obi-sdk 0.18.19 → 0.18.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- (function(){"use strict";function uf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uo={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,A="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(A=!1));function i(o,c,l){this.fn=o,this.context=c,this.once=l||!1}function r(o,c,l,u,d){if(typeof l!="function")throw new TypeError("The listener must be a function");var h=new i(l,u||o,d),p=A?A+c:c;return o._events[p]?o._events[p].fn?o._events[p]=[o._events[p],h]:o._events[p].push(h):(o._events[p]=h,o._eventsCount++),o}function s(o,c){--o._eventsCount===0?o._events=new n:delete o._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)e.call(l,u)&&c.push(A?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},a.prototype.listeners=function(c){var l=A?A+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,h=u.length,p=new Array(h);d<h;d++)p[d]=u[d].fn;return p},a.prototype.listenerCount=function(c){var l=A?A+c:c,u=this._events[l];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,l,u,d,h,p){var f=A?A+c:c;if(!this._events[f])return!1;var m=this._events[f],B=arguments.length,b,U;if(m.fn){switch(m.once&&this.removeListener(c,m.fn,void 0,!0),B){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,l),!0;case 3:return m.fn.call(m.context,l,u),!0;case 4:return m.fn.call(m.context,l,u,d),!0;case 5:return m.fn.call(m.context,l,u,d,h),!0;case 6:return m.fn.call(m.context,l,u,d,h,p),!0}for(U=1,b=new Array(B-1);U<B;U++)b[U-1]=arguments[U];m.fn.apply(m.context,b)}else{var w=m.length,v;for(U=0;U<w;U++)switch(m[U].once&&this.removeListener(c,m[U].fn,void 0,!0),B){case 1:m[U].fn.call(m[U].context);break;case 2:m[U].fn.call(m[U].context,l);break;case 3:m[U].fn.call(m[U].context,l,u);break;case 4:m[U].fn.call(m[U].context,l,u,d);break;default:if(!b)for(v=1,b=new Array(B-1);v<B;v++)b[v-1]=arguments[v];m[U].fn.apply(m[U].context,b)}}return!0},a.prototype.on=function(c,l,u){return r(this,c,l,u,!1)},a.prototype.once=function(c,l,u){return r(this,c,l,u,!0)},a.prototype.removeListener=function(c,l,u,d){var h=A?A+c:c;if(!this._events[h])return this;if(!l)return s(this,h),this;var p=this._events[h];if(p.fn)p.fn===l&&(!d||p.once)&&(!u||p.context===u)&&s(this,h);else{for(var f=0,m=[],B=p.length;f<B;f++)(p[f].fn!==l||d&&!p[f].once||u&&p[f].context!==u)&&m.push(p[f]);m.length?this._events[h]=m.length===1?m[0]:m:s(this,h)}return this},a.prototype.removeAllListeners=function(c){var l;return c?(l=A?A+c:c,this._events[l]&&s(this,l)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=A,a.EventEmitter=a,t.exports=a})(uo);var df=uo.exports;const kr=uf(df);/*!
1
+ (function(){"use strict";function uf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var uo={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,A="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(A=!1));function i(o,c,l){this.fn=o,this.context=c,this.once=l||!1}function r(o,c,l,u,d){if(typeof l!="function")throw new TypeError("The listener must be a function");var h=new i(l,u||o,d),g=A?A+c:c;return o._events[g]?o._events[g].fn?o._events[g]=[o._events[g],h]:o._events[g].push(h):(o._events[g]=h,o._eventsCount++),o}function s(o,c){--o._eventsCount===0?o._events=new n:delete o._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],l,u;if(this._eventsCount===0)return c;for(u in l=this._events)e.call(l,u)&&c.push(A?u.slice(1):u);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(l)):c},a.prototype.listeners=function(c){var l=A?A+c:c,u=this._events[l];if(!u)return[];if(u.fn)return[u.fn];for(var d=0,h=u.length,g=new Array(h);d<h;d++)g[d]=u[d].fn;return g},a.prototype.listenerCount=function(c){var l=A?A+c:c,u=this._events[l];return u?u.fn?1:u.length:0},a.prototype.emit=function(c,l,u,d,h,g){var f=A?A+c:c;if(!this._events[f])return!1;var m=this._events[f],B=arguments.length,b,U;if(m.fn){switch(m.once&&this.removeListener(c,m.fn,void 0,!0),B){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,l),!0;case 3:return m.fn.call(m.context,l,u),!0;case 4:return m.fn.call(m.context,l,u,d),!0;case 5:return m.fn.call(m.context,l,u,d,h),!0;case 6:return m.fn.call(m.context,l,u,d,h,g),!0}for(U=1,b=new Array(B-1);U<B;U++)b[U-1]=arguments[U];m.fn.apply(m.context,b)}else{var C=m.length,w;for(U=0;U<C;U++)switch(m[U].once&&this.removeListener(c,m[U].fn,void 0,!0),B){case 1:m[U].fn.call(m[U].context);break;case 2:m[U].fn.call(m[U].context,l);break;case 3:m[U].fn.call(m[U].context,l,u);break;case 4:m[U].fn.call(m[U].context,l,u,d);break;default:if(!b)for(w=1,b=new Array(B-1);w<B;w++)b[w-1]=arguments[w];m[U].fn.apply(m[U].context,b)}}return!0},a.prototype.on=function(c,l,u){return r(this,c,l,u,!1)},a.prototype.once=function(c,l,u){return r(this,c,l,u,!0)},a.prototype.removeListener=function(c,l,u,d){var h=A?A+c:c;if(!this._events[h])return this;if(!l)return s(this,h),this;var g=this._events[h];if(g.fn)g.fn===l&&(!d||g.once)&&(!u||g.context===u)&&s(this,h);else{for(var f=0,m=[],B=g.length;f<B;f++)(g[f].fn!==l||d&&!g[f].once||u&&g[f].context!==u)&&m.push(g[f]);m.length?this._events[h]=m.length===1?m[0]:m:s(this,h)}return this},a.prototype.removeAllListeners=function(c){var l;return c?(l=A?A+c:c,this._events[l]&&s(this,l)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=A,a.EventEmitter=a,t.exports=a})(uo);var df=uo.exports;const kr=uf(df);/*!
2
2
  * html2canvas-pro 1.5.11 <https://yorickshan.github.io/html2canvas-pro/>
3
3
  * Copyright (c) 2024-present yorickshan and html2canvas-pro contributors
4
4
  * Released under MIT License
5
- */var Tr=function(t,e){return Tr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,n){A.__proto__=n}||function(A,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(A[i]=n[i])},Tr(t,e)};function iA(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Tr(t,e);function A(){this.constructor=t}t.prototype=e===null?Object.create(e):(A.prototype=e.prototype,new A)}var Fr=function(){return Fr=Object.assign||function(e){for(var A,n=1,i=arguments.length;n<i;n++){A=arguments[n];for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(e[r]=A[r])}return e},Fr.apply(this,arguments)};function Re(t,e,A,n){function i(r){return r instanceof A?r:new A(function(s){s(r)})}return new(A||(A=Promise))(function(r,s){function a(l){try{c(n.next(l))}catch(u){s(u)}}function o(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(a,o)}c((n=n.apply(t,e||[])).next())})}function xe(t,e){var A={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(l){return o([c,l])}}function o(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(A=0)),A;)try{if(n=1,i&&(r=c[0]&2?i.return:c[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,c[1])).done)return r;switch(i=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return A.label++,{value:c[1],done:!1};case 5:A.label++,i=c[1],c=[0];continue;case 7:c=A.ops.pop(),A.trys.pop();continue;default:if(r=A.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){A=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){A.label=c[1];break}if(c[0]===6&&A.label<r[1]){A.label=r[1],r=c;break}if(r&&A.label<r[2]){A.label=r[2],A.ops.push(c);break}r[2]&&A.ops.pop(),A.trys.pop();continue}c=e.call(t,A)}catch(l){c=[6,l],i=0}finally{n=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Dn(t,e,A){if(A||arguments.length===2)for(var n=0,i=e.length,r;n<i;n++)(r||!(n in e))&&(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;for(var EA=function(){function t(e,A,n,i){this.left=e,this.top=A,this.width=n,this.height=i}return t.prototype.add=function(e,A,n,i){return new t(this.left+e,this.top+A,this.width+n,this.height+i)},t.fromClientRect=function(e,A){return new t(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height)},t.fromDOMRectList=function(e,A){var n=Array.from(A).find(function(i){return i.width!==0});return n?new t(n.left+e.windowBounds.left,n.top+e.windowBounds.top,n.width,n.height):t.EMPTY},t.EMPTY=new t(0,0,0,0),t}(),Hn=function(t,e){return EA.fromClientRect(t,e.getBoundingClientRect())},hf=function(t){var e=t.body,A=t.documentElement;if(!e||!A)throw new Error("Unable to get document size");var n=Math.max(Math.max(e.scrollWidth,A.scrollWidth),Math.max(e.offsetWidth,A.offsetWidth),Math.max(e.clientWidth,A.clientWidth)),i=Math.max(Math.max(e.scrollHeight,A.scrollHeight),Math.max(e.offsetHeight,A.offsetHeight),Math.max(e.clientHeight,A.clientHeight));return new EA(0,0,n,i)},On=function(t){for(var e=[],A=0,n=t.length;A<n;){var i=t.charCodeAt(A++);if(i>=55296&&i<=56319&&A<n){var r=t.charCodeAt(A++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},he=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var A=t.length;if(!A)return"";for(var n=[],i=-1,r="";++i<A;){var s=t[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===A||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},ho="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ff=typeof Uint8Array>"u"?[]:new Uint8Array(256),Mn=0;Mn<ho.length;Mn++)ff[ho.charCodeAt(Mn)]=Mn;for(var fo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$t=typeof Uint8Array>"u"?[]:new Uint8Array(256),Nn=0;Nn<fo.length;Nn++)$t[fo.charCodeAt(Nn)]=Nn;for(var gf=function(t){var e=t.length*.75,A=t.length,n,i=0,r,s,a,o;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<A;n+=4)r=$t[t.charCodeAt(n)],s=$t[t.charCodeAt(n+1)],a=$t[t.charCodeAt(n+2)],o=$t[t.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|a>>2,l[i++]=(a&3)<<6|o&63;return c},pf=function(t){for(var e=t.length,A=[],n=0;n<e;n+=2)A.push(t[n+1]<<8|t[n]);return A},mf=function(t){for(var e=t.length,A=[],n=0;n<e;n+=4)A.push(t[n+3]<<24|t[n+2]<<16|t[n+1]<<8|t[n]);return A},rt=5,Ir=6+5,xr=2,Bf=Ir-rt,go=65536>>rt,vf=1<<rt,_r=vf-1,Cf=1024>>rt,wf=go+Cf,bf=wf,yf=32,Uf=bf+yf,Qf=65536>>Ir,Ef=1<<Bf,Sf=Ef-1,po=function(t,e,A){return t.slice?t.slice(e,A):new Uint16Array(Array.prototype.slice.call(t,e,A))},kf=function(t,e,A){return t.slice?t.slice(e,A):new Uint32Array(Array.prototype.slice.call(t,e,A))},Tf=function(t,e){var A=gf(t),n=Array.isArray(A)?mf(A):new Uint32Array(A),i=Array.isArray(A)?pf(A):new Uint16Array(A),r=24,s=po(i,r/2,n[4]/2),a=n[5]===2?po(i,(r+n[4])/2):kf(n,Math.ceil((r+n[4])/4));return new Ff(n[0],n[1],n[2],n[3],s,a)},Ff=function(){function t(e,A,n,i,r,s){this.initialValue=e,this.errorValue=A,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return t.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>rt],A=(A<<xr)+(e&_r),this.data[A];if(e<=65535)return A=this.index[go+(e-55296>>rt)],A=(A<<xr)+(e&_r),this.data[A];if(e<this.highStart)return A=Uf-Qf+(e>>Ir),A=this.index[A],A+=e>>rt&Sf,A=this.index[A],A=(A<<xr)+(e&_r),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),mo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",If=typeof Uint8Array>"u"?[]:new Uint8Array(256),Kn=0;Kn<mo.length;Kn++)If[mo.charCodeAt(Kn)]=Kn;var xf="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Bo=50,_f=1,vo=2,Co=3,Pf=4,Rf=5,wo=7,bo=8,yo=9,LA=10,Pr=11,Uo=12,Rr=13,Lf=14,en=15,Lr=16,Vn=17,An=18,Df=19,Qo=20,Dr=21,tn=22,Hr=23,yt=24,Xe=25,nn=26,rn=27,Ut=28,Hf=29,st=30,Of=31,Gn=32,jn=33,Or=34,Mr=35,Nr=36,sn=37,Kr=38,Wn=39,Jn=40,Vr=41,Eo=42,Mf=43,Nf=[9001,65288],So="!",G="×",Xn="÷",Gr=Tf(xf),SA=[st,Nr],jr=[_f,vo,Co,Rf],ko=[LA,bo],To=[rn,nn],Kf=jr.concat(ko),Fo=[Kr,Wn,Jn,Or,Mr],Vf=[en,Rr],Gf=function(t,e){e===void 0&&(e="strict");var A=[],n=[],i=[];return t.forEach(function(r,s){var a=Gr.get(r);if(a>Bo?(i.push(!0),a-=Bo):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(r)!==-1)return n.push(s),A.push(Lr);if(a===Pf||a===Pr){if(s===0)return n.push(s),A.push(st);var o=A[s-1];return Kf.indexOf(o)===-1?(n.push(n[s-1]),A.push(o)):(n.push(s),A.push(st))}if(n.push(s),a===Of)return A.push(e==="strict"?Dr:sn);if(a===Eo||a===Hf)return A.push(st);if(a===Mf)return r>=131072&&r<=196605||r>=196608&&r<=262141?A.push(sn):A.push(st);A.push(a)}),[n,A,i]},Wr=function(t,e,A,n){var i=n[A];if(Array.isArray(t)?t.indexOf(i)!==-1:t===i)for(var r=A;r<=n.length;){r++;var s=n[r];if(s===e)return!0;if(s!==LA)break}if(i===LA)for(var r=A;r>0;){r--;var a=n[r];if(Array.isArray(t)?t.indexOf(a)!==-1:t===a)for(var o=A;o<=n.length;){o++;var s=n[o];if(s===e)return!0;if(s!==LA)break}if(a!==LA)break}return!1},Io=function(t,e){for(var A=t;A>=0;){var n=e[A];if(n===LA)A--;else return n}return 0},jf=function(t,e,A,n,i){if(A[n]===0)return G;var r=n-1;if(Array.isArray(i)&&i[r]===!0)return G;var s=r-1,a=r+1,o=e[r],c=s>=0?e[s]:0,l=e[a];if(o===vo&&l===Co)return G;if(jr.indexOf(o)!==-1)return So;if(jr.indexOf(l)!==-1||ko.indexOf(l)!==-1)return G;if(Io(r,e)===bo)return Xn;if(Gr.get(t[r])===Pr||(o===Gn||o===jn)&&Gr.get(t[a])===Pr||o===wo||l===wo||o===yo||[LA,Rr,en].indexOf(o)===-1&&l===yo||[Vn,An,Df,yt,Ut].indexOf(l)!==-1||Io(r,e)===tn||Wr(Hr,tn,r,e)||Wr([Vn,An],Dr,r,e)||Wr(Uo,Uo,r,e))return G;if(o===LA)return Xn;if(o===Hr||l===Hr)return G;if(l===Lr||o===Lr)return Xn;if([Rr,en,Dr].indexOf(l)!==-1||o===Lf||c===Nr&&Vf.indexOf(o)!==-1||o===Ut&&l===Nr||l===Qo||SA.indexOf(l)!==-1&&o===Xe||SA.indexOf(o)!==-1&&l===Xe||o===rn&&[sn,Gn,jn].indexOf(l)!==-1||[sn,Gn,jn].indexOf(o)!==-1&&l===nn||SA.indexOf(o)!==-1&&To.indexOf(l)!==-1||To.indexOf(o)!==-1&&SA.indexOf(l)!==-1||[rn,nn].indexOf(o)!==-1&&(l===Xe||[tn,en].indexOf(l)!==-1&&e[a+1]===Xe)||[tn,en].indexOf(o)!==-1&&l===Xe||o===Xe&&[Xe,Ut,yt].indexOf(l)!==-1)return G;if([Xe,Ut,yt,Vn,An].indexOf(l)!==-1)for(var u=r;u>=0;){var d=e[u];if(d===Xe)return G;if([Ut,yt].indexOf(d)!==-1)u--;else break}if([rn,nn].indexOf(l)!==-1)for(var u=[Vn,An].indexOf(o)!==-1?s:r;u>=0;){var d=e[u];if(d===Xe)return G;if([Ut,yt].indexOf(d)!==-1)u--;else break}if(Kr===o&&[Kr,Wn,Or,Mr].indexOf(l)!==-1||[Wn,Or].indexOf(o)!==-1&&[Wn,Jn].indexOf(l)!==-1||[Jn,Mr].indexOf(o)!==-1&&l===Jn||Fo.indexOf(o)!==-1&&[Qo,nn].indexOf(l)!==-1||Fo.indexOf(l)!==-1&&o===rn||SA.indexOf(o)!==-1&&SA.indexOf(l)!==-1||o===yt&&SA.indexOf(l)!==-1||SA.concat(Xe).indexOf(o)!==-1&&l===tn&&Nf.indexOf(t[a])===-1||SA.concat(Xe).indexOf(l)!==-1&&o===An)return G;if(o===Vr&&l===Vr){for(var h=A[r],p=1;h>0&&(h--,e[h]===Vr);)p++;if(p%2!==0)return G}return o===Gn&&l===jn?G:Xn},Wf=function(t,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var A=Gf(t,e.lineBreak),n=A[0],i=A[1],r=A[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[Xe,st,Eo].indexOf(a)!==-1?sn:a}));var s=e.wordBreak==="keep-all"?r.map(function(a,o){return a&&t[o]>=19968&&t[o]<=40959}):void 0;return[n,i,s]},Jf=function(){function t(e,A,n,i){this.codePoints=e,this.required=A===So,this.start=n,this.end=i}return t.prototype.slice=function(){return he.apply(void 0,this.codePoints.slice(this.start,this.end))},t}(),Xf=function(t,e){var A=On(t),n=Wf(A,e),i=n[0],r=n[1],s=n[2],a=A.length,o=0,c=0;return{next:function(){if(c>=a)return{done:!0,value:null};for(var l=G;c<a&&(l=jf(A,r,i,++c,s))===G;);if(l!==G||c===a){var u=new Jf(A,l,o,c);return o=c,{value:u,done:!1}}return{done:!0,value:null}}}},qf=1,Yf=2,an=4,xo=8,qn=10,_o=47,on=92,zf=9,Zf=32,Yn=34,cn=61,$f=35,eg=36,Ag=37,zn=39,Zn=40,ln=41,tg=95,De=45,ng=33,ig=60,rg=62,sg=64,ag=91,og=93,cg=61,lg=123,$n=63,ug=125,Po=124,dg=126,hg=128,Ro=65533,Jr=42,at=43,fg=44,gg=58,pg=59,un=46,mg=0,Bg=8,vg=11,Cg=14,wg=31,bg=127,pA=-1,Lo=48,Do=97,Ho=101,yg=102,Ug=117,Qg=122,Oo=65,Mo=69,No=70,Eg=85,Sg=90,_e=function(t){return t>=Lo&&t<=57},kg=function(t){return t>=55296&&t<=57343},Qt=function(t){return _e(t)||t>=Oo&&t<=No||t>=Do&&t<=yg},Tg=function(t){return t>=Do&&t<=Qg},Fg=function(t){return t>=Oo&&t<=Sg},Ig=function(t){return Tg(t)||Fg(t)},xg=function(t){return t>=hg},ei=function(t){return t===qn||t===zf||t===Zf},Ai=function(t){return Ig(t)||xg(t)||t===tg},Ko=function(t){return Ai(t)||_e(t)||t===De},_g=function(t){return t>=mg&&t<=Bg||t===vg||t>=Cg&&t<=wg||t===bg},DA=function(t,e){return t!==on?!1:e!==qn},ti=function(t,e,A){return t===De?Ai(e)||DA(e,A):Ai(t)?!0:!!(t===on&&DA(t,e))},Xr=function(t,e,A){return t===at||t===De?_e(e)?!0:e===un&&_e(A):_e(t===un?e:t)},Pg=function(t){var e=0,A=1;(t[e]===at||t[e]===De)&&(t[e]===De&&(A=-1),e++);for(var n=[];_e(t[e]);)n.push(t[e++]);var i=n.length?parseInt(he.apply(void 0,n),10):0;t[e]===un&&e++;for(var r=[];_e(t[e]);)r.push(t[e++]);var s=r.length,a=s?parseInt(he.apply(void 0,r),10):0;(t[e]===Mo||t[e]===Ho)&&e++;var o=1;(t[e]===at||t[e]===De)&&(t[e]===De&&(o=-1),e++);for(var c=[];_e(t[e]);)c.push(t[e++]);var l=c.length?parseInt(he.apply(void 0,c),10):0;return A*(i+a*Math.pow(10,-s))*Math.pow(10,o*l)},Rg={type:2},Lg={type:3},Dg={type:4},Hg={type:13},Og={type:8},Mg={type:21},Ng={type:9},Kg={type:10},Vg={type:11},Gg={type:12},jg={type:14},ni={type:23},Wg={type:1},Jg={type:25},Xg={type:24},qg={type:26},Yg={type:27},zg={type:28},Zg={type:29},$g={type:31},qr={type:32},Vo=function(){function t(){this._value=[]}return t.prototype.write=function(e){this._value=this._value.concat(On(e))},t.prototype.read=function(){for(var e=[],A=this.consumeToken();A!==qr;)e.push(A),A=this.consumeToken();return e},t.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Yn:return this.consumeStringToken(Yn);case $f:var A=this.peekCodePoint(0),n=this.peekCodePoint(1),i=this.peekCodePoint(2);if(Ko(A)||DA(n,i)){var r=ti(A,n,i)?Yf:qf,s=this.consumeName();return{type:5,value:s,flags:r}}break;case eg:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Hg;break;case zn:return this.consumeStringToken(zn);case Zn:return Rg;case ln:return Lg;case Jr:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),jg;break;case at:if(Xr(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case fg:return Dg;case De:var a=e,o=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Xr(a,o,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(ti(a,o,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(o===De&&c===rg)return this.consumeCodePoint(),this.consumeCodePoint(),Xg;break;case un:if(Xr(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case _o:if(this.peekCodePoint(0)===Jr)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Jr&&(l=this.consumeCodePoint(),l===_o))return this.consumeToken();if(l===pA)return this.consumeToken()}break;case gg:return qg;case pg:return Yg;case ig:if(this.peekCodePoint(0)===ng&&this.peekCodePoint(1)===De&&this.peekCodePoint(2)===De)return this.consumeCodePoint(),this.consumeCodePoint(),Jg;break;case sg:var u=this.peekCodePoint(0),d=this.peekCodePoint(1),h=this.peekCodePoint(2);if(ti(u,d,h)){var s=this.consumeName();return{type:7,value:s}}break;case ag:return zg;case on:if(DA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case og:return Zg;case cg:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Og;break;case lg:return Vg;case ug:return Gg;case Ug:case Eg:var p=this.peekCodePoint(0),f=this.peekCodePoint(1);return p===at&&(Qt(f)||f===$n)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Po:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Ng;if(this.peekCodePoint(0)===Po)return this.consumeCodePoint(),Mg;break;case dg:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Kg;break;case pA:return qr}return ei(e)?(this.consumeWhiteSpace(),$g):_e(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Ai(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:he(e)}},t.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},t.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},t.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},t.prototype.consumeUnicodeRangeToken=function(){for(var e=[],A=this.consumeCodePoint();Qt(A)&&e.length<6;)e.push(A),A=this.consumeCodePoint();for(var n=!1;A===$n&&e.length<6;)e.push(A),A=this.consumeCodePoint(),n=!0;if(n){var i=parseInt(he.apply(void 0,e.map(function(o){return o===$n?Lo:o})),16),r=parseInt(he.apply(void 0,e.map(function(o){return o===$n?No:o})),16);return{type:30,start:i,end:r}}var s=parseInt(he.apply(void 0,e),16);if(this.peekCodePoint(0)===De&&Qt(this.peekCodePoint(1))){this.consumeCodePoint(),A=this.consumeCodePoint();for(var a=[];Qt(A)&&a.length<6;)a.push(A),A=this.consumeCodePoint();var r=parseInt(he.apply(void 0,a),16);return{type:30,start:s,end:r}}else return{type:30,start:s,end:s}},t.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Zn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Zn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},t.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===pA)return{type:22,value:""};var A=this.peekCodePoint(0);if(A===zn||A===Yn){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===pA||this.peekCodePoint(0)===ln)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),ni)}for(;;){var i=this.consumeCodePoint();if(i===pA||i===ln)return{type:22,value:he.apply(void 0,e)};if(ei(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===pA||this.peekCodePoint(0)===ln?(this.consumeCodePoint(),{type:22,value:he.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ni);if(i===Yn||i===zn||i===Zn||_g(i))return this.consumeBadUrlRemnants(),ni;if(i===on)if(DA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ni;else e.push(i)}},t.prototype.consumeWhiteSpace=function(){for(;ei(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ln||e===pA)return;DA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(e){for(var A=5e4,n="";e>0;){var i=Math.min(A,e);n+=he.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),n},t.prototype.consumeStringToken=function(e){var A="",n=0;do{var i=this._value[n];if(i===pA||i===void 0||i===e)return A+=this.consumeStringSlice(n),{type:0,value:A};if(i===qn)return this._value.splice(0,n),Wg;if(i===on){var r=this._value[n+1];r!==pA&&r!==void 0&&(r===qn?(A+=this.consumeStringSlice(n),n=-1,this._value.shift()):DA(i,r)&&(A+=this.consumeStringSlice(n),A+=he(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},t.prototype.consumeNumber=function(){var e=[],A=an,n=this.peekCodePoint(0);for((n===at||n===De)&&e.push(this.consumeCodePoint());_e(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(n===un&&_e(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=xo;_e(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),i=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((n===Mo||n===Ho)&&((i===at||i===De)&&_e(r)||_e(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=xo;_e(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Pg(e),A]},t.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),A=e[0],n=e[1],i=this.peekCodePoint(0),r=this.peekCodePoint(1),s=this.peekCodePoint(2);if(ti(i,r,s)){var a=this.consumeName();return{type:15,number:A,flags:n,unit:a}}return i===Ag?(this.consumeCodePoint(),{type:16,number:A,flags:n}):{type:17,number:A,flags:n}},t.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Qt(e)){for(var A=he(e);Qt(this.peekCodePoint(0))&&A.length<6;)A+=he(this.consumeCodePoint());ei(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(A,16);return n===0||kg(n)||n>1114111?Ro:n}return e===pA?Ro:e},t.prototype.consumeName=function(){for(var e="";;){var A=this.consumeCodePoint();if(Ko(A))e+=he(A);else if(DA(A,this.peekCodePoint(0)))e+=he(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(A),e}},t}(),Go=function(){function t(e){this._tokens=e}return t.create=function(e){var A=new Vo;return A.write(e),new t(A.read())},t.parseValue=function(e){return t.create(e).parseComponentValue()},t.parseValues=function(e){return t.create(e).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var A=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return A;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var e=[];;){var A=this.consumeComponentValue();if(A.type===32)return e;e.push(A),e.push()}},t.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},t.prototype.consumeSimpleBlock=function(e){for(var A={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||Ap(n,e))return A;this.reconsumeToken(n),A.values.push(this.consumeComponentValue()),n=this.consumeToken()}},t.prototype.consumeFunction=function(e){for(var A={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return A;this.reconsumeToken(n),A.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?qr:e},t.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},t}(),HA=function(t){return t.type===15},me=function(t){return t.type===17},j=function(t){return t.type===20},ep=function(t){return t.type===0},Yr=function(t,e){return j(t)&&t.value===e},jo=function(t){return t.type!==31},Ee=function(t){return t.type!==31&&t.type!==4},mA=function(t){var e=[],A=[];return t.forEach(function(n){if(n.type===4){if(A.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(A),A=[];return}n.type!==31&&A.push(n)}),A.length&&e.push(A),e},Ap=function(t,e){return e===11&&t.type===12||e===28&&t.type===29?!0:e===2&&t.type===3},OA=function(t){return t.type===17||t.type===15},te=function(t){return t.type===16||OA(t)},Wo=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},Se={type:17,number:0,flags:an},zr={type:16,number:50,flags:an},MA={type:16,number:100,flags:an},dn=function(t,e,A){var n=t[0],i=t[1];return[$(n,e),$(typeof i<"u"?i:n,A)]},$=function(t,e){if(t.type===16)return t.number/100*e;if(HA(t))switch(t.unit){case"rem":case"em":return 16*t.number;case"px":default:return t.number}return t.number},Jo="deg",Xo="grad",qo="rad",Yo="turn",ii={name:"angle",parse:function(t,e){if(e.type===15)switch(e.unit){case Jo:return Math.PI*e.number/180;case Xo:return Math.PI/200*e.number;case qo:return e.number;case Yo:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},zo=function(t){return t.type===15&&(t.unit===Jo||t.unit===Xo||t.unit===qo||t.unit===Yo)},Zo=function(t){var e=t.filter(j).map(function(A){return A.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Se,Se];case"to top":case"bottom":return ze(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Se,MA];case"to right":case"left":return ze(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[MA,MA];case"to bottom":case"top":return ze(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[MA,Se];case"to left":case"right":return ze(270)}return 0},ze=function(t){return Math.PI*t/180},NA=function(t){return(255&t)===0},Ue=function(t){var e=255&t,A=255&t>>8,n=255&t>>16,i=255&t>>24;return e<255?"rgba(".concat(i,",").concat(n,",").concat(A,",").concat(e/255,")"):"rgb(".concat(i,",").concat(n,",").concat(A,")")},BA=function(t,e,A,n){return(t<<24|e<<16|A<<8|Math.round(n*255)<<0)>>>0},ri=function(t,e){if(t.type===17)return t.number;if(t.type===16){var A=e===3?1:255;return e===3?t.number/100*A:Math.round(t.number/100*A)}return 0},ot=function(t){return(t[0].type===20?t[0].value:"unknown")==="from"},ce=function(t,e,A){return Math.min(Math.max(t,e),A)},He=function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},tp=function(t){return BA(ce(Math.round(t[0]*255),0,255),ce(Math.round(t[1]*255),0,255),ce(Math.round(t[2]*255),0,255),ce(t[3],0,1))},Zr=function(t){var e=t[0],A=t[1],n=t[2],i=t[3],r=ct([e,A,n]);return BA(ce(Math.round(r[0]*255),0,255),ce(Math.round(r[1]*255),0,255),ce(Math.round(r[2]*255),0,255),i)},hn=function(t){var e=KA([t[0],t[1],t[2]]);return Zr([e[0],e[1],e[2],t[3]])},np=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for lab()");var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(ci([n,i,r])));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},ip=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for oklab()");var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(oi([n,i,r])));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},rp=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for oklch()");var A=tc(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(oi(ai([n,i,r]))));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},sp=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for lch()");var A=Ac(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(ci(ai([n,i,r]))));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},$o=function(t,e){var A=e.filter(Ee),n=A[0],i=A[1],r=A[2],s=A[3],a=(n.type===17?ze(n.number):ii.parse(t,n))/(Math.PI*2),o=te(i)?i.number/100:0,c=te(r)?r.number/100:0,l=typeof s<"u"&&te(s)?$(s,1):1;return[a,o,c,l]},ec=function(t,e){if(ot(e))throw new Error("Relative color not supported for hsl()");var A=$o(t,e),n=A[0],i=A[1],r=A[2],s=A[3],a=ic([n,i,r]);return BA(a[0]*255,a[1]*255,a[2]*255,i===0?1:s)},Ac=function(t){var e=t.filter(Ee),A=te(e[0])?e[0].number:0,n=te(e[1])?e[1].number:0,i=me(e[2])||HA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&te(e[4])?$(e[4],1):1;return[A,n,i,r]},si=function(t){var e=t.filter(Ee),A=e[0].type===16?e[0].number/100:me(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:me(e[1])?e[1].number:0,i=me(e[2])||HA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&te(e[4])?$(e[4],1):1;return[A,n,i,r]},tc=function(t){var e=t.filter(Ee),A=e[0].type===16?e[0].number/100:me(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:me(e[1])?e[1].number:0,i=me(e[2])||HA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&te(e[4])?$(e[4],1):1;return[A,n,i,r]},nc=function(t){return He([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],t)},$r=function(t){return He([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],t)},es=function(t,e,A){return A<0&&(A+=1),A>=1&&(A-=1),A<1/6?(e-t)*A*6+t:A<1/2?e:A<2/3?(e-t)*6*(2/3-A)+t:t},ic=function(t){var e=t[0],A=t[1],n=t[2];if(A===0)return[n*255,n*255,n*255];var i=n<=.5?n*(A+1):n+A-n*A,r=n*2-i,s=es(r,i,e+1/3),a=es(r,i,e),o=es(r,i,e-1/3);return[s,a,o]},ai=function(t){var e=t[0],A=t[1],n=t[2];return A<0&&(A=0),isNaN(n)&&(n=0),[e,A*Math.cos(n*Math.PI/180),A*Math.sin(n*Math.PI/180)]},oi=function(t){var e=He([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],t),A=e.map(function(n){return Math.pow(n,3)});return He([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],A)},ci=function(t){var e=(t[0]+16)/116,A=t[1]/500+e,n=e-t[2]/200,i=24389/27,r=24/116,s=[(A>r?Math.pow(A,3):(116*A-16)/i)*.3457/.3585,t[0]>8?Math.pow(e,3):t[0]/i,(n>r?Math.pow(n,3):(116*n-16)/i)*(1-.3457-.3585)/.3585];return $r([s[0],s[1],s[2]])},ap=function(t,e){var A=e.filter(Ee);if(A.length===3){var n=A.map(ri),i=n[0],r=n[1],s=n[2],a=ts([i/255,r/255,s/255]),o=As([a[0],a[1],a[2]]),c=o[0],l=o[1],u=o[2];return[c,l,u,1]}if(A.length===4){var d=A.map(ri),i=d[0],r=d[1],s=d[2],h=d[3],a=ts([i/255,r/255,s/255]),p=As([a[0],a[1],a[2]]),c=p[0],l=p[1],u=p[2];return[c,l,u,h]}return[0,0,0,1]},op=function(t,e){var A=$o(t,e),n=A[0],i=A[1],r=A[2],s=A[3],a=ts(ic([n,i,r])),o=As([a[0],a[1],a[2]]),c=o[0],l=o[1],u=o[2];return[c,l,u,s]},cp=function(t,e){var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ci([n,i,r]),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},lp=function(t,e){var A=Ac(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ci(ai([n,i,r])),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},up=function(t,e){var A=tc(e),n=A[0],i=A[1],r=A[2],s=A[3],a=oi(ai([n,i,r])),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},dp=function(t,e){var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=oi([n,i,r]),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},hp=function(t){return $r([t[0],t[1],t[2]])},rc=function(t){return t},fp=function(t){var e=nc([t[0],t[2],t[3]]),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},sc=function(t){return hn([t[0],t[1],t[2],t[3]])},gp=function(t){var e=hp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},KA=function(t){return He([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],t)},As=function(t){return He([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],t)},ct=function(t){return t.map(function(e){var A=e<0?-1:1,n=Math.abs(e);return n>.0031308?A*(1.055*Math.pow(n,1/2.4)-.055):12.92*e})},ts=function(t){return t.map(function(e){var A=e<0?-1:1,n=Math.abs(e);return n<=.04045?e/12.92:A*Math.pow((n+.055)/1.055,2.4)})},pp=function(t){var e=ct(KA([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},mp=function(t){var e=KA([t[0],t[1],t[2]]),A=e[0],n=e[1],i=e[2];return[ce(Math.round(A*255),0,255),ce(Math.round(n*255),0,255),ce(Math.round(i*255),0,255),t[3]]},Bp=function(t){return He([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],t)},vp=function(t){return He([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],t)},Cp=function(t){return t.map(function(e){var A=e<0?-1:1,n=e*A;return n<=.04045?e/12.92:A*Math.pow((e+.055)/1.055,2.4)||0})},wp=function(t){return ct(t)},bp=function(t){var e=Cp([t[0],t[1],t[2]]);return Bp([e[0],e[1],e[2]])},yp=function(t){var e=wp(vp([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Up=function(t){var e=bp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},Qp=function(t){return He([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],t)},Ep=function(t){return He([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],t)},Sp=function(t){var e=t.map(function(A){var n=A<0?-1:1,i=Math.abs(A);return n*Math.pow(i,2.19921875)});return[e[0],e[1],e[2]]},kp=function(t){var e=t.map(function(A){var n=A<0?-1:1,i=Math.abs(A);return n*Math.pow(i,.4547069271758437)});return[e[0],e[1],e[2]]},Tp=function(t){var e=kp(Qp([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Fp=function(t){var e=KA(Ep(Sp([t[0],t[1],t[2]])));return Zr([e[0],e[1],e[2],t[3]])},Ip=function(t){return He([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],t)},xp=function(t){return He([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],t)},_p=function(t){return t.map(function(e){return e<16/512?e/16:Math.pow(e,1.8)})},Pp=function(t){return t.map(function(e){return e>1/512?Math.pow(e,1/1.8):e*16})},Rp=function(t){var e=_p([t[0],t[1],t[2]]);return $r(Ip([e[0],e[1],e[2]]))},Lp=function(t){var e=Pp(xp(nc([t[0],t[1],t[2]]))),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Dp=function(t){var e=Rp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},li=1.09929682680944,ac=.018053968510807,Hp=function(t){return t.map(function(e){return e<ac*4.5?e/4.5:Math.pow((e+li-1)/li,1/.45)})},Op=function(t){return t.map(function(e){return e>=ac?li*Math.pow(e,.45)-(li-1):4.5*e})},Mp=function(t){return He([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],t)},Np=function(t){return He([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],t)},Kp=function(t){var e=Hp([t[0],t[1],t[2]]);return Mp([e[0],e[1],e[2]])},Vp=function(t){var e=Op(Np([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Gp=function(t){var e=Kp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},VA={name:"color",parse:function(t,e){if(e.type===18){var A=Xp[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported color function "'.concat(e.name,'"'));return A(t,e.values)}if(e.type===5){var n=oc(e),i=n[0],r=n[1],s=n[2],a=n[3];return BA(i,r,s,a)}if(e.type===20){var o=vA[e.value.toUpperCase()];if(typeof o<"u")return o}return vA.TRANSPARENT}},oc=function(t){if(t.value.length===3){var e=t.value.substring(0,1),A=t.value.substring(1,2),n=t.value.substring(2,3);return[parseInt(e+e,16),parseInt(A+A,16),parseInt(n+n,16),1]}if(t.value.length===4){var e=t.value.substring(0,1),A=t.value.substring(1,2),n=t.value.substring(2,3),i=t.value.substring(3,4);return[parseInt(e+e,16),parseInt(A+A,16),parseInt(n+n,16),parseInt(i+i,16)/255]}if(t.value.length===6){var e=t.value.substring(0,2),A=t.value.substring(2,4),n=t.value.substring(4,6);return[parseInt(e,16),parseInt(A,16),parseInt(n,16),1]}if(t.value.length===8){var e=t.value.substring(0,2),A=t.value.substring(2,4),n=t.value.substring(4,6),i=t.value.substring(6,8);return[parseInt(e,16),parseInt(A,16),parseInt(n,16),parseInt(i,16)/255]}return[0,0,0,1]},cc=function(t,e){var A=e.filter(Ee);if(ot(A))throw new Error("Relative color not supported for rgb()");if(A.length===3){var n=A.map(ri),i=n[0],r=n[1],s=n[2];return BA(i,r,s,1)}if(A.length===4){var a=A.map(ri),i=a[0],r=a[1],s=a[2],o=a[3];return BA(i,r,s,o)}return 0},jp=function(t,e){var A=e.filter(Ee),n=A[0].type===20?A[0].value:"unknown",i=!ot(A);if(i){var r=n,s=lc[r];if(typeof s>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(r,'" for color() function'));var a=me(A[1])?A[1].number:0,o=me(A[2])?A[2].number:0,c=me(A[3])?A[3].number:0,l=A.length>4&&A[4].type===6&&A[4].value==="/"&&me(A[5])?A[5].number:1;return s([a,o,c,l])}else{var u=function(N,V){if(me(V))return V.number;var Fe=function(we){return we==="r"||we==="x"?0:we==="g"||we==="y"?1:2};if(j(V)){var ve=Fe(V.value);return N[ve]}var Ce=function(we){for(var nA=we.filter(Ee),Ye="(",Ie=0,it=nA;Ie<it.length;Ie++){var We=it[Ie];Ye+=We.type===18&&We.name==="calc"?Ce(We.values):me(We)?We.number:We.type===6||j(We)?We.value:""}return Ye+=")",Ye};if(V.type===18){var tA=V.values.filter(Ee);if(V.name==="calc"){var Le=Ce(tA).replace(/r|x/,N[0].toString()).replace(/g|y/,N[1].toString()).replace(/b|z/,N[2].toString());return new Function("return "+Le)()}}return null},d=A[1].type===18?A[1].name:j(A[1])||A[1].type===5?"rgb":"unknown",h=j(A[2])?A[2].value:"unknown",p=A[1].type===18?A[1].values:j(A[1])?[A[1]]:[];if(j(A[1])){var f=vA[A[1].value.toUpperCase()];if(typeof f>"u")throw new Error("Attempting to use unknown color in relative color 'from'");var m=Et(t,A[1].value),B=255&m,b=255&m>>8,U=255&m>>16,w=255&m>>24;p=[{type:17,number:w,flags:1},{type:17,number:U,flags:1},{type:17,number:b,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}else if(A[1].type===5){var v=oc(A[1]),w=v[0],U=v[1],b=v[2],B=v[3];p=[{type:17,number:w,flags:1},{type:17,number:U,flags:1},{type:17,number:b,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}if(p.length===0)throw new Error("Attempting to use unknown color in relative color 'from'");if(h==="unknown")throw new Error("Attempting to use unknown colorspace in relative color 'to'");var y=Wp[d],E=Jp[h],T=lc[h];if(typeof y>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(d,'" for color() function'));if(typeof E>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(h,'" for color() function'));var F=y(t,p),R=E(F),a=u(R,A[3]),o=u(R,A[4]),c=u(R,A[5]),l=A.length>6&&A[6].type===6&&A[6].value==="/"&&me(A[7])?A[7].number:1;if(a===null||o===null||c===null)throw new Error("Invalid relative color in color() function");return T([a,o,c,l])}},lc={srgb:tp,"srgb-linear":Zr,"display-p3":Up,"a98-rgb":Fp,"prophoto-rgb":Dp,xyz:sc,"xyz-d50":gp,"xyz-d65":sc,rec2020:Gp},Wp={rgb:ap,hsl:op,lab:cp,lch:lp,oklab:dp,oklch:up},Jp={srgb:pp,"srgb-linear":mp,"display-p3":yp,"a98-rgb":Tp,"prophoto-rgb":Lp,xyz:rc,"xyz-d50":fp,"xyz-d65":rc,rec2020:Vp},Xp={hsl:ec,hsla:ec,rgb:cc,rgba:cc,lch:sp,oklch:rp,oklab:ip,lab:np,color:jp},Et=function(t,e){return VA.parse(t,Go.create(e).parseComponentValue())},vA={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},qp={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(A){if(j(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Yp={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ui=function(t,e){var A=VA.parse(t,e[0]),n=e[1];return n&&te(n)?{color:A,stop:n}:{color:A,stop:null}},uc=function(t,e){var A=t[0],n=t[t.length-1];A.stop===null&&(A.stop=Se),n.stop===null&&(n.stop=MA);for(var i=[],r=0,s=0;s<t.length;s++){var a=t[s].stop;if(a!==null){var o=$(a,e);o>r?i.push(o):i.push(r),r=o}else i.push(null)}for(var c=null,s=0;s<i.length;s++){var l=i[s];if(l===null)c===null&&(c=s);else if(c!==null){for(var u=s-c,d=i[c-1],h=(l-d)/(u+1),p=1;p<=u;p++)i[c+p-1]=h*p;c=null}}return t.map(function(f,m){var B=f.color;return{color:B,stop:Math.max(Math.min(1,i[m]/e),0)}})},zp=function(t,e,A){var n=e/2,i=A/2,r=$(t[0],e)-n,s=i-$(t[1],A);return(Math.atan2(s,r)+Math.PI*2)%(Math.PI*2)},Zp=function(t,e,A){var n=typeof t=="number"?t:zp(t,e,A),i=Math.abs(e*Math.sin(n))+Math.abs(A*Math.cos(n)),r=e/2,s=A/2,a=i/2,o=Math.sin(n-Math.PI/2)*a,c=Math.cos(n-Math.PI/2)*a;return[i,r-c,r+c,s-o,s+o]},rA=function(t,e){return Math.sqrt(t*t+e*e)},dc=function(t,e,A,n,i){var r=[[0,0],[0,e],[t,0],[t,e]];return r.reduce(function(s,a){var o=a[0],c=a[1],l=rA(A-o,n-c);return(i?l<s.optimumDistance:l>s.optimumDistance)?{optimumCorner:a,optimumDistance:l}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},$p=function(t,e,A,n,i){var r=0,s=0;switch(t.size){case 0:t.shape===0?r=s=Math.min(Math.abs(e),Math.abs(e-n),Math.abs(A),Math.abs(A-i)):t.shape===1&&(r=Math.min(Math.abs(e),Math.abs(e-n)),s=Math.min(Math.abs(A),Math.abs(A-i)));break;case 2:if(t.shape===0)r=s=Math.min(rA(e,A),rA(e,A-i),rA(e-n,A),rA(e-n,A-i));else if(t.shape===1){var a=Math.min(Math.abs(A),Math.abs(A-i))/Math.min(Math.abs(e),Math.abs(e-n)),o=dc(n,i,e,A,!0),c=o[0],l=o[1];r=rA(c-e,(l-A)/a),s=a*r}break;case 1:t.shape===0?r=s=Math.max(Math.abs(e),Math.abs(e-n),Math.abs(A),Math.abs(A-i)):t.shape===1&&(r=Math.max(Math.abs(e),Math.abs(e-n)),s=Math.max(Math.abs(A),Math.abs(A-i)));break;case 3:if(t.shape===0)r=s=Math.max(rA(e,A),rA(e,A-i),rA(e-n,A),rA(e-n,A-i));else if(t.shape===1){var a=Math.max(Math.abs(A),Math.abs(A-i))/Math.max(Math.abs(e),Math.abs(e-n)),u=dc(n,i,e,A,!1),c=u[0],l=u[1];r=rA(c-e,(l-A)/a),s=a*r}break}return Array.isArray(t.size)&&(r=$(t.size[0],n),s=t.size.length===2?$(t.size[1],i):r),[r,s]},em=function(t,e){var A=ze(180),n=[];return mA(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&s.value==="to"){A=Zo(i);return}else if(zo(s)){A=ii.parse(t,s);return}}var a=ui(t,i);n.push(a)}),{angle:A,stops:n,type:1}},di=function(t,e){var A=ze(180),n=[];return mA(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){A=Zo(i);return}else if(zo(s)){A=(ii.parse(t,s)+ze(270))%ze(360);return}}var a=ui(t,i);n.push(a)}),{angle:A,stops:n,type:1}},Am=function(t,e){var A=ze(180),n=[],i=1,r=0,s=3,a=[];return mA(e).forEach(function(o,c){var l=o[0];if(c===0){if(j(l)&&l.value==="linear"){i=1;return}else if(j(l)&&l.value==="radial"){i=2;return}}if(l.type===18){if(l.name==="from"){var u=VA.parse(t,l.values[0]);n.push({stop:Se,color:u})}else if(l.name==="to"){var u=VA.parse(t,l.values[0]);n.push({stop:MA,color:u})}else if(l.name==="color-stop"){var d=l.values.filter(Ee);if(d.length===2){var u=VA.parse(t,d[1]),h=d[0];me(h)&&n.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(A+ze(180))%ze(360),stops:n,type:i}:{size:s,shape:r,stops:n,position:a,type:i}},hc="closest-side",fc="farthest-side",gc="closest-corner",pc="farthest-corner",mc="circle",Bc="ellipse",vc="cover",Cc="contain",tm=function(t,e){var A=0,n=3,i=[],r=[];return mA(e).forEach(function(s,a){var o=!0;if(a===0){var c=!1;o=s.reduce(function(u,d){if(c)if(j(d))switch(d.value){case"center":return r.push(zr),u;case"top":case"left":return r.push(Se),u;case"right":case"bottom":return r.push(MA),u}else(te(d)||OA(d))&&r.push(d);else if(j(d))switch(d.value){case mc:return A=0,!1;case Bc:return A=1,!1;case"at":return c=!0,!1;case hc:return n=0,!1;case vc:case fc:return n=1,!1;case Cc:case gc:return n=2,!1;case pc:return n=3,!1}else if(OA(d)||te(d))return Array.isArray(n)||(n=[]),n.push(d),!1;return u},o)}if(o){var l=ui(t,s);i.push(l)}}),{size:n,shape:A,stops:i,position:r,type:2}},hi=function(t,e){var A=0,n=3,i=[],r=[];return mA(e).forEach(function(s,a){var o=!0;if(a===0?o=s.reduce(function(l,u){if(j(u))switch(u.value){case"center":return r.push(zr),!1;case"top":case"left":return r.push(Se),!1;case"right":case"bottom":return r.push(MA),!1}else if(te(u)||OA(u))return r.push(u),!1;return l},o):a===1&&(o=s.reduce(function(l,u){if(j(u))switch(u.value){case mc:return A=0,!1;case Bc:return A=1,!1;case Cc:case hc:return n=0,!1;case fc:return n=1,!1;case gc:return n=2,!1;case vc:case pc:return n=3,!1}else if(OA(u)||te(u))return Array.isArray(n)||(n=[]),n.push(u),!1;return l},o)),o){var c=ui(t,s);i.push(c)}}),{size:n,shape:A,stops:i,position:r,type:2}},nm=function(t){return t.type===1},im=function(t){return t.type===2},ns={name:"image",parse:function(t,e){if(e.type===22){var A={url:e.value,type:0};return t.cache.addImage(e.value),A}if(e.type===18){var n=wc[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported image function "'.concat(e.name,'"'));return n(t,e.values)}throw new Error("Unsupported image type ".concat(e.type))}};function rm(t){return!(t.type===20&&t.value==="none")&&(t.type!==18||!!wc[t.name])}var wc={"linear-gradient":em,"-moz-linear-gradient":di,"-ms-linear-gradient":di,"-o-linear-gradient":di,"-webkit-linear-gradient":di,"radial-gradient":tm,"-moz-radial-gradient":hi,"-ms-radial-gradient":hi,"-o-radial-gradient":hi,"-webkit-radial-gradient":hi,"-webkit-gradient":Am},sm={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e.filter(function(n){return Ee(n)&&rm(n)}).map(function(n){return ns.parse(t,n)})}},am={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(A){if(j(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},om={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(t,e){return mA(e).map(function(A){return A.filter(te)}).map(Wo)}},cm={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return mA(e).map(function(A){return A.filter(j).map(function(n){return n.value}).join(" ")}).map(lm)}},lm=function(t){switch(t){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},St;(function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"})(St||(St={}));var um={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(t,e){return mA(e).map(function(A){return A.filter(dm)})}},dm=function(t){return j(t)||te(t)},fi=function(t){return{name:"border-".concat(t,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},hm=fi("top"),fm=fi("right"),gm=fi("bottom"),pm=fi("left"),gi=function(t){return{name:"border-radius-".concat(t),initialValue:"0 0",prefix:!1,type:1,parse:function(e,A){return Wo(A.filter(te))}}},mm=gi("top-left"),Bm=gi("top-right"),vm=gi("bottom-right"),Cm=gi("bottom-left"),pi=function(t){return{name:"border-".concat(t,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(e,A){switch(A){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},wm=pi("top"),bm=pi("right"),ym=pi("bottom"),Um=pi("left"),mi=function(t){return{name:"border-".concat(t,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(e,A){return HA(A)?A.number:0}}},Qm=mi("top"),Em=mi("right"),Sm=mi("bottom"),km=mi("left"),Tm={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Fm={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(t,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},Im={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(t,e){return e.filter(j).reduce(function(A,n){return A|xm(n.value)},0)}},xm=function(t){switch(t){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},_m={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Pm={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(t,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},Bi;(function(t){t.NORMAL="normal",t.STRICT="strict"})(Bi||(Bi={}));var Rm={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"strict":return Bi.STRICT;case"normal":default:return Bi.NORMAL}}},Lm={name:"line-height",initialValue:"normal",prefix:!1,type:4},bc=function(t,e){return j(t)&&t.value==="normal"?1.2*e:t.type===17?e*t.number:te(t)?$(t,e):e},Dm={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(t,e){return e.type===20&&e.value==="none"?null:ns.parse(t,e)}},Hm={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(t,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},is={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},vi=function(t){return{name:"margin-".concat(t),initialValue:"0",prefix:!1,type:4}},Om=vi("top"),Mm=vi("right"),Nm=vi("bottom"),Km=vi("left"),Vm={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(t,e){return e.filter(j).map(function(A){switch(A.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Gm={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},Ci=function(t){return{name:"padding-".concat(t),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},jm=Ci("top"),Wm=Ci("right"),Jm=Ci("bottom"),Xm=Ci("left"),qm={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(t,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},Ym={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(t,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},zm={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&Yr(e[0],"none")?[]:mA(e).map(function(A){for(var n={color:vA.TRANSPARENT,offsetX:Se,offsetY:Se,blur:Se},i=0,r=0;r<A.length;r++){var s=A[r];OA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:n.blur=s,i++):n.color=VA.parse(t,s)}return n})}},Zm={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},$m={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(t,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var A=t0[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported transform function "'.concat(e.name,'"'));return A(e.values)}return null}},e0=function(t){var e=t.filter(function(A){return A.type===17}).map(function(A){return A.number});return e.length===6?e:null},A0=function(t){var e=t.filter(function(o){return o.type===17}).map(function(o){return o.number}),A=e[0],n=e[1];e[2],e[3];var i=e[4],r=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],a=e[13];return e[14],e[15],e.length===16?[A,n,i,r,s,a]:null},t0={matrix:e0,matrix3d:A0},yc={type:16,number:50,flags:an},n0=[yc,yc],i0={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(t,e){var A=e.filter(te);return A.length!==2?n0:[A[0],A[1]]}},r0={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},fn;(function(t){t.NORMAL="normal",t.BREAK_ALL="break-all",t.KEEP_ALL="keep-all"})(fn||(fn={}));for(var s0={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-all":return fn.BREAK_ALL;case"keep-all":return fn.KEEP_ALL;case"normal":default:return fn.NORMAL}}},a0={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(t,e){if(e.type===20)return{auto:!0,order:0};if(me(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Uc={name:"time",parse:function(t,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},o0={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(t,e){return me(e)?e.number:1}},c0={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},l0={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(t,e){return e.filter(j).map(function(A){switch(A.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(A){return A!==0})}},u0={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(t,e){var A=[],n=[];return e.forEach(function(i){switch(i.type){case 20:case 0:A.push(i.value);break;case 17:A.push(i.number.toString());break;case 4:n.push(A.join(" ")),A.length=0;break}}),A.length&&n.push(A.join(" ")),n.map(function(i){return i.indexOf(" ")===-1?i:"'".concat(i,"'")})}},d0={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},h0={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(t,e){if(me(e))return e.number;if(j(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},f0={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(j).map(function(A){return A.value})}},g0={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},be=function(t,e){return(t&e)!==0},p0={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e}},m0={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;for(var n=[],i=e.filter(jo),r=0;r<i.length;r++){var s=i[r],a=i[r+1];if(s.type===20){var o=a&&me(a)?a.number:1;n.push({counter:s.value,increment:o})}}return n}},B0={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return[];for(var A=[],n=e.filter(jo),i=0;i<n.length;i++){var r=n[i],s=n[i+1];if(j(r)&&r.value!=="none"){var a=s&&me(s)?s.number:0;A.push({counter:r.value,reset:a})}}return A}},v0={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(t,e){return e.filter(HA).map(function(A){return Uc.parse(t,A)})}},C0={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;var n=[],i=e.filter(ep);if(i.length%2!==0)return null;for(var r=0;r<i.length;r+=2){var s=i[r].value,a=i[r+1].value;n.push({open:s,close:a})}return n}},Qc=function(t,e,A){if(!t)return"";var n=t[Math.min(e,t.length-1)];return n?A?n.open:n.close:""},w0={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&Yr(e[0],"none")?[]:mA(e).map(function(A){for(var n={color:255,offsetX:Se,offsetY:Se,blur:Se,spread:Se,inset:!1},i=0,r=0;r<A.length;r++){var s=A[r];Yr(s,"inset")?n.inset=!0:OA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:i===2?n.blur=s:n.spread=s,i++):n.color=VA.parse(t,s)}return n})}},b0={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(t,e){var A=[0,1,2],n=[];return e.filter(j).forEach(function(i){switch(i.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2);break}}),A.forEach(function(i){n.indexOf(i)===-1&&n.push(i)}),n}},y0={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},U0={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(t,e){return HA(e)?e.number:0}},Q0={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(t,e){return e.filter(j).reduce(function(A,n){return A|E0(n.value)},0)}},E0=function(t){switch(t){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},S0=function(){function t(e,A){var n,i;this.animationDuration=H(e,v0,A.animationDuration),this.backgroundClip=H(e,qp,A.backgroundClip),this.backgroundColor=H(e,Yp,A.backgroundColor),this.backgroundImage=H(e,sm,A.backgroundImage),this.backgroundOrigin=H(e,am,A.backgroundOrigin),this.backgroundPosition=H(e,om,A.backgroundPosition),this.backgroundRepeat=H(e,cm,A.backgroundRepeat),this.backgroundSize=H(e,um,A.backgroundSize),this.borderTopColor=H(e,hm,A.borderTopColor),this.borderRightColor=H(e,fm,A.borderRightColor),this.borderBottomColor=H(e,gm,A.borderBottomColor),this.borderLeftColor=H(e,pm,A.borderLeftColor),this.borderTopLeftRadius=H(e,mm,A.borderTopLeftRadius),this.borderTopRightRadius=H(e,Bm,A.borderTopRightRadius),this.borderBottomRightRadius=H(e,vm,A.borderBottomRightRadius),this.borderBottomLeftRadius=H(e,Cm,A.borderBottomLeftRadius),this.borderTopStyle=H(e,wm,A.borderTopStyle),this.borderRightStyle=H(e,bm,A.borderRightStyle),this.borderBottomStyle=H(e,ym,A.borderBottomStyle),this.borderLeftStyle=H(e,Um,A.borderLeftStyle),this.borderTopWidth=H(e,Qm,A.borderTopWidth),this.borderRightWidth=H(e,Em,A.borderRightWidth),this.borderBottomWidth=H(e,Sm,A.borderBottomWidth),this.borderLeftWidth=H(e,km,A.borderLeftWidth),this.boxShadow=H(e,w0,A.boxShadow),this.color=H(e,Tm,A.color),this.direction=H(e,Fm,A.direction),this.display=H(e,Im,A.display),this.float=H(e,_m,A.cssFloat),this.fontFamily=H(e,u0,A.fontFamily),this.fontSize=H(e,d0,A.fontSize),this.fontStyle=H(e,g0,A.fontStyle),this.fontVariant=H(e,f0,A.fontVariant),this.fontWeight=H(e,h0,A.fontWeight),this.letterSpacing=H(e,Pm,A.letterSpacing),this.lineBreak=H(e,Rm,A.lineBreak),this.lineHeight=H(e,Lm,A.lineHeight),this.listStyleImage=H(e,Dm,A.listStyleImage),this.listStylePosition=H(e,Hm,A.listStylePosition),this.listStyleType=H(e,is,A.listStyleType),this.marginTop=H(e,Om,A.marginTop),this.marginRight=H(e,Mm,A.marginRight),this.marginBottom=H(e,Nm,A.marginBottom),this.marginLeft=H(e,Km,A.marginLeft),this.opacity=H(e,o0,A.opacity);var r=H(e,Vm,A.overflow);this.overflowX=r[0],this.overflowY=r[r.length>1?1:0],this.overflowWrap=H(e,Gm,A.overflowWrap),this.paddingTop=H(e,jm,A.paddingTop),this.paddingRight=H(e,Wm,A.paddingRight),this.paddingBottom=H(e,Jm,A.paddingBottom),this.paddingLeft=H(e,Xm,A.paddingLeft),this.paintOrder=H(e,b0,A.paintOrder),this.position=H(e,Ym,A.position),this.textAlign=H(e,qm,A.textAlign),this.textDecorationColor=H(e,c0,(n=A.textDecorationColor)!==null&&n!==void 0?n:A.color),this.textDecorationLine=H(e,l0,(i=A.textDecorationLine)!==null&&i!==void 0?i:A.textDecoration),this.textShadow=H(e,zm,A.textShadow),this.textTransform=H(e,Zm,A.textTransform),this.transform=H(e,$m,A.transform),this.transformOrigin=H(e,i0,A.transformOrigin),this.visibility=H(e,r0,A.visibility),this.webkitTextStrokeColor=H(e,y0,A.webkitTextStrokeColor),this.webkitTextStrokeWidth=H(e,U0,A.webkitTextStrokeWidth),this.wordBreak=H(e,s0,A.wordBreak),this.zIndex=H(e,a0,A.zIndex),this.objectFit=H(e,Q0,A.objectFit)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},t.prototype.isTransparent=function(){return NA(this.backgroundColor)},t.prototype.isTransformed=function(){return this.transform!==null},t.prototype.isPositioned=function(){return this.position!==0},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return this.float!==0},t.prototype.isInlineLevel=function(){return be(this.display,4)||be(this.display,33554432)||be(this.display,268435456)||be(this.display,536870912)||be(this.display,67108864)||be(this.display,134217728)},t}(),k0=function(){function t(e,A){this.content=H(e,p0,A.content),this.quotes=H(e,C0,A.quotes)}return t}(),Ec=function(){function t(e,A){this.counterIncrement=H(e,m0,A.counterIncrement),this.counterReset=H(e,B0,A.counterReset)}return t}(),H=function(t,e,A){var n=new Vo,i=A!==null&&typeof A<"u"?A.toString():e.initialValue;n.write(i);var r=new Go(n.read());switch(e.type){case 2:var s=r.parseComponentValue();return e.parse(t,j(s)?s.value:e.initialValue);case 0:return e.parse(t,r.parseComponentValue());case 1:return e.parse(t,r.parseComponentValues());case 4:return r.parseComponentValue();case 3:switch(e.format){case"angle":return ii.parse(t,r.parseComponentValue());case"color":return VA.parse(t,r.parseComponentValue());case"image":return ns.parse(t,r.parseComponentValue());case"length":var a=r.parseComponentValue();return OA(a)?a:Se;case"length-percentage":var o=r.parseComponentValue();return te(o)?o:Se;case"time":return Uc.parse(t,r.parseComponentValue())}break}},T0="data-html2canvas-debug",F0=function(t){var e=t.getAttribute(T0);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},rs=function(t,e){var A=F0(t);return A===1||e===A},CA=function(){function t(e,A){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,rs(A,3),this.styles=new S0(e,window.getComputedStyle(A,null)),vs(A)&&(this.styles.animationDuration.some(function(n){return n>0})&&(A.style.animationDuration="0s"),this.styles.transform!==null&&(A.style.transform="none")),this.bounds=Hn(this.context,A),rs(A,4)&&(this.flags|=16)}return t}(),I0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Sc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gn=typeof Uint8Array>"u"?[]:new Uint8Array(256),wi=0;wi<Sc.length;wi++)gn[Sc.charCodeAt(wi)]=wi;for(var x0=function(t){var e=t.length*.75,A=t.length,n,i=0,r,s,a,o;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<A;n+=4)r=gn[t.charCodeAt(n)],s=gn[t.charCodeAt(n+1)],a=gn[t.charCodeAt(n+2)],o=gn[t.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|a>>2,l[i++]=(a&3)<<6|o&63;return c},_0=function(t){for(var e=t.length,A=[],n=0;n<e;n+=2)A.push(t[n+1]<<8|t[n]);return A},P0=function(t){for(var e=t.length,A=[],n=0;n<e;n+=4)A.push(t[n+3]<<24|t[n+2]<<16|t[n+1]<<8|t[n]);return A},lt=5,ss=6+5,as=2,R0=ss-lt,kc=65536>>lt,L0=1<<lt,os=L0-1,D0=1024>>lt,H0=kc+D0,O0=H0,M0=32,N0=O0+M0,K0=65536>>ss,V0=1<<R0,G0=V0-1,Tc=function(t,e,A){return t.slice?t.slice(e,A):new Uint16Array(Array.prototype.slice.call(t,e,A))},j0=function(t,e,A){return t.slice?t.slice(e,A):new Uint32Array(Array.prototype.slice.call(t,e,A))},W0=function(t,e){var A=x0(t),n=Array.isArray(A)?P0(A):new Uint32Array(A),i=Array.isArray(A)?_0(A):new Uint16Array(A),r=24,s=Tc(i,r/2,n[4]/2),a=n[5]===2?Tc(i,(r+n[4])/2):j0(n,Math.ceil((r+n[4])/4));return new J0(n[0],n[1],n[2],n[3],s,a)},J0=function(){function t(e,A,n,i,r,s){this.initialValue=e,this.errorValue=A,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return t.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>lt],A=(A<<as)+(e&os),this.data[A];if(e<=65535)return A=this.index[kc+(e-55296>>lt)],A=(A<<as)+(e&os),this.data[A];if(e<this.highStart)return A=N0-K0+(e>>ss),A=this.index[A],A+=e>>lt&G0,A=this.index[A],A=(A<<as)+(e&os),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),Fc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",X0=typeof Uint8Array>"u"?[]:new Uint8Array(256),bi=0;bi<Fc.length;bi++)X0[Fc.charCodeAt(bi)]=bi;var q0=1,cs=2,ls=3,Ic=4,xc=5,Y0=7,_c=8,us=9,ds=10,Pc=11,Rc=12,Lc=13,Dc=14,hs=15,z0=function(t){for(var e=[],A=0,n=t.length;A<n;){var i=t.charCodeAt(A++);if(i>=55296&&i<=56319&&A<n){var r=t.charCodeAt(A++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},Z0=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var A=t.length;if(!A)return"";for(var n=[],i=-1,r="";++i<A;){var s=t[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===A||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},$0=W0(I0),Ze="×",fs="÷",eB=function(t){return $0.get(t)},AB=function(t,e,A){var n=A-2,i=e[n],r=e[A-1],s=e[A];if(r===cs&&s===ls)return Ze;if(r===cs||r===ls||r===Ic||s===cs||s===ls||s===Ic)return fs;if(r===_c&&[_c,us,Pc,Rc].indexOf(s)!==-1||(r===Pc||r===us)&&(s===us||s===ds)||(r===Rc||r===ds)&&s===ds||s===Lc||s===xc||s===Y0||r===q0)return Ze;if(r===Lc&&s===Dc){for(;i===xc;)i=e[--n];if(i===Dc)return Ze}if(r===hs&&s===hs){for(var a=0;i===hs;)a++,i=e[--n];if(a%2===0)return Ze}return fs},tB=function(t){var e=z0(t),A=e.length,n=0,i=0,r=e.map(eB);return{next:function(){if(n>=A)return{done:!0,value:null};for(var s=Ze;n<A&&(s=AB(e,r,++n))===Ze;);if(s!==Ze||n===A){var a=Z0.apply(null,e.slice(i,n));return i=n,{value:a,done:!1}}return{done:!0,value:null}}}},nB=function(t){for(var e=tB(t),A=[],n;!(n=e.next()).done;)n.value&&A.push(n.value.slice());return A},iB=function(t){var e=123;if(t.createRange){var A=t.createRange();if(A.getBoundingClientRect){var n=t.createElement("boundtest");n.style.height="".concat(e,"px"),n.style.display="block",t.body.appendChild(n),A.selectNode(n);var i=A.getBoundingClientRect(),r=Math.round(i.height);if(t.body.removeChild(n),r===e)return!0}}return!1},rB=function(t){var e=t.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",t.body.appendChild(e);var A=t.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var n=e.firstChild,i=On(n.data).map(function(o){return he(o)}),r=0,s={},a=i.every(function(o,c){A.setStart(n,r),A.setEnd(n,r+o.length);var l=A.getBoundingClientRect();r+=o.length;var u=l.x>s.x||l.y>s.y;return s=l,c===0?!0:u});return t.body.removeChild(e),a},sB=function(){return typeof new Image().crossOrigin<"u"},aB=function(){return typeof new XMLHttpRequest().responseType=="string"},oB=function(t){var e=new Image,A=t.createElement("canvas"),n=A.getContext("2d");if(!n)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(e,0,0),A.toDataURL()}catch{return!1}return!0},Hc=function(t){return t[0]===0&&t[1]===255&&t[2]===0&&t[3]===255},cB=function(t){var e=t.createElement("canvas"),A=100;e.width=A,e.height=A;var n=e.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,A,A);var i=new Image,r=e.toDataURL();i.src=r;var s=gs(A,A,0,0,i);return n.fillStyle="red",n.fillRect(0,0,A,A),Oc(s).then(function(a){n.drawImage(a,0,0);var o=n.getImageData(0,0,A,A).data;n.fillStyle="red",n.fillRect(0,0,A,A);var c=t.createElement("div");return c.style.backgroundImage="url(".concat(r,")"),c.style.height="".concat(A,"px"),Hc(o)?Oc(gs(A,A,0,0,c)):Promise.reject(!1)}).then(function(a){return n.drawImage(a,0,0),Hc(n.getImageData(0,0,A,A).data)}).catch(function(){return!1})},gs=function(t,e,A,n,i){var r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),a=document.createElementNS(r,"foreignObject");return s.setAttributeNS(null,"width",t.toString()),s.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",A.toString()),a.setAttributeNS(null,"y",n.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(a),a.appendChild(i),s},Oc=function(t){return new Promise(function(e,A){var n=new Image;n.onload=function(){return e(n)},n.onerror=A,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(t)))})},ke={get SUPPORT_RANGE_BOUNDS(){var t=iB(document);return Object.defineProperty(ke,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_WORD_BREAKING(){var t=ke.SUPPORT_RANGE_BOUNDS&&rB(document);return Object.defineProperty(ke,"SUPPORT_WORD_BREAKING",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=oB(document);return Object.defineProperty(ke,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t=typeof Array.from=="function"&&typeof window.fetch=="function"?cB(document):Promise.resolve(!1);return Object.defineProperty(ke,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=sB();return Object.defineProperty(ke,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t=aB();return Object.defineProperty(ke,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ke,"SUPPORT_CORS_XHR",{value:t}),t},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var t=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(ke,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:t}),t}},pn=function(){function t(e,A){this.text=e,this.bounds=A}return t}(),lB=function(t,e,A,n){var i=hB(e,A),r=[],s=0;return i.forEach(function(a){if(A.textDecorationLine.length||a.trim().length>0)if(ke.SUPPORT_RANGE_BOUNDS){var o=Mc(n,s,a.length).getClientRects();if(o.length>1){var c=ps(a),l=0;c.forEach(function(d){r.push(new pn(d,EA.fromDOMRectList(t,Mc(n,l+s,d.length).getClientRects()))),l+=d.length})}else r.push(new pn(a,EA.fromDOMRectList(t,o)))}else{var u=n.splitText(a.length);r.push(new pn(a,uB(t,n))),n=u}else ke.SUPPORT_RANGE_BOUNDS||(n=n.splitText(a.length));s+=a.length}),r},uB=function(t,e){var A=e.ownerDocument;if(A){var n=A.createElement("html2canvaswrapper");n.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(n,e);var r=Hn(t,n);return n.firstChild&&i.replaceChild(n.firstChild,n),r}}return EA.EMPTY},Mc=function(t,e,A){var n=t.ownerDocument;if(!n)throw new Error("Node has no owner document");var i=n.createRange();return i.setStart(t,e),i.setEnd(t,e+A),i},ps=function(t){if(ke.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(t)).map(function(A){return A.segment})}return nB(t)},dB=function(t,e){if(ke.SUPPORT_NATIVE_TEXT_SEGMENTATION){var A=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(A.segment(t)).map(function(n){return n.segment})}return gB(t,e)},hB=function(t,e){return e.letterSpacing!==0?ps(t):dB(t,e)},fB=[32,160,4961,65792,65793,4153,4241],gB=function(t,e){for(var A=Xf(t,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),n=[],i,r=function(){if(i.value){var s=i.value.slice(),a=On(s),o="";a.forEach(function(c){fB.indexOf(c)===-1?o+=he(c):(o.length&&n.push(o),n.push(he(c)),o="")}),o.length&&n.push(o)}};!(i=A.next()).done;)r();return n},pB=function(){function t(e,A,n){this.text=mB(A.data,n.textTransform),this.textBounds=lB(e,this.text,n,A)}return t}(),mB=function(t,e){switch(e){case 1:return t.toLowerCase();case 3:return t.replace(BB,vB);case 2:return t.toUpperCase();default:return t}},BB=/(^|\s|:|-|\(|\))([a-z])/g,vB=function(t,e,A){return t.length>0?e+A.toUpperCase():t},Nc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.src=n.currentSrc||n.src,i.intrinsicWidth=n.naturalWidth,i.intrinsicHeight=n.naturalHeight,i.context.cache.addImage(i.src),i}return e}(CA),Kc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.canvas=n,i.intrinsicWidth=n.width,i.intrinsicHeight=n.height,i}return e}(CA),Vc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this,r=new XMLSerializer,s=Hn(A,n);return n.setAttribute("width","".concat(s.width,"px")),n.setAttribute("height","".concat(s.height,"px")),i.svg="data:image/svg+xml,".concat(encodeURIComponent(r.serializeToString(n))),i.intrinsicWidth=n.width.baseVal.value,i.intrinsicHeight=n.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(CA),Gc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.value=n.value,i}return e}(CA),ms=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.start=n.start,i.reversed=typeof n.reversed=="boolean"&&n.reversed===!0,i}return e}(CA),CB=[{type:15,flags:0,unit:"px",number:3}],wB=[{type:16,flags:0,number:50}],bB=function(t){return t.width>t.height?new EA(t.left+(t.width-t.height)/2,t.top,t.height,t.height):t.width<t.height?new EA(t.left,t.top+(t.height-t.width)/2,t.width,t.width):t},yB=function(t){var e=t.type===UB?new Array(t.value.length+1).join("•"):t.value;return e.length===0?t.placeholder||"":e},yi="checkbox",Ui="radio",UB="password",jc=707406591,Bs=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;switch(i.type=n.type.toLowerCase(),i.checked=n.checked,i.value=yB(n),(i.type===yi||i.type===Ui)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=bB(i.bounds)),i.type){case yi:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=CB;break;case Ui:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=wB;break}return i}return e}(CA),Wc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this,r=n.options[n.selectedIndex||0];return i.value=r&&r.text||"",i}return e}(CA),Jc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.value=n.value,i}return e}(CA),Xc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;i.src=n.src,i.width=parseInt(n.width,10)||0,i.height=parseInt(n.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){i.tree=Yc(A,n.contentWindow.document.documentElement);var r=n.contentWindow.document.documentElement?Et(A,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):vA.TRANSPARENT,s=n.contentWindow.document.body?Et(A,getComputedStyle(n.contentWindow.document.body).backgroundColor):vA.TRANSPARENT;i.backgroundColor=NA(r)?NA(s)?i.styles.backgroundColor:s:r}}catch{}return i}return e}(CA),QB=["OL","UL","MENU"],Qi=function(t,e,A,n){for(var i=e.firstChild,r=void 0;i;i=r)if(r=i.nextSibling,zc(i)&&i.data.length>0)A.textNodes.push(new pB(t,i,A.styles));else if(kt(i))if(nl(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return Qi(t,a,A,n)});else{var s=qc(t,i);s.styles.isVisible()&&(EB(i,s,n)?s.flags|=4:SB(s.styles)&&(s.flags|=2),QB.indexOf(i.tagName)!==-1&&(s.flags|=8),A.elements.push(s),i.slot,i.shadowRoot?Qi(t,i.shadowRoot,s,n):!Si(i)&&!Zc(i)&&!ki(i)&&Qi(t,i,s,n))}},qc=function(t,e){return ws(e)?new Nc(t,e):$c(e)?new Kc(t,e):Zc(e)?new Vc(t,e):kB(e)?new Gc(t,e):TB(e)?new ms(t,e):FB(e)?new Bs(t,e):ki(e)?new Wc(t,e):Si(e)?new Jc(t,e):Al(e)?new Xc(t,e):new CA(t,e)},Yc=function(t,e){var A=qc(t,e);return A.flags|=4,Qi(t,e,A,A),A},EB=function(t,e,A){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Cs(t)&&A.styles.isTransparent()},SB=function(t){return t.isPositioned()||t.isFloating()},zc=function(t){return t.nodeType===Node.TEXT_NODE},kt=function(t){return t.nodeType===Node.ELEMENT_NODE},vs=function(t){return kt(t)&&typeof t.style<"u"&&!Ei(t)},Ei=function(t){return typeof t.className=="object"},kB=function(t){return t.tagName==="LI"},TB=function(t){return t.tagName==="OL"},FB=function(t){return t.tagName==="INPUT"},IB=function(t){return t.tagName==="HTML"},Zc=function(t){return t.tagName==="svg"},Cs=function(t){return t.tagName==="BODY"},$c=function(t){return t.tagName==="CANVAS"},el=function(t){return t.tagName==="VIDEO"},ws=function(t){return t.tagName==="IMG"},Al=function(t){return t.tagName==="IFRAME"},tl=function(t){return t.tagName==="STYLE"},xB=function(t){return t.tagName==="SCRIPT"},Si=function(t){return t.tagName==="TEXTAREA"},ki=function(t){return t.tagName==="SELECT"},nl=function(t){return t.tagName==="SLOT"},il=function(t){return t.tagName.indexOf("-")>0},_B=function(){function t(){this.counters={}}return t.prototype.getCounterValue=function(e){var A=this.counters[e];return A&&A.length?A[A.length-1]:1},t.prototype.getCounterValues=function(e){var A=this.counters[e];return A||[]},t.prototype.pop=function(e){var A=this;e.forEach(function(n){return A.counters[n].pop()})},t.prototype.parse=function(e){var A=this,n=e.counterIncrement,i=e.counterReset,r=!0;n!==null&&n.forEach(function(a){var o=A.counters[a.counter];o&&a.increment!==0&&(r=!1,o.length||o.push(1),o[Math.max(0,o.length-1)]+=a.increment)});var s=[];return r&&i.forEach(function(a){var o=A.counters[a.counter];s.push(a.counter),o||(o=A.counters[a.counter]=[]),o.push(a.reset)}),s},t}(),rl={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},sl={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},PB={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},RB={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Tt=function(t,e,A,n,i,r){return t<e||t>A?Bn(t,i,r.length>0):n.integers.reduce(function(s,a,o){for(;t>=a;)t-=a,s+=n.values[o];return s},"")+r},al=function(t,e,A,n){var i="";do A||t--,i=n(t)+i,t/=e;while(t*e>=e);return i},fe=function(t,e,A,n,i){var r=A-e+1;return(t<0?"-":"")+(al(Math.abs(t),r,n,function(s){return he(Math.floor(s%r)+e)})+i)},ut=function(t,e,A){A===void 0&&(A=". ");var n=e.length;return al(Math.abs(t),n,!1,function(i){return e[Math.floor(i%n)]})+A},Ft=1,GA=2,jA=4,mn=8,kA=function(t,e,A,n,i,r){if(t<-9999||t>9999)return Bn(t,4,i.length>0);var s=Math.abs(t),a=i;if(s===0)return e[0]+a;for(var o=0;s>0&&o<=4;o++){var c=s%10;c===0&&be(r,Ft)&&a!==""?a=e[c]+a:c>1||c===1&&o===0||c===1&&o===1&&be(r,GA)||c===1&&o===1&&be(r,jA)&&t>100||c===1&&o>1&&be(r,mn)?a=e[c]+(o>0?A[o-1]:"")+a:c===1&&o>0&&(a=A[o-1]+a),s=Math.floor(s/10)}return(t<0?n:"")+a},ol="十百千萬",cl="拾佰仟萬",ll="マイナス",bs="마이너스",Bn=function(t,e,A){var n=A?". ":"",i=A?"、":"",r=A?", ":"",s=A?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var a=fe(t,48,57,!0,n);return a.length<4?"0".concat(a):a;case 4:return ut(t,"〇一二三四五六七八九",i);case 6:return Tt(t,1,3999,rl,3,n).toLowerCase();case 7:return Tt(t,1,3999,rl,3,n);case 8:return fe(t,945,969,!1,n);case 9:return fe(t,97,122,!1,n);case 10:return fe(t,65,90,!1,n);case 11:return fe(t,1632,1641,!0,n);case 12:case 49:return Tt(t,1,9999,sl,3,n);case 35:return Tt(t,1,9999,sl,3,n).toLowerCase();case 13:return fe(t,2534,2543,!0,n);case 14:case 30:return fe(t,6112,6121,!0,n);case 15:return ut(t,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return ut(t,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return kA(t,"零一二三四五六七八九",ol,"負",i,GA|jA|mn);case 47:return kA(t,"零壹貳參肆伍陸柒捌玖",cl,"負",i,Ft|GA|jA|mn);case 42:return kA(t,"零一二三四五六七八九",ol,"负",i,GA|jA|mn);case 41:return kA(t,"零壹贰叁肆伍陆柒捌玖",cl,"负",i,Ft|GA|jA|mn);case 26:return kA(t,"〇一二三四五六七八九","十百千万",ll,i,0);case 25:return kA(t,"零壱弐参四伍六七八九","拾百千万",ll,i,Ft|GA|jA);case 31:return kA(t,"영일이삼사오육칠팔구","십백천만",bs,r,Ft|GA|jA);case 33:return kA(t,"零一二三四五六七八九","十百千萬",bs,r,0);case 32:return kA(t,"零壹貳參四五六七八九","拾百千",bs,r,Ft|GA|jA);case 18:return fe(t,2406,2415,!0,n);case 20:return Tt(t,1,19999,RB,3,n);case 21:return fe(t,2790,2799,!0,n);case 22:return fe(t,2662,2671,!0,n);case 52:return Tt(t,1,10999,PB,3,n);case 23:return ut(t,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ut(t,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return fe(t,3302,3311,!0,n);case 28:return ut(t,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return ut(t,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return fe(t,3792,3801,!0,n);case 37:return fe(t,6160,6169,!0,n);case 38:return fe(t,4160,4169,!0,n);case 39:return fe(t,2918,2927,!0,n);case 40:return fe(t,1776,1785,!0,n);case 43:return fe(t,3046,3055,!0,n);case 44:return fe(t,3174,3183,!0,n);case 45:return fe(t,3664,3673,!0,n);case 46:return fe(t,3872,3881,!0,n);case 3:default:return fe(t,48,57,!0,n)}},ul="data-html2canvas-ignore",dl=function(){function t(e,A,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=A,this.counters=new _B,this.quoteDepth=0,!A.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(A.ownerDocument.documentElement,!1)}return t.prototype.toIFrame=function(e,A){var n=this,i=LB(e,A);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,a=i.contentWindow,o=a.document,c=OB(i).then(function(){return Re(n,void 0,void 0,function(){var u,d;return xe(this,function(h){switch(h.label){case 0:return this.scrolledElements.forEach(VB),a&&(a.scrollTo(A.left,A.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(a.scrollY!==A.top||a.scrollX!==A.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(a.scrollX-A.left,a.scrollY-A.top,0,0))),u=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:o.fonts&&o.fonts.ready?[4,o.fonts.ready]:[3,2];case 1:h.sent(),h.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,HB(o)]:[3,4];case 3:h.sent(),h.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(o,d)}).then(function(){return i})]:[2,i]}})})}),l=o.adoptNode(this.documentElement);return XB(l,o),o.open(),o.write("".concat(NB(document.doctype),"<html></html>")),KB(this.referenceElement.ownerDocument,r,s),o.replaceChild(l,o.documentElement),o.close(),c},t.prototype.createElementClone=function(e){if(rs(e,2),$c(e))return this.createCanvasClone(e);if(el(e))return this.createVideoClone(e);if(tl(e))return this.createStyleClone(e);var A=e.cloneNode(!1);return ws(A)&&(ws(e)&&e.currentSrc&&e.currentSrc!==e.src&&(A.src=e.currentSrc,A.srcset=""),A.loading==="lazy"&&(A.loading="eager")),il(A)?this.createCustomElementClone(A):A},t.prototype.createCustomElementClone=function(e){var A=document.createElement("html2canvascustomelement");return ys(e.style,A),A},t.prototype.createStyleClone=function(e){try{var A=e.sheet;if(A&&A.cssRules){var n=[].slice.call(A.cssRules,0).reduce(function(r,s){return s&&typeof s.cssText=="string"?r+s.cssText:r},""),i=e.cloneNode(!1);return i.textContent=n,i}}catch(r){if(this.context.logger.error("Unable to access cssRules property",r),r.name!=="SecurityError")throw r}return e.cloneNode(!1)},t.prototype.createCanvasClone=function(e){var A;if(this.options.inlineImages&&e.ownerDocument){var n=e.ownerDocument.createElement("img");try{return n.src=e.toDataURL(),n}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var r=e.getContext("2d"),s=i.getContext("2d",{willReadFrequently:!0});if(s)if(!this.options.allowTaint&&r)s.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=(A=e.getContext("webgl2"))!==null&&A!==void 0?A:e.getContext("webgl");if(a){var o=a.getContextAttributes();(o==null?void 0:o.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},t.prototype.createVideoClone=function(e){var A=e.ownerDocument.createElement("canvas");A.width=e.offsetWidth,A.height=e.offsetHeight;var n=A.getContext("2d");try{return n&&(n.drawImage(e,0,0,A.width,A.height),this.options.allowTaint||n.getImageData(0,0,A.width,A.height)),A}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},t.prototype.appendChildNode=function(e,A,n){(!kt(A)||!xB(A)&&!A.hasAttribute(ul)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(A)))&&(!this.options.copyStyles||!kt(A)||!tl(A))&&e.appendChild(this.cloneNode(A,n))},t.prototype.cloneChildNodes=function(e,A,n){for(var i=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(kt(r)&&nl(r)&&typeof r.assignedNodes=="function"){var s=r.assignedNodes();s.length&&s.forEach(function(a){return i.appendChildNode(A,a,n)})}else this.appendChildNode(A,r,n)},t.prototype.cloneNode=function(e,A){if(zc(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&kt(e)&&(vs(e)||Ei(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var r=n.getComputedStyle(e),s=n.getComputedStyle(e,":before"),a=n.getComputedStyle(e,":after");this.referenceElement===e&&vs(i)&&(this.clonedReferenceElement=i),Cs(i)&&WB(i);var o=this.counters.parse(new Ec(this.context,r)),c=this.resolvePseudoContent(e,i,s,vn.BEFORE);il(e)&&(A=!0),el(e)||this.cloneChildNodes(e,i,A),c&&i.insertBefore(c,i.firstChild);var l=this.resolvePseudoContent(e,i,a,vn.AFTER);return l&&i.appendChild(l),this.counters.pop(o),(r&&(this.options.copyStyles||Ei(e))&&!Al(e)||A)&&ys(r,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(Si(e)||ki(e))&&(Si(i)||ki(i))&&(i.value=e.value),i}return e.cloneNode(!1)},t.prototype.resolvePseudoContent=function(e,A,n,i){var r=this;if(n){var s=n.content,a=A.ownerDocument;if(!(!a||!s||s==="none"||s==="-moz-alt-content"||n.display==="none")){this.counters.parse(new Ec(this.context,n));var o=new k0(this.context,n),c=a.createElement("html2canvaspseudoelement");ys(n,c),o.content.forEach(function(u){if(u.type===0)c.appendChild(a.createTextNode(u.value));else if(u.type===22){var d=a.createElement("img");d.src=u.value,d.style.opacity="1",c.appendChild(d)}else if(u.type===18){if(u.name==="attr"){var h=u.values.filter(j);h.length&&c.appendChild(a.createTextNode(e.getAttribute(h[0].value)||""))}else if(u.name==="counter"){var p=u.values.filter(Ee),f=p[0],m=p[1];if(f&&j(f)){var B=r.counters.getCounterValue(f.value),b=m&&j(m)?is.parse(r.context,m.value):3;c.appendChild(a.createTextNode(Bn(B,b,!1)))}}else if(u.name==="counters"){var U=u.values.filter(Ee),f=U[0],w=U[1],m=U[2];if(f&&j(f)){var v=r.counters.getCounterValues(f.value),y=m&&j(m)?is.parse(r.context,m.value):3,E=w&&w.type===0?w.value:"",T=v.map(function(D){return Bn(D,y,!1)}).join(E);c.appendChild(a.createTextNode(T))}}}else if(u.type===20)switch(u.value){case"open-quote":c.appendChild(a.createTextNode(Qc(o.quotes,r.quoteDepth++,!0)));break;case"close-quote":c.appendChild(a.createTextNode(Qc(o.quotes,--r.quoteDepth,!1)));break;default:c.appendChild(a.createTextNode(u.value))}}),c.className="".concat(Us," ").concat(Qs);var l=i===vn.BEFORE?" ".concat(Us):" ".concat(Qs);return Ei(A)?A.className.baseValue+=l:A.className+=l,c}}},t.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},t}(),vn;(function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"})(vn||(vn={}));var LB=function(t,e){var A=t.createElement("iframe");return A.className="html2canvas-container",A.style.visibility="hidden",A.style.position="fixed",A.style.left="-10000px",A.style.top="0px",A.style.border="0",A.width=e.width.toString(),A.height=e.height.toString(),A.scrolling="no",A.setAttribute(ul,"true"),t.body.appendChild(A),A},DB=function(t){return new Promise(function(e){if(t.complete){e();return}if(!t.src){e();return}t.onload=e,t.onerror=e})},HB=function(t){return Promise.all([].slice.call(t.images,0).map(DB))},OB=function(t){return new Promise(function(e,A){var n=t.contentWindow;if(!n)return A("No window assigned for iframe");var i=n.document;n.onload=t.onload=function(){n.onload=t.onload=null;var r=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(r),e(t))},50)}})},MB=["all","d","content"],ys=function(t,e){for(var A=t.length-1;A>=0;A--){var n=t.item(A);MB.indexOf(n)===-1&&e.style.setProperty(n,t.getPropertyValue(n))}return e},NB=function(t){var e="";return t&&(e+="<!DOCTYPE ",t.name&&(e+=t.name),t.internalSubset&&(e+=t.internalSubset),t.publicId&&(e+='"'.concat(t.publicId,'"')),t.systemId&&(e+='"'.concat(t.systemId,'"')),e+=">"),e},KB=function(t,e,A){t&&t.defaultView&&(e!==t.defaultView.pageXOffset||A!==t.defaultView.pageYOffset)&&t.defaultView.scrollTo(e,A)},VB=function(t){var e=t[0],A=t[1],n=t[2];e.scrollLeft=A,e.scrollTop=n},GB=":before",jB=":after",Us="___html2canvas___pseudoelement_before",Qs="___html2canvas___pseudoelement_after",hl=`{
5
+ */var Tr=function(t,e){return Tr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(A,n){A.__proto__=n}||function(A,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(A[i]=n[i])},Tr(t,e)};function iA(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Tr(t,e);function A(){this.constructor=t}t.prototype=e===null?Object.create(e):(A.prototype=e.prototype,new A)}var Fr=function(){return Fr=Object.assign||function(e){for(var A,n=1,i=arguments.length;n<i;n++){A=arguments[n];for(var r in A)Object.prototype.hasOwnProperty.call(A,r)&&(e[r]=A[r])}return e},Fr.apply(this,arguments)};function Re(t,e,A,n){function i(r){return r instanceof A?r:new A(function(s){s(r)})}return new(A||(A=Promise))(function(r,s){function a(l){try{c(n.next(l))}catch(u){s(u)}}function o(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(a,o)}c((n=n.apply(t,e||[])).next())})}function xe(t,e){var A={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(l){return o([c,l])}}function o(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(A=0)),A;)try{if(n=1,i&&(r=c[0]&2?i.return:c[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,c[1])).done)return r;switch(i=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return A.label++,{value:c[1],done:!1};case 5:A.label++,i=c[1],c=[0];continue;case 7:c=A.ops.pop(),A.trys.pop();continue;default:if(r=A.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){A=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){A.label=c[1];break}if(c[0]===6&&A.label<r[1]){A.label=r[1],r=c;break}if(r&&A.label<r[2]){A.label=r[2],A.ops.push(c);break}r[2]&&A.ops.pop(),A.trys.pop();continue}c=e.call(t,A)}catch(l){c=[6,l],i=0}finally{n=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Dn(t,e,A){if(A||arguments.length===2)for(var n=0,i=e.length,r;n<i;n++)(r||!(n in e))&&(r||(r=Array.prototype.slice.call(e,0,n)),r[n]=e[n]);return t.concat(r||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;for(var EA=function(){function t(e,A,n,i){this.left=e,this.top=A,this.width=n,this.height=i}return t.prototype.add=function(e,A,n,i){return new t(this.left+e,this.top+A,this.width+n,this.height+i)},t.fromClientRect=function(e,A){return new t(A.left+e.windowBounds.left,A.top+e.windowBounds.top,A.width,A.height)},t.fromDOMRectList=function(e,A){var n=Array.from(A).find(function(i){return i.width!==0});return n?new t(n.left+e.windowBounds.left,n.top+e.windowBounds.top,n.width,n.height):t.EMPTY},t.EMPTY=new t(0,0,0,0),t}(),Hn=function(t,e){return EA.fromClientRect(t,e.getBoundingClientRect())},hf=function(t){var e=t.body,A=t.documentElement;if(!e||!A)throw new Error("Unable to get document size");var n=Math.max(Math.max(e.scrollWidth,A.scrollWidth),Math.max(e.offsetWidth,A.offsetWidth),Math.max(e.clientWidth,A.clientWidth)),i=Math.max(Math.max(e.scrollHeight,A.scrollHeight),Math.max(e.offsetHeight,A.offsetHeight),Math.max(e.clientHeight,A.clientHeight));return new EA(0,0,n,i)},On=function(t){for(var e=[],A=0,n=t.length;A<n;){var i=t.charCodeAt(A++);if(i>=55296&&i<=56319&&A<n){var r=t.charCodeAt(A++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},he=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var A=t.length;if(!A)return"";for(var n=[],i=-1,r="";++i<A;){var s=t[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===A||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},ho="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ff=typeof Uint8Array>"u"?[]:new Uint8Array(256),Mn=0;Mn<ho.length;Mn++)ff[ho.charCodeAt(Mn)]=Mn;for(var fo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$t=typeof Uint8Array>"u"?[]:new Uint8Array(256),Nn=0;Nn<fo.length;Nn++)$t[fo.charCodeAt(Nn)]=Nn;for(var gf=function(t){var e=t.length*.75,A=t.length,n,i=0,r,s,a,o;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<A;n+=4)r=$t[t.charCodeAt(n)],s=$t[t.charCodeAt(n+1)],a=$t[t.charCodeAt(n+2)],o=$t[t.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|a>>2,l[i++]=(a&3)<<6|o&63;return c},pf=function(t){for(var e=t.length,A=[],n=0;n<e;n+=2)A.push(t[n+1]<<8|t[n]);return A},mf=function(t){for(var e=t.length,A=[],n=0;n<e;n+=4)A.push(t[n+3]<<24|t[n+2]<<16|t[n+1]<<8|t[n]);return A},rt=5,Ir=6+5,xr=2,Bf=Ir-rt,go=65536>>rt,vf=1<<rt,_r=vf-1,Cf=1024>>rt,wf=go+Cf,bf=wf,yf=32,Uf=bf+yf,Qf=65536>>Ir,Ef=1<<Bf,Sf=Ef-1,po=function(t,e,A){return t.slice?t.slice(e,A):new Uint16Array(Array.prototype.slice.call(t,e,A))},kf=function(t,e,A){return t.slice?t.slice(e,A):new Uint32Array(Array.prototype.slice.call(t,e,A))},Tf=function(t,e){var A=gf(t),n=Array.isArray(A)?mf(A):new Uint32Array(A),i=Array.isArray(A)?pf(A):new Uint16Array(A),r=24,s=po(i,r/2,n[4]/2),a=n[5]===2?po(i,(r+n[4])/2):kf(n,Math.ceil((r+n[4])/4));return new Ff(n[0],n[1],n[2],n[3],s,a)},Ff=function(){function t(e,A,n,i,r,s){this.initialValue=e,this.errorValue=A,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return t.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>rt],A=(A<<xr)+(e&_r),this.data[A];if(e<=65535)return A=this.index[go+(e-55296>>rt)],A=(A<<xr)+(e&_r),this.data[A];if(e<this.highStart)return A=Uf-Qf+(e>>Ir),A=this.index[A],A+=e>>rt&Sf,A=this.index[A],A=(A<<xr)+(e&_r),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),mo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",If=typeof Uint8Array>"u"?[]:new Uint8Array(256),Kn=0;Kn<mo.length;Kn++)If[mo.charCodeAt(Kn)]=Kn;var xf="KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA==",Bo=50,_f=1,vo=2,Co=3,Pf=4,Rf=5,wo=7,bo=8,yo=9,LA=10,Pr=11,Uo=12,Rr=13,Lf=14,en=15,Lr=16,Vn=17,An=18,Df=19,Qo=20,Dr=21,tn=22,Hr=23,yt=24,Xe=25,nn=26,rn=27,Ut=28,Hf=29,st=30,Of=31,Gn=32,jn=33,Or=34,Mr=35,Nr=36,sn=37,Kr=38,Wn=39,Jn=40,Vr=41,Eo=42,Mf=43,Nf=[9001,65288],So="!",G="×",Xn="÷",Gr=Tf(xf),SA=[st,Nr],jr=[_f,vo,Co,Rf],ko=[LA,bo],To=[rn,nn],Kf=jr.concat(ko),Fo=[Kr,Wn,Jn,Or,Mr],Vf=[en,Rr],Gf=function(t,e){e===void 0&&(e="strict");var A=[],n=[],i=[];return t.forEach(function(r,s){var a=Gr.get(r);if(a>Bo?(i.push(!0),a-=Bo):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(r)!==-1)return n.push(s),A.push(Lr);if(a===Pf||a===Pr){if(s===0)return n.push(s),A.push(st);var o=A[s-1];return Kf.indexOf(o)===-1?(n.push(n[s-1]),A.push(o)):(n.push(s),A.push(st))}if(n.push(s),a===Of)return A.push(e==="strict"?Dr:sn);if(a===Eo||a===Hf)return A.push(st);if(a===Mf)return r>=131072&&r<=196605||r>=196608&&r<=262141?A.push(sn):A.push(st);A.push(a)}),[n,A,i]},Wr=function(t,e,A,n){var i=n[A];if(Array.isArray(t)?t.indexOf(i)!==-1:t===i)for(var r=A;r<=n.length;){r++;var s=n[r];if(s===e)return!0;if(s!==LA)break}if(i===LA)for(var r=A;r>0;){r--;var a=n[r];if(Array.isArray(t)?t.indexOf(a)!==-1:t===a)for(var o=A;o<=n.length;){o++;var s=n[o];if(s===e)return!0;if(s!==LA)break}if(a!==LA)break}return!1},Io=function(t,e){for(var A=t;A>=0;){var n=e[A];if(n===LA)A--;else return n}return 0},jf=function(t,e,A,n,i){if(A[n]===0)return G;var r=n-1;if(Array.isArray(i)&&i[r]===!0)return G;var s=r-1,a=r+1,o=e[r],c=s>=0?e[s]:0,l=e[a];if(o===vo&&l===Co)return G;if(jr.indexOf(o)!==-1)return So;if(jr.indexOf(l)!==-1||ko.indexOf(l)!==-1)return G;if(Io(r,e)===bo)return Xn;if(Gr.get(t[r])===Pr||(o===Gn||o===jn)&&Gr.get(t[a])===Pr||o===wo||l===wo||o===yo||[LA,Rr,en].indexOf(o)===-1&&l===yo||[Vn,An,Df,yt,Ut].indexOf(l)!==-1||Io(r,e)===tn||Wr(Hr,tn,r,e)||Wr([Vn,An],Dr,r,e)||Wr(Uo,Uo,r,e))return G;if(o===LA)return Xn;if(o===Hr||l===Hr)return G;if(l===Lr||o===Lr)return Xn;if([Rr,en,Dr].indexOf(l)!==-1||o===Lf||c===Nr&&Vf.indexOf(o)!==-1||o===Ut&&l===Nr||l===Qo||SA.indexOf(l)!==-1&&o===Xe||SA.indexOf(o)!==-1&&l===Xe||o===rn&&[sn,Gn,jn].indexOf(l)!==-1||[sn,Gn,jn].indexOf(o)!==-1&&l===nn||SA.indexOf(o)!==-1&&To.indexOf(l)!==-1||To.indexOf(o)!==-1&&SA.indexOf(l)!==-1||[rn,nn].indexOf(o)!==-1&&(l===Xe||[tn,en].indexOf(l)!==-1&&e[a+1]===Xe)||[tn,en].indexOf(o)!==-1&&l===Xe||o===Xe&&[Xe,Ut,yt].indexOf(l)!==-1)return G;if([Xe,Ut,yt,Vn,An].indexOf(l)!==-1)for(var u=r;u>=0;){var d=e[u];if(d===Xe)return G;if([Ut,yt].indexOf(d)!==-1)u--;else break}if([rn,nn].indexOf(l)!==-1)for(var u=[Vn,An].indexOf(o)!==-1?s:r;u>=0;){var d=e[u];if(d===Xe)return G;if([Ut,yt].indexOf(d)!==-1)u--;else break}if(Kr===o&&[Kr,Wn,Or,Mr].indexOf(l)!==-1||[Wn,Or].indexOf(o)!==-1&&[Wn,Jn].indexOf(l)!==-1||[Jn,Mr].indexOf(o)!==-1&&l===Jn||Fo.indexOf(o)!==-1&&[Qo,nn].indexOf(l)!==-1||Fo.indexOf(l)!==-1&&o===rn||SA.indexOf(o)!==-1&&SA.indexOf(l)!==-1||o===yt&&SA.indexOf(l)!==-1||SA.concat(Xe).indexOf(o)!==-1&&l===tn&&Nf.indexOf(t[a])===-1||SA.concat(Xe).indexOf(l)!==-1&&o===An)return G;if(o===Vr&&l===Vr){for(var h=A[r],g=1;h>0&&(h--,e[h]===Vr);)g++;if(g%2!==0)return G}return o===Gn&&l===jn?G:Xn},Wf=function(t,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var A=Gf(t,e.lineBreak),n=A[0],i=A[1],r=A[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[Xe,st,Eo].indexOf(a)!==-1?sn:a}));var s=e.wordBreak==="keep-all"?r.map(function(a,o){return a&&t[o]>=19968&&t[o]<=40959}):void 0;return[n,i,s]},Jf=function(){function t(e,A,n,i){this.codePoints=e,this.required=A===So,this.start=n,this.end=i}return t.prototype.slice=function(){return he.apply(void 0,this.codePoints.slice(this.start,this.end))},t}(),Xf=function(t,e){var A=On(t),n=Wf(A,e),i=n[0],r=n[1],s=n[2],a=A.length,o=0,c=0;return{next:function(){if(c>=a)return{done:!0,value:null};for(var l=G;c<a&&(l=jf(A,r,i,++c,s))===G;);if(l!==G||c===a){var u=new Jf(A,l,o,c);return o=c,{value:u,done:!1}}return{done:!0,value:null}}}},qf=1,Yf=2,an=4,xo=8,qn=10,_o=47,on=92,zf=9,Zf=32,Yn=34,cn=61,$f=35,eg=36,Ag=37,zn=39,Zn=40,ln=41,tg=95,De=45,ng=33,ig=60,rg=62,sg=64,ag=91,og=93,cg=61,lg=123,$n=63,ug=125,Po=124,dg=126,hg=128,Ro=65533,Jr=42,at=43,fg=44,gg=58,pg=59,un=46,mg=0,Bg=8,vg=11,Cg=14,wg=31,bg=127,pA=-1,Lo=48,Do=97,Ho=101,yg=102,Ug=117,Qg=122,Oo=65,Mo=69,No=70,Eg=85,Sg=90,_e=function(t){return t>=Lo&&t<=57},kg=function(t){return t>=55296&&t<=57343},Qt=function(t){return _e(t)||t>=Oo&&t<=No||t>=Do&&t<=yg},Tg=function(t){return t>=Do&&t<=Qg},Fg=function(t){return t>=Oo&&t<=Sg},Ig=function(t){return Tg(t)||Fg(t)},xg=function(t){return t>=hg},ei=function(t){return t===qn||t===zf||t===Zf},Ai=function(t){return Ig(t)||xg(t)||t===tg},Ko=function(t){return Ai(t)||_e(t)||t===De},_g=function(t){return t>=mg&&t<=Bg||t===vg||t>=Cg&&t<=wg||t===bg},DA=function(t,e){return t!==on?!1:e!==qn},ti=function(t,e,A){return t===De?Ai(e)||DA(e,A):Ai(t)?!0:!!(t===on&&DA(t,e))},Xr=function(t,e,A){return t===at||t===De?_e(e)?!0:e===un&&_e(A):_e(t===un?e:t)},Pg=function(t){var e=0,A=1;(t[e]===at||t[e]===De)&&(t[e]===De&&(A=-1),e++);for(var n=[];_e(t[e]);)n.push(t[e++]);var i=n.length?parseInt(he.apply(void 0,n),10):0;t[e]===un&&e++;for(var r=[];_e(t[e]);)r.push(t[e++]);var s=r.length,a=s?parseInt(he.apply(void 0,r),10):0;(t[e]===Mo||t[e]===Ho)&&e++;var o=1;(t[e]===at||t[e]===De)&&(t[e]===De&&(o=-1),e++);for(var c=[];_e(t[e]);)c.push(t[e++]);var l=c.length?parseInt(he.apply(void 0,c),10):0;return A*(i+a*Math.pow(10,-s))*Math.pow(10,o*l)},Rg={type:2},Lg={type:3},Dg={type:4},Hg={type:13},Og={type:8},Mg={type:21},Ng={type:9},Kg={type:10},Vg={type:11},Gg={type:12},jg={type:14},ni={type:23},Wg={type:1},Jg={type:25},Xg={type:24},qg={type:26},Yg={type:27},zg={type:28},Zg={type:29},$g={type:31},qr={type:32},Vo=function(){function t(){this._value=[]}return t.prototype.write=function(e){this._value=this._value.concat(On(e))},t.prototype.read=function(){for(var e=[],A=this.consumeToken();A!==qr;)e.push(A),A=this.consumeToken();return e},t.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Yn:return this.consumeStringToken(Yn);case $f:var A=this.peekCodePoint(0),n=this.peekCodePoint(1),i=this.peekCodePoint(2);if(Ko(A)||DA(n,i)){var r=ti(A,n,i)?Yf:qf,s=this.consumeName();return{type:5,value:s,flags:r}}break;case eg:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Hg;break;case zn:return this.consumeStringToken(zn);case Zn:return Rg;case ln:return Lg;case Jr:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),jg;break;case at:if(Xr(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case fg:return Dg;case De:var a=e,o=this.peekCodePoint(0),c=this.peekCodePoint(1);if(Xr(a,o,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(ti(a,o,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(o===De&&c===rg)return this.consumeCodePoint(),this.consumeCodePoint(),Xg;break;case un:if(Xr(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case _o:if(this.peekCodePoint(0)===Jr)for(this.consumeCodePoint();;){var l=this.consumeCodePoint();if(l===Jr&&(l=this.consumeCodePoint(),l===_o))return this.consumeToken();if(l===pA)return this.consumeToken()}break;case gg:return qg;case pg:return Yg;case ig:if(this.peekCodePoint(0)===ng&&this.peekCodePoint(1)===De&&this.peekCodePoint(2)===De)return this.consumeCodePoint(),this.consumeCodePoint(),Jg;break;case sg:var u=this.peekCodePoint(0),d=this.peekCodePoint(1),h=this.peekCodePoint(2);if(ti(u,d,h)){var s=this.consumeName();return{type:7,value:s}}break;case ag:return zg;case on:if(DA(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case og:return Zg;case cg:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Og;break;case lg:return Vg;case ug:return Gg;case Ug:case Eg:var g=this.peekCodePoint(0),f=this.peekCodePoint(1);return g===at&&(Qt(f)||f===$n)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case Po:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Ng;if(this.peekCodePoint(0)===Po)return this.consumeCodePoint(),Mg;break;case dg:if(this.peekCodePoint(0)===cn)return this.consumeCodePoint(),Kg;break;case pA:return qr}return ei(e)?(this.consumeWhiteSpace(),$g):_e(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Ai(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:he(e)}},t.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},t.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},t.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},t.prototype.consumeUnicodeRangeToken=function(){for(var e=[],A=this.consumeCodePoint();Qt(A)&&e.length<6;)e.push(A),A=this.consumeCodePoint();for(var n=!1;A===$n&&e.length<6;)e.push(A),A=this.consumeCodePoint(),n=!0;if(n){var i=parseInt(he.apply(void 0,e.map(function(o){return o===$n?Lo:o})),16),r=parseInt(he.apply(void 0,e.map(function(o){return o===$n?No:o})),16);return{type:30,start:i,end:r}}var s=parseInt(he.apply(void 0,e),16);if(this.peekCodePoint(0)===De&&Qt(this.peekCodePoint(1))){this.consumeCodePoint(),A=this.consumeCodePoint();for(var a=[];Qt(A)&&a.length<6;)a.push(A),A=this.consumeCodePoint();var r=parseInt(he.apply(void 0,a),16);return{type:30,start:s,end:r}}else return{type:30,start:s,end:s}},t.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Zn?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Zn?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},t.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===pA)return{type:22,value:""};var A=this.peekCodePoint(0);if(A===zn||A===Yn){var n=this.consumeStringToken(this.consumeCodePoint());return n.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===pA||this.peekCodePoint(0)===ln)?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),ni)}for(;;){var i=this.consumeCodePoint();if(i===pA||i===ln)return{type:22,value:he.apply(void 0,e)};if(ei(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===pA||this.peekCodePoint(0)===ln?(this.consumeCodePoint(),{type:22,value:he.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ni);if(i===Yn||i===zn||i===Zn||_g(i))return this.consumeBadUrlRemnants(),ni;if(i===on)if(DA(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ni;else e.push(i)}},t.prototype.consumeWhiteSpace=function(){for(;ei(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===ln||e===pA)return;DA(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(e){for(var A=5e4,n="";e>0;){var i=Math.min(A,e);n+=he.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),n},t.prototype.consumeStringToken=function(e){var A="",n=0;do{var i=this._value[n];if(i===pA||i===void 0||i===e)return A+=this.consumeStringSlice(n),{type:0,value:A};if(i===qn)return this._value.splice(0,n),Wg;if(i===on){var r=this._value[n+1];r!==pA&&r!==void 0&&(r===qn?(A+=this.consumeStringSlice(n),n=-1,this._value.shift()):DA(i,r)&&(A+=this.consumeStringSlice(n),A+=he(this.consumeEscapedCodePoint()),n=-1))}n++}while(!0)},t.prototype.consumeNumber=function(){var e=[],A=an,n=this.peekCodePoint(0);for((n===at||n===De)&&e.push(this.consumeCodePoint());_e(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(n===un&&_e(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=xo;_e(this.peekCodePoint(0));)e.push(this.consumeCodePoint());n=this.peekCodePoint(0),i=this.peekCodePoint(1);var r=this.peekCodePoint(2);if((n===Mo||n===Ho)&&((i===at||i===De)&&_e(r)||_e(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),A=xo;_e(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Pg(e),A]},t.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),A=e[0],n=e[1],i=this.peekCodePoint(0),r=this.peekCodePoint(1),s=this.peekCodePoint(2);if(ti(i,r,s)){var a=this.consumeName();return{type:15,number:A,flags:n,unit:a}}return i===Ag?(this.consumeCodePoint(),{type:16,number:A,flags:n}):{type:17,number:A,flags:n}},t.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Qt(e)){for(var A=he(e);Qt(this.peekCodePoint(0))&&A.length<6;)A+=he(this.consumeCodePoint());ei(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(A,16);return n===0||kg(n)||n>1114111?Ro:n}return e===pA?Ro:e},t.prototype.consumeName=function(){for(var e="";;){var A=this.consumeCodePoint();if(Ko(A))e+=he(A);else if(DA(A,this.peekCodePoint(0)))e+=he(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(A),e}},t}(),Go=function(){function t(e){this._tokens=e}return t.create=function(e){var A=new Vo;return A.write(e),new t(A.read())},t.parseValue=function(e){return t.create(e).parseComponentValue()},t.parseValues=function(e){return t.create(e).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var A=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return A;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var e=[];;){var A=this.consumeComponentValue();if(A.type===32)return e;e.push(A),e.push()}},t.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},t.prototype.consumeSimpleBlock=function(e){for(var A={type:e,values:[]},n=this.consumeToken();;){if(n.type===32||Ap(n,e))return A;this.reconsumeToken(n),A.values.push(this.consumeComponentValue()),n=this.consumeToken()}},t.prototype.consumeFunction=function(e){for(var A={name:e.value,values:[],type:18};;){var n=this.consumeToken();if(n.type===32||n.type===3)return A;this.reconsumeToken(n),A.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?qr:e},t.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},t}(),HA=function(t){return t.type===15},me=function(t){return t.type===17},j=function(t){return t.type===20},ep=function(t){return t.type===0},Yr=function(t,e){return j(t)&&t.value===e},jo=function(t){return t.type!==31},Ee=function(t){return t.type!==31&&t.type!==4},mA=function(t){var e=[],A=[];return t.forEach(function(n){if(n.type===4){if(A.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(A),A=[];return}n.type!==31&&A.push(n)}),A.length&&e.push(A),e},Ap=function(t,e){return e===11&&t.type===12||e===28&&t.type===29?!0:e===2&&t.type===3},OA=function(t){return t.type===17||t.type===15},te=function(t){return t.type===16||OA(t)},Wo=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},Se={type:17,number:0,flags:an},zr={type:16,number:50,flags:an},MA={type:16,number:100,flags:an},dn=function(t,e,A){var n=t[0],i=t[1];return[$(n,e),$(typeof i<"u"?i:n,A)]},$=function(t,e){if(t.type===16)return t.number/100*e;if(HA(t))switch(t.unit){case"rem":case"em":return 16*t.number;case"px":default:return t.number}return t.number},Jo="deg",Xo="grad",qo="rad",Yo="turn",ii={name:"angle",parse:function(t,e){if(e.type===15)switch(e.unit){case Jo:return Math.PI*e.number/180;case Xo:return Math.PI/200*e.number;case qo:return e.number;case Yo:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},zo=function(t){return t.type===15&&(t.unit===Jo||t.unit===Xo||t.unit===qo||t.unit===Yo)},Zo=function(t){var e=t.filter(j).map(function(A){return A.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Se,Se];case"to top":case"bottom":return ze(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Se,MA];case"to right":case"left":return ze(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[MA,MA];case"to bottom":case"top":return ze(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[MA,Se];case"to left":case"right":return ze(270)}return 0},ze=function(t){return Math.PI*t/180},NA=function(t){return(255&t)===0},Ue=function(t){var e=255&t,A=255&t>>8,n=255&t>>16,i=255&t>>24;return e<255?"rgba(".concat(i,",").concat(n,",").concat(A,",").concat(e/255,")"):"rgb(".concat(i,",").concat(n,",").concat(A,")")},BA=function(t,e,A,n){return(t<<24|e<<16|A<<8|Math.round(n*255)<<0)>>>0},ri=function(t,e){if(t.type===17)return t.number;if(t.type===16){var A=e===3?1:255;return e===3?t.number/100*A:Math.round(t.number/100*A)}return 0},ot=function(t){return(t[0].type===20?t[0].value:"unknown")==="from"},ce=function(t,e,A){return Math.min(Math.max(t,e),A)},He=function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]},tp=function(t){return BA(ce(Math.round(t[0]*255),0,255),ce(Math.round(t[1]*255),0,255),ce(Math.round(t[2]*255),0,255),ce(t[3],0,1))},Zr=function(t){var e=t[0],A=t[1],n=t[2],i=t[3],r=ct([e,A,n]);return BA(ce(Math.round(r[0]*255),0,255),ce(Math.round(r[1]*255),0,255),ce(Math.round(r[2]*255),0,255),i)},hn=function(t){var e=KA([t[0],t[1],t[2]]);return Zr([e[0],e[1],e[2],t[3]])},np=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for lab()");var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(ci([n,i,r])));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},ip=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for oklab()");var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(oi([n,i,r])));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},rp=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for oklch()");var A=tc(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(oi(ai([n,i,r]))));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},sp=function(t,e){if(ot(e.filter(Ee)))throw new Error("Relative color not supported for lch()");var A=Ac(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ct(KA(ci(ai([n,i,r]))));return BA(ce(Math.round(a[0]*255),0,255),ce(Math.round(a[1]*255),0,255),ce(Math.round(a[2]*255),0,255),s)},$o=function(t,e){var A=e.filter(Ee),n=A[0],i=A[1],r=A[2],s=A[3],a=(n.type===17?ze(n.number):ii.parse(t,n))/(Math.PI*2),o=te(i)?i.number/100:0,c=te(r)?r.number/100:0,l=typeof s<"u"&&te(s)?$(s,1):1;return[a,o,c,l]},ec=function(t,e){if(ot(e))throw new Error("Relative color not supported for hsl()");var A=$o(t,e),n=A[0],i=A[1],r=A[2],s=A[3],a=ic([n,i,r]);return BA(a[0]*255,a[1]*255,a[2]*255,i===0?1:s)},Ac=function(t){var e=t.filter(Ee),A=te(e[0])?e[0].number:0,n=te(e[1])?e[1].number:0,i=me(e[2])||HA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&te(e[4])?$(e[4],1):1;return[A,n,i,r]},si=function(t){var e=t.filter(Ee),A=e[0].type===16?e[0].number/100:me(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:me(e[1])?e[1].number:0,i=me(e[2])||HA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&te(e[4])?$(e[4],1):1;return[A,n,i,r]},tc=function(t){var e=t.filter(Ee),A=e[0].type===16?e[0].number/100:me(e[0])?e[0].number:0,n=e[1].type===16?e[1].number/100:me(e[1])?e[1].number:0,i=me(e[2])||HA(e[2])?e[2].number:0,r=typeof e[4]<"u"&&te(e[4])?$(e[4],1):1;return[A,n,i,r]},nc=function(t){return He([1.0479297925449969,.022946870601609652,-.05019226628920524,.02962780877005599,.9904344267538799,-.017073799063418826,-.009243040646204504,.015055191490298152,.7518742814281371],t)},$r=function(t){return He([.955473421488075,-.02309845494876471,.06325924320057072,-.0283697093338637,1.0099953980813041,.021041441191917323,.012314014864481998,-.020507649298898964,1.330365926242124],t)},es=function(t,e,A){return A<0&&(A+=1),A>=1&&(A-=1),A<1/6?(e-t)*A*6+t:A<1/2?e:A<2/3?(e-t)*6*(2/3-A)+t:t},ic=function(t){var e=t[0],A=t[1],n=t[2];if(A===0)return[n*255,n*255,n*255];var i=n<=.5?n*(A+1):n+A-n*A,r=n*2-i,s=es(r,i,e+1/3),a=es(r,i,e),o=es(r,i,e-1/3);return[s,a,o]},ai=function(t){var e=t[0],A=t[1],n=t[2];return A<0&&(A=0),isNaN(n)&&(n=0),[e,A*Math.cos(n*Math.PI/180),A*Math.sin(n*Math.PI/180)]},oi=function(t){var e=He([1,.3963377773761749,.2158037573099136,1,-.1055613458156586,-.0638541728258133,1,-.0894841775298119,-1.2914855480194092],t),A=e.map(function(n){return Math.pow(n,3)});return He([1.2268798758459243,-.5578149944602171,.2813910456659647,-.0405757452148008,1.112286803280317,-.0717110580655164,-.0763729366746601,-.4214933324022432,1.5869240198367816],A)},ci=function(t){var e=(t[0]+16)/116,A=t[1]/500+e,n=e-t[2]/200,i=24389/27,r=24/116,s=[(A>r?Math.pow(A,3):(116*A-16)/i)*.3457/.3585,t[0]>8?Math.pow(e,3):t[0]/i,(n>r?Math.pow(n,3):(116*n-16)/i)*(1-.3457-.3585)/.3585];return $r([s[0],s[1],s[2]])},ap=function(t,e){var A=e.filter(Ee);if(A.length===3){var n=A.map(ri),i=n[0],r=n[1],s=n[2],a=ts([i/255,r/255,s/255]),o=As([a[0],a[1],a[2]]),c=o[0],l=o[1],u=o[2];return[c,l,u,1]}if(A.length===4){var d=A.map(ri),i=d[0],r=d[1],s=d[2],h=d[3],a=ts([i/255,r/255,s/255]),g=As([a[0],a[1],a[2]]),c=g[0],l=g[1],u=g[2];return[c,l,u,h]}return[0,0,0,1]},op=function(t,e){var A=$o(t,e),n=A[0],i=A[1],r=A[2],s=A[3],a=ts(ic([n,i,r])),o=As([a[0],a[1],a[2]]),c=o[0],l=o[1],u=o[2];return[c,l,u,s]},cp=function(t,e){var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ci([n,i,r]),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},lp=function(t,e){var A=Ac(e),n=A[0],i=A[1],r=A[2],s=A[3],a=ci(ai([n,i,r])),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},up=function(t,e){var A=tc(e),n=A[0],i=A[1],r=A[2],s=A[3],a=oi(ai([n,i,r])),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},dp=function(t,e){var A=si(e),n=A[0],i=A[1],r=A[2],s=A[3],a=oi([n,i,r]),o=a[0],c=a[1],l=a[2];return[o,c,l,s]},hp=function(t){return $r([t[0],t[1],t[2]])},rc=function(t){return t},fp=function(t){var e=nc([t[0],t[2],t[3]]),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},sc=function(t){return hn([t[0],t[1],t[2],t[3]])},gp=function(t){var e=hp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},KA=function(t){return He([3.2409699419045226,-1.537383177570094,-.4986107602930034,-.9692436362808796,1.8759675015077202,.04155505740717559,.05563007969699366,-.20397695888897652,1.0569715142428786],t)},As=function(t){return He([.41239079926595934,.357584339383878,.1804807884018343,.21263900587151027,.715168678767756,.07219231536073371,.01933081871559182,.11919477979462598,.9505321522496607],t)},ct=function(t){return t.map(function(e){var A=e<0?-1:1,n=Math.abs(e);return n>.0031308?A*(1.055*Math.pow(n,1/2.4)-.055):12.92*e})},ts=function(t){return t.map(function(e){var A=e<0?-1:1,n=Math.abs(e);return n<=.04045?e/12.92:A*Math.pow((n+.055)/1.055,2.4)})},pp=function(t){var e=ct(KA([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},mp=function(t){var e=KA([t[0],t[1],t[2]]),A=e[0],n=e[1],i=e[2];return[ce(Math.round(A*255),0,255),ce(Math.round(n*255),0,255),ce(Math.round(i*255),0,255),t[3]]},Bp=function(t){return He([.4865709486482162,.26566769316909306,.1982172852343625,.2289745640697488,.6917385218365064,.079286914093745,0,.04511338185890264,1.043944368900976],t)},vp=function(t){return He([2.493496911941425,-.9313836179191239,-.40271078445071684,-.8294889695615747,1.7626640603183463,.023624685841943577,.03584583024378447,-.07617238926804182,.9568845240076872],t)},Cp=function(t){return t.map(function(e){var A=e<0?-1:1,n=e*A;return n<=.04045?e/12.92:A*Math.pow((e+.055)/1.055,2.4)||0})},wp=function(t){return ct(t)},bp=function(t){var e=Cp([t[0],t[1],t[2]]);return Bp([e[0],e[1],e[2]])},yp=function(t){var e=wp(vp([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Up=function(t){var e=bp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},Qp=function(t){return He([2.0415879038107465,-.5650069742788596,-.34473135077832956,-.9692436362808795,1.8759675015077202,.04155505740717557,.013444280632031142,-.11836239223101838,1.0151749943912054],t)},Ep=function(t){return He([.5766690429101305,.1855582379065463,.1882286462349947,.29734497525053605,.6273635662554661,.0752914584939978,.02703136138641234,.07068885253582723,.9913375368376388],t)},Sp=function(t){var e=t.map(function(A){var n=A<0?-1:1,i=Math.abs(A);return n*Math.pow(i,2.19921875)});return[e[0],e[1],e[2]]},kp=function(t){var e=t.map(function(A){var n=A<0?-1:1,i=Math.abs(A);return n*Math.pow(i,.4547069271758437)});return[e[0],e[1],e[2]]},Tp=function(t){var e=kp(Qp([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Fp=function(t){var e=KA(Ep(Sp([t[0],t[1],t[2]])));return Zr([e[0],e[1],e[2],t[3]])},Ip=function(t){return He([.7977666449006423,.13518129740053308,.0313477341283922,.2880748288194013,.711835234241873,8993693872564e-17,0,0,.8251046025104602],t)},xp=function(t){return He([1.3457868816471583,-.25557208737979464,-.05110186497554526,-.5446307051249019,1.5082477428451468,.02052744743642139,0,0,1.2119675456389452],t)},_p=function(t){return t.map(function(e){return e<16/512?e/16:Math.pow(e,1.8)})},Pp=function(t){return t.map(function(e){return e>1/512?Math.pow(e,1/1.8):e*16})},Rp=function(t){var e=_p([t[0],t[1],t[2]]);return $r(Ip([e[0],e[1],e[2]]))},Lp=function(t){var e=Pp(xp(nc([t[0],t[1],t[2]]))),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Dp=function(t){var e=Rp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},li=1.09929682680944,ac=.018053968510807,Hp=function(t){return t.map(function(e){return e<ac*4.5?e/4.5:Math.pow((e+li-1)/li,1/.45)})},Op=function(t){return t.map(function(e){return e>=ac?li*Math.pow(e,.45)-(li-1):4.5*e})},Mp=function(t){return He([.6369580483012914,.14461690358620832,.1688809751641721,.2627002120112671,.6779980715188708,.05930171646986196,0,.028072693049087428,1.060985057710791],t)},Np=function(t){return He([1.716651187971268,-.355670783776392,-.25336628137366,-.666684351832489,1.616481236634939,.0157685458139111,.017639857445311,-.042770613257809,.942103121235474],t)},Kp=function(t){var e=Hp([t[0],t[1],t[2]]);return Mp([e[0],e[1],e[2]])},Vp=function(t){var e=Op(Np([t[0],t[1],t[2]])),A=e[0],n=e[1],i=e[2];return[A,n,i,t[3]]},Gp=function(t){var e=Kp([t[0],t[1],t[2]]);return hn([e[0],e[1],e[2],t[3]])},VA={name:"color",parse:function(t,e){if(e.type===18){var A=Xp[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported color function "'.concat(e.name,'"'));return A(t,e.values)}if(e.type===5){var n=oc(e),i=n[0],r=n[1],s=n[2],a=n[3];return BA(i,r,s,a)}if(e.type===20){var o=vA[e.value.toUpperCase()];if(typeof o<"u")return o}return vA.TRANSPARENT}},oc=function(t){if(t.value.length===3){var e=t.value.substring(0,1),A=t.value.substring(1,2),n=t.value.substring(2,3);return[parseInt(e+e,16),parseInt(A+A,16),parseInt(n+n,16),1]}if(t.value.length===4){var e=t.value.substring(0,1),A=t.value.substring(1,2),n=t.value.substring(2,3),i=t.value.substring(3,4);return[parseInt(e+e,16),parseInt(A+A,16),parseInt(n+n,16),parseInt(i+i,16)/255]}if(t.value.length===6){var e=t.value.substring(0,2),A=t.value.substring(2,4),n=t.value.substring(4,6);return[parseInt(e,16),parseInt(A,16),parseInt(n,16),1]}if(t.value.length===8){var e=t.value.substring(0,2),A=t.value.substring(2,4),n=t.value.substring(4,6),i=t.value.substring(6,8);return[parseInt(e,16),parseInt(A,16),parseInt(n,16),parseInt(i,16)/255]}return[0,0,0,1]},cc=function(t,e){var A=e.filter(Ee);if(ot(A))throw new Error("Relative color not supported for rgb()");if(A.length===3){var n=A.map(ri),i=n[0],r=n[1],s=n[2];return BA(i,r,s,1)}if(A.length===4){var a=A.map(ri),i=a[0],r=a[1],s=a[2],o=a[3];return BA(i,r,s,o)}return 0},jp=function(t,e){var A=e.filter(Ee),n=A[0].type===20?A[0].value:"unknown",i=!ot(A);if(i){var r=n,s=lc[r];if(typeof s>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(r,'" for color() function'));var a=me(A[1])?A[1].number:0,o=me(A[2])?A[2].number:0,c=me(A[3])?A[3].number:0,l=A.length>4&&A[4].type===6&&A[4].value==="/"&&me(A[5])?A[5].number:1;return s([a,o,c,l])}else{var u=function(N,V){if(me(V))return V.number;var Fe=function(we){return we==="r"||we==="x"?0:we==="g"||we==="y"?1:2};if(j(V)){var ve=Fe(V.value);return N[ve]}var Ce=function(we){for(var nA=we.filter(Ee),Ye="(",Ie=0,it=nA;Ie<it.length;Ie++){var We=it[Ie];Ye+=We.type===18&&We.name==="calc"?Ce(We.values):me(We)?We.number:We.type===6||j(We)?We.value:""}return Ye+=")",Ye};if(V.type===18){var tA=V.values.filter(Ee);if(V.name==="calc"){var Le=Ce(tA).replace(/r|x/,N[0].toString()).replace(/g|y/,N[1].toString()).replace(/b|z/,N[2].toString());return new Function("return "+Le)()}}return null},d=A[1].type===18?A[1].name:j(A[1])||A[1].type===5?"rgb":"unknown",h=j(A[2])?A[2].value:"unknown",g=A[1].type===18?A[1].values:j(A[1])?[A[1]]:[];if(j(A[1])){var f=vA[A[1].value.toUpperCase()];if(typeof f>"u")throw new Error("Attempting to use unknown color in relative color 'from'");var m=Et(t,A[1].value),B=255&m,b=255&m>>8,U=255&m>>16,C=255&m>>24;g=[{type:17,number:C,flags:1},{type:17,number:U,flags:1},{type:17,number:b,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}else if(A[1].type===5){var w=oc(A[1]),C=w[0],U=w[1],b=w[2],B=w[3];g=[{type:17,number:C,flags:1},{type:17,number:U,flags:1},{type:17,number:b,flags:1},{type:17,number:B>1?B/255:B,flags:1}]}if(g.length===0)throw new Error("Attempting to use unknown color in relative color 'from'");if(h==="unknown")throw new Error("Attempting to use unknown colorspace in relative color 'to'");var y=Wp[d],E=Jp[h],S=lc[h];if(typeof y>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(d,'" for color() function'));if(typeof E>"u")throw new Error('Attempting to parse an unsupported color space "'.concat(h,'" for color() function'));var k=y(t,g),R=E(k),a=u(R,A[3]),o=u(R,A[4]),c=u(R,A[5]),l=A.length>6&&A[6].type===6&&A[6].value==="/"&&me(A[7])?A[7].number:1;if(a===null||o===null||c===null)throw new Error("Invalid relative color in color() function");return S([a,o,c,l])}},lc={srgb:tp,"srgb-linear":Zr,"display-p3":Up,"a98-rgb":Fp,"prophoto-rgb":Dp,xyz:sc,"xyz-d50":gp,"xyz-d65":sc,rec2020:Gp},Wp={rgb:ap,hsl:op,lab:cp,lch:lp,oklab:dp,oklch:up},Jp={srgb:pp,"srgb-linear":mp,"display-p3":yp,"a98-rgb":Tp,"prophoto-rgb":Lp,xyz:rc,"xyz-d50":fp,"xyz-d65":rc,rec2020:Vp},Xp={hsl:ec,hsla:ec,rgb:cc,rgba:cc,lch:sp,oklch:rp,oklab:ip,lab:np,color:jp},Et=function(t,e){return VA.parse(t,Go.create(e).parseComponentValue())},vA={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},qp={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(A){if(j(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Yp={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ui=function(t,e){var A=VA.parse(t,e[0]),n=e[1];return n&&te(n)?{color:A,stop:n}:{color:A,stop:null}},uc=function(t,e){var A=t[0],n=t[t.length-1];A.stop===null&&(A.stop=Se),n.stop===null&&(n.stop=MA);for(var i=[],r=0,s=0;s<t.length;s++){var a=t[s].stop;if(a!==null){var o=$(a,e);o>r?i.push(o):i.push(r),r=o}else i.push(null)}for(var c=null,s=0;s<i.length;s++){var l=i[s];if(l===null)c===null&&(c=s);else if(c!==null){for(var u=s-c,d=i[c-1],h=(l-d)/(u+1),g=1;g<=u;g++)i[c+g-1]=h*g;c=null}}return t.map(function(f,m){var B=f.color;return{color:B,stop:Math.max(Math.min(1,i[m]/e),0)}})},zp=function(t,e,A){var n=e/2,i=A/2,r=$(t[0],e)-n,s=i-$(t[1],A);return(Math.atan2(s,r)+Math.PI*2)%(Math.PI*2)},Zp=function(t,e,A){var n=typeof t=="number"?t:zp(t,e,A),i=Math.abs(e*Math.sin(n))+Math.abs(A*Math.cos(n)),r=e/2,s=A/2,a=i/2,o=Math.sin(n-Math.PI/2)*a,c=Math.cos(n-Math.PI/2)*a;return[i,r-c,r+c,s-o,s+o]},rA=function(t,e){return Math.sqrt(t*t+e*e)},dc=function(t,e,A,n,i){var r=[[0,0],[0,e],[t,0],[t,e]];return r.reduce(function(s,a){var o=a[0],c=a[1],l=rA(A-o,n-c);return(i?l<s.optimumDistance:l>s.optimumDistance)?{optimumCorner:a,optimumDistance:l}:s},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},$p=function(t,e,A,n,i){var r=0,s=0;switch(t.size){case 0:t.shape===0?r=s=Math.min(Math.abs(e),Math.abs(e-n),Math.abs(A),Math.abs(A-i)):t.shape===1&&(r=Math.min(Math.abs(e),Math.abs(e-n)),s=Math.min(Math.abs(A),Math.abs(A-i)));break;case 2:if(t.shape===0)r=s=Math.min(rA(e,A),rA(e,A-i),rA(e-n,A),rA(e-n,A-i));else if(t.shape===1){var a=Math.min(Math.abs(A),Math.abs(A-i))/Math.min(Math.abs(e),Math.abs(e-n)),o=dc(n,i,e,A,!0),c=o[0],l=o[1];r=rA(c-e,(l-A)/a),s=a*r}break;case 1:t.shape===0?r=s=Math.max(Math.abs(e),Math.abs(e-n),Math.abs(A),Math.abs(A-i)):t.shape===1&&(r=Math.max(Math.abs(e),Math.abs(e-n)),s=Math.max(Math.abs(A),Math.abs(A-i)));break;case 3:if(t.shape===0)r=s=Math.max(rA(e,A),rA(e,A-i),rA(e-n,A),rA(e-n,A-i));else if(t.shape===1){var a=Math.max(Math.abs(A),Math.abs(A-i))/Math.max(Math.abs(e),Math.abs(e-n)),u=dc(n,i,e,A,!1),c=u[0],l=u[1];r=rA(c-e,(l-A)/a),s=a*r}break}return Array.isArray(t.size)&&(r=$(t.size[0],n),s=t.size.length===2?$(t.size[1],i):r),[r,s]},em=function(t,e){var A=ze(180),n=[];return mA(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&s.value==="to"){A=Zo(i);return}else if(zo(s)){A=ii.parse(t,s);return}}var a=ui(t,i);n.push(a)}),{angle:A,stops:n,type:1}},di=function(t,e){var A=ze(180),n=[];return mA(e).forEach(function(i,r){if(r===0){var s=i[0];if(s.type===20&&["top","left","right","bottom"].indexOf(s.value)!==-1){A=Zo(i);return}else if(zo(s)){A=(ii.parse(t,s)+ze(270))%ze(360);return}}var a=ui(t,i);n.push(a)}),{angle:A,stops:n,type:1}},Am=function(t,e){var A=ze(180),n=[],i=1,r=0,s=3,a=[];return mA(e).forEach(function(o,c){var l=o[0];if(c===0){if(j(l)&&l.value==="linear"){i=1;return}else if(j(l)&&l.value==="radial"){i=2;return}}if(l.type===18){if(l.name==="from"){var u=VA.parse(t,l.values[0]);n.push({stop:Se,color:u})}else if(l.name==="to"){var u=VA.parse(t,l.values[0]);n.push({stop:MA,color:u})}else if(l.name==="color-stop"){var d=l.values.filter(Ee);if(d.length===2){var u=VA.parse(t,d[1]),h=d[0];me(h)&&n.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(A+ze(180))%ze(360),stops:n,type:i}:{size:s,shape:r,stops:n,position:a,type:i}},hc="closest-side",fc="farthest-side",gc="closest-corner",pc="farthest-corner",mc="circle",Bc="ellipse",vc="cover",Cc="contain",tm=function(t,e){var A=0,n=3,i=[],r=[];return mA(e).forEach(function(s,a){var o=!0;if(a===0){var c=!1;o=s.reduce(function(u,d){if(c)if(j(d))switch(d.value){case"center":return r.push(zr),u;case"top":case"left":return r.push(Se),u;case"right":case"bottom":return r.push(MA),u}else(te(d)||OA(d))&&r.push(d);else if(j(d))switch(d.value){case mc:return A=0,!1;case Bc:return A=1,!1;case"at":return c=!0,!1;case hc:return n=0,!1;case vc:case fc:return n=1,!1;case Cc:case gc:return n=2,!1;case pc:return n=3,!1}else if(OA(d)||te(d))return Array.isArray(n)||(n=[]),n.push(d),!1;return u},o)}if(o){var l=ui(t,s);i.push(l)}}),{size:n,shape:A,stops:i,position:r,type:2}},hi=function(t,e){var A=0,n=3,i=[],r=[];return mA(e).forEach(function(s,a){var o=!0;if(a===0?o=s.reduce(function(l,u){if(j(u))switch(u.value){case"center":return r.push(zr),!1;case"top":case"left":return r.push(Se),!1;case"right":case"bottom":return r.push(MA),!1}else if(te(u)||OA(u))return r.push(u),!1;return l},o):a===1&&(o=s.reduce(function(l,u){if(j(u))switch(u.value){case mc:return A=0,!1;case Bc:return A=1,!1;case Cc:case hc:return n=0,!1;case fc:return n=1,!1;case gc:return n=2,!1;case vc:case pc:return n=3,!1}else if(OA(u)||te(u))return Array.isArray(n)||(n=[]),n.push(u),!1;return l},o)),o){var c=ui(t,s);i.push(c)}}),{size:n,shape:A,stops:i,position:r,type:2}},nm=function(t){return t.type===1},im=function(t){return t.type===2},ns={name:"image",parse:function(t,e){if(e.type===22){var A={url:e.value,type:0};return t.cache.addImage(e.value),A}if(e.type===18){var n=wc[e.name];if(typeof n>"u")throw new Error('Attempting to parse an unsupported image function "'.concat(e.name,'"'));return n(t,e.values)}throw new Error("Unsupported image type ".concat(e.type))}};function rm(t){return!(t.type===20&&t.value==="none")&&(t.type!==18||!!wc[t.name])}var wc={"linear-gradient":em,"-moz-linear-gradient":di,"-ms-linear-gradient":di,"-o-linear-gradient":di,"-webkit-linear-gradient":di,"radial-gradient":tm,"-moz-radial-gradient":hi,"-ms-radial-gradient":hi,"-o-radial-gradient":hi,"-webkit-radial-gradient":hi,"-webkit-gradient":Am},sm={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e.filter(function(n){return Ee(n)&&rm(n)}).map(function(n){return ns.parse(t,n)})}},am={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(A){if(j(A))switch(A.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},om={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(t,e){return mA(e).map(function(A){return A.filter(te)}).map(Wo)}},cm={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return mA(e).map(function(A){return A.filter(j).map(function(n){return n.value}).join(" ")}).map(lm)}},lm=function(t){switch(t){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},St;(function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"})(St||(St={}));var um={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(t,e){return mA(e).map(function(A){return A.filter(dm)})}},dm=function(t){return j(t)||te(t)},fi=function(t){return{name:"border-".concat(t,"-color"),initialValue:"transparent",prefix:!1,type:3,format:"color"}},hm=fi("top"),fm=fi("right"),gm=fi("bottom"),pm=fi("left"),gi=function(t){return{name:"border-radius-".concat(t),initialValue:"0 0",prefix:!1,type:1,parse:function(e,A){return Wo(A.filter(te))}}},mm=gi("top-left"),Bm=gi("top-right"),vm=gi("bottom-right"),Cm=gi("bottom-left"),pi=function(t){return{name:"border-".concat(t,"-style"),initialValue:"solid",prefix:!1,type:2,parse:function(e,A){switch(A){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},wm=pi("top"),bm=pi("right"),ym=pi("bottom"),Um=pi("left"),mi=function(t){return{name:"border-".concat(t,"-width"),initialValue:"0",type:0,prefix:!1,parse:function(e,A){return HA(A)?A.number:0}}},Qm=mi("top"),Em=mi("right"),Sm=mi("bottom"),km=mi("left"),Tm={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Fm={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(t,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},Im={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(t,e){return e.filter(j).reduce(function(A,n){return A|xm(n.value)},0)}},xm=function(t){switch(t){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},_m={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Pm={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(t,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},Bi;(function(t){t.NORMAL="normal",t.STRICT="strict"})(Bi||(Bi={}));var Rm={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"strict":return Bi.STRICT;case"normal":default:return Bi.NORMAL}}},Lm={name:"line-height",initialValue:"normal",prefix:!1,type:4},bc=function(t,e){return j(t)&&t.value==="normal"?1.2*e:t.type===17?e*t.number:te(t)?$(t,e):e},Dm={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(t,e){return e.type===20&&e.value==="none"?null:ns.parse(t,e)}},Hm={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(t,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},is={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 52;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},vi=function(t){return{name:"margin-".concat(t),initialValue:"0",prefix:!1,type:4}},Om=vi("top"),Mm=vi("right"),Nm=vi("bottom"),Km=vi("left"),Vm={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(t,e){return e.filter(j).map(function(A){switch(A.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Gm={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},Ci=function(t){return{name:"padding-".concat(t),initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},jm=Ci("top"),Wm=Ci("right"),Jm=Ci("bottom"),Xm=Ci("left"),qm={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(t,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},Ym={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(t,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},zm={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&Yr(e[0],"none")?[]:mA(e).map(function(A){for(var n={color:vA.TRANSPARENT,offsetX:Se,offsetY:Se,blur:Se},i=0,r=0;r<A.length;r++){var s=A[r];OA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:n.blur=s,i++):n.color=VA.parse(t,s)}return n})}},Zm={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},$m={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(t,e){if(e.type===20&&e.value==="none")return null;if(e.type===18){var A=t0[e.name];if(typeof A>"u")throw new Error('Attempting to parse an unsupported transform function "'.concat(e.name,'"'));return A(e.values)}return null}},e0=function(t){var e=t.filter(function(A){return A.type===17}).map(function(A){return A.number});return e.length===6?e:null},A0=function(t){var e=t.filter(function(o){return o.type===17}).map(function(o){return o.number}),A=e[0],n=e[1];e[2],e[3];var i=e[4],r=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var s=e[12],a=e[13];return e[14],e[15],e.length===16?[A,n,i,r,s,a]:null},t0={matrix:e0,matrix3d:A0},yc={type:16,number:50,flags:an},n0=[yc,yc],i0={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(t,e){var A=e.filter(te);return A.length!==2?n0:[A[0],A[1]]}},r0={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},fn;(function(t){t.NORMAL="normal",t.BREAK_ALL="break-all",t.KEEP_ALL="keep-all"})(fn||(fn={}));for(var s0={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-all":return fn.BREAK_ALL;case"keep-all":return fn.KEEP_ALL;case"normal":default:return fn.NORMAL}}},a0={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(t,e){if(e.type===20)return{auto:!0,order:0};if(me(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Uc={name:"time",parse:function(t,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},o0={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(t,e){return me(e)?e.number:1}},c0={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},l0={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(t,e){return e.filter(j).map(function(A){switch(A.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(A){return A!==0})}},u0={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(t,e){var A=[],n=[];return e.forEach(function(i){switch(i.type){case 20:case 0:A.push(i.value);break;case 17:A.push(i.number.toString());break;case 4:n.push(A.join(" ")),A.length=0;break}}),A.length&&n.push(A.join(" ")),n.map(function(i){return i.indexOf(" ")===-1?i:"'".concat(i,"'")})}},d0={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},h0={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(t,e){if(me(e))return e.number;if(j(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},f0={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(j).map(function(A){return A.value})}},g0={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},be=function(t,e){return(t&e)!==0},p0={name:"content",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(e.length===0)return[];var A=e[0];return A.type===20&&A.value==="none"?[]:e}},m0={name:"counter-increment",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;for(var n=[],i=e.filter(jo),r=0;r<i.length;r++){var s=i[r],a=i[r+1];if(s.type===20){var o=a&&me(a)?a.number:1;n.push({counter:s.value,increment:o})}}return n}},B0={name:"counter-reset",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return[];for(var A=[],n=e.filter(jo),i=0;i<n.length;i++){var r=n[i],s=n[i+1];if(j(r)&&r.value!=="none"){var a=s&&me(s)?s.number:0;A.push({counter:r.value,reset:a})}}return A}},v0={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(t,e){return e.filter(HA).map(function(A){return Uc.parse(t,A)})}},C0={name:"quotes",initialValue:"none",prefix:!0,type:1,parse:function(t,e){if(e.length===0)return null;var A=e[0];if(A.type===20&&A.value==="none")return null;var n=[],i=e.filter(ep);if(i.length%2!==0)return null;for(var r=0;r<i.length;r+=2){var s=i[r].value,a=i[r+1].value;n.push({open:s,close:a})}return n}},Qc=function(t,e,A){if(!t)return"";var n=t[Math.min(e,t.length-1)];return n?A?n.open:n.close:""},w0={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.length===1&&Yr(e[0],"none")?[]:mA(e).map(function(A){for(var n={color:255,offsetX:Se,offsetY:Se,blur:Se,spread:Se,inset:!1},i=0,r=0;r<A.length;r++){var s=A[r];Yr(s,"inset")?n.inset=!0:OA(s)?(i===0?n.offsetX=s:i===1?n.offsetY=s:i===2?n.blur=s:n.spread=s,i++):n.color=VA.parse(t,s)}return n})}},b0={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(t,e){var A=[0,1,2],n=[];return e.filter(j).forEach(function(i){switch(i.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2);break}}),A.forEach(function(i){n.indexOf(i)===-1&&n.push(i)}),n}},y0={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},U0={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(t,e){return HA(e)?e.number:0}},Q0={name:"objectFit",initialValue:"fill",prefix:!1,type:1,parse:function(t,e){return e.filter(j).reduce(function(A,n){return A|E0(n.value)},0)}},E0=function(t){switch(t){case"contain":return 2;case"cover":return 4;case"none":return 8;case"scale-down":return 16}return 0},S0=function(){function t(e,A){var n,i;this.animationDuration=O(e,v0,A.animationDuration),this.backgroundClip=O(e,qp,A.backgroundClip),this.backgroundColor=O(e,Yp,A.backgroundColor),this.backgroundImage=O(e,sm,A.backgroundImage),this.backgroundOrigin=O(e,am,A.backgroundOrigin),this.backgroundPosition=O(e,om,A.backgroundPosition),this.backgroundRepeat=O(e,cm,A.backgroundRepeat),this.backgroundSize=O(e,um,A.backgroundSize),this.borderTopColor=O(e,hm,A.borderTopColor),this.borderRightColor=O(e,fm,A.borderRightColor),this.borderBottomColor=O(e,gm,A.borderBottomColor),this.borderLeftColor=O(e,pm,A.borderLeftColor),this.borderTopLeftRadius=O(e,mm,A.borderTopLeftRadius),this.borderTopRightRadius=O(e,Bm,A.borderTopRightRadius),this.borderBottomRightRadius=O(e,vm,A.borderBottomRightRadius),this.borderBottomLeftRadius=O(e,Cm,A.borderBottomLeftRadius),this.borderTopStyle=O(e,wm,A.borderTopStyle),this.borderRightStyle=O(e,bm,A.borderRightStyle),this.borderBottomStyle=O(e,ym,A.borderBottomStyle),this.borderLeftStyle=O(e,Um,A.borderLeftStyle),this.borderTopWidth=O(e,Qm,A.borderTopWidth),this.borderRightWidth=O(e,Em,A.borderRightWidth),this.borderBottomWidth=O(e,Sm,A.borderBottomWidth),this.borderLeftWidth=O(e,km,A.borderLeftWidth),this.boxShadow=O(e,w0,A.boxShadow),this.color=O(e,Tm,A.color),this.direction=O(e,Fm,A.direction),this.display=O(e,Im,A.display),this.float=O(e,_m,A.cssFloat),this.fontFamily=O(e,u0,A.fontFamily),this.fontSize=O(e,d0,A.fontSize),this.fontStyle=O(e,g0,A.fontStyle),this.fontVariant=O(e,f0,A.fontVariant),this.fontWeight=O(e,h0,A.fontWeight),this.letterSpacing=O(e,Pm,A.letterSpacing),this.lineBreak=O(e,Rm,A.lineBreak),this.lineHeight=O(e,Lm,A.lineHeight),this.listStyleImage=O(e,Dm,A.listStyleImage),this.listStylePosition=O(e,Hm,A.listStylePosition),this.listStyleType=O(e,is,A.listStyleType),this.marginTop=O(e,Om,A.marginTop),this.marginRight=O(e,Mm,A.marginRight),this.marginBottom=O(e,Nm,A.marginBottom),this.marginLeft=O(e,Km,A.marginLeft),this.opacity=O(e,o0,A.opacity);var r=O(e,Vm,A.overflow);this.overflowX=r[0],this.overflowY=r[r.length>1?1:0],this.overflowWrap=O(e,Gm,A.overflowWrap),this.paddingTop=O(e,jm,A.paddingTop),this.paddingRight=O(e,Wm,A.paddingRight),this.paddingBottom=O(e,Jm,A.paddingBottom),this.paddingLeft=O(e,Xm,A.paddingLeft),this.paintOrder=O(e,b0,A.paintOrder),this.position=O(e,Ym,A.position),this.textAlign=O(e,qm,A.textAlign),this.textDecorationColor=O(e,c0,(n=A.textDecorationColor)!==null&&n!==void 0?n:A.color),this.textDecorationLine=O(e,l0,(i=A.textDecorationLine)!==null&&i!==void 0?i:A.textDecoration),this.textShadow=O(e,zm,A.textShadow),this.textTransform=O(e,Zm,A.textTransform),this.transform=O(e,$m,A.transform),this.transformOrigin=O(e,i0,A.transformOrigin),this.visibility=O(e,r0,A.visibility),this.webkitTextStrokeColor=O(e,y0,A.webkitTextStrokeColor),this.webkitTextStrokeWidth=O(e,U0,A.webkitTextStrokeWidth),this.wordBreak=O(e,s0,A.wordBreak),this.zIndex=O(e,a0,A.zIndex),this.objectFit=O(e,Q0,A.objectFit)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},t.prototype.isTransparent=function(){return NA(this.backgroundColor)},t.prototype.isTransformed=function(){return this.transform!==null},t.prototype.isPositioned=function(){return this.position!==0},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return this.float!==0},t.prototype.isInlineLevel=function(){return be(this.display,4)||be(this.display,33554432)||be(this.display,268435456)||be(this.display,536870912)||be(this.display,67108864)||be(this.display,134217728)},t}(),k0=function(){function t(e,A){this.content=O(e,p0,A.content),this.quotes=O(e,C0,A.quotes)}return t}(),Ec=function(){function t(e,A){this.counterIncrement=O(e,m0,A.counterIncrement),this.counterReset=O(e,B0,A.counterReset)}return t}(),O=function(t,e,A){var n=new Vo,i=A!==null&&typeof A<"u"?A.toString():e.initialValue;n.write(i);var r=new Go(n.read());switch(e.type){case 2:var s=r.parseComponentValue();return e.parse(t,j(s)?s.value:e.initialValue);case 0:return e.parse(t,r.parseComponentValue());case 1:return e.parse(t,r.parseComponentValues());case 4:return r.parseComponentValue();case 3:switch(e.format){case"angle":return ii.parse(t,r.parseComponentValue());case"color":return VA.parse(t,r.parseComponentValue());case"image":return ns.parse(t,r.parseComponentValue());case"length":var a=r.parseComponentValue();return OA(a)?a:Se;case"length-percentage":var o=r.parseComponentValue();return te(o)?o:Se;case"time":return Uc.parse(t,r.parseComponentValue())}break}},T0="data-html2canvas-debug",F0=function(t){var e=t.getAttribute(T0);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},rs=function(t,e){var A=F0(t);return A===1||e===A},CA=function(){function t(e,A){this.context=e,this.textNodes=[],this.elements=[],this.flags=0,rs(A,3),this.styles=new S0(e,window.getComputedStyle(A,null)),vs(A)&&(this.styles.animationDuration.some(function(n){return n>0})&&(A.style.animationDuration="0s"),this.styles.transform!==null&&(A.style.transform="none")),this.bounds=Hn(this.context,A),rs(A,4)&&(this.flags|=16)}return t}(),I0="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Sc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gn=typeof Uint8Array>"u"?[]:new Uint8Array(256),wi=0;wi<Sc.length;wi++)gn[Sc.charCodeAt(wi)]=wi;for(var x0=function(t){var e=t.length*.75,A=t.length,n,i=0,r,s,a,o;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);var c=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&typeof Uint8Array.prototype.slice<"u"?new ArrayBuffer(e):new Array(e),l=Array.isArray(c)?c:new Uint8Array(c);for(n=0;n<A;n+=4)r=gn[t.charCodeAt(n)],s=gn[t.charCodeAt(n+1)],a=gn[t.charCodeAt(n+2)],o=gn[t.charCodeAt(n+3)],l[i++]=r<<2|s>>4,l[i++]=(s&15)<<4|a>>2,l[i++]=(a&3)<<6|o&63;return c},_0=function(t){for(var e=t.length,A=[],n=0;n<e;n+=2)A.push(t[n+1]<<8|t[n]);return A},P0=function(t){for(var e=t.length,A=[],n=0;n<e;n+=4)A.push(t[n+3]<<24|t[n+2]<<16|t[n+1]<<8|t[n]);return A},lt=5,ss=6+5,as=2,R0=ss-lt,kc=65536>>lt,L0=1<<lt,os=L0-1,D0=1024>>lt,H0=kc+D0,O0=H0,M0=32,N0=O0+M0,K0=65536>>ss,V0=1<<R0,G0=V0-1,Tc=function(t,e,A){return t.slice?t.slice(e,A):new Uint16Array(Array.prototype.slice.call(t,e,A))},j0=function(t,e,A){return t.slice?t.slice(e,A):new Uint32Array(Array.prototype.slice.call(t,e,A))},W0=function(t,e){var A=x0(t),n=Array.isArray(A)?P0(A):new Uint32Array(A),i=Array.isArray(A)?_0(A):new Uint16Array(A),r=24,s=Tc(i,r/2,n[4]/2),a=n[5]===2?Tc(i,(r+n[4])/2):j0(n,Math.ceil((r+n[4])/4));return new J0(n[0],n[1],n[2],n[3],s,a)},J0=function(){function t(e,A,n,i,r,s){this.initialValue=e,this.errorValue=A,this.highStart=n,this.highValueIndex=i,this.index=r,this.data=s}return t.prototype.get=function(e){var A;if(e>=0){if(e<55296||e>56319&&e<=65535)return A=this.index[e>>lt],A=(A<<as)+(e&os),this.data[A];if(e<=65535)return A=this.index[kc+(e-55296>>lt)],A=(A<<as)+(e&os),this.data[A];if(e<this.highStart)return A=N0-K0+(e>>ss),A=this.index[A],A+=e>>lt&G0,A=this.index[A],A=(A<<as)+(e&os),this.data[A];if(e<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),Fc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",X0=typeof Uint8Array>"u"?[]:new Uint8Array(256),bi=0;bi<Fc.length;bi++)X0[Fc.charCodeAt(bi)]=bi;var q0=1,cs=2,ls=3,Ic=4,xc=5,Y0=7,_c=8,us=9,ds=10,Pc=11,Rc=12,Lc=13,Dc=14,hs=15,z0=function(t){for(var e=[],A=0,n=t.length;A<n;){var i=t.charCodeAt(A++);if(i>=55296&&i<=56319&&A<n){var r=t.charCodeAt(A++);(r&64512)===56320?e.push(((i&1023)<<10)+(r&1023)+65536):(e.push(i),A--)}else e.push(i)}return e},Z0=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var A=t.length;if(!A)return"";for(var n=[],i=-1,r="";++i<A;){var s=t[i];s<=65535?n.push(s):(s-=65536,n.push((s>>10)+55296,s%1024+56320)),(i+1===A||n.length>16384)&&(r+=String.fromCharCode.apply(String,n),n.length=0)}return r},$0=W0(I0),Ze="×",fs="÷",eB=function(t){return $0.get(t)},AB=function(t,e,A){var n=A-2,i=e[n],r=e[A-1],s=e[A];if(r===cs&&s===ls)return Ze;if(r===cs||r===ls||r===Ic||s===cs||s===ls||s===Ic)return fs;if(r===_c&&[_c,us,Pc,Rc].indexOf(s)!==-1||(r===Pc||r===us)&&(s===us||s===ds)||(r===Rc||r===ds)&&s===ds||s===Lc||s===xc||s===Y0||r===q0)return Ze;if(r===Lc&&s===Dc){for(;i===xc;)i=e[--n];if(i===Dc)return Ze}if(r===hs&&s===hs){for(var a=0;i===hs;)a++,i=e[--n];if(a%2===0)return Ze}return fs},tB=function(t){var e=z0(t),A=e.length,n=0,i=0,r=e.map(eB);return{next:function(){if(n>=A)return{done:!0,value:null};for(var s=Ze;n<A&&(s=AB(e,r,++n))===Ze;);if(s!==Ze||n===A){var a=Z0.apply(null,e.slice(i,n));return i=n,{value:a,done:!1}}return{done:!0,value:null}}}},nB=function(t){for(var e=tB(t),A=[],n;!(n=e.next()).done;)n.value&&A.push(n.value.slice());return A},iB=function(t){var e=123;if(t.createRange){var A=t.createRange();if(A.getBoundingClientRect){var n=t.createElement("boundtest");n.style.height="".concat(e,"px"),n.style.display="block",t.body.appendChild(n),A.selectNode(n);var i=A.getBoundingClientRect(),r=Math.round(i.height);if(t.body.removeChild(n),r===e)return!0}}return!1},rB=function(t){var e=t.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",t.body.appendChild(e);var A=t.createRange();e.innerHTML=typeof"".repeat=="function"?"&#128104;".repeat(10):"";var n=e.firstChild,i=On(n.data).map(function(o){return he(o)}),r=0,s={},a=i.every(function(o,c){A.setStart(n,r),A.setEnd(n,r+o.length);var l=A.getBoundingClientRect();r+=o.length;var u=l.x>s.x||l.y>s.y;return s=l,c===0?!0:u});return t.body.removeChild(e),a},sB=function(){return typeof new Image().crossOrigin<"u"},aB=function(){return typeof new XMLHttpRequest().responseType=="string"},oB=function(t){var e=new Image,A=t.createElement("canvas"),n=A.getContext("2d");if(!n)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{n.drawImage(e,0,0),A.toDataURL()}catch{return!1}return!0},Hc=function(t){return t[0]===0&&t[1]===255&&t[2]===0&&t[3]===255},cB=function(t){var e=t.createElement("canvas"),A=100;e.width=A,e.height=A;var n=e.getContext("2d");if(!n)return Promise.reject(!1);n.fillStyle="rgb(0, 255, 0)",n.fillRect(0,0,A,A);var i=new Image,r=e.toDataURL();i.src=r;var s=gs(A,A,0,0,i);return n.fillStyle="red",n.fillRect(0,0,A,A),Oc(s).then(function(a){n.drawImage(a,0,0);var o=n.getImageData(0,0,A,A).data;n.fillStyle="red",n.fillRect(0,0,A,A);var c=t.createElement("div");return c.style.backgroundImage="url(".concat(r,")"),c.style.height="".concat(A,"px"),Hc(o)?Oc(gs(A,A,0,0,c)):Promise.reject(!1)}).then(function(a){return n.drawImage(a,0,0),Hc(n.getImageData(0,0,A,A).data)}).catch(function(){return!1})},gs=function(t,e,A,n,i){var r="http://www.w3.org/2000/svg",s=document.createElementNS(r,"svg"),a=document.createElementNS(r,"foreignObject");return s.setAttributeNS(null,"width",t.toString()),s.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",A.toString()),a.setAttributeNS(null,"y",n.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),s.appendChild(a),a.appendChild(i),s},Oc=function(t){return new Promise(function(e,A){var n=new Image;n.onload=function(){return e(n)},n.onerror=A,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(t)))})},ke={get SUPPORT_RANGE_BOUNDS(){var t=iB(document);return Object.defineProperty(ke,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_WORD_BREAKING(){var t=ke.SUPPORT_RANGE_BOUNDS&&rB(document);return Object.defineProperty(ke,"SUPPORT_WORD_BREAKING",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=oB(document);return Object.defineProperty(ke,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t=typeof Array.from=="function"&&typeof window.fetch=="function"?cB(document):Promise.resolve(!1);return Object.defineProperty(ke,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=sB();return Object.defineProperty(ke,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t=aB();return Object.defineProperty(ke,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ke,"SUPPORT_CORS_XHR",{value:t}),t},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var t=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(ke,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:t}),t}},pn=function(){function t(e,A){this.text=e,this.bounds=A}return t}(),lB=function(t,e,A,n){var i=hB(e,A),r=[],s=0;return i.forEach(function(a){if(A.textDecorationLine.length||a.trim().length>0)if(ke.SUPPORT_RANGE_BOUNDS){var o=Mc(n,s,a.length).getClientRects();if(o.length>1){var c=ps(a),l=0;c.forEach(function(d){r.push(new pn(d,EA.fromDOMRectList(t,Mc(n,l+s,d.length).getClientRects()))),l+=d.length})}else r.push(new pn(a,EA.fromDOMRectList(t,o)))}else{var u=n.splitText(a.length);r.push(new pn(a,uB(t,n))),n=u}else ke.SUPPORT_RANGE_BOUNDS||(n=n.splitText(a.length));s+=a.length}),r},uB=function(t,e){var A=e.ownerDocument;if(A){var n=A.createElement("html2canvaswrapper");n.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(n,e);var r=Hn(t,n);return n.firstChild&&i.replaceChild(n.firstChild,n),r}}return EA.EMPTY},Mc=function(t,e,A){var n=t.ownerDocument;if(!n)throw new Error("Node has no owner document");var i=n.createRange();return i.setStart(t,e),i.setEnd(t,e+A),i},ps=function(t){if(ke.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(t)).map(function(A){return A.segment})}return nB(t)},dB=function(t,e){if(ke.SUPPORT_NATIVE_TEXT_SEGMENTATION){var A=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(A.segment(t)).map(function(n){return n.segment})}return gB(t,e)},hB=function(t,e){return e.letterSpacing!==0?ps(t):dB(t,e)},fB=[32,160,4961,65792,65793,4153,4241],gB=function(t,e){for(var A=Xf(t,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),n=[],i,r=function(){if(i.value){var s=i.value.slice(),a=On(s),o="";a.forEach(function(c){fB.indexOf(c)===-1?o+=he(c):(o.length&&n.push(o),n.push(he(c)),o="")}),o.length&&n.push(o)}};!(i=A.next()).done;)r();return n},pB=function(){function t(e,A,n){this.text=mB(A.data,n.textTransform),this.textBounds=lB(e,this.text,n,A)}return t}(),mB=function(t,e){switch(e){case 1:return t.toLowerCase();case 3:return t.replace(BB,vB);case 2:return t.toUpperCase();default:return t}},BB=/(^|\s|:|-|\(|\))([a-z])/g,vB=function(t,e,A){return t.length>0?e+A.toUpperCase():t},Nc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.src=n.currentSrc||n.src,i.intrinsicWidth=n.naturalWidth,i.intrinsicHeight=n.naturalHeight,i.context.cache.addImage(i.src),i}return e}(CA),Kc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.canvas=n,i.intrinsicWidth=n.width,i.intrinsicHeight=n.height,i}return e}(CA),Vc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this,r=new XMLSerializer,s=Hn(A,n);return n.setAttribute("width","".concat(s.width,"px")),n.setAttribute("height","".concat(s.height,"px")),i.svg="data:image/svg+xml,".concat(encodeURIComponent(r.serializeToString(n))),i.intrinsicWidth=n.width.baseVal.value,i.intrinsicHeight=n.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(CA),Gc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.value=n.value,i}return e}(CA),ms=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.start=n.start,i.reversed=typeof n.reversed=="boolean"&&n.reversed===!0,i}return e}(CA),CB=[{type:15,flags:0,unit:"px",number:3}],wB=[{type:16,flags:0,number:50}],bB=function(t){return t.width>t.height?new EA(t.left+(t.width-t.height)/2,t.top,t.height,t.height):t.width<t.height?new EA(t.left,t.top+(t.height-t.width)/2,t.width,t.width):t},yB=function(t){var e=t.type===UB?new Array(t.value.length+1).join("•"):t.value;return e.length===0?t.placeholder||"":e},yi="checkbox",Ui="radio",UB="password",jc=707406591,Bs=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;switch(i.type=n.type.toLowerCase(),i.checked=n.checked,i.value=yB(n),(i.type===yi||i.type===Ui)&&(i.styles.backgroundColor=3739148031,i.styles.borderTopColor=i.styles.borderRightColor=i.styles.borderBottomColor=i.styles.borderLeftColor=2779096575,i.styles.borderTopWidth=i.styles.borderRightWidth=i.styles.borderBottomWidth=i.styles.borderLeftWidth=1,i.styles.borderTopStyle=i.styles.borderRightStyle=i.styles.borderBottomStyle=i.styles.borderLeftStyle=1,i.styles.backgroundClip=[0],i.styles.backgroundOrigin=[0],i.bounds=bB(i.bounds)),i.type){case yi:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=CB;break;case Ui:i.styles.borderTopRightRadius=i.styles.borderTopLeftRadius=i.styles.borderBottomRightRadius=i.styles.borderBottomLeftRadius=wB;break}return i}return e}(CA),Wc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this,r=n.options[n.selectedIndex||0];return i.value=r&&r.text||"",i}return e}(CA),Jc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.value=n.value,i}return e}(CA),Xc=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;i.src=n.src,i.width=parseInt(n.width,10)||0,i.height=parseInt(n.height,10)||0,i.backgroundColor=i.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){i.tree=Yc(A,n.contentWindow.document.documentElement);var r=n.contentWindow.document.documentElement?Et(A,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):vA.TRANSPARENT,s=n.contentWindow.document.body?Et(A,getComputedStyle(n.contentWindow.document.body).backgroundColor):vA.TRANSPARENT;i.backgroundColor=NA(r)?NA(s)?i.styles.backgroundColor:s:r}}catch{}return i}return e}(CA),QB=["OL","UL","MENU"],Qi=function(t,e,A,n){for(var i=e.firstChild,r=void 0;i;i=r)if(r=i.nextSibling,zc(i)&&i.data.length>0)A.textNodes.push(new pB(t,i,A.styles));else if(kt(i))if(nl(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return Qi(t,a,A,n)});else{var s=qc(t,i);s.styles.isVisible()&&(EB(i,s,n)?s.flags|=4:SB(s.styles)&&(s.flags|=2),QB.indexOf(i.tagName)!==-1&&(s.flags|=8),A.elements.push(s),i.slot,i.shadowRoot?Qi(t,i.shadowRoot,s,n):!Si(i)&&!Zc(i)&&!ki(i)&&Qi(t,i,s,n))}},qc=function(t,e){return ws(e)?new Nc(t,e):$c(e)?new Kc(t,e):Zc(e)?new Vc(t,e):kB(e)?new Gc(t,e):TB(e)?new ms(t,e):FB(e)?new Bs(t,e):ki(e)?new Wc(t,e):Si(e)?new Jc(t,e):Al(e)?new Xc(t,e):new CA(t,e)},Yc=function(t,e){var A=qc(t,e);return A.flags|=4,Qi(t,e,A,A),A},EB=function(t,e,A){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Cs(t)&&A.styles.isTransparent()},SB=function(t){return t.isPositioned()||t.isFloating()},zc=function(t){return t.nodeType===Node.TEXT_NODE},kt=function(t){return t.nodeType===Node.ELEMENT_NODE},vs=function(t){return kt(t)&&typeof t.style<"u"&&!Ei(t)},Ei=function(t){return typeof t.className=="object"},kB=function(t){return t.tagName==="LI"},TB=function(t){return t.tagName==="OL"},FB=function(t){return t.tagName==="INPUT"},IB=function(t){return t.tagName==="HTML"},Zc=function(t){return t.tagName==="svg"},Cs=function(t){return t.tagName==="BODY"},$c=function(t){return t.tagName==="CANVAS"},el=function(t){return t.tagName==="VIDEO"},ws=function(t){return t.tagName==="IMG"},Al=function(t){return t.tagName==="IFRAME"},tl=function(t){return t.tagName==="STYLE"},xB=function(t){return t.tagName==="SCRIPT"},Si=function(t){return t.tagName==="TEXTAREA"},ki=function(t){return t.tagName==="SELECT"},nl=function(t){return t.tagName==="SLOT"},il=function(t){return t.tagName.indexOf("-")>0},_B=function(){function t(){this.counters={}}return t.prototype.getCounterValue=function(e){var A=this.counters[e];return A&&A.length?A[A.length-1]:1},t.prototype.getCounterValues=function(e){var A=this.counters[e];return A||[]},t.prototype.pop=function(e){var A=this;e.forEach(function(n){return A.counters[n].pop()})},t.prototype.parse=function(e){var A=this,n=e.counterIncrement,i=e.counterReset,r=!0;n!==null&&n.forEach(function(a){var o=A.counters[a.counter];o&&a.increment!==0&&(r=!1,o.length||o.push(1),o[Math.max(0,o.length-1)]+=a.increment)});var s=[];return r&&i.forEach(function(a){var o=A.counters[a.counter];s.push(a.counter),o||(o=A.counters[a.counter]=[]),o.push(a.reset)}),s},t}(),rl={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},sl={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},PB={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},RB={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Tt=function(t,e,A,n,i,r){return t<e||t>A?Bn(t,i,r.length>0):n.integers.reduce(function(s,a,o){for(;t>=a;)t-=a,s+=n.values[o];return s},"")+r},al=function(t,e,A,n){var i="";do A||t--,i=n(t)+i,t/=e;while(t*e>=e);return i},fe=function(t,e,A,n,i){var r=A-e+1;return(t<0?"-":"")+(al(Math.abs(t),r,n,function(s){return he(Math.floor(s%r)+e)})+i)},ut=function(t,e,A){A===void 0&&(A=". ");var n=e.length;return al(Math.abs(t),n,!1,function(i){return e[Math.floor(i%n)]})+A},Ft=1,GA=2,jA=4,mn=8,kA=function(t,e,A,n,i,r){if(t<-9999||t>9999)return Bn(t,4,i.length>0);var s=Math.abs(t),a=i;if(s===0)return e[0]+a;for(var o=0;s>0&&o<=4;o++){var c=s%10;c===0&&be(r,Ft)&&a!==""?a=e[c]+a:c>1||c===1&&o===0||c===1&&o===1&&be(r,GA)||c===1&&o===1&&be(r,jA)&&t>100||c===1&&o>1&&be(r,mn)?a=e[c]+(o>0?A[o-1]:"")+a:c===1&&o>0&&(a=A[o-1]+a),s=Math.floor(s/10)}return(t<0?n:"")+a},ol="十百千萬",cl="拾佰仟萬",ll="マイナス",bs="마이너스",Bn=function(t,e,A){var n=A?". ":"",i=A?"、":"",r=A?", ":"",s=A?" ":"";switch(e){case 0:return"•"+s;case 1:return"◦"+s;case 2:return"◾"+s;case 5:var a=fe(t,48,57,!0,n);return a.length<4?"0".concat(a):a;case 4:return ut(t,"〇一二三四五六七八九",i);case 6:return Tt(t,1,3999,rl,3,n).toLowerCase();case 7:return Tt(t,1,3999,rl,3,n);case 8:return fe(t,945,969,!1,n);case 9:return fe(t,97,122,!1,n);case 10:return fe(t,65,90,!1,n);case 11:return fe(t,1632,1641,!0,n);case 12:case 49:return Tt(t,1,9999,sl,3,n);case 35:return Tt(t,1,9999,sl,3,n).toLowerCase();case 13:return fe(t,2534,2543,!0,n);case 14:case 30:return fe(t,6112,6121,!0,n);case 15:return ut(t,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return ut(t,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return kA(t,"零一二三四五六七八九",ol,"負",i,GA|jA|mn);case 47:return kA(t,"零壹貳參肆伍陸柒捌玖",cl,"負",i,Ft|GA|jA|mn);case 42:return kA(t,"零一二三四五六七八九",ol,"负",i,GA|jA|mn);case 41:return kA(t,"零壹贰叁肆伍陆柒捌玖",cl,"负",i,Ft|GA|jA|mn);case 26:return kA(t,"〇一二三四五六七八九","十百千万",ll,i,0);case 25:return kA(t,"零壱弐参四伍六七八九","拾百千万",ll,i,Ft|GA|jA);case 31:return kA(t,"영일이삼사오육칠팔구","십백천만",bs,r,Ft|GA|jA);case 33:return kA(t,"零一二三四五六七八九","十百千萬",bs,r,0);case 32:return kA(t,"零壹貳參四五六七八九","拾百千",bs,r,Ft|GA|jA);case 18:return fe(t,2406,2415,!0,n);case 20:return Tt(t,1,19999,RB,3,n);case 21:return fe(t,2790,2799,!0,n);case 22:return fe(t,2662,2671,!0,n);case 52:return Tt(t,1,10999,PB,3,n);case 23:return ut(t,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ut(t,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return fe(t,3302,3311,!0,n);case 28:return ut(t,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return ut(t,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return fe(t,3792,3801,!0,n);case 37:return fe(t,6160,6169,!0,n);case 38:return fe(t,4160,4169,!0,n);case 39:return fe(t,2918,2927,!0,n);case 40:return fe(t,1776,1785,!0,n);case 43:return fe(t,3046,3055,!0,n);case 44:return fe(t,3174,3183,!0,n);case 45:return fe(t,3664,3673,!0,n);case 46:return fe(t,3872,3881,!0,n);case 3:default:return fe(t,48,57,!0,n)}},ul="data-html2canvas-ignore",dl=function(){function t(e,A,n){if(this.context=e,this.options=n,this.scrolledElements=[],this.referenceElement=A,this.counters=new _B,this.quoteDepth=0,!A.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(A.ownerDocument.documentElement,!1)}return t.prototype.toIFrame=function(e,A){var n=this,i=LB(e,A);if(!i.contentWindow)return Promise.reject("Unable to find iframe window");var r=e.defaultView.pageXOffset,s=e.defaultView.pageYOffset,a=i.contentWindow,o=a.document,c=OB(i).then(function(){return Re(n,void 0,void 0,function(){var u,d;return xe(this,function(h){switch(h.label){case 0:return this.scrolledElements.forEach(VB),a&&(a.scrollTo(A.left,A.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(a.scrollY!==A.top||a.scrollX!==A.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(a.scrollX-A.left,a.scrollY-A.top,0,0))),u=this.options.onclone,d=this.clonedReferenceElement,typeof d>"u"?[2,Promise.reject("Error finding the ".concat(this.referenceElement.nodeName," in the cloned document"))]:o.fonts&&o.fonts.ready?[4,o.fonts.ready]:[3,2];case 1:h.sent(),h.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,HB(o)]:[3,4];case 3:h.sent(),h.label=4;case 4:return typeof u=="function"?[2,Promise.resolve().then(function(){return u(o,d)}).then(function(){return i})]:[2,i]}})})}),l=o.adoptNode(this.documentElement);return XB(l,o),o.open(),o.write("".concat(NB(document.doctype),"<html></html>")),KB(this.referenceElement.ownerDocument,r,s),o.replaceChild(l,o.documentElement),o.close(),c},t.prototype.createElementClone=function(e){if(rs(e,2),$c(e))return this.createCanvasClone(e);if(el(e))return this.createVideoClone(e);if(tl(e))return this.createStyleClone(e);var A=e.cloneNode(!1);return ws(A)&&(ws(e)&&e.currentSrc&&e.currentSrc!==e.src&&(A.src=e.currentSrc,A.srcset=""),A.loading==="lazy"&&(A.loading="eager")),il(A)?this.createCustomElementClone(A):A},t.prototype.createCustomElementClone=function(e){var A=document.createElement("html2canvascustomelement");return ys(e.style,A),A},t.prototype.createStyleClone=function(e){try{var A=e.sheet;if(A&&A.cssRules){var n=[].slice.call(A.cssRules,0).reduce(function(r,s){return s&&typeof s.cssText=="string"?r+s.cssText:r},""),i=e.cloneNode(!1);return i.textContent=n,i}}catch(r){if(this.context.logger.error("Unable to access cssRules property",r),r.name!=="SecurityError")throw r}return e.cloneNode(!1)},t.prototype.createCanvasClone=function(e){var A;if(this.options.inlineImages&&e.ownerDocument){var n=e.ownerDocument.createElement("img");try{return n.src=e.toDataURL(),n}catch{this.context.logger.info("Unable to inline canvas contents, canvas is tainted",e)}}var i=e.cloneNode(!1);try{i.width=e.width,i.height=e.height;var r=e.getContext("2d"),s=i.getContext("2d",{willReadFrequently:!0});if(s)if(!this.options.allowTaint&&r)s.putImageData(r.getImageData(0,0,e.width,e.height),0,0);else{var a=(A=e.getContext("webgl2"))!==null&&A!==void 0?A:e.getContext("webgl");if(a){var o=a.getContextAttributes();(o==null?void 0:o.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",e)}s.drawImage(e,0,0)}return i}catch{this.context.logger.info("Unable to clone canvas as it is tainted",e)}return i},t.prototype.createVideoClone=function(e){var A=e.ownerDocument.createElement("canvas");A.width=e.offsetWidth,A.height=e.offsetHeight;var n=A.getContext("2d");try{return n&&(n.drawImage(e,0,0,A.width,A.height),this.options.allowTaint||n.getImageData(0,0,A.width,A.height)),A}catch{this.context.logger.info("Unable to clone video as it is tainted",e)}var i=e.ownerDocument.createElement("canvas");return i.width=e.offsetWidth,i.height=e.offsetHeight,i},t.prototype.appendChildNode=function(e,A,n){(!kt(A)||!xB(A)&&!A.hasAttribute(ul)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(A)))&&(!this.options.copyStyles||!kt(A)||!tl(A))&&e.appendChild(this.cloneNode(A,n))},t.prototype.cloneChildNodes=function(e,A,n){for(var i=this,r=e.shadowRoot?e.shadowRoot.firstChild:e.firstChild;r;r=r.nextSibling)if(kt(r)&&nl(r)&&typeof r.assignedNodes=="function"){var s=r.assignedNodes();s.length&&s.forEach(function(a){return i.appendChildNode(A,a,n)})}else this.appendChildNode(A,r,n)},t.prototype.cloneNode=function(e,A){if(zc(e))return document.createTextNode(e.data);if(!e.ownerDocument)return e.cloneNode(!1);var n=e.ownerDocument.defaultView;if(n&&kt(e)&&(vs(e)||Ei(e))){var i=this.createElementClone(e);i.style.transitionProperty="none";var r=n.getComputedStyle(e),s=n.getComputedStyle(e,":before"),a=n.getComputedStyle(e,":after");this.referenceElement===e&&vs(i)&&(this.clonedReferenceElement=i),Cs(i)&&WB(i);var o=this.counters.parse(new Ec(this.context,r)),c=this.resolvePseudoContent(e,i,s,vn.BEFORE);il(e)&&(A=!0),el(e)||this.cloneChildNodes(e,i,A),c&&i.insertBefore(c,i.firstChild);var l=this.resolvePseudoContent(e,i,a,vn.AFTER);return l&&i.appendChild(l),this.counters.pop(o),(r&&(this.options.copyStyles||Ei(e))&&!Al(e)||A)&&ys(r,i),(e.scrollTop!==0||e.scrollLeft!==0)&&this.scrolledElements.push([i,e.scrollLeft,e.scrollTop]),(Si(e)||ki(e))&&(Si(i)||ki(i))&&(i.value=e.value),i}return e.cloneNode(!1)},t.prototype.resolvePseudoContent=function(e,A,n,i){var r=this;if(n){var s=n.content,a=A.ownerDocument;if(!(!a||!s||s==="none"||s==="-moz-alt-content"||n.display==="none")){this.counters.parse(new Ec(this.context,n));var o=new k0(this.context,n),c=a.createElement("html2canvaspseudoelement");ys(n,c),o.content.forEach(function(u){if(u.type===0)c.appendChild(a.createTextNode(u.value));else if(u.type===22){var d=a.createElement("img");d.src=u.value,d.style.opacity="1",c.appendChild(d)}else if(u.type===18){if(u.name==="attr"){var h=u.values.filter(j);h.length&&c.appendChild(a.createTextNode(e.getAttribute(h[0].value)||""))}else if(u.name==="counter"){var g=u.values.filter(Ee),f=g[0],m=g[1];if(f&&j(f)){var B=r.counters.getCounterValue(f.value),b=m&&j(m)?is.parse(r.context,m.value):3;c.appendChild(a.createTextNode(Bn(B,b,!1)))}}else if(u.name==="counters"){var U=u.values.filter(Ee),f=U[0],C=U[1],m=U[2];if(f&&j(f)){var w=r.counters.getCounterValues(f.value),y=m&&j(m)?is.parse(r.context,m.value):3,E=C&&C.type===0?C.value:"",S=w.map(function(P){return Bn(P,y,!1)}).join(E);c.appendChild(a.createTextNode(S))}}}else if(u.type===20)switch(u.value){case"open-quote":c.appendChild(a.createTextNode(Qc(o.quotes,r.quoteDepth++,!0)));break;case"close-quote":c.appendChild(a.createTextNode(Qc(o.quotes,--r.quoteDepth,!1)));break;default:c.appendChild(a.createTextNode(u.value))}}),c.className="".concat(Us," ").concat(Qs);var l=i===vn.BEFORE?" ".concat(Us):" ".concat(Qs);return Ei(A)?A.className.baseValue+=l:A.className+=l,c}}},t.destroy=function(e){return e.parentNode?(e.parentNode.removeChild(e),!0):!1},t}(),vn;(function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"})(vn||(vn={}));var LB=function(t,e){var A=t.createElement("iframe");return A.className="html2canvas-container",A.style.visibility="hidden",A.style.position="fixed",A.style.left="-10000px",A.style.top="0px",A.style.border="0",A.width=e.width.toString(),A.height=e.height.toString(),A.scrolling="no",A.setAttribute(ul,"true"),t.body.appendChild(A),A},DB=function(t){return new Promise(function(e){if(t.complete){e();return}if(!t.src){e();return}t.onload=e,t.onerror=e})},HB=function(t){return Promise.all([].slice.call(t.images,0).map(DB))},OB=function(t){return new Promise(function(e,A){var n=t.contentWindow;if(!n)return A("No window assigned for iframe");var i=n.document;n.onload=t.onload=function(){n.onload=t.onload=null;var r=setInterval(function(){i.body.childNodes.length>0&&i.readyState==="complete"&&(clearInterval(r),e(t))},50)}})},MB=["all","d","content"],ys=function(t,e){for(var A=t.length-1;A>=0;A--){var n=t.item(A);MB.indexOf(n)===-1&&e.style.setProperty(n,t.getPropertyValue(n))}return e},NB=function(t){var e="";return t&&(e+="<!DOCTYPE ",t.name&&(e+=t.name),t.internalSubset&&(e+=t.internalSubset),t.publicId&&(e+='"'.concat(t.publicId,'"')),t.systemId&&(e+='"'.concat(t.systemId,'"')),e+=">"),e},KB=function(t,e,A){t&&t.defaultView&&(e!==t.defaultView.pageXOffset||A!==t.defaultView.pageYOffset)&&t.defaultView.scrollTo(e,A)},VB=function(t){var e=t[0],A=t[1],n=t[2];e.scrollLeft=A,e.scrollTop=n},GB=":before",jB=":after",Us="___html2canvas___pseudoelement_before",Qs="___html2canvas___pseudoelement_after",hl=`{
6
6
  content: "" !important;
7
7
  display: none !important;
8
8
  }`,WB=function(t){JB(t,".".concat(Us).concat(GB).concat(hl,`
9
- .`).concat(Qs).concat(jB).concat(hl))},JB=function(t,e){var A=t.ownerDocument;if(A){var n=A.createElement("style");n.textContent=e,t.appendChild(n)}},XB=function(t,e){var A,n=e.createElement("base");n.href=e.baseURI;var i=t.getElementsByTagName("head").item(0);i==null||i.insertBefore(n,(A=i==null?void 0:i.firstChild)!==null&&A!==void 0?A:null)},Es=function(){function t(){}return t.getOrigin=function(e){var A=t._link;return A?(A.href=e,A.href=A.href,A.protocol+A.hostname+A.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),qB=function(){function t(e,A){this.context=e,this._options=A,this._cache={}}return t.prototype.addImage=function(e){var A=Promise.resolve();return this.has(e)||(ks(e)||$B(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),A},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return Re(this,void 0,void 0,function(){var A,n,i,r,s,a=this;return xe(this,function(o){switch(o.label){case 0:return typeof this._options.customIsSameOrigin!="function"?[3,2]:[4,this._options.customIsSameOrigin(e,Es.isSameOrigin)];case 1:return n=o.sent(),[3,3];case 2:n=Es.isSameOrigin(e),o.label=3;case 3:return A=n,i=!Ss(e)&&this._options.useCORS===!0&&ke.SUPPORT_CORS_IMAGES&&!A,r=!Ss(e)&&!A&&!ks(e)&&typeof this._options.proxy=="string"&&ke.SUPPORT_CORS_XHR&&!i,!A&&this._options.allowTaint===!1&&!Ss(e)&&!ks(e)&&!r&&!i?[2]:(s=e,r?[4,this.proxy(s)]:[3,5]);case 4:s=o.sent(),o.label=5;case 5:return this.context.logger.debug("Added image ".concat(e.substring(0,256))),[4,new Promise(function(c,l){var u=new Image;u.onload=function(){return c(u)},u.onerror=l,(ev(s)||i)&&(u.crossOrigin="anonymous"),u.src=s,u.complete===!0&&setTimeout(function(){return c(u)},500),a._options.imageTimeout>0&&setTimeout(function(){return l("Timed out (".concat(a._options.imageTimeout,"ms) loading image"))},a._options.imageTimeout)})];case 6:return[2,o.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var A=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(r,s){var a=ke.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;o.onload=function(){if(o.status===200)if(a==="text")r(o.response);else{var u=new FileReader;u.addEventListener("load",function(){return r(u.result)},!1),u.addEventListener("error",function(d){return s(d)},!1),u.readAsDataURL(o.response)}else s("Failed to proxy resource ".concat(i," with status code ").concat(o.status))},o.onerror=s;var c=n.indexOf("?")>-1?"&":"?";if(o.open("GET","".concat(n).concat(c,"url=").concat(encodeURIComponent(e),"&responseType=").concat(a)),a!=="text"&&o instanceof XMLHttpRequest&&(o.responseType=a),A._options.imageTimeout){var l=A._options.imageTimeout;o.timeout=l,o.ontimeout=function(){return s("Timed out (".concat(l,"ms) proxying ").concat(i))}}o.send()})},t}(),YB=/^data:image\/svg\+xml/i,zB=/^data:image\/.*;base64,/i,ZB=/^data:image\/.*/i,$B=function(t){return ke.SUPPORT_SVG_DRAWING||!Av(t)},Ss=function(t){return ZB.test(t)},ev=function(t){return zB.test(t)},ks=function(t){return t.substr(0,4)==="blob"},Av=function(t){return t.substr(-3).toLowerCase()==="svg"||YB.test(t)},L=function(){function t(e,A){this.type=0,this.x=e,this.y=A}return t.prototype.add=function(e,A){return new t(this.x+e,this.y+A)},t}(),It=function(t,e,A){return new L(t.x+(e.x-t.x)*A,t.y+(e.y-t.y)*A)},Ti=function(){function t(e,A,n,i){this.type=1,this.start=e,this.startControl=A,this.endControl=n,this.end=i}return t.prototype.subdivide=function(e,A){var n=It(this.start,this.startControl,e),i=It(this.startControl,this.endControl,e),r=It(this.endControl,this.end,e),s=It(n,i,e),a=It(i,r,e),o=It(s,a,e);return A?new t(this.start,n,s,o):new t(o,a,r,this.end)},t.prototype.add=function(e,A){return new t(this.start.add(e,A),this.startControl.add(e,A),this.endControl.add(e,A),this.end.add(e,A))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),$e=function(t){return t.type===1},tv=function(){function t(e){var A=e.styles,n=e.bounds,i=dn(A.borderTopLeftRadius,n.width,n.height),r=i[0],s=i[1],a=dn(A.borderTopRightRadius,n.width,n.height),o=a[0],c=a[1],l=dn(A.borderBottomRightRadius,n.width,n.height),u=l[0],d=l[1],h=dn(A.borderBottomLeftRadius,n.width,n.height),p=h[0],f=h[1],m=[];m.push((r+o)/n.width),m.push((p+u)/n.width),m.push((s+f)/n.height),m.push((c+d)/n.height);var B=Math.max.apply(Math,m);B>1&&(r/=B,s/=B,o/=B,c/=B,u/=B,d/=B,p/=B,f/=B);var b=n.width-o,U=n.height-d,w=n.width-u,v=n.height-f,y=A.borderTopWidth,E=A.borderRightWidth,T=A.borderBottomWidth,F=A.borderLeftWidth,R=$(A.paddingTop,e.bounds.width),D=$(A.paddingRight,e.bounds.width),O=$(A.paddingBottom,e.bounds.width),M=$(A.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||s>0?ie(n.left+F/3,n.top+y/3,r-F/3,s-y/3,Y.TOP_LEFT):new L(n.left+F/3,n.top+y/3),this.topRightBorderDoubleOuterBox=r>0||s>0?ie(n.left+b,n.top+y/3,o-E/3,c-y/3,Y.TOP_RIGHT):new L(n.left+n.width-E/3,n.top+y/3),this.bottomRightBorderDoubleOuterBox=u>0||d>0?ie(n.left+w,n.top+U,u-E/3,d-T/3,Y.BOTTOM_RIGHT):new L(n.left+n.width-E/3,n.top+n.height-T/3),this.bottomLeftBorderDoubleOuterBox=p>0||f>0?ie(n.left+F/3,n.top+v,p-F/3,f-T/3,Y.BOTTOM_LEFT):new L(n.left+F/3,n.top+n.height-T/3),this.topLeftBorderDoubleInnerBox=r>0||s>0?ie(n.left+F*2/3,n.top+y*2/3,r-F*2/3,s-y*2/3,Y.TOP_LEFT):new L(n.left+F*2/3,n.top+y*2/3),this.topRightBorderDoubleInnerBox=r>0||s>0?ie(n.left+b,n.top+y*2/3,o-E*2/3,c-y*2/3,Y.TOP_RIGHT):new L(n.left+n.width-E*2/3,n.top+y*2/3),this.bottomRightBorderDoubleInnerBox=u>0||d>0?ie(n.left+w,n.top+U,u-E*2/3,d-T*2/3,Y.BOTTOM_RIGHT):new L(n.left+n.width-E*2/3,n.top+n.height-T*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||f>0?ie(n.left+F*2/3,n.top+v,p-F*2/3,f-T*2/3,Y.BOTTOM_LEFT):new L(n.left+F*2/3,n.top+n.height-T*2/3),this.topLeftBorderStroke=r>0||s>0?ie(n.left+F/2,n.top+y/2,r-F/2,s-y/2,Y.TOP_LEFT):new L(n.left+F/2,n.top+y/2),this.topRightBorderStroke=r>0||s>0?ie(n.left+b,n.top+y/2,o-E/2,c-y/2,Y.TOP_RIGHT):new L(n.left+n.width-E/2,n.top+y/2),this.bottomRightBorderStroke=u>0||d>0?ie(n.left+w,n.top+U,u-E/2,d-T/2,Y.BOTTOM_RIGHT):new L(n.left+n.width-E/2,n.top+n.height-T/2),this.bottomLeftBorderStroke=p>0||f>0?ie(n.left+F/2,n.top+v,p-F/2,f-T/2,Y.BOTTOM_LEFT):new L(n.left+F/2,n.top+n.height-T/2),this.topLeftBorderBox=r>0||s>0?ie(n.left,n.top,r,s,Y.TOP_LEFT):new L(n.left,n.top),this.topRightBorderBox=o>0||c>0?ie(n.left+b,n.top,o,c,Y.TOP_RIGHT):new L(n.left+n.width,n.top),this.bottomRightBorderBox=u>0||d>0?ie(n.left+w,n.top+U,u,d,Y.BOTTOM_RIGHT):new L(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=p>0||f>0?ie(n.left,n.top+v,p,f,Y.BOTTOM_LEFT):new L(n.left,n.top+n.height),this.topLeftPaddingBox=r>0||s>0?ie(n.left+F,n.top+y,Math.max(0,r-F),Math.max(0,s-y),Y.TOP_LEFT):new L(n.left+F,n.top+y),this.topRightPaddingBox=o>0||c>0?ie(n.left+Math.min(b,n.width-E),n.top+y,b>n.width+E?0:Math.max(0,o-E),Math.max(0,c-y),Y.TOP_RIGHT):new L(n.left+n.width-E,n.top+y),this.bottomRightPaddingBox=u>0||d>0?ie(n.left+Math.min(w,n.width-F),n.top+Math.min(U,n.height-T),Math.max(0,u-E),Math.max(0,d-T),Y.BOTTOM_RIGHT):new L(n.left+n.width-E,n.top+n.height-T),this.bottomLeftPaddingBox=p>0||f>0?ie(n.left+F,n.top+Math.min(v,n.height-T),Math.max(0,p-F),Math.max(0,f-T),Y.BOTTOM_LEFT):new L(n.left+F,n.top+n.height-T),this.topLeftContentBox=r>0||s>0?ie(n.left+F+M,n.top+y+R,Math.max(0,r-(F+M)),Math.max(0,s-(y+R)),Y.TOP_LEFT):new L(n.left+F+M,n.top+y+R),this.topRightContentBox=o>0||c>0?ie(n.left+Math.min(b,n.width+F+M),n.top+y+R,b>n.width+F+M?0:o-F+M,c-(y+R),Y.TOP_RIGHT):new L(n.left+n.width-(E+D),n.top+y+R),this.bottomRightContentBox=u>0||d>0?ie(n.left+Math.min(w,n.width-(F+M)),n.top+Math.min(U,n.height+y+R),Math.max(0,u-(E+D)),d-(T+O),Y.BOTTOM_RIGHT):new L(n.left+n.width-(E+D),n.top+n.height-(T+O)),this.bottomLeftContentBox=p>0||f>0?ie(n.left+F+M,n.top+v,Math.max(0,p-(F+M)),f-(T+O),Y.BOTTOM_LEFT):new L(n.left+F+M,n.top+n.height-(T+O))}return t}(),Y;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var ie=function(t,e,A,n,i){var r=4*((Math.sqrt(2)-1)/3),s=A*r,a=n*r,o=t+A,c=e+n;switch(i){case Y.TOP_LEFT:return new Ti(new L(t,c),new L(t,c-a),new L(o-s,e),new L(o,e));case Y.TOP_RIGHT:return new Ti(new L(t,e),new L(t+s,e),new L(o,c-a),new L(o,c));case Y.BOTTOM_RIGHT:return new Ti(new L(o,e),new L(o,e+a),new L(t+s,c),new L(t,c));case Y.BOTTOM_LEFT:default:return new Ti(new L(o,c),new L(o-s,c),new L(t,e+a),new L(t,e))}},Fi=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},nv=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},Ii=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},iv=function(){function t(e,A,n){this.offsetX=e,this.offsetY=A,this.matrix=n,this.type=0,this.target=6}return t}(),xi=function(){function t(e,A){this.path=e,this.target=A,this.type=1}return t}(),rv=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),sv=function(t){return t.type===0},fl=function(t){return t.type===1},av=function(t){return t.type===2},gl=function(t,e){return t.length===e.length?t.some(function(A,n){return A===e[n]}):!1},ov=function(t,e,A,n,i){return t.map(function(r,s){switch(s){case 0:return r.add(e,A);case 1:return r.add(e+n,A);case 2:return r.add(e+n,A+i);case 3:return r.add(e,A+i)}return r})},pl=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),ml=function(){function t(e,A){if(this.container=e,this.parent=A,this.effects=[],this.curves=new tv(this.container),this.container.styles.opacity<1&&this.effects.push(new rv(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new iv(n,i,r))}if(this.container.styles.overflowX!==0){var s=Fi(this.curves),a=Ii(this.curves);gl(s,a)?this.effects.push(new xi(s,6)):(this.effects.push(new xi(s,2)),this.effects.push(new xi(a,4)))}}return t.prototype.getEffects=function(e){for(var A=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,i=this.effects.slice(0);n;){var r=n.effects.filter(function(o){return!fl(o)});if(A||n.container.styles.position!==0||!n.parent){if(A=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var s=Fi(n.curves),a=Ii(n.curves);gl(s,a)||i.unshift(new xi(a,6))}i.unshift.apply(i,r)}else i.unshift.apply(i,r);n=n.parent}return i.filter(function(o){return be(o.target,e)})},t}(),Ts=function(t,e,A,n){t.container.elements.forEach(function(i){var r=be(i.flags,4),s=be(i.flags,2),a=new ml(i,t);be(i.styles.display,2048)&&n.push(a);var o=be(i.flags,8)?[]:n;if(r||s){var c=r||i.styles.isPositioned()?A:e,l=new pl(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var d=0;c.negativeZIndex.some(function(p,f){return u>p.element.container.styles.zIndex.order?(d=f,!1):d>0}),c.negativeZIndex.splice(d,0,l)}else if(u>0){var h=0;c.positiveZIndex.some(function(p,f){return u>=p.element.container.styles.zIndex.order?(h=f+1,!1):h>0}),c.positiveZIndex.splice(h,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else i.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);Ts(a,l,r?l:A,o)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),Ts(a,e,A,o);be(i.flags,8)&&Bl(i,o)})},Bl=function(t,e){for(var A=t instanceof ms?t.start:1,n=t instanceof ms?t.reversed:!1,i=0;i<e.length;i++){var r=e[i];r.container instanceof Gc&&typeof r.container.value=="number"&&r.container.value!==0&&(A=r.container.value),r.listValue=Bn(A,r.container.styles.listStyleType,!0),A+=n?-1:1}},cv=function(t){var e=new ml(t,null),A=new pl(e),n=[];return Ts(e,A,A,n),Bl(e.container,n),A},vl=function(t,e){switch(e){case 0:return eA(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return eA(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return eA(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);case 3:default:return eA(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},lv=function(t,e){switch(e){case 0:return eA(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return eA(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return eA(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);case 3:default:return eA(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},uv=function(t,e){switch(e){case 0:return eA(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return eA(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return eA(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);case 3:default:return eA(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},dv=function(t,e){switch(e){case 0:return _i(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return _i(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return _i(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);case 3:default:return _i(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},_i=function(t,e){var A=[];return $e(t)?A.push(t.subdivide(.5,!1)):A.push(t),$e(e)?A.push(e.subdivide(.5,!0)):A.push(e),A},eA=function(t,e,A,n){var i=[];return $e(t)?i.push(t.subdivide(.5,!1)):i.push(t),$e(A)?i.push(A.subdivide(.5,!0)):i.push(A),$e(n)?i.push(n.subdivide(.5,!0).reverse()):i.push(n),$e(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},Cl=function(t){var e=t.bounds,A=t.styles;return e.add(A.borderLeftWidth,A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth),-(A.borderTopWidth+A.borderBottomWidth))},Pi=function(t){var e=t.styles,A=t.bounds,n=$(e.paddingLeft,A.width),i=$(e.paddingRight,A.width),r=$(e.paddingTop,A.width),s=$(e.paddingBottom,A.width);return A.add(n+e.borderLeftWidth,r+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+n+i),-(e.borderTopWidth+e.borderBottomWidth+r+s))},hv=function(t,e){return t===0?e.bounds:t===2?Pi(e):Cl(e)},fv=function(t,e){return t===0?e.bounds:t===2?Pi(e):Cl(e)},Fs=function(t,e,A){var n=hv(_t(t.styles.backgroundOrigin,e),t),i=fv(_t(t.styles.backgroundClip,e),t),r=gv(_t(t.styles.backgroundSize,e),A,n),s=r[0],a=r[1],o=dn(_t(t.styles.backgroundPosition,e),n.width-s,n.height-a),c=pv(_t(t.styles.backgroundRepeat,e),o,r,n,i),l=Math.round(n.left+o[0]),u=Math.round(n.top+o[1]);return s=Math.max(1,s),a=Math.max(1,a),[c,l,u,s,a]},xt=function(t){return j(t)&&t.value===St.AUTO},Ri=function(t){return typeof t=="number"},gv=function(t,e,A){var n=e[0],i=e[1],r=e[2],s=t[0],a=t[1];if(!s)return[0,0];if(te(s)&&a&&te(a))return[$(s,A.width),$(a,A.height)];var o=Ri(r);if(j(s)&&(s.value===St.CONTAIN||s.value===St.COVER)){if(Ri(r)){var c=A.width/A.height;return c<r!=(s.value===St.COVER)?[A.width,A.width/r]:[A.height*r,A.height]}return[A.width,A.height]}var l=Ri(n),u=Ri(i),d=l||u;if(xt(s)&&(!a||xt(a))){if(l&&u)return[n,i];if(!o&&!d)return[A.width,A.height];if(d&&o){var h=l?n:i*r,p=u?i:n/r;return[h,p]}var f=l?n:A.width,m=u?i:A.height;return[f,m]}if(o){var B=0,b=0;return te(s)?B=$(s,A.width):te(a)&&(b=$(a,A.height)),xt(s)?B=b*r:(!a||xt(a))&&(b=B/r),[B,b]}var U=null,w=null;if(te(s)?U=$(s,A.width):a&&te(a)&&(w=$(a,A.height)),U!==null&&(!a||xt(a))&&(w=l&&u?U/n*i:A.height),w!==null&&xt(s)&&(U=l&&u?w/i*n:A.width),U!==null&&w!==null)return[U,w];throw new Error("Unable to calculate background-size for element")},_t=function(t,e){var A=t[e];return typeof A>"u"?t[0]:A},pv=function(t,e,A,n,i){var r=e[0],s=e[1],a=A[0],o=A[1];switch(t){case 2:return[new L(Math.round(n.left),Math.round(n.top+s)),new L(Math.round(n.left+n.width),Math.round(n.top+s)),new L(Math.round(n.left+n.width),Math.round(o+n.top+s)),new L(Math.round(n.left),Math.round(o+n.top+s))];case 3:return[new L(Math.round(n.left+r),Math.round(n.top)),new L(Math.round(n.left+r+a),Math.round(n.top)),new L(Math.round(n.left+r+a),Math.round(n.height+n.top)),new L(Math.round(n.left+r),Math.round(n.height+n.top))];case 1:return[new L(Math.round(n.left+r),Math.round(n.top+s)),new L(Math.round(n.left+r+a),Math.round(n.top+s)),new L(Math.round(n.left+r+a),Math.round(n.top+s+o)),new L(Math.round(n.left+r),Math.round(n.top+s+o))];default:return[new L(Math.round(i.left),Math.round(i.top)),new L(Math.round(i.left+i.width),Math.round(i.top)),new L(Math.round(i.left+i.width),Math.round(i.height+i.top)),new L(Math.round(i.left),Math.round(i.height+i.top))]}},mv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",wl="Hidden Text",Bv=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,A){var n=this._document.createElement("div"),i=this._document.createElement("img"),r=this._document.createElement("span"),s=this._document.body;n.style.visibility="hidden",n.style.fontFamily=e,n.style.fontSize=A,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",s.appendChild(n),i.src=mv,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",r.style.fontFamily=e,r.style.fontSize=A,r.style.margin="0",r.style.padding="0",r.appendChild(this._document.createTextNode(wl)),n.appendChild(r),n.appendChild(i);var a=i.offsetTop-r.offsetTop+2;n.removeChild(r),n.appendChild(this._document.createTextNode(wl)),n.style.lineHeight="normal",i.style.verticalAlign="super";var o=i.offsetTop-n.offsetTop+2;return s.removeChild(n),{baseline:a,middle:o}},t.prototype.getMetrics=function(e,A){var n="".concat(e," ").concat(A);return typeof this._data[n]>"u"&&(this._data[n]=this.parseMetrics(e,A)),this._data[n]},t}(),bl=function(){function t(e,A){this.context=e,this.options=A}return t}(),vv=1e4,Cv=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i._activeEffects=[],i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),n.canvas||(i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px")),i.fontMetrics=new Bv(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized (".concat(n.width,"x").concat(n.height,") with scale ").concat(n.scale)),i}return e.prototype.applyEffects=function(A){for(var n=this;this._activeEffects.length;)this.popEffect();A.forEach(function(i){return n.applyEffect(i)})},e.prototype.applyEffect=function(A){this.ctx.save(),av(A)&&(this.ctx.globalAlpha=A.opacity),sv(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),fl(A)&&(this.path(A.path),this.ctx.clip()),this._activeEffects.push(A)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(A){return Re(this,void 0,void 0,function(){var n;return xe(this,function(i){switch(i.label){case 0:return n=A.element.container.styles,n.isVisible()?[4,this.renderStackContent(A)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(A){return Re(this,void 0,void 0,function(){return xe(this,function(n){switch(n.label){case 0:return be(A.container.flags,16),A.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(A)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(A)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(A,n,i){var r=this;if(n===0)navigator.userAgent.indexOf("Firefox")===-1?(this.ctx.textBaseline="ideographic",this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+A.bounds.height)):this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+i);else{var s=ps(A.text);s.reduce(function(a,o){return r.ctx.fillText(o,a,A.bounds.top+i),a+r.ctx.measureText(o).width},A.bounds.left)}},e.prototype.createFontStyle=function(A){var n=A.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=Qv(A.fontFamily).join(", "),r=HA(A.fontSize)?"".concat(A.fontSize.number).concat(A.fontSize.unit):"".concat(A.fontSize.number,"px");return[[A.fontStyle,n,A.fontWeight,r,i].join(" "),i,r]},e.prototype.renderTextNode=function(A,n){return Re(this,void 0,void 0,function(){var i,r,s=this;return xe(this,function(a){return i=this.createFontStyle(n)[0],this.ctx.font=i,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",r=n.paintOrder,A.textBounds.forEach(function(o){r.forEach(function(c){switch(c){case 0:s.ctx.fillStyle=Ue(n.color),s.renderTextWithLetterSpacing(o,n.letterSpacing,n.fontSize.number);var l=n.textShadow;if(l.length&&o.text.trim().length&&(l.slice(0).reverse().forEach(function(d){s.ctx.shadowColor=Ue(d.color),s.ctx.shadowOffsetX=d.offsetX.number*s.options.scale,s.ctx.shadowOffsetY=d.offsetY.number*s.options.scale,s.ctx.shadowBlur=d.blur.number,s.renderTextWithLetterSpacing(o,n.letterSpacing,n.fontSize.number)}),s.ctx.shadowColor="",s.ctx.shadowOffsetX=0,s.ctx.shadowOffsetY=0,s.ctx.shadowBlur=0),n.textDecorationLine.length){s.ctx.fillStyle=Ue(n.textDecorationColor||n.color);var u=1;n.textDecorationLine.forEach(function(d){switch(d){case 1:s.ctx.fillRect(o.bounds.left,o.bounds.top+o.bounds.height-u,o.bounds.width,u);break;case 2:s.ctx.fillRect(o.bounds.left,o.bounds.top,o.bounds.width,u);break;case 3:s.ctx.fillRect(o.bounds.left,o.bounds.top+(o.bounds.height/2-u/2),o.bounds.width,u);break}})}break;case 1:n.webkitTextStrokeWidth&&o.text.trim().length&&(s.ctx.strokeStyle=Ue(n.webkitTextStrokeColor),s.ctx.lineWidth=n.webkitTextStrokeWidth,s.ctx.lineJoin=window.chrome?"miter":"round",s.ctx.strokeText(o.text,o.bounds.left,o.bounds.top+o.bounds.height)),s.ctx.strokeStyle="",s.ctx.lineWidth=0,s.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(A,n,i){var r=i.naturalWidth||A.intrinsicWidth,s=i.naturalHeight||A.intrinsicHeight;if(i&&r>0&&s>0){var a=Pi(A),o=Ii(n);this.path(o),this.ctx.save(),this.ctx.clip();var c=0,l=0,u=r,d=s,h=a.left,p=a.top,f=a.width,m=a.height,B=A.styles.objectFit,b=f/m,U=u/d;if(B===2)U>b?(m=f/U,p+=(a.height-m)/2):(f=m*U,h+=(a.width-f)/2);else if(B===4)U>b?(u=d*b,c+=(r-u)/2):(d=u/b,l+=(s-d)/2);else if(B===8)u>f?(c+=(u-f)/2,u=f):(h+=(f-u)/2,f=u),d>m?(l+=(d-m)/2,d=m):(p+=(m-d)/2,m=d);else if(B===16){var w=U>b?f:m*U,v=u>f?u:f;w<v?U>b?(m=f/U,p+=(a.height-m)/2):(f=m*U,h+=(a.width-f)/2):(u>f?(c+=(u-f)/2,u=f):(h+=(f-u)/2,f=u),d>m?(l+=(d-m)/2,d=m):(p+=(m-d)/2,m=d))}this.ctx.drawImage(i,c,l,u,d,h,p,f,m),this.ctx.restore()}},e.prototype.renderNodeContent=function(A){return Re(this,void 0,void 0,function(){var n,i,r,s,a,o,U,U,c,l,u,d,v,h,p,f,y,m,B,b,U,w,v,y;return xe(this,function(E){switch(E.label){case 0:this.applyEffects(A.getEffects(4)),n=A.container,i=A.curves,r=n.styles,s=0,a=n.textNodes,E.label=1;case 1:return s<a.length?(o=a[s],[4,this.renderTextNode(o,r)]):[3,4];case 2:E.sent(),E.label=3;case 3:return s++,[3,1];case 4:if(!(n instanceof Nc))return[3,8];E.label=5;case 5:return E.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return U=E.sent(),this.renderReplacedElement(n,i,U),[3,8];case 7:return E.sent(),this.context.logger.error("Error loading image ".concat(n.src)),[3,8];case 8:if(n instanceof Kc&&this.renderReplacedElement(n,i,n.canvas),!(n instanceof Vc))return[3,12];E.label=9;case 9:return E.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return U=E.sent(),this.renderReplacedElement(n,i,U),[3,12];case 11:return E.sent(),this.context.logger.error("Error loading svg ".concat(n.svg.substring(0,255))),[3,12];case 12:return n instanceof Xc&&n.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,c.render(n.tree)]):[3,14];case 13:l=E.sent(),n.width&&n.height&&this.ctx.drawImage(l,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),E.label=14;case 14:if(n instanceof Bs&&(u=Math.min(n.bounds.width,n.bounds.height),n.type===yi?n.checked&&(this.ctx.save(),this.path([new L(n.bounds.left+u*.39363,n.bounds.top+u*.79),new L(n.bounds.left+u*.16,n.bounds.top+u*.5549),new L(n.bounds.left+u*.27347,n.bounds.top+u*.44071),new L(n.bounds.left+u*.39694,n.bounds.top+u*.5649),new L(n.bounds.left+u*.72983,n.bounds.top+u*.23),new L(n.bounds.left+u*.84,n.bounds.top+u*.34085),new L(n.bounds.left+u*.39363,n.bounds.top+u*.79)]),this.ctx.fillStyle=Ue(jc),this.ctx.fill(),this.ctx.restore()):n.type===Ui&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+u/2,n.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ue(jc),this.ctx.fill(),this.ctx.restore())),wv(n)&&n.value.length){switch(d=this.createFontStyle(r),v=d[0],h=d[1],p=d[2],f=this.fontMetrics.getMetrics(h,p).baseline,this.ctx.font=v,this.ctx.fillStyle=Ue(r.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=yv(n.styles.textAlign),y=Pi(n),m=0,n.styles.textAlign){case 1:m+=y.width/2;break;case 2:m+=y.width;break}B=y.add(m,0,0,-y.height/2+1),this.ctx.save(),this.path([new L(y.left,y.top),new L(y.left+y.width,y.top),new L(y.left+y.width,y.top+y.height),new L(y.left,y.top+y.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new pn(n.value,B),r.letterSpacing,f),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!be(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(b=n.styles.listStyleImage,b.type!==0)return[3,18];U=void 0,w=b.url,E.label=15;case 15:return E.trys.push([15,17,,18]),[4,this.context.cache.match(w)];case 16:return U=E.sent(),this.ctx.drawImage(U,n.bounds.left-(U.width+10),n.bounds.top),[3,18];case 17:return E.sent(),this.context.logger.error("Error loading list-style-image ".concat(w)),[3,18];case 18:return[3,20];case 19:A.listValue&&n.styles.listStyleType!==-1&&(v=this.createFontStyle(r)[0],this.ctx.font=v,this.ctx.fillStyle=Ue(r.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",y=new EA(n.bounds.left,n.bounds.top+$(n.styles.paddingTop,n.bounds.width),n.bounds.width,bc(r.lineHeight,r.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new pn(A.listValue,y),r.letterSpacing,bc(r.lineHeight,r.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),E.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(A){return Re(this,void 0,void 0,function(){var n,i,B,r,s,B,a,o,B,c,l,B,u,d,B,h,p,B,f,m,B;return xe(this,function(b){switch(b.label){case 0:return be(A.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(A.element)];case 1:b.sent(),n=0,i=A.negativeZIndex,b.label=2;case 2:return n<i.length?(B=i[n],[4,this.renderStack(B)]):[3,5];case 3:b.sent(),b.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(A.element)];case 6:b.sent(),r=0,s=A.nonInlineLevel,b.label=7;case 7:return r<s.length?(B=s[r],[4,this.renderNode(B)]):[3,10];case 8:b.sent(),b.label=9;case 9:return r++,[3,7];case 10:a=0,o=A.nonPositionedFloats,b.label=11;case 11:return a<o.length?(B=o[a],[4,this.renderStack(B)]):[3,14];case 12:b.sent(),b.label=13;case 13:return a++,[3,11];case 14:c=0,l=A.nonPositionedInlineLevel,b.label=15;case 15:return c<l.length?(B=l[c],[4,this.renderStack(B)]):[3,18];case 16:b.sent(),b.label=17;case 17:return c++,[3,15];case 18:u=0,d=A.inlineLevel,b.label=19;case 19:return u<d.length?(B=d[u],[4,this.renderNode(B)]):[3,22];case 20:b.sent(),b.label=21;case 21:return u++,[3,19];case 22:h=0,p=A.zeroOrAutoZIndexOrTransformedOrOpacity,b.label=23;case 23:return h<p.length?(B=p[h],[4,this.renderStack(B)]):[3,26];case 24:b.sent(),b.label=25;case 25:return h++,[3,23];case 26:f=0,m=A.positiveZIndex,b.label=27;case 27:return f<m.length?(B=m[f],[4,this.renderStack(B)]):[3,30];case 28:b.sent(),b.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(A){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(A.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()},e.prototype.formatPath=function(A){var n=this;A.forEach(function(i,r){var s=$e(i)?i.start:i;r===0?n.ctx.moveTo(s.x,s.y):n.ctx.lineTo(s.x,s.y),$e(i)&&n.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(A,n,i,r){this.path(A),this.ctx.fillStyle=n,this.ctx.translate(i,r),this.ctx.fill(),this.ctx.translate(-i,-r)},e.prototype.resizeImage=function(A,n,i){var r,s=(r=this.canvas.ownerDocument)!==null&&r!==void 0?r:document,a=s.createElement("canvas");a.width=Math.max(1,n),a.height=Math.max(1,i);var o=a.getContext("2d");return o.drawImage(A,0,0,A.width,A.height,0,0,n,i),a},e.prototype.renderBackgroundImage=function(A){return Re(this,void 0,void 0,function(){var n,i,r,s,a,o;return xe(this,function(c){switch(c.label){case 0:n=A.styles.backgroundImage.length-1,i=function(l){var u,d,h,p,f,O,ve,Ce,N,V,R,m,O,ve,Ce,N,V,B,b,U,w,v,y,E,T,F,R,D,O,M,ae,N,V,Fe,ve,Ce,tA,Le,we,nA,Ye,Ie,it,We;return xe(this,function(oe){switch(oe.label){case 0:if(l.type!==0)return[3,5];u=void 0,d=l.url,oe.label=1;case 1:return oe.trys.push([1,3,,4]),[4,r.context.cache.match(d)];case 2:return u=oe.sent(),[3,4];case 3:return oe.sent(),r.context.logger.error("Error loading background-image ".concat(d)),[3,4];case 4:return u&&(h=isNaN(u.width)||u.width===0?1:u.width,p=isNaN(u.height)||u.height===0?1:u.height,f=Fs(A,n,[h,p,h/p]),O=f[0],ve=f[1],Ce=f[2],N=f[3],V=f[4],R=r.ctx.createPattern(r.resizeImage(u,N,V),"repeat"),r.renderRepeat(O,R,ve,Ce)),[3,6];case 5:nm(l)?(m=Fs(A,n,[null,null,null]),O=m[0],ve=m[1],Ce=m[2],N=m[3],V=m[4],B=Zp(l.angle,N,V),b=B[0],U=B[1],w=B[2],v=B[3],y=B[4],E=document.createElement("canvas"),E.width=N,E.height=V,T=E.getContext("2d"),F=T.createLinearGradient(U,v,w,y),uc(l.stops,b||1).forEach(function(Je){return F.addColorStop(Je.stop,Ue(Je.color))}),T.fillStyle=F,T.fillRect(0,0,N,V),N>0&&V>0&&(R=r.ctx.createPattern(E,"repeat"),r.renderRepeat(O,R,ve,Ce))):im(l)&&(D=Fs(A,n,[null,null,null]),O=D[0],M=D[1],ae=D[2],N=D[3],V=D[4],Fe=l.position.length===0?[zr]:l.position,ve=$(Fe[0],N),Ce=$(Fe[Fe.length-1],V),tA=$p(l,ve,Ce,N,V),Le=tA[0],we=tA[1],Le>0&&we>0&&(nA=r.ctx.createRadialGradient(M+ve,ae+Ce,0,M+ve,ae+Ce,Le),uc(l.stops,Le*2).forEach(function(Je){return nA.addColorStop(Je.stop,Ue(Je.color))}),r.path(O),r.ctx.fillStyle=nA,Le!==we?(Ye=A.bounds.left+.5*A.bounds.width,Ie=A.bounds.top+.5*A.bounds.height,it=we/Le,We=1/it,r.ctx.save(),r.ctx.translate(Ye,Ie),r.ctx.transform(1,0,0,it,0,0),r.ctx.translate(-Ye,-Ie),r.ctx.fillRect(M,We*(ae-Ie)+Ie,N,V*We),r.ctx.restore()):r.ctx.fill())),oe.label=6;case 6:return n--,[2]}})},r=this,s=0,a=A.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<a.length?(o=a[s],[5,i(o)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(A,n,i){return Re(this,void 0,void 0,function(){return xe(this,function(r){return this.path(vl(i,n)),this.ctx.fillStyle=Ue(A),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(A,n,i,r){return Re(this,void 0,void 0,function(){var s,a;return xe(this,function(o){switch(o.label){case 0:return n<3?[4,this.renderSolidBorder(A,i,r)]:[3,2];case 1:return o.sent(),[2];case 2:return s=lv(r,i),this.path(s),this.ctx.fillStyle=Ue(A),this.ctx.fill(),a=uv(r,i),this.path(a),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(A){return Re(this,void 0,void 0,function(){var n,i,r,s,a,o,c,l,u=this;return xe(this,function(d){switch(d.label){case 0:return this.applyEffects(A.getEffects(2)),n=A.container.styles,i=!NA(n.backgroundColor)||n.backgroundImage.length,r=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],s=bv(_t(n.backgroundClip,0),A.curves),i||n.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),NA(n.backgroundColor)||(this.ctx.fillStyle=Ue(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(A.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(h){u.ctx.save();var p=Fi(A.curves),f=h.inset?0:vv,m=ov(p,-f+(h.inset?1:-1)*h.spread.number,(h.inset?1:-1)*h.spread.number,h.spread.number*(h.inset?-2:2),h.spread.number*(h.inset?-2:2));h.inset?(u.path(p),u.ctx.clip(),u.mask(m)):(u.mask(p),u.ctx.clip(),u.path(m)),u.ctx.shadowOffsetX=h.offsetX.number+f,u.ctx.shadowOffsetY=h.offsetY.number,u.ctx.shadowColor=Ue(h.color),u.ctx.shadowBlur=h.blur.number,u.ctx.fillStyle=h.inset?Ue(h.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),d.label=2;case 2:a=0,o=0,c=r,d.label=3;case 3:return o<c.length?(l=c[o],l.style!==0&&!NA(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,a,A.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,a,A.curves,3)];case 6:return d.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,a,A.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,a,A.curves)];case 10:d.sent(),d.label=11;case 11:a++,d.label=12;case 12:return o++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(A,n,i,r,s){return Re(this,void 0,void 0,function(){var a,o,c,l,u,d,h,p,f,m,B,b,U,w,v,y,v,y;return xe(this,function(E){return this.ctx.save(),a=dv(r,i),o=vl(r,i),s===2&&(this.path(o),this.ctx.clip()),$e(o[0])?(c=o[0].start.x,l=o[0].start.y):(c=o[0].x,l=o[0].y),$e(o[1])?(u=o[1].end.x,d=o[1].end.y):(u=o[1].x,d=o[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(l-d),this.ctx.beginPath(),s===3?this.formatPath(a):this.formatPath(o.slice(0,2)),p=n<3?n*3:n*2,f=n<3?n*2:n,s===3&&(p=n,f=n),m=!0,h<=p*2?m=!1:h<=p*2+f?(B=h/(2*p+f),p*=B,f*=B):(b=Math.floor((h+f)/(p+f)),U=(h-b*p)/(b-1),w=(h-(b+1)*p)/b,f=w<=0||Math.abs(f-U)<Math.abs(f-w)?U:w),m&&(s===3?this.ctx.setLineDash([0,p+f]):this.ctx.setLineDash([p,f])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=Ue(A),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&($e(o[0])&&(v=o[3],y=o[0],this.ctx.beginPath(),this.formatPath([new L(v.end.x,v.end.y),new L(y.start.x,y.start.y)]),this.ctx.stroke()),$e(o[1])&&(v=o[1],y=o[2],this.ctx.beginPath(),this.formatPath([new L(v.end.x,v.end.y),new L(y.start.x,y.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(A){return Re(this,void 0,void 0,function(){var n;return xe(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ue(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=cv(A),[4,this.renderStack(n)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(bl),wv=function(t){return t instanceof Jc||t instanceof Wc?!0:t instanceof Bs&&t.type!==Ui&&t.type!==yi},bv=function(t,e){switch(t){case 0:return Fi(e);case 2:return nv(e);case 1:default:return Ii(e)}},yv=function(t){switch(t){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Uv=["-apple-system","system-ui"],Qv=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(e){return Uv.indexOf(e)===-1}):t},Ev=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=n,i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px"),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(n.width,"x").concat(n.height," at ").concat(n.x,",").concat(n.y,") with scale ").concat(n.scale)),i}return e.prototype.render=function(A){return Re(this,void 0,void 0,function(){var n,i;return xe(this,function(r){switch(r.label){case 0:return n=gs(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),[4,Sv(n)];case 1:return i=r.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ue(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(bl),Sv=function(t){return new Promise(function(e,A){var n=new Image;n.onload=function(){e(n)},n.onerror=A,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(t)))})},kv=function(){function t(e){var A=e.id,n=e.enabled;this.id=A,this.enabled=n,this.start=Date.now()}return t.prototype.debug=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.debug=="function"?console.debug.apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1))},t.prototype.warn=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.prototype.error=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.instances={},t}(),Tv=function(){function t(e,A){var n;this.windowBounds=A,this.instanceName="#".concat(t.instanceCount++),this.logger=new kv({id:this.instanceName,enabled:e.logging}),this.cache=(n=e.cache)!==null&&n!==void 0?n:new qB(this,e)}return t.instanceCount=1,t}(),Fv=function(t,e){return e===void 0&&(e={}),Iv(t,e)};typeof window<"u"&&Es.setContext(window);var Iv=function(t,e){return Re(void 0,void 0,void 0,function(){var A,n,i,r,s,a,o,c,l,u,d,h,p,f,m,B,b,U,w,v,E,y,E,T,F,R,D,O,M,ae,N,V,Fe,ve,Ce,tA,Le,we,nA,Ye;return xe(this,function(Ie){switch(Ie.label){case 0:if(!t||typeof t!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(A=t.ownerDocument,!A)throw new Error("Element is not attached to a Document");if(n=A.defaultView,!n)throw new Error("Document is not attached to a Window");return i={allowTaint:(T=e.allowTaint)!==null&&T!==void 0?T:!1,imageTimeout:(F=e.imageTimeout)!==null&&F!==void 0?F:15e3,proxy:e.proxy,useCORS:(R=e.useCORS)!==null&&R!==void 0?R:!1,customIsSameOrigin:e.customIsSameOrigin},r=Fr({logging:(D=e.logging)!==null&&D!==void 0?D:!0,cache:e.cache},i),s={windowWidth:(O=e.windowWidth)!==null&&O!==void 0?O:n.innerWidth,windowHeight:(M=e.windowHeight)!==null&&M!==void 0?M:n.innerHeight,scrollX:(ae=e.scrollX)!==null&&ae!==void 0?ae:n.pageXOffset,scrollY:(N=e.scrollY)!==null&&N!==void 0?N:n.pageYOffset},a=new EA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),o=new Tv(r,a),c=(V=e.foreignObjectRendering)!==null&&V!==void 0?V:!1,l={allowTaint:(Fe=e.allowTaint)!==null&&Fe!==void 0?Fe:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},o.logger.debug("Starting document clone with size ".concat(a.width,"x").concat(a.height," scrolled to ").concat(-a.left,",").concat(-a.top)),u=new dl(o,t,l),d=u.clonedReferenceElement,d?[4,u.toIFrame(A,a)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return h=Ie.sent(),p=Cs(d)||IB(d)?hf(d.ownerDocument):Hn(o,d),f=p.width,m=p.height,B=p.left,b=p.top,U=xv(o,d,e.backgroundColor),w={canvas:e.canvas,backgroundColor:U,scale:(Ce=(ve=e.scale)!==null&&ve!==void 0?ve:n.devicePixelRatio)!==null&&Ce!==void 0?Ce:1,x:((tA=e.x)!==null&&tA!==void 0?tA:0)+B,y:((Le=e.y)!==null&&Le!==void 0?Le:0)+b,width:(we=e.width)!==null&&we!==void 0?we:Math.ceil(f),height:(nA=e.height)!==null&&nA!==void 0?nA:Math.ceil(m)},c?(o.logger.debug("Document cloned, using foreign object rendering"),E=new Ev(o,w),[4,E.render(d)]):[3,3];case 2:return v=Ie.sent(),[3,5];case 3:return o.logger.debug("Document cloned, element located at ".concat(B,",").concat(b," with size ").concat(f,"x").concat(m," using computed rendering")),o.logger.debug("Starting DOM parsing"),y=Yc(o,d),U===y.styles.backgroundColor&&(y.styles.backgroundColor=vA.TRANSPARENT),o.logger.debug("Starting renderer for element at ".concat(w.x,",").concat(w.y," with size ").concat(w.width,"x").concat(w.height)),E=new Cv(o,w),[4,E.render(y)];case 4:v=Ie.sent(),Ie.label=5;case 5:return(!((Ye=e.removeContainer)!==null&&Ye!==void 0)||Ye)&&(dl.destroy(h)||o.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),o.logger.debug("Finished rendering"),[2,v]}})})},xv=function(t,e,A){var n=e.ownerDocument,i=n.documentElement?Et(t,getComputedStyle(n.documentElement).backgroundColor):vA.TRANSPARENT,r=n.body?Et(t,getComputedStyle(n.body).backgroundColor):vA.TRANSPARENT,s=typeof A=="string"?Et(t,A):A===null?vA.TRANSPARENT:4294967295;return e===n.documentElement?NA(i)?NA(r)?s:r:i:s};function _v(t,e){return e.forEach(function(A){A&&typeof A!="string"&&!Array.isArray(A)&&Object.keys(A).forEach(function(n){if(n!=="default"&&!(n in t)){var i=Object.getOwnPropertyDescriptor(A,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return A[n]}})}})}),Object.freeze(t)}var Pv=Object.defineProperty,Rv=(t,e,A)=>e in t?Pv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:A}):t[e]=A,yl=(t,e,A)=>Rv(t,typeof e!="symbol"?e+"":e,A);let Oe=class{constructor(){yl(this,"_locking"),yl(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const A=new Promise(i=>e=()=>{this._locks-=1,i()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>A),n}};function le(t,e){if(!t)throw new Error(e)}const Lv=34028234663852886e22,Dv=-34028234663852886e22,Hv=4294967295,Ov=2147483647,Mv=-2147483648;function Li(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>Ov||t<Mv)throw new Error("invalid int 32: "+t)}function Is(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>Hv||t<0)throw new Error("invalid uint 32: "+t)}function Ul(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>Lv||t<Dv))throw new Error("invalid float 32: "+t)}const Ql=Symbol("@bufbuild/protobuf/enum-type");function Nv(t){const e=t[Ql];return le(e,"missing enum type on enum object"),e}function El(t,e,A,n){t[Ql]=Sl(e,A.map(i=>({no:i.no,name:i.name,localName:t[i.no]})))}function Sl(t,e,A){const n=Object.create(null),i=Object.create(null),r=[];for(const s of e){const a=kl(s);r.push(a),n[s.name]=a,i[s.no]=a}return{typeName:t,values:r,findName(s){return n[s]},findNumber(s){return i[s]}}}function Kv(t,e,A){const n={};for(const i of e){const r=kl(i);n[r.localName]=r.no,n[r.no]=r.localName}return El(n,t,e),n}function kl(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class xs{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,A){const n=this.getType(),i=n.runtime.bin,r=i.makeReadOptions(A);return i.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,A){const n=this.getType(),i=n.runtime.json,r=i.makeReadOptions(A);return i.readMessage(n,e,r,this),this}fromJsonString(e,A){let n;try{n=JSON.parse(e)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(n,A)}toBinary(e){const A=this.getType(),n=A.runtime.bin,i=n.makeWriteOptions(e),r=i.writerFactory();return n.writeMessage(this,r,i),r.finish()}toJson(e){const A=this.getType(),n=A.runtime.json,i=n.makeWriteOptions(e);return n.writeMessage(this,i)}toJsonString(e){var A;const n=this.toJson(e);return JSON.stringify(n,null,(A=e==null?void 0:e.prettySpaces)!==null&&A!==void 0?A:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function Vv(t,e,A,n){var i;const r=(i=n==null?void 0:n.localName)!==null&&i!==void 0?i:e.substring(e.lastIndexOf(".")+1),s={[r]:function(a){t.util.initFields(this),t.util.initPartial(a,this)}}[r];return Object.setPrototypeOf(s.prototype,new xs),Object.assign(s,{runtime:t,typeName:e,fields:t.util.newFieldList(A),fromBinary(a,o){return new s().fromBinary(a,o)},fromJson(a,o){return new s().fromJson(a,o)},fromJsonString(a,o){return new s().fromJsonString(a,o)},equals(a,o){return t.util.equals(s,a,o)}}),s}function Gv(){let t=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<n,!(i&128))return this.assertBounds(),[t,e]}let A=this.buf[this.pos++];if(t|=(A&15)<<28,e=(A&112)>>4,!(A&128))return this.assertBounds(),[t,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,!(i&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function _s(t,e,A){for(let r=0;r<28;r=r+7){const s=t>>>r,a=!(!(s>>>7)&&e==0),o=(a?s|128:s)&255;if(A.push(o),!a)return}const n=t>>>28&15|(e&7)<<4,i=!!(e>>3);if(A.push((i?n|128:n)&255),!!i){for(let r=3;r<31;r=r+7){const s=e>>>r,a=!!(s>>>7),o=(a?s|128:s)&255;if(A.push(o),!a)return}A.push(e>>>31&1)}}const Di=4294967296;function Tl(t){const e=t[0]==="-";e&&(t=t.slice(1));const A=1e6;let n=0,i=0;function r(s,a){const o=Number(t.slice(s,a));i*=A,n=n*A+o,n>=Di&&(i=i+(n/Di|0),n=n%Di)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),e?Il(n,i):Ps(n,i)}function jv(t,e){let A=Ps(t,e);const n=A.hi&2147483648;n&&(A=Il(A.lo,A.hi));const i=Fl(A.lo,A.hi);return n?"-"+i:i}function Fl(t,e){if({lo:t,hi:e}=Wv(t,e),e<=2097151)return String(Di*e+t);const A=t&16777215,n=(t>>>24|e<<8)&16777215,i=e>>16&65535;let r=A+n*6777216+i*6710656,s=n+i*8147497,a=i*2;const o=1e7;return r>=o&&(s+=Math.floor(r/o),r%=o),s>=o&&(a+=Math.floor(s/o),s%=o),a.toString()+xl(s)+xl(r)}function Wv(t,e){return{lo:t>>>0,hi:e>>>0}}function Ps(t,e){return{lo:t|0,hi:e|0}}function Il(t,e){return e=~e,t?t=~t+1:e+=1,Ps(t,e)}const xl=t=>{const e=String(t);return"0000000".slice(e.length)+e};function _l(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let A=0;A<9;A++)e.push(t&127|128),t=t>>7;e.push(1)}}function Jv(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let A=5;t&128&&A<10;A++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function Xv(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){const i=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(o){const c=typeof o=="bigint"?o:BigInt(o);if(c>r||c<i)throw new Error("int64 invalid: ".concat(o));return c},uParse(o){const c=typeof o=="bigint"?o:BigInt(o);if(c>a||c<s)throw new Error("uint64 invalid: ".concat(o));return c},enc(o){return t.setBigInt64(0,this.parse(o),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(o){return t.setBigInt64(0,this.uParse(o),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(o,c){return t.setInt32(0,o,!0),t.setInt32(4,c,!0),t.getBigInt64(0,!0)},uDec(o,c){return t.setInt32(0,o,!0),t.setInt32(4,c,!0),t.getBigUint64(0,!0)}}}const A=i=>le(/^-?[0-9]+$/.test(i),"int64 invalid: ".concat(i)),n=i=>le(/^[0-9]+$/.test(i),"uint64 invalid: ".concat(i));return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),A(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),A(i),Tl(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),n(i),Tl(i)},dec(i,r){return jv(i,r)},uDec(i,r){return Fl(i,r)}}}const re=Xv();var S;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(S||(S={}));var WA;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(WA||(WA={}));function JA(t,e,A){if(e===A)return!0;if(t==S.BYTES){if(!(e instanceof Uint8Array)||!(A instanceof Uint8Array)||e.length!==A.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==A[n])return!1;return!0}switch(t){case S.UINT64:case S.FIXED64:case S.INT64:case S.SFIXED64:case S.SINT64:return e==A}return!1}function Pt(t,e){switch(t){case S.BOOL:return!1;case S.UINT64:case S.FIXED64:case S.INT64:case S.SFIXED64:case S.SINT64:return e==0?re.zero:"0";case S.DOUBLE:case S.FLOAT:return 0;case S.BYTES:return new Uint8Array(0);case S.STRING:return"";default:return 0}}function Pl(t,e){switch(t){case S.BOOL:return e===!1;case S.STRING:return e==="";case S.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var ge;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(ge||(ge={}));class qv{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let A=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)A.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],A}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),A=this.stack.pop();if(!A)throw new Error("invalid state, fork stack empty");return this.chunks=A.chunks,this.buf=A.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,A){return this.uint32((e<<3|A)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Is(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Li(e),_l(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let A=this.textEncoder.encode(e);return this.uint32(A.byteLength),this.raw(A)}float(e){Ul(e);let A=new Uint8Array(4);return new DataView(A.buffer).setFloat32(0,e,!0),this.raw(A)}double(e){let A=new Uint8Array(8);return new DataView(A.buffer).setFloat64(0,e,!0),this.raw(A)}fixed32(e){Is(e);let A=new Uint8Array(4);return new DataView(A.buffer).setUint32(0,e,!0),this.raw(A)}sfixed32(e){Li(e);let A=new Uint8Array(4);return new DataView(A.buffer).setInt32(0,e,!0),this.raw(A)}sint32(e){return Li(e),e=(e<<1^e>>31)>>>0,_l(e,this.buf),this}sfixed64(e){let A=new Uint8Array(8),n=new DataView(A.buffer),i=re.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(A)}fixed64(e){let A=new Uint8Array(8),n=new DataView(A.buffer),i=re.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(A)}int64(e){let A=re.enc(e);return _s(A.lo,A.hi,this.buf),this}sint64(e){let A=re.enc(e),n=A.hi>>31,i=A.lo<<1^n,r=(A.hi<<1|A.lo>>>31)^n;return _s(i,r,this.buf),this}uint64(e){let A=re.uEnc(e);return _s(A.lo,A.hi,this.buf),this}}class Yv{constructor(e,A){this.varint64=Gv,this.uint32=Jv,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=A??new TextDecoder}tag(){let e=this.uint32(),A=e>>>3,n=e&7;if(A<=0||n<0||n>5)throw new Error("illegal tag: field no "+A+" wire type "+n);return[A,n]}skip(e,A){let n=this.pos;switch(e){case ge.Varint:for(;this.buf[this.pos++]&128;);break;case ge.Bit64:this.pos+=4;case ge.Bit32:this.pos+=4;break;case ge.LengthDelimited:let i=this.uint32();this.pos+=i;break;case ge.StartGroup:for(;;){const[r,s]=this.tag();if(s===ge.EndGroup){if(A!==void 0&&r!==A)throw new Error("invalid end group tag");break}this.skip(s,r)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return re.dec(...this.varint64())}uint64(){return re.uDec(...this.varint64())}sint64(){let[e,A]=this.varint64(),n=-(e&1);return e=(e>>>1|(A&1)<<31)^n,A=A>>>1^n,re.dec(e,A)}bool(){let[e,A]=this.varint64();return e!==0||A!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return re.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return re.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),A=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(A,A+e)}string(){return this.textDecoder.decode(this.bytes())}}function zv(t,e,A,n){let i;return{typeName:e,extendee:A,get field(){if(!i){const r=typeof n=="function"?n():n;r.name=e.split(".").pop(),r.jsonName="[".concat(e,"]"),i=t.util.newFieldList([r]).list()[0]}return i},runtime:t}}function Rl(t){const e=t.field.localName,A=Object.create(null);return A[e]=Zv(t),[A,()=>A[e]]}function Zv(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return Pt(e.T,e.L);case"message":const A=e.T,n=new A;return A.fieldWrapper?A.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}function $v(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let A=t.length-1;A>=0;--A)if(t[A].no==e.no)return[t[A]];return[]}return t.filter(A=>A.no===e.no)}let TA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Hi=[];for(let t=0;t<TA.length;t++)Hi[TA[t].charCodeAt(0)]=t;Hi["-".charCodeAt(0)]=TA.indexOf("+"),Hi["_".charCodeAt(0)]=TA.indexOf("/");const Ll={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let A=new Uint8Array(e),n=0,i=0,r,s=0;for(let a=0;a<t.length;a++){if(r=Hi[t.charCodeAt(a)],r===void 0)switch(t[a]){case"=":i=0;case`
10
- `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:s=r,i=1;break;case 1:A[n++]=s<<2|(r&48)>>4,s=r,i=2;break;case 2:A[n++]=(s&15)<<4|(r&60)>>2,s=r,i=3;break;case 3:A[n++]=(s&3)<<6|r,i=0;break}}if(i==1)throw Error("invalid base64 string.");return A.subarray(0,n)},enc(t){let e="",A=0,n,i=0;for(let r=0;r<t.length;r++)switch(n=t[r],A){case 0:e+=TA[n>>2],i=(n&3)<<4,A=1;break;case 1:e+=TA[i|n>>4],i=(n&15)<<2,A=2;break;case 2:e+=TA[i|n>>6],e+=TA[n&63],A=0;break}return A&&(e+=TA[i],e+="=",A==1&&(e+="=")),e}};function eC(t,e,A){Hl(e,t);const n=e.runtime.bin.makeReadOptions(A),i=$v(t.getType().runtime.bin.listUnknownFields(t),e.field),[r,s]=Rl(e);for(const a of i)e.runtime.bin.readField(r,n.readerFactory(a.data),e.field,a.wireType,n);return s()}function AC(t,e,A,n){Hl(e,t);const i=e.runtime.bin.makeReadOptions(n),r=e.runtime.bin.makeWriteOptions(n);if(Dl(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(l=>l.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const l of c)t.getType().runtime.bin.onUnknownField(t,l.no,l.wireType,l.data)}const s=r.writerFactory();let a=e.field;!a.opt&&!a.repeated&&(a.kind=="enum"||a.kind=="scalar")&&(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,A,s,r);const o=i.readerFactory(s.finish());for(;o.pos<o.len;){const[c,l]=o.tag(),u=o.skip(l,c);t.getType().runtime.bin.onUnknownField(t,c,l,u)}}function Dl(t,e){const A=t.getType();return e.extendee.typeName===A.typeName&&!!A.runtime.bin.listUnknownFields(t).find(n=>n.no==e.field.no)}function Hl(t,e){le(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function Ol(t,e){const A=t.localName;if(t.repeated)return e[A].length>0;if(t.oneof)return e[t.oneof.localName].case===A;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[A]!==void 0:t.kind=="enum"?e[A]!==t.T.values[0].no:!Pl(t.T,e[A]);case"message":return e[A]!==void 0;case"map":return Object.keys(e[A]).length>0}}function Ml(t,e){const A=t.localName,n=!t.opt&&!t.req;if(t.repeated)e[A]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[A]={};break;case"enum":e[A]=n?t.T.values[0].no:void 0;break;case"scalar":e[A]=n?Pt(t.T,t.L):void 0;break;case"message":e[A]=void 0;break}}function dt(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(xs.prototype).every(n=>n in t&&typeof t[n]=="function"))return!1;const A=t.getType();return A===null||typeof A!="function"||!("typeName"in A)||typeof A.typeName!="string"?!1:e===void 0?!0:A.typeName==e.typeName}function Nl(t,e){return dt(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}S.DOUBLE,S.FLOAT,S.INT64,S.UINT64,S.INT32,S.UINT32,S.BOOL,S.STRING,S.BYTES;const Kl={ignoreUnknownFields:!1},Vl={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function tC(t){return t?Object.assign(Object.assign({},Kl),t):Kl}function nC(t){return t?Object.assign(Object.assign({},Vl),t):Vl}const Oi=Symbol(),Mi=Symbol();function iC(){return{makeReadOptions:tC,makeWriteOptions:nC,readMessage(t,e,A,n){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(wA(e)));n=n??new t;const i=new Map,r=A.typeRegistry;for(const[s,a]of Object.entries(e)){const o=t.fields.findJsonName(s);if(o){if(o.oneof){if(a===null&&o.kind=="scalar")continue;const c=i.get(o.oneof);if(c!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(o.oneof.name,'" present: "').concat(c,'", "').concat(s,'"'));i.set(o.oneof,s)}Gl(n,a,o,A,t)}else{let c=!1;if(r!=null&&r.findExtension&&s.startsWith("[")&&s.endsWith("]")){const l=r.findExtension(s.substring(1,s.length-1));if(l&&l.extendee.typeName==t.typeName){c=!0;const[u,d]=Rl(l);Gl(u,a,l.field,A,l),AC(n,l,d(),A)}}if(!c&&!A.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(s,'" is unknown'))}}return n},writeMessage(t,e){const A=t.getType(),n={};let i;try{for(i of A.fields.byNumber()){if(!Ol(i,t)){if(i.req)throw"required field not set";if(!e.emitDefaultValues||!sC(i))continue}const s=i.oneof?t[i.oneof.localName].value:t[i.localName],a=jl(i,s,e);a!==void 0&&(n[e.useProtoFieldName?i.name:i.jsonName]=a)}const r=e.typeRegistry;if(r!=null&&r.findExtensionFor)for(const s of A.runtime.bin.listUnknownFields(t)){const a=r.findExtensionFor(A.typeName,s.no);if(a&&Dl(t,a)){const o=eC(t,a,e),c=jl(a.field,o,e);c!==void 0&&(n[a.field.jsonName]=c)}}}catch(r){const s=i?"cannot encode field ".concat(A.typeName,".").concat(i.name," to JSON"):"cannot encode message ".concat(A.typeName," to JSON"),a=r instanceof Error?r.message:String(r);throw new Error(s+(a.length>0?": ".concat(a):""))}return n},readScalar(t,e,A){return Cn(t,e,A??WA.BIGINT,!0)},writeScalar(t,e,A){if(e!==void 0&&(A||Pl(t,e)))return Ni(t,e)},debug:wA}}function wA(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function Gl(t,e,A,n,i){let r=A.localName;if(A.repeated){if(le(A.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e)));const s=t[r];for(const a of e){if(a===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(a)));switch(A.kind){case"message":s.push(A.T.fromJson(a,n));break;case"enum":const o=Rs(A.T,a,n.ignoreUnknownFields,!0);o!==Mi&&s.push(o);break;case"scalar":try{s.push(Cn(A.T,a,A.L,!0))}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(a));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}}else if(A.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e)));const s=t[r];for(const[a,o]of Object.entries(e)){if(o===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: map value null"));let c;try{c=rC(A.K,a)}catch(l){let u="cannot decode map key for field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e));throw l instanceof Error&&l.message.length>0&&(u+=": ".concat(l.message)),new Error(u)}switch(A.V.kind){case"message":s[c]=A.V.T.fromJson(o,n);break;case"enum":const l=Rs(A.V.T,o,n.ignoreUnknownFields,!0);l!==Mi&&(s[c]=l);break;case"scalar":try{s[c]=Cn(A.V.T,o,WA.BIGINT,!0)}catch(u){let d="cannot decode map value for field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e));throw u instanceof Error&&u.message.length>0&&(d+=": ".concat(u.message)),new Error(d)}break}}}else switch(A.oneof&&(t=t[A.oneof.localName]={case:r},r="value"),A.kind){case"message":const s=A.T;if(e===null&&s.typeName!="google.protobuf.Value")return;let a=t[r];dt(a)?a.fromJson(e,n):(t[r]=a=s.fromJson(e,n),s.fieldWrapper&&!A.oneof&&(t[r]=s.fieldWrapper.unwrapField(a)));break;case"enum":const o=Rs(A.T,e,n.ignoreUnknownFields,!1);switch(o){case Oi:Ml(A,t);break;case Mi:break;default:t[r]=o;break}break;case"scalar":try{const c=Cn(A.T,e,A.L,!1);switch(c){case Oi:Ml(A,t);break;default:t[r]=c;break}}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}function rC(t,e){if(t===S.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return Cn(t,e,WA.BIGINT,!0).toString()}function Cn(t,e,A,n){if(e===null)return n?Pt(t,A):Oi;switch(t){case S.DOUBLE:case S.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const i=Number(e);if(Number.isNaN(i)||!Number.isFinite(i))break;return t==S.FLOAT&&Ul(i),i;case S.INT32:case S.FIXED32:case S.SFIXED32:case S.SINT32:case S.UINT32:let r;if(typeof e=="number"?r=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(r=Number(e)),r===void 0)break;return t==S.UINT32||t==S.FIXED32?Is(r):Li(r),r;case S.INT64:case S.SFIXED64:case S.SINT64:if(typeof e!="number"&&typeof e!="string")break;const s=re.parse(e);return A?s.toString():s;case S.FIXED64:case S.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=re.uParse(e);return A?a.toString():a;case S.BOOL:if(typeof e!="boolean")break;return e;case S.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case S.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Ll.dec(e)}throw new Error}function Rs(t,e,A,n){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:n?t.values[0].no:Oi;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const i=t.findName(e);if(i!==void 0)return i.no;if(A)return Mi;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(wA(e)))}function sC(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function jl(t,e,A){if(t.kind=="map"){le(typeof e=="object"&&e!=null);const n={},i=Object.entries(e);switch(t.V.kind){case"scalar":for(const[s,a]of i)n[s.toString()]=Ni(t.V.T,a);break;case"message":for(const[s,a]of i)n[s.toString()]=a.toJson(A);break;case"enum":const r=t.V.T;for(const[s,a]of i)n[s.toString()]=Ls(r,a,A.enumAsInteger);break}return A.emitDefaultValues||i.length>0?n:void 0}if(t.repeated){le(Array.isArray(e));const n=[];switch(t.kind){case"scalar":for(let i=0;i<e.length;i++)n.push(Ni(t.T,e[i]));break;case"enum":for(let i=0;i<e.length;i++)n.push(Ls(t.T,e[i],A.enumAsInteger));break;case"message":for(let i=0;i<e.length;i++)n.push(e[i].toJson(A));break}return A.emitDefaultValues||n.length>0?n:void 0}switch(t.kind){case"scalar":return Ni(t.T,e);case"enum":return Ls(t.T,e,A.enumAsInteger);case"message":return Nl(t.T,e).toJson(A)}}function Ls(t,e,A){var n;if(le(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(A)return e;const i=t.findNumber(e);return(n=i==null?void 0:i.name)!==null&&n!==void 0?n:e}function Ni(t,e){switch(t){case S.INT32:case S.SFIXED32:case S.SINT32:case S.FIXED32:case S.UINT32:return le(typeof e=="number"),e;case S.FLOAT:case S.DOUBLE:return le(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case S.STRING:return le(typeof e=="string"),e;case S.BOOL:return le(typeof e=="boolean"),e;case S.UINT64:case S.FIXED64:case S.INT64:case S.SFIXED64:case S.SINT64:return le(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case S.BYTES:return le(e instanceof Uint8Array),Ll.enc(e)}}const Rt=Symbol("@bufbuild/protobuf/unknown-fields"),Wl={readUnknownFields:!0,readerFactory:t=>new Yv(t)},Jl={writeUnknownFields:!0,writerFactory:()=>new qv};function aC(t){return t?Object.assign(Object.assign({},Wl),t):Wl}function oC(t){return t?Object.assign(Object.assign({},Jl),t):Jl}function cC(){return{makeReadOptions:aC,makeWriteOptions:oC,listUnknownFields(t){var e;return(e=t[Rt])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Rt]},writeUnknownFields(t,e){const n=t[Rt];if(n)for(const i of n)e.tag(i.no,i.wireType).raw(i.data)},onUnknownField(t,e,A,n){const i=t;Array.isArray(i[Rt])||(i[Rt]=[]),i[Rt].push({no:e,wireType:A,data:n})},readMessage(t,e,A,n,i){const r=t.getType(),s=i?e.len:e.pos+A;let a,o;for(;e.pos<s&&([a,o]=e.tag(),!(i===!0&&o==ge.EndGroup));){const c=r.fields.find(a);if(!c){const l=e.skip(o,a);n.readUnknownFields&&this.onUnknownField(t,a,o,l);continue}Xl(t,e,c,o,n)}if(i&&(o!=ge.EndGroup||a!==A))throw new Error("invalid end group tag")},readField:Xl,writeMessage(t,e,A){const n=t.getType();for(const i of n.fields.byNumber()){if(!Ol(i,t)){if(i.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(i.name," to binary: required field not set"));continue}const r=i.oneof?t[i.oneof.localName].value:t[i.localName];ql(i,r,e,A)}return A.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,A,n){e!==void 0&&ql(t,e,A,n)}}}function Xl(t,e,A,n,i){let{repeated:r,localName:s}=A;switch(A.oneof&&(t=t[A.oneof.localName],t.case!=s&&delete t.value,t.case=s,s="value"),A.kind){case"scalar":case"enum":const a=A.kind=="enum"?S.INT32:A.T;let o=Vi;if(A.kind=="scalar"&&A.L>0&&(o=uC),r){let d=t[s];if(n==ge.LengthDelimited&&a!=S.STRING&&a!=S.BYTES){let p=e.uint32()+e.pos;for(;e.pos<p;)d.push(o(e,a))}else d.push(o(e,a))}else t[s]=o(e,a);break;case"message":const c=A.T;r?t[s].push(Ki(e,new c,i,A)):dt(t[s])?Ki(e,t[s],i,A):(t[s]=Ki(e,new c,i,A),c.fieldWrapper&&!A.oneof&&!A.repeated&&(t[s]=c.fieldWrapper.unwrapField(t[s])));break;case"map":let[l,u]=lC(A,e,i);t[s][l]=u;break}}function Ki(t,e,A,n){const i=e.getType().runtime.bin,r=n==null?void 0:n.delimited;return i.readMessage(e,t,r?n.no:t.uint32(),A,r),e}function lC(t,e,A){const n=e.uint32(),i=e.pos+n;let r,s;for(;e.pos<i;){const[a]=e.tag();switch(a){case 1:r=Vi(e,t.K);break;case 2:switch(t.V.kind){case"scalar":s=Vi(e,t.V.T);break;case"enum":s=e.int32();break;case"message":s=Ki(e,new t.V.T,A,void 0);break}break}}if(r===void 0&&(r=Pt(t.K,WA.BIGINT)),typeof r!="string"&&typeof r!="number"&&(r=r.toString()),s===void 0)switch(t.V.kind){case"scalar":s=Pt(t.V.T,WA.BIGINT);break;case"enum":s=t.V.T.values[0].no;break;case"message":s=new t.V.T;break}return[r,s]}function uC(t,e){const A=Vi(t,e);return typeof A=="bigint"?A.toString():A}function Vi(t,e){switch(e){case S.STRING:return t.string();case S.BOOL:return t.bool();case S.DOUBLE:return t.double();case S.FLOAT:return t.float();case S.INT32:return t.int32();case S.INT64:return t.int64();case S.UINT64:return t.uint64();case S.FIXED64:return t.fixed64();case S.BYTES:return t.bytes();case S.FIXED32:return t.fixed32();case S.SFIXED32:return t.sfixed32();case S.SFIXED64:return t.sfixed64();case S.SINT64:return t.sint64();case S.UINT32:return t.uint32();case S.SINT32:return t.sint32()}}function ql(t,e,A,n){le(e!==void 0);const i=t.repeated;switch(t.kind){case"scalar":case"enum":let r=t.kind=="enum"?S.INT32:t.T;if(i)if(le(Array.isArray(e)),t.packed)hC(A,r,t.no,e);else for(const s of e)wn(A,r,t.no,s);else wn(A,r,t.no,e);break;case"message":if(i){le(Array.isArray(e));for(const s of e)Yl(A,n,t,s)}else Yl(A,n,t,e);break;case"map":le(typeof e=="object"&&e!=null);for(const[s,a]of Object.entries(e))dC(A,n,t,s,a);break}}function dC(t,e,A,n,i){t.tag(A.no,ge.LengthDelimited),t.fork();let r=n;switch(A.K){case S.INT32:case S.FIXED32:case S.UINT32:case S.SFIXED32:case S.SINT32:r=Number.parseInt(n);break;case S.BOOL:le(n=="true"||n=="false"),r=n=="true";break}switch(wn(t,A.K,1,r),A.V.kind){case"scalar":wn(t,A.V.T,2,i);break;case"enum":wn(t,S.INT32,2,i);break;case"message":le(i!==void 0),t.tag(2,ge.LengthDelimited).bytes(i.toBinary(e));break}t.join()}function Yl(t,e,A,n){const i=Nl(A.T,n);A.delimited?t.tag(A.no,ge.StartGroup).raw(i.toBinary(e)).tag(A.no,ge.EndGroup):t.tag(A.no,ge.LengthDelimited).bytes(i.toBinary(e))}function wn(t,e,A,n){le(n!==void 0);let[i,r]=zl(e);t.tag(A,i)[r](n)}function hC(t,e,A,n){if(!n.length)return;t.tag(A,ge.LengthDelimited).fork();let[,i]=zl(e);for(let r=0;r<n.length;r++)t[i](n[r]);t.join()}function zl(t){let e=ge.Varint;switch(t){case S.BYTES:case S.STRING:e=ge.LengthDelimited;break;case S.DOUBLE:case S.FIXED64:case S.SFIXED64:e=ge.Bit64;break;case S.FIXED32:case S.SFIXED32:case S.FLOAT:e=ge.Bit32;break}const A=S[t].toLowerCase();return[e,A]}function fC(){return{setEnumType:El,initPartial(t,e){if(t===void 0)return;const A=e.getType();for(const n of A.fields.byMember()){const i=n.localName,r=e,s=t;if(s[i]!=null)switch(n.kind){case"oneof":const a=s[i].case;if(a===void 0)continue;const o=n.findField(a);let c=s[i].value;o&&o.kind=="message"&&!dt(c,o.T)?c=new o.T(c):o&&o.kind==="scalar"&&o.T===S.BYTES&&(c=bn(c)),r[i]={case:a,value:c};break;case"scalar":case"enum":let l=s[i];n.T===S.BYTES&&(l=n.repeated?l.map(bn):bn(l)),r[i]=l;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===S.BYTES)for(const[h,p]of Object.entries(s[i]))r[i][h]=bn(p);else Object.assign(r[i],s[i]);break;case"message":const d=n.V.T;for(const h of Object.keys(s[i])){let p=s[i][h];d.fieldWrapper||(p=new d(p)),r[i][h]=p}break}break;case"message":const u=n.T;if(n.repeated)r[i]=s[i].map(d=>dt(d,u)?d:new u(d));else{const d=s[i];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?r[i]=bn(d):r[i]=d:r[i]=dt(d,u)?d:new u(d)}break}}},equals(t,e,A){return e===A?!0:!e||!A?!1:t.fields.byMember().every(n=>{const i=e[n.localName],r=A[n.localName];if(n.repeated){if(i.length!==r.length)return!1;switch(n.kind){case"message":return i.every((s,a)=>n.T.equals(s,r[a]));case"scalar":return i.every((s,a)=>JA(n.T,s,r[a]));case"enum":return i.every((s,a)=>JA(S.INT32,s,r[a]))}throw new Error("repeated cannot contain ".concat(n.kind))}switch(n.kind){case"message":return n.T.equals(i,r);case"enum":return JA(S.INT32,i,r);case"scalar":return JA(n.T,i,r);case"oneof":if(i.case!==r.case)return!1;const s=n.findField(i.case);if(s===void 0)return!0;switch(s.kind){case"message":return s.T.equals(i.value,r.value);case"enum":return JA(S.INT32,i.value,r.value);case"scalar":return JA(s.T,i.value,r.value)}throw new Error("oneof cannot contain ".concat(s.kind));case"map":const a=Object.keys(i).concat(Object.keys(r));switch(n.V.kind){case"message":const o=n.V.T;return a.every(l=>o.equals(i[l],r[l]));case"enum":return a.every(l=>JA(S.INT32,i[l],r[l]));case"scalar":const c=n.V.T;return a.every(l=>JA(c,i[l],r[l]))}break}})},clone(t){const e=t.getType(),A=new e,n=A;for(const i of e.fields.byMember()){const r=t[i.localName];let s;if(i.repeated)s=r.map(Gi);else if(i.kind=="map"){s=n[i.localName];for(const[a,o]of Object.entries(r))s[a]=Gi(o)}else i.kind=="oneof"?s=i.findField(r.case)?{case:r.case,value:Gi(r.value)}:{case:void 0}:s=Gi(r);n[i.localName]=s}for(const i of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(n,i.no,i.wireType,i.data);return A}}}function Gi(t){if(t===void 0)return t;if(dt(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function bn(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function gC(t,e,A){return{syntax:t,json:iC(),bin:cC(),util:Object.assign(Object.assign({},fC()),{newFieldList:e,initFields:A}),makeMessageType(n,i,r){return Vv(this,n,i,r)},makeEnum:Kv,makeEnumType:Sl,getEnumType:Nv,makeExtension(n,i,r){return zv(this,n,i,r)}}}class pC{constructor(e,A){this._fields=e,this._normalizer=A}findJsonName(e){if(!this.jsonNames){const A={};for(const n of this.list())A[n.jsonName]=A[n.name]=n;this.jsonNames=A}return this.jsonNames[e]}find(e){if(!this.numbers){const A={};for(const n of this.list())A[n.no]=n;this.numbers=A}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,A)=>e.no-A.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let A;for(const n of this.list())n.oneof?n.oneof!==A&&(A=n.oneof,e.push(A)):e.push(n)}return this.members}}function Zl(t,e){const A=$l(t);return e?A:bC(wC(A))}function mC(t){return Zl(t,!1)}const BC=$l;function $l(t){let e=!1;const A=[];for(let n=0;n<t.length;n++){let i=t.charAt(n);switch(i){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":A.push(i),e=!1;break;default:e&&(e=!1,i=i.toUpperCase()),A.push(i);break}}return A.join("")}const vC=new Set(["constructor","toString","toJSON","valueOf"]),CC=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),eu=t=>"".concat(t,"$"),wC=t=>CC.has(t)?eu(t):t,bC=t=>vC.has(t)?eu(t):t;class yC{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=mC(e)}addField(e){le(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let A=0;A<this.fields.length;A++)this._lookup[this.fields[A].localName]=this.fields[A]}return this._lookup[e]}}function UC(t,e){var A,n,i,r,s,a;const o=[];let c;for(const l of typeof t=="function"?t():t){const u=l;if(u.localName=Zl(l.name,l.oneof!==void 0),u.jsonName=(A=l.jsonName)!==null&&A!==void 0?A:BC(l.name),u.repeated=(n=l.repeated)!==null&&n!==void 0?n:!1,l.kind=="scalar"&&(u.L=(i=l.L)!==null&&i!==void 0?i:WA.BIGINT),u.delimited=(r=l.delimited)!==null&&r!==void 0?r:!1,u.req=(s=l.req)!==null&&s!==void 0?s:!1,u.opt=(a=l.opt)!==null&&a!==void 0?a:!1,l.packed===void 0&&(u.packed=l.kind=="enum"||l.kind=="scalar"&&l.T!=S.BYTES&&l.T!=S.STRING),l.oneof!==void 0){const d=typeof l.oneof=="string"?l.oneof:l.oneof.name;(!c||c.name!=d)&&(c=new yC(d)),u.oneof=c,c.addField(u)}o.push(u)}return o}const Q=gC("proto3",t=>new pC(t,e=>UC(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const A=e.localName,n=t;if(e.repeated){n[A]=[];continue}switch(e.kind){case"oneof":n[A]={case:void 0};break;case"enum":n[A]=0;break;case"map":n[A]={};break;case"scalar":n[A]=Pt(e.T,e.L);break}}});class Me extends xs{constructor(e){super(),this.seconds=re.zero,this.nanos=0,Q.util.initPartial(e,this)}fromJson(e,A){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Q.json.debug(e)));const n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=re.parse(i/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),this}toJson(e){const A=Number(this.seconds)*1e3;if(A<Date.parse("0001-01-01T00:00:00Z")||A>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let n="Z";if(this.nanos>0){const i=(this.nanos+1e9).toString().substring(1);i.substring(3)==="000000"?n="."+i.substring(0,3)+"Z":i.substring(6)==="000"?n="."+i.substring(0,6)+"Z":n="."+i+"Z"}return new Date(A).toISOString().replace(".000Z",n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return Me.fromDate(new Date)}static fromDate(e){const A=e.getTime();return new Me({seconds:re.parse(Math.floor(A/1e3)),nanos:A%1e3*1e6})}static fromBinary(e,A){return new Me().fromBinary(e,A)}static fromJson(e,A){return new Me().fromJson(e,A)}static fromJsonString(e,A){return new Me().fromJsonString(e,A)}static equals(e,A){return Q.util.equals(Me,e,A)}}Me.runtime=Q,Me.typeName="google.protobuf.Timestamp",Me.fields=Q.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const QC=Q.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Me},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:EC,repeated:!0},{no:5,name:"events",kind:"message",T:kC,repeated:!0}]),EC=Q.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:SC,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),SC=Q.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Me},{no:3,name:"value",kind:"scalar",T:2}]),kC=Q.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:Me},{no:7,name:"normalized_end_timestamp",kind:"message",T:Me,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),Au=Q.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),sA=Q.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Be=Q.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),Lt=Q.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),yn=Q.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),Un=Q.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),aA=Q.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"}]),Dt=Q.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),TC=Q.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),oA=Q.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),ji=Q.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:Wi,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:fu}]),Wi=Q.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),FC=Q.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:Q.getEnumType(Be),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),ht=Q.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Q.getEnumType(Ht)},{no:4,name:"tracks",kind:"message",T:Ot,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:FC},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Q.getEnumType(Ji)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Q.getEnumType(aA)},{no:18,name:"kind_details",kind:"enum",T:Q.getEnumType(IC),repeated:!0}]),Ht=Q.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Ji=Q.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),IC=Q.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),qe=Q.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),xC=Q.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:ft,repeated:!0}]),Ot=Q.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Q.getEnumType(sA)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:Q.getEnumType(Be)},{no:10,name:"layers",kind:"message",T:ft,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:xC,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:Q.getEnumType(qe)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:fu},{no:19,name:"audio_features",kind:"enum",T:Q.getEnumType(oA),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Q.getEnumType(Au)}]),ft=Q.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Q.getEnumType(Lt)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}]),Ne=Q.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Q.getEnumType(X)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:nu,oneof:"value"},{no:3,name:"speaker",kind:"message",T:_C,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:iu,oneof:"value"},{no:7,name:"transcription",kind:"message",T:PC,oneof:"value"},{no:8,name:"metrics",kind:"message",T:QC,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:Ds,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:ru,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:su,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:au,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:Os,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Ms,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Ns,oneof:"value"}]),X=Q.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),_C=Q.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:tu,repeated:!0}]),tu=Q.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),nu=Q.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),iu=Q.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),PC=Q.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:RC,repeated:!0}]),RC=Q.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),Ds=Q.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),ru=Q.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),su=Q.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),au=Q.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:ou,oneof:"value"}]),ou=Q.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),cu=Q.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),LC=Q.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Q.getEnumType(lu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),lu=Q.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),DC=Q.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Q.getEnumType(uu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),uu=Q.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"}]),du=Q.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:hu},{no:2,name:"screen",kind:"message",T:hu},{no:3,name:"resume_connection",kind:"enum",T:Q.getEnumType(Un)},{no:4,name:"disabled_codecs",kind:"message",T:HC},{no:5,name:"force_relay",kind:"enum",T:Q.getEnumType(Un)}]),hu=Q.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Q.getEnumType(Un)}]),HC=Q.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:Wi,repeated:!0},{no:2,name:"publish",kind:"message",T:Wi,repeated:!0}]),fu=Q.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),Hs=Q.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),gu=Q.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Q.getEnumType(Hs)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),pu=Q.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),Os=Q.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:Q.getEnumType(qe)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:gu,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:pu,oneof:"content_header"}],{localName:"DataStream_Header"}),Ms=Q.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),Ns=Q.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),cA=Q.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Ks=Q.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),OC=Q.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),MC=Q.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:gt,oneof:"message"},{no:2,name:"answer",kind:"message",T:gt,oneof:"message"},{no:3,name:"trickle",kind:"message",T:js,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Gs,oneof:"message"},{no:5,name:"mute",kind:"message",T:Ws,oneof:"message"},{no:6,name:"subscription",kind:"message",T:Xi,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Bu,oneof:"message"},{no:8,name:"leave",kind:"message",T:qi,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:Cu,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:Uu,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:Qu,oneof:"message"},{no:13,name:"simulate",kind:"message",T:bA,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:wu,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:Su,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:vu,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:jC,oneof:"message"}]),mu=Q.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:NC,oneof:"message"},{no:2,name:"answer",kind:"message",T:gt,oneof:"message"},{no:3,name:"offer",kind:"message",T:gt,oneof:"message"},{no:4,name:"trickle",kind:"message",T:js,oneof:"message"},{no:5,name:"update",kind:"message",T:GC,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Js,oneof:"message"},{no:8,name:"leave",kind:"message",T:qi,oneof:"message"},{no:9,name:"mute",kind:"message",T:Ws,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:WC,oneof:"message"},{no:11,name:"room_update",kind:"message",T:JC,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:qC,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:zC,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:$C,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:ew,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:VC,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:KC,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:tw,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:rw,oneof:"message"},{no:22,name:"request_response",kind:"message",T:sw,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:aw,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:Aw,oneof:"message"}]),Vs=Q.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),Gs=Q.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:Q.getEnumType(sA)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:Q.getEnumType(Be)},{no:9,name:"layers",kind:"message",T:ft,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Vs,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:Q.getEnumType(qe)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Q.getEnumType(Au)},{no:17,name:"audio_features",kind:"enum",T:Q.getEnumType(oA),repeated:!0}]),js=Q.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Q.getEnumType(cA)},{no:3,name:"final",kind:"scalar",T:8}]),Ws=Q.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),NC=Q.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:ji},{no:2,name:"participant",kind:"message",T:ht},{no:3,name:"other_participants",kind:"message",T:ht,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:bu,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:du},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:LC},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:Wi,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),KC=Q.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:bu,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:du}]),Js=Q.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Ot}]),VC=Q.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),gt=Q.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9}]),GC=Q.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:ht,repeated:!0}]),Xi=Q.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:cu,repeated:!0}]),Bu=Q.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:Q.getEnumType(Lt)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),vu=Q.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Q.getEnumType(oA),repeated:!0}]),jC=Q.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),qi=Q.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Q.getEnumType(aA)},{no:3,name:"action",kind:"enum",T:Q.getEnumType(Mt)},{no:4,name:"regions",kind:"message",T:nw}]),Mt=Q.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),Cu=Q.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:ft,repeated:!0}]),wu=Q.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),bu=Q.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),WC=Q.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:tu,repeated:!0}]),JC=Q.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:ji}]),XC=Q.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Q.getEnumType(yn)},{no:3,name:"score",kind:"scalar",T:2}]),qC=Q.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:XC,repeated:!0}]),YC=Q.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Q.getEnumType(Ks)}]),zC=Q.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:YC,repeated:!0}]),Xs=Q.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Q.getEnumType(Lt)},{no:2,name:"enabled",kind:"scalar",T:8}]),ZC=Q.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Xs,repeated:!0}]),$C=Q.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Xs,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:ZC,repeated:!0}]),yu=Q.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),Uu=Q.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:yu,repeated:!0}]),ew=Q.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),Aw=Q.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:ji},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:ht},{no:4,name:"other_participants",kind:"message",T:ht,repeated:!0}]),Qu=Q.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:gt},{no:2,name:"subscription",kind:"message",T:Xi},{no:3,name:"publish_tracks",kind:"message",T:Js,repeated:!0},{no:4,name:"data_channels",kind:"message",T:Eu,repeated:!0},{no:5,name:"offer",kind:"message",T:gt},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0}]),Eu=Q.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:Q.getEnumType(cA)}]),bA=Q.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:Q.getEnumType(OC),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),Su=Q.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),tw=Q.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),nw=Q.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:iw,repeated:!0}]),iw=Q.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),rw=Q.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Q.getEnumType(TC)}]),sw=Q.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Q.getEnumType(qs)},{no:3,name:"message",kind:"scalar",T:9}]),qs=Q.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),aw=Q.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function ow(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yi={exports:{}},cw=Yi.exports,ku;function lw(){return ku||(ku=1,function(t){(function(e,A){t.exports?t.exports=A():e.log=A()})(cw,function(){var e=function(){},A="undefined",n=typeof window!==A&&typeof window.navigator!==A&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function a(f,m){var B=f[m];if(typeof B.bind=="function")return B.bind(f);try{return Function.prototype.bind.call(B,f)}catch{return function(){return Function.prototype.apply.apply(B,[f,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(f){return f==="debug"&&(f="log"),typeof console===A?!1:f==="trace"&&n?o:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):e}function l(){for(var f=this.getLevel(),m=0;m<i.length;m++){var B=i[m];this[B]=m<f?e:this.methodFactory(B,f,this.name)}if(this.log=this.debug,typeof console===A&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==A&&(l.call(this),this[f].apply(this,arguments))}}function d(f,m,B){return c(f)||u.apply(this,arguments)}function h(f,m){var B=this,b,U,w,v="loglevel";typeof f=="string"?v+=":"+f:typeof f=="symbol"&&(v=void 0);function y(D){var O=(i[D]||"silent").toUpperCase();if(!(typeof window===A||!v)){try{window.localStorage[v]=O;return}catch{}try{window.document.cookie=encodeURIComponent(v)+"="+O+";"}catch{}}}function E(){var D;if(!(typeof window===A||!v)){try{D=window.localStorage[v]}catch{}if(typeof D===A)try{var O=window.document.cookie,M=encodeURIComponent(v),ae=O.indexOf(M+"=");ae!==-1&&(D=/^([^;]+)/.exec(O.slice(ae+M.length+1))[1])}catch{}return B.levels[D]===void 0&&(D=void 0),D}}function T(){if(!(typeof window===A||!v)){try{window.localStorage.removeItem(v)}catch{}try{window.document.cookie=encodeURIComponent(v)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function F(D){var O=D;if(typeof O=="string"&&B.levels[O.toUpperCase()]!==void 0&&(O=B.levels[O.toUpperCase()]),typeof O=="number"&&O>=0&&O<=B.levels.SILENT)return O;throw new TypeError("log.setLevel() called with invalid level: "+D)}B.name=f,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=m||d,B.getLevel=function(){return w??U??b},B.setLevel=function(D,O){return w=F(D),O!==!1&&y(w),l.call(B)},B.setDefaultLevel=function(D){U=F(D),E()||B.setLevel(D,!1)},B.resetLevel=function(){w=null,T(),l.call(B)},B.enableAll=function(D){B.setLevel(B.levels.TRACE,D)},B.disableAll=function(D){B.setLevel(B.levels.SILENT,D)},B.rebuild=function(){if(s!==B&&(b=F(s.getLevel())),l.call(B),s===B)for(var D in r)r[D].rebuild()},b=F(s?s.getLevel():"WARN");var R=E();R!=null&&(w=F(R)),l.call(B)}s=new h,s.getLogger=function(m){if(typeof m!="symbol"&&typeof m!="string"||m==="")throw new TypeError("You must supply a name when creating a logger.");var B=r[m];return B||(B=r[m]=new h(m,s.methodFactory)),B};var p=typeof window!==A?window.log:void 0;return s.noConflict=function(){return typeof window!==A&&window.log===s&&(window.log=p),s},s.getLoggers=function(){return r},s.default=s,s})}(Yi)),Yi.exports}var zi=lw(),Ys;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(Ys||(Ys={}));var lA;(function(t){t.Default="livekit",t.Room="livekit-room",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee"})(lA||(lA={}));let W=zi.getLogger("livekit");Object.values(lA).map(t=>zi.getLogger(t)),W.setDefaultLevel(Ys.info);function FA(t){const e=zi.getLogger(t);return e.setDefaultLevel(W.getLevel()),e}const uw=zi.getLogger("lk-e2ee"),Qn=7e3,dw=[0,300,2*2*300,3*3*300,4*4*300,Qn,Qn,Qn,Qn,Qn];class hw{constructor(e){this._retryDelays=e!==void 0?[...e]:dw}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const A=this._retryDelays[e.retryCount];return e.retryCount<=1?A:A+Math.random()*1e3}}function fw(t,e){var A={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(A[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(A[n[i]]=t[n[i]]);return A}function C(t,e,A,n){function i(r){return r instanceof A?r:new A(function(s){s(r)})}return new(A||(A=Promise))(function(r,s){function a(l){try{c(n.next(l))}catch(u){s(u)}}function o(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(a,o)}c((n=n.apply(t,e||[])).next())})}function Tu(t){var e=typeof Symbol=="function"&&Symbol.iterator,A=e&&t[e],n=0;if(A)return A.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function XA(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],A;return e?e.call(t):(t=typeof Tu=="function"?Tu(t):t[Symbol.iterator](),A={},n("next"),n("throw"),n("return"),A[Symbol.asyncIterator]=function(){return this},A);function n(r){A[r]=t[r]&&function(s){return new Promise(function(a,o){s=t[r](s),i(a,o,s.done,s.value)})}}function i(r,s,a,o){Promise.resolve(o).then(function(c){r({value:c,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;var Zi={exports:{}},Fu;function gw(){if(Fu)return Zi.exports;Fu=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(v,y,E){return Function.prototype.apply.call(v,y,E)},A;t&&typeof t.ownKeys=="function"?A=t.ownKeys:Object.getOwnPropertySymbols?A=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:A=function(v){return Object.getOwnPropertyNames(v)};function n(w){console&&console.warn&&console.warn(w)}var i=Number.isNaN||function(v){return v!==v};function r(){r.init.call(this)}Zi.exports=r,Zi.exports.once=B,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var s=10;function a(w){if(typeof w!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof w)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(w){if(typeof w!="number"||w<0||i(w))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+w+".");s=w}}),r.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},r.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function o(w){return w._maxListeners===void 0?r.defaultMaxListeners:w._maxListeners}r.prototype.getMaxListeners=function(){return o(this)},r.prototype.emit=function(v){for(var y=[],E=1;E<arguments.length;E++)y.push(arguments[E]);var T=v==="error",F=this._events;if(F!==void 0)T=T&&F.error===void 0;else if(!T)return!1;if(T){var R;if(y.length>0&&(R=y[0]),R instanceof Error)throw R;var D=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw D.context=R,D}var O=F[v];if(O===void 0)return!1;if(typeof O=="function")e(O,this,y);else for(var M=O.length,ae=p(O,M),E=0;E<M;++E)e(ae[E],this,y);return!0};function c(w,v,y,E){var T,F,R;if(a(y),F=w._events,F===void 0?(F=w._events=Object.create(null),w._eventsCount=0):(F.newListener!==void 0&&(w.emit("newListener",v,y.listener?y.listener:y),F=w._events),R=F[v]),R===void 0)R=F[v]=y,++w._eventsCount;else if(typeof R=="function"?R=F[v]=E?[y,R]:[R,y]:E?R.unshift(y):R.push(y),T=o(w),T>0&&R.length>T&&!R.warned){R.warned=!0;var D=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");D.name="MaxListenersExceededWarning",D.emitter=w,D.type=v,D.count=R.length,n(D)}return w}r.prototype.addListener=function(v,y){return c(this,v,y,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(v,y){return c(this,v,y,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(w,v,y){var E={fired:!1,wrapFn:void 0,target:w,type:v,listener:y},T=l.bind(E);return T.listener=y,E.wrapFn=T,T}r.prototype.once=function(v,y){return a(y),this.on(v,u(this,v,y)),this},r.prototype.prependOnceListener=function(v,y){return a(y),this.prependListener(v,u(this,v,y)),this},r.prototype.removeListener=function(v,y){var E,T,F,R,D;if(a(y),T=this._events,T===void 0)return this;if(E=T[v],E===void 0)return this;if(E===y||E.listener===y)--this._eventsCount===0?this._events=Object.create(null):(delete T[v],T.removeListener&&this.emit("removeListener",v,E.listener||y));else if(typeof E!="function"){for(F=-1,R=E.length-1;R>=0;R--)if(E[R]===y||E[R].listener===y){D=E[R].listener,F=R;break}if(F<0)return this;F===0?E.shift():f(E,F),E.length===1&&(T[v]=E[0]),T.removeListener!==void 0&&this.emit("removeListener",v,D||y)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(v){var y,E,T;if(E=this._events,E===void 0)return this;if(E.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):E[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete E[v]),this;if(arguments.length===0){var F=Object.keys(E),R;for(T=0;T<F.length;++T)R=F[T],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(y=E[v],typeof y=="function")this.removeListener(v,y);else if(y!==void 0)for(T=y.length-1;T>=0;T--)this.removeListener(v,y[T]);return this};function d(w,v,y){var E=w._events;if(E===void 0)return[];var T=E[v];return T===void 0?[]:typeof T=="function"?y?[T.listener||T]:[T]:y?m(T):p(T,T.length)}r.prototype.listeners=function(v){return d(this,v,!0)},r.prototype.rawListeners=function(v){return d(this,v,!1)},r.listenerCount=function(w,v){return typeof w.listenerCount=="function"?w.listenerCount(v):h.call(w,v)},r.prototype.listenerCount=h;function h(w){var v=this._events;if(v!==void 0){var y=v[w];if(typeof y=="function")return 1;if(y!==void 0)return y.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?A(this._events):[]};function p(w,v){for(var y=new Array(v),E=0;E<v;++E)y[E]=w[E];return y}function f(w,v){for(;v+1<w.length;v++)w[v]=w[v+1];w.pop()}function m(w){for(var v=new Array(w.length),y=0;y<v.length;++y)v[y]=w[y].listener||w[y];return v}function B(w,v){return new Promise(function(y,E){function T(R){w.removeListener(v,F),E(R)}function F(){typeof w.removeListener=="function"&&w.removeListener("error",T),y([].slice.call(arguments))}U(w,v,F,{once:!0}),v!=="error"&&b(w,T,{once:!0})})}function b(w,v,y){typeof w.on=="function"&&U(w,"error",v,y)}function U(w,v,y,E){if(typeof w.on=="function")E.once?w.once(v,y):w.on(v,y);else if(typeof w.addEventListener=="function")w.addEventListener(v,function T(F){E.once&&w.removeEventListener(v,T),y(F)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof w)}return Zi.exports}var yA=gw();let Iu=!0,xu=!0;function $i(t,e,A){const n=t.match(e);return n&&n.length>=A&&parseInt(n[A],10)}function pt(t,e,A){if(!t.RTCPeerConnection)return;const n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(s,a){if(s!==e)return i.apply(this,arguments);const o=c=>{const l=A(c);l&&(a.handleEvent?a.handleEvent(l):a(l))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,o),i.apply(this,[s,o])};const r=n.removeEventListener;n.removeEventListener=function(s,a){if(s!==e||!this._eventMap||!this._eventMap[e])return r.apply(this,arguments);if(!this._eventMap[e].has(a))return r.apply(this,arguments);const o=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,r.apply(this,[s,o])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function pw(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(Iu=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function mw(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(xu=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function _u(){if(typeof window=="object"){if(Iu)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function zs(t,e){xu&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Bw(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:A}=t;if(A.userAgentData&&A.userAgentData.brands){const n=A.userAgentData.brands.find(i=>i.brand==="Chromium");if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(A.mozGetUserMedia)e.browser="firefox",e.version=$i(A.userAgent,/Firefox\/(\d+)\./,1);else if(A.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=$i(A.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&A.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=$i(A.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function Pu(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ru(t){return Pu(t)?Object.keys(t).reduce(function(e,A){const n=Pu(t[A]),i=n?Ru(t[A]):t[A],r=n&&!Object.keys(i).length;return i===void 0||r?e:Object.assign(e,{[A]:i})},{}):t}function Zs(t,e,A){!e||A.has(e.id)||(A.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?Zs(t,t.get(e[n]),A):n.endsWith("Ids")&&e[n].forEach(i=>{Zs(t,t.get(i),A)})}))}function Lu(t,e,A){const n=A?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const r=[];return t.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&r.push(s)}),r.forEach(s=>{t.forEach(a=>{a.type===n&&a.trackId===s.id&&Zs(t,a,i)})}),i}const Du=_u;function Hu(t,e){const A=t&&t.navigator;if(!A.mediaDevices)return;const n=function(a){if(typeof a!="object"||a.mandatory||a.optional)return a;const o={};return Object.keys(a).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const l=typeof a[c]=="object"?a[c]:{ideal:a[c]};l.exact!==void 0&&typeof l.exact=="number"&&(l.min=l.max=l.exact);const u=function(d,h){return d?d+h.charAt(0).toUpperCase()+h.slice(1):h==="deviceId"?"sourceId":h};if(l.ideal!==void 0){o.optional=o.optional||[];let d={};typeof l.ideal=="number"?(d[u("min",c)]=l.ideal,o.optional.push(d),d={},d[u("max",c)]=l.ideal,o.optional.push(d)):(d[u("",c)]=l.ideal,o.optional.push(d))}l.exact!==void 0&&typeof l.exact!="number"?(o.mandatory=o.mandatory||{},o.mandatory[u("",c)]=l.exact):["min","max"].forEach(d=>{l[d]!==void 0&&(o.mandatory=o.mandatory||{},o.mandatory[u(d,c)]=l[d])})}),a.advanced&&(o.optional=(o.optional||[]).concat(a.advanced)),o},i=function(a,o){if(e.version>=61)return o(a);if(a=JSON.parse(JSON.stringify(a)),a&&typeof a.audio=="object"){const c=function(l,u,d){u in l&&!(d in l)&&(l[d]=l[u],delete l[u])};a=JSON.parse(JSON.stringify(a)),c(a.audio,"autoGainControl","googAutoGainControl"),c(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=n(a.audio)}if(a&&typeof a.video=="object"){let c=a.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const l=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(A.mediaDevices.getSupportedConstraints&&A.mediaDevices.getSupportedConstraints().facingMode&&!l)){delete a.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return A.mediaDevices.enumerateDevices().then(d=>{d=d.filter(p=>p.kind==="videoinput");let h=d.find(p=>u.some(f=>p.label.toLowerCase().includes(f)));return!h&&d.length&&u.includes("back")&&(h=d[d.length-1]),h&&(a.video.deviceId=c.exact?{exact:h.deviceId}:{ideal:h.deviceId}),a.video=n(a.video),Du("chrome: "+JSON.stringify(a)),o(a)})}a.video=n(a.video)}return Du("chrome: "+JSON.stringify(a)),o(a)},r=function(a){return e.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},s=function(a,o,c){i(a,l=>{A.webkitGetUserMedia(l,o,u=>{c&&c(r(u))})})};if(A.getUserMedia=s.bind(A),A.mediaDevices.getUserMedia){const a=A.mediaDevices.getUserMedia.bind(A.mediaDevices);A.mediaDevices.getUserMedia=function(o){return i(o,c=>a(c).then(l=>{if(c.audio&&!l.getAudioTracks().length||c.video&&!l.getVideoTracks().length)throw l.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return l},l=>Promise.reject(r(l))))}}}function Ou(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function Mu(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(A){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=A)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",i=>{let r;t.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)}),n.stream.getTracks().forEach(i=>{let r;t.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(a=>a.track&&a.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else pt(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Nu(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(i,r){return{track:r,get dtmf(){return this._dtmf===void 0&&(r.kind==="audio"?this._dtmf=i.createDTMFSender(r):this._dtmf=null),this._dtmf},_pc:i}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,o){let c=i.apply(this,arguments);return c||(c=e(this,a),this._senders.push(c)),c};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){r.apply(this,arguments);const o=this._senders.indexOf(a);o!==-1&&this._senders.splice(o,1)}}const A=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],A.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],n.apply(this,[r]),r.getTracks().forEach(s=>{const a=this._senders.find(o=>o.track===s);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ku(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const A=t.RTCPeerConnection.prototype.getSenders;A&&(t.RTCPeerConnection.prototype.getSenders=function(){const r=A.apply(this,[]);return r.forEach(s=>s._pc=this),r});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const r=n.apply(this,arguments);return r._pc=this,r}),t.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>Lu(s,r.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const A=t.RTCPeerConnection.prototype.getReceivers;A&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=A.apply(this,[]);return i.forEach(r=>r._pc=this),i}),pt(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>Lu(r,i.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const n=arguments[0];let i,r,s;return this.getSenders().forEach(a=>{a.track===n&&(i?s=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===n&&(r?s=!0:r=a),a.track===n)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Vu(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(s,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const o=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(o)===-1&&this._shimmedLocalStreams[a.id].push(o):this._shimmedLocalStreams[a.id]=[a,o],o};const A=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(c=>{if(this.getSenders().find(u=>u.track===c))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();A.apply(this,arguments);const o=this.getSenders().filter(c=>a.indexOf(c)===-1);this._shimmedLocalStreams[s.id]=[s].concat(o)};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],n.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const o=this._shimmedLocalStreams[a].indexOf(s);o!==-1&&this._shimmedLocalStreams[a].splice(o,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),i.apply(this,arguments)}}function Gu(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Vu(t);const A=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const l=A.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(u=>this._reverseStreams[u.id])};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(u=>{if(this.getSenders().find(h=>h.track===u))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const u=new t.MediaStream(l.getTracks());this._streams[l.id]=u,this._reverseStreams[u.id]=l,l=u}n.apply(this,[l])};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},t.RTCPeerConnection.prototype.addTrack=function(l,u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const d=[].slice.call(arguments,1);if(d.length!==1||!d[0].getTracks().find(f=>f===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(f=>f.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const p=this._streams[u.id];if(p)p.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const f=new t.MediaStream([l]);this._streams[u.id]=f,this._reverseStreams[f.id]=u,this.addStream(f)}return this.getSenders().find(f=>f.track===l)};function r(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],p=c._streams[h.id];u=u.replace(new RegExp(p.id,"g"),h.id)}),new RTCSessionDescription({type:l.type,sdp:u})}function s(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],p=c._streams[h.id];u=u.replace(new RegExp(h.id,"g"),p.id)}),new RTCSessionDescription({type:l.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const l=t.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?l.apply(this,[p=>{const f=r(this,p);d[0].apply(null,[f])},p=>{d[1]&&d[1].apply(null,p)},arguments[2]]):l.apply(this,arguments).then(p=>r(this,p))}};t.RTCPeerConnection.prototype[c]=u[c]});const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?a.apply(this,arguments):(arguments[0]=s(this,arguments[0]),a.apply(this,arguments))};const o=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const c=o.get.apply(this);return c.type===""?c:r(this,c)}}),t.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(l._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(f=>l.track===f)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function $s(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(A){const n=t.RTCPeerConnection.prototype[A],i={[A](){return arguments[0]=new(A==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[A]=i[A]})}function ju(t,e){pt(t,"negotiationneeded",A=>{const n=A.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return A})}var Wu=Object.freeze({__proto__:null,fixNegotiationNeeded:ju,shimAddTrackRemoveTrack:Gu,shimAddTrackRemoveTrackWithNative:Vu,shimGetSendersWithDtmf:Nu,shimGetUserMedia:Hu,shimMediaStream:Ou,shimOnTrack:Mu,shimPeerConnection:$s,shimSenderReceiverGetStats:Ku});function Ju(t,e){const A=t&&t.navigator,n=t&&t.MediaStreamTrack;if(A.getUserMedia=function(i,r,s){zs("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),A.mediaDevices.getUserMedia(i).then(r,s)},!(e.version>55&&"autoGainControl"in A.mediaDevices.getSupportedConstraints())){const i=function(s,a,o){a in s&&!(o in s)&&(s[o]=s[a],delete s[a])},r=A.mediaDevices.getUserMedia.bind(A.mediaDevices);if(A.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),r(s)},n&&n.prototype.getSettings){const s=n.prototype.getSettings;n.prototype.getSettings=function(){const a=s.apply(this,arguments);return i(a,"mozAutoGainControl","autoGainControl"),i(a,"mozNoiseSuppression","noiseSuppression"),a}}if(n&&n.prototype.applyConstraints){const s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(a){return this.kind==="audio"&&typeof a=="object"&&(a=JSON.parse(JSON.stringify(a)),i(a,"autoGainControl","mozAutoGainControl"),i(a,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[a])}}}}function vw(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function Xu(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ea(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const r=t.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[i]=s[i]});const A={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[r,s,a]=arguments;return n.apply(this,[r||null]).then(o=>{if(e.version<53&&!s)try{o.forEach(c=>{c.type=A[c.type]||c.type})}catch(c){if(c.name!=="TypeError")throw c;o.forEach((l,u)=>{o.set(u,Object.assign({},l,{type:A[l.type]||l.type}))})}return o}).then(s,a)}}function qu(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i});const A=t.RTCPeerConnection.prototype.addTrack;A&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=A.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Yu(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n}),pt(t,"track",A=>(A.receiver._pc=A.srcElement,A)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function zu(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(A){zs("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&A.getTracks().includes(n.track)&&this.removeTrack(n)})})}function Zu(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function $u(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const i=n.length>0;i&&n.forEach(s=>{if("rid"in s&&!/^[a-z0-9]{0,16}$/i.test(s.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in s&&!(parseFloat(s.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in s&&!(parseFloat(s.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=e.apply(this,arguments);if(i){const{sender:s}=r,a=s.getParameters();(!("encodings"in a)||a.encodings.length===1&&Object.keys(a.encodings[0]).length===0)&&(a.encodings=n,s.sendEncodings=n,this.setParametersPromises.push(s.setParameters(a).then(()=>{delete s.sendEncodings}).catch(()=>{delete s.sendEncodings})))}return r})}function ed(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function Ad(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function td(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var nd=Object.freeze({__proto__:null,shimAddTransceiver:$u,shimCreateAnswer:td,shimCreateOffer:Ad,shimGetDisplayMedia:vw,shimGetParameters:ed,shimGetUserMedia:Ju,shimOnTrack:Xu,shimPeerConnection:ea,shimRTCDataChannel:Zu,shimReceiverGetStats:Yu,shimRemoveStream:zu,shimSenderGetStats:qu});function id(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(i=>e.call(this,i,n)),n.getVideoTracks().forEach(i=>e.call(this,i,n))},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return r&&r.forEach(a=>{this._localStreams?this._localStreams.includes(a)||this._localStreams.push(a):this._localStreams=[a]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(A){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(A);if(n===-1)return;this._localStreams.splice(n,1);const i=A.getTracks();this.getSenders().forEach(r=>{i.includes(r.track)&&this.removeTrack(r)})})}}function rd(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(A){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=A),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const r=new Event("addstream");r.stream=i,this.dispatchEvent(r)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(r=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(r)>=0)return;n._remoteStreams.push(r);const s=new Event("addstream");s.stream=r,n.dispatchEvent(s)})}),e.apply(n,arguments)}}}function sd(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,A=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,r=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=A.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d},e.createAnswer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=n.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d};let a=function(o,c,l){const u=i.apply(this,[o]);return l?(u.then(c,l),Promise.resolve()):u};e.setLocalDescription=a,a=function(o,c,l){const u=r.apply(this,[o]);return l?(u.then(c,l),Promise.resolve()):u},e.setRemoteDescription=a,a=function(o,c,l){const u=s.apply(this,[o]);return l?(u.then(c,l),Promise.resolve()):u},e.addIceCandidate=a}function ad(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const A=e.mediaDevices,n=A.getUserMedia.bind(A);e.mediaDevices.getUserMedia=i=>n(od(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,i,r){e.mediaDevices.getUserMedia(n).then(i,r)}).bind(e))}function od(t){return t&&t.video!==void 0?Object.assign({},t,{video:Ru(t.video)}):t}function cd(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){const r=[];for(let s=0;s<n.iceServers.length;s++){let a=n.iceServers[s];a.urls===void 0&&a.url?(zs("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,r.push(a)):r.push(n.iceServers[s])}n.iceServers=r}return new e(n,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function ld(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ud(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const i=this.getTransceivers().find(s=>s.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const r=this.getTransceivers().find(s=>s.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):n.offerToReceiveVideo===!0&&!r&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function dd(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var hd=Object.freeze({__proto__:null,shimAudioContext:dd,shimCallbacksAPI:sd,shimConstraints:od,shimCreateOfferLegacy:ud,shimGetUserMedia:ad,shimLocalStreamsAPI:id,shimRTCIceServerUrls:cd,shimRemoteStreamsAPI:rd,shimTrackEventTransceiver:ld}),Aa={exports:{}},fd;function Cw(){return fd||(fd=1,function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(A){return A.trim().split(`
9
+ .`).concat(Qs).concat(jB).concat(hl))},JB=function(t,e){var A=t.ownerDocument;if(A){var n=A.createElement("style");n.textContent=e,t.appendChild(n)}},XB=function(t,e){var A,n=e.createElement("base");n.href=e.baseURI;var i=t.getElementsByTagName("head").item(0);i==null||i.insertBefore(n,(A=i==null?void 0:i.firstChild)!==null&&A!==void 0?A:null)},Es=function(){function t(){}return t.getOrigin=function(e){var A=t._link;return A?(A.href=e,A.href=A.href,A.protocol+A.hostname+A.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),qB=function(){function t(e,A){this.context=e,this._options=A,this._cache={}}return t.prototype.addImage=function(e){var A=Promise.resolve();return this.has(e)||(ks(e)||$B(e))&&(this._cache[e]=this.loadImage(e)).catch(function(){}),A},t.prototype.match=function(e){return this._cache[e]},t.prototype.loadImage=function(e){return Re(this,void 0,void 0,function(){var A,n,i,r,s,a=this;return xe(this,function(o){switch(o.label){case 0:return typeof this._options.customIsSameOrigin!="function"?[3,2]:[4,this._options.customIsSameOrigin(e,Es.isSameOrigin)];case 1:return n=o.sent(),[3,3];case 2:n=Es.isSameOrigin(e),o.label=3;case 3:return A=n,i=!Ss(e)&&this._options.useCORS===!0&&ke.SUPPORT_CORS_IMAGES&&!A,r=!Ss(e)&&!A&&!ks(e)&&typeof this._options.proxy=="string"&&ke.SUPPORT_CORS_XHR&&!i,!A&&this._options.allowTaint===!1&&!Ss(e)&&!ks(e)&&!r&&!i?[2]:(s=e,r?[4,this.proxy(s)]:[3,5]);case 4:s=o.sent(),o.label=5;case 5:return this.context.logger.debug("Added image ".concat(e.substring(0,256))),[4,new Promise(function(c,l){var u=new Image;u.onload=function(){return c(u)},u.onerror=l,(ev(s)||i)&&(u.crossOrigin="anonymous"),u.src=s,u.complete===!0&&setTimeout(function(){return c(u)},500),a._options.imageTimeout>0&&setTimeout(function(){return l("Timed out (".concat(a._options.imageTimeout,"ms) loading image"))},a._options.imageTimeout)})];case 6:return[2,o.sent()]}})})},t.prototype.has=function(e){return typeof this._cache[e]<"u"},t.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},t.prototype.proxy=function(e){var A=this,n=this._options.proxy;if(!n)throw new Error("No proxy defined");var i=e.substring(0,256);return new Promise(function(r,s){var a=ke.SUPPORT_RESPONSE_TYPE?"blob":"text",o=new XMLHttpRequest;o.onload=function(){if(o.status===200)if(a==="text")r(o.response);else{var u=new FileReader;u.addEventListener("load",function(){return r(u.result)},!1),u.addEventListener("error",function(d){return s(d)},!1),u.readAsDataURL(o.response)}else s("Failed to proxy resource ".concat(i," with status code ").concat(o.status))},o.onerror=s;var c=n.indexOf("?")>-1?"&":"?";if(o.open("GET","".concat(n).concat(c,"url=").concat(encodeURIComponent(e),"&responseType=").concat(a)),a!=="text"&&o instanceof XMLHttpRequest&&(o.responseType=a),A._options.imageTimeout){var l=A._options.imageTimeout;o.timeout=l,o.ontimeout=function(){return s("Timed out (".concat(l,"ms) proxying ").concat(i))}}o.send()})},t}(),YB=/^data:image\/svg\+xml/i,zB=/^data:image\/.*;base64,/i,ZB=/^data:image\/.*/i,$B=function(t){return ke.SUPPORT_SVG_DRAWING||!Av(t)},Ss=function(t){return ZB.test(t)},ev=function(t){return zB.test(t)},ks=function(t){return t.substr(0,4)==="blob"},Av=function(t){return t.substr(-3).toLowerCase()==="svg"||YB.test(t)},H=function(){function t(e,A){this.type=0,this.x=e,this.y=A}return t.prototype.add=function(e,A){return new t(this.x+e,this.y+A)},t}(),It=function(t,e,A){return new H(t.x+(e.x-t.x)*A,t.y+(e.y-t.y)*A)},Ti=function(){function t(e,A,n,i){this.type=1,this.start=e,this.startControl=A,this.endControl=n,this.end=i}return t.prototype.subdivide=function(e,A){var n=It(this.start,this.startControl,e),i=It(this.startControl,this.endControl,e),r=It(this.endControl,this.end,e),s=It(n,i,e),a=It(i,r,e),o=It(s,a,e);return A?new t(this.start,n,s,o):new t(o,a,r,this.end)},t.prototype.add=function(e,A){return new t(this.start.add(e,A),this.startControl.add(e,A),this.endControl.add(e,A),this.end.add(e,A))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),$e=function(t){return t.type===1},tv=function(){function t(e){var A=e.styles,n=e.bounds,i=dn(A.borderTopLeftRadius,n.width,n.height),r=i[0],s=i[1],a=dn(A.borderTopRightRadius,n.width,n.height),o=a[0],c=a[1],l=dn(A.borderBottomRightRadius,n.width,n.height),u=l[0],d=l[1],h=dn(A.borderBottomLeftRadius,n.width,n.height),g=h[0],f=h[1],m=[];m.push((r+o)/n.width),m.push((g+u)/n.width),m.push((s+f)/n.height),m.push((c+d)/n.height);var B=Math.max.apply(Math,m);B>1&&(r/=B,s/=B,o/=B,c/=B,u/=B,d/=B,g/=B,f/=B);var b=n.width-o,U=n.height-d,C=n.width-u,w=n.height-f,y=A.borderTopWidth,E=A.borderRightWidth,S=A.borderBottomWidth,k=A.borderLeftWidth,R=$(A.paddingTop,e.bounds.width),P=$(A.paddingRight,e.bounds.width),D=$(A.paddingBottom,e.bounds.width),M=$(A.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=r>0||s>0?ie(n.left+k/3,n.top+y/3,r-k/3,s-y/3,Y.TOP_LEFT):new H(n.left+k/3,n.top+y/3),this.topRightBorderDoubleOuterBox=r>0||s>0?ie(n.left+b,n.top+y/3,o-E/3,c-y/3,Y.TOP_RIGHT):new H(n.left+n.width-E/3,n.top+y/3),this.bottomRightBorderDoubleOuterBox=u>0||d>0?ie(n.left+C,n.top+U,u-E/3,d-S/3,Y.BOTTOM_RIGHT):new H(n.left+n.width-E/3,n.top+n.height-S/3),this.bottomLeftBorderDoubleOuterBox=g>0||f>0?ie(n.left+k/3,n.top+w,g-k/3,f-S/3,Y.BOTTOM_LEFT):new H(n.left+k/3,n.top+n.height-S/3),this.topLeftBorderDoubleInnerBox=r>0||s>0?ie(n.left+k*2/3,n.top+y*2/3,r-k*2/3,s-y*2/3,Y.TOP_LEFT):new H(n.left+k*2/3,n.top+y*2/3),this.topRightBorderDoubleInnerBox=r>0||s>0?ie(n.left+b,n.top+y*2/3,o-E*2/3,c-y*2/3,Y.TOP_RIGHT):new H(n.left+n.width-E*2/3,n.top+y*2/3),this.bottomRightBorderDoubleInnerBox=u>0||d>0?ie(n.left+C,n.top+U,u-E*2/3,d-S*2/3,Y.BOTTOM_RIGHT):new H(n.left+n.width-E*2/3,n.top+n.height-S*2/3),this.bottomLeftBorderDoubleInnerBox=g>0||f>0?ie(n.left+k*2/3,n.top+w,g-k*2/3,f-S*2/3,Y.BOTTOM_LEFT):new H(n.left+k*2/3,n.top+n.height-S*2/3),this.topLeftBorderStroke=r>0||s>0?ie(n.left+k/2,n.top+y/2,r-k/2,s-y/2,Y.TOP_LEFT):new H(n.left+k/2,n.top+y/2),this.topRightBorderStroke=r>0||s>0?ie(n.left+b,n.top+y/2,o-E/2,c-y/2,Y.TOP_RIGHT):new H(n.left+n.width-E/2,n.top+y/2),this.bottomRightBorderStroke=u>0||d>0?ie(n.left+C,n.top+U,u-E/2,d-S/2,Y.BOTTOM_RIGHT):new H(n.left+n.width-E/2,n.top+n.height-S/2),this.bottomLeftBorderStroke=g>0||f>0?ie(n.left+k/2,n.top+w,g-k/2,f-S/2,Y.BOTTOM_LEFT):new H(n.left+k/2,n.top+n.height-S/2),this.topLeftBorderBox=r>0||s>0?ie(n.left,n.top,r,s,Y.TOP_LEFT):new H(n.left,n.top),this.topRightBorderBox=o>0||c>0?ie(n.left+b,n.top,o,c,Y.TOP_RIGHT):new H(n.left+n.width,n.top),this.bottomRightBorderBox=u>0||d>0?ie(n.left+C,n.top+U,u,d,Y.BOTTOM_RIGHT):new H(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=g>0||f>0?ie(n.left,n.top+w,g,f,Y.BOTTOM_LEFT):new H(n.left,n.top+n.height),this.topLeftPaddingBox=r>0||s>0?ie(n.left+k,n.top+y,Math.max(0,r-k),Math.max(0,s-y),Y.TOP_LEFT):new H(n.left+k,n.top+y),this.topRightPaddingBox=o>0||c>0?ie(n.left+Math.min(b,n.width-E),n.top+y,b>n.width+E?0:Math.max(0,o-E),Math.max(0,c-y),Y.TOP_RIGHT):new H(n.left+n.width-E,n.top+y),this.bottomRightPaddingBox=u>0||d>0?ie(n.left+Math.min(C,n.width-k),n.top+Math.min(U,n.height-S),Math.max(0,u-E),Math.max(0,d-S),Y.BOTTOM_RIGHT):new H(n.left+n.width-E,n.top+n.height-S),this.bottomLeftPaddingBox=g>0||f>0?ie(n.left+k,n.top+Math.min(w,n.height-S),Math.max(0,g-k),Math.max(0,f-S),Y.BOTTOM_LEFT):new H(n.left+k,n.top+n.height-S),this.topLeftContentBox=r>0||s>0?ie(n.left+k+M,n.top+y+R,Math.max(0,r-(k+M)),Math.max(0,s-(y+R)),Y.TOP_LEFT):new H(n.left+k+M,n.top+y+R),this.topRightContentBox=o>0||c>0?ie(n.left+Math.min(b,n.width+k+M),n.top+y+R,b>n.width+k+M?0:o-k+M,c-(y+R),Y.TOP_RIGHT):new H(n.left+n.width-(E+P),n.top+y+R),this.bottomRightContentBox=u>0||d>0?ie(n.left+Math.min(C,n.width-(k+M)),n.top+Math.min(U,n.height+y+R),Math.max(0,u-(E+P)),d-(S+D),Y.BOTTOM_RIGHT):new H(n.left+n.width-(E+P),n.top+n.height-(S+D)),this.bottomLeftContentBox=g>0||f>0?ie(n.left+k+M,n.top+w,Math.max(0,g-(k+M)),f-(S+D),Y.BOTTOM_LEFT):new H(n.left+k+M,n.top+n.height-(S+D))}return t}(),Y;(function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(Y||(Y={}));var ie=function(t,e,A,n,i){var r=4*((Math.sqrt(2)-1)/3),s=A*r,a=n*r,o=t+A,c=e+n;switch(i){case Y.TOP_LEFT:return new Ti(new H(t,c),new H(t,c-a),new H(o-s,e),new H(o,e));case Y.TOP_RIGHT:return new Ti(new H(t,e),new H(t+s,e),new H(o,c-a),new H(o,c));case Y.BOTTOM_RIGHT:return new Ti(new H(o,e),new H(o,e+a),new H(t+s,c),new H(t,c));case Y.BOTTOM_LEFT:default:return new Ti(new H(o,c),new H(o-s,c),new H(t,e+a),new H(t,e))}},Fi=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},nv=function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]},Ii=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},iv=function(){function t(e,A,n){this.offsetX=e,this.offsetY=A,this.matrix=n,this.type=0,this.target=6}return t}(),xi=function(){function t(e,A){this.path=e,this.target=A,this.type=1}return t}(),rv=function(){function t(e){this.opacity=e,this.type=2,this.target=6}return t}(),sv=function(t){return t.type===0},fl=function(t){return t.type===1},av=function(t){return t.type===2},gl=function(t,e){return t.length===e.length?t.some(function(A,n){return A===e[n]}):!1},ov=function(t,e,A,n,i){return t.map(function(r,s){switch(s){case 0:return r.add(e,A);case 1:return r.add(e+n,A);case 2:return r.add(e+n,A+i);case 3:return r.add(e,A+i)}return r})},pl=function(){function t(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return t}(),ml=function(){function t(e,A){if(this.container=e,this.parent=A,this.effects=[],this.curves=new tv(this.container),this.container.styles.opacity<1&&this.effects.push(new rv(this.container.styles.opacity)),this.container.styles.transform!==null){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,r=this.container.styles.transform;this.effects.push(new iv(n,i,r))}if(this.container.styles.overflowX!==0){var s=Fi(this.curves),a=Ii(this.curves);gl(s,a)?this.effects.push(new xi(s,6)):(this.effects.push(new xi(s,2)),this.effects.push(new xi(a,4)))}}return t.prototype.getEffects=function(e){for(var A=[2,3].indexOf(this.container.styles.position)===-1,n=this.parent,i=this.effects.slice(0);n;){var r=n.effects.filter(function(o){return!fl(o)});if(A||n.container.styles.position!==0||!n.parent){if(A=[2,3].indexOf(n.container.styles.position)===-1,n.container.styles.overflowX!==0){var s=Fi(n.curves),a=Ii(n.curves);gl(s,a)||i.unshift(new xi(a,6))}i.unshift.apply(i,r)}else i.unshift.apply(i,r);n=n.parent}return i.filter(function(o){return be(o.target,e)})},t}(),Ts=function(t,e,A,n){t.container.elements.forEach(function(i){var r=be(i.flags,4),s=be(i.flags,2),a=new ml(i,t);be(i.styles.display,2048)&&n.push(a);var o=be(i.flags,8)?[]:n;if(r||s){var c=r||i.styles.isPositioned()?A:e,l=new pl(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var d=0;c.negativeZIndex.some(function(g,f){return u>g.element.container.styles.zIndex.order?(d=f,!1):d>0}),c.negativeZIndex.splice(d,0,l)}else if(u>0){var h=0;c.positiveZIndex.some(function(g,f){return u>=g.element.container.styles.zIndex.order?(h=f+1,!1):h>0}),c.positiveZIndex.splice(h,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else i.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);Ts(a,l,r?l:A,o)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),Ts(a,e,A,o);be(i.flags,8)&&Bl(i,o)})},Bl=function(t,e){for(var A=t instanceof ms?t.start:1,n=t instanceof ms?t.reversed:!1,i=0;i<e.length;i++){var r=e[i];r.container instanceof Gc&&typeof r.container.value=="number"&&r.container.value!==0&&(A=r.container.value),r.listValue=Bn(A,r.container.styles.listStyleType,!0),A+=n?-1:1}},cv=function(t){var e=new ml(t,null),A=new pl(e),n=[];return Ts(e,A,A,n),Bl(e.container,n),A},vl=function(t,e){switch(e){case 0:return eA(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return eA(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return eA(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);case 3:default:return eA(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},lv=function(t,e){switch(e){case 0:return eA(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return eA(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return eA(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);case 3:default:return eA(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}},uv=function(t,e){switch(e){case 0:return eA(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return eA(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return eA(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);case 3:default:return eA(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}},dv=function(t,e){switch(e){case 0:return _i(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return _i(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return _i(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);case 3:default:return _i(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}},_i=function(t,e){var A=[];return $e(t)?A.push(t.subdivide(.5,!1)):A.push(t),$e(e)?A.push(e.subdivide(.5,!0)):A.push(e),A},eA=function(t,e,A,n){var i=[];return $e(t)?i.push(t.subdivide(.5,!1)):i.push(t),$e(A)?i.push(A.subdivide(.5,!0)):i.push(A),$e(n)?i.push(n.subdivide(.5,!0).reverse()):i.push(n),$e(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},Cl=function(t){var e=t.bounds,A=t.styles;return e.add(A.borderLeftWidth,A.borderTopWidth,-(A.borderRightWidth+A.borderLeftWidth),-(A.borderTopWidth+A.borderBottomWidth))},Pi=function(t){var e=t.styles,A=t.bounds,n=$(e.paddingLeft,A.width),i=$(e.paddingRight,A.width),r=$(e.paddingTop,A.width),s=$(e.paddingBottom,A.width);return A.add(n+e.borderLeftWidth,r+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+n+i),-(e.borderTopWidth+e.borderBottomWidth+r+s))},hv=function(t,e){return t===0?e.bounds:t===2?Pi(e):Cl(e)},fv=function(t,e){return t===0?e.bounds:t===2?Pi(e):Cl(e)},Fs=function(t,e,A){var n=hv(_t(t.styles.backgroundOrigin,e),t),i=fv(_t(t.styles.backgroundClip,e),t),r=gv(_t(t.styles.backgroundSize,e),A,n),s=r[0],a=r[1],o=dn(_t(t.styles.backgroundPosition,e),n.width-s,n.height-a),c=pv(_t(t.styles.backgroundRepeat,e),o,r,n,i),l=Math.round(n.left+o[0]),u=Math.round(n.top+o[1]);return s=Math.max(1,s),a=Math.max(1,a),[c,l,u,s,a]},xt=function(t){return j(t)&&t.value===St.AUTO},Ri=function(t){return typeof t=="number"},gv=function(t,e,A){var n=e[0],i=e[1],r=e[2],s=t[0],a=t[1];if(!s)return[0,0];if(te(s)&&a&&te(a))return[$(s,A.width),$(a,A.height)];var o=Ri(r);if(j(s)&&(s.value===St.CONTAIN||s.value===St.COVER)){if(Ri(r)){var c=A.width/A.height;return c<r!=(s.value===St.COVER)?[A.width,A.width/r]:[A.height*r,A.height]}return[A.width,A.height]}var l=Ri(n),u=Ri(i),d=l||u;if(xt(s)&&(!a||xt(a))){if(l&&u)return[n,i];if(!o&&!d)return[A.width,A.height];if(d&&o){var h=l?n:i*r,g=u?i:n/r;return[h,g]}var f=l?n:A.width,m=u?i:A.height;return[f,m]}if(o){var B=0,b=0;return te(s)?B=$(s,A.width):te(a)&&(b=$(a,A.height)),xt(s)?B=b*r:(!a||xt(a))&&(b=B/r),[B,b]}var U=null,C=null;if(te(s)?U=$(s,A.width):a&&te(a)&&(C=$(a,A.height)),U!==null&&(!a||xt(a))&&(C=l&&u?U/n*i:A.height),C!==null&&xt(s)&&(U=l&&u?C/i*n:A.width),U!==null&&C!==null)return[U,C];throw new Error("Unable to calculate background-size for element")},_t=function(t,e){var A=t[e];return typeof A>"u"?t[0]:A},pv=function(t,e,A,n,i){var r=e[0],s=e[1],a=A[0],o=A[1];switch(t){case 2:return[new H(Math.round(n.left),Math.round(n.top+s)),new H(Math.round(n.left+n.width),Math.round(n.top+s)),new H(Math.round(n.left+n.width),Math.round(o+n.top+s)),new H(Math.round(n.left),Math.round(o+n.top+s))];case 3:return[new H(Math.round(n.left+r),Math.round(n.top)),new H(Math.round(n.left+r+a),Math.round(n.top)),new H(Math.round(n.left+r+a),Math.round(n.height+n.top)),new H(Math.round(n.left+r),Math.round(n.height+n.top))];case 1:return[new H(Math.round(n.left+r),Math.round(n.top+s)),new H(Math.round(n.left+r+a),Math.round(n.top+s)),new H(Math.round(n.left+r+a),Math.round(n.top+s+o)),new H(Math.round(n.left+r),Math.round(n.top+s+o))];default:return[new H(Math.round(i.left),Math.round(i.top)),new H(Math.round(i.left+i.width),Math.round(i.top)),new H(Math.round(i.left+i.width),Math.round(i.height+i.top)),new H(Math.round(i.left),Math.round(i.height+i.top))]}},mv="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",wl="Hidden Text",Bv=function(){function t(e){this._data={},this._document=e}return t.prototype.parseMetrics=function(e,A){var n=this._document.createElement("div"),i=this._document.createElement("img"),r=this._document.createElement("span"),s=this._document.body;n.style.visibility="hidden",n.style.fontFamily=e,n.style.fontSize=A,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",s.appendChild(n),i.src=mv,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",r.style.fontFamily=e,r.style.fontSize=A,r.style.margin="0",r.style.padding="0",r.appendChild(this._document.createTextNode(wl)),n.appendChild(r),n.appendChild(i);var a=i.offsetTop-r.offsetTop+2;n.removeChild(r),n.appendChild(this._document.createTextNode(wl)),n.style.lineHeight="normal",i.style.verticalAlign="super";var o=i.offsetTop-n.offsetTop+2;return s.removeChild(n),{baseline:a,middle:o}},t.prototype.getMetrics=function(e,A){var n="".concat(e," ").concat(A);return typeof this._data[n]>"u"&&(this._data[n]=this.parseMetrics(e,A)),this._data[n]},t}(),bl=function(){function t(e,A){this.context=e,this.options=A}return t}(),vv=1e4,Cv=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i._activeEffects=[],i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),n.canvas||(i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px")),i.fontMetrics=new Bv(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized (".concat(n.width,"x").concat(n.height,") with scale ").concat(n.scale)),i}return e.prototype.applyEffects=function(A){for(var n=this;this._activeEffects.length;)this.popEffect();A.forEach(function(i){return n.applyEffect(i)})},e.prototype.applyEffect=function(A){this.ctx.save(),av(A)&&(this.ctx.globalAlpha=A.opacity),sv(A)&&(this.ctx.translate(A.offsetX,A.offsetY),this.ctx.transform(A.matrix[0],A.matrix[1],A.matrix[2],A.matrix[3],A.matrix[4],A.matrix[5]),this.ctx.translate(-A.offsetX,-A.offsetY)),fl(A)&&(this.path(A.path),this.ctx.clip()),this._activeEffects.push(A)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(A){return Re(this,void 0,void 0,function(){var n;return xe(this,function(i){switch(i.label){case 0:return n=A.element.container.styles,n.isVisible()?[4,this.renderStackContent(A)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(A){return Re(this,void 0,void 0,function(){return xe(this,function(n){switch(n.label){case 0:return be(A.container.flags,16),A.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(A)]:[3,3];case 1:return n.sent(),[4,this.renderNodeContent(A)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(A,n,i){var r=this;if(n===0)navigator.userAgent.indexOf("Firefox")===-1?(this.ctx.textBaseline="ideographic",this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+A.bounds.height)):this.ctx.fillText(A.text,A.bounds.left,A.bounds.top+i);else{var s=ps(A.text);s.reduce(function(a,o){return r.ctx.fillText(o,a,A.bounds.top+i),a+r.ctx.measureText(o).width},A.bounds.left)}},e.prototype.createFontStyle=function(A){var n=A.fontVariant.filter(function(s){return s==="normal"||s==="small-caps"}).join(""),i=Qv(A.fontFamily).join(", "),r=HA(A.fontSize)?"".concat(A.fontSize.number).concat(A.fontSize.unit):"".concat(A.fontSize.number,"px");return[[A.fontStyle,n,A.fontWeight,r,i].join(" "),i,r]},e.prototype.renderTextNode=function(A,n){return Re(this,void 0,void 0,function(){var i,r,s=this;return xe(this,function(a){return i=this.createFontStyle(n)[0],this.ctx.font=i,this.ctx.direction=n.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",r=n.paintOrder,A.textBounds.forEach(function(o){r.forEach(function(c){switch(c){case 0:s.ctx.fillStyle=Ue(n.color),s.renderTextWithLetterSpacing(o,n.letterSpacing,n.fontSize.number);var l=n.textShadow;if(l.length&&o.text.trim().length&&(l.slice(0).reverse().forEach(function(d){s.ctx.shadowColor=Ue(d.color),s.ctx.shadowOffsetX=d.offsetX.number*s.options.scale,s.ctx.shadowOffsetY=d.offsetY.number*s.options.scale,s.ctx.shadowBlur=d.blur.number,s.renderTextWithLetterSpacing(o,n.letterSpacing,n.fontSize.number)}),s.ctx.shadowColor="",s.ctx.shadowOffsetX=0,s.ctx.shadowOffsetY=0,s.ctx.shadowBlur=0),n.textDecorationLine.length){s.ctx.fillStyle=Ue(n.textDecorationColor||n.color);var u=1;n.textDecorationLine.forEach(function(d){switch(d){case 1:s.ctx.fillRect(o.bounds.left,o.bounds.top+o.bounds.height-u,o.bounds.width,u);break;case 2:s.ctx.fillRect(o.bounds.left,o.bounds.top,o.bounds.width,u);break;case 3:s.ctx.fillRect(o.bounds.left,o.bounds.top+(o.bounds.height/2-u/2),o.bounds.width,u);break}})}break;case 1:n.webkitTextStrokeWidth&&o.text.trim().length&&(s.ctx.strokeStyle=Ue(n.webkitTextStrokeColor),s.ctx.lineWidth=n.webkitTextStrokeWidth,s.ctx.lineJoin=window.chrome?"miter":"round",s.ctx.strokeText(o.text,o.bounds.left,o.bounds.top+o.bounds.height)),s.ctx.strokeStyle="",s.ctx.lineWidth=0,s.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(A,n,i){var r=i.naturalWidth||A.intrinsicWidth,s=i.naturalHeight||A.intrinsicHeight;if(i&&r>0&&s>0){var a=Pi(A),o=Ii(n);this.path(o),this.ctx.save(),this.ctx.clip();var c=0,l=0,u=r,d=s,h=a.left,g=a.top,f=a.width,m=a.height,B=A.styles.objectFit,b=f/m,U=u/d;if(B===2)U>b?(m=f/U,g+=(a.height-m)/2):(f=m*U,h+=(a.width-f)/2);else if(B===4)U>b?(u=d*b,c+=(r-u)/2):(d=u/b,l+=(s-d)/2);else if(B===8)u>f?(c+=(u-f)/2,u=f):(h+=(f-u)/2,f=u),d>m?(l+=(d-m)/2,d=m):(g+=(m-d)/2,m=d);else if(B===16){var C=U>b?f:m*U,w=u>f?u:f;C<w?U>b?(m=f/U,g+=(a.height-m)/2):(f=m*U,h+=(a.width-f)/2):(u>f?(c+=(u-f)/2,u=f):(h+=(f-u)/2,f=u),d>m?(l+=(d-m)/2,d=m):(g+=(m-d)/2,m=d))}this.ctx.drawImage(i,c,l,u,d,h,g,f,m),this.ctx.restore()}},e.prototype.renderNodeContent=function(A){return Re(this,void 0,void 0,function(){var n,i,r,s,a,o,U,U,c,l,u,d,w,h,g,f,y,m,B,b,U,C,w,y;return xe(this,function(E){switch(E.label){case 0:this.applyEffects(A.getEffects(4)),n=A.container,i=A.curves,r=n.styles,s=0,a=n.textNodes,E.label=1;case 1:return s<a.length?(o=a[s],[4,this.renderTextNode(o,r)]):[3,4];case 2:E.sent(),E.label=3;case 3:return s++,[3,1];case 4:if(!(n instanceof Nc))return[3,8];E.label=5;case 5:return E.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return U=E.sent(),this.renderReplacedElement(n,i,U),[3,8];case 7:return E.sent(),this.context.logger.error("Error loading image ".concat(n.src)),[3,8];case 8:if(n instanceof Kc&&this.renderReplacedElement(n,i,n.canvas),!(n instanceof Vc))return[3,12];E.label=9;case 9:return E.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return U=E.sent(),this.renderReplacedElement(n,i,U),[3,12];case 11:return E.sent(),this.context.logger.error("Error loading svg ".concat(n.svg.substring(0,255))),[3,12];case 12:return n instanceof Xc&&n.tree?(c=new e(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}),[4,c.render(n.tree)]):[3,14];case 13:l=E.sent(),n.width&&n.height&&this.ctx.drawImage(l,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),E.label=14;case 14:if(n instanceof Bs&&(u=Math.min(n.bounds.width,n.bounds.height),n.type===yi?n.checked&&(this.ctx.save(),this.path([new H(n.bounds.left+u*.39363,n.bounds.top+u*.79),new H(n.bounds.left+u*.16,n.bounds.top+u*.5549),new H(n.bounds.left+u*.27347,n.bounds.top+u*.44071),new H(n.bounds.left+u*.39694,n.bounds.top+u*.5649),new H(n.bounds.left+u*.72983,n.bounds.top+u*.23),new H(n.bounds.left+u*.84,n.bounds.top+u*.34085),new H(n.bounds.left+u*.39363,n.bounds.top+u*.79)]),this.ctx.fillStyle=Ue(jc),this.ctx.fill(),this.ctx.restore()):n.type===Ui&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+u/2,n.bounds.top+u/2,u/4,0,Math.PI*2,!0),this.ctx.fillStyle=Ue(jc),this.ctx.fill(),this.ctx.restore())),wv(n)&&n.value.length){switch(d=this.createFontStyle(r),w=d[0],h=d[1],g=d[2],f=this.fontMetrics.getMetrics(h,g).baseline,this.ctx.font=w,this.ctx.fillStyle=Ue(r.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=yv(n.styles.textAlign),y=Pi(n),m=0,n.styles.textAlign){case 1:m+=y.width/2;break;case 2:m+=y.width;break}B=y.add(m,0,0,-y.height/2+1),this.ctx.save(),this.path([new H(y.left,y.top),new H(y.left+y.width,y.top),new H(y.left+y.width,y.top+y.height),new H(y.left,y.top+y.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new pn(n.value,B),r.letterSpacing,f),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!be(n.styles.display,2048))return[3,20];if(n.styles.listStyleImage===null)return[3,19];if(b=n.styles.listStyleImage,b.type!==0)return[3,18];U=void 0,C=b.url,E.label=15;case 15:return E.trys.push([15,17,,18]),[4,this.context.cache.match(C)];case 16:return U=E.sent(),this.ctx.drawImage(U,n.bounds.left-(U.width+10),n.bounds.top),[3,18];case 17:return E.sent(),this.context.logger.error("Error loading list-style-image ".concat(C)),[3,18];case 18:return[3,20];case 19:A.listValue&&n.styles.listStyleType!==-1&&(w=this.createFontStyle(r)[0],this.ctx.font=w,this.ctx.fillStyle=Ue(r.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",y=new EA(n.bounds.left,n.bounds.top+$(n.styles.paddingTop,n.bounds.width),n.bounds.width,bc(r.lineHeight,r.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new pn(A.listValue,y),r.letterSpacing,bc(r.lineHeight,r.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),E.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(A){return Re(this,void 0,void 0,function(){var n,i,B,r,s,B,a,o,B,c,l,B,u,d,B,h,g,B,f,m,B;return xe(this,function(b){switch(b.label){case 0:return be(A.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(A.element)];case 1:b.sent(),n=0,i=A.negativeZIndex,b.label=2;case 2:return n<i.length?(B=i[n],[4,this.renderStack(B)]):[3,5];case 3:b.sent(),b.label=4;case 4:return n++,[3,2];case 5:return[4,this.renderNodeContent(A.element)];case 6:b.sent(),r=0,s=A.nonInlineLevel,b.label=7;case 7:return r<s.length?(B=s[r],[4,this.renderNode(B)]):[3,10];case 8:b.sent(),b.label=9;case 9:return r++,[3,7];case 10:a=0,o=A.nonPositionedFloats,b.label=11;case 11:return a<o.length?(B=o[a],[4,this.renderStack(B)]):[3,14];case 12:b.sent(),b.label=13;case 13:return a++,[3,11];case 14:c=0,l=A.nonPositionedInlineLevel,b.label=15;case 15:return c<l.length?(B=l[c],[4,this.renderStack(B)]):[3,18];case 16:b.sent(),b.label=17;case 17:return c++,[3,15];case 18:u=0,d=A.inlineLevel,b.label=19;case 19:return u<d.length?(B=d[u],[4,this.renderNode(B)]):[3,22];case 20:b.sent(),b.label=21;case 21:return u++,[3,19];case 22:h=0,g=A.zeroOrAutoZIndexOrTransformedOrOpacity,b.label=23;case 23:return h<g.length?(B=g[h],[4,this.renderStack(B)]):[3,26];case 24:b.sent(),b.label=25;case 25:return h++,[3,23];case 26:f=0,m=A.positiveZIndex,b.label=27;case 27:return f<m.length?(B=m[f],[4,this.renderStack(B)]):[3,30];case 28:b.sent(),b.label=29;case 29:return f++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(A){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(A.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(A){this.ctx.beginPath(),this.formatPath(A),this.ctx.closePath()},e.prototype.formatPath=function(A){var n=this;A.forEach(function(i,r){var s=$e(i)?i.start:i;r===0?n.ctx.moveTo(s.x,s.y):n.ctx.lineTo(s.x,s.y),$e(i)&&n.ctx.bezierCurveTo(i.startControl.x,i.startControl.y,i.endControl.x,i.endControl.y,i.end.x,i.end.y)})},e.prototype.renderRepeat=function(A,n,i,r){this.path(A),this.ctx.fillStyle=n,this.ctx.translate(i,r),this.ctx.fill(),this.ctx.translate(-i,-r)},e.prototype.resizeImage=function(A,n,i){var r,s=(r=this.canvas.ownerDocument)!==null&&r!==void 0?r:document,a=s.createElement("canvas");a.width=Math.max(1,n),a.height=Math.max(1,i);var o=a.getContext("2d");return o.drawImage(A,0,0,A.width,A.height,0,0,n,i),a},e.prototype.renderBackgroundImage=function(A){return Re(this,void 0,void 0,function(){var n,i,r,s,a,o;return xe(this,function(c){switch(c.label){case 0:n=A.styles.backgroundImage.length-1,i=function(l){var u,d,h,g,f,D,ve,Ce,N,V,R,m,D,ve,Ce,N,V,B,b,U,C,w,y,E,S,k,R,P,D,M,ae,N,V,Fe,ve,Ce,tA,Le,we,nA,Ye,Ie,it,We;return xe(this,function(oe){switch(oe.label){case 0:if(l.type!==0)return[3,5];u=void 0,d=l.url,oe.label=1;case 1:return oe.trys.push([1,3,,4]),[4,r.context.cache.match(d)];case 2:return u=oe.sent(),[3,4];case 3:return oe.sent(),r.context.logger.error("Error loading background-image ".concat(d)),[3,4];case 4:return u&&(h=isNaN(u.width)||u.width===0?1:u.width,g=isNaN(u.height)||u.height===0?1:u.height,f=Fs(A,n,[h,g,h/g]),D=f[0],ve=f[1],Ce=f[2],N=f[3],V=f[4],R=r.ctx.createPattern(r.resizeImage(u,N,V),"repeat"),r.renderRepeat(D,R,ve,Ce)),[3,6];case 5:nm(l)?(m=Fs(A,n,[null,null,null]),D=m[0],ve=m[1],Ce=m[2],N=m[3],V=m[4],B=Zp(l.angle,N,V),b=B[0],U=B[1],C=B[2],w=B[3],y=B[4],E=document.createElement("canvas"),E.width=N,E.height=V,S=E.getContext("2d"),k=S.createLinearGradient(U,w,C,y),uc(l.stops,b||1).forEach(function(Je){return k.addColorStop(Je.stop,Ue(Je.color))}),S.fillStyle=k,S.fillRect(0,0,N,V),N>0&&V>0&&(R=r.ctx.createPattern(E,"repeat"),r.renderRepeat(D,R,ve,Ce))):im(l)&&(P=Fs(A,n,[null,null,null]),D=P[0],M=P[1],ae=P[2],N=P[3],V=P[4],Fe=l.position.length===0?[zr]:l.position,ve=$(Fe[0],N),Ce=$(Fe[Fe.length-1],V),tA=$p(l,ve,Ce,N,V),Le=tA[0],we=tA[1],Le>0&&we>0&&(nA=r.ctx.createRadialGradient(M+ve,ae+Ce,0,M+ve,ae+Ce,Le),uc(l.stops,Le*2).forEach(function(Je){return nA.addColorStop(Je.stop,Ue(Je.color))}),r.path(D),r.ctx.fillStyle=nA,Le!==we?(Ye=A.bounds.left+.5*A.bounds.width,Ie=A.bounds.top+.5*A.bounds.height,it=we/Le,We=1/it,r.ctx.save(),r.ctx.translate(Ye,Ie),r.ctx.transform(1,0,0,it,0,0),r.ctx.translate(-Ye,-Ie),r.ctx.fillRect(M,We*(ae-Ie)+Ie,N,V*We),r.ctx.restore()):r.ctx.fill())),oe.label=6;case 6:return n--,[2]}})},r=this,s=0,a=A.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return s<a.length?(o=a[s],[5,i(o)]):[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(A,n,i){return Re(this,void 0,void 0,function(){return xe(this,function(r){return this.path(vl(i,n)),this.ctx.fillStyle=Ue(A),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(A,n,i,r){return Re(this,void 0,void 0,function(){var s,a;return xe(this,function(o){switch(o.label){case 0:return n<3?[4,this.renderSolidBorder(A,i,r)]:[3,2];case 1:return o.sent(),[2];case 2:return s=lv(r,i),this.path(s),this.ctx.fillStyle=Ue(A),this.ctx.fill(),a=uv(r,i),this.path(a),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(A){return Re(this,void 0,void 0,function(){var n,i,r,s,a,o,c,l,u=this;return xe(this,function(d){switch(d.label){case 0:return this.applyEffects(A.getEffects(2)),n=A.container.styles,i=!NA(n.backgroundColor)||n.backgroundImage.length,r=[{style:n.borderTopStyle,color:n.borderTopColor,width:n.borderTopWidth},{style:n.borderRightStyle,color:n.borderRightColor,width:n.borderRightWidth},{style:n.borderBottomStyle,color:n.borderBottomColor,width:n.borderBottomWidth},{style:n.borderLeftStyle,color:n.borderLeftColor,width:n.borderLeftWidth}],s=bv(_t(n.backgroundClip,0),A.curves),i||n.boxShadow.length?(this.ctx.save(),this.path(s),this.ctx.clip(),NA(n.backgroundColor)||(this.ctx.fillStyle=Ue(n.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(A.container)]):[3,2];case 1:d.sent(),this.ctx.restore(),n.boxShadow.slice(0).reverse().forEach(function(h){u.ctx.save();var g=Fi(A.curves),f=h.inset?0:vv,m=ov(g,-f+(h.inset?1:-1)*h.spread.number,(h.inset?1:-1)*h.spread.number,h.spread.number*(h.inset?-2:2),h.spread.number*(h.inset?-2:2));h.inset?(u.path(g),u.ctx.clip(),u.mask(m)):(u.mask(g),u.ctx.clip(),u.path(m)),u.ctx.shadowOffsetX=h.offsetX.number+f,u.ctx.shadowOffsetY=h.offsetY.number,u.ctx.shadowColor=Ue(h.color),u.ctx.shadowBlur=h.blur.number,u.ctx.fillStyle=h.inset?Ue(h.color):"rgba(0,0,0,1)",u.ctx.fill(),u.ctx.restore()}),d.label=2;case 2:a=0,o=0,c=r,d.label=3;case 3:return o<c.length?(l=c[o],l.style!==0&&!NA(l.color)&&l.width>0?l.style!==2?[3,5]:[4,this.renderDashedDottedBorder(l.color,l.width,a,A.curves,2)]:[3,11]):[3,13];case 4:return d.sent(),[3,11];case 5:return l.style!==3?[3,7]:[4,this.renderDashedDottedBorder(l.color,l.width,a,A.curves,3)];case 6:return d.sent(),[3,11];case 7:return l.style!==4?[3,9]:[4,this.renderDoubleBorder(l.color,l.width,a,A.curves)];case 8:return d.sent(),[3,11];case 9:return[4,this.renderSolidBorder(l.color,a,A.curves)];case 10:d.sent(),d.label=11;case 11:a++,d.label=12;case 12:return o++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(A,n,i,r,s){return Re(this,void 0,void 0,function(){var a,o,c,l,u,d,h,g,f,m,B,b,U,C,w,y,w,y;return xe(this,function(E){return this.ctx.save(),a=dv(r,i),o=vl(r,i),s===2&&(this.path(o),this.ctx.clip()),$e(o[0])?(c=o[0].start.x,l=o[0].start.y):(c=o[0].x,l=o[0].y),$e(o[1])?(u=o[1].end.x,d=o[1].end.y):(u=o[1].x,d=o[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(l-d),this.ctx.beginPath(),s===3?this.formatPath(a):this.formatPath(o.slice(0,2)),g=n<3?n*3:n*2,f=n<3?n*2:n,s===3&&(g=n,f=n),m=!0,h<=g*2?m=!1:h<=g*2+f?(B=h/(2*g+f),g*=B,f*=B):(b=Math.floor((h+f)/(g+f)),U=(h-b*g)/(b-1),C=(h-(b+1)*g)/b,f=C<=0||Math.abs(f-U)<Math.abs(f-C)?U:C),m&&(s===3?this.ctx.setLineDash([0,g+f]):this.ctx.setLineDash([g,f])),s===3?(this.ctx.lineCap="round",this.ctx.lineWidth=n):this.ctx.lineWidth=n*2+1.1,this.ctx.strokeStyle=Ue(A),this.ctx.stroke(),this.ctx.setLineDash([]),s===2&&($e(o[0])&&(w=o[3],y=o[0],this.ctx.beginPath(),this.formatPath([new H(w.end.x,w.end.y),new H(y.start.x,y.start.y)]),this.ctx.stroke()),$e(o[1])&&(w=o[1],y=o[2],this.ctx.beginPath(),this.formatPath([new H(w.end.x,w.end.y),new H(y.start.x,y.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(A){return Re(this,void 0,void 0,function(){var n;return xe(this,function(i){switch(i.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=Ue(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),n=cv(A),[4,this.renderStack(n)];case 1:return i.sent(),this.applyEffects([]),[2,this.canvas]}})})},e}(bl),wv=function(t){return t instanceof Jc||t instanceof Wc?!0:t instanceof Bs&&t.type!==Ui&&t.type!==yi},bv=function(t,e){switch(t){case 0:return Fi(e);case 2:return nv(e);case 1:default:return Ii(e)}},yv=function(t){switch(t){case 1:return"center";case 2:return"right";case 0:default:return"left"}},Uv=["-apple-system","system-ui"],Qv=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(e){return Uv.indexOf(e)===-1}):t},Ev=function(t){iA(e,t);function e(A,n){var i=t.call(this,A,n)||this;return i.canvas=n.canvas?n.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),i.options=n,i.canvas.width=Math.floor(n.width*n.scale),i.canvas.height=Math.floor(n.height*n.scale),i.canvas.style.width="".concat(n.width,"px"),i.canvas.style.height="".concat(n.height,"px"),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-n.x,-n.y),i.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (".concat(n.width,"x").concat(n.height," at ").concat(n.x,",").concat(n.y,") with scale ").concat(n.scale)),i}return e.prototype.render=function(A){return Re(this,void 0,void 0,function(){var n,i;return xe(this,function(r){switch(r.label){case 0:return n=gs(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,A),[4,Sv(n)];case 1:return i=r.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=Ue(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(i,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})},e}(bl),Sv=function(t){return new Promise(function(e,A){var n=new Image;n.onload=function(){e(n)},n.onerror=A,n.src="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(t)))})},kv=function(){function t(e){var A=e.id,n=e.enabled;this.id=A,this.enabled=n,this.start=Date.now()}return t.prototype.debug=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console?(()=>{}).apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.prototype.getTime=function(){return Date.now()-this.start},t.prototype.info=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&typeof window<"u"&&window.console&&typeof console.info=="function"&&console.info.apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1))},t.prototype.warn=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.warn=="function"?console.warn.apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.prototype.error=function(){for(var e=[],A=0;A<arguments.length;A++)e[A]=arguments[A];this.enabled&&(typeof window<"u"&&window.console&&typeof console.error=="function"?console.error.apply(console,Dn([this.id,"".concat(this.getTime(),"ms")],e,!1)):this.info.apply(this,e))},t.instances={},t}(),Tv=function(){function t(e,A){var n;this.windowBounds=A,this.instanceName="#".concat(t.instanceCount++),this.logger=new kv({id:this.instanceName,enabled:e.logging}),this.cache=(n=e.cache)!==null&&n!==void 0?n:new qB(this,e)}return t.instanceCount=1,t}(),Fv=function(t,e){return e===void 0&&(e={}),Iv(t,e)};typeof window<"u"&&Es.setContext(window);var Iv=function(t,e){return Re(void 0,void 0,void 0,function(){var A,n,i,r,s,a,o,c,l,u,d,h,g,f,m,B,b,U,C,w,E,y,E,S,k,R,P,D,M,ae,N,V,Fe,ve,Ce,tA,Le,we,nA,Ye;return xe(this,function(Ie){switch(Ie.label){case 0:if(!t||typeof t!="object")return[2,Promise.reject("Invalid element provided as first argument")];if(A=t.ownerDocument,!A)throw new Error("Element is not attached to a Document");if(n=A.defaultView,!n)throw new Error("Document is not attached to a Window");return i={allowTaint:(S=e.allowTaint)!==null&&S!==void 0?S:!1,imageTimeout:(k=e.imageTimeout)!==null&&k!==void 0?k:15e3,proxy:e.proxy,useCORS:(R=e.useCORS)!==null&&R!==void 0?R:!1,customIsSameOrigin:e.customIsSameOrigin},r=Fr({logging:(P=e.logging)!==null&&P!==void 0?P:!0,cache:e.cache},i),s={windowWidth:(D=e.windowWidth)!==null&&D!==void 0?D:n.innerWidth,windowHeight:(M=e.windowHeight)!==null&&M!==void 0?M:n.innerHeight,scrollX:(ae=e.scrollX)!==null&&ae!==void 0?ae:n.pageXOffset,scrollY:(N=e.scrollY)!==null&&N!==void 0?N:n.pageYOffset},a=new EA(s.scrollX,s.scrollY,s.windowWidth,s.windowHeight),o=new Tv(r,a),c=(V=e.foreignObjectRendering)!==null&&V!==void 0?V:!1,l={allowTaint:(Fe=e.allowTaint)!==null&&Fe!==void 0?Fe:!1,onclone:e.onclone,ignoreElements:e.ignoreElements,inlineImages:c,copyStyles:c},o.logger.debug("Starting document clone with size ".concat(a.width,"x").concat(a.height," scrolled to ").concat(-a.left,",").concat(-a.top)),u=new dl(o,t,l),d=u.clonedReferenceElement,d?[4,u.toIFrame(A,a)]:[2,Promise.reject("Unable to find element in cloned iframe")];case 1:return h=Ie.sent(),g=Cs(d)||IB(d)?hf(d.ownerDocument):Hn(o,d),f=g.width,m=g.height,B=g.left,b=g.top,U=xv(o,d,e.backgroundColor),C={canvas:e.canvas,backgroundColor:U,scale:(Ce=(ve=e.scale)!==null&&ve!==void 0?ve:n.devicePixelRatio)!==null&&Ce!==void 0?Ce:1,x:((tA=e.x)!==null&&tA!==void 0?tA:0)+B,y:((Le=e.y)!==null&&Le!==void 0?Le:0)+b,width:(we=e.width)!==null&&we!==void 0?we:Math.ceil(f),height:(nA=e.height)!==null&&nA!==void 0?nA:Math.ceil(m)},c?(o.logger.debug("Document cloned, using foreign object rendering"),E=new Ev(o,C),[4,E.render(d)]):[3,3];case 2:return w=Ie.sent(),[3,5];case 3:return o.logger.debug("Document cloned, element located at ".concat(B,",").concat(b," with size ").concat(f,"x").concat(m," using computed rendering")),o.logger.debug("Starting DOM parsing"),y=Yc(o,d),U===y.styles.backgroundColor&&(y.styles.backgroundColor=vA.TRANSPARENT),o.logger.debug("Starting renderer for element at ".concat(C.x,",").concat(C.y," with size ").concat(C.width,"x").concat(C.height)),E=new Cv(o,C),[4,E.render(y)];case 4:w=Ie.sent(),Ie.label=5;case 5:return(!((Ye=e.removeContainer)!==null&&Ye!==void 0)||Ye)&&(dl.destroy(h)||o.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")),o.logger.debug("Finished rendering"),[2,w]}})})},xv=function(t,e,A){var n=e.ownerDocument,i=n.documentElement?Et(t,getComputedStyle(n.documentElement).backgroundColor):vA.TRANSPARENT,r=n.body?Et(t,getComputedStyle(n.body).backgroundColor):vA.TRANSPARENT,s=typeof A=="string"?Et(t,A):A===null?vA.TRANSPARENT:4294967295;return e===n.documentElement?NA(i)?NA(r)?s:r:i:s};function _v(t,e){return e.forEach(function(A){A&&typeof A!="string"&&!Array.isArray(A)&&Object.keys(A).forEach(function(n){if(n!=="default"&&!(n in t)){var i=Object.getOwnPropertyDescriptor(A,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return A[n]}})}})}),Object.freeze(t)}var Pv=Object.defineProperty,Rv=(t,e,A)=>e in t?Pv(t,e,{enumerable:!0,configurable:!0,writable:!0,value:A}):t[e]=A,yl=(t,e,A)=>Rv(t,typeof e!="symbol"?e+"":e,A);let Oe=class{constructor(){yl(this,"_locking"),yl(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const A=new Promise(i=>e=()=>{this._locks-=1,i()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>A),n}};function le(t,e){if(!t)throw new Error(e)}const Lv=34028234663852886e22,Dv=-34028234663852886e22,Hv=4294967295,Ov=2147483647,Mv=-2147483648;function Li(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>Ov||t<Mv)throw new Error("invalid int 32: "+t)}function Is(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>Hv||t<0)throw new Error("invalid uint 32: "+t)}function Ul(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>Lv||t<Dv))throw new Error("invalid float 32: "+t)}const Ql=Symbol("@bufbuild/protobuf/enum-type");function Nv(t){const e=t[Ql];return le(e,"missing enum type on enum object"),e}function El(t,e,A,n){t[Ql]=Sl(e,A.map(i=>({no:i.no,name:i.name,localName:t[i.no]})))}function Sl(t,e,A){const n=Object.create(null),i=Object.create(null),r=[];for(const s of e){const a=kl(s);r.push(a),n[s.name]=a,i[s.no]=a}return{typeName:t,values:r,findName(s){return n[s]},findNumber(s){return i[s]}}}function Kv(t,e,A){const n={};for(const i of e){const r=kl(i);n[r.localName]=r.no,n[r.no]=r.localName}return El(n,t,e),n}function kl(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class xs{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,A){const n=this.getType(),i=n.runtime.bin,r=i.makeReadOptions(A);return i.readMessage(this,r.readerFactory(e),e.byteLength,r),this}fromJson(e,A){const n=this.getType(),i=n.runtime.json,r=i.makeReadOptions(A);return i.readMessage(n,e,r,this),this}fromJsonString(e,A){let n;try{n=JSON.parse(e)}catch(i){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(i instanceof Error?i.message:String(i)))}return this.fromJson(n,A)}toBinary(e){const A=this.getType(),n=A.runtime.bin,i=n.makeWriteOptions(e),r=i.writerFactory();return n.writeMessage(this,r,i),r.finish()}toJson(e){const A=this.getType(),n=A.runtime.json,i=n.makeWriteOptions(e);return n.writeMessage(this,i)}toJsonString(e){var A;const n=this.toJson(e);return JSON.stringify(n,null,(A=e==null?void 0:e.prettySpaces)!==null&&A!==void 0?A:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function Vv(t,e,A,n){var i;const r=(i=n==null?void 0:n.localName)!==null&&i!==void 0?i:e.substring(e.lastIndexOf(".")+1),s={[r]:function(a){t.util.initFields(this),t.util.initPartial(a,this)}}[r];return Object.setPrototypeOf(s.prototype,new xs),Object.assign(s,{runtime:t,typeName:e,fields:t.util.newFieldList(A),fromBinary(a,o){return new s().fromBinary(a,o)},fromJson(a,o){return new s().fromJson(a,o)},fromJsonString(a,o){return new s().fromJsonString(a,o)},equals(a,o){return t.util.equals(s,a,o)}}),s}function Gv(){let t=0,e=0;for(let n=0;n<28;n+=7){let i=this.buf[this.pos++];if(t|=(i&127)<<n,!(i&128))return this.assertBounds(),[t,e]}let A=this.buf[this.pos++];if(t|=(A&15)<<28,e=(A&112)>>4,!(A&128))return this.assertBounds(),[t,e];for(let n=3;n<=31;n+=7){let i=this.buf[this.pos++];if(e|=(i&127)<<n,!(i&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function _s(t,e,A){for(let r=0;r<28;r=r+7){const s=t>>>r,a=!(!(s>>>7)&&e==0),o=(a?s|128:s)&255;if(A.push(o),!a)return}const n=t>>>28&15|(e&7)<<4,i=!!(e>>3);if(A.push((i?n|128:n)&255),!!i){for(let r=3;r<31;r=r+7){const s=e>>>r,a=!!(s>>>7),o=(a?s|128:s)&255;if(A.push(o),!a)return}A.push(e>>>31&1)}}const Di=4294967296;function Tl(t){const e=t[0]==="-";e&&(t=t.slice(1));const A=1e6;let n=0,i=0;function r(s,a){const o=Number(t.slice(s,a));i*=A,n=n*A+o,n>=Di&&(i=i+(n/Di|0),n=n%Di)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),e?Il(n,i):Ps(n,i)}function jv(t,e){let A=Ps(t,e);const n=A.hi&2147483648;n&&(A=Il(A.lo,A.hi));const i=Fl(A.lo,A.hi);return n?"-"+i:i}function Fl(t,e){if({lo:t,hi:e}=Wv(t,e),e<=2097151)return String(Di*e+t);const A=t&16777215,n=(t>>>24|e<<8)&16777215,i=e>>16&65535;let r=A+n*6777216+i*6710656,s=n+i*8147497,a=i*2;const o=1e7;return r>=o&&(s+=Math.floor(r/o),r%=o),s>=o&&(a+=Math.floor(s/o),s%=o),a.toString()+xl(s)+xl(r)}function Wv(t,e){return{lo:t>>>0,hi:e>>>0}}function Ps(t,e){return{lo:t|0,hi:e|0}}function Il(t,e){return e=~e,t?t=~t+1:e+=1,Ps(t,e)}const xl=t=>{const e=String(t);return"0000000".slice(e.length)+e};function _l(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let A=0;A<9;A++)e.push(t&127|128),t=t>>7;e.push(1)}}function Jv(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let A=5;t&128&&A<10;A++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function Xv(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){const i=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),s=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(o){const c=typeof o=="bigint"?o:BigInt(o);if(c>r||c<i)throw new Error("int64 invalid: ".concat(o));return c},uParse(o){const c=typeof o=="bigint"?o:BigInt(o);if(c>a||c<s)throw new Error("uint64 invalid: ".concat(o));return c},enc(o){return t.setBigInt64(0,this.parse(o),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(o){return t.setBigInt64(0,this.uParse(o),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(o,c){return t.setInt32(0,o,!0),t.setInt32(4,c,!0),t.getBigInt64(0,!0)},uDec(o,c){return t.setInt32(0,o,!0),t.setInt32(4,c,!0),t.getBigUint64(0,!0)}}}const A=i=>le(/^-?[0-9]+$/.test(i),"int64 invalid: ".concat(i)),n=i=>le(/^[0-9]+$/.test(i),"uint64 invalid: ".concat(i));return{zero:"0",supported:!1,parse(i){return typeof i!="string"&&(i=i.toString()),A(i),i},uParse(i){return typeof i!="string"&&(i=i.toString()),n(i),i},enc(i){return typeof i!="string"&&(i=i.toString()),A(i),Tl(i)},uEnc(i){return typeof i!="string"&&(i=i.toString()),n(i),Tl(i)},dec(i,r){return jv(i,r)},uDec(i,r){return Fl(i,r)}}}const re=Xv();var T;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(T||(T={}));var WA;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(WA||(WA={}));function JA(t,e,A){if(e===A)return!0;if(t==T.BYTES){if(!(e instanceof Uint8Array)||!(A instanceof Uint8Array)||e.length!==A.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==A[n])return!1;return!0}switch(t){case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return e==A}return!1}function Pt(t,e){switch(t){case T.BOOL:return!1;case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return e==0?re.zero:"0";case T.DOUBLE:case T.FLOAT:return 0;case T.BYTES:return new Uint8Array(0);case T.STRING:return"";default:return 0}}function Pl(t,e){switch(t){case T.BOOL:return e===!1;case T.STRING:return e==="";case T.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var ge;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(ge||(ge={}));class qv{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let i=0;i<this.chunks.length;i++)e+=this.chunks[i].length;let A=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)A.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],A}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),A=this.stack.pop();if(!A)throw new Error("invalid state, fork stack empty");return this.chunks=A.chunks,this.buf=A.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,A){return this.uint32((e<<3|A)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Is(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Li(e),_l(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let A=this.textEncoder.encode(e);return this.uint32(A.byteLength),this.raw(A)}float(e){Ul(e);let A=new Uint8Array(4);return new DataView(A.buffer).setFloat32(0,e,!0),this.raw(A)}double(e){let A=new Uint8Array(8);return new DataView(A.buffer).setFloat64(0,e,!0),this.raw(A)}fixed32(e){Is(e);let A=new Uint8Array(4);return new DataView(A.buffer).setUint32(0,e,!0),this.raw(A)}sfixed32(e){Li(e);let A=new Uint8Array(4);return new DataView(A.buffer).setInt32(0,e,!0),this.raw(A)}sint32(e){return Li(e),e=(e<<1^e>>31)>>>0,_l(e,this.buf),this}sfixed64(e){let A=new Uint8Array(8),n=new DataView(A.buffer),i=re.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(A)}fixed64(e){let A=new Uint8Array(8),n=new DataView(A.buffer),i=re.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(A)}int64(e){let A=re.enc(e);return _s(A.lo,A.hi,this.buf),this}sint64(e){let A=re.enc(e),n=A.hi>>31,i=A.lo<<1^n,r=(A.hi<<1|A.lo>>>31)^n;return _s(i,r,this.buf),this}uint64(e){let A=re.uEnc(e);return _s(A.lo,A.hi,this.buf),this}}class Yv{constructor(e,A){this.varint64=Gv,this.uint32=Jv,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=A??new TextDecoder}tag(){let e=this.uint32(),A=e>>>3,n=e&7;if(A<=0||n<0||n>5)throw new Error("illegal tag: field no "+A+" wire type "+n);return[A,n]}skip(e,A){let n=this.pos;switch(e){case ge.Varint:for(;this.buf[this.pos++]&128;);break;case ge.Bit64:this.pos+=4;case ge.Bit32:this.pos+=4;break;case ge.LengthDelimited:let i=this.uint32();this.pos+=i;break;case ge.StartGroup:for(;;){const[r,s]=this.tag();if(s===ge.EndGroup){if(A!==void 0&&r!==A)throw new Error("invalid end group tag");break}this.skip(s,r)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return re.dec(...this.varint64())}uint64(){return re.uDec(...this.varint64())}sint64(){let[e,A]=this.varint64(),n=-(e&1);return e=(e>>>1|(A&1)<<31)^n,A=A>>>1^n,re.dec(e,A)}bool(){let[e,A]=this.varint64();return e!==0||A!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return re.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return re.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),A=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(A,A+e)}string(){return this.textDecoder.decode(this.bytes())}}function zv(t,e,A,n){let i;return{typeName:e,extendee:A,get field(){if(!i){const r=typeof n=="function"?n():n;r.name=e.split(".").pop(),r.jsonName="[".concat(e,"]"),i=t.util.newFieldList([r]).list()[0]}return i},runtime:t}}function Rl(t){const e=t.field.localName,A=Object.create(null);return A[e]=Zv(t),[A,()=>A[e]]}function Zv(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return Pt(e.T,e.L);case"message":const A=e.T,n=new A;return A.fieldWrapper?A.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}function $v(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let A=t.length-1;A>=0;--A)if(t[A].no==e.no)return[t[A]];return[]}return t.filter(A=>A.no===e.no)}let TA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Hi=[];for(let t=0;t<TA.length;t++)Hi[TA[t].charCodeAt(0)]=t;Hi["-".charCodeAt(0)]=TA.indexOf("+"),Hi["_".charCodeAt(0)]=TA.indexOf("/");const Ll={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let A=new Uint8Array(e),n=0,i=0,r,s=0;for(let a=0;a<t.length;a++){if(r=Hi[t.charCodeAt(a)],r===void 0)switch(t[a]){case"=":i=0;case`
10
+ `:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string.")}switch(i){case 0:s=r,i=1;break;case 1:A[n++]=s<<2|(r&48)>>4,s=r,i=2;break;case 2:A[n++]=(s&15)<<4|(r&60)>>2,s=r,i=3;break;case 3:A[n++]=(s&3)<<6|r,i=0;break}}if(i==1)throw Error("invalid base64 string.");return A.subarray(0,n)},enc(t){let e="",A=0,n,i=0;for(let r=0;r<t.length;r++)switch(n=t[r],A){case 0:e+=TA[n>>2],i=(n&3)<<4,A=1;break;case 1:e+=TA[i|n>>4],i=(n&15)<<2,A=2;break;case 2:e+=TA[i|n>>6],e+=TA[n&63],A=0;break}return A&&(e+=TA[i],e+="=",A==1&&(e+="=")),e}};function eC(t,e,A){Hl(e,t);const n=e.runtime.bin.makeReadOptions(A),i=$v(t.getType().runtime.bin.listUnknownFields(t),e.field),[r,s]=Rl(e);for(const a of i)e.runtime.bin.readField(r,n.readerFactory(a.data),e.field,a.wireType,n);return s()}function AC(t,e,A,n){Hl(e,t);const i=e.runtime.bin.makeReadOptions(n),r=e.runtime.bin.makeWriteOptions(n);if(Dl(t,e)){const c=t.getType().runtime.bin.listUnknownFields(t).filter(l=>l.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const l of c)t.getType().runtime.bin.onUnknownField(t,l.no,l.wireType,l.data)}const s=r.writerFactory();let a=e.field;!a.opt&&!a.repeated&&(a.kind=="enum"||a.kind=="scalar")&&(a=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(a,A,s,r);const o=i.readerFactory(s.finish());for(;o.pos<o.len;){const[c,l]=o.tag(),u=o.skip(l,c);t.getType().runtime.bin.onUnknownField(t,c,l,u)}}function Dl(t,e){const A=t.getType();return e.extendee.typeName===A.typeName&&!!A.runtime.bin.listUnknownFields(t).find(n=>n.no==e.field.no)}function Hl(t,e){le(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function Ol(t,e){const A=t.localName;if(t.repeated)return e[A].length>0;if(t.oneof)return e[t.oneof.localName].case===A;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[A]!==void 0:t.kind=="enum"?e[A]!==t.T.values[0].no:!Pl(t.T,e[A]);case"message":return e[A]!==void 0;case"map":return Object.keys(e[A]).length>0}}function Ml(t,e){const A=t.localName,n=!t.opt&&!t.req;if(t.repeated)e[A]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[A]={};break;case"enum":e[A]=n?t.T.values[0].no:void 0;break;case"scalar":e[A]=n?Pt(t.T,t.L):void 0;break;case"message":e[A]=void 0;break}}function dt(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(xs.prototype).every(n=>n in t&&typeof t[n]=="function"))return!1;const A=t.getType();return A===null||typeof A!="function"||!("typeName"in A)||typeof A.typeName!="string"?!1:e===void 0?!0:A.typeName==e.typeName}function Nl(t,e){return dt(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}T.DOUBLE,T.FLOAT,T.INT64,T.UINT64,T.INT32,T.UINT32,T.BOOL,T.STRING,T.BYTES;const Kl={ignoreUnknownFields:!1},Vl={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function tC(t){return t?Object.assign(Object.assign({},Kl),t):Kl}function nC(t){return t?Object.assign(Object.assign({},Vl),t):Vl}const Oi=Symbol(),Mi=Symbol();function iC(){return{makeReadOptions:tC,makeWriteOptions:nC,readMessage(t,e,A,n){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(wA(e)));n=n??new t;const i=new Map,r=A.typeRegistry;for(const[s,a]of Object.entries(e)){const o=t.fields.findJsonName(s);if(o){if(o.oneof){if(a===null&&o.kind=="scalar")continue;const c=i.get(o.oneof);if(c!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(o.oneof.name,'" present: "').concat(c,'", "').concat(s,'"'));i.set(o.oneof,s)}Gl(n,a,o,A,t)}else{let c=!1;if(r!=null&&r.findExtension&&s.startsWith("[")&&s.endsWith("]")){const l=r.findExtension(s.substring(1,s.length-1));if(l&&l.extendee.typeName==t.typeName){c=!0;const[u,d]=Rl(l);Gl(u,a,l.field,A,l),AC(n,l,d(),A)}}if(!c&&!A.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(s,'" is unknown'))}}return n},writeMessage(t,e){const A=t.getType(),n={};let i;try{for(i of A.fields.byNumber()){if(!Ol(i,t)){if(i.req)throw"required field not set";if(!e.emitDefaultValues||!sC(i))continue}const s=i.oneof?t[i.oneof.localName].value:t[i.localName],a=jl(i,s,e);a!==void 0&&(n[e.useProtoFieldName?i.name:i.jsonName]=a)}const r=e.typeRegistry;if(r!=null&&r.findExtensionFor)for(const s of A.runtime.bin.listUnknownFields(t)){const a=r.findExtensionFor(A.typeName,s.no);if(a&&Dl(t,a)){const o=eC(t,a,e),c=jl(a.field,o,e);c!==void 0&&(n[a.field.jsonName]=c)}}}catch(r){const s=i?"cannot encode field ".concat(A.typeName,".").concat(i.name," to JSON"):"cannot encode message ".concat(A.typeName," to JSON"),a=r instanceof Error?r.message:String(r);throw new Error(s+(a.length>0?": ".concat(a):""))}return n},readScalar(t,e,A){return Cn(t,e,A??WA.BIGINT,!0)},writeScalar(t,e,A){if(e!==void 0&&(A||Pl(t,e)))return Ni(t,e)},debug:wA}}function wA(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function Gl(t,e,A,n,i){let r=A.localName;if(A.repeated){if(le(A.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e)));const s=t[r];for(const a of e){if(a===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(a)));switch(A.kind){case"message":s.push(A.T.fromJson(a,n));break;case"enum":const o=Rs(A.T,a,n.ignoreUnknownFields,!0);o!==Mi&&s.push(o);break;case"scalar":try{s.push(Cn(A.T,a,A.L,!0))}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(a));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}}else if(A.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e)));const s=t[r];for(const[a,o]of Object.entries(e)){if(o===null)throw new Error("cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: map value null"));let c;try{c=rC(A.K,a)}catch(l){let u="cannot decode map key for field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e));throw l instanceof Error&&l.message.length>0&&(u+=": ".concat(l.message)),new Error(u)}switch(A.V.kind){case"message":s[c]=A.V.T.fromJson(o,n);break;case"enum":const l=Rs(A.V.T,o,n.ignoreUnknownFields,!0);l!==Mi&&(s[c]=l);break;case"scalar":try{s[c]=Cn(A.V.T,o,WA.BIGINT,!0)}catch(u){let d="cannot decode map value for field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e));throw u instanceof Error&&u.message.length>0&&(d+=": ".concat(u.message)),new Error(d)}break}}}else switch(A.oneof&&(t=t[A.oneof.localName]={case:r},r="value"),A.kind){case"message":const s=A.T;if(e===null&&s.typeName!="google.protobuf.Value")return;let a=t[r];dt(a)?a.fromJson(e,n):(t[r]=a=s.fromJson(e,n),s.fieldWrapper&&!A.oneof&&(t[r]=s.fieldWrapper.unwrapField(a)));break;case"enum":const o=Rs(A.T,e,n.ignoreUnknownFields,!1);switch(o){case Oi:Ml(A,t);break;case Mi:break;default:t[r]=o;break}break;case"scalar":try{const c=Cn(A.T,e,A.L,!1);switch(c){case Oi:Ml(A,t);break;default:t[r]=c;break}}catch(c){let l="cannot decode field ".concat(i.typeName,".").concat(A.name," from JSON: ").concat(wA(e));throw c instanceof Error&&c.message.length>0&&(l+=": ".concat(c.message)),new Error(l)}break}}function rC(t,e){if(t===T.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return Cn(t,e,WA.BIGINT,!0).toString()}function Cn(t,e,A,n){if(e===null)return n?Pt(t,A):Oi;switch(t){case T.DOUBLE:case T.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const i=Number(e);if(Number.isNaN(i)||!Number.isFinite(i))break;return t==T.FLOAT&&Ul(i),i;case T.INT32:case T.FIXED32:case T.SFIXED32:case T.SINT32:case T.UINT32:let r;if(typeof e=="number"?r=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(r=Number(e)),r===void 0)break;return t==T.UINT32||t==T.FIXED32?Is(r):Li(r),r;case T.INT64:case T.SFIXED64:case T.SINT64:if(typeof e!="number"&&typeof e!="string")break;const s=re.parse(e);return A?s.toString():s;case T.FIXED64:case T.UINT64:if(typeof e!="number"&&typeof e!="string")break;const a=re.uParse(e);return A?a.toString():a;case T.BOOL:if(typeof e!="boolean")break;return e;case T.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case T.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return Ll.dec(e)}throw new Error}function Rs(t,e,A,n){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:n?t.values[0].no:Oi;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const i=t.findName(e);if(i!==void 0)return i.no;if(A)return Mi;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(wA(e)))}function sC(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function jl(t,e,A){if(t.kind=="map"){le(typeof e=="object"&&e!=null);const n={},i=Object.entries(e);switch(t.V.kind){case"scalar":for(const[s,a]of i)n[s.toString()]=Ni(t.V.T,a);break;case"message":for(const[s,a]of i)n[s.toString()]=a.toJson(A);break;case"enum":const r=t.V.T;for(const[s,a]of i)n[s.toString()]=Ls(r,a,A.enumAsInteger);break}return A.emitDefaultValues||i.length>0?n:void 0}if(t.repeated){le(Array.isArray(e));const n=[];switch(t.kind){case"scalar":for(let i=0;i<e.length;i++)n.push(Ni(t.T,e[i]));break;case"enum":for(let i=0;i<e.length;i++)n.push(Ls(t.T,e[i],A.enumAsInteger));break;case"message":for(let i=0;i<e.length;i++)n.push(e[i].toJson(A));break}return A.emitDefaultValues||n.length>0?n:void 0}switch(t.kind){case"scalar":return Ni(t.T,e);case"enum":return Ls(t.T,e,A.enumAsInteger);case"message":return Nl(t.T,e).toJson(A)}}function Ls(t,e,A){var n;if(le(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(A)return e;const i=t.findNumber(e);return(n=i==null?void 0:i.name)!==null&&n!==void 0?n:e}function Ni(t,e){switch(t){case T.INT32:case T.SFIXED32:case T.SINT32:case T.FIXED32:case T.UINT32:return le(typeof e=="number"),e;case T.FLOAT:case T.DOUBLE:return le(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case T.STRING:return le(typeof e=="string"),e;case T.BOOL:return le(typeof e=="boolean"),e;case T.UINT64:case T.FIXED64:case T.INT64:case T.SFIXED64:case T.SINT64:return le(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case T.BYTES:return le(e instanceof Uint8Array),Ll.enc(e)}}const Rt=Symbol("@bufbuild/protobuf/unknown-fields"),Wl={readUnknownFields:!0,readerFactory:t=>new Yv(t)},Jl={writeUnknownFields:!0,writerFactory:()=>new qv};function aC(t){return t?Object.assign(Object.assign({},Wl),t):Wl}function oC(t){return t?Object.assign(Object.assign({},Jl),t):Jl}function cC(){return{makeReadOptions:aC,makeWriteOptions:oC,listUnknownFields(t){var e;return(e=t[Rt])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Rt]},writeUnknownFields(t,e){const n=t[Rt];if(n)for(const i of n)e.tag(i.no,i.wireType).raw(i.data)},onUnknownField(t,e,A,n){const i=t;Array.isArray(i[Rt])||(i[Rt]=[]),i[Rt].push({no:e,wireType:A,data:n})},readMessage(t,e,A,n,i){const r=t.getType(),s=i?e.len:e.pos+A;let a,o;for(;e.pos<s&&([a,o]=e.tag(),!(i===!0&&o==ge.EndGroup));){const c=r.fields.find(a);if(!c){const l=e.skip(o,a);n.readUnknownFields&&this.onUnknownField(t,a,o,l);continue}Xl(t,e,c,o,n)}if(i&&(o!=ge.EndGroup||a!==A))throw new Error("invalid end group tag")},readField:Xl,writeMessage(t,e,A){const n=t.getType();for(const i of n.fields.byNumber()){if(!Ol(i,t)){if(i.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(i.name," to binary: required field not set"));continue}const r=i.oneof?t[i.oneof.localName].value:t[i.localName];ql(i,r,e,A)}return A.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,A,n){e!==void 0&&ql(t,e,A,n)}}}function Xl(t,e,A,n,i){let{repeated:r,localName:s}=A;switch(A.oneof&&(t=t[A.oneof.localName],t.case!=s&&delete t.value,t.case=s,s="value"),A.kind){case"scalar":case"enum":const a=A.kind=="enum"?T.INT32:A.T;let o=Vi;if(A.kind=="scalar"&&A.L>0&&(o=uC),r){let d=t[s];if(n==ge.LengthDelimited&&a!=T.STRING&&a!=T.BYTES){let g=e.uint32()+e.pos;for(;e.pos<g;)d.push(o(e,a))}else d.push(o(e,a))}else t[s]=o(e,a);break;case"message":const c=A.T;r?t[s].push(Ki(e,new c,i,A)):dt(t[s])?Ki(e,t[s],i,A):(t[s]=Ki(e,new c,i,A),c.fieldWrapper&&!A.oneof&&!A.repeated&&(t[s]=c.fieldWrapper.unwrapField(t[s])));break;case"map":let[l,u]=lC(A,e,i);t[s][l]=u;break}}function Ki(t,e,A,n){const i=e.getType().runtime.bin,r=n==null?void 0:n.delimited;return i.readMessage(e,t,r?n.no:t.uint32(),A,r),e}function lC(t,e,A){const n=e.uint32(),i=e.pos+n;let r,s;for(;e.pos<i;){const[a]=e.tag();switch(a){case 1:r=Vi(e,t.K);break;case 2:switch(t.V.kind){case"scalar":s=Vi(e,t.V.T);break;case"enum":s=e.int32();break;case"message":s=Ki(e,new t.V.T,A,void 0);break}break}}if(r===void 0&&(r=Pt(t.K,WA.BIGINT)),typeof r!="string"&&typeof r!="number"&&(r=r.toString()),s===void 0)switch(t.V.kind){case"scalar":s=Pt(t.V.T,WA.BIGINT);break;case"enum":s=t.V.T.values[0].no;break;case"message":s=new t.V.T;break}return[r,s]}function uC(t,e){const A=Vi(t,e);return typeof A=="bigint"?A.toString():A}function Vi(t,e){switch(e){case T.STRING:return t.string();case T.BOOL:return t.bool();case T.DOUBLE:return t.double();case T.FLOAT:return t.float();case T.INT32:return t.int32();case T.INT64:return t.int64();case T.UINT64:return t.uint64();case T.FIXED64:return t.fixed64();case T.BYTES:return t.bytes();case T.FIXED32:return t.fixed32();case T.SFIXED32:return t.sfixed32();case T.SFIXED64:return t.sfixed64();case T.SINT64:return t.sint64();case T.UINT32:return t.uint32();case T.SINT32:return t.sint32()}}function ql(t,e,A,n){le(e!==void 0);const i=t.repeated;switch(t.kind){case"scalar":case"enum":let r=t.kind=="enum"?T.INT32:t.T;if(i)if(le(Array.isArray(e)),t.packed)hC(A,r,t.no,e);else for(const s of e)wn(A,r,t.no,s);else wn(A,r,t.no,e);break;case"message":if(i){le(Array.isArray(e));for(const s of e)Yl(A,n,t,s)}else Yl(A,n,t,e);break;case"map":le(typeof e=="object"&&e!=null);for(const[s,a]of Object.entries(e))dC(A,n,t,s,a);break}}function dC(t,e,A,n,i){t.tag(A.no,ge.LengthDelimited),t.fork();let r=n;switch(A.K){case T.INT32:case T.FIXED32:case T.UINT32:case T.SFIXED32:case T.SINT32:r=Number.parseInt(n);break;case T.BOOL:le(n=="true"||n=="false"),r=n=="true";break}switch(wn(t,A.K,1,r),A.V.kind){case"scalar":wn(t,A.V.T,2,i);break;case"enum":wn(t,T.INT32,2,i);break;case"message":le(i!==void 0),t.tag(2,ge.LengthDelimited).bytes(i.toBinary(e));break}t.join()}function Yl(t,e,A,n){const i=Nl(A.T,n);A.delimited?t.tag(A.no,ge.StartGroup).raw(i.toBinary(e)).tag(A.no,ge.EndGroup):t.tag(A.no,ge.LengthDelimited).bytes(i.toBinary(e))}function wn(t,e,A,n){le(n!==void 0);let[i,r]=zl(e);t.tag(A,i)[r](n)}function hC(t,e,A,n){if(!n.length)return;t.tag(A,ge.LengthDelimited).fork();let[,i]=zl(e);for(let r=0;r<n.length;r++)t[i](n[r]);t.join()}function zl(t){let e=ge.Varint;switch(t){case T.BYTES:case T.STRING:e=ge.LengthDelimited;break;case T.DOUBLE:case T.FIXED64:case T.SFIXED64:e=ge.Bit64;break;case T.FIXED32:case T.SFIXED32:case T.FLOAT:e=ge.Bit32;break}const A=T[t].toLowerCase();return[e,A]}function fC(){return{setEnumType:El,initPartial(t,e){if(t===void 0)return;const A=e.getType();for(const n of A.fields.byMember()){const i=n.localName,r=e,s=t;if(s[i]!=null)switch(n.kind){case"oneof":const a=s[i].case;if(a===void 0)continue;const o=n.findField(a);let c=s[i].value;o&&o.kind=="message"&&!dt(c,o.T)?c=new o.T(c):o&&o.kind==="scalar"&&o.T===T.BYTES&&(c=bn(c)),r[i]={case:a,value:c};break;case"scalar":case"enum":let l=s[i];n.T===T.BYTES&&(l=n.repeated?l.map(bn):bn(l)),r[i]=l;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===T.BYTES)for(const[h,g]of Object.entries(s[i]))r[i][h]=bn(g);else Object.assign(r[i],s[i]);break;case"message":const d=n.V.T;for(const h of Object.keys(s[i])){let g=s[i][h];d.fieldWrapper||(g=new d(g)),r[i][h]=g}break}break;case"message":const u=n.T;if(n.repeated)r[i]=s[i].map(d=>dt(d,u)?d:new u(d));else{const d=s[i];u.fieldWrapper?u.typeName==="google.protobuf.BytesValue"?r[i]=bn(d):r[i]=d:r[i]=dt(d,u)?d:new u(d)}break}}},equals(t,e,A){return e===A?!0:!e||!A?!1:t.fields.byMember().every(n=>{const i=e[n.localName],r=A[n.localName];if(n.repeated){if(i.length!==r.length)return!1;switch(n.kind){case"message":return i.every((s,a)=>n.T.equals(s,r[a]));case"scalar":return i.every((s,a)=>JA(n.T,s,r[a]));case"enum":return i.every((s,a)=>JA(T.INT32,s,r[a]))}throw new Error("repeated cannot contain ".concat(n.kind))}switch(n.kind){case"message":return n.T.equals(i,r);case"enum":return JA(T.INT32,i,r);case"scalar":return JA(n.T,i,r);case"oneof":if(i.case!==r.case)return!1;const s=n.findField(i.case);if(s===void 0)return!0;switch(s.kind){case"message":return s.T.equals(i.value,r.value);case"enum":return JA(T.INT32,i.value,r.value);case"scalar":return JA(s.T,i.value,r.value)}throw new Error("oneof cannot contain ".concat(s.kind));case"map":const a=Object.keys(i).concat(Object.keys(r));switch(n.V.kind){case"message":const o=n.V.T;return a.every(l=>o.equals(i[l],r[l]));case"enum":return a.every(l=>JA(T.INT32,i[l],r[l]));case"scalar":const c=n.V.T;return a.every(l=>JA(c,i[l],r[l]))}break}})},clone(t){const e=t.getType(),A=new e,n=A;for(const i of e.fields.byMember()){const r=t[i.localName];let s;if(i.repeated)s=r.map(Gi);else if(i.kind=="map"){s=n[i.localName];for(const[a,o]of Object.entries(r))s[a]=Gi(o)}else i.kind=="oneof"?s=i.findField(r.case)?{case:r.case,value:Gi(r.value)}:{case:void 0}:s=Gi(r);n[i.localName]=s}for(const i of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(n,i.no,i.wireType,i.data);return A}}}function Gi(t){if(t===void 0)return t;if(dt(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function bn(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function gC(t,e,A){return{syntax:t,json:iC(),bin:cC(),util:Object.assign(Object.assign({},fC()),{newFieldList:e,initFields:A}),makeMessageType(n,i,r){return Vv(this,n,i,r)},makeEnum:Kv,makeEnumType:Sl,getEnumType:Nv,makeExtension(n,i,r){return zv(this,n,i,r)}}}class pC{constructor(e,A){this._fields=e,this._normalizer=A}findJsonName(e){if(!this.jsonNames){const A={};for(const n of this.list())A[n.jsonName]=A[n.name]=n;this.jsonNames=A}return this.jsonNames[e]}find(e){if(!this.numbers){const A={};for(const n of this.list())A[n.no]=n;this.numbers=A}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,A)=>e.no-A.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let A;for(const n of this.list())n.oneof?n.oneof!==A&&(A=n.oneof,e.push(A)):e.push(n)}return this.members}}function Zl(t,e){const A=$l(t);return e?A:bC(wC(A))}function mC(t){return Zl(t,!1)}const BC=$l;function $l(t){let e=!1;const A=[];for(let n=0;n<t.length;n++){let i=t.charAt(n);switch(i){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":A.push(i),e=!1;break;default:e&&(e=!1,i=i.toUpperCase()),A.push(i);break}}return A.join("")}const vC=new Set(["constructor","toString","toJSON","valueOf"]),CC=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),eu=t=>"".concat(t,"$"),wC=t=>CC.has(t)?eu(t):t,bC=t=>vC.has(t)?eu(t):t;class yC{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=mC(e)}addField(e){le(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let A=0;A<this.fields.length;A++)this._lookup[this.fields[A].localName]=this.fields[A]}return this._lookup[e]}}function UC(t,e){var A,n,i,r,s,a;const o=[];let c;for(const l of typeof t=="function"?t():t){const u=l;if(u.localName=Zl(l.name,l.oneof!==void 0),u.jsonName=(A=l.jsonName)!==null&&A!==void 0?A:BC(l.name),u.repeated=(n=l.repeated)!==null&&n!==void 0?n:!1,l.kind=="scalar"&&(u.L=(i=l.L)!==null&&i!==void 0?i:WA.BIGINT),u.delimited=(r=l.delimited)!==null&&r!==void 0?r:!1,u.req=(s=l.req)!==null&&s!==void 0?s:!1,u.opt=(a=l.opt)!==null&&a!==void 0?a:!1,l.packed===void 0&&(u.packed=l.kind=="enum"||l.kind=="scalar"&&l.T!=T.BYTES&&l.T!=T.STRING),l.oneof!==void 0){const d=typeof l.oneof=="string"?l.oneof:l.oneof.name;(!c||c.name!=d)&&(c=new yC(d)),u.oneof=c,c.addField(u)}o.push(u)}return o}const Q=gC("proto3",t=>new pC(t,e=>UC(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const A=e.localName,n=t;if(e.repeated){n[A]=[];continue}switch(e.kind){case"oneof":n[A]={case:void 0};break;case"enum":n[A]=0;break;case"map":n[A]={};break;case"scalar":n[A]=Pt(e.T,e.L);break}}});class Me extends xs{constructor(e){super(),this.seconds=re.zero,this.nanos=0,Q.util.initPartial(e,this)}fromJson(e,A){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Q.json.debug(e)));const n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(i))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=re.parse(i/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),this}toJson(e){const A=Number(this.seconds)*1e3;if(A<Date.parse("0001-01-01T00:00:00Z")||A>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let n="Z";if(this.nanos>0){const i=(this.nanos+1e9).toString().substring(1);i.substring(3)==="000000"?n="."+i.substring(0,3)+"Z":i.substring(6)==="000"?n="."+i.substring(0,6)+"Z":n="."+i+"Z"}return new Date(A).toISOString().replace(".000Z",n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return Me.fromDate(new Date)}static fromDate(e){const A=e.getTime();return new Me({seconds:re.parse(Math.floor(A/1e3)),nanos:A%1e3*1e6})}static fromBinary(e,A){return new Me().fromBinary(e,A)}static fromJson(e,A){return new Me().fromJson(e,A)}static fromJsonString(e,A){return new Me().fromJsonString(e,A)}static equals(e,A){return Q.util.equals(Me,e,A)}}Me.runtime=Q,Me.typeName="google.protobuf.Timestamp",Me.fields=Q.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const QC=Q.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Me},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:EC,repeated:!0},{no:5,name:"events",kind:"message",T:kC,repeated:!0}]),EC=Q.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:SC,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),SC=Q.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Me},{no:3,name:"value",kind:"scalar",T:2}]),kC=Q.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:Me},{no:7,name:"normalized_end_timestamp",kind:"message",T:Me,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),Au=Q.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),sA=Q.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Be=Q.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),Lt=Q.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),yn=Q.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),Un=Q.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),aA=Q.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"}]),Dt=Q.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),TC=Q.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),oA=Q.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),ji=Q.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:Wi,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:fu}]),Wi=Q.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),FC=Q.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:Q.getEnumType(Be),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),ht=Q.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Q.getEnumType(Ht)},{no:4,name:"tracks",kind:"message",T:Ot,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:FC},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Q.getEnumType(Ji)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Q.getEnumType(aA)},{no:18,name:"kind_details",kind:"enum",T:Q.getEnumType(IC),repeated:!0}]),Ht=Q.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Ji=Q.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),IC=Q.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),qe=Q.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),xC=Q.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:ft,repeated:!0}]),Ot=Q.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Q.getEnumType(sA)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:Q.getEnumType(Be)},{no:10,name:"layers",kind:"message",T:ft,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:xC,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:Q.getEnumType(qe)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:fu},{no:19,name:"audio_features",kind:"enum",T:Q.getEnumType(oA),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Q.getEnumType(Au)}]),ft=Q.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Q.getEnumType(Lt)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13}]),Ne=Q.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Q.getEnumType(X)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:nu,oneof:"value"},{no:3,name:"speaker",kind:"message",T:_C,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:iu,oneof:"value"},{no:7,name:"transcription",kind:"message",T:PC,oneof:"value"},{no:8,name:"metrics",kind:"message",T:QC,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:Ds,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:ru,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:su,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:au,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:Os,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Ms,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:Ns,oneof:"value"}]),X=Q.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),_C=Q.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:tu,repeated:!0}]),tu=Q.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),nu=Q.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),iu=Q.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),PC=Q.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:RC,repeated:!0}]),RC=Q.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),Ds=Q.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),ru=Q.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),su=Q.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),au=Q.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:ou,oneof:"value"}]),ou=Q.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),cu=Q.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),LC=Q.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Q.getEnumType(lu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),lu=Q.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),DC=Q.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Q.getEnumType(uu)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),uu=Q.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"}]),du=Q.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:hu},{no:2,name:"screen",kind:"message",T:hu},{no:3,name:"resume_connection",kind:"enum",T:Q.getEnumType(Un)},{no:4,name:"disabled_codecs",kind:"message",T:HC},{no:5,name:"force_relay",kind:"enum",T:Q.getEnumType(Un)}]),hu=Q.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Q.getEnumType(Un)}]),HC=Q.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:Wi,repeated:!0},{no:2,name:"publish",kind:"message",T:Wi,repeated:!0}]),fu=Q.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),Hs=Q.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),gu=Q.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Q.getEnumType(Hs)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),pu=Q.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),Os=Q.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:Q.getEnumType(qe)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:gu,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:pu,oneof:"content_header"}],{localName:"DataStream_Header"}),Ms=Q.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),Ns=Q.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),cA=Q.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Ks=Q.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),OC=Q.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),MC=Q.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:gt,oneof:"message"},{no:2,name:"answer",kind:"message",T:gt,oneof:"message"},{no:3,name:"trickle",kind:"message",T:js,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Gs,oneof:"message"},{no:5,name:"mute",kind:"message",T:Ws,oneof:"message"},{no:6,name:"subscription",kind:"message",T:Xi,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Bu,oneof:"message"},{no:8,name:"leave",kind:"message",T:qi,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:Cu,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:Uu,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:Qu,oneof:"message"},{no:13,name:"simulate",kind:"message",T:bA,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:wu,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:Su,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:vu,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:jC,oneof:"message"}]),mu=Q.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:NC,oneof:"message"},{no:2,name:"answer",kind:"message",T:gt,oneof:"message"},{no:3,name:"offer",kind:"message",T:gt,oneof:"message"},{no:4,name:"trickle",kind:"message",T:js,oneof:"message"},{no:5,name:"update",kind:"message",T:GC,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Js,oneof:"message"},{no:8,name:"leave",kind:"message",T:qi,oneof:"message"},{no:9,name:"mute",kind:"message",T:Ws,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:WC,oneof:"message"},{no:11,name:"room_update",kind:"message",T:JC,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:qC,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:zC,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:$C,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:ew,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:VC,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:KC,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:tw,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:rw,oneof:"message"},{no:22,name:"request_response",kind:"message",T:sw,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:aw,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:Aw,oneof:"message"}]),Vs=Q.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9}]),Gs=Q.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:Q.getEnumType(sA)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:Q.getEnumType(Be)},{no:9,name:"layers",kind:"message",T:ft,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Vs,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:Q.getEnumType(qe)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Q.getEnumType(Au)},{no:17,name:"audio_features",kind:"enum",T:Q.getEnumType(oA),repeated:!0}]),js=Q.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Q.getEnumType(cA)},{no:3,name:"final",kind:"scalar",T:8}]),Ws=Q.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),NC=Q.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:ji},{no:2,name:"participant",kind:"message",T:ht},{no:3,name:"other_participants",kind:"message",T:ht,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:bu,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:du},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:LC},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:Wi,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),KC=Q.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:bu,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:du}]),Js=Q.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Ot}]),VC=Q.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),gt=Q.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9}]),GC=Q.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:ht,repeated:!0}]),Xi=Q.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:cu,repeated:!0}]),Bu=Q.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:Q.getEnumType(Lt)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),vu=Q.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Q.getEnumType(oA),repeated:!0}]),jC=Q.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),qi=Q.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Q.getEnumType(aA)},{no:3,name:"action",kind:"enum",T:Q.getEnumType(Mt)},{no:4,name:"regions",kind:"message",T:nw}]),Mt=Q.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),Cu=Q.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:ft,repeated:!0}]),wu=Q.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),bu=Q.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),WC=Q.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:tu,repeated:!0}]),JC=Q.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:ji}]),XC=Q.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Q.getEnumType(yn)},{no:3,name:"score",kind:"scalar",T:2}]),qC=Q.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:XC,repeated:!0}]),YC=Q.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Q.getEnumType(Ks)}]),zC=Q.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:YC,repeated:!0}]),Xs=Q.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Q.getEnumType(Lt)},{no:2,name:"enabled",kind:"scalar",T:8}]),ZC=Q.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:Xs,repeated:!0}]),$C=Q.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:Xs,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:ZC,repeated:!0}]),yu=Q.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),Uu=Q.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:yu,repeated:!0}]),ew=Q.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),Aw=Q.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:ji},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:ht},{no:4,name:"other_participants",kind:"message",T:ht,repeated:!0}]),Qu=Q.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:gt},{no:2,name:"subscription",kind:"message",T:Xi},{no:3,name:"publish_tracks",kind:"message",T:Js,repeated:!0},{no:4,name:"data_channels",kind:"message",T:Eu,repeated:!0},{no:5,name:"offer",kind:"message",T:gt},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0}]),Eu=Q.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:Q.getEnumType(cA)}]),bA=Q.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:Q.getEnumType(OC),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),Su=Q.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),tw=Q.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),nw=Q.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:iw,repeated:!0}]),iw=Q.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),rw=Q.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Q.getEnumType(TC)}]),sw=Q.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Q.getEnumType(qs)},{no:3,name:"message",kind:"scalar",T:9}]),qs=Q.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"}]),aw=Q.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]);function ow(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yi={exports:{}},cw=Yi.exports,ku;function lw(){return ku||(ku=1,function(t){(function(e,A){t.exports?t.exports=A():e.log=A()})(cw,function(){var e=function(){},A="undefined",n=typeof window!==A&&typeof window.navigator!==A&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function a(f,m){var B=f[m];if(typeof B.bind=="function")return B.bind(f);try{return Function.prototype.bind.call(B,f)}catch{return function(){return Function.prototype.apply.apply(B,[f,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(f){return f==="debug"&&(f="log"),typeof console===A?!1:f==="trace"&&n?o:console[f]!==void 0?a(console,f):console.log!==void 0?a(console,"log"):e}function l(){for(var f=this.getLevel(),m=0;m<i.length;m++){var B=i[m];this[B]=m<f?e:this.methodFactory(B,f,this.name)}if(this.log=this.debug,typeof console===A&&f<this.levels.SILENT)return"No console available for logging"}function u(f){return function(){typeof console!==A&&(l.call(this),this[f].apply(this,arguments))}}function d(f,m,B){return c(f)||u.apply(this,arguments)}function h(f,m){var B=this,b,U,C,w="loglevel";typeof f=="string"?w+=":"+f:typeof f=="symbol"&&(w=void 0);function y(P){var D=(i[P]||"silent").toUpperCase();if(!(typeof window===A||!w)){try{window.localStorage[w]=D;return}catch{}try{window.document.cookie=encodeURIComponent(w)+"="+D+";"}catch{}}}function E(){var P;if(!(typeof window===A||!w)){try{P=window.localStorage[w]}catch{}if(typeof P===A)try{var D=window.document.cookie,M=encodeURIComponent(w),ae=D.indexOf(M+"=");ae!==-1&&(P=/^([^;]+)/.exec(D.slice(ae+M.length+1))[1])}catch{}return B.levels[P]===void 0&&(P=void 0),P}}function S(){if(!(typeof window===A||!w)){try{window.localStorage.removeItem(w)}catch{}try{window.document.cookie=encodeURIComponent(w)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function k(P){var D=P;if(typeof D=="string"&&B.levels[D.toUpperCase()]!==void 0&&(D=B.levels[D.toUpperCase()]),typeof D=="number"&&D>=0&&D<=B.levels.SILENT)return D;throw new TypeError("log.setLevel() called with invalid level: "+P)}B.name=f,B.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},B.methodFactory=m||d,B.getLevel=function(){return C??U??b},B.setLevel=function(P,D){return C=k(P),D!==!1&&y(C),l.call(B)},B.setDefaultLevel=function(P){U=k(P),E()||B.setLevel(P,!1)},B.resetLevel=function(){C=null,S(),l.call(B)},B.enableAll=function(P){B.setLevel(B.levels.TRACE,P)},B.disableAll=function(P){B.setLevel(B.levels.SILENT,P)},B.rebuild=function(){if(s!==B&&(b=k(s.getLevel())),l.call(B),s===B)for(var P in r)r[P].rebuild()},b=k(s?s.getLevel():"WARN");var R=E();R!=null&&(C=k(R)),l.call(B)}s=new h,s.getLogger=function(m){if(typeof m!="symbol"&&typeof m!="string"||m==="")throw new TypeError("You must supply a name when creating a logger.");var B=r[m];return B||(B=r[m]=new h(m,s.methodFactory)),B};var g=typeof window!==A?window.log:void 0;return s.noConflict=function(){return typeof window!==A&&window.log===s&&(window.log=g),s},s.getLoggers=function(){return r},s.default=s,s})}(Yi)),Yi.exports}var zi=lw(),Ys;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(Ys||(Ys={}));var lA;(function(t){t.Default="livekit",t.Room="livekit-room",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee"})(lA||(lA={}));let W=zi.getLogger("livekit");Object.values(lA).map(t=>zi.getLogger(t)),W.setDefaultLevel(Ys.info);function FA(t){const e=zi.getLogger(t);return e.setDefaultLevel(W.getLevel()),e}const uw=zi.getLogger("lk-e2ee"),Qn=7e3,dw=[0,300,2*2*300,3*3*300,4*4*300,Qn,Qn,Qn,Qn,Qn];class hw{constructor(e){this._retryDelays=e!==void 0?[...e]:dw}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const A=this._retryDelays[e.retryCount];return e.retryCount<=1?A:A+Math.random()*1e3}}function fw(t,e){var A={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(A[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(A[n[i]]=t[n[i]]);return A}function v(t,e,A,n){function i(r){return r instanceof A?r:new A(function(s){s(r)})}return new(A||(A=Promise))(function(r,s){function a(l){try{c(n.next(l))}catch(u){s(u)}}function o(l){try{c(n.throw(l))}catch(u){s(u)}}function c(l){l.done?r(l.value):i(l.value).then(a,o)}c((n=n.apply(t,e||[])).next())})}function Tu(t){var e=typeof Symbol=="function"&&Symbol.iterator,A=e&&t[e],n=0;if(A)return A.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function XA(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],A;return e?e.call(t):(t=typeof Tu=="function"?Tu(t):t[Symbol.iterator](),A={},n("next"),n("throw"),n("return"),A[Symbol.asyncIterator]=function(){return this},A);function n(r){A[r]=t[r]&&function(s){return new Promise(function(a,o){s=t[r](s),i(a,o,s.done,s.value)})}}function i(r,s,a,o){Promise.resolve(o).then(function(c){r({value:c,done:a})},s)}}typeof SuppressedError=="function"&&SuppressedError;var Zi={exports:{}},Fu;function gw(){if(Fu)return Zi.exports;Fu=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(w,y,E){return Function.prototype.apply.call(w,y,E)},A;t&&typeof t.ownKeys=="function"?A=t.ownKeys:Object.getOwnPropertySymbols?A=function(w){return Object.getOwnPropertyNames(w).concat(Object.getOwnPropertySymbols(w))}:A=function(w){return Object.getOwnPropertyNames(w)};function n(C){console&&console.warn&&console.warn(C)}var i=Number.isNaN||function(w){return w!==w};function r(){r.init.call(this)}Zi.exports=r,Zi.exports.once=B,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._eventsCount=0,r.prototype._maxListeners=void 0;var s=10;function a(C){if(typeof C!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof C)}Object.defineProperty(r,"defaultMaxListeners",{enumerable:!0,get:function(){return s},set:function(C){if(typeof C!="number"||C<0||i(C))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+C+".");s=C}}),r.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},r.prototype.setMaxListeners=function(w){if(typeof w!="number"||w<0||i(w))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+w+".");return this._maxListeners=w,this};function o(C){return C._maxListeners===void 0?r.defaultMaxListeners:C._maxListeners}r.prototype.getMaxListeners=function(){return o(this)},r.prototype.emit=function(w){for(var y=[],E=1;E<arguments.length;E++)y.push(arguments[E]);var S=w==="error",k=this._events;if(k!==void 0)S=S&&k.error===void 0;else if(!S)return!1;if(S){var R;if(y.length>0&&(R=y[0]),R instanceof Error)throw R;var P=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw P.context=R,P}var D=k[w];if(D===void 0)return!1;if(typeof D=="function")e(D,this,y);else for(var M=D.length,ae=g(D,M),E=0;E<M;++E)e(ae[E],this,y);return!0};function c(C,w,y,E){var S,k,R;if(a(y),k=C._events,k===void 0?(k=C._events=Object.create(null),C._eventsCount=0):(k.newListener!==void 0&&(C.emit("newListener",w,y.listener?y.listener:y),k=C._events),R=k[w]),R===void 0)R=k[w]=y,++C._eventsCount;else if(typeof R=="function"?R=k[w]=E?[y,R]:[R,y]:E?R.unshift(y):R.push(y),S=o(C),S>0&&R.length>S&&!R.warned){R.warned=!0;var P=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(w)+" listeners added. Use emitter.setMaxListeners() to increase limit");P.name="MaxListenersExceededWarning",P.emitter=C,P.type=w,P.count=R.length,n(P)}return C}r.prototype.addListener=function(w,y){return c(this,w,y,!1)},r.prototype.on=r.prototype.addListener,r.prototype.prependListener=function(w,y){return c(this,w,y,!0)};function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(C,w,y){var E={fired:!1,wrapFn:void 0,target:C,type:w,listener:y},S=l.bind(E);return S.listener=y,E.wrapFn=S,S}r.prototype.once=function(w,y){return a(y),this.on(w,u(this,w,y)),this},r.prototype.prependOnceListener=function(w,y){return a(y),this.prependListener(w,u(this,w,y)),this},r.prototype.removeListener=function(w,y){var E,S,k,R,P;if(a(y),S=this._events,S===void 0)return this;if(E=S[w],E===void 0)return this;if(E===y||E.listener===y)--this._eventsCount===0?this._events=Object.create(null):(delete S[w],S.removeListener&&this.emit("removeListener",w,E.listener||y));else if(typeof E!="function"){for(k=-1,R=E.length-1;R>=0;R--)if(E[R]===y||E[R].listener===y){P=E[R].listener,k=R;break}if(k<0)return this;k===0?E.shift():f(E,k),E.length===1&&(S[w]=E[0]),S.removeListener!==void 0&&this.emit("removeListener",w,P||y)}return this},r.prototype.off=r.prototype.removeListener,r.prototype.removeAllListeners=function(w){var y,E,S;if(E=this._events,E===void 0)return this;if(E.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):E[w]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete E[w]),this;if(arguments.length===0){var k=Object.keys(E),R;for(S=0;S<k.length;++S)R=k[S],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(y=E[w],typeof y=="function")this.removeListener(w,y);else if(y!==void 0)for(S=y.length-1;S>=0;S--)this.removeListener(w,y[S]);return this};function d(C,w,y){var E=C._events;if(E===void 0)return[];var S=E[w];return S===void 0?[]:typeof S=="function"?y?[S.listener||S]:[S]:y?m(S):g(S,S.length)}r.prototype.listeners=function(w){return d(this,w,!0)},r.prototype.rawListeners=function(w){return d(this,w,!1)},r.listenerCount=function(C,w){return typeof C.listenerCount=="function"?C.listenerCount(w):h.call(C,w)},r.prototype.listenerCount=h;function h(C){var w=this._events;if(w!==void 0){var y=w[C];if(typeof y=="function")return 1;if(y!==void 0)return y.length}return 0}r.prototype.eventNames=function(){return this._eventsCount>0?A(this._events):[]};function g(C,w){for(var y=new Array(w),E=0;E<w;++E)y[E]=C[E];return y}function f(C,w){for(;w+1<C.length;w++)C[w]=C[w+1];C.pop()}function m(C){for(var w=new Array(C.length),y=0;y<w.length;++y)w[y]=C[y].listener||C[y];return w}function B(C,w){return new Promise(function(y,E){function S(R){C.removeListener(w,k),E(R)}function k(){typeof C.removeListener=="function"&&C.removeListener("error",S),y([].slice.call(arguments))}U(C,w,k,{once:!0}),w!=="error"&&b(C,S,{once:!0})})}function b(C,w,y){typeof C.on=="function"&&U(C,"error",w,y)}function U(C,w,y,E){if(typeof C.on=="function")E.once?C.once(w,y):C.on(w,y);else if(typeof C.addEventListener=="function")C.addEventListener(w,function S(k){E.once&&C.removeEventListener(w,S),y(k)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof C)}return Zi.exports}var yA=gw();let Iu=!0,xu=!0;function $i(t,e,A){const n=t.match(e);return n&&n.length>=A&&parseInt(n[A],10)}function pt(t,e,A){if(!t.RTCPeerConnection)return;const n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(s,a){if(s!==e)return i.apply(this,arguments);const o=c=>{const l=A(c);l&&(a.handleEvent?a.handleEvent(l):a(l))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,o),i.apply(this,[s,o])};const r=n.removeEventListener;n.removeEventListener=function(s,a){if(s!==e||!this._eventMap||!this._eventMap[e])return r.apply(this,arguments);if(!this._eventMap[e].has(a))return r.apply(this,arguments);const o=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,r.apply(this,[s,o])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(s){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),s&&this.addEventListener(e,this["_on"+e]=s)},enumerable:!0,configurable:!0})}function pw(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(Iu=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function mw(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(xu=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function _u(){if(typeof window=="object"){if(Iu)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function zs(t,e){xu&&console.warn(t+" is deprecated, please use "+e+" instead.")}function Bw(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:A}=t;if(A.userAgentData&&A.userAgentData.brands){const n=A.userAgentData.brands.find(i=>i.brand==="Chromium");if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(A.mozGetUserMedia)e.browser="firefox",e.version=$i(A.userAgent,/Firefox\/(\d+)\./,1);else if(A.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=$i(A.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&A.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=$i(A.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function Pu(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ru(t){return Pu(t)?Object.keys(t).reduce(function(e,A){const n=Pu(t[A]),i=n?Ru(t[A]):t[A],r=n&&!Object.keys(i).length;return i===void 0||r?e:Object.assign(e,{[A]:i})},{}):t}function Zs(t,e,A){!e||A.has(e.id)||(A.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?Zs(t,t.get(e[n]),A):n.endsWith("Ids")&&e[n].forEach(i=>{Zs(t,t.get(i),A)})}))}function Lu(t,e,A){const n=A?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;const r=[];return t.forEach(s=>{s.type==="track"&&s.trackIdentifier===e.id&&r.push(s)}),r.forEach(s=>{t.forEach(a=>{a.type===n&&a.trackId===s.id&&Zs(t,a,i)})}),i}const Du=_u;function Hu(t,e){const A=t&&t.navigator;if(!A.mediaDevices)return;const n=function(a){if(typeof a!="object"||a.mandatory||a.optional)return a;const o={};return Object.keys(a).forEach(c=>{if(c==="require"||c==="advanced"||c==="mediaSource")return;const l=typeof a[c]=="object"?a[c]:{ideal:a[c]};l.exact!==void 0&&typeof l.exact=="number"&&(l.min=l.max=l.exact);const u=function(d,h){return d?d+h.charAt(0).toUpperCase()+h.slice(1):h==="deviceId"?"sourceId":h};if(l.ideal!==void 0){o.optional=o.optional||[];let d={};typeof l.ideal=="number"?(d[u("min",c)]=l.ideal,o.optional.push(d),d={},d[u("max",c)]=l.ideal,o.optional.push(d)):(d[u("",c)]=l.ideal,o.optional.push(d))}l.exact!==void 0&&typeof l.exact!="number"?(o.mandatory=o.mandatory||{},o.mandatory[u("",c)]=l.exact):["min","max"].forEach(d=>{l[d]!==void 0&&(o.mandatory=o.mandatory||{},o.mandatory[u(d,c)]=l[d])})}),a.advanced&&(o.optional=(o.optional||[]).concat(a.advanced)),o},i=function(a,o){if(e.version>=61)return o(a);if(a=JSON.parse(JSON.stringify(a)),a&&typeof a.audio=="object"){const c=function(l,u,d){u in l&&!(d in l)&&(l[d]=l[u],delete l[u])};a=JSON.parse(JSON.stringify(a)),c(a.audio,"autoGainControl","googAutoGainControl"),c(a.audio,"noiseSuppression","googNoiseSuppression"),a.audio=n(a.audio)}if(a&&typeof a.video=="object"){let c=a.video.facingMode;c=c&&(typeof c=="object"?c:{ideal:c});const l=e.version<66;if(c&&(c.exact==="user"||c.exact==="environment"||c.ideal==="user"||c.ideal==="environment")&&!(A.mediaDevices.getSupportedConstraints&&A.mediaDevices.getSupportedConstraints().facingMode&&!l)){delete a.video.facingMode;let u;if(c.exact==="environment"||c.ideal==="environment"?u=["back","rear"]:(c.exact==="user"||c.ideal==="user")&&(u=["front"]),u)return A.mediaDevices.enumerateDevices().then(d=>{d=d.filter(g=>g.kind==="videoinput");let h=d.find(g=>u.some(f=>g.label.toLowerCase().includes(f)));return!h&&d.length&&u.includes("back")&&(h=d[d.length-1]),h&&(a.video.deviceId=c.exact?{exact:h.deviceId}:{ideal:h.deviceId}),a.video=n(a.video),Du("chrome: "+JSON.stringify(a)),o(a)})}a.video=n(a.video)}return Du("chrome: "+JSON.stringify(a)),o(a)},r=function(a){return e.version>=64?a:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[a.name]||a.name,message:a.message,constraint:a.constraint||a.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},s=function(a,o,c){i(a,l=>{A.webkitGetUserMedia(l,o,u=>{c&&c(r(u))})})};if(A.getUserMedia=s.bind(A),A.mediaDevices.getUserMedia){const a=A.mediaDevices.getUserMedia.bind(A.mediaDevices);A.mediaDevices.getUserMedia=function(o){return i(o,c=>a(c).then(l=>{if(c.audio&&!l.getAudioTracks().length||c.video&&!l.getVideoTracks().length)throw l.getTracks().forEach(u=>{u.stop()}),new DOMException("","NotFoundError");return l},l=>Promise.reject(r(l))))}}}function Ou(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function Mu(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(A){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=A)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",i=>{let r;t.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(a=>a.track&&a.track.id===i.track.id):r={track:i.track};const s=new Event("track");s.track=i.track,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)}),n.stream.getTracks().forEach(i=>{let r;t.RTCPeerConnection.prototype.getReceivers?r=this.getReceivers().find(a=>a.track&&a.track.id===i.id):r={track:i};const s=new Event("track");s.track=i,s.receiver=r,s.transceiver={receiver:r},s.streams=[n.stream],this.dispatchEvent(s)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else pt(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function Nu(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(i,r){return{track:r,get dtmf(){return this._dtmf===void 0&&(r.kind==="audio"?this._dtmf=i.createDTMFSender(r):this._dtmf=null),this._dtmf},_pc:i}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const i=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(a,o){let c=i.apply(this,arguments);return c||(c=e(this,a),this._senders.push(c)),c};const r=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(a){r.apply(this,arguments);const o=this._senders.indexOf(a);o!==-1&&this._senders.splice(o,1)}}const A=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(r){this._senders=this._senders||[],A.apply(this,[r]),r.getTracks().forEach(s=>{this._senders.push(e(this,s))})};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(r){this._senders=this._senders||[],n.apply(this,[r]),r.getTracks().forEach(s=>{const a=this._senders.find(o=>o.track===s);a&&this._senders.splice(this._senders.indexOf(a),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ku(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const A=t.RTCPeerConnection.prototype.getSenders;A&&(t.RTCPeerConnection.prototype.getSenders=function(){const r=A.apply(this,[]);return r.forEach(s=>s._pc=this),r});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const r=n.apply(this,arguments);return r._pc=this,r}),t.RTCRtpSender.prototype.getStats=function(){const r=this;return this._pc.getStats().then(s=>Lu(s,r.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const A=t.RTCPeerConnection.prototype.getReceivers;A&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=A.apply(this,[]);return i.forEach(r=>r._pc=this),i}),pt(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){const i=this;return this._pc.getStats().then(r=>Lu(r,i.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const n=arguments[0];let i,r,s;return this.getSenders().forEach(a=>{a.track===n&&(i?s=!0:i=a)}),this.getReceivers().forEach(a=>(a.track===n&&(r?s=!0:r=a),a.track===n)),s||i&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):i?i.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function Vu(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(s=>this._shimmedLocalStreams[s][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(s,a){if(!a)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const o=e.apply(this,arguments);return this._shimmedLocalStreams[a.id]?this._shimmedLocalStreams[a.id].indexOf(o)===-1&&this._shimmedLocalStreams[a.id].push(o):this._shimmedLocalStreams[a.id]=[a,o],o};const A=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){this._shimmedLocalStreams=this._shimmedLocalStreams||{},s.getTracks().forEach(c=>{if(this.getSenders().find(u=>u.track===c))throw new DOMException("Track already exists.","InvalidAccessError")});const a=this.getSenders();A.apply(this,arguments);const o=this.getSenders().filter(c=>a.indexOf(c)===-1);this._shimmedLocalStreams[s.id]=[s].concat(o)};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[s.id],n.apply(this,arguments)};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(s){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},s&&Object.keys(this._shimmedLocalStreams).forEach(a=>{const o=this._shimmedLocalStreams[a].indexOf(s);o!==-1&&this._shimmedLocalStreams[a].splice(o,1),this._shimmedLocalStreams[a].length===1&&delete this._shimmedLocalStreams[a]}),i.apply(this,arguments)}}function Gu(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return Vu(t);const A=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const l=A.apply(this);return this._reverseStreams=this._reverseStreams||{},l.map(u=>this._reverseStreams[u.id])};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(l){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},l.getTracks().forEach(u=>{if(this.getSenders().find(h=>h.track===u))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[l.id]){const u=new t.MediaStream(l.getTracks());this._streams[l.id]=u,this._reverseStreams[u.id]=l,l=u}n.apply(this,[l])};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(l){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[l.id]||l]),delete this._reverseStreams[this._streams[l.id]?this._streams[l.id].id:l.id],delete this._streams[l.id]},t.RTCPeerConnection.prototype.addTrack=function(l,u){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const d=[].slice.call(arguments,1);if(d.length!==1||!d[0].getTracks().find(f=>f===l))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(f=>f.track===l))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const g=this._streams[u.id];if(g)g.addTrack(l),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const f=new t.MediaStream([l]);this._streams[u.id]=f,this._reverseStreams[f.id]=u,this.addStream(f)}return this.getSenders().find(f=>f.track===l)};function r(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],g=c._streams[h.id];u=u.replace(new RegExp(g.id,"g"),h.id)}),new RTCSessionDescription({type:l.type,sdp:u})}function s(c,l){let u=l.sdp;return Object.keys(c._reverseStreams||[]).forEach(d=>{const h=c._reverseStreams[d],g=c._streams[h.id];u=u.replace(new RegExp(h.id,"g"),g.id)}),new RTCSessionDescription({type:l.type,sdp:u})}["createOffer","createAnswer"].forEach(function(c){const l=t.RTCPeerConnection.prototype[c],u={[c](){const d=arguments;return arguments.length&&typeof arguments[0]=="function"?l.apply(this,[g=>{const f=r(this,g);d[0].apply(null,[f])},g=>{d[1]&&d[1].apply(null,g)},arguments[2]]):l.apply(this,arguments).then(g=>r(this,g))}};t.RTCPeerConnection.prototype[c]=u[c]});const a=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?a.apply(this,arguments):(arguments[0]=s(this,arguments[0]),a.apply(this,arguments))};const o=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const c=o.get.apply(this);return c.type===""?c:r(this,c)}}),t.RTCPeerConnection.prototype.removeTrack=function(l){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!l._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(l._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let d;Object.keys(this._streams).forEach(h=>{this._streams[h].getTracks().find(f=>l.track===f)&&(d=this._streams[h])}),d&&(d.getTracks().length===1?this.removeStream(this._reverseStreams[d.id]):d.removeTrack(l.track),this.dispatchEvent(new Event("negotiationneeded")))}}function $s(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(A){const n=t.RTCPeerConnection.prototype[A],i={[A](){return arguments[0]=new(A==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[A]=i[A]})}function ju(t,e){pt(t,"negotiationneeded",A=>{const n=A.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return A})}var Wu=Object.freeze({__proto__:null,fixNegotiationNeeded:ju,shimAddTrackRemoveTrack:Gu,shimAddTrackRemoveTrackWithNative:Vu,shimGetSendersWithDtmf:Nu,shimGetUserMedia:Hu,shimMediaStream:Ou,shimOnTrack:Mu,shimPeerConnection:$s,shimSenderReceiverGetStats:Ku});function Ju(t,e){const A=t&&t.navigator,n=t&&t.MediaStreamTrack;if(A.getUserMedia=function(i,r,s){zs("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),A.mediaDevices.getUserMedia(i).then(r,s)},!(e.version>55&&"autoGainControl"in A.mediaDevices.getSupportedConstraints())){const i=function(s,a,o){a in s&&!(o in s)&&(s[o]=s[a],delete s[a])},r=A.mediaDevices.getUserMedia.bind(A.mediaDevices);if(A.mediaDevices.getUserMedia=function(s){return typeof s=="object"&&typeof s.audio=="object"&&(s=JSON.parse(JSON.stringify(s)),i(s.audio,"autoGainControl","mozAutoGainControl"),i(s.audio,"noiseSuppression","mozNoiseSuppression")),r(s)},n&&n.prototype.getSettings){const s=n.prototype.getSettings;n.prototype.getSettings=function(){const a=s.apply(this,arguments);return i(a,"mozAutoGainControl","autoGainControl"),i(a,"mozNoiseSuppression","noiseSuppression"),a}}if(n&&n.prototype.applyConstraints){const s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(a){return this.kind==="audio"&&typeof a=="object"&&(a=JSON.parse(JSON.stringify(a)),i(a,"autoGainControl","mozAutoGainControl"),i(a,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[a])}}}}function vw(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function Xu(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ea(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(i){const r=t.RTCPeerConnection.prototype[i],s={[i](){return arguments[0]=new(i==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};t.RTCPeerConnection.prototype[i]=s[i]});const A={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[r,s,a]=arguments;return n.apply(this,[r||null]).then(o=>{if(e.version<53&&!s)try{o.forEach(c=>{c.type=A[c.type]||c.type})}catch(c){if(c.name!=="TypeError")throw c;o.forEach((l,u)=>{o.set(u,Object.assign({},l,{type:A[l.type]||l.type}))})}return o}).then(s,a)}}function qu(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=e.apply(this,[]);return i.forEach(r=>r._pc=this),i});const A=t.RTCPeerConnection.prototype.addTrack;A&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=A.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Yu(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(i=>i._pc=this),n}),pt(t,"track",A=>(A.receiver._pc=A.srcElement,A)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function zu(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(A){zs("removeStream","removeTrack"),this.getSenders().forEach(n=>{n.track&&A.getTracks().includes(n.track)&&this.removeTrack(n)})})}function Zu(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function $u(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const i=n.length>0;i&&n.forEach(s=>{if("rid"in s&&!/^[a-z0-9]{0,16}$/i.test(s.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in s&&!(parseFloat(s.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in s&&!(parseFloat(s.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const r=e.apply(this,arguments);if(i){const{sender:s}=r,a=s.getParameters();(!("encodings"in a)||a.encodings.length===1&&Object.keys(a.encodings[0]).length===0)&&(a.encodings=n,s.sendEncodings=n,this.setParametersPromises.push(s.setParameters(a).then(()=>{delete s.sendEncodings}).catch(()=>{delete s.sendEncodings})))}return r})}function ed(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function Ad(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function td(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var nd=Object.freeze({__proto__:null,shimAddTransceiver:$u,shimCreateAnswer:td,shimCreateOffer:Ad,shimGetDisplayMedia:vw,shimGetParameters:ed,shimGetUserMedia:Ju,shimOnTrack:Xu,shimPeerConnection:ea,shimRTCDataChannel:Zu,shimReceiverGetStats:Yu,shimRemoveStream:zu,shimSenderGetStats:qu});function id(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(i=>e.call(this,i,n)),n.getVideoTracks().forEach(i=>e.call(this,i,n))},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return r&&r.forEach(a=>{this._localStreams?this._localStreams.includes(a)||this._localStreams.push(a):this._localStreams=[a]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(A){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(A);if(n===-1)return;this._localStreams.splice(n,1);const i=A.getTracks();this.getSenders().forEach(r=>{i.includes(r.track)&&this.removeTrack(r)})})}}function rd(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(A){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=A),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(i=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(i))return;this._remoteStreams.push(i);const r=new Event("addstream");r.stream=i,this.dispatchEvent(r)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(i){i.streams.forEach(r=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(r)>=0)return;n._remoteStreams.push(r);const s=new Event("addstream");s.stream=r,n.dispatchEvent(s)})}),e.apply(n,arguments)}}}function sd(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,A=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,r=e.setRemoteDescription,s=e.addIceCandidate;e.createOffer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=A.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d},e.createAnswer=function(c,l){const u=arguments.length>=2?arguments[2]:arguments[0],d=n.apply(this,[u]);return l?(d.then(c,l),Promise.resolve()):d};let a=function(o,c,l){const u=i.apply(this,[o]);return l?(u.then(c,l),Promise.resolve()):u};e.setLocalDescription=a,a=function(o,c,l){const u=r.apply(this,[o]);return l?(u.then(c,l),Promise.resolve()):u},e.setRemoteDescription=a,a=function(o,c,l){const u=s.apply(this,[o]);return l?(u.then(c,l),Promise.resolve()):u},e.addIceCandidate=a}function ad(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const A=e.mediaDevices,n=A.getUserMedia.bind(A);e.mediaDevices.getUserMedia=i=>n(od(i))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,i,r){e.mediaDevices.getUserMedia(n).then(i,r)}).bind(e))}function od(t){return t&&t.video!==void 0?Object.assign({},t,{video:Ru(t.video)}):t}function cd(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){const r=[];for(let s=0;s<n.iceServers.length;s++){let a=n.iceServers[s];a.urls===void 0&&a.url?(zs("RTCIceServer.url","RTCIceServer.urls"),a=JSON.parse(JSON.stringify(a)),a.urls=a.url,delete a.url,r.push(a)):r.push(n.iceServers[s])}n.iceServers=r}return new e(n,i)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function ld(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function ud(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const i=this.getTransceivers().find(s=>s.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveAudio===!0&&!i&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const r=this.getTransceivers().find(s=>s.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&r?r.direction==="sendrecv"?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":r.direction==="recvonly"&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):n.offerToReceiveVideo===!0&&!r&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function dd(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var hd=Object.freeze({__proto__:null,shimAudioContext:dd,shimCallbacksAPI:sd,shimConstraints:od,shimCreateOfferLegacy:ud,shimGetUserMedia:ad,shimLocalStreamsAPI:id,shimRTCIceServerUrls:cd,shimRemoteStreamsAPI:rd,shimTrackEventTransceiver:ld}),Aa={exports:{}},fd;function Cw(){return fd||(fd=1,function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(A){return A.trim().split(`
11
11
  `).map(n=>n.trim())},e.splitSections=function(A){return A.split(`
12
12
  m=`).map((i,r)=>(r>0?"m="+i:i).trim()+`\r
13
13
  `)},e.getDescription=function(A){const n=e.splitSections(A);return n&&n[0]},e.getMediaSections=function(A){const n=e.splitSections(A);return n.shift(),n},e.matchPrefix=function(A,n){return e.splitLines(A).filter(i=>i.indexOf(n)===0)},e.parseCandidate=function(A){let n;A.indexOf("a=candidate:")===0?n=A.substring(12).split(" "):n=A.substring(10).split(" ");const i={foundation:n[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let r=8;r<n.length;r+=2)switch(n[r]){case"raddr":i.relatedAddress=n[r+1];break;case"rport":i.relatedPort=parseInt(n[r+1],10);break;case"tcptype":i.tcpType=n[r+1];break;case"ufrag":i.ufrag=n[r+1],i.usernameFragment=n[r+1];break;default:i[n[r]]===void 0&&(i[n[r]]=n[r+1]);break}return i},e.writeCandidate=function(A){const n=[];n.push(A.foundation);const i=A.component;i==="rtp"?n.push(1):i==="rtcp"?n.push(2):n.push(i),n.push(A.protocol.toUpperCase()),n.push(A.priority),n.push(A.address||A.ip),n.push(A.port);const r=A.type;return n.push("typ"),n.push(r),r!=="host"&&A.relatedAddress&&A.relatedPort&&(n.push("raddr"),n.push(A.relatedAddress),n.push("rport"),n.push(A.relatedPort)),A.tcpType&&A.protocol.toLowerCase()==="tcp"&&(n.push("tcptype"),n.push(A.tcpType)),(A.usernameFragment||A.ufrag)&&(n.push("ufrag"),n.push(A.usernameFragment||A.ufrag)),"candidate:"+n.join(" ")},e.parseIceOptions=function(A){return A.substring(14).split(" ")},e.parseRtpMap=function(A){let n=A.substring(9).split(" ");const i={payloadType:parseInt(n.shift(),10)};return n=n[0].split("/"),i.name=n[0],i.clockRate=parseInt(n[1],10),i.channels=n.length===3?parseInt(n[2],10):1,i.numChannels=i.channels,i},e.writeRtpMap=function(A){let n=A.payloadType;A.preferredPayloadType!==void 0&&(n=A.preferredPayloadType);const i=A.channels||A.numChannels||1;return"a=rtpmap:"+n+" "+A.name+"/"+A.clockRate+(i!==1?"/"+i:"")+`\r
@@ -24,7 +24,7 @@ a=ice-pwd:`+A.password+`\r
24
24
  `,i+=`c=IN IP4 0.0.0.0\r
25
25
  `,i+=`a=rtcp:9 IN IP4 0.0.0.0\r
26
26
  `,n.codecs.forEach(s=>{i+=e.writeRtpMap(s),i+=e.writeFmtp(s),i+=e.writeRtcpFb(s)});let r=0;return n.codecs.forEach(s=>{s.maxptime>r&&(r=s.maxptime)}),r>0&&(i+="a=maxptime:"+r+`\r
27
- `),n.headerExtensions&&n.headerExtensions.forEach(s=>{i+=e.writeExtmap(s)}),i},e.parseRtpEncodingParameters=function(A){const n=[],i=e.parseRtpParameters(A),r=i.fecMechanisms.indexOf("RED")!==-1,s=i.fecMechanisms.indexOf("ULPFEC")!==-1,a=e.matchPrefix(A,"a=ssrc:").map(d=>e.parseSsrcMedia(d)).filter(d=>d.attribute==="cname"),o=a.length>0&&a[0].ssrc;let c;const l=e.matchPrefix(A,"a=ssrc-group:FID").map(d=>d.substring(17).split(" ").map(p=>parseInt(p,10)));l.length>0&&l[0].length>1&&l[0][0]===o&&(c=l[0][1]),i.codecs.forEach(d=>{if(d.name.toUpperCase()==="RTX"&&d.parameters.apt){let h={ssrc:o,codecPayloadType:parseInt(d.parameters.apt,10)};o&&c&&(h.rtx={ssrc:c}),n.push(h),r&&(h=JSON.parse(JSON.stringify(h)),h.fec={ssrc:o,mechanism:s?"red+ulpfec":"red"},n.push(h))}}),n.length===0&&o&&n.push({ssrc:o});let u=e.matchPrefix(A,"b=");return u.length&&(u[0].indexOf("b=TIAS:")===0?u=parseInt(u[0].substring(7),10):u[0].indexOf("b=AS:")===0?u=parseInt(u[0].substring(5),10)*1e3*.95-50*40*8:u=void 0,n.forEach(d=>{d.maxBitrate=u})),n},e.parseRtcpParameters=function(A){const n={},i=e.matchPrefix(A,"a=ssrc:").map(a=>e.parseSsrcMedia(a)).filter(a=>a.attribute==="cname")[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);const r=e.matchPrefix(A,"a=rtcp-rsize");n.reducedSize=r.length>0,n.compound=r.length===0;const s=e.matchPrefix(A,"a=rtcp-mux");return n.mux=s.length>0,n},e.writeRtcpParameters=function(A){let n="";return A.reducedSize&&(n+=`a=rtcp-rsize\r
27
+ `),n.headerExtensions&&n.headerExtensions.forEach(s=>{i+=e.writeExtmap(s)}),i},e.parseRtpEncodingParameters=function(A){const n=[],i=e.parseRtpParameters(A),r=i.fecMechanisms.indexOf("RED")!==-1,s=i.fecMechanisms.indexOf("ULPFEC")!==-1,a=e.matchPrefix(A,"a=ssrc:").map(d=>e.parseSsrcMedia(d)).filter(d=>d.attribute==="cname"),o=a.length>0&&a[0].ssrc;let c;const l=e.matchPrefix(A,"a=ssrc-group:FID").map(d=>d.substring(17).split(" ").map(g=>parseInt(g,10)));l.length>0&&l[0].length>1&&l[0][0]===o&&(c=l[0][1]),i.codecs.forEach(d=>{if(d.name.toUpperCase()==="RTX"&&d.parameters.apt){let h={ssrc:o,codecPayloadType:parseInt(d.parameters.apt,10)};o&&c&&(h.rtx={ssrc:c}),n.push(h),r&&(h=JSON.parse(JSON.stringify(h)),h.fec={ssrc:o,mechanism:s?"red+ulpfec":"red"},n.push(h))}}),n.length===0&&o&&n.push({ssrc:o});let u=e.matchPrefix(A,"b=");return u.length&&(u[0].indexOf("b=TIAS:")===0?u=parseInt(u[0].substring(7),10):u[0].indexOf("b=AS:")===0?u=parseInt(u[0].substring(5),10)*1e3*.95-50*40*8:u=void 0,n.forEach(d=>{d.maxBitrate=u})),n},e.parseRtcpParameters=function(A){const n={},i=e.matchPrefix(A,"a=ssrc:").map(a=>e.parseSsrcMedia(a)).filter(a=>a.attribute==="cname")[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);const r=e.matchPrefix(A,"a=rtcp-rsize");n.reducedSize=r.length>0,n.compound=r.length===0;const s=e.matchPrefix(A,"a=rtcp-mux");return n.mux=s.length>0,n},e.writeRtcpParameters=function(A){let n="";return A.reducedSize&&(n+=`a=rtcp-rsize\r
28
28
  `),A.mux&&(n+=`a=rtcp-mux\r
29
29
  `),A.ssrc!==void 0&&A.cname&&(n+="a=ssrc:"+A.ssrc+" cname:"+A.cname+`\r
30
30
  `),n},e.parseMsid=function(A){let n;const i=e.matchPrefix(A,"a=msid:");if(i.length===1)return n=i[0].substring(7).split(" "),{stream:n[0],track:n[1]};const r=e.matchPrefix(A,"a=ssrc:").map(s=>e.parseSsrcMedia(s)).filter(s=>s.attribute==="msid");if(r.length>0)return n=r[0].value.split(" "),{stream:n[0],track:n[1]}},e.parseSctpDescription=function(A){const n=e.parseMLine(A),i=e.matchPrefix(A,"a=max-message-size:");let r;i.length>0&&(r=parseInt(i[0].substring(19),10)),isNaN(r)&&(r=65536);const s=e.matchPrefix(A,"a=sctp-port:");if(s.length>0)return{port:parseInt(s[0].substring(12),10),protocol:n.fmt,maxMessageSize:r};const a=e.matchPrefix(A,"a=sctpmap:");if(a.length>0){const o=a[0].substring(10).split(" ");return{port:parseInt(o[0],10),protocol:o[1],maxMessageSize:r}}},e.writeSctpDescription=function(A,n){let i=[];return A.protocol!=="DTLS/SCTP"?i=["m="+A.kind+" 9 "+A.protocol+" "+n.protocol+`\r
@@ -41,22 +41,22 @@ t=0 0\r
41
41
  `},e.getDirection=function(A,n){const i=e.splitLines(A);for(let r=0;r<i.length;r++)switch(i[r]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[r].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(A){return e.splitLines(A)[0].split(" ")[0].substring(2)},e.isRejected=function(A){return A.split(" ",2)[1]==="0"},e.parseMLine=function(A){const i=e.splitLines(A)[0].substring(2).split(" ");return{kind:i[0],port:parseInt(i[1],10),protocol:i[2],fmt:i.slice(3).join(" ")}},e.parseOLine=function(A){const i=e.matchPrefix(A,"o=")[0].substring(2).split(" ");return{username:i[0],sessionId:i[1],sessionVersion:parseInt(i[2],10),netType:i[3],addressType:i[4],address:i[5]}},e.isValidSDP=function(A){if(typeof A!="string"||A.length===0)return!1;const n=e.splitLines(A);for(let i=0;i<n.length;i++)if(n[i].length<2||n[i].charAt(1)!=="=")return!1;return!0},t.exports=e}(Aa)),Aa.exports}var gd=Cw(),Nt=ow(gd),ww=_v({__proto__:null,default:Nt},[gd]);function er(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(n){if(typeof n=="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substring(2)),n.candidate&&n.candidate.length){const i=new e(n),r=Nt.parseCandidate(n.candidate);for(const s in r)s in i||Object.defineProperty(i,s,{value:r[s]});return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new e(n)},t.RTCIceCandidate.prototype=e.prototype,pt(t,"icecandidate",A=>(A.candidate&&Object.defineProperty(A,"candidate",{value:new t.RTCIceCandidate(A.candidate),writable:"false"}),A))}function ta(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||pt(t,"icecandidate",e=>{if(e.candidate){const A=Nt.parseCandidate(e.candidate.candidate);A.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[A.priority>>24])}return e})}function Ar(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const A=function(a){if(!a||!a.sdp)return!1;const o=Nt.splitSections(a.sdp);return o.shift(),o.some(c=>{const l=Nt.parseMLine(c);return l&&l.kind==="application"&&l.protocol.indexOf("SCTP")!==-1})},n=function(a){const o=a.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(o===null||o.length<2)return-1;const c=parseInt(o[1],10);return c!==c?-1:c},i=function(a){let o=65536;return e.browser==="firefox"&&(e.version<57?a===-1?o=16384:o=2147483637:e.version<60?o=e.version===57?65535:65536:o=2147483637),o},r=function(a,o){let c=65536;e.browser==="firefox"&&e.version===57&&(c=65535);const l=Nt.matchPrefix(a.sdp,"a=max-message-size:");return l.length>0?c=parseInt(l[0].substring(19),10):e.browser==="firefox"&&o!==-1&&(c=2147483637),c},s=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:o}=this.getConfiguration();o==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(A(arguments[0])){const o=n(arguments[0]),c=i(o),l=r(arguments[0],o);let u;c===0&&l===0?u=Number.POSITIVE_INFINITY:c===0||l===0?u=Math.max(c,l):u=Math.min(c,l);const d={};Object.defineProperty(d,"maxMessageSize",{get(){return u}}),this._sctp=d}return s.apply(this,arguments)}}function tr(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(n,i){const r=n.send;n.send=function(){const a=arguments[0],o=a.length||a.size||a.byteLength;if(n.readyState==="open"&&i.sctp&&o>i.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+i.sctp.maxMessageSize+" bytes)");return r.apply(n,arguments)}}const A=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const i=A.apply(this,arguments);return e(i,this),i},pt(t,"datachannel",n=>(e(n.channel,n.target),n))}function na(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(A){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),A&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=A)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(A=>{const n=e[A];e[A]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=i=>{const r=i.target;if(r._lastConnectionState!==r.connectionState){r._lastConnectionState=r.connectionState;const s=new Event("connectionstatechange",i);r.dispatchEvent(s)}return i},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function ia(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e.version>=605)return;const A=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(i){if(i&&i.sdp&&i.sdp.indexOf(`
42
42
  a=extmap-allow-mixed`)!==-1){const r=i.sdp.split(`
43
43
  `).filter(s=>s.trim()!=="a=extmap-allow-mixed").join(`
44
- `);t.RTCSessionDescription&&i instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:i.type,sdp:r}):i.sdp=r}return A.apply(this,arguments)}}function nr(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const A=t.RTCPeerConnection.prototype.addIceCandidate;!A||A.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():A.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ir(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const A=t.RTCPeerConnection.prototype.setLocalDescription;!A||A.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return A.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?A.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>A.apply(this,[s]))})}var bw=Object.freeze({__proto__:null,removeExtmapAllowMixed:ia,shimAddIceCandidateNullOrEmpty:nr,shimConnectionState:na,shimMaxMessageSize:Ar,shimParameterlessSetLocalDescription:ir,shimRTCIceCandidate:er,shimRTCIceCandidateRelayProtocol:ta,shimSendThrowTypeError:tr});function yw(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const A=_u,n=Bw(t),i={browserDetails:n,commonShim:bw,extractVersion:$i,disableLog:pw,disableWarnings:mw,sdp:ww};switch(n.browser){case"chrome":if(!Wu||!$s||!e.shimChrome)return A("Chrome shim is not included in this adapter release."),i;if(n.version===null)return A("Chrome shim can not determine version, not shimming."),i;A("adapter.js shimming chrome."),i.browserShim=Wu,nr(t,n),ir(t),Hu(t,n),Ou(t),$s(t,n),Mu(t),Gu(t,n),Nu(t),Ku(t),ju(t,n),er(t),ta(t),na(t),Ar(t,n),tr(t),ia(t,n);break;case"firefox":if(!nd||!ea||!e.shimFirefox)return A("Firefox shim is not included in this adapter release."),i;A("adapter.js shimming firefox."),i.browserShim=nd,nr(t,n),ir(t),Ju(t,n),ea(t,n),Xu(t),zu(t),qu(t),Yu(t),Zu(t),$u(t),ed(t),Ad(t),td(t),er(t),na(t),Ar(t,n),tr(t);break;case"safari":if(!hd||!e.shimSafari)return A("Safari shim is not included in this adapter release."),i;A("adapter.js shimming safari."),i.browserShim=hd,nr(t,n),ir(t),cd(t),ud(t),sd(t),id(t),rd(t),ld(t),ad(t),dd(t),er(t),ta(t),Ar(t,n),tr(t),ia(t,n);break;default:A("Unsupported browser!");break}return i}yw({window:typeof window>"u"?void 0:window});const Uw=10,rr="lk_e2ee",Qw={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:Uw,keyringSize:16};var qA;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(qA||(qA={}));var pd;(function(t){t.KeyRatcheted="keyRatcheted"})(pd||(pd={}));var YA;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(YA||(YA={}));var md;(function(t){t.Error="cryptorError"})(md||(md={}));function Ew(){return Sw()||ra()}function ra(){return typeof window.RTCRtpScriptTransform<"u"}function Sw(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class DU extends yA.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(A,n,i)=>{W.debug("key ratcheted event received",{ratchetResult:A,participantId:n,keyIndex:i})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Qw),e),this.on(qA.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,A,n){const i={key:e,participantIdentity:A,keyIndex:n};if(!this.options.sharedKey&&!A)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(A??"shared","-").concat(n??0),i),this.emit(qA.SetKey,i)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,A){this.emit(qA.RatchetRequest,e,A)}}class zA extends Error{constructor(e,A){super(A||"an error has occured"),this.name="LiveKitError",this.code=e}}var J;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest"})(J||(J={}));class Ae extends zA{constructor(e,A,n,i){super(1,e),this.name="ConnectionError",this.status=n,this.reason=A,this.context=i,this.reasonName=J[A]}}class sa extends zA{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class IA extends zA{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class kw extends zA{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class ye extends zA{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class aa extends zA{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class oa extends zA{constructor(e,A){super(15,e),this.name="PublishTrackError",this.status=A}}class Bd extends zA{constructor(e,A){super(15,e),this.reason=A,this.reasonName=typeof A=="string"?A:qs[A]}}var sr;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(sr||(sr={})),function(t){function e(A){if(A&&"name"in A)return A.name==="NotFoundError"||A.name==="DevicesNotFoundError"?t.NotFound:A.name==="NotAllowedError"||A.name==="PermissionDeniedError"?t.PermissionDenied:A.name==="NotReadableError"||A.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e}(sr||(sr={}));var vd;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(vd||(vd={}));var I;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(I||(I={}));var P;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(P||(P={}));var _;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved"})(_||(_={}));var x;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate"})(x||(x={}));function Tw(t){return typeof t>"u"?t:typeof structuredClone=="function"?structuredClone(t):JSON.parse(JSON.stringify(t))}const Fw=/version\/(\d+(\.?_?\d+)+)/i;let ca;function uA(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof t>"u"&&typeof navigator>"u")return;const A=(t??navigator.userAgent).toLowerCase();if(ca===void 0||e){const n=Iw.find(i=>{let{test:r}=i;return r.test(A)});ca=n==null?void 0:n.describe(A)}return ca}const Iw=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:ar(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:la(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:ar(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:la(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:ar(Fw,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:la(t)}}}];function ar(t,e){let A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const n=e.match(t);return n&&n.length>=A&&n[A]||""}function la(t){return t.includes("mac os")?ar(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var xw="2.13.0";const _w=xw,Pw=16;class Te{}Te.setTimeout=function(){return setTimeout(...arguments)},Te.setInterval=function(){return setInterval(...arguments)},Te.clearTimeout=function(){return clearTimeout(...arguments)},Te.clearInterval=function(){return clearInterval(...arguments)};const Rw=5e3,En=[];var AA;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(AA||(AA={}));class k extends yA.EventEmitter{constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=k.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=W,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),Rw):this.handleAppVisibilityChanged()},this.log=FA((i=n.loggerName)!==null&&i!==void 0?i:lA.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=A,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=k.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),z(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let A="audio";this.kind===k.Kind.Video&&(A="video"),this.attachedElements.length===0&&this.kind===k.Kind.Video&&this.addAppVisibilityListener(),e||(A==="audio"&&(En.forEach(r=>{r.parentElement===null&&!e&&(e=r)}),e&&En.splice(En.indexOf(e),1)),e||(e=document.createElement(A))),this.attachedElements.includes(e)||this.attachedElements.push(e),Kt(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),i=n.some(r=>r.kind==="audio");return e.play().then(()=>{this.emit(i?x.AudioPlaybackStarted:x.VideoPlaybackStarted)}).catch(r=>{r.name==="NotAllowedError"?this.emit(i?x.AudioPlaybackFailed:x.VideoPlaybackFailed,r):r.name==="AbortError"?W.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):W.warn("could not playback ".concat(i?"audio":"video"),r),i&&e&&n.some(s=>s.kind==="video")&&r.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(x.ElementAttached,e),e}detach(e){try{if(e){Vt(this.mediaStreamTrack,e);const n=this.attachedElements.indexOf(e);return n>=0&&(this.attachedElements.splice(n,1),this.recycleElement(e),this.emit(x.ElementDetached,e)),e}const A=[];return this.attachedElements.forEach(n=>{Vt(this.mediaStreamTrack,n),A.push(n),this.recycleElement(n),this.emit(x.ElementDetached,n)}),this.attachedElements=[],A}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=FA(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let A=!0;e.pause(),En.forEach(n=>{n.parentElement||(A=!1)}),A&&En.push(e)}}handleAppVisibilityChanged(){return C(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===k.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Ve()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Ve()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Kt(t,e){let A;e.srcObject instanceof MediaStream?A=e.srcObject:A=new MediaStream;let n;t.kind==="audio"?n=A.getAudioTracks():n=A.getVideoTracks(),n.includes(t)||(n.forEach(i=>{A.removeTrack(i)}),A.addTrack(t)),(!ZA()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=A.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==A&&(e.srcObject=A,(ZA()||Gt())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=A,e.play().catch(()=>{})},0))}function Vt(t,e){if(e.srcObject instanceof MediaStream){const A=e.srcObject;A.removeTrack(t),A.getTracks().length>0?e.srcObject=A:e.srcObject=null}}(function(t){let e;(function(c){c.Audio="audio",c.Video="video",c.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let A;(function(c){c.Camera="camera",c.Microphone="microphone",c.ScreenShare="screen_share",c.ScreenShareAudio="screen_share_audio",c.Unknown="unknown"})(A=t.Source||(t.Source={}));let n;(function(c){c.Active="active",c.Paused="paused",c.Unknown="unknown"})(n=t.StreamState||(t.StreamState={}));function i(c){switch(c){case e.Audio:return sA.AUDIO;case e.Video:return sA.VIDEO;default:return sA.DATA}}t.kindToProto=i;function r(c){switch(c){case sA.AUDIO:return e.Audio;case sA.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=r;function s(c){switch(c){case A.Camera:return Be.CAMERA;case A.Microphone:return Be.MICROPHONE;case A.ScreenShare:return Be.SCREEN_SHARE;case A.ScreenShareAudio:return Be.SCREEN_SHARE_AUDIO;default:return Be.UNKNOWN}}t.sourceToProto=s;function a(c){switch(c){case Be.CAMERA:return A.Camera;case Be.MICROPHONE:return A.Microphone;case Be.SCREEN_SHARE:return A.ScreenShare;case Be.SCREEN_SHARE_AUDIO:return A.ScreenShareAudio;default:return A.Unknown}}t.sourceFromProto=a;function o(c){switch(c){case Ks.ACTIVE:return n.Active;case Ks.PAUSED:return n.Paused;default:return n.Unknown}}t.streamStateFromProto=o})(k||(k={}));class ee{constructor(e,A,n,i,r){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(A!==void 0&&n!==void 0)this.width=e,this.height=A,this.aspectRatio=e/A,this.encoding={maxBitrate:n,maxFramerate:i,priority:r};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const Lw=["vp8","h264"],Dw=["vp8","h264","vp9","av1"];function Hw(t){return!!Lw.find(e=>e===t)}var Cd;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(Cd||(Cd={}));var ua;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(ua||(ua={}));const Sn={h90:new ee(160,90,9e4,20),h180:new ee(320,180,16e4,20),h216:new ee(384,216,18e4,20),h360:new ee(640,360,45e4,20),h540:new ee(960,540,8e5,25),h720:new ee(1280,720,17e5,30),h1080:new ee(1920,1080,3e6,30),h1440:new ee(2560,1440,5e6,30),h2160:new ee(3840,2160,8e6,30)},da={h120:new ee(160,120,7e4,20),h180:new ee(240,180,125e3,20),h240:new ee(320,240,14e4,20),h360:new ee(480,360,33e4,20),h480:new ee(640,480,5e5,20),h540:new ee(720,540,6e5,25),h720:new ee(960,720,13e5,30),h1080:new ee(1440,1080,23e5,30),h1440:new ee(1920,1440,38e5,30)},ha={h360fps3:new ee(640,360,2e5,3,"medium"),h360fps15:new ee(640,360,4e5,15,"medium"),h720fps5:new ee(1280,720,8e5,5,"medium"),h720fps15:new ee(1280,720,15e5,15,"medium"),h720fps30:new ee(1280,720,2e6,30,"medium"),h1080fps15:new ee(1920,1080,25e5,15,"medium"),h1080fps30:new ee(1920,1080,5e6,30,"medium"),original:new ee(0,0,7e6,30,"medium")},Ow="|",wd="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function Mw(t){const e=t.split(Ow);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function Ke(t){return C(this,void 0,void 0,function*(){return new Promise(e=>Te.setTimeout(e,t))})}function fa(){return"addTransceiver"in RTCPeerConnection.prototype}function ga(){return"addTrack"in RTCPeerConnection.prototype}function Nw(){if(!("getCapabilities"in RTCRtpSender)||ZA())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const A of t.codecs)if(A.mimeType==="video/AV1"){e=!0;break}}return e}function Kw(){if(!("getCapabilities"in RTCRtpSender)||Gt())return!1;if(ZA()){const A=uA();if(A!=null&&A.version&&mt(A.version,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const A of t.codecs)if(A.mimeType==="video/VP9"){e=!0;break}}return e}function kn(t){return t==="av1"||t==="vp9"}function pa(t){return document?(t||(t=document.createElement("audio")),"setSinkId"in t):!1}function Vw(){return typeof RTCPeerConnection>"u"?!1:fa()||ga()}function Gt(){var t;return((t=uA())===null||t===void 0?void 0:t.name)==="Firefox"}function ZA(){var t;return((t=uA())===null||t===void 0?void 0:t.name)==="Safari"}function Gw(){const t=uA();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")}function bd(){var t,e;return Ve()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function jw(){const t=uA(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&mt(e,t.osVersion)>=0?!0:t.name==="Safari"&&mt(e,t.version)>=0}function Ve(){return typeof document<"u"}function UA(){return navigator.product=="ReactNative"}function ma(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function yd(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Ud(){if(!UA())return;let t=yd();if(t)return t.platform}function Qd(){if(Ve())return window.devicePixelRatio;if(UA()){let t=yd();if(t)return t.devicePixelRatio}return 1}function mt(t,e){const A=t.split("."),n=e.split("."),i=Math.min(A.length,n.length);for(let r=0;r<i;++r){const s=parseInt(A[r],10),a=parseInt(n[r],10);if(s>a)return 1;if(s<a)return-1;if(r===i-1&&s===a)return 0}return t===""&&e!==""?-1:e===""?1:A.length==n.length?0:A.length<n.length?-1:1}function Ww(t){for(const e of t)e.target.handleResize(e)}function Jw(t){for(const e of t)e.target.handleVisibilityChanged(e)}let Ba=null;const Ed=()=>(Ba||(Ba=new ResizeObserver(Ww)),Ba);let va=null;const Sd=()=>(va||(va=new IntersectionObserver(Jw,{root:null,rootMargin:"0px"})),va);function Xw(){var t;const e=new DC({sdk:uu.JS,protocol:Pw,version:_w});return UA()&&(e.os=(t=Ud())!==null&&t!==void 0?t:""),e}function kd(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const i=document.createElement("canvas");i.width=t,i.height=e;const r=i.getContext("2d");r==null||r.fillRect(0,0,i.width,i.height),n&&r&&(r.beginPath(),r.arc(t/2,e/2,50,0,Math.PI*2,!0),r.closePath(),r.fillStyle="grey",r.fill());const s=i.captureStream(),[a]=s.getTracks();if(!a)throw Error("Could not get empty media stream video track");return a.enabled=A,a}let Tn;function Ca(){if(!Tn){const t=new AudioContext,e=t.createOscillator(),A=t.createGain();A.gain.setValueAtTime(0,0);const n=t.createMediaStreamDestination();if(e.connect(A),A.connect(n),e.start(),[Tn]=n.stream.getAudioTracks(),!Tn)throw Error("Could not get empty media stream audio track");Tn.enabled=!1}return Tn.clone()}class wa{constructor(e,A){this.onFinally=A,this.promise=new Promise((n,i)=>C(this,void 0,void 0,function*(){this.resolve=n,this.reject=i,e&&(yield e(n,i))})).finally(()=>{var n;return(n=this.onFinally)===null||n===void 0?void 0:n.call(this)})}}function qw(t){return Dw.includes(t)}function $A(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function Yw(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function ba(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function zw(t,e){return t.segments.map(A=>{let{id:n,text:i,language:r,startTime:s,endTime:a,final:o}=A;var c;const l=(c=e.get(n))!==null&&c!==void 0?c:Date.now(),u=Date.now();return o?e.delete(n):e.set(n,l),{id:n,text:i,startTime:Number.parseInt(s.toString()),endTime:Number.parseInt(a.toString()),final:o,language:r,firstReceivedTime:l,lastReceivedTime:u}})}function Zw(t){const{id:e,timestamp:A,message:n,editTimestamp:i}=t;return{id:e,timestamp:Number.parseInt(A.toString()),editTimestamp:i?Number.parseInt(i.toString()):void 0,message:n}}function Td(t){switch(t.reason){case J.LeaveRequest:return t.context;case J.Cancelled:return aA.CLIENT_INITIATED;case J.NotAllowed:return aA.USER_REJECTED;case J.ServerUnreachable:return aA.JOIN_FAILURE;default:return aA.UNKNOWN_REASON}}function or(t){return t!==void 0?Number(t):void 0}function Bt(t){return t!==void 0?BigInt(t):void 0}function jt(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function xA(t){return!!t&&t.kind==k.Kind.Audio}function Wt(t){return!!t&&t.kind==k.Kind.Video}function et(t){return jt(t)&&Wt(t)}function vt(t){return jt(t)&&xA(t)}function ya(t){return!!t&&!t.isLocal}function $w(t){return!!t&&!t.isLocal}function Ua(t){return ya(t)&&Wt(t)}function eb(t){return t.isLocal}function Ab(t,e){const A=[];let n=new TextEncoder().encode(t);for(;n.length>e;){let i=e;for(;i>0;){const r=n[i];if(r!==void 0&&(r&192)!==128)break;i--}A.push(n.slice(0,i)),n=n.slice(i)}return n.length>0&&A.push(n),A}function Fd(t,e,A){var n,i,r,s;const{optionsWithoutProcessor:a,audioProcessor:o,videoProcessor:c}=Pd(t??{}),l=e==null?void 0:e.processor,u=A==null?void 0:A.processor,d=a??{};return d.audio===!0&&(d.audio={}),d.video===!0&&(d.video={}),d.audio&&(Qa(d.audio,e),(n=(r=d.audio).deviceId)!==null&&n!==void 0||(r.deviceId={ideal:"default"}),(o||l)&&(d.audio.processor=o??l)),d.video&&(Qa(d.video,A),(i=(s=d.video).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(c||u)&&(d.video.processor=c??u)),d}function Qa(t,e){return Object.keys(e).forEach(A=>{t[A]===void 0&&(t[A]=e[A])}),t}function Ea(t){var e,A,n,i;const r={};if(t.video)if(typeof t.video=="object"){const s={},a=s,o=t.video;Object.keys(o).forEach(c=>{switch(c){case"resolution":Qa(a,o.resolution);break;default:a[c]=o[c]}}),r.video=s,(e=(n=r.video).deviceId)!==null&&e!==void 0||(n.deviceId={ideal:"default"})}else r.video=t.video?{deviceId:{ideal:"default"}}:!1;else r.video=!1;return t.audio?typeof t.audio=="object"?(r.audio=t.audio,(A=(i=r.audio).deviceId)!==null&&A!==void 0||(i.deviceId={ideal:"default"})):r.audio={deviceId:{ideal:"default"}}:r.audio=!1,r}function Id(t){return C(this,arguments,void 0,function(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const n=xd();if(n){const i=n.createAnalyser();i.fftSize=2048;const r=i.frequencyBinCount,s=new Uint8Array(r);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield Ke(A),i.getByteTimeDomainData(s);const o=s.some(c=>c!==128&&c!==0);return n.close(),!o}return!1}()})}function xd(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const A=new e({latencyHint:"interactive"});if(A.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const n=()=>C(this,void 0,void 0,function*(){var i;try{A.state==="suspended"&&(yield A.resume())}catch(r){console.warn("Error trying to auto-resume audio context",r)}(i=window.document.body)===null||i===void 0||i.removeEventListener("click",n)});window.document.body.addEventListener("click",n)}return A}}function tb(t){return t==="audioinput"?k.Source.Microphone:t==="videoinput"?k.Source.Camera:k.Source.Unknown}function _d(t){return t===k.Source.Microphone?"audioinput":t===k.Source.Camera?"videoinput":void 0}function nb(t){var e,A;let n=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(n=typeof n=="boolean"?{}:n,ZA()?n=Object.assign(Object.assign({},n),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):n=Object.assign(Object.assign({},n),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(A=t.audio)!==null&&A!==void 0?A:!1,video:n,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function cr(t){return t.split("/")[1].toLowerCase()}function ib(t){const e=[];return t.forEach(A=>{A.track!==void 0&&e.push(new Js({cid:A.track.mediaStreamID,track:A.trackInfo}))}),e}function z(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?z(t.track):{})}}function rb(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function sb(t,e){var A;t===void 0&&(t={}),e===void 0&&(e={});const n=[...Object.keys(e),...Object.keys(t)],i={};for(const r of n)t[r]!==e[r]&&(i[r]=(A=e[r])!==null&&A!==void 0?A:"");return i}function Pd(t){const e=Object.assign({},t);let A,n;return typeof e.audio=="object"&&e.audio.processor&&(A=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(n=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:A,videoProcessor:n,optionsWithoutProcessor:Tw(e)}}function ab(t){switch(t){case Be.CAMERA:return k.Source.Camera;case Be.MICROPHONE:return k.Source.Microphone;case Be.SCREEN_SHARE:return k.Source.ScreenShare;case Be.SCREEN_SHARE_AUDIO:return k.Source.ScreenShareAudio;default:return k.Source.Unknown}}class ob extends yA.EventEmitter{constructor(e){super(),this.onWorkerMessage=A=>{var n,i;const{kind:r,data:s}=A.data;switch(r){case"error":W.error(s.error.message),this.emit(YA.EncryptionError,s.error);break;case"initAck":s.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)});break;case"enable":if(s.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)}),this.encryptionEnabled!==s.enabled&&s.participantIdentity===((n=this.room)===null||n===void 0?void 0:n.localParticipant.identity))this.emit(YA.ParticipantEncryptionStatusChanged,s.enabled,this.room.localParticipant),this.encryptionEnabled=s.enabled;else if(s.participantIdentity){const a=(i=this.room)===null||i===void 0?void 0:i.getParticipantByIdentity(s.participantIdentity);if(!a)throw TypeError("couldn't set encryption status, participant not found".concat(s.participantIdentity));this.emit(YA.ParticipantEncryptionStatusChanged,s.enabled,a)}break;case"ratchetKey":this.keyProvider.emit(qA.KeyRatcheted,s.ratchetResult,s.participantIdentity,s.keyIndex);break}},this.onWorkerError=A=>{W.error("e2ee worker encountered an error:",{error:A.error}),this.emit(YA.EncryptionError,A.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!Ew())throw new sa("tried to setup end-to-end encryption on an unsupported browser");if(W.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const A={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:uw.getLevel()}};this.worker&&(W.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(A))}}setParticipantCryptorEnabled(e,A){W.debug("set e2ee to ".concat(e," for participant ").concat(A)),this.postEnable(e,A)}setSifTrailer(e){!e||e.length===0?W.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(_.RTPVideoMapUpdate,A=>{this.postRTPMap(A)})}setupEventListeners(e,A){e.on(I.TrackPublished,(n,i)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==qe.NONE,i.identity)),e.on(I.ConnectionStateChanged,n=>{n===q.Connected&&e.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{this.setParticipantCryptorEnabled(r.trackInfo.encryption!==qe.NONE,i.identity)})})}).on(I.TrackUnsubscribed,(n,i,r)=>{var s;const a={kind:"removeTransform",data:{participantIdentity:r.identity,trackId:n.mediaStreamID}};(s=this.worker)===null||s===void 0||s.postMessage(a)}).on(I.TrackSubscribed,(n,i,r)=>{this.setupE2EEReceiver(n,r.identity,i.trackInfo)}).on(I.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");A.getKeys().forEach(n=>{this.postKey(n)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(P.LocalTrackPublished,n=>C(this,void 0,void 0,function*(){this.setupE2EESender(n.track,n.track.sender)})),A.on(qA.SetKey,n=>this.postKey(n)).on(qA.RatchetRequest,(n,i)=>this.postRatchetRequest(n,i))}postRatchetRequest(e,A){if(!this.worker)throw Error("could not ratchet key, worker is missing");const n={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:A}};this.worker.postMessage(n)}postKey(e){let{key:A,participantIdentity:n,keyIndex:i}=e;var r;if(!this.worker)throw Error("could not set key, worker is missing");const s={kind:"setKey",data:{participantIdentity:n,isPublisher:n===((r=this.room)===null||r===void 0?void 0:r.localParticipant.identity),key:A,keyIndex:i}};this.worker.postMessage(s)}postEnable(e,A){if(this.worker){const n={kind:"enable",data:{enabled:e,participantIdentity:A}};this.worker.postMessage(n)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var A;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((A=this.room)===null||A===void 0)&&A.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const n={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const A={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(A)}setupE2EEReceiver(e,A,n){if(e.receiver){if(!(n!=null&&n.mimeType)||n.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,A,e.kind==="video"?cr(n.mimeType):void 0)}}setupE2EESender(e,A){if(!jt(e)||!A){A||W.warn("early return because sender is not ready");return}this.handleSender(A,e.mediaStreamID,void 0)}handleReceiver(e,A,n,i){return C(this,void 0,void 0,function*(){if(this.worker){if(ra()){const r={kind:"decode",participantIdentity:n,trackId:A,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{if(rr in e&&i){const o={kind:"updateCodec",data:{trackId:A,codec:i,participantIdentity:n}};this.worker.postMessage(o);return}let r=e.writableStream,s=e.readableStream;if(!r||!s){const o=e.createEncodedStreams();e.writableStream=o.writable,r=o.writable,e.readableStream=o.readable,s=o.readable}const a={kind:"decode",data:{readableStream:s,writableStream:r,trackId:A,codec:i,participantIdentity:n}};this.worker.postMessage(a,[s,r])}e[rr]=!0}})}handleSender(e,A,n){var i;if(!(rr in e||!this.worker)){if(!(!((i=this.room)===null||i===void 0)&&i.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(ra()){W.info("initialize script transform");const r={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:A,codec:n};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{W.info("initialize encoded streams");const r=e.createEncodedStreams(),s={kind:"encode",data:{readableStream:r.readable,writableStream:r.writable,codec:n,trackId:A,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(s,[r.readable,r.writable])}e[rr]=!0}}}const Sa="default";class Qe{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new Qe),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return C(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;if(((r=Qe.userMediaPromiseMap)===null||r===void 0?void 0:r.size)>0){W.debug("awaiting getUserMedia promise");try{A?yield Qe.userMediaPromiseMap.get(A):yield Promise.all(Qe.userMediaPromiseMap.values())}catch{W.warn("error waiting for media permissons")}}let s=yield navigator.mediaDevices.enumerateDevices();if(i&&!(ZA()&&n.hasDeviceInUse(A))&&(s.filter(o=>o.kind===A).length===0||s.some(o=>{const c=o.label==="",l=A?o.kind===A:!0;return c&&l}))){const o={video:A!=="audioinput"&&A!=="audiooutput",audio:A!=="videoinput"&&{deviceId:{ideal:"default"}}},c=yield navigator.mediaDevices.getUserMedia(o);s=yield navigator.mediaDevices.enumerateDevices(),c.getTracks().forEach(l=>{l.stop()})}return n._previousDevices=s,A&&(s=s.filter(a=>a.kind===A)),s}()})}normalizeDeviceId(e,A,n){return C(this,void 0,void 0,function*(){if(A!==Sa)return A;const i=yield this.getDevices(e),r=i.find(a=>a.deviceId===Sa);if(!r){W.warn("could not reliably determine default device");return}const s=i.find(a=>a.deviceId!==Sa&&a.groupId===(n??r.groupId));if(!s){W.warn("could not reliably determine default device");return}return s==null?void 0:s.deviceId})}hasDeviceInUse(e){return e?Qe.userMediaPromiseMap.has(e):Qe.userMediaPromiseMap.size>0}}Qe.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],Qe.userMediaPromiseMap=new Map;var Fn;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(Fn||(Fn={}));class cb{constructor(){this.pendingTasks=new Map,this.taskMutex=new Oe,this.nextTaskIndex=0}run(e){return C(this,void 0,void 0,function*(){const A={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:Fn.WAITING};this.pendingTasks.set(A.id,A);const n=yield this.taskMutex.lock();try{return A.executedAt=Date.now(),A.status=Fn.RUNNING,yield e()}finally{A.status=Fn.COMPLETED,this.pendingTasks.delete(A.id),n()}})}flush(){return C(this,void 0,void 0,function*(){return this.run(()=>C(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function lb(t,e){const A=new URL(Yw(t));return e.forEach((n,i)=>{A.searchParams.set(i,n)}),Rd(A,"rtc")}function ub(t){const e=new URL(ba(t));return Rd(e,"validate")}function db(t){return t.endsWith("/")?t:"".concat(t,"/")}function Rd(t,e){return t.pathname="".concat(db(t.pathname)).concat(e),t.toString()}const hb=["syncState","trickle","offer","answer","simulate","leave"];function fb(t){const e=hb.indexOf(t.case)>=0;return W.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var ne;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(ne||(ne={}));class ka{get currentState(){return this.state}get isDisconnected(){return this.state===ne.DISCONNECTING||this.state===ne.DISCONNECTED}get isEstablishingConnection(){return this.state===ne.CONNECTING||this.state===ne.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;this.rtt=0,this.state=ne.DISCONNECTED,this.log=W,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=FA((n=A.loggerName)!==null&&n!==void 0?n:lA.Signal),this.loggerContextCb=A.loggerContextCb,this.useJSON=e,this.requestQueue=new cb,this.queuedRequests=[],this.closingLock=new Oe,this.connectionLock=new Oe,this.state=ne.DISCONNECTED}get logContext(){var e,A;return(A=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&A!==void 0?A:{}}join(e,A,n,i){return C(this,void 0,void 0,function*(){return this.state=ne.CONNECTING,this.options=n,yield this.connect(e,A,n,i)})}reconnect(e,A,n,i){return C(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=ne.RECONNECTING,this.clearPingInterval(),yield this.connect(e,A,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:i}))})}connect(e,A,n,i){this.connectOptions=n;const r=Xw(),s=gb(A,r,n),a=lb(e,s),o=ub(a);return new Promise((c,l)=>C(this,void 0,void 0,function*(){const u=yield this.connectionLock.lock();try{const d=()=>C(this,void 0,void 0,function*(){this.close(),clearTimeout(h),l(new Ae("room connection has been cancelled (signal)",J.Cancelled))}),h=setTimeout(()=>{this.close(),l(new Ae("room connection has timed out (signal)",J.ServerUnreachable))},n.websocketTimeout);i!=null&&i.aborted&&d(),i==null||i.addEventListener("abort",d);const p=new URL(a);p.searchParams.has("access_token")&&p.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(p),Object.assign({reconnect:n.reconnect,reconnectReason:n.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(a),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(h)},this.ws.onerror=f=>C(this,void 0,void 0,function*(){if(this.state!==ne.CONNECTED){this.state=ne.DISCONNECTED,clearTimeout(h);try{const m=yield fetch(o);if(m.status.toFixed(0).startsWith("4")){const B=yield m.text();l(new Ae(B,J.NotAllowed,m.status))}else l(new Ae("Encountered unknown websocket error during connection: ".concat(f.toString()),J.InternalError,m.status))}catch(m){l(new Ae(m instanceof Error?m.message:"server was not reachable",J.ServerUnreachable))}return}this.handleWSError(f)}),this.ws.onmessage=f=>C(this,void 0,void 0,function*(){var m,B,b;let U;if(typeof f.data=="string"){const w=JSON.parse(f.data);U=mu.fromJson(w,{ignoreUnknownFields:!0})}else if(f.data instanceof ArrayBuffer)U=mu.fromBinary(new Uint8Array(f.data));else{this.log.error("could not decode websocket message: ".concat(typeof f.data),this.logContext);return}if(this.state!==ne.CONNECTED){let w=!1;if(((m=U.message)===null||m===void 0?void 0:m.case)==="join"?(this.state=ne.CONNECTED,i==null||i.removeEventListener("abort",d),this.pingTimeoutDuration=U.message.value.pingTimeout,this.pingIntervalDuration=U.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),c(U.message.value)):this.state===ne.RECONNECTING&&U.message.case!=="leave"?(this.state=ne.CONNECTED,i==null||i.removeEventListener("abort",d),this.startPingInterval(),((B=U.message)===null||B===void 0?void 0:B.case)==="reconnect"?c(U.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),c(void 0),w=!0)):this.isEstablishingConnection&&U.message.case==="leave"?l(new Ae("Received leave request while trying to (re)connect",J.LeaveRequest,void 0,U.message.value.reason)):n.reconnect||l(new Ae("did not receive join response, got ".concat((b=U.message)===null||b===void 0?void 0:b.case," instead"),J.InternalError)),!w)return}this.signalLatency&&(yield Ke(this.signalLatency)),this.handleSignalResponse(U)}),this.ws.onclose=f=>{this.isEstablishingConnection&&l(new Ae("Websocket got closed during a (re)connection attempt",J.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:f.reason,code:f.code,wasClean:f.wasClean,state:this.state})),this.handleOnClose(f.reason)}}finally{u()}}))}close(){return C(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const n=yield e.closingLock.lock();try{if(e.clearPingInterval(),A&&(e.state=ne.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const i=new Promise(r=>{e.ws?e.ws.onclose=()=>{r()}:r()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([i,Ke(250)])),e.ws=void 0}}finally{A&&(e.state=ne.DISCONNECTED),n()}}()})}sendOffer(e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:lr(e)})}sendAnswer(e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:lr(e)})}sendIceCandidate(e,A){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new js({candidateInit:JSON.stringify(e),target:A})})}sendMuteTrack(e,A){return this.sendRequest({case:"mute",value:new Ws({sid:e,muted:A})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,A){return C(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const a=r.getNextRequestId();return yield r.sendRequest({case:"updateMetadata",value:new wu({requestId:a,metadata:n,name:i,attributes:s})}),a}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,A){return this.sendRequest({case:"updateLayers",value:new Cu({trackSid:e,layers:A})})}sendUpdateSubscriptionPermissions(e,A){return this.sendRequest({case:"subscriptionPermission",value:new Uu({allParticipants:e,trackPermissions:A})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:re.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new Su({timestamp:re.parse(Date.now()),rtt:re.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,A){return this.sendRequest({case:"updateAudioTrack",value:new vu({trackSid:e,features:A})})}sendLeave(){return this.sendRequest({case:"leave",value:new qi({reason:aA.CLIENT_INITIATED,action:Mt.DISCONNECT})})}sendRequest(e){return C(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!i&&!fb(A)&&n.state===ne.RECONNECTING){n.queuedRequests.push(()=>C(n,void 0,void 0,function*(){yield this.sendRequest(A,!0)}));return}if(i||(yield n.requestQueue.flush()),n.signalLatency&&(yield Ke(n.signalLatency)),!n.ws||n.ws.readyState!==n.ws.OPEN){n.log.error("cannot send signal request before connected, type: ".concat(A==null?void 0:A.case),n.logContext);return}const s=new MC({message:A});try{n.useJSON?n.ws.send(s.toJsonString()):n.ws.send(s.toBinary())}catch(a){n.log.error("error sending signal message",Object.assign(Object.assign({},n.logContext),{error:a}))}}()})}handleSignalResponse(e){var A,n;const i=e.message;if(i==null){this.log.debug("received unsupported message",this.logContext);return}let r=!1;if(i.case==="answer"){const s=Ld(i.value);this.onAnswer&&this.onAnswer(s)}else if(i.case==="offer"){const s=Ld(i.value);this.onOffer&&this.onOffer(s)}else if(i.case==="trickle"){const s=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(s,i.value.target)}else i.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((A=i.value.participants)!==null&&A!==void 0?A:[]):i.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):i.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((n=i.value.speakers)!==null&&n!==void 0?n:[]):i.case==="leave"?this.onLeave&&this.onLeave(i.value):i.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):i.case==="roomUpdate"?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):i.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(i.value):i.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):i.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):i.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):i.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(i.value):i.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):i.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(i.value):i.case==="pong"||(i.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),r=!0):i.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(i.value):i.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):i.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:i.case})));r||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return C(this,void 0,void 0,function*(){if(this.state===ne.DISCONNECTED)return;const A=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),A&&A(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Te.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Te.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Te.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Te.clearInterval(this.pingInterval)}}function Ld(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function lr(t){return new gt({sdp:t.sdp,type:t.type})}function gb(t,e,A){var n;const i=new URLSearchParams;return i.set("access_token",t),A.reconnect&&(i.set("reconnect","1"),A.sid&&i.set("sid",A.sid)),i.set("auto_subscribe",A.autoSubscribe?"1":"0"),i.set("sdk",UA()?"reactnative":"js"),i.set("version",e.version),i.set("protocol",e.protocol.toString()),e.deviceModel&&i.set("device_model",e.deviceModel),e.os&&i.set("os",e.os),e.osVersion&&i.set("os_version",e.osVersion),e.browser&&i.set("browser",e.browser),e.browserVersion&&i.set("browser_version",e.browserVersion),A.adaptiveStream&&i.set("adaptive_stream","1"),A.reconnectReason&&i.set("reconnect_reason",A.reconnectReason.toString()),!((n=navigator.connection)===null||n===void 0)&&n.type&&i.set("network",navigator.connection.type),i}var dA={},Ta={},Fa={exports:{}},Dd;function Ia(){if(Dd)return Fa.exports;Dd=1;var t=Fa.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var A="candidate:%s %d %s %d %s %d typ %s";return A+=e.raddr!=null?" raddr %s rport %d":"%v%v",A+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(A+=" generation %d"),A+=e["network-id"]!=null?" network-id %d":"%v",A+=e["network-cost"]!=null?" network-cost %d":"%v",A}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var A="ssrc:%d";return e.attribute!=null&&(A+=" %s",e.value!=null&&(A+=":%s")),A}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var A="mediaclk:";return A+=e.id!=null?"id=%s %s":"%v%s",A+=e.mediaClockValue!=null?"=%s":"",A+=e.rateNumerator!=null?" rate=%s":"",A+=e.rateDenominator!=null?"/%s":"",A}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var A=t[e];A.forEach(function(n){n.reg||(n.reg=/(.*)/),n.format||(n.format="%s")})}),Fa.exports}var Hd;function pb(){return Hd||(Hd=1,function(t){var e=function(a){return String(Number(a))===a?Number(a):a},A=function(a,o,c,l){if(l&&!c)o[l]=e(a[1]);else for(var u=0;u<c.length;u+=1)a[u+1]!=null&&(o[c[u]]=e(a[u+1]))},n=function(a,o,c){var l=a.name&&a.names;a.push&&!o[a.push]?o[a.push]=[]:l&&!o[a.name]&&(o[a.name]={});var u=a.push?{}:l?o[a.name]:o;A(c.match(a.reg),u,a.names,a.name),a.push&&o[a.push].push(u)},i=Ia(),r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(a){var o={},c=[],l=o;return a.split(/(\r\n|\r|\n)/).filter(r).forEach(function(u){var d=u[0],h=u.slice(2);d==="m"&&(c.push({rtp:[],fmtp:[]}),l=c[c.length-1]);for(var p=0;p<(i[d]||[]).length;p+=1){var f=i[d][p];if(f.reg.test(h))return n(f,l,h)}}),o.media=c,o};var s=function(a,o){var c=o.split(/=(.+)/,2);return c.length===2?a[c[0]]=e(c[1]):c.length===1&&o.length>1&&(a[c[0]]=void 0),a};t.parseParams=function(a){return a.split(/;\s?/).reduce(s,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(a){return a.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(a){for(var o=[],c=a.split(" ").map(e),l=0;l<c.length;l+=3)o.push({component:c[l],ip:c[l+1],port:c[l+2]});return o},t.parseImageAttributes=function(a){return a.split(" ").map(function(o){return o.substring(1,o.length-1).split(",").reduce(s,{})})},t.parseSimulcastStreamList=function(a){return a.split(";").map(function(o){return o.split(",").map(function(c){var l,u=!1;return c[0]!=="~"?l=e(c):(l=e(c.substring(1,c.length)),u=!0),{scid:l,paused:u}})})}}(Ta)),Ta}var xa,Od;function mb(){if(Od)return xa;Od=1;var t=Ia(),e=/%[sdv%]/g,A=function(s){var a=1,o=arguments,c=o.length;return s.replace(e,function(l){if(a>=c)return l;var u=o[a];switch(a+=1,l){case"%%":return"%";case"%s":return String(u);case"%d":return Number(u);case"%v":return""}})},n=function(s,a,o){var c=a.format instanceof Function?a.format(a.push?o:o[a.name]):a.format,l=[s+"="+c];if(a.names)for(var u=0;u<a.names.length;u+=1){var d=a.names[u];a.name?l.push(o[a.name][d]):l.push(o[a.names[u]])}else l.push(o[a.name]);return A.apply(null,l)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],r=["i","c","b","a"];return xa=function(s,a){a=a||{},s.version==null&&(s.version=0),s.name==null&&(s.name=" "),s.media.forEach(function(u){u.payloads==null&&(u.payloads="")});var o=a.outerOrder||i,c=a.innerOrder||r,l=[];return o.forEach(function(u){t[u].forEach(function(d){d.name in s&&s[d.name]!=null?l.push(n(u,d,s)):d.push in s&&s[d.push]!=null&&s[d.push].forEach(function(h){l.push(n(u,d,h))})})}),s.media.forEach(function(u){l.push(n("m",t.m[0],u)),c.forEach(function(d){t[d].forEach(function(h){h.name in u&&u[h.name]!=null?l.push(n(d,h,u)):h.push in u&&u[h.push]!=null&&u[h.push].forEach(function(p){l.push(n(d,h,p))})})})}),l.join(`\r
44
+ `);t.RTCSessionDescription&&i instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:i.type,sdp:r}):i.sdp=r}return A.apply(this,arguments)}}function nr(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const A=t.RTCPeerConnection.prototype.addIceCandidate;!A||A.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():A.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ir(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const A=t.RTCPeerConnection.prototype.setLocalDescription;!A||A.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let i=arguments[0]||{};if(typeof i!="object"||i.type&&i.sdp)return A.apply(this,arguments);if(i={type:i.type,sdp:i.sdp},!i.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer";break}return i.sdp||i.type!=="offer"&&i.type!=="answer"?A.apply(this,[i]):(i.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(s=>A.apply(this,[s]))})}var bw=Object.freeze({__proto__:null,removeExtmapAllowMixed:ia,shimAddIceCandidateNullOrEmpty:nr,shimConnectionState:na,shimMaxMessageSize:Ar,shimParameterlessSetLocalDescription:ir,shimRTCIceCandidate:er,shimRTCIceCandidateRelayProtocol:ta,shimSendThrowTypeError:tr});function yw(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const A=_u,n=Bw(t),i={browserDetails:n,commonShim:bw,extractVersion:$i,disableLog:pw,disableWarnings:mw,sdp:ww};switch(n.browser){case"chrome":if(!Wu||!$s||!e.shimChrome)return A("Chrome shim is not included in this adapter release."),i;if(n.version===null)return A("Chrome shim can not determine version, not shimming."),i;A("adapter.js shimming chrome."),i.browserShim=Wu,nr(t,n),ir(t),Hu(t,n),Ou(t),$s(t,n),Mu(t),Gu(t,n),Nu(t),Ku(t),ju(t,n),er(t),ta(t),na(t),Ar(t,n),tr(t),ia(t,n);break;case"firefox":if(!nd||!ea||!e.shimFirefox)return A("Firefox shim is not included in this adapter release."),i;A("adapter.js shimming firefox."),i.browserShim=nd,nr(t,n),ir(t),Ju(t,n),ea(t,n),Xu(t),zu(t),qu(t),Yu(t),Zu(t),$u(t),ed(t),Ad(t),td(t),er(t),na(t),Ar(t,n),tr(t);break;case"safari":if(!hd||!e.shimSafari)return A("Safari shim is not included in this adapter release."),i;A("adapter.js shimming safari."),i.browserShim=hd,nr(t,n),ir(t),cd(t),ud(t),sd(t),id(t),rd(t),ld(t),ad(t),dd(t),er(t),ta(t),Ar(t,n),tr(t),ia(t,n);break;default:A("Unsupported browser!");break}return i}yw({window:typeof window>"u"?void 0:window});const Uw=10,rr="lk_e2ee",Qw={sharedKey:!1,ratchetSalt:"LKFrameEncryptionKey",ratchetWindowSize:8,failureTolerance:Uw,keyringSize:16};var qA;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(qA||(qA={}));var pd;(function(t){t.KeyRatcheted="keyRatcheted"})(pd||(pd={}));var YA;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(YA||(YA={}));var md;(function(t){t.Error="cryptorError"})(md||(md={}));function Ew(){return Sw()||ra()}function ra(){return typeof window.RTCRtpScriptTransform<"u"}function Sw(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}class DU extends yA.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(A,n,i)=>{W.debug("key ratcheted event received",{ratchetResult:A,participantId:n,keyIndex:i})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Qw),e),this.on(qA.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,A,n){const i={key:e,participantIdentity:A,keyIndex:n};if(!this.options.sharedKey&&!A)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(A??"shared","-").concat(n??0),i),this.emit(qA.SetKey,i)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,A){this.emit(qA.RatchetRequest,e,A)}}class zA extends Error{constructor(e,A){super(A||"an error has occured"),this.name="LiveKitError",this.code=e}}var J;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest"})(J||(J={}));class Ae extends zA{constructor(e,A,n,i){super(1,e),this.name="ConnectionError",this.status=n,this.reason=A,this.context=i,this.reasonName=J[A]}}class sa extends zA{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class IA extends zA{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class kw extends zA{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class ye extends zA{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class aa extends zA{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class oa extends zA{constructor(e,A){super(15,e),this.name="PublishTrackError",this.status=A}}class Bd extends zA{constructor(e,A){super(15,e),this.reason=A,this.reasonName=typeof A=="string"?A:qs[A]}}var sr;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(sr||(sr={})),function(t){function e(A){if(A&&"name"in A)return A.name==="NotFoundError"||A.name==="DevicesNotFoundError"?t.NotFound:A.name==="NotAllowedError"||A.name==="PermissionDeniedError"?t.PermissionDenied:A.name==="NotReadableError"||A.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e}(sr||(sr={}));var vd;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(vd||(vd={}));var I;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(I||(I={}));var L;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(L||(L={}));var _;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved"})(_||(_={}));var x;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate"})(x||(x={}));function Tw(t){return typeof t>"u"?t:typeof structuredClone=="function"?structuredClone(t):JSON.parse(JSON.stringify(t))}const Fw=/version\/(\d+(\.?_?\d+)+)/i;let ca;function uA(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof t>"u"&&typeof navigator>"u")return;const A=(t??navigator.userAgent).toLowerCase();if(ca===void 0||e){const n=Iw.find(i=>{let{test:r}=i;return r.test(A)});ca=n==null?void 0:n.describe(A)}return ca}const Iw=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:ar(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:la(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:ar(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:la(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:ar(Fw,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:la(t)}}}];function ar(t,e){let A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const n=e.match(t);return n&&n.length>=A&&n[A]||""}function la(t){return t.includes("mac os")?ar(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var xw="2.13.0";const _w=xw,Pw=16;class Te{}Te.setTimeout=function(){return setTimeout(...arguments)},Te.setInterval=function(){return setInterval(...arguments)},Te.clearTimeout=function(){return clearTimeout(...arguments)},Te.clearInterval=function(){return clearInterval(...arguments)};const Rw=5e3,En=[];var AA;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(AA||(AA={}));class F extends yA.EventEmitter{constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this.streamState=F.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=W,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),Rw):this.handleAppVisibilityChanged()},this.log=FA((i=n.loggerName)!==null&&i!==void 0?i:lA.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=A,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=F.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),z(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let A="audio";this.kind===F.Kind.Video&&(A="video"),this.attachedElements.length===0&&this.kind===F.Kind.Video&&this.addAppVisibilityListener(),e||(A==="audio"&&(En.forEach(r=>{r.parentElement===null&&!e&&(e=r)}),e&&En.splice(En.indexOf(e),1)),e||(e=document.createElement(A))),this.attachedElements.includes(e)||this.attachedElements.push(e),Kt(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),i=n.some(r=>r.kind==="audio");return e.play().then(()=>{this.emit(i?x.AudioPlaybackStarted:x.VideoPlaybackStarted)}).catch(r=>{r.name==="NotAllowedError"?this.emit(i?x.AudioPlaybackFailed:x.VideoPlaybackFailed,r):r.name==="AbortError"?W.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):W.warn("could not playback ".concat(i?"audio":"video"),r),i&&e&&n.some(s=>s.kind==="video")&&r.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(x.ElementAttached,e),e}detach(e){try{if(e){Vt(this.mediaStreamTrack,e);const n=this.attachedElements.indexOf(e);return n>=0&&(this.attachedElements.splice(n,1),this.recycleElement(e),this.emit(x.ElementDetached,e)),e}const A=[];return this.attachedElements.forEach(n=>{Vt(this.mediaStreamTrack,n),A.push(n),this.recycleElement(n),this.emit(x.ElementDetached,n)}),this.attachedElements=[],A}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=FA(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let A=!0;e.pause(),En.forEach(n=>{n.parentElement||(A=!1)}),A&&En.push(e)}}handleAppVisibilityChanged(){return v(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===F.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){Ve()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Ve()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Kt(t,e){let A;e.srcObject instanceof MediaStream?A=e.srcObject:A=new MediaStream;let n;t.kind==="audio"?n=A.getAudioTracks():n=A.getVideoTracks(),n.includes(t)||(n.forEach(i=>{A.removeTrack(i)}),A.addTrack(t)),(!ZA()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=A.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==A&&(e.srcObject=A,(ZA()||Gt())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=A,e.play().catch(()=>{})},0))}function Vt(t,e){if(e.srcObject instanceof MediaStream){const A=e.srcObject;A.removeTrack(t),A.getTracks().length>0?e.srcObject=A:e.srcObject=null}}(function(t){let e;(function(c){c.Audio="audio",c.Video="video",c.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let A;(function(c){c.Camera="camera",c.Microphone="microphone",c.ScreenShare="screen_share",c.ScreenShareAudio="screen_share_audio",c.Unknown="unknown"})(A=t.Source||(t.Source={}));let n;(function(c){c.Active="active",c.Paused="paused",c.Unknown="unknown"})(n=t.StreamState||(t.StreamState={}));function i(c){switch(c){case e.Audio:return sA.AUDIO;case e.Video:return sA.VIDEO;default:return sA.DATA}}t.kindToProto=i;function r(c){switch(c){case sA.AUDIO:return e.Audio;case sA.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=r;function s(c){switch(c){case A.Camera:return Be.CAMERA;case A.Microphone:return Be.MICROPHONE;case A.ScreenShare:return Be.SCREEN_SHARE;case A.ScreenShareAudio:return Be.SCREEN_SHARE_AUDIO;default:return Be.UNKNOWN}}t.sourceToProto=s;function a(c){switch(c){case Be.CAMERA:return A.Camera;case Be.MICROPHONE:return A.Microphone;case Be.SCREEN_SHARE:return A.ScreenShare;case Be.SCREEN_SHARE_AUDIO:return A.ScreenShareAudio;default:return A.Unknown}}t.sourceFromProto=a;function o(c){switch(c){case Ks.ACTIVE:return n.Active;case Ks.PAUSED:return n.Paused;default:return n.Unknown}}t.streamStateFromProto=o})(F||(F={}));class ee{constructor(e,A,n,i,r){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(A!==void 0&&n!==void 0)this.width=e,this.height=A,this.aspectRatio=e/A,this.encoding={maxBitrate:n,maxFramerate:i,priority:r};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const Lw=["vp8","h264"],Dw=["vp8","h264","vp9","av1"];function Hw(t){return!!Lw.find(e=>e===t)}var Cd;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(Cd||(Cd={}));var ua;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(ua||(ua={}));const Sn={h90:new ee(160,90,9e4,20),h180:new ee(320,180,16e4,20),h216:new ee(384,216,18e4,20),h360:new ee(640,360,45e4,20),h540:new ee(960,540,8e5,25),h720:new ee(1280,720,17e5,30),h1080:new ee(1920,1080,3e6,30),h1440:new ee(2560,1440,5e6,30),h2160:new ee(3840,2160,8e6,30)},da={h120:new ee(160,120,7e4,20),h180:new ee(240,180,125e3,20),h240:new ee(320,240,14e4,20),h360:new ee(480,360,33e4,20),h480:new ee(640,480,5e5,20),h540:new ee(720,540,6e5,25),h720:new ee(960,720,13e5,30),h1080:new ee(1440,1080,23e5,30),h1440:new ee(1920,1440,38e5,30)},ha={h360fps3:new ee(640,360,2e5,3,"medium"),h360fps15:new ee(640,360,4e5,15,"medium"),h720fps5:new ee(1280,720,8e5,5,"medium"),h720fps15:new ee(1280,720,15e5,15,"medium"),h720fps30:new ee(1280,720,2e6,30,"medium"),h1080fps15:new ee(1920,1080,25e5,15,"medium"),h1080fps30:new ee(1920,1080,5e6,30,"medium"),original:new ee(0,0,7e6,30,"medium")},Ow="|",wd="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function Mw(t){const e=t.split(Ow);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function Ke(t){return v(this,void 0,void 0,function*(){return new Promise(e=>Te.setTimeout(e,t))})}function fa(){return"addTransceiver"in RTCPeerConnection.prototype}function ga(){return"addTrack"in RTCPeerConnection.prototype}function Nw(){if(!("getCapabilities"in RTCRtpSender)||ZA())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const A of t.codecs)if(A.mimeType==="video/AV1"){e=!0;break}}return e}function Kw(){if(!("getCapabilities"in RTCRtpSender)||Gt())return!1;if(ZA()){const A=uA();if(A!=null&&A.version&&mt(A.version,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const A of t.codecs)if(A.mimeType==="video/VP9"){e=!0;break}}return e}function kn(t){return t==="av1"||t==="vp9"}function pa(t){return document?(t||(t=document.createElement("audio")),"setSinkId"in t):!1}function Vw(){return typeof RTCPeerConnection>"u"?!1:fa()||ga()}function Gt(){var t;return((t=uA())===null||t===void 0?void 0:t.name)==="Firefox"}function ZA(){var t;return((t=uA())===null||t===void 0?void 0:t.name)==="Safari"}function Gw(){const t=uA();return(t==null?void 0:t.name)==="Safari"&&t.version.startsWith("17.")}function bd(){var t,e;return Ve()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function jw(){const t=uA(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&mt(e,t.osVersion)>=0?!0:t.name==="Safari"&&mt(e,t.version)>=0}function Ve(){return typeof document<"u"}function UA(){return navigator.product=="ReactNative"}function ma(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function yd(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Ud(){if(!UA())return;let t=yd();if(t)return t.platform}function Qd(){if(Ve())return window.devicePixelRatio;if(UA()){let t=yd();if(t)return t.devicePixelRatio}return 1}function mt(t,e){const A=t.split("."),n=e.split("."),i=Math.min(A.length,n.length);for(let r=0;r<i;++r){const s=parseInt(A[r],10),a=parseInt(n[r],10);if(s>a)return 1;if(s<a)return-1;if(r===i-1&&s===a)return 0}return t===""&&e!==""?-1:e===""?1:A.length==n.length?0:A.length<n.length?-1:1}function Ww(t){for(const e of t)e.target.handleResize(e)}function Jw(t){for(const e of t)e.target.handleVisibilityChanged(e)}let Ba=null;const Ed=()=>(Ba||(Ba=new ResizeObserver(Ww)),Ba);let va=null;const Sd=()=>(va||(va=new IntersectionObserver(Jw,{root:null,rootMargin:"0px"})),va);function Xw(){var t;const e=new DC({sdk:uu.JS,protocol:Pw,version:_w});return UA()&&(e.os=(t=Ud())!==null&&t!==void 0?t:""),e}function kd(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,A=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const i=document.createElement("canvas");i.width=t,i.height=e;const r=i.getContext("2d");r==null||r.fillRect(0,0,i.width,i.height),n&&r&&(r.beginPath(),r.arc(t/2,e/2,50,0,Math.PI*2,!0),r.closePath(),r.fillStyle="grey",r.fill());const s=i.captureStream(),[a]=s.getTracks();if(!a)throw Error("Could not get empty media stream video track");return a.enabled=A,a}let Tn;function Ca(){if(!Tn){const t=new AudioContext,e=t.createOscillator(),A=t.createGain();A.gain.setValueAtTime(0,0);const n=t.createMediaStreamDestination();if(e.connect(A),A.connect(n),e.start(),[Tn]=n.stream.getAudioTracks(),!Tn)throw Error("Could not get empty media stream audio track");Tn.enabled=!1}return Tn.clone()}class wa{constructor(e,A){this.onFinally=A,this.promise=new Promise((n,i)=>v(this,void 0,void 0,function*(){this.resolve=n,this.reject=i,e&&(yield e(n,i))})).finally(()=>{var n;return(n=this.onFinally)===null||n===void 0?void 0:n.call(this)})}}function qw(t){return Dw.includes(t)}function $A(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function Yw(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function ba(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function zw(t,e){return t.segments.map(A=>{let{id:n,text:i,language:r,startTime:s,endTime:a,final:o}=A;var c;const l=(c=e.get(n))!==null&&c!==void 0?c:Date.now(),u=Date.now();return o?e.delete(n):e.set(n,l),{id:n,text:i,startTime:Number.parseInt(s.toString()),endTime:Number.parseInt(a.toString()),final:o,language:r,firstReceivedTime:l,lastReceivedTime:u}})}function Zw(t){const{id:e,timestamp:A,message:n,editTimestamp:i}=t;return{id:e,timestamp:Number.parseInt(A.toString()),editTimestamp:i?Number.parseInt(i.toString()):void 0,message:n}}function Td(t){switch(t.reason){case J.LeaveRequest:return t.context;case J.Cancelled:return aA.CLIENT_INITIATED;case J.NotAllowed:return aA.USER_REJECTED;case J.ServerUnreachable:return aA.JOIN_FAILURE;default:return aA.UNKNOWN_REASON}}function or(t){return t!==void 0?Number(t):void 0}function Bt(t){return t!==void 0?BigInt(t):void 0}function jt(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function xA(t){return!!t&&t.kind==F.Kind.Audio}function Wt(t){return!!t&&t.kind==F.Kind.Video}function et(t){return jt(t)&&Wt(t)}function vt(t){return jt(t)&&xA(t)}function ya(t){return!!t&&!t.isLocal}function $w(t){return!!t&&!t.isLocal}function Ua(t){return ya(t)&&Wt(t)}function eb(t){return t.isLocal}function Ab(t,e){const A=[];let n=new TextEncoder().encode(t);for(;n.length>e;){let i=e;for(;i>0;){const r=n[i];if(r!==void 0&&(r&192)!==128)break;i--}A.push(n.slice(0,i)),n=n.slice(i)}return n.length>0&&A.push(n),A}function Fd(t,e,A){var n,i,r,s;const{optionsWithoutProcessor:a,audioProcessor:o,videoProcessor:c}=Pd(t??{}),l=e==null?void 0:e.processor,u=A==null?void 0:A.processor,d=a??{};return d.audio===!0&&(d.audio={}),d.video===!0&&(d.video={}),d.audio&&(Qa(d.audio,e),(n=(r=d.audio).deviceId)!==null&&n!==void 0||(r.deviceId={ideal:"default"}),(o||l)&&(d.audio.processor=o??l)),d.video&&(Qa(d.video,A),(i=(s=d.video).deviceId)!==null&&i!==void 0||(s.deviceId={ideal:"default"}),(c||u)&&(d.video.processor=c??u)),d}function Qa(t,e){return Object.keys(e).forEach(A=>{t[A]===void 0&&(t[A]=e[A])}),t}function Ea(t){var e,A,n,i;const r={};if(t.video)if(typeof t.video=="object"){const s={},a=s,o=t.video;Object.keys(o).forEach(c=>{switch(c){case"resolution":Qa(a,o.resolution);break;default:a[c]=o[c]}}),r.video=s,(e=(n=r.video).deviceId)!==null&&e!==void 0||(n.deviceId={ideal:"default"})}else r.video=t.video?{deviceId:{ideal:"default"}}:!1;else r.video=!1;return t.audio?typeof t.audio=="object"?(r.audio=t.audio,(A=(i=r.audio).deviceId)!==null&&A!==void 0||(i.deviceId={ideal:"default"})):r.audio={deviceId:{ideal:"default"}}:r.audio=!1,r}function Id(t){return v(this,arguments,void 0,function(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const n=xd();if(n){const i=n.createAnalyser();i.fftSize=2048;const r=i.frequencyBinCount,s=new Uint8Array(r);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield Ke(A),i.getByteTimeDomainData(s);const o=s.some(c=>c!==128&&c!==0);return n.close(),!o}return!1}()})}function xd(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const A=new e({latencyHint:"interactive"});if(A.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const n=()=>v(this,void 0,void 0,function*(){var i;try{A.state==="suspended"&&(yield A.resume())}catch(r){console.warn("Error trying to auto-resume audio context",r)}(i=window.document.body)===null||i===void 0||i.removeEventListener("click",n)});window.document.body.addEventListener("click",n)}return A}}function tb(t){return t==="audioinput"?F.Source.Microphone:t==="videoinput"?F.Source.Camera:F.Source.Unknown}function _d(t){return t===F.Source.Microphone?"audioinput":t===F.Source.Camera?"videoinput":void 0}function nb(t){var e,A;let n=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(n=typeof n=="boolean"?{}:n,ZA()?n=Object.assign(Object.assign({},n),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):n=Object.assign(Object.assign({},n),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(A=t.audio)!==null&&A!==void 0?A:!1,video:n,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function cr(t){return t.split("/")[1].toLowerCase()}function ib(t){const e=[];return t.forEach(A=>{A.track!==void 0&&e.push(new Js({cid:A.track.mediaStreamID,track:A.trackInfo}))}),e}function z(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?z(t.track):{})}}function rb(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function sb(t,e){var A;t===void 0&&(t={}),e===void 0&&(e={});const n=[...Object.keys(e),...Object.keys(t)],i={};for(const r of n)t[r]!==e[r]&&(i[r]=(A=e[r])!==null&&A!==void 0?A:"");return i}function Pd(t){const e=Object.assign({},t);let A,n;return typeof e.audio=="object"&&e.audio.processor&&(A=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(n=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:A,videoProcessor:n,optionsWithoutProcessor:Tw(e)}}function ab(t){switch(t){case Be.CAMERA:return F.Source.Camera;case Be.MICROPHONE:return F.Source.Microphone;case Be.SCREEN_SHARE:return F.Source.ScreenShare;case Be.SCREEN_SHARE_AUDIO:return F.Source.ScreenShareAudio;default:return F.Source.Unknown}}class ob extends yA.EventEmitter{constructor(e){super(),this.onWorkerMessage=A=>{var n,i;const{kind:r,data:s}=A.data;switch(r){case"error":W.error(s.error.message),this.emit(YA.EncryptionError,s.error);break;case"initAck":s.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)});break;case"enable":if(s.enabled&&this.keyProvider.getKeys().forEach(a=>{this.postKey(a)}),this.encryptionEnabled!==s.enabled&&s.participantIdentity===((n=this.room)===null||n===void 0?void 0:n.localParticipant.identity))this.emit(YA.ParticipantEncryptionStatusChanged,s.enabled,this.room.localParticipant),this.encryptionEnabled=s.enabled;else if(s.participantIdentity){const a=(i=this.room)===null||i===void 0?void 0:i.getParticipantByIdentity(s.participantIdentity);if(!a)throw TypeError("couldn't set encryption status, participant not found".concat(s.participantIdentity));this.emit(YA.ParticipantEncryptionStatusChanged,s.enabled,a)}break;case"ratchetKey":this.keyProvider.emit(qA.KeyRatcheted,s.ratchetResult,s.participantIdentity,s.keyIndex);break}},this.onWorkerError=A=>{W.error("e2ee worker encountered an error:",{error:A.error}),this.emit(YA.EncryptionError,A.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1}setup(e){if(!Ew())throw new sa("tried to setup end-to-end encryption on an unsupported browser");if(W.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const A={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:uw.getLevel()}};this.worker&&(W.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(A))}}setParticipantCryptorEnabled(e,A){W.debug("set e2ee to ".concat(e," for participant ").concat(A)),this.postEnable(e,A)}setSifTrailer(e){!e||e.length===0?W.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(_.RTPVideoMapUpdate,A=>{this.postRTPMap(A)})}setupEventListeners(e,A){e.on(I.TrackPublished,(n,i)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==qe.NONE,i.identity)),e.on(I.ConnectionStateChanged,n=>{n===q.Connected&&e.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{this.setParticipantCryptorEnabled(r.trackInfo.encryption!==qe.NONE,i.identity)})})}).on(I.TrackUnsubscribed,(n,i,r)=>{var s;const a={kind:"removeTransform",data:{participantIdentity:r.identity,trackId:n.mediaStreamID}};(s=this.worker)===null||s===void 0||s.postMessage(a)}).on(I.TrackSubscribed,(n,i,r)=>{this.setupE2EEReceiver(n,r.identity,i.trackInfo)}).on(I.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");A.getKeys().forEach(n=>{this.postKey(n)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(L.LocalTrackPublished,n=>v(this,void 0,void 0,function*(){this.setupE2EESender(n.track,n.track.sender)})),A.on(qA.SetKey,n=>this.postKey(n)).on(qA.RatchetRequest,(n,i)=>this.postRatchetRequest(n,i))}postRatchetRequest(e,A){if(!this.worker)throw Error("could not ratchet key, worker is missing");const n={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:A}};this.worker.postMessage(n)}postKey(e){let{key:A,participantIdentity:n,keyIndex:i}=e;var r;if(!this.worker)throw Error("could not set key, worker is missing");const s={kind:"setKey",data:{participantIdentity:n,isPublisher:n===((r=this.room)===null||r===void 0?void 0:r.localParticipant.identity),key:A,keyIndex:i}};this.worker.postMessage(s)}postEnable(e,A){if(this.worker){const n={kind:"enable",data:{enabled:e,participantIdentity:A}};this.worker.postMessage(n)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var A;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((A=this.room)===null||A===void 0)&&A.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const n={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const A={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(A)}setupE2EEReceiver(e,A,n){if(e.receiver){if(!(n!=null&&n.mimeType)||n.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,A,e.kind==="video"?cr(n.mimeType):void 0)}}setupE2EESender(e,A){if(!jt(e)||!A){A||W.warn("early return because sender is not ready");return}this.handleSender(A,e.mediaStreamID,void 0)}handleReceiver(e,A,n,i){return v(this,void 0,void 0,function*(){if(this.worker){if(ra()){const r={kind:"decode",participantIdentity:n,trackId:A,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{if(rr in e&&i){const o={kind:"updateCodec",data:{trackId:A,codec:i,participantIdentity:n}};this.worker.postMessage(o);return}let r=e.writableStream,s=e.readableStream;if(!r||!s){const o=e.createEncodedStreams();e.writableStream=o.writable,r=o.writable,e.readableStream=o.readable,s=o.readable}const a={kind:"decode",data:{readableStream:s,writableStream:r,trackId:A,codec:i,participantIdentity:n}};this.worker.postMessage(a,[s,r])}e[rr]=!0}})}handleSender(e,A,n){var i;if(!(rr in e||!this.worker)){if(!(!((i=this.room)===null||i===void 0)&&i.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(ra()){W.info("initialize script transform");const r={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:A,codec:n};e.transform=new RTCRtpScriptTransform(this.worker,r)}else{W.info("initialize encoded streams");const r=e.createEncodedStreams(),s={kind:"encode",data:{readableStream:r.readable,writableStream:r.writable,codec:n,trackId:A,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(s,[r.readable,r.writable])}e[rr]=!0}}}const Sa="default";class Qe{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new Qe),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return v(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;if(((r=Qe.userMediaPromiseMap)===null||r===void 0?void 0:r.size)>0){W.debug("awaiting getUserMedia promise");try{A?yield Qe.userMediaPromiseMap.get(A):yield Promise.all(Qe.userMediaPromiseMap.values())}catch{W.warn("error waiting for media permissons")}}let s=yield navigator.mediaDevices.enumerateDevices();if(i&&!(ZA()&&n.hasDeviceInUse(A))&&(s.filter(o=>o.kind===A).length===0||s.some(o=>{const c=o.label==="",l=A?o.kind===A:!0;return c&&l}))){const o={video:A!=="audioinput"&&A!=="audiooutput",audio:A!=="videoinput"&&{deviceId:{ideal:"default"}}},c=yield navigator.mediaDevices.getUserMedia(o);s=yield navigator.mediaDevices.enumerateDevices(),c.getTracks().forEach(l=>{l.stop()})}return n._previousDevices=s,A&&(s=s.filter(a=>a.kind===A)),s}()})}normalizeDeviceId(e,A,n){return v(this,void 0,void 0,function*(){if(A!==Sa)return A;const i=yield this.getDevices(e),r=i.find(a=>a.deviceId===Sa);if(!r){W.warn("could not reliably determine default device");return}const s=i.find(a=>a.deviceId!==Sa&&a.groupId===(n??r.groupId));if(!s){W.warn("could not reliably determine default device");return}return s==null?void 0:s.deviceId})}hasDeviceInUse(e){return e?Qe.userMediaPromiseMap.has(e):Qe.userMediaPromiseMap.size>0}}Qe.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],Qe.userMediaPromiseMap=new Map;var Fn;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(Fn||(Fn={}));class cb{constructor(){this.pendingTasks=new Map,this.taskMutex=new Oe,this.nextTaskIndex=0}run(e){return v(this,void 0,void 0,function*(){const A={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:Fn.WAITING};this.pendingTasks.set(A.id,A);const n=yield this.taskMutex.lock();try{return A.executedAt=Date.now(),A.status=Fn.RUNNING,yield e()}finally{A.status=Fn.COMPLETED,this.pendingTasks.delete(A.id),n()}})}flush(){return v(this,void 0,void 0,function*(){return this.run(()=>v(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function lb(t,e){const A=new URL(Yw(t));return e.forEach((n,i)=>{A.searchParams.set(i,n)}),Rd(A,"rtc")}function ub(t){const e=new URL(ba(t));return Rd(e,"validate")}function db(t){return t.endsWith("/")?t:"".concat(t,"/")}function Rd(t,e){return t.pathname="".concat(db(t.pathname)).concat(e),t.toString()}const hb=["syncState","trickle","offer","answer","simulate","leave"];function fb(t){const e=hb.indexOf(t.case)>=0;return W.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var ne;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(ne||(ne={}));class ka{get currentState(){return this.state}get isDisconnected(){return this.state===ne.DISCONNECTING||this.state===ne.DISCONNECTED}get isEstablishingConnection(){return this.state===ne.CONNECTING||this.state===ne.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;this.rtt=0,this.state=ne.DISCONNECTED,this.log=W,this._requestId=0,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0},this.log=FA((n=A.loggerName)!==null&&n!==void 0?n:lA.Signal),this.loggerContextCb=A.loggerContextCb,this.useJSON=e,this.requestQueue=new cb,this.queuedRequests=[],this.closingLock=new Oe,this.connectionLock=new Oe,this.state=ne.DISCONNECTED}get logContext(){var e,A;return(A=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&A!==void 0?A:{}}join(e,A,n,i){return v(this,void 0,void 0,function*(){return this.state=ne.CONNECTING,this.options=n,yield this.connect(e,A,n,i)})}reconnect(e,A,n,i){return v(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=ne.RECONNECTING,this.clearPingInterval(),yield this.connect(e,A,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:i}))})}connect(e,A,n,i){this.connectOptions=n;const r=Xw(),s=gb(A,r,n),a=lb(e,s),o=ub(a);return new Promise((c,l)=>v(this,void 0,void 0,function*(){const u=yield this.connectionLock.lock();try{const d=()=>v(this,void 0,void 0,function*(){this.close(),clearTimeout(h),l(new Ae("room connection has been cancelled (signal)",J.Cancelled))}),h=setTimeout(()=>{this.close(),l(new Ae("room connection has timed out (signal)",J.ServerUnreachable))},n.websocketTimeout);i!=null&&i.aborted&&d(),i==null||i.addEventListener("abort",d);const g=new URL(a);g.searchParams.has("access_token")&&g.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(g),Object.assign({reconnect:n.reconnect,reconnectReason:n.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(a),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(h)},this.ws.onerror=f=>v(this,void 0,void 0,function*(){if(this.state!==ne.CONNECTED){this.state=ne.DISCONNECTED,clearTimeout(h);try{const m=yield fetch(o);if(m.status.toFixed(0).startsWith("4")){const B=yield m.text();l(new Ae(B,J.NotAllowed,m.status))}else l(new Ae("Encountered unknown websocket error during connection: ".concat(f.toString()),J.InternalError,m.status))}catch(m){l(new Ae(m instanceof Error?m.message:"server was not reachable",J.ServerUnreachable))}return}this.handleWSError(f)}),this.ws.onmessage=f=>v(this,void 0,void 0,function*(){var m,B,b;let U;if(typeof f.data=="string"){const C=JSON.parse(f.data);U=mu.fromJson(C,{ignoreUnknownFields:!0})}else if(f.data instanceof ArrayBuffer)U=mu.fromBinary(new Uint8Array(f.data));else{this.log.error("could not decode websocket message: ".concat(typeof f.data),this.logContext);return}if(this.state!==ne.CONNECTED){let C=!1;if(((m=U.message)===null||m===void 0?void 0:m.case)==="join"?(this.state=ne.CONNECTED,i==null||i.removeEventListener("abort",d),this.pingTimeoutDuration=U.message.value.pingTimeout,this.pingIntervalDuration=U.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&(this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})),this.startPingInterval()),c(U.message.value)):this.state===ne.RECONNECTING&&U.message.case!=="leave"?(this.state=ne.CONNECTED,i==null||i.removeEventListener("abort",d),this.startPingInterval(),((B=U.message)===null||B===void 0?void 0:B.case)==="reconnect"?c(U.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),c(void 0),C=!0)):this.isEstablishingConnection&&U.message.case==="leave"?l(new Ae("Received leave request while trying to (re)connect",J.LeaveRequest,void 0,U.message.value.reason)):n.reconnect||l(new Ae("did not receive join response, got ".concat((b=U.message)===null||b===void 0?void 0:b.case," instead"),J.InternalError)),!C)return}this.signalLatency&&(yield Ke(this.signalLatency)),this.handleSignalResponse(U)}),this.ws.onclose=f=>{this.isEstablishingConnection&&l(new Ae("Websocket got closed during a (re)connection attempt",J.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:f.reason,code:f.code,wasClean:f.wasClean,state:this.state})),this.handleOnClose(f.reason)}}finally{u()}}))}close(){return v(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const n=yield e.closingLock.lock();try{if(e.clearPingInterval(),A&&(e.state=ne.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const i=new Promise(r=>{e.ws?e.ws.onclose=()=>{r()}:r()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([i,Ke(250)])),e.ws=void 0}}finally{A&&(e.state=ne.DISCONNECTED),n()}}()})}sendOffer(e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:lr(e)})}sendAnswer(e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:lr(e)})}sendIceCandidate(e,A){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new js({candidateInit:JSON.stringify(e),target:A})})}sendMuteTrack(e,A){return this.sendRequest({case:"mute",value:new Ws({sid:e,muted:A})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,A){return v(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const a=r.getNextRequestId();return yield r.sendRequest({case:"updateMetadata",value:new wu({requestId:a,metadata:n,name:i,attributes:s})}),a}()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,A){return this.sendRequest({case:"updateLayers",value:new Cu({trackSid:e,layers:A})})}sendUpdateSubscriptionPermissions(e,A){return this.sendRequest({case:"subscriptionPermission",value:new Uu({allParticipants:e,trackPermissions:A})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:re.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new Su({timestamp:re.parse(Date.now()),rtt:re.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,A){return this.sendRequest({case:"updateAudioTrack",value:new vu({trackSid:e,features:A})})}sendLeave(){return this.sendRequest({case:"leave",value:new qi({reason:aA.CLIENT_INITIATED,action:Mt.DISCONNECT})})}sendRequest(e){return v(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!i&&!fb(A)&&n.state===ne.RECONNECTING){n.queuedRequests.push(()=>v(n,void 0,void 0,function*(){yield this.sendRequest(A,!0)}));return}if(i||(yield n.requestQueue.flush()),n.signalLatency&&(yield Ke(n.signalLatency)),!n.ws||n.ws.readyState!==n.ws.OPEN){n.log.error("cannot send signal request before connected, type: ".concat(A==null?void 0:A.case),n.logContext);return}const s=new MC({message:A});try{n.useJSON?n.ws.send(s.toJsonString()):n.ws.send(s.toBinary())}catch(a){n.log.error("error sending signal message",Object.assign(Object.assign({},n.logContext),{error:a}))}}()})}handleSignalResponse(e){var A,n;const i=e.message;if(i==null){this.log.debug("received unsupported message",this.logContext);return}let r=!1;if(i.case==="answer"){const s=Ld(i.value);this.onAnswer&&this.onAnswer(s)}else if(i.case==="offer"){const s=Ld(i.value);this.onOffer&&this.onOffer(s)}else if(i.case==="trickle"){const s=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(s,i.value.target)}else i.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((A=i.value.participants)!==null&&A!==void 0?A:[]):i.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):i.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((n=i.value.speakers)!==null&&n!==void 0?n:[]):i.case==="leave"?this.onLeave&&this.onLeave(i.value):i.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):i.case==="roomUpdate"?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):i.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(i.value):i.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):i.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):i.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):i.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(i.value):i.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):i.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(i.value):i.case==="pong"||(i.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),r=!0):i.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(i.value):i.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):i.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(i.value.token),this.onRoomMoved&&this.onRoomMoved(i.value)):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:i.case})));r||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return v(this,void 0,void 0,function*(){if(this.state===ne.DISCONNECTED)return;const A=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),A&&A(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Te.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Te.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Te.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Te.clearInterval(this.pingInterval)}}function Ld(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function lr(t){return new gt({sdp:t.sdp,type:t.type})}function gb(t,e,A){var n;const i=new URLSearchParams;return i.set("access_token",t),A.reconnect&&(i.set("reconnect","1"),A.sid&&i.set("sid",A.sid)),i.set("auto_subscribe",A.autoSubscribe?"1":"0"),i.set("sdk",UA()?"reactnative":"js"),i.set("version",e.version),i.set("protocol",e.protocol.toString()),e.deviceModel&&i.set("device_model",e.deviceModel),e.os&&i.set("os",e.os),e.osVersion&&i.set("os_version",e.osVersion),e.browser&&i.set("browser",e.browser),e.browserVersion&&i.set("browser_version",e.browserVersion),A.adaptiveStream&&i.set("adaptive_stream","1"),A.reconnectReason&&i.set("reconnect_reason",A.reconnectReason.toString()),!((n=navigator.connection)===null||n===void 0)&&n.type&&i.set("network",navigator.connection.type),i}var dA={},Ta={},Fa={exports:{}},Dd;function Ia(){if(Dd)return Fa.exports;Dd=1;var t=Fa.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var A="candidate:%s %d %s %d %s %d typ %s";return A+=e.raddr!=null?" raddr %s rport %d":"%v%v",A+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(A+=" generation %d"),A+=e["network-id"]!=null?" network-id %d":"%v",A+=e["network-cost"]!=null?" network-cost %d":"%v",A}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var A="ssrc:%d";return e.attribute!=null&&(A+=" %s",e.value!=null&&(A+=":%s")),A}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var A="mediaclk:";return A+=e.id!=null?"id=%s %s":"%v%s",A+=e.mediaClockValue!=null?"=%s":"",A+=e.rateNumerator!=null?" rate=%s":"",A+=e.rateDenominator!=null?"/%s":"",A}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var A=t[e];A.forEach(function(n){n.reg||(n.reg=/(.*)/),n.format||(n.format="%s")})}),Fa.exports}var Hd;function pb(){return Hd||(Hd=1,function(t){var e=function(a){return String(Number(a))===a?Number(a):a},A=function(a,o,c,l){if(l&&!c)o[l]=e(a[1]);else for(var u=0;u<c.length;u+=1)a[u+1]!=null&&(o[c[u]]=e(a[u+1]))},n=function(a,o,c){var l=a.name&&a.names;a.push&&!o[a.push]?o[a.push]=[]:l&&!o[a.name]&&(o[a.name]={});var u=a.push?{}:l?o[a.name]:o;A(c.match(a.reg),u,a.names,a.name),a.push&&o[a.push].push(u)},i=Ia(),r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(a){var o={},c=[],l=o;return a.split(/(\r\n|\r|\n)/).filter(r).forEach(function(u){var d=u[0],h=u.slice(2);d==="m"&&(c.push({rtp:[],fmtp:[]}),l=c[c.length-1]);for(var g=0;g<(i[d]||[]).length;g+=1){var f=i[d][g];if(f.reg.test(h))return n(f,l,h)}}),o.media=c,o};var s=function(a,o){var c=o.split(/=(.+)/,2);return c.length===2?a[c[0]]=e(c[1]):c.length===1&&o.length>1&&(a[c[0]]=void 0),a};t.parseParams=function(a){return a.split(/;\s?/).reduce(s,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(a){return a.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(a){for(var o=[],c=a.split(" ").map(e),l=0;l<c.length;l+=3)o.push({component:c[l],ip:c[l+1],port:c[l+2]});return o},t.parseImageAttributes=function(a){return a.split(" ").map(function(o){return o.substring(1,o.length-1).split(",").reduce(s,{})})},t.parseSimulcastStreamList=function(a){return a.split(";").map(function(o){return o.split(",").map(function(c){var l,u=!1;return c[0]!=="~"?l=e(c):(l=e(c.substring(1,c.length)),u=!0),{scid:l,paused:u}})})}}(Ta)),Ta}var xa,Od;function mb(){if(Od)return xa;Od=1;var t=Ia(),e=/%[sdv%]/g,A=function(s){var a=1,o=arguments,c=o.length;return s.replace(e,function(l){if(a>=c)return l;var u=o[a];switch(a+=1,l){case"%%":return"%";case"%s":return String(u);case"%d":return Number(u);case"%v":return""}})},n=function(s,a,o){var c=a.format instanceof Function?a.format(a.push?o:o[a.name]):a.format,l=[s+"="+c];if(a.names)for(var u=0;u<a.names.length;u+=1){var d=a.names[u];a.name?l.push(o[a.name][d]):l.push(o[a.names[u]])}else l.push(o[a.name]);return A.apply(null,l)},i=["v","o","s","i","u","e","p","c","b","t","r","z","a"],r=["i","c","b","a"];return xa=function(s,a){a=a||{},s.version==null&&(s.version=0),s.name==null&&(s.name=" "),s.media.forEach(function(u){u.payloads==null&&(u.payloads="")});var o=a.outerOrder||i,c=a.innerOrder||r,l=[];return o.forEach(function(u){t[u].forEach(function(d){d.name in s&&s[d.name]!=null?l.push(n(u,d,s)):d.push in s&&s[d.push]!=null&&s[d.push].forEach(function(h){l.push(n(u,d,h))})})}),s.media.forEach(function(u){l.push(n("m",t.m[0],u)),c.forEach(function(d){t[d].forEach(function(h){h.name in u&&u[h.name]!=null?l.push(n(d,h,u)):h.push in u&&u[h.push]!=null&&u[h.push].forEach(function(g){l.push(n(d,h,g))})})})}),l.join(`\r
45
45
  `)+`\r
46
- `},xa}var Md;function Bb(){if(Md)return dA;Md=1;var t=pb(),e=mb(),A=Ia();return dA.grammar=A,dA.write=e,dA.parse=t.parse,dA.parseParams=t.parseParams,dA.parseFmtpConfig=t.parseFmtpConfig,dA.parsePayloads=t.parsePayloads,dA.parseRemoteCandidates=t.parseRemoteCandidates,dA.parseImageAttributes=t.parseImageAttributes,dA.parseSimulcastStreamList=t.parseSimulcastStreamList,dA}var At=Bb();function _a(t,e,A){var n,i,r;e===void 0&&(e=50),A===void 0&&(A={});var s=(n=A.isImmediate)!=null&&n,a=(i=A.callback)!=null&&i,o=A.maxWait,c=Date.now(),l=[];function u(){if(o!==void 0){var h=Date.now()-c;if(h+e>=o)return o-h}return e}var d=function(){var h=[].slice.call(arguments),p=this;return new Promise(function(f,m){var B=s&&r===void 0;if(r!==void 0&&clearTimeout(r),r=setTimeout(function(){if(r=void 0,c=Date.now(),!s){var U=t.apply(p,h);a&&a(U),l.forEach(function(w){return(0,w.resolve)(U)}),l=[]}},u()),B){var b=t.apply(p,h);return a&&a(b),f(b)}l.push({resolve:f,reject:m})})};return d.cancel=function(h){r!==void 0&&clearTimeout(r),l.forEach(function(p){return(0,p.reject)(h)}),l=[]},d}const vb=.7,Cb=20,Jt={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class Nd extends yA.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;super(),this.log=W,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=_a(i=>C(this,void 0,void 0,function*(){this.emit(Jt.NegotiationStarted);try{yield this.createAndSendOffer()}catch(r){if(i)i(r);else throw r}}),Cb),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=FA((n=A.loggerName)!==null&&n!==void 0?n:lA.PCTransport),this.loggerOptions=A,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=A=>{var n;A.candidate&&((n=this.onIceCandidate)===null||n===void 0||n.call(this,A.candidate))},e.onicecandidateerror=A=>{var n;(n=this.onIceCandidateError)===null||n===void 0||n.call(this,A)},e.oniceconnectionstatechange=()=>{var A;(A=this.onIceConnectionStateChange)===null||A===void 0||A.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var A;(A=this.onSignalingStatechange)===null||A===void 0||A.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var A;(A=this.onConnectionStateChange)===null||A===void 0||A.call(this,e.connectionState)},e.ondatachannel=A=>{var n;(n=this.onDataChannel)===null||n===void 0||n.call(this,A)},e.ontrack=A=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,A)},e}get logContext(){var e,A;return Object.assign({},(A=(e=this.loggerOptions).loggerContextCb)===null||A===void 0?void 0:A.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return C(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e){return C(this,void 0,void 0,function*(){var A;let n;if(e.type==="offer"){let{stereoMids:i,nackMids:r}=wb(e);this.remoteStereoMids=i,this.remoteNackMids=r}else if(e.type==="answer"){const i=At.parse((A=e.sdp)!==null&&A!==void 0?A:"");i.media.forEach(r=>{r.type==="audio"&&this.trackBitrates.some(s=>{if(!s.transceiver||r.mid!=s.transceiver.mid)return!1;let a=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(a=c.payload,!0):!1),a===0)return!0;let o=!1;for(const c of r.fmtp)if(c.payload===a){c.config=c.config.split(";").filter(l=>!l.includes("maxaveragebitrate")).join(";"),s.maxbr>0&&(c.config+=";maxaveragebitrate=".concat(s.maxbr*1e3)),o=!0;break}return o||s.maxbr>0&&r.fmtp.push({payload:a,config:"maxaveragebitrate=".concat(s.maxbr*1e3)}),!0})}),n=At.write(i)}yield this.setMungedSDP(e,n,!0),this.pendingCandidates.forEach(i=>{this.pc.addIceCandidate(i)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Jt.NegotiationComplete),e.sdp&&At.parse(e.sdp).media.forEach(r=>{r.type==="video"&&this.emit(Jt.RTPVideoPayloadTypes,r.rtp)}))})}createAndSendOffer(e){return C(this,void 0,void 0,function*(){var A;if(this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const r=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&r)yield this._pc.setRemoteDescription(r);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const n=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:n.sdp},this.logContext));const i=At.parse((A=n.sdp)!==null&&A!==void 0?A:"");i.media.forEach(r=>{Vd(r),r.type==="audio"?Kd(r,[],[]):r.type==="video"&&this.trackBitrates.some(s=>{if(!r.msid||!s.cid||!r.msid.includes(s.cid))return!1;let a=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(a=c.payload,!0):!1),a===0||(kn(s.codec)&&this.ensureVideoDDExtensionForSVC(r,i),s.codec!=="av1"))return!0;const o=Math.round(s.maxbr*vb);for(const c of r.fmtp)if(c.payload===a){c.config.includes("x-google-start-bitrate")||(c.config+=";x-google-start-bitrate=".concat(o));break}return!0})}),yield this.setMungedSDP(n,At.write(i)),this.onOffer(n)})}createAndSetAnswer(){return C(this,void 0,void 0,function*(){var e;const A=yield this.pc.createAnswer(),n=At.parse((e=A.sdp)!==null&&e!==void 0?e:"");return n.media.forEach(i=>{Vd(i),i.type==="audio"&&Kd(i,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(A,At.write(n)),A})}createDataChannel(e,A){return this.pc.createDataChannel(e,A)}addTransceiver(e,A){return this.pc.addTransceiver(e,A)}addTrack(e){if(!this._pc)throw new ye("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var A;if(!this._pc)throw new ye("PC closed, cannot configure");return(A=this._pc)===null||A===void 0?void 0:A.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var A;return(A=this._pc)===null||A===void 0?void 0:A.removeTrack(e)}getConnectionState(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&A!==void 0?A:"closed"}getICEConnectionState(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&A!==void 0?A:"closed"}getSignallingState(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&A!==void 0?A:"closed"}getTransceivers(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&A!==void 0?A:[]}getSenders(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&A!==void 0?A:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return C(this,void 0,void 0,function*(){var e;if(!this._pc)return;let A="";const n=new Map,i=new Map;if((yield this._pc.getStats()).forEach(a=>{switch(a.type){case"transport":A=a.selectedCandidatePairId;break;case"candidate-pair":A===""&&a.selected&&(A=a.id),n.set(a.id,a);break;case"remote-candidate":i.set(a.id,"".concat(a.address,":").concat(a.port));break}}),A==="")return;const s=(e=n.get(A))===null||e===void 0?void 0:e.remoteCandidateId;if(s!==void 0)return i.get(s)})}setMungedSDP(e,A,n){return C(this,void 0,void 0,function*(){if(A){const i=e.sdp;e.sdp=A;try{this.log.debug("setting munged ".concat(n?"remote":"local"," description"),this.logContext),n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(r){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:r,sdp:A})),e.sdp=i}}try{n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(i){let r="unknown error";i instanceof Error?r=i.message:typeof i=="string"&&(r=i);const s={error:r,sdp:e.sdp};throw!n&&this.pc.remoteDescription&&(s.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:s})),new aa(r)}})}ensureVideoDDExtensionForSVC(e,A){var n,i;if(!((n=e.ext)===null||n===void 0?void 0:n.some(s=>s.uri===wd))){if(this.ddExtID===0){let s=0;A.media.forEach(a=>{var o;a.type==="video"&&((o=a.ext)===null||o===void 0||o.forEach(c=>{c.value>s&&(s=c.value)}))}),this.ddExtID=s+1}(i=e.ext)===null||i===void 0||i.push({value:this.ddExtID,uri:wd})}}}function Kd(t,e,A){let n=0;t.rtp.some(i=>i.codec==="opus"?(n=i.payload,!0):!1),n>0&&(t.rtcpFb||(t.rtcpFb=[]),A.includes(t.mid)&&!t.rtcpFb.some(i=>i.payload===n&&i.type==="nack")&&t.rtcpFb.push({payload:n,type:"nack"}),e.includes(t.mid)&&t.fmtp.some(i=>i.payload===n?(i.config.includes("stereo=1")||(i.config+=";stereo=1"),!0):!1))}function wb(t){var e;const A=[],n=[],i=At.parse((e=t.sdp)!==null&&e!==void 0?e:"");let r=0;return i.media.forEach(s=>{var a;s.type==="audio"&&(s.rtp.some(o=>o.codec==="opus"?(r=o.payload,!0):!1),!((a=s.rtcpFb)===null||a===void 0)&&a.some(o=>o.payload===r&&o.type==="nack")&&n.push(s.mid),s.fmtp.some(o=>o.payload===r?(o.config.includes("sprop-stereo=1")&&A.push(s.mid),!0):!1))}),{stereoMids:A,nackMids:n}}function Vd(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}const Pa="vp8",bb={audioPreset:ua.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:ha.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Pa,backupCodec:!0},Gd={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},jd={deviceId:{ideal:"default"},resolution:Sn.h720.resolution},yb={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new hw,disconnectOnPageLeave:!0,webAudioMix:!1},Ra={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var ue;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(ue||(ue={}));class Ub{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,A,n){var i;this.peerConnectionTimeout=Ra.peerConnectionTimeout,this.log=W,this.updateState=()=>{var r;const s=this.state,a=this.requiredTransports.map(o=>o.getConnectionState());a.every(o=>o==="connected")?this.state=ue.CONNECTED:a.some(o=>o==="failed")?this.state=ue.FAILED:a.some(o=>o==="connecting")?this.state=ue.CONNECTING:a.every(o=>o==="closed")?this.state=ue.CLOSED:a.some(o=>o==="closed")?this.state=ue.CLOSING:a.every(o=>o==="new")&&(this.state=ue.NEW),s!==this.state&&(this.log.debug("pc state change: from ".concat(ue[s]," to ").concat(ue[this.state]),this.logContext),(r=this.onStateChange)===null||r===void 0||r.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=FA((i=n.loggerName)!==null&&i!==void 0?i:lA.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=!A,this.isSubscriberConnectionRequired=A,this.publisher=new Nd(e,n),this.subscriber=new Nd(e,n),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,cA.PUBLISHER)},this.subscriber.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,cA.SUBSCRIBER)},this.subscriber.onDataChannel=r=>{var s;(s=this.onDataChannel)===null||s===void 0||s.call(this,r)},this.subscriber.onTrack=r=>{var s;(s=this.onTrack)===null||s===void 0||s.call(this,r)},this.publisher.onOffer=r=>{var s;(s=this.onPublisherOffer)===null||s===void 0||s.call(this,r)},this.state=ue.NEW,this.connectionLock=new Oe,this.remoteOfferLock=new Oe}get logContext(){var e,A;return Object.assign({},(A=(e=this.loggerOptions).loggerContextCb)===null||A===void 0?void 0:A.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e){return this.publisher.setRemoteDescription(e)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return C(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const A of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(A)}catch(n){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:n}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return C(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,A){return C(this,void 0,void 0,function*(){A===cA.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e){return C(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const A=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(e),yield this.subscriber.createAndSetAnswer()}finally{A()}})}updateConfiguration(e,A){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),A&&this.triggerIceRestart()}ensurePCTransportConnection(e,A){return C(this,void 0,void 0,function*(){var n;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((n=this.requiredTransports)===null||n===void 0?void 0:n.map(r=>this.ensureTransportConnected(r,e,A)))}finally{i()}})}negotiate(e){return C(this,void 0,void 0,function*(){return new Promise((A,n)=>C(this,void 0,void 0,function*(){const i=setTimeout(()=>{n("negotiation timed out")},this.peerConnectionTimeout),r=()=>{clearTimeout(i),n("negotiation aborted")};e.signal.addEventListener("abort",r),this.publisher.once(Jt.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Jt.NegotiationComplete,()=>{clearTimeout(i),A()})}),yield this.publisher.negotiate(s=>{clearTimeout(i),n(s)})}))})}addPublisherTransceiver(e,A){return this.publisher.addTransceiver(e,A)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,A){return this.publisher.createDataChannel(e,A)}getConnectedAddress(e){return e===cA.PUBLISHER?this.publisher.getConnectedAddress():e===cA.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,A){return C(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(n.getConnectionState()!=="connected")return new Promise((o,c)=>C(r,void 0,void 0,function*(){const l=()=>{this.log.warn("abort transport connection",this.logContext),Te.clearTimeout(u),c(new Ae("room connection has been cancelled",J.Cancelled))};i!=null&&i.signal.aborted&&l(),i==null||i.signal.addEventListener("abort",l);const u=Te.setTimeout(()=>{i==null||i.signal.removeEventListener("abort",l),c(new Ae("could not establish pc connection",J.InternalError))},s);for(;this.state!==ue.CONNECTED;)if(yield Ke(50),i!=null&&i.signal.aborted){c(new Ae("room connection has been cancelled",J.Cancelled));return}Te.clearTimeout(u),i==null||i.signal.removeEventListener("abort",l),o()}))}()})}}class de extends Error{constructor(e,A,n){super(A),this.code=e,this.message=Jd(A,de.MAX_MESSAGE_BYTES),this.data=n?Jd(n,de.MAX_DATA_BYTES):void 0}static fromProto(e){return new de(e.code,e.message,e.data)}toProto(){return new ou({code:this.code,message:this.message,data:this.data})}static builtIn(e,A){return new de(de.ErrorCode[e],de.ErrorMessage[e],A)}}de.MAX_MESSAGE_BYTES=256,de.MAX_DATA_BYTES=15360,de.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},de.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const Wd=15360;function La(t){return new TextEncoder().encode(t).length}function Jd(t,e){if(La(t)<=e)return t;let A=0,n=t.length;const i=new TextEncoder;for(;A<n;){const r=Math.floor((A+n+1)/2);i.encode(t.slice(0,r)).length<=e?A=r:n=r-1}return t.slice(0,A)}const Da=2e3;function ur(t,e){if(!e)return 0;let A,n;return"bytesReceived"in t?(A=t.bytesReceived,n=e.bytesReceived):"bytesSent"in t&&(A=t.bytesSent,n=e.bytesSent),A===void 0||n===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(A-n)*8*1e3/(t.timestamp-e.timestamp)}const Qb=1e3;class Xd extends k{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}constructor(e,A,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4?arguments[4]:void 0;super(e,A,r),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=_a(()=>C(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>C(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(x.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new Oe,this.pauseUpstreamLock=new Oe,this.processorLock=new Oe,this.restartLock=new Oe,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==k.Kind.Video)return;const{width:e,height:A}=this._mediaStreamTrack.getSettings();if(e&&A)return{width:e,height:A}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,A;return(A=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&A!==void 0?A:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,A){return C(this,void 0,void 0,function*(){var n;if(e===this._mediaStreamTrack&&!A)return;this._mediaStreamTrack&&(this.attachedElements.forEach(r=>{Vt(this._mediaStreamTrack,r)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let i;if(this.processor&&e){const r=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Kt(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}finally{r()}}this.sender&&((n=this.sender.transport)===null||n===void 0?void 0:n.state)!=="closed"&&(yield this.sender.replaceTrack(i??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(r=>{Kt(i??e,r)}))})}waitForDimensions(){return C(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qb;return function*(){var n;if(e.kind===k.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=uA())===null||n===void 0?void 0:n.os)==="iOS"&&(yield Ke(10));const i=Date.now();for(;Date.now()-i<A;){const r=e.dimensions;if(r)return r;yield Ke(50)}throw new IA("unable to get track dimensions after timeout")}()})}setDeviceId(e){return C(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===$A(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),$A(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return C(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===k.Source.ScreenShare)return;const{deviceId:n,groupId:i}=e._mediaStreamTrack.getSettings(),r=e.kind===k.Kind.Audio?"audioinput":"videoinput";return A?Qe.getInstance().normalizeDeviceId(r,n,i):n}()})}mute(){return C(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return C(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,A){return C(this,void 0,void 0,function*(){if(!this.sender)throw new IA("unable to replace an unpublished track");let n,i;return typeof A=="boolean"?n=A:A!==void 0&&(n=A.userProvidedTrack,i=A.stopProcessor),this.providedByUser=n??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return C(this,void 0,void 0,function*(){this.manuallyStopped=!1;const A=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:n,facingMode:i}=e,r=fw(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const s={audio:!1,video:!1};this.kind===k.Kind.Video?s.video=n||i?{deviceId:n,facingMode:i}:!0:s.audio=n?{deviceId:n}:!0,this.attachedElements.forEach(c=>{Vt(this.mediaStreamTrack,c)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const o=(yield navigator.mediaDevices.getUserMedia(s)).getTracks()[0];return yield o.applyConstraints(r),o.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(o),this._constraints=e,this.emit(x.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{A()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?x.Muted:x.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return C(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),bd()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return C(this,void 0,void 0,function*(){var e;const A=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(x.UpstreamPaused,this);const n=uA();if((n==null?void 0:n.name)==="Safari"&&mt(n.version,"12.0")<0)throw new sa("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{A()}})}resumeUpstream(){return C(this,void 0,void 0,function*(){var e;const A=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(x.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{A()}})}getRTCStatsReport(){return C(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return C(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;const s=yield n.processorLock.lock();try{n.log.debug("setting up processor",n.logContext);const a=document.createElement(n.kind),o={kind:n.kind,track:n._mediaStreamTrack,element:a,audioContext:n.audioContext};if(yield A.init(o),n.log.debug("processor initialized",n.logContext),n.processor&&(yield n.stopProcessor()),n.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Kt(n._mediaStreamTrack,a),a.muted=!0,a.play().catch(c=>n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{error:c}))),n.processor=A,n.processorElement=a,n.processor.processedTrack){for(const c of n.attachedElements)c!==n.processorElement&&i&&(Vt(n._mediaStreamTrack,c),Kt(n.processor.processedTrack,c));yield(r=n.sender)===null||r===void 0?void 0:r.replaceTrack(n.processor.processedTrack)}n.emit(x.TrackProcessorUpdate,n.processor)}finally{s()}}()})}getProcessor(){return this.processor}stopProcessor(){return C(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var n,i;e.processor&&(e.log.debug("stopping processor",e.logContext),(n=e.processor.processedTrack)===null||n===void 0||n.stop(),yield e.processor.destroy(),e.processor=void 0,A||((i=e.processorElement)===null||i===void 0||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(x.TrackProcessorUpdate))}()})}}class dr extends Xd{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;super(e,k.Kind.Audio,A,n,r),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>C(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}s&&this.prevStats&&(this._currentBitrate=ur(s,this.prevStats)),this.prevStats=s}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(x.AudioTrackFeatureUpdate,this,oA.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(x.AudioTrackFeatureUpdate,this,oA.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return C(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===k.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{A()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return C(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const n=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==$A(this._constraints.deviceId);return this.source===k.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||n)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{A()}})}restartTrack(e){return C(this,void 0,void 0,function*(){let A;if(e){const n=Ea({audio:e});typeof n.audio!="boolean"&&(A=n.audio)}yield this.restart(A)})}restart(e){const A=Object.create(null,{restart:{get:()=>super.restart}});return C(this,void 0,void 0,function*(){const n=yield A.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){Ve()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Da)))}setProcessor(e){return C(this,void 0,void 0,function*(){var A;const n=yield this.processorLock.lock();try{if(!UA()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const i={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(i),this.processor=e,this.processor.processedTrack&&(yield(A=this.sender)===null||A===void 0?void 0:A.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(x.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return C(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const A=yield this.sender.getStats();let n;return A.forEach(i=>{i.type==="outbound-rtp"&&(n={type:"audio",streamId:i.id,packetsSent:i.packetsSent,packetsLost:i.packetsLost,bytesSent:i.bytesSent,timestamp:i.timestamp,roundTripTime:i.roundTripTime,jitter:i.jitter})}),n})}checkForSilence(){return C(this,void 0,void 0,function*(){const e=yield Id(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(x.AudioSilenceDetected)),e})}}function Eb(t,e,A){switch(t.kind){case"audio":return new dr(t,e,!1,void 0,A);case"video":return new fr(t,e,!1,A);default:throw new IA("unsupported track type: ".concat(t.kind))}}const Sb=Object.values(Sn),kb=Object.values(da),Tb=Object.values(ha),Fb=[Sn.h180,Sn.h360],Ib=[da.h180,da.h360],xb=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(A=>{var n,i;return new ee(Math.floor(t.width/A.scaleResolutionDownBy),Math.floor(t.height/A.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(A.scaleResolutionDownBy,2)*(((n=t.encoding.maxFramerate)!==null&&n!==void 0?n:30)/((i=A.fps)!==null&&i!==void 0?i:30))))),A.fps,t.encoding.priority)}),Ha=["q","h","f"];function Oa(t,e,A,n){var i,r;let s=n==null?void 0:n.videoEncoding;t&&(s=n==null?void 0:n.screenShareEncoding);const a=n==null?void 0:n.simulcast,o=n==null?void 0:n.scalabilityMode,c=n==null?void 0:n.videoCodec;if(!s&&!a&&!o||!e||!A)return[{}];s||(s=Pb(t,e,A,c),W.debug("using video encoding",s));const l=s.maxFramerate,u=new ee(e,A,s.maxBitrate,s.maxFramerate,s.priority);if(o&&kn(c)){const p=new hr(o),f=[];if(p.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(o));const m=uA();if(ZA()||UA()||(m==null?void 0:m.name)==="Chrome"&&mt(m==null?void 0:m.version,"113")<0){const B=p.suffix=="h"?2:3;for(let b=0;b<p.spatial;b+=1)f.push({rid:Ha[2-b],maxBitrate:s.maxBitrate/Math.pow(B,b),maxFramerate:u.encoding.maxFramerate});f[0].scalabilityMode=o}else f.push({maxBitrate:s.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:o});return u.encoding.priority&&(f[0].priority=u.encoding.priority,f[0].networkPriority=u.encoding.priority),W.debug("using svc encoding",{encodings:f}),f}if(!a)return[s];let d=[];t?d=(i=Yd(n==null?void 0:n.screenShareSimulcastLayers))!==null&&i!==void 0?i:qd(t,u):d=(r=Yd(n==null?void 0:n.videoSimulcastLayers))!==null&&r!==void 0?r:qd(t,u);let h;if(d.length>0){const p=d[0];d.length>1&&([,h]=d);const f=Math.max(e,A);if(f>=960&&h)return Ma(e,A,[p,h,u],l);if(f>=480)return Ma(e,A,[p,u],l)}return Ma(e,A,[u])}function _b(t,e,A){var n,i,r,s;if(!A.backupCodec||A.backupCodec===!0||A.backupCodec.codec===A.videoCodec)return;e!==A.backupCodec.codec&&W.warn("requested a different codec than specified as backup",{serverRequested:e,backup:A.backupCodec.codec}),A.videoCodec=e,A.videoEncoding=A.backupCodec.encoding;const a=t.mediaStreamTrack.getSettings(),o=(n=a.width)!==null&&n!==void 0?n:(i=t.dimensions)===null||i===void 0?void 0:i.width,c=(r=a.height)!==null&&r!==void 0?r:(s=t.dimensions)===null||s===void 0?void 0:s.height;return t.source===k.Source.ScreenShare&&A.simulcast&&(A.simulcast=!1),Oa(t.source===k.Source.ScreenShare,o,c,A)}function Pb(t,e,A,n){const i=Rb(t,e,A);let{encoding:r}=i[0];const s=Math.max(e,A);for(let a=0;a<i.length;a+=1){const o=i[a];if(r=o.encoding,o.width>=s)break}if(n)switch(n){case"av1":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.7;break;case"vp9":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.85;break}return r}function Rb(t,e,A){if(t)return Tb;const n=e>A?e/A:A/e;return Math.abs(n-16/9)<Math.abs(n-4/3)?Sb:kb}function qd(t,e){if(t)return xb(e);const{width:A,height:n}=e,i=A>n?A/n:n/A;return Math.abs(i-16/9)<Math.abs(i-4/3)?Fb:Ib}function Ma(t,e,A,n){const i=[];if(A.forEach((r,s)=>{if(s>=Ha.length)return;const a=Math.min(t,e),c={rid:Ha[s],scaleResolutionDownBy:Math.max(1,a/Math.min(r.width,r.height)),maxBitrate:r.encoding.maxBitrate},l=n&&r.encoding.maxFramerate?Math.min(n,r.encoding.maxFramerate):r.encoding.maxFramerate;l&&(c.maxFramerate=l);const u=Gt()||s===0;r.encoding.priority&&u&&(c.priority=r.encoding.priority,c.networkPriority=r.encoding.priority),i.push(c)}),UA()&&Ud()==="ios"){let r;i.forEach(a=>{r?a.maxFramerate&&a.maxFramerate>r&&(r=a.maxFramerate):r=a.maxFramerate});let s=!0;i.forEach(a=>{var o;a.maxFramerate!=r&&(s&&(s=!1,W.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),W.info('Setting framerate of encoding "'.concat((o=a.rid)!==null&&o!==void 0?o:"",'" to ').concat(r)),a.maxFramerate=r)})}return i}function Yd(t){if(t)return t.sort((e,A)=>{const{encoding:n}=e,{encoding:i}=A;return n.maxBitrate>i.maxBitrate?1:n.maxBitrate<i.maxBitrate?-1:n.maxBitrate===i.maxBitrate&&n.maxFramerate&&i.maxFramerate?n.maxFramerate>i.maxFramerate?1:-1:0})}class hr{constructor(e){const A=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!A)throw new Error("invalid scalability mode");if(this.spatial=parseInt(A[1]),this.temporal=parseInt(A[2]),A.length>3)switch(A[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=A[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function Lb(t){return t.source===k.Source.ScreenShare||t.constraints.height&&$A(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const Db=5e3;class fr extends Xd{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0;super(e,k.Kind.Video,A,n,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>C(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let r;try{r=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}const s=new Map(r.map(a=>[a.rid,a]));if(this.prevStats){let a=0;s.forEach((o,c)=>{var l;const u=(l=this.prevStats)===null||l===void 0?void 0:l.get(c);a+=ur(o,u)}),this._currentBitrate=a}this.prevStats=s}),this.senderLock=new Oe}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var A;if(this.signalClient=e,!Ve())return;const n=(A=this.sender)===null||A===void 0?void 0:A.getParameters();n&&(this.encodings=n.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},Da))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return C(this,void 0,void 0,function*(){var A,n,i,r,s;yield e.pauseUpstream.call(this);try{for(var a=!0,o=XA(this.simulcastCodecs.values()),c;c=yield o.next(),A=c.done,!A;a=!0)r=c.value,a=!1,yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(null)}catch(l){n={error:l}}finally{try{!a&&!A&&(i=o.return)&&(yield i.call(o))}finally{if(n)throw n.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return C(this,void 0,void 0,function*(){var A,n,i,r,s;yield e.resumeUpstream.call(this);try{for(var a=!0,o=XA(this.simulcastCodecs.values()),c;c=yield o.next(),A=c.done,!A;a=!0){r=c.value,a=!1;const l=r;yield(s=l.sender)===null||s===void 0?void 0:s.replaceTrack(l.mediaStreamTrack)}}catch(l){n={error:l}}finally{try{!a&&!A&&(i=o.return)&&(yield i.call(o))}finally{if(n)throw n.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return C(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===k.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{A()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return C(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{return this.isMuted?(this.source===k.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{A()}})}setTrackMuted(e){super.setTrackMuted(e);for(const A of this.simulcastCodecs.values())A.mediaStreamTrack.enabled=!e}getSenderStats(){return C(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const A=[],n=yield this.sender.getStats();return n.forEach(i=>{var r;if(i.type==="outbound-rtp"){const s={type:"video",streamId:i.id,frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesPerSecond:i.framesPerSecond,framesSent:i.framesSent,firCount:i.firCount,pliCount:i.pliCount,nackCount:i.nackCount,packetsSent:i.packetsSent,bytesSent:i.bytesSent,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,rid:(r=i.rid)!==null&&r!==void 0?r:i.id,retransmittedPacketsSent:i.retransmittedPacketsSent,targetBitrate:i.targetBitrate,timestamp:i.timestamp},a=n.get(i.remoteId);a&&(s.jitter=a.jitter,s.packetsLost=a.packetsLost,s.roundTripTime=a.roundTripTime),A.push(s)}}),A.sort((i,r)=>{var s,a;return((s=r.frameWidth)!==null&&s!==void 0?s:0)-((a=i.frameWidth)!==null&&a!==void 0?a:0)}),A})}setPublishingQuality(e){const A=[];for(let n=AA.LOW;n<=AA.HIGH;n+=1)A.push(new Xs({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(A)}restartTrack(e){return C(this,void 0,void 0,function*(){var A,n,i,r,s;let a;if(e){const u=Ea({video:e});typeof u.video!="boolean"&&(a=u.video)}yield this.restart(a);try{for(var o=!0,c=XA(this.simulcastCodecs.values()),l;l=yield c.next(),A=l.done,!A;o=!0){r=l.value,o=!1;const u=r;u.sender&&((s=u.sender.transport)===null||s===void 0?void 0:s.state)!=="closed"&&(u.mediaStreamTrack=this.mediaStreamTrack.clone(),yield u.sender.replaceTrack(u.mediaStreamTrack))}}catch(u){n={error:u}}finally{try{!o&&!A&&(i=c.return)&&(yield i.call(c))}finally{if(n)throw n.error}}})}setProcessor(e){const A=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return C(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s,a,o,c,l,u;if(yield A.setProcessor.call(i,n,r),!((l=i.processor)===null||l===void 0)&&l.processedTrack)try{for(var d=!0,h=XA(i.simulcastCodecs.values()),p;p=yield h.next(),s=p.done,!s;d=!0)c=p.value,d=!1,yield(u=c.sender)===null||u===void 0?void 0:u.replaceTrack(i.processor.processedTrack)}catch(f){a={error:f}}finally{try{!d&&!s&&(o=h.return)&&(yield o.call(h))}finally{if(a)throw a.error}}}()})}setDegradationPreference(e){return C(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const A=this.sender.getParameters();A.degradationPreference=e,this.sender.setParameters(A)}catch(A){this.log.warn("failed to set degradationPreference",Object.assign({error:A},this.logContext))}})}addSimulcastTrack(e,A){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:A};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,A){const n=this.simulcastCodecs.get(e);n&&(n.sender=A,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},Db))}setPublishingCodecs(e){return C(this,void 0,void 0,function*(){var A,n,i,r,s,a,o;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(e[0].qualities),[];this.subscribedCodecs=e;const c=[];try{for(A=!0,n=XA(e);i=yield n.next(),r=i.done,!r;A=!0){o=i.value,A=!1;const l=o;if(!this.codec||this.codec===l.codec)yield this.setPublishingLayers(l.qualities);else{const u=this.simulcastCodecs.get(l.codec);if(this.log.debug("try setPublishingCodec for ".concat(l.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:u})),!u||!u.sender){for(const d of l.qualities)if(d.enabled){c.push(l.codec);break}}else u.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(l.codec),this.logContext),yield zd(u.sender,u.encodings,l.qualities,this.senderLock,this.log,this.logContext))}}}catch(l){s={error:l}}finally{try{!A&&!r&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return c})}setPublishingLayers(e){return C(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield zd(this.sender,this.encodings,e,this.senderLock,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return C(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),bd()&&this.isInBackground&&this.source===k.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function zd(t,e,A,n,i,r){return C(this,void 0,void 0,function*(){const s=yield n.lock();i.debug("setPublishingLayersForSender",Object.assign(Object.assign({},r),{sender:t,qualities:A,senderEncodings:e}));try{const a=t.getParameters(),{encodings:o}=a;if(!o)return;if(o.length!==e.length){i.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},r),{encodings:o,senderEncodings:e}));return}let c=!1;const l=uA();if((l==null?void 0:l.name)==="Chrome"&&mt(l==null?void 0:l.version,"133")>0&&o[0].scalabilityMode){const d=o[0],h=new hr(d.scalabilityMode);let p=Lt.OFF;if(A.forEach(f=>{f.enabled&&(p===Lt.OFF||f.quality>p)&&(p=f.quality)}),p===Lt.OFF)d.active&&(d.active=!1,c=!0);else if(!d.active||h.spatial!==p+1){c=!0,d.active=!0;const f=new hr(e[0].scalabilityMode);h.spatial=p+1,h.suffix=f.suffix,h.spatial===1&&(h.suffix=void 0),d.scalabilityMode=h.toString(),d.scaleResolutionDownBy=Math.pow(2,2-p),e[0].maxBitrate&&(d.maxBitrate=e[0].maxBitrate/(d.scaleResolutionDownBy*d.scaleResolutionDownBy))}}else o.forEach((d,h)=>{var p;let f=(p=d.rid)!==null&&p!==void 0?p:"";f===""&&(f="q");const m=Zd(f),B=A.find(b=>b.quality===m);B&&d.active!==B.enabled&&(c=!0,d.active=B.enabled,i.debug("setting layer ".concat(B.quality," to ").concat(d.active?"enabled":"disabled"),r),Gt()&&(B.enabled?(d.scaleResolutionDownBy=e[h].scaleResolutionDownBy,d.maxBitrate=e[h].maxBitrate,d.maxFrameRate=e[h].maxFrameRate):(d.scaleResolutionDownBy=4,d.maxBitrate=10,d.maxFrameRate=2)))});c&&(a.encodings=o,i.debug("setting encodings",Object.assign(Object.assign({},r),{encodings:a.encodings})),yield t.setParameters(a))}finally{s()}})}function Zd(t){switch(t){case"f":return AA.HIGH;case"h":return AA.MEDIUM;case"q":return AA.LOW;default:return AA.HIGH}}function $d(t,e,A,n){if(!A)return[new ft({quality:AA.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(n){const i=A[0].scalabilityMode,r=new hr(i),s=[],a=r.suffix=="h"?1.5:2,o=r.suffix=="h"?2:3;for(let c=0;c<r.spatial;c+=1)s.push(new ft({quality:Math.min(AA.HIGH,r.spatial-1)-c,width:Math.ceil(t/Math.pow(a,c)),height:Math.ceil(e/Math.pow(a,c)),bitrate:A[0].maxBitrate?Math.ceil(A[0].maxBitrate/Math.pow(o,c)):0,ssrc:0}));return s}return A.map(i=>{var r,s,a;const o=(r=i.scaleResolutionDownBy)!==null&&r!==void 0?r:1;let c=Zd((s=i.rid)!==null&&s!==void 0?s:"");return new ft({quality:c,width:Math.ceil(t/o),height:Math.ceil(e/o),bitrate:(a=i.maxBitrate)!==null&&a!==void 0?a:0,ssrc:0})})}const eh="_lossy",Ah="_reliable",Hb=2*1e3,Na="leave-reconnect";var hA;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(hA||(hA={}));class Ob extends yA.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var A;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=Ra.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=hA.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=W,this.handleDataChannel=n=>C(this,[n],void 0,function(i){var r=this;let{channel:s}=i;return function*(){if(s){if(s.label===Ah)r.reliableDCSub=s;else if(s.label===eh)r.lossyDCSub=s;else return;r.log.debug("on data channel ".concat(s.id,", ").concat(s.label),r.logContext),s.onmessage=r.handleDataMessage}}()}),this.handleDataMessage=n=>C(this,void 0,void 0,function*(){var i,r;const s=yield this.dataProcessLock.lock();try{let a;if(n.data instanceof ArrayBuffer)a=n.data;else if(n.data instanceof Blob)a=yield n.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:n.data}));return}const o=Ne.fromBinary(new Uint8Array(a));((i=o.value)===null||i===void 0?void 0:i.case)==="speaker"?this.emit(_.ActiveSpeakersUpdate,o.value.value.speakers):(((r=o.value)===null||r===void 0?void 0:r.case)==="user"&&Nb(o,o.value.value),this.emit(_.DataPacketReceived,o))}finally{s()}}),this.handleDataError=n=>{const r=n.currentTarget.maxRetransmits===0?"lossy":"reliable";if(n instanceof ErrorEvent&&n.error){const{error:s}=n.error;this.log.error("DataChannel error on ".concat(r,": ").concat(n.message),Object.assign(Object.assign({},this.logContext),{error:s}))}else this.log.error("Unknown DataChannel error on ".concat(r),Object.assign(Object.assign({},this.logContext),{event:n}))},this.handleBufferedAmountLow=n=>{const r=n.currentTarget.maxRetransmits===0?X.LOSSY:X.RELIABLE;this.updateAndEmitDCBufferStatus(r)},this.handleDisconnect=(n,i)=>{if(this._isClosed)return;this.log.warn("".concat(n," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const r=o=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(o,"ms. giving up"),this.logContext),this.emit(_.Disconnected),this.close()},s=Date.now()-this.reconnectStart;let a=this.getNextRetryDelay({elapsedMs:s,retryCount:this.reconnectAttempts});if(a===null){r(s);return}n===Na&&(a=0),this.log.debug("reconnecting in ".concat(a,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Te.setTimeout(()=>this.attemptReconnect(i).finally(()=>this.reconnectTimeout=void 0),a)},this.waitForRestarted=()=>new Promise((n,i)=>{this.pcState===hA.Connected&&n();const r=()=>{this.off(_.Disconnected,s),n()},s=()=>{this.off(_.Restarted,r),i()};this.once(_.Restarted,r),this.once(_.Disconnected,s)}),this.updateAndEmitDCBufferStatus=n=>{const i=this.isBufferStatusLow(n);typeof i<"u"&&i!==this.dcBufferStatus.get(n)&&(this.dcBufferStatus.set(n,i),this.emit(_.DCBufferStatusChanged,i,n))},this.isBufferStatusLow=n=>{const i=this.dataChannelForKind(n);if(i)return i.bufferedAmount<=i.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===ne.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(Dt.RR_SIGNAL_DISCONNECTED))},this.log=FA((A=e.loggerName)!==null&&A!==void 0?A:lA.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new ka(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new Oe,this.dataProcessLock=new Oe,this.dcBufferStatus=new Map([[X.LOSSY,!0],[X.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(_.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(_.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(_.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(_.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(_.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(_.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(_.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(_.SignalRequestResponse,n)}get logContext(){var e,A,n,i,r,s,a,o;return{room:(A=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||A===void 0?void 0:A.name,roomID:(i=(n=this.latestJoinResponse)===null||n===void 0?void 0:n.room)===null||i===void 0?void 0:i.sid,participant:(s=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.participant)===null||s===void 0?void 0:s.identity,pID:(o=(a=this.latestJoinResponse)===null||a===void 0?void 0:a.participant)===null||o===void 0?void 0:o.sid}}join(e,A,n,i){return C(this,void 0,void 0,function*(){this.url=e,this.token=A,this.signalOpts=n,this.maxJoinAttempts=n.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const r=yield this.client.join(e,A,n,i);return this._isClosed=!1,this.latestJoinResponse=r,this.subscriberPrimary=r.subscriberPrimary,this.pcManager||(yield this.configure(r)),(!this.subscriberPrimary||r.fastPublish)&&this.negotiate(),this.clientConfiguration=r.clientConfiguration,setTimeout(()=>{this.emit(_.SignalConnected)},10),r}catch(r){if(r instanceof Ae&&r.reason===J.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,A,n,i);throw r}})}close(){return C(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(_.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return C(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const A=n=>{n&&(n.close(),n.onbufferedamountlow=null,n.onclose=null,n.onclosing=null,n.onerror=null,n.onmessage=null,n.onopen=null)};A(this.lossyDC),A(this.lossyDCSub),A(this.reliableDC),A(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0})}cleanupClient(){return C(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new IA("a track with the same ID has already been published");return new Promise((A,n)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(new Ae("publication of local track timed out, no response from server",J.InternalError))},1e4);this.pendingTrackResolvers[e.cid]={resolve:r=>{clearTimeout(i),A(r)},reject:()=>{clearTimeout(i),n(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:A}=this.pendingTrackResolvers[e.track.id];A&&A(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(A){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:A}))}return!1}updateMuteStatus(e,A){this.client.sendMuteTrack(e,A)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return C(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return C(this,void 0,void 0,function*(){var A,n;if(this.pcManager&&this.pcManager.currentState!==ue.NEW)return;this.participantSid=(A=e.participant)===null||A===void 0?void 0:A.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new Ub(i,e.subscriberPrimary,this.loggerOptions),this.emit(_.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(r,s)=>{this.client.sendIceCandidate(r,s)},this.pcManager.onPublisherOffer=r=>{this.client.sendOffer(r)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(r,s,a)=>C(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(r),this.logContext),["closed","disconnected","failed"].includes(s)&&(this.publisherConnectionPromise=void 0),r===ue.CONNECTED){const l=this.pcState===hA.New;this.pcState=hA.Connected,l&&this.emit(_.Connected,e)}else r===ue.FAILED&&this.pcState===hA.Connected&&(this.pcState=hA.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?Dt.RR_SUBSCRIBER_FAILED:Dt.RR_PUBLISHER_FAILED));const o=this.client.isDisconnected||this.client.currentState===ne.RECONNECTING,c=[ue.FAILED,ue.CLOSING,ue.CLOSED].includes(r);o&&c&&!this._isClosed&&this.emit(_.Offline)}),this.pcManager.onTrack=r=>{this.emit(_.MediaTrackAdded,r.track,r.streams[0],r.receiver)},Mb((n=e.serverInfo)===null||n===void 0?void 0:n.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=e=>C(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e))}),this.client.onTrickle=(e,A)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:A})),this.pcManager.addIceCandidate(e,A))},this.client.onOffer=e=>C(this,void 0,void 0,function*(){if(!this.pcManager)return;const A=yield this.pcManager.createSubscriberAnswerFromOffer(e);this.client.sendAnswer(A)}),this.client.onLocalTrackPublished=e=>{var A;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(A=e.track)===null||A===void 0?void 0:A.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:n}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],n(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(_.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(_.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,A)=>{this.emit(_.RemoteMute,e,A)},this.client.onSubscribedQualityUpdate=e=>{this.emit(_.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var A;this.participantSid=(A=e.participant)===null||A===void 0?void 0:A.sid,this.emit(_.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",Dt.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case Mt.DISCONNECT:this.emit(_.Disconnected,e==null?void 0:e.reason),this.close();break;case Mt.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Na);break;case Mt.RESUME:this.handleDisconnect(Na)}}}makeRTCConfiguration(e){var A;const n=Object.assign({},this.rtcConfig);if(!((A=this.signalOpts)===null||A===void 0)&&A.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),n.encodedInsertableStreams=!0),e.iceServers&&!n.iceServers){const i=[];e.iceServers.forEach(r=>{const s={urls:r.urls};r.username&&(s.username=r.username),r.credential&&(s.credential=r.credential),i.push(s)}),n.iceServers=i}return e.clientConfiguration&&e.clientConfiguration.forceRelay===Un.ENABLED&&(n.iceTransportPolicy="relay"),n.sdpSemantics="unified-plan",n.continualGatheringPolicy="gather_continually",n}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(eh,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(Ah,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,A,n){return C(this,void 0,void 0,function*(){if(fa())return yield this.createTransceiverRTCRtpSender(e,A,n);if(ga())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new ye("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,A,n,i){return C(this,void 0,void 0,function*(){if(fa())return this.createSimulcastTransceiverSender(e,A,n,i);if(ga())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new ye("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,A,n){return C(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),Wt(e)&&(e.codec=A.videoCodec);const r={direction:"sendonly",streams:i};return n&&(r.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,r)).sender})}createSimulcastTransceiverSender(e,A,n,i){return C(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("publisher is closed");const r={direction:"sendonly"};i&&(r.sendEncodings=i);const s=yield this.pcManager.addPublisherTransceiver(A.mediaStreamTrack,r);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,s.sender),s.sender})}createRTCRtpSender(e){return C(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return C(this,void 0,void 0,function*(){var A,n,i;if(!this._isClosed){if(this.attemptingReconnect){W.warn("already attempting reconnect, returning early",this.logContext);return}(((A=this.clientConfiguration)===null||A===void 0?void 0:A.resumeConnection)===Un.DISABLED||((i=(n=this.pcManager)===null||n===void 0?void 0:n.currentState)!==null&&i!==void 0?i:ue.NEW)===ue.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(r){this.reconnectAttempts+=1;let s=!0;r instanceof ye?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:r})),s=!1):r instanceof Xt||(this.fullReconnectOnNext=!0),s?this.handleDisconnect("reconnect",Dt.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(_.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(A){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:A}))}return null}restartConnection(e){return C(this,void 0,void 0,function*(){var A,n,i;try{if(!this.url||!this.token)throw new ye("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(_.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let r;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Xt;r=yield this.join(e??this.url,this.token,this.signalOpts)}catch(s){throw s instanceof Ae&&s.reason===J.NotAllowed?new ye("could not reconnect, token might be expired"):new Xt}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(_.SignalRestarted,r),yield this.waitForPCReconnected(),this.client.currentState!==ne.CONNECTED)throw new Xt("Signal connection got severed during reconnect");(A=this.regionUrlProvider)===null||A===void 0||A.resetAttempts(),this.emit(_.Restarted)}catch(r){const s=yield(n=this.regionUrlProvider)===null||n===void 0?void 0:n.getNextBestRegionUrl();if(s){yield this.restartConnection(s);return}else throw(i=this.regionUrlProvider)===null||i===void 0||i.resetAttempts(),r}})}resumeConnection(e){return C(this,void 0,void 0,function*(){var A;if(!this.url||!this.token)throw new ye("could not reconnect, url or token not saved");if(!this.pcManager)throw new ye("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(_.Resuming);let n;try{this.setupSignalClientCallbacks(),n=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let r="";throw i instanceof Error&&(r=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof Ae&&i.reason===J.NotAllowed?new ye("could not reconnect, token might be expired"):i instanceof Ae&&i.reason===J.LeaveRequest?i:new Xt(r)}if(this.emit(_.SignalResumed),n){const i=this.makeRTCConfiguration(n);this.pcManager.updateConfiguration(i)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==ne.CONNECTED)throw new Xt("Signal connection got severed during reconnect");this.client.setReconnected(),((A=this.reliableDC)===null||A===void 0?void 0:A.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),this.emit(_.Resumed)})}waitForPCInitialConnection(e,A){return C(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(A,e)})}waitForPCReconnected(){return C(this,void 0,void 0,function*(){this.pcState=hA.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield Ke(Hb),!this.pcManager)throw new ye("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=hA.Connected}catch(e){throw this.pcState=hA.Disconnected,new Ae("could not establish PC connection, ".concat(e.message),J.InternalError)}})}publishRpcResponse(e,A,n,i){return C(this,void 0,void 0,function*(){const r=new Ne({destinationIdentities:[e],kind:X.RELIABLE,value:{case:"rpcResponse",value:new au({requestId:A,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(r,X.RELIABLE)})}publishRpcAck(e,A){return C(this,void 0,void 0,function*(){const n=new Ne({destinationIdentities:[e],kind:X.RELIABLE,value:{case:"rpcAck",value:new su({requestId:A})}});yield this.sendDataPacket(n,X.RELIABLE)})}sendDataPacket(e,A){return C(this,void 0,void 0,function*(){const n=e.toBinary();yield this.ensurePublisherConnected(A);const i=this.dataChannelForKind(A);i&&i.send(n),this.updateAndEmitDCBufferStatus(A)})}waitForBufferStatusLow(e){return new Promise((A,n)=>C(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))A();else{const i=()=>n("Engine closed");for(this.once(_.Closing,i);!this.dcBufferStatus.get(e);)yield Ke(10);this.off(_.Closing,i),A()}}))}ensureDataTransportConnected(e){return C(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var r;if(!n.pcManager)throw new ye("PC manager is closed");const s=i?n.pcManager.subscriber:n.pcManager.publisher,a=i?"Subscriber":"Publisher";if(!s)throw new Ae("".concat(a," connection not set"),J.InternalError);let o=!1;!i&&!n.dataChannelForKind(A,i)&&(n.createDataChannels(),o=!0),!o&&!i&&!n.pcManager.publisher.isICEConnected&&n.pcManager.publisher.getICEConnectionState()!=="checking"&&(o=!0),o&&n.negotiate();const c=n.dataChannelForKind(A,i);if((c==null?void 0:c.readyState)==="open")return;const l=new Date().getTime()+n.peerConnectionTimeout;for(;new Date().getTime()<l;){if(s.isICEConnected&&((r=n.dataChannelForKind(A,i))===null||r===void 0?void 0:r.readyState)==="open")return;yield Ke(50)}throw new Ae("could not establish ".concat(a," connection, state: ").concat(s.getICEConnectionState()),J.InternalError)}()})}ensurePublisherConnected(e){return C(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==ue.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return C(this,void 0,void 0,function*(){return new Promise((e,A)=>C(this,void 0,void 0,function*(){if(!this.pcManager){A(new aa("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const n=new AbortController,i=()=>{n.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&A("cannot negotiate on closed engine"),this.on(_.Closing,i),this.pcManager.publisher.once(Jt.RTPVideoPayloadTypes,r=>{const s=new Map;r.forEach(a=>{const o=a.codec.toLowerCase();qw(o)&&s.set(a.payload,o)}),this.emit(_.RTPVideoMapUpdate,s)});try{yield this.pcManager.negotiate(n),e()}catch(r){r instanceof aa&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Dt.RR_UNKNOWN),A(r)}finally{this.off(_.Closing,i)}}))})}dataChannelForKind(e,A){if(A){if(e===X.LOSSY)return this.lossyDCSub;if(e===X.RELIABLE)return this.reliableDCSub}else{if(e===X.LOSSY)return this.lossyDC;if(e===X.RELIABLE)return this.reliableDC}}sendSyncState(e,A){var n,i;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const r=this.pcManager.subscriber.getLocalDescription(),s=this.pcManager.subscriber.getRemoteDescription(),a=(i=(n=this.signalOpts)===null||n===void 0?void 0:n.autoSubscribe)!==null&&i!==void 0?i:!0,o=new Array,c=new Array;e.forEach(l=>{l.isDesired!==a&&o.push(l.trackSid),l.isEnabled||c.push(l.trackSid)}),this.client.sendSyncState(new Qu({answer:r?lr({sdp:r.sdp,type:r.type}):void 0,offer:s?lr({sdp:s.sdp,type:s.type}):void 0,subscription:new Xi({trackSids:o,subscribe:!a,participantTracks:[]}),publishTracks:ib(A),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:c}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],A=(n,i)=>{(n==null?void 0:n.id)!==void 0&&n.id!==null&&e.push(new Eu({label:n.label,id:n.id,target:i}))};return A(this.dataChannelForKind(X.LOSSY),cA.PUBLISHER),A(this.dataChannelForKind(X.RELIABLE),cA.PUBLISHER),A(this.dataChannelForKind(X.LOSSY,!0),cA.SUBSCRIBER),A(this.dataChannelForKind(X.RELIABLE,!0),cA.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Te.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Ve()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Ve()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Xt extends Error{}function Mb(t){return t!==void 0&&t>13}function Nb(t,e){const A=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=A,e.participantIdentity=A;const n=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=n,e.destinationIdentities=n}class Ka{constructor(e,A){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=A}updateToken(e){this.token=e}isCloud(){return ma(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return C(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const A=this.regionSettings.regions.filter(n=>!this.attemptedRegions.find(i=>i.url===n.url));if(A.length>0){const n=A[0];return this.attemptedRegions.push(n),W.debug("next region: ".concat(n.region)),n.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return C(this,void 0,void 0,function*(){const A=yield fetch("".concat(Kb(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(A.ok){const n=yield A.json();return this.lastUpdateAt=Date.now(),n}else throw new Ae("Could not fetch region settings: ".concat(A.statusText),A.status===401?J.NotAllowed:J.InternalError,A.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function Kb(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class th{get info(){return this._info}constructor(e,A,n){this.reader=A,this.totalByteSize=n,this._info=e,this.bytesReceived=0}}class Vb extends th{handleChunkReceived(e){var A;this.bytesReceived+=e.content.byteLength;const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(A=this.onProgress)===null||A===void 0||A.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>C(this,void 0,void 0,function*(){try{const{done:A,value:n}=yield e.read();return A?{done:!0,value:void 0}:(this.handleChunkReceived(n),{done:!1,value:n.content})}catch{return{done:!0,value:void 0}}}),return(){return C(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return C(this,void 0,void 0,function*(){var e,A,n,i;let r=new Set;try{for(var s=!0,a=XA(this),o;o=yield a.next(),e=o.done,!e;s=!0){i=o.value,s=!1;const c=i;r.add(c)}}catch(c){A={error:c}}finally{try{!s&&!e&&(n=a.return)&&(yield n.call(a))}finally{if(A)throw A.error}}return Array.from(r)})}}class Gb extends th{constructor(e,A,n){super(e,A,n),this.receivedChunks=new Map}handleChunkReceived(e){var A;const n=or(e.chunkIndex),i=this.receivedChunks.get(n);if(i&&i.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength;const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(A=this.onProgress)===null||A===void 0||A.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader(),A=new TextDecoder;return{next:()=>C(this,void 0,void 0,function*(){try{const{done:n,value:i}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:A.decode(i.content)})}catch{return{done:!0,value:void 0}}}),return(){return C(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return C(this,void 0,void 0,function*(){var e,A,n,i;let r="";try{for(var s=!0,a=XA(this),o;o=yield a.next(),e=o.done,!e;s=!0)i=o.value,s=!1,r+=i}catch(c){A={error:c}}finally{try{!s&&!e&&(n=a.return)&&(yield n.call(a))}finally{if(A)throw A.error}}return r})}}class nh{constructor(e,A,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=A}write(e){return this.defaultWriter.write(e)}close(){return C(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class jb extends nh{}class Wb extends nh{}class ih extends k{constructor(e,A,n,i,r){super(e,n,r),this.sid=A,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?x.Muted:x.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const A=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",A),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(x.Ended,this))};e.addEventListener("removetrack",A)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return C(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),Da)),rb()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var A;this.timeSyncHandle=requestAnimationFrame(()=>e());const n=(A=this.receiver)===null||A===void 0?void 0:A.getSynchronizationSources()[0];if(n){const{timestamp:i,rtpTimestamp:r}=n;r&&this.rtpTimestamp!==r&&(this.emit(x.TimeSyncUpdate,{timestamp:i,rtpTimestamp:r}),this.rtpTimestamp=r)}};e()}}class Jb extends ih{constructor(e,A,n,i,r,s){super(e,A,k.Kind.Audio,n,s),this.monitorReceiver=()=>C(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const a=yield this.getReceiverStats();a&&this.prevStats&&this.receiver&&(this._currentBitrate=ur(a,this.prevStats)),this.prevStats=a}),this.audioContext=i,this.webAudioPluginNodes=[],r&&(this.sinkId=r.deviceId)}setVolume(e){var A;for(const n of this.attachedElements)this.audioContext?(A=this.gainNode)===null||A===void 0||A.gain.setTargetAtTime(e,0,.1):n.volume=e;UA()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(UA())return 1;let e=0;return this.attachedElements.forEach(A=>{A.volume>e&&(e=A.volume)}),e}setSinkId(e){return C(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(A=>{if(pa(A))return A.setSinkId(e)}))})}attach(e){const A=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&pa(e)&&e.setSinkId(this.sinkId).catch(n=>{this.log.error("Failed to set sink id on remote audio track",n,this.logContext)}),this.audioContext&&A&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let A;return e?(A=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(A=super.detach(),this.disconnectWebAudio()),A}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,A){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(A.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(i=>{n.connect(i),n=i}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(x.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(i=>{this.emit(x.AudioPlaybackFailed,i)})}disconnectWebAudio(){var e,A;(e=this.gainNode)===null||e===void 0||e.disconnect(),(A=this.sourceNode)===null||A===void 0||A.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return C(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let A;return e.forEach(n=>{n.type==="inbound-rtp"&&(A={type:"audio",streamId:n.id,timestamp:n.timestamp,jitter:n.jitter,bytesReceived:n.bytesReceived,concealedSamples:n.concealedSamples,concealmentEvents:n.concealmentEvents,silentConcealedSamples:n.silentConcealedSamples,silentConcealmentEvents:n.silentConcealmentEvents,totalAudioEnergy:n.totalAudioEnergy,totalSamplesDuration:n.totalSamplesDuration})}),A})}}const Va=100;class Xb extends ih{constructor(e,A,n,i,r){super(e,A,k.Kind.Video,n,r),this.elementInfos=[],this.monitorReceiver=()=>C(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const s=yield this.getReceiverStats();s&&this.prevStats&&this.receiver&&(this._currentBitrate=ur(s,this.prevStats)),this.prevStats=s}),this.debouncedHandleResize=_a(()=>{this.updateDimensions()},Va),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(A=>{e?Vt(this._mediaStreamTrack,A):Kt(this._mediaStreamTrack,A)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(A=>A.element===e)===void 0){const A=new qb(e);this.observeElementInfo(A)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(A=>A===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const A=this.elementInfos.filter(n=>n===e);for(const n of A)n.stopObserving();this.elementInfos=this.elementInfos.filter(n=>n!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let A=[];if(e)return this.stopObservingElement(e),super.detach(e);A=super.detach();for(const n of A)this.stopObservingElement(n);return A}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return C(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let A,n="",i=new Map;return e.forEach(r=>{r.type==="inbound-rtp"?(n=r.codecId,A={type:"video",streamId:r.id,framesDecoded:r.framesDecoded,framesDropped:r.framesDropped,framesReceived:r.framesReceived,packetsReceived:r.packetsReceived,packetsLost:r.packetsLost,frameWidth:r.frameWidth,frameHeight:r.frameHeight,pliCount:r.pliCount,firCount:r.firCount,nackCount:r.nackCount,jitter:r.jitter,timestamp:r.timestamp,bytesReceived:r.bytesReceived,decoderImplementation:r.decoderImplementation}):r.type==="codec"&&i.set(r.id,r)}),A&&n!==""&&i.get(n)&&(A.mimeType=i.get(n).mimeType),A})}stopObservingElement(e){const A=this.elementInfos.filter(n=>n.element===e);for(const n of A)this.stopObservingElementInfo(n)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return C(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,A;const n=this.elementInfos.reduce((a,o)=>Math.max(a,o.visibilityChangedAt||0),0),i=!((A=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&A!==void 0)||A?this.isInBackground:!1,r=this.elementInfos.some(a=>a.pictureInPicture),s=this.elementInfos.some(a=>a.visible)&&!i||r;if(this.lastVisible!==s){if(!s&&Date.now()-n<Va){Te.setTimeout(()=>{this.updateVisibility()},Va);return}this.lastVisible=s,this.emit(x.VisibilityChanged,s,this)}}updateDimensions(){var e,A;let n=0,i=0;const r=this.getPixelDensity();for(const s of this.elementInfos){const a=s.width()*r,o=s.height()*r;a+o>n+i&&(n=a,i=o)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===n&&((A=this.lastDimensions)===null||A===void 0?void 0:A.height)===i||(this.lastDimensions={width:n,height:i},this.emit(x.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const A=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return A==="screen"?Qd():A||(Qd()>2?2:1)}}class qb{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,A){this.onVisibilityChanged=n=>{var i;const{target:r,isIntersecting:s}=n;r===this.element&&(this.isIntersecting=s,this.isPiP=In(this.element),this.visibilityChangedAt=Date.now(),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this))},this.onEnterPiP=()=>{var n,i,r;(i=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP),this.isPiP=In(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.onLeavePiP=()=>{var n;this.isPiP=In(this.element),(n=this.handleVisibilityChanged)===null||n===void 0||n.call(this)},this.element=e,this.isIntersecting=A??Ga(e),this.isPiP=Ve()&&In(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,A,n;this.isIntersecting=Ga(this.element),this.isPiP=In(this.element),this.element.handleResize=()=>{var i;(i=this.handleResize)===null||i===void 0||i.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Sd().observe(this.element),Ed().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(n=(A=window.documentPictureInPicture)===null||A===void 0?void 0:A.window)===null||n===void 0||n.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,A,n,i,r;(e=Sd())===null||e===void 0||e.unobserve(this.element),(A=Ed())===null||A===void 0||A.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(n=window.documentPictureInPicture)===null||n===void 0||n.removeEventListener("enter",this.onEnterPiP),(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.removeEventListener("pagehide",this.onLeavePiP)}}function In(t){var e,A;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?Ga(t,(A=window.documentPictureInPicture)===null||A===void 0?void 0:A.window):!1}function Ga(t,e){const A=e||window;let n=t.offsetTop,i=t.offsetLeft;const r=t.offsetWidth,s=t.offsetHeight,{hidden:a}=t,{display:o}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,n+=t.offsetTop,i+=t.offsetLeft;return n<A.pageYOffset+A.innerHeight&&i<A.pageXOffset+A.innerWidth&&n+s>A.pageYOffset&&i+r>A.pageXOffset&&!a&&o!=="none"}class _A extends yA.EventEmitter{constructor(e,A,n,i){var r;super(),this.metadataMuted=!1,this.encryption=qe.NONE,this.log=W,this.handleMuted=()=>{this.emit(x.Muted)},this.handleUnmuted=()=>{this.emit(x.Unmuted)},this.log=FA((r=i==null?void 0:i.loggerName)!==null&&r!==void 0?r:lA.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=A,this.trackName=n,this.source=k.Source.Unknown}setTrack(e){this.track&&(this.track.off(x.Muted,this.handleMuted),this.track.off(x.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(x.Muted,this.handleMuted),e.on(x.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),z(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==qe.NONE}get audioTrack(){if(xA(this.track))return this.track}get videoTrack(){if(Wt(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=k.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===k.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(_A||(_A={}));class ja extends _A{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,A,n,i){super(e,A.sid,A.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(x.Ended)},this.updateInfo(A),this.setTrack(n)}setTrack(e){this.track&&this.track.off(x.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(x.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return C(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return C(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return C(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return C(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(xA(this.track)){const A=this.track.getSourceTrackSettings(),n=new Set;return A.autoGainControl&&n.add(oA.TF_AUTO_GAIN_CONTROL),A.echoCancellation&&n.add(oA.TF_ECHO_CANCELLATION),A.noiseSuppression&&n.add(oA.TF_NOISE_SUPPRESSION),A.channelCount&&A.channelCount>1&&n.add(oA.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(oA.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(oA.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function gr(t,e){return C(this,void 0,void 0,function*(){t??(t={});let A=!1;const{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:r}=Pd(t);let s=r.audio,a=r.video;if(n&&typeof r.audio=="object"&&(r.audio.processor=n),i&&typeof r.video=="object"&&(r.video.processor=i),t.audio&&typeof r.audio=="object"&&typeof r.audio.deviceId=="string"){const u=r.audio.deviceId;r.audio.deviceId={exact:u},A=!0,s=Object.assign(Object.assign({},r.audio),{deviceId:{ideal:u}})}if(r.video&&typeof r.video=="object"&&typeof r.video.deviceId=="string"){const u=r.video.deviceId;r.video.deviceId={exact:u},A=!0,a=Object.assign(Object.assign({},r.video),{deviceId:{ideal:u}})}(r.audio===!0||typeof r.audio=="object"&&!r.audio.deviceId)&&(r.audio={deviceId:"default"}),r.video===!0?r.video={deviceId:"default"}:typeof r.video=="object"&&!r.video.deviceId&&(r.video.deviceId="default");const o=Fd(r,Gd,jd),c=Ea(o),l=navigator.mediaDevices.getUserMedia(c);r.audio&&(Qe.userMediaPromiseMap.set("audioinput",l),l.catch(()=>Qe.userMediaPromiseMap.delete("audioinput"))),r.video&&(Qe.userMediaPromiseMap.set("videoinput",l),l.catch(()=>Qe.userMediaPromiseMap.delete("videoinput")));try{const u=yield l;return yield Promise.all(u.getTracks().map(d=>C(this,void 0,void 0,function*(){const h=d.kind==="audio";let p=h?o.audio:o.video;(typeof p=="boolean"||!p)&&(p={});let f;const m=h?c.audio:c.video;typeof m!="boolean"&&(f=m);const B=d.getSettings().deviceId;f!=null&&f.deviceId&&$A(f.deviceId)!==B?f.deviceId=B:f||(f={deviceId:B});const b=Eb(d,f,e);return b.kind===k.Kind.Video?b.source=k.Source.Camera:b.kind===k.Kind.Audio&&(b.source=k.Source.Microphone),b.mediaStream=u,xA(b)&&n?yield b.setProcessor(n):Wt(b)&&i&&(yield b.setProcessor(i)),b})))}catch(u){if(!A)throw u;return gr(Object.assign(Object.assign({},t),{audio:s,video:a}),e)}})}function Yb(t){return C(this,void 0,void 0,function*(){return(yield gr({audio:!1,video:t??!0}))[0]})}function zb(t){return C(this,void 0,void 0,function*(){return(yield gr({audio:t??!0,video:!1}))[0]})}var tt;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(tt||(tt={}));function Zb(t){switch(t){case yn.EXCELLENT:return tt.Excellent;case yn.GOOD:return tt.Good;case yn.POOR:return tt.Poor;case yn.LOST:return tt.Lost;default:return tt.Unknown}}class rh extends yA.EventEmitter{get logContext(){var e,A;return Object.assign({},(A=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||A===void 0?void 0:A.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===Ji.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===Ht.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,A,n,i,r,s){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Ji.STANDARD;var o;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=tt.Unknown,this.log=W,this.log=FA((o=s==null?void 0:s.loggerName)!==null&&o!==void 0?o:lA.Participant),this.loggerOptions=s,this.setMaxListeners(100),this.sid=e,this.identity=A,this.name=n,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=a,this._attributes=r??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,A]of this.trackPublications)if(A.source===e)return A}getTrackPublicationByName(e){for(const[,A]of this.trackPublications)if(A.trackName===e)return A}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new wa,this.once(P.Active,()=>{var e,A;(A=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||A===void 0||A.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const A=this.getTrackPublication(k.Source.Camera);return!(!((e=A==null?void 0:A.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const A=this.getTrackPublication(k.Source.Microphone);return!(!((e=A==null?void 0:A.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(k.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var A;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===Ht.ACTIVE&&((A=this.participantInfo)===null||A===void 0?void 0:A.state)!==Ht.ACTIVE&&this.emit(P.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const A=this.metadata!==e,n=this.metadata;this.metadata=e,A&&this.emit(P.ParticipantMetadataChanged,n)}_setName(e){const A=this.name!==e;this.name=e,A&&this.emit(P.ParticipantNameChanged,e)}_setAttributes(e){const A=sb(this.attributes,e);this._attributes=e,Object.keys(A).length>0&&this.emit(P.AttributesChanged,A)}setPermissions(e){var A,n,i,r,s,a;const o=this.permissions,c=e.canPublish!==((A=this.permissions)===null||A===void 0?void 0:A.canPublish)||e.canSubscribe!==((n=this.permissions)===null||n===void 0?void 0:n.canSubscribe)||e.canPublishData!==((i=this.permissions)===null||i===void 0?void 0:i.canPublishData)||e.hidden!==((r=this.permissions)===null||r===void 0?void 0:r.hidden)||e.recorder!==((s=this.permissions)===null||s===void 0?void 0:s.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((l,u)=>{var d;return l!==((d=this.permissions)===null||d===void 0?void 0:d.canPublishSources[u])})||e.canSubscribeMetrics!==((a=this.permissions)===null||a===void 0?void 0:a.canSubscribeMetrics);return this.permissions=e,c&&this.emit(P.ParticipantPermissionsChanged,o),c}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(P.IsSpeakingChanged,e))}setConnectionQuality(e){const A=this._connectionQuality;this._connectionQuality=Zb(e),A!==this._connectionQuality&&this.emit(P.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,A;this.activeFuture&&((A=(e=this.activeFuture).reject)===null||A===void 0||A.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(A=>xA(A.track)&&A.track.setAudioContext(e))}addTrackPublication(e){e.on(x.Muted,()=>{this.emit(P.TrackMuted,e)}),e.on(x.Unmuted,()=>{this.emit(P.TrackUnmuted,e)});const A=e;switch(A.track&&(A.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case k.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case k.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function $b(t){var e,A,n;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new yu({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(A=t.participantSid)!==null&&A!==void 0?A:"",allTracks:(n=t.allowAll)!==null&&n!==void 0?n:!1,trackSids:t.allowedTrackSids||[]})}const sh=15e3;class ey extends rh{constructor(e,A,n,i,r){super(e,A,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=qe.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new wa)},this.handleReconnected=()=>{var s,a;(a=(s=this.reconnectFuture)===null||s===void 0?void 0:s.resolve)===null||a===void 0||a.call(s),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var s,a;this.reconnectFuture&&(this.reconnectFuture.promise.catch(o=>this.log.warn(o.message,this.logContext)),(a=(s=this.reconnectFuture)===null||s===void 0?void 0:s.reject)===null||a===void 0||a.call(s,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=s=>{const{requestId:a,reason:o,message:c}=s,l=this.pendingSignalRequests.get(a);l&&(o!==qs.OK&&l.reject(new Bd(c,o)),this.pendingSignalRequests.delete(a))},this.handleDataPacket=s=>{switch(s.value.case){case"rpcResponse":let a=s.value.value,o=null,c=null;a.value.case==="payload"?o=a.value.value:a.value.case==="error"&&(c=de.fromProto(a.value.value)),this.handleIncomingRpcResponse(a.requestId,o,c);break;case"rpcAck":let l=s.value.value;this.handleIncomingRpcAck(l.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(s=>$b(s)))},this.onTrackUnmuted=s=>{this.onTrackMuted(s,s.isUpstreamPaused)},this.onTrackMuted=(s,a)=>{if(a===void 0&&(a=!0),!s.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),z(s)));return}this.engine.updateMuteStatus(s.sid,a)},this.onTrackUpstreamPaused=s=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),z(s))),this.onTrackMuted(s,!0)},this.onTrackUpstreamResumed=s=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),z(s))),this.onTrackMuted(s,s.isMuted)},this.onTrackFeatureUpdate=s=>{const a=this.audioTrackPublications.get(s.sid);if(!a){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(s.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(a.trackSid,a.getTrackFeatures())},this.handleSubscribedQualityUpdate=s=>C(this,void 0,void 0,function*(){var a,o,c,l,u,d;if(!(!((u=this.roomOptions)===null||u===void 0)&&u.dynacast))return;const h=this.videoTrackPublications.get(s.trackSid);if(!h){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}if(s.subscribedCodecs.length>0){if(!h.videoTrack)return;const B=yield h.videoTrack.setPublishingCodecs(s.subscribedCodecs);try{for(var p=!0,f=XA(B),m;m=yield f.next(),a=m.done,!a;p=!0){l=m.value,p=!1;const b=l;Hw(b)&&(this.log.debug("publish ".concat(b," for ").concat(h.videoTrack.sid),Object.assign(Object.assign({},this.logContext),z(h))),yield this.publishAdditionalCodecForTrack(h.videoTrack,b,h.options))}}catch(b){o={error:b}}finally{try{!p&&!a&&(c=f.return)&&(yield c.call(f))}finally{if(o)throw o.error}}}else s.subscribedQualities.length>0&&(yield(d=h.videoTrack)===null||d===void 0?void 0:d.setPublishingLayers(s.subscribedQualities))}),this.handleLocalTrackUnpublished=s=>{const a=this.trackPublications.get(s.trackSid);if(!a){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}this.unpublishTrack(a.track)},this.handleTrackEnded=s=>C(this,void 0,void 0,function*(){if(s.source===k.Source.ScreenShare||s.source===k.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),z(s))),this.unpublishTrack(s);else if(s.isUserProvided)yield s.mute();else if(vt(s)||et(s))try{if(Ve())try{const a=yield navigator==null?void 0:navigator.permissions.query({name:s.source===k.Source.Camera?"camera":"microphone"});if(a&&a.state==="denied")throw this.log.warn("user has revoked access to ".concat(s.source),Object.assign(Object.assign({},this.logContext),z(s))),a.onchange=()=>{a.state!=="denied"&&(s.isMuted||s.restartTrack(),a.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}s.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),z(s))),vt(s)?yield s.restartTrack({deviceId:"default"}):yield s.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),z(s))),yield s.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=n,this.roomOptions=i,this.setupEngine(n),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=r}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==qe.NONE}getTrackPublication(e){const A=super.getTrackPublication(e);if(A)return A}getTrackPublicationByName(e){const A=super.getTrackPublicationByName(e);if(A)return A}setupEngine(e){this.engine=e,this.engine.on(_.RemoteMute,(A,n)=>{const i=this.trackPublications.get(A);!i||!i.track||(n?i.mute():i.unmute())}),this.engine.on(_.Connected,this.handleReconnected).on(_.SignalRestarted,this.handleReconnected).on(_.SignalResumed,this.handleReconnected).on(_.Restarting,this.handleReconnecting).on(_.Resuming,this.handleReconnecting).on(_.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(_.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(_.Disconnected,this.handleDisconnected).on(_.SignalRequestResponse,this.handleSignalRequestResponse).on(_.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return C(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return C(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return C(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return C(this,arguments,void 0,function(A){var n=this;let{metadata:i,name:r,attributes:s}=A;return function*(){return new Promise((a,o)=>C(n,void 0,void 0,function*(){var c,l;try{let u=!1;const d=yield this.engine.client.sendUpdateLocalMetadata((c=i??this.metadata)!==null&&c!==void 0?c:"",(l=r??this.name)!==null&&l!==void 0?l:"",s),h=performance.now();for(this.pendingSignalRequests.set(d,{resolve:a,reject:p=>{o(p),u=!0},values:{name:r,metadata:i,attributes:s}});performance.now()-h<5e3&&!u;){if((!r||this.name===r)&&(!i||this.metadata===i)&&(!s||Object.entries(s).every(p=>{let[f,m]=p;return this.attributes[f]===m||m===""&&!this.attributes[f]}))){this.pendingSignalRequests.delete(d),a();return}yield Ke(50)}o(new Bd("Request to update local metadata timed out","TimeoutError"))}catch(u){u instanceof Error&&o(u)}}))}()})}setCameraEnabled(e,A,n){return this.setTrackEnabled(k.Source.Camera,e,A,n)}setMicrophoneEnabled(e,A,n){return this.setTrackEnabled(k.Source.Microphone,e,A,n)}setScreenShareEnabled(e,A,n){return this.setTrackEnabled(k.Source.ScreenShare,e,A,n)}setPermissions(e){const A=this.permissions,n=super.setPermissions(e);return n&&A&&this.emit(P.ParticipantPermissionsChanged,A),n}setE2EEEnabled(e){return C(this,void 0,void 0,function*(){this.encryptionType=e?qe.GCM:qe.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,A,n,i){return C(this,void 0,void 0,function*(){var r,s;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:A})),this.republishPromise&&(yield this.republishPromise);let a=this.getTrackPublication(e);if(A)if(a)yield a.unmute();else{let o;if(this.pendingPublishing.has(e)){const c=yield this.waitForPendingPublicationOfSource(e);return c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield c==null?void 0:c.unmute(),c}this.pendingPublishing.add(e);try{switch(e){case k.Source.Camera:o=yield this.createTracks({video:(r=n)!==null&&r!==void 0?r:!0});break;case k.Source.Microphone:o=yield this.createTracks({audio:(s=n)!==null&&s!==void 0?s:!0});break;case k.Source.ScreenShare:o=yield this.createScreenTracks(Object.assign({},n));break;default:throw new IA(e)}}catch(c){throw o==null||o.forEach(l=>{l.stop()}),c instanceof Error&&this.emit(P.MediaDevicesError,c),this.pendingPublishing.delete(e),c}try{const c=[];for(const u of o)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),z(u))),c.push(this.publishTrack(u,i));[a]=yield Promise.all(c)}catch(c){throw o==null||o.forEach(l=>{l.stop()}),c}finally{this.pendingPublishing.delete(e)}}else if(!(a!=null&&a.track)&&this.pendingPublishing.has(e)&&(a=yield this.waitForPendingPublicationOfSource(e),a||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),a&&a.track)if(e===k.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const o=this.getTrackPublication(k.Source.ScreenShareAudio);o&&o.track&&this.unpublishTrack(o.track)}else yield a.mute();return a})}enableCameraAndMicrophone(){return C(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(k.Source.Camera)||this.pendingPublishing.has(k.Source.Microphone))){this.pendingPublishing.add(k.Source.Camera),this.pendingPublishing.add(k.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(A=>this.publishTrack(A)))}finally{this.pendingPublishing.delete(k.Source.Camera),this.pendingPublishing.delete(k.Source.Microphone)}}})}createTracks(e){return C(this,void 0,void 0,function*(){var A,n;e??(e={});const i=Fd(e,(A=this.roomOptions)===null||A===void 0?void 0:A.audioCaptureDefaults,(n=this.roomOptions)===null||n===void 0?void 0:n.videoCaptureDefaults);try{return(yield gr(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(a=>(xA(a)&&(this.microphoneError=void 0,a.setAudioContext(this.audioContext),a.source=k.Source.Microphone,this.emit(P.AudioStreamAcquired)),Wt(a)&&(this.cameraError=void 0,a.source=k.Source.Camera),a))}catch(r){throw r instanceof Error&&(e.audio&&(this.microphoneError=r),e.video&&(this.cameraError=r)),r}})}createScreenTracks(e){return C(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new sa("getDisplayMedia not supported");e.resolution===void 0&&!Gw()&&(e.resolution=ha.h1080fps30.resolution);const A=nb(e),n=yield navigator.mediaDevices.getDisplayMedia(A),i=n.getVideoTracks();if(i.length===0)throw new IA("no video track found");const r=new fr(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});r.source=k.Source.ScreenShare,e.contentHint&&(r.mediaStreamTrack.contentHint=e.contentHint);const s=[r];if(n.getAudioTracks().length>0){this.emit(P.AudioStreamAcquired);const a=new dr(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});a.source=k.Source.ScreenShareAudio,s.push(a)}return s})}publishTrack(e,A){return C(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,A)})}publishOrRepublishTrack(e,A){return C(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var a,o,c,l;vt(n)&&n.setAudioContext(r.audioContext),yield(a=r.reconnectFuture)===null||a===void 0?void 0:a.promise,r.republishPromise&&!s&&(yield r.republishPromise),jt(n)&&r.pendingPublishPromises.has(n)&&(yield r.pendingPublishPromises.get(n));let u;if(n instanceof MediaStreamTrack)u=n.getConstraints();else{u=n.constraints;let B;switch(n.source){case k.Source.Microphone:B="audioinput";break;case k.Source.Camera:B="videoinput"}B&&r.activeDeviceMap.has(B)&&(u=Object.assign(Object.assign({},u),{deviceId:r.activeDeviceMap.get(B)}))}if(n instanceof MediaStreamTrack)switch(n.kind){case"audio":n=new dr(n,u,!0,r.audioContext,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;case"video":n=new fr(n,u,!0,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;default:throw new IA("unsupported MediaStreamTrack kind ".concat(n.kind))}else n.updateLoggerOptions({loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});let d;if(r.trackPublications.forEach(B=>{B.track&&B.track===n&&(d=B)}),d)return r.log.warn("track has already been published, skipping",Object.assign(Object.assign({},r.logContext),z(d))),d;const h="channelCount"in n.mediaStreamTrack.getSettings()&&n.mediaStreamTrack.getSettings().channelCount===2||n.mediaStreamTrack.getConstraints().channelCount===2,p=(o=i==null?void 0:i.forceStereo)!==null&&o!==void 0?o:h;p&&(i||(i={}),i.dtx===void 0&&r.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},r.logContext),z(n))),i.red===void 0&&r.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(c=i.dtx)!==null&&c!==void 0||(i.dtx=!1),(l=i.red)!==null&&l!==void 0||(i.red=!1));const f=Object.assign(Object.assign({},r.roomOptions.publishDefaults),i);!jw()&&r.roomOptions.e2ee&&(r.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},r.logContext)),f.simulcast=!1),f.source&&(n.source=f.source);const m=new Promise((B,b)=>C(r,void 0,void 0,function*(){try{if(this.engine.client.currentState!==ne.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:z(n)}));const U=()=>C(this,void 0,void 0,function*(){try{const w=yield this.publish(n,f,p);B(w)}catch(w){b(w)}});setTimeout(()=>{this.engine.off(_.SignalConnected,U),b(new oa("publishing rejected as engine not connected within timeout",408))},15e3),this.engine.once(_.SignalConnected,U),this.engine.on(_.Closing,()=>{this.engine.off(_.SignalConnected,U),b(new oa("publishing rejected as engine closed",499))})}else try{const U=yield this.publish(n,f,p);B(U)}catch(U){b(U)}}catch(U){b(U)}}));r.pendingPublishPromises.set(n,m);try{return yield m}catch(B){throw B}finally{r.pendingPublishPromises.delete(n)}}()})}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),z(e))),!1;const{canPublish:A,canPublishSources:n}=this.permissions;return A&&(n.length===0||n.map(i=>ab(i)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),z(e))),!1)}publish(e,A,n){return C(this,void 0,void 0,function*(){var i,r,s,a,o,c,l,u,d,h;if(!this.hasPermissionsToPublish(e))throw new oa("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(v=>jt(e)&&v.source===e.source)&&e.source!==k.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),z(e))),A.stopMicTrackOnMute&&xA(e)&&(e.stopOnMute=!0),e.source===k.Source.ScreenShare&&Gt()&&(A.simulcast=!1),A.videoCodec==="av1"&&!Nw()&&(A.videoCodec=void 0),A.videoCodec==="vp9"&&!Kw()&&(A.videoCodec=void 0),A.videoCodec===void 0&&(A.videoCodec=Pa),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(v=>A.videoCodec===cr(v.mime))||(A.videoCodec=cr(this.enabledPublishVideoCodecs[0].mime)));const f=A.videoCodec;e.on(x.Muted,this.onTrackMuted),e.on(x.Unmuted,this.onTrackUnmuted),e.on(x.Ended,this.handleTrackEnded),e.on(x.UpstreamPaused,this.onTrackUpstreamPaused),e.on(x.UpstreamResumed,this.onTrackUpstreamResumed),e.on(x.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const m=new Gs({cid:e.mediaStreamTrack.id,name:A.name,type:k.kindToProto(e.kind),muted:e.isMuted,source:k.sourceToProto(e.source),disableDtx:!(!((i=A.dtx)!==null&&i!==void 0)||i),encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(!((r=A.red)!==null&&r!==void 0)||r),stream:A==null?void 0:A.stream,backupCodecPolicy:A==null?void 0:A.backupCodecPolicy});let B;if(e.kind===k.Kind.Video){let v={width:0,height:0};try{v=yield e.waitForDimensions()}catch{const E=(a=(s=this.roomOptions.videoCaptureDefaults)===null||s===void 0?void 0:s.resolution)!==null&&a!==void 0?a:Sn.h720.resolution;v={width:E.width,height:E.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),z(e)),{dims:v}))}m.width=v.width,m.height=v.height,et(e)&&(kn(f)&&(e.source===k.Source.ScreenShare&&(A.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),z(e))))),A.scalabilityMode=(o=A.scalabilityMode)!==null&&o!==void 0?o:"L3T3_KEY"),m.simulcastCodecs=[new Vs({codec:f,cid:e.mediaStreamTrack.id})],A.backupCodec===!0&&(A.backupCodec={codec:Pa}),A.backupCodec&&f!==A.backupCodec.codec&&m.encryption===qe.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),m.simulcastCodecs.push(new Vs({codec:A.backupCodec.codec,cid:""})))),B=Oa(e.source===k.Source.ScreenShare,m.width,m.height,A),m.layers=$d(m.width,m.height,B,kn(A.videoCodec))}else e.kind===k.Kind.Audio&&(B=[{maxBitrate:(c=A.audioPreset)===null||c===void 0?void 0:c.maxBitrate,priority:(u=(l=A.audioPreset)===null||l===void 0?void 0:l.priority)!==null&&u!==void 0?u:"high",networkPriority:(h=(d=A.audioPreset)===null||d===void 0?void 0:d.priority)!==null&&h!==void 0?h:"high"}]);if(!this.engine||this.engine.isClosed)throw new ye("cannot publish track when not connected");const b=()=>C(this,void 0,void 0,function*(){var v,y,E;if(!this.engine.pcManager)throw new ye("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,A,B),et(e)&&((v=A.degradationPreference)!==null&&v!==void 0||(A.degradationPreference=Lb(e)),e.setDegradationPreference(A.degradationPreference)),B)if(Gt()&&e.kind===k.Kind.Audio){let T;for(const F of this.engine.pcManager.publisher.getTransceivers())if(F.sender===e.sender){T=F;break}T&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:T,codec:"opus",maxbr:!((y=B[0])===null||y===void 0)&&y.maxBitrate?B[0].maxBitrate/1e3:0})}else e.codec&&kn(e.codec)&&(!((E=B[0])===null||E===void 0)&&E.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:m.cid,codec:e.codec,maxbr:B[0].maxBitrate/1e3});yield this.engine.negotiate()});let U;if(this.enabledPublishVideoCodecs.length>0)U=(yield Promise.all([this.engine.addTrack(m),b()]))[0];else{U=yield this.engine.addTrack(m);let v;if(U.codecs.forEach(y=>{v===void 0&&(v=y.mimeType)}),v&&e.kind===k.Kind.Video){const y=cr(v);y!==f&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),z(e)),{codec:y})),A.videoCodec=y,B=Oa(e.source===k.Source.ScreenShare,m.width,m.height,A))}yield b()}const w=new ja(e.kind,U,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return w.options=A,e.sid=U.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:B,trackInfo:U})),et(e)?e.startMonitor(this.engine.client):vt(e)&&e.startMonitor(),this.addTrackPublication(w),this.emit(P.LocalTrackPublished,w),w})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,A,n){return C(this,void 0,void 0,function*(){var i;if(this.encryptionType!==qe.NONE)return;let r;if(this.trackPublications.forEach(h=>{h.track&&h.track===e&&(r=h)}),!r)throw new IA("track is not published");if(!et(e))throw new IA("track is not a video track");const s=Object.assign(Object.assign({},(i=this.roomOptions)===null||i===void 0?void 0:i.publishDefaults),n),a=_b(e,A,s);if(!a){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),z(e)));return}const o=e.addSimulcastTrack(A,a);if(!o)return;const c=new Gs({cid:o.mediaStreamTrack.id,type:k.kindToProto(e.kind),muted:e.isMuted,source:k.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:s.videoCodec,cid:o.mediaStreamTrack.id}]});if(c.layers=$d(c.width,c.height,a),!this.engine||this.engine.isClosed)throw new ye("cannot publish track when not connected");const l=()=>C(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,o,s,a),yield this.engine.negotiate()}),d=(yield Promise.all([this.engine.addTrack(c),l()]))[0];this.log.debug("published ".concat(A," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:a,trackInfo:d}))})}unpublishTrack(e,A){return C(this,void 0,void 0,function*(){var n,i;if(jt(e)){const c=this.pendingPublishPromises.get(e);c&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),z(e))),yield c)}const r=this.getPublicationForTrack(e),s=r?z(r):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),s)),!r||!r.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),s));return}e=r.track,e.off(x.Muted,this.onTrackMuted),e.off(x.Unmuted,this.onTrackUnmuted),e.off(x.Ended,this.handleTrackEnded),e.off(x.UpstreamPaused,this.onTrackUpstreamPaused),e.off(x.UpstreamResumed,this.onTrackUpstreamResumed),e.off(x.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),A===void 0&&(A=(i=(n=this.roomOptions)===null||n===void 0?void 0:n.stopLocalTrackOnUnpublish)!==null&&i!==void 0?i:!0),A?e.stop():e.stopMonitor();let a=!1;const o=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<ue.FAILED&&o)try{for(const c of this.engine.pcManager.publisher.getTransceivers())c.sender===o&&(c.direction="inactive",a=!0);if(this.engine.removeTrack(o)&&(a=!0),et(e)){for(const[,c]of e.simulcastCodecs)c.sender&&(this.engine.removeTrack(c.sender)&&(a=!0),c.sender=void 0);e.simulcastCodecs.clear()}}catch(c){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),s),{error:c}))}switch(this.trackPublications.delete(r.trackSid),r.kind){case k.Kind.Audio:this.audioTrackPublications.delete(r.trackSid);break;case k.Kind.Video:this.videoTrackPublications.delete(r.trackSid);break}return this.emit(P.LocalTrackUnpublished,r),r.setTrack(void 0),a&&(yield this.engine.negotiate()),r})}unpublishTracks(e){return C(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>this.unpublishTrack(n)))).filter(n=>!!n)})}republishAllTracks(e){return C(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){n.republishPromise&&(yield n.republishPromise),n.republishPromise=new Promise((r,s)=>C(n,void 0,void 0,function*(){try{const a=[];this.trackPublications.forEach(o=>{o.track&&(A&&(o.options=Object.assign(Object.assign({},o.options),A)),a.push(o))}),yield Promise.all(a.map(o=>C(this,void 0,void 0,function*(){const c=o.track;yield this.unpublishTrack(c,!1),i&&!c.isMuted&&c.source!==k.Source.ScreenShare&&c.source!==k.Source.ScreenShareAudio&&(vt(c)||et(c))&&!c.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:o.trackSid})),yield c.restartTrack()),yield this.publishOrRepublishTrack(c,o.options,!0)}))),r()}catch(a){s(a)}finally{this.republishPromise=void 0}})),yield n.republishPromise}()})}publishData(e){return C(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const r=i.reliable?X.RELIABLE:X.LOSSY,s=i.destinationIdentities,a=i.topic,o=new Ne({kind:r,value:{case:"user",value:new nu({participantIdentity:n.identity,payload:A,destinationIdentities:s,topic:a})}});yield n.engine.sendDataPacket(o,r)}()})}publishDtmf(e,A){return C(this,void 0,void 0,function*(){const n=new Ne({kind:X.RELIABLE,value:{case:"sipDtmf",value:new iu({code:e,digit:A})}});yield this.engine.sendDataPacket(n,X.RELIABLE)})}sendChatMessage(e,A){return C(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:A==null?void 0:A.attachments},i=new Ne({value:{case:"chatMessage",value:new Ds(Object.assign(Object.assign({},n),{timestamp:re.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(i,X.RELIABLE),this.emit(P.ChatMessage,n),n})}editChatMessage(e,A){return C(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},A),{message:e,editTimestamp:Date.now()}),i=new Ne({value:{case:"chatMessage",value:new Ds(Object.assign(Object.assign({},n),{timestamp:re.parse(n.timestamp),editTimestamp:re.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,X.RELIABLE),this.emit(P.ChatMessage,n),n})}sendText(e,A){return C(this,void 0,void 0,function*(){var n;const i=crypto.randomUUID(),s=new TextEncoder().encode(e).byteLength,a=(n=A==null?void 0:A.attachments)===null||n===void 0?void 0:n.map(()=>crypto.randomUUID()),o=new Array(a?a.length+1:1).fill(0),c=(u,d)=>{var h;o[d]=u;const p=o.reduce((f,m)=>f+m,0);(h=A==null?void 0:A.onProgress)===null||h===void 0||h.call(A,p)},l=yield this.streamText({streamId:i,totalSize:s,destinationIdentities:A==null?void 0:A.destinationIdentities,topic:A==null?void 0:A.topic,attachedStreamIds:a,attributes:A==null?void 0:A.attributes});return yield l.write(e),c(1,0),yield l.close(),A!=null&&A.attachments&&a&&(yield Promise.all(A.attachments.map((u,d)=>C(this,void 0,void 0,function*(){return this._sendFile(a[d],u,{topic:A.topic,mimeType:u.type,onProgress:h=>{c(h,d+1)}})})))),l.info})}streamText(e){return C(this,void 0,void 0,function*(){var A,n;const i=(A=e==null?void 0:e.streamId)!==null&&A!==void 0?A:crypto.randomUUID(),r={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:(n=e==null?void 0:e.topic)!==null&&n!==void 0?n:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes},s=new Os({streamId:i,mimeType:r.mimeType,topic:r.topic,timestamp:Bt(r.timestamp),totalLength:Bt(e==null?void 0:e.totalSize),attributes:r.attributes,contentHeader:{case:"textHeader",value:new gu({version:e==null?void 0:e.version,attachedStreamIds:e==null?void 0:e.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?Hs.UPDATE:Hs.CREATE})}}),a=e==null?void 0:e.destinationIdentities,o=new Ne({destinationIdentities:a,value:{case:"streamHeader",value:s}});yield this.engine.sendDataPacket(o,X.RELIABLE);let c=0;const l=this,u=new WritableStream({write(p){return C(this,void 0,void 0,function*(){for(const f of Ab(p,sh)){yield l.engine.waitForBufferStatusLow(X.RELIABLE);const m=new Ms({content:f,streamId:i,chunkIndex:Bt(c)}),B=new Ne({destinationIdentities:a,value:{case:"streamChunk",value:m}});yield l.engine.sendDataPacket(B,X.RELIABLE),c+=1}})},close(){return C(this,void 0,void 0,function*(){const p=new Ns({streamId:i}),f=new Ne({destinationIdentities:a,value:{case:"streamTrailer",value:p}});yield l.engine.sendDataPacket(f,X.RELIABLE)})},abort(p){console.log("Sink error:",p)}});let d=()=>C(this,void 0,void 0,function*(){yield h.close()});l.engine.once(_.Closing,d);const h=new jb(u,r,()=>this.engine.off(_.Closing,d));return h})}sendFile(e,A){return C(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,A),{id:n}})}_sendFile(e,A,n){return C(this,void 0,void 0,function*(){var i;const r=yield this.streamBytes({streamId:e,totalSize:A.size,name:A.name,mimeType:(i=n==null?void 0:n.mimeType)!==null&&i!==void 0?i:A.type,topic:n==null?void 0:n.topic,destinationIdentities:n==null?void 0:n.destinationIdentities}),s=A.stream().getReader();for(;;){const{done:a,value:o}=yield s.read();if(a)break;yield r.write(o)}return yield r.close(),r.info})}streamBytes(e){return C(this,void 0,void 0,function*(){var A,n,i,r,s;const a=(A=e==null?void 0:e.streamId)!==null&&A!==void 0?A:crypto.randomUUID(),o=e==null?void 0:e.destinationIdentities,c={id:a,mimeType:(n=e==null?void 0:e.mimeType)!==null&&n!==void 0?n:"application/octet-stream",topic:(i=e==null?void 0:e.topic)!==null&&i!==void 0?i:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(r=e==null?void 0:e.name)!==null&&r!==void 0?r:"unknown"},l=new Os({totalLength:Bt((s=c.size)!==null&&s!==void 0?s:0),mimeType:c.mimeType,streamId:a,topic:c.topic,timestamp:Bt(Date.now()),attributes:c.attributes,contentHeader:{case:"byteHeader",value:new pu({name:c.name})}}),u=new Ne({destinationIdentities:o,value:{case:"streamHeader",value:l}});yield this.engine.sendDataPacket(u,X.RELIABLE);let d=0;const h=new Oe,p=this.engine,f=this.log,m=new WritableStream({write(b){return C(this,void 0,void 0,function*(){const U=yield h.lock();let w=0;try{for(;w<b.byteLength;){const v=b.slice(w,w+sh);yield p.waitForBufferStatusLow(X.RELIABLE);const y=new Ne({destinationIdentities:o,value:{case:"streamChunk",value:new Ms({content:v,streamId:a,chunkIndex:Bt(d)})}});yield p.sendDataPacket(y,X.RELIABLE),d+=1,w+=v.byteLength}}finally{U()}})},close(){return C(this,void 0,void 0,function*(){const b=new Ns({streamId:a}),U=new Ne({destinationIdentities:o,value:{case:"streamTrailer",value:b}});yield p.sendDataPacket(U,X.RELIABLE)})},abort(b){f.error("Sink error:",b)}});return new Wb(m,c)})}performRpc(e){return C(this,arguments,void 0,function(A){var n=this;let{destinationIdentity:i,method:r,payload:s,responseTimeout:a=1e4}=A;return function*(){return new Promise((c,l)=>C(n,void 0,void 0,function*(){var u,d,h,p;if(La(s)>Wd){l(de.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((d=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||d===void 0)&&d.version&&mt((p=(h=this.engine.latestJoinResponse)===null||h===void 0?void 0:h.serverInfo)===null||p===void 0?void 0:p.version,"1.8.0")<0){l(de.builtIn("UNSUPPORTED_SERVER"));return}const f=crypto.randomUUID();yield this.publishRpcRequest(i,f,r,s,a-2e3);const m=setTimeout(()=>{this.pendingAcks.delete(f),l(de.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(f),clearTimeout(B)},2e3);this.pendingAcks.set(f,{resolve:()=>{clearTimeout(m)},participantIdentity:i});const B=setTimeout(()=>{this.pendingResponses.delete(f),l(de.builtIn("RESPONSE_TIMEOUT"))},a);this.pendingResponses.set(f,{resolve:(b,U)=>{clearTimeout(B),this.pendingAcks.has(f)&&(console.warn("RPC response received before ack",f),this.pendingAcks.delete(f),clearTimeout(m)),U?l(U):c(b??"")},participantIdentity:i})}))}()})}registerRpcMethod(e,A){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,A)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=A,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const A=this.pendingAcks.get(e);A?(A.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,A,n){const i=this.pendingResponses.get(e);i?(i.resolve(A,n),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,A,n,i,r){return C(this,void 0,void 0,function*(){const s=new Ne({destinationIdentities:[e],kind:X.RELIABLE,value:{case:"rpcRequest",value:new ru({id:A,method:n,payload:i,responseTimeoutMs:r,version:1})}});yield this.engine.sendDataPacket(s,X.RELIABLE)})}handleParticipantDisconnected(e){for(const[A,{participantIdentity:n}]of this.pendingAcks)n===e&&this.pendingAcks.delete(A);for(const[A,{participantIdentity:n,resolve:i}]of this.pendingResponses)n===e&&(i(null,de.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(A))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(A=>A.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(A=>{var n,i;const r=this.trackPublications.get(A.sid);if(r){const s=r.isMuted||((i=(n=r.track)===null||n===void 0?void 0:n.isUpstreamPaused)!==null&&i!==void 0?i:!1);s!==A.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),z(r)),{mutedOnServer:s})),this.engine.client.sendMuteTrack(A.sid,s))}}),!0):!1}getPublicationForTrack(e){let A;return this.trackPublications.forEach(n=>{const i=n.track;i&&(e instanceof MediaStreamTrack?(vt(i)||et(i))&&i.mediaStreamTrack===e&&(A=n):e===i&&(A=n))}),A}waitForPendingPublicationOfSource(e){return C(this,void 0,void 0,function*(){const n=Date.now();for(;Date.now()<n+1e4;){const i=Array.from(this.pendingPublishPromises.entries()).find(r=>{let[s]=r;return s.source===e});if(i)return i[1];yield Ke(20)}})}}class Ay extends _A{constructor(e,A,n,i){super(e,A.sid,A.name,i),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=AA.HIGH,this.handleEnded=r=>{this.setTrack(void 0),this.emit(x.Ended,r)},this.handleVisibilityChange=r=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(r),this.logContext),this.disabled=!r,this.emitTrackUpdate()},this.handleVideoDimensionsChange=r=>{this.log.debug("adaptivestream video dimensions ".concat(r.width,"x").concat(r.height),this.logContext),this.videoDimensions=r,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(A)}setSubscribed(e){const A=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new Xi({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new cu({participantSid:"",trackSids:[this.trackSid]})]});this.emit(x.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(A),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?_A.SubscriptionStatus.Unsubscribed:super.isSubscribed?_A.SubscriptionStatus.Subscribed:_A.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?_A.PermissionStatus.Allowed:_A.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var A,n;this.isManualOperationAllowed()&&(((A=this.videoDimensions)===null||A===void 0?void 0:A.width)===e.width&&((n=this.videoDimensions)===null||n===void 0?void 0:n.height)===e.height||(Ua(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&Ua(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const A=this.subscriptionStatus,n=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off(x.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(x.VisibilityChanged,this.handleVisibilityChange),i.off(x.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(x.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(x.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(x.VisibilityChanged,this.handleVisibilityChange),e.on(x.Ended,this.handleEnded),this.emit(x.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(A))}setAllowed(e){const A=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(A)}setSubscriptionError(e){this.emit(x.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const A=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):A!==e.muted&&this.emit(e.muted?x.Muted:x.Unmuted)}emitSubscriptionUpdateIfChanged(e){const A=this.subscriptionStatus;e!==A&&this.emit(x.SubscriptionStatusChanged,A,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(x.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===k.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return Ua(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new Bu({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=AA.HIGH,this.emit(x.UpdateSettings,e)}}class pr extends rh{static fromParticipantInfo(e,A,n){return new pr(e,A.sid,A.identity,A.name,A.metadata,A.attributes,n,A.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,A,n,i,r,s,a){let o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:Ji.STANDARD;super(A,n||"",i,r,s,a,o),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(x.UpdateSettings,A=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),z(e))),this.signalClient.sendUpdateTrackSettings(A)}),e.on(x.UpdateSubscription,A=>{A.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(A)}),e.on(x.SubscriptionPermissionChanged,A=>{this.emit(P.TrackSubscriptionPermissionChanged,e,A)}),e.on(x.SubscriptionStatusChanged,A=>{this.emit(P.TrackSubscriptionStatusChanged,e,A)}),e.on(x.Subscribed,A=>{this.emit(P.TrackSubscribed,A,e)}),e.on(x.Unsubscribed,A=>{this.emit(P.TrackUnsubscribed,A,e)}),e.on(x.SubscriptionFailed,A=>{this.emit(P.TrackSubscriptionFailed,e.trackSid,A)})}getTrackPublication(e){const A=super.getTrackPublication(e);if(A)return A}getTrackPublicationByName(e){const A=super.getTrackPublicationByName(e);if(A)return A}setVolume(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:k.Source.Microphone;this.volumeMap.set(A,e);const n=this.getTrackPublication(A);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k.Source.Microphone;const A=this.getTrackPublication(e);return A&&A.track?A.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,A,n,i,r,s){let a=this.getTrackPublicationBySid(A);if(a||A.startsWith("TR")||this.trackPublications.forEach(l=>{!a&&e.kind===l.kind.toString()&&(a=l)}),!a){if(s===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:A})),this.emit(P.TrackSubscriptionFailed,A);return}s===void 0&&(s=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,A,n,i,r,s-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),z(a))),this.emit(P.TrackSubscriptionFailed,A);return}const o=e.kind==="video";let c;return o?c=new Xb(e,A,i,r):c=new Jb(e,A,i,this.audioContext,this.audioOutput),c.source=a.source,c.isMuted=a.isMuted,c.setMediaStream(n),c.start(),a.setTrack(c),this.volumeMap.has(a.source)&&ya(c)&&xA(c)&&c.setVolume(this.volumeMap.get(a.source)),a}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const A=new Map,n=new Map;return e.tracks.forEach(i=>{var r,s;let a=this.getTrackPublicationBySid(i.sid);if(a)a.updateInfo(i);else{const o=k.kindFromProto(i.type);if(!o)return;a=new Ay(o,i,(r=this.signalClient.connectOptions)===null||r===void 0?void 0:r.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(s=this.loggerOptions)===null||s===void 0?void 0:s.loggerName}),a.updateInfo(i),n.set(i.sid,a);const c=Array.from(this.trackPublications.values()).find(l=>l.source===(a==null?void 0:a.source));c&&a.source!==k.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(a.source),Object.assign(Object.assign({},this.logContext),{oldTrack:z(c),newTrack:z(a)})),this.addTrackPublication(a)}A.set(i.sid,a)}),this.trackPublications.forEach(i=>{A.has(i.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),z(i))),this.unpublishTrack(i.trackSid,!0))}),n.forEach(i=>{this.emit(P.TrackPublished,i)}),!0}unpublishTrack(e,A){const n=this.trackPublications.get(e);if(!n)return;const{track:i}=n;switch(i&&(i.stop(),n.setTrack(void 0)),this.trackPublications.delete(e),n.kind){case k.Kind.Audio:this.audioTrackPublications.delete(e);break;case k.Kind.Video:this.videoTrackPublications.delete(e);break}A&&this.emit(P.TrackUnpublished,n)}setAudioOutput(e){return C(this,void 0,void 0,function*(){this.audioOutput=e;const A=[];this.audioTrackPublications.forEach(n=>{var i;xA(n.track)&&ya(n.track)&&A.push(n.track.setSinkId((i=e.deviceId)!==null&&i!==void 0?i:"default"))}),yield Promise.all(A)})}emit(e){for(var A=arguments.length,n=new Array(A>1?A-1:0),i=1;i<A;i++)n[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:n})),super.emit(e,...n)}}var q;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(q||(q={}));const ty=4*1e3;class qt extends yA.EventEmitter{constructor(e){var A,n,i,r;if(super(),A=this,this.state=q.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=W,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(s,a,o)=>C(this,void 0,void 0,function*(){var c;if(!Vw())throw UA()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const l=yield this.disconnectLock.lock();if(this.state===q.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),l(),Promise.resolve();if(this.connectFuture)return l(),this.connectFuture.promise;this.setAndEmitConnectionState(q.Connecting),((c=this.regionUrlProvider)===null||c===void 0?void 0:c.getServerUrl().toString())!==s&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),ma(new URL(s))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Ka(s,a):this.regionUrlProvider.updateToken(a),this.regionUrlProvider.fetchRegionSettings().then(h=>{var p;(p=this.regionUrlProvider)===null||p===void 0||p.setServerReportedRegions(h)}).catch(h=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:h}))}));const u=(h,p,f)=>C(this,void 0,void 0,function*(){var m,B;this.abortController&&this.abortController.abort();const b=new AbortController;this.abortController=b,l==null||l();try{yield this.attemptConnection(f??s,a,o,b),this.abortController=void 0,h()}catch(U){if(this.regionUrlProvider&&U instanceof Ae&&U.reason!==J.Cancelled&&U.reason!==J.NotAllowed){let w=null;try{w=yield this.regionUrlProvider.getNextBestRegionUrl((m=this.abortController)===null||m===void 0?void 0:m.signal)}catch(v){if(v instanceof Ae&&(v.status===401||v.reason===J.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),p(v);return}}w&&!(!((B=this.abortController)===null||B===void 0)&&B.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(U.message,". Retrying with another region: ").concat(w),this.logContext),this.recreateEngine(),yield u(h,p,w)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Td(U)),p(U))}else{let w=aA.UNKNOWN_REASON;U instanceof Ae&&(w=Td(U)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,w),p(U)}}}),d=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new wa((h,p)=>{u(h,p,d)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(s,a,o,c,l,u)=>C(this,void 0,void 0,function*(){var d,h,p;const f=yield o.join(s,a,{autoSubscribe:c.autoSubscribe,adaptiveStream:typeof l.adaptiveStream=="object"?!0:l.adaptiveStream,maxRetries:c.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:c.websocketTimeout},u.signal);let m=f.serverInfo;if(m||(m={version:f.serverVersion,region:f.serverRegion}),this.serverInfo=m,this.log.debug("connected to Livekit Server ".concat(Object.entries(m).map(B=>{let[b,U]=B;return"".concat(b,": ").concat(U)}).join(", ")),{room:(d=f.room)===null||d===void 0?void 0:d.name,roomSid:(h=f.room)===null||h===void 0?void 0:h.sid,identity:(p=f.participant)===null||p===void 0?void 0:p.identity}),!m.version)throw new kw("unknown server version");return m.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),l.dynacast=!1),f}),this.applyJoinResponse=s=>{const a=s.participant;if(this.localParticipant.sid=a.sid,this.localParticipant.identity=a.identity,this.localParticipant.setEnabledPublishCodecs(s.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(s.sifTrailer)}catch(o){this.log.error(o instanceof Error?o.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:o}))}this.handleParticipantUpdates([a,...s.otherParticipants]),s.room&&this.handleRoomUpdate(s.room)},this.attemptConnection=(s,a,o,c)=>C(this,void 0,void 0,function*(){var l,u;this.state===q.Reconnecting||this.isResuming||!((l=this.engine)===null||l===void 0)&&l.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((u=this.regionUrlProvider)===null||u===void 0)&&u.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Ra),o),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const d=yield this.connectSignal(s,a,this.engine,this.connOptions,this.options,c);this.applyJoinResponse(d),this.setupLocalParticipantEvents(),this.emit(I.SignalConnected)}catch(d){yield this.engine.close(),this.recreateEngine();const h=new Ae("could not establish signal connection",J.ServerUnreachable);throw d instanceof Error&&(h.message="".concat(h.message,": ").concat(d.message)),d instanceof Ae&&(h.reason=d.reason,h.status=d.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:d})),h}if(c.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ae("Connection attempt aborted",J.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,c)}catch(d){throw yield this.engine.close(),this.recreateEngine(),d}Ve()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Ve()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(q.Connected),this.emit(I.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return C(A,[...a],void 0,function(){var c=this;let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var u,d,h,p;const f=yield c.disconnectLock.lock();try{if(c.state===q.Disconnected){c.log.debug("already disconnected",c.logContext);return}c.log.info("disconnect from room",Object.assign({},c.logContext)),(c.state===q.Connecting||c.state===q.Reconnecting||c.isResuming)&&(c.log.warn("abort connection attempt",c.logContext),(u=c.abortController)===null||u===void 0||u.abort(),(h=(d=c.connectFuture)===null||d===void 0?void 0:d.reject)===null||h===void 0||h.call(d,new Ae("Client initiated disconnect",J.Cancelled)),c.connectFuture=void 0),!((p=c.engine)===null||p===void 0)&&p.client.isDisconnected||(yield c.engine.client.sendLeave()),c.engine&&(yield c.engine.close()),c.handleDisconnect(l,aA.CLIENT_INITIATED),c.engine=void 0}finally{f()}}()})},this.onPageLeave=()=>C(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>C(this,void 0,void 0,function*(){const s=[],a=uA();if(a&&a.os==="iOS"){const o="livekit-dummy-audio-el";let c=document.getElementById(o);if(!c){c=document.createElement("audio"),c.id=o,c.autoplay=!0,c.hidden=!0;const l=Ca();l.enabled=!0;const u=new MediaStream([l]);c.srcObject=u,document.addEventListener("visibilitychange",()=>{c&&(c.srcObject=document.hidden?null:u,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(c),this.once(I.Disconnected,()=>{c==null||c.remove(),c=null})}s.push(c)}this.remoteParticipants.forEach(o=>{o.audioTrackPublications.forEach(c=>{c.track&&c.track.attachedElements.forEach(l=>{s.push(l)})})});try{yield Promise.all([this.acquireAudioContext(),...s.map(o=>(o.muted=!1,o.play()))]),this.handleAudioPlaybackStarted()}catch(o){throw this.handleAudioPlaybackFailed(o),o}}),this.startVideo=()=>C(this,void 0,void 0,function*(){const s=[];for(const a of this.remoteParticipants.values())a.videoTrackPublications.forEach(o=>{var c;(c=o.track)===null||c===void 0||c.attachedElements.forEach(l=>{s.includes(l)||s.push(l)})});yield Promise.all(s.map(a=>a.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(a=>{a.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const s of this.remoteParticipants.values())this.handleParticipantDisconnected(s.identity,s);this.setAndEmitConnectionState(q.Reconnecting)&&this.emit(I.Reconnecting)},this.handleSignalRestarted=s=>C(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(s.serverRegion),Object.assign(Object.assign({},this.logContext),{region:s.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(s);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(a){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:a}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:s.serverRegion}))}catch{return}this.setAndEmitConnectionState(q.Connected),this.emit(I.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=s=>{s.forEach(a=>{var o;if(a.identity===this.localParticipant.identity){this.localParticipant.updateInfo(a);return}a.identity===""&&(a.identity=(o=this.sidToIdentity.get(a.sid))!==null&&o!==void 0?o:"");let c=this.remoteParticipants.get(a.identity);a.state===Ht.DISCONNECTED?this.handleParticipantDisconnected(a.identity,c):c=this.getOrCreateParticipant(a.identity,a)})},this.handleActiveSpeakersUpdate=s=>{const a=[],o={};s.forEach(c=>{if(o[c.sid]=!0,c.sid===this.localParticipant.sid)this.localParticipant.audioLevel=c.level,this.localParticipant.setIsSpeaking(!0),a.push(this.localParticipant);else{const l=this.getRemoteParticipantBySid(c.sid);l&&(l.audioLevel=c.level,l.setIsSpeaking(!0),a.push(l))}}),o[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(c=>{o[c.sid]||(c.audioLevel=0,c.setIsSpeaking(!1))}),this.activeSpeakers=a,this.emitWhenConnected(I.ActiveSpeakersChanged,a)},this.handleSpeakersChanged=s=>{const a=new Map;this.activeSpeakers.forEach(c=>{const l=this.remoteParticipants.get(c.identity);l&&l.sid!==c.sid||a.set(c.sid,c)}),s.forEach(c=>{let l=this.getRemoteParticipantBySid(c.sid);c.sid===this.localParticipant.sid&&(l=this.localParticipant),l&&(l.audioLevel=c.level,l.setIsSpeaking(c.active),c.active?a.set(c.sid,l):a.delete(c.sid))});const o=Array.from(a.values());o.sort((c,l)=>l.audioLevel-c.audioLevel),this.activeSpeakers=o,this.emitWhenConnected(I.ActiveSpeakersChanged,o)},this.handleStreamStateUpdate=s=>{s.streamStates.forEach(a=>{const o=this.getRemoteParticipantBySid(a.participantSid);if(!o)return;const c=o.getTrackPublicationBySid(a.trackSid);if(!c||!c.track)return;const l=k.streamStateFromProto(a.state);l!==c.track.streamState&&(c.track.streamState=l,o.emit(P.TrackStreamStateChanged,c,c.track.streamState),this.emitWhenConnected(I.TrackStreamStateChanged,c,c.track.streamState,o))})},this.handleSubscriptionPermissionUpdate=s=>{const a=this.getRemoteParticipantBySid(s.participantSid);if(!a)return;const o=a.getTrackPublicationBySid(s.trackSid);o&&o.setAllowed(s.allowed)},this.handleSubscriptionError=s=>{const a=Array.from(this.remoteParticipants.values()).find(c=>c.trackPublications.has(s.trackSid));if(!a)return;const o=a.getTrackPublicationBySid(s.trackSid);o&&o.setSubscriptionError(s.err)},this.handleDataPacket=s=>{const a=this.remoteParticipants.get(s.participantIdentity);if(s.value.case==="user")this.handleUserPacket(a,s.value.value,s.kind);else if(s.value.case==="transcription")this.handleTranscription(a,s.value.value);else if(s.value.case==="sipDtmf")this.handleSipDtmf(a,s.value.value);else if(s.value.case==="chatMessage")this.handleChatMessage(a,s.value.value);else if(s.value.case==="metrics")this.handleMetrics(s.value.value,a);else if(s.value.case==="streamHeader")this.handleStreamHeader(s.value.value,s.participantIdentity);else if(s.value.case==="streamChunk")this.handleStreamChunk(s.value.value);else if(s.value.case==="streamTrailer")this.handleStreamTrailer(s.value.value);else if(s.value.case==="rpcRequest"){const o=s.value.value;this.handleIncomingRpcRequest(s.participantIdentity,o.id,o.method,o.payload,o.responseTimeoutMs,o.version)}},this.handleUserPacket=(s,a,o)=>{this.emit(I.DataReceived,a.payload,s,o,a.topic),s==null||s.emit(P.DataReceived,a.payload,o)},this.handleSipDtmf=(s,a)=>{this.emit(I.SipDTMFReceived,a,s),s==null||s.emit(P.SipDTMFReceived,a)},this.bufferedSegments=new Map,this.handleTranscription=(s,a)=>{const o=a.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(a.transcribedParticipantIdentity),c=o==null?void 0:o.trackPublications.get(a.trackId),l=zw(a,this.transcriptionReceivedTimes);c==null||c.emit(x.TranscriptionReceived,l),o==null||o.emit(P.TranscriptionReceived,l,c),this.emit(I.TranscriptionReceived,l,o,c)},this.handleChatMessage=(s,a)=>{const o=Zw(a);this.emit(I.ChatMessage,o,s)},this.handleMetrics=(s,a)=>{this.emit(I.MetricsReceived,s,a)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(I.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=s=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:s})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(I.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(I.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(I.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>C(this,void 0,void 0,function*(){var s,a,o;const c=Qe.getInstance().previousDevices,l=yield Qe.getInstance().getDevices(void 0,!1),u=uA();if((u==null?void 0:u.name)==="Chrome"&&u.os!=="iOS")for(let h of l){const p=c.find(f=>f.deviceId===h.deviceId);p&&p.label!==""&&p.kind===h.kind&&p.label!==h.label&&this.getActiveDevice(h.kind)==="default"&&this.emit(I.ActiveDeviceChanged,h.kind,h.deviceId)}const d=["audiooutput","audioinput","videoinput"];for(let h of d){const p=tb(h),f=this.localParticipant.getTrackPublication(p);if(f&&(!((s=f.track)===null||s===void 0)&&s.isUserProvided))continue;const m=l.filter(b=>b.kind===h),B=this.getActiveDevice(h);if(B===((a=c.filter(b=>b.kind===h)[0])===null||a===void 0?void 0:a.deviceId)&&m.length>0&&((o=m[0])===null||o===void 0?void 0:o.deviceId)!==B){yield this.switchActiveDevice(h,m[0].deviceId);continue}h==="audioinput"&&!ZA()||h==="videoinput"||m.length>0&&!m.find(b=>b.deviceId===this.getActiveDevice(h))&&(yield this.switchActiveDevice(h,m[0].deviceId))}this.emit(I.MediaDevicesChanged)}),this.handleRoomUpdate=s=>{const a=this.roomInfo;this.roomInfo=s,a&&a.metadata!==s.metadata&&this.emitWhenConnected(I.RoomMetadataChanged,s.metadata),(a==null?void 0:a.activeRecording)!==s.activeRecording&&this.emitWhenConnected(I.RecordingStatusChanged,s.activeRecording)},this.handleConnectionQualityUpdate=s=>{s.updates.forEach(a=>{if(a.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(a.quality);return}const o=this.getRemoteParticipantBySid(a.participantSid);o&&o.setConnectionQuality(a.quality)})},this.onLocalParticipantMetadataChanged=s=>{this.emit(I.ParticipantMetadataChanged,s,this.localParticipant)},this.onLocalParticipantNameChanged=s=>{this.emit(I.ParticipantNameChanged,s,this.localParticipant)},this.onLocalAttributesChanged=s=>{this.emit(I.ParticipantAttributesChanged,s,this.localParticipant)},this.onLocalTrackMuted=s=>{this.emit(I.TrackMuted,s,this.localParticipant)},this.onLocalTrackUnmuted=s=>{this.emit(I.TrackUnmuted,s,this.localParticipant)},this.onTrackProcessorUpdate=s=>{var a;(a=s==null?void 0:s.onPublish)===null||a===void 0||a.call(s,this)},this.onLocalTrackPublished=s=>C(this,void 0,void 0,function*(){var a,o,c,l,u,d;(a=s.track)===null||a===void 0||a.on(x.TrackProcessorUpdate,this.onTrackProcessorUpdate),(o=s.track)===null||o===void 0||o.on(x.Restarted,this.onLocalTrackRestarted),(u=(l=(c=s.track)===null||c===void 0?void 0:c.getProcessor())===null||l===void 0?void 0:l.onPublish)===null||u===void 0||u.call(l,this),this.emit(I.LocalTrackPublished,s,this.localParticipant),vt(s.track)&&(yield s.track.checkForSilence())&&this.emit(I.LocalAudioSilenceDetected,s);const h=yield(d=s.track)===null||d===void 0?void 0:d.getDeviceId(!1),p=_d(s.source);p&&h&&h!==this.localParticipant.activeDeviceMap.get(p)&&(this.localParticipant.activeDeviceMap.set(p,h),this.emit(I.ActiveDeviceChanged,p,h))}),this.onLocalTrackUnpublished=s=>{var a,o;(a=s.track)===null||a===void 0||a.off(x.TrackProcessorUpdate,this.onTrackProcessorUpdate),(o=s.track)===null||o===void 0||o.off(x.Restarted,this.onLocalTrackRestarted),this.emit(I.LocalTrackUnpublished,s,this.localParticipant)},this.onLocalTrackRestarted=s=>C(this,void 0,void 0,function*(){const a=yield s.getDeviceId(!1),o=_d(s.source);o&&a&&a!==this.localParticipant.activeDeviceMap.get(o)&&(this.log.debug("local track restarted, setting ".concat(o," ").concat(a," active"),this.logContext),this.localParticipant.activeDeviceMap.set(o,a),this.emit(I.ActiveDeviceChanged,o,a))}),this.onLocalConnectionQualityChanged=s=>{this.emit(I.ConnectionQualityChanged,s,this.localParticipant)},this.onMediaDevicesError=s=>{this.emit(I.MediaDevicesError,s)},this.onLocalParticipantPermissionsChanged=s=>{this.emit(I.ParticipantPermissionsChanged,s,this.localParticipant)},this.onLocalChatMessageSent=s=>{this.emit(I.ChatMessage,s,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},yb),e),this.log=FA((n=this.options.loggerName)!==null&&n!==void 0?n:lA.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Gd),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},jd),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},bb),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new Oe,this.localParticipant=new ey("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",$A(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",$A(this.options.audioCaptureDefaults.deviceId)),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&this.switchActiveDevice("audiooutput",$A(this.options.audioOutput.deviceId)).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),Ve()){const s=new AbortController;(r=navigator.mediaDevices)===null||r===void 0||r.addEventListener("devicechange",this.handleDeviceChange,{signal:s.signal}),qt.cleanupRegistry&&qt.cleanupRegistry.register(this,()=>{s.abort()})}}registerTextStreamHandler(e,A){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,A)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,A){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,A)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,A){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,A)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,A,n,i,r,s){return C(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,A),s!==1){yield this.engine.publishRpcResponse(e,A,null,de.builtIn("UNSUPPORTED_VERSION"));return}const a=this.rpcHandlers.get(n);if(!a){yield this.engine.publishRpcResponse(e,A,null,de.builtIn("UNSUPPORTED_METHOD"));return}let o=null,c=null;try{const l=yield a({requestId:A,callerIdentity:e,payload:i,responseTimeout:r});La(l)>Wd?(o=de.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(n))):c=l}catch(l){l instanceof de?o=l:(console.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),l),o=de.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,A,c,o)})}setE2EEEnabled(e){return C(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new ob(this.options.e2ee),this.e2eeManager.on(YA.ParticipantEncryptionStatusChanged,(A,n)=>{eb(n)&&(this.isE2EEEnabled=A),this.emit(I.ParticipantEncryptionStatusChanged,A,n)}),this.e2eeManager.on(YA.EncryptionError,A=>this.emit(I.EncryptionError,A)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&A!==void 0?A:!1}getSid(){return C(this,void 0,void 0,function*(){return this.state===q.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,A)=>{const n=i=>{i.sid!==""&&(this.engine.off(_.RoomUpdate,n),e(i.sid))};this.engine.on(_.RoomUpdate,n),this.once(I.Disconnected,()=>{this.engine.off(_.RoomUpdate,n),A("Room disconnected before room server id was available")})})})}get name(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&A!==void 0?A:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&A!==void 0?A:0}get numPublishers(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&A!==void 0?A:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Ob(this.options),this.engine.on(_.ParticipantUpdate,this.handleParticipantUpdates).on(_.RoomUpdate,this.handleRoomUpdate).on(_.SpeakersChanged,this.handleSpeakersChanged).on(_.StreamStateChanged,this.handleStreamStateUpdate).on(_.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(_.SubscriptionError,this.handleSubscriptionError).on(_.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(_.MediaTrackAdded,(e,A,n)=>{this.onTrackAdded(e,A,n)}).on(_.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(_.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(_.DataPacketReceived,this.handleDataPacket).on(_.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(q.SignalReconnecting)&&this.emit(I.SignalReconnecting)}).on(_.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(q.Connected)&&this.emit(I.Reconnected)}).on(_.SignalResumed,()=>{this.bufferedEvents=[],(this.state===q.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(_.Restarting,this.handleRestarting).on(_.SignalRestarted,this.handleSignalRestarted).on(_.Offline,()=>{this.setAndEmitConnectionState(q.Reconnecting)&&this.emit(I.Reconnecting)}).on(_.DCBufferStatusChanged,(e,A)=>{this.emit(I.DCBufferStatusChanged,e,A)}).on(_.LocalTrackSubscribed,e=>{const A=this.localParticipant.getTrackPublications().find(n=>{let{trackSid:i}=n;return i===e});if(!A){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(P.LocalTrackSubscribed,A),this.emitWhenConnected(I.LocalTrackSubscribed,A,this.localParticipant)}).on(_.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((A,n)=>{this.handleParticipantDisconnected(n,A)}),this.emit(I.Moved,e.room.name,e.token),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Qe.getInstance().getDevices(e,A)}prepareConnection(e,A){return C(this,void 0,void 0,function*(){if(this.state===q.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(ma(new URL(e))&&A){this.regionUrlProvider=new Ka(e,A);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===q.Disconnected&&(this.regionUrl=n,yield fetch(ba(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(ba(e),{method:"HEAD"})}catch(n){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:n}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,A){return C(this,void 0,void 0,function*(){let n=()=>{},i;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":i=new bA({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":i=new bA({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":i=new bA({scenario:{case:"serverLeave",value:!0}});break;case"migration":i=new bA({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":n=()=>C(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new bA({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":n=()=>C(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new bA({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":i=new bA({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),n=()=>C(this,void 0,void 0,function*(){const r=this.engine.client.onLeave;r&&r(new qi({reason:aA.CLIENT_INITIATED,action:Mt.RECONNECT}))});break;case"subscriber-bandwidth":if(A===void 0||typeof A!="number")throw new Error("subscriber-bandwidth requires a number as argument");i=new bA({scenario:{case:"subscriberBandwidth",value:Bt(A)}});break;case"leave-full-reconnect":i=new bA({scenario:{case:"leaveRequestFullReconnect",value:!0}})}i&&(yield this.engine.client.sendSimulateScenario(i),yield n())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,A){return C(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var a,o,c,l,u,d,h,p;let f=!0,m=!1;const B=s?{exact:i}:i;if(n==="audioinput"){m=r.localParticipant.audioTrackPublications.size===0;const b=(a=r.getActiveDevice(n))!==null&&a!==void 0?a:r.options.audioCaptureDefaults.deviceId;r.options.audioCaptureDefaults.deviceId=B;const U=Array.from(r.localParticipant.audioTrackPublications.values()).filter(w=>w.source===k.Source.Microphone);try{f=(yield Promise.all(U.map(w=>{var v;return(v=w.audioTrack)===null||v===void 0?void 0:v.setDeviceId(B)}))).every(w=>w===!0)}catch(w){throw r.options.audioCaptureDefaults.deviceId=b,w}}else if(n==="videoinput"){m=r.localParticipant.videoTrackPublications.size===0;const b=(o=r.getActiveDevice(n))!==null&&o!==void 0?o:r.options.videoCaptureDefaults.deviceId;r.options.videoCaptureDefaults.deviceId=B;const U=Array.from(r.localParticipant.videoTrackPublications.values()).filter(w=>w.source===k.Source.Camera);try{f=(yield Promise.all(U.map(w=>{var v;return(v=w.videoTrack)===null||v===void 0?void 0:v.setDeviceId(B)}))).every(w=>w===!0)}catch(w){throw r.options.videoCaptureDefaults.deviceId=b,w}}else if(n==="audiooutput"){if(!pa()&&!r.options.webAudioMix||r.options.webAudioMix&&r.audioContext&&!("setSinkId"in r.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");r.options.webAudioMix&&(i=(c=yield Qe.getInstance().normalizeDeviceId("audiooutput",i))!==null&&c!==void 0?c:""),(l=(p=r.options).audioOutput)!==null&&l!==void 0||(p.audioOutput={});const b=(u=r.getActiveDevice(n))!==null&&u!==void 0?u:r.options.audioOutput.deviceId;r.options.audioOutput.deviceId=i;try{r.options.webAudioMix&&((d=r.audioContext)===null||d===void 0||d.setSinkId(i)),yield Promise.all(Array.from(r.remoteParticipants.values()).map(U=>U.setAudioOutput({deviceId:i})))}catch(U){throw r.options.audioOutput.deviceId=b,U}}return(m||n==="audiooutput")&&(r.localParticipant.activeDeviceMap.set(n,n==="audiooutput"&&((h=r.options.audioOutput)===null||h===void 0?void 0:h.deviceId)||i),r.emit(I.ActiveDeviceChanged,n,i)),f}()})}setupLocalParticipantEvents(){this.localParticipant.on(P.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(P.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(P.AttributesChanged,this.onLocalAttributesChanged).on(P.TrackMuted,this.onLocalTrackMuted).on(P.TrackUnmuted,this.onLocalTrackUnmuted).on(P.LocalTrackPublished,this.onLocalTrackPublished).on(P.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(P.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(P.MediaDevicesError,this.onMediaDevicesError).on(P.AudioStreamAcquired,this.startAudio).on(P.ChatMessage,this.onLocalChatMessageSent).on(P.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,A,n){if(this.state===q.Connecting||this.state===q.Reconnecting){const l=()=>{this.onTrackAdded(e,A,n),u()},u=()=>{this.off(I.Reconnected,l),this.off(I.Connected,l),this.off(I.Disconnected,u)};this.once(I.Reconnected,l),this.once(I.Connected,l),this.once(I.Disconnected,u);return}if(this.state===q.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const i=Mw(A.id),r=i[0];let s=i[1],a=e.id;if(s&&s.startsWith("TR")&&(a=s),r===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const o=Array.from(this.remoteParticipants.values()).find(l=>l.sid===r);if(!o){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(r),this.logContext);return}let c;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?c=this.options.adaptiveStream:c={}),o.addSubscribedMediaTrack(e,a,A,n,c)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,A=arguments.length>1?arguments[1]:void 0;var n;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==q.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{i.unpublishTrack(r.trackSid)})}),this.localParticipant.trackPublications.forEach(i=>{var r,s,a;i.track&&this.localParticipant.unpublishTrack(i.track,e),e?((r=i.track)===null||r===void 0||r.detach(),(s=i.track)===null||s===void 0||s.stop()):(a=i.track)===null||a===void 0||a.stopMonitor()}),this.localParticipant.off(P.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(P.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(P.AttributesChanged,this.onLocalAttributesChanged).off(P.TrackMuted,this.onLocalTrackMuted).off(P.TrackUnmuted,this.onLocalTrackUnmuted).off(P.LocalTrackPublished,this.onLocalTrackPublished).off(P.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(P.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(P.MediaDevicesError,this.onMediaDevicesError).off(P.AudioStreamAcquired,this.startAudio).off(P.ChatMessage,this.onLocalChatMessageSent).off(P.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Ve()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(n=navigator.mediaDevices)===null||n===void 0||n.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(q.Disconnected),this.emit(I.Disconnected,A)}}}handleParticipantDisconnected(e,A){var n;this.remoteParticipants.delete(e),A&&(A.trackPublications.forEach(i=>{A.unpublishTrack(i.trackSid,!0)}),this.emit(I.ParticipantDisconnected,A),A.setDisconnected(),(n=this.localParticipant)===null||n===void 0||n.handleParticipantDisconnected(A.identity))}handleStreamHeader(e,A){return C(this,void 0,void 0,function*(){var n;if(e.contentHeader.case==="byteHeader"){const i=this.byteStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,name:(n=e.contentHeader.value.name)!==null&&n!==void 0?n:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:or(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:o=>{r=o,this.byteStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new Vb(s,a,or(e.totalLength)),{identity:A})}else if(e.contentHeader.case==="textHeader"){const i=this.textStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:o=>{r=o,this.textStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new Gb(s,a,or(e.totalLength)),{identity:A})}})}handleStreamChunk(e){const A=this.byteStreamControllers.get(e.streamId);A&&e.content.length>0&&A.controller.enqueue(e);const n=this.textStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e)}handleStreamTrailer(e){const A=this.textStreamControllers.get(e.streamId);A&&(A.info.attributes=Object.assign(Object.assign({},A.info.attributes),e.attributes),A.controller.close(),this.textStreamControllers.delete(e.streamId));const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.byteStreamControllers.delete(e.streamId))}acquireAudioContext(){return C(this,void 0,void 0,function*(){var e,A;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=xd())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(i=>i.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),Ke(200)])}catch(i){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:i}))}const n=((A=this.audioContext)===null||A===void 0?void 0:A.state)==="running";n!==this.canPlaybackAudio&&(this.audioEnabled=n,this.emit(I.AudioPlaybackStatusChanged,n))})}createParticipant(e,A){var n;let i;return A?i=pr.fromParticipantInfo(this.engine.client,A,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):i=new pr(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),!((n=this.options.audioOutput)===null||n===void 0)&&n.deviceId&&i.setAudioOutput(this.options.audioOutput).catch(r=>this.log.warn("Could not set audio output: ".concat(r.message),this.logContext)),i}getOrCreateParticipant(e,A){if(this.remoteParticipants.has(e)){const i=this.remoteParticipants.get(e);return A&&i.updateInfo(A)&&this.sidToIdentity.set(A.sid,A.identity),i}const n=this.createParticipant(e,A);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(A.sid,A.identity),this.emitWhenConnected(I.ParticipantConnected,n),n.on(P.TrackPublished,i=>{this.emitWhenConnected(I.TrackPublished,i,n)}).on(P.TrackSubscribed,(i,r)=>{i.kind===k.Kind.Audio?(i.on(x.AudioPlaybackStarted,this.handleAudioPlaybackStarted),i.on(x.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):i.kind===k.Kind.Video&&(i.on(x.VideoPlaybackFailed,this.handleVideoPlaybackFailed),i.on(x.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(I.TrackSubscribed,i,r,n)}).on(P.TrackUnpublished,i=>{this.emit(I.TrackUnpublished,i,n)}).on(P.TrackUnsubscribed,(i,r)=>{this.emit(I.TrackUnsubscribed,i,r,n)}).on(P.TrackMuted,i=>{this.emitWhenConnected(I.TrackMuted,i,n)}).on(P.TrackUnmuted,i=>{this.emitWhenConnected(I.TrackUnmuted,i,n)}).on(P.ParticipantMetadataChanged,i=>{this.emitWhenConnected(I.ParticipantMetadataChanged,i,n)}).on(P.ParticipantNameChanged,i=>{this.emitWhenConnected(I.ParticipantNameChanged,i,n)}).on(P.AttributesChanged,i=>{this.emitWhenConnected(I.ParticipantAttributesChanged,i,n)}).on(P.ConnectionQualityChanged,i=>{this.emitWhenConnected(I.ConnectionQualityChanged,i,n)}).on(P.ParticipantPermissionsChanged,i=>{this.emitWhenConnected(I.ParticipantPermissionsChanged,i,n)}).on(P.TrackSubscriptionStatusChanged,(i,r)=>{this.emitWhenConnected(I.TrackSubscriptionStatusChanged,i,r,n)}).on(P.TrackSubscriptionFailed,(i,r)=>{this.emit(I.TrackSubscriptionFailed,i,n,r)}).on(P.TrackSubscriptionPermissionChanged,(i,r)=>{this.emitWhenConnected(I.TrackSubscriptionPermissionChanged,i,r,n)}).on(P.Active,()=>{this.emitWhenConnected(I.ParticipantActive,n)}),A&&n.updateInfo(A),n}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((n,i)=>(n.push(...i.getTrackPublications()),n),[]),A=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,A)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const A of e.videoTrackPublications.values())A.isSubscribed&&$w(A)&&A.emitTrackUpdate()}getRemoteParticipantBySid(e){const A=this.sidToIdentity.get(e);if(A)return this.remoteParticipants.get(A)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Te.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,aA.STATE_MISMATCH))):e=0},ty)}clearConnectionReconcile(){this.connectionReconcileInterval&&Te.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(I.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[A,n]=e;this.emit(A,...n)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var A=arguments.length,n=new Array(A>1?A-1:0),i=1;i<A;i++)n[i-1]=arguments[i];if(this.state===q.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===q.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return C(this,void 0,void 0,function*(){var A,n;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),r=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new ji({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:re.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new ht({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(I.SignalConnected),this.emit(I.Connected),this.setAndEmitConnectionState(q.Connected),i.video){const s=new ja(k.Kind.Video,new Ot({source:Be.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO,name:"video-dummy"}),new fr(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:kd(160*((A=r.aspectRatios[0])!==null&&A!==void 0?A:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(P.LocalTrackPublished,s)}if(i.audio){const s=new ja(k.Kind.Audio,new Ot({source:Be.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO}),new dr(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:Ca(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(P.LocalTrackPublished,s)}for(let s=0;s<r.count-1;s+=1){let a=new ht({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(s),state:Ht.ACTIVE,tracks:[],joinedAt:re.parse(Date.now())});const o=this.getOrCreateParticipant(a.identity,a);if(r.video){const c=kd(160*((n=r.aspectRatios[s%r.aspectRatios.length])!==null&&n!==void 0?n:1),160,!1,!0),l=new Ot({source:Be.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO});o.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),a.tracks=[...a.tracks,l]}if(r.audio){const c=Ca(),l=new Ot({source:Be.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO});o.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),a.tracks=[...a.tracks,l]}o.updateInfo(a)}})}emit(e){for(var A=arguments.length,n=new Array(A>1?A-1:0),i=1;i<A;i++)n[i-1]=arguments[i];if(e!==I.ActiveSpeakersChanged&&e!==I.TranscriptionReceived){const r=ah(n).filter(s=>s!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:r}))}return super.emit(e,...n)}}qt.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function ah(t){return t.map(e=>{if(e)return Array.isArray(e)?ah(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var fA;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(fA||(fA={}));class nt extends yA.EventEmitter{constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=fA.IDLE,this.logs=[],this.options={},this.url=e,this.token=A,this.name=this.constructor.name,this.room=new qt(n.roomOptions),this.connectOptions=n.connectOptions,this.options=n}run(e){return C(this,void 0,void 0,function*(){if(this.status!==fA.IDLE)throw Error("check is running already");this.setStatus(fA.RUNNING);try{yield this.perform()}catch(A){A instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(A.message):this.appendError(A.message))}return yield this.disconnect(),yield new Promise(A=>setTimeout(A,500)),this.status!==fA.SKIPPED&&this.setStatus(this.isSuccess()?fA.SUCCESS:fA.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return C(this,void 0,void 0,function*(){return this.room.state===q.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return C(this,void 0,void 0,function*(){this.room&&this.room.state!==q.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(fA.SKIPPED)}switchProtocol(e){return C(this,void 0,void 0,function*(){let A=!1,n=!1;if(this.room.on(I.Reconnecting,()=>{A=!0}),this.room.once(I.Reconnected,()=>{n=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(r=>setTimeout(r,1e3)),!A)return;const i=Date.now()+1e4;for(;Date.now()<i;){if(n)return;yield Ke(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class ny extends nt{get description(){return"Cloud regions"}perform(){return C(this,void 0,void 0,function*(){const e=new Ka(this.url,this.token);if(!e.isCloud()){this.skip();return}const A=[],n=new Set;for(let r=0;r<3;r++){const s=yield e.getNextBestRegionUrl();if(!s)break;if(n.has(s))continue;n.add(s);const a=yield this.checkCloudRegion(s);this.appendMessage("".concat(a.region," RTT: ").concat(a.rtt,"ms, duration: ").concat(a.duration,"ms")),A.push(a)}A.sort((r,s)=>(r.duration-s.duration)*.5+(r.rtt-s.rtt)*.5);const i=A[0];this.bestStats=i,this.appendMessage("best Cloud region: ".concat(i.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return C(this,void 0,void 0,function*(){var A,n;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const i=(A=this.room.serverInfo)===null||A===void 0?void 0:A.region;if(!i)throw new Error("Region not found");const r=yield this.room.localParticipant.streamText({topic:"test"}),s=1e3,o=1e6/s,c="A".repeat(s),l=Date.now();for(let p=0;p<o;p++)yield r.write(c);yield r.close();const u=Date.now(),d=yield(n=this.room.engine.pcManager)===null||n===void 0?void 0:n.publisher.getStats(),h={region:i,rtt:1e4,duration:u-l};return d==null||d.forEach(p=>{p.type==="candidate-pair"&&p.nominated&&(h.rtt=p.currentRoundTripTime*1e3)}),yield this.disconnect(),h})}}const Wa=1e4;class iy extends nt{get description(){return"Connection via UDP vs TCP"}perform(){return C(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),A=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-A.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-A.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=A):this.appendMessage("best connection quality via udp");const n=this.bestStats;this.appendMessage("upstream bitrate: ".concat((n.bitrateTotal/n.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((n.rttTotal/n.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((n.jitterTotal/n.count*1e3).toFixed(2)," ms")),n.packetsLost>0&&this.appendWarning("packets lost: ".concat((n.packetsLost/n.packetsSent*100).toFixed(2),"%")),n.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((n.qualityLimitationDurations.bandwidth/(Wa/1e3)*100).toFixed(2),"%")),n.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((n.qualityLimitationDurations.cpu/(Wa/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return C(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const A=document.createElement("canvas");A.width=1280,A.height=720;const n=A.getContext("2d");if(!n)throw new Error("Could not get canvas context");let i=0;const r=()=>{i=(i+1)%360,n.fillStyle="hsl(".concat(i,", 100%, 50%)"),n.fillRect(0,0,A.width,A.height),requestAnimationFrame(r)};r();const a=A.captureStream(30).getVideoTracks()[0],c=(yield this.room.localParticipant.publishTrack(a,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,l={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},u=setInterval(()=>C(this,void 0,void 0,function*(){const d=yield c.getRTCStatsReport();d==null||d.forEach(h=>{h.type==="outbound-rtp"?(l.packetsSent=h.packetsSent,l.qualityLimitationDurations=h.qualityLimitationDurations,l.bitrateTotal+=h.targetBitrate,l.count++):h.type==="remote-inbound-rtp"&&(l.packetsLost=h.packetsLost,l.rttTotal+=h.roundTripTime,l.jitterTotal+=h.jitter)})}),1e3);return yield new Promise(d=>setTimeout(d,Wa)),clearInterval(u),a.stop(),A.remove(),yield this.disconnect(),l})}}class ry extends nt{get description(){return"Can publish audio"}perform(){return C(this,void 0,void 0,function*(){var e;const A=yield this.connect(),n=yield zb();if(yield Id(n,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),A.localParticipant.publishTrack(n),yield new Promise(a=>setTimeout(a,3e3));const r=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!r)throw new Error("Could not get RTCStats");let s=0;if(r.forEach(a=>{a.type==="outbound-rtp"&&(a.kind==="audio"||!a.kind&&a.mediaType==="audio")&&(s=a.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," audio packets"))})}}class sy extends nt{get description(){return"Can publish video"}perform(){return C(this,void 0,void 0,function*(){var e;const A=yield this.connect(),n=yield Yb();yield this.checkForVideo(n.mediaStreamTrack),A.localParticipant.publishTrack(n),yield new Promise(s=>setTimeout(s,5e3));const i=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let r=0;if(i.forEach(s=>{s.type==="outbound-rtp"&&(s.kind==="video"||!s.kind&&s.mediaType==="video")&&(r+=s.packetsSent)}),r===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(r," video packets"))})}checkForVideo(e){return C(this,void 0,void 0,function*(){const A=new MediaStream;A.addTrack(e.clone());const n=document.createElement("video");n.srcObject=A,n.muted=!0,yield new Promise(i=>{n.onplay=()=>{setTimeout(()=>{var r,s,a,o;const c=document.createElement("canvas"),l=e.getSettings(),u=(s=(r=l.width)!==null&&r!==void 0?r:n.videoWidth)!==null&&s!==void 0?s:1280,d=(o=(a=l.height)!==null&&a!==void 0?a:n.videoHeight)!==null&&o!==void 0?o:720;c.width=u,c.height=d;const h=c.getContext("2d");h.drawImage(n,0,0);const f=h.getImageData(0,0,c.width,c.height).data;let m=!0;for(let B=0;B<f.length;B+=4)if(f[B]!==0||f[B+1]!==0||f[B+2]!==0){m=!1;break}m?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),i()},1e3)},n.play()}),n.remove()})}}class ay extends nt{get description(){return"Resuming connection after interruption"}perform(){return C(this,void 0,void 0,function*(){var e;const A=yield this.connect();let n=!1,i=!1,r;const s=new Promise(c=>{setTimeout(c,5e3),r=c}),a=()=>{n=!0};A.on(I.SignalReconnecting,a).on(I.Reconnecting,a).on(I.Reconnected,()=>{i=!0,r(!0)}),(e=A.engine.client.ws)===null||e===void 0||e.close();const o=A.engine.client.onClose;if(o&&o(""),yield s,n){if(!i||A.state!==q.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class oy extends nt{get description(){return"Can connect via TURN"}perform(){return C(this,void 0,void 0,function*(){var e,A;const n=new ka,i=yield n.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let r=!1,s=!1,a=!1;for(let o of i.iceServers)for(let c of o.urls)c.startsWith("turn:")?(s=!0,a=!0):c.startsWith("turns:")&&(s=!0,a=!0,r=!0),c.startsWith("stun:")&&(a=!0);a?s&&!r&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield n.close(),!((A=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||A===void 0)&&A.iceServers||s?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(o=>setTimeout(o,0)))})}}class cy extends nt{get description(){return"Establishing WebRTC connection"}perform(){return C(this,void 0,void 0,function*(){let e=!1,A=!1;this.room.on(I.SignalConnected,()=>{const n=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(i,r)=>{if(i.candidate){const s=new RTCIceCandidate(i);let a="".concat(s.protocol," ").concat(s.address,":").concat(s.port," ").concat(s.type);s.address&&(ly(s.address)?a+=" (private)":s.protocol==="tcp"&&s.tcpType==="passive"?(e=!0,a+=" (passive)"):s.protocol==="udp"&&(A=!0)),this.appendMessage(a)}n&&n(i,r)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=i=>{i instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(i.errorCode," ").concat(i.errorText," ").concat(i.url))})});try{yield this.connect(),W.info("now the room is connected")}catch(n){throw this.appendWarning("ports need to be open on firewall in order to connect."),n}e||this.appendWarning("Server is not configured for ICE/TCP"),A||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function ly(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const A=parseInt(e[1],10);if(A>=16&&A<=31)return!0}}return!1}class uy extends nt{get description(){return"Connecting to signal connection via WebSocket"}perform(){return C(this,void 0,void 0,function*(){var e,A,n;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let i=new ka;const r=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(r.serverVersion,".")),((e=r.serverInfo)===null||e===void 0?void 0:e.edition)===lu.Cloud&&(!((A=r.serverInfo)===null||A===void 0)&&A.region)&&this.appendMessage("LiveKit Cloud: ".concat((n=r.serverInfo)===null||n===void 0?void 0:n.region)),yield i.close()})}}class HU extends yA.EventEmitter{constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=A,this.options=n}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:fA.IDLE,name:"",description:""}),e}updateCheck(e,A){this.checkResults.set(e,A),this.emit("checkUpdate",e,A)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==fA.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return C(this,void 0,void 0,function*(){const A=this.getNextCheckId(),n=new e(this.url,this.token,this.options),i=s=>{this.updateCheck(A,s)};n.on("update",i);const r=yield n.run();return n.off("update",i),r})}checkWebsocket(){return C(this,void 0,void 0,function*(){return this.createAndRunCheck(uy)})}checkWebRTC(){return C(this,void 0,void 0,function*(){return this.createAndRunCheck(cy)})}checkTURN(){return C(this,void 0,void 0,function*(){return this.createAndRunCheck(oy)})}checkReconnect(){return C(this,void 0,void 0,function*(){return this.createAndRunCheck(ay)})}checkPublishAudio(){return C(this,void 0,void 0,function*(){return this.createAndRunCheck(ry)})}checkPublishVideo(){return C(this,void 0,void 0,function*(){return this.createAndRunCheck(sy)})}checkConnectionProtocol(){return C(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(iy);if(e.data&&"protocol"in e.data){const A=e.data;this.options.protocol=A.protocol}return e})}checkCloudRegion(){return C(this,void 0,void 0,function*(){return this.createAndRunCheck(ny)})}}const dy=/\{[^{}]+\}/g;function hy(){return Math.random().toString(36).slice(2,11)}function fy(t){let{baseUrl:e="",Request:A=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:r,headers:s,...a}={...t};e=uh(e);const o=[];async function c(l,u){const{baseUrl:d,fetch:h=n,Request:p=A,headers:f,params:m={},parseAs:B="json",querySerializer:b,bodySerializer:U=r??py,body:w,...v}=u||{};d&&(e=uh(d));let y=typeof i=="function"?i:lh(i);b&&(y=typeof b=="function"?b:lh({...typeof i=="object"?i:{},...b}));const E=w===void 0?void 0:U(w),T=E===void 0||E instanceof FormData?{}:{"Content-Type":"application/json"},F={redirect:"follow",...a,...v,body:E,headers:By(T,s,f,m.header)};let R,D,O=new A(my(l,{baseUrl:e,params:m,querySerializer:y}),F);for(const N in v)N in O||(O[N]=v[N]);if(o.length){R=hy(),D=Object.freeze({baseUrl:e,fetch:h,parseAs:B,querySerializer:y,bodySerializer:U});for(const N of o)if(N&&typeof N=="object"&&typeof N.onRequest=="function"){const V=await N.onRequest({request:O,schemaPath:l,params:m,options:D,id:R});if(V){if(!(V instanceof A))throw new Error("onRequest: must return new Request() when modifying the request");O=V}}}let M=await h(O);if(o.length)for(let N=o.length-1;N>=0;N--){const V=o[N];if(V&&typeof V=="object"&&typeof V.onResponse=="function"){const Fe=await V.onResponse({request:O,response:M,schemaPath:l,params:m,options:D,id:R});if(Fe){if(!(Fe instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");M=Fe}}}if(M.status===204||M.headers.get("Content-Length")==="0")return M.ok?{data:{},response:M}:{error:{},response:M};if(M.ok)return B==="stream"?{data:M.body,response:M}:{data:await M[B](),response:M};let ae=await M.text();try{ae=JSON.parse(ae)}catch{}return{error:ae,response:M}}return{GET(l,u){return c(l,{...u,method:"GET"})},PUT(l,u){return c(l,{...u,method:"PUT"})},POST(l,u){return c(l,{...u,method:"POST"})},DELETE(l,u){return c(l,{...u,method:"DELETE"})},OPTIONS(l,u){return c(l,{...u,method:"OPTIONS"})},HEAD(l,u){return c(l,{...u,method:"HEAD"})},PATCH(l,u){return c(l,{...u,method:"PATCH"})},TRACE(l,u){return c(l,{...u,method:"TRACE"})},use(...l){for(const u of l)if(u){if(typeof u!="object"||!("onRequest"in u||"onResponse"in u))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");o.push(u)}},eject(...l){for(const u of l){const d=o.indexOf(u);d!==-1&&o.splice(d,1)}}}}function mr(t,e,A){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${(A==null?void 0:A.allowReserved)===!0?e:encodeURIComponent(e)}`}function oh(t,e,A){if(!e||typeof e!="object")return"";const n=[],i={simple:",",label:".",matrix:";"}[A.style]||"&";if(A.style!=="deepObject"&&A.explode===!1){for(const a in e)n.push(a,A.allowReserved===!0?e[a]:encodeURIComponent(e[a]));const s=n.join(",");switch(A.style){case"form":return`${t}=${s}`;case"label":return`.${s}`;case"matrix":return`;${t}=${s}`;default:return s}}for(const s in e){const a=A.style==="deepObject"?`${t}[${s}]`:s;n.push(mr(a,e[s],A))}const r=n.join(i);return A.style==="label"||A.style==="matrix"?`${i}${r}`:r}function ch(t,e,A){if(!Array.isArray(e))return"";if(A.explode===!1){const r={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[A.style]||",",s=(A.allowReserved===!0?e:e.map(a=>encodeURIComponent(a))).join(r);switch(A.style){case"simple":return s;case"label":return`.${s}`;case"matrix":return`;${t}=${s}`;default:return`${t}=${s}`}}const n={simple:",",label:".",matrix:";"}[A.style]||"&",i=[];for(const r of e)A.style==="simple"||A.style==="label"?i.push(A.allowReserved===!0?r:encodeURIComponent(r)):i.push(mr(t,r,A));return A.style==="label"||A.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function lh(t){return function(A){const n=[];if(A&&typeof A=="object")for(const i in A){const r=A[i];if(r!=null){if(Array.isArray(r)){if(r.length===0)continue;n.push(ch(i,r,{style:"form",explode:!0,...t==null?void 0:t.array,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}if(typeof r=="object"){n.push(oh(i,r,{style:"deepObject",explode:!0,...t==null?void 0:t.object,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}n.push(mr(i,r,t))}}return n.join("&")}}function gy(t,e){let A=t;for(const n of t.match(dy)??[]){let i=n.substring(1,n.length-1),r=!1,s="simple";if(i.endsWith("*")&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(s="label",i=i.substring(1)):i.startsWith(";")&&(s="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;const a=e[i];if(Array.isArray(a)){A=A.replace(n,ch(i,a,{style:s,explode:r}));continue}if(typeof a=="object"){A=A.replace(n,oh(i,a,{style:s,explode:r}));continue}if(s==="matrix"){A=A.replace(n,`;${mr(i,a)}`);continue}A=A.replace(n,s==="label"?`.${encodeURIComponent(a)}`:encodeURIComponent(a))}return A}function py(t){return t instanceof FormData?t:JSON.stringify(t)}function my(t,e){var i;let A=`${e.baseUrl}${t}`;(i=e.params)!=null&&i.path&&(A=gy(A,e.params.path));let n=e.querySerializer(e.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(A+=`?${n}`),A}function By(...t){const e=new Headers;for(const A of t){if(!A||typeof A!="object")continue;const n=A instanceof Headers?A.entries():Object.entries(A);for(const[i,r]of n)if(r===null)e.delete(i);else if(Array.isArray(r))for(const s of r)e.append(i,s);else r!==void 0&&e.set(i,r)}return e}function uh(t){return t.endsWith("/")?t.substring(0,t.length-1):t}class dh{constructor(e){this.client=fy({baseUrl:e.baseUrl,headers:e.headers,fetch:e.fetch})}setAuthToken(e){this.client.use({onRequest({request:A}){return A.headers.set("Authorization",`Bearer ${e}`),A}})}setApiToken(e){this.client.use({onRequest({request:A}){return A.headers.set("Authorization",`Token ${e}`),A}})}async getAuthUrl(e){return await this.client.GET("/api/auth/{type}",{params:{path:{type:e}}})}async getConnectUrl(e){return await this.client.GET("/api/connect/{type}",{params:{path:{type:e}}})}async logout(){return await this.client.POST("/api/logout")}async getCurrentUser(){return await this.client.GET("/api/me")}async clientInitialise(e,A={}){return await this.client.POST("/api/client/{appToken}/initialise",{params:{path:{appToken:e}},body:A})}async clientStartSession(e,A){return await this.client.POST("/api/client/{appToken}/start-session",{params:{path:{appToken:e}},body:A})}async createPresignedUploadUrl(e){return await this.client.POST("/api/files",{body:e})}async createKnowledgeBlock(e){return await this.client.POST("/api/knowledge",{body:e})}async listOnboardees(){return await this.client.GET("/api/onboardees")}async getOnboardee(e){return await this.client.GET("/api/onboardees/{id}",{params:{path:{id:e}}})}async getOnboardeeWidgetConfig(e,A){return await this.client.GET("/api/onboardees/{id}/config",{params:{path:{id:e}},signal:A})}async listPlans(){return await this.client.GET("/api/plans")}async listProducts(){return await this.client.GET("/api/products")}async getProduct(e){return await this.client.GET("/api/products/{id}",{params:{path:{id:e}}})}async getProductAnalytics(e,A,n){return await this.client.GET("/api/products/{id}/analytics",{params:{path:{id:e},query:{...A&&{start_date:A},...n&&{end_date:n}}}})}async createProduct(e){return await this.client.POST("/api/products",{body:e})}async updateProduct(e,A){return await this.client.PATCH("/api/products/{id}",{params:{path:{id:e}},body:A})}async getProductNavigationIndex(e){return await this.client.GET("/api/products/{id}/navigation-index",{params:{path:{id:e}}})}async replaceProductNavigationIndex(e,A){return await this.client.PUT("/api/products/{id}/navigation-index",{params:{path:{id:e}},body:A})}async listProductKnowledgeBlocks(e){return await this.client.GET("/api/products/{id}/knowledge-blocks",{params:{path:{id:e}}})}async createProductKnowledgeBlock(e,A){return await this.client.POST("/api/products/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async searchProductKnowledgeBlocks(e,A,n){return await this.client.GET("/api/products/{id}/knowledge-blocks/search",{params:{path:{id:e},query:{q:A,...n&&{limit:n.toString()}}}})}async updateProductKnowledgeBlock(e,A,n){return await this.client.PATCH("/api/products/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}},body:n})}async deleteProductKnowledgeBlock(e,A){return await this.client.DELETE("/api/products/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}}})}async createPlan(e){return await this.client.POST("/api/plans",{body:e})}async getPlan(e){return await this.client.GET("/api/plans/{id}",{params:{path:{id:e}}})}async replacePlan(e,A){return await this.client.PUT("/api/plans/{id}",{params:{path:{id:e}},body:A})}async updatePlan(e,A){return await this.client.PATCH("/api/plans/{id}",{params:{path:{id:e}},body:A})}async getPlanVideoUrl(e){return await this.client.GET("/api/plans/{id}/video-url",{params:{path:{id:e}}})}async deletePlan(e){return await this.client.DELETE("/api/admin/plans/{id}",{params:{path:{id:e}}})}async publishPlanRevision(e,A){return await this.client.POST("/api/plans/{id}/publish",{params:{path:{id:e}},body:A})}async listPlanRevisions(e){return await this.client.GET("/api/plans/{id}/revisions",{params:{path:{id:e}}})}async listPlanKnowledgeBlocks(e){return await this.client.GET("/api/plans/{id}/knowledge-blocks",{params:{path:{id:e}}})}async createPlanKnowledgeBlock(e,A){return await this.client.POST("/api/plans/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async updatePlanKnowledgeBlock(e,A,n){return await this.client.PUT("/api/plans/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}},body:n})}async deletePlanKnowledgeBlock(e,A){return await this.client.DELETE("/api/plans/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}}})}async getPlanNavigationIndex(e){return await this.client.GET("/api/plans/{id}/navigation-index",{params:{path:{id:e}}})}async replacePlanNavigationIndex(e,A){return await this.client.POST("/api/plans/{id}/navigation-index",{params:{path:{id:e}},body:A})}async getRevisionNavigationIndex(e){return await this.client.GET("/api/revisions/{id}/navigation-index",{params:{path:{id:e}}})}async replaceRevisionNavigationIndex(e,A){return await this.client.PUT("/api/revisions/{id}/navigation-index",{params:{path:{id:e}},body:A})}async getRevisionFAQ(e){return await this.client.GET("/api/revisions/{id}/faq",{params:{path:{id:e}}})}async replaceRevisionFAQ(e,A){return await this.client.PUT("/api/revisions/{id}/faq",{params:{path:{id:e}},body:A})}async listRevisionKnowledgeBlocks(e){return await this.client.GET("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}}})}async getRevisionSteps(e){return await this.client.GET("/api/revisions/{id}/steps",{params:{path:{id:e}}})}async replaceRevisionKnowledgeBlocks(e,A){return await this.client.PUT("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async createRevisionKnowledgeBlock(e,A){return await this.client.POST("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async updateRevisionKnowledgeBlock(e,A,n){return await this.client.PUT("/api/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}},body:n})}async deleteRevisionKnowledgeBlock(e,A){return await this.client.DELETE("/api/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}}})}async listSessions(e,A){const n={token:e};return A!=null&&A.productId&&(n.product_id=A.productId),A!=null&&A.startDate&&(n.start_date=A.startDate),A!=null&&A.endDate&&(n.end_date=A.endDate),await this.client.GET("/api/sessions",{params:{query:n}})}async createSession(e){return await this.client.POST("/api/sessions",{body:e})}async getSession(e){return await this.client.GET("/api/sessions/{id}",{params:{path:{id:e}}})}async startSession(e,A){return await this.client.GET("/api/sessions/{id}/start-session",{params:{path:{id:e},query:{token:A}}})}async getSessionRecording(e){return await this.client.GET("/api/sessions/{id}/recording",{params:{path:{id:e}}})}async getSessionSummary(e){return await this.client.GET("/api/sessions/{id}/summary",{params:{path:{id:e}}})}async getSessionProductUrl(e){return await this.client.GET("/api/sessions/{id}/product-url",{params:{path:{id:e}}})}async updateSession(e,A){return await this.client.PATCH("/api/sessions/{id}",{params:{path:{id:e}},body:A})}async listUserSessions(e){const A={};return e!=null&&e.productId&&(A.product_id=e.productId),e!=null&&e.startDate&&(A.start_date=e.startDate),e!=null&&e.endDate&&(A.end_date=e.endDate),e!=null&&e.page&&(A.page=e.page),e!=null&&e.limit&&(A.limit=e.limit),e!=null&&e.courseName&&(A.course_name=e.courseName),e!=null&&e.userName&&(A.user_name=e.userName),e!=null&&e.company&&(A.company=e.company),e!=null&&e.email&&(A.email=e.email),e!=null&&e.sortBy&&(A.sort_by=e.sortBy),e!=null&&e.sortOrder&&(A.sort_order=e.sortOrder),await this.client.GET("/api/user-sessions",{params:Object.keys(A).length>0?{query:A}:void 0})}async listUserSessionsAggregate(e){const A={};return e!=null&&e.productId&&(A.product_id=e.productId),e!=null&&e.startDate&&(A.start_date=e.startDate),e!=null&&e.endDate&&(A.end_date=e.endDate),await this.client.GET("/api/user-sessions-aggregate",{params:Object.keys(A).length>0?{query:A}:void 0})}async getJoinToken(e,{clientType:A,user:n}={}){return await this.client.GET("/api/join-token",{params:{query:{token:e,...A&&{client_type:A},...n&&{user:encodeURIComponent(n)}}}})}async trackEvent(e){try{return await this.client.POST("/api/track",{body:{sent_at:new Date().toISOString(),...e}})}catch(A){console.error("[obi] error tracking event:",A)}return{}}async getSessionPlan(e){return await this.client.GET("/api/sessions/{id}/plan",{params:{path:{id:e}}})}getClient(){return this.client}}const hh="https://app.coragents.ai";class Br extends kr{constructor(e,A,n,i){super(),this.state=null,this.isPaused=!1,this.speakingState=null,this.captureScreen=null,this.sessionUuid=null,this.roomId=null,this.joinToken=null,this.roomUrl=null,this.room=null,this.agentAnalyser=null,this.userAnalyser=null,this.appToken=e,this.planId=A,this.clientType=n,this.api=i.api||new dh({baseUrl:hh}),this.identity=i.identity||null,this.roomFactory=i.roomFactory||(r=>new qt(r)),this.captureScreen=i.captureScreen||null}async start(){console.debug("[obi] starting session",{planId:this.planId}),this.setState("connecting"),this.speakingStateChanged("thinking");try{const A=(await this.api.clientStartSession(this.appToken,{client_type:this.clientType,onboarding_plan:this.planId})).data;if(!(A!=null&&A.url)||!(A!=null&&A.token)||!(A!=null&&A.room)||!(A!=null&&A.session_uuid))throw new Error("Invalid room info");this.sessionUuid=A==null?void 0:A.session_uuid,this.roomId=A==null?void 0:A.room,this.joinToken=A==null?void 0:A.token,this.roomUrl=A==null?void 0:A.url,await this.joinRoom(),this.setState("connected"),console.debug("[obi] started session",{planId:this.planId,sessionUuid:this.sessionUuid})}catch(e){console.error("[obi] error starting session",{error:e}),this.setState("error")}}async joinRoom({withMicrophone:e=!1,withStateRecovery:A=!1}={}){this.room=this.roomFactory({adaptiveStream:!0,dynacast:!0}),this.room.on(I.Disconnected,n=>{if(console.debug("[obi] room disconnected",{reason:n}),!this.room)return;let i=null;switch(n){case 12:i="invalid-room";break}this.shutdown(i)}),this.room.on(I.TrackSubscribed,n=>{n.kind==="audio"&&(n.attach(),n.source===k.Source.Microphone&&(this.agentAnalyser&&this.agentAnalyser.disconnect(),this.agentAnalyser=this.createFFT(n.mediaStream)))}),this.room.on(I.LocalTrackPublished,n=>{n.kind==="audio"&&(this.userAnalyser&&this.userAnalyser.disconnect(),this.userAnalyser=this.createFFT(n.audioTrack.mediaStream))}),this.room.on(I.ParticipantAttributesChanged,n=>{if(!n["lk.agent.state"])return;const i=n["lk.agent.state"];switch(i){case"speaking":this.speakingStateChanged("speaking");break;case"listening":this.state!=="connected"&&this.speakingStateChanged("listening");break;case"thinking":this.speakingStateChanged("thinking");break;default:console.warn("[obi] unknown speaking state",i)}}),this.room.on(I.DataReceived,async n=>{try{const i=new TextDecoder().decode(n);console.debug("[obi] data received",i);const r=JSON.parse(i);switch(r.status||r.request||r.type){case"course_progress":typeof r.current_step=="number"&&typeof r.total_steps=="number"&&Array.isArray(r.step_names)&&this.emit("courseProgress",{currentStep:Math.max(1,r.current_step),totalSteps:Math.max(1,r.total_steps),stepNames:r.step_names});break;case"using_tool":this.speakingStateChanged("busy");break;case"using_tool_ended":this.speakingStateChanged("speaking");break;case"prompt_user":this.setState("volume-check");break;case"mic_check":this.setState("mic-check");break;case"share_mic":this.setState("mic-share");break;case"share_screen":this.setState("screen-share");break;case"navigate":this.setState("navigate");break;default:console.warn("[obi] unknown data received",r)}}catch(i){console.error("[obi] error parsing data",i)}}),this.room.localParticipant.registerRpcMethod("mic_check",async n=>(console.debug("[obi] checking microphone",{sessionUuid:this.sessionUuid}),await this.checkMicrophone()?"ok":"error")),this.room.localParticipant.registerRpcMethod("screen_capture",async n=>{if(!this.captureScreen)return console.error("[obi] no captureScreen function provided"),"error";let i=null,r=null;try{i=await this.captureScreen()}catch(s){i=null,s=s}if(!i||r)return console.error("[obi] error capturing screen",{error:r}),"error";try{return await this.room.localParticipant.sendFile(new File([i],"screen_capture.png",{type:"image/png"}),{mimeType:"image/png",topic:"screen_capture"}),"ok"}catch(s){return console.error("[obi] error sending screen capture",{error:s}),"error"}}),await this.room.connect(this.roomUrl,this.joinToken);for(let n=0;n<9&&!(this.room.state===q.Connected&&this.room.remoteParticipants.size>=1);n++)await new Promise(i=>setTimeout(i,1e3));if(!(this.room.state===q.Connected&&this.room.remoteParticipants.size>=1)){console.error("[obi] room not connected",{state:this.room.state,numParticipants:this.room.remoteParticipants.size}),this.shutdown("invalid-room");return}if(e&&await this.room.localParticipant.setMicrophoneEnabled(!0),A){let n=!1;for(const i of this.room.remoteParticipants.values())i.isSpeaking&&(n=!0);n?this.speakingState="speaking":this.speakingState="listening"}}async continue(){console.debug("[obi] continuing session",{sessionUuid:this.sessionUuid}),this.speakingStateChanged("thinking"),await this.sendData({request:"prompt_user",success:!0})}async checkMicrophone(){let e=!1;try{e=(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch(A){console.error("[obi] error checking microphone permission:",A)}return e?(console.debug("[obi] microphone permission granted",{sessionUuid:this.sessionUuid}),await this.room.localParticipant.setMicrophoneEnabled(!0),this.isMicShared=!0):console.debug("[obi] microphone permission denied",{sessionUuid:this.sessionUuid}),e&&this.clientType==="sdk"&&this.setState("in-progress"),this.emit("micCheckComplete",e),e}async shareMicrophone(){console.debug("[obi] sharing microphone",{sessionUuid:this.sessionUuid}),this.speakingStateChanged("thinking");let e=null,A=null;try{e=await this.room.localParticipant.setMicrophoneEnabled(!0),this.isMicShared=!0}catch(n){n=n,this.isMicShared=!1}e?console.debug("[obi] shared microphone",{sessionUuid:this.sessionUuid}):console.error("[obi] failed to share microphone",{error:A}),await this.sendData({request:"share_mic",success:!!e}),this.clientType==="sdk"&&this.setState("in-progress")}async shareScreen(){console.debug("[obi] sharing screen",{sessionUuid:this.sessionUuid}),this.speakingStateChanged("thinking"),await this.room.localParticipant.setScreenShareEnabled(!0,{video:{displaySurface:"window"}}),await this.sendData({request:"share_screen",success:!0}),this.setState("navigate")}async pause(){this.muteMicrophone(),this.isPaused=!0,this.emit("paused"),await this.sendData({request:"pause"}),console.log("[obi] paused session",{sessionUuid:this.sessionUuid})}async unpause(){this.unmuteMicrophone(),this.isPaused=!1,this.emit("unpaused"),await this.sendData({request:"unpause"}),console.log("[obi] unpaused session",{sessionUuid:this.sessionUuid})}muteMicrophone(){console.debug("[obi] muting microphone",{sessionUuid:this.sessionUuid}),this.room.localParticipant.getTrackPublications().forEach(e=>{var A,n;e.handleMuted(),(n=(A=e.track)==null?void 0:A.mediaStream)==null||n.getTracks().forEach(i=>i.enabled=!1)})}unmuteMicrophone(){console.debug("[obi] unmuting microphone",{sessionUuid:this.sessionUuid}),this.room.localParticipant.getTrackPublications().forEach(e=>{var A,n;e.handleUnmuted(),(n=(A=e.track)==null?void 0:A.mediaStream)==null||n.getTracks().forEach(i=>i.enabled=!0)})}async stop(){this.emit("stopped"),await this.shutdown()}async shutdown(e=null){if(this.room){console.debug("[obi] stopping session",{sessionUuid:this.sessionUuid});const A=this.room;this.room=null,await A.disconnect(),console.debug("[obi] stopped session",{sessionUuid:this.sessionUuid})}this.sessionUuid=null,this.roomId=null,this.joinToken=null,this.roomUrl=null,this.emit("shutdown",e)}async say(e){this.speakingStateChanged("thinking"),this.isPaused&&await this.unpause(),await this.sendData({request:"say",message:e})}serialise(){return JSON.stringify({state:this.state,speakingState:this.speakingState,appToken:this.appToken,planId:this.planId,clientType:this.clientType,isPaused:this.isPaused,identity:this.identity,sessionUuid:this.sessionUuid,roomId:this.roomId,joinToken:this.joinToken,roomUrl:this.roomUrl})}audioSpectrum(){return this.speakingState==="speaking"&&this.agentAnalyser?this.normaliseSpectrum(this.agentAnalyser):this.speakingState==="listening"&&this.userAnalyser?this.normaliseSpectrum(this.userAnalyser):null}normaliseSpectrum(e){const n=e.context.sampleRate/2/e.frequencyBinCount,i=new Uint8Array(e.frequencyBinCount);e.getByteFrequencyData(i);const r=[],s=50,a=5e3,o=8,c=Math.pow(a/s,1/o);for(let l=0;l<o;l++){const u=s*Math.pow(c,l),d=s*Math.pow(c,l+1),h=Math.floor(u/n),p=Math.floor(d/n),f=Math.min(p,i.length),m=Math.min(h,f);if(m<f){const B=i.slice(m,f).reduce((b,U)=>b+U,0)/(f-m)/255;r.push(B)}else r.push(0)}return r}setState(e){console.debug("[obi] state changed",{state:e,oldState:this.state});const A=this.state;this.state=e,this.emit("stateChanged",e,A)}static deserialise(e,A,n,i={}){const r=JSON.parse(e),s=new Br(A,r.planId,n,i);return s.state=r.state,s.speakingState=r.speakingState,s.identity=r.identity||null,s.isPaused=r.isPaused||!1,s.sessionUuid=r.sessionUuid||null,s.roomId=r.roomId||null,s.joinToken=r.joinToken||null,s.roomUrl=r.roomUrl||null,s}speakingStateChanged(e){console.debug("[obi] speaking state changed",{state:e,oldState:this.speakingState});const A=this.speakingState;this.speakingState=e,this.emit("speakingStateChanged",e,A)}async sendData(e){console.debug("[obi] sending data",{data:e}),await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify(e)),{reliable:!0})}createFFT(e){const A=new AudioContext,n=A.createAnalyser();return A.createMediaStreamSource(e).connect(n),n.fftSize=2048,n.smoothingTimeConstant=.6,n}}class vr extends kr{constructor(e,A,n={}){super(),this.state="loading",this.error=null,this.identity=null,this.product=null,this.plans=[],this.selectedPlan=null,this.selectedPlanUuid=null,this.showWidget=!1,this.session=null,this.captureScreen=null,this.appToken=e,this.clientType=A,this.api=n.api||new dh({baseUrl:n.apiBaseUrl||hh}),this.sessionFactory=n.sessionFactory||((i,r,s,a)=>new Br(i,r,s,a)),this.captureScreen=n.captureScreen||null}async initialise(e={}){var A,n,i,r;if(console.debug("[obi] initialising client"),!this.appToken)throw new Error("App token is required");this.setState("loading");try{const s=await this.api.clientInitialise(this.appToken,{identity:e.identity});if(this.identity=e.identity||null,this.product=((A=s.data)==null?void 0:A.product)||null,this.plans=((n=s.data)==null?void 0:n.onboarding_plans)||[],this.selectedPlan=((i=s.data)==null?void 0:i.selected_plan)||null,this.showWidget=((r=s.data)==null?void 0:r.show_widget)||!1,e.planUuid){let a=this.plans.find(o=>o.uuid===e.planUuid)||null;if(!a)try{const o=await this.api.getSessionPlan(e.planUuid);a=this.plans.find(c=>{var l;return c.uuid===((l=o.data)==null?void 0:l.plan_uuid)})||null}catch(o){console.error("[obi] error getting session plan",o)}a?(this.selectedPlan=a,this.selectedPlanUuid=e.planUuid):console.warn("[obi] plan not found",{planUuid:e.planUuid})}console.debug("[obi] initialised client",{identity:this.identity,product:this.product,plans:this.plans,selectedPlan:this.selectedPlan,showWidget:this.showWidget})}catch(s){throw this.error=s instanceof Error?s:new Error(String(s)),this.setState("error"),s}finally{this.setState("ready")}}selectPlan(e){this.selectedPlan=e,this.selectedPlanUuid=(e==null?void 0:e.uuid)||null,this.emit("planSelected",e),this.trackEvent(e?"plan_selected":"plan_cancelled")}async startSession(e,A){return await this._stopSession(),this.session=this.sessionFactory(this.appToken,e,this.clientType,{api:this.api,identity:this.identity,captureScreen:this.captureScreen}),this.prepareSession(A),this.session.start().then(()=>{this.emit("sessionStarted",this.session)}).catch(n=>{this.session=null,console.error("[obi] error starting session",n)}),this.trackEvent("session_started"),this.session}async resumeSession(e){var A,n;return console.debug("[obi] resuming session",{clientState:this.state,sessionState:(A=this.session)==null?void 0:A.state,speakingState:(n=this.session)==null?void 0:n.speakingState}),this.session.captureScreen=this.captureScreen,this.prepareSession(e),this.session.joinRoom({withMicrophone:!0,withStateRecovery:!0}).then(()=>{this.emit("sessionResumed",this.session)}).catch(i=>{console.error("[obi] error joining room",{error:i}),i instanceof Error&&i.message==="Room is not connected"&&this.session.stop()}),this.trackEvent("session_resumed"),this.session}prepareSession(e){if(!this.session)throw new Error("No session to prepare");return e(this.session),this.session.on("stopped",()=>{this.emit("sessionStopped")}),this.session.on("shutdown",A=>{var n,i;(i=(n=this.session)==null?void 0:n.removeAllListeners)==null||i.call(n),this.session=null,this.selectedPlan=null,this.selectedPlanUuid=null,this.emit("sessionShutdown",A)}),this.session}async stopSession(){await this._stopSession(),this.selectedPlan&&this.selectPlan(null)}async _stopSession(){this.session&&(this.trackEvent("session_stopped"),await this.session.stop(),this.session=null)}isLoading(){return this.state==="loading"}isReady(){return this.state==="ready"}serialise(){var e;return JSON.stringify({state:this.state,appToken:this.appToken,clientType:this.clientType,identity:this.identity,product:this.product,plans:this.plans,selectedPlan:this.selectedPlan,selectedPlanUuid:this.selectedPlanUuid,showWidget:this.showWidget,session:(e=this.session)==null?void 0:e.serialise()})}static deserialise(e,A,n,i={}){const r=JSON.parse(e),s=new vr(A,n,i);return s.state=r.state,s.identity=r.identity||null,s.product=r.product||null,s.plans=r.plans||[],s.selectedPlan=r.selectedPlan||null,s.selectedPlanUuid=r.selectedPlanUuid||null,s.showWidget=r.showWidget||!1,r.session&&(s.session=Br.deserialise(r.session,A,n,{api:s.api})),s}setState(e){const A=this.state;this.state=e,this.emit("stateChanged",e,A)}trackEvent(e,A={}){var n,i,r;this.api.trackEvent({event:e,client_type:this.clientType,plan_id:(n=this.selectedPlan)==null?void 0:n.uuid,product_id:(i=this.product)==null?void 0:i.uuid,session_id:(r=this.session)==null?void 0:r.sessionUuid,...A}).then(()=>{console.debug("[obi] tracked event",{event:e,data:A})}).catch(s=>{console.error("[obi] error tracking event",{event:e,data:A,error:s})})}}var Cr,K,fh,Ct,gh,ph,mh,Bh,Ja,Xa,qa,vh,xn={},Ch=[],vy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_n=Array.isArray;function PA(t,e){for(var A in e)t[A]=e[A];return t}function Ya(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function za(t,e,A){var n,i,r,s={};for(r in e)r=="key"?n=e[r]:r=="ref"?i=e[r]:s[r]=e[r];if(arguments.length>2&&(s.children=arguments.length>3?Cr.call(arguments,2):A),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)s[r]==null&&(s[r]=t.defaultProps[r]);return wr(t,s,n,i,null)}function wr(t,e,A,n,i){var r={type:t,props:e,key:A,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++fh,__i:-1,__u:0};return i==null&&K.vnode!=null&&K.vnode(r),r}function Pe(t){return t.children}function RA(t,e){this.props=t,this.context=e}function Yt(t,e){if(e==null)return t.__?Yt(t.__,t.__i+1):null;for(var A;e<t.__k.length;e++)if((A=t.__k[e])!=null&&A.__e!=null)return A.__e;return typeof t.type=="function"?Yt(t):null}function wh(t){var e,A;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((A=t.__k[e])!=null&&A.__e!=null){t.__e=t.__c.base=A.__e;break}return wh(t)}}function Za(t){(!t.__d&&(t.__d=!0)&&Ct.push(t)&&!br.__r++||gh!=K.debounceRendering)&&((gh=K.debounceRendering)||ph)(br)}function br(){for(var t,e,A,n,i,r,s,a=1;Ct.length;)Ct.length>a&&Ct.sort(mh),t=Ct.shift(),a=Ct.length,t.__d&&(A=void 0,i=(n=(e=t).__v).__e,r=[],s=[],e.__P&&((A=PA({},n)).__v=n.__v+1,K.vnode&&K.vnode(A),$a(e.__P,A,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,r,i??Yt(n),!!(32&n.__u),s),A.__v=n.__v,A.__.__k[A.__i]=A,Eh(r,A,s),A.__e!=i&&wh(A)));br.__r=0}function bh(t,e,A,n,i,r,s,a,o,c,l){var u,d,h,p,f,m,B=n&&n.__k||Ch,b=e.length;for(o=Cy(A,e,B,o,b),u=0;u<b;u++)(h=A.__k[u])!=null&&(d=h.__i==-1?xn:B[h.__i]||xn,h.__i=u,m=$a(t,h,d,i,r,s,a,o,c,l),p=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&eo(d.ref,null,h),l.push(h.ref,h.__c||p,h)),f==null&&p!=null&&(f=p),4&h.__u||d.__k===h.__k?o=yh(h,o,t):typeof h.type=="function"&&m!==void 0?o=m:p&&(o=p.nextSibling),h.__u&=-7);return A.__e=f,o}function Cy(t,e,A,n,i){var r,s,a,o,c,l=A.length,u=l,d=0;for(t.__k=new Array(i),r=0;r<i;r++)(s=e[r])!=null&&typeof s!="boolean"&&typeof s!="function"?(o=r+d,(s=t.__k[r]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?wr(null,s,null,null,null):_n(s)?wr(Pe,{children:s},null,null,null):s.constructor==null&&s.__b>0?wr(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(c=s.__i=wy(s,A,o,u))!=-1&&(u--,(a=A[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(i>l?d--:i<l&&d++),typeof s.type!="function"&&(s.__u|=4)):c!=o&&(c==o-1?d--:c==o+1?d++:(c>o?d--:d++,s.__u|=4))):t.__k[r]=null;if(u)for(r=0;r<l;r++)(a=A[r])!=null&&!(2&a.__u)&&(a.__e==n&&(n=Yt(a)),kh(a,a));return n}function yh(t,e,A){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=yh(n[i],e,A));return e}t.__e!=e&&(e&&t.type&&!A.contains(e)&&(e=Yt(t)),A.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function yr(t,e){return e=e||[],t==null||typeof t=="boolean"||(_n(t)?t.some(function(A){yr(A,e)}):e.push(t)),e}function wy(t,e,A,n){var i,r,s=t.key,a=t.type,o=e[A];if(o===null&&t.key==null||o&&s==o.key&&a==o.type&&!(2&o.__u))return A;if(n>(o!=null&&!(2&o.__u)?1:0))for(i=A-1,r=A+1;i>=0||r<e.length;){if(i>=0){if((o=e[i])&&!(2&o.__u)&&s==o.key&&a==o.type)return i;i--}if(r<e.length){if((o=e[r])&&!(2&o.__u)&&s==o.key&&a==o.type)return r;r++}}return-1}function Uh(t,e,A){e[0]=="-"?t.setProperty(e,A??""):t[e]=A==null?"":typeof A!="number"||vy.test(e)?A:A+"px"}function Ur(t,e,A,n,i){var r;e:if(e=="style")if(typeof A=="string")t.style.cssText=A;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)A&&e in A||Uh(t.style,e,"");if(A)for(e in A)n&&A[e]==n[e]||Uh(t.style,e,A[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Bh,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=A,A?n?A.u=n.u:(A.u=Ja,t.addEventListener(e,r?qa:Xa,r)):t.removeEventListener(e,r?qa:Xa,r);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=A??"";break e}catch{}typeof A=="function"||(A==null||A===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&A==1?"":A))}}function Qh(t){return function(e){if(this.l){var A=this.l[e.type+t];if(e.t==null)e.t=Ja++;else if(e.t<A.u)return;return A(K.event?K.event(e):e)}}}function $a(t,e,A,n,i,r,s,a,o,c){var l,u,d,h,p,f,m,B,b,U,w,v,y,E,T,F,R,D=e.type;if(e.constructor!=null)return null;128&A.__u&&(o=!!(32&A.__u),r=[a=e.__e=A.__e]),(l=K.__b)&&l(e);e:if(typeof D=="function")try{if(B=e.props,b="prototype"in D&&D.prototype.render,U=(l=D.contextType)&&n[l.__c],w=l?U?U.props.value:l.__:n,A.__c?m=(u=e.__c=A.__c).__=u.__E:(b?e.__c=u=new D(B,w):(e.__c=u=new RA(B,w),u.constructor=D,u.render=yy),U&&U.sub(u),u.props=B,u.state||(u.state={}),u.context=w,u.__n=n,d=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&D.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=PA({},u.__s)),PA(u.__s,D.getDerivedStateFromProps(B,u.__s))),h=u.props,p=u.state,u.__v=e,d)b&&D.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&B!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(B,w),!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(B,u.__s,w)===!1||e.__v==A.__v){for(e.__v!=A.__v&&(u.props=B,u.state=u.__s,u.__d=!1),e.__e=A.__e,e.__k=A.__k,e.__k.some(function(O){O&&(O.__=e)}),v=0;v<u._sb.length;v++)u.__h.push(u._sb[v]);u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(B,u.__s,w),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,p,f)})}if(u.context=w,u.props=B,u.__P=t,u.__e=!1,y=K.__r,E=0,b){for(u.state=u.__s,u.__d=!1,y&&y(e),l=u.render(u.props,u.state,u.context),T=0;T<u._sb.length;T++)u.__h.push(u._sb[T]);u._sb=[]}else do u.__d=!1,y&&y(e),l=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++E<25);u.state=u.__s,u.getChildContext!=null&&(n=PA(PA({},n),u.getChildContext())),b&&!d&&u.getSnapshotBeforeUpdate!=null&&(f=u.getSnapshotBeforeUpdate(h,p)),F=l,l!=null&&l.type===Pe&&l.key==null&&(F=Sh(l.props.children)),a=bh(t,_n(F)?F:[F],e,A,n,i,r,s,a,o,c),u.base=e.__e,e.__u&=-161,u.__h.length&&s.push(u),m&&(u.__E=u.__=null)}catch(O){if(e.__v=null,o||r!=null)if(O.then){for(e.__u|=o?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;r[r.indexOf(a)]=null,e.__e=a}else for(R=r.length;R--;)Ya(r[R]);else e.__e=A.__e,e.__k=A.__k;K.__e(O,e,A)}else r==null&&e.__v==A.__v?(e.__k=A.__k,e.__e=A.__e):a=e.__e=by(A.__e,e,A,n,i,r,s,o,c);return(l=K.diffed)&&l(e),128&e.__u?void 0:a}function Eh(t,e,A){for(var n=0;n<A.length;n++)eo(A[n],A[++n],A[++n]);K.__c&&K.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(r){r.call(i)})}catch(r){K.__e(r,i.__v)}})}function Sh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:_n(t)?t.map(Sh):PA({},t)}function by(t,e,A,n,i,r,s,a,o){var c,l,u,d,h,p,f,m=A.props,B=e.props,b=e.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),r!=null){for(c=0;c<r.length;c++)if((h=r[c])&&"setAttribute"in h==!!b&&(b?h.localName==b:h.nodeType==3)){t=h,r[c]=null;break}}if(t==null){if(b==null)return document.createTextNode(B);t=document.createElementNS(i,b,B.is&&B),a&&(K.__m&&K.__m(e,r),a=!1),r=null}if(b==null)m===B||a&&t.data==B||(t.data=B);else{if(r=r&&Cr.call(t.childNodes),m=A.props||xn,!a&&r!=null)for(m={},c=0;c<t.attributes.length;c++)m[(h=t.attributes[c]).name]=h.value;for(c in m)if(h=m[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=h;else if(!(c in B)){if(c=="value"&&"defaultValue"in B||c=="checked"&&"defaultChecked"in B)continue;Ur(t,c,null,h,i)}}for(c in B)h=B[c],c=="children"?d=h:c=="dangerouslySetInnerHTML"?l=h:c=="value"?p=h:c=="checked"?f=h:a&&typeof h!="function"||m[c]===h||Ur(t,c,h,m[c],i);if(l)a||u&&(l.__html==u.__html||l.__html==t.innerHTML)||(t.innerHTML=l.__html),e.__k=[];else if(u&&(t.innerHTML=""),bh(e.type=="template"?t.content:t,_n(d)?d:[d],e,A,n,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,r,s,r?r[0]:A.__k&&Yt(A,0),a,o),r!=null)for(c=r.length;c--;)Ya(r[c]);a||(c="value",b=="progress"&&p==null?t.removeAttribute("value"):p!=null&&(p!==t[c]||b=="progress"&&!p||b=="option"&&p!=m[c])&&Ur(t,c,p,m[c],i),c="checked",f!=null&&f!=t[c]&&Ur(t,c,f,m[c],i))}return t}function eo(t,e,A){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){K.__e(i,A)}}function kh(t,e,A){var n,i;if(K.unmount&&K.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||eo(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(r){K.__e(r,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&kh(n[i],e,A||typeof t.type!="function");A||Ya(t.__e),t.__c=t.__=t.__e=void 0}function yy(t,e,A){return this.constructor(t,A)}function Uy(t,e,A){var n,i,r,s;e==document&&(e=document.documentElement),K.__&&K.__(t,e),i=(n=typeof A=="function")?null:A&&A.__k||e.__k,r=[],s=[],$a(e,t=(!n&&A||e).__k=za(Pe,null,[t]),i||xn,xn,e.namespaceURI,!n&&A?[A]:i?null:e.firstChild?Cr.call(e.childNodes):null,r,!n&&A?A:i?i.__e:e.firstChild,n,s),Eh(r,t,s)}function Qy(t){function e(A){var n,i;return this.getChildContext||(n=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(r){this.props.value!=r.value&&n.forEach(function(s){s.__e=!0,Za(s)})},this.sub=function(r){n.add(r);var s=r.componentWillUnmount;r.componentWillUnmount=function(){n&&n.delete(r),s&&s.call(r)}}),A.children}return e.__c="__cC"+vh++,e.__=t,e.Provider=e.__l=(e.Consumer=function(A,n){return A.children(n)}).contextType=e,e}Cr=Ch.slice,K={__e:function(t,e,A,n){for(var i,r,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((r=i.constructor)&&r.getDerivedStateFromError!=null&&(i.setState(r.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},fh=0,RA.prototype.setState=function(t,e){var A;A=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=PA({},this.state),typeof t=="function"&&(t=t(PA({},A),this.props)),t&&PA(A,t),t!=null&&this.__v&&(e&&this._sb.push(e),Za(this))},RA.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Za(this))},RA.prototype.render=Pe,Ct=[],ph=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,mh=function(t,e){return t.__v.__b-e.__v.__b},br.__r=0,Bh=/(PointerCapture)$|Capture$/i,Ja=0,Xa=Qh(!1),qa=Qh(!0),vh=0;var Ey=0;function g(t,e,A,n,i,r){e||(e={});var s,a,o=e;if("ref"in o)for(a in o={},e)a=="ref"?s=e[a]:o[a]=e[a];var c={type:t,props:o,key:A,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ey,__i:-1,__u:0,__source:i,__self:r};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)o[a]===void 0&&(o[a]=s[a]);return K.vnode&&K.vnode(c),c}const Sy=`:root,:host{--obi-modal-padding: 48px 48px 32px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 12px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 545px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:100%}.tour-content .title{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:700;font-size:32px;line-height:90%;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0}.tour-content .subtitle{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{width:480px;height:240px;margin-top:24px;border-radius:12px;display:flex;align-items:center;justify-content:center;position:relative}.tour-content .description{width:100%;min-height:48px;margin:24px 0 0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b}.tour-content .button-container{display:flex;margin-top:24px;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;min-width:200px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{flex:1;display:flex;flex-direction:column}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transform:translateY(0);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out;width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-message{display:inline-flex;align-items:center;justify-content:center;min-width:140px;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:6px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:2px 0;height:6px;flex:1;min-width:0}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-course-progress-container{display:none;width:100%;max-height:0;opacity:0;transform:translateY(-10px);overflow:hidden;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel:hover .obi-course-progress-container{display:block;max-width:22 0px;animation:expand-course-progress .3s ease-in-out forwards}.obi-widget-panel:hover .obi-course-progress-container.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:4px}.obi-widget-out-of-plan .text{color:#fff;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
47
- `;var wt,se,Ao,Th,Pn=0,Fh=[],pe=K,Ih=pe.__b,xh=pe.__r,_h=pe.diffed,Ph=pe.__c,Rh=pe.unmount,Lh=pe.__;function Rn(t,e){pe.__h&&pe.__h(se,t,Pn||e),Pn=0;var A=se.__H||(se.__H={__:[],__h:[]});return t>=A.__.length&&A.__.push({}),A.__[t]}function Z(t){return Pn=1,ky(Oh,t)}function ky(t,e,A){var n=Rn(wt++,2);if(n.t=t,!n.__c&&(n.__=[A?A(e):Oh(void 0,e),function(a){var o=n.__N?n.__N[0]:n.__[0],c=n.t(o,a);o!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=se,!se.__f)){var i=function(a,o,c){if(!n.__c.__H)return!0;var l=n.__c.__H.__.filter(function(d){return!!d.__c});if(l.every(function(d){return!d.__N}))return!r||r.call(this,a,o,c);var u=n.__c.props!==a;return l.forEach(function(d){if(d.__N){var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(u=!0)}}),r&&r.call(this,a,o,c)||u};se.__f=!0;var r=se.shouldComponentUpdate,s=se.componentWillUpdate;se.componentWillUpdate=function(a,o,c){if(this.__e){var l=r;r=void 0,i(a,o,c),r=l}s&&s.call(this,a,o,c)},se.shouldComponentUpdate=i}return n.__N||n.__}function Ge(t,e){var A=Rn(wt++,3);!pe.__s&&ro(A.__H,e)&&(A.__=t,A.u=e,se.__H.__h.push(A))}function to(t,e){var A=Rn(wt++,4);!pe.__s&&ro(A.__H,e)&&(A.__=t,A.u=e,se.__h.push(A))}function QA(t){return Pn=5,no(function(){return{current:t}},[])}function no(t,e){var A=Rn(wt++,7);return ro(A.__H,e)&&(A.__=t(),A.__H=e,A.__h=t),A.__}function Ty(t,e){return Pn=8,no(function(){return t},e)}function Dh(t){var e=se.context[t.__c],A=Rn(wt++,9);return A.c=t,e?(A.__==null&&(A.__=!0,e.sub(se)),e.props.value):t.__}function Fy(){for(var t;t=Fh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Qr),t.__H.__h.forEach(io),t.__H.__h=[]}catch(e){t.__H.__h=[],pe.__e(e,t.__v)}}pe.__b=function(t){se=null,Ih&&Ih(t)},pe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Lh&&Lh(t,e)},pe.__r=function(t){xh&&xh(t),wt=0;var e=(se=t.__c).__H;e&&(Ao===se?(e.__h=[],se.__h=[],e.__.forEach(function(A){A.__N&&(A.__=A.__N),A.u=A.__N=void 0})):(e.__h.forEach(Qr),e.__h.forEach(io),e.__h=[],wt=0)),Ao=se},pe.diffed=function(t){_h&&_h(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Fh.push(e)!==1&&Th===pe.requestAnimationFrame||((Th=pe.requestAnimationFrame)||Iy)(Fy)),e.__H.__.forEach(function(A){A.u&&(A.__H=A.u),A.u=void 0})),Ao=se=null},pe.__c=function(t,e){e.some(function(A){try{A.__h.forEach(Qr),A.__h=A.__h.filter(function(n){return!n.__||io(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],pe.__e(n,A.__v)}}),Ph&&Ph(t,e)},pe.unmount=function(t){Rh&&Rh(t);var e,A=t.__c;A&&A.__H&&(A.__H.__.forEach(function(n){try{Qr(n)}catch(i){e=i}}),A.__H=void 0,e&&pe.__e(e,A.__v))};var Hh=typeof requestAnimationFrame=="function";function Iy(t){var e,A=function(){clearTimeout(n),Hh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(A,100);Hh&&(e=requestAnimationFrame(A))}function Qr(t){var e=se,A=t.__c;typeof A=="function"&&(t.__c=void 0,A()),se=e}function io(t){var e=se;t.__c=t.__(),se=e}function ro(t,e){return!t||t.length!==e.length||e.some(function(A,n){return A!==t[n]})}function Oh(t,e){return typeof e=="function"?e(t):e}function xy({size:t=24,color:e="#000"}){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-x-icon lucide-x",children:[g("path",{d:"M18 6 6 18"}),g("path",{d:"m6 6 12 12"})]})}function Mh({onClose:t}){return g("button",{class:"obi-button obi-close-button",onClick:t,"aria-label":"Close",type:"button",children:g(xy,{})})}function Nh({open:t=!1,children:e,onClose:A,size:n="medium"}){const i=QA(null),r=QA(null);Ge(()=>{const c=i.current;c&&(t&&!c.open?c.showModal():!t&&c.open&&(r.current="programmatic",c.close()))},[t]);const s=c=>{const l=i.current;c.target===l&&(r.current="user-initiated",l==null||l.close())},a=c=>{c.preventDefault(),r.current||(r.current="user-initiated");const l=r.current;r.current=null,A==null||A(l)},o=()=>{var c;r.current="user-initiated",(c=i.current)==null||c.close()};return Ge(()=>{const c=i.current;if(c)return c.addEventListener("click",s),c.addEventListener("close",a),()=>{c.removeEventListener("click",s),c.removeEventListener("close",a)}},[A]),g("dialog",{ref:i,className:`modal-${n}`,children:[g(Mh,{onClose:o}),g("div",{class:"modal-content",children:t?typeof e=="function"?e():e:null})]})}function so(t){const{children:e,className:A="",...n}=t;return g("div",{className:`${A} obi-panel`,...n,children:e})}function ao({className:t="",isActive:e=!1,speakingStatus:A,onClick:n,onMouseEnter:i,onMouseLeave:r,children:s}){let a=`obi-pill container ${e&&"active"}`;return A==="user-speaking"&&(a+=" user-speaking"),A==="busy"&&(a+=" busy"),g("div",{className:a,onMouseEnter:i,onMouseLeave:r,children:g("div",{className:`obi-pill pill ${t}`,onClick:n,children:s})})}function Kh({className:t="",active:e,speakingStatus:A,onClick:n,onMouseEnter:i,onMouseLeave:r,children:s,...a}){const o=`obi-pill2 container ${e?"active":""} ${A==="user-speaking"?"user-speaking":""} ${t}`;return g("div",{className:o,...a,children:g("div",{className:"pill",onClick:n,onMouseEnter:i,onMouseLeave:r,children:s})})}function bt({type:t,size:e=24}){return g("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:_y(t)})}function _y(t){switch(t){case"pause":return g(Pe,{children:[g("rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}),g("rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"})]});case"play":return g(Pe,{children:g("path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"})});case"close":return g(Pe,{children:[g("path",{d:"M18 6 6 18"}),g("path",{d:"m6 6 12 12"})]});case"message":return g(Pe,{children:g("path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"})});case"minimize":return g(Pe,{children:[g("path",{d:"m14 10 7-7"}),g("path",{d:"M20 10h-6V4"}),g("path",{d:"m3 21 7-7"}),g("path",{d:"M4 14h6v6"})]});case"voice":return g(Pe,{children:[g("path",{d:"M2 10v3"}),g("path",{d:"M6 6v11"}),g("path",{d:"M10 3v18"}),g("path",{d:"M14 8v7"}),g("path",{d:"M18 5v13"}),g("path",{d:"M22 10v3"})]});case"open":return g(Pe,{children:[g("path",{d:"M12 7v14"}),g("path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"})]})}}const oo=Qy(null);function Py({children:t}){const e=Dh(oo);if(!e)throw new Error("PopoutTarget must be used within a Popout component");const{controlledOpen:A,isOpen:n,setIsOpen:i,setAnimating:r,targetRef:s,trigger:a,onChange:o,delayMs:c}=e,l=QA(null),u=Vh(s,r),[d,h]=Z(!1);Ge(()=>{A!==void 0&&A!==d&&(A?f():m()),h(A)},[A]),Ge(()=>()=>{l.current&&clearTimeout(l.current)},[]);function p(){l.current&&(clearTimeout(l.current),l.current=null)}function f(){p(),c>0?l.current=setTimeout(()=>{o==null||o(!0),i(!0),l.current=null},c):(o==null||o(!0),i(!0))}function m(){p(),o==null||o(!1),i(!1)}const B=()=>{a==="click"&&(n?m():f())};function b(){a==="hover"&&f()}function U(){a==="hover"&&m()}return g("div",{ref:u,class:"target",onClick:B,onMouseEnter:b,onMouseLeave:U,children:t})}function Ry({children:t}){const e=Dh(oo);if(!e)throw new Error("PopoutContent must be used within a Popout component");const{isOpen:A,animating:n,setAnimating:i,targetRef:r,contentRef:s}=e,a=Vh(s,i);return to(()=>{if(A&&!n&&r.current&&s.current){const o=s.current;if(!o)return;const c=r.current;if(!c)return;const l=o.getBoundingClientRect(),u=c.getBoundingClientRect(),d=u.right-u.left;o.style.top=`${l.top-l.bottom-(8+e.offset)}px`,o.style.left=`${-(l.right-l.left-d)/2}px`}},[A,n]),A?g("div",{ref:a,class:"content",style:{opacity:n?0:1},children:t}):null}function je({trigger:t="click",open:e,onChange:A,children:n,delayMs:i=0,offset:r=0,className:s=""}){const[a,o]=Z(!1),[c,l]=Z(!1),u=QA(null),d=QA(null),h={controlledOpen:e,isOpen:a,setIsOpen:o,animating:c,setAnimating:l,targetRef:u,contentRef:d,trigger:t,onChange:A,delayMs:i,offset:r};return g(oo.Provider,{value:h,children:g("div",{class:`obi-popout ${s}`,children:n})})}je.Target=Py,je.Content=Ry;function Vh(t,e){const A=QA(null),n=QA(null),i=QA(!0),r=Ty(s=>{if(t.current=s,!s){n.current&&(n.current.disconnect(),n.current=null),i.current=!0;return}function a(){if(i.current){i.current=!1;return}A.current?clearTimeout(A.current):e(!0),A.current=setTimeout(()=>{e(!1),A.current=null},200)}n.current=new ResizeObserver(a),n.current.observe(s,{box:"border-box"})},[]);return Ge(()=>()=>{n.current&&(n.current.disconnect(),n.current=null)},[]),r}function gA({className:t,onClick:e,type:A,disabled:n,title:i}){const r={cancel:g(bt,{type:"close",size:16}),pause:g(bt,{type:"pause",size:16}),play:g(bt,{type:"play",size:16}),message:g(bt,{type:"message",size:16}),minimize:g(bt,{type:"minimize",size:16}),voice:g(bt,{type:"voice",size:16}),open:g(bt,{type:"open",size:16})}[A],s={cancel:"",pause:"",play:"",message:"",minimize:"",voice:"",open:""}[A],a=g("button",{class:`obi-button obi-round-button ${s} ${t}`,onClick:n?void 0:e,disabled:n,children:r});return i?g(je,{className:"obi-round-button-popout",trigger:"hover",delayMs:200,offset:9,children:[g(je.Target,{children:a}),g(je.Content,{children:g("div",{className:"obi-round-button-title",children:i})})]}):a}const Gh=8,Er=8,Ly=50,Dy=.7,zt=3;function jh({getBands:t,color:e="white"}){const A=QA(null);return Ge(()=>{if(!t)return;const n=setInterval(()=>{try{const i=t();if(!A.current)return;const r=A.current.querySelectorAll(".bar"),s=i&&i.length>0?i.slice(0,Er).map(a=>{const o=Math.abs(a);return Math.min(o/Dy*Gh,Gh)||zt}):Array(Er).fill(zt);for(;s.length<Er;)s.push(zt);s.forEach((a,o)=>{if(a<zt&&(a=zt),r[o]){const c=a*2;r[o].style.height=`${c}px`,r[o].style.display=a>0?"block":"none"}})}catch(i){console.warn("Error updating equaliser:",i)}},Ly);return()=>{clearInterval(n)}},[t]),g("div",{className:"obi-equaliser",ref:A,children:Array.from({length:Er},(n,i)=>g("div",{className:"column",children:g("div",{className:"bar",style:{height:`${zt}px`,backgroundColor:e,display:"block"}})},i))})}function Ln({className:t,children:e,onClick:A}){return A?g("button",{class:`obi-button obi-message ${t} clickable`,onClick:A,children:e}):g("div",{class:`obi-message ${t}`,children:e})}const Hy=8;function Wh({color:t="white"}){return g("div",{className:"obi-loading-dots",children:Array.from({length:Hy},(e,A)=>g("div",{className:"column",children:[g("div",{className:"bar",style:{backgroundColor:t,animationDelay:`${A*.15}s`}}),g("div",{className:"dot",style:{backgroundColor:t}})]},A))})}function Oy({onContinue:t,onWrapUp:e}){return g(so,{className:"obi-exit-survey",children:g(Ny,{onContinue:t,onWrapUp:()=>{e()}})})}function My({onReasonSelect:t,onClose:e}){const[A,n]=Z("reason"),i=r=>{r==="other"?n("other-reason"):t(r)};return g(so,{className:`obi-exit-survey ${A==="reason"?"obi-exit-survey-reason":""}`,children:A==="reason"?g(Ky,{onReasonSelect:i}):g(Vy,{onReasonSelect:i,onClose:e})})}function Ny({onContinue:t,onWrapUp:e}){return g("div",{className:"obi-exit-survey-container",children:[g("h2",{className:"obi-exit-survey-title",children:"Wrapping up early?"}),g("div",{className:"obi-exit-survey-options",children:[g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-button-continue",onClick:t,type:"button",children:"No, let's continue"}),g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-button-wrap-up",onClick:e,type:"button",children:"Yes, let's wrap up"})]})]})}function Ky({onReasonSelect:t}){return g("div",{className:"obi-exit-survey-container obi-exit-survey-reason-container",children:[g("div",{className:"obi-exit-survey-header",children:g("h2",{className:"obi-exit-survey-title obi-exit-survey-reason-title",children:"Quick feedback?"})}),g("div",{className:"obi-exit-survey-options obi-exit-survey-reason-options",children:[g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("testing"),type:"button",children:"Will do later"}),g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("no-time"),type:"button",children:"Can't talk right now"}),g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("format-mismatch"),type:"button",children:"Prefer written instructions"}),g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("technical-issue"),type:"button",children:"Experienced technical issues"}),g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("other"),type:"button",children:"Other"})]})]})}function Vy({onReasonSelect:t,onClose:e}){return g("div",{className:"obi-exit-survey-container obi-exit-survey-reason-container",children:[g("div",{className:"obi-exit-survey-header",children:[g(Mh,{onClose:e}),g("h2",{className:"obi-exit-survey-title obi-exit-survey-reason-title",children:"Tell us more"})]}),g("div",{className:"obi-exit-survey-options obi-exit-survey-reason-options",children:[g("textarea",{className:"obi-exit-survey-button obi-exit-survey-reason-button",placeholder:"What's on your mind?"}),g("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-button-wrap-up",onClick:()=>t("other-feedback"),type:"button",children:"Send feedback"})]})]})}function Gy(t,e){for(var A in e)t[A]=e[A];return t}function Jh(t,e){for(var A in t)if(A!=="__source"&&!(A in e))return!0;for(var n in e)if(n!=="__source"&&t[n]!==e[n])return!0;return!1}function Xh(t,e){this.props=t,this.context=e}(Xh.prototype=new RA).isPureReactComponent=!0,Xh.prototype.shouldComponentUpdate=function(t,e){return Jh(this.props,t)||Jh(this.state,e)};var qh=K.__b;K.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),qh&&qh(t)};var jy=K.__e;K.__e=function(t,e,A,n){if(t.then){for(var i,r=e;r=r.__;)if((i=r.__c)&&i.__c)return e.__e==null&&(e.__e=A.__e,e.__k=A.__k),i.__c(t,e)}jy(t,e,A,n)};var Yh=K.unmount;function zh(t,e,A){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),t.__c.__H=null),(t=Gy({},t)).__c!=null&&(t.__c.__P===A&&(t.__c.__P=e),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(n){return zh(n,e,A)})),t}function Zh(t,e,A){return t&&A&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(n){return Zh(n,e,A)}),t.__c&&t.__c.__P===e&&(t.__e&&A.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=A)),t}function co(){this.__u=0,this.o=null,this.__b=null}function $h(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Sr(){this.i=null,this.l=null}K.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Yh&&Yh(t)},(co.prototype=new RA).__c=function(t,e){var A=e.__c,n=this;n.o==null&&(n.o=[]),n.o.push(A);var i=$h(n.__v),r=!1,s=function(){r||(r=!0,A.__R=null,i?i(a):a())};A.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var o=n.state.__a;n.__v.__k[0]=Zh(o,o.__c.__P,o.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&e.__u||n.setState({__a:n.__b=n.__v.__k[0]}),t.then(s,s)},co.prototype.componentWillUnmount=function(){this.o=[]},co.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var A=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=zh(this.__b,A,n.__O=n.__P)}this.__b=null}var i=e.__a&&za(Pe,null,t.fallback);return i&&(i.__u&=-33),[za(Pe,null,e.__a?null:t.children),i]};var ef=function(t,e,A){if(++A[1]===A[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(A=t.i;A;){for(;A.length>3;)A.pop()();if(A[1]<A[0])break;t.i=A=A[2]}};(Sr.prototype=new RA).__a=function(t){var e=this,A=$h(e.__v),n=e.l.get(t);return n[0]++,function(i){var r=function(){e.props.revealOrder?(n.push(i),ef(e,t,n)):i()};A?A(r):r()}},Sr.prototype.render=function(t){this.i=null,this.l=new Map;var e=yr(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var A=e.length;A--;)this.l.set(e[A],this.i=[1,0,this.i]);return t.children},Sr.prototype.componentDidUpdate=Sr.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,A){ef(t,A,e)})};var Wy=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Jy=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xy=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,qy=/[A-Z0-9]/g,Yy=typeof document<"u",zy=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};RA.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(RA.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Af=K.event;function Zy(){}function $y(){return this.cancelBubble}function eU(){return this.defaultPrevented}K.event=function(t){return Af&&(t=Af(t)),t.persist=Zy,t.isPropagationStopped=$y,t.isDefaultPrevented=eU,t.nativeEvent=t};var AU={enumerable:!1,configurable:!0,get:function(){return this.class}},tf=K.vnode;K.vnode=function(t){typeof t.type=="string"&&function(e){var A=e.props,n=e.type,i={},r=n.indexOf("-")===-1;for(var s in A){var a=A[s];if(!(s==="value"&&"defaultValue"in A&&a==null||Yy&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var o=s.toLowerCase();s==="defaultValue"&&"value"in A&&A.value==null?s="value":s==="download"&&a===!0?a="":o==="translate"&&a==="no"?a=!1:o[0]==="o"&&o[1]==="n"?o==="ondoubleclick"?s="ondblclick":o!=="onchange"||n!=="input"&&n!=="textarea"||zy(A.type)?o==="onfocus"?s="onfocusin":o==="onblur"?s="onfocusout":Xy.test(s)&&(s=o):o=s="oninput":r&&Jy.test(s)?s=s.replace(qy,"-$&").toLowerCase():a===null&&(a=void 0),o==="oninput"&&i[s=o]&&(s="oninputCapture"),i[s]=a}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=yr(A.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=yr(A.children).forEach(function(c){c.props.selected=i.multiple?i.defaultValue.indexOf(c.props.value)!=-1:i.defaultValue==c.props.value})),A.class&&!A.className?(i.class=A.class,Object.defineProperty(i,"className",AU)):(A.className&&!A.class||A.class&&A.className)&&(i.class=i.className=A.className),e.props=i}(t),t.$$typeof=Wy,tf&&tf(t)};var nf=K.__r;K.__r=function(t){nf&&nf(t),t.__c};var rf=K.diffed;K.diffed=function(t){rf&&rf(t);var e=t.props,A=t.__e;A!=null&&t.type==="textarea"&&"value"in e&&e.value!==A.value&&(A.value=e.value==null?"":e.value)};function tU(t){const{placeholder:e="Type your message...",value:A,defaultValue:n,onChange:i,onSend:r,onCancel:s,onExpand:a,isLoading:o=!1,disabled:c=!1,maxLength:l=500,children:u}=t,[d,h]=Z(A||n||""),[p,f]=Z((A||n||"").length>24),m=QA(null);to(()=>{p&&(a==null||a(!0))},[]);const B=A!==void 0?A:d,b=v=>{const y=v.currentTarget.value;A===void 0&&h(y),i==null||i(y)},U=v=>{v.key==="Escape"&&(h(A||n||""),f(!1),s==null||s()),v.key==="Enter"&&!v.shiftKey&&B.trim()&&(v.preventDefault(),h(A||n||""),f(!1),w()),(B||"").length>=24&&!p&&(f(!0),a==null||a(!0))};Ge(()=>{m.current&&m.current.focus()},[m.current]);const w=()=>{!B.trim()||o||c||(r==null||r(B.trim()),A===void 0&&h(""))};return g("div",{className:`obi-message-input ${p?"expanded":""}`,children:[g("div",{className:"container",children:g("textarea",{ref:m,className:"field",placeholder:e,value:B,onInput:b,onKeyDown:U,disabled:c||o,maxLength:l,rows:1})}),g("div",{className:"button-container",children:[p&&g("div",{children:u}),g("button",{className:"obi-button send",onClick:w,disabled:!B.trim()||o||c,type:"button",children:g("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g("path",{d:"M6.00016 10.6673V1.33398M6.00016 1.33398L1.3335 6.00065M6.00016 1.33398L10.6668 6.00065",stroke:"#F3F3F3","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"})})})]})]})}function nU(t){const{currentStep:e,totalSteps:A,stepNames:n,className:i}=t,r=Array.from({length:A},(o,c)=>({isCompleted:c<e,stepNumber:c+1})),s=n[e-1]||`Step ${e}`,a=`${e}/${A} • ${s}`;return g("div",{class:`obi-course-progress ${i||""}`,children:[g("div",{class:"obi-course-progress-steps",children:r.map((o,c)=>g("div",{class:"obi-course-progress-container",children:g("div",{class:`obi-course-progress-step ${o.isCompleted?"completed":""}`})},c))}),g("div",{class:"obi-course-progress-description",children:a})]})}function iU(t){const{disabled:e,inPlan:A,isPaused:n}=t,[i,r]=Z(null),[s,a]=Z(t.isActive??t.defaultIsActive??!1),[o,c]=Z(!1),[l,u]=Z(t.cancelling??!1),[d,h]=Z(t.messaging??!1),[p,f]=Z(!1),[m,B]=Z(!1);to(()=>{t.messaging!==void 0&&h(t.messaging)},[t.messaging]);function b(){a(!0),c(!1),B(!0),t.messaging!==void 0&&h(t.messaging)}function U(){}function w(){i&&(clearTimeout(i),r(null))}function v(){r(setTimeout(()=>{a(t.defaultIsActive??!1),B(!1)},400))}function y(oe){var Je;f(!1),(Je=t.onMessage)==null||Je.call(t,oe)}function E(){h(!1),f(!1),a(!1),c(!0)}function T(){h(!1),u(!0),f(!1)}function F(){var oe;A||((oe=t.onOpen)==null||oe.call(t))}function R(){var oe;(oe=t.onMessage)==null||oe.call(t,"Okay, let's continue.")}function D(oe){var Je;t.messaging===void 0&&((Je=t.onMessagingChange)==null||Je.call(t,oe),h(oe)),oe||f(!1)}const O=t.isActive??((s||A)&&!o&&!e),M=O&&A,ae=O&&A&&!p,N=t.speakingStatus==="user-speaking",V=t.speakingStatus==="thinking",Fe=t.speakingStatus==="busy",ve=O&&!A&&!l&&m,Ce=O&&A&&n&&!N&&!l,tA=O&&A&&n&&N&&!l,Le=O&&A&&!n&&N&&!l,we=O&&A&&!n&&Fe&&!l,nA=d&&N,Ye=ve||Ce||tA||Le||l,Ie=400,it=O&&A&&!p,We=ve?5:10;return!A&&!l?g(rU,{...t}):!A&&l?g(sU,{onCancelReason:oe=>{var Je;a(t.defaultIsActive??!1),u(!1),(Je=t.onCancelReason)==null||Je.call(t,oe)},onClose:()=>{a(t.defaultIsActive??!1),u(!1)}}):g(so,{className:`obi-widget-panel ${M?"expanded":""} ${p?"maximized":""} ${d?"messaging":""} ${Fe?"tool-usage":""}`,children:[g("div",{className:`obi-widget ${O?"active":""} ${A?"in-plan":""}`,onMouseEnter:w,onMouseLeave:v,children:[ae&&g(gA,{type:"cancel",onClick:T,disabled:l,title:"Cancel session"}),ae&&!n&&g(gA,{type:"pause",onClick:t.onPause,title:"Pause session"}),ae&&n&&g(gA,{type:"play",onClick:t.onUnpause,title:"Unpause session"}),g(je,{className:"obi-widget-popout",open:Ye,trigger:null,delayMs:Ie,offset:We,children:[g(je.Target,{children:[nA&&g(tU,{value:t.message,defaultValue:"Okay, let's continue.",onCancel:()=>D(!1),onSend:y,onExpand:f,children:g("div",{className:"obi-widget-buttons",children:[g(gA,{type:"cancel",onClick:T,disabled:l,title:"Cancel session"}),!n&&g(gA,{type:"pause",onClick:t.onPause,title:"Pause session"}),n&&g(gA,{type:"play",onClick:t.onUnpause,title:"Unpause session"}),g(gA,{type:d?"voice":"message",disabled:!N||t.messaging!==void 0,onClick:()=>D(!d),title:d?"Voice input":"Text input"}),g(gA,{type:"minimize",onClick:E,title:"Minimize widget"})]})}),!nA&&g(ao,{className:O&&!A?"button":"",isActive:O,speakingStatus:t.speakingStatus,onClick:F,onMouseEnter:b,onMouseLeave:U,children:[O&&!A&&!we&&g("span",{className:"obi-widget-pill-text",children:"Tutorials"}),O&&A&&we&&g("span",{className:"obi-widget-pill-text",children:"Searching knowledge ..."}),O&&A&&!V&&!we&&g(jh,{getBands:t.spectrum}),O&&V&&!we&&g(Wh,{})]})]}),g(je.Content,{children:g("div",{onMouseLeave:v,children:[ve&&g(Ln,{onClick:F,children:"Click to see all"}),Ce&&g(Ln,{children:"Session will pause shortly"}),tA&&g(Ln,{children:"Paused"}),Le&&g(Ln,{onClick:R,children:"Ready to continue?"}),l&&g(Oy,{onContinue:()=>{u(!1),t.messaging!==void 0&&h(t.messaging)},onWrapUp:()=>{var oe;(oe=t.onCancel)==null||oe.call(t)}})]})})]}),ae&&g(gA,{type:d?"voice":"message",disabled:!N||t.messaging!==void 0,onClick:()=>D(!d),title:d?"Voice input":"Text input"}),ae&&g(gA,{type:"minimize",onClick:E,title:"Minimize widget"})]}),it&&t.courseProgress&&g("div",{className:`obi-course-progress-container ${d?"expanded":""}`,children:g(nU,{currentStep:t.courseProgress.currentStep,totalSteps:t.courseProgress.totalSteps,stepNames:t.courseProgress.stepNames})})]})}function rU(t){const{disabled:e}=t,[A,n]=Z(null),[i,r]=Z(t.isActive??t.defaultIsActive??!1),[s,a]=Z(!1),[o,c]=Z(t.hovered??!1);function l(){r(!0),a(!1),c(!0)}function u(){}function d(){A&&(clearTimeout(A),n(null))}function h(){i&&n(setTimeout(()=>{r(t.defaultIsActive??!1),c(!1)},400))}function p(){r(!1),a(!0)}function f(){var w;(w=t.onOpen)==null||w.call(t)}const m=t.hovered??(o&&!s),B=t.isActive??(i&&!e&&!s),b=B&&m,U=`round-button ${B?"active":""}`;return g("div",{className:"obi-widget-out-of-plan-container",children:g("div",{className:`obi-widget-out-of-plan ${m?"hover":""} ${B?"active":""}`,onMouseEnter:d,onMouseLeave:h,children:[g("div",{className:U,style:{width:"27px",height:"30px"}}),g(je,{className:"obi-widget-popout",open:b,trigger:null,delayMs:400,offset:5,children:[g(je.Target,{children:g(Kh,{className:B?"button":"",active:B,onClick:f,onMouseEnter:l,onMouseLeave:u,children:B&&g("span",{className:"text",children:"Tutorials"})})}),g(je.Content,{children:g("div",{onMouseLeave:h,children:g(Ln,{className:"message",onClick:f,children:"Click to see all"})})})]}),g(gA,{className:U,type:"minimize",onClick:p,title:"Minimize widget"})]})})}function sU(t){return g("div",{className:"obi-widget-out-of-plan-container",children:g("div",{className:"obi-widget-out-of-plan",children:g(je,{className:"obi-widget-popout",open:!0,trigger:null,delayMs:100,offset:5,children:[g(je.Target,{children:g(Kh,{active:!1})}),g(je.Content,{children:g(My,{onReasonSelect:e=>{var A;(A=t.onCancelReason)==null||A.call(t,e)},onClose:()=>{var e;(e=t.onClose)==null||e.call(t)}})})]})})})}function aU({open:t=!1,children:e,onClose:A}){return g(Nh,{open:t,onClose:A,children:g("div",{className:"tour content-area",children:t?typeof e=="function"?e():e:null})})}function Zt({title:t="",subtitle:e="",agentName:A="Obi",buttonText:n="Continue",speakingState:i=null,actionDisabled:r=!1,href:s=null,centerVisual:a,description:o,button:c,onAction:l}){const[u,d]=Z(r),[h,p]=Z(!1),[f,m]=Z(i);return Ge(()=>{h||(i==="listening"&&f!=="listening"&&u&&d(!1),i!=="listening"&&!u&&d(!0)),m(i)},[i,u]),Ge(()=>{d(r)},[r]),g("div",{className:"tour-content",children:g("div",{className:"container",children:[g("div",{className:"header",children:[g("h1",{className:"title",children:t}),g("p",{className:"subtitle",children:e})]}),g("div",{className:"visual",style:{background:"var(--obi-color-tint)"},children:a}),g("div",{className:"description",children:o}),g("div",{className:"button-container",children:c||g(s?"a":"button",{className:`action-button ${u?"disabled":""}`,onClick:()=>{u||(d(!0),p(!0),l==null||l())},disabled:u,...s?{href:s,target:"_blank",rel:"noopener noreferrer"}:{type:"button"},children:g("span",{className:"button-text",children:(()=>{switch(i){case"thinking":return"Loading...";case"speaking":return`${A} is speaking`;default:return n}})()})})})]})})}function oU({logoUrl:t="",appName:e="App"}){const[A,n]=Z(!1),[i,r]=Z(!1),s=()=>{n(!0)},a=()=>{r(!0),n(!1)},o={container:{display:"block"},logoContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",position:"relative",overflow:"hidden"},backgroundPattern:{position:"absolute",inset:0,zIndex:0,background:"#F5F5F5",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='277' height='195' viewBox='0 0 277 195' fill='none'%3E%3Cpath opacity='0.4' d='M341.308 0.75C380.279 0.750001 411.872 24.3772 411.872 53.5229C411.872 82.6685 380.279 106.296 341.308 106.296H215.792C176.964 108.335 145.691 130.837 141.128 159.475V256.616C145.912 286.659 180.089 309.954 221.548 309.954H330.872C375.607 309.954 411.872 282.833 411.872 249.377V159.069C411.872 129.923 443.465 106.296 482.436 106.296C521.407 106.296 553 129.923 553 159.069V257.181C553 285.058 524.099 307.88 487.483 309.815C489.264 309.902 491.061 309.954 492.871 309.954C448.137 309.954 411.872 337.076 411.872 370.532C411.872 369.177 411.803 367.834 411.686 366.502C409.098 393.885 378.582 415.5 341.308 415.5H210.118C171.147 415.5 139.554 391.873 139.554 362.727C139.554 362.204 139.565 361.683 139.585 361.163C133.564 332.156 100.023 309.954 59.5488 309.954C61.4544 309.954 63.3441 309.9 65.2169 309.803C28.7434 307.76 -8.57239e-07 284.982 0 257.181V159.069C1.64632e-06 130.901 29.5078 107.89 66.6662 106.377C64.3207 106.224 61.9472 106.141 59.5488 106.141C100.012 106.141 133.54 83.951 139.575 54.9552C139.558 54.4793 139.554 54.0018 139.554 53.5229C139.554 24.3772 171.147 0.75 210.118 0.75H341.308Z' fill='white'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"190px 60px",backgroundSize:"300px 225px"},logoWrapper:{background:"#888888",width:"120px",height:"120px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",zIndex:10,overflow:"hidden"},appLogo:{width:"120px",height:"120px",objectFit:"cover",display:t&&!A&&i?"block":"none"},placeholderLogo:{width:"60px",height:"60px",background:"rgba(255, 255, 255, 0.2)",borderRadius:"4px",display:!t||A||!i?"flex":"none",alignItems:"center",justifyContent:"center",color:"rgba(255, 255, 255, 0.8)",fontSize:"24px",fontWeight:"bold"}};return g("div",{style:o.container,children:g("div",{style:o.logoContainer,children:[g("div",{style:o.backgroundPattern}),g("div",{style:o.logoWrapper,children:[t&&g("img",{style:o.appLogo,src:t,alt:`${e} logo`,onError:s,onLoad:a}),g("div",{style:o.placeholderLogo,children:e.charAt(0).toUpperCase()})]})]})})}function cU({session:t,speakingState:e,onAction:A}){const n=t.appName?`Navigate to ${t.appName}`:"Navigate to app",i=t.appName?`Open ${t.appName}`:"Open app",r=t.appName?`Enjoy the tutorial in ${t.appName}`:"Enjoy the tutorial";return g(Zt,{title:n,subtitle:"Click the button below to open the app",agentName:t.agentName||"Obi",buttonText:i,speakingState:e,actionDisabled:!0,href:t.url,description:r,centerVisual:g(oU,{logoUrl:t.appLogoUrl,appName:t.appName}),onAction:A})}function sf({className:t=""}){return g("svg",{width:"64",height:"64",viewBox:"0 0 256 256",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:g("path",{d:"M158.803 0L160.352 0.0399439C176.267 0.844061 188.922 13.9634 188.922 30.0311C188.922 46.6174 175.438 60.0653 158.803 60.0656H99.0263L98.9061 60.0722C78.8071 61.4795 62.6269 77.004 60.2644 96.7673L60.241 96.9704V158.93L60.2644 159.13C62.7406 179.86 80.4234 195.934 101.881 195.935H153.842C176.993 195.935 195.759 177.223 195.759 154.14V96.9138L195.799 95.3693C196.606 79.5009 209.766 66.8827 225.881 66.8827C242.515 66.8834 256 80.328 256 96.9138V159.086L255.963 160.564C255.225 175.748 243.176 187.971 228.038 189.038V189.214C207.121 190.591 190.4 207.263 189.019 228.119H188.842C187.738 243.7 174.712 256 158.803 256H96.4491C79.8147 256 66.3309 242.555 66.3302 225.969C66.3302 225.673 66.3349 225.375 66.3436 225.077H66.3503H66.3035C63.3344 206.008 47.4427 190.589 27.8321 189.231L27.8354 189.031C12.2702 187.868 0.000167669 174.905 0 159.086V96.9138L0.0367222 95.4192C0.791087 80.0787 13.0909 67.7634 28.453 66.9293C47.7697 65.3039 63.3522 50.3234 66.2969 31.4658L66.3469 31.1595L66.3369 30.85C66.3301 30.5933 66.3302 30.3238 66.3302 30.0311C66.3309 13.4454 79.8148 0.000165137 96.4491 0H158.803Z",fill:"currentColor"})})}function lU({children:t}){const e={container:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},logo:{display:"flex",width:"120px",height:"120px",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"8px",color:"#FFFFFF",position:"relative",overflow:"hidden",background:"var(--obi-color-primary)",boxShadow:`
46
+ `},xa}var Md;function Bb(){if(Md)return dA;Md=1;var t=pb(),e=mb(),A=Ia();return dA.grammar=A,dA.write=e,dA.parse=t.parse,dA.parseParams=t.parseParams,dA.parseFmtpConfig=t.parseFmtpConfig,dA.parsePayloads=t.parsePayloads,dA.parseRemoteCandidates=t.parseRemoteCandidates,dA.parseImageAttributes=t.parseImageAttributes,dA.parseSimulcastStreamList=t.parseSimulcastStreamList,dA}var At=Bb();function _a(t,e,A){var n,i,r;e===void 0&&(e=50),A===void 0&&(A={});var s=(n=A.isImmediate)!=null&&n,a=(i=A.callback)!=null&&i,o=A.maxWait,c=Date.now(),l=[];function u(){if(o!==void 0){var h=Date.now()-c;if(h+e>=o)return o-h}return e}var d=function(){var h=[].slice.call(arguments),g=this;return new Promise(function(f,m){var B=s&&r===void 0;if(r!==void 0&&clearTimeout(r),r=setTimeout(function(){if(r=void 0,c=Date.now(),!s){var U=t.apply(g,h);a&&a(U),l.forEach(function(C){return(0,C.resolve)(U)}),l=[]}},u()),B){var b=t.apply(g,h);return a&&a(b),f(b)}l.push({resolve:f,reject:m})})};return d.cancel=function(h){r!==void 0&&clearTimeout(r),l.forEach(function(g){return(0,g.reject)(h)}),l=[]},d}const vb=.7,Cb=20,Jt={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class Nd extends yA.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;super(),this.log=W,this.ddExtID=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=_a(i=>v(this,void 0,void 0,function*(){this.emit(Jt.NegotiationStarted);try{yield this.createAndSendOffer()}catch(r){if(i)i(r);else throw r}}),Cb),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=FA((n=A.loggerName)!==null&&n!==void 0?n:lA.PCTransport),this.loggerOptions=A,this.config=e,this._pc=this.createPC()}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=A=>{var n;A.candidate&&((n=this.onIceCandidate)===null||n===void 0||n.call(this,A.candidate))},e.onicecandidateerror=A=>{var n;(n=this.onIceCandidateError)===null||n===void 0||n.call(this,A)},e.oniceconnectionstatechange=()=>{var A;(A=this.onIceConnectionStateChange)===null||A===void 0||A.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var A;(A=this.onSignalingStatechange)===null||A===void 0||A.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var A;(A=this.onConnectionStateChange)===null||A===void 0||A.call(this,e.connectionState)},e.ondatachannel=A=>{var n;(n=this.onDataChannel)===null||n===void 0||n.call(this,A)},e.ontrack=A=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,A)},e}get logContext(){var e,A;return Object.assign({},(A=(e=this.loggerOptions).loggerContextCb)===null||A===void 0?void 0:A.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return v(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e){return v(this,void 0,void 0,function*(){var A;let n;if(e.type==="offer"){let{stereoMids:i,nackMids:r}=wb(e);this.remoteStereoMids=i,this.remoteNackMids=r}else if(e.type==="answer"){const i=At.parse((A=e.sdp)!==null&&A!==void 0?A:"");i.media.forEach(r=>{r.type==="audio"&&this.trackBitrates.some(s=>{if(!s.transceiver||r.mid!=s.transceiver.mid)return!1;let a=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(a=c.payload,!0):!1),a===0)return!0;let o=!1;for(const c of r.fmtp)if(c.payload===a){c.config=c.config.split(";").filter(l=>!l.includes("maxaveragebitrate")).join(";"),s.maxbr>0&&(c.config+=";maxaveragebitrate=".concat(s.maxbr*1e3)),o=!0;break}return o||s.maxbr>0&&r.fmtp.push({payload:a,config:"maxaveragebitrate=".concat(s.maxbr*1e3)}),!0})}),n=At.write(i)}yield this.setMungedSDP(e,n,!0),this.pendingCandidates.forEach(i=>{this.pc.addIceCandidate(i)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Jt.NegotiationComplete),e.sdp&&At.parse(e.sdp).media.forEach(r=>{r.type==="video"&&this.emit(Jt.RTPVideoPayloadTypes,r.rtp)}))})}createAndSendOffer(e){return v(this,void 0,void 0,function*(){var A;if(this.onOffer===void 0)return;if(e!=null&&e.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const r=this._pc.remoteDescription;if(e!=null&&e.iceRestart&&r)yield this._pc.setRemoteDescription(r);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const n=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:n.sdp},this.logContext));const i=At.parse((A=n.sdp)!==null&&A!==void 0?A:"");i.media.forEach(r=>{Vd(r),r.type==="audio"?Kd(r,[],[]):r.type==="video"&&this.trackBitrates.some(s=>{if(!r.msid||!s.cid||!r.msid.includes(s.cid))return!1;let a=0;if(r.rtp.some(c=>c.codec.toUpperCase()===s.codec.toUpperCase()?(a=c.payload,!0):!1),a===0||(kn(s.codec)&&this.ensureVideoDDExtensionForSVC(r,i),s.codec!=="av1"))return!0;const o=Math.round(s.maxbr*vb);for(const c of r.fmtp)if(c.payload===a){c.config.includes("x-google-start-bitrate")||(c.config+=";x-google-start-bitrate=".concat(o));break}return!0})}),yield this.setMungedSDP(n,At.write(i)),this.onOffer(n)})}createAndSetAnswer(){return v(this,void 0,void 0,function*(){var e;const A=yield this.pc.createAnswer(),n=At.parse((e=A.sdp)!==null&&e!==void 0?e:"");return n.media.forEach(i=>{Vd(i),i.type==="audio"&&Kd(i,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(A,At.write(n)),A})}createDataChannel(e,A){return this.pc.createDataChannel(e,A)}addTransceiver(e,A){return this.pc.addTransceiver(e,A)}addTrack(e){if(!this._pc)throw new ye("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var A;if(!this._pc)throw new ye("PC closed, cannot configure");return(A=this._pc)===null||A===void 0?void 0:A.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var A;return(A=this._pc)===null||A===void 0?void 0:A.removeTrack(e)}getConnectionState(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&A!==void 0?A:"closed"}getICEConnectionState(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&A!==void 0?A:"closed"}getSignallingState(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&A!==void 0?A:"closed"}getTransceivers(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&A!==void 0?A:[]}getSenders(){var e,A;return(A=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&A!==void 0?A:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return v(this,void 0,void 0,function*(){var e;if(!this._pc)return;let A="";const n=new Map,i=new Map;if((yield this._pc.getStats()).forEach(a=>{switch(a.type){case"transport":A=a.selectedCandidatePairId;break;case"candidate-pair":A===""&&a.selected&&(A=a.id),n.set(a.id,a);break;case"remote-candidate":i.set(a.id,"".concat(a.address,":").concat(a.port));break}}),A==="")return;const s=(e=n.get(A))===null||e===void 0?void 0:e.remoteCandidateId;if(s!==void 0)return i.get(s)})}setMungedSDP(e,A,n){return v(this,void 0,void 0,function*(){if(A){const i=e.sdp;e.sdp=A;try{this.log.debug("setting munged ".concat(n?"remote":"local"," description"),this.logContext),n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(r){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:r,sdp:A})),e.sdp=i}}try{n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(i){let r="unknown error";i instanceof Error?r=i.message:typeof i=="string"&&(r=i);const s={error:r,sdp:e.sdp};throw!n&&this.pc.remoteDescription&&(s.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:s})),new aa(r)}})}ensureVideoDDExtensionForSVC(e,A){var n,i;if(!((n=e.ext)===null||n===void 0?void 0:n.some(s=>s.uri===wd))){if(this.ddExtID===0){let s=0;A.media.forEach(a=>{var o;a.type==="video"&&((o=a.ext)===null||o===void 0||o.forEach(c=>{c.value>s&&(s=c.value)}))}),this.ddExtID=s+1}(i=e.ext)===null||i===void 0||i.push({value:this.ddExtID,uri:wd})}}}function Kd(t,e,A){let n=0;t.rtp.some(i=>i.codec==="opus"?(n=i.payload,!0):!1),n>0&&(t.rtcpFb||(t.rtcpFb=[]),A.includes(t.mid)&&!t.rtcpFb.some(i=>i.payload===n&&i.type==="nack")&&t.rtcpFb.push({payload:n,type:"nack"}),e.includes(t.mid)&&t.fmtp.some(i=>i.payload===n?(i.config.includes("stereo=1")||(i.config+=";stereo=1"),!0):!1))}function wb(t){var e;const A=[],n=[],i=At.parse((e=t.sdp)!==null&&e!==void 0?e:"");let r=0;return i.media.forEach(s=>{var a;s.type==="audio"&&(s.rtp.some(o=>o.codec==="opus"?(r=o.payload,!0):!1),!((a=s.rtcpFb)===null||a===void 0)&&a.some(o=>o.payload===r&&o.type==="nack")&&n.push(s.mid),s.fmtp.some(o=>o.payload===r?(o.config.includes("sprop-stereo=1")&&A.push(s.mid),!0):!1))}),{stereoMids:A,nackMids:n}}function Vd(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}const Pa="vp8",bb={audioPreset:ua.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:ha.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Pa,backupCodec:!0},Gd={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},jd={deviceId:{ideal:"default"},resolution:Sn.h720.resolution},yb={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new hw,disconnectOnPageLeave:!0,webAudioMix:!1},Ra={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var ue;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(ue||(ue={}));class Ub{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,A,n){var i;this.peerConnectionTimeout=Ra.peerConnectionTimeout,this.log=W,this.updateState=()=>{var r;const s=this.state,a=this.requiredTransports.map(o=>o.getConnectionState());a.every(o=>o==="connected")?this.state=ue.CONNECTED:a.some(o=>o==="failed")?this.state=ue.FAILED:a.some(o=>o==="connecting")?this.state=ue.CONNECTING:a.every(o=>o==="closed")?this.state=ue.CLOSED:a.some(o=>o==="closed")?this.state=ue.CLOSING:a.every(o=>o==="new")&&(this.state=ue.NEW),s!==this.state&&(this.log.debug("pc state change: from ".concat(ue[s]," to ").concat(ue[this.state]),this.logContext),(r=this.onStateChange)===null||r===void 0||r.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=FA((i=n.loggerName)!==null&&i!==void 0?i:lA.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=!A,this.isSubscriberConnectionRequired=A,this.publisher=new Nd(e,n),this.subscriber=new Nd(e,n),this.publisher.onConnectionStateChange=this.updateState,this.subscriber.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,cA.PUBLISHER)},this.subscriber.onIceCandidate=r=>{var s;(s=this.onIceCandidate)===null||s===void 0||s.call(this,r,cA.SUBSCRIBER)},this.subscriber.onDataChannel=r=>{var s;(s=this.onDataChannel)===null||s===void 0||s.call(this,r)},this.subscriber.onTrack=r=>{var s;(s=this.onTrack)===null||s===void 0||s.call(this,r)},this.publisher.onOffer=r=>{var s;(s=this.onPublisherOffer)===null||s===void 0||s.call(this,r)},this.state=ue.NEW,this.connectionLock=new Oe,this.remoteOfferLock=new Oe}get logContext(){var e,A;return Object.assign({},(A=(e=this.loggerOptions).loggerContextCb)===null||A===void 0?void 0:A.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e){return this.publisher.setRemoteDescription(e)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return v(this,void 0,void 0,function*(){if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const A of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(A)}catch(n){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:n}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return v(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,A){return v(this,void 0,void 0,function*(){A===cA.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e){return v(this,void 0,void 0,function*(){this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:this.subscriber.getSignallingState().toString()}));const A=yield this.remoteOfferLock.lock();try{return yield this.subscriber.setRemoteDescription(e),yield this.subscriber.createAndSetAnswer()}finally{A()}})}updateConfiguration(e,A){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),A&&this.triggerIceRestart()}ensurePCTransportConnection(e,A){return v(this,void 0,void 0,function*(){var n;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((n=this.requiredTransports)===null||n===void 0?void 0:n.map(r=>this.ensureTransportConnected(r,e,A)))}finally{i()}})}negotiate(e){return v(this,void 0,void 0,function*(){return new Promise((A,n)=>v(this,void 0,void 0,function*(){const i=setTimeout(()=>{n("negotiation timed out")},this.peerConnectionTimeout),r=()=>{clearTimeout(i),n("negotiation aborted")};e.signal.addEventListener("abort",r),this.publisher.once(Jt.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Jt.NegotiationComplete,()=>{clearTimeout(i),A()})}),yield this.publisher.negotiate(s=>{clearTimeout(i),n(s)})}))})}addPublisherTransceiver(e,A){return this.publisher.addTransceiver(e,A)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,A){return this.publisher.createDataChannel(e,A)}getConnectedAddress(e){return e===cA.PUBLISHER?this.publisher.getConnectedAddress():e===cA.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&e.push(this.subscriber),e}ensureTransportConnected(e,A){return v(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(n.getConnectionState()!=="connected")return new Promise((o,c)=>v(r,void 0,void 0,function*(){const l=()=>{this.log.warn("abort transport connection",this.logContext),Te.clearTimeout(u),c(new Ae("room connection has been cancelled",J.Cancelled))};i!=null&&i.signal.aborted&&l(),i==null||i.signal.addEventListener("abort",l);const u=Te.setTimeout(()=>{i==null||i.signal.removeEventListener("abort",l),c(new Ae("could not establish pc connection",J.InternalError))},s);for(;this.state!==ue.CONNECTED;)if(yield Ke(50),i!=null&&i.signal.aborted){c(new Ae("room connection has been cancelled",J.Cancelled));return}Te.clearTimeout(u),i==null||i.signal.removeEventListener("abort",l),o()}))}()})}}class de extends Error{constructor(e,A,n){super(A),this.code=e,this.message=Jd(A,de.MAX_MESSAGE_BYTES),this.data=n?Jd(n,de.MAX_DATA_BYTES):void 0}static fromProto(e){return new de(e.code,e.message,e.data)}toProto(){return new ou({code:this.code,message:this.message,data:this.data})}static builtIn(e,A){return new de(de.ErrorCode[e],de.ErrorMessage[e],A)}}de.MAX_MESSAGE_BYTES=256,de.MAX_DATA_BYTES=15360,de.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404},de.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const Wd=15360;function La(t){return new TextEncoder().encode(t).length}function Jd(t,e){if(La(t)<=e)return t;let A=0,n=t.length;const i=new TextEncoder;for(;A<n;){const r=Math.floor((A+n+1)/2);i.encode(t.slice(0,r)).length<=e?A=r:n=r-1}return t.slice(0,A)}const Da=2e3;function ur(t,e){if(!e)return 0;let A,n;return"bytesReceived"in t?(A=t.bytesReceived,n=e.bytesReceived):"bytesSent"in t&&(A=t.bytesSent,n=e.bytesSent),A===void 0||n===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(A-n)*8*1e3/(t.timestamp-e.timestamp)}const Qb=1e3;class Xd extends F{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}constructor(e,A,n){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,r=arguments.length>4?arguments[4]:void 0;super(e,A,r),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=_a(()=>v(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>v(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(x.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new Oe,this.pauseUpstreamLock=new Oe,this.processorLock=new Oe,this.restartLock=new Oe,this.setMediaStreamTrack(e,!0),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==F.Kind.Video)return;const{width:e,height:A}=this._mediaStreamTrack.getSettings();if(e&&A)return{width:e,height:A}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,A;return(A=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&A!==void 0?A:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,A){return v(this,void 0,void 0,function*(){var n;if(e===this._mediaStreamTrack&&!A)return;this._mediaStreamTrack&&(this.attachedElements.forEach(r=>{Vt(this._mediaStreamTrack,r)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let i;if(this.processor&&e){const r=yield this.processorLock.lock();try{if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Kt(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}finally{r()}}this.sender&&((n=this.sender.transport)===null||n===void 0?void 0:n.state)!=="closed"&&(yield this.sender.replaceTrack(i??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(r=>{Kt(i??e,r)}))})}waitForDimensions(){return v(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Qb;return function*(){var n;if(e.kind===F.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=uA())===null||n===void 0?void 0:n.os)==="iOS"&&(yield Ke(10));const i=Date.now();for(;Date.now()-i<A;){const r=e.dimensions;if(r)return r;yield Ke(50)}throw new IA("unable to get track dimensions after timeout")}()})}setDeviceId(e){return v(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===$A(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),$A(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return v(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(e.source===F.Source.ScreenShare)return;const{deviceId:n,groupId:i}=e._mediaStreamTrack.getSettings(),r=e.kind===F.Kind.Audio?"audioinput":"videoinput";return A?Qe.getInstance().normalizeDeviceId(r,n,i):n}()})}mute(){return v(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return v(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,A){return v(this,void 0,void 0,function*(){if(!this.sender)throw new IA("unable to replace an unpublished track");let n,i;return typeof A=="boolean"?n=A:A!==void 0&&(n=A.userProvidedTrack,i=A.stopProcessor),this.providedByUser=n??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.stopProcessor()),this})}restart(e){return v(this,void 0,void 0,function*(){this.manuallyStopped=!1;const A=yield this.restartLock.lock();try{e||(e=this._constraints);const{deviceId:n,facingMode:i}=e,r=fw(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const s={audio:!1,video:!1};this.kind===F.Kind.Video?s.video=n||i?{deviceId:n,facingMode:i}:!0:s.audio=n?{deviceId:n}:!0,this.attachedElements.forEach(c=>{Vt(this.mediaStreamTrack,c)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const o=(yield navigator.mediaDevices.getUserMedia(s)).getTracks()[0];return yield o.applyConstraints(r),o.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(o),this._constraints=e,this.emit(x.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{A()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?x.Muted:x.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return v(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),bd()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return v(this,void 0,void 0,function*(){var e;const A=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(x.UpstreamPaused,this);const n=uA();if((n==null?void 0:n.name)==="Safari"&&mt(n.version,"12.0")<0)throw new sa("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{A()}})}resumeUpstream(){return v(this,void 0,void 0,function*(){var e;const A=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(x.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{A()}})}getRTCStatsReport(){return v(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return v(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var r;const s=yield n.processorLock.lock();try{n.log.debug("setting up processor",n.logContext);const a=document.createElement(n.kind),o={kind:n.kind,track:n._mediaStreamTrack,element:a,audioContext:n.audioContext};if(yield A.init(o),n.log.debug("processor initialized",n.logContext),n.processor&&(yield n.stopProcessor()),n.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Kt(n._mediaStreamTrack,a),a.muted=!0,a.play().catch(c=>n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{error:c}))),n.processor=A,n.processorElement=a,n.processor.processedTrack){for(const c of n.attachedElements)c!==n.processorElement&&i&&(Vt(n._mediaStreamTrack,c),Kt(n.processor.processedTrack,c));yield(r=n.sender)===null||r===void 0?void 0:r.replaceTrack(n.processor.processedTrack)}n.emit(x.TrackProcessorUpdate,n.processor)}finally{s()}}()})}getProcessor(){return this.processor}stopProcessor(){return v(this,arguments,void 0,function(){var e=this;let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var n,i;e.processor&&(e.log.debug("stopping processor",e.logContext),(n=e.processor.processedTrack)===null||n===void 0||n.stop(),yield e.processor.destroy(),e.processor=void 0,A||((i=e.processorElement)===null||i===void 0||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(x.TrackProcessorUpdate))}()})}}class dr extends Xd{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;super(e,F.Kind.Audio,A,n,r),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>v(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let s;try{s=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}s&&this.prevStats&&(this._currentBitrate=ur(s,this.prevStats)),this.prevStats=s}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(x.AudioTrackFeatureUpdate,this,oA.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(x.AudioTrackFeatureUpdate,this,oA.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return v(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===F.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{A()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return v(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const n=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==$A(this._constraints.deviceId);return this.source===F.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||n)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{A()}})}restartTrack(e){return v(this,void 0,void 0,function*(){let A;if(e){const n=Ea({audio:e});typeof n.audio!="boolean"&&(A=n.audio)}yield this.restart(A)})}restart(e){const A=Object.create(null,{restart:{get:()=>super.restart}});return v(this,void 0,void 0,function*(){const n=yield A.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){Ve()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Da)))}setProcessor(e){return v(this,void 0,void 0,function*(){var A;const n=yield this.processorLock.lock();try{if(!UA()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.stopProcessor());const i={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(i),this.processor=e,this.processor.processedTrack&&(yield(A=this.sender)===null||A===void 0?void 0:A.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(x.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return v(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const A=yield this.sender.getStats();let n;return A.forEach(i=>{i.type==="outbound-rtp"&&(n={type:"audio",streamId:i.id,packetsSent:i.packetsSent,packetsLost:i.packetsLost,bytesSent:i.bytesSent,timestamp:i.timestamp,roundTripTime:i.roundTripTime,jitter:i.jitter})}),n})}checkForSilence(){return v(this,void 0,void 0,function*(){const e=yield Id(this);return e&&(this.isMuted||this.log.warn("silence detected on local audio track",this.logContext),this.emit(x.AudioSilenceDetected)),e})}}function Eb(t,e,A){switch(t.kind){case"audio":return new dr(t,e,!1,void 0,A);case"video":return new fr(t,e,!1,A);default:throw new IA("unsupported track type: ".concat(t.kind))}}const Sb=Object.values(Sn),kb=Object.values(da),Tb=Object.values(ha),Fb=[Sn.h180,Sn.h360],Ib=[da.h180,da.h360],xb=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(A=>{var n,i;return new ee(Math.floor(t.width/A.scaleResolutionDownBy),Math.floor(t.height/A.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(A.scaleResolutionDownBy,2)*(((n=t.encoding.maxFramerate)!==null&&n!==void 0?n:30)/((i=A.fps)!==null&&i!==void 0?i:30))))),A.fps,t.encoding.priority)}),Ha=["q","h","f"];function Oa(t,e,A,n){var i,r;let s=n==null?void 0:n.videoEncoding;t&&(s=n==null?void 0:n.screenShareEncoding);const a=n==null?void 0:n.simulcast,o=n==null?void 0:n.scalabilityMode,c=n==null?void 0:n.videoCodec;if(!s&&!a&&!o||!e||!A)return[{}];s||(s=Pb(t,e,A,c),W.debug("using video encoding",s));const l=s.maxFramerate,u=new ee(e,A,s.maxBitrate,s.maxFramerate,s.priority);if(o&&kn(c)){const g=new hr(o),f=[];if(g.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(o));const m=uA();if(ZA()||UA()||(m==null?void 0:m.name)==="Chrome"&&mt(m==null?void 0:m.version,"113")<0){const B=g.suffix=="h"?2:3;for(let b=0;b<g.spatial;b+=1)f.push({rid:Ha[2-b],maxBitrate:s.maxBitrate/Math.pow(B,b),maxFramerate:u.encoding.maxFramerate});f[0].scalabilityMode=o}else f.push({maxBitrate:s.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:o});return u.encoding.priority&&(f[0].priority=u.encoding.priority,f[0].networkPriority=u.encoding.priority),W.debug("using svc encoding",{encodings:f}),f}if(!a)return[s];let d=[];t?d=(i=Yd(n==null?void 0:n.screenShareSimulcastLayers))!==null&&i!==void 0?i:qd(t,u):d=(r=Yd(n==null?void 0:n.videoSimulcastLayers))!==null&&r!==void 0?r:qd(t,u);let h;if(d.length>0){const g=d[0];d.length>1&&([,h]=d);const f=Math.max(e,A);if(f>=960&&h)return Ma(e,A,[g,h,u],l);if(f>=480)return Ma(e,A,[g,u],l)}return Ma(e,A,[u])}function _b(t,e,A){var n,i,r,s;if(!A.backupCodec||A.backupCodec===!0||A.backupCodec.codec===A.videoCodec)return;e!==A.backupCodec.codec&&W.warn("requested a different codec than specified as backup",{serverRequested:e,backup:A.backupCodec.codec}),A.videoCodec=e,A.videoEncoding=A.backupCodec.encoding;const a=t.mediaStreamTrack.getSettings(),o=(n=a.width)!==null&&n!==void 0?n:(i=t.dimensions)===null||i===void 0?void 0:i.width,c=(r=a.height)!==null&&r!==void 0?r:(s=t.dimensions)===null||s===void 0?void 0:s.height;return t.source===F.Source.ScreenShare&&A.simulcast&&(A.simulcast=!1),Oa(t.source===F.Source.ScreenShare,o,c,A)}function Pb(t,e,A,n){const i=Rb(t,e,A);let{encoding:r}=i[0];const s=Math.max(e,A);for(let a=0;a<i.length;a+=1){const o=i[a];if(r=o.encoding,o.width>=s)break}if(n)switch(n){case"av1":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.7;break;case"vp9":r=Object.assign({},r),r.maxBitrate=r.maxBitrate*.85;break}return r}function Rb(t,e,A){if(t)return Tb;const n=e>A?e/A:A/e;return Math.abs(n-16/9)<Math.abs(n-4/3)?Sb:kb}function qd(t,e){if(t)return xb(e);const{width:A,height:n}=e,i=A>n?A/n:n/A;return Math.abs(i-16/9)<Math.abs(i-4/3)?Fb:Ib}function Ma(t,e,A,n){const i=[];if(A.forEach((r,s)=>{if(s>=Ha.length)return;const a=Math.min(t,e),c={rid:Ha[s],scaleResolutionDownBy:Math.max(1,a/Math.min(r.width,r.height)),maxBitrate:r.encoding.maxBitrate},l=n&&r.encoding.maxFramerate?Math.min(n,r.encoding.maxFramerate):r.encoding.maxFramerate;l&&(c.maxFramerate=l);const u=Gt()||s===0;r.encoding.priority&&u&&(c.priority=r.encoding.priority,c.networkPriority=r.encoding.priority),i.push(c)}),UA()&&Ud()==="ios"){let r;i.forEach(a=>{r?a.maxFramerate&&a.maxFramerate>r&&(r=a.maxFramerate):r=a.maxFramerate});let s=!0;i.forEach(a=>{var o;a.maxFramerate!=r&&(s&&(s=!1,W.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),W.info('Setting framerate of encoding "'.concat((o=a.rid)!==null&&o!==void 0?o:"",'" to ').concat(r)),a.maxFramerate=r)})}return i}function Yd(t){if(t)return t.sort((e,A)=>{const{encoding:n}=e,{encoding:i}=A;return n.maxBitrate>i.maxBitrate?1:n.maxBitrate<i.maxBitrate?-1:n.maxBitrate===i.maxBitrate&&n.maxFramerate&&i.maxFramerate?n.maxFramerate>i.maxFramerate?1:-1:0})}class hr{constructor(e){const A=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!A)throw new Error("invalid scalability mode");if(this.spatial=parseInt(A[1]),this.temporal=parseInt(A[2]),A.length>3)switch(A[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=A[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function Lb(t){return t.source===F.Source.ScreenShare||t.constraints.height&&$A(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const Db=5e3;class fr extends Xd{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,i=arguments.length>3?arguments[3]:void 0;super(e,F.Kind.Video,A,n,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.monitorSender=()=>v(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let r;try{r=yield this.getSenderStats()}catch(a){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}const s=new Map(r.map(a=>[a.rid,a]));if(this.prevStats){let a=0;s.forEach((o,c)=>{var l;const u=(l=this.prevStats)===null||l===void 0?void 0:l.get(c);a+=ur(o,u)}),this._currentBitrate=a}this.prevStats=s}),this.senderLock=new Oe}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var A;if(this.signalClient=e,!Ve())return;const n=(A=this.sender)===null||A===void 0?void 0:A.getParameters();n&&(this.encodings=n.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},Da))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return v(this,void 0,void 0,function*(){var A,n,i,r,s;yield e.pauseUpstream.call(this);try{for(var a=!0,o=XA(this.simulcastCodecs.values()),c;c=yield o.next(),A=c.done,!A;a=!0)r=c.value,a=!1,yield(s=r.sender)===null||s===void 0?void 0:s.replaceTrack(null)}catch(l){n={error:l}}finally{try{!a&&!A&&(i=o.return)&&(yield i.call(o))}finally{if(n)throw n.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return v(this,void 0,void 0,function*(){var A,n,i,r,s;yield e.resumeUpstream.call(this);try{for(var a=!0,o=XA(this.simulcastCodecs.values()),c;c=yield o.next(),A=c.done,!A;a=!0){r=c.value,a=!1;const l=r;yield(s=l.sender)===null||s===void 0?void 0:s.replaceTrack(l.mediaStreamTrack)}}catch(l){n={error:l}}finally{try{!a&&!A&&(i=o.return)&&(yield i.call(o))}finally{if(n)throw n.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return v(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===F.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{A()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return v(this,void 0,void 0,function*(){const A=yield this.muteLock.lock();try{return this.isMuted?(this.source===F.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{A()}})}setTrackMuted(e){super.setTrackMuted(e);for(const A of this.simulcastCodecs.values())A.mediaStreamTrack.enabled=!e}getSenderStats(){return v(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const A=[],n=yield this.sender.getStats();return n.forEach(i=>{var r;if(i.type==="outbound-rtp"){const s={type:"video",streamId:i.id,frameHeight:i.frameHeight,frameWidth:i.frameWidth,framesPerSecond:i.framesPerSecond,framesSent:i.framesSent,firCount:i.firCount,pliCount:i.pliCount,nackCount:i.nackCount,packetsSent:i.packetsSent,bytesSent:i.bytesSent,qualityLimitationReason:i.qualityLimitationReason,qualityLimitationDurations:i.qualityLimitationDurations,qualityLimitationResolutionChanges:i.qualityLimitationResolutionChanges,rid:(r=i.rid)!==null&&r!==void 0?r:i.id,retransmittedPacketsSent:i.retransmittedPacketsSent,targetBitrate:i.targetBitrate,timestamp:i.timestamp},a=n.get(i.remoteId);a&&(s.jitter=a.jitter,s.packetsLost=a.packetsLost,s.roundTripTime=a.roundTripTime),A.push(s)}}),A.sort((i,r)=>{var s,a;return((s=r.frameWidth)!==null&&s!==void 0?s:0)-((a=i.frameWidth)!==null&&a!==void 0?a:0)}),A})}setPublishingQuality(e){const A=[];for(let n=AA.LOW;n<=AA.HIGH;n+=1)A.push(new Xs({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(A)}restartTrack(e){return v(this,void 0,void 0,function*(){var A,n,i,r,s;let a;if(e){const u=Ea({video:e});typeof u.video!="boolean"&&(a=u.video)}yield this.restart(a);try{for(var o=!0,c=XA(this.simulcastCodecs.values()),l;l=yield c.next(),A=l.done,!A;o=!0){r=l.value,o=!1;const u=r;u.sender&&((s=u.sender.transport)===null||s===void 0?void 0:s.state)!=="closed"&&(u.mediaStreamTrack=this.mediaStreamTrack.clone(),yield u.sender.replaceTrack(u.mediaStreamTrack))}}catch(u){n={error:u}}finally{try{!o&&!A&&(i=c.return)&&(yield i.call(c))}finally{if(n)throw n.error}}})}setProcessor(e){const A=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return v(this,arguments,void 0,function(n){var i=this;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var s,a,o,c,l,u;if(yield A.setProcessor.call(i,n,r),!((l=i.processor)===null||l===void 0)&&l.processedTrack)try{for(var d=!0,h=XA(i.simulcastCodecs.values()),g;g=yield h.next(),s=g.done,!s;d=!0)c=g.value,d=!1,yield(u=c.sender)===null||u===void 0?void 0:u.replaceTrack(i.processor.processedTrack)}catch(f){a={error:f}}finally{try{!d&&!s&&(o=h.return)&&(yield o.call(h))}finally{if(a)throw a.error}}}()})}setDegradationPreference(e){return v(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const A=this.sender.getParameters();A.degradationPreference=e,this.sender.setParameters(A)}catch(A){this.log.warn("failed to set degradationPreference",Object.assign({error:A},this.logContext))}})}addSimulcastTrack(e,A){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:A};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,A){const n=this.simulcastCodecs.get(e);n&&(n.sender=A,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},Db))}setPublishingCodecs(e){return v(this,void 0,void 0,function*(){var A,n,i,r,s,a,o;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(e[0].qualities),[];this.subscribedCodecs=e;const c=[];try{for(A=!0,n=XA(e);i=yield n.next(),r=i.done,!r;A=!0){o=i.value,A=!1;const l=o;if(!this.codec||this.codec===l.codec)yield this.setPublishingLayers(l.qualities);else{const u=this.simulcastCodecs.get(l.codec);if(this.log.debug("try setPublishingCodec for ".concat(l.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:u})),!u||!u.sender){for(const d of l.qualities)if(d.enabled){c.push(l.codec);break}}else u.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(l.codec),this.logContext),yield zd(u.sender,u.encodings,l.qualities,this.senderLock,this.log,this.logContext))}}}catch(l){s={error:l}}finally{try{!A&&!r&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return c})}setPublishingLayers(e){return v(this,void 0,void 0,function*(){this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield zd(this.sender,this.encodings,e,this.senderLock,this.log,this.logContext))})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return v(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),bd()&&this.isInBackground&&this.source===F.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function zd(t,e,A,n,i,r){return v(this,void 0,void 0,function*(){const s=yield n.lock();i.debug("setPublishingLayersForSender",Object.assign(Object.assign({},r),{sender:t,qualities:A,senderEncodings:e}));try{const a=t.getParameters(),{encodings:o}=a;if(!o)return;if(o.length!==e.length){i.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},r),{encodings:o,senderEncodings:e}));return}let c=!1;const l=uA();if((l==null?void 0:l.name)==="Chrome"&&mt(l==null?void 0:l.version,"133")>0&&o[0].scalabilityMode){const d=o[0],h=new hr(d.scalabilityMode);let g=Lt.OFF;if(A.forEach(f=>{f.enabled&&(g===Lt.OFF||f.quality>g)&&(g=f.quality)}),g===Lt.OFF)d.active&&(d.active=!1,c=!0);else if(!d.active||h.spatial!==g+1){c=!0,d.active=!0;const f=new hr(e[0].scalabilityMode);h.spatial=g+1,h.suffix=f.suffix,h.spatial===1&&(h.suffix=void 0),d.scalabilityMode=h.toString(),d.scaleResolutionDownBy=Math.pow(2,2-g),e[0].maxBitrate&&(d.maxBitrate=e[0].maxBitrate/(d.scaleResolutionDownBy*d.scaleResolutionDownBy))}}else o.forEach((d,h)=>{var g;let f=(g=d.rid)!==null&&g!==void 0?g:"";f===""&&(f="q");const m=Zd(f),B=A.find(b=>b.quality===m);B&&d.active!==B.enabled&&(c=!0,d.active=B.enabled,i.debug("setting layer ".concat(B.quality," to ").concat(d.active?"enabled":"disabled"),r),Gt()&&(B.enabled?(d.scaleResolutionDownBy=e[h].scaleResolutionDownBy,d.maxBitrate=e[h].maxBitrate,d.maxFrameRate=e[h].maxFrameRate):(d.scaleResolutionDownBy=4,d.maxBitrate=10,d.maxFrameRate=2)))});c&&(a.encodings=o,i.debug("setting encodings",Object.assign(Object.assign({},r),{encodings:a.encodings})),yield t.setParameters(a))}finally{s()}})}function Zd(t){switch(t){case"f":return AA.HIGH;case"h":return AA.MEDIUM;case"q":return AA.LOW;default:return AA.HIGH}}function $d(t,e,A,n){if(!A)return[new ft({quality:AA.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(n){const i=A[0].scalabilityMode,r=new hr(i),s=[],a=r.suffix=="h"?1.5:2,o=r.suffix=="h"?2:3;for(let c=0;c<r.spatial;c+=1)s.push(new ft({quality:Math.min(AA.HIGH,r.spatial-1)-c,width:Math.ceil(t/Math.pow(a,c)),height:Math.ceil(e/Math.pow(a,c)),bitrate:A[0].maxBitrate?Math.ceil(A[0].maxBitrate/Math.pow(o,c)):0,ssrc:0}));return s}return A.map(i=>{var r,s,a;const o=(r=i.scaleResolutionDownBy)!==null&&r!==void 0?r:1;let c=Zd((s=i.rid)!==null&&s!==void 0?s:"");return new ft({quality:c,width:Math.ceil(t/o),height:Math.ceil(e/o),bitrate:(a=i.maxBitrate)!==null&&a!==void 0?a:0,ssrc:0})})}const eh="_lossy",Ah="_reliable",Hb=2*1e3,Na="leave-reconnect";var hA;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(hA||(hA={}));class Ob extends yA.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var A;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=Ra.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.subscriberPrimary=!1,this.pcState=hA.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=W,this.handleDataChannel=n=>v(this,[n],void 0,function(i){var r=this;let{channel:s}=i;return function*(){if(s){if(s.label===Ah)r.reliableDCSub=s;else if(s.label===eh)r.lossyDCSub=s;else return;r.log.debug("on data channel ".concat(s.id,", ").concat(s.label),r.logContext),s.onmessage=r.handleDataMessage}}()}),this.handleDataMessage=n=>v(this,void 0,void 0,function*(){var i,r;const s=yield this.dataProcessLock.lock();try{let a;if(n.data instanceof ArrayBuffer)a=n.data;else if(n.data instanceof Blob)a=yield n.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:n.data}));return}const o=Ne.fromBinary(new Uint8Array(a));((i=o.value)===null||i===void 0?void 0:i.case)==="speaker"?this.emit(_.ActiveSpeakersUpdate,o.value.value.speakers):(((r=o.value)===null||r===void 0?void 0:r.case)==="user"&&Nb(o,o.value.value),this.emit(_.DataPacketReceived,o))}finally{s()}}),this.handleDataError=n=>{const r=n.currentTarget.maxRetransmits===0?"lossy":"reliable";if(n instanceof ErrorEvent&&n.error){const{error:s}=n.error;this.log.error("DataChannel error on ".concat(r,": ").concat(n.message),Object.assign(Object.assign({},this.logContext),{error:s}))}else this.log.error("Unknown DataChannel error on ".concat(r),Object.assign(Object.assign({},this.logContext),{event:n}))},this.handleBufferedAmountLow=n=>{const r=n.currentTarget.maxRetransmits===0?X.LOSSY:X.RELIABLE;this.updateAndEmitDCBufferStatus(r)},this.handleDisconnect=(n,i)=>{if(this._isClosed)return;this.log.warn("".concat(n," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const r=o=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(o,"ms. giving up"),this.logContext),this.emit(_.Disconnected),this.close()},s=Date.now()-this.reconnectStart;let a=this.getNextRetryDelay({elapsedMs:s,retryCount:this.reconnectAttempts});if(a===null){r(s);return}n===Na&&(a=0),this.log.debug("reconnecting in ".concat(a,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Te.setTimeout(()=>this.attemptReconnect(i).finally(()=>this.reconnectTimeout=void 0),a)},this.waitForRestarted=()=>new Promise((n,i)=>{this.pcState===hA.Connected&&n();const r=()=>{this.off(_.Disconnected,s),n()},s=()=>{this.off(_.Restarted,r),i()};this.once(_.Restarted,r),this.once(_.Disconnected,s)}),this.updateAndEmitDCBufferStatus=n=>{const i=this.isBufferStatusLow(n);typeof i<"u"&&i!==this.dcBufferStatus.get(n)&&(this.dcBufferStatus.set(n,i),this.emit(_.DCBufferStatusChanged,i,n))},this.isBufferStatusLow=n=>{const i=this.dataChannelForKind(n);if(i)return i.bufferedAmount<=i.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===ne.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(Dt.RR_SIGNAL_DISCONNECTED))},this.log=FA((A=e.loggerName)!==null&&A!==void 0?A:lA.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new ka(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.registerOnLineListener(),this.closingLock=new Oe,this.dataProcessLock=new Oe,this.dcBufferStatus=new Map([[X.LOSSY,!0],[X.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(_.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(_.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(_.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(_.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(_.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(_.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(_.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(_.SignalRequestResponse,n)}get logContext(){var e,A,n,i,r,s,a,o;return{room:(A=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||A===void 0?void 0:A.name,roomID:(i=(n=this.latestJoinResponse)===null||n===void 0?void 0:n.room)===null||i===void 0?void 0:i.sid,participant:(s=(r=this.latestJoinResponse)===null||r===void 0?void 0:r.participant)===null||s===void 0?void 0:s.identity,pID:(o=(a=this.latestJoinResponse)===null||a===void 0?void 0:a.participant)===null||o===void 0?void 0:o.sid}}join(e,A,n,i){return v(this,void 0,void 0,function*(){this.url=e,this.token=A,this.signalOpts=n,this.maxJoinAttempts=n.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const r=yield this.client.join(e,A,n,i);return this._isClosed=!1,this.latestJoinResponse=r,this.subscriberPrimary=r.subscriberPrimary,this.pcManager||(yield this.configure(r)),(!this.subscriberPrimary||r.fastPublish)&&this.negotiate(),this.clientConfiguration=r.clientConfiguration,setTimeout(()=>{this.emit(_.SignalConnected)},10),r}catch(r){if(r instanceof Ae&&r.reason===J.ServerUnreachable&&(this.log.warn("Couldn't connect to server, attempt ".concat(this.joinAttempts," of ").concat(this.maxJoinAttempts),this.logContext),this.joinAttempts<this.maxJoinAttempts))return this.join(e,A,n,i);throw r}})}close(){return v(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(_.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return v(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const A=n=>{n&&(n.close(),n.onbufferedamountlow=null,n.onclose=null,n.onclosing=null,n.onerror=null,n.onmessage=null,n.onopen=null)};A(this.lossyDC),A(this.lossyDCSub),A(this.reliableDC),A(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0})}cleanupClient(){return v(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new IA("a track with the same ID has already been published");return new Promise((A,n)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(new Ae("publication of local track timed out, no response from server",J.InternalError))},1e4);this.pendingTrackResolvers[e.cid]={resolve:r=>{clearTimeout(i),A(r)},reject:()=>{clearTimeout(i),n(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:A}=this.pendingTrackResolvers[e.track.id];A&&A(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(A){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:A}))}return!1}updateMuteStatus(e,A){this.client.sendMuteTrack(e,A)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return v(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return v(this,void 0,void 0,function*(){var A,n;if(this.pcManager&&this.pcManager.currentState!==ue.NEW)return;this.participantSid=(A=e.participant)===null||A===void 0?void 0:A.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new Ub(i,e.subscriberPrimary,this.loggerOptions),this.emit(_.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(r,s)=>{this.client.sendIceCandidate(r,s)},this.pcManager.onPublisherOffer=r=>{this.client.sendOffer(r)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(r,s,a)=>v(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(r),this.logContext),["closed","disconnected","failed"].includes(s)&&(this.publisherConnectionPromise=void 0),r===ue.CONNECTED){const l=this.pcState===hA.New;this.pcState=hA.Connected,l&&this.emit(_.Connected,e)}else r===ue.FAILED&&this.pcState===hA.Connected&&(this.pcState=hA.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?Dt.RR_SUBSCRIBER_FAILED:Dt.RR_PUBLISHER_FAILED));const o=this.client.isDisconnected||this.client.currentState===ne.RECONNECTING,c=[ue.FAILED,ue.CLOSING,ue.CLOSED].includes(r);o&&c&&!this._isClosed&&this.emit(_.Offline)}),this.pcManager.onTrack=r=>{this.emit(_.MediaTrackAdded,r.track,r.streams[0],r.receiver)},Mb((n=e.serverInfo)===null||n===void 0?void 0:n.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=e=>v(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type})),yield this.pcManager.setPublisherAnswer(e))}),this.client.onTrickle=(e,A)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:A})),this.pcManager.addIceCandidate(e,A))},this.client.onOffer=e=>v(this,void 0,void 0,function*(){if(!this.pcManager)return;const A=yield this.pcManager.createSubscriberAnswerFromOffer(e);this.client.sendAnswer(A)}),this.client.onLocalTrackPublished=e=>{var A;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(A=e.track)===null||A===void 0?void 0:A.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:n}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],n(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(_.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(_.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,A)=>{this.emit(_.RemoteMute,e,A)},this.client.onSubscribedQualityUpdate=e=>{this.emit(_.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var A;this.participantSid=(A=e.participant)===null||A===void 0?void 0:A.sid,this.emit(_.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",Dt.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e==null?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case Mt.DISCONNECT:this.emit(_.Disconnected,e==null?void 0:e.reason),this.close();break;case Mt.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(Na);break;case Mt.RESUME:this.handleDisconnect(Na)}}}makeRTCConfiguration(e){var A;const n=Object.assign({},this.rtcConfig);if(!((A=this.signalOpts)===null||A===void 0)&&A.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),n.encodedInsertableStreams=!0),e.iceServers&&!n.iceServers){const i=[];e.iceServers.forEach(r=>{const s={urls:r.urls};r.username&&(s.username=r.username),r.credential&&(s.credential=r.credential),i.push(s)}),n.iceServers=i}return e.clientConfiguration&&e.clientConfiguration.forceRelay===Un.ENABLED&&(n.iceTransportPolicy="relay"),n.sdpSemantics="unified-plan",n.continualGatheringPolicy="gather_continually",n}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(eh,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(Ah,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow)}createSender(e,A,n){return v(this,void 0,void 0,function*(){if(fa())return yield this.createTransceiverRTCRtpSender(e,A,n);if(ga())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new ye("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,A,n,i){return v(this,void 0,void 0,function*(){if(fa())return this.createSimulcastTransceiverSender(e,A,n,i);if(ga())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new ye("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,A,n){return v(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),Wt(e)&&(e.codec=A.videoCodec);const r={direction:"sendonly",streams:i};return n&&(r.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,r)).sender})}createSimulcastTransceiverSender(e,A,n,i){return v(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("publisher is closed");const r={direction:"sendonly"};i&&(r.sendEncodings=i);const s=yield this.pcManager.addPublisherTransceiver(A.mediaStreamTrack,r);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,s.sender),s.sender})}createRTCRtpSender(e){return v(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return v(this,void 0,void 0,function*(){var A,n,i;if(!this._isClosed){if(this.attemptingReconnect){W.warn("already attempting reconnect, returning early",this.logContext);return}(((A=this.clientConfiguration)===null||A===void 0?void 0:A.resumeConnection)===Un.DISABLED||((i=(n=this.pcManager)===null||n===void 0?void 0:n.currentState)!==null&&i!==void 0?i:ue.NEW)===ue.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(r){this.reconnectAttempts+=1;let s=!0;r instanceof ye?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:r})),s=!1):r instanceof Xt||(this.fullReconnectOnNext=!0),s?this.handleDisconnect("reconnect",Dt.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(_.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(A){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:A}))}return null}restartConnection(e){return v(this,void 0,void 0,function*(){var A,n,i;try{if(!this.url||!this.token)throw new ye("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(_.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let r;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Xt;r=yield this.join(e??this.url,this.token,this.signalOpts)}catch(s){throw s instanceof Ae&&s.reason===J.NotAllowed?new ye("could not reconnect, token might be expired"):new Xt}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(_.SignalRestarted,r),yield this.waitForPCReconnected(),this.client.currentState!==ne.CONNECTED)throw new Xt("Signal connection got severed during reconnect");(A=this.regionUrlProvider)===null||A===void 0||A.resetAttempts(),this.emit(_.Restarted)}catch(r){const s=yield(n=this.regionUrlProvider)===null||n===void 0?void 0:n.getNextBestRegionUrl();if(s){yield this.restartConnection(s);return}else throw(i=this.regionUrlProvider)===null||i===void 0||i.resetAttempts(),r}})}resumeConnection(e){return v(this,void 0,void 0,function*(){var A;if(!this.url||!this.token)throw new ye("could not reconnect, url or token not saved");if(!this.pcManager)throw new ye("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(_.Resuming);let n;try{this.setupSignalClientCallbacks(),n=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let r="";throw i instanceof Error&&(r=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof Ae&&i.reason===J.NotAllowed?new ye("could not reconnect, token might be expired"):i instanceof Ae&&i.reason===J.LeaveRequest?i:new Xt(r)}if(this.emit(_.SignalResumed),n){const i=this.makeRTCConfiguration(n);this.pcManager.updateConfiguration(i)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==ne.CONNECTED)throw new Xt("Signal connection got severed during reconnect");this.client.setReconnected(),((A=this.reliableDC)===null||A===void 0?void 0:A.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),this.emit(_.Resumed)})}waitForPCInitialConnection(e,A){return v(this,void 0,void 0,function*(){if(!this.pcManager)throw new ye("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(A,e)})}waitForPCReconnected(){return v(this,void 0,void 0,function*(){this.pcState=hA.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield Ke(Hb),!this.pcManager)throw new ye("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=hA.Connected}catch(e){throw this.pcState=hA.Disconnected,new Ae("could not establish PC connection, ".concat(e.message),J.InternalError)}})}publishRpcResponse(e,A,n,i){return v(this,void 0,void 0,function*(){const r=new Ne({destinationIdentities:[e],kind:X.RELIABLE,value:{case:"rpcResponse",value:new au({requestId:A,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(r,X.RELIABLE)})}publishRpcAck(e,A){return v(this,void 0,void 0,function*(){const n=new Ne({destinationIdentities:[e],kind:X.RELIABLE,value:{case:"rpcAck",value:new su({requestId:A})}});yield this.sendDataPacket(n,X.RELIABLE)})}sendDataPacket(e,A){return v(this,void 0,void 0,function*(){const n=e.toBinary();yield this.ensurePublisherConnected(A);const i=this.dataChannelForKind(A);i&&i.send(n),this.updateAndEmitDCBufferStatus(A)})}waitForBufferStatusLow(e){return new Promise((A,n)=>v(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))A();else{const i=()=>n("Engine closed");for(this.once(_.Closing,i);!this.dcBufferStatus.get(e);)yield Ke(10);this.off(_.Closing,i),A()}}))}ensureDataTransportConnected(e){return v(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var r;if(!n.pcManager)throw new ye("PC manager is closed");const s=i?n.pcManager.subscriber:n.pcManager.publisher,a=i?"Subscriber":"Publisher";if(!s)throw new Ae("".concat(a," connection not set"),J.InternalError);let o=!1;!i&&!n.dataChannelForKind(A,i)&&(n.createDataChannels(),o=!0),!o&&!i&&!n.pcManager.publisher.isICEConnected&&n.pcManager.publisher.getICEConnectionState()!=="checking"&&(o=!0),o&&n.negotiate();const c=n.dataChannelForKind(A,i);if((c==null?void 0:c.readyState)==="open")return;const l=new Date().getTime()+n.peerConnectionTimeout;for(;new Date().getTime()<l;){if(s.isICEConnected&&((r=n.dataChannelForKind(A,i))===null||r===void 0?void 0:r.readyState)==="open")return;yield Ke(50)}throw new Ae("could not establish ".concat(a," connection, state: ").concat(s.getICEConnectionState()),J.InternalError)}()})}ensurePublisherConnected(e){return v(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==ue.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return v(this,void 0,void 0,function*(){return new Promise((e,A)=>v(this,void 0,void 0,function*(){if(!this.pcManager){A(new aa("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const n=new AbortController,i=()=>{n.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&A("cannot negotiate on closed engine"),this.on(_.Closing,i),this.pcManager.publisher.once(Jt.RTPVideoPayloadTypes,r=>{const s=new Map;r.forEach(a=>{const o=a.codec.toLowerCase();qw(o)&&s.set(a.payload,o)}),this.emit(_.RTPVideoMapUpdate,s)});try{yield this.pcManager.negotiate(n),e()}catch(r){r instanceof aa&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",Dt.RR_UNKNOWN),A(r)}finally{this.off(_.Closing,i)}}))})}dataChannelForKind(e,A){if(A){if(e===X.LOSSY)return this.lossyDCSub;if(e===X.RELIABLE)return this.reliableDCSub}else{if(e===X.LOSSY)return this.lossyDC;if(e===X.RELIABLE)return this.reliableDC}}sendSyncState(e,A){var n,i;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const r=this.pcManager.subscriber.getLocalDescription(),s=this.pcManager.subscriber.getRemoteDescription(),a=(i=(n=this.signalOpts)===null||n===void 0?void 0:n.autoSubscribe)!==null&&i!==void 0?i:!0,o=new Array,c=new Array;e.forEach(l=>{l.isDesired!==a&&o.push(l.trackSid),l.isEnabled||c.push(l.trackSid)}),this.client.sendSyncState(new Qu({answer:r?lr({sdp:r.sdp,type:r.type}):void 0,offer:s?lr({sdp:s.sdp,type:s.type}):void 0,subscription:new Xi({trackSids:o,subscribe:!a,participantTracks:[]}),publishTracks:ib(A),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:c}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],A=(n,i)=>{(n==null?void 0:n.id)!==void 0&&n.id!==null&&e.push(new Eu({label:n.label,id:n.id,target:i}))};return A(this.dataChannelForKind(X.LOSSY),cA.PUBLISHER),A(this.dataChannelForKind(X.RELIABLE),cA.PUBLISHER),A(this.dataChannelForKind(X.LOSSY,!0),cA.SUBSCRIBER),A(this.dataChannelForKind(X.RELIABLE,!0),cA.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Te.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Ve()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){Ve()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Xt extends Error{}function Mb(t){return t!==void 0&&t>13}function Nb(t,e){const A=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=A,e.participantIdentity=A;const n=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=n,e.destinationIdentities=n}class Ka{constructor(e,A){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=A}updateToken(e){this.token=e}isCloud(){return ma(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return v(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");(!this.regionSettings||Date.now()-this.lastUpdateAt>this.settingsCacheTime)&&(this.regionSettings=yield this.fetchRegionSettings(e));const A=this.regionSettings.regions.filter(n=>!this.attemptedRegions.find(i=>i.url===n.url));if(A.length>0){const n=A[0];return this.attemptedRegions.push(n),W.debug("next region: ".concat(n.region)),n.url}else return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return v(this,void 0,void 0,function*(){const A=yield fetch("".concat(Kb(this.serverUrl),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});if(A.ok){const n=yield A.json();return this.lastUpdateAt=Date.now(),n}else throw new Ae("Could not fetch region settings: ".concat(A.statusText),A.status===401?J.NotAllowed:J.InternalError,A.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}function Kb(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}class th{get info(){return this._info}constructor(e,A,n){this.reader=A,this.totalByteSize=n,this._info=e,this.bytesReceived=0}}class Vb extends th{handleChunkReceived(e){var A;this.bytesReceived+=e.content.byteLength;const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(A=this.onProgress)===null||A===void 0||A.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader();return{next:()=>v(this,void 0,void 0,function*(){try{const{done:A,value:n}=yield e.read();return A?{done:!0,value:void 0}:(this.handleChunkReceived(n),{done:!1,value:n.content})}catch{return{done:!0,value:void 0}}}),return(){return v(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return v(this,void 0,void 0,function*(){var e,A,n,i;let r=new Set;try{for(var s=!0,a=XA(this),o;o=yield a.next(),e=o.done,!e;s=!0){i=o.value,s=!1;const c=i;r.add(c)}}catch(c){A={error:c}}finally{try{!s&&!e&&(n=a.return)&&(yield n.call(a))}finally{if(A)throw A.error}}return Array.from(r)})}}class Gb extends th{constructor(e,A,n){super(e,A,n),this.receivedChunks=new Map}handleChunkReceived(e){var A;const n=or(e.chunkIndex),i=this.receivedChunks.get(n);if(i&&i.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength;const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(A=this.onProgress)===null||A===void 0||A.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader(),A=new TextDecoder;return{next:()=>v(this,void 0,void 0,function*(){try{const{done:n,value:i}=yield e.read();return n?{done:!0,value:void 0}:(this.handleChunkReceived(i),{done:!1,value:A.decode(i.content)})}catch{return{done:!0,value:void 0}}}),return(){return v(this,void 0,void 0,function*(){return e.releaseLock(),{done:!0,value:void 0}})}}}readAll(){return v(this,void 0,void 0,function*(){var e,A,n,i;let r="";try{for(var s=!0,a=XA(this),o;o=yield a.next(),e=o.done,!e;s=!0)i=o.value,s=!1,r+=i}catch(c){A={error:c}}finally{try{!s&&!e&&(n=a.return)&&(yield n.call(a))}finally{if(A)throw A.error}}return r})}}class nh{constructor(e,A,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=A}write(e){return this.defaultWriter.write(e)}close(){return v(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class jb extends nh{}class Wb extends nh{}class ih extends F{constructor(e,A,n,i,r){super(e,n,r),this.sid=A,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?x.Muted:x.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const A=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",A),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(x.Ended,this))};e.addEventListener("removetrack",A)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return v(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),Da)),rb()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var A;this.timeSyncHandle=requestAnimationFrame(()=>e());const n=(A=this.receiver)===null||A===void 0?void 0:A.getSynchronizationSources()[0];if(n){const{timestamp:i,rtpTimestamp:r}=n;r&&this.rtpTimestamp!==r&&(this.emit(x.TimeSyncUpdate,{timestamp:i,rtpTimestamp:r}),this.rtpTimestamp=r)}};e()}}class Jb extends ih{constructor(e,A,n,i,r,s){super(e,A,F.Kind.Audio,n,s),this.monitorReceiver=()=>v(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const a=yield this.getReceiverStats();a&&this.prevStats&&this.receiver&&(this._currentBitrate=ur(a,this.prevStats)),this.prevStats=a}),this.audioContext=i,this.webAudioPluginNodes=[],r&&(this.sinkId=r.deviceId)}setVolume(e){var A;for(const n of this.attachedElements)this.audioContext?(A=this.gainNode)===null||A===void 0||A.gain.setTargetAtTime(e,0,.1):n.volume=e;UA()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(UA())return 1;let e=0;return this.attachedElements.forEach(A=>{A.volume>e&&(e=A.volume)}),e}setSinkId(e){return v(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(A=>{if(pa(A))return A.setSinkId(e)}))})}attach(e){const A=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&pa(e)&&e.setSinkId(this.sinkId).catch(n=>{this.log.error("Failed to set sink id on remote audio track",n,this.logContext)}),this.audioContext&&A&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let A;return e?(A=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(A=super.detach(),this.disconnectWebAudio()),A}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,A){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(A.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(i=>{n.connect(i),n=i}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(x.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(i=>{this.emit(x.AudioPlaybackFailed,i)})}disconnectWebAudio(){var e,A;(e=this.gainNode)===null||e===void 0||e.disconnect(),(A=this.sourceNode)===null||A===void 0||A.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return v(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let A;return e.forEach(n=>{n.type==="inbound-rtp"&&(A={type:"audio",streamId:n.id,timestamp:n.timestamp,jitter:n.jitter,bytesReceived:n.bytesReceived,concealedSamples:n.concealedSamples,concealmentEvents:n.concealmentEvents,silentConcealedSamples:n.silentConcealedSamples,silentConcealmentEvents:n.silentConcealmentEvents,totalAudioEnergy:n.totalAudioEnergy,totalSamplesDuration:n.totalSamplesDuration})}),A})}}const Va=100;class Xb extends ih{constructor(e,A,n,i,r){super(e,A,F.Kind.Video,n,r),this.elementInfos=[],this.monitorReceiver=()=>v(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const s=yield this.getReceiverStats();s&&this.prevStats&&this.receiver&&(this._currentBitrate=ur(s,this.prevStats)),this.prevStats=s}),this.debouncedHandleResize=_a(()=>{this.updateDimensions()},Va),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(A=>{e?Vt(this._mediaStreamTrack,A):Kt(this._mediaStreamTrack,A)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(A=>A.element===e)===void 0){const A=new qb(e);this.observeElementInfo(A)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(A=>A===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const A=this.elementInfos.filter(n=>n===e);for(const n of A)n.stopObserving();this.elementInfos=this.elementInfos.filter(n=>n!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let A=[];if(e)return this.stopObservingElement(e),super.detach(e);A=super.detach();for(const n of A)this.stopObservingElement(n);return A}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return v(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let A,n="",i=new Map;return e.forEach(r=>{r.type==="inbound-rtp"?(n=r.codecId,A={type:"video",streamId:r.id,framesDecoded:r.framesDecoded,framesDropped:r.framesDropped,framesReceived:r.framesReceived,packetsReceived:r.packetsReceived,packetsLost:r.packetsLost,frameWidth:r.frameWidth,frameHeight:r.frameHeight,pliCount:r.pliCount,firCount:r.firCount,nackCount:r.nackCount,jitter:r.jitter,timestamp:r.timestamp,bytesReceived:r.bytesReceived,decoderImplementation:r.decoderImplementation}):r.type==="codec"&&i.set(r.id,r)}),A&&n!==""&&i.get(n)&&(A.mimeType=i.get(n).mimeType),A})}stopObservingElement(e){const A=this.elementInfos.filter(n=>n.element===e);for(const n of A)this.stopObservingElementInfo(n)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return v(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(){var e,A;const n=this.elementInfos.reduce((a,o)=>Math.max(a,o.visibilityChangedAt||0),0),i=!((A=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&A!==void 0)||A?this.isInBackground:!1,r=this.elementInfos.some(a=>a.pictureInPicture),s=this.elementInfos.some(a=>a.visible)&&!i||r;if(this.lastVisible!==s){if(!s&&Date.now()-n<Va){Te.setTimeout(()=>{this.updateVisibility()},Va);return}this.lastVisible=s,this.emit(x.VisibilityChanged,s,this)}}updateDimensions(){var e,A;let n=0,i=0;const r=this.getPixelDensity();for(const s of this.elementInfos){const a=s.width()*r,o=s.height()*r;a+o>n+i&&(n=a,i=o)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===n&&((A=this.lastDimensions)===null||A===void 0?void 0:A.height)===i||(this.lastDimensions={width:n,height:i},this.emit(x.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const A=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return A==="screen"?Qd():A||(Qd()>2?2:1)}}class qb{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,A){this.onVisibilityChanged=n=>{var i;const{target:r,isIntersecting:s}=n;r===this.element&&(this.isIntersecting=s,this.isPiP=In(this.element),this.visibilityChangedAt=Date.now(),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this))},this.onEnterPiP=()=>{var n,i,r;(i=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP),this.isPiP=In(this.element),(r=this.handleVisibilityChanged)===null||r===void 0||r.call(this)},this.onLeavePiP=()=>{var n;this.isPiP=In(this.element),(n=this.handleVisibilityChanged)===null||n===void 0||n.call(this)},this.element=e,this.isIntersecting=A??Ga(e),this.isPiP=Ve()&&In(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,A,n;this.isIntersecting=Ga(this.element),this.isPiP=In(this.element),this.element.handleResize=()=>{var i;(i=this.handleResize)===null||i===void 0||i.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Sd().observe(this.element),Ed().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(n=(A=window.documentPictureInPicture)===null||A===void 0?void 0:A.window)===null||n===void 0||n.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,A,n,i,r;(e=Sd())===null||e===void 0||e.unobserve(this.element),(A=Ed())===null||A===void 0||A.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(n=window.documentPictureInPicture)===null||n===void 0||n.removeEventListener("enter",this.onEnterPiP),(r=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||r===void 0||r.removeEventListener("pagehide",this.onLeavePiP)}}function In(t){var e,A;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?Ga(t,(A=window.documentPictureInPicture)===null||A===void 0?void 0:A.window):!1}function Ga(t,e){const A=e||window;let n=t.offsetTop,i=t.offsetLeft;const r=t.offsetWidth,s=t.offsetHeight,{hidden:a}=t,{display:o}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,n+=t.offsetTop,i+=t.offsetLeft;return n<A.pageYOffset+A.innerHeight&&i<A.pageXOffset+A.innerWidth&&n+s>A.pageYOffset&&i+r>A.pageXOffset&&!a&&o!=="none"}class _A extends yA.EventEmitter{constructor(e,A,n,i){var r;super(),this.metadataMuted=!1,this.encryption=qe.NONE,this.log=W,this.handleMuted=()=>{this.emit(x.Muted)},this.handleUnmuted=()=>{this.emit(x.Unmuted)},this.log=FA((r=i==null?void 0:i.loggerName)!==null&&r!==void 0?r:lA.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=A,this.trackName=n,this.source=F.Source.Unknown}setTrack(e){this.track&&(this.track.off(x.Muted,this.handleMuted),this.track.off(x.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(x.Muted,this.handleMuted),e.on(x.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),z(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==qe.NONE}get audioTrack(){if(xA(this.track))return this.track}get videoTrack(){if(Wt(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=F.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===F.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(_A||(_A={}));class ja extends _A{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,A,n,i){super(e,A.sid,A.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(x.Ended)},this.updateInfo(A),this.setTrack(n)}setTrack(e){this.track&&this.track.off(x.Ended,this.handleTrackEnded),super.setTrack(e),e&&e.on(x.Ended,this.handleTrackEnded)}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return v(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return v(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return v(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return v(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(xA(this.track)){const A=this.track.getSourceTrackSettings(),n=new Set;return A.autoGainControl&&n.add(oA.TF_AUTO_GAIN_CONTROL),A.echoCancellation&&n.add(oA.TF_ECHO_CANCELLATION),A.noiseSuppression&&n.add(oA.TF_NOISE_SUPPRESSION),A.channelCount&&A.channelCount>1&&n.add(oA.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(oA.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(oA.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function gr(t,e){return v(this,void 0,void 0,function*(){t??(t={});let A=!1;const{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:r}=Pd(t);let s=r.audio,a=r.video;if(n&&typeof r.audio=="object"&&(r.audio.processor=n),i&&typeof r.video=="object"&&(r.video.processor=i),t.audio&&typeof r.audio=="object"&&typeof r.audio.deviceId=="string"){const u=r.audio.deviceId;r.audio.deviceId={exact:u},A=!0,s=Object.assign(Object.assign({},r.audio),{deviceId:{ideal:u}})}if(r.video&&typeof r.video=="object"&&typeof r.video.deviceId=="string"){const u=r.video.deviceId;r.video.deviceId={exact:u},A=!0,a=Object.assign(Object.assign({},r.video),{deviceId:{ideal:u}})}(r.audio===!0||typeof r.audio=="object"&&!r.audio.deviceId)&&(r.audio={deviceId:"default"}),r.video===!0?r.video={deviceId:"default"}:typeof r.video=="object"&&!r.video.deviceId&&(r.video.deviceId="default");const o=Fd(r,Gd,jd),c=Ea(o),l=navigator.mediaDevices.getUserMedia(c);r.audio&&(Qe.userMediaPromiseMap.set("audioinput",l),l.catch(()=>Qe.userMediaPromiseMap.delete("audioinput"))),r.video&&(Qe.userMediaPromiseMap.set("videoinput",l),l.catch(()=>Qe.userMediaPromiseMap.delete("videoinput")));try{const u=yield l;return yield Promise.all(u.getTracks().map(d=>v(this,void 0,void 0,function*(){const h=d.kind==="audio";let g=h?o.audio:o.video;(typeof g=="boolean"||!g)&&(g={});let f;const m=h?c.audio:c.video;typeof m!="boolean"&&(f=m);const B=d.getSettings().deviceId;f!=null&&f.deviceId&&$A(f.deviceId)!==B?f.deviceId=B:f||(f={deviceId:B});const b=Eb(d,f,e);return b.kind===F.Kind.Video?b.source=F.Source.Camera:b.kind===F.Kind.Audio&&(b.source=F.Source.Microphone),b.mediaStream=u,xA(b)&&n?yield b.setProcessor(n):Wt(b)&&i&&(yield b.setProcessor(i)),b})))}catch(u){if(!A)throw u;return gr(Object.assign(Object.assign({},t),{audio:s,video:a}),e)}})}function Yb(t){return v(this,void 0,void 0,function*(){return(yield gr({audio:!1,video:t??!0}))[0]})}function zb(t){return v(this,void 0,void 0,function*(){return(yield gr({audio:t??!0,video:!1}))[0]})}var tt;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(tt||(tt={}));function Zb(t){switch(t){case yn.EXCELLENT:return tt.Excellent;case yn.GOOD:return tt.Good;case yn.POOR:return tt.Poor;case yn.LOST:return tt.Lost;default:return tt.Unknown}}class rh extends yA.EventEmitter{get logContext(){var e,A;return Object.assign({},(A=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||A===void 0?void 0:A.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===Ji.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===Ht.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,A,n,i,r,s){let a=arguments.length>6&&arguments[6]!==void 0?arguments[6]:Ji.STANDARD;var o;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=tt.Unknown,this.log=W,this.log=FA((o=s==null?void 0:s.loggerName)!==null&&o!==void 0?o:lA.Participant),this.loggerOptions=s,this.setMaxListeners(100),this.sid=e,this.identity=A,this.name=n,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=a,this._attributes=r??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,A]of this.trackPublications)if(A.source===e)return A}getTrackPublicationByName(e){for(const[,A]of this.trackPublications)if(A.trackName===e)return A}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new wa,this.once(L.Active,()=>{var e,A;(A=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||A===void 0||A.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const A=this.getTrackPublication(F.Source.Camera);return!(!((e=A==null?void 0:A.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const A=this.getTrackPublication(F.Source.Microphone);return!(!((e=A==null?void 0:A.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(F.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var A;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===Ht.ACTIVE&&((A=this.participantInfo)===null||A===void 0?void 0:A.state)!==Ht.ACTIVE&&this.emit(L.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const A=this.metadata!==e,n=this.metadata;this.metadata=e,A&&this.emit(L.ParticipantMetadataChanged,n)}_setName(e){const A=this.name!==e;this.name=e,A&&this.emit(L.ParticipantNameChanged,e)}_setAttributes(e){const A=sb(this.attributes,e);this._attributes=e,Object.keys(A).length>0&&this.emit(L.AttributesChanged,A)}setPermissions(e){var A,n,i,r,s,a;const o=this.permissions,c=e.canPublish!==((A=this.permissions)===null||A===void 0?void 0:A.canPublish)||e.canSubscribe!==((n=this.permissions)===null||n===void 0?void 0:n.canSubscribe)||e.canPublishData!==((i=this.permissions)===null||i===void 0?void 0:i.canPublishData)||e.hidden!==((r=this.permissions)===null||r===void 0?void 0:r.hidden)||e.recorder!==((s=this.permissions)===null||s===void 0?void 0:s.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((l,u)=>{var d;return l!==((d=this.permissions)===null||d===void 0?void 0:d.canPublishSources[u])})||e.canSubscribeMetrics!==((a=this.permissions)===null||a===void 0?void 0:a.canSubscribeMetrics);return this.permissions=e,c&&this.emit(L.ParticipantPermissionsChanged,o),c}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(L.IsSpeakingChanged,e))}setConnectionQuality(e){const A=this._connectionQuality;this._connectionQuality=Zb(e),A!==this._connectionQuality&&this.emit(L.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,A;this.activeFuture&&((A=(e=this.activeFuture).reject)===null||A===void 0||A.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(A=>xA(A.track)&&A.track.setAudioContext(e))}addTrackPublication(e){e.on(x.Muted,()=>{this.emit(L.TrackMuted,e)}),e.on(x.Unmuted,()=>{this.emit(L.TrackUnmuted,e)});const A=e;switch(A.track&&(A.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case F.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case F.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function $b(t){var e,A,n;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new yu({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(A=t.participantSid)!==null&&A!==void 0?A:"",allTracks:(n=t.allowAll)!==null&&n!==void 0?n:!1,trackSids:t.allowedTrackSids||[]})}const sh=15e3;class ey extends rh{constructor(e,A,n,i,r){super(e,A,void 0,void 0,void 0,{loggerName:i.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=qe.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new wa)},this.handleReconnected=()=>{var s,a;(a=(s=this.reconnectFuture)===null||s===void 0?void 0:s.resolve)===null||a===void 0||a.call(s),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleDisconnected=()=>{var s,a;this.reconnectFuture&&(this.reconnectFuture.promise.catch(o=>this.log.warn(o.message,this.logContext)),(a=(s=this.reconnectFuture)===null||s===void 0?void 0:s.reject)===null||a===void 0||a.call(s,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0)},this.handleSignalRequestResponse=s=>{const{requestId:a,reason:o,message:c}=s,l=this.pendingSignalRequests.get(a);l&&(o!==qs.OK&&l.reject(new Bd(c,o)),this.pendingSignalRequests.delete(a))},this.handleDataPacket=s=>{switch(s.value.case){case"rpcResponse":let a=s.value.value,o=null,c=null;a.value.case==="payload"?o=a.value.value:a.value.case==="error"&&(c=de.fromProto(a.value.value)),this.handleIncomingRpcResponse(a.requestId,o,c);break;case"rpcAck":let l=s.value.value;this.handleIncomingRpcAck(l.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(s=>$b(s)))},this.onTrackUnmuted=s=>{this.onTrackMuted(s,s.isUpstreamPaused)},this.onTrackMuted=(s,a)=>{if(a===void 0&&(a=!0),!s.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),z(s)));return}this.engine.updateMuteStatus(s.sid,a)},this.onTrackUpstreamPaused=s=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),z(s))),this.onTrackMuted(s,!0)},this.onTrackUpstreamResumed=s=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),z(s))),this.onTrackMuted(s,s.isMuted)},this.onTrackFeatureUpdate=s=>{const a=this.audioTrackPublications.get(s.sid);if(!a){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(s.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(a.trackSid,a.getTrackFeatures())},this.handleSubscribedQualityUpdate=s=>v(this,void 0,void 0,function*(){var a,o,c,l,u,d;if(!(!((u=this.roomOptions)===null||u===void 0)&&u.dynacast))return;const h=this.videoTrackPublications.get(s.trackSid);if(!h){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}if(s.subscribedCodecs.length>0){if(!h.videoTrack)return;const B=yield h.videoTrack.setPublishingCodecs(s.subscribedCodecs);try{for(var g=!0,f=XA(B),m;m=yield f.next(),a=m.done,!a;g=!0){l=m.value,g=!1;const b=l;Hw(b)&&(this.log.debug("publish ".concat(b," for ").concat(h.videoTrack.sid),Object.assign(Object.assign({},this.logContext),z(h))),yield this.publishAdditionalCodecForTrack(h.videoTrack,b,h.options))}}catch(b){o={error:b}}finally{try{!g&&!a&&(c=f.return)&&(yield c.call(f))}finally{if(o)throw o.error}}}else s.subscribedQualities.length>0&&(yield(d=h.videoTrack)===null||d===void 0?void 0:d.setPublishingLayers(s.subscribedQualities))}),this.handleLocalTrackUnpublished=s=>{const a=this.trackPublications.get(s.trackSid);if(!a){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:s.trackSid}));return}this.unpublishTrack(a.track)},this.handleTrackEnded=s=>v(this,void 0,void 0,function*(){if(s.source===F.Source.ScreenShare||s.source===F.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),z(s))),this.unpublishTrack(s);else if(s.isUserProvided)yield s.mute();else if(vt(s)||et(s))try{if(Ve())try{const a=yield navigator==null?void 0:navigator.permissions.query({name:s.source===F.Source.Camera?"camera":"microphone"});if(a&&a.state==="denied")throw this.log.warn("user has revoked access to ".concat(s.source),Object.assign(Object.assign({},this.logContext),z(s))),a.onchange=()=>{a.state!=="denied"&&(s.isMuted||s.restartTrack(),a.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}s.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),z(s))),vt(s)?yield s.restartTrack({deviceId:"default"}):yield s.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),z(s))),yield s.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=n,this.roomOptions=i,this.setupEngine(n),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=r}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==qe.NONE}getTrackPublication(e){const A=super.getTrackPublication(e);if(A)return A}getTrackPublicationByName(e){const A=super.getTrackPublicationByName(e);if(A)return A}setupEngine(e){this.engine=e,this.engine.on(_.RemoteMute,(A,n)=>{const i=this.trackPublications.get(A);!i||!i.track||(n?i.mute():i.unmute())}),this.engine.on(_.Connected,this.handleReconnected).on(_.SignalRestarted,this.handleReconnected).on(_.SignalResumed,this.handleReconnected).on(_.Restarting,this.handleReconnecting).on(_.Resuming,this.handleReconnecting).on(_.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(_.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(_.Disconnected,this.handleDisconnected).on(_.SignalRequestResponse,this.handleSignalRequestResponse).on(_.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return v(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return v(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return v(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return v(this,arguments,void 0,function(A){var n=this;let{metadata:i,name:r,attributes:s}=A;return function*(){return new Promise((a,o)=>v(n,void 0,void 0,function*(){var c,l;try{let u=!1;const d=yield this.engine.client.sendUpdateLocalMetadata((c=i??this.metadata)!==null&&c!==void 0?c:"",(l=r??this.name)!==null&&l!==void 0?l:"",s),h=performance.now();for(this.pendingSignalRequests.set(d,{resolve:a,reject:g=>{o(g),u=!0},values:{name:r,metadata:i,attributes:s}});performance.now()-h<5e3&&!u;){if((!r||this.name===r)&&(!i||this.metadata===i)&&(!s||Object.entries(s).every(g=>{let[f,m]=g;return this.attributes[f]===m||m===""&&!this.attributes[f]}))){this.pendingSignalRequests.delete(d),a();return}yield Ke(50)}o(new Bd("Request to update local metadata timed out","TimeoutError"))}catch(u){u instanceof Error&&o(u)}}))}()})}setCameraEnabled(e,A,n){return this.setTrackEnabled(F.Source.Camera,e,A,n)}setMicrophoneEnabled(e,A,n){return this.setTrackEnabled(F.Source.Microphone,e,A,n)}setScreenShareEnabled(e,A,n){return this.setTrackEnabled(F.Source.ScreenShare,e,A,n)}setPermissions(e){const A=this.permissions,n=super.setPermissions(e);return n&&A&&this.emit(L.ParticipantPermissionsChanged,A),n}setE2EEEnabled(e){return v(this,void 0,void 0,function*(){this.encryptionType=e?qe.GCM:qe.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,A,n,i){return v(this,void 0,void 0,function*(){var r,s;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:A})),this.republishPromise&&(yield this.republishPromise);let a=this.getTrackPublication(e);if(A)if(a)yield a.unmute();else{let o;if(this.pendingPublishing.has(e)){const c=yield this.waitForPendingPublicationOfSource(e);return c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield c==null?void 0:c.unmute(),c}this.pendingPublishing.add(e);try{switch(e){case F.Source.Camera:o=yield this.createTracks({video:(r=n)!==null&&r!==void 0?r:!0});break;case F.Source.Microphone:o=yield this.createTracks({audio:(s=n)!==null&&s!==void 0?s:!0});break;case F.Source.ScreenShare:o=yield this.createScreenTracks(Object.assign({},n));break;default:throw new IA(e)}}catch(c){throw o==null||o.forEach(l=>{l.stop()}),c instanceof Error&&this.emit(L.MediaDevicesError,c),this.pendingPublishing.delete(e),c}try{const c=[];for(const u of o)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),z(u))),c.push(this.publishTrack(u,i));[a]=yield Promise.all(c)}catch(c){throw o==null||o.forEach(l=>{l.stop()}),c}finally{this.pendingPublishing.delete(e)}}else if(!(a!=null&&a.track)&&this.pendingPublishing.has(e)&&(a=yield this.waitForPendingPublicationOfSource(e),a||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),a&&a.track)if(e===F.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const o=this.getTrackPublication(F.Source.ScreenShareAudio);o&&o.track&&this.unpublishTrack(o.track)}else yield a.mute();return a})}enableCameraAndMicrophone(){return v(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(F.Source.Camera)||this.pendingPublishing.has(F.Source.Microphone))){this.pendingPublishing.add(F.Source.Camera),this.pendingPublishing.add(F.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(A=>this.publishTrack(A)))}finally{this.pendingPublishing.delete(F.Source.Camera),this.pendingPublishing.delete(F.Source.Microphone)}}})}createTracks(e){return v(this,void 0,void 0,function*(){var A,n;e??(e={});const i=Fd(e,(A=this.roomOptions)===null||A===void 0?void 0:A.audioCaptureDefaults,(n=this.roomOptions)===null||n===void 0?void 0:n.videoCaptureDefaults);try{return(yield gr(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(a=>(xA(a)&&(this.microphoneError=void 0,a.setAudioContext(this.audioContext),a.source=F.Source.Microphone,this.emit(L.AudioStreamAcquired)),Wt(a)&&(this.cameraError=void 0,a.source=F.Source.Camera),a))}catch(r){throw r instanceof Error&&(e.audio&&(this.microphoneError=r),e.video&&(this.cameraError=r)),r}})}createScreenTracks(e){return v(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new sa("getDisplayMedia not supported");e.resolution===void 0&&!Gw()&&(e.resolution=ha.h1080fps30.resolution);const A=nb(e),n=yield navigator.mediaDevices.getDisplayMedia(A),i=n.getVideoTracks();if(i.length===0)throw new IA("no video track found");const r=new fr(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});r.source=F.Source.ScreenShare,e.contentHint&&(r.mediaStreamTrack.contentHint=e.contentHint);const s=[r];if(n.getAudioTracks().length>0){this.emit(L.AudioStreamAcquired);const a=new dr(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});a.source=F.Source.ScreenShareAudio,s.push(a)}return s})}publishTrack(e,A){return v(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,A)})}publishOrRepublishTrack(e,A){return v(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var a,o,c,l;vt(n)&&n.setAudioContext(r.audioContext),yield(a=r.reconnectFuture)===null||a===void 0?void 0:a.promise,r.republishPromise&&!s&&(yield r.republishPromise),jt(n)&&r.pendingPublishPromises.has(n)&&(yield r.pendingPublishPromises.get(n));let u;if(n instanceof MediaStreamTrack)u=n.getConstraints();else{u=n.constraints;let B;switch(n.source){case F.Source.Microphone:B="audioinput";break;case F.Source.Camera:B="videoinput"}B&&r.activeDeviceMap.has(B)&&(u=Object.assign(Object.assign({},u),{deviceId:r.activeDeviceMap.get(B)}))}if(n instanceof MediaStreamTrack)switch(n.kind){case"audio":n=new dr(n,u,!0,r.audioContext,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;case"video":n=new fr(n,u,!0,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;default:throw new IA("unsupported MediaStreamTrack kind ".concat(n.kind))}else n.updateLoggerOptions({loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});let d;if(r.trackPublications.forEach(B=>{B.track&&B.track===n&&(d=B)}),d)return r.log.warn("track has already been published, skipping",Object.assign(Object.assign({},r.logContext),z(d))),d;const h="channelCount"in n.mediaStreamTrack.getSettings()&&n.mediaStreamTrack.getSettings().channelCount===2||n.mediaStreamTrack.getConstraints().channelCount===2,g=(o=i==null?void 0:i.forceStereo)!==null&&o!==void 0?o:h;g&&(i||(i={}),i.dtx===void 0&&r.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},r.logContext),z(n))),i.red===void 0&&r.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(c=i.dtx)!==null&&c!==void 0||(i.dtx=!1),(l=i.red)!==null&&l!==void 0||(i.red=!1));const f=Object.assign(Object.assign({},r.roomOptions.publishDefaults),i);!jw()&&r.roomOptions.e2ee&&(r.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},r.logContext)),f.simulcast=!1),f.source&&(n.source=f.source);const m=new Promise((B,b)=>v(r,void 0,void 0,function*(){try{if(this.engine.client.currentState!==ne.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:z(n)}));const U=()=>v(this,void 0,void 0,function*(){try{const C=yield this.publish(n,f,g);B(C)}catch(C){b(C)}});setTimeout(()=>{this.engine.off(_.SignalConnected,U),b(new oa("publishing rejected as engine not connected within timeout",408))},15e3),this.engine.once(_.SignalConnected,U),this.engine.on(_.Closing,()=>{this.engine.off(_.SignalConnected,U),b(new oa("publishing rejected as engine closed",499))})}else try{const U=yield this.publish(n,f,g);B(U)}catch(U){b(U)}}catch(U){b(U)}}));r.pendingPublishPromises.set(n,m);try{return yield m}catch(B){throw B}finally{r.pendingPublishPromises.delete(n)}}()})}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),z(e))),!1;const{canPublish:A,canPublishSources:n}=this.permissions;return A&&(n.length===0||n.map(i=>ab(i)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),z(e))),!1)}publish(e,A,n){return v(this,void 0,void 0,function*(){var i,r,s,a,o,c,l,u,d,h;if(!this.hasPermissionsToPublish(e))throw new oa("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(w=>jt(e)&&w.source===e.source)&&e.source!==F.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),z(e))),A.stopMicTrackOnMute&&xA(e)&&(e.stopOnMute=!0),e.source===F.Source.ScreenShare&&Gt()&&(A.simulcast=!1),A.videoCodec==="av1"&&!Nw()&&(A.videoCodec=void 0),A.videoCodec==="vp9"&&!Kw()&&(A.videoCodec=void 0),A.videoCodec===void 0&&(A.videoCodec=Pa),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(w=>A.videoCodec===cr(w.mime))||(A.videoCodec=cr(this.enabledPublishVideoCodecs[0].mime)));const f=A.videoCodec;e.on(x.Muted,this.onTrackMuted),e.on(x.Unmuted,this.onTrackUnmuted),e.on(x.Ended,this.handleTrackEnded),e.on(x.UpstreamPaused,this.onTrackUpstreamPaused),e.on(x.UpstreamResumed,this.onTrackUpstreamResumed),e.on(x.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const m=new Gs({cid:e.mediaStreamTrack.id,name:A.name,type:F.kindToProto(e.kind),muted:e.isMuted,source:F.sourceToProto(e.source),disableDtx:!(!((i=A.dtx)!==null&&i!==void 0)||i),encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(!((r=A.red)!==null&&r!==void 0)||r),stream:A==null?void 0:A.stream,backupCodecPolicy:A==null?void 0:A.backupCodecPolicy});let B;if(e.kind===F.Kind.Video){let w={width:0,height:0};try{w=yield e.waitForDimensions()}catch{const E=(a=(s=this.roomOptions.videoCaptureDefaults)===null||s===void 0?void 0:s.resolution)!==null&&a!==void 0?a:Sn.h720.resolution;w={width:E.width,height:E.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),z(e)),{dims:w}))}m.width=w.width,m.height=w.height,et(e)&&(kn(f)&&(e.source===F.Source.ScreenShare&&(A.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),z(e))))),A.scalabilityMode=(o=A.scalabilityMode)!==null&&o!==void 0?o:"L3T3_KEY"),m.simulcastCodecs=[new Vs({codec:f,cid:e.mediaStreamTrack.id})],A.backupCodec===!0&&(A.backupCodec={codec:Pa}),A.backupCodec&&f!==A.backupCodec.codec&&m.encryption===qe.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),m.simulcastCodecs.push(new Vs({codec:A.backupCodec.codec,cid:""})))),B=Oa(e.source===F.Source.ScreenShare,m.width,m.height,A),m.layers=$d(m.width,m.height,B,kn(A.videoCodec))}else e.kind===F.Kind.Audio&&(B=[{maxBitrate:(c=A.audioPreset)===null||c===void 0?void 0:c.maxBitrate,priority:(u=(l=A.audioPreset)===null||l===void 0?void 0:l.priority)!==null&&u!==void 0?u:"high",networkPriority:(h=(d=A.audioPreset)===null||d===void 0?void 0:d.priority)!==null&&h!==void 0?h:"high"}]);if(!this.engine||this.engine.isClosed)throw new ye("cannot publish track when not connected");const b=()=>v(this,void 0,void 0,function*(){var w,y,E;if(!this.engine.pcManager)throw new ye("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,A,B),et(e)&&((w=A.degradationPreference)!==null&&w!==void 0||(A.degradationPreference=Lb(e)),e.setDegradationPreference(A.degradationPreference)),B)if(Gt()&&e.kind===F.Kind.Audio){let S;for(const k of this.engine.pcManager.publisher.getTransceivers())if(k.sender===e.sender){S=k;break}S&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:S,codec:"opus",maxbr:!((y=B[0])===null||y===void 0)&&y.maxBitrate?B[0].maxBitrate/1e3:0})}else e.codec&&kn(e.codec)&&(!((E=B[0])===null||E===void 0)&&E.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:m.cid,codec:e.codec,maxbr:B[0].maxBitrate/1e3});yield this.engine.negotiate()});let U;if(this.enabledPublishVideoCodecs.length>0)U=(yield Promise.all([this.engine.addTrack(m),b()]))[0];else{U=yield this.engine.addTrack(m);let w;if(U.codecs.forEach(y=>{w===void 0&&(w=y.mimeType)}),w&&e.kind===F.Kind.Video){const y=cr(w);y!==f&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),z(e)),{codec:y})),A.videoCodec=y,B=Oa(e.source===F.Source.ScreenShare,m.width,m.height,A))}yield b()}const C=new ja(e.kind,U,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});return C.options=A,e.sid=U.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:B,trackInfo:U})),et(e)?e.startMonitor(this.engine.client):vt(e)&&e.startMonitor(),this.addTrackPublication(C),this.emit(L.LocalTrackPublished,C),C})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,A,n){return v(this,void 0,void 0,function*(){var i;if(this.encryptionType!==qe.NONE)return;let r;if(this.trackPublications.forEach(h=>{h.track&&h.track===e&&(r=h)}),!r)throw new IA("track is not published");if(!et(e))throw new IA("track is not a video track");const s=Object.assign(Object.assign({},(i=this.roomOptions)===null||i===void 0?void 0:i.publishDefaults),n),a=_b(e,A,s);if(!a){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),z(e)));return}const o=e.addSimulcastTrack(A,a);if(!o)return;const c=new Gs({cid:o.mediaStreamTrack.id,type:F.kindToProto(e.kind),muted:e.isMuted,source:F.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:s.videoCodec,cid:o.mediaStreamTrack.id}]});if(c.layers=$d(c.width,c.height,a),!this.engine||this.engine.isClosed)throw new ye("cannot publish track when not connected");const l=()=>v(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,o,s,a),yield this.engine.negotiate()}),d=(yield Promise.all([this.engine.addTrack(c),l()]))[0];this.log.debug("published ".concat(A," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:a,trackInfo:d}))})}unpublishTrack(e,A){return v(this,void 0,void 0,function*(){var n,i;if(jt(e)){const c=this.pendingPublishPromises.get(e);c&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),z(e))),yield c)}const r=this.getPublicationForTrack(e),s=r?z(r):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),s)),!r||!r.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),s));return}e=r.track,e.off(x.Muted,this.onTrackMuted),e.off(x.Unmuted,this.onTrackUnmuted),e.off(x.Ended,this.handleTrackEnded),e.off(x.UpstreamPaused,this.onTrackUpstreamPaused),e.off(x.UpstreamResumed,this.onTrackUpstreamResumed),e.off(x.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),A===void 0&&(A=(i=(n=this.roomOptions)===null||n===void 0?void 0:n.stopLocalTrackOnUnpublish)!==null&&i!==void 0?i:!0),A?e.stop():e.stopMonitor();let a=!1;const o=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<ue.FAILED&&o)try{for(const c of this.engine.pcManager.publisher.getTransceivers())c.sender===o&&(c.direction="inactive",a=!0);if(this.engine.removeTrack(o)&&(a=!0),et(e)){for(const[,c]of e.simulcastCodecs)c.sender&&(this.engine.removeTrack(c.sender)&&(a=!0),c.sender=void 0);e.simulcastCodecs.clear()}}catch(c){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),s),{error:c}))}switch(this.trackPublications.delete(r.trackSid),r.kind){case F.Kind.Audio:this.audioTrackPublications.delete(r.trackSid);break;case F.Kind.Video:this.videoTrackPublications.delete(r.trackSid);break}return this.emit(L.LocalTrackUnpublished,r),r.setTrack(void 0),a&&(yield this.engine.negotiate()),r})}unpublishTracks(e){return v(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>this.unpublishTrack(n)))).filter(n=>!!n)})}republishAllTracks(e){return v(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){n.republishPromise&&(yield n.republishPromise),n.republishPromise=new Promise((r,s)=>v(n,void 0,void 0,function*(){try{const a=[];this.trackPublications.forEach(o=>{o.track&&(A&&(o.options=Object.assign(Object.assign({},o.options),A)),a.push(o))}),yield Promise.all(a.map(o=>v(this,void 0,void 0,function*(){const c=o.track;yield this.unpublishTrack(c,!1),i&&!c.isMuted&&c.source!==F.Source.ScreenShare&&c.source!==F.Source.ScreenShareAudio&&(vt(c)||et(c))&&!c.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:o.trackSid})),yield c.restartTrack()),yield this.publishOrRepublishTrack(c,o.options,!0)}))),r()}catch(a){s(a)}finally{this.republishPromise=void 0}})),yield n.republishPromise}()})}publishData(e){return v(this,arguments,void 0,function(A){var n=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const r=i.reliable?X.RELIABLE:X.LOSSY,s=i.destinationIdentities,a=i.topic,o=new Ne({kind:r,value:{case:"user",value:new nu({participantIdentity:n.identity,payload:A,destinationIdentities:s,topic:a})}});yield n.engine.sendDataPacket(o,r)}()})}publishDtmf(e,A){return v(this,void 0,void 0,function*(){const n=new Ne({kind:X.RELIABLE,value:{case:"sipDtmf",value:new iu({code:e,digit:A})}});yield this.engine.sendDataPacket(n,X.RELIABLE)})}sendChatMessage(e,A){return v(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:A==null?void 0:A.attachments},i=new Ne({value:{case:"chatMessage",value:new Ds(Object.assign(Object.assign({},n),{timestamp:re.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(i,X.RELIABLE),this.emit(L.ChatMessage,n),n})}editChatMessage(e,A){return v(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},A),{message:e,editTimestamp:Date.now()}),i=new Ne({value:{case:"chatMessage",value:new Ds(Object.assign(Object.assign({},n),{timestamp:re.parse(n.timestamp),editTimestamp:re.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,X.RELIABLE),this.emit(L.ChatMessage,n),n})}sendText(e,A){return v(this,void 0,void 0,function*(){var n;const i=crypto.randomUUID(),s=new TextEncoder().encode(e).byteLength,a=(n=A==null?void 0:A.attachments)===null||n===void 0?void 0:n.map(()=>crypto.randomUUID()),o=new Array(a?a.length+1:1).fill(0),c=(u,d)=>{var h;o[d]=u;const g=o.reduce((f,m)=>f+m,0);(h=A==null?void 0:A.onProgress)===null||h===void 0||h.call(A,g)},l=yield this.streamText({streamId:i,totalSize:s,destinationIdentities:A==null?void 0:A.destinationIdentities,topic:A==null?void 0:A.topic,attachedStreamIds:a,attributes:A==null?void 0:A.attributes});return yield l.write(e),c(1,0),yield l.close(),A!=null&&A.attachments&&a&&(yield Promise.all(A.attachments.map((u,d)=>v(this,void 0,void 0,function*(){return this._sendFile(a[d],u,{topic:A.topic,mimeType:u.type,onProgress:h=>{c(h,d+1)}})})))),l.info})}streamText(e){return v(this,void 0,void 0,function*(){var A,n;const i=(A=e==null?void 0:e.streamId)!==null&&A!==void 0?A:crypto.randomUUID(),r={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:(n=e==null?void 0:e.topic)!==null&&n!==void 0?n:"",size:e==null?void 0:e.totalSize,attributes:e==null?void 0:e.attributes},s=new Os({streamId:i,mimeType:r.mimeType,topic:r.topic,timestamp:Bt(r.timestamp),totalLength:Bt(e==null?void 0:e.totalSize),attributes:r.attributes,contentHeader:{case:"textHeader",value:new gu({version:e==null?void 0:e.version,attachedStreamIds:e==null?void 0:e.attachedStreamIds,replyToStreamId:e==null?void 0:e.replyToStreamId,operationType:(e==null?void 0:e.type)==="update"?Hs.UPDATE:Hs.CREATE})}}),a=e==null?void 0:e.destinationIdentities,o=new Ne({destinationIdentities:a,value:{case:"streamHeader",value:s}});yield this.engine.sendDataPacket(o,X.RELIABLE);let c=0;const l=this,u=new WritableStream({write(g){return v(this,void 0,void 0,function*(){for(const f of Ab(g,sh)){yield l.engine.waitForBufferStatusLow(X.RELIABLE);const m=new Ms({content:f,streamId:i,chunkIndex:Bt(c)}),B=new Ne({destinationIdentities:a,value:{case:"streamChunk",value:m}});yield l.engine.sendDataPacket(B,X.RELIABLE),c+=1}})},close(){return v(this,void 0,void 0,function*(){const g=new Ns({streamId:i}),f=new Ne({destinationIdentities:a,value:{case:"streamTrailer",value:g}});yield l.engine.sendDataPacket(f,X.RELIABLE)})},abort(g){console.log("Sink error:",g)}});let d=()=>v(this,void 0,void 0,function*(){yield h.close()});l.engine.once(_.Closing,d);const h=new jb(u,r,()=>this.engine.off(_.Closing,d));return h})}sendFile(e,A){return v(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,A),{id:n}})}_sendFile(e,A,n){return v(this,void 0,void 0,function*(){var i;const r=yield this.streamBytes({streamId:e,totalSize:A.size,name:A.name,mimeType:(i=n==null?void 0:n.mimeType)!==null&&i!==void 0?i:A.type,topic:n==null?void 0:n.topic,destinationIdentities:n==null?void 0:n.destinationIdentities}),s=A.stream().getReader();for(;;){const{done:a,value:o}=yield s.read();if(a)break;yield r.write(o)}return yield r.close(),r.info})}streamBytes(e){return v(this,void 0,void 0,function*(){var A,n,i,r,s;const a=(A=e==null?void 0:e.streamId)!==null&&A!==void 0?A:crypto.randomUUID(),o=e==null?void 0:e.destinationIdentities,c={id:a,mimeType:(n=e==null?void 0:e.mimeType)!==null&&n!==void 0?n:"application/octet-stream",topic:(i=e==null?void 0:e.topic)!==null&&i!==void 0?i:"",timestamp:Date.now(),attributes:e==null?void 0:e.attributes,size:e==null?void 0:e.totalSize,name:(r=e==null?void 0:e.name)!==null&&r!==void 0?r:"unknown"},l=new Os({totalLength:Bt((s=c.size)!==null&&s!==void 0?s:0),mimeType:c.mimeType,streamId:a,topic:c.topic,timestamp:Bt(Date.now()),attributes:c.attributes,contentHeader:{case:"byteHeader",value:new pu({name:c.name})}}),u=new Ne({destinationIdentities:o,value:{case:"streamHeader",value:l}});yield this.engine.sendDataPacket(u,X.RELIABLE);let d=0;const h=new Oe,g=this.engine,f=this.log,m=new WritableStream({write(b){return v(this,void 0,void 0,function*(){const U=yield h.lock();let C=0;try{for(;C<b.byteLength;){const w=b.slice(C,C+sh);yield g.waitForBufferStatusLow(X.RELIABLE);const y=new Ne({destinationIdentities:o,value:{case:"streamChunk",value:new Ms({content:w,streamId:a,chunkIndex:Bt(d)})}});yield g.sendDataPacket(y,X.RELIABLE),d+=1,C+=w.byteLength}}finally{U()}})},close(){return v(this,void 0,void 0,function*(){const b=new Ns({streamId:a}),U=new Ne({destinationIdentities:o,value:{case:"streamTrailer",value:b}});yield g.sendDataPacket(U,X.RELIABLE)})},abort(b){f.error("Sink error:",b)}});return new Wb(m,c)})}performRpc(e){return v(this,arguments,void 0,function(A){var n=this;let{destinationIdentity:i,method:r,payload:s,responseTimeout:a=1e4}=A;return function*(){return new Promise((c,l)=>v(n,void 0,void 0,function*(){var u,d,h,g;if(La(s)>Wd){l(de.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((d=(u=this.engine.latestJoinResponse)===null||u===void 0?void 0:u.serverInfo)===null||d===void 0)&&d.version&&mt((g=(h=this.engine.latestJoinResponse)===null||h===void 0?void 0:h.serverInfo)===null||g===void 0?void 0:g.version,"1.8.0")<0){l(de.builtIn("UNSUPPORTED_SERVER"));return}const f=crypto.randomUUID();yield this.publishRpcRequest(i,f,r,s,a-2e3);const m=setTimeout(()=>{this.pendingAcks.delete(f),l(de.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(f),clearTimeout(B)},2e3);this.pendingAcks.set(f,{resolve:()=>{clearTimeout(m)},participantIdentity:i});const B=setTimeout(()=>{this.pendingResponses.delete(f),l(de.builtIn("RESPONSE_TIMEOUT"))},a);this.pendingResponses.set(f,{resolve:(b,U)=>{clearTimeout(B),this.pendingAcks.has(f)&&(console.warn("RPC response received before ack",f),this.pendingAcks.delete(f),clearTimeout(m)),U?l(U):c(b??"")},participantIdentity:i})}))}()})}registerRpcMethod(e,A){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,A)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=A,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const A=this.pendingAcks.get(e);A?(A.resolve(),this.pendingAcks.delete(e)):console.error("Ack received for unexpected RPC request",e)}handleIncomingRpcResponse(e,A,n){const i=this.pendingResponses.get(e);i?(i.resolve(A,n),this.pendingResponses.delete(e)):console.error("Response received for unexpected RPC request",e)}publishRpcRequest(e,A,n,i,r){return v(this,void 0,void 0,function*(){const s=new Ne({destinationIdentities:[e],kind:X.RELIABLE,value:{case:"rpcRequest",value:new ru({id:A,method:n,payload:i,responseTimeoutMs:r,version:1})}});yield this.engine.sendDataPacket(s,X.RELIABLE)})}handleParticipantDisconnected(e){for(const[A,{participantIdentity:n}]of this.pendingAcks)n===e&&this.pendingAcks.delete(A);for(const[A,{participantIdentity:n,resolve:i}]of this.pendingResponses)n===e&&(i(null,de.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(A))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(A=>A.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(A=>{var n,i;const r=this.trackPublications.get(A.sid);if(r){const s=r.isMuted||((i=(n=r.track)===null||n===void 0?void 0:n.isUpstreamPaused)!==null&&i!==void 0?i:!1);s!==A.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),z(r)),{mutedOnServer:s})),this.engine.client.sendMuteTrack(A.sid,s))}}),!0):!1}getPublicationForTrack(e){let A;return this.trackPublications.forEach(n=>{const i=n.track;i&&(e instanceof MediaStreamTrack?(vt(i)||et(i))&&i.mediaStreamTrack===e&&(A=n):e===i&&(A=n))}),A}waitForPendingPublicationOfSource(e){return v(this,void 0,void 0,function*(){const n=Date.now();for(;Date.now()<n+1e4;){const i=Array.from(this.pendingPublishPromises.entries()).find(r=>{let[s]=r;return s.source===e});if(i)return i[1];yield Ke(20)}})}}class Ay extends _A{constructor(e,A,n,i){super(e,A.sid,A.name,i),this.track=void 0,this.allowed=!0,this.disabled=!1,this.currentVideoQuality=AA.HIGH,this.handleEnded=r=>{this.setTrack(void 0),this.emit(x.Ended,r)},this.handleVisibilityChange=r=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(r),this.logContext),this.disabled=!r,this.emitTrackUpdate()},this.handleVideoDimensionsChange=r=>{this.log.debug("adaptivestream video dimensions ".concat(r.width,"x").concat(r.height),this.logContext),this.videoDimensions=r,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(A)}setSubscribed(e){const A=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new Xi({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new cu({participantSid:"",trackSids:[this.trackSid]})]});this.emit(x.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(A),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?_A.SubscriptionStatus.Unsubscribed:super.isSubscribed?_A.SubscriptionStatus.Subscribed:_A.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?_A.PermissionStatus.Allowed:_A.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return!this.disabled}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.disabled===!e||(this.disabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.currentVideoQuality===e||(this.currentVideoQuality=e,this.videoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var A,n;this.isManualOperationAllowed()&&(((A=this.videoDimensions)===null||A===void 0?void 0:A.width)===e.width&&((n=this.videoDimensions)===null||n===void 0?void 0:n.height)===e.height||(Ua(this.track)&&(this.videoDimensions=e),this.currentVideoQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&Ua(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){return this.currentVideoQuality}setTrack(e){const A=this.subscriptionStatus,n=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off(x.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(x.VisibilityChanged,this.handleVisibilityChange),i.off(x.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(x.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(x.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(x.VisibilityChanged,this.handleVisibilityChange),e.on(x.Ended,this.handleEnded),this.emit(x.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(A))}setAllowed(e){const A=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(A)}setSubscriptionError(e){this.emit(x.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const A=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):A!==e.muted&&this.emit(e.muted?x.Muted:x.Unmuted)}emitSubscriptionUpdateIfChanged(e){const A=this.subscriptionStatus;e!==A&&this.emit(x.SubscriptionStatusChanged,A,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(x.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.kind===F.Kind.Video&&this.isAdaptiveStream?(this.log.warn("adaptive stream is enabled, cannot change video track settings",this.logContext),!1):this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return Ua(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new Bu({trackSids:[this.trackSid],disabled:this.disabled,fps:this.fps});this.videoDimensions?(e.width=Math.ceil(this.videoDimensions.width),e.height=Math.ceil(this.videoDimensions.height)):this.currentVideoQuality!==void 0?e.quality=this.currentVideoQuality:e.quality=AA.HIGH,this.emit(x.UpdateSettings,e)}}class pr extends rh{static fromParticipantInfo(e,A,n){return new pr(e,A.sid,A.identity,A.name,A.metadata,A.attributes,n,A.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,A,n,i,r,s,a){let o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:Ji.STANDARD;super(A,n||"",i,r,s,a,o),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(x.UpdateSettings,A=>{this.log.debug("send update settings",Object.assign(Object.assign({},this.logContext),z(e))),this.signalClient.sendUpdateTrackSettings(A)}),e.on(x.UpdateSubscription,A=>{A.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(A)}),e.on(x.SubscriptionPermissionChanged,A=>{this.emit(L.TrackSubscriptionPermissionChanged,e,A)}),e.on(x.SubscriptionStatusChanged,A=>{this.emit(L.TrackSubscriptionStatusChanged,e,A)}),e.on(x.Subscribed,A=>{this.emit(L.TrackSubscribed,A,e)}),e.on(x.Unsubscribed,A=>{this.emit(L.TrackUnsubscribed,A,e)}),e.on(x.SubscriptionFailed,A=>{this.emit(L.TrackSubscriptionFailed,e.trackSid,A)})}getTrackPublication(e){const A=super.getTrackPublication(e);if(A)return A}getTrackPublicationByName(e){const A=super.getTrackPublicationByName(e);if(A)return A}setVolume(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:F.Source.Microphone;this.volumeMap.set(A,e);const n=this.getTrackPublication(A);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F.Source.Microphone;const A=this.getTrackPublication(e);return A&&A.track?A.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,A,n,i,r,s){let a=this.getTrackPublicationBySid(A);if(a||A.startsWith("TR")||this.trackPublications.forEach(l=>{!a&&e.kind===l.kind.toString()&&(a=l)}),!a){if(s===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:A})),this.emit(L.TrackSubscriptionFailed,A);return}s===void 0&&(s=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,A,n,i,r,s-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),z(a))),this.emit(L.TrackSubscriptionFailed,A);return}const o=e.kind==="video";let c;return o?c=new Xb(e,A,i,r):c=new Jb(e,A,i,this.audioContext,this.audioOutput),c.source=a.source,c.isMuted=a.isMuted,c.setMediaStream(n),c.start(),a.setTrack(c),this.volumeMap.has(a.source)&&ya(c)&&xA(c)&&c.setVolume(this.volumeMap.get(a.source)),a}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const A=new Map,n=new Map;return e.tracks.forEach(i=>{var r,s;let a=this.getTrackPublicationBySid(i.sid);if(a)a.updateInfo(i);else{const o=F.kindFromProto(i.type);if(!o)return;a=new Ay(o,i,(r=this.signalClient.connectOptions)===null||r===void 0?void 0:r.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(s=this.loggerOptions)===null||s===void 0?void 0:s.loggerName}),a.updateInfo(i),n.set(i.sid,a);const c=Array.from(this.trackPublications.values()).find(l=>l.source===(a==null?void 0:a.source));c&&a.source!==F.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(a.source),Object.assign(Object.assign({},this.logContext),{oldTrack:z(c),newTrack:z(a)})),this.addTrackPublication(a)}A.set(i.sid,a)}),this.trackPublications.forEach(i=>{A.has(i.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),z(i))),this.unpublishTrack(i.trackSid,!0))}),n.forEach(i=>{this.emit(L.TrackPublished,i)}),!0}unpublishTrack(e,A){const n=this.trackPublications.get(e);if(!n)return;const{track:i}=n;switch(i&&(i.stop(),n.setTrack(void 0)),this.trackPublications.delete(e),n.kind){case F.Kind.Audio:this.audioTrackPublications.delete(e);break;case F.Kind.Video:this.videoTrackPublications.delete(e);break}A&&this.emit(L.TrackUnpublished,n)}setAudioOutput(e){return v(this,void 0,void 0,function*(){this.audioOutput=e;const A=[];this.audioTrackPublications.forEach(n=>{var i;xA(n.track)&&ya(n.track)&&A.push(n.track.setSinkId((i=e.deviceId)!==null&&i!==void 0?i:"default"))}),yield Promise.all(A)})}emit(e){for(var A=arguments.length,n=new Array(A>1?A-1:0),i=1;i<A;i++)n[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:n})),super.emit(e,...n)}}var q;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(q||(q={}));const ty=4*1e3;class qt extends yA.EventEmitter{constructor(e){var A,n,i,r;if(super(),A=this,this.state=q.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=W,this.bufferedEvents=[],this.isResuming=!1,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map,this.rpcHandlers=new Map,this.connect=(s,a,o)=>v(this,void 0,void 0,function*(){var c;if(!Vw())throw UA()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const l=yield this.disconnectLock.lock();if(this.state===q.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),l(),Promise.resolve();if(this.connectFuture)return l(),this.connectFuture.promise;this.setAndEmitConnectionState(q.Connecting),((c=this.regionUrlProvider)===null||c===void 0?void 0:c.getServerUrl().toString())!==s&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),ma(new URL(s))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Ka(s,a):this.regionUrlProvider.updateToken(a),this.regionUrlProvider.fetchRegionSettings().then(h=>{var g;(g=this.regionUrlProvider)===null||g===void 0||g.setServerReportedRegions(h)}).catch(h=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:h}))}));const u=(h,g,f)=>v(this,void 0,void 0,function*(){var m,B;this.abortController&&this.abortController.abort();const b=new AbortController;this.abortController=b,l==null||l();try{yield this.attemptConnection(f??s,a,o,b),this.abortController=void 0,h()}catch(U){if(this.regionUrlProvider&&U instanceof Ae&&U.reason!==J.Cancelled&&U.reason!==J.NotAllowed){let C=null;try{C=yield this.regionUrlProvider.getNextBestRegionUrl((m=this.abortController)===null||m===void 0?void 0:m.signal)}catch(w){if(w instanceof Ae&&(w.status===401||w.reason===J.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),g(w);return}}C&&!(!((B=this.abortController)===null||B===void 0)&&B.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(U.message,". Retrying with another region: ").concat(C),this.logContext),this.recreateEngine(),yield u(h,g,C)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Td(U)),g(U))}else{let C=aA.UNKNOWN_REASON;U instanceof Ae&&(C=Td(U)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,C),g(U)}}}),d=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new wa((h,g)=>{u(h,g,d)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(s,a,o,c,l,u)=>v(this,void 0,void 0,function*(){var d,h,g;const f=yield o.join(s,a,{autoSubscribe:c.autoSubscribe,adaptiveStream:typeof l.adaptiveStream=="object"?!0:l.adaptiveStream,maxRetries:c.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:c.websocketTimeout},u.signal);let m=f.serverInfo;if(m||(m={version:f.serverVersion,region:f.serverRegion}),this.serverInfo=m,this.log.debug("connected to Livekit Server ".concat(Object.entries(m).map(B=>{let[b,U]=B;return"".concat(b,": ").concat(U)}).join(", ")),{room:(d=f.room)===null||d===void 0?void 0:d.name,roomSid:(h=f.room)===null||h===void 0?void 0:h.sid,identity:(g=f.participant)===null||g===void 0?void 0:g.identity}),!m.version)throw new kw("unknown server version");return m.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),l.dynacast=!1),f}),this.applyJoinResponse=s=>{const a=s.participant;if(this.localParticipant.sid=a.sid,this.localParticipant.identity=a.identity,this.localParticipant.setEnabledPublishCodecs(s.enabledPublishCodecs),this.options.e2ee&&this.e2eeManager)try{this.e2eeManager.setSifTrailer(s.sifTrailer)}catch(o){this.log.error(o instanceof Error?o.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:o}))}this.handleParticipantUpdates([a,...s.otherParticipants]),s.room&&this.handleRoomUpdate(s.room)},this.attemptConnection=(s,a,o,c)=>v(this,void 0,void 0,function*(){var l,u;this.state===q.Reconnecting||this.isResuming||!((l=this.engine)===null||l===void 0)&&l.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((u=this.regionUrlProvider)===null||u===void 0)&&u.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Ra),o),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const d=yield this.connectSignal(s,a,this.engine,this.connOptions,this.options,c);this.applyJoinResponse(d),this.setupLocalParticipantEvents(),this.emit(I.SignalConnected)}catch(d){yield this.engine.close(),this.recreateEngine();const h=new Ae("could not establish signal connection",J.ServerUnreachable);throw d instanceof Error&&(h.message="".concat(h.message,": ").concat(d.message)),d instanceof Ae&&(h.reason=d.reason,h.status=d.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:d})),h}if(c.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Ae("Connection attempt aborted",J.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,c)}catch(d){throw yield this.engine.close(),this.recreateEngine(),d}Ve()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Ve()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(q.Connected),this.emit(I.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var s=arguments.length,a=new Array(s),o=0;o<s;o++)a[o]=arguments[o];return v(A,[...a],void 0,function(){var c=this;let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var u,d,h,g;const f=yield c.disconnectLock.lock();try{if(c.state===q.Disconnected){c.log.debug("already disconnected",c.logContext);return}c.log.info("disconnect from room",Object.assign({},c.logContext)),(c.state===q.Connecting||c.state===q.Reconnecting||c.isResuming)&&(c.log.warn("abort connection attempt",c.logContext),(u=c.abortController)===null||u===void 0||u.abort(),(h=(d=c.connectFuture)===null||d===void 0?void 0:d.reject)===null||h===void 0||h.call(d,new Ae("Client initiated disconnect",J.Cancelled)),c.connectFuture=void 0),!((g=c.engine)===null||g===void 0)&&g.client.isDisconnected||(yield c.engine.client.sendLeave()),c.engine&&(yield c.engine.close()),c.handleDisconnect(l,aA.CLIENT_INITIATED),c.engine=void 0}finally{f()}}()})},this.onPageLeave=()=>v(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>v(this,void 0,void 0,function*(){const s=[],a=uA();if(a&&a.os==="iOS"){const o="livekit-dummy-audio-el";let c=document.getElementById(o);if(!c){c=document.createElement("audio"),c.id=o,c.autoplay=!0,c.hidden=!0;const l=Ca();l.enabled=!0;const u=new MediaStream([l]);c.srcObject=u,document.addEventListener("visibilitychange",()=>{c&&(c.srcObject=document.hidden?null:u,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(c),this.once(I.Disconnected,()=>{c==null||c.remove(),c=null})}s.push(c)}this.remoteParticipants.forEach(o=>{o.audioTrackPublications.forEach(c=>{c.track&&c.track.attachedElements.forEach(l=>{s.push(l)})})});try{yield Promise.all([this.acquireAudioContext(),...s.map(o=>(o.muted=!1,o.play()))]),this.handleAudioPlaybackStarted()}catch(o){throw this.handleAudioPlaybackFailed(o),o}}),this.startVideo=()=>v(this,void 0,void 0,function*(){const s=[];for(const a of this.remoteParticipants.values())a.videoTrackPublications.forEach(o=>{var c;(c=o.track)===null||c===void 0||c.attachedElements.forEach(l=>{s.includes(l)||s.push(l)})});yield Promise.all(s.map(a=>a.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(a=>{a.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const s of this.remoteParticipants.values())this.handleParticipantDisconnected(s.identity,s);this.setAndEmitConnectionState(q.Reconnecting)&&this.emit(I.Reconnecting)},this.handleSignalRestarted=s=>v(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(s.serverRegion),Object.assign(Object.assign({},this.logContext),{region:s.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(s);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(a){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:a}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:s.serverRegion}))}catch{return}this.setAndEmitConnectionState(q.Connected),this.emit(I.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=s=>{s.forEach(a=>{var o;if(a.identity===this.localParticipant.identity){this.localParticipant.updateInfo(a);return}a.identity===""&&(a.identity=(o=this.sidToIdentity.get(a.sid))!==null&&o!==void 0?o:"");let c=this.remoteParticipants.get(a.identity);a.state===Ht.DISCONNECTED?this.handleParticipantDisconnected(a.identity,c):c=this.getOrCreateParticipant(a.identity,a)})},this.handleActiveSpeakersUpdate=s=>{const a=[],o={};s.forEach(c=>{if(o[c.sid]=!0,c.sid===this.localParticipant.sid)this.localParticipant.audioLevel=c.level,this.localParticipant.setIsSpeaking(!0),a.push(this.localParticipant);else{const l=this.getRemoteParticipantBySid(c.sid);l&&(l.audioLevel=c.level,l.setIsSpeaking(!0),a.push(l))}}),o[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(c=>{o[c.sid]||(c.audioLevel=0,c.setIsSpeaking(!1))}),this.activeSpeakers=a,this.emitWhenConnected(I.ActiveSpeakersChanged,a)},this.handleSpeakersChanged=s=>{const a=new Map;this.activeSpeakers.forEach(c=>{const l=this.remoteParticipants.get(c.identity);l&&l.sid!==c.sid||a.set(c.sid,c)}),s.forEach(c=>{let l=this.getRemoteParticipantBySid(c.sid);c.sid===this.localParticipant.sid&&(l=this.localParticipant),l&&(l.audioLevel=c.level,l.setIsSpeaking(c.active),c.active?a.set(c.sid,l):a.delete(c.sid))});const o=Array.from(a.values());o.sort((c,l)=>l.audioLevel-c.audioLevel),this.activeSpeakers=o,this.emitWhenConnected(I.ActiveSpeakersChanged,o)},this.handleStreamStateUpdate=s=>{s.streamStates.forEach(a=>{const o=this.getRemoteParticipantBySid(a.participantSid);if(!o)return;const c=o.getTrackPublicationBySid(a.trackSid);if(!c||!c.track)return;const l=F.streamStateFromProto(a.state);l!==c.track.streamState&&(c.track.streamState=l,o.emit(L.TrackStreamStateChanged,c,c.track.streamState),this.emitWhenConnected(I.TrackStreamStateChanged,c,c.track.streamState,o))})},this.handleSubscriptionPermissionUpdate=s=>{const a=this.getRemoteParticipantBySid(s.participantSid);if(!a)return;const o=a.getTrackPublicationBySid(s.trackSid);o&&o.setAllowed(s.allowed)},this.handleSubscriptionError=s=>{const a=Array.from(this.remoteParticipants.values()).find(c=>c.trackPublications.has(s.trackSid));if(!a)return;const o=a.getTrackPublicationBySid(s.trackSid);o&&o.setSubscriptionError(s.err)},this.handleDataPacket=s=>{const a=this.remoteParticipants.get(s.participantIdentity);if(s.value.case==="user")this.handleUserPacket(a,s.value.value,s.kind);else if(s.value.case==="transcription")this.handleTranscription(a,s.value.value);else if(s.value.case==="sipDtmf")this.handleSipDtmf(a,s.value.value);else if(s.value.case==="chatMessage")this.handleChatMessage(a,s.value.value);else if(s.value.case==="metrics")this.handleMetrics(s.value.value,a);else if(s.value.case==="streamHeader")this.handleStreamHeader(s.value.value,s.participantIdentity);else if(s.value.case==="streamChunk")this.handleStreamChunk(s.value.value);else if(s.value.case==="streamTrailer")this.handleStreamTrailer(s.value.value);else if(s.value.case==="rpcRequest"){const o=s.value.value;this.handleIncomingRpcRequest(s.participantIdentity,o.id,o.method,o.payload,o.responseTimeoutMs,o.version)}},this.handleUserPacket=(s,a,o)=>{this.emit(I.DataReceived,a.payload,s,o,a.topic),s==null||s.emit(L.DataReceived,a.payload,o)},this.handleSipDtmf=(s,a)=>{this.emit(I.SipDTMFReceived,a,s),s==null||s.emit(L.SipDTMFReceived,a)},this.bufferedSegments=new Map,this.handleTranscription=(s,a)=>{const o=a.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(a.transcribedParticipantIdentity),c=o==null?void 0:o.trackPublications.get(a.trackId),l=zw(a,this.transcriptionReceivedTimes);c==null||c.emit(x.TranscriptionReceived,l),o==null||o.emit(L.TranscriptionReceived,l,c),this.emit(I.TranscriptionReceived,l,o,c)},this.handleChatMessage=(s,a)=>{const o=Zw(a);this.emit(I.ChatMessage,o,s)},this.handleMetrics=(s,a)=>{this.emit(I.MetricsReceived,s,a)},this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(I.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=s=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:s})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(I.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(I.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(I.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>v(this,void 0,void 0,function*(){var s,a,o;const c=Qe.getInstance().previousDevices,l=yield Qe.getInstance().getDevices(void 0,!1),u=uA();if((u==null?void 0:u.name)==="Chrome"&&u.os!=="iOS")for(let h of l){const g=c.find(f=>f.deviceId===h.deviceId);g&&g.label!==""&&g.kind===h.kind&&g.label!==h.label&&this.getActiveDevice(h.kind)==="default"&&this.emit(I.ActiveDeviceChanged,h.kind,h.deviceId)}const d=["audiooutput","audioinput","videoinput"];for(let h of d){const g=tb(h),f=this.localParticipant.getTrackPublication(g);if(f&&(!((s=f.track)===null||s===void 0)&&s.isUserProvided))continue;const m=l.filter(b=>b.kind===h),B=this.getActiveDevice(h);if(B===((a=c.filter(b=>b.kind===h)[0])===null||a===void 0?void 0:a.deviceId)&&m.length>0&&((o=m[0])===null||o===void 0?void 0:o.deviceId)!==B){yield this.switchActiveDevice(h,m[0].deviceId);continue}h==="audioinput"&&!ZA()||h==="videoinput"||m.length>0&&!m.find(b=>b.deviceId===this.getActiveDevice(h))&&(yield this.switchActiveDevice(h,m[0].deviceId))}this.emit(I.MediaDevicesChanged)}),this.handleRoomUpdate=s=>{const a=this.roomInfo;this.roomInfo=s,a&&a.metadata!==s.metadata&&this.emitWhenConnected(I.RoomMetadataChanged,s.metadata),(a==null?void 0:a.activeRecording)!==s.activeRecording&&this.emitWhenConnected(I.RecordingStatusChanged,s.activeRecording)},this.handleConnectionQualityUpdate=s=>{s.updates.forEach(a=>{if(a.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(a.quality);return}const o=this.getRemoteParticipantBySid(a.participantSid);o&&o.setConnectionQuality(a.quality)})},this.onLocalParticipantMetadataChanged=s=>{this.emit(I.ParticipantMetadataChanged,s,this.localParticipant)},this.onLocalParticipantNameChanged=s=>{this.emit(I.ParticipantNameChanged,s,this.localParticipant)},this.onLocalAttributesChanged=s=>{this.emit(I.ParticipantAttributesChanged,s,this.localParticipant)},this.onLocalTrackMuted=s=>{this.emit(I.TrackMuted,s,this.localParticipant)},this.onLocalTrackUnmuted=s=>{this.emit(I.TrackUnmuted,s,this.localParticipant)},this.onTrackProcessorUpdate=s=>{var a;(a=s==null?void 0:s.onPublish)===null||a===void 0||a.call(s,this)},this.onLocalTrackPublished=s=>v(this,void 0,void 0,function*(){var a,o,c,l,u,d;(a=s.track)===null||a===void 0||a.on(x.TrackProcessorUpdate,this.onTrackProcessorUpdate),(o=s.track)===null||o===void 0||o.on(x.Restarted,this.onLocalTrackRestarted),(u=(l=(c=s.track)===null||c===void 0?void 0:c.getProcessor())===null||l===void 0?void 0:l.onPublish)===null||u===void 0||u.call(l,this),this.emit(I.LocalTrackPublished,s,this.localParticipant),vt(s.track)&&(yield s.track.checkForSilence())&&this.emit(I.LocalAudioSilenceDetected,s);const h=yield(d=s.track)===null||d===void 0?void 0:d.getDeviceId(!1),g=_d(s.source);g&&h&&h!==this.localParticipant.activeDeviceMap.get(g)&&(this.localParticipant.activeDeviceMap.set(g,h),this.emit(I.ActiveDeviceChanged,g,h))}),this.onLocalTrackUnpublished=s=>{var a,o;(a=s.track)===null||a===void 0||a.off(x.TrackProcessorUpdate,this.onTrackProcessorUpdate),(o=s.track)===null||o===void 0||o.off(x.Restarted,this.onLocalTrackRestarted),this.emit(I.LocalTrackUnpublished,s,this.localParticipant)},this.onLocalTrackRestarted=s=>v(this,void 0,void 0,function*(){const a=yield s.getDeviceId(!1),o=_d(s.source);o&&a&&a!==this.localParticipant.activeDeviceMap.get(o)&&(this.log.debug("local track restarted, setting ".concat(o," ").concat(a," active"),this.logContext),this.localParticipant.activeDeviceMap.set(o,a),this.emit(I.ActiveDeviceChanged,o,a))}),this.onLocalConnectionQualityChanged=s=>{this.emit(I.ConnectionQualityChanged,s,this.localParticipant)},this.onMediaDevicesError=s=>{this.emit(I.MediaDevicesError,s)},this.onLocalParticipantPermissionsChanged=s=>{this.emit(I.ParticipantPermissionsChanged,s,this.localParticipant)},this.onLocalChatMessageSent=s=>{this.emit(I.ChatMessage,s,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},yb),e),this.log=FA((n=this.options.loggerName)!==null&&n!==void 0?n:lA.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Gd),e==null?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},jd),e==null?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},bb),e==null?void 0:e.publishDefaults),this.maybeCreateEngine(),this.disconnectLock=new Oe,this.localParticipant=new ey("","",this.engine,this.options,this.rpcHandlers),this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",$A(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",$A(this.options.audioCaptureDefaults.deviceId)),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&this.switchActiveDevice("audiooutput",$A(this.options.audioOutput.deviceId)).catch(s=>this.log.warn("Could not set audio output: ".concat(s.message),this.logContext)),this.options.e2ee&&this.setupE2EE(),Ve()){const s=new AbortController;(r=navigator.mediaDevices)===null||r===void 0||r.addEventListener("devicechange",this.handleDeviceChange,{signal:s.signal}),qt.cleanupRegistry&&qt.cleanupRegistry.register(this,()=>{s.abort()})}}registerTextStreamHandler(e,A){if(this.textStreamHandlers.has(e))throw new TypeError('A text stream handler for topic "'.concat(e,'" has already been set.'));this.textStreamHandlers.set(e,A)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,A){if(this.byteStreamHandlers.has(e))throw new TypeError('A byte stream handler for topic "'.concat(e,'" has already been set.'));this.byteStreamHandlers.set(e,A)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}registerRpcMethod(e,A){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,A)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}handleIncomingRpcRequest(e,A,n,i,r,s){return v(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,A),s!==1){yield this.engine.publishRpcResponse(e,A,null,de.builtIn("UNSUPPORTED_VERSION"));return}const a=this.rpcHandlers.get(n);if(!a){yield this.engine.publishRpcResponse(e,A,null,de.builtIn("UNSUPPORTED_METHOD"));return}let o=null,c=null;try{const l=yield a({requestId:A,callerIdentity:e,payload:i,responseTimeout:r});La(l)>Wd?(o=de.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),console.warn("RPC Response payload too large for ".concat(n))):c=l}catch(l){l instanceof de?o=l:(console.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),l),o=de.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,A,c,o)})}setE2EEEnabled(e){return v(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;this.options.e2ee&&("e2eeManager"in this.options.e2ee?this.e2eeManager=this.options.e2ee.e2eeManager:this.e2eeManager=new ob(this.options.e2ee),this.e2eeManager.on(YA.ParticipantEncryptionStatusChanged,(A,n)=>{eb(n)&&(this.isE2EEEnabled=A),this.emit(I.ParticipantEncryptionStatusChanged,A,n)}),this.e2eeManager.on(YA.EncryptionError,A=>this.emit(I.EncryptionError,A)),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&A!==void 0?A:!1}getSid(){return v(this,void 0,void 0,function*(){return this.state===q.Disconnected?"":this.roomInfo&&this.roomInfo.sid!==""?this.roomInfo.sid:new Promise((e,A)=>{const n=i=>{i.sid!==""&&(this.engine.off(_.RoomUpdate,n),e(i.sid))};this.engine.on(_.RoomUpdate,n),this.once(I.Disconnected,()=>{this.engine.off(_.RoomUpdate,n),A("Room disconnected before room server id was available")})})})}get name(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&A!==void 0?A:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&A!==void 0?A:0}get numPublishers(){var e,A;return(A=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&A!==void 0?A:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Ob(this.options),this.engine.on(_.ParticipantUpdate,this.handleParticipantUpdates).on(_.RoomUpdate,this.handleRoomUpdate).on(_.SpeakersChanged,this.handleSpeakersChanged).on(_.StreamStateChanged,this.handleStreamStateUpdate).on(_.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(_.SubscriptionError,this.handleSubscriptionError).on(_.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(_.MediaTrackAdded,(e,A,n)=>{this.onTrackAdded(e,A,n)}).on(_.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(_.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(_.DataPacketReceived,this.handleDataPacket).on(_.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(q.SignalReconnecting)&&this.emit(I.SignalReconnecting)}).on(_.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(q.Connected)&&this.emit(I.Reconnected)}).on(_.SignalResumed,()=>{this.bufferedEvents=[],(this.state===q.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(_.Restarting,this.handleRestarting).on(_.SignalRestarted,this.handleSignalRestarted).on(_.Offline,()=>{this.setAndEmitConnectionState(q.Reconnecting)&&this.emit(I.Reconnecting)}).on(_.DCBufferStatusChanged,(e,A)=>{this.emit(I.DCBufferStatusChanged,e,A)}).on(_.LocalTrackSubscribed,e=>{const A=this.localParticipant.getTrackPublications().find(n=>{let{trackSid:i}=n;return i===e});if(!A){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(L.LocalTrackSubscribed,A),this.emitWhenConnected(I.LocalTrackSubscribed,A,this.localParticipant)}).on(_.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((A,n)=>{this.handleParticipantDisconnected(n,A)}),this.emit(I.Moved,e.room.name,e.token),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine))}static getLocalDevices(e){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Qe.getInstance().getDevices(e,A)}prepareConnection(e,A){return v(this,void 0,void 0,function*(){if(this.state===q.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(ma(new URL(e))&&A){this.regionUrlProvider=new Ka(e,A);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===q.Disconnected&&(this.regionUrl=n,yield fetch(ba(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(ba(e),{method:"HEAD"})}catch(n){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:n}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,A){return v(this,void 0,void 0,function*(){let n=()=>{},i;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":i=new bA({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":i=new bA({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":i=new bA({scenario:{case:"serverLeave",value:!0}});break;case"migration":i=new bA({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":n=()=>v(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new bA({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":n=()=>v(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),i=new bA({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":i=new bA({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),n=()=>v(this,void 0,void 0,function*(){const r=this.engine.client.onLeave;r&&r(new qi({reason:aA.CLIENT_INITIATED,action:Mt.RECONNECT}))});break;case"subscriber-bandwidth":if(A===void 0||typeof A!="number")throw new Error("subscriber-bandwidth requires a number as argument");i=new bA({scenario:{case:"subscriberBandwidth",value:Bt(A)}});break;case"leave-full-reconnect":i=new bA({scenario:{case:"leaveRequestFullReconnect",value:!0}})}i&&(yield this.engine.client.sendSimulateScenario(i),yield n())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,A){return v(this,arguments,void 0,function(n,i){var r=this;let s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var a,o,c,l,u,d,h,g;let f=!0,m=!1;const B=s?{exact:i}:i;if(n==="audioinput"){m=r.localParticipant.audioTrackPublications.size===0;const b=(a=r.getActiveDevice(n))!==null&&a!==void 0?a:r.options.audioCaptureDefaults.deviceId;r.options.audioCaptureDefaults.deviceId=B;const U=Array.from(r.localParticipant.audioTrackPublications.values()).filter(C=>C.source===F.Source.Microphone);try{f=(yield Promise.all(U.map(C=>{var w;return(w=C.audioTrack)===null||w===void 0?void 0:w.setDeviceId(B)}))).every(C=>C===!0)}catch(C){throw r.options.audioCaptureDefaults.deviceId=b,C}}else if(n==="videoinput"){m=r.localParticipant.videoTrackPublications.size===0;const b=(o=r.getActiveDevice(n))!==null&&o!==void 0?o:r.options.videoCaptureDefaults.deviceId;r.options.videoCaptureDefaults.deviceId=B;const U=Array.from(r.localParticipant.videoTrackPublications.values()).filter(C=>C.source===F.Source.Camera);try{f=(yield Promise.all(U.map(C=>{var w;return(w=C.videoTrack)===null||w===void 0?void 0:w.setDeviceId(B)}))).every(C=>C===!0)}catch(C){throw r.options.videoCaptureDefaults.deviceId=b,C}}else if(n==="audiooutput"){if(!pa()&&!r.options.webAudioMix||r.options.webAudioMix&&r.audioContext&&!("setSinkId"in r.audioContext))throw new Error("cannot switch audio output, setSinkId not supported");r.options.webAudioMix&&(i=(c=yield Qe.getInstance().normalizeDeviceId("audiooutput",i))!==null&&c!==void 0?c:""),(l=(g=r.options).audioOutput)!==null&&l!==void 0||(g.audioOutput={});const b=(u=r.getActiveDevice(n))!==null&&u!==void 0?u:r.options.audioOutput.deviceId;r.options.audioOutput.deviceId=i;try{r.options.webAudioMix&&((d=r.audioContext)===null||d===void 0||d.setSinkId(i)),yield Promise.all(Array.from(r.remoteParticipants.values()).map(U=>U.setAudioOutput({deviceId:i})))}catch(U){throw r.options.audioOutput.deviceId=b,U}}return(m||n==="audiooutput")&&(r.localParticipant.activeDeviceMap.set(n,n==="audiooutput"&&((h=r.options.audioOutput)===null||h===void 0?void 0:h.deviceId)||i),r.emit(I.ActiveDeviceChanged,n,i)),f}()})}setupLocalParticipantEvents(){this.localParticipant.on(L.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(L.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(L.AttributesChanged,this.onLocalAttributesChanged).on(L.TrackMuted,this.onLocalTrackMuted).on(L.TrackUnmuted,this.onLocalTrackUnmuted).on(L.LocalTrackPublished,this.onLocalTrackPublished).on(L.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(L.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(L.MediaDevicesError,this.onMediaDevicesError).on(L.AudioStreamAcquired,this.startAudio).on(L.ChatMessage,this.onLocalChatMessageSent).on(L.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,A,n){if(this.state===q.Connecting||this.state===q.Reconnecting){const l=()=>{this.onTrackAdded(e,A,n),u()},u=()=>{this.off(I.Reconnected,l),this.off(I.Connected,l),this.off(I.Disconnected,u)};this.once(I.Reconnected,l),this.once(I.Connected,l),this.once(I.Disconnected,u);return}if(this.state===q.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const i=Mw(A.id),r=i[0];let s=i[1],a=e.id;if(s&&s.startsWith("TR")&&(a=s),r===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const o=Array.from(this.remoteParticipants.values()).find(l=>l.sid===r);if(!o){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(r),this.logContext);return}let c;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?c=this.options.adaptiveStream:c={}),o.addSubscribedMediaTrack(e,a,A,n,c)}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,A=arguments.length>1?arguments[1]:void 0;var n;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.state!==q.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(i=>{i.trackPublications.forEach(r=>{i.unpublishTrack(r.trackSid)})}),this.localParticipant.trackPublications.forEach(i=>{var r,s,a;i.track&&this.localParticipant.unpublishTrack(i.track,e),e?((r=i.track)===null||r===void 0||r.detach(),(s=i.track)===null||s===void 0||s.stop()):(a=i.track)===null||a===void 0||a.stopMonitor()}),this.localParticipant.off(L.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(L.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(L.AttributesChanged,this.onLocalAttributesChanged).off(L.TrackMuted,this.onLocalTrackMuted).off(L.TrackUnmuted,this.onLocalTrackUnmuted).off(L.LocalTrackPublished,this.onLocalTrackPublished).off(L.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(L.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(L.MediaDevicesError,this.onMediaDevicesError).off(L.AudioStreamAcquired,this.startAudio).off(L.ChatMessage,this.onLocalChatMessageSent).off(L.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),Ve()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(n=navigator.mediaDevices)===null||n===void 0||n.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(q.Disconnected),this.emit(I.Disconnected,A)}}}handleParticipantDisconnected(e,A){var n;this.remoteParticipants.delete(e),A&&(A.trackPublications.forEach(i=>{A.unpublishTrack(i.trackSid,!0)}),this.emit(I.ParticipantDisconnected,A),A.setDisconnected(),(n=this.localParticipant)===null||n===void 0||n.handleParticipantDisconnected(A.identity))}handleStreamHeader(e,A){return v(this,void 0,void 0,function*(){var n;if(e.contentHeader.case==="byteHeader"){const i=this.byteStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,name:(n=e.contentHeader.value.name)!==null&&n!==void 0?n:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:or(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:o=>{r=o,this.byteStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new Vb(s,a,or(e.totalLength)),{identity:A})}else if(e.contentHeader.case==="textHeader"){const i=this.textStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let r;const s={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes},a=new ReadableStream({start:o=>{r=o,this.textStreamControllers.set(e.streamId,{info:s,controller:r,startTime:Date.now()})}});i(new Gb(s,a,or(e.totalLength)),{identity:A})}})}handleStreamChunk(e){const A=this.byteStreamControllers.get(e.streamId);A&&e.content.length>0&&A.controller.enqueue(e);const n=this.textStreamControllers.get(e.streamId);n&&e.content.length>0&&n.controller.enqueue(e)}handleStreamTrailer(e){const A=this.textStreamControllers.get(e.streamId);A&&(A.info.attributes=Object.assign(Object.assign({},A.info.attributes),e.attributes),A.controller.close(),this.textStreamControllers.delete(e.streamId));const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.byteStreamControllers.delete(e.streamId))}acquireAudioContext(){return v(this,void 0,void 0,function*(){var e,A;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=xd())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(i=>i.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),Ke(200)])}catch(i){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:i}))}const n=((A=this.audioContext)===null||A===void 0?void 0:A.state)==="running";n!==this.canPlaybackAudio&&(this.audioEnabled=n,this.emit(I.AudioPlaybackStatusChanged,n))})}createParticipant(e,A){var n;let i;return A?i=pr.fromParticipantInfo(this.engine.client,A,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):i=new pr(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),!((n=this.options.audioOutput)===null||n===void 0)&&n.deviceId&&i.setAudioOutput(this.options.audioOutput).catch(r=>this.log.warn("Could not set audio output: ".concat(r.message),this.logContext)),i}getOrCreateParticipant(e,A){if(this.remoteParticipants.has(e)){const i=this.remoteParticipants.get(e);return A&&i.updateInfo(A)&&this.sidToIdentity.set(A.sid,A.identity),i}const n=this.createParticipant(e,A);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(A.sid,A.identity),this.emitWhenConnected(I.ParticipantConnected,n),n.on(L.TrackPublished,i=>{this.emitWhenConnected(I.TrackPublished,i,n)}).on(L.TrackSubscribed,(i,r)=>{i.kind===F.Kind.Audio?(i.on(x.AudioPlaybackStarted,this.handleAudioPlaybackStarted),i.on(x.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):i.kind===F.Kind.Video&&(i.on(x.VideoPlaybackFailed,this.handleVideoPlaybackFailed),i.on(x.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(I.TrackSubscribed,i,r,n)}).on(L.TrackUnpublished,i=>{this.emit(I.TrackUnpublished,i,n)}).on(L.TrackUnsubscribed,(i,r)=>{this.emit(I.TrackUnsubscribed,i,r,n)}).on(L.TrackMuted,i=>{this.emitWhenConnected(I.TrackMuted,i,n)}).on(L.TrackUnmuted,i=>{this.emitWhenConnected(I.TrackUnmuted,i,n)}).on(L.ParticipantMetadataChanged,i=>{this.emitWhenConnected(I.ParticipantMetadataChanged,i,n)}).on(L.ParticipantNameChanged,i=>{this.emitWhenConnected(I.ParticipantNameChanged,i,n)}).on(L.AttributesChanged,i=>{this.emitWhenConnected(I.ParticipantAttributesChanged,i,n)}).on(L.ConnectionQualityChanged,i=>{this.emitWhenConnected(I.ConnectionQualityChanged,i,n)}).on(L.ParticipantPermissionsChanged,i=>{this.emitWhenConnected(I.ParticipantPermissionsChanged,i,n)}).on(L.TrackSubscriptionStatusChanged,(i,r)=>{this.emitWhenConnected(I.TrackSubscriptionStatusChanged,i,r,n)}).on(L.TrackSubscriptionFailed,(i,r)=>{this.emit(I.TrackSubscriptionFailed,i,n,r)}).on(L.TrackSubscriptionPermissionChanged,(i,r)=>{this.emitWhenConnected(I.TrackSubscriptionPermissionChanged,i,r,n)}).on(L.Active,()=>{this.emitWhenConnected(I.ParticipantActive,n)}),A&&n.updateInfo(A),n}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((n,i)=>(n.push(...i.getTrackPublications()),n),[]),A=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,A)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const A of e.videoTrackPublications.values())A.isSubscribed&&$w(A)&&A.emitTrackUpdate()}getRemoteParticipantBySid(e){const A=this.sidToIdentity.get(e);if(A)return this.remoteParticipants.get(A)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Te.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,aA.STATE_MISMATCH))):e=0},ty)}clearConnectionReconcile(){this.connectionReconcileInterval&&Te.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(I.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[A,n]=e;this.emit(A,...n)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var A=arguments.length,n=new Array(A>1?A-1:0),i=1;i<A;i++)n[i-1]=arguments[i];if(this.state===q.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===q.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return v(this,void 0,void 0,function*(){var A,n;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),r=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new ji({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:re.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new ht({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(I.SignalConnected),this.emit(I.Connected),this.setAndEmitConnectionState(q.Connected),i.video){const s=new ja(F.Kind.Video,new Ot({source:Be.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO,name:"video-dummy"}),new fr(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:kd(160*((A=r.aspectRatios[0])!==null&&A!==void 0?A:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(L.LocalTrackPublished,s)}if(i.audio){const s=new ja(F.Kind.Audio,new Ot({source:Be.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO}),new dr(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:Ca(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(s),this.localParticipant.emit(L.LocalTrackPublished,s)}for(let s=0;s<r.count-1;s+=1){let a=new ht({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(s),state:Ht.ACTIVE,tracks:[],joinedAt:re.parse(Date.now())});const o=this.getOrCreateParticipant(a.identity,a);if(r.video){const c=kd(160*((n=r.aspectRatios[s%r.aspectRatios.length])!==null&&n!==void 0?n:1),160,!1,!0),l=new Ot({source:Be.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO});o.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),a.tracks=[...a.tracks,l]}if(r.audio){const c=Ca(),l=new Ot({source:Be.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:sA.AUDIO});o.addSubscribedMediaTrack(c,l.sid,new MediaStream([c]),new RTCRtpReceiver),a.tracks=[...a.tracks,l]}o.updateInfo(a)}})}emit(e){for(var A=arguments.length,n=new Array(A>1?A-1:0),i=1;i<A;i++)n[i-1]=arguments[i];if(e!==I.ActiveSpeakersChanged&&e!==I.TranscriptionReceived){const r=ah(n).filter(s=>s!==void 0);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:r}))}return super.emit(e,...n)}}qt.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function ah(t){return t.map(e=>{if(e)return Array.isArray(e)?ah(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var fA;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(fA||(fA={}));class nt extends yA.EventEmitter{constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=fA.IDLE,this.logs=[],this.options={},this.url=e,this.token=A,this.name=this.constructor.name,this.room=new qt(n.roomOptions),this.connectOptions=n.connectOptions,this.options=n}run(e){return v(this,void 0,void 0,function*(){if(this.status!==fA.IDLE)throw Error("check is running already");this.setStatus(fA.RUNNING);try{yield this.perform()}catch(A){A instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(A.message):this.appendError(A.message))}return yield this.disconnect(),yield new Promise(A=>setTimeout(A,500)),this.status!==fA.SKIPPED&&this.setStatus(this.isSuccess()?fA.SUCCESS:fA.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return v(this,void 0,void 0,function*(){return this.room.state===q.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return v(this,void 0,void 0,function*(){this.room&&this.room.state!==q.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(fA.SKIPPED)}switchProtocol(e){return v(this,void 0,void 0,function*(){let A=!1,n=!1;if(this.room.on(I.Reconnecting,()=>{A=!0}),this.room.once(I.Reconnected,()=>{n=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(r=>setTimeout(r,1e3)),!A)return;const i=Date.now()+1e4;for(;Date.now()<i;){if(n)return;yield Ke(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class ny extends nt{get description(){return"Cloud regions"}perform(){return v(this,void 0,void 0,function*(){const e=new Ka(this.url,this.token);if(!e.isCloud()){this.skip();return}const A=[],n=new Set;for(let r=0;r<3;r++){const s=yield e.getNextBestRegionUrl();if(!s)break;if(n.has(s))continue;n.add(s);const a=yield this.checkCloudRegion(s);this.appendMessage("".concat(a.region," RTT: ").concat(a.rtt,"ms, duration: ").concat(a.duration,"ms")),A.push(a)}A.sort((r,s)=>(r.duration-s.duration)*.5+(r.rtt-s.rtt)*.5);const i=A[0];this.bestStats=i,this.appendMessage("best Cloud region: ".concat(i.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return v(this,void 0,void 0,function*(){var A,n;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const i=(A=this.room.serverInfo)===null||A===void 0?void 0:A.region;if(!i)throw new Error("Region not found");const r=yield this.room.localParticipant.streamText({topic:"test"}),s=1e3,o=1e6/s,c="A".repeat(s),l=Date.now();for(let g=0;g<o;g++)yield r.write(c);yield r.close();const u=Date.now(),d=yield(n=this.room.engine.pcManager)===null||n===void 0?void 0:n.publisher.getStats(),h={region:i,rtt:1e4,duration:u-l};return d==null||d.forEach(g=>{g.type==="candidate-pair"&&g.nominated&&(h.rtt=g.currentRoundTripTime*1e3)}),yield this.disconnect(),h})}}const Wa=1e4;class iy extends nt{get description(){return"Connection via UDP vs TCP"}perform(){return v(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),A=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-A.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-A.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=A):this.appendMessage("best connection quality via udp");const n=this.bestStats;this.appendMessage("upstream bitrate: ".concat((n.bitrateTotal/n.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((n.rttTotal/n.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((n.jitterTotal/n.count*1e3).toFixed(2)," ms")),n.packetsLost>0&&this.appendWarning("packets lost: ".concat((n.packetsLost/n.packetsSent*100).toFixed(2),"%")),n.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((n.qualityLimitationDurations.bandwidth/(Wa/1e3)*100).toFixed(2),"%")),n.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((n.qualityLimitationDurations.cpu/(Wa/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return v(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const A=document.createElement("canvas");A.width=1280,A.height=720;const n=A.getContext("2d");if(!n)throw new Error("Could not get canvas context");let i=0;const r=()=>{i=(i+1)%360,n.fillStyle="hsl(".concat(i,", 100%, 50%)"),n.fillRect(0,0,A.width,A.height),requestAnimationFrame(r)};r();const a=A.captureStream(30).getVideoTracks()[0],c=(yield this.room.localParticipant.publishTrack(a,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,l={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},u=setInterval(()=>v(this,void 0,void 0,function*(){const d=yield c.getRTCStatsReport();d==null||d.forEach(h=>{h.type==="outbound-rtp"?(l.packetsSent=h.packetsSent,l.qualityLimitationDurations=h.qualityLimitationDurations,l.bitrateTotal+=h.targetBitrate,l.count++):h.type==="remote-inbound-rtp"&&(l.packetsLost=h.packetsLost,l.rttTotal+=h.roundTripTime,l.jitterTotal+=h.jitter)})}),1e3);return yield new Promise(d=>setTimeout(d,Wa)),clearInterval(u),a.stop(),A.remove(),yield this.disconnect(),l})}}class ry extends nt{get description(){return"Can publish audio"}perform(){return v(this,void 0,void 0,function*(){var e;const A=yield this.connect(),n=yield zb();if(yield Id(n,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),A.localParticipant.publishTrack(n),yield new Promise(a=>setTimeout(a,3e3));const r=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!r)throw new Error("Could not get RTCStats");let s=0;if(r.forEach(a=>{a.type==="outbound-rtp"&&(a.kind==="audio"||!a.kind&&a.mediaType==="audio")&&(s=a.packetsSent)}),s===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(s," audio packets"))})}}class sy extends nt{get description(){return"Can publish video"}perform(){return v(this,void 0,void 0,function*(){var e;const A=yield this.connect(),n=yield Yb();yield this.checkForVideo(n.mediaStreamTrack),A.localParticipant.publishTrack(n),yield new Promise(s=>setTimeout(s,5e3));const i=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let r=0;if(i.forEach(s=>{s.type==="outbound-rtp"&&(s.kind==="video"||!s.kind&&s.mediaType==="video")&&(r+=s.packetsSent)}),r===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(r," video packets"))})}checkForVideo(e){return v(this,void 0,void 0,function*(){const A=new MediaStream;A.addTrack(e.clone());const n=document.createElement("video");n.srcObject=A,n.muted=!0,yield new Promise(i=>{n.onplay=()=>{setTimeout(()=>{var r,s,a,o;const c=document.createElement("canvas"),l=e.getSettings(),u=(s=(r=l.width)!==null&&r!==void 0?r:n.videoWidth)!==null&&s!==void 0?s:1280,d=(o=(a=l.height)!==null&&a!==void 0?a:n.videoHeight)!==null&&o!==void 0?o:720;c.width=u,c.height=d;const h=c.getContext("2d");h.drawImage(n,0,0);const f=h.getImageData(0,0,c.width,c.height).data;let m=!0;for(let B=0;B<f.length;B+=4)if(f[B]!==0||f[B+1]!==0||f[B+2]!==0){m=!1;break}m?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),i()},1e3)},n.play()}),n.remove()})}}class ay extends nt{get description(){return"Resuming connection after interruption"}perform(){return v(this,void 0,void 0,function*(){var e;const A=yield this.connect();let n=!1,i=!1,r;const s=new Promise(c=>{setTimeout(c,5e3),r=c}),a=()=>{n=!0};A.on(I.SignalReconnecting,a).on(I.Reconnecting,a).on(I.Reconnected,()=>{i=!0,r(!0)}),(e=A.engine.client.ws)===null||e===void 0||e.close();const o=A.engine.client.onClose;if(o&&o(""),yield s,n){if(!i||A.state!==q.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class oy extends nt{get description(){return"Can connect via TURN"}perform(){return v(this,void 0,void 0,function*(){var e,A;const n=new ka,i=yield n.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});let r=!1,s=!1,a=!1;for(let o of i.iceServers)for(let c of o.urls)c.startsWith("turn:")?(s=!0,a=!0):c.startsWith("turns:")&&(s=!0,a=!0,r=!0),c.startsWith("stun:")&&(a=!0);a?s&&!r&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield n.close(),!((A=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||A===void 0)&&A.iceServers||s?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(o=>setTimeout(o,0)))})}}class cy extends nt{get description(){return"Establishing WebRTC connection"}perform(){return v(this,void 0,void 0,function*(){let e=!1,A=!1;this.room.on(I.SignalConnected,()=>{const n=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(i,r)=>{if(i.candidate){const s=new RTCIceCandidate(i);let a="".concat(s.protocol," ").concat(s.address,":").concat(s.port," ").concat(s.type);s.address&&(ly(s.address)?a+=" (private)":s.protocol==="tcp"&&s.tcpType==="passive"?(e=!0,a+=" (passive)"):s.protocol==="udp"&&(A=!0)),this.appendMessage(a)}n&&n(i,r)},this.room.engine.pcManager&&(this.room.engine.pcManager.subscriber.onIceCandidateError=i=>{i instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(i.errorCode," ").concat(i.errorText," ").concat(i.url))})});try{yield this.connect(),W.info("now the room is connected")}catch(n){throw this.appendWarning("ports need to be open on firewall in order to connect."),n}e||this.appendWarning("Server is not configured for ICE/TCP"),A||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function ly(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const A=parseInt(e[1],10);if(A>=16&&A<=31)return!0}}return!1}class uy extends nt{get description(){return"Connecting to signal connection via WebSocket"}perform(){return v(this,void 0,void 0,function*(){var e,A,n;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let i=new ka;const r=yield i.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3});this.appendMessage("Connected to server, version ".concat(r.serverVersion,".")),((e=r.serverInfo)===null||e===void 0?void 0:e.edition)===lu.Cloud&&(!((A=r.serverInfo)===null||A===void 0)&&A.region)&&this.appendMessage("LiveKit Cloud: ".concat((n=r.serverInfo)===null||n===void 0?void 0:n.region)),yield i.close()})}}class HU extends yA.EventEmitter{constructor(e,A){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=A,this.options=n}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:fA.IDLE,name:"",description:""}),e}updateCheck(e,A){this.checkResults.set(e,A),this.emit("checkUpdate",e,A)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==fA.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return v(this,void 0,void 0,function*(){const A=this.getNextCheckId(),n=new e(this.url,this.token,this.options),i=s=>{this.updateCheck(A,s)};n.on("update",i);const r=yield n.run();return n.off("update",i),r})}checkWebsocket(){return v(this,void 0,void 0,function*(){return this.createAndRunCheck(uy)})}checkWebRTC(){return v(this,void 0,void 0,function*(){return this.createAndRunCheck(cy)})}checkTURN(){return v(this,void 0,void 0,function*(){return this.createAndRunCheck(oy)})}checkReconnect(){return v(this,void 0,void 0,function*(){return this.createAndRunCheck(ay)})}checkPublishAudio(){return v(this,void 0,void 0,function*(){return this.createAndRunCheck(ry)})}checkPublishVideo(){return v(this,void 0,void 0,function*(){return this.createAndRunCheck(sy)})}checkConnectionProtocol(){return v(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(iy);if(e.data&&"protocol"in e.data){const A=e.data;this.options.protocol=A.protocol}return e})}checkCloudRegion(){return v(this,void 0,void 0,function*(){return this.createAndRunCheck(ny)})}}const dy=/\{[^{}]+\}/g;function hy(){return Math.random().toString(36).slice(2,11)}function fy(t){let{baseUrl:e="",Request:A=globalThis.Request,fetch:n=globalThis.fetch,querySerializer:i,bodySerializer:r,headers:s,...a}={...t};e=uh(e);const o=[];async function c(l,u){const{baseUrl:d,fetch:h=n,Request:g=A,headers:f,params:m={},parseAs:B="json",querySerializer:b,bodySerializer:U=r??py,body:C,...w}=u||{};d&&(e=uh(d));let y=typeof i=="function"?i:lh(i);b&&(y=typeof b=="function"?b:lh({...typeof i=="object"?i:{},...b}));const E=C===void 0?void 0:U(C),S=E===void 0||E instanceof FormData?{}:{"Content-Type":"application/json"},k={redirect:"follow",...a,...w,body:E,headers:By(S,s,f,m.header)};let R,P,D=new A(my(l,{baseUrl:e,params:m,querySerializer:y}),k);for(const N in w)N in D||(D[N]=w[N]);if(o.length){R=hy(),P=Object.freeze({baseUrl:e,fetch:h,parseAs:B,querySerializer:y,bodySerializer:U});for(const N of o)if(N&&typeof N=="object"&&typeof N.onRequest=="function"){const V=await N.onRequest({request:D,schemaPath:l,params:m,options:P,id:R});if(V){if(!(V instanceof A))throw new Error("onRequest: must return new Request() when modifying the request");D=V}}}let M=await h(D);if(o.length)for(let N=o.length-1;N>=0;N--){const V=o[N];if(V&&typeof V=="object"&&typeof V.onResponse=="function"){const Fe=await V.onResponse({request:D,response:M,schemaPath:l,params:m,options:P,id:R});if(Fe){if(!(Fe instanceof Response))throw new Error("onResponse: must return new Response() when modifying the response");M=Fe}}}if(M.status===204||M.headers.get("Content-Length")==="0")return M.ok?{data:{},response:M}:{error:{},response:M};if(M.ok)return B==="stream"?{data:M.body,response:M}:{data:await M[B](),response:M};let ae=await M.text();try{ae=JSON.parse(ae)}catch{}return{error:ae,response:M}}return{GET(l,u){return c(l,{...u,method:"GET"})},PUT(l,u){return c(l,{...u,method:"PUT"})},POST(l,u){return c(l,{...u,method:"POST"})},DELETE(l,u){return c(l,{...u,method:"DELETE"})},OPTIONS(l,u){return c(l,{...u,method:"OPTIONS"})},HEAD(l,u){return c(l,{...u,method:"HEAD"})},PATCH(l,u){return c(l,{...u,method:"PATCH"})},TRACE(l,u){return c(l,{...u,method:"TRACE"})},use(...l){for(const u of l)if(u){if(typeof u!="object"||!("onRequest"in u||"onResponse"in u))throw new Error("Middleware must be an object with one of `onRequest()` or `onResponse()`");o.push(u)}},eject(...l){for(const u of l){const d=o.indexOf(u);d!==-1&&o.splice(d,1)}}}}function mr(t,e,A){if(e==null)return"";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${(A==null?void 0:A.allowReserved)===!0?e:encodeURIComponent(e)}`}function oh(t,e,A){if(!e||typeof e!="object")return"";const n=[],i={simple:",",label:".",matrix:";"}[A.style]||"&";if(A.style!=="deepObject"&&A.explode===!1){for(const a in e)n.push(a,A.allowReserved===!0?e[a]:encodeURIComponent(e[a]));const s=n.join(",");switch(A.style){case"form":return`${t}=${s}`;case"label":return`.${s}`;case"matrix":return`;${t}=${s}`;default:return s}}for(const s in e){const a=A.style==="deepObject"?`${t}[${s}]`:s;n.push(mr(a,e[s],A))}const r=n.join(i);return A.style==="label"||A.style==="matrix"?`${i}${r}`:r}function ch(t,e,A){if(!Array.isArray(e))return"";if(A.explode===!1){const r={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[A.style]||",",s=(A.allowReserved===!0?e:e.map(a=>encodeURIComponent(a))).join(r);switch(A.style){case"simple":return s;case"label":return`.${s}`;case"matrix":return`;${t}=${s}`;default:return`${t}=${s}`}}const n={simple:",",label:".",matrix:";"}[A.style]||"&",i=[];for(const r of e)A.style==="simple"||A.style==="label"?i.push(A.allowReserved===!0?r:encodeURIComponent(r)):i.push(mr(t,r,A));return A.style==="label"||A.style==="matrix"?`${n}${i.join(n)}`:i.join(n)}function lh(t){return function(A){const n=[];if(A&&typeof A=="object")for(const i in A){const r=A[i];if(r!=null){if(Array.isArray(r)){if(r.length===0)continue;n.push(ch(i,r,{style:"form",explode:!0,...t==null?void 0:t.array,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}if(typeof r=="object"){n.push(oh(i,r,{style:"deepObject",explode:!0,...t==null?void 0:t.object,allowReserved:(t==null?void 0:t.allowReserved)||!1}));continue}n.push(mr(i,r,t))}}return n.join("&")}}function gy(t,e){let A=t;for(const n of t.match(dy)??[]){let i=n.substring(1,n.length-1),r=!1,s="simple";if(i.endsWith("*")&&(r=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(s="label",i=i.substring(1)):i.startsWith(";")&&(s="matrix",i=i.substring(1)),!e||e[i]===void 0||e[i]===null)continue;const a=e[i];if(Array.isArray(a)){A=A.replace(n,ch(i,a,{style:s,explode:r}));continue}if(typeof a=="object"){A=A.replace(n,oh(i,a,{style:s,explode:r}));continue}if(s==="matrix"){A=A.replace(n,`;${mr(i,a)}`);continue}A=A.replace(n,s==="label"?`.${encodeURIComponent(a)}`:encodeURIComponent(a))}return A}function py(t){return t instanceof FormData?t:JSON.stringify(t)}function my(t,e){var i;let A=`${e.baseUrl}${t}`;(i=e.params)!=null&&i.path&&(A=gy(A,e.params.path));let n=e.querySerializer(e.params.query??{});return n.startsWith("?")&&(n=n.substring(1)),n&&(A+=`?${n}`),A}function By(...t){const e=new Headers;for(const A of t){if(!A||typeof A!="object")continue;const n=A instanceof Headers?A.entries():Object.entries(A);for(const[i,r]of n)if(r===null)e.delete(i);else if(Array.isArray(r))for(const s of r)e.append(i,s);else r!==void 0&&e.set(i,r)}return e}function uh(t){return t.endsWith("/")?t.substring(0,t.length-1):t}class dh{constructor(e){this.client=fy({baseUrl:e.baseUrl,headers:e.headers,fetch:e.fetch})}setAuthToken(e){this.client.use({onRequest({request:A}){return A.headers.set("Authorization",`Bearer ${e}`),A}})}setApiToken(e){this.client.use({onRequest({request:A}){return A.headers.set("Authorization",`Token ${e}`),A}})}async getAuthUrl(e){return await this.client.GET("/api/auth/{type}",{params:{path:{type:e}}})}async getConnectUrl(e){return await this.client.GET("/api/connect/{type}",{params:{path:{type:e}}})}async logout(){return await this.client.POST("/api/logout")}async getCurrentUser(){return await this.client.GET("/api/me")}async clientInitialise(e,A={}){return await this.client.POST("/api/client/{appToken}/initialise",{params:{path:{appToken:e}},body:A})}async clientStartSession(e,A){return await this.client.POST("/api/client/{appToken}/start-session",{params:{path:{appToken:e}},body:A})}async createPresignedUploadUrl(e){return await this.client.POST("/api/files",{body:e})}async createKnowledgeBlock(e){return await this.client.POST("/api/knowledge",{body:e})}async listOnboardees(){return await this.client.GET("/api/onboardees")}async getOnboardee(e){return await this.client.GET("/api/onboardees/{id}",{params:{path:{id:e}}})}async getOnboardeeWidgetConfig(e,A){return await this.client.GET("/api/onboardees/{id}/config",{params:{path:{id:e}},signal:A})}async listPlans(){return await this.client.GET("/api/plans")}async listProducts(){return await this.client.GET("/api/products")}async getProduct(e){return await this.client.GET("/api/products/{id}",{params:{path:{id:e}}})}async getProductAnalytics(e,A,n){return await this.client.GET("/api/products/{id}/analytics",{params:{path:{id:e},query:{...A&&{start_date:A},...n&&{end_date:n}}}})}async getCourseAnalytics(e,A,n){return await this.client.GET("/api/courses/analytics",{params:{query:{...e&&{product_id:e.toString()},...A&&{start_date:A},...n&&{end_date:n}}}})}async createProduct(e){return await this.client.POST("/api/products",{body:e})}async updateProduct(e,A){return await this.client.PATCH("/api/products/{id}",{params:{path:{id:e}},body:A})}async getProductNavigationIndex(e){return await this.client.GET("/api/products/{id}/navigation-index",{params:{path:{id:e}}})}async replaceProductNavigationIndex(e,A){return await this.client.PUT("/api/products/{id}/navigation-index",{params:{path:{id:e}},body:A})}async listProductKnowledgeBlocks(e){return await this.client.GET("/api/products/{id}/knowledge-blocks",{params:{path:{id:e}}})}async createProductKnowledgeBlock(e,A){return await this.client.POST("/api/products/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async searchProductKnowledgeBlocks(e,A,n){return await this.client.GET("/api/products/{id}/knowledge-blocks/search",{params:{path:{id:e},query:{q:A,...n&&{limit:n.toString()}}}})}async updateProductKnowledgeBlock(e,A,n){return await this.client.PATCH("/api/products/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}},body:n})}async deleteProductKnowledgeBlock(e,A){return await this.client.DELETE("/api/products/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}}})}async createPlan(e){return await this.client.POST("/api/plans",{body:e})}async getPlan(e){return await this.client.GET("/api/plans/{id}",{params:{path:{id:e}}})}async replacePlan(e,A){return await this.client.PUT("/api/plans/{id}",{params:{path:{id:e}},body:A})}async updatePlan(e,A){return await this.client.PATCH("/api/plans/{id}",{params:{path:{id:e}},body:A})}async getPlanVideoUrl(e){return await this.client.GET("/api/plans/{id}/video-url",{params:{path:{id:e}}})}async deletePlan(e){return await this.client.DELETE("/api/admin/plans/{id}",{params:{path:{id:e}}})}async publishPlanRevision(e,A){return await this.client.POST("/api/plans/{id}/publish",{params:{path:{id:e}},body:A})}async listPlanRevisions(e){return await this.client.GET("/api/plans/{id}/revisions",{params:{path:{id:e}}})}async listPlanKnowledgeBlocks(e){return await this.client.GET("/api/plans/{id}/knowledge-blocks",{params:{path:{id:e}}})}async createPlanKnowledgeBlock(e,A){return await this.client.POST("/api/plans/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async updatePlanKnowledgeBlock(e,A,n){return await this.client.PUT("/api/plans/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}},body:n})}async deletePlanKnowledgeBlock(e,A){return await this.client.DELETE("/api/plans/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}}})}async getPlanNavigationIndex(e){return await this.client.GET("/api/plans/{id}/navigation-index",{params:{path:{id:e}}})}async replacePlanNavigationIndex(e,A){return await this.client.POST("/api/plans/{id}/navigation-index",{params:{path:{id:e}},body:A})}async getRevisionNavigationIndex(e){return await this.client.GET("/api/revisions/{id}/navigation-index",{params:{path:{id:e}}})}async replaceRevisionNavigationIndex(e,A){return await this.client.PUT("/api/revisions/{id}/navigation-index",{params:{path:{id:e}},body:A})}async getRevisionFAQ(e){return await this.client.GET("/api/revisions/{id}/faq",{params:{path:{id:e}}})}async replaceRevisionFAQ(e,A){return await this.client.PUT("/api/revisions/{id}/faq",{params:{path:{id:e}},body:A})}async listRevisionKnowledgeBlocks(e){return await this.client.GET("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}}})}async getRevisionSteps(e){return await this.client.GET("/api/revisions/{id}/steps",{params:{path:{id:e}}})}async replaceRevisionKnowledgeBlocks(e,A){return await this.client.PUT("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async createRevisionKnowledgeBlock(e,A){return await this.client.POST("/api/revisions/{id}/knowledge-blocks",{params:{path:{id:e}},body:A})}async updateRevisionKnowledgeBlock(e,A,n){return await this.client.PUT("/api/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}},body:n})}async deleteRevisionKnowledgeBlock(e,A){return await this.client.DELETE("/api/revisions/{id}/knowledge-blocks/{blockId}",{params:{path:{id:e,blockId:A}}})}async listSessions(e,A){const n={token:e};return A!=null&&A.productId&&(n.product_id=A.productId),A!=null&&A.startDate&&(n.start_date=A.startDate),A!=null&&A.endDate&&(n.end_date=A.endDate),await this.client.GET("/api/sessions",{params:{query:n}})}async createSession(e){return await this.client.POST("/api/sessions",{body:e})}async getSession(e){return await this.client.GET("/api/sessions/{id}",{params:{path:{id:e}}})}async startSession(e,A){return await this.client.GET("/api/sessions/{id}/start-session",{params:{path:{id:e},query:{token:A}}})}async getSessionRecording(e){return await this.client.GET("/api/sessions/{id}/recording",{params:{path:{id:e}}})}async getSessionSummary(e){return await this.client.GET("/api/sessions/{id}/summary",{params:{path:{id:e}}})}async getSessionProductUrl(e){return await this.client.GET("/api/sessions/{id}/product-url",{params:{path:{id:e}}})}async updateSession(e,A){return await this.client.PATCH("/api/sessions/{id}",{params:{path:{id:e}},body:A})}async listUserSessions(e){const A={};return e!=null&&e.productId&&(A.product_id=e.productId),e!=null&&e.startDate&&(A.start_date=e.startDate),e!=null&&e.endDate&&(A.end_date=e.endDate),e!=null&&e.page&&(A.page=e.page),e!=null&&e.limit&&(A.limit=e.limit),e!=null&&e.courseName&&(A.course_name=e.courseName),e!=null&&e.userName&&(A.user_name=e.userName),e!=null&&e.company&&(A.company=e.company),e!=null&&e.email&&(A.email=e.email),e!=null&&e.sortBy&&(A.sort_by=e.sortBy),e!=null&&e.sortOrder&&(A.sort_order=e.sortOrder),await this.client.GET("/api/user-sessions",{params:Object.keys(A).length>0?{query:A}:void 0})}async listUserSessionsAggregate(e){const A={};return e!=null&&e.productId&&(A.product_id=e.productId),e!=null&&e.startDate&&(A.start_date=e.startDate),e!=null&&e.endDate&&(A.end_date=e.endDate),await this.client.GET("/api/user-sessions-aggregate",{params:Object.keys(A).length>0?{query:A}:void 0})}async getJoinToken(e,{clientType:A,user:n}={}){return await this.client.GET("/api/join-token",{params:{query:{token:e,...A&&{client_type:A},...n&&{user:encodeURIComponent(n)}}}})}async trackEvent(e){try{return await this.client.POST("/api/track",{body:{sent_at:new Date().toISOString(),...e}})}catch(A){console.error("[obi] error tracking event:",A)}return{}}async getSessionPlan(e){return await this.client.GET("/api/sessions/{id}/plan",{params:{path:{id:e}}})}getClient(){return this.client}}const hh="https://app.coragents.ai";class Br extends kr{constructor(e,A,n,i){super(),this.state=null,this.isPaused=!1,this.speakingState=null,this.captureScreen=null,this.sessionUuid=null,this.roomId=null,this.joinToken=null,this.roomUrl=null,this.room=null,this.agentAnalyser=null,this.userAnalyser=null,this.appToken=e,this.planId=A,this.clientType=n,this.api=i.api||new dh({baseUrl:hh}),this.identity=i.identity||null,this.roomFactory=i.roomFactory||(r=>new qt(r)),this.captureScreen=i.captureScreen||null}async start(){this.planId,this.setState("connecting"),this.speakingStateChanged("thinking");try{const A=(await this.api.clientStartSession(this.appToken,{client_type:this.clientType,onboarding_plan:this.planId})).data;if(!(A!=null&&A.url)||!(A!=null&&A.token)||!(A!=null&&A.room)||!(A!=null&&A.session_uuid))throw new Error("Invalid room info");this.sessionUuid=A==null?void 0:A.session_uuid,this.roomId=A==null?void 0:A.room,this.joinToken=A==null?void 0:A.token,this.roomUrl=A==null?void 0:A.url,await this.joinRoom(),this.setState("connected"),this.planId,this.sessionUuid}catch(e){console.error("[obi] error starting session",{error:e}),this.setState("error")}}async joinRoom({withMicrophone:e=!1,withStateRecovery:A=!1}={}){this.room=this.roomFactory({adaptiveStream:!0,dynacast:!0}),this.room.on(I.Disconnected,n=>{if(!this.room)return;let i=null;switch(n){case 12:i="invalid-room";break}this.shutdown(i)}),this.room.on(I.TrackSubscribed,n=>{n.kind==="audio"&&(n.attach(),n.source===F.Source.Microphone&&(this.agentAnalyser&&this.agentAnalyser.disconnect(),this.agentAnalyser=this.createFFT(n.mediaStream)))}),this.room.on(I.LocalTrackPublished,n=>{n.kind==="audio"&&(this.userAnalyser&&this.userAnalyser.disconnect(),this.userAnalyser=this.createFFT(n.audioTrack.mediaStream))}),this.room.on(I.ParticipantAttributesChanged,n=>{if(!n["lk.agent.state"])return;const i=n["lk.agent.state"];switch(i){case"speaking":this.speakingStateChanged("speaking");break;case"listening":this.state!=="connected"&&this.speakingStateChanged("listening");break;case"thinking":this.speakingStateChanged("thinking");break;default:console.warn("[obi] unknown speaking state",i)}}),this.room.on(I.DataReceived,async n=>{try{const i=new TextDecoder().decode(n),r=JSON.parse(i);switch(r.status||r.request||r.type){case"course_progress":typeof r.current_step=="number"&&typeof r.total_steps=="number"&&Array.isArray(r.step_names)&&this.emit("courseProgress",{currentStep:Math.max(1,r.current_step),totalSteps:Math.max(1,r.total_steps),stepNames:r.step_names});break;case"using_tool":this.speakingStateChanged("busy");break;case"using_tool_ended":this.speakingStateChanged("speaking");break;case"prompt_user":this.setState("volume-check");break;case"mic_check":this.setState("mic-check");break;case"share_mic":this.setState("mic-share");break;case"share_screen":this.setState("screen-share");break;case"navigate":this.setState("navigate");break;default:console.warn("[obi] unknown data received",r)}}catch(i){console.error("[obi] error parsing data",i)}}),this.room.localParticipant.registerRpcMethod("mic_check",async n=>(this.sessionUuid,await this.checkMicrophone()?"ok":"error")),this.room.localParticipant.registerRpcMethod("screen_capture",async n=>{if(!this.captureScreen)return console.error("[obi] no captureScreen function provided"),"error";let i=null,r=null;try{i=await this.captureScreen()}catch(s){i=null,s=s}if(!i||r)return console.error("[obi] error capturing screen",{error:r}),"error";try{return await this.room.localParticipant.sendFile(new File([i],"screen_capture.png",{type:"image/png"}),{mimeType:"image/png",topic:"screen_capture"}),"ok"}catch(s){return console.error("[obi] error sending screen capture",{error:s}),"error"}}),await this.room.connect(this.roomUrl,this.joinToken);for(let n=0;n<9&&!(this.room.state===q.Connected&&this.room.remoteParticipants.size>=1);n++)await new Promise(i=>setTimeout(i,1e3));if(!(this.room.state===q.Connected&&this.room.remoteParticipants.size>=1)){console.error("[obi] room not connected",{state:this.room.state,numParticipants:this.room.remoteParticipants.size}),this.shutdown("invalid-room");return}if(e&&await this.room.localParticipant.setMicrophoneEnabled(!0),A){let n=!1;for(const i of this.room.remoteParticipants.values())i.isSpeaking&&(n=!0);n?this.speakingState="speaking":this.speakingState="listening"}}async continue(){this.sessionUuid,this.speakingStateChanged("thinking"),await this.sendData({request:"prompt_user",success:!0})}async checkMicrophone(){let e=!1;try{e=(await navigator.permissions.query({name:"microphone"})).state==="granted"}catch(A){console.error("[obi] error checking microphone permission:",A)}return e?(this.sessionUuid,await this.room.localParticipant.setMicrophoneEnabled(!0),this.isMicShared=!0):this.sessionUuid,e&&this.clientType==="sdk"&&this.setState("in-progress"),this.emit("micCheckComplete",e),e}async shareMicrophone(){this.sessionUuid,this.speakingStateChanged("thinking");let e=null,A=null;try{e=await this.room.localParticipant.setMicrophoneEnabled(!0),this.isMicShared=!0}catch(n){n=n,this.isMicShared=!1}e?this.sessionUuid:console.error("[obi] failed to share microphone",{error:A}),await this.sendData({request:"share_mic",success:!!e}),this.clientType==="sdk"&&this.setState("in-progress")}async shareScreen(){this.sessionUuid,this.speakingStateChanged("thinking"),await this.room.localParticipant.setScreenShareEnabled(!0,{video:{displaySurface:"window"}}),await this.sendData({request:"share_screen",success:!0}),this.setState("navigate")}async pause(){this.muteMicrophone(),this.isPaused=!0,this.emit("paused"),await this.sendData({request:"pause"}),console.log("[obi] paused session",{sessionUuid:this.sessionUuid})}async unpause(){this.unmuteMicrophone(),this.isPaused=!1,this.emit("unpaused"),await this.sendData({request:"unpause"}),console.log("[obi] unpaused session",{sessionUuid:this.sessionUuid})}muteMicrophone(){this.sessionUuid,this.room.localParticipant.getTrackPublications().forEach(e=>{var A,n;e.handleMuted(),(n=(A=e.track)==null?void 0:A.mediaStream)==null||n.getTracks().forEach(i=>i.enabled=!1)})}unmuteMicrophone(){this.sessionUuid,this.room.localParticipant.getTrackPublications().forEach(e=>{var A,n;e.handleUnmuted(),(n=(A=e.track)==null?void 0:A.mediaStream)==null||n.getTracks().forEach(i=>i.enabled=!0)})}async stop(){this.emit("stopped"),await this.shutdown()}async shutdown(e=null){if(this.room){this.sessionUuid;const A=this.room;this.room=null,await A.disconnect(),this.sessionUuid}this.sessionUuid=null,this.roomId=null,this.joinToken=null,this.roomUrl=null,this.emit("shutdown",e)}async say(e){this.speakingStateChanged("thinking"),this.isPaused&&await this.unpause(),await this.sendData({request:"say",message:e})}serialise(){return JSON.stringify({state:this.state,speakingState:this.speakingState,appToken:this.appToken,planId:this.planId,clientType:this.clientType,isPaused:this.isPaused,identity:this.identity,sessionUuid:this.sessionUuid,roomId:this.roomId,joinToken:this.joinToken,roomUrl:this.roomUrl})}audioSpectrum(){return this.speakingState==="speaking"&&this.agentAnalyser?this.normaliseSpectrum(this.agentAnalyser):this.speakingState==="listening"&&this.userAnalyser?this.normaliseSpectrum(this.userAnalyser):null}normaliseSpectrum(e){const n=e.context.sampleRate/2/e.frequencyBinCount,i=new Uint8Array(e.frequencyBinCount);e.getByteFrequencyData(i);const r=[],s=50,a=5e3,o=8,c=Math.pow(a/s,1/o);for(let l=0;l<o;l++){const u=s*Math.pow(c,l),d=s*Math.pow(c,l+1),h=Math.floor(u/n),g=Math.floor(d/n),f=Math.min(g,i.length),m=Math.min(h,f);if(m<f){const B=i.slice(m,f).reduce((b,U)=>b+U,0)/(f-m)/255;r.push(B)}else r.push(0)}return r}setState(e){this.state;const A=this.state;this.state=e,this.emit("stateChanged",e,A)}static deserialise(e,A,n,i={}){const r=JSON.parse(e),s=new Br(A,r.planId,n,i);return s.state=r.state,s.speakingState=r.speakingState,s.identity=r.identity||null,s.isPaused=r.isPaused||!1,s.sessionUuid=r.sessionUuid||null,s.roomId=r.roomId||null,s.joinToken=r.joinToken||null,s.roomUrl=r.roomUrl||null,s}speakingStateChanged(e){this.speakingState;const A=this.speakingState;this.speakingState=e,this.emit("speakingStateChanged",e,A)}async sendData(e){await this.room.localParticipant.publishData(new TextEncoder().encode(JSON.stringify(e)),{reliable:!0})}createFFT(e){const A=new AudioContext,n=A.createAnalyser();return A.createMediaStreamSource(e).connect(n),n.fftSize=2048,n.smoothingTimeConstant=.6,n}}class vr extends kr{constructor(e,A,n={}){super(),this.state="loading",this.error=null,this.identity=null,this.product=null,this.plans=[],this.selectedPlan=null,this.selectedPlanUuid=null,this.showWidget=!1,this.session=null,this.captureScreen=null,this.appToken=e,this.clientType=A,this.api=n.api||new dh({baseUrl:n.apiBaseUrl||hh}),this.sessionFactory=n.sessionFactory||((i,r,s,a)=>new Br(i,r,s,a)),this.captureScreen=n.captureScreen||null}async initialise(e={}){var A,n,i,r;if(!this.appToken)throw new Error("App token is required");this.setState("loading");try{const s=await this.api.clientInitialise(this.appToken,{identity:e.identity});if(this.identity=e.identity||null,this.product=((A=s.data)==null?void 0:A.product)||null,this.plans=((n=s.data)==null?void 0:n.onboarding_plans)||[],this.selectedPlan=((i=s.data)==null?void 0:i.selected_plan)||null,this.showWidget=((r=s.data)==null?void 0:r.show_widget)||!1,e.planUuid){let a=this.plans.find(o=>o.uuid===e.planUuid)||null;if(!a)try{const o=await this.api.getSessionPlan(e.planUuid);a=this.plans.find(c=>{var l;return c.uuid===((l=o.data)==null?void 0:l.plan_uuid)})||null}catch(o){console.error("[obi] error getting session plan",o)}a?(this.selectedPlan=a,this.selectedPlanUuid=e.planUuid):console.warn("[obi] plan not found",{planUuid:e.planUuid})}this.identity,this.product,this.plans,this.selectedPlan,this.showWidget}catch(s){throw this.error=s instanceof Error?s:new Error(String(s)),this.setState("error"),s}finally{this.setState("ready")}}selectPlan(e){this.selectedPlan=e,this.selectedPlanUuid=(e==null?void 0:e.uuid)||null,this.emit("planSelected",e),this.trackEvent(e?"plan_selected":"plan_cancelled")}async startSession(e,A){return await this._stopSession(),this.session=this.sessionFactory(this.appToken,e,this.clientType,{api:this.api,identity:this.identity,captureScreen:this.captureScreen}),this.prepareSession(A),this.session.start().then(()=>{this.emit("sessionStarted",this.session)}).catch(n=>{this.session=null,console.error("[obi] error starting session",n)}),this.trackEvent("session_started"),this.session}async resumeSession(e){var A,n;return this.state,(A=this.session)==null||A.state,(n=this.session)==null||n.speakingState,this.session.captureScreen=this.captureScreen,this.prepareSession(e),this.session.joinRoom({withMicrophone:!0,withStateRecovery:!0}).then(()=>{this.emit("sessionResumed",this.session)}).catch(i=>{console.error("[obi] error joining room",{error:i}),i instanceof Error&&i.message==="Room is not connected"&&this.session.stop()}),this.trackEvent("session_resumed"),this.session}prepareSession(e){if(!this.session)throw new Error("No session to prepare");return e(this.session),this.session.on("stopped",()=>{this.emit("sessionStopped")}),this.session.on("shutdown",A=>{var n,i;(i=(n=this.session)==null?void 0:n.removeAllListeners)==null||i.call(n),this.session=null,this.selectedPlan=null,this.selectedPlanUuid=null,this.emit("sessionShutdown",A)}),this.session}async stopSession(){await this._stopSession(),this.selectedPlan&&this.selectPlan(null)}async _stopSession(){this.session&&(this.trackEvent("session_stopped"),await this.session.stop(),this.session=null)}isLoading(){return this.state==="loading"}isReady(){return this.state==="ready"}serialise(){var e;return JSON.stringify({state:this.state,appToken:this.appToken,clientType:this.clientType,identity:this.identity,product:this.product,plans:this.plans,selectedPlan:this.selectedPlan,selectedPlanUuid:this.selectedPlanUuid,showWidget:this.showWidget,session:(e=this.session)==null?void 0:e.serialise()})}static deserialise(e,A,n,i={}){const r=JSON.parse(e),s=new vr(A,n,i);return s.state=r.state,s.identity=r.identity||null,s.product=r.product||null,s.plans=r.plans||[],s.selectedPlan=r.selectedPlan||null,s.selectedPlanUuid=r.selectedPlanUuid||null,s.showWidget=r.showWidget||!1,r.session&&(s.session=Br.deserialise(r.session,A,n,{api:s.api})),s}setState(e){const A=this.state;this.state=e,this.emit("stateChanged",e,A)}trackEvent(e,A={}){var n,i,r;this.api.trackEvent({event:e,client_type:this.clientType,plan_id:(n=this.selectedPlan)==null?void 0:n.uuid,product_id:(i=this.product)==null?void 0:i.uuid,session_id:(r=this.session)==null?void 0:r.sessionUuid,...A}).then(()=>{}).catch(s=>{console.error("[obi] error tracking event",{event:e,data:A,error:s})})}}var Cr,K,fh,Ct,gh,ph,mh,Bh,Ja,Xa,qa,vh,xn={},Ch=[],vy=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_n=Array.isArray;function PA(t,e){for(var A in e)t[A]=e[A];return t}function Ya(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function za(t,e,A){var n,i,r,s={};for(r in e)r=="key"?n=e[r]:r=="ref"?i=e[r]:s[r]=e[r];if(arguments.length>2&&(s.children=arguments.length>3?Cr.call(arguments,2):A),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)s[r]==null&&(s[r]=t.defaultProps[r]);return wr(t,s,n,i,null)}function wr(t,e,A,n,i){var r={type:t,props:e,key:A,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++fh,__i:-1,__u:0};return i==null&&K.vnode!=null&&K.vnode(r),r}function Pe(t){return t.children}function RA(t,e){this.props=t,this.context=e}function Yt(t,e){if(e==null)return t.__?Yt(t.__,t.__i+1):null;for(var A;e<t.__k.length;e++)if((A=t.__k[e])!=null&&A.__e!=null)return A.__e;return typeof t.type=="function"?Yt(t):null}function wh(t){var e,A;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((A=t.__k[e])!=null&&A.__e!=null){t.__e=t.__c.base=A.__e;break}return wh(t)}}function Za(t){(!t.__d&&(t.__d=!0)&&Ct.push(t)&&!br.__r++||gh!=K.debounceRendering)&&((gh=K.debounceRendering)||ph)(br)}function br(){for(var t,e,A,n,i,r,s,a=1;Ct.length;)Ct.length>a&&Ct.sort(mh),t=Ct.shift(),a=Ct.length,t.__d&&(A=void 0,i=(n=(e=t).__v).__e,r=[],s=[],e.__P&&((A=PA({},n)).__v=n.__v+1,K.vnode&&K.vnode(A),$a(e.__P,A,n,e.__n,e.__P.namespaceURI,32&n.__u?[i]:null,r,i??Yt(n),!!(32&n.__u),s),A.__v=n.__v,A.__.__k[A.__i]=A,Eh(r,A,s),A.__e!=i&&wh(A)));br.__r=0}function bh(t,e,A,n,i,r,s,a,o,c,l){var u,d,h,g,f,m,B=n&&n.__k||Ch,b=e.length;for(o=Cy(A,e,B,o,b),u=0;u<b;u++)(h=A.__k[u])!=null&&(d=h.__i==-1?xn:B[h.__i]||xn,h.__i=u,m=$a(t,h,d,i,r,s,a,o,c,l),g=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&eo(d.ref,null,h),l.push(h.ref,h.__c||g,h)),f==null&&g!=null&&(f=g),4&h.__u||d.__k===h.__k?o=yh(h,o,t):typeof h.type=="function"&&m!==void 0?o=m:g&&(o=g.nextSibling),h.__u&=-7);return A.__e=f,o}function Cy(t,e,A,n,i){var r,s,a,o,c,l=A.length,u=l,d=0;for(t.__k=new Array(i),r=0;r<i;r++)(s=e[r])!=null&&typeof s!="boolean"&&typeof s!="function"?(o=r+d,(s=t.__k[r]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?wr(null,s,null,null,null):_n(s)?wr(Pe,{children:s},null,null,null):s.constructor==null&&s.__b>0?wr(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=t,s.__b=t.__b+1,a=null,(c=s.__i=wy(s,A,o,u))!=-1&&(u--,(a=A[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(i>l?d--:i<l&&d++),typeof s.type!="function"&&(s.__u|=4)):c!=o&&(c==o-1?d--:c==o+1?d++:(c>o?d--:d++,s.__u|=4))):t.__k[r]=null;if(u)for(r=0;r<l;r++)(a=A[r])!=null&&!(2&a.__u)&&(a.__e==n&&(n=Yt(a)),kh(a,a));return n}function yh(t,e,A){var n,i;if(typeof t.type=="function"){for(n=t.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=t,e=yh(n[i],e,A));return e}t.__e!=e&&(e&&t.type&&!A.contains(e)&&(e=Yt(t)),A.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function yr(t,e){return e=e||[],t==null||typeof t=="boolean"||(_n(t)?t.some(function(A){yr(A,e)}):e.push(t)),e}function wy(t,e,A,n){var i,r,s=t.key,a=t.type,o=e[A];if(o===null&&t.key==null||o&&s==o.key&&a==o.type&&!(2&o.__u))return A;if(n>(o!=null&&!(2&o.__u)?1:0))for(i=A-1,r=A+1;i>=0||r<e.length;){if(i>=0){if((o=e[i])&&!(2&o.__u)&&s==o.key&&a==o.type)return i;i--}if(r<e.length){if((o=e[r])&&!(2&o.__u)&&s==o.key&&a==o.type)return r;r++}}return-1}function Uh(t,e,A){e[0]=="-"?t.setProperty(e,A??""):t[e]=A==null?"":typeof A!="number"||vy.test(e)?A:A+"px"}function Ur(t,e,A,n,i){var r;e:if(e=="style")if(typeof A=="string")t.style.cssText=A;else{if(typeof n=="string"&&(t.style.cssText=n=""),n)for(e in n)A&&e in A||Uh(t.style,e,"");if(A)for(e in A)n&&A[e]==n[e]||Uh(t.style,e,A[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Bh,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=A,A?n?A.u=n.u:(A.u=Ja,t.addEventListener(e,r?qa:Xa,r)):t.removeEventListener(e,r?qa:Xa,r);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=A??"";break e}catch{}typeof A=="function"||(A==null||A===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&A==1?"":A))}}function Qh(t){return function(e){if(this.l){var A=this.l[e.type+t];if(e.t==null)e.t=Ja++;else if(e.t<A.u)return;return A(K.event?K.event(e):e)}}}function $a(t,e,A,n,i,r,s,a,o,c){var l,u,d,h,g,f,m,B,b,U,C,w,y,E,S,k,R,P=e.type;if(e.constructor!=null)return null;128&A.__u&&(o=!!(32&A.__u),r=[a=e.__e=A.__e]),(l=K.__b)&&l(e);e:if(typeof P=="function")try{if(B=e.props,b="prototype"in P&&P.prototype.render,U=(l=P.contextType)&&n[l.__c],C=l?U?U.props.value:l.__:n,A.__c?m=(u=e.__c=A.__c).__=u.__E:(b?e.__c=u=new P(B,C):(e.__c=u=new RA(B,C),u.constructor=P,u.render=yy),U&&U.sub(u),u.props=B,u.state||(u.state={}),u.context=C,u.__n=n,d=u.__d=!0,u.__h=[],u._sb=[]),b&&u.__s==null&&(u.__s=u.state),b&&P.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=PA({},u.__s)),PA(u.__s,P.getDerivedStateFromProps(B,u.__s))),h=u.props,g=u.state,u.__v=e,d)b&&P.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),b&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(b&&P.getDerivedStateFromProps==null&&B!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(B,C),!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(B,u.__s,C)===!1||e.__v==A.__v){for(e.__v!=A.__v&&(u.props=B,u.state=u.__s,u.__d=!1),e.__e=A.__e,e.__k=A.__k,e.__k.some(function(D){D&&(D.__=e)}),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(B,u.__s,C),b&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,g,f)})}if(u.context=C,u.props=B,u.__P=t,u.__e=!1,y=K.__r,E=0,b){for(u.state=u.__s,u.__d=!1,y&&y(e),l=u.render(u.props,u.state,u.context),S=0;S<u._sb.length;S++)u.__h.push(u._sb[S]);u._sb=[]}else do u.__d=!1,y&&y(e),l=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++E<25);u.state=u.__s,u.getChildContext!=null&&(n=PA(PA({},n),u.getChildContext())),b&&!d&&u.getSnapshotBeforeUpdate!=null&&(f=u.getSnapshotBeforeUpdate(h,g)),k=l,l!=null&&l.type===Pe&&l.key==null&&(k=Sh(l.props.children)),a=bh(t,_n(k)?k:[k],e,A,n,i,r,s,a,o,c),u.base=e.__e,e.__u&=-161,u.__h.length&&s.push(u),m&&(u.__E=u.__=null)}catch(D){if(e.__v=null,o||r!=null)if(D.then){for(e.__u|=o?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;r[r.indexOf(a)]=null,e.__e=a}else for(R=r.length;R--;)Ya(r[R]);else e.__e=A.__e,e.__k=A.__k;K.__e(D,e,A)}else r==null&&e.__v==A.__v?(e.__k=A.__k,e.__e=A.__e):a=e.__e=by(A.__e,e,A,n,i,r,s,o,c);return(l=K.diffed)&&l(e),128&e.__u?void 0:a}function Eh(t,e,A){for(var n=0;n<A.length;n++)eo(A[n],A[++n],A[++n]);K.__c&&K.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(r){r.call(i)})}catch(r){K.__e(r,i.__v)}})}function Sh(t){return typeof t!="object"||t==null||t.__b&&t.__b>0?t:_n(t)?t.map(Sh):PA({},t)}function by(t,e,A,n,i,r,s,a,o){var c,l,u,d,h,g,f,m=A.props,B=e.props,b=e.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),r!=null){for(c=0;c<r.length;c++)if((h=r[c])&&"setAttribute"in h==!!b&&(b?h.localName==b:h.nodeType==3)){t=h,r[c]=null;break}}if(t==null){if(b==null)return document.createTextNode(B);t=document.createElementNS(i,b,B.is&&B),a&&(K.__m&&K.__m(e,r),a=!1),r=null}if(b==null)m===B||a&&t.data==B||(t.data=B);else{if(r=r&&Cr.call(t.childNodes),m=A.props||xn,!a&&r!=null)for(m={},c=0;c<t.attributes.length;c++)m[(h=t.attributes[c]).name]=h.value;for(c in m)if(h=m[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=h;else if(!(c in B)){if(c=="value"&&"defaultValue"in B||c=="checked"&&"defaultChecked"in B)continue;Ur(t,c,null,h,i)}}for(c in B)h=B[c],c=="children"?d=h:c=="dangerouslySetInnerHTML"?l=h:c=="value"?g=h:c=="checked"?f=h:a&&typeof h!="function"||m[c]===h||Ur(t,c,h,m[c],i);if(l)a||u&&(l.__html==u.__html||l.__html==t.innerHTML)||(t.innerHTML=l.__html),e.__k=[];else if(u&&(t.innerHTML=""),bh(e.type=="template"?t.content:t,_n(d)?d:[d],e,A,n,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,r,s,r?r[0]:A.__k&&Yt(A,0),a,o),r!=null)for(c=r.length;c--;)Ya(r[c]);a||(c="value",b=="progress"&&g==null?t.removeAttribute("value"):g!=null&&(g!==t[c]||b=="progress"&&!g||b=="option"&&g!=m[c])&&Ur(t,c,g,m[c],i),c="checked",f!=null&&f!=t[c]&&Ur(t,c,f,m[c],i))}return t}function eo(t,e,A){try{if(typeof t=="function"){var n=typeof t.__u=="function";n&&t.__u(),n&&e==null||(t.__u=t(e))}else t.current=e}catch(i){K.__e(i,A)}}function kh(t,e,A){var n,i;if(K.unmount&&K.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||eo(n,null,e)),(n=t.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(r){K.__e(r,e)}n.base=n.__P=null}if(n=t.__k)for(i=0;i<n.length;i++)n[i]&&kh(n[i],e,A||typeof t.type!="function");A||Ya(t.__e),t.__c=t.__=t.__e=void 0}function yy(t,e,A){return this.constructor(t,A)}function Uy(t,e,A){var n,i,r,s;e==document&&(e=document.documentElement),K.__&&K.__(t,e),i=(n=typeof A=="function")?null:A&&A.__k||e.__k,r=[],s=[],$a(e,t=(!n&&A||e).__k=za(Pe,null,[t]),i||xn,xn,e.namespaceURI,!n&&A?[A]:i?null:e.firstChild?Cr.call(e.childNodes):null,r,!n&&A?A:i?i.__e:e.firstChild,n,s),Eh(r,t,s)}function Qy(t){function e(A){var n,i;return this.getChildContext||(n=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(r){this.props.value!=r.value&&n.forEach(function(s){s.__e=!0,Za(s)})},this.sub=function(r){n.add(r);var s=r.componentWillUnmount;r.componentWillUnmount=function(){n&&n.delete(r),s&&s.call(r)}}),A.children}return e.__c="__cC"+vh++,e.__=t,e.Provider=e.__l=(e.Consumer=function(A,n){return A.children(n)}).contextType=e,e}Cr=Ch.slice,K={__e:function(t,e,A,n){for(var i,r,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((r=i.constructor)&&r.getDerivedStateFromError!=null&&(i.setState(r.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,n||{}),s=i.__d),s)return i.__E=i}catch(a){t=a}throw t}},fh=0,RA.prototype.setState=function(t,e){var A;A=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=PA({},this.state),typeof t=="function"&&(t=t(PA({},A),this.props)),t&&PA(A,t),t!=null&&this.__v&&(e&&this._sb.push(e),Za(this))},RA.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Za(this))},RA.prototype.render=Pe,Ct=[],ph=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,mh=function(t,e){return t.__v.__b-e.__v.__b},br.__r=0,Bh=/(PointerCapture)$|Capture$/i,Ja=0,Xa=Qh(!1),qa=Qh(!0),vh=0;var Ey=0;function p(t,e,A,n,i,r){e||(e={});var s,a,o=e;if("ref"in o)for(a in o={},e)a=="ref"?s=e[a]:o[a]=e[a];var c={type:t,props:o,key:A,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ey,__i:-1,__u:0,__source:i,__self:r};if(typeof t=="function"&&(s=t.defaultProps))for(a in s)o[a]===void 0&&(o[a]=s[a]);return K.vnode&&K.vnode(c),c}const Sy=`:root,:host{--obi-modal-padding: 48px 48px 32px;--obi-modal-background-color: #FFFFFF;--obi-modal-border-radius: 12px;--obi-modal-shadow: 0px 1px 2px rgba(0, 0, 0, .05);--obi-modal-xsmall-width: 320px;--obi-modal-xsmall-height: 240px;--obi-modal-small-width: 480px;--obi-modal-small-height: 400px;--obi-modal-medium-width: 640px;--obi-modal-medium-height: 545px;--obi-modal-large-width: 1200px;--obi-modal-large-height: 700px;--obi-font-family: "Satoshi", sans-serif;--obi-color-primary: #9500FF;--obi-color-primary-50: color-mix(in srgb, var(--obi-color-primary) 50%, white 50%);--obi-color-primary-30: color-mix(in srgb, var(--obi-color-primary) 30%, white 70%);--obi-color-tint: color-mix(in srgb, var(--obi-color-primary) 5%, white 95%);--obi-color-text: #18181B;--obi-course-color-selected: var(--obi-color-primary-50);--obi-course-color-tint: var(--obi-color-tint);--obi-course-progress-step-completed: #B3B3B3;--obi-course-progress-step-incomplete: #D9D9D9;--obi-course-progress-text-color: #757575;font-family:var(--obi-font-family);color:var(--obi-color-text)}.obi-button{font-family:var(--obi-font-family);color:var(--obi-color-text)}dialog{margin:auto;padding:0;border:none;border-radius:var(--obi-modal-border-radius);box-shadow:var(--obi-modal-shadow);background:var(--obi-modal-background-color);box-sizing:border-box}dialog>.modal-content{padding:var(--obi-modal-padding);box-sizing:border-box}dialog,dialog.modal-medium,dialog>.modal-content,dialog.modal-medium>.modal-content{width:var(--obi-modal-medium-width);min-height:var(--obi-modal-medium-height)}dialog.modal-xsmall,dialog.modal-xsmall>.modal-content{width:var(--obi-modal-xsmall-width);min-height:var(--obi-modal-xsmall-height)}dialog.modal-small,dialog.modal-small>.modal-content{width:var(--obi-modal-small-width);min-height:var(--obi-modal-small-height)}dialog.modal-large,dialog.modal-large>.modal-content{width:var(--obi-modal-large-width);min-height:var(--obi-modal-large-height)}dialog::backdrop{background:rgba(0,0,0,.5)}.tour-content{display:block;width:100%;height:100%}.tour-content .container{box-sizing:border-box;display:flex;flex-direction:column;align-items:center;padding:0;width:100%;height:100%}.tour-content .header{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:100%}.tour-content .title{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:700;font-size:32px;line-height:90%;text-align:center;letter-spacing:-.03em;color:#18181b;margin:0}.tour-content .subtitle{width:100%;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b;margin:0}.tour-content .visual{width:480px;height:240px;margin-top:24px;border-radius:12px;display:flex;align-items:center;justify-content:center;position:relative}.tour-content .description{width:100%;min-height:48px;margin:24px 0 0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:140%;text-align:center;letter-spacing:-.01em;color:#18181b}.tour-content .button-container{display:flex;margin-top:24px;flex-direction:column;align-items:center;gap:16px;width:100%}.tour-content .action-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;min-width:200px;height:40px;background:#303030;border:1px solid #303030;border-radius:4px;cursor:pointer;text-decoration:none}.tour-content .action-button.disabled{opacity:.6;cursor:not-allowed}.tour-content .button-text{height:16px;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:16px;line-height:100%;color:#fbf3ff}.tour.content-area{flex:1;display:flex;flex-direction:column}.obi-close-button{position:absolute;top:24px;right:24px;width:24px;height:24px;cursor:pointer;border:none;background:none;padding:0;display:flex;align-items:center;justify-content:center;z-index:1}.obi-panel{box-sizing:border-box;padding:24px;background-color:#fff;box-shadow:0 16px 32px -4px #0000001f,0 4px 8px -2px #00000014,inset 0 1px #fff9;border-radius:12px}.obi-pill.container{width:96px;height:30px;display:flex;align-items:center;justify-content:center}.obi-pill.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill.container .pill.button{cursor:pointer}.obi-pill.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-pill.container.active .pill{width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill.container.busy,.obi-pill.container.busy .pill{width:220px}.obi-pill2.container{display:flex;align-items:center;justify-content:center}.obi-pill2.container .pill{display:flex;align-items:center;justify-content:center;width:48px;height:6px;opacity:.7;border-radius:3px;background-color:var(--obi-color-primary);transform:translateY(0);transition:width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container .pill.button{cursor:pointer}.obi-pill2.container:not(.active){transition:height 0s linear .15s;height:6px}.obi-pill2.container:not(.active) .pill{transform:translateY(12px);transition:transform 0s linear .15s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out}.obi-pill2.container.active{transition:none;height:30px}.obi-pill2.container.active .pill{transition:transform 0s,width .15s ease-in-out,height .15s ease-in-out,border-radius .15s ease-in-out;width:96px;height:30px;border-radius:15px;opacity:1}.obi-pill2.container.user-speaking .pill{background-color:var(--obi-color-primary-30)}.obi-popout{position:relative;display:inline-block}.obi-popout .obi-popout-target{cursor:pointer;display:inline-block}.obi-popout .content{position:absolute;background-color:#fff0;z-index:100;animation:popout-appear .15s ease-out}@keyframes popout-appear{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.obi-round-button-popout{z-index:600}.obi-round-button{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:50%;padding:0;box-sizing:border-box;background-color:#fff;border:1px solid #D9D9D9;box-shadow:none}.obi-round-button:hover{cursor:pointer}.obi-round-button:disabled{box-shadow:none;background-color:#f0f0f0;color:#999;cursor:not-allowed!important;pointer-events:none}.obi-round-button-title{padding:8px 16px;border-radius:12px;background-color:#fff;color:#000;font-size:14px;font-weight:400;white-space:nowrap;box-shadow:0 4px 12px #00000026,0 2px 4px #0000001a;border:1px solid rgba(0,0,0,.08);z-index:5000;pointer-events:none;-webkit-user-select:none;user-select:none;position:relative}.obi-round-button-title:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid white;filter:drop-shadow(0 2px 2px rgba(0,0,0,.1))}.obi-equaliser{display:flex;align-items:center;gap:2px;height:32px}.obi-equaliser .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-equaliser .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1}.obi-message{display:inline-flex;align-items:center;justify-content:center;min-width:140px;padding:0 15px;text-wrap:nowrap;font-size:16px;font-weight:400;height:30px;box-sizing:border-box;background-color:#fff;border-radius:15px;border:1px solid #D9D9D9}.obi-message.clickable{box-shadow:0 4px 6px #0000001a;cursor:pointer}.obi-loading-dots{display:flex;align-items:center;gap:2px;height:32px}.obi-loading-dots .column{position:relative;display:flex;align-items:center;justify-content:center;width:5px;height:100%}.obi-loading-dots .dot{width:3px;height:3px;border-radius:2px;position:relative;z-index:2}.obi-loading-dots .bar{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;border-radius:2px;z-index:1;height:0px;animation:bounce .9s ease-in-out infinite}@keyframes bounce{0%,60%,to{height:0px}30%{height:16px}}.obi-exit-survey{position:relative;width:320px;margin:0 auto;-webkit-backdrop-filter:none;backdrop-filter:none;background:white;z-index:9999}.obi-exit-survey-container{display:flex;flex-direction:column;align-items:center;padding:0;gap:16px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-header{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-title{width:272px;height:22px;margin:0;font-family:Satoshi,sans-serif;font-size:16px;font-weight:600;line-height:140%;text-align:center;color:#1e1e1e;flex:none;align-self:stretch}.obi-exit-survey-subtitle{width:272px;height:20px;margin:0;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;text-align:center;color:#757575;flex:none;align-self:stretch}.obi-exit-survey-options{display:flex;flex-direction:column;align-items:flex-start;padding:0;gap:4px;width:272px;flex:none;align-self:stretch}.obi-exit-survey-options textarea{height:80px;resize:none;outline:none}.obi-exit-survey-button{box-sizing:border-box;display:flex;flex-direction:row;justify-content:center;align-items:center;padding:12px;gap:8px;width:272px;height:44px;border-radius:12px;cursor:pointer;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-button:hover{transform:translateY(-1px);box-shadow:0 4px 8px #0000001a}.obi-exit-survey-button:active{transform:translateY(0)}.obi-exit-survey-button-continue{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-button-continue:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-button-wrap-up{background:#303030;border:1px solid rgba(217,217,217);color:#fff;font-weight:500}.obi-exit-survey-button-wrap-up:hover{background:#404040;border-color:#d9d9d9}.obi-exit-survey-reason-button{background:rgba(255,255,255);border:1px solid rgba(217,217,217);color:#1e1e1e}.obi-exit-survey-reason-button:hover{background:rgba(255,255,255);border-color:#d9d9d9}.obi-exit-survey-reason-button-secondary{display:flex;flex-direction:row;justify-content:center;align-items:center;padding:4px 6px;gap:8px;width:272px;height:28px;border-radius:4px;cursor:pointer;border:none;background:transparent;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:140%;color:#5a5a5a;flex:none;align-self:stretch;transition:all .2s ease}.obi-exit-survey-reason-button-secondary:hover{background:rgba(0,0,0,.05);color:#3a3a3a}.obi-message-input{display:inline-block;position:relative}.obi-message-input .container{width:212px;height:30px;box-sizing:border-box;background:#FFFFFF;border:1px solid var(--obi-color-primary-30);border-radius:15px;display:flex;align-items:center;flex:none;order:2;flex-grow:0;transition:height .3s ease,border-radius .3s ease;animation:expandMessageInput .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .container{height:auto;min-height:140px;border-radius:15px;align-items:flex-start;padding:8px 0;animation:expandMessageInputWide .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input .field{flex:1 1 0;border:none;background:transparent;outline:none;font-family:Satoshi,sans-serif;font-style:normal;font-weight:400;font-size:14px;line-height:18px;color:#000;padding:4px 3px 0 16px;height:100%;box-sizing:border-box;min-width:0;resize:none;overflow:hidden;scrollbar-width:none;transition:padding .3s ease;animation:fadeInInputField .2s cubic-bezier(.4,0,.2,1) 0s 1 normal both}.obi-message-input.expanded .field{height:auto;min-height:120px;padding:4px 16px;overflow-y:auto;line-height:18px}.obi-message-input .field::placeholder{color:#999}.obi-message-input .field:disabled{cursor:not-allowed;opacity:.6}.obi-message-input .send{position:absolute;bottom:3px;right:4px;flex-shrink:0;width:24px;height:24px;background:var(--obi-color-primary);border:none;border-radius:9999px;display:flex;justify-content:center;align-items:center;cursor:pointer;transition:all .3s ease;color:#fff}.obi-message-input.expanded .send{width:28px;height:28px;position:relative;top:0;bottom:0;margin-right:0}.obi-message-input.expanded .button-container{display:flex;justify-content:space-between;align-items:center;width:100%;margin-top:8px}.obi-message-input .send:disabled{background:#CCCCCC;cursor:not-allowed;transform:none}.obi-message-input .container:focus-within{border-color:var(--obi-color-primary);box-shadow:0 0 0 2px #9008ff1a}@keyframes expandMessageInput{0%{width:32px}to{width:212px}}@keyframes expandMessageInputWide{0%{width:212px}to{width:340px}}@keyframes fadeInInputField{0%{opacity:0}60%{opacity:0}to{opacity:1}}.obi-course-progress{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:6px;width:100%;min-width:0;height:24px;flex:none;order:1;align-self:stretch;flex-grow:0}.obi-course-progress-steps{display:flex;flex-direction:row;align-items:center;justify-content:space-between;padding:0;gap:2px;width:100%;height:6px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-container{display:flex;flex-direction:column;justify-content:center;align-items:stretch;padding:2px 0;height:6px;flex:1;min-width:0}.obi-course-progress-step{width:100%;height:2px;background:var(--obi-course-progress-step-incomplete);border-radius:24px;flex:none;order:0;align-self:stretch;flex-grow:0}.obi-course-progress-step.completed{background:var(--obi-course-progress-step-completed)}.obi-course-progress-description{width:100%;height:14px;font-family:var(--obi-font-family);font-style:normal;font-weight:500;font-size:14px;line-height:100%;color:var(--obi-course-progress-text-color);flex:none;order:1;flex-grow:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.obi-widget-popout{z-index:400}.obi-widget-panel{display:flex;flex-direction:column;gap:8px;align-items:center;justify-content:center;min-width:222px;width:min-content;padding:12px;box-sizing:border-box;border-radius:27px;background:white;transition:background .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel:not(.messaging){width:256px}.obi-widget-panel.tool-usage{width:384px}.obi-widget-panel:not(.expanded){background:transparent;border:none;box-shadow:none;transition:background .1s ease-out .1s,border .1s ease-out .1s,box-shadow .1s ease-out .1s}.obi-widget-panel.maximized{transform:translateY(-110px)}.obi-widget-panel .obi-widget{display:flex;align-items:center;min-width:192px;padding-left:58px;box-sizing:border-box;gap:4px}.obi-widget-panel .obi-widget.active.in-plan{padding-left:0}.obi-widget-panel .obi-widget.active.in-plan .obi-round-button{animation:fade-in-button .2s ease-out .15s both}.obi-widget-panel .obi-widget.active .obi-equaliser{animation:fade-in-equaliser .2s ease-out .15s both}@keyframes fade-in-button{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes fade-in-equaliser{0%{opacity:0}to{opacity:1}}.obi-widget-panel .obi-course-progress-container{display:none;width:100%;max-height:0;opacity:0;transform:translateY(-10px);overflow:hidden;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,transform .3s ease-in-out}.obi-widget-panel:hover .obi-course-progress-container{display:block;max-width:22 0px;animation:expand-course-progress .3s ease-in-out forwards}.obi-widget-panel:hover .obi-course-progress-container.expanded{max-width:330px}@keyframes expand-course-progress{0%{max-height:0;opacity:0;transform:translateY(-10px)}to{max-height:40px;opacity:1;transform:translateY(0)}}.obi-widget-pill-text{font-size:16px;font-weight:400;color:#fff;opacity:0;animation:fade-in-pill-text .3s ease-in-out forwards}@keyframes fade-in-pill-text{0%{opacity:0}40%{opacity:0}to{opacity:1}}.obi-widget-buttons{display:flex;flex-direction:row;gap:4px}.obi-widget-out-of-plan{display:flex;align-items:center;gap:4px}.obi-widget-out-of-plan .text{color:#fff;animation:fade-in-pill-text .3s ease-in-out forwards}.obi-widget-out-of-plan .round-button{display:none;animation:fade-in-button .2s ease-out .15s both}.obi-widget-out-of-plan .message{display:none}.obi-widget-out-of-plan.active:hover .round-button,.obi-widget-out-of-plan.active:hover .message,.obi-widget-out-of-plan.active.hover .round-button,.obi-widget-out-of-plan.active.hover .message{display:flex}.tour-select{display:block;font-family:Inter,sans-serif}.course-container{display:flex;padding:20px;align-items:flex-start;gap:8px;height:180px;border-radius:6px;border:1px solid rgba(0,0,0,.6);background:#fff;cursor:pointer;transition:all .2s;flex-direction:column;box-sizing:border-box;overflow:hidden}.course-container:hover{background-color:#f9fafb;border-color:#d1d5db;box-shadow:0 1px 2px #0000000d}.course-container:active{transform:scale(.98)}.course-container.selected{border-radius:6px;border:1px solid var(--obi-course-color-selected);background:var(--obi-course-color-tint)}.course-container.selected:hover{background:var(--obi-course-color-tint)}.header-row{display:flex;justify-content:space-between;align-items:flex-start;align-self:stretch;flex-shrink:0;text-align:left}.course-title{color:#000;font-family:Inter,sans-serif;font-size:20px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.2px;margin:0}.duration{display:flex;padding:4px 12px;justify-content:center;align-items:center;gap:8px;border-radius:9999px;background:var(--obi-course-color-tint);color:#000;font-family:Inter,sans-serif;font-size:14px;font-style:normal;font-weight:500;line-height:100%;letter-spacing:-.14px;flex-shrink:0}.course-container.selected .duration{background:#fff}.course-description{flex:1 0 0;color:#0009;font-family:Inter,sans-serif;font-size:16px;font-style:normal;font-weight:400;line-height:140%;letter-spacing:-.16px;margin:0;overflow:hidden;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;text-align:left}.course-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:4px;padding:0;flex:1 0 0;align-self:stretch;min-height:364px}.controls{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.tabs{display:flex;gap:10px}.tab{display:flex;padding:6px 12px;justify-content:center;align-items:center;align-self:stretch;border:none;background:none;cursor:pointer;font-family:Inter,sans-serif;font-size:16px;font-weight:500;color:#0006;border-bottom:2px solid transparent;transition:all .2s}.tab.active{color:#000;border-bottom:2px solid var(--obi-color-primary)}.tab:hover{color:#000}.filter{position:relative;display:flex;align-items:center;width:336px;height:40px}.filter input{color:var(--obi-color-text);caret-color:var(--obi-color-text);padding:8px 12px 8px 36px;border-radius:6px;border:1px solid rgba(0,0,0,.1);background:#fff;font-family:Inter,sans-serif;font-size:14px;line-height:20px;width:100%;height:100%;box-sizing:border-box;outline:none}.filter input:focus{outline:1px solid var(--obi-color-primary);outline-offset:-1px}.filter input::placeholder{color:#0006}.filter svg{position:absolute;left:12px;pointer-events:none}@media (max-width: 767px){.course-grid{grid-template-columns:1fr}}.loading,.error,.empty{display:flex;justify-content:center;align-items:center;margin-top:16px}.error{color:#ef4444}.tour-select-modal-container{display:flex;flex-direction:column;align-items:center;gap:24px;flex:1 0 0;align-self:stretch;font-family:Satoshi,sans-serif;color:#000;text-align:center;max-width:1200px;width:100%;min-height:600px;box-sizing:border-box}.course-list-wrapper{flex:1;overflow-y:auto;width:100%;min-height:0;max-height:424px;padding-right:3px;box-sizing:border-box}.course-list-wrapper::-webkit-scrollbar{width:3px}.course-list-wrapper::-webkit-scrollbar-track{background:transparent}.course-list-wrapper::-webkit-scrollbar-thumb{background-color:#000;border-radius:2px;min-height:20px}.course-list-wrapper::-webkit-scrollbar-thumb:hover{background-color:#333}.header{display:flex;align-items:flex-start;gap:16px;width:100%;text-align:left}.icon{display:flex;width:56px;height:56px;padding:12px;justify-content:center;align-items:center;border-radius:12px;border:1px solid var(--obi-color-primary);background:var(--obi-color-primary);box-sizing:border-box}.icon img{width:32px;height:32px;color:#fff;fill:#fff}.title-section{align-self:stretch;flex:1}.tour-select-modal-container h1{color:#18181b;font-family:Satoshi;font-size:32px;font-style:normal;font-weight:700;line-height:90%;letter-spacing:-.96px;margin:0 0 8px}.subtitle{color:#18181b;font-family:Satoshi;font-size:20px;font-style:normal;font-weight:500;line-height:90%;letter-spacing:-.6px;margin:0}.footer{display:flex;width:360px;flex-direction:column;align-items:center;gap:12px}.footer-button{display:flex;height:48px;padding:16px;justify-content:center;align-items:center;gap:8px;align-self:stretch;border-radius:6px;background:#18181b;border:none;cursor:pointer;color:#fafafa;font-family:Satoshi;font-weight:500;transition:opacity .2s ease}.footer-button:disabled{opacity:.5;cursor:not-allowed}.footer-button:not(:disabled){opacity:1}.footer-button:not(:disabled):hover{background:#27272a}.footer-text{color:#18181b;font-family:Satoshi;font-size:12px;font-style:normal;font-weight:400;line-height:100%;letter-spacing:-.12px;margin:0;text-align:center}.skeleton{background:linear-gradient(90deg,#e5e7eb 25%,#f3f4f6 50%,#e5e7eb 75%);background-size:200% 100%;animation:loading 1.5s infinite;border-radius:4px}@keyframes loading{0%{background-position:200% 0}to{background-position:-200% 0}}.skeleton-title{height:32px;width:60%;margin-bottom:12px}.skeleton-subtitle{height:20px;width:80%}
47
+ `;var wt,se,Ao,Th,Pn=0,Fh=[],pe=K,Ih=pe.__b,xh=pe.__r,_h=pe.diffed,Ph=pe.__c,Rh=pe.unmount,Lh=pe.__;function Rn(t,e){pe.__h&&pe.__h(se,t,Pn||e),Pn=0;var A=se.__H||(se.__H={__:[],__h:[]});return t>=A.__.length&&A.__.push({}),A.__[t]}function Z(t){return Pn=1,ky(Oh,t)}function ky(t,e,A){var n=Rn(wt++,2);if(n.t=t,!n.__c&&(n.__=[A?A(e):Oh(void 0,e),function(a){var o=n.__N?n.__N[0]:n.__[0],c=n.t(o,a);o!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=se,!se.__f)){var i=function(a,o,c){if(!n.__c.__H)return!0;var l=n.__c.__H.__.filter(function(d){return!!d.__c});if(l.every(function(d){return!d.__N}))return!r||r.call(this,a,o,c);var u=n.__c.props!==a;return l.forEach(function(d){if(d.__N){var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(u=!0)}}),r&&r.call(this,a,o,c)||u};se.__f=!0;var r=se.shouldComponentUpdate,s=se.componentWillUpdate;se.componentWillUpdate=function(a,o,c){if(this.__e){var l=r;r=void 0,i(a,o,c),r=l}s&&s.call(this,a,o,c)},se.shouldComponentUpdate=i}return n.__N||n.__}function Ge(t,e){var A=Rn(wt++,3);!pe.__s&&ro(A.__H,e)&&(A.__=t,A.u=e,se.__H.__h.push(A))}function to(t,e){var A=Rn(wt++,4);!pe.__s&&ro(A.__H,e)&&(A.__=t,A.u=e,se.__h.push(A))}function QA(t){return Pn=5,no(function(){return{current:t}},[])}function no(t,e){var A=Rn(wt++,7);return ro(A.__H,e)&&(A.__=t(),A.__H=e,A.__h=t),A.__}function Ty(t,e){return Pn=8,no(function(){return t},e)}function Dh(t){var e=se.context[t.__c],A=Rn(wt++,9);return A.c=t,e?(A.__==null&&(A.__=!0,e.sub(se)),e.props.value):t.__}function Fy(){for(var t;t=Fh.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(Qr),t.__H.__h.forEach(io),t.__H.__h=[]}catch(e){t.__H.__h=[],pe.__e(e,t.__v)}}pe.__b=function(t){se=null,Ih&&Ih(t)},pe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Lh&&Lh(t,e)},pe.__r=function(t){xh&&xh(t),wt=0;var e=(se=t.__c).__H;e&&(Ao===se?(e.__h=[],se.__h=[],e.__.forEach(function(A){A.__N&&(A.__=A.__N),A.u=A.__N=void 0})):(e.__h.forEach(Qr),e.__h.forEach(io),e.__h=[],wt=0)),Ao=se},pe.diffed=function(t){_h&&_h(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Fh.push(e)!==1&&Th===pe.requestAnimationFrame||((Th=pe.requestAnimationFrame)||Iy)(Fy)),e.__H.__.forEach(function(A){A.u&&(A.__H=A.u),A.u=void 0})),Ao=se=null},pe.__c=function(t,e){e.some(function(A){try{A.__h.forEach(Qr),A.__h=A.__h.filter(function(n){return!n.__||io(n)})}catch(n){e.some(function(i){i.__h&&(i.__h=[])}),e=[],pe.__e(n,A.__v)}}),Ph&&Ph(t,e)},pe.unmount=function(t){Rh&&Rh(t);var e,A=t.__c;A&&A.__H&&(A.__H.__.forEach(function(n){try{Qr(n)}catch(i){e=i}}),A.__H=void 0,e&&pe.__e(e,A.__v))};var Hh=typeof requestAnimationFrame=="function";function Iy(t){var e,A=function(){clearTimeout(n),Hh&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(A,100);Hh&&(e=requestAnimationFrame(A))}function Qr(t){var e=se,A=t.__c;typeof A=="function"&&(t.__c=void 0,A()),se=e}function io(t){var e=se;t.__c=t.__(),se=e}function ro(t,e){return!t||t.length!==e.length||e.some(function(A,n){return A!==t[n]})}function Oh(t,e){return typeof e=="function"?e(t):e}function xy({size:t=24,color:e="#000"}){return p("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:e,"stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-x-icon lucide-x",children:[p("path",{d:"M18 6 6 18"}),p("path",{d:"m6 6 12 12"})]})}function Mh({onClose:t}){return p("button",{class:"obi-button obi-close-button",onClick:t,"aria-label":"Close",type:"button",children:p(xy,{})})}function Nh({open:t=!1,children:e,onClose:A,size:n="medium"}){const i=QA(null),r=QA(null);Ge(()=>{const c=i.current;c&&(t&&!c.open?c.showModal():!t&&c.open&&(r.current="programmatic",c.close()))},[t]);const s=c=>{const l=i.current;c.target===l&&(r.current="user-initiated",l==null||l.close())},a=c=>{c.preventDefault(),r.current||(r.current="user-initiated");const l=r.current;r.current=null,A==null||A(l)},o=()=>{var c;r.current="user-initiated",(c=i.current)==null||c.close()};return Ge(()=>{const c=i.current;if(c)return c.addEventListener("click",s),c.addEventListener("close",a),()=>{c.removeEventListener("click",s),c.removeEventListener("close",a)}},[A]),p("dialog",{ref:i,className:`modal-${n}`,children:[p(Mh,{onClose:o}),p("div",{class:"modal-content",children:t?typeof e=="function"?e():e:null})]})}function so(t){const{children:e,className:A="",...n}=t;return p("div",{className:`${A} obi-panel`,...n,children:e})}function ao({className:t="",isActive:e=!1,speakingStatus:A,onClick:n,onMouseEnter:i,onMouseLeave:r,children:s}){let a=`obi-pill container ${e&&"active"}`;return A==="user-speaking"&&(a+=" user-speaking"),A==="busy"&&(a+=" busy"),p("div",{className:a,onMouseEnter:i,onMouseLeave:r,children:p("div",{className:`obi-pill pill ${t}`,onClick:n,children:s})})}function Kh({className:t="",active:e,speakingStatus:A,onClick:n,onMouseEnter:i,onMouseLeave:r,children:s,...a}){const o=`obi-pill2 container ${e?"active":""} ${A==="user-speaking"?"user-speaking":""} ${t}`;return p("div",{className:o,...a,children:p("div",{className:"pill",onClick:n,onMouseEnter:i,onMouseLeave:r,children:s})})}function bt({type:t,size:e=24}){return p("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:_y(t)})}function _y(t){switch(t){case"pause":return p(Pe,{children:[p("rect",{x:"14",y:"3",width:"5",height:"18",rx:"1"}),p("rect",{x:"5",y:"3",width:"5",height:"18",rx:"1"})]});case"play":return p(Pe,{children:p("path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z"})});case"close":return p(Pe,{children:[p("path",{d:"M18 6 6 18"}),p("path",{d:"m6 6 12 12"})]});case"message":return p(Pe,{children:p("path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z"})});case"minimize":return p(Pe,{children:[p("path",{d:"m14 10 7-7"}),p("path",{d:"M20 10h-6V4"}),p("path",{d:"m3 21 7-7"}),p("path",{d:"M4 14h6v6"})]});case"voice":return p(Pe,{children:[p("path",{d:"M2 10v3"}),p("path",{d:"M6 6v11"}),p("path",{d:"M10 3v18"}),p("path",{d:"M14 8v7"}),p("path",{d:"M18 5v13"}),p("path",{d:"M22 10v3"})]});case"open":return p(Pe,{children:[p("path",{d:"M12 7v14"}),p("path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"})]})}}const oo=Qy(null);function Py({children:t}){const e=Dh(oo);if(!e)throw new Error("PopoutTarget must be used within a Popout component");const{controlledOpen:A,isOpen:n,setIsOpen:i,setAnimating:r,targetRef:s,trigger:a,onChange:o,delayMs:c}=e,l=QA(null),u=Vh(s,r),[d,h]=Z(!1);Ge(()=>{A!==void 0&&A!==d&&(A?f():m()),h(A)},[A]),Ge(()=>()=>{l.current&&clearTimeout(l.current)},[]);function g(){l.current&&(clearTimeout(l.current),l.current=null)}function f(){g(),c>0?l.current=setTimeout(()=>{o==null||o(!0),i(!0),l.current=null},c):(o==null||o(!0),i(!0))}function m(){g(),o==null||o(!1),i(!1)}const B=()=>{a==="click"&&(n?m():f())};function b(){a==="hover"&&f()}function U(){a==="hover"&&m()}return p("div",{ref:u,class:"target",onClick:B,onMouseEnter:b,onMouseLeave:U,children:t})}function Ry({children:t}){const e=Dh(oo);if(!e)throw new Error("PopoutContent must be used within a Popout component");const{isOpen:A,animating:n,setAnimating:i,targetRef:r,contentRef:s}=e,a=Vh(s,i);return to(()=>{if(A&&!n&&r.current&&s.current){const o=s.current;if(!o)return;const c=r.current;if(!c)return;const l=o.getBoundingClientRect(),u=c.getBoundingClientRect(),d=u.right-u.left;o.style.top=`${l.top-l.bottom-(8+e.offset)}px`,o.style.left=`${-(l.right-l.left-d)/2}px`}},[A,n]),A?p("div",{ref:a,class:"content",style:{opacity:n?0:1},children:t}):null}function je({trigger:t="click",open:e,onChange:A,children:n,delayMs:i=0,offset:r=0,className:s=""}){const[a,o]=Z(!1),[c,l]=Z(!1),u=QA(null),d=QA(null),h={controlledOpen:e,isOpen:a,setIsOpen:o,animating:c,setAnimating:l,targetRef:u,contentRef:d,trigger:t,onChange:A,delayMs:i,offset:r};return p(oo.Provider,{value:h,children:p("div",{class:`obi-popout ${s}`,children:n})})}je.Target=Py,je.Content=Ry;function Vh(t,e){const A=QA(null),n=QA(null),i=QA(!0),r=Ty(s=>{if(t.current=s,!s){n.current&&(n.current.disconnect(),n.current=null),i.current=!0;return}function a(){if(i.current){i.current=!1;return}A.current?clearTimeout(A.current):e(!0),A.current=setTimeout(()=>{e(!1),A.current=null},200)}n.current=new ResizeObserver(a),n.current.observe(s,{box:"border-box"})},[]);return Ge(()=>()=>{n.current&&(n.current.disconnect(),n.current=null)},[]),r}function gA({className:t,onClick:e,type:A,disabled:n,title:i}){const r={cancel:p(bt,{type:"close",size:16}),pause:p(bt,{type:"pause",size:16}),play:p(bt,{type:"play",size:16}),message:p(bt,{type:"message",size:16}),minimize:p(bt,{type:"minimize",size:16}),voice:p(bt,{type:"voice",size:16}),open:p(bt,{type:"open",size:16})}[A],s={cancel:"",pause:"",play:"",message:"",minimize:"",voice:"",open:""}[A],a=p("button",{class:`obi-button obi-round-button ${s} ${t}`,onClick:n?void 0:e,disabled:n,children:r});return i?p(je,{className:"obi-round-button-popout",trigger:"hover",delayMs:200,offset:9,children:[p(je.Target,{children:a}),p(je.Content,{children:p("div",{className:"obi-round-button-title",children:i})})]}):a}const Gh=8,Er=8,Ly=50,Dy=.7,zt=3;function jh({getBands:t,color:e="white"}){const A=QA(null);return Ge(()=>{if(!t)return;const n=setInterval(()=>{try{const i=t();if(!A.current)return;const r=A.current.querySelectorAll(".bar"),s=i&&i.length>0?i.slice(0,Er).map(a=>{const o=Math.abs(a);return Math.min(o/Dy*Gh,Gh)||zt}):Array(Er).fill(zt);for(;s.length<Er;)s.push(zt);s.forEach((a,o)=>{if(a<zt&&(a=zt),r[o]){const c=a*2;r[o].style.height=`${c}px`,r[o].style.display=a>0?"block":"none"}})}catch(i){console.warn("Error updating equaliser:",i)}},Ly);return()=>{clearInterval(n)}},[t]),p("div",{className:"obi-equaliser",ref:A,children:Array.from({length:Er},(n,i)=>p("div",{className:"column",children:p("div",{className:"bar",style:{height:`${zt}px`,backgroundColor:e,display:"block"}})},i))})}function Ln({className:t,children:e,onClick:A}){return A?p("button",{class:`obi-button obi-message ${t} clickable`,onClick:A,children:e}):p("div",{class:`obi-message ${t}`,children:e})}const Hy=8;function Wh({color:t="white"}){return p("div",{className:"obi-loading-dots",children:Array.from({length:Hy},(e,A)=>p("div",{className:"column",children:[p("div",{className:"bar",style:{backgroundColor:t,animationDelay:`${A*.15}s`}}),p("div",{className:"dot",style:{backgroundColor:t}})]},A))})}function Oy({onContinue:t,onWrapUp:e}){return p(so,{className:"obi-exit-survey",children:p(Ny,{onContinue:t,onWrapUp:()=>{e()}})})}function My({onReasonSelect:t,onClose:e}){const[A,n]=Z("reason"),i=r=>{r==="other"?n("other-reason"):t(r)};return p(so,{className:`obi-exit-survey ${A==="reason"?"obi-exit-survey-reason":""}`,children:A==="reason"?p(Ky,{onReasonSelect:i}):p(Vy,{onReasonSelect:i,onClose:e})})}function Ny({onContinue:t,onWrapUp:e}){return p("div",{className:"obi-exit-survey-container",children:[p("h2",{className:"obi-exit-survey-title",children:"Wrapping up early?"}),p("div",{className:"obi-exit-survey-options",children:[p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-button-continue",onClick:t,type:"button",children:"No, let's continue"}),p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-button-wrap-up",onClick:e,type:"button",children:"Yes, let's wrap up"})]})]})}function Ky({onReasonSelect:t}){return p("div",{className:"obi-exit-survey-container obi-exit-survey-reason-container",children:[p("div",{className:"obi-exit-survey-header",children:p("h2",{className:"obi-exit-survey-title obi-exit-survey-reason-title",children:"Quick feedback?"})}),p("div",{className:"obi-exit-survey-options obi-exit-survey-reason-options",children:[p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("testing"),type:"button",children:"Will do later"}),p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("no-time"),type:"button",children:"Can't talk right now"}),p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("format-mismatch"),type:"button",children:"Prefer written instructions"}),p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("technical-issue"),type:"button",children:"Experienced technical issues"}),p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-reason-button",onClick:()=>t("other"),type:"button",children:"Other"})]})]})}function Vy({onReasonSelect:t,onClose:e}){return p("div",{className:"obi-exit-survey-container obi-exit-survey-reason-container",children:[p("div",{className:"obi-exit-survey-header",children:[p(Mh,{onClose:e}),p("h2",{className:"obi-exit-survey-title obi-exit-survey-reason-title",children:"Tell us more"})]}),p("div",{className:"obi-exit-survey-options obi-exit-survey-reason-options",children:[p("textarea",{className:"obi-exit-survey-button obi-exit-survey-reason-button",placeholder:"What's on your mind?"}),p("button",{className:"obi-button obi-exit-survey-button obi-exit-survey-button-wrap-up",onClick:()=>t("other-feedback"),type:"button",children:"Send feedback"})]})]})}function Gy(t,e){for(var A in e)t[A]=e[A];return t}function Jh(t,e){for(var A in t)if(A!=="__source"&&!(A in e))return!0;for(var n in e)if(n!=="__source"&&t[n]!==e[n])return!0;return!1}function Xh(t,e){this.props=t,this.context=e}(Xh.prototype=new RA).isPureReactComponent=!0,Xh.prototype.shouldComponentUpdate=function(t,e){return Jh(this.props,t)||Jh(this.state,e)};var qh=K.__b;K.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),qh&&qh(t)};var jy=K.__e;K.__e=function(t,e,A,n){if(t.then){for(var i,r=e;r=r.__;)if((i=r.__c)&&i.__c)return e.__e==null&&(e.__e=A.__e,e.__k=A.__k),i.__c(t,e)}jy(t,e,A,n)};var Yh=K.unmount;function zh(t,e,A){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),t.__c.__H=null),(t=Gy({},t)).__c!=null&&(t.__c.__P===A&&(t.__c.__P=e),t.__c.__e=!0,t.__c=null),t.__k=t.__k&&t.__k.map(function(n){return zh(n,e,A)})),t}function Zh(t,e,A){return t&&A&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(n){return Zh(n,e,A)}),t.__c&&t.__c.__P===e&&(t.__e&&A.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=A)),t}function co(){this.__u=0,this.o=null,this.__b=null}function $h(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function Sr(){this.i=null,this.l=null}K.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Yh&&Yh(t)},(co.prototype=new RA).__c=function(t,e){var A=e.__c,n=this;n.o==null&&(n.o=[]),n.o.push(A);var i=$h(n.__v),r=!1,s=function(){r||(r=!0,A.__R=null,i?i(a):a())};A.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var o=n.state.__a;n.__v.__k[0]=Zh(o,o.__c.__P,o.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&e.__u||n.setState({__a:n.__b=n.__v.__k[0]}),t.then(s,s)},co.prototype.componentWillUnmount=function(){this.o=[]},co.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var A=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=zh(this.__b,A,n.__O=n.__P)}this.__b=null}var i=e.__a&&za(Pe,null,t.fallback);return i&&(i.__u&=-33),[za(Pe,null,e.__a?null:t.children),i]};var ef=function(t,e,A){if(++A[1]===A[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(A=t.i;A;){for(;A.length>3;)A.pop()();if(A[1]<A[0])break;t.i=A=A[2]}};(Sr.prototype=new RA).__a=function(t){var e=this,A=$h(e.__v),n=e.l.get(t);return n[0]++,function(i){var r=function(){e.props.revealOrder?(n.push(i),ef(e,t,n)):i()};A?A(r):r()}},Sr.prototype.render=function(t){this.i=null,this.l=new Map;var e=yr(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var A=e.length;A--;)this.l.set(e[A],this.i=[1,0,this.i]);return t.children},Sr.prototype.componentDidUpdate=Sr.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,A){ef(t,A,e)})};var Wy=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Jy=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xy=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,qy=/[A-Z0-9]/g,Yy=typeof document<"u",zy=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};RA.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(RA.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Af=K.event;function Zy(){}function $y(){return this.cancelBubble}function eU(){return this.defaultPrevented}K.event=function(t){return Af&&(t=Af(t)),t.persist=Zy,t.isPropagationStopped=$y,t.isDefaultPrevented=eU,t.nativeEvent=t};var AU={enumerable:!1,configurable:!0,get:function(){return this.class}},tf=K.vnode;K.vnode=function(t){typeof t.type=="string"&&function(e){var A=e.props,n=e.type,i={},r=n.indexOf("-")===-1;for(var s in A){var a=A[s];if(!(s==="value"&&"defaultValue"in A&&a==null||Yy&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var o=s.toLowerCase();s==="defaultValue"&&"value"in A&&A.value==null?s="value":s==="download"&&a===!0?a="":o==="translate"&&a==="no"?a=!1:o[0]==="o"&&o[1]==="n"?o==="ondoubleclick"?s="ondblclick":o!=="onchange"||n!=="input"&&n!=="textarea"||zy(A.type)?o==="onfocus"?s="onfocusin":o==="onblur"?s="onfocusout":Xy.test(s)&&(s=o):o=s="oninput":r&&Jy.test(s)?s=s.replace(qy,"-$&").toLowerCase():a===null&&(a=void 0),o==="oninput"&&i[s=o]&&(s="oninputCapture"),i[s]=a}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=yr(A.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=yr(A.children).forEach(function(c){c.props.selected=i.multiple?i.defaultValue.indexOf(c.props.value)!=-1:i.defaultValue==c.props.value})),A.class&&!A.className?(i.class=A.class,Object.defineProperty(i,"className",AU)):(A.className&&!A.class||A.class&&A.className)&&(i.class=i.className=A.className),e.props=i}(t),t.$$typeof=Wy,tf&&tf(t)};var nf=K.__r;K.__r=function(t){nf&&nf(t),t.__c};var rf=K.diffed;K.diffed=function(t){rf&&rf(t);var e=t.props,A=t.__e;A!=null&&t.type==="textarea"&&"value"in e&&e.value!==A.value&&(A.value=e.value==null?"":e.value)};function tU(t){const{placeholder:e="Type your message...",value:A,defaultValue:n,onChange:i,onSend:r,onCancel:s,onExpand:a,isLoading:o=!1,disabled:c=!1,maxLength:l=500,children:u}=t,[d,h]=Z(A||n||""),[g,f]=Z((A||n||"").length>24),m=QA(null);to(()=>{g&&(a==null||a(!0))},[]);const B=A!==void 0?A:d,b=w=>{const y=w.currentTarget.value;A===void 0&&h(y),i==null||i(y)},U=w=>{w.key==="Escape"&&(h(A||n||""),f(!1),s==null||s()),w.key==="Enter"&&!w.shiftKey&&B.trim()&&(w.preventDefault(),h(A||n||""),f(!1),C()),(B||"").length>=24&&!g&&(f(!0),a==null||a(!0))};Ge(()=>{m.current&&m.current.focus()},[m.current]);const C=()=>{!B.trim()||o||c||(r==null||r(B.trim()),A===void 0&&h(""))};return p("div",{className:`obi-message-input ${g?"expanded":""}`,children:[p("div",{className:"container",children:p("textarea",{ref:m,className:"field",placeholder:e,value:B,onInput:b,onKeyDown:U,disabled:c||o,maxLength:l,rows:1})}),p("div",{className:"button-container",children:[g&&p("div",{children:u}),p("button",{className:"obi-button send",onClick:C,disabled:!B.trim()||o||c,type:"button",children:p("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p("path",{d:"M6.00016 10.6673V1.33398M6.00016 1.33398L1.3335 6.00065M6.00016 1.33398L10.6668 6.00065",stroke:"#F3F3F3","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"})})})]})]})}function nU(t){const{currentStep:e,totalSteps:A,stepNames:n,className:i}=t,r=Array.from({length:A},(o,c)=>({isCompleted:c<e,stepNumber:c+1})),s=n[e-1]||`Step ${e}`,a=`${e}/${A} • ${s}`;return p("div",{class:`obi-course-progress ${i||""}`,children:[p("div",{class:"obi-course-progress-steps",children:r.map((o,c)=>p("div",{class:"obi-course-progress-container",children:p("div",{class:`obi-course-progress-step ${o.isCompleted?"completed":""}`})},c))}),p("div",{class:"obi-course-progress-description",children:a})]})}function iU(t){const{disabled:e,inPlan:A,isPaused:n}=t,[i,r]=Z(null),[s,a]=Z(t.isActive??t.defaultIsActive??!1),[o,c]=Z(!1),[l,u]=Z(t.cancelling??!1),[d,h]=Z(t.messaging??!1),[g,f]=Z(!1),[m,B]=Z(!1);to(()=>{t.messaging!==void 0&&h(t.messaging)},[t.messaging]);function b(){a(!0),c(!1),B(!0),t.messaging!==void 0&&h(t.messaging)}function U(){}function C(){i&&(clearTimeout(i),r(null))}function w(){r(setTimeout(()=>{a(t.defaultIsActive??!1),B(!1)},400))}function y(oe){var Je;f(!1),(Je=t.onMessage)==null||Je.call(t,oe)}function E(){h(!1),f(!1),a(!1),c(!0)}function S(){h(!1),u(!0),f(!1)}function k(){var oe;A||((oe=t.onOpen)==null||oe.call(t))}function R(){var oe;(oe=t.onMessage)==null||oe.call(t,"Okay, let's continue.")}function P(oe){var Je;t.messaging===void 0&&((Je=t.onMessagingChange)==null||Je.call(t,oe),h(oe)),oe||f(!1)}const D=t.isActive??((s||A)&&!o&&!e),M=D&&A,ae=D&&A&&!g,N=t.speakingStatus==="user-speaking",V=t.speakingStatus==="thinking",Fe=t.speakingStatus==="busy",ve=D&&!A&&!l&&m,Ce=D&&A&&n&&!N&&!l,tA=D&&A&&n&&N&&!l,Le=D&&A&&!n&&N&&!l,we=D&&A&&!n&&Fe&&!l,nA=d&&N,Ye=ve||Ce||tA||Le||l,Ie=400,it=D&&A&&!g,We=ve?5:10;return!A&&!l?p(rU,{...t}):!A&&l?p(sU,{onCancelReason:oe=>{var Je;a(t.defaultIsActive??!1),u(!1),(Je=t.onCancelReason)==null||Je.call(t,oe)},onClose:()=>{a(t.defaultIsActive??!1),u(!1)}}):p(so,{className:`obi-widget-panel ${M?"expanded":""} ${g?"maximized":""} ${d?"messaging":""} ${Fe?"tool-usage":""}`,children:[p("div",{className:`obi-widget ${D?"active":""} ${A?"in-plan":""}`,onMouseEnter:C,onMouseLeave:w,children:[ae&&p(gA,{type:"cancel",onClick:S,disabled:l,title:"Cancel session"}),ae&&!n&&p(gA,{type:"pause",onClick:t.onPause,title:"Pause session"}),ae&&n&&p(gA,{type:"play",onClick:t.onUnpause,title:"Unpause session"}),p(je,{className:"obi-widget-popout",open:Ye,trigger:null,delayMs:Ie,offset:We,children:[p(je.Target,{children:[nA&&p(tU,{value:t.message,defaultValue:"Okay, let's continue.",onCancel:()=>P(!1),onSend:y,onExpand:f,children:p("div",{className:"obi-widget-buttons",children:[p(gA,{type:"cancel",onClick:S,disabled:l,title:"Cancel session"}),!n&&p(gA,{type:"pause",onClick:t.onPause,title:"Pause session"}),n&&p(gA,{type:"play",onClick:t.onUnpause,title:"Unpause session"}),p(gA,{type:d?"voice":"message",disabled:!N||t.messaging!==void 0,onClick:()=>P(!d),title:d?"Voice input":"Text input"}),p(gA,{type:"minimize",onClick:E,title:"Minimize widget"})]})}),!nA&&p(ao,{className:D&&!A?"button":"",isActive:D,speakingStatus:t.speakingStatus,onClick:k,onMouseEnter:b,onMouseLeave:U,children:[D&&!A&&!we&&p("span",{className:"obi-widget-pill-text",children:"Tutorials"}),D&&A&&we&&p("span",{className:"obi-widget-pill-text",children:"Searching knowledge ..."}),D&&A&&!V&&!we&&p(jh,{getBands:t.spectrum}),D&&V&&!we&&p(Wh,{})]})]}),p(je.Content,{children:p("div",{onMouseLeave:w,children:[ve&&p(Ln,{onClick:k,children:"Click to see all"}),Ce&&p(Ln,{children:"Session will pause shortly"}),tA&&p(Ln,{children:"Paused"}),Le&&p(Ln,{onClick:R,children:"Ready to continue?"}),l&&p(Oy,{onContinue:()=>{u(!1),t.messaging!==void 0&&h(t.messaging)},onWrapUp:()=>{var oe;(oe=t.onCancel)==null||oe.call(t)}})]})})]}),ae&&p(gA,{type:d?"voice":"message",disabled:!N||t.messaging!==void 0,onClick:()=>P(!d),title:d?"Voice input":"Text input"}),ae&&p(gA,{type:"minimize",onClick:E,title:"Minimize widget"})]}),it&&t.courseProgress&&p("div",{className:`obi-course-progress-container ${d?"expanded":""}`,children:p(nU,{currentStep:t.courseProgress.currentStep,totalSteps:t.courseProgress.totalSteps,stepNames:t.courseProgress.stepNames})})]})}function rU(t){const{disabled:e}=t,[A,n]=Z(null),[i,r]=Z(t.isActive??t.defaultIsActive??!1),[s,a]=Z(!1),[o,c]=Z(t.hovered??!1);function l(){r(!0),a(!1),c(!0)}function u(){}function d(){A&&(clearTimeout(A),n(null))}function h(){i&&n(setTimeout(()=>{r(t.defaultIsActive??!1),c(!1)},400))}function g(){r(!1),a(!0)}function f(){var C;(C=t.onOpen)==null||C.call(t)}const m=t.hovered??(o&&!s),B=t.isActive??(i&&!e&&!s),b=B&&m,U=`round-button ${B?"active":""}`;return p("div",{className:"obi-widget-out-of-plan-container",children:p("div",{className:`obi-widget-out-of-plan ${m?"hover":""} ${B?"active":""}`,onMouseEnter:d,onMouseLeave:h,children:[p("div",{className:U,style:{width:"27px",height:"30px"}}),p(je,{className:"obi-widget-popout",open:b,trigger:null,delayMs:400,offset:5,children:[p(je.Target,{children:p(Kh,{className:B?"button":"",active:B,onClick:f,onMouseEnter:l,onMouseLeave:u,children:B&&p("span",{className:"text",children:"Tutorials"})})}),p(je.Content,{children:p("div",{onMouseLeave:h,children:p(Ln,{className:"message",onClick:f,children:"Click to see all"})})})]}),p(gA,{className:U,type:"minimize",onClick:g,title:"Minimize widget"})]})})}function sU(t){return p("div",{className:"obi-widget-out-of-plan-container",children:p("div",{className:"obi-widget-out-of-plan",children:p(je,{className:"obi-widget-popout",open:!0,trigger:null,delayMs:100,offset:5,children:[p(je.Target,{children:p(Kh,{active:!1})}),p(je.Content,{children:p(My,{onReasonSelect:e=>{var A;(A=t.onCancelReason)==null||A.call(t,e)},onClose:()=>{var e;(e=t.onClose)==null||e.call(t)}})})]})})})}function aU({open:t=!1,children:e,onClose:A}){return p(Nh,{open:t,onClose:A,children:p("div",{className:"tour content-area",children:t?typeof e=="function"?e():e:null})})}function Zt({title:t="",subtitle:e="",agentName:A="Obi",buttonText:n="Continue",speakingState:i=null,actionDisabled:r=!1,href:s=null,centerVisual:a,description:o,button:c,onAction:l}){const[u,d]=Z(r),[h,g]=Z(!1),[f,m]=Z(i);return Ge(()=>{h||(i==="listening"&&f!=="listening"&&u&&d(!1),i!=="listening"&&!u&&d(!0)),m(i)},[i,u]),Ge(()=>{d(r)},[r]),p("div",{className:"tour-content",children:p("div",{className:"container",children:[p("div",{className:"header",children:[p("h1",{className:"title",children:t}),p("p",{className:"subtitle",children:e})]}),p("div",{className:"visual",style:{background:"var(--obi-color-tint)"},children:a}),p("div",{className:"description",children:o}),p("div",{className:"button-container",children:c||p(s?"a":"button",{className:`action-button ${u?"disabled":""}`,onClick:()=>{u||(d(!0),g(!0),l==null||l())},disabled:u,...s?{href:s,target:"_blank",rel:"noopener noreferrer"}:{type:"button"},children:p("span",{className:"button-text",children:(()=>{switch(i){case"thinking":return"Loading...";case"speaking":return`${A} is speaking`;default:return n}})()})})})]})})}function oU({logoUrl:t="",appName:e="App"}){const[A,n]=Z(!1),[i,r]=Z(!1),s=()=>{n(!0)},a=()=>{r(!0),n(!1)},o={container:{display:"block"},logoContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"flex",alignItems:"center",justifyContent:"center",position:"relative",overflow:"hidden"},backgroundPattern:{position:"absolute",inset:0,zIndex:0,background:"#F5F5F5",backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='277' height='195' viewBox='0 0 277 195' fill='none'%3E%3Cpath opacity='0.4' d='M341.308 0.75C380.279 0.750001 411.872 24.3772 411.872 53.5229C411.872 82.6685 380.279 106.296 341.308 106.296H215.792C176.964 108.335 145.691 130.837 141.128 159.475V256.616C145.912 286.659 180.089 309.954 221.548 309.954H330.872C375.607 309.954 411.872 282.833 411.872 249.377V159.069C411.872 129.923 443.465 106.296 482.436 106.296C521.407 106.296 553 129.923 553 159.069V257.181C553 285.058 524.099 307.88 487.483 309.815C489.264 309.902 491.061 309.954 492.871 309.954C448.137 309.954 411.872 337.076 411.872 370.532C411.872 369.177 411.803 367.834 411.686 366.502C409.098 393.885 378.582 415.5 341.308 415.5H210.118C171.147 415.5 139.554 391.873 139.554 362.727C139.554 362.204 139.565 361.683 139.585 361.163C133.564 332.156 100.023 309.954 59.5488 309.954C61.4544 309.954 63.3441 309.9 65.2169 309.803C28.7434 307.76 -8.57239e-07 284.982 0 257.181V159.069C1.64632e-06 130.901 29.5078 107.89 66.6662 106.377C64.3207 106.224 61.9472 106.141 59.5488 106.141C100.012 106.141 133.54 83.951 139.575 54.9552C139.558 54.4793 139.554 54.0018 139.554 53.5229C139.554 24.3772 171.147 0.75 210.118 0.75H341.308Z' fill='white'/%3E%3C/svg%3E")`,backgroundRepeat:"no-repeat",backgroundPosition:"190px 60px",backgroundSize:"300px 225px"},logoWrapper:{background:"#888888",width:"120px",height:"120px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",zIndex:10,overflow:"hidden"},appLogo:{width:"120px",height:"120px",objectFit:"cover",display:t&&!A&&i?"block":"none"},placeholderLogo:{width:"60px",height:"60px",background:"rgba(255, 255, 255, 0.2)",borderRadius:"4px",display:!t||A||!i?"flex":"none",alignItems:"center",justifyContent:"center",color:"rgba(255, 255, 255, 0.8)",fontSize:"24px",fontWeight:"bold"}};return p("div",{style:o.container,children:p("div",{style:o.logoContainer,children:[p("div",{style:o.backgroundPattern}),p("div",{style:o.logoWrapper,children:[t&&p("img",{style:o.appLogo,src:t,alt:`${e} logo`,onError:s,onLoad:a}),p("div",{style:o.placeholderLogo,children:e.charAt(0).toUpperCase()})]})]})})}function cU({session:t,speakingState:e,onAction:A}){const n=t.appName?`Navigate to ${t.appName}`:"Navigate to app",i=t.appName?`Open ${t.appName}`:"Open app",r=t.appName?`Enjoy the tutorial in ${t.appName}`:"Enjoy the tutorial";return p(Zt,{title:n,subtitle:"Click the button below to open the app",agentName:t.agentName||"Obi",buttonText:i,speakingState:e,actionDisabled:!0,href:t.url,description:r,centerVisual:p(oU,{logoUrl:t.appLogoUrl,appName:t.appName}),onAction:A})}function sf({className:t=""}){return p("svg",{width:"64",height:"64",viewBox:"0 0 256 256",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:p("path",{d:"M158.803 0L160.352 0.0399439C176.267 0.844061 188.922 13.9634 188.922 30.0311C188.922 46.6174 175.438 60.0653 158.803 60.0656H99.0263L98.9061 60.0722C78.8071 61.4795 62.6269 77.004 60.2644 96.7673L60.241 96.9704V158.93L60.2644 159.13C62.7406 179.86 80.4234 195.934 101.881 195.935H153.842C176.993 195.935 195.759 177.223 195.759 154.14V96.9138L195.799 95.3693C196.606 79.5009 209.766 66.8827 225.881 66.8827C242.515 66.8834 256 80.328 256 96.9138V159.086L255.963 160.564C255.225 175.748 243.176 187.971 228.038 189.038V189.214C207.121 190.591 190.4 207.263 189.019 228.119H188.842C187.738 243.7 174.712 256 158.803 256H96.4491C79.8147 256 66.3309 242.555 66.3302 225.969C66.3302 225.673 66.3349 225.375 66.3436 225.077H66.3503H66.3035C63.3344 206.008 47.4427 190.589 27.8321 189.231L27.8354 189.031C12.2702 187.868 0.000167669 174.905 0 159.086V96.9138L0.0367222 95.4192C0.791087 80.0787 13.0909 67.7634 28.453 66.9293C47.7697 65.3039 63.3522 50.3234 66.2969 31.4658L66.3469 31.1595L66.3369 30.85C66.3301 30.5933 66.3302 30.3238 66.3302 30.0311C66.3309 13.4454 79.8148 0.000165137 96.4491 0H158.803Z",fill:"currentColor"})})}function lU({children:t}){const e={container:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},logo:{display:"flex",width:"120px",height:"120px",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"8px",color:"#FFFFFF",position:"relative",overflow:"hidden",background:"var(--obi-color-primary)",boxShadow:`
48
48
  0 0 20px color-mix(in srgb, var(--obi-color-primary) 20%, transparent),
49
49
  0 0 40px color-mix(in srgb, var(--obi-color-primary) 15%, transparent),
50
50
  0 0 60px color-mix(in srgb, var(--obi-color-primary) 8%, transparent)
51
- `.replace(/\s+/g," ").trim()},logoIcon:{width:"64px",height:"64px",color:"inherit",fill:"currentColor"}};return g("div",{style:e.container,children:g("div",{style:e.logo,children:t||g(sf,{className:"logo-icon"})})})}function uU({session:t,speakingState:e,onAction:A}){return g(Zt,{title:t.name,subtitle:`Voice AI Tutorial by ${t.agentName||"Obi"}`,description:t.description,agentName:t.agentName||"Obi",speakingState:e,centerVisual:g(lU,{}),onAction:A})}function dU(){const t={host:{display:"block",position:"relative",width:"100%",height:"100%"},container:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},permissionDialog:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",padding:"16px 20px",gap:"16px",position:"absolute",width:"344px",height:"125px",left:"calc(50% - 344px/2)",top:"calc(50% - 125px/2)",background:"#FFFFFF",border:"1px solid #E5E7EB",boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",borderRadius:"8px"},permissionContent:{width:"100%",display:"flex",flexDirection:"column",gap:"16px"},permissionContentTop:{display:"flex",flexDirection:"row",alignItems:"center",padding:"0px",gap:"16px"},micIconContainer:{color:"var(--obi-color-text)",boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"12px",gap:"8px",width:"48px",height:"48px",background:"#F9FAFB",border:"1px solid #D1D5DB",borderRadius:"6px",flex:"none",order:0,flexGrow:0},micIcon:{width:"24px",height:"24px",flex:"none",order:0,flexGrow:0},permissionText:{flex:1,height:"24px",fontFamily:"'Inter', sans-serif",fontStyle:"normal",fontWeight:500,fontSize:"16px",lineHeight:"24px",display:"flex",alignItems:"center",color:"#111827",flexGrow:1,order:1},allowButton:{alignSelf:"flex-end",boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"10px 20px",gap:"8px",minWidth:"80px",height:"40px",background:"#F9FAFB",border:"1px solid #D1D5DB",borderRadius:"6px",flex:"none",order:2,flexGrow:0,cursor:"pointer",fontFamily:"'Inter', sans-serif",fontStyle:"normal",fontWeight:500,fontSize:"14px",lineHeight:"20px",color:"#374151"},cursorPointer:{position:"absolute",width:"24px",height:"24px",right:"80px",bottom:"60px",zIndex:3,animation:"pointToAllow 2s ease-in-out infinite"},cursorSvg:{width:"100%",height:"100%",filter:"drop-shadow(0px 1px 1.8px rgba(0, 0, 0, 0.65))"}};return g("div",{style:t.host,children:[g("style",{children:`
51
+ `.replace(/\s+/g," ").trim()},logoIcon:{width:"64px",height:"64px",color:"inherit",fill:"currentColor"}};return p("div",{style:e.container,children:p("div",{style:e.logo,children:t||p(sf,{className:"logo-icon"})})})}function uU({session:t,speakingState:e,onAction:A}){return p(Zt,{title:t.name,subtitle:`Voice AI Tutorial by ${t.agentName||"Obi"}`,description:t.description,agentName:t.agentName||"Obi",speakingState:e,centerVisual:p(lU,{}),onAction:A})}function dU(){const t={host:{display:"block",position:"relative",width:"100%",height:"100%"},container:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},permissionDialog:{boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"flex-start",alignItems:"center",padding:"16px 20px",gap:"16px",position:"absolute",width:"344px",height:"125px",left:"calc(50% - 344px/2)",top:"calc(50% - 125px/2)",background:"#FFFFFF",border:"1px solid #E5E7EB",boxShadow:"0px 10px 15px -3px rgba(0, 0, 0, 0.1), 0px 4px 6px -2px rgba(0, 0, 0, 0.05)",borderRadius:"8px"},permissionContent:{width:"100%",display:"flex",flexDirection:"column",gap:"16px"},permissionContentTop:{display:"flex",flexDirection:"row",alignItems:"center",padding:"0px",gap:"16px"},micIconContainer:{color:"var(--obi-color-text)",boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"12px",gap:"8px",width:"48px",height:"48px",background:"#F9FAFB",border:"1px solid #D1D5DB",borderRadius:"6px",flex:"none",order:0,flexGrow:0},micIcon:{width:"24px",height:"24px",flex:"none",order:0,flexGrow:0},permissionText:{flex:1,height:"24px",fontFamily:"'Inter', sans-serif",fontStyle:"normal",fontWeight:500,fontSize:"16px",lineHeight:"24px",display:"flex",alignItems:"center",color:"#111827",flexGrow:1,order:1},allowButton:{alignSelf:"flex-end",boxSizing:"border-box",display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",padding:"10px 20px",gap:"8px",minWidth:"80px",height:"40px",background:"#F9FAFB",border:"1px solid #D1D5DB",borderRadius:"6px",flex:"none",order:2,flexGrow:0,cursor:"pointer",fontFamily:"'Inter', sans-serif",fontStyle:"normal",fontWeight:500,fontSize:"14px",lineHeight:"20px",color:"#374151"},cursorPointer:{position:"absolute",width:"24px",height:"24px",right:"80px",bottom:"60px",zIndex:3,animation:"pointToAllow 2s ease-in-out infinite"},cursorSvg:{width:"100%",height:"100%",filter:"drop-shadow(0px 1px 1.8px rgba(0, 0, 0, 0.65))"}};return p("div",{style:t.host,children:[p("style",{children:`
52
52
  @keyframes pointToAllow {
53
53
  0%, 100% { transform: translate(0, 0); }
54
54
  50% { transform: translate(2px, -1px); }
55
55
  }
56
- `}),g("div",{style:t.container,children:[g("div",{style:t.permissionDialog,children:g("div",{style:t.permissionContent,children:[g("div",{style:t.permissionContentTop,children:[g("div",{style:t.micIconContainer,children:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:t.micIcon,children:[g("path",{d:"M12 19v3"}),g("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),g("rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"})]})}),g("div",{style:t.permissionText,children:"Use your microphone"})]}),g("button",{style:t.allowButton,children:"Allow"})]})}),g("div",{style:t.cursorPointer,children:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:t.cursorSvg,children:[g("path",{d:"M12.586 12.586 19 19"}),g("path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"})]})})]})]})}function hU({session:t,speakingState:e,onAction:A}){return g(Zt,{title:"Connect your microphone",subtitle:"Watch for the prompt in your browser",agentName:t.agentName||"Obi",buttonText:"Continue",speakingState:e,actionDisabled:!0,description:`${t.agentName||"Obi"} will guide you through the tutorial by talking with you.`,centerVisual:g(dU,{}),onAction:A})}function fU({}){return g("div",{style:{borderRadius:"15px",boxShadow:"0 0 20px 2px var(--obi-color-primary)",backgroundColor:"var(--obi-color-primary)",transform:"scale(1.6)"},children:g(ao,{isActive:!0,children:g(Wh,{})})})}function gU({session:t,speakingState:e,onAction:A}){return g(Zt,{title:"Can you hear me?",subtitle:`Make sure your sound is on so you can hear ${t.agentName||"Obi"}`,agentName:t.agentName||"Obi",speakingState:e,actionDisabled:!0,description:`${t.agentName||"Obi"} will guide you through the tutorial by talking with you.`,centerVisual:g(fU,{}),onAction:A})}function pU(){const t={container:{display:"flex",justifyContent:"center",alignItems:"center"},skeletonContainer:{display:"flex",flexDirection:"column",flexShrink:0,gap:"10px",alignItems:"center",padding:"20px",margin:"0 auto",background:"white",borderRadius:"12px",border:"0.569px solid #E4E4E7",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",height:"234px",width:"344px"},headerSection:{display:"flex",position:"relative",gap:"16px",alignItems:"center",alignSelf:"stretch"},avatar:{position:"relative",background:"#F4F4F5",borderRadius:"50%",height:"55px",width:"55px",flexShrink:0,overflow:"hidden"},textLines:{display:"flex",position:"relative",flexDirection:"column",gap:"10px",alignItems:"flex-start",alignSelf:"stretch",width:"100%"},textLine:{position:"relative",borderRadius:"2px",background:"#F4F4F5",height:"18px",alignSelf:"stretch",overflow:"hidden"},contentSection:{display:"flex",position:"relative",flexDirection:"column",flexShrink:0,gap:"16px",justifyContent:"center",alignItems:"flex-start",alignSelf:"stretch",height:"62px"},contentBlock:{position:"relative",alignSelf:"stretch",borderRadius:"2px",background:"#F4F4F5",flex:"1 0 0",overflow:"hidden"},shimmer:{position:"absolute",top:0,left:"-150px",height:"100%",width:"150px",background:"linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent)",animation:"skeleton-loading 2s infinite"}};return g("div",{style:t.container,children:[g("style",{children:`
56
+ `}),p("div",{style:t.container,children:[p("div",{style:t.permissionDialog,children:p("div",{style:t.permissionContent,children:[p("div",{style:t.permissionContentTop,children:[p("div",{style:t.micIconContainer,children:p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:t.micIcon,children:[p("path",{d:"M12 19v3"}),p("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),p("rect",{x:"9",y:"2",width:"6",height:"13",rx:"3"})]})}),p("div",{style:t.permissionText,children:"Use your microphone"})]}),p("button",{style:t.allowButton,children:"Allow"})]})}),p("div",{style:t.cursorPointer,children:p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:t.cursorSvg,children:[p("path",{d:"M12.586 12.586 19 19"}),p("path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z"})]})})]})]})}function hU({session:t,speakingState:e,onAction:A}){return p(Zt,{title:"Connect your microphone",subtitle:"Watch for the prompt in your browser",agentName:t.agentName||"Obi",buttonText:"Continue",speakingState:e,actionDisabled:!0,description:`${t.agentName||"Obi"} will guide you through the tutorial by talking with you.`,centerVisual:p(dU,{}),onAction:A})}function fU({}){return p("div",{style:{borderRadius:"15px",boxShadow:"0 0 20px 2px var(--obi-color-primary)",backgroundColor:"var(--obi-color-primary)",transform:"scale(1.6)"},children:p(ao,{isActive:!0,children:p(Wh,{})})})}function gU({session:t,speakingState:e,onAction:A}){return p(Zt,{title:"Can you hear me?",subtitle:`Make sure your sound is on so you can hear ${t.agentName||"Obi"}`,agentName:t.agentName||"Obi",speakingState:e,actionDisabled:!0,description:`${t.agentName||"Obi"} will guide you through the tutorial by talking with you.`,centerVisual:p(fU,{}),onAction:A})}function pU(){const t={container:{display:"flex",justifyContent:"center",alignItems:"center"},skeletonContainer:{display:"flex",flexDirection:"column",flexShrink:0,gap:"10px",alignItems:"center",padding:"20px",margin:"0 auto",background:"white",borderRadius:"12px",border:"0.569px solid #E4E4E7",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.25)",height:"234px",width:"344px"},headerSection:{display:"flex",position:"relative",gap:"16px",alignItems:"center",alignSelf:"stretch"},avatar:{position:"relative",background:"#F4F4F5",borderRadius:"50%",height:"55px",width:"55px",flexShrink:0,overflow:"hidden"},textLines:{display:"flex",position:"relative",flexDirection:"column",gap:"10px",alignItems:"flex-start",alignSelf:"stretch",width:"100%"},textLine:{position:"relative",borderRadius:"2px",background:"#F4F4F5",height:"18px",alignSelf:"stretch",overflow:"hidden"},contentSection:{display:"flex",position:"relative",flexDirection:"column",flexShrink:0,gap:"16px",justifyContent:"center",alignItems:"flex-start",alignSelf:"stretch",height:"62px"},contentBlock:{position:"relative",alignSelf:"stretch",borderRadius:"2px",background:"#F4F4F5",flex:"1 0 0",overflow:"hidden"},shimmer:{position:"absolute",top:0,left:"-150px",height:"100%",width:"150px",background:"linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent)",animation:"skeleton-loading 2s infinite"}};return p("div",{style:t.container,children:[p("style",{children:`
57
57
  @keyframes skeleton-loading {
58
58
  0% { transform: translateX(-150px); }
59
59
  50% { transform: translateX(344px); }
60
60
  100% { transform: translateX(344px); }
61
61
  }
62
- `}),g("article",{style:t.skeletonContainer,role:"status","aria-label":"Loading content",children:[g("section",{style:t.headerSection,children:[g("div",{style:t.avatar,role:"img","aria-label":"Loading avatar",children:g("div",{style:t.shimmer})}),g("div",{style:t.textLines,children:[g("div",{style:t.textLine,role:"presentation","aria-label":"Loading text line 1",children:g("div",{style:t.shimmer})}),g("div",{style:t.textLine,role:"presentation","aria-label":"Loading text line 2",children:g("div",{style:t.shimmer})})]})]}),g("section",{style:t.contentSection,children:g("div",{style:t.contentBlock,role:"presentation","aria-label":"Loading card content",children:g("div",{style:t.shimmer})})})]})]})}function mU({}){const t={host:{display:"block"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Satoshi', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return g("div",{style:t.host,children:g("div",{style:t.shareContainer,children:[g("div",{style:t.controlsRow,children:[g("div",{style:t.monitorIconContainer,children:g("svg",{style:t.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[g("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),g("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),g("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),g("div",{style:t.tabSelector,children:[g("button",{style:t.tabButton(!1),children:"Tab"}),g("button",{style:t.tabButton(!0),children:"Window"})]})]}),g("div",{style:t.skeletonContainer,children:g(pU,{})})]})})}function BU({session:t,speakingState:e,onAction:A}){return g(Zt,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:t.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${t.agentName||"Obi"} will guide you through ${t.appName||"the app"} by watching your screen.`,centerVisual:g(mU,{}),actionDisabled:!0,onAction:A})}function vU({spectrum:t}){return g("div",{style:{borderRadius:"15px",boxShadow:"0 0 20px 2px var(--obi-color-primary)",backgroundColor:"var(--obi-color-primary)",transform:"scale(1.6)"},children:g(ao,{isActive:!0,children:g(jh,{getBands:t})})})}function CU({session:t,speakingState:e,spectrum:A,onAction:n}){return g(Zt,{title:"Overview",subtitle:`${t.agentName||"Obi"} will start your tutorial in a moment`,agentName:t.agentName||"Obi",speakingState:e,description:`Get ready to explore ${t.appName||"the app"} with ${t.agentName||"Obi"}.`,centerVisual:g(vU,{spectrum:A}),actionDisabled:!0,onAction:n})}function wU({id:t,name:e,description:A,duration:n=10,order:i=0,selected:r=!1,onClick:s}){return g("div",{className:`course-container ${r?"selected":""}`,onClick:()=>{s==null||s({id:t,name:e,description:A,duration:n,order:i})},children:[g("div",{className:"header-row",children:[g("h2",{className:"course-title",children:e}),g("span",{className:"duration",children:["~",n," mins"]})]}),A&&g("p",{className:"course-description",children:A})]})}function bU({courses:t=[],selectedCourseId:e=null,loading:A=!1,error:n="",onCourseSelect:i}){const[r,s]=Z(""),a=l=>{const u=l.currentTarget;s(u.value)},o=l=>{i==null||i(l)};if(A)return g("div",{className:"loading",children:"Loading..."});if(n)return g("div",{className:"error",children:n});if(!t||t.length===0)return g("div",{className:"empty",children:"No courses available"});const c=t.filter(l=>l.name.toLowerCase().includes(r.toLowerCase())||(l.description||"").toLowerCase().includes(r.toLowerCase()));return g("div",{className:"tour-select",children:[g("div",{className:"controls",children:[g("div",{className:"tabs",children:g("button",{className:"tab active",children:"All"})}),g("div",{className:"filter",children:[g("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:g("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),g("input",{type:"text",placeholder:"Search...",value:r,onInput:a})]})]}),g("div",{className:"course-grid",children:c.sort((l,u)=>(l.order||0)-(u.order||0)).map(l=>{const u=l.id===e;return g(wU,{id:l.id,name:l.name,description:l.description||"",duration:l.duration,order:l.order||0,selected:u,onClick:o},l.id)})})]})}function yU({open:t,courses:e=[],loading:A=!1,error:n="",agentName:i="Obi",onClose:r,onCourseSelect:s}){const[a,o]=Z(null),c=u=>{o(u)},l=()=>{a&&s&&s(a)};return g(Nh,{open:t,onClose:r,size:"large",children:g("div",{className:"tour-select-modal-container",children:[g("div",{className:"header",children:[g("div",{className:"icon",style:{color:"white"},children:g(sf,{})}),g("div",{className:"title-section",children:A?g(Pe,{children:[g("div",{className:"skeleton skeleton-title"}),g("div",{className:"skeleton skeleton-subtitle"})]}):g(Pe,{children:[g("h1",{children:["Give ",i," a try!"]}),g("p",{className:"subtitle",children:["Pick a tutorial, share your screen, and ",i," will take it from there."]})]})})]}),g("div",{className:"course-list-wrapper",children:g(bU,{courses:e,selectedCourseId:(a==null?void 0:a.id)||"",loading:A,error:n,onCourseSelect:c})}),g("div",{className:"footer",children:[g("button",{className:"obi-button footer-button",onClick:l,disabled:!a,children:[g("span",{children:"Get started"}),g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:g("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:a?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),g("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function UU({session:t,sessionState:e,speakingState:A,spectrum:n,onStart:i,onContinue:r,onShareMicrophone:s,onShareScreen:a}){function o(){e==="connecting"||e==="connected"||!e?i==null||i():e==="volume-check"||e==="mic-check"?r==null||r():e==="mic-share"?s==null||s():e==="screen-share"&&(a==null||a())}return no(()=>{switch(e){case null:case"connecting":case"connected":return g(uU,{session:t,speakingState:A,onAction:o});case"volume-check":return g(gU,{session:t,speakingState:A,onAction:o});case"mic-check":return g(CU,{session:t,speakingState:A,spectrum:n,onAction:o});case"mic-share":return g(hU,{session:t,speakingState:A,onAction:o});case"screen-share":return g(BU,{session:t,speakingState:A,onAction:o});case"navigate":return g(cU,{session:t,speakingState:A,onAction:o});default:return null}},[e,A,i,r,s,a])}function QU(t){const{session:e,sessionState:A,speakingState:n,spectrum:i,onClose:r,onStart:s,onContinue:a,onShareMicrophone:o,onShareScreen:c}=t,l=(t.open??!0)&&(!A||A==="connecting"||A==="connected"||A==="volume-check"||A==="mic-check"||A==="mic-share"||A==="screen-share"||A==="navigate");return g(aU,{open:l,onClose:r,children:()=>g(UU,{session:e,sessionState:A,speakingState:n,spectrum:i,onStart:s,onContinue:a,onShareMicrophone:o,onShareScreen:c})})}function EU(t){let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function SU(t,e){if(!e||e.length===0)return!1;const A=t.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(n=>{try{const i=EU(n);return i.test(A)||i.test(t)}catch(i){return console.warn(`Invalid URL pattern: ${n}`,i),!1}})}function lo(t){if(!t||t.length===0)return!1;const e=window.location.origin+window.location.pathname;return SU(e,t)}function kU(t){var b,U,w;const[e,A]=Z(!1),[n,i]=Z(!1),[r,s]=Z(null),a=TU(t.sdk,o,t.shadowHost,s);function o(v){var y;(y=a.client)!=null&&y.session||A(v)}if(!a.client)return null;const c=FU((b=a.client.product)==null?void 0:b.widget_url_blacklist),l=a.client.session,u=!!l,d=u&&!e;let h;switch(l==null?void 0:l.speakingState){case"listening":h="user-speaking";break;case"speaking":h="agent-speaking";break;case"thinking":h="thinking";break;case"busy":h="busy";break}const p=l==null?void 0:l.isPaused,f=a.client.state==="ready"&&!c&&(a.client.selectedPlan||!((U=a.client.product)!=null&&U.widget_link_only_access)),m=d?100:62,B=()=>{var v,y,E,T,F,R;return{name:(v=a.client.selectedPlan)==null?void 0:v.name,description:(y=a.client.selectedPlan)==null?void 0:y.description,appName:(E=a.client.product)==null?void 0:E.name,appLogoUrl:((T=a.client.product)==null?void 0:T.logo_url)||"",url:(F=a.client.product)==null?void 0:F.url,agentName:((R=a.client.product)==null?void 0:R.agent_name)||"Obi"}};return g("div",{children:[e&&g(yU,{open:e,courses:a.client.plans.map(v=>({id:v.uuid,name:v.name,description:v.description||"",duration:v.duration||0})),loading:!1,agentName:((w=a.client.product)==null?void 0:w.agent_name)||"Obi",onCourseSelect:v=>{const y=a.client.plans.find(E=>E.uuid===v.id)||null;y&&(a.client.selectPlan(y),A(!1),i(!0))},onClose:v=>{v==="user-initiated"&&a.client.selectPlan(null),A(!1)}}),f&&g(Pe,{children:[g("div",{style:{position:"fixed",top:`calc(100vh - ${m}px)`,left:"50%",transform:"translateX(-50%)",width:"max-content"},children:g(iU,{inPlan:u,isActive:n?!1:void 0,defaultIsActive:!0,isPaused:p,messaging:(l==null?void 0:l.isMicShared)===!1?!0:void 0,speakingStatus:h,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,courseProgress:r,onOpen:()=>{A(!0)},onCancel:()=>{var v;(v=a.client.session)==null||v.stop()},onPause:()=>{var v,y;(y=(v=a.client.session)==null?void 0:v.pause)==null||y.call(v)},onUnpause:()=>{var v,y;(y=(v=a.client.session)==null?void 0:v.unpause)==null||y.call(v)},onMessagingChange:v=>{var y,E,T,F;v?(E=(y=a.client.session)==null?void 0:y.muteMicrophone)==null||E.call(y):(F=(T=a.client.session)==null?void 0:T.unmuteMicrophone)==null||F.call(T)},onMessage:v=>{a.say(v)}})}),!!a.client.selectedPlan&&g(QU,{open:!0,session:B(),sessionState:(l==null?void 0:l.state)||null,speakingState:(l==null?void 0:l.speakingState)||null,spectrum:()=>(l==null?void 0:l.audioSpectrum())||null,onClose:v=>{v==="user-initiated"&&a.client.stopSession(),i(!1)},onStart:()=>{a.client.selectedPlanUuid&&a.startSession()},onContinue:()=>{l==null||l.continue()},onShareMicrophone:()=>{l==null||l.shareMicrophone()}})]})]})}function TU(t,e,A,n){const[i,r]=Z(0),[s,a]=Z(null);return Ge(()=>{t.on("showMenu",o=>{e(o)})},[t]),Ge(()=>{t.client&&(t.client.session&&a(t.client.session),t.client.on("sessionStarted",o=>{a(o),r(c=>c+1)}),t.client.on("sessionStopped",()=>{a(null),r(o=>o+1)}),t.client.on("sessionShutdown",()=>{r(o=>o+1)}),t.client.on("sessionResumed",()=>{r(o=>o+1)}),t.client.on("stateChanged",()=>{var o;t.client.state==="ready"&&A.style.setProperty("--obi-color-primary",((o=t.client.product)==null?void 0:o.primary_color)||"#9500FF"),r(c=>c+1)}),t.client.on("planSelected",()=>{r(o=>o+1)}))},[t,t.client]),Ge(()=>{if(!s)return;s.on("stateChanged",()=>{r(c=>c+1)}),s.on("speakingStateChanged",()=>{r(c=>c+1)}),s.on("paused",()=>{r(c=>c+1)}),s.on("unpaused",()=>{r(c=>c+1)});const o=c=>{n(c)};return s.on&&s.on("courseProgress",o),()=>{s.off&&s.off("courseProgress",o)}},[s]),t}function FU(t){const[e,A]=Z(()=>lo(t));return Ge(()=>{A(lo(t))},[t]),Ge(()=>{IU();const n=()=>{A(lo(t))};return window.addEventListener("locationchange",n),window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{window.removeEventListener("locationchange",n),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}},[t]),e}function IU(){const t=window;if(t.__obi_history_patched)return;const{pushState:e,replaceState:A}=window.history,n=i=>function(...r){const s=i.apply(this,r);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=n(e),window.history.replaceState=n(A),t.__obi_history_patched=!0}function xU(t){if(document.querySelector("obi-widget")){console.debug("[obi] widget already mounted");return}_U();const e=document.createElement("div");e.id="host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const A=e.attachShadow({mode:"open"}),n=document.createElement("div");n.id="obi-container",n.className="parentclass",A.appendChild(n);const i=new CSSStyleSheet;i.replaceSync(Sy),A.adoptedStyleSheets=[i],Uy(g(kU,{sdk:t,shadowHost:e}),n),console.log("[obi-sdk] widget mounted")}function _U(){af("https://fonts.cdnfonts.com/css/satoshi"),af("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function af(t){const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)}const of="49206C6F7665204F6269_session",cf="obi-url-params";class PU extends kr{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(A,n,i)=>{var r,s;switch(A){case"update":this.updateConfig(n,i);break;case"endSession":(s=(r=this.client)==null?void 0:r.stopSession)==null||s.call(r);break;case"say":this.say(n);break;default:console.warn("[obi] unknown command",{commandType:A,args:n})}},e&&this.createClient(e)}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}console.debug("[obi] creating client");let A=null;const n=this.load();if(n){console.debug("[obi] attempting to load cached client");try{A=vr.deserialise(n,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(i){console.error("[obi] error loading cached client",i)}}A||(A=new vr(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=A,this.client.on("stateChanged",i=>{var r,s,a;i==="ready"&&this.updateConfig({isActive:(r=this.client)==null?void 0:r.showWidget,primaryColour:((a=(s=this.client)==null?void 0:s.product)==null?void 0:a.primary_color)||"#9500FF"})}),this.client.on("sessionStarted",()=>{this.save()}),this.client.on("sessionStopped",()=>{console.debug("[obi] removing client from local storage"),localStorage.removeItem("obi-client")}),this.client.on("sessionShutdown",i=>{i==="invalid-room"&&(console.debug("[obi] removing client from local storage"),localStorage.removeItem("obi-client"))}),this.client.session&&this.client.resumeSession(i=>{i.on("stateChanged",r=>{r!=="disconnecting"&&r!=="disconnected"&&r!=="error"&&r!=="connecting"&&this.save()}),i.on("paused",()=>{this.save()}),i.on("unpaused",()=>{this.save()})})}async initialise(e={}){const A=this.parsePassiveParams()||void 0;this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?(console.debug("[obi] client already exists, initialising"),this.client.initialise({planUuid:A}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(n=>{console.error("[obi] error initialising client",n),this.emit("error",n)})):(console.debug("[obi] client does not exist, dispatching command queue"),this.dispatchCommandQueue(A))}async updateConfig(e,A){console.debug("[obi] updating config",e),await this.updateAppToken(e.apiKey,A),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),await this.updateIdentity(e.user,A),this.updateShowMenu(e.showMenu)}async updateAppToken(e,A){var n;e===void 0||e==((n=this.client)==null?void 0:n.appToken)||(console.debug("[obi] updating app token",{appToken:e,planUuid:A}),await this.createClient(e),this.client&&await this.client.initialise({planUuid:A}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateActive(e){e===void 0||e==this.isActive||(console.debug("[obi] updating active state",e),this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(console.debug("[obi] updating primary colour",e),this.primaryColour=e)}async updateIdentity(e,A){var n;e===void 0||e==((n=this.client)==null?void 0:n.identity)||(console.debug("[obi] updating identity",e),await this.client.initialise({identity:e||void 0,planUuid:A}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)}))}updateShowMenu(e){e!==void 0&&(console.debug("[obi] updating show menu",e),this.emit("showMenu",e))}async say(e){var A,n,i;await((i=(n=(A=this.client)==null?void 0:A.session)==null?void 0:n.say)==null?void 0:i.call(n,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",A=>{A!=="disconnecting"&&A!=="disconnected"&&A!=="error"&&A!=="connecting"&&this.save()})})}dispatchCommandQueue(e){const A=this.commandQueue;this.commandQueue=[],A.forEach(n=>{console.debug("[obi] dispatching command",n);try{this.dispatchCommand(n[0],n[1]||[],e)}catch(i){console.error("[obi] error dispatching command",i)}})}parsePassiveParams(){console.debug("[obi] parsing passive params");let e={};e=JSON.parse(localStorage.getItem(cf)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((r,s)=>{e[s]=r});const A=e[of];if(!A)return null;console.debug("[obi] found plan uuid from passive params",A);const n=new URL(window.location.href);return n.searchParams.delete(of),window.history.replaceState({},"",n.toString()),console.debug("[obi] removed plan uuid from url",n.toString()),localStorage.removeItem(cf),A}mountWidget(){xU(this),console.debug("[obi] widget mounted")}async captureScreen(){return(await Fv(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}save(){}load(){return localStorage.getItem("obi-client")}}async function lf(t){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return RU({appToken:t,window:e})}async function RU({appToken:t,window:e}){var i,r;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t||(t=(i=e==null?void 0:e.obiWidgetConfig)==null?void 0:i.apiKey);let A;try{A=((r=e.ObiSDK)==null?void 0:r.q)||[]}catch{A=[]}const n=new PU(t);return e.ObiSDK=n.dispatchCommand,await n.initialise({queuedCommands:A}),e.obi=n,n.mountWidget(),n}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{lf()}):lf()})();
62
+ `}),p("article",{style:t.skeletonContainer,role:"status","aria-label":"Loading content",children:[p("section",{style:t.headerSection,children:[p("div",{style:t.avatar,role:"img","aria-label":"Loading avatar",children:p("div",{style:t.shimmer})}),p("div",{style:t.textLines,children:[p("div",{style:t.textLine,role:"presentation","aria-label":"Loading text line 1",children:p("div",{style:t.shimmer})}),p("div",{style:t.textLine,role:"presentation","aria-label":"Loading text line 2",children:p("div",{style:t.shimmer})})]})]}),p("section",{style:t.contentSection,children:p("div",{style:t.contentBlock,role:"presentation","aria-label":"Loading card content",children:p("div",{style:t.shimmer})})})]})]})}function mU({}){const t={host:{display:"block"},shareContainer:{width:"480px",height:"240px",borderRadius:"12px",display:"grid",placeItems:"center",overflow:"hidden",position:"relative",backgroundColor:"var(--obi-color-tint)"},controlsRow:{zIndex:10,gridRowStart:1,gridColumnStart:1,display:"flex",alignSelf:"flex-start",marginTop:"36px",alignItems:"center",gap:"8px"},monitorIconContainer:{display:"flex",height:"40px",width:"40px",aspectRatio:"1",alignItems:"center",justifyContent:"center",gap:"8px",borderRadius:"2px",border:"1px solid #E4E4E7",background:"#F8FAFC",padding:"8px"},monitorIcon:{width:"24px",height:"24px",color:"#111827"},tabSelector:{display:"flex",width:"260px",height:"40px",padding:"4px",alignItems:"center",borderRadius:"2px",background:"#E4E4E7"},tabButton:e=>({display:"flex",flex:1,alignSelf:"stretch",alignItems:"center",justifyContent:"center",gap:"10px",borderRadius:"2px",padding:"6px 12px",border:"none",cursor:"pointer",fontFamily:"'Satoshi', sans-serif",fontSize:"14px",fontWeight:500,opacity:e?1:.4,background:e?"white":"#F8FAFC",boxShadow:e?"0 1px 2px 0 rgba(0, 0, 0, 0.05)":"none"}),skeletonContainer:{marginTop:"104px",gridColumnStart:1,gridRowStart:1,alignSelf:"center"}};return p("div",{style:t.host,children:p("div",{style:t.shareContainer,children:[p("div",{style:t.controlsRow,children:[p("div",{style:t.monitorIconContainer,children:p("svg",{style:t.monitorIcon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[p("rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",ry:"2"}),p("line",{x1:"8",x2:"16",y1:"21",y2:"21"}),p("line",{x1:"12",x2:"12",y1:"17",y2:"21"})]})}),p("div",{style:t.tabSelector,children:[p("button",{style:t.tabButton(!1),children:"Tab"}),p("button",{style:t.tabButton(!0),children:"Window"})]})]}),p("div",{style:t.skeletonContainer,children:p(pU,{})})]})})}function BU({session:t,speakingState:e,onAction:A}){return p(Zt,{title:"Connect your screen",subtitle:"Watch for the prompt in your browser",agentName:t.agentName||"Obi",buttonText:"Share screen",speakingState:e,description:`${t.agentName||"Obi"} will guide you through ${t.appName||"the app"} by watching your screen.`,centerVisual:p(mU,{}),actionDisabled:!0,onAction:A})}function vU({spectrum:t}){return p("div",{style:{borderRadius:"15px",boxShadow:"0 0 20px 2px var(--obi-color-primary)",backgroundColor:"var(--obi-color-primary)",transform:"scale(1.6)"},children:p(ao,{isActive:!0,children:p(jh,{getBands:t})})})}function CU({session:t,speakingState:e,spectrum:A,onAction:n}){return p(Zt,{title:"Overview",subtitle:`${t.agentName||"Obi"} will start your tutorial in a moment`,agentName:t.agentName||"Obi",speakingState:e,description:`Get ready to explore ${t.appName||"the app"} with ${t.agentName||"Obi"}.`,centerVisual:p(vU,{spectrum:A}),actionDisabled:!0,onAction:n})}function wU({id:t,name:e,description:A,duration:n=10,order:i=0,selected:r=!1,onClick:s}){return p("div",{className:`course-container ${r?"selected":""}`,onClick:()=>{s==null||s({id:t,name:e,description:A,duration:n,order:i})},children:[p("div",{className:"header-row",children:[p("h2",{className:"course-title",children:e}),p("span",{className:"duration",children:["~",n," mins"]})]}),A&&p("p",{className:"course-description",children:A})]})}function bU({courses:t=[],selectedCourseId:e=null,loading:A=!1,error:n="",onCourseSelect:i}){const[r,s]=Z(""),a=l=>{const u=l.currentTarget;s(u.value)},o=l=>{i==null||i(l)};if(A)return p("div",{className:"loading",children:"Loading..."});if(n)return p("div",{className:"error",children:n});if(!t||t.length===0)return p("div",{className:"empty",children:"No courses available"});const c=t.filter(l=>l.name.toLowerCase().includes(r.toLowerCase())||(l.description||"").toLowerCase().includes(r.toLowerCase()));return p("div",{className:"tour-select",children:[p("div",{className:"controls",children:[p("div",{className:"tabs",children:p("button",{className:"tab active",children:"All"})}),p("div",{className:"filter",children:[p("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:p("path",{d:"M10.0417 8.75002H9.42087L9.20004 8.53502C9.96921 7.63585 10.4417 6.47502 10.4417 5.20835C10.4417 2.56085 8.32254 0.441681 5.67504 0.441681C3.02754 0.441681 0.908374 2.56085 0.908374 5.20835C0.908374 7.85585 3.02754 9.97502 5.67504 9.97502C6.94171 9.97502 8.10254 9.50252 9.00171 8.73335L9.22671 8.95418V9.57502L13.2167 13.5592L14.375 12.4008L10.0417 8.75002ZM5.67504 8.75002C3.72754 8.75002 2.15837 7.18085 2.15837 5.20835C2.15837 3.23585 3.72754 1.66668 5.67504 1.66668C7.62254 1.66668 9.19171 3.23585 9.19171 5.20835C9.19171 7.18085 7.62254 8.75002 5.67504 8.75002Z",fill:"#6B7280"})}),p("input",{type:"text",placeholder:"Search...",value:r,onInput:a})]})]}),p("div",{className:"course-grid",children:c.sort((l,u)=>(l.order||0)-(u.order||0)).map(l=>{const u=l.id===e;return p(wU,{id:l.id,name:l.name,description:l.description||"",duration:l.duration,order:l.order||0,selected:u,onClick:o},l.id)})})]})}function yU({open:t,courses:e=[],loading:A=!1,error:n="",agentName:i="Obi",onClose:r,onCourseSelect:s}){const[a,o]=Z(null),c=u=>{o(u)},l=()=>{a&&s&&s(a)};return p(Nh,{open:t,onClose:r,size:"large",children:p("div",{className:"tour-select-modal-container",children:[p("div",{className:"header",children:[p("div",{className:"icon",style:{color:"white"},children:p(sf,{})}),p("div",{className:"title-section",children:A?p(Pe,{children:[p("div",{className:"skeleton skeleton-title"}),p("div",{className:"skeleton skeleton-subtitle"})]}):p(Pe,{children:[p("h1",{children:["Give ",i," a try!"]}),p("p",{className:"subtitle",children:["Pick a tutorial, share your screen, and ",i," will take it from there."]})]})})]}),p("div",{className:"course-list-wrapper",children:p(bU,{courses:e,selectedCourseId:(a==null?void 0:a.id)||"",loading:A,error:n,onCourseSelect:c})}),p("div",{className:"footer",children:[p("button",{className:"obi-button footer-button",onClick:l,disabled:!a,children:[p("span",{children:"Get started"}),p("svg",{xmlns:"http://www.w3.org/2000/svg",width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",children:p("path",{d:"M3.83325 8.00065H13.1666M13.1666 8.00065L8.49992 3.33398M13.1666 8.00065L8.49992 12.6673",stroke:a?"#FAFAFA":"#999","stroke-width":"1.33","stroke-linecap":"round","stroke-linejoin":"round"})})]}),p("p",{className:"footer-text",children:"Sessions are securely recorded for quality improvement purposes."})]})]})})}function UU({session:t,sessionState:e,speakingState:A,spectrum:n,onStart:i,onContinue:r,onShareMicrophone:s,onShareScreen:a}){function o(){e==="connecting"||e==="connected"||!e?i==null||i():e==="volume-check"||e==="mic-check"?r==null||r():e==="mic-share"?s==null||s():e==="screen-share"&&(a==null||a())}return no(()=>{switch(e){case null:case"connecting":case"connected":return p(uU,{session:t,speakingState:A,onAction:o});case"volume-check":return p(gU,{session:t,speakingState:A,onAction:o});case"mic-check":return p(CU,{session:t,speakingState:A,spectrum:n,onAction:o});case"mic-share":return p(hU,{session:t,speakingState:A,onAction:o});case"screen-share":return p(BU,{session:t,speakingState:A,onAction:o});case"navigate":return p(cU,{session:t,speakingState:A,onAction:o});default:return null}},[e,A,i,r,s,a])}function QU(t){const{session:e,sessionState:A,speakingState:n,spectrum:i,onClose:r,onStart:s,onContinue:a,onShareMicrophone:o,onShareScreen:c}=t,l=(t.open??!0)&&(!A||A==="connecting"||A==="connected"||A==="volume-check"||A==="mic-check"||A==="mic-share"||A==="screen-share"||A==="navigate");return p(aU,{open:l,onClose:r,children:()=>p(UU,{session:e,sessionState:A,speakingState:n,spectrum:i,onStart:s,onContinue:a,onShareMicrophone:o,onShareScreen:c})})}function EU(t){let e=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"__DOUBLE_STAR__").replace(/\*/g,"[^/]*").replace(/__DOUBLE_STAR__/g,".*").replace(/\?/g,"[^/]");return new RegExp(`^${e}$`,"i")}function SU(t,e){if(!e||e.length===0)return!1;const A=t.replace(/^https?:\/\//,"").replace(/\/$/,"");return e.some(n=>{try{const i=EU(n);return i.test(A)||i.test(t)}catch(i){return console.warn(`Invalid URL pattern: ${n}`,i),!1}})}function lo(t){if(!t||t.length===0)return!1;const e=window.location.origin+window.location.pathname;return SU(e,t)}function kU(t){var U,C,w,y,E;const[e,A]=Z(!1),[n,i]=Z(!1),[r,s]=Z(null),a=TU(t.sdk,o,t.shadowHost,s);function o(S){var k;(k=a.client)!=null&&k.session||A(S)}if(!a.client)return null;const c=FU((U=a.client.product)==null?void 0:U.widget_url_blacklist);let l=a.isActive;((w=(C=a.client)==null?void 0:C.product)==null?void 0:w.name)==="Canibuild"&&(l=!0);const u=a.client.session,d=!!u,h=d&&!e;let g;switch(u==null?void 0:u.speakingState){case"listening":g="user-speaking";break;case"speaking":g="agent-speaking";break;case"thinking":g="thinking";break;case"busy":g="busy";break}const f=u==null?void 0:u.isPaused,m=a.client.state==="ready"&&l&&!c&&(a.client.selectedPlan||!((y=a.client.product)!=null&&y.widget_link_only_access)),B=h?100:62,b=()=>{var S,k,R,P,D,M;return{name:(S=a.client.selectedPlan)==null?void 0:S.name,description:(k=a.client.selectedPlan)==null?void 0:k.description,appName:(R=a.client.product)==null?void 0:R.name,appLogoUrl:((P=a.client.product)==null?void 0:P.logo_url)||"",url:(D=a.client.product)==null?void 0:D.url,agentName:((M=a.client.product)==null?void 0:M.agent_name)||"Obi"}};return p("div",{children:[e&&p(yU,{open:e,courses:a.client.plans.map(S=>({id:S.uuid,name:S.name,description:S.description||"",duration:S.duration||0})),loading:!1,agentName:((E=a.client.product)==null?void 0:E.agent_name)||"Obi",onCourseSelect:S=>{const k=a.client.plans.find(R=>R.uuid===S.id)||null;k&&(a.client.selectPlan(k),A(!1),i(!0))},onClose:S=>{S==="user-initiated"&&a.client.selectPlan(null),A(!1)}}),m&&p(Pe,{children:[p("div",{style:{position:"fixed",top:`calc(100vh - ${B}px)`,left:"50%",transform:"translateX(-50%)",width:"max-content"},children:p(iU,{inPlan:d,isActive:n?!1:void 0,defaultIsActive:!0,isPaused:f,messaging:(u==null?void 0:u.isMicShared)===!1?!0:void 0,speakingStatus:g,spectrum:()=>(u==null?void 0:u.audioSpectrum())||null,courseProgress:r,onOpen:()=>{A(!0)},onCancel:()=>{var S;(S=a.client.session)==null||S.stop()},onPause:()=>{var S,k;(k=(S=a.client.session)==null?void 0:S.pause)==null||k.call(S)},onUnpause:()=>{var S,k;(k=(S=a.client.session)==null?void 0:S.unpause)==null||k.call(S)},onMessagingChange:S=>{var k,R,P,D;S?(R=(k=a.client.session)==null?void 0:k.muteMicrophone)==null||R.call(k):(D=(P=a.client.session)==null?void 0:P.unmuteMicrophone)==null||D.call(P)},onMessage:S=>{a.say(S)}})}),!!a.client.selectedPlan&&p(QU,{open:!0,session:b(),sessionState:(u==null?void 0:u.state)||null,speakingState:(u==null?void 0:u.speakingState)||null,spectrum:()=>(u==null?void 0:u.audioSpectrum())||null,onClose:S=>{S==="user-initiated"&&a.client.stopSession(),i(!1)},onStart:()=>{a.client.selectedPlanUuid&&a.startSession()},onContinue:()=>{u==null||u.continue()},onShareMicrophone:()=>{u==null||u.shareMicrophone()}})]})]})}function TU(t,e,A,n){const[i,r]=Z(0),[s,a]=Z(null);return Ge(()=>{t.on("showMenu",o=>{e(o)}),t.on("configUpdated",()=>{r(o=>o+1)})},[t]),Ge(()=>{t.client&&(t.client.session&&a(t.client.session),t.client.on("sessionStarted",o=>{a(o),r(c=>c+1)}),t.client.on("sessionStopped",()=>{a(null),r(o=>o+1)}),t.client.on("sessionShutdown",()=>{r(o=>o+1)}),t.client.on("sessionResumed",()=>{r(o=>o+1)}),t.client.on("stateChanged",()=>{var o;t.client.state==="ready"&&A.style.setProperty("--obi-color-primary",((o=t.client.product)==null?void 0:o.primary_color)||"#9500FF"),r(c=>c+1)}),t.client.on("planSelected",()=>{r(o=>o+1)}))},[t,t.client]),Ge(()=>{if(!s)return;s.on("stateChanged",()=>{r(c=>c+1)}),s.on("speakingStateChanged",()=>{r(c=>c+1)}),s.on("paused",()=>{r(c=>c+1)}),s.on("unpaused",()=>{r(c=>c+1)});const o=c=>{n(c)};return s.on&&s.on("courseProgress",o),()=>{s.off&&s.off("courseProgress",o)}},[s]),t}function FU(t){const[e,A]=Z(()=>lo(t));return Ge(()=>{A(lo(t))},[t]),Ge(()=>{IU();const n=()=>{A(lo(t))};return window.addEventListener("locationchange",n),window.addEventListener("popstate",n),window.addEventListener("hashchange",n),()=>{window.removeEventListener("locationchange",n),window.removeEventListener("popstate",n),window.removeEventListener("hashchange",n)}},[t]),e}function IU(){const t=window;if(t.__obi_history_patched)return;const{pushState:e,replaceState:A}=window.history,n=i=>function(...r){const s=i.apply(this,r);return window.dispatchEvent(new Event("locationchange")),s};window.history.pushState=n(e),window.history.replaceState=n(A),t.__obi_history_patched=!0}function xU(t){if(document.querySelector("obi-widget"))return;_U();const e=document.createElement("div");e.id="host",e.style.position="fixed",e.style.zIndex="9999",document.body.appendChild(e);const A=e.attachShadow({mode:"open"}),n=document.createElement("div");n.id="obi-container",n.className="parentclass",A.appendChild(n);const i=new CSSStyleSheet;i.replaceSync(Sy),A.adoptedStyleSheets=[i],Uy(p(kU,{sdk:t,shadowHost:e}),n),console.log("[obi-sdk] widget mounted")}function _U(){af("https://fonts.cdnfonts.com/css/satoshi"),af("https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap")}function af(t){const e=document.createElement("link");e.href=t,e.rel="stylesheet",document.head.appendChild(e)}const of="49206C6F7665204F6269_session",cf="obi-url-params";class PU extends kr{constructor(e){super(),this.client=null,this.isActive=!1,this.primaryColour="#9500FF",this.passivePlanUuid=null,this.commandQueue=[],this._resumed=!1,this.dispatchCommand=(A,n)=>{var i,r;switch(A){case"update":this.updateConfig(n);break;case"endSession":(r=(i=this.client)==null?void 0:i.stopSession)==null||r.call(i);break;case"say":this.say(n);break;default:console.warn("[obi] unknown command",{commandType:A,args:n})}},e&&this.createClient(e),this.parsePassiveParams()}async createClient(e){if(this.client){this.client.appToken!==e&&console.warn("[obi] client already exists with different app token");return}let A=null;const n=this.load();if(n)try{A=vr.deserialise(n,e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)}),this._resumed=!0}catch(i){console.error("[obi] error loading cached client",i)}A||(A=new vr(e,"sdk",{apiBaseUrl:"https://app.coragents.ai",captureScreen:this.captureScreen.bind(this)})),this.client=A,this.client.on("stateChanged",i=>{var r,s,a;i==="ready"&&this.updateConfig({isActive:(r=this.client)==null?void 0:r.showWidget,primaryColour:((a=(s=this.client)==null?void 0:s.product)==null?void 0:a.primary_color)||"#9500FF"})}),this.client.on("sessionStarted",()=>{this.save(),this.passivePlanUuid=null}),this.client.on("sessionStopped",()=>{localStorage.removeItem("obi-client"),this.passivePlanUuid=null}),this.client.on("sessionShutdown",i=>{i==="invalid-room"&&localStorage.removeItem("obi-client")}),this.client.session&&this.client.resumeSession(i=>{i.on("stateChanged",r=>{r!=="disconnecting"&&r!=="disconnected"&&r!=="error"&&r!=="connecting"&&this.save()}),i.on("paused",()=>{this.save()}),i.on("unpaused",()=>{this.save()})})}async initialise(e={}){this.commandQueue=e.queuedCommands||[],this._resumed?(this._resumed=!1,this.dispatchCommandQueue()):this.client?this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised"),this.dispatchCommandQueue()}).catch(A=>{console.error("[obi] error initialising client",A),this.emit("error",A)}):this.dispatchCommandQueue()}async updateConfig(e){await this.updateAppToken(e.apiKey),this.updateActive(e.isActive),this.updatePrimaryColour(e.primaryColour),await this.updateIdentity(e.user),this.updateShowMenu(e.showMenu),this.emit("configUpdated")}async updateAppToken(e){var A;e===void 0||e==((A=this.client)==null?void 0:A.appToken)||(this.passivePlanUuid,await this.createClient(e),this.client&&await this.client.initialise({planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(n=>{console.error("[obi] error initialising client",n),this.emit("error",n)}))}updateActive(e){e===void 0||e==this.isActive||(this.isActive=e)}updatePrimaryColour(e){e===void 0||e==this.primaryColour||(this.primaryColour=e)}async updateIdentity(e){var n;if(e===void 0||e==((n=this.client)==null?void 0:n.identity))return;let A=e?{...e,extra:{...e,...(e==null?void 0:e.extra)||{}}}:void 0;await this.client.initialise({identity:A,planUuid:this.passivePlanUuid||void 0}).then(()=>{this.emit("initialised")}).catch(i=>{console.error("[obi] error initialising client",i),this.emit("error",i)})}updateShowMenu(e){e!==void 0&&this.emit("showMenu",e)}async say(e){var A,n,i;await((i=(n=(A=this.client)==null?void 0:A.session)==null?void 0:n.say)==null?void 0:i.call(n,e))}async startSession(){await this.client.startSession(this.client.selectedPlan.uuid,e=>{e.on("stateChanged",A=>{A!=="disconnecting"&&A!=="disconnected"&&A!=="error"&&A!=="connecting"&&this.save()})})}dispatchCommandQueue(){const e=this.commandQueue;this.commandQueue=[],e.forEach(A=>{try{this.dispatchCommand(A[0],A[1]||[])}catch(n){console.error("[obi] error dispatching command",n)}})}parsePassiveParams(){if(this.passivePlanUuid){this.passivePlanUuid;return}let e={};e=JSON.parse(localStorage.getItem(cf)||"{}"),Object.keys(e).length===0&&new URLSearchParams(window.location.search).forEach((r,s)=>{e[s]=r});const A=e[of];if(!A)return null;const n=new URL(window.location.href);n.searchParams.delete(of),window.history.replaceState({},"",n.toString()),n.toString(),localStorage.removeItem(cf),this.passivePlanUuid=A}mountWidget(){xU(this)}async captureScreen(){return(await Fv(document.documentElement,{useCORS:!0,allowTaint:!0,foreignObjectRendering:!0})).toDataURL("image/png")}save(){}load(){return localStorage.getItem("obi-client")}}async function lf(t){let e;try{e=window}catch{console.warn("[obi] no window object found"),e={}}return RU({appToken:t,window:e})}async function RU({appToken:t,window:e}){var i,r;if(e.obi){console.warn("[obi] obi object already found on window, skipping");return}t||(t=(i=e==null?void 0:e.obiWidgetConfig)==null?void 0:i.apiKey);let A;try{A=((r=e.ObiSDK)==null?void 0:r.q)||[]}catch{A=[]}const n=new PU(t);return e.ObiSDK=n.dispatchCommand,await n.initialise({queuedCommands:A}),e.obi=n,n.mountWidget(),n}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{lf()}):lf()})();