@fiction/widget 1.0.23 → 1.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/widget.js +1 -1
  2. package/package.json +7 -7
package/dist/widget.js CHANGED
@@ -1 +1 @@
1
- var FictionWidget=function(e){"use strict";var t=Object.defineProperty,r=(e,r,i)=>((e,r,i)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i)(e,"symbol"!=typeof r?r+"":r,i),i=Object.defineProperty,n=(e,t,r)=>((e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const o=e=>"symbol"==typeof e;let a;const s=()=>a||(a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(o)),s().requestIdleCallback,s().cancelIdleCallback;{const e=s(),t=(t,r)=>{let i;return(i=e[t])||(i=e[t]=[]),i.push(r),e=>{i.length>1?i.forEach(t=>t(e)):i[0](e)}};t("__VUE_INSTANCE_SETTERS__",e=>e),t("__VUE_SSR_SETTERS__",e=>e)}function l({prefix:e="id_"}={}){const t=e.length>=3?e.substring(0,3):e.padEnd(3,"_"),r=Math.floor(Date.now()/1e3).toString(16).padStart(8,"0");let i="";for(let n=0;n<16;n++)i+=Math.floor(16*Math.random()).toString(16);return t+r+i}m.default=m,m.stable=k,m.stableStringify=k;var c="[...]",d="[Circular]",u=[],h=[];function p(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function m(e,t,r,i){var n;void 0===i&&(i=p()),v(e,"",0,[],void 0,0,i);try{n=0===h.length?JSON.stringify(e,t,r):JSON.stringify(e,w(t),r)}catch(a){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==u.length;){var o=u.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return n}function g(e,t,r,i){var n=Object.getOwnPropertyDescriptor(i,r);void 0!==n.get?n.configurable?(Object.defineProperty(i,r,{value:e}),u.push([i,r,t,n])):h.push([t,r,e]):(i[r]=e,u.push([i,r,t]))}function v(e,t,r,i,n,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;s<i.length;s++)if(i[s]===e)return void g(d,e,t,n);if(void 0!==a.depthLimit&&o>a.depthLimit)return void g(c,e,t,n);if(void 0!==a.edgesLimit&&r+1>a.edgesLimit)return void g(c,e,t,n);if(i.push(e),Array.isArray(e))for(s=0;s<e.length;s++)v(e[s],s,s,i,e,o,a);else{var l=Object.keys(e);for(s=0;s<l.length;s++){var u=l[s];v(e[u],u,s,i,e,o,a)}}i.pop()}}function f(e,t){return e<t?-1:e>t?1:0}function k(e,t,r,i){void 0===i&&(i=p());var n,o=b(e,"",0,[],void 0,0,i)||e;try{n=0===h.length?JSON.stringify(o,t,r):JSON.stringify(o,w(t),r)}catch(s){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==u.length;){var a=u.pop();4===a.length?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return n}function b(e,t,r,i,n,o,a){var s;if(o+=1,"object"==typeof e&&null!==e){for(s=0;s<i.length;s++)if(i[s]===e)return void g(d,e,t,n);try{if("function"==typeof e.toJSON)return}catch(m){return}if(void 0!==a.depthLimit&&o>a.depthLimit)return void g(c,e,t,n);if(void 0!==a.edgesLimit&&r+1>a.edgesLimit)return void g(c,e,t,n);if(i.push(e),Array.isArray(e))for(s=0;s<e.length;s++)b(e[s],s,s,i,e,o,a);else{var l={},h=Object.keys(e).sort(f);for(s=0;s<h.length;s++){var p=h[s];b(e[p],p,s,i,e,o,a),l[p]=e[p]}if(void 0===n)return l;u.push([n,t,e]),n[t]=l}i.pop()}}function w(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(h.length>0)for(var i=0;i<h.length;i++){var n=h[i];if(n[1]===t&&n[0]===r){r=n[2],h.splice(i,1);break}}return e.call(this,t,r)}}!function(){var e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function t(e,t){var r=e[0],i=e[1],n=e[2],o=e[3];i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&n|~i&o)+t[0]-680876936|0)<<7|r>>>25)+i|0)&i|~r&n)+t[1]-389564586|0)<<12|o>>>20)+r|0)&r|~o&i)+t[2]+606105819|0)<<17|n>>>15)+o|0)&o|~n&r)+t[3]-1044525330|0)<<22|i>>>10)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&n|~i&o)+t[4]-176418897|0)<<7|r>>>25)+i|0)&i|~r&n)+t[5]+1200080426|0)<<12|o>>>20)+r|0)&r|~o&i)+t[6]-1473231341|0)<<17|n>>>15)+o|0)&o|~n&r)+t[7]-45705983|0)<<22|i>>>10)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&n|~i&o)+t[8]+1770035416|0)<<7|r>>>25)+i|0)&i|~r&n)+t[9]-1958414417|0)<<12|o>>>20)+r|0)&r|~o&i)+t[10]-42063|0)<<17|n>>>15)+o|0)&o|~n&r)+t[11]-1990404162|0)<<22|i>>>10)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&n|~i&o)+t[12]+1804603682|0)<<7|r>>>25)+i|0)&i|~r&n)+t[13]-40341101|0)<<12|o>>>20)+r|0)&r|~o&i)+t[14]-1502002290|0)<<17|n>>>15)+o|0)&o|~n&r)+t[15]+1236535329|0)<<22|i>>>10)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&o|n&~o)+t[1]-165796510|0)<<5|r>>>27)+i|0)&n|i&~n)+t[6]-1069501632|0)<<9|o>>>23)+r|0)&i|r&~i)+t[11]+643717713|0)<<14|n>>>18)+o|0)&r|o&~r)+t[0]-373897302|0)<<20|i>>>12)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&o|n&~o)+t[5]-701558691|0)<<5|r>>>27)+i|0)&n|i&~n)+t[10]+38016083|0)<<9|o>>>23)+r|0)&i|r&~i)+t[15]-660478335|0)<<14|n>>>18)+o|0)&r|o&~r)+t[4]-405537848|0)<<20|i>>>12)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&o|n&~o)+t[9]+568446438|0)<<5|r>>>27)+i|0)&n|i&~n)+t[14]-1019803690|0)<<9|o>>>23)+r|0)&i|r&~i)+t[3]-187363961|0)<<14|n>>>18)+o|0)&r|o&~r)+t[8]+1163531501|0)<<20|i>>>12)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i&o|n&~o)+t[13]-1444681467|0)<<5|r>>>27)+i|0)&n|i&~n)+t[2]-51403784|0)<<9|o>>>23)+r|0)&i|r&~i)+t[7]+1735328473|0)<<14|n>>>18)+o|0)&r|o&~r)+t[12]-1926607734|0)<<20|i>>>12)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i^n^o)+t[5]-378558|0)<<4|r>>>28)+i|0)^i^n)+t[8]-2022574463|0)<<11|o>>>21)+r|0)^r^i)+t[11]+1839030562|0)<<16|n>>>16)+o|0)^o^r)+t[14]-35309556|0)<<23|i>>>9)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i^n^o)+t[1]-1530992060|0)<<4|r>>>28)+i|0)^i^n)+t[4]+1272893353|0)<<11|o>>>21)+r|0)^r^i)+t[7]-155497632|0)<<16|n>>>16)+o|0)^o^r)+t[10]-1094730640|0)<<23|i>>>9)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i^n^o)+t[13]+681279174|0)<<4|r>>>28)+i|0)^i^n)+t[0]-358537222|0)<<11|o>>>21)+r|0)^r^i)+t[3]-722521979|0)<<16|n>>>16)+o|0)^o^r)+t[6]+76029189|0)<<23|i>>>9)+n|0,i=((i+=((n=((n+=((o=((o+=((r=((r+=(i^n^o)+t[9]-640364487|0)<<4|r>>>28)+i|0)^i^n)+t[12]-421815835|0)<<11|o>>>21)+r|0)^r^i)+t[15]+530742520|0)<<16|n>>>16)+o|0)^o^r)+t[2]-995338651|0)<<23|i>>>9)+n|0,i=((i+=((o=((o+=(i^((r=((r+=(n^(i|~o))+t[0]-198630844|0)<<6|r>>>26)+i|0)|~n))+t[7]+1126891415|0)<<10|o>>>22)+r|0)^((n=((n+=(r^(o|~i))+t[14]-1416354905|0)<<15|n>>>17)+o|0)|~r))+t[5]-57434055|0)<<21|i>>>11)+n|0,i=((i+=((o=((o+=(i^((r=((r+=(n^(i|~o))+t[12]+1700485571|0)<<6|r>>>26)+i|0)|~n))+t[3]-1894986606|0)<<10|o>>>22)+r|0)^((n=((n+=(r^(o|~i))+t[10]-1051523|0)<<15|n>>>17)+o|0)|~r))+t[1]-2054922799|0)<<21|i>>>11)+n|0,i=((i+=((o=((o+=(i^((r=((r+=(n^(i|~o))+t[8]+1873313359|0)<<6|r>>>26)+i|0)|~n))+t[15]-30611744|0)<<10|o>>>22)+r|0)^((n=((n+=(r^(o|~i))+t[6]-1560198380|0)<<15|n>>>17)+o|0)|~r))+t[13]+1309151649|0)<<21|i>>>11)+n|0,i=((i+=((o=((o+=(i^((r=((r+=(n^(i|~o))+t[4]-145523070|0)<<6|r>>>26)+i|0)|~n))+t[11]-1120210379|0)<<10|o>>>22)+r|0)^((n=((n+=(r^(o|~i))+t[2]+718787259|0)<<15|n>>>17)+o|0)|~r))+t[9]-343485551|0)<<21|i>>>11)+n|0,e[0]=r+e[0]|0,e[1]=i+e[1]|0,e[2]=n+e[2]|0,e[3]=o+e[3]|0}function r(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return r}function i(e){var t,r=[];for(t=0;t<64;t+=4)r[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return r}function n(e){var i,n,o,a,s,l,c=e.length,d=[1732584193,-271733879,-1732584194,271733878];for(i=64;i<=c;i+=64)t(d,r(e.substring(i-64,i)));for(n=(e=e.substring(i-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=0;i<n;i+=1)o[i>>2]|=e.charCodeAt(i)<<(i%4<<3);if(o[i>>2]|=128<<(i%4<<3),i>55)for(t(d,o),i=0;i<16;i+=1)o[i]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,o[14]=s,o[15]=l,t(d,o),d}function o(t){var r,i="";for(r=0;r<4;r+=1)i+=e[t>>8*r+4&15]+e[t>>8*r&15];return i}function a(e){var t;for(t=0;t<e.length;t+=1)e[t]=o(e[t]);return e.join("")}function s(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function l(e){var t,r=[],i=e.length;for(t=0;t<i-1;t+=2)r.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,r)}function c(){this.reset()}a(n("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function e(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(t,r){var i,n,o,a,s=this.byteLength,l=e(t,s),c=s;return undefined!==r&&(c=e(r,s)),l>c?new ArrayBuffer(0):(i=c-l,n=new ArrayBuffer(i),o=new Uint8Array(n),a=new Uint8Array(this,l,i),o.set(a),n)}}(),c.prototype.append=function(e){return this.appendBinary(s(e)),this},c.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var i,n=this._buff.length;for(i=64;i<=n;i+=64)t(this._hash,r(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},c.prototype.end=function(e){var t,r,i=this._buff,n=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)o[t>>2]|=i.charCodeAt(t)<<(t%4<<3);return this._finish(o,n),r=a(this._hash),e&&(r=l(r)),this.reset(),r},c.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},c.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},c.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},c.prototype._finish=function(e,r){var i,n,o,a=r;if(e[a>>2]|=128<<(a%4<<3),a>55)for(t(this._hash,e),a=0;a<16;a+=1)e[a]=0;i=(i=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),n=parseInt(i[2],16),o=parseInt(i[1],16)||0,e[14]=n,e[15]=o,t(this._hash,e)},c.hash=function(e,t){return c.hashBinary(s(e),t)},c.hashBinary=function(e,t){var r=a(n(e));return t?l(r):r},c.ArrayBuffer=function(){this.reset()},c.ArrayBuffer.prototype.append=function(e){var r,n,o,a,s=(n=this._buff.buffer,o=e,(a=new Uint8Array(n.byteLength+o.byteLength)).set(new Uint8Array(n)),a.set(new Uint8Array(o),n.byteLength),a),l=s.length;for(this._length+=e.byteLength,r=64;r<=l;r+=64)t(this._hash,i(s.subarray(r-64,r)));return this._buff=r-64<l?new Uint8Array(s.buffer.slice(r-64)):new Uint8Array(0),this},c.ArrayBuffer.prototype.end=function(e){var t,r,i=this._buff,n=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<n;t+=1)o[t>>2]|=i[t]<<(t%4<<3);return this._finish(o,n),r=a(this._hash),e&&(r=l(r)),this.reset(),r},c.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},c.ArrayBuffer.prototype.getState=function(){var e,t=c.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},c.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var r,i=e.length,n=new ArrayBuffer(i),o=new Uint8Array(n);for(r=0;r<i;r+=1)o[r]=e.charCodeAt(r);return t?o:n}(e.buff,!0),c.prototype.setState.call(this,e)},c.ArrayBuffer.prototype.destroy=c.prototype.destroy,c.ArrayBuffer.prototype._finish=c.prototype._finish,c.ArrayBuffer.hash=function(e,r){var n=a(function(e){var r,n,o,a,s,l,c=e.length,d=[1732584193,-271733879,-1732584194,271733878];for(r=64;r<=c;r+=64)t(d,i(e.subarray(r-64,r)));for(n=(e=r-64<c?e.subarray(r-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<n;r+=1)o[r>>2]|=e[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(t(d,o),r=0;r<16;r+=1)o[r]=0;return a=(a=8*c).toString(16).match(/(.*?)(.{0,8})$/),s=parseInt(a[2],16),l=parseInt(a[1],16)||0,o[14]=s,o[15]=l,t(d,o),d}(new Uint8Array(e)));return r?l(n):n}}();const y="undefined"!=typeof window,x=!y&&"undefined"!=typeof globalThis&&void 0!==globalThis.process,C={error:{priority:50,color:"#FF0000",nodeColor:"\x1b[31m"},warn:{priority:40,color:"#FFA500",nodeColor:"\x1b[33m"},info:{priority:30,color:"#00ABFF",nodeColor:"\x1b[36m"},debug:{priority:20,color:"#00BD0C",nodeColor:"\x1b[32m"},trace:{priority:10,color:"#5233FF",nodeColor:"\x1b[35m"}};class S{constructor(e={},t){n(this,"settings"),n(this,"enabledInBrowser",!1),n(this,"context"),this.context=t,this.settings={enabled:e.enabled??!0,minLevel:e.minLevel??(this.isProduction()?"info":"trace"),colors:e.colors??!0,timestamps:e.timestamps??!0},y&&this.initBrowserLogging()}isProduction(){var e,t;if(x)return"production"===(null==(t=null==(e=globalThis.process)?void 0:e.env)?void 0:t.NODE_ENV);if(y&&window.location){const e=window.location.hostname;return"localhost"!==e&&!e.includes("127.0.0.1")}return!1}initBrowserLogging(){var e;if(!y)return;const t=(null==(e=window.location)?void 0:e.hostname)||"";this.enabledInBrowser=!this.isProduction()||"localhost"===t||t.includes("127.0.0.1")||"true"===localStorage.getItem("enableLogging"),!this.enabledInBrowser&&this.isProduction()}shouldLog(e){return!!this.settings.enabled&&(!(y&&!this.enabledInBrowser)&&C[e].priority>=C[this.settings.minLevel].priority)}formatTimestamp(){return(new Date).toLocaleTimeString("en-GB",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}formatData(e,t=5,r=0,i=12e3,n=100){var o,a,s;if(r>=t)return`[Max Depth Reached: ${t}]`;if(null==e)return e;if(e instanceof Error)return{name:e.name,message:e.message,stack:null==(o=e.stack)?void 0:o.split("\n").slice(0,5).join("\n")};if(e instanceof Date)return`DATE: ${e.toISOString()}`;if("object"!=typeof e)return e;if(Array.isArray(e))return e.length>20?`Array(${e.length}) [${e.slice(0,3).map(e=>this.formatData(e,t,r+1,i,n)).join(", ")}, ...]`:e.map(e=>this.formatData(e,t,r+1,i,n));try{const t=JSON.stringify(e);if(t.length>i){return`[${(a=e)instanceof Map?"Map":a instanceof Set?"Set":(null==(s=a.constructor)?void 0:s.name)??"Object"}: ${Object.keys(e).length} properties, Size: ${t.length}/${i}]`}}catch{return"[Circular Reference or Unserializable]"}const l={},c=Object.entries(e).slice(0,n);for(const[d,u]of c)try{l[d]=this.formatData(u,t,r+1,i,n)}catch{l[d]="[Circular or Unserializable]"}return Object.keys(e).length>n&&(l["..."]=Object.keys(e).length-n+" more properties"),l}logToBrowser(e){if(!y||!this.shouldLog(e.level))return;const{level:t,description:r,context:i,data:n,error:o}=e,a=C[t];i||this.context,this.settings.timestamps&&this.formatTimestamp(),a.color,a.color,a.color,a.color,void 0!==n&&n instanceof Error&&n.stack}logError(e){const{error:t,context:r="Unknown Context",description:i}=e,n=t,o=(this.formatTimestamp(),"\x1b[0m");`\x1b[31m(${r}):${o}`.padEnd(15),n.message;n.message,n.stack&&n.stack.split("\n").slice(1,6).map(e=>`\x1b[2m${e.trim()}${o}`).join("\n")}logToNode(e){if(!x||!this.shouldLog(e.level))return;const{level:t,description:r,context:i,data:n,error:o}=e,a=C[t],s=i||this.context||"app";this.settings.timestamps&&this.formatTimestamp();if(o)return void this.logError({error:o,context:s,description:r});const l=this.settings.colors?a.nodeColor:"";t.toUpperCase(),`${l}(${s}):\x1b[0m`.padEnd(15),void 0!==n&&(n instanceof Error?this.logError({error:n,context:s}):this.formatData(n))}log(e){y?this.logToBrowser(e):x&&this.logToNode(e)}error(e,t){this.log({level:"error",description:e,data:t,context:this.context})}warn(e,t){this.log({level:"warn",description:e,data:t,context:this.context})}info(e,t){this.log({level:"info",description:e,data:t,context:this.context})}debug(e,t){this.log({level:"debug",description:e,data:t,context:this.context})}trace(e,t){this.log({level:"trace",description:e,data:t,context:this.context})}createContextLogger(e){const t=new S(this.settings,e);return{error:(e,r)=>t.error(e,r),warn:(e,r)=>t.warn(e,r),info:(e,r)=>t.info(e,r),debug:(e,r)=>t.debug(e,r),trace:(e,r)=>t.trace(e,r)}}setLevel(e){this.settings.minLevel=e}setEnabled(e){this.settings.enabled=e}}const T=new S;function E(e){const t=Object.create(null);for(const r of e.split(","))t[r]=1;return e=>e in t}T.error.bind(T),T.warn.bind(T),T.info.bind(T),T.debug.bind(T),T.trace.bind(T),new class{constructor(e=".body-content"){n(this,"originalBodyPosition"),n(this,"originalBodyTop"),n(this,"originalBodyLeft"),n(this,"originalBodyWidth"),n(this,"originalBodyOverflow"),n(this,"originalScrollPosition"),n(this,"siteContentElement"),n(this,"isActivated",!1),n(this,"clearTimeout"),this.originalBodyPosition="",this.originalBodyTop="",this.originalBodyLeft="",this.originalBodyWidth="",this.originalBodyOverflow="",this.originalScrollPosition=0,"undefined"!=typeof document&&(this.siteContentElement=document.querySelector(e))}activate(){if("undefined"==typeof document)return;this.clearTimeout&&clearTimeout(this.clearTimeout),this.isActivated=!0,this.originalBodyPosition=document.body.style.position,this.originalBodyTop=document.body.style.top,this.originalBodyLeft=document.body.style.left,this.originalBodyWidth=document.body.style.width,this.originalBodyOverflow=document.body.style.overflow,this.originalScrollPosition=window.pageYOffset;const e=window.innerHeight,t=document.documentElement.scrollHeight-e,r=t>0?this.originalScrollPosition/t:0,i=Math.min(Math.max(100*r,30),70);document.body.style.position="fixed",document.body.style.top=`-${this.originalScrollPosition}px`,document.body.style.left="0",document.body.style.width="100%",document.body.style.overflow="hidden",this.siteContentElement&&(this.siteContentElement.style.transformOrigin=`center ${i}%`,this.siteContentElement.style.transform="scale(.96)",this.siteContentElement.style.transition="transform .75s cubic-bezier(0.25, 1, 0.33, 1)",this.siteContentElement.style.overflow="hidden")}deactivate(){"undefined"!=typeof document&&this.isActivated&&(this.isActivated=!1,document.body.style.position=this.originalBodyPosition,document.body.style.top=this.originalBodyTop,document.body.style.left=this.originalBodyLeft,document.body.style.width=this.originalBodyWidth,document.body.style.overflow=this.originalBodyOverflow,this.siteContentElement&&(this.siteContentElement.style.transform="scale(1)",this.siteContentElement.style.overflow=""),window.scrollTo(0,this.originalScrollPosition),this.clearTimeout=setTimeout(()=>{this.siteContentElement&&(this.siteContentElement.style.transform="",this.siteContentElement.style.transformOrigin="",this.siteContentElement.style.transition="")},1500))}},new class{constructor(){n(this,"callbacks",new Set),n(this,"initialized",!1)}get _testCallbacks(){return this.callbacks}get _testInitialized(){return this.initialized}set _testInitialized(e){this.initialized=e}onReset(e){return"undefined"==typeof window?()=>{}:(this.callbacks.add(e),this.init(),()=>this.callbacks.delete(e))}reset(){this.callbacks.forEach(e=>{try{e()}catch(t){}})}init(){this.initialized||"undefined"==typeof window||(this.initialized=!0,window.addEventListener("keydown",e=>{"Escape"===e.key&&this.reset()}),window.addEventListener("click",()=>this.reset()),this.initRouteWatcher())}initRouteWatcher(){window.addEventListener("popstate",()=>this.reset());const e=history.pushState.bind(history),t=history.replaceState.bind(history);history.pushState=(...t)=>{e(...t),setTimeout(()=>this.reset(),0)},history.replaceState=(...e)=>{t(...e),setTimeout(()=>this.reset(),0)}}};const _={},I=[],P=()=>{},M=()=>!1,A=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),R=e=>e.startsWith("onUpdate:"),O=Object.assign,D=(e,t)=>{const r=e.indexOf(t);r>-1&&e.splice(r,1)},L=Object.prototype.hasOwnProperty,N=(e,t)=>L.call(e,t),z=Array.isArray,j=e=>"[object Map]"===W(e),U=e=>"[object Set]"===W(e),F=e=>"function"==typeof e,B=e=>"string"==typeof e,V=e=>"symbol"==typeof e,q=e=>null!==e&&"object"==typeof e,$=e=>(q(e)||F(e))&&F(e.then)&&F(e.catch),H=Object.prototype.toString,W=e=>H.call(e),G=e=>"[object Object]"===W(e),Z=e=>B(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,J=E(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),K=e=>{const t=Object.create(null);return r=>t[r]||(t[r]=e(r))},Y=/-\w/g,Q=K(e=>e.replace(Y,e=>e.slice(1).toUpperCase())),X=/\B([A-Z])/g,ee=K(e=>e.replace(X,"-$1").toLowerCase()),te=K(e=>e.charAt(0).toUpperCase()+e.slice(1)),re=K(e=>e?`on${te(e)}`:""),ie=(e,t)=>!Object.is(e,t),ne=(e,...t)=>{for(let r=0;r<e.length;r++)e[r](...t)},oe=(e,t,r,i=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:i,value:r})},ae=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let se;const le=()=>se||(se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function ce(e){if(z(e)){const t={};for(let r=0;r<e.length;r++){const i=e[r],n=B(i)?pe(i):ce(i);if(n)for(const e in n)t[e]=n[e]}return t}if(B(e)||q(e))return e}const de=/;(?![^(]*\))/g,ue=/:([^]+)/,he=/\/\*[^]*?\*\//g;function pe(e){const t={};return e.replace(he,"").split(de).forEach(e=>{if(e){const r=e.split(ue);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function me(e){let t="";if(B(e))t=e;else if(z(e))for(let r=0;r<e.length;r++){const i=me(e[r]);i&&(t+=i+" ")}else if(q(e))for(const r in e)e[r]&&(t+=r+" ");return t.trim()}const ge=E("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function ve(e){return!!e||""===e}const fe=e=>!(!e||!0!==e.__v_isRef),ke=e=>B(e)?e:null==e?"":z(e)||q(e)&&(e.toString===H||!F(e.toString))?fe(e)?ke(e.value):JSON.stringify(e,be,2):String(e),be=(e,t)=>fe(t)?be(e,t.value):j(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,r],i)=>(e[we(t,i)+" =>"]=r,e),{})}:U(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>we(e))}:V(t)?we(t):!q(t)||z(t)||G(t)?t:String(t),we=(e,t="")=>{var r;return V(e)?`Symbol(${null!=(r=e.description)?r:t})`:e};let ye,xe;class Ce{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=ye,!e&&ye&&(this.index=(ye.scopes||(ye.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=ye;try{return ye=this,e()}finally{ye=t}}}on(){1===++this._on&&(this.prevScope=ye,ye=this)}off(){this._on>0&&0===--this._on&&(ye=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){let t,r;for(this._active=!1,t=0,r=this.effects.length;t<r;t++)this.effects[t].stop();for(this.effects.length=0,t=0,r=this.cleanups.length;t<r;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,r=this.scopes.length;t<r;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}const Se=new WeakSet;class Te{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,ye&&ye.active&&ye.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,Se.has(this)&&(Se.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||Pe(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,Ve(this),Re(this);const e=xe,t=je;xe=this,je=!0;try{return this.fn()}finally{Oe(this),xe=e,je=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)Ne(e);this.deps=this.depsTail=void 0,Ve(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?Se.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){De(this)&&this.run()}get dirty(){return De(this)}}let Ee,_e,Ie=0;function Pe(e,t=!1){if(e.flags|=8,t)return e.next=_e,void(_e=e);e.next=Ee,Ee=e}function Me(){Ie++}function Ae(){if(--Ie>0)return;if(_e){let e=_e;for(_e=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Ee;){let r=Ee;for(Ee=void 0;r;){const i=r.next;if(r.next=void 0,r.flags&=-9,1&r.flags)try{r.trigger()}catch(t){e||(e=t)}r=i}}if(e)throw e}function Re(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Oe(e){let t,r=e.depsTail,i=r;for(;i;){const e=i.prevDep;-1===i.version?(i===r&&(r=e),Ne(i),ze(i)):t=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=e}e.deps=t,e.depsTail=r}function De(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Le(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Le(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===qe)return;if(e.globalVersion=qe,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!De(e)))return;e.flags|=2;const t=e.dep,r=xe,i=je;xe=e,je=!0;try{Re(e);const r=e.fn(e._value);(0===t.version||ie(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(n){throw t.version++,n}finally{xe=r,je=i,Oe(e),e.flags&=-3}}function Ne(e,t=!1){const{dep:r,prevSub:i,nextSub:n}=e;if(i&&(i.nextSub=n,e.prevSub=void 0),n&&(n.prevSub=i,e.nextSub=void 0),r.subs===e&&(r.subs=i,!i&&r.computed)){r.computed.flags&=-5;for(let e=r.computed.deps;e;e=e.nextDep)Ne(e,!0)}t||--r.sc||!r.map||r.map.delete(r.key)}function ze(e){const{prevDep:t,nextDep:r}=e;t&&(t.nextDep=r,e.prevDep=void 0),r&&(r.prevDep=t,e.nextDep=void 0)}let je=!0;const Ue=[];function Fe(){Ue.push(je),je=!1}function Be(){const e=Ue.pop();je=void 0===e||e}function Ve(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=xe;xe=void 0;try{t()}finally{xe=e}}}let qe=0;class $e{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class He{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!xe||!je||xe===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==xe)t=this.activeLink=new $e(xe,this),xe.deps?(t.prevDep=xe.depsTail,xe.depsTail.nextDep=t,xe.depsTail=t):xe.deps=xe.depsTail=t,We(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=xe.depsTail,t.nextDep=void 0,xe.depsTail.nextDep=t,xe.depsTail=t,xe.deps===t&&(xe.deps=e)}return t}trigger(e){this.version++,qe++,this.notify(e)}notify(e){Me();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ae()}}}function We(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)We(e)}const r=e.dep.subs;r!==e&&(e.prevSub=r,r&&(r.nextSub=e)),e.dep.subs=e}}const Ge=new WeakMap,Ze=Symbol(""),Je=Symbol(""),Ke=Symbol("");function Ye(e,t,r){if(je&&xe){let t=Ge.get(e);t||Ge.set(e,t=new Map);let i=t.get(r);i||(t.set(r,i=new He),i.map=t,i.key=r),i.track()}}function Qe(e,t,r,i,n,o){const a=Ge.get(e);if(!a)return void qe++;const s=e=>{e&&e.trigger()};if(Me(),"clear"===t)a.forEach(s);else{const n=z(e),o=n&&Z(r);if(n&&"length"===r){const e=Number(i);a.forEach((t,r)=>{("length"===r||r===Ke||!V(r)&&r>=e)&&s(t)})}else switch((void 0!==r||a.has(void 0))&&s(a.get(r)),o&&s(a.get(Ke)),t){case"add":n?o&&s(a.get("length")):(s(a.get(Ze)),j(e)&&s(a.get(Je)));break;case"delete":n||(s(a.get(Ze)),j(e)&&s(a.get(Je)));break;case"set":j(e)&&s(a.get(Ze))}}Ae()}function Xe(e){const t=Lt(e);return t===e?t:(Ye(t,0,Ke),Ot(e)?t:t.map(Nt))}function et(e){return Ye(e=Lt(e),0,Ke),e}const tt={__proto__:null,[Symbol.iterator](){return rt(this,Symbol.iterator,Nt)},concat(...e){return Xe(this).concat(...e.map(e=>z(e)?Xe(e):e))},entries(){return rt(this,"entries",e=>(e[1]=Nt(e[1]),e))},every(e,t){return nt(this,"every",e,t,void 0,arguments)},filter(e,t){return nt(this,"filter",e,t,e=>e.map(Nt),arguments)},find(e,t){return nt(this,"find",e,t,Nt,arguments)},findIndex(e,t){return nt(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return nt(this,"findLast",e,t,Nt,arguments)},findLastIndex(e,t){return nt(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return nt(this,"forEach",e,t,void 0,arguments)},includes(...e){return at(this,"includes",e)},indexOf(...e){return at(this,"indexOf",e)},join(e){return Xe(this).join(e)},lastIndexOf(...e){return at(this,"lastIndexOf",e)},map(e,t){return nt(this,"map",e,t,void 0,arguments)},pop(){return st(this,"pop")},push(...e){return st(this,"push",e)},reduce(e,...t){return ot(this,"reduce",e,t)},reduceRight(e,...t){return ot(this,"reduceRight",e,t)},shift(){return st(this,"shift")},some(e,t){return nt(this,"some",e,t,void 0,arguments)},splice(...e){return st(this,"splice",e)},toReversed(){return Xe(this).toReversed()},toSorted(e){return Xe(this).toSorted(e)},toSpliced(...e){return Xe(this).toSpliced(...e)},unshift(...e){return st(this,"unshift",e)},values(){return rt(this,"values",Nt)}};function rt(e,t,r){const i=et(e),n=i[t]();return i===e||Ot(e)||(n._next=n.next,n.next=()=>{const e=n._next();return e.done||(e.value=r(e.value)),e}),n}const it=Array.prototype;function nt(e,t,r,i,n,o){const a=et(e),s=a!==e&&!Ot(e),l=a[t];if(l!==it[t]){const t=l.apply(e,o);return s?Nt(t):t}let c=r;a!==e&&(s?c=function(t,i){return r.call(this,Nt(t),i,e)}:r.length>2&&(c=function(t,i){return r.call(this,t,i,e)}));const d=l.call(a,c,i);return s&&n?n(d):d}function ot(e,t,r,i){const n=et(e);let o=r;return n!==e&&(Ot(e)?r.length>3&&(o=function(t,i,n){return r.call(this,t,i,n,e)}):o=function(t,i,n){return r.call(this,t,Nt(i),n,e)}),n[t](o,...i)}function at(e,t,r){const i=Lt(e);Ye(i,0,Ke);const n=i[t](...r);return-1!==n&&!1!==n||!Dt(r[0])?n:(r[0]=Lt(r[0]),i[t](...r))}function st(e,t,r=[]){Fe(),Me();const i=Lt(e)[t].apply(e,r);return Ae(),Be(),i}const lt=E("__proto__,__v_isRef,__isVue"),ct=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(V));function dt(e){V(e)||(e=String(e));const t=Lt(this);return Ye(t,0,e),t.hasOwnProperty(e)}class ut{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,r){if("__v_skip"===t)return e.__v_skip;const i=this._isReadonly,n=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return n;if("__v_raw"===t)return r===(i?n?_t:Et:n?Tt:St).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=z(e);if(!i){let e;if(o&&(e=tt[t]))return e;if("hasOwnProperty"===t)return dt}const a=Reflect.get(e,t,jt(e)?e:r);if(V(t)?ct.has(t):lt(t))return a;if(i||Ye(e,0,t),n)return a;if(jt(a)){const e=o&&Z(t)?a:a.value;return i&&q(e)?Pt(e):e}return q(a)?i?Pt(a):It(a):a}}class ht extends ut{constructor(e=!1){super(!1,e)}set(e,t,r,i){let n=e[t];if(!this._isShallow){const t=Rt(n);if(Ot(r)||Rt(r)||(n=Lt(n),r=Lt(r)),!z(e)&&jt(n)&&!jt(r))return t||(n.value=r),!0}const o=z(e)&&Z(t)?Number(t)<e.length:N(e,t),a=Reflect.set(e,t,r,jt(e)?e:i);return e===Lt(i)&&(o?ie(r,n)&&Qe(e,"set",t,r):Qe(e,"add",t,r)),a}deleteProperty(e,t){const r=N(e,t);e[t];const i=Reflect.deleteProperty(e,t);return i&&r&&Qe(e,"delete",t,void 0),i}has(e,t){const r=Reflect.has(e,t);return V(t)&&ct.has(t)||Ye(e,0,t),r}ownKeys(e){return Ye(e,0,z(e)?"length":Ze),Reflect.ownKeys(e)}}class pt extends ut{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const mt=new ht,gt=new pt,vt=new ht(!0),ft=e=>e,kt=e=>Reflect.getPrototypeOf(e);function bt(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function wt(e,t){const r=function(e,t){const r={get(r){const i=this.__v_raw,n=Lt(i),o=Lt(r);e||(ie(r,o)&&Ye(n,0,r),Ye(n,0,o));const{has:a}=kt(n),s=t?ft:e?zt:Nt;return a.call(n,r)?s(i.get(r)):a.call(n,o)?s(i.get(o)):void(i!==n&&i.get(r))},get size(){const t=this.__v_raw;return!e&&Ye(Lt(t),0,Ze),t.size},has(t){const r=this.__v_raw,i=Lt(r),n=Lt(t);return e||(ie(t,n)&&Ye(i,0,t),Ye(i,0,n)),t===n?r.has(t):r.has(t)||r.has(n)},forEach(r,i){const n=this,o=n.__v_raw,a=Lt(o),s=t?ft:e?zt:Nt;return!e&&Ye(a,0,Ze),o.forEach((e,t)=>r.call(i,s(e),s(t),n))}};return O(r,e?{add:bt("add"),set:bt("set"),delete:bt("delete"),clear:bt("clear")}:{add(e){t||Ot(e)||Rt(e)||(e=Lt(e));const r=Lt(this);return kt(r).has.call(r,e)||(r.add(e),Qe(r,"add",e,e)),this},set(e,r){t||Ot(r)||Rt(r)||(r=Lt(r));const i=Lt(this),{has:n,get:o}=kt(i);let a=n.call(i,e);a||(e=Lt(e),a=n.call(i,e));const s=o.call(i,e);return i.set(e,r),a?ie(r,s)&&Qe(i,"set",e,r):Qe(i,"add",e,r),this},delete(e){const t=Lt(this),{has:r,get:i}=kt(t);let n=r.call(t,e);n||(e=Lt(e),n=r.call(t,e)),i&&i.call(t,e);const o=t.delete(e);return n&&Qe(t,"delete",e,void 0),o},clear(){const e=Lt(this),t=0!==e.size,r=e.clear();return t&&Qe(e,"clear",void 0,void 0),r}}),["keys","values","entries",Symbol.iterator].forEach(i=>{r[i]=function(e,t,r){return function(...i){const n=this.__v_raw,o=Lt(n),a=j(o),s="entries"===e||e===Symbol.iterator&&a,l="keys"===e&&a,c=n[e](...i),d=r?ft:t?zt:Nt;return!t&&Ye(o,0,l?Je:Ze),{next(){const{value:e,done:t}=c.next();return t?{value:e,done:t}:{value:s?[d(e[0]),d(e[1])]:d(e),done:t}},[Symbol.iterator](){return this}}}}(i,e,t)}),r}(e,t);return(t,i,n)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(N(r,i)&&i in t?r:t,i,n)}const yt={get:wt(!1,!1)},xt={get:wt(!1,!0)},Ct={get:wt(!0,!1)},St=new WeakMap,Tt=new WeakMap,Et=new WeakMap,_t=new WeakMap;function It(e){return Rt(e)?e:Mt(e,!1,mt,yt,St)}function Pt(e){return Mt(e,!0,gt,Ct,Et)}function Mt(e,t,r,i,n){if(!q(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const o=(a=e).__v_skip||!Object.isExtensible(a)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>W(e).slice(8,-1))(a));var a;if(0===o)return e;const s=n.get(e);if(s)return s;const l=new Proxy(e,2===o?i:r);return n.set(e,l),l}function At(e){return Rt(e)?At(e.__v_raw):!(!e||!e.__v_isReactive)}function Rt(e){return!(!e||!e.__v_isReadonly)}function Ot(e){return!(!e||!e.__v_isShallow)}function Dt(e){return!!e&&!!e.__v_raw}function Lt(e){const t=e&&e.__v_raw;return t?Lt(t):e}const Nt=e=>q(e)?It(e):e,zt=e=>q(e)?Pt(e):e;function jt(e){return!!e&&!0===e.__v_isRef}function Ut(e){return Ft(e,!1)}function Ft(e,t){return jt(e)?e:new Bt(e,t)}class Bt{constructor(e,t){this.dep=new He,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Lt(e),this._value=t?e:Nt(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,r=this.__v_isShallow||Ot(e)||Rt(e);e=r?e:Lt(e),ie(e,t)&&(this._rawValue=e,this._value=r?e:Nt(e),this.dep.trigger())}}function Vt(e){return jt(e)?e.value:e}const qt={get:(e,t,r)=>"__v_raw"===t?e:Vt(Reflect.get(e,t,r)),set:(e,t,r,i)=>{const n=e[t];return jt(n)&&!jt(r)?(n.value=r,!0):Reflect.set(e,t,r,i)}};function $t(e){return At(e)?e:new Proxy(e,qt)}class Ht{constructor(e,t,r){this.fn=e,this.setter=t,this._value=void 0,this.dep=new He(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=qe-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=r}notify(){if(this.flags|=16,!(8&this.flags)&&xe!==this)return Pe(this,!0),!0}get value(){const e=this.dep.track();return Le(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}const Wt={},Gt=new WeakMap;let Zt;function Jt(e,t=1/0,r){if(t<=0||!q(e)||e.__v_skip)return e;if(((r=r||new Map).get(e)||0)>=t)return e;if(r.set(e,t),t--,jt(e))Jt(e.value,t,r);else if(z(e))for(let i=0;i<e.length;i++)Jt(e[i],t,r);else if(U(e)||j(e))e.forEach(e=>{Jt(e,t,r)});else if(G(e)){for(const i in e)Jt(e[i],t,r);for(const i of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,i)&&Jt(e[i],t,r)}return e}function Kt(e,t,r,i){try{return i?e(...i):e()}catch(n){Qt(n,t,r)}}function Yt(e,t,r,i){if(F(e)){const n=Kt(e,t,r,i);return n&&$(n)&&n.catch(e=>{Qt(e,t,r)}),n}if(z(e)){const n=[];for(let o=0;o<e.length;o++)n.push(Yt(e[o],t,r,i));return n}}function Qt(e,t,r,i=!0){t&&t.vnode;const{errorHandler:n,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||_;if(t){let i=t.parent;const o=t.proxy,a=`https://vuejs.org/error-reference/#runtime-${r}`;for(;i;){const t=i.ec;if(t)for(let r=0;r<t.length;r++)if(!1===t[r](e,o,a))return;i=i.parent}if(n)return Fe(),Kt(n,null,10,[e,o,a]),void Be()}!function(e,t,r,i=!0,n=!1){if(n)throw e}(e,0,0,i,o)}const Xt=[];let er=-1;const tr=[];let rr=null,ir=0;const nr=Promise.resolve();let or=null;function ar(e){const t=or||nr;return e?t.then(this?e.bind(this):e):t}function sr(e){if(!(1&e.flags)){const t=ur(e),r=Xt[Xt.length-1];!r||!(2&e.flags)&&t>=ur(r)?Xt.push(e):Xt.splice(function(e){let t=er+1,r=Xt.length;for(;t<r;){const i=t+r>>>1,n=Xt[i],o=ur(n);o<e||o===e&&2&n.flags?t=i+1:r=i}return t}(t),0,e),e.flags|=1,lr()}}function lr(){or||(or=nr.then(hr))}function cr(e,t,r=er+1){for(;r<Xt.length;r++){const t=Xt[r];if(t&&2&t.flags){if(e&&t.id!==e.uid)continue;Xt.splice(r,1),r--,4&t.flags&&(t.flags&=-2),t(),4&t.flags||(t.flags&=-2)}}}function dr(e){if(tr.length){const e=[...new Set(tr)].sort((e,t)=>ur(e)-ur(t));if(tr.length=0,rr)return void rr.push(...e);for(rr=e,ir=0;ir<rr.length;ir++){const e=rr[ir];4&e.flags&&(e.flags&=-2),8&e.flags||e(),e.flags&=-2}rr=null,ir=0}}const ur=e=>null==e.id?2&e.flags?-1:1/0:e.id;function hr(e){try{for(er=0;er<Xt.length;er++){const e=Xt[er];!e||8&e.flags||(4&e.flags&&(e.flags&=-2),Kt(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2))}}finally{for(;er<Xt.length;er++){const e=Xt[er];e&&(e.flags&=-2)}er=-1,Xt.length=0,dr(),or=null,(Xt.length||tr.length)&&hr()}}let pr=null,mr=null;function gr(e){const t=pr;return pr=e,mr=e&&e.type.__scopeId||null,t}function vr(e,t=pr,r){if(!t)return e;if(e._n)return e;const i=(...r)=>{i._d&&Cn(-1);const n=gr(t);let o;try{o=e(...r)}finally{gr(n),i._d&&Cn(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function fr(e,t){if(null===pr)return e;const r=Xn(pr),i=e.dirs||(e.dirs=[]);for(let n=0;n<t.length;n++){let[e,o,a,s=_]=t[n];e&&(F(e)&&(e={mounted:e,updated:e}),e.deep&&Jt(o),i.push({dir:e,instance:r,value:o,oldValue:void 0,arg:a,modifiers:s}))}return e}function kr(e,t,r,i){const n=e.dirs,o=t&&t.dirs;for(let a=0;a<n.length;a++){const s=n[a];o&&(s.oldValue=o[a].value);let l=s.dir[i];l&&(Fe(),Yt(l,r,8,[e.el,s,e,t]),Be())}}const br=Symbol("_vte"),wr=e=>e.__isTeleport,yr=Symbol("_leaveCb"),xr=Symbol("_enterCb");function Cr(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Jr(()=>{e.isMounted=!0}),Qr(()=>{e.isUnmounting=!0}),e}const Sr=[Function,Array],Tr={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Sr,onEnter:Sr,onAfterEnter:Sr,onEnterCancelled:Sr,onBeforeLeave:Sr,onLeave:Sr,onAfterLeave:Sr,onLeaveCancelled:Sr,onBeforeAppear:Sr,onAppear:Sr,onAfterAppear:Sr,onAppearCancelled:Sr},Er=e=>{const t=e.subTree;return t.component?Er(t.component):t};function _r(e){let t=e[0];if(e.length>1)for(const r of e)if(r.type!==fn){t=r;break}return t}const Ir={name:"BaseTransition",props:Tr,setup(e,{slots:t}){const r=qn(),i=Cr();return()=>{const n=t.default&&Dr(t.default(),!0);if(!n||!n.length)return;const o=_r(n),a=Lt(e),{mode:s}=a;if(i.isLeaving)return Ar(o);const l=Rr(o);if(!l)return Ar(o);let c=Mr(l,a,i,r,e=>c=e);l.type!==fn&&Or(l,c);let d=r.subTree&&Rr(r.subTree);if(d&&d.type!==fn&&!In(d,l)&&Er(r).type!==fn){let e=Mr(d,a,i,r);if(Or(d,e),"out-in"===s&&l.type!==fn)return i.isLeaving=!0,e.afterLeave=()=>{i.isLeaving=!1,8&r.job.flags||r.update(),delete e.afterLeave,d=void 0},Ar(o);"in-out"===s&&l.type!==fn?e.delayLeave=(e,t,r)=>{Pr(i,d)[String(d.key)]=d,e[yr]=()=>{t(),e[yr]=void 0,delete c.delayedLeave,d=void 0},c.delayedLeave=()=>{r(),delete c.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return o}}};function Pr(e,t){const{leavingVNodes:r}=e;let i=r.get(t.type);return i||(i=Object.create(null),r.set(t.type,i)),i}function Mr(e,t,r,i,n){const{appear:o,mode:a,persisted:s=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:u,onBeforeLeave:h,onLeave:p,onAfterLeave:m,onLeaveCancelled:g,onBeforeAppear:v,onAppear:f,onAfterAppear:k,onAppearCancelled:b}=t,w=String(e.key),y=Pr(r,e),x=(e,t)=>{e&&Yt(e,i,9,t)},C=(e,t)=>{const r=t[1];x(e,t),z(e)?e.every(e=>e.length<=1)&&r():e.length<=1&&r()},S={mode:a,persisted:s,beforeEnter(t){let i=l;if(!r.isMounted){if(!o)return;i=v||l}t[yr]&&t[yr](!0);const n=y[w];n&&In(e,n)&&n.el[yr]&&n.el[yr](),x(i,[t])},enter(e){let t=c,i=d,n=u;if(!r.isMounted){if(!o)return;t=f||c,i=k||d,n=b||u}let a=!1;const s=e[xr]=t=>{a||(a=!0,x(t?n:i,[e]),S.delayedLeave&&S.delayedLeave(),e[xr]=void 0)};t?C(t,[e,s]):s()},leave(t,i){const n=String(e.key);if(t[xr]&&t[xr](!0),r.isUnmounting)return i();x(h,[t]);let o=!1;const a=t[yr]=r=>{o||(o=!0,i(),x(r?g:m,[t]),t[yr]=void 0,y[n]===e&&delete y[n])};y[n]=e,p?C(p,[t,a]):a()},clone(e){const o=Mr(e,t,r,i,n);return n&&n(o),o}};return S}function Ar(e){if(Br(e))return(e=On(e)).children=null,e}function Rr(e){if(!Br(e))return wr(e.type)&&e.children?_r(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:r}=e;if(r){if(16&t)return r[0];if(32&t&&F(r.default))return r.default()}}function Or(e,t){6&e.shapeFlag&&e.component?(e.transition=t,Or(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Dr(e,t=!1,r){let i=[],n=0;for(let o=0;o<e.length;o++){let a=e[o];const s=null==r?a.key:String(r)+String(null!=a.key?a.key:o);a.type===gn?(128&a.patchFlag&&n++,i=i.concat(Dr(a.children,t,s))):(t||a.type!==fn)&&i.push(null!=s?On(a,{key:s}):a)}if(n>1)for(let o=0;o<i.length;o++)i[o].patchFlag=-2;return i}function Lr(e,t){return F(e)?(()=>O({name:e.name},t,{setup:e}))():e}function Nr(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}const zr=new WeakMap;function jr(e,t,r,i,n=!1){if(z(e))return void e.forEach((e,o)=>jr(e,t&&(z(t)?t[o]:t),r,i,n));if(Fr(i)&&!n)return void(512&i.shapeFlag&&i.type.__asyncResolved&&i.component.subTree.component&&jr(e,t,r,i.component.subTree));const o=4&i.shapeFlag?Xn(i.component):i.el,a=n?null:o,{i:s,r:l}=e,c=t&&t.r,d=s.refs===_?s.refs={}:s.refs,u=s.setupState,h=Lt(u),p=u===_?M:e=>N(h,e);if(null!=c&&c!==l)if(Ur(t),B(c))d[c]=null,p(c)&&(u[c]=null);else if(jt(c)){c.value=null;const e=t;e.k&&(d[e.k]=null)}if(F(l))Kt(l,s,12,[a,d]);else{const t=B(l),i=jt(l);if(t||i){const s=()=>{if(e.f){const r=t?p(l)?u[l]:d[l]:l.value;if(n)z(r)&&D(r,o);else if(z(r))r.includes(o)||r.push(o);else if(t)d[l]=[o],p(l)&&(u[l]=d[l]);else{const t=[o];l.value=t,e.k&&(d[e.k]=t)}}else t?(d[l]=a,p(l)&&(u[l]=a)):i&&(l.value=a,e.k&&(d[e.k]=a))};if(a){const t=()=>{s(),zr.delete(e)};t.id=-1,zr.set(e,t),Hi(t,r)}else Ur(e),s()}}}function Ur(e){const t=zr.get(e);t&&(t.flags|=8,zr.delete(e))}le().requestIdleCallback,le().cancelIdleCallback;const Fr=e=>!!e.type.__asyncLoader,Br=e=>e.type.__isKeepAlive;function Vr(e,t){$r(e,"a",t)}function qr(e,t){$r(e,"da",t)}function $r(e,t,r=Vn){const i=e.__wdc||(e.__wdc=()=>{let t=r;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Wr(t,i,r),r){let e=r.parent;for(;e&&e.parent;)Br(e.parent.vnode)&&Hr(i,t,r,e),e=e.parent}}function Hr(e,t,r,i){const n=Wr(t,e,i,!0);Xr(()=>{D(i[t],n)},r)}function Wr(e,t,r=Vn,i=!1){if(r){const n=r[e]||(r[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Fe();const n=Wn(r),o=Yt(t,r,e,i);return n(),Be(),o});return i?n.unshift(o):n.push(o),o}}const Gr=e=>(t,r=Vn)=>{Jn&&"sp"!==e||Wr(e,(...e)=>t(...e),r)},Zr=Gr("bm"),Jr=Gr("m"),Kr=Gr("bu"),Yr=Gr("u"),Qr=Gr("bum"),Xr=Gr("um"),ei=Gr("sp"),ti=Gr("rtg"),ri=Gr("rtc");function ii(e,t=Vn){Wr("ec",e,t)}const ni=Symbol.for("v-ndc");function oi(e){return B(e)?function(e,t,r=!0,i=!1){const n=pr||Vn;if(n){const r=n.type;{const e=function(e,t=!0){return F(e)?e.displayName||e.name:e.name||t&&e.__name}(r,!1);if(e&&(e===t||e===Q(t)||e===te(Q(t))))return r}const o=ai(n[e]||r[e],t)||ai(n.appContext[e],t);return!o&&i?r:o}}("components",e,!1)||e:e||ni}function ai(e,t){return e&&(e[t]||e[Q(t)]||e[te(Q(t))])}function si(e,t,r,i){let n;const o=r,a=z(e);if(a||B(e)){let r=!1,i=!1;a&&At(e)&&(r=!Ot(e),i=Rt(e),e=et(e)),n=new Array(e.length);for(let a=0,s=e.length;a<s;a++)n[a]=t(r?i?zt(Nt(e[a])):Nt(e[a]):e[a],a,void 0,o)}else if("number"==typeof e){n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r+1,r,void 0,o)}else if(q(e))if(e[Symbol.iterator])n=Array.from(e,(e,r)=>t(e,r,void 0,o));else{const r=Object.keys(e);n=new Array(r.length);for(let i=0,a=r.length;i<a;i++){const a=r[i];n[i]=t(e[a],a,i,o)}}else n=[];return n}function li(e,t,r={},i,n){if(pr.ce||pr.parent&&Fr(pr.parent)&&pr.parent.ce){const e=Object.keys(r).length>0;return"default"!==t&&(r.name=t),yn(),En(gn,null,[Rn("slot",r,i&&i())],e?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),yn();const a=o&&ci(o(r)),s=r.key||a&&a.key,l=En(gn,{key:(s&&!V(s)?s:`_${t}`)+(!a&&i?"_fb":"")},a||(i?i():[]),a&&1===e._?64:-2);return l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),o&&o._c&&(o._d=!0),l}function ci(e){return e.some(e=>!_n(e)||e.type!==fn&&!(e.type===gn&&!ci(e.children)))?e:null}const di=e=>e?Zn(e)?Xn(e):di(e.parent):null,ui=O(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>di(e.parent),$root:e=>di(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ki(e),$forceUpdate:e=>e.f||(e.f=()=>{sr(e.update)}),$nextTick:e=>e.n||(e.n=ar.bind(e.proxy)),$watch:e=>rn.bind(e)}),hi=(e,t)=>e!==_&&!e.__isScriptSetup&&N(e,t),pi={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:r,setupState:i,data:n,props:o,accessCache:a,type:s,appContext:l}=e;let c;if("$"!==t[0]){const s=a[t];if(void 0!==s)switch(s){case 1:return i[t];case 2:return n[t];case 4:return r[t];case 3:return o[t]}else{if(hi(i,t))return a[t]=1,i[t];if(n!==_&&N(n,t))return a[t]=2,n[t];if((c=e.propsOptions[0])&&N(c,t))return a[t]=3,o[t];if(r!==_&&N(r,t))return a[t]=4,r[t];gi&&(a[t]=0)}}const d=ui[t];let u,h;return d?("$attrs"===t&&Ye(e.attrs,0,""),d(e)):(u=s.__cssModules)&&(u=u[t])?u:r!==_&&N(r,t)?(a[t]=4,r[t]):(h=l.config.globalProperties,N(h,t)?h[t]:void 0)},set({_:e},t,r){const{data:i,setupState:n,ctx:o}=e;return hi(n,t)?(n[t]=r,!0):i!==_&&N(i,t)?(i[t]=r,!0):!(N(e.props,t)||"$"===t[0]&&t.slice(1)in e||(o[t]=r,0))},has({_:{data:e,setupState:t,accessCache:r,ctx:i,appContext:n,propsOptions:o,type:a}},s){let l,c;return!!(r[s]||e!==_&&"$"!==s[0]&&N(e,s)||hi(t,s)||(l=o[0])&&N(l,s)||N(i,s)||N(ui,s)||N(n.config.globalProperties,s)||(c=a.__cssModules)&&c[s])},defineProperty(e,t,r){return null!=r.get?e._.accessCache[t]=0:N(r,"value")&&this.set(e,t,r.value,null),Reflect.defineProperty(e,t,r)}};function mi(e){return z(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}let gi=!0;function vi(e,t,r){Yt(z(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,r)}function fi(e,t,r,i){let n=i.includes(".")?nn(r,i):()=>r[i];if(B(e)){const r=t[e];F(r)&&en(n,r)}else if(F(e))en(n,e.bind(r));else if(q(e))if(z(e))e.forEach(e=>fi(e,t,r,i));else{const i=F(e.handler)?e.handler.bind(r):t[e.handler];F(i)&&en(n,i,e)}}function ki(e){const t=e.type,{mixins:r,extends:i}=t,{mixins:n,optionsCache:o,config:{optionMergeStrategies:a}}=e.appContext,s=o.get(t);let l;return s?l=s:n.length||r||i?(l={},n.length&&n.forEach(e=>bi(l,e,a,!0)),bi(l,t,a)):l=t,q(t)&&o.set(t,l),l}function bi(e,t,r,i=!1){const{mixins:n,extends:o}=t;o&&bi(e,o,r,!0),n&&n.forEach(t=>bi(e,t,r,!0));for(const a in t)if(i&&"expose"===a);else{const i=wi[a]||r&&r[a];e[a]=i?i(e[a],t[a]):t[a]}return e}const wi={data:yi,props:Ti,emits:Ti,methods:Si,computed:Si,beforeCreate:Ci,created:Ci,beforeMount:Ci,mounted:Ci,beforeUpdate:Ci,updated:Ci,beforeDestroy:Ci,beforeUnmount:Ci,destroyed:Ci,unmounted:Ci,activated:Ci,deactivated:Ci,errorCaptured:Ci,serverPrefetch:Ci,components:Si,directives:Si,watch:function(e,t){if(!e)return t;if(!t)return e;const r=O(Object.create(null),e);for(const i in t)r[i]=Ci(e[i],t[i]);return r},provide:yi,inject:function(e,t){return Si(xi(e),xi(t))}};function yi(e,t){return t?e?function(){return O(F(e)?e.call(this,this):e,F(t)?t.call(this,this):t)}:t:e}function xi(e){if(z(e)){const t={};for(let r=0;r<e.length;r++)t[e[r]]=e[r];return t}return e}function Ci(e,t){return e?[...new Set([].concat(e,t))]:t}function Si(e,t){return e?O(Object.create(null),e,t):t}function Ti(e,t){return e?z(e)&&z(t)?[...new Set([...e,...t])]:O(Object.create(null),mi(e),mi(null!=t?t:{})):t}function Ei(){return{app:null,config:{isNativeTag:M,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let _i=0;function Ii(e,t){return function(t,r=null){F(t)||(t=O({},t)),null==r||q(r)||(r=null);const i=Ei(),n=new WeakSet,o=[];let a=!1;const s=i.app={_uid:_i++,_component:t,_props:r,_container:null,_context:i,_instance:null,version:to,get config(){return i.config},set config(e){},use:(e,...t)=>(n.has(e)||(e&&F(e.install)?(n.add(e),e.install(s,...t)):F(e)&&(n.add(e),e(s,...t))),s),mixin:e=>(i.mixins.includes(e)||i.mixins.push(e),s),component:(e,t)=>t?(i.components[e]=t,s):i.components[e],directive:(e,t)=>t?(i.directives[e]=t,s):i.directives[e],mount(n,o,l){if(!a){const o=s._ceVNode||Rn(t,r);return o.appContext=i,!0===l?l="svg":!1===l&&(l=void 0),e(o,n,l),a=!0,s._container=n,n.__vue_app__=s,Xn(o.component)}},onUnmount(e){o.push(e)},unmount(){a&&(Yt(o,s._instance,16),e(null,s._container),delete s._container.__vue_app__)},provide:(e,t)=>(i.provides[e]=t,s),runWithContext(e){const t=Pi;Pi=s;try{return e()}finally{Pi=t}}};return s}}let Pi=null;function Mi(e,t,r=!1){const i=qn();if(i||Pi){let n=Pi?Pi._context.provides:i?null==i.parent||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(n&&e in n)return n[e];if(arguments.length>1)return r&&F(t)?t.call(i&&i.proxy):t}}const Ai={},Ri=()=>Object.create(Ai),Oi=e=>Object.getPrototypeOf(e)===Ai;function Di(e,t,r,i){const[n,o]=e.propsOptions;let a,s=!1;if(t)for(let l in t){if(J(l))continue;const c=t[l];let d;n&&N(n,d=Q(l))?o&&o.includes(d)?(a||(a={}))[d]=c:r[d]=c:cn(e.emitsOptions,l)||l in i&&c===i[l]||(i[l]=c,s=!0)}if(o){const t=Lt(r),i=a||_;for(let a=0;a<o.length;a++){const s=o[a];r[s]=Li(n,t,s,i[s],e,!N(i,s))}}return s}function Li(e,t,r,i,n,o){const a=e[r];if(null!=a){const e=N(a,"default");if(e&&void 0===i){const e=a.default;if(a.type!==Function&&!a.skipFactory&&F(e)){const{propsDefaults:o}=n;if(r in o)i=o[r];else{const a=Wn(n);i=o[r]=e.call(null,t),a()}}else i=e;n.ce&&n.ce._setProp(r,i)}a[0]&&(o&&!e?i=!1:!a[1]||""!==i&&i!==ee(r)||(i=!0))}return i}const Ni=new WeakMap;function zi(e,t,r=!1){const i=r?Ni:t.propsCache,n=i.get(e);if(n)return n;const o=e.props,a={},s=[];let l=!1;if(!F(e)){const i=e=>{l=!0;const[r,i]=zi(e,t,!0);O(a,r),i&&s.push(...i)};!r&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}if(!o&&!l)return q(e)&&i.set(e,I),I;if(z(o))for(let d=0;d<o.length;d++){const e=Q(o[d]);ji(e)&&(a[e]=_)}else if(o)for(const d in o){const e=Q(d);if(ji(e)){const t=o[d],r=a[e]=z(t)||F(t)?{type:t}:O({},t),i=r.type;let n=!1,l=!0;if(z(i))for(let e=0;e<i.length;++e){const t=i[e],r=F(t)&&t.name;if("Boolean"===r){n=!0;break}"String"===r&&(l=!1)}else n=F(i)&&"Boolean"===i.name;r[0]=n,r[1]=l,(n||N(r,"default"))&&s.push(e)}}const c=[a,s];return q(e)&&i.set(e,c),c}function ji(e){return"$"!==e[0]&&!J(e)}const Ui=e=>"_"===e||"_ctx"===e||"$stable"===e,Fi=e=>z(e)?e.map(Nn):[Nn(e)],Bi=(e,t,r)=>{if(t._n)return t;const i=vr((...e)=>Fi(t(...e)),r);return i._c=!1,i},Vi=(e,t,r)=>{const i=e._ctx;for(const n in e){if(Ui(n))continue;const r=e[n];if(F(r))t[n]=Bi(0,r,i);else if(null!=r){const e=Fi(r);t[n]=()=>e}}},qi=(e,t)=>{const r=Fi(t);e.slots.default=()=>r},$i=(e,t,r)=>{for(const i in t)!r&&Ui(i)||(e[i]=t[i])},Hi=function(e,t){var r;t&&t.pendingBranch?z(e)?t.effects.push(...e):t.effects.push(e):(z(r=e)?tr.push(...r):rr&&-1===r.id?rr.splice(ir+1,0,r):1&r.flags||(tr.push(r),r.flags|=1),lr())};function Wi(e){return function(e){le().__VUE__=!0;const{insert:t,remove:r,patchProp:i,createElement:n,createText:o,createComment:a,setText:s,setElementText:l,parentNode:c,nextSibling:d,setScopeId:u=P,insertStaticContent:h}=e,p=(e,t,r,i=null,n=null,o=null,a=void 0,s=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!In(e,t)&&(i=q(e),j(e,n,o,!0),e=null),-2===t.patchFlag&&(l=!1,t.dynamicChildren=null);const{type:c,ref:d,shapeFlag:u}=t;switch(c){case vn:m(e,t,r,i);break;case fn:g(e,t,r,i);break;case kn:null==e&&v(t,r,i,a);break;case gn:S(e,t,r,i,n,o,a,s,l);break;default:1&u?f(e,t,r,i,n,o,a,s,l):6&u?T(e,t,r,i,n,o,a,s,l):(64&u||128&u)&&c.process(e,t,r,i,n,o,a,s,l,G)}null!=d&&n?jr(d,e&&e.ref,o,t||e,!t):null==d&&e&&null!=e.ref&&jr(e.ref,null,o,e,!0)},m=(e,r,i,n)=>{if(null==e)t(r.el=o(r.children),i,n);else{const t=r.el=e.el;r.children!==e.children&&s(t,r.children)}},g=(e,r,i,n)=>{null==e?t(r.el=a(r.children||""),i,n):r.el=e.el},v=(e,t,r,i)=>{[e.el,e.anchor]=h(e.children,t,r,i,e.el,e.anchor)},f=(e,t,r,i,n,o,a,s,l)=>{"svg"===t.type?a="svg":"math"===t.type&&(a="mathml"),null==e?k(t,r,i,n,o,a,s,l):y(e,t,n,o,a,s,l)},k=(e,r,o,a,s,c,d,u)=>{let h,p;const{props:m,shapeFlag:g,transition:v,dirs:f}=e;if(h=e.el=n(e.type,c,m&&m.is,m),8&g?l(h,e.children):16&g&&w(e.children,h,null,a,s,Gi(e,c),d,u),f&&kr(e,null,a,"created"),b(h,e,e.scopeId,d,a),m){for(const e in m)"value"===e||J(e)||i(h,e,null,m[e],c,a);"value"in m&&i(h,"value",null,m.value,c),(p=m.onVnodeBeforeMount)&&Un(p,a,e)}f&&kr(e,null,a,"beforeMount");const k=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(s,v);k&&v.beforeEnter(h),t(h,r,o),((p=m&&m.onVnodeMounted)||k||f)&&Hi(()=>{p&&Un(p,a,e),k&&v.enter(h),f&&kr(e,null,a,"mounted")},s)},b=(e,t,r,i,n)=>{if(r&&u(e,r),i)for(let o=0;o<i.length;o++)u(e,i[o]);if(n){let r=n.subTree;if(t===r||mn(r.type)&&(r.ssContent===t||r.ssFallback===t)){const t=n.vnode;b(e,t,t.scopeId,t.slotScopeIds,n.parent)}}},w=(e,t,r,i,n,o,a,s,l=0)=>{for(let c=l;c<e.length;c++){const l=e[c]=s?zn(e[c]):Nn(e[c]);p(null,l,t,r,i,n,o,a,s)}},y=(e,t,r,n,o,a,s)=>{const c=t.el=e.el;let{patchFlag:d,dynamicChildren:u,dirs:h}=t;d|=16&e.patchFlag;const p=e.props||_,m=t.props||_;let g;if(r&&Zi(r,!1),(g=m.onVnodeBeforeUpdate)&&Un(g,r,t,e),h&&kr(t,e,r,"beforeUpdate"),r&&Zi(r,!0),(p.innerHTML&&null==m.innerHTML||p.textContent&&null==m.textContent)&&l(c,""),u?x(e.dynamicChildren,u,c,r,n,Gi(t,o),a):s||O(e,t,c,null,r,n,Gi(t,o),a,!1),d>0){if(16&d)C(c,p,m,r,o);else if(2&d&&p.class!==m.class&&i(c,"class",null,m.class,o),4&d&&i(c,"style",p.style,m.style,o),8&d){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t],a=p[n],s=m[n];s===a&&"value"!==n||i(c,n,a,s,o,r)}}1&d&&e.children!==t.children&&l(c,t.children)}else s||null!=u||C(c,p,m,r,o);((g=m.onVnodeUpdated)||h)&&Hi(()=>{g&&Un(g,r,t,e),h&&kr(t,e,r,"updated")},n)},x=(e,t,r,i,n,o,a)=>{for(let s=0;s<t.length;s++){const l=e[s],d=t[s],u=l.el&&(l.type===gn||!In(l,d)||198&l.shapeFlag)?c(l.el):r;p(l,d,u,null,i,n,o,a,!0)}},C=(e,t,r,n,o)=>{if(t!==r){if(t!==_)for(const a in t)J(a)||a in r||i(e,a,t[a],null,o,n);for(const a in r){if(J(a))continue;const s=r[a],l=t[a];s!==l&&"value"!==a&&i(e,a,l,s,o,n)}"value"in r&&i(e,"value",t.value,r.value,o)}},S=(e,r,i,n,a,s,l,c,d)=>{const u=r.el=e?e.el:o(""),h=r.anchor=e?e.anchor:o("");let{patchFlag:p,dynamicChildren:m,slotScopeIds:g}=r;g&&(c=c?c.concat(g):g),null==e?(t(u,i,n),t(h,i,n),w(r.children||[],i,h,a,s,l,c,d)):p>0&&64&p&&m&&e.dynamicChildren?(x(e.dynamicChildren,m,i,a,s,l,c),(null!=r.key||a&&r===a.subTree)&&Ji(e,r,!0)):O(e,r,i,h,a,s,l,c,d)},T=(e,t,r,i,n,o,a,s,l)=>{t.slotScopeIds=s,null==e?512&t.shapeFlag?n.ctx.activate(t,r,i,a,l):E(t,r,i,n,o,a,l):M(e,t,l)},E=(e,t,r,i,n,o,a)=>{const s=e.component=function(e,t,r){const i=e.type,n=(t?t.appContext:e.appContext)||Fn,o={uid:Bn++,vnode:e,type:i,parent:t,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ce(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(n.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:zi(i,n),emitsOptions:ln(i,n),emit:null,emitted:null,propsDefaults:_,inheritAttrs:i.inheritAttrs,ctx:_,data:_,props:_,attrs:_,slots:_,refs:_,setupState:_,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return o.ctx={_:o},o.root=t?t.root:o,o.emit=an.bind(null,o),e.ce&&e.ce(o),o}(e,i,n);if(Br(e)&&(s.ctx.renderer=G),function(e,t=!1,r=!1){t&&Hn(t);const{props:i,children:n}=e.vnode,o=Zn(e);(function(e,t,r,i=!1){const n={},o=Ri();e.propsDefaults=Object.create(null),Di(e,t,n,o);for(const a in e.propsOptions[0])a in n||(n[a]=void 0);r?e.props=i?n:Mt(n,!1,vt,xt,Tt):e.type.props?e.props=n:e.props=o,e.attrs=o})(e,i,o,t),((e,t,r)=>{const i=e.slots=Ri();if(32&e.vnode.shapeFlag){const e=t._;e?($i(i,t,r),r&&oe(i,"_",e,!0)):Vi(t,i)}else t&&qi(e,t)})(e,n,r||t);o&&function(e,t){const r=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,pi);const{setup:i}=r;if(i){Fe();const r=e.setupContext=i.length>1?function(e){return{attrs:new Proxy(e.attrs,Qn),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}(e):null,n=Wn(e),o=Kt(i,e,0,[e.props,r]),a=$(o);if(Be(),n(),!a&&!e.sp||Fr(e)||Nr(e),a){if(o.then(Gn,Gn),t)return o.then(t=>{Kn(e,t)}).catch(t=>{Qt(t,e,0)});e.asyncDep=o}else Kn(e,o)}else Yn(e)}(e,t);t&&Hn(!1)}(s,!1,a),s.asyncDep){if(n&&n.registerDep(s,A,a),!e.el){const i=s.subTree=Rn(fn);g(null,i,t,r),e.placeholder=i.el}}else A(s,e,t,r,n,o,a)},M=(e,t,r)=>{const i=t.component=e.component;if(function(e,t,r){const{props:i,children:n,component:o}=e,{props:a,children:s,patchFlag:l}=t,c=o.emitsOptions;if(t.dirs||t.transition)return!0;if(!(r&&l>=0))return!(!n&&!s||s&&s.$stable)||i!==a&&(i?!a||pn(i,a,c):!!a);if(1024&l)return!0;if(16&l)return i?pn(i,a,c):!!a;if(8&l){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const r=e[t];if(a[r]!==i[r]&&!cn(c,r))return!0}}return!1}(e,t,r)){if(i.asyncDep&&!i.asyncResolved)return void R(i,t,r);i.next=t,i.update()}else t.el=e.el,i.vnode=t},A=(e,t,r,i,n,o,a)=>{const s=()=>{if(e.isMounted){let{next:t,bu:r,u:i,parent:l,vnode:d}=e;{const r=Ki(e);if(r)return t&&(t.el=d.el,R(e,t,a)),void r.asyncDep.then(()=>{e.isUnmounted||s()})}let u,h=t;Zi(e,!1),t?(t.el=d.el,R(e,t,a)):t=d,r&&ne(r),(u=t.props&&t.props.onVnodeBeforeUpdate)&&Un(u,l,t,d),Zi(e,!0);const m=dn(e),g=e.subTree;e.subTree=m,p(g,m,c(g.el),q(g),e,n,o),t.el=m.el,null===h&&function({vnode:e,parent:t},r){for(;t;){const i=t.subTree;if(i.suspense&&i.suspense.activeBranch===e&&(i.el=e.el),i!==e)break;(e=t.vnode).el=r,t=t.parent}}(e,m.el),i&&Hi(i,n),(u=t.props&&t.props.onVnodeUpdated)&&Hi(()=>Un(u,l,t,d),n)}else{let a;const{el:s,props:l}=t,{bm:c,m:d,parent:u,root:h,type:m}=e,g=Fr(t);Zi(e,!1),c&&ne(c),!g&&(a=l&&l.onVnodeBeforeMount)&&Un(a,u,t),Zi(e,!0);{h.ce&&!1!==h.ce._def.shadowRoot&&h.ce._injectChildStyle(m);const a=e.subTree=dn(e);p(null,a,r,i,e,n,o),t.el=a.el}if(d&&Hi(d,n),!g&&(a=l&&l.onVnodeMounted)){const e=t;Hi(()=>Un(a,u,e),n)}(256&t.shapeFlag||u&&Fr(u.vnode)&&256&u.vnode.shapeFlag)&&e.a&&Hi(e.a,n),e.isMounted=!0,t=r=i=null}};e.scope.on();const l=e.effect=new Te(s);e.scope.off();const d=e.update=l.run.bind(l),u=e.job=l.runIfDirty.bind(l);u.i=e,u.id=e.uid,l.scheduler=()=>sr(u),Zi(e,!0),d()},R=(e,t,r)=>{t.component=e;const i=e.vnode.props;e.vnode=t,e.next=null,function(e,t,r,i){const{props:n,attrs:o,vnode:{patchFlag:a}}=e,s=Lt(n),[l]=e.propsOptions;let c=!1;if(!(i||a>0)||16&a){let i;Di(e,t,n,o)&&(c=!0);for(const o in s)t&&(N(t,o)||(i=ee(o))!==o&&N(t,i))||(l?!r||void 0===r[o]&&void 0===r[i]||(n[o]=Li(l,s,o,void 0,e,!0)):delete n[o]);if(o!==s)for(const e in o)t&&N(t,e)||(delete o[e],c=!0)}else if(8&a){const r=e.vnode.dynamicProps;for(let i=0;i<r.length;i++){let a=r[i];if(cn(e.emitsOptions,a))continue;const d=t[a];if(l)if(N(o,a))d!==o[a]&&(o[a]=d,c=!0);else{const t=Q(a);n[t]=Li(l,s,t,d,e,!1)}else d!==o[a]&&(o[a]=d,c=!0)}}c&&Qe(e.attrs,"set","")}(e,t.props,i,r),((e,t,r)=>{const{vnode:i,slots:n}=e;let o=!0,a=_;if(32&i.shapeFlag){const e=t._;e?r&&1===e?o=!1:$i(n,t,r):(o=!t.$stable,Vi(t,n)),a=t}else t&&(qi(e,t),a={default:1});if(o)for(const s in n)Ui(s)||null!=a[s]||delete n[s]})(e,t.children,r),Fe(),cr(e),Be()},O=(e,t,r,i,n,o,a,s,c=!1)=>{const d=e&&e.children,u=e?e.shapeFlag:0,h=t.children,{patchFlag:p,shapeFlag:m}=t;if(p>0){if(128&p)return void L(d,h,r,i,n,o,a,s,c);if(256&p)return void D(d,h,r,i,n,o,a,s,c)}8&m?(16&u&&V(d,n,o),h!==d&&l(r,h)):16&u?16&m?L(d,h,r,i,n,o,a,s,c):V(d,n,o,!0):(8&u&&l(r,""),16&m&&w(h,r,i,n,o,a,s,c))},D=(e,t,r,i,n,o,a,s,l)=>{t=t||I;const c=(e=e||I).length,d=t.length,u=Math.min(c,d);let h;for(h=0;h<u;h++){const i=t[h]=l?zn(t[h]):Nn(t[h]);p(e[h],i,r,null,n,o,a,s,l)}c>d?V(e,n,o,!0,!1,u):w(t,r,i,n,o,a,s,l,u)},L=(e,t,r,i,n,o,a,s,l)=>{let c=0;const d=t.length;let u=e.length-1,h=d-1;for(;c<=u&&c<=h;){const i=e[c],d=t[c]=l?zn(t[c]):Nn(t[c]);if(!In(i,d))break;p(i,d,r,null,n,o,a,s,l),c++}for(;c<=u&&c<=h;){const i=e[u],c=t[h]=l?zn(t[h]):Nn(t[h]);if(!In(i,c))break;p(i,c,r,null,n,o,a,s,l),u--,h--}if(c>u){if(c<=h){const e=h+1,u=e<d?t[e].el:i;for(;c<=h;)p(null,t[c]=l?zn(t[c]):Nn(t[c]),r,u,n,o,a,s,l),c++}}else if(c>h)for(;c<=u;)j(e[c],n,o,!0),c++;else{const m=c,g=c,v=new Map;for(c=g;c<=h;c++){const e=t[c]=l?zn(t[c]):Nn(t[c]);null!=e.key&&v.set(e.key,c)}let f,k=0;const b=h-g+1;let w=!1,y=0;const x=new Array(b);for(c=0;c<b;c++)x[c]=0;for(c=m;c<=u;c++){const i=e[c];if(k>=b){j(i,n,o,!0);continue}let d;if(null!=i.key)d=v.get(i.key);else for(f=g;f<=h;f++)if(0===x[f-g]&&In(i,t[f])){d=f;break}void 0===d?j(i,n,o,!0):(x[d-g]=c+1,d>=y?y=d:w=!0,p(i,t[d],r,null,n,o,a,s,l),k++)}const C=w?function(e){const t=e.slice(),r=[0];let i,n,o,a,s;const l=e.length;for(i=0;i<l;i++){const l=e[i];if(0!==l){if(n=r[r.length-1],e[n]<l){t[i]=n,r.push(i);continue}for(o=0,a=r.length-1;o<a;)s=o+a>>1,e[r[s]]<l?o=s+1:a=s;l<e[r[o]]&&(o>0&&(t[i]=r[o-1]),r[o]=i)}}for(o=r.length,a=r[o-1];o-- >0;)r[o]=a,a=t[a];return r}(x):I;for(f=C.length-1,c=b-1;c>=0;c--){const e=g+c,u=t[e],h=t[e+1],m=e+1<d?h.el||h.placeholder:i;0===x[c]?p(null,u,r,m,n,o,a,s,l):w&&(f<0||c!==C[f]?z(u,r,m,2):f--)}}},z=(e,i,n,o,a=null)=>{const{el:s,type:l,transition:c,children:u,shapeFlag:h}=e;if(6&h)z(e.component.subTree,i,n,o);else if(128&h)e.suspense.move(i,n,o);else if(64&h)l.move(e,i,n,G);else if(l!==gn)if(l!==kn)if(2!==o&&1&h&&c)if(0===o)c.beforeEnter(s),t(s,i,n),Hi(()=>c.enter(s),a);else{const{leave:o,delayLeave:a,afterLeave:l}=c,d=()=>{e.ctx.isUnmounted?r(s):t(s,i,n)},u=()=>{s._isLeaving&&s[yr](!0),o(s,()=>{d(),l&&l()})};a?a(s,d,u):u()}else t(s,i,n);else(({el:e,anchor:r},i,n)=>{let o;for(;e&&e!==r;)o=d(e),t(e,i,n),e=o;t(r,i,n)})(e,i,n);else{t(s,i,n);for(let e=0;e<u.length;e++)z(u[e],i,n,o);t(e.anchor,i,n)}},j=(e,t,r,i=!1,n=!1)=>{const{type:o,props:a,ref:s,children:l,dynamicChildren:c,shapeFlag:d,patchFlag:u,dirs:h,cacheIndex:p}=e;if(-2===u&&(n=!1),null!=s&&(Fe(),jr(s,null,r,e,!0),Be()),null!=p&&(t.renderCache[p]=void 0),256&d)return void t.ctx.deactivate(e);const m=1&d&&h,g=!Fr(e);let v;if(g&&(v=a&&a.onVnodeBeforeUnmount)&&Un(v,t,e),6&d)B(e.component,r,i);else{if(128&d)return void e.suspense.unmount(r,i);m&&kr(e,null,t,"beforeUnmount"),64&d?e.type.remove(e,t,r,G,i):c&&!c.hasOnce&&(o!==gn||u>0&&64&u)?V(c,t,r,!1,!0):(o===gn&&384&u||!n&&16&d)&&V(l,t,r),i&&U(e)}(g&&(v=a&&a.onVnodeUnmounted)||m)&&Hi(()=>{v&&Un(v,t,e),m&&kr(e,null,t,"unmounted")},r)},U=e=>{const{type:t,el:i,anchor:n,transition:o}=e;if(t===gn)return void F(i,n);if(t===kn)return void(({el:e,anchor:t})=>{let i;for(;e&&e!==t;)i=d(e),r(e),e=i;r(t)})(e);const a=()=>{r(i),o&&!o.persisted&&o.afterLeave&&o.afterLeave()};if(1&e.shapeFlag&&o&&!o.persisted){const{leave:t,delayLeave:r}=o,n=()=>t(i,a);r?r(e.el,a,n):n()}else a()},F=(e,t)=>{let i;for(;e!==t;)i=d(e),r(e),e=i;r(t)},B=(e,t,r)=>{const{bum:i,scope:n,job:o,subTree:a,um:s,m:l,a:c}=e;Yi(l),Yi(c),i&&ne(i),n.stop(),o&&(o.flags|=8,j(a,e,t,r)),s&&Hi(s,t),Hi(()=>{e.isUnmounted=!0},t)},V=(e,t,r,i=!1,n=!1,o=0)=>{for(let a=o;a<e.length;a++)j(e[a],t,r,i,n)},q=e=>{if(6&e.shapeFlag)return q(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=d(e.anchor||e.el),r=t&&t[br];return r?d(r):t};let H=!1;const W=(e,t,r)=>{null==e?t._vnode&&j(t._vnode,null,null,!0):p(t._vnode||null,e,t,null,null,null,r),t._vnode=e,H||(H=!0,cr(),dr(),H=!1)},G={p:p,um:j,m:z,r:U,mt:E,mc:w,pc:O,pbc:x,n:q,o:e};return{render:W,hydrate:undefined,createApp:Ii(W)}}(e)}function Gi({type:e,props:t},r){return"svg"===r&&"foreignObject"===e||"mathml"===r&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:r}function Zi({effect:e,job:t},r){r?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Ji(e,t,r=!1){const i=e.children,n=t.children;if(z(i)&&z(n))for(let o=0;o<i.length;o++){const e=i[o];let t=n[o];1&t.shapeFlag&&!t.dynamicChildren&&((t.patchFlag<=0||32===t.patchFlag)&&(t=n[o]=zn(n[o]),t.el=e.el),r||-2===t.patchFlag||Ji(e,t)),t.type===vn&&-1!==t.patchFlag&&(t.el=e.el),t.type!==fn||t.el||(t.el=e.el)}}function Ki(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Ki(t)}function Yi(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}const Qi=Symbol.for("v-scx"),Xi=()=>Mi(Qi);function en(e,t,r){return tn(e,t,r)}function tn(e,t,r=_){const{immediate:i,deep:n,flush:o,once:a}=r,s=O({},r),l=t&&i||!t&&"post"!==o;let c;if(Jn)if("sync"===o){const e=Xi();c=e.__watcherHandles||(e.__watcherHandles=[])}else if(!l){const e=()=>{};return e.stop=P,e.resume=P,e.pause=P,e}const d=Vn;s.call=(e,t,r)=>Yt(e,d,t,r);let u=!1;"post"===o?s.scheduler=e=>{Hi(e,d&&d.suspense)}:"sync"!==o&&(u=!0,s.scheduler=(e,t)=>{t?e():sr(e)}),s.augmentJob=e=>{t&&(e.flags|=4),u&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};const h=function(e,t,r=_){const{immediate:i,deep:n,once:o,scheduler:a,augmentJob:s,call:l}=r,c=e=>n?e:Ot(e)||!1===n||0===n?Jt(e,1):Jt(e);let d,u,h,p,m=!1,g=!1;if(jt(e)?(u=()=>e.value,m=Ot(e)):At(e)?(u=()=>c(e),m=!0):z(e)?(g=!0,m=e.some(e=>At(e)||Ot(e)),u=()=>e.map(e=>jt(e)?e.value:At(e)?c(e):F(e)?l?l(e,2):e():void 0)):u=F(e)?t?l?()=>l(e,2):e:()=>{if(h){Fe();try{h()}finally{Be()}}const t=Zt;Zt=d;try{return l?l(e,3,[p]):e(p)}finally{Zt=t}}:P,t&&n){const e=u,t=!0===n?1/0:n;u=()=>Jt(e(),t)}const v=ye,f=()=>{d.stop(),v&&v.active&&D(v.effects,d)};if(o&&t){const e=t;t=(...t)=>{e(...t),f()}}let k=g?new Array(e.length).fill(Wt):Wt;const b=e=>{if(1&d.flags&&(d.dirty||e))if(t){const e=d.run();if(n||m||(g?e.some((e,t)=>ie(e,k[t])):ie(e,k))){h&&h();const r=Zt;Zt=d;try{const r=[e,k===Wt?void 0:g&&k[0]===Wt?[]:k,p];k=e,l?l(t,3,r):t(...r)}finally{Zt=r}}}else d.run()};return s&&s(b),d=new Te(u),d.scheduler=a?()=>a(b,!1):b,p=e=>function(e,t=!1,r=Zt){if(r){let t=Gt.get(r);t||Gt.set(r,t=[]),t.push(e)}}(e,!1,d),h=d.onStop=()=>{const e=Gt.get(d);if(e){if(l)l(e,4);else for(const t of e)t();Gt.delete(d)}},t?i?b(!0):k=d.run():a?a(b.bind(null,!0),!0):d.run(),f.pause=d.pause.bind(d),f.resume=d.resume.bind(d),f.stop=f,f}(e,t,s);return Jn&&(c?c.push(h):l&&h()),h}function rn(e,t,r){const i=this.proxy,n=B(e)?e.includes(".")?nn(i,e):()=>i[e]:e.bind(i,i);let o;F(t)?o=t:(o=t.handler,r=t);const a=Wn(this),s=tn(n,o.bind(i),r);return a(),s}function nn(e,t){const r=t.split(".");return()=>{let t=e;for(let e=0;e<r.length&&t;e++)t=t[r[e]];return t}}const on=(e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${Q(t)}Modifiers`]||e[`${ee(t)}Modifiers`];function an(e,t,...r){if(e.isUnmounted)return;const i=e.vnode.props||_;let n=r;const o=t.startsWith("update:"),a=o&&on(i,t.slice(7));let s;a&&(a.trim&&(n=r.map(e=>B(e)?e.trim():e)),a.number&&(n=r.map(ae)));let l=i[s=re(t)]||i[s=re(Q(t))];!l&&o&&(l=i[s=re(ee(t))]),l&&Yt(l,e,6,n);const c=i[s+"Once"];if(c){if(e.emitted){if(e.emitted[s])return}else e.emitted={};e.emitted[s]=!0,Yt(c,e,6,n)}}const sn=new WeakMap;function ln(e,t,r=!1){const i=r?sn:t.emitsCache,n=i.get(e);if(void 0!==n)return n;const o=e.emits;let a={},s=!1;if(!F(e)){const i=e=>{const r=ln(e,t,!0);r&&(s=!0,O(a,r))};!r&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}return o||s?(z(o)?o.forEach(e=>a[e]=null):O(a,o),q(e)&&i.set(e,a),a):(q(e)&&i.set(e,null),null)}function cn(e,t){return!(!e||!A(t))&&(t=t.slice(2).replace(/Once$/,""),N(e,t[0].toLowerCase()+t.slice(1))||N(e,ee(t))||N(e,t))}function dn(e){const{type:t,vnode:r,proxy:i,withProxy:n,propsOptions:[o],slots:a,attrs:s,emit:l,render:c,renderCache:d,props:u,data:h,setupState:p,ctx:m,inheritAttrs:g}=e,v=gr(e);let f,k;try{if(4&r.shapeFlag){const e=n||i,t=e;f=Nn(c.call(t,e,d,u,p,h,m)),k=s}else{const e=t;f=Nn(e.length>1?e(u,{attrs:s,slots:a,emit:l}):e(u,null)),k=t.props?s:un(s)}}catch(w){bn.length=0,Qt(w,e,1),f=Rn(fn)}let b=f;if(k&&!1!==g){const e=Object.keys(k),{shapeFlag:t}=b;e.length&&7&t&&(o&&e.some(R)&&(k=hn(k,o)),b=On(b,k,!1,!0))}return r.dirs&&(b=On(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(r.dirs):r.dirs),r.transition&&Or(b,r.transition),f=b,gr(v),f}const un=e=>{let t;for(const r in e)("class"===r||"style"===r||A(r))&&((t||(t={}))[r]=e[r]);return t},hn=(e,t)=>{const r={};for(const i in e)R(i)&&i.slice(9)in t||(r[i]=e[i]);return r};function pn(e,t,r){const i=Object.keys(t);if(i.length!==Object.keys(e).length)return!0;for(let n=0;n<i.length;n++){const o=i[n];if(t[o]!==e[o]&&!cn(r,o))return!0}return!1}const mn=e=>e.__isSuspense,gn=Symbol.for("v-fgt"),vn=Symbol.for("v-txt"),fn=Symbol.for("v-cmt"),kn=Symbol.for("v-stc"),bn=[];let wn=null;function yn(e=!1){bn.push(wn=e?null:[])}let xn=1;function Cn(e,t=!1){xn+=e,e<0&&wn&&t&&(wn.hasOnce=!0)}function Sn(e){return e.dynamicChildren=xn>0?wn||I:null,bn.pop(),wn=bn[bn.length-1]||null,xn>0&&wn&&wn.push(e),e}function Tn(e,t,r,i,n,o){return Sn(An(e,t,r,i,n,o,!0))}function En(e,t,r,i,n){return Sn(Rn(e,t,r,i,n,!0))}function _n(e){return!!e&&!0===e.__v_isVNode}function In(e,t){return e.type===t.type&&e.key===t.key}const Pn=({key:e})=>null!=e?e:null,Mn=({ref:e,ref_key:t,ref_for:r})=>("number"==typeof e&&(e=""+e),null!=e?B(e)||jt(e)||F(e)?{i:pr,r:e,k:t,f:!!r}:e:null);function An(e,t=null,r=null,i=0,n=null,o=(e===gn?0:1),a=!1,s=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Pn(t),ref:t&&Mn(t),scopeId:mr,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:o,patchFlag:i,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:pr};return s?(jn(l,r),128&o&&e.normalize(l)):r&&(l.shapeFlag|=B(r)?8:16),xn>0&&!a&&wn&&(l.patchFlag>0||6&o)&&32!==l.patchFlag&&wn.push(l),l}const Rn=function(e,t=null,r=null,i=0,n=null,o=!1){if(e&&e!==ni||(e=fn),_n(e)){const i=On(e,t,!0);return r&&jn(i,r),xn>0&&!o&&wn&&(6&i.shapeFlag?wn[wn.indexOf(e)]=i:wn.push(i)),i.patchFlag=-2,i}var a;if(F(a=e)&&"__vccOpts"in a&&(e=e.__vccOpts),t){t=function(e){return e?Dt(e)||Oi(e)?O({},e):e:null}(t);let{class:e,style:r}=t;e&&!B(e)&&(t.class=me(e)),q(r)&&(Dt(r)&&!z(r)&&(r=O({},r)),t.style=ce(r))}return An(e,t,r,i,n,B(e)?1:mn(e)?128:wr(e)?64:q(e)?4:F(e)?2:0,o,!0)};function On(e,t,r=!1,i=!1){const{props:n,ref:o,patchFlag:a,children:s,transition:l}=e,c=t?function(...e){const t={};for(let r=0;r<e.length;r++){const i=e[r];for(const e in i)if("class"===e)t.class!==i.class&&(t.class=me([t.class,i.class]));else if("style"===e)t.style=ce([t.style,i.style]);else if(A(e)){const r=t[e],n=i[e];!n||r===n||z(r)&&r.includes(n)||(t[e]=r?[].concat(r,n):n)}else""!==e&&(t[e]=i[e])}return t}(n||{},t):n,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Pn(c),ref:t&&t.ref?r&&o?z(o)?o.concat(Mn(t)):[o,Mn(t)]:Mn(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==gn?-1===a?16:16|a:a,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&On(e.ssContent),ssFallback:e.ssFallback&&On(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&i&&Or(d,l.clone(d)),d}function Dn(e=" ",t=0){return Rn(vn,null,e,t)}function Ln(e="",t=!1){return t?(yn(),En(fn,null,e)):Rn(fn,null,e)}function Nn(e){return null==e||"boolean"==typeof e?Rn(fn):z(e)?Rn(gn,null,e.slice()):_n(e)?zn(e):Rn(vn,null,String(e))}function zn(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:On(e)}function jn(e,t){let r=0;const{shapeFlag:i}=e;if(null==t)t=null;else if(z(t))r=16;else if("object"==typeof t){if(65&i){const r=t.default;return void(r&&(r._c&&(r._d=!1),jn(e,r()),r._c&&(r._d=!0)))}{r=32;const i=t._;i||Oi(t)?3===i&&pr&&(1===pr.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=pr}}else F(t)?(t={default:t,_ctx:pr},r=32):(t=String(t),64&i?(r=16,t=[Dn(t)]):r=8);e.children=t,e.shapeFlag|=r}function Un(e,t,r,i=null){Yt(e,t,7,[r,i])}const Fn=Ei();let Bn=0,Vn=null;const qn=()=>Vn||pr;let $n,Hn;{const e=le(),t=(t,r)=>{let i;return(i=e[t])||(i=e[t]=[]),i.push(r),e=>{i.length>1?i.forEach(t=>t(e)):i[0](e)}};$n=t("__VUE_INSTANCE_SETTERS__",e=>Vn=e),Hn=t("__VUE_SSR_SETTERS__",e=>Jn=e)}const Wn=e=>{const t=Vn;return $n(e),e.scope.on(),()=>{e.scope.off(),$n(t)}},Gn=()=>{Vn&&Vn.scope.off(),$n(null)};function Zn(e){return 4&e.vnode.shapeFlag}let Jn=!1;function Kn(e,t,r){F(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:q(t)&&(e.setupState=$t(t)),Yn(e)}function Yn(e,t,r){const i=e.type;e.render||(e.render=i.render||P);{const t=Wn(e);Fe();try{!function(e){const t=ki(e),r=e.proxy,i=e.ctx;gi=!1,t.beforeCreate&&vi(t.beforeCreate,e,"bc");const{data:n,computed:o,methods:a,watch:s,provide:l,inject:c,created:d,beforeMount:u,mounted:h,beforeUpdate:p,updated:m,activated:g,deactivated:v,beforeDestroy:f,beforeUnmount:k,destroyed:b,unmounted:w,render:y,renderTracked:x,renderTriggered:C,errorCaptured:S,serverPrefetch:T,expose:E,inheritAttrs:_,components:I,directives:M,filters:A}=t;if(c&&function(e,t){z(e)&&(e=xi(e));for(const r in e){const i=e[r];let n;n=q(i)?"default"in i?Mi(i.from||r,i.default,!0):Mi(i.from||r):Mi(i),jt(n)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>n.value,set:e=>n.value=e}):t[r]=n}}(c,i),a)for(const P in a){const e=a[P];F(e)&&(i[P]=e.bind(r))}if(n){const t=n.call(r,r);q(t)&&(e.data=It(t))}if(gi=!0,o)for(const O in o){const e=o[O],t=F(e)?e.bind(r,r):F(e.get)?e.get.bind(r,r):P,n=!F(e)&&F(e.set)?e.set.bind(r):P,a=eo({get:t,set:n});Object.defineProperty(i,O,{enumerable:!0,configurable:!0,get:()=>a.value,set:e=>a.value=e})}if(s)for(const P in s)fi(s[P],i,r,P);if(l){const e=F(l)?l.call(r):l;Reflect.ownKeys(e).forEach(t=>{!function(e,t){if(Vn){let r=Vn.provides;const i=Vn.parent&&Vn.parent.provides;i===r&&(r=Vn.provides=Object.create(i)),r[e]=t}}(t,e[t])})}function R(e,t){z(t)?t.forEach(t=>e(t.bind(r))):t&&e(t.bind(r))}if(d&&vi(d,e,"c"),R(Zr,u),R(Jr,h),R(Kr,p),R(Yr,m),R(Vr,g),R(qr,v),R(ii,S),R(ri,x),R(ti,C),R(Qr,k),R(Xr,w),R(ei,T),z(E))if(E.length){const t=e.exposed||(e.exposed={});E.forEach(e=>{Object.defineProperty(t,e,{get:()=>r[e],set:t=>r[e]=t,enumerable:!0})})}else e.exposed||(e.exposed={});y&&e.render===P&&(e.render=y),null!=_&&(e.inheritAttrs=_),I&&(e.components=I),M&&(e.directives=M),T&&Nr(e)}(e)}finally{Be(),t()}}}const Qn={get:(e,t)=>(Ye(e,0,""),e[t])};function Xn(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy($t((t=e.exposed,!N(t,"__v_skip")&&Object.isExtensible(t)&&oe(t,"__v_skip",!0),t)),{get:(t,r)=>r in t?t[r]:r in ui?ui[r](e):void 0,has:(e,t)=>t in e||t in ui})):e.proxy;var t}const eo=(e,t)=>{const r=function(e,t,r=!1){let i,n;return F(e)?i=e:(i=e.get,n=e.set),new Ht(i,n,r)}(e,0,Jn);return r},to="3.5.22";let ro;const io="undefined"!=typeof window&&window.trustedTypes;if(io)try{ro=io.createPolicy("vue",{createHTML:e=>e})}catch(VT){}const no=ro?e=>ro.createHTML(e):e=>e,oo="undefined"!=typeof document?document:null,ao=oo&&oo.createElement("template"),so={insert:(e,t,r)=>{t.insertBefore(e,r||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,r,i)=>{const n="svg"===t?oo.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?oo.createElementNS("http://www.w3.org/1998/Math/MathML",e):r?oo.createElement(e,{is:r}):oo.createElement(e);return"select"===e&&i&&null!=i.multiple&&n.setAttribute("multiple",i.multiple),n},createText:e=>oo.createTextNode(e),createComment:e=>oo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>oo.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,r,i,n,o){const a=r?r.previousSibling:t.lastChild;if(n&&(n===o||n.nextSibling))for(;t.insertBefore(n.cloneNode(!0),r),n!==o&&(n=n.nextSibling););else{ao.innerHTML=no("svg"===i?`<svg>${e}</svg>`:"mathml"===i?`<math>${e}</math>`:e);const n=ao.content;if("svg"===i||"mathml"===i){const e=n.firstChild;for(;e.firstChild;)n.appendChild(e.firstChild);n.removeChild(e)}t.insertBefore(n,r)}return[a?a.nextSibling:t.firstChild,r?r.previousSibling:t.lastChild]}},lo="transition",co="animation",uo=Symbol("_vtc"),ho={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},po=O({},Tr,ho),mo=(e=>(e.displayName="Transition",e.props=po,e))((e,{slots:t})=>function(e,t,r){try{Cn(-1);const i=arguments.length;return 2===i?q(t)&&!z(t)?_n(t)?Rn(e,null,[t]):Rn(e,t):Rn(e,null,t):(i>3?r=Array.prototype.slice.call(arguments,2):3===i&&_n(r)&&(r=[r]),Rn(e,t,r))}finally{Cn(1)}}(Ir,fo(e),t)),go=(e,t=[])=>{z(e)?e.forEach(e=>e(...t)):e&&e(...t)},vo=e=>!!e&&(z(e)?e.some(e=>e.length>1):e.length>1);function fo(e){const t={};for(const I in e)I in ho||(t[I]=e[I]);if(!1===e.css)return t;const{name:r="v",type:i,duration:n,enterFromClass:o=`${r}-enter-from`,enterActiveClass:a=`${r}-enter-active`,enterToClass:s=`${r}-enter-to`,appearFromClass:l=o,appearActiveClass:c=a,appearToClass:d=s,leaveFromClass:u=`${r}-leave-from`,leaveActiveClass:h=`${r}-leave-active`,leaveToClass:p=`${r}-leave-to`}=e,m=function(e){if(null==e)return null;if(q(e))return[ko(e.enter),ko(e.leave)];{const t=ko(e);return[t,t]}}(n),g=m&&m[0],v=m&&m[1],{onBeforeEnter:f,onEnter:k,onEnterCancelled:b,onLeave:w,onLeaveCancelled:y,onBeforeAppear:x=f,onAppear:C=k,onAppearCancelled:S=b}=t,T=(e,t,r,i)=>{e._enterCancelled=i,wo(e,t?d:s),wo(e,t?c:a),r&&r()},E=(e,t)=>{e._isLeaving=!1,wo(e,u),wo(e,p),wo(e,h),t&&t()},_=e=>(t,r)=>{const n=e?C:k,a=()=>T(t,e,r);go(n,[t,a]),yo(()=>{wo(t,e?l:o),bo(t,e?d:s),vo(n)||Co(t,i,g,a)})};return O(t,{onBeforeEnter(e){go(f,[e]),bo(e,o),bo(e,a)},onBeforeAppear(e){go(x,[e]),bo(e,l),bo(e,c)},onEnter:_(!1),onAppear:_(!0),onLeave(e,t){e._isLeaving=!0;const r=()=>E(e,t);bo(e,u),e._enterCancelled?(bo(e,h),_o(e)):(_o(e),bo(e,h)),yo(()=>{e._isLeaving&&(wo(e,u),bo(e,p),vo(w)||Co(e,i,v,r))}),go(w,[e,r])},onEnterCancelled(e){T(e,!1,void 0,!0),go(b,[e])},onAppearCancelled(e){T(e,!0,void 0,!0),go(S,[e])},onLeaveCancelled(e){E(e),go(y,[e])}})}function ko(e){const t=(e=>{const t=B(e)?Number(e):NaN;return isNaN(t)?e:t})(e);return t}function bo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[uo]||(e[uo]=new Set)).add(t)}function wo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));const r=e[uo];r&&(r.delete(t),r.size||(e[uo]=void 0))}function yo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let xo=0;function Co(e,t,r,i){const n=e._endId=++xo,o=()=>{n===e._endId&&i()};if(null!=r)return setTimeout(o,r);const{type:a,timeout:s,propCount:l}=So(e,t);if(!a)return i();const c=a+"end";let d=0;const u=()=>{e.removeEventListener(c,h),o()},h=t=>{t.target===e&&++d>=l&&u()};setTimeout(()=>{d<l&&u()},s+1),e.addEventListener(c,h)}function So(e,t){const r=window.getComputedStyle(e),i=e=>(r[e]||"").split(", "),n=i(`${lo}Delay`),o=i(`${lo}Duration`),a=To(n,o),s=i(`${co}Delay`),l=i(`${co}Duration`),c=To(s,l);let d=null,u=0,h=0;return t===lo?a>0&&(d=lo,u=a,h=o.length):t===co?c>0&&(d=co,u=c,h=l.length):(u=Math.max(a,c),d=u>0?a>c?lo:co:null,h=d?d===lo?o.length:l.length:0),{type:d,timeout:u,propCount:h,hasTransform:d===lo&&/\b(?:transform|all)(?:,|$)/.test(i(`${lo}Property`).toString())}}function To(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,r)=>Eo(t)+Eo(e[r])))}function Eo(e){return"auto"===e?0:1e3*Number(e.slice(0,-1).replace(",","."))}function _o(e){return(e?e.ownerDocument:document).body.offsetHeight}const Io=Symbol("_vod"),Po=Symbol("_vsh"),Mo=Symbol(""),Ao=/(?:^|;)\s*display\s*:/,Ro=/\s*!important$/;function Oo(e,t,r){if(z(r))r.forEach(r=>Oo(e,t,r));else if(null==r&&(r=""),t.startsWith("--"))e.setProperty(t,r);else{const i=function(e,t){const r=Lo[t];if(r)return r;let i=Q(t);if("filter"!==i&&i in e)return Lo[t]=i;i=te(i);for(let n=0;n<Do.length;n++){const r=Do[n]+i;if(r in e)return Lo[t]=r}return t}(e,t);Ro.test(r)?e.setProperty(ee(i),r.replace(Ro,""),"important"):e[i]=r}}const Do=["Webkit","Moz","ms"],Lo={},No="http://www.w3.org/1999/xlink";function zo(e,t,r,i,n,o=ge(t)){i&&t.startsWith("xlink:")?null==r?e.removeAttributeNS(No,t.slice(6,t.length)):e.setAttributeNS(No,t,r):null==r||o&&!ve(r)?e.removeAttribute(t):e.setAttribute(t,o?"":V(r)?String(r):r)}function jo(e,t,r,i,n){if("innerHTML"===t||"textContent"===t)return void(null!=r&&(e[t]="innerHTML"===t?no(r):r));const o=e.tagName;if("value"===t&&"PROGRESS"!==o&&!o.includes("-")){const i="OPTION"===o?e.getAttribute("value")||"":e.value,n=null==r?"checkbox"===e.type?"on":"":String(r);return i===n&&"_value"in e||(e.value=n),null==r&&e.removeAttribute(t),void(e._value=r)}let a=!1;if(""===r||null==r){const i=typeof e[t];"boolean"===i?r=ve(r):null==r&&"string"===i?(r="",a=!0):"number"===i&&(r=0,a=!0)}try{e[t]=r}catch(VT){}a&&e.removeAttribute(n||t)}function Uo(e,t,r,i){e.addEventListener(t,r,i)}const Fo=Symbol("_vei");const Bo=/(?:Once|Passive|Capture)$/;let Vo=0;const qo=Promise.resolve(),$o=()=>Vo||(qo.then(()=>Vo=0),Vo=Date.now()),Ho=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Wo=new WeakMap,Go=new WeakMap,Zo=Symbol("_moveCb"),Jo=Symbol("_enterCb"),Ko=(e=>(delete e.props.mode,e))({name:"TransitionGroup",props:O({},po,{tag:String,moveClass:String}),setup(e,{slots:t}){const r=qn(),i=Cr();let n,o;return Yr(()=>{if(!n.length)return;const t=e.moveClass||`${e.name||"v"}-move`;if(!function(e,t,r){const i=e.cloneNode(),n=e[uo];n&&n.forEach(e=>{e.split(/\s+/).forEach(e=>e&&i.classList.remove(e))}),r.split(/\s+/).forEach(e=>e&&i.classList.add(e)),i.style.display="none";const o=1===t.nodeType?t:t.parentNode;o.appendChild(i);const{hasTransform:a}=So(i);return o.removeChild(i),a}(n[0].el,r.vnode.el,t))return void(n=[]);n.forEach(Yo),n.forEach(Qo);const i=n.filter(Xo);_o(r.vnode.el),i.forEach(e=>{const r=e.el,i=r.style;bo(r,t),i.transform=i.webkitTransform=i.transitionDuration="";const n=r[Zo]=e=>{e&&e.target!==r||e&&!e.propertyName.endsWith("transform")||(r.removeEventListener("transitionend",n),r[Zo]=null,wo(r,t))};r.addEventListener("transitionend",n)}),n=[]}),()=>{const a=Lt(e),s=fo(a);let l=a.tag||gn;if(n=[],o)for(let e=0;e<o.length;e++){const t=o[e];t.el&&t.el instanceof Element&&(n.push(t),Or(t,Mr(t,s,i,r)),Wo.set(t,t.el.getBoundingClientRect()))}o=t.default?Dr(t.default()):[];for(let e=0;e<o.length;e++){const t=o[e];null!=t.key&&Or(t,Mr(t,s,i,r))}return Rn(l,null,o)}}});function Yo(e){const t=e.el;t[Zo]&&t[Zo](),t[Jo]&&t[Jo]()}function Qo(e){Go.set(e,e.el.getBoundingClientRect())}function Xo(e){const t=Wo.get(e),r=Go.get(e),i=t.left-r.left,n=t.top-r.top;if(i||n){const t=e.el.style;return t.transform=t.webkitTransform=`translate(${i}px,${n}px)`,t.transitionDuration="0s",e}}const ea=e=>{const t=e.props["onUpdate:modelValue"]||!1;return z(t)?e=>ne(t,e):t};function ta(e){e.target.composing=!0}function ra(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const ia=Symbol("_assign"),na={created(e,{modifiers:{lazy:t,trim:r,number:i}},n){e[ia]=ea(n);const o=i||n.props&&"number"===n.props.type;Uo(e,t?"change":"input",t=>{if(t.target.composing)return;let i=e.value;r&&(i=i.trim()),o&&(i=ae(i)),e[ia](i)}),r&&Uo(e,"change",()=>{e.value=e.value.trim()}),t||(Uo(e,"compositionstart",ta),Uo(e,"compositionend",ra),Uo(e,"change",ra))},mounted(e,{value:t}){e.value=null==t?"":t},beforeUpdate(e,{value:t,oldValue:r,modifiers:{lazy:i,trim:n,number:o}},a){if(e[ia]=ea(a),e.composing)return;const s=null==t?"":t;if((!o&&"number"!==e.type||/^0\d/.test(e.value)?e.value:ae(e.value))!==s){if(document.activeElement===e&&"range"!==e.type){if(i&&t===r)return;if(n&&e.value.trim()===s)return}e.value=s}}},oa=["ctrl","shift","alt","meta"],aa={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>oa.some(r=>e[`${r}Key`]&&!t.includes(r))},sa=(e,t)=>{const r=e._withMods||(e._withMods={}),i=t.join(".");return r[i]||(r[i]=(r,...i)=>{for(let e=0;e<t.length;e++){const i=aa[t[e]];if(i&&i(r,t))return}return e(r,...i)})},la={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ca=(e,t)=>{const r=e._withKeys||(e._withKeys={}),i=t.join(".");return r[i]||(r[i]=r=>{if(!("key"in r))return;const i=ee(r.key);return t.some(e=>e===i||la[e]===i)?e(r):void 0})},da=O({patchProp:(e,t,r,i,n,o)=>{const a="svg"===n;"class"===t?function(e,t,r){const i=e[uo];i&&(t=(t?[t,...i]:[...i]).join(" ")),null==t?e.removeAttribute("class"):r?e.setAttribute("class",t):e.className=t}(e,i,a):"style"===t?function(e,t,r){const i=e.style,n=B(r);let o=!1;if(r&&!n){if(t)if(B(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==r[t]&&Oo(i,t,"")}else for(const e in t)null==r[e]&&Oo(i,e,"");for(const e in r)"display"===e&&(o=!0),Oo(i,e,r[e])}else if(n){if(t!==r){const e=i[Mo];e&&(r+=";"+e),i.cssText=r,o=Ao.test(r)}}else t&&e.removeAttribute("style");Io in e&&(e[Io]=o?i.display:"",e[Po]&&(i.display="none"))}(e,r,i):A(t)?R(t)||function(e,t,r,i,n=null){const o=e[Fo]||(e[Fo]={}),a=o[t];if(i&&a)a.value=i;else{const[r,s]=function(e){let t;if(Bo.test(e)){let r;for(t={};r=e.match(Bo);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[":"===e[2]?e.slice(3):ee(e.slice(2)),t]}(t);if(i){const a=o[t]=function(e,t){const r=e=>{if(e._vts){if(e._vts<=r.attached)return}else e._vts=Date.now();Yt(function(e,t){if(z(t)){const r=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{r.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,r.value),t,5,[e])};return r.value=e,r.attached=$o(),r}(i,n);Uo(e,r,a,s)}else a&&(function(e,t,r,i){e.removeEventListener(t,r,i)}(e,r,a,s),o[t]=void 0)}}(e,t,0,i,o):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,r,i){if(i)return"innerHTML"===t||"textContent"===t||!!(t in e&&Ho(t)&&F(r));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}return(!Ho(t)||!B(r))&&t in e}(e,t,i,a))?(jo(e,t,i),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||zo(e,t,i,a,0,"value"!==t)):!e._isVueCE||!/[A-Z]/.test(t)&&B(i)?("true-value"===t?e._trueValue=i:"false-value"===t&&(e._falseValue=i),zo(e,t,i,a)):jo(e,Q(t),i,0,t)}},so);let ua;var ha=(e,t,r)=>((e,t,r={})=>{let i=`${e}=${t}`;if(e.startsWith("__Secure-")&&!r.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!r.secure)throw new Error("__Host- Cookie must have Secure attributes");if("/"!==r.path)throw new Error('__Host- Cookie must have Path attributes with "/"');if(r.domain)throw new Error("__Host- Cookie must not have Domain attributes")}if(r&&"number"==typeof r.maxAge&&r.maxAge>=0){if(r.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");i+="; Max-Age="+(0|r.maxAge)}if(r.domain&&"host"!==r.prefix&&(i+=`; Domain=${r.domain}`),r.path&&(i+=`; Path=${r.path}`),r.expires){if(r.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite&&(i+=`; SameSite=${r.sameSite.charAt(0).toUpperCase()+r.sameSite.slice(1)}`),r.priority&&(i+=`; Priority=${r.priority.charAt(0).toUpperCase()+r.priority.slice(1)}`),r.partitioned){if(!r.secure)throw new Error("Partitioned Cookie must have Secure attributes");i+="; Partitioned"}return i})(e,t=encodeURIComponent(t),r),pa=(e,t)=>{for(const[r,i]of Object.entries(t)){const t=new RegExp("/:"+r+"(?:{[^/]+})?\\??");e=e.replace(t,i?`/${i}`:"")}return e},ma=e=>{const t=new URLSearchParams;for(const[r,i]of Object.entries(e))if(void 0!==i)if(Array.isArray(i))for(const e of i)t.append(r,e);else t.set(r,i);return t},ga=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,"/"):e.replace(/\/index(?=\?|$)/,"");function va(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function fa(e,t){if(!va(e)&&!va(t))return t;const r={...e};for(const i in t){const e=t[i];va(r[i])&&va(e)?r[i]=fa(r[i],e):r[i]=e}return r}var ka=(e,t)=>new Proxy(()=>{},{get(r,i){if("string"==typeof i&&"then"!==i)return ka(e,[...t,i])},apply:(r,i,n)=>e({path:t,args:n})}),ba=class{constructor(e,t){r(this,"url"),r(this,"method"),r(this,"queryParams"),r(this,"pathParams",{}),r(this,"rBody"),r(this,"cType"),r(this,"fetch",async(e,t)=>{if(e){if(e.query&&(this.queryParams=ma(e.query)),e.form){const t=new FormData;for(const[r,i]of Object.entries(e.form))if(Array.isArray(i))for(const e of i)t.append(r,e);else t.append(r,i);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType="application/json"),e.param&&(this.pathParams=e.param)}let r=this.method.toUpperCase();const i={...e?.header,..."function"==typeof t?.headers?await t.headers():t?.headers};if(e?.cookie){const t=[];for(const[r,i]of Object.entries(e.cookie))t.push(ha(r,i,{path:"/"}));i.Cookie=t.join(",")}this.cType&&(i["Content-Type"]=this.cType);const n=new Headers(i??void 0);let o=this.url;o=ga(o),o=pa(o,this.pathParams),this.queryParams&&(o=o+"?"+this.queryParams.toString()),r=this.method.toUpperCase();const a=!("GET"===r||"HEAD"===r);return(t?.fetch||fetch)(o,{body:a?this.rBody:void 0,method:r,headers:n,...t?.init})}),this.url=e,this.method=t}},wa=(e,t)=>ka(function r(i){const n=[...i.path],o=n.slice(-3).reverse();if("toString"===o[0])return"name"===o[1]?o[2]||"":r.toString();if("valueOf"===o[0])return"name"===o[1]?o[2]||"":r;let a="";if(/^\$/.test(o[0])){const e=n.pop();e&&(a=e.replace(/^\$/,""))}const s=n.join("/"),l=((e,t)=>(e=e.replace(/\/+$/,""),(e+="/")+t.replace(/^\/+/,"")))(e,s);if("url"===a){let e=l;return i.args[0]&&(i.args[0].param&&(e=pa(l,i.args[0].param)),i.args[0].query&&(e=e+"?"+ma(i.args[0].query).toString())),e=ga(e),new URL(e)}if("ws"===a){const e=(i.args[0]&&i.args[0].param?pa(l,i.args[0].param):l).replace(/^http/,"ws"),r=new URL(e),n=i.args[0]?.query;return n&&Object.entries(n).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>r.searchParams.append(e,t)):r.searchParams.set(e,t)}),((...e)=>void 0!==t?.webSocket&&"function"==typeof t.webSocket?t.webSocket(...e):new WebSocket(...e))(r.toString())}const c=new ba(l,a);if(a){t??(t={});const e=fa(t,{...i.args[1]});return c.fetch(i.args[0],e)}return c},[]),ya=Object.defineProperty,xa=(e,t)=>ya(e,"name",{value:t,configurable:!0}),Ca=(e,t,r)=>((e,t,r)=>t in e?ya(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const Sa=globalThis.process,Ta=typeof window<"u",Ea=typeof Sa<"u"&&!Ta,_a=Ta?typeof window<"u"&&window.location&&!window.location.hostname.includes("localhost"):Ea&&typeof Sa<"u"&&"production"===Sa.env?.NODE_ENV,Ia=!_a,Pa={error:{priority:50,color:"#FF0000",nodeColor:"\x1b[31m"},warn:{priority:40,color:"#FFA500",nodeColor:"\x1b[33m"},info:{priority:30,color:"#00ABFF",nodeColor:"\x1b[36m"},debug:{priority:20,color:"#00BD0C",nodeColor:"\x1b[32m"},trace:{priority:10,color:"#5233FF",nodeColor:"\x1b[35m"}},Ma=["password","token","secret","apikey","api_key","authorization","cookie"],Aa=class e{constructor(e={},t){Ca(this,"settings"),Ca(this,"enabledInBrowser",!1),Ca(this,"context"),this.context=t,this.settings={enabled:e.enabled??!0,minLevel:e.minLevel??this.getDefaultLevel(),timestamps:e.timestamps??!0},Ta&&this.initBrowserLogging()}getDefaultLevel(){if(Ea&&typeof Sa<"u"&&Sa.env?.LOG_LEVEL)return Sa.env.LOG_LEVEL;if(Ta&&typeof localStorage<"u"){const e=localStorage.getItem("FICTION_LOG_LEVEL");if(e)return e}return _a?"info":"debug"}initBrowserLogging(){if(!Ta)return;const t="true"===localStorage.getItem("FICTION_LOG"),r=window.location?.hostname||"";this.enabledInBrowser=Ia||t||"localhost"===r||r.includes("127.0.0.1"),_a&&!t&&!e.hasShownHelp&&(e.hasShownHelp=!0)}shouldLog(e){return!(!this.settings.enabled||Ta&&!this.enabledInBrowser)&&Pa[e].priority>=Pa[this.settings.minLevel].priority}formatTimestamp(){return(new Date).toLocaleTimeString("en-GB",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}formatISOTimestamp(){return(new Date).toISOString()}redactSensitive(e){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return e.map(e=>this.redactSensitive(e));const t={};for(const[r,i]of Object.entries(e)){const e=r.toLowerCase();Ma.some(t=>e.includes(t))?t[r]="[REDACTED]":t[r]="object"==typeof i&&null!==i?this.redactSensitive(i):i}return t}formatData(e,t=3,r=0){if(r>=t)return"[Max Depth]";if(null==e)return e;if(e instanceof Error)return{name:e.name,message:e.message,stack:_a?e.stack?.split("\n").slice(0,3).join("\n"):e.stack,...e};if(e instanceof Date)return e.toISOString();if("object"!=typeof e)return e;if(Array.isArray(e))return e.length>20&&_a?`Array(${e.length}) [${e.slice(0,3).map(e=>this.formatData(e,t,r+1)).join(", ")}, ...]`:e.map(e=>this.formatData(e,t,r+1));try{const i={},n=Object.entries(e),o=_a?50:200;for(const[e,a]of n.slice(0,o))i[e]=this.formatData(a,t,r+1);return n.length>o&&(i["..."]=n.length-o+" more properties"),this.redactSensitive(i)}catch{return"[Unserializable]"}}logToBrowser(e){if(!Ta||!this.shouldLog(e.level))return;const{level:t,description:r,context:i,data:n,error:o}=e,a=Pa[t];i||this.context,t.toUpperCase(),a.color,o&&Error}async logToNode(e){if(!Ea||!this.shouldLog(e.level))return;const{level:t,description:r,context:i,data:n,error:o}=e,a=i||this.context||"www";if(_a){const e={timestamp:this.formatISOTimestamp(),level:t.toUpperCase()};n&&(e.data=this.formatData(n)),o&&(e.error=this.formatData(o))}else try{const e=(await Promise.resolve().then(()=>BT).catch(()=>null))?.default,r=Pa[t],i=this.formatTimestamp();if(e){const n=e.dim,s=e.hex(r.color);n(`${i} `),s(`${t.toUpperCase()} `);s(`(${a}): `),o&&o instanceof Error&&e&&o.stack}}catch{}}log(e){Ta?this.logToBrowser(e):Ea&&this.logToNode(e).catch(console.error)}error(e,t){this.log({level:"error",description:e,data:t,context:this.context})}warn(e,t){this.log({level:"warn",description:e,data:t,context:this.context})}info(e,t){this.log({level:"info",description:e,data:t,context:this.context})}debug(e,t){this.log({level:"debug",description:e,data:t,context:this.context})}trace(e,t){this.log({level:"trace",description:e,data:t,context:this.context})}isEnabled(){return!Ta||this.enabledInBrowser}setLevel(e){this.settings.minLevel=e}createContextLogger(t){const r=new e(this.settings,t);return{error:xa((e,t)=>r.error(e,t),"error"),warn:xa((e,t)=>r.warn(e,t),"warn"),info:xa((e,t)=>r.info(e,t),"info"),debug:xa((e,t)=>r.debug(e,t),"debug"),trace:xa((e,t)=>r.trace(e,t),"trace"),isEnabled:xa(()=>r.isEnabled(),"isEnabled"),setLevel:xa(e=>r.setLevel(e),"setLevel")}}};xa(Aa,"Logger"),Ca(Aa,"hasShownHelp",!1);let Ra=Aa;function Oa(e){return new Ra({},e).createContextLogger(e)}xa(Oa,"createLogger");const Da=new Ra;Da.error.bind(Da),Da.warn.bind(Da),Da.info.bind(Da),Da.debug.bind(Da),Da.trace.bind(Da);const La=class{constructor(e,t){Ca(this,"name"),Ca(this,"settings"),Ca(this,"logger"),this.name=e,this.settings=t,this.logger=Oa(e)}};xa(La,"SettingsObject");let Na=La;const za=class{constructor(){Ca(this,"tokenName","auth-token"),Ca(this,"tokenMaxAge",604800),Ca(this,"fallbackStorageKey","token"),Ca(this,"productionDomain",".fiction.com")}getCookie(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(const r of t){const[t,i]=r.trim().split("=");if(t===e)return decodeURIComponent(i||"")}return null}setCookie(e,t,r={}){if(typeof document>"u")return;const{secure:i=!0,sameSite:n="lax",maxAge:o=604800,domain:a,path:s="/"}=r;let l=`${e}=${encodeURIComponent(t)}`;l+=`; Path=${s}`,l+=`; Max-Age=${o}`,l+=`; SameSite=${n}`,i&&(l+="; Secure"),a&&(l+=`; Domain=${a}`),document.cookie=l}removeCookie(e,t={}){this.setCookie(e,"",{...t,maxAge:0})}getAuthToken(){const e=this.getCookie(this.tokenName);if(e)return e;if(typeof localStorage<"u"){const e=localStorage.getItem(this.fallbackStorageKey);if(e)return this.setAuthToken(e),localStorage.removeItem(this.fallbackStorageKey),e}return null}setAuthToken(e){const t=typeof window<"u"&&"localhost"!==window.location.hostname;this.setCookie(this.tokenName,e,{secure:t,sameSite:"lax",maxAge:this.tokenMaxAge,domain:t?this.productionDomain:void 0,path:"/"})}removeAuthToken(){const e=typeof window<"u"&&"localhost"!==window.location.hostname;this.removeCookie(this.tokenName,{domain:e?this.productionDomain:void 0,path:"/"}),typeof localStorage<"u"&&localStorage.removeItem(this.fallbackStorageKey)}};xa(za,"CookieUtil");const ja=new za;function Ua(e,t){const r=e.apiBase||(e.isDev?"http://localhost:5555":"https://app.fiction.com");return wa(r,{fetch:xa(async(e,r)=>{const i=await fetch(e,{...r,credentials:"include",headers:{...r?.headers,"Content-Type":"application/json",Authorization:`Bearer ${ja.getAuthToken()||""}`}});if(t){const e=i.json.bind(i),r=i.clone();return Object.defineProperty(r,"json",{value:xa(async()=>{const r=await e();return"object"==typeof r&&null!==r&&"ok"in r&&("user"in r||"token"in r)&&t(r),r},"value")}),r}return i},"fetch")})}xa(Ua,"createApiClient");let Fa=[],Ba=0,Va=xa(e=>{let t=[],r={get:()=>(r.lc||r.listen(()=>{})(),r.value),lc:0,listen:e=>(r.lc=t.push(e),()=>{for(let t=Ba+4;t<Fa.length;)Fa[t]===e?Fa.splice(t,4):t+=4;let i=t.indexOf(e);~i&&(t.splice(i,1),--r.lc||r.off())}),notify(e,i){let n=!Fa.length;for(let o of t)Fa.push(o,r.value,e,i);if(n){for(Ba=0;Ba<Fa.length;Ba+=4)Fa[Ba](Fa[Ba+1],Fa[Ba+2],Fa[Ba+3]);Fa.length=0}},off(){},set(e){let t=r.value;t!==e&&(r.value=e,r.notify(t))},subscribe(e){let t=r.listen(e);return e(r.value),t},value:e};return r},"atom");const qa=Va(void 0),$a=Va(null),Ha=class{constructor(){Ca(this,"logger",Oa("SDKStorage"))}syncWithGlobalStores(e,t){const r=qa.get(),i=$a.get();r&&(e.value=r),i&&(t.value=i),en(e,e=>{qa.set(e)},{immediate:!0}),en(t,e=>{$a.set(e)},{immediate:!0}),qa.subscribe(t=>{t!==e.value&&(e.value=t)}),$a.subscribe(e=>{e!==t.value&&(t.value=e)})}loadFromStorage(e,t){if(typeof window>"u")return;const r=ja.getAuthToken();r&&(t.value=r);try{const t=localStorage.getItem("fiction-user");t&&(e.value=JSON.parse(t))}catch(i){this.logger.error("Failed to load user from localStorage",{data:i})}}saveToStorage(e,t){if(!(typeof window>"u")){t.value?ja.setAuthToken(t.value):ja.removeAuthToken();try{e.value?localStorage.setItem("fiction-user",JSON.stringify(e.value)):localStorage.removeItem("fiction-user")}catch(r){this.logger.error("Failed to save user to localStorage",{data:r})}}}clearStorage(){if(!(typeof window>"u")){ja.removeAuthToken();try{localStorage.removeItem("fiction-user")}catch(e){this.logger.error("Failed to clear user from localStorage",{data:e})}qa.set(void 0),$a.set(null)}}getItem(e){if(typeof window>"u")return null;try{return localStorage.getItem(e)}catch(VT){return this.logger.error("Failed to get item from localStorage",{key:e,error:VT}),null}}setItem(e,t){if(!(typeof window>"u"))try{localStorage.setItem(e,t)}catch(r){this.logger.error("Failed to set item in localStorage",{key:e,error:r})}}};xa(Ha,"SDKStorage");let Wa=Ha;const Ga=class extends Na{constructor(e={}){super("FictionSDK",e),Ca(this,"activeUser",Ut()),Ca(this,"token",Ut(null)),Ca(this,"loading",Ut(!1)),Ca(this,"error",Ut(null)),Ca(this,"apiBase",this.settings.apiBase||void 0),Ca(this,"storage",new Wa),Ca(this,"sessionId",l({prefix:"ses"})),Ca(this,"apiClient"),Ca(this,"currentSelf",eo(()=>{const e=this.activeUser.value;if(!e?.selves)return;const t=e.primarySelfId||e.selves[0]?.selfId;return t?e.selves.find(e=>e.selfId===t):void 0})),Ca(this,"currentOrg",eo(()=>{const e=this.currentSelf.value;if(!e?.orgId)return;const t=this.activeUser.value;return t?.orgs?t.orgs.find(t=>t.orgId===e.orgId):void 0})),Ca(this,"initialized"),Ca(this,"resolveUser"),this.apiClient=Ua({isDev:this.isDev,apiBase:this.apiBase},this.processApiResponse.bind(this)),this.logger.info("FictionSDK initialized"),this.storage.loadFromStorage(this.activeUser,this.token),this.storage.syncWithGlobalStores(this.activeUser,this.token),this.initialized=new Promise(e=>{this.resolveUser=e}),this.token.value&&!this.activeUser.value?this.getCurrentUser().then(e=>{this.resolveUser&&(this.resolveUser(e),this.resolveUser=void 0)}).catch(e=>{this.logger.error("Auto user fetch failed",{data:e}),this.resolveUser&&(this.resolveUser(void 0),this.resolveUser=void 0)}):this.activeUser.value?this.resolveUser?.(this.activeUser.value):this.resolveUser?.(void 0)}get isDev(){return this.settings.isDev??(typeof window<"u"&&("localhost"===window.location.hostname||window.location.hostname.includes("127.0.0.1")))}get api(){return this.apiClient.api}processApiResponse(e){e.ok&&e.user&&(this.activeUser.value=e.user,this.logger.info("User updated from API response",{data:e.user})),e.ok&&e.token&&(this.token.value=e.token,this.storage.saveToStorage(this.activeUser,this.token),this.logger.info("Token updated from API response")),this.resolveUser&&e.ok&&(this.resolveUser(e.user),this.resolveUser=void 0)}clearSession(){this.logger.info("Clearing session"),this.activeUser.value=void 0,this.token.value=null,this.error.value=null,this.storage.clearStorage()}async sendCode(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.auth["check-email"].$post({json:{email:e}})).json();if(!t.ok)throw this.error.value=t.error,new Error(t.error)}catch(t){this.logger.error("Send code error",{data:t});const e=t instanceof Error?t.message:"Failed to send verification code";throw this.error.value=e,t}finally{this.loading.value=!1}}async verifyCode(e,t){this.loading.value=!0,this.error.value=null;try{const r=await(await this.api.auth["verify-code"].$post({json:{email:e,code:t}})).json();if(!r.ok)throw this.error.value=r.error,new Error(r.error)}catch(r){this.logger.error("Verify code error",{data:r});const e=r instanceof Error?r.message:"Failed to verify code";throw this.error.value=e,r}finally{this.loading.value=!1}}async login(e,t){this.loading.value=!0,this.error.value=null;try{const r=await(await this.api.auth.login.$post({json:{email:e,password:t}})).json();if(!r.ok)throw this.error.value=r.error,new Error(r.error)}catch(r){this.logger.error("Login error",{data:r});const e=r instanceof Error?r.message:"Login failed";throw this.error.value=e,r}finally{this.loading.value=!1}}async logout(){this.loading.value=!0,this.error.value=null;try{await this.api.auth.logout.$post(),this.activeUser.value=void 0,this.token.value=null,this.storage.clearStorage()}catch(VT){this.logger.error("Logout error (user still logged out locally)",{data:VT}),this.activeUser.value=void 0,this.token.value=null,this.storage.clearStorage()}finally{this.loading.value=!1}}async getCurrentUser(){if(this.token.value){this.loading.value=!0;try{const e=await(await this.api.auth.me.$get()).json();return e.ok?e.user:(this.error.value=e.error,void(e.error.includes("Authentication")&&(this.activeUser.value=void 0,this.token.value=null,this.storage.clearStorage())))}catch(VT){return this.logger.error("Get current user error",{data:VT}),void(this.error.value=VT instanceof Error?VT.message:"Failed to get user info")}finally{this.loading.value=!1}}}async getPublicSelf(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.self.public[":handle"].$get({param:{handle:e.handle}})).json();return t.ok?t.data:(this.error.value=t.error,void this.logger.error("Failed to fetch public self",{handle:e.handle,error:t.error}))}catch(t){return this.logger.error("Get public self error",{handle:e.handle,error:t}),void(this.error.value=t instanceof Error?t.message:"Failed to fetch self")}finally{this.loading.value=!1}}async requestAuthCode(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.auth["check-email"].$post({json:{email:e.email}})).json();return t.ok?(this.logger.info("Auth code requested successfully",{email:e.email}),!0):(this.error.value=t.error,this.logger.error("Failed to request auth code",{email:e.email,error:t.error}),!1)}catch(t){return this.logger.error("Request auth code error",{email:e.email,error:t}),this.error.value=t instanceof Error?t.message:"Failed to request auth code",!1}finally{this.loading.value=!1}}async loginWithCode(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.auth["verify-code"].$post({json:{email:e.email,code:e.code}})).json();return t.ok?(this.logger.info("Login successful",{email:e.email}),e.orgId&&!1!==e.autoCreateContact&&this.activeUser.value?.userId&&await this.autoCreateContact({userId:this.activeUser.value.userId,orgId:e.orgId}),!0):(this.error.value=t.error,this.logger.error("Login failed",{email:e.email,error:t.error}),!1)}catch(t){return this.logger.error("Login with code error",{email:e.email,error:t}),this.error.value=t instanceof Error?t.message:"Login failed",!1}finally{this.loading.value=!1}}async trackUsage(e){try{const t=this.currentSelf.value;if(!t?.orgId)return this.logger.error("Cannot track usage: no current self with orgId",{args:e}),!1;const r=await(await this.api.usage.record.$post({json:{orgId:t.orgId,selfId:e.selfId,sessionId:this.sessionId,type:e.type,quantity:e.quantity,userId:e.participantId||this.activeUser.value?.userId||"anonymous"}})).json();return!!r.ok||(this.logger.error("Failed to track usage",{error:r.error,args:e}),!1)}catch(t){return this.logger.error("Track usage error",{error:t,args:e}),!1}}async autoCreateContact(e){try{const t=await(await this.api.contact.resolve.$post({json:{userId:e.userId,orgId:e.orgId}})).json();return t.ok?(this.logger.info("Contact resolved",{userId:e.userId,orgId:e.orgId}),!0):(this.logger.error("Failed to auto-create contact",{error:t.error,args:e}),!1)}catch(t){return this.logger.error("Auto-create contact error",{error:t,args:e}),!1}}async startConversation(e){try{const t=this.currentSelf.value;if(!t?.orgId)return void this.logger.error("Cannot start conversation: no current self with orgId",{args:e});const r=await(await this.api.conversation.start.$post({json:{orgId:t.orgId,selfId:e.selfId,userId:e.userId||this.activeUser.value?.userId,anonId:e.anonId}})).json();if(!r.ok||!r.data){const t=r.ok?"No conversation data returned":"error"in r?r.error:"Unknown error";return void this.logger.error("Failed to start conversation",{error:t,args:e})}return this.logger.info("Conversation started",{conversationId:r.data.conversationId}),r.data}catch(t){return void this.logger.error("Start conversation error",{error:t,args:e})}}generateAnonId(){const e="fictionAnonId";let t=this.storage.getItem(e);return t||(t=l({prefix:"anon"}),this.storage.setItem(e,t)),t}async saveMessage(e){try{const t=await(await this.api.conversation.messages.$post({json:{sessionId:e.conversationId,participantId:e.participantId,content:e.content,role:e.role}})).json();return!!t.ok||(this.logger.error("Failed to save message",{error:"error"in t?t.error:"Unknown error",args:e}),!1)}catch(t){return this.logger.error("Save message error",{error:t,args:e}),!1}}};xa(Ga,"FictionSDK");let Za=Ga;function Ja(e,t,r){function i(r,i){var n;Object.defineProperty(r,"_zod",{value:r._zod??{},enumerable:!1}),(n=r._zod).traits??(n.traits=new Set),r._zod.traits.add(e),t(r,i);for(const e in a.prototype)e in r||Object.defineProperty(r,e,{value:a.prototype[e].bind(r)});r._zod.constr=a,r._zod.def=i}const n=r?.Parent??Object;class o extends n{}function a(e){var t;const n=r?.Parent?new o:this;i(n,e),(t=n._zod).deferred??(t.deferred=[]);for(const r of n._zod.deferred)r();return n}return Object.defineProperty(o,"name",{value:e}),Object.defineProperty(a,"init",{value:i}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class Ka extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ya extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Qa={};function Xa(e){return Qa}function es(e,t){return"bigint"==typeof t?t.toString():t}function ts(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function rs(e){return null==e}function is(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const ns=Symbol("evaluating");function os(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==ns)return void 0===i&&(i=ns,i=r()),i},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function as(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ss(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function ls(e){return JSON.stringify(e)}const cs="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ds(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const us=ts(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function hs(e){if(!1===ds(e))return!1;const t=e.constructor;if(void 0===t)return!0;const r=t.prototype;return!1!==ds(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function ps(e){return hs(e)?{...e}:Array.isArray(e)?[...e]:e}const ms=new Set(["string","number","symbol"]);function gs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vs(e,t,r){const i=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(i._zod.parent=e),i}function fs(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const ks={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function bs(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function ws(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function ys(e){return"string"==typeof e?e:e?.message}function xs(e,t,r){const i={...e,path:e.path??[]};if(!e.message){const n=ys(e.inst?._zod.def?.error?.(e))??ys(t?.error?.(e))??ys(r.customError?.(e))??ys(r.localeError?.(e))??"Invalid input";i.message=n}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Cs(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Ss(...e){const[t,r,i]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:i}:{...t}}const Ts=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,es,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Es=Ja("$ZodError",Ts),_s=Ja("$ZodError",Ts,{Parent:Error}),Is=e=>(t,r,i,n)=>{const o=i?Object.assign(i,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new Ka;if(a.issues.length){const t=new(n?.Err??e)(a.issues.map(e=>xs(e,o,Xa())));throw cs(t,n?.callee),t}return a.value},Ps=e=>async(t,r,i,n)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(n?.Err??e)(a.issues.map(e=>xs(e,o,Xa())));throw cs(t,n?.callee),t}return a.value},Ms=e=>(t,r,i)=>{const n=i?{...i,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},n);if(o instanceof Promise)throw new Ka;return o.issues.length?{success:!1,error:new(e??Es)(o.issues.map(e=>xs(e,n,Xa())))}:{success:!0,data:o.value}},As=Ms(_s),Rs=e=>async(t,r,i)=>{const n=i?Object.assign(i,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>xs(e,n,Xa())))}:{success:!0,data:o.value}},Os=Rs(_s),Ds=e=>(t,r,i)=>{const n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Is(e)(t,r,n)},Ls=e=>(t,r,i)=>Is(e)(t,r,i),Ns=e=>async(t,r,i)=>{const n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ps(e)(t,r,n)},zs=e=>async(t,r,i)=>Ps(e)(t,r,i),js=e=>(t,r,i)=>{const n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ms(e)(t,r,n)},Us=e=>(t,r,i)=>Ms(e)(t,r,i),Fs=e=>async(t,r,i)=>{const n=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Rs(e)(t,r,n)},Bs=e=>async(t,r,i)=>Rs(e)(t,r,i),Vs=/^[cC][^\s-]{8,}$/,qs=/^[0-9a-z]+$/,$s=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Hs=/^[0-9a-vA-V]{20}$/,Ws=/^[A-Za-z0-9]{27}$/,Gs=/^[a-zA-Z0-9_-]{21}$/,Zs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Js=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ks=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ys=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qs=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,el=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,rl=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,il=/^[A-Za-z0-9_-]*$/,nl=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,ol=/^\+(?:[0-9]){6,14}[0-9]$/,al="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",sl=new RegExp(`^${al}$`);function ll(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const cl=/^-?\d+$/,dl=/^-?\d+(?:\.\d+)?/,ul=/^(?:true|false)$/i,hl=/^[^A-Z]*$/,pl=/^[^a-z]*$/,ml=Ja("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),gl={number:"number",bigint:"bigint",object:"date"},vl=Ja("$ZodCheckLessThan",(e,t)=>{ml.init(e,t);const r=gl[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,i=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:r,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),fl=Ja("$ZodCheckGreaterThan",(e,t)=>{ml.init(e,t);const r=gl[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,i=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),kl=Ja("$ZodCheckMultipleOf",(e,t)=>{ml.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=(e.toString().split(".")[1]||"").length,i=t.toString();let n=(i.split(".")[1]||"").length;if(0===n&&/\d?e-\d?/.test(i)){const e=i.match(/\d?e-(\d?)/);e?.[1]&&(n=Number.parseInt(e[1]))}const o=r>n?r:n;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),bl=Ja("$ZodCheckNumberFormat",(e,t)=>{ml.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),i=r?"int":"number",[n,o]=ks[t.format];e._zod.onattach.push(e=>{const i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=o,r&&(i.pattern=cl)}),e._zod.check=a=>{const s=a.value;if(r){if(!Number.isInteger(s))return void a.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});if(!Number.isSafeInteger(s))return void(s>0?a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}s<n&&a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),s>o&&a.issues.push({origin:"number",input:s,code:"too_big",maximum:o,inst:e})}}),wl=Ja("$ZodCheckMaxLength",(e,t)=>{var r;ml.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!rs(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const i=r.value;if(i.length<=t.maximum)return;const n=Cs(i);r.issues.push({origin:n,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),yl=Ja("$ZodCheckMinLength",(e,t)=>{var r;ml.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!rs(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const i=r.value;if(i.length>=t.minimum)return;const n=Cs(i);r.issues.push({origin:n,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xl=Ja("$ZodCheckLengthEquals",(e,t)=>{var r;ml.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!rs(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const i=r.value,n=i.length;if(n===t.length)return;const o=Cs(i),a=n>t.length;r.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Cl=Ja("$ZodCheckStringFormat",(e,t)=>{var r,i;ml.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),Sl=Ja("$ZodCheckRegex",(e,t)=>{Cl.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Tl=Ja("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hl),Cl.init(e,t)}),El=Ja("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pl),Cl.init(e,t)}),_l=Ja("$ZodCheckIncludes",(e,t)=>{ml.init(e,t);const r=gs(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Il=Ja("$ZodCheckStartsWith",(e,t)=>{ml.init(e,t);const r=new RegExp(`^${gs(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Pl=Ja("$ZodCheckEndsWith",(e,t)=>{ml.init(e,t);const r=new RegExp(`.*${gs(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Ml=Ja("$ZodCheckOverwrite",(e,t)=>{ml.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Al{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),i=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const n of i)this.content.push(n)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Rl={major:4,minor:1,patch:11},Ol=Ja("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Rl;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const n of i)for(const t of n._zod.onattach)t(e);if(0===i.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let i,n=bs(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(n)continue;const t=e.issues.length,a=o._zod.check(e);if(a instanceof Promise&&!1===r?.async)throw new Ka;if(i||a instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await a,e.issues.length!==t&&(n||(n=bs(e,t)))});else{if(e.issues.length===t)continue;n||(n=bs(e,t))}}return i?i.then(()=>e):e},r=(r,n,o)=>{if(bs(r))return r.aborted=!0,r;const a=t(n,i,o);if(a instanceof Promise){if(!1===o.async)throw new Ka;return a.then(t=>e._zod.parse(t,o))}return e._zod.parse(a,o)};e._zod.run=(n,o)=>{if(o.skipChecks)return e._zod.parse(n,o);if("backward"===o.direction){const t=e._zod.parse({value:n.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,n,o)):r(t,n,o)}const a=e._zod.parse(n,o);if(a instanceof Promise){if(!1===o.async)throw new Ka;return a.then(e=>t(e,i,o))}return t(a,i,o)}}e["~standard"]={validate:t=>{try{const r=As(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Os(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Dl=Ja("$ZodString",(e,t)=>{var r;Ol.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ll=Ja("$ZodStringFormat",(e,t)=>{Cl.init(e,t),Dl.init(e,t)}),Nl=Ja("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Js),Ll.init(e,t)}),zl=Ja("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ks(e))}else t.pattern??(t.pattern=Ks());Ll.init(e,t)}),jl=Ja("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ys),Ll.init(e,t)}),Ul=Ja("$ZodURL",(e,t)=>{Ll.init(e,t),e._zod.check=r=>{try{const i=r.value.trim(),n=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:nl.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=n.href:r.value=i)}catch(i){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Fl=Ja("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ll.init(e,t)}),Bl=Ja("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Gs),Ll.init(e,t)}),Vl=Ja("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Vs),Ll.init(e,t)}),ql=Ja("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=qs),Ll.init(e,t)}),$l=Ja("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$s),Ll.init(e,t)}),Hl=Ja("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Hs),Ll.init(e,t)}),Wl=Ja("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ws),Ll.init(e,t)}),Gl=Ja("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=ll({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${r.join("|")})`;return new RegExp(`^${al}T(?:${i})$`)}(t)),Ll.init(e,t)}),Zl=Ja("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=sl),Ll.init(e,t)}),Jl=Ja("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${ll(t)}$`)),Ll.init(e,t)}),Kl=Ja("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Zs),Ll.init(e,t)}),Yl=Ja("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Qs),Ll.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Ql=Ja("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xs),Ll.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Xl=Ja("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=el),Ll.init(e,t)}),ec=Ja("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tl),Ll.init(e,t),e._zod.check=r=>{const i=r.value.split("/");try{if(2!==i.length)throw new Error;const[e,t]=i;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function tc(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const rc=Ja("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=rl),Ll.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{tc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ic=Ja("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=il),Ll.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{(function(e){if(!il.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tc(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),nc=Ja("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ol),Ll.init(e,t)}),oc=Ja("$ZodJWT",(e,t)=>{Ll.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[i]=r;if(!i)return!1;const n=JSON.parse(atob(i));return!("typ"in n&&"JWT"!==n?.typ||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),ac=Ja("$ZodNumber",(e,t)=>{Ol.init(e,t),e._zod.pattern=e._zod.bag.pattern??dl,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch(a){}const n=r.value;if("number"==typeof n&&!Number.isNaN(n)&&Number.isFinite(n))return r;const o="number"==typeof n?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...o?{received:o}:{}}),r}}),sc=Ja("$ZodNumber",(e,t)=>{bl.init(e,t),ac.init(e,t)}),lc=Ja("$ZodBoolean",(e,t)=>{Ol.init(e,t),e._zod.pattern=ul,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(o){}const n=r.value;return"boolean"==typeof n||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}}),cc=Ja("$ZodAny",(e,t)=>{Ol.init(e,t),e._zod.parse=e=>e}),dc=Ja("$ZodUnknown",(e,t)=>{Ol.init(e,t),e._zod.parse=e=>e}),uc=Ja("$ZodNever",(e,t)=>{Ol.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function hc(e,t,r){e.issues.length&&t.issues.push(...ws(r,e.issues)),t.value[r]=e.value}const pc=Ja("$ZodArray",(e,t)=>{Ol.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const o=[];for(let e=0;e<n.length;e++){const a=n[e],s=t.element._zod.run({value:a,issues:[]},i);s instanceof Promise?o.push(s.then(t=>hc(t,r,e))):hc(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function mc(e,t,r,i){e.issues.length&&t.issues.push(...ws(r,e.issues)),void 0===e.value?r in i&&(t.value[r]=void 0):t.value[r]=e.value}function gc(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=(i=e.shape,Object.keys(i).filter(e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function vc(e,t,r,i,n,o){const a=[],s=n.keySet,l=n.catchall._zod,c=l.def.type;for(const d of Object.keys(t)){if(s.has(d))continue;if("never"===c){a.push(d);continue}const n=l.run({value:t[d],issues:[]},i);n instanceof Promise?e.push(n.then(e=>mc(e,r,d,t))):mc(n,r,d,t)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}const fc=Ja("$ZodObject",(e,t)=>{Ol.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const i=ts(()=>gc(t));os(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const i=e[t]._zod;if(i.values){r[t]??(r[t]=new Set);for(const e of i.values)r[t].add(e)}}return r});const n=ds,o=t.catchall;let a;e._zod.parse=(t,r)=>{a??(a=i.value);const s=t.value;if(!n(s))return t.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),t;t.value={};const l=[],c=a.shape;for(const e of a.keys){const i=c[e]._zod.run({value:s[e],issues:[]},r);i instanceof Promise?l.push(i.then(r=>mc(r,t,e,s))):mc(i,t,e,s)}return o?vc(l,s,t,r,i.value,e):l.length?Promise.all(l).then(()=>t):t}}),kc=Ja("$ZodObjectJIT",(e,t)=>{fc.init(e,t);const r=e._zod.parse,i=ts(()=>gc(t));let n;const o=ds,a=!Qa.jitless,s=a&&us.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=i.value);const h=d.value;return o(h)?a&&s&&!1===u?.async&&!0!==u.jitless?(n||(n=(e=>{const t=new Al(["shape","payload","ctx"]),r=i.value,n=e=>{const t=ls(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let a=0;for(const i of r.keys)o[i]="key_"+a++;t.write("const newResult = {};");for(const i of r.keys){const e=o[i],r=ls(i);t.write(`const ${e} = ${n(i)};`),t.write(`\n if (${e}.issues.length) {\n payload.issues = payload.issues.concat(${e}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${r}, ...iss.path] : [${r}]\n })));\n }\n \n \n if (${e}.value === undefined) {\n if (${r} in input) {\n newResult[${r}] = undefined;\n }\n } else {\n newResult[${r}] = ${e}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const s=t.compile();return(t,r)=>s(e,t,r)})(t.shape)),d=n(d,u),l?vc([],h,d,u,c,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d)}});function bc(e,t,r,i){for(const o of e)if(0===o.issues.length)return t.value=o.value,t;const n=e.filter(e=>!bs(e));return 1===n.length?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>xs(e,i,Xa())))}),t)}const wc=Ja("$ZodUnion",(e,t)=>{Ol.init(e,t),os(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),os(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),os(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),os(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>is(e.source)).join("|")})$`)}});const r=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(n,o)=>{if(r)return i(n,o);let a=!1;const s=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)s.push(t),a=!0;else{if(0===t.issues.length)return t;s.push(t)}}return a?Promise.all(s).then(t=>bc(t,n,e,o)):bc(s,n,e,o)}}),yc=Ja("$ZodDiscriminatedUnion",(e,t)=>{wc.init(e,t);const r=e._zod.parse;os(e._zod,"propValues",()=>{const e={};for(const r of t.options){const i=r._zod.propValues;if(!i||0===Object.keys(i).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[t,r]of Object.entries(i)){e[t]||(e[t]=new Set);for(const i of r)e[t].add(i)}}return e});const i=ts(()=>{const e=t.options,r=new Map;for(const i of e){const e=i._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const t of e){if(r.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,i)}}return r});e._zod.parse=(n,o)=>{const a=n.value;if(!ds(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;const s=i.value.get(a?.[t.discriminator]);return s?s._zod.run(n,o):t.unionFallback?r(n,o):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),n)}}),xc=Ja("$ZodIntersection",(e,t)=>{Ol.init(e,t),e._zod.parse=(e,r)=>{const i=e.value,n=t.left._zod.run({value:i,issues:[]},r),o=t.right._zod.run({value:i,issues:[]},r);return n instanceof Promise||o instanceof Promise?Promise.all([n,o]).then(([t,r])=>Sc(e,t,r)):Sc(e,n,o)}});function Cc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(hs(e)&&hs(t)){const r=Object.keys(t),i=Object.keys(e).filter(e=>-1!==r.indexOf(e)),n={...e,...t};for(const o of i){const r=Cc(e[o],t[o]);if(!r.valid)return{valid:!1,mergeErrorPath:[o,...r.mergeErrorPath]};n[o]=r.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i<e.length;i++){const n=Cc(e[i],t[i]);if(!n.valid)return{valid:!1,mergeErrorPath:[i,...n.mergeErrorPath]};r.push(n.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Sc(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),bs(e))return e;const i=Cc(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Tc=Ja("$ZodRecord",(e,t)=>{Ol.init(e,t),e._zod.parse=(r,i)=>{const n=r.value;if(!hs(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;const o=[];if(t.keyType._zod.values){const a=t.keyType._zod.values;r.value={};for(const e of a)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const a=t.valueType._zod.run({value:n[e],issues:[]},i);a instanceof Promise?o.push(a.then(t=>{t.issues.length&&r.issues.push(...ws(e,t.issues)),r.value[e]=t.value})):(a.issues.length&&r.issues.push(...ws(e,a.issues)),r.value[e]=a.value)}let s;for(const e in n)a.has(e)||(s=s??[],s.push(e));s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:s})}else{r.value={};for(const a of Reflect.ownKeys(n)){if("__proto__"===a)continue;const s=t.keyType._zod.run({value:a,issues:[]},i);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(e=>xs(e,i,Xa())),input:a,path:[a],inst:e}),r.value[s.value]=s.value;continue}const l=t.valueType._zod.run({value:n[a],issues:[]},i);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&r.issues.push(...ws(a,e.issues)),r.value[s.value]=e.value})):(l.issues.length&&r.issues.push(...ws(a,l.issues)),r.value[s.value]=l.value)}}return o.length?Promise.all(o).then(()=>r):r}}),Ec=Ja("$ZodEnum",(e,t)=>{Ol.init(e,t);const r=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(e=>ms.has(typeof e)).map(e=>"string"==typeof e?gs(e):e.toString()).join("|")})$`),e._zod.parse=(t,n)=>{const o=t.value;return i.has(o)||t.issues.push({code:"invalid_value",values:r,input:o,inst:e}),t}}),_c=Ja("$ZodLiteral",(e,t)=>{if(Ol.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?gs(e):e?gs(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const n=r.value;return e._zod.values.has(n)||r.issues.push({code:"invalid_value",values:t.values,input:n,inst:e}),r}}),Ic=Ja("$ZodTransform",(e,t)=>{Ol.init(e,t),e._zod.parse=(r,i)=>{if("backward"===i.direction)throw new Ya(e.constructor.name);const n=t.transform(r.value,r);if(i.async)return(n instanceof Promise?n:Promise.resolve(n)).then(e=>(r.value=e,r));if(n instanceof Promise)throw new Ka;return r.value=n,r}});function Pc(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Mc=Ja("$ZodOptional",(e,t)=>{Ol.init(e,t),e._zod.optin="optional",e._zod.optout="optional",os(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),os(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${is(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(t=>Pc(t,e.value)):Pc(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Ac=Ja("$ZodNullable",(e,t)=>{Ol.init(e,t),os(e._zod,"optin",()=>t.innerType._zod.optin),os(e._zod,"optout",()=>t.innerType._zod.optout),os(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${is(e.source)}|null)$`):void 0}),os(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Rc=Ja("$ZodDefault",(e,t)=>{Ol.init(e,t),e._zod.optin="optional",os(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(e=>Oc(e,t)):Oc(i,t)}});function Oc(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Dc=Ja("$ZodPrefault",(e,t)=>{Ol.init(e,t),e._zod.optin="optional",os(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Lc=Ja("$ZodNonOptional",(e,t)=>{Ol.init(e,t),os(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,i)=>{const n=t.innerType._zod.run(r,i);return n instanceof Promise?n.then(t=>Nc(t,e)):Nc(n,e)}});function Nc(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const zc=Ja("$ZodCatch",(e,t)=>{Ol.init(e,t),os(e._zod,"optin",()=>t.innerType._zod.optin),os(e._zod,"optout",()=>t.innerType._zod.optout),os(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>xs(e,r,Xa()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>xs(e,r,Xa()))},input:e.value}),e.issues=[]),e)}}),jc=Ja("$ZodPipe",(e,t)=>{Ol.init(e,t),os(e._zod,"values",()=>t.in._zod.values),os(e._zod,"optin",()=>t.in._zod.optin),os(e._zod,"optout",()=>t.out._zod.optout),os(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const i=t.out._zod.run(e,r);return i instanceof Promise?i.then(e=>Uc(e,t.in,r)):Uc(i,t.in,r)}const i=t.in._zod.run(e,r);return i instanceof Promise?i.then(e=>Uc(e,t.out,r)):Uc(i,t.out,r)}});function Uc(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const Fc=Ja("$ZodReadonly",(e,t)=>{Ol.init(e,t),os(e._zod,"propValues",()=>t.innerType._zod.propValues),os(e._zod,"values",()=>t.innerType._zod.values),os(e._zod,"optin",()=>t.innerType._zod.optin),os(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const i=t.innerType._zod.run(e,r);return i instanceof Promise?i.then(Bc):Bc(i)}});function Bc(e){return e.value=Object.freeze(e.value),e}const Vc=Ja("$ZodCustom",(e,t)=>{ml.init(e,t),Ol.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const i=r.value,n=t.fn(i);if(n instanceof Promise)return n.then(t=>qc(t,r,i,e));qc(n,r,i,e)}});function qc(e,t,r,i){if(!e){const e={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(Ss(e))}}class $c{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const i={...r,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Hc(){return new $c}const Wc=Hc();function Gc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...fs(t)})}function Zc(e,t){return new vl({check:"less_than",...fs(t),value:e,inclusive:!1})}function Jc(e,t){return new vl({check:"less_than",...fs(t),value:e,inclusive:!0})}function Kc(e,t){return new fl({check:"greater_than",...fs(t),value:e,inclusive:!1})}function Yc(e,t){return new fl({check:"greater_than",...fs(t),value:e,inclusive:!0})}function Qc(e,t){return new kl({check:"multiple_of",...fs(t),value:e})}function Xc(e,t){return new wl({check:"max_length",...fs(t),maximum:e})}function ed(e,t){return new yl({check:"min_length",...fs(t),minimum:e})}function td(e,t){return new xl({check:"length_equals",...fs(t),length:e})}function rd(e){return new Ml({check:"overwrite",tx:e})}const id=Ja("ZodISODateTime",(e,t)=>{Gl.init(e,t),Sd.init(e,t)});const nd=Ja("ZodISODate",(e,t)=>{Zl.init(e,t),Sd.init(e,t)});const od=Ja("ZodISOTime",(e,t)=>{Jl.init(e,t),Sd.init(e,t)});const ad=Ja("ZodISODuration",(e,t)=>{Kl.init(e,t),Sd.init(e,t)});const sd=Ja("ZodError",(e,t)=>{Es.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t){const r=t||function(e){return e.message},i={_errors:[]},n=e=>{for(const t of e.issues)if("invalid_union"===t.code&&t.errors.length)t.errors.map(e=>n({issues:e}));else if("invalid_key"===t.code)n({issues:t.issues});else if("invalid_element"===t.code)n({issues:t.issues});else if(0===t.path.length)i._errors.push(r(t));else{let e=i,n=0;for(;n<t.path.length;){const i=t.path[n];n===t.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(r(t))):e[i]=e[i]||{_errors:[]},e=e[i],n++}}};return n(e),i}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},i=[];for(const n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):i.push(t(n));return{formErrors:i,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,es,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,es,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),ld=Is(sd),cd=Ps(sd),dd=Ms(sd),ud=Rs(sd),hd=Ds(sd),pd=Ls(sd),md=Ns(sd),gd=zs(sd),vd=js(sd),fd=Us(sd),kd=Fs(sd),bd=Bs(sd),wd=Ja("ZodType",(e,t)=>(Ol.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(ss(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,r)=>vs(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>ld(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>dd(e,t,r),e.parseAsync=async(t,r)=>cd(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ud(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>hd(e,t,r),e.decode=(t,r)=>pd(e,t,r),e.encodeAsync=async(t,r)=>md(e,t,r),e.decodeAsync=async(t,r)=>gd(e,t,r),e.safeEncode=(t,r)=>vd(e,t,r),e.safeDecode=(t,r)=>fd(e,t,r),e.safeEncodeAsync=async(t,r)=>kd(e,t,r),e.safeDecodeAsync=async(t,r)=>bd(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...fs(r)})}(Iu,e,t)}(t,r)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new ml({check:"custom",...fs(void 0)});return t._zod.check=e,t}(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(Ss(e,r.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(Ss(i))}},e(r.value,r)));return t}(t)),e.overwrite=t=>e.check(rd(t)),e.optional=()=>ku(e),e.nullable=()=>wu(e),e.nullish=()=>ku(wu(e)),e.nonoptional=t=>function(e,t){return new Cu({type:"nonoptional",innerType:e,...fs(t)})}(e,t),e.array=()=>iu(e),e.or=t=>su([e,t]),e.and=t=>new cu({type:"intersection",left:e,right:t}),e.transform=t=>Eu(e,new vu({type:"transform",transform:t})),e.default=t=>{return r=t,new yu({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():ps(r)}});var r},e.prefault=t=>{return r=t,new xu({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():ps(r)}});var r},e.catch=t=>{return new Su({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Eu(e,t),e.readonly=()=>new _u({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Wc.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Wc.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Wc.get(e);const r=e.clone();return Wc.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),yd=Ja("_ZodString",(e,t)=>{Dl.init(e,t),wd.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Sl({check:"string_format",format:"regex",...fs(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new _l({check:"string_format",format:"includes",...fs(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Il({check:"string_format",format:"starts_with",...fs(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Pl({check:"string_format",format:"ends_with",...fs(t),suffix:e})}(...t)),e.min=(...t)=>e.check(ed(...t)),e.max=(...t)=>e.check(Xc(...t)),e.length=(...t)=>e.check(td(...t)),e.nonempty=(...t)=>e.check(ed(1,...t)),e.lowercase=t=>e.check(function(e){return new Tl({check:"string_format",format:"lowercase",...fs(e)})}(t)),e.uppercase=t=>e.check(function(e){return new El({check:"string_format",format:"uppercase",...fs(e)})}(t)),e.trim=()=>e.check(rd(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return rd(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(rd(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(rd(e=>e.toUpperCase()))}),xd=Ja("ZodString",(e,t)=>{Dl.init(e,t),yd.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...fs(t)})}(Td,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...fs(t)})}(Id,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...fs(t)})}(qd,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...fs(t)})}(Pd,t)),e.guid=t=>e.check(Gc(Ed,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...fs(t)})}(_d,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...fs(t)})}(_d,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...fs(t)})}(_d,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...fs(t)})}(_d,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...fs(t)})}(Md,t)),e.guid=t=>e.check(Gc(Ed,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...fs(t)})}(Ad,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...fs(t)})}(Rd,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...fs(t)})}(Od,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...fs(t)})}(Fd,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...fs(t)})}(Bd,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...fs(t)})}(Dd,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...fs(t)})}(Ld,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...fs(t)})}(Nd,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...fs(t)})}(zd,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...fs(t)})}(jd,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...fs(t)})}(Ud,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...fs(t)})}(Vd,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...fs(t)})}(id,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...fs(t)})}(nd,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...fs(t)})}(od,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...fs(t)})}(ad,e)}(t))});function Cd(e){return function(e,t){return new e({type:"string",...fs(t)})}(xd,e)}const Sd=Ja("ZodStringFormat",(e,t)=>{Ll.init(e,t),yd.init(e,t)}),Td=Ja("ZodEmail",(e,t)=>{jl.init(e,t),Sd.init(e,t)}),Ed=Ja("ZodGUID",(e,t)=>{Nl.init(e,t),Sd.init(e,t)}),_d=Ja("ZodUUID",(e,t)=>{zl.init(e,t),Sd.init(e,t)}),Id=Ja("ZodURL",(e,t)=>{Ul.init(e,t),Sd.init(e,t)}),Pd=Ja("ZodEmoji",(e,t)=>{Fl.init(e,t),Sd.init(e,t)}),Md=Ja("ZodNanoID",(e,t)=>{Bl.init(e,t),Sd.init(e,t)}),Ad=Ja("ZodCUID",(e,t)=>{Vl.init(e,t),Sd.init(e,t)}),Rd=Ja("ZodCUID2",(e,t)=>{ql.init(e,t),Sd.init(e,t)}),Od=Ja("ZodULID",(e,t)=>{$l.init(e,t),Sd.init(e,t)}),Dd=Ja("ZodXID",(e,t)=>{Hl.init(e,t),Sd.init(e,t)}),Ld=Ja("ZodKSUID",(e,t)=>{Wl.init(e,t),Sd.init(e,t)}),Nd=Ja("ZodIPv4",(e,t)=>{Yl.init(e,t),Sd.init(e,t)}),zd=Ja("ZodIPv6",(e,t)=>{Ql.init(e,t),Sd.init(e,t)}),jd=Ja("ZodCIDRv4",(e,t)=>{Xl.init(e,t),Sd.init(e,t)}),Ud=Ja("ZodCIDRv6",(e,t)=>{ec.init(e,t),Sd.init(e,t)}),Fd=Ja("ZodBase64",(e,t)=>{rc.init(e,t),Sd.init(e,t)}),Bd=Ja("ZodBase64URL",(e,t)=>{ic.init(e,t),Sd.init(e,t)}),Vd=Ja("ZodE164",(e,t)=>{nc.init(e,t),Sd.init(e,t)}),qd=Ja("ZodJWT",(e,t)=>{oc.init(e,t),Sd.init(e,t)}),$d=Ja("ZodNumber",(e,t)=>{ac.init(e,t),wd.init(e,t),e.gt=(t,r)=>e.check(Kc(t,r)),e.gte=(t,r)=>e.check(Yc(t,r)),e.min=(t,r)=>e.check(Yc(t,r)),e.lt=(t,r)=>e.check(Zc(t,r)),e.lte=(t,r)=>e.check(Jc(t,r)),e.max=(t,r)=>e.check(Jc(t,r)),e.int=t=>e.check(Gd(t)),e.safe=t=>e.check(Gd(t)),e.positive=t=>e.check(Kc(0,t)),e.nonnegative=t=>e.check(Yc(0,t)),e.negative=t=>e.check(Zc(0,t)),e.nonpositive=t=>e.check(Jc(0,t)),e.multipleOf=(t,r)=>e.check(Qc(t,r)),e.step=(t,r)=>e.check(Qc(t,r)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Hd(e){return function(e,t){return new e({type:"number",checks:[],...fs(t)})}($d,e)}const Wd=Ja("ZodNumberFormat",(e,t)=>{sc.init(e,t),$d.init(e,t)});function Gd(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...fs(t)})}(Wd,e)}const Zd=Ja("ZodBoolean",(e,t)=>{lc.init(e,t),wd.init(e,t)});function Jd(e){return function(e,t){return new e({type:"boolean",...fs(t)})}(Zd,e)}const Kd=Ja("ZodAny",(e,t)=>{cc.init(e,t),wd.init(e,t)});function Yd(){return new Kd({type:"any"})}const Qd=Ja("ZodUnknown",(e,t)=>{dc.init(e,t),wd.init(e,t)});function Xd(){return new Qd({type:"unknown"})}const eu=Ja("ZodNever",(e,t)=>{uc.init(e,t),wd.init(e,t)});function tu(e){return function(e,t){return new e({type:"never",...fs(t)})}(eu,e)}const ru=Ja("ZodArray",(e,t)=>{pc.init(e,t),wd.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(ed(t,r)),e.nonempty=t=>e.check(ed(1,t)),e.max=(t,r)=>e.check(Xc(t,r)),e.length=(t,r)=>e.check(td(t,r)),e.unwrap=()=>e.element});function iu(e,t){return function(e,t,r){return new e({type:"array",element:t,...fs(r)})}(ru,e,t)}const nu=Ja("ZodObject",(e,t)=>{kc.init(e,t),wd.init(e,t),os(e,"shape",()=>t.shape),e.keyof=()=>pu(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Xd()}),e.loose=()=>e.clone({...e._zod.def,catchall:Xd()}),e.strict=()=>e.clone({...e._zod.def,catchall:tu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!hs(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=ss(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return as(this,"shape",r),r},checks:[]});return vs(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!hs(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return as(this,"shape",r),r},checks:e._zod.def.checks};return vs(e,r)}(e,t),e.merge=t=>function(e,t){const r=ss(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return as(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return vs(e,r)}(e,t),e.pick=t=>function(e,t){const r=e._zod.def;return vs(e,ss(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in r.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=r.shape[i])}return as(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,i=ss(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return as(this,"shape",i),i},checks:[]});return vs(e,i)}(e,t),e.partial=(...t)=>function(e,t,r){const i=ss(t._zod.def,{get shape(){const i=t._zod.def.shape,n={...i};if(r)for(const t in r){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(n[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)n[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return as(this,"shape",n),n},checks:[]});return vs(t,i)}(fu,e,t[0]),e.required=(...t)=>function(e,t,r){const i=ss(t._zod.def,{get shape(){const i=t._zod.def.shape,n={...i};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(n[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)n[t]=new e({type:"nonoptional",innerType:i[t]});return as(this,"shape",n),n},checks:[]});return vs(t,i)}(Cu,e,t[0])});function ou(e,t){const r={type:"object",shape:e??{},...fs(t)};return new nu(r)}const au=Ja("ZodUnion",(e,t)=>{wc.init(e,t),wd.init(e,t),e.options=t.options});function su(e,t){return new au({type:"union",options:e,...fs(t)})}const lu=Ja("ZodDiscriminatedUnion",(e,t)=>{au.init(e,t),yc.init(e,t)}),cu=Ja("ZodIntersection",(e,t)=>{xc.init(e,t),wd.init(e,t)}),du=Ja("ZodRecord",(e,t)=>{Tc.init(e,t),wd.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function uu(e,t,r){return new du({type:"record",keyType:e,valueType:t,...fs(r)})}const hu=Ja("ZodEnum",(e,t)=>{Ec.init(e,t),wd.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const n={};for(const o of e){if(!r.has(o))throw new Error(`Key ${o} not found in enum`);n[o]=t.entries[o]}return new hu({...t,checks:[],...fs(i),entries:n})},e.exclude=(e,i)=>{const n={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete n[t]}return new hu({...t,checks:[],...fs(i),entries:n})}});function pu(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new hu({type:"enum",entries:r,...fs(t)})}const mu=Ja("ZodLiteral",(e,t)=>{_c.init(e,t),wd.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function gu(e,t){return new mu({type:"literal",values:Array.isArray(e)?e:[e],...fs(t)})}const vu=Ja("ZodTransform",(e,t)=>{Ic.init(e,t),wd.init(e,t),e._zod.parse=(r,i)=>{if("backward"===i.direction)throw new Ya(e.constructor.name);r.addIssue=i=>{if("string"==typeof i)r.issues.push(Ss(i,r.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(Ss(t))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(e=>(r.value=e,r)):(r.value=n,r)}}),fu=Ja("ZodOptional",(e,t)=>{Mc.init(e,t),wd.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ku(e){return new fu({type:"optional",innerType:e})}const bu=Ja("ZodNullable",(e,t)=>{Ac.init(e,t),wd.init(e,t),e.unwrap=()=>e._zod.def.innerType});function wu(e){return new bu({type:"nullable",innerType:e})}const yu=Ja("ZodDefault",(e,t)=>{Rc.init(e,t),wd.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),xu=Ja("ZodPrefault",(e,t)=>{Dc.init(e,t),wd.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Cu=Ja("ZodNonOptional",(e,t)=>{Lc.init(e,t),wd.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Su=Ja("ZodCatch",(e,t)=>{zc.init(e,t),wd.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),Tu=Ja("ZodPipe",(e,t)=>{jc.init(e,t),wd.init(e,t),e.in=t.in,e.out=t.out});function Eu(e,t){return new Tu({type:"pipe",in:e,out:t})}const _u=Ja("ZodReadonly",(e,t)=>{Fc.init(e,t),wd.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Iu=Ja("ZodCustom",(e,t)=>{Vc.init(e,t),wd.init(e,t)}),Pu=pu(["image","video","audio"]),Mu=pu(["avatar","cover","voice","general"]),Au=pu(["processing","active","failed","deleted"]),Ru=pu(["jpg","jpeg","png","gif","webp","svg"]),Ou=pu(["mp4","webm","ogg","mov","avi"]),Du=pu(["mp3","wav","ogg","aac","flac"]),Lu=ou({mediaId:Cd(),userId:Cd(),orgId:Cd(),selfId:Cd().nullable().optional(),filename:Cd(),mimeType:Cd(),size:Hd(),src:Cd(),alt:Cd().optional(),context:Mu.default("general"),status:Au.default("processing"),createdAt:Cd().optional(),updatedAt:Cd().optional()}).extend({format:Pu.optional(),className:Cd().optional(),width:Hd().optional(),height:Hd().optional(),duration:Hd().optional(),blurhash:Cd().optional()}).partial(),Nu=ou({duration:Hd().optional(),thumbnail:Cd().optional(),autoplay:Jd().optional(),loop:Jd().optional(),muted:Jd().optional(),controls:Jd().optional()}),zu=ou({duration:Hd().optional(),autoplay:Jd().optional(),loop:Jd().optional(),muted:Jd().optional(),controls:Jd().optional()});new lu({type:"union",options:[Lu.extend({format:gu("image"),imageFormat:Ru}),Lu.extend({format:gu("video"),videoFormat:Ou,video:Nu.optional()}),Lu.extend({format:gu("audio"),audioFormat:Du,audio:zu.optional()})],discriminator:"format",...fs(undefined)});const ju=pu(["xxs","xs","sm","md","lg","xl"]),Uu=pu(["primary","default","overlay","red","green","indigo","orange"]),Fu=pu(["ghost","link","outline","solid"]),Bu=ou({key:Cd().optional(),label:Cd().optional(),href:Cd().optional(),size:ju.optional(),theme:Uu.optional(),design:Fu.optional(),icon:su([Cd(),Lu]).optional(),iconAfter:su([Cd(),Lu]).optional(),rounding:pu(["full","md","lg"]).optional(),loading:Jd().optional(),disabled:Jd().optional(),onClick:Yd().optional(),testId:Cd().optional(),target:pu(["_blank","_self"]).optional(),type:pu(["button","submit","reset"]).optional()});ou({buttons:iu(Bu).optional(),size:ju.optional(),theme:Uu.optional(),design:Fu.optional()});const Vu=ou({key:Cd().optional(),id:Cd().optional(),label:Cd().optional(),srLabel:Cd().optional(),subLabel:Cd().optional(),value:su([Cd(),Hd()]).optional(),description:Cd().optional(),info:Cd().optional(),count:Hd().optional(),className:Cd().optional(),media:Lu.optional(),icon:Lu.optional(),iconAfter:Lu.optional(),href:Cd().optional(),target:pu(["_self","_blank"]).optional(),onClick:Yd().optional(),theme:pu(["primary","default"]).optional(),isActive:Jd().optional(),isDisabled:Jd().optional(),isHidden:Jd().optional(),priority:Hd().optional(),testId:Cd().optional(),items:iu(Yd()).optional()});ou({title:Cd().optional(),description:Cd().optional(),items:iu(Vu).optional()});const qu=ou({selfId:Cd().optional(),handle:Cd().optional(),ownerId:Cd().optional(),orgId:Cd().optional(),name:Cd().optional(),title:Cd().nullable().optional(),summary:Cd().nullable().optional(),entityType:Cd().optional(),avatarId:Cd().nullable().optional(),coverId:Cd().nullable().optional(),avatar:Lu.optional(),cover:Lu.optional(),voiceRecordings:iu(Lu).optional(),email:Cd().nullable().optional(),website:Cd().url().nullable().optional(),accounts:uu(Cd(),ou({handle:Cd().optional(),url:Cd().optional()})).nullable().optional(),basePrompt:Cd().nullable().optional(),firstMessage:Cd().nullable().optional(),personalityPrompt:Cd().nullable().optional(),useCustomPrompts:Jd().nullable().optional(),elevenlabsVoiceId:Cd().nullable().optional(),elevenlabsAgentId:Cd().nullable().optional(),headline:Cd().nullable().optional(),industry:Cd().nullable().optional(),location:Cd().nullable().optional(),influences:iu(Cd()).nullable().optional(),interests:iu(Cd()).nullable().optional(),personalDetails:Cd().nullable().optional(),cloutScore:Hd().nullable().optional(),gender:Cd().nullable().optional(),birthdayAt:Cd().nullable().optional(),businessTemplate:Cd().nullable().optional(),enrichment:uu(Cd(),Yd()).nullable().optional(),onboarding:uu(Cd(),Yd()).nullable().optional(),org:ou({orgId:Cd(),handle:Cd(),name:Cd(),headline:Cd().optional(),summary:Cd().optional(),status:Cd()}).optional(),visibility:pu(["private","org","public"]).optional(),status:Cd().optional(),createdAt:Cd().optional(),updatedAt:Cd().optional()});qu.extend({avatar:Lu.optional(),cover:Lu.optional(),voiceRecordings:iu(Lu).optional(),isPrimary:Jd().optional()});const $u=ou({userId:Cd(),email:Cd().optional(),handle:Cd().optional(),fullName:Cd().optional(),emailVerified:Jd().optional(),hashedPassword:Cd().optional(),primarySelfId:Cd().optional(),onboarding:Yd().optional(),recentSelfIds:iu(Cd()).optional(),status:Cd().optional(),lastSeenAt:Cd().optional(),createdAt:Cd().optional(),updatedAt:Cd().optional(),onboarded:Jd().optional()});ou({name:Cd().min(1).max(100).optional(),primarySelfId:Cd().optional(),onboarding:Yd().optional()}).partial(),ou({email:Cd()}),ou({email:Cd(),password:Cd().min(8,"Password must be at least 8 characters")}),ou({email:Cd(),password:Cd().min(8,"Password must be at least 8 characters"),fullName:Cd().min(1,"Name is required")}),ou({email:Cd(),code:Cd().min(6,"Verification code is required")}),ou({email:Cd(),code:Cd().min(6,"Verification code is required"),newPassword:Cd().min(8,"New password must be at least 8 characters")}),ou({newEmail:Cd()}),ou({newPassword:Cd().min(8,"New password must be at least 8 characters")}),ou({credential:Cd().optional(),code:Cd().optional(),createOnEmpty:Jd().optional()}).refine(e=>e.credential||e.code,{message:"Either credential or code must be provided"}),ou({orgId:Cd().optional(),handle:Cd().optional(),name:Cd().optional(),email:Cd().optional(),website:Cd().url().nullable().optional(),summary:Cd().optional(),avatarId:Cd().optional(),avatar:Lu.optional(),coverId:Cd().optional(),cover:Lu.optional(),accounts:uu(Cd(),ou({handle:Cd().optional(),url:Cd().optional()})).nullable().optional(),ownerId:Cd().optional(),billingStatus:Cd().optional(),isPersonal:Jd().optional(),stripeCustomerIdTest:Cd().optional(),stripeCustomerIdLive:Cd().optional(),subscriptionStatus:Cd().optional(),planId:Cd().optional(),maxSelves:Hd().optional(),maxUsers:Hd().optional(),onboarding:Yd().optional(),status:Cd().optional(),createdAt:Cd().optional(),updatedAt:Cd().optional()});const Hu=ou({membershipId:Cd(),orgId:Cd(),name:Cd(),handle:Cd(),avatarId:Cd().optional(),avatar:Lu.optional(),coverId:Cd().optional(),cover:Lu.optional(),role:pu(["owner","admin","member","observer"]),joinedAt:Cd()});function Wu(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(r){if("default"!==r&&!(r in e)){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})}),Object.freeze(e)}$u.extend({orgs:iu(Hu).optional(),memberships:iu(Hu).optional(),selves:iu(qu).optional()});var Gu=Object.defineProperty,Zu=(e,t,r)=>((e,t,r)=>t in e?Gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);let Ju=class{constructor(){Zu(this,"_locking"),Zu(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){let e;this._locks+=1;const t=new Promise(t=>e=()=>{this._locks-=1,t()}),r=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),r}};function Ku(e,t){if(!e)throw new Error(t)}function Yu(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function Qu(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function Xu(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}const eh=Symbol("@bufbuild/protobuf/enum-type");function th(e,t,r,i){e[eh]=rh(t,r.map(t=>({no:t.no,name:t.name,localName:e[t.no]})))}function rh(e,t,r){const i=Object.create(null),n=Object.create(null),o=[];for(const a of t){const e=ih(a);o.push(e),i[a.name]=e,n[a.no]=e}return{typeName:e,values:o,findName:e=>i[e],findNumber:e=>n[e]}}function ih(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class nh{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const r=this.getType().runtime.bin,i=r.makeReadOptions(t);return r.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,t){const r=this.getType(),i=r.runtime.json,n=i.makeReadOptions(t);return i.readMessage(r,e,n,this),this}fromJsonString(e,t){let r;try{r=JSON.parse(e)}catch(VT){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(VT instanceof Error?VT.message:String(VT)))}return this.fromJson(r,t)}toBinary(e){const t=this.getType().runtime.bin,r=t.makeWriteOptions(e),i=r.writerFactory();return t.writeMessage(this,i,r),i.finish()}toJson(e){const t=this.getType().runtime.json,r=t.makeWriteOptions(e);return t.writeMessage(this,r)}toJsonString(e){var t;const r=this.toJson(e);return JSON.stringify(r,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function oh(){let e=0,t=0;for(let i=0;i<28;i+=7){let r=this.buf[this.pos++];if(e|=(127&r)<<i,!(128&r))return this.assertBounds(),[e,t]}let r=this.buf[this.pos++];if(e|=(15&r)<<28,t=(112&r)>>4,!(128&r))return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let r=this.buf[this.pos++];if(t|=(127&r)<<i,!(128&r))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function ah(e,t,r){for(let o=0;o<28;o+=7){const i=e>>>o,n=!(i>>>7==0&&0==t),a=255&(n?128|i:i);if(r.push(a),!n)return}const i=e>>>28&15|(7&t)<<4,n=!!(t>>3);if(r.push(255&(n?128|i:i)),n){for(let e=3;e<31;e+=7){const i=t>>>e,n=!(i>>>7==0),o=255&(n?128|i:i);if(r.push(o),!n)return}r.push(t>>>31&1)}}const sh=4294967296;function lh(e){const t="-"===e[0];t&&(e=e.slice(1));const r=1e6;let i=0,n=0;function o(t,o){const a=Number(e.slice(t,o));n*=r,i=i*r+a,i>=sh&&(n+=i/sh|0,i%=sh)}return o(-24,-18),o(-18,-12),o(-12,-6),o(-6),t?uh(i,n):dh(i,n)}function ch(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(sh*t+e);const r=16777215&(e>>>24|t<<8),i=t>>16&65535;let n=(16777215&e)+6777216*r+6710656*i,o=r+8147497*i,a=2*i;const s=1e7;return n>=s&&(o+=Math.floor(n/s),n%=s),o>=s&&(a+=Math.floor(o/s),o%=s),a.toString()+hh(o)+hh(n)}function dh(e,t){return{lo:0|e,hi:0|t}}function uh(e,t){return t=~t,e?e=1+~e:t+=1,dh(e,t)}const hh=e=>{const t=String(e);return"0000000".slice(t.length)+t};function ph(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let r=0;r<9;r++)t.push(127&e|128),e>>=7;t.push(1)}}function mh(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let r=5;128&e&&r<10;r++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const gh=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),r=BigInt("9223372036854775807"),i=BigInt("0"),n=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const i="bigint"==typeof e?e:BigInt(e);if(i>r||i<t)throw new Error("int64 invalid: ".concat(e));return i},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>n||t<i)throw new Error("uint64 invalid: ".concat(e));return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,r)=>(e.setInt32(0,t,!0),e.setInt32(4,r,!0),e.getBigInt64(0,!0)),uDec:(t,r)=>(e.setInt32(0,t,!0),e.setInt32(4,r,!0),e.getBigUint64(0,!0))}}const t=e=>Ku(/^-?[0-9]+$/.test(e),"int64 invalid: ".concat(e)),r=e=>Ku(/^[0-9]+$/.test(e),"uint64 invalid: ".concat(e));return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),r(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),lh(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),r(e),lh(e)),dec:(e,t)=>function(e,t){let r=dh(e,t);const i=2147483648&r.hi;i&&(r=uh(r.lo,r.hi));const n=ch(r.lo,r.hi);return i?"-"+n:n}(e,t),uDec:(e,t)=>ch(e,t)}}();var vh,fh,kh,bh,wh,yh;function xh(e,t,r){if(t===r)return!0;if(e==vh.BYTES){if(!(t instanceof Uint8Array&&r instanceof Uint8Array))return!1;if(t.length!==r.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==r[e])return!1;return!0}switch(e){case vh.UINT64:case vh.FIXED64:case vh.INT64:case vh.SFIXED64:case vh.SINT64:return t==r}return!1}function Ch(e,t){switch(e){case vh.BOOL:return!1;case vh.UINT64:case vh.FIXED64:case vh.INT64:case vh.SFIXED64:case vh.SINT64:return 0==t?gh.zero:"0";case vh.DOUBLE:case vh.FLOAT:return 0;case vh.BYTES:return new Uint8Array(0);case vh.STRING:return"";default:return 0}}function Sh(e,t){switch(e){case vh.BOOL:return!1===t;case vh.STRING:return""===t;case vh.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(fh=vh||(vh={}))[fh.DOUBLE=1]="DOUBLE",fh[fh.FLOAT=2]="FLOAT",fh[fh.INT64=3]="INT64",fh[fh.UINT64=4]="UINT64",fh[fh.INT32=5]="INT32",fh[fh.FIXED64=6]="FIXED64",fh[fh.FIXED32=7]="FIXED32",fh[fh.BOOL=8]="BOOL",fh[fh.STRING=9]="STRING",fh[fh.BYTES=12]="BYTES",fh[fh.UINT32=13]="UINT32",fh[fh.SFIXED32=15]="SFIXED32",fh[fh.SFIXED64=16]="SFIXED64",fh[fh.SINT32=17]="SINT32",fh[fh.SINT64=18]="SINT64",(bh=kh||(kh={}))[bh.BIGINT=0]="BIGINT",bh[bh.STRING=1]="STRING",(yh=wh||(wh={}))[yh.Varint=0]="Varint",yh[yh.Bit64=1]="Bit64",yh[yh.LengthDelimited=2]="LengthDelimited",yh[yh.StartGroup=3]="StartGroup",yh[yh.EndGroup=4]="EndGroup",yh[yh.Bit32=5]="Bit32";class Th{constructor(e){this.stack=[],this.textEncoder=null!=e?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 t=new Uint8Array(e),r=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],r),r+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Qu(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Yu(e),ph(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 t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Xu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Qu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Yu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Yu(e),ph(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=gh.enc(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),r=new DataView(t.buffer),i=gh.uEnc(e);return r.setInt32(0,i.lo,!0),r.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=gh.enc(e);return ah(t.lo,t.hi,this.buf),this}sint64(e){let t=gh.enc(e),r=t.hi>>31;return ah(t.lo<<1^r,(t.hi<<1|t.lo>>>31)^r,this.buf),this}uint64(e){let t=gh.uEnc(e);return ah(t.lo,t.hi,this.buf),this}}class Eh{constructor(e,t){this.varint64=oh,this.uint32=mh,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,r=7&e;if(t<=0||r<0||r>5)throw new Error("illegal tag: field no "+t+" wire type "+r);return[t,r]}skip(e,t){let r=this.pos;switch(e){case wh.Varint:for(;128&this.buf[this.pos++];);break;case wh.Bit64:this.pos+=4;case wh.Bit32:this.pos+=4;break;case wh.LengthDelimited:let r=this.uint32();this.pos+=r;break;case wh.StartGroup:for(;;){const[e,r]=this.tag();if(r===wh.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(r,e)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(r,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return gh.dec(...this.varint64())}uint64(){return gh.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),r=-(1&e);return e=(e>>>1|(1&t)<<31)^r,t=t>>>1^r,gh.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return gh.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return gh.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(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function _h(e){const t=e.field.localName,r=Object.create(null);return r[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return Ch(t.T,t.L);case"message":const e=t.T,r=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(r):r;case"map":throw"map fields are not allowed to be extensions"}}(e),[r,()=>r[t]]}let Ih="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ph=[];for(let qT=0;qT<Ih.length;qT++)Ph[Ih[qT].charCodeAt(0)]=qT;Ph["-".charCodeAt(0)]=Ih.indexOf("+"),Ph["_".charCodeAt(0)]=Ih.indexOf("/");const Mh={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let r,i=new Uint8Array(t),n=0,o=0,a=0;for(let s=0;s<e.length;s++){if(r=Ph[e.charCodeAt(s)],void 0===r)switch(e[s]){case"=":o=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(o){case 0:a=r,o=1;break;case 1:i[n++]=a<<2|(48&r)>>4,a=r,o=2;break;case 2:i[n++]=(15&a)<<4|(60&r)>>2,a=r,o=3;break;case 3:i[n++]=(3&a)<<6|r,o=0}}if(1==o)throw Error("invalid base64 string.");return i.subarray(0,n)},enc(e){let t,r="",i=0,n=0;for(let o=0;o<e.length;o++)switch(t=e[o],i){case 0:r+=Ih[t>>2],n=(3&t)<<4,i=1;break;case 1:r+=Ih[n|t>>4],n=(15&t)<<2,i=2;break;case 2:r+=Ih[n|t>>6],r+=Ih[63&t],i=0}return i&&(r+=Ih[n],r+="=",1==i&&(r+="=")),r}};function Ah(e,t,r){Dh(t,e);const i=t.runtime.bin.makeReadOptions(r),n=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let r=e.length-1;r>=0;--r)if(e[r].no==t.no)return[e[r]];return[]}return e.filter(e=>e.no===t.no)}(e.getType().runtime.bin.listUnknownFields(e),t.field),[o,a]=_h(t);for(const s of n)t.runtime.bin.readField(o,i.readerFactory(s.data),t.field,s.wireType,i);return a()}function Rh(e,t,r,i){Dh(t,e);const n=t.runtime.bin.makeReadOptions(i),o=t.runtime.bin.makeWriteOptions(i);if(Oh(e,t)){const r=e.getType().runtime.bin.listUnknownFields(e).filter(e=>e.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(const t of r)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const a=o.writerFactory();let s=t.field;s.opt||s.repeated||"enum"!=s.kind&&"scalar"!=s.kind||(s=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(s,r,a,o);const l=n.readerFactory(a.finish());for(;l.pos<l.len;){const[t,r]=l.tag(),i=l.skip(r,t);e.getType().runtime.bin.onUnknownField(e,t,r,i)}}function Oh(e,t){const r=e.getType();return t.extendee.typeName===r.typeName&&!!r.runtime.bin.listUnknownFields(e).find(e=>e.no==t.field.no)}function Dh(e,t){Ku(e.extendee.typeName==t.getType().typeName,"extension ".concat(e.typeName," can only be applied to message ").concat(e.extendee.typeName))}function Lh(e,t){const r=e.localName;if(e.repeated)return t[r].length>0;if(e.oneof)return t[e.oneof.localName].case===r;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[r]:"enum"==e.kind?t[r]!==e.T.values[0].no:!Sh(e.T,t[r]);case"message":return void 0!==t[r];case"map":return Object.keys(t[r]).length>0}}function Nh(e,t){const r=e.localName,i=!e.opt&&!e.req;if(e.repeated)t[r]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[r]={};break;case"enum":t[r]=i?e.T.values[0].no:void 0;break;case"scalar":t[r]=i?Ch(e.T,e.L):void 0;break;case"message":t[r]=void 0}}function zh(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(nh.prototype).every(t=>t in e&&"function"==typeof e[t]))return!1;const r=e.getType();return null!==r&&"function"==typeof r&&"typeName"in r&&"string"==typeof r.typeName&&(void 0===t||r.typeName==t.typeName)}function jh(e,t){return zh(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}vh.DOUBLE,vh.FLOAT,vh.INT64,vh.UINT64,vh.INT32,vh.UINT32,vh.BOOL,vh.STRING,vh.BYTES;const Uh={ignoreUnknownFields:!1},Fh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};const Bh=Symbol(),Vh=Symbol();function qh(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":'"'.concat(e.split('"').join('\\"'),'"');default:return String(e)}}function $h(e,t,r,i,n){let o=r.localName;if(r.repeated){if(Ku("map"!=r.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(n.typeName,".").concat(r.name," from JSON: ").concat(qh(t)));const a=e[o];for(const e of t){if(null===e)throw new Error("cannot decode field ".concat(n.typeName,".").concat(r.name," from JSON: ").concat(qh(e)));switch(r.kind){case"message":a.push(r.T.fromJson(e,i));break;case"enum":const t=Gh(r.T,e,i.ignoreUnknownFields,!0);t!==Vh&&a.push(t);break;case"scalar":try{a.push(Wh(r.T,e,r.L,!0))}catch(VT){let i="cannot decode field ".concat(n.typeName,".").concat(r.name," from JSON: ").concat(qh(e));throw VT instanceof Error&&VT.message.length>0&&(i+=": ".concat(VT.message)),new Error(i)}}}}else if("map"==r.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(n.typeName,".").concat(r.name," from JSON: ").concat(qh(t)));const a=e[o];for(const[e,o]of Object.entries(t)){if(null===o)throw new Error("cannot decode field ".concat(n.typeName,".").concat(r.name," from JSON: map value null"));let s;try{s=Hh(r.K,e)}catch(VT){let i="cannot decode map key for field ".concat(n.typeName,".").concat(r.name," from JSON: ").concat(qh(t));throw VT instanceof Error&&VT.message.length>0&&(i+=": ".concat(VT.message)),new Error(i)}switch(r.V.kind){case"message":a[s]=r.V.T.fromJson(o,i);break;case"enum":const e=Gh(r.V.T,o,i.ignoreUnknownFields,!0);e!==Vh&&(a[s]=e);break;case"scalar":try{a[s]=Wh(r.V.T,o,kh.BIGINT,!0)}catch(VT){let i="cannot decode map value for field ".concat(n.typeName,".").concat(r.name," from JSON: ").concat(qh(t));throw VT instanceof Error&&VT.message.length>0&&(i+=": ".concat(VT.message)),new Error(i)}}}}else switch(r.oneof&&(e=e[r.oneof.localName]={case:o},o="value"),r.kind){case"message":const a=r.T;if(null===t&&"google.protobuf.Value"!=a.typeName)return;let s=e[o];zh(s)?s.fromJson(t,i):(e[o]=s=a.fromJson(t,i),a.fieldWrapper&&!r.oneof&&(e[o]=a.fieldWrapper.unwrapField(s)));break;case"enum":const l=Gh(r.T,t,i.ignoreUnknownFields,!1);switch(l){case Bh:Nh(r,e);break;case Vh:break;default:e[o]=l}break;case"scalar":try{const i=Wh(r.T,t,r.L,!1);i===Bh?Nh(r,e):e[o]=i}catch(VT){let i="cannot decode field ".concat(n.typeName,".").concat(r.name," from JSON: ").concat(qh(t));throw VT instanceof Error&&VT.message.length>0&&(i+=": ".concat(VT.message)),new Error(i)}}}function Hh(e,t){if(e===vh.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return Wh(e,t,kh.BIGINT,!0).toString()}function Wh(e,t,r,i){if(null===t)return i?Ch(e,r):Bh;switch(e){case vh.DOUBLE:case vh.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const i=Number(t);if(Number.isNaN(i))break;if(!Number.isFinite(i))break;return e==vh.FLOAT&&Xu(i),i;case vh.INT32:case vh.FIXED32:case vh.SFIXED32:case vh.SINT32:case vh.UINT32:let n;if("number"==typeof t?n=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(n=Number(t)),void 0===n)break;return e==vh.UINT32||e==vh.FIXED32?Qu(n):Yu(n),n;case vh.INT64:case vh.SFIXED64:case vh.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const o=gh.parse(t);return r?o.toString():o;case vh.FIXED64:case vh.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const a=gh.uParse(t);return r?a.toString():a;case vh.BOOL:if("boolean"!=typeof t)break;return t;case vh.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(VT){throw new Error("invalid UTF8")}return t;case vh.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return Mh.dec(t)}throw new Error}function Gh(e,t,r,i){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:i?e.values[0].no:Bh;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const i=e.findName(t);if(void 0!==i)return i.no;if(r)return Vh}throw new Error("cannot decode enum ".concat(e.typeName," from JSON: ").concat(qh(t)))}function Zh(e){return!(!e.repeated&&"map"!=e.kind&&(e.oneof||"message"==e.kind||e.opt||e.req))}function Jh(e,t,r){if("map"==e.kind){Ku("object"==typeof t&&null!=t);const i={},n=Object.entries(t);switch(e.V.kind){case"scalar":for(const[r,o]of n)i[r.toString()]=Yh(e.V.T,o);break;case"message":for(const[e,o]of n)i[e.toString()]=o.toJson(r);break;case"enum":const t=e.V.T;for(const[e,o]of n)i[e.toString()]=Kh(t,o,r.enumAsInteger)}return r.emitDefaultValues||n.length>0?i:void 0}if(e.repeated){Ku(Array.isArray(t));const i=[];switch(e.kind){case"scalar":for(let r=0;r<t.length;r++)i.push(Yh(e.T,t[r]));break;case"enum":for(let n=0;n<t.length;n++)i.push(Kh(e.T,t[n],r.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)i.push(t[e].toJson(r))}return r.emitDefaultValues||i.length>0?i:void 0}switch(e.kind){case"scalar":return Yh(e.T,t);case"enum":return Kh(e.T,t,r.enumAsInteger);case"message":return jh(e.T,t).toJson(r)}}function Kh(e,t,r){var i;if(Ku("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(r)return t;const n=e.findNumber(t);return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:t}function Yh(e,t){switch(e){case vh.INT32:case vh.SFIXED32:case vh.SINT32:case vh.FIXED32:case vh.UINT32:return Ku("number"==typeof t),t;case vh.FLOAT:case vh.DOUBLE:return Ku("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case vh.STRING:return Ku("string"==typeof t),t;case vh.BOOL:return Ku("boolean"==typeof t),t;case vh.UINT64:case vh.FIXED64:case vh.INT64:case vh.SFIXED64:case vh.SINT64:return Ku("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case vh.BYTES:return Ku(t instanceof Uint8Array),Mh.enc(t)}}const Qh=Symbol("@bufbuild/protobuf/unknown-fields"),Xh={readUnknownFields:!0,readerFactory:e=>new Eh(e)},ep={writeUnknownFields:!0,writerFactory:()=>new Th};function tp(e,t,r,i,n){let{repeated:o,localName:a}=r;switch(r.oneof&&((e=e[r.oneof.localName]).case!=a&&delete e.value,e.case=a,a="value"),r.kind){case"scalar":case"enum":const s="enum"==r.kind?vh.INT32:r.T;let l=np;if("scalar"==r.kind&&r.L>0&&(l=ip),o){let r=e[a];if(i==wh.LengthDelimited&&s!=vh.STRING&&s!=vh.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)r.push(l(t,s))}else r.push(l(t,s))}else e[a]=l(t,s);break;case"message":const c=r.T;o?e[a].push(rp(t,new c,n,r)):zh(e[a])?rp(t,e[a],n,r):(e[a]=rp(t,new c,n,r),!c.fieldWrapper||r.oneof||r.repeated||(e[a]=c.fieldWrapper.unwrapField(e[a])));break;case"map":let[d,u]=function(e,t,r){const i=t.uint32(),n=t.pos+i;let o,a;for(;t.pos<n;){const[i]=t.tag();switch(i){case 1:o=np(t,e.K);break;case 2:switch(e.V.kind){case"scalar":a=np(t,e.V.T);break;case"enum":a=t.int32();break;case"message":a=rp(t,new e.V.T,r,void 0)}}}if(void 0===o&&(o=Ch(e.K,kh.BIGINT)),"string"!=typeof o&&"number"!=typeof o&&(o=o.toString()),void 0===a)switch(e.V.kind){case"scalar":a=Ch(e.V.T,kh.BIGINT);break;case"enum":a=e.V.T.values[0].no;break;case"message":a=new e.V.T}return[o,a]}(r,t,n);e[a][d]=u}}function rp(e,t,r,i){const n=t.getType().runtime.bin,o=null==i?void 0:i.delimited;return n.readMessage(t,e,o?i.no:e.uint32(),r,o),t}function ip(e,t){const r=np(e,t);return"bigint"==typeof r?r.toString():r}function np(e,t){switch(t){case vh.STRING:return e.string();case vh.BOOL:return e.bool();case vh.DOUBLE:return e.double();case vh.FLOAT:return e.float();case vh.INT32:return e.int32();case vh.INT64:return e.int64();case vh.UINT64:return e.uint64();case vh.FIXED64:return e.fixed64();case vh.BYTES:return e.bytes();case vh.FIXED32:return e.fixed32();case vh.SFIXED32:return e.sfixed32();case vh.SFIXED64:return e.sfixed64();case vh.SINT64:return e.sint64();case vh.UINT32:return e.uint32();case vh.SINT32:return e.sint32()}}function op(e,t,r,i){Ku(void 0!==t);const n=e.repeated;switch(e.kind){case"scalar":case"enum":let o="enum"==e.kind?vh.INT32:e.T;if(n)if(Ku(Array.isArray(t)),e.packed)!function(e,t,r,i){if(!i.length)return;e.tag(r,wh.LengthDelimited).fork();let[,n]=cp(t);for(let o=0;o<i.length;o++)e[n](i[o]);e.join()}(r,o,e.no,t);else for(const i of t)lp(r,o,e.no,i);else lp(r,o,e.no,t);break;case"message":if(n){Ku(Array.isArray(t));for(const n of t)sp(r,i,e,n)}else sp(r,i,e,t);break;case"map":Ku("object"==typeof t&&null!=t);for(const[n,a]of Object.entries(t))ap(r,i,e,n,a)}}function ap(e,t,r,i,n){e.tag(r.no,wh.LengthDelimited),e.fork();let o=i;switch(r.K){case vh.INT32:case vh.FIXED32:case vh.UINT32:case vh.SFIXED32:case vh.SINT32:o=Number.parseInt(i);break;case vh.BOOL:Ku("true"==i||"false"==i),o="true"==i}switch(lp(e,r.K,1,o),r.V.kind){case"scalar":lp(e,r.V.T,2,n);break;case"enum":lp(e,vh.INT32,2,n);break;case"message":Ku(void 0!==n),e.tag(2,wh.LengthDelimited).bytes(n.toBinary(t))}e.join()}function sp(e,t,r,i){const n=jh(r.T,i);r.delimited?e.tag(r.no,wh.StartGroup).raw(n.toBinary(t)).tag(r.no,wh.EndGroup):e.tag(r.no,wh.LengthDelimited).bytes(n.toBinary(t))}function lp(e,t,r,i){Ku(void 0!==i);let[n,o]=cp(t);e.tag(r,n)[o](i)}function cp(e){let t=wh.Varint;switch(e){case vh.BYTES:case vh.STRING:t=wh.LengthDelimited;break;case vh.DOUBLE:case vh.FIXED64:case vh.SFIXED64:t=wh.Bit64;break;case vh.FIXED32:case vh.SFIXED32:case vh.FLOAT:t=wh.Bit32}return[t,vh[e].toLowerCase()]}function dp(e){if(void 0===e)return e;if(zh(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function up(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class hp{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}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,t)=>e.no-t.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const r of this.list())r.oneof?r.oneof!==t&&(t=r.oneof,e.push(t)):e.push(r)}return this.members}}function pp(e,t){const r=gp(e);return t?r:wp(bp(r))}const mp=gp;function gp(e){let t=!1;const r=[];for(let i=0;i<e.length;i++){let n=e.charAt(i);switch(n){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r.push(n),t=!1;break;default:t&&(t=!1,n=n.toUpperCase()),r.push(n)}}return r.join("")}const vp=new Set(["constructor","toString","toJSON","valueOf"]),fp=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),kp=e=>"".concat(e,"$"),bp=e=>fp.has(e)?kp(e):e,wp=e=>vp.has(e)?kp(e):e;class yp{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=pp(e,!1)}addField(e){Ku(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 e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const xp=(Cp=e=>new hp(e,e=>function(e){var t,r,i,n,o,a;const s=[];let l;for(const c of"function"==typeof e?e():e){const e=c;if(e.localName=pp(c.name,void 0!==c.oneof),e.jsonName=null!==(t=c.jsonName)&&void 0!==t?t:mp(c.name),e.repeated=null!==(r=c.repeated)&&void 0!==r&&r,"scalar"==c.kind&&(e.L=null!==(i=c.L)&&void 0!==i?i:kh.BIGINT),e.delimited=null!==(n=c.delimited)&&void 0!==n&&n,e.req=null!==(o=c.req)&&void 0!==o&&o,e.opt=null!==(a=c.opt)&&void 0!==a&&a,void 0===c.packed&&(e.packed="enum"==c.kind||"scalar"==c.kind&&c.T!=vh.BYTES&&c.T!=vh.STRING),void 0!==c.oneof){const t="string"==typeof c.oneof?c.oneof:c.oneof.name;l&&l.name==t||(l=new yp(t)),e.oneof=l,l.addField(e)}s.push(e)}return s}(e)),Sp=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const r=t.localName,i=e;if(t.repeated)i[r]=[];else switch(t.kind){case"oneof":i[r]={case:void 0};break;case"enum":i[r]=0;break;case"map":i[r]={};break;case"scalar":i[r]=Ch(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:function(e){return e?Object.assign(Object.assign({},Uh),e):Uh},makeWriteOptions:function(e){return e?Object.assign(Object.assign({},Fh),e):Fh},readMessage(e,t,r,i){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(e.typeName," from JSON: ").concat(qh(t)));i=null!=i?i:new e;const n=new Map,o=r.typeRegistry;for(const[a,s]of Object.entries(t)){const t=e.fields.findJsonName(a);if(t){if(t.oneof){if(null===s&&"scalar"==t.kind)continue;const r=n.get(t.oneof);if(void 0!==r)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(r,'", "').concat(a,'"'));n.set(t.oneof,a)}$h(i,s,t,r,e)}else{let t=!1;if((null==o?void 0:o.findExtension)&&a.startsWith("[")&&a.endsWith("]")){const n=o.findExtension(a.substring(1,a.length-1));if(n&&n.extendee.typeName==e.typeName){t=!0;const[e,o]=_h(n);$h(e,s,n.field,r,n),Rh(i,n,o(),r)}}if(!t&&!r.ignoreUnknownFields)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: key "').concat(a,'" is unknown'))}}return i},writeMessage(e,t){const r=e.getType(),i={};let n;try{for(n of r.fields.byNumber()){if(!Lh(n,e)){if(n.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!Zh(n))continue}const r=Jh(n,n.oneof?e[n.oneof.localName].value:e[n.localName],t);void 0!==r&&(i[t.useProtoFieldName?n.name:n.jsonName]=r)}const o=t.typeRegistry;if(null==o?void 0:o.findExtensionFor)for(const n of r.runtime.bin.listUnknownFields(e)){const a=o.findExtensionFor(r.typeName,n.no);if(a&&Oh(e,a)){const r=Ah(e,a,t),n=Jh(a.field,r,t);void 0!==n&&(i[a.field.jsonName]=n)}}}catch(VT){const t=n?"cannot encode field ".concat(r.typeName,".").concat(n.name," to JSON"):"cannot encode message ".concat(r.typeName," to JSON"),i=VT instanceof Error?VT.message:String(VT);throw new Error(t+(i.length>0?": ".concat(i):""))}return i},readScalar:(e,t,r)=>Wh(e,t,null!=r?r:kh.BIGINT,!0),writeScalar(e,t,r){if(void 0!==t)return r||Sh(e,t)?Yh(e,t):void 0},debug:qh},bin:{makeReadOptions:function(e){return e?Object.assign(Object.assign({},Xh),e):Xh},makeWriteOptions:function(e){return e?Object.assign(Object.assign({},ep),e):ep},listUnknownFields(e){var t;return null!==(t=e[Qh])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[Qh]},writeUnknownFields(e,t){const r=e[Qh];if(r)for(const i of r)t.tag(i.no,i.wireType).raw(i.data)},onUnknownField(e,t,r,i){const n=e;Array.isArray(n[Qh])||(n[Qh]=[]),n[Qh].push({no:t,wireType:r,data:i})},readMessage(e,t,r,i,n){const o=e.getType(),a=n?t.len:t.pos+r;let s,l;for(;t.pos<a&&([s,l]=t.tag(),!0!==n||l!=wh.EndGroup);){const r=o.fields.find(s);if(!r){const r=t.skip(l,s);i.readUnknownFields&&this.onUnknownField(e,s,l,r);continue}tp(e,t,r,l,i)}if(n&&(l!=wh.EndGroup||s!==r))throw new Error("invalid end group tag")},readField:tp,writeMessage(e,t,r){const i=e.getType();for(const n of i.fields.byNumber())if(Lh(n,e))op(n,n.oneof?e[n.oneof.localName].value:e[n.localName],t,r);else if(n.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(n.name," to binary: required field not set"));return r.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,r,i){void 0!==t&&op(e,t,r,i)}},util:Object.assign(Object.assign({},{setEnumType:th,initPartial(e,t){if(void 0===e)return;const r=t.getType();for(const i of r.fields.byMember()){const r=i.localName,n=t,o=e;if(null!=o[r])switch(i.kind){case"oneof":const e=o[r].case;if(void 0===e)continue;const t=i.findField(e);let a=o[r].value;t&&"message"==t.kind&&!zh(a,t.T)?a=new t.T(a):t&&"scalar"===t.kind&&t.T===vh.BYTES&&(a=up(a)),n[r]={case:e,value:a};break;case"scalar":case"enum":let s=o[r];i.T===vh.BYTES&&(s=i.repeated?s.map(up):up(s)),n[r]=s;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===vh.BYTES)for(const[t,i]of Object.entries(o[r]))n[r][t]=up(i);else Object.assign(n[r],o[r]);break;case"message":const e=i.V.T;for(const t of Object.keys(o[r])){let i=o[r][t];e.fieldWrapper||(i=new e(i)),n[r][t]=i}}break;case"message":const l=i.T;if(i.repeated)n[r]=o[r].map(e=>zh(e,l)?e:new l(e));else{const e=o[r];l.fieldWrapper?"google.protobuf.BytesValue"===l.typeName?n[r]=up(e):n[r]=e:n[r]=zh(e,l)?e:new l(e)}}}},equals:(e,t,r)=>t===r||!(!t||!r)&&e.fields.byMember().every(e=>{const i=t[e.localName],n=r[e.localName];if(e.repeated){if(i.length!==n.length)return!1;switch(e.kind){case"message":return i.every((t,r)=>e.T.equals(t,n[r]));case"scalar":return i.every((t,r)=>xh(e.T,t,n[r]));case"enum":return i.every((e,t)=>xh(vh.INT32,e,n[t]))}throw new Error("repeated cannot contain ".concat(e.kind))}switch(e.kind){case"message":let t=i,r=n;return e.T.fieldWrapper&&(void 0===t||zh(t)||(t=e.T.fieldWrapper.wrapField(t)),void 0===r||zh(r)||(r=e.T.fieldWrapper.wrapField(r))),e.T.equals(t,r);case"enum":return xh(vh.INT32,i,n);case"scalar":return xh(e.T,i,n);case"oneof":if(i.case!==n.case)return!1;const o=e.findField(i.case);if(void 0===o)return!0;switch(o.kind){case"message":return o.T.equals(i.value,n.value);case"enum":return xh(vh.INT32,i.value,n.value);case"scalar":return xh(o.T,i.value,n.value)}throw new Error("oneof cannot contain ".concat(o.kind));case"map":const a=Object.keys(i).concat(Object.keys(n));switch(e.V.kind){case"message":const t=e.V.T;return a.every(e=>t.equals(i[e],n[e]));case"enum":return a.every(e=>xh(vh.INT32,i[e],n[e]));case"scalar":const r=e.V.T;return a.every(e=>xh(r,i[e],n[e]))}}}),clone(e){const t=e.getType(),r=new t,i=r;for(const n of t.fields.byMember()){const t=e[n.localName];let r;if(n.repeated)r=t.map(dp);else if("map"==n.kind){r=i[n.localName];for(const[e,i]of Object.entries(t))r[e]=dp(i)}else r="oneof"==n.kind?n.findField(t.case)?{case:t.case,value:dp(t.value)}:{case:void 0}:dp(t);i[n.localName]=r}for(const n of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(i,n.no,n.wireType,n.data);return r}}),{newFieldList:Cp,initFields:Sp}),makeMessageType(e,t,r){return function(e,t,r,i){var n;const o=null!==(n=null==i?void 0:i.localName)&&void 0!==n?n:t.substring(t.lastIndexOf(".")+1),a={[o]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[o];return Object.setPrototypeOf(a.prototype,new nh),Object.assign(a,{runtime:e,typeName:t,fields:e.util.newFieldList(r),fromBinary:(e,t)=>(new a).fromBinary(e,t),fromJson:(e,t)=>(new a).fromJson(e,t),fromJsonString:(e,t)=>(new a).fromJsonString(e,t),equals:(t,r)=>e.util.equals(a,t,r)}),a}(this,e,t,r)},makeEnum:function(e,t,r){const i={};for(const n of t){const e=ih(n);i[e.localName]=e.no,i[e.no]=e.localName}return th(i,e,t),i},makeEnumType:rh,getEnumType:function(e){const t=e[eh];return Ku(t,"missing enum type on enum object"),t},makeExtension(e,t,r){return function(e,t,r,i){let n;return{typeName:t,extendee:r,get field(){if(!n){const r="function"==typeof i?i():i;r.name=t.split(".").pop(),r.jsonName="[".concat(t,"]"),n=e.util.newFieldList([r]).list()[0]}return n},runtime:e}}(this,e,t,r)}});var Cp,Sp;class Tp extends nh{constructor(e){super(),this.seconds=gh.zero,this.nanos=0,xp.util.initPartial(e,this)}fromJson(e,t){if("string"!=typeof e)throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(xp.json.debug(e)));const r=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(!r)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const i=Date.parse(r[1]+"-"+r[2]+"-"+r[3]+"T"+r[4]+":"+r[5]+":"+r[6]+(r[8]?r[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=gh.parse(i/1e3),this.nanos=0,r[7]&&(this.nanos=parseInt("1"+r[7]+"0".repeat(9-r[7].length))-1e9),this}toJson(e){const t=1e3*Number(this.seconds);if(t<Date.parse("0001-01-01T00:00:00Z")||t>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 r="Z";if(this.nanos>0){const e=(this.nanos+1e9).toString().substring(1);r="000000"===e.substring(3)?"."+e.substring(0,3)+"Z":"000"===e.substring(6)?"."+e.substring(0,6)+"Z":"."+e+"Z"}return new Date(t).toISOString().replace(".000Z",r)}toDate(){return new Date(1e3*Number(this.seconds)+Math.ceil(this.nanos/1e6))}static now(){return Tp.fromDate(new Date)}static fromDate(e){const t=e.getTime();return new Tp({seconds:gh.parse(Math.floor(t/1e3)),nanos:t%1e3*1e6})}static fromBinary(e,t){return(new Tp).fromBinary(e,t)}static fromJson(e,t){return(new Tp).fromJson(e,t)}static fromJsonString(e,t){return(new Tp).fromJsonString(e,t)}static equals(e,t){return xp.util.equals(Tp,e,t)}}Tp.runtime=xp,Tp.typeName="google.protobuf.Timestamp",Tp.fields=xp.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Ep=xp.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Tp},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:_p,repeated:!0},{no:5,name:"events",kind:"message",T:Pp,repeated:!0}]),_p=xp.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:Ip,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Ip=xp.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:Tp},{no:3,name:"value",kind:"scalar",T:2}]),Pp=xp.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:Tp},{no:7,name:"normalized_end_timestamp",kind:"message",T:Tp,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),Mp=xp.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Ap=xp.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Rp=xp.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"}]),Op=xp.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Dp=xp.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),Lp=xp.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Np=xp.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"},{no:15,name:"MEDIA_FAILURE"}]),zp=xp.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"}]),jp=xp.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),Up=xp.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"}]),Fp=xp.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:Bp,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:ym}]),Bp=xp.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),Vp=xp.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:xp.getEnumType(Rp),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}]),qp=xp.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:xp.getEnumType($p)},{no:4,name:"tracks",kind:"message",T:Jp,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:Vp},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:xp.getEnumType(Hp)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:xp.getEnumType(Np)},{no:18,name:"kind_details",kind:"enum",T:xp.getEnumType(Wp),repeated:!0}]),$p=xp.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Hp=xp.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),Wp=xp.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),Gp=xp.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),Zp=xp.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:Kp,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:xp.getEnumType(Yp)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Jp=xp.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:xp.getEnumType(Ap)},{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:xp.getEnumType(Rp)},{no:10,name:"layers",kind:"message",T:Kp,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:Zp,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:xp.getEnumType(Gp)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:ym},{no:19,name:"audio_features",kind:"enum",T:xp.getEnumType(Up),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:xp.getEnumType(Mp)}]),Kp=xp.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:xp.getEnumType(Op)},{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},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9}]),Yp=xp.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),Qp=xp.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:xp.getEnumType(Xp)},{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:nm,oneof:"value"},{no:3,name:"speaker",kind:"message",T:rm,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:om,oneof:"value"},{no:7,name:"transcription",kind:"message",T:am,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Ep,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:lm,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:cm,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:dm,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:um,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:Tm,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Em,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:_m,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:em,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),Xp=xp.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),em=xp.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:xp.getEnumType(Gp)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}]),tm=xp.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:nm,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:lm,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:cm,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:dm,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:um,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:Tm,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:Em,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:_m,oneof:"value"}]),rm=xp.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:im,repeated:!0}]),im=xp.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}]),nm=xp.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}]),om=xp.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),am=xp.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:sm,repeated:!0}]),sm=xp.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}]),lm=xp.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}]),cm=xp.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}]),dm=xp.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),um=xp.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:hm,oneof:"value"}]),hm=xp.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}]),pm=xp.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),mm=xp.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:xp.getEnumType(gm)},{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}]),gm=xp.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),vm=xp.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:xp.getEnumType(fm)},{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}]),fm=xp.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"},{no:14,name:"ESP32"}]),km=xp.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:bm},{no:2,name:"screen",kind:"message",T:bm},{no:3,name:"resume_connection",kind:"enum",T:xp.getEnumType(Lp)},{no:4,name:"disabled_codecs",kind:"message",T:wm},{no:5,name:"force_relay",kind:"enum",T:xp.getEnumType(Lp)}]),bm=xp.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:xp.getEnumType(Lp)}]),wm=xp.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:Bp,repeated:!0},{no:2,name:"publish",kind:"message",T:Bp,repeated:!0}]),ym=xp.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),xm=xp.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),Cm=xp.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:xp.getEnumType(xm)},{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"}),Sm=xp.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),Tm=xp.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:xp.getEnumType(Gp)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:Cm,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:Sm,oneof:"content_header"}],{localName:"DataStream_Header"}),Em=xp.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"}),_m=xp.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"}),Im=xp.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),Pm=xp.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Mm=xp.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),Am=xp.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),Rm=xp.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:Vm,oneof:"message"},{no:2,name:"answer",kind:"message",T:Vm,oneof:"message"},{no:3,name:"trickle",kind:"message",T:Nm,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Lm,oneof:"message"},{no:5,name:"mute",kind:"message",T:zm,oneof:"message"},{no:6,name:"subscription",kind:"message",T:$m,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Hm,oneof:"message"},{no:8,name:"leave",kind:"message",T:Zm,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:Km,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:dg,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:pg,oneof:"message"},{no:13,name:"simulate",kind:"message",T:vg,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:Ym,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:fg,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:Wm,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:Gm,oneof:"message"}]),Om=xp.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:jm,oneof:"message"},{no:2,name:"answer",kind:"message",T:Vm,oneof:"message"},{no:3,name:"offer",kind:"message",T:Vm,oneof:"message"},{no:4,name:"trickle",kind:"message",T:Nm,oneof:"message"},{no:5,name:"update",kind:"message",T:qm,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Fm,oneof:"message"},{no:8,name:"leave",kind:"message",T:Zm,oneof:"message"},{no:9,name:"mute",kind:"message",T:zm,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:Xm,oneof:"message"},{no:11,name:"room_update",kind:"message",T:eg,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:rg,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:ng,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:sg,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:ug,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:Bm,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:Um,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:kg,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:yg,oneof:"message"},{no:22,name:"request_response",kind:"message",T:xg,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:Sg,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:hg,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:Tg,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:lg,oneof:"message"}]),Dm=xp.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Kp,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:xp.getEnumType(Yp)}]),Lm=xp.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:xp.getEnumType(Ap)},{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:xp.getEnumType(Rp)},{no:9,name:"layers",kind:"message",T:Kp,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Dm,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:xp.getEnumType(Gp)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:xp.getEnumType(Mp)},{no:17,name:"audio_features",kind:"enum",T:xp.getEnumType(Up),repeated:!0}]),Nm=xp.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:xp.getEnumType(Pm)},{no:3,name:"final",kind:"scalar",T:8}]),zm=xp.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),jm=xp.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:Fp},{no:2,name:"participant",kind:"message",T:qp},{no:3,name:"other_participants",kind:"message",T:qp,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:Qm,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:km},{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:mm},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:Bp,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),Um=xp.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:Qm,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:km},{no:3,name:"server_info",kind:"message",T:mm},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),Fm=xp.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Jp}]),Bm=xp.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Vm=xp.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13}]),qm=xp.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:qp,repeated:!0}]),$m=xp.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:pm,repeated:!0}]),Hm=xp.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:xp.getEnumType(Op)},{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}]),Wm=xp.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:xp.getEnumType(Up),repeated:!0}]),Gm=xp.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}]),Zm=xp.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:xp.getEnumType(Np)},{no:3,name:"action",kind:"enum",T:xp.getEnumType(Jm)},{no:4,name:"regions",kind:"message",T:bg}]),Jm=xp.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),Km=xp.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Kp,repeated:!0}]),Ym=xp.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}]),Qm=xp.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}]),Xm=xp.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:im,repeated:!0}]),eg=xp.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:Fp}]),tg=xp.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:xp.getEnumType(Dp)},{no:3,name:"score",kind:"scalar",T:2}]),rg=xp.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:tg,repeated:!0}]),ig=xp.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:xp.getEnumType(Mm)}]),ng=xp.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:ig,repeated:!0}]),og=xp.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:xp.getEnumType(Op)},{no:2,name:"enabled",kind:"scalar",T:8}]),ag=xp.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:og,repeated:!0}]),sg=xp.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:og,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:ag,repeated:!0}]),lg=xp.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:Im,repeated:!0}]),cg=xp.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}]),dg=xp.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:cg,repeated:!0}]),ug=xp.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}]),hg=xp.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:Fp},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:qp},{no:4,name:"other_participants",kind:"message",T:qp,repeated:!0}]),pg=xp.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:Vm},{no:2,name:"subscription",kind:"message",T:$m},{no:3,name:"publish_tracks",kind:"message",T:Fm,repeated:!0},{no:4,name:"data_channels",kind:"message",T:gg,repeated:!0},{no:5,name:"offer",kind:"message",T:Vm},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:mg,repeated:!0}]),mg=xp.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),gg=xp.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:xp.getEnumType(Pm)}]),vg=xp.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:xp.getEnumType(Am),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"}]),fg=xp.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),kg=xp.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),bg=xp.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:wg,repeated:!0}]),wg=xp.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}]),yg=xp.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:xp.getEnumType(jp)}]),xg=xp.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:xp.getEnumType(Cg)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:Nm,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Lm,oneof:"request"},{no:6,name:"mute",kind:"message",T:zm,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:Ym,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:Wm,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:Gm,oneof:"request"}]),Cg=xp.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"},{no:4,name:"QUEUED"},{no:5,name:"UNSUPPORTED_TYPE"},{no:6,name:"UNCLASSIFIED_ERROR"}]),Sg=xp.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Tg=xp.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function Eg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var _g,Ig,Pg,Mg,Ag,Rg,Og,Dg,Lg={exports:{}},Ng=(_g||(_g=1,Og=Lg.exports,Dg=function(){var e=function(){},t="undefined",r=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],n={},o=null;function a(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(VT){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function s(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments])),console.trace}function l(){for(var r=this.getLevel(),n=0;n<i.length;n++){var o=i[n];this[o]=n<r?e:this.methodFactory(o,r,this.name)}if(this.log=this.debug,typeof console===t&&r<this.levels.SILENT)return"No console available for logging"}function c(e){return function(){typeof console!==t&&(l.call(this),this[e].apply(this,arguments))}}function d(i,n,o){return function(i){return"debug"===i&&(i="log"),typeof console!==t&&("trace"===i&&r?s:void 0!==console[i]?a(console,i):void 0!==console.log?a(console,"log"):e)}(i)||c.apply(this,arguments)}function u(e,r){var a,s,c,u=this,h="loglevel";function p(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(o){}if(typeof e===t)try{var r=window.document.cookie,i=encodeURIComponent(h),n=r.indexOf(i+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n+i.length+1))[1])}catch(o){}return void 0===u.levels[e]&&(e=void 0),e}}function m(e){var t=e;if("string"==typeof t&&void 0!==u.levels[t.toUpperCase()]&&(t=u.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=u.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),u.name=e,u.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},u.methodFactory=r||d,u.getLevel=function(){return null!=c?c:null!=s?s:a},u.setLevel=function(e,r){return c=m(e),!1!==r&&function(e){var r=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=r)}catch(n){}try{window.document.cookie=encodeURIComponent(h)+"="+r+";"}catch(n){}}}(c),l.call(u)},u.setDefaultLevel=function(e){s=m(e),p()||u.setLevel(e,!1)},u.resetLevel=function(){c=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),l.call(u)},u.enableAll=function(e){u.setLevel(u.levels.TRACE,e)},u.disableAll=function(e){u.setLevel(u.levels.SILENT,e)},u.rebuild=function(){if(o!==u&&(a=m(o.getLevel())),l.call(u),o===u)for(var e in n)n[e].rebuild()},a=m(o?o.getLevel():"WARN");var g=p();null!=g&&(c=m(g)),l.call(u)}(o=new u).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=n[e];return t||(t=n[e]=new u(e,o.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return o.noConflict=function(){return typeof window!==t&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return n},o.default=o,o},(Rg=Lg).exports?Rg.exports=Dg():Og.log=Dg()),Lg.exports);(Pg=Ig||(Ig={}))[Pg.trace=0]="trace",Pg[Pg.debug=1]="debug",Pg[Pg.info=2]="info",Pg[Pg.warn=3]="warn",Pg[Pg.error=4]="error",Pg[Pg.silent=5]="silent",(Ag=Mg||(Mg={})).Default="livekit",Ag.Room="livekit-room",Ag.TokenSource="livekit-token-source",Ag.Participant="livekit-participant",Ag.Track="livekit-track",Ag.Publication="livekit-track-publication",Ag.Engine="livekit-engine",Ag.Signal="livekit-signal",Ag.PCManager="livekit-pc-manager",Ag.PCTransport="livekit-pc-transport",Ag.E2EE="lk-e2ee";let zg=Ng.getLogger("livekit");function jg(e){const t=Ng.getLogger(e);return t.setDefaultLevel(zg.getLevel()),t}Object.values(Mg).map(e=>Ng.getLogger(e)),zg.setDefaultLevel(Ig.info);const Ug=Ng.getLogger("lk-e2ee"),Fg=7e3,Bg=[0,300,1200,2700,4800,Fg,Fg,Fg,Fg,Fg];function Vg(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{l(i.next(e))}catch(VT){o(VT)}}function s(e){try{l(i.throw(e))}catch(VT){o(VT)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,s)}l((i=i.apply(e,t||[])).next())})}function qg(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){!function(e,t,r,i){Promise.resolve(i).then(function(t){e({value:t,done:r})},t)}(i,n,(t=e[r](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;var $g,Hg={exports:{}},Wg=function(){if($g)return Hg.exports;$g=1;var e,t="object"==typeof Reflect?Reflect:null,r=t&&"function"==typeof t.apply?t.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function n(){n.init.call(this)}Hg.exports=n,Hg.exports.once=function(e,t){return new Promise(function(r,i){function n(r){e.removeListener(t,o),i(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}m(e,t,o,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,n)})},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function l(e,t,r,i){var n,o,l;if(a(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),l=o[t]),void 0===l)l=o[t]=r,++e._eventsCount;else if("function"==typeof l?l=o[t]=i?[r,l]:[l,r]:i?l.unshift(r):l.push(r),(n=s(e))>0&&l.length>n&&!l.warned){l.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=l.length,console&&console.warn}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=c.bind(i);return n.listener=r,i.wrapFn=n,n}function u(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):p(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function m(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function n(o){i.once&&e.removeEventListener(t,n),r(o)})}}return Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),n.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return s(this)},n.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var n="error"===e,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=o[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var c=l.length,d=p(l,c);for(i=0;i<c;++i)r(d[i],this,t)}return!0},n.prototype.addListener=function(e,t){return l(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return l(this,e,t,!0)},n.prototype.once=function(e,t){return a(t),this.on(e,d(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,d(this,e,t)),this},n.prototype.removeListener=function(e,t){var r,i,n,o,s;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,s||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,o=Object.keys(r);for(i=0;i<o.length;++i)"removeListener"!==(n=o[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},n.prototype.listeners=function(e){return u(this,e,!0)},n.prototype.rawListeners=function(e){return u(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},n.prototype.listenerCount=h,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},Hg.exports}();let Gg=!0,Zg=!0;function Jg(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseFloat(i[r],10)}function Kg(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function Yg(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Gg=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Qg(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Zg=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Xg(){if("object"==typeof window){if(Gg)return;"undefined"!=typeof console&&console.log}}function ev(e,t){}function tv(e){return"[object Object]"===Object.prototype.toString.call(e)}function rv(e){return tv(e)?Object.keys(e).reduce(function(t,r){const i=tv(e[r]),n=i?rv(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})},{}):e}function iv(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach(i=>{i.endsWith("Id")?iv(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach(t=>{iv(e,e.get(t),r)})}))}function nv(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)}),o.forEach(t=>{e.forEach(r=>{r.type===i&&r.trackId===t.id&&iv(e,r,n)})}),n}const ov=Xg;function av(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach(e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then(r=>{let a=(r=r.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=i(e.video),ov("chrome: "+JSON.stringify(e)),n(e)})}e.video=i(e.video)}return ov("chrome: "+JSON.stringify(e)),n(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,e=>{r.webkitGetUserMedia(e,t,e=>{i&&i(o(e))})})}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(o(e))))}}}function sv(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function lv(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.track.id):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}),t.stream.getTracks().forEach(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.id):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Kg(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function cv(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function dv(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>nv(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Kg(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>nv(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach(r=>{r.track===e&&(t?i=!0:t=r)}),this.getReceivers().forEach(t=>(t.track===e&&(r?i=!0:r=t),t.track===e)),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function uv(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),n.apply(this,arguments)}}function hv(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return uv(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(e=>e===t))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(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const n=this._streams[r.id];if(n)n.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach(function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then(e=>o(this,e))}};e.RTCPeerConnection.prototype[t]=i[t]});const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(r=>{this._streams[r].getTracks().find(t=>e.track===t)&&(t=this._streams[r])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function pv(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]})}function mv(e,t){Kg(e,"negotiationneeded",e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e})}var gv=Object.freeze({__proto__:null,fixNegotiationNeeded:mv,shimAddTrackRemoveTrack:hv,shimAddTrackRemoveTrackWithNative:uv,shimGetSendersWithDtmf:cv,shimGetUserMedia:av,shimMediaStream:sv,shimOnTrack:lv,shimPeerConnection:pv,shimSenderReceiverGetStats:dv});function vv(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function fv(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function kv(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]});const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then(e=>{if(t.version<53&&!n)try{e.forEach(e=>{e.type=r[e.type]||e.type})}catch(VT){if("TypeError"!==VT.name)throw VT;e.forEach((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(n,o)}}function bv(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function wv(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Kg(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function yv(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function xv(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Cv(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach(e=>{if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(r).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return i})}function Sv(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Tv(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function Ev(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var _v=Object.freeze({__proto__:null,shimAddTransceiver:Cv,shimCreateAnswer:Ev,shimCreateOffer:Tv,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:Sv,shimGetUserMedia:vv,shimOnTrack:fv,shimPeerConnection:kv,shimRTCDataChannel:xv,shimReceiverGetStats:wv,shimRemoveStream:yv,shimSenderGetStats:bv});function Iv(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>t.call(this,r,e)),e.getVideoTracks().forEach(r=>t.call(this,r,e))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return i&&i.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach(e=>{r.includes(e.track)&&this.removeTrack(e)})})}}function Pv(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)})}),t.apply(e,arguments)}}}function Mv(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let s=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=s,s=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=s,s=function(e,t,r){const i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=s}function Av(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(Rv(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function Rv(e){return e&&void 0!==e.video?Object.assign({},e,{video:rv(e.video)}):e}function Ov(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];void 0===i.urls&&i.url?(ev(),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Dv(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Lv(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Nv(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var zv,jv=Object.freeze({__proto__:null,shimAudioContext:Nv,shimCallbacksAPI:Mv,shimConstraints:Rv,shimCreateOfferLegacy:Lv,shimGetUserMedia:Av,shimLocalStreamsAPI:Iv,shimRTCIceServerUrls:Ov,shimRemoteStreamsAPI:Pv,shimTrackEventTransceiver:Dv}),Uv={exports:{}},Fv=(zv||(zv=1,function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},t.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter(e=>0===e.indexOf(r))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:void 0===r[t[i]]&&(r[t[i]]=t[i+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let r;const i=e.substring(e.indexOf(" ")+1).split(";");for(let n=0;n<i.length;n++)r=i[n].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)}),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substring(t+1,i),r.value=e.substring(i+1)):r.attribute=e.substring(t+1),r},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),r},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){const i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substring(12),password:n.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" ");r.profile=i[2];for(let o=3;o<i.length;o++){const n=i[o],a=t.matchPrefix(e,"a=rtpmap:"+n+" ")[0];if(a){const i=t.parseRtpMap(a),o=t.matchPrefix(e,"a=fmtp:"+n+" ");switch(i.parameters=o.length?t.parseFmtp(o[0]):{},i.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+n+" ").map(t.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach(e=>{r.headerExtensions.push(t.parseExtmap(e))});const n=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach(e=>{n.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),r},t.writeRtpDescription=function(e,r){let i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach(e=>{i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)});let n=0;return r.codecs.forEach(e=>{e.maxptime>n&&(n=e.maxptime)}),n>0&&(i+="a=maxptime:"+n+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach(e=>{i+=t.writeExtmap(e)}),i},t.parseRtpEncodingParameters=function(e){const r=[],i=t.parseRtpParameters(e),n=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),a=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),s=a.length>0&&a[0].ssrc;let l;const c=t.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));c.length>0&&c[0].length>1&&c[0][0]===s&&(l=c[0][1]),i.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&l&&(t.rtx={ssrc:l}),r.push(t),n&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:s,mechanism:o?"red+ulpfec":"red"},r.push(t))}}),0===r.length&&s&&r.push({ssrc:s});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,r.forEach(e=>{e.maxBitrate=d})),r},t.parseRtcpParameters=function(e){const r={},i=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const i=t.matchPrefix(e,"a=msid:");if(1===i.length)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const n=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return n.length>0?(r=n[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");let n;i.length>0&&(n=parseInt(i[0].substring(19),10)),isNaN(n)&&(n=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:n};const a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){const e=a[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,r,i){let n;const o=void 0!==r?r:2;return n=e||t.generateSessionId(),"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const i=t.splitLines(e);for(let t=0;t<i.length;t++)switch(i[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[t].substring(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const r=t.splitLines(e);for(let t=0;t<r.length;t++)if(r[t].length<2||"="!==r[t].charAt(1))return!1;return!0},e.exports=t}(Uv)),Uv.exports),Bv=Eg(Fv),Vv=Wu({__proto__:null,default:Bv},[Fv]);function qv(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const r=new t(e),i=Bv.parseCandidate(e.candidate);for(const e in i)e in r||Object.defineProperty(r,e,{value:i[e]});return r.toJSON=function(){return{candidate:r.candidate,sdpMid:r.sdpMid,sdpMLineIndex:r.sdpMLineIndex,usernameFragment:r.usernameFragment}},r}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Kg(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function $v(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||Kg(e,"icecandidate",e=>{if(e.candidate){const t=Bv.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e})}function Hv(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=Bv.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=Bv.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),r=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r}(e),i=function(e,r){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=Bv.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substring(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i}(arguments[0],e);let n;n=0===r&&0===i?Number.POSITIVE_INFINITY:0===r||0===i?Math.max(r,i):Math.min(r,i);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>n}),this._sctp=o}return r.apply(this,arguments)}}function Wv(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},Kg(e,"datachannel",e=>(t(e.channel,e.target),e))}function Gv(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function Zv(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t._safariVersion>=13.1)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Jv(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Kv(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?r.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then(e=>r.apply(this,[e]))})}var Yv=Object.freeze({__proto__:null,removeExtmapAllowMixed:Zv,shimAddIceCandidateNullOrEmpty:Jv,shimConnectionState:Gv,shimMaxMessageSize:Hv,shimParameterlessSetLocalDescription:Kv,shimRTCIceCandidate:qv,shimRTCIceCandidateRelayProtocol:$v,shimSendThrowTypeError:Wv});!function(){let{window:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const r=Xg,i=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.userAgentData&&r.userAgentData.brands){const e=r.userAgentData.brands.find(e=>"Chromium"===e.brand);if(e)return{browser:"chrome",version:parseInt(e.version,10)}}if(r.mozGetUserMedia)t.browser="firefox",t.version=parseInt(Jg(r.userAgent,/Firefox\/(\d+)\./,1));else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=parseInt(Jg(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=parseInt(Jg(r.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype,t._safariVersion=Jg(r.userAgent,/Version\/(\d+(\.?\d+))/,1)}return t}(e),n={browserDetails:i,commonShim:Yv,extractVersion:Jg,disableLog:Yg,disableWarnings:Qg,sdp:Vv};switch(i.browser){case"chrome":if(!gv||!pv||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),n;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),n;r("adapter.js shimming chrome."),n.browserShim=gv,Jv(e,i),Kv(e),av(e,i),sv(e),pv(e,i),lv(e),hv(e,i),cv(e),dv(e),mv(e,i),qv(e),$v(e),Gv(e),Hv(e,i),Wv(e),Zv(e,i);break;case"firefox":if(!_v||!kv||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),n;r("adapter.js shimming firefox."),n.browserShim=_v,Jv(e,i),Kv(e),vv(e,i),kv(e,i),fv(e),yv(e),bv(e),wv(e),xv(e),Cv(e),Sv(e),Tv(e),Ev(e),qv(e),Gv(e),Hv(e,i),Wv(e);break;case"safari":if(!jv||!t.shimSafari)return r("Safari shim is not included in this adapter release."),n;r("adapter.js shimming safari."),n.browserShim=jv,Jv(e,i),Kv(e),Ov(e),Lv(e),Mv(e),Iv(e),Pv(e),Dv(e),Av(e),Nv(e),qv(e),$v(e),Hv(e,i),Wv(e),Zv(e,i);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const Qv="lk_e2ee";var Xv,ef,tf,rf,nf,of,af,sf,lf,cf,df,uf,hf,pf,mf,gf,vf,ff,kf,bf,wf,yf;function xf(){return void 0!==window.RTCRtpScriptTransform}(ef=Xv||(Xv={})).SetKey="setKey",ef.RatchetRequest="ratchetRequest",ef.KeyRatcheted="keyRatcheted",(tf||(tf={})).KeyRatcheted="keyRatcheted",(nf=rf||(rf={})).ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",nf.EncryptionError="encryptionError",(of||(of={})).Error="cryptorError",Wg.EventEmitter;class Cf extends Error{constructor(e,t){super(t||"an error has occured"),this.name="LiveKitError",this.code=e}}(sf=af||(af={}))[sf.NotAllowed=0]="NotAllowed",sf[sf.ServerUnreachable=1]="ServerUnreachable",sf[sf.InternalError=2]="InternalError",sf[sf.Cancelled=3]="Cancelled",sf[sf.LeaveRequest=4]="LeaveRequest",sf[sf.Timeout=5]="Timeout";class Sf extends Cf{constructor(e,t,r,i){super(1,e),this.name="ConnectionError",this.status=r,this.reason=t,this.context=i,this.reasonName=af[t]}}class Tf extends Cf{constructor(e){super(21,null!=e?e:"device is unsupported"),this.name="DeviceUnsupportedError"}}class Ef extends Cf{constructor(e){super(20,null!=e?e:"track is invalid"),this.name="TrackInvalidError"}}class _f extends Cf{constructor(e){super(10,null!=e?e:"unsupported server"),this.name="UnsupportedServer"}}class If extends Cf{constructor(e){super(12,null!=e?e:"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Pf extends Cf{constructor(e){super(13,null!=e?e:"unable to negotiate"),this.name="NegotiationError"}}class Mf extends Cf{constructor(e,t){super(15,e),this.name="PublishTrackError",this.status=t}}class Af extends Cf{constructor(e,t){super(15,e),this.reason=t,this.reasonName="string"==typeof t?t:Cg[t]}}(cf=lf||(lf={}))[cf.AlreadyOpened=0]="AlreadyOpened",cf[cf.AbnormalEnd=1]="AbnormalEnd",cf[cf.DecodeFailed=2]="DecodeFailed",cf[cf.LengthExceeded=3]="LengthExceeded",cf[cf.Incomplete=4]="Incomplete",cf[cf.HandlerAlreadyRegistered=7]="HandlerAlreadyRegistered",cf[cf.EncryptionTypeMismatch=8]="EncryptionTypeMismatch";class Rf extends Cf{constructor(e,t){super(16,e),this.name="DataStreamError",this.reason=t,this.reasonName=lf[t]}}(uf=df||(df={})).PermissionDenied="PermissionDenied",uf.NotFound="NotFound",uf.DeviceInUse="DeviceInUse",uf.Other="Other",function(e){e.getFailure=function(t){if(t&&"name"in t)return"NotFoundError"===t.name||"DevicesNotFoundError"===t.name?e.NotFound:"NotAllowedError"===t.name||"PermissionDeniedError"===t.name?e.PermissionDenied:"NotReadableError"===t.name||"TrackStartError"===t.name?e.DeviceInUse:e.Other}}(df||(df={})),(pf=hf||(hf={}))[pf.InvalidKey=0]="InvalidKey",pf[pf.MissingKey=1]="MissingKey",pf[pf.InternalError=2]="InternalError",(gf=mf||(mf={})).Connected="connected",gf.Reconnecting="reconnecting",gf.SignalReconnecting="signalReconnecting",gf.Reconnected="reconnected",gf.Disconnected="disconnected",gf.ConnectionStateChanged="connectionStateChanged",gf.Moved="moved",gf.MediaDevicesChanged="mediaDevicesChanged",gf.ParticipantConnected="participantConnected",gf.ParticipantDisconnected="participantDisconnected",gf.TrackPublished="trackPublished",gf.TrackSubscribed="trackSubscribed",gf.TrackSubscriptionFailed="trackSubscriptionFailed",gf.TrackUnpublished="trackUnpublished",gf.TrackUnsubscribed="trackUnsubscribed",gf.TrackMuted="trackMuted",gf.TrackUnmuted="trackUnmuted",gf.LocalTrackPublished="localTrackPublished",gf.LocalTrackUnpublished="localTrackUnpublished",gf.LocalAudioSilenceDetected="localAudioSilenceDetected",gf.ActiveSpeakersChanged="activeSpeakersChanged",gf.ParticipantMetadataChanged="participantMetadataChanged",gf.ParticipantNameChanged="participantNameChanged",gf.ParticipantAttributesChanged="participantAttributesChanged",gf.ParticipantActive="participantActive",gf.RoomMetadataChanged="roomMetadataChanged",gf.DataReceived="dataReceived",gf.SipDTMFReceived="sipDTMFReceived",gf.TranscriptionReceived="transcriptionReceived",gf.ConnectionQualityChanged="connectionQualityChanged",gf.TrackStreamStateChanged="trackStreamStateChanged",gf.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",gf.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",gf.AudioPlaybackStatusChanged="audioPlaybackChanged",gf.VideoPlaybackStatusChanged="videoPlaybackChanged",gf.MediaDevicesError="mediaDevicesError",gf.ParticipantPermissionsChanged="participantPermissionsChanged",gf.SignalConnected="signalConnected",gf.RecordingStatusChanged="recordingStatusChanged",gf.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",gf.EncryptionError="encryptionError",gf.DCBufferStatusChanged="dcBufferStatusChanged",gf.ActiveDeviceChanged="activeDeviceChanged",gf.ChatMessage="chatMessage",gf.LocalTrackSubscribed="localTrackSubscribed",gf.MetricsReceived="metricsReceived",(ff=vf||(vf={})).TrackPublished="trackPublished",ff.TrackSubscribed="trackSubscribed",ff.TrackSubscriptionFailed="trackSubscriptionFailed",ff.TrackUnpublished="trackUnpublished",ff.TrackUnsubscribed="trackUnsubscribed",ff.TrackMuted="trackMuted",ff.TrackUnmuted="trackUnmuted",ff.LocalTrackPublished="localTrackPublished",ff.LocalTrackUnpublished="localTrackUnpublished",ff.LocalTrackCpuConstrained="localTrackCpuConstrained",ff.LocalSenderCreated="localSenderCreated",ff.ParticipantMetadataChanged="participantMetadataChanged",ff.ParticipantNameChanged="participantNameChanged",ff.DataReceived="dataReceived",ff.SipDTMFReceived="sipDTMFReceived",ff.TranscriptionReceived="transcriptionReceived",ff.IsSpeakingChanged="isSpeakingChanged",ff.ConnectionQualityChanged="connectionQualityChanged",ff.TrackStreamStateChanged="trackStreamStateChanged",ff.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",ff.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",ff.TrackCpuConstrained="trackCpuConstrained",ff.MediaDevicesError="mediaDevicesError",ff.AudioStreamAcquired="audioStreamAcquired",ff.ParticipantPermissionsChanged="participantPermissionsChanged",ff.PCTrackAdded="pcTrackAdded",ff.AttributesChanged="attributesChanged",ff.LocalTrackSubscribed="localTrackSubscribed",ff.ChatMessage="chatMessage",ff.Active="active",(bf=kf||(kf={})).TransportsCreated="transportsCreated",bf.Connected="connected",bf.Disconnected="disconnected",bf.Resuming="resuming",bf.Resumed="resumed",bf.Restarting="restarting",bf.Restarted="restarted",bf.SignalResumed="signalResumed",bf.SignalRestarted="signalRestarted",bf.Closing="closing",bf.MediaTrackAdded="mediaTrackAdded",bf.ActiveSpeakersUpdate="activeSpeakersUpdate",bf.DataPacketReceived="dataPacketReceived",bf.RTPVideoMapUpdate="rtpVideoMapUpdate",bf.DCBufferStatusChanged="dcBufferStatusChanged",bf.ParticipantUpdate="participantUpdate",bf.RoomUpdate="roomUpdate",bf.SpeakersChanged="speakersChanged",bf.StreamStateChanged="streamStateChanged",bf.ConnectionQualityUpdate="connectionQualityUpdate",bf.SubscriptionError="subscriptionError",bf.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",bf.RemoteMute="remoteMute",bf.SubscribedQualityUpdate="subscribedQualityUpdate",bf.LocalTrackUnpublished="localTrackUnpublished",bf.LocalTrackSubscribed="localTrackSubscribed",bf.Offline="offline",bf.SignalRequestResponse="signalRequestResponse",bf.SignalConnected="signalConnected",bf.RoomMoved="roomMoved",(yf=wf||(wf={})).Message="message",yf.Muted="muted",yf.Unmuted="unmuted",yf.Restarted="restarted",yf.Ended="ended",yf.Subscribed="subscribed",yf.Unsubscribed="unsubscribed",yf.CpuConstrained="cpuConstrained",yf.UpdateSettings="updateSettings",yf.UpdateSubscription="updateSubscription",yf.AudioPlaybackStarted="audioPlaybackStarted",yf.AudioPlaybackFailed="audioPlaybackFailed",yf.AudioSilenceDetected="audioSilenceDetected",yf.VisibilityChanged="visibilityChanged",yf.VideoDimensionsChanged="videoDimensionsChanged",yf.VideoPlaybackStarted="videoPlaybackStarted",yf.VideoPlaybackFailed="videoPlaybackFailed",yf.ElementAttached="elementAttached",yf.ElementDetached="elementDetached",yf.UpstreamPaused="upstreamPaused",yf.UpstreamResumed="upstreamResumed",yf.SubscriptionPermissionChanged="subscriptionPermissionChanged",yf.SubscriptionStatusChanged="subscriptionStatusChanged",yf.SubscriptionFailed="subscriptionFailed",yf.TrackProcessorUpdate="trackProcessorUpdate",yf.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",yf.TranscriptionReceived="transcriptionReceived",yf.TimeSyncUpdate="timeSyncUpdate",yf.PreConnectBufferFlushed="preConnectBufferFlushed";const Of=/version\/(\d+(\.?_?\d+)+)/i;let Df;function Lf(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("undefined"==typeof navigator)return;const r=navigator.userAgent.toLowerCase();if(void 0===Df||t){const e=Nf.find(e=>{let{test:t}=e;return t.test(r)});Df=null==e?void 0:e.describe(r)}return Df}const Nf=[{test:/firefox|iceweasel|fxios/i,describe:e=>({name:"Firefox",version:zf(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:jf(e)})},{test:/chrom|crios|crmo/i,describe:e=>({name:"Chrome",version:zf(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("crios")?"iOS":void 0,osVersion:jf(e)})},{test:/safari|applewebkit/i,describe:e=>({name:"Safari",version:zf(Of,e),os:e.includes("mobile/")?"iOS":"macOS",osVersion:jf(e)})}];function zf(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const i=t.match(e);return i&&i.length>=r&&i[r]||""}function jf(e){return e.includes("mac os")?zf(/\(.+?(\d+_\d+(:?_\d+)?)/,e,1).replace(/_/g,"."):void 0}class Uf{}Uf.setTimeout=function(){return setTimeout(...arguments)},Uf.setInterval=function(){return setInterval(...arguments)},Uf.clearTimeout=function(){return clearTimeout(...arguments)},Uf.clearInterval=function(){return clearInterval(...arguments)};const Ff=[];var Bf,Vf;(Vf=Bf||(Bf={}))[Vf.LOW=0]="LOW",Vf[Vf.MEDIUM=1]="MEDIUM",Vf[Vf.HIGH=2]="HIGH";class qf extends Wg.EventEmitter{get streamState(){return this._streamState}setStreamState(e){this._streamState=e}constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=qf.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=zg,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),"hidden"===document.visibilityState?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),5e3):this.handleAppVisibilityChanged()},this.log=jg(null!==(i=r.loggerName)&&void 0!==i?i:Mg.Track),this.loggerContextCb=r.loggerContextCb,this.setMaxListeners(100),this.kind=t,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=qf.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},null===(e=this.loggerContextCb)||void 0===e?void 0:e.call(this)),Yk(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let t="audio";this.kind===qf.Kind.Video&&(t="video"),0===this.attachedElements.length&&this.kind===qf.Kind.Video&&this.addAppVisibilityListener(),e||("audio"===t&&(Ff.forEach(t=>{null!==t.parentElement||e||(e=t)}),e&&Ff.splice(Ff.indexOf(e),1)),e||(e=document.createElement(t))),this.attachedElements.includes(e)||this.attachedElements.push(e),$f(this.mediaStreamTrack,e);const r=e.srcObject.getTracks(),i=r.some(e=>"audio"===e.kind);return e.play().then(()=>{this.emit(i?wf.AudioPlaybackStarted:wf.VideoPlaybackStarted)}).catch(t=>{"NotAllowedError"===t.name?this.emit(i?wf.AudioPlaybackFailed:wf.VideoPlaybackFailed,t):"AbortError"===t.name?zg.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):zg.warn("could not playback ".concat(i?"audio":"video"),t),i&&e&&r.some(e=>"video"===e.kind)&&"NotAllowedError"===t.name&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(wf.ElementAttached,e),e}detach(e){try{if(e){Hf(this.mediaStreamTrack,e);const t=this.attachedElements.indexOf(e);return t>=0&&(this.attachedElements.splice(t,1),this.recycleElement(e),this.emit(wf.ElementDetached,e)),e}const t=[];return this.attachedElements.forEach(e=>{Hf(this.mediaStreamTrack,e),t.push(e),this.recycleElement(e),this.emit(wf.ElementDetached,e)}),this.attachedElements=[],t}finally{0===this.attachedElements.length&&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=jg(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let t=!0;e.pause(),Ff.forEach(e=>{e.parentElement||(t=!1)}),t&&Ff.push(e)}}handleAppVisibilityChanged(){return Vg(this,void 0,void 0,function*(){this.isInBackground="hidden"===document.visibilityState,this.isInBackground||this.kind!==qf.Kind.Video||setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){pk()?(this.isInBackground="hidden"===document.visibilityState,document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){pk()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function $f(e,t){let r,i;r=t.srcObject instanceof MediaStream?t.srcObject:new MediaStream,i="audio"===e.kind?r.getAudioTracks():r.getVideoTracks(),i.includes(e)||(i.forEach(e=>{r.removeTrack(e)}),r.addTrack(e)),dk()&&t instanceof HTMLVideoElement||(t.autoplay=!0),t.muted=0===r.getAudioTracks().length,t instanceof HTMLVideoElement&&(t.playsInline=!0),t.srcObject!==r&&(t.srcObject=r,(dk()||ck())&&t instanceof HTMLVideoElement&&setTimeout(()=>{t.srcObject=r,t.play().catch(()=>{})},0))}function Hf(e,t){if(t.srcObject instanceof MediaStream){const r=t.srcObject;r.removeTrack(e),r.getTracks().length>0?t.srcObject=r:t.srcObject=null}}!function(e){let t;var r;let i;var n;let o;var a;(r=t=e.Kind||(e.Kind={})).Audio="audio",r.Video="video",r.Unknown="unknown",(n=i=e.Source||(e.Source={})).Camera="camera",n.Microphone="microphone",n.ScreenShare="screen_share",n.ScreenShareAudio="screen_share_audio",n.Unknown="unknown",(a=o=e.StreamState||(e.StreamState={})).Active="active",a.Paused="paused",a.Unknown="unknown",e.kindToProto=function(e){switch(e){case t.Audio:return Ap.AUDIO;case t.Video:return Ap.VIDEO;default:return Ap.DATA}},e.kindFromProto=function(e){switch(e){case Ap.AUDIO:return t.Audio;case Ap.VIDEO:return t.Video;default:return t.Unknown}},e.sourceToProto=function(e){switch(e){case i.Camera:return Rp.CAMERA;case i.Microphone:return Rp.MICROPHONE;case i.ScreenShare:return Rp.SCREEN_SHARE;case i.ScreenShareAudio:return Rp.SCREEN_SHARE_AUDIO;default:return Rp.UNKNOWN}},e.sourceFromProto=function(e){switch(e){case Rp.CAMERA:return i.Camera;case Rp.MICROPHONE:return i.Microphone;case Rp.SCREEN_SHARE:return i.ScreenShare;case Rp.SCREEN_SHARE_AUDIO:return i.ScreenShareAudio;default:return i.Unknown}},e.streamStateFromProto=function(e){switch(e){case Mm.ACTIVE:return o.Active;case Mm.PAUSED:return o.Paused;default:return o.Unknown}}}(qf||(qf={}));class Wf{constructor(e,t,r,i,n){if("object"==typeof e)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(void 0===t||void 0===r)throw new TypeError("Unsupported options: provide at least width, height and maxBitrate");this.width=e,this.height=t,this.aspectRatio=e/t,this.encoding={maxBitrate:r,maxFramerate:i,priority:n}}}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const Gf=["vp8","h264"],Zf=["vp8","h264","vp9","av1","h265"],Jf=function(e){return!!Gf.find(t=>t===e)};var Kf,Yf,Qf,Xf;(Yf=Kf||(Kf={}))[Yf.PREFER_REGRESSION=0]="PREFER_REGRESSION",Yf[Yf.SIMULCAST=1]="SIMULCAST",Yf[Yf.REGRESSION=2]="REGRESSION",(Xf=Qf||(Qf={})).telephone={maxBitrate:12e3},Xf.speech={maxBitrate:24e3},Xf.music={maxBitrate:48e3},Xf.musicStereo={maxBitrate:64e3},Xf.musicHighQuality={maxBitrate:96e3},Xf.musicHighQualityStereo={maxBitrate:128e3};const ek={h90:new Wf(160,90,9e4,20),h180:new Wf(320,180,16e4,20),h216:new Wf(384,216,18e4,20),h360:new Wf(640,360,45e4,20),h540:new Wf(960,540,8e5,25),h720:new Wf(1280,720,17e5,30),h1080:new Wf(1920,1080,3e6,30),h1440:new Wf(2560,1440,5e6,30),h2160:new Wf(3840,2160,8e6,30)},tk={h120:new Wf(160,120,7e4,20),h180:new Wf(240,180,125e3,20),h240:new Wf(320,240,14e4,20),h360:new Wf(480,360,33e4,20),h480:new Wf(640,480,5e5,20),h540:new Wf(720,540,6e5,25),h720:new Wf(960,720,13e5,30),h1080:new Wf(1440,1080,23e5,30),h1440:new Wf(1920,1440,38e5,30)},rk={h360fps3:new Wf(640,360,2e5,3,"medium"),h360fps15:new Wf(640,360,4e5,15,"medium"),h720fps5:new Wf(1280,720,8e5,5,"medium"),h720fps15:new Wf(1280,720,15e5,15,"medium"),h720fps30:new Wf(1280,720,2e6,30,"medium"),h1080fps15:new Wf(1920,1080,25e5,15,"medium"),h1080fps30:new Wf(1920,1080,5e6,30,"medium"),original:new Wf(0,0,7e6,30,"medium")},ik="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function nk(e){return Vg(this,void 0,void 0,function*(){return new Promise(t=>Uf.setTimeout(t,e))})}function ok(){return"addTransceiver"in RTCPeerConnection.prototype}function ak(){return"addTrack"in RTCPeerConnection.prototype}function sk(e){return"av1"===e||"vp9"===e}function lk(e){return!(!document||uk())&&(e||(e=document.createElement("audio")),"setSinkId"in e)}function ck(){var e;return"Firefox"===(null===(e=Lf())||void 0===e?void 0:e.name)}function dk(){var e;return"Safari"===(null===(e=Lf())||void 0===e?void 0:e.name)}function uk(){const e=Lf();return"Safari"===(null==e?void 0:e.name)||"iOS"===(null==e?void 0:e.os)}function hk(){var e,t;return!!pk()&&(null!==(t=null===(e=navigator.userAgentData)||void 0===e?void 0:e.mobile)&&void 0!==t?t:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent))}function pk(){return"undefined"!=typeof document}function mk(){return"ReactNative"==navigator.product}function gk(e){return e.hostname.endsWith(".livekit.cloud")||e.hostname.endsWith(".livekit.run")}function vk(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function fk(){if(!mk())return;let e=vk();return e?e.platform:void 0}function kk(){if(pk())return window.devicePixelRatio;if(mk()){let e=vk();if(e)return e.devicePixelRatio}return 1}function bk(e,t){const r=e.split("."),i=t.split("."),n=Math.min(r.length,i.length);for(let o=0;o<n;++o){const e=parseInt(r[o],10),t=parseInt(i[o],10);if(e>t)return 1;if(e<t)return-1;if(o===n-1&&e===t)return 0}return""===e&&""!==t?-1:""===t?1:r.length==i.length?0:r.length<i.length?-1:1}function wk(e){for(const t of e)t.target.handleResize(t)}function yk(e){for(const t of e)t.target.handleVisibilityChanged(t)}let xk=null;const Ck=()=>(xk||(xk=new ResizeObserver(wk)),xk);let Sk=null;const Tk=()=>(Sk||(Sk=new IntersectionObserver(yk,{root:null,rootMargin:"0px"})),Sk);function Ek(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const n=document.createElement("canvas");n.width=e,n.height=t;const o=n.getContext("2d");null==o||o.fillRect(0,0,n.width,n.height),i&&o&&(o.beginPath(),o.arc(e/2,t/2,50,0,2*Math.PI,!0),o.closePath(),o.fillStyle="grey",o.fill());const a=n.captureStream(),[s]=a.getTracks();if(!s)throw Error("Could not get empty media stream video track");return s.enabled=r,s}let _k;function Ik(){if(!_k){const e=new AudioContext,t=e.createOscillator(),r=e.createGain();r.gain.setValueAtTime(0,0);const i=e.createMediaStreamDestination();if(t.connect(r),r.connect(i),t.start(),[_k]=i.stream.getAudioTracks(),!_k)throw Error("Could not get empty media stream audio track");_k.enabled=!1}return _k.clone()}class Pk{get isResolved(){return this._isResolved}constructor(e,t){this._isResolved=!1,this.onFinally=t,this.promise=new Promise((t,r)=>Vg(this,void 0,void 0,function*(){this.resolve=t,this.reject=r,e&&(yield e(t,r))})).finally(()=>{var e;this._isResolved=!0,null===(e=this.onFinally)||void 0===e||e.call(this)})}}function Mk(e){if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e[0];if(void 0!==e.exact)return Array.isArray(e.exact)?e.exact[0]:e.exact;if(void 0!==e.ideal)return Array.isArray(e.ideal)?e.ideal[0]:e.ideal;throw Error("could not unwrap constraint")}function Ak(e){return e.startsWith("ws")?e.replace(/^(ws)/,"http"):e}function Rk(e){switch(e.reason){case af.LeaveRequest:return e.context;case af.Cancelled:return Np.CLIENT_INITIATED;case af.NotAllowed:return Np.USER_REJECTED;case af.ServerUnreachable:return Np.JOIN_FAILURE;default:return Np.UNKNOWN_REASON}}function Ok(e){return void 0!==e?Number(e):void 0}function Dk(e){return void 0!==e?BigInt(e):void 0}function Lk(e){return!!e&&!(e instanceof MediaStreamTrack)&&e.isLocal}function Nk(e){return!!e&&e.kind==qf.Kind.Audio}function zk(e){return!!e&&e.kind==qf.Kind.Video}function jk(e){return Lk(e)&&zk(e)}function Uk(e){return Lk(e)&&Nk(e)}function Fk(e){return!!e&&!e.isLocal}function Bk(e){return!!e&&!e.isLocal}function Vk(e){return Fk(e)&&zk(e)}function qk(e,t,r){var i,n,o,a;const{optionsWithoutProcessor:s,audioProcessor:l,videoProcessor:c}=Qk(null!=e?e:{}),d=null==t?void 0:t.processor,u=null==r?void 0:r.processor,h=null!=s?s:{};return!0===h.audio&&(h.audio={}),!0===h.video&&(h.video={}),h.audio&&($k(h.audio,t),null!==(i=(o=h.audio).deviceId)&&void 0!==i||(o.deviceId={ideal:"default"}),(l||d)&&(h.audio.processor=null!=l?l:d)),h.video&&($k(h.video,r),null!==(n=(a=h.video).deviceId)&&void 0!==n||(a.deviceId={ideal:"default"}),(c||u)&&(h.video.processor=null!=c?c:u)),h}function $k(e,t){return Object.keys(t).forEach(r=>{void 0===e[r]&&(e[r]=t[r])}),e}function Hk(e){var t,r,i,n;const o={};if(e.video)if("object"==typeof e.video){const r={},n=r,a=e.video;Object.keys(a).forEach(e=>{"resolution"===e?$k(n,a.resolution):n[e]=a[e]}),o.video=r,null!==(t=(i=o.video).deviceId)&&void 0!==t||(i.deviceId={ideal:"default"})}else o.video=!!e.video&&{deviceId:{ideal:"default"}};else o.video=!1;return e.audio?"object"==typeof e.audio?(o.audio=e.audio,null!==(r=(n=o.audio).deviceId)&&void 0!==r||(n.deviceId={ideal:"default"})):o.audio={deviceId:{ideal:"default"}}:o.audio=!1,o}function Wk(){var e;const t="undefined"!=typeof window&&(window.AudioContext||window.webkitAudioContext);if(t){const r=new t({latencyHint:"interactive"});if("suspended"===r.state&&"undefined"!=typeof window&&(null===(e=window.document)||void 0===e?void 0:e.body)){const e=()=>Vg(this,void 0,void 0,function*(){var t;try{"suspended"===r.state&&(yield r.resume())}catch(VT){}finally{null===(t=window.document.body)||void 0===t||t.removeEventListener("click",e)}});r.addEventListener("statechange",()=>{var t;"closed"===r.state&&(null===(t=window.document.body)||void 0===t||t.removeEventListener("click",e))}),window.document.body.addEventListener("click",e)}return r}}function Gk(e){return"audioinput"===e?qf.Source.Microphone:"videoinput"===e?qf.Source.Camera:qf.Source.Unknown}function Zk(e){return e===qf.Source.Microphone?"audioinput":e===qf.Source.Camera?"videoinput":void 0}function Jk(e){return e.split("/")[1].toLowerCase()}function Kk(e){const t=[];return e.forEach(e=>{void 0!==e.track&&t.push(new Fm({cid:e.track.mediaStreamID,track:e.trackInfo}))}),t}function Yk(e){return"mediaStreamTrack"in e?{trackID:e.sid,source:e.source,muted:e.isMuted,enabled:e.mediaStreamTrack.enabled,kind:e.kind,streamID:e.mediaStreamID,streamTrackID:e.mediaStreamTrack.id}:{trackID:e.trackSid,enabled:e.isEnabled,muted:e.isMuted,trackInfo:Object.assign({mimeType:e.mimeType,name:e.trackName,encrypted:e.isEncrypted,kind:e.kind,source:e.source},e.track?Yk(e.track):{})}}function Qk(e){const t=Object.assign({},e);let r,i;return"object"==typeof t.audio&&t.audio.processor&&(r=t.audio.processor,t.audio=Object.assign(Object.assign({},t.audio),{processor:void 0})),"object"==typeof t.video&&t.video.processor&&(i=t.video.processor,t.video=Object.assign(Object.assign({},t.video),{processor:void 0})),{audioProcessor:r,videoProcessor:i,optionsWithoutProcessor:(n=t,void 0===n?n:"function"==typeof structuredClone?"object"==typeof n&&null!==n?structuredClone(Object.assign({},n)):structuredClone(n):JSON.parse(JSON.stringify(n)))};var n}function Xk(e,t){return e.width*e.height<t.width*t.height}class eb extends Wg.EventEmitter{constructor(e,t){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=e=>{var t,r;const{kind:i,data:n}=e.data;switch(i){case"error":zg.error(n.error.message),this.emit(rf.EncryptionError,n.error);break;case"initAck":n.enabled&&this.keyProvider.getKeys().forEach(e=>{this.postKey(e)});break;case"enable":if(n.enabled&&this.keyProvider.getKeys().forEach(e=>{this.postKey(e)}),this.encryptionEnabled!==n.enabled&&n.participantIdentity===(null===(t=this.room)||void 0===t?void 0:t.localParticipant.identity))this.emit(rf.ParticipantEncryptionStatusChanged,n.enabled,this.room.localParticipant),this.encryptionEnabled=n.enabled;else if(n.participantIdentity){const e=null===(r=this.room)||void 0===r?void 0:r.getParticipantByIdentity(n.participantIdentity);if(!e)throw TypeError("couldn't set encryption status, participant not found".concat(n.participantIdentity));this.emit(rf.ParticipantEncryptionStatusChanged,n.enabled,e)}break;case"ratchetKey":this.keyProvider.emit(Xv.KeyRatcheted,n.ratchetResult,n.participantIdentity,n.keyIndex);break;case"decryptDataResponse":const e=this.decryptDataRequests.get(n.uuid);(null==e?void 0:e.resolve)&&e.resolve(n);break;case"encryptDataResponse":const i=this.encryptDataRequests.get(n.uuid);(null==i?void 0:i.resolve)&&i.resolve(n)}},this.onWorkerError=e=>{zg.error("e2ee worker encountered an error:",{error:e.error}),this.emit(rf.EncryptionError,e.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=t}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}setup(e){if(!(void 0!==window.RTCRtpSender&&void 0!==window.RTCRtpSender.prototype.createEncodedStreams||xf()))throw new Tf("tried to setup end-to-end encryption on an unsupported browser");if(zg.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const t={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Ug.getLevel()}};this.worker&&(zg.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(e,t){zg.debug("set e2ee to ".concat(e," for participant ").concat(t)),this.postEnable(e,t)}setSifTrailer(e){e&&0!==e.length?this.postSifTrailer(e):zg.warn("ignoring server sent trailer as it's empty")}setupEngine(e){e.on(kf.RTPVideoMapUpdate,e=>{this.postRTPMap(e)})}setupEventListeners(e,t){e.on(mf.TrackPublished,(e,t)=>this.setParticipantCryptorEnabled(e.trackInfo.encryption!==Gp.NONE,t.identity)),e.on(mf.ConnectionStateChanged,t=>{t===Sw.Connected&&e.remoteParticipants.forEach(e=>{e.trackPublications.forEach(t=>{this.setParticipantCryptorEnabled(t.trackInfo.encryption!==Gp.NONE,e.identity)})})}).on(mf.TrackUnsubscribed,(e,t,r)=>{var i;const n={kind:"removeTransform",data:{participantIdentity:r.identity,trackId:e.mediaStreamID}};null===(i=this.worker)||void 0===i||i.postMessage(n)}).on(mf.TrackSubscribed,(e,t,r)=>{this.setupE2EEReceiver(e,r.identity,t.trackInfo)}).on(mf.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");t.getKeys().forEach(e=>{this.postKey(e)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(vf.LocalSenderCreated,(e,t)=>Vg(this,void 0,void 0,function*(){this.setupE2EESender(t,e)})),e.localParticipant.on(vf.LocalTrackPublished,e=>{if(!zk(e.track)||!uk())return;const t={kind:"updateCodec",data:{trackId:e.track.mediaStreamID,codec:Jk(e.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(t)}),t.on(Xv.SetKey,e=>this.postKey(e)).on(Xv.RatchetRequest,(e,t)=>this.postRatchetRequest(e,t))}encryptData(e){return Vg(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const t=crypto.randomUUID(),r={kind:"encryptDataRequest",data:{uuid:t,payload:e,participantIdentity:this.room.localParticipant.identity}},i=new Pk;return i.onFinally=()=>{this.encryptDataRequests.delete(t)},this.encryptDataRequests.set(t,i),this.worker.postMessage(r),i.promise})}handleEncryptedData(e,t,r,i){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const n=crypto.randomUUID(),o={kind:"decryptDataRequest",data:{uuid:n,payload:e,iv:t,participantIdentity:r,keyIndex:i}},a=new Pk;return a.onFinally=()=>{this.decryptDataRequests.delete(n)},this.decryptDataRequests.set(n,a),this.worker.postMessage(o),a.promise}postRatchetRequest(e,t){if(!this.worker)throw Error("could not ratchet key, worker is missing");const r={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:t}};this.worker.postMessage(r)}postKey(e){let{key:t,participantIdentity:r,keyIndex:i}=e;var n;if(!this.worker)throw Error("could not set key, worker is missing");const o={kind:"setKey",data:{participantIdentity:r,isPublisher:r===(null===(n=this.room)||void 0===n?void 0:n.localParticipant.identity),key:t,keyIndex:i}};this.worker.postMessage(o)}postEnable(e,t){if(!this.worker)throw new ReferenceError("failed to enable e2ee, worker is not ready");{const r={kind:"enable",data:{enabled:e,participantIdentity:t}};this.worker.postMessage(r)}}postRTPMap(e){var t;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(null===(t=this.room)||void 0===t?void 0:t.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const r={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(r)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const t={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(t)}setupE2EEReceiver(e,t,r){if(e.receiver){if(!(null==r?void 0:r.mimeType)||""===r.mimeType)throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,t,"video"===e.kind?Jk(r.mimeType):void 0)}}setupE2EESender(e,t){Lk(e)&&t?this.handleSender(t,e.mediaStreamID,void 0):t||zg.warn("early return because sender is not ready")}handleReceiver(e,t,r,i){return Vg(this,void 0,void 0,function*(){if(this.worker){if(xf()){const n={kind:"decode",participantIdentity:r,trackId:t,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,n)}else{if(Qv in e&&i){const e={kind:"updateCodec",data:{trackId:t,codec:i,participantIdentity:r}};return void this.worker.postMessage(e)}let n=e.writableStream,o=e.readableStream;if(!n||!o){const t=e.createEncodedStreams();e.writableStream=t.writable,n=t.writable,e.readableStream=t.readable,o=t.readable}const a={kind:"decode",data:{readableStream:o,writableStream:n,trackId:t,codec:i,participantIdentity:r,isReuse:Qv in e}};this.worker.postMessage(a,[o,n])}e[Qv]=!0}})}handleSender(e,t,r){var i;if(!(Qv in e)&&this.worker){if(!(null===(i=this.room)||void 0===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(xf()){zg.info("initialize script transform");const i={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:t,codec:r};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{zg.info("initialize encoded streams");const i=e.createEncodedStreams(),n={kind:"encode",data:{readableStream:i.readable,writableStream:i.writable,codec:r,trackId:t,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(n,[i.readable,i.writable])}e[Qv]=!0}}}const tb="default";class rb{constructor(){this._previousDevices=[]}static getInstance(){return void 0===this.instance&&(this.instance=new rb),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return Vg(this,arguments,void 0,function(e){var t=this;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){var i;if((null===(i=rb.userMediaPromiseMap)||void 0===i?void 0:i.size)>0){zg.debug("awaiting getUserMedia promise");try{e?yield rb.userMediaPromiseMap.get(e):yield Promise.all(rb.userMediaPromiseMap.values())}catch(VT){zg.warn("error waiting for media permissons")}}let n=yield navigator.mediaDevices.enumerateDevices();if(r&&(!dk()||!t.hasDeviceInUse(e))&&(0===n.filter(t=>t.kind===e).length||n.some(t=>{const r=""===t.label,i=!e||t.kind===e;return r&&i}))){const t={video:"audioinput"!==e&&"audiooutput"!==e,audio:"videoinput"!==e&&{deviceId:{ideal:"default"}}},r=yield navigator.mediaDevices.getUserMedia(t);n=yield navigator.mediaDevices.enumerateDevices(),r.getTracks().forEach(e=>{e.stop()})}return t._previousDevices=n,e&&(n=n.filter(t=>t.kind===e)),n}()})}normalizeDeviceId(e,t,r){return Vg(this,void 0,void 0,function*(){if(t!==tb)return t;const i=yield this.getDevices(e),n=i.find(e=>e.deviceId===tb);if(!n)return void zg.warn("could not reliably determine default device");const o=i.find(e=>e.deviceId!==tb&&e.groupId===(null!=r?r:n.groupId));if(o)return null==o?void 0:o.deviceId;zg.warn("could not reliably determine default device")})}hasDeviceInUse(e){return e?rb.userMediaPromiseMap.has(e):rb.userMediaPromiseMap.size>0}}var ib,nb;rb.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],rb.userMediaPromiseMap=new Map,(nb=ib||(ib={}))[nb.WAITING=0]="WAITING",nb[nb.RUNNING=1]="RUNNING",nb[nb.COMPLETED=2]="COMPLETED";class ob{constructor(){this.pendingTasks=new Map,this.taskMutex=new Ju,this.nextTaskIndex=0}run(e){return Vg(this,void 0,void 0,function*(){const t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:ib.WAITING};this.pendingTasks.set(t.id,t);const r=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=ib.RUNNING,yield e()}finally{t.status=ib.COMPLETED,this.pendingTasks.delete(t.id),r()}})}flush(){return Vg(this,void 0,void 0,function*(){return this.run(()=>Vg(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function ab(e,t){return e.pathname="".concat(function(e){return e.endsWith("/")?e:"".concat(e,"/")}(e.pathname)).concat(t),e.toString()}const sb=["syncState","trickle","offer","answer","simulate","leave"];var lb,cb;(cb=lb||(lb={}))[cb.CONNECTING=0]="CONNECTING",cb[cb.CONNECTED=1]="CONNECTED",cb[cb.RECONNECTING=2]="RECONNECTING",cb[cb.DISCONNECTING=3]="DISCONNECTING",cb[cb.DISCONNECTED=4]="DISCONNECTED";class db{get currentState(){return this.state}get isDisconnected(){return this.state===lb.DISCONNECTING||this.state===lb.DISCONNECTED}get isEstablishingConnection(){return this.state===lb.CONNECTING||this.state===lb.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var r;this.rtt=0,this.state=lb.DISCONNECTED,this.log=zg,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=jg(null!==(r=t.loggerName)&&void 0!==r?r:Mg.Signal),this.loggerContextCb=t.loggerContextCb,this.useJSON=e,this.requestQueue=new ob,this.queuedRequests=[],this.closingLock=new Ju,this.connectionLock=new Ju,this.state=lb.DISCONNECTED}get logContext(){var e,t;return null!==(t=null===(e=this.loggerContextCb)||void 0===e?void 0:e.call(this))&&void 0!==t?t:{}}join(e,t,r,i){return Vg(this,void 0,void 0,function*(){return this.state=lb.CONNECTING,this.options=r,yield this.connect(e,t,r,i)})}reconnect(e,t,r,i){return Vg(this,void 0,void 0,function*(){if(this.options)return this.state=lb.RECONNECTING,this.clearPingInterval(),yield this.connect(e,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:r,reconnectReason:i}));this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext)})}connect(e,t,r,i){this.connectOptions=r;const n=function(e,t,r){var i;const n=new URLSearchParams;return n.set("access_token",e),r.reconnect&&(n.set("reconnect","1"),r.sid&&n.set("sid",r.sid)),n.set("auto_subscribe",r.autoSubscribe?"1":"0"),n.set("sdk",mk()?"reactnative":"js"),n.set("version",t.version),n.set("protocol",t.protocol.toString()),t.deviceModel&&n.set("device_model",t.deviceModel),t.os&&n.set("os",t.os),t.osVersion&&n.set("os_version",t.osVersion),t.browser&&n.set("browser",t.browser),t.browserVersion&&n.set("browser_version",t.browserVersion),r.adaptiveStream&&n.set("adaptive_stream","1"),r.reconnectReason&&n.set("reconnect_reason",r.reconnectReason.toString()),(null===(i=navigator.connection)||void 0===i?void 0:i.type)&&n.set("network",navigator.connection.type),n}(t,function(){var e;const t=new vm({sdk:fm.JS,protocol:16,version:"2.15.8"});return mk()&&(t.os=null!==(e=fk())&&void 0!==e?e:""),t}(),r),o=function(e,t){const r=new URL(function(e){return e.startsWith("http")?e.replace(/^(http)/,"ws"):e}(e));return t.forEach((e,t)=>{r.searchParams.set(t,e)}),ab(r,"rtc")}(e,n),a=ab(new URL(Ak(o)),"validate");return new Promise((e,t)=>Vg(this,void 0,void 0,function*(){const n=yield this.connectionLock.lock();try{const n=()=>Vg(this,void 0,void 0,function*(){this.close(),clearTimeout(s),t(new Sf("room connection has been cancelled (signal)",af.Cancelled))}),s=setTimeout(()=>{this.close(),t(new Sf("room connection has timed out (signal)",af.ServerUnreachable))},r.websocketTimeout);(null==i?void 0:i.aborted)&&n(),null==i||i.addEventListener("abort",n);const l=new URL(o);l.searchParams.has("access_token")&&l.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(l),Object.assign({reconnect:r.reconnect,reconnectReason:r.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(o),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(s)},this.ws.onerror=e=>Vg(this,void 0,void 0,function*(){if(this.state===lb.CONNECTED)this.handleWSError(e);else{this.state=lb.DISCONNECTED,clearTimeout(s);try{const r=yield fetch(a);if(r.status.toFixed(0).startsWith("4")){const e=yield r.text();t(new Sf(e,af.NotAllowed,r.status))}else t(new Sf("Encountered unknown websocket error during connection: ".concat(e.toString()),af.InternalError,r.status))}catch(VT){t(new Sf(VT instanceof Error?VT.message:"server was not reachable",af.ServerUnreachable))}}}),this.ws.onmessage=o=>Vg(this,void 0,void 0,function*(){var a,s,l;let c;if("string"==typeof o.data){const e=JSON.parse(o.data);c=Om.fromJson(e,{ignoreUnknownFields:!0})}else{if(!(o.data instanceof ArrayBuffer))return void this.log.error("could not decode websocket message: ".concat(typeof o.data),this.logContext);c=Om.fromBinary(new Uint8Array(o.data))}if(this.state!==lb.CONNECTED){let o=!1;if("join"===(null===(a=c.message)||void 0===a?void 0:a.case)?(this.state=lb.CONNECTED,null==i||i.removeEventListener("abort",n),this.pingTimeoutDuration=c.message.value.pingTimeout,this.pingIntervalDuration=c.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()),e(c.message.value)):this.state===lb.RECONNECTING&&"leave"!==c.message.case?(this.state=lb.CONNECTED,null==i||i.removeEventListener("abort",n),this.startPingInterval(),"reconnect"===(null===(s=c.message)||void 0===s?void 0:s.case)?e(c.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),e(void 0),o=!0)):this.isEstablishingConnection&&"leave"===c.message.case?t(new Sf("Received leave request while trying to (re)connect",af.LeaveRequest,void 0,c.message.value.reason)):r.reconnect||t(new Sf("did not receive join response, got ".concat(null===(l=c.message)||void 0===l?void 0:l.case," instead"),af.InternalError)),!o)return}this.signalLatency&&(yield nk(this.signalLatency)),this.handleSignalResponse(c)}),this.ws.onclose=e=>{this.isEstablishingConnection&&t(new Sf("Websocket got closed during a (re)connection attempt",af.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:e.reason,code:e.code,wasClean:e.wasClean,state:this.state})),this.handleOnClose(e.reason)}}finally{n()}}))}close(){return Vg(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){const r=yield e.closingLock.lock();try{if(e.clearPingInterval(),t&&(e.state=lb.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const t=new Promise(t=>{e.ws?e.ws.onclose=()=>{t()}:t()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([t,nk(250)])),e.ws=void 0}}finally{t&&(e.state=lb.DISCONNECTED),r()}}()})}sendOffer(e,t){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:hb(e,t)})}sendAnswer(e,t){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:hb(e,t)})}sendIceCandidate(e,t){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new Nm({candidateInit:JSON.stringify(e),target:t})})}sendMuteTrack(e,t){return this.sendRequest({case:"mute",value:new zm({sid:e,muted:t})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,t){return Vg(this,arguments,void 0,function(e,t){var r=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){const n=r.getNextRequestId();return yield r.sendRequest({case:"updateMetadata",value:new Ym({requestId:n,metadata:e,name:t,attributes:i})}),n}()})}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,t){return this.sendRequest({case:"updateLayers",value:new Km({trackSid:e,layers:t})})}sendUpdateSubscriptionPermissions(e,t){return this.sendRequest({case:"subscriptionPermission",value:new dg({allParticipants:e,trackPermissions:t})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:gh.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new fg({timestamp:gh.parse(Date.now()),rtt:gh.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,t){return this.sendRequest({case:"updateAudioTrack",value:new Wm({trackSid:e,features:t})})}sendLeave(){return this.sendRequest({case:"leave",value:new Zm({reason:Np.CLIENT_INITIATED,action:Jm.DISCONNECT})})}sendRequest(e){return Vg(this,arguments,void 0,function(e){var t=this;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function*(){const i=!r&&!function(e){const t=sb.indexOf(e.case)>=0;return zg.trace("request allowed to bypass queue:",{canPass:t,req:e}),t}(e);if(i&&t.state===lb.RECONNECTING)return void t.queuedRequests.push(()=>Vg(t,void 0,void 0,function*(){yield this.sendRequest(e,!0)}));if(r||(yield t.requestQueue.flush()),t.signalLatency&&(yield nk(t.signalLatency)),t.isDisconnected)return void t.log.debug("skipping signal request (type: ".concat(e.case,") - SignalClient disconnected"));if(!t.ws||t.ws.readyState!==t.ws.OPEN)return void t.log.error("cannot send signal request before connected, type: ".concat(null==e?void 0:e.case),t.logContext);const n=new Rm({message:e});try{t.useJSON?t.ws.send(n.toJsonString()):t.ws.send(n.toBinary())}catch(VT){t.log.error("error sending signal message",Object.assign(Object.assign({},t.logContext),{error:VT}))}}()})}handleSignalResponse(e){var t,r;const i=e.message;if(null==i)return void this.log.debug("received unsupported message",this.logContext);let n=!1;if("answer"===i.case){const e=ub(i.value);this.onAnswer&&this.onAnswer(e,i.value.id)}else if("offer"===i.case){const e=ub(i.value);this.onOffer&&this.onOffer(e,i.value.id)}else if("trickle"===i.case){const e=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(e,i.value.target)}else"update"===i.case?this.onParticipantUpdate&&this.onParticipantUpdate(null!==(t=i.value.participants)&&void 0!==t?t:[]):"trackPublished"===i.case?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):"speakersChanged"===i.case?this.onSpeakersChanged&&this.onSpeakersChanged(null!==(r=i.value.speakers)&&void 0!==r?r:[]):"leave"===i.case?this.onLeave&&this.onLeave(i.value):"mute"===i.case?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):"roomUpdate"===i.case?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):"connectionQuality"===i.case?this.onConnectionQuality&&this.onConnectionQuality(i.value):"streamStateUpdate"===i.case?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):"subscribedQualityUpdate"===i.case?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):"subscriptionPermissionUpdate"===i.case?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):"refreshToken"===i.case?this.onTokenRefresh&&this.onTokenRefresh(i.value):"trackUnpublished"===i.case?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):"subscriptionResponse"===i.case?this.onSubscriptionError&&this.onSubscriptionError(i.value):"pong"===i.case||("pongResp"===i.case?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),n=!0):"requestResponse"===i.case?this.onRequestResponse&&this.onRequestResponse(i.value):"trackSubscribed"===i.case?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):"roomMoved"===i.case?(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})));n||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return Vg(this,void 0,void 0,function*(){if(this.state===lb.DISCONNECTED)return;const t=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),t&&t(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){this.clearPingTimeout(),this.pingTimeoutDuration?this.pingTimeout=Uf.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-1e3*this.pingTimeoutDuration).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},1e3*this.pingTimeoutDuration):this.log.warn("ping timeout duration not set",this.logContext)}clearPingTimeout(){this.pingTimeout&&Uf.clearTimeout(this.pingTimeout)}startPingInterval(){this.clearPingInterval(),this.resetPingTimeout(),this.pingIntervalDuration?(this.log.debug("start ping interval",this.logContext),this.pingInterval=Uf.setInterval(()=>{this.sendPing()},1e3*this.pingIntervalDuration)):this.log.warn("ping interval duration not set",this.logContext)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Uf.clearInterval(this.pingInterval)}}function ub(e){const t={type:"offer",sdp:e.sdp};switch(e.type){case"answer":case"offer":case"pranswer":case"rollback":t.type=e.type}return t}function hb(e,t){return new Vm({sdp:e.sdp,type:e.type,id:t})}class pb{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const t=this.buffer[0];if(this._totalSize-t.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class mb{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,t){const r=Date.now();r-this._lastCleanup>this.ttl/2&&this.cleanup();const i=r+this.ttl;return this._map.set(e,{value:t,expiresAt:i}),this}get(e){const t=this._map.get(e);if(t){if(!(t.expiresAt<Date.now()))return t.value;this._map.delete(e)}}has(e){const t=this._map.get(e);return!(!t||t.expiresAt<Date.now()&&(this._map.delete(e),1))}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[t,r]of this._map.entries())r.expiresAt<e&&this._map.delete(t);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[t,r]of this._map.entries())r.expiresAt>=Date.now()&&e(r.value,t,this.asValueMap())}map(e){this.cleanup();const t=[],r=this.asValueMap();for(const[i,n]of r.entries())t.push(e(n,i,r));return t}asValueMap(){const e=new Map;for(const[t,r]of this._map.entries())r.expiresAt>=Date.now()&&e.set(t,r.value);return e}}var gb,vb,fb,kb,bb,wb={},yb={},xb={exports:{}};function Cb(){if(gb)return xb.exports;gb=1;var e=xb.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 null!=e.address?"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 null!=e.subtype?"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 null!=e.sessionConfig?"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 t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["network-cost"]?" network-cost %d":"%v")}},{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 t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{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 null!=e.maxMessageSize?"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"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",(t+=null!=e.rateNumerator?" rate=%s":"")+(null!=e.rateDenominator?"/%s":"")}},{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(e).forEach(function(t){e[t].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),xb.exports}function Sb(){if(kb)return fb;kb=1;var e=Cb(),t=/%[sdv%]/g,r=function(e){var r=1,i=arguments,n=i.length;return e.replace(t,function(e){if(r>=n)return e;var t=i[r];switch(r+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},i=function(e,t,i){var n=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var o=0;o<t.names.length;o+=1){var a=t.names[o];t.name?n.push(i[t.name][a]):n.push(i[t.names[o]])}else n.push(i[t.name]);return r.apply(null,n)},n=["v","o","s","i","u","e","p","c","b","t","r","z","a"],o=["i","c","b","a"];return fb=function(t,r){r=r||{},null==t.version&&(t.version=0),null==t.name&&(t.name=" "),t.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var a=r.outerOrder||n,s=r.innerOrder||o,l=[];return a.forEach(function(r){e[r].forEach(function(e){e.name in t&&null!=t[e.name]?l.push(i(r,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){l.push(i(r,e,t))})})}),t.media.forEach(function(t){l.push(i("m",e.m[0],t)),s.forEach(function(r){e[r].forEach(function(e){e.name in t&&null!=t[e.name]?l.push(i(r,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){l.push(i(r,e,t))})})})}),l.join("\r\n")+"\r\n"}}var Tb=function(){if(bb)return wb;bb=1;var e=(vb||(vb=1,function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,i){var n=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:n&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:n?r[e.name]:r;!function(e,r,i,n){if(n&&!i)r[n]=t(e[1]);else for(var o=0;o<i.length;o+=1)null!=e[o+1]&&(r[i[o]]=t(e[o+1]))}(i.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},i=Cb(),n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach(function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(i[t]||[]).length;s+=1){var l=i[t][s];if(l.reg.test(n))return r(l,a,n)}}),t.media=o,t};var o=function(e,r){var i=r.split(/=(.+)/,2);return 2===i.length?e[i[0]]=t(i[1]):1===i.length&&r.length>1&&(e[i[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],i=e.split(" ").map(t),n=0;n<i.length;n+=3)r.push({component:i[n],ip:i[n+1],port:i[n+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var r,i=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),i=!0),{scid:r,paused:i}})})}}(yb)),yb),t=Sb(),r=Cb();return wb.grammar=r,wb.write=t,wb.parse=e.parse,wb.parseParams=e.parseParams,wb.parseFmtpConfig=e.parseFmtpConfig,wb.parsePayloads=e.parsePayloads,wb.parseRemoteCandidates=e.parseRemoteCandidates,wb.parseImageAttributes=e.parseImageAttributes,wb.parseSimulcastStreamList=e.parseSimulcastStreamList,wb}();function Eb(e,t,r){var i,n,o;void 0===t&&(t=50),void 0===r&&(r={});var a=null!=(i=r.isImmediate)&&i,s=null!=(n=r.callback)&&n,l=r.maxWait,c=Date.now(),d=[],u=function(){var r=[].slice.call(arguments),i=this;return new Promise(function(n,u){var h=a&&void 0===o;if(void 0!==o&&clearTimeout(o),o=setTimeout(function(){if(o=void 0,c=Date.now(),!a){var t=e.apply(i,r);s&&s(t),d.forEach(function(e){return(0,e.resolve)(t)}),d=[]}},function(){if(void 0!==l){var e=Date.now()-c;if(e+t>=l)return l-e}return t}()),h){var p=e.apply(i,r);return s&&s(p),n(p)}d.push({resolve:n,reject:u})})};return u.cancel=function(e){void 0!==o&&clearTimeout(o),d.forEach(function(t){return(0,t.reject)(e)}),d=[]},u}const _b="negotiationStarted",Ib="negotiationComplete",Pb="rtpVideoPayloadTypes";class Mb extends Wg.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var r;super(),this.log=zg,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=Eb(e=>Vg(this,void 0,void 0,function*(){this.emit(_b);try{yield this.createAndSendOffer()}catch(VT){if(!e)throw VT;e(VT)}}),20),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=jg(null!==(r=t.loggerName)&&void 0!==r?r:Mg.PCTransport),this.loggerOptions=t,this.config=e,this._pc=this.createPC(),this.offerLock=new Ju}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=e=>{var t;e.candidate&&(null===(t=this.onIceCandidate)||void 0===t||t.call(this,e.candidate))},e.onicecandidateerror=e=>{var t;null===(t=this.onIceCandidateError)||void 0===t||t.call(this,e)},e.oniceconnectionstatechange=()=>{var t;null===(t=this.onIceConnectionStateChange)||void 0===t||t.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var t;null===(t=this.onSignalingStatechange)||void 0===t||t.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var t;null===(t=this.onConnectionStateChange)||void 0===t||t.call(this,e.connectionState)},e.ondatachannel=e=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,e)},e.ontrack=e=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,e)},e}get logContext(){var e,t;return Object.assign({},null===(t=(e=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(e))}get isICEConnected(){return null!==this._pc&&("connected"===this.pc.iceConnectionState||"completed"===this.pc.iceConnectionState)}addIceCandidate(e){return Vg(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,t){return Vg(this,void 0,void 0,function*(){var r;if("answer"===e.type&&this.latestOfferId>0&&t>0&&t!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:t,latestOfferId:this.latestOfferId})),!1;let i;if("offer"===e.type){let{stereoMids:t,nackMids:r}=function(e){var t;const r=[],i=[],n=Tb.parse(null!==(t=e.sdp)&&void 0!==t?t:"");let o=0;return n.media.forEach(e=>{var t;const n=Ob(e.mid);"audio"===e.type&&(e.rtp.some(e=>"opus"===e.codec&&(o=e.payload,!0)),(null===(t=e.rtcpFb)||void 0===t?void 0:t.some(e=>e.payload===o&&"nack"===e.type))&&i.push(n),e.fmtp.some(e=>e.payload===o&&(e.config.includes("sprop-stereo=1")&&r.push(n),!0)))}),{stereoMids:r,nackMids:i}}(e);this.remoteStereoMids=t,this.remoteNackMids=r}else if("answer"===e.type){const t=Tb.parse(null!==(r=e.sdp)&&void 0!==r?r:"");t.media.forEach(e=>{const t=Ob(e.mid);"audio"===e.type&&this.trackBitrates.some(r=>{if(!r.transceiver||t!=r.transceiver.mid)return!1;let i=0;if(e.rtp.some(e=>e.codec.toUpperCase()===r.codec.toUpperCase()&&(i=e.payload,!0)),0===i)return!0;let n=!1;for(const t of e.fmtp)if(t.payload===i){t.config=t.config.split(";").filter(e=>!e.includes("maxaveragebitrate")).join(";"),r.maxbr>0&&(t.config+=";maxaveragebitrate=".concat(1e3*r.maxbr)),n=!0;break}return n||r.maxbr>0&&e.fmtp.push({payload:i,config:"maxaveragebitrate=".concat(1e3*r.maxbr)}),!0})}),i=Tb.write(t)}return yield this.setMungedSDP(e,i,!0),this.pendingCandidates.forEach(e=>{this.pc.addIceCandidate(e)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):"answer"===e.type&&(this.emit(Ib),e.sdp)&&Tb.parse(e.sdp).media.forEach(e=>{"video"===e.type&&this.emit(Pb,e.rtp)}),!0})}createAndSendOffer(e){return Vg(this,void 0,void 0,function*(){var t;const r=yield this.offerLock.lock();try{if(void 0===this.onOffer)return;if((null==e?void 0:e.iceRestart)&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&"have-local-offer"===this._pc.signalingState){const t=this._pc.remoteDescription;if(!(null==e?void 0:e.iceRestart)||!t)return void(this.renegotiate=!0);yield this._pc.setRemoteDescription(t)}else if(!this._pc||"closed"===this._pc.signalingState)return void this.log.warn("could not createOffer with closed peer connection",this.logContext);this.log.debug("starting to negotiate",this.logContext);const r=this.latestOfferId+1;this.latestOfferId=r;const i=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:i.sdp},this.logContext));const n=Tb.parse(null!==(t=i.sdp)&&void 0!==t?t:"");if(n.media.forEach(e=>{Rb(e),"audio"===e.type?Ab(e,[],[]):"video"===e.type&&this.trackBitrates.some(t=>{if(!e.msid||!t.cid||!e.msid.includes(t.cid))return!1;let r=0;if(e.rtp.some(e=>e.codec.toUpperCase()===t.codec.toUpperCase()&&(r=e.payload,!0)),0===r)return!0;if(sk(t.codec)&&!dk()&&this.ensureVideoDDExtensionForSVC(e,n),"av1"!==t.codec)return!0;const i=Math.round(.7*t.maxbr);for(const n of e.fmtp)if(n.payload===r){n.config.includes("x-google-start-bitrate")||(n.config+=";x-google-start-bitrate=".concat(i));break}return!0})}),this.latestOfferId>r)return void this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:r}));yield this.setMungedSDP(i,Tb.write(n)),this.onOffer(i,this.latestOfferId)}finally{r()}})}createAndSetAnswer(){return Vg(this,void 0,void 0,function*(){var e;const t=yield this.pc.createAnswer(),r=Tb.parse(null!==(e=t.sdp)&&void 0!==e?e:"");return r.media.forEach(e=>{Rb(e),"audio"===e.type&&Ab(e,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(t,Tb.write(r)),t})}createDataChannel(e,t){return this.pc.createDataChannel(e,t)}addTransceiver(e,t){return this.pc.addTransceiver(e,t)}addTrack(e){if(!this._pc)throw new If("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var t;if(!this._pc)throw new If("PC closed, cannot configure");return null===(t=this._pc)||void 0===t?void 0:t.setConfiguration(e)}canRemoveTrack(){var e;return!!(null===(e=this._pc)||void 0===e?void 0:e.removeTrack)}removeTrack(e){var t;return null===(t=this._pc)||void 0===t?void 0:t.removeTrack(e)}getConnectionState(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.connectionState)&&void 0!==t?t:"closed"}getICEConnectionState(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.iceConnectionState)&&void 0!==t?t:"closed"}getSignallingState(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.signalingState)&&void 0!==t?t:"closed"}getTransceivers(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.getTransceivers())&&void 0!==t?t:[]}getSenders(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.getSenders())&&void 0!==t?t:[]}getLocalDescription(){var e;return null===(e=this._pc)||void 0===e?void 0:e.localDescription}getRemoteDescription(){var e;return null===(e=this.pc)||void 0===e?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return Vg(this,void 0,void 0,function*(){var e;if(!this._pc)return;let t="";const r=new Map,i=new Map;if((yield this._pc.getStats()).forEach(e=>{switch(e.type){case"transport":t=e.selectedCandidatePairId;break;case"candidate-pair":""===t&&e.selected&&(t=e.id),r.set(e.id,e);break;case"remote-candidate":i.set(e.id,"".concat(e.address,":").concat(e.port))}}),""===t)return;const n=null===(e=r.get(t))||void 0===e?void 0:e.remoteCandidateId;return void 0!==n?i.get(n):void 0})}setMungedSDP(e,t,r){return Vg(this,void 0,void 0,function*(){if(t){const i=e.sdp;e.sdp=t;try{return this.log.debug("setting munged ".concat(r?"remote":"local"," description"),this.logContext),void(r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e))}catch(VT){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:VT,sdp:t})),e.sdp=i}}try{r?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(VT){let i="unknown error";VT instanceof Error?i=VT.message:"string"==typeof VT&&(i=VT);const n={error:i,sdp:e.sdp};throw!r&&this.pc.remoteDescription&&(n.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:n})),new Pf(i)}})}ensureVideoDDExtensionForSVC(e,t){var r,i;if(!(null===(r=e.ext)||void 0===r?void 0:r.some(e=>e.uri===ik))){if(0===this.ddExtID){let e=0;t.media.forEach(t=>{var r;"video"===t.type&&(null===(r=t.ext)||void 0===r||r.forEach(t=>{t.value>e&&(e=t.value)}))}),this.ddExtID=e+1}null===(i=e.ext)||void 0===i||i.push({value:this.ddExtID,uri:ik})}}}function Ab(e,t,r){const i=Ob(e.mid);let n=0;e.rtp.some(e=>"opus"===e.codec&&(n=e.payload,!0)),n>0&&(e.rtcpFb||(e.rtcpFb=[]),r.includes(i)&&!e.rtcpFb.some(e=>e.payload===n&&"nack"===e.type)&&e.rtcpFb.push({payload:n,type:"nack"}),t.includes(i)&&e.fmtp.some(e=>e.payload===n&&(e.config.includes("stereo=1")||(e.config+=";stereo=1"),!0)))}function Rb(e){if(e.connection){const t=e.connection.ip.indexOf(":")>=0;(4===e.connection.version&&t||6===e.connection.version&&!t)&&(e.connection.ip="0.0.0.0",e.connection.version=4)}}function Ob(e){return"number"==typeof e?e.toFixed(0):e}const Db="vp8",Lb={audioPreset:Qf.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:rk.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Db,backupCodec:!0,preConnectBuffer:!1},Nb={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},zb={deviceId:{ideal:"default"},resolution:ek.h720.resolution},jb={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new class{constructor(e){this._retryDelays=void 0!==e?[...e]:Bg}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const t=this._retryDelays[e.retryCount];return e.retryCount<=1?t:t+1e3*Math.random()}},disconnectOnPageLeave:!0,webAudioMix:!1},Ub={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Fb,Bb;(Bb=Fb||(Fb={}))[Bb.NEW=0]="NEW",Bb[Bb.CONNECTING=1]="CONNECTING",Bb[Bb.CONNECTED=2]="CONNECTED",Bb[Bb.FAILED=3]="FAILED",Bb[Bb.CLOSING=4]="CLOSING",Bb[Bb.CLOSED=5]="CLOSED";class Vb{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,t,r){var i;this.peerConnectionTimeout=Ub.peerConnectionTimeout,this.log=zg,this.updateState=()=>{var e;const t=this.state,r=this.requiredTransports.map(e=>e.getConnectionState());r.every(e=>"connected"===e)?this.state=Fb.CONNECTED:r.some(e=>"failed"===e)?this.state=Fb.FAILED:r.some(e=>"connecting"===e)?this.state=Fb.CONNECTING:r.every(e=>"closed"===e)?this.state=Fb.CLOSED:r.some(e=>"closed"===e)?this.state=Fb.CLOSING:r.every(e=>"new"===e)&&(this.state=Fb.NEW),t!==this.state&&(this.log.debug("pc state change: from ".concat(Fb[t]," to ").concat(Fb[this.state]),this.logContext),null===(e=this.onStateChange)||void 0===e||e.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=jg(null!==(i=r.loggerName)&&void 0!==i?i:Mg.PCManager),this.loggerOptions=r,this.isPublisherConnectionRequired=!t,this.isSubscriberConnectionRequired=t,this.publisher=new Mb(e,r),this.subscriber=new Mb(e,r),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=e=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,e,Pm.PUBLISHER)},this.subscriber.onIceCandidate=e=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,e,Pm.SUBSCRIBER)},this.subscriber.onDataChannel=e=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,e)},this.subscriber.onTrack=e=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,e)},this.publisher.onOffer=(e,t)=>{var r;null===(r=this.onPublisherOffer)||void 0===r||r.call(this,e,t)},this.state=Fb.NEW,this.connectionLock=new Ju,this.remoteOfferLock=new Ju}get logContext(){var e,t;return Object.assign({},null===(t=(e=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(e))}requirePublisher(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,t){return this.publisher.setRemoteDescription(e,t)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return Vg(this,void 0,void 0,function*(){if(this.publisher&&"closed"!==this.publisher.getSignallingState()){const e=this.publisher;for(const t of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(t)}catch(VT){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:VT}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return Vg(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,t){return Vg(this,void 0,void 0,function*(){t===Pm.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,t){return Vg(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 r=yield this.remoteOfferLock.lock();try{if(!(yield this.subscriber.setRemoteDescription(e,t)))return;return yield this.subscriber.createAndSetAnswer()}finally{r()}})}updateConfiguration(e,t){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),t&&this.triggerIceRestart()}ensurePCTransportConnection(e,t){return Vg(this,void 0,void 0,function*(){var r;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&"connected"!==this.publisher.getConnectionState()&&"connecting"!==this.publisher.getConnectionState()&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all(null===(r=this.requiredTransports)||void 0===r?void 0:r.map(r=>this.ensureTransportConnected(r,e,t)))}finally{i()}})}negotiate(e){return Vg(this,void 0,void 0,function*(){return new Promise((t,r)=>Vg(this,void 0,void 0,function*(){const i=setTimeout(()=>{r("negotiation timed out")},this.peerConnectionTimeout);e.signal.addEventListener("abort",()=>{clearTimeout(i),r("negotiation aborted")}),this.publisher.once(_b,()=>{e.signal.aborted||this.publisher.once(Ib,()=>{clearTimeout(i),t()})}),yield this.publisher.negotiate(e=>{clearTimeout(i),r(e)})}))})}addPublisherTransceiver(e,t){return this.publisher.addTransceiver(e,t)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,t){return this.publisher.createDataChannel(e,t)}getConnectedAddress(e){return e===Pm.PUBLISHER||e===Pm.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,t){return Vg(this,arguments,void 0,function(e,t){var r=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.peerConnectionTimeout;return function*(){if("connected"!==e.getConnectionState())return new Promise((e,n)=>Vg(r,void 0,void 0,function*(){const r=()=>{this.log.warn("abort transport connection",this.logContext),Uf.clearTimeout(o),n(new Sf("room connection has been cancelled",af.Cancelled))};(null==t?void 0:t.signal.aborted)&&r(),null==t||t.signal.addEventListener("abort",r);const o=Uf.setTimeout(()=>{null==t||t.signal.removeEventListener("abort",r),n(new Sf("could not establish pc connection",af.InternalError))},i);for(;this.state!==Fb.CONNECTED;)if(yield nk(50),null==t?void 0:t.signal.aborted)return void n(new Sf("room connection has been cancelled",af.Cancelled));Uf.clearTimeout(o),null==t||t.signal.removeEventListener("abort",r),e()}))}()})}}class qb extends Error{constructor(e,t,r){super(t),this.code=e,this.message=Hb(t,qb.MAX_MESSAGE_BYTES),this.data=r?Hb(r,qb.MAX_DATA_BYTES):void 0}static fromProto(e){return new qb(e.code,e.message,e.data)}toProto(){return new hm({code:this.code,message:this.message,data:this.data})}static builtIn(e,t){return new qb(qb.ErrorCode[e],qb.ErrorMessage[e],t)}}function $b(e){return(new TextEncoder).encode(e).length}function Hb(e,t){if($b(e)<=t)return e;let r=0,i=e.length;const n=new TextEncoder;for(;r<i;){const o=Math.floor((r+i+1)/2);n.encode(e.slice(0,o)).length<=t?r=o:i=o-1}return e.slice(0,r)}qb.MAX_MESSAGE_BYTES=256,qb.MAX_DATA_BYTES=15360,qb.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},qb.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 Wb=2e3;function Gb(e,t){if(!t)return 0;let r,i;return"bytesReceived"in e?(r=e.bytesReceived,i=t.bytesReceived):"bytesSent"in e&&(r=e.bytesSent,i=t.bytesSent),void 0===r||void 0===i||void 0===e.timestamp||void 0===t.timestamp?0:8*(r-i)*1e3/(e.timestamp-t.timestamp)}const Zb="undefined"!=typeof MediaRecorder,Jb=Zb?MediaRecorder:class{constructor(){throw new Error("MediaRecorder is not available in this environment")}};class Kb extends Jb{constructor(e,t){if(!Zb)throw new Error("MediaRecorder is not available in this environment");let r,i;super(new MediaStream([e.mediaStreamTrack]),t);const n=()=>{this.removeEventListener("dataavailable",r),this.removeEventListener("stop",n),this.removeEventListener("error",o),null==i||i.close(),i=void 0},o=e=>{null==i||i.error(e),this.removeEventListener("dataavailable",r),this.removeEventListener("stop",n),this.removeEventListener("error",o),i=void 0};this.byteStream=new ReadableStream({start:e=>{i=e,r=t=>Vg(this,void 0,void 0,function*(){let r;if(t.data.arrayBuffer){const e=yield t.data.arrayBuffer();r=new Uint8Array(e)}else{if(!t.data.byteArray)throw new Error("no data available!");r=t.data.byteArray}void 0!==i&&e.enqueue(r)}),this.addEventListener("dataavailable",r)},cancel:()=>{n()}}),this.addEventListener("stop",n),this.addEventListener("error",o)}}class Yb extends qf{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,t,r){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(e,t,arguments.length>4?arguments[4]:void 0),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=Eb(()=>Vg(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>Vg(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(wf.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new Ju,this.pauseUpstreamLock=new Ju,this.trackChangeLock=new Ju,this.trackChangeLock.lock().then(t=>Vg(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(e,!0)}finally{t()}})),this._constraints=e.getConstraints(),r&&(this._constraints=r)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==qf.Kind.Video)return;const{width:e,height:t}=this._mediaStreamTrack.getSettings();return e&&t?{width:e,height:t}:void 0}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,t;return null!==(t=null===(e=this.processor)||void 0===e?void 0:e.processedTrack)&&void 0!==t?t:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,t){return Vg(this,void 0,void 0,function*(){var r;if(e===this._mediaStreamTrack&&!t)return;let i;if(this._mediaStreamTrack&&(this.attachedElements.forEach(e=>{Hf(this._mediaStreamTrack,e)}),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()),this.processor&&e){if(this.log.debug("restarting processor",this.logContext),"unknown"===this.kind)throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&($f(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}this.sender&&"closed"!==(null===(r=this.sender.transport)||void 0===r?void 0:r.state)&&(yield this.sender.replaceTrack(null!=i?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(t=>{$f(null!=i?i:e,t)}))})}waitForDimensions(){return Vg(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return function*(){var r;if(e.kind===qf.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");"iOS"===(null===(r=Lf())||void 0===r?void 0:r.os)&&(yield nk(10));const i=Date.now();for(;Date.now()-i<t;){const t=e.dimensions;if(t)return t;yield nk(50)}throw new Ef("unable to get track dimensions after timeout")}()})}setDeviceId(e){return Vg(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Mk(e)||(this._constraints.deviceId=e,!!this.isMuted||(yield this.restartTrack(),Mk(e)===this._mediaStreamTrack.getSettings().deviceId))})}getDeviceId(){return Vg(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){if(e.source===qf.Source.ScreenShare)return;const{deviceId:r,groupId:i}=e._mediaStreamTrack.getSettings(),n=e.kind===qf.Kind.Audio?"audioinput":"videoinput";return t?rb.getInstance().normalizeDeviceId(n,r,i):r}()})}mute(){return Vg(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return Vg(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,t){return Vg(this,void 0,void 0,function*(){const r=yield this.trackChangeLock.lock();try{if(!this.sender)throw new Ef("unable to replace an unpublished track");let r,i;return"boolean"==typeof t?r=t:void 0!==t&&(r=t.userProvidedTrack,i=t.stopProcessor),this.providedByUser=null==r||r,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.internalStopProcessor()),this}finally{r()}})}restart(e){return Vg(this,void 0,void 0,function*(){this.manuallyStopped=!1;const t=yield this.trackChangeLock.lock();try{e||(e=this._constraints);const{deviceId:t,facingMode:r}=e,i=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const n={audio:!1,video:!1};this.kind===qf.Kind.Video?n.video=!t&&!r||{deviceId:t,facingMode:r}:n.audio=!t||Object.assign({deviceId:t},i),this.attachedElements.forEach(e=>{Hf(this.mediaStreamTrack,e)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const o=(yield navigator.mediaDevices.getUserMedia(n)).getTracks()[0];return this.kind===qf.Kind.Video&&(yield o.applyConstraints(i)),o.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(o),this._constraints=e,this.emit(wf.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{t()}})}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?wf.Muted:wf.Unmuted,this))}get needsReAcquisition(){return"live"!==this._mediaStreamTrack.readyState||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Vg(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),hk()&&(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),null===(e=this.processor)||void 0===e||e.destroy(),this.processor=void 0}pauseUpstream(){return Vg(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(!0===this._isUpstreamPaused)return;if(!this.sender)return void this.log.warn("unable to pause upstream for an unpublished track",this.logContext);this._isUpstreamPaused=!0,this.emit(wf.UpstreamPaused,this);const t=Lf();if("Safari"===(null==t?void 0:t.name)&&bk(t.version,"12.0")<0)throw new Tf("pauseUpstream is not supported on Safari < 12.");"closed"!==(null===(e=this.sender.transport)||void 0===e?void 0:e.state)&&(yield this.sender.replaceTrack(null))}finally{t()}})}resumeUpstream(){return Vg(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(!1===this._isUpstreamPaused)return;if(!this.sender)return void this.log.warn("unable to resume upstream for an unpublished track",this.logContext);this._isUpstreamPaused=!1,this.emit(wf.UpstreamResumed,this),"closed"!==(null===(e=this.sender.transport)||void 0===e?void 0:e.state)&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{t()}})}getRTCStatsReport(){return Vg(this,void 0,void 0,function*(){var e;if(null===(e=this.sender)||void 0===e?void 0:e.getStats)return yield this.sender.getStats()})}setProcessor(e){return Vg(this,arguments,void 0,function(e){var t=this;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){var i;const n=yield t.trackChangeLock.lock();try{t.log.debug("setting up processor",t.logContext);const n=document.createElement(t.kind),o={kind:t.kind,track:t._mediaStreamTrack,element:n,audioContext:t.audioContext};if(yield e.init(o),t.log.debug("processor initialized",t.logContext),t.processor&&(yield t.internalStopProcessor()),"unknown"===t.kind)throw TypeError("cannot set processor on track of unknown kind");if($f(t._mediaStreamTrack,n),n.muted=!0,n.play().catch(e=>{e instanceof DOMException&&"AbortError"===e.name?(t.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},t.logContext),{error:e})),setTimeout(()=>{n.play().catch(e=>{t.log.error("failed to play processor element",Object.assign(Object.assign({},t.logContext),{err:e}))})},100)):t.log.error("failed to play processor element",Object.assign(Object.assign({},t.logContext),{error:e}))}),t.processor=e,t.processorElement=n,t.processor.processedTrack){for(const e of t.attachedElements)e!==t.processorElement&&r&&(Hf(t._mediaStreamTrack,e),$f(t.processor.processedTrack,e));yield null===(i=t.sender)||void 0===i?void 0:i.replaceTrack(t.processor.processedTrack)}t.emit(wf.TrackProcessorUpdate,t.processor)}finally{n()}}()})}getProcessor(){return this.processor}stopProcessor(){return Vg(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){const r=yield e.trackChangeLock.lock();try{yield e.internalStopProcessor(t)}finally{r()}}()})}internalStopProcessor(){return Vg(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){var r,i;e.processor&&(e.log.debug("stopping processor",e.logContext),null===(r=e.processor.processedTrack)||void 0===r||r.stop(),yield e.processor.destroy(),e.processor=void 0,t||(null===(i=e.processorElement)||void 0===i||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(wf.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;if(Zb)if(this.localTrackRecorder)this.log.warn("preconnect buffer already started");else{{let e="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(e)||(e="video/mp4"),this.localTrackRecorder=new Kb(this,{mimeType:e})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},1e4)}else this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return null===(e=this.localTrackRecorder)||void 0===e?void 0:e.byteStream}getPreConnectBufferMimeType(){var e;return null===(e=this.localTrackRecorder)||void 0===e?void 0:e.mimeType}}class Qb extends Yb{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;super(e,qf.Kind.Audio,t,r,n),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>Vg(this,void 0,void 0,function*(){if(!this.sender)return void(this._currentBitrate=0);let e;try{e=yield this.getSenderStats()}catch(VT){return void this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:VT}))}e&&this.prevStats&&(this._currentBitrate=Gb(e,this.prevStats)),this.prevStats=e}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(wf.AudioTrackFeatureUpdate,this,Up.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(wf.AudioTrackFeatureUpdate,this,Up.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return Vg(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===qf.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return Vg(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const t=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Mk(this._constraints.deviceId);return this.source!==qf.Source.Microphone||!this.stopOnMute&&"ended"!==this._mediaStreamTrack.readyState&&!t||this.isUserProvided||(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{t()}})}restartTrack(e){return Vg(this,void 0,void 0,function*(){let t;if(e){const r=Hk({audio:e});"boolean"!=typeof r.audio&&(t=r.audio)}yield this.restart(t)})}restart(e){const t=Object.create(null,{restart:{get:()=>super.restart}});return Vg(this,void 0,void 0,function*(){const r=yield t.restart.call(this,e);return this.checkForSilence(),r})}startMonitor(){pk()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Wb)))}setProcessor(e){return Vg(this,void 0,void 0,function*(){var t;const r=yield this.trackChangeLock.lock();try{if(!mk()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const r={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(r),this.processor=e,this.processor.processedTrack&&(yield null===(t=this.sender)||void 0===t?void 0:t.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(wf.TrackProcessorUpdate,this.processor)}finally{r()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return Vg(this,void 0,void 0,function*(){var e;if(!(null===(e=this.sender)||void 0===e?void 0:e.getStats))return;let t;return(yield this.sender.getStats()).forEach(e=>{"outbound-rtp"===e.type&&(t={type:"audio",streamId:e.id,packetsSent:e.packetsSent,packetsLost:e.packetsLost,bytesSent:e.bytesSent,timestamp:e.timestamp,roundTripTime:e.roundTripTime,jitter:e.jitter})}),t})}checkForSilence(){return Vg(this,void 0,void 0,function*(){const e=yield function(e){return Vg(this,arguments,void 0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return function*(){const r=Wk();if(r){const i=r.createAnalyser();i.fftSize=2048;const n=i.frequencyBinCount,o=new Uint8Array(n);r.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield nk(t),i.getByteTimeDomainData(o);const a=o.some(e=>128!==e&&0!==e);return r.close(),!a}return!1}()})}(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(wf.AudioSilenceDetected)),e})}}const Xb=Object.values(ek),ew=Object.values(tk),tw=Object.values(rk),rw=[ek.h180,ek.h360],iw=[tk.h180,tk.h360],nw=["q","h","f"];function ow(e,t,r,i){var n,o;let a=null==i?void 0:i.videoEncoding;e&&(a=null==i?void 0:i.screenShareEncoding);const s=null==i?void 0:i.simulcast,l=null==i?void 0:i.scalabilityMode,c=null==i?void 0:i.videoCodec;if(!a&&!s&&!l||!t||!r)return[{}];a||(a=function(e,t,r,i){const n=function(e,t,r){if(e)return tw;const i=t>r?t/r:r/t;return Math.abs(i-16/9)<Math.abs(i-4/3)?Xb:ew}(e,t,r);let{encoding:o}=n[0];const a=Math.max(t,r);for(let s=0;s<n.length;s+=1){const e=n[s];if(o=e.encoding,e.width>=a)break}if(i)switch(i){case"av1":case"h265":o=Object.assign({},o),o.maxBitrate=.7*o.maxBitrate;break;case"vp9":o=Object.assign({},o),o.maxBitrate=.85*o.maxBitrate}return o}(e,t,r,c),zg.debug("using video encoding",a));const d=a.maxFramerate,u=new Wf(t,r,a.maxBitrate,a.maxFramerate,a.priority);if(l&&sk(c)){const e=new cw(l),t=[];if(e.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(l));const r=Lf();if(uk()||mk()||"Chrome"===(null==r?void 0:r.name)&&bk(null==r?void 0:r.version,"113")<0){const i="h"==e.suffix?2:3,n=function(e){return e||(e=Lf()),"Safari"===(null==e?void 0:e.name)&&bk(e.version,"18.3")>0||"iOS"===(null==e?void 0:e.os)&&!!(null==e?void 0:e.osVersion)&&bk(e.osVersion,"18.3")>0}(r);for(let r=0;r<e.spatial;r+=1)t.push({rid:nw[2-r],maxBitrate:a.maxBitrate/Math.pow(i,r),maxFramerate:u.encoding.maxFramerate,scaleResolutionDownBy:n?Math.pow(2,r):void 0});t[0].scalabilityMode=l}else t.push({maxBitrate:a.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:l});return u.encoding.priority&&(t[0].priority=u.encoding.priority,t[0].networkPriority=u.encoding.priority),zg.debug("using svc encoding",{encodings:t}),t}if(!s)return[a];let h,p=[];if(p=e?null!==(n=lw(null==i?void 0:i.screenShareSimulcastLayers))&&void 0!==n?n:aw(e,u):null!==(o=lw(null==i?void 0:i.videoSimulcastLayers))&&void 0!==o?o:aw(e,u),p.length>0){const e=p[0];p.length>1&&([,h]=p);const i=Math.max(t,r);if(i>=960&&h)return sw(t,r,[e,h,u],d);if(i>=480)return sw(t,r,[e,u],d)}return sw(t,r,[u])}function aw(e,t){if(e)return[{scaleResolutionDownBy:2,fps:(r=t).encoding.maxFramerate}].map(e=>{var t,i;return new Wf(Math.floor(r.width/e.scaleResolutionDownBy),Math.floor(r.height/e.scaleResolutionDownBy),Math.max(15e4,Math.floor(r.encoding.maxBitrate/(Math.pow(e.scaleResolutionDownBy,2)*((null!==(t=r.encoding.maxFramerate)&&void 0!==t?t:30)/(null!==(i=e.fps)&&void 0!==i?i:30))))),e.fps,r.encoding.priority)});var r;const{width:i,height:n}=t,o=i>n?i/n:n/i;return Math.abs(o-16/9)<Math.abs(o-4/3)?rw:iw}function sw(e,t,r,i){const n=[];if(r.forEach((r,o)=>{if(o>=nw.length)return;const a=Math.min(e,t),s={rid:nw[o],scaleResolutionDownBy:Math.max(1,a/Math.min(r.width,r.height)),maxBitrate:r.encoding.maxBitrate},l=i&&r.encoding.maxFramerate?Math.min(i,r.encoding.maxFramerate):r.encoding.maxFramerate;l&&(s.maxFramerate=l);const c=ck()||0===o;r.encoding.priority&&c&&(s.priority=r.encoding.priority,s.networkPriority=r.encoding.priority),n.push(s)}),mk()&&"ios"===fk()){let e;n.forEach(t=>{e?t.maxFramerate&&t.maxFramerate>e&&(e=t.maxFramerate):e=t.maxFramerate});let t=!0;n.forEach(r=>{var i;r.maxFramerate!=e&&(t&&(t=!1,zg.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),zg.info('Setting framerate of encoding "'.concat(null!==(i=r.rid)&&void 0!==i?i:"",'" to ').concat(e)),r.maxFramerate=e)})}return n}function lw(e){if(e)return e.sort((e,t)=>{const{encoding:r}=e,{encoding:i}=t;return r.maxBitrate>i.maxBitrate?1:r.maxBitrate<i.maxBitrate?-1:r.maxBitrate===i.maxBitrate&&r.maxFramerate&&i.maxFramerate?r.maxFramerate>i.maxFramerate?1:-1:0})}class cw{constructor(e){const t=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw new Error("invalid scalability mode");if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=t[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat(null!==(e=this.suffix)&&void 0!==e?e:"")}}class dw extends Yb{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,t){let r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0;super(e,qf.Kind.Video,t,r,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>Vg(this,void 0,void 0,function*(){if(!this.sender)return void(this._currentBitrate=0);let e;try{e=yield this.getSenderStats()}catch(VT){return void this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:VT}))}const t=new Map(e.map(e=>[e.rid,e])),r=e.some(e=>"cpu"===e.qualityLimitationReason);if(r!==this.isCpuConstrained&&(this.isCpuConstrained=r,this.isCpuConstrained&&this.emit(wf.CpuConstrained)),this.prevStats){let e=0;t.forEach((t,r)=>{var i;const n=null===(i=this.prevStats)||void 0===i?void 0:i.get(r);e+=Gb(t,n)}),this._currentBitrate=e}this.prevStats=t}),this.senderLock=new Ju}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var t;if(this.signalClient=e,!pk())return;const r=null===(t=this.sender)||void 0===t?void 0:t.getParameters();r&&(this.encodings=r.encodings),this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Wb))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return Vg(this,void 0,void 0,function*(){var t,r,i,n,o;yield e.pauseUpstream.call(this);try{for(var a,s=!0,l=qg(this.simulcastCodecs.values());!(t=(a=yield l.next()).done);s=!0){n=a.value,s=!1;const e=n;yield null===(o=e.sender)||void 0===o?void 0:o.replaceTrack(null)}}catch(c){r={error:c}}finally{try{s||t||!(i=l.return)||(yield i.call(l))}finally{if(r)throw r.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return Vg(this,void 0,void 0,function*(){var t,r,i,n,o;yield e.resumeUpstream.call(this);try{for(var a,s=!0,l=qg(this.simulcastCodecs.values());!(t=(a=yield l.next()).done);s=!0){n=a.value,s=!1;const e=n;yield null===(o=e.sender)||void 0===o?void 0:o.replaceTrack(e.mediaStreamTrack)}}catch(c){r={error:c}}finally{try{s||t||!(i=l.return)||(yield i.call(l))}finally{if(r)throw r.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return Vg(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source!==qf.Source.Camera||this.isUserProvided||(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return Vg(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.source!==qf.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{t()}})}setTrackMuted(e){super.setTrackMuted(e);for(const t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!e}getSenderStats(){return Vg(this,void 0,void 0,function*(){var e;if(!(null===(e=this.sender)||void 0===e?void 0:e.getStats))return[];const t=[],r=yield this.sender.getStats();return r.forEach(e=>{var i;if("outbound-rtp"===e.type){const n={type:"video",streamId:e.id,frameHeight:e.frameHeight,frameWidth:e.frameWidth,framesPerSecond:e.framesPerSecond,framesSent:e.framesSent,firCount:e.firCount,pliCount:e.pliCount,nackCount:e.nackCount,packetsSent:e.packetsSent,bytesSent:e.bytesSent,qualityLimitationReason:e.qualityLimitationReason,qualityLimitationDurations:e.qualityLimitationDurations,qualityLimitationResolutionChanges:e.qualityLimitationResolutionChanges,rid:null!==(i=e.rid)&&void 0!==i?i:e.id,retransmittedPacketsSent:e.retransmittedPacketsSent,targetBitrate:e.targetBitrate,timestamp:e.timestamp},o=r.get(e.remoteId);o&&(n.jitter=o.jitter,n.packetsLost=o.packetsLost,n.roundTripTime=o.roundTripTime),t.push(n)}}),t.sort((e,t)=>{var r,i;return(null!==(r=t.frameWidth)&&void 0!==r?r:0)-(null!==(i=e.frameWidth)&&void 0!==i?i:0)}),t})}setPublishingQuality(e){const t=[];for(let r=Bf.LOW;r<=Bf.HIGH;r+=1)t.push(new og({quality:r,enabled:r<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(sk(this.codec),t)}restartTrack(e){return Vg(this,void 0,void 0,function*(){var t,r,i,n,o;let a;if(e){const t=Hk({video:e});"boolean"!=typeof t.video&&(a=t.video)}yield this.restart(a),this.isCpuConstrained=!1;try{for(var s,l=!0,c=qg(this.simulcastCodecs.values());!(t=(s=yield c.next()).done);l=!0){n=s.value,l=!1;const e=n;e.sender&&"closed"!==(null===(o=e.sender.transport)||void 0===o?void 0:o.state)&&(e.mediaStreamTrack=this.mediaStreamTrack.clone(),yield e.sender.replaceTrack(e.mediaStreamTrack))}}catch(d){r={error:d}}finally{try{l||t||!(i=c.return)||(yield i.call(c))}finally{if(r)throw r.error}}})}setProcessor(e){const t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return Vg(this,arguments,void 0,function(e){var r=this;let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){var n,o,a,s,l,c;if(yield t.setProcessor.call(r,e,i),null===(l=r.processor)||void 0===l?void 0:l.processedTrack)try{for(var d,u=!0,h=qg(r.simulcastCodecs.values());!(n=(d=yield h.next()).done);u=!0){s=d.value,u=!1;const e=s;yield null===(c=e.sender)||void 0===c?void 0:c.replaceTrack(r.processor.processedTrack)}}catch(p){o={error:p}}finally{try{u||n||!(a=h.return)||(yield a.call(h))}finally{if(o)throw o.error}}}()})}setDegradationPreference(e){return Vg(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const t=this.sender.getParameters();t.degradationPreference=e,this.sender.setParameters(t)}catch(VT){this.log.warn("failed to set degradationPreference",Object.assign({error:VT},this.logContext))}})}addSimulcastTrack(e,t){if(this.simulcastCodecs.has(e))return void this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);const r={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(e,r),r}setSimulcastTrackSender(e,t){const r=this.simulcastCodecs.get(e);r&&(r.sender=t,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},5e3))}setPublishingCodecs(e){return Vg(this,void 0,void 0,function*(){var t,r,i,n,o,a,s;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(sk(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const l=[];try{for(t=!0,r=qg(e);!(n=(i=yield r.next()).done);t=!0){s=i.value,t=!1;const e=s;if(this.codec&&this.codec!==e.codec){const t=this.simulcastCodecs.get(e.codec);if(this.log.debug("try setPublishingCodec for ".concat(e.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:t})),t&&t.sender)t.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(e.codec),this.logContext),yield uw(t.sender,t.encodings,e.qualities,this.senderLock,sk(e.codec),this.log,this.logContext));else for(const r of e.qualities)if(r.enabled){l.push(e.codec);break}}else yield this.setPublishingLayers(sk(e.codec),e.qualities)}}catch(c){o={error:c}}finally{try{t||n||!(a=r.return)||(yield a.call(r))}finally{if(o)throw o.error}}return l})}setPublishingLayers(e,t){return Vg(this,void 0,void 0,function*(){this.optimizeForPerformance?this.log.info("skipping setPublishingLayers due to optimized publishing performance",Object.assign(Object.assign({},this.logContext),{qualities:t})):(this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:t})),this.sender&&this.encodings&&(yield uw(this.sender,this.encodings,t,this.senderLock,e,this.log,this.logContext)))})}prioritizePerformance(){return Vg(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const e=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const e=this.sender.getParameters();e.encodings=e.encodings.map((e,t)=>{var r;return Object.assign(Object.assign({},e),{active:0===t,scaleResolutionDownBy:Math.max(1,Math.ceil((null!==(r=this.mediaStreamTrack.getSettings().height)&&void 0!==r?r:360)/360)),scalabilityMode:0===t&&sk(this.codec)?"L1T3":void 0,maxFramerate:0===t?15:0,maxBitrate:0===t?e.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:e.encodings})),this.encodings=e.encodings,yield this.sender.setParameters(e)}catch(VT){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:VT})),this.optimizeForPerformance=!1}finally{e()}})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Vg(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),hk()&&this.isInBackground&&this.source===qf.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function uw(e,t,r,i,n,o,a){return Vg(this,void 0,void 0,function*(){const s=yield i.lock();o.debug("setPublishingLayersForSender",Object.assign(Object.assign({},a),{sender:e,qualities:r,senderEncodings:t}));try{const i=e.getParameters(),{encodings:s}=i;if(!s)return;if(s.length!==t.length)return void o.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},a),{encodings:s,senderEncodings:t}));let l=!1;n&&r.some(e=>e.enabled)&&r.forEach(e=>e.enabled=!0),s.forEach((e,i)=>{var n;let s=null!==(n=e.rid)&&void 0!==n?n:"";""===s&&(s="q");const c=hw(s),d=r.find(e=>e.quality===c);d&&e.active!==d.enabled&&(l=!0,e.active=d.enabled,o.debug("setting layer ".concat(d.quality," to ").concat(e.active?"enabled":"disabled"),a),ck()&&(d.enabled?(e.scaleResolutionDownBy=t[i].scaleResolutionDownBy,e.maxBitrate=t[i].maxBitrate,e.maxFrameRate=t[i].maxFrameRate):(e.scaleResolutionDownBy=4,e.maxBitrate=10,e.maxFrameRate=2)))}),l&&(i.encodings=s,o.debug("setting encodings",Object.assign(Object.assign({},a),{encodings:i.encodings})),yield e.setParameters(i))}finally{s()}})}function hw(e){switch(e){case"f":default:return Bf.HIGH;case"h":return Bf.MEDIUM;case"q":return Bf.LOW}}function pw(e,t,r,i){if(!r)return[new Kp({quality:Bf.HIGH,width:e,height:t,bitrate:0,ssrc:0})];if(i){const i=r[0].scalabilityMode,n=new cw(i),o=[],a="h"==n.suffix?1.5:2,s="h"==n.suffix?2:3;for(let l=0;l<n.spatial;l+=1)o.push(new Kp({quality:Math.min(Bf.HIGH,n.spatial-1)-l,width:Math.ceil(e/Math.pow(a,l)),height:Math.ceil(t/Math.pow(a,l)),bitrate:r[0].maxBitrate?Math.ceil(r[0].maxBitrate/Math.pow(s,l)):0,ssrc:0}));return o}return r.map(r=>{var i,n,o;const a=null!==(i=r.scaleResolutionDownBy)&&void 0!==i?i:1;let s=hw(null!==(n=r.rid)&&void 0!==n?n:"");return new Kp({quality:s,width:Math.ceil(e/a),height:Math.ceil(t/a),bitrate:null!==(o=r.maxBitrate)&&void 0!==o?o:0,ssrc:0})})}const mw="_lossy",gw="_reliable",vw="leave-reconnect";var fw,kw,bw,ww,yw,xw,Cw,Sw,Tw,Ew,_w;(kw=fw||(fw={}))[kw.New=0]="New",kw[kw.Connected=1]="Connected",kw[kw.Disconnected=2]="Disconnected",kw[kw.Reconnecting=3]="Reconnecting",kw[kw.Closed=4]="Closed";class Iw extends Wg.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var t;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=Ub.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=fw.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=zg,this.reliableDataSequence=1,this.reliableMessageBuffer=new pb,this.reliableReceivedState=new mb(3e4),this.handleDataChannel=e=>Vg(this,[e],void 0,function(e){var t=this;let{channel:r}=e;return function*(){if(r){if(r.label===gw)t.reliableDCSub=r;else{if(r.label!==mw)return;t.lossyDCSub=r}t.log.debug("on data channel ".concat(r.id,", ").concat(r.label),t.logContext),r.onmessage=t.handleDataMessage}}()}),this.handleDataMessage=e=>Vg(this,void 0,void 0,function*(){var t,r,i,n,o;const a=yield this.dataProcessLock.lock();try{let a;if(e.data instanceof ArrayBuffer)a=e.data;else{if(!(e.data instanceof Blob))return void this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:e.data}));a=yield e.data.arrayBuffer()}const s=Qp.fromBinary(new Uint8Array(a));if(s.sequence>0&&""!==s.participantSid){const e=this.reliableReceivedState.get(s.participantSid);if(e&&s.sequence<=e)return;this.reliableReceivedState.set(s.participantSid,s.sequence)}if("speaker"===(null===(t=s.value)||void 0===t?void 0:t.case))this.emit(kf.ActiveSpeakersUpdate,s.value.value.speakers);else if("encryptedPacket"===(null===(r=s.value)||void 0===r?void 0:r.case)){if(!this.e2eeManager)return void this.log.error("Received encrypted packet but E2EE not set up",this.logContext);const e=yield null===(i=this.e2eeManager)||void 0===i?void 0:i.handleEncryptedData(s.value.value.encryptedValue,s.value.value.iv,s.participantIdentity,s.value.value.keyIndex),t=tm.fromBinary(e.payload),r=new Qp({value:t.value});"user"===(null===(n=r.value)||void 0===n?void 0:n.case)&&Mw(r,r.value.value),this.emit(kf.DataPacketReceived,r,s.value.value.encryptionType)}else"user"===(null===(o=s.value)||void 0===o?void 0:o.case)&&Mw(s,s.value.value),this.emit(kf.DataPacketReceived,s,Gp.NONE)}finally{a()}}),this.handleDataError=e=>{const t=0===e.currentTarget.maxRetransmits?"lossy":"reliable";if(e instanceof ErrorEvent&&e.error){const{error:r}=e.error;this.log.error("DataChannel error on ".concat(t,": ").concat(e.message),Object.assign(Object.assign({},this.logContext),{error:r}))}else this.log.error("Unknown DataChannel error on ".concat(t),Object.assign(Object.assign({},this.logContext),{event:e}))},this.handleBufferedAmountLow=e=>{const t=0===e.currentTarget.maxRetransmits?Xp.LOSSY:Xp.RELIABLE;this.updateAndEmitDCBufferStatus(t)},this.handleDisconnect=(e,t)=>{if(this._isClosed)return;this.log.warn("".concat(e," disconnected"),this.logContext),0===this.reconnectAttempts&&(this.reconnectStart=Date.now());const r=Date.now()-this.reconnectStart;let i=this.getNextRetryDelay({elapsedMs:r,retryCount:this.reconnectAttempts});null!==i?(e===vw&&(i=0),this.log.debug("reconnecting in ".concat(i,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Uf.setTimeout(()=>this.attemptReconnect(t).finally(()=>this.reconnectTimeout=void 0),i)):(e=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(e,"ms. giving up"),this.logContext),this.emit(kf.Disconnected),this.close()})(r)},this.waitForRestarted=()=>new Promise((e,t)=>{this.pcState===fw.Connected&&e();const r=()=>{this.off(kf.Disconnected,i),e()},i=()=>{this.off(kf.Restarted,r),t()};this.once(kf.Restarted,r),this.once(kf.Disconnected,i)}),this.updateAndEmitDCBufferStatus=e=>{const t=this.isBufferStatusLow(e);void 0!==t&&t!==this.dcBufferStatus.get(e)&&(this.dcBufferStatus.set(e,t),this.emit(kf.DCBufferStatusChanged,t,e))},this.isBufferStatusLow=e=>{const t=this.dataChannelForKind(e);if(t)return e===Xp.RELIABLE&&this.reliableMessageBuffer.alignBufferedAmount(t.bufferedAmount),t.bufferedAmount<=t.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===lb.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(zp.RR_SIGNAL_DISCONNECTED))},this.log=jg(null!==(t=e.loggerName)&&void 0!==t?t:Mg.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new db(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new Ju,this.dataProcessLock=new Ju,this.dcBufferStatus=new Map([[Xp.LOSSY,!0],[Xp.RELIABLE,!0]]),this.client.onParticipantUpdate=e=>this.emit(kf.ParticipantUpdate,e),this.client.onConnectionQuality=e=>this.emit(kf.ConnectionQualityUpdate,e),this.client.onRoomUpdate=e=>this.emit(kf.RoomUpdate,e),this.client.onSubscriptionError=e=>this.emit(kf.SubscriptionError,e),this.client.onSubscriptionPermissionUpdate=e=>this.emit(kf.SubscriptionPermissionUpdate,e),this.client.onSpeakersChanged=e=>this.emit(kf.SpeakersChanged,e),this.client.onStreamStateUpdate=e=>this.emit(kf.StreamStateChanged,e),this.client.onRequestResponse=e=>this.emit(kf.SignalRequestResponse,e)}get logContext(){var e,t,r,i,n,o;return{room:null===(t=null===(e=this.latestJoinResponse)||void 0===e?void 0:e.room)||void 0===t?void 0:t.name,roomID:null===(i=null===(r=this.latestJoinResponse)||void 0===r?void 0:r.room)||void 0===i?void 0:i.sid,participant:null===(o=null===(n=this.latestJoinResponse)||void 0===n?void 0:n.participant)||void 0===o?void 0:o.identity,pID:this.participantSid}}join(e,t,r,i){return Vg(this,void 0,void 0,function*(){this.url=e,this.token=t,this.signalOpts=r,this.maxJoinAttempts=r.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const n=yield this.client.join(e,t,r,i);return this._isClosed=!1,this.latestJoinResponse=n,this.subscriberPrimary=n.subscriberPrimary,this.pcManager||(yield this.configure(n)),this.subscriberPrimary&&!n.fastPublish||this.negotiate().catch(e=>{zg.error(e,this.logContext)}),this.registerOnLineListener(),this.clientConfiguration=n.clientConfiguration,this.emit(kf.SignalConnected,n),n}catch(VT){if(VT instanceof Sf&&VT.reason===af.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,t,r,i);throw VT}})}close(){return Vg(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed)e();else try{this._isClosed=!0,this.joinAttempts=0,this.emit(kf.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return Vg(this,void 0,void 0,function*(){var e;yield null===(e=this.pcManager)||void 0===e?void 0:e.close(),this.pcManager=void 0;const t=e=>{e&&(e.close(),e.onbufferedamountlow=null,e.onclose=null,e.onclosing=null,e.onerror=null,e.onmessage=null,e.onopen=null)};t(this.lossyDC),t(this.lossyDCSub),t(this.reliableDC),t(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new pb,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupClient(){return Vg(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Ef("a track with the same ID has already been published");return new Promise((t,r)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],r(new Sf("publication of local track timed out, no response from server",af.Timeout))},1e4);this.pendingTrackResolvers[e.cid]={resolve:e=>{clearTimeout(i),t(e)},reject:()=>{clearTimeout(i),r(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:t}=this.pendingTrackResolvers[e.track.id];t&&t(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(VT){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:VT}))}return!1}updateMuteStatus(e,t){this.client.sendMuteTrack(e,t)}get dataSubscriberReadyState(){var e;return null===(e=this.reliableDCSub)||void 0===e?void 0:e.readyState}getConnectedServerAddress(){return Vg(this,void 0,void 0,function*(){var e;return null===(e=this.pcManager)||void 0===e?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return Vg(this,void 0,void 0,function*(){var t,r;if(this.pcManager&&this.pcManager.currentState!==Fb.NEW)return;this.participantSid=null===(t=e.participant)||void 0===t?void 0:t.sid;const i=this.makeRTCConfiguration(e);var n;this.pcManager=new Vb(i,e.subscriberPrimary,this.loggerOptions),this.emit(kf.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(e,t)=>{this.client.sendIceCandidate(e,t)},this.pcManager.onPublisherOffer=(e,t)=>{this.client.sendOffer(e,t)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(t,r,i)=>Vg(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(t),this.logContext),["closed","disconnected","failed"].includes(r)&&(this.publisherConnectionPromise=void 0),t===Fb.CONNECTED){const t=this.pcState===fw.New;this.pcState=fw.Connected,t&&this.emit(kf.Connected,e)}else t===Fb.FAILED&&(this.pcState!==fw.Connected&&this.pcState!==fw.Reconnecting||(this.pcState=fw.Disconnected,this.handleDisconnect("peerconnection failed","failed"===i?zp.RR_SUBSCRIBER_FAILED:zp.RR_PUBLISHER_FAILED)));const n=this.client.isDisconnected||this.client.currentState===lb.RECONNECTING,o=[Fb.FAILED,Fb.CLOSING,Fb.CLOSED].includes(t);n&&o&&!this._isClosed&&this.emit(kf.Offline)}),this.pcManager.onTrack=e=>{this.emit(kf.MediaTrackAdded,e.track,e.streams[0],e.receiver)},void 0!==(n=null===(r=e.serverInfo)||void 0===r?void 0:r.protocol)&&n>13||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(e,t)=>Vg(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,t))}),this.client.onTrickle=(e,t)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:t})),this.pcManager.addIceCandidate(e,t))},this.client.onOffer=(e,t)=>Vg(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=t,!this.pcManager)return;const r=yield this.pcManager.createSubscriberAnswerFromOffer(e,t);r&&this.client.sendAnswer(r,t)}),this.client.onLocalTrackPublished=e=>{var t;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:null===(t=e.track)||void 0===t?void 0:t.sid})),!this.pendingTrackResolvers[e.cid])return void this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));const{resolve:r}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],r(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(kf.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(kf.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,t)=>{this.emit(kf.RemoteMute,e,t)},this.client.onSubscribedQualityUpdate=e=>{this.emit(kf.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var t;this.participantSid=null===(t=e.participant)||void 0===t?void 0:t.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(kf.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",zp.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:null==e?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case Jm.DISCONNECT:this.emit(kf.Disconnected,null==e?void 0:e.reason),this.close();break;case Jm.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(vw);break;case Jm.RESUME:this.handleDisconnect(vw)}}}makeRTCConfiguration(e){var t;const r=Object.assign({},this.rtcConfig);if((null===(t=this.signalOpts)||void 0===t?void 0:t.e2eeEnabled)&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),r.encodedInsertableStreams=!0),e.iceServers&&!r.iceServers){const t=[];e.iceServers.forEach(e=>{const r={urls:e.urls};e.username&&(r.username=e.username),e.credential&&(r.credential=e.credential),t.push(r)}),r.iceServers=t}return e.clientConfiguration&&e.clientConfiguration.forceRelay===Lp.ENABLED&&(r.iceTransportPolicy="relay"),r.sdpSemantics="unified-plan",r.continualGatheringPolicy="gather_continually",r}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(mw,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(gw,{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,t,r){return Vg(this,void 0,void 0,function*(){if(ok())return yield this.createTransceiverRTCRtpSender(e,t,r);if(ak())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new If("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,t,r,i){return Vg(this,void 0,void 0,function*(){if(ok())return this.createSimulcastTransceiverSender(e,t,r,i);if(ak())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new If("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,t,r){return Vg(this,void 0,void 0,function*(){if(!this.pcManager)throw new If("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),zk(e)&&(e.codec=t.videoCodec);const n={direction:"sendonly",streams:i};return r&&(n.sendEncodings=r),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,n)).sender})}createSimulcastTransceiverSender(e,t,r,i){return Vg(this,void 0,void 0,function*(){if(!this.pcManager)throw new If("publisher is closed");const n={direction:"sendonly"};i&&(n.sendEncodings=i);const o=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,n);if(r.videoCodec)return e.setSimulcastTrackSender(r.videoCodec,o.sender),o.sender})}createRTCRtpSender(e){return Vg(this,void 0,void 0,function*(){if(!this.pcManager)throw new If("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return Vg(this,void 0,void 0,function*(){var t,r,i;if(!this._isClosed)if(this.attemptingReconnect)zg.warn("already attempting reconnect, returning early",this.logContext);else{(null===(t=this.clientConfiguration)||void 0===t?void 0:t.resumeConnection)!==Lp.DISABLED&&(null!==(i=null===(r=this.pcManager)||void 0===r?void 0:r.currentState)&&void 0!==i?i:Fb.NEW)!==Fb.NEW||(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(VT){this.reconnectAttempts+=1;let t=!0;VT instanceof If?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:VT})),t=!1):VT instanceof Pw||(this.fullReconnectOnNext=!0),t?this.handleDisconnect("reconnect",zp.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(kf.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(VT){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:VT}))}return null}restartConnection(e){return Vg(this,void 0,void 0,function*(){var t,r,i;try{if(!this.url||!this.token)throw new If("could not reconnect, url or token not saved");let r;this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(kf.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Pw;r=yield this.join(null!=e?e:this.url,this.token,this.signalOpts)}catch(VT){if(VT instanceof Sf&&VT.reason===af.NotAllowed)throw new If("could not reconnect, token might be expired");throw new Pw}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(kf.SignalRestarted,r),yield this.waitForPCReconnected(),this.client.currentState!==lb.CONNECTED)throw new Pw("Signal connection got severed during reconnect");null===(t=this.regionUrlProvider)||void 0===t||t.resetAttempts(),this.emit(kf.Restarted)}catch(n){const e=yield null===(r=this.regionUrlProvider)||void 0===r?void 0:r.getNextBestRegionUrl();if(e)return void(yield this.restartConnection(e));throw null===(i=this.regionUrlProvider)||void 0===i||i.resetAttempts(),n}})}resumeConnection(e){return Vg(this,void 0,void 0,function*(){var t;if(!this.url||!this.token)throw new If("could not reconnect, url or token not saved");if(!this.pcManager)throw new If("publisher and subscriber connections unset");let r;this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(kf.Resuming);try{this.setupSignalClientCallbacks(),r=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let e="";if(i instanceof Error&&(e=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof Sf&&i.reason===af.NotAllowed)throw new If("could not reconnect, token might be expired");if(i instanceof Sf&&i.reason===af.LeaveRequest)throw i;throw new Pw(e)}if(this.emit(kf.SignalResumed),r){const e=this.makeRTCConfiguration(r);this.pcManager.updateConfiguration(e),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=r.serverInfo)}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!==lb.CONNECTED)throw new Pw("Signal connection got severed during reconnect");this.client.setReconnected(),"open"===(null===(t=this.reliableDC)||void 0===t?void 0:t.readyState)&&null===this.reliableDC.id&&this.createDataChannels(),(null==r?void 0:r.lastMessageSeq)&&this.resendReliableMessagesForResume(r.lastMessageSeq),this.emit(kf.Resumed)})}waitForPCInitialConnection(e,t){return Vg(this,void 0,void 0,function*(){if(!this.pcManager)throw new If("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(t,e)})}waitForPCReconnected(){return Vg(this,void 0,void 0,function*(){this.pcState=fw.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield nk(2e3),!this.pcManager)throw new If("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=fw.Connected}catch(VT){throw this.pcState=fw.Disconnected,new Sf("could not establish PC connection, ".concat(VT.message),af.InternalError)}})}publishRpcResponse(e,t,r,i){return Vg(this,void 0,void 0,function*(){const n=new Qp({destinationIdentities:[e],kind:Xp.RELIABLE,value:{case:"rpcResponse",value:new um({requestId:t,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:null!=r?r:""}})}});yield this.sendDataPacket(n,Xp.RELIABLE)})}publishRpcAck(e,t){return Vg(this,void 0,void 0,function*(){const r=new Qp({destinationIdentities:[e],kind:Xp.RELIABLE,value:{case:"rpcAck",value:new dm({requestId:t})}});yield this.sendDataPacket(r,Xp.RELIABLE)})}sendDataPacket(e,t){return Vg(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(t),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const t=function(e){var t,r,i,n,o;if("sipDtmf"!==(null===(t=e.value)||void 0===t?void 0:t.case)&&"metrics"!==(null===(r=e.value)||void 0===r?void 0:r.case)&&"speaker"!==(null===(i=e.value)||void 0===i?void 0:i.case)&&"transcription"!==(null===(n=e.value)||void 0===n?void 0:n.case)&&"encryptedPacket"!==(null===(o=e.value)||void 0===o?void 0:o.case))return new tm({value:e.value})}(e);if(t){const r=yield this.e2eeManager.encryptData(t.toBinary());e.value={case:"encryptedPacket",value:new em({encryptedValue:r.payload,iv:r.iv,keyIndex:r.keyIndex})}}}t===Xp.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const r=e.toBinary(),i=this.dataChannelForKind(t);if(i){if(t===Xp.RELIABLE&&this.reliableMessageBuffer.push({data:r,sequence:e.sequence}),this.attemptingReconnect)return;i.send(r)}this.updateAndEmitDCBufferStatus(t)})}resendReliableMessagesForResume(e){return Vg(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(Xp.RELIABLE);const t=this.dataChannelForKind(Xp.RELIABLE);t&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(e=>{t.send(e.data)})),this.updateAndEmitDCBufferStatus(Xp.RELIABLE)})}waitForBufferStatusLow(e){return new Promise((t,r)=>Vg(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))t();else{const i=()=>r("Engine closed");for(this.once(kf.Closing,i);!this.dcBufferStatus.get(e);)yield nk(10);this.off(kf.Closing,i),t()}}))}ensureDataTransportConnected(e){return Vg(this,arguments,void 0,function(e){var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.subscriberPrimary;return function*(){var i;if(!t.pcManager)throw new If("PC manager is closed");const n=r?t.pcManager.subscriber:t.pcManager.publisher,o=r?"Subscriber":"Publisher";if(!n)throw new Sf("".concat(o," connection not set"),af.InternalError);let a=!1;r||t.dataChannelForKind(e,r)||(t.createDataChannels(),a=!0),a||r||t.pcManager.publisher.isICEConnected||"checking"===t.pcManager.publisher.getICEConnectionState()||(a=!0),a&&t.negotiate().catch(e=>{zg.error(e,t.logContext)});const s=t.dataChannelForKind(e,r);if("open"===(null==s?void 0:s.readyState))return;const l=(new Date).getTime()+t.peerConnectionTimeout;for(;(new Date).getTime()<l;){if(n.isICEConnected&&"open"===(null===(i=t.dataChannelForKind(e,r))||void 0===i?void 0:i.readyState))return;yield nk(50)}throw new Sf("could not establish ".concat(o," connection, state: ").concat(n.getICEConnectionState()),af.InternalError)}()})}ensurePublisherConnected(e){return Vg(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!!this.pcManager&&this.pcManager.currentState===Fb.CONNECTED&&!(!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return Vg(this,void 0,void 0,function*(){return new Promise((e,t)=>Vg(this,void 0,void 0,function*(){if(!this.pcManager)return void t(new Pf("PC manager is closed"));this.pcManager.requirePublisher(),0!=this.pcManager.publisher.getTransceivers().length||this.lossyDC||this.reliableDC||this.createDataChannels();const r=new AbortController,i=()=>{r.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&t("cannot negotiate on closed engine"),this.on(kf.Closing,i),this.pcManager.publisher.once(Pb,e=>{const t=new Map;e.forEach(e=>{const r=e.codec.toLowerCase();var i;i=r,Zf.includes(i)&&t.set(e.payload,r)}),this.emit(kf.RTPVideoMapUpdate,t)});try{yield this.pcManager.negotiate(r),e()}catch(VT){VT instanceof Pf&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",zp.RR_UNKNOWN),t(VT)}finally{this.off(kf.Closing,i)}}))})}dataChannelForKind(e,t){if(t){if(e===Xp.LOSSY)return this.lossyDCSub;if(e===Xp.RELIABLE)return this.reliableDCSub}else{if(e===Xp.LOSSY)return this.lossyDC;if(e===Xp.RELIABLE)return this.reliableDC}}sendSyncState(e,t){var r,i;if(!this.pcManager)return void this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);const n=this.pcManager.subscriber.getLocalDescription(),o=this.pcManager.subscriber.getRemoteDescription(),a=null===(i=null===(r=this.signalOpts)||void 0===r?void 0:r.autoSubscribe)||void 0===i||i,s=new Array,l=new Array;e.forEach(e=>{e.isDesired!==a&&s.push(e.trackSid),e.isEnabled||l.push(e.trackSid)}),this.client.sendSyncState(new pg({answer:n?hb({sdp:n.sdp,type:n.type}):void 0,offer:o?hb({sdp:o.sdp,type:o.type}):void 0,subscription:new $m({trackSids:s,subscribe:!a,participantTracks:[]}),publishTracks:Kk(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:l,datachannelReceiveStates:this.reliableReceivedState.map((e,t)=>new mg({publisherSid:t,lastSeq:e}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],t=(t,r)=>{void 0!==(null==t?void 0:t.id)&&null!==t.id&&e.push(new gg({label:t.label,id:t.id,target:r}))};return t(this.dataChannelForKind(Xp.LOSSY),Pm.PUBLISHER),t(this.dataChannelForKind(Xp.RELIABLE),Pm.PUBLISHER),t(this.dataChannelForKind(Xp.LOSSY,!0),Pm.SUBSCRIBER),t(this.dataChannelForKind(Xp.RELIABLE,!0),Pm.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Uf.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){pk()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){pk()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Pw extends Error{}function Mw(e,t){const r=e.participantIdentity?e.participantIdentity:t.participantIdentity;e.participantIdentity=r,t.participantIdentity=r;const i=0!==e.destinationIdentities.length?e.destinationIdentities:t.destinationIdentities;e.destinationIdentities=i,t.destinationIdentities=i}class Aw{constructor(e,t){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=t}updateToken(e){this.token=e}isCloud(){return gk(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return Vg(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 t=this.regionSettings.regions.filter(e=>!this.attemptedRegions.find(t=>t.url===e.url));if(t.length>0){const e=t[0];return this.attemptedRegions.push(e),zg.debug("next region: ".concat(e.region)),e.url}return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return Vg(this,void 0,void 0,function*(){const t=yield fetch("".concat((r=this.serverUrl,"".concat(r.protocol.replace("ws","http"),"//").concat(r.host,"/settings")),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});var r;if(t.ok){const e=yield t.json();return this.lastUpdateAt=Date.now(),e}throw new Sf("Could not fetch region settings: ".concat(t.statusText),401===t.status?af.NotAllowed:af.InternalError,t.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}class Rw{get info(){return this._info}validateBytesReceived(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("number"==typeof this.totalByteSize&&0!==this.totalByteSize){if(e&&this.bytesReceived<this.totalByteSize)throw new Rf("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),lf.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new Rf("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),lf.LengthExceeded)}}constructor(e,t,r,i){this.reader=t,this.totalByteSize=r,this._info=e,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=i}}class Ow extends Rw{handleChunkReceived(e){var t;this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const r=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,r)}[Symbol.asyncIterator](){const e=this.reader.getReader();let t=new Pk,r=null,i=null;if(this.signal){const e=this.signal;i=()=>{var r;null===(r=t.reject)||void 0===r||r.call(t,e.reason)},e.addEventListener("abort",i),r=e}const n=()=>{e.releaseLock(),r&&i&&r.removeEventListener("abort",i),this.signal=void 0};return{next:()=>Vg(this,void 0,void 0,function*(){var r,i;try{const{done:n,value:o}=yield Promise.race([e.read(),t.promise,null!==(i=null===(r=this.outOfBandFailureRejectingFuture)||void 0===r?void 0:r.promise)&&void 0!==i?i:new Promise(()=>{})]);return n?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(o),{done:!1,value:o.content})}catch(o){throw n(),o}}),return(){return Vg(this,void 0,void 0,function*(){return n(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return Vg(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){var r,i,n,o;let a=new Set;const s=t.signal?e.withAbortSignal(t.signal):e;try{for(var l,c=!0,d=qg(s);!(r=(l=yield d.next()).done);c=!0){o=l.value,c=!1;const e=o;a.add(e)}}catch(u){i={error:u}}finally{try{c||r||!(n=d.return)||(yield n.call(d))}finally{if(i)throw i.error}}return Array.from(a)}()})}}class Dw extends Rw{constructor(e,t,r,i){super(e,t,r,i),this.receivedChunks=new Map}handleChunkReceived(e){var t;const r=Ok(e.chunkIndex),i=this.receivedChunks.get(r);if(i&&i.version>e.version)return;this.receivedChunks.set(r,e),this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader(),t=new TextDecoder("utf-8",{fatal:!0});let r=new Pk,i=null,n=null;if(this.signal){const e=this.signal;n=()=>{var t;null===(t=r.reject)||void 0===t||t.call(r,e.reason)},e.addEventListener("abort",n),i=e}const o=()=>{e.releaseLock(),i&&n&&i.removeEventListener("abort",n),this.signal=void 0};return{next:()=>Vg(this,void 0,void 0,function*(){var i,n;try{const{done:o,value:s}=yield Promise.race([e.read(),r.promise,null!==(n=null===(i=this.outOfBandFailureRejectingFuture)||void 0===i?void 0:i.promise)&&void 0!==n?n:new Promise(()=>{})]);if(o)return this.validateBytesReceived(!0),{done:!0,value:void 0};{let e;this.handleChunkReceived(s);try{e=t.decode(s.content)}catch(a){throw new Rf("Cannot decode datastream chunk ".concat(s.chunkIndex," as text: ").concat(a),lf.DecodeFailed)}return{done:!1,value:e}}}catch(a){throw o(),a}}),return(){return Vg(this,void 0,void 0,function*(){return o(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return Vg(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){var r,i,n,o;let a="";const s=t.signal?e.withAbortSignal(t.signal):e;try{for(var l,c=!0,d=qg(s);!(r=(l=yield d.next()).done);c=!0)o=l.value,c=!1,a+=o}catch(u){i={error:u}}finally{try{c||r||!(n=d.return)||(yield n.call(d))}finally{if(i)throw i.error}}return a}()})}}class Lw{constructor(){this.log=zg,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map}registerTextStreamHandler(e,t){if(this.textStreamHandlers.has(e))throw new Rf('A text stream handler for topic "'.concat(e,'" has already been set.'),lf.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,t)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,t){if(this.byteStreamHandlers.has(e))throw new Rf('A byte stream handler for topic "'.concat(e,'" has already been set.'),lf.HandlerAlreadyRegistered);this.byteStreamHandlers.set(e,t)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}clearHandlersAndControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear(),this.byteStreamHandlers.clear(),this.textStreamHandlers.clear()}validateParticipantHasNoActiveDataStreams(e){var t,r,i,n;const o=Array.from(this.textStreamControllers.entries()).filter(t=>t[1].sendingParticipantIdentity===e),a=Array.from(this.byteStreamControllers.entries()).filter(t=>t[1].sendingParticipantIdentity===e);if(o.length>0||a.length>0){const s=new Rf("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),lf.AbnormalEnd);for(const[e,i]of a)null===(r=(t=i.outOfBandFailureRejectingFuture).reject)||void 0===r||r.call(t,s),this.byteStreamControllers.delete(e);for(const[e,t]of o)null===(n=(i=t.outOfBandFailureRejectingFuture).reject)||void 0===n||n.call(i,s),this.textStreamControllers.delete(e)}}handleDataStreamPacket(e,t){return Vg(this,void 0,void 0,function*(){switch(e.value.case){case"streamHeader":return this.handleStreamHeader(e.value.value,e.participantIdentity,t);case"streamChunk":return this.handleStreamChunk(e.value.value,t);case"streamTrailer":return this.handleStreamTrailer(e.value.value,t);default:throw new Error('DataPacket of value "'.concat(e.value.case,'" is not data stream related!'))}})}handleStreamHeader(e,t,r){return Vg(this,void 0,void 0,function*(){var i;if("byteHeader"===e.contentHeader.case){const n=this.byteStreamHandlers.get(e.topic);if(!n)return void this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);let o;const a=new Pk;a.promise.catch(e=>{this.log.error(e)});const s={id:e.streamId,name:null!==(i=e.contentHeader.value.name)&&void 0!==i?i:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Ok(e.timestamp),attributes:e.attributes,encryptionType:r},l=new ReadableStream({start:r=>{if(o=r,this.textStreamControllers.has(e.streamId))throw new Rf("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),lf.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:s,controller:o,startTime:Date.now(),sendingParticipantIdentity:t,outOfBandFailureRejectingFuture:a})}});n(new Ow(s,l,Ok(e.totalLength),a),{identity:t})}else if("textHeader"===e.contentHeader.case){const i=this.textStreamHandlers.get(e.topic);if(!i)return void this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);let n;const o=new Pk;o.promise.catch(e=>{this.log.error(e)});const a={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes,encryptionType:r},s=new ReadableStream({start:r=>{if(n=r,this.textStreamControllers.has(e.streamId))throw new Rf("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),lf.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:a,controller:n,startTime:Date.now(),sendingParticipantIdentity:t,outOfBandFailureRejectingFuture:o})}});i(new Dw(a,s,Ok(e.totalLength),o),{identity:t})}})}handleStreamChunk(e,t){const r=this.byteStreamControllers.get(e.streamId);r&&(r.info.encryptionType!==t?(r.controller.error(new Rf("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(r.info.encryptionType),lf.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId)):e.content.length>0&&r.controller.enqueue(e));const i=this.textStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==t?(i.controller.error(new Rf("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(i.info.encryptionType),lf.EncryptionTypeMismatch)),this.textStreamControllers.delete(e.streamId)):e.content.length>0&&i.controller.enqueue(e))}handleStreamTrailer(e,t){const r=this.textStreamControllers.get(e.streamId);r&&(r.info.encryptionType!==t?r.controller.error(new Rf("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(r.info.encryptionType),lf.EncryptionTypeMismatch)):(r.info.attributes=Object.assign(Object.assign({},r.info.attributes),e.attributes),r.controller.close(),this.textStreamControllers.delete(e.streamId)));const i=this.byteStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==t?i.controller.error(new Rf("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(i.info.encryptionType),lf.EncryptionTypeMismatch)):(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),e.attributes),i.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class Nw{constructor(e,t,r){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=r,this.info=t}write(e){return this.defaultWriter.write(e)}close(){return Vg(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),null===(e=this.onClose)||void 0===e||e.call(this)})}}class zw extends Nw{}class jw extends Nw{}class Uw{constructor(e,t){this.engine=e,this.log=t}setupEngine(e){this.engine=e}sendText(e,t){return Vg(this,void 0,void 0,function*(){var r;const i=crypto.randomUUID(),n=(new TextEncoder).encode(e).byteLength,o=null===(r=null==t?void 0:t.attachments)||void 0===r?void 0:r.map(()=>crypto.randomUUID()),a=new Array(o?o.length+1:1).fill(0),s=(e,r)=>{var i;a[r]=e;const n=a.reduce((e,t)=>e+t,0);null===(i=null==t?void 0:t.onProgress)||void 0===i||i.call(t,n)},l=yield this.streamText({streamId:i,totalSize:n,destinationIdentities:null==t?void 0:t.destinationIdentities,topic:null==t?void 0:t.topic,attachedStreamIds:o,attributes:null==t?void 0:t.attributes});return yield l.write(e),s(1,0),yield l.close(),(null==t?void 0:t.attachments)&&o&&(yield Promise.all(t.attachments.map((e,r)=>Vg(this,void 0,void 0,function*(){return this._sendFile(o[r],e,{topic:t.topic,mimeType:e.type,onProgress:e=>{s(e,r+1)}})})))),l.info})}streamText(e){return Vg(this,void 0,void 0,function*(){var t,r,i;const n=null!==(t=null==e?void 0:e.streamId)&&void 0!==t?t:crypto.randomUUID(),o={id:n,mimeType:"text/plain",timestamp:Date.now(),topic:null!==(r=null==e?void 0:e.topic)&&void 0!==r?r:"",size:null==e?void 0:e.totalSize,attributes:null==e?void 0:e.attributes,encryptionType:(null===(i=this.engine.e2eeManager)||void 0===i?void 0:i.isDataChannelEncryptionEnabled)?Gp.GCM:Gp.NONE},a=new Tm({streamId:n,mimeType:o.mimeType,topic:o.topic,timestamp:Dk(o.timestamp),totalLength:Dk(null==e?void 0:e.totalSize),attributes:o.attributes,contentHeader:{case:"textHeader",value:new Cm({version:null==e?void 0:e.version,attachedStreamIds:null==e?void 0:e.attachedStreamIds,replyToStreamId:null==e?void 0:e.replyToStreamId,operationType:"update"===(null==e?void 0:e.type)?xm.UPDATE:xm.CREATE})}}),s=null==e?void 0:e.destinationIdentities,l=new Qp({destinationIdentities:s,value:{case:"streamHeader",value:a}});yield this.engine.sendDataPacket(l,Xp.RELIABLE);let c=0;const d=this.engine,u=new WritableStream({write(e){return Vg(this,void 0,void 0,function*(){for(const t of function(e){const t=[];let r=(new TextEncoder).encode(e);for(;r.length>15e3;){let e=15e3;for(;e>0;){const t=r[e];if(void 0!==t&&128!=(192&t))break;e--}t.push(r.slice(0,e)),r=r.slice(e)}return r.length>0&&t.push(r),t}(e)){yield d.waitForBufferStatusLow(Xp.RELIABLE);const e=new Em({content:t,streamId:n,chunkIndex:Dk(c)}),r=new Qp({destinationIdentities:s,value:{case:"streamChunk",value:e}});yield d.sendDataPacket(r,Xp.RELIABLE),c+=1}})},close(){return Vg(this,void 0,void 0,function*(){const e=new _m({streamId:n}),t=new Qp({destinationIdentities:s,value:{case:"streamTrailer",value:e}});yield d.sendDataPacket(t,Xp.RELIABLE)})},abort(e){}});let h=()=>Vg(this,void 0,void 0,function*(){yield p.close()});d.once(kf.Closing,h);const p=new zw(u,o,()=>this.engine.off(kf.Closing,h));return p})}sendFile(e,t){return Vg(this,void 0,void 0,function*(){const r=crypto.randomUUID();return yield this._sendFile(r,e,t),{id:r}})}_sendFile(e,t,r){return Vg(this,void 0,void 0,function*(){var i;const n=yield this.streamBytes({streamId:e,totalSize:t.size,name:t.name,mimeType:null!==(i=null==r?void 0:r.mimeType)&&void 0!==i?i:t.type,topic:null==r?void 0:r.topic,destinationIdentities:null==r?void 0:r.destinationIdentities}),o=t.stream().getReader();for(;;){const{done:e,value:t}=yield o.read();if(e)break;yield n.write(t)}return yield n.close(),n.info})}streamBytes(e){return Vg(this,void 0,void 0,function*(){var t,r,i,n,o,a;const s=null!==(t=null==e?void 0:e.streamId)&&void 0!==t?t:crypto.randomUUID(),l=null==e?void 0:e.destinationIdentities,c={id:s,mimeType:null!==(r=null==e?void 0:e.mimeType)&&void 0!==r?r:"application/octet-stream",topic:null!==(i=null==e?void 0:e.topic)&&void 0!==i?i:"",timestamp:Date.now(),attributes:null==e?void 0:e.attributes,size:null==e?void 0:e.totalSize,name:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:"unknown",encryptionType:(null===(o=this.engine.e2eeManager)||void 0===o?void 0:o.isDataChannelEncryptionEnabled)?Gp.GCM:Gp.NONE},d=new Tm({totalLength:Dk(null!==(a=c.size)&&void 0!==a?a:0),mimeType:c.mimeType,streamId:s,topic:c.topic,timestamp:Dk(Date.now()),attributes:c.attributes,contentHeader:{case:"byteHeader",value:new Sm({name:c.name})}}),u=new Qp({destinationIdentities:l,value:{case:"streamHeader",value:d}});yield this.engine.sendDataPacket(u,Xp.RELIABLE);let h=0;const p=new Ju,m=this.engine,g=this.log,v=new WritableStream({write(e){return Vg(this,void 0,void 0,function*(){const t=yield p.lock();let r=0;try{for(;r<e.byteLength;){const t=e.slice(r,r+15e3);yield m.waitForBufferStatusLow(Xp.RELIABLE);const i=new Qp({destinationIdentities:l,value:{case:"streamChunk",value:new Em({content:t,streamId:s,chunkIndex:Dk(h)})}});yield m.sendDataPacket(i,Xp.RELIABLE),h+=1,r+=t.byteLength}}finally{t()}})},close(){return Vg(this,void 0,void 0,function*(){const e=new _m({streamId:s}),t=new Qp({destinationIdentities:l,value:{case:"streamTrailer",value:e}});yield m.sendDataPacket(t,Xp.RELIABLE)})},abort(e){g.error("Sink error:",e)}});return new jw(v,c)})}}class Fw extends qf{constructor(e,t,r,i,n){super(e,r,n),this.sid=t,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?wf.Muted:wf.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const t=r=>{r.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",t),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(wf.Ended,this))};e.addEventListener("removetrack",t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return Vg(this,void 0,void 0,function*(){var e;if(null===(e=this.receiver)||void 0===e?void 0:e.getStats)return yield this.receiver.getStats()})}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(),Wb)),"undefined"!=typeof RTCRtpReceiver&&"getSynchronizationSources"in RTCRtpReceiver&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var t;this.timeSyncHandle=requestAnimationFrame(()=>e());const r=null===(t=this.receiver)||void 0===t?void 0:t.getSynchronizationSources()[0];if(r){const{timestamp:e,rtpTimestamp:t}=r;t&&this.rtpTimestamp!==t&&(this.emit(wf.TimeSyncUpdate,{timestamp:e,rtpTimestamp:t}),this.rtpTimestamp=t)}};e()}}class Bw extends Fw{constructor(e,t,r,i,n,o){super(e,t,qf.Kind.Audio,r,o),this.monitorReceiver=()=>Vg(this,void 0,void 0,function*(){if(!this.receiver)return void(this._currentBitrate=0);const e=yield this.getReceiverStats();e&&this.prevStats&&this.receiver&&(this._currentBitrate=Gb(e,this.prevStats)),this.prevStats=e}),this.audioContext=i,this.webAudioPluginNodes=[],n&&(this.sinkId=n.deviceId)}setVolume(e){var t;for(const r of this.attachedElements)this.audioContext?null===(t=this.gainNode)||void 0===t||t.gain.setTargetAtTime(e,0,.1):r.volume=e;mk()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(mk())return 1;let e=0;return this.attachedElements.forEach(t=>{t.volume>e&&(e=t.volume)}),e}setSinkId(e){return Vg(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(t=>{if(lk(t))return t.setSinkId(e)}))})}attach(e){const t=0===this.attachedElements.length;return e?super.attach(e):e=super.attach(),this.sinkId&&lk(e)&&e.setSinkId(this.sinkId).catch(e=>{this.log.error("Failed to set sink id on remote audio track",e,this.logContext)}),this.audioContext&&t&&(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 t;return e?(t=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}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,t){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(t.srcObject);let r=this.sourceNode;this.webAudioPluginNodes.forEach(e=>{r.connect(e),r=e}),this.gainNode=e.createGain(),r.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),"running"!==e.state&&e.resume().then(()=>{"running"!==e.state&&this.emit(wf.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(e=>{this.emit(wf.AudioPlaybackFailed,e)})}disconnectWebAudio(){var e,t;null===(e=this.gainNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return Vg(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;let e;return(yield this.receiver.getStats()).forEach(t=>{"inbound-rtp"===t.type&&(e={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration})}),e})}}class Vw extends Fw{constructor(e,t,r,i,n){super(e,t,qf.Kind.Video,r,n),this.elementInfos=[],this.monitorReceiver=()=>Vg(this,void 0,void 0,function*(){if(!this.receiver)return void(this._currentBitrate=0);const e=yield this.getReceiverStats();e&&this.prevStats&&this.receiver&&(this._currentBitrate=Gb(e,this.prevStats)),this.prevStats=e}),this.debouncedHandleResize=Eb(()=>{this.updateDimensions()},100),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return void 0!==this.adaptiveStreamSettings}setStreamState(e){super.setStreamState(e),e===qf.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(t=>{e?Hf(this._mediaStreamTrack,t):$f(this._mediaStreamTrack,t)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&void 0===this.elementInfos.find(t=>t.element===e)){const t=new qw(e);this.observeElementInfo(t)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&void 0===this.elementInfos.find(t=>t===e)?(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)return void this.log.warn("stopObservingElementInfo ignored",this.logContext);const t=this.elementInfos.filter(t=>t===e);for(const r of t)r.stopObserving();this.elementInfos=this.elementInfos.filter(t=>t!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let t=[];if(e)return this.stopObservingElement(e),super.detach(e);t=super.detach();for(const r of t)this.stopObservingElement(r);return t}getDecoderImplementation(){var e;return null===(e=this.prevStats)||void 0===e?void 0:e.decoderImplementation}getReceiverStats(){return Vg(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t,r="",i=new Map;return e.forEach(e=>{"inbound-rtp"===e.type?(r=e.codecId,t={type:"video",streamId:e.id,framesDecoded:e.framesDecoded,framesDropped:e.framesDropped,framesReceived:e.framesReceived,packetsReceived:e.packetsReceived,packetsLost:e.packetsLost,frameWidth:e.frameWidth,frameHeight:e.frameHeight,pliCount:e.pliCount,firCount:e.firCount,nackCount:e.nackCount,jitter:e.jitter,timestamp:e.timestamp,bytesReceived:e.bytesReceived,decoderImplementation:e.decoderImplementation}):"codec"===e.type&&i.set(e.id,e)}),t&&""!==r&&i.get(r)&&(t.mimeType=i.get(r).mimeType),t})}stopObservingElement(e){const t=this.elementInfos.filter(t=>t.element===e);for(const r of t)this.stopObservingElementInfo(r)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return Vg(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(e){var t,r;const i=this.elementInfos.reduce((e,t)=>Math.max(e,t.visibilityChangedAt||0),0),n=!(null!==(r=null===(t=this.adaptiveStreamSettings)||void 0===t?void 0:t.pauseVideoInBackground)&&void 0!==r&&!r)&&this.isInBackground,o=this.elementInfos.some(e=>e.pictureInPicture),a=this.elementInfos.some(e=>e.visible)&&!n||o;(this.lastVisible!==a||e)&&(!a&&Date.now()-i<100?Uf.setTimeout(()=>{this.updateVisibility()},100):(this.lastVisible=a,this.emit(wf.VisibilityChanged,a,this)))}updateDimensions(){var e,t;let r=0,i=0;const n=this.getPixelDensity();for(const o of this.elementInfos){const e=o.width()*n,t=o.height()*n;e+t>r+i&&(r=e,i=t)}(null===(e=this.lastDimensions)||void 0===e?void 0:e.width)===r&&(null===(t=this.lastDimensions)||void 0===t?void 0:t.height)===i||(this.lastDimensions={width:r,height:i},this.emit(wf.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const t=null===(e=this.adaptiveStreamSettings)||void 0===e?void 0:e.pixelDensity;return"screen"===t?kk():t||(kk()>2?2:1)}}class qw{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,t){this.onVisibilityChanged=e=>{var t;const{target:r,isIntersecting:i}=e;r===this.element&&(this.isIntersecting=i,this.isPiP=$w(this.element),this.visibilityChangedAt=Date.now(),null===(t=this.handleVisibilityChanged)||void 0===t||t.call(this))},this.onEnterPiP=()=>{var e,t,r;null===(t=null===(e=window.documentPictureInPicture)||void 0===e?void 0:e.window)||void 0===t||t.addEventListener("pagehide",this.onLeavePiP),this.isPiP=$w(this.element),null===(r=this.handleVisibilityChanged)||void 0===r||r.call(this)},this.onLeavePiP=()=>{var e;this.isPiP=$w(this.element),null===(e=this.handleVisibilityChanged)||void 0===e||e.call(this)},this.element=e,this.isIntersecting=null!=t?t:Hw(e),this.isPiP=pk()&&$w(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,t,r;this.isIntersecting=Hw(this.element),this.isPiP=$w(this.element),this.element.handleResize=()=>{var e;null===(e=this.handleResize)||void 0===e||e.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,Tk().observe(this.element),Ck().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),null===(e=window.documentPictureInPicture)||void 0===e||e.addEventListener("enter",this.onEnterPiP),null===(r=null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)||void 0===r||r.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,t,r,i,n;null===(e=Tk())||void 0===e||e.unobserve(this.element),null===(t=Ck())||void 0===t||t.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),null===(r=window.documentPictureInPicture)||void 0===r||r.removeEventListener("enter",this.onEnterPiP),null===(n=null===(i=window.documentPictureInPicture)||void 0===i?void 0:i.window)||void 0===n||n.removeEventListener("pagehide",this.onLeavePiP)}}function $w(e){var t,r;return document.pictureInPictureElement===e||!!(null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)&&Hw(e,null===(r=window.documentPictureInPicture)||void 0===r?void 0:r.window)}function Hw(e,t){const r=t||window;let i=e.offsetTop,n=e.offsetLeft;const o=e.offsetWidth,a=e.offsetHeight,{hidden:s}=e,{display:l}=getComputedStyle(e);for(;e.offsetParent;)i+=(e=e.offsetParent).offsetTop,n+=e.offsetLeft;return i<r.pageYOffset+r.innerHeight&&n<r.pageXOffset+r.innerWidth&&i+a>r.pageYOffset&&n+o>r.pageXOffset&&!s&&"none"!==l}class Ww extends Wg.EventEmitter{constructor(e,t,r,i){var n;super(),this.metadataMuted=!1,this.encryption=Gp.NONE,this.log=zg,this.handleMuted=()=>{this.emit(wf.Muted)},this.handleUnmuted=()=>{this.emit(wf.Unmuted)},this.log=jg(null!==(n=null==i?void 0:i.loggerName)&&void 0!==n?n:Mg.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=t,this.trackName=r,this.source=qf.Source.Unknown}setTrack(e){this.track&&(this.track.off(wf.Muted,this.handleMuted),this.track.off(wf.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(wf.Muted,this.handleMuted),e.on(wf.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},null===(e=this.loggerContextCb)||void 0===e?void 0:e.call(this)),Yk(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return void 0!==this.track}get isEncrypted(){return this.encryption!==Gp.NONE}get audioTrack(){if(Nk(this.track))return this.track}get videoTrack(){if(zk(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=qf.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===qf.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}))}}(ww=(bw=Ww||(Ww={})).SubscriptionStatus||(bw.SubscriptionStatus={})).Desired="desired",ww.Subscribed="subscribed",ww.Unsubscribed="unsubscribed",(yw=bw.PermissionStatus||(bw.PermissionStatus={})).Allowed="allowed",yw.NotAllowed="not_allowed";class Gw extends Ww{get isUpstreamPaused(){var e;return null===(e=this.track)||void 0===e?void 0:e.isUpstreamPaused}constructor(e,t,r,i){super(e,t.sid,t.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(wf.Ended)},this.handleCpuConstrained=()=>{this.track&&zk(this.track)&&this.emit(wf.CpuConstrained,this.track)},this.updateInfo(t),this.setTrack(r)}setTrack(e){this.track&&(this.track.off(wf.Ended,this.handleTrackEnded),this.track.off(wf.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(wf.Ended,this.handleTrackEnded),e.on(wf.CpuConstrained,this.handleCpuConstrained))}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 Vg(this,void 0,void 0,function*(){var e;return null===(e=this.track)||void 0===e?void 0:e.mute()})}unmute(){return Vg(this,void 0,void 0,function*(){var e;return null===(e=this.track)||void 0===e?void 0:e.unmute()})}pauseUpstream(){return Vg(this,void 0,void 0,function*(){var e;yield null===(e=this.track)||void 0===e?void 0:e.pauseUpstream()})}resumeUpstream(){return Vg(this,void 0,void 0,function*(){var e;yield null===(e=this.track)||void 0===e?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(Nk(this.track)){const t=this.track.getSourceTrackSettings(),r=new Set;return t.autoGainControl&&r.add(Up.TF_AUTO_GAIN_CONTROL),t.echoCancellation&&r.add(Up.TF_ECHO_CANCELLATION),t.noiseSuppression&&r.add(Up.TF_NOISE_SUPPRESSION),t.channelCount&&t.channelCount>1&&r.add(Up.TF_STEREO),(null===(e=this.options)||void 0===e?void 0:e.dtx)||r.add(Up.TF_NO_DTX),this.track.enhancedNoiseCancellation&&r.add(Up.TF_ENHANCED_NOISE_CANCELLATION),Array.from(r.values())}return[]}}function Zw(e,t){return Vg(this,void 0,void 0,function*(){null!=e||(e={});let r=!1;const{audioProcessor:i,videoProcessor:n,optionsWithoutProcessor:o}=Qk(e);let a=o.audio,s=o.video;if(i&&"object"==typeof o.audio&&(o.audio.processor=i),n&&"object"==typeof o.video&&(o.video.processor=n),e.audio&&"object"==typeof o.audio&&"string"==typeof o.audio.deviceId){const e=o.audio.deviceId;o.audio.deviceId={exact:e},r=!0,a=Object.assign(Object.assign({},o.audio),{deviceId:{ideal:e}})}if(o.video&&"object"==typeof o.video&&"string"==typeof o.video.deviceId){const e=o.video.deviceId;o.video.deviceId={exact:e},r=!0,s=Object.assign(Object.assign({},o.video),{deviceId:{ideal:e}})}(!0===o.audio||"object"==typeof o.audio&&!o.audio.deviceId)&&(o.audio={deviceId:"default"}),!0===o.video?o.video={deviceId:"default"}:"object"!=typeof o.video||o.video.deviceId||(o.video.deviceId="default");const l=qk(o,Nb,zb),c=Hk(l),d=navigator.mediaDevices.getUserMedia(c);o.audio&&(rb.userMediaPromiseMap.set("audioinput",d),d.catch(()=>rb.userMediaPromiseMap.delete("audioinput"))),o.video&&(rb.userMediaPromiseMap.set("videoinput",d),d.catch(()=>rb.userMediaPromiseMap.delete("videoinput")));try{const e=yield d;return yield Promise.all(e.getTracks().map(r=>Vg(this,void 0,void 0,function*(){const o="audio"===r.kind;let a,s=o?l.audio:l.video;"boolean"!=typeof s&&s||(s={});const d=o?c.audio:c.video;"boolean"!=typeof d&&(a=d);const u=r.getSettings().deviceId;(null==a?void 0:a.deviceId)&&Mk(a.deviceId)!==u?a.deviceId=u:a||(a={deviceId:u});const h=function(e,t,r){switch(e.kind){case"audio":return new Qb(e,t,!1,void 0,r);case"video":return new dw(e,t,!1,r);default:throw new Ef("unsupported track type: ".concat(e.kind))}}(r,a,t);return h.kind===qf.Kind.Video?h.source=qf.Source.Camera:h.kind===qf.Kind.Audio&&(h.source=qf.Source.Microphone),h.mediaStream=e,Nk(h)&&i?yield h.setProcessor(i):zk(h)&&n&&(yield h.setProcessor(n)),h})))}catch(VT){if(!r)throw VT;return Zw(Object.assign(Object.assign({},e),{audio:a,video:s}),t)}})}(Cw=xw||(xw={})).Excellent="excellent",Cw.Good="good",Cw.Poor="poor",Cw.Lost="lost",Cw.Unknown="unknown";class Jw extends Wg.EventEmitter{get logContext(){var e,t;return Object.assign({},null===(t=null===(e=this.loggerOptions)||void 0===e?void 0:e.loggerContextCb)||void 0===t?void 0:t.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return(null===(e=this.permissions)||void 0===e?void 0:e.agent)||this.kind===Hp.AGENT}get isActive(){var e;return(null===(e=this.participantInfo)||void 0===e?void 0:e.state)===$p.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,t,r,i,n,o){let a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Hp.STANDARD;var s;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=xw.Unknown,this.log=zg,this.log=jg(null!==(s=null==o?void 0:o.loggerName)&&void 0!==s?s:Mg.Participant),this.loggerOptions=o,this.setMaxListeners(100),this.sid=e,this.identity=t,this.name=r,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=a,this._attributes=null!=n?n:{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,t]of this.trackPublications)if(t.source===e)return t}getTrackPublicationByName(e){for(const[,t]of this.trackPublications)if(t.trackName===e)return t}waitUntilActive(){return this.isActive?Promise.resolve():(this.activeFuture||(this.activeFuture=new Pk,this.once(vf.Active,()=>{var e,t;null===(t=null===(e=this.activeFuture)||void 0===e?void 0:e.resolve)||void 0===t||t.call(e),this.activeFuture=void 0})),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const t=this.getTrackPublication(qf.Source.Camera);return!(null===(e=null==t?void 0:t.isMuted)||void 0===e||e)}get isMicrophoneEnabled(){var e;const t=this.getTrackPublication(qf.Source.Microphone);return!(null===(e=null==t?void 0:t.isMuted)||void 0===e||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(qf.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(1e3*Number.parseInt(this.participantInfo.joinedAt.toString())):new Date}updateInfo(e){var t;return!(this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version||(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===$p.ACTIVE&&(null===(t=this.participantInfo)||void 0===t?void 0:t.state)!==$p.ACTIVE&&this.emit(vf.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,0))}_setMetadata(e){const t=this.metadata!==e,r=this.metadata;this.metadata=e,t&&this.emit(vf.ParticipantMetadataChanged,r)}_setName(e){const t=this.name!==e;this.name=e,t&&this.emit(vf.ParticipantNameChanged,e)}_setAttributes(e){const t=function(e,t){var r;void 0===e&&(e={}),void 0===t&&(t={});const i=[...Object.keys(t),...Object.keys(e)],n={};for(const o of i)e[o]!==t[o]&&(n[o]=null!==(r=t[o])&&void 0!==r?r:"");return n}(this.attributes,e);this._attributes=e,Object.keys(t).length>0&&this.emit(vf.AttributesChanged,t)}setPermissions(e){var t,r,i,n,o,a;const s=this.permissions,l=e.canPublish!==(null===(t=this.permissions)||void 0===t?void 0:t.canPublish)||e.canSubscribe!==(null===(r=this.permissions)||void 0===r?void 0:r.canSubscribe)||e.canPublishData!==(null===(i=this.permissions)||void 0===i?void 0:i.canPublishData)||e.hidden!==(null===(n=this.permissions)||void 0===n?void 0:n.hidden)||e.recorder!==(null===(o=this.permissions)||void 0===o?void 0:o.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((e,t)=>{var r;return e!==(null===(r=this.permissions)||void 0===r?void 0:r.canPublishSources[t])})||e.canSubscribeMetrics!==(null===(a=this.permissions)||void 0===a?void 0:a.canSubscribeMetrics);return this.permissions=e,l&&this.emit(vf.ParticipantPermissionsChanged,s),l}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(vf.IsSpeakingChanged,e))}setConnectionQuality(e){const t=this._connectionQuality;this._connectionQuality=function(e){switch(e){case Dp.EXCELLENT:return xw.Excellent;case Dp.GOOD:return xw.Good;case Dp.POOR:return xw.Poor;case Dp.LOST:return xw.Lost;default:return xw.Unknown}}(e),t!==this._connectionQuality&&this.emit(vf.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,t;this.activeFuture&&(null===(t=(e=this.activeFuture).reject)||void 0===t||t.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(t=>Nk(t.track)&&t.track.setAudioContext(e))}addTrackPublication(e){e.on(wf.Muted,()=>{this.emit(vf.TrackMuted,e)}),e.on(wf.Unmuted,()=>{this.emit(vf.TrackUnmuted,e)});const t=e;switch(t.track&&(t.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case qf.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case qf.Kind.Video:this.videoTrackPublications.set(e.trackSid,e)}}}class Kw extends Jw{constructor(e,t,r,i,n,o){super(e,t,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=Gp.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Pk)},this.handleReconnected=()=>{var e,t;null===(t=null===(e=this.reconnectFuture)||void 0===e?void 0:e.resolve)||void 0===t||t.call(e),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var e,t,r,i,n,o;this.reconnectFuture&&(this.reconnectFuture.promise.catch(e=>this.log.warn(e.message,this.logContext)),null===(t=null===(e=this.reconnectFuture)||void 0===e?void 0:e.reject)||void 0===t||t.call(e,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0),this.signalConnectedFuture&&(null===(i=(r=this.signalConnectedFuture).reject)||void 0===i||i.call(r,"Got disconnected without signal connected"),this.signalConnectedFuture=void 0),null===(o=null===(n=this.activeAgentFuture)||void 0===n?void 0:n.reject)||void 0===o||o.call(n,"Got disconnected without active agent present"),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=e=>{var t,r;e.participant&&this.updateInfo(e.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new Pk),null===(r=(t=this.signalConnectedFuture).resolve)||void 0===r||r.call(t)},this.handleSignalRequestResponse=e=>{const{requestId:t,reason:r,message:i}=e,n=this.pendingSignalRequests.get(t);n&&(r!==Cg.OK&&n.reject(new Af(i,r)),this.pendingSignalRequests.delete(t))},this.handleDataPacket=e=>{switch(e.value.case){case"rpcResponse":let t=e.value.value,r=null,i=null;"payload"===t.value.case?r=t.value.value:"error"===t.value.case&&(i=qb.fromProto(t.value.value)),this.handleIncomingRpcResponse(t.requestId,r,i);break;case"rpcAck":let n=e.value.value;this.handleIncomingRpcAck(n.requestId)}},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(e=>function(e){var t,r,i;if(!e.participantSid&&!e.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new cg({participantIdentity:null!==(t=e.participantIdentity)&&void 0!==t?t:"",participantSid:null!==(r=e.participantSid)&&void 0!==r?r:"",allTracks:null!==(i=e.allowAll)&&void 0!==i&&i,trackSids:e.allowedTrackSids||[]})}(e)))},this.onTrackUnmuted=e=>{this.onTrackMuted(e,e.isUpstreamPaused)},this.onTrackMuted=(e,t)=>{void 0===t&&(t=!0),e.sid?this.engine.updateMuteStatus(e.sid,t):this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),Yk(e)))},this.onTrackUpstreamPaused=e=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),Yk(e))),this.onTrackMuted(e,!0)},this.onTrackUpstreamResumed=e=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),Yk(e))),this.onTrackMuted(e,e.isMuted)},this.onTrackFeatureUpdate=e=>{const t=this.audioTrackPublications.get(e.sid);t?this.engine.client.sendUpdateLocalAudioTrack(t.trackSid,t.getTrackFeatures()):this.log.warn("Could not update local audio track settings, missing publication for track ".concat(e.sid),this.logContext)},this.onTrackCpuConstrained=(e,t)=>{this.log.debug("track cpu constrained",Object.assign(Object.assign({},this.logContext),Yk(t))),this.emit(vf.LocalTrackCpuConstrained,e,t)},this.handleSubscribedQualityUpdate=e=>Vg(this,void 0,void 0,function*(){var t,r,i,n,o;if(!(null===(o=this.roomOptions)||void 0===o?void 0:o.dynacast))return;const a=this.videoTrackPublications.get(e.trackSid);if(!a)return void this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:e.trackSid}));if(!a.videoTrack)return;const s=yield a.videoTrack.setPublishingCodecs(e.subscribedCodecs);try{for(var l,c=!0,d=qg(s);!(t=(l=yield d.next()).done);c=!0){n=l.value,c=!1;const e=n;Jf(e)&&(this.log.debug("publish ".concat(e," for ").concat(a.videoTrack.sid),Object.assign(Object.assign({},this.logContext),Yk(a))),yield this.publishAdditionalCodecForTrack(a.videoTrack,e,a.options))}}catch(u){r={error:u}}finally{try{c||t||!(i=d.return)||(yield i.call(d))}finally{if(r)throw r.error}}}),this.handleLocalTrackUnpublished=e=>{const t=this.trackPublications.get(e.trackSid);t?this.unpublishTrack(t.track):this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:e.trackSid}))},this.handleTrackEnded=e=>Vg(this,void 0,void 0,function*(){if(e.source===qf.Source.ScreenShare||e.source===qf.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),Yk(e))),this.unpublishTrack(e);else if(e.isUserProvided)yield e.mute();else if(Uk(e)||jk(e))try{if(pk())try{const t=yield null===navigator||void 0===navigator?void 0:navigator.permissions.query({name:e.source===qf.Source.Camera?"camera":"microphone"});if(t&&"denied"===t.state)throw this.log.warn("user has revoked access to ".concat(e.source),Object.assign(Object.assign({},this.logContext),Yk(e))),t.onchange=()=>{"denied"!==t.state&&(e.isMuted||e.restartTrack(),t.onchange=null)},new Error("GetUserMedia Permission denied")}catch(VT){}e.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),Yk(e))),Uk(e)?yield e.restartTrack({deviceId:"default"}):yield e.restartTrack())}catch(VT){this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),Yk(e))),yield e.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=r,this.roomOptions=i,this.setupEngine(r),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=n,this.roomOutgoingDataStreamManager=o}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==Gp.NONE}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setupEngine(e){var t;this.engine=e,this.engine.on(kf.RemoteMute,(e,t)=>{const r=this.trackPublications.get(e);r&&r.track&&(t?r.mute():r.unmute())}),(null===(t=this.signalConnectedFuture)||void 0===t?void 0:t.isResolved)&&(this.signalConnectedFuture=void 0),this.engine.on(kf.Connected,this.handleReconnected).on(kf.SignalConnected,this.handleSignalConnected).on(kf.SignalRestarted,this.handleReconnected).on(kf.SignalResumed,this.handleReconnected).on(kf.Restarting,this.handleReconnecting).on(kf.Resuming,this.handleReconnecting).on(kf.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(kf.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(kf.Closing,this.handleClosing).on(kf.SignalRequestResponse,this.handleSignalRequestResponse).on(kf.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return Vg(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return Vg(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return Vg(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return Vg(this,arguments,void 0,function(e){var t=this;let{metadata:r,name:i,attributes:n}=e;return function*(){return new Promise((e,o)=>Vg(t,void 0,void 0,function*(){var t,a;try{let s=!1;const l=yield this.engine.client.sendUpdateLocalMetadata(null!==(t=null!=r?r:this.metadata)&&void 0!==t?t:"",null!==(a=null!=i?i:this.name)&&void 0!==a?a:"",n),c=performance.now();for(this.pendingSignalRequests.set(l,{resolve:e,reject:e=>{o(e),s=!0},values:{name:i,metadata:r,attributes:n}});performance.now()-c<5e3&&!s;){if((!i||this.name===i)&&(!r||this.metadata===r)&&(!n||Object.entries(n).every(e=>{let[t,r]=e;return this.attributes[t]===r||""===r&&!this.attributes[t]})))return this.pendingSignalRequests.delete(l),void e();yield nk(50)}o(new Af("Request to update local metadata timed out","TimeoutError"))}catch(VT){VT instanceof Error&&o(VT)}}))}()})}setCameraEnabled(e,t,r){return this.setTrackEnabled(qf.Source.Camera,e,t,r)}setMicrophoneEnabled(e,t,r){return this.setTrackEnabled(qf.Source.Microphone,e,t,r)}setScreenShareEnabled(e,t,r){return this.setTrackEnabled(qf.Source.ScreenShare,e,t,r)}setE2EEEnabled(e){return Vg(this,void 0,void 0,function*(){this.encryptionType=e?Gp.GCM:Gp.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,t,r,i){return Vg(this,void 0,void 0,function*(){var n,o;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:t})),this.republishPromise&&(yield this.republishPromise);let a=this.getTrackPublication(e);if(t)if(a)yield a.unmute();else{let t;if(this.pendingPublishing.has(e)){const t=yield this.waitForPendingPublicationOfSource(e);return t||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield null==t?void 0:t.unmute(),t}this.pendingPublishing.add(e);try{switch(e){case qf.Source.Camera:t=yield this.createTracks({video:null===(n=r)||void 0===n||n});break;case qf.Source.Microphone:t=yield this.createTracks({audio:null===(o=r)||void 0===o||o});break;case qf.Source.ScreenShare:t=yield this.createScreenTracks(Object.assign({},r));break;default:throw new Ef(e)}}catch(VT){throw null==t||t.forEach(e=>{e.stop()}),VT instanceof Error&&this.emit(vf.MediaDevicesError,VT,Zk(e)),this.pendingPublishing.delete(e),VT}for(const i of t){const t=Object.assign(Object.assign({},this.roomOptions.publishDefaults),r);e===qf.Source.Microphone&&Nk(i)&&t.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),i.startPreConnectBuffer())}try{const e=[];for(const n of t)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),Yk(n))),e.push(this.publishTrack(n,i));const r=yield Promise.all(e);[a]=r}catch(VT){throw null==t||t.forEach(e=>{e.stop()}),VT}finally{this.pendingPublishing.delete(e)}}else if(!(null==a?void 0: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===qf.Source.ScreenShare){a=yield this.unpublishTrack(a.track);const e=this.getTrackPublication(qf.Source.ScreenShareAudio);e&&e.track&&this.unpublishTrack(e.track)}else yield a.mute();return a})}enableCameraAndMicrophone(){return Vg(this,void 0,void 0,function*(){if(!this.pendingPublishing.has(qf.Source.Camera)&&!this.pendingPublishing.has(qf.Source.Microphone)){this.pendingPublishing.add(qf.Source.Camera),this.pendingPublishing.add(qf.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(e=>this.publishTrack(e)))}finally{this.pendingPublishing.delete(qf.Source.Camera),this.pendingPublishing.delete(qf.Source.Microphone)}}})}createTracks(e){return Vg(this,void 0,void 0,function*(){var t,r;null!=e||(e={});const i=qk(e,null===(t=this.roomOptions)||void 0===t?void 0:t.audioCaptureDefaults,null===(r=this.roomOptions)||void 0===r?void 0:r.videoCaptureDefaults);try{return(yield Zw(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(e=>(Nk(e)&&(this.microphoneError=void 0,e.setAudioContext(this.audioContext),e.source=qf.Source.Microphone,this.emit(vf.AudioStreamAcquired)),zk(e)&&(this.cameraError=void 0,e.source=qf.Source.Camera),e))}catch(n){throw n instanceof Error&&(e.audio&&(this.microphoneError=n),e.video&&(this.cameraError=n)),n}})}createScreenTracks(e){return Vg(this,void 0,void 0,function*(){if(void 0===e&&(e={}),void 0===navigator.mediaDevices.getDisplayMedia)throw new Tf("getDisplayMedia not supported");void 0!==e.resolution||function(){const e=Lf();return"Safari"===(null==e?void 0:e.name)&&e.version.startsWith("17.")||"iOS"===(null==e?void 0:e.os)&&!!(null==e?void 0:e.osVersion)&&bk(e.osVersion,"17")>=0}()||(e.resolution=rk.h1080fps30.resolution);const t=function(e){var t,r;let i=null===(t=e.video)||void 0===t||t;return e.resolution&&e.resolution.width>0&&e.resolution.height>0&&(i="boolean"==typeof i?{}:i,i=dk()?Object.assign(Object.assign({},i),{width:{max:e.resolution.width},height:{max:e.resolution.height},frameRate:e.resolution.frameRate}):Object.assign(Object.assign({},i),{width:{ideal:e.resolution.width},height:{ideal:e.resolution.height},frameRate:e.resolution.frameRate})),{audio:null!==(r=e.audio)&&void 0!==r&&r,video:i,controller:e.controller,selfBrowserSurface:e.selfBrowserSurface,surfaceSwitching:e.surfaceSwitching,systemAudio:e.systemAudio,preferCurrentTab:e.preferCurrentTab}}(e),r=yield navigator.mediaDevices.getDisplayMedia(t),i=r.getVideoTracks();if(0===i.length)throw new Ef("no video track found");const n=new dw(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});n.source=qf.Source.ScreenShare,e.contentHint&&(n.mediaStreamTrack.contentHint=e.contentHint);const o=[n];if(r.getAudioTracks().length>0){this.emit(vf.AudioStreamAcquired);const e=new Qb(r.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});e.source=qf.Source.ScreenShareAudio,o.push(e)}return o})}publishTrack(e,t){return Vg(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,t)})}publishOrRepublishTrack(e,t){return Vg(this,arguments,void 0,function(e,t){var r=this;let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function*(){var n,o,a,s;let l,c;if(Uk(e)&&e.setAudioContext(r.audioContext),yield null===(n=r.reconnectFuture)||void 0===n?void 0:n.promise,r.republishPromise&&!i&&(yield r.republishPromise),Lk(e)&&r.pendingPublishPromises.has(e)&&(yield r.pendingPublishPromises.get(e)),e instanceof MediaStreamTrack)l=e.getConstraints();else{let t;switch(l=e.constraints,e.source){case qf.Source.Microphone:t="audioinput";break;case qf.Source.Camera:t="videoinput"}t&&r.activeDeviceMap.has(t)&&(l=Object.assign(Object.assign({},l),{deviceId:r.activeDeviceMap.get(t)}))}if(e instanceof MediaStreamTrack)switch(e.kind){case"audio":e=new Qb(e,l,!0,r.audioContext,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;case"video":e=new dw(e,l,!0,{loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});break;default:throw new Ef("unsupported MediaStreamTrack kind ".concat(e.kind))}else e.updateLoggerOptions({loggerName:r.roomOptions.loggerName,loggerContextCb:()=>r.logContext});if(r.trackPublications.forEach(t=>{t.track&&t.track===e&&(c=t)}),c)return r.log.warn("track has already been published, skipping",Object.assign(Object.assign({},r.logContext),Yk(c))),c;const d=Object.assign(Object.assign({},r.roomOptions.publishDefaults),t),u="channelCount"in e.mediaStreamTrack.getSettings()&&2===e.mediaStreamTrack.getSettings().channelCount||2===e.mediaStreamTrack.getConstraints().channelCount,h=null!==(o=d.forceStereo)&&void 0!==o?o:u;h&&(void 0===d.dtx&&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),Yk(e))),void 0===d.red&&r.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),null!==(a=d.dtx)&&void 0!==a||(d.dtx=!1),null!==(s=d.red)&&void 0!==s||(d.red=!1)),!function(){const e=Lf(),t="17.2";if(e)return"Safari"!==e.name&&"iOS"!==e.os||!!("iOS"===e.os&&e.osVersion&&bk(e.osVersion,t)>=0)||"Safari"===e.name&&bk(e.version,t)>=0}()&&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)),d.simulcast=!1),d.source&&(e.source=d.source);const p=new Promise((t,i)=>Vg(r,void 0,void 0,function*(){try{if(this.engine.client.currentState!==lb.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:Yk(e)}));const r=setTimeout(()=>{i(new Mf("publishing rejected as engine not connected within timeout",408))},15e3);yield this.waitUntilEngineConnected(),clearTimeout(r);const n=yield this.publish(e,d,h);t(n)}else try{const r=yield this.publish(e,d,h);t(r)}catch(VT){i(VT)}}catch(VT){i(VT)}}));r.pendingPublishPromises.set(e,p);try{return yield p}catch(VT){throw VT}finally{r.pendingPublishPromises.delete(e)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new Pk),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),Yk(e))),!1;const{canPublish:t,canPublishSources:r}=this.permissions;return!(!t||0!==r.length&&!r.map(e=>function(e){switch(e){case Rp.CAMERA:return qf.Source.Camera;case Rp.MICROPHONE:return qf.Source.Microphone;case Rp.SCREEN_SHARE:return qf.Source.ScreenShare;case Rp.SCREEN_SHARE_AUDIO:return qf.Source.ScreenShareAudio;default:return qf.Source.Unknown}}(e)).includes(e.source))||(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),Yk(e))),!1)}publish(e,t,r){return Vg(this,void 0,void 0,function*(){var i,n,o,a,s,l,c,d,u,h;if(!this.hasPermissionsToPublish(e))throw new Mf("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(t=>Lk(e)&&t.source===e.source)&&e.source!==qf.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),Yk(e))),t.stopMicTrackOnMute&&Nk(e)&&(e.stopOnMute=!0),e.source===qf.Source.ScreenShare&&ck()&&(t.simulcast=!1),"av1"!==t.videoCodec||function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(dk()||ck())return!1;const e=RTCRtpSender.getCapabilities("video");let t=!1;if(e)for(const r of e.codecs)if("video/av1"===r.mimeType.toLowerCase()){t=!0;break}return t}()||(t.videoCodec=void 0),"vp9"!==t.videoCodec||function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(ck())return!1;if(dk()){const e=Lf();if((null==e?void 0:e.version)&&bk(e.version,"16")<0)return!1;if("iOS"===(null==e?void 0:e.os)&&(null==e?void 0:e.osVersion)&&bk(e.osVersion,"16")<0)return!1}const e=RTCRtpSender.getCapabilities("video");let t=!1;if(e)for(const r of e.codecs)if("video/vp9"===r.mimeType.toLowerCase()){t=!0;break}return t}()||(t.videoCodec=void 0),void 0===t.videoCodec&&(t.videoCodec=Db),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(e=>t.videoCodec===Jk(e.mime))||(t.videoCodec=Jk(this.enabledPublishVideoCodecs[0].mime)));const p=t.videoCodec;e.on(wf.Muted,this.onTrackMuted),e.on(wf.Unmuted,this.onTrackUnmuted),e.on(wf.Ended,this.handleTrackEnded),e.on(wf.UpstreamPaused,this.onTrackUpstreamPaused),e.on(wf.UpstreamResumed,this.onTrackUpstreamResumed),e.on(wf.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const m=[],g=!(null===(i=t.dtx)||void 0===i||i),v=e.getSourceTrackSettings();v.autoGainControl&&m.push(Up.TF_AUTO_GAIN_CONTROL),v.echoCancellation&&m.push(Up.TF_ECHO_CANCELLATION),v.noiseSuppression&&m.push(Up.TF_NOISE_SUPPRESSION),v.channelCount&&v.channelCount>1&&m.push(Up.TF_STEREO),g&&m.push(Up.TF_NO_DTX),Uk(e)&&e.hasPreConnectBuffer&&m.push(Up.TF_PRECONNECT_BUFFER);const f=new Lm({cid:e.mediaStreamTrack.id,name:t.name,type:qf.kindToProto(e.kind),muted:e.isMuted,source:qf.sourceToProto(e.source),disableDtx:g,encryption:this.encryptionType,stereo:r,disableRed:this.isE2EEEnabled||!(null===(n=t.red)||void 0===n||n),stream:null==t?void 0:t.stream,backupCodecPolicy:null==t?void 0:t.backupCodecPolicy,audioFeatures:m});let k;if(e.kind===qf.Kind.Video){let r={width:0,height:0};try{r=yield e.waitForDimensions()}catch(VT){const i=null!==(a=null===(o=this.roomOptions.videoCaptureDefaults)||void 0===o?void 0:o.resolution)&&void 0!==a?a:ek.h720.resolution;r={width:i.width,height:i.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),Yk(e)),{dims:r}))}f.width=r.width,f.height=r.height,jk(e)&&(sk(p)&&(e.source===qf.Source.ScreenShare&&(t.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),Yk(e))))),t.scalabilityMode=null!==(s=t.scalabilityMode)&&void 0!==s?s:"L3T3_KEY"),f.simulcastCodecs=[new Dm({codec:p,cid:e.mediaStreamTrack.id})],!0===t.backupCodec&&(t.backupCodec={codec:Db}),t.backupCodec&&p!==t.backupCodec.codec&&f.encryption===Gp.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),f.simulcastCodecs.push(new Dm({codec:t.backupCodec.codec,cid:""})))),k=ow(e.source===qf.Source.ScreenShare,f.width,f.height,t),f.layers=pw(f.width,f.height,k,sk(t.videoCodec))}else e.kind===qf.Kind.Audio&&(k=[{maxBitrate:null===(l=t.audioPreset)||void 0===l?void 0:l.maxBitrate,priority:null!==(d=null===(c=t.audioPreset)||void 0===c?void 0:c.priority)&&void 0!==d?d:"high",networkPriority:null!==(h=null===(u=t.audioPreset)||void 0===u?void 0:u.priority)&&void 0!==h?h:"high"}]);if(!this.engine||this.engine.isClosed)throw new If("cannot publish track when not connected");const b=()=>Vg(this,void 0,void 0,function*(){var r,i,n;if(!this.engine.pcManager)throw new If("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,t,k),this.emit(vf.LocalSenderCreated,e.sender,e),jk(e)&&(null!==(r=t.degradationPreference)&&void 0!==r||(t.degradationPreference=function(e){return e.source===qf.Source.ScreenShare||e.constraints.height&&Mk(e.constraints.height)>=1080?"maintain-resolution":"balanced"}(e)),e.setDegradationPreference(t.degradationPreference)),k)if(ck()&&e.kind===qf.Kind.Audio){let t;for(const r of this.engine.pcManager.publisher.getTransceivers())if(r.sender===e.sender){t=r;break}t&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:t,codec:"opus",maxbr:(null===(i=k[0])||void 0===i?void 0:i.maxBitrate)?k[0].maxBitrate/1e3:0})}else e.codec&&sk(e.codec)&&(null===(n=k[0])||void 0===n?void 0:n.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:f.cid,codec:e.codec,maxbr:k[0].maxBitrate/1e3});yield this.engine.negotiate()});let w;const y=new Promise((t,r)=>Vg(this,void 0,void 0,function*(){var i;try{w=yield this.engine.addTrack(f),t(w)}catch(n){e.sender&&(null===(i=this.engine.pcManager)||void 0===i?void 0:i.publisher)&&(this.engine.pcManager.publisher.removeTrack(e.sender),yield this.engine.negotiate().catch(t=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),Yk(e)),{error:t}))})),r(n)}}));if(this.enabledPublishVideoCodecs.length>0){const e=yield Promise.all([y,b()]);w=e[0]}else{let r;if(w=yield y,w.codecs.forEach(e=>{void 0===r&&(r=e.mimeType)}),r&&e.kind===qf.Kind.Video){const i=Jk(r);i!==p&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),Yk(e)),{codec:i})),t.videoCodec=i,k=ow(e.source===qf.Source.ScreenShare,f.width,f.height,t))}yield b()}const x=new Gw(e.kind,w,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(x.on(wf.CpuConstrained,e=>this.onTrackCpuConstrained(e,x)),x.options=t,e.sid=w.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:k,trackInfo:w})),jk(e)?e.startMonitor(this.engine.client):Uk(e)&&e.startMonitor(),this.addTrackPublication(x),this.emit(vf.LocalTrackPublished,x),Uk(e)&&w.audioFeatures.includes(Up.TF_PRECONNECT_BUFFER)){const t=e.getPreConnectBuffer(),r=e.getPreConnectBufferMimeType();this.on(vf.LocalTrackSubscribed,t=>{if(t.trackSid===w.sid){if(!e.hasPreConnectBuffer)return void this.log.warn("subscribe event came to late, buffer already closed",this.logContext);this.log.debug("finished recording preconnect buffer",Object.assign(Object.assign({},this.logContext),Yk(e))),e.stopPreConnectBuffer()}}),t&&new Promise((i,n)=>Vg(this,void 0,void 0,function*(){var o,a,s,l,c,d;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),Yk(e)));const g=setTimeout(()=>{n(new Error("agent not active within 10 seconds"))},1e4),f=yield this.waitUntilActiveAgentPresent();clearTimeout(g),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),Yk(e)));const k=yield this.streamBytes({name:"preconnect-buffer",mimeType:r,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[f.identity],attributes:{trackId:x.trackSid,sampleRate:String(null!==(c=v.sampleRate)&&void 0!==c?c:"48000"),channels:String(null!==(d=v.channelCount)&&void 0!==d?d:"1")}});try{for(var u,h=!0,p=qg(t);!(o=(u=yield p.next()).done);h=!0){l=u.value,h=!1;const e=l;yield k.write(e)}}catch(m){a={error:m}}finally{try{h||o||!(s=p.return)||(yield s.call(p))}finally{if(a)throw a.error}}yield k.close(),i()}catch(VT){n(VT)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),Yk(e)))}).catch(t=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),Yk(e)),{error:t}))})}return x})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,t,r){return Vg(this,void 0,void 0,function*(){var i;if(this.encryptionType!==Gp.NONE)return;let n;if(this.trackPublications.forEach(t=>{t.track&&t.track===e&&(n=t)}),!n)throw new Ef("track is not published");if(!jk(e))throw new Ef("track is not a video track");const o=Object.assign(Object.assign({},null===(i=this.roomOptions)||void 0===i?void 0:i.publishDefaults),r),a=function(e,t,r){var i,n,o,a;if(!r.backupCodec||!0===r.backupCodec||r.backupCodec.codec===r.videoCodec)return;t!==r.backupCodec.codec&&zg.warn("requested a different codec than specified as backup",{serverRequested:t,backup:r.backupCodec.codec}),r.videoCodec=t,r.videoEncoding=r.backupCodec.encoding;const s=e.mediaStreamTrack.getSettings(),l=null!==(i=s.width)&&void 0!==i?i:null===(n=e.dimensions)||void 0===n?void 0:n.width,c=null!==(o=s.height)&&void 0!==o?o:null===(a=e.dimensions)||void 0===a?void 0:a.height;return e.source===qf.Source.ScreenShare&&r.simulcast&&(r.simulcast=!1),ow(e.source===qf.Source.ScreenShare,l,c,r)}(e,t,o);if(!a)return void this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),Yk(e)));const s=e.addSimulcastTrack(t,a);if(!s)return;const l=new Lm({cid:s.mediaStreamTrack.id,type:qf.kindToProto(e.kind),muted:e.isMuted,source:qf.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:s.mediaStreamTrack.id}]});if(l.layers=pw(l.width,l.height,a),!this.engine||this.engine.isClosed)throw new If("cannot publish track when not connected");const c=(yield Promise.all([this.engine.addTrack(l),(()=>Vg(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,s,o,a),yield this.engine.negotiate()}))()]))[0];this.log.debug("published ".concat(t," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:a,trackInfo:c}))})}unpublishTrack(e,t){return Vg(this,void 0,void 0,function*(){var r,i;if(Lk(e)){const t=this.pendingPublishPromises.get(e);t&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),Yk(e))),yield t)}const n=this.getPublicationForTrack(e),o=n?Yk(n):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),o)),!n||!n.track)return void this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),o));(e=n.track).off(wf.Muted,this.onTrackMuted),e.off(wf.Unmuted,this.onTrackUnmuted),e.off(wf.Ended,this.handleTrackEnded),e.off(wf.UpstreamPaused,this.onTrackUpstreamPaused),e.off(wf.UpstreamResumed,this.onTrackUpstreamResumed),e.off(wf.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),void 0===t&&(t=null===(i=null===(r=this.roomOptions)||void 0===r?void 0:r.stopLocalTrackOnUnpublish)||void 0===i||i),t?e.stop():e.stopMonitor();let a=!1;const s=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Fb.FAILED&&s)try{for(const e of this.engine.pcManager.publisher.getTransceivers())e.sender===s&&(e.direction="inactive",a=!0);if(this.engine.removeTrack(s)&&(a=!0),jk(e)){for(const[,t]of e.simulcastCodecs)t.sender&&(this.engine.removeTrack(t.sender)&&(a=!0),t.sender=void 0);e.simulcastCodecs.clear()}}catch(VT){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),o),{error:VT}))}switch(this.trackPublications.delete(n.trackSid),n.kind){case qf.Kind.Audio:this.audioTrackPublications.delete(n.trackSid);break;case qf.Kind.Video:this.videoTrackPublications.delete(n.trackSid)}return this.emit(vf.LocalTrackUnpublished,n),n.setTrack(void 0),a&&(yield this.engine.negotiate()),n})}unpublishTracks(e){return Vg(this,void 0,void 0,function*(){return(yield Promise.all(e.map(e=>this.unpublishTrack(e)))).filter(e=>!!e)})}republishAllTracks(e){return Vg(this,arguments,void 0,function(e){var t=this;let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){t.republishPromise&&(yield t.republishPromise),t.republishPromise=new Promise((i,n)=>Vg(t,void 0,void 0,function*(){try{const t=[];this.trackPublications.forEach(r=>{r.track&&(e&&(r.options=Object.assign(Object.assign({},r.options),e)),t.push(r))}),yield Promise.all(t.map(e=>Vg(this,void 0,void 0,function*(){const t=e.track;yield this.unpublishTrack(t,!1),!r||t.isMuted||t.source===qf.Source.ScreenShare||t.source===qf.Source.ScreenShareAudio||!Uk(t)&&!jk(t)||t.isUserProvided||(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:e.trackSid})),yield t.restartTrack()),yield this.publishOrRepublishTrack(t,e.options,!0)}))),i()}catch(t){n(t)}finally{this.republishPromise=void 0}})),yield t.republishPromise}()})}publishData(e){return Vg(this,arguments,void 0,function(e){var t=this;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const i=r.reliable?Xp.RELIABLE:Xp.LOSSY,n=r.destinationIdentities,o=r.topic;let a=new nm({participantIdentity:t.identity,payload:e,destinationIdentities:n,topic:o});const s=new Qp({kind:i,value:{case:"user",value:a}});yield t.engine.sendDataPacket(s,i)}()})}publishDtmf(e,t){return Vg(this,void 0,void 0,function*(){const r=new Qp({kind:Xp.RELIABLE,value:{case:"sipDtmf",value:new om({code:e,digit:t})}});yield this.engine.sendDataPacket(r,Xp.RELIABLE)})}sendChatMessage(e,t){return Vg(this,void 0,void 0,function*(){const r={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:null==t?void 0:t.attachments},i=new Qp({value:{case:"chatMessage",value:new lm(Object.assign(Object.assign({},r),{timestamp:gh.parse(r.timestamp)}))}});return yield this.engine.sendDataPacket(i,Xp.RELIABLE),this.emit(vf.ChatMessage,r),r})}editChatMessage(e,t){return Vg(this,void 0,void 0,function*(){const r=Object.assign(Object.assign({},t),{message:e,editTimestamp:Date.now()}),i=new Qp({value:{case:"chatMessage",value:new lm(Object.assign(Object.assign({},r),{timestamp:gh.parse(r.timestamp),editTimestamp:gh.parse(r.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,Xp.RELIABLE),this.emit(vf.ChatMessage,r),r})}sendText(e,t){return Vg(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,t)})}streamText(e){return Vg(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,t){return Vg(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,t)})}streamBytes(e){return Vg(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(e)})}performRpc(e){return Vg(this,arguments,void 0,function(e){var t=this;let{destinationIdentity:r,method:i,payload:n,responseTimeout:o=1e4}=e;return function*(){return new Promise((e,a)=>Vg(t,void 0,void 0,function*(){var t,s,l,c;if($b(n)>15360)return void a(qb.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));if((null===(s=null===(t=this.engine.latestJoinResponse)||void 0===t?void 0:t.serverInfo)||void 0===s?void 0:s.version)&&bk(null===(c=null===(l=this.engine.latestJoinResponse)||void 0===l?void 0:l.serverInfo)||void 0===c?void 0:c.version,"1.8.0")<0)return void a(qb.builtIn("UNSUPPORTED_SERVER"));const d=crypto.randomUUID();yield this.publishRpcRequest(r,d,i,n,o-2e3);const u=setTimeout(()=>{this.pendingAcks.delete(d),a(qb.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(d),clearTimeout(h)},2e3);this.pendingAcks.set(d,{resolve:()=>{clearTimeout(u)},participantIdentity:r});const h=setTimeout(()=>{this.pendingResponses.delete(d),a(qb.builtIn("RESPONSE_TIMEOUT"))},o);this.pendingResponses.set(d,{resolve:(t,r)=>{clearTimeout(h),this.pendingAcks.has(d)&&(this.pendingAcks.delete(d),clearTimeout(u)),r?a(r):e(null!=t?t:"")},participantIdentity:r})}))}()})}registerRpcMethod(e,t){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,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const t=this.pendingAcks.get(e);t&&(t.resolve(),this.pendingAcks.delete(e))}handleIncomingRpcResponse(e,t,r){const i=this.pendingResponses.get(e);i&&(i.resolve(t,r),this.pendingResponses.delete(e))}publishRpcRequest(e,t,r,i,n){return Vg(this,void 0,void 0,function*(){const o=new Qp({destinationIdentities:[e],kind:Xp.RELIABLE,value:{case:"rpcRequest",value:new cm({id:t,method:r,payload:i,responseTimeoutMs:n,version:1})}});yield this.engine.sendDataPacket(o,Xp.RELIABLE)})}handleParticipantDisconnected(e){for(const[t,{participantIdentity:r}]of this.pendingAcks)r===e&&this.pendingAcks.delete(t);for(const[t,{participantIdentity:r,resolve:i}]of this.pendingResponses)r===e&&(i(null,qb.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(t))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(e=>"video"===e.mime.split("/")[0].toLowerCase())}updateInfo(e){return!!super.updateInfo(e)&&(e.tracks.forEach(e=>{var t,r;const i=this.trackPublications.get(e.sid);if(i){const n=i.isMuted||null!==(r=null===(t=i.track)||void 0===t?void 0:t.isUpstreamPaused)&&void 0!==r&&r;n!==e.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),Yk(i)),{mutedOnServer:n})),this.engine.client.sendMuteTrack(e.sid,n))}}),!0)}setActiveAgent(e){var t,r,i,n;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?null===(r=null===(t=this.activeAgentFuture)||void 0===t?void 0:t.resolve)||void 0===r||r.call(t,e):null===(n=null===(i=this.activeAgentFuture)||void 0===i?void 0:i.reject)||void 0===n||n.call(i,"Agent disconnected"),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new Pk),this.activeAgentFuture.promise)}getPublicationForTrack(e){let t;return this.trackPublications.forEach(r=>{const i=r.track;i&&(e instanceof MediaStreamTrack?(Uk(i)||jk(i))&&i.mediaStreamTrack===e&&(t=r):e===i&&(t=r))}),t}waitForPendingPublicationOfSource(e){return Vg(this,void 0,void 0,function*(){const t=Date.now();for(;Date.now()<t+1e4;){const t=Array.from(this.pendingPublishPromises.entries()).find(t=>{let[r]=t;return r.source===e});if(t)return t[1];yield nk(20)}})}}class Yw extends Ww{constructor(e,t,r,i){super(e,t.sid,t.name,i),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=e=>{this.setTrack(void 0),this.emit(wf.Ended,e)},this.handleVisibilityChange=e=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(e),this.logContext),this.visible=e,this.emitTrackUpdate()},this.handleVideoDimensionsChange=e=>{this.log.debug("adaptivestream video dimensions ".concat(e.width,"x").concat(e.height),this.logContext),this.videoDimensionsAdaptiveStream=e,this.emitTrackUpdate()},this.subscribed=r,this.updateInfo(t)}setSubscribed(e){const t=this.subscriptionStatus,r=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new $m({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new pm({participantSid:"",trackSids:[this.trackSid]})]});this.emit(wf.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(r)}get subscriptionStatus(){return!1===this.subscribed?Ww.SubscriptionStatus.Unsubscribed:super.isSubscribed?Ww.SubscriptionStatus.Subscribed:Ww.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Ww.PermissionStatus.Allowed:Ww.PermissionStatus.NotAllowed}get isSubscribed(){return!1!==this.subscribed&&super.isSubscribed}get isDesired(){return!1!==this.subscribed}get isEnabled(){return void 0!==this.requestedDisabled?!this.requestedDisabled:!this.isAdaptiveStream||this.visible}get isLocal(){return!1}setEnabled(e){this.isManualOperationAllowed()&&this.requestedDisabled!==!e&&(this.requestedDisabled=!e,this.emitTrackUpdate())}setVideoQuality(e){this.isManualOperationAllowed()&&this.requestedMaxQuality!==e&&(this.requestedMaxQuality=e,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var t,r;this.isManualOperationAllowed()&&((null===(t=this.requestedVideoDimensions)||void 0===t?void 0:t.width)===e.width&&(null===(r=this.requestedVideoDimensions)||void 0===r?void 0:r.height)===e.height||(Vk(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&Vk(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){var e;return null!==(e=this.requestedMaxQuality)&&void 0!==e?e:Bf.HIGH}setTrack(e){const t=this.subscriptionStatus,r=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off(wf.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(wf.VisibilityChanged,this.handleVisibilityChange),i.off(wf.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(wf.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(wf.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(wf.VisibilityChanged,this.handleVisibilityChange),e.on(wf.Ended,this.handleEnded),this.emit(wf.Subscribed,e)),this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(e){const t=this.subscriptionStatus,r=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(r),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(e){this.emit(wf.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const t=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):t!==e.muted&&this.emit(e.muted?wf.Muted:wf.Unmuted)}emitSubscriptionUpdateIfChanged(e){const t=this.subscriptionStatus;e!==t&&this.emit(wf.SubscriptionStatusChanged,t,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(wf.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return!!this.isDesired||(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return Vk(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new Hm({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===qf.Kind.Video){let n=this.requestedVideoDimensions;if(void 0!==this.videoDimensionsAdaptiveStream)if(n)Xk(this.videoDimensionsAdaptiveStream,n)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream);else if(void 0!==this.requestedMaxQuality&&this.trackInfo){const e=(t=this.trackInfo,r=this.requestedMaxQuality,null===(i=t.layers)||void 0===i?void 0:i.find(e=>e.quality===r));e&&Xk(this.videoDimensionsAdaptiveStream,e)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),n=this.videoDimensionsAdaptiveStream;n?(e.width=Math.ceil(n.width),e.height=Math.ceil(n.height)):void 0!==this.requestedMaxQuality?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),e.quality=this.requestedMaxQuality):(this.log.debug("using default quality",Object.assign(Object.assign({},this.logContext),{quality:Bf.HIGH})),e.quality=Bf.HIGH)}var t,r,i;this.emit(wf.UpdateSettings,e)}}class Qw extends Jw{static fromParticipantInfo(e,t,r){return new Qw(e,t.sid,t.identity,t.name,t.metadata,t.attributes,r,t.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,t,r,i,n,o,a){super(t,r||"",i,n,o,a,arguments.length>7&&void 0!==arguments[7]?arguments[7]:Hp.STANDARD),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(wf.UpdateSettings,t=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),Yk(e)),{settings:t})),this.signalClient.sendUpdateTrackSettings(t)}),e.on(wf.UpdateSubscription,e=>{e.participantTracks.forEach(e=>{e.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(e)}),e.on(wf.SubscriptionPermissionChanged,t=>{this.emit(vf.TrackSubscriptionPermissionChanged,e,t)}),e.on(wf.SubscriptionStatusChanged,t=>{this.emit(vf.TrackSubscriptionStatusChanged,e,t)}),e.on(wf.Subscribed,t=>{this.emit(vf.TrackSubscribed,t,e)}),e.on(wf.Unsubscribed,t=>{this.emit(vf.TrackUnsubscribed,t,e)}),e.on(wf.SubscriptionFailed,t=>{this.emit(vf.TrackSubscriptionFailed,e.trackSid,t)})}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setVolume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qf.Source.Microphone;this.volumeMap.set(t,e);const r=this.getTrackPublication(t);r&&r.track&&r.track.setVolume(e)}getVolume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:qf.Source.Microphone;const t=this.getTrackPublication(e);return t&&t.track?t.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,t,r,i,n,o){let a,s=this.getTrackPublicationBySid(t);return s||t.startsWith("TR")||this.trackPublications.forEach(t=>{s||e.kind!==t.kind.toString()||(s=t)}),s?"ended"===e.readyState?(this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),Yk(s))),void this.emit(vf.TrackSubscriptionFailed,t)):(a="video"===e.kind?new Vw(e,t,i,n):new Bw(e,t,i,this.audioContext,this.audioOutput),a.source=s.source,a.isMuted=s.isMuted,a.setMediaStream(r),a.start(),s.setTrack(a),this.volumeMap.has(s.source)&&Fk(a)&&Nk(a)&&a.setVolume(this.volumeMap.get(s.source)),s):0===o?(this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:t})),void this.emit(vf.TrackSubscriptionFailed,t)):(void 0===o&&(o=20),void setTimeout(()=>{this.addSubscribedMediaTrack(e,t,r,i,n,o-1)},150))}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const t=new Map,r=new Map;return e.tracks.forEach(e=>{var i,n;let o=this.getTrackPublicationBySid(e.sid);if(o)o.updateInfo(e);else{const t=qf.kindFromProto(e.type);if(!t)return;o=new Yw(t,e,null===(i=this.signalClient.connectOptions)||void 0===i?void 0:i.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:null===(n=this.loggerOptions)||void 0===n?void 0:n.loggerName}),o.updateInfo(e),r.set(e.sid,o);const a=Array.from(this.trackPublications.values()).find(e=>e.source===(null==o?void 0:o.source));a&&o.source!==qf.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(o.source),Object.assign(Object.assign({},this.logContext),{oldTrack:Yk(a),newTrack:Yk(o)})),this.addTrackPublication(o)}t.set(e.sid,o)}),this.trackPublications.forEach(e=>{t.has(e.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),Yk(e))),this.unpublishTrack(e.trackSid,!0))}),r.forEach(e=>{this.emit(vf.TrackPublished,e)}),!0}unpublishTrack(e,t){const r=this.trackPublications.get(e);if(!r)return;const{track:i}=r;switch(i&&(i.stop(),r.setTrack(void 0)),this.trackPublications.delete(e),r.kind){case qf.Kind.Audio:this.audioTrackPublications.delete(e);break;case qf.Kind.Video:this.videoTrackPublications.delete(e)}t&&this.emit(vf.TrackUnpublished,r)}setAudioOutput(e){return Vg(this,void 0,void 0,function*(){this.audioOutput=e;const t=[];this.audioTrackPublications.forEach(r=>{var i;Nk(r.track)&&Fk(r.track)&&t.push(r.track.setSinkId(null!==(i=e.deviceId)&&void 0!==i?i:"default"))}),yield Promise.all(t)})}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:r})),super.emit(e,...r)}}(Tw=Sw||(Sw={})).Disconnected="disconnected",Tw.Connecting="connecting",Tw.Connected="connected",Tw.Reconnecting="reconnecting",Tw.SignalReconnecting="signalReconnecting";class Xw extends Wg.EventEmitter{get hasE2EESetup(){return void 0!==this.e2eeManager}constructor(e){var t,r,i,n;if(super(),t=this,this.state=Sw.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=zg,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(e,t,r)=>Vg(this,void 0,void 0,function*(){var i;if("undefined"==typeof RTCPeerConnection||!ok()&&!ak())throw mk()?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 n=yield this.disconnectLock.lock();if(this.state===Sw.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),n(),Promise.resolve();if(this.connectFuture)return n(),this.connectFuture.promise;this.setAndEmitConnectionState(Sw.Connecting),(null===(i=this.regionUrlProvider)||void 0===i?void 0:i.getServerUrl().toString())!==e&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),gk(new URL(e))&&(void 0===this.regionUrlProvider?this.regionUrlProvider=new Aw(e,t):this.regionUrlProvider.updateToken(t),this.regionUrlProvider.fetchRegionSettings().then(e=>{var t;null===(t=this.regionUrlProvider)||void 0===t||t.setServerReportedRegions(e)}).catch(e=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:e}))}));const o=(i,a,s)=>Vg(this,void 0,void 0,function*(){var l,c;this.abortController&&this.abortController.abort();const d=new AbortController;this.abortController=d,null==n||n();try{yield this.attemptConnection(null!=s?s:e,t,r,d),this.abortController=void 0,i()}catch(VT){if(this.regionUrlProvider&&VT instanceof Sf&&VT.reason!==af.Cancelled&&VT.reason!==af.NotAllowed){let t=null;try{t=yield this.regionUrlProvider.getNextBestRegionUrl(null===(l=this.abortController)||void 0===l?void 0:l.signal)}catch(u){if(u instanceof Sf&&(401===u.status||u.reason===af.Cancelled))return this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),void a(u)}t&&!(null===(c=this.abortController)||void 0===c?void 0:c.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(VT.message,". Retrying with another region: ").concat(t),this.logContext),this.recreateEngine(),yield o(i,a,t)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Rk(VT)),a(VT))}else{let t=Np.UNKNOWN_REASON;VT instanceof Sf&&(t=Rk(VT)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,t),a(VT)}}}),a=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Pk((e,t)=>{o(e,t,a)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(e,t,r,i,n,o)=>Vg(this,void 0,void 0,function*(){var a,s,l;const c=yield r.join(e,t,{autoSubscribe:i.autoSubscribe,adaptiveStream:"object"==typeof n.adaptiveStream||n.adaptiveStream,maxRetries:i.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:i.websocketTimeout},o.signal);let d=c.serverInfo;if(d||(d={version:c.serverVersion,region:c.serverRegion}),this.serverInfo=d,this.log.debug("connected to Livekit Server ".concat(Object.entries(d).map(e=>{let[t,r]=e;return"".concat(t,": ").concat(r)}).join(", ")),{room:null===(a=c.room)||void 0===a?void 0:a.name,roomSid:null===(s=c.room)||void 0===s?void 0:s.sid,identity:null===(l=c.participant)||void 0===l?void 0:l.identity}),!d.version)throw new _f("unknown server version");return"0.15.1"===d.version&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),n.dynacast=!1),c}),this.applyJoinResponse=e=>{const t=e.participant;if(this.localParticipant.sid=t.sid,this.localParticipant.identity=t.identity,this.localParticipant.setEnabledPublishCodecs(e.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(e.sifTrailer)}catch(VT){this.log.error(VT instanceof Error?VT.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:VT}))}this.handleParticipantUpdates([t,...e.otherParticipants]),e.room&&this.handleRoomUpdate(e.room)},this.attemptConnection=(e,t,r,i)=>Vg(this,void 0,void 0,function*(){var n,o;this.state===Sw.Reconnecting||this.isResuming||(null===(n=this.engine)||void 0===n?void 0:n.pendingReconnect)?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),(null===(o=this.regionUrlProvider)||void 0===o?void 0:o.isCloud())&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Ub),r),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const r=yield this.connectSignal(e,t,this.engine,this.connOptions,this.options,i);this.applyJoinResponse(r),this.setupLocalParticipantEvents(),this.emit(mf.SignalConnected)}catch(a){yield this.engine.close(),this.recreateEngine();const e=new Sf("could not establish signal connection",af.ServerUnreachable);throw a instanceof Error&&(e.message="".concat(e.message,": ").concat(a.message)),a instanceof Sf&&(e.reason=a.reason,e.status=a.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:a})),e}if(i.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Sf("Connection attempt aborted",af.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,i)}catch(VT){throw yield this.engine.close(),this.recreateEngine(),VT}pk()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),pk()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Sw.Connected),this.emit(mf.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];return Vg(t,[...r],void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){var r,i,n,o;const a=yield e.disconnectLock.lock();try{if(e.state===Sw.Disconnected)return void e.log.debug("already disconnected",e.logContext);e.log.info("disconnect from room",Object.assign({},e.logContext)),(e.state===Sw.Connecting||e.state===Sw.Reconnecting||e.isResuming)&&(e.log.warn("abort connection attempt",e.logContext),null===(r=e.abortController)||void 0===r||r.abort(),null===(n=null===(i=e.connectFuture)||void 0===i?void 0:i.reject)||void 0===n||n.call(i,new Sf("Client initiated disconnect",af.Cancelled)),e.connectFuture=void 0),(null===(o=e.engine)||void 0===o?void 0:o.client.isDisconnected)||(yield e.engine.client.sendLeave()),e.engine&&(yield e.engine.close()),e.handleDisconnect(t,Np.CLIENT_INITIATED),e.engine=void 0}finally{a()}}()})},this.onPageLeave=()=>Vg(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>Vg(this,void 0,void 0,function*(){const e=[],t=Lf();if(t&&"iOS"===t.os){const t="livekit-dummy-audio-el";let r=document.getElementById(t);if(!r){r=document.createElement("audio"),r.id=t,r.autoplay=!0,r.hidden=!0;const e=Ik();e.enabled=!0;const i=new MediaStream([e]);r.srcObject=i,document.addEventListener("visibilitychange",()=>{r&&(r.srcObject=document.hidden?null:i,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(r),this.once(mf.Disconnected,()=>{null==r||r.remove(),r=null})}e.push(r)}this.remoteParticipants.forEach(t=>{t.audioTrackPublications.forEach(t=>{t.track&&t.track.attachedElements.forEach(t=>{e.push(t)})})});try{yield Promise.all([this.acquireAudioContext(),...e.map(e=>(e.muted=!1,e.play()))]),this.handleAudioPlaybackStarted()}catch(r){throw this.handleAudioPlaybackFailed(r),r}}),this.startVideo=()=>Vg(this,void 0,void 0,function*(){const e=[];for(const t of this.remoteParticipants.values())t.videoTrackPublications.forEach(t=>{var r;null===(r=t.track)||void 0===r||r.attachedElements.forEach(t=>{e.includes(t)||e.push(t)})});yield Promise.all(e.map(e=>e.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(e=>{"NotAllowedError"===e.name?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 e of this.remoteParticipants.values())this.handleParticipantDisconnected(e.identity,e);this.setAndEmitConnectionState(Sw.Reconnecting)&&this.emit(mf.Reconnecting)},this.handleSignalRestarted=e=>Vg(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(e.serverRegion),Object.assign(Object.assign({},this.logContext),{region:e.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(e);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(t){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:t}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:e.serverRegion}))}catch(r){return}this.setAndEmitConnectionState(Sw.Connected),this.emit(mf.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=e=>{e.forEach(e=>{var t;if(e.identity===this.localParticipant.identity)return void this.localParticipant.updateInfo(e);""===e.identity&&(e.identity=null!==(t=this.sidToIdentity.get(e.sid))&&void 0!==t?t:"");let r=this.remoteParticipants.get(e.identity);e.state===$p.DISCONNECTED?this.handleParticipantDisconnected(e.identity,r):r=this.getOrCreateParticipant(e.identity,e)})},this.handleActiveSpeakersUpdate=e=>{const t=[],r={};e.forEach(e=>{if(r[e.sid]=!0,e.sid===this.localParticipant.sid)this.localParticipant.audioLevel=e.level,this.localParticipant.setIsSpeaking(!0),t.push(this.localParticipant);else{const r=this.getRemoteParticipantBySid(e.sid);r&&(r.audioLevel=e.level,r.setIsSpeaking(!0),t.push(r))}}),r[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(e=>{r[e.sid]||(e.audioLevel=0,e.setIsSpeaking(!1))}),this.activeSpeakers=t,this.emitWhenConnected(mf.ActiveSpeakersChanged,t)},this.handleSpeakersChanged=e=>{const t=new Map;this.activeSpeakers.forEach(e=>{const r=this.remoteParticipants.get(e.identity);r&&r.sid!==e.sid||t.set(e.sid,e)}),e.forEach(e=>{let r=this.getRemoteParticipantBySid(e.sid);e.sid===this.localParticipant.sid&&(r=this.localParticipant),r&&(r.audioLevel=e.level,r.setIsSpeaking(e.active),e.active?t.set(e.sid,r):t.delete(e.sid))});const r=Array.from(t.values());r.sort((e,t)=>t.audioLevel-e.audioLevel),this.activeSpeakers=r,this.emitWhenConnected(mf.ActiveSpeakersChanged,r)},this.handleStreamStateUpdate=e=>{e.streamStates.forEach(e=>{const t=this.getRemoteParticipantBySid(e.participantSid);if(!t)return;const r=t.getTrackPublicationBySid(e.trackSid);if(!r||!r.track)return;const i=qf.streamStateFromProto(e.state);r.track.setStreamState(i),i!==r.track.streamState&&(t.emit(vf.TrackStreamStateChanged,r,r.track.streamState),this.emitWhenConnected(mf.TrackStreamStateChanged,r,r.track.streamState,t))})},this.handleSubscriptionPermissionUpdate=e=>{const t=this.getRemoteParticipantBySid(e.participantSid);if(!t)return;const r=t.getTrackPublicationBySid(e.trackSid);r&&r.setAllowed(e.allowed)},this.handleSubscriptionError=e=>{const t=Array.from(this.remoteParticipants.values()).find(t=>t.trackPublications.has(e.trackSid));if(!t)return;const r=t.getTrackPublicationBySid(e.trackSid);r&&r.setSubscriptionError(e.err)},this.handleDataPacket=(e,t)=>{const r=this.remoteParticipants.get(e.participantIdentity);if("user"===e.value.case)this.handleUserPacket(r,e.value.value,e.kind,t);else if("transcription"===e.value.case)this.handleTranscription(r,e.value.value);else if("sipDtmf"===e.value.case)this.handleSipDtmf(r,e.value.value);else if("chatMessage"===e.value.case)this.handleChatMessage(r,e.value.value);else if("metrics"===e.value.case)this.handleMetrics(e.value.value,r);else if("streamHeader"===e.value.case||"streamChunk"===e.value.case||"streamTrailer"===e.value.case)this.handleDataStream(e,t);else if("rpcRequest"===e.value.case){const t=e.value.value;this.handleIncomingRpcRequest(e.participantIdentity,t.id,t.method,t.payload,t.responseTimeoutMs,t.version)}},this.handleUserPacket=(e,t,r,i)=>{this.emit(mf.DataReceived,t.payload,e,r,t.topic,i),null==e||e.emit(vf.DataReceived,t.payload,r,i)},this.handleSipDtmf=(e,t)=>{this.emit(mf.SipDTMFReceived,t,e),null==e||e.emit(vf.SipDTMFReceived,t)},this.handleTranscription=(e,t)=>{const r=t.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(t.transcribedParticipantIdentity),i=null==r?void 0:r.trackPublications.get(t.trackId),n=function(e,t){return e.segments.map(e=>{let{id:r,text:i,language:n,startTime:o,endTime:a,final:s}=e;var l;const c=null!==(l=t.get(r))&&void 0!==l?l:Date.now(),d=Date.now();return s?t.delete(r):t.set(r,c),{id:r,text:i,startTime:Number.parseInt(o.toString()),endTime:Number.parseInt(a.toString()),final:s,language:n,firstReceivedTime:c,lastReceivedTime:d}})}(t,this.transcriptionReceivedTimes);null==i||i.emit(wf.TranscriptionReceived,n),null==r||r.emit(vf.TranscriptionReceived,n,i),this.emit(mf.TranscriptionReceived,n,r,i)},this.handleChatMessage=(e,t)=>{const r=function(e){const{id:t,timestamp:r,message:i,editTimestamp:n}=e;return{id:t,timestamp:Number.parseInt(r.toString()),editTimestamp:n?Number.parseInt(n.toString()):void 0,message:i}}(t);this.emit(mf.ChatMessage,r,e)},this.handleMetrics=(e,t)=>{this.emit(mf.MetricsReceived,e,t)},this.handleDataStream=(e,t)=>{this.incomingDataStreamManager.handleDataStreamPacket(e,t)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(mf.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=e=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:e})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(mf.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(mf.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(mf.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>Vg(this,void 0,void 0,function*(){var e;"iOS"!==(null===(e=Lf())||void 0===e?void 0:e.os)&&(yield this.selectDefaultDevices()),this.emit(mf.MediaDevicesChanged)}),this.handleRoomUpdate=e=>{const t=this.roomInfo;this.roomInfo=e,t&&t.metadata!==e.metadata&&this.emitWhenConnected(mf.RoomMetadataChanged,e.metadata),(null==t?void 0:t.activeRecording)!==e.activeRecording&&this.emitWhenConnected(mf.RecordingStatusChanged,e.activeRecording)},this.handleConnectionQualityUpdate=e=>{e.updates.forEach(e=>{if(e.participantSid===this.localParticipant.sid)return void this.localParticipant.setConnectionQuality(e.quality);const t=this.getRemoteParticipantBySid(e.participantSid);t&&t.setConnectionQuality(e.quality)})},this.onLocalParticipantMetadataChanged=e=>{this.emit(mf.ParticipantMetadataChanged,e,this.localParticipant)},this.onLocalParticipantNameChanged=e=>{this.emit(mf.ParticipantNameChanged,e,this.localParticipant)},this.onLocalAttributesChanged=e=>{this.emit(mf.ParticipantAttributesChanged,e,this.localParticipant)},this.onLocalTrackMuted=e=>{this.emit(mf.TrackMuted,e,this.localParticipant)},this.onLocalTrackUnmuted=e=>{this.emit(mf.TrackUnmuted,e,this.localParticipant)},this.onTrackProcessorUpdate=e=>{var t;null===(t=null==e?void 0:e.onPublish)||void 0===t||t.call(e,this)},this.onLocalTrackPublished=e=>Vg(this,void 0,void 0,function*(){var t,r,i,n,o,a;null===(t=e.track)||void 0===t||t.on(wf.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(r=e.track)||void 0===r||r.on(wf.Restarted,this.onLocalTrackRestarted),null===(o=null===(n=null===(i=e.track)||void 0===i?void 0:i.getProcessor())||void 0===n?void 0:n.onPublish)||void 0===o||o.call(n,this),this.emit(mf.LocalTrackPublished,e,this.localParticipant),Uk(e.track)&&(yield e.track.checkForSilence())&&this.emit(mf.LocalAudioSilenceDetected,e);const s=yield null===(a=e.track)||void 0===a?void 0:a.getDeviceId(!1),l=Zk(e.source);l&&s&&s!==this.localParticipant.activeDeviceMap.get(l)&&(this.localParticipant.activeDeviceMap.set(l,s),this.emit(mf.ActiveDeviceChanged,l,s))}),this.onLocalTrackUnpublished=e=>{var t,r;null===(t=e.track)||void 0===t||t.off(wf.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(r=e.track)||void 0===r||r.off(wf.Restarted,this.onLocalTrackRestarted),this.emit(mf.LocalTrackUnpublished,e,this.localParticipant)},this.onLocalTrackRestarted=e=>Vg(this,void 0,void 0,function*(){const t=yield e.getDeviceId(!1),r=Zk(e.source);r&&t&&t!==this.localParticipant.activeDeviceMap.get(r)&&(this.log.debug("local track restarted, setting ".concat(r," ").concat(t," active"),this.logContext),this.localParticipant.activeDeviceMap.set(r,t),this.emit(mf.ActiveDeviceChanged,r,t))}),this.onLocalConnectionQualityChanged=e=>{this.emit(mf.ConnectionQualityChanged,e,this.localParticipant)},this.onMediaDevicesError=(e,t)=>{this.emit(mf.MediaDevicesError,e,t)},this.onLocalParticipantPermissionsChanged=e=>{this.emit(mf.ParticipantPermissionsChanged,e,this.localParticipant)},this.onLocalChatMessageSent=e=>{this.emit(mf.ChatMessage,e,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},jb),e),this.log=jg(null!==(r=this.options.loggerName)&&void 0!==r?r:Mg.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Nb),null==e?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},zb),null==e?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},Lb),null==e?void 0:e.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new Lw,this.outgoingDataStreamManager=new Uw(this.engine,this.log),this.disconnectLock=new Ju,this.localParticipant=new Kw("","",this.engine,this.options,this.rpcHandlers,this.outgoingDataStreamManager),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Mk(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Mk(this.options.audioCaptureDefaults.deviceId)),(null===(i=this.options.audioOutput)||void 0===i?void 0:i.deviceId)&&this.switchActiveDevice("audiooutput",Mk(this.options.audioOutput.deviceId)).catch(e=>this.log.warn("Could not set audio output: ".concat(e.message),this.logContext)),pk()){const e=new AbortController;null===(n=navigator.mediaDevices)||void 0===n||n.addEventListener("devicechange",this.handleDeviceChange,{signal:e.signal}),Xw.cleanupRegistry&&Xw.cleanupRegistry.register(this,()=>{e.abort()})}}registerTextStreamHandler(e,t){return this.incomingDataStreamManager.registerTextStreamHandler(e,t)}unregisterTextStreamHandler(e){return this.incomingDataStreamManager.unregisterTextStreamHandler(e)}registerByteStreamHandler(e,t){return this.incomingDataStreamManager.registerByteStreamHandler(e,t)}unregisterByteStreamHandler(e){return this.incomingDataStreamManager.unregisterByteStreamHandler(e)}registerRpcMethod(e,t){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,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setE2EEEnabled(e){return Vg(this,void 0,void 0,function*(){if(!this.e2eeManager)throw Error("e2ee not configured, please set e2ee settings within the room options");yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),""!==this.localParticipant.identity&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity)})}setupE2EE(){var e;const t=!!this.options.encryption,r=this.options.encryption||this.options.e2ee;r&&(this.e2eeManager="e2eeManager"in r?r.e2eeManager:new eb(r,t),this.e2eeManager.on(rf.ParticipantEncryptionStatusChanged,(e,t)=>{t.isLocal&&(this.isE2EEEnabled=e),this.emit(mf.ParticipantEncryptionStatusChanged,e,t)}),this.e2eeManager.on(rf.EncryptionError,e=>this.emit(mf.EncryptionError,e)),null===(e=this.e2eeManager)||void 0===e||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:null===(e=this.roomInfo)||void 0===e?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.activeRecording)&&void 0!==t&&t}getSid(){return Vg(this,void 0,void 0,function*(){return this.state===Sw.Disconnected?"":this.roomInfo&&""!==this.roomInfo.sid?this.roomInfo.sid:new Promise((e,t)=>{const r=t=>{""!==t.sid&&(this.engine.off(kf.RoomUpdate,r),e(t.sid))};this.engine.on(kf.RoomUpdate,r),this.once(mf.Disconnected,()=>{this.engine.off(kf.RoomUpdate,r),t("Room disconnected before room server id was available")})})})}get name(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.name)&&void 0!==t?t:""}get metadata(){var e;return null===(e=this.roomInfo)||void 0===e?void 0:e.metadata}get numParticipants(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.numParticipants)&&void 0!==t?t:0}get numPublishers(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.numPublishers)&&void 0!==t?t:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Iw(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(kf.ParticipantUpdate,this.handleParticipantUpdates).on(kf.RoomUpdate,this.handleRoomUpdate).on(kf.SpeakersChanged,this.handleSpeakersChanged).on(kf.StreamStateChanged,this.handleStreamStateUpdate).on(kf.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(kf.SubscriptionError,this.handleSubscriptionError).on(kf.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(kf.MediaTrackAdded,(e,t,r)=>{this.onTrackAdded(e,t,r)}).on(kf.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(kf.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(kf.DataPacketReceived,this.handleDataPacket).on(kf.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(Sw.SignalReconnecting)&&this.emit(mf.SignalReconnecting)}).on(kf.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Sw.Connected)&&this.emit(mf.Reconnected)}).on(kf.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Sw.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(kf.Restarting,this.handleRestarting).on(kf.SignalRestarted,this.handleSignalRestarted).on(kf.Offline,()=>{this.setAndEmitConnectionState(Sw.Reconnecting)&&this.emit(mf.Reconnecting)}).on(kf.DCBufferStatusChanged,(e,t)=>{this.emit(mf.DCBufferStatusChanged,e,t)}).on(kf.LocalTrackSubscribed,e=>{const t=this.localParticipant.getTrackPublications().find(t=>{let{trackSid:r}=t;return r===e});t?(this.localParticipant.emit(vf.LocalTrackSubscribed,t),this.emitWhenConnected(mf.LocalTrackSubscribed,t,this.localParticipant)):this.log.warn("could not find local track subscription for subscribed event",this.logContext)}).on(kf.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((e,t)=>{this.handleParticipantDisconnected(t,e)}),this.emit(mf.Moved,e.room.name),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),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}static getLocalDevices(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return rb.getInstance().getDevices(e,t)}prepareConnection(e,t){return Vg(this,void 0,void 0,function*(){if(this.state===Sw.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(gk(new URL(e))&&t){this.regionUrlProvider=new Aw(e,t);const r=yield this.regionUrlProvider.getNextBestRegionUrl();r&&this.state===Sw.Disconnected&&(this.regionUrl=r,yield fetch(Ak(r),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(r),this.logContext))}else yield fetch(Ak(e),{method:"HEAD"})}catch(VT){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:VT}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,t){return Vg(this,void 0,void 0,function*(){let r,i=()=>Vg(this,void 0,void 0,function*(){});switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":r=new vg({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":r=new vg({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":r=new vg({scenario:{case:"serverLeave",value:!0}});break;case"migration":r=new vg({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":i=()=>Vg(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new vg({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>Vg(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),r=new vg({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":r=new vg({scenario:{case:"switchCandidateProtocol",value:"force-tls"===e?2:1}}),i=()=>Vg(this,void 0,void 0,function*(){const e=this.engine.client.onLeave;e&&e(new Zm({reason:Np.CLIENT_INITIATED,action:Jm.RECONNECT}))});break;case"subscriber-bandwidth":if(void 0===t||"number"!=typeof t)throw new Error("subscriber-bandwidth requires a number as argument");r=new vg({scenario:{case:"subscriberBandwidth",value:Dk(t)}});break;case"leave-full-reconnect":r=new vg({scenario:{case:"leaveRequestFullReconnect",value:!0}})}r&&(yield this.engine.client.sendSimulateScenario(r),yield i())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,t){return Vg(this,arguments,void 0,function(e,t){var r=this;let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function*(){var n,o,a,s,l,c,d;let u=!0,h=!1;const p=i?{exact:t}:t;if("audioinput"===e){h=0===r.localParticipant.audioTrackPublications.size;const t=null!==(n=r.getActiveDevice(e))&&void 0!==n?n:r.options.audioCaptureDefaults.deviceId;r.options.audioCaptureDefaults.deviceId=p;const i=Array.from(r.localParticipant.audioTrackPublications.values()).filter(e=>e.source===qf.Source.Microphone);try{u=(yield Promise.all(i.map(e=>{var t;return null===(t=e.audioTrack)||void 0===t?void 0:t.setDeviceId(p)}))).every(e=>!0===e)}catch(VT){throw r.options.audioCaptureDefaults.deviceId=t,VT}const o=i.some(e=>{var t,r;return null!==(r=null===(t=e.track)||void 0===t?void 0:t.isMuted)&&void 0!==r&&r});u&&o&&(h=!0)}else if("videoinput"===e){h=0===r.localParticipant.videoTrackPublications.size;const t=null!==(o=r.getActiveDevice(e))&&void 0!==o?o:r.options.videoCaptureDefaults.deviceId;r.options.videoCaptureDefaults.deviceId=p;const i=Array.from(r.localParticipant.videoTrackPublications.values()).filter(e=>e.source===qf.Source.Camera);try{u=(yield Promise.all(i.map(e=>{var t;return null===(t=e.videoTrack)||void 0===t?void 0:t.setDeviceId(p)}))).every(e=>!0===e)}catch(VT){throw r.options.videoCaptureDefaults.deviceId=t,VT}const n=i.some(e=>{var t,r;return null!==(r=null===(t=e.track)||void 0===t?void 0:t.isMuted)&&void 0!==r&&r});u&&n&&(h=!0)}else if("audiooutput"===e){if(h=!0,!lk()&&!r.options.webAudioMix||r.options.webAudioMix&&r.audioContext&&!("setSinkId"in r.audioContext))throw new Error("cannot switch audio output, the current browser does not support it");r.options.webAudioMix&&(t=null!==(a=yield rb.getInstance().normalizeDeviceId("audiooutput",t))&&void 0!==a?a:""),null!==(s=(d=r.options).audioOutput)&&void 0!==s||(d.audioOutput={});const i=null!==(l=r.getActiveDevice(e))&&void 0!==l?l:r.options.audioOutput.deviceId;r.options.audioOutput.deviceId=t;try{r.options.webAudioMix&&(null===(c=r.audioContext)||void 0===c||c.setSinkId(t)),yield Promise.all(Array.from(r.remoteParticipants.values()).map(e=>e.setAudioOutput({deviceId:t})))}catch(VT){throw r.options.audioOutput.deviceId=i,VT}}return h&&(r.localParticipant.activeDeviceMap.set(e,t),r.emit(mf.ActiveDeviceChanged,e,t)),u}()})}setupLocalParticipantEvents(){this.localParticipant.on(vf.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(vf.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(vf.AttributesChanged,this.onLocalAttributesChanged).on(vf.TrackMuted,this.onLocalTrackMuted).on(vf.TrackUnmuted,this.onLocalTrackUnmuted).on(vf.LocalTrackPublished,this.onLocalTrackPublished).on(vf.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(vf.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(vf.MediaDevicesError,this.onMediaDevicesError).on(vf.AudioStreamAcquired,this.startAudio).on(vf.ChatMessage,this.onLocalChatMessageSent).on(vf.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;null===(e=this.engine)||void 0===e||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,t,r){if(this.state===Sw.Connecting||this.state===Sw.Reconnecting){const i=()=>{this.onTrackAdded(e,t,r),n()},n=()=>{this.off(mf.Reconnected,i),this.off(mf.Connected,i),this.off(mf.Disconnected,n)};return this.once(mf.Reconnected,i),this.once(mf.Connected,i),void this.once(mf.Disconnected,n)}if(this.state===Sw.Disconnected)return void this.log.warn("skipping incoming track after Room disconnected",this.logContext);if("ended"===e.readyState)return void this.log.info("skipping incoming track as it already ended",this.logContext);const i=function(e){const t=e.split("|");return t.length>1?[t[0],e.substr(t[0].length+1)]:[e,""]}(t.id),n=i[0];let o=i[1],a=e.id;if(o&&o.startsWith("TR")&&(a=o),n===this.localParticipant.sid)return void this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);const s=Array.from(this.remoteParticipants.values()).find(e=>e.sid===n);if(!s)return void this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(n),this.logContext);let l;this.options.adaptiveStream&&(l="object"==typeof this.options.adaptiveStream?this.options.adaptiveStream:{});const c=s.addSubscribedMediaTrack(e,a,t,r,l);(null==c?void 0:c.isEncrypted)&&!this.e2eeManager&&this.emit(mf.EncryptionError,new Error("Encrypted ".concat(c.source," track received from participant ").concat(s.sid,", but room does not have encryption enabled!")))}handleDisconnect(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;var r;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearHandlersAndControllers(),this.state!==Sw.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(e=>{e.trackPublications.forEach(t=>{e.unpublishTrack(t.trackSid)})}),this.localParticipant.trackPublications.forEach(t=>{var r,i,n;t.track&&this.localParticipant.unpublishTrack(t.track,e),e?(null===(r=t.track)||void 0===r||r.detach(),null===(i=t.track)||void 0===i||i.stop()):null===(n=t.track)||void 0===n||n.stopMonitor()}),this.localParticipant.off(vf.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(vf.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(vf.AttributesChanged,this.onLocalAttributesChanged).off(vf.TrackMuted,this.onLocalTrackMuted).off(vf.TrackUnmuted,this.onLocalTrackUnmuted).off(vf.LocalTrackPublished,this.onLocalTrackPublished).off(vf.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(vf.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(vf.MediaDevicesError,this.onMediaDevicesError).off(vf.AudioStreamAcquired,this.startAudio).off(vf.ChatMessage,this.onLocalChatMessageSent).off(vf.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&&"boolean"==typeof this.options.webAudioMix&&(this.audioContext.close(),this.audioContext=void 0),pk()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),null===(r=navigator.mediaDevices)||void 0===r||r.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Sw.Disconnected),this.emit(mf.Disconnected,t)}}}handleParticipantDisconnected(e,t){var r;this.remoteParticipants.delete(e),t&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(e),t.trackPublications.forEach(e=>{t.unpublishTrack(e.trackSid,!0)}),this.emit(mf.ParticipantDisconnected,t),t.setDisconnected(),null===(r=this.localParticipant)||void 0===r||r.handleParticipantDisconnected(t.identity))}handleIncomingRpcRequest(e,t,r,i,n,o){return Vg(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,t),1!==o)return void(yield this.engine.publishRpcResponse(e,t,null,qb.builtIn("UNSUPPORTED_VERSION")));const a=this.rpcHandlers.get(r);if(!a)return void(yield this.engine.publishRpcResponse(e,t,null,qb.builtIn("UNSUPPORTED_METHOD")));let s=null,l=null;try{const r=yield a({requestId:t,callerIdentity:e,payload:i,responseTimeout:n});$b(r)>15360?s=qb.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"):l=r}catch(c){s=c instanceof qb?c:qb.builtIn("APPLICATION_ERROR")}yield this.engine.publishRpcResponse(e,t,l,s)})}selectDefaultDevices(){return Vg(this,void 0,void 0,function*(){var e,t,r;const i=rb.getInstance().previousDevices,n=yield rb.getInstance().getDevices(void 0,!1),o=Lf();if("Chrome"===(null==o?void 0:o.name)&&"iOS"!==o.os)for(let s of n){const e=i.find(e=>e.deviceId===s.deviceId);e&&""!==e.label&&e.kind===s.kind&&e.label!==s.label&&"default"===this.getActiveDevice(s.kind)&&this.emit(mf.ActiveDeviceChanged,s.kind,s.deviceId)}const a=["audiooutput","audioinput","videoinput"];for(let s of a){const o=Gk(s),a=this.localParticipant.getTrackPublication(o);if(a&&(null===(e=a.track)||void 0===e?void 0:e.isUserProvided))continue;const l=n.filter(e=>e.kind===s),c=this.getActiveDevice(s);c===(null===(t=i.filter(e=>e.kind===s)[0])||void 0===t?void 0:t.deviceId)&&l.length>0&&(null===(r=l[0])||void 0===r?void 0:r.deviceId)!==c?yield this.switchActiveDevice(s,l[0].deviceId):"audioinput"===s&&!uk()||"videoinput"===s||!(l.length>0)||l.find(e=>e.deviceId===this.getActiveDevice(s))||"audiooutput"===s&&uk()||(yield this.switchActiveDevice(s,l[0].deviceId))}})}acquireAudioContext(){return Vg(this,void 0,void 0,function*(){var e,t;if("boolean"!=typeof this.options.webAudioMix&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:this.audioContext&&"closed"!==this.audioContext.state||(this.audioContext=null!==(e=Wk())&&void 0!==e?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(e=>e.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&"suspended"===this.audioContext.state)try{yield Promise.race([this.audioContext.resume(),nk(200)])}catch(VT){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:VT}))}const r="running"===(null===(t=this.audioContext)||void 0===t?void 0:t.state);r!==this.canPlaybackAudio&&(this.audioEnabled=r,this.emit(mf.AudioPlaybackStatusChanged,r))})}createParticipant(e,t){var r;let i;return i=t?Qw.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):new Qw(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),(null===(r=this.options.audioOutput)||void 0===r?void 0:r.deviceId)&&i.setAudioOutput(this.options.audioOutput).catch(e=>this.log.warn("Could not set audio output: ".concat(e.message),this.logContext)),i}getOrCreateParticipant(e,t){if(this.remoteParticipants.has(e)){const r=this.remoteParticipants.get(e);return t&&r.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),r}const r=this.createParticipant(e,t);return this.remoteParticipants.set(e,r),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(mf.ParticipantConnected,r),r.on(vf.TrackPublished,e=>{this.emitWhenConnected(mf.TrackPublished,e,r)}).on(vf.TrackSubscribed,(e,t)=>{e.kind===qf.Kind.Audio?(e.on(wf.AudioPlaybackStarted,this.handleAudioPlaybackStarted),e.on(wf.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):e.kind===qf.Kind.Video&&(e.on(wf.VideoPlaybackFailed,this.handleVideoPlaybackFailed),e.on(wf.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(mf.TrackSubscribed,e,t,r)}).on(vf.TrackUnpublished,e=>{this.emit(mf.TrackUnpublished,e,r)}).on(vf.TrackUnsubscribed,(e,t)=>{this.emit(mf.TrackUnsubscribed,e,t,r)}).on(vf.TrackMuted,e=>{this.emitWhenConnected(mf.TrackMuted,e,r)}).on(vf.TrackUnmuted,e=>{this.emitWhenConnected(mf.TrackUnmuted,e,r)}).on(vf.ParticipantMetadataChanged,e=>{this.emitWhenConnected(mf.ParticipantMetadataChanged,e,r)}).on(vf.ParticipantNameChanged,e=>{this.emitWhenConnected(mf.ParticipantNameChanged,e,r)}).on(vf.AttributesChanged,e=>{this.emitWhenConnected(mf.ParticipantAttributesChanged,e,r)}).on(vf.ConnectionQualityChanged,e=>{this.emitWhenConnected(mf.ConnectionQualityChanged,e,r)}).on(vf.ParticipantPermissionsChanged,e=>{this.emitWhenConnected(mf.ParticipantPermissionsChanged,e,r)}).on(vf.TrackSubscriptionStatusChanged,(e,t)=>{this.emitWhenConnected(mf.TrackSubscriptionStatusChanged,e,t,r)}).on(vf.TrackSubscriptionFailed,(e,t)=>{this.emit(mf.TrackSubscriptionFailed,e,r,t)}).on(vf.TrackSubscriptionPermissionChanged,(e,t)=>{this.emitWhenConnected(mf.TrackSubscriptionPermissionChanged,e,t,r)}).on(vf.Active,()=>{this.emitWhenConnected(mf.ParticipantActive,r),r.kind===Hp.AGENT&&this.localParticipant.setActiveAgent(r)}),t&&r.updateInfo(t),r}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((e,t)=>(e.push(...t.getTrackPublications()),e),[]),t=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,t)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const t of e.videoTrackPublications.values())t.isSubscribed&&Bk(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(e){const t=this.sidToIdentity.get(e);if(t)return this.remoteParticipants.get(t)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Uf.setInterval(()=>{this.engine&&!this.engine.isClosed&&this.engine.verifyTransport()?e=0:(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,Np.STATE_MISMATCH)))},4e3)}clearConnectionReconcile(){this.connectionReconcileInterval&&Uf.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e!==this.state&&(this.state=e,this.emit(mf.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[t,r]=e;this.emit(t,...r)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];if(this.state===Sw.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,r]);else if(this.state===Sw.Connected)return this.emit(e,...r);return!1}simulateParticipants(e){return Vg(this,void 0,void 0,function*(){var t,r;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),n=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new Fp({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:gh.parse((new Date).getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new qp({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(mf.SignalConnected),this.emit(mf.Connected),this.setAndEmitConnectionState(Sw.Connected),i.video){const e=new Gw(qf.Kind.Video,new Jp({source:Rp.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO,name:"video-dummy"}),new dw(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:Ek(160*(null!==(t=n.aspectRatios[0])&&void 0!==t?t:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(e),this.localParticipant.emit(vf.LocalTrackPublished,e)}if(i.audio){const e=new Gw(qf.Kind.Audio,new Jp({source:Rp.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO}),new Qb(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:Ik(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(e),this.localParticipant.emit(vf.LocalTrackPublished,e)}for(let e=0;e<n.count-1;e+=1){let t=new qp({sid:Math.floor(1e4*Math.random()).toString(),identity:"simulated-".concat(e),state:$p.ACTIVE,tracks:[],joinedAt:gh.parse(Date.now())});const i=this.getOrCreateParticipant(t.identity,t);if(n.video){const o=Ek(160*(null!==(r=n.aspectRatios[e%n.aspectRatios.length])&&void 0!==r?r:1),160,!1,!0),a=new Jp({source:Rp.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO});i.addSubscribedMediaTrack(o,a.sid,new MediaStream([o]),new RTCRtpReceiver),t.tracks=[...t.tracks,a]}if(n.audio){const e=Ik(),r=new Jp({source:Rp.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO});i.addSubscribedMediaTrack(e,r.sid,new MediaStream([e]),new RTCRtpReceiver),t.tracks=[...t.tracks,r]}i.updateInfo(t)}})}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];if(e!==mf.ActiveSpeakersChanged&&e!==mf.TranscriptionReceived){const t=ey(r).filter(e=>void 0!==e);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:t}))}return super.emit(e,...r)}}function ey(e){return e.map(e=>{if(e)return Array.isArray(e)?ey(e):"object"==typeof e?"logContext"in e?e.logContext:void 0:e})}function ty(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Xw.cleanupRegistry="undefined"!=typeof FinalizationRegistry&&new FinalizationRegistry(e=>{e()}),(_w=Ew||(Ew={}))[_w.IDLE=0]="IDLE",_w[_w.RUNNING=1]="RUNNING",_w[_w.SKIPPED=2]="SKIPPED",_w[_w.SUCCESS=3]="SUCCESS",_w[_w.FAILED=4]="FAILED",Wg.EventEmitter,Wg.EventEmitter,new TextEncoder,new TextDecoder;class ry extends Error{constructor(e,t){var r;super(e,t),ty(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(r=Error.captureStackTrace)||void 0===r||r.call(Error,this,this.constructor)}}function iy(){return iy=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},iy.apply(null,arguments)}ty(ry,"code","ERR_JOSE_GENERIC"),ty(class extends ry{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:r,reason:i,payload:t}}),ty(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),ty(this,"claim",void 0),ty(this,"reason",void 0),ty(this,"payload",void 0),this.claim=r,this.reason=i,this.payload=t}},"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),ty(class extends ry{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:r,reason:i,payload:t}}),ty(this,"code","ERR_JWT_EXPIRED"),ty(this,"claim",void 0),ty(this,"reason",void 0),ty(this,"payload",void 0),this.claim=r,this.reason=i,this.payload=t}},"code","ERR_JWT_EXPIRED"),ty(class extends ry{constructor(){super(...arguments),ty(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}},"code","ERR_JOSE_ALG_NOT_ALLOWED"),ty(class extends ry{constructor(){super(...arguments),ty(this,"code","ERR_JOSE_NOT_SUPPORTED")}},"code","ERR_JOSE_NOT_SUPPORTED"),ty(class extends ry{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),ty(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),ty(class extends ry{constructor(){super(...arguments),ty(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID"),ty(class extends ry{constructor(){super(...arguments),ty(this,"code","ERR_JWS_INVALID")}},"code","ERR_JWS_INVALID"),ty(class extends ry{constructor(){super(...arguments),ty(this,"code","ERR_JWT_INVALID")}},"code","ERR_JWT_INVALID"),ty(class extends ry{constructor(){super(...arguments),ty(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID"),ty(class extends ry{constructor(){super(...arguments),ty(this,"code","ERR_JWKS_INVALID")}},"code","ERR_JWKS_INVALID"),ty(class extends ry{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),ty(this,"code","ERR_JWKS_NO_MATCHING_KEY")}},"code","ERR_JWKS_NO_MATCHING_KEY"),ty(class extends ry{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),ty(this,Symbol.asyncIterator,void 0),ty(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}},"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS"),ty(class extends ry{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),ty(this,"code","ERR_JWKS_TIMEOUT")}},"code","ERR_JWKS_TIMEOUT"),ty(class extends ry{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),ty(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}},"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const ny=new Uint8Array(0);class oy{static getFullOptions(e){return iy({clientTools:{},onConnect:()=>{},onDebug:()=>{},onDisconnect:()=>{},onError:()=>{},onMessage:()=>{},onAudio:()=>{},onModeChange:()=>{},onStatusChange:()=>{},onCanSendFeedbackChange:()=>{},onInterruption:()=>{}},e)}constructor(e,t){var r=this;this.options=void 0,this.connection=void 0,this.lastInterruptTimestamp=0,this.mode="listening",this.status="connecting",this.volume=1,this.currentEventId=1,this.lastFeedbackEventId=0,this.canSendFeedback=!1,this.endSessionWithDetails=async function(e){"connected"!==r.status&&"connecting"!==r.status||(r.updateStatus("disconnecting"),await r.handleEndSession(),r.updateStatus("disconnected"),r.options.onDisconnect&&r.options.onDisconnect(e))},this.onMessage=async function(e){switch(e.type){case"interruption":return void r.handleInterruption(e);case"agent_response":return void r.handleAgentResponse(e);case"user_transcript":return void r.handleUserTranscript(e);case"internal_tentative_agent_response":return void r.handleTentativeAgentResponse(e);case"client_tool_call":try{await r.handleClientToolCall(e)}catch(t){r.onError(`Unexpected error in client tool call handling: ${t instanceof Error?t.message:String(t)}`,{clientToolName:e.client_tool_call.tool_name,toolCallId:e.client_tool_call.tool_call_id})}return;case"audio":return void r.handleAudio(e);case"vad_score":return void r.handleVadScore(e);case"ping":return void r.connection.sendMessage({type:"pong",event_id:e.ping_event.event_id});case"mcp_tool_call":return void r.handleMCPToolCall(e);case"mcp_connection_status":return void r.handleMCPConnectionStatus(e);case"agent_tool_response":return void r.handleAgentToolResponse(e);case"conversation_initiation_metadata":return void r.handleConversationMetadata(e);case"asr_initiation_metadata":return void r.handleAsrInitiationMetadata(e);default:return void(r.options.onDebug&&r.options.onDebug(e))}},this.setVolume=({volume:e})=>{this.volume=e},this.options=e,this.connection=t,this.options.onConnect&&this.options.onConnect({conversationId:t.conversationId}),this.connection.onMessage(this.onMessage),this.connection.onDisconnect(this.endSessionWithDetails),this.connection.onModeChange(e=>this.updateMode(e)),this.updateStatus("connected")}endSession(){return this.endSessionWithDetails({reason:"user"})}async handleEndSession(){this.connection.close()}updateMode(e){e!==this.mode&&(this.mode=e,this.options.onModeChange&&this.options.onModeChange({mode:e}))}updateStatus(e){e!==this.status&&(this.status=e,this.options.onStatusChange&&this.options.onStatusChange({status:e}))}updateCanSendFeedback(){const e=this.currentEventId!==this.lastFeedbackEventId;this.canSendFeedback!==e&&(this.canSendFeedback=e,this.options.onCanSendFeedbackChange&&this.options.onCanSendFeedbackChange({canSendFeedback:e}))}handleInterruption(e){e.interruption_event&&(this.lastInterruptTimestamp=e.interruption_event.event_id,this.options.onInterruption&&this.options.onInterruption({event_id:e.interruption_event.event_id}))}handleAgentResponse(e){this.options.onMessage&&this.options.onMessage({source:"ai",message:e.agent_response_event.agent_response})}handleUserTranscript(e){this.options.onMessage&&this.options.onMessage({source:"user",message:e.user_transcription_event.user_transcript})}handleTentativeAgentResponse(e){this.options.onDebug&&this.options.onDebug({type:"tentative_agent_response",response:e.tentative_agent_response_internal_event.tentative_agent_response})}handleVadScore(e){this.options.onVadScore&&this.options.onVadScore({vadScore:e.vad_score_event.vad_score})}async handleClientToolCall(e){if(Object.prototype.hasOwnProperty.call(this.options.clientTools,e.client_tool_call.tool_name))try{var t;const r=null!=(t=await this.options.clientTools[e.client_tool_call.tool_name](e.client_tool_call.parameters))?t:"Client tool execution successful.",i="object"==typeof r?JSON.stringify(r):String(r);this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:i,is_error:!1})}catch(r){this.onError(`Client tool execution failed with following error: ${null==r?void 0:r.message}`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool execution failed: ${null==r?void 0:r.message}`,is_error:!0})}else{if(this.options.onUnhandledClientToolCall)return void this.options.onUnhandledClientToolCall(e.client_tool_call);this.onError(`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,is_error:!0})}}handleAudio(e){}handleMCPToolCall(e){this.options.onMCPToolCall&&this.options.onMCPToolCall(e.mcp_tool_call)}handleMCPConnectionStatus(e){this.options.onMCPConnectionStatus&&this.options.onMCPConnectionStatus(e.mcp_connection_status)}handleAgentToolResponse(e){this.options.onAgentToolResponse&&this.options.onAgentToolResponse(e.agent_tool_response)}handleConversationMetadata(e){this.options.onConversationMetadata&&this.options.onConversationMetadata(e.conversation_initiation_metadata_event)}handleAsrInitiationMetadata(e){this.options.onAsrInitiationMetadata&&this.options.onAsrInitiationMetadata(e.asr_initiation_metadata_event)}onError(e,t){this.options.onError&&this.options.onError(e,t)}getId(){return this.connection.conversationId}isOpen(){return"connected"===this.status}setMicMuted(e){this.connection.setMicMuted(e)}getInputByteFrequencyData(){return ny}getOutputByteFrequencyData(){return ny}getInputVolume(){return 0}getOutputVolume(){return 0}sendFeedback(e){this.canSendFeedback&&(this.connection.sendMessage({type:"feedback",score:e?"like":"dislike",event_id:this.currentEventId}),this.lastFeedbackEventId=this.currentEventId,this.updateCanSendFeedback())}sendContextualUpdate(e){this.connection.sendMessage({type:"contextual_update",text:e})}sendUserMessage(e){this.connection.sendMessage({type:"user_message",text:e})}sendUserActivity(){this.connection.sendMessage({type:"user_activity"})}sendMCPToolApprovalResult(e,t){this.connection.sendMessage({type:"mcp_tool_approval_result",tool_call_id:e,is_approved:t})}}class ay{constructor(e={}){this.queue=[],this.disconnectionDetails=null,this.onDisconnectCallback=null,this.onMessageCallback=null,this.onModeChangeCallback=null,this.onDebug=void 0,this.onDebug=e.onDebug}debug(e){this.onDebug&&this.onDebug(e)}onMessage(e){this.onMessageCallback=e;const t=this.queue;this.queue=[],t.length>0&&queueMicrotask(()=>{t.forEach(e)})}onDisconnect(e){this.onDisconnectCallback=e;const t=this.disconnectionDetails;t&&queueMicrotask(()=>{e(t)})}onModeChange(e){this.onModeChangeCallback=e}updateMode(e){var t;null==(t=this.onModeChangeCallback)||t.call(this,e)}disconnect(e){var t;this.disconnectionDetails||(this.disconnectionDetails=e,null==(t=this.onDisconnectCallback)||t.call(this,e))}handleMessage(e){this.onMessageCallback?this.onMessageCallback(e):this.queue.push(e)}}function sy(e){const[t,r]=e.split("_");if(!["pcm","ulaw"].includes(t))throw new Error(`Invalid format: ${e}`);const i=Number.parseInt(r);if(Number.isNaN(i))throw new Error(`Invalid sample rate: ${r}`);return{format:t,sampleRate:i}}const ly="0.7.1";function cy(e){return!!e.type}const dy="conversation_initiation_client_data";function uy(e){var t;const r={type:dy};var i,n,o,a,s;return e.overrides&&(r.conversation_config_override={agent:{prompt:null==(i=e.overrides.agent)?void 0:i.prompt,first_message:null==(n=e.overrides.agent)?void 0:n.firstMessage,language:null==(o=e.overrides.agent)?void 0:o.language},tts:{voice_id:null==(a=e.overrides.tts)?void 0:a.voiceId},conversation:{text_only:null==(s=e.overrides.conversation)?void 0:s.textOnly}}),e.customLlmExtraBody&&(r.custom_llm_extra_body=e.customLlmExtraBody),e.dynamicVariables&&(r.dynamic_variables=e.dynamicVariables),e.userId&&(r.user_id=e.userId),null!=(t=e.overrides)&&t.client&&(r.source_info={source:e.overrides.client.source,version:e.overrides.client.version}),r}let hy=class e extends ay{constructor(e,t,r,i){super(),this.socket=void 0,this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.socket=e,this.conversationId=t,this.inputFormat=r,this.outputFormat=i,this.socket.addEventListener("error",e=>{setTimeout(()=>this.disconnect({reason:"error",message:"The connection was closed due to a socket error.",context:e}),0)}),this.socket.addEventListener("close",e=>{this.disconnect(1e3===e.code?{reason:"agent",context:e}:{reason:"error",message:e.reason||"The connection was closed by the server.",context:e})}),this.socket.addEventListener("message",e=>{try{const t=JSON.parse(e.data);if(!cy(t))return void this.debug({type:"invalid_event",message:"Received invalid socket event",data:e.data});this.handleMessage(t)}catch(t){this.debug({type:"parsing_error",message:"Failed to parse socket message",error:t instanceof Error?t.message:String(t),data:e.data})}})}static async create(t){let r=null;try{var i,n,o;const a=null!=(i=t.origin)?i:"wss://api.elevenlabs.io";let s;const l=(null==(n=t.overrides)||null==(n=n.client)?void 0:n.version)||ly,c=(null==(o=t.overrides)||null==(o=o.client)?void 0:o.source)||"js_sdk";if(t.signedUrl){const e=t.signedUrl.includes("?")?"&":"?";s=`${t.signedUrl}${e}source=${c}&version=${l}`}else s=`${a}/v1/convai/conversation?agent_id=${t.agentId}&source=${c}&version=${l}`;const d=["convai"];t.authorization&&d.push(`bearer.${t.authorization}`),r=new WebSocket(s,d);const u=await new Promise((e,i)=>{r.addEventListener("open",()=>{var e;const i=uy(t);null==(e=r)||e.send(JSON.stringify(i))},{once:!0}),r.addEventListener("error",e=>{setTimeout(()=>i(e),0)}),r.addEventListener("close",i),r.addEventListener("message",t=>{const r=JSON.parse(t.data);cy(r)&&"conversation_initiation_metadata"===r.type&&e(r.conversation_initiation_metadata_event)},{once:!0})}),{conversation_id:h,agent_output_audio_format:p,user_input_audio_format:m}=u,g=sy(null!=m?m:"pcm_16000"),v=sy(p);return new e(r,h,g,v)}catch(s){var a;throw null==(a=r)||a.close(),s}}close(){this.socket.close()}sendMessage(e){this.socket.send(JSON.stringify(e))}async setMicMuted(e){}};function py(e){const t=new Uint8Array(e);return window.btoa(String.fromCharCode(...t))}function my(e){const t=window.atob(e),r=t.length,i=new Uint8Array(r);for(let n=0;n<r;n++)i[n]=t.charCodeAt(n);return i.buffer}const gy=new Map;function vy(e,t){return async(r,i)=>{const n=gy.get(e);if(n)return r.addModule(n);if(i)try{return await r.addModule(i),void gy.set(e,i)}catch(s){throw new Error(`Failed to load the ${e} worklet module from path: ${i}. Error: ${s}`)}const o=new Blob([t],{type:"application/javascript"}),a=URL.createObjectURL(o);try{return await r.addModule(a),void gy.set(e,a)}catch(l){URL.revokeObjectURL(a)}try{const i=`data:application/javascript;base64,${btoa(t)}`;await r.addModule(i),gy.set(e,i)}catch(s){throw new Error(`Failed to load the ${e} worklet module. Make sure the browser supports AudioWorklets. If you are using a strict CSP, you may need to self-host the worklet files.`)}}}const fy=vy("rawAudioProcessor",'/*\n * ulaw encoding logic taken from the wavefile library\n * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js\n * USED BY @elevenlabs/client\n */\n\nconst BIAS = 0x84;\nconst CLIP = 32635;\nconst encodeTable = [\n 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,\n 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,\n 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,\n 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7\n];\n\nfunction encodeSample(sample) {\n let sign;\n let exponent;\n let mantissa;\n let muLawSample;\n sign = (sample >> 8) & 0x80;\n if (sign !== 0) sample = -sample;\n sample = sample + BIAS;\n if (sample > CLIP) sample = CLIP;\n exponent = encodeTable[(sample>>7) & 0xFF];\n mantissa = (sample >> (exponent+3)) & 0x0F;\n muLawSample = ~(sign | (exponent << 4) | mantissa);\n \n return muLawSample;\n}\n\nclass RawAudioProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n \n this.port.onmessage = ({ data }) => {\n switch (data.type) {\n case "setFormat":\n this.isMuted = false;\n this.buffer = []; // Initialize an empty buffer\n this.bufferSize = data.sampleRate / 4;\n this.format = data.format;\n\n if (globalThis.LibSampleRate && sampleRate !== data.sampleRate) {\n globalThis.LibSampleRate.create(1, sampleRate, data.sampleRate).then(resampler => {\n this.resampler = resampler;\n });\n }\n break;\n case "setMuted":\n this.isMuted = data.isMuted;\n break;\n }\n };\n }\n process(inputs) {\n if (!this.buffer) {\n return true;\n }\n \n const input = inputs[0]; // Get the first input node\n if (input.length > 0) {\n let channelData = input[0]; // Get the first channel\'s data\n\n // Resample the audio if necessary\n if (this.resampler) {\n channelData = this.resampler.full(channelData);\n }\n\n // Add channel data to the buffer\n this.buffer.push(...channelData);\n // Get max volume \n let sum = 0.0;\n for (let i = 0; i < channelData.length; i++) {\n sum += channelData[i] * channelData[i];\n }\n const maxVolume = Math.sqrt(sum / channelData.length);\n // Check if buffer size has reached or exceeded the threshold\n if (this.buffer.length >= this.bufferSize) {\n const float32Array = this.isMuted \n ? new Float32Array(this.buffer.length)\n : new Float32Array(this.buffer);\n\n let encodedArray = this.format === "ulaw"\n ? new Uint8Array(float32Array.length)\n : new Int16Array(float32Array.length);\n\n // Iterate through the Float32Array and convert each sample to PCM16\n for (let i = 0; i < float32Array.length; i++) {\n // Clamp the value to the range [-1, 1]\n let sample = Math.max(-1, Math.min(1, float32Array[i]));\n\n // Scale the sample to the range [-32768, 32767]\n let value = sample < 0 ? sample * 32768 : sample * 32767;\n if (this.format === "ulaw") {\n value = encodeSample(Math.round(value));\n }\n\n encodedArray[i] = value;\n }\n\n // Send the buffered data to the main script\n this.port.postMessage([encodedArray, maxVolume]);\n\n // Clear the buffer after sending\n this.buffer = [];\n }\n }\n return true; // Continue processing\n }\n}\nregisterProcessor("rawAudioProcessor", RawAudioProcessor);\n');let ky=class e extends ay{constructor(e,t,r,i,n={}){super(n),this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.room=void 0,this.isConnected=!1,this.audioEventId=1,this.audioCaptureContext=null,this.audioElements=[],this.outputDeviceId=null,this.outputAnalyser=null,this.outputFrequencyData=null,this.room=e,this.conversationId=t,this.inputFormat=r,this.outputFormat=i,this.setupRoomEventListeners()}static async create(t){let r;if("conversationToken"in t&&t.conversationToken)r=t.conversationToken;else{if(!("agentId"in t)||!t.agentId)throw new Error("Either conversationToken or agentId is required for WebRTC connection");try{var i,n,o;const e=(null==(i=t.overrides)||null==(i=i.client)?void 0:i.version)||ly,s=(null==(n=t.overrides)||null==(n=n.client)?void 0:n.source)||"js_sdk",l=`${a=null!=(o=t.origin)?o:"https://api.elevenlabs.io",a.replace(/^wss:\/\//,"https://")}/v1/convai/conversation/token?agent_id=${t.agentId}&source=${s}&version=${e}`,c=await fetch(l);if(!c.ok)throw new Error(`ElevenLabs API returned ${c.status} ${c.statusText}`);if(r=(await c.json()).token,!r)throw new Error("No conversation token received from API")}catch(VT){let r=VT instanceof Error?VT.message:String(VT);throw VT instanceof Error&&VT.message.includes("401")&&(r="Your agent has authentication enabled, but no signed URL or conversation token was provided."),new Error(`Failed to fetch conversation token for agent ${t.agentId}: ${r}`)}}var a;const s=new Xw;try{const i=`room_${Date.now()}`,n=sy("pcm_48000"),o=sy("pcm_48000"),a=new e(s,i,n,o,t),c=t.livekitUrl||"wss://livekit.rtc.elevenlabs.io";var l;await s.connect(c,r),await new Promise(e=>{if(a.isConnected)e();else{const t=()=>{s.off(mf.Connected,t),e()};s.on(mf.Connected,t)}}),s.name&&(a.conversationId=(null==(l=s.name.match(/(conv_[a-zA-Z0-9]+)/))?void 0:l[0])||s.name),await s.localParticipant.setMicrophoneEnabled(!0);const d=uy(t);return a.debug({type:dy,message:d}),await a.sendMessage(d),a}catch(VT){throw await s.disconnect(),VT}}setupRoomEventListeners(){var e=this;this.room.on(mf.Connected,async function(){e.isConnected=!0}),this.room.on(mf.Disconnected,e=>{this.isConnected=!1,this.disconnect({reason:"agent",context:new CloseEvent("close",{reason:null==e?void 0:e.toString()})})}),this.room.on(mf.ConnectionStateChanged,e=>{e===Sw.Disconnected&&(this.isConnected=!1,this.disconnect({reason:"error",message:`LiveKit connection state changed to ${e}`,context:new Event("connection_state_changed")}))}),this.room.on(mf.DataReceived,(e,t)=>{try{const t=JSON.parse((new TextDecoder).decode(e));if("audio"===t.type)return;cy(t)&&this.handleMessage(t)}catch(r){}}),this.room.on(mf.TrackSubscribed,async function(t,r,i){if(t.kind===qf.Kind.Audio&&i.identity.includes("agent")){const r=t,i=r.attach();if(i.autoplay=!0,i.controls=!1,e.outputDeviceId&&i.setSinkId)try{await i.setSinkId(e.outputDeviceId)}catch(n){}i.style.display="none",document.body.appendChild(i),e.audioElements.push(i),1===e.audioElements.length&&(null==e.onDebug||e.onDebug({type:"audio_element_ready"})),await e.setupAudioCapture(r)}}),this.room.on(mf.ActiveSpeakersChanged,async function(t){e.updateMode(t.length>0&&t[0].identity.startsWith("agent")?"speaking":"listening")})}close(){if(this.isConnected){try{this.room.localParticipant.audioTrackPublications.forEach(e=>{e.track&&e.track.stop()})}catch(VT){}this.audioCaptureContext&&(this.audioCaptureContext.close().catch(e=>{}),this.audioCaptureContext=null),this.audioElements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.audioElements=[],this.room.disconnect()}}async sendMessage(e){if(this.isConnected&&this.room.localParticipant&&!("user_audio_chunk"in e))try{const t=(new TextEncoder).encode(JSON.stringify(e));await this.room.localParticipant.publishData(t,{reliable:!0})}catch(t){this.debug({type:"send_message_error",message:{message:e,error:t}})}}getRoom(){return this.room}async setMicMuted(e){if(!this.isConnected||!this.room.localParticipant)return;const t=this.room.localParticipant.getTrackPublication(qf.Source.Microphone);if(null!=t&&t.track)try{e?await t.track.mute():await t.track.unmute()}catch(r){await this.room.localParticipant.setMicrophoneEnabled(!e)}else await this.room.localParticipant.setMicrophoneEnabled(!e)}async setupAudioCapture(e){try{const t=new AudioContext;this.audioCaptureContext=t,this.outputAnalyser=t.createAnalyser(),this.outputAnalyser.fftSize=2048,this.outputAnalyser.smoothingTimeConstant=.8;const r=new MediaStream([e.mediaStreamTrack]),i=t.createMediaStreamSource(r);i.connect(this.outputAnalyser),await fy(t.audioWorklet);const n=new AudioWorkletNode(t,"rawAudioProcessor");this.outputAnalyser.connect(n),n.port.postMessage({type:"setFormat",format:this.outputFormat.format,sampleRate:this.outputFormat.sampleRate}),n.port.onmessage=e=>{const[t,r]=e.data;if(r>.01){const e=py(t.buffer),r=this.audioEventId++;this.handleMessage({type:"audio",audio_event:{audio_base_64:e,event_id:r}})}},i.connect(n)}catch(t){}}setAudioVolume(e){this.audioElements.forEach(t=>{t.volume=e})}async setAudioOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");const t=this.audioElements.map(async function(t){try{await t.setSinkId(e)}catch(r){throw r}});await Promise.all(t),this.outputDeviceId=e}async setAudioInputDevice(e){if(!this.isConnected||!this.room.localParticipant)throw new Error("Cannot change input device: room not connected or no local participant");try{const t=this.room.localParticipant.getTrackPublication(qf.Source.Microphone);null!=t&&t.track&&(await t.track.stop(),await this.room.localParticipant.unpublishTrack(t.track));const r={deviceId:{exact:e},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}},i=await function(e){return Vg(this,void 0,void 0,function*(){return(yield Zw({audio:null==e||e,video:!1}))[0]})}(r);await this.room.localParticipant.publishTrack(i,{name:"microphone",source:qf.Source.Microphone})}catch(t){try{await this.room.localParticipant.setMicrophoneEnabled(!0)}catch(r){}throw t}}getOutputByteFrequencyData(){return this.outputAnalyser?(null!=this.outputFrequencyData||(this.outputFrequencyData=new Uint8Array(this.outputAnalyser.frequencyBinCount)),this.outputAnalyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData):null}};async function by(e){const t=(r=e).connectionType?r.connectionType:"conversationToken"in r&&r.conversationToken?"webrtc":"websocket";var r;switch(t){case"websocket":return hy.create(e);case"webrtc":return ky.create(e);default:throw new Error(`Unknown connection type: ${t}`)}}function wy(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}async function yy(e={default:0,android:3e3}){let t=e.default;var r;if(/android/i.test(navigator.userAgent))t=null!=(r=e.android)?r:t;else if(wy()){var i;t=null!=(i=e.ios)?i:t}t>0&&await new Promise(e=>setTimeout(e,t))}let xy=class e extends oy{static async startSession(t){const r=oy.getFullOptions(t);r.onStatusChange&&r.onStatusChange({status:"connecting"}),r.onCanSendFeedbackChange&&r.onCanSendFeedbackChange({canSendFeedback:!1}),r.onModeChange&&r.onModeChange({mode:"listening"}),r.onCanSendFeedbackChange&&r.onCanSendFeedbackChange({canSendFeedback:!1});let i=null;try{return await yy(r.connectionDelay),i=await by(t),new e(r,i)}catch(o){var n;throw r.onStatusChange&&r.onStatusChange({status:"disconnected"}),null==(n=i)||n.close(),o}}};const Cy={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}};let Sy=class e{static async create({sampleRate:t,format:r,preferHeadphonesForIosDevices:i,inputDeviceId:n,workletPaths:o,libsampleratePath:a}){let s=null,l=null;try{const c=iy({sampleRate:{ideal:t}},Cy);if(wy()&&i){const e=(await window.navigator.mediaDevices.enumerateDevices()).find(e=>"audioinput"===e.kind&&["airpod","headphone","earphone"].find(t=>e.label.toLowerCase().includes(t)));e&&(c.deviceId={ideal:e.deviceId})}n&&(c.deviceId={exact:n});const d=navigator.mediaDevices.getSupportedConstraints().sampleRate;s=new window.AudioContext(d?{sampleRate:t}:{});const u=s.createAnalyser();if(!d){const e=a||"https://cdn.jsdelivr.net/npm/@alexanderolsen/libsamplerate-js@2.1.2/dist/libsamplerate.worklet.js";await s.audioWorklet.addModule(e)}await fy(s.audioWorklet,null==o?void 0:o.rawAudioProcessor);const h=iy({voiceIsolation:!0},c);l=await navigator.mediaDevices.getUserMedia({audio:h});const p=s.createMediaStreamSource(l),m=new AudioWorkletNode(s,"rawAudioProcessor");return m.port.postMessage({type:"setFormat",format:r,sampleRate:t}),p.connect(u),u.connect(m),await s.resume(),new e(s,u,m,l,p)}catch(u){var c,d;throw null==(c=l)||c.getTracks().forEach(e=>{e.stop()}),null==(d=s)||d.close(),u}}constructor(e,t,r,i,n){this.context=void 0,this.analyser=void 0,this.worklet=void 0,this.inputStream=void 0,this.mediaStreamSource=void 0,this.context=e,this.analyser=t,this.worklet=r,this.inputStream=i,this.mediaStreamSource=n}async close(){this.inputStream.getTracks().forEach(e=>{e.stop()}),this.mediaStreamSource.disconnect(),await this.context.close()}setMuted(e){this.worklet.port.postMessage({type:"setMuted",isMuted:e})}async setInputDevice(e){try{const t=iy({},Cy);e&&(t.deviceId={exact:e});const r=iy({voiceIsolation:!0},t),i=await navigator.mediaDevices.getUserMedia({audio:r});this.inputStream.getTracks().forEach(e=>{e.stop()}),this.mediaStreamSource.disconnect(),this.inputStream=i,this.mediaStreamSource=this.context.createMediaStreamSource(i),this.mediaStreamSource.connect(this.analyser)}catch(t){throw t}}};const Ty=vy("audioConcatProcessor",'/*\n * ulaw decoding logic taken from the wavefile library\n * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js\n * USED BY @elevenlabs/client\n */\n\nconst decodeTable = [0,132,396,924,1980,4092,8316,16764];\n\nfunction decodeSample(muLawSample) {\n let sign;\n let exponent;\n let mantissa;\n let sample;\n muLawSample = ~muLawSample;\n sign = (muLawSample & 0x80);\n exponent = (muLawSample >> 4) & 0x07;\n mantissa = muLawSample & 0x0F;\n sample = decodeTable[exponent] + (mantissa << (exponent+3));\n if (sign !== 0) sample = -sample;\n\n return sample;\n}\n\nclass AudioConcatProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.buffers = []; // Initialize an empty buffer\n this.cursor = 0;\n this.currentBuffer = null;\n this.wasInterrupted = false;\n this.finished = false;\n \n this.port.onmessage = ({ data }) => {\n switch (data.type) {\n case "setFormat":\n this.format = data.format;\n break;\n case "buffer":\n this.wasInterrupted = false;\n this.buffers.push(\n this.format === "ulaw"\n ? new Uint8Array(data.buffer)\n : new Int16Array(data.buffer)\n );\n break;\n case "interrupt":\n this.wasInterrupted = true;\n break;\n case "clearInterrupted":\n if (this.wasInterrupted) {\n this.wasInterrupted = false;\n this.buffers = [];\n this.currentBuffer = null;\n }\n }\n };\n }\n process(_, outputs) {\n let finished = false;\n const output = outputs[0][0];\n for (let i = 0; i < output.length; i++) {\n if (!this.currentBuffer) {\n if (this.buffers.length === 0) {\n finished = true;\n break;\n }\n this.currentBuffer = this.buffers.shift();\n this.cursor = 0;\n }\n\n let value = this.currentBuffer[this.cursor];\n if (this.format === "ulaw") {\n value = decodeSample(value);\n }\n output[i] = value / 32768;\n this.cursor++;\n\n if (this.cursor >= this.currentBuffer.length) {\n this.currentBuffer = null;\n }\n }\n\n if (this.finished !== finished) {\n this.finished = finished;\n this.port.postMessage({ type: "process", finished });\n }\n\n return true; // Continue processing\n }\n}\n\nregisterProcessor("audioConcatProcessor", AudioConcatProcessor);\n');let Ey=class e{static async create({sampleRate:t,format:r,outputDeviceId:i,workletPaths:n}){let o=null,a=null;try{o=new AudioContext({sampleRate:t});const s=o.createAnalyser(),l=o.createGain();a=new Audio,a.src="",a.load(),a.autoplay=!0,a.style.display="none",document.body.appendChild(a);const c=o.createMediaStreamDestination();a.srcObject=c.stream,l.connect(s),s.connect(c),await Ty(o.audioWorklet,null==n?void 0:n.audioConcatProcessor);const d=new AudioWorkletNode(o,"audioConcatProcessor");return d.port.postMessage({type:"setFormat",format:r}),d.connect(l),await o.resume(),i&&a.setSinkId&&await a.setSinkId(i),new e(o,s,l,d,a)}catch(c){var s,l;throw null!=(s=a)&&s.parentNode&&a.parentNode.removeChild(a),null==(l=a)||l.pause(),o&&"closed"!==o.state&&await o.close(),c}}constructor(e,t,r,i,n){this.context=void 0,this.analyser=void 0,this.gain=void 0,this.worklet=void 0,this.audioElement=void 0,this.context=e,this.analyser=t,this.gain=r,this.worklet=i,this.audioElement=n}async setOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");await this.audioElement.setSinkId(e||"")}async close(){this.audioElement.parentNode&&this.audioElement.parentNode.removeChild(this.audioElement),this.audioElement.pause(),await this.context.close()}};class _y extends oy{static async startSession(e){var t;const r=oy.getFullOptions(e);r.onStatusChange&&r.onStatusChange({status:"connecting"}),r.onCanSendFeedbackChange&&r.onCanSendFeedbackChange({canSendFeedback:!1});let i=null,n=null,o=null,a=null,s=null;if(null==(t=e.useWakeLock)||t)try{s=await navigator.wakeLock.request("screen")}catch(m){}try{var l;return a=await navigator.mediaDevices.getUserMedia({audio:!0}),await yy(r.connectionDelay),n=await by(e),[i,o]=await Promise.all([Sy.create(iy({},n.inputFormat,{preferHeadphonesForIosDevices:e.preferHeadphonesForIosDevices,inputDeviceId:e.inputDeviceId,workletPaths:e.workletPaths,libsampleratePath:e.libsampleratePath})),Ey.create(iy({},n.outputFormat,{outputDeviceId:e.outputDeviceId,workletPaths:e.workletPaths}))]),null==(l=a)||l.getTracks().forEach(e=>{e.stop()}),a=null,new _y(r,n,i,o,s)}catch(m){var c,d,u,h;r.onStatusChange&&r.onStatusChange({status:"disconnected"}),null==(c=a)||c.getTracks().forEach(e=>{e.stop()}),null==(d=n)||d.close(),await(null==(u=i)?void 0:u.close()),await(null==(h=o)?void 0:h.close());try{var p;await(null==(p=s)?void 0:p.release()),s=null}catch(g){}throw m}}constructor(e,t,r,i,n){super(e,t),this.input=void 0,this.output=void 0,this.wakeLock=void 0,this.inputFrequencyData=void 0,this.outputFrequencyData=void 0,this.onInputWorkletMessage=e=>{"connected"===this.status&&this.connection.sendMessage({user_audio_chunk:py(e.data[0].buffer)})},this.onOutputWorkletMessage=({data:e})=>{"process"===e.type&&this.updateMode(e.finished?"listening":"speaking")},this.addAudioBase64Chunk=e=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"}),this.output.worklet.port.postMessage({type:"buffer",buffer:my(e)})},this.fadeOutAudio=()=>{this.updateMode("listening"),this.output.worklet.port.postMessage({type:"interrupt"}),this.output.gain.gain.exponentialRampToValueAtTime(1e-4,this.output.context.currentTime+2),setTimeout(()=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"})},2e3)},this.calculateVolume=e=>{if(0===e.length)return 0;let t=0;for(let r=0;r<e.length;r++)t+=e[r]/255;return t/=e.length,t<0?0:t>1?1:t},this.setVolume=({volume:e})=>{const t=Number.isFinite(e)?Math.min(1,Math.max(0,e)):1;this.volume=t,this.connection instanceof ky?this.connection.setAudioVolume(t):this.output.gain.gain.value=t},this.input=r,this.output=i,this.wakeLock=n,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.output.worklet.port.onmessage=this.onOutputWorkletMessage}async handleEndSession(){await super.handleEndSession();try{var e;await(null==(e=this.wakeLock)?void 0:e.release()),this.wakeLock=null}catch(t){}await this.input.close(),await this.output.close()}handleInterruption(e){super.handleInterruption(e),this.fadeOutAudio()}handleAudio(e){var t,r;this.lastInterruptTimestamp<=e.audio_event.event_id&&(null==(t=(r=this.options).onAudio)||t.call(r,e.audio_event.audio_base_64),this.connection instanceof ky||this.addAudioBase64Chunk(e.audio_event.audio_base_64),this.currentEventId=e.audio_event.event_id,this.updateCanSendFeedback(),this.updateMode("speaking"))}setMicMuted(e){this.connection instanceof ky?this.connection.setMicMuted(e):this.input.setMuted(e)}getInputByteFrequencyData(){return null!=this.inputFrequencyData||(this.inputFrequencyData=new Uint8Array(this.input.analyser.frequencyBinCount)),this.input.analyser.getByteFrequencyData(this.inputFrequencyData),this.inputFrequencyData}getOutputByteFrequencyData(){return this.connection instanceof ky?this.connection.getOutputByteFrequencyData()||new Uint8Array(1024):(null!=this.outputFrequencyData||(this.outputFrequencyData=new Uint8Array(this.output.analyser.frequencyBinCount)),this.output.analyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData)}getInputVolume(){return this.calculateVolume(this.getInputByteFrequencyData())}getOutputVolume(){return this.calculateVolume(this.getOutputByteFrequencyData())}async changeInputDevice({sampleRate:e,format:t,preferHeadphonesForIosDevices:r,inputDeviceId:i}){try{if(this.connection instanceof hy)try{return await this.input.setInputDevice(i),this.input}catch(n){}this.connection instanceof ky&&await this.connection.setAudioInputDevice(i||""),await this.input.close();const o=await Sy.create({sampleRate:null!=e?e:this.connection.inputFormat.sampleRate,format:null!=t?t:this.connection.inputFormat.format,preferHeadphonesForIosDevices:r,inputDeviceId:i,workletPaths:this.options.workletPaths,libsampleratePath:this.options.libsampleratePath});return this.input=o,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.input}catch(n){throw n}}async changeOutputDevice({sampleRate:e,format:t,outputDeviceId:r}){try{if(this.connection instanceof hy)try{return await this.output.setOutputDevice(r),this.output}catch(i){}this.connection instanceof ky&&await this.connection.setAudioOutputDevice(r||""),await this.output.close();const n=await Ey.create({sampleRate:null!=e?e:this.connection.outputFormat.sampleRate,format:null!=t?t:this.connection.outputFormat.format,outputDeviceId:r,workletPaths:this.options.workletPaths});return this.output=n,this.output}catch(i){throw i}}}let Iy=class extends oy{static startSession(e){return e.textOnly?xy.startSession(e):_y.startSession(e)}};var Py=Object.defineProperty,My=(e,t)=>Py(e,"name",{value:t,configurable:!0}),Ay=(e,t,r)=>((e,t,r)=>t in e?Py(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const Ry={bars:64,barWidth:3,barSpacing:1,minHeight:4,maxHeight:80,STIFFNESS:.18,DAMPING:.22,PEAK_HOLD_TIME:300,PEAK_DECAY_STIFFNESS:.12,PEAK_DECAY_DAMPING:.15},Oy=[85,100,120,140,155,170,185,200,215,230,245,260,275,290,315,340,355,375,400,425,450,475,500,530,560,590,630,670,700,730,780,820,880,940,1e3,1100,1200,1300,1400,1500,1600,1700,1800,1900,2e3,2200,2300,2500,2600,2800,3e3,3200,3500,3800,4e3,4300,4500,4800,5e3,5300,5500,5800,6e3,6500,7e3,7500,8e3,8500],Dy=class extends Na{constructor(e){super("ClientAudio",e),Ay(this,"audioContext"),Ay(this,"analyser"),Ay(this,"microphone"),Ay(this,"audioLevelInterval"),Ay(this,"stream"),Ay(this,"visibilityChangeHandler"),Ay(this,"audioLevels",Ut({inputLevel:0,outputLevel:0})),this.setupVisibilityHandler()}setupVisibilityHandler(){typeof document>"u"||(this.visibilityChangeHandler=()=>{document.hidden?(this.logger.info("App backgrounded, suspending audio context"),this.handleAppBackground()):(this.logger.info("App foregrounded, resuming audio context"),this.handleAppForeground())},document.addEventListener("visibilitychange",this.visibilityChangeHandler,{passive:!0}),window.addEventListener("beforeunload",()=>{this.cleanup().catch(this.logger.error.bind(this,"Error during beforeunload cleanup"))},{passive:!0}))}handleAppBackground(){this.audioContext&&"running"===this.audioContext.state&&this.audioContext.suspend().catch(this.logger.error.bind(this,"Error suspending audio context")),this.audioLevelInterval&&(clearInterval(this.audioLevelInterval),this.audioLevelInterval=void 0)}handleAppForeground(){this.audioContext&&"suspended"===this.audioContext.state&&this.audioContext.resume().catch(this.logger.error.bind(this,"Error resuming audio context")),this.analyser&&!this.audioLevelInterval&&this.startAudioLevelMonitoring()}async requestMicrophonePermission(e={}){try{const{noiseSuppression:t=!0,echoCancellation:r=!0,autoGainControl:i=!0}=e;return this.stream=await navigator.mediaDevices.getUserMedia({audio:{noiseSuppression:t,echoCancellation:r,autoGainControl:i}}),this.logger.info("Microphone permission granted"),await this.setupAudioAnalysis(),!0}catch(t){return this.logger.error("Microphone permission denied:",t),!1}}async setupAudioAnalysis(){if(!this.stream)throw new Error("No audio stream available");try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8,this.microphone.connect(this.analyser),this.logger.info("Audio analysis setup complete")}catch(e){throw this.logger.error("Failed to setup audio analysis:",e),e}}startAudioLevelMonitoring(e){if(!this.analyser)return void this.logger.info("Audio level monitoring not started - missing analyser");this.logger.info("Starting audio level monitoring at timestamp:",Date.now());const t=new Uint8Array(this.analyser.frequencyBinCount),r=My(async()=>{if(this.analyser)try{this.analyser.getByteFrequencyData(t);const r=t.reduce((e,t)=>e+t,0)/t.length,i=Math.min(r/128,1),n=e?.()?.3:0;this.audioLevels.value={inputLevel:i,outputLevel:n}}catch(r){this.logger.error("Error in audio level monitoring:",r),this.stopAudioLevelMonitoring()}else this.logger.info("Stopping audio level monitoring - missing analyser")},"updateLevels"),i=My(()=>{r().catch(e=>{this.logger.error("Async error in audio level monitoring:",e)})},"intervalWrapper");this.audioLevelInterval=window.setInterval(i,50)}stopAudioLevelMonitoring(){this.audioLevelInterval?(this.logger.info("Stopping audio level monitoring interval"),clearInterval(this.audioLevelInterval),this.audioLevelInterval=void 0):this.logger.info("No audio level monitoring interval to stop")}resetAudioLevels(){this.audioLevels.value={inputLevel:0,outputLevel:0}}isAudioContextAvailable(){return!!this.audioContext}getAudioContextState(){return this.audioContext?.state}getSharedAnalyser(){return this.analyser}async stopMicrophone(){this.stream&&(this.logger.info("Stopping microphone stream"),this.stream.getTracks().forEach(e=>{e.stop(),e.enabled=!1}),this.stream=void 0),this.stopAudioLevelMonitoring(),this.resetAudioLevels(),this.audioContext&&"closed"!==this.audioContext.state&&(await this.audioContext.close(),this.audioContext=void 0),this.analyser=void 0,this.microphone=void 0,this.logger.info("Microphone stopped")}async cleanup(){await this.stopMicrophone(),this.visibilityChangeHandler&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=void 0),this.logger.info("Audio resources cleaned up")}};My(Dy,"ClientAudio");let Ly=Dy;const Ny=[{mode:"self",label:"Mode",icon:"i-tabler-north-star"},{mode:"talk",label:"Talk",icon:"i-tabler-phone"},{mode:"chat",label:"Chat",icon:"i-tabler-message-circle"},{mode:"info",label:"About",icon:"i-tabler-user-circle"}],zy={class:"spinner max-w-sm"},jy={class:"ring-circular h-full w-full origin-center",viewBox:"25 25 50 50"},Uy=Lr({__name:"FSpinner",props:{width:{type:String,default:""},colorMode:{type:String,default:"primary"}},setup:e=>(t,r)=>(yn(),Tn("div",zy,[(yn(),Tn("svg",jy,[An("circle",{class:me([e.colorMode,"ring-path"]),cx:"50",cy:"50",r:"20",fill:"none",stroke:"currentColor","stroke-width":"5","stroke-miterlimit":"30"},null,2)]))]))}),Fy={green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"}};function By(e){return Fy[e]||Fy.blue}function Vy(e){return e?"string"==typeof e?e:e.src||"":""}function qy(e){return Vy(e.cover)||Vy(e.avatar)||"/img/placeholder-avatar.png"}function $y(){return"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+"}function Hy(e){const t=e.target;t.dataset.fallbackUsed||(t.dataset.fallbackUsed="true",t.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+")}function Wy(e){const{message:t}=e;if(!t)return null;if("string"==typeof t)return t.trim()?{text:t.trim(),sender:"agent"}:null;if("object"!=typeof t)return null;const r=[e=>{if(!("source"in e))return null;const t={user:"user",ai:"agent",agent:"agent"}[e.source];return t?{text:e.message||"",sender:t}:null}];for(const i of r){const e=i(t);if(e&&e.text.trim())return{text:e.text.trim(),sender:e.sender}}return null}My(By,"getColorSchemeOklch"),My(Vy,"getImageSrc"),My(qy,"getSelfAvatarUrl"),My($y,"getFallbackAvatarDataUrl"),My(Hy,"handleImageError"),My(Wy,"parseVoiceMessage"),My(function(e){const{name:t,context:r}=e;return"welcome"===r?`Welcome to Fiction! I'm ${t}, your digital self. I'm here to help you understand how I can represent you and assist with your daily tasks. What would you like to know about how I work?`:"onboarding"===r?`Hi! I'm ${t}, your newly created digital self. I can handle conversations, answer questions about your expertise, and represent you professionally. Ready to see what I can do?`:`Hello! I'm ${t}. How can I help you today?`},"generateFirstMessage");const Gy=class extends Na{constructor(e){if(super("SelfController",e),Ay(this,"conversation"),Ay(this,"isTextMode",!1),Ay(this,"lastMessage",{hash:"",time:0}),Ay(this,"clientAudio"),Ay(this,"unwatchAudio"),Ay(this,"isConnecting",!1),Ay(this,"sessionId"),Ay(this,"conversationStartTime"),Ay(this,"chatCharacterCount",0),Ay(this,"hostParticipantId"),Ay(this,"visitorParticipantId"),Ay(this,"voiceState",Ut({isActive:!1,isConnected:!1,isSpeaking:!1,isListening:!1,transcript:"Tap to begin voice conversation",connectionStatus:"disconnected"})),Ay(this,"textState",Ut({isActive:!1,isConnected:!1,isThinking:!1,connectionStatus:"disconnected"})),Ay(this,"agentMode",Ut("self")),Ay(this,"sharedMessages",Ut([])),!e.self.elevenlabsAgentId||""===e.self.elevenlabsAgentId.trim())throw new Error(`Agent ID is required for SelfController. Self "${e.self.name}" (${e.self.selfId}) does not have a valid elevenlabsAgentId.`);this.clientAudio=new Ly(e),this.setupModeWatcher()}get audioLevels(){return this.clientAudio.audioLevels}getClientAudio(){return this.clientAudio}getOutputFrequencyData(){if(!this.conversation)return null;try{const e=this.conversation.getOutputByteFrequencyData();return e&&e.length>0?(Array.from(e).filter(e=>Number(e)>0).length,Math.max(...Array.from(e)),Array.from(e).reduce((e,t)=>e+Number(t),0),e.length,new Uint8Array(e)):null}catch(e){return null}}isDuplicateMessage(e,t){const r=`${t}:${e.toLowerCase().trim()}`,i=Date.now(),n=r===this.lastMessage.hash&&i-this.lastMessage.time<500;return n||(this.lastMessage={hash:r,time:i}),n}addMessage(e,t){this.isDuplicateMessage(e,t)||(this.sharedMessages.value=[...this.sharedMessages.value,{id:Date.now().toString(),text:e,sender:t,timestamp:new Date}])}getDynamicSettings(){return{dynamicVariables:{context:this.settings.context||"",firstMessage:this.settings.firstMessage||""},overrides:{agent:this.settings.firstMessage?{firstMessage:this.settings.firstMessage}:{}}}}updateState(e,t){e.value={...e.value,...t}}resetState(e){e?this.updateState(this.textState,{isActive:!1,isConnected:!1,isThinking:!1,connectionStatus:"disconnected",error:void 0}):(this.updateState(this.voiceState,{isActive:!1,isConnected:!1,isSpeaking:!1,isListening:!1,transcript:"Ready to start a call...",connectionStatus:"disconnected",error:void 0}),this.clientAudio.resetAudioLevels())}setupModeWatcher(){en(this.agentMode,async(e,t)=>{this.logger.info(`Mode changed from ${t} to ${e}`),this.conversation&&("talk"===t||"chat"===t)&&await this.endConversation()})}handleMessage(e,t){const r=Wy(e);if(r&&(this.addMessage(r.text,r.sender),!t&&"agent"===r.sender&&this.updateState(this.textState,{isThinking:!1}),this.sessionId&&this.hostParticipantId&&this.visitorParticipantId)){const e="agent"===r.sender?this.hostParticipantId:this.visitorParticipantId,{sdk:t}=this.settings;t.saveMessage({conversationId:this.sessionId,participantId:e,content:r.text,role:"agent"===r.sender?"agent":"user"}).catch(e=>{this.logger.warn("Failed to save message",{error:e})})}}handleError(e,t){const r=e.message;this.logger.error("Conversation error:",e),this.resetState(t),t?this.updateState(this.voiceState,{error:r,connectionStatus:"error",transcript:"Failed to start call."}):this.updateState(this.textState,{error:r,connectionStatus:"error"})}async setMode(e){this.agentMode.value!==e&&(this.agentMode.value=e)}async startVoiceConversation(e={}){if(this.isConnecting)return void this.logger.info("Voice conversation already connecting, ignoring duplicate request");if(this.isConnecting=!0,this.isTextMode=!1,this.updateState(this.voiceState,{isActive:!0,transcript:"Connecting...",connectionStatus:"connecting"}),!(await this.clientAudio.requestMicrophonePermission()))throw this.isConnecting=!1,this.updateState(this.voiceState,{isActive:!1,error:"Microphone permission required",transcript:"Failed to get microphone permission",connectionStatus:"error"}),new Error("Microphone permission required");await this.startSession("voice");const t=this.getDynamicSettings(),r=this.settings.self.elevenlabsAgentId;this.logger.info("Starting voice conversation...",{agentId:r,dynamicSettings:t});try{this.conversation=await Iy.startSession({agentId:r,connectionType:"websocket",...t,onConnect:My(()=>{this.isConnecting=!1,this.clientAudio.startAudioLevelMonitoring(()=>this.isVoiceConnected()),this.updateState(this.voiceState,{isConnected:!0,isListening:!0,transcript:"Connected! Start speaking...",connectionStatus:"connected"}),e.onConnect?.(),e.onAudioLevel&&(this.unwatchAudio=en(this.audioLevels,e.onAudioLevel,{immediate:!0}))},"onConnect"),onDisconnect:My(()=>{this.logger.info("Voice conversation disconnected"),this.conversation=void 0,this.clientAudio.stopAudioLevelMonitoring(),this.endSession().catch(e=>{}),this.resetState(!1),e.onDisconnect?.()},"onDisconnect"),onError:My(t=>{let r=t;t.includes("does not exist")?r=`Agent not found: ${this.settings.self.elevenlabsAgentId}. Check ElevenLabs configuration.`:t.includes("limit")||t.includes("quota")?r="ElevenLabs account limit reached. Check your subscription and usage.":(t.includes("unauthorized")||t.includes("invalid"))&&(r="ElevenLabs API authentication failed. Check ELEVENLABS_API_KEY."),this.endSession().catch(e=>{}),this.handleError(new Error(r),!0),e.onError?.(new Error(r))},"onError"),onModeChange:My(t=>{const r="speaking"===t.mode;this.updateState(this.voiceState,{isSpeaking:r,isListening:!r,transcript:r?"Agent is speaking...":"Listening for your voice..."}),e.onModeChange?.(t.mode)},"onModeChange"),onMessage:My(t=>{this.handleMessage(t,!0),e.onMessage?.(t)},"onMessage")})}catch(i){throw this.isConnecting=!1,this.endSession().catch(e=>{}),this.handleError(i,!0),i}}async startTextConversation(e={}){if(this.isConnecting)this.logger.info("Text conversation already connecting, ignoring duplicate request");else{this.isConnecting=!0,this.isTextMode=!0,this.updateState(this.textState,{isActive:!0,connectionStatus:"connecting"}),await this.startSession("chat");try{this.conversation=await Iy.startSession({agentId:this.settings.self.elevenlabsAgentId,connectionType:"websocket",...this.getDynamicSettings(),textOnly:!0,onConnect:My(()=>{this.isConnecting=!1,this.updateState(this.textState,{isConnected:!0,connectionStatus:"connected"}),e.onConnect?.()},"onConnect"),onDisconnect:My(()=>{this.conversation=void 0,this.endSession().catch(e=>{}),this.resetState(!0),e.onDisconnect?.()},"onDisconnect"),onError:My(t=>{let r=t;t.includes("does not exist")?r=`Agent not found: ${this.settings.self.elevenlabsAgentId}. Check ElevenLabs configuration.`:t.includes("limit")||t.includes("quota")?r="ElevenLabs account limit reached. Check your subscription and usage.":(t.includes("unauthorized")||t.includes("invalid"))&&(r="ElevenLabs API authentication failed. Check ELEVENLABS_API_KEY."),this.endSession().catch(e=>{}),this.handleError(new Error(r),!1),e.onError?.(new Error(r))},"onError"),onModeChange:My(t=>{e.onModeChange?.(t.mode)},"onModeChange"),onMessage:My(t=>{this.handleMessage(t,!1),e.onMessage?.(t)},"onMessage")})}catch(t){throw this.isConnecting=!1,this.endSession().catch(e=>{}),this.handleError(t,!1),t}}}async endConversation(){if(!this.conversation)return this.resetState(this.isTextMode),void(await this.clientAudio.stopMicrophone());try{await this.conversation.endSession()}finally{this.conversation=void 0,this.unwatchAudio?.(),this.unwatchAudio=void 0,this.resetState(this.isTextMode),this.isTextMode=!1,await this.clientAudio.stopMicrophone()}}async sendChatMessage(e){if(this.conversation&&this.isTextMode){this.addMessage(e,"user"),this.chatCharacterCount+=e.length;try{this.updateState(this.textState,{isThinking:!0}),this.conversation.sendUserMessage(e)}catch(t){this.handleError(t,!1)}}}isConnected(){return!!this.conversation}isVoiceConnected(){return this.isConnected()&&!this.isTextMode}isTextConnected(){return this.isConnected()&&this.isTextMode}async destroy(){await this.endConversation(),await this.clientAudio.cleanup(),this.endSession().catch(e=>{})}async startSession(e){const{self:t,sdk:r}=this.settings;if(this.conversationStartTime=new Date,this.chatCharacterCount=0,t.selfId&&t.orgId){const i=r.activeUser.value?.userId?void 0:r.generateAnonId(),n=await r.startConversation({selfId:t.selfId,userId:r.activeUser.value?.userId,anonId:i});if(n)return this.sessionId=n.conversationId,this.hostParticipantId=n.hostParticipantId,this.visitorParticipantId=n.visitorParticipantId,void this.logger.info("Started conversation session",{sessionId:this.sessionId,type:e,userId:r.activeUser.value?.userId,anonId:i,hostParticipantId:this.hostParticipantId,visitorParticipantId:this.visitorParticipantId})}this.sessionId=l(),this.logger.info("Started conversation session (fallback)",{sessionId:this.sessionId,type:e})}async endSession(){if(!this.sessionId||!this.conversationStartTime)return;const{self:e,sdk:t}=this.settings;if(!e.orgId||!t.activeUser.value?.userId)return this.logger.info("No org/user context - skipping usage recording"),void this.resetSession();const r=Math.round((Date.now()-this.conversationStartTime.getTime())/1e3),i=this.isTextMode?"chat":"voice",n="voice"===i?r:this.chatCharacterCount;if(!e.selfId)return this.logger.warn("Cannot track usage: selfId is undefined"),void this.resetSession();await t.trackUsage({selfId:e.selfId,type:i,quantity:n,participantId:t.activeUser.value?.userId})?this.logger.info("Recorded usage",{sessionId:this.sessionId,type:i,quantity:n,duration:r}):this.logger.warn("Failed to record usage - continuing normally"),this.resetSession()}resetSession(){this.sessionId=void 0,this.conversationStartTime=void 0,this.chatCharacterCount=0}};My(Gy,"SelfController");let Zy=Gy;const Jy=Lr({__name:"EffectTransitionList",props:{disabled:{type:Boolean,default:!1},mode:{default:"block"}},setup:e=>(t,r)=>(yn(),En(Ko,{name:e.disabled?"":"nlist"},{default:vr(()=>[li(t.$slots,"default")]),_:3},8,["name"]))}),Ky={key:0,class:"absolute inset-0 flex items-center justify-center"},Yy=Lr({__name:"ElSelfButton",props:{theme:{default:"primary"},size:{default:"lg"},loading:{type:Boolean,default:!1},icon:{},iconAfter:{}},setup(e){const t=eo(()=>({primary:"bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",green:"bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",red:"bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",default:"bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"}[e.theme])),r=eo(()=>({sm:"px-4 py-2 text-sm",md:"px-6 py-3 text-base",lg:"px-8 py-4 text-base"}[e.size])),i=eo(()=>({sm:"size-4",md:"size-4",lg:"size-5"}[e.size]));return(n,o)=>(yn(),Tn("button",{class:me(["relative inline-flex items-center justify-center gap-2 font-medium rounded-full backdrop-blur-sm border-2 text-white transition-all duration-200 focus:outline-none active:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",[t.value,r.value]])},[e.loading?(yn(),Tn("div",Ky,[...o[0]||(o[0]=[An("i",{class:"i-svg-spinners-90-ring-with-bg size-5"},null,-1)])])):Ln("",!0),An("span",{class:me(["flex items-center gap-2 transition-opacity duration-200",e.loading?"opacity-0":"opacity-100"])},[e.icon?(yn(),Tn("i",{key:0,class:me([e.icon,i.value])},null,2)):Ln("",!0),li(n.$slots,"default"),e.iconAfter?(yn(),Tn("i",{key:1,class:me([e.iconAfter,i.value])},null,2)):Ln("",!0)],2)],2))}}),Qy=["value"],Xy=Lr({__name:"SelfInputEmail",props:{modelValue:{default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const r=t;return(t,i)=>(yn(),Tn("input",{type:"email",autocomplete:"email",placeholder:"Enter Your Email",value:e.modelValue,class:"w-full px-6 py-3 text-theme-900 placeholder-theme-500 bg-white border border-white rounded-full focus:outline-none transition-all",style:{"font-size":"16px"},onInput:i[0]||(i[0]=e=>r("update:modelValue",e.target.value))},null,40,Qy))}}),ex={class:"flex gap-1.5 justify-center"},tx=["onUpdate:modelValue","onInput","onKeydown","onPaste","onFocus"],rx=Lr({__name:"SelfInputOneTimeCode",props:{modelValue:{},length:{},focusFirst:{type:Boolean}},emits:["update:modelValue","autoSubmit"],setup(e,{emit:t}){const r=e,i=t,n=Ut([]),o=Ut(Array.from({length:r.length}).fill("")),a=Ut(!1);function s(e,t){t.preventDefault(),a.value=!0;const i=(t.clipboardData?.getData("text")||"").replace(/\D/g,"");if(i.length===r.length)o.value=i.split(""),setTimeout(()=>{n.value[r.length-1]?.focus(),a.value=!1},10);else{const t=[...o.value];i.split("").slice(0,r.length-e).forEach((r,i)=>{t[e+i]=r}),o.value=t;const s=Math.min(e+i.length,r.length-1);setTimeout(()=>{n.value[s]?.focus(),a.value=!1},10)}}function l(e,t){const i=t.target.value.slice(-1).replace(/\D/g,"");o.value[e]=i,i&&e<r.length-1&&n.value[e+1]?.focus()}function c(e,t){"Backspace"===t.key?(t.preventDefault(),o.value[e]="",e>0&&n.value[e-1]?.focus()):"ArrowLeft"===t.key&&e>0?n.value[e-1]?.focus():"ArrowRight"===t.key&&e<r.length-1&&n.value[e+1]?.focus()}function d(e){if(n.value[e]?.select(),!a.value&&o.value[e])for(let t=e;t<r.length;t++)o.value[t]=""}return Jr(()=>{r.modelValue&&(o.value=r.modelValue.split("").slice(0,r.length)),r.focusFirst&&!("ontouchstart"in window)&&n.value[0]?.focus()}),en(()=>r.modelValue,e=>{o.value=e?e.split("").slice(0,r.length):Array.from({length:r.length}).fill("")}),en(o,()=>{const e=o.value.filter(Boolean).join("");i("update:modelValue",e),e.length===r.length&&i("autoSubmit",e)},{deep:!0}),My(s,"onPaste"),My(l,"onInput"),My(c,"onKeydown"),My(d,"onFocus"),(t,r)=>(yn(),Tn("div",ex,[(yn(!0),Tn(gn,null,si(e.length,e=>fr((yn(),Tn("input",{key:e,ref_for:!0,ref:My(t=>n.value[e-1]=t,"ref"),"onUpdate:modelValue":My(t=>o.value[e-1]=t,"onUpdate:modelValue"),type:"text",inputmode:"numeric",autocomplete:"one-time-code",class:"size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",style:{"font-size":"16px"},maxlength:"1",onInput:My(t=>l(e-1,t),"onInput"),onKeydown:My(t=>c(e-1,t),"onKeydown"),onPaste:My(t=>s(e-1,t),"onPaste"),onFocus:My(t=>d(e-1),"onFocus")},null,40,tx)),[[na,o.value[e-1]]])),128))]))}}),ix={class:"flex flex-col items-center justify-center h-full p-6"},nx={class:"w-full max-w-xs space-y-12"},ox={key:0,class:"text-xs text-theme-400 text-center"},ax={class:"text-base font-light text-white text-center"},sx={class:"space-y-6 relative"},lx={key:"email-field",class:"w-full"},cx={key:"code-field",class:"w-full"},dx=Lr({__name:"ElAuthGate",props:{sdk:{}},setup(e){const t=Ut({email:"",code:""}),r=Ut("email"),i={email:{title:"Enter Your Email",button:{label:"Continue",disabled:My(()=>!t.value.email,"disabled")},action:My(async()=>{await e.sdk.requestAuthCode({email:t.value.email})&&(r.value="code")},"action")},code:{title:"Enter Verification Code",button:{label:"Verify",disabled:My(()=>6!==t.value.code.length,"disabled")},action:My(()=>e.sdk.loginWithCode({email:t.value.email,code:t.value.code}),"action")}},n=eo(()=>i[r.value]);return(i,o)=>(yn(),Tn("div",ix,[An("div",nx,[e.sdk.error.value?(yn(),Tn("p",ox,ke(e.sdk.error.value),1)):Ln("",!0),An("h3",ax,ke(n.value.title),1),An("div",sx,[Rn(Jy,null,{default:vr(()=>["email"===r.value?(yn(),Tn("div",lx,[Rn(Xy,{modelValue:t.value.email,"onUpdate:modelValue":o[0]||(o[0]=e=>t.value.email=e),onKeyup:ca(n.value.action,["enter"])},null,8,["modelValue","onKeyup"])])):(yn(),Tn("div",cx,[Rn(rx,{modelValue:t.value.code,"onUpdate:modelValue":o[1]||(o[1]=e=>t.value.code=e),length:6,"focus-first":!0,onAutoSubmit:n.value.action},null,8,["modelValue","onAutoSubmit"])])),(yn(),Tn("div",{key:n.value.button.label,class:"space-y-4 w-full"},[Rn(Yy,{theme:"primary",size:"md",class:"w-full",loading:e.sdk.loading.value,disabled:n.value.button.disabled()||e.sdk.loading.value,onClick:n.value.action},{default:vr(()=>[Dn(ke(n.value.button.label),1)]),_:1},8,["loading","disabled","onClick"]),"code"===r.value?(yn(),Tn("button",{key:0,class:"w-full text-xs text-white/50 hover:text-white/70 transition-colors py-2",onClick:o[2]||(o[2]=e=>r.value="email")}," Change Email ")):Ln("",!0)]))]),_:1})])])]))}}),ux={class:"relative flex-shrink-0"},hx=["src","alt"],px={key:0,class:"absolute top-1 right-1"},mx={class:"min-w-0"},gx=Lr({__name:"ElModeHeader",props:{self:{},size:{default:"md"},showOnlineIndicator:{type:Boolean,default:!0},layout:{default:"centered"}},setup(e){function t(){return e.self.avatar?.src?e.self.avatar.src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+"}return My(t,"getAvatarSrc"),(r,i)=>(yn(),Tn("div",{class:me(["flex gap-4",["centered"===e.layout?"flex-col items-center text-center":"flex-row items-center justify-center"]])},[An("div",ux,[An("div",{class:me(["rounded-full overflow-hidden border-white","lg"===e.size?"w-20 h-20 sm:w-24 sm:h-24 border-4":"w-16 sm:size-16 border-2"])},[An("img",{src:t(),alt:e.self.name,class:"w-full h-full object-cover",onError:i[0]||(i[0]=(...e)=>Vt(Hy)&&Vt(Hy)(...e))},null,40,hx)],2),e.showOnlineIndicator?(yn(),Tn("div",px,[...i[1]||(i[1]=[An("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",style:{"animation-duration":"3s"}},null,-1),An("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white"},null,-1)])])):Ln("",!0)]),An("div",mx,[An("h1",{class:me(["font-light text-white mb-1 truncate",["lg"===e.size?"text-3xl mb-2":"text-xl sm:text-2xl tracking-wide leading-tight","horizontal"===e.layout?"text-white/95":""]])},ke(e.self.name),3),An("p",{class:me(["font-light line-clamp-1",["lg"===e.size?"text-base text-white/60":"text-sm sm:text-base","horizontal"===e.layout?"text-white/70 truncate":"text-white/60"]])},ke("horizontal"===e.layout?e.self.title||"Digital Self":e.self.title),3)])],2))}}),vx=My(e=>{const t=wx(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:My(e=>{const r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),fx(r,t)||bx(e)},"getClassGroupId"),getConflictingClassGroupIds:My((e,t)=>{const n=r[e]||[];return t&&i[e]?[...n,...i[e]]:n},"getConflictingClassGroupIds")}},"createClassGroupUtils"),fx=My((e,t)=>{if(0===e.length)return t.classGroupId;const r=e[0],i=t.nextPart.get(r),n=i?fx(e.slice(1),i):void 0;if(n)return n;if(0===t.validators.length)return;const o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},"getGroupRecursive"),kx=/^\[(.+)\]$/,bx=My(e=>{if(kx.test(e)){const t=kx.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},"getGroupIdForArbitraryProperty"),wx=My(e=>{const{theme:t,classGroups:r}=e,i={nextPart:new Map,validators:[]};for(const n in r)yx(r[n],i,n,t);return i},"createClassMap"),yx=My((e,t,r,i)=>{e.forEach(e=>{if("string"!=typeof e)return"function"==typeof e?Cx(e)?void yx(e(i),t,r,i):void t.validators.push({validator:e,classGroupId:r}):void Object.entries(e).forEach(([e,n])=>{yx(n,xx(t,e),r,i)});(""===e?t:xx(t,e)).classGroupId=r})},"processClassesRecursively"),xx=My((e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},"getPart"),Cx=My(e=>e.isThemeGetter,"isThemeGetter"),Sx=My(e=>{if(e<1)return{get:My(()=>{},"get"),set:My(()=>{},"set")};let t=0,r=new Map,i=new Map;const n=My((n,o)=>{r.set(n,o),t++,t>e&&(t=0,i=r,r=new Map)},"update");return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=i.get(e))?(n(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):n(e,t)}}},"createLruCache"),Tx=My(e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=My(e=>{const t=[];let r,i=0,n=0,o=0;for(let l=0;l<e.length;l++){let a=e[l];if(0===i&&0===n){if(":"===a){t.push(e.slice(o,l)),o=l+1;continue}if("/"===a){r=l;continue}}"["===a?i++:"]"===a?i--:"("===a?n++:")"===a&&n--}const a=0===t.length?e:e.substring(o),s=Ex(a);return{modifiers:t,hasImportantModifier:s!==a,baseClassName:s,maybePostfixModifierPosition:r&&r>o?r-o:void 0}},"parseClassName");if(t){const e=t+":",r=i;i=My(t=>t.startsWith(e)?r(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0},"parseClassName")}if(r){const e=i;i=My(t=>r({className:t,parseClassName:e}),"parseClassName")}return i},"createParseClassName"),Ex=My(e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,"stripImportantModifier"),_x=My(e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return My(e=>{if(e.length<=1)return e;const r=[];let i=[];return e.forEach(e=>{"["===e[0]||t[e]?(r.push(...i.sort(),e),i=[]):i.push(e)}),r.push(...i.sort()),r},"sortModifiers")},"createSortModifiers"),Ix=My(e=>({cache:Sx(e.cacheSize),parseClassName:Tx(e),sortModifiers:_x(e),...vx(e)}),"createConfigUtils"),Px=/\s+/,Mx=My((e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:n,sortModifiers:o}=t,a=[],s=e.trim().split(Px);let l="";for(let c=s.length-1;c>=0;c-=1){const e=s[c],{isExternal:t,modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:p}=r(e);if(t){l=e+(l.length>0?" "+l:l);continue}let m=!!p,g=i(m?h.substring(0,p):h);if(!g){if(!m){l=e+(l.length>0?" "+l:l);continue}if(g=i(h),!g){l=e+(l.length>0?" "+l:l);continue}m=!1}const v=o(d).join(":"),f=u?v+"!":v,k=f+g;if(a.includes(k))continue;a.push(k);const b=n(g,m);for(let r=0;r<b.length;++r){const e=b[r];a.push(f+e)}l=e+(l.length>0?" "+l:l)}return l},"mergeClassList");function Ax(){let e,t,r=0,i="";for(;r<arguments.length;)(e=arguments[r++])&&(t=Rx(e))&&(i&&(i+=" "),i+=t);return i}My(Ax,"twJoin");const Rx=My(e=>{if("string"==typeof e)return e;let t,r="";for(let i=0;i<e.length;i++)e[i]&&(t=Rx(e[i]))&&(r&&(r+=" "),r+=t);return r},"toValue");function Ox(e,...t){let r,i,n,o=a;function a(a){const l=t.reduce((e,t)=>t(e),e());return r=Ix(l),i=r.cache.get,n=r.cache.set,o=s,s(a)}function s(e){const t=i(e);if(t)return t;const o=Mx(e,r);return n(e,o),o}return My(a,"initTailwindMerge"),My(s,"tailwindMerge"),My(function(){return o(Ax.apply(null,arguments))},"callTailwindMerge")}My(Ox,"createTailwindMerge");const Dx=My(e=>{const t=My(t=>t[e]||[],"themeGetter");return t.isThemeGetter=!0,t},"fromTheme"),Lx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Nx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zx=/^\d+\/\d+$/,jx=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ux=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Fx=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Bx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Vx=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qx=My(e=>zx.test(e),"isFraction"),$x=My(e=>!!e&&!Number.isNaN(Number(e)),"isNumber"),Hx=My(e=>!!e&&Number.isInteger(Number(e)),"isInteger"),Wx=My(e=>e.endsWith("%")&&$x(e.slice(0,-1)),"isPercent"),Gx=My(e=>jx.test(e),"isTshirtSize"),Zx=My(()=>!0,"isAny"),Jx=My(e=>Ux.test(e)&&!Fx.test(e),"isLengthOnly"),Kx=My(()=>!1,"isNever"),Yx=My(e=>Bx.test(e),"isShadow"),Qx=My(e=>Vx.test(e),"isImage"),Xx=My(e=>!tC(e)&&!sC(e),"isAnyNonArbitrary"),eC=My(e=>mC(e,kC,Kx),"isArbitrarySize"),tC=My(e=>Lx.test(e),"isArbitraryValue"),rC=My(e=>mC(e,bC,Jx),"isArbitraryLength"),iC=My(e=>mC(e,wC,$x),"isArbitraryNumber"),nC=My(e=>mC(e,vC,Kx),"isArbitraryPosition"),oC=My(e=>mC(e,fC,Qx),"isArbitraryImage"),aC=My(e=>mC(e,xC,Yx),"isArbitraryShadow"),sC=My(e=>Nx.test(e),"isArbitraryVariable"),lC=My(e=>gC(e,bC),"isArbitraryVariableLength"),cC=My(e=>gC(e,yC),"isArbitraryVariableFamilyName"),dC=My(e=>gC(e,vC),"isArbitraryVariablePosition"),uC=My(e=>gC(e,kC),"isArbitraryVariableSize"),hC=My(e=>gC(e,fC),"isArbitraryVariableImage"),pC=My(e=>gC(e,xC,!0),"isArbitraryVariableShadow"),mC=My((e,t,r)=>{const i=Lx.exec(e);return!!i&&(i[1]?t(i[1]):r(i[2]))},"getIsArbitraryValue"),gC=My((e,t,r=!1)=>{const i=Nx.exec(e);return!!i&&(i[1]?t(i[1]):r)},"getIsArbitraryVariable"),vC=My(e=>"position"===e||"percentage"===e,"isLabelPosition"),fC=My(e=>"image"===e||"url"===e,"isLabelImage"),kC=My(e=>"length"===e||"size"===e||"bg-size"===e,"isLabelSize"),bC=My(e=>"length"===e,"isLabelLength"),wC=My(e=>"number"===e,"isLabelNumber"),yC=My(e=>"family-name"===e,"isLabelFamilyName"),xC=My(e=>"shadow"===e,"isLabelShadow"),CC=Ox(My(()=>{const e=Dx("color"),t=Dx("font"),r=Dx("text"),i=Dx("font-weight"),n=Dx("tracking"),o=Dx("leading"),a=Dx("breakpoint"),s=Dx("container"),l=Dx("spacing"),c=Dx("radius"),d=Dx("shadow"),u=Dx("inset-shadow"),h=Dx("text-shadow"),p=Dx("drop-shadow"),m=Dx("blur"),g=Dx("perspective"),v=Dx("aspect"),f=Dx("ease"),k=Dx("animate"),b=My(()=>["auto","avoid","all","avoid-page","page","left","right","column"],"scaleBreak"),w=My(()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],"scalePosition"),y=My(()=>[...w(),sC,tC],"scalePositionWithArbitrary"),x=My(()=>["auto","hidden","clip","visible","scroll"],"scaleOverflow"),C=My(()=>["auto","contain","none"],"scaleOverscroll"),S=My(()=>[sC,tC,l],"scaleUnambiguousSpacing"),T=My(()=>[qx,"full","auto",...S()],"scaleInset"),E=My(()=>[Hx,"none","subgrid",sC,tC],"scaleGridTemplateColsRows"),_=My(()=>["auto",{span:["full",Hx,sC,tC]},Hx,sC,tC],"scaleGridColRowStartAndEnd"),I=My(()=>[Hx,"auto",sC,tC],"scaleGridColRowStartOrEnd"),P=My(()=>["auto","min","max","fr",sC,tC],"scaleGridAutoColsRows"),M=My(()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],"scaleAlignPrimaryAxis"),A=My(()=>["start","end","center","stretch","center-safe","end-safe"],"scaleAlignSecondaryAxis"),R=My(()=>["auto",...S()],"scaleMargin"),O=My(()=>[qx,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...S()],"scaleSizing"),D=My(()=>[e,sC,tC],"scaleColor"),L=My(()=>[...w(),dC,nC,{position:[sC,tC]}],"scaleBgPosition"),N=My(()=>["no-repeat",{repeat:["","x","y","space","round"]}],"scaleBgRepeat"),z=My(()=>["auto","cover","contain",uC,eC,{size:[sC,tC]}],"scaleBgSize"),j=My(()=>[Wx,lC,rC],"scaleGradientStopPosition"),U=My(()=>["","none","full",c,sC,tC],"scaleRadius"),F=My(()=>["",$x,lC,rC],"scaleBorderWidth"),B=My(()=>["solid","dashed","dotted","double"],"scaleLineStyle"),V=My(()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"scaleBlendMode"),q=My(()=>[$x,Wx,dC,nC],"scaleMaskImagePosition"),$=My(()=>["","none",m,sC,tC],"scaleBlur"),H=My(()=>["none",$x,sC,tC],"scaleRotate"),W=My(()=>["none",$x,sC,tC],"scaleScale"),G=My(()=>[$x,sC,tC],"scaleSkew"),Z=My(()=>[qx,"full",...S()],"scaleTranslate");return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gx],breakpoint:[Gx],color:[Zx],container:[Gx],"drop-shadow":[Gx],ease:["in","out","in-out"],font:[Xx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Gx],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Gx],shadow:[Gx],spacing:["px",$x],text:[Gx],"text-shadow":[Gx],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qx,tC,sC,v]}],container:["container"],columns:[{columns:[$x,tC,sC,s]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:y()}],overflow:[{overflow:x()}],"overflow-x":[{"overflow-x":x()}],"overflow-y":[{"overflow-y":x()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[Hx,"auto",sC,tC]}],basis:[{basis:[qx,"full","auto",s,...S()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$x,qx,"auto","initial","none",tC]}],grow:[{grow:["",$x,sC,tC]}],shrink:[{shrink:["",$x,sC,tC]}],order:[{order:[Hx,"first","last","none",sC,tC]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:_()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:_()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:S()}],"gap-x":[{"gap-x":S()}],"gap-y":[{"gap-y":S()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],p:[{p:S()}],px:[{px:S()}],py:[{py:S()}],ps:[{ps:S()}],pe:[{pe:S()}],pt:[{pt:S()}],pr:[{pr:S()}],pb:[{pb:S()}],pl:[{pl:S()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":S()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":S()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],w:[{w:[s,"screen",...O()]}],"min-w":[{"min-w":[s,"screen","none",...O()]}],"max-w":[{"max-w":[s,"screen","none","prose",{screen:[a]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",r,lC,rC]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,sC,iC]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wx,tC]}],"font-family":[{font:[cC,tC,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,sC,tC]}],"line-clamp":[{"line-clamp":[$x,"none",sC,iC]}],leading:[{leading:[o,...S()]}],"list-image":[{"list-image":["none",sC,tC]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",sC,tC]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:[$x,"from-font","auto",sC,rC]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[$x,"auto",sC,tC]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",sC,tC]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",sC,tC]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:N()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Hx,sC,tC],radial:["",sC,tC],conic:[Hx,sC,tC]},hC,oC]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:j()}],"gradient-via-pos":[{via:j()}],"gradient-to-pos":[{to:j()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:U()}],"rounded-s":[{"rounded-s":U()}],"rounded-e":[{"rounded-e":U()}],"rounded-t":[{"rounded-t":U()}],"rounded-r":[{"rounded-r":U()}],"rounded-b":[{"rounded-b":U()}],"rounded-l":[{"rounded-l":U()}],"rounded-ss":[{"rounded-ss":U()}],"rounded-se":[{"rounded-se":U()}],"rounded-ee":[{"rounded-ee":U()}],"rounded-es":[{"rounded-es":U()}],"rounded-tl":[{"rounded-tl":U()}],"rounded-tr":[{"rounded-tr":U()}],"rounded-br":[{"rounded-br":U()}],"rounded-bl":[{"rounded-bl":U()}],"border-w":[{border:F()}],"border-w-x":[{"border-x":F()}],"border-w-y":[{"border-y":F()}],"border-w-s":[{"border-s":F()}],"border-w-e":[{"border-e":F()}],"border-w-t":[{"border-t":F()}],"border-w-r":[{"border-r":F()}],"border-w-b":[{"border-b":F()}],"border-w-l":[{"border-l":F()}],"divide-x":[{"divide-x":F()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":F()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...B(),"hidden","none"]}],"divide-style":[{divide:[...B(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...B(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$x,sC,tC]}],"outline-w":[{outline:["",$x,lC,rC]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,pC,aC]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",u,pC,aC]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[$x,rC]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":F()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,pC,aC]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[$x,sC,tC]}],"mix-blend":[{"mix-blend":[...V(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":V()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[$x]}],"mask-image-linear-from-pos":[{"mask-linear-from":q()}],"mask-image-linear-to-pos":[{"mask-linear-to":q()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":q()}],"mask-image-t-to-pos":[{"mask-t-to":q()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":q()}],"mask-image-r-to-pos":[{"mask-r-to":q()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":q()}],"mask-image-b-to-pos":[{"mask-b-to":q()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":q()}],"mask-image-l-to-pos":[{"mask-l-to":q()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":q()}],"mask-image-x-to-pos":[{"mask-x-to":q()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":q()}],"mask-image-y-to-pos":[{"mask-y-to":q()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[sC,tC]}],"mask-image-radial-from-pos":[{"mask-radial-from":q()}],"mask-image-radial-to-pos":[{"mask-radial-to":q()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":w()}],"mask-image-conic-pos":[{"mask-conic":[$x]}],"mask-image-conic-from-pos":[{"mask-conic-from":q()}],"mask-image-conic-to-pos":[{"mask-conic-to":q()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:N()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",sC,tC]}],filter:[{filter:["","none",sC,tC]}],blur:[{blur:$()}],brightness:[{brightness:[$x,sC,tC]}],contrast:[{contrast:[$x,sC,tC]}],"drop-shadow":[{"drop-shadow":["","none",p,pC,aC]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",$x,sC,tC]}],"hue-rotate":[{"hue-rotate":[$x,sC,tC]}],invert:[{invert:["",$x,sC,tC]}],saturate:[{saturate:[$x,sC,tC]}],sepia:[{sepia:["",$x,sC,tC]}],"backdrop-filter":[{"backdrop-filter":["","none",sC,tC]}],"backdrop-blur":[{"backdrop-blur":$()}],"backdrop-brightness":[{"backdrop-brightness":[$x,sC,tC]}],"backdrop-contrast":[{"backdrop-contrast":[$x,sC,tC]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$x,sC,tC]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$x,sC,tC]}],"backdrop-invert":[{"backdrop-invert":["",$x,sC,tC]}],"backdrop-opacity":[{"backdrop-opacity":[$x,sC,tC]}],"backdrop-saturate":[{"backdrop-saturate":[$x,sC,tC]}],"backdrop-sepia":[{"backdrop-sepia":["",$x,sC,tC]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":S()}],"border-spacing-x":[{"border-spacing-x":S()}],"border-spacing-y":[{"border-spacing-y":S()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",sC,tC]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$x,"initial",sC,tC]}],ease:[{ease:["linear","initial",f,sC,tC]}],delay:[{delay:[$x,sC,tC]}],animate:[{animate:["none",k,sC,tC]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,sC,tC]}],"perspective-origin":[{"perspective-origin":y()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:W()}],"scale-x":[{"scale-x":W()}],"scale-y":[{"scale-y":W()}],"scale-z":[{"scale-z":W()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[sC,tC,"","none","gpu","cpu"]}],"transform-origin":[{origin:y()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Z()}],"translate-x":[{"translate-x":Z()}],"translate-y":[{"translate-y":Z()}],"translate-z":[{"translate-z":Z()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",sC,tC]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",sC,tC]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[$x,lC,rC,iC]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},"getDefaultConfig")),SC={default:{solid:{base:"bg-theme-0 dark:bg-theme-700/40 text-theme-600 dark:text-theme-50",input:"bg-white dark:bg-theme-800/50\n ring-theme-200 dark:ring-theme-600/70\n focus:ring-theme-600 focus:bg-white\n dark:focus:ring-theme-500 dark:focus:bg-theme-800\n focus-within:ring-theme-600 dark:focus-within:ring-theme-500\n text-theme-900 dark:text-theme-100\n placeholder:text-theme-400 dark:placeholder:text-theme-500",border:"border-theme-300/80 dark:border-theme-600",hover:"hover:border-theme-300 dark:hover:border-theme-500",icon:"text-theme-600 dark:text-theme-50"},ghost:{base:"bg-theme-50 dark:bg-theme-600/30 text-theme-700 dark:text-theme-50",border:"border-theme-100 dark:border-theme-800/20",hover:"hover:bg-theme-200 dark:hover:bg-theme-600/50 hover:border-theme-200 dark:hover:border-theme-600",icon:"text-theme-500 dark:text-theme-500"},outline:{base:"bg-transparent text-theme-700 dark:text-theme-50",border:"border-theme-300 dark:border-theme-400",hover:"hover:opacity-70",icon:"text-theme-700 dark:text-theme-300"},link:{base:"bg-transparent text-theme-600 dark:text-theme-50",border:"border-transparent",hover:"hover:opacity-70",icon:"text-theme-600 dark:text-theme-400"}},muted:{solid:{base:"bg-gray-100 dark:bg-gray-700/40 text-gray-900 dark:text-gray-50",input:"bg-white dark:bg-gray-800/50\n ring-gray-200 dark:ring-gray-600/70\n focus:ring-gray-600 focus:bg-white\n dark:focus:ring-gray-500 dark:focus:bg-gray-800\n focus-within:ring-gray-600 dark:focus-within:ring-gray-500\n text-gray-900 dark:text-gray-100\n placeholder:text-gray-400 dark:placeholder:text-gray-500",border:"border-gray-300/80 dark:border-gray-600",hover:"hover:border-gray-300 dark:hover:border-gray-500",icon:"text-gray-600 dark:text-gray-50"},ghost:{base:"bg-gray-100 dark:bg-gray-600/30 text-gray-700 dark:text-gray-50",border:"border-gray-100 dark:border-gray-800/20",hover:"hover:bg-gray-200 dark:hover:bg-gray-600/50 hover:border-gray-200 dark:hover:border-gray-600",icon:"text-gray-500 dark:text-gray-500"},outline:{base:"bg-transparent text-gray-700 dark:text-gray-50",border:"border-gray-500 dark:border-gray-400",hover:"hover:opacity-70",icon:"text-gray-700 dark:text-gray-300"},link:{base:"bg-transparent text-gray-600 dark:text-gray-50",border:"border-transparent",hover:"hover:opacity-70",icon:"text-gray-600 dark:text-gray-400"}},overlay:{solid:{base:"bg-white/100 text-black backdrop-blur-sm shadow-sm mix-blend-overlay [text-shadow:_0_1px_1px_rgb(255_255_255_/_100%)]",border:"border-white/100",input:"bg-white/10 ring-white\n focus:ring-white/90 focus:bg-white/20\n dark:focus:ring-white/70\n text-white\n placeholder:text-white/60",hover:"hover:bg-white/70 ",icon:"text-black"},ghost:{base:"bg-white/70 text-black backdrop-blur-sm shadow-sm mix-blend-overlay [text-shadow:_0_1px_1px_rgb(255_255_255_/_100%)]",border:"border-white/100",hover:"hover:bg-white/70 hover:border-white/90",icon:"text-black"},outline:{base:"bg-white/10 text-white backdrop-blur-sm shadow-sm [text-shadow:_0_0.5px_0_rgb(0_0_0_/_40%)]",border:"border-white",hover:"hover:border-white/80",icon:"text-white"},link:{base:"bg-transparent text-white [text-shadow:_0_0.5px_0_rgb(0_0_0_/_40%)]",border:"border-transparent",hover:"hover:opacity-70",icon:"text-white"}},primary:{solid:{base:"bg-primary-500 dark:bg-primary-700/70 text-primary-0 dark:text-primary-50",border:"border-primary-600/80 dark:border-primary-600",input:"bg-primary-50 dark:bg-primary-800/20\n ring-primary-500 dark:ring-primary-600/70\n focus:ring-primary-700 focus:bg-primary-50/50\n dark:focus:ring-primary-600 dark:focus:bg-primary-800/40\n text-primary-800 dark:text-primary-0\n placeholder:text-primary-300 dark:placeholder:text-primary-600",hover:"hover:bg-primary-600 dark:hover:bg-primary-800",icon:"text-primary-0 dark:text-primary-50"},ghost:{base:"bg-primary-50 dark:bg-primary-800/40 text-primary-800 dark:text-primary-0",border:"border-primary-100 dark:border-primary-800/20",hover:"hover:bg-primary-100 dark:hover:bg-primary-800/60 hover:border-primary-200 dark:hover:border-primary-700",icon:"text-primary-500 dark:text-primary-500"},outline:{base:"bg-transparent text-primary-500 dark:text-primary-100",border:"border-primary-500 dark:border-primary-500",hover:"hover:bg-primary-500/10 dark:hover:bg-primary-500/20",icon:"text-primary-700 dark:text-primary-100"},link:{base:"bg-transparent text-primary-600 dark:text-primary-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-primary-600 dark:text-primary-400"}},theme:{solid:{base:"bg-theme-500 dark:bg-theme-600/70 text-theme-0 dark:text-theme-0",border:"border-theme-600/80 dark:border-theme-600",hover:"hover:bg-theme-600 dark:hover:bg-theme-800",icon:"text-theme-50 dark:text-theme-50"},ghost:{base:"bg-theme-100 dark:bg-theme-600/50 text-theme-900 dark:text-theme-100",border:"border-theme-100 dark:border-theme-800/20",hover:"hover:bg-theme-200 dark:hover:bg-theme-600/40 hover:border-theme-200 dark:hover:border-theme-600",icon:"text-theme-500 dark:text-theme-500"},outline:{base:"bg-transparent text-theme-500 dark:text-theme-300",border:"border-theme-500 dark:border-theme-400",hover:"hover:bg-theme-500/10 dark:hover:bg-theme-400/20",icon:"text-theme-500 dark:text-theme-300"},link:{base:"bg-transparent text-theme-600 dark:text-theme-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-theme-600 dark:text-theme-400"}},green:{solid:{base:"bg-green-600 dark:bg-green-700/70 text-green-50 dark:text-green-50",border:"border-green-600 dark:border-green-600",hover:"hover:bg-green-700 dark:hover:bg-green-800",icon:"text-green-50 dark:text-green-50"},ghost:{base:"bg-green-100 dark:bg-green-800/20 text-green-900 dark:text-green-100",border:"border-green-100 dark:border-green-800/20",hover:"hover:bg-green-200 dark:hover:bg-green-800/40 hover:border-green-200 dark:hover:border-green-700",icon:"text-green-500 dark:text-green-500"},outline:{base:"bg-transparent text-green-500 dark:text-green-50",border:"border-green-500 dark:border-green-600",hover:"hover:bg-green-500/10 dark:hover:bg-green-400/10",icon:"text-green-500 dark:text-green-50"},link:{base:"bg-transparent text-green-600 dark:text-green-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-green-600 dark:text-green-400"}},orange:{solid:{base:"bg-orange-500 dark:bg-orange-700/70 text-orange-50 dark:text-orange-50",border:"border-orange-700 dark:border-orange-600",hover:"hover:bg-orange-700 dark:hover:bg-orange-800",icon:"text-orange-50 dark:text-orange-50"},ghost:{base:"bg-orange-100 dark:bg-orange-800/20 text-orange-900 dark:text-orange-100",border:"border-orange-100 dark:border-orange-800/20",hover:"hover:bg-orange-200 dark:hover:bg-orange-800/40 hover:border-orange-200 dark:hover:border-orange-700",icon:"text-orange-500 dark:text-orange-500"},outline:{base:"bg-transparent text-orange-500 dark:text-orange-50",border:"border-orange-500 dark:border-orange-600",hover:"hover:bg-orange-500/10 dark:hover:bg-orange-400/10",icon:"text-orange-500 dark:text-orange-50"},link:{base:"bg-transparent text-orange-600 dark:text-orange-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-orange-600 dark:text-orange-400"}},rose:{solid:{base:"bg-rose-500 dark:bg-rose-700/70 text-rose-50 dark:text-rose-50",border:"border-rose-600/80 dark:border-rose-600",hover:"hover:bg-rose-600 dark:hover:bg-rose-800",icon:"text-rose-50 dark:text-rose-50"},ghost:{base:"bg-rose-100 dark:bg-rose-800/20 text-rose-900 dark:text-rose-100",border:"border-rose-100 dark:border-rose-800/20",hover:"hover:bg-rose-200 dark:hover:bg-rose-800/40 hover:border-rose-200 dark:hover:border-rose-700",icon:"text-rose-500 dark:text-rose-500"},outline:{base:"bg-transparent text-rose-500 dark:text-rose-50",border:"border-rose-500 dark:border-rose-600",hover:"hover:bg-rose-500/10 dark:hover:bg-rose-400/10",icon:"text-rose-500 dark:text-rose-50"},link:{base:"bg-transparent text-rose-600 dark:text-rose-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-rose-600 dark:text-rose-400"}},indigo:{solid:{base:"bg-indigo-500 dark:bg-indigo-700/70 text-indigo-50 dark:text-indigo-50",border:"border-indigo-600/80 dark:border-indigo-600",hover:"hover:bg-indigo-600 dark:hover:bg-indigo-800",icon:"text-indigo-50 dark:text-indigo-50"},ghost:{base:"bg-indigo-100 dark:bg-indigo-800/20 text-indigo-900 dark:text-indigo-100",border:"border-indigo-100 dark:border-indigo-800/20",hover:"hover:bg-indigo-200 dark:hover:bg-indigo-800/40 hover:border-indigo-200 dark:hover:border-indigo-700",icon:"text-indigo-500 dark:text-indigo-500"},outline:{base:"bg-transparent text-indigo-500 dark:text-indigo-50",border:"border-indigo-500 dark:border-indigo-600",hover:"hover:bg-indigo-500/10 dark:hover:bg-indigo-400/10",icon:"text-indigo-500 dark:text-indigo-50"},link:{base:"bg-transparent text-indigo-600 dark:text-indigo-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-indigo-600 dark:text-indigo-400"}},red:{solid:{base:"bg-red-500 dark:bg-red-700/70 text-red-50 dark:text-red-50",border:"border-red-600/80 dark:border-red-600",hover:"hover:bg-red-600 dark:hover:bg-red-800",icon:"text-red-50 dark:text-red-50"},ghost:{base:"bg-red-100 dark:bg-red-800/20 text-red-900 dark:text-red-100",border:"border-red-100 dark:border-red-800/20",hover:"hover:bg-red-200 dark:hover:bg-red-800/40 hover:border-red-200 dark:hover:border-red-700",icon:"text-red-500 dark:text-red-500"},outline:{base:"bg-transparent text-red-500 dark:text-red-50",border:"border-red-500 dark:border-red-600",hover:"hover:bg-red-500/10 dark:hover:bg-red-400/10",icon:"text-red-500 dark:text-red-50"},link:{base:"bg-transparent text-red-600 dark:text-red-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-red-600 dark:text-red-400"}}},TC={key:0,class:"absolute inset-0 flex items-center justify-center"},EC=Lr({__name:"FButton",props:{theme:{default:"default"},design:{default:"solid"},size:{default:"md"},rounding:{default:"full"},href:{},icon:{},iconAfter:{},tag:{default:"button"},loading:{type:Boolean,default:!1},class:{default:""}},setup(e){const t=eo(()=>({icon:"string"==typeof e.icon?e.icon:e.icon?.className,iconAfter:"string"==typeof e.iconAfter?e.iconAfter:e.iconAfter?.className})),r=eo(()=>e.href?"a":e.tag),i=eo(()=>({xxs:"size-2.5",xs:"size-3",sm:"size-3.5",md:"size-4",lg:"size-5",xl:"size-6"}[e.size])),n=eo(()=>{const t="link"===e.design?"!px-1":"",r=SC[e.theme]?.[e.design]||SC.default[e.design],i=["relative inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 focus:outline-none active:opacity-80 cursor-pointer",{xxs:"px-2 py-0.5 text-[10px]",xs:"px-3 py-1 text-[11px]",sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base",xl:"px-8 py-4 text-base"}[e.size],t,{md:"rounded-md",lg:"rounded-lg",full:"rounded-full"}[e.rounding],r.base,`border ${r.border}`,r.hover].filter(Boolean).join(" ");return CC(i,e.class)}),o=eo(()=>({design:(SC[e.theme]?.[e.design]||SC.default[e.design]).icon||""}));return(a,s)=>(yn(),En(oi(r.value),{href:e.href,class:me(n.value)},{default:vr(()=>[e.loading?(yn(),Tn("div",TC,[Rn(Uy,{class:me(i.value)},null,8,["class"])])):Ln("",!0),An("span",{class:me(["flex items-center gap-2 transition-opacity duration-200 whitespace-nowrap",e.loading?"opacity-0":"opacity-100"])},[t.value.icon?(yn(),Tn("span",{key:0,class:me(["flex items-center size-[1.1em] mt-[-.07em]",[t.value.icon,o.value]])},null,2)):Ln("",!0),li(a.$slots,"default"),t.value.iconAfter?(yn(),Tn("span",{key:1,class:me(["flex items-center size-[1.1em] mt-[-.07em]",[t.value.iconAfter,o.value]])},null,2)):Ln("",!0)],2)]),_:3},8,["href","class"]))}}),_C={class:"flex-1 flex flex-col min-h-0 py-6 space-y-6 h-full overflow-scroll [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden relative"},IC={class:"flex-1 space-y-6"},PC={key:0,class:"bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"},MC={class:"text-sm text-white/70 leading-relaxed"},AC={key:1,class:"bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"},RC=["innerHTML"],OC={key:2,class:"bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"},DC={class:"text-sm text-white/70 leading-relaxed"},LC={key:3,class:"space-y-3"},NC={class:"grid grid-cols-2 gap-3"},zC=Lr({__name:"ElSelfAbout",props:{self:{}},setup(e){const t=eo(()=>[{key:"email",condition:My(()=>!!e.self.email,"condition"),generate:My(()=>({title:"Contact",url:`mailto:${e.self.email}`,icon:"i-heroicons-envelope"}),"generate")},{key:"linkedin",condition:My(()=>!!e.self.accounts?.linkedin?.handle,"condition"),generate:My(()=>({title:"LinkedIn",url:e.self.accounts?.linkedin?.url||`https://linkedin.com/in/${e.self.accounts?.linkedin?.handle}`,icon:"i-simple-icons-linkedin"}),"generate")},{key:"x",condition:My(()=>!!e.self.accounts?.x?.handle,"condition"),generate:My(()=>({title:"X (Twitter)",url:e.self.accounts?.x?.url||`https://x.com/${e.self.accounts?.x?.handle}`,icon:"i-simple-icons-x"}),"generate")},{key:"github",condition:My(()=>!!e.self.accounts?.github?.handle,"condition"),generate:My(()=>({title:"GitHub",url:e.self.accounts?.github?.url||`https://github.com/${e.self.accounts?.github?.handle}`,icon:"i-simple-icons-github"}),"generate")},{key:"website",condition:My(()=>!!e.self.accounts?.website?.url,"condition"),generate:My(()=>({title:"Website",url:e.self.accounts?.website?.url,icon:"i-heroicons-globe-alt"}),"generate")}].filter(e=>e.condition()).map(e=>e.generate()));return(r,i)=>(yn(),Tn("div",_C,[An("div",IC,[e.self.headline?(yn(),Tn("div",PC,[i[0]||(i[0]=An("h3",{class:"text-sm font-medium text-white/90 mb-2"}," Professional Tagline ",-1)),An("div",MC,ke(e.self.headline),1)])):Ln("",!0),e.self.summary?(yn(),Tn("div",AC,[i[1]||(i[1]=An("h3",{class:"text-sm font-medium text-white/90 mb-2"}," About ",-1)),An("div",{class:"text-sm text-white/70 leading-relaxed",innerHTML:e.self.summary},null,8,RC)])):Ln("",!0),"company"===e.self.entityType?(yn(),Tn("div",OC,[i[2]||(i[2]=An("h3",{class:"text-sm font-medium text-white/90 mb-2"}," Company Info ",-1)),An("p",DC," This is a company digital self representing "+ke(e.self.name)+". ",1)])):Ln("",!0),t.value.length>0?(yn(),Tn("div",LC,[i[3]||(i[3]=An("h3",{class:"text-sm font-medium text-white/90"}," Connect ",-1)),An("div",NC,[(yn(!0),Tn(gn,null,si(t.value,e=>(yn(),En(EC,{key:e.title,design:"ghost",theme:"default",size:"sm",class:"bg-white/5 hover:bg-white/10 border border-white/10 text-white/80 text-sm justify-start h-10",href:e.url,target:"_blank"},{default:vr(()=>[An("i",{class:me([e.icon,"size-4 mr-2"])},null,2),Dn(" "+ke(e.title),1)]),_:2},1032,["href"]))),128))])])):Ln("",!0)])]))}}),jC={class:"flex flex-col h-full relative"},UC={key:0,class:"text-theme-600 py-16 flex flex-col items-center justify-center gap-2 text-sm"},FC={key:0,class:"flex-shrink-0 size-8"},BC=["src","alt"],VC={class:"max-w-[70%]"},qC={class:"text-sm leading-[1.5] whitespace-pre-wrap break-words"},$C={key:0,class:"flex gap-2 justify-start items-end mb-4"},HC={class:"flex-shrink-0"},WC=["src","alt"],GC={class:"flex-shrink-0 pt-6 pb-2"},ZC=["placeholder","disabled"],JC=Lr({__name:"ElSelfChat",props:{selfController:{},self:{}},setup(e){const t=Ut(""),r=Ut(),i=Ut(),n=eo(()=>qy(e.self));function o(e,t){const r=e[t],i=e[t+1];return!i||i.sender!==r.sender}async function a(){if(!t.value.trim()||!e.selfController||!e.selfController.textState.value.isConnected)return;const r=t.value;t.value="",i.value&&(i.value.style.height="auto",i.value.focus());try{await e.selfController.sendChatMessage(r),l()}catch(n){}}function s(e){"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),a())}function l(){r.value&&ar(()=>{const e=r.value;e.scrollTop=e.scrollHeight})}function c(){if(!i.value)return;i.value.style.height="auto";const e=Math.min(i.value.scrollHeight,150);i.value.style.height=`${e}px`}return My(o,"shouldShowAvatar"),Jr(async()=>{if(e.selfController&&!e.selfController.textState.value.isConnected)try{await e.selfController.startTextConversation()}catch(t){}}),My(a,"sendMessage"),My(s,"handleKeydown"),My(l,"scrollToBottom"),My(c,"adjustTextareaHeight"),en(t,()=>{ar(()=>c())}),en(()=>e.selfController?.sharedMessages.value,e=>{e&&e.length>0&&ar(()=>l())},{immediate:!0,deep:!0}),(a,l)=>(yn(),Tn("div",jC,["connected"!==e.selfController?.textState.value.connectionStatus?(yn(),Tn("div",UC,[Rn(Uy,{class:"size-4"})])):Ln("",!0),An("div",{ref_key:"messagesContainer",ref:r,class:"flex-1 overflow-y-auto overflow-x-hidden py-8 space-y-1 min-h-0 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"},[(yn(!0),Tn(gn,null,si(e.selfController?.sharedMessages.value.filter(e=>"system"!==e.sender)??[],(t,r)=>(yn(),Tn("div",{key:t.id,class:me(["flex gap-2 items-end",{"justify-end":"user"===t.sender,"justify-start":"agent"===t.sender,"mb-4":o(e.selfController?.sharedMessages.value.filter(e=>"system"!==e.sender)??[],r)}])},["agent"===t.sender?(yn(),Tn("div",FC,[o(e.selfController?.sharedMessages.value.filter(e=>"system"!==e.sender)??[],r)?(yn(),Tn("img",{key:0,src:n.value,alt:e.self.name,class:"size-7 rounded-full object-cover"},null,8,BC)):Ln("",!0)])):Ln("",!0),An("div",VC,[An("div",{class:me(["rounded-2xl px-3.5 py-1.5 backdrop-blur-sm","user"===t.sender?"bg-primary-500/80 text-white":"bg-white/15 text-white/95"])},[An("p",qC,ke(t.text),1)],2)])],2))),128)),e.selfController?.textState.value.isThinking?(yn(),Tn("div",$C,[An("div",HC,[An("img",{src:n.value,alt:e.self.name,class:"size-8 rounded-full object-cover"},null,8,WC)]),l[1]||(l[1]=An("div",{class:"rounded-2xl px-4 py-2.5 bg-white/15 backdrop-blur-sm flex items-center"},[An("i",{class:"i-svg-spinners-3-dots-fade size-6 text-white/70"})],-1))])):Ln("",!0)],512),An("div",GC,[fr(An("textarea",{ref_key:"textarea",ref:i,"onUpdate:modelValue":l[0]||(l[0]=e=>t.value=e),rows:"1",placeholder:e.selfController?.textState.value.isConnected?"Message":"Connecting...",disabled:!e.selfController?.textState.value.isConnected,style:{"font-size":"16px",resize:"none"},class:"w-full bg-white/10 backdrop-blur-sm border border-white/20 rounded-3xl px-5 py-3 text-white placeholder-white/50 focus:outline-none focus:border-white/40 disabled:opacity-50 overflow-y-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",onKeydown:s},null,40,ZC),[[na,t.value]]),l[2]||(l[2]=An("div",{class:"text-[10px] text-white/40 text-center mt-2"}," Press Enter to send, Shift+Enter for new line ",-1))])]))}}),KC={class:"flex flex-col items-center text-center gap-4"},YC={class:"relative flex-shrink-0"},QC={class:"w-20 h-20 sm:w-24 sm:h-24 rounded-full overflow-hidden border-4 border-white"},XC=["src","alt"],eS={class:"min-w-0"},tS={class:"text-3xl font-light text-white mb-2 truncate"},rS={class:"text-base font-light text-white/60 line-clamp-1"},iS=Lr({__name:"ElSelfHeader",props:{self:{}},setup(e){function t(){return e.self.avatar?.src?e.self.avatar.src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+"}return My(t,"getAvatarSrc"),(r,i)=>(yn(),Tn("div",KC,[An("div",YC,[An("div",QC,[An("img",{src:t(),alt:e.self.name,class:"w-full h-full object-cover",onError:i[0]||(i[0]=(...e)=>Vt(Hy)&&Vt(Hy)(...e))},null,40,XC)]),i[1]||(i[1]=An("div",{class:"absolute top-1.5 right-1.5"},[An("div",{class:"size-4 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",style:{"animation-duration":"3s"}}),An("div",{class:"size-4 bg-green-500 rounded-full ring-2 ring-white"})],-1))]),An("div",eS,[An("h1",tS,ke(e.self.name),1),An("p",rS,ke(e.self.title),1)])]))}}),nS={class:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[28px] h-[28px] overflow-hidden"},oS=Lr({name:"FClose",__name:"FClose",emits:["click"],setup(e){const t=Ut(!1);return Jr(()=>{setTimeout(()=>{t.value=!0},100)}),(e,r)=>(yn(),Tn("a",{class:"close block cursor-pointer w-[60px] h-[60px] rounded-full transition-all duration-1000 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-110 active:scale-90 hover:rotate-90",onClick:r[0]||(r[0]=t=>e.$emit("click",t))},[r[1]||(r[1]=An("span",{class:"absolute inset-0 rounded-full transition-all"},null,-1)),An("span",nS,[An("span",{class:me(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]",t.value?"translate-y-0 translate-x-0 rotate-45":"translate-y-[30px] -translate-x-[30px] rotate-0"]),style:{"background-color":"currentColor","transition-delay":"0.15s"}},null,2),An("span",{class:me(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]",t.value?"translate-y-0 translate-x-0 -rotate-45":"-translate-y-[30px] -translate-x-[30px] rotate-0"]),style:{"background-color":"currentColor","transition-delay":"0.45s"}},null,2)])]))}}),aS={key:0,class:"px-9 pt-12 pb-4"},sS={class:"text-base font-medium text-theme-400"},lS={key:1,class:"px-4 pb-8 border-b border-white/10"},cS=["disabled","onClick"],dS={class:"flex items-center gap-3"},uS={class:"flex-1"},hS={key:0,class:"text-xs text-white/50 mt-0.5"},pS={class:"p-6"},mS=Lr({name:"ElSidebar",__name:"ElSidebar",props:{modelValue:{type:Boolean},items:{},position:{},title:{},widthClasses:{}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,i=t,n=r.position||"left",o=r.widthClasses||"w-[80%] max-w-[300px]",a=eo({get:My(()=>r.modelValue,"get"),set:My(e=>i("update:modelValue",e),"set")}),s=eo(()=>r.items.filter(e=>!e.isHidden));function l(e){e.isDisabled||(e.onClick?e.onClick({item:e,event:new MouseEvent("click")}):e.href&&(e.href.includes("http")?window.open(e.href,e.target||"_self")?.focus():window.location.href=e.href),a.value=!1)}My(l,"handleItemClick");const c=eo(()=>"left"===n?{enter:"-translate-x-full",leave:"-translate-x-full",position:"justify-start",closeButton:"-right-16"}:{enter:"translate-x-full",leave:"translate-x-full",position:"justify-end",closeButton:"-left-16"});return(t,r)=>(yn(),Tn(gn,null,[Rn(mo,{"enter-active-class":"transition-opacity duration-300 ease-out","leave-active-class":"transition-opacity duration-200 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:vr(()=>[a.value?(yn(),Tn("div",{key:0,class:"absolute inset-0 z-40 bg-black/50 backdrop-blur-sm",onClick:r[0]||(r[0]=e=>a.value=!1)})):Ln("",!0)]),_:1}),Rn(mo,{"enter-active-class":"transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)]","leave-active-class":"transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]","enter-from-class":c.value.enter,"enter-to-class":"translate-x-0","leave-from-class":"translate-x-0","leave-to-class":c.value.leave},{default:vr(()=>[a.value?(yn(),Tn("div",{key:0,class:me(["absolute inset-0 z-50 flex",c.value.position]),onClick:r[3]||(r[3]=e=>a.value=!1)},[An("div",{class:me(["relative h-full shadow-2xl bg-black/30 backdrop-blur-xl flex flex-col justify-center",Vt(o)]),onClick:r[2]||(r[2]=sa(()=>{},["stop"]))},[Rn(oS,{class:me(["absolute top-4 z-10 text-white",c.value.closeButton]),onClick:r[1]||(r[1]=e=>a.value=!1)},null,8,["class"]),e.title?(yn(),Tn("div",aS,[An("h3",sS,ke(e.title),1)])):Ln("",!0),t.$slots.header?(yn(),Tn("div",lS,[li(t.$slots,"header")])):Ln("",!0),An("div",{class:me(["flex-1 p-6 space-y-2 overflow-y-auto",{"pt-6":!e.title&&!t.$slots.header,"pt-4":e.title||t.$slots.header}])},[Rn(Ko,{"enter-active-class":"transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]","leave-active-class":"transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)]","enter-from-class":"left"===Vt(n)?"-translate-x-4 opacity-0":"translate-x-4 opacity-0","enter-to-class":"translate-x-0 opacity-100","leave-from-class":"translate-x-0 opacity-100","leave-to-class":"left"===Vt(n)?"-translate-x-4 opacity-0":"translate-x-4 opacity-0"},{default:vr(()=>[(yn(!0),Tn(gn,null,si(s.value,(e,t)=>(yn(),Tn("button",{key:e.key||e.label||t,style:ce({transitionDelay:40*t+"ms"}),class:me(["cursor-pointer w-full text-left p-3 rounded-xl transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group",[e.isActive?"bg-primary-500/20 border border-primary-500/40":"hover:bg-white/10",e.isDisabled&&"opacity-50 cursor-not-allowed"]]),disabled:e.isDisabled,onClick:My(t=>l(e),"onClick")},[An("div",dS,[e.icon?.src?(yn(),Tn("i",{key:0,class:me(["size-5 flex-shrink-0 transition-transform duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group-hover:scale-110",[e.icon.src,e.isActive?"text-primary-400":"text-white/70 group-hover:text-white"]])},null,2)):Ln("",!0),An("div",uS,[An("div",{class:me(["font-medium text-sm",e.isActive?"text-primary-300":"text-white"])},ke(e.label),3),e.subLabel?(yn(),Tn("div",hS,ke(e.subLabel),1)):Ln("",!0)])])],14,cS))),128))]),_:1},8,["enter-from-class","leave-to-class"])],2),An("div",pS,[li(t.$slots,"footer",{},()=>[r[4]||(r[4]=An("div",{class:"text-center"},[An("p",{class:"text-[10px] text-white/40 font-sans"},[Dn(" Digital Self by "),An("a",{href:"https://www.fiction.com",target:"_blank",class:"text-white/60 hover:text-white/80 transition-colors"},"Fiction")])],-1))])])],2)],2)):Ln("",!0)]),_:3},8,["enter-from-class","leave-to-class"])],64))}}),gS=Lr({name:"SelfModeSidebar",__name:"ElSelfModeSidebar",props:{modelValue:{type:Boolean},selfController:{}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,i=t,n=eo({get:My(()=>r.modelValue,"get"),set:My(e=>i("update:modelValue",e),"set")}),o=eo(()=>r.selfController?.agentMode?.value??"self"),a=eo(()=>Ny.map(e=>({key:e.mode,icon:{src:e.icon},label:e.label,isActive:o.value===e.mode,onClick:My(()=>{r.selfController?.setMode(e.mode)},"onClick")})));return(e,t)=>(yn(),En(mS,{modelValue:n.value,"onUpdate:modelValue":t[0]||(t[0]=e=>n.value=e),items:a.value,position:"right",title:"Mode","width-classes":"w-[80%] max-w-[255px]"},null,8,["modelValue","items"]))}}),vS=Lr({name:"SelfSidebar",__name:"ElSelfSidebar",props:{modelValue:{type:Boolean},self:{},sdk:{},title:{}},emits:["update:modelValue"],setup(e,{emit:t}){const r=e,i=t,n=eo({get:My(()=>r.modelValue,"get"),set:My(e=>i("update:modelValue",e),"set")}),o=eo(()=>{const e=[{key:"share",icon:{src:"i-tabler-share"},label:"Share This Digital Self",onClick:My(()=>{const e=`${window.location.origin}/@${r.self.handle||r.self.selfId}`;navigator.clipboard.writeText(e)},"onClick")},{key:"profile",icon:{src:"i-tabler-user"},label:"Visit Full Profile",onClick:My(()=>{window.open(`/@${r.self.handle||r.self.selfId}`,"_blank")},"onClick")},{key:"create",icon:{src:"i-tabler-sparkles"},label:"Create Your Own",onClick:My(()=>{window.open("/auth","_blank")},"onClick")}];return r.sdk.activeUser.value&&e.push({key:"logout",icon:{src:"i-tabler-logout"},label:"Logout",onClick:My(async()=>{await r.sdk.logout()},"onClick")}),e});return(t,r)=>(yn(),En(mS,{modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=e=>n.value=e),items:o.value,position:"left",title:e.title||"Menu"},null,8,["modelValue","items","title"]))}}),fS={class:"w-full max-w-full flex items-center justify-center"},kS=["width","height"],bS=Lr({__name:"ElAudioVisualizer",props:{rms:{},color:{},isActive:{type:Boolean},audioLevels:{},isListening:{type:Boolean},isSpeaking:{type:Boolean},isConnected:{type:Boolean},enableRealAudio:{type:Boolean},selfController:{},enableWaveMotion:{type:Boolean},enableScrollingWave:{type:Boolean}},setup(e){const t=e,r=Ut();let i=null,n=null;const o=Ut(!1),a=Ut(!0),s=new Map;let l=null,c=null,d=null;const u=Ut(!1),h=Ut(null),{bars:p,barWidth:m,barSpacing:g,minHeight:v,maxHeight:f,STIFFNESS:k,DAMPING:b,PEAK_HOLD_TIME:w,PEAK_DECAY_STIFFNESS:y,PEAK_DECAY_DAMPING:x}=Ry,C=new Float32Array(p).fill(v),S=new Float32Array(p).fill(0),T=new Float32Array(p).fill(v),E=new Float32Array(p).fill(v),_=new Float32Array(p).fill(0),I=new Float32Array(p).fill(0);function P(e){return e<200?{stiffnessMultiplier:.7,dampingMultiplier:1.2}:e<1e3?{stiffnessMultiplier:1,dampingMultiplier:1}:e<4e3?{stiffnessMultiplier:1.3,dampingMultiplier:.8}:{stiffnessMultiplier:1.5,dampingMultiplier:.6}}async function M(){if(!(typeof window>"u")&&t.enableRealAudio&&t.selfController)try{const e=t.selfController.getClientAudio();if(e?.isAudioContextAvailable()){const t=e.getSharedAnalyser();if(t){c=t;const e=new ArrayBuffer(t.frequencyBinCount);return d=new Uint8Array(e),u.value=!0,void(h.value=null)}}u.value=!1,h.value="Shared audio context not available"}catch(e){h.value=e instanceof Error?e.message:"Failed to setup shared audio",u.value=!1}}function A(){c=null,d=null,u.value=!1,h.value=null}My(P,"getFrequencyPhysics"),My(M,"setupAudio"),My(A,"cleanupAudio");let R=1;function O(){if(!r.value)return;typeof window<"u"&&(R=Math.max(1,Math.min(2,window.devicePixelRatio||1)));const e=(m+g)*p-g,t=f;r.value.width=Math.floor(e*R),r.value.height=Math.floor(t*R),r.value.style.width=`${e}px`,r.value.style.height=`${t}px`,i&&i.setTransform(R,0,0,R,0,0),Q()}function D(){return c&&d&&u.value?(c.getByteFrequencyData(d),N(d)):Array.from({length:Oy.length},()=>0)}function L(){if(!t.selfController)return Array.from({length:Oy.length},()=>0);try{const e=t.selfController.getOutputFrequencyData();if(e&&e.length>0)return N(e)}catch(e){}return Array.from({length:Oy.length},()=>0)}function N(e){return Array.from({length:Oy.length},(t,r)=>{const i=Oy[r],n=Math.floor(i/12e3*e.length),o=Math.max(1,Math.floor(e.length/Oy.length/2));let a=0;for(let c=0;c<o&&n+c<e.length;c++)a+=e[n+c];a=a/o/255;let s=1;s=i<150?.1:i<200?.3:i>=400&&i<=600?1.4:i>=1400&&i<=1600?1.3:i>=2400&&i<=2600?1.2:i>=200&&i<=2e3?1.1:i>=2e3&&i<=4e3?.9:i>6e3?.4:.7;const l=a**.5*.6*s;return Math.min(.85,l)})}My(O,"resizeCanvas"),My(D,"generateRealInputFrequencyBands"),My(L,"generateRealOutputFrequencyBands"),My(N,"mapFrequencyDataToBands");let z=0,j=0,U=0;const F=[{name:"a",f1:730,f2:1090,f3:2440,duration:120,energy:.9},{name:"e",f1:530,f2:1840,f3:2480,duration:100,energy:.8},{name:"i",f1:270,f2:2290,f3:3010,duration:110,energy:.85},{name:"o",f1:570,f2:840,f3:2410,duration:130,energy:.9},{name:"u",f1:300,f2:870,f3:2240,duration:140,energy:.8},{name:"s",f1:4e3,f2:6e3,f3:8e3,duration:80,energy:.4},{name:"t",f1:1500,f2:4e3,f3:6e3,duration:60,energy:.3},{name:"n",f1:280,f2:1700,f3:2600,duration:70,energy:.6},{name:"r",f1:350,f2:1200,f3:1650,duration:90,energy:.7},{name:"pause",f1:0,f2:0,f3:0,duration:150,energy:.05}];function B(e){const t=Array.from({length:Oy.length},()=>0);if(e<=0)return t;j+=16.67,U+=.02,j>F[z].duration&&(z=(z+1)%F.length,j=0);const r=F[z],i=F[(z+1)%F.length],n=j/r.duration,o=.5*(1+Math.cos(Math.PI+n*Math.PI)),a=.7+.3*Math.sin(.5*U),s=.9+.1*Math.sin(8*U);for(let l=0;l<Oy.length;l++){const n=Oy[l];let c=0;c=(.4*V(n,r.f1,i.f1,o,200)+.35*V(n,r.f2,i.f2,o,300)+.25*V(n,r.f3,i.f3,o,400))*(r.energy*(1-o)+i.energy*o);const d=150+50*Math.sin(.3*U);(Math.abs(n-d)<20||Math.abs(n-2*d)<30||Math.abs(n-3*d)<40)&&(c+=.3*r.energy),c*=e*a*s,c*=.85+.3*Math.random(),t[l]=Math.max(0,Math.min(1,c))}return t}function V(e,t,r,i,n){if(0===t&&0===r)return 0;const o=t*(1-i)+r*i;if(0===o)return 0;const a=Math.abs(e-o);return Math.exp(-((a/n)**2))}My(B,"generateSpeechPatterns"),My(V,"getFormantResponse");let q=[],$=0,H=0;function W(){return(o.value?100:50)*Math.min(2**H,8)}function G(e){let r=[];if(t.enableRealAudio&&t.isListening&&u.value&&c&&d){const e=D();e.some(e=>e>.05)&&(r=e)}if(!r.length&&t.isSpeaking&&t.selfController&&t.audioLevels&&t.audioLevels.outputLevel>.05){const e=Date.now(),t=W();if(e-$>t){$=e;try{const e=L();e.some(e=>e>.05)&&(q=e,H=0)}catch(i){H++}}q.some(e=>e>.05)&&(r=q)}return r.length||(r=e>0&&(t.isListening||t.isSpeaking)?t.isSpeaking?B(e):J(e):t.isConnected?J(.02):Array.from({length:Oy.length},()=>0)),t.enableWaveMotion&&typeof window<"u"&&(r=Z(r,e)),r}function Z(e,r){const i=.001*performance.now(),n=[...e];for(let o=0;o<e.length;o++){const a=o*(2*Math.PI)/e.length;let s=0;s=t.isListening||t.isSpeaking?.15*Math.sin(4.2*i+.6*a-(t.enableScrollingWave?2*i:0))+.08*Math.sin(6.8*i+1.2*a-(t.enableScrollingWave?1.5*i:0))+.05*Math.sin(.8*i):t.isConnected?.1*Math.sin(.6*i)+.05*Math.sin(2*i+.3*a):.12*Math.sin(1.5*i+a)+.05*Math.sin(.4*i);const l=Math.max(.3,r);n[o]=Math.max(0,Math.min(.9,e[o]+s*l))}return n}function J(e){const t=Array.from({length:Oy.length},()=>0);if(e<=0)return t;for(let r=0;r<Oy.length;r++){const i=Oy[r];let n=0;n=i>=400&&i<=600?.9*e:i>=1400&&i<=1600?.8*e:i>=2400&&i<=2600?.7*e:i>=200&&i<=2e3?.6*e:i>=85&&i<=300?.4*e:.2*e,n*=.8+.4*Math.random(),t[r]=Math.max(0,Math.min(1,n))}return t}function K(){if(typeof window>"u")return;const e=navigator.userAgent.toLowerCase(),t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(e);o.value=t}function Y(e,t){return s.has(e)||s.set(e,t()),s.get(e)}function Q(){s.clear(),l=null}function X(){if(typeof window>"u"||!i||!r.value)return;K();const e=r.value,s=e.width/R,c=e.height/R;function d(e){if(!i)return;if(!a.value)return void(n=requestAnimationFrame(d));i.clearRect(0,0,s,c);let r=0;t.audioLevels?t.isListening?r=Math.min(1.5*t.audioLevels.inputLevel,1):t.isSpeaking&&(r=Math.min(1.8*t.audioLevels.outputLevel,1)):void 0!==t.rms&&(r=Math.min(t.rms/70,1));const u=G(r);for(let t=0;t<p;t++)T[t]=v+u[t]*(f-v);for(let t=0;t<p;t++){const e=P(Oy[t]),r=T[t]-C[t],i=k*e.stiffnessMultiplier,n=b*e.dampingMultiplier,o=r*i-S[t]*n;if(S[t]+=o,C[t]+=S[t],C[t]>E[t])E[t]=C[t],_[t]=w,I[t]=0;else if(_[t]=Math.max(0,_[t]-16.67),_[t]<=0){const e=(Math.max(v,1.1*C[t])-E[t])*y-I[t]*x;I[t]+=e,E[t]=Math.max(v,E[t]+I[t])}}const h=.15*p;function M(){i&&(l||(l=i.createRadialGradient(.5*s,.6*c,.1*c,.5*s,.6*c,.9*c),l.addColorStop(0,"rgba(255,255,255,0.02)"),l.addColorStop(1,"rgba(0,0,0,0.08)")),i.fillStyle=l,i.fillRect(0,0,s,c))}if(My(M,"drawBackground"),M(),(t.isListening||t.isSpeaking)&&!o.value){const e=.001*performance.now(),r=.1+.05*Math.sin(2*e);i.save(),i.globalCompositeOperation="lighter",i.globalAlpha=r;const n=t.isSpeaking?"rgba(34,197,94,0.4)":"rgba(59,130,246,0.4)";i.fillStyle=n;for(let t=0;t<p;t++){const e=t*(m+g),r=C[t],n=c-r;i.beginPath(),i.roundRect(e-1,n-1,m+2,r+2,[2,2,0,0]),i.fill()}i.restore()}for(let n=0;n<p;n++){const e=n*(m+g),r=C[n],a=c-r,s=Oy[n],l=Math.min(n,p-1-n),d=Math.min(1,l/h),u=Math.min(1,r/f),k=(.8+.2*u)*d,b=(.6+.2*u)*d,y=(.3+.1*u)*d,x=Math.round(10*u)/10,S=Math.round(10*d)/10,T=Y(`${t.isSpeaking?"speaking":t.isListening?"listening":"idle"}-${x}-${S}-${r}`,()=>{const e=i.createLinearGradient(0,a,0,a+r);if(t.isSpeaking)e.addColorStop(0,`rgba(34, 197, 94, ${k})`),e.addColorStop(.5,`rgba(34, 197, 94, ${b})`),e.addColorStop(1,`rgba(34, 197, 94, ${y})`),(s>=400&&s<=600||s>=1400&&s<=1600)&&e.addColorStop(0,`rgba(74, 222, 128, ${Math.min(1,k+.2)})`);else if(t.isListening)e.addColorStop(0,`rgba(59, 130, 246, ${k})`),e.addColorStop(.5,`rgba(59, 130, 246, ${b})`),e.addColorStop(1,`rgba(59, 130, 246, ${y})`);else{const t=.6*d,r=.4*d,i=.2*d;e.addColorStop(0,`rgba(156, 163, 175, ${t})`),e.addColorStop(.6,`rgba(156, 163, 175, ${r})`),e.addColorStop(1,`rgba(156, 163, 175, ${i})`)}return e});if(i.fillStyle=T,i.beginPath(),i.roundRect(e,a,m,r,[1,1,0,0]),i.fill(),E[n]>v+2){const r=c-E[n],a=_[n]>0?.9:Math.max(.3,_[n]/w);i.fillStyle=`rgba(255, 255, 255, ${a})`,i.fillRect(e,r-1,m,2),a>.5&&!o.value&&(i.shadowColor=t.isSpeaking?"rgba(34, 197, 94, 0.5)":"rgba(59, 130, 246, 0.5)",i.shadowBlur=3,i.fillRect(e,r-1,m,2),i.shadowBlur=0)}}n=requestAnimationFrame(d)}My(d,"animate"),n=requestAnimationFrame(d)}function ee(){if(typeof window<"u"){const e=Math.max(1,Math.min(2,window.devicePixelRatio||1));e!==R&&(R=e)}O()}return My(W,"getApiThrottleInterval"),My(G,"generateFrequencyBands"),My(Z,"addWaveMotionOverlay"),My(J,"generateIntensityBasedBands"),My(K,"detectMobile"),My(Y,"getGradient"),My(Q,"clearGradientCache"),My(X,"startAnimation"),Jr(()=>{if(r.value){if(i=r.value.getContext("2d"),O(),typeof window<"u"){window.addEventListener("resize",ee,{passive:!0});const e=My(()=>{a.value=!document.hidden},"handleVisibilityChange");document.addEventListener("visibilitychange",e,{passive:!0})}X()}t.enableRealAudio&&t.isListening&&setTimeout(()=>{M().catch(console.error)},100)}),My(ee,"onResize"),Xr(()=>{n&&cancelAnimationFrame(n),typeof window<"u"&&(window.removeEventListener("resize",ee),document.removeEventListener("visibilitychange",()=>{a.value=!document.hidden})),A()}),en([()=>t.isActive,()=>t.isConnected,()=>t.isListening,()=>t.isSpeaking,()=>t.rms],()=>{!i&&r.value&&(i=r.value.getContext("2d")),n&&cancelAnimationFrame(n),X()},{immediate:!0}),en([()=>t.enableRealAudio,()=>t.isListening],async([e,t],[r,i])=>{e&&t&&(!r||!i)&&(u.value||await M().catch(console.error)),(!e||!t)&&r&&i&&A()},{immediate:!1}),en(r,e=>{e&&!i&&(i=e.getContext("2d"),O(),X())}),(e,t)=>(yn(),Tn("div",fS,[An("canvas",{ref_key:"canvasRef",ref:r,width:(Vt(m)+Vt(g))*Vt(p)-Vt(g),height:Vt(f),class:"w-full max-w-full [image-rendering:-webkit-optimize-contrast]",style:ce({height:`${Vt(f)}px`})},null,12,kS)]))}}),wS={class:"flex flex-col h-full items-center justify-center px-6 py-8"},yS={class:"flex-1 flex flex-col items-center justify-center space-y-8 py-4"},xS={class:"h-32 w-full max-w-md"},CS={class:"text-center flex gap-2 items-center text-xs"},SS={class:"flex items-center justify-center gap-2"},TS={key:0,class:"size-2 bg-blue-500 rounded-full animate-pulse"},ES={key:1,class:"size-2 bg-green-500 rounded-full animate-pulse"},_S={key:2,class:"size-2 bg-white/50 rounded-full"},IS={key:3,class:"size-2 bg-red-500 rounded-full"},PS={class:"text-white/70 text-sm max-w-xs leading-relaxed"},MS={class:"flex flex-col items-center space-y-6"},AS=Lr({__name:"ElSelfVoice",props:{selfController:{}},setup(e){const t=eo(()=>e.selfController?.voiceState.value),r=eo(()=>t.value?.isConnected?"red":"green"),i=eo(()=>t.value?.isConnected?"i-heroicons-phone-x-mark":"i-heroicons-phone"),n=eo(()=>t.value?.isConnected?"End Call":"Start a Call"),o=eo(()=>{const t=e.selfController?.voiceState.value;return!!t?.error||"connecting"===t?.connectionStatus}),a=eo(()=>"connecting"===t.value?.connectionStatus);async function s(){if(e.selfController)try{e.selfController.voiceState.value.isConnected?await e.selfController.endConversation():(e.selfController.isConnected()&&await e.selfController.endConversation(),await e.selfController.startVoiceConversation(),e.selfController.agentMode.value="talk")}catch(t){}}return My(s,"toggleCall"),(t,l)=>(yn(),Tn("div",wS,[An("div",yS,[An("div",xS,[Rn(bS,{"audio-levels":e.selfController?.audioLevels.value??{inputLevel:0,outputLevel:0},"is-listening":e.selfController?.voiceState.value.isListening??!1,"is-speaking":e.selfController?.voiceState.value.isSpeaking??!1,"is-connected":e.selfController?.voiceState.value.isConnected??!1,"enable-real-audio":!0,"enable-wave-motion":!0,"enable-scrolling-wave":!0,"self-controller":e.selfController},null,8,["audio-levels","is-listening","is-speaking","is-connected","self-controller"])]),An("div",CS,[An("div",SS,[e.selfController?.voiceState.value.isListening?(yn(),Tn("div",TS)):e.selfController?.voiceState.value.isSpeaking?(yn(),Tn("div",ES)):!e.selfController?.voiceState.value.isConnected||e.selfController?.voiceState.value.isListening||e.selfController?.voiceState.value.isSpeaking?e.selfController?.voiceState.value.error?(yn(),Tn("div",IS)):Ln("",!0):(yn(),Tn("div",_S))]),An("p",PS,ke(e.selfController?.voiceState.value.error?`Error: ${e.selfController.voiceState.value.error}`:e.selfController?.voiceState.value.transcript||"Ready to start a call..."),1)])]),An("div",MS,[Rn(Yy,{theme:r.value,icon:i.value,size:"lg",loading:a.value,disabled:o.value,onClick:s},{default:vr(()=>[Dn(ke(n.value),1)]),_:1},8,["theme","icon","loading","disabled"])])]))}}),RS={key:0,class:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-theme-800 to-theme-950 rounded-3xl z-10"},OS={class:"text-sm"},DS={key:0,class:"flex-1 basis-0 flex justify-end"},LS={key:0,class:"h-full pb-12 flex-1 flex flex-col relative z-20 min-h-0 px-4 @[480px]/agent:px-6 max-w-md mx-auto w-full"},NS={class:"flex-1 basis-0 flex flex-col justify-start pt-6"},zS={key:1,class:"flex-1 flex flex-col relative z-20 min-h-0 w-full"},jS={class:"px-4 pt-4 pb-4 max-w-md mx-auto"},US={key:2,class:"flex-1 flex flex-col relative z-20 min-h-0 w-full px-4 @[480px]/agent:px-6"},FS={class:"flex-1 min-h-0 max-w-md mx-auto w-full"},BS={key:2,class:"bg-gradient-to-br from-theme-800 to-theme-950 text-white flex items-center justify-center h-full p-8"},VS={class:"text-center max-w-md space-y-4"},qS={class:"text-sm text-white/70 leading-relaxed"},$S={key:3,class:"bg-white/10 backdrop-blur-sm text-white/70 flex items-center justify-center h-full"},HS=Lr({__name:"SelfAgent",props:{sdk:{},self:{},context:{},firstMessage:{},hasClose:{type:Boolean,default:!1},isActive:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},theme:{default:"green"}},emits:["close","error"],setup(e,{emit:t}){const r=t,i=Ft(undefined,!0),n=Ut(!1),o=Ut(!1),a=Ut(),s=Ut(),l=eo(()=>i.value?.agentMode?.value??"self"),c=eo(()=>void 0!==e.sdk.activeUser.value),d=eo(()=>Ny.find(e=>e.mode===l.value));function u(){i.value&&i.value.destroy();try{i.value=new Zy({sdk:e.sdk,self:e.self,context:e.context,firstMessage:e.firstMessage})}catch(t){throw t}}function h(e){if(!s.value)return;const t=By(e);Object.entries(t).forEach(([e,t])=>{s.value.style.setProperty(`--primary-${e}`,t)})}return My(u,"createSelfController"),My(h,"applyTheme"),Jr(()=>{try{u(),h(e.theme)}catch(t){const e=t instanceof Error?t.message:"Failed to initialize digital self";a.value=e,r("error",e)}}),Xr(()=>{i.value&&i.value.destroy()}),en(()=>e.theme,e=>{h(e)}),en(()=>e.sdk.activeUser.value,(e,t)=>{t&&!e&&i.value&&i.value.setMode("self")}),(t,u)=>(yn(),Tn("div",{ref_key:"rootElement",ref:s,key:Vt(qy)(e.self),class:"@container/agent self-agent w-full h-full overflow-hidden relative","data-test":"self-agent"},[e.loading?(yn(),Tn("div",RS,[Rn(Uy,{class:"text-white size-8"})])):e.self&&!a.value?(yn(),Tn("div",{key:1,class:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:ce({backgroundImage:`url(${Vt(qy)(e.self)||Vt($y)()})`})},[An("div",{class:me(["absolute inset-0 bg-gradient-to-br z-0","self"===l.value?"from-black/70 via-black/50 to-black/80":"from-black/90 via-black/90 to-black/100"])},null,2),An("div",{class:me(["relative z-10 flex flex-col h-full transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] will-change-transform",e.isActive?"opacity-100 translate-y-0":"opacity-0 translate-y-2"])},[An("div",{class:me(["relative z-30 p-2","self"!==l.value?"backdrop-blur-lg":""])},[An("div",{class:me(["flex items-center",e.hasClose?"":"justify-between"])},[An("div",{class:me(e.hasClose?"flex-1 basis-0":"")},[An("button",{class:"cursor-pointer p-2 flex items-center gap-2 rounded-2xl text-white/70 hover:bg-white/10 transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-105 active:scale-95",onClick:u[0]||(u[0]=e=>n.value=!0)},[...u[6]||(u[6]=[An("i",{class:"i-tabler-menu size-7"},null,-1)])])],2),An("button",{class:me(["flex items-center gap-2 px-3.5 py-3 rounded-2xl text-white/90 hover:bg-white/10 transition-all cursor-pointer flex-grow-0",{"bg-white/10":o.value}]),onClick:u[1]||(u[1]=e=>o.value=!0)},[An("i",{class:me([d.value?.icon,"size-4 opacity-60"])},null,2),An("span",OS,ke(d.value?.label),1),u[7]||(u[7]=An("i",{class:"i-tabler-chevron-down size-4"},null,-1))],2),e.hasClose?(yn(),Tn("div",DS,[An("button",{class:"cursor-pointer flex items-center p-3 rounded-2xl text-white/70 hover:bg-white/10 transition-colors",onClick:u[2]||(u[2]=sa(e=>r("close","button"),["stop"]))},[...u[8]||(u[8]=[An("i",{class:"size-6 i-tabler-x"},null,-1)])])])):Ln("",!0)],2)],2),"self"===l.value?(yn(),Tn("div",LS,[u[9]||(u[9]=An("div",{class:"flex-1 basis-0 mb-36"},null,-1)),Rn(iS,{self:e.self},null,8,["self"]),An("div",NS,[Rn(Yy,{theme:"primary",size:"lg",class:"w-full",icon:"i-heroicons-phone","data-test":"voice-button",onClick:u[3]||(u[3]=e=>i.value?.setMode("talk"))},{default:vr(()=>[Dn(" Talk to "+ke(e.self.name),1)]),_:1})])])):"talk"===l.value?(yn(),Tn("div",zS,[c.value?(yn(),Tn(gn,{key:1},[An("div",null,[An("div",jS,[Rn(gx,{self:e.self},null,8,["self"])])]),Rn(AS,{"self-controller":i.value},null,8,["self-controller"])],64)):(yn(),En(dx,{key:0,sdk:e.sdk},null,8,["sdk"]))])):(yn(),Tn("div",US,[An("div",FS,["chat"===l.value?(yn(),Tn(gn,{key:0},[c.value?(yn(),En(JC,{key:1,"self-controller":i.value,self:e.self},null,8,["self-controller","self"])):(yn(),En(dx,{key:0,sdk:e.sdk},null,8,["sdk"]))],64)):"info"===l.value?(yn(),En(zC,{key:1,self:e.self},null,8,["self"])):Ln("",!0)])])),An("div",{class:me(["relative z-20 text-center py-5 px-6","info"===l.value?"hidden":""])},[...u[10]||(u[10]=[An("a",{href:"https://www.fiction.com",class:"flex items-center justify-center gap-1.5 text-[10px] font-sans font-normal text-white/50 hover:text-white/70 transition-colors"},[An("span",{class:""},"Digital Self\u2122"),An("span",{class:"text-white/20"},"by"),An("span",null,"Fiction.com")],-1)])],2)],2)],4)):a.value?(yn(),Tn("div",BS,[An("div",VS,[u[11]||(u[11]=An("div",{class:"flex justify-center"},[An("div",{class:"rounded-full bg-red-500/20 flex items-center justify-center size-10"},[An("i",{class:"i-tabler-alert-circle size-6 text-red-400"})])],-1)),u[12]||(u[12]=An("h3",{class:"text-lg font-medium"}," Self Error ",-1)),An("p",qS,ke(a.value),1)])])):(yn(),Tn("div",$S," There was an error loading the digital self. Please try again later. ")),Rn(vS,{modelValue:n.value,"onUpdate:modelValue":u[4]||(u[4]=e=>n.value=e),self:e.self,sdk:e.sdk,title:e.self.name},null,8,["modelValue","self","sdk","title"]),Rn(gS,{modelValue:o.value,"onUpdate:modelValue":u[5]||(u[5]=e=>o.value=e),"self-controller":i.value},null,8,["modelValue","self-controller"])]))}}),WS={class:"self-wrap"},GS={key:0,class:"flex items-center justify-center h-full"},ZS={key:2,class:"flex items-center justify-center h-full text-theme-500 text-xs"},JS={class:"flex flex-col items-center gap-2"},KS=Lr({__name:"SelfWrap",props:{sdk:{},self:{},handle:{},context:{},firstMessage:{},hasClose:{type:Boolean},apiBase:{}},setup(e){const t=e,r=t.sdk||new Za({isDev:typeof window<"u"&&("localhost"===window.location.hostname||window.location.hostname.includes("127.0.0.1")),apiBase:t.apiBase}),i=Ut(!t.self),n=Ut(t.self),o=Ut();return Jr(async()=>{if(t.self)i.value=!1;else{if(!t.handle)return o.value="No handle or self provided",void(i.value=!1);try{i.value=!0;const e=await r.getPublicSelf({handle:t.handle});e?n.value=e:o.value=r.error.value||"Self not found"}catch(e){o.value=e instanceof Error?e.message:"Failed to fetch self"}finally{i.value=!1}}}),(t,a)=>(yn(),Tn("div",WS,[i.value?(yn(),Tn("div",GS,[...a[0]||(a[0]=[An("div",{class:"animate-spin rounded-full size-6 border-b-2 border-white"},null,-1)])])):n.value?li(t.$slots,"default",{key:1,sdk:Vt(r),self:n.value,context:e.context,firstMessage:e.firstMessage,loading:i.value}):o.value?(yn(),Tn("div",ZS,[An("div",JS,[a[1]||(a[1]=An("div",null,[An("div",{class:"i-tabler-user-off size-8"})],-1)),An("div",null,ke(o.value),1)])])):Ln("",!0)]))}}),YS={key:0,class:"relative h-full w-full"},QS={class:"group relative h-full w-full rounded-3xl overflow-hidden shadow-lg transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:shadow-2xl hover:translate-y-[-1px] hover:brightness-110 active:scale-[1.06] active:-translate-y-0.5 active:duration-100"},XS=["src","alt"],eT=Lr({__name:"SelfWidget",props:{sdk:{},handle:{},context:{},firstMessage:{},position:{}},setup(e,{expose:t}){const r=e,i=Ut(!1),n=Ut(!1);function o(){i.value=!i.value}function a(){i.value=!0}function s(){i.value=!1}function l(){s()}return My(o,"toggle"),en(i,async e=>{e?(await ar(),setTimeout(()=>{n.value=!0},400)):n.value=!1}),My(a,"open"),My(s,"close"),My(l,"handleClose"),t({toggle:o,open:a,close:s}),(t,a)=>(yn(),En(KS,{sdk:e.sdk,handle:e.handle,context:e.context,"first-message":e.firstMessage},{default:vr(({self:t,sdk:s})=>[t?(yn(),Tn("div",{key:0,class:me(["fixed z-[999999] pointer-events-auto",["bottom-left"===r.position?"bottom-6 left-6":"top-right"===r.position?"top-6 right-6":"top-left"===r.position?"top-6 left-6":"bottom-6 right-6"]])},[An("div",{class:me(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu",[i.value?"widget-expanded w-96 h-[600px] max-w-[calc(100vw-48px)] max-h-[calc(100vh-48px)] rounded-3xl opacity-100 scale-100":"widget-button w-[80px] h-[80px] opacity-100 scale-100 flex items-center justify-center cursor-pointer"]]),style:ce({"transform-origin":"bottom-left"===r.position?"bottom left":"top-right"===r.position?"top right":"top-left"===r.position?"top left":"bottom right"}),onClick:a[0]||(a[0]=e=>i.value?void 0:o())},[i.value?Ln("",!0):(yn(),Tn("div",YS,[An("div",QS,[An("img",{src:Vt(qy)(t)||Vt($y)(),alt:`${t.name} avatar`,class:"h-full w-full object-cover pointer-events-none"},null,8,XS),a[1]||(a[1]=An("div",{class:"absolute inset-0 pointer-events-none bg-gradient-to-br from-transparent via-black/10 to-black/40 opacity-60 transition-opacity duration-300 group-hover:opacity-40"},null,-1))]),a[2]||(a[2]=An("div",{class:"absolute top-0.5 right-0.5"},[An("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",style:{"animation-duration":"3s"}}),An("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white"})],-1))])),i.value&&t?(yn(),En(HS,{key:1,class:"rounded-3xl shadow-2xl border border-white/10",sdk:s,self:t,context:e.context,"first-message":e.firstMessage,"has-close":!0,"is-active":n.value,onClose:l},null,8,["sdk","self","context","first-message","is-active"])):Ln("",!0)],6)],2)):Ln("",!0)]),_:1},8,["sdk","handle","context","first-message"]))}}),tT=class e{constructor(t){r(this,"app",null),r(this,"shadowRoot",null),r(this,"container",null),r(this,"widgetInstance",null),r(this,"config"),this.config=t;const i=e.instances.get(t.handle);i&&(t.handle,i.destroy()),this.init(),e.instances.set(t.handle,this)}init(){this.container=document.createElement("div"),this.container.id=`fiction-widget-${this.config.handle}`;const e=this.config.position||"bottom-right",t=this.getPositionStyles(e);this.container.style.cssText=`\n position: fixed;\n ${t}\n z-index: 9999;\n pointer-events: auto;\n font-family: system-ui, -apple-system, sans-serif;\n `,this.shadowRoot=this.container.attachShadow({mode:"open"});const r=document.createElement("style");r.textContent="/*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:system-ui,-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,sans-serif;--font-serif:\"New York\",Georgia,Cambria,\"Times New Roman\",Times,serif;--font-mono:\"DM Mono\",\"SF Mono\",SFMono-Regular,Consolas,\"Liberation Mono\",Menlo,Courier,monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-50:oklch(98% .016 73.684);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-200:oklch(90.1% .076 70.697);--color-orange-400:oklch(75% .183 55.934);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-700:oklch(55.5% .163 48.998);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-700:oklch(55.4% .135 66.442);--color-yellow-800:oklch(47.6% .114 61.907);--color-yellow-900:oklch(42.1% .095 57.708);--color-green-50:oklch(98.2% .018 155.826);--color-green-100:oklch(96.2% .044 156.743);--color-green-200:oklch(92.5% .084 155.995);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-50:oklch(97.9% .021 166.113);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-indigo-50:oklch(96.2% .018 272.314);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-indigo-900:oklch(35.9% .144 278.697);--color-purple-50:oklch(97.7% .014 308.299);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-200:oklch(90.2% .063 306.703);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-pink-50:oklch(97.1% .014 343.198);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-50:oklch(96.9% .015 12.422);--color-rose-100:oklch(94.1% .03 12.58);--color-rose-200:oklch(89.2% .058 10.001);--color-rose-400:oklch(71.2% .194 13.428);--color-rose-500:oklch(64.5% .246 16.439);--color-rose-600:oklch(58.6% .253 17.585);--color-rose-700:oklch(51.4% .222 16.935);--color-rose-800:oklch(45.5% .188 13.697);--color-rose-900:oklch(41% .159 10.272);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-800:oklch(27.9% .041 260.031);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-neutral-200:oklch(92.2% 0 0);--color-neutral-400:oklch(70.8% 0 0);--color-neutral-600:oklch(43.9% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-md:48rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--text-5xl:3rem;--text-5xl--line-height:1;--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-relaxed:1.625;--radius-2xl:1rem;--radius-3xl:1.5rem;--ease-in:cubic-bezier(.4,0,1,1);--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-lg:16px;--blur-xl:24px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-theme-0:var(--theme-0,#fff);--color-theme-25:var(--theme-25,#f8fafc);--color-theme-50:var(--theme-50,#f3f4f6);--color-theme-100:var(--theme-100,#e5e7eb);--color-theme-200:var(--theme-200,#d1d5db);--color-theme-300:var(--theme-300,#9ca3af);--color-theme-400:var(--theme-400,#6b7280);--color-theme-500:var(--theme-500,#4b5563);--color-theme-600:var(--theme-600,#374151);--color-theme-700:var(--theme-700,#1f2a44);--color-theme-800:var(--theme-800,#111827);--color-theme-900:var(--theme-900,#0c0a13);--color-theme-950:var(--theme-950,#030712);--color-primary-0:var(--primary-0,#fff);--color-primary-25:var(--primary-25,#eff6ff);--color-primary-50:var(--primary-50,#dbeafe);--color-primary-100:var(--primary-100,#bfdbfe);--color-primary-200:var(--primary-200,#93c5fd);--color-primary-300:var(--primary-300,#60a5fa);--color-primary-400:var(--primary-400,#3b82f6);--color-primary-500:var(--primary-500,#2563eb);--color-primary-600:var(--primary-600,#1d4ed8);--color-primary-700:var(--primary-700,#1e40af);--color-primary-800:var(--primary-800,#1e3a8a);--color-primary-900:var(--primary-900,#172554);--color-primary-950:var(--primary-950,#0c1838);--color-primary:var(--primary)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::-moz-placeholder{opacity:1}::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){::-moz-placeholder{color:currentColor}::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab,red,red)){*{outline-color:color-mix(in oklab,var(--ring)50%,transparent)}}body{background-color:var(--background);font-family:var(--font-sans);color:var(--foreground)}.x-font-title{font-family:Cal Sans,Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-weight:700}}@layer components;@layer utilities{.\\@container\\/agent{container:agent/inline-size}.\\@container\\/input{container:input/inline-size}.\\@container{container-type:inline-size}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.-top-1{top:calc(var(--spacing)*-1)}.-top-3{top:calc(var(--spacing)*-3)}.top-0{top:calc(var(--spacing)*0)}.top-0\\.5{top:calc(var(--spacing)*.5)}.top-1{top:calc(var(--spacing)*1)}.top-1\\.5{top:calc(var(--spacing)*1.5)}.top-1\\/2{top:50%}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-6{top:calc(var(--spacing)*6)}.top-full{top:100%}.-right-16{right:calc(var(--spacing)*-16)}.right-0{right:calc(var(--spacing)*0)}.right-0\\.5{right:calc(var(--spacing)*.5)}.right-1{right:calc(var(--spacing)*1)}.right-1\\.5{right:calc(var(--spacing)*1.5)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-6{right:calc(var(--spacing)*6)}.right-\\[-4px\\]{right:-4px}.right-full{right:100%}.-bottom-1{bottom:calc(var(--spacing)*-1)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-6{bottom:calc(var(--spacing)*6)}.bottom-full{bottom:100%}.-left-4{left:calc(var(--spacing)*-4)}.-left-16{left:calc(var(--spacing)*-16)}.-left-full{left:-100%}.left-0{left:calc(var(--spacing)*0)}.left-1\\/2{left:50%}.left-3{left:calc(var(--spacing)*3)}.left-6{left:calc(var(--spacing)*6)}.left-\\[-4px\\]{left:-4px}.left-\\[13px\\]{left:13px}.left-full{left:100%}.isolate{isolation:isolate}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\\[100\\]{z-index:100}.z-\\[999999\\]{z-index:999999}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-mx-3{margin-inline:calc(var(--spacing)*-3)}.mx-1{margin-inline:calc(var(--spacing)*1)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-4{margin-inline:calc(var(--spacing)*4)}.mx-auto{margin-inline:auto}.my-0\\.5{margin-block:calc(var(--spacing)*.5)}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.my-4{margin-block:calc(var(--spacing)*4)}.my-6{margin-block:calc(var(--spacing)*6)}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-1\\.5{margin-top:calc(var(--spacing)*1.5)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.mt-6{margin-top:calc(var(--spacing)*6)}.mt-8{margin-top:calc(var(--spacing)*8)}.mt-12{margin-top:calc(var(--spacing)*12)}.mt-\\[-\\.07em\\]{margin-top:-.07em}.mt-\\[0\\.5em\\]{margin-top:.5em}.-mr-1{margin-right:calc(var(--spacing)*-1)}.mr-1{margin-right:calc(var(--spacing)*1)}.mr-1\\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.-mb-px{margin-bottom:-1px}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-1\\.5{margin-bottom:calc(var(--spacing)*1.5)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.mb-6{margin-bottom:calc(var(--spacing)*6)}.mb-8{margin-bottom:calc(var(--spacing)*8)}.mb-12{margin-bottom:calc(var(--spacing)*12)}.mb-36{margin-bottom:calc(var(--spacing)*36)}.mb-\\[1px\\]{margin-bottom:1px}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-3{margin-left:calc(var(--spacing)*3)}.ml-auto{margin-left:auto}.i-heroicons-arrow-path{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-arrow-right{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-arrow-up-tray{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-check-20-solid{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' width='20' height='20'%3E%3Cpath fill='black' fill-rule='evenodd' d='M16.705 4.153a.75.75 0 0 1 .142 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893l7.48-9.817a.75.75 0 0 1 1.05-.143' clip-rule='evenodd'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-envelope{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0L3.32 8.91a2.25 2.25 0 0 1-1.07-1.916V6.75'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-exclamation-triangle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0zM12 15.75h.007v.008H12z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-globe-alt{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a9 9 0 0 1 7.843 4.582M12 3a9 9 0 0 0-7.843 4.582m15.686 0A11.95 11.95 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.96 8.96 0 0 1 21 12c0 .778-.099 1.533-.284 2.253m0 0A17.9 17.9 0 0 1 12 16.5a17.9 17.9 0 0 1-8.716-2.247m0 0A9 9 0 0 1 3 12c0-1.605.42-3.113 1.157-4.418'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-home{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m2.25 12l8.955-8.955a1.124 1.124 0 0 1 1.59 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-information-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m11.25 11.25l.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0a9 9 0 0 1 18 0m-9-3.75h.008v.008H12z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-phone{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 0 0 2.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.04 12.04 0 0 1-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 0 0-1.091-.852H4.5A2.25 2.25 0 0 0 2.25 4.5z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-phone-x-mark{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M15.75 3.75L18 6m0 0l2.25 2.25M18 6l2.25-2.25M18 6l-2.25 2.25m1.5 13.5c-8.284 0-15-6.716-15-15V4.5A2.25 2.25 0 0 1 4.5 2.25h1.372c.516 0 .966.351 1.091.852l1.106 4.423c.11.44-.054.902-.417 1.173l-1.293.97a1.06 1.06 0 0 0-.38 1.21a12.04 12.04 0 0 0 7.143 7.143c.441.162.928-.004 1.21-.38l.97-1.293a1.13 1.13 0 0 1 1.173-.417l4.423 1.106c.5.125.852.575.852 1.091V19.5a2.25 2.25 0 0 1-2.25 2.25z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-photo{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m2.25 15.75l5.159-5.159a2.25 2.25 0 0 1 3.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 0 1 3.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H3.75A1.5 1.5 0 0 0 2.25 6v12a1.5 1.5 0 0 0 1.5 1.5m10.5-11.25h.008v.008h-.008zm.375 0a.375.375 0 1 1-.75 0a.375.375 0 0 1 .75 0'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-heroicons-trash{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21q.512.078 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48 48 0 0 0-3.478-.397m-12 .562q.51-.088 1.022-.165m0 0a48 48 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a52 52 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a49 49 0 0 0-7.5 0'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-lucide-audio-waveform{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-lucide-rocket{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2'/%3E%3Cpath d='M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0m1 7v5s3.03-.55 4-2c1.08-1.62 0-5 0-5'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-simple-icons-calendly{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M19.655 14.262q.421.001.828.064c0 .005-.005.01-.005.014a6 6 0 0 1-.381.786l-1.219 2.106a6.24 6.24 0 0 1-5.411 3.127h-2.432a6.25 6.25 0 0 1-5.412-3.127l-1.218-2.106a6.25 6.25 0 0 1 0-6.252l1.218-2.106a6.24 6.24 0 0 1 5.412-3.127h2.432a6.25 6.25 0 0 1 5.411 3.127l1.219 2.106c.147.252.271.519.381.786c0 .004.005.009.005.014a5.5 5.5 0 0 1-.828.064c-1.816 0-2.501-.607-3.291-1.306c-.764-.676-1.711-1.517-3.44-1.517h-1.029c-1.251 0-2.387.455-3.2 1.278c-.796.805-1.233 1.904-1.233 3.099v1.411c0 1.196.437 2.295 1.233 3.099c.813.823 1.949 1.278 3.2 1.278h1.034c1.729 0 2.676-.841 3.439-1.517c.791-.703 1.471-1.306 3.287-1.301m.005-3.237q.6 0 1.179-.11q-.003-.007-.002-.014a6.3 6.3 0 0 0-.349-1.218a4.6 4.6 0 0 0 1.986-.819c0-.004-.005-.013-.005-.018a10.6 10.6 0 0 0-1.489-3.03a10.9 10.9 0 0 0-2.331-2.395a10.64 10.64 0 0 0-6.428-2.138c-1.448 0-2.855.28-4.175.841c-1.273.543-2.423 1.315-3.407 2.299S2.878 6.552 2.341 7.83a10.7 10.7 0 0 0-.842 4.175c0 1.448.281 2.855.842 4.174c.542 1.274 1.314 2.423 2.298 3.407s2.129 1.761 3.407 2.299c1.324.556 2.727.841 4.175.841c2.34 0 4.561-.74 6.428-2.137a10.8 10.8 0 0 0 2.331-2.396a10.8 10.8 0 0 0 1.489-3.03c0-.004.005-.014.005-.018a4.6 4.6 0 0 0-1.986-.819c.161-.395.276-.804.349-1.218c.005-.009.005-.014.005-.023a5.85 5.85 0 0 1 2.404 1.035c.685.505.552 1.075.446 1.416C22.184 20.437 17.619 24 12.221 24c-6.625 0-12-5.375-12-12s5.37-12 12-12c5.398 0 9.963 3.563 11.471 8.464c.106.341.239.915-.446 1.421a5.8 5.8 0 0 1-2.404 1.034c.128.716.128 1.45 0 2.166a6.3 6.3 0 0 0-1.182-.11c-4.184 0-3.968 2.823-6.736 2.823h-1.029c-1.899 0-3.15-1.357-3.15-3.095v-1.411c0-1.738 1.251-3.094 3.15-3.094h1.034c2.768 0 2.552 2.823 6.731 2.827'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-simple-icons-github{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-simple-icons-linkedin{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037c-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85c3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.06 2.06 0 0 1-2.063-2.065a2.064 2.064 0 1 1 2.063 2.065m1.782 13.019H3.555V9h3.564zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-simple-icons-n8n{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M21.474 5.684a2.53 2.53 0 0 0-2.447 1.895H16.13a2.526 2.526 0 0 0-2.492 2.11l-.103.624a1.26 1.26 0 0 1-1.246 1.055h-1.001a2.527 2.527 0 0 0-4.893 0H4.973a2.527 2.527 0 1 0 0 1.264h1.422a2.527 2.527 0 0 0 4.894 0h1a1.26 1.26 0 0 1 1.247 1.055l.103.623a2.526 2.526 0 0 0 2.492 2.111h.37a2.527 2.527 0 1 0 0-1.263h-.37a1.26 1.26 0 0 1-1.246-1.056l-.103-.623A2.52 2.52 0 0 0 13.96 12a2.52 2.52 0 0 0 .82-1.48l.104-.622a1.26 1.26 0 0 1 1.246-1.056h2.896a2.527 2.527 0 1 0 2.447-3.158m0 1.263a1.263 1.263 0 0 1 1.263 1.263a1.263 1.263 0 0 1-1.263 1.264A1.263 1.263 0 0 1 20.21 8.21a1.263 1.263 0 0 1 1.264-1.263m-18.948 3.79A1.263 1.263 0 0 1 3.79 12a1.263 1.263 0 0 1-1.264 1.263A1.263 1.263 0 0 1 1.263 12a1.263 1.263 0 0 1 1.263-1.263m6.316 0A1.263 1.263 0 0 1 10.105 12a1.263 1.263 0 0 1-1.263 1.263A1.263 1.263 0 0 1 7.58 12a1.263 1.263 0 0 1 1.263-1.263m10.106 3.79a1.263 1.263 0 0 1 1.263 1.263a1.263 1.263 0 0 1-1.263 1.263a1.263 1.263 0 0 1-1.264-1.263a1.263 1.263 0 0 1 1.263-1.264'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-simple-icons-salesforce{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M10.006 5.415a4.2 4.2 0 0 1 3.045-1.306c1.56 0 2.954.9 3.69 2.205c.63-.3 1.35-.45 2.1-.45c2.85 0 5.159 2.34 5.159 5.22s-2.31 5.22-5.176 5.22c-.345 0-.69-.044-1.02-.104a3.75 3.75 0 0 1-3.3 1.95c-.6 0-1.155-.15-1.65-.375A4.31 4.31 0 0 1 8.88 20.4a4.3 4.3 0 0 1-4.05-2.82c-.27.062-.54.076-.825.076c-2.204 0-4.005-1.8-4.005-4.05c0-1.5.811-2.805 2.01-3.51c-.255-.57-.39-1.2-.39-1.846c0-2.58 2.1-4.65 4.65-4.65c1.53 0 2.85.705 3.72 1.8'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-simple-icons-x{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M14.234 10.162L22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299l-.929-1.329L3.076 1.56h3.182l5.965 8.532l.929 1.329l7.754 11.09h-3.182z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-simple-icons-zapier{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M4.157 0A4.15 4.15 0 0 0 0 4.161v15.678A4.15 4.15 0 0 0 4.157 24h15.682A4.15 4.15 0 0 0 24 19.839V4.161A4.15 4.15 0 0 0 19.839 0zm10.61 8.761h.03a.6.6 0 0 1 .23.038a.6.6 0 0 1 .201.124a.63.63 0 0 1 .162.431a.6.6 0 0 1-.162.435a.6.6 0 0 1-.201.128a.6.6 0 0 1-.23.042a.5.5 0 0 1-.235-.042a.6.6 0 0 1-.332-.328a.6.6 0 0 1-.038-.235a.6.6 0 0 1 .17-.431a.6.6 0 0 1 .405-.162m2.853 1.572q.044.005.095.004c.325-.011.646.064.937.219c.238.144.431.355.552.609c.128.279.189.582.185.888v.193a2 2 0 0 1 0 .219h-2.498c.003.227.075.45.204.642a.78.78 0 0 0 .646.265a.7.7 0 0 0 .484-.136a.64.64 0 0 0 .23-.318l.915.257a1.4 1.4 0 0 1-.28.537c-.14.159-.321.284-.521.355a2.2 2.2 0 0 1-.836.136a1.9 1.9 0 0 1-1.001-.245a1.6 1.6 0 0 1-.665-.703a2.2 2.2 0 0 1-.227-1.036a1.95 1.95 0 0 1 .48-1.398a1.9 1.9 0 0 1 1.3-.488m-9.607.023c.162.004.325.026.48.079c.207.065.4.174.563.314c.26.302.393.692.366 1.088v2.276H8.53l-.109-.711h-.065q-.096.245-.272.439a1.1 1.1 0 0 1-.374.264a1 1 0 0 1-.453.083a1.33 1.33 0 0 1-.866-.264a.97.97 0 0 1-.329-.801a1 1 0 0 1 .076-.431a1 1 0 0 1 .242-.363a1.48 1.48 0 0 1 1.043-.303h.952v-.181a.7.7 0 0 0-.136-.454a.55.55 0 0 0-.438-.154a.7.7 0 0 0-.378.086a.48.48 0 0 0-.193.254l-.99-.144a1.26 1.26 0 0 1 .257-.563c.14-.174.321-.302.533-.378c.261-.091.54-.136.82-.129q.078-.006.163-.007m4.384.007c.174 0 .347.038.506.114c.182.083.34.211.458.374c.257.423.377.911.351 1.406a2.53 2.53 0 0 1-.355 1.448a1.15 1.15 0 0 1-1.009.517c-.204 0-.401-.045-.582-.136a1.05 1.05 0 0 1-.48-.457a1.3 1.3 0 0 1-.114-.234h-.045l.004 1.784h-1.059v-4.713h.904l.117.805h.057c.068-.208.177-.401.328-.56a1.13 1.13 0 0 1 .843-.344h.076zm7.559.084h.903l.113.805h.053a1.4 1.4 0 0 1 .235-.484a.8.8 0 0 1 .313-.242a.8.8 0 0 1 .39-.076h.234v1.051h-.401a.66.66 0 0 0-.313.008a.6.6 0 0 0-.272.155a.66.66 0 0 0-.174.26a.7.7 0 0 0-.027.314v1.875h-1.054zm-17.515.003h3.262v.896L3.73 13.104l.034.113h1.973l.042.9H2.4v-.9l1.931-1.754l-.045-.117H2.441zm11.815 0h1.055v3.659h-1.055zm3.443.684l.019.016a.7.7 0 0 0-.351.045a.76.76 0 0 0-.287.204c-.11.155-.174.336-.189.522h1.545c-.034-.526-.257-.787-.74-.787zm-5.718.163c-.026 0-.057 0-.083.004a.8.8 0 0 0-.31.053a.75.75 0 0 0-.257.189a1.02 1.02 0 0 0-.204.695v.064c-.015.257.057.507.204.711a.63.63 0 0 0 .253.196a.64.64 0 0 0 .314.061a.64.64 0 0 0 .578-.265c.14-.223.204-.48.189-.74a1.2 1.2 0 0 0-.181-.711a.68.68 0 0 0-.503-.257m-4.509 1.266a.46.46 0 0 0-.268.102a.37.37 0 0 0-.114.276q0 .08.027.155a.4.4 0 0 0 .087.132a.58.58 0 0 0 .397.11v.004a.86.86 0 0 0 .563-.182a.57.57 0 0 0 .211-.457v-.14z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-svg-spinners-3-dots-fade{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Ccircle cx='4' cy='12' r='3' fill='black'%3E%3Canimate id='SVG7x14Dcom' fill='freeze' attributeName='opacity' begin='0;SVGqSjG0dUp.end-0.25s' dur='0.75s' values='1;.2'/%3E%3C/circle%3E%3Ccircle cx='12' cy='12' r='3' fill='black' opacity='.4'%3E%3Canimate fill='freeze' attributeName='opacity' begin='SVG7x14Dcom.begin+0.15s' dur='0.75s' values='1;.2'/%3E%3C/circle%3E%3Ccircle cx='20' cy='12' r='3' fill='black' opacity='.3'%3E%3Canimate id='SVGqSjG0dUp' fill='freeze' attributeName='opacity' begin='SVG7x14Dcom.begin+0.3s' dur='0.75s' values='1;.2'/%3E%3C/circle%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-svg-spinners-90-ring-with-bg{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='black' d='M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z' opacity='.25'/%3E%3Cpath fill='black' d='M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z'%3E%3CanimateTransform attributeName='transform' dur='0.75s' repeatCount='indefinite' type='rotate' values='0 12 12;360 12 12'/%3E%3C/path%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-adjustments{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 10a2 2 0 1 0 4 0a2 2 0 0 0-4 0m2-6v4m0 4v8m4-4a2 2 0 1 0 4 0a2 2 0 0 0-4 0m2-12v10m0 4v2m4-13a2 2 0 1 0 4 0a2 2 0 0 0-4 0m2-3v1m0 4v11'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-alert-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0m9-4v4m0 4h.01'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-alert-triangle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 9v4m-1.637-9.409L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0zM12 16h.01'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-apps{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-arrow-down-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 7v14m-3-3l3 3l3-3M12 7a2 2 0 1 0 0-4a2 2 0 0 0 0 4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-arrow-left{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 12h14M5 12l6 6m-6-6l6-6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-arrow-right{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 12h14m-6 6l6-6m-6-6l6 6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-arrow-up{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 5v14m6-8l-6-6m-6 6l6-6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-arrow-up-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 17V3m3 3l-3-3l-3 3m3 11a2 2 0 1 0 0 4a2 2 0 0 0 0-4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-article{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm4 2h10M7 12h10M7 16h10'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-bold{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 5h6a3.5 3.5 0 0 1 0 7H7zm6 7h1a3.5 3.5 0 0 1 0 7H7v-7'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-bolt{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 3v7h6l-8 11v-7H5z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-brand-asana{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 7a3 3 0 1 0 6 0a3 3 0 1 0-6 0m5 9a3 3 0 1 0 6 0a3 3 0 1 0-6 0M4 16a3 3 0 1 0 6 0a3 3 0 1 0-6 0'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-brand-discord{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M8 12a1 1 0 1 0 2 0a1 1 0 0 0-2 0m6 0a1 1 0 1 0 2 0a1 1 0 0 0-2 0'/%3E%3Cpath d='M15.5 17c0 1 1.5 3 2 3c1.5 0 2.833-1.667 3.5-3c.667-1.667.5-5.833-1.5-11.5c-1.457-1.015-3-1.34-4.5-1.5l-.972 1.923a11.9 11.9 0 0 0-4.053 0L9 4c-1.5.16-3.043.485-4.5 1.5c-2 5.667-2.167 9.833-1.5 11.5c.667 1.333 2 3 3.5 3c.5 0 2-2 2-3'/%3E%3Cpath d='M7 16.5c3.5 1 6.5 1 10 0'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-bubble-text{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 10h10m-8 4h5M12.4 3a5.34 5.34 0 0 1 4.906 3.239a5.333 5.333 0 0 1-1.195 10.6a4.26 4.26 0 0 1-5.28 1.863L7 21v-3.134a2.668 2.668 0 0 1-1.795-3.773A4.8 4.8 0 0 1 8.113 5.16A5.33 5.33 0 0 1 12.4 3'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-bug{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 9V8a3 3 0 0 1 6 0v1M8 9h8a6 6 0 0 1 1 3v3a5 5 0 0 1-10 0v-3a6 6 0 0 1 1-3m-5 4h4m10 0h4m-9 7v-6m-8 5l3.35-2M20 19l-3.35-2M4 7l3.75 2.4M20 7l-3.75 2.4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-building{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 21h18M9 8h1m-1 4h1m-1 4h1m4-8h1m-1 4h1m-1 4h1M5 21V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-bulb{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12h1m8-9v1m8 8h1M5.6 5.6l.7.7m12.1-.7l-.7.7M9 16a5 5 0 1 1 6 0a3.5 3.5 0 0 0-1 3a2 2 0 0 1-4 0a3.5 3.5 0 0 0-1-3m.7 1h4.6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-calendar{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm12-4v4M8 3v4m-4 4h16m-9 4h1m0 0v3'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-chart-line{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 19h16M4 15l4-6l4 2l4-5l4 4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-check{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m5 12l5 5L20 7'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-checklist{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9.615 20H7a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8m-3 5l2 2l4-4M9 8h4m-4 4h2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-chevron-down{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9l6 6l6-6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-chevron-right{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m9 6l6 6l-6 6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-chevron-up{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 15l6-6l6 6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-circle-check{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0'/%3E%3Cpath d='m9 12l2 2l4-4'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-circle-x{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0m7-2l4 4m0-4l-4 4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-clear-formatting{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m17 15l4 4m0-4l-4 4M7 6V5h11v1M7 19h4m2-14L9 19'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-clock{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0'/%3E%3Cpath d='M12 7v5l3 3'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-cloud-upload{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M7 18a4.6 4.4 0 0 1 0-9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1'/%3E%3Cpath d='m9 15l3-3l3 3m-3-3v9'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-code{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m7 8l-4 4l4 4m10-8l4 4l-4 4M14 4l-4 16'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-copy{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M7 9.667A2.667 2.667 0 0 1 9.667 7h8.666A2.667 2.667 0 0 1 21 9.667v8.666A2.667 2.667 0 0 1 18.333 21H9.667A2.667 2.667 0 0 1 7 18.333z'/%3E%3Cpath d='M4.012 16.737A2 2 0 0 1 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-credit-card{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 8a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3zm0 2h18M7 15h.01M11 15h2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-crown{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m12 6l4 6l5-4l-2 10H5L3 8l5 4z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-dashboard{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10 13a2 2 0 1 0 4 0a2 2 0 1 0-4 0m3.45-1.45L15.5 9.5'/%3E%3Cpath d='M6.4 20a9 9 0 1 1 11.2 0z'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-device-floppy{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M6 4h10l4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2'/%3E%3Cpath d='M10 14a2 2 0 1 0 4 0a2 2 0 1 0-4 0m4-10v4H8V4'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-discount-check{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M5 7.2A2.2 2.2 0 0 1 7.2 5h1a2.2 2.2 0 0 0 1.55-.64l.7-.7a2.2 2.2 0 0 1 3.12 0l.7.7c.412.41.97.64 1.55.64h1a2.2 2.2 0 0 1 2.2 2.2v1c0 .58.23 1.138.64 1.55l.7.7a2.2 2.2 0 0 1 0 3.12l-.7.7a2.2 2.2 0 0 0-.64 1.55v1a2.2 2.2 0 0 1-2.2 2.2h-1a2.2 2.2 0 0 0-1.55.64l-.7.7a2.2 2.2 0 0 1-3.12 0l-.7-.7a2.2 2.2 0 0 0-1.55-.64h-1a2.2 2.2 0 0 1-2.2-2.2v-1a2.2 2.2 0 0 0-.64-1.55l-.7-.7a2.2 2.2 0 0 1 0-3.12l.7-.7A2.2 2.2 0 0 0 5 8.2z'/%3E%3Cpath d='m9 12l2 2l4-4'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-download{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5l5-5m-5-7v12'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-exclamation-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0m9-3v4m0 3v.01'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-external-link{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6m-7 1l9-9m-5 0h5v5'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-eye{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0'/%3E%3Cpath d='M21 12q-3.6 6-9 6t-9-6q3.6-6 9-6t9 6'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-file-music{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14 3v4a1 1 0 0 0 1 1h4'/%3E%3Cpath d='M17 21H7a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2'/%3E%3Cpath d='M10 16a1 1 0 1 0 2 0a1 1 0 1 0-2 0m2 0v-5l2 1'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-fingerprint{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M18.9 7a8 8 0 0 1 1.1 5v1a6 6 0 0 0 .8 3M8 11a4 4 0 0 1 8 0v1a10 10 0 0 0 2 6'/%3E%3Cpath d='M12 11v2a14 14 0 0 0 2.5 8M8 15a18 18 0 0 0 1.8 6m-4.9-2a22 22 0 0 1-.9-7v-1a8 8 0 0 1 12-6.95'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-flask{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 3h6m-5 6h4m-4-6v6L6 20a.7.7 0 0 0 .5 1h11a.7.7 0 0 0 .5-1L14 9V3'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-frame{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 7h16M4 17h16M7 4v16M17 4v16'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-gift{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 9a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1zm9-1v13'/%3E%3Cpath d='M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7m2.5-4a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5a2.5 2.5 0 0 1 0 5'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-grip-vertical{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 5a1 1 0 1 0 2 0a1 1 0 1 0-2 0m0 7a1 1 0 1 0 2 0a1 1 0 1 0-2 0m0 7a1 1 0 1 0 2 0a1 1 0 1 0-2 0m6-14a1 1 0 1 0 2 0a1 1 0 1 0-2 0m0 7a1 1 0 1 0 2 0a1 1 0 1 0-2 0m0 7a1 1 0 1 0 2 0a1 1 0 1 0-2 0'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-headphones{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M4 15a2 2 0 0 1 2-2h1a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm11 0a2 2 0 0 1 2-2h1a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2z'/%3E%3Cpath d='M4 15v-3a8 8 0 0 1 16 0v3'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-heart{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19.5 12.572L12 20l-7.5-7.428A5 5 0 1 1 12 6.006a5 5 0 1 1 7.5 6.572'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-help{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0m9 5v.01'/%3E%3Cpath d='M12 13.5a1.5 1.5 0 0 1 1-1.5a2.6 2.6 0 1 0-3-4'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-history{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 8v4l2 2'/%3E%3Cpath d='M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-home{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M5 12H3l9-9l9 9h-2M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-7'/%3E%3Cpath d='M9 21v-6a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v6'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-info-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0m9-3h.01'/%3E%3Cpath d='M11 12h1v4h1'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-italic{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 5h6M7 19h6m1-14l-4 14'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-key{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m16.555 3.843l3.602 3.602a2.877 2.877 0 0 1 0 4.069l-2.643 2.643a2.877 2.877 0 0 1-4.069 0l-.301-.301l-6.558 6.558a2 2 0 0 1-1.239.578L5.172 21H4a1 1 0 0 1-.993-.883L3 20v-1.172a2 2 0 0 1 .467-1.284l.119-.13L4 17h2v-2h2v-2l2.144-2.144l-.301-.301a2.877 2.877 0 0 1 0-4.069l2.643-2.643a2.877 2.877 0 0 1 4.069 0M15 9h.01'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-link{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m9 15l6-6m-4-3l.463-.536a5 5 0 0 1 7.071 7.072L18 13m-5 5l-.397.534a5.07 5.07 0 0 1-7.127 0a4.97 4.97 0 0 1 0-7.071L6 11'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-list{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 6h11M9 12h11M9 18h11M5 6v.01M5 12v.01M5 18v.01'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-list-numbers{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11 6h9m-9 6h9m-8 6h8M4 16a2 2 0 1 1 4 0c0 .591-.5 1-1 1.5L4 20h4M6 10V4L4 6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-loader{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 6V3m4.25 4.75L18.4 5.6M18 12h3m-4.75 4.25l2.15 2.15M12 18v3m-4.25-4.75L5.6 18.4M6 12H3m4.75-4.25L5.6 5.6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-loader-2{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 3a9 9 0 1 0 9 9'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-lock{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M5 13a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z'/%3E%3Cpath d='M11 16a1 1 0 1 0 2 0a1 1 0 0 0-2 0m-3-5V7a4 4 0 1 1 8 0v4'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-lock-open{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M5 13a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z'/%3E%3Cpath d='M11 16a1 1 0 1 0 2 0a1 1 0 1 0-2 0m-3-5V6a4 4 0 0 1 8 0'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-logout{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M14 8V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2-2v-2'/%3E%3Cpath d='M9 12h12l-3-3m0 6l3-3'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-mail-check{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M11 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6'/%3E%3Cpath d='m3 7l9 6l9-6m-6 12l2 2l4-4'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-menu{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h16M4 16h16'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-message{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 9h8m-8 4h6m4-9a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-5l-5 3v-3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-message-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 20l1.3-3.9C1.976 12.663 2.874 8.228 6.4 5.726c3.526-2.501 8.59-2.296 11.845.48c3.255 2.777 3.695 7.266 1.029 10.501S11.659 20.922 7.7 19z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-message-dots{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 11v.01M8 11v.01m8-.01v.01M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-5l-5 3v-3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-messages{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m21 14l-3-3h-7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1zm-7 1v2a1 1 0 0 1-1 1H6l-3 3V11a1 1 0 0 1 1-1h2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-microphone{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M9 5a3 3 0 0 1 3-3h0a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h0a3 3 0 0 1-3-3z'/%3E%3Cpath d='M5 10a7 7 0 0 0 14 0M8 21h8m-4-4v4'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-mood-happy{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0m6-3h.01M15 9h.01'/%3E%3Cpath d='M8 13a4 4 0 1 0 8 0z'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-mood-neutral{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0m6-2h.01M15 10h.01'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-mood-sad{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0m6-2h.01M15 10h.01'/%3E%3Cpath d='M9.5 15.25a3.5 3.5 0 0 1 5 0'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-north-star{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12h18m-9 9V3M7.5 7.5l9 9m-9 0l9-9'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-percentage{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M16 17a1 1 0 1 0 2 0a1 1 0 1 0-2 0M6 7a1 1 0 1 0 2 0a1 1 0 1 0-2 0m0 11L18 6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-phone{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 4h4l2 5l-2.5 1.5a11 11 0 0 0 5 5L15 13l5 2v4a2 2 0 0 1-2 2A16 16 0 0 1 3 6a2 2 0 0 1 2-2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-photo{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M15 8h.01M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3z'/%3E%3Cpath d='m3 16l5-5c.928-.893 2.072-.893 3 0l5 5'/%3E%3Cpath d='m14 14l1-1c.928-.893 2.072-.893 3 0l3 3'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-player-pause{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1zm8 0a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-player-play{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 4v16l13-8z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-plug{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9.785 6L18 14.215l-2.054 2.054a5.81 5.81 0 1 1-8.215-8.215zM4 20l3.5-3.5M15 4l-3.5 3.5M20 9l-3.5 3.5'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-plug-connected{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m7 12l5 5l-1.5 1.5a3.536 3.536 0 1 1-5-5zm10 0l-5-5l1.5-1.5a3.536 3.536 0 1 1 5 5zM3 21l2.5-2.5m13-13L21 3m-11 8l-2 2m5 1l-2 2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-plug-off{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m16.123 16.092l-.177.177a5.81 5.81 0 1 1-8.215-8.215l.159-.159M4 20l3.5-3.5M15 4l-3.5 3.5M20 9l-3.5 3.5M3 3l18 18'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-plus{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 5v14m-7-7h14'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-puzzle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 7h3a1 1 0 0 0 1-1V5a2 2 0 0 1 4 0v1a1 1 0 0 0 1 1h3a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h1a2 2 0 0 1 0 4h-1a1 1 0 0 0-1 1v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-1a2 2 0 0 0-4 0v1a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a2 2 0 0 0 0-4H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-puzzle-off{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8.18 4.171A2 2 0 0 1 12 5v1a1 1 0 0 0 1 1h3a1 1 0 0 1 1 1v3a1 1 0 0 0 1 1h1a2 2 0 0 1 .819 3.825M17 17v3a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-1a2 2 0 1 0-4 0v1a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a2 2 0 1 0 0-4H4a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h3M3 3l18 18'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-qrcode{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm3 12v.01M14 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zM7 7v.01M4 15a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm13-8v.01M14 14h3m3 0v.01M14 14v3m0 3h3m0-3h3m0 0v3'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-quotes{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 12c-1.333-1.854-1.333-4.146 0-6m4 6c-1.333-1.854-1.333-4.146 0-6m8 12c1.333-1.854 1.333-4.146 0-6m4 6c1.333-1.854 1.333-4.146 0-6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-refresh{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-robot{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2zm6-4v2m-3 8v9m6-9v9M5 16l4-2m6 0l4 2M9 18h6M10 8v.01M14 8v.01'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-script{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M17 20H6a3 3 0 0 1 0-6h11a3 3 0 0 0 0 6h1a3 3 0 0 0 3-3V6a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v8'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-search{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 10a7 7 0 1 0 14 0a7 7 0 1 0-14 0m18 11l-6-6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-settings{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065'/%3E%3Cpath d='M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-settings-cog{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12.003 21c-.732.001-1.465-.438-1.678-1.317a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c.886.215 1.325.957 1.318 1.694'/%3E%3Cpath d='M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0m8.001 7a2 2 0 1 0 4 0a2 2 0 1 0-4 0m2-3.5V17m0 4v1.5m3.031-5.25l-1.299.75m-3.463 2l-1.3.75m0-3.5l1.3.75m3.463 2l1.3.75'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-share{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 12a3 3 0 1 0 6 0a3 3 0 1 0-6 0m12-6a3 3 0 1 0 6 0a3 3 0 1 0-6 0m0 12a3 3 0 1 0 6 0a3 3 0 1 0-6 0m-6.3-7.3l6.6-3.4m-6.6 6l6.6 3.4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-shield-check{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M11.46 20.846A12 12 0 0 1 3.5 6A12 12 0 0 0 12 3a12 12 0 0 0 8.5 3a12 12 0 0 1-.09 7.06M15 19l2 2l4-4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-shield-lock{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 3a12 12 0 0 0 8.5 3A12 12 0 0 1 12 21A12 12 0 0 1 3.5 6A12 12 0 0 0 12 3'/%3E%3Cpath d='M11 11a1 1 0 1 0 2 0a1 1 0 1 0-2 0m1 1v2.5'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-sparkles{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M16 18a2 2 0 0 1 2 2a2 2 0 0 1 2-2a2 2 0 0 1-2-2a2 2 0 0 1-2 2m0-12a2 2 0 0 1 2 2a2 2 0 0 1 2-2a2 2 0 0 1-2-2a2 2 0 0 1-2 2M9 18a6 6 0 0 1 6-6a6 6 0 0 1-6-6a6 6 0 0 1-6 6a6 6 0 0 1 6 6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-square{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-star{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m12 17.75l-6.172 3.245l1.179-6.873l-5-4.867l6.9-1l3.086-6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-switch{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 4h4v4m-4.25 1.25L19 4M5 19l4-4m6 4h4v-4M5 5l14 14'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-tags{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 8v4.172a2 2 0 0 0 .586 1.414l5.71 5.71a2.41 2.41 0 0 0 3.408 0l3.592-3.592a2.41 2.41 0 0 0 0-3.408l-5.71-5.71A2 2 0 0 0 9.172 6H5a2 2 0 0 0-2 2'/%3E%3Cpath d='m18 19l1.592-1.592a4.82 4.82 0 0 0 0-6.816L15 6m-8 4h-.01'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-target{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M11 12a1 1 0 1 0 2 0a1 1 0 1 0-2 0'/%3E%3Cpath d='M7 12a5 5 0 1 0 10 0a5 5 0 1 0-10 0'/%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-tool{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M7 10h3V7L6.5 3.5a6 6 0 0 1 8 8l6 6a2 2 0 0 1-3 3l-6-6a6 6 0 0 1-8-8z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-trash{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 7h16m-10 4v6m4-6v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-trending-up{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='m3 17l6-6l4 4l8-8'/%3E%3Cpath d='M14 7h7v7'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-user{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-user-check{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h4m1 4l2 2l4-4'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-user-circle{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0'/%3E%3Cpath d='M9 10a3 3 0 1 0 6 0a3 3 0 1 0-6 0m-2.832 8.849A4 4 0 0 1 10 16h4a4 4 0 0 1 3.834 2.855'/%3E%3C/g%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-user-cog{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h2.5m4.501 4a2 2 0 1 0 4 0a2 2 0 1 0-4 0m2-3.5V17m0 4v1.5m3.031-5.25l-1.299.75m-3.463 2l-1.3.75m0-3.5l1.3.75m3.463 2l1.3.75'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-user-edit{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h3.5m4.92.61a2.1 2.1 0 0 1 2.97 2.97L18 22h-3v-3z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-user-off{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8.18 8.189a4.01 4.01 0 0 0 2.616 2.627m3.507-.545a4 4 0 1 0-5.59-5.552M6 21v-2a4 4 0 0 1 4-4h4c.412 0 .81.062 1.183.178m2.633 2.618c.12.38.184.785.184 1.204v2M3 3l18 18'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-user-share{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h3m3 7l5-5m0 4.5V17h-4.5'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-users{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 7a4 4 0 1 0 8 0a4 4 0 1 0-8 0M3 21v-2a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v2m1-17.87a4 4 0 0 1 0 7.75M21 21v-2a4 4 0 0 0-3-3.85'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-volume{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 8a5 5 0 0 1 0 8m2.7-11a9 9 0 0 1 0 14M6 15H4a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h2l3.5-4.5A.8.8 0 0 1 11 5v14a.8.8 0 0 1-1.5.5z'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-volume-off{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 8a5 5 0 0 1 1.912 4.934m-1.377 2.602A5 5 0 0 1 15 16m2.7-11a9 9 0 0 1 2.362 11.086m-1.676 2.299A9 9 0 0 1 17.7 19M9.069 5.054L9.5 4.5A.8.8 0 0 1 11 5v2m0 4v8a.8.8 0 0 1-1.5.5L6 15H4a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h2l1.294-1.664M3 3l18 18'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-wave-sine{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 12h-2c-.894 0-1.662-.857-1.761-2c-.296-3.45-.749-6-2.749-6s-2.5 3.582-2.5 8s-.5 8-2.5 8s-2.452-2.547-2.749-6c-.1-1.147-.867-2-1.763-2h-2'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-wifi-off{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 18h.01m-2.838-2.828a4 4 0 0 1 5.656 0m-8.485-2.829a7.96 7.96 0 0 1 3.864-2.14m4.163.155a8 8 0 0 1 3.287 2M3.515 9.515A12 12 0 0 1 7.059 7.06m3.101-.92a12 12 0 0 1 10.325 3.374M3 3l18 18'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-writing{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 17V5c0-1.121-.879-2-2-2s-2 .879-2 2v12l2 2zM16 7h4m-2 12H5a2 2 0 1 1 0-4h4a2 2 0 1 0 0-4H6'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-tabler-x{--svg:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E\");width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.i-logos-hubspot{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 149' width='512' height='149'%3E%3Cpath fill='%2345535E' d='M.06 27.679h17.852v39.662h37.651V27.679h17.875v97.358H55.563V84.542H17.912v40.495H.06zm129.933 65.647c0 8.15-6.64 14.782-14.788 14.782c-8.151 0-14.787-6.632-14.787-14.782V51.41h-16.93v41.916c0 17.487 14.229 31.711 31.717 31.711c17.484 0 31.712-14.224 31.712-31.711V51.41h-16.924zm64.186-41.425c-8.398 0-14.26 2.437-19.921 7.994V27.679h-16.985v59.705c0 22.348 16.158 37.653 34.311 37.653c20.181 0 37.863-15.578 37.863-36.567c0-20.723-16.305-36.569-35.268-36.569m.422 57.423c-11.509 0-20.31-9.612-20.31-20.854c0-11.244 8.801-20.859 20.31-20.859c9.752 0 18.558 9.615 18.558 20.859c0 11.242-8.806 20.854-18.558 20.854m63.373-53.144c0-8.538 5.689-11.245 11.917-11.245c5.014 0 11.649 3.792 15.979 8.398l11.103-13.001c-5.549-7.448-16.788-12.596-25.998-12.596c-18.421 0-31.694 10.7-31.694 28.444c0 32.91 40.497 22.478 40.497 40.902c0 5.682-5.551 10.698-11.913 10.698c-10.026 0-13.278-4.876-17.881-10.024l-12.327 12.729c7.86 9.617 17.608 14.495 29.257 14.495c17.47 0 31.556-10.835 31.556-27.767c0-36.566-40.496-25.188-40.496-41.033m85.21-5.233c-18.151 0-34.311 15.296-34.311 37.649v59.859h16.984v-32.369c5.662 5.553 11.521 7.994 19.922 7.994c18.962 0 35.269-15.844 35.269-36.567c0-20.992-17.687-36.566-37.864-36.566m3.018 57.425c-11.508 0-20.31-9.625-20.31-20.859c0-11.244 8.802-20.859 20.31-20.859c9.75 0 18.557 9.615 18.557 20.859c0 11.234-8.807 20.859-18.557 20.859m159.867.952c-10.018 0-12.862-4.332-12.862-10.971V68.965h15.572V54.069h-15.572v-19.64l-17.195 7.718v59.863c0 15.306 10.56 23.027 25.045 23.027c2.167 0 5.15-.14 6.777-.541l4.199-15.438c-1.896.131-4.062.266-5.964.266'/%3E%3Cpath fill='%23F8761F' d='M461.278 69.831c-3.256-5.602-7.836-10.093-13.562-13.474c-4.279-2.491-8.716-4.072-13.716-4.751v-17.8c5-2.123 8.103-6.822 8.103-12.304c0-7.472-5.992-13.527-13.458-13.527c-7.472 0-13.569 6.055-13.569 13.527c0 5.482 2.924 10.181 7.924 12.304v17.808c-4 .578-8.148 1.825-11.936 3.741c-7.737-5.876-33.107-25.153-47.948-36.412c.352-1.269.623-2.577.623-3.957c0-8.276-6.702-14.984-14.981-14.984S333.78 6.71 333.78 14.986s6.706 14.985 14.985 14.985c2.824 0 5.436-.826 7.69-2.184l3.132 2.376l43.036 31.008c-2.275 2.089-4.394 4.465-6.089 7.131C393.099 73.737 391 79.717 391 86.24v1.361c0 4.579.87 8.902 2.352 12.963c1.305 3.546 3.213 6.77 5.576 9.685l-14.283 14.318a11.5 11.5 0 0 0-12.166 2.668a11.5 11.5 0 0 0-3.388 8.19c.001 3.093 1.206 6 3.394 8.187a11.5 11.5 0 0 0 8.188 3.394a11.5 11.5 0 0 0 8.191-3.394a11.5 11.5 0 0 0 3.39-8.187c0-1.197-.185-2.365-.533-3.475l14.763-14.765c2.024 1.398 4.21 2.575 6.56 3.59c4.635 2.004 9.751 3.225 15.35 3.225h1.026c6.19 0 12.029-1.454 17.518-4.428c5.784-3.143 10.311-7.441 13.731-12.928c3.438-5.502 5.331-11.581 5.331-18.269v-.334c0-6.579-1.523-12.649-4.722-18.21m-18.038 30.973c-4.007 4.453-8.613 7.196-13.82 7.196h-.858c-2.974 0-5.883-.822-8.731-2.317c-3.21-1.646-5.65-3.994-7.647-6.967c-2.064-2.918-3.184-6.104-3.184-9.482v-1.026c0-3.321.637-6.47 2.243-9.444c1.717-3.251 4.036-5.779 7.12-7.789c3.028-1.996 6.262-2.975 9.864-2.975h.335c3.266 0 6.358.644 9.276 2.137c2.973 1.592 5.402 3.767 7.285 6.628c1.829 2.862 2.917 5.949 3.267 9.312c.055.699.083 1.415.083 2.099c0 4.564-1.744 8.791-5.233 12.628'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:100% 100%;width:1em;height:1em;display:inline-block}.i-logos-stripe{background-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 214' width='512' height='214'%3E%3Cpath fill='%23635BFF' d='M512 110.08c0-36.409-17.636-65.138-51.342-65.138c-33.85 0-54.33 28.73-54.33 64.854c0 42.808 24.179 64.426 58.88 64.426c16.925 0 29.725-3.84 39.396-9.244v-28.445c-9.67 4.836-20.764 7.823-34.844 7.823c-13.796 0-26.027-4.836-27.591-21.618h69.547c0-1.85.284-9.245.284-12.658m-70.258-13.511c0-16.071 9.814-22.756 18.774-22.756c8.675 0 17.92 6.685 17.92 22.756zm-90.31-51.627c-13.939 0-22.899 6.542-27.876 11.094l-1.85-8.818h-31.288v165.83l35.555-7.537l.143-40.249c5.12 3.698 12.657 8.96 25.173 8.96c25.458 0 48.64-20.48 48.64-65.564c-.142-41.245-23.609-63.716-48.498-63.716m-8.534 97.991c-8.391 0-13.37-2.986-16.782-6.684l-.143-52.765c3.698-4.124 8.818-6.968 16.925-6.968c12.942 0 21.902 14.506 21.902 33.137c0 19.058-8.818 33.28-21.902 33.28M241.493 36.551l35.698-7.68V0l-35.698 7.538zm0 10.809h35.698v124.444h-35.698zm-38.257 10.524L200.96 47.36h-30.72v124.444h35.556V87.467c8.39-10.951 22.613-8.96 27.022-7.396V47.36c-4.551-1.707-21.191-4.836-29.582 10.524m-71.112-41.386l-34.702 7.395l-.142 113.92c0 21.05 15.787 36.551 36.836 36.551c11.662 0 20.195-2.133 24.888-4.693V140.8c-4.55 1.849-27.022 8.391-27.022-12.658V77.653h27.022V47.36h-27.022zM35.982 83.484c0-5.546 4.551-7.68 12.09-7.68c10.808 0 24.461 3.272 35.27 9.103V51.484c-11.804-4.693-23.466-6.542-35.27-6.542C19.2 44.942 0 60.018 0 85.192c0 39.252 54.044 32.995 54.044 49.92c0 6.541-5.688 8.675-13.653 8.675c-11.804 0-26.88-4.836-38.827-11.378v33.849c13.227 5.689 26.596 8.106 38.827 8.106c29.582 0 49.92-14.648 49.92-40.106c-.142-42.382-54.329-34.845-54.329-50.774'/%3E%3C/svg%3E\");background-repeat:no-repeat;background-size:100% 100%;width:1em;height:1em;display:inline-block}.line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.aspect-\\[3\\/1\\]{aspect-ratio:3}.aspect-\\[3\\/4\\]{aspect-ratio:3/4}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-1\\.5{width:calc(var(--spacing)*1.5);height:calc(var(--spacing)*1.5)}.size-2{width:calc(var(--spacing)*2);height:calc(var(--spacing)*2)}.size-2\\.5{width:calc(var(--spacing)*2.5);height:calc(var(--spacing)*2.5)}.size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.size-3\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-7{width:calc(var(--spacing)*7);height:calc(var(--spacing)*7)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.size-11{width:calc(var(--spacing)*11);height:calc(var(--spacing)*11)}.size-12{width:calc(var(--spacing)*12);height:calc(var(--spacing)*12)}.size-14{width:calc(var(--spacing)*14);height:calc(var(--spacing)*14)}.size-\\[1\\.1em\\]{width:1.1em;height:1.1em}.size-full{width:100%;height:100%}.h-0{height:calc(var(--spacing)*0)}.h-1{height:calc(var(--spacing)*1)}.h-2{height:calc(var(--spacing)*2)}.h-3{height:calc(var(--spacing)*3)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-14{height:calc(var(--spacing)*14)}.h-16{height:calc(var(--spacing)*16)}.h-20{height:calc(var(--spacing)*20)}.h-24{height:calc(var(--spacing)*24)}.h-32{height:calc(var(--spacing)*32)}.h-40{height:calc(var(--spacing)*40)}.h-64{height:calc(var(--spacing)*64)}.h-\\[28px\\]{height:28px}.h-\\[34px\\]{height:34px}.h-\\[42px\\]{height:42px}.h-\\[60px\\]{height:60px}.h-\\[80px\\]{height:80px}.h-\\[80vh\\]{height:80vh}.h-\\[100dvh\\]{height:100dvh}.h-\\[600px\\]{height:600px}.h-auto{height:auto}.h-dvh{height:100dvh}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-0{max-height:calc(var(--spacing)*0)}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-72{max-height:calc(var(--spacing)*72)}.max-h-80{max-height:calc(var(--spacing)*80)}.max-h-\\[200px\\]{max-height:200px}.max-h-\\[300px\\]{max-height:300px}.max-h-\\[400px\\]{max-height:400px}.max-h-\\[600px\\]{max-height:600px}.max-h-\\[calc\\(100vh-48px\\)\\]{max-height:calc(100vh - 48px)}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-32{min-height:calc(var(--spacing)*32)}.min-h-\\[30px\\]{min-height:30px}.min-h-\\[44px\\]{min-height:44px}.min-h-\\[70vh\\]{min-height:70vh}.min-h-\\[280px\\]{min-height:280px}.min-h-full{min-height:100%}.min-h-screen{min-height:100vh}.w-1\\/2{width:50%}.w-2{width:calc(var(--spacing)*2)}.w-3{width:calc(var(--spacing)*3)}.w-3\\/4{width:75%}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-5\\/6{width:83.3333%}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.w-14{width:calc(var(--spacing)*14)}.w-16{width:calc(var(--spacing)*16)}.w-20{width:calc(var(--spacing)*20)}.w-22{width:calc(var(--spacing)*22)}.w-24{width:calc(var(--spacing)*24)}.w-28{width:calc(var(--spacing)*28)}.w-30{width:calc(var(--spacing)*30)}.w-32{width:calc(var(--spacing)*32)}.w-48{width:calc(var(--spacing)*48)}.w-56{width:calc(var(--spacing)*56)}.w-64{width:calc(var(--spacing)*64)}.w-80{width:calc(var(--spacing)*80)}.w-96{width:calc(var(--spacing)*96)}.w-\\[3px\\]{width:3px}.w-\\[28px\\]{width:28px}.w-\\[29\\%\\]{width:29%}.w-\\[60px\\]{width:60px}.w-\\[80\\%\\]{width:80%}.w-\\[80px\\]{width:80px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\\[70\\%\\]{max-width:70%}.max-w-\\[255px\\]{max-width:255px}.max-w-\\[300px\\]{max-width:300px}.max-w-\\[380px\\]{max-width:380px}.max-w-\\[calc\\(100vw-48px\\)\\]{max-width:calc(100vw - 48px)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-screen-md{max-width:var(--breakpoint-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-\\[80px\\]{min-width:80px}.min-w-\\[200px\\]{min-width:200px}.min-w-max{min-width:-moz-max-content;min-width:max-content}.flex-1{flex:1}.flex-none{flex:none}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.flex-grow-0{flex-grow:0}.grow{flex-grow:1}.basis-0{flex-basis:calc(var(--spacing)*0)}.border-collapse{border-collapse:collapse}.origin-center{transform-origin:50%}.origin-top-right{transform-origin:100% 0}.-translate-x-1\\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-4{--tw-translate-x:calc(var(--spacing)*-4);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-\\[30px\\]{--tw-translate-x: -30px ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-3{--tw-translate-x:calc(var(--spacing)*3);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-4{--tw-translate-x:calc(var(--spacing)*4);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-5{--tw-translate-x:calc(var(--spacing)*5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-6{--tw-translate-x:calc(var(--spacing)*6);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-7{--tw-translate-x:calc(var(--spacing)*7);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-8{--tw-translate-x:calc(var(--spacing)*8);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-\\[30px\\]{--tw-translate-y: -30px ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-2{--tw-translate-y:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\\[30px\\]{--tw-translate-y:30px;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-full{--tw-translate-y:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.scale-75{--tw-scale-x:75%;--tw-scale-y:75%;--tw-scale-z:75%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.scale-150{--tw-scale-x:150%;--tw-scale-y:150%;--tw-scale-z:150%;scale:var(--tw-scale-x)var(--tw-scale-y)}.-rotate-45{rotate:-45deg}.rotate-0{rotate:none}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.transform-gpu{transform:translateZ(0)var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-grab{cursor:grab}.cursor-help{cursor:help}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.list-outside{list-style-position:outside}.list-disc{list-style-type:disc}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-5{gap:calc(var(--spacing)*5)}.gap-6{gap:calc(var(--spacing)*6)}.gap-8{gap:calc(var(--spacing)*8)}:where(.space-y-0>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*0)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*0)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1.5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1.5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*5)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*5)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-12>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*12)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*12)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-16>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*16)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*16)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*3)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*4)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-12>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*12)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*12)*calc(1 - var(--tw-space-x-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-clip{overflow-x:clip}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\\[5px\\]{border-radius:5px}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-t-2xl{border-top-left-radius:var(--radius-2xl);border-top-right-radius:var(--radius-2xl)}.rounded-t-md{border-top-left-radius:calc(var(--radius) - 2px);border-top-right-radius:calc(var(--radius) - 2px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-4{border-style:var(--tw-border-style);border-width:4px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-amber-300{border-color:var(--color-amber-300)}.border-black{border-color:var(--color-black)}.border-blue-200{border-color:var(--color-blue-200)}.border-emerald-300{border-color:var(--color-emerald-300)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-300\\/80{border-color:#d1d5dccc}@supports (color:color-mix(in lab,red,red)){.border-gray-300\\/80{border-color:color-mix(in oklab,var(--color-gray-300)80%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-green-100{border-color:var(--color-green-100)}.border-green-200{border-color:var(--color-green-200)}.border-green-400{border-color:var(--color-green-400)}.border-green-500{border-color:var(--color-green-500)}.border-green-600{border-color:var(--color-green-600)}.border-indigo-100{border-color:var(--color-indigo-100)}.border-indigo-500{border-color:var(--color-indigo-500)}.border-indigo-600\\/80{border-color:#4f39f6cc}@supports (color:color-mix(in lab,red,red)){.border-indigo-600\\/80{border-color:color-mix(in oklab,var(--color-indigo-600)80%,transparent)}}.border-neutral-200{border-color:var(--color-neutral-200)}.border-orange-100{border-color:var(--color-orange-100)}.border-orange-200{border-color:var(--color-orange-200)}.border-orange-500{border-color:var(--color-orange-500)}.border-orange-700{border-color:var(--color-orange-700)}.border-primary-100{border-color:var(--color-primary-100)}.border-primary-200,.border-primary-200\\/50{border-color:var(--color-primary-200)}@supports (color:color-mix(in lab,red,red)){.border-primary-200\\/50{border-color:color-mix(in oklab,var(--color-primary-200)50%,transparent)}}.border-primary-200\\/70{border-color:var(--color-primary-200)}@supports (color:color-mix(in lab,red,red)){.border-primary-200\\/70{border-color:color-mix(in oklab,var(--color-primary-200)70%,transparent)}}.border-primary-300,.border-primary-300\\/60{border-color:var(--color-primary-300)}@supports (color:color-mix(in lab,red,red)){.border-primary-300\\/60{border-color:color-mix(in oklab,var(--color-primary-300)60%,transparent)}}.border-primary-400{border-color:var(--color-primary-400)}.border-primary-500,.border-primary-500\\/40{border-color:var(--color-primary-500)}@supports (color:color-mix(in lab,red,red)){.border-primary-500\\/40{border-color:color-mix(in oklab,var(--color-primary-500)40%,transparent)}}.border-primary-600\\/80{border-color:var(--color-primary-600)}@supports (color:color-mix(in lab,red,red)){.border-primary-600\\/80{border-color:color-mix(in oklab,var(--color-primary-600)80%,transparent)}}.border-purple-200{border-color:var(--color-purple-200)}.border-red-100{border-color:var(--color-red-100)}.border-red-200{border-color:var(--color-red-200)}.border-red-300{border-color:var(--color-red-300)}.border-red-400{border-color:var(--color-red-400)}.border-red-500{border-color:var(--color-red-500)}.border-red-600\\/80{border-color:#e40014cc}@supports (color:color-mix(in lab,red,red)){.border-red-600\\/80{border-color:color-mix(in oklab,var(--color-red-600)80%,transparent)}}.border-rose-100{border-color:var(--color-rose-100)}.border-rose-500{border-color:var(--color-rose-500)}.border-rose-600\\/80{border-color:#e70044cc}@supports (color:color-mix(in lab,red,red)){.border-rose-600\\/80{border-color:color-mix(in oklab,var(--color-rose-600)80%,transparent)}}.border-slate-300{border-color:var(--color-slate-300)}.border-theme-100{border-color:var(--color-theme-100)}.border-theme-200,.border-theme-200\\/50{border-color:var(--color-theme-200)}@supports (color:color-mix(in lab,red,red)){.border-theme-200\\/50{border-color:color-mix(in oklab,var(--color-theme-200)50%,transparent)}}.border-theme-200\\/60{border-color:var(--color-theme-200)}@supports (color:color-mix(in lab,red,red)){.border-theme-200\\/60{border-color:color-mix(in oklab,var(--color-theme-200)60%,transparent)}}.border-theme-200\\/70{border-color:var(--color-theme-200)}@supports (color:color-mix(in lab,red,red)){.border-theme-200\\/70{border-color:color-mix(in oklab,var(--color-theme-200)70%,transparent)}}.border-theme-300,.border-theme-300\\/50{border-color:var(--color-theme-300)}@supports (color:color-mix(in lab,red,red)){.border-theme-300\\/50{border-color:color-mix(in oklab,var(--color-theme-300)50%,transparent)}}.border-theme-300\\/80{border-color:var(--color-theme-300)}@supports (color:color-mix(in lab,red,red)){.border-theme-300\\/80{border-color:color-mix(in oklab,var(--color-theme-300)80%,transparent)}}.border-theme-500{border-color:var(--color-theme-500)}.border-theme-600\\/80{border-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.border-theme-600\\/80{border-color:color-mix(in oklab,var(--color-theme-600)80%,transparent)}}.border-theme-900{border-color:var(--color-theme-900)}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.border-white\\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.border-white\\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.border-white\\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-white\\/100{border-color:var(--color-white)}.border-yellow-200{border-color:var(--color-yellow-200)}.border-t-primary-500{border-top-color:var(--color-primary-500)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-background{background-color:var(--background)}.bg-black{background-color:var(--color-black)}.bg-black\\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-black\\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.bg-black\\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-emerald-50{background-color:var(--color-emerald-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-50{background-color:var(--color-green-50)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-600{background-color:var(--color-green-600)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-indigo-500{background-color:var(--color-indigo-500)}.bg-neutral-200{background-color:var(--color-neutral-200)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-600{background-color:var(--color-orange-600)}.bg-primary-25{background-color:var(--color-primary-25)}.bg-primary-50,.bg-primary-50\\/20{background-color:var(--color-primary-50)}@supports (color:color-mix(in lab,red,red)){.bg-primary-50\\/20{background-color:color-mix(in oklab,var(--color-primary-50)20%,transparent)}}.bg-primary-50\\/30{background-color:var(--color-primary-50)}@supports (color:color-mix(in lab,red,red)){.bg-primary-50\\/30{background-color:color-mix(in oklab,var(--color-primary-50)30%,transparent)}}.bg-primary-500,.bg-primary-500\\/20{background-color:var(--color-primary-500)}@supports (color:color-mix(in lab,red,red)){.bg-primary-500\\/20{background-color:color-mix(in oklab,var(--color-primary-500)20%,transparent)}}.bg-primary-500\\/80{background-color:var(--color-primary-500)}@supports (color:color-mix(in lab,red,red)){.bg-primary-500\\/80{background-color:color-mix(in oklab,var(--color-primary-500)80%,transparent)}}.bg-primary-600{background-color:var(--color-primary-600)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-purple-500{background-color:var(--color-purple-500)}.bg-purple-600{background-color:var(--color-purple-600)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-red-600{background-color:var(--color-red-600)}.bg-rose-50{background-color:var(--color-rose-50)}.bg-rose-100{background-color:var(--color-rose-100)}.bg-rose-500{background-color:var(--color-rose-500)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-theme-0{background-color:var(--color-theme-0)}.bg-theme-25,.bg-theme-25\\/70{background-color:var(--color-theme-25)}@supports (color:color-mix(in lab,red,red)){.bg-theme-25\\/70{background-color:color-mix(in oklab,var(--color-theme-25)70%,transparent)}}.bg-theme-50,.bg-theme-50\\/20{background-color:var(--color-theme-50)}@supports (color:color-mix(in lab,red,red)){.bg-theme-50\\/20{background-color:color-mix(in oklab,var(--color-theme-50)20%,transparent)}}.bg-theme-100,.bg-theme-100\\/70{background-color:var(--color-theme-100)}@supports (color:color-mix(in lab,red,red)){.bg-theme-100\\/70{background-color:color-mix(in oklab,var(--color-theme-100)70%,transparent)}}.bg-theme-200{background-color:var(--color-theme-200)}.bg-theme-300{background-color:var(--color-theme-300)}.bg-theme-500{background-color:var(--color-theme-500)}.bg-theme-600{background-color:var(--color-theme-600)}.bg-theme-700\\/50{background-color:var(--color-theme-700)}@supports (color:color-mix(in lab,red,red)){.bg-theme-700\\/50{background-color:color-mix(in oklab,var(--color-theme-700)50%,transparent)}}.bg-theme-800,.bg-theme-800\\/60{background-color:var(--color-theme-800)}@supports (color:color-mix(in lab,red,red)){.bg-theme-800\\/60{background-color:color-mix(in oklab,var(--color-theme-800)60%,transparent)}}.bg-theme-900{background-color:var(--color-theme-900)}.bg-theme-950\\/20{background-color:var(--color-theme-950)}@supports (color:color-mix(in lab,red,red)){.bg-theme-950\\/20{background-color:color-mix(in oklab,var(--color-theme-950)20%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab,red,red)){.bg-white\\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.bg-white\\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-white\\/15{background-color:#ffffff26}@supports (color:color-mix(in lab,red,red)){.bg-white\\/15{background-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.bg-white\\/50{background-color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.bg-white\\/50{background-color:color-mix(in oklab,var(--color-white)50%,transparent)}}.bg-white\\/70{background-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.bg-white\\/70{background-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.bg-white\\/100{background-color:var(--color-white)}.bg-yellow-50{background-color:var(--color-yellow-50)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-black\\/70{--tw-gradient-from:#000000b3}@supports (color:color-mix(in lab,red,red)){.from-black\\/70{--tw-gradient-from:color-mix(in oklab,var(--color-black)70%,transparent)}}.from-black\\/70{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\\/90{--tw-gradient-from:#000000e6}@supports (color:color-mix(in lab,red,red)){.from-black\\/90{--tw-gradient-from:color-mix(in oklab,var(--color-black)90%,transparent)}}.from-black\\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-blue-50{--tw-gradient-from:var(--color-blue-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-50{--tw-gradient-from:var(--color-purple-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-theme-50\\/40{--tw-gradient-from:var(--color-theme-50)}@supports (color:color-mix(in lab,red,red)){.from-theme-50\\/40{--tw-gradient-from:color-mix(in oklab,var(--color-theme-50)40%,transparent)}}.from-theme-50\\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-theme-100{--tw-gradient-from:var(--color-theme-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-theme-200\\/60{--tw-gradient-from:var(--color-theme-200)}@supports (color:color-mix(in lab,red,red)){.from-theme-200\\/60{--tw-gradient-from:color-mix(in oklab,var(--color-theme-200)60%,transparent)}}.from-theme-200\\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-theme-800{--tw-gradient-from:var(--color-theme-800);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-transparent{--tw-gradient-from:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-black\\/10{--tw-gradient-via:#0000001a}@supports (color:color-mix(in lab,red,red)){.via-black\\/10{--tw-gradient-via:color-mix(in oklab,var(--color-black)10%,transparent)}}.via-black\\/10{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\\/50{--tw-gradient-via:#00000080}@supports (color:color-mix(in lab,red,red)){.via-black\\/50{--tw-gradient-via:color-mix(in oklab,var(--color-black)50%,transparent)}}.via-black\\/50{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\\/90{--tw-gradient-via:#000000e6}@supports (color:color-mix(in lab,red,red)){.via-black\\/90{--tw-gradient-via:color-mix(in oklab,var(--color-black)90%,transparent)}}.via-black\\/90{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-theme-100\\/60{--tw-gradient-via:var(--color-theme-100)}@supports (color:color-mix(in lab,red,red)){.via-theme-100\\/60{--tw-gradient-via:color-mix(in oklab,var(--color-theme-100)60%,transparent)}}.via-theme-100\\/60{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-theme-200{--tw-gradient-via:var(--color-theme-200);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-black\\/40{--tw-gradient-to:#0006}@supports (color:color-mix(in lab,red,red)){.to-black\\/40{--tw-gradient-to:color-mix(in oklab,var(--color-black)40%,transparent)}}.to-black\\/40{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-black\\/80{--tw-gradient-to:#000c}@supports (color:color-mix(in lab,red,red)){.to-black\\/80{--tw-gradient-to:color-mix(in oklab,var(--color-black)80%,transparent)}}.to-black\\/80{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-black\\/100{--tw-gradient-to:var(--color-black);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-indigo-50{--tw-gradient-to:var(--color-indigo-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-pink-50{--tw-gradient-to:var(--color-pink-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-theme-50\\/20{--tw-gradient-to:var(--color-theme-50)}@supports (color:color-mix(in lab,red,red)){.to-theme-50\\/20{--tw-gradient-to:color-mix(in oklab,var(--color-theme-50)20%,transparent)}}.to-theme-50\\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-theme-100{--tw-gradient-to:var(--color-theme-100);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-theme-200\\/60{--tw-gradient-to:var(--color-theme-200)}@supports (color:color-mix(in lab,red,red)){.to-theme-200\\/60{--tw-gradient-to:color-mix(in oklab,var(--color-theme-200)60%,transparent)}}.to-theme-200\\/60{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.to-theme-950{--tw-gradient-to:var(--color-theme-950);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.bg-no-repeat{background-repeat:no-repeat}.fill-orange-500{fill:var(--color-orange-500)}.fill-primary-500{fill:var(--color-primary-500)}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.p-12{padding:calc(var(--spacing)*12)}.p-24{padding:calc(var(--spacing)*24)}.\\!px-1{padding-inline:calc(var(--spacing)*1)!important}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-3\\.5{padding-inline:calc(var(--spacing)*3.5)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.px-9{padding-inline:calc(var(--spacing)*9)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.py-5{padding-block:calc(var(--spacing)*5)}.py-6{padding-block:calc(var(--spacing)*6)}.py-8{padding-block:calc(var(--spacing)*8)}.py-12{padding-block:calc(var(--spacing)*12)}.py-16{padding-block:calc(var(--spacing)*16)}.py-24{padding-block:calc(var(--spacing)*24)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pt-4{padding-top:calc(var(--spacing)*4)}.pt-6{padding-top:calc(var(--spacing)*6)}.pt-8{padding-top:calc(var(--spacing)*8)}.pt-12{padding-top:calc(var(--spacing)*12)}.pt-32{padding-top:calc(var(--spacing)*32)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pb-6{padding-bottom:calc(var(--spacing)*6)}.pb-8{padding-bottom:calc(var(--spacing)*8)}.pb-12{padding-bottom:calc(var(--spacing)*12)}.pb-24{padding-bottom:calc(var(--spacing)*24)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-5{padding-left:calc(var(--spacing)*5)}.pl-10{padding-left:calc(var(--spacing)*10)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.font-serif{font-family:var(--font-serif)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[\\.9em\\]{font-size:.9em}.text-\\[0\\.8em\\]{font-size:.8em}.text-\\[1\\.2em\\]{font-size:1.2em}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-6{--tw-leading:calc(var(--spacing)*6);line-height:calc(var(--spacing)*6)}.leading-\\[1\\.5\\]{--tw-leading:1.5;line-height:1.5}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-light{--tw-font-weight:var(--font-weight-light);font-weight:var(--font-weight-light)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-pretty{text-wrap:pretty}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-500{color:var(--color-amber-500)}.text-amber-600{color:var(--color-amber-600)}.text-amber-700{color:var(--color-amber-700)}.text-black{color:var(--color-black)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-blue-700{color:var(--color-blue-700)}.text-emerald-500{color:var(--color-emerald-500)}.text-emerald-600{color:var(--color-emerald-600)}.text-foreground{color:var(--foreground)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-900{color:var(--color-gray-900)}.text-green-50{color:var(--color-green-50)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-green-900{color:var(--color-green-900)}.text-indigo-50{color:var(--color-indigo-50)}.text-indigo-500{color:var(--color-indigo-500)}.text-indigo-600{color:var(--color-indigo-600)}.text-indigo-900{color:var(--color-indigo-900)}.text-inherit{color:inherit}.text-neutral-400{color:var(--color-neutral-400)}.text-neutral-600{color:var(--color-neutral-600)}.text-orange-50{color:var(--color-orange-50)}.text-orange-500{color:var(--color-orange-500)}.text-orange-600{color:var(--color-orange-600)}.text-orange-600\\/80{color:#f05100cc}@supports (color:color-mix(in lab,red,red)){.text-orange-600\\/80{color:color-mix(in oklab,var(--color-orange-600)80%,transparent)}}.text-orange-900{color:var(--color-orange-900)}.text-primary-0{color:var(--color-primary-0)}.text-primary-300{color:var(--color-primary-300)}.text-primary-400{color:var(--color-primary-400)}.text-primary-500{color:var(--color-primary-500)}.text-primary-600{color:var(--color-primary-600)}.text-primary-700{color:var(--color-primary-700)}.text-primary-800{color:var(--color-primary-800)}.text-purple-600{color:var(--color-purple-600)}.text-purple-700{color:var(--color-purple-700)}.text-red-50{color:var(--color-red-50)}.text-red-400{color:var(--color-red-400)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.text-rose-50{color:var(--color-rose-50)}.text-rose-500{color:var(--color-rose-500)}.text-rose-600{color:var(--color-rose-600)}.text-rose-700{color:var(--color-rose-700)}.text-rose-900{color:var(--color-rose-900)}.text-theme-0{color:var(--color-theme-0)}.text-theme-50{color:var(--color-theme-50)}.text-theme-200{color:var(--color-theme-200)}.text-theme-300{color:var(--color-theme-300)}.text-theme-400{color:var(--color-theme-400)}.text-theme-500{color:var(--color-theme-500)}.text-theme-600,.text-theme-600\\/90{color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.text-theme-600\\/90{color:color-mix(in oklab,var(--color-theme-600)90%,transparent)}}.text-theme-700{color:var(--color-theme-700)}.text-theme-800{color:var(--color-theme-800)}.text-theme-900{color:var(--color-theme-900)}.text-white{color:var(--color-white)}.text-white\\/20{color:#fff3}@supports (color:color-mix(in lab,red,red)){.text-white\\/20{color:color-mix(in oklab,var(--color-white)20%,transparent)}}.text-white\\/40{color:#fff6}@supports (color:color-mix(in lab,red,red)){.text-white\\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\\/50{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.text-white\\/50{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.text-white\\/60{color:#fff9}@supports (color:color-mix(in lab,red,red)){.text-white\\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\\/70{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.text-white\\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\\/80{color:#fffc}@supports (color:color-mix(in lab,red,red)){.text-white\\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\\/90{color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.text-white\\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.text-white\\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\\/95{color:color-mix(in oklab,var(--color-white)95%,transparent)}}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-600{color:var(--color-yellow-600)}.text-yellow-700{color:var(--color-yellow-700)}.text-yellow-800{color:var(--color-yellow-800)}.text-yellow-900{color:var(--color-yellow-900)}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-theme-500::-moz-placeholder{color:var(--color-theme-500)}.placeholder-theme-500::placeholder{color:var(--color-theme-500)}.placeholder-white\\/50::-moz-placeholder{color:#ffffff80}.placeholder-white\\/50::placeholder{color:#ffffff80}@supports (color:color-mix(in lab,red,red)){.placeholder-white\\/50::-moz-placeholder{color:color-mix(in oklab,var(--color-white)50%,transparent)}.placeholder-white\\/50::placeholder{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.caret-primary-500{caret-color:var(--color-primary-500)}.opacity-0{opacity:0}.opacity-25{opacity:.25}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-100{opacity:1}.mix-blend-overlay{mix-blend-mode:overlay}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-black\\/10{--tw-ring-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.ring-black\\/10{--tw-ring-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.ring-gray-200{--tw-ring-color:var(--color-gray-200)}.ring-primary-500{--tw-ring-color:var(--color-primary-500)}.ring-theme-200{--tw-ring-color:var(--color-theme-200)}.ring-theme-300\\/70{--tw-ring-color:var(--color-theme-300)}@supports (color:color-mix(in lab,red,red)){.ring-theme-300\\/70{--tw-ring-color:color-mix(in oklab,var(--color-theme-300)70%,transparent)}}.ring-theme-500{--tw-ring-color:var(--color-theme-500)}.ring-white{--tw-ring-color:var(--color-white)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-75{--tw-duration:75ms;transition-duration:75ms}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-400{--tw-duration:.4s;transition-duration:.4s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.duration-1000{--tw-duration:1s;transition-duration:1s}.duration-\\[400ms\\]{--tw-duration:.4s;transition-duration:.4s}.ease-\\[cubic-bezier\\(0\\.25\\,1\\,0\\.33\\,1\\)\\]{--tw-ease:cubic-bezier(.25,1,.33,1);transition-timing-function:cubic-bezier(.25,1,.33,1)}.ease-\\[cubic-bezier\\(0\\.52\\,0\\.01\\,0\\.16\\,1\\)\\]{--tw-ease:cubic-bezier(.52,.01,.16,1);transition-timing-function:cubic-bezier(.52,.01,.16,1)}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.will-change-auto{will-change:auto}.will-change-transform{will-change:transform}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.\\[-ms-overflow-style\\:none\\]{-ms-overflow-style:none}.\\[image-rendering\\:-webkit-optimize-contrast\\]{image-rendering:-webkit-optimize-contrast}.\\[scrollbar-width\\:none\\]{scrollbar-width:none}.\\[text-shadow\\:_0_0\\.5px_0_rgb\\(0_0_0_\\/_40\\%\\)\\]{text-shadow:0 .5px #0006}.\\[text-shadow\\:_0_1px_1px_rgb\\(255_255_255_\\/_100\\%\\)\\]{text-shadow:0 1px 1px #fff}.ring-inset{--tw-ring-inset:inset}.running{animation-play-state:running}@media (hover:hover){.group-hover\\:max-h-\\[300px\\]:is(:where(.group):hover *){max-height:300px}.group-hover\\:scale-110:is(:where(.group):hover *){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.group-hover\\:text-theme-400:is(:where(.group):hover *){color:var(--color-theme-400)}.group-hover\\:text-theme-600:is(:where(.group):hover *){color:var(--color-theme-600)}.group-hover\\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\\:opacity-40:is(:where(.group):hover *){opacity:.4}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\\:text-gray-400::-moz-placeholder{color:var(--color-gray-400)}.placeholder\\:text-gray-400::placeholder{color:var(--color-gray-400)}.placeholder\\:text-primary-300::-moz-placeholder{color:var(--color-primary-300)}.placeholder\\:text-primary-300::placeholder{color:var(--color-primary-300)}.placeholder\\:text-theme-400::-moz-placeholder{color:var(--color-theme-400)}.placeholder\\:text-theme-400::placeholder{color:var(--color-theme-400)}.placeholder\\:text-white\\/60::-moz-placeholder{color:#fff9}.placeholder\\:text-white\\/60::placeholder{color:#fff9}@supports (color:color-mix(in lab,red,red)){.placeholder\\:text-white\\/60::-moz-placeholder{color:color-mix(in oklab,var(--color-white)60%,transparent)}.placeholder\\:text-white\\/60::placeholder{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.checked\\:border-primary-500:checked{border-color:var(--color-primary-500)}.checked\\:bg-primary-500:checked{background-color:var(--color-primary-500)}.focus-within\\:ring-gray-600:focus-within{--tw-ring-color:var(--color-gray-600)}.focus-within\\:ring-theme-600:focus-within{--tw-ring-color:var(--color-theme-600)}.focus-within\\:outline-none:focus-within{--tw-outline-style:none;outline-style:none}@media (hover:hover){.hover\\:translate-y-\\[-1px\\]:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x)var(--tw-translate-y)}.hover\\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\:scale-110:hover{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\:rotate-90:hover{rotate:90deg}.hover\\:border-l:hover{border-left-style:var(--tw-border-style);border-left-width:1px}.hover\\:border-gray-200:hover{border-color:var(--color-gray-200)}.hover\\:border-gray-300:hover{border-color:var(--color-gray-300)}.hover\\:border-green-200:hover{border-color:var(--color-green-200)}.hover\\:border-green-300:hover{border-color:var(--color-green-300)}.hover\\:border-indigo-200:hover{border-color:var(--color-indigo-200)}.hover\\:border-orange-200:hover{border-color:var(--color-orange-200)}.hover\\:border-primary-200:hover{border-color:var(--color-primary-200)}.hover\\:border-primary-300:hover{border-color:var(--color-primary-300)}.hover\\:border-primary-400:hover{border-color:var(--color-primary-400)}.hover\\:border-red-200:hover{border-color:var(--color-red-200)}.hover\\:border-red-300:hover{border-color:var(--color-red-300)}.hover\\:border-rose-200:hover{border-color:var(--color-rose-200)}.hover\\:border-theme-200:hover{border-color:var(--color-theme-200)}.hover\\:border-theme-300:hover,.hover\\:border-theme-300\\/80:hover{border-color:var(--color-theme-300)}@supports (color:color-mix(in lab,red,red)){.hover\\:border-theme-300\\/80:hover{border-color:color-mix(in oklab,var(--color-theme-300)80%,transparent)}}.hover\\:border-theme-400:hover{border-color:var(--color-theme-400)}.hover\\:border-white\\/40:hover{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.hover\\:border-white\\/40:hover{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.hover\\:border-white\\/80:hover{border-color:#fffc}@supports (color:color-mix(in lab,red,red)){.hover\\:border-white\\/80:hover{border-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.hover\\:border-white\\/90:hover{border-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.hover\\:border-white\\/90:hover{border-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.hover\\:bg-amber-50:hover{background-color:var(--color-amber-50)}.hover\\:bg-black\\/60:hover{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-black\\/60:hover{background-color:color-mix(in oklab,var(--color-black)60%,transparent)}}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-green-200:hover{background-color:var(--color-green-200)}.hover\\:bg-green-500:hover{background-color:var(--color-green-500)}.hover\\:bg-green-500\\/10:hover{background-color:#00c7581a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-green-500\\/10:hover{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.hover\\:bg-green-700:hover{background-color:var(--color-green-700)}.hover\\:bg-indigo-200:hover{background-color:var(--color-indigo-200)}.hover\\:bg-indigo-500\\/10:hover{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-indigo-500\\/10:hover{background-color:color-mix(in oklab,var(--color-indigo-500)10%,transparent)}}.hover\\:bg-indigo-600:hover{background-color:var(--color-indigo-600)}.hover\\:bg-orange-200:hover{background-color:var(--color-orange-200)}.hover\\:bg-orange-500\\/10:hover{background-color:#fe6e001a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-orange-500\\/10:hover{background-color:color-mix(in oklab,var(--color-orange-500)10%,transparent)}}.hover\\:bg-orange-700:hover{background-color:var(--color-orange-700)}.hover\\:bg-primary-100:hover{background-color:var(--color-primary-100)}.hover\\:bg-primary-500:hover,.hover\\:bg-primary-500\\/10:hover{background-color:var(--color-primary-500)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-primary-500\\/10:hover{background-color:color-mix(in oklab,var(--color-primary-500)10%,transparent)}}.hover\\:bg-primary-600:hover{background-color:var(--color-primary-600)}.hover\\:bg-primary-700:hover{background-color:var(--color-primary-700)}.hover\\:bg-red-50:hover{background-color:var(--color-red-50)}.hover\\:bg-red-200:hover{background-color:var(--color-red-200)}.hover\\:bg-red-500:hover{background-color:var(--color-red-500)}.hover\\:bg-red-500\\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-red-500\\/10:hover{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.hover\\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\\:bg-rose-200:hover{background-color:var(--color-rose-200)}.hover\\:bg-rose-500\\/10:hover{background-color:#ff23571a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-rose-500\\/10:hover{background-color:color-mix(in oklab,var(--color-rose-500)10%,transparent)}}.hover\\:bg-rose-600:hover{background-color:var(--color-rose-600)}.hover\\:bg-theme-25:hover,.hover\\:bg-theme-25\\/50:hover{background-color:var(--color-theme-25)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-theme-25\\/50:hover{background-color:color-mix(in oklab,var(--color-theme-25)50%,transparent)}}.hover\\:bg-theme-50:hover,.hover\\:bg-theme-50\\/60:hover{background-color:var(--color-theme-50)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-theme-50\\/60:hover{background-color:color-mix(in oklab,var(--color-theme-50)60%,transparent)}}.hover\\:bg-theme-100:hover{background-color:var(--color-theme-100)}.hover\\:bg-theme-200:hover{background-color:var(--color-theme-200)}.hover\\:bg-theme-500\\/10:hover{background-color:var(--color-theme-500)}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-theme-500\\/10:hover{background-color:color-mix(in oklab,var(--color-theme-500)10%,transparent)}}.hover\\:bg-theme-600:hover{background-color:var(--color-theme-600)}.hover\\:bg-white:hover{background-color:var(--color-white)}.hover\\:bg-white\\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\\:bg-white\\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\\:bg-white\\/70:hover{background-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-white\\/70:hover{background-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.hover\\:from-theme-50\\/60:hover{--tw-gradient-from:var(--color-theme-50)}@supports (color:color-mix(in lab,red,red)){.hover\\:from-theme-50\\/60:hover{--tw-gradient-from:color-mix(in oklab,var(--color-theme-50)60%,transparent)}}.hover\\:from-theme-50\\/60:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\\:to-theme-50\\/40:hover{--tw-gradient-to:var(--color-theme-50)}@supports (color:color-mix(in lab,red,red)){.hover\\:to-theme-50\\/40:hover{--tw-gradient-to:color-mix(in oklab,var(--color-theme-50)40%,transparent)}}.hover\\:to-theme-50\\/40:hover{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.hover\\:pl-2\\.5:hover{padding-left:calc(var(--spacing)*2.5)}.hover\\:text-neutral-600:hover{color:var(--color-neutral-600)}.hover\\:text-primary-600:hover{color:var(--color-primary-600)}.hover\\:text-red-500:hover{color:var(--color-red-500)}.hover\\:text-theme-0:hover{color:var(--color-theme-0)}.hover\\:text-theme-400:hover{color:var(--color-theme-400)}.hover\\:text-theme-500:hover{color:var(--color-theme-500)}.hover\\:text-theme-600:hover{color:var(--color-theme-600)}.hover\\:text-theme-700:hover{color:var(--color-theme-700)}.hover\\:text-theme-800:hover{color:var(--color-theme-800)}.hover\\:text-theme-900:hover{color:var(--color-theme-900)}.hover\\:text-white:hover{color:var(--color-white)}.hover\\:text-white\\/70:hover{color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.hover\\:text-white\\/70:hover{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.hover\\:text-white\\/80:hover{color:#fffc}@supports (color:color-mix(in lab,red,red)){.hover\\:text-white\\/80:hover{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.hover\\:opacity-70:hover{opacity:.7}.hover\\:opacity-100:hover{opacity:1}.hover\\:shadow-2xl:hover{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\:shadow-sm:hover{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\:ring-2:hover{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\:ring-theme-100\\/30:hover{--tw-ring-color:var(--color-theme-100)}@supports (color:color-mix(in lab,red,red)){.hover\\:ring-theme-100\\/30:hover{--tw-ring-color:color-mix(in oklab,var(--color-theme-100)30%,transparent)}}.hover\\:ring-theme-200\\/50:hover{--tw-ring-color:var(--color-theme-200)}@supports (color:color-mix(in lab,red,red)){.hover\\:ring-theme-200\\/50:hover{--tw-ring-color:color-mix(in oklab,var(--color-theme-200)50%,transparent)}}.hover\\:ring-theme-400\\/70:hover{--tw-ring-color:var(--color-theme-400)}@supports (color:color-mix(in lab,red,red)){.hover\\:ring-theme-400\\/70:hover{--tw-ring-color:color-mix(in oklab,var(--color-theme-400)70%,transparent)}}.hover\\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.focus\\:border-0:focus{border-style:var(--tw-border-style);border-width:0}.focus\\:border-primary-500:focus{border-color:var(--color-primary-500)}.focus\\:border-transparent:focus{border-color:#0000}.focus\\:border-white\\/40:focus{border-color:#fff6}@supports (color:color-mix(in lab,red,red)){.focus\\:border-white\\/40:focus{border-color:color-mix(in oklab,var(--color-white)40%,transparent)}}.focus\\:bg-primary-50\\/50:focus{background-color:var(--color-primary-50)}@supports (color:color-mix(in lab,red,red)){.focus\\:bg-primary-50\\/50:focus{background-color:color-mix(in oklab,var(--color-primary-50)50%,transparent)}}.focus\\:bg-theme-200:focus{background-color:var(--color-theme-200)}.focus\\:bg-white:focus{background-color:var(--color-white)}.focus\\:bg-white\\/20:focus{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.focus\\:bg-white\\/20:focus{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.focus\\:caret-primary-500:focus{caret-color:var(--color-primary-500)}.focus\\:ring-0:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-gray-600:focus{--tw-ring-color:var(--color-gray-600)}.focus\\:ring-primary-500:focus{--tw-ring-color:var(--color-primary-500)}.focus\\:ring-primary-600:focus{--tw-ring-color:var(--color-primary-600)}.focus\\:ring-primary-700:focus{--tw-ring-color:var(--color-primary-700)}.focus\\:ring-theme-600:focus{--tw-ring-color:var(--color-theme-600)}.focus\\:ring-white\\/90:focus{--tw-ring-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.focus\\:ring-white\\/90:focus{--tw-ring-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.focus\\:ring-offset-0:focus{--tw-ring-offset-width:0px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus\\:ring-inset:focus{--tw-ring-inset:inset}.focus-visible\\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\\:outline-offset-2:focus-visible{outline-offset:2px}.focus-visible\\:outline-primary-600:focus-visible{outline-color:var(--color-primary-600)}.active\\:-translate-y-0\\.5:active{--tw-translate-y:calc(var(--spacing)*-.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.active\\:scale-90:active{--tw-scale-x:90%;--tw-scale-y:90%;--tw-scale-z:90%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.active\\:scale-\\[1\\.06\\]:active{scale:1.06}.active\\:cursor-grabbing:active{cursor:grabbing}.active\\:bg-primary-500:active{background-color:var(--color-primary-500)}.active\\:bg-theme-800\\/80:active{background-color:var(--color-theme-800)}@supports (color:color-mix(in lab,red,red)){.active\\:bg-theme-800\\/80:active{background-color:color-mix(in oklab,var(--color-theme-800)80%,transparent)}}.active\\:opacity-80:active{opacity:.8}.active\\:duration-100:active{--tw-duration:.1s;transition-duration:.1s}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:opacity-50:disabled{opacity:.5}.disabled\\:opacity-60:disabled{opacity:.6}@media (min-width:40rem){.sm\\:block{display:block}.sm\\:size-16{width:calc(var(--spacing)*16);height:calc(var(--spacing)*16)}.sm\\:h-24{height:calc(var(--spacing)*24)}.sm\\:w-24{width:calc(var(--spacing)*24)}.sm\\:max-w-md{max-width:var(--container-md)}.sm\\:translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\\:translate-x-2{--tw-translate-x:calc(var(--spacing)*2);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\\:translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\\:flex-row{flex-direction:row}.sm\\:items-center{align-items:center}.sm\\:px-0{padding-inline:calc(var(--spacing)*0)}.sm\\:py-20{padding-block:calc(var(--spacing)*20)}.sm\\:py-32{padding-block:calc(var(--spacing)*32)}.sm\\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.sm\\:text-5xl{font-size:var(--text-5xl);line-height:var(--tw-leading,var(--text-5xl--line-height))}.sm\\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}}@media (min-width:48rem){.md\\:static{position:static}.md\\:left-0{left:calc(var(--spacing)*0)}.md\\:block{display:block}.md\\:hidden{display:none}.md\\:h-\\[600px\\]{height:600px}.md\\:w-\\[calc\\(10rem\\+12vw\\)\\]{width:calc(10rem + 12vw)}.md\\:max-w-none{max-width:none}.md\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\\:justify-end{justify-content:flex-end}.md\\:border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.md\\:p-6{padding:calc(var(--spacing)*6)}.md\\:px-6{padding-inline:calc(var(--spacing)*6)}.md\\:px-12{padding-inline:calc(var(--spacing)*12)}.md\\:px-16{padding-inline:calc(var(--spacing)*16)}.md\\:py-8{padding-block:calc(var(--spacing)*8)}.md\\:pr-4{padding-right:calc(var(--spacing)*4)}.md\\:opacity-100{opacity:1}}@media (min-width:64rem){.lg\\:max-w-lg{max-width:var(--container-lg)}.lg\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\\:flex-row{flex-direction:row}.lg\\:p-8{padding:calc(var(--spacing)*8)}.lg\\:px-8{padding-inline:calc(var(--spacing)*8)}.lg\\:px-12{padding-inline:calc(var(--spacing)*12)}.lg\\:py-6{padding-block:calc(var(--spacing)*6)}}@media (min-width:80rem){.xl\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.xl\\:pl-8{padding-left:calc(var(--spacing)*8)}.xl\\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}}@container input (min-width:220px){.\\@\\[220px\\]\\/input\\:block{display:block}.\\@\\[220px\\]\\/input\\:size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.\\@\\[220px\\]\\/input\\:size-12{width:calc(var(--spacing)*12);height:calc(var(--spacing)*12)}.\\@\\[220px\\]\\/input\\:size-14{width:calc(var(--spacing)*14);height:calc(var(--spacing)*14)}.\\@\\[220px\\]\\/input\\:size-16{width:calc(var(--spacing)*16);height:calc(var(--spacing)*16)}.\\@\\[220px\\]\\/input\\:gap-2\\.5{gap:calc(var(--spacing)*2.5)}.\\@\\[220px\\]\\/input\\:text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.\\@\\[220px\\]\\/input\\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.\\@\\[220px\\]\\/input\\:text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.\\@\\[220px\\]\\/input\\:text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}}@container (min-width:400px){.\\@\\[400px\\]\\:flex-row{flex-direction:row}.\\@\\[400px\\]\\:gap-6{gap:calc(var(--spacing)*6)}}@container agent (min-width:480px){.\\@\\[480px\\]\\/agent\\:px-6{padding-inline:calc(var(--spacing)*6)}}@container (min-width:20rem){.\\@xs\\:flex{display:flex}.\\@xs\\:items-center{align-items:center}.\\@xs\\:justify-between{justify-content:space-between}:where(.\\@xs\\:space-x-6>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*6)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-x-reverse)))}}@container (min-width:36rem){.\\@xl\\:size-7{width:calc(var(--spacing)*7);height:calc(var(--spacing)*7)}.\\@xl\\:size-14{width:calc(var(--spacing)*14);height:calc(var(--spacing)*14)}}.dark\\:border-gray-400:where(.dark,.dark *){border-color:var(--color-gray-400)}.dark\\:border-gray-600:where(.dark,.dark *){border-color:var(--color-gray-600)}.dark\\:border-gray-800\\/20:where(.dark,.dark *){border-color:#1e293933}@supports (color:color-mix(in lab,red,red)){.dark\\:border-gray-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-gray-800)20%,transparent)}}.dark\\:border-green-600:where(.dark,.dark *){border-color:var(--color-green-600)}.dark\\:border-green-800:where(.dark,.dark *){border-color:var(--color-green-800)}.dark\\:border-green-800\\/20:where(.dark,.dark *){border-color:#01663033}@supports (color:color-mix(in lab,red,red)){.dark\\:border-green-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-green-800)20%,transparent)}}.dark\\:border-indigo-600:where(.dark,.dark *){border-color:var(--color-indigo-600)}.dark\\:border-indigo-800\\/20:where(.dark,.dark *){border-color:#372aac33}@supports (color:color-mix(in lab,red,red)){.dark\\:border-indigo-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-indigo-800)20%,transparent)}}.dark\\:border-orange-600:where(.dark,.dark *){border-color:var(--color-orange-600)}.dark\\:border-orange-800\\/20:where(.dark,.dark *){border-color:#9f2d0033}@supports (color:color-mix(in lab,red,red)){.dark\\:border-orange-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-orange-800)20%,transparent)}}.dark\\:border-primary-500:where(.dark,.dark *){border-color:var(--color-primary-500)}.dark\\:border-primary-600:where(.dark,.dark *){border-color:var(--color-primary-600)}.dark\\:border-primary-800\\/20:where(.dark,.dark *){border-color:var(--color-primary-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:border-primary-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-primary-800)20%,transparent)}}.dark\\:border-primary-800\\/50:where(.dark,.dark *){border-color:var(--color-primary-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:border-primary-800\\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-primary-800)50%,transparent)}}.dark\\:border-red-600:where(.dark,.dark *){border-color:var(--color-red-600)}.dark\\:border-red-800:where(.dark,.dark *){border-color:var(--color-red-800)}.dark\\:border-red-800\\/20:where(.dark,.dark *){border-color:#9f071233}@supports (color:color-mix(in lab,red,red)){.dark\\:border-red-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-800)20%,transparent)}}.dark\\:border-rose-600:where(.dark,.dark *){border-color:var(--color-rose-600)}.dark\\:border-rose-800\\/20:where(.dark,.dark *){border-color:#a3003733}@supports (color:color-mix(in lab,red,red)){.dark\\:border-rose-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-rose-800)20%,transparent)}}.dark\\:border-slate-600:where(.dark,.dark *){border-color:var(--color-slate-600)}.dark\\:border-theme-400:where(.dark,.dark *){border-color:var(--color-theme-400)}.dark\\:border-theme-500:where(.dark,.dark *){border-color:var(--color-theme-500)}.dark\\:border-theme-600:where(.dark,.dark *),.dark\\:border-theme-600\\/50:where(.dark,.dark *){border-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:border-theme-600\\/50:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-theme-600)50%,transparent)}}.dark\\:border-theme-600\\/70:where(.dark,.dark *){border-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:border-theme-600\\/70:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-theme-600)70%,transparent)}}.dark\\:border-theme-700:where(.dark,.dark *),.dark\\:border-theme-700\\/70:where(.dark,.dark *){border-color:var(--color-theme-700)}@supports (color:color-mix(in lab,red,red)){.dark\\:border-theme-700\\/70:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-theme-700)70%,transparent)}}.dark\\:border-theme-800\\/20:where(.dark,.dark *){border-color:var(--color-theme-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:border-theme-800\\/20:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-theme-800)20%,transparent)}}.dark\\:bg-gray-600\\/30:where(.dark,.dark *){background-color:#4a55654d}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-gray-600\\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-600)30%,transparent)}}.dark\\:bg-gray-700\\/40:where(.dark,.dark *){background-color:#36415366}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-gray-700\\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-700)40%,transparent)}}.dark\\:bg-gray-800\\/50:where(.dark,.dark *){background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-gray-800\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.dark\\:bg-green-700\\/70:where(.dark,.dark *){background-color:#008138b3}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-green-700\\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-700)70%,transparent)}}.dark\\:bg-green-800\\/20:where(.dark,.dark *){background-color:#01663033}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-green-800\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-800)20%,transparent)}}.dark\\:bg-green-900\\/20:where(.dark,.dark *){background-color:#0d542b33}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-green-900\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-900)20%,transparent)}}.dark\\:bg-indigo-700\\/70:where(.dark,.dark *){background-color:#432dd7b3}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-indigo-700\\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-700)70%,transparent)}}.dark\\:bg-indigo-800\\/20:where(.dark,.dark *){background-color:#372aac33}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-indigo-800\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-800)20%,transparent)}}.dark\\:bg-orange-700\\/70:where(.dark,.dark *){background-color:#c53c00b3}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-orange-700\\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-700)70%,transparent)}}.dark\\:bg-orange-800\\/20:where(.dark,.dark *){background-color:#9f2d0033}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-orange-800\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-800)20%,transparent)}}.dark\\:bg-primary-500:where(.dark,.dark *){background-color:var(--color-primary-500)}.dark\\:bg-primary-700\\/50:where(.dark,.dark *){background-color:var(--color-primary-700)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-primary-700\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-primary-700)50%,transparent)}}.dark\\:bg-primary-700\\/70:where(.dark,.dark *){background-color:var(--color-primary-700)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-primary-700\\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-primary-700)70%,transparent)}}.dark\\:bg-primary-800\\/20:where(.dark,.dark *){background-color:var(--color-primary-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-primary-800\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-primary-800)20%,transparent)}}.dark\\:bg-primary-800\\/40:where(.dark,.dark *){background-color:var(--color-primary-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-primary-800\\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-primary-800)40%,transparent)}}.dark\\:bg-primary-900\\/20:where(.dark,.dark *){background-color:var(--color-primary-900)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-primary-900\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-primary-900)20%,transparent)}}.dark\\:bg-primary-950\\/20:where(.dark,.dark *){background-color:var(--color-primary-950)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-primary-950\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-primary-950)20%,transparent)}}.dark\\:bg-primary-950\\/50:where(.dark,.dark *){background-color:var(--color-primary-950)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-primary-950\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-primary-950)50%,transparent)}}.dark\\:bg-red-700\\/70:where(.dark,.dark *){background-color:#bf000fb3}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-red-700\\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-700)70%,transparent)}}.dark\\:bg-red-800\\/20:where(.dark,.dark *){background-color:#9f071233}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-red-800\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-800)20%,transparent)}}.dark\\:bg-red-900\\/20:where(.dark,.dark *){background-color:#82181a33}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-red-900\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-900)20%,transparent)}}.dark\\:bg-rose-700\\/70:where(.dark,.dark *){background-color:#c20039b3}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-rose-700\\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-rose-700)70%,transparent)}}.dark\\:bg-rose-800\\/20:where(.dark,.dark *){background-color:#a3003733}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-rose-800\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-rose-800)20%,transparent)}}.dark\\:bg-rose-900\\/30:where(.dark,.dark *){background-color:#8b08364d}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-rose-900\\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-rose-900)30%,transparent)}}.dark\\:bg-slate-800:where(.dark,.dark *){background-color:var(--color-slate-800)}.dark\\:bg-theme-600:where(.dark,.dark *),.dark\\:bg-theme-600\\/30:where(.dark,.dark *){background-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-600\\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-600)30%,transparent)}}.dark\\:bg-theme-600\\/50:where(.dark,.dark *){background-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-600\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-600)50%,transparent)}}.dark\\:bg-theme-600\\/70:where(.dark,.dark *){background-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-600\\/70:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-600)70%,transparent)}}.dark\\:bg-theme-600\\/90:where(.dark,.dark *){background-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-600\\/90:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-600)90%,transparent)}}.dark\\:bg-theme-700:where(.dark,.dark *),.dark\\:bg-theme-700\\/40:where(.dark,.dark *){background-color:var(--color-theme-700)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-700\\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-700)40%,transparent)}}.dark\\:bg-theme-800:where(.dark,.dark *),.dark\\:bg-theme-800\\/50:where(.dark,.dark *){background-color:var(--color-theme-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-800\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-800)50%,transparent)}}.dark\\:bg-theme-800\\/90:where(.dark,.dark *){background-color:var(--color-theme-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-800\\/90:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-800)90%,transparent)}}.dark\\:bg-theme-900:where(.dark,.dark *),.dark\\:bg-theme-900\\/40:where(.dark,.dark *){background-color:var(--color-theme-900)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-900\\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-900)40%,transparent)}}.dark\\:bg-theme-900\\/50:where(.dark,.dark *){background-color:var(--color-theme-900)}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-theme-900\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-theme-900)50%,transparent)}}.dark\\:text-gray-50:where(.dark,.dark *){color:var(--color-gray-50)}.dark\\:text-gray-100:where(.dark,.dark *){color:var(--color-gray-100)}.dark\\:text-gray-300:where(.dark,.dark *){color:var(--color-gray-300)}.dark\\:text-gray-400:where(.dark,.dark *){color:var(--color-gray-400)}.dark\\:text-gray-500:where(.dark,.dark *){color:var(--color-gray-500)}.dark\\:text-green-50:where(.dark,.dark *){color:var(--color-green-50)}.dark\\:text-green-100:where(.dark,.dark *){color:var(--color-green-100)}.dark\\:text-green-400:where(.dark,.dark *){color:var(--color-green-400)}.dark\\:text-green-500:where(.dark,.dark *){color:var(--color-green-500)}.dark\\:text-indigo-50:where(.dark,.dark *){color:var(--color-indigo-50)}.dark\\:text-indigo-100:where(.dark,.dark *){color:var(--color-indigo-100)}.dark\\:text-indigo-400:where(.dark,.dark *){color:var(--color-indigo-400)}.dark\\:text-indigo-500:where(.dark,.dark *){color:var(--color-indigo-500)}.dark\\:text-orange-50:where(.dark,.dark *){color:var(--color-orange-50)}.dark\\:text-orange-100:where(.dark,.dark *){color:var(--color-orange-100)}.dark\\:text-orange-400:where(.dark,.dark *){color:var(--color-orange-400)}.dark\\:text-orange-500:where(.dark,.dark *){color:var(--color-orange-500)}.dark\\:text-primary-0:where(.dark,.dark *){color:var(--color-primary-0)}.dark\\:text-primary-50:where(.dark,.dark *){color:var(--color-primary-50)}.dark\\:text-primary-100:where(.dark,.dark *){color:var(--color-primary-100)}.dark\\:text-primary-200:where(.dark,.dark *){color:var(--color-primary-200)}.dark\\:text-primary-400:where(.dark,.dark *){color:var(--color-primary-400)}.dark\\:text-primary-500:where(.dark,.dark *){color:var(--color-primary-500)}.dark\\:text-red-50:where(.dark,.dark *){color:var(--color-red-50)}.dark\\:text-red-100:where(.dark,.dark *){color:var(--color-red-100)}.dark\\:text-red-400:where(.dark,.dark *){color:var(--color-red-400)}.dark\\:text-red-500:where(.dark,.dark *){color:var(--color-red-500)}.dark\\:text-rose-50:where(.dark,.dark *){color:var(--color-rose-50)}.dark\\:text-rose-100:where(.dark,.dark *){color:var(--color-rose-100)}.dark\\:text-rose-400:where(.dark,.dark *){color:var(--color-rose-400)}.dark\\:text-rose-500:where(.dark,.dark *){color:var(--color-rose-500)}.dark\\:text-theme-0:where(.dark,.dark *){color:var(--color-theme-0)}.dark\\:text-theme-50:where(.dark,.dark *){color:var(--color-theme-50)}.dark\\:text-theme-100:where(.dark,.dark *){color:var(--color-theme-100)}.dark\\:text-theme-200:where(.dark,.dark *){color:var(--color-theme-200)}.dark\\:text-theme-300:where(.dark,.dark *){color:var(--color-theme-300)}.dark\\:text-theme-400:where(.dark,.dark *){color:var(--color-theme-400)}.dark\\:text-theme-500:where(.dark,.dark *){color:var(--color-theme-500)}.dark\\:text-theme-600:where(.dark,.dark *){color:var(--color-theme-600)}.dark\\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\\:ring-gray-600\\/70:where(.dark,.dark *){--tw-ring-color:#4a5565b3}@supports (color:color-mix(in lab,red,red)){.dark\\:ring-gray-600\\/70:where(.dark,.dark *){--tw-ring-color:color-mix(in oklab,var(--color-gray-600)70%,transparent)}}.dark\\:ring-primary-600\\/70:where(.dark,.dark *){--tw-ring-color:var(--color-primary-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:ring-primary-600\\/70:where(.dark,.dark *){--tw-ring-color:color-mix(in oklab,var(--color-primary-600)70%,transparent)}}.dark\\:ring-theme-500\\/70:where(.dark,.dark *){--tw-ring-color:var(--color-theme-500)}@supports (color:color-mix(in lab,red,red)){.dark\\:ring-theme-500\\/70:where(.dark,.dark *){--tw-ring-color:color-mix(in oklab,var(--color-theme-500)70%,transparent)}}.dark\\:ring-theme-600:where(.dark,.dark *),.dark\\:ring-theme-600\\/70:where(.dark,.dark *){--tw-ring-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:ring-theme-600\\/70:where(.dark,.dark *){--tw-ring-color:color-mix(in oklab,var(--color-theme-600)70%,transparent)}}@media (hover:hover){.dark\\:group-hover\\:text-theme-50:where(.dark,.dark *):is(:where(.group):hover *){color:var(--color-theme-50)}}.dark\\:placeholder\\:text-gray-500:where(.dark,.dark *)::-moz-placeholder{color:var(--color-gray-500)}.dark\\:placeholder\\:text-gray-500:where(.dark,.dark *)::placeholder{color:var(--color-gray-500)}.dark\\:placeholder\\:text-primary-600:where(.dark,.dark *)::-moz-placeholder{color:var(--color-primary-600)}.dark\\:placeholder\\:text-primary-600:where(.dark,.dark *)::placeholder{color:var(--color-primary-600)}.dark\\:placeholder\\:text-theme-500:where(.dark,.dark *)::-moz-placeholder{color:var(--color-theme-500)}.dark\\:placeholder\\:text-theme-500:where(.dark,.dark *)::placeholder{color:var(--color-theme-500)}.dark\\:checked\\:border-primary-600:where(.dark,.dark *):checked{border-color:var(--color-primary-600)}.dark\\:checked\\:bg-primary-700:where(.dark,.dark *):checked{background-color:var(--color-primary-700)}.dark\\:focus-within\\:ring-gray-500:where(.dark,.dark *):focus-within{--tw-ring-color:var(--color-gray-500)}.dark\\:focus-within\\:ring-theme-500:where(.dark,.dark *):focus-within{--tw-ring-color:var(--color-theme-500)}@media (hover:hover){.dark\\:hover\\:border-gray-500:where(.dark,.dark *):hover{border-color:var(--color-gray-500)}.dark\\:hover\\:border-gray-600:where(.dark,.dark *):hover{border-color:var(--color-gray-600)}.dark\\:hover\\:border-green-700:where(.dark,.dark *):hover{border-color:var(--color-green-700)}.dark\\:hover\\:border-indigo-700:where(.dark,.dark *):hover{border-color:var(--color-indigo-700)}.dark\\:hover\\:border-orange-700:where(.dark,.dark *):hover{border-color:var(--color-orange-700)}.dark\\:hover\\:border-primary-700:where(.dark,.dark *):hover{border-color:var(--color-primary-700)}.dark\\:hover\\:border-red-700:where(.dark,.dark *):hover{border-color:var(--color-red-700)}.dark\\:hover\\:border-rose-700:where(.dark,.dark *):hover{border-color:var(--color-rose-700)}.dark\\:hover\\:border-theme-500:where(.dark,.dark *):hover{border-color:var(--color-theme-500)}.dark\\:hover\\:border-theme-600:where(.dark,.dark *):hover{border-color:var(--color-theme-600)}.dark\\:hover\\:bg-gray-600\\/50:where(.dark,.dark *):hover{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-gray-600\\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.dark\\:hover\\:bg-green-400\\/10:where(.dark,.dark *):hover{background-color:#05df721a}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-green-400\\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-green-400)10%,transparent)}}.dark\\:hover\\:bg-green-800:where(.dark,.dark *):hover{background-color:var(--color-green-800)}.dark\\:hover\\:bg-green-800\\/40:where(.dark,.dark *):hover{background-color:#01663066}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-green-800\\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-green-800)40%,transparent)}}.dark\\:hover\\:bg-indigo-400\\/10:where(.dark,.dark *):hover{background-color:#7d87ff1a}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-indigo-400\\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-indigo-400)10%,transparent)}}.dark\\:hover\\:bg-indigo-800:where(.dark,.dark *):hover{background-color:var(--color-indigo-800)}.dark\\:hover\\:bg-indigo-800\\/40:where(.dark,.dark *):hover{background-color:#372aac66}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-indigo-800\\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-indigo-800)40%,transparent)}}.dark\\:hover\\:bg-orange-400\\/10:where(.dark,.dark *):hover{background-color:#ff8b1a1a}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-orange-400\\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-orange-400)10%,transparent)}}.dark\\:hover\\:bg-orange-800:where(.dark,.dark *):hover{background-color:var(--color-orange-800)}.dark\\:hover\\:bg-orange-800\\/40:where(.dark,.dark *):hover{background-color:#9f2d0066}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-orange-800\\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-orange-800)40%,transparent)}}.dark\\:hover\\:bg-primary-500\\/20:where(.dark,.dark *):hover{background-color:var(--color-primary-500)}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-primary-500\\/20:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-primary-500)20%,transparent)}}.dark\\:hover\\:bg-primary-800:where(.dark,.dark *):hover,.dark\\:hover\\:bg-primary-800\\/60:where(.dark,.dark *):hover{background-color:var(--color-primary-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-primary-800\\/60:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-primary-800)60%,transparent)}}.dark\\:hover\\:bg-primary-900\\/50:where(.dark,.dark *):hover{background-color:var(--color-primary-900)}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-primary-900\\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-primary-900)50%,transparent)}}.dark\\:hover\\:bg-red-400\\/10:where(.dark,.dark *):hover{background-color:#ff65681a}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-red-400\\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-400)10%,transparent)}}.dark\\:hover\\:bg-red-800:where(.dark,.dark *):hover{background-color:var(--color-red-800)}.dark\\:hover\\:bg-red-800\\/40:where(.dark,.dark *):hover{background-color:#9f071266}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-red-800\\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-red-800)40%,transparent)}}.dark\\:hover\\:bg-rose-400\\/10:where(.dark,.dark *):hover{background-color:#ff667f1a}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-rose-400\\/10:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-rose-400)10%,transparent)}}.dark\\:hover\\:bg-rose-800:where(.dark,.dark *):hover{background-color:var(--color-rose-800)}.dark\\:hover\\:bg-rose-800\\/40:where(.dark,.dark *):hover{background-color:#a3003766}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-rose-800\\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-rose-800)40%,transparent)}}.dark\\:hover\\:bg-theme-400\\/20:where(.dark,.dark *):hover{background-color:var(--color-theme-400)}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-theme-400\\/20:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-theme-400)20%,transparent)}}.dark\\:hover\\:bg-theme-600:where(.dark,.dark *):hover,.dark\\:hover\\:bg-theme-600\\/40:where(.dark,.dark *):hover{background-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-theme-600\\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-theme-600)40%,transparent)}}.dark\\:hover\\:bg-theme-600\\/50:where(.dark,.dark *):hover{background-color:var(--color-theme-600)}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-theme-600\\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-theme-600)50%,transparent)}}.dark\\:hover\\:bg-theme-700:where(.dark,.dark *):hover{background-color:var(--color-theme-700)}.dark\\:hover\\:bg-theme-800:where(.dark,.dark *):hover{background-color:var(--color-theme-800)}.dark\\:hover\\:text-theme-0:where(.dark,.dark *):hover{color:var(--color-theme-0)}.dark\\:hover\\:text-theme-50:where(.dark,.dark *):hover{color:var(--color-theme-50)}.dark\\:hover\\:text-theme-300:where(.dark,.dark *):hover{color:var(--color-theme-300)}.dark\\:hover\\:ring-theme-400\\/70:where(.dark,.dark *):hover{--tw-ring-color:var(--color-theme-400)}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:ring-theme-400\\/70:where(.dark,.dark *):hover{--tw-ring-color:color-mix(in oklab,var(--color-theme-400)70%,transparent)}}.dark\\:hover\\:ring-theme-500:where(.dark,.dark *):hover{--tw-ring-color:var(--color-theme-500)}.dark\\:hover\\:ring-theme-600:where(.dark,.dark *):hover{--tw-ring-color:var(--color-theme-600)}}.dark\\:focus\\:bg-gray-800:where(.dark,.dark *):focus{background-color:var(--color-gray-800)}.dark\\:focus\\:bg-primary-800\\/40:where(.dark,.dark *):focus{background-color:var(--color-primary-800)}@supports (color:color-mix(in lab,red,red)){.dark\\:focus\\:bg-primary-800\\/40:where(.dark,.dark *):focus{background-color:color-mix(in oklab,var(--color-primary-800)40%,transparent)}}.dark\\:focus\\:bg-theme-800:where(.dark,.dark *):focus{background-color:var(--color-theme-800)}.dark\\:focus\\:bg-theme-900\\/50:where(.dark,.dark *):focus{background-color:var(--color-theme-900)}@supports (color:color-mix(in lab,red,red)){.dark\\:focus\\:bg-theme-900\\/50:where(.dark,.dark *):focus{background-color:color-mix(in oklab,var(--color-theme-900)50%,transparent)}}.dark\\:focus\\:ring-gray-500:where(.dark,.dark *):focus{--tw-ring-color:var(--color-gray-500)}.dark\\:focus\\:ring-primary-400:where(.dark,.dark *):focus{--tw-ring-color:var(--color-primary-400)}.dark\\:focus\\:ring-primary-600:where(.dark,.dark *):focus{--tw-ring-color:var(--color-primary-600)}.dark\\:focus\\:ring-theme-500:where(.dark,.dark *):focus{--tw-ring-color:var(--color-theme-500)}.dark\\:focus\\:ring-white\\/70:where(.dark,.dark *):focus{--tw-ring-color:#ffffffb3}@supports (color:color-mix(in lab,red,red)){.dark\\:focus\\:ring-white\\/70:where(.dark,.dark *):focus{--tw-ring-color:color-mix(in oklab,var(--color-white)70%,transparent)}}.dark\\:active\\:bg-primary-700:where(.dark,.dark *):active{background-color:var(--color-primary-700)}.\\[\\&\\:\\:-webkit-scrollbar\\]\\:hidden::-webkit-scrollbar{display:none}}@property --tw-animation-delay{syntax:\"*\";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:\"*\";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:\"*\";inherits:false}@property --tw-animation-fill-mode{syntax:\"*\";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:\"*\";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:\"*\";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:\"*\";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:\"*\";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:\"*\";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:\"*\";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:\"*\";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:\"*\";inherits:false;initial-value:0}:root{--radius:.625rem;--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--muted:oklch(97% 0 0);--accent:oklch(97% 0 0);--border:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--primary:oklch(50% .17 260);--primary-foreground:oklch(100% 0 0)}.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--accent:oklch(26.9% 0 0);--border:oklch(100% 0 0/.1);--ring:oklch(55.6% 0 0);--primary:oklch(60% .17 260);--primary-foreground:oklch(100% 0 0)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}:root{--shadow-color:220deg 60% 50%}.shadow-elevated{box-shadow:.5px 1px 1px hsl(var(--shadow-color)/.075),1px 2px 2px hsl(var(--shadow-color)/.075),2px 4px 4px hsl(var(--shadow-color)/.075),4px 8px 8px hsl(var(--shadow-color)/.075)}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-scale-x{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-y{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-z{syntax:\"*\";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:\"*\";inherits:false}@property --tw-rotate-y{syntax:\"*\";inherits:false}@property --tw-rotate-z{syntax:\"*\";inherits:false}@property --tw-skew-x{syntax:\"*\";inherits:false}@property --tw-skew-y{syntax:\"*\";inherits:false}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:\"*\";inherits:false}@property --tw-gradient-from{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:\"*\";inherits:false}@property --tw-gradient-via-stops{syntax:\"*\";inherits:false}@property --tw-gradient-from-position{syntax:\"<length-percentage>\";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:\"<length-percentage>\";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:\"<length-percentage>\";inherits:false;initial-value:100%}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-tracking{syntax:\"*\";inherits:false}@property --tw-ordinal{syntax:\"*\";inherits:false}@property --tw-slashed-zero{syntax:\"*\";inherits:false}@property --tw-numeric-figure{syntax:\"*\";inherits:false}@property --tw-numeric-spacing{syntax:\"*\";inherits:false}@property --tw-numeric-fraction{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-blur{syntax:\"*\";inherits:false}@property --tw-brightness{syntax:\"*\";inherits:false}@property --tw-contrast{syntax:\"*\";inherits:false}@property --tw-grayscale{syntax:\"*\";inherits:false}@property --tw-hue-rotate{syntax:\"*\";inherits:false}@property --tw-invert{syntax:\"*\";inherits:false}@property --tw-opacity{syntax:\"*\";inherits:false}@property --tw-saturate{syntax:\"*\";inherits:false}@property --tw-sepia{syntax:\"*\";inherits:false}@property --tw-drop-shadow{syntax:\"*\";inherits:false}@property --tw-drop-shadow-color{syntax:\"*\";inherits:false}@property --tw-drop-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:\"*\";inherits:false}@property --tw-backdrop-blur{syntax:\"*\";inherits:false}@property --tw-backdrop-brightness{syntax:\"*\";inherits:false}@property --tw-backdrop-contrast{syntax:\"*\";inherits:false}@property --tw-backdrop-grayscale{syntax:\"*\";inherits:false}@property --tw-backdrop-hue-rotate{syntax:\"*\";inherits:false}@property --tw-backdrop-invert{syntax:\"*\";inherits:false}@property --tw-backdrop-opacity{syntax:\"*\";inherits:false}@property --tw-backdrop-saturate{syntax:\"*\";inherits:false}@property --tw-backdrop-sepia{syntax:\"*\";inherits:false}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}.ring-circular{animation:rotate 1s linear infinite}.ring-path{will-change:stroke-dasharray;will-change:stroke-dashoffset;stroke-dasharray:1,200;stroke-dashoffset:0;stroke-linecap:round;animation:dash 2s ease-in-out infinite}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}.nlist-enter-active,.nlist-leave-active,.nlist-move{transition:all .6s cubic-bezier(.68,-.55,.27,1.55)}.nlist-enter-from{opacity:0;transform:translate(-30px) scale(.9)}.nlist-enter-to{opacity:1;transform:translate(0) scale(1)}.nlist-leave-active{position:absolute}.nlist-leave-to{opacity:0;transform:scale(.9)}",this.shadowRoot.appendChild(r);const i=document.createElement("div");i.id="fiction-widget-root",this.shadowRoot.appendChild(i);const n="undefined"!=typeof window&&("localhost"===window.location.hostname||window.location.hostname.includes("127.0.0.1")),o=new Za({isDev:n,apiBase:this.config.apiBase});this.config.handle,this.config.apiBase,"undefined"!=typeof window&&window.location.hostname,this.app=((...e)=>{const t=(ua||(ua=Wi(da))).createApp(...e),{mount:r}=t;return t.mount=e=>{const i=function(e){return B(e)?document.querySelector(e):e}(e);if(!i)return;const n=t._component;F(n)||n.render||n.template||(n.template=i.innerHTML),1===i.nodeType&&(i.textContent="");const o=r(i,!1,function(e){return e instanceof SVGElement?"svg":"function"==typeof MathMLElement&&e instanceof MathMLElement?"mathml":void 0}(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},t})(eT,{sdk:o,handle:this.config.handle,context:this.config.context,firstMessage:this.config.firstMessage,position:this.config.position||"bottom-right"}),this.widgetInstance=this.app.mount(i),document.body.appendChild(this.container)}getPositionStyles(e){switch(e){case"bottom-left":return"bottom: 24px; left: 24px;";case"top-right":return"top: 24px; right: 24px;";case"top-left":return"top: 24px; left: 24px;";default:return"bottom: 24px; right: 24px;"}}toggle(){this.widgetInstance?.toggle()}open(){this.widgetInstance?.open()}close(){this.widgetInstance?.close()}destroy(){this.app&&(this.app.unmount(),this.app=null),this.container&&(this.container.remove(),this.container=null),this.shadowRoot=null,this.widgetInstance=null,e.instances.delete(this.config.handle),this.config.handle}static destroyAll(){e.instances.forEach(e=>e.destroy()),e.instances.clear()}static getInstance(t){return e.instances.get(t)}};r(tT,"instances",new Map);let rT=tT;class iT extends HTMLElement{constructor(){super(...arguments),r(this,"widget",null)}connectedCallback(){const e=this.getAttribute("handle"),t=this.getAttribute("context"),r=this.getAttribute("first-message"),i=this.getAttribute("position"),n=this.getAttribute("api-base");e&&(this.widget=new rT({handle:e,context:t||void 0,firstMessage:r||void 0,position:i||void 0,apiBase:n||void 0}),window[`openFictionSelf_${e}`]=()=>{this.widget?.open()})}disconnectedCallback(){this.widget?.destroy()}}if("undefined"==typeof window||customElements.get("fiction-self")||customElements.define("fiction-self",iT),"undefined"!=typeof window){window.FictionWidget=rT;const e=()=>{document.querySelectorAll("fiction-self").forEach(e=>{e.getAttribute("handle")})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}var nT=Object.defineProperty,oT=(e,t)=>nT(e,"name",{value:t,configurable:!0});const aT=oT((e=0)=>t=>`\x1b[${t+e}m`,"wrapAnsi16"),sT=oT((e=0)=>t=>`\x1b[${38+e};5;${t}m`,"wrapAnsi256"),lT=oT((e=0)=>(t,r,i)=>`\x1b[${38+e};2;${t};${r};${i}m`,"wrapAnsi16m"),cT={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},dT=Object.keys(cT.modifier),uT=Object.keys(cT.color),hT=Object.keys(cT.bgColor),pT=[...uT,...hT];function mT(){const e=new Map;for(const[t,r]of Object.entries(cT)){for(const[t,i]of Object.entries(r))cT[t]={open:`\x1b[${i[0]}m`,close:`\x1b[${i[1]}m`},r[t]=cT[t],e.set(i[0],i[1]);Object.defineProperty(cT,t,{value:r,enumerable:!1})}return Object.defineProperty(cT,"codes",{value:e,enumerable:!1}),cT.color.close="\x1b[39m",cT.bgColor.close="\x1b[49m",cT.color.ansi=aT(),cT.color.ansi256=sT(),cT.color.ansi16m=lT(),cT.bgColor.ansi=aT(10),cT.bgColor.ansi256=sT(10),cT.bgColor.ansi16m=lT(10),Object.defineProperties(cT,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map(e=>e+e).join(""));const i=Number.parseInt(r,16);return[i>>16&255,i>>8&255,255&i]},enumerable:!1},hexToAnsi256:{value:oT(e=>cT.rgbToAnsi256(...cT.hexToRgb(e)),"value"),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,i;if(e>=232)t=(10*(e-232)+8)/255,r=t,i=t;else{const n=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(n/6)/5,i=n%6/5}const n=2*Math.max(t,r,i);if(0===n)return 30;let o=30+(Math.round(i)<<2|Math.round(r)<<1|Math.round(t));return 2===n&&(o+=60),o},enumerable:!1},rgbToAnsi:{value:oT((e,t,r)=>cT.ansi256ToAnsi(cT.rgbToAnsi256(e,t,r)),"value"),enumerable:!1},hexToAnsi:{value:oT(e=>cT.ansi256ToAnsi(cT.hexToAnsi256(e)),"value"),enumerable:!1}}),cT}oT(mT,"assembleStyles");const gT=mT(),vT=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),fT=0!==vT&&{level:vT,hasBasic:!0,has256:vT>=2,has16m:vT>=3},kT={stdout:fT,stderr:fT};function bT(e,t,r){let i=e.indexOf(t);if(-1===i)return e;const n=t.length;let o=0,a="";do{a+=e.slice(o,i)+t+r,o=i+n,i=e.indexOf(t,o)}while(-1!==i);return a+=e.slice(o),a}function wT(e,t,r,i){let n=0,o="";do{const a="\r"===e[i-1];o+=e.slice(n,a?i-1:i)+t+(a?"\r\n":"\n")+r,n=i+1,i=e.indexOf("\n",n)}while(-1!==i);return o+=e.slice(n),o}oT(bT,"stringReplaceAll"),oT(wT,"stringEncaseCRLFWithFirstIndex");const{stdout:yT,stderr:xT}=kT,CT=Symbol("GENERATOR"),ST=Symbol("STYLER"),TT=Symbol("IS_EMPTY"),ET=["ansi","ansi","ansi256","ansi16m"],_T=Object.create(null),IT=oT((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=yT?yT.level:0;e.level=void 0===t.level?r:t.level},"applyOptions"),PT=class{constructor(e){return AT(e)}};oT(PT,"Chalk");let MT=PT;const AT=oT(e=>{const t=oT((...e)=>e.join(" "),"chalk");return IT(t,e),Object.setPrototypeOf(t,RT.prototype),t},"chalkFactory");function RT(e){return AT(e)}oT(RT,"createChalk"),Object.setPrototypeOf(RT.prototype,Function.prototype);for(const[qT,$T]of Object.entries(gT))_T[qT]={get(){const e=zT(this,NT($T.open,$T.close,this[ST]),this[TT]);return Object.defineProperty(this,qT,{value:e}),e}};_T.visible={get(){const e=zT(this,this[ST],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const OT=oT((e,t,r,...i)=>"rgb"===e?"ansi16m"===t?gT[r].ansi16m(...i):"ansi256"===t?gT[r].ansi256(gT.rgbToAnsi256(...i)):gT[r].ansi(gT.rgbToAnsi(...i)):"hex"===e?OT("rgb",t,r,...gT.hexToRgb(...i)):gT[r][e](...i),"getModelAnsi"),DT=["rgb","hex","ansi256"];for(const qT of DT)_T[qT]={get(){const{level:e}=this;return function(...t){const r=NT(OT(qT,ET[e],"color",...t),gT.color.close,this[ST]);return zT(this,r,this[TT])}}},_T["bg"+qT[0].toUpperCase()+qT.slice(1)]={get(){const{level:e}=this;return function(...t){const r=NT(OT(qT,ET[e],"bgColor",...t),gT.bgColor.close,this[ST]);return zT(this,r,this[TT])}}};const LT=Object.defineProperties(()=>{},{..._T,level:{enumerable:!0,get(){return this[CT].level},set(e){this[CT].level=e}}}),NT=oT((e,t,r)=>{let i,n;return void 0===r?(i=e,n=t):(i=r.openAll+e,n=t+r.closeAll),{open:e,close:t,openAll:i,closeAll:n,parent:r}},"createStyler"),zT=oT((e,t,r)=>{const i=oT((...e)=>jT(i,1===e.length?""+e[0]:e.join(" ")),"builder");return Object.setPrototypeOf(i,LT),i[CT]=e,i[ST]=t,i[TT]=r,i},"createBuilder"),jT=oT((e,t)=>{if(e.level<=0||!t)return e[TT]?"":t;let r=e[ST];if(void 0===r)return t;const{openAll:i,closeAll:n}=r;if(t.includes("\x1b"))for(;void 0!==r;)t=bT(t,r.close,r.open),r=r.parent;const o=t.indexOf("\n");return-1!==o&&(t=wT(t,n,i,o)),i+t+n},"applyStyle");Object.defineProperties(RT.prototype,_T);const UT=RT(),FT=RT({level:xT?xT.level:0}),BT=Object.freeze(Object.defineProperty({__proto__:null,Chalk:MT,backgroundColorNames:hT,backgroundColors:hT,chalkStderr:FT,colorNames:pT,colors:pT,default:UT,foregroundColorNames:uT,foregroundColors:uT,modifierNames:dT,modifiers:dT,supportsColor:yT,supportsColorStderr:xT},Symbol.toStringTag,{value:"Module"}));return e.FictionWidget=rT,e.default=rT,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),e}({});
1
+ var FictionWidget=function(e){"use strict";var t=Object.defineProperty,n=(e,n,i)=>((e,n,i)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[n]=i)(e,"symbol"!=typeof n?n+"":n,i),i=Object.defineProperty,o=(e,t,n)=>((e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const r=e=>"symbol"==typeof e;let s;const a=()=>s||(s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(r)),a().requestIdleCallback,a().cancelIdleCallback;{const e=a(),t=(t,n)=>{let i;return(i=e[t])||(i=e[t]=[]),i.push(n),e=>{i.length>1?i.forEach(t=>t(e)):i[0](e)}};t("__VUE_INSTANCE_SETTERS__",e=>e),t("__VUE_SSR_SETTERS__",e=>e)}function c({prefix:e="id_"}={}){const t=e.length>=3?e.substring(0,3):e.padEnd(3,"_"),n=Math.floor(Date.now()/1e3).toString(16).padStart(8,"0");let i="";for(let o=0;o<16;o++)i+=Math.floor(16*Math.random()).toString(16);return t+n+i}m.default=m,m.stable=b,m.stableStringify=b;var l="[...]",d="[Circular]",u=[],h=[];function p(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function m(e,t,n,i){var o;void 0===i&&(i=p()),g(e,"",0,[],void 0,0,i);try{o=0===h.length?JSON.stringify(e,t,n):JSON.stringify(e,k(t),n)}catch(s){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==u.length;){var r=u.pop();4===r.length?Object.defineProperty(r[0],r[1],r[3]):r[0][r[1]]=r[2]}}return o}function f(e,t,n,i){var o=Object.getOwnPropertyDescriptor(i,n);void 0!==o.get?o.configurable?(Object.defineProperty(i,n,{value:e}),u.push([i,n,t,o])):h.push([t,n,e]):(i[n]=e,u.push([i,n,t]))}function g(e,t,n,i,o,r,s){var a;if(r+=1,"object"==typeof e&&null!==e){for(a=0;a<i.length;a++)if(i[a]===e)return void f(d,e,t,o);if(void 0!==s.depthLimit&&r>s.depthLimit)return void f(l,e,t,o);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void f(l,e,t,o);if(i.push(e),Array.isArray(e))for(a=0;a<e.length;a++)g(e[a],a,a,i,e,r,s);else{var c=Object.keys(e);for(a=0;a<c.length;a++){var u=c[a];g(e[u],u,a,i,e,r,s)}}i.pop()}}function v(e,t){return e<t?-1:e>t?1:0}function b(e,t,n,i){void 0===i&&(i=p());var o,r=y(e,"",0,[],void 0,0,i)||e;try{o=0===h.length?JSON.stringify(r,t,n):JSON.stringify(r,k(t),n)}catch(a){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==u.length;){var s=u.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return o}function y(e,t,n,i,o,r,s){var a;if(r+=1,"object"==typeof e&&null!==e){for(a=0;a<i.length;a++)if(i[a]===e)return void f(d,e,t,o);try{if("function"==typeof e.toJSON)return}catch(m){return}if(void 0!==s.depthLimit&&r>s.depthLimit)return void f(l,e,t,o);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void f(l,e,t,o);if(i.push(e),Array.isArray(e))for(a=0;a<e.length;a++)y(e[a],a,a,i,e,r,s);else{var c={},h=Object.keys(e).sort(v);for(a=0;a<h.length;a++){var p=h[a];y(e[p],p,a,i,e,r,s),c[p]=e[p]}if(void 0===o)return c;u.push([o,t,e]),o[t]=c}i.pop()}}function k(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(h.length>0)for(var i=0;i<h.length;i++){var o=h[i];if(o[1]===t&&o[0]===n){n=o[2],h.splice(i,1);break}}return e.call(this,t,n)}}!function(){var e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function t(e,t){var n=e[0],i=e[1],o=e[2],r=e[3];i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&o|~i&r)+t[0]-680876936|0)<<7|n>>>25)+i|0)&i|~n&o)+t[1]-389564586|0)<<12|r>>>20)+n|0)&n|~r&i)+t[2]+606105819|0)<<17|o>>>15)+r|0)&r|~o&n)+t[3]-1044525330|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&o|~i&r)+t[4]-176418897|0)<<7|n>>>25)+i|0)&i|~n&o)+t[5]+1200080426|0)<<12|r>>>20)+n|0)&n|~r&i)+t[6]-1473231341|0)<<17|o>>>15)+r|0)&r|~o&n)+t[7]-45705983|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&o|~i&r)+t[8]+1770035416|0)<<7|n>>>25)+i|0)&i|~n&o)+t[9]-1958414417|0)<<12|r>>>20)+n|0)&n|~r&i)+t[10]-42063|0)<<17|o>>>15)+r|0)&r|~o&n)+t[11]-1990404162|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&o|~i&r)+t[12]+1804603682|0)<<7|n>>>25)+i|0)&i|~n&o)+t[13]-40341101|0)<<12|r>>>20)+n|0)&n|~r&i)+t[14]-1502002290|0)<<17|o>>>15)+r|0)&r|~o&n)+t[15]+1236535329|0)<<22|i>>>10)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&r|o&~r)+t[1]-165796510|0)<<5|n>>>27)+i|0)&o|i&~o)+t[6]-1069501632|0)<<9|r>>>23)+n|0)&i|n&~i)+t[11]+643717713|0)<<14|o>>>18)+r|0)&n|r&~n)+t[0]-373897302|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&r|o&~r)+t[5]-701558691|0)<<5|n>>>27)+i|0)&o|i&~o)+t[10]+38016083|0)<<9|r>>>23)+n|0)&i|n&~i)+t[15]-660478335|0)<<14|o>>>18)+r|0)&n|r&~n)+t[4]-405537848|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&r|o&~r)+t[9]+568446438|0)<<5|n>>>27)+i|0)&o|i&~o)+t[14]-1019803690|0)<<9|r>>>23)+n|0)&i|n&~i)+t[3]-187363961|0)<<14|o>>>18)+r|0)&n|r&~n)+t[8]+1163531501|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i&r|o&~r)+t[13]-1444681467|0)<<5|n>>>27)+i|0)&o|i&~o)+t[2]-51403784|0)<<9|r>>>23)+n|0)&i|n&~i)+t[7]+1735328473|0)<<14|o>>>18)+r|0)&n|r&~n)+t[12]-1926607734|0)<<20|i>>>12)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i^o^r)+t[5]-378558|0)<<4|n>>>28)+i|0)^i^o)+t[8]-2022574463|0)<<11|r>>>21)+n|0)^n^i)+t[11]+1839030562|0)<<16|o>>>16)+r|0)^r^n)+t[14]-35309556|0)<<23|i>>>9)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i^o^r)+t[1]-1530992060|0)<<4|n>>>28)+i|0)^i^o)+t[4]+1272893353|0)<<11|r>>>21)+n|0)^n^i)+t[7]-155497632|0)<<16|o>>>16)+r|0)^r^n)+t[10]-1094730640|0)<<23|i>>>9)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i^o^r)+t[13]+681279174|0)<<4|n>>>28)+i|0)^i^o)+t[0]-358537222|0)<<11|r>>>21)+n|0)^n^i)+t[3]-722521979|0)<<16|o>>>16)+r|0)^r^n)+t[6]+76029189|0)<<23|i>>>9)+o|0,i=((i+=((o=((o+=((r=((r+=((n=((n+=(i^o^r)+t[9]-640364487|0)<<4|n>>>28)+i|0)^i^o)+t[12]-421815835|0)<<11|r>>>21)+n|0)^n^i)+t[15]+530742520|0)<<16|o>>>16)+r|0)^r^n)+t[2]-995338651|0)<<23|i>>>9)+o|0,i=((i+=((r=((r+=(i^((n=((n+=(o^(i|~r))+t[0]-198630844|0)<<6|n>>>26)+i|0)|~o))+t[7]+1126891415|0)<<10|r>>>22)+n|0)^((o=((o+=(n^(r|~i))+t[14]-1416354905|0)<<15|o>>>17)+r|0)|~n))+t[5]-57434055|0)<<21|i>>>11)+o|0,i=((i+=((r=((r+=(i^((n=((n+=(o^(i|~r))+t[12]+1700485571|0)<<6|n>>>26)+i|0)|~o))+t[3]-1894986606|0)<<10|r>>>22)+n|0)^((o=((o+=(n^(r|~i))+t[10]-1051523|0)<<15|o>>>17)+r|0)|~n))+t[1]-2054922799|0)<<21|i>>>11)+o|0,i=((i+=((r=((r+=(i^((n=((n+=(o^(i|~r))+t[8]+1873313359|0)<<6|n>>>26)+i|0)|~o))+t[15]-30611744|0)<<10|r>>>22)+n|0)^((o=((o+=(n^(r|~i))+t[6]-1560198380|0)<<15|o>>>17)+r|0)|~n))+t[13]+1309151649|0)<<21|i>>>11)+o|0,i=((i+=((r=((r+=(i^((n=((n+=(o^(i|~r))+t[4]-145523070|0)<<6|n>>>26)+i|0)|~o))+t[11]-1120210379|0)<<10|r>>>22)+n|0)^((o=((o+=(n^(r|~i))+t[2]+718787259|0)<<15|o>>>17)+r|0)|~n))+t[9]-343485551|0)<<21|i>>>11)+o|0,e[0]=n+e[0]|0,e[1]=i+e[1]|0,e[2]=o+e[2]|0,e[3]=r+e[3]|0}function n(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function o(e){var i,o,r,s,a,c,l=e.length,d=[1732584193,-271733879,-1732584194,271733878];for(i=64;i<=l;i+=64)t(d,n(e.substring(i-64,i)));for(o=(e=e.substring(i-64)).length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=0;i<o;i+=1)r[i>>2]|=e.charCodeAt(i)<<(i%4<<3);if(r[i>>2]|=128<<(i%4<<3),i>55)for(t(d,r),i=0;i<16;i+=1)r[i]=0;return s=(s=8*l).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),c=parseInt(s[1],16)||0,r[14]=a,r[15]=c,t(d,r),d}function r(t){var n,i="";for(n=0;n<4;n+=1)i+=e[t>>8*n+4&15]+e[t>>8*n&15];return i}function s(e){var t;for(t=0;t<e.length;t+=1)e[t]=r(e[t]);return e.join("")}function a(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function c(e){var t,n=[],i=e.length;for(t=0;t<i-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function l(){this.reset()}s(o("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function e(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(t,n){var i,o,r,s,a=this.byteLength,c=e(t,a),l=a;return undefined!==n&&(l=e(n,a)),c>l?new ArrayBuffer(0):(i=l-c,o=new ArrayBuffer(i),r=new Uint8Array(o),s=new Uint8Array(this,c,i),r.set(s),o)}}(),l.prototype.append=function(e){return this.appendBinary(a(e)),this},l.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var i,o=this._buff.length;for(i=64;i<=o;i+=64)t(this._hash,n(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},l.prototype.end=function(e){var t,n,i=this._buff,o=i.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)r[t>>2]|=i.charCodeAt(t)<<(t%4<<3);return this._finish(r,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},l.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},l.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},l.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},l.prototype._finish=function(e,n){var i,o,r,s=n;if(e[s>>2]|=128<<(s%4<<3),s>55)for(t(this._hash,e),s=0;s<16;s+=1)e[s]=0;i=(i=8*this._length).toString(16).match(/(.*?)(.{0,8})$/),o=parseInt(i[2],16),r=parseInt(i[1],16)||0,e[14]=o,e[15]=r,t(this._hash,e)},l.hash=function(e,t){return l.hashBinary(a(e),t)},l.hashBinary=function(e,t){var n=s(o(e));return t?c(n):n},l.ArrayBuffer=function(){this.reset()},l.ArrayBuffer.prototype.append=function(e){var n,o,r,s,a=(o=this._buff.buffer,r=e,(s=new Uint8Array(o.byteLength+r.byteLength)).set(new Uint8Array(o)),s.set(new Uint8Array(r),o.byteLength),s),c=a.length;for(this._length+=e.byteLength,n=64;n<=c;n+=64)t(this._hash,i(a.subarray(n-64,n)));return this._buff=n-64<c?new Uint8Array(a.buffer.slice(n-64)):new Uint8Array(0),this},l.ArrayBuffer.prototype.end=function(e){var t,n,i=this._buff,o=i.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<o;t+=1)r[t>>2]|=i[t]<<(t%4<<3);return this._finish(r,o),n=s(this._hash),e&&(n=c(n)),this.reset(),n},l.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},l.ArrayBuffer.prototype.getState=function(){var e,t=l.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},l.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,i=e.length,o=new ArrayBuffer(i),r=new Uint8Array(o);for(n=0;n<i;n+=1)r[n]=e.charCodeAt(n);return t?r:o}(e.buff,!0),l.prototype.setState.call(this,e)},l.ArrayBuffer.prototype.destroy=l.prototype.destroy,l.ArrayBuffer.prototype._finish=l.prototype._finish,l.ArrayBuffer.hash=function(e,n){var o=s(function(e){var n,o,r,s,a,c,l=e.length,d=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=l;n+=64)t(d,i(e.subarray(n-64,n)));for(o=(e=n-64<l?e.subarray(n-64):new Uint8Array(0)).length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<o;n+=1)r[n>>2]|=e[n]<<(n%4<<3);if(r[n>>2]|=128<<(n%4<<3),n>55)for(t(d,r),n=0;n<16;n+=1)r[n]=0;return s=(s=8*l).toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(s[2],16),c=parseInt(s[1],16)||0,r[14]=a,r[15]=c,t(d,r),d}(new Uint8Array(e)));return n?c(o):o}}();const w="undefined"!=typeof window,C=!w&&"undefined"!=typeof globalThis&&void 0!==globalThis.process,S={error:{priority:50,color:"#FF0000",nodeColor:"\x1b[31m"},warn:{priority:40,color:"#FFA500",nodeColor:"\x1b[33m"},info:{priority:30,color:"#00ABFF",nodeColor:"\x1b[36m"},debug:{priority:20,color:"#00BD0C",nodeColor:"\x1b[32m"},trace:{priority:10,color:"#5233FF",nodeColor:"\x1b[35m"}};class T{constructor(e={},t){o(this,"settings"),o(this,"enabledInBrowser",!1),o(this,"context"),this.context=t,this.settings={enabled:e.enabled??!0,minLevel:e.minLevel??(this.isProduction()?"info":"trace"),colors:e.colors??!0,timestamps:e.timestamps??!0},w&&this.initBrowserLogging()}isProduction(){var e,t;if(C)return"production"===(null==(t=null==(e=globalThis.process)?void 0:e.env)?void 0:t.NODE_ENV);if(w&&window.location){const e=window.location.hostname;return"localhost"!==e&&!e.includes("127.0.0.1")}return!1}initBrowserLogging(){var e;if(!w)return;const t=(null==(e=window.location)?void 0:e.hostname)||"";this.enabledInBrowser=!this.isProduction()||"localhost"===t||t.includes("127.0.0.1")||"true"===localStorage.getItem("enableLogging"),!this.enabledInBrowser&&this.isProduction()}shouldLog(e){return!!this.settings.enabled&&(!(w&&!this.enabledInBrowser)&&S[e].priority>=S[this.settings.minLevel].priority)}formatTimestamp(){return(new Date).toLocaleTimeString("en-GB",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}formatData(e,t=5,n=0,i=12e3,o=100){var r,s,a;if(n>=t)return`[Max Depth Reached: ${t}]`;if(null==e)return e;if(e instanceof Error)return{name:e.name,message:e.message,stack:null==(r=e.stack)?void 0:r.split("\n").slice(0,5).join("\n")};if(e instanceof Date)return`DATE: ${e.toISOString()}`;if("object"!=typeof e)return e;if(Array.isArray(e))return e.length>20?`Array(${e.length}) [${e.slice(0,3).map(e=>this.formatData(e,t,n+1,i,o)).join(", ")}, ...]`:e.map(e=>this.formatData(e,t,n+1,i,o));try{const t=JSON.stringify(e);if(t.length>i){return`[${(s=e)instanceof Map?"Map":s instanceof Set?"Set":(null==(a=s.constructor)?void 0:a.name)??"Object"}: ${Object.keys(e).length} properties, Size: ${t.length}/${i}]`}}catch{return"[Circular Reference or Unserializable]"}const c={},l=Object.entries(e).slice(0,o);for(const[d,u]of l)try{c[d]=this.formatData(u,t,n+1,i,o)}catch{c[d]="[Circular or Unserializable]"}return Object.keys(e).length>o&&(c["..."]=Object.keys(e).length-o+" more properties"),c}logToBrowser(e){if(!w||!this.shouldLog(e.level))return;const{level:t,description:n,context:i,data:o,error:r}=e,s=S[t];i||this.context,this.settings.timestamps&&this.formatTimestamp(),s.color,s.color,s.color,s.color,void 0!==o&&o instanceof Error&&o.stack}logError(e){const{error:t,context:n="Unknown Context",description:i}=e,o=t,r=(this.formatTimestamp(),"\x1b[0m");`\x1b[31m(${n}):${r}`.padEnd(15),o.message;o.message,o.stack&&o.stack.split("\n").slice(1,6).map(e=>`\x1b[2m${e.trim()}${r}`).join("\n")}logToNode(e){if(!C||!this.shouldLog(e.level))return;const{level:t,description:n,context:i,data:o,error:r}=e,s=S[t],a=i||this.context||"app";this.settings.timestamps&&this.formatTimestamp();if(r)return void this.logError({error:r,context:a,description:n});const c=this.settings.colors?s.nodeColor:"";t.toUpperCase(),`${c}(${a}):\x1b[0m`.padEnd(15),void 0!==o&&(o instanceof Error?this.logError({error:o,context:a}):this.formatData(o))}log(e){w?this.logToBrowser(e):C&&this.logToNode(e)}error(e,t){this.log({level:"error",description:e,data:t,context:this.context})}warn(e,t){this.log({level:"warn",description:e,data:t,context:this.context})}info(e,t){this.log({level:"info",description:e,data:t,context:this.context})}debug(e,t){this.log({level:"debug",description:e,data:t,context:this.context})}trace(e,t){this.log({level:"trace",description:e,data:t,context:this.context})}createContextLogger(e){const t=new T(this.settings,e);return{error:(e,n)=>t.error(e,n),warn:(e,n)=>t.warn(e,n),info:(e,n)=>t.info(e,n),debug:(e,n)=>t.debug(e,n),trace:(e,n)=>t.trace(e,n)}}setLevel(e){this.settings.minLevel=e}setEnabled(e){this.settings.enabled=e}}const x=new T;function E(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return e=>e in t}x.error.bind(x),x.warn.bind(x),x.info.bind(x),x.debug.bind(x),x.trace.bind(x),new class{constructor(e=".body-content"){o(this,"originalBodyPosition"),o(this,"originalBodyTop"),o(this,"originalBodyLeft"),o(this,"originalBodyWidth"),o(this,"originalBodyOverflow"),o(this,"originalScrollPosition"),o(this,"siteContentElement"),o(this,"isActivated",!1),o(this,"clearTimeout"),this.originalBodyPosition="",this.originalBodyTop="",this.originalBodyLeft="",this.originalBodyWidth="",this.originalBodyOverflow="",this.originalScrollPosition=0,"undefined"!=typeof document&&(this.siteContentElement=document.querySelector(e))}activate(){if("undefined"==typeof document)return;this.clearTimeout&&clearTimeout(this.clearTimeout),this.isActivated=!0,this.originalBodyPosition=document.body.style.position,this.originalBodyTop=document.body.style.top,this.originalBodyLeft=document.body.style.left,this.originalBodyWidth=document.body.style.width,this.originalBodyOverflow=document.body.style.overflow,this.originalScrollPosition=window.pageYOffset;const e=window.innerHeight,t=document.documentElement.scrollHeight-e,n=t>0?this.originalScrollPosition/t:0,i=Math.min(Math.max(100*n,30),70);document.body.style.position="fixed",document.body.style.top=`-${this.originalScrollPosition}px`,document.body.style.left="0",document.body.style.width="100%",document.body.style.overflow="hidden",this.siteContentElement&&(this.siteContentElement.style.transformOrigin=`center ${i}%`,this.siteContentElement.style.transform="scale(.96)",this.siteContentElement.style.transition="transform .75s cubic-bezier(0.25, 1, 0.33, 1)",this.siteContentElement.style.overflow="hidden")}deactivate(){"undefined"!=typeof document&&this.isActivated&&(this.isActivated=!1,document.body.style.position=this.originalBodyPosition,document.body.style.top=this.originalBodyTop,document.body.style.left=this.originalBodyLeft,document.body.style.width=this.originalBodyWidth,document.body.style.overflow=this.originalBodyOverflow,this.siteContentElement&&(this.siteContentElement.style.transform="scale(1)",this.siteContentElement.style.overflow=""),window.scrollTo(0,this.originalScrollPosition),this.clearTimeout=setTimeout(()=>{this.siteContentElement&&(this.siteContentElement.style.transform="",this.siteContentElement.style.transformOrigin="",this.siteContentElement.style.transition="")},1500))}},new class{constructor(){o(this,"callbacks",new Set),o(this,"initialized",!1)}get _testCallbacks(){return this.callbacks}get _testInitialized(){return this.initialized}set _testInitialized(e){this.initialized=e}onReset(e){return"undefined"==typeof window?()=>{}:(this.callbacks.add(e),this.init(),()=>this.callbacks.delete(e))}reset(){this.callbacks.forEach(e=>{try{e()}catch(t){}})}init(){this.initialized||"undefined"==typeof window||(this.initialized=!0,window.addEventListener("keydown",e=>{"Escape"===e.key&&this.reset()}),window.addEventListener("click",()=>this.reset()),this.initRouteWatcher())}initRouteWatcher(){window.addEventListener("popstate",()=>this.reset());const e=history.pushState.bind(history),t=history.replaceState.bind(history);history.pushState=(...t)=>{e(...t),setTimeout(()=>this.reset(),0)},history.replaceState=(...e)=>{t(...e),setTimeout(()=>this.reset(),0)}}};const _={},I=[],P=()=>{},R=()=>!1,A=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),M=e=>e.startsWith("onUpdate:"),O=Object.assign,D=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},N=Object.prototype.hasOwnProperty,L=(e,t)=>N.call(e,t),j=Array.isArray,U=e=>"[object Map]"===H(e),F=e=>"[object Set]"===H(e),B=e=>"function"==typeof e,z=e=>"string"==typeof e,V=e=>"symbol"==typeof e,$=e=>null!==e&&"object"==typeof e,q=e=>($(e)||B(e))&&B(e.then)&&B(e.catch),W=Object.prototype.toString,H=e=>W.call(e),G=e=>"[object Object]"===H(e),Z=e=>z(e)&&"NaN"!==e&&"-"!==e[0]&&""+parseInt(e,10)===e,J=E(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),K=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},Y=/-\w/g,Q=K(e=>e.replace(Y,e=>e.slice(1).toUpperCase())),X=/\B([A-Z])/g,ee=K(e=>e.replace(X,"-$1").toLowerCase()),te=K(e=>e.charAt(0).toUpperCase()+e.slice(1)),ne=K(e=>e?`on${te(e)}`:""),ie=(e,t)=>!Object.is(e,t),oe=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},re=(e,t,n,i=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:i,value:n})},se=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let ae;const ce=()=>ae||(ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});function le(e){if(j(e)){const t={};for(let n=0;n<e.length;n++){const i=e[n],o=z(i)?pe(i):le(i);if(o)for(const e in o)t[e]=o[e]}return t}if(z(e)||$(e))return e}const de=/;(?![^(]*\))/g,ue=/:([^]+)/,he=/\/\*[^]*?\*\//g;function pe(e){const t={};return e.replace(he,"").split(de).forEach(e=>{if(e){const n=e.split(ue);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function me(e){let t="";if(z(e))t=e;else if(j(e))for(let n=0;n<e.length;n++){const i=me(e[n]);i&&(t+=i+" ")}else if($(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const fe=E("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function ge(e){return!!e||""===e}const ve=e=>!(!e||!0!==e.__v_isRef),be=e=>z(e)?e:null==e?"":j(e)||$(e)&&(e.toString===W||!B(e.toString))?ve(e)?be(e.value):JSON.stringify(e,ye,2):String(e),ye=(e,t)=>ve(t)?ye(e,t.value):U(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],i)=>(e[ke(t,i)+" =>"]=n,e),{})}:F(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>ke(e))}:V(t)?ke(t):!$(t)||j(t)||G(t)?t:String(t),ke=(e,t="")=>{var n;return V(e)?`Symbol(${null!=(n=e.description)?n:t})`:e};let we,Ce;class Se{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=we,!e&&we&&(this.index=(we.scopes||(we.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){let e,t;if(this._isPaused=!0,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){let e,t;if(this._isPaused=!1,this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=we;try{return we=this,e()}finally{we=t}}}on(){1===++this._on&&(this.prevScope=we,we=this)}off(){this._on>0&&0===--this._on&&(we=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){let t,n;for(this._active=!1,t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}}const Te=new WeakSet;class xe{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,we&&we.active&&we.effects.push(this)}pause(){this.flags|=64}resume(){64&this.flags&&(this.flags&=-65,Te.has(this)&&(Te.delete(this),this.trigger()))}notify(){2&this.flags&&!(32&this.flags)||8&this.flags||Pe(this)}run(){if(!(1&this.flags))return this.fn();this.flags|=2,Ve(this),Me(this);const e=Ce,t=Ue;Ce=this,Ue=!0;try{return this.fn()}finally{Oe(this),Ce=e,Ue=t,this.flags&=-3}}stop(){if(1&this.flags){for(let e=this.deps;e;e=e.nextDep)Le(e);this.deps=this.depsTail=void 0,Ve(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){64&this.flags?Te.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){De(this)&&this.run()}get dirty(){return De(this)}}let Ee,_e,Ie=0;function Pe(e,t=!1){if(e.flags|=8,t)return e.next=_e,void(_e=e);e.next=Ee,Ee=e}function Re(){Ie++}function Ae(){if(--Ie>0)return;if(_e){let e=_e;for(_e=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Ee;){let n=Ee;for(Ee=void 0;n;){const i=n.next;if(n.next=void 0,n.flags&=-9,1&n.flags)try{n.trigger()}catch(t){e||(e=t)}n=i}}if(e)throw e}function Me(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Oe(e){let t,n=e.depsTail,i=n;for(;i;){const e=i.prevDep;-1===i.version?(i===n&&(n=e),Le(i),je(i)):t=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=e}e.deps=t,e.depsTail=n}function De(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ne(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ne(e){if(4&e.flags&&!(16&e.flags))return;if(e.flags&=-17,e.globalVersion===$e)return;if(e.globalVersion=$e,!e.isSSR&&128&e.flags&&(!e.deps&&!e._dirty||!De(e)))return;e.flags|=2;const t=e.dep,n=Ce,i=Ue;Ce=e,Ue=!0;try{Me(e);const n=e.fn(e._value);(0===t.version||ie(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(o){throw t.version++,o}finally{Ce=n,Ue=i,Oe(e),e.flags&=-3}}function Le(e,t=!1){const{dep:n,prevSub:i,nextSub:o}=e;if(i&&(i.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=i,e.nextSub=void 0),n.subs===e&&(n.subs=i,!i&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Le(e,!0)}t||--n.sc||!n.map||n.map.delete(n.key)}function je(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Ue=!0;const Fe=[];function Be(){Fe.push(Ue),Ue=!1}function ze(){const e=Fe.pop();Ue=void 0===e||e}function Ve(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const e=Ce;Ce=void 0;try{t()}finally{Ce=e}}}let $e=0;class qe{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class We{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Ce||!Ue||Ce===this.computed)return;let t=this.activeLink;if(void 0===t||t.sub!==Ce)t=this.activeLink=new qe(Ce,this),Ce.deps?(t.prevDep=Ce.depsTail,Ce.depsTail.nextDep=t,Ce.depsTail=t):Ce.deps=Ce.depsTail=t,He(t);else if(-1===t.version&&(t.version=this.version,t.nextDep)){const e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Ce.depsTail,t.nextDep=void 0,Ce.depsTail.nextDep=t,Ce.depsTail=t,Ce.deps===t&&(Ce.deps=e)}return t}trigger(e){this.version++,$e++,this.notify(e)}notify(e){Re();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ae()}}}function He(e){if(e.dep.sc++,4&e.sub.flags){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)He(e)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Ge=new WeakMap,Ze=Symbol(""),Je=Symbol(""),Ke=Symbol("");function Ye(e,t,n){if(Ue&&Ce){let t=Ge.get(e);t||Ge.set(e,t=new Map);let i=t.get(n);i||(t.set(n,i=new We),i.map=t,i.key=n),i.track()}}function Qe(e,t,n,i,o,r){const s=Ge.get(e);if(!s)return void $e++;const a=e=>{e&&e.trigger()};if(Re(),"clear"===t)s.forEach(a);else{const o=j(e),r=o&&Z(n);if(o&&"length"===n){const e=Number(i);s.forEach((t,n)=>{("length"===n||n===Ke||!V(n)&&n>=e)&&a(t)})}else switch((void 0!==n||s.has(void 0))&&a(s.get(n)),r&&a(s.get(Ke)),t){case"add":o?r&&a(s.get("length")):(a(s.get(Ze)),U(e)&&a(s.get(Je)));break;case"delete":o||(a(s.get(Ze)),U(e)&&a(s.get(Je)));break;case"set":U(e)&&a(s.get(Ze))}}Ae()}function Xe(e){const t=Nt(e);return t===e?t:(Ye(t,0,Ke),Ot(e)?t:t.map(Lt))}function et(e){return Ye(e=Nt(e),0,Ke),e}const tt={__proto__:null,[Symbol.iterator](){return nt(this,Symbol.iterator,Lt)},concat(...e){return Xe(this).concat(...e.map(e=>j(e)?Xe(e):e))},entries(){return nt(this,"entries",e=>(e[1]=Lt(e[1]),e))},every(e,t){return ot(this,"every",e,t,void 0,arguments)},filter(e,t){return ot(this,"filter",e,t,e=>e.map(Lt),arguments)},find(e,t){return ot(this,"find",e,t,Lt,arguments)},findIndex(e,t){return ot(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ot(this,"findLast",e,t,Lt,arguments)},findLastIndex(e,t){return ot(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ot(this,"forEach",e,t,void 0,arguments)},includes(...e){return st(this,"includes",e)},indexOf(...e){return st(this,"indexOf",e)},join(e){return Xe(this).join(e)},lastIndexOf(...e){return st(this,"lastIndexOf",e)},map(e,t){return ot(this,"map",e,t,void 0,arguments)},pop(){return at(this,"pop")},push(...e){return at(this,"push",e)},reduce(e,...t){return rt(this,"reduce",e,t)},reduceRight(e,...t){return rt(this,"reduceRight",e,t)},shift(){return at(this,"shift")},some(e,t){return ot(this,"some",e,t,void 0,arguments)},splice(...e){return at(this,"splice",e)},toReversed(){return Xe(this).toReversed()},toSorted(e){return Xe(this).toSorted(e)},toSpliced(...e){return Xe(this).toSpliced(...e)},unshift(...e){return at(this,"unshift",e)},values(){return nt(this,"values",Lt)}};function nt(e,t,n){const i=et(e),o=i[t]();return i===e||Ot(e)||(o._next=o.next,o.next=()=>{const e=o._next();return e.done||(e.value=n(e.value)),e}),o}const it=Array.prototype;function ot(e,t,n,i,o,r){const s=et(e),a=s!==e&&!Ot(e),c=s[t];if(c!==it[t]){const t=c.apply(e,r);return a?Lt(t):t}let l=n;s!==e&&(a?l=function(t,i){return n.call(this,Lt(t),i,e)}:n.length>2&&(l=function(t,i){return n.call(this,t,i,e)}));const d=c.call(s,l,i);return a&&o?o(d):d}function rt(e,t,n,i){const o=et(e);let r=n;return o!==e&&(Ot(e)?n.length>3&&(r=function(t,i,o){return n.call(this,t,i,o,e)}):r=function(t,i,o){return n.call(this,t,Lt(i),o,e)}),o[t](r,...i)}function st(e,t,n){const i=Nt(e);Ye(i,0,Ke);const o=i[t](...n);return-1!==o&&!1!==o||!Dt(n[0])?o:(n[0]=Nt(n[0]),i[t](...n))}function at(e,t,n=[]){Be(),Re();const i=Nt(e)[t].apply(e,n);return Ae(),ze(),i}const ct=E("__proto__,__v_isRef,__isVue"),lt=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>"arguments"!==e&&"caller"!==e).map(e=>Symbol[e]).filter(V));function dt(e){V(e)||(e=String(e));const t=Nt(this);return Ye(t,0,e),t.hasOwnProperty(e)}class ut{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if("__v_skip"===t)return e.__v_skip;const i=this._isReadonly,o=this._isShallow;if("__v_isReactive"===t)return!i;if("__v_isReadonly"===t)return i;if("__v_isShallow"===t)return o;if("__v_raw"===t)return n===(i?o?_t:Et:o?xt:Tt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const r=j(e);if(!i){let e;if(r&&(e=tt[t]))return e;if("hasOwnProperty"===t)return dt}const s=Reflect.get(e,t,Ut(e)?e:n);if(V(t)?lt.has(t):ct(t))return s;if(i||Ye(e,0,t),o)return s;if(Ut(s)){const e=r&&Z(t)?s:s.value;return i&&$(e)?Pt(e):e}return $(s)?i?Pt(s):It(s):s}}class ht extends ut{constructor(e=!1){super(!1,e)}set(e,t,n,i){let o=e[t];if(!this._isShallow){const t=Mt(o);if(Ot(n)||Mt(n)||(o=Nt(o),n=Nt(n)),!j(e)&&Ut(o)&&!Ut(n))return t||(o.value=n),!0}const r=j(e)&&Z(t)?Number(t)<e.length:L(e,t),s=Reflect.set(e,t,n,Ut(e)?e:i);return e===Nt(i)&&(r?ie(n,o)&&Qe(e,"set",t,n):Qe(e,"add",t,n)),s}deleteProperty(e,t){const n=L(e,t);e[t];const i=Reflect.deleteProperty(e,t);return i&&n&&Qe(e,"delete",t,void 0),i}has(e,t){const n=Reflect.has(e,t);return V(t)&&lt.has(t)||Ye(e,0,t),n}ownKeys(e){return Ye(e,0,j(e)?"length":Ze),Reflect.ownKeys(e)}}class pt extends ut{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}}const mt=new ht,ft=new pt,gt=new ht(!0),vt=e=>e,bt=e=>Reflect.getPrototypeOf(e);function yt(e){return function(...t){return"delete"!==e&&("clear"===e?void 0:this)}}function kt(e,t){const n=function(e,t){const n={get(n){const i=this.__v_raw,o=Nt(i),r=Nt(n);e||(ie(n,r)&&Ye(o,0,n),Ye(o,0,r));const{has:s}=bt(o),a=t?vt:e?jt:Lt;return s.call(o,n)?a(i.get(n)):s.call(o,r)?a(i.get(r)):void(i!==o&&i.get(n))},get size(){const t=this.__v_raw;return!e&&Ye(Nt(t),0,Ze),t.size},has(t){const n=this.__v_raw,i=Nt(n),o=Nt(t);return e||(ie(t,o)&&Ye(i,0,t),Ye(i,0,o)),t===o?n.has(t):n.has(t)||n.has(o)},forEach(n,i){const o=this,r=o.__v_raw,s=Nt(r),a=t?vt:e?jt:Lt;return!e&&Ye(s,0,Ze),r.forEach((e,t)=>n.call(i,a(e),a(t),o))}};return O(n,e?{add:yt("add"),set:yt("set"),delete:yt("delete"),clear:yt("clear")}:{add(e){t||Ot(e)||Mt(e)||(e=Nt(e));const n=Nt(this);return bt(n).has.call(n,e)||(n.add(e),Qe(n,"add",e,e)),this},set(e,n){t||Ot(n)||Mt(n)||(n=Nt(n));const i=Nt(this),{has:o,get:r}=bt(i);let s=o.call(i,e);s||(e=Nt(e),s=o.call(i,e));const a=r.call(i,e);return i.set(e,n),s?ie(n,a)&&Qe(i,"set",e,n):Qe(i,"add",e,n),this},delete(e){const t=Nt(this),{has:n,get:i}=bt(t);let o=n.call(t,e);o||(e=Nt(e),o=n.call(t,e)),i&&i.call(t,e);const r=t.delete(e);return o&&Qe(t,"delete",e,void 0),r},clear(){const e=Nt(this),t=0!==e.size,n=e.clear();return t&&Qe(e,"clear",void 0,void 0),n}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=function(e,t,n){return function(...i){const o=this.__v_raw,r=Nt(o),s=U(r),a="entries"===e||e===Symbol.iterator&&s,c="keys"===e&&s,l=o[e](...i),d=n?vt:t?jt:Lt;return!t&&Ye(r,0,c?Je:Ze),{next(){const{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:a?[d(e[0]),d(e[1])]:d(e),done:t}},[Symbol.iterator](){return this}}}}(i,e,t)}),n}(e,t);return(t,i,o)=>"__v_isReactive"===i?!e:"__v_isReadonly"===i?e:"__v_raw"===i?t:Reflect.get(L(n,i)&&i in t?n:t,i,o)}const wt={get:kt(!1,!1)},Ct={get:kt(!1,!0)},St={get:kt(!0,!1)},Tt=new WeakMap,xt=new WeakMap,Et=new WeakMap,_t=new WeakMap;function It(e){return Mt(e)?e:Rt(e,!1,mt,wt,Tt)}function Pt(e){return Rt(e,!0,ft,St,Et)}function Rt(e,t,n,i,o){if(!$(e))return e;if(e.__v_raw&&(!t||!e.__v_isReactive))return e;const r=(s=e).__v_skip||!Object.isExtensible(s)?0:function(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((e=>H(e).slice(8,-1))(s));var s;if(0===r)return e;const a=o.get(e);if(a)return a;const c=new Proxy(e,2===r?i:n);return o.set(e,c),c}function At(e){return Mt(e)?At(e.__v_raw):!(!e||!e.__v_isReactive)}function Mt(e){return!(!e||!e.__v_isReadonly)}function Ot(e){return!(!e||!e.__v_isShallow)}function Dt(e){return!!e&&!!e.__v_raw}function Nt(e){const t=e&&e.__v_raw;return t?Nt(t):e}const Lt=e=>$(e)?It(e):e,jt=e=>$(e)?Pt(e):e;function Ut(e){return!!e&&!0===e.__v_isRef}function Ft(e){return Bt(e,!1)}function Bt(e,t){return Ut(e)?e:new zt(e,t)}class zt{constructor(e,t){this.dep=new We,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Nt(e),this._value=t?e:Lt(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||Ot(e)||Mt(e);e=n?e:Nt(e),ie(e,t)&&(this._rawValue=e,this._value=n?e:Lt(e),this.dep.trigger())}}function Vt(e){return Ut(e)?e.value:e}const $t={get:(e,t,n)=>"__v_raw"===t?e:Vt(Reflect.get(e,t,n)),set:(e,t,n,i)=>{const o=e[t];return Ut(o)&&!Ut(n)?(o.value=n,!0):Reflect.set(e,t,n,i)}};function qt(e){return At(e)?e:new Proxy(e,$t)}class Wt{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new We(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=$e-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(8&this.flags)&&Ce!==this)return Pe(this,!0),!0}get value(){const e=this.dep.track();return Ne(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}const Ht={},Gt=new WeakMap;let Zt;function Jt(e,t=1/0,n){if(t<=0||!$(e)||e.__v_skip)return e;if(((n=n||new Map).get(e)||0)>=t)return e;if(n.set(e,t),t--,Ut(e))Jt(e.value,t,n);else if(j(e))for(let i=0;i<e.length;i++)Jt(e[i],t,n);else if(F(e)||U(e))e.forEach(e=>{Jt(e,t,n)});else if(G(e)){for(const i in e)Jt(e[i],t,n);for(const i of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,i)&&Jt(e[i],t,n)}return e}function Kt(e,t,n,i){try{return i?e(...i):e()}catch(o){Qt(o,t,n)}}function Yt(e,t,n,i){if(B(e)){const o=Kt(e,t,n,i);return o&&q(o)&&o.catch(e=>{Qt(e,t,n)}),o}if(j(e)){const o=[];for(let r=0;r<e.length;r++)o.push(Yt(e[r],t,n,i));return o}}function Qt(e,t,n,i=!0){t&&t.vnode;const{errorHandler:o,throwUnhandledErrorInProduction:r}=t&&t.appContext.config||_;if(t){let i=t.parent;const r=t.proxy,s=`https://vuejs.org/error-reference/#runtime-${n}`;for(;i;){const t=i.ec;if(t)for(let n=0;n<t.length;n++)if(!1===t[n](e,r,s))return;i=i.parent}if(o)return Be(),Kt(o,null,10,[e,r,s]),void ze()}!function(e,t,n,i=!0,o=!1){if(o)throw e}(e,0,0,i,r)}const Xt=[];let en=-1;const tn=[];let nn=null,on=0;const rn=Promise.resolve();let sn=null;function an(e){const t=sn||rn;return e?t.then(this?e.bind(this):e):t}function cn(e){if(!(1&e.flags)){const t=hn(e),n=Xt[Xt.length-1];!n||!(2&e.flags)&&t>=hn(n)?Xt.push(e):Xt.splice(function(e){let t=en+1,n=Xt.length;for(;t<n;){const i=t+n>>>1,o=Xt[i],r=hn(o);r<e||r===e&&2&o.flags?t=i+1:n=i}return t}(t),0,e),e.flags|=1,ln()}}function ln(){sn||(sn=rn.then(pn))}function dn(e,t,n=en+1){for(;n<Xt.length;n++){const t=Xt[n];if(t&&2&t.flags){if(e&&t.id!==e.uid)continue;Xt.splice(n,1),n--,4&t.flags&&(t.flags&=-2),t(),4&t.flags||(t.flags&=-2)}}}function un(e){if(tn.length){const e=[...new Set(tn)].sort((e,t)=>hn(e)-hn(t));if(tn.length=0,nn)return void nn.push(...e);for(nn=e,on=0;on<nn.length;on++){const e=nn[on];4&e.flags&&(e.flags&=-2),8&e.flags||e(),e.flags&=-2}nn=null,on=0}}const hn=e=>null==e.id?2&e.flags?-1:1/0:e.id;function pn(e){try{for(en=0;en<Xt.length;en++){const e=Xt[en];!e||8&e.flags||(4&e.flags&&(e.flags&=-2),Kt(e,e.i,e.i?15:14),4&e.flags||(e.flags&=-2))}}finally{for(;en<Xt.length;en++){const e=Xt[en];e&&(e.flags&=-2)}en=-1,Xt.length=0,un(),sn=null,(Xt.length||tn.length)&&pn()}}let mn=null,fn=null;function gn(e){const t=mn;return mn=e,fn=e&&e.type.__scopeId||null,t}function vn(e,t=mn,n){if(!t)return e;if(e._n)return e;const i=(...n)=>{i._d&&To(-1);const o=gn(t);let r;try{r=e(...n)}finally{gn(o),i._d&&To(1)}return r};return i._n=!0,i._c=!0,i._d=!0,i}function bn(e,t){if(null===mn)return e;const n=er(mn),i=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[e,r,s,a=_]=t[o];e&&(B(e)&&(e={mounted:e,updated:e}),e.deep&&Jt(r),i.push({dir:e,instance:n,value:r,oldValue:void 0,arg:s,modifiers:a}))}return e}function yn(e,t,n,i){const o=e.dirs,r=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];r&&(a.oldValue=r[s].value);let c=a.dir[i];c&&(Be(),Yt(c,n,8,[e.el,a,e,t]),ze())}}const kn=Symbol("_vte"),wn=e=>e.__isTeleport,Cn=Symbol("_leaveCb"),Sn=Symbol("_enterCb");function Tn(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Kn(()=>{e.isMounted=!0}),Xn(()=>{e.isUnmounting=!0}),e}const xn=[Function,Array],En={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:xn,onEnter:xn,onAfterEnter:xn,onEnterCancelled:xn,onBeforeLeave:xn,onLeave:xn,onAfterLeave:xn,onLeaveCancelled:xn,onBeforeAppear:xn,onAppear:xn,onAfterAppear:xn,onAppearCancelled:xn},_n=e=>{const t=e.subTree;return t.component?_n(t.component):t};function In(e){let t=e[0];if(e.length>1)for(const n of e)if(n.type!==bo){t=n;break}return t}const Pn={name:"BaseTransition",props:En,setup(e,{slots:t}){const n=qo(),i=Tn();return()=>{const o=t.default&&Nn(t.default(),!0);if(!o||!o.length)return;const r=In(o),s=Nt(e),{mode:a}=s;if(i.isLeaving)return Mn(r);const c=On(r);if(!c)return Mn(r);let l=An(c,s,i,n,e=>l=e);c.type!==bo&&Dn(c,l);let d=n.subTree&&On(n.subTree);if(d&&d.type!==bo&&!Po(d,c)&&_n(n).type!==bo){let e=An(d,s,i,n);if(Dn(d,e),"out-in"===a&&c.type!==bo)return i.isLeaving=!0,e.afterLeave=()=>{i.isLeaving=!1,8&n.job.flags||n.update(),delete e.afterLeave,d=void 0},Mn(r);"in-out"===a&&c.type!==bo?e.delayLeave=(e,t,n)=>{Rn(i,d)[String(d.key)]=d,e[Cn]=()=>{t(),e[Cn]=void 0,delete l.delayedLeave,d=void 0},l.delayedLeave=()=>{n(),delete l.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return r}}};function Rn(e,t){const{leavingVNodes:n}=e;let i=n.get(t.type);return i||(i=Object.create(null),n.set(t.type,i)),i}function An(e,t,n,i,o){const{appear:r,mode:s,persisted:a=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:d,onEnterCancelled:u,onBeforeLeave:h,onLeave:p,onAfterLeave:m,onLeaveCancelled:f,onBeforeAppear:g,onAppear:v,onAfterAppear:b,onAppearCancelled:y}=t,k=String(e.key),w=Rn(n,e),C=(e,t)=>{e&&Yt(e,i,9,t)},S=(e,t)=>{const n=t[1];C(e,t),j(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},T={mode:s,persisted:a,beforeEnter(t){let i=c;if(!n.isMounted){if(!r)return;i=g||c}t[Cn]&&t[Cn](!0);const o=w[k];o&&Po(e,o)&&o.el[Cn]&&o.el[Cn](),C(i,[t])},enter(e){let t=l,i=d,o=u;if(!n.isMounted){if(!r)return;t=v||l,i=b||d,o=y||u}let s=!1;const a=e[Sn]=t=>{s||(s=!0,C(t?o:i,[e]),T.delayedLeave&&T.delayedLeave(),e[Sn]=void 0)};t?S(t,[e,a]):a()},leave(t,i){const o=String(e.key);if(t[Sn]&&t[Sn](!0),n.isUnmounting)return i();C(h,[t]);let r=!1;const s=t[Cn]=n=>{r||(r=!0,i(),C(n?f:m,[t]),t[Cn]=void 0,w[o]===e&&delete w[o])};w[o]=e,p?S(p,[t,s]):s()},clone(e){const r=An(e,t,n,i,o);return o&&o(r),r}};return T}function Mn(e){if(Vn(e))return(e=Do(e)).children=null,e}function On(e){if(!Vn(e))return wn(e.type)&&e.children?In(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(16&t)return n[0];if(32&t&&B(n.default))return n.default()}}function Dn(e,t){6&e.shapeFlag&&e.component?(e.transition=t,Dn(e.component.subTree,t)):128&e.shapeFlag?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Nn(e,t=!1,n){let i=[],o=0;for(let r=0;r<e.length;r++){let s=e[r];const a=null==n?s.key:String(n)+String(null!=s.key?s.key:r);s.type===go?(128&s.patchFlag&&o++,i=i.concat(Nn(s.children,t,a))):(t||s.type!==bo)&&i.push(null!=a?Do(s,{key:a}):s)}if(o>1)for(let r=0;r<i.length;r++)i[r].patchFlag=-2;return i}function Ln(e,t){return B(e)?(()=>O({name:e.name},t,{setup:e}))():e}function jn(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}const Un=new WeakMap;function Fn(e,t,n,i,o=!1){if(j(e))return void e.forEach((e,r)=>Fn(e,t&&(j(t)?t[r]:t),n,i,o));if(zn(i)&&!o)return void(512&i.shapeFlag&&i.type.__asyncResolved&&i.component.subTree.component&&Fn(e,t,n,i.component.subTree));const r=4&i.shapeFlag?er(i.component):i.el,s=o?null:r,{i:a,r:c}=e,l=t&&t.r,d=a.refs===_?a.refs={}:a.refs,u=a.setupState,h=Nt(u),p=u===_?R:e=>L(h,e);if(null!=l&&l!==c)if(Bn(t),z(l))d[l]=null,p(l)&&(u[l]=null);else if(Ut(l)){l.value=null;const e=t;e.k&&(d[e.k]=null)}if(B(c))Kt(c,a,12,[s,d]);else{const t=z(c),i=Ut(c);if(t||i){const a=()=>{if(e.f){const n=t?p(c)?u[c]:d[c]:c.value;if(o)j(n)&&D(n,r);else if(j(n))n.includes(r)||n.push(r);else if(t)d[c]=[r],p(c)&&(u[c]=d[c]);else{const t=[r];c.value=t,e.k&&(d[e.k]=t)}}else t?(d[c]=s,p(c)&&(u[c]=s)):i&&(c.value=s,e.k&&(d[e.k]=s))};if(s){const t=()=>{a(),Un.delete(e)};t.id=-1,Un.set(e,t),Hi(t,n)}else Bn(e),a()}}}function Bn(e){const t=Un.get(e);t&&(t.flags|=8,Un.delete(e))}ce().requestIdleCallback,ce().cancelIdleCallback;const zn=e=>!!e.type.__asyncLoader,Vn=e=>e.type.__isKeepAlive;function $n(e,t){Wn(e,"a",t)}function qn(e,t){Wn(e,"da",t)}function Wn(e,t,n=$o){const i=e.__wdc||(e.__wdc=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()});if(Gn(t,i,n),n){let e=n.parent;for(;e&&e.parent;)Vn(e.parent.vnode)&&Hn(i,t,n,e),e=e.parent}}function Hn(e,t,n,i){const o=Gn(t,e,i,!0);ei(()=>{D(i[t],o)},n)}function Gn(e,t,n=$o,i=!1){if(n){const o=n[e]||(n[e]=[]),r=t.__weh||(t.__weh=(...i)=>{Be();const o=Go(n),r=Yt(t,n,e,i);return o(),ze(),r});return i?o.unshift(r):o.push(r),r}}const Zn=e=>(t,n=$o)=>{Ko&&"sp"!==e||Gn(e,(...e)=>t(...e),n)},Jn=Zn("bm"),Kn=Zn("m"),Yn=Zn("bu"),Qn=Zn("u"),Xn=Zn("bum"),ei=Zn("um"),ti=Zn("sp"),ni=Zn("rtg"),ii=Zn("rtc");function oi(e,t=$o){Gn("ec",e,t)}const ri=Symbol.for("v-ndc");function si(e){return z(e)?function(e,t,n=!0,i=!1){const o=mn||$o;if(o){const n=o.type;{const e=function(e,t=!0){return B(e)?e.displayName||e.name:e.name||t&&e.__name}(n,!1);if(e&&(e===t||e===Q(t)||e===te(Q(t))))return n}const r=ai(o[e]||n[e],t)||ai(o.appContext[e],t);return!r&&i?n:r}}("components",e,!1)||e:e||ri}function ai(e,t){return e&&(e[t]||e[Q(t)]||e[te(Q(t))])}function ci(e,t,n,i){let o;const r=n,s=j(e);if(s||z(e)){let n=!1,i=!1;s&&At(e)&&(n=!Ot(e),i=Mt(e),e=et(e)),o=new Array(e.length);for(let s=0,a=e.length;s<a;s++)o[s]=t(n?i?jt(Lt(e[s])):Lt(e[s]):e[s],s,void 0,r)}else if("number"==typeof e){o=new Array(e);for(let n=0;n<e;n++)o[n]=t(n+1,n,void 0,r)}else if($(e))if(e[Symbol.iterator])o=Array.from(e,(e,n)=>t(e,n,void 0,r));else{const n=Object.keys(e);o=new Array(n.length);for(let i=0,s=n.length;i<s;i++){const s=n[i];o[i]=t(e[s],s,i,r)}}else o=[];return o}function li(e,t,n={},i,o){if(mn.ce||mn.parent&&zn(mn.parent)&&mn.parent.ce){const e=Object.keys(n).length>0;return"default"!==t&&(n.name=t),Co(),_o(go,null,[Oo("slot",n,i&&i())],e?-2:64)}let r=e[t];r&&r._c&&(r._d=!1),Co();const s=r&&di(r(n)),a=n.key||s&&s.key,c=_o(go,{key:(a&&!V(a)?a:`_${t}`)+(!s&&i?"_fb":"")},s||(i?i():[]),s&&1===e._?64:-2);return c.scopeId&&(c.slotScopeIds=[c.scopeId+"-s"]),r&&r._c&&(r._d=!0),c}function di(e){return e.some(e=>!Io(e)||e.type!==bo&&!(e.type===go&&!di(e.children)))?e:null}const ui=e=>e?Jo(e)?er(e):ui(e.parent):null,hi=O(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>ui(e.parent),$root:e=>ui(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>yi(e),$forceUpdate:e=>e.f||(e.f=()=>{cn(e.update)}),$nextTick:e=>e.n||(e.n=an.bind(e.proxy)),$watch:e=>io.bind(e)}),pi=(e,t)=>e!==_&&!e.__isScriptSetup&&L(e,t),mi={get({_:e},t){if("__v_skip"===t)return!0;const{ctx:n,setupState:i,data:o,props:r,accessCache:s,type:a,appContext:c}=e;let l;if("$"!==t[0]){const a=s[t];if(void 0!==a)switch(a){case 1:return i[t];case 2:return o[t];case 4:return n[t];case 3:return r[t]}else{if(pi(i,t))return s[t]=1,i[t];if(o!==_&&L(o,t))return s[t]=2,o[t];if((l=e.propsOptions[0])&&L(l,t))return s[t]=3,r[t];if(n!==_&&L(n,t))return s[t]=4,n[t];gi&&(s[t]=0)}}const d=hi[t];let u,h;return d?("$attrs"===t&&Ye(e.attrs,0,""),d(e)):(u=a.__cssModules)&&(u=u[t])?u:n!==_&&L(n,t)?(s[t]=4,n[t]):(h=c.config.globalProperties,L(h,t)?h[t]:void 0)},set({_:e},t,n){const{data:i,setupState:o,ctx:r}=e;return pi(o,t)?(o[t]=n,!0):i!==_&&L(i,t)?(i[t]=n,!0):!(L(e.props,t)||"$"===t[0]&&t.slice(1)in e||(r[t]=n,0))},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:o,propsOptions:r,type:s}},a){let c,l;return!!(n[a]||e!==_&&"$"!==a[0]&&L(e,a)||pi(t,a)||(c=r[0])&&L(c,a)||L(i,a)||L(hi,a)||L(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return null!=n.get?e._.accessCache[t]=0:L(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function fi(e){return j(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}let gi=!0;function vi(e,t,n){Yt(j(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function bi(e,t,n,i){let o=i.includes(".")?oo(n,i):()=>n[i];if(z(e)){const n=t[e];B(n)&&to(o,n)}else if(B(e))to(o,e.bind(n));else if($(e))if(j(e))e.forEach(e=>bi(e,t,n,i));else{const i=B(e.handler)?e.handler.bind(n):t[e.handler];B(i)&&to(o,i,e)}}function yi(e){const t=e.type,{mixins:n,extends:i}=t,{mixins:o,optionsCache:r,config:{optionMergeStrategies:s}}=e.appContext,a=r.get(t);let c;return a?c=a:o.length||n||i?(c={},o.length&&o.forEach(e=>ki(c,e,s,!0)),ki(c,t,s)):c=t,$(t)&&r.set(t,c),c}function ki(e,t,n,i=!1){const{mixins:o,extends:r}=t;r&&ki(e,r,n,!0),o&&o.forEach(t=>ki(e,t,n,!0));for(const s in t)if(i&&"expose"===s);else{const i=wi[s]||n&&n[s];e[s]=i?i(e[s],t[s]):t[s]}return e}const wi={data:Ci,props:Ei,emits:Ei,methods:xi,computed:xi,beforeCreate:Ti,created:Ti,beforeMount:Ti,mounted:Ti,beforeUpdate:Ti,updated:Ti,beforeDestroy:Ti,beforeUnmount:Ti,destroyed:Ti,unmounted:Ti,activated:Ti,deactivated:Ti,errorCaptured:Ti,serverPrefetch:Ti,components:xi,directives:xi,watch:function(e,t){if(!e)return t;if(!t)return e;const n=O(Object.create(null),e);for(const i in t)n[i]=Ti(e[i],t[i]);return n},provide:Ci,inject:function(e,t){return xi(Si(e),Si(t))}};function Ci(e,t){return t?e?function(){return O(B(e)?e.call(this,this):e,B(t)?t.call(this,this):t)}:t:e}function Si(e){if(j(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ti(e,t){return e?[...new Set([].concat(e,t))]:t}function xi(e,t){return e?O(Object.create(null),e,t):t}function Ei(e,t){return e?j(e)&&j(t)?[...new Set([...e,...t])]:O(Object.create(null),fi(e),fi(null!=t?t:{})):t}function _i(){return{app:null,config:{isNativeTag:R,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Ii=0;function Pi(e,t){return function(t,n=null){B(t)||(t=O({},t)),null==n||$(n)||(n=null);const i=_i(),o=new WeakSet,r=[];let s=!1;const a=i.app={_uid:Ii++,_component:t,_props:n,_container:null,_context:i,_instance:null,version:nr,get config(){return i.config},set config(e){},use:(e,...t)=>(o.has(e)||(e&&B(e.install)?(o.add(e),e.install(a,...t)):B(e)&&(o.add(e),e(a,...t))),a),mixin:e=>(i.mixins.includes(e)||i.mixins.push(e),a),component:(e,t)=>t?(i.components[e]=t,a):i.components[e],directive:(e,t)=>t?(i.directives[e]=t,a):i.directives[e],mount(o,r,c){if(!s){const r=a._ceVNode||Oo(t,n);return r.appContext=i,!0===c?c="svg":!1===c&&(c=void 0),e(r,o,c),s=!0,a._container=o,o.__vue_app__=a,er(r.component)}},onUnmount(e){r.push(e)},unmount(){s&&(Yt(r,a._instance,16),e(null,a._container),delete a._container.__vue_app__)},provide:(e,t)=>(i.provides[e]=t,a),runWithContext(e){const t=Ri;Ri=a;try{return e()}finally{Ri=t}}};return a}}let Ri=null;function Ai(e,t,n=!1){const i=qo();if(i||Ri){let o=Ri?Ri._context.provides:i?null==i.parent||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&B(t)?t.call(i&&i.proxy):t}}const Mi={},Oi=()=>Object.create(Mi),Di=e=>Object.getPrototypeOf(e)===Mi;function Ni(e,t,n,i){const[o,r]=e.propsOptions;let s,a=!1;if(t)for(let c in t){if(J(c))continue;const l=t[c];let d;o&&L(o,d=Q(c))?r&&r.includes(d)?(s||(s={}))[d]=l:n[d]=l:lo(e.emitsOptions,c)||c in i&&l===i[c]||(i[c]=l,a=!0)}if(r){const t=Nt(n),i=s||_;for(let s=0;s<r.length;s++){const a=r[s];n[a]=Li(o,t,a,i[a],e,!L(i,a))}}return a}function Li(e,t,n,i,o,r){const s=e[n];if(null!=s){const e=L(s,"default");if(e&&void 0===i){const e=s.default;if(s.type!==Function&&!s.skipFactory&&B(e)){const{propsDefaults:r}=o;if(n in r)i=r[n];else{const s=Go(o);i=r[n]=e.call(null,t),s()}}else i=e;o.ce&&o.ce._setProp(n,i)}s[0]&&(r&&!e?i=!1:!s[1]||""!==i&&i!==ee(n)||(i=!0))}return i}const ji=new WeakMap;function Ui(e,t,n=!1){const i=n?ji:t.propsCache,o=i.get(e);if(o)return o;const r=e.props,s={},a=[];let c=!1;if(!B(e)){const i=e=>{c=!0;const[n,i]=Ui(e,t,!0);O(s,n),i&&a.push(...i)};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}if(!r&&!c)return $(e)&&i.set(e,I),I;if(j(r))for(let d=0;d<r.length;d++){const e=Q(r[d]);Fi(e)&&(s[e]=_)}else if(r)for(const d in r){const e=Q(d);if(Fi(e)){const t=r[d],n=s[e]=j(t)||B(t)?{type:t}:O({},t),i=n.type;let o=!1,c=!0;if(j(i))for(let e=0;e<i.length;++e){const t=i[e],n=B(t)&&t.name;if("Boolean"===n){o=!0;break}"String"===n&&(c=!1)}else o=B(i)&&"Boolean"===i.name;n[0]=o,n[1]=c,(o||L(n,"default"))&&a.push(e)}}const l=[s,a];return $(e)&&i.set(e,l),l}function Fi(e){return"$"!==e[0]&&!J(e)}const Bi=e=>"_"===e||"_ctx"===e||"$stable"===e,zi=e=>j(e)?e.map(jo):[jo(e)],Vi=(e,t,n)=>{if(t._n)return t;const i=vn((...e)=>zi(t(...e)),n);return i._c=!1,i},$i=(e,t,n)=>{const i=e._ctx;for(const o in e){if(Bi(o))continue;const n=e[o];if(B(n))t[o]=Vi(0,n,i);else if(null!=n){const e=zi(n);t[o]=()=>e}}},qi=(e,t)=>{const n=zi(t);e.slots.default=()=>n},Wi=(e,t,n)=>{for(const i in t)!n&&Bi(i)||(e[i]=t[i])},Hi=function(e,t){var n;t&&t.pendingBranch?j(e)?t.effects.push(...e):t.effects.push(e):(j(n=e)?tn.push(...n):nn&&-1===n.id?nn.splice(on+1,0,n):1&n.flags||(tn.push(n),n.flags|=1),ln())};function Gi(e){return function(e){ce().__VUE__=!0;const{insert:t,remove:n,patchProp:i,createElement:o,createText:r,createComment:s,setText:a,setElementText:c,parentNode:l,nextSibling:d,setScopeId:u=P,insertStaticContent:h}=e,p=(e,t,n,i=null,o=null,r=null,s=void 0,a=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!Po(e,t)&&(i=$(e),U(e,o,r,!0),e=null),-2===t.patchFlag&&(c=!1,t.dynamicChildren=null);const{type:l,ref:d,shapeFlag:u}=t;switch(l){case vo:m(e,t,n,i);break;case bo:f(e,t,n,i);break;case yo:null==e&&g(t,n,i,s);break;case go:T(e,t,n,i,o,r,s,a,c);break;default:1&u?v(e,t,n,i,o,r,s,a,c):6&u?x(e,t,n,i,o,r,s,a,c):(64&u||128&u)&&l.process(e,t,n,i,o,r,s,a,c,G)}null!=d&&o?Fn(d,e&&e.ref,r,t||e,!t):null==d&&e&&null!=e.ref&&Fn(e.ref,null,r,e,!0)},m=(e,n,i,o)=>{if(null==e)t(n.el=r(n.children),i,o);else{const t=n.el=e.el;n.children!==e.children&&a(t,n.children)}},f=(e,n,i,o)=>{null==e?t(n.el=s(n.children||""),i,o):n.el=e.el},g=(e,t,n,i)=>{[e.el,e.anchor]=h(e.children,t,n,i,e.el,e.anchor)},v=(e,t,n,i,o,r,s,a,c)=>{"svg"===t.type?s="svg":"math"===t.type&&(s="mathml"),null==e?b(t,n,i,o,r,s,a,c):w(e,t,o,r,s,a,c)},b=(e,n,r,s,a,l,d,u)=>{let h,p;const{props:m,shapeFlag:f,transition:g,dirs:v}=e;if(h=e.el=o(e.type,l,m&&m.is,m),8&f?c(h,e.children):16&f&&k(e.children,h,null,s,a,Zi(e,l),d,u),v&&yn(e,null,s,"created"),y(h,e,e.scopeId,d,s),m){for(const e in m)"value"===e||J(e)||i(h,e,null,m[e],l,s);"value"in m&&i(h,"value",null,m.value,l),(p=m.onVnodeBeforeMount)&&Bo(p,s,e)}v&&yn(e,null,s,"beforeMount");const b=function(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}(a,g);b&&g.beforeEnter(h),t(h,n,r),((p=m&&m.onVnodeMounted)||b||v)&&Hi(()=>{p&&Bo(p,s,e),b&&g.enter(h),v&&yn(e,null,s,"mounted")},a)},y=(e,t,n,i,o)=>{if(n&&u(e,n),i)for(let r=0;r<i.length;r++)u(e,i[r]);if(o){let n=o.subTree;if(t===n||fo(n.type)&&(n.ssContent===t||n.ssFallback===t)){const t=o.vnode;y(e,t,t.scopeId,t.slotScopeIds,o.parent)}}},k=(e,t,n,i,o,r,s,a,c=0)=>{for(let l=c;l<e.length;l++){const c=e[l]=a?Uo(e[l]):jo(e[l]);p(null,c,t,n,i,o,r,s,a)}},w=(e,t,n,o,r,s,a)=>{const l=t.el=e.el;let{patchFlag:d,dynamicChildren:u,dirs:h}=t;d|=16&e.patchFlag;const p=e.props||_,m=t.props||_;let f;if(n&&Ji(n,!1),(f=m.onVnodeBeforeUpdate)&&Bo(f,n,t,e),h&&yn(t,e,n,"beforeUpdate"),n&&Ji(n,!0),(p.innerHTML&&null==m.innerHTML||p.textContent&&null==m.textContent)&&c(l,""),u?C(e.dynamicChildren,u,l,n,o,Zi(t,r),s):a||O(e,t,l,null,n,o,Zi(t,r),s,!1),d>0){if(16&d)S(l,p,m,n,r);else if(2&d&&p.class!==m.class&&i(l,"class",null,m.class,r),4&d&&i(l,"style",p.style,m.style,r),8&d){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const o=e[t],s=p[o],a=m[o];a===s&&"value"!==o||i(l,o,s,a,r,n)}}1&d&&e.children!==t.children&&c(l,t.children)}else a||null!=u||S(l,p,m,n,r);((f=m.onVnodeUpdated)||h)&&Hi(()=>{f&&Bo(f,n,t,e),h&&yn(t,e,n,"updated")},o)},C=(e,t,n,i,o,r,s)=>{for(let a=0;a<t.length;a++){const c=e[a],d=t[a],u=c.el&&(c.type===go||!Po(c,d)||198&c.shapeFlag)?l(c.el):n;p(c,d,u,null,i,o,r,s,!0)}},S=(e,t,n,o,r)=>{if(t!==n){if(t!==_)for(const s in t)J(s)||s in n||i(e,s,t[s],null,r,o);for(const s in n){if(J(s))continue;const a=n[s],c=t[s];a!==c&&"value"!==s&&i(e,s,c,a,r,o)}"value"in n&&i(e,"value",t.value,n.value,r)}},T=(e,n,i,o,s,a,c,l,d)=>{const u=n.el=e?e.el:r(""),h=n.anchor=e?e.anchor:r("");let{patchFlag:p,dynamicChildren:m,slotScopeIds:f}=n;f&&(l=l?l.concat(f):f),null==e?(t(u,i,o),t(h,i,o),k(n.children||[],i,h,s,a,c,l,d)):p>0&&64&p&&m&&e.dynamicChildren?(C(e.dynamicChildren,m,i,s,a,c,l),(null!=n.key||s&&n===s.subTree)&&Ki(e,n,!0)):O(e,n,i,h,s,a,c,l,d)},x=(e,t,n,i,o,r,s,a,c)=>{t.slotScopeIds=a,null==e?512&t.shapeFlag?o.ctx.activate(t,n,i,s,c):E(t,n,i,o,r,s,c):R(e,t,c)},E=(e,t,n,i,o,r,s)=>{const a=e.component=function(e,t,n){const i=e.type,o=(t?t.appContext:e.appContext)||zo,r={uid:Vo++,vnode:e,type:i,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Se(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Ui(i,o),emitsOptions:co(i,o),emit:null,emitted:null,propsDefaults:_,inheritAttrs:i.inheritAttrs,ctx:_,data:_,props:_,attrs:_,slots:_,refs:_,setupState:_,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return r.ctx={_:r},r.root=t?t.root:r,r.emit=so.bind(null,r),e.ce&&e.ce(r),r}(e,i,o);if(Vn(e)&&(a.ctx.renderer=G),function(e,t=!1,n=!1){t&&Ho(t);const{props:i,children:o}=e.vnode,r=Jo(e);(function(e,t,n,i=!1){const o={},r=Oi();e.propsDefaults=Object.create(null),Ni(e,t,o,r);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=i?o:Rt(o,!1,gt,Ct,xt):e.type.props?e.props=o:e.props=r,e.attrs=r})(e,i,r,t),((e,t,n)=>{const i=e.slots=Oi();if(32&e.vnode.shapeFlag){const e=t._;e?(Wi(i,t,n),n&&re(i,"_",e,!0)):$i(t,i)}else t&&qi(e,t)})(e,o,n||t);r&&function(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,mi);const{setup:i}=n;if(i){Be();const n=e.setupContext=i.length>1?function(e){return{attrs:new Proxy(e.attrs,Xo),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}(e):null,o=Go(e),r=Kt(i,e,0,[e.props,n]),s=q(r);if(ze(),o(),!s&&!e.sp||zn(e)||jn(e),s){if(r.then(Zo,Zo),t)return r.then(t=>{Yo(e,t)}).catch(t=>{Qt(t,e,0)});e.asyncDep=r}else Yo(e,r)}else Qo(e)}(e,t);t&&Ho(!1)}(a,!1,s),a.asyncDep){if(o&&o.registerDep(a,A,s),!e.el){const i=a.subTree=Oo(bo);f(null,i,t,n),e.placeholder=i.el}}else A(a,e,t,n,o,r,s)},R=(e,t,n)=>{const i=t.component=e.component;if(function(e,t,n){const{props:i,children:o,component:r}=e,{props:s,children:a,patchFlag:c}=t,l=r.emitsOptions;if(t.dirs||t.transition)return!0;if(!(n&&c>=0))return!(!o&&!a||a&&a.$stable)||i!==s&&(i?!s||mo(i,s,l):!!s);if(1024&c)return!0;if(16&c)return i?mo(i,s,l):!!s;if(8&c){const e=t.dynamicProps;for(let t=0;t<e.length;t++){const n=e[t];if(s[n]!==i[n]&&!lo(l,n))return!0}}return!1}(e,t,n)){if(i.asyncDep&&!i.asyncResolved)return void M(i,t,n);i.next=t,i.update()}else t.el=e.el,i.vnode=t},A=(e,t,n,i,o,r,s)=>{const a=()=>{if(e.isMounted){let{next:t,bu:n,u:i,parent:c,vnode:d}=e;{const n=Yi(e);if(n)return t&&(t.el=d.el,M(e,t,s)),void n.asyncDep.then(()=>{e.isUnmounted||a()})}let u,h=t;Ji(e,!1),t?(t.el=d.el,M(e,t,s)):t=d,n&&oe(n),(u=t.props&&t.props.onVnodeBeforeUpdate)&&Bo(u,c,t,d),Ji(e,!0);const m=uo(e),f=e.subTree;e.subTree=m,p(f,m,l(f.el),$(f),e,o,r),t.el=m.el,null===h&&function({vnode:e,parent:t},n){for(;t;){const i=t.subTree;if(i.suspense&&i.suspense.activeBranch===e&&(i.el=e.el),i!==e)break;(e=t.vnode).el=n,t=t.parent}}(e,m.el),i&&Hi(i,o),(u=t.props&&t.props.onVnodeUpdated)&&Hi(()=>Bo(u,c,t,d),o)}else{let s;const{el:a,props:c}=t,{bm:l,m:d,parent:u,root:h,type:m}=e,f=zn(t);Ji(e,!1),l&&oe(l),!f&&(s=c&&c.onVnodeBeforeMount)&&Bo(s,u,t),Ji(e,!0);{h.ce&&!1!==h.ce._def.shadowRoot&&h.ce._injectChildStyle(m);const s=e.subTree=uo(e);p(null,s,n,i,e,o,r),t.el=s.el}if(d&&Hi(d,o),!f&&(s=c&&c.onVnodeMounted)){const e=t;Hi(()=>Bo(s,u,e),o)}(256&t.shapeFlag||u&&zn(u.vnode)&&256&u.vnode.shapeFlag)&&e.a&&Hi(e.a,o),e.isMounted=!0,t=n=i=null}};e.scope.on();const c=e.effect=new xe(a);e.scope.off();const d=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>cn(u),Ji(e,!0),d()},M=(e,t,n)=>{t.component=e;const i=e.vnode.props;e.vnode=t,e.next=null,function(e,t,n,i){const{props:o,attrs:r,vnode:{patchFlag:s}}=e,a=Nt(o),[c]=e.propsOptions;let l=!1;if(!(i||s>0)||16&s){let i;Ni(e,t,o,r)&&(l=!0);for(const r in a)t&&(L(t,r)||(i=ee(r))!==r&&L(t,i))||(c?!n||void 0===n[r]&&void 0===n[i]||(o[r]=Li(c,a,r,void 0,e,!0)):delete o[r]);if(r!==a)for(const e in r)t&&L(t,e)||(delete r[e],l=!0)}else if(8&s){const n=e.vnode.dynamicProps;for(let i=0;i<n.length;i++){let s=n[i];if(lo(e.emitsOptions,s))continue;const d=t[s];if(c)if(L(r,s))d!==r[s]&&(r[s]=d,l=!0);else{const t=Q(s);o[t]=Li(c,a,t,d,e,!1)}else d!==r[s]&&(r[s]=d,l=!0)}}l&&Qe(e.attrs,"set","")}(e,t.props,i,n),((e,t,n)=>{const{vnode:i,slots:o}=e;let r=!0,s=_;if(32&i.shapeFlag){const e=t._;e?n&&1===e?r=!1:Wi(o,t,n):(r=!t.$stable,$i(t,o)),s=t}else t&&(qi(e,t),s={default:1});if(r)for(const a in o)Bi(a)||null!=s[a]||delete o[a]})(e,t.children,n),Be(),dn(e),ze()},O=(e,t,n,i,o,r,s,a,l=!1)=>{const d=e&&e.children,u=e?e.shapeFlag:0,h=t.children,{patchFlag:p,shapeFlag:m}=t;if(p>0){if(128&p)return void N(d,h,n,i,o,r,s,a,l);if(256&p)return void D(d,h,n,i,o,r,s,a,l)}8&m?(16&u&&V(d,o,r),h!==d&&c(n,h)):16&u?16&m?N(d,h,n,i,o,r,s,a,l):V(d,o,r,!0):(8&u&&c(n,""),16&m&&k(h,n,i,o,r,s,a,l))},D=(e,t,n,i,o,r,s,a,c)=>{t=t||I;const l=(e=e||I).length,d=t.length,u=Math.min(l,d);let h;for(h=0;h<u;h++){const i=t[h]=c?Uo(t[h]):jo(t[h]);p(e[h],i,n,null,o,r,s,a,c)}l>d?V(e,o,r,!0,!1,u):k(t,n,i,o,r,s,a,c,u)},N=(e,t,n,i,o,r,s,a,c)=>{let l=0;const d=t.length;let u=e.length-1,h=d-1;for(;l<=u&&l<=h;){const i=e[l],d=t[l]=c?Uo(t[l]):jo(t[l]);if(!Po(i,d))break;p(i,d,n,null,o,r,s,a,c),l++}for(;l<=u&&l<=h;){const i=e[u],l=t[h]=c?Uo(t[h]):jo(t[h]);if(!Po(i,l))break;p(i,l,n,null,o,r,s,a,c),u--,h--}if(l>u){if(l<=h){const e=h+1,u=e<d?t[e].el:i;for(;l<=h;)p(null,t[l]=c?Uo(t[l]):jo(t[l]),n,u,o,r,s,a,c),l++}}else if(l>h)for(;l<=u;)U(e[l],o,r,!0),l++;else{const m=l,f=l,g=new Map;for(l=f;l<=h;l++){const e=t[l]=c?Uo(t[l]):jo(t[l]);null!=e.key&&g.set(e.key,l)}let v,b=0;const y=h-f+1;let k=!1,w=0;const C=new Array(y);for(l=0;l<y;l++)C[l]=0;for(l=m;l<=u;l++){const i=e[l];if(b>=y){U(i,o,r,!0);continue}let d;if(null!=i.key)d=g.get(i.key);else for(v=f;v<=h;v++)if(0===C[v-f]&&Po(i,t[v])){d=v;break}void 0===d?U(i,o,r,!0):(C[d-f]=l+1,d>=w?w=d:k=!0,p(i,t[d],n,null,o,r,s,a,c),b++)}const S=k?function(e){const t=e.slice(),n=[0];let i,o,r,s,a;const c=e.length;for(i=0;i<c;i++){const c=e[i];if(0!==c){if(o=n[n.length-1],e[o]<c){t[i]=o,n.push(i);continue}for(r=0,s=n.length-1;r<s;)a=r+s>>1,e[n[a]]<c?r=a+1:s=a;c<e[n[r]]&&(r>0&&(t[i]=n[r-1]),n[r]=i)}}for(r=n.length,s=n[r-1];r-- >0;)n[r]=s,s=t[s];return n}(C):I;for(v=S.length-1,l=y-1;l>=0;l--){const e=f+l,u=t[e],h=t[e+1],m=e+1<d?h.el||h.placeholder:i;0===C[l]?p(null,u,n,m,o,r,s,a,c):k&&(v<0||l!==S[v]?j(u,n,m,2):v--)}}},j=(e,i,o,r,s=null)=>{const{el:a,type:c,transition:l,children:u,shapeFlag:h}=e;if(6&h)j(e.component.subTree,i,o,r);else if(128&h)e.suspense.move(i,o,r);else if(64&h)c.move(e,i,o,G);else if(c!==go)if(c!==yo)if(2!==r&&1&h&&l)if(0===r)l.beforeEnter(a),t(a,i,o),Hi(()=>l.enter(a),s);else{const{leave:r,delayLeave:s,afterLeave:c}=l,d=()=>{e.ctx.isUnmounted?n(a):t(a,i,o)},u=()=>{a._isLeaving&&a[Cn](!0),r(a,()=>{d(),c&&c()})};s?s(a,d,u):u()}else t(a,i,o);else(({el:e,anchor:n},i,o)=>{let r;for(;e&&e!==n;)r=d(e),t(e,i,o),e=r;t(n,i,o)})(e,i,o);else{t(a,i,o);for(let e=0;e<u.length;e++)j(u[e],i,o,r);t(e.anchor,i,o)}},U=(e,t,n,i=!1,o=!1)=>{const{type:r,props:s,ref:a,children:c,dynamicChildren:l,shapeFlag:d,patchFlag:u,dirs:h,cacheIndex:p}=e;if(-2===u&&(o=!1),null!=a&&(Be(),Fn(a,null,n,e,!0),ze()),null!=p&&(t.renderCache[p]=void 0),256&d)return void t.ctx.deactivate(e);const m=1&d&&h,f=!zn(e);let g;if(f&&(g=s&&s.onVnodeBeforeUnmount)&&Bo(g,t,e),6&d)z(e.component,n,i);else{if(128&d)return void e.suspense.unmount(n,i);m&&yn(e,null,t,"beforeUnmount"),64&d?e.type.remove(e,t,n,G,i):l&&!l.hasOnce&&(r!==go||u>0&&64&u)?V(l,t,n,!1,!0):(r===go&&384&u||!o&&16&d)&&V(c,t,n),i&&F(e)}(f&&(g=s&&s.onVnodeUnmounted)||m)&&Hi(()=>{g&&Bo(g,t,e),m&&yn(e,null,t,"unmounted")},n)},F=e=>{const{type:t,el:i,anchor:o,transition:r}=e;if(t===go)return void B(i,o);if(t===yo)return void(({el:e,anchor:t})=>{let i;for(;e&&e!==t;)i=d(e),n(e),e=i;n(t)})(e);const s=()=>{n(i),r&&!r.persisted&&r.afterLeave&&r.afterLeave()};if(1&e.shapeFlag&&r&&!r.persisted){const{leave:t,delayLeave:n}=r,o=()=>t(i,s);n?n(e.el,s,o):o()}else s()},B=(e,t)=>{let i;for(;e!==t;)i=d(e),n(e),e=i;n(t)},z=(e,t,n)=>{const{bum:i,scope:o,job:r,subTree:s,um:a,m:c,a:l}=e;Qi(c),Qi(l),i&&oe(i),o.stop(),r&&(r.flags|=8,U(s,e,t,n)),a&&Hi(a,t),Hi(()=>{e.isUnmounted=!0},t)},V=(e,t,n,i=!1,o=!1,r=0)=>{for(let s=r;s<e.length;s++)U(e[s],t,n,i,o)},$=e=>{if(6&e.shapeFlag)return $(e.component.subTree);if(128&e.shapeFlag)return e.suspense.next();const t=d(e.anchor||e.el),n=t&&t[kn];return n?d(n):t};let W=!1;const H=(e,t,n)=>{null==e?t._vnode&&U(t._vnode,null,null,!0):p(t._vnode||null,e,t,null,null,null,n),t._vnode=e,W||(W=!0,dn(),un(),W=!1)},G={p:p,um:U,m:j,r:F,mt:E,mc:k,pc:O,pbc:C,n:$,o:e};return{render:H,hydrate:undefined,createApp:Pi(H)}}(e)}function Zi({type:e,props:t},n){return"svg"===n&&"foreignObject"===e||"mathml"===n&&"annotation-xml"===e&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Ji({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Ki(e,t,n=!1){const i=e.children,o=t.children;if(j(i)&&j(o))for(let r=0;r<i.length;r++){const e=i[r];let t=o[r];1&t.shapeFlag&&!t.dynamicChildren&&((t.patchFlag<=0||32===t.patchFlag)&&(t=o[r]=Uo(o[r]),t.el=e.el),n||-2===t.patchFlag||Ki(e,t)),t.type===vo&&-1!==t.patchFlag&&(t.el=e.el),t.type!==bo||t.el||(t.el=e.el)}}function Yi(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Yi(t)}function Qi(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}const Xi=Symbol.for("v-scx"),eo=()=>Ai(Xi);function to(e,t,n){return no(e,t,n)}function no(e,t,n=_){const{immediate:i,deep:o,flush:r,once:s}=n,a=O({},n),c=t&&i||!t&&"post"!==r;let l;if(Ko)if("sync"===r){const e=eo();l=e.__watcherHandles||(e.__watcherHandles=[])}else if(!c){const e=()=>{};return e.stop=P,e.resume=P,e.pause=P,e}const d=$o;a.call=(e,t,n)=>Yt(e,d,t,n);let u=!1;"post"===r?a.scheduler=e=>{Hi(e,d&&d.suspense)}:"sync"!==r&&(u=!0,a.scheduler=(e,t)=>{t?e():cn(e)}),a.augmentJob=e=>{t&&(e.flags|=4),u&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};const h=function(e,t,n=_){const{immediate:i,deep:o,once:r,scheduler:s,augmentJob:a,call:c}=n,l=e=>o?e:Ot(e)||!1===o||0===o?Jt(e,1):Jt(e);let d,u,h,p,m=!1,f=!1;if(Ut(e)?(u=()=>e.value,m=Ot(e)):At(e)?(u=()=>l(e),m=!0):j(e)?(f=!0,m=e.some(e=>At(e)||Ot(e)),u=()=>e.map(e=>Ut(e)?e.value:At(e)?l(e):B(e)?c?c(e,2):e():void 0)):u=B(e)?t?c?()=>c(e,2):e:()=>{if(h){Be();try{h()}finally{ze()}}const t=Zt;Zt=d;try{return c?c(e,3,[p]):e(p)}finally{Zt=t}}:P,t&&o){const e=u,t=!0===o?1/0:o;u=()=>Jt(e(),t)}const g=we,v=()=>{d.stop(),g&&g.active&&D(g.effects,d)};if(r&&t){const e=t;t=(...t)=>{e(...t),v()}}let b=f?new Array(e.length).fill(Ht):Ht;const y=e=>{if(1&d.flags&&(d.dirty||e))if(t){const e=d.run();if(o||m||(f?e.some((e,t)=>ie(e,b[t])):ie(e,b))){h&&h();const n=Zt;Zt=d;try{const n=[e,b===Ht?void 0:f&&b[0]===Ht?[]:b,p];b=e,c?c(t,3,n):t(...n)}finally{Zt=n}}}else d.run()};return a&&a(y),d=new xe(u),d.scheduler=s?()=>s(y,!1):y,p=e=>function(e,t=!1,n=Zt){if(n){let t=Gt.get(n);t||Gt.set(n,t=[]),t.push(e)}}(e,!1,d),h=d.onStop=()=>{const e=Gt.get(d);if(e){if(c)c(e,4);else for(const t of e)t();Gt.delete(d)}},t?i?y(!0):b=d.run():s?s(y.bind(null,!0),!0):d.run(),v.pause=d.pause.bind(d),v.resume=d.resume.bind(d),v.stop=v,v}(e,t,a);return Ko&&(l?l.push(h):c&&h()),h}function io(e,t,n){const i=this.proxy,o=z(e)?e.includes(".")?oo(i,e):()=>i[e]:e.bind(i,i);let r;B(t)?r=t:(r=t.handler,n=t);const s=Go(this),a=no(o,r.bind(i),n);return s(),a}function oo(e,t){const n=t.split(".");return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}const ro=(e,t)=>"modelValue"===t||"model-value"===t?e.modelModifiers:e[`${t}Modifiers`]||e[`${Q(t)}Modifiers`]||e[`${ee(t)}Modifiers`];function so(e,t,...n){if(e.isUnmounted)return;const i=e.vnode.props||_;let o=n;const r=t.startsWith("update:"),s=r&&ro(i,t.slice(7));let a;s&&(s.trim&&(o=n.map(e=>z(e)?e.trim():e)),s.number&&(o=n.map(se)));let c=i[a=ne(t)]||i[a=ne(Q(t))];!c&&r&&(c=i[a=ne(ee(t))]),c&&Yt(c,e,6,o);const l=i[a+"Once"];if(l){if(e.emitted){if(e.emitted[a])return}else e.emitted={};e.emitted[a]=!0,Yt(l,e,6,o)}}const ao=new WeakMap;function co(e,t,n=!1){const i=n?ao:t.emitsCache,o=i.get(e);if(void 0!==o)return o;const r=e.emits;let s={},a=!1;if(!B(e)){const i=e=>{const n=co(e,t,!0);n&&(a=!0,O(s,n))};!n&&t.mixins.length&&t.mixins.forEach(i),e.extends&&i(e.extends),e.mixins&&e.mixins.forEach(i)}return r||a?(j(r)?r.forEach(e=>s[e]=null):O(s,r),$(e)&&i.set(e,s),s):($(e)&&i.set(e,null),null)}function lo(e,t){return!(!e||!A(t))&&(t=t.slice(2).replace(/Once$/,""),L(e,t[0].toLowerCase()+t.slice(1))||L(e,ee(t))||L(e,t))}function uo(e){const{type:t,vnode:n,proxy:i,withProxy:o,propsOptions:[r],slots:s,attrs:a,emit:c,render:l,renderCache:d,props:u,data:h,setupState:p,ctx:m,inheritAttrs:f}=e,g=gn(e);let v,b;try{if(4&n.shapeFlag){const e=o||i,t=e;v=jo(l.call(t,e,d,u,p,h,m)),b=a}else{const e=t;v=jo(e.length>1?e(u,{attrs:a,slots:s,emit:c}):e(u,null)),b=t.props?a:ho(a)}}catch(k){ko.length=0,Qt(k,e,1),v=Oo(bo)}let y=v;if(b&&!1!==f){const e=Object.keys(b),{shapeFlag:t}=y;e.length&&7&t&&(r&&e.some(M)&&(b=po(b,r)),y=Do(y,b,!1,!0))}return n.dirs&&(y=Do(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&Dn(y,n.transition),v=y,gn(g),v}const ho=e=>{let t;for(const n in e)("class"===n||"style"===n||A(n))&&((t||(t={}))[n]=e[n]);return t},po=(e,t)=>{const n={};for(const i in e)M(i)&&i.slice(9)in t||(n[i]=e[i]);return n};function mo(e,t,n){const i=Object.keys(t);if(i.length!==Object.keys(e).length)return!0;for(let o=0;o<i.length;o++){const r=i[o];if(t[r]!==e[r]&&!lo(n,r))return!0}return!1}const fo=e=>e.__isSuspense,go=Symbol.for("v-fgt"),vo=Symbol.for("v-txt"),bo=Symbol.for("v-cmt"),yo=Symbol.for("v-stc"),ko=[];let wo=null;function Co(e=!1){ko.push(wo=e?null:[])}let So=1;function To(e,t=!1){So+=e,e<0&&wo&&t&&(wo.hasOnce=!0)}function xo(e){return e.dynamicChildren=So>0?wo||I:null,ko.pop(),wo=ko[ko.length-1]||null,So>0&&wo&&wo.push(e),e}function Eo(e,t,n,i,o,r){return xo(Mo(e,t,n,i,o,r,!0))}function _o(e,t,n,i,o){return xo(Oo(e,t,n,i,o,!0))}function Io(e){return!!e&&!0===e.__v_isVNode}function Po(e,t){return e.type===t.type&&e.key===t.key}const Ro=({key:e})=>null!=e?e:null,Ao=({ref:e,ref_key:t,ref_for:n})=>("number"==typeof e&&(e=""+e),null!=e?z(e)||Ut(e)||B(e)?{i:mn,r:e,k:t,f:!!n}:e:null);function Mo(e,t=null,n=null,i=0,o=null,r=(e===go?0:1),s=!1,a=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ro(t),ref:t&&Ao(t),scopeId:fn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:mn};return a?(Fo(c,n),128&r&&e.normalize(c)):n&&(c.shapeFlag|=z(n)?8:16),So>0&&!s&&wo&&(c.patchFlag>0||6&r)&&32!==c.patchFlag&&wo.push(c),c}const Oo=function(e,t=null,n=null,i=0,o=null,r=!1){if(e&&e!==ri||(e=bo),Io(e)){const i=Do(e,t,!0);return n&&Fo(i,n),So>0&&!r&&wo&&(6&i.shapeFlag?wo[wo.indexOf(e)]=i:wo.push(i)),i.patchFlag=-2,i}var s;if(B(s=e)&&"__vccOpts"in s&&(e=e.__vccOpts),t){t=function(e){return e?Dt(e)||Di(e)?O({},e):e:null}(t);let{class:e,style:n}=t;e&&!z(e)&&(t.class=me(e)),$(n)&&(Dt(n)&&!j(n)&&(n=O({},n)),t.style=le(n))}return Mo(e,t,n,i,o,z(e)?1:fo(e)?128:wn(e)?64:$(e)?4:B(e)?2:0,r,!0)};function Do(e,t,n=!1,i=!1){const{props:o,ref:r,patchFlag:s,children:a,transition:c}=e,l=t?function(...e){const t={};for(let n=0;n<e.length;n++){const i=e[n];for(const e in i)if("class"===e)t.class!==i.class&&(t.class=me([t.class,i.class]));else if("style"===e)t.style=le([t.style,i.style]);else if(A(e)){const n=t[e],o=i[e];!o||n===o||j(n)&&n.includes(o)||(t[e]=n?[].concat(n,o):o)}else""!==e&&(t[e]=i[e])}return t}(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Ro(l),ref:t&&t.ref?n&&r?j(r)?r.concat(Ao(t)):[r,Ao(t)]:Ao(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==go?-1===s?16:16|s:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Do(e.ssContent),ssFallback:e.ssFallback&&Do(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&i&&Dn(d,c.clone(d)),d}function No(e=" ",t=0){return Oo(vo,null,e,t)}function Lo(e="",t=!1){return t?(Co(),_o(bo,null,e)):Oo(bo,null,e)}function jo(e){return null==e||"boolean"==typeof e?Oo(bo):j(e)?Oo(go,null,e.slice()):Io(e)?Uo(e):Oo(vo,null,String(e))}function Uo(e){return null===e.el&&-1!==e.patchFlag||e.memo?e:Do(e)}function Fo(e,t){let n=0;const{shapeFlag:i}=e;if(null==t)t=null;else if(j(t))n=16;else if("object"==typeof t){if(65&i){const n=t.default;return void(n&&(n._c&&(n._d=!1),Fo(e,n()),n._c&&(n._d=!0)))}{n=32;const i=t._;i||Di(t)?3===i&&mn&&(1===mn.slots._?t._=1:(t._=2,e.patchFlag|=1024)):t._ctx=mn}}else B(t)?(t={default:t,_ctx:mn},n=32):(t=String(t),64&i?(n=16,t=[No(t)]):n=8);e.children=t,e.shapeFlag|=n}function Bo(e,t,n,i=null){Yt(e,t,7,[n,i])}const zo=_i();let Vo=0,$o=null;const qo=()=>$o||mn;let Wo,Ho;{const e=ce(),t=(t,n)=>{let i;return(i=e[t])||(i=e[t]=[]),i.push(n),e=>{i.length>1?i.forEach(t=>t(e)):i[0](e)}};Wo=t("__VUE_INSTANCE_SETTERS__",e=>$o=e),Ho=t("__VUE_SSR_SETTERS__",e=>Ko=e)}const Go=e=>{const t=$o;return Wo(e),e.scope.on(),()=>{e.scope.off(),Wo(t)}},Zo=()=>{$o&&$o.scope.off(),Wo(null)};function Jo(e){return 4&e.vnode.shapeFlag}let Ko=!1;function Yo(e,t,n){B(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:$(t)&&(e.setupState=qt(t)),Qo(e)}function Qo(e,t,n){const i=e.type;e.render||(e.render=i.render||P);{const t=Go(e);Be();try{!function(e){const t=yi(e),n=e.proxy,i=e.ctx;gi=!1,t.beforeCreate&&vi(t.beforeCreate,e,"bc");const{data:o,computed:r,methods:s,watch:a,provide:c,inject:l,created:d,beforeMount:u,mounted:h,beforeUpdate:p,updated:m,activated:f,deactivated:g,beforeDestroy:v,beforeUnmount:b,destroyed:y,unmounted:k,render:w,renderTracked:C,renderTriggered:S,errorCaptured:T,serverPrefetch:x,expose:E,inheritAttrs:_,components:I,directives:R,filters:A}=t;if(l&&function(e,t){j(e)&&(e=Si(e));for(const n in e){const i=e[n];let o;o=$(i)?"default"in i?Ai(i.from||n,i.default,!0):Ai(i.from||n):Ai(i),Ut(o)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>o.value,set:e=>o.value=e}):t[n]=o}}(l,i),s)for(const P in s){const e=s[P];B(e)&&(i[P]=e.bind(n))}if(o){const t=o.call(n,n);$(t)&&(e.data=It(t))}if(gi=!0,r)for(const O in r){const e=r[O],t=B(e)?e.bind(n,n):B(e.get)?e.get.bind(n,n):P,o=!B(e)&&B(e.set)?e.set.bind(n):P,s=tr({get:t,set:o});Object.defineProperty(i,O,{enumerable:!0,configurable:!0,get:()=>s.value,set:e=>s.value=e})}if(a)for(const P in a)bi(a[P],i,n,P);if(c){const e=B(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{!function(e,t){if($o){let n=$o.provides;const i=$o.parent&&$o.parent.provides;i===n&&(n=$o.provides=Object.create(i)),n[e]=t}}(t,e[t])})}function M(e,t){j(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(d&&vi(d,e,"c"),M(Jn,u),M(Kn,h),M(Yn,p),M(Qn,m),M($n,f),M(qn,g),M(oi,T),M(ii,C),M(ni,S),M(Xn,b),M(ei,k),M(ti,x),j(E))if(E.length){const t=e.exposed||(e.exposed={});E.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||(e.exposed={});w&&e.render===P&&(e.render=w),null!=_&&(e.inheritAttrs=_),I&&(e.components=I),R&&(e.directives=R),x&&jn(e)}(e)}finally{ze(),t()}}}const Xo={get:(e,t)=>(Ye(e,0,""),e[t])};function er(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(qt((t=e.exposed,!L(t,"__v_skip")&&Object.isExtensible(t)&&re(t,"__v_skip",!0),t)),{get:(t,n)=>n in t?t[n]:n in hi?hi[n](e):void 0,has:(e,t)=>t in e||t in hi})):e.proxy;var t}const tr=(e,t)=>{const n=function(e,t,n=!1){let i,o;return B(e)?i=e:(i=e.get,o=e.set),new Wt(i,o,n)}(e,0,Ko);return n},nr="3.5.22";let ir;const or="undefined"!=typeof window&&window.trustedTypes;if(or)try{ir=or.createPolicy("vue",{createHTML:e=>e})}catch(Bx){}const rr=ir?e=>ir.createHTML(e):e=>e,sr="undefined"!=typeof document?document:null,ar=sr&&sr.createElement("template"),cr={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,i)=>{const o="svg"===t?sr.createElementNS("http://www.w3.org/2000/svg",e):"mathml"===t?sr.createElementNS("http://www.w3.org/1998/Math/MathML",e):n?sr.createElement(e,{is:n}):sr.createElement(e);return"select"===e&&i&&null!=i.multiple&&o.setAttribute("multiple",i.multiple),o},createText:e=>sr.createTextNode(e),createComment:e=>sr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>sr.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,i,o,r){const s=n?n.previousSibling:t.lastChild;if(o&&(o===r||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),o!==r&&(o=o.nextSibling););else{ar.innerHTML=rr("svg"===i?`<svg>${e}</svg>`:"mathml"===i?`<math>${e}</math>`:e);const o=ar.content;if("svg"===i||"mathml"===i){const e=o.firstChild;for(;e.firstChild;)o.appendChild(e.firstChild);o.removeChild(e)}t.insertBefore(o,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},lr="transition",dr="animation",ur=Symbol("_vtc"),hr={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},pr=O({},En,hr),mr=(e=>(e.displayName="Transition",e.props=pr,e))((e,{slots:t})=>function(e,t,n){try{To(-1);const i=arguments.length;return 2===i?$(t)&&!j(t)?Io(t)?Oo(e,null,[t]):Oo(e,t):Oo(e,null,t):(i>3?n=Array.prototype.slice.call(arguments,2):3===i&&Io(n)&&(n=[n]),Oo(e,t,n))}finally{To(1)}}(Pn,vr(e),t)),fr=(e,t=[])=>{j(e)?e.forEach(e=>e(...t)):e&&e(...t)},gr=e=>!!e&&(j(e)?e.some(e=>e.length>1):e.length>1);function vr(e){const t={};for(const I in e)I in hr||(t[I]=e[I]);if(!1===e.css)return t;const{name:n="v",type:i,duration:o,enterFromClass:r=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:c=r,appearActiveClass:l=s,appearToClass:d=a,leaveFromClass:u=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,m=function(e){if(null==e)return null;if($(e))return[br(e.enter),br(e.leave)];{const t=br(e);return[t,t]}}(o),f=m&&m[0],g=m&&m[1],{onBeforeEnter:v,onEnter:b,onEnterCancelled:y,onLeave:k,onLeaveCancelled:w,onBeforeAppear:C=v,onAppear:S=b,onAppearCancelled:T=y}=t,x=(e,t,n,i)=>{e._enterCancelled=i,kr(e,t?d:a),kr(e,t?l:s),n&&n()},E=(e,t)=>{e._isLeaving=!1,kr(e,u),kr(e,p),kr(e,h),t&&t()},_=e=>(t,n)=>{const o=e?S:b,s=()=>x(t,e,n);fr(o,[t,s]),wr(()=>{kr(t,e?c:r),yr(t,e?d:a),gr(o)||Sr(t,i,f,s)})};return O(t,{onBeforeEnter(e){fr(v,[e]),yr(e,r),yr(e,s)},onBeforeAppear(e){fr(C,[e]),yr(e,c),yr(e,l)},onEnter:_(!1),onAppear:_(!0),onLeave(e,t){e._isLeaving=!0;const n=()=>E(e,t);yr(e,u),e._enterCancelled?(yr(e,h),_r(e)):(_r(e),yr(e,h)),wr(()=>{e._isLeaving&&(kr(e,u),yr(e,p),gr(k)||Sr(e,i,g,n))}),fr(k,[e,n])},onEnterCancelled(e){x(e,!1,void 0,!0),fr(y,[e])},onAppearCancelled(e){x(e,!0,void 0,!0),fr(T,[e])},onLeaveCancelled(e){E(e),fr(w,[e])}})}function br(e){const t=(e=>{const t=z(e)?Number(e):NaN;return isNaN(t)?e:t})(e);return t}function yr(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[ur]||(e[ur]=new Set)).add(t)}function kr(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));const n=e[ur];n&&(n.delete(t),n.size||(e[ur]=void 0))}function wr(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Cr=0;function Sr(e,t,n,i){const o=e._endId=++Cr,r=()=>{o===e._endId&&i()};if(null!=n)return setTimeout(r,n);const{type:s,timeout:a,propCount:c}=Tr(e,t);if(!s)return i();const l=s+"end";let d=0;const u=()=>{e.removeEventListener(l,h),r()},h=t=>{t.target===e&&++d>=c&&u()};setTimeout(()=>{d<c&&u()},a+1),e.addEventListener(l,h)}function Tr(e,t){const n=window.getComputedStyle(e),i=e=>(n[e]||"").split(", "),o=i(`${lr}Delay`),r=i(`${lr}Duration`),s=xr(o,r),a=i(`${dr}Delay`),c=i(`${dr}Duration`),l=xr(a,c);let d=null,u=0,h=0;return t===lr?s>0&&(d=lr,u=s,h=r.length):t===dr?l>0&&(d=dr,u=l,h=c.length):(u=Math.max(s,l),d=u>0?s>l?lr:dr:null,h=d?d===lr?r.length:c.length:0),{type:d,timeout:u,propCount:h,hasTransform:d===lr&&/\b(?:transform|all)(?:,|$)/.test(i(`${lr}Property`).toString())}}function xr(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>Er(t)+Er(e[n])))}function Er(e){return"auto"===e?0:1e3*Number(e.slice(0,-1).replace(",","."))}function _r(e){return(e?e.ownerDocument:document).body.offsetHeight}const Ir=Symbol("_vod"),Pr=Symbol("_vsh"),Rr=Symbol(""),Ar=/(?:^|;)\s*display\s*:/,Mr=/\s*!important$/;function Or(e,t,n){if(j(n))n.forEach(n=>Or(e,t,n));else if(null==n&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const i=function(e,t){const n=Nr[t];if(n)return n;let i=Q(t);if("filter"!==i&&i in e)return Nr[t]=i;i=te(i);for(let o=0;o<Dr.length;o++){const n=Dr[o]+i;if(n in e)return Nr[t]=n}return t}(e,t);Mr.test(n)?e.setProperty(ee(i),n.replace(Mr,""),"important"):e[i]=n}}const Dr=["Webkit","Moz","ms"],Nr={},Lr="http://www.w3.org/1999/xlink";function jr(e,t,n,i,o,r=fe(t)){i&&t.startsWith("xlink:")?null==n?e.removeAttributeNS(Lr,t.slice(6,t.length)):e.setAttributeNS(Lr,t,n):null==n||r&&!ge(n)?e.removeAttribute(t):e.setAttribute(t,r?"":V(n)?String(n):n)}function Ur(e,t,n,i,o){if("innerHTML"===t||"textContent"===t)return void(null!=n&&(e[t]="innerHTML"===t?rr(n):n));const r=e.tagName;if("value"===t&&"PROGRESS"!==r&&!r.includes("-")){const i="OPTION"===r?e.getAttribute("value")||"":e.value,o=null==n?"checkbox"===e.type?"on":"":String(n);return i===o&&"_value"in e||(e.value=o),null==n&&e.removeAttribute(t),void(e._value=n)}let s=!1;if(""===n||null==n){const i=typeof e[t];"boolean"===i?n=ge(n):null==n&&"string"===i?(n="",s=!0):"number"===i&&(n=0,s=!0)}try{e[t]=n}catch(Bx){}s&&e.removeAttribute(o||t)}function Fr(e,t,n,i){e.addEventListener(t,n,i)}const Br=Symbol("_vei");const zr=/(?:Once|Passive|Capture)$/;let Vr=0;const $r=Promise.resolve(),qr=()=>Vr||($r.then(()=>Vr=0),Vr=Date.now()),Wr=e=>111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Hr=new WeakMap,Gr=new WeakMap,Zr=Symbol("_moveCb"),Jr=Symbol("_enterCb"),Kr=(e=>(delete e.props.mode,e))({name:"TransitionGroup",props:O({},pr,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=qo(),i=Tn();let o,r;return Qn(()=>{if(!o.length)return;const t=e.moveClass||`${e.name||"v"}-move`;if(!function(e,t,n){const i=e.cloneNode(),o=e[ur];o&&o.forEach(e=>{e.split(/\s+/).forEach(e=>e&&i.classList.remove(e))}),n.split(/\s+/).forEach(e=>e&&i.classList.add(e)),i.style.display="none";const r=1===t.nodeType?t:t.parentNode;r.appendChild(i);const{hasTransform:s}=Tr(i);return r.removeChild(i),s}(o[0].el,n.vnode.el,t))return void(o=[]);o.forEach(Yr),o.forEach(Qr);const i=o.filter(Xr);_r(n.vnode.el),i.forEach(e=>{const n=e.el,i=n.style;yr(n,t),i.transform=i.webkitTransform=i.transitionDuration="";const o=n[Zr]=e=>{e&&e.target!==n||e&&!e.propertyName.endsWith("transform")||(n.removeEventListener("transitionend",o),n[Zr]=null,kr(n,t))};n.addEventListener("transitionend",o)}),o=[]}),()=>{const s=Nt(e),a=vr(s);let c=s.tag||go;if(o=[],r)for(let e=0;e<r.length;e++){const t=r[e];t.el&&t.el instanceof Element&&(o.push(t),Dn(t,An(t,a,i,n)),Hr.set(t,t.el.getBoundingClientRect()))}r=t.default?Nn(t.default()):[];for(let e=0;e<r.length;e++){const t=r[e];null!=t.key&&Dn(t,An(t,a,i,n))}return Oo(c,null,r)}}});function Yr(e){const t=e.el;t[Zr]&&t[Zr](),t[Jr]&&t[Jr]()}function Qr(e){Gr.set(e,e.el.getBoundingClientRect())}function Xr(e){const t=Hr.get(e),n=Gr.get(e),i=t.left-n.left,o=t.top-n.top;if(i||o){const t=e.el.style;return t.transform=t.webkitTransform=`translate(${i}px,${o}px)`,t.transitionDuration="0s",e}}const es=e=>{const t=e.props["onUpdate:modelValue"]||!1;return j(t)?e=>oe(t,e):t};function ts(e){e.target.composing=!0}function ns(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const is=Symbol("_assign"),os={created(e,{modifiers:{lazy:t,trim:n,number:i}},o){e[is]=es(o);const r=i||o.props&&"number"===o.props.type;Fr(e,t?"change":"input",t=>{if(t.target.composing)return;let i=e.value;n&&(i=i.trim()),r&&(i=se(i)),e[is](i)}),n&&Fr(e,"change",()=>{e.value=e.value.trim()}),t||(Fr(e,"compositionstart",ts),Fr(e,"compositionend",ns),Fr(e,"change",ns))},mounted(e,{value:t}){e.value=null==t?"":t},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:i,trim:o,number:r}},s){if(e[is]=es(s),e.composing)return;const a=null==t?"":t;if((!r&&"number"!==e.type||/^0\d/.test(e.value)?e.value:se(e.value))!==a){if(document.activeElement===e&&"range"!==e.type){if(i&&t===n)return;if(o&&e.value.trim()===a)return}e.value=a}}},rs=["ctrl","shift","alt","meta"],ss={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&0!==e.button,middle:e=>"button"in e&&1!==e.button,right:e=>"button"in e&&2!==e.button,exact:(e,t)=>rs.some(n=>e[`${n}Key`]&&!t.includes(n))},as=(e,t)=>{const n=e._withMods||(e._withMods={}),i=t.join(".");return n[i]||(n[i]=(n,...i)=>{for(let e=0;e<t.length;e++){const i=ss[t[e]];if(i&&i(n,t))return}return e(n,...i)})},cs={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ls=(e,t)=>{const n=e._withKeys||(e._withKeys={}),i=t.join(".");return n[i]||(n[i]=n=>{if(!("key"in n))return;const i=ee(n.key);return t.some(e=>e===i||cs[e]===i)?e(n):void 0})},ds=O({patchProp:(e,t,n,i,o,r)=>{const s="svg"===o;"class"===t?function(e,t,n){const i=e[ur];i&&(t=(t?[t,...i]:[...i]).join(" ")),null==t?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}(e,i,s):"style"===t?function(e,t,n){const i=e.style,o=z(n);let r=!1;if(n&&!o){if(t)if(z(t))for(const e of t.split(";")){const t=e.slice(0,e.indexOf(":")).trim();null==n[t]&&Or(i,t,"")}else for(const e in t)null==n[e]&&Or(i,e,"");for(const e in n)"display"===e&&(r=!0),Or(i,e,n[e])}else if(o){if(t!==n){const e=i[Rr];e&&(n+=";"+e),i.cssText=n,r=Ar.test(n)}}else t&&e.removeAttribute("style");Ir in e&&(e[Ir]=r?i.display:"",e[Pr]&&(i.display="none"))}(e,n,i):A(t)?M(t)||function(e,t,n,i,o=null){const r=e[Br]||(e[Br]={}),s=r[t];if(i&&s)s.value=i;else{const[n,a]=function(e){let t;if(zr.test(e)){let n;for(t={};n=e.match(zr);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[":"===e[2]?e.slice(3):ee(e.slice(2)),t]}(t);if(i){const s=r[t]=function(e,t){const n=e=>{if(e._vts){if(e._vts<=n.attached)return}else e._vts=Date.now();Yt(function(e,t){if(j(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(e=>t=>!t._stopped&&e&&e(t))}return t}(e,n.value),t,5,[e])};return n.value=e,n.attached=qr(),n}(i,o);Fr(e,n,s,a)}else s&&(function(e,t,n,i){e.removeEventListener(t,n,i)}(e,n,s,a),r[t]=void 0)}}(e,t,0,i,r):("."===t[0]?(t=t.slice(1),1):"^"===t[0]?(t=t.slice(1),0):function(e,t,n,i){if(i)return"innerHTML"===t||"textContent"===t||!!(t in e&&Wr(t)&&B(n));if("spellcheck"===t||"draggable"===t||"translate"===t||"autocorrect"===t)return!1;if("form"===t)return!1;if("list"===t&&"INPUT"===e.tagName)return!1;if("type"===t&&"TEXTAREA"===e.tagName)return!1;if("width"===t||"height"===t){const t=e.tagName;if("IMG"===t||"VIDEO"===t||"CANVAS"===t||"SOURCE"===t)return!1}return(!Wr(t)||!z(n))&&t in e}(e,t,i,s))?(Ur(e,t,i),e.tagName.includes("-")||"value"!==t&&"checked"!==t&&"selected"!==t||jr(e,t,i,s,0,"value"!==t)):!e._isVueCE||!/[A-Z]/.test(t)&&z(i)?("true-value"===t?e._trueValue=i:"false-value"===t&&(e._falseValue=i),jr(e,t,i,s)):Ur(e,Q(t),i,0,t)}},cr);let us;var hs=(e,t,n)=>((e,t,n={})=>{let i=`${e}=${t}`;if(e.startsWith("__Secure-")&&!n.secure)throw new Error("__Secure- Cookie must have Secure attributes");if(e.startsWith("__Host-")){if(!n.secure)throw new Error("__Host- Cookie must have Secure attributes");if("/"!==n.path)throw new Error('__Host- Cookie must have Path attributes with "/"');if(n.domain)throw new Error("__Host- Cookie must not have Domain attributes")}if(n&&"number"==typeof n.maxAge&&n.maxAge>=0){if(n.maxAge>3456e4)throw new Error("Cookies Max-Age SHOULD NOT be greater than 400 days (34560000 seconds) in duration.");i+="; Max-Age="+(0|n.maxAge)}if(n.domain&&"host"!==n.prefix&&(i+=`; Domain=${n.domain}`),n.path&&(i+=`; Path=${n.path}`),n.expires){if(n.expires.getTime()-Date.now()>3456e7)throw new Error("Cookies Expires SHOULD NOT be greater than 400 days (34560000 seconds) in the future.");i+=`; Expires=${n.expires.toUTCString()}`}if(n.httpOnly&&(i+="; HttpOnly"),n.secure&&(i+="; Secure"),n.sameSite&&(i+=`; SameSite=${n.sameSite.charAt(0).toUpperCase()+n.sameSite.slice(1)}`),n.priority&&(i+=`; Priority=${n.priority.charAt(0).toUpperCase()+n.priority.slice(1)}`),n.partitioned){if(!n.secure)throw new Error("Partitioned Cookie must have Secure attributes");i+="; Partitioned"}return i})(e,t=encodeURIComponent(t),n),ps=(e,t)=>{for(const[n,i]of Object.entries(t)){const t=new RegExp("/:"+n+"(?:{[^/]+})?\\??");e=e.replace(t,i?`/${i}`:"")}return e},ms=e=>{const t=new URLSearchParams;for(const[n,i]of Object.entries(e))if(void 0!==i)if(Array.isArray(i))for(const e of i)t.append(n,e);else t.set(n,i);return t},fs=e=>/^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e)?e.replace(/\/index(?=\?|$)/,"/"):e.replace(/\/index(?=\?|$)/,"");function gs(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function vs(e,t){if(!gs(e)&&!gs(t))return t;const n={...e};for(const i in t){const e=t[i];gs(n[i])&&gs(e)?n[i]=vs(n[i],e):n[i]=e}return n}var bs=(e,t)=>new Proxy(()=>{},{get(n,i){if("string"==typeof i&&"then"!==i)return bs(e,[...t,i])},apply:(n,i,o)=>e({path:t,args:o})}),ys=class{constructor(e,t){n(this,"url"),n(this,"method"),n(this,"queryParams"),n(this,"pathParams",{}),n(this,"rBody"),n(this,"cType"),n(this,"fetch",async(e,t)=>{if(e){if(e.query&&(this.queryParams=ms(e.query)),e.form){const t=new FormData;for(const[n,i]of Object.entries(e.form))if(Array.isArray(i))for(const e of i)t.append(n,e);else t.append(n,i);this.rBody=t}e.json&&(this.rBody=JSON.stringify(e.json),this.cType="application/json"),e.param&&(this.pathParams=e.param)}let n=this.method.toUpperCase();const i={...e?.header,..."function"==typeof t?.headers?await t.headers():t?.headers};if(e?.cookie){const t=[];for(const[n,i]of Object.entries(e.cookie))t.push(hs(n,i,{path:"/"}));i.Cookie=t.join(",")}this.cType&&(i["Content-Type"]=this.cType);const o=new Headers(i??void 0);let r=this.url;r=fs(r),r=ps(r,this.pathParams),this.queryParams&&(r=r+"?"+this.queryParams.toString()),n=this.method.toUpperCase();const s=!("GET"===n||"HEAD"===n);return(t?.fetch||fetch)(r,{body:s?this.rBody:void 0,method:n,headers:o,...t?.init})}),this.url=e,this.method=t}},ks=(e,t)=>bs(function n(i){const o=[...i.path],r=o.slice(-3).reverse();if("toString"===r[0])return"name"===r[1]?r[2]||"":n.toString();if("valueOf"===r[0])return"name"===r[1]?r[2]||"":n;let s="";if(/^\$/.test(r[0])){const e=o.pop();e&&(s=e.replace(/^\$/,""))}const a=o.join("/"),c=((e,t)=>(e=e.replace(/\/+$/,""),(e+="/")+t.replace(/^\/+/,"")))(e,a);if("url"===s){let e=c;return i.args[0]&&(i.args[0].param&&(e=ps(c,i.args[0].param)),i.args[0].query&&(e=e+"?"+ms(i.args[0].query).toString())),e=fs(e),new URL(e)}if("ws"===s){const e=(i.args[0]&&i.args[0].param?ps(c,i.args[0].param):c).replace(/^http/,"ws"),n=new URL(e),o=i.args[0]?.query;return o&&Object.entries(o).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>n.searchParams.append(e,t)):n.searchParams.set(e,t)}),((...e)=>void 0!==t?.webSocket&&"function"==typeof t.webSocket?t.webSocket(...e):new WebSocket(...e))(n.toString())}const l=new ys(c,s);if(s){t??(t={});const e=vs(t,{...i.args[1]});return l.fetch(i.args[0],e)}return l},[]),ws=Object.defineProperty,Cs=(e,t)=>ws(e,"name",{value:t,configurable:!0}),Ss=(e,t,n)=>((e,t,n)=>t in e?ws(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const Ts=globalThis.process,xs=typeof window<"u",Es=typeof Ts<"u"&&!xs,_s=xs?typeof window<"u"&&window.location&&!window.location.hostname.includes("localhost"):Es&&typeof Ts<"u"&&"production"===Ts.env?.NODE_ENV,Is=!_s,Ps={error:{priority:50,color:"#FF0000",nodeColor:"\x1b[31m"},warn:{priority:40,color:"#FFA500",nodeColor:"\x1b[33m"},info:{priority:30,color:"#00ABFF",nodeColor:"\x1b[36m"},debug:{priority:20,color:"#00BD0C",nodeColor:"\x1b[32m"},trace:{priority:10,color:"#5233FF",nodeColor:"\x1b[35m"}},Rs=["password","token","secret","apikey","api_key","authorization","cookie"],As=class e{constructor(e={},t){Ss(this,"settings"),Ss(this,"enabledInBrowser",!1),Ss(this,"context"),this.context=t,this.settings={enabled:e.enabled??!0,minLevel:e.minLevel??this.getDefaultLevel(),timestamps:e.timestamps??!0},xs&&this.initBrowserLogging()}getDefaultLevel(){if(Es&&typeof Ts<"u"&&Ts.env?.LOG_LEVEL)return Ts.env.LOG_LEVEL;if(xs&&typeof localStorage<"u"){const e=localStorage.getItem("FICTION_LOG_LEVEL");if(e)return e}return _s?"info":"debug"}initBrowserLogging(){if(!xs)return;const t="true"===localStorage.getItem("FICTION_LOG"),n=window.location?.hostname||"";this.enabledInBrowser=Is||t||"localhost"===n||n.includes("127.0.0.1"),_s&&!t&&!e.hasShownHelp&&(e.hasShownHelp=!0)}shouldLog(e){return!(!this.settings.enabled||xs&&!this.enabledInBrowser)&&Ps[e].priority>=Ps[this.settings.minLevel].priority}formatTimestamp(){return(new Date).toLocaleTimeString("en-GB",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}formatISOTimestamp(){return(new Date).toISOString()}redactSensitive(e){if("object"!=typeof e||null===e)return e;if(Array.isArray(e))return e.map(e=>this.redactSensitive(e));const t={};for(const[n,i]of Object.entries(e)){const e=n.toLowerCase();Rs.some(t=>e.includes(t))?t[n]="[REDACTED]":t[n]="object"==typeof i&&null!==i?this.redactSensitive(i):i}return t}formatData(e,t=3,n=0){if(n>=t)return"[Max Depth]";if(null==e)return e;if(e instanceof Error)return{name:e.name,message:e.message,stack:_s?e.stack?.split("\n").slice(0,3).join("\n"):e.stack,...e};if(e instanceof Date)return e.toISOString();if("object"!=typeof e)return e;if(Array.isArray(e))return e.length>20&&_s?`Array(${e.length}) [${e.slice(0,3).map(e=>this.formatData(e,t,n+1)).join(", ")}, ...]`:e.map(e=>this.formatData(e,t,n+1));try{const i={},o=Object.entries(e),r=_s?50:200;for(const[e,s]of o.slice(0,r))i[e]=this.formatData(s,t,n+1);return o.length>r&&(i["..."]=o.length-r+" more properties"),this.redactSensitive(i)}catch{return"[Unserializable]"}}logToBrowser(e){if(!xs||!this.shouldLog(e.level))return;const{level:t,description:n,context:i,data:o,error:r}=e,s=Ps[t];i||this.context,t.toUpperCase(),s.color,r&&Error}async logToNode(e){if(!Es||!this.shouldLog(e.level))return;const{level:t,description:n,context:i,data:o,error:r}=e,s=i||this.context||"www";if(_s){const e={timestamp:this.formatISOTimestamp(),level:t.toUpperCase()};o&&(e.data=this.formatData(o)),r&&(e.error=this.formatData(r))}else try{const e=(await Promise.resolve().then(()=>Fx).catch(()=>null))?.default,n=Ps[t],i=this.formatTimestamp();if(e){const o=e.dim,a=e.hex(n.color);o(`${i} `),a(`${t.toUpperCase()} `);a(`(${s}): `),r&&r instanceof Error&&e&&r.stack}}catch{}}log(e){xs?this.logToBrowser(e):Es&&this.logToNode(e).catch(console.error)}error(e,t){this.log({level:"error",description:e,data:t,context:this.context})}warn(e,t){this.log({level:"warn",description:e,data:t,context:this.context})}info(e,t){this.log({level:"info",description:e,data:t,context:this.context})}debug(e,t){this.log({level:"debug",description:e,data:t,context:this.context})}trace(e,t){this.log({level:"trace",description:e,data:t,context:this.context})}isEnabled(){return!xs||this.enabledInBrowser}setLevel(e){this.settings.minLevel=e}createContextLogger(t){const n=new e(this.settings,t);return{error:Cs((e,t)=>n.error(e,t),"error"),warn:Cs((e,t)=>n.warn(e,t),"warn"),info:Cs((e,t)=>n.info(e,t),"info"),debug:Cs((e,t)=>n.debug(e,t),"debug"),trace:Cs((e,t)=>n.trace(e,t),"trace"),isEnabled:Cs(()=>n.isEnabled(),"isEnabled"),setLevel:Cs(e=>n.setLevel(e),"setLevel")}}};Cs(As,"Logger"),Ss(As,"hasShownHelp",!1);let Ms=As;function Os(e){return new Ms({},e).createContextLogger(e)}Cs(Os,"createLogger");const Ds=new Ms;Ds.error.bind(Ds),Ds.warn.bind(Ds),Ds.info.bind(Ds),Ds.debug.bind(Ds),Ds.trace.bind(Ds);const Ns=class{constructor(e,t){Ss(this,"name"),Ss(this,"settings"),Ss(this,"logger"),this.name=e,this.settings=t,this.logger=Os(e)}};Cs(Ns,"SettingsObject");let Ls=Ns;const js=class{constructor(){Ss(this,"tokenName","auth-token"),Ss(this,"tokenMaxAge",604800),Ss(this,"fallbackStorageKey","token"),Ss(this,"productionDomain",".fiction.com")}getCookie(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(const n of t){const[t,i]=n.trim().split("=");if(t===e)return decodeURIComponent(i||"")}return null}setCookie(e,t,n={}){if(typeof document>"u")return;const{secure:i=!0,sameSite:o="lax",maxAge:r=604800,domain:s,path:a="/"}=n;let c=`${e}=${encodeURIComponent(t)}`;c+=`; Path=${a}`,c+=`; Max-Age=${r}`,c+=`; SameSite=${o}`,i&&(c+="; Secure"),s&&(c+=`; Domain=${s}`),document.cookie=c}removeCookie(e,t={}){this.setCookie(e,"",{...t,maxAge:0})}getAuthToken(){const e=this.getCookie(this.tokenName);if(e)return e;if(typeof localStorage<"u"){const e=localStorage.getItem(this.fallbackStorageKey);if(e)return this.setAuthToken(e),localStorage.removeItem(this.fallbackStorageKey),e}return null}setAuthToken(e){const t=typeof window<"u"&&"localhost"!==window.location.hostname;this.setCookie(this.tokenName,e,{secure:t,sameSite:"lax",maxAge:this.tokenMaxAge,domain:t?this.productionDomain:void 0,path:"/"})}removeAuthToken(){const e=typeof window<"u"&&"localhost"!==window.location.hostname;this.removeCookie(this.tokenName,{domain:e?this.productionDomain:void 0,path:"/"}),typeof localStorage<"u"&&localStorage.removeItem(this.fallbackStorageKey)}};Cs(js,"CookieUtil");const Us=new js;function Fs(e,t){const n=e.apiBase||(e.isDev?"http://localhost:5555":"https://app.fiction.com");return ks(n,{fetch:Cs(async(e,n)=>{const i=await fetch(e,{...n,credentials:"include",headers:{...n?.headers,"Content-Type":"application/json",Authorization:`Bearer ${Us.getAuthToken()||""}`}});if(t){const e=i.json.bind(i),n=i.clone();return Object.defineProperty(n,"json",{value:Cs(async()=>{const n=await e();return"object"==typeof n&&null!==n&&"ok"in n&&("user"in n||"token"in n)&&t(n),n},"value")}),n}return i},"fetch")})}Cs(Fs,"createApiClient");let Bs=[],zs=0,Vs=Cs(e=>{let t=[],n={get:()=>(n.lc||n.listen(()=>{})(),n.value),lc:0,listen:e=>(n.lc=t.push(e),()=>{for(let t=zs+4;t<Bs.length;)Bs[t]===e?Bs.splice(t,4):t+=4;let i=t.indexOf(e);~i&&(t.splice(i,1),--n.lc||n.off())}),notify(e,i){let o=!Bs.length;for(let r of t)Bs.push(r,n.value,e,i);if(o){for(zs=0;zs<Bs.length;zs+=4)Bs[zs](Bs[zs+1],Bs[zs+2],Bs[zs+3]);Bs.length=0}},off(){},set(e){let t=n.value;t!==e&&(n.value=e,n.notify(t))},subscribe(e){let t=n.listen(e);return e(n.value),t},value:e};return n},"atom");const $s=Vs(void 0),qs=Vs(null),Ws=class{constructor(){Ss(this,"logger",Os("SDKStorage"))}syncWithGlobalStores(e,t){const n=$s.get(),i=qs.get();n&&(e.value=n),i&&(t.value=i),to(e,e=>{$s.set(e)},{immediate:!0}),to(t,e=>{qs.set(e)},{immediate:!0}),$s.subscribe(t=>{t!==e.value&&(e.value=t)}),qs.subscribe(e=>{e!==t.value&&(t.value=e)})}loadFromStorage(e,t){if(typeof window>"u")return;const n=Us.getAuthToken();n&&(t.value=n);try{const t=localStorage.getItem("fiction-user");t&&(e.value=JSON.parse(t))}catch(i){this.logger.error("Failed to load user from localStorage",{data:i})}}saveToStorage(e,t){if(!(typeof window>"u")){t.value?Us.setAuthToken(t.value):Us.removeAuthToken();try{e.value?localStorage.setItem("fiction-user",JSON.stringify(e.value)):localStorage.removeItem("fiction-user")}catch(n){this.logger.error("Failed to save user to localStorage",{data:n})}}}clearStorage(){if(!(typeof window>"u")){Us.removeAuthToken();try{localStorage.removeItem("fiction-user")}catch(e){this.logger.error("Failed to clear user from localStorage",{data:e})}$s.set(void 0),qs.set(null)}}getItem(e){if(typeof window>"u")return null;try{return localStorage.getItem(e)}catch(Bx){return this.logger.error("Failed to get item from localStorage",{key:e,error:Bx}),null}}setItem(e,t){if(!(typeof window>"u"))try{localStorage.setItem(e,t)}catch(n){this.logger.error("Failed to set item in localStorage",{key:e,error:n})}}};Cs(Ws,"SDKStorage");let Hs=Ws;const Gs=class extends Ls{constructor(e={}){super("FictionSDK",e),Ss(this,"activeUser",Ft()),Ss(this,"token",Ft(null)),Ss(this,"loading",Ft(!1)),Ss(this,"error",Ft(null)),Ss(this,"apiBase",this.settings.apiBase||void 0),Ss(this,"storage",new Hs),Ss(this,"sessionId",c({prefix:"ses"})),Ss(this,"apiClient"),Ss(this,"currentSelf",tr(()=>{const e=this.activeUser.value;if(!e?.selves)return;const t=e.primarySelfId||e.selves[0]?.selfId;return t?e.selves.find(e=>e.selfId===t):void 0})),Ss(this,"currentOrg",tr(()=>{const e=this.currentSelf.value;if(!e?.orgId)return;const t=this.activeUser.value;return t?.orgs?t.orgs.find(t=>t.orgId===e.orgId):void 0})),Ss(this,"initialized"),Ss(this,"resolveUser"),this.apiClient=Fs({isDev:this.isDev,apiBase:this.apiBase},this.processApiResponse.bind(this)),this.logger.info("FictionSDK initialized"),this.storage.loadFromStorage(this.activeUser,this.token),this.storage.syncWithGlobalStores(this.activeUser,this.token),this.initialized=new Promise(e=>{this.resolveUser=e}),this.token.value&&!this.activeUser.value?this.getCurrentUser().then(e=>{this.resolveUser&&(this.resolveUser(e),this.resolveUser=void 0)}).catch(e=>{this.logger.error("Auto user fetch failed",{data:e}),this.resolveUser&&(this.resolveUser(void 0),this.resolveUser=void 0)}):this.activeUser.value?this.resolveUser?.(this.activeUser.value):this.resolveUser?.(void 0)}get isDev(){return this.settings.isDev??(typeof window<"u"&&("localhost"===window.location.hostname||window.location.hostname.includes("127.0.0.1")))}get api(){return this.apiClient.api}processApiResponse(e){e.ok&&e.user&&(this.activeUser.value=e.user,this.logger.info("User updated from API response",{data:e.user})),e.ok&&e.token&&(this.token.value=e.token,this.storage.saveToStorage(this.activeUser,this.token),this.logger.info("Token updated from API response")),this.resolveUser&&e.ok&&(this.resolveUser(e.user),this.resolveUser=void 0)}clearSession(){this.logger.info("Clearing session"),this.activeUser.value=void 0,this.token.value=null,this.error.value=null,this.storage.clearStorage()}async sendCode(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.auth["check-email"].$post({json:{email:e}})).json();if(!t.ok)throw this.error.value=t.error,new Error(t.error)}catch(t){this.logger.error("Send code error",{data:t});const e=t instanceof Error?t.message:"Failed to send verification code";throw this.error.value=e,t}finally{this.loading.value=!1}}async verifyCode(e,t){this.loading.value=!0,this.error.value=null;try{const n=await(await this.api.auth["verify-code"].$post({json:{email:e,code:t}})).json();if(!n.ok)throw this.error.value=n.error,new Error(n.error)}catch(n){this.logger.error("Verify code error",{data:n});const e=n instanceof Error?n.message:"Failed to verify code";throw this.error.value=e,n}finally{this.loading.value=!1}}async login(e,t){this.loading.value=!0,this.error.value=null;try{const n=await(await this.api.auth.login.$post({json:{email:e,password:t}})).json();if(!n.ok)throw this.error.value=n.error,new Error(n.error)}catch(n){this.logger.error("Login error",{data:n});const e=n instanceof Error?n.message:"Login failed";throw this.error.value=e,n}finally{this.loading.value=!1}}async logout(){this.loading.value=!0,this.error.value=null;try{await this.api.auth.logout.$post(),this.activeUser.value=void 0,this.token.value=null,this.storage.clearStorage()}catch(Bx){this.logger.error("Logout error (user still logged out locally)",{data:Bx}),this.activeUser.value=void 0,this.token.value=null,this.storage.clearStorage()}finally{this.loading.value=!1}}async getCurrentUser(){if(this.token.value){this.loading.value=!0;try{const e=await(await this.api.auth.me.$get()).json();return e.ok?e.user:(this.error.value=e.error,void(e.error.includes("Authentication")&&(this.activeUser.value=void 0,this.token.value=null,this.storage.clearStorage())))}catch(Bx){return this.logger.error("Get current user error",{data:Bx}),void(this.error.value=Bx instanceof Error?Bx.message:"Failed to get user info")}finally{this.loading.value=!1}}}async getPublicSelf(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.self.public[":handle"].$get({param:{handle:e.handle}})).json();return t.ok?t.data:(this.error.value=t.error,void this.logger.error("Failed to fetch public self",{handle:e.handle,error:t.error}))}catch(t){return this.logger.error("Get public self error",{handle:e.handle,error:t}),void(this.error.value=t instanceof Error?t.message:"Failed to fetch self")}finally{this.loading.value=!1}}async requestAuthCode(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.auth["check-email"].$post({json:{email:e.email}})).json();return t.ok?(this.logger.info("Auth code requested successfully",{email:e.email}),!0):(this.error.value=t.error,this.logger.error("Failed to request auth code",{email:e.email,error:t.error}),!1)}catch(t){return this.logger.error("Request auth code error",{email:e.email,error:t}),this.error.value=t instanceof Error?t.message:"Failed to request auth code",!1}finally{this.loading.value=!1}}async loginWithCode(e){this.loading.value=!0,this.error.value=null;try{const t=await(await this.api.auth["verify-code"].$post({json:{email:e.email,code:e.code}})).json();return t.ok?(this.logger.info("Login successful",{email:e.email}),e.orgId&&!1!==e.autoCreateContact&&this.activeUser.value?.userId&&await this.autoCreateContact({userId:this.activeUser.value.userId,orgId:e.orgId}),!0):(this.error.value=t.error,this.logger.error("Login failed",{email:e.email,error:t.error}),!1)}catch(t){return this.logger.error("Login with code error",{email:e.email,error:t}),this.error.value=t instanceof Error?t.message:"Login failed",!1}finally{this.loading.value=!1}}async trackUsage(e){try{const t=this.currentSelf.value;if(!t?.orgId)return this.logger.error("Cannot track usage: no current self with orgId",{args:e}),!1;const n=await(await this.api.usage.record.$post({json:{orgId:t.orgId,selfId:e.selfId,sessionId:this.sessionId,type:e.type,quantity:e.quantity,userId:e.participantId||this.activeUser.value?.userId||"anonymous"}})).json();return!!n.ok||(this.logger.error("Failed to track usage",{error:n.error,args:e}),!1)}catch(t){return this.logger.error("Track usage error",{error:t,args:e}),!1}}async autoCreateContact(e){try{const t=await(await this.api.contact.resolve.$post({json:{userId:e.userId,orgId:e.orgId}})).json();return t.ok?(this.logger.info("Contact resolved",{userId:e.userId,orgId:e.orgId}),!0):(this.logger.error("Failed to auto-create contact",{error:t.error,args:e}),!1)}catch(t){return this.logger.error("Auto-create contact error",{error:t,args:e}),!1}}async startConversation(e){try{const t=this.currentSelf.value;if(!t?.orgId)return void this.logger.error("Cannot start conversation: no current self with orgId",{args:e});const n=await(await this.api.conversation.start.$post({json:{orgId:t.orgId,selfId:e.selfId,userId:e.userId||this.activeUser.value?.userId,anonId:e.anonId}})).json();if(!n.ok||!n.data){const t=n.ok?"No conversation data returned":"error"in n?n.error:"Unknown error";return void this.logger.error("Failed to start conversation",{error:t,args:e})}return this.logger.info("Conversation started",{conversationId:n.data.conversationId}),n.data}catch(t){return void this.logger.error("Start conversation error",{error:t,args:e})}}generateAnonId(){const e="fictionAnonId";let t=this.storage.getItem(e);return t||(t=c({prefix:"anon"}),this.storage.setItem(e,t)),t}async saveMessage(e){try{const t=await(await this.api.conversation.messages.$post({json:{sessionId:e.conversationId,participantId:e.participantId,content:e.content,role:e.role}})).json();return!!t.ok||(this.logger.error("Failed to save message",{error:"error"in t?t.error:"Unknown error",args:e}),!1)}catch(t){return this.logger.error("Save message error",{error:t,args:e}),!1}}};Cs(Gs,"FictionSDK");let Zs=Gs;function Js(e,t,n){function i(n,i){var o;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(o=n._zod).traits??(o.traits=new Set),n._zod.traits.add(e),t(n,i);for(const e in s.prototype)e in n||Object.defineProperty(n,e,{value:s.prototype[e].bind(n)});n._zod.constr=s,n._zod.def=i}const o=n?.Parent??Object;class r extends o{}function s(e){var t;const o=n?.Parent?new r:this;i(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const n of o._zod.deferred)n();return o}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(s,"init",{value:i}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Ks extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ys extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const Qs={};function Xs(e){return Qs}function ea(e,t){return"bigint"==typeof t?t.toString():t}function ta(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function na(e){return null==e}function ia(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const oa=Symbol("evaluating");function ra(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==oa)return void 0===i&&(i=oa,i=n()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function sa(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function aa(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ca(e){return JSON.stringify(e)}const la="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function da(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const ua=ta(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function ha(e){if(!1===da(e))return!1;const t=e.constructor;if(void 0===t)return!0;const n=t.prototype;return!1!==da(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function pa(e){return ha(e)?{...e}:Array.isArray(e)?[...e]:e}const ma=new Set(["string","number","symbol"]);function fa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ga(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}function va(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const ba={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function ya(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function ka(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function wa(e){return"string"==typeof e?e:e?.message}function Ca(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const o=wa(e.inst?._zod.def?.error?.(e))??wa(t?.error?.(e))??wa(n.customError?.(e))??wa(n.localeError?.(e))??"Invalid input";i.message=o}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Sa(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Ta(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}const xa=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ea,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ea=Js("$ZodError",xa),_a=Js("$ZodError",xa,{Parent:Error}),Ia=e=>(t,n,i,o)=>{const r=i?Object.assign(i,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise)throw new Ks;if(s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>Ca(e,r,Xs())));throw la(t,o?.callee),t}return s.value},Pa=e=>async(t,n,i,o)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},r);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>Ca(e,r,Xs())));throw la(t,o?.callee),t}return s.value},Ra=e=>(t,n,i)=>{const o=i?{...i,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},o);if(r instanceof Promise)throw new Ks;return r.issues.length?{success:!1,error:new(e??Ea)(r.issues.map(e=>Ca(e,o,Xs())))}:{success:!0,data:r.value}},Aa=Ra(_a),Ma=e=>async(t,n,i)=>{const o=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},o);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map(e=>Ca(e,o,Xs())))}:{success:!0,data:r.value}},Oa=Ma(_a),Da=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ia(e)(t,n,o)},Na=e=>(t,n,i)=>Ia(e)(t,n,i),La=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Pa(e)(t,n,o)},ja=e=>async(t,n,i)=>Pa(e)(t,n,i),Ua=e=>(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ra(e)(t,n,o)},Fa=e=>(t,n,i)=>Ra(e)(t,n,i),Ba=e=>async(t,n,i)=>{const o=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ma(e)(t,n,o)},za=e=>async(t,n,i)=>Ma(e)(t,n,i),Va=/^[cC][^\s-]{8,}$/,$a=/^[0-9a-z]+$/,qa=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Wa=/^[0-9a-vA-V]{20}$/,Ha=/^[A-Za-z0-9]{27}$/,Ga=/^[a-zA-Z0-9_-]{21}$/,Za=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ja=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ka=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ya=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xa=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ec=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tc=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ic=/^[A-Za-z0-9_-]*$/,oc=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,rc=/^\+(?:[0-9]){6,14}[0-9]$/,sc="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",ac=new RegExp(`^${sc}$`);function cc(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const lc=/^-?\d+$/,dc=/^-?\d+(?:\.\d+)?/,uc=/^(?:true|false)$/i,hc=/^[^A-Z]*$/,pc=/^[^a-z]*$/,mc=Js("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),fc={number:"number",bigint:"bigint",object:"date"},gc=Js("$ZodCheckLessThan",(e,t)=>{mc.init(e,t);const n=fc[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:n,code:"too_big",maximum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vc=Js("$ZodCheckGreaterThan",(e,t)=>{mc.init(e,t);const n=fc[typeof t.value];e._zod.onattach.push(e=>{const n=e._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:n,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bc=Js("$ZodCheckMultipleOf",(e,t)=>{mc.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof n.value?n.value%t.value===BigInt(0):0===function(e,t){const n=(e.toString().split(".")[1]||"").length,i=t.toString();let o=(i.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(i)){const e=i.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const r=n>o?n:o;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}(n.value,t.value))||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),yc=Js("$ZodCheckNumberFormat",(e,t)=>{mc.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),i=n?"int":"number",[o,r]=ba[t.format];e._zod.onattach.push(e=>{const i=e._zod.bag;i.format=t.format,i.minimum=o,i.maximum=r,n&&(i.pattern=lc)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a))return void s.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});if(!Number.isSafeInteger(a))return void(a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}))}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>r&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:r,inst:e})}}),kc=Js("$ZodCheckMaxLength",(e,t)=>{var n;mc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!na(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const o=Sa(i);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),wc=Js("$ZodCheckMinLength",(e,t)=>{var n;mc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!na(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const o=Sa(i);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Cc=Js("$ZodCheckLengthEquals",(e,t)=>{var n;mc.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!na(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const i=n.value,o=i.length;if(o===t.length)return;const r=Sa(i),s=o>t.length;n.issues.push({origin:r,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Sc=Js("$ZodCheckStringFormat",(e,t)=>{var n,i;mc.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),Tc=Js("$ZodCheckRegex",(e,t)=>{Sc.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xc=Js("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hc),Sc.init(e,t)}),Ec=Js("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=pc),Sc.init(e,t)}),_c=Js("$ZodCheckIncludes",(e,t)=>{mc.init(e,t);const n=fa(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Ic=Js("$ZodCheckStartsWith",(e,t)=>{mc.init(e,t);const n=new RegExp(`^${fa(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Pc=Js("$ZodCheckEndsWith",(e,t)=>{mc.init(e,t);const n=new RegExp(`.*${fa(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Rc=Js("$ZodCheckOverwrite",(e,t)=>{mc.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Ac{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),i=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const o of i)this.content.push(o)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Mc={major:4,minor:1,patch:12},Oc=Js("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mc;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const o of i)for(const t of o._zod.onattach)t(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let i,o=ya(e);for(const r of t){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,s=r._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new Ks;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(o||(o=ya(e,t)))});else{if(e.issues.length===t)continue;o||(o=ya(e,t))}}return i?i.then(()=>e):e},n=(n,o,r)=>{if(ya(n))return n.aborted=!0,n;const s=t(o,i,r);if(s instanceof Promise){if(!1===r.async)throw new Ks;return s.then(t=>e._zod.parse(t,r))}return e._zod.parse(s,r)};e._zod.run=(o,r)=>{if(r.skipChecks)return e._zod.parse(o,r);if("backward"===r.direction){const t=e._zod.parse({value:o.value,issues:[]},{...r,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,o,r)):n(t,o,r)}const s=e._zod.parse(o,r);if(s instanceof Promise){if(!1===r.async)throw new Ks;return s.then(e=>t(e,i,r))}return t(s,i,r)}}e["~standard"]={validate:t=>{try{const n=Aa(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Oa(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Dc=Js("$ZodString",(e,t)=>{var n;Oc.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Nc=Js("$ZodStringFormat",(e,t)=>{Sc.init(e,t),Dc.init(e,t)}),Lc=Js("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ja),Nc.init(e,t)}),jc=Js("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ka(e))}else t.pattern??(t.pattern=Ka());Nc.init(e,t)}),Uc=Js("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ya),Nc.init(e,t)}),Fc=Js("$ZodURL",(e,t)=>{Nc.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),o=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:oc.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=o.href:n.value=i)}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Bc=Js("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Nc.init(e,t)}),zc=Js("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ga),Nc.init(e,t)}),Vc=Js("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Va),Nc.init(e,t)}),$c=Js("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$a),Nc.init(e,t)}),qc=Js("$ZodULID",(e,t)=>{t.pattern??(t.pattern=qa),Nc.init(e,t)}),Wc=Js("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Wa),Nc.init(e,t)}),Hc=Js("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ha),Nc.init(e,t)}),Gc=Js("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=cc({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${sc}T(?:${i})$`)}(t)),Nc.init(e,t)}),Zc=Js("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ac),Nc.init(e,t)}),Jc=Js("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${cc(t)}$`)),Nc.init(e,t)}),Kc=Js("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Za),Nc.init(e,t)}),Yc=Js("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Qa),Nc.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv4"})}),Qc=Js("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xa),Nc.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Xc=Js("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ec),Nc.init(e,t)}),el=Js("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tc),Nc.init(e,t),e._zod.check=n=>{const i=n.value.split("/");try{if(2!==i.length)throw new Error;const[e,t]=i;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function tl(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const nl=Js("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=nc),Nc.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{tl(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),il=Js("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ic),Nc.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{(function(e){if(!ic.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tl(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ol=Js("$ZodE164",(e,t)=>{t.pattern??(t.pattern=rc),Nc.init(e,t)}),rl=Js("$ZodJWT",(e,t)=>{Nc.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),sl=Js("$ZodNumber",(e,t)=>{Oc.init(e,t),e._zod.pattern=e._zod.bag.pattern??dc,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const o=n.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return n;const r="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...r?{received:r}:{}}),n}}),al=Js("$ZodNumber",(e,t)=>{yc.init(e,t),sl.init(e,t)}),cl=Js("$ZodBoolean",(e,t)=>{Oc.init(e,t),e._zod.pattern=uc,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(r){}const o=n.value;return"boolean"==typeof o||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ll=Js("$ZodAny",(e,t)=>{Oc.init(e,t),e._zod.parse=e=>e}),dl=Js("$ZodUnknown",(e,t)=>{Oc.init(e,t),e._zod.parse=e=>e}),ul=Js("$ZodNever",(e,t)=>{Oc.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function hl(e,t,n){e.issues.length&&t.issues.push(...ka(n,e.issues)),t.value[n]=e.value}const pl=Js("$ZodArray",(e,t)=>{Oc.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const r=[];for(let e=0;e<o.length;e++){const s=o[e],a=t.element._zod.run({value:s,issues:[]},i);a instanceof Promise?r.push(a.then(t=>hl(t,n,e))):hl(a,n,e)}return r.length?Promise.all(r).then(()=>n):n}});function ml(e,t,n,i){e.issues.length&&t.issues.push(...ka(n,e.issues)),void 0===e.value?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function fl(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=(i=e.shape,Object.keys(i).filter(e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function gl(e,t,n,i,o,r){const s=[],a=o.keySet,c=o.catchall._zod,l=c.def.type;for(const d of Object.keys(t)){if(a.has(d))continue;if("never"===l){s.push(d);continue}const o=c.run({value:t[d],issues:[]},i);o instanceof Promise?e.push(o.then(e=>ml(e,n,d,t))):ml(o,n,d,t)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:r}),e.length?Promise.all(e).then(()=>n):n}const vl=Js("$ZodObject",(e,t)=>{Oc.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const i=ta(()=>fl(t));ra(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const i=e[t]._zod;if(i.values){n[t]??(n[t]=new Set);for(const e of i.values)n[t].add(e)}}return n});const o=da,r=t.catchall;let s;e._zod.parse=(t,n)=>{s??(s=i.value);const a=t.value;if(!o(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const c=[],l=s.shape;for(const e of s.keys){const i=l[e]._zod.run({value:a[e],issues:[]},n);i instanceof Promise?c.push(i.then(n=>ml(n,t,e,a))):ml(i,t,e,a)}return r?gl(c,a,t,n,i.value,e):c.length?Promise.all(c).then(()=>t):t}}),bl=Js("$ZodObjectJIT",(e,t)=>{vl.init(e,t);const n=e._zod.parse,i=ta(()=>fl(t));let o;const r=da,s=!Qs.jitless,a=s&&ua.value,c=t.catchall;let l;e._zod.parse=(d,u)=>{l??(l=i.value);const h=d.value;return r(h)?s&&a&&!1===u?.async&&!0!==u.jitless?(o||(o=(e=>{const t=new Ac(["shape","payload","ctx"]),n=i.value,o=e=>{const t=ca(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let s=0;for(const i of n.keys)r[i]="key_"+s++;t.write("const newResult = {};");for(const i of n.keys){const e=r[i],n=ca(i);t.write(`const ${e} = ${o(i)};`),t.write(`\n if (${e}.issues.length) {\n payload.issues = payload.issues.concat(${e}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${n}, ...iss.path] : [${n}]\n })));\n }\n \n \n if (${e}.value === undefined) {\n if (${n} in input) {\n newResult[${n}] = undefined;\n }\n } else {\n newResult[${n}] = ${e}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),d=o(d,u),c?gl([],h,d,u,l,e):d):n(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d)}});function yl(e,t,n,i){for(const r of e)if(0===r.issues.length)return t.value=r.value,t;const o=e.filter(e=>!ya(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Ca(e,i,Xs())))}),t)}const kl=Js("$ZodUnion",(e,t)=>{Oc.init(e,t),ra(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),ra(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),ra(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),ra(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>ia(e.source)).join("|")})$`)}});const n=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(o,r)=>{if(n)return i(o,r);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},r);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>yl(t,o,e,r)):yl(a,o,e,r)}}),wl=Js("$ZodDiscriminatedUnion",(e,t)=>{kl.init(e,t);const n=e._zod.parse;ra(e._zod,"propValues",()=>{const e={};for(const n of t.options){const i=n._zod.propValues;if(!i||0===Object.keys(i).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(i)){e[t]||(e[t]=new Set);for(const i of n)e[t].add(i)}}return e});const i=ta(()=>{const e=t.options,n=new Map;for(const i of e){const e=i._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,i)}}return n});e._zod.parse=(o,r)=>{const s=o.value;if(!da(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=i.value.get(s?.[t.discriminator]);return a?a._zod.run(o,r):t.unionFallback?n(o,r):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o)}}),Cl=Js("$ZodIntersection",(e,t)=>{Oc.init(e,t),e._zod.parse=(e,n)=>{const i=e.value,o=t.left._zod.run({value:i,issues:[]},n),r=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||r instanceof Promise?Promise.all([o,r]).then(([t,n])=>Tl(e,t,n)):Tl(e,o,r)}});function Sl(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(ha(e)&&ha(t)){const n=Object.keys(t),i=Object.keys(e).filter(e=>-1!==n.indexOf(e)),o={...e,...t};for(const r of i){const n=Sl(e[r],t[r]);if(!n.valid)return{valid:!1,mergeErrorPath:[r,...n.mergeErrorPath]};o[r]=n.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const o=Sl(e[i],t[i]);if(!o.valid)return{valid:!1,mergeErrorPath:[i,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Tl(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),ya(e))return e;const i=Sl(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const xl=Js("$ZodRecord",(e,t)=>{Oc.init(e,t),e._zod.parse=(n,i)=>{const o=n.value;if(!ha(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const r=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){const s=t.valueType._zod.run({value:o[e],issues:[]},i);s instanceof Promise?r.push(s.then(t=>{t.issues.length&&n.issues.push(...ka(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...ka(e,s.issues)),n.value[e]=s.value)}let a;for(const e in o)s.has(e)||(a=a??[],a.push(e));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if("__proto__"===s)continue;const a=t.keyType._zod.run({value:s,issues:[]},i);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>Ca(e,i,Xs())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:o[s],issues:[]},i);c instanceof Promise?r.push(c.then(e=>{e.issues.length&&n.issues.push(...ka(s,e.issues)),n.value[a.value]=e.value})):(c.issues.length&&n.issues.push(...ka(s,c.issues)),n.value[a.value]=c.value)}}return r.length?Promise.all(r).then(()=>n):n}}),El=Js("$ZodEnum",(e,t)=>{Oc.init(e,t);const n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(e=>ma.has(typeof e)).map(e=>"string"==typeof e?fa(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const r=t.value;return i.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}}),_l=Js("$ZodLiteral",(e,t)=>{if(Oc.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?fa(e):e?fa(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,i)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Il=Js("$ZodTransform",(e,t)=>{Oc.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new Ys(e.constructor.name);const o=t.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n));if(o instanceof Promise)throw new Ks;return n.value=o,n}});function Pl(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const Rl=Js("$ZodOptional",(e,t)=>{Oc.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ra(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ra(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ia(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(t=>Pl(t,e.value)):Pl(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Al=Js("$ZodNullable",(e,t)=>{Oc.init(e,t),ra(e._zod,"optin",()=>t.innerType._zod.optin),ra(e._zod,"optout",()=>t.innerType._zod.optout),ra(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ia(e.source)}|null)$`):void 0}),ra(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Ml=Js("$ZodDefault",(e,t)=>{Oc.init(e,t),e._zod.optin="optional",ra(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ol(e,t)):Ol(i,t)}});function Ol(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Dl=Js("$ZodPrefault",(e,t)=>{Oc.init(e,t),e._zod.optin="optional",ra(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Nl=Js("$ZodNonOptional",(e,t)=>{Oc.init(e,t),ra(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,i)=>{const o=t.innerType._zod.run(n,i);return o instanceof Promise?o.then(t=>Ll(t,e)):Ll(o,e)}});function Ll(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const jl=Js("$ZodCatch",(e,t)=>{Oc.init(e,t),ra(e._zod,"optin",()=>t.innerType._zod.optin),ra(e._zod,"optout",()=>t.innerType._zod.optout),ra(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>Ca(e,n,Xs()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>Ca(e,n,Xs()))},input:e.value}),e.issues=[]),e)}}),Ul=Js("$ZodPipe",(e,t)=>{Oc.init(e,t),ra(e._zod,"values",()=>t.in._zod.values),ra(e._zod,"optin",()=>t.in._zod.optin),ra(e._zod,"optout",()=>t.out._zod.optout),ra(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const i=t.out._zod.run(e,n);return i instanceof Promise?i.then(e=>Fl(e,t.in,n)):Fl(i,t.in,n)}const i=t.in._zod.run(e,n);return i instanceof Promise?i.then(e=>Fl(e,t.out,n)):Fl(i,t.out,n)}});function Fl(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Bl=Js("$ZodReadonly",(e,t)=>{Oc.init(e,t),ra(e._zod,"propValues",()=>t.innerType._zod.propValues),ra(e._zod,"values",()=>t.innerType._zod.values),ra(e._zod,"optin",()=>t.innerType._zod.optin),ra(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(zl):zl(i)}});function zl(e){return e.value=Object.freeze(e.value),e}const Vl=Js("$ZodCustom",(e,t)=>{mc.init(e,t),Oc.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,o=t.fn(i);if(o instanceof Promise)return o.then(t=>$l(t,n,i,e));$l(o,n,i,e)}});function $l(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(Ta(e))}}class ql{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Wl(){return new ql}const Hl=Wl();function Gl(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...va(t)})}function Zl(e,t){return new gc({check:"less_than",...va(t),value:e,inclusive:!1})}function Jl(e,t){return new gc({check:"less_than",...va(t),value:e,inclusive:!0})}function Kl(e,t){return new vc({check:"greater_than",...va(t),value:e,inclusive:!1})}function Yl(e,t){return new vc({check:"greater_than",...va(t),value:e,inclusive:!0})}function Ql(e,t){return new bc({check:"multiple_of",...va(t),value:e})}function Xl(e,t){return new kc({check:"max_length",...va(t),maximum:e})}function ed(e,t){return new wc({check:"min_length",...va(t),minimum:e})}function td(e,t){return new Cc({check:"length_equals",...va(t),length:e})}function nd(e){return new Rc({check:"overwrite",tx:e})}const id=Js("ZodISODateTime",(e,t)=>{Gc.init(e,t),Td.init(e,t)});const od=Js("ZodISODate",(e,t)=>{Zc.init(e,t),Td.init(e,t)});const rd=Js("ZodISOTime",(e,t)=>{Jc.init(e,t),Td.init(e,t)});const sd=Js("ZodISODuration",(e,t)=>{Kc.init(e,t),Td.init(e,t)});const ad=Js("ZodError",(e,t)=>{Ea.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},i=e=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>i({issues:e}));else if("invalid_key"===o.code)i({issues:o.issues});else if("invalid_element"===o.code)i({issues:o.issues});else if(0===o.path.length)n._errors.push(t(o));else{let e=n,i=0;for(;i<o.path.length;){const n=o.path[i];i===o.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))):e[n]=e[n]||{_errors:[]},e=e[n],i++}}};return i(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},i=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ea,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ea,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),cd=Ia(ad),ld=Pa(ad),dd=Ra(ad),ud=Ma(ad),hd=Da(ad),pd=Na(ad),md=La(ad),fd=ja(ad),gd=Ua(ad),vd=Fa(ad),bd=Ba(ad),yd=za(ad),kd=Js("ZodType",(e,t)=>(Oc.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(aa(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,n)=>ga(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>cd(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>dd(e,t,n),e.parseAsync=async(t,n)=>ld(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ud(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>hd(e,t,n),e.decode=(t,n)=>pd(e,t,n),e.encodeAsync=async(t,n)=>md(e,t,n),e.decodeAsync=async(t,n)=>fd(e,t,n),e.safeEncode=(t,n)=>gd(e,t,n),e.safeDecode=(t,n)=>vd(e,t,n),e.safeEncodeAsync=async(t,n)=>bd(e,t,n),e.safeDecodeAsync=async(t,n)=>yd(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...va(n)})}(Iu,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=function(e){const t=new mc({check:"custom",...va(void 0)});return t._zod.check=e,t}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(Ta(e,n.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(Ta(i))}},e(n.value,n)));return t}(t)),e.overwrite=t=>e.check(nd(t)),e.optional=()=>bu(e),e.nullable=()=>ku(e),e.nullish=()=>bu(ku(e)),e.nonoptional=t=>function(e,t){return new Su({type:"nonoptional",innerType:e,...va(t)})}(e,t),e.array=()=>iu(e),e.or=t=>au([e,t]),e.and=t=>new lu({type:"intersection",left:e,right:t}),e.transform=t=>Eu(e,new gu({type:"transform",transform:t})),e.default=t=>{return n=t,new wu({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():pa(n)}});var n},e.prefault=t=>{return n=t,new Cu({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():pa(n)}});var n},e.catch=t=>{return new Tu({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>Eu(e,t),e.readonly=()=>new _u({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Hl.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Hl.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Hl.get(e);const n=e.clone();return Hl.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),wd=Js("_ZodString",(e,t)=>{Dc.init(e,t),kd.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new Tc({check:"string_format",format:"regex",...va(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new _c({check:"string_format",format:"includes",...va(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Ic({check:"string_format",format:"starts_with",...va(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Pc({check:"string_format",format:"ends_with",...va(t),suffix:e})}(...t)),e.min=(...t)=>e.check(ed(...t)),e.max=(...t)=>e.check(Xl(...t)),e.length=(...t)=>e.check(td(...t)),e.nonempty=(...t)=>e.check(ed(1,...t)),e.lowercase=t=>e.check(function(e){return new xc({check:"string_format",format:"lowercase",...va(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Ec({check:"string_format",format:"uppercase",...va(e)})}(t)),e.trim=()=>e.check(nd(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return nd(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(nd(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(nd(e=>e.toUpperCase()))}),Cd=Js("ZodString",(e,t)=>{Dc.init(e,t),wd.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...va(t)})}(xd,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...va(t)})}(Id,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...va(t)})}($d,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...va(t)})}(Pd,t)),e.guid=t=>e.check(Gl(Ed,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...va(t)})}(_d,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...va(t)})}(_d,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...va(t)})}(_d,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...va(t)})}(_d,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...va(t)})}(Rd,t)),e.guid=t=>e.check(Gl(Ed,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...va(t)})}(Ad,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...va(t)})}(Md,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...va(t)})}(Od,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...va(t)})}(Bd,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...va(t)})}(zd,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...va(t)})}(Dd,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...va(t)})}(Nd,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...va(t)})}(Ld,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...va(t)})}(jd,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...va(t)})}(Ud,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...va(t)})}(Fd,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...va(t)})}(Vd,t)),e.datetime=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...va(t)})}(id,e)}(t)),e.date=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...va(t)})}(od,e)}(t)),e.time=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...va(t)})}(rd,e)}(t)),e.duration=t=>e.check(function(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...va(t)})}(sd,e)}(t))});function Sd(e){return function(e,t){return new e({type:"string",...va(t)})}(Cd,e)}const Td=Js("ZodStringFormat",(e,t)=>{Nc.init(e,t),wd.init(e,t)}),xd=Js("ZodEmail",(e,t)=>{Uc.init(e,t),Td.init(e,t)}),Ed=Js("ZodGUID",(e,t)=>{Lc.init(e,t),Td.init(e,t)}),_d=Js("ZodUUID",(e,t)=>{jc.init(e,t),Td.init(e,t)}),Id=Js("ZodURL",(e,t)=>{Fc.init(e,t),Td.init(e,t)}),Pd=Js("ZodEmoji",(e,t)=>{Bc.init(e,t),Td.init(e,t)}),Rd=Js("ZodNanoID",(e,t)=>{zc.init(e,t),Td.init(e,t)}),Ad=Js("ZodCUID",(e,t)=>{Vc.init(e,t),Td.init(e,t)}),Md=Js("ZodCUID2",(e,t)=>{$c.init(e,t),Td.init(e,t)}),Od=Js("ZodULID",(e,t)=>{qc.init(e,t),Td.init(e,t)}),Dd=Js("ZodXID",(e,t)=>{Wc.init(e,t),Td.init(e,t)}),Nd=Js("ZodKSUID",(e,t)=>{Hc.init(e,t),Td.init(e,t)}),Ld=Js("ZodIPv4",(e,t)=>{Yc.init(e,t),Td.init(e,t)}),jd=Js("ZodIPv6",(e,t)=>{Qc.init(e,t),Td.init(e,t)}),Ud=Js("ZodCIDRv4",(e,t)=>{Xc.init(e,t),Td.init(e,t)}),Fd=Js("ZodCIDRv6",(e,t)=>{el.init(e,t),Td.init(e,t)}),Bd=Js("ZodBase64",(e,t)=>{nl.init(e,t),Td.init(e,t)}),zd=Js("ZodBase64URL",(e,t)=>{il.init(e,t),Td.init(e,t)}),Vd=Js("ZodE164",(e,t)=>{ol.init(e,t),Td.init(e,t)}),$d=Js("ZodJWT",(e,t)=>{rl.init(e,t),Td.init(e,t)}),qd=Js("ZodNumber",(e,t)=>{sl.init(e,t),kd.init(e,t),e.gt=(t,n)=>e.check(Kl(t,n)),e.gte=(t,n)=>e.check(Yl(t,n)),e.min=(t,n)=>e.check(Yl(t,n)),e.lt=(t,n)=>e.check(Zl(t,n)),e.lte=(t,n)=>e.check(Jl(t,n)),e.max=(t,n)=>e.check(Jl(t,n)),e.int=t=>e.check(Gd(t)),e.safe=t=>e.check(Gd(t)),e.positive=t=>e.check(Kl(0,t)),e.nonnegative=t=>e.check(Yl(0,t)),e.negative=t=>e.check(Zl(0,t)),e.nonpositive=t=>e.check(Jl(0,t)),e.multipleOf=(t,n)=>e.check(Ql(t,n)),e.step=(t,n)=>e.check(Ql(t,n)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Wd(e){return function(e,t){return new e({type:"number",checks:[],...va(t)})}(qd,e)}const Hd=Js("ZodNumberFormat",(e,t)=>{al.init(e,t),qd.init(e,t)});function Gd(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...va(t)})}(Hd,e)}const Zd=Js("ZodBoolean",(e,t)=>{cl.init(e,t),kd.init(e,t)});function Jd(e){return function(e,t){return new e({type:"boolean",...va(t)})}(Zd,e)}const Kd=Js("ZodAny",(e,t)=>{ll.init(e,t),kd.init(e,t)});function Yd(){return new Kd({type:"any"})}const Qd=Js("ZodUnknown",(e,t)=>{dl.init(e,t),kd.init(e,t)});function Xd(){return new Qd({type:"unknown"})}const eu=Js("ZodNever",(e,t)=>{ul.init(e,t),kd.init(e,t)});function tu(e){return function(e,t){return new e({type:"never",...va(t)})}(eu,e)}const nu=Js("ZodArray",(e,t)=>{pl.init(e,t),kd.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(ed(t,n)),e.nonempty=t=>e.check(ed(1,t)),e.max=(t,n)=>e.check(Xl(t,n)),e.length=(t,n)=>e.check(td(t,n)),e.unwrap=()=>e.element});function iu(e,t){return function(e,t,n){return new e({type:"array",element:t,...va(n)})}(nu,e,t)}const ou=Js("ZodObject",(e,t)=>{bl.init(e,t),kd.init(e,t),ra(e,"shape",()=>t.shape),e.keyof=()=>pu(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Xd()}),e.loose=()=>e.clone({...e._zod.def,catchall:Xd()}),e.strict=()=>e.clone({...e._zod.def,catchall:tu()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!ha(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const i=aa(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return sa(this,"shape",n),n},checks:[]});return ga(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!ha(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n={...e._zod.def,get shape(){const n={...e._zod.def.shape,...t};return sa(this,"shape",n),n},checks:e._zod.def.checks};return ga(e,n)}(e,t),e.merge=t=>function(e,t){const n=aa(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return sa(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return ga(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def;return ga(e,aa(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=n.shape[i])}return sa(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,i=aa(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return sa(this,"shape",i),i},checks:[]});return ga(e,i)}(e,t),e.partial=(...t)=>function(e,t,n){const i=aa(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)o[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return sa(this,"shape",o),o},checks:[]});return ga(t,i)}(vu,e,t[0]),e.required=(...t)=>function(e,t,n){const i=aa(t._zod.def,{get shape(){const i=t._zod.def.shape,o={...i};if(n)for(const t in n){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(o[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)o[t]=new e({type:"nonoptional",innerType:i[t]});return sa(this,"shape",o),o},checks:[]});return ga(t,i)}(Su,e,t[0])});function ru(e,t){const n={type:"object",shape:e??{},...va(t)};return new ou(n)}const su=Js("ZodUnion",(e,t)=>{kl.init(e,t),kd.init(e,t),e.options=t.options});function au(e,t){return new su({type:"union",options:e,...va(t)})}const cu=Js("ZodDiscriminatedUnion",(e,t)=>{su.init(e,t),wl.init(e,t)}),lu=Js("ZodIntersection",(e,t)=>{Cl.init(e,t),kd.init(e,t)}),du=Js("ZodRecord",(e,t)=>{xl.init(e,t),kd.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function uu(e,t,n){return new du({type:"record",keyType:e,valueType:t,...va(n)})}const hu=Js("ZodEnum",(e,t)=>{El.init(e,t),kd.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const o={};for(const r of e){if(!n.has(r))throw new Error(`Key ${r} not found in enum`);o[r]=t.entries[r]}return new hu({...t,checks:[],...va(i),entries:o})},e.exclude=(e,i)=>{const o={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new hu({...t,checks:[],...va(i),entries:o})}});function pu(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new hu({type:"enum",entries:n,...va(t)})}const mu=Js("ZodLiteral",(e,t)=>{_l.init(e,t),kd.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function fu(e,t){return new mu({type:"literal",values:Array.isArray(e)?e:[e],...va(t)})}const gu=Js("ZodTransform",(e,t)=>{Il.init(e,t),kd.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new Ys(e.constructor.name);n.addIssue=i=>{if("string"==typeof i)n.issues.push(Ta(i,n.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(Ta(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n)):(n.value=o,n)}}),vu=Js("ZodOptional",(e,t)=>{Rl.init(e,t),kd.init(e,t),e.unwrap=()=>e._zod.def.innerType});function bu(e){return new vu({type:"optional",innerType:e})}const yu=Js("ZodNullable",(e,t)=>{Al.init(e,t),kd.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ku(e){return new yu({type:"nullable",innerType:e})}const wu=Js("ZodDefault",(e,t)=>{Ml.init(e,t),kd.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),Cu=Js("ZodPrefault",(e,t)=>{Dl.init(e,t),kd.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Su=Js("ZodNonOptional",(e,t)=>{Nl.init(e,t),kd.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Tu=Js("ZodCatch",(e,t)=>{jl.init(e,t),kd.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),xu=Js("ZodPipe",(e,t)=>{Ul.init(e,t),kd.init(e,t),e.in=t.in,e.out=t.out});function Eu(e,t){return new xu({type:"pipe",in:e,out:t})}const _u=Js("ZodReadonly",(e,t)=>{Bl.init(e,t),kd.init(e,t),e.unwrap=()=>e._zod.def.innerType}),Iu=Js("ZodCustom",(e,t)=>{Vl.init(e,t),kd.init(e,t)}),Pu=pu(["image","video","audio"]),Ru=pu(["avatar","cover","voice","general"]),Au=pu(["processing","active","failed","deleted"]),Mu=pu(["jpg","jpeg","png","gif","webp","svg"]),Ou=pu(["mp4","webm","ogg","mov","avi"]),Du=pu(["mp3","wav","ogg","aac","flac"]),Nu=ru({mediaId:Sd(),userId:Sd(),orgId:Sd(),selfId:Sd().nullable().optional(),filename:Sd(),mimeType:Sd(),size:Wd(),src:Sd(),alt:Sd().optional(),context:Ru.default("general"),status:Au.default("processing"),createdAt:Sd().optional(),updatedAt:Sd().optional()}).extend({mediaType:Pu.optional(),className:Sd().optional(),width:Wd().optional(),height:Wd().optional(),duration:Wd().optional(),blurhash:Sd().optional()}).partial(),Lu=ru({duration:Wd().optional(),thumbnail:Sd().optional(),autoplay:Jd().optional(),loop:Jd().optional(),muted:Jd().optional(),controls:Jd().optional()}),ju=ru({duration:Wd().optional(),autoplay:Jd().optional(),loop:Jd().optional(),muted:Jd().optional(),controls:Jd().optional()});new cu({type:"union",options:[Nu.extend({mediaType:fu("image"),imageFormat:Mu}),Nu.extend({mediaType:fu("video"),videoFormat:Ou,video:Lu.optional()}),Nu.extend({mediaType:fu("audio"),audioFormat:Du,audio:ju.optional()})],discriminator:"mediaType",...va(undefined)});const Uu=pu(["xxs","xs","sm","md","lg","xl"]),Fu=pu(["primary","default","overlay","red","green","indigo","orange"]),Bu=pu(["ghost","link","outline","solid"]),zu=ru({key:Sd().optional(),label:Sd().optional(),href:Sd().optional(),size:Uu.optional(),theme:Fu.optional(),design:Bu.optional(),icon:au([Sd(),Nu]).optional(),iconAfter:au([Sd(),Nu]).optional(),rounding:pu(["full","md","lg"]).optional(),loading:Jd().optional(),disabled:Jd().optional(),onClick:Yd().optional(),testId:Sd().optional(),target:pu(["_blank","_self"]).optional(),type:pu(["button","submit","reset"]).optional()});ru({buttons:iu(zu).optional(),size:Uu.optional(),theme:Fu.optional(),design:Bu.optional()});const Vu=ru({key:Sd().optional(),id:Sd().optional(),label:Sd().optional(),srLabel:Sd().optional(),subLabel:Sd().optional(),value:au([Sd(),Wd()]).optional(),description:Sd().optional(),info:Sd().optional(),count:Wd().optional(),className:Sd().optional(),media:Nu.optional(),icon:Nu.optional(),iconAfter:Nu.optional(),href:Sd().optional(),target:pu(["_self","_blank"]).optional(),onClick:Yd().optional(),theme:pu(["primary","default"]).optional(),isActive:Jd().optional(),isDisabled:Jd().optional(),isHidden:Jd().optional(),priority:Wd().optional(),testId:Sd().optional(),items:iu(Yd()).optional()});ru({title:Sd().optional(),description:Sd().optional(),items:iu(Vu).optional()});const $u=ru({selfId:Sd().optional(),handle:Sd().optional(),ownerId:Sd().optional(),orgId:Sd().optional(),name:Sd().optional(),title:Sd().nullable().optional(),summary:Sd().nullable().optional(),entityType:Sd().optional(),avatarId:Sd().nullable().optional(),coverId:Sd().nullable().optional(),avatar:Nu.optional(),cover:Nu.optional(),voiceRecordings:iu(Nu).optional(),email:Sd().nullable().optional(),website:Sd().url().nullable().optional(),accounts:uu(Sd(),ru({handle:Sd().optional(),url:Sd().optional()})).nullable().optional(),basePrompt:Sd().nullable().optional(),firstMessage:Sd().nullable().optional(),personalityPrompt:Sd().nullable().optional(),useCustomPrompts:Jd().nullable().optional(),elevenlabsVoiceId:Sd().nullable().optional(),elevenlabsAgentId:Sd().nullable().optional(),headline:Sd().nullable().optional(),industry:Sd().nullable().optional(),location:Sd().nullable().optional(),influences:iu(Sd()).nullable().optional(),interests:iu(Sd()).nullable().optional(),personalDetails:Sd().nullable().optional(),cloutScore:Wd().nullable().optional(),gender:Sd().nullable().optional(),birthdayAt:Sd().nullable().optional(),businessTemplate:Sd().nullable().optional(),enrichment:uu(Sd(),Yd()).nullable().optional(),onboarding:uu(Sd(),Yd()).nullable().optional(),org:ru({orgId:Sd(),handle:Sd(),name:Sd(),headline:Sd().optional(),summary:Sd().optional(),status:Sd()}).optional(),visibility:pu(["private","org","public"]).optional(),status:Sd().optional(),createdAt:Sd().optional(),updatedAt:Sd().optional()});$u.extend({avatar:Nu.optional(),cover:Nu.optional(),voiceRecordings:iu(Nu).optional(),isPrimary:Jd().optional()});const qu=ru({userId:Sd(),email:Sd().optional(),handle:Sd().optional(),fullName:Sd().optional(),emailVerified:Jd().optional(),hashedPassword:Sd().optional(),primarySelfId:Sd().optional(),onboarding:Yd().optional(),recentSelfIds:iu(Sd()).optional(),status:Sd().optional(),lastSeenAt:Sd().optional(),createdAt:Sd().optional(),updatedAt:Sd().optional(),onboarded:Jd().optional()});ru({name:Sd().min(1).max(100).optional(),primarySelfId:Sd().optional(),onboarding:Yd().optional()}).partial(),ru({email:Sd()}),ru({email:Sd(),password:Sd().min(8,"Password must be at least 8 characters")}),ru({email:Sd(),password:Sd().min(8,"Password must be at least 8 characters"),fullName:Sd().min(1,"Name is required")}),ru({email:Sd(),code:Sd().min(6,"Verification code is required")}),ru({email:Sd(),code:Sd().min(6,"Verification code is required"),newPassword:Sd().min(8,"New password must be at least 8 characters")}),ru({newEmail:Sd()}),ru({newPassword:Sd().min(8,"New password must be at least 8 characters")}),ru({credential:Sd().optional(),code:Sd().optional(),createOnEmpty:Jd().optional()}).refine(e=>e.credential||e.code,{message:"Either credential or code must be provided"}),ru({orgId:Sd().optional(),handle:Sd().optional(),name:Sd().optional(),email:Sd().optional(),website:Sd().url().nullable().optional(),summary:Sd().optional(),avatarId:Sd().optional(),avatar:Nu.optional(),coverId:Sd().optional(),cover:Nu.optional(),accounts:uu(Sd(),ru({handle:Sd().optional(),url:Sd().optional()})).nullable().optional(),ownerId:Sd().optional(),billingStatus:Sd().optional(),isPersonal:Jd().optional(),stripeCustomerIdTest:Sd().optional(),stripeCustomerIdLive:Sd().optional(),subscriptionStatus:Sd().optional(),planId:Sd().optional(),maxSelves:Wd().optional(),maxUsers:Wd().optional(),onboarding:Yd().optional(),status:Sd().optional(),createdAt:Sd().optional(),updatedAt:Sd().optional()});const Wu=ru({membershipId:Sd(),orgId:Sd(),name:Sd(),handle:Sd(),avatarId:Sd().optional(),avatar:Nu.optional(),coverId:Sd().optional(),cover:Nu.optional(),role:pu(["owner","admin","member","observer"]),joinedAt:Sd()});function Hu(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}qu.extend({orgs:iu(Wu).optional(),memberships:iu(Wu).optional(),selves:iu($u).optional()});var Gu=Object.defineProperty,Zu=(e,t,n)=>((e,t,n)=>t in e?Gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);let Ju=class{constructor(){Zu(this,"_locking"),Zu(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){let e;this._locks+=1;const t=new Promise(t=>e=()=>{this._locks-=1,t()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>t),n}};function Ku(e,t){if(!e)throw new Error(t)}function Yu(e){if("number"!=typeof e)throw new Error("invalid int 32: "+typeof e);if(!Number.isInteger(e)||e>2147483647||e<-2147483648)throw new Error("invalid int 32: "+e)}function Qu(e){if("number"!=typeof e)throw new Error("invalid uint 32: "+typeof e);if(!Number.isInteger(e)||e>4294967295||e<0)throw new Error("invalid uint 32: "+e)}function Xu(e){if("number"!=typeof e)throw new Error("invalid float 32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw new Error("invalid float 32: "+e)}const eh=Symbol("@bufbuild/protobuf/enum-type");function th(e,t,n,i){e[eh]=nh(t,n.map(t=>({no:t.no,name:t.name,localName:e[t.no]})))}function nh(e,t,n){const i=Object.create(null),o=Object.create(null),r=[];for(const s of t){const e=ih(s);r.push(e),i[s.name]=e,o[s.no]=e}return{typeName:e,values:r,findName:e=>i[e],findNumber:e=>o[e]}}function ih(e){return"localName"in e?e:Object.assign(Object.assign({},e),{localName:e.name})}class oh{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,t){const n=this.getType().runtime.bin,i=n.makeReadOptions(t);return n.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,t){const n=this.getType(),i=n.runtime.json,o=i.makeReadOptions(t);return i.readMessage(n,e,o,this),this}fromJsonString(e,t){let n;try{n=JSON.parse(e)}catch(Bx){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(Bx instanceof Error?Bx.message:String(Bx)))}return this.fromJson(n,t)}toBinary(e){const t=this.getType().runtime.bin,n=t.makeWriteOptions(e),i=n.writerFactory();return t.writeMessage(this,i,n),i.finish()}toJson(e){const t=this.getType().runtime.json,n=t.makeWriteOptions(e);return t.writeMessage(this,n)}toJsonString(e){var t;const n=this.toJson(e);return JSON.stringify(n,null,null!==(t=null==e?void 0:e.prettySpaces)&&void 0!==t?t:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function rh(){let e=0,t=0;for(let i=0;i<28;i+=7){let n=this.buf[this.pos++];if(e|=(127&n)<<i,!(128&n))return this.assertBounds(),[e,t]}let n=this.buf[this.pos++];if(e|=(15&n)<<28,t=(112&n)>>4,!(128&n))return this.assertBounds(),[e,t];for(let i=3;i<=31;i+=7){let n=this.buf[this.pos++];if(t|=(127&n)<<i,!(128&n))return this.assertBounds(),[e,t]}throw new Error("invalid varint")}function sh(e,t,n){for(let r=0;r<28;r+=7){const i=e>>>r,o=!(i>>>7==0&&0==t),s=255&(o?128|i:i);if(n.push(s),!o)return}const i=e>>>28&15|(7&t)<<4,o=!!(t>>3);if(n.push(255&(o?128|i:i)),o){for(let e=3;e<31;e+=7){const i=t>>>e,o=!(i>>>7==0),r=255&(o?128|i:i);if(n.push(r),!o)return}n.push(t>>>31&1)}}const ah=4294967296;function ch(e){const t="-"===e[0];t&&(e=e.slice(1));const n=1e6;let i=0,o=0;function r(t,r){const s=Number(e.slice(t,r));o*=n,i=i*n+s,i>=ah&&(o+=i/ah|0,i%=ah)}return r(-24,-18),r(-18,-12),r(-12,-6),r(-6),t?uh(i,o):dh(i,o)}function lh(e,t){if(({lo:e,hi:t}=function(e,t){return{lo:e>>>0,hi:t>>>0}}(e,t)),t<=2097151)return String(ah*t+e);const n=16777215&(e>>>24|t<<8),i=t>>16&65535;let o=(16777215&e)+6777216*n+6710656*i,r=n+8147497*i,s=2*i;const a=1e7;return o>=a&&(r+=Math.floor(o/a),o%=a),r>=a&&(s+=Math.floor(r/a),r%=a),s.toString()+hh(r)+hh(o)}function dh(e,t){return{lo:0|e,hi:0|t}}function uh(e,t){return t=~t,e?e=1+~e:t+=1,dh(e,t)}const hh=e=>{const t=String(e);return"0000000".slice(t.length)+t};function ph(e,t){if(e>=0){for(;e>127;)t.push(127&e|128),e>>>=7;t.push(e)}else{for(let n=0;n<9;n++)t.push(127&e|128),e>>=7;t.push(1)}}function mh(){let e=this.buf[this.pos++],t=127&e;if(!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<7,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<14,!(128&e))return this.assertBounds(),t;if(e=this.buf[this.pos++],t|=(127&e)<<21,!(128&e))return this.assertBounds(),t;e=this.buf[this.pos++],t|=(15&e)<<28;for(let n=5;128&e&&n<10;n++)e=this.buf[this.pos++];if(128&e)throw new Error("invalid varint");return this.assertBounds(),t>>>0}const fh=function(){const e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&("object"!=typeof process||"object"!=typeof process.env||"1"!==process.env.BUF_BIGINT_DISABLE)){const t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),i=BigInt("0"),o=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){const i="bigint"==typeof e?e:BigInt(e);if(i>n||i<t)throw new Error("int64 invalid: ".concat(e));return i},uParse(e){const t="bigint"==typeof e?e:BigInt(e);if(t>o||t<i)throw new Error("uint64 invalid: ".concat(e));return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}const t=e=>Ku(/^-?[0-9]+$/.test(e),"int64 invalid: ".concat(e)),n=e=>Ku(/^[0-9]+$/.test(e),"uint64 invalid: ".concat(e));return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),t(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),n(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),t(e),ch(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),n(e),ch(e)),dec:(e,t)=>function(e,t){let n=dh(e,t);const i=2147483648&n.hi;i&&(n=uh(n.lo,n.hi));const o=lh(n.lo,n.hi);return i?"-"+o:o}(e,t),uDec:(e,t)=>lh(e,t)}}();var gh,vh,bh,yh,kh,wh;function Ch(e,t,n){if(t===n)return!0;if(e==gh.BYTES){if(!(t instanceof Uint8Array&&n instanceof Uint8Array))return!1;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e]!==n[e])return!1;return!0}switch(e){case gh.UINT64:case gh.FIXED64:case gh.INT64:case gh.SFIXED64:case gh.SINT64:return t==n}return!1}function Sh(e,t){switch(e){case gh.BOOL:return!1;case gh.UINT64:case gh.FIXED64:case gh.INT64:case gh.SFIXED64:case gh.SINT64:return 0==t?fh.zero:"0";case gh.DOUBLE:case gh.FLOAT:return 0;case gh.BYTES:return new Uint8Array(0);case gh.STRING:return"";default:return 0}}function Th(e,t){switch(e){case gh.BOOL:return!1===t;case gh.STRING:return""===t;case gh.BYTES:return t instanceof Uint8Array&&!t.byteLength;default:return 0==t}}(vh=gh||(gh={}))[vh.DOUBLE=1]="DOUBLE",vh[vh.FLOAT=2]="FLOAT",vh[vh.INT64=3]="INT64",vh[vh.UINT64=4]="UINT64",vh[vh.INT32=5]="INT32",vh[vh.FIXED64=6]="FIXED64",vh[vh.FIXED32=7]="FIXED32",vh[vh.BOOL=8]="BOOL",vh[vh.STRING=9]="STRING",vh[vh.BYTES=12]="BYTES",vh[vh.UINT32=13]="UINT32",vh[vh.SFIXED32=15]="SFIXED32",vh[vh.SFIXED64=16]="SFIXED64",vh[vh.SINT32=17]="SINT32",vh[vh.SINT64=18]="SINT64",(yh=bh||(bh={}))[yh.BIGINT=0]="BIGINT",yh[yh.STRING=1]="STRING",(wh=kh||(kh={}))[wh.Varint=0]="Varint",wh[wh.Bit64=1]="Bit64",wh[wh.LengthDelimited=2]="LengthDelimited",wh[wh.StartGroup=3]="StartGroup",wh[wh.EndGroup=4]="EndGroup",wh[wh.Bit32=5]="Bit32";class xh{constructor(e){this.stack=[],this.textEncoder=null!=e?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 t=new Uint8Array(e),n=0;for(let i=0;i<this.chunks.length;i++)t.set(this.chunks[i],n),n+=this.chunks[i].length;return this.chunks=[],t}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),t=this.stack.pop();if(!t)throw new Error("invalid state, fork stack empty");return this.chunks=t.chunks,this.buf=t.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(Qu(e);e>127;)this.buf.push(127&e|128),e>>>=7;return this.buf.push(e),this}int32(e){return Yu(e),ph(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 t=this.textEncoder.encode(e);return this.uint32(t.byteLength),this.raw(t)}float(e){Xu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setFloat32(0,e,!0),this.raw(t)}double(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!0),this.raw(t)}fixed32(e){Qu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e,!0),this.raw(t)}sfixed32(e){Yu(e);let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!0),this.raw(t)}sint32(e){return Yu(e),ph(e=(e<<1^e>>31)>>>0,this.buf),this}sfixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=fh.enc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}fixed64(e){let t=new Uint8Array(8),n=new DataView(t.buffer),i=fh.uEnc(e);return n.setInt32(0,i.lo,!0),n.setInt32(4,i.hi,!0),this.raw(t)}int64(e){let t=fh.enc(e);return sh(t.lo,t.hi,this.buf),this}sint64(e){let t=fh.enc(e),n=t.hi>>31;return sh(t.lo<<1^n,(t.hi<<1|t.lo>>>31)^n,this.buf),this}uint64(e){let t=fh.uEnc(e);return sh(t.lo,t.hi,this.buf),this}}class Eh{constructor(e,t){this.varint64=rh,this.uint32=mh,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=null!=t?t:new TextDecoder}tag(){let e=this.uint32(),t=e>>>3,n=7&e;if(t<=0||n<0||n>5)throw new Error("illegal tag: field no "+t+" wire type "+n);return[t,n]}skip(e,t){let n=this.pos;switch(e){case kh.Varint:for(;128&this.buf[this.pos++];);break;case kh.Bit64:this.pos+=4;case kh.Bit32:this.pos+=4;break;case kh.LengthDelimited:let n=this.uint32();this.pos+=n;break;case kh.StartGroup:for(;;){const[e,n]=this.tag();if(n===kh.EndGroup){if(void 0!==t&&e!==t)throw new Error("invalid end group tag");break}this.skip(n,e)}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 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return fh.dec(...this.varint64())}uint64(){return fh.uDec(...this.varint64())}sint64(){let[e,t]=this.varint64(),n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,fh.dec(e,t)}bool(){let[e,t]=this.varint64();return 0!==e||0!==t}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return fh.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return fh.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(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(){return this.textDecoder.decode(this.bytes())}}function _h(e){const t=e.field.localName,n=Object.create(null);return n[t]=function(e){const t=e.field;if(t.repeated)return[];if(void 0!==t.default)return t.default;switch(t.kind){case"enum":return t.T.values[0].no;case"scalar":return Sh(t.T,t.L);case"message":const e=t.T,n=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}(e),[n,()=>n[t]]}let Ih="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ph=[];for(let zx=0;zx<Ih.length;zx++)Ph[Ih[zx].charCodeAt(0)]=zx;Ph["-".charCodeAt(0)]=Ih.indexOf("+"),Ph["_".charCodeAt(0)]=Ih.indexOf("/");const Rh={dec(e){let t=3*e.length/4;"="==e[e.length-2]?t-=2:"="==e[e.length-1]&&(t-=1);let n,i=new Uint8Array(t),o=0,r=0,s=0;for(let a=0;a<e.length;a++){if(n=Ph[e.charCodeAt(a)],void 0===n)switch(e[a]){case"=":r=0;case"\n":case"\r":case"\t":case" ":continue;default:throw Error("invalid base64 string.")}switch(r){case 0:s=n,r=1;break;case 1:i[o++]=s<<2|(48&n)>>4,s=n,r=2;break;case 2:i[o++]=(15&s)<<4|(60&n)>>2,s=n,r=3;break;case 3:i[o++]=(3&s)<<6|n,r=0}}if(1==r)throw Error("invalid base64 string.");return i.subarray(0,o)},enc(e){let t,n="",i=0,o=0;for(let r=0;r<e.length;r++)switch(t=e[r],i){case 0:n+=Ih[t>>2],o=(3&t)<<4,i=1;break;case 1:n+=Ih[o|t>>4],o=(15&t)<<2,i=2;break;case 2:n+=Ih[o|t>>6],n+=Ih[63&t],i=0}return i&&(n+=Ih[o],n+="=",1==i&&(n+="=")),n}};function Ah(e,t,n){Dh(t,e);const i=t.runtime.bin.makeReadOptions(n),o=function(e,t){if(!t.repeated&&("enum"==t.kind||"scalar"==t.kind)){for(let n=e.length-1;n>=0;--n)if(e[n].no==t.no)return[e[n]];return[]}return e.filter(e=>e.no===t.no)}(e.getType().runtime.bin.listUnknownFields(e),t.field),[r,s]=_h(t);for(const a of o)t.runtime.bin.readField(r,i.readerFactory(a.data),t.field,a.wireType,i);return s()}function Mh(e,t,n,i){Dh(t,e);const o=t.runtime.bin.makeReadOptions(i),r=t.runtime.bin.makeWriteOptions(i);if(Oh(e,t)){const n=e.getType().runtime.bin.listUnknownFields(e).filter(e=>e.no!=t.field.no);e.getType().runtime.bin.discardUnknownFields(e);for(const t of n)e.getType().runtime.bin.onUnknownField(e,t.no,t.wireType,t.data)}const s=r.writerFactory();let a=t.field;a.opt||a.repeated||"enum"!=a.kind&&"scalar"!=a.kind||(a=Object.assign(Object.assign({},t.field),{opt:!0})),t.runtime.bin.writeField(a,n,s,r);const c=o.readerFactory(s.finish());for(;c.pos<c.len;){const[t,n]=c.tag(),i=c.skip(n,t);e.getType().runtime.bin.onUnknownField(e,t,n,i)}}function Oh(e,t){const n=e.getType();return t.extendee.typeName===n.typeName&&!!n.runtime.bin.listUnknownFields(e).find(e=>e.no==t.field.no)}function Dh(e,t){Ku(e.extendee.typeName==t.getType().typeName,"extension ".concat(e.typeName," can only be applied to message ").concat(e.extendee.typeName))}function Nh(e,t){const n=e.localName;if(e.repeated)return t[n].length>0;if(e.oneof)return t[e.oneof.localName].case===n;switch(e.kind){case"enum":case"scalar":return e.opt||e.req?void 0!==t[n]:"enum"==e.kind?t[n]!==e.T.values[0].no:!Th(e.T,t[n]);case"message":return void 0!==t[n];case"map":return Object.keys(t[n]).length>0}}function Lh(e,t){const n=e.localName,i=!e.opt&&!e.req;if(e.repeated)t[n]=[];else if(e.oneof)t[e.oneof.localName]={case:void 0};else switch(e.kind){case"map":t[n]={};break;case"enum":t[n]=i?e.T.values[0].no:void 0;break;case"scalar":t[n]=i?Sh(e.T,e.L):void 0;break;case"message":t[n]=void 0}}function jh(e,t){if(null===e||"object"!=typeof e)return!1;if(!Object.getOwnPropertyNames(oh.prototype).every(t=>t in e&&"function"==typeof e[t]))return!1;const n=e.getType();return null!==n&&"function"==typeof n&&"typeName"in n&&"string"==typeof n.typeName&&(void 0===t||n.typeName==t.typeName)}function Uh(e,t){return jh(t)||!e.fieldWrapper?t:e.fieldWrapper.wrapField(t)}gh.DOUBLE,gh.FLOAT,gh.INT64,gh.UINT64,gh.INT32,gh.UINT32,gh.BOOL,gh.STRING,gh.BYTES;const Fh={ignoreUnknownFields:!1},Bh={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};const zh=Symbol(),Vh=Symbol();function $h(e){if(null===e)return"null";switch(typeof e){case"object":return Array.isArray(e)?"array":"object";case"string":return e.length>100?"string":'"'.concat(e.split('"').join('\\"'),'"');default:return String(e)}}function qh(e,t,n,i,o){let r=n.localName;if(n.repeated){if(Ku("map"!=n.kind),null===t)return;if(!Array.isArray(t))throw new Error("cannot decode field ".concat(o.typeName,".").concat(n.name," from JSON: ").concat($h(t)));const s=e[r];for(const e of t){if(null===e)throw new Error("cannot decode field ".concat(o.typeName,".").concat(n.name," from JSON: ").concat($h(e)));switch(n.kind){case"message":s.push(n.T.fromJson(e,i));break;case"enum":const t=Gh(n.T,e,i.ignoreUnknownFields,!0);t!==Vh&&s.push(t);break;case"scalar":try{s.push(Hh(n.T,e,n.L,!0))}catch(Bx){let i="cannot decode field ".concat(o.typeName,".").concat(n.name," from JSON: ").concat($h(e));throw Bx instanceof Error&&Bx.message.length>0&&(i+=": ".concat(Bx.message)),new Error(i)}}}}else if("map"==n.kind){if(null===t)return;if("object"!=typeof t||Array.isArray(t))throw new Error("cannot decode field ".concat(o.typeName,".").concat(n.name," from JSON: ").concat($h(t)));const s=e[r];for(const[e,r]of Object.entries(t)){if(null===r)throw new Error("cannot decode field ".concat(o.typeName,".").concat(n.name," from JSON: map value null"));let a;try{a=Wh(n.K,e)}catch(Bx){let i="cannot decode map key for field ".concat(o.typeName,".").concat(n.name," from JSON: ").concat($h(t));throw Bx instanceof Error&&Bx.message.length>0&&(i+=": ".concat(Bx.message)),new Error(i)}switch(n.V.kind){case"message":s[a]=n.V.T.fromJson(r,i);break;case"enum":const e=Gh(n.V.T,r,i.ignoreUnknownFields,!0);e!==Vh&&(s[a]=e);break;case"scalar":try{s[a]=Hh(n.V.T,r,bh.BIGINT,!0)}catch(Bx){let i="cannot decode map value for field ".concat(o.typeName,".").concat(n.name," from JSON: ").concat($h(t));throw Bx instanceof Error&&Bx.message.length>0&&(i+=": ".concat(Bx.message)),new Error(i)}}}}else switch(n.oneof&&(e=e[n.oneof.localName]={case:r},r="value"),n.kind){case"message":const s=n.T;if(null===t&&"google.protobuf.Value"!=s.typeName)return;let a=e[r];jh(a)?a.fromJson(t,i):(e[r]=a=s.fromJson(t,i),s.fieldWrapper&&!n.oneof&&(e[r]=s.fieldWrapper.unwrapField(a)));break;case"enum":const c=Gh(n.T,t,i.ignoreUnknownFields,!1);switch(c){case zh:Lh(n,e);break;case Vh:break;default:e[r]=c}break;case"scalar":try{const i=Hh(n.T,t,n.L,!1);i===zh?Lh(n,e):e[r]=i}catch(Bx){let i="cannot decode field ".concat(o.typeName,".").concat(n.name," from JSON: ").concat($h(t));throw Bx instanceof Error&&Bx.message.length>0&&(i+=": ".concat(Bx.message)),new Error(i)}}}function Wh(e,t){if(e===gh.BOOL)switch(t){case"true":t=!0;break;case"false":t=!1}return Hh(e,t,bh.BIGINT,!0).toString()}function Hh(e,t,n,i){if(null===t)return i?Sh(e,n):zh;switch(e){case gh.DOUBLE:case gh.FLOAT:if("NaN"===t)return Number.NaN;if("Infinity"===t)return Number.POSITIVE_INFINITY;if("-Infinity"===t)return Number.NEGATIVE_INFINITY;if(""===t)break;if("string"==typeof t&&t.trim().length!==t.length)break;if("string"!=typeof t&&"number"!=typeof t)break;const i=Number(t);if(Number.isNaN(i))break;if(!Number.isFinite(i))break;return e==gh.FLOAT&&Xu(i),i;case gh.INT32:case gh.FIXED32:case gh.SFIXED32:case gh.SINT32:case gh.UINT32:let o;if("number"==typeof t?o=t:"string"==typeof t&&t.length>0&&t.trim().length===t.length&&(o=Number(t)),void 0===o)break;return e==gh.UINT32||e==gh.FIXED32?Qu(o):Yu(o),o;case gh.INT64:case gh.SFIXED64:case gh.SINT64:if("number"!=typeof t&&"string"!=typeof t)break;const r=fh.parse(t);return n?r.toString():r;case gh.FIXED64:case gh.UINT64:if("number"!=typeof t&&"string"!=typeof t)break;const s=fh.uParse(t);return n?s.toString():s;case gh.BOOL:if("boolean"!=typeof t)break;return t;case gh.STRING:if("string"!=typeof t)break;try{encodeURIComponent(t)}catch(Bx){throw new Error("invalid UTF8")}return t;case gh.BYTES:if(""===t)return new Uint8Array(0);if("string"!=typeof t)break;return Rh.dec(t)}throw new Error}function Gh(e,t,n,i){if(null===t)return"google.protobuf.NullValue"==e.typeName?0:i?e.values[0].no:zh;switch(typeof t){case"number":if(Number.isInteger(t))return t;break;case"string":const i=e.findName(t);if(void 0!==i)return i.no;if(n)return Vh}throw new Error("cannot decode enum ".concat(e.typeName," from JSON: ").concat($h(t)))}function Zh(e){return!(!e.repeated&&"map"!=e.kind&&(e.oneof||"message"==e.kind||e.opt||e.req))}function Jh(e,t,n){if("map"==e.kind){Ku("object"==typeof t&&null!=t);const i={},o=Object.entries(t);switch(e.V.kind){case"scalar":for(const[n,r]of o)i[n.toString()]=Yh(e.V.T,r);break;case"message":for(const[e,r]of o)i[e.toString()]=r.toJson(n);break;case"enum":const t=e.V.T;for(const[e,r]of o)i[e.toString()]=Kh(t,r,n.enumAsInteger)}return n.emitDefaultValues||o.length>0?i:void 0}if(e.repeated){Ku(Array.isArray(t));const i=[];switch(e.kind){case"scalar":for(let n=0;n<t.length;n++)i.push(Yh(e.T,t[n]));break;case"enum":for(let o=0;o<t.length;o++)i.push(Kh(e.T,t[o],n.enumAsInteger));break;case"message":for(let e=0;e<t.length;e++)i.push(t[e].toJson(n))}return n.emitDefaultValues||i.length>0?i:void 0}switch(e.kind){case"scalar":return Yh(e.T,t);case"enum":return Kh(e.T,t,n.enumAsInteger);case"message":return Uh(e.T,t).toJson(n)}}function Kh(e,t,n){var i;if(Ku("number"==typeof t),"google.protobuf.NullValue"==e.typeName)return null;if(n)return t;const o=e.findNumber(t);return null!==(i=null==o?void 0:o.name)&&void 0!==i?i:t}function Yh(e,t){switch(e){case gh.INT32:case gh.SFIXED32:case gh.SINT32:case gh.FIXED32:case gh.UINT32:return Ku("number"==typeof t),t;case gh.FLOAT:case gh.DOUBLE:return Ku("number"==typeof t),Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t;case gh.STRING:return Ku("string"==typeof t),t;case gh.BOOL:return Ku("boolean"==typeof t),t;case gh.UINT64:case gh.FIXED64:case gh.INT64:case gh.SFIXED64:case gh.SINT64:return Ku("bigint"==typeof t||"string"==typeof t||"number"==typeof t),t.toString();case gh.BYTES:return Ku(t instanceof Uint8Array),Rh.enc(t)}}const Qh=Symbol("@bufbuild/protobuf/unknown-fields"),Xh={readUnknownFields:!0,readerFactory:e=>new Eh(e)},ep={writeUnknownFields:!0,writerFactory:()=>new xh};function tp(e,t,n,i,o){let{repeated:r,localName:s}=n;switch(n.oneof&&((e=e[n.oneof.localName]).case!=s&&delete e.value,e.case=s,s="value"),n.kind){case"scalar":case"enum":const a="enum"==n.kind?gh.INT32:n.T;let c=op;if("scalar"==n.kind&&n.L>0&&(c=ip),r){let n=e[s];if(i==kh.LengthDelimited&&a!=gh.STRING&&a!=gh.BYTES){let e=t.uint32()+t.pos;for(;t.pos<e;)n.push(c(t,a))}else n.push(c(t,a))}else e[s]=c(t,a);break;case"message":const l=n.T;r?e[s].push(np(t,new l,o,n)):jh(e[s])?np(t,e[s],o,n):(e[s]=np(t,new l,o,n),!l.fieldWrapper||n.oneof||n.repeated||(e[s]=l.fieldWrapper.unwrapField(e[s])));break;case"map":let[d,u]=function(e,t,n){const i=t.uint32(),o=t.pos+i;let r,s;for(;t.pos<o;){const[i]=t.tag();switch(i){case 1:r=op(t,e.K);break;case 2:switch(e.V.kind){case"scalar":s=op(t,e.V.T);break;case"enum":s=t.int32();break;case"message":s=np(t,new e.V.T,n,void 0)}}}if(void 0===r&&(r=Sh(e.K,bh.BIGINT)),"string"!=typeof r&&"number"!=typeof r&&(r=r.toString()),void 0===s)switch(e.V.kind){case"scalar":s=Sh(e.V.T,bh.BIGINT);break;case"enum":s=e.V.T.values[0].no;break;case"message":s=new e.V.T}return[r,s]}(n,t,o);e[s][d]=u}}function np(e,t,n,i){const o=t.getType().runtime.bin,r=null==i?void 0:i.delimited;return o.readMessage(t,e,r?i.no:e.uint32(),n,r),t}function ip(e,t){const n=op(e,t);return"bigint"==typeof n?n.toString():n}function op(e,t){switch(t){case gh.STRING:return e.string();case gh.BOOL:return e.bool();case gh.DOUBLE:return e.double();case gh.FLOAT:return e.float();case gh.INT32:return e.int32();case gh.INT64:return e.int64();case gh.UINT64:return e.uint64();case gh.FIXED64:return e.fixed64();case gh.BYTES:return e.bytes();case gh.FIXED32:return e.fixed32();case gh.SFIXED32:return e.sfixed32();case gh.SFIXED64:return e.sfixed64();case gh.SINT64:return e.sint64();case gh.UINT32:return e.uint32();case gh.SINT32:return e.sint32()}}function rp(e,t,n,i){Ku(void 0!==t);const o=e.repeated;switch(e.kind){case"scalar":case"enum":let r="enum"==e.kind?gh.INT32:e.T;if(o)if(Ku(Array.isArray(t)),e.packed)!function(e,t,n,i){if(!i.length)return;e.tag(n,kh.LengthDelimited).fork();let[,o]=lp(t);for(let r=0;r<i.length;r++)e[o](i[r]);e.join()}(n,r,e.no,t);else for(const i of t)cp(n,r,e.no,i);else cp(n,r,e.no,t);break;case"message":if(o){Ku(Array.isArray(t));for(const o of t)ap(n,i,e,o)}else ap(n,i,e,t);break;case"map":Ku("object"==typeof t&&null!=t);for(const[o,s]of Object.entries(t))sp(n,i,e,o,s)}}function sp(e,t,n,i,o){e.tag(n.no,kh.LengthDelimited),e.fork();let r=i;switch(n.K){case gh.INT32:case gh.FIXED32:case gh.UINT32:case gh.SFIXED32:case gh.SINT32:r=Number.parseInt(i);break;case gh.BOOL:Ku("true"==i||"false"==i),r="true"==i}switch(cp(e,n.K,1,r),n.V.kind){case"scalar":cp(e,n.V.T,2,o);break;case"enum":cp(e,gh.INT32,2,o);break;case"message":Ku(void 0!==o),e.tag(2,kh.LengthDelimited).bytes(o.toBinary(t))}e.join()}function ap(e,t,n,i){const o=Uh(n.T,i);n.delimited?e.tag(n.no,kh.StartGroup).raw(o.toBinary(t)).tag(n.no,kh.EndGroup):e.tag(n.no,kh.LengthDelimited).bytes(o.toBinary(t))}function cp(e,t,n,i){Ku(void 0!==i);let[o,r]=lp(t);e.tag(n,o)[r](i)}function lp(e){let t=kh.Varint;switch(e){case gh.BYTES:case gh.STRING:t=kh.LengthDelimited;break;case gh.DOUBLE:case gh.FIXED64:case gh.SFIXED64:t=kh.Bit64;break;case gh.FIXED32:case gh.SFIXED32:case gh.FLOAT:t=kh.Bit32}return[t,gh[e].toLowerCase()]}function dp(e){if(void 0===e)return e;if(jh(e))return e.clone();if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),t}return e}function up(e){return e instanceof Uint8Array?e:new Uint8Array(e)}class hp{constructor(e,t){this._fields=e,this._normalizer=t}findJsonName(e){if(!this.jsonNames){const e={};for(const t of this.list())e[t.jsonName]=e[t.name]=t;this.jsonNames=e}return this.jsonNames[e]}find(e){if(!this.numbers){const e={};for(const t of this.list())e[t.no]=t;this.numbers=e}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,t)=>e.no-t.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let t;for(const n of this.list())n.oneof?n.oneof!==t&&(t=n.oneof,e.push(t)):e.push(n)}return this.members}}function pp(e,t){const n=fp(e);return t?n:kp(yp(n))}const mp=fp;function fp(e){let t=!1;const n=[];for(let i=0;i<e.length;i++){let o=e.charAt(i);switch(o){case"_":t=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n.push(o),t=!1;break;default:t&&(t=!1,o=o.toUpperCase()),n.push(o)}}return n.join("")}const gp=new Set(["constructor","toString","toJSON","valueOf"]),vp=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),bp=e=>"".concat(e,"$"),yp=e=>vp.has(e)?bp(e):e,kp=e=>gp.has(e)?bp(e):e;class wp{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=pp(e,!1)}addField(e){Ku(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 e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[e]}}const Cp=(Sp=e=>new hp(e,e=>function(e){var t,n,i,o,r,s;const a=[];let c;for(const l of"function"==typeof e?e():e){const e=l;if(e.localName=pp(l.name,void 0!==l.oneof),e.jsonName=null!==(t=l.jsonName)&&void 0!==t?t:mp(l.name),e.repeated=null!==(n=l.repeated)&&void 0!==n&&n,"scalar"==l.kind&&(e.L=null!==(i=l.L)&&void 0!==i?i:bh.BIGINT),e.delimited=null!==(o=l.delimited)&&void 0!==o&&o,e.req=null!==(r=l.req)&&void 0!==r&&r,e.opt=null!==(s=l.opt)&&void 0!==s&&s,void 0===l.packed&&(e.packed="enum"==l.kind||"scalar"==l.kind&&l.T!=gh.BYTES&&l.T!=gh.STRING),void 0!==l.oneof){const t="string"==typeof l.oneof?l.oneof:l.oneof.name;c&&c.name==t||(c=new wp(t)),e.oneof=c,c.addField(e)}a.push(e)}return a}(e)),Tp=e=>{for(const t of e.getType().fields.byMember()){if(t.opt)continue;const n=t.localName,i=e;if(t.repeated)i[n]=[];else switch(t.kind){case"oneof":i[n]={case:void 0};break;case"enum":i[n]=0;break;case"map":i[n]={};break;case"scalar":i[n]=Sh(t.T,t.L)}}},{syntax:"proto3",json:{makeReadOptions:function(e){return e?Object.assign(Object.assign({},Fh),e):Fh},makeWriteOptions:function(e){return e?Object.assign(Object.assign({},Bh),e):Bh},readMessage(e,t,n,i){if(null==t||Array.isArray(t)||"object"!=typeof t)throw new Error("cannot decode message ".concat(e.typeName," from JSON: ").concat($h(t)));i=null!=i?i:new e;const o=new Map,r=n.typeRegistry;for(const[s,a]of Object.entries(t)){const t=e.fields.findJsonName(s);if(t){if(t.oneof){if(null===a&&"scalar"==t.kind)continue;const n=o.get(t.oneof);if(void 0!==n)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: multiple keys for oneof "').concat(t.oneof.name,'" present: "').concat(n,'", "').concat(s,'"'));o.set(t.oneof,s)}qh(i,a,t,n,e)}else{let t=!1;if((null==r?void 0:r.findExtension)&&s.startsWith("[")&&s.endsWith("]")){const o=r.findExtension(s.substring(1,s.length-1));if(o&&o.extendee.typeName==e.typeName){t=!0;const[e,r]=_h(o);qh(e,a,o.field,n,o),Mh(i,o,r(),n)}}if(!t&&!n.ignoreUnknownFields)throw new Error("cannot decode message ".concat(e.typeName,' from JSON: key "').concat(s,'" is unknown'))}}return i},writeMessage(e,t){const n=e.getType(),i={};let o;try{for(o of n.fields.byNumber()){if(!Nh(o,e)){if(o.req)throw"required field not set";if(!t.emitDefaultValues)continue;if(!Zh(o))continue}const n=Jh(o,o.oneof?e[o.oneof.localName].value:e[o.localName],t);void 0!==n&&(i[t.useProtoFieldName?o.name:o.jsonName]=n)}const r=t.typeRegistry;if(null==r?void 0:r.findExtensionFor)for(const o of n.runtime.bin.listUnknownFields(e)){const s=r.findExtensionFor(n.typeName,o.no);if(s&&Oh(e,s)){const n=Ah(e,s,t),o=Jh(s.field,n,t);void 0!==o&&(i[s.field.jsonName]=o)}}}catch(Bx){const t=o?"cannot encode field ".concat(n.typeName,".").concat(o.name," to JSON"):"cannot encode message ".concat(n.typeName," to JSON"),i=Bx instanceof Error?Bx.message:String(Bx);throw new Error(t+(i.length>0?": ".concat(i):""))}return i},readScalar:(e,t,n)=>Hh(e,t,null!=n?n:bh.BIGINT,!0),writeScalar(e,t,n){if(void 0!==t)return n||Th(e,t)?Yh(e,t):void 0},debug:$h},bin:{makeReadOptions:function(e){return e?Object.assign(Object.assign({},Xh),e):Xh},makeWriteOptions:function(e){return e?Object.assign(Object.assign({},ep),e):ep},listUnknownFields(e){var t;return null!==(t=e[Qh])&&void 0!==t?t:[]},discardUnknownFields(e){delete e[Qh]},writeUnknownFields(e,t){const n=e[Qh];if(n)for(const i of n)t.tag(i.no,i.wireType).raw(i.data)},onUnknownField(e,t,n,i){const o=e;Array.isArray(o[Qh])||(o[Qh]=[]),o[Qh].push({no:t,wireType:n,data:i})},readMessage(e,t,n,i,o){const r=e.getType(),s=o?t.len:t.pos+n;let a,c;for(;t.pos<s&&([a,c]=t.tag(),!0!==o||c!=kh.EndGroup);){const n=r.fields.find(a);if(!n){const n=t.skip(c,a);i.readUnknownFields&&this.onUnknownField(e,a,c,n);continue}tp(e,t,n,c,i)}if(o&&(c!=kh.EndGroup||a!==n))throw new Error("invalid end group tag")},readField:tp,writeMessage(e,t,n){const i=e.getType();for(const o of i.fields.byNumber())if(Nh(o,e))rp(o,o.oneof?e[o.oneof.localName].value:e[o.localName],t,n);else if(o.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(o.name," to binary: required field not set"));return n.writeUnknownFields&&this.writeUnknownFields(e,t),t},writeField(e,t,n,i){void 0!==t&&rp(e,t,n,i)}},util:Object.assign(Object.assign({},{setEnumType:th,initPartial(e,t){if(void 0===e)return;const n=t.getType();for(const i of n.fields.byMember()){const n=i.localName,o=t,r=e;if(null!=r[n])switch(i.kind){case"oneof":const e=r[n].case;if(void 0===e)continue;const t=i.findField(e);let s=r[n].value;t&&"message"==t.kind&&!jh(s,t.T)?s=new t.T(s):t&&"scalar"===t.kind&&t.T===gh.BYTES&&(s=up(s)),o[n]={case:e,value:s};break;case"scalar":case"enum":let a=r[n];i.T===gh.BYTES&&(a=i.repeated?a.map(up):up(a)),o[n]=a;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===gh.BYTES)for(const[t,i]of Object.entries(r[n]))o[n][t]=up(i);else Object.assign(o[n],r[n]);break;case"message":const e=i.V.T;for(const t of Object.keys(r[n])){let i=r[n][t];e.fieldWrapper||(i=new e(i)),o[n][t]=i}}break;case"message":const c=i.T;if(i.repeated)o[n]=r[n].map(e=>jh(e,c)?e:new c(e));else{const e=r[n];c.fieldWrapper?"google.protobuf.BytesValue"===c.typeName?o[n]=up(e):o[n]=e:o[n]=jh(e,c)?e:new c(e)}}}},equals:(e,t,n)=>t===n||!(!t||!n)&&e.fields.byMember().every(e=>{const i=t[e.localName],o=n[e.localName];if(e.repeated){if(i.length!==o.length)return!1;switch(e.kind){case"message":return i.every((t,n)=>e.T.equals(t,o[n]));case"scalar":return i.every((t,n)=>Ch(e.T,t,o[n]));case"enum":return i.every((e,t)=>Ch(gh.INT32,e,o[t]))}throw new Error("repeated cannot contain ".concat(e.kind))}switch(e.kind){case"message":let t=i,n=o;return e.T.fieldWrapper&&(void 0===t||jh(t)||(t=e.T.fieldWrapper.wrapField(t)),void 0===n||jh(n)||(n=e.T.fieldWrapper.wrapField(n))),e.T.equals(t,n);case"enum":return Ch(gh.INT32,i,o);case"scalar":return Ch(e.T,i,o);case"oneof":if(i.case!==o.case)return!1;const r=e.findField(i.case);if(void 0===r)return!0;switch(r.kind){case"message":return r.T.equals(i.value,o.value);case"enum":return Ch(gh.INT32,i.value,o.value);case"scalar":return Ch(r.T,i.value,o.value)}throw new Error("oneof cannot contain ".concat(r.kind));case"map":const s=Object.keys(i).concat(Object.keys(o));switch(e.V.kind){case"message":const t=e.V.T;return s.every(e=>t.equals(i[e],o[e]));case"enum":return s.every(e=>Ch(gh.INT32,i[e],o[e]));case"scalar":const n=e.V.T;return s.every(e=>Ch(n,i[e],o[e]))}}}),clone(e){const t=e.getType(),n=new t,i=n;for(const o of t.fields.byMember()){const t=e[o.localName];let n;if(o.repeated)n=t.map(dp);else if("map"==o.kind){n=i[o.localName];for(const[e,i]of Object.entries(t))n[e]=dp(i)}else n="oneof"==o.kind?o.findField(t.case)?{case:t.case,value:dp(t.value)}:{case:void 0}:dp(t);i[o.localName]=n}for(const o of t.runtime.bin.listUnknownFields(e))t.runtime.bin.onUnknownField(i,o.no,o.wireType,o.data);return n}}),{newFieldList:Sp,initFields:Tp}),makeMessageType(e,t,n){return function(e,t,n,i){var o;const r=null!==(o=null==i?void 0:i.localName)&&void 0!==o?o:t.substring(t.lastIndexOf(".")+1),s={[r]:function(t){e.util.initFields(this),e.util.initPartial(t,this)}}[r];return Object.setPrototypeOf(s.prototype,new oh),Object.assign(s,{runtime:e,typeName:t,fields:e.util.newFieldList(n),fromBinary:(e,t)=>(new s).fromBinary(e,t),fromJson:(e,t)=>(new s).fromJson(e,t),fromJsonString:(e,t)=>(new s).fromJsonString(e,t),equals:(t,n)=>e.util.equals(s,t,n)}),s}(this,e,t,n)},makeEnum:function(e,t,n){const i={};for(const o of t){const e=ih(o);i[e.localName]=e.no,i[e.no]=e.localName}return th(i,e,t),i},makeEnumType:nh,getEnumType:function(e){const t=e[eh];return Ku(t,"missing enum type on enum object"),t},makeExtension(e,t,n){return function(e,t,n,i){let o;return{typeName:t,extendee:n,get field(){if(!o){const n="function"==typeof i?i():i;n.name=t.split(".").pop(),n.jsonName="[".concat(t,"]"),o=e.util.newFieldList([n]).list()[0]}return o},runtime:e}}(this,e,t,n)}});var Sp,Tp;class xp extends oh{constructor(e){super(),this.seconds=fh.zero,this.nanos=0,Cp.util.initPartial(e,this)}fromJson(e,t){if("string"!=typeof e)throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Cp.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=fh.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 t=1e3*Number(this.seconds);if(t<Date.parse("0001-01-01T00:00:00Z")||t>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 e=(this.nanos+1e9).toString().substring(1);n="000000"===e.substring(3)?"."+e.substring(0,3)+"Z":"000"===e.substring(6)?"."+e.substring(0,6)+"Z":"."+e+"Z"}return new Date(t).toISOString().replace(".000Z",n)}toDate(){return new Date(1e3*Number(this.seconds)+Math.ceil(this.nanos/1e6))}static now(){return xp.fromDate(new Date)}static fromDate(e){const t=e.getTime();return new xp({seconds:fh.parse(Math.floor(t/1e3)),nanos:t%1e3*1e6})}static fromBinary(e,t){return(new xp).fromBinary(e,t)}static fromJson(e,t){return(new xp).fromJson(e,t)}static fromJsonString(e,t){return(new xp).fromJsonString(e,t)}static equals(e,t){return Cp.util.equals(xp,e,t)}}xp.runtime=Cp,xp.typeName="google.protobuf.Timestamp",xp.fields=Cp.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Ep=Cp.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:xp},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:_p,repeated:!0},{no:5,name:"events",kind:"message",T:Pp,repeated:!0}]),_p=Cp.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:Ip,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),Ip=Cp.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:xp},{no:3,name:"value",kind:"scalar",T:2}]),Pp=Cp.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:xp},{no:7,name:"normalized_end_timestamp",kind:"message",T:xp,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),Rp=Cp.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),Ap=Cp.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Mp=Cp.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"}]),Op=Cp.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Dp=Cp.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),Np=Cp.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Lp=Cp.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"},{no:15,name:"MEDIA_FAILURE"}]),jp=Cp.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"}]),Up=Cp.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),Fp=Cp.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"}]),Bp=Cp.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:zp,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:wm}]),zp=Cp.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),Vp=Cp.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:Cp.getEnumType(Mp),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}]),$p=Cp.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:Cp.getEnumType(qp)},{no:4,name:"tracks",kind:"message",T:Jp,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:Vp},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Cp.getEnumType(Wp)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Cp.getEnumType(Lp)},{no:18,name:"kind_details",kind:"enum",T:Cp.getEnumType(Hp),repeated:!0}]),qp=Cp.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),Wp=Cp.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"}]),Hp=Cp.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),Gp=Cp.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),Zp=Cp.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:Kp,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Cp.getEnumType(Yp)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Jp=Cp.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Cp.getEnumType(Ap)},{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:Cp.getEnumType(Mp)},{no:10,name:"layers",kind:"message",T:Kp,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:Zp,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:Cp.getEnumType(Gp)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:wm},{no:19,name:"audio_features",kind:"enum",T:Cp.getEnumType(Fp),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Cp.getEnumType(Rp)}]),Kp=Cp.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Cp.getEnumType(Op)},{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},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9}]),Yp=Cp.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),Qp=Cp.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Cp.getEnumType(Xp)},{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:om,oneof:"value"},{no:3,name:"speaker",kind:"message",T:nm,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:rm,oneof:"value"},{no:7,name:"transcription",kind:"message",T:sm,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Ep,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:cm,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:lm,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:dm,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:um,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:xm,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:Em,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:_m,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:em,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),Xp=Cp.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),em=Cp.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:Cp.getEnumType(Gp)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}]),tm=Cp.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:om,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:cm,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:lm,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:dm,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:um,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:xm,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:Em,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:_m,oneof:"value"}]),nm=Cp.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:im,repeated:!0}]),im=Cp.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}]),om=Cp.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}]),rm=Cp.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),sm=Cp.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:am,repeated:!0}]),am=Cp.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}]),cm=Cp.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}]),lm=Cp.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}]),dm=Cp.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),um=Cp.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:hm,oneof:"value"}]),hm=Cp.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}]),pm=Cp.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),mm=Cp.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Cp.getEnumType(fm)},{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}]),fm=Cp.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),gm=Cp.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Cp.getEnumType(vm)},{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}]),vm=Cp.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"},{no:14,name:"ESP32"}]),bm=Cp.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:ym},{no:2,name:"screen",kind:"message",T:ym},{no:3,name:"resume_connection",kind:"enum",T:Cp.getEnumType(Np)},{no:4,name:"disabled_codecs",kind:"message",T:km},{no:5,name:"force_relay",kind:"enum",T:Cp.getEnumType(Np)}]),ym=Cp.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Cp.getEnumType(Np)}]),km=Cp.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:zp,repeated:!0},{no:2,name:"publish",kind:"message",T:zp,repeated:!0}]),wm=Cp.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),Cm=Cp.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),Sm=Cp.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Cp.getEnumType(Cm)},{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"}),Tm=Cp.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),xm=Cp.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:Cp.getEnumType(Gp)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:Sm,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:Tm,oneof:"content_header"}],{localName:"DataStream_Header"}),Em=Cp.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"}),_m=Cp.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"}),Im=Cp.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),Pm=Cp.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),Rm=Cp.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),Am=Cp.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),Mm=Cp.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:Vm,oneof:"message"},{no:2,name:"answer",kind:"message",T:Vm,oneof:"message"},{no:3,name:"trickle",kind:"message",T:Lm,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Nm,oneof:"message"},{no:5,name:"mute",kind:"message",T:jm,oneof:"message"},{no:6,name:"subscription",kind:"message",T:qm,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Wm,oneof:"message"},{no:8,name:"leave",kind:"message",T:Zm,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:Km,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:uf,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:mf,oneof:"message"},{no:13,name:"simulate",kind:"message",T:vf,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:Ym,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:bf,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:Hm,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:Gm,oneof:"message"}]),Om=Cp.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:Um,oneof:"message"},{no:2,name:"answer",kind:"message",T:Vm,oneof:"message"},{no:3,name:"offer",kind:"message",T:Vm,oneof:"message"},{no:4,name:"trickle",kind:"message",T:Lm,oneof:"message"},{no:5,name:"update",kind:"message",T:$m,oneof:"message"},{no:6,name:"track_published",kind:"message",T:Bm,oneof:"message"},{no:8,name:"leave",kind:"message",T:Zm,oneof:"message"},{no:9,name:"mute",kind:"message",T:jm,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:Xm,oneof:"message"},{no:11,name:"room_update",kind:"message",T:ef,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:nf,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:rf,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:cf,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:hf,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:zm,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:Fm,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:yf,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:Cf,oneof:"message"},{no:22,name:"request_response",kind:"message",T:Sf,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:xf,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:pf,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:Ef,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:lf,oneof:"message"}]),Dm=Cp.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:Kp,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Cp.getEnumType(Yp)}]),Nm=Cp.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:Cp.getEnumType(Ap)},{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:Cp.getEnumType(Mp)},{no:9,name:"layers",kind:"message",T:Kp,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:Dm,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:Cp.getEnumType(Gp)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Cp.getEnumType(Rp)},{no:17,name:"audio_features",kind:"enum",T:Cp.getEnumType(Fp),repeated:!0}]),Lm=Cp.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Cp.getEnumType(Pm)},{no:3,name:"final",kind:"scalar",T:8}]),jm=Cp.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),Um=Cp.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:Bp},{no:2,name:"participant",kind:"message",T:$p},{no:3,name:"other_participants",kind:"message",T:$p,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:Qm,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:bm},{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:mm},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:zp,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),Fm=Cp.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:Qm,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:bm},{no:3,name:"server_info",kind:"message",T:mm},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),Bm=Cp.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Jp}]),zm=Cp.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Vm=Cp.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13}]),$m=Cp.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:$p,repeated:!0}]),qm=Cp.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:pm,repeated:!0}]),Wm=Cp.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:Cp.getEnumType(Op)},{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}]),Hm=Cp.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Cp.getEnumType(Fp),repeated:!0}]),Gm=Cp.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}]),Zm=Cp.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Cp.getEnumType(Lp)},{no:3,name:"action",kind:"enum",T:Cp.getEnumType(Jm)},{no:4,name:"regions",kind:"message",T:kf}]),Jm=Cp.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),Km=Cp.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:Kp,repeated:!0}]),Ym=Cp.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}]),Qm=Cp.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}]),Xm=Cp.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:im,repeated:!0}]),ef=Cp.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:Bp}]),tf=Cp.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Cp.getEnumType(Dp)},{no:3,name:"score",kind:"scalar",T:2}]),nf=Cp.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:tf,repeated:!0}]),of=Cp.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:Cp.getEnumType(Rm)}]),rf=Cp.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:of,repeated:!0}]),sf=Cp.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Cp.getEnumType(Op)},{no:2,name:"enabled",kind:"scalar",T:8}]),af=Cp.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:sf,repeated:!0}]),cf=Cp.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:sf,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:af,repeated:!0}]),lf=Cp.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:Im,repeated:!0}]),df=Cp.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}]),uf=Cp.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:df,repeated:!0}]),hf=Cp.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}]),pf=Cp.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:Bp},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:$p},{no:4,name:"other_participants",kind:"message",T:$p,repeated:!0}]),mf=Cp.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:Vm},{no:2,name:"subscription",kind:"message",T:qm},{no:3,name:"publish_tracks",kind:"message",T:Bm,repeated:!0},{no:4,name:"data_channels",kind:"message",T:gf,repeated:!0},{no:5,name:"offer",kind:"message",T:Vm},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:ff,repeated:!0}]),ff=Cp.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),gf=Cp.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:Cp.getEnumType(Pm)}]),vf=Cp.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:Cp.getEnumType(Am),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"}]),bf=Cp.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),yf=Cp.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),kf=Cp.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:wf,repeated:!0}]),wf=Cp.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}]),Cf=Cp.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Cp.getEnumType(Up)}]),Sf=Cp.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Cp.getEnumType(Tf)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:Lm,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Nm,oneof:"request"},{no:6,name:"mute",kind:"message",T:jm,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:Ym,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:Hm,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:Gm,oneof:"request"}]),Tf=Cp.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"},{no:4,name:"QUEUED"},{no:5,name:"UNSUPPORTED_TYPE"},{no:6,name:"UNCLASSIFIED_ERROR"}]),xf=Cp.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),Ef=Cp.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function _f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var If,Pf,Rf,Af,Mf,Of,Df,Nf,Lf={exports:{}},jf=(If||(If=1,Df=Lf.exports,Nf=function(){var e=function(){},t="undefined",n=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],o={},r=null;function s(e,t){var n=e[t];if("function"==typeof n.bind)return n.bind(e);try{return Function.prototype.bind.call(n,e)}catch(Bx){return function(){return Function.prototype.apply.apply(n,[e,arguments])}}}function a(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments])),console.trace}function c(){for(var n=this.getLevel(),o=0;o<i.length;o++){var r=i[o];this[r]=o<n?e:this.methodFactory(r,n,this.name)}if(this.log=this.debug,typeof console===t&&n<this.levels.SILENT)return"No console available for logging"}function l(e){return function(){typeof console!==t&&(c.call(this),this[e].apply(this,arguments))}}function d(i,o,r){return function(i){return"debug"===i&&(i="log"),typeof console!==t&&("trace"===i&&n?a:void 0!==console[i]?s(console,i):void 0!==console.log?s(console,"log"):e)}(i)||l.apply(this,arguments)}function u(e,n){var s,a,l,u=this,h="loglevel";function p(){var e;if(typeof window!==t&&h){try{e=window.localStorage[h]}catch(r){}if(typeof e===t)try{var n=window.document.cookie,i=encodeURIComponent(h),o=n.indexOf(i+"=");-1!==o&&(e=/^([^;]+)/.exec(n.slice(o+i.length+1))[1])}catch(r){}return void 0===u.levels[e]&&(e=void 0),e}}function m(e){var t=e;if("string"==typeof t&&void 0!==u.levels[t.toUpperCase()]&&(t=u.levels[t.toUpperCase()]),"number"==typeof t&&t>=0&&t<=u.levels.SILENT)return t;throw new TypeError("log.setLevel() called with invalid level: "+e)}"string"==typeof e?h+=":"+e:"symbol"==typeof e&&(h=void 0),u.name=e,u.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},u.methodFactory=n||d,u.getLevel=function(){return null!=l?l:null!=a?a:s},u.setLevel=function(e,n){return l=m(e),!1!==n&&function(e){var n=(i[e]||"silent").toUpperCase();if(typeof window!==t&&h){try{return void(window.localStorage[h]=n)}catch(o){}try{window.document.cookie=encodeURIComponent(h)+"="+n+";"}catch(o){}}}(l),c.call(u)},u.setDefaultLevel=function(e){a=m(e),p()||u.setLevel(e,!1)},u.resetLevel=function(){l=null,function(){if(typeof window!==t&&h){try{window.localStorage.removeItem(h)}catch(e){}try{window.document.cookie=encodeURIComponent(h)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(e){}}}(),c.call(u)},u.enableAll=function(e){u.setLevel(u.levels.TRACE,e)},u.disableAll=function(e){u.setLevel(u.levels.SILENT,e)},u.rebuild=function(){if(r!==u&&(s=m(r.getLevel())),c.call(u),r===u)for(var e in o)o[e].rebuild()},s=m(r?r.getLevel():"WARN");var f=p();null!=f&&(l=m(f)),c.call(u)}(r=new u).getLogger=function(e){if("symbol"!=typeof e&&"string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=o[e];return t||(t=o[e]=new u(e,r.methodFactory)),t};var h=typeof window!==t?window.log:void 0;return r.noConflict=function(){return typeof window!==t&&window.log===r&&(window.log=h),r},r.getLoggers=function(){return o},r.default=r,r},(Of=Lf).exports?Of.exports=Nf():Df.log=Nf()),Lf.exports);(Rf=Pf||(Pf={}))[Rf.trace=0]="trace",Rf[Rf.debug=1]="debug",Rf[Rf.info=2]="info",Rf[Rf.warn=3]="warn",Rf[Rf.error=4]="error",Rf[Rf.silent=5]="silent",(Mf=Af||(Af={})).Default="livekit",Mf.Room="livekit-room",Mf.TokenSource="livekit-token-source",Mf.Participant="livekit-participant",Mf.Track="livekit-track",Mf.Publication="livekit-track-publication",Mf.Engine="livekit-engine",Mf.Signal="livekit-signal",Mf.PCManager="livekit-pc-manager",Mf.PCTransport="livekit-pc-transport",Mf.E2EE="lk-e2ee";let Uf=jf.getLogger("livekit");function Ff(e){const t=jf.getLogger(e);return t.setDefaultLevel(Uf.getLevel()),t}Object.values(Af).map(e=>jf.getLogger(e)),Uf.setDefaultLevel(Pf.info);const Bf=jf.getLogger("lk-e2ee"),zf=7e3,Vf=[0,300,1200,2700,4800,zf,zf,zf,zf,zf];function $f(e,t,n,i){return new(n||(n=Promise))(function(o,r){function s(e){try{c(i.next(e))}catch(Bx){r(Bx)}}function a(e){try{c(i.throw(e))}catch(Bx){r(Bx)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((i=i.apply(e,t||[])).next())})}function qf(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(n){t[n]=e[n]&&function(t){return new Promise(function(i,o){!function(e,t,n,i){Promise.resolve(i).then(function(t){e({value:t,done:n})},t)}(i,o,(t=e[n](t)).done,t.value)})}}}"function"==typeof SuppressedError&&SuppressedError;var Wf,Hf={exports:{}},Gf=function(){if(Wf)return Hf.exports;Wf=1;var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function o(){o.init.call(this)}Hf.exports=o,Hf.exports.once=function(e,t){return new Promise(function(n,i){function o(n){e.removeListener(t,r),i(n)}function r(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}m(e,t,r,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&m(e,"error",t,{once:!0})}(e,o)})},o.EventEmitter=o,o.prototype._events=void 0,o.prototype._eventsCount=0,o.prototype._maxListeners=void 0;var r=10;function s(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var o,r,c;if(s(n),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),c=r[t]),void 0===c)c=r[t]=n,++e._eventsCount;else if("function"==typeof c?c=r[t]=i?[n,c]:[c,n]:i?c.unshift(n):c.push(n),(o=a(e))>0&&c.length>o&&!c.warned){c.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=c.length,console&&console.warn}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=l.bind(i);return o.listener=n,i.wrapFn=o,o}function u(e,t,n){var i=e._events;if(void 0===i)return[];var o=i[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(o):p(o,o.length)}function h(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function m(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function o(r){i.once&&e.removeEventListener(t,o),n(r)})}}return Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return r},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");r=e}}),o.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return a(this)},o.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var o="error"===e,r=this._events;if(void 0!==r)o=o&&void 0===r.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=r[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,d=p(c,l);for(i=0;i<l;++i)n(d[i],this,t)}return!0},o.prototype.addListener=function(e,t){return c(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return c(this,e,t,!0)},o.prototype.once=function(e,t){return s(t),this.on(e,d(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,d(this,e,t)),this},o.prototype.removeListener=function(e,t){var n,i,o,r,a;if(s(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(o=-1,r=n.length-1;r>=0;r--)if(n[r]===t||n[r].listener===t){a=n[r].listener,o=r;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,o),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.off=o.prototype.removeListener,o.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var o,r=Object.keys(n);for(i=0;i<r.length;++i)"removeListener"!==(o=r[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return u(this,e,!0)},o.prototype.rawListeners=function(e){return u(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},o.prototype.listenerCount=h,o.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},Hf.exports}();let Zf=!0,Jf=!0;function Kf(e,t,n){const i=e.match(t);return i&&i.length>=n&&parseFloat(i[n],10)}function Yf(e,t,n){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,o=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return o.apply(this,arguments);const r=e=>{const t=n(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,r),o.apply(this,[e,r])};const r=i.removeEventListener;i.removeEventListener=function(e,n){if(e!==t||!this._eventMap||!this._eventMap[t])return r.apply(this,arguments);if(!this._eventMap[t].has(n))return r.apply(this,arguments);const i=this._eventMap[t].get(n);return this._eventMap[t].delete(n),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,r.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function Qf(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Zf=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Xf(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Jf=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function eg(){if("object"==typeof window){if(Zf)return;"undefined"!=typeof console&&console.log}}function tg(e,t){}function ng(e){return"[object Object]"===Object.prototype.toString.call(e)}function ig(e){return ng(e)?Object.keys(e).reduce(function(t,n){const i=ng(e[n]),o=i?ig(e[n]):e[n],r=i&&!Object.keys(o).length;return void 0===o||r?t:Object.assign(t,{[n]:o})},{}):e}function og(e,t,n){t&&!n.has(t.id)&&(n.set(t.id,t),Object.keys(t).forEach(i=>{i.endsWith("Id")?og(e,e.get(t[i]),n):i.endsWith("Ids")&&t[i].forEach(t=>{og(e,e.get(t),n)})}))}function rg(e,t,n){const i=n?"outbound-rtp":"inbound-rtp",o=new Map;if(null===t)return o;const r=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&r.push(e)}),r.forEach(t=>{e.forEach(n=>{n.type===i&&n.trackId===t.id&&og(e,n,o)})}),o}const sg=eg;function ag(e,t){const n=e&&e.navigator;if(!n.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(n=>{if("require"===n||"advanced"===n||"mediaSource"===n)return;const i="object"==typeof e[n]?e[n]:{ideal:e[n]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[o("min",n)]=i.ideal,t.optional.push(e),e={},e[o("max",n)]=i.ideal,t.optional.push(e)):(e[o("",n)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[o("",n)]=i.exact):["min","max"].forEach(e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[o(e,n)]=i[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},o=function(e,o){if(t.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let r=e.video.facingMode;r=r&&("object"==typeof r?r:{ideal:r});const s=t.version<66;if(r&&("user"===r.exact||"environment"===r.exact||"user"===r.ideal||"environment"===r.ideal)&&(!n.mediaDevices.getSupportedConstraints||!n.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===r.exact||"environment"===r.ideal?t=["back","rear"]:"user"!==r.exact&&"user"!==r.ideal||(t=["front"]),t)return n.mediaDevices.enumerateDevices().then(n=>{let s=(n=n.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!s&&n.length&&t.includes("back")&&(s=n[n.length-1]),s&&(e.video.deviceId=r.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=i(e.video),sg("chrome: "+JSON.stringify(e)),o(e)})}e.video=i(e.video)}return sg("chrome: "+JSON.stringify(e)),o(e)},r=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(n.getUserMedia=function(e,t,i){o(e,e=>{n.webkitGetUserMedia(e,t,e=>{i&&i(r(e))})})}.bind(n),n.mediaDevices.getUserMedia){const e=n.mediaDevices.getUserMedia.bind(n.mediaDevices);n.mediaDevices.getUserMedia=function(t){return o(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>Promise.reject(r(e))))}}}function cg(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function lg(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",n=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.track.id):{track:n.track};const o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],this.dispatchEvent(o)}),t.stream.getTracks().forEach(n=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===n.id):{track:n};const o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Yf(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function dg(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const n=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let o=n.apply(this,arguments);return o||(o=t(this,e),this._senders.push(o)),o};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function ug(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>rg(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Yf(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>rg(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,n,i;return this.getSenders().forEach(n=>{n.track===e&&(t?i=!0:t=n)}),this.getReceivers().forEach(t=>(t.track===e&&(n?i=!0:n=t),t.track===e)),i||t&&n?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():n?n.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function hg(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){if(!n)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[n.id]?-1===this._shimmedLocalStreams[n.id].indexOf(i)&&this._shimmedLocalStreams[n.id].push(i):this._shimmedLocalStreams[n.id]=[n,i],i};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();n.apply(this,arguments);const i=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const o=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const n=this._shimmedLocalStreams[t].indexOf(e);-1!==n&&this._shimmedLocalStreams[t].splice(n,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),o.apply(this,arguments)}}function pg(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return hg(e);const n=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=n.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}i.apply(this,[t])};const o=e.RTCPeerConnection.prototype.removeStream;function r(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],o=e._streams[i.id];n=n.replace(new RegExp(o.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:n})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},o.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,n){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(e=>e===t))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(e=>e.track===t))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const o=this._streams[n.id];if(o)o.addTrack(t),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const i=new e.MediaStream([t]);this._streams[n.id]=i,this._reverseStreams[i.id]=n,this.addStream(i)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?n.apply(this,[t=>{const n=r(this,t);e[0].apply(null,[n])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):n.apply(this,arguments).then(e=>r(this,e))}};e.RTCPeerConnection.prototype[t]=i[t]});const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let n=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],o=e._streams[i.id];n=n.replace(new RegExp(i.id,"g"),o.id)}),new RTCSessionDescription({type:t.type,sdp:n})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:r(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(n=>{this._streams[n].getTracks().find(t=>e.track===t)&&(t=this._streams[n])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function mg(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]})}function fg(e,t){Yf(e,"negotiationneeded",e=>{const n=e.target;if(!(t.version<72||n.getConfiguration&&"plan-b"===n.getConfiguration().sdpSemantics)||"stable"===n.signalingState)return e})}var gg=Object.freeze({__proto__:null,fixNegotiationNeeded:fg,shimAddTrackRemoveTrack:pg,shimAddTrackRemoveTrackWithNative:hg,shimGetSendersWithDtmf:dg,shimGetUserMedia:ag,shimMediaStream:cg,shimOnTrack:lg,shimPeerConnection:mg,shimSenderReceiverGetStats:ug});function vg(e,t){const n=e&&e.navigator,i=e&&e.MediaStreamTrack;if(n.getUserMedia=function(e,t,i){n.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in n.mediaDevices.getSupportedConstraints())){const e=function(e,t,n){t in e&&!(n in e)&&(e[n]=e[t],delete e[t])},t=n.mediaDevices.getUserMedia.bind(n.mediaDevices);if(n.mediaDevices.getUserMedia=function(n){return"object"==typeof n&&"object"==typeof n.audio&&(n=JSON.parse(JSON.stringify(n)),e(n.audio,"autoGainControl","mozAutoGainControl"),e(n.audio,"noiseSuppression","mozNoiseSuppression")),t(n)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const n=t.apply(this,arguments);return e(n,"mozAutoGainControl","autoGainControl"),e(n,"mozNoiseSuppression","noiseSuppression"),n}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(n){return"audio"===this.kind&&"object"==typeof n&&(n=JSON.parse(JSON.stringify(n)),e(n,"autoGainControl","mozAutoGainControl"),e(n,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[n])}}}}function bg(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function yg(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(t){const n=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]});const n={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,o,r]=arguments;return i.apply(this,[e||null]).then(e=>{if(t.version<53&&!o)try{e.forEach(e=>{e.type=n[e.type]||e.type})}catch(Bx){if("TypeError"!==Bx.name)throw Bx;e.forEach((t,i)=>{e.set(i,Object.assign({},t,{type:n[t.type]||t.type}))})}return e}).then(o,r)}}function kg(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const n=e.RTCPeerConnection.prototype.addTrack;n&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=n.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function wg(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Yf(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Cg(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function Sg(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Tg(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const n=e.length>0;n&&e.forEach(e=>{if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=t.apply(this,arguments);if(n){const{sender:t}=i,n=t.getParameters();(!("encodings"in n)||1===n.encodings.length&&0===Object.keys(n.encodings[0]).length)&&(n.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(n).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return i})}function xg(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function Eg(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function _g(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var Ig=Object.freeze({__proto__:null,shimAddTransceiver:Tg,shimCreateAnswer:_g,shimCreateOffer:Eg,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(n){if(!n||!n.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===n.video?n.video={mediaSource:t}:n.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(n)})},shimGetParameters:xg,shimGetUserMedia:vg,shimOnTrack:bg,shimPeerConnection:yg,shimRTCDataChannel:Sg,shimReceiverGetStats:wg,shimRemoveStream:Cg,shimSenderGetStats:kg});function Pg(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(n=>t.call(this,n,e)),e.getVideoTracks().forEach(n=>t.call(this,n,e))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const n=e.getTracks();this.getSenders().forEach(e=>{n.includes(e.track)&&this.removeTrack(e)})})}}function Rg(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const n=new Event("addstream");n.stream=t,e.dispatchEvent(n)})}),t.apply(e,arguments)}}}function Ag(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,n=t.createOffer,i=t.createAnswer,o=t.setLocalDescription,r=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],o=n.apply(this,[i]);return t?(o.then(e,t),Promise.resolve()):o},t.createAnswer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],o=i.apply(this,[n]);return t?(o.then(e,t),Promise.resolve()):o};let a=function(e,t,n){const i=o.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i};t.setLocalDescription=a,a=function(e,t,n){const i=r.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i},t.setRemoteDescription=a,a=function(e,t,n){const i=s.apply(this,[e]);return n?(i.then(t,n),Promise.resolve()):i},t.addIceCandidate=a}function Mg(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,n=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>n(Og(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,n,i){t.mediaDevices.getUserMedia(e).then(n,i)}.bind(t))}function Og(e){return e&&void 0!==e.video?Object.assign({},e,{video:ig(e.video)}):e}function Dg(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,n){if(e&&e.iceServers){const t=[];for(let n=0;n<e.iceServers.length;n++){let i=e.iceServers[n];void 0===i.urls&&i.url?(tg(),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[n])}e.iceServers=t}return new t(e,n)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function Ng(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Lg(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const n=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function jg(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Ug,Fg=Object.freeze({__proto__:null,shimAudioContext:jg,shimCallbacksAPI:Ag,shimConstraints:Og,shimCreateOfferLegacy:Lg,shimGetUserMedia:Mg,shimLocalStreamsAPI:Pg,shimRTCIceServerUrls:Dg,shimRemoteStreamsAPI:Rg,shimTrackEventTransceiver:Ng}),Bg={exports:{}},zg=(Ug||(Ug=1,function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map(e=>e.trim())},t.splitSections=function(e){return e.split("\nm=").map((e,t)=>(t>0?"m="+e:e).trim()+"\r\n")},t.getDescription=function(e){const n=t.splitSections(e);return n&&n[0]},t.getMediaSections=function(e){const n=t.splitSections(e);return n.shift(),n},t.matchPrefix=function(e,n){return t.splitLines(e).filter(e=>0===e.indexOf(n))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const n={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let i=8;i<t.length;i+=2)switch(t[i]){case"raddr":n.relatedAddress=t[i+1];break;case"rport":n.relatedPort=parseInt(t[i+1],10);break;case"tcptype":n.tcpType=t[i+1];break;case"ufrag":n.ufrag=t[i+1],n.usernameFragment=t[i+1];break;default:void 0===n[t[i]]&&(n[t[i]]=t[i+1])}return n},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const n=e.component;"rtp"===n?t.push(1):"rtcp"===n?t.push(2):t.push(n),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const n={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),n.name=t[0],n.clockRate=parseInt(t[1],10),n.channels=3===t.length?parseInt(t[2],10):1,n.numChannels=n.channels,n},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const n=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==n?"/"+n:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let n;const i=e.substring(e.indexOf(" ")+1).split(";");for(let o=0;o<i.length;o++)n=i[o].trim().split("="),t[n[0].trim()]=n[1];return t},t.writeFmtp=function(e){let t="",n=e.payloadType;if(void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach(t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)}),t+="a=fmtp:"+n+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",n=e.payloadType;return void 0!==e.preferredPayloadType&&(n=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(e=>{t+="a=rtcp-fb:"+n+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"}),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),n={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(n.attribute=e.substring(t+1,i),n.value=e.substring(i+1)):n.attribute=e.substring(t+1),n},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(e=>parseInt(e,10))}},t.getMid=function(e){const n=t.matchPrefix(e,"a=mid:")[0];if(n)return n.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,n){return{role:"auto",fingerprints:t.matchPrefix(e+n,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let n="a=setup:"+t+"\r\n";return e.fingerprints.forEach(e=>{n+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"}),n},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,n){return t.matchPrefix(e+n,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,n){const i=t.matchPrefix(e+n,"a=ice-ufrag:")[0],o=t.matchPrefix(e+n,"a=ice-pwd:")[0];return i&&o?{usernameFragment:i.substring(12),password:o.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" ");n.profile=i[2];for(let r=3;r<i.length;r++){const o=i[r],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const i=t.parseRtpMap(s),r=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(i.parameters=r.length?t.parseFmtp(r[0]):{},i.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),n.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(i.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach(e=>{n.headerExtensions.push(t.parseExtmap(e))});const o=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return n.codecs.forEach(e=>{o.forEach(t=>{e.rtcpFeedback.find(e=>e.type===t.type&&e.parameter===t.parameter)||e.rtcpFeedback.push(t)})}),n},t.writeRtpDescription=function(e,n){let i="";i+="m="+e+" ",i+=n.codecs.length>0?"9":"0",i+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=n.codecs.map(e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",n.codecs.forEach(e=>{i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)});let o=0;return n.codecs.forEach(e=>{e.maxptime>o&&(o=e.maxptime)}),o>0&&(i+="a=maxptime:"+o+"\r\n"),n.headerExtensions&&n.headerExtensions.forEach(e=>{i+=t.writeExtmap(e)}),i},t.parseRtpEncodingParameters=function(e){const n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),r=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute),a=s.length>0&&s[0].ssrc;let c;const l=t.matchPrefix(e,"a=ssrc-group:FID").map(e=>e.substring(17).split(" ").map(e=>parseInt(e,10)));l.length>0&&l[0].length>1&&l[0][0]===a&&(c=l[0][1]),i.codecs.forEach(e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),n.push(t),o&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:r?"red+ulpfec":"red"},n.push(t))}}),0===n.length&&a&&n.push({ssrc:a});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,n.forEach(e=>{e.maxBitrate=d})),n},t.parseRtcpParameters=function(e){const n={},i=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"cname"===e.attribute)[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);const o=t.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;const r=t.matchPrefix(e,"a=rtcp-mux");return n.mux=r.length>0,n},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let n;const i=t.matchPrefix(e,"a=msid:");if(1===i.length)return n=i[0].substring(7).split(" "),{stream:n[0],track:n[1]};const o=t.matchPrefix(e,"a=ssrc:").map(e=>t.parseSsrcMedia(e)).filter(e=>"msid"===e.attribute);return o.length>0?(n=o[0].value.split(" "),{stream:n[0],track:n[1]}):void 0},t.parseSctpDescription=function(e){const n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");let o;i.length>0&&(o=parseInt(i[0].substring(19),10)),isNaN(o)&&(o=65536);const r=t.matchPrefix(e,"a=sctp-port:");if(r.length>0)return{port:parseInt(r[0].substring(12),10),protocol:n.fmt,maxMessageSize:o};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:o}}},t.writeSctpDescription=function(e,t){let n=[];return n="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&n.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),n.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,n,i){let o;const r=void 0!==n?n:2;return o=e||t.generateSessionId(),"v=0\r\no="+(i||"thisisadapterortc")+" "+o+" "+r+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,n){const i=t.splitLines(e);for(let t=0;t<i.length;t++)switch(i[t]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[t].substring(2)}return n?t.getDirection(n):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const n=t.splitLines(e)[0].substring(2).split(" ");return{kind:n[0],port:parseInt(n[1],10),protocol:n[2],fmt:n.slice(3).join(" ")}},t.parseOLine=function(e){const n=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:n[0],sessionId:n[1],sessionVersion:parseInt(n[2],10),netType:n[3],addressType:n[4],address:n[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const n=t.splitLines(e);for(let t=0;t<n.length;t++)if(n[t].length<2||"="!==n[t].charAt(1))return!1;return!0},e.exports=t}(Bg)),Bg.exports),Vg=_f(zg),$g=Hu({__proto__:null,default:Vg},[zg]);function qg(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substring(2)),e.candidate&&e.candidate.length){const n=new t(e),i=Vg.parseCandidate(e.candidate);for(const e in i)e in n||Object.defineProperty(n,e,{value:i[e]});return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Yf(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Wg(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||Yf(e,"icecandidate",e=>{if(e.candidate){const t=Vg.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e})}function Hg(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=Vg.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=Vg.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const n=parseInt(t[1],10);return n!=n?-1:n}(arguments[0]),n=function(e){let n=65536;return"firefox"===t.browser&&(n=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),n}(e),i=function(e,n){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const o=Vg.matchPrefix(e.sdp,"a=max-message-size:");return o.length>0?i=parseInt(o[0].substring(19),10):"firefox"===t.browser&&-1!==n&&(i=2147483637),i}(arguments[0],e);let o;o=0===n&&0===i?Number.POSITIVE_INFINITY:0===n||0===i?Math.max(n,i):Math.min(n,i);const r={};Object.defineProperty(r,"maxMessageSize",{get:()=>o}),this._sctp=r}return n.apply(this,arguments)}}function Gg(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const n=e.send;e.send=function(){const i=arguments[0],o=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&o>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return n.apply(e,arguments)}}const n=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=n.apply(this,arguments);return t(e,this),e},Yf(e,"datachannel",e=>(t(e.channel,e.target),e))}function Zg(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const n=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const n=new Event("connectionstatechange",e);t.dispatchEvent(n)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function Jg(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t._safariVersion>=13.1)return;const n=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const n=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==e.trim()).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return n.apply(this,arguments)}}function Kg(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.addIceCandidate;n&&0!==n.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():n.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function Yg(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const n=e.RTCPeerConnection.prototype.setLocalDescription;n&&0!==n.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return n.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}return e.sdp||"offer"!==e.type&&"answer"!==e.type?n.apply(this,[e]):("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then(e=>n.apply(this,[e]))})}var Qg=Object.freeze({__proto__:null,removeExtmapAllowMixed:Jg,shimAddIceCandidateNullOrEmpty:Kg,shimConnectionState:Zg,shimMaxMessageSize:Hg,shimParameterlessSetLocalDescription:Yg,shimRTCIceCandidate:qg,shimRTCIceCandidateRelayProtocol:Wg,shimSendThrowTypeError:Gg});!function(){let{window:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const n=eg,i=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator||!e.navigator.userAgent)return t.browser="Not a browser.",t;const{navigator:n}=e;if(n.userAgentData&&n.userAgentData.brands){const e=n.userAgentData.brands.find(e=>"Chromium"===e.brand);if(e)return{browser:"chrome",version:parseInt(e.version,10)}}if(n.mozGetUserMedia)t.browser="firefox",t.version=parseInt(Kf(n.userAgent,/Firefox\/(\d+)\./,1));else if(n.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=parseInt(Kf(n.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else{if(!e.RTCPeerConnection||!n.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=parseInt(Kf(n.userAgent,/AppleWebKit\/(\d+)\./,1)),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype,t._safariVersion=Kf(n.userAgent,/Version\/(\d+(\.?\d+))/,1)}return t}(e),o={browserDetails:i,commonShim:Qg,extractVersion:Kf,disableLog:Qf,disableWarnings:Xf,sdp:$g};switch(i.browser){case"chrome":if(!gg||!mg||!t.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=gg,Kg(e,i),Yg(e),ag(e,i),cg(e),mg(e,i),lg(e),pg(e,i),dg(e),ug(e),fg(e,i),qg(e),Wg(e),Zg(e),Hg(e,i),Gg(e),Jg(e,i);break;case"firefox":if(!Ig||!yg||!t.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=Ig,Kg(e,i),Yg(e),vg(e,i),yg(e,i),bg(e),Cg(e),kg(e),wg(e),Sg(e),Tg(e),xg(e),Eg(e),_g(e),qg(e),Zg(e),Hg(e,i),Gg(e);break;case"safari":if(!Fg||!t.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=Fg,Kg(e,i),Yg(e),Dg(e),Lg(e),Ag(e),Pg(e),Rg(e),Ng(e),Mg(e),jg(e),qg(e),Wg(e),Hg(e,i),Gg(e),Jg(e,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});const Xg="lk_e2ee";var ev,tv,nv,iv,ov,rv,sv,av,cv,lv,dv,uv,hv,pv,mv,fv,gv,vv,bv,yv,kv,wv;function Cv(){return void 0!==window.RTCRtpScriptTransform}(tv=ev||(ev={})).SetKey="setKey",tv.RatchetRequest="ratchetRequest",tv.KeyRatcheted="keyRatcheted",(nv||(nv={})).KeyRatcheted="keyRatcheted",(ov=iv||(iv={})).ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",ov.EncryptionError="encryptionError",(rv||(rv={})).Error="cryptorError",Gf.EventEmitter;class Sv extends Error{constructor(e,t){super(t||"an error has occured"),this.name="LiveKitError",this.code=e}}(av=sv||(sv={}))[av.NotAllowed=0]="NotAllowed",av[av.ServerUnreachable=1]="ServerUnreachable",av[av.InternalError=2]="InternalError",av[av.Cancelled=3]="Cancelled",av[av.LeaveRequest=4]="LeaveRequest",av[av.Timeout=5]="Timeout";class Tv extends Sv{constructor(e,t,n,i){super(1,e),this.name="ConnectionError",this.status=n,this.reason=t,this.context=i,this.reasonName=sv[t]}}class xv extends Sv{constructor(e){super(21,null!=e?e:"device is unsupported"),this.name="DeviceUnsupportedError"}}class Ev extends Sv{constructor(e){super(20,null!=e?e:"track is invalid"),this.name="TrackInvalidError"}}class _v extends Sv{constructor(e){super(10,null!=e?e:"unsupported server"),this.name="UnsupportedServer"}}class Iv extends Sv{constructor(e){super(12,null!=e?e:"unexpected connection state"),this.name="UnexpectedConnectionState"}}class Pv extends Sv{constructor(e){super(13,null!=e?e:"unable to negotiate"),this.name="NegotiationError"}}class Rv extends Sv{constructor(e,t){super(15,e),this.name="PublishTrackError",this.status=t}}class Av extends Sv{constructor(e,t){super(15,e),this.reason=t,this.reasonName="string"==typeof t?t:Tf[t]}}(lv=cv||(cv={}))[lv.AlreadyOpened=0]="AlreadyOpened",lv[lv.AbnormalEnd=1]="AbnormalEnd",lv[lv.DecodeFailed=2]="DecodeFailed",lv[lv.LengthExceeded=3]="LengthExceeded",lv[lv.Incomplete=4]="Incomplete",lv[lv.HandlerAlreadyRegistered=7]="HandlerAlreadyRegistered",lv[lv.EncryptionTypeMismatch=8]="EncryptionTypeMismatch";class Mv extends Sv{constructor(e,t){super(16,e),this.name="DataStreamError",this.reason=t,this.reasonName=cv[t]}}(uv=dv||(dv={})).PermissionDenied="PermissionDenied",uv.NotFound="NotFound",uv.DeviceInUse="DeviceInUse",uv.Other="Other",function(e){e.getFailure=function(t){if(t&&"name"in t)return"NotFoundError"===t.name||"DevicesNotFoundError"===t.name?e.NotFound:"NotAllowedError"===t.name||"PermissionDeniedError"===t.name?e.PermissionDenied:"NotReadableError"===t.name||"TrackStartError"===t.name?e.DeviceInUse:e.Other}}(dv||(dv={})),(pv=hv||(hv={}))[pv.InvalidKey=0]="InvalidKey",pv[pv.MissingKey=1]="MissingKey",pv[pv.InternalError=2]="InternalError",(fv=mv||(mv={})).Connected="connected",fv.Reconnecting="reconnecting",fv.SignalReconnecting="signalReconnecting",fv.Reconnected="reconnected",fv.Disconnected="disconnected",fv.ConnectionStateChanged="connectionStateChanged",fv.Moved="moved",fv.MediaDevicesChanged="mediaDevicesChanged",fv.ParticipantConnected="participantConnected",fv.ParticipantDisconnected="participantDisconnected",fv.TrackPublished="trackPublished",fv.TrackSubscribed="trackSubscribed",fv.TrackSubscriptionFailed="trackSubscriptionFailed",fv.TrackUnpublished="trackUnpublished",fv.TrackUnsubscribed="trackUnsubscribed",fv.TrackMuted="trackMuted",fv.TrackUnmuted="trackUnmuted",fv.LocalTrackPublished="localTrackPublished",fv.LocalTrackUnpublished="localTrackUnpublished",fv.LocalAudioSilenceDetected="localAudioSilenceDetected",fv.ActiveSpeakersChanged="activeSpeakersChanged",fv.ParticipantMetadataChanged="participantMetadataChanged",fv.ParticipantNameChanged="participantNameChanged",fv.ParticipantAttributesChanged="participantAttributesChanged",fv.ParticipantActive="participantActive",fv.RoomMetadataChanged="roomMetadataChanged",fv.DataReceived="dataReceived",fv.SipDTMFReceived="sipDTMFReceived",fv.TranscriptionReceived="transcriptionReceived",fv.ConnectionQualityChanged="connectionQualityChanged",fv.TrackStreamStateChanged="trackStreamStateChanged",fv.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",fv.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",fv.AudioPlaybackStatusChanged="audioPlaybackChanged",fv.VideoPlaybackStatusChanged="videoPlaybackChanged",fv.MediaDevicesError="mediaDevicesError",fv.ParticipantPermissionsChanged="participantPermissionsChanged",fv.SignalConnected="signalConnected",fv.RecordingStatusChanged="recordingStatusChanged",fv.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",fv.EncryptionError="encryptionError",fv.DCBufferStatusChanged="dcBufferStatusChanged",fv.ActiveDeviceChanged="activeDeviceChanged",fv.ChatMessage="chatMessage",fv.LocalTrackSubscribed="localTrackSubscribed",fv.MetricsReceived="metricsReceived",(vv=gv||(gv={})).TrackPublished="trackPublished",vv.TrackSubscribed="trackSubscribed",vv.TrackSubscriptionFailed="trackSubscriptionFailed",vv.TrackUnpublished="trackUnpublished",vv.TrackUnsubscribed="trackUnsubscribed",vv.TrackMuted="trackMuted",vv.TrackUnmuted="trackUnmuted",vv.LocalTrackPublished="localTrackPublished",vv.LocalTrackUnpublished="localTrackUnpublished",vv.LocalTrackCpuConstrained="localTrackCpuConstrained",vv.LocalSenderCreated="localSenderCreated",vv.ParticipantMetadataChanged="participantMetadataChanged",vv.ParticipantNameChanged="participantNameChanged",vv.DataReceived="dataReceived",vv.SipDTMFReceived="sipDTMFReceived",vv.TranscriptionReceived="transcriptionReceived",vv.IsSpeakingChanged="isSpeakingChanged",vv.ConnectionQualityChanged="connectionQualityChanged",vv.TrackStreamStateChanged="trackStreamStateChanged",vv.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",vv.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",vv.TrackCpuConstrained="trackCpuConstrained",vv.MediaDevicesError="mediaDevicesError",vv.AudioStreamAcquired="audioStreamAcquired",vv.ParticipantPermissionsChanged="participantPermissionsChanged",vv.PCTrackAdded="pcTrackAdded",vv.AttributesChanged="attributesChanged",vv.LocalTrackSubscribed="localTrackSubscribed",vv.ChatMessage="chatMessage",vv.Active="active",(yv=bv||(bv={})).TransportsCreated="transportsCreated",yv.Connected="connected",yv.Disconnected="disconnected",yv.Resuming="resuming",yv.Resumed="resumed",yv.Restarting="restarting",yv.Restarted="restarted",yv.SignalResumed="signalResumed",yv.SignalRestarted="signalRestarted",yv.Closing="closing",yv.MediaTrackAdded="mediaTrackAdded",yv.ActiveSpeakersUpdate="activeSpeakersUpdate",yv.DataPacketReceived="dataPacketReceived",yv.RTPVideoMapUpdate="rtpVideoMapUpdate",yv.DCBufferStatusChanged="dcBufferStatusChanged",yv.ParticipantUpdate="participantUpdate",yv.RoomUpdate="roomUpdate",yv.SpeakersChanged="speakersChanged",yv.StreamStateChanged="streamStateChanged",yv.ConnectionQualityUpdate="connectionQualityUpdate",yv.SubscriptionError="subscriptionError",yv.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",yv.RemoteMute="remoteMute",yv.SubscribedQualityUpdate="subscribedQualityUpdate",yv.LocalTrackUnpublished="localTrackUnpublished",yv.LocalTrackSubscribed="localTrackSubscribed",yv.Offline="offline",yv.SignalRequestResponse="signalRequestResponse",yv.SignalConnected="signalConnected",yv.RoomMoved="roomMoved",(wv=kv||(kv={})).Message="message",wv.Muted="muted",wv.Unmuted="unmuted",wv.Restarted="restarted",wv.Ended="ended",wv.Subscribed="subscribed",wv.Unsubscribed="unsubscribed",wv.CpuConstrained="cpuConstrained",wv.UpdateSettings="updateSettings",wv.UpdateSubscription="updateSubscription",wv.AudioPlaybackStarted="audioPlaybackStarted",wv.AudioPlaybackFailed="audioPlaybackFailed",wv.AudioSilenceDetected="audioSilenceDetected",wv.VisibilityChanged="visibilityChanged",wv.VideoDimensionsChanged="videoDimensionsChanged",wv.VideoPlaybackStarted="videoPlaybackStarted",wv.VideoPlaybackFailed="videoPlaybackFailed",wv.ElementAttached="elementAttached",wv.ElementDetached="elementDetached",wv.UpstreamPaused="upstreamPaused",wv.UpstreamResumed="upstreamResumed",wv.SubscriptionPermissionChanged="subscriptionPermissionChanged",wv.SubscriptionStatusChanged="subscriptionStatusChanged",wv.SubscriptionFailed="subscriptionFailed",wv.TrackProcessorUpdate="trackProcessorUpdate",wv.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",wv.TranscriptionReceived="transcriptionReceived",wv.TimeSyncUpdate="timeSyncUpdate",wv.PreConnectBufferFlushed="preConnectBufferFlushed";const Ov=/version\/(\d+(\.?_?\d+)+)/i;let Dv;function Nv(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if("undefined"==typeof navigator)return;const n=navigator.userAgent.toLowerCase();if(void 0===Dv||t){const e=Lv.find(e=>{let{test:t}=e;return t.test(n)});Dv=null==e?void 0:e.describe(n)}return Dv}const Lv=[{test:/firefox|iceweasel|fxios/i,describe:e=>({name:"Firefox",version:jv(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:Uv(e)})},{test:/chrom|crios|crmo/i,describe:e=>({name:"Chrome",version:jv(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),os:e.toLowerCase().includes("crios")?"iOS":void 0,osVersion:Uv(e)})},{test:/safari|applewebkit/i,describe:e=>({name:"Safari",version:jv(Ov,e),os:e.includes("mobile/")?"iOS":"macOS",osVersion:Uv(e)})}];function jv(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;const i=t.match(e);return i&&i.length>=n&&i[n]||""}function Uv(e){return e.includes("mac os")?jv(/\(.+?(\d+_\d+(:?_\d+)?)/,e,1).replace(/_/g,"."):void 0}class Fv{}Fv.setTimeout=function(){return setTimeout(...arguments)},Fv.setInterval=function(){return setInterval(...arguments)},Fv.clearTimeout=function(){return clearTimeout(...arguments)},Fv.clearInterval=function(){return clearInterval(...arguments)};const Bv=[];var zv,Vv;(Vv=zv||(zv={}))[Vv.LOW=0]="LOW",Vv[Vv.MEDIUM=1]="MEDIUM",Vv[Vv.HIGH=2]="HIGH";class $v extends Gf.EventEmitter{get streamState(){return this._streamState}setStreamState(e){this._streamState=e}constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=$v.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=Uf,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),"hidden"===document.visibilityState?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),5e3):this.handleAppVisibilityChanged()},this.log=Ff(null!==(i=n.loggerName)&&void 0!==i?i:Af.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=t,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=$v.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},null===(e=this.loggerContextCb)||void 0===e?void 0:e.call(this)),Yb(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let t="audio";this.kind===$v.Kind.Video&&(t="video"),0===this.attachedElements.length&&this.kind===$v.Kind.Video&&this.addAppVisibilityListener(),e||("audio"===t&&(Bv.forEach(t=>{null!==t.parentElement||e||(e=t)}),e&&Bv.splice(Bv.indexOf(e),1)),e||(e=document.createElement(t))),this.attachedElements.includes(e)||this.attachedElements.push(e),qv(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),i=n.some(e=>"audio"===e.kind);return e.play().then(()=>{this.emit(i?kv.AudioPlaybackStarted:kv.VideoPlaybackStarted)}).catch(t=>{"NotAllowedError"===t.name?this.emit(i?kv.AudioPlaybackFailed:kv.VideoPlaybackFailed,t):"AbortError"===t.name?Uf.debug("".concat(i?"audio":"video"," playback aborted, likely due to new play request")):Uf.warn("could not playback ".concat(i?"audio":"video"),t),i&&e&&n.some(e=>"video"===e.kind)&&"NotAllowedError"===t.name&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(kv.ElementAttached,e),e}detach(e){try{if(e){Wv(this.mediaStreamTrack,e);const t=this.attachedElements.indexOf(e);return t>=0&&(this.attachedElements.splice(t,1),this.recycleElement(e),this.emit(kv.ElementDetached,e)),e}const t=[];return this.attachedElements.forEach(e=>{Wv(this.mediaStreamTrack,e),t.push(e),this.recycleElement(e),this.emit(kv.ElementDetached,e)}),this.attachedElements=[],t}finally{0===this.attachedElements.length&&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=Ff(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let t=!0;e.pause(),Bv.forEach(e=>{e.parentElement||(t=!1)}),t&&Bv.push(e)}}handleAppVisibilityChanged(){return $f(this,void 0,void 0,function*(){this.isInBackground="hidden"===document.visibilityState,this.isInBackground||this.kind!==$v.Kind.Video||setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){pb()?(this.isInBackground="hidden"===document.visibilityState,document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){pb()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function qv(e,t){let n,i;n=t.srcObject instanceof MediaStream?t.srcObject:new MediaStream,i="audio"===e.kind?n.getAudioTracks():n.getVideoTracks(),i.includes(e)||(i.forEach(e=>{n.removeTrack(e)}),n.addTrack(e)),db()&&t instanceof HTMLVideoElement||(t.autoplay=!0),t.muted=0===n.getAudioTracks().length,t instanceof HTMLVideoElement&&(t.playsInline=!0),t.srcObject!==n&&(t.srcObject=n,(db()||lb())&&t instanceof HTMLVideoElement&&setTimeout(()=>{t.srcObject=n,t.play().catch(()=>{})},0))}function Wv(e,t){if(t.srcObject instanceof MediaStream){const n=t.srcObject;n.removeTrack(e),n.getTracks().length>0?t.srcObject=n:t.srcObject=null}}!function(e){let t;var n;let i;var o;let r;var s;(n=t=e.Kind||(e.Kind={})).Audio="audio",n.Video="video",n.Unknown="unknown",(o=i=e.Source||(e.Source={})).Camera="camera",o.Microphone="microphone",o.ScreenShare="screen_share",o.ScreenShareAudio="screen_share_audio",o.Unknown="unknown",(s=r=e.StreamState||(e.StreamState={})).Active="active",s.Paused="paused",s.Unknown="unknown",e.kindToProto=function(e){switch(e){case t.Audio:return Ap.AUDIO;case t.Video:return Ap.VIDEO;default:return Ap.DATA}},e.kindFromProto=function(e){switch(e){case Ap.AUDIO:return t.Audio;case Ap.VIDEO:return t.Video;default:return t.Unknown}},e.sourceToProto=function(e){switch(e){case i.Camera:return Mp.CAMERA;case i.Microphone:return Mp.MICROPHONE;case i.ScreenShare:return Mp.SCREEN_SHARE;case i.ScreenShareAudio:return Mp.SCREEN_SHARE_AUDIO;default:return Mp.UNKNOWN}},e.sourceFromProto=function(e){switch(e){case Mp.CAMERA:return i.Camera;case Mp.MICROPHONE:return i.Microphone;case Mp.SCREEN_SHARE:return i.ScreenShare;case Mp.SCREEN_SHARE_AUDIO:return i.ScreenShareAudio;default:return i.Unknown}},e.streamStateFromProto=function(e){switch(e){case Rm.ACTIVE:return r.Active;case Rm.PAUSED:return r.Paused;default:return r.Unknown}}}($v||($v={}));class Hv{constructor(e,t,n,i,o){if("object"==typeof e)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(void 0===t||void 0===n)throw new TypeError("Unsupported options: provide at least width, height and maxBitrate");this.width=e,this.height=t,this.aspectRatio=e/t,this.encoding={maxBitrate:n,maxFramerate:i,priority:o}}}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const Gv=["vp8","h264"],Zv=["vp8","h264","vp9","av1","h265"],Jv=function(e){return!!Gv.find(t=>t===e)};var Kv,Yv,Qv,Xv;(Yv=Kv||(Kv={}))[Yv.PREFER_REGRESSION=0]="PREFER_REGRESSION",Yv[Yv.SIMULCAST=1]="SIMULCAST",Yv[Yv.REGRESSION=2]="REGRESSION",(Xv=Qv||(Qv={})).telephone={maxBitrate:12e3},Xv.speech={maxBitrate:24e3},Xv.music={maxBitrate:48e3},Xv.musicStereo={maxBitrate:64e3},Xv.musicHighQuality={maxBitrate:96e3},Xv.musicHighQualityStereo={maxBitrate:128e3};const eb={h90:new Hv(160,90,9e4,20),h180:new Hv(320,180,16e4,20),h216:new Hv(384,216,18e4,20),h360:new Hv(640,360,45e4,20),h540:new Hv(960,540,8e5,25),h720:new Hv(1280,720,17e5,30),h1080:new Hv(1920,1080,3e6,30),h1440:new Hv(2560,1440,5e6,30),h2160:new Hv(3840,2160,8e6,30)},tb={h120:new Hv(160,120,7e4,20),h180:new Hv(240,180,125e3,20),h240:new Hv(320,240,14e4,20),h360:new Hv(480,360,33e4,20),h480:new Hv(640,480,5e5,20),h540:new Hv(720,540,6e5,25),h720:new Hv(960,720,13e5,30),h1080:new Hv(1440,1080,23e5,30),h1440:new Hv(1920,1440,38e5,30)},nb={h360fps3:new Hv(640,360,2e5,3,"medium"),h360fps15:new Hv(640,360,4e5,15,"medium"),h720fps5:new Hv(1280,720,8e5,5,"medium"),h720fps15:new Hv(1280,720,15e5,15,"medium"),h720fps30:new Hv(1280,720,2e6,30,"medium"),h1080fps15:new Hv(1920,1080,25e5,15,"medium"),h1080fps30:new Hv(1920,1080,5e6,30,"medium"),original:new Hv(0,0,7e6,30,"medium")},ib="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function ob(e){return $f(this,void 0,void 0,function*(){return new Promise(t=>Fv.setTimeout(t,e))})}function rb(){return"addTransceiver"in RTCPeerConnection.prototype}function sb(){return"addTrack"in RTCPeerConnection.prototype}function ab(e){return"av1"===e||"vp9"===e}function cb(e){return!(!document||ub())&&(e||(e=document.createElement("audio")),"setSinkId"in e)}function lb(){var e;return"Firefox"===(null===(e=Nv())||void 0===e?void 0:e.name)}function db(){var e;return"Safari"===(null===(e=Nv())||void 0===e?void 0:e.name)}function ub(){const e=Nv();return"Safari"===(null==e?void 0:e.name)||"iOS"===(null==e?void 0:e.os)}function hb(){var e,t;return!!pb()&&(null!==(t=null===(e=navigator.userAgentData)||void 0===e?void 0:e.mobile)&&void 0!==t?t:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent))}function pb(){return"undefined"!=typeof document}function mb(){return"ReactNative"==navigator.product}function fb(e){return e.hostname.endsWith(".livekit.cloud")||e.hostname.endsWith(".livekit.run")}function gb(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function vb(){if(!mb())return;let e=gb();return e?e.platform:void 0}function bb(){if(pb())return window.devicePixelRatio;if(mb()){let e=gb();if(e)return e.devicePixelRatio}return 1}function yb(e,t){const n=e.split("."),i=t.split("."),o=Math.min(n.length,i.length);for(let r=0;r<o;++r){const e=parseInt(n[r],10),t=parseInt(i[r],10);if(e>t)return 1;if(e<t)return-1;if(r===o-1&&e===t)return 0}return""===e&&""!==t?-1:""===t?1:n.length==i.length?0:n.length<i.length?-1:1}function kb(e){for(const t of e)t.target.handleResize(t)}function wb(e){for(const t of e)t.target.handleVisibilityChanged(t)}let Cb=null;const Sb=()=>(Cb||(Cb=new ResizeObserver(kb)),Cb);let Tb=null;const xb=()=>(Tb||(Tb=new IntersectionObserver(wb,{root:null,rootMargin:"0px"})),Tb);function Eb(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:16,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const o=document.createElement("canvas");o.width=e,o.height=t;const r=o.getContext("2d");null==r||r.fillRect(0,0,o.width,o.height),i&&r&&(r.beginPath(),r.arc(e/2,t/2,50,0,2*Math.PI,!0),r.closePath(),r.fillStyle="grey",r.fill());const s=o.captureStream(),[a]=s.getTracks();if(!a)throw Error("Could not get empty media stream video track");return a.enabled=n,a}let _b;function Ib(){if(!_b){const e=new AudioContext,t=e.createOscillator(),n=e.createGain();n.gain.setValueAtTime(0,0);const i=e.createMediaStreamDestination();if(t.connect(n),n.connect(i),t.start(),[_b]=i.stream.getAudioTracks(),!_b)throw Error("Could not get empty media stream audio track");_b.enabled=!1}return _b.clone()}class Pb{get isResolved(){return this._isResolved}constructor(e,t){this._isResolved=!1,this.onFinally=t,this.promise=new Promise((t,n)=>$f(this,void 0,void 0,function*(){this.resolve=t,this.reject=n,e&&(yield e(t,n))})).finally(()=>{var e;this._isResolved=!0,null===(e=this.onFinally)||void 0===e||e.call(this)})}}function Rb(e){if("string"==typeof e||"number"==typeof e)return e;if(Array.isArray(e))return e[0];if(void 0!==e.exact)return Array.isArray(e.exact)?e.exact[0]:e.exact;if(void 0!==e.ideal)return Array.isArray(e.ideal)?e.ideal[0]:e.ideal;throw Error("could not unwrap constraint")}function Ab(e){return e.startsWith("ws")?e.replace(/^(ws)/,"http"):e}function Mb(e){switch(e.reason){case sv.LeaveRequest:return e.context;case sv.Cancelled:return Lp.CLIENT_INITIATED;case sv.NotAllowed:return Lp.USER_REJECTED;case sv.ServerUnreachable:return Lp.JOIN_FAILURE;default:return Lp.UNKNOWN_REASON}}function Ob(e){return void 0!==e?Number(e):void 0}function Db(e){return void 0!==e?BigInt(e):void 0}function Nb(e){return!!e&&!(e instanceof MediaStreamTrack)&&e.isLocal}function Lb(e){return!!e&&e.kind==$v.Kind.Audio}function jb(e){return!!e&&e.kind==$v.Kind.Video}function Ub(e){return Nb(e)&&jb(e)}function Fb(e){return Nb(e)&&Lb(e)}function Bb(e){return!!e&&!e.isLocal}function zb(e){return!!e&&!e.isLocal}function Vb(e){return Bb(e)&&jb(e)}function $b(e,t,n){var i,o,r,s;const{optionsWithoutProcessor:a,audioProcessor:c,videoProcessor:l}=Qb(null!=e?e:{}),d=null==t?void 0:t.processor,u=null==n?void 0:n.processor,h=null!=a?a:{};return!0===h.audio&&(h.audio={}),!0===h.video&&(h.video={}),h.audio&&(qb(h.audio,t),null!==(i=(r=h.audio).deviceId)&&void 0!==i||(r.deviceId={ideal:"default"}),(c||d)&&(h.audio.processor=null!=c?c:d)),h.video&&(qb(h.video,n),null!==(o=(s=h.video).deviceId)&&void 0!==o||(s.deviceId={ideal:"default"}),(l||u)&&(h.video.processor=null!=l?l:u)),h}function qb(e,t){return Object.keys(t).forEach(n=>{void 0===e[n]&&(e[n]=t[n])}),e}function Wb(e){var t,n,i,o;const r={};if(e.video)if("object"==typeof e.video){const n={},o=n,s=e.video;Object.keys(s).forEach(e=>{"resolution"===e?qb(o,s.resolution):o[e]=s[e]}),r.video=n,null!==(t=(i=r.video).deviceId)&&void 0!==t||(i.deviceId={ideal:"default"})}else r.video=!!e.video&&{deviceId:{ideal:"default"}};else r.video=!1;return e.audio?"object"==typeof e.audio?(r.audio=e.audio,null!==(n=(o=r.audio).deviceId)&&void 0!==n||(o.deviceId={ideal:"default"})):r.audio={deviceId:{ideal:"default"}}:r.audio=!1,r}function Hb(){var e;const t="undefined"!=typeof window&&(window.AudioContext||window.webkitAudioContext);if(t){const n=new t({latencyHint:"interactive"});if("suspended"===n.state&&"undefined"!=typeof window&&(null===(e=window.document)||void 0===e?void 0:e.body)){const e=()=>$f(this,void 0,void 0,function*(){var t;try{"suspended"===n.state&&(yield n.resume())}catch(Bx){}finally{null===(t=window.document.body)||void 0===t||t.removeEventListener("click",e)}});n.addEventListener("statechange",()=>{var t;"closed"===n.state&&(null===(t=window.document.body)||void 0===t||t.removeEventListener("click",e))}),window.document.body.addEventListener("click",e)}return n}}function Gb(e){return"audioinput"===e?$v.Source.Microphone:"videoinput"===e?$v.Source.Camera:$v.Source.Unknown}function Zb(e){return e===$v.Source.Microphone?"audioinput":e===$v.Source.Camera?"videoinput":void 0}function Jb(e){return e.split("/")[1].toLowerCase()}function Kb(e){const t=[];return e.forEach(e=>{void 0!==e.track&&t.push(new Bm({cid:e.track.mediaStreamID,track:e.trackInfo}))}),t}function Yb(e){return"mediaStreamTrack"in e?{trackID:e.sid,source:e.source,muted:e.isMuted,enabled:e.mediaStreamTrack.enabled,kind:e.kind,streamID:e.mediaStreamID,streamTrackID:e.mediaStreamTrack.id}:{trackID:e.trackSid,enabled:e.isEnabled,muted:e.isMuted,trackInfo:Object.assign({mimeType:e.mimeType,name:e.trackName,encrypted:e.isEncrypted,kind:e.kind,source:e.source},e.track?Yb(e.track):{})}}function Qb(e){const t=Object.assign({},e);let n,i;return"object"==typeof t.audio&&t.audio.processor&&(n=t.audio.processor,t.audio=Object.assign(Object.assign({},t.audio),{processor:void 0})),"object"==typeof t.video&&t.video.processor&&(i=t.video.processor,t.video=Object.assign(Object.assign({},t.video),{processor:void 0})),{audioProcessor:n,videoProcessor:i,optionsWithoutProcessor:(o=t,void 0===o?o:"function"==typeof structuredClone?"object"==typeof o&&null!==o?structuredClone(Object.assign({},o)):structuredClone(o):JSON.parse(JSON.stringify(o)))};var o}function Xb(e,t){return e.width*e.height<t.width*t.height}class ey extends Gf.EventEmitter{constructor(e,t){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=e=>{var t,n;const{kind:i,data:o}=e.data;switch(i){case"error":Uf.error(o.error.message),this.emit(iv.EncryptionError,o.error);break;case"initAck":o.enabled&&this.keyProvider.getKeys().forEach(e=>{this.postKey(e)});break;case"enable":if(o.enabled&&this.keyProvider.getKeys().forEach(e=>{this.postKey(e)}),this.encryptionEnabled!==o.enabled&&o.participantIdentity===(null===(t=this.room)||void 0===t?void 0:t.localParticipant.identity))this.emit(iv.ParticipantEncryptionStatusChanged,o.enabled,this.room.localParticipant),this.encryptionEnabled=o.enabled;else if(o.participantIdentity){const e=null===(n=this.room)||void 0===n?void 0:n.getParticipantByIdentity(o.participantIdentity);if(!e)throw TypeError("couldn't set encryption status, participant not found".concat(o.participantIdentity));this.emit(iv.ParticipantEncryptionStatusChanged,o.enabled,e)}break;case"ratchetKey":this.keyProvider.emit(ev.KeyRatcheted,o.ratchetResult,o.participantIdentity,o.keyIndex);break;case"decryptDataResponse":const e=this.decryptDataRequests.get(o.uuid);(null==e?void 0:e.resolve)&&e.resolve(o);break;case"encryptDataResponse":const i=this.encryptDataRequests.get(o.uuid);(null==i?void 0:i.resolve)&&i.resolve(o)}},this.onWorkerError=e=>{Uf.error("e2ee worker encountered an error:",{error:e.error}),this.emit(iv.EncryptionError,e.error)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=t}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}setup(e){if(!(void 0!==window.RTCRtpSender&&void 0!==window.RTCRtpSender.prototype.createEncodedStreams||Cv()))throw new xv("tried to setup end-to-end encryption on an unsupported browser");if(Uf.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const t={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Bf.getLevel()}};this.worker&&(Uf.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(t))}}setParticipantCryptorEnabled(e,t){Uf.debug("set e2ee to ".concat(e," for participant ").concat(t)),this.postEnable(e,t)}setSifTrailer(e){e&&0!==e.length?this.postSifTrailer(e):Uf.warn("ignoring server sent trailer as it's empty")}setupEngine(e){e.on(bv.RTPVideoMapUpdate,e=>{this.postRTPMap(e)})}setupEventListeners(e,t){e.on(mv.TrackPublished,(e,t)=>this.setParticipantCryptorEnabled(e.trackInfo.encryption!==Gp.NONE,t.identity)),e.on(mv.ConnectionStateChanged,t=>{t===Tk.Connected&&e.remoteParticipants.forEach(e=>{e.trackPublications.forEach(t=>{this.setParticipantCryptorEnabled(t.trackInfo.encryption!==Gp.NONE,e.identity)})})}).on(mv.TrackUnsubscribed,(e,t,n)=>{var i;const o={kind:"removeTransform",data:{participantIdentity:n.identity,trackId:e.mediaStreamID}};null===(i=this.worker)||void 0===i||i.postMessage(o)}).on(mv.TrackSubscribed,(e,t,n)=>{this.setupE2EEReceiver(e,n.identity,t.trackInfo)}).on(mv.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");t.getKeys().forEach(e=>{this.postKey(e)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(gv.LocalSenderCreated,(e,t)=>$f(this,void 0,void 0,function*(){this.setupE2EESender(t,e)})),e.localParticipant.on(gv.LocalTrackPublished,e=>{if(!jb(e.track)||!ub())return;const t={kind:"updateCodec",data:{trackId:e.track.mediaStreamID,codec:Jb(e.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(t)}),t.on(ev.SetKey,e=>this.postKey(e)).on(ev.RatchetRequest,(e,t)=>this.postRatchetRequest(e,t))}encryptData(e){return $f(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const t=crypto.randomUUID(),n={kind:"encryptDataRequest",data:{uuid:t,payload:e,participantIdentity:this.room.localParticipant.identity}},i=new Pb;return i.onFinally=()=>{this.encryptDataRequests.delete(t)},this.encryptDataRequests.set(t,i),this.worker.postMessage(n),i.promise})}handleEncryptedData(e,t,n,i){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const o=crypto.randomUUID(),r={kind:"decryptDataRequest",data:{uuid:o,payload:e,iv:t,participantIdentity:n,keyIndex:i}},s=new Pb;return s.onFinally=()=>{this.decryptDataRequests.delete(o)},this.decryptDataRequests.set(o,s),this.worker.postMessage(r),s.promise}postRatchetRequest(e,t){if(!this.worker)throw Error("could not ratchet key, worker is missing");const n={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:t}};this.worker.postMessage(n)}postKey(e){let{key:t,participantIdentity:n,keyIndex:i}=e;var o;if(!this.worker)throw Error("could not set key, worker is missing");const r={kind:"setKey",data:{participantIdentity:n,isPublisher:n===(null===(o=this.room)||void 0===o?void 0:o.localParticipant.identity),key:t,keyIndex:i}};this.worker.postMessage(r)}postEnable(e,t){if(!this.worker)throw new ReferenceError("failed to enable e2ee, worker is not ready");{const n={kind:"enable",data:{enabled:e,participantIdentity:t}};this.worker.postMessage(n)}}postRTPMap(e){var t;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(null===(t=this.room)||void 0===t?void 0:t.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 t={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(t)}setupE2EEReceiver(e,t,n){if(e.receiver){if(!(null==n?void 0:n.mimeType)||""===n.mimeType)throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,t,"video"===e.kind?Jb(n.mimeType):void 0)}}setupE2EESender(e,t){Nb(e)&&t?this.handleSender(t,e.mediaStreamID,void 0):t||Uf.warn("early return because sender is not ready")}handleReceiver(e,t,n,i){return $f(this,void 0,void 0,function*(){if(this.worker){if(Cv()){const o={kind:"decode",participantIdentity:n,trackId:t,codec:i};e.transform=new RTCRtpScriptTransform(this.worker,o)}else{if(Xg in e&&i){const e={kind:"updateCodec",data:{trackId:t,codec:i,participantIdentity:n}};return void this.worker.postMessage(e)}let o=e.writableStream,r=e.readableStream;if(!o||!r){const t=e.createEncodedStreams();e.writableStream=t.writable,o=t.writable,e.readableStream=t.readable,r=t.readable}const s={kind:"decode",data:{readableStream:r,writableStream:o,trackId:t,codec:i,participantIdentity:n,isReuse:Xg in e}};this.worker.postMessage(s,[r,o])}e[Xg]=!0}})}handleSender(e,t,n){var i;if(!(Xg in e)&&this.worker){if(!(null===(i=this.room)||void 0===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(Cv()){Uf.info("initialize script transform");const i={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:t,codec:n};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{Uf.info("initialize encoded streams");const i=e.createEncodedStreams(),o={kind:"encode",data:{readableStream:i.readable,writableStream:i.writable,codec:n,trackId:t,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(o,[i.readable,i.writable])}e[Xg]=!0}}}const ty="default";class ny{constructor(){this._previousDevices=[]}static getInstance(){return void 0===this.instance&&(this.instance=new ny),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return $f(this,arguments,void 0,function(e){var t=this;let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){var i;if((null===(i=ny.userMediaPromiseMap)||void 0===i?void 0:i.size)>0){Uf.debug("awaiting getUserMedia promise");try{e?yield ny.userMediaPromiseMap.get(e):yield Promise.all(ny.userMediaPromiseMap.values())}catch(Bx){Uf.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(n&&(!db()||!t.hasDeviceInUse(e))&&(0===o.filter(t=>t.kind===e).length||o.some(t=>{const n=""===t.label,i=!e||t.kind===e;return n&&i}))){const t={video:"audioinput"!==e&&"audiooutput"!==e,audio:"videoinput"!==e&&{deviceId:{ideal:"default"}}},n=yield navigator.mediaDevices.getUserMedia(t);o=yield navigator.mediaDevices.enumerateDevices(),n.getTracks().forEach(e=>{e.stop()})}return t._previousDevices=o,e&&(o=o.filter(t=>t.kind===e)),o}()})}normalizeDeviceId(e,t,n){return $f(this,void 0,void 0,function*(){if(t!==ty)return t;const i=yield this.getDevices(e),o=i.find(e=>e.deviceId===ty);if(!o)return void Uf.warn("could not reliably determine default device");const r=i.find(e=>e.deviceId!==ty&&e.groupId===(null!=n?n:o.groupId));if(r)return null==r?void 0:r.deviceId;Uf.warn("could not reliably determine default device")})}hasDeviceInUse(e){return e?ny.userMediaPromiseMap.has(e):ny.userMediaPromiseMap.size>0}}var iy,oy;ny.mediaDeviceKinds=["audioinput","audiooutput","videoinput"],ny.userMediaPromiseMap=new Map,(oy=iy||(iy={}))[oy.WAITING=0]="WAITING",oy[oy.RUNNING=1]="RUNNING",oy[oy.COMPLETED=2]="COMPLETED";class ry{constructor(){this.pendingTasks=new Map,this.taskMutex=new Ju,this.nextTaskIndex=0}run(e){return $f(this,void 0,void 0,function*(){const t={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:iy.WAITING};this.pendingTasks.set(t.id,t);const n=yield this.taskMutex.lock();try{return t.executedAt=Date.now(),t.status=iy.RUNNING,yield e()}finally{t.status=iy.COMPLETED,this.pendingTasks.delete(t.id),n()}})}flush(){return $f(this,void 0,void 0,function*(){return this.run(()=>$f(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}function sy(e,t){return e.pathname="".concat(function(e){return e.endsWith("/")?e:"".concat(e,"/")}(e.pathname)).concat(t),e.toString()}const ay=["syncState","trickle","offer","answer","simulate","leave"];var cy,ly;(ly=cy||(cy={}))[ly.CONNECTING=0]="CONNECTING",ly[ly.CONNECTED=1]="CONNECTED",ly[ly.RECONNECTING=2]="RECONNECTING",ly[ly.DISCONNECTING=3]="DISCONNECTING",ly[ly.DISCONNECTED=4]="DISCONNECTED";class dy{get currentState(){return this.state}get isDisconnected(){return this.state===cy.DISCONNECTING||this.state===cy.DISCONNECTED}get isEstablishingConnection(){return this.state===cy.CONNECTING||this.state===cy.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;this.rtt=0,this.state=cy.DISCONNECTED,this.log=Uf,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=Ff(null!==(n=t.loggerName)&&void 0!==n?n:Af.Signal),this.loggerContextCb=t.loggerContextCb,this.useJSON=e,this.requestQueue=new ry,this.queuedRequests=[],this.closingLock=new Ju,this.connectionLock=new Ju,this.state=cy.DISCONNECTED}get logContext(){var e,t;return null!==(t=null===(e=this.loggerContextCb)||void 0===e?void 0:e.call(this))&&void 0!==t?t:{}}join(e,t,n,i){return $f(this,void 0,void 0,function*(){return this.state=cy.CONNECTING,this.options=n,yield this.connect(e,t,n,i)})}reconnect(e,t,n,i){return $f(this,void 0,void 0,function*(){if(this.options)return this.state=cy.RECONNECTING,this.clearPingInterval(),yield this.connect(e,t,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:i}));this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext)})}connect(e,t,n,i){this.connectOptions=n;const o=function(e,t,n){var i;const o=new URLSearchParams;return o.set("access_token",e),n.reconnect&&(o.set("reconnect","1"),n.sid&&o.set("sid",n.sid)),o.set("auto_subscribe",n.autoSubscribe?"1":"0"),o.set("sdk",mb()?"reactnative":"js"),o.set("version",t.version),o.set("protocol",t.protocol.toString()),t.deviceModel&&o.set("device_model",t.deviceModel),t.os&&o.set("os",t.os),t.osVersion&&o.set("os_version",t.osVersion),t.browser&&o.set("browser",t.browser),t.browserVersion&&o.set("browser_version",t.browserVersion),n.adaptiveStream&&o.set("adaptive_stream","1"),n.reconnectReason&&o.set("reconnect_reason",n.reconnectReason.toString()),(null===(i=navigator.connection)||void 0===i?void 0:i.type)&&o.set("network",navigator.connection.type),o}(t,function(){var e;const t=new gm({sdk:vm.JS,protocol:16,version:"2.15.8"});return mb()&&(t.os=null!==(e=vb())&&void 0!==e?e:""),t}(),n),r=function(e,t){const n=new URL(function(e){return e.startsWith("http")?e.replace(/^(http)/,"ws"):e}(e));return t.forEach((e,t)=>{n.searchParams.set(t,e)}),sy(n,"rtc")}(e,o),s=sy(new URL(Ab(r)),"validate");return new Promise((e,t)=>$f(this,void 0,void 0,function*(){const o=yield this.connectionLock.lock();try{const o=()=>$f(this,void 0,void 0,function*(){this.close(),clearTimeout(a),t(new Tv("room connection has been cancelled (signal)",sv.Cancelled))}),a=setTimeout(()=>{this.close(),t(new Tv("room connection has timed out (signal)",sv.ServerUnreachable))},n.websocketTimeout);(null==i?void 0:i.aborted)&&o(),null==i||i.addEventListener("abort",o);const c=new URL(r);c.searchParams.has("access_token")&&c.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(c),Object.assign({reconnect:n.reconnect,reconnectReason:n.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new WebSocket(r),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{clearTimeout(a)},this.ws.onerror=e=>$f(this,void 0,void 0,function*(){if(this.state===cy.CONNECTED)this.handleWSError(e);else{this.state=cy.DISCONNECTED,clearTimeout(a);try{const n=yield fetch(s);if(n.status.toFixed(0).startsWith("4")){const e=yield n.text();t(new Tv(e,sv.NotAllowed,n.status))}else t(new Tv("Encountered unknown websocket error during connection: ".concat(e.toString()),sv.InternalError,n.status))}catch(Bx){t(new Tv(Bx instanceof Error?Bx.message:"server was not reachable",sv.ServerUnreachable))}}}),this.ws.onmessage=r=>$f(this,void 0,void 0,function*(){var s,a,c;let l;if("string"==typeof r.data){const e=JSON.parse(r.data);l=Om.fromJson(e,{ignoreUnknownFields:!0})}else{if(!(r.data instanceof ArrayBuffer))return void this.log.error("could not decode websocket message: ".concat(typeof r.data),this.logContext);l=Om.fromBinary(new Uint8Array(r.data))}if(this.state!==cy.CONNECTED){let r=!1;if("join"===(null===(s=l.message)||void 0===s?void 0:s.case)?(this.state=cy.CONNECTED,null==i||i.removeEventListener("abort",o),this.pingTimeoutDuration=l.message.value.pingTimeout,this.pingIntervalDuration=l.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()),e(l.message.value)):this.state===cy.RECONNECTING&&"leave"!==l.message.case?(this.state=cy.CONNECTED,null==i||i.removeEventListener("abort",o),this.startPingInterval(),"reconnect"===(null===(a=l.message)||void 0===a?void 0:a.case)?e(l.message.value):(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),e(void 0),r=!0)):this.isEstablishingConnection&&"leave"===l.message.case?t(new Tv("Received leave request while trying to (re)connect",sv.LeaveRequest,void 0,l.message.value.reason)):n.reconnect||t(new Tv("did not receive join response, got ".concat(null===(c=l.message)||void 0===c?void 0:c.case," instead"),sv.InternalError)),!r)return}this.signalLatency&&(yield ob(this.signalLatency)),this.handleSignalResponse(l)}),this.ws.onclose=e=>{this.isEstablishingConnection&&t(new Tv("Websocket got closed during a (re)connection attempt",sv.InternalError)),this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:e.reason,code:e.code,wasClean:e.wasClean,state:this.state})),this.handleOnClose(e.reason)}}finally{o()}}))}close(){return $f(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){const n=yield e.closingLock.lock();try{if(e.clearPingInterval(),t&&(e.state=cy.DISCONNECTING),e.ws){e.ws.onmessage=null,e.ws.onopen=null,e.ws.onclose=null;const t=new Promise(t=>{e.ws?e.ws.onclose=()=>{t()}:t()});e.ws.readyState<e.ws.CLOSING&&(e.ws.close(),yield Promise.race([t,ob(250)])),e.ws=void 0}}finally{t&&(e.state=cy.DISCONNECTED),n()}}()})}sendOffer(e,t){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:hy(e,t)})}sendAnswer(e,t){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:hy(e,t)})}sendIceCandidate(e,t){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new Lm({candidateInit:JSON.stringify(e),target:t})})}sendMuteTrack(e,t){return this.sendRequest({case:"mute",value:new jm({sid:e,muted:t})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,t){return $f(this,arguments,void 0,function(e,t){var n=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function*(){const o=n.getNextRequestId();return yield n.sendRequest({case:"updateMetadata",value:new Ym({requestId:o,metadata:e,name:t,attributes:i})}),o}()})}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,t){return this.sendRequest({case:"updateLayers",value:new Km({trackSid:e,layers:t})})}sendUpdateSubscriptionPermissions(e,t){return this.sendRequest({case:"subscriptionPermission",value:new uf({allParticipants:e,trackPermissions:t})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:fh.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new bf({timestamp:fh.parse(Date.now()),rtt:fh.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,t){return this.sendRequest({case:"updateAudioTrack",value:new Hm({trackSid:e,features:t})})}sendLeave(){return this.sendRequest({case:"leave",value:new Zm({reason:Lp.CLIENT_INITIATED,action:Jm.DISCONNECT})})}sendRequest(e){return $f(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return function*(){const i=!n&&!function(e){const t=ay.indexOf(e.case)>=0;return Uf.trace("request allowed to bypass queue:",{canPass:t,req:e}),t}(e);if(i&&t.state===cy.RECONNECTING)return void t.queuedRequests.push(()=>$f(t,void 0,void 0,function*(){yield this.sendRequest(e,!0)}));if(n||(yield t.requestQueue.flush()),t.signalLatency&&(yield ob(t.signalLatency)),t.isDisconnected)return void t.log.debug("skipping signal request (type: ".concat(e.case,") - SignalClient disconnected"));if(!t.ws||t.ws.readyState!==t.ws.OPEN)return void t.log.error("cannot send signal request before connected, type: ".concat(null==e?void 0:e.case),t.logContext);const o=new Mm({message:e});try{t.useJSON?t.ws.send(o.toJsonString()):t.ws.send(o.toBinary())}catch(Bx){t.log.error("error sending signal message",Object.assign(Object.assign({},t.logContext),{error:Bx}))}}()})}handleSignalResponse(e){var t,n;const i=e.message;if(null==i)return void this.log.debug("received unsupported message",this.logContext);let o=!1;if("answer"===i.case){const e=uy(i.value);this.onAnswer&&this.onAnswer(e,i.value.id)}else if("offer"===i.case){const e=uy(i.value);this.onOffer&&this.onOffer(e,i.value.id)}else if("trickle"===i.case){const e=JSON.parse(i.value.candidateInit);this.onTrickle&&this.onTrickle(e,i.value.target)}else"update"===i.case?this.onParticipantUpdate&&this.onParticipantUpdate(null!==(t=i.value.participants)&&void 0!==t?t:[]):"trackPublished"===i.case?this.onLocalTrackPublished&&this.onLocalTrackPublished(i.value):"speakersChanged"===i.case?this.onSpeakersChanged&&this.onSpeakersChanged(null!==(n=i.value.speakers)&&void 0!==n?n:[]):"leave"===i.case?this.onLeave&&this.onLeave(i.value):"mute"===i.case?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(i.value.sid,i.value.muted):"roomUpdate"===i.case?this.onRoomUpdate&&i.value.room&&this.onRoomUpdate(i.value.room):"connectionQuality"===i.case?this.onConnectionQuality&&this.onConnectionQuality(i.value):"streamStateUpdate"===i.case?this.onStreamStateUpdate&&this.onStreamStateUpdate(i.value):"subscribedQualityUpdate"===i.case?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(i.value):"subscriptionPermissionUpdate"===i.case?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(i.value):"refreshToken"===i.case?this.onTokenRefresh&&this.onTokenRefresh(i.value):"trackUnpublished"===i.case?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(i.value):"subscriptionResponse"===i.case?this.onSubscriptionError&&this.onSubscriptionError(i.value):"pong"===i.case||("pongResp"===i.case?(this.rtt=Date.now()-Number.parseInt(i.value.lastPingTimestamp.toString()),this.resetPingTimeout(),o=!0):"requestResponse"===i.case?this.onRequestResponse&&this.onRequestResponse(i.value):"trackSubscribed"===i.case?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(i.value.trackSid):"roomMoved"===i.case?(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})));o||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return $f(this,void 0,void 0,function*(){if(this.state===cy.DISCONNECTED)return;const t=this.onClose;yield this.close(),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),t&&t(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){this.clearPingTimeout(),this.pingTimeoutDuration?this.pingTimeout=Fv.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-1e3*this.pingTimeoutDuration).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},1e3*this.pingTimeoutDuration):this.log.warn("ping timeout duration not set",this.logContext)}clearPingTimeout(){this.pingTimeout&&Fv.clearTimeout(this.pingTimeout)}startPingInterval(){this.clearPingInterval(),this.resetPingTimeout(),this.pingIntervalDuration?(this.log.debug("start ping interval",this.logContext),this.pingInterval=Fv.setInterval(()=>{this.sendPing()},1e3*this.pingIntervalDuration)):this.log.warn("ping interval duration not set",this.logContext)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Fv.clearInterval(this.pingInterval)}}function uy(e){const t={type:"offer",sdp:e.sdp};switch(e.type){case"answer":case"offer":case"pranswer":case"rollback":t.type=e.type}return t}function hy(e,t){return new Vm({sdp:e.sdp,type:e.type,id:t})}class py{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const t=this.buffer[0];if(this._totalSize-t.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class my{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,t){const n=Date.now();n-this._lastCleanup>this.ttl/2&&this.cleanup();const i=n+this.ttl;return this._map.set(e,{value:t,expiresAt:i}),this}get(e){const t=this._map.get(e);if(t){if(!(t.expiresAt<Date.now()))return t.value;this._map.delete(e)}}has(e){const t=this._map.get(e);return!(!t||t.expiresAt<Date.now()&&(this._map.delete(e),1))}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[t,n]of this._map.entries())n.expiresAt<e&&this._map.delete(t);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[t,n]of this._map.entries())n.expiresAt>=Date.now()&&e(n.value,t,this.asValueMap())}map(e){this.cleanup();const t=[],n=this.asValueMap();for(const[i,o]of n.entries())t.push(e(o,i,n));return t}asValueMap(){const e=new Map;for(const[t,n]of this._map.entries())n.expiresAt>=Date.now()&&e.set(t,n.value);return e}}var fy,gy,vy,by,yy,ky={},wy={},Cy={exports:{}};function Sy(){if(fy)return Cy.exports;fy=1;var e=Cy.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 null!=e.address?"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 null!=e.subtype?"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 null!=e.sessionConfig?"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 t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),(t+=null!=e["network-id"]?" network-id %d":"%v")+(null!=e["network-cost"]?" network-cost %d":"%v")}},{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 t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{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 null!=e.maxMessageSize?"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"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",(t+=null!=e.rateNumerator?" rate=%s":"")+(null!=e.rateDenominator?"/%s":"")}},{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(e).forEach(function(t){e[t].forEach(function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")})}),Cy.exports}function Ty(){if(by)return vy;by=1;var e=Sy(),t=/%[sdv%]/g,n=function(e){var n=1,i=arguments,o=i.length;return e.replace(t,function(e){if(n>=o)return e;var t=i[n];switch(n+=1,e){case"%%":return"%";case"%s":return String(t);case"%d":return Number(t);case"%v":return""}})},i=function(e,t,i){var o=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var r=0;r<t.names.length;r+=1){var s=t.names[r];t.name?o.push(i[t.name][s]):o.push(i[t.names[r]])}else o.push(i[t.name]);return n.apply(null,o)},o=["v","o","s","i","u","e","p","c","b","t","r","z","a"],r=["i","c","b","a"];return vy=function(t,n){n=n||{},null==t.version&&(t.version=0),null==t.name&&(t.name=" "),t.media.forEach(function(e){null==e.payloads&&(e.payloads="")});var s=n.outerOrder||o,a=n.innerOrder||r,c=[];return s.forEach(function(n){e[n].forEach(function(e){e.name in t&&null!=t[e.name]?c.push(i(n,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){c.push(i(n,e,t))})})}),t.media.forEach(function(t){c.push(i("m",e.m[0],t)),a.forEach(function(n){e[n].forEach(function(e){e.name in t&&null!=t[e.name]?c.push(i(n,e,t)):e.push in t&&null!=t[e.push]&&t[e.push].forEach(function(t){c.push(i(n,e,t))})})})}),c.join("\r\n")+"\r\n"}}var xy=function(){if(yy)return ky;yy=1;var e=(gy||(gy=1,function(e){var t=function(e){return String(Number(e))===e?Number(e):e},n=function(e,n,i){var o=e.name&&e.names;e.push&&!n[e.push]?n[e.push]=[]:o&&!n[e.name]&&(n[e.name]={});var r=e.push?{}:o?n[e.name]:n;!function(e,n,i,o){if(o&&!i)n[o]=t(e[1]);else for(var r=0;r<i.length;r+=1)null!=e[r+1]&&(n[i[r]]=t(e[r+1]))}(i.match(e.reg),r,e.names,e.name),e.push&&n[e.push].push(r)},i=Sy(),o=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},r=[],s=t;return e.split(/(\r\n|\r|\n)/).filter(o).forEach(function(e){var t=e[0],o=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),s=r[r.length-1]);for(var a=0;a<(i[t]||[]).length;a+=1){var c=i[t][a];if(c.reg.test(o))return n(c,s,o)}}),t.media=r,t};var r=function(e,n){var i=n.split(/=(.+)/,2);return 2===i.length?e[i[0]]=t(i[1]):1===i.length&&n.length>1&&(e[i[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(r,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var n=[],i=e.split(" ").map(t),o=0;o<i.length;o+=3)n.push({component:i[o],ip:i[o+1],port:i[o+2]});return n},e.parseImageAttributes=function(e){return e.split(" ").map(function(e){return e.substring(1,e.length-1).split(",").reduce(r,{})})},e.parseSimulcastStreamList=function(e){return e.split(";").map(function(e){return e.split(",").map(function(e){var n,i=!1;return"~"!==e[0]?n=t(e):(n=t(e.substring(1,e.length)),i=!0),{scid:n,paused:i}})})}}(wy)),wy),t=Ty(),n=Sy();return ky.grammar=n,ky.write=t,ky.parse=e.parse,ky.parseParams=e.parseParams,ky.parseFmtpConfig=e.parseFmtpConfig,ky.parsePayloads=e.parsePayloads,ky.parseRemoteCandidates=e.parseRemoteCandidates,ky.parseImageAttributes=e.parseImageAttributes,ky.parseSimulcastStreamList=e.parseSimulcastStreamList,ky}();function Ey(e,t,n){var i,o,r;void 0===t&&(t=50),void 0===n&&(n={});var s=null!=(i=n.isImmediate)&&i,a=null!=(o=n.callback)&&o,c=n.maxWait,l=Date.now(),d=[],u=function(){var n=[].slice.call(arguments),i=this;return new Promise(function(o,u){var h=s&&void 0===r;if(void 0!==r&&clearTimeout(r),r=setTimeout(function(){if(r=void 0,l=Date.now(),!s){var t=e.apply(i,n);a&&a(t),d.forEach(function(e){return(0,e.resolve)(t)}),d=[]}},function(){if(void 0!==c){var e=Date.now()-l;if(e+t>=c)return c-e}return t}()),h){var p=e.apply(i,n);return a&&a(p),o(p)}d.push({resolve:o,reject:u})})};return u.cancel=function(e){void 0!==r&&clearTimeout(r),d.forEach(function(t){return(0,t.reject)(e)}),d=[]},u}const _y="negotiationStarted",Iy="negotiationComplete",Py="rtpVideoPayloadTypes";class Ry extends Gf.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var n;super(),this.log=Uf,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=Ey(e=>$f(this,void 0,void 0,function*(){this.emit(_y);try{yield this.createAndSendOffer()}catch(Bx){if(!e)throw Bx;e(Bx)}}),20),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=Ff(null!==(n=t.loggerName)&&void 0!==n?n:Af.PCTransport),this.loggerOptions=t,this.config=e,this._pc=this.createPC(),this.offerLock=new Ju}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=e=>{var t;e.candidate&&(null===(t=this.onIceCandidate)||void 0===t||t.call(this,e.candidate))},e.onicecandidateerror=e=>{var t;null===(t=this.onIceCandidateError)||void 0===t||t.call(this,e)},e.oniceconnectionstatechange=()=>{var t;null===(t=this.onIceConnectionStateChange)||void 0===t||t.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var t;null===(t=this.onSignalingStatechange)||void 0===t||t.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var t;null===(t=this.onConnectionStateChange)||void 0===t||t.call(this,e.connectionState)},e.ondatachannel=e=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,e)},e.ontrack=e=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,e)},e}get logContext(){var e,t;return Object.assign({},null===(t=(e=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(e))}get isICEConnected(){return null!==this._pc&&("connected"===this.pc.iceConnectionState||"completed"===this.pc.iceConnectionState)}addIceCandidate(e){return $f(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,t){return $f(this,void 0,void 0,function*(){var n;if("answer"===e.type&&this.latestOfferId>0&&t>0&&t!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:t,latestOfferId:this.latestOfferId})),!1;let i;if("offer"===e.type){let{stereoMids:t,nackMids:n}=function(e){var t;const n=[],i=[],o=xy.parse(null!==(t=e.sdp)&&void 0!==t?t:"");let r=0;return o.media.forEach(e=>{var t;const o=Oy(e.mid);"audio"===e.type&&(e.rtp.some(e=>"opus"===e.codec&&(r=e.payload,!0)),(null===(t=e.rtcpFb)||void 0===t?void 0:t.some(e=>e.payload===r&&"nack"===e.type))&&i.push(o),e.fmtp.some(e=>e.payload===r&&(e.config.includes("sprop-stereo=1")&&n.push(o),!0)))}),{stereoMids:n,nackMids:i}}(e);this.remoteStereoMids=t,this.remoteNackMids=n}else if("answer"===e.type){const t=xy.parse(null!==(n=e.sdp)&&void 0!==n?n:"");t.media.forEach(e=>{const t=Oy(e.mid);"audio"===e.type&&this.trackBitrates.some(n=>{if(!n.transceiver||t!=n.transceiver.mid)return!1;let i=0;if(e.rtp.some(e=>e.codec.toUpperCase()===n.codec.toUpperCase()&&(i=e.payload,!0)),0===i)return!0;let o=!1;for(const t of e.fmtp)if(t.payload===i){t.config=t.config.split(";").filter(e=>!e.includes("maxaveragebitrate")).join(";"),n.maxbr>0&&(t.config+=";maxaveragebitrate=".concat(1e3*n.maxbr)),o=!0;break}return o||n.maxbr>0&&e.fmtp.push({payload:i,config:"maxaveragebitrate=".concat(1e3*n.maxbr)}),!0})}),i=xy.write(t)}return yield this.setMungedSDP(e,i,!0),this.pendingCandidates.forEach(e=>{this.pc.addIceCandidate(e)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):"answer"===e.type&&(this.emit(Iy),e.sdp)&&xy.parse(e.sdp).media.forEach(e=>{"video"===e.type&&this.emit(Py,e.rtp)}),!0})}createAndSendOffer(e){return $f(this,void 0,void 0,function*(){var t;const n=yield this.offerLock.lock();try{if(void 0===this.onOffer)return;if((null==e?void 0:e.iceRestart)&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&"have-local-offer"===this._pc.signalingState){const t=this._pc.remoteDescription;if(!(null==e?void 0:e.iceRestart)||!t)return void(this.renegotiate=!0);yield this._pc.setRemoteDescription(t)}else if(!this._pc||"closed"===this._pc.signalingState)return void this.log.warn("could not createOffer with closed peer connection",this.logContext);this.log.debug("starting to negotiate",this.logContext);const n=this.latestOfferId+1;this.latestOfferId=n;const i=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:i.sdp},this.logContext));const o=xy.parse(null!==(t=i.sdp)&&void 0!==t?t:"");if(o.media.forEach(e=>{My(e),"audio"===e.type?Ay(e,[],[]):"video"===e.type&&this.trackBitrates.some(t=>{if(!e.msid||!t.cid||!e.msid.includes(t.cid))return!1;let n=0;if(e.rtp.some(e=>e.codec.toUpperCase()===t.codec.toUpperCase()&&(n=e.payload,!0)),0===n)return!0;if(ab(t.codec)&&!db()&&this.ensureVideoDDExtensionForSVC(e,o),"av1"!==t.codec)return!0;const i=Math.round(.7*t.maxbr);for(const o of e.fmtp)if(o.payload===n){o.config.includes("x-google-start-bitrate")||(o.config+=";x-google-start-bitrate=".concat(i));break}return!0})}),this.latestOfferId>n)return void this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:n}));yield this.setMungedSDP(i,xy.write(o)),this.onOffer(i,this.latestOfferId)}finally{n()}})}createAndSetAnswer(){return $f(this,void 0,void 0,function*(){var e;const t=yield this.pc.createAnswer(),n=xy.parse(null!==(e=t.sdp)&&void 0!==e?e:"");return n.media.forEach(e=>{My(e),"audio"===e.type&&Ay(e,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(t,xy.write(n)),t})}createDataChannel(e,t){return this.pc.createDataChannel(e,t)}addTransceiver(e,t){return this.pc.addTransceiver(e,t)}addTrack(e){if(!this._pc)throw new Iv("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var t;if(!this._pc)throw new Iv("PC closed, cannot configure");return null===(t=this._pc)||void 0===t?void 0:t.setConfiguration(e)}canRemoveTrack(){var e;return!!(null===(e=this._pc)||void 0===e?void 0:e.removeTrack)}removeTrack(e){var t;return null===(t=this._pc)||void 0===t?void 0:t.removeTrack(e)}getConnectionState(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.connectionState)&&void 0!==t?t:"closed"}getICEConnectionState(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.iceConnectionState)&&void 0!==t?t:"closed"}getSignallingState(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.signalingState)&&void 0!==t?t:"closed"}getTransceivers(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.getTransceivers())&&void 0!==t?t:[]}getSenders(){var e,t;return null!==(t=null===(e=this._pc)||void 0===e?void 0:e.getSenders())&&void 0!==t?t:[]}getLocalDescription(){var e;return null===(e=this._pc)||void 0===e?void 0:e.localDescription}getRemoteDescription(){var e;return null===(e=this.pc)||void 0===e?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return $f(this,void 0,void 0,function*(){var e;if(!this._pc)return;let t="";const n=new Map,i=new Map;if((yield this._pc.getStats()).forEach(e=>{switch(e.type){case"transport":t=e.selectedCandidatePairId;break;case"candidate-pair":""===t&&e.selected&&(t=e.id),n.set(e.id,e);break;case"remote-candidate":i.set(e.id,"".concat(e.address,":").concat(e.port))}}),""===t)return;const o=null===(e=n.get(t))||void 0===e?void 0:e.remoteCandidateId;return void 0!==o?i.get(o):void 0})}setMungedSDP(e,t,n){return $f(this,void 0,void 0,function*(){if(t){const i=e.sdp;e.sdp=t;try{return this.log.debug("setting munged ".concat(n?"remote":"local"," description"),this.logContext),void(n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e))}catch(Bx){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:Bx,sdp:t})),e.sdp=i}}try{n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(Bx){let i="unknown error";Bx instanceof Error?i=Bx.message:"string"==typeof Bx&&(i=Bx);const o={error:i,sdp:e.sdp};throw!n&&this.pc.remoteDescription&&(o.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:o})),new Pv(i)}})}ensureVideoDDExtensionForSVC(e,t){var n,i;if(!(null===(n=e.ext)||void 0===n?void 0:n.some(e=>e.uri===ib))){if(0===this.ddExtID){let e=0;t.media.forEach(t=>{var n;"video"===t.type&&(null===(n=t.ext)||void 0===n||n.forEach(t=>{t.value>e&&(e=t.value)}))}),this.ddExtID=e+1}null===(i=e.ext)||void 0===i||i.push({value:this.ddExtID,uri:ib})}}}function Ay(e,t,n){const i=Oy(e.mid);let o=0;e.rtp.some(e=>"opus"===e.codec&&(o=e.payload,!0)),o>0&&(e.rtcpFb||(e.rtcpFb=[]),n.includes(i)&&!e.rtcpFb.some(e=>e.payload===o&&"nack"===e.type)&&e.rtcpFb.push({payload:o,type:"nack"}),t.includes(i)&&e.fmtp.some(e=>e.payload===o&&(e.config.includes("stereo=1")||(e.config+=";stereo=1"),!0)))}function My(e){if(e.connection){const t=e.connection.ip.indexOf(":")>=0;(4===e.connection.version&&t||6===e.connection.version&&!t)&&(e.connection.ip="0.0.0.0",e.connection.version=4)}}function Oy(e){return"number"==typeof e?e.toFixed(0):e}const Dy="vp8",Ny={audioPreset:Qv.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:nb.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:Dy,backupCodec:!0,preConnectBuffer:!1},Ly={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},jy={deviceId:{ideal:"default"},resolution:eb.h720.resolution},Uy={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new class{constructor(e){this._retryDelays=void 0!==e?[...e]:Vf}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const t=this._retryDelays[e.retryCount];return e.retryCount<=1?t:t+1e3*Math.random()}},disconnectOnPageLeave:!0,webAudioMix:!1},Fy={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var By,zy;(zy=By||(By={}))[zy.NEW=0]="NEW",zy[zy.CONNECTING=1]="CONNECTING",zy[zy.CONNECTED=2]="CONNECTED",zy[zy.FAILED=3]="FAILED",zy[zy.CLOSING=4]="CLOSING",zy[zy.CLOSED=5]="CLOSED";class Vy{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}constructor(e,t,n){var i;this.peerConnectionTimeout=Fy.peerConnectionTimeout,this.log=Uf,this.updateState=()=>{var e;const t=this.state,n=this.requiredTransports.map(e=>e.getConnectionState());n.every(e=>"connected"===e)?this.state=By.CONNECTED:n.some(e=>"failed"===e)?this.state=By.FAILED:n.some(e=>"connecting"===e)?this.state=By.CONNECTING:n.every(e=>"closed"===e)?this.state=By.CLOSED:n.some(e=>"closed"===e)?this.state=By.CLOSING:n.every(e=>"new"===e)&&(this.state=By.NEW),t!==this.state&&(this.log.debug("pc state change: from ".concat(By[t]," to ").concat(By[this.state]),this.logContext),null===(e=this.onStateChange)||void 0===e||e.call(this,this.state,this.publisher.getConnectionState(),this.subscriber.getConnectionState()))},this.log=Ff(null!==(i=n.loggerName)&&void 0!==i?i:Af.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=!t,this.isSubscriberConnectionRequired=t,this.publisher=new Ry(e,n),this.subscriber=new Ry(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=e=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,e,Pm.PUBLISHER)},this.subscriber.onIceCandidate=e=>{var t;null===(t=this.onIceCandidate)||void 0===t||t.call(this,e,Pm.SUBSCRIBER)},this.subscriber.onDataChannel=e=>{var t;null===(t=this.onDataChannel)||void 0===t||t.call(this,e)},this.subscriber.onTrack=e=>{var t;null===(t=this.onTrack)||void 0===t||t.call(this,e)},this.publisher.onOffer=(e,t)=>{var n;null===(n=this.onPublisherOffer)||void 0===n||n.call(this,e,t)},this.state=By.NEW,this.connectionLock=new Ju,this.remoteOfferLock=new Ju}get logContext(){var e,t;return Object.assign({},null===(t=(e=this.loggerOptions).loggerContextCb)||void 0===t?void 0:t.call(e))}requirePublisher(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isPublisherConnectionRequired=e,this.updateState()}requireSubscriber(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.isSubscriberConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,t){return this.publisher.setRemoteDescription(e,t)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return $f(this,void 0,void 0,function*(){if(this.publisher&&"closed"!==this.publisher.getSignallingState()){const e=this.publisher;for(const t of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(t)}catch(Bx){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:Bx}))}}yield Promise.all([this.publisher.close(),this.subscriber.close()]),this.updateState()})}triggerIceRestart(){return $f(this,void 0,void 0,function*(){this.subscriber.restartingIce=!0,this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,t){return $f(this,void 0,void 0,function*(){t===Pm.PUBLISHER?yield this.publisher.addIceCandidate(e):yield this.subscriber.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,t){return $f(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 n=yield this.remoteOfferLock.lock();try{if(!(yield this.subscriber.setRemoteDescription(e,t)))return;return yield this.subscriber.createAndSetAnswer()}finally{n()}})}updateConfiguration(e,t){this.publisher.setConfiguration(e),this.subscriber.setConfiguration(e),t&&this.triggerIceRestart()}ensurePCTransportConnection(e,t){return $f(this,void 0,void 0,function*(){var n;const i=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&"connected"!==this.publisher.getConnectionState()&&"connecting"!==this.publisher.getConnectionState()&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all(null===(n=this.requiredTransports)||void 0===n?void 0:n.map(n=>this.ensureTransportConnected(n,e,t)))}finally{i()}})}negotiate(e){return $f(this,void 0,void 0,function*(){return new Promise((t,n)=>$f(this,void 0,void 0,function*(){const i=setTimeout(()=>{n("negotiation timed out")},this.peerConnectionTimeout);e.signal.addEventListener("abort",()=>{clearTimeout(i),n("negotiation aborted")}),this.publisher.once(_y,()=>{e.signal.aborted||this.publisher.once(Iy,()=>{clearTimeout(i),t()})}),yield this.publisher.negotiate(e=>{clearTimeout(i),n(e)})}))})}addPublisherTransceiver(e,t){return this.publisher.addTransceiver(e,t)}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,t){return this.publisher.createDataChannel(e,t)}getConnectedAddress(e){return e===Pm.PUBLISHER||e===Pm.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,t){return $f(this,arguments,void 0,function(e,t){var n=this;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.peerConnectionTimeout;return function*(){if("connected"!==e.getConnectionState())return new Promise((e,o)=>$f(n,void 0,void 0,function*(){const n=()=>{this.log.warn("abort transport connection",this.logContext),Fv.clearTimeout(r),o(new Tv("room connection has been cancelled",sv.Cancelled))};(null==t?void 0:t.signal.aborted)&&n(),null==t||t.signal.addEventListener("abort",n);const r=Fv.setTimeout(()=>{null==t||t.signal.removeEventListener("abort",n),o(new Tv("could not establish pc connection",sv.InternalError))},i);for(;this.state!==By.CONNECTED;)if(yield ob(50),null==t?void 0:t.signal.aborted)return void o(new Tv("room connection has been cancelled",sv.Cancelled));Fv.clearTimeout(r),null==t||t.signal.removeEventListener("abort",n),e()}))}()})}}class $y extends Error{constructor(e,t,n){super(t),this.code=e,this.message=Wy(t,$y.MAX_MESSAGE_BYTES),this.data=n?Wy(n,$y.MAX_DATA_BYTES):void 0}static fromProto(e){return new $y(e.code,e.message,e.data)}toProto(){return new hm({code:this.code,message:this.message,data:this.data})}static builtIn(e,t){return new $y($y.ErrorCode[e],$y.ErrorMessage[e],t)}}function qy(e){return(new TextEncoder).encode(e).length}function Wy(e,t){if(qy(e)<=t)return e;let n=0,i=e.length;const o=new TextEncoder;for(;n<i;){const r=Math.floor((n+i+1)/2);o.encode(e.slice(0,r)).length<=t?n=r:i=r-1}return e.slice(0,n)}$y.MAX_MESSAGE_BYTES=256,$y.MAX_DATA_BYTES=15360,$y.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},$y.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 Hy=2e3;function Gy(e,t){if(!t)return 0;let n,i;return"bytesReceived"in e?(n=e.bytesReceived,i=t.bytesReceived):"bytesSent"in e&&(n=e.bytesSent,i=t.bytesSent),void 0===n||void 0===i||void 0===e.timestamp||void 0===t.timestamp?0:8*(n-i)*1e3/(e.timestamp-t.timestamp)}const Zy="undefined"!=typeof MediaRecorder,Jy=Zy?MediaRecorder:class{constructor(){throw new Error("MediaRecorder is not available in this environment")}};class Ky extends Jy{constructor(e,t){if(!Zy)throw new Error("MediaRecorder is not available in this environment");let n,i;super(new MediaStream([e.mediaStreamTrack]),t);const o=()=>{this.removeEventListener("dataavailable",n),this.removeEventListener("stop",o),this.removeEventListener("error",r),null==i||i.close(),i=void 0},r=e=>{null==i||i.error(e),this.removeEventListener("dataavailable",n),this.removeEventListener("stop",o),this.removeEventListener("error",r),i=void 0};this.byteStream=new ReadableStream({start:e=>{i=e,n=t=>$f(this,void 0,void 0,function*(){let n;if(t.data.arrayBuffer){const e=yield t.data.arrayBuffer();n=new Uint8Array(e)}else{if(!t.data.byteArray)throw new Error("no data available!");n=t.data.byteArray}void 0!==i&&e.enqueue(n)}),this.addEventListener("dataavailable",n)},cancel:()=>{o()}}),this.addEventListener("stop",o),this.addEventListener("error",r)}}class Yy extends $v{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(e,t,arguments.length>4?arguments[4]:void 0),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=Ey(()=>$f(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>$f(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(kv.Ended,this)},this.reacquireTrack=!1,this.providedByUser=i,this.muteLock=new Ju,this.pauseUpstreamLock=new Ju,this.trackChangeLock=new Ju,this.trackChangeLock.lock().then(t=>$f(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(e,!0)}finally{t()}})),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==$v.Kind.Video)return;const{width:e,height:t}=this._mediaStreamTrack.getSettings();return e&&t?{width:e,height:t}:void 0}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,t;return null!==(t=null===(e=this.processor)||void 0===e?void 0:e.processedTrack)&&void 0!==t?t:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,t){return $f(this,void 0,void 0,function*(){var n;if(e===this._mediaStreamTrack&&!t)return;let i;if(this._mediaStreamTrack&&(this.attachedElements.forEach(e=>{Wv(this._mediaStreamTrack,e)}),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()),this.processor&&e){if(this.log.debug("restarting processor",this.logContext),"unknown"===this.kind)throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(qv(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),i=this.processor.processedTrack}this.sender&&"closed"!==(null===(n=this.sender.transport)||void 0===n?void 0:n.state)&&(yield this.sender.replaceTrack(null!=i?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(t=>{qv(null!=i?i:e,t)}))})}waitForDimensions(){return $f(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return function*(){var n;if(e.kind===$v.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");"iOS"===(null===(n=Nv())||void 0===n?void 0:n.os)&&(yield ob(10));const i=Date.now();for(;Date.now()-i<t;){const t=e.dimensions;if(t)return t;yield ob(50)}throw new Ev("unable to get track dimensions after timeout")}()})}setDeviceId(e){return $f(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Rb(e)||(this._constraints.deviceId=e,!!this.isMuted||(yield this.restartTrack(),Rb(e)===this._mediaStreamTrack.getSettings().deviceId))})}getDeviceId(){return $f(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){if(e.source===$v.Source.ScreenShare)return;const{deviceId:n,groupId:i}=e._mediaStreamTrack.getSettings(),o=e.kind===$v.Kind.Audio?"audioinput":"videoinput";return t?ny.getInstance().normalizeDeviceId(o,n,i):n}()})}mute(){return $f(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return $f(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,t){return $f(this,void 0,void 0,function*(){const n=yield this.trackChangeLock.lock();try{if(!this.sender)throw new Ev("unable to replace an unpublished track");let n,i;return"boolean"==typeof t?n=t:void 0!==t&&(n=t.userProvidedTrack,i=t.stopProcessor),this.providedByUser=null==n||n,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.internalStopProcessor()),this}finally{n()}})}restart(e){return $f(this,void 0,void 0,function*(){this.manuallyStopped=!1;const t=yield this.trackChangeLock.lock();try{e||(e=this._constraints);const{deviceId:t,facingMode:n}=e,i=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o<i.length;o++)t.indexOf(i[o])<0&&Object.prototype.propertyIsEnumerable.call(e,i[o])&&(n[i[o]]=e[i[o]])}return n}(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const o={audio:!1,video:!1};this.kind===$v.Kind.Video?o.video=!t&&!n||{deviceId:t,facingMode:n}:o.audio=!t||Object.assign({deviceId:t},i),this.attachedElements.forEach(e=>{Wv(this.mediaStreamTrack,e)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const r=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return this.kind===$v.Kind.Video&&(yield r.applyConstraints(i)),r.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(r),this._constraints=e,this.emit(kv.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{t()}})}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?kv.Muted:kv.Unmuted,this))}get needsReAcquisition(){return"live"!==this._mediaStreamTrack.readyState||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return $f(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),hb()&&(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),null===(e=this.processor)||void 0===e||e.destroy(),this.processor=void 0}pauseUpstream(){return $f(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(!0===this._isUpstreamPaused)return;if(!this.sender)return void this.log.warn("unable to pause upstream for an unpublished track",this.logContext);this._isUpstreamPaused=!0,this.emit(kv.UpstreamPaused,this);const t=Nv();if("Safari"===(null==t?void 0:t.name)&&yb(t.version,"12.0")<0)throw new xv("pauseUpstream is not supported on Safari < 12.");"closed"!==(null===(e=this.sender.transport)||void 0===e?void 0:e.state)&&(yield this.sender.replaceTrack(null))}finally{t()}})}resumeUpstream(){return $f(this,void 0,void 0,function*(){var e;const t=yield this.pauseUpstreamLock.lock();try{if(!1===this._isUpstreamPaused)return;if(!this.sender)return void this.log.warn("unable to resume upstream for an unpublished track",this.logContext);this._isUpstreamPaused=!1,this.emit(kv.UpstreamResumed,this),"closed"!==(null===(e=this.sender.transport)||void 0===e?void 0:e.state)&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{t()}})}getRTCStatsReport(){return $f(this,void 0,void 0,function*(){var e;if(null===(e=this.sender)||void 0===e?void 0:e.getStats)return yield this.sender.getStats()})}setProcessor(e){return $f(this,arguments,void 0,function(e){var t=this;let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){var i;const o=yield t.trackChangeLock.lock();try{t.log.debug("setting up processor",t.logContext);const o=document.createElement(t.kind),r={kind:t.kind,track:t._mediaStreamTrack,element:o,audioContext:t.audioContext};if(yield e.init(r),t.log.debug("processor initialized",t.logContext),t.processor&&(yield t.internalStopProcessor()),"unknown"===t.kind)throw TypeError("cannot set processor on track of unknown kind");if(qv(t._mediaStreamTrack,o),o.muted=!0,o.play().catch(e=>{e instanceof DOMException&&"AbortError"===e.name?(t.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},t.logContext),{error:e})),setTimeout(()=>{o.play().catch(e=>{t.log.error("failed to play processor element",Object.assign(Object.assign({},t.logContext),{err:e}))})},100)):t.log.error("failed to play processor element",Object.assign(Object.assign({},t.logContext),{error:e}))}),t.processor=e,t.processorElement=o,t.processor.processedTrack){for(const e of t.attachedElements)e!==t.processorElement&&n&&(Wv(t._mediaStreamTrack,e),qv(t.processor.processedTrack,e));yield null===(i=t.sender)||void 0===i?void 0:i.replaceTrack(t.processor.processedTrack)}t.emit(kv.TrackProcessorUpdate,t.processor)}finally{o()}}()})}getProcessor(){return this.processor}stopProcessor(){return $f(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){const n=yield e.trackChangeLock.lock();try{yield e.internalStopProcessor(t)}finally{n()}}()})}internalStopProcessor(){return $f(this,arguments,void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){var n,i;e.processor&&(e.log.debug("stopping processor",e.logContext),null===(n=e.processor.processedTrack)||void 0===n||n.stop(),yield e.processor.destroy(),e.processor=void 0,t||(null===(i=e.processorElement)||void 0===i||i.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(kv.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;if(Zy)if(this.localTrackRecorder)this.log.warn("preconnect buffer already started");else{{let e="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(e)||(e="video/mp4"),this.localTrackRecorder=new Ky(this,{mimeType:e})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},1e4)}else this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return null===(e=this.localTrackRecorder)||void 0===e?void 0:e.byteStream}getPreConnectBufferMimeType(){var e;return null===(e=this.localTrackRecorder)||void 0===e?void 0:e.mimeType}}class Qy extends Yy{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;super(e,$v.Kind.Audio,t,n,o),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>$f(this,void 0,void 0,function*(){if(!this.sender)return void(this._currentBitrate=0);let e;try{e=yield this.getSenderStats()}catch(Bx){return void this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:Bx}))}e&&this.prevStats&&(this._currentBitrate=Gy(e,this.prevStats)),this.prevStats=e}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(kv.AudioTrackFeatureUpdate,this,Fp.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(kv.AudioTrackFeatureUpdate,this,Fp.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=i,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return $f(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===$v.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return $f(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const t=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Rb(this._constraints.deviceId);return this.source!==$v.Source.Microphone||!this.stopOnMute&&"ended"!==this._mediaStreamTrack.readyState&&!t||this.isUserProvided||(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{t()}})}restartTrack(e){return $f(this,void 0,void 0,function*(){let t;if(e){const n=Wb({audio:e});"boolean"!=typeof n.audio&&(t=n.audio)}yield this.restart(t)})}restart(e){const t=Object.create(null,{restart:{get:()=>super.restart}});return $f(this,void 0,void 0,function*(){const n=yield t.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){pb()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Hy)))}setProcessor(e){return $f(this,void 0,void 0,function*(){var t;const n=yield this.trackChangeLock.lock();try{if(!mb()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const n={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(n),this.processor=e,this.processor.processedTrack&&(yield null===(t=this.sender)||void 0===t?void 0:t.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(kv.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return $f(this,void 0,void 0,function*(){var e;if(!(null===(e=this.sender)||void 0===e?void 0:e.getStats))return;let t;return(yield this.sender.getStats()).forEach(e=>{"outbound-rtp"===e.type&&(t={type:"audio",streamId:e.id,packetsSent:e.packetsSent,packetsLost:e.packetsLost,bytesSent:e.bytesSent,timestamp:e.timestamp,roundTripTime:e.roundTripTime,jitter:e.jitter})}),t})}checkForSilence(){return $f(this,void 0,void 0,function*(){const e=yield function(e){return $f(this,arguments,void 0,function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:200;return function*(){const n=Hb();if(n){const i=n.createAnalyser();i.fftSize=2048;const o=i.frequencyBinCount,r=new Uint8Array(o);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(i),yield ob(t),i.getByteTimeDomainData(r);const s=r.some(e=>128!==e&&0!==e);return n.close(),!s}return!1}()})}(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(kv.AudioSilenceDetected)),e})}}const Xy=Object.values(eb),ek=Object.values(tb),tk=Object.values(nb),nk=[eb.h180,eb.h360],ik=[tb.h180,tb.h360],ok=["q","h","f"];function rk(e,t,n,i){var o,r;let s=null==i?void 0:i.videoEncoding;e&&(s=null==i?void 0:i.screenShareEncoding);const a=null==i?void 0:i.simulcast,c=null==i?void 0:i.scalabilityMode,l=null==i?void 0:i.videoCodec;if(!s&&!a&&!c||!t||!n)return[{}];s||(s=function(e,t,n,i){const o=function(e,t,n){if(e)return tk;const i=t>n?t/n:n/t;return Math.abs(i-16/9)<Math.abs(i-4/3)?Xy:ek}(e,t,n);let{encoding:r}=o[0];const s=Math.max(t,n);for(let a=0;a<o.length;a+=1){const e=o[a];if(r=e.encoding,e.width>=s)break}if(i)switch(i){case"av1":case"h265":r=Object.assign({},r),r.maxBitrate=.7*r.maxBitrate;break;case"vp9":r=Object.assign({},r),r.maxBitrate=.85*r.maxBitrate}return r}(e,t,n,l),Uf.debug("using video encoding",s));const d=s.maxFramerate,u=new Hv(t,n,s.maxBitrate,s.maxFramerate,s.priority);if(c&&ab(l)){const e=new lk(c),t=[];if(e.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(c));const n=Nv();if(ub()||mb()||"Chrome"===(null==n?void 0:n.name)&&yb(null==n?void 0:n.version,"113")<0){const i="h"==e.suffix?2:3,o=function(e){return e||(e=Nv()),"Safari"===(null==e?void 0:e.name)&&yb(e.version,"18.3")>0||"iOS"===(null==e?void 0:e.os)&&!!(null==e?void 0:e.osVersion)&&yb(e.osVersion,"18.3")>0}(n);for(let n=0;n<e.spatial;n+=1)t.push({rid:ok[2-n],maxBitrate:s.maxBitrate/Math.pow(i,n),maxFramerate:u.encoding.maxFramerate,scaleResolutionDownBy:o?Math.pow(2,n):void 0});t[0].scalabilityMode=c}else t.push({maxBitrate:s.maxBitrate,maxFramerate:u.encoding.maxFramerate,scalabilityMode:c});return u.encoding.priority&&(t[0].priority=u.encoding.priority,t[0].networkPriority=u.encoding.priority),Uf.debug("using svc encoding",{encodings:t}),t}if(!a)return[s];let h,p=[];if(p=e?null!==(o=ck(null==i?void 0:i.screenShareSimulcastLayers))&&void 0!==o?o:sk(e,u):null!==(r=ck(null==i?void 0:i.videoSimulcastLayers))&&void 0!==r?r:sk(e,u),p.length>0){const e=p[0];p.length>1&&([,h]=p);const i=Math.max(t,n);if(i>=960&&h)return ak(t,n,[e,h,u],d);if(i>=480)return ak(t,n,[e,u],d)}return ak(t,n,[u])}function sk(e,t){if(e)return[{scaleResolutionDownBy:2,fps:(n=t).encoding.maxFramerate}].map(e=>{var t,i;return new Hv(Math.floor(n.width/e.scaleResolutionDownBy),Math.floor(n.height/e.scaleResolutionDownBy),Math.max(15e4,Math.floor(n.encoding.maxBitrate/(Math.pow(e.scaleResolutionDownBy,2)*((null!==(t=n.encoding.maxFramerate)&&void 0!==t?t:30)/(null!==(i=e.fps)&&void 0!==i?i:30))))),e.fps,n.encoding.priority)});var n;const{width:i,height:o}=t,r=i>o?i/o:o/i;return Math.abs(r-16/9)<Math.abs(r-4/3)?nk:ik}function ak(e,t,n,i){const o=[];if(n.forEach((n,r)=>{if(r>=ok.length)return;const s=Math.min(e,t),a={rid:ok[r],scaleResolutionDownBy:Math.max(1,s/Math.min(n.width,n.height)),maxBitrate:n.encoding.maxBitrate},c=i&&n.encoding.maxFramerate?Math.min(i,n.encoding.maxFramerate):n.encoding.maxFramerate;c&&(a.maxFramerate=c);const l=lb()||0===r;n.encoding.priority&&l&&(a.priority=n.encoding.priority,a.networkPriority=n.encoding.priority),o.push(a)}),mb()&&"ios"===vb()){let e;o.forEach(t=>{e?t.maxFramerate&&t.maxFramerate>e&&(e=t.maxFramerate):e=t.maxFramerate});let t=!0;o.forEach(n=>{var i;n.maxFramerate!=e&&(t&&(t=!1,Uf.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),Uf.info('Setting framerate of encoding "'.concat(null!==(i=n.rid)&&void 0!==i?i:"",'" to ').concat(e)),n.maxFramerate=e)})}return o}function ck(e){if(e)return e.sort((e,t)=>{const{encoding:n}=e,{encoding:i}=t;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 lk{constructor(e){const t=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!t)throw new Error("invalid scalability mode");if(this.spatial=parseInt(t[1]),this.temporal=parseInt(t[2]),t.length>3)switch(t[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=t[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat(null!==(e=this.suffix)&&void 0!==e?e:"")}}class dk extends Yy{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=arguments.length>3?arguments[3]:void 0;super(e,$v.Kind.Video,t,n,i),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>$f(this,void 0,void 0,function*(){if(!this.sender)return void(this._currentBitrate=0);let e;try{e=yield this.getSenderStats()}catch(Bx){return void this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:Bx}))}const t=new Map(e.map(e=>[e.rid,e])),n=e.some(e=>"cpu"===e.qualityLimitationReason);if(n!==this.isCpuConstrained&&(this.isCpuConstrained=n,this.isCpuConstrained&&this.emit(kv.CpuConstrained)),this.prevStats){let e=0;t.forEach((t,n)=>{var i;const o=null===(i=this.prevStats)||void 0===i?void 0:i.get(n);e+=Gy(t,o)}),this._currentBitrate=e}this.prevStats=t}),this.senderLock=new Ju}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var t;if(this.signalClient=e,!pb())return;const n=null===(t=this.sender)||void 0===t?void 0:t.getParameters();n&&(this.encodings=n.encodings),this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},Hy))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return $f(this,void 0,void 0,function*(){var t,n,i,o,r;yield e.pauseUpstream.call(this);try{for(var s,a=!0,c=qf(this.simulcastCodecs.values());!(t=(s=yield c.next()).done);a=!0){o=s.value,a=!1;const e=o;yield null===(r=e.sender)||void 0===r?void 0:r.replaceTrack(null)}}catch(l){n={error:l}}finally{try{a||t||!(i=c.return)||(yield i.call(c))}finally{if(n)throw n.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return $f(this,void 0,void 0,function*(){var t,n,i,o,r;yield e.resumeUpstream.call(this);try{for(var s,a=!0,c=qf(this.simulcastCodecs.values());!(t=(s=yield c.next()).done);a=!0){o=s.value,a=!1;const e=o;yield null===(r=e.sender)||void 0===r?void 0:r.replaceTrack(e.mediaStreamTrack)}}catch(l){n={error:l}}finally{try{a||t||!(i=c.return)||(yield i.call(c))}finally{if(n)throw n.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return $f(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source!==$v.Source.Camera||this.isUserProvided||(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{t()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return $f(this,void 0,void 0,function*(){const t=yield this.muteLock.lock();try{return this.isMuted?(this.source!==$v.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{t()}})}setTrackMuted(e){super.setTrackMuted(e);for(const t of this.simulcastCodecs.values())t.mediaStreamTrack.enabled=!e}getSenderStats(){return $f(this,void 0,void 0,function*(){var e;if(!(null===(e=this.sender)||void 0===e?void 0:e.getStats))return[];const t=[],n=yield this.sender.getStats();return n.forEach(e=>{var i;if("outbound-rtp"===e.type){const o={type:"video",streamId:e.id,frameHeight:e.frameHeight,frameWidth:e.frameWidth,framesPerSecond:e.framesPerSecond,framesSent:e.framesSent,firCount:e.firCount,pliCount:e.pliCount,nackCount:e.nackCount,packetsSent:e.packetsSent,bytesSent:e.bytesSent,qualityLimitationReason:e.qualityLimitationReason,qualityLimitationDurations:e.qualityLimitationDurations,qualityLimitationResolutionChanges:e.qualityLimitationResolutionChanges,rid:null!==(i=e.rid)&&void 0!==i?i:e.id,retransmittedPacketsSent:e.retransmittedPacketsSent,targetBitrate:e.targetBitrate,timestamp:e.timestamp},r=n.get(e.remoteId);r&&(o.jitter=r.jitter,o.packetsLost=r.packetsLost,o.roundTripTime=r.roundTripTime),t.push(o)}}),t.sort((e,t)=>{var n,i;return(null!==(n=t.frameWidth)&&void 0!==n?n:0)-(null!==(i=e.frameWidth)&&void 0!==i?i:0)}),t})}setPublishingQuality(e){const t=[];for(let n=zv.LOW;n<=zv.HIGH;n+=1)t.push(new sf({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(ab(this.codec),t)}restartTrack(e){return $f(this,void 0,void 0,function*(){var t,n,i,o,r;let s;if(e){const t=Wb({video:e});"boolean"!=typeof t.video&&(s=t.video)}yield this.restart(s),this.isCpuConstrained=!1;try{for(var a,c=!0,l=qf(this.simulcastCodecs.values());!(t=(a=yield l.next()).done);c=!0){o=a.value,c=!1;const e=o;e.sender&&"closed"!==(null===(r=e.sender.transport)||void 0===r?void 0:r.state)&&(e.mediaStreamTrack=this.mediaStreamTrack.clone(),yield e.sender.replaceTrack(e.mediaStreamTrack))}}catch(d){n={error:d}}finally{try{c||t||!(i=l.return)||(yield i.call(l))}finally{if(n)throw n.error}}})}setProcessor(e){const t=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return $f(this,arguments,void 0,function(e){var n=this;let i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){var o,r,s,a,c,l;if(yield t.setProcessor.call(n,e,i),null===(c=n.processor)||void 0===c?void 0:c.processedTrack)try{for(var d,u=!0,h=qf(n.simulcastCodecs.values());!(o=(d=yield h.next()).done);u=!0){a=d.value,u=!1;const e=a;yield null===(l=e.sender)||void 0===l?void 0:l.replaceTrack(n.processor.processedTrack)}}catch(p){r={error:p}}finally{try{u||o||!(s=h.return)||(yield s.call(h))}finally{if(r)throw r.error}}}()})}setDegradationPreference(e){return $f(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const t=this.sender.getParameters();t.degradationPreference=e,this.sender.setParameters(t)}catch(Bx){this.log.warn("failed to set degradationPreference",Object.assign({error:Bx},this.logContext))}})}addSimulcastTrack(e,t){if(this.simulcastCodecs.has(e))return void this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);const n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:t};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,t){const n=this.simulcastCodecs.get(e);n&&(n.sender=t,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},5e3))}setPublishingCodecs(e){return $f(this,void 0,void 0,function*(){var t,n,i,o,r,s,a;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(ab(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const c=[];try{for(t=!0,n=qf(e);!(o=(i=yield n.next()).done);t=!0){a=i.value,t=!1;const e=a;if(this.codec&&this.codec!==e.codec){const t=this.simulcastCodecs.get(e.codec);if(this.log.debug("try setPublishingCodec for ".concat(e.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:t})),t&&t.sender)t.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(e.codec),this.logContext),yield uk(t.sender,t.encodings,e.qualities,this.senderLock,ab(e.codec),this.log,this.logContext));else for(const n of e.qualities)if(n.enabled){c.push(e.codec);break}}else yield this.setPublishingLayers(ab(e.codec),e.qualities)}}catch(l){r={error:l}}finally{try{t||o||!(s=n.return)||(yield s.call(n))}finally{if(r)throw r.error}}return c})}setPublishingLayers(e,t){return $f(this,void 0,void 0,function*(){this.optimizeForPerformance?this.log.info("skipping setPublishingLayers due to optimized publishing performance",Object.assign(Object.assign({},this.logContext),{qualities:t})):(this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:t})),this.sender&&this.encodings&&(yield uk(this.sender,this.encodings,t,this.senderLock,e,this.log,this.logContext)))})}prioritizePerformance(){return $f(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const e=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const e=this.sender.getParameters();e.encodings=e.encodings.map((e,t)=>{var n;return Object.assign(Object.assign({},e),{active:0===t,scaleResolutionDownBy:Math.max(1,Math.ceil((null!==(n=this.mediaStreamTrack.getSettings().height)&&void 0!==n?n:360)/360)),scalabilityMode:0===t&&ab(this.codec)?"L1T3":void 0,maxFramerate:0===t?15:0,maxBitrate:0===t?e.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:e.encodings})),this.encodings=e.encodings,yield this.sender.setParameters(e)}catch(Bx){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:Bx})),this.optimizeForPerformance=!1}finally{e()}})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return $f(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),hb()&&this.isInBackground&&this.source===$v.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function uk(e,t,n,i,o,r,s){return $f(this,void 0,void 0,function*(){const a=yield i.lock();r.debug("setPublishingLayersForSender",Object.assign(Object.assign({},s),{sender:e,qualities:n,senderEncodings:t}));try{const i=e.getParameters(),{encodings:a}=i;if(!a)return;if(a.length!==t.length)return void r.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},s),{encodings:a,senderEncodings:t}));let c=!1;o&&n.some(e=>e.enabled)&&n.forEach(e=>e.enabled=!0),a.forEach((e,i)=>{var o;let a=null!==(o=e.rid)&&void 0!==o?o:"";""===a&&(a="q");const l=hk(a),d=n.find(e=>e.quality===l);d&&e.active!==d.enabled&&(c=!0,e.active=d.enabled,r.debug("setting layer ".concat(d.quality," to ").concat(e.active?"enabled":"disabled"),s),lb()&&(d.enabled?(e.scaleResolutionDownBy=t[i].scaleResolutionDownBy,e.maxBitrate=t[i].maxBitrate,e.maxFrameRate=t[i].maxFrameRate):(e.scaleResolutionDownBy=4,e.maxBitrate=10,e.maxFrameRate=2)))}),c&&(i.encodings=a,r.debug("setting encodings",Object.assign(Object.assign({},s),{encodings:i.encodings})),yield e.setParameters(i))}finally{a()}})}function hk(e){switch(e){case"f":default:return zv.HIGH;case"h":return zv.MEDIUM;case"q":return zv.LOW}}function pk(e,t,n,i){if(!n)return[new Kp({quality:zv.HIGH,width:e,height:t,bitrate:0,ssrc:0})];if(i){const i=n[0].scalabilityMode,o=new lk(i),r=[],s="h"==o.suffix?1.5:2,a="h"==o.suffix?2:3;for(let c=0;c<o.spatial;c+=1)r.push(new Kp({quality:Math.min(zv.HIGH,o.spatial-1)-c,width:Math.ceil(e/Math.pow(s,c)),height:Math.ceil(t/Math.pow(s,c)),bitrate:n[0].maxBitrate?Math.ceil(n[0].maxBitrate/Math.pow(a,c)):0,ssrc:0}));return r}return n.map(n=>{var i,o,r;const s=null!==(i=n.scaleResolutionDownBy)&&void 0!==i?i:1;let a=hk(null!==(o=n.rid)&&void 0!==o?o:"");return new Kp({quality:a,width:Math.ceil(e/s),height:Math.ceil(t/s),bitrate:null!==(r=n.maxBitrate)&&void 0!==r?r:0,ssrc:0})})}const mk="_lossy",fk="_reliable",gk="leave-reconnect";var vk,bk,yk,kk,wk,Ck,Sk,Tk,xk,Ek,_k;(bk=vk||(vk={}))[bk.New=0]="New",bk[bk.Connected=1]="Connected",bk[bk.Disconnected=2]="Disconnected",bk[bk.Reconnecting=3]="Reconnecting",bk[bk.Closed=4]="Closed";class Ik extends Gf.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var t;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=Fy.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=vk.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=Uf,this.reliableDataSequence=1,this.reliableMessageBuffer=new py,this.reliableReceivedState=new my(3e4),this.handleDataChannel=e=>$f(this,[e],void 0,function(e){var t=this;let{channel:n}=e;return function*(){if(n){if(n.label===fk)t.reliableDCSub=n;else{if(n.label!==mk)return;t.lossyDCSub=n}t.log.debug("on data channel ".concat(n.id,", ").concat(n.label),t.logContext),n.onmessage=t.handleDataMessage}}()}),this.handleDataMessage=e=>$f(this,void 0,void 0,function*(){var t,n,i,o,r;const s=yield this.dataProcessLock.lock();try{let s;if(e.data instanceof ArrayBuffer)s=e.data;else{if(!(e.data instanceof Blob))return void this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:e.data}));s=yield e.data.arrayBuffer()}const a=Qp.fromBinary(new Uint8Array(s));if(a.sequence>0&&""!==a.participantSid){const e=this.reliableReceivedState.get(a.participantSid);if(e&&a.sequence<=e)return;this.reliableReceivedState.set(a.participantSid,a.sequence)}if("speaker"===(null===(t=a.value)||void 0===t?void 0:t.case))this.emit(bv.ActiveSpeakersUpdate,a.value.value.speakers);else if("encryptedPacket"===(null===(n=a.value)||void 0===n?void 0:n.case)){if(!this.e2eeManager)return void this.log.error("Received encrypted packet but E2EE not set up",this.logContext);const e=yield null===(i=this.e2eeManager)||void 0===i?void 0:i.handleEncryptedData(a.value.value.encryptedValue,a.value.value.iv,a.participantIdentity,a.value.value.keyIndex),t=tm.fromBinary(e.payload),n=new Qp({value:t.value});"user"===(null===(o=n.value)||void 0===o?void 0:o.case)&&Rk(n,n.value.value),this.emit(bv.DataPacketReceived,n,a.value.value.encryptionType)}else"user"===(null===(r=a.value)||void 0===r?void 0:r.case)&&Rk(a,a.value.value),this.emit(bv.DataPacketReceived,a,Gp.NONE)}finally{s()}}),this.handleDataError=e=>{const t=0===e.currentTarget.maxRetransmits?"lossy":"reliable";if(e instanceof ErrorEvent&&e.error){const{error:n}=e.error;this.log.error("DataChannel error on ".concat(t,": ").concat(e.message),Object.assign(Object.assign({},this.logContext),{error:n}))}else this.log.error("Unknown DataChannel error on ".concat(t),Object.assign(Object.assign({},this.logContext),{event:e}))},this.handleBufferedAmountLow=e=>{const t=0===e.currentTarget.maxRetransmits?Xp.LOSSY:Xp.RELIABLE;this.updateAndEmitDCBufferStatus(t)},this.handleDisconnect=(e,t)=>{if(this._isClosed)return;this.log.warn("".concat(e," disconnected"),this.logContext),0===this.reconnectAttempts&&(this.reconnectStart=Date.now());const n=Date.now()-this.reconnectStart;let i=this.getNextRetryDelay({elapsedMs:n,retryCount:this.reconnectAttempts});null!==i?(e===gk&&(i=0),this.log.debug("reconnecting in ".concat(i,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Fv.setTimeout(()=>this.attemptReconnect(t).finally(()=>this.reconnectTimeout=void 0),i)):(e=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(e,"ms. giving up"),this.logContext),this.emit(bv.Disconnected),this.close()})(n)},this.waitForRestarted=()=>new Promise((e,t)=>{this.pcState===vk.Connected&&e();const n=()=>{this.off(bv.Disconnected,i),e()},i=()=>{this.off(bv.Restarted,n),t()};this.once(bv.Restarted,n),this.once(bv.Disconnected,i)}),this.updateAndEmitDCBufferStatus=e=>{const t=this.isBufferStatusLow(e);void 0!==t&&t!==this.dcBufferStatus.get(e)&&(this.dcBufferStatus.set(e,t),this.emit(bv.DCBufferStatusChanged,t,e))},this.isBufferStatusLow=e=>{const t=this.dataChannelForKind(e);if(t)return e===Xp.RELIABLE&&this.reliableMessageBuffer.alignBufferedAmount(t.bufferedAmount),t.bufferedAmount<=t.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>{this.client.currentState===cy.RECONNECTING&&(this.clearReconnectTimeout(),this.attemptReconnect(jp.RR_SIGNAL_DISCONNECTED))},this.log=Ff(null!==(t=e.loggerName)&&void 0!==t?t:Af.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new dy(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new Ju,this.dataProcessLock=new Ju,this.dcBufferStatus=new Map([[Xp.LOSSY,!0],[Xp.RELIABLE,!0]]),this.client.onParticipantUpdate=e=>this.emit(bv.ParticipantUpdate,e),this.client.onConnectionQuality=e=>this.emit(bv.ConnectionQualityUpdate,e),this.client.onRoomUpdate=e=>this.emit(bv.RoomUpdate,e),this.client.onSubscriptionError=e=>this.emit(bv.SubscriptionError,e),this.client.onSubscriptionPermissionUpdate=e=>this.emit(bv.SubscriptionPermissionUpdate,e),this.client.onSpeakersChanged=e=>this.emit(bv.SpeakersChanged,e),this.client.onStreamStateUpdate=e=>this.emit(bv.StreamStateChanged,e),this.client.onRequestResponse=e=>this.emit(bv.SignalRequestResponse,e)}get logContext(){var e,t,n,i,o,r;return{room:null===(t=null===(e=this.latestJoinResponse)||void 0===e?void 0:e.room)||void 0===t?void 0:t.name,roomID:null===(i=null===(n=this.latestJoinResponse)||void 0===n?void 0:n.room)||void 0===i?void 0:i.sid,participant:null===(r=null===(o=this.latestJoinResponse)||void 0===o?void 0:o.participant)||void 0===r?void 0:r.identity,pID:this.participantSid}}join(e,t,n,i){return $f(this,void 0,void 0,function*(){this.url=e,this.token=t,this.signalOpts=n,this.maxJoinAttempts=n.maxRetries;try{this.joinAttempts+=1,this.setupSignalClientCallbacks();const o=yield this.client.join(e,t,n,i);return this._isClosed=!1,this.latestJoinResponse=o,this.subscriberPrimary=o.subscriberPrimary,this.pcManager||(yield this.configure(o)),this.subscriberPrimary&&!o.fastPublish||this.negotiate().catch(e=>{Uf.error(e,this.logContext)}),this.registerOnLineListener(),this.clientConfiguration=o.clientConfiguration,this.emit(bv.SignalConnected,o),o}catch(Bx){if(Bx instanceof Tv&&Bx.reason===sv.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,t,n,i);throw Bx}})}close(){return $f(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed)e();else try{this._isClosed=!0,this.joinAttempts=0,this.emit(bv.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return $f(this,void 0,void 0,function*(){var e;yield null===(e=this.pcManager)||void 0===e?void 0:e.close(),this.pcManager=void 0;const t=e=>{e&&(e.close(),e.onbufferedamountlow=null,e.onclose=null,e.onclosing=null,e.onerror=null,e.onmessage=null,e.onopen=null)};t(this.lossyDC),t(this.lossyDCSub),t(this.reliableDC),t(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new py,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupClient(){return $f(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Ev("a track with the same ID has already been published");return new Promise((t,n)=>{const i=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(new Tv("publication of local track timed out, no response from server",sv.Timeout))},1e4);this.pendingTrackResolvers[e.cid]={resolve:e=>{clearTimeout(i),t(e)},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:t}=this.pendingTrackResolvers[e.track.id];t&&t(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(Bx){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:Bx}))}return!1}updateMuteStatus(e,t){this.client.sendMuteTrack(e,t)}get dataSubscriberReadyState(){var e;return null===(e=this.reliableDCSub)||void 0===e?void 0:e.readyState}getConnectedServerAddress(){return $f(this,void 0,void 0,function*(){var e;return null===(e=this.pcManager)||void 0===e?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e){return $f(this,void 0,void 0,function*(){var t,n;if(this.pcManager&&this.pcManager.currentState!==By.NEW)return;this.participantSid=null===(t=e.participant)||void 0===t?void 0:t.sid;const i=this.makeRTCConfiguration(e);var o;this.pcManager=new Vy(i,e.subscriberPrimary,this.loggerOptions),this.emit(bv.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(e,t)=>{this.client.sendIceCandidate(e,t)},this.pcManager.onPublisherOffer=(e,t)=>{this.client.sendOffer(e,t)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(t,n,i)=>$f(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(t),this.logContext),["closed","disconnected","failed"].includes(n)&&(this.publisherConnectionPromise=void 0),t===By.CONNECTED){const t=this.pcState===vk.New;this.pcState=vk.Connected,t&&this.emit(bv.Connected,e)}else t===By.FAILED&&(this.pcState!==vk.Connected&&this.pcState!==vk.Reconnecting||(this.pcState=vk.Disconnected,this.handleDisconnect("peerconnection failed","failed"===i?jp.RR_SUBSCRIBER_FAILED:jp.RR_PUBLISHER_FAILED)));const o=this.client.isDisconnected||this.client.currentState===cy.RECONNECTING,r=[By.FAILED,By.CLOSING,By.CLOSED].includes(t);o&&r&&!this._isClosed&&this.emit(bv.Offline)}),this.pcManager.onTrack=e=>{this.emit(bv.MediaTrackAdded,e.track,e.streams[0],e.receiver)},void 0!==(o=null===(n=e.serverInfo)||void 0===n?void 0:n.protocol)&&o>13||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(e,t)=>$f(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,t))}),this.client.onTrickle=(e,t)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:t})),this.pcManager.addIceCandidate(e,t))},this.client.onOffer=(e,t)=>$f(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=t,!this.pcManager)return;const n=yield this.pcManager.createSubscriberAnswerFromOffer(e,t);n&&this.client.sendAnswer(n,t)}),this.client.onLocalTrackPublished=e=>{var t;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:null===(t=e.track)||void 0===t?void 0:t.sid})),!this.pendingTrackResolvers[e.cid])return void this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));const{resolve:n}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],n(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(bv.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(bv.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{this.token=e},this.client.onRemoteMuteChanged=(e,t)=>{this.emit(bv.RemoteMute,e,t)},this.client.onSubscribedQualityUpdate=e=>{this.emit(bv.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var t;this.participantSid=null===(t=e.participant)||void 0===t?void 0:t.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(bv.RoomMoved,e)},this.client.onClose=()=>{this.handleDisconnect("signal",jp.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:null==e?void 0:e.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions(e.regions)),e.action){case Jm.DISCONNECT:this.emit(bv.Disconnected,null==e?void 0:e.reason),this.close();break;case Jm.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(gk);break;case Jm.RESUME:this.handleDisconnect(gk)}}}makeRTCConfiguration(e){var t;const n=Object.assign({},this.rtcConfig);if((null===(t=this.signalOpts)||void 0===t?void 0:t.e2eeEnabled)&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),n.encodedInsertableStreams=!0),e.iceServers&&!n.iceServers){const t=[];e.iceServers.forEach(e=>{const n={urls:e.urls};e.username&&(n.username=e.username),e.credential&&(n.credential=e.credential),t.push(n)}),n.iceServers=t}return e.clientConfiguration&&e.clientConfiguration.forceRelay===Np.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(mk,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(fk,{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,t,n){return $f(this,void 0,void 0,function*(){if(rb())return yield this.createTransceiverRTCRtpSender(e,t,n);if(sb())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new Iv("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,t,n,i){return $f(this,void 0,void 0,function*(){if(rb())return this.createSimulcastTransceiverSender(e,t,n,i);if(sb())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new Iv("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,t,n){return $f(this,void 0,void 0,function*(){if(!this.pcManager)throw new Iv("publisher is closed");const i=[];e.mediaStream&&i.push(e.mediaStream),jb(e)&&(e.codec=t.videoCodec);const o={direction:"sendonly",streams:i};return n&&(o.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,o)).sender})}createSimulcastTransceiverSender(e,t,n,i){return $f(this,void 0,void 0,function*(){if(!this.pcManager)throw new Iv("publisher is closed");const o={direction:"sendonly"};i&&(o.sendEncodings=i);const r=yield this.pcManager.addPublisherTransceiver(t.mediaStreamTrack,o);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,r.sender),r.sender})}createRTCRtpSender(e){return $f(this,void 0,void 0,function*(){if(!this.pcManager)throw new Iv("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return $f(this,void 0,void 0,function*(){var t,n,i;if(!this._isClosed)if(this.attemptingReconnect)Uf.warn("already attempting reconnect, returning early",this.logContext);else{(null===(t=this.clientConfiguration)||void 0===t?void 0:t.resumeConnection)!==Np.DISABLED&&(null!==(i=null===(n=this.pcManager)||void 0===n?void 0:n.currentState)&&void 0!==i?i:By.NEW)!==By.NEW||(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(Bx){this.reconnectAttempts+=1;let t=!0;Bx instanceof Iv?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:Bx})),t=!1):Bx instanceof Pk||(this.fullReconnectOnNext=!0),t?this.handleDisconnect("reconnect",jp.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(bv.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(Bx){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:Bx}))}return null}restartConnection(e){return $f(this,void 0,void 0,function*(){var t,n,i;try{if(!this.url||!this.token)throw new Iv("could not reconnect, url or token not saved");let n;this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(bv.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new Pk;n=yield this.join(null!=e?e:this.url,this.token,this.signalOpts)}catch(Bx){if(Bx instanceof Tv&&Bx.reason===sv.NotAllowed)throw new Iv("could not reconnect, token might be expired");throw new Pk}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(bv.SignalRestarted,n),yield this.waitForPCReconnected(),this.client.currentState!==cy.CONNECTED)throw new Pk("Signal connection got severed during reconnect");null===(t=this.regionUrlProvider)||void 0===t||t.resetAttempts(),this.emit(bv.Restarted)}catch(o){const e=yield null===(n=this.regionUrlProvider)||void 0===n?void 0:n.getNextBestRegionUrl();if(e)return void(yield this.restartConnection(e));throw null===(i=this.regionUrlProvider)||void 0===i||i.resetAttempts(),o}})}resumeConnection(e){return $f(this,void 0,void 0,function*(){var t;if(!this.url||!this.token)throw new Iv("could not reconnect, url or token not saved");if(!this.pcManager)throw new Iv("publisher and subscriber connections unset");let n;this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(bv.Resuming);try{this.setupSignalClientCallbacks(),n=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(i){let e="";if(i instanceof Error&&(e=i.message,this.log.error(i.message,Object.assign(Object.assign({},this.logContext),{error:i}))),i instanceof Tv&&i.reason===sv.NotAllowed)throw new Iv("could not reconnect, token might be expired");if(i instanceof Tv&&i.reason===sv.LeaveRequest)throw i;throw new Pk(e)}if(this.emit(bv.SignalResumed),n){const e=this.makeRTCConfiguration(n);this.pcManager.updateConfiguration(e),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=n.serverInfo)}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!==cy.CONNECTED)throw new Pk("Signal connection got severed during reconnect");this.client.setReconnected(),"open"===(null===(t=this.reliableDC)||void 0===t?void 0:t.readyState)&&null===this.reliableDC.id&&this.createDataChannels(),(null==n?void 0:n.lastMessageSeq)&&this.resendReliableMessagesForResume(n.lastMessageSeq),this.emit(bv.Resumed)})}waitForPCInitialConnection(e,t){return $f(this,void 0,void 0,function*(){if(!this.pcManager)throw new Iv("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(t,e)})}waitForPCReconnected(){return $f(this,void 0,void 0,function*(){this.pcState=vk.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield ob(2e3),!this.pcManager)throw new Iv("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=vk.Connected}catch(Bx){throw this.pcState=vk.Disconnected,new Tv("could not establish PC connection, ".concat(Bx.message),sv.InternalError)}})}publishRpcResponse(e,t,n,i){return $f(this,void 0,void 0,function*(){const o=new Qp({destinationIdentities:[e],kind:Xp.RELIABLE,value:{case:"rpcResponse",value:new um({requestId:t,value:i?{case:"error",value:i.toProto()}:{case:"payload",value:null!=n?n:""}})}});yield this.sendDataPacket(o,Xp.RELIABLE)})}publishRpcAck(e,t){return $f(this,void 0,void 0,function*(){const n=new Qp({destinationIdentities:[e],kind:Xp.RELIABLE,value:{case:"rpcAck",value:new dm({requestId:t})}});yield this.sendDataPacket(n,Xp.RELIABLE)})}sendDataPacket(e,t){return $f(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(t),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const t=function(e){var t,n,i,o,r;if("sipDtmf"!==(null===(t=e.value)||void 0===t?void 0:t.case)&&"metrics"!==(null===(n=e.value)||void 0===n?void 0:n.case)&&"speaker"!==(null===(i=e.value)||void 0===i?void 0:i.case)&&"transcription"!==(null===(o=e.value)||void 0===o?void 0:o.case)&&"encryptedPacket"!==(null===(r=e.value)||void 0===r?void 0:r.case))return new tm({value:e.value})}(e);if(t){const n=yield this.e2eeManager.encryptData(t.toBinary());e.value={case:"encryptedPacket",value:new em({encryptedValue:n.payload,iv:n.iv,keyIndex:n.keyIndex})}}}t===Xp.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const n=e.toBinary(),i=this.dataChannelForKind(t);if(i){if(t===Xp.RELIABLE&&this.reliableMessageBuffer.push({data:n,sequence:e.sequence}),this.attemptingReconnect)return;i.send(n)}this.updateAndEmitDCBufferStatus(t)})}resendReliableMessagesForResume(e){return $f(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(Xp.RELIABLE);const t=this.dataChannelForKind(Xp.RELIABLE);t&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(e=>{t.send(e.data)})),this.updateAndEmitDCBufferStatus(Xp.RELIABLE)})}waitForBufferStatusLow(e){return new Promise((t,n)=>$f(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))t();else{const i=()=>n("Engine closed");for(this.once(bv.Closing,i);!this.dcBufferStatus.get(e);)yield ob(10);this.off(bv.Closing,i),t()}}))}ensureDataTransportConnected(e){return $f(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.subscriberPrimary;return function*(){var i;if(!t.pcManager)throw new Iv("PC manager is closed");const o=n?t.pcManager.subscriber:t.pcManager.publisher,r=n?"Subscriber":"Publisher";if(!o)throw new Tv("".concat(r," connection not set"),sv.InternalError);let s=!1;n||t.dataChannelForKind(e,n)||(t.createDataChannels(),s=!0),s||n||t.pcManager.publisher.isICEConnected||"checking"===t.pcManager.publisher.getICEConnectionState()||(s=!0),s&&t.negotiate().catch(e=>{Uf.error(e,t.logContext)});const a=t.dataChannelForKind(e,n);if("open"===(null==a?void 0:a.readyState))return;const c=(new Date).getTime()+t.peerConnectionTimeout;for(;(new Date).getTime()<c;){if(o.isICEConnected&&"open"===(null===(i=t.dataChannelForKind(e,n))||void 0===i?void 0:i.readyState))return;yield ob(50)}throw new Tv("could not establish ".concat(r," connection, state: ").concat(o.getICEConnectionState()),sv.InternalError)}()})}ensurePublisherConnected(e){return $f(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!!this.pcManager&&this.pcManager.currentState===By.CONNECTED&&!(!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return $f(this,void 0,void 0,function*(){return new Promise((e,t)=>$f(this,void 0,void 0,function*(){if(!this.pcManager)return void t(new Pv("PC manager is closed"));this.pcManager.requirePublisher(),0!=this.pcManager.publisher.getTransceivers().length||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&&t("cannot negotiate on closed engine"),this.on(bv.Closing,i),this.pcManager.publisher.once(Py,e=>{const t=new Map;e.forEach(e=>{const n=e.codec.toLowerCase();var i;i=n,Zv.includes(i)&&t.set(e.payload,n)}),this.emit(bv.RTPVideoMapUpdate,t)});try{yield this.pcManager.negotiate(n),e()}catch(Bx){Bx instanceof Pv&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",jp.RR_UNKNOWN),t(Bx)}finally{this.off(bv.Closing,i)}}))})}dataChannelForKind(e,t){if(t){if(e===Xp.LOSSY)return this.lossyDCSub;if(e===Xp.RELIABLE)return this.reliableDCSub}else{if(e===Xp.LOSSY)return this.lossyDC;if(e===Xp.RELIABLE)return this.reliableDC}}sendSyncState(e,t){var n,i;if(!this.pcManager)return void this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);const o=this.pcManager.subscriber.getLocalDescription(),r=this.pcManager.subscriber.getRemoteDescription(),s=null===(i=null===(n=this.signalOpts)||void 0===n?void 0:n.autoSubscribe)||void 0===i||i,a=new Array,c=new Array;e.forEach(e=>{e.isDesired!==s&&a.push(e.trackSid),e.isEnabled||c.push(e.trackSid)}),this.client.sendSyncState(new mf({answer:o?hy({sdp:o.sdp,type:o.type}):void 0,offer:r?hy({sdp:r.sdp,type:r.type}):void 0,subscription:new qm({trackSids:a,subscribe:!s,participantTracks:[]}),publishTracks:Kb(t),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:c,datachannelReceiveStates:this.reliableReceivedState.map((e,t)=>new ff({publisherSid:t,lastSeq:e}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],t=(t,n)=>{void 0!==(null==t?void 0:t.id)&&null!==t.id&&e.push(new gf({label:t.label,id:t.id,target:n}))};return t(this.dataChannelForKind(Xp.LOSSY),Pm.PUBLISHER),t(this.dataChannelForKind(Xp.RELIABLE),Pm.PUBLISHER),t(this.dataChannelForKind(Xp.LOSSY,!0),Pm.SUBSCRIBER),t(this.dataChannelForKind(Xp.RELIABLE,!0),Pm.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Fv.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){pb()&&window.addEventListener("online",this.handleBrowserOnLine)}deregisterOnLineListener(){pb()&&window.removeEventListener("online",this.handleBrowserOnLine)}}class Pk extends Error{}function Rk(e,t){const n=e.participantIdentity?e.participantIdentity:t.participantIdentity;e.participantIdentity=n,t.participantIdentity=n;const i=0!==e.destinationIdentities.length?e.destinationIdentities:t.destinationIdentities;e.destinationIdentities=i,t.destinationIdentities=i}class Ak{constructor(e,t){this.lastUpdateAt=0,this.settingsCacheTime=3e3,this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=t}updateToken(e){this.token=e}isCloud(){return fb(this.serverUrl)}getServerUrl(){return this.serverUrl}getNextBestRegionUrl(e){return $f(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 t=this.regionSettings.regions.filter(e=>!this.attemptedRegions.find(t=>t.url===e.url));if(t.length>0){const e=t[0];return this.attemptedRegions.push(e),Uf.debug("next region: ".concat(e.region)),e.url}return null})}resetAttempts(){this.attemptedRegions=[]}fetchRegionSettings(e){return $f(this,void 0,void 0,function*(){const t=yield fetch("".concat((n=this.serverUrl,"".concat(n.protocol.replace("ws","http"),"//").concat(n.host,"/settings")),"/regions"),{headers:{authorization:"Bearer ".concat(this.token)},signal:e});var n;if(t.ok){const e=yield t.json();return this.lastUpdateAt=Date.now(),e}throw new Tv("Could not fetch region settings: ".concat(t.statusText),401===t.status?sv.NotAllowed:sv.InternalError,t.status)})}setServerReportedRegions(e){this.regionSettings=e,this.lastUpdateAt=Date.now()}}class Mk{get info(){return this._info}validateBytesReceived(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("number"==typeof this.totalByteSize&&0!==this.totalByteSize){if(e&&this.bytesReceived<this.totalByteSize)throw new Mv("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),cv.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new Mv("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),cv.LengthExceeded)}}constructor(e,t,n,i){this.reader=t,this.totalByteSize=n,this._info=e,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=i}}class Ok extends Mk{handleChunkReceived(e){var t;this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader();let t=new Pb,n=null,i=null;if(this.signal){const e=this.signal;i=()=>{var n;null===(n=t.reject)||void 0===n||n.call(t,e.reason)},e.addEventListener("abort",i),n=e}const o=()=>{e.releaseLock(),n&&i&&n.removeEventListener("abort",i),this.signal=void 0};return{next:()=>$f(this,void 0,void 0,function*(){var n,i;try{const{done:o,value:r}=yield Promise.race([e.read(),t.promise,null!==(i=null===(n=this.outOfBandFailureRejectingFuture)||void 0===n?void 0:n.promise)&&void 0!==i?i:new Promise(()=>{})]);return o?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(r),{done:!1,value:r.content})}catch(r){throw o(),r}}),return(){return $f(this,void 0,void 0,function*(){return o(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return $f(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){var n,i,o,r;let s=new Set;const a=t.signal?e.withAbortSignal(t.signal):e;try{for(var c,l=!0,d=qf(a);!(n=(c=yield d.next()).done);l=!0){r=c.value,l=!1;const e=r;s.add(e)}}catch(u){i={error:u}}finally{try{l||n||!(o=d.return)||(yield o.call(d))}finally{if(i)throw i.error}}return Array.from(s)}()})}}class Dk extends Mk{constructor(e,t,n,i){super(e,t,n,i),this.receivedChunks=new Map}handleChunkReceived(e){var t;const n=Ob(e.chunkIndex),i=this.receivedChunks.get(n);if(i&&i.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const o=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;null===(t=this.onProgress)||void 0===t||t.call(this,o)}[Symbol.asyncIterator](){const e=this.reader.getReader(),t=new TextDecoder("utf-8",{fatal:!0});let n=new Pb,i=null,o=null;if(this.signal){const e=this.signal;o=()=>{var t;null===(t=n.reject)||void 0===t||t.call(n,e.reason)},e.addEventListener("abort",o),i=e}const r=()=>{e.releaseLock(),i&&o&&i.removeEventListener("abort",o),this.signal=void 0};return{next:()=>$f(this,void 0,void 0,function*(){var i,o;try{const{done:r,value:a}=yield Promise.race([e.read(),n.promise,null!==(o=null===(i=this.outOfBandFailureRejectingFuture)||void 0===i?void 0:i.promise)&&void 0!==o?o:new Promise(()=>{})]);if(r)return this.validateBytesReceived(!0),{done:!0,value:void 0};{let e;this.handleChunkReceived(a);try{e=t.decode(a.content)}catch(s){throw new Mv("Cannot decode datastream chunk ".concat(a.chunkIndex," as text: ").concat(s),cv.DecodeFailed)}return{done:!1,value:e}}}catch(s){throw r(),s}}),return(){return $f(this,void 0,void 0,function*(){return r(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return $f(this,arguments,void 0,function(){var e=this;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function*(){var n,i,o,r;let s="";const a=t.signal?e.withAbortSignal(t.signal):e;try{for(var c,l=!0,d=qf(a);!(n=(c=yield d.next()).done);l=!0)r=c.value,l=!1,s+=r}catch(u){i={error:u}}finally{try{l||n||!(o=d.return)||(yield o.call(d))}finally{if(i)throw i.error}}return s}()})}}class Nk{constructor(){this.log=Uf,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map}registerTextStreamHandler(e,t){if(this.textStreamHandlers.has(e))throw new Mv('A text stream handler for topic "'.concat(e,'" has already been set.'),cv.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,t)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,t){if(this.byteStreamHandlers.has(e))throw new Mv('A byte stream handler for topic "'.concat(e,'" has already been set.'),cv.HandlerAlreadyRegistered);this.byteStreamHandlers.set(e,t)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}clearHandlersAndControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear(),this.byteStreamHandlers.clear(),this.textStreamHandlers.clear()}validateParticipantHasNoActiveDataStreams(e){var t,n,i,o;const r=Array.from(this.textStreamControllers.entries()).filter(t=>t[1].sendingParticipantIdentity===e),s=Array.from(this.byteStreamControllers.entries()).filter(t=>t[1].sendingParticipantIdentity===e);if(r.length>0||s.length>0){const a=new Mv("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),cv.AbnormalEnd);for(const[e,i]of s)null===(n=(t=i.outOfBandFailureRejectingFuture).reject)||void 0===n||n.call(t,a),this.byteStreamControllers.delete(e);for(const[e,t]of r)null===(o=(i=t.outOfBandFailureRejectingFuture).reject)||void 0===o||o.call(i,a),this.textStreamControllers.delete(e)}}handleDataStreamPacket(e,t){return $f(this,void 0,void 0,function*(){switch(e.value.case){case"streamHeader":return this.handleStreamHeader(e.value.value,e.participantIdentity,t);case"streamChunk":return this.handleStreamChunk(e.value.value,t);case"streamTrailer":return this.handleStreamTrailer(e.value.value,t);default:throw new Error('DataPacket of value "'.concat(e.value.case,'" is not data stream related!'))}})}handleStreamHeader(e,t,n){return $f(this,void 0,void 0,function*(){var i;if("byteHeader"===e.contentHeader.case){const o=this.byteStreamHandlers.get(e.topic);if(!o)return void this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);let r;const s=new Pb;s.promise.catch(e=>{this.log.error(e)});const a={id:e.streamId,name:null!==(i=e.contentHeader.value.name)&&void 0!==i?i:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Ob(e.timestamp),attributes:e.attributes,encryptionType:n},c=new ReadableStream({start:n=>{if(r=n,this.textStreamControllers.has(e.streamId))throw new Mv("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),cv.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:a,controller:r,startTime:Date.now(),sendingParticipantIdentity:t,outOfBandFailureRejectingFuture:s})}});o(new Ok(a,c,Ob(e.totalLength),s),{identity:t})}else if("textHeader"===e.contentHeader.case){const i=this.textStreamHandlers.get(e.topic);if(!i)return void this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);let o;const r=new Pb;r.promise.catch(e=>{this.log.error(e)});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,encryptionType:n},a=new ReadableStream({start:n=>{if(o=n,this.textStreamControllers.has(e.streamId))throw new Mv("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),cv.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:s,controller:o,startTime:Date.now(),sendingParticipantIdentity:t,outOfBandFailureRejectingFuture:r})}});i(new Dk(s,a,Ob(e.totalLength),r),{identity:t})}})}handleStreamChunk(e,t){const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.encryptionType!==t?(n.controller.error(new Mv("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(n.info.encryptionType),cv.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId)):e.content.length>0&&n.controller.enqueue(e));const i=this.textStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==t?(i.controller.error(new Mv("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(i.info.encryptionType),cv.EncryptionTypeMismatch)),this.textStreamControllers.delete(e.streamId)):e.content.length>0&&i.controller.enqueue(e))}handleStreamTrailer(e,t){const n=this.textStreamControllers.get(e.streamId);n&&(n.info.encryptionType!==t?n.controller.error(new Mv("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(n.info.encryptionType),cv.EncryptionTypeMismatch)):(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId)));const i=this.byteStreamControllers.get(e.streamId);i&&(i.info.encryptionType!==t?i.controller.error(new Mv("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(t,", got ").concat(i.info.encryptionType),cv.EncryptionTypeMismatch)):(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),e.attributes),i.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class Lk{constructor(e,t,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=t}write(e){return this.defaultWriter.write(e)}close(){return $f(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),null===(e=this.onClose)||void 0===e||e.call(this)})}}class jk extends Lk{}class Uk extends Lk{}class Fk{constructor(e,t){this.engine=e,this.log=t}setupEngine(e){this.engine=e}sendText(e,t){return $f(this,void 0,void 0,function*(){var n;const i=crypto.randomUUID(),o=(new TextEncoder).encode(e).byteLength,r=null===(n=null==t?void 0:t.attachments)||void 0===n?void 0:n.map(()=>crypto.randomUUID()),s=new Array(r?r.length+1:1).fill(0),a=(e,n)=>{var i;s[n]=e;const o=s.reduce((e,t)=>e+t,0);null===(i=null==t?void 0:t.onProgress)||void 0===i||i.call(t,o)},c=yield this.streamText({streamId:i,totalSize:o,destinationIdentities:null==t?void 0:t.destinationIdentities,topic:null==t?void 0:t.topic,attachedStreamIds:r,attributes:null==t?void 0:t.attributes});return yield c.write(e),a(1,0),yield c.close(),(null==t?void 0:t.attachments)&&r&&(yield Promise.all(t.attachments.map((e,n)=>$f(this,void 0,void 0,function*(){return this._sendFile(r[n],e,{topic:t.topic,mimeType:e.type,onProgress:e=>{a(e,n+1)}})})))),c.info})}streamText(e){return $f(this,void 0,void 0,function*(){var t,n,i;const o=null!==(t=null==e?void 0:e.streamId)&&void 0!==t?t:crypto.randomUUID(),r={id:o,mimeType:"text/plain",timestamp:Date.now(),topic:null!==(n=null==e?void 0:e.topic)&&void 0!==n?n:"",size:null==e?void 0:e.totalSize,attributes:null==e?void 0:e.attributes,encryptionType:(null===(i=this.engine.e2eeManager)||void 0===i?void 0:i.isDataChannelEncryptionEnabled)?Gp.GCM:Gp.NONE},s=new xm({streamId:o,mimeType:r.mimeType,topic:r.topic,timestamp:Db(r.timestamp),totalLength:Db(null==e?void 0:e.totalSize),attributes:r.attributes,contentHeader:{case:"textHeader",value:new Sm({version:null==e?void 0:e.version,attachedStreamIds:null==e?void 0:e.attachedStreamIds,replyToStreamId:null==e?void 0:e.replyToStreamId,operationType:"update"===(null==e?void 0:e.type)?Cm.UPDATE:Cm.CREATE})}}),a=null==e?void 0:e.destinationIdentities,c=new Qp({destinationIdentities:a,value:{case:"streamHeader",value:s}});yield this.engine.sendDataPacket(c,Xp.RELIABLE);let l=0;const d=this.engine,u=new WritableStream({write(e){return $f(this,void 0,void 0,function*(){for(const t of function(e){const t=[];let n=(new TextEncoder).encode(e);for(;n.length>15e3;){let e=15e3;for(;e>0;){const t=n[e];if(void 0!==t&&128!=(192&t))break;e--}t.push(n.slice(0,e)),n=n.slice(e)}return n.length>0&&t.push(n),t}(e)){yield d.waitForBufferStatusLow(Xp.RELIABLE);const e=new Em({content:t,streamId:o,chunkIndex:Db(l)}),n=new Qp({destinationIdentities:a,value:{case:"streamChunk",value:e}});yield d.sendDataPacket(n,Xp.RELIABLE),l+=1}})},close(){return $f(this,void 0,void 0,function*(){const e=new _m({streamId:o}),t=new Qp({destinationIdentities:a,value:{case:"streamTrailer",value:e}});yield d.sendDataPacket(t,Xp.RELIABLE)})},abort(e){}});let h=()=>$f(this,void 0,void 0,function*(){yield p.close()});d.once(bv.Closing,h);const p=new jk(u,r,()=>this.engine.off(bv.Closing,h));return p})}sendFile(e,t){return $f(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,t),{id:n}})}_sendFile(e,t,n){return $f(this,void 0,void 0,function*(){var i;const o=yield this.streamBytes({streamId:e,totalSize:t.size,name:t.name,mimeType:null!==(i=null==n?void 0:n.mimeType)&&void 0!==i?i:t.type,topic:null==n?void 0:n.topic,destinationIdentities:null==n?void 0:n.destinationIdentities}),r=t.stream().getReader();for(;;){const{done:e,value:t}=yield r.read();if(e)break;yield o.write(t)}return yield o.close(),o.info})}streamBytes(e){return $f(this,void 0,void 0,function*(){var t,n,i,o,r,s;const a=null!==(t=null==e?void 0:e.streamId)&&void 0!==t?t:crypto.randomUUID(),c=null==e?void 0:e.destinationIdentities,l={id:a,mimeType:null!==(n=null==e?void 0:e.mimeType)&&void 0!==n?n:"application/octet-stream",topic:null!==(i=null==e?void 0:e.topic)&&void 0!==i?i:"",timestamp:Date.now(),attributes:null==e?void 0:e.attributes,size:null==e?void 0:e.totalSize,name:null!==(o=null==e?void 0:e.name)&&void 0!==o?o:"unknown",encryptionType:(null===(r=this.engine.e2eeManager)||void 0===r?void 0:r.isDataChannelEncryptionEnabled)?Gp.GCM:Gp.NONE},d=new xm({totalLength:Db(null!==(s=l.size)&&void 0!==s?s:0),mimeType:l.mimeType,streamId:a,topic:l.topic,timestamp:Db(Date.now()),attributes:l.attributes,contentHeader:{case:"byteHeader",value:new Tm({name:l.name})}}),u=new Qp({destinationIdentities:c,value:{case:"streamHeader",value:d}});yield this.engine.sendDataPacket(u,Xp.RELIABLE);let h=0;const p=new Ju,m=this.engine,f=this.log,g=new WritableStream({write(e){return $f(this,void 0,void 0,function*(){const t=yield p.lock();let n=0;try{for(;n<e.byteLength;){const t=e.slice(n,n+15e3);yield m.waitForBufferStatusLow(Xp.RELIABLE);const i=new Qp({destinationIdentities:c,value:{case:"streamChunk",value:new Em({content:t,streamId:a,chunkIndex:Db(h)})}});yield m.sendDataPacket(i,Xp.RELIABLE),h+=1,n+=t.byteLength}}finally{t()}})},close(){return $f(this,void 0,void 0,function*(){const e=new _m({streamId:a}),t=new Qp({destinationIdentities:c,value:{case:"streamTrailer",value:e}});yield m.sendDataPacket(t,Xp.RELIABLE)})},abort(e){f.error("Sink error:",e)}});return new Uk(g,l)})}}class Bk extends $v{constructor(e,t,n,i,o){super(e,n,o),this.sid=t,this.receiver=i}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?kv.Muted:kv.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const t=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",t),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(kv.Ended,this))};e.addEventListener("removetrack",t)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return $f(this,void 0,void 0,function*(){var e;if(null===(e=this.receiver)||void 0===e?void 0:e.getStats)return yield this.receiver.getStats()})}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(),Hy)),"undefined"!=typeof RTCRtpReceiver&&"getSynchronizationSources"in RTCRtpReceiver&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var t;this.timeSyncHandle=requestAnimationFrame(()=>e());const n=null===(t=this.receiver)||void 0===t?void 0:t.getSynchronizationSources()[0];if(n){const{timestamp:e,rtpTimestamp:t}=n;t&&this.rtpTimestamp!==t&&(this.emit(kv.TimeSyncUpdate,{timestamp:e,rtpTimestamp:t}),this.rtpTimestamp=t)}};e()}}class zk extends Bk{constructor(e,t,n,i,o,r){super(e,t,$v.Kind.Audio,n,r),this.monitorReceiver=()=>$f(this,void 0,void 0,function*(){if(!this.receiver)return void(this._currentBitrate=0);const e=yield this.getReceiverStats();e&&this.prevStats&&this.receiver&&(this._currentBitrate=Gy(e,this.prevStats)),this.prevStats=e}),this.audioContext=i,this.webAudioPluginNodes=[],o&&(this.sinkId=o.deviceId)}setVolume(e){var t;for(const n of this.attachedElements)this.audioContext?null===(t=this.gainNode)||void 0===t||t.gain.setTargetAtTime(e,0,.1):n.volume=e;mb()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(mb())return 1;let e=0;return this.attachedElements.forEach(t=>{t.volume>e&&(e=t.volume)}),e}setSinkId(e){return $f(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(t=>{if(cb(t))return t.setSinkId(e)}))})}attach(e){const t=0===this.attachedElements.length;return e?super.attach(e):e=super.attach(),this.sinkId&&cb(e)&&e.setSinkId(this.sinkId).catch(e=>{this.log.error("Failed to set sink id on remote audio track",e,this.logContext)}),this.audioContext&&t&&(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 t;return e?(t=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(t=super.detach(),this.disconnectWebAudio()),t}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,t){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(t.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(e=>{n.connect(e),n=e}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),"running"!==e.state&&e.resume().then(()=>{"running"!==e.state&&this.emit(kv.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(e=>{this.emit(kv.AudioPlaybackFailed,e)})}disconnectWebAudio(){var e,t;null===(e=this.gainNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return $f(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;let e;return(yield this.receiver.getStats()).forEach(t=>{"inbound-rtp"===t.type&&(e={type:"audio",streamId:t.id,timestamp:t.timestamp,jitter:t.jitter,bytesReceived:t.bytesReceived,concealedSamples:t.concealedSamples,concealmentEvents:t.concealmentEvents,silentConcealedSamples:t.silentConcealedSamples,silentConcealmentEvents:t.silentConcealmentEvents,totalAudioEnergy:t.totalAudioEnergy,totalSamplesDuration:t.totalSamplesDuration})}),e})}}class Vk extends Bk{constructor(e,t,n,i,o){super(e,t,$v.Kind.Video,n,o),this.elementInfos=[],this.monitorReceiver=()=>$f(this,void 0,void 0,function*(){if(!this.receiver)return void(this._currentBitrate=0);const e=yield this.getReceiverStats();e&&this.prevStats&&this.receiver&&(this._currentBitrate=Gy(e,this.prevStats)),this.prevStats=e}),this.debouncedHandleResize=Ey(()=>{this.updateDimensions()},100),this.adaptiveStreamSettings=i}get isAdaptiveStream(){return void 0!==this.adaptiveStreamSettings}setStreamState(e){super.setStreamState(e),e===$v.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(t=>{e?Wv(this._mediaStreamTrack,t):qv(this._mediaStreamTrack,t)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&void 0===this.elementInfos.find(t=>t.element===e)){const t=new $k(e);this.observeElementInfo(t)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&void 0===this.elementInfos.find(t=>t===e)?(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)return void this.log.warn("stopObservingElementInfo ignored",this.logContext);const t=this.elementInfos.filter(t=>t===e);for(const n of t)n.stopObserving();this.elementInfos=this.elementInfos.filter(t=>t!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let t=[];if(e)return this.stopObservingElement(e),super.detach(e);t=super.detach();for(const n of t)this.stopObservingElement(n);return t}getDecoderImplementation(){var e;return null===(e=this.prevStats)||void 0===e?void 0:e.decoderImplementation}getReceiverStats(){return $f(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let t,n="",i=new Map;return e.forEach(e=>{"inbound-rtp"===e.type?(n=e.codecId,t={type:"video",streamId:e.id,framesDecoded:e.framesDecoded,framesDropped:e.framesDropped,framesReceived:e.framesReceived,packetsReceived:e.packetsReceived,packetsLost:e.packetsLost,frameWidth:e.frameWidth,frameHeight:e.frameHeight,pliCount:e.pliCount,firCount:e.firCount,nackCount:e.nackCount,jitter:e.jitter,timestamp:e.timestamp,bytesReceived:e.bytesReceived,decoderImplementation:e.decoderImplementation}):"codec"===e.type&&i.set(e.id,e)}),t&&""!==n&&i.get(n)&&(t.mimeType=i.get(n).mimeType),t})}stopObservingElement(e){const t=this.elementInfos.filter(t=>t.element===e);for(const n of t)this.stopObservingElementInfo(n)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return $f(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(e){var t,n;const i=this.elementInfos.reduce((e,t)=>Math.max(e,t.visibilityChangedAt||0),0),o=!(null!==(n=null===(t=this.adaptiveStreamSettings)||void 0===t?void 0:t.pauseVideoInBackground)&&void 0!==n&&!n)&&this.isInBackground,r=this.elementInfos.some(e=>e.pictureInPicture),s=this.elementInfos.some(e=>e.visible)&&!o||r;(this.lastVisible!==s||e)&&(!s&&Date.now()-i<100?Fv.setTimeout(()=>{this.updateVisibility()},100):(this.lastVisible=s,this.emit(kv.VisibilityChanged,s,this)))}updateDimensions(){var e,t;let n=0,i=0;const o=this.getPixelDensity();for(const r of this.elementInfos){const e=r.width()*o,t=r.height()*o;e+t>n+i&&(n=e,i=t)}(null===(e=this.lastDimensions)||void 0===e?void 0:e.width)===n&&(null===(t=this.lastDimensions)||void 0===t?void 0:t.height)===i||(this.lastDimensions={width:n,height:i},this.emit(kv.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const t=null===(e=this.adaptiveStreamSettings)||void 0===e?void 0:e.pixelDensity;return"screen"===t?bb():t||(bb()>2?2:1)}}class $k{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,t){this.onVisibilityChanged=e=>{var t;const{target:n,isIntersecting:i}=e;n===this.element&&(this.isIntersecting=i,this.isPiP=qk(this.element),this.visibilityChangedAt=Date.now(),null===(t=this.handleVisibilityChanged)||void 0===t||t.call(this))},this.onEnterPiP=()=>{var e,t,n;null===(t=null===(e=window.documentPictureInPicture)||void 0===e?void 0:e.window)||void 0===t||t.addEventListener("pagehide",this.onLeavePiP),this.isPiP=qk(this.element),null===(n=this.handleVisibilityChanged)||void 0===n||n.call(this)},this.onLeavePiP=()=>{var e;this.isPiP=qk(this.element),null===(e=this.handleVisibilityChanged)||void 0===e||e.call(this)},this.element=e,this.isIntersecting=null!=t?t:Wk(e),this.isPiP=pb()&&qk(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,t,n;this.isIntersecting=Wk(this.element),this.isPiP=qk(this.element),this.element.handleResize=()=>{var e;null===(e=this.handleResize)||void 0===e||e.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,xb().observe(this.element),Sb().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),null===(e=window.documentPictureInPicture)||void 0===e||e.addEventListener("enter",this.onEnterPiP),null===(n=null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)||void 0===n||n.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,t,n,i,o;null===(e=xb())||void 0===e||e.unobserve(this.element),null===(t=Sb())||void 0===t||t.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),null===(n=window.documentPictureInPicture)||void 0===n||n.removeEventListener("enter",this.onEnterPiP),null===(o=null===(i=window.documentPictureInPicture)||void 0===i?void 0:i.window)||void 0===o||o.removeEventListener("pagehide",this.onLeavePiP)}}function qk(e){var t,n;return document.pictureInPictureElement===e||!!(null===(t=window.documentPictureInPicture)||void 0===t?void 0:t.window)&&Wk(e,null===(n=window.documentPictureInPicture)||void 0===n?void 0:n.window)}function Wk(e,t){const n=t||window;let i=e.offsetTop,o=e.offsetLeft;const r=e.offsetWidth,s=e.offsetHeight,{hidden:a}=e,{display:c}=getComputedStyle(e);for(;e.offsetParent;)i+=(e=e.offsetParent).offsetTop,o+=e.offsetLeft;return i<n.pageYOffset+n.innerHeight&&o<n.pageXOffset+n.innerWidth&&i+s>n.pageYOffset&&o+r>n.pageXOffset&&!a&&"none"!==c}class Hk extends Gf.EventEmitter{constructor(e,t,n,i){var o;super(),this.metadataMuted=!1,this.encryption=Gp.NONE,this.log=Uf,this.handleMuted=()=>{this.emit(kv.Muted)},this.handleUnmuted=()=>{this.emit(kv.Unmuted)},this.log=Ff(null!==(o=null==i?void 0:i.loggerName)&&void 0!==o?o:Af.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=t,this.trackName=n,this.source=$v.Source.Unknown}setTrack(e){this.track&&(this.track.off(kv.Muted,this.handleMuted),this.track.off(kv.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(kv.Muted,this.handleMuted),e.on(kv.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},null===(e=this.loggerContextCb)||void 0===e?void 0:e.call(this)),Yb(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return void 0!==this.track}get isEncrypted(){return this.encryption!==Gp.NONE}get audioTrack(){if(Lb(this.track))return this.track}get videoTrack(){if(jb(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=$v.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===$v.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}))}}(kk=(yk=Hk||(Hk={})).SubscriptionStatus||(yk.SubscriptionStatus={})).Desired="desired",kk.Subscribed="subscribed",kk.Unsubscribed="unsubscribed",(wk=yk.PermissionStatus||(yk.PermissionStatus={})).Allowed="allowed",wk.NotAllowed="not_allowed";class Gk extends Hk{get isUpstreamPaused(){var e;return null===(e=this.track)||void 0===e?void 0:e.isUpstreamPaused}constructor(e,t,n,i){super(e,t.sid,t.name,i),this.track=void 0,this.handleTrackEnded=()=>{this.emit(kv.Ended)},this.handleCpuConstrained=()=>{this.track&&jb(this.track)&&this.emit(kv.CpuConstrained,this.track)},this.updateInfo(t),this.setTrack(n)}setTrack(e){this.track&&(this.track.off(kv.Ended,this.handleTrackEnded),this.track.off(kv.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(kv.Ended,this.handleTrackEnded),e.on(kv.CpuConstrained,this.handleCpuConstrained))}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 $f(this,void 0,void 0,function*(){var e;return null===(e=this.track)||void 0===e?void 0:e.mute()})}unmute(){return $f(this,void 0,void 0,function*(){var e;return null===(e=this.track)||void 0===e?void 0:e.unmute()})}pauseUpstream(){return $f(this,void 0,void 0,function*(){var e;yield null===(e=this.track)||void 0===e?void 0:e.pauseUpstream()})}resumeUpstream(){return $f(this,void 0,void 0,function*(){var e;yield null===(e=this.track)||void 0===e?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(Lb(this.track)){const t=this.track.getSourceTrackSettings(),n=new Set;return t.autoGainControl&&n.add(Fp.TF_AUTO_GAIN_CONTROL),t.echoCancellation&&n.add(Fp.TF_ECHO_CANCELLATION),t.noiseSuppression&&n.add(Fp.TF_NOISE_SUPPRESSION),t.channelCount&&t.channelCount>1&&n.add(Fp.TF_STEREO),(null===(e=this.options)||void 0===e?void 0:e.dtx)||n.add(Fp.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(Fp.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}return[]}}function Zk(e,t){return $f(this,void 0,void 0,function*(){null!=e||(e={});let n=!1;const{audioProcessor:i,videoProcessor:o,optionsWithoutProcessor:r}=Qb(e);let s=r.audio,a=r.video;if(i&&"object"==typeof r.audio&&(r.audio.processor=i),o&&"object"==typeof r.video&&(r.video.processor=o),e.audio&&"object"==typeof r.audio&&"string"==typeof r.audio.deviceId){const e=r.audio.deviceId;r.audio.deviceId={exact:e},n=!0,s=Object.assign(Object.assign({},r.audio),{deviceId:{ideal:e}})}if(r.video&&"object"==typeof r.video&&"string"==typeof r.video.deviceId){const e=r.video.deviceId;r.video.deviceId={exact:e},n=!0,a=Object.assign(Object.assign({},r.video),{deviceId:{ideal:e}})}(!0===r.audio||"object"==typeof r.audio&&!r.audio.deviceId)&&(r.audio={deviceId:"default"}),!0===r.video?r.video={deviceId:"default"}:"object"!=typeof r.video||r.video.deviceId||(r.video.deviceId="default");const c=$b(r,Ly,jy),l=Wb(c),d=navigator.mediaDevices.getUserMedia(l);r.audio&&(ny.userMediaPromiseMap.set("audioinput",d),d.catch(()=>ny.userMediaPromiseMap.delete("audioinput"))),r.video&&(ny.userMediaPromiseMap.set("videoinput",d),d.catch(()=>ny.userMediaPromiseMap.delete("videoinput")));try{const e=yield d;return yield Promise.all(e.getTracks().map(n=>$f(this,void 0,void 0,function*(){const r="audio"===n.kind;let s,a=r?c.audio:c.video;"boolean"!=typeof a&&a||(a={});const d=r?l.audio:l.video;"boolean"!=typeof d&&(s=d);const u=n.getSettings().deviceId;(null==s?void 0:s.deviceId)&&Rb(s.deviceId)!==u?s.deviceId=u:s||(s={deviceId:u});const h=function(e,t,n){switch(e.kind){case"audio":return new Qy(e,t,!1,void 0,n);case"video":return new dk(e,t,!1,n);default:throw new Ev("unsupported track type: ".concat(e.kind))}}(n,s,t);return h.kind===$v.Kind.Video?h.source=$v.Source.Camera:h.kind===$v.Kind.Audio&&(h.source=$v.Source.Microphone),h.mediaStream=e,Lb(h)&&i?yield h.setProcessor(i):jb(h)&&o&&(yield h.setProcessor(o)),h})))}catch(Bx){if(!n)throw Bx;return Zk(Object.assign(Object.assign({},e),{audio:s,video:a}),t)}})}(Sk=Ck||(Ck={})).Excellent="excellent",Sk.Good="good",Sk.Poor="poor",Sk.Lost="lost",Sk.Unknown="unknown";class Jk extends Gf.EventEmitter{get logContext(){var e,t;return Object.assign({},null===(t=null===(e=this.loggerOptions)||void 0===e?void 0:e.loggerContextCb)||void 0===t?void 0:t.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return(null===(e=this.permissions)||void 0===e?void 0:e.agent)||this.kind===Wp.AGENT}get isActive(){var e;return(null===(e=this.participantInfo)||void 0===e?void 0:e.state)===qp.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,t,n,i,o,r){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Wp.STANDARD;var a;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Ck.Unknown,this.log=Uf,this.log=Ff(null!==(a=null==r?void 0:r.loggerName)&&void 0!==a?a:Af.Participant),this.loggerOptions=r,this.setMaxListeners(100),this.sid=e,this.identity=t,this.name=n,this.metadata=i,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=s,this._attributes=null!=o?o:{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,t]of this.trackPublications)if(t.source===e)return t}getTrackPublicationByName(e){for(const[,t]of this.trackPublications)if(t.trackName===e)return t}waitUntilActive(){return this.isActive?Promise.resolve():(this.activeFuture||(this.activeFuture=new Pb,this.once(gv.Active,()=>{var e,t;null===(t=null===(e=this.activeFuture)||void 0===e?void 0:e.resolve)||void 0===t||t.call(e),this.activeFuture=void 0})),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const t=this.getTrackPublication($v.Source.Camera);return!(null===(e=null==t?void 0:t.isMuted)||void 0===e||e)}get isMicrophoneEnabled(){var e;const t=this.getTrackPublication($v.Source.Microphone);return!(null===(e=null==t?void 0:t.isMuted)||void 0===e||e)}get isScreenShareEnabled(){return!!this.getTrackPublication($v.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(1e3*Number.parseInt(this.participantInfo.joinedAt.toString())):new Date}updateInfo(e){var t;return!(this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version||(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===qp.ACTIVE&&(null===(t=this.participantInfo)||void 0===t?void 0:t.state)!==qp.ACTIVE&&this.emit(gv.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,0))}_setMetadata(e){const t=this.metadata!==e,n=this.metadata;this.metadata=e,t&&this.emit(gv.ParticipantMetadataChanged,n)}_setName(e){const t=this.name!==e;this.name=e,t&&this.emit(gv.ParticipantNameChanged,e)}_setAttributes(e){const t=function(e,t){var n;void 0===e&&(e={}),void 0===t&&(t={});const i=[...Object.keys(t),...Object.keys(e)],o={};for(const r of i)e[r]!==t[r]&&(o[r]=null!==(n=t[r])&&void 0!==n?n:"");return o}(this.attributes,e);this._attributes=e,Object.keys(t).length>0&&this.emit(gv.AttributesChanged,t)}setPermissions(e){var t,n,i,o,r,s;const a=this.permissions,c=e.canPublish!==(null===(t=this.permissions)||void 0===t?void 0:t.canPublish)||e.canSubscribe!==(null===(n=this.permissions)||void 0===n?void 0:n.canSubscribe)||e.canPublishData!==(null===(i=this.permissions)||void 0===i?void 0:i.canPublishData)||e.hidden!==(null===(o=this.permissions)||void 0===o?void 0:o.hidden)||e.recorder!==(null===(r=this.permissions)||void 0===r?void 0:r.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((e,t)=>{var n;return e!==(null===(n=this.permissions)||void 0===n?void 0:n.canPublishSources[t])})||e.canSubscribeMetrics!==(null===(s=this.permissions)||void 0===s?void 0:s.canSubscribeMetrics);return this.permissions=e,c&&this.emit(gv.ParticipantPermissionsChanged,a),c}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(gv.IsSpeakingChanged,e))}setConnectionQuality(e){const t=this._connectionQuality;this._connectionQuality=function(e){switch(e){case Dp.EXCELLENT:return Ck.Excellent;case Dp.GOOD:return Ck.Good;case Dp.POOR:return Ck.Poor;case Dp.LOST:return Ck.Lost;default:return Ck.Unknown}}(e),t!==this._connectionQuality&&this.emit(gv.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,t;this.activeFuture&&(null===(t=(e=this.activeFuture).reject)||void 0===t||t.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(t=>Lb(t.track)&&t.track.setAudioContext(e))}addTrackPublication(e){e.on(kv.Muted,()=>{this.emit(gv.TrackMuted,e)}),e.on(kv.Unmuted,()=>{this.emit(gv.TrackUnmuted,e)});const t=e;switch(t.track&&(t.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case $v.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case $v.Kind.Video:this.videoTrackPublications.set(e.trackSid,e)}}}class Kk extends Jk{constructor(e,t,n,i,o,r){super(e,t,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=Gp.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new Pb)},this.handleReconnected=()=>{var e,t;null===(t=null===(e=this.reconnectFuture)||void 0===e?void 0:e.resolve)||void 0===t||t.call(e),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var e,t,n,i,o,r;this.reconnectFuture&&(this.reconnectFuture.promise.catch(e=>this.log.warn(e.message,this.logContext)),null===(t=null===(e=this.reconnectFuture)||void 0===e?void 0:e.reject)||void 0===t||t.call(e,"Got disconnected during reconnection attempt"),this.reconnectFuture=void 0),this.signalConnectedFuture&&(null===(i=(n=this.signalConnectedFuture).reject)||void 0===i||i.call(n,"Got disconnected without signal connected"),this.signalConnectedFuture=void 0),null===(r=null===(o=this.activeAgentFuture)||void 0===o?void 0:o.reject)||void 0===r||r.call(o,"Got disconnected without active agent present"),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=e=>{var t,n;e.participant&&this.updateInfo(e.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new Pb),null===(n=(t=this.signalConnectedFuture).resolve)||void 0===n||n.call(t)},this.handleSignalRequestResponse=e=>{const{requestId:t,reason:n,message:i}=e,o=this.pendingSignalRequests.get(t);o&&(n!==Tf.OK&&o.reject(new Av(i,n)),this.pendingSignalRequests.delete(t))},this.handleDataPacket=e=>{switch(e.value.case){case"rpcResponse":let t=e.value.value,n=null,i=null;"payload"===t.value.case?n=t.value.value:"error"===t.value.case&&(i=$y.fromProto(t.value.value)),this.handleIncomingRpcResponse(t.requestId,n,i);break;case"rpcAck":let o=e.value.value;this.handleIncomingRpcAck(o.requestId)}},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(e=>function(e){var t,n,i;if(!e.participantSid&&!e.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new df({participantIdentity:null!==(t=e.participantIdentity)&&void 0!==t?t:"",participantSid:null!==(n=e.participantSid)&&void 0!==n?n:"",allTracks:null!==(i=e.allowAll)&&void 0!==i&&i,trackSids:e.allowedTrackSids||[]})}(e)))},this.onTrackUnmuted=e=>{this.onTrackMuted(e,e.isUpstreamPaused)},this.onTrackMuted=(e,t)=>{void 0===t&&(t=!0),e.sid?this.engine.updateMuteStatus(e.sid,t):this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),Yb(e)))},this.onTrackUpstreamPaused=e=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),Yb(e))),this.onTrackMuted(e,!0)},this.onTrackUpstreamResumed=e=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),Yb(e))),this.onTrackMuted(e,e.isMuted)},this.onTrackFeatureUpdate=e=>{const t=this.audioTrackPublications.get(e.sid);t?this.engine.client.sendUpdateLocalAudioTrack(t.trackSid,t.getTrackFeatures()):this.log.warn("Could not update local audio track settings, missing publication for track ".concat(e.sid),this.logContext)},this.onTrackCpuConstrained=(e,t)=>{this.log.debug("track cpu constrained",Object.assign(Object.assign({},this.logContext),Yb(t))),this.emit(gv.LocalTrackCpuConstrained,e,t)},this.handleSubscribedQualityUpdate=e=>$f(this,void 0,void 0,function*(){var t,n,i,o,r;if(!(null===(r=this.roomOptions)||void 0===r?void 0:r.dynacast))return;const s=this.videoTrackPublications.get(e.trackSid);if(!s)return void this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:e.trackSid}));if(!s.videoTrack)return;const a=yield s.videoTrack.setPublishingCodecs(e.subscribedCodecs);try{for(var c,l=!0,d=qf(a);!(t=(c=yield d.next()).done);l=!0){o=c.value,l=!1;const e=o;Jv(e)&&(this.log.debug("publish ".concat(e," for ").concat(s.videoTrack.sid),Object.assign(Object.assign({},this.logContext),Yb(s))),yield this.publishAdditionalCodecForTrack(s.videoTrack,e,s.options))}}catch(u){n={error:u}}finally{try{l||t||!(i=d.return)||(yield i.call(d))}finally{if(n)throw n.error}}}),this.handleLocalTrackUnpublished=e=>{const t=this.trackPublications.get(e.trackSid);t?this.unpublishTrack(t.track):this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:e.trackSid}))},this.handleTrackEnded=e=>$f(this,void 0,void 0,function*(){if(e.source===$v.Source.ScreenShare||e.source===$v.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),Yb(e))),this.unpublishTrack(e);else if(e.isUserProvided)yield e.mute();else if(Fb(e)||Ub(e))try{if(pb())try{const t=yield null===navigator||void 0===navigator?void 0:navigator.permissions.query({name:e.source===$v.Source.Camera?"camera":"microphone"});if(t&&"denied"===t.state)throw this.log.warn("user has revoked access to ".concat(e.source),Object.assign(Object.assign({},this.logContext),Yb(e))),t.onchange=()=>{"denied"!==t.state&&(e.isMuted||e.restartTrack(),t.onchange=null)},new Error("GetUserMedia Permission denied")}catch(Bx){}e.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),Yb(e))),Fb(e)?yield e.restartTrack({deviceId:"default"}):yield e.restartTrack())}catch(Bx){this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),Yb(e))),yield e.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=o,this.roomOutgoingDataStreamManager=r}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==Gp.NONE}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setupEngine(e){var t;this.engine=e,this.engine.on(bv.RemoteMute,(e,t)=>{const n=this.trackPublications.get(e);n&&n.track&&(t?n.mute():n.unmute())}),(null===(t=this.signalConnectedFuture)||void 0===t?void 0:t.isResolved)&&(this.signalConnectedFuture=void 0),this.engine.on(bv.Connected,this.handleReconnected).on(bv.SignalConnected,this.handleSignalConnected).on(bv.SignalRestarted,this.handleReconnected).on(bv.SignalResumed,this.handleReconnected).on(bv.Restarting,this.handleReconnecting).on(bv.Resuming,this.handleReconnecting).on(bv.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(bv.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(bv.Closing,this.handleClosing).on(bv.SignalRequestResponse,this.handleSignalRequestResponse).on(bv.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return $f(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return $f(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return $f(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return $f(this,arguments,void 0,function(e){var t=this;let{metadata:n,name:i,attributes:o}=e;return function*(){return new Promise((e,r)=>$f(t,void 0,void 0,function*(){var t,s;try{let a=!1;const c=yield this.engine.client.sendUpdateLocalMetadata(null!==(t=null!=n?n:this.metadata)&&void 0!==t?t:"",null!==(s=null!=i?i:this.name)&&void 0!==s?s:"",o),l=performance.now();for(this.pendingSignalRequests.set(c,{resolve:e,reject:e=>{r(e),a=!0},values:{name:i,metadata:n,attributes:o}});performance.now()-l<5e3&&!a;){if((!i||this.name===i)&&(!n||this.metadata===n)&&(!o||Object.entries(o).every(e=>{let[t,n]=e;return this.attributes[t]===n||""===n&&!this.attributes[t]})))return this.pendingSignalRequests.delete(c),void e();yield ob(50)}r(new Av("Request to update local metadata timed out","TimeoutError"))}catch(Bx){Bx instanceof Error&&r(Bx)}}))}()})}setCameraEnabled(e,t,n){return this.setTrackEnabled($v.Source.Camera,e,t,n)}setMicrophoneEnabled(e,t,n){return this.setTrackEnabled($v.Source.Microphone,e,t,n)}setScreenShareEnabled(e,t,n){return this.setTrackEnabled($v.Source.ScreenShare,e,t,n)}setE2EEEnabled(e){return $f(this,void 0,void 0,function*(){this.encryptionType=e?Gp.GCM:Gp.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,t,n,i){return $f(this,void 0,void 0,function*(){var o,r;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:t})),this.republishPromise&&(yield this.republishPromise);let s=this.getTrackPublication(e);if(t)if(s)yield s.unmute();else{let t;if(this.pendingPublishing.has(e)){const t=yield this.waitForPendingPublicationOfSource(e);return t||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield null==t?void 0:t.unmute(),t}this.pendingPublishing.add(e);try{switch(e){case $v.Source.Camera:t=yield this.createTracks({video:null===(o=n)||void 0===o||o});break;case $v.Source.Microphone:t=yield this.createTracks({audio:null===(r=n)||void 0===r||r});break;case $v.Source.ScreenShare:t=yield this.createScreenTracks(Object.assign({},n));break;default:throw new Ev(e)}}catch(Bx){throw null==t||t.forEach(e=>{e.stop()}),Bx instanceof Error&&this.emit(gv.MediaDevicesError,Bx,Zb(e)),this.pendingPublishing.delete(e),Bx}for(const i of t){const t=Object.assign(Object.assign({},this.roomOptions.publishDefaults),n);e===$v.Source.Microphone&&Lb(i)&&t.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),i.startPreConnectBuffer())}try{const e=[];for(const o of t)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),Yb(o))),e.push(this.publishTrack(o,i));const n=yield Promise.all(e);[s]=n}catch(Bx){throw null==t||t.forEach(e=>{e.stop()}),Bx}finally{this.pendingPublishing.delete(e)}}else if(!(null==s?void 0:s.track)&&this.pendingPublishing.has(e)&&(s=yield this.waitForPendingPublicationOfSource(e),s||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),s&&s.track)if(e===$v.Source.ScreenShare){s=yield this.unpublishTrack(s.track);const e=this.getTrackPublication($v.Source.ScreenShareAudio);e&&e.track&&this.unpublishTrack(e.track)}else yield s.mute();return s})}enableCameraAndMicrophone(){return $f(this,void 0,void 0,function*(){if(!this.pendingPublishing.has($v.Source.Camera)&&!this.pendingPublishing.has($v.Source.Microphone)){this.pendingPublishing.add($v.Source.Camera),this.pendingPublishing.add($v.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(e=>this.publishTrack(e)))}finally{this.pendingPublishing.delete($v.Source.Camera),this.pendingPublishing.delete($v.Source.Microphone)}}})}createTracks(e){return $f(this,void 0,void 0,function*(){var t,n;null!=e||(e={});const i=$b(e,null===(t=this.roomOptions)||void 0===t?void 0:t.audioCaptureDefaults,null===(n=this.roomOptions)||void 0===n?void 0:n.videoCaptureDefaults);try{return(yield Zk(i,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(e=>(Lb(e)&&(this.microphoneError=void 0,e.setAudioContext(this.audioContext),e.source=$v.Source.Microphone,this.emit(gv.AudioStreamAcquired)),jb(e)&&(this.cameraError=void 0,e.source=$v.Source.Camera),e))}catch(o){throw o instanceof Error&&(e.audio&&(this.microphoneError=o),e.video&&(this.cameraError=o)),o}})}createScreenTracks(e){return $f(this,void 0,void 0,function*(){if(void 0===e&&(e={}),void 0===navigator.mediaDevices.getDisplayMedia)throw new xv("getDisplayMedia not supported");void 0!==e.resolution||function(){const e=Nv();return"Safari"===(null==e?void 0:e.name)&&e.version.startsWith("17.")||"iOS"===(null==e?void 0:e.os)&&!!(null==e?void 0:e.osVersion)&&yb(e.osVersion,"17")>=0}()||(e.resolution=nb.h1080fps30.resolution);const t=function(e){var t,n;let i=null===(t=e.video)||void 0===t||t;return e.resolution&&e.resolution.width>0&&e.resolution.height>0&&(i="boolean"==typeof i?{}:i,i=db()?Object.assign(Object.assign({},i),{width:{max:e.resolution.width},height:{max:e.resolution.height},frameRate:e.resolution.frameRate}):Object.assign(Object.assign({},i),{width:{ideal:e.resolution.width},height:{ideal:e.resolution.height},frameRate:e.resolution.frameRate})),{audio:null!==(n=e.audio)&&void 0!==n&&n,video:i,controller:e.controller,selfBrowserSurface:e.selfBrowserSurface,surfaceSwitching:e.surfaceSwitching,systemAudio:e.systemAudio,preferCurrentTab:e.preferCurrentTab}}(e),n=yield navigator.mediaDevices.getDisplayMedia(t),i=n.getVideoTracks();if(0===i.length)throw new Ev("no video track found");const o=new dk(i[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});o.source=$v.Source.ScreenShare,e.contentHint&&(o.mediaStreamTrack.contentHint=e.contentHint);const r=[o];if(n.getAudioTracks().length>0){this.emit(gv.AudioStreamAcquired);const e=new Qy(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});e.source=$v.Source.ScreenShareAudio,r.push(e)}return r})}publishTrack(e,t){return $f(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,t)})}publishOrRepublishTrack(e,t){return $f(this,arguments,void 0,function(e,t){var n=this;let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return function*(){var o,r,s,a;let c,l;if(Fb(e)&&e.setAudioContext(n.audioContext),yield null===(o=n.reconnectFuture)||void 0===o?void 0:o.promise,n.republishPromise&&!i&&(yield n.republishPromise),Nb(e)&&n.pendingPublishPromises.has(e)&&(yield n.pendingPublishPromises.get(e)),e instanceof MediaStreamTrack)c=e.getConstraints();else{let t;switch(c=e.constraints,e.source){case $v.Source.Microphone:t="audioinput";break;case $v.Source.Camera:t="videoinput"}t&&n.activeDeviceMap.has(t)&&(c=Object.assign(Object.assign({},c),{deviceId:n.activeDeviceMap.get(t)}))}if(e instanceof MediaStreamTrack)switch(e.kind){case"audio":e=new Qy(e,c,!0,n.audioContext,{loggerName:n.roomOptions.loggerName,loggerContextCb:()=>n.logContext});break;case"video":e=new dk(e,c,!0,{loggerName:n.roomOptions.loggerName,loggerContextCb:()=>n.logContext});break;default:throw new Ev("unsupported MediaStreamTrack kind ".concat(e.kind))}else e.updateLoggerOptions({loggerName:n.roomOptions.loggerName,loggerContextCb:()=>n.logContext});if(n.trackPublications.forEach(t=>{t.track&&t.track===e&&(l=t)}),l)return n.log.warn("track has already been published, skipping",Object.assign(Object.assign({},n.logContext),Yb(l))),l;const d=Object.assign(Object.assign({},n.roomOptions.publishDefaults),t),u="channelCount"in e.mediaStreamTrack.getSettings()&&2===e.mediaStreamTrack.getSettings().channelCount||2===e.mediaStreamTrack.getConstraints().channelCount,h=null!==(r=d.forceStereo)&&void 0!==r?r:u;h&&(void 0===d.dtx&&n.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},n.logContext),Yb(e))),void 0===d.red&&n.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),null!==(s=d.dtx)&&void 0!==s||(d.dtx=!1),null!==(a=d.red)&&void 0!==a||(d.red=!1)),!function(){const e=Nv(),t="17.2";if(e)return"Safari"!==e.name&&"iOS"!==e.os||!!("iOS"===e.os&&e.osVersion&&yb(e.osVersion,t)>=0)||"Safari"===e.name&&yb(e.version,t)>=0}()&&n.roomOptions.e2ee&&(n.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({},n.logContext)),d.simulcast=!1),d.source&&(e.source=d.source);const p=new Promise((t,i)=>$f(n,void 0,void 0,function*(){try{if(this.engine.client.currentState!==cy.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:Yb(e)}));const n=setTimeout(()=>{i(new Rv("publishing rejected as engine not connected within timeout",408))},15e3);yield this.waitUntilEngineConnected(),clearTimeout(n);const o=yield this.publish(e,d,h);t(o)}else try{const n=yield this.publish(e,d,h);t(n)}catch(Bx){i(Bx)}}catch(Bx){i(Bx)}}));n.pendingPublishPromises.set(e,p);try{return yield p}catch(Bx){throw Bx}finally{n.pendingPublishPromises.delete(e)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new Pb),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),Yb(e))),!1;const{canPublish:t,canPublishSources:n}=this.permissions;return!(!t||0!==n.length&&!n.map(e=>function(e){switch(e){case Mp.CAMERA:return $v.Source.Camera;case Mp.MICROPHONE:return $v.Source.Microphone;case Mp.SCREEN_SHARE:return $v.Source.ScreenShare;case Mp.SCREEN_SHARE_AUDIO:return $v.Source.ScreenShareAudio;default:return $v.Source.Unknown}}(e)).includes(e.source))||(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),Yb(e))),!1)}publish(e,t,n){return $f(this,void 0,void 0,function*(){var i,o,r,s,a,c,l,d,u,h;if(!this.hasPermissionsToPublish(e))throw new Rv("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(t=>Nb(e)&&t.source===e.source)&&e.source!==$v.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),Yb(e))),t.stopMicTrackOnMute&&Lb(e)&&(e.stopOnMute=!0),e.source===$v.Source.ScreenShare&&lb()&&(t.simulcast=!1),"av1"!==t.videoCodec||function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(db()||lb())return!1;const e=RTCRtpSender.getCapabilities("video");let t=!1;if(e)for(const n of e.codecs)if("video/av1"===n.mimeType.toLowerCase()){t=!0;break}return t}()||(t.videoCodec=void 0),"vp9"!==t.videoCodec||function(){if(!("getCapabilities"in RTCRtpSender))return!1;if(lb())return!1;if(db()){const e=Nv();if((null==e?void 0:e.version)&&yb(e.version,"16")<0)return!1;if("iOS"===(null==e?void 0:e.os)&&(null==e?void 0:e.osVersion)&&yb(e.osVersion,"16")<0)return!1}const e=RTCRtpSender.getCapabilities("video");let t=!1;if(e)for(const n of e.codecs)if("video/vp9"===n.mimeType.toLowerCase()){t=!0;break}return t}()||(t.videoCodec=void 0),void 0===t.videoCodec&&(t.videoCodec=Dy),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(e=>t.videoCodec===Jb(e.mime))||(t.videoCodec=Jb(this.enabledPublishVideoCodecs[0].mime)));const p=t.videoCodec;e.on(kv.Muted,this.onTrackMuted),e.on(kv.Unmuted,this.onTrackUnmuted),e.on(kv.Ended,this.handleTrackEnded),e.on(kv.UpstreamPaused,this.onTrackUpstreamPaused),e.on(kv.UpstreamResumed,this.onTrackUpstreamResumed),e.on(kv.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const m=[],f=!(null===(i=t.dtx)||void 0===i||i),g=e.getSourceTrackSettings();g.autoGainControl&&m.push(Fp.TF_AUTO_GAIN_CONTROL),g.echoCancellation&&m.push(Fp.TF_ECHO_CANCELLATION),g.noiseSuppression&&m.push(Fp.TF_NOISE_SUPPRESSION),g.channelCount&&g.channelCount>1&&m.push(Fp.TF_STEREO),f&&m.push(Fp.TF_NO_DTX),Fb(e)&&e.hasPreConnectBuffer&&m.push(Fp.TF_PRECONNECT_BUFFER);const v=new Nm({cid:e.mediaStreamTrack.id,name:t.name,type:$v.kindToProto(e.kind),muted:e.isMuted,source:$v.sourceToProto(e.source),disableDtx:f,encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(null===(o=t.red)||void 0===o||o),stream:null==t?void 0:t.stream,backupCodecPolicy:null==t?void 0:t.backupCodecPolicy,audioFeatures:m});let b;if(e.kind===$v.Kind.Video){let n={width:0,height:0};try{n=yield e.waitForDimensions()}catch(Bx){const i=null!==(s=null===(r=this.roomOptions.videoCaptureDefaults)||void 0===r?void 0:r.resolution)&&void 0!==s?s:eb.h720.resolution;n={width:i.width,height:i.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),Yb(e)),{dims:n}))}v.width=n.width,v.height=n.height,Ub(e)&&(ab(p)&&(e.source===$v.Source.ScreenShare&&(t.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),Yb(e))))),t.scalabilityMode=null!==(a=t.scalabilityMode)&&void 0!==a?a:"L3T3_KEY"),v.simulcastCodecs=[new Dm({codec:p,cid:e.mediaStreamTrack.id})],!0===t.backupCodec&&(t.backupCodec={codec:Dy}),t.backupCodec&&p!==t.backupCodec.codec&&v.encryption===Gp.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),v.simulcastCodecs.push(new Dm({codec:t.backupCodec.codec,cid:""})))),b=rk(e.source===$v.Source.ScreenShare,v.width,v.height,t),v.layers=pk(v.width,v.height,b,ab(t.videoCodec))}else e.kind===$v.Kind.Audio&&(b=[{maxBitrate:null===(c=t.audioPreset)||void 0===c?void 0:c.maxBitrate,priority:null!==(d=null===(l=t.audioPreset)||void 0===l?void 0:l.priority)&&void 0!==d?d:"high",networkPriority:null!==(h=null===(u=t.audioPreset)||void 0===u?void 0:u.priority)&&void 0!==h?h:"high"}]);if(!this.engine||this.engine.isClosed)throw new Iv("cannot publish track when not connected");const y=()=>$f(this,void 0,void 0,function*(){var n,i,o;if(!this.engine.pcManager)throw new Iv("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,t,b),this.emit(gv.LocalSenderCreated,e.sender,e),Ub(e)&&(null!==(n=t.degradationPreference)&&void 0!==n||(t.degradationPreference=function(e){return e.source===$v.Source.ScreenShare||e.constraints.height&&Rb(e.constraints.height)>=1080?"maintain-resolution":"balanced"}(e)),e.setDegradationPreference(t.degradationPreference)),b)if(lb()&&e.kind===$v.Kind.Audio){let t;for(const n of this.engine.pcManager.publisher.getTransceivers())if(n.sender===e.sender){t=n;break}t&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:t,codec:"opus",maxbr:(null===(i=b[0])||void 0===i?void 0:i.maxBitrate)?b[0].maxBitrate/1e3:0})}else e.codec&&ab(e.codec)&&(null===(o=b[0])||void 0===o?void 0:o.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:v.cid,codec:e.codec,maxbr:b[0].maxBitrate/1e3});yield this.engine.negotiate()});let k;const w=new Promise((t,n)=>$f(this,void 0,void 0,function*(){var i;try{k=yield this.engine.addTrack(v),t(k)}catch(o){e.sender&&(null===(i=this.engine.pcManager)||void 0===i?void 0:i.publisher)&&(this.engine.pcManager.publisher.removeTrack(e.sender),yield this.engine.negotiate().catch(t=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),Yb(e)),{error:t}))})),n(o)}}));if(this.enabledPublishVideoCodecs.length>0){const e=yield Promise.all([w,y()]);k=e[0]}else{let n;if(k=yield w,k.codecs.forEach(e=>{void 0===n&&(n=e.mimeType)}),n&&e.kind===$v.Kind.Video){const i=Jb(n);i!==p&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),Yb(e)),{codec:i})),t.videoCodec=i,b=rk(e.source===$v.Source.ScreenShare,v.width,v.height,t))}yield y()}const C=new Gk(e.kind,k,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(C.on(kv.CpuConstrained,e=>this.onTrackCpuConstrained(e,C)),C.options=t,e.sid=k.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:b,trackInfo:k})),Ub(e)?e.startMonitor(this.engine.client):Fb(e)&&e.startMonitor(),this.addTrackPublication(C),this.emit(gv.LocalTrackPublished,C),Fb(e)&&k.audioFeatures.includes(Fp.TF_PRECONNECT_BUFFER)){const t=e.getPreConnectBuffer(),n=e.getPreConnectBufferMimeType();this.on(gv.LocalTrackSubscribed,t=>{if(t.trackSid===k.sid){if(!e.hasPreConnectBuffer)return void this.log.warn("subscribe event came to late, buffer already closed",this.logContext);this.log.debug("finished recording preconnect buffer",Object.assign(Object.assign({},this.logContext),Yb(e))),e.stopPreConnectBuffer()}}),t&&new Promise((i,o)=>$f(this,void 0,void 0,function*(){var r,s,a,c,l,d;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),Yb(e)));const f=setTimeout(()=>{o(new Error("agent not active within 10 seconds"))},1e4),v=yield this.waitUntilActiveAgentPresent();clearTimeout(f),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),Yb(e)));const b=yield this.streamBytes({name:"preconnect-buffer",mimeType:n,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[v.identity],attributes:{trackId:C.trackSid,sampleRate:String(null!==(l=g.sampleRate)&&void 0!==l?l:"48000"),channels:String(null!==(d=g.channelCount)&&void 0!==d?d:"1")}});try{for(var u,h=!0,p=qf(t);!(r=(u=yield p.next()).done);h=!0){c=u.value,h=!1;const e=c;yield b.write(e)}}catch(m){s={error:m}}finally{try{h||r||!(a=p.return)||(yield a.call(p))}finally{if(s)throw s.error}}yield b.close(),i()}catch(Bx){o(Bx)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),Yb(e)))}).catch(t=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),Yb(e)),{error:t}))})}return C})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,t,n){return $f(this,void 0,void 0,function*(){var i;if(this.encryptionType!==Gp.NONE)return;let o;if(this.trackPublications.forEach(t=>{t.track&&t.track===e&&(o=t)}),!o)throw new Ev("track is not published");if(!Ub(e))throw new Ev("track is not a video track");const r=Object.assign(Object.assign({},null===(i=this.roomOptions)||void 0===i?void 0:i.publishDefaults),n),s=function(e,t,n){var i,o,r,s;if(!n.backupCodec||!0===n.backupCodec||n.backupCodec.codec===n.videoCodec)return;t!==n.backupCodec.codec&&Uf.warn("requested a different codec than specified as backup",{serverRequested:t,backup:n.backupCodec.codec}),n.videoCodec=t,n.videoEncoding=n.backupCodec.encoding;const a=e.mediaStreamTrack.getSettings(),c=null!==(i=a.width)&&void 0!==i?i:null===(o=e.dimensions)||void 0===o?void 0:o.width,l=null!==(r=a.height)&&void 0!==r?r:null===(s=e.dimensions)||void 0===s?void 0:s.height;return e.source===$v.Source.ScreenShare&&n.simulcast&&(n.simulcast=!1),rk(e.source===$v.Source.ScreenShare,c,l,n)}(e,t,r);if(!s)return void this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),Yb(e)));const a=e.addSimulcastTrack(t,s);if(!a)return;const c=new Nm({cid:a.mediaStreamTrack.id,type:$v.kindToProto(e.kind),muted:e.isMuted,source:$v.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:r.videoCodec,cid:a.mediaStreamTrack.id}]});if(c.layers=pk(c.width,c.height,s),!this.engine||this.engine.isClosed)throw new Iv("cannot publish track when not connected");const l=(yield Promise.all([this.engine.addTrack(c),(()=>$f(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,a,r,s),yield this.engine.negotiate()}))()]))[0];this.log.debug("published ".concat(t," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:s,trackInfo:l}))})}unpublishTrack(e,t){return $f(this,void 0,void 0,function*(){var n,i;if(Nb(e)){const t=this.pendingPublishPromises.get(e);t&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),Yb(e))),yield t)}const o=this.getPublicationForTrack(e),r=o?Yb(o):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),r)),!o||!o.track)return void this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),r));(e=o.track).off(kv.Muted,this.onTrackMuted),e.off(kv.Unmuted,this.onTrackUnmuted),e.off(kv.Ended,this.handleTrackEnded),e.off(kv.UpstreamPaused,this.onTrackUpstreamPaused),e.off(kv.UpstreamResumed,this.onTrackUpstreamResumed),e.off(kv.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),void 0===t&&(t=null===(i=null===(n=this.roomOptions)||void 0===n?void 0:n.stopLocalTrackOnUnpublish)||void 0===i||i),t?e.stop():e.stopMonitor();let s=!1;const a=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<By.FAILED&&a)try{for(const e of this.engine.pcManager.publisher.getTransceivers())e.sender===a&&(e.direction="inactive",s=!0);if(this.engine.removeTrack(a)&&(s=!0),Ub(e)){for(const[,t]of e.simulcastCodecs)t.sender&&(this.engine.removeTrack(t.sender)&&(s=!0),t.sender=void 0);e.simulcastCodecs.clear()}}catch(Bx){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),r),{error:Bx}))}switch(this.trackPublications.delete(o.trackSid),o.kind){case $v.Kind.Audio:this.audioTrackPublications.delete(o.trackSid);break;case $v.Kind.Video:this.videoTrackPublications.delete(o.trackSid)}return this.emit(gv.LocalTrackUnpublished,o),o.setTrack(void 0),s&&(yield this.engine.negotiate()),o})}unpublishTracks(e){return $f(this,void 0,void 0,function*(){return(yield Promise.all(e.map(e=>this.unpublishTrack(e)))).filter(e=>!!e)})}republishAllTracks(e){return $f(this,arguments,void 0,function(e){var t=this;let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return function*(){t.republishPromise&&(yield t.republishPromise),t.republishPromise=new Promise((i,o)=>$f(t,void 0,void 0,function*(){try{const t=[];this.trackPublications.forEach(n=>{n.track&&(e&&(n.options=Object.assign(Object.assign({},n.options),e)),t.push(n))}),yield Promise.all(t.map(e=>$f(this,void 0,void 0,function*(){const t=e.track;yield this.unpublishTrack(t,!1),!n||t.isMuted||t.source===$v.Source.ScreenShare||t.source===$v.Source.ScreenShareAudio||!Fb(t)&&!Ub(t)||t.isUserProvided||(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:e.trackSid})),yield t.restartTrack()),yield this.publishOrRepublishTrack(t,e.options,!0)}))),i()}catch(t){o(t)}finally{this.republishPromise=void 0}})),yield t.republishPromise}()})}publishData(e){return $f(this,arguments,void 0,function(e){var t=this;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function*(){const i=n.reliable?Xp.RELIABLE:Xp.LOSSY,o=n.destinationIdentities,r=n.topic;let s=new om({participantIdentity:t.identity,payload:e,destinationIdentities:o,topic:r});const a=new Qp({kind:i,value:{case:"user",value:s}});yield t.engine.sendDataPacket(a,i)}()})}publishDtmf(e,t){return $f(this,void 0,void 0,function*(){const n=new Qp({kind:Xp.RELIABLE,value:{case:"sipDtmf",value:new rm({code:e,digit:t})}});yield this.engine.sendDataPacket(n,Xp.RELIABLE)})}sendChatMessage(e,t){return $f(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:null==t?void 0:t.attachments},i=new Qp({value:{case:"chatMessage",value:new cm(Object.assign(Object.assign({},n),{timestamp:fh.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(i,Xp.RELIABLE),this.emit(gv.ChatMessage,n),n})}editChatMessage(e,t){return $f(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},t),{message:e,editTimestamp:Date.now()}),i=new Qp({value:{case:"chatMessage",value:new cm(Object.assign(Object.assign({},n),{timestamp:fh.parse(n.timestamp),editTimestamp:fh.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(i,Xp.RELIABLE),this.emit(gv.ChatMessage,n),n})}sendText(e,t){return $f(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,t)})}streamText(e){return $f(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,t){return $f(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,t)})}streamBytes(e){return $f(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(e)})}performRpc(e){return $f(this,arguments,void 0,function(e){var t=this;let{destinationIdentity:n,method:i,payload:o,responseTimeout:r=1e4}=e;return function*(){return new Promise((e,s)=>$f(t,void 0,void 0,function*(){var t,a,c,l;if(qy(o)>15360)return void s($y.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));if((null===(a=null===(t=this.engine.latestJoinResponse)||void 0===t?void 0:t.serverInfo)||void 0===a?void 0:a.version)&&yb(null===(l=null===(c=this.engine.latestJoinResponse)||void 0===c?void 0:c.serverInfo)||void 0===l?void 0:l.version,"1.8.0")<0)return void s($y.builtIn("UNSUPPORTED_SERVER"));const d=crypto.randomUUID();yield this.publishRpcRequest(n,d,i,o,r-2e3);const u=setTimeout(()=>{this.pendingAcks.delete(d),s($y.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(d),clearTimeout(h)},2e3);this.pendingAcks.set(d,{resolve:()=>{clearTimeout(u)},participantIdentity:n});const h=setTimeout(()=>{this.pendingResponses.delete(d),s($y.builtIn("RESPONSE_TIMEOUT"))},r);this.pendingResponses.set(d,{resolve:(t,n)=>{clearTimeout(h),this.pendingAcks.has(d)&&(this.pendingAcks.delete(d),clearTimeout(u)),n?s(n):e(null!=t?t:"")},participantIdentity:n})}))}()})}registerRpcMethod(e,t){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,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.participantTrackPermissions=t,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const t=this.pendingAcks.get(e);t&&(t.resolve(),this.pendingAcks.delete(e))}handleIncomingRpcResponse(e,t,n){const i=this.pendingResponses.get(e);i&&(i.resolve(t,n),this.pendingResponses.delete(e))}publishRpcRequest(e,t,n,i,o){return $f(this,void 0,void 0,function*(){const r=new Qp({destinationIdentities:[e],kind:Xp.RELIABLE,value:{case:"rpcRequest",value:new lm({id:t,method:n,payload:i,responseTimeoutMs:o,version:1})}});yield this.engine.sendDataPacket(r,Xp.RELIABLE)})}handleParticipantDisconnected(e){for(const[t,{participantIdentity:n}]of this.pendingAcks)n===e&&this.pendingAcks.delete(t);for(const[t,{participantIdentity:n,resolve:i}]of this.pendingResponses)n===e&&(i(null,$y.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(t))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(e=>"video"===e.mime.split("/")[0].toLowerCase())}updateInfo(e){return!!super.updateInfo(e)&&(e.tracks.forEach(e=>{var t,n;const i=this.trackPublications.get(e.sid);if(i){const o=i.isMuted||null!==(n=null===(t=i.track)||void 0===t?void 0:t.isUpstreamPaused)&&void 0!==n&&n;o!==e.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),Yb(i)),{mutedOnServer:o})),this.engine.client.sendMuteTrack(e.sid,o))}}),!0)}setActiveAgent(e){var t,n,i,o;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?null===(n=null===(t=this.activeAgentFuture)||void 0===t?void 0:t.resolve)||void 0===n||n.call(t,e):null===(o=null===(i=this.activeAgentFuture)||void 0===i?void 0:i.reject)||void 0===o||o.call(i,"Agent disconnected"),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new Pb),this.activeAgentFuture.promise)}getPublicationForTrack(e){let t;return this.trackPublications.forEach(n=>{const i=n.track;i&&(e instanceof MediaStreamTrack?(Fb(i)||Ub(i))&&i.mediaStreamTrack===e&&(t=n):e===i&&(t=n))}),t}waitForPendingPublicationOfSource(e){return $f(this,void 0,void 0,function*(){const t=Date.now();for(;Date.now()<t+1e4;){const t=Array.from(this.pendingPublishPromises.entries()).find(t=>{let[n]=t;return n.source===e});if(t)return t[1];yield ob(20)}})}}class Yk extends Hk{constructor(e,t,n,i){super(e,t.sid,t.name,i),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=e=>{this.setTrack(void 0),this.emit(kv.Ended,e)},this.handleVisibilityChange=e=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(e),this.logContext),this.visible=e,this.emitTrackUpdate()},this.handleVideoDimensionsChange=e=>{this.log.debug("adaptivestream video dimensions ".concat(e.width,"x").concat(e.height),this.logContext),this.videoDimensionsAdaptiveStream=e,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(t)}setSubscribed(e){const t=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const i=new qm({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new pm({participantSid:"",trackSids:[this.trackSid]})]});this.emit(kv.UpdateSubscription,i),this.emitSubscriptionUpdateIfChanged(t),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return!1===this.subscribed?Hk.SubscriptionStatus.Unsubscribed:super.isSubscribed?Hk.SubscriptionStatus.Subscribed:Hk.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Hk.PermissionStatus.Allowed:Hk.PermissionStatus.NotAllowed}get isSubscribed(){return!1!==this.subscribed&&super.isSubscribed}get isDesired(){return!1!==this.subscribed}get isEnabled(){return void 0!==this.requestedDisabled?!this.requestedDisabled:!this.isAdaptiveStream||this.visible}get isLocal(){return!1}setEnabled(e){this.isManualOperationAllowed()&&this.requestedDisabled!==!e&&(this.requestedDisabled=!e,this.emitTrackUpdate())}setVideoQuality(e){this.isManualOperationAllowed()&&this.requestedMaxQuality!==e&&(this.requestedMaxQuality=e,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var t,n;this.isManualOperationAllowed()&&((null===(t=this.requestedVideoDimensions)||void 0===t?void 0:t.width)===e.width&&(null===(n=this.requestedVideoDimensions)||void 0===n?void 0:n.height)===e.height||(Vb(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&Vb(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){var e;return null!==(e=this.requestedMaxQuality)&&void 0!==e?e:zv.HIGH}setTrack(e){const t=this.subscriptionStatus,n=this.permissionStatus,i=this.track;i!==e&&(i&&(i.off(kv.VideoDimensionsChanged,this.handleVideoDimensionsChange),i.off(kv.VisibilityChanged,this.handleVisibilityChange),i.off(kv.Ended,this.handleEnded),i.detach(),i.stopMonitor(),this.emit(kv.Unsubscribed,i)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(kv.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(kv.VisibilityChanged,this.handleVisibilityChange),e.on(kv.Ended,this.handleEnded),this.emit(kv.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t))}setAllowed(e){const t=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(t)}setSubscriptionError(e){this.emit(kv.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const t=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):t!==e.muted&&this.emit(e.muted?kv.Muted:kv.Unmuted)}emitSubscriptionUpdateIfChanged(e){const t=this.subscriptionStatus;e!==t&&this.emit(kv.SubscriptionStatusChanged,t,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(kv.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return!!this.isDesired||(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return Vb(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new Wm({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===$v.Kind.Video){let o=this.requestedVideoDimensions;if(void 0!==this.videoDimensionsAdaptiveStream)if(o)Xb(this.videoDimensionsAdaptiveStream,o)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),o=this.videoDimensionsAdaptiveStream);else if(void 0!==this.requestedMaxQuality&&this.trackInfo){const e=(t=this.trackInfo,n=this.requestedMaxQuality,null===(i=t.layers)||void 0===i?void 0:i.find(e=>e.quality===n));e&&Xb(this.videoDimensionsAdaptiveStream,e)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),o=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),o=this.videoDimensionsAdaptiveStream;o?(e.width=Math.ceil(o.width),e.height=Math.ceil(o.height)):void 0!==this.requestedMaxQuality?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),e.quality=this.requestedMaxQuality):(this.log.debug("using default quality",Object.assign(Object.assign({},this.logContext),{quality:zv.HIGH})),e.quality=zv.HIGH)}var t,n,i;this.emit(kv.UpdateSettings,e)}}class Qk extends Jk{static fromParticipantInfo(e,t,n){return new Qk(e,t.sid,t.identity,t.name,t.metadata,t.attributes,n,t.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,t,n,i,o,r,s){super(t,n||"",i,o,r,s,arguments.length>7&&void 0!==arguments[7]?arguments[7]:Wp.STANDARD),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(kv.UpdateSettings,t=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),Yb(e)),{settings:t})),this.signalClient.sendUpdateTrackSettings(t)}),e.on(kv.UpdateSubscription,e=>{e.participantTracks.forEach(e=>{e.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(e)}),e.on(kv.SubscriptionPermissionChanged,t=>{this.emit(gv.TrackSubscriptionPermissionChanged,e,t)}),e.on(kv.SubscriptionStatusChanged,t=>{this.emit(gv.TrackSubscriptionStatusChanged,e,t)}),e.on(kv.Subscribed,t=>{this.emit(gv.TrackSubscribed,t,e)}),e.on(kv.Unsubscribed,t=>{this.emit(gv.TrackUnsubscribed,t,e)}),e.on(kv.SubscriptionFailed,t=>{this.emit(gv.TrackSubscriptionFailed,e.trackSid,t)})}getTrackPublication(e){const t=super.getTrackPublication(e);if(t)return t}getTrackPublicationByName(e){const t=super.getTrackPublicationByName(e);if(t)return t}setVolume(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$v.Source.Microphone;this.volumeMap.set(t,e);const n=this.getTrackPublication(t);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$v.Source.Microphone;const t=this.getTrackPublication(e);return t&&t.track?t.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,t,n,i,o,r){let s,a=this.getTrackPublicationBySid(t);return a||t.startsWith("TR")||this.trackPublications.forEach(t=>{a||e.kind!==t.kind.toString()||(a=t)}),a?"ended"===e.readyState?(this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),Yb(a))),void this.emit(gv.TrackSubscriptionFailed,t)):(s="video"===e.kind?new Vk(e,t,i,o):new zk(e,t,i,this.audioContext,this.audioOutput),s.source=a.source,s.isMuted=a.isMuted,s.setMediaStream(n),s.start(),a.setTrack(s),this.volumeMap.has(a.source)&&Bb(s)&&Lb(s)&&s.setVolume(this.volumeMap.get(a.source)),a):0===r?(this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:t})),void this.emit(gv.TrackSubscriptionFailed,t)):(void 0===r&&(r=20),void setTimeout(()=>{this.addSubscribedMediaTrack(e,t,n,i,o,r-1)},150))}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const t=new Map,n=new Map;return e.tracks.forEach(e=>{var i,o;let r=this.getTrackPublicationBySid(e.sid);if(r)r.updateInfo(e);else{const t=$v.kindFromProto(e.type);if(!t)return;r=new Yk(t,e,null===(i=this.signalClient.connectOptions)||void 0===i?void 0:i.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:null===(o=this.loggerOptions)||void 0===o?void 0:o.loggerName}),r.updateInfo(e),n.set(e.sid,r);const s=Array.from(this.trackPublications.values()).find(e=>e.source===(null==r?void 0:r.source));s&&r.source!==$v.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(r.source),Object.assign(Object.assign({},this.logContext),{oldTrack:Yb(s),newTrack:Yb(r)})),this.addTrackPublication(r)}t.set(e.sid,r)}),this.trackPublications.forEach(e=>{t.has(e.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),Yb(e))),this.unpublishTrack(e.trackSid,!0))}),n.forEach(e=>{this.emit(gv.TrackPublished,e)}),!0}unpublishTrack(e,t){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 $v.Kind.Audio:this.audioTrackPublications.delete(e);break;case $v.Kind.Video:this.videoTrackPublications.delete(e)}t&&this.emit(gv.TrackUnpublished,n)}setAudioOutput(e){return $f(this,void 0,void 0,function*(){this.audioOutput=e;const t=[];this.audioTrackPublications.forEach(n=>{var i;Lb(n.track)&&Bb(n.track)&&t.push(n.track.setSinkId(null!==(i=e.deviceId)&&void 0!==i?i:"default"))}),yield Promise.all(t)})}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;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)}}(xk=Tk||(Tk={})).Disconnected="disconnected",xk.Connecting="connecting",xk.Connected="connected",xk.Reconnecting="reconnecting",xk.SignalReconnecting="signalReconnecting";class Xk extends Gf.EventEmitter{get hasE2EESetup(){return void 0!==this.e2eeManager}constructor(e){var t,n,i,o;if(super(),t=this,this.state=Tk.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=Uf,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(e,t,n)=>$f(this,void 0,void 0,function*(){var i;if("undefined"==typeof RTCPeerConnection||!rb()&&!sb())throw mb()?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 o=yield this.disconnectLock.lock();if(this.state===Tk.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),o(),Promise.resolve();if(this.connectFuture)return o(),this.connectFuture.promise;this.setAndEmitConnectionState(Tk.Connecting),(null===(i=this.regionUrlProvider)||void 0===i?void 0:i.getServerUrl().toString())!==e&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),fb(new URL(e))&&(void 0===this.regionUrlProvider?this.regionUrlProvider=new Ak(e,t):this.regionUrlProvider.updateToken(t),this.regionUrlProvider.fetchRegionSettings().then(e=>{var t;null===(t=this.regionUrlProvider)||void 0===t||t.setServerReportedRegions(e)}).catch(e=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:e}))}));const r=(i,s,a)=>$f(this,void 0,void 0,function*(){var c,l;this.abortController&&this.abortController.abort();const d=new AbortController;this.abortController=d,null==o||o();try{yield this.attemptConnection(null!=a?a:e,t,n,d),this.abortController=void 0,i()}catch(Bx){if(this.regionUrlProvider&&Bx instanceof Tv&&Bx.reason!==sv.Cancelled&&Bx.reason!==sv.NotAllowed){let t=null;try{t=yield this.regionUrlProvider.getNextBestRegionUrl(null===(c=this.abortController)||void 0===c?void 0:c.signal)}catch(u){if(u instanceof Tv&&(401===u.status||u.reason===sv.Cancelled))return this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),void s(u)}t&&!(null===(l=this.abortController)||void 0===l?void 0:l.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(Bx.message,". Retrying with another region: ").concat(t),this.logContext),this.recreateEngine(),yield r(i,s,t)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Mb(Bx)),s(Bx))}else{let t=Lp.UNKNOWN_REASON;Bx instanceof Tv&&(t=Mb(Bx)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,t),s(Bx)}}}),s=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new Pb((e,t)=>{r(e,t,s)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(e,t,n,i,o,r)=>$f(this,void 0,void 0,function*(){var s,a,c;const l=yield n.join(e,t,{autoSubscribe:i.autoSubscribe,adaptiveStream:"object"==typeof o.adaptiveStream||o.adaptiveStream,maxRetries:i.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:i.websocketTimeout},r.signal);let d=l.serverInfo;if(d||(d={version:l.serverVersion,region:l.serverRegion}),this.serverInfo=d,this.log.debug("connected to Livekit Server ".concat(Object.entries(d).map(e=>{let[t,n]=e;return"".concat(t,": ").concat(n)}).join(", ")),{room:null===(s=l.room)||void 0===s?void 0:s.name,roomSid:null===(a=l.room)||void 0===a?void 0:a.sid,identity:null===(c=l.participant)||void 0===c?void 0:c.identity}),!d.version)throw new _v("unknown server version");return"0.15.1"===d.version&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),o.dynacast=!1),l}),this.applyJoinResponse=e=>{const t=e.participant;if(this.localParticipant.sid=t.sid,this.localParticipant.identity=t.identity,this.localParticipant.setEnabledPublishCodecs(e.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(e.sifTrailer)}catch(Bx){this.log.error(Bx instanceof Error?Bx.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:Bx}))}this.handleParticipantUpdates([t,...e.otherParticipants]),e.room&&this.handleRoomUpdate(e.room)},this.attemptConnection=(e,t,n,i)=>$f(this,void 0,void 0,function*(){var o,r;this.state===Tk.Reconnecting||this.isResuming||(null===(o=this.engine)||void 0===o?void 0:o.pendingReconnect)?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),(null===(r=this.regionUrlProvider)||void 0===r?void 0:r.isCloud())&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},Fy),n),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const n=yield this.connectSignal(e,t,this.engine,this.connOptions,this.options,i);this.applyJoinResponse(n),this.setupLocalParticipantEvents(),this.emit(mv.SignalConnected)}catch(s){yield this.engine.close(),this.recreateEngine();const e=new Tv("could not establish signal connection",sv.ServerUnreachable);throw s instanceof Error&&(e.message="".concat(e.message,": ").concat(s.message)),s instanceof Tv&&(e.reason=s.reason,e.status=s.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:s})),e}if(i.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),new Tv("Connection attempt aborted",sv.Cancelled);try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,i)}catch(Bx){throw yield this.engine.close(),this.recreateEngine(),Bx}pb()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),pb()&&document.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Tk.Connected),this.emit(mv.Connected),this.registerConnectionReconcile()}),this.disconnect=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return $f(t,[...n],void 0,function(){var e=this;let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return function*(){var n,i,o,r;const s=yield e.disconnectLock.lock();try{if(e.state===Tk.Disconnected)return void e.log.debug("already disconnected",e.logContext);e.log.info("disconnect from room",Object.assign({},e.logContext)),(e.state===Tk.Connecting||e.state===Tk.Reconnecting||e.isResuming)&&(e.log.warn("abort connection attempt",e.logContext),null===(n=e.abortController)||void 0===n||n.abort(),null===(o=null===(i=e.connectFuture)||void 0===i?void 0:i.reject)||void 0===o||o.call(i,new Tv("Client initiated disconnect",sv.Cancelled)),e.connectFuture=void 0),(null===(r=e.engine)||void 0===r?void 0:r.client.isDisconnected)||(yield e.engine.client.sendLeave()),e.engine&&(yield e.engine.close()),e.handleDisconnect(t,Lp.CLIENT_INITIATED),e.engine=void 0}finally{s()}}()})},this.onPageLeave=()=>$f(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>$f(this,void 0,void 0,function*(){const e=[],t=Nv();if(t&&"iOS"===t.os){const t="livekit-dummy-audio-el";let n=document.getElementById(t);if(!n){n=document.createElement("audio"),n.id=t,n.autoplay=!0,n.hidden=!0;const e=Ib();e.enabled=!0;const i=new MediaStream([e]);n.srcObject=i,document.addEventListener("visibilitychange",()=>{n&&(n.srcObject=document.hidden?null:i,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(n),this.once(mv.Disconnected,()=>{null==n||n.remove(),n=null})}e.push(n)}this.remoteParticipants.forEach(t=>{t.audioTrackPublications.forEach(t=>{t.track&&t.track.attachedElements.forEach(t=>{e.push(t)})})});try{yield Promise.all([this.acquireAudioContext(),...e.map(e=>(e.muted=!1,e.play()))]),this.handleAudioPlaybackStarted()}catch(n){throw this.handleAudioPlaybackFailed(n),n}}),this.startVideo=()=>$f(this,void 0,void 0,function*(){const e=[];for(const t of this.remoteParticipants.values())t.videoTrackPublications.forEach(t=>{var n;null===(n=t.track)||void 0===n||n.attachedElements.forEach(t=>{e.includes(t)||e.push(t)})});yield Promise.all(e.map(e=>e.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(e=>{"NotAllowedError"===e.name?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 e of this.remoteParticipants.values())this.handleParticipantDisconnected(e.identity,e);this.setAndEmitConnectionState(Tk.Reconnecting)&&this.emit(mv.Reconnecting)},this.handleSignalRestarted=e=>$f(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(e.serverRegion),Object.assign(Object.assign({},this.logContext),{region:e.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(e);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(t){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:t}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:e.serverRegion}))}catch(n){return}this.setAndEmitConnectionState(Tk.Connected),this.emit(mv.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=e=>{e.forEach(e=>{var t;if(e.identity===this.localParticipant.identity)return void this.localParticipant.updateInfo(e);""===e.identity&&(e.identity=null!==(t=this.sidToIdentity.get(e.sid))&&void 0!==t?t:"");let n=this.remoteParticipants.get(e.identity);e.state===qp.DISCONNECTED?this.handleParticipantDisconnected(e.identity,n):n=this.getOrCreateParticipant(e.identity,e)})},this.handleActiveSpeakersUpdate=e=>{const t=[],n={};e.forEach(e=>{if(n[e.sid]=!0,e.sid===this.localParticipant.sid)this.localParticipant.audioLevel=e.level,this.localParticipant.setIsSpeaking(!0),t.push(this.localParticipant);else{const n=this.getRemoteParticipantBySid(e.sid);n&&(n.audioLevel=e.level,n.setIsSpeaking(!0),t.push(n))}}),n[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(e=>{n[e.sid]||(e.audioLevel=0,e.setIsSpeaking(!1))}),this.activeSpeakers=t,this.emitWhenConnected(mv.ActiveSpeakersChanged,t)},this.handleSpeakersChanged=e=>{const t=new Map;this.activeSpeakers.forEach(e=>{const n=this.remoteParticipants.get(e.identity);n&&n.sid!==e.sid||t.set(e.sid,e)}),e.forEach(e=>{let n=this.getRemoteParticipantBySid(e.sid);e.sid===this.localParticipant.sid&&(n=this.localParticipant),n&&(n.audioLevel=e.level,n.setIsSpeaking(e.active),e.active?t.set(e.sid,n):t.delete(e.sid))});const n=Array.from(t.values());n.sort((e,t)=>t.audioLevel-e.audioLevel),this.activeSpeakers=n,this.emitWhenConnected(mv.ActiveSpeakersChanged,n)},this.handleStreamStateUpdate=e=>{e.streamStates.forEach(e=>{const t=this.getRemoteParticipantBySid(e.participantSid);if(!t)return;const n=t.getTrackPublicationBySid(e.trackSid);if(!n||!n.track)return;const i=$v.streamStateFromProto(e.state);n.track.setStreamState(i),i!==n.track.streamState&&(t.emit(gv.TrackStreamStateChanged,n,n.track.streamState),this.emitWhenConnected(mv.TrackStreamStateChanged,n,n.track.streamState,t))})},this.handleSubscriptionPermissionUpdate=e=>{const t=this.getRemoteParticipantBySid(e.participantSid);if(!t)return;const n=t.getTrackPublicationBySid(e.trackSid);n&&n.setAllowed(e.allowed)},this.handleSubscriptionError=e=>{const t=Array.from(this.remoteParticipants.values()).find(t=>t.trackPublications.has(e.trackSid));if(!t)return;const n=t.getTrackPublicationBySid(e.trackSid);n&&n.setSubscriptionError(e.err)},this.handleDataPacket=(e,t)=>{const n=this.remoteParticipants.get(e.participantIdentity);if("user"===e.value.case)this.handleUserPacket(n,e.value.value,e.kind,t);else if("transcription"===e.value.case)this.handleTranscription(n,e.value.value);else if("sipDtmf"===e.value.case)this.handleSipDtmf(n,e.value.value);else if("chatMessage"===e.value.case)this.handleChatMessage(n,e.value.value);else if("metrics"===e.value.case)this.handleMetrics(e.value.value,n);else if("streamHeader"===e.value.case||"streamChunk"===e.value.case||"streamTrailer"===e.value.case)this.handleDataStream(e,t);else if("rpcRequest"===e.value.case){const t=e.value.value;this.handleIncomingRpcRequest(e.participantIdentity,t.id,t.method,t.payload,t.responseTimeoutMs,t.version)}},this.handleUserPacket=(e,t,n,i)=>{this.emit(mv.DataReceived,t.payload,e,n,t.topic,i),null==e||e.emit(gv.DataReceived,t.payload,n,i)},this.handleSipDtmf=(e,t)=>{this.emit(mv.SipDTMFReceived,t,e),null==e||e.emit(gv.SipDTMFReceived,t)},this.handleTranscription=(e,t)=>{const n=t.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(t.transcribedParticipantIdentity),i=null==n?void 0:n.trackPublications.get(t.trackId),o=function(e,t){return e.segments.map(e=>{let{id:n,text:i,language:o,startTime:r,endTime:s,final:a}=e;var c;const l=null!==(c=t.get(n))&&void 0!==c?c:Date.now(),d=Date.now();return a?t.delete(n):t.set(n,l),{id:n,text:i,startTime:Number.parseInt(r.toString()),endTime:Number.parseInt(s.toString()),final:a,language:o,firstReceivedTime:l,lastReceivedTime:d}})}(t,this.transcriptionReceivedTimes);null==i||i.emit(kv.TranscriptionReceived,o),null==n||n.emit(gv.TranscriptionReceived,o,i),this.emit(mv.TranscriptionReceived,o,n,i)},this.handleChatMessage=(e,t)=>{const n=function(e){const{id:t,timestamp:n,message:i,editTimestamp:o}=e;return{id:t,timestamp:Number.parseInt(n.toString()),editTimestamp:o?Number.parseInt(o.toString()):void 0,message:i}}(t);this.emit(mv.ChatMessage,n,e)},this.handleMetrics=(e,t)=>{this.emit(mv.MetricsReceived,e,t)},this.handleDataStream=(e,t)=>{this.incomingDataStreamManager.handleDataStreamPacket(e,t)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(mv.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=e=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:e})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(mv.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(mv.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(mv.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>$f(this,void 0,void 0,function*(){var e;"iOS"!==(null===(e=Nv())||void 0===e?void 0:e.os)&&(yield this.selectDefaultDevices()),this.emit(mv.MediaDevicesChanged)}),this.handleRoomUpdate=e=>{const t=this.roomInfo;this.roomInfo=e,t&&t.metadata!==e.metadata&&this.emitWhenConnected(mv.RoomMetadataChanged,e.metadata),(null==t?void 0:t.activeRecording)!==e.activeRecording&&this.emitWhenConnected(mv.RecordingStatusChanged,e.activeRecording)},this.handleConnectionQualityUpdate=e=>{e.updates.forEach(e=>{if(e.participantSid===this.localParticipant.sid)return void this.localParticipant.setConnectionQuality(e.quality);const t=this.getRemoteParticipantBySid(e.participantSid);t&&t.setConnectionQuality(e.quality)})},this.onLocalParticipantMetadataChanged=e=>{this.emit(mv.ParticipantMetadataChanged,e,this.localParticipant)},this.onLocalParticipantNameChanged=e=>{this.emit(mv.ParticipantNameChanged,e,this.localParticipant)},this.onLocalAttributesChanged=e=>{this.emit(mv.ParticipantAttributesChanged,e,this.localParticipant)},this.onLocalTrackMuted=e=>{this.emit(mv.TrackMuted,e,this.localParticipant)},this.onLocalTrackUnmuted=e=>{this.emit(mv.TrackUnmuted,e,this.localParticipant)},this.onTrackProcessorUpdate=e=>{var t;null===(t=null==e?void 0:e.onPublish)||void 0===t||t.call(e,this)},this.onLocalTrackPublished=e=>$f(this,void 0,void 0,function*(){var t,n,i,o,r,s;null===(t=e.track)||void 0===t||t.on(kv.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(n=e.track)||void 0===n||n.on(kv.Restarted,this.onLocalTrackRestarted),null===(r=null===(o=null===(i=e.track)||void 0===i?void 0:i.getProcessor())||void 0===o?void 0:o.onPublish)||void 0===r||r.call(o,this),this.emit(mv.LocalTrackPublished,e,this.localParticipant),Fb(e.track)&&(yield e.track.checkForSilence())&&this.emit(mv.LocalAudioSilenceDetected,e);const a=yield null===(s=e.track)||void 0===s?void 0:s.getDeviceId(!1),c=Zb(e.source);c&&a&&a!==this.localParticipant.activeDeviceMap.get(c)&&(this.localParticipant.activeDeviceMap.set(c,a),this.emit(mv.ActiveDeviceChanged,c,a))}),this.onLocalTrackUnpublished=e=>{var t,n;null===(t=e.track)||void 0===t||t.off(kv.TrackProcessorUpdate,this.onTrackProcessorUpdate),null===(n=e.track)||void 0===n||n.off(kv.Restarted,this.onLocalTrackRestarted),this.emit(mv.LocalTrackUnpublished,e,this.localParticipant)},this.onLocalTrackRestarted=e=>$f(this,void 0,void 0,function*(){const t=yield e.getDeviceId(!1),n=Zb(e.source);n&&t&&t!==this.localParticipant.activeDeviceMap.get(n)&&(this.log.debug("local track restarted, setting ".concat(n," ").concat(t," active"),this.logContext),this.localParticipant.activeDeviceMap.set(n,t),this.emit(mv.ActiveDeviceChanged,n,t))}),this.onLocalConnectionQualityChanged=e=>{this.emit(mv.ConnectionQualityChanged,e,this.localParticipant)},this.onMediaDevicesError=(e,t)=>{this.emit(mv.MediaDevicesError,e,t)},this.onLocalParticipantPermissionsChanged=e=>{this.emit(mv.ParticipantPermissionsChanged,e,this.localParticipant)},this.onLocalChatMessageSent=e=>{this.emit(mv.ChatMessage,e,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},Uy),e),this.log=Ff(null!==(n=this.options.loggerName)&&void 0!==n?n:Af.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Ly),null==e?void 0:e.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},jy),null==e?void 0:e.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},Ny),null==e?void 0:e.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new Nk,this.outgoingDataStreamManager=new Fk(this.engine,this.log),this.disconnectLock=new Ju,this.localParticipant=new Kk("","",this.engine,this.options,this.rpcHandlers,this.outgoingDataStreamManager),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Rb(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Rb(this.options.audioCaptureDefaults.deviceId)),(null===(i=this.options.audioOutput)||void 0===i?void 0:i.deviceId)&&this.switchActiveDevice("audiooutput",Rb(this.options.audioOutput.deviceId)).catch(e=>this.log.warn("Could not set audio output: ".concat(e.message),this.logContext)),pb()){const e=new AbortController;null===(o=navigator.mediaDevices)||void 0===o||o.addEventListener("devicechange",this.handleDeviceChange,{signal:e.signal}),Xk.cleanupRegistry&&Xk.cleanupRegistry.register(this,()=>{e.abort()})}}registerTextStreamHandler(e,t){return this.incomingDataStreamManager.registerTextStreamHandler(e,t)}unregisterTextStreamHandler(e){return this.incomingDataStreamManager.unregisterTextStreamHandler(e)}registerByteStreamHandler(e,t){return this.incomingDataStreamManager.registerByteStreamHandler(e,t)}unregisterByteStreamHandler(e){return this.incomingDataStreamManager.unregisterByteStreamHandler(e)}registerRpcMethod(e,t){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,t)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setE2EEEnabled(e){return $f(this,void 0,void 0,function*(){if(!this.e2eeManager)throw Error("e2ee not configured, please set e2ee settings within the room options");yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),""!==this.localParticipant.identity&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity)})}setupE2EE(){var e;const t=!!this.options.encryption,n=this.options.encryption||this.options.e2ee;n&&(this.e2eeManager="e2eeManager"in n?n.e2eeManager:new ey(n,t),this.e2eeManager.on(iv.ParticipantEncryptionStatusChanged,(e,t)=>{t.isLocal&&(this.isE2EEEnabled=e),this.emit(mv.ParticipantEncryptionStatusChanged,e,t)}),this.e2eeManager.on(iv.EncryptionError,e=>this.emit(mv.EncryptionError,e)),null===(e=this.e2eeManager)||void 0===e||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:null===(e=this.roomInfo)||void 0===e?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.activeRecording)&&void 0!==t&&t}getSid(){return $f(this,void 0,void 0,function*(){return this.state===Tk.Disconnected?"":this.roomInfo&&""!==this.roomInfo.sid?this.roomInfo.sid:new Promise((e,t)=>{const n=t=>{""!==t.sid&&(this.engine.off(bv.RoomUpdate,n),e(t.sid))};this.engine.on(bv.RoomUpdate,n),this.once(mv.Disconnected,()=>{this.engine.off(bv.RoomUpdate,n),t("Room disconnected before room server id was available")})})})}get name(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.name)&&void 0!==t?t:""}get metadata(){var e;return null===(e=this.roomInfo)||void 0===e?void 0:e.metadata}get numParticipants(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.numParticipants)&&void 0!==t?t:0}get numPublishers(){var e,t;return null!==(t=null===(e=this.roomInfo)||void 0===e?void 0:e.numPublishers)&&void 0!==t?t:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Ik(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(bv.ParticipantUpdate,this.handleParticipantUpdates).on(bv.RoomUpdate,this.handleRoomUpdate).on(bv.SpeakersChanged,this.handleSpeakersChanged).on(bv.StreamStateChanged,this.handleStreamStateUpdate).on(bv.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(bv.SubscriptionError,this.handleSubscriptionError).on(bv.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(bv.MediaTrackAdded,(e,t,n)=>{this.onTrackAdded(e,t,n)}).on(bv.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(bv.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(bv.DataPacketReceived,this.handleDataPacket).on(bv.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(Tk.SignalReconnecting)&&this.emit(mv.SignalReconnecting)}).on(bv.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Tk.Connected)&&this.emit(mv.Reconnected)}).on(bv.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Tk.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(bv.Restarting,this.handleRestarting).on(bv.SignalRestarted,this.handleSignalRestarted).on(bv.Offline,()=>{this.setAndEmitConnectionState(Tk.Reconnecting)&&this.emit(mv.Reconnecting)}).on(bv.DCBufferStatusChanged,(e,t)=>{this.emit(mv.DCBufferStatusChanged,e,t)}).on(bv.LocalTrackSubscribed,e=>{const t=this.localParticipant.getTrackPublications().find(t=>{let{trackSid:n}=t;return n===e});t?(this.localParticipant.emit(gv.LocalTrackSubscribed,t),this.emitWhenConnected(mv.LocalTrackSubscribed,t,this.localParticipant)):this.log.warn("could not find local track subscription for subscribed event",this.logContext)}).on(bv.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((e,t)=>{this.handleParticipantDisconnected(t,e)}),this.emit(mv.Moved,e.room.name),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),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}static getLocalDevices(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return ny.getInstance().getDevices(e,t)}prepareConnection(e,t){return $f(this,void 0,void 0,function*(){if(this.state===Tk.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(fb(new URL(e))&&t){this.regionUrlProvider=new Ak(e,t);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===Tk.Disconnected&&(this.regionUrl=n,yield fetch(Ab(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(Ab(e),{method:"HEAD"})}catch(Bx){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:Bx}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,t){return $f(this,void 0,void 0,function*(){let n,i=()=>$f(this,void 0,void 0,function*(){});switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":n=new vf({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":n=new vf({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":n=new vf({scenario:{case:"serverLeave",value:!0}});break;case"migration":n=new vf({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":i=()=>$f(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),n=new vf({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>$f(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),n=new vf({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":n=new vf({scenario:{case:"switchCandidateProtocol",value:"force-tls"===e?2:1}}),i=()=>$f(this,void 0,void 0,function*(){const e=this.engine.client.onLeave;e&&e(new Zm({reason:Lp.CLIENT_INITIATED,action:Jm.RECONNECT}))});break;case"subscriber-bandwidth":if(void 0===t||"number"!=typeof t)throw new Error("subscriber-bandwidth requires a number as argument");n=new vf({scenario:{case:"subscriberBandwidth",value:Db(t)}});break;case"leave-full-reconnect":n=new vf({scenario:{case:"leaveRequestFullReconnect",value:!0}})}n&&(yield this.engine.client.sendSimulateScenario(n),yield i())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,t){return $f(this,arguments,void 0,function(e,t){var n=this;let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return function*(){var o,r,s,a,c,l,d;let u=!0,h=!1;const p=i?{exact:t}:t;if("audioinput"===e){h=0===n.localParticipant.audioTrackPublications.size;const t=null!==(o=n.getActiveDevice(e))&&void 0!==o?o:n.options.audioCaptureDefaults.deviceId;n.options.audioCaptureDefaults.deviceId=p;const i=Array.from(n.localParticipant.audioTrackPublications.values()).filter(e=>e.source===$v.Source.Microphone);try{u=(yield Promise.all(i.map(e=>{var t;return null===(t=e.audioTrack)||void 0===t?void 0:t.setDeviceId(p)}))).every(e=>!0===e)}catch(Bx){throw n.options.audioCaptureDefaults.deviceId=t,Bx}const r=i.some(e=>{var t,n;return null!==(n=null===(t=e.track)||void 0===t?void 0:t.isMuted)&&void 0!==n&&n});u&&r&&(h=!0)}else if("videoinput"===e){h=0===n.localParticipant.videoTrackPublications.size;const t=null!==(r=n.getActiveDevice(e))&&void 0!==r?r:n.options.videoCaptureDefaults.deviceId;n.options.videoCaptureDefaults.deviceId=p;const i=Array.from(n.localParticipant.videoTrackPublications.values()).filter(e=>e.source===$v.Source.Camera);try{u=(yield Promise.all(i.map(e=>{var t;return null===(t=e.videoTrack)||void 0===t?void 0:t.setDeviceId(p)}))).every(e=>!0===e)}catch(Bx){throw n.options.videoCaptureDefaults.deviceId=t,Bx}const o=i.some(e=>{var t,n;return null!==(n=null===(t=e.track)||void 0===t?void 0:t.isMuted)&&void 0!==n&&n});u&&o&&(h=!0)}else if("audiooutput"===e){if(h=!0,!cb()&&!n.options.webAudioMix||n.options.webAudioMix&&n.audioContext&&!("setSinkId"in n.audioContext))throw new Error("cannot switch audio output, the current browser does not support it");n.options.webAudioMix&&(t=null!==(s=yield ny.getInstance().normalizeDeviceId("audiooutput",t))&&void 0!==s?s:""),null!==(a=(d=n.options).audioOutput)&&void 0!==a||(d.audioOutput={});const i=null!==(c=n.getActiveDevice(e))&&void 0!==c?c:n.options.audioOutput.deviceId;n.options.audioOutput.deviceId=t;try{n.options.webAudioMix&&(null===(l=n.audioContext)||void 0===l||l.setSinkId(t)),yield Promise.all(Array.from(n.remoteParticipants.values()).map(e=>e.setAudioOutput({deviceId:t})))}catch(Bx){throw n.options.audioOutput.deviceId=i,Bx}}return h&&(n.localParticipant.activeDeviceMap.set(e,t),n.emit(mv.ActiveDeviceChanged,e,t)),u}()})}setupLocalParticipantEvents(){this.localParticipant.on(gv.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(gv.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(gv.AttributesChanged,this.onLocalAttributesChanged).on(gv.TrackMuted,this.onLocalTrackMuted).on(gv.TrackUnmuted,this.onLocalTrackUnmuted).on(gv.LocalTrackPublished,this.onLocalTrackPublished).on(gv.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(gv.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(gv.MediaDevicesError,this.onMediaDevicesError).on(gv.AudioStreamAcquired,this.startAudio).on(gv.ChatMessage,this.onLocalChatMessageSent).on(gv.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;null===(e=this.engine)||void 0===e||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,t,n){if(this.state===Tk.Connecting||this.state===Tk.Reconnecting){const i=()=>{this.onTrackAdded(e,t,n),o()},o=()=>{this.off(mv.Reconnected,i),this.off(mv.Connected,i),this.off(mv.Disconnected,o)};return this.once(mv.Reconnected,i),this.once(mv.Connected,i),void this.once(mv.Disconnected,o)}if(this.state===Tk.Disconnected)return void this.log.warn("skipping incoming track after Room disconnected",this.logContext);if("ended"===e.readyState)return void this.log.info("skipping incoming track as it already ended",this.logContext);const i=function(e){const t=e.split("|");return t.length>1?[t[0],e.substr(t[0].length+1)]:[e,""]}(t.id),o=i[0];let r=i[1],s=e.id;if(r&&r.startsWith("TR")&&(s=r),o===this.localParticipant.sid)return void this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);const a=Array.from(this.remoteParticipants.values()).find(e=>e.sid===o);if(!a)return void this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(o),this.logContext);let c;this.options.adaptiveStream&&(c="object"==typeof this.options.adaptiveStream?this.options.adaptiveStream:{});const l=a.addSubscribedMediaTrack(e,s,t,n,c);(null==l?void 0:l.isEncrypted)&&!this.e2eeManager&&this.emit(mv.EncryptionError,new Error("Encrypted ".concat(l.source," track received from participant ").concat(a.sid,", but room does not have encryption enabled!")))}handleDisconnect(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=arguments.length>1?arguments[1]:void 0;var n;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearHandlersAndControllers(),this.state!==Tk.Disconnected){this.regionUrl=void 0;try{this.remoteParticipants.forEach(e=>{e.trackPublications.forEach(t=>{e.unpublishTrack(t.trackSid)})}),this.localParticipant.trackPublications.forEach(t=>{var n,i,o;t.track&&this.localParticipant.unpublishTrack(t.track,e),e?(null===(n=t.track)||void 0===n||n.detach(),null===(i=t.track)||void 0===i||i.stop()):null===(o=t.track)||void 0===o||o.stopMonitor()}),this.localParticipant.off(gv.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(gv.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(gv.AttributesChanged,this.onLocalAttributesChanged).off(gv.TrackMuted,this.onLocalTrackMuted).off(gv.TrackUnmuted,this.onLocalTrackUnmuted).off(gv.LocalTrackPublished,this.onLocalTrackPublished).off(gv.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(gv.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(gv.MediaDevicesError,this.onMediaDevicesError).off(gv.AudioStreamAcquired,this.startAudio).off(gv.ChatMessage,this.onLocalChatMessageSent).off(gv.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&&"boolean"==typeof this.options.webAudioMix&&(this.audioContext.close(),this.audioContext=void 0),pb()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),null===(n=navigator.mediaDevices)||void 0===n||n.removeEventListener("devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Tk.Disconnected),this.emit(mv.Disconnected,t)}}}handleParticipantDisconnected(e,t){var n;this.remoteParticipants.delete(e),t&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(e),t.trackPublications.forEach(e=>{t.unpublishTrack(e.trackSid,!0)}),this.emit(mv.ParticipantDisconnected,t),t.setDisconnected(),null===(n=this.localParticipant)||void 0===n||n.handleParticipantDisconnected(t.identity))}handleIncomingRpcRequest(e,t,n,i,o,r){return $f(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,t),1!==r)return void(yield this.engine.publishRpcResponse(e,t,null,$y.builtIn("UNSUPPORTED_VERSION")));const s=this.rpcHandlers.get(n);if(!s)return void(yield this.engine.publishRpcResponse(e,t,null,$y.builtIn("UNSUPPORTED_METHOD")));let a=null,c=null;try{const n=yield s({requestId:t,callerIdentity:e,payload:i,responseTimeout:o});qy(n)>15360?a=$y.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"):c=n}catch(l){a=l instanceof $y?l:$y.builtIn("APPLICATION_ERROR")}yield this.engine.publishRpcResponse(e,t,c,a)})}selectDefaultDevices(){return $f(this,void 0,void 0,function*(){var e,t,n;const i=ny.getInstance().previousDevices,o=yield ny.getInstance().getDevices(void 0,!1),r=Nv();if("Chrome"===(null==r?void 0:r.name)&&"iOS"!==r.os)for(let a of o){const e=i.find(e=>e.deviceId===a.deviceId);e&&""!==e.label&&e.kind===a.kind&&e.label!==a.label&&"default"===this.getActiveDevice(a.kind)&&this.emit(mv.ActiveDeviceChanged,a.kind,a.deviceId)}const s=["audiooutput","audioinput","videoinput"];for(let a of s){const r=Gb(a),s=this.localParticipant.getTrackPublication(r);if(s&&(null===(e=s.track)||void 0===e?void 0:e.isUserProvided))continue;const c=o.filter(e=>e.kind===a),l=this.getActiveDevice(a);l===(null===(t=i.filter(e=>e.kind===a)[0])||void 0===t?void 0:t.deviceId)&&c.length>0&&(null===(n=c[0])||void 0===n?void 0:n.deviceId)!==l?yield this.switchActiveDevice(a,c[0].deviceId):"audioinput"===a&&!ub()||"videoinput"===a||!(c.length>0)||c.find(e=>e.deviceId===this.getActiveDevice(a))||"audiooutput"===a&&ub()||(yield this.switchActiveDevice(a,c[0].deviceId))}})}acquireAudioContext(){return $f(this,void 0,void 0,function*(){var e,t;if("boolean"!=typeof this.options.webAudioMix&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:this.audioContext&&"closed"!==this.audioContext.state||(this.audioContext=null!==(e=Hb())&&void 0!==e?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(e=>e.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&"suspended"===this.audioContext.state)try{yield Promise.race([this.audioContext.resume(),ob(200)])}catch(Bx){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:Bx}))}const n="running"===(null===(t=this.audioContext)||void 0===t?void 0:t.state);n!==this.canPlaybackAudio&&(this.audioEnabled=n,this.emit(mv.AudioPlaybackStatusChanged,n))})}createParticipant(e,t){var n;let i;return i=t?Qk.fromParticipantInfo(this.engine.client,t,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):new Qk(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&i.setAudioContext(this.audioContext),(null===(n=this.options.audioOutput)||void 0===n?void 0:n.deviceId)&&i.setAudioOutput(this.options.audioOutput).catch(e=>this.log.warn("Could not set audio output: ".concat(e.message),this.logContext)),i}getOrCreateParticipant(e,t){if(this.remoteParticipants.has(e)){const n=this.remoteParticipants.get(e);return t&&n.updateInfo(t)&&this.sidToIdentity.set(t.sid,t.identity),n}const n=this.createParticipant(e,t);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(t.sid,t.identity),this.emitWhenConnected(mv.ParticipantConnected,n),n.on(gv.TrackPublished,e=>{this.emitWhenConnected(mv.TrackPublished,e,n)}).on(gv.TrackSubscribed,(e,t)=>{e.kind===$v.Kind.Audio?(e.on(kv.AudioPlaybackStarted,this.handleAudioPlaybackStarted),e.on(kv.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):e.kind===$v.Kind.Video&&(e.on(kv.VideoPlaybackFailed,this.handleVideoPlaybackFailed),e.on(kv.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(mv.TrackSubscribed,e,t,n)}).on(gv.TrackUnpublished,e=>{this.emit(mv.TrackUnpublished,e,n)}).on(gv.TrackUnsubscribed,(e,t)=>{this.emit(mv.TrackUnsubscribed,e,t,n)}).on(gv.TrackMuted,e=>{this.emitWhenConnected(mv.TrackMuted,e,n)}).on(gv.TrackUnmuted,e=>{this.emitWhenConnected(mv.TrackUnmuted,e,n)}).on(gv.ParticipantMetadataChanged,e=>{this.emitWhenConnected(mv.ParticipantMetadataChanged,e,n)}).on(gv.ParticipantNameChanged,e=>{this.emitWhenConnected(mv.ParticipantNameChanged,e,n)}).on(gv.AttributesChanged,e=>{this.emitWhenConnected(mv.ParticipantAttributesChanged,e,n)}).on(gv.ConnectionQualityChanged,e=>{this.emitWhenConnected(mv.ConnectionQualityChanged,e,n)}).on(gv.ParticipantPermissionsChanged,e=>{this.emitWhenConnected(mv.ParticipantPermissionsChanged,e,n)}).on(gv.TrackSubscriptionStatusChanged,(e,t)=>{this.emitWhenConnected(mv.TrackSubscriptionStatusChanged,e,t,n)}).on(gv.TrackSubscriptionFailed,(e,t)=>{this.emit(mv.TrackSubscriptionFailed,e,n,t)}).on(gv.TrackSubscriptionPermissionChanged,(e,t)=>{this.emitWhenConnected(mv.TrackSubscriptionPermissionChanged,e,t,n)}).on(gv.Active,()=>{this.emitWhenConnected(mv.ParticipantActive,n),n.kind===Wp.AGENT&&this.localParticipant.setActiveAgent(n)}),t&&n.updateInfo(t),n}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((e,t)=>(e.push(...t.getTrackPublications()),e),[]),t=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,t)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const t of e.videoTrackPublications.values())t.isSubscribed&&zb(t)&&t.emitTrackUpdate()}getRemoteParticipantBySid(e){const t=this.sidToIdentity.get(e);if(t)return this.remoteParticipants.get(t)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Fv.setInterval(()=>{this.engine&&!this.engine.isClosed&&this.engine.verifyTransport()?e=0:(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,Lp.STATE_MISMATCH)))},4e3)}clearConnectionReconcile(){this.connectionReconcileInterval&&Fv.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e!==this.state&&(this.state=e,this.emit(mv.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[t,n]=e;this.emit(t,...n)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(this.state===Tk.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===Tk.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return $f(this,void 0,void 0,function*(){var t,n;const i=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),o=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new Bp({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:fh.parse((new Date).getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new $p({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(mv.SignalConnected),this.emit(mv.Connected),this.setAndEmitConnectionState(Tk.Connected),i.video){const e=new Gk($v.Kind.Video,new Jp({source:Mp.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO,name:"video-dummy"}),new dk(i.useRealTracks?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:Eb(160*(null!==(t=o.aspectRatios[0])&&void 0!==t?t:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(e),this.localParticipant.emit(gv.LocalTrackPublished,e)}if(i.audio){const e=new Gk($v.Kind.Audio,new Jp({source:Mp.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO}),new Qy(i.useRealTracks?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:Ib(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(e),this.localParticipant.emit(gv.LocalTrackPublished,e)}for(let e=0;e<o.count-1;e+=1){let t=new $p({sid:Math.floor(1e4*Math.random()).toString(),identity:"simulated-".concat(e),state:qp.ACTIVE,tracks:[],joinedAt:fh.parse(Date.now())});const i=this.getOrCreateParticipant(t.identity,t);if(o.video){const r=Eb(160*(null!==(n=o.aspectRatios[e%o.aspectRatios.length])&&void 0!==n?n:1),160,!1,!0),s=new Jp({source:Mp.CAMERA,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO});i.addSubscribedMediaTrack(r,s.sid,new MediaStream([r]),new RTCRtpReceiver),t.tracks=[...t.tracks,s]}if(o.audio){const e=Ib(),n=new Jp({source:Mp.MICROPHONE,sid:Math.floor(1e4*Math.random()).toString(),type:Ap.AUDIO});i.addSubscribedMediaTrack(e,n.sid,new MediaStream([e]),new RTCRtpReceiver),t.tracks=[...t.tracks,n]}i.updateInfo(t)}})}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];if(e!==mv.ActiveSpeakersChanged&&e!==mv.TranscriptionReceived){const t=ew(n).filter(e=>void 0!==e);this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:t}))}return super.emit(e,...n)}}function ew(e){return e.map(e=>{if(e)return Array.isArray(e)?ew(e):"object"==typeof e?"logContext"in e?e.logContext:void 0:e})}function tw(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Xk.cleanupRegistry="undefined"!=typeof FinalizationRegistry&&new FinalizationRegistry(e=>{e()}),(_k=Ek||(Ek={}))[_k.IDLE=0]="IDLE",_k[_k.RUNNING=1]="RUNNING",_k[_k.SKIPPED=2]="SKIPPED",_k[_k.SUCCESS=3]="SUCCESS",_k[_k.FAILED=4]="FAILED",Gf.EventEmitter,Gf.EventEmitter,new TextEncoder,new TextDecoder;class nw extends Error{constructor(e,t){var n;super(e,t),tw(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,null===(n=Error.captureStackTrace)||void 0===n||n.call(Error,this,this.constructor)}}function iw(){return iw=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},iw.apply(null,arguments)}tw(nw,"code","ERR_JOSE_GENERIC"),tw(class extends nw{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:i,payload:t}}),tw(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),tw(this,"claim",void 0),tw(this,"reason",void 0),tw(this,"payload",void 0),this.claim=n,this.reason=i,this.payload=t}},"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),tw(class extends nw{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unspecified",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:i,payload:t}}),tw(this,"code","ERR_JWT_EXPIRED"),tw(this,"claim",void 0),tw(this,"reason",void 0),tw(this,"payload",void 0),this.claim=n,this.reason=i,this.payload=t}},"code","ERR_JWT_EXPIRED"),tw(class extends nw{constructor(){super(...arguments),tw(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}},"code","ERR_JOSE_ALG_NOT_ALLOWED"),tw(class extends nw{constructor(){super(...arguments),tw(this,"code","ERR_JOSE_NOT_SUPPORTED")}},"code","ERR_JOSE_NOT_SUPPORTED"),tw(class extends nw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"decryption operation failed",arguments.length>1?arguments[1]:void 0),tw(this,"code","ERR_JWE_DECRYPTION_FAILED")}},"code","ERR_JWE_DECRYPTION_FAILED"),tw(class extends nw{constructor(){super(...arguments),tw(this,"code","ERR_JWE_INVALID")}},"code","ERR_JWE_INVALID"),tw(class extends nw{constructor(){super(...arguments),tw(this,"code","ERR_JWS_INVALID")}},"code","ERR_JWS_INVALID"),tw(class extends nw{constructor(){super(...arguments),tw(this,"code","ERR_JWT_INVALID")}},"code","ERR_JWT_INVALID"),tw(class extends nw{constructor(){super(...arguments),tw(this,"code","ERR_JWK_INVALID")}},"code","ERR_JWK_INVALID"),tw(class extends nw{constructor(){super(...arguments),tw(this,"code","ERR_JWKS_INVALID")}},"code","ERR_JWKS_INVALID"),tw(class extends nw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"no applicable key found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),tw(this,"code","ERR_JWKS_NO_MATCHING_KEY")}},"code","ERR_JWKS_NO_MATCHING_KEY"),tw(class extends nw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"multiple matching keys found in the JSON Web Key Set",arguments.length>1?arguments[1]:void 0),tw(this,Symbol.asyncIterator,void 0),tw(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}},"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS"),tw(class extends nw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"request timed out",arguments.length>1?arguments[1]:void 0),tw(this,"code","ERR_JWKS_TIMEOUT")}},"code","ERR_JWKS_TIMEOUT"),tw(class extends nw{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature verification failed",arguments.length>1?arguments[1]:void 0),tw(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}},"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const ow=new Uint8Array(0);class rw{static getFullOptions(e){return iw({clientTools:{},onConnect:()=>{},onDebug:()=>{},onDisconnect:()=>{},onError:()=>{},onMessage:()=>{},onAudio:()=>{},onModeChange:()=>{},onStatusChange:()=>{},onCanSendFeedbackChange:()=>{},onInterruption:()=>{}},e)}constructor(e,t){var n=this;this.options=void 0,this.connection=void 0,this.lastInterruptTimestamp=0,this.mode="listening",this.status="connecting",this.volume=1,this.currentEventId=1,this.lastFeedbackEventId=0,this.canSendFeedback=!1,this.endSessionWithDetails=async function(e){"connected"!==n.status&&"connecting"!==n.status||(n.updateStatus("disconnecting"),await n.handleEndSession(),n.updateStatus("disconnected"),n.options.onDisconnect&&n.options.onDisconnect(e))},this.onMessage=async function(e){switch(e.type){case"interruption":return void n.handleInterruption(e);case"agent_response":return void n.handleAgentResponse(e);case"user_transcript":return void n.handleUserTranscript(e);case"internal_tentative_agent_response":return void n.handleTentativeAgentResponse(e);case"client_tool_call":try{await n.handleClientToolCall(e)}catch(t){n.onError(`Unexpected error in client tool call handling: ${t instanceof Error?t.message:String(t)}`,{clientToolName:e.client_tool_call.tool_name,toolCallId:e.client_tool_call.tool_call_id})}return;case"audio":return void n.handleAudio(e);case"vad_score":return void n.handleVadScore(e);case"ping":return void n.connection.sendMessage({type:"pong",event_id:e.ping_event.event_id});case"mcp_tool_call":return void n.handleMCPToolCall(e);case"mcp_connection_status":return void n.handleMCPConnectionStatus(e);case"agent_tool_response":return void n.handleAgentToolResponse(e);case"conversation_initiation_metadata":return void n.handleConversationMetadata(e);case"asr_initiation_metadata":return void n.handleAsrInitiationMetadata(e);default:return void(n.options.onDebug&&n.options.onDebug(e))}},this.setVolume=({volume:e})=>{this.volume=e},this.options=e,this.connection=t,this.options.onConnect&&this.options.onConnect({conversationId:t.conversationId}),this.connection.onMessage(this.onMessage),this.connection.onDisconnect(this.endSessionWithDetails),this.connection.onModeChange(e=>this.updateMode(e)),this.updateStatus("connected")}endSession(){return this.endSessionWithDetails({reason:"user"})}async handleEndSession(){this.connection.close()}updateMode(e){e!==this.mode&&(this.mode=e,this.options.onModeChange&&this.options.onModeChange({mode:e}))}updateStatus(e){e!==this.status&&(this.status=e,this.options.onStatusChange&&this.options.onStatusChange({status:e}))}updateCanSendFeedback(){const e=this.currentEventId!==this.lastFeedbackEventId;this.canSendFeedback!==e&&(this.canSendFeedback=e,this.options.onCanSendFeedbackChange&&this.options.onCanSendFeedbackChange({canSendFeedback:e}))}handleInterruption(e){e.interruption_event&&(this.lastInterruptTimestamp=e.interruption_event.event_id,this.options.onInterruption&&this.options.onInterruption({event_id:e.interruption_event.event_id}))}handleAgentResponse(e){this.options.onMessage&&this.options.onMessage({source:"ai",message:e.agent_response_event.agent_response})}handleUserTranscript(e){this.options.onMessage&&this.options.onMessage({source:"user",message:e.user_transcription_event.user_transcript})}handleTentativeAgentResponse(e){this.options.onDebug&&this.options.onDebug({type:"tentative_agent_response",response:e.tentative_agent_response_internal_event.tentative_agent_response})}handleVadScore(e){this.options.onVadScore&&this.options.onVadScore({vadScore:e.vad_score_event.vad_score})}async handleClientToolCall(e){if(Object.prototype.hasOwnProperty.call(this.options.clientTools,e.client_tool_call.tool_name))try{var t;const n=null!=(t=await this.options.clientTools[e.client_tool_call.tool_name](e.client_tool_call.parameters))?t:"Client tool execution successful.",i="object"==typeof n?JSON.stringify(n):String(n);this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:i,is_error:!1})}catch(n){this.onError(`Client tool execution failed with following error: ${null==n?void 0:n.message}`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool execution failed: ${null==n?void 0:n.message}`,is_error:!0})}else{if(this.options.onUnhandledClientToolCall)return void this.options.onUnhandledClientToolCall(e.client_tool_call);this.onError(`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,{clientToolName:e.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:e.client_tool_call.tool_call_id,result:`Client tool with name ${e.client_tool_call.tool_name} is not defined on client`,is_error:!0})}}handleAudio(e){}handleMCPToolCall(e){this.options.onMCPToolCall&&this.options.onMCPToolCall(e.mcp_tool_call)}handleMCPConnectionStatus(e){this.options.onMCPConnectionStatus&&this.options.onMCPConnectionStatus(e.mcp_connection_status)}handleAgentToolResponse(e){this.options.onAgentToolResponse&&this.options.onAgentToolResponse(e.agent_tool_response)}handleConversationMetadata(e){this.options.onConversationMetadata&&this.options.onConversationMetadata(e.conversation_initiation_metadata_event)}handleAsrInitiationMetadata(e){this.options.onAsrInitiationMetadata&&this.options.onAsrInitiationMetadata(e.asr_initiation_metadata_event)}onError(e,t){this.options.onError&&this.options.onError(e,t)}getId(){return this.connection.conversationId}isOpen(){return"connected"===this.status}setMicMuted(e){this.connection.setMicMuted(e)}getInputByteFrequencyData(){return ow}getOutputByteFrequencyData(){return ow}getInputVolume(){return 0}getOutputVolume(){return 0}sendFeedback(e){this.canSendFeedback&&(this.connection.sendMessage({type:"feedback",score:e?"like":"dislike",event_id:this.currentEventId}),this.lastFeedbackEventId=this.currentEventId,this.updateCanSendFeedback())}sendContextualUpdate(e){this.connection.sendMessage({type:"contextual_update",text:e})}sendUserMessage(e){this.connection.sendMessage({type:"user_message",text:e})}sendUserActivity(){this.connection.sendMessage({type:"user_activity"})}sendMCPToolApprovalResult(e,t){this.connection.sendMessage({type:"mcp_tool_approval_result",tool_call_id:e,is_approved:t})}}class sw{constructor(e={}){this.queue=[],this.disconnectionDetails=null,this.onDisconnectCallback=null,this.onMessageCallback=null,this.onModeChangeCallback=null,this.onDebug=void 0,this.onDebug=e.onDebug}debug(e){this.onDebug&&this.onDebug(e)}onMessage(e){this.onMessageCallback=e;const t=this.queue;this.queue=[],t.length>0&&queueMicrotask(()=>{t.forEach(e)})}onDisconnect(e){this.onDisconnectCallback=e;const t=this.disconnectionDetails;t&&queueMicrotask(()=>{e(t)})}onModeChange(e){this.onModeChangeCallback=e}updateMode(e){var t;null==(t=this.onModeChangeCallback)||t.call(this,e)}disconnect(e){var t;this.disconnectionDetails||(this.disconnectionDetails=e,null==(t=this.onDisconnectCallback)||t.call(this,e))}handleMessage(e){this.onMessageCallback?this.onMessageCallback(e):this.queue.push(e)}}function aw(e){const[t,n]=e.split("_");if(!["pcm","ulaw"].includes(t))throw new Error(`Invalid format: ${e}`);const i=Number.parseInt(n);if(Number.isNaN(i))throw new Error(`Invalid sample rate: ${n}`);return{format:t,sampleRate:i}}const cw="0.7.1";function lw(e){return!!e.type}const dw="conversation_initiation_client_data";function uw(e){var t;const n={type:dw};var i,o,r,s,a;return e.overrides&&(n.conversation_config_override={agent:{prompt:null==(i=e.overrides.agent)?void 0:i.prompt,first_message:null==(o=e.overrides.agent)?void 0:o.firstMessage,language:null==(r=e.overrides.agent)?void 0:r.language},tts:{voice_id:null==(s=e.overrides.tts)?void 0:s.voiceId},conversation:{text_only:null==(a=e.overrides.conversation)?void 0:a.textOnly}}),e.customLlmExtraBody&&(n.custom_llm_extra_body=e.customLlmExtraBody),e.dynamicVariables&&(n.dynamic_variables=e.dynamicVariables),e.userId&&(n.user_id=e.userId),null!=(t=e.overrides)&&t.client&&(n.source_info={source:e.overrides.client.source,version:e.overrides.client.version}),n}let hw=class e extends sw{constructor(e,t,n,i){super(),this.socket=void 0,this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.socket=e,this.conversationId=t,this.inputFormat=n,this.outputFormat=i,this.socket.addEventListener("error",e=>{setTimeout(()=>this.disconnect({reason:"error",message:"The connection was closed due to a socket error.",context:e}),0)}),this.socket.addEventListener("close",e=>{this.disconnect(1e3===e.code?{reason:"agent",context:e}:{reason:"error",message:e.reason||"The connection was closed by the server.",context:e})}),this.socket.addEventListener("message",e=>{try{const t=JSON.parse(e.data);if(!lw(t))return void this.debug({type:"invalid_event",message:"Received invalid socket event",data:e.data});this.handleMessage(t)}catch(t){this.debug({type:"parsing_error",message:"Failed to parse socket message",error:t instanceof Error?t.message:String(t),data:e.data})}})}static async create(t){let n=null;try{var i,o,r;const s=null!=(i=t.origin)?i:"wss://api.elevenlabs.io";let a;const c=(null==(o=t.overrides)||null==(o=o.client)?void 0:o.version)||cw,l=(null==(r=t.overrides)||null==(r=r.client)?void 0:r.source)||"js_sdk";if(t.signedUrl){const e=t.signedUrl.includes("?")?"&":"?";a=`${t.signedUrl}${e}source=${l}&version=${c}`}else a=`${s}/v1/convai/conversation?agent_id=${t.agentId}&source=${l}&version=${c}`;const d=["convai"];t.authorization&&d.push(`bearer.${t.authorization}`),n=new WebSocket(a,d);const u=await new Promise((e,i)=>{n.addEventListener("open",()=>{var e;const i=uw(t);null==(e=n)||e.send(JSON.stringify(i))},{once:!0}),n.addEventListener("error",e=>{setTimeout(()=>i(e),0)}),n.addEventListener("close",i),n.addEventListener("message",t=>{const n=JSON.parse(t.data);lw(n)&&"conversation_initiation_metadata"===n.type&&e(n.conversation_initiation_metadata_event)},{once:!0})}),{conversation_id:h,agent_output_audio_format:p,user_input_audio_format:m}=u,f=aw(null!=m?m:"pcm_16000"),g=aw(p);return new e(n,h,f,g)}catch(a){var s;throw null==(s=n)||s.close(),a}}close(){this.socket.close()}sendMessage(e){this.socket.send(JSON.stringify(e))}async setMicMuted(e){}};function pw(e){const t=new Uint8Array(e);return window.btoa(String.fromCharCode(...t))}function mw(e){const t=window.atob(e),n=t.length,i=new Uint8Array(n);for(let o=0;o<n;o++)i[o]=t.charCodeAt(o);return i.buffer}const fw=new Map;function gw(e,t){return async(n,i)=>{const o=fw.get(e);if(o)return n.addModule(o);if(i)try{return await n.addModule(i),void fw.set(e,i)}catch(a){throw new Error(`Failed to load the ${e} worklet module from path: ${i}. Error: ${a}`)}const r=new Blob([t],{type:"application/javascript"}),s=URL.createObjectURL(r);try{return await n.addModule(s),void fw.set(e,s)}catch(c){URL.revokeObjectURL(s)}try{const i=`data:application/javascript;base64,${btoa(t)}`;await n.addModule(i),fw.set(e,i)}catch(a){throw new Error(`Failed to load the ${e} worklet module. Make sure the browser supports AudioWorklets. If you are using a strict CSP, you may need to self-host the worklet files.`)}}}const vw=gw("rawAudioProcessor",'/*\n * ulaw encoding logic taken from the wavefile library\n * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js\n * USED BY @elevenlabs/client\n */\n\nconst BIAS = 0x84;\nconst CLIP = 32635;\nconst encodeTable = [\n 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,\n 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,\n 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,\n 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,\n 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7\n];\n\nfunction encodeSample(sample) {\n let sign;\n let exponent;\n let mantissa;\n let muLawSample;\n sign = (sample >> 8) & 0x80;\n if (sign !== 0) sample = -sample;\n sample = sample + BIAS;\n if (sample > CLIP) sample = CLIP;\n exponent = encodeTable[(sample>>7) & 0xFF];\n mantissa = (sample >> (exponent+3)) & 0x0F;\n muLawSample = ~(sign | (exponent << 4) | mantissa);\n \n return muLawSample;\n}\n\nclass RawAudioProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n \n this.port.onmessage = ({ data }) => {\n switch (data.type) {\n case "setFormat":\n this.isMuted = false;\n this.buffer = []; // Initialize an empty buffer\n this.bufferSize = data.sampleRate / 4;\n this.format = data.format;\n\n if (globalThis.LibSampleRate && sampleRate !== data.sampleRate) {\n globalThis.LibSampleRate.create(1, sampleRate, data.sampleRate).then(resampler => {\n this.resampler = resampler;\n });\n }\n break;\n case "setMuted":\n this.isMuted = data.isMuted;\n break;\n }\n };\n }\n process(inputs) {\n if (!this.buffer) {\n return true;\n }\n \n const input = inputs[0]; // Get the first input node\n if (input.length > 0) {\n let channelData = input[0]; // Get the first channel\'s data\n\n // Resample the audio if necessary\n if (this.resampler) {\n channelData = this.resampler.full(channelData);\n }\n\n // Add channel data to the buffer\n this.buffer.push(...channelData);\n // Get max volume \n let sum = 0.0;\n for (let i = 0; i < channelData.length; i++) {\n sum += channelData[i] * channelData[i];\n }\n const maxVolume = Math.sqrt(sum / channelData.length);\n // Check if buffer size has reached or exceeded the threshold\n if (this.buffer.length >= this.bufferSize) {\n const float32Array = this.isMuted \n ? new Float32Array(this.buffer.length)\n : new Float32Array(this.buffer);\n\n let encodedArray = this.format === "ulaw"\n ? new Uint8Array(float32Array.length)\n : new Int16Array(float32Array.length);\n\n // Iterate through the Float32Array and convert each sample to PCM16\n for (let i = 0; i < float32Array.length; i++) {\n // Clamp the value to the range [-1, 1]\n let sample = Math.max(-1, Math.min(1, float32Array[i]));\n\n // Scale the sample to the range [-32768, 32767]\n let value = sample < 0 ? sample * 32768 : sample * 32767;\n if (this.format === "ulaw") {\n value = encodeSample(Math.round(value));\n }\n\n encodedArray[i] = value;\n }\n\n // Send the buffered data to the main script\n this.port.postMessage([encodedArray, maxVolume]);\n\n // Clear the buffer after sending\n this.buffer = [];\n }\n }\n return true; // Continue processing\n }\n}\nregisterProcessor("rawAudioProcessor", RawAudioProcessor);\n');let bw=class e extends sw{constructor(e,t,n,i,o={}){super(o),this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.room=void 0,this.isConnected=!1,this.audioEventId=1,this.audioCaptureContext=null,this.audioElements=[],this.outputDeviceId=null,this.outputAnalyser=null,this.outputFrequencyData=null,this.room=e,this.conversationId=t,this.inputFormat=n,this.outputFormat=i,this.setupRoomEventListeners()}static async create(t){let n;if("conversationToken"in t&&t.conversationToken)n=t.conversationToken;else{if(!("agentId"in t)||!t.agentId)throw new Error("Either conversationToken or agentId is required for WebRTC connection");try{var i,o,r;const e=(null==(i=t.overrides)||null==(i=i.client)?void 0:i.version)||cw,a=(null==(o=t.overrides)||null==(o=o.client)?void 0:o.source)||"js_sdk",c=`${s=null!=(r=t.origin)?r:"https://api.elevenlabs.io",s.replace(/^wss:\/\//,"https://")}/v1/convai/conversation/token?agent_id=${t.agentId}&source=${a}&version=${e}`,l=await fetch(c);if(!l.ok)throw new Error(`ElevenLabs API returned ${l.status} ${l.statusText}`);if(n=(await l.json()).token,!n)throw new Error("No conversation token received from API")}catch(Bx){let n=Bx instanceof Error?Bx.message:String(Bx);throw Bx instanceof Error&&Bx.message.includes("401")&&(n="Your agent has authentication enabled, but no signed URL or conversation token was provided."),new Error(`Failed to fetch conversation token for agent ${t.agentId}: ${n}`)}}var s;const a=new Xk;try{const i=`room_${Date.now()}`,o=aw("pcm_48000"),r=aw("pcm_48000"),s=new e(a,i,o,r,t),l=t.livekitUrl||"wss://livekit.rtc.elevenlabs.io";var c;await a.connect(l,n),await new Promise(e=>{if(s.isConnected)e();else{const t=()=>{a.off(mv.Connected,t),e()};a.on(mv.Connected,t)}}),a.name&&(s.conversationId=(null==(c=a.name.match(/(conv_[a-zA-Z0-9]+)/))?void 0:c[0])||a.name),await a.localParticipant.setMicrophoneEnabled(!0);const d=uw(t);return s.debug({type:dw,message:d}),await s.sendMessage(d),s}catch(Bx){throw await a.disconnect(),Bx}}setupRoomEventListeners(){var e=this;this.room.on(mv.Connected,async function(){e.isConnected=!0}),this.room.on(mv.Disconnected,e=>{this.isConnected=!1,this.disconnect({reason:"agent",context:new CloseEvent("close",{reason:null==e?void 0:e.toString()})})}),this.room.on(mv.ConnectionStateChanged,e=>{e===Tk.Disconnected&&(this.isConnected=!1,this.disconnect({reason:"error",message:`LiveKit connection state changed to ${e}`,context:new Event("connection_state_changed")}))}),this.room.on(mv.DataReceived,(e,t)=>{try{const t=JSON.parse((new TextDecoder).decode(e));if("audio"===t.type)return;lw(t)&&this.handleMessage(t)}catch(n){}}),this.room.on(mv.TrackSubscribed,async function(t,n,i){if(t.kind===$v.Kind.Audio&&i.identity.includes("agent")){const n=t,i=n.attach();if(i.autoplay=!0,i.controls=!1,e.outputDeviceId&&i.setSinkId)try{await i.setSinkId(e.outputDeviceId)}catch(o){}i.style.display="none",document.body.appendChild(i),e.audioElements.push(i),1===e.audioElements.length&&(null==e.onDebug||e.onDebug({type:"audio_element_ready"})),await e.setupAudioCapture(n)}}),this.room.on(mv.ActiveSpeakersChanged,async function(t){e.updateMode(t.length>0&&t[0].identity.startsWith("agent")?"speaking":"listening")})}close(){if(this.isConnected){try{this.room.localParticipant.audioTrackPublications.forEach(e=>{e.track&&e.track.stop()})}catch(Bx){}this.audioCaptureContext&&(this.audioCaptureContext.close().catch(e=>{}),this.audioCaptureContext=null),this.audioElements.forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),this.audioElements=[],this.room.disconnect()}}async sendMessage(e){if(this.isConnected&&this.room.localParticipant&&!("user_audio_chunk"in e))try{const t=(new TextEncoder).encode(JSON.stringify(e));await this.room.localParticipant.publishData(t,{reliable:!0})}catch(t){this.debug({type:"send_message_error",message:{message:e,error:t}})}}getRoom(){return this.room}async setMicMuted(e){if(!this.isConnected||!this.room.localParticipant)return;const t=this.room.localParticipant.getTrackPublication($v.Source.Microphone);if(null!=t&&t.track)try{e?await t.track.mute():await t.track.unmute()}catch(n){await this.room.localParticipant.setMicrophoneEnabled(!e)}else await this.room.localParticipant.setMicrophoneEnabled(!e)}async setupAudioCapture(e){try{const t=new AudioContext;this.audioCaptureContext=t,this.outputAnalyser=t.createAnalyser(),this.outputAnalyser.fftSize=2048,this.outputAnalyser.smoothingTimeConstant=.8;const n=new MediaStream([e.mediaStreamTrack]),i=t.createMediaStreamSource(n);i.connect(this.outputAnalyser),await vw(t.audioWorklet);const o=new AudioWorkletNode(t,"rawAudioProcessor");this.outputAnalyser.connect(o),o.port.postMessage({type:"setFormat",format:this.outputFormat.format,sampleRate:this.outputFormat.sampleRate}),o.port.onmessage=e=>{const[t,n]=e.data;if(n>.01){const e=pw(t.buffer),n=this.audioEventId++;this.handleMessage({type:"audio",audio_event:{audio_base_64:e,event_id:n}})}},i.connect(o)}catch(t){}}setAudioVolume(e){this.audioElements.forEach(t=>{t.volume=e})}async setAudioOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");const t=this.audioElements.map(async function(t){try{await t.setSinkId(e)}catch(n){throw n}});await Promise.all(t),this.outputDeviceId=e}async setAudioInputDevice(e){if(!this.isConnected||!this.room.localParticipant)throw new Error("Cannot change input device: room not connected or no local participant");try{const t=this.room.localParticipant.getTrackPublication($v.Source.Microphone);null!=t&&t.track&&(await t.track.stop(),await this.room.localParticipant.unpublishTrack(t.track));const n={deviceId:{exact:e},echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}},i=await function(e){return $f(this,void 0,void 0,function*(){return(yield Zk({audio:null==e||e,video:!1}))[0]})}(n);await this.room.localParticipant.publishTrack(i,{name:"microphone",source:$v.Source.Microphone})}catch(t){try{await this.room.localParticipant.setMicrophoneEnabled(!0)}catch(n){}throw t}}getOutputByteFrequencyData(){return this.outputAnalyser?(null!=this.outputFrequencyData||(this.outputFrequencyData=new Uint8Array(this.outputAnalyser.frequencyBinCount)),this.outputAnalyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData):null}};async function yw(e){const t=(n=e).connectionType?n.connectionType:"conversationToken"in n&&n.conversationToken?"webrtc":"websocket";var n;switch(t){case"websocket":return hw.create(e);case"webrtc":return bw.create(e);default:throw new Error(`Unknown connection type: ${t}`)}}function kw(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}async function ww(e={default:0,android:3e3}){let t=e.default;var n;if(/android/i.test(navigator.userAgent))t=null!=(n=e.android)?n:t;else if(kw()){var i;t=null!=(i=e.ios)?i:t}t>0&&await new Promise(e=>setTimeout(e,t))}let Cw=class e extends rw{static async startSession(t){const n=rw.getFullOptions(t);n.onStatusChange&&n.onStatusChange({status:"connecting"}),n.onCanSendFeedbackChange&&n.onCanSendFeedbackChange({canSendFeedback:!1}),n.onModeChange&&n.onModeChange({mode:"listening"}),n.onCanSendFeedbackChange&&n.onCanSendFeedbackChange({canSendFeedback:!1});let i=null;try{return await ww(n.connectionDelay),i=await yw(t),new e(n,i)}catch(r){var o;throw n.onStatusChange&&n.onStatusChange({status:"disconnected"}),null==(o=i)||o.close(),r}}};const Sw={echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:{ideal:1}};let Tw=class e{static async create({sampleRate:t,format:n,preferHeadphonesForIosDevices:i,inputDeviceId:o,workletPaths:r,libsampleratePath:s}){let a=null,c=null;try{const l=iw({sampleRate:{ideal:t}},Sw);if(kw()&&i){const e=(await window.navigator.mediaDevices.enumerateDevices()).find(e=>"audioinput"===e.kind&&["airpod","headphone","earphone"].find(t=>e.label.toLowerCase().includes(t)));e&&(l.deviceId={ideal:e.deviceId})}o&&(l.deviceId={exact:o});const d=navigator.mediaDevices.getSupportedConstraints().sampleRate;a=new window.AudioContext(d?{sampleRate:t}:{});const u=a.createAnalyser();if(!d){const e=s||"https://cdn.jsdelivr.net/npm/@alexanderolsen/libsamplerate-js@2.1.2/dist/libsamplerate.worklet.js";await a.audioWorklet.addModule(e)}await vw(a.audioWorklet,null==r?void 0:r.rawAudioProcessor);const h=iw({voiceIsolation:!0},l);c=await navigator.mediaDevices.getUserMedia({audio:h});const p=a.createMediaStreamSource(c),m=new AudioWorkletNode(a,"rawAudioProcessor");return m.port.postMessage({type:"setFormat",format:n,sampleRate:t}),p.connect(u),u.connect(m),await a.resume(),new e(a,u,m,c,p)}catch(u){var l,d;throw null==(l=c)||l.getTracks().forEach(e=>{e.stop()}),null==(d=a)||d.close(),u}}constructor(e,t,n,i,o){this.context=void 0,this.analyser=void 0,this.worklet=void 0,this.inputStream=void 0,this.mediaStreamSource=void 0,this.context=e,this.analyser=t,this.worklet=n,this.inputStream=i,this.mediaStreamSource=o}async close(){this.inputStream.getTracks().forEach(e=>{e.stop()}),this.mediaStreamSource.disconnect(),await this.context.close()}setMuted(e){this.worklet.port.postMessage({type:"setMuted",isMuted:e})}async setInputDevice(e){try{const t=iw({},Sw);e&&(t.deviceId={exact:e});const n=iw({voiceIsolation:!0},t),i=await navigator.mediaDevices.getUserMedia({audio:n});this.inputStream.getTracks().forEach(e=>{e.stop()}),this.mediaStreamSource.disconnect(),this.inputStream=i,this.mediaStreamSource=this.context.createMediaStreamSource(i),this.mediaStreamSource.connect(this.analyser)}catch(t){throw t}}};const xw=gw("audioConcatProcessor",'/*\n * ulaw decoding logic taken from the wavefile library\n * https://github.com/rochars/wavefile/blob/master/lib/codecs/mulaw.js\n * USED BY @elevenlabs/client\n */\n\nconst decodeTable = [0,132,396,924,1980,4092,8316,16764];\n\nfunction decodeSample(muLawSample) {\n let sign;\n let exponent;\n let mantissa;\n let sample;\n muLawSample = ~muLawSample;\n sign = (muLawSample & 0x80);\n exponent = (muLawSample >> 4) & 0x07;\n mantissa = muLawSample & 0x0F;\n sample = decodeTable[exponent] + (mantissa << (exponent+3));\n if (sign !== 0) sample = -sample;\n\n return sample;\n}\n\nclass AudioConcatProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.buffers = []; // Initialize an empty buffer\n this.cursor = 0;\n this.currentBuffer = null;\n this.wasInterrupted = false;\n this.finished = false;\n \n this.port.onmessage = ({ data }) => {\n switch (data.type) {\n case "setFormat":\n this.format = data.format;\n break;\n case "buffer":\n this.wasInterrupted = false;\n this.buffers.push(\n this.format === "ulaw"\n ? new Uint8Array(data.buffer)\n : new Int16Array(data.buffer)\n );\n break;\n case "interrupt":\n this.wasInterrupted = true;\n break;\n case "clearInterrupted":\n if (this.wasInterrupted) {\n this.wasInterrupted = false;\n this.buffers = [];\n this.currentBuffer = null;\n }\n }\n };\n }\n process(_, outputs) {\n let finished = false;\n const output = outputs[0][0];\n for (let i = 0; i < output.length; i++) {\n if (!this.currentBuffer) {\n if (this.buffers.length === 0) {\n finished = true;\n break;\n }\n this.currentBuffer = this.buffers.shift();\n this.cursor = 0;\n }\n\n let value = this.currentBuffer[this.cursor];\n if (this.format === "ulaw") {\n value = decodeSample(value);\n }\n output[i] = value / 32768;\n this.cursor++;\n\n if (this.cursor >= this.currentBuffer.length) {\n this.currentBuffer = null;\n }\n }\n\n if (this.finished !== finished) {\n this.finished = finished;\n this.port.postMessage({ type: "process", finished });\n }\n\n return true; // Continue processing\n }\n}\n\nregisterProcessor("audioConcatProcessor", AudioConcatProcessor);\n');let Ew=class e{static async create({sampleRate:t,format:n,outputDeviceId:i,workletPaths:o}){let r=null,s=null;try{r=new AudioContext({sampleRate:t});const a=r.createAnalyser(),c=r.createGain();s=new Audio,s.src="",s.load(),s.autoplay=!0,s.style.display="none",document.body.appendChild(s);const l=r.createMediaStreamDestination();s.srcObject=l.stream,c.connect(a),a.connect(l),await xw(r.audioWorklet,null==o?void 0:o.audioConcatProcessor);const d=new AudioWorkletNode(r,"audioConcatProcessor");return d.port.postMessage({type:"setFormat",format:n}),d.connect(c),await r.resume(),i&&s.setSinkId&&await s.setSinkId(i),new e(r,a,c,d,s)}catch(l){var a,c;throw null!=(a=s)&&a.parentNode&&s.parentNode.removeChild(s),null==(c=s)||c.pause(),r&&"closed"!==r.state&&await r.close(),l}}constructor(e,t,n,i,o){this.context=void 0,this.analyser=void 0,this.gain=void 0,this.worklet=void 0,this.audioElement=void 0,this.context=e,this.analyser=t,this.gain=n,this.worklet=i,this.audioElement=o}async setOutputDevice(e){if(!("setSinkId"in HTMLAudioElement.prototype))throw new Error("setSinkId is not supported in this browser");await this.audioElement.setSinkId(e||"")}async close(){this.audioElement.parentNode&&this.audioElement.parentNode.removeChild(this.audioElement),this.audioElement.pause(),await this.context.close()}};class _w extends rw{static async startSession(e){var t;const n=rw.getFullOptions(e);n.onStatusChange&&n.onStatusChange({status:"connecting"}),n.onCanSendFeedbackChange&&n.onCanSendFeedbackChange({canSendFeedback:!1});let i=null,o=null,r=null,s=null,a=null;if(null==(t=e.useWakeLock)||t)try{a=await navigator.wakeLock.request("screen")}catch(m){}try{var c;return s=await navigator.mediaDevices.getUserMedia({audio:!0}),await ww(n.connectionDelay),o=await yw(e),[i,r]=await Promise.all([Tw.create(iw({},o.inputFormat,{preferHeadphonesForIosDevices:e.preferHeadphonesForIosDevices,inputDeviceId:e.inputDeviceId,workletPaths:e.workletPaths,libsampleratePath:e.libsampleratePath})),Ew.create(iw({},o.outputFormat,{outputDeviceId:e.outputDeviceId,workletPaths:e.workletPaths}))]),null==(c=s)||c.getTracks().forEach(e=>{e.stop()}),s=null,new _w(n,o,i,r,a)}catch(m){var l,d,u,h;n.onStatusChange&&n.onStatusChange({status:"disconnected"}),null==(l=s)||l.getTracks().forEach(e=>{e.stop()}),null==(d=o)||d.close(),await(null==(u=i)?void 0:u.close()),await(null==(h=r)?void 0:h.close());try{var p;await(null==(p=a)?void 0:p.release()),a=null}catch(f){}throw m}}constructor(e,t,n,i,o){super(e,t),this.input=void 0,this.output=void 0,this.wakeLock=void 0,this.inputFrequencyData=void 0,this.outputFrequencyData=void 0,this.onInputWorkletMessage=e=>{"connected"===this.status&&this.connection.sendMessage({user_audio_chunk:pw(e.data[0].buffer)})},this.onOutputWorkletMessage=({data:e})=>{"process"===e.type&&this.updateMode(e.finished?"listening":"speaking")},this.addAudioBase64Chunk=e=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"}),this.output.worklet.port.postMessage({type:"buffer",buffer:mw(e)})},this.fadeOutAudio=()=>{this.updateMode("listening"),this.output.worklet.port.postMessage({type:"interrupt"}),this.output.gain.gain.exponentialRampToValueAtTime(1e-4,this.output.context.currentTime+2),setTimeout(()=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"})},2e3)},this.calculateVolume=e=>{if(0===e.length)return 0;let t=0;for(let n=0;n<e.length;n++)t+=e[n]/255;return t/=e.length,t<0?0:t>1?1:t},this.setVolume=({volume:e})=>{const t=Number.isFinite(e)?Math.min(1,Math.max(0,e)):1;this.volume=t,this.connection instanceof bw?this.connection.setAudioVolume(t):this.output.gain.gain.value=t},this.input=n,this.output=i,this.wakeLock=o,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.output.worklet.port.onmessage=this.onOutputWorkletMessage}async handleEndSession(){await super.handleEndSession();try{var e;await(null==(e=this.wakeLock)?void 0:e.release()),this.wakeLock=null}catch(t){}await this.input.close(),await this.output.close()}handleInterruption(e){super.handleInterruption(e),this.fadeOutAudio()}handleAudio(e){var t,n;this.lastInterruptTimestamp<=e.audio_event.event_id&&(null==(t=(n=this.options).onAudio)||t.call(n,e.audio_event.audio_base_64),this.connection instanceof bw||this.addAudioBase64Chunk(e.audio_event.audio_base_64),this.currentEventId=e.audio_event.event_id,this.updateCanSendFeedback(),this.updateMode("speaking"))}setMicMuted(e){this.connection instanceof bw?this.connection.setMicMuted(e):this.input.setMuted(e)}getInputByteFrequencyData(){return null!=this.inputFrequencyData||(this.inputFrequencyData=new Uint8Array(this.input.analyser.frequencyBinCount)),this.input.analyser.getByteFrequencyData(this.inputFrequencyData),this.inputFrequencyData}getOutputByteFrequencyData(){return this.connection instanceof bw?this.connection.getOutputByteFrequencyData()||new Uint8Array(1024):(null!=this.outputFrequencyData||(this.outputFrequencyData=new Uint8Array(this.output.analyser.frequencyBinCount)),this.output.analyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData)}getInputVolume(){return this.calculateVolume(this.getInputByteFrequencyData())}getOutputVolume(){return this.calculateVolume(this.getOutputByteFrequencyData())}async changeInputDevice({sampleRate:e,format:t,preferHeadphonesForIosDevices:n,inputDeviceId:i}){try{if(this.connection instanceof hw)try{return await this.input.setInputDevice(i),this.input}catch(o){}this.connection instanceof bw&&await this.connection.setAudioInputDevice(i||""),await this.input.close();const r=await Tw.create({sampleRate:null!=e?e:this.connection.inputFormat.sampleRate,format:null!=t?t:this.connection.inputFormat.format,preferHeadphonesForIosDevices:n,inputDeviceId:i,workletPaths:this.options.workletPaths,libsampleratePath:this.options.libsampleratePath});return this.input=r,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.input}catch(o){throw o}}async changeOutputDevice({sampleRate:e,format:t,outputDeviceId:n}){try{if(this.connection instanceof hw)try{return await this.output.setOutputDevice(n),this.output}catch(i){}this.connection instanceof bw&&await this.connection.setAudioOutputDevice(n||""),await this.output.close();const o=await Ew.create({sampleRate:null!=e?e:this.connection.outputFormat.sampleRate,format:null!=t?t:this.connection.outputFormat.format,outputDeviceId:n,workletPaths:this.options.workletPaths});return this.output=o,this.output}catch(i){throw i}}}let Iw=class extends rw{static startSession(e){return e.textOnly?Cw.startSession(e):_w.startSession(e)}};var Pw=Object.defineProperty,Rw=(e,t)=>Pw(e,"name",{value:t,configurable:!0}),Aw=(e,t,n)=>((e,t,n)=>t in e?Pw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const Mw={class:"spinner max-w-sm"},Ow={class:"ring-circular h-full w-full origin-center",viewBox:"25 25 50 50"},Dw=Ln({__name:"FSpinner",props:{width:{type:String,default:""},colorMode:{type:String,default:"primary"}},setup:e=>(t,n)=>(Co(),Eo("div",Mw,[(Co(),Eo("svg",Ow,[Mo("circle",{class:me([e.colorMode,"ring-path"]),cx:"50",cy:"50",r:"20",fill:"none",stroke:"currentColor","stroke-width":"5","stroke-miterlimit":"30"},null,2)]))]))}),Nw={green:{50:"oklch(98.2% 0.018 155.826)",100:"oklch(96.2% 0.044 156.743)",200:"oklch(92.5% 0.084 155.995)",300:"oklch(87.1% 0.15 154.449)",400:"oklch(79.2% 0.209 151.711)",500:"oklch(72.3% 0.219 149.579)",600:"oklch(62.7% 0.194 149.214)",700:"oklch(52.7% 0.154 150.069)",800:"oklch(44.8% 0.119 151.328)",900:"oklch(39.3% 0.095 152.535)",950:"oklch(26.6% 0.065 152.934)"},blue:{50:"oklch(97% 0.014 254.604)",100:"oklch(93.2% 0.032 255.585)",200:"oklch(88.2% 0.059 254.128)",300:"oklch(80.9% 0.105 251.813)",400:"oklch(70.7% 0.165 254.624)",500:"oklch(62.3% 0.214 259.815)",600:"oklch(54.6% 0.245 262.881)",700:"oklch(48.8% 0.243 264.376)",800:"oklch(42.4% 0.199 265.638)",900:"oklch(37.9% 0.146 265.522)",950:"oklch(28.2% 0.091 267.935)"},rose:{50:"oklch(96.9% 0.015 12.422)",100:"oklch(94.1% 0.03 12.58)",200:"oklch(89.2% 0.058 10.001)",300:"oklch(81% 0.117 11.638)",400:"oklch(71.2% 0.194 13.428)",500:"oklch(64.5% 0.246 16.439)",600:"oklch(58.6% 0.253 17.585)",700:"oklch(51.4% 0.222 16.935)",800:"oklch(45.5% 0.188 13.697)",900:"oklch(41% 0.159 10.272)",950:"oklch(27.1% 0.105 12.094)"},cyan:{50:"oklch(98.4% 0.019 200.873)",100:"oklch(95.6% 0.045 203.388)",200:"oklch(91.7% 0.08 205.041)",300:"oklch(86.5% 0.127 207.078)",400:"oklch(78.9% 0.154 211.53)",500:"oklch(71.5% 0.143 215.221)",600:"oklch(60.9% 0.126 221.723)",700:"oklch(52% 0.105 223.128)",800:"oklch(45% 0.085 224.283)",900:"oklch(39.8% 0.07 227.392)",950:"oklch(30.2% 0.056 229.695)"},purple:{50:"oklch(97.7% 0.014 308.299)",100:"oklch(94.6% 0.033 307.174)",200:"oklch(90.2% 0.063 306.703)",300:"oklch(82.7% 0.119 306.383)",400:"oklch(71.4% 0.203 305.504)",500:"oklch(62.7% 0.265 303.9)",600:"oklch(55.8% 0.288 302.321)",700:"oklch(49.6% 0.265 301.924)",800:"oklch(43.8% 0.218 303.724)",900:"oklch(38.1% 0.176 304.987)",950:"oklch(29.1% 0.149 302.717)"},amber:{50:"oklch(98.7% 0.022 95.277)",100:"oklch(96.2% 0.059 95.617)",200:"oklch(92.4% 0.12 95.746)",300:"oklch(87.9% 0.169 91.605)",400:"oklch(82.8% 0.189 84.429)",500:"oklch(76.9% 0.188 70.08)",600:"oklch(66.6% 0.179 58.318)",700:"oklch(55.5% 0.163 48.998)",800:"oklch(47.3% 0.137 46.201)",900:"oklch(41.4% 0.112 45.904)",950:"oklch(27.9% 0.077 45.635)"},indigo:{50:"oklch(96.2% 0.018 272.314)",100:"oklch(93% 0.034 272.788)",200:"oklch(87% 0.065 274.039)",300:"oklch(78.5% 0.115 274.713)",400:"oklch(67.3% 0.182 276.935)",500:"oklch(58.5% 0.233 277.117)",600:"oklch(51.1% 0.262 276.966)",700:"oklch(45.7% 0.24 277.023)",800:"oklch(39.8% 0.195 277.366)",900:"oklch(35.9% 0.144 278.697)",950:"oklch(25.7% 0.09 281.288)"},pink:{50:"oklch(97.1% 0.014 343.198)",100:"oklch(94.8% 0.028 342.258)",200:"oklch(89.9% 0.061 343.231)",300:"oklch(82.3% 0.12 346.018)",400:"oklch(71.8% 0.202 349.761)",500:"oklch(65.6% 0.241 354.308)",600:"oklch(59.2% 0.249 0.584)",700:"oklch(52.5% 0.223 3.958)",800:"oklch(45.9% 0.187 3.815)",900:"oklch(40.8% 0.153 2.432)",950:"oklch(28.4% 0.109 3.907)"},teal:{50:"oklch(98.4% 0.014 180.72)",100:"oklch(95.3% 0.051 180.801)",200:"oklch(91% 0.096 180.426)",300:"oklch(85.5% 0.138 181.071)",400:"oklch(77.7% 0.152 181.912)",500:"oklch(70.4% 0.14 182.503)",600:"oklch(60% 0.118 184.704)",700:"oklch(51.1% 0.096 186.391)",800:"oklch(43.7% 0.078 188.216)",900:"oklch(38.6% 0.063 188.416)",950:"oklch(27.7% 0.046 192.524)"},sky:{50:"oklch(97.7% 0.013 236.62)",100:"oklch(95.1% 0.026 236.824)",200:"oklch(90.1% 0.058 230.902)",300:"oklch(82.8% 0.111 230.318)",400:"oklch(74.6% 0.16 232.661)",500:"oklch(68.5% 0.169 237.323)",600:"oklch(58.8% 0.158 241.966)",700:"oklch(50% 0.134 242.749)",800:"oklch(44.3% 0.11 240.79)",900:"oklch(39.1% 0.09 240.876)",950:"oklch(29.3% 0.066 243.157)"}};function Lw(e){return Nw[e]||Nw.blue}Rw(Lw,"getColorSchemeOklch");const jw=[{mode:"self",label:"Mode",icon:"i-tabler-north-star"},{mode:"talk",label:"Talk",icon:"i-tabler-phone"},{mode:"chat",label:"Chat",icon:"i-tabler-message-circle"},{mode:"info",label:"About",icon:"i-tabler-user-circle"}],Uw={bars:64,barWidth:3,barSpacing:1,minHeight:4,maxHeight:80,STIFFNESS:.18,DAMPING:.22,PEAK_HOLD_TIME:300,PEAK_DECAY_STIFFNESS:.12,PEAK_DECAY_DAMPING:.15},Fw=[85,100,120,140,155,170,185,200,215,230,245,260,275,290,315,340,355,375,400,425,450,475,500,530,560,590,630,670,700,730,780,820,880,940,1e3,1100,1200,1300,1400,1500,1600,1700,1800,1900,2e3,2200,2300,2500,2600,2800,3e3,3200,3500,3800,4e3,4300,4500,4800,5e3,5300,5500,5800,6e3,6500,7e3,7500,8e3,8500],Bw=class extends Ls{constructor(e){super("ClientAudio",e),Aw(this,"audioContext"),Aw(this,"analyser"),Aw(this,"microphone"),Aw(this,"audioLevelInterval"),Aw(this,"stream"),Aw(this,"visibilityChangeHandler"),Aw(this,"audioLevels",Ft({inputLevel:0,outputLevel:0})),this.setupVisibilityHandler()}setupVisibilityHandler(){typeof document>"u"||(this.visibilityChangeHandler=()=>{document.hidden?(this.logger.info("App backgrounded, suspending audio context"),this.handleAppBackground()):(this.logger.info("App foregrounded, resuming audio context"),this.handleAppForeground())},document.addEventListener("visibilitychange",this.visibilityChangeHandler,{passive:!0}),window.addEventListener("beforeunload",()=>{this.cleanup().catch(this.logger.error.bind(this,"Error during beforeunload cleanup"))},{passive:!0}))}handleAppBackground(){this.audioContext&&"running"===this.audioContext.state&&this.audioContext.suspend().catch(this.logger.error.bind(this,"Error suspending audio context")),this.audioLevelInterval&&(clearInterval(this.audioLevelInterval),this.audioLevelInterval=void 0)}handleAppForeground(){this.audioContext&&"suspended"===this.audioContext.state&&this.audioContext.resume().catch(this.logger.error.bind(this,"Error resuming audio context")),this.analyser&&!this.audioLevelInterval&&this.startAudioLevelMonitoring()}async requestMicrophonePermission(e={}){try{const{noiseSuppression:t=!0,echoCancellation:n=!0,autoGainControl:i=!0}=e;return this.stream=await navigator.mediaDevices.getUserMedia({audio:{noiseSuppression:t,echoCancellation:n,autoGainControl:i}}),this.logger.info("Microphone permission granted"),await this.setupAudioAnalysis(),!0}catch(t){return this.logger.error("Microphone permission denied:",t),!1}}async setupAudioAnalysis(){if(!this.stream)throw new Error("No audio stream available");try{this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.microphone=this.audioContext.createMediaStreamSource(this.stream),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.8,this.microphone.connect(this.analyser),this.logger.info("Audio analysis setup complete")}catch(e){throw this.logger.error("Failed to setup audio analysis:",e),e}}startAudioLevelMonitoring(e){if(!this.analyser)return void this.logger.info("Audio level monitoring not started - missing analyser");this.logger.info("Starting audio level monitoring at timestamp:",Date.now());const t=new Uint8Array(this.analyser.frequencyBinCount),n=Rw(async()=>{if(this.analyser)try{this.analyser.getByteFrequencyData(t);const n=t.reduce((e,t)=>e+t,0)/t.length,i=Math.min(n/128,1),o=e?.()?.3:0;this.audioLevels.value={inputLevel:i,outputLevel:o}}catch(n){this.logger.error("Error in audio level monitoring:",n),this.stopAudioLevelMonitoring()}else this.logger.info("Stopping audio level monitoring - missing analyser")},"updateLevels"),i=Rw(()=>{n().catch(e=>{this.logger.error("Async error in audio level monitoring:",e)})},"intervalWrapper");this.audioLevelInterval=window.setInterval(i,50)}stopAudioLevelMonitoring(){this.audioLevelInterval?(this.logger.info("Stopping audio level monitoring interval"),clearInterval(this.audioLevelInterval),this.audioLevelInterval=void 0):this.logger.info("No audio level monitoring interval to stop")}resetAudioLevels(){this.audioLevels.value={inputLevel:0,outputLevel:0}}isAudioContextAvailable(){return!!this.audioContext}getAudioContextState(){return this.audioContext?.state}getSharedAnalyser(){return this.analyser}async stopMicrophone(){this.stream&&(this.logger.info("Stopping microphone stream"),this.stream.getTracks().forEach(e=>{e.stop(),e.enabled=!1}),this.stream=void 0),this.stopAudioLevelMonitoring(),this.resetAudioLevels(),this.audioContext&&"closed"!==this.audioContext.state&&(await this.audioContext.close(),this.audioContext=void 0),this.analyser=void 0,this.microphone=void 0,this.logger.info("Microphone stopped")}async cleanup(){await this.stopMicrophone(),this.visibilityChangeHandler&&typeof document<"u"&&(document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.visibilityChangeHandler=void 0),this.logger.info("Audio resources cleaned up")}};Rw(Bw,"ClientAudio");let zw=Bw;function Vw(e){return e?"string"==typeof e?e:e.src||"":""}function $w(e){return Vw(e.cover)||Vw(e.avatar)||"/img/placeholder-avatar.png"}function qw(){return"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+"}function Ww(e){const t=e.target;t.dataset.fallbackUsed||(t.dataset.fallbackUsed="true",t.src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+")}function Hw(e){const{message:t}=e;if(!t)return null;if("string"==typeof t)return t.trim()?{text:t.trim(),sender:"agent"}:null;if("object"!=typeof t)return null;const n=[e=>{if(!("source"in e))return null;const t={user:"user",ai:"agent",agent:"agent"}[e.source];return t?{text:e.message||"",sender:t}:null}];for(const i of n){const e=i(t);if(e&&e.text.trim())return{text:e.text.trim(),sender:e.sender}}return null}Rw(Vw,"getImageSrc"),Rw($w,"getSelfAvatarUrl"),Rw(qw,"getFallbackAvatarDataUrl"),Rw(Ww,"handleImageError"),Rw(Hw,"parseVoiceMessage"),Rw(function(e){const{name:t,context:n}=e;return"welcome"===n?`Welcome to Fiction! I'm ${t}, your digital self. I'm here to help you understand how I can represent you and assist with your daily tasks. What would you like to know about how I work?`:"onboarding"===n?`Hi! I'm ${t}, your newly created digital self. I can handle conversations, answer questions about your expertise, and represent you professionally. Ready to see what I can do?`:`Hello! I'm ${t}. How can I help you today?`},"generateFirstMessage");const Gw=class extends Ls{constructor(e){if(super("SelfController",e),Aw(this,"conversation"),Aw(this,"isTextMode",!1),Aw(this,"lastMessage",{hash:"",time:0}),Aw(this,"clientAudio"),Aw(this,"unwatchAudio"),Aw(this,"isConnecting",!1),Aw(this,"sessionId"),Aw(this,"conversationStartTime"),Aw(this,"chatCharacterCount",0),Aw(this,"hostParticipantId"),Aw(this,"visitorParticipantId"),Aw(this,"voiceState",Ft({isActive:!1,isConnected:!1,isSpeaking:!1,isListening:!1,transcript:"Tap to begin voice conversation",connectionStatus:"disconnected"})),Aw(this,"textState",Ft({isActive:!1,isConnected:!1,isThinking:!1,connectionStatus:"disconnected"})),Aw(this,"agentMode",Ft("self")),Aw(this,"sharedMessages",Ft([])),!e.self.elevenlabsAgentId||""===e.self.elevenlabsAgentId.trim())throw new Error(`Agent ID is required for SelfController. Self "${e.self.name}" (${e.self.selfId}) does not have a valid elevenlabsAgentId.`);this.clientAudio=new zw(e),this.setupModeWatcher()}get audioLevels(){return this.clientAudio.audioLevels}getClientAudio(){return this.clientAudio}getOutputFrequencyData(){if(!this.conversation)return null;try{const e=this.conversation.getOutputByteFrequencyData();return e&&e.length>0?(Array.from(e).filter(e=>Number(e)>0).length,Math.max(...Array.from(e)),Array.from(e).reduce((e,t)=>e+Number(t),0),e.length,new Uint8Array(e)):null}catch(e){return null}}isDuplicateMessage(e,t){const n=`${t}:${e.toLowerCase().trim()}`,i=Date.now(),o=n===this.lastMessage.hash&&i-this.lastMessage.time<500;return o||(this.lastMessage={hash:n,time:i}),o}addMessage(e,t){this.isDuplicateMessage(e,t)||(this.sharedMessages.value=[...this.sharedMessages.value,{id:Date.now().toString(),text:e,sender:t,timestamp:new Date}])}getDynamicSettings(){return{dynamicVariables:{context:this.settings.context||"",firstMessage:this.settings.firstMessage||""},overrides:{agent:this.settings.firstMessage?{firstMessage:this.settings.firstMessage}:{}}}}updateState(e,t){e.value={...e.value,...t}}resetState(e){e?this.updateState(this.textState,{isActive:!1,isConnected:!1,isThinking:!1,connectionStatus:"disconnected",error:void 0}):(this.updateState(this.voiceState,{isActive:!1,isConnected:!1,isSpeaking:!1,isListening:!1,transcript:"Ready to start a call...",connectionStatus:"disconnected",error:void 0}),this.clientAudio.resetAudioLevels())}setupModeWatcher(){to(this.agentMode,async(e,t)=>{this.logger.info(`Mode changed from ${t} to ${e}`),this.conversation&&("talk"===t||"chat"===t)&&await this.endConversation()})}handleMessage(e,t){const n=Hw(e);if(n&&(this.addMessage(n.text,n.sender),!t&&"agent"===n.sender&&this.updateState(this.textState,{isThinking:!1}),this.sessionId&&this.hostParticipantId&&this.visitorParticipantId)){const e="agent"===n.sender?this.hostParticipantId:this.visitorParticipantId,{sdk:t}=this.settings;t.saveMessage({conversationId:this.sessionId,participantId:e,content:n.text,role:"agent"===n.sender?"agent":"user"}).catch(e=>{this.logger.warn("Failed to save message",{error:e})})}}handleError(e,t){const n=e.message;this.logger.error("Conversation error:",e),this.resetState(t),t?this.updateState(this.voiceState,{error:n,connectionStatus:"error",transcript:"Failed to start call."}):this.updateState(this.textState,{error:n,connectionStatus:"error"})}async setMode(e){this.agentMode.value!==e&&(this.agentMode.value=e)}async startVoiceConversation(e={}){if(this.isConnecting)return void this.logger.info("Voice conversation already connecting, ignoring duplicate request");if(this.isConnecting=!0,this.isTextMode=!1,this.updateState(this.voiceState,{isActive:!0,transcript:"Connecting...",connectionStatus:"connecting"}),!(await this.clientAudio.requestMicrophonePermission()))throw this.isConnecting=!1,this.updateState(this.voiceState,{isActive:!1,error:"Microphone permission required",transcript:"Failed to get microphone permission",connectionStatus:"error"}),new Error("Microphone permission required");await this.startSession("voice");const t=this.getDynamicSettings(),n=this.settings.self.elevenlabsAgentId;this.logger.info("Starting voice conversation...",{agentId:n,dynamicSettings:t});try{this.conversation=await Iw.startSession({agentId:n,connectionType:"websocket",...t,onConnect:Rw(()=>{this.isConnecting=!1,this.clientAudio.startAudioLevelMonitoring(()=>this.isVoiceConnected()),this.updateState(this.voiceState,{isConnected:!0,isListening:!0,transcript:"Connected! Start speaking...",connectionStatus:"connected"}),e.onConnect?.(),e.onAudioLevel&&(this.unwatchAudio=to(this.audioLevels,e.onAudioLevel,{immediate:!0}))},"onConnect"),onDisconnect:Rw(()=>{this.logger.info("Voice conversation disconnected"),this.conversation=void 0,this.clientAudio.stopAudioLevelMonitoring(),this.endSession().catch(e=>{}),this.resetState(!1),e.onDisconnect?.()},"onDisconnect"),onError:Rw(t=>{let n=t;t.includes("does not exist")?n=`Agent not found: ${this.settings.self.elevenlabsAgentId}. Check ElevenLabs configuration.`:t.includes("limit")||t.includes("quota")?n="ElevenLabs account limit reached. Check your subscription and usage.":(t.includes("unauthorized")||t.includes("invalid"))&&(n="ElevenLabs API authentication failed. Check ELEVENLABS_API_KEY."),this.endSession().catch(e=>{}),this.handleError(new Error(n),!0),e.onError?.(new Error(n))},"onError"),onModeChange:Rw(t=>{const n="speaking"===t.mode;this.updateState(this.voiceState,{isSpeaking:n,isListening:!n,transcript:n?"Agent is speaking...":"Listening for your voice..."}),e.onModeChange?.(t.mode)},"onModeChange"),onMessage:Rw(t=>{this.handleMessage(t,!0),e.onMessage?.(t)},"onMessage")})}catch(i){throw this.isConnecting=!1,this.endSession().catch(e=>{}),this.handleError(i,!0),i}}async startTextConversation(e={}){if(this.isConnecting)this.logger.info("Text conversation already connecting, ignoring duplicate request");else{this.isConnecting=!0,this.isTextMode=!0,this.updateState(this.textState,{isActive:!0,connectionStatus:"connecting"}),await this.startSession("chat");try{this.conversation=await Iw.startSession({agentId:this.settings.self.elevenlabsAgentId,connectionType:"websocket",...this.getDynamicSettings(),textOnly:!0,onConnect:Rw(()=>{this.isConnecting=!1,this.updateState(this.textState,{isConnected:!0,connectionStatus:"connected"}),e.onConnect?.()},"onConnect"),onDisconnect:Rw(()=>{this.conversation=void 0,this.endSession().catch(e=>{}),this.resetState(!0),e.onDisconnect?.()},"onDisconnect"),onError:Rw(t=>{let n=t;t.includes("does not exist")?n=`Agent not found: ${this.settings.self.elevenlabsAgentId}. Check ElevenLabs configuration.`:t.includes("limit")||t.includes("quota")?n="ElevenLabs account limit reached. Check your subscription and usage.":(t.includes("unauthorized")||t.includes("invalid"))&&(n="ElevenLabs API authentication failed. Check ELEVENLABS_API_KEY."),this.endSession().catch(e=>{}),this.handleError(new Error(n),!1),e.onError?.(new Error(n))},"onError"),onModeChange:Rw(t=>{e.onModeChange?.(t.mode)},"onModeChange"),onMessage:Rw(t=>{this.handleMessage(t,!1),e.onMessage?.(t)},"onMessage")})}catch(t){throw this.isConnecting=!1,this.endSession().catch(e=>{}),this.handleError(t,!1),t}}}async endConversation(){if(!this.conversation)return this.resetState(this.isTextMode),void(await this.clientAudio.stopMicrophone());try{await this.conversation.endSession()}finally{this.conversation=void 0,this.unwatchAudio?.(),this.unwatchAudio=void 0,this.resetState(this.isTextMode),this.isTextMode=!1,await this.clientAudio.stopMicrophone()}}async sendChatMessage(e){if(this.conversation&&this.isTextMode){this.addMessage(e,"user"),this.chatCharacterCount+=e.length;try{this.updateState(this.textState,{isThinking:!0}),this.conversation.sendUserMessage(e)}catch(t){this.handleError(t,!1)}}}isConnected(){return!!this.conversation}isVoiceConnected(){return this.isConnected()&&!this.isTextMode}isTextConnected(){return this.isConnected()&&this.isTextMode}async destroy(){await this.endConversation(),await this.clientAudio.cleanup(),this.endSession().catch(e=>{})}async startSession(e){const{self:t,sdk:n}=this.settings;if(this.conversationStartTime=new Date,this.chatCharacterCount=0,t.selfId&&t.orgId){const i=n.activeUser.value?.userId?void 0:n.generateAnonId(),o=await n.startConversation({selfId:t.selfId,userId:n.activeUser.value?.userId,anonId:i});if(o)return this.sessionId=o.conversationId,this.hostParticipantId=o.hostParticipantId,this.visitorParticipantId=o.visitorParticipantId,void this.logger.info("Started conversation session",{sessionId:this.sessionId,type:e,userId:n.activeUser.value?.userId,anonId:i,hostParticipantId:this.hostParticipantId,visitorParticipantId:this.visitorParticipantId})}this.sessionId=c(),this.logger.info("Started conversation session (fallback)",{sessionId:this.sessionId,type:e})}async endSession(){if(!this.sessionId||!this.conversationStartTime)return;const{self:e,sdk:t}=this.settings;if(!e.orgId||!t.activeUser.value?.userId)return this.logger.info("No org/user context - skipping usage recording"),void this.resetSession();const n=Math.round((Date.now()-this.conversationStartTime.getTime())/1e3),i=this.isTextMode?"chat":"voice",o="voice"===i?n:this.chatCharacterCount;if(!e.selfId)return this.logger.warn("Cannot track usage: selfId is undefined"),void this.resetSession();await t.trackUsage({selfId:e.selfId,type:i,quantity:o,participantId:t.activeUser.value?.userId})?this.logger.info("Recorded usage",{sessionId:this.sessionId,type:i,quantity:o,duration:n}):this.logger.warn("Failed to record usage - continuing normally"),this.resetSession()}resetSession(){this.sessionId=void 0,this.conversationStartTime=void 0,this.chatCharacterCount=0}};Rw(Gw,"SelfController");let Zw=Gw;const Jw=Ln({__name:"EffectTransitionList",props:{disabled:{type:Boolean,default:!1},mode:{default:"block"}},setup:e=>(t,n)=>(Co(),_o(Kr,{name:e.disabled?"":"nlist"},{default:vn(()=>[li(t.$slots,"default")]),_:3},8,["name"]))}),Kw={key:0,class:"absolute inset-0 flex items-center justify-center"},Yw=Ln({__name:"ElSelfButton",props:{theme:{default:"primary"},size:{default:"lg"},loading:{type:Boolean,default:!1},icon:{},iconAfter:{}},setup(e){const t=tr(()=>({primary:"bg-primary-600 border-primary-400 hover:border-primary-300 hover:bg-primary-500",green:"bg-green-600 border-green-400 hover:border-green-300 hover:bg-green-500",red:"bg-red-600 border-red-400 hover:border-red-300 hover:bg-red-500",default:"bg-white/10 border-white/20 hover:border-white/40 hover:bg-white/20"}[e.theme])),n=tr(()=>({sm:"px-4 py-2 text-sm",md:"px-6 py-3 text-base",lg:"px-8 py-4 text-base"}[e.size])),i=tr(()=>({sm:"size-4",md:"size-4",lg:"size-5"}[e.size]));return(o,r)=>(Co(),Eo("button",{class:me(["relative inline-flex items-center justify-center gap-2 font-medium rounded-full backdrop-blur-sm border-2 text-white transition-all duration-200 focus:outline-none active:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer",[t.value,n.value]])},[e.loading?(Co(),Eo("div",Kw,[...r[0]||(r[0]=[Mo("i",{class:"i-svg-spinners-90-ring-with-bg size-5"},null,-1)])])):Lo("",!0),Mo("span",{class:me(["flex items-center gap-2 transition-opacity duration-200",e.loading?"opacity-0":"opacity-100"])},[e.icon?(Co(),Eo("i",{key:0,class:me([e.icon,i.value])},null,2)):Lo("",!0),li(o.$slots,"default"),e.iconAfter?(Co(),Eo("i",{key:1,class:me([e.iconAfter,i.value])},null,2)):Lo("",!0)],2)],2))}}),Qw=["value"],Xw=Ln({__name:"SelfInputEmail",props:{modelValue:{default:""}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(t,i)=>(Co(),Eo("input",{type:"email",autocomplete:"email",placeholder:"Enter Your Email",value:e.modelValue,class:"w-full px-6 py-3 text-theme-900 placeholder-theme-500 bg-white border border-white rounded-full focus:outline-none transition-all",style:{"font-size":"16px"},onInput:i[0]||(i[0]=e=>n("update:modelValue",e.target.value))},null,40,Qw))}}),eC={class:"flex gap-1.5 justify-center"},tC=["onUpdate:modelValue","onInput","onKeydown","onPaste","onFocus"],nC=Ln({__name:"SelfInputOneTimeCode",props:{modelValue:{},length:{},focusFirst:{type:Boolean}},emits:["update:modelValue","autoSubmit"],setup(e,{emit:t}){const n=e,i=t,o=Ft([]),r=Ft(Array.from({length:n.length}).fill("")),s=Ft(!1);function a(e,t){t.preventDefault(),s.value=!0;const i=(t.clipboardData?.getData("text")||"").replace(/\D/g,"");if(i.length===n.length)r.value=i.split(""),setTimeout(()=>{o.value[n.length-1]?.focus(),s.value=!1},10);else{const t=[...r.value];i.split("").slice(0,n.length-e).forEach((n,i)=>{t[e+i]=n}),r.value=t;const a=Math.min(e+i.length,n.length-1);setTimeout(()=>{o.value[a]?.focus(),s.value=!1},10)}}function c(e,t){const i=t.target.value.slice(-1).replace(/\D/g,"");r.value[e]=i,i&&e<n.length-1&&o.value[e+1]?.focus()}function l(e,t){"Backspace"===t.key?(t.preventDefault(),r.value[e]="",e>0&&o.value[e-1]?.focus()):"ArrowLeft"===t.key&&e>0?o.value[e-1]?.focus():"ArrowRight"===t.key&&e<n.length-1&&o.value[e+1]?.focus()}function d(e){if(o.value[e]?.select(),!s.value&&r.value[e])for(let t=e;t<n.length;t++)r.value[t]=""}return Kn(()=>{n.modelValue&&(r.value=n.modelValue.split("").slice(0,n.length)),n.focusFirst&&!("ontouchstart"in window)&&o.value[0]?.focus()}),to(()=>n.modelValue,e=>{r.value=e?e.split("").slice(0,n.length):Array.from({length:n.length}).fill("")}),to(r,()=>{const e=r.value.filter(Boolean).join("");i("update:modelValue",e),e.length===n.length&&i("autoSubmit",e)},{deep:!0}),Rw(a,"onPaste"),Rw(c,"onInput"),Rw(l,"onKeydown"),Rw(d,"onFocus"),(t,n)=>(Co(),Eo("div",eC,[(Co(!0),Eo(go,null,ci(e.length,e=>bn((Co(),Eo("input",{key:e,ref_for:!0,ref:Rw(t=>o.value[e-1]=t,"ref"),"onUpdate:modelValue":Rw(t=>r.value[e-1]=t,"onUpdate:modelValue"),type:"text",inputmode:"numeric",autocomplete:"one-time-code",class:"size-11 text-center font-mono text-theme-900 bg-white border border-white rounded-lg focus:outline-none transition-all",style:{"font-size":"16px"},maxlength:"1",onInput:Rw(t=>c(e-1,t),"onInput"),onKeydown:Rw(t=>l(e-1,t),"onKeydown"),onPaste:Rw(t=>a(e-1,t),"onPaste"),onFocus:Rw(t=>d(e-1),"onFocus")},null,40,tC)),[[os,r.value[e-1]]])),128))]))}}),iC={class:"flex flex-col items-center justify-center h-full p-6"},oC={class:"w-full max-w-xs space-y-12"},rC={key:0,class:"text-xs text-theme-400 text-center"},sC={class:"text-base font-light text-white text-center"},aC={class:"space-y-6 relative"},cC={key:"email-field",class:"w-full"},lC={key:"code-field",class:"w-full"},dC=Ln({__name:"ElAuthGate",props:{sdk:{}},setup(e){const t=Ft({email:"",code:""}),n=Ft("email"),i={email:{title:"Enter Your Email",button:{label:"Continue",disabled:Rw(()=>!t.value.email,"disabled")},action:Rw(async()=>{await e.sdk.requestAuthCode({email:t.value.email})&&(n.value="code")},"action")},code:{title:"Enter Verification Code",button:{label:"Verify",disabled:Rw(()=>6!==t.value.code.length,"disabled")},action:Rw(()=>e.sdk.loginWithCode({email:t.value.email,code:t.value.code}),"action")}},o=tr(()=>i[n.value]);return(i,r)=>(Co(),Eo("div",iC,[Mo("div",oC,[e.sdk.error.value?(Co(),Eo("p",rC,be(e.sdk.error.value),1)):Lo("",!0),Mo("h3",sC,be(o.value.title),1),Mo("div",aC,[Oo(Jw,null,{default:vn(()=>["email"===n.value?(Co(),Eo("div",cC,[Oo(Xw,{modelValue:t.value.email,"onUpdate:modelValue":r[0]||(r[0]=e=>t.value.email=e),onKeyup:ls(o.value.action,["enter"])},null,8,["modelValue","onKeyup"])])):(Co(),Eo("div",lC,[Oo(nC,{modelValue:t.value.code,"onUpdate:modelValue":r[1]||(r[1]=e=>t.value.code=e),length:6,"focus-first":!0,onAutoSubmit:o.value.action},null,8,["modelValue","onAutoSubmit"])])),(Co(),Eo("div",{key:o.value.button.label,class:"space-y-4 w-full"},[Oo(Yw,{theme:"primary",size:"md",class:"w-full",loading:e.sdk.loading.value,disabled:o.value.button.disabled()||e.sdk.loading.value,onClick:o.value.action},{default:vn(()=>[No(be(o.value.button.label),1)]),_:1},8,["loading","disabled","onClick"]),"code"===n.value?(Co(),Eo("button",{key:0,class:"w-full text-xs text-white/50 hover:text-white/70 transition-colors py-2",onClick:r[2]||(r[2]=e=>n.value="email")}," Change Email ")):Lo("",!0)]))]),_:1})])])]))}}),uC={class:"relative flex-shrink-0"},hC=["src","alt"],pC={key:0,class:"absolute top-1 right-1"},mC={class:"min-w-0"},fC=Ln({__name:"ElModeHeader",props:{self:{},size:{default:"md"},showOnlineIndicator:{type:Boolean,default:!0},layout:{default:"centered"}},setup(e){function t(){return e.self.avatar?.src?e.self.avatar.src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+"}return Rw(t,"getAvatarSrc"),(n,i)=>(Co(),Eo("div",{class:me(["flex gap-4",["centered"===e.layout?"flex-col items-center text-center":"flex-row items-center justify-center"]])},[Mo("div",uC,[Mo("div",{class:me(["rounded-full overflow-hidden border-white","lg"===e.size?"w-20 h-20 sm:w-24 sm:h-24 border-4":"w-16 sm:size-16 border-2"])},[Mo("img",{src:t(),alt:e.self.name,class:"w-full h-full object-cover",onError:i[0]||(i[0]=(...e)=>Vt(Ww)&&Vt(Ww)(...e))},null,40,hC)],2),e.showOnlineIndicator?(Co(),Eo("div",pC,[...i[1]||(i[1]=[Mo("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",style:{"animation-duration":"3s"}},null,-1),Mo("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white"},null,-1)])])):Lo("",!0)]),Mo("div",mC,[Mo("h1",{class:me(["font-light text-white mb-1 truncate",["lg"===e.size?"text-3xl mb-2":"text-xl sm:text-2xl tracking-wide leading-tight","horizontal"===e.layout?"text-white/95":""]])},be(e.self.name),3),Mo("p",{class:me(["font-light line-clamp-1",["lg"===e.size?"text-base text-white/60":"text-sm sm:text-base","horizontal"===e.layout?"text-white/70 truncate":"text-white/60"]])},be("horizontal"===e.layout?e.self.title||"Digital Self":e.self.title),3)])],2))}}),gC=Rw(e=>{const t=kC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:Rw(e=>{const n=e.split("-");return""===n[0]&&1!==n.length&&n.shift(),vC(n,t)||yC(e)},"getClassGroupId"),getConflictingClassGroupIds:Rw((e,t)=>{const o=n[e]||[];return t&&i[e]?[...o,...i[e]]:o},"getConflictingClassGroupIds")}},"createClassGroupUtils"),vC=Rw((e,t)=>{if(0===e.length)return t.classGroupId;const n=e[0],i=t.nextPart.get(n),o=i?vC(e.slice(1),i):void 0;if(o)return o;if(0===t.validators.length)return;const r=e.join("-");return t.validators.find(({validator:e})=>e(r))?.classGroupId},"getGroupRecursive"),bC=/^\[(.+)\]$/,yC=Rw(e=>{if(bC.test(e)){const t=bC.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},"getGroupIdForArbitraryProperty"),kC=Rw(e=>{const{theme:t,classGroups:n}=e,i={nextPart:new Map,validators:[]};for(const o in n)wC(n[o],i,o,t);return i},"createClassMap"),wC=Rw((e,t,n,i)=>{e.forEach(e=>{if("string"!=typeof e)return"function"==typeof e?SC(e)?void wC(e(i),t,n,i):void t.validators.push({validator:e,classGroupId:n}):void Object.entries(e).forEach(([e,o])=>{wC(o,CC(t,e),n,i)});(""===e?t:CC(t,e)).classGroupId=n})},"processClassesRecursively"),CC=Rw((e,t)=>{let n=e;return t.split("-").forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},"getPart"),SC=Rw(e=>e.isThemeGetter,"isThemeGetter"),TC=Rw(e=>{if(e<1)return{get:Rw(()=>{},"get"),set:Rw(()=>{},"set")};let t=0,n=new Map,i=new Map;const o=Rw((o,r)=>{n.set(o,r),t++,t>e&&(t=0,i=n,n=new Map)},"update");return{get(e){let t=n.get(e);return void 0!==t?t:void 0!==(t=i.get(e))?(o(e,t),t):void 0},set(e,t){n.has(e)?n.set(e,t):o(e,t)}}},"createLruCache"),xC=Rw(e=>{const{prefix:t,experimentalParseClassName:n}=e;let i=Rw(e=>{const t=[];let n,i=0,o=0,r=0;for(let c=0;c<e.length;c++){let s=e[c];if(0===i&&0===o){if(":"===s){t.push(e.slice(r,c)),r=c+1;continue}if("/"===s){n=c;continue}}"["===s?i++:"]"===s?i--:"("===s?o++:")"===s&&o--}const s=0===t.length?e:e.substring(r),a=EC(s);return{modifiers:t,hasImportantModifier:a!==s,baseClassName:a,maybePostfixModifierPosition:n&&n>r?n-r:void 0}},"parseClassName");if(t){const e=t+":",n=i;i=Rw(t=>t.startsWith(e)?n(t.substring(e.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:t,maybePostfixModifierPosition:void 0},"parseClassName")}if(n){const e=i;i=Rw(t=>n({className:t,parseClassName:e}),"parseClassName")}return i},"createParseClassName"),EC=Rw(e=>e.endsWith("!")?e.substring(0,e.length-1):e.startsWith("!")?e.substring(1):e,"stripImportantModifier"),_C=Rw(e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(e=>[e,!0]));return Rw(e=>{if(e.length<=1)return e;const n=[];let i=[];return e.forEach(e=>{"["===e[0]||t[e]?(n.push(...i.sort(),e),i=[]):i.push(e)}),n.push(...i.sort()),n},"sortModifiers")},"createSortModifiers"),IC=Rw(e=>({cache:TC(e.cacheSize),parseClassName:xC(e),sortModifiers:_C(e),...gC(e)}),"createConfigUtils"),PC=/\s+/,RC=Rw((e,t)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:r}=t,s=[],a=e.trim().split(PC);let c="";for(let l=a.length-1;l>=0;l-=1){const e=a[l],{isExternal:t,modifiers:d,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:p}=n(e);if(t){c=e+(c.length>0?" "+c:c);continue}let m=!!p,f=i(m?h.substring(0,p):h);if(!f){if(!m){c=e+(c.length>0?" "+c:c);continue}if(f=i(h),!f){c=e+(c.length>0?" "+c:c);continue}m=!1}const g=r(d).join(":"),v=u?g+"!":g,b=v+f;if(s.includes(b))continue;s.push(b);const y=o(f,m);for(let n=0;n<y.length;++n){const e=y[n];s.push(v+e)}c=e+(c.length>0?" "+c:c)}return c},"mergeClassList");function AC(){let e,t,n=0,i="";for(;n<arguments.length;)(e=arguments[n++])&&(t=MC(e))&&(i&&(i+=" "),i+=t);return i}Rw(AC,"twJoin");const MC=Rw(e=>{if("string"==typeof e)return e;let t,n="";for(let i=0;i<e.length;i++)e[i]&&(t=MC(e[i]))&&(n&&(n+=" "),n+=t);return n},"toValue");function OC(e,...t){let n,i,o,r=s;function s(s){const c=t.reduce((e,t)=>t(e),e());return n=IC(c),i=n.cache.get,o=n.cache.set,r=a,a(s)}function a(e){const t=i(e);if(t)return t;const r=RC(e,n);return o(e,r),r}return Rw(s,"initTailwindMerge"),Rw(a,"tailwindMerge"),Rw(function(){return r(AC.apply(null,arguments))},"callTailwindMerge")}Rw(OC,"createTailwindMerge");const DC=Rw(e=>{const t=Rw(t=>t[e]||[],"themeGetter");return t.isThemeGetter=!0,t},"fromTheme"),NC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,LC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,jC=/^\d+\/\d+$/,UC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,FC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,zC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,VC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$C=Rw(e=>jC.test(e),"isFraction"),qC=Rw(e=>!!e&&!Number.isNaN(Number(e)),"isNumber"),WC=Rw(e=>!!e&&Number.isInteger(Number(e)),"isInteger"),HC=Rw(e=>e.endsWith("%")&&qC(e.slice(0,-1)),"isPercent"),GC=Rw(e=>UC.test(e),"isTshirtSize"),ZC=Rw(()=>!0,"isAny"),JC=Rw(e=>FC.test(e)&&!BC.test(e),"isLengthOnly"),KC=Rw(()=>!1,"isNever"),YC=Rw(e=>zC.test(e),"isShadow"),QC=Rw(e=>VC.test(e),"isImage"),XC=Rw(e=>!tS(e)&&!aS(e),"isAnyNonArbitrary"),eS=Rw(e=>mS(e,bS,KC),"isArbitrarySize"),tS=Rw(e=>NC.test(e),"isArbitraryValue"),nS=Rw(e=>mS(e,yS,JC),"isArbitraryLength"),iS=Rw(e=>mS(e,kS,qC),"isArbitraryNumber"),oS=Rw(e=>mS(e,gS,KC),"isArbitraryPosition"),rS=Rw(e=>mS(e,vS,QC),"isArbitraryImage"),sS=Rw(e=>mS(e,CS,YC),"isArbitraryShadow"),aS=Rw(e=>LC.test(e),"isArbitraryVariable"),cS=Rw(e=>fS(e,yS),"isArbitraryVariableLength"),lS=Rw(e=>fS(e,wS),"isArbitraryVariableFamilyName"),dS=Rw(e=>fS(e,gS),"isArbitraryVariablePosition"),uS=Rw(e=>fS(e,bS),"isArbitraryVariableSize"),hS=Rw(e=>fS(e,vS),"isArbitraryVariableImage"),pS=Rw(e=>fS(e,CS,!0),"isArbitraryVariableShadow"),mS=Rw((e,t,n)=>{const i=NC.exec(e);return!!i&&(i[1]?t(i[1]):n(i[2]))},"getIsArbitraryValue"),fS=Rw((e,t,n=!1)=>{const i=LC.exec(e);return!!i&&(i[1]?t(i[1]):n)},"getIsArbitraryVariable"),gS=Rw(e=>"position"===e||"percentage"===e,"isLabelPosition"),vS=Rw(e=>"image"===e||"url"===e,"isLabelImage"),bS=Rw(e=>"length"===e||"size"===e||"bg-size"===e,"isLabelSize"),yS=Rw(e=>"length"===e,"isLabelLength"),kS=Rw(e=>"number"===e,"isLabelNumber"),wS=Rw(e=>"family-name"===e,"isLabelFamilyName"),CS=Rw(e=>"shadow"===e,"isLabelShadow"),SS=OC(Rw(()=>{const e=DC("color"),t=DC("font"),n=DC("text"),i=DC("font-weight"),o=DC("tracking"),r=DC("leading"),s=DC("breakpoint"),a=DC("container"),c=DC("spacing"),l=DC("radius"),d=DC("shadow"),u=DC("inset-shadow"),h=DC("text-shadow"),p=DC("drop-shadow"),m=DC("blur"),f=DC("perspective"),g=DC("aspect"),v=DC("ease"),b=DC("animate"),y=Rw(()=>["auto","avoid","all","avoid-page","page","left","right","column"],"scaleBreak"),k=Rw(()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],"scalePosition"),w=Rw(()=>[...k(),aS,tS],"scalePositionWithArbitrary"),C=Rw(()=>["auto","hidden","clip","visible","scroll"],"scaleOverflow"),S=Rw(()=>["auto","contain","none"],"scaleOverscroll"),T=Rw(()=>[aS,tS,c],"scaleUnambiguousSpacing"),x=Rw(()=>[$C,"full","auto",...T()],"scaleInset"),E=Rw(()=>[WC,"none","subgrid",aS,tS],"scaleGridTemplateColsRows"),_=Rw(()=>["auto",{span:["full",WC,aS,tS]},WC,aS,tS],"scaleGridColRowStartAndEnd"),I=Rw(()=>[WC,"auto",aS,tS],"scaleGridColRowStartOrEnd"),P=Rw(()=>["auto","min","max","fr",aS,tS],"scaleGridAutoColsRows"),R=Rw(()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],"scaleAlignPrimaryAxis"),A=Rw(()=>["start","end","center","stretch","center-safe","end-safe"],"scaleAlignSecondaryAxis"),M=Rw(()=>["auto",...T()],"scaleMargin"),O=Rw(()=>[$C,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],"scaleSizing"),D=Rw(()=>[e,aS,tS],"scaleColor"),N=Rw(()=>[...k(),dS,oS,{position:[aS,tS]}],"scaleBgPosition"),L=Rw(()=>["no-repeat",{repeat:["","x","y","space","round"]}],"scaleBgRepeat"),j=Rw(()=>["auto","cover","contain",uS,eS,{size:[aS,tS]}],"scaleBgSize"),U=Rw(()=>[HC,cS,nS],"scaleGradientStopPosition"),F=Rw(()=>["","none","full",l,aS,tS],"scaleRadius"),B=Rw(()=>["",qC,cS,nS],"scaleBorderWidth"),z=Rw(()=>["solid","dashed","dotted","double"],"scaleLineStyle"),V=Rw(()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"scaleBlendMode"),$=Rw(()=>[qC,HC,dS,oS],"scaleMaskImagePosition"),q=Rw(()=>["","none",m,aS,tS],"scaleBlur"),W=Rw(()=>["none",qC,aS,tS],"scaleRotate"),H=Rw(()=>["none",qC,aS,tS],"scaleScale"),G=Rw(()=>[qC,aS,tS],"scaleSkew"),Z=Rw(()=>[$C,"full",...T()],"scaleTranslate");return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[GC],breakpoint:[GC],color:[ZC],container:[GC],"drop-shadow":[GC],ease:["in","out","in-out"],font:[XC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[GC],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[GC],shadow:[GC],spacing:["px",qC],text:[GC],"text-shadow":[GC],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",$C,tS,aS,g]}],container:["container"],columns:[{columns:[qC,tS,aS,a]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:w()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:x()}],"inset-x":[{"inset-x":x()}],"inset-y":[{"inset-y":x()}],start:[{start:x()}],end:[{end:x()}],top:[{top:x()}],right:[{right:x()}],bottom:[{bottom:x()}],left:[{left:x()}],visibility:["visible","invisible","collapse"],z:[{z:[WC,"auto",aS,tS]}],basis:[{basis:[$C,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[qC,$C,"auto","initial","none",tS]}],grow:[{grow:["",qC,aS,tS]}],shrink:[{shrink:["",qC,aS,tS]}],order:[{order:[WC,"first","last","none",aS,tS]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:_()}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:_()}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":P()}],"auto-rows":[{"auto-rows":P()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...R(),"normal"]}],"justify-items":[{"justify-items":[...A(),"normal"]}],"justify-self":[{"justify-self":["auto",...A()]}],"align-content":[{content:["normal",...R()]}],"align-items":[{items:[...A(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...A(),{baseline:["","last"]}]}],"place-content":[{"place-content":R()}],"place-items":[{"place-items":[...A(),"baseline"]}],"place-self":[{"place-self":["auto",...A()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:O()}],w:[{w:[a,"screen",...O()]}],"min-w":[{"min-w":[a,"screen","none",...O()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...O()]}],h:[{h:["screen","lh",...O()]}],"min-h":[{"min-h":["screen","lh","none",...O()]}],"max-h":[{"max-h":["screen","lh",...O()]}],"font-size":[{text:["base",n,cS,nS]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,aS,iS]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",HC,tS]}],"font-family":[{font:[lS,tS,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,aS,tS]}],"line-clamp":[{"line-clamp":[qC,"none",aS,iS]}],leading:[{leading:[r,...T()]}],"list-image":[{"list-image":["none",aS,tS]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",aS,tS]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:D()}],"text-color":[{text:D()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...z(),"wavy"]}],"text-decoration-thickness":[{decoration:[qC,"from-font","auto",aS,nS]}],"text-decoration-color":[{decoration:D()}],"underline-offset":[{"underline-offset":[qC,"auto",aS,tS]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",aS,tS]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",aS,tS]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:N()}],"bg-repeat":[{bg:L()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},WC,aS,tS],radial:["",aS,tS],conic:[WC,aS,tS]},hS,rS]}],"bg-color":[{bg:D()}],"gradient-from-pos":[{from:U()}],"gradient-via-pos":[{via:U()}],"gradient-to-pos":[{to:U()}],"gradient-from":[{from:D()}],"gradient-via":[{via:D()}],"gradient-to":[{to:D()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":B()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...z(),"hidden","none"]}],"divide-style":[{divide:[...z(),"hidden","none"]}],"border-color":[{border:D()}],"border-color-x":[{"border-x":D()}],"border-color-y":[{"border-y":D()}],"border-color-s":[{"border-s":D()}],"border-color-e":[{"border-e":D()}],"border-color-t":[{"border-t":D()}],"border-color-r":[{"border-r":D()}],"border-color-b":[{"border-b":D()}],"border-color-l":[{"border-l":D()}],"divide-color":[{divide:D()}],"outline-style":[{outline:[...z(),"none","hidden"]}],"outline-offset":[{"outline-offset":[qC,aS,tS]}],"outline-w":[{outline:["",qC,cS,nS]}],"outline-color":[{outline:D()}],shadow:[{shadow:["","none",d,pS,sS]}],"shadow-color":[{shadow:D()}],"inset-shadow":[{"inset-shadow":["none",u,pS,sS]}],"inset-shadow-color":[{"inset-shadow":D()}],"ring-w":[{ring:B()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:D()}],"ring-offset-w":[{"ring-offset":[qC,nS]}],"ring-offset-color":[{"ring-offset":D()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":D()}],"text-shadow":[{"text-shadow":["none",h,pS,sS]}],"text-shadow-color":[{"text-shadow":D()}],opacity:[{opacity:[qC,aS,tS]}],"mix-blend":[{"mix-blend":[...V(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":V()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[qC]}],"mask-image-linear-from-pos":[{"mask-linear-from":$()}],"mask-image-linear-to-pos":[{"mask-linear-to":$()}],"mask-image-linear-from-color":[{"mask-linear-from":D()}],"mask-image-linear-to-color":[{"mask-linear-to":D()}],"mask-image-t-from-pos":[{"mask-t-from":$()}],"mask-image-t-to-pos":[{"mask-t-to":$()}],"mask-image-t-from-color":[{"mask-t-from":D()}],"mask-image-t-to-color":[{"mask-t-to":D()}],"mask-image-r-from-pos":[{"mask-r-from":$()}],"mask-image-r-to-pos":[{"mask-r-to":$()}],"mask-image-r-from-color":[{"mask-r-from":D()}],"mask-image-r-to-color":[{"mask-r-to":D()}],"mask-image-b-from-pos":[{"mask-b-from":$()}],"mask-image-b-to-pos":[{"mask-b-to":$()}],"mask-image-b-from-color":[{"mask-b-from":D()}],"mask-image-b-to-color":[{"mask-b-to":D()}],"mask-image-l-from-pos":[{"mask-l-from":$()}],"mask-image-l-to-pos":[{"mask-l-to":$()}],"mask-image-l-from-color":[{"mask-l-from":D()}],"mask-image-l-to-color":[{"mask-l-to":D()}],"mask-image-x-from-pos":[{"mask-x-from":$()}],"mask-image-x-to-pos":[{"mask-x-to":$()}],"mask-image-x-from-color":[{"mask-x-from":D()}],"mask-image-x-to-color":[{"mask-x-to":D()}],"mask-image-y-from-pos":[{"mask-y-from":$()}],"mask-image-y-to-pos":[{"mask-y-to":$()}],"mask-image-y-from-color":[{"mask-y-from":D()}],"mask-image-y-to-color":[{"mask-y-to":D()}],"mask-image-radial":[{"mask-radial":[aS,tS]}],"mask-image-radial-from-pos":[{"mask-radial-from":$()}],"mask-image-radial-to-pos":[{"mask-radial-to":$()}],"mask-image-radial-from-color":[{"mask-radial-from":D()}],"mask-image-radial-to-color":[{"mask-radial-to":D()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":k()}],"mask-image-conic-pos":[{"mask-conic":[qC]}],"mask-image-conic-from-pos":[{"mask-conic-from":$()}],"mask-image-conic-to-pos":[{"mask-conic-to":$()}],"mask-image-conic-from-color":[{"mask-conic-from":D()}],"mask-image-conic-to-color":[{"mask-conic-to":D()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:N()}],"mask-repeat":[{mask:L()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",aS,tS]}],filter:[{filter:["","none",aS,tS]}],blur:[{blur:q()}],brightness:[{brightness:[qC,aS,tS]}],contrast:[{contrast:[qC,aS,tS]}],"drop-shadow":[{"drop-shadow":["","none",p,pS,sS]}],"drop-shadow-color":[{"drop-shadow":D()}],grayscale:[{grayscale:["",qC,aS,tS]}],"hue-rotate":[{"hue-rotate":[qC,aS,tS]}],invert:[{invert:["",qC,aS,tS]}],saturate:[{saturate:[qC,aS,tS]}],sepia:[{sepia:["",qC,aS,tS]}],"backdrop-filter":[{"backdrop-filter":["","none",aS,tS]}],"backdrop-blur":[{"backdrop-blur":q()}],"backdrop-brightness":[{"backdrop-brightness":[qC,aS,tS]}],"backdrop-contrast":[{"backdrop-contrast":[qC,aS,tS]}],"backdrop-grayscale":[{"backdrop-grayscale":["",qC,aS,tS]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[qC,aS,tS]}],"backdrop-invert":[{"backdrop-invert":["",qC,aS,tS]}],"backdrop-opacity":[{"backdrop-opacity":[qC,aS,tS]}],"backdrop-saturate":[{"backdrop-saturate":[qC,aS,tS]}],"backdrop-sepia":[{"backdrop-sepia":["",qC,aS,tS]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",aS,tS]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[qC,"initial",aS,tS]}],ease:[{ease:["linear","initial",v,aS,tS]}],delay:[{delay:[qC,aS,tS]}],animate:[{animate:["none",b,aS,tS]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,aS,tS]}],"perspective-origin":[{"perspective-origin":w()}],rotate:[{rotate:W()}],"rotate-x":[{"rotate-x":W()}],"rotate-y":[{"rotate-y":W()}],"rotate-z":[{"rotate-z":W()}],scale:[{scale:H()}],"scale-x":[{"scale-x":H()}],"scale-y":[{"scale-y":H()}],"scale-z":[{"scale-z":H()}],"scale-3d":["scale-3d"],skew:[{skew:G()}],"skew-x":[{"skew-x":G()}],"skew-y":[{"skew-y":G()}],transform:[{transform:[aS,tS,"","none","gpu","cpu"]}],"transform-origin":[{origin:w()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Z()}],"translate-x":[{"translate-x":Z()}],"translate-y":[{"translate-y":Z()}],"translate-z":[{"translate-z":Z()}],"translate-none":["translate-none"],accent:[{accent:D()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:D()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",aS,tS]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",aS,tS]}],fill:[{fill:["none",...D()]}],"stroke-w":[{stroke:[qC,cS,nS,iS]}],stroke:[{stroke:["none",...D()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},"getDefaultConfig")),TS={default:{solid:{base:"bg-theme-0 dark:bg-theme-700/40 text-theme-600 dark:text-theme-50",input:"bg-white dark:bg-theme-800/50\n ring-theme-200 dark:ring-theme-600/70\n focus:ring-theme-600 focus:bg-white\n dark:focus:ring-theme-500 dark:focus:bg-theme-800\n focus-within:ring-theme-600 dark:focus-within:ring-theme-500\n text-theme-900 dark:text-theme-100\n placeholder:text-theme-400 dark:placeholder:text-theme-500",border:"border-theme-300/80 dark:border-theme-600",hover:"hover:border-theme-300 dark:hover:border-theme-500",icon:"text-theme-600 dark:text-theme-50"},ghost:{base:"bg-theme-50 dark:bg-theme-600/30 text-theme-700 dark:text-theme-50",border:"border-theme-100 dark:border-theme-800/20",hover:"hover:bg-theme-200 dark:hover:bg-theme-600/50 hover:border-theme-200 dark:hover:border-theme-600",icon:"text-theme-500 dark:text-theme-500"},outline:{base:"bg-transparent text-theme-700 dark:text-theme-50",border:"border-theme-300 dark:border-theme-400",hover:"hover:opacity-70",icon:"text-theme-700 dark:text-theme-300"},link:{base:"bg-transparent text-theme-600 dark:text-theme-50",border:"border-transparent",hover:"hover:opacity-70",icon:"text-theme-600 dark:text-theme-400"}},muted:{solid:{base:"bg-gray-100 dark:bg-gray-700/40 text-gray-900 dark:text-gray-50",input:"bg-white dark:bg-gray-800/50\n ring-gray-200 dark:ring-gray-600/70\n focus:ring-gray-600 focus:bg-white\n dark:focus:ring-gray-500 dark:focus:bg-gray-800\n focus-within:ring-gray-600 dark:focus-within:ring-gray-500\n text-gray-900 dark:text-gray-100\n placeholder:text-gray-400 dark:placeholder:text-gray-500",border:"border-gray-300/80 dark:border-gray-600",hover:"hover:border-gray-300 dark:hover:border-gray-500",icon:"text-gray-600 dark:text-gray-50"},ghost:{base:"bg-gray-100 dark:bg-gray-600/30 text-gray-700 dark:text-gray-50",border:"border-gray-100 dark:border-gray-800/20",hover:"hover:bg-gray-200 dark:hover:bg-gray-600/50 hover:border-gray-200 dark:hover:border-gray-600",icon:"text-gray-500 dark:text-gray-500"},outline:{base:"bg-transparent text-gray-700 dark:text-gray-50",border:"border-gray-500 dark:border-gray-400",hover:"hover:opacity-70",icon:"text-gray-700 dark:text-gray-300"},link:{base:"bg-transparent text-gray-600 dark:text-gray-50",border:"border-transparent",hover:"hover:opacity-70",icon:"text-gray-600 dark:text-gray-400"}},overlay:{solid:{base:"bg-white/100 text-black backdrop-blur-sm shadow-sm mix-blend-overlay [text-shadow:_0_1px_1px_rgb(255_255_255_/_100%)]",border:"border-white/100",input:"bg-white/10 ring-white\n focus:ring-white/90 focus:bg-white/20\n dark:focus:ring-white/70\n text-white\n placeholder:text-white/60",hover:"hover:bg-white/70 ",icon:"text-black"},ghost:{base:"bg-white/70 text-black backdrop-blur-sm shadow-sm mix-blend-overlay [text-shadow:_0_1px_1px_rgb(255_255_255_/_100%)]",border:"border-white/100",hover:"hover:bg-white/70 hover:border-white/90",icon:"text-black"},outline:{base:"bg-white/10 text-white backdrop-blur-sm shadow-sm [text-shadow:_0_0.5px_0_rgb(0_0_0_/_40%)]",border:"border-white",hover:"hover:border-white/80",icon:"text-white"},link:{base:"bg-transparent text-white [text-shadow:_0_0.5px_0_rgb(0_0_0_/_40%)]",border:"border-transparent",hover:"hover:opacity-70",icon:"text-white"}},primary:{solid:{base:"bg-primary-500 dark:bg-primary-700/70 text-primary-0 dark:text-primary-50",border:"border-primary-600/80 dark:border-primary-600",input:"bg-primary-50 dark:bg-primary-800/20\n ring-primary-500 dark:ring-primary-600/70\n focus:ring-primary-700 focus:bg-primary-50/50\n dark:focus:ring-primary-600 dark:focus:bg-primary-800/40\n text-primary-800 dark:text-primary-0\n placeholder:text-primary-300 dark:placeholder:text-primary-600",hover:"hover:bg-primary-600 dark:hover:bg-primary-800",icon:"text-primary-0 dark:text-primary-50"},ghost:{base:"bg-primary-50 dark:bg-primary-800/40 text-primary-800 dark:text-primary-0",border:"border-primary-100 dark:border-primary-800/20",hover:"hover:bg-primary-100 dark:hover:bg-primary-800/60 hover:border-primary-200 dark:hover:border-primary-700",icon:"text-primary-500 dark:text-primary-500"},outline:{base:"bg-transparent text-primary-500 dark:text-primary-100",border:"border-primary-500 dark:border-primary-500",hover:"hover:bg-primary-500/10 dark:hover:bg-primary-500/20",icon:"text-primary-700 dark:text-primary-100"},link:{base:"bg-transparent text-primary-600 dark:text-primary-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-primary-600 dark:text-primary-400"}},theme:{solid:{base:"bg-theme-500 dark:bg-theme-600/70 text-theme-0 dark:text-theme-0",border:"border-theme-600/80 dark:border-theme-600",hover:"hover:bg-theme-600 dark:hover:bg-theme-800",icon:"text-theme-50 dark:text-theme-50"},ghost:{base:"bg-theme-100 dark:bg-theme-600/50 text-theme-900 dark:text-theme-100",border:"border-theme-100 dark:border-theme-800/20",hover:"hover:bg-theme-200 dark:hover:bg-theme-600/40 hover:border-theme-200 dark:hover:border-theme-600",icon:"text-theme-500 dark:text-theme-500"},outline:{base:"bg-transparent text-theme-500 dark:text-theme-300",border:"border-theme-500 dark:border-theme-400",hover:"hover:bg-theme-500/10 dark:hover:bg-theme-400/20",icon:"text-theme-500 dark:text-theme-300"},link:{base:"bg-transparent text-theme-600 dark:text-theme-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-theme-600 dark:text-theme-400"}},green:{solid:{base:"bg-green-600 dark:bg-green-700/70 text-green-50 dark:text-green-50",border:"border-green-600 dark:border-green-600",hover:"hover:bg-green-700 dark:hover:bg-green-800",icon:"text-green-50 dark:text-green-50"},ghost:{base:"bg-green-100 dark:bg-green-800/20 text-green-900 dark:text-green-100",border:"border-green-100 dark:border-green-800/20",hover:"hover:bg-green-200 dark:hover:bg-green-800/40 hover:border-green-200 dark:hover:border-green-700",icon:"text-green-500 dark:text-green-500"},outline:{base:"bg-transparent text-green-500 dark:text-green-50",border:"border-green-500 dark:border-green-600",hover:"hover:bg-green-500/10 dark:hover:bg-green-400/10",icon:"text-green-500 dark:text-green-50"},link:{base:"bg-transparent text-green-600 dark:text-green-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-green-600 dark:text-green-400"}},orange:{solid:{base:"bg-orange-500 dark:bg-orange-700/70 text-orange-50 dark:text-orange-50",border:"border-orange-700 dark:border-orange-600",hover:"hover:bg-orange-700 dark:hover:bg-orange-800",icon:"text-orange-50 dark:text-orange-50"},ghost:{base:"bg-orange-100 dark:bg-orange-800/20 text-orange-900 dark:text-orange-100",border:"border-orange-100 dark:border-orange-800/20",hover:"hover:bg-orange-200 dark:hover:bg-orange-800/40 hover:border-orange-200 dark:hover:border-orange-700",icon:"text-orange-500 dark:text-orange-500"},outline:{base:"bg-transparent text-orange-500 dark:text-orange-50",border:"border-orange-500 dark:border-orange-600",hover:"hover:bg-orange-500/10 dark:hover:bg-orange-400/10",icon:"text-orange-500 dark:text-orange-50"},link:{base:"bg-transparent text-orange-600 dark:text-orange-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-orange-600 dark:text-orange-400"}},rose:{solid:{base:"bg-rose-500 dark:bg-rose-700/70 text-rose-50 dark:text-rose-50",border:"border-rose-600/80 dark:border-rose-600",hover:"hover:bg-rose-600 dark:hover:bg-rose-800",icon:"text-rose-50 dark:text-rose-50"},ghost:{base:"bg-rose-100 dark:bg-rose-800/20 text-rose-900 dark:text-rose-100",border:"border-rose-100 dark:border-rose-800/20",hover:"hover:bg-rose-200 dark:hover:bg-rose-800/40 hover:border-rose-200 dark:hover:border-rose-700",icon:"text-rose-500 dark:text-rose-500"},outline:{base:"bg-transparent text-rose-500 dark:text-rose-50",border:"border-rose-500 dark:border-rose-600",hover:"hover:bg-rose-500/10 dark:hover:bg-rose-400/10",icon:"text-rose-500 dark:text-rose-50"},link:{base:"bg-transparent text-rose-600 dark:text-rose-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-rose-600 dark:text-rose-400"}},indigo:{solid:{base:"bg-indigo-500 dark:bg-indigo-700/70 text-indigo-50 dark:text-indigo-50",border:"border-indigo-600/80 dark:border-indigo-600",hover:"hover:bg-indigo-600 dark:hover:bg-indigo-800",icon:"text-indigo-50 dark:text-indigo-50"},ghost:{base:"bg-indigo-100 dark:bg-indigo-800/20 text-indigo-900 dark:text-indigo-100",border:"border-indigo-100 dark:border-indigo-800/20",hover:"hover:bg-indigo-200 dark:hover:bg-indigo-800/40 hover:border-indigo-200 dark:hover:border-indigo-700",icon:"text-indigo-500 dark:text-indigo-500"},outline:{base:"bg-transparent text-indigo-500 dark:text-indigo-50",border:"border-indigo-500 dark:border-indigo-600",hover:"hover:bg-indigo-500/10 dark:hover:bg-indigo-400/10",icon:"text-indigo-500 dark:text-indigo-50"},link:{base:"bg-transparent text-indigo-600 dark:text-indigo-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-indigo-600 dark:text-indigo-400"}},red:{solid:{base:"bg-red-500 dark:bg-red-700/70 text-red-50 dark:text-red-50",border:"border-red-600/80 dark:border-red-600",hover:"hover:bg-red-600 dark:hover:bg-red-800",icon:"text-red-50 dark:text-red-50"},ghost:{base:"bg-red-100 dark:bg-red-800/20 text-red-900 dark:text-red-100",border:"border-red-100 dark:border-red-800/20",hover:"hover:bg-red-200 dark:hover:bg-red-800/40 hover:border-red-200 dark:hover:border-red-700",icon:"text-red-500 dark:text-red-500"},outline:{base:"bg-transparent text-red-500 dark:text-red-50",border:"border-red-500 dark:border-red-600",hover:"hover:bg-red-500/10 dark:hover:bg-red-400/10",icon:"text-red-500 dark:text-red-50"},link:{base:"bg-transparent text-red-600 dark:text-red-400",border:"border-transparent",hover:"hover:opacity-70",icon:"text-red-600 dark:text-red-400"}}},xS={key:0,class:"absolute inset-0 flex items-center justify-center"},ES=Ln({__name:"FButton",props:{theme:{default:"default"},design:{default:"solid"},size:{default:"md"},rounding:{default:"full"},href:{},icon:{},iconAfter:{},tag:{default:"button"},loading:{type:Boolean,default:!1},class:{default:""}},setup(e){const t=tr(()=>({icon:"string"==typeof e.icon?e.icon:e.icon?.className,iconAfter:"string"==typeof e.iconAfter?e.iconAfter:e.iconAfter?.className})),n=tr(()=>e.href?"a":e.tag),i=tr(()=>({xxs:"size-2.5",xs:"size-3",sm:"size-3.5",md:"size-4",lg:"size-5",xl:"size-6"}[e.size])),o=tr(()=>{const t="link"===e.design?"!px-1":"",n=TS[e.theme]?.[e.design]||TS.default[e.design],i=["relative inline-flex items-center justify-center gap-2 font-medium transition-all duration-200 focus:outline-none active:opacity-80 cursor-pointer",{xxs:"px-2 py-0.5 text-[10px]",xs:"px-3 py-1 text-[11px]",sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base",xl:"px-8 py-4 text-base"}[e.size],t,{md:"rounded-md",lg:"rounded-lg",full:"rounded-full"}[e.rounding],n.base,`border ${n.border}`,n.hover].filter(Boolean).join(" ");return SS(i,e.class)}),r=tr(()=>({design:(TS[e.theme]?.[e.design]||TS.default[e.design]).icon||""}));return(s,a)=>(Co(),_o(si(n.value),{href:e.href,class:me(o.value)},{default:vn(()=>[e.loading?(Co(),Eo("div",xS,[Oo(Dw,{class:me(i.value)},null,8,["class"])])):Lo("",!0),Mo("span",{class:me(["flex items-center gap-2 transition-opacity duration-200 whitespace-nowrap",e.loading?"opacity-0":"opacity-100"])},[t.value.icon?(Co(),Eo("span",{key:0,class:me(["flex items-center size-[1.1em] mt-[-.07em]",[t.value.icon,r.value]])},null,2)):Lo("",!0),li(s.$slots,"default"),t.value.iconAfter?(Co(),Eo("span",{key:1,class:me(["flex items-center size-[1.1em] mt-[-.07em]",[t.value.iconAfter,r.value]])},null,2)):Lo("",!0)],2)]),_:3},8,["href","class"]))}}),_S={class:"flex-1 flex flex-col min-h-0 py-6 space-y-6 h-full overflow-scroll [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden relative"},IS={class:"flex-1 space-y-6"},PS={key:0,class:"bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"},RS={class:"text-sm text-white/70 leading-relaxed"},AS={key:1,class:"bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"},MS=["innerHTML"],OS={key:2,class:"bg-white/5 backdrop-blur-sm rounded-2xl p-4 border border-white/10"},DS={class:"text-sm text-white/70 leading-relaxed"},NS={key:3,class:"space-y-3"},LS={class:"grid grid-cols-2 gap-3"},jS=Ln({__name:"ElSelfAbout",props:{self:{}},setup(e){const t=tr(()=>[{key:"email",condition:Rw(()=>!!e.self.email,"condition"),generate:Rw(()=>({title:"Contact",url:`mailto:${e.self.email}`,icon:"i-heroicons-envelope"}),"generate")},{key:"linkedin",condition:Rw(()=>!!e.self.accounts?.linkedin?.handle,"condition"),generate:Rw(()=>({title:"LinkedIn",url:e.self.accounts?.linkedin?.url||`https://linkedin.com/in/${e.self.accounts?.linkedin?.handle}`,icon:"i-simple-icons-linkedin"}),"generate")},{key:"x",condition:Rw(()=>!!e.self.accounts?.x?.handle,"condition"),generate:Rw(()=>({title:"X (Twitter)",url:e.self.accounts?.x?.url||`https://x.com/${e.self.accounts?.x?.handle}`,icon:"i-simple-icons-x"}),"generate")},{key:"github",condition:Rw(()=>!!e.self.accounts?.github?.handle,"condition"),generate:Rw(()=>({title:"GitHub",url:e.self.accounts?.github?.url||`https://github.com/${e.self.accounts?.github?.handle}`,icon:"i-simple-icons-github"}),"generate")},{key:"website",condition:Rw(()=>!!e.self.accounts?.website?.url,"condition"),generate:Rw(()=>({title:"Website",url:e.self.accounts?.website?.url,icon:"i-heroicons-globe-alt"}),"generate")}].filter(e=>e.condition()).map(e=>e.generate()));return(n,i)=>(Co(),Eo("div",_S,[Mo("div",IS,[e.self.headline?(Co(),Eo("div",PS,[i[0]||(i[0]=Mo("h3",{class:"text-sm font-medium text-white/90 mb-2"}," Professional Tagline ",-1)),Mo("div",RS,be(e.self.headline),1)])):Lo("",!0),e.self.summary?(Co(),Eo("div",AS,[i[1]||(i[1]=Mo("h3",{class:"text-sm font-medium text-white/90 mb-2"}," About ",-1)),Mo("div",{class:"text-sm text-white/70 leading-relaxed",innerHTML:e.self.summary},null,8,MS)])):Lo("",!0),"company"===e.self.entityType?(Co(),Eo("div",OS,[i[2]||(i[2]=Mo("h3",{class:"text-sm font-medium text-white/90 mb-2"}," Company Info ",-1)),Mo("p",DS," This is a company digital self representing "+be(e.self.name)+". ",1)])):Lo("",!0),t.value.length>0?(Co(),Eo("div",NS,[i[3]||(i[3]=Mo("h3",{class:"text-sm font-medium text-white/90"}," Connect ",-1)),Mo("div",LS,[(Co(!0),Eo(go,null,ci(t.value,e=>(Co(),_o(ES,{key:e.title,design:"ghost",theme:"default",size:"sm",class:"bg-white/5 hover:bg-white/10 border border-white/10 text-white/80 text-sm justify-start h-10",href:e.url,target:"_blank"},{default:vn(()=>[Mo("i",{class:me([e.icon,"size-4 mr-2"])},null,2),No(" "+be(e.title),1)]),_:2},1032,["href"]))),128))])])):Lo("",!0)])]))}}),US={class:"flex flex-col h-full relative"},FS={key:0,class:"text-theme-600 py-16 flex flex-col items-center justify-center gap-2 text-sm"},BS={key:0,class:"flex-shrink-0 size-8"},zS=["src","alt"],VS={class:"max-w-[70%]"},$S={class:"text-sm leading-[1.5] whitespace-pre-wrap break-words"},qS={key:0,class:"flex gap-2 justify-start items-end mb-4"},WS={class:"flex-shrink-0"},HS=["src","alt"],GS={class:"flex-shrink-0 pt-6 pb-2"},ZS=["placeholder","disabled"],JS=Ln({__name:"ElSelfChat",props:{selfController:{},self:{}},setup(e){const t=Ft(""),n=Ft(),i=Ft(),o=tr(()=>$w(e.self));function r(e,t){const n=e[t],i=e[t+1];return!i||i.sender!==n.sender}async function s(){if(!t.value.trim()||!e.selfController||!e.selfController.textState.value.isConnected)return;const n=t.value;t.value="",i.value&&(i.value.style.height="auto",i.value.focus());try{await e.selfController.sendChatMessage(n),c()}catch(o){}}function a(e){"Enter"===e.key&&!e.shiftKey&&(e.preventDefault(),s())}function c(){n.value&&an(()=>{const e=n.value;e.scrollTop=e.scrollHeight})}function l(){if(!i.value)return;i.value.style.height="auto";const e=Math.min(i.value.scrollHeight,150);i.value.style.height=`${e}px`}return Rw(r,"shouldShowAvatar"),Kn(async()=>{if(e.selfController&&!e.selfController.textState.value.isConnected)try{await e.selfController.startTextConversation()}catch(t){}}),Rw(s,"sendMessage"),Rw(a,"handleKeydown"),Rw(c,"scrollToBottom"),Rw(l,"adjustTextareaHeight"),to(t,()=>{an(()=>l())}),to(()=>e.selfController?.sharedMessages.value,e=>{e&&e.length>0&&an(()=>c())},{immediate:!0,deep:!0}),(s,c)=>(Co(),Eo("div",US,["connected"!==e.selfController?.textState.value.connectionStatus?(Co(),Eo("div",FS,[Oo(Dw,{class:"size-4"})])):Lo("",!0),Mo("div",{ref_key:"messagesContainer",ref:n,class:"flex-1 overflow-y-auto overflow-x-hidden py-8 space-y-1 min-h-0 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden"},[(Co(!0),Eo(go,null,ci(e.selfController?.sharedMessages.value.filter(e=>"system"!==e.sender)??[],(t,n)=>(Co(),Eo("div",{key:t.id,class:me(["flex gap-2 items-end",{"justify-end":"user"===t.sender,"justify-start":"agent"===t.sender,"mb-4":r(e.selfController?.sharedMessages.value.filter(e=>"system"!==e.sender)??[],n)}])},["agent"===t.sender?(Co(),Eo("div",BS,[r(e.selfController?.sharedMessages.value.filter(e=>"system"!==e.sender)??[],n)?(Co(),Eo("img",{key:0,src:o.value,alt:e.self.name,class:"size-7 rounded-full object-cover"},null,8,zS)):Lo("",!0)])):Lo("",!0),Mo("div",VS,[Mo("div",{class:me(["rounded-2xl px-3.5 py-1.5 backdrop-blur-sm","user"===t.sender?"bg-primary-500/80 text-white":"bg-white/15 text-white/95"])},[Mo("p",$S,be(t.text),1)],2)])],2))),128)),e.selfController?.textState.value.isThinking?(Co(),Eo("div",qS,[Mo("div",WS,[Mo("img",{src:o.value,alt:e.self.name,class:"size-8 rounded-full object-cover"},null,8,HS)]),c[1]||(c[1]=Mo("div",{class:"rounded-2xl px-4 py-2.5 bg-white/15 backdrop-blur-sm flex items-center"},[Mo("i",{class:"i-svg-spinners-3-dots-fade size-6 text-white/70"})],-1))])):Lo("",!0)],512),Mo("div",GS,[bn(Mo("textarea",{ref_key:"textarea",ref:i,"onUpdate:modelValue":c[0]||(c[0]=e=>t.value=e),rows:"1",placeholder:e.selfController?.textState.value.isConnected?"Message":"Connecting...",disabled:!e.selfController?.textState.value.isConnected,style:{"font-size":"16px",resize:"none"},class:"w-full bg-white/10 backdrop-blur-sm border border-white/20 rounded-3xl px-5 py-3 text-white placeholder-white/50 focus:outline-none focus:border-white/40 disabled:opacity-50 overflow-y-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",onKeydown:a},null,40,ZS),[[os,t.value]]),c[2]||(c[2]=Mo("div",{class:"text-[10px] text-white/40 text-center mt-2"}," Press Enter to send, Shift+Enter for new line ",-1))])]))}}),KS={class:"flex flex-col items-center text-center gap-4"},YS={class:"relative flex-shrink-0"},QS={class:"w-20 h-20 sm:w-24 sm:h-24 rounded-full overflow-hidden border-4 border-white"},XS=["src","alt"],eT={class:"min-w-0"},tT={class:"text-3xl font-light text-white mb-2 truncate"},nT={class:"text-base font-light text-white/60 line-clamp-1"},iT=Ln({__name:"ElSelfHeader",props:{self:{}},setup(e){function t(){return e.self.avatar?.src?e.self.avatar.src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjgwIiBoZWlnaHQ9IjgwIiByeD0iNDAiIGZpbGw9IiM2MzY2RjEiLz4KPHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeD0iMjAiIHk9IjIwIj4KPHA0aCBkPSJNMTIgMTJjMi4yMSAwIDQtMS43OSA0LTRTNC4yMSA0IDIgNHMxLjc5IDQgNCA0em0wIDJjLTIuNjcgMC04IDEuMzQtOCA0djJoMTZ2LTJjMC0yLjY2LTUuMzMtNC04LTR6IiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4KPC9zdmc+"}return Rw(t,"getAvatarSrc"),(n,i)=>(Co(),Eo("div",KS,[Mo("div",YS,[Mo("div",QS,[Mo("img",{src:t(),alt:e.self.name,class:"w-full h-full object-cover",onError:i[0]||(i[0]=(...e)=>Vt(Ww)&&Vt(Ww)(...e))},null,40,XS)]),i[1]||(i[1]=Mo("div",{class:"absolute top-1.5 right-1.5"},[Mo("div",{class:"size-4 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",style:{"animation-duration":"3s"}}),Mo("div",{class:"size-4 bg-green-500 rounded-full ring-2 ring-white"})],-1))]),Mo("div",eT,[Mo("h1",tT,be(e.self.name),1),Mo("p",nT,be(e.self.title),1)])]))}}),oT={class:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[28px] h-[28px] overflow-hidden"},rT=Ln({name:"FClose",__name:"FClose",emits:["click"],setup(e){const t=Ft(!1);return Kn(()=>{setTimeout(()=>{t.value=!0},100)}),(e,n)=>(Co(),Eo("a",{class:"close block cursor-pointer w-[60px] h-[60px] rounded-full transition-all duration-1000 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-110 active:scale-90 hover:rotate-90",onClick:n[0]||(n[0]=t=>e.$emit("click",t))},[n[1]||(n[1]=Mo("span",{class:"absolute inset-0 rounded-full transition-all"},null,-1)),Mo("span",oT,[Mo("span",{class:me(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]",t.value?"translate-y-0 translate-x-0 rotate-45":"translate-y-[30px] -translate-x-[30px] rotate-0"]),style:{"background-color":"currentColor","transition-delay":"0.15s"}},null,2),Mo("span",{class:me(["absolute h-full w-[3px] rounded-[5px] left-[13px] transition-all duration-[400ms] ease-[cubic-bezier(0.52,0.01,0.16,1)]",t.value?"translate-y-0 translate-x-0 -rotate-45":"-translate-y-[30px] -translate-x-[30px] rotate-0"]),style:{"background-color":"currentColor","transition-delay":"0.45s"}},null,2)])]))}}),sT={key:0,class:"px-9 pt-12 pb-4"},aT={class:"text-base font-medium text-theme-400"},cT={key:1,class:"px-4 pb-8 border-b border-white/10"},lT=["disabled","onClick"],dT={class:"flex items-center gap-3"},uT={class:"flex-1"},hT={key:0,class:"text-xs text-white/50 mt-0.5"},pT={class:"p-6"},mT=Ln({name:"ElSidebar",__name:"ElSidebar",props:{modelValue:{type:Boolean},items:{},position:{},title:{},widthClasses:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=t,o=n.position||"left",r=n.widthClasses||"w-[80%] max-w-[300px]",s=tr({get:Rw(()=>n.modelValue,"get"),set:Rw(e=>i("update:modelValue",e),"set")}),a=tr(()=>n.items.filter(e=>!e.isHidden));function c(e){e.isDisabled||(e.onClick?e.onClick({item:e,event:new MouseEvent("click")}):e.href&&(e.href.includes("http")?window.open(e.href,e.target||"_self")?.focus():window.location.href=e.href),s.value=!1)}Rw(c,"handleItemClick");const l=tr(()=>"left"===o?{enter:"-translate-x-full",leave:"-translate-x-full",position:"justify-start",closeButton:"-right-16"}:{enter:"translate-x-full",leave:"translate-x-full",position:"justify-end",closeButton:"-left-16"});return(t,n)=>(Co(),Eo(go,null,[Oo(mr,{"enter-active-class":"transition-opacity duration-300 ease-out","leave-active-class":"transition-opacity duration-200 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:vn(()=>[s.value?(Co(),Eo("div",{key:0,class:"absolute inset-0 z-40 bg-black/50 backdrop-blur-sm",onClick:n[0]||(n[0]=e=>s.value=!1)})):Lo("",!0)]),_:1}),Oo(mr,{"enter-active-class":"transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)]","leave-active-class":"transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]","enter-from-class":l.value.enter,"enter-to-class":"translate-x-0","leave-from-class":"translate-x-0","leave-to-class":l.value.leave},{default:vn(()=>[s.value?(Co(),Eo("div",{key:0,class:me(["absolute inset-0 z-50 flex",l.value.position]),onClick:n[3]||(n[3]=e=>s.value=!1)},[Mo("div",{class:me(["relative h-full shadow-2xl bg-black/30 backdrop-blur-xl flex flex-col justify-center",Vt(r)]),onClick:n[2]||(n[2]=as(()=>{},["stop"]))},[Oo(rT,{class:me(["absolute top-4 z-10 text-white",l.value.closeButton]),onClick:n[1]||(n[1]=e=>s.value=!1)},null,8,["class"]),e.title?(Co(),Eo("div",sT,[Mo("h3",aT,be(e.title),1)])):Lo("",!0),t.$slots.header?(Co(),Eo("div",cT,[li(t.$slots,"header")])):Lo("",!0),Mo("div",{class:me(["flex-1 p-6 space-y-2 overflow-y-auto",{"pt-6":!e.title&&!t.$slots.header,"pt-4":e.title||t.$slots.header}])},[Oo(Kr,{"enter-active-class":"transition-all duration-400 ease-[cubic-bezier(0.25,1,0.33,1)]","leave-active-class":"transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)]","enter-from-class":"left"===Vt(o)?"-translate-x-4 opacity-0":"translate-x-4 opacity-0","enter-to-class":"translate-x-0 opacity-100","leave-from-class":"translate-x-0 opacity-100","leave-to-class":"left"===Vt(o)?"-translate-x-4 opacity-0":"translate-x-4 opacity-0"},{default:vn(()=>[(Co(!0),Eo(go,null,ci(a.value,(e,t)=>(Co(),Eo("button",{key:e.key||e.label||t,style:le({transitionDelay:40*t+"ms"}),class:me(["cursor-pointer w-full text-left p-3 rounded-xl transition-all duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group",[e.isActive?"bg-primary-500/20 border border-primary-500/40":"hover:bg-white/10",e.isDisabled&&"opacity-50 cursor-not-allowed"]]),disabled:e.isDisabled,onClick:Rw(t=>c(e),"onClick")},[Mo("div",dT,[e.icon?.src?(Co(),Eo("i",{key:0,class:me(["size-5 flex-shrink-0 transition-transform duration-200 ease-[cubic-bezier(0.25,1,0.33,1)] group-hover:scale-110",[e.icon.src,e.isActive?"text-primary-400":"text-white/70 group-hover:text-white"]])},null,2)):Lo("",!0),Mo("div",uT,[Mo("div",{class:me(["font-medium text-sm",e.isActive?"text-primary-300":"text-white"])},be(e.label),3),e.subLabel?(Co(),Eo("div",hT,be(e.subLabel),1)):Lo("",!0)])])],14,lT))),128))]),_:1},8,["enter-from-class","leave-to-class"])],2),Mo("div",pT,[li(t.$slots,"footer",{},()=>[n[4]||(n[4]=Mo("div",{class:"text-center"},[Mo("p",{class:"text-[10px] text-white/40 font-sans"},[No(" Digital Self by "),Mo("a",{href:"https://www.fiction.com",target:"_blank",class:"text-white/60 hover:text-white/80 transition-colors"},"Fiction")])],-1))])])],2)],2)):Lo("",!0)]),_:3},8,["enter-from-class","leave-to-class"])],64))}}),fT=Ln({name:"SelfModeSidebar",__name:"ElSelfModeSidebar",props:{modelValue:{type:Boolean},selfController:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=t,o=tr({get:Rw(()=>n.modelValue,"get"),set:Rw(e=>i("update:modelValue",e),"set")}),r=tr(()=>n.selfController?.agentMode?.value??"self"),s=tr(()=>jw.map(e=>({key:e.mode,icon:{src:e.icon},label:e.label,isActive:r.value===e.mode,onClick:Rw(()=>{n.selfController?.setMode(e.mode)},"onClick")})));return(e,t)=>(Co(),_o(mT,{modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=e=>o.value=e),items:s.value,position:"right",title:"Mode","width-classes":"w-[80%] max-w-[255px]"},null,8,["modelValue","items"]))}}),gT=Ln({name:"SelfSidebar",__name:"ElSelfSidebar",props:{modelValue:{type:Boolean},self:{},sdk:{},title:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,i=t,o=tr({get:Rw(()=>n.modelValue,"get"),set:Rw(e=>i("update:modelValue",e),"set")}),r=tr(()=>{const e=[{key:"share",icon:{src:"i-tabler-share"},label:"Share This Digital Self",onClick:Rw(()=>{const e=`${window.location.origin}/@${n.self.handle||n.self.selfId}`;navigator.clipboard.writeText(e)},"onClick")},{key:"profile",icon:{src:"i-tabler-user"},label:"Visit Full Profile",onClick:Rw(()=>{window.open(`/@${n.self.handle||n.self.selfId}`,"_blank")},"onClick")},{key:"create",icon:{src:"i-tabler-sparkles"},label:"Create Your Own",onClick:Rw(()=>{window.open("/auth","_blank")},"onClick")}];return n.sdk.activeUser.value&&e.push({key:"logout",icon:{src:"i-tabler-logout"},label:"Logout",onClick:Rw(async()=>{await n.sdk.logout()},"onClick")}),e});return(t,n)=>(Co(),_o(mT,{modelValue:o.value,"onUpdate:modelValue":n[0]||(n[0]=e=>o.value=e),items:r.value,position:"left",title:e.title||"Menu"},null,8,["modelValue","items","title"]))}}),vT={class:"w-full max-w-full flex items-center justify-center"},bT=["width","height"],yT=Ln({__name:"ElAudioVisualizer",props:{rms:{},color:{},isActive:{type:Boolean},audioLevels:{},isListening:{type:Boolean},isSpeaking:{type:Boolean},isConnected:{type:Boolean},enableRealAudio:{type:Boolean},selfController:{},enableWaveMotion:{type:Boolean},enableScrollingWave:{type:Boolean}},setup(e){const t=e,n=Ft();let i=null,o=null;const r=Ft(!1),s=Ft(!0),a=new Map;let c=null,l=null,d=null;const u=Ft(!1),h=Ft(null),{bars:p,barWidth:m,barSpacing:f,minHeight:g,maxHeight:v,STIFFNESS:b,DAMPING:y,PEAK_HOLD_TIME:k,PEAK_DECAY_STIFFNESS:w,PEAK_DECAY_DAMPING:C}=Uw,S=new Float32Array(p).fill(g),T=new Float32Array(p).fill(0),x=new Float32Array(p).fill(g),E=new Float32Array(p).fill(g),_=new Float32Array(p).fill(0),I=new Float32Array(p).fill(0);function P(e){return e<200?{stiffnessMultiplier:.7,dampingMultiplier:1.2}:e<1e3?{stiffnessMultiplier:1,dampingMultiplier:1}:e<4e3?{stiffnessMultiplier:1.3,dampingMultiplier:.8}:{stiffnessMultiplier:1.5,dampingMultiplier:.6}}async function R(){if(!(typeof window>"u")&&t.enableRealAudio&&t.selfController)try{const e=t.selfController.getClientAudio();if(e?.isAudioContextAvailable()){const t=e.getSharedAnalyser();if(t){l=t;const e=new ArrayBuffer(t.frequencyBinCount);return d=new Uint8Array(e),u.value=!0,void(h.value=null)}}u.value=!1,h.value="Shared audio context not available"}catch(e){h.value=e instanceof Error?e.message:"Failed to setup shared audio",u.value=!1}}function A(){l=null,d=null,u.value=!1,h.value=null}Rw(P,"getFrequencyPhysics"),Rw(R,"setupAudio"),Rw(A,"cleanupAudio");let M=1;function O(){if(!n.value)return;typeof window<"u"&&(M=Math.max(1,Math.min(2,window.devicePixelRatio||1)));const e=(m+f)*p-f,t=v;n.value.width=Math.floor(e*M),n.value.height=Math.floor(t*M),n.value.style.width=`${e}px`,n.value.style.height=`${t}px`,i&&i.setTransform(M,0,0,M,0,0),Q()}function D(){return l&&d&&u.value?(l.getByteFrequencyData(d),L(d)):Array.from({length:Fw.length},()=>0)}function N(){if(!t.selfController)return Array.from({length:Fw.length},()=>0);try{const e=t.selfController.getOutputFrequencyData();if(e&&e.length>0)return L(e)}catch(e){}return Array.from({length:Fw.length},()=>0)}function L(e){return Array.from({length:Fw.length},(t,n)=>{const i=Fw[n],o=Math.floor(i/12e3*e.length),r=Math.max(1,Math.floor(e.length/Fw.length/2));let s=0;for(let l=0;l<r&&o+l<e.length;l++)s+=e[o+l];s=s/r/255;let a=1;a=i<150?.1:i<200?.3:i>=400&&i<=600?1.4:i>=1400&&i<=1600?1.3:i>=2400&&i<=2600?1.2:i>=200&&i<=2e3?1.1:i>=2e3&&i<=4e3?.9:i>6e3?.4:.7;const c=s**.5*.6*a;return Math.min(.85,c)})}Rw(O,"resizeCanvas"),Rw(D,"generateRealInputFrequencyBands"),Rw(N,"generateRealOutputFrequencyBands"),Rw(L,"mapFrequencyDataToBands");let j=0,U=0,F=0;const B=[{name:"a",f1:730,f2:1090,f3:2440,duration:120,energy:.9},{name:"e",f1:530,f2:1840,f3:2480,duration:100,energy:.8},{name:"i",f1:270,f2:2290,f3:3010,duration:110,energy:.85},{name:"o",f1:570,f2:840,f3:2410,duration:130,energy:.9},{name:"u",f1:300,f2:870,f3:2240,duration:140,energy:.8},{name:"s",f1:4e3,f2:6e3,f3:8e3,duration:80,energy:.4},{name:"t",f1:1500,f2:4e3,f3:6e3,duration:60,energy:.3},{name:"n",f1:280,f2:1700,f3:2600,duration:70,energy:.6},{name:"r",f1:350,f2:1200,f3:1650,duration:90,energy:.7},{name:"pause",f1:0,f2:0,f3:0,duration:150,energy:.05}];function z(e){const t=Array.from({length:Fw.length},()=>0);if(e<=0)return t;U+=16.67,F+=.02,U>B[j].duration&&(j=(j+1)%B.length,U=0);const n=B[j],i=B[(j+1)%B.length],o=U/n.duration,r=.5*(1+Math.cos(Math.PI+o*Math.PI)),s=.7+.3*Math.sin(.5*F),a=.9+.1*Math.sin(8*F);for(let c=0;c<Fw.length;c++){const o=Fw[c];let l=0;l=(.4*V(o,n.f1,i.f1,r,200)+.35*V(o,n.f2,i.f2,r,300)+.25*V(o,n.f3,i.f3,r,400))*(n.energy*(1-r)+i.energy*r);const d=150+50*Math.sin(.3*F);(Math.abs(o-d)<20||Math.abs(o-2*d)<30||Math.abs(o-3*d)<40)&&(l+=.3*n.energy),l*=e*s*a,l*=.85+.3*Math.random(),t[c]=Math.max(0,Math.min(1,l))}return t}function V(e,t,n,i,o){if(0===t&&0===n)return 0;const r=t*(1-i)+n*i;if(0===r)return 0;const s=Math.abs(e-r);return Math.exp(-((s/o)**2))}Rw(z,"generateSpeechPatterns"),Rw(V,"getFormantResponse");let $=[],q=0,W=0;function H(){return(r.value?100:50)*Math.min(2**W,8)}function G(e){let n=[];if(t.enableRealAudio&&t.isListening&&u.value&&l&&d){const e=D();e.some(e=>e>.05)&&(n=e)}if(!n.length&&t.isSpeaking&&t.selfController&&t.audioLevels&&t.audioLevels.outputLevel>.05){const e=Date.now(),t=H();if(e-q>t){q=e;try{const e=N();e.some(e=>e>.05)&&($=e,W=0)}catch(i){W++}}$.some(e=>e>.05)&&(n=$)}return n.length||(n=e>0&&(t.isListening||t.isSpeaking)?t.isSpeaking?z(e):J(e):t.isConnected?J(.02):Array.from({length:Fw.length},()=>0)),t.enableWaveMotion&&typeof window<"u"&&(n=Z(n,e)),n}function Z(e,n){const i=.001*performance.now(),o=[...e];for(let r=0;r<e.length;r++){const s=r*(2*Math.PI)/e.length;let a=0;a=t.isListening||t.isSpeaking?.15*Math.sin(4.2*i+.6*s-(t.enableScrollingWave?2*i:0))+.08*Math.sin(6.8*i+1.2*s-(t.enableScrollingWave?1.5*i:0))+.05*Math.sin(.8*i):t.isConnected?.1*Math.sin(.6*i)+.05*Math.sin(2*i+.3*s):.12*Math.sin(1.5*i+s)+.05*Math.sin(.4*i);const c=Math.max(.3,n);o[r]=Math.max(0,Math.min(.9,e[r]+a*c))}return o}function J(e){const t=Array.from({length:Fw.length},()=>0);if(e<=0)return t;for(let n=0;n<Fw.length;n++){const i=Fw[n];let o=0;o=i>=400&&i<=600?.9*e:i>=1400&&i<=1600?.8*e:i>=2400&&i<=2600?.7*e:i>=200&&i<=2e3?.6*e:i>=85&&i<=300?.4*e:.2*e,o*=.8+.4*Math.random(),t[n]=Math.max(0,Math.min(1,o))}return t}function K(){if(typeof window>"u")return;const e=navigator.userAgent.toLowerCase(),t=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(e);r.value=t}function Y(e,t){return a.has(e)||a.set(e,t()),a.get(e)}function Q(){a.clear(),c=null}function X(){if(typeof window>"u"||!i||!n.value)return;K();const e=n.value,a=e.width/M,l=e.height/M;function d(e){if(!i)return;if(!s.value)return void(o=requestAnimationFrame(d));i.clearRect(0,0,a,l);let n=0;t.audioLevels?t.isListening?n=Math.min(1.5*t.audioLevels.inputLevel,1):t.isSpeaking&&(n=Math.min(1.8*t.audioLevels.outputLevel,1)):void 0!==t.rms&&(n=Math.min(t.rms/70,1));const u=G(n);for(let t=0;t<p;t++)x[t]=g+u[t]*(v-g);for(let t=0;t<p;t++){const e=P(Fw[t]),n=x[t]-S[t],i=b*e.stiffnessMultiplier,o=y*e.dampingMultiplier,r=n*i-T[t]*o;if(T[t]+=r,S[t]+=T[t],S[t]>E[t])E[t]=S[t],_[t]=k,I[t]=0;else if(_[t]=Math.max(0,_[t]-16.67),_[t]<=0){const e=(Math.max(g,1.1*S[t])-E[t])*w-I[t]*C;I[t]+=e,E[t]=Math.max(g,E[t]+I[t])}}const h=.15*p;function R(){i&&(c||(c=i.createRadialGradient(.5*a,.6*l,.1*l,.5*a,.6*l,.9*l),c.addColorStop(0,"rgba(255,255,255,0.02)"),c.addColorStop(1,"rgba(0,0,0,0.08)")),i.fillStyle=c,i.fillRect(0,0,a,l))}if(Rw(R,"drawBackground"),R(),(t.isListening||t.isSpeaking)&&!r.value){const e=.001*performance.now(),n=.1+.05*Math.sin(2*e);i.save(),i.globalCompositeOperation="lighter",i.globalAlpha=n;const o=t.isSpeaking?"rgba(34,197,94,0.4)":"rgba(59,130,246,0.4)";i.fillStyle=o;for(let t=0;t<p;t++){const e=t*(m+f),n=S[t],o=l-n;i.beginPath(),i.roundRect(e-1,o-1,m+2,n+2,[2,2,0,0]),i.fill()}i.restore()}for(let o=0;o<p;o++){const e=o*(m+f),n=S[o],s=l-n,a=Fw[o],c=Math.min(o,p-1-o),d=Math.min(1,c/h),u=Math.min(1,n/v),b=(.8+.2*u)*d,y=(.6+.2*u)*d,w=(.3+.1*u)*d,C=Math.round(10*u)/10,T=Math.round(10*d)/10,x=Y(`${t.isSpeaking?"speaking":t.isListening?"listening":"idle"}-${C}-${T}-${n}`,()=>{const e=i.createLinearGradient(0,s,0,s+n);if(t.isSpeaking)e.addColorStop(0,`rgba(34, 197, 94, ${b})`),e.addColorStop(.5,`rgba(34, 197, 94, ${y})`),e.addColorStop(1,`rgba(34, 197, 94, ${w})`),(a>=400&&a<=600||a>=1400&&a<=1600)&&e.addColorStop(0,`rgba(74, 222, 128, ${Math.min(1,b+.2)})`);else if(t.isListening)e.addColorStop(0,`rgba(59, 130, 246, ${b})`),e.addColorStop(.5,`rgba(59, 130, 246, ${y})`),e.addColorStop(1,`rgba(59, 130, 246, ${w})`);else{const t=.6*d,n=.4*d,i=.2*d;e.addColorStop(0,`rgba(156, 163, 175, ${t})`),e.addColorStop(.6,`rgba(156, 163, 175, ${n})`),e.addColorStop(1,`rgba(156, 163, 175, ${i})`)}return e});if(i.fillStyle=x,i.beginPath(),i.roundRect(e,s,m,n,[1,1,0,0]),i.fill(),E[o]>g+2){const n=l-E[o],s=_[o]>0?.9:Math.max(.3,_[o]/k);i.fillStyle=`rgba(255, 255, 255, ${s})`,i.fillRect(e,n-1,m,2),s>.5&&!r.value&&(i.shadowColor=t.isSpeaking?"rgba(34, 197, 94, 0.5)":"rgba(59, 130, 246, 0.5)",i.shadowBlur=3,i.fillRect(e,n-1,m,2),i.shadowBlur=0)}}o=requestAnimationFrame(d)}Rw(d,"animate"),o=requestAnimationFrame(d)}function ee(){if(typeof window<"u"){const e=Math.max(1,Math.min(2,window.devicePixelRatio||1));e!==M&&(M=e)}O()}return Rw(H,"getApiThrottleInterval"),Rw(G,"generateFrequencyBands"),Rw(Z,"addWaveMotionOverlay"),Rw(J,"generateIntensityBasedBands"),Rw(K,"detectMobile"),Rw(Y,"getGradient"),Rw(Q,"clearGradientCache"),Rw(X,"startAnimation"),Kn(()=>{if(n.value){if(i=n.value.getContext("2d"),O(),typeof window<"u"){window.addEventListener("resize",ee,{passive:!0});const e=Rw(()=>{s.value=!document.hidden},"handleVisibilityChange");document.addEventListener("visibilitychange",e,{passive:!0})}X()}t.enableRealAudio&&t.isListening&&setTimeout(()=>{R().catch(console.error)},100)}),Rw(ee,"onResize"),ei(()=>{o&&cancelAnimationFrame(o),typeof window<"u"&&(window.removeEventListener("resize",ee),document.removeEventListener("visibilitychange",()=>{s.value=!document.hidden})),A()}),to([()=>t.isActive,()=>t.isConnected,()=>t.isListening,()=>t.isSpeaking,()=>t.rms],()=>{!i&&n.value&&(i=n.value.getContext("2d")),o&&cancelAnimationFrame(o),X()},{immediate:!0}),to([()=>t.enableRealAudio,()=>t.isListening],async([e,t],[n,i])=>{e&&t&&(!n||!i)&&(u.value||await R().catch(console.error)),(!e||!t)&&n&&i&&A()},{immediate:!1}),to(n,e=>{e&&!i&&(i=e.getContext("2d"),O(),X())}),(e,t)=>(Co(),Eo("div",vT,[Mo("canvas",{ref_key:"canvasRef",ref:n,width:(Vt(m)+Vt(f))*Vt(p)-Vt(f),height:Vt(v),class:"w-full max-w-full [image-rendering:-webkit-optimize-contrast]",style:le({height:`${Vt(v)}px`})},null,12,bT)]))}}),kT={class:"flex flex-col h-full items-center justify-center px-6 py-8"},wT={class:"flex-1 flex flex-col items-center justify-center space-y-8 py-4"},CT={class:"h-32 w-full max-w-md"},ST={class:"text-center flex gap-2 items-center text-xs"},TT={class:"flex items-center justify-center gap-2"},xT={key:0,class:"size-2 bg-blue-500 rounded-full animate-pulse"},ET={key:1,class:"size-2 bg-green-500 rounded-full animate-pulse"},_T={key:2,class:"size-2 bg-white/50 rounded-full"},IT={key:3,class:"size-2 bg-red-500 rounded-full"},PT={class:"text-white/70 text-sm max-w-xs leading-relaxed"},RT={class:"flex flex-col items-center space-y-6"},AT=Ln({__name:"ElSelfVoice",props:{selfController:{}},setup(e){const t=tr(()=>e.selfController?.voiceState.value),n=tr(()=>t.value?.isConnected?"red":"green"),i=tr(()=>t.value?.isConnected?"i-heroicons-phone-x-mark":"i-heroicons-phone"),o=tr(()=>t.value?.isConnected?"End Call":"Start a Call"),r=tr(()=>{const t=e.selfController?.voiceState.value;return!!t?.error||"connecting"===t?.connectionStatus}),s=tr(()=>"connecting"===t.value?.connectionStatus);async function a(){if(e.selfController)try{e.selfController.voiceState.value.isConnected?await e.selfController.endConversation():(e.selfController.isConnected()&&await e.selfController.endConversation(),await e.selfController.startVoiceConversation(),e.selfController.agentMode.value="talk")}catch(t){}}return Rw(a,"toggleCall"),(t,c)=>(Co(),Eo("div",kT,[Mo("div",wT,[Mo("div",CT,[Oo(yT,{"audio-levels":e.selfController?.audioLevels.value??{inputLevel:0,outputLevel:0},"is-listening":e.selfController?.voiceState.value.isListening??!1,"is-speaking":e.selfController?.voiceState.value.isSpeaking??!1,"is-connected":e.selfController?.voiceState.value.isConnected??!1,"enable-real-audio":!0,"enable-wave-motion":!0,"enable-scrolling-wave":!0,"self-controller":e.selfController},null,8,["audio-levels","is-listening","is-speaking","is-connected","self-controller"])]),Mo("div",ST,[Mo("div",TT,[e.selfController?.voiceState.value.isListening?(Co(),Eo("div",xT)):e.selfController?.voiceState.value.isSpeaking?(Co(),Eo("div",ET)):!e.selfController?.voiceState.value.isConnected||e.selfController?.voiceState.value.isListening||e.selfController?.voiceState.value.isSpeaking?e.selfController?.voiceState.value.error?(Co(),Eo("div",IT)):Lo("",!0):(Co(),Eo("div",_T))]),Mo("p",PT,be(e.selfController?.voiceState.value.error?`Error: ${e.selfController.voiceState.value.error}`:e.selfController?.voiceState.value.transcript||"Ready to start a call..."),1)])]),Mo("div",RT,[Oo(Yw,{theme:n.value,icon:i.value,size:"lg",loading:s.value,disabled:r.value,onClick:a},{default:vn(()=>[No(be(o.value),1)]),_:1},8,["theme","icon","loading","disabled"])])]))}}),MT={key:0,class:"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-theme-800 to-theme-950 rounded-3xl z-10"},OT={class:"text-sm"},DT={key:0,class:"flex-1 basis-0 flex justify-end"},NT={key:0,class:"h-full pb-12 flex-1 flex flex-col relative z-20 min-h-0 px-4 @[480px]/agent:px-6 max-w-md mx-auto w-full"},LT={class:"flex-1 basis-0 flex flex-col justify-start pt-6"},jT={key:1,class:"flex-1 flex flex-col relative z-20 min-h-0 w-full"},UT={class:"px-4 pt-4 pb-4 max-w-md mx-auto"},FT={key:2,class:"flex-1 flex flex-col relative z-20 min-h-0 w-full px-4 @[480px]/agent:px-6"},BT={class:"flex-1 min-h-0 max-w-md mx-auto w-full"},zT={key:2,class:"bg-gradient-to-br from-theme-800 to-theme-950 text-white flex items-center justify-center h-full p-8"},VT={class:"text-center max-w-md space-y-4"},$T={class:"text-sm text-white/70 leading-relaxed"},qT={key:3,class:"bg-white/10 backdrop-blur-sm text-white/70 flex items-center justify-center h-full"},WT=Ln({__name:"SelfAgent",props:{sdk:{},self:{},context:{},firstMessage:{},hasClose:{type:Boolean,default:!1},isActive:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},theme:{default:"green"}},emits:["close","error"],setup(e,{emit:t}){const n=t,i=Bt(undefined,!0),o=Ft(!1),r=Ft(!1),s=Ft(),a=Ft(),c=tr(()=>i.value?.agentMode?.value??"self"),l=tr(()=>void 0!==e.sdk.activeUser.value),d=tr(()=>jw.find(e=>e.mode===c.value));function u(){i.value&&i.value.destroy();try{i.value=new Zw({sdk:e.sdk,self:e.self,context:e.context,firstMessage:e.firstMessage})}catch(t){throw t}}function h(e){if(!a.value)return;const t=Lw(e);Object.entries(t).forEach(([e,t])=>{a.value.style.setProperty(`--primary-${e}`,t)})}return Rw(u,"createSelfController"),Rw(h,"applyTheme"),Kn(()=>{try{u(),h(e.theme)}catch(t){const e=t instanceof Error?t.message:"Failed to initialize digital self";s.value=e,n("error",e)}}),ei(()=>{i.value&&i.value.destroy()}),to(()=>e.theme,e=>{h(e)}),to(()=>e.sdk.activeUser.value,(e,t)=>{t&&!e&&i.value&&i.value.setMode("self")}),(t,u)=>(Co(),Eo("div",{ref_key:"rootElement",ref:a,key:Vt($w)(e.self),class:"fiction-sdk @container/agent self-agent w-full h-full overflow-hidden relative","data-test":"self-agent"},[e.loading?(Co(),Eo("div",MT,[Oo(Dw,{class:"text-white size-8"})])):e.self&&!s.value?(Co(),Eo("div",{key:1,class:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:le({backgroundImage:`url(${Vt($w)(e.self)||Vt(qw)()})`})},[Mo("div",{class:me(["absolute inset-0 bg-gradient-to-br z-0","self"===c.value?"from-black/70 via-black/50 to-black/80":"from-black/90 via-black/90 to-black/100"])},null,2),Mo("div",{class:me(["relative z-10 flex flex-col h-full transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] will-change-transform",e.isActive?"opacity-100 translate-y-0":"opacity-0 translate-y-2"])},[Mo("div",{class:me(["relative z-30 p-2","self"!==c.value?"backdrop-blur-lg":""])},[Mo("div",{class:me(["flex items-center",e.hasClose?"":"justify-between"])},[Mo("div",{class:me(e.hasClose?"flex-1 basis-0":"")},[Mo("button",{class:"cursor-pointer p-2 flex items-center gap-2 rounded-2xl text-white/70 hover:bg-white/10 transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:scale-105 active:scale-95",onClick:u[0]||(u[0]=e=>o.value=!0)},[...u[6]||(u[6]=[Mo("i",{class:"i-tabler-menu size-7"},null,-1)])])],2),Mo("button",{class:me(["flex items-center gap-2 px-3.5 py-3 rounded-2xl text-white/90 hover:bg-white/10 transition-all cursor-pointer flex-grow-0",{"bg-white/10":r.value}]),onClick:u[1]||(u[1]=e=>r.value=!0)},[Mo("i",{class:me([d.value?.icon,"size-4 opacity-60"])},null,2),Mo("span",OT,be(d.value?.label),1),u[7]||(u[7]=Mo("i",{class:"i-tabler-chevron-down size-4"},null,-1))],2),e.hasClose?(Co(),Eo("div",DT,[Mo("button",{class:"cursor-pointer flex items-center p-3 rounded-2xl text-white/70 hover:bg-white/10 transition-colors",onClick:u[2]||(u[2]=as(e=>n("close","button"),["stop"]))},[...u[8]||(u[8]=[Mo("i",{class:"size-6 i-tabler-x"},null,-1)])])])):Lo("",!0)],2)],2),"self"===c.value?(Co(),Eo("div",NT,[u[9]||(u[9]=Mo("div",{class:"flex-1 basis-0 mb-36"},null,-1)),Oo(iT,{self:e.self},null,8,["self"]),Mo("div",LT,[Oo(Yw,{theme:"primary",size:"lg",class:"w-full",icon:"i-heroicons-phone","data-test":"voice-button",onClick:u[3]||(u[3]=e=>i.value?.setMode("talk"))},{default:vn(()=>[No(" Talk to "+be(e.self.name),1)]),_:1})])])):"talk"===c.value?(Co(),Eo("div",jT,[l.value?(Co(),Eo(go,{key:1},[Mo("div",null,[Mo("div",UT,[Oo(fC,{self:e.self},null,8,["self"])])]),Oo(AT,{"self-controller":i.value},null,8,["self-controller"])],64)):(Co(),_o(dC,{key:0,sdk:e.sdk},null,8,["sdk"]))])):(Co(),Eo("div",FT,[Mo("div",BT,["chat"===c.value?(Co(),Eo(go,{key:0},[l.value?(Co(),_o(JS,{key:1,"self-controller":i.value,self:e.self},null,8,["self-controller","self"])):(Co(),_o(dC,{key:0,sdk:e.sdk},null,8,["sdk"]))],64)):"info"===c.value?(Co(),_o(jS,{key:1,self:e.self},null,8,["self"])):Lo("",!0)])])),Mo("div",{class:me(["relative z-20 text-center py-5 px-6","info"===c.value?"hidden":""])},[...u[10]||(u[10]=[Mo("a",{href:"https://www.fiction.com",class:"flex items-center justify-center gap-1.5 text-[10px] font-sans font-normal text-white/50 hover:text-white/70 transition-colors"},[Mo("span",{class:""},"Digital Self\u2122"),Mo("span",{class:"text-white/20"},"by"),Mo("span",null,"Fiction.com")],-1)])],2)],2)],4)):s.value?(Co(),Eo("div",zT,[Mo("div",VT,[u[11]||(u[11]=Mo("div",{class:"flex justify-center"},[Mo("div",{class:"rounded-full bg-red-500/20 flex items-center justify-center size-10"},[Mo("i",{class:"i-tabler-alert-circle size-6 text-red-400"})])],-1)),u[12]||(u[12]=Mo("h3",{class:"text-lg font-medium"}," Self Error ",-1)),Mo("p",$T,be(s.value),1)])])):(Co(),Eo("div",qT," There was an error loading the digital self. Please try again later. ")),Oo(gT,{modelValue:o.value,"onUpdate:modelValue":u[4]||(u[4]=e=>o.value=e),self:e.self,sdk:e.sdk,title:e.self.name},null,8,["modelValue","self","sdk","title"]),Oo(fT,{modelValue:r.value,"onUpdate:modelValue":u[5]||(u[5]=e=>r.value=e),"self-controller":i.value},null,8,["modelValue","self-controller"])]))}}),HT={class:"self-wrap"},GT={key:0,class:"flex items-center justify-center h-full"},ZT=Ln({__name:"SelfWrap",props:{sdk:{},self:{},handle:{},context:{},firstMessage:{},hasClose:{type:Boolean},apiBase:{}},setup(e){const t=Os("SelfWrap"),n=e,i=n.sdk||new Zs({isDev:typeof window<"u"&&("localhost"===window.location.hostname||window.location.hostname.includes("127.0.0.1")),apiBase:n.apiBase}),o=Ft(!n.self),r=Ft(n.self),s=Ft();return Kn(async()=>{if(n.self)return t.debug("Self provided via props, skipping fetch",{selfId:n.self.selfId,handle:n.self.handle}),void(o.value=!1);if(!n.handle)return s.value="No handle or self provided",t.warn("SelfWrap mounted without handle or self",{propsReceived:{handle:n.handle,self:n.self,context:n.context,apiBase:n.apiBase},sdkState:{isDev:i.isDev,apiBase:i.apiBase}}),void(o.value=!1);try{o.value=!0,t.debug("Fetching public self",{handle:n.handle});const e=await i.getPublicSelf({handle:n.handle});e?(r.value=e,t.debug("Successfully fetched public self",{selfId:e.selfId,handle:e.handle})):(s.value=i.error.value||"Self not found",t.error("Failed to fetch public self - no data returned",{handle:n.handle,sdkError:i.error.value,sdkState:{isDev:i.isDev,apiBase:i.apiBase,loading:i.loading.value}}))}catch(e){s.value=e instanceof Error?e.message:"Failed to fetch self",t.error("Exception while fetching public self",{handle:n.handle,error:e instanceof Error?{message:e.message,stack:e.stack}:e,sdkState:{isDev:i.isDev,apiBase:i.apiBase,error:i.error.value}})}finally{o.value=!1,r.value||t.debug("SelfWrap component will render empty (silent failure)",{state:{loading:o.value,hasSelf:!!r.value,error:s.value},props:{handle:n.handle,context:n.context,apiBase:n.apiBase},sdkState:{isDev:i.isDev,apiBase:i.apiBase,error:i.error.value}})}}),(t,n)=>(Co(),Eo("div",HT,[o.value?(Co(),Eo("div",GT,[...n[0]||(n[0]=[Mo("div",{class:"animate-spin rounded-full size-6 border-b-2 border-white"},null,-1)])])):r.value?li(t.$slots,"default",{key:1,sdk:Vt(i),self:r.value,context:e.context,firstMessage:e.firstMessage,loading:o.value}):Lo("",!0)]))}}),JT={key:0,class:"relative h-full w-full"},KT={class:"group relative h-full w-full rounded-3xl overflow-hidden shadow-lg transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:shadow-2xl hover:translate-y-[-1px] hover:brightness-110 active:scale-[1.06] active:-translate-y-0.5 active:duration-100"},YT=["src","alt"],QT=Ln({__name:"SelfWidget",props:{sdk:{},handle:{},context:{},firstMessage:{},position:{}},setup(e,{expose:t}){const n=e,i=Ft(!1),o=Ft(!1);function r(){i.value=!i.value}function s(){i.value=!0}function a(){i.value=!1}function c(){a()}return Rw(r,"toggle"),to(i,async e=>{e?(await an(),setTimeout(()=>{o.value=!0},400)):o.value=!1}),Rw(s,"open"),Rw(a,"close"),Rw(c,"handleClose"),t({toggle:r,open:s,close:a}),(t,s)=>(Co(),_o(ZT,{sdk:e.sdk,handle:e.handle,context:e.context,"first-message":e.firstMessage},{default:vn(({self:t,sdk:a})=>[t?(Co(),Eo("div",{key:0,class:me(["fixed z-[999999] pointer-events-auto",["bottom-left"===n.position?"bottom-6 left-6":"top-right"===n.position?"top-6 right-6":"top-left"===n.position?"top-6 left-6":"bottom-6 right-6"]])},[Mo("div",{class:me(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu",[i.value?"widget-expanded w-96 h-[600px] max-w-[calc(100vw-48px)] max-h-[calc(100vh-48px)] rounded-3xl opacity-100 scale-100":"widget-button w-[80px] h-[80px] opacity-100 scale-100 flex items-center justify-center cursor-pointer"]]),style:le({"transform-origin":"bottom-left"===n.position?"bottom left":"top-right"===n.position?"top right":"top-left"===n.position?"top left":"bottom right"}),onClick:s[0]||(s[0]=e=>i.value?void 0:r())},[i.value?Lo("",!0):(Co(),Eo("div",JT,[Mo("div",KT,[Mo("img",{src:Vt($w)(t)||Vt(qw)(),alt:`${t.name} avatar`,class:"h-full w-full object-cover pointer-events-none"},null,8,YT),s[1]||(s[1]=Mo("div",{class:"absolute inset-0 pointer-events-none bg-gradient-to-br from-transparent via-black/10 to-black/40 opacity-60 transition-opacity duration-300 group-hover:opacity-40"},null,-1))]),s[2]||(s[2]=Mo("div",{class:"absolute top-0.5 right-0.5"},[Mo("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",style:{"animation-duration":"3s"}}),Mo("div",{class:"size-3 bg-green-500 rounded-full ring-2 ring-white"})],-1))])),i.value&&t?(Co(),_o(WT,{key:1,class:"rounded-3xl shadow-2xl border border-white/10",sdk:a,self:t,context:e.context,"first-message":e.firstMessage,"has-close":!0,"is-active":o.value,onClose:c},null,8,["sdk","self","context","first-message","is-active"])):Lo("",!0)],6)],2)):Lo("",!0)]),_:1},8,["sdk","handle","context","first-message"]))}}),XT=class e{constructor(t){n(this,"app",null),n(this,"shadowRoot",null),n(this,"container",null),n(this,"widgetInstance",null),n(this,"config"),this.config=t;const i=e.instances.get(t.handle);i&&(t.handle,i.destroy()),this.init(),e.instances.set(t.handle,this)}init(){this.container=document.createElement("div"),this.container.id=`fiction-widget-${this.config.handle}`;const e=this.config.position||"bottom-right",t=this.getPositionStyles(e);this.container.style.cssText=`\n position: fixed;\n ${t}\n z-index: 9999;\n pointer-events: auto;\n font-family: system-ui, -apple-system, sans-serif;\n `,this.shadowRoot=this.container.attachShadow({mode:"open"});const n=document.createElement("style");n.textContent=".ring-circular{animation:rotate 1s linear infinite}.ring-path{will-change:stroke-dasharray;will-change:stroke-dashoffset;stroke-dasharray:1,200;stroke-dashoffset:0;stroke-linecap:round;animation:dash 2s ease-in-out infinite}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:89,200;stroke-dashoffset:-35px}to{stroke-dasharray:89,200;stroke-dashoffset:-124px}}.nlist-enter-active,.nlist-leave-active,.nlist-move{transition:all .6s cubic-bezier(.68,-.55,.27,1.55)}.nlist-enter-from{opacity:0;transform:translate(-30px) scale(.9)}.nlist-enter-to{opacity:1;transform:translate(0) scale(1)}.nlist-leave-active{position:absolute}.nlist-leave-to{opacity:0;transform:scale(.9)}",this.shadowRoot.appendChild(n);const i=document.createElement("div");i.id="fiction-widget-root",this.shadowRoot.appendChild(i);const o="undefined"!=typeof window&&("localhost"===window.location.hostname||window.location.hostname.includes("127.0.0.1")),r=new Zs({isDev:o,apiBase:this.config.apiBase});this.config.handle,this.config.apiBase,"undefined"!=typeof window&&window.location.hostname,this.app=((...e)=>{const t=(us||(us=Gi(ds))).createApp(...e),{mount:n}=t;return t.mount=e=>{const i=function(e){return z(e)?document.querySelector(e):e}(e);if(!i)return;const o=t._component;B(o)||o.render||o.template||(o.template=i.innerHTML),1===i.nodeType&&(i.textContent="");const r=n(i,!1,function(e){return e instanceof SVGElement?"svg":"function"==typeof MathMLElement&&e instanceof MathMLElement?"mathml":void 0}(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),r},t})(QT,{sdk:r,handle:this.config.handle,context:this.config.context,firstMessage:this.config.firstMessage,position:this.config.position||"bottom-right"}),this.widgetInstance=this.app.mount(i),document.body.appendChild(this.container)}getPositionStyles(e){switch(e){case"bottom-left":return"bottom: 24px; left: 24px;";case"top-right":return"top: 24px; right: 24px;";case"top-left":return"top: 24px; left: 24px;";default:return"bottom: 24px; right: 24px;"}}toggle(){this.widgetInstance?.toggle()}open(){this.widgetInstance?.open()}close(){this.widgetInstance?.close()}destroy(){this.app&&(this.app.unmount(),this.app=null),this.container&&(this.container.remove(),this.container=null),this.shadowRoot=null,this.widgetInstance=null,e.instances.delete(this.config.handle),this.config.handle}static destroyAll(){e.instances.forEach(e=>e.destroy()),e.instances.clear()}static getInstance(t){return e.instances.get(t)}};n(XT,"instances",new Map);let ex=XT;class tx extends HTMLElement{constructor(){super(...arguments),n(this,"widget",null)}connectedCallback(){const e=this.getAttribute("handle"),t=this.getAttribute("context"),n=this.getAttribute("first-message"),i=this.getAttribute("position"),o=this.getAttribute("api-base");e&&(this.widget=new ex({handle:e,context:t||void 0,firstMessage:n||void 0,position:i||void 0,apiBase:o||void 0}),window[`openFictionSelf_${e}`]=()=>{this.widget?.open()})}disconnectedCallback(){this.widget?.destroy()}}if("undefined"==typeof window||customElements.get("fiction-self")||customElements.define("fiction-self",tx),"undefined"!=typeof window){window.FictionWidget=ex;const e=()=>{document.querySelectorAll("fiction-self").forEach(e=>{e.getAttribute("handle")})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}var nx=Object.defineProperty,ix=(e,t)=>nx(e,"name",{value:t,configurable:!0});const ox=ix((e=0)=>t=>`\x1b[${t+e}m`,"wrapAnsi16"),rx=ix((e=0)=>t=>`\x1b[${38+e};5;${t}m`,"wrapAnsi256"),sx=ix((e=0)=>(t,n,i)=>`\x1b[${38+e};2;${t};${n};${i}m`,"wrapAnsi16m"),ax={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},cx=Object.keys(ax.modifier),lx=Object.keys(ax.color),dx=Object.keys(ax.bgColor),ux=[...lx,...dx];function hx(){const e=new Map;for(const[t,n]of Object.entries(ax)){for(const[t,i]of Object.entries(n))ax[t]={open:`\x1b[${i[0]}m`,close:`\x1b[${i[1]}m`},n[t]=ax[t],e.set(i[0],i[1]);Object.defineProperty(ax,t,{value:n,enumerable:!1})}return Object.defineProperty(ax,"codes",{value:e,enumerable:!1}),ax.color.close="\x1b[39m",ax.bgColor.close="\x1b[49m",ax.color.ansi=ox(),ax.color.ansi256=rx(),ax.color.ansi16m=sx(),ax.bgColor.ansi=ox(10),ax.bgColor.ansi256=rx(10),ax.bgColor.ansi16m=sx(10),Object.defineProperties(ax,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;3===n.length&&(n=[...n].map(e=>e+e).join(""));const i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},enumerable:!1},hexToAnsi256:{value:ix(e=>ax.rgbToAnsi256(...ax.hexToRgb(e)),"value"),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,n,i;if(e>=232)t=(10*(e-232)+8)/255,n=t,i=t;else{const o=(e-=16)%36;t=Math.floor(e/36)/5,n=Math.floor(o/6)/5,i=o%6/5}const o=2*Math.max(t,n,i);if(0===o)return 30;let r=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(t));return 2===o&&(r+=60),r},enumerable:!1},rgbToAnsi:{value:ix((e,t,n)=>ax.ansi256ToAnsi(ax.rgbToAnsi256(e,t,n)),"value"),enumerable:!1},hexToAnsi:{value:ix(e=>ax.ansi256ToAnsi(ax.hexToAnsi256(e)),"value"),enumerable:!1}}),ax}ix(hx,"assembleStyles");const px=hx(),mx=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),fx=0!==mx&&{level:mx,hasBasic:!0,has256:mx>=2,has16m:mx>=3},gx={stdout:fx,stderr:fx};function vx(e,t,n){let i=e.indexOf(t);if(-1===i)return e;const o=t.length;let r=0,s="";do{s+=e.slice(r,i)+t+n,r=i+o,i=e.indexOf(t,r)}while(-1!==i);return s+=e.slice(r),s}function bx(e,t,n,i){let o=0,r="";do{const s="\r"===e[i-1];r+=e.slice(o,s?i-1:i)+t+(s?"\r\n":"\n")+n,o=i+1,i=e.indexOf("\n",o)}while(-1!==i);return r+=e.slice(o),r}ix(vx,"stringReplaceAll"),ix(bx,"stringEncaseCRLFWithFirstIndex");const{stdout:yx,stderr:kx}=gx,wx=Symbol("GENERATOR"),Cx=Symbol("STYLER"),Sx=Symbol("IS_EMPTY"),Tx=["ansi","ansi","ansi256","ansi16m"],xx=Object.create(null),Ex=ix((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const n=yx?yx.level:0;e.level=void 0===t.level?n:t.level},"applyOptions"),_x=class{constructor(e){return Px(e)}};ix(_x,"Chalk");let Ix=_x;const Px=ix(e=>{const t=ix((...e)=>e.join(" "),"chalk");return Ex(t,e),Object.setPrototypeOf(t,Rx.prototype),t},"chalkFactory");function Rx(e){return Px(e)}ix(Rx,"createChalk"),Object.setPrototypeOf(Rx.prototype,Function.prototype);for(const[zx,Vx]of Object.entries(px))xx[zx]={get(){const e=Nx(this,Dx(Vx.open,Vx.close,this[Cx]),this[Sx]);return Object.defineProperty(this,zx,{value:e}),e}};xx.visible={get(){const e=Nx(this,this[Cx],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Ax=ix((e,t,n,...i)=>"rgb"===e?"ansi16m"===t?px[n].ansi16m(...i):"ansi256"===t?px[n].ansi256(px.rgbToAnsi256(...i)):px[n].ansi(px.rgbToAnsi(...i)):"hex"===e?Ax("rgb",t,n,...px.hexToRgb(...i)):px[n][e](...i),"getModelAnsi"),Mx=["rgb","hex","ansi256"];for(const zx of Mx)xx[zx]={get(){const{level:e}=this;return function(...t){const n=Dx(Ax(zx,Tx[e],"color",...t),px.color.close,this[Cx]);return Nx(this,n,this[Sx])}}},xx["bg"+zx[0].toUpperCase()+zx.slice(1)]={get(){const{level:e}=this;return function(...t){const n=Dx(Ax(zx,Tx[e],"bgColor",...t),px.bgColor.close,this[Cx]);return Nx(this,n,this[Sx])}}};const Ox=Object.defineProperties(()=>{},{...xx,level:{enumerable:!0,get(){return this[wx].level},set(e){this[wx].level=e}}}),Dx=ix((e,t,n)=>{let i,o;return void 0===n?(i=e,o=t):(i=n.openAll+e,o=t+n.closeAll),{open:e,close:t,openAll:i,closeAll:o,parent:n}},"createStyler"),Nx=ix((e,t,n)=>{const i=ix((...e)=>Lx(i,1===e.length?""+e[0]:e.join(" ")),"builder");return Object.setPrototypeOf(i,Ox),i[wx]=e,i[Cx]=t,i[Sx]=n,i},"createBuilder"),Lx=ix((e,t)=>{if(e.level<=0||!t)return e[Sx]?"":t;let n=e[Cx];if(void 0===n)return t;const{openAll:i,closeAll:o}=n;if(t.includes("\x1b"))for(;void 0!==n;)t=vx(t,n.close,n.open),n=n.parent;const r=t.indexOf("\n");return-1!==r&&(t=bx(t,o,i,r)),i+t+o},"applyStyle");Object.defineProperties(Rx.prototype,xx);const jx=Rx(),Ux=Rx({level:kx?kx.level:0}),Fx=Object.freeze(Object.defineProperty({__proto__:null,Chalk:Ix,backgroundColorNames:dx,backgroundColors:dx,chalkStderr:Ux,colorNames:ux,colors:ux,default:jx,foregroundColorNames:lx,foregroundColors:lx,modifierNames:cx,modifiers:cx,supportsColor:yx,supportsColorStderr:kx},Symbol.toStringTag,{value:"Module"}));return e.FictionWidget=ex,e.default=ex,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),e}({});