@eluvio/elv-player-js 2.0.2 → 2.0.3

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.
@@ -316,7 +316,7 @@ ${o} ${VX(e)}
316
316
  * @author Feross Aboukhadijeh <https://feross.org>
317
317
  * @license MIT
318
318
  */(function(n){const e=JI(),t=QI(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=c,n.SlowBuffer=I,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.kMaxLength=i,c.TYPED_ARRAY_SUPPORT=o(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const X=new Uint8Array(1),$={foo:function(){return 42}};return Object.setPrototypeOf($,Uint8Array.prototype),Object.setPrototypeOf(X,$),X.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function u(X){if(X>i)throw new RangeError('The value "'+X+'" is invalid for option "size"');const $=new Uint8Array(X);return Object.setPrototypeOf($,c.prototype),$}function c(X,$,G){if(typeof X=="number"){if(typeof $=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(X)}return p(X,$,G)}c.poolSize=8192;function p(X,$,G){if(typeof X=="string")return w(X,$);if(ArrayBuffer.isView(X))return C(X);if(X==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof X);if(Le(X,ArrayBuffer)||X&&Le(X.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Le(X,SharedArrayBuffer)||X&&Le(X.buffer,SharedArrayBuffer)))return T(X,$,G);if(typeof X=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const me=X.valueOf&&X.valueOf();if(me!=null&&me!==X)return c.from(me,$,G);const xe=R(X);if(xe)return xe;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof X[Symbol.toPrimitive]=="function")return c.from(X[Symbol.toPrimitive]("string"),$,G);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof X)}c.from=function(X,$,G){return p(X,$,G)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function h(X){if(typeof X!="number")throw new TypeError('"size" argument must be of type number');if(X<0)throw new RangeError('The value "'+X+'" is invalid for option "size"')}function g(X,$,G){return h(X),X<=0?u(X):$!==void 0?typeof G=="string"?u(X).fill($,G):u(X).fill($):u(X)}c.alloc=function(X,$,G){return g(X,$,G)};function m(X){return h(X),u(X<0?0:O(X)|0)}c.allocUnsafe=function(X){return m(X)},c.allocUnsafeSlow=function(X){return m(X)};function w(X,$){if((typeof $!="string"||$==="")&&($="utf8"),!c.isEncoding($))throw new TypeError("Unknown encoding: "+$);const G=D(X,$)|0;let me=u(G);const xe=me.write(X,$);return xe!==G&&(me=me.slice(0,xe)),me}function v(X){const $=X.length<0?0:O(X.length)|0,G=u($);for(let me=0;me<$;me+=1)G[me]=X[me]&255;return G}function C(X){if(Le(X,Uint8Array)){const $=new Uint8Array(X);return T($.buffer,$.byteOffset,$.byteLength)}return v(X)}function T(X,$,G){if($<0||X.byteLength<$)throw new RangeError('"offset" is outside of buffer bounds');if(X.byteLength<$+(G||0))throw new RangeError('"length" is outside of buffer bounds');let me;return $===void 0&&G===void 0?me=new Uint8Array(X):G===void 0?me=new Uint8Array(X,$):me=new Uint8Array(X,$,G),Object.setPrototypeOf(me,c.prototype),me}function R(X){if(c.isBuffer(X)){const $=O(X.length)|0,G=u($);return G.length===0||X.copy(G,0,0,$),G}if(X.length!==void 0)return typeof X.length!="number"||Xe(X.length)?u(0):v(X);if(X.type==="Buffer"&&Array.isArray(X.data))return v(X.data)}function O(X){if(X>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return X|0}function I(X){return+X!=X&&(X=0),c.alloc(+X)}c.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==c.prototype},c.compare=function($,G){if(Le($,Uint8Array)&&($=c.from($,$.offset,$.byteLength)),Le(G,Uint8Array)&&(G=c.from(G,G.offset,G.byteLength)),!c.isBuffer($)||!c.isBuffer(G))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===G)return 0;let me=$.length,xe=G.length;for(let Re=0,Fe=Math.min(me,xe);Re<Fe;++Re)if($[Re]!==G[Re]){me=$[Re],xe=G[Re];break}return me<xe?-1:xe<me?1:0},c.isEncoding=function($){switch(String($).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function($,G){if(!Array.isArray($))throw new TypeError('"list" argument must be an Array of Buffers');if($.length===0)return c.alloc(0);let me;if(G===void 0)for(G=0,me=0;me<$.length;++me)G+=$[me].length;const xe=c.allocUnsafe(G);let Re=0;for(me=0;me<$.length;++me){let Fe=$[me];if(Le(Fe,Uint8Array))Re+Fe.length>xe.length?(c.isBuffer(Fe)||(Fe=c.from(Fe)),Fe.copy(xe,Re)):Uint8Array.prototype.set.call(xe,Fe,Re);else if(c.isBuffer(Fe))Fe.copy(xe,Re);else throw new TypeError('"list" argument must be an Array of Buffers');Re+=Fe.length}return xe};function D(X,$){if(c.isBuffer(X))return X.length;if(ArrayBuffer.isView(X)||Le(X,ArrayBuffer))return X.byteLength;if(typeof X!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof X);const G=X.length,me=arguments.length>2&&arguments[2]===!0;if(!me&&G===0)return 0;let xe=!1;for(;;)switch($){case"ascii":case"latin1":case"binary":return G;case"utf8":case"utf-8":return N(X).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G*2;case"hex":return G>>>1;case"base64":return oe(X).length;default:if(xe)return me?-1:N(X).length;$=(""+$).toLowerCase(),xe=!0}}c.byteLength=D;function K(X,$,G){let me=!1;if(($===void 0||$<0)&&($=0),$>this.length||((G===void 0||G>this.length)&&(G=this.length),G<=0)||(G>>>=0,$>>>=0,G<=$))return"";for(X||(X="utf8");;)switch(X){case"hex":return Y(this,$,G);case"utf8":case"utf-8":return x(this,$,G);case"ascii":return L(this,$,G);case"latin1":case"binary":return z(this,$,G);case"base64":return S(this,$,G);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,$,G);default:if(me)throw new TypeError("Unknown encoding: "+X);X=(X+"").toLowerCase(),me=!0}}c.prototype._isBuffer=!0;function W(X,$,G){const me=X[$];X[$]=X[G],X[G]=me}c.prototype.swap16=function(){const $=this.length;if($%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let G=0;G<$;G+=2)W(this,G,G+1);return this},c.prototype.swap32=function(){const $=this.length;if($%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let G=0;G<$;G+=4)W(this,G,G+3),W(this,G+1,G+2);return this},c.prototype.swap64=function(){const $=this.length;if($%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let G=0;G<$;G+=8)W(this,G,G+7),W(this,G+1,G+6),W(this,G+2,G+5),W(this,G+3,G+4);return this},c.prototype.toString=function(){const $=this.length;return $===0?"":arguments.length===0?x(this,0,$):K.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function($){if(!c.isBuffer($))throw new TypeError("Argument must be a Buffer");return this===$?!0:c.compare(this,$)===0},c.prototype.inspect=function(){let $="";const G=n.INSPECT_MAX_BYTES;return $=this.toString("hex",0,G).replace(/(.{2})/g,"$1 ").trim(),this.length>G&&($+=" ... "),"<Buffer "+$+">"},r&&(c.prototype[r]=c.prototype.inspect),c.prototype.compare=function($,G,me,xe,Re){if(Le($,Uint8Array)&&($=c.from($,$.offset,$.byteLength)),!c.isBuffer($))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof $);if(G===void 0&&(G=0),me===void 0&&(me=$?$.length:0),xe===void 0&&(xe=0),Re===void 0&&(Re=this.length),G<0||me>$.length||xe<0||Re>this.length)throw new RangeError("out of range index");if(xe>=Re&&G>=me)return 0;if(xe>=Re)return-1;if(G>=me)return 1;if(G>>>=0,me>>>=0,xe>>>=0,Re>>>=0,this===$)return 0;let Fe=Re-xe,Et=me-G;const vt=Math.min(Fe,Et),xt=this.slice(xe,Re),kt=$.slice(G,me);for(let Nt=0;Nt<vt;++Nt)if(xt[Nt]!==kt[Nt]){Fe=xt[Nt],Et=kt[Nt];break}return Fe<Et?-1:Et<Fe?1:0};function pe(X,$,G,me,xe){if(X.length===0)return-1;if(typeof G=="string"?(me=G,G=0):G>2147483647?G=2147483647:G<-2147483648&&(G=-2147483648),G=+G,Xe(G)&&(G=xe?0:X.length-1),G<0&&(G=X.length+G),G>=X.length){if(xe)return-1;G=X.length-1}else if(G<0)if(xe)G=0;else return-1;if(typeof $=="string"&&($=c.from($,me)),c.isBuffer($))return $.length===0?-1:ce(X,$,G,me,xe);if(typeof $=="number")return $=$&255,typeof Uint8Array.prototype.indexOf=="function"?xe?Uint8Array.prototype.indexOf.call(X,$,G):Uint8Array.prototype.lastIndexOf.call(X,$,G):ce(X,[$],G,me,xe);throw new TypeError("val must be string, number or Buffer")}function ce(X,$,G,me,xe){let Re=1,Fe=X.length,Et=$.length;if(me!==void 0&&(me=String(me).toLowerCase(),me==="ucs2"||me==="ucs-2"||me==="utf16le"||me==="utf-16le")){if(X.length<2||$.length<2)return-1;Re=2,Fe/=2,Et/=2,G/=2}function vt(kt,Nt){return Re===1?kt[Nt]:kt.readUInt16BE(Nt*Re)}let xt;if(xe){let kt=-1;for(xt=G;xt<Fe;xt++)if(vt(X,xt)===vt($,kt===-1?0:xt-kt)){if(kt===-1&&(kt=xt),xt-kt+1===Et)return kt*Re}else kt!==-1&&(xt-=xt-kt),kt=-1}else for(G+Et>Fe&&(G=Fe-Et),xt=G;xt>=0;xt--){let kt=!0;for(let Nt=0;Nt<Et;Nt++)if(vt(X,xt+Nt)!==vt($,Nt)){kt=!1;break}if(kt)return xt}return-1}c.prototype.includes=function($,G,me){return this.indexOf($,G,me)!==-1},c.prototype.indexOf=function($,G,me){return pe(this,$,G,me,!0)},c.prototype.lastIndexOf=function($,G,me){return pe(this,$,G,me,!1)};function ge(X,$,G,me){G=Number(G)||0;const xe=X.length-G;me?(me=Number(me),me>xe&&(me=xe)):me=xe;const Re=$.length;me>Re/2&&(me=Re/2);let Fe;for(Fe=0;Fe<me;++Fe){const Et=parseInt($.substr(Fe*2,2),16);if(Xe(Et))return Fe;X[G+Fe]=Et}return Fe}function Se(X,$,G,me){return Ce(N($,X.length-G),X,G,me)}function _e(X,$,G,me){return Ce(B($),X,G,me)}function ae(X,$,G,me){return Ce(oe($),X,G,me)}function Te(X,$,G,me){return Ce(te($,X.length-G),X,G,me)}c.prototype.write=function($,G,me,xe){if(G===void 0)xe="utf8",me=this.length,G=0;else if(me===void 0&&typeof G=="string")xe=G,me=this.length,G=0;else if(isFinite(G))G=G>>>0,isFinite(me)?(me=me>>>0,xe===void 0&&(xe="utf8")):(xe=me,me=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Re=this.length-G;if((me===void 0||me>Re)&&(me=Re),$.length>0&&(me<0||G<0)||G>this.length)throw new RangeError("Attempt to write outside buffer bounds");xe||(xe="utf8");let Fe=!1;for(;;)switch(xe){case"hex":return ge(this,$,G,me);case"utf8":case"utf-8":return Se(this,$,G,me);case"ascii":case"latin1":case"binary":return _e(this,$,G,me);case"base64":return ae(this,$,G,me);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Te(this,$,G,me);default:if(Fe)throw new TypeError("Unknown encoding: "+xe);xe=(""+xe).toLowerCase(),Fe=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function S(X,$,G){return $===0&&G===X.length?e.fromByteArray(X):e.fromByteArray(X.slice($,G))}function x(X,$,G){G=Math.min(X.length,G);const me=[];let xe=$;for(;xe<G;){const Re=X[xe];let Fe=null,Et=Re>239?4:Re>223?3:Re>191?2:1;if(xe+Et<=G){let vt,xt,kt,Nt;switch(Et){case 1:Re<128&&(Fe=Re);break;case 2:vt=X[xe+1],(vt&192)===128&&(Nt=(Re&31)<<6|vt&63,Nt>127&&(Fe=Nt));break;case 3:vt=X[xe+1],xt=X[xe+2],(vt&192)===128&&(xt&192)===128&&(Nt=(Re&15)<<12|(vt&63)<<6|xt&63,Nt>2047&&(Nt<55296||Nt>57343)&&(Fe=Nt));break;case 4:vt=X[xe+1],xt=X[xe+2],kt=X[xe+3],(vt&192)===128&&(xt&192)===128&&(kt&192)===128&&(Nt=(Re&15)<<18|(vt&63)<<12|(xt&63)<<6|kt&63,Nt>65535&&Nt<1114112&&(Fe=Nt))}}Fe===null?(Fe=65533,Et=1):Fe>65535&&(Fe-=65536,me.push(Fe>>>10&1023|55296),Fe=56320|Fe&1023),me.push(Fe),xe+=Et}return U(me)}const A=4096;function U(X){const $=X.length;if($<=A)return String.fromCharCode.apply(String,X);let G="",me=0;for(;me<$;)G+=String.fromCharCode.apply(String,X.slice(me,me+=A));return G}function L(X,$,G){let me="";G=Math.min(X.length,G);for(let xe=$;xe<G;++xe)me+=String.fromCharCode(X[xe]&127);return me}function z(X,$,G){let me="";G=Math.min(X.length,G);for(let xe=$;xe<G;++xe)me+=String.fromCharCode(X[xe]);return me}function Y(X,$,G){const me=X.length;(!$||$<0)&&($=0),(!G||G<0||G>me)&&(G=me);let xe="";for(let Re=$;Re<G;++Re)xe+=ct[X[Re]];return xe}function q(X,$,G){const me=X.slice($,G);let xe="";for(let Re=0;Re<me.length-1;Re+=2)xe+=String.fromCharCode(me[Re]+me[Re+1]*256);return xe}c.prototype.slice=function($,G){const me=this.length;$=~~$,G=G===void 0?me:~~G,$<0?($+=me,$<0&&($=0)):$>me&&($=me),G<0?(G+=me,G<0&&(G=0)):G>me&&(G=me),G<$&&(G=$);const xe=this.subarray($,G);return Object.setPrototypeOf(xe,c.prototype),xe};function P(X,$,G){if(X%1!==0||X<0)throw new RangeError("offset is not uint");if(X+$>G)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function($,G,me){$=$>>>0,G=G>>>0,me||P($,G,this.length);let xe=this[$],Re=1,Fe=0;for(;++Fe<G&&(Re*=256);)xe+=this[$+Fe]*Re;return xe},c.prototype.readUintBE=c.prototype.readUIntBE=function($,G,me){$=$>>>0,G=G>>>0,me||P($,G,this.length);let xe=this[$+--G],Re=1;for(;G>0&&(Re*=256);)xe+=this[$+--G]*Re;return xe},c.prototype.readUint8=c.prototype.readUInt8=function($,G){return $=$>>>0,G||P($,1,this.length),this[$]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function($,G){return $=$>>>0,G||P($,2,this.length),this[$]|this[$+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function($,G){return $=$>>>0,G||P($,2,this.length),this[$]<<8|this[$+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function($,G){return $=$>>>0,G||P($,4,this.length),(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function($,G){return $=$>>>0,G||P($,4,this.length),this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])},c.prototype.readBigUInt64LE=Ct(function($){$=$>>>0,le($,"offset");const G=this[$],me=this[$+7];(G===void 0||me===void 0)&&ne($,this.length-8);const xe=G+this[++$]*2**8+this[++$]*2**16+this[++$]*2**24,Re=this[++$]+this[++$]*2**8+this[++$]*2**16+me*2**24;return BigInt(xe)+(BigInt(Re)<<BigInt(32))}),c.prototype.readBigUInt64BE=Ct(function($){$=$>>>0,le($,"offset");const G=this[$],me=this[$+7];(G===void 0||me===void 0)&&ne($,this.length-8);const xe=G*2**24+this[++$]*2**16+this[++$]*2**8+this[++$],Re=this[++$]*2**24+this[++$]*2**16+this[++$]*2**8+me;return(BigInt(xe)<<BigInt(32))+BigInt(Re)}),c.prototype.readIntLE=function($,G,me){$=$>>>0,G=G>>>0,me||P($,G,this.length);let xe=this[$],Re=1,Fe=0;for(;++Fe<G&&(Re*=256);)xe+=this[$+Fe]*Re;return Re*=128,xe>=Re&&(xe-=Math.pow(2,8*G)),xe},c.prototype.readIntBE=function($,G,me){$=$>>>0,G=G>>>0,me||P($,G,this.length);let xe=G,Re=1,Fe=this[$+--xe];for(;xe>0&&(Re*=256);)Fe+=this[$+--xe]*Re;return Re*=128,Fe>=Re&&(Fe-=Math.pow(2,8*G)),Fe},c.prototype.readInt8=function($,G){return $=$>>>0,G||P($,1,this.length),this[$]&128?(255-this[$]+1)*-1:this[$]},c.prototype.readInt16LE=function($,G){$=$>>>0,G||P($,2,this.length);const me=this[$]|this[$+1]<<8;return me&32768?me|4294901760:me},c.prototype.readInt16BE=function($,G){$=$>>>0,G||P($,2,this.length);const me=this[$+1]|this[$]<<8;return me&32768?me|4294901760:me},c.prototype.readInt32LE=function($,G){return $=$>>>0,G||P($,4,this.length),this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24},c.prototype.readInt32BE=function($,G){return $=$>>>0,G||P($,4,this.length),this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]},c.prototype.readBigInt64LE=Ct(function($){$=$>>>0,le($,"offset");const G=this[$],me=this[$+7];(G===void 0||me===void 0)&&ne($,this.length-8);const xe=this[$+4]+this[$+5]*2**8+this[$+6]*2**16+(me<<24);return(BigInt(xe)<<BigInt(32))+BigInt(G+this[++$]*2**8+this[++$]*2**16+this[++$]*2**24)}),c.prototype.readBigInt64BE=Ct(function($){$=$>>>0,le($,"offset");const G=this[$],me=this[$+7];(G===void 0||me===void 0)&&ne($,this.length-8);const xe=(G<<24)+this[++$]*2**16+this[++$]*2**8+this[++$];return(BigInt(xe)<<BigInt(32))+BigInt(this[++$]*2**24+this[++$]*2**16+this[++$]*2**8+me)}),c.prototype.readFloatLE=function($,G){return $=$>>>0,G||P($,4,this.length),t.read(this,$,!0,23,4)},c.prototype.readFloatBE=function($,G){return $=$>>>0,G||P($,4,this.length),t.read(this,$,!1,23,4)},c.prototype.readDoubleLE=function($,G){return $=$>>>0,G||P($,8,this.length),t.read(this,$,!0,52,8)},c.prototype.readDoubleBE=function($,G){return $=$>>>0,G||P($,8,this.length),t.read(this,$,!1,52,8)};function M(X,$,G,me,xe,Re){if(!c.isBuffer(X))throw new TypeError('"buffer" argument must be a Buffer instance');if($>xe||$<Re)throw new RangeError('"value" argument is out of bounds');if(G+me>X.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function($,G,me,xe){if($=+$,G=G>>>0,me=me>>>0,!xe){const Et=Math.pow(2,8*me)-1;M(this,$,G,me,Et,0)}let Re=1,Fe=0;for(this[G]=$&255;++Fe<me&&(Re*=256);)this[G+Fe]=$/Re&255;return G+me},c.prototype.writeUintBE=c.prototype.writeUIntBE=function($,G,me,xe){if($=+$,G=G>>>0,me=me>>>0,!xe){const Et=Math.pow(2,8*me)-1;M(this,$,G,me,Et,0)}let Re=me-1,Fe=1;for(this[G+Re]=$&255;--Re>=0&&(Fe*=256);)this[G+Re]=$/Fe&255;return G+me},c.prototype.writeUint8=c.prototype.writeUInt8=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,1,255,0),this[G]=$&255,G+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,2,65535,0),this[G]=$&255,this[G+1]=$>>>8,G+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,2,65535,0),this[G]=$>>>8,this[G+1]=$&255,G+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,4,4294967295,0),this[G+3]=$>>>24,this[G+2]=$>>>16,this[G+1]=$>>>8,this[G]=$&255,G+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,4,4294967295,0),this[G]=$>>>24,this[G+1]=$>>>16,this[G+2]=$>>>8,this[G+3]=$&255,G+4};function Q(X,$,G,me,xe){de($,me,xe,X,G,7);let Re=Number($&BigInt(4294967295));X[G++]=Re,Re=Re>>8,X[G++]=Re,Re=Re>>8,X[G++]=Re,Re=Re>>8,X[G++]=Re;let Fe=Number($>>BigInt(32)&BigInt(4294967295));return X[G++]=Fe,Fe=Fe>>8,X[G++]=Fe,Fe=Fe>>8,X[G++]=Fe,Fe=Fe>>8,X[G++]=Fe,G}function ie(X,$,G,me,xe){de($,me,xe,X,G,7);let Re=Number($&BigInt(4294967295));X[G+7]=Re,Re=Re>>8,X[G+6]=Re,Re=Re>>8,X[G+5]=Re,Re=Re>>8,X[G+4]=Re;let Fe=Number($>>BigInt(32)&BigInt(4294967295));return X[G+3]=Fe,Fe=Fe>>8,X[G+2]=Fe,Fe=Fe>>8,X[G+1]=Fe,Fe=Fe>>8,X[G]=Fe,G+8}c.prototype.writeBigUInt64LE=Ct(function($,G=0){return Q(this,$,G,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Ct(function($,G=0){return ie(this,$,G,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function($,G,me,xe){if($=+$,G=G>>>0,!xe){const vt=Math.pow(2,8*me-1);M(this,$,G,me,vt-1,-vt)}let Re=0,Fe=1,Et=0;for(this[G]=$&255;++Re<me&&(Fe*=256);)$<0&&Et===0&&this[G+Re-1]!==0&&(Et=1),this[G+Re]=($/Fe>>0)-Et&255;return G+me},c.prototype.writeIntBE=function($,G,me,xe){if($=+$,G=G>>>0,!xe){const vt=Math.pow(2,8*me-1);M(this,$,G,me,vt-1,-vt)}let Re=me-1,Fe=1,Et=0;for(this[G+Re]=$&255;--Re>=0&&(Fe*=256);)$<0&&Et===0&&this[G+Re+1]!==0&&(Et=1),this[G+Re]=($/Fe>>0)-Et&255;return G+me},c.prototype.writeInt8=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,1,127,-128),$<0&&($=255+$+1),this[G]=$&255,G+1},c.prototype.writeInt16LE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,2,32767,-32768),this[G]=$&255,this[G+1]=$>>>8,G+2},c.prototype.writeInt16BE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,2,32767,-32768),this[G]=$>>>8,this[G+1]=$&255,G+2},c.prototype.writeInt32LE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,4,2147483647,-2147483648),this[G]=$&255,this[G+1]=$>>>8,this[G+2]=$>>>16,this[G+3]=$>>>24,G+4},c.prototype.writeInt32BE=function($,G,me){return $=+$,G=G>>>0,me||M(this,$,G,4,2147483647,-2147483648),$<0&&($=4294967295+$+1),this[G]=$>>>24,this[G+1]=$>>>16,this[G+2]=$>>>8,this[G+3]=$&255,G+4},c.prototype.writeBigInt64LE=Ct(function($,G=0){return Q(this,$,G,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Ct(function($,G=0){return ie(this,$,G,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function H(X,$,G,me,xe,Re){if(G+me>X.length)throw new RangeError("Index out of range");if(G<0)throw new RangeError("Index out of range")}function we(X,$,G,me,xe){return $=+$,G=G>>>0,xe||H(X,$,G,4),t.write(X,$,G,me,23,4),G+4}c.prototype.writeFloatLE=function($,G,me){return we(this,$,G,!0,me)},c.prototype.writeFloatBE=function($,G,me){return we(this,$,G,!1,me)};function Ne(X,$,G,me,xe){return $=+$,G=G>>>0,xe||H(X,$,G,8),t.write(X,$,G,me,52,8),G+8}c.prototype.writeDoubleLE=function($,G,me){return Ne(this,$,G,!0,me)},c.prototype.writeDoubleBE=function($,G,me){return Ne(this,$,G,!1,me)},c.prototype.copy=function($,G,me,xe){if(!c.isBuffer($))throw new TypeError("argument should be a Buffer");if(me||(me=0),!xe&&xe!==0&&(xe=this.length),G>=$.length&&(G=$.length),G||(G=0),xe>0&&xe<me&&(xe=me),xe===me||$.length===0||this.length===0)return 0;if(G<0)throw new RangeError("targetStart out of bounds");if(me<0||me>=this.length)throw new RangeError("Index out of range");if(xe<0)throw new RangeError("sourceEnd out of bounds");xe>this.length&&(xe=this.length),$.length-G<xe-me&&(xe=$.length-G+me);const Re=xe-me;return this===$&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(G,me,xe):Uint8Array.prototype.set.call($,this.subarray(me,xe),G),Re},c.prototype.fill=function($,G,me,xe){if(typeof $=="string"){if(typeof G=="string"?(xe=G,G=0,me=this.length):typeof me=="string"&&(xe=me,me=this.length),xe!==void 0&&typeof xe!="string")throw new TypeError("encoding must be a string");if(typeof xe=="string"&&!c.isEncoding(xe))throw new TypeError("Unknown encoding: "+xe);if($.length===1){const Fe=$.charCodeAt(0);(xe==="utf8"&&Fe<128||xe==="latin1")&&($=Fe)}}else typeof $=="number"?$=$&255:typeof $=="boolean"&&($=Number($));if(G<0||this.length<G||this.length<me)throw new RangeError("Out of range index");if(me<=G)return this;G=G>>>0,me=me===void 0?this.length:me>>>0,$||($=0);let Re;if(typeof $=="number")for(Re=G;Re<me;++Re)this[Re]=$;else{const Fe=c.isBuffer($)?$:c.from($,xe),Et=Fe.length;if(Et===0)throw new TypeError('The value "'+$+'" is invalid for argument "value"');for(Re=0;Re<me-G;++Re)this[Re+G]=Fe[Re%Et]}return this};const ke={};function Ue(X,$,G){ke[X]=class extends G{constructor(){super(),Object.defineProperty(this,"message",{value:$.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${X}]`,this.stack,delete this.name}get code(){return X}set code(xe){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:xe,writable:!0})}toString(){return`${this.name} [${X}]: ${this.message}`}}}Ue("ERR_BUFFER_OUT_OF_BOUNDS",function(X){return X?`${X} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ue("ERR_INVALID_ARG_TYPE",function(X,$){return`The "${X}" argument must be of type number. Received type ${typeof $}`},TypeError),Ue("ERR_OUT_OF_RANGE",function(X,$,G){let me=`The value of "${X}" is out of range.`,xe=G;return Number.isInteger(G)&&Math.abs(G)>2**32?xe=se(String(G)):typeof G=="bigint"&&(xe=String(G),(G>BigInt(2)**BigInt(32)||G<-(BigInt(2)**BigInt(32)))&&(xe=se(xe)),xe+="n"),me+=` It must be ${$}. Received ${xe}`,me},RangeError);function se(X){let $="",G=X.length;const me=X[0]==="-"?1:0;for(;G>=me+4;G-=3)$=`_${X.slice(G-3,G)}${$}`;return`${X.slice(0,G)}${$}`}function fe(X,$,G){le($,"offset"),(X[$]===void 0||X[$+G]===void 0)&&ne($,X.length-(G+1))}function de(X,$,G,me,xe,Re){if(X>G||X<$){const Fe=typeof $=="bigint"?"n":"";let Et;throw Re>3?$===0||$===BigInt(0)?Et=`>= 0${Fe} and < 2${Fe} ** ${(Re+1)*8}${Fe}`:Et=`>= -(2${Fe} ** ${(Re+1)*8-1}${Fe}) and < 2 ** ${(Re+1)*8-1}${Fe}`:Et=`>= ${$}${Fe} and <= ${G}${Fe}`,new ke.ERR_OUT_OF_RANGE("value",Et,X)}fe(me,xe,Re)}function le(X,$){if(typeof X!="number")throw new ke.ERR_INVALID_ARG_TYPE($,"number",X)}function ne(X,$,G){throw Math.floor(X)!==X?(le(X,G),new ke.ERR_OUT_OF_RANGE(G||"offset","an integer",X)):$<0?new ke.ERR_BUFFER_OUT_OF_BOUNDS:new ke.ERR_OUT_OF_RANGE(G||"offset",`>= ${G?1:0} and <= ${$}`,X)}const ye=/[^+/0-9A-Za-z-_]/g;function Z(X){if(X=X.split("=")[0],X=X.trim().replace(ye,""),X.length<2)return"";for(;X.length%4!==0;)X=X+"=";return X}function N(X,$){$=$||1/0;let G;const me=X.length;let xe=null;const Re=[];for(let Fe=0;Fe<me;++Fe){if(G=X.charCodeAt(Fe),G>55295&&G<57344){if(!xe){if(G>56319){($-=3)>-1&&Re.push(239,191,189);continue}else if(Fe+1===me){($-=3)>-1&&Re.push(239,191,189);continue}xe=G;continue}if(G<56320){($-=3)>-1&&Re.push(239,191,189),xe=G;continue}G=(xe-55296<<10|G-56320)+65536}else xe&&($-=3)>-1&&Re.push(239,191,189);if(xe=null,G<128){if(($-=1)<0)break;Re.push(G)}else if(G<2048){if(($-=2)<0)break;Re.push(G>>6|192,G&63|128)}else if(G<65536){if(($-=3)<0)break;Re.push(G>>12|224,G>>6&63|128,G&63|128)}else if(G<1114112){if(($-=4)<0)break;Re.push(G>>18|240,G>>12&63|128,G>>6&63|128,G&63|128)}else throw new Error("Invalid code point")}return Re}function B(X){const $=[];for(let G=0;G<X.length;++G)$.push(X.charCodeAt(G)&255);return $}function te(X,$){let G,me,xe;const Re=[];for(let Fe=0;Fe<X.length&&!(($-=2)<0);++Fe)G=X.charCodeAt(Fe),me=G>>8,xe=G%256,Re.push(xe),Re.push(me);return Re}function oe(X){return e.toByteArray(Z(X))}function Ce(X,$,G,me){let xe;for(xe=0;xe<me&&!(xe+G>=$.length||xe>=X.length);++xe)$[xe+G]=X[xe];return xe}function Le(X,$){return X instanceof $||X!=null&&X.constructor!=null&&X.constructor.name!=null&&X.constructor.name===$.name}function Xe(X){return X!==X}const ct=function(){const X="0123456789abcdef",$=new Array(256);for(let G=0;G<16;++G){const me=G*16;for(let xe=0;xe<16;++xe)$[me+xe]=X[G]+X[xe]}return $}();function Ct(X){return typeof BigInt>"u"?Mt:X}function Mt(){throw new Error("BigInt not supported")}})(ip);var wa={ArrayIsArray(n){return Array.isArray(n)},ArrayPrototypeIncludes(n,e){return n.includes(e)},ArrayPrototypeIndexOf(n,e){return n.indexOf(e)},ArrayPrototypeJoin(n,e){return n.join(e)},ArrayPrototypeMap(n,e){return n.map(e)},ArrayPrototypePop(n,e){return n.pop(e)},ArrayPrototypePush(n,e){return n.push(e)},ArrayPrototypeSlice(n,e,t){return n.slice(e,t)},Error,FunctionPrototypeCall(n,e,...t){return n.call(e,...t)},FunctionPrototypeSymbolHasInstance(n,e){return Function.prototype[Symbol.hasInstance].call(n,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(n,e){return Object.defineProperties(n,e)},ObjectDefineProperty(n,e,t){return Object.defineProperty(n,e,t)},ObjectGetOwnPropertyDescriptor(n,e){return Object.getOwnPropertyDescriptor(n,e)},ObjectKeys(n){return Object.keys(n)},ObjectSetPrototypeOf(n,e){return Object.setPrototypeOf(n,e)},Promise,PromisePrototypeCatch(n,e){return n.catch(e)},PromisePrototypeThen(n,e,t){return n.then(e,t)},PromiseReject(n){return Promise.reject(n)},PromiseResolve(n){return Promise.resolve(n)},ReflectApply:Reflect.apply,RegExpPrototypeTest(n,e){return n.test(e)},SafeSet:Set,String,StringPrototypeSlice(n,e,t){return n.slice(e,t)},StringPrototypeToLowerCase(n){return n.toLowerCase()},StringPrototypeToUpperCase(n){return n.toUpperCase()},StringPrototypeTrim(n){return n.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(n,e,t){return n.set(e,t)},Boolean,Uint8Array},wB={exports:{}},dv={exports:{}},nP;function r1(){if(nP)return dv.exports;nP=1;const{AbortController:n,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return dv.exports=n,dv.exports.AbortSignal=e,dv.exports.default=n,dv.exports}var MM={exports:{}},cm=typeof Reflect=="object"?Reflect:null,rP=cm&&typeof cm.apply=="function"?cm.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},u2;cm&&typeof cm.ownKeys=="function"?u2=cm.ownKeys:Object.getOwnPropertySymbols?u2=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:u2=function(e){return Object.getOwnPropertyNames(e)};function Fae(n){console&&console.warn&&console.warn(n)}var xB=Number.isNaN||function(e){return e!==e};function Lr(){Lr.init.call(this)}MM.exports=Lr;MM.exports.once=$ae;Lr.EventEmitter=Lr;Lr.prototype._events=void 0;Lr.prototype._eventsCount=0;Lr.prototype._maxListeners=void 0;var aP=10;function hS(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(Lr,"defaultMaxListeners",{enumerable:!0,get:function(){return aP},set:function(n){if(typeof n!="number"||n<0||xB(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");aP=n}});Lr.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};Lr.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||xB(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};function _B(n){return n._maxListeners===void 0?Lr.defaultMaxListeners:n._maxListeners}Lr.prototype.getMaxListeners=function(){return _B(this)};Lr.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var u;if(t.length>0&&(u=t[0]),u instanceof Error)throw u;var c=new Error("Unhandled error."+(u?" ("+u.message+")":""));throw c.context=u,c}var p=o[e];if(p===void 0)return!1;if(typeof p=="function")rP(p,this,t);else for(var h=p.length,g=MB(p,h),r=0;r<h;++r)rP(g[r],this,t);return!0};function SB(n,e,t,r){var i,o,u;if(hS(t),o=n._events,o===void 0?(o=n._events=Object.create(null),n._eventsCount=0):(o.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),o=n._events),u=o[e]),u===void 0)u=o[e]=t,++n._eventsCount;else if(typeof u=="function"?u=o[e]=r?[t,u]:[u,t]:r?u.unshift(t):u.push(t),i=_B(n),i>0&&u.length>i&&!u.warned){u.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+u.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=n,c.type=e,c.count=u.length,Fae(c)}return n}Lr.prototype.addListener=function(e,t){return SB(this,e,t,!1)};Lr.prototype.on=Lr.prototype.addListener;Lr.prototype.prependListener=function(e,t){return SB(this,e,t,!0)};function Bae(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function EB(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=Bae.bind(r);return i.listener=t,r.wrapFn=i,i}Lr.prototype.once=function(e,t){return hS(t),this.on(e,EB(this,e,t)),this};Lr.prototype.prependOnceListener=function(e,t){return hS(t),this.prependListener(e,EB(this,e,t)),this};Lr.prototype.removeListener=function(e,t){var r,i,o,u,c;if(hS(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(o=-1,u=r.length-1;u>=0;u--)if(r[u]===t||r[u].listener===t){c=r[u].listener,o=u;break}if(o<0)return this;o===0?r.shift():zae(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,c||t)}return this};Lr.prototype.off=Lr.prototype.removeListener;Lr.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),u;for(i=0;i<o.length;++i)u=o[i],u!=="removeListener"&&this.removeAllListeners(u);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function CB(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?jae(i):MB(i,i.length)}Lr.prototype.listeners=function(e){return CB(this,e,!0)};Lr.prototype.rawListeners=function(e){return CB(this,e,!1)};Lr.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):AB.call(n,e)};Lr.prototype.listenerCount=AB;function AB(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}Lr.prototype.eventNames=function(){return this._eventsCount>0?u2(this._events):[]};function MB(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function zae(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function jae(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function $ae(n,e){return new Promise(function(t,r){function i(u){n.removeListener(e,o),r(u)}function o(){typeof n.removeListener=="function"&&n.removeListener("error",i),t([].slice.call(arguments))}kB(n,e,o,{once:!0}),e!=="error"&&Hae(n,i,{once:!0})})}function Hae(n,e,t){typeof n.on=="function"&&kB(n,"error",e,t)}function kB(n,e,t,r){if(typeof n.on=="function")r.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function i(o){r.once&&n.removeEventListener(e,i),t(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var S1=MM.exports;(function(n){const e=ip,{kResistStopPropagation:t,SymbolDispose:r}=wa,i=globalThis.AbortSignal||r1().AbortSignal,o=globalThis.AbortController||r1().AbortController,u=Object.getPrototypeOf(async function(){}).constructor,c=globalThis.Blob||e.Blob,p=typeof c<"u"?function(v){return v instanceof c}:function(v){return!1},h=(w,v)=>{if(w!==void 0&&(w===null||typeof w!="object"||!("aborted"in w)))throw new ERR_INVALID_ARG_TYPE(v,"AbortSignal",w)},g=(w,v)=>{if(typeof w!="function")throw new ERR_INVALID_ARG_TYPE(v,"Function",w)};class m extends Error{constructor(v){if(!Array.isArray(v))throw new TypeError(`Expected input to be an Array, got ${typeof v}`);let C="";for(let T=0;T<v.length;T++)C+=` ${v[T].stack}
319
- `;super(C),this.name="AggregateError",this.errors=v}}n.exports={AggregateError:m,kEmptyObject:Object.freeze({}),once(w){let v=!1;return function(...C){v||(v=!0,w.apply(this,C))}},createDeferredPromise:function(){let w,v;return{promise:new Promise((T,R)=>{w=T,v=R}),resolve:w,reject:v}},promisify(w){return new Promise((v,C)=>{w((T,...R)=>T?C(T):v(...R))})},debuglog(){return function(){}},format(w,...v){return w.replace(/%([sdifj])/g,function(...[C,T]){const R=v.shift();return T==="f"?R.toFixed(6):T==="j"?JSON.stringify(R):T==="s"&&typeof R=="object"?`${R.constructor!==Object?R.constructor.name:""} {}`.trim():R.toString()})},inspect(w){switch(typeof w){case"string":if(w.includes("'"))if(w.includes('"')){if(!w.includes("`")&&!w.includes("${"))return`\`${w}\``}else return`"${w}"`;return`'${w}'`;case"number":return isNaN(w)?"NaN":Object.is(w,-0)?String(w):w;case"bigint":return`${String(w)}n`;case"boolean":case"undefined":return String(w);case"object":return"{}"}},types:{isAsyncFunction(w){return w instanceof u},isArrayBufferView(w){return ArrayBuffer.isView(w)}},isBlob:p,deprecate(w,v){return w},addAbortListener:S1.addAbortListener||function(v,C){if(v===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",v);h(v,"signal"),g(C,"listener");let T;return v.aborted?queueMicrotask(()=>C()):(v.addEventListener("abort",C,{__proto__:null,once:!0,[t]:!0}),T=()=>{v.removeEventListener("abort",C)}),{__proto__:null,[r](){var R;(R=T)===null||R===void 0||R()}}},AbortSignalAny:i.any||function(v){if(v.length===1)return v[0];const C=new o,T=()=>C.abort();return v.forEach(R=>{h(R,"signals"),R.addEventListener("abort",T,{once:!0})}),C.signal.addEventListener("abort",()=>{v.forEach(R=>R.removeEventListener("abort",T))},{once:!0}),C.signal}},n.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(wB);var Os=wB.exports,kM={};const{format:qae,inspect:R2,AggregateError:Vae}=Os,Gae=globalThis.AggregateError||Vae,Wae=Symbol("kIsNodeError"),Kae=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Yae=/^([A-Z][a-z0-9]*)+$/,Jae="__node_internal_",yS={};function Sh(n,e){if(!n)throw new yS.ERR_INTERNAL_ASSERTION(e)}function iP(n){let e="",t=n.length;const r=n[0]==="-"?1:0;for(;t>=r+4;t-=3)e=`_${n.slice(t-3,t)}${e}`;return`${n.slice(0,t)}${e}`}function Qae(n,e,t){if(typeof e=="function")return Sh(e.length<=t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${e.length}).`),e(...t);const r=(e.match(/%[dfijoOs]/g)||[]).length;return Sh(r===t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${r}).`),t.length===0?e:qae(e,...t)}function Bi(n,e,t){t||(t=Error);class r extends t{constructor(...o){super(Qae(n,e,o))}toString(){return`${this.name} [${n}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:t.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${n}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=n,r.prototype[Wae]=!0,yS[n]=r}function sP(n){const e=Jae+n.name;return Object.defineProperty(n,"name",{value:e}),n}function Zae(n,e){if(n&&e&&n!==e){if(Array.isArray(e.errors))return e.errors.push(n),e;const t=new Gae([e,n],e.message);return t.code=e.code,t}return n||e}let Xae=class extends Error{constructor(e="The operation was aborted",t=void 0){if(t!==void 0&&typeof t!="object")throw new yS.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Bi("ERR_ASSERTION","%s",Error);Bi("ERR_INVALID_ARG_TYPE",(n,e,t)=>{Sh(typeof n=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let r="The ";n.endsWith(" argument")?r+=`${n} `:r+=`"${n}" ${n.includes(".")?"property":"argument"} `,r+="must be ";const i=[],o=[],u=[];for(const p of e)Sh(typeof p=="string","All expected entries have to be of type string"),Kae.includes(p)?i.push(p.toLowerCase()):Yae.test(p)?o.push(p):(Sh(p!=="object",'The value "object" should be written as "Object"'),u.push(p));if(o.length>0){const p=i.indexOf("object");p!==-1&&(i.splice(i,p,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:r+=`of type ${i[0]}`;break;case 2:r+=`one of type ${i[0]} or ${i[1]}`;break;default:{const p=i.pop();r+=`one of type ${i.join(", ")}, or ${p}`}}(o.length>0||u.length>0)&&(r+=" or ")}if(o.length>0){switch(o.length){case 1:r+=`an instance of ${o[0]}`;break;case 2:r+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const p=o.pop();r+=`an instance of ${o.join(", ")}, or ${p}`}}u.length>0&&(r+=" or ")}switch(u.length){case 0:break;case 1:u[0].toLowerCase()!==u[0]&&(r+="an "),r+=`${u[0]}`;break;case 2:r+=`one of ${u[0]} or ${u[1]}`;break;default:{const p=u.pop();r+=`one of ${u.join(", ")}, or ${p}`}}if(t==null)r+=`. Received ${t}`;else if(typeof t=="function"&&t.name)r+=`. Received function ${t.name}`;else if(typeof t=="object"){var c;if((c=t.constructor)!==null&&c!==void 0&&c.name)r+=`. Received an instance of ${t.constructor.name}`;else{const p=R2(t,{depth:-1});r+=`. Received ${p}`}}else{let p=R2(t,{colors:!1});p.length>25&&(p=`${p.slice(0,25)}...`),r+=`. Received type ${typeof t} (${p})`}return r},TypeError);Bi("ERR_INVALID_ARG_VALUE",(n,e,t="is invalid")=>{let r=R2(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${n.includes(".")?"property":"argument"} '${n}' ${t}. Received ${r}`},TypeError);Bi("ERR_INVALID_RETURN_VALUE",(n,e,t)=>{var r;const i=t!=null&&(r=t.constructor)!==null&&r!==void 0&&r.name?`instance of ${t.constructor.name}`:`type ${typeof t}`;return`Expected ${n} to be returned from the "${e}" function but got ${i}.`},TypeError);Bi("ERR_MISSING_ARGS",(...n)=>{Sh(n.length>0,"At least one arg needs to be specified");let e;const t=n.length;switch(n=(Array.isArray(n)?n:[n]).map(r=>`"${r}"`).join(" or "),t){case 1:e+=`The ${n[0]} argument`;break;case 2:e+=`The ${n[0]} and ${n[1]} arguments`;break;default:{const r=n.pop();e+=`The ${n.join(", ")}, and ${r} arguments`}break}return`${e} must be specified`},TypeError);Bi("ERR_OUT_OF_RANGE",(n,e,t)=>{Sh(e,'Missing "range" argument');let r;return Number.isInteger(t)&&Math.abs(t)>2**32?r=iP(String(t)):typeof t=="bigint"?(r=String(t),(t>2n**32n||t<-(2n**32n))&&(r=iP(r)),r+="n"):r=R2(t),`The value of "${n}" is out of range. It must be ${e}. Received ${r}`},RangeError);Bi("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Bi("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Bi("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Bi("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Bi("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Bi("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Bi("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Bi("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Bi("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Bi("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Bi("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var oo={AbortError:Xae,aggregateTwoErrors:sP(Zae),hideStackFrames:sP,codes:yS};const{ArrayIsArray:TM,ArrayPrototypeIncludes:TB,ArrayPrototypeJoin:RB,ArrayPrototypeMap:eie,NumberIsInteger:RM,NumberIsNaN:tie,NumberMAX_SAFE_INTEGER:nie,NumberMIN_SAFE_INTEGER:rie,NumberParseInt:aie,ObjectPrototypeHasOwnProperty:iie,RegExpPrototypeExec:OB,String:sie,StringPrototypeToUpperCase:oie,StringPrototypeTrim:uie}=wa,{hideStackFrames:iu,codes:{ERR_SOCKET_BAD_PORT:lie,ERR_INVALID_ARG_TYPE:ds,ERR_INVALID_ARG_VALUE:zm,ERR_OUT_OF_RANGE:Lh,ERR_UNKNOWN_SIGNAL:oP}}=oo,{normalizeEncoding:cie}=Os,{isAsyncFunction:fie,isArrayBufferView:die}=Os.types,uP={};function pie(n){return n===(n|0)}function hie(n){return n===n>>>0}const yie=/^[0-7]+$/,mie="must be a 32-bit unsigned integer or an octal string";function gie(n,e,t){if(typeof n>"u"&&(n=t),typeof n=="string"){if(OB(yie,n)===null)throw new zm(e,n,mie);n=aie(n,8)}return LB(n,e),n}const bie=iu((n,e,t=rie,r=nie)=>{if(typeof n!="number")throw new ds(e,"number",n);if(!RM(n))throw new Lh(e,"an integer",n);if(n<t||n>r)throw new Lh(e,`>= ${t} && <= ${r}`,n)}),vie=iu((n,e,t=-2147483648,r=2147483647)=>{if(typeof n!="number")throw new ds(e,"number",n);if(!RM(n))throw new Lh(e,"an integer",n);if(n<t||n>r)throw new Lh(e,`>= ${t} && <= ${r}`,n)}),LB=iu((n,e,t=!1)=>{if(typeof n!="number")throw new ds(e,"number",n);if(!RM(n))throw new Lh(e,"an integer",n);const r=t?1:0,i=4294967295;if(n<r||n>i)throw new Lh(e,`>= ${r} && <= ${i}`,n)});function OM(n,e){if(typeof n!="string")throw new ds(e,"string",n)}function wie(n,e,t=void 0,r){if(typeof n!="number")throw new ds(e,"number",n);if(t!=null&&n<t||r!=null&&n>r||(t!=null||r!=null)&&tie(n))throw new Lh(e,`${t!=null?`>= ${t}`:""}${t!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,n)}const xie=iu((n,e,t)=>{if(!TB(t,n)){const i="must be one of: "+RB(eie(t,o=>typeof o=="string"?`'${o}'`:sie(o)),", ");throw new zm(e,n,i)}});function NB(n,e){if(typeof n!="boolean")throw new ds(e,"boolean",n)}function V8(n,e,t){return n==null||!iie(n,e)?t:n[e]}const _ie=iu((n,e,t=null)=>{const r=V8(t,"allowArray",!1),i=V8(t,"allowFunction",!1);if(!V8(t,"nullable",!1)&&n===null||!r&&TM(n)||typeof n!="object"&&(!i||typeof n!="function"))throw new ds(e,"Object",n)}),Sie=iu((n,e)=>{if(n!=null&&typeof n!="object"&&typeof n!="function")throw new ds(e,"a dictionary",n)}),mS=iu((n,e,t=0)=>{if(!TM(n))throw new ds(e,"Array",n);if(n.length<t){const r=`must be longer than ${t}`;throw new zm(e,n,r)}});function Eie(n,e){mS(n,e);for(let t=0;t<n.length;t++)OM(n[t],`${e}[${t}]`)}function Cie(n,e){mS(n,e);for(let t=0;t<n.length;t++)NB(n[t],`${e}[${t}]`)}function Aie(n,e){mS(n,e);for(let t=0;t<n.length;t++){const r=n[t],i=`${e}[${t}]`;if(r==null)throw new ds(i,"AbortSignal",r);PB(r,i)}}function Mie(n,e="signal"){if(OM(n,e),uP[n]===void 0)throw uP[oie(n)]!==void 0?new oP(n+" (signals must use all capital letters)"):new oP(n)}const kie=iu((n,e="buffer")=>{if(!die(n))throw new ds(e,["Buffer","TypedArray","DataView"],n)});function Tie(n,e){const t=cie(e),r=n.length;if(t==="hex"&&r%2!==0)throw new zm("encoding",e,`is invalid for data of length ${r}`)}function Rie(n,e="Port",t=!0){if(typeof n!="number"&&typeof n!="string"||typeof n=="string"&&uie(n).length===0||+n!==+n>>>0||n>65535||n===0&&!t)throw new lie(e,n,t);return n|0}const PB=iu((n,e)=>{if(n!==void 0&&(n===null||typeof n!="object"||!("aborted"in n)))throw new ds(e,"AbortSignal",n)}),Oie=iu((n,e)=>{if(typeof n!="function")throw new ds(e,"Function",n)}),Lie=iu((n,e)=>{if(typeof n!="function"||fie(n))throw new ds(e,"Function",n)}),Nie=iu((n,e)=>{if(n!==void 0)throw new ds(e,"undefined",n)});function Pie(n,e,t){if(!TB(t,n))throw new ds(e,`('${RB(t,"|")}')`,n)}const Iie=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function lP(n,e){if(typeof n>"u"||!OB(Iie,n))throw new zm(e,n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Die(n){if(typeof n=="string")return lP(n,"hints"),n;if(TM(n)){const e=n.length;let t="";if(e===0)return t;for(let r=0;r<e;r++){const i=n[r];lP(i,"hints"),t+=i,r!==e-1&&(t+=", ")}return t}throw new zm("hints",n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}var E1={isInt32:pie,isUint32:hie,parseFileMode:gie,validateArray:mS,validateStringArray:Eie,validateBooleanArray:Cie,validateAbortSignalArray:Aie,validateBoolean:NB,validateBuffer:kie,validateDictionary:Sie,validateEncoding:Tie,validateFunction:Oie,validateInt32:vie,validateInteger:bie,validateNumber:wie,validateObject:_ie,validateOneOf:xie,validatePlainFunction:Lie,validatePort:Rie,validateSignalName:Mie,validateString:OM,validateUint32:LB,validateUndefined:Nie,validateUnion:Pie,validateAbortSignal:PB,validateLinkHeaderValue:Die},LM={exports:{}},G8={exports:{}},cP;function sp(){if(cP)return G8.exports;cP=1;var n=G8.exports={},e,t;function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function o(T){if(e===setTimeout)return setTimeout(T,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(T,0);try{return e(T,0)}catch{try{return e.call(null,T,0)}catch{return e.call(this,T,0)}}}function u(T){if(t===clearTimeout)return clearTimeout(T);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(T);try{return t(T)}catch{try{return t.call(null,T)}catch{return t.call(this,T)}}}var c=[],p=!1,h,g=-1;function m(){!p||!h||(p=!1,h.length?c=h.concat(c):g=-1,c.length&&w())}function w(){if(!p){var T=o(m);p=!0;for(var R=c.length;R;){for(h=c,c=[];++g<R;)h&&h[g].run();g=-1,R=c.length}h=null,p=!1,u(T)}}n.nextTick=function(T){var R=new Array(arguments.length-1);if(arguments.length>1)for(var O=1;O<arguments.length;O++)R[O-1]=arguments[O];c.push(new v(T,R)),c.length===1&&!p&&o(w)};function v(T,R){this.fun=T,this.array=R}v.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={};function C(){}return n.on=C,n.addListener=C,n.once=C,n.off=C,n.removeListener=C,n.removeAllListeners=C,n.emit=C,n.prependListener=C,n.prependOnceListener=C,n.listeners=function(T){return[]},n.binding=function(T){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(T){throw new Error("process.chdir is not supported")},n.umask=function(){return 0},G8.exports}const{SymbolAsyncIterator:fP,SymbolIterator:dP,SymbolFor:Gh}=wa,IB=Gh("nodejs.stream.destroyed"),DB=Gh("nodejs.stream.errored"),c4=Gh("nodejs.stream.readable"),f4=Gh("nodejs.stream.writable"),UB=Gh("nodejs.stream.disturbed"),Uie=Gh("nodejs.webstream.isClosedPromise"),Fie=Gh("nodejs.webstream.controllerErrorFunction");function gS(n,e=!1){var t;return!!(n&&typeof n.pipe=="function"&&typeof n.on=="function"&&(!e||typeof n.pause=="function"&&typeof n.resume=="function")&&(!n._writableState||((t=n._readableState)===null||t===void 0?void 0:t.readable)!==!1)&&(!n._writableState||n._readableState))}function bS(n){var e;return!!(n&&typeof n.write=="function"&&typeof n.on=="function"&&(!n._readableState||((e=n._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Bie(n){return!!(n&&typeof n.pipe=="function"&&n._readableState&&typeof n.on=="function"&&typeof n.write=="function")}function mc(n){return n&&(n._readableState||n._writableState||typeof n.write=="function"&&typeof n.on=="function"||typeof n.pipe=="function"&&typeof n.on=="function")}function FB(n){return!!(n&&!mc(n)&&typeof n.pipeThrough=="function"&&typeof n.getReader=="function"&&typeof n.cancel=="function")}function BB(n){return!!(n&&!mc(n)&&typeof n.getWriter=="function"&&typeof n.abort=="function")}function zB(n){return!!(n&&!mc(n)&&typeof n.readable=="object"&&typeof n.writable=="object")}function zie(n){return FB(n)||BB(n)||zB(n)}function jie(n,e){return n==null?!1:e===!0?typeof n[fP]=="function":e===!1?typeof n[dP]=="function":typeof n[fP]=="function"||typeof n[dP]=="function"}function vS(n){if(!mc(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!!(n.destroyed||n[IB]||r!=null&&r.destroyed)}function jB(n){if(!bS(n))return null;if(n.writableEnded===!0)return!0;const e=n._writableState;return e!=null&&e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function $ie(n,e){if(!bS(n))return null;if(n.writableFinished===!0)return!0;const t=n._writableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.finished)!="boolean"?null:!!(t.finished||e===!1&&t.ended===!0&&t.length===0)}function Hie(n){if(!gS(n))return null;if(n.readableEnded===!0)return!0;const e=n._readableState;return!e||e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function $B(n,e){if(!gS(n))return null;const t=n._readableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.endEmitted)!="boolean"?null:!!(t.endEmitted||e===!1&&t.ended===!0&&t.length===0)}function HB(n){return n&&n[c4]!=null?n[c4]:typeof(n==null?void 0:n.readable)!="boolean"?null:vS(n)?!1:gS(n)&&n.readable&&!$B(n)}function qB(n){return n&&n[f4]!=null?n[f4]:typeof(n==null?void 0:n.writable)!="boolean"?null:vS(n)?!1:bS(n)&&n.writable&&!jB(n)}function qie(n,e){return mc(n)?vS(n)?!0:!((e==null?void 0:e.readable)!==!1&&HB(n)||(e==null?void 0:e.writable)!==!1&&qB(n)):null}function Vie(n){var e,t;return mc(n)?n.writableErrored?n.writableErrored:(e=(t=n._writableState)===null||t===void 0?void 0:t.errored)!==null&&e!==void 0?e:null:null}function Gie(n){var e,t;return mc(n)?n.readableErrored?n.readableErrored:(e=(t=n._readableState)===null||t===void 0?void 0:t.errored)!==null&&e!==void 0?e:null:null}function Wie(n){if(!mc(n))return null;if(typeof n.closed=="boolean")return n.closed;const e=n._writableState,t=n._readableState;return typeof(e==null?void 0:e.closed)=="boolean"||typeof(t==null?void 0:t.closed)=="boolean"?(e==null?void 0:e.closed)||(t==null?void 0:t.closed):typeof n._closed=="boolean"&&VB(n)?n._closed:null}function VB(n){return typeof n._closed=="boolean"&&typeof n._defaultKeepAlive=="boolean"&&typeof n._removedConnection=="boolean"&&typeof n._removedContLen=="boolean"}function GB(n){return typeof n._sent100=="boolean"&&VB(n)}function Kie(n){var e;return typeof n._consuming=="boolean"&&typeof n._dumped=="boolean"&&((e=n.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function Yie(n){if(!mc(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!r&&GB(n)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function Jie(n){var e;return!!(n&&((e=n[UB])!==null&&e!==void 0?e:n.readableDidRead||n.readableAborted))}function Qie(n){var e,t,r,i,o,u,c,p,h,g;return!!(n&&((e=(t=(r=(i=(o=(u=n[DB])!==null&&u!==void 0?u:n.readableErrored)!==null&&o!==void 0?o:n.writableErrored)!==null&&i!==void 0?i:(c=n._readableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&r!==void 0?r:(p=n._writableState)===null||p===void 0?void 0:p.errorEmitted)!==null&&t!==void 0?t:(h=n._readableState)===null||h===void 0?void 0:h.errored)!==null&&e!==void 0?e:!((g=n._writableState)===null||g===void 0)&&g.errored))}var Af={isDestroyed:vS,kIsDestroyed:IB,isDisturbed:Jie,kIsDisturbed:UB,isErrored:Qie,kIsErrored:DB,isReadable:HB,kIsReadable:c4,kIsClosedPromise:Uie,kControllerErrorFunction:Fie,kIsWritable:f4,isClosed:Wie,isDuplexNodeStream:Bie,isFinished:qie,isIterable:jie,isReadableNodeStream:gS,isReadableStream:FB,isReadableEnded:Hie,isReadableFinished:$B,isReadableErrored:Gie,isNodeStream:mc,isWebStream:zie,isWritable:qB,isWritableNodeStream:bS,isWritableStream:BB,isWritableEnded:jB,isWritableFinished:$ie,isWritableErrored:Vie,isServerRequest:Kie,isServerResponse:GB,willEmitClose:Yie,isTransformStream:zB};const Fd=sp(),{AbortError:WB,codes:Zie}=oo,{ERR_INVALID_ARG_TYPE:Xie,ERR_STREAM_PREMATURE_CLOSE:pP}=Zie,{kEmptyObject:d4,once:p4}=Os,{validateAbortSignal:ese,validateFunction:tse,validateObject:nse,validateBoolean:rse}=E1,{Promise:ase,PromisePrototypeThen:ise,SymbolDispose:KB}=wa,{isClosed:sse,isReadable:hP,isReadableNodeStream:W8,isReadableStream:ose,isReadableFinished:yP,isReadableErrored:mP,isWritable:gP,isWritableNodeStream:bP,isWritableStream:use,isWritableFinished:vP,isWritableErrored:wP,isNodeStream:lse,willEmitClose:cse,kIsClosedPromise:fse}=Af;let fm;function dse(n){return n.setHeader&&typeof n.abort=="function"}const h4=()=>{};function YB(n,e,t){var r,i;if(arguments.length===2?(t=e,e=d4):e==null?e=d4:nse(e,"options"),tse(t,"callback"),ese(e.signal,"options.signal"),t=p4(t),ose(n)||use(n))return pse(n,e,t);if(!lse(n))throw new Xie("stream",["ReadableStream","WritableStream","Stream"],n);const o=(r=e.readable)!==null&&r!==void 0?r:W8(n),u=(i=e.writable)!==null&&i!==void 0?i:bP(n),c=n._writableState,p=n._readableState,h=()=>{n.writable||w()};let g=cse(n)&&W8(n)===o&&bP(n)===u,m=vP(n,!1);const w=()=>{m=!0,n.destroyed&&(g=!1),!(g&&(!n.readable||o))&&(!o||v)&&t.call(n)};let v=yP(n,!1);const C=()=>{v=!0,n.destroyed&&(g=!1),!(g&&(!n.writable||u))&&(!u||m)&&t.call(n)},T=W=>{t.call(n,W)};let R=sse(n);const O=()=>{R=!0;const W=wP(n)||mP(n);if(W&&typeof W!="boolean")return t.call(n,W);if(o&&!v&&W8(n,!0)&&!yP(n,!1))return t.call(n,new pP);if(u&&!m&&!vP(n,!1))return t.call(n,new pP);t.call(n)},I=()=>{R=!0;const W=wP(n)||mP(n);if(W&&typeof W!="boolean")return t.call(n,W);t.call(n)},D=()=>{n.req.on("finish",w)};dse(n)?(n.on("complete",w),g||n.on("abort",O),n.req?D():n.on("request",D)):u&&!c&&(n.on("end",h),n.on("close",h)),!g&&typeof n.aborted=="boolean"&&n.on("aborted",O),n.on("end",C),n.on("finish",w),e.error!==!1&&n.on("error",T),n.on("close",O),R?Fd.nextTick(O):c!=null&&c.errorEmitted||p!=null&&p.errorEmitted?g||Fd.nextTick(I):(!o&&(!g||hP(n))&&(m||gP(n)===!1)||!u&&(!g||gP(n))&&(v||hP(n)===!1)||p&&n.req&&n.aborted)&&Fd.nextTick(I);const K=()=>{t=h4,n.removeListener("aborted",O),n.removeListener("complete",w),n.removeListener("abort",O),n.removeListener("request",D),n.req&&n.req.removeListener("finish",w),n.removeListener("end",h),n.removeListener("close",h),n.removeListener("finish",w),n.removeListener("end",C),n.removeListener("error",T),n.removeListener("close",O)};if(e.signal&&!R){const W=()=>{const pe=t;K(),pe.call(n,new WB(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Fd.nextTick(W);else{fm=fm||Os.addAbortListener;const pe=fm(e.signal,W),ce=t;t=p4((...ge)=>{pe[KB](),ce.apply(n,ge)})}}return K}function pse(n,e,t){let r=!1,i=h4;if(e.signal)if(i=()=>{r=!0,t.call(n,new WB(void 0,{cause:e.signal.reason}))},e.signal.aborted)Fd.nextTick(i);else{fm=fm||Os.addAbortListener;const u=fm(e.signal,i),c=t;t=p4((...p)=>{u[KB](),c.apply(n,p)})}const o=(...u)=>{r||Fd.nextTick(()=>t.apply(n,u))};return ise(n[fse].promise,o,o),h4}function hse(n,e){var t;let r=!1;return e===null&&(e=d4),(t=e)!==null&&t!==void 0&&t.cleanup&&(rse(e.cleanup,"cleanup"),r=e.cleanup),new ase((i,o)=>{const u=YB(n,e,c=>{r&&u(),c?o(c):i()})})}LM.exports=YB;LM.exports.finished=hse;var op=LM.exports;const ic=sp(),{aggregateTwoErrors:yse,codes:{ERR_MULTIPLE_CALLBACK:mse},AbortError:gse}=oo,{Symbol:JB}=wa,{kIsDestroyed:bse,isDestroyed:vse,isFinished:wse,isServerRequest:xse}=Af,QB=JB("kDestroy"),y4=JB("kConstruct");function ZB(n,e,t){n&&(n.stack,e&&!e.errored&&(e.errored=n),t&&!t.errored&&(t.errored=n))}function _se(n,e){const t=this._readableState,r=this._writableState,i=r||t;return r!=null&&r.destroyed||t!=null&&t.destroyed?(typeof e=="function"&&e(),this):(ZB(n,r,t),r&&(r.destroyed=!0),t&&(t.destroyed=!0),i.constructed?xP(this,n,e):this.once(QB,function(o){xP(this,yse(o,n),e)}),this)}function xP(n,e,t){let r=!1;function i(o){if(r)return;r=!0;const u=n._readableState,c=n._writableState;ZB(o,c,u),c&&(c.closed=!0),u&&(u.closed=!0),typeof t=="function"&&t(o),o?ic.nextTick(Sse,n,o):ic.nextTick(XB,n)}try{n._destroy(e||null,i)}catch(o){i(o)}}function Sse(n,e){m4(n,e),XB(n)}function XB(n){const e=n._readableState,t=n._writableState;t&&(t.closeEmitted=!0),e&&(e.closeEmitted=!0),(t!=null&&t.emitClose||e!=null&&e.emitClose)&&n.emit("close")}function m4(n,e){const t=n._readableState,r=n._writableState;r!=null&&r.errorEmitted||t!=null&&t.errorEmitted||(r&&(r.errorEmitted=!0),t&&(t.errorEmitted=!0),n.emit("error",e))}function Ese(){const n=this._readableState,e=this._writableState;n&&(n.constructed=!0,n.closed=!1,n.closeEmitted=!1,n.destroyed=!1,n.errored=null,n.errorEmitted=!1,n.reading=!1,n.ended=n.readable===!1,n.endEmitted=n.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function g4(n,e,t){const r=n._readableState,i=n._writableState;if(i!=null&&i.destroyed||r!=null&&r.destroyed)return this;r!=null&&r.autoDestroy||i!=null&&i.autoDestroy?n.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),r&&!r.errored&&(r.errored=e),t?ic.nextTick(m4,n,e):m4(n,e))}function Cse(n,e){if(typeof n._construct!="function")return;const t=n._readableState,r=n._writableState;t&&(t.constructed=!1),r&&(r.constructed=!1),n.once(y4,e),!(n.listenerCount(y4)>1)&&ic.nextTick(Ase,n)}function Ase(n){let e=!1;function t(r){if(e){g4(n,r??new mse);return}e=!0;const i=n._readableState,o=n._writableState,u=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),u.destroyed?n.emit(QB,r):r?g4(n,r,!0):ic.nextTick(Mse,n)}try{n._construct(r=>{ic.nextTick(t,r)})}catch(r){ic.nextTick(t,r)}}function Mse(n){n.emit(y4)}function _P(n){return(n==null?void 0:n.setHeader)&&typeof n.abort=="function"}function ez(n){n.emit("close")}function kse(n,e){n.emit("error",e),ic.nextTick(ez,n)}function Tse(n,e){!n||vse(n)||(!e&&!wse(n)&&(e=new gse),xse(n)?(n.socket=null,n.destroy(e)):_P(n)?n.abort():_P(n.req)?n.req.abort():typeof n.destroy=="function"?n.destroy(e):typeof n.close=="function"?n.close():e?ic.nextTick(kse,n,e):ic.nextTick(ez,n),n.destroyed||(n[bse]=!0))}var jm={construct:Cse,destroyer:Tse,destroy:_se,undestroy:Ese,errorOrDestroy:g4};const{ArrayIsArray:Rse,ObjectSetPrototypeOf:tz}=wa,{EventEmitter:wS}=S1;function xS(n){wS.call(this,n)}tz(xS.prototype,wS.prototype);tz(xS,wS);xS.prototype.pipe=function(n,e){const t=this;function r(g){n.writable&&n.write(g)===!1&&t.pause&&t.pause()}t.on("data",r);function i(){t.readable&&t.resume&&t.resume()}n.on("drain",i),!n._isStdio&&(!e||e.end!==!1)&&(t.on("end",u),t.on("close",c));let o=!1;function u(){o||(o=!0,n.end())}function c(){o||(o=!0,typeof n.destroy=="function"&&n.destroy())}function p(g){h(),wS.listenerCount(this,"error")===0&&this.emit("error",g)}b4(t,"error",p),b4(n,"error",p);function h(){t.removeListener("data",r),n.removeListener("drain",i),t.removeListener("end",u),t.removeListener("close",c),t.removeListener("error",p),n.removeListener("error",p),t.removeListener("end",h),t.removeListener("close",h),n.removeListener("close",h)}return t.on("end",h),t.on("close",h),n.on("close",h),n.emit("pipe",t),n};function b4(n,e,t){if(typeof n.prependListener=="function")return n.prependListener(e,t);!n._events||!n._events[e]?n.on(e,t):Rse(n._events[e])?n._events[e].unshift(t):n._events[e]=[t,n._events[e]]}var NM={Stream:xS,prependListener:b4},nz={exports:{}};(function(n){const{SymbolDispose:e}=wa,{AbortError:t,codes:r}=oo,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:u}=Af,c=op,{ERR_INVALID_ARG_TYPE:p}=r;let h;const g=(m,w)=>{if(typeof m!="object"||!("aborted"in m))throw new p(w,"AbortSignal",m)};n.exports.addAbortSignal=function(w,v){if(g(w,"signal"),!i(v)&&!o(v))throw new p("stream",["ReadableStream","WritableStream","Stream"],v);return n.exports.addAbortSignalNoValidate(w,v)},n.exports.addAbortSignalNoValidate=function(m,w){if(typeof m!="object"||!("aborted"in m))return w;const v=i(w)?()=>{w.destroy(new t(void 0,{cause:m.reason}))}:()=>{w[u](new t(void 0,{cause:m.reason}))};if(m.aborted)v();else{h=h||Os.addAbortListener;const C=h(m,v);c(w,C[e])}return w}})(nz);var _S=nz.exports;const{StringPrototypeSlice:SP,SymbolIterator:Ose,TypedArrayPrototypeSet:H_,Uint8Array:Lse}=wa,{Buffer:K8}=ip,{inspect:Nse}=Os;var Pse=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;const e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let t=this.head,r=""+t.data;for(;(t=t.next)!==null;)r+=e+t.data;return r}concat(e){if(this.length===0)return K8.alloc(0);const t=K8.allocUnsafe(e>>>0);let r=this.head,i=0;for(;r;)H_(t,r.data,i),i+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(e<r.length){const i=r.slice(0,e);return this.head.data=r.slice(e),i}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Ose](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",r=this.head,i=0;do{const o=r.data;if(e>o.length)t+=o,e-=o.length;else{e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=SP(o,0,e),this.head=r,r.data=SP(o,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){const t=K8.allocUnsafe(e),r=e;let i=this.head,o=0;do{const u=i.data;if(e>u.length)H_(t,u,r-e),e-=u.length;else{e===u.length?(H_(t,u,r-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(H_(t,new Lse(u.buffer,u.byteOffset,e),r-e),this.head=i,i.data=u.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return Nse(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:Ise,NumberIsInteger:Dse}=wa,{validateInteger:Use}=E1,{ERR_INVALID_ARG_VALUE:Fse}=oo.codes;let rz=16*1024,az=16;function Bse(n,e,t){return n.highWaterMark!=null?n.highWaterMark:e?n[t]:null}function iz(n){return n?az:rz}function zse(n,e){Use(e,"value",0),n?az=e:rz=e}function jse(n,e,t,r){const i=Bse(e,r,t);if(i!=null){if(!Dse(i)||i<0){const o=r?`options.${t}`:"options.highWaterMark";throw new Fse(o,i)}return Ise(i)}return iz(n.objectMode)}var SS={getHighWaterMark:jse,getDefaultHighWaterMark:iz,setDefaultHighWaterMark:zse},PM={},IM=oF.Buffer,EP=IM.isEncoding||function(n){switch(n=""+n,n&&n.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function $se(n){if(!n)return"utf8";for(var e;;)switch(n){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return n;default:if(e)return;n=(""+n).toLowerCase(),e=!0}}function Hse(n){var e=$se(n);if(typeof e!="string"&&(IM.isEncoding===EP||!EP(n)))throw new Error("Unknown encoding: "+n);return e||n}PM.StringDecoder=C1;function C1(n){this.encoding=Hse(n);var e;switch(this.encoding){case"utf16le":this.text=Yse,this.end=Jse,e=4;break;case"utf8":this.fillLast=Gse,e=4;break;case"base64":this.text=Qse,this.end=Zse,e=3;break;default:this.write=Xse,this.end=eoe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=IM.allocUnsafe(e)}C1.prototype.write=function(n){if(n.length===0)return"";var e,t;if(this.lastNeed){if(e=this.fillLast(n),e===void 0)return"";t=this.lastNeed,this.lastNeed=0}else t=0;return t<n.length?e?e+this.text(n,t):this.text(n,t):e||""};C1.prototype.end=Kse;C1.prototype.text=Wse;C1.prototype.fillLast=function(n){if(this.lastNeed<=n.length)return n.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);n.copy(this.lastChar,this.lastTotal-this.lastNeed,0,n.length),this.lastNeed-=n.length};function Y8(n){return n<=127?0:n>>5===6?2:n>>4===14?3:n>>3===30?4:n>>6===2?-1:-2}function qse(n,e,t){var r=e.length-1;if(r<t)return 0;var i=Y8(e[r]);return i>=0?(i>0&&(n.lastNeed=i-1),i):--r<t||i===-2?0:(i=Y8(e[r]),i>=0?(i>0&&(n.lastNeed=i-2),i):--r<t||i===-2?0:(i=Y8(e[r]),i>=0?(i>0&&(i===2?i=0:n.lastNeed=i-3),i):0))}function Vse(n,e,t){if((e[0]&192)!==128)return n.lastNeed=0,"�";if(n.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return n.lastNeed=1,"�";if(n.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return n.lastNeed=2,"�"}}function Gse(n){var e=this.lastTotal-this.lastNeed,t=Vse(this,n);if(t!==void 0)return t;if(this.lastNeed<=n.length)return n.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);n.copy(this.lastChar,e,0,n.length),this.lastNeed-=n.length}function Wse(n,e){var t=qse(this,n,e);if(!this.lastNeed)return n.toString("utf8",e);this.lastTotal=t;var r=n.length-(t-this.lastNeed);return n.copy(this.lastChar,0,r),n.toString("utf8",e,r)}function Kse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+"�":e}function Yse(n,e){if((n.length-e)%2===0){var t=n.toString("utf16le",e);if(t){var r=t.charCodeAt(t.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=n[n.length-2],this.lastChar[1]=n[n.length-1],t.slice(0,-1)}return t}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=n[n.length-1],n.toString("utf16le",e,n.length-1)}function Jse(n){var e=n&&n.length?this.write(n):"";if(this.lastNeed){var t=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,t)}return e}function Qse(n,e){var t=(n.length-e)%3;return t===0?n.toString("base64",e):(this.lastNeed=3-t,this.lastTotal=3,t===1?this.lastChar[0]=n[n.length-1]:(this.lastChar[0]=n[n.length-2],this.lastChar[1]=n[n.length-1]),n.toString("base64",e,n.length-t))}function Zse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Xse(n){return n.toString(this.encoding)}function eoe(n){return n&&n.length?this.write(n):""}const CP=sp(),{PromisePrototypeThen:toe,SymbolAsyncIterator:AP,SymbolIterator:MP}=wa,{Buffer:noe}=ip,{ERR_INVALID_ARG_TYPE:roe,ERR_STREAM_NULL_VALUES:aoe}=oo.codes;function ioe(n,e,t){let r;if(typeof e=="string"||e instanceof noe)return new n({objectMode:!0,...t,read(){this.push(e),this.push(null)}});let i;if(e&&e[AP])i=!0,r=e[AP]();else if(e&&e[MP])i=!1,r=e[MP]();else throw new roe("iterable",["Iterable"],e);const o=new n({objectMode:!0,highWaterMark:1,...t});let u=!1;o._read=function(){u||(u=!0,p())},o._destroy=function(h,g){toe(c(h),()=>CP.nextTick(g,h),m=>CP.nextTick(g,m||h))};async function c(h){const g=h!=null,m=typeof r.throw=="function";if(g&&m){const{value:w,done:v}=await r.throw(h);if(await w,v)return}if(typeof r.return=="function"){const{value:w}=await r.return();await w}}async function p(){for(;;){try{const{value:h,done:g}=i?await r.next():r.next();if(g)o.push(null);else{const m=h&&typeof h.then=="function"?await h:h;if(m===null)throw u=!1,new aoe;if(o.push(m))continue;u=!1}}catch(h){o.destroy(h)}break}}return o}var sz=ioe,J8,kP;function ES(){if(kP)return J8;kP=1;const n=sp(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:i,ObjectDefineProperties:o,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:p,SafeSet:h,SymbolAsyncDispose:g,SymbolAsyncIterator:m,Symbol:w}=wa;J8=Le,Le.ReadableState=Ce;const{EventEmitter:v}=S1,{Stream:C,prependListener:T}=NM,{Buffer:R}=ip,{addAbortSignal:O}=_S,I=op;let D=Os.debuglog("stream",be=>{D=be});const K=Pse,W=jm,{getHighWaterMark:pe,getDefaultHighWaterMark:ce}=SS,{aggregateTwoErrors:ge,codes:{ERR_INVALID_ARG_TYPE:Se,ERR_METHOD_NOT_IMPLEMENTED:_e,ERR_OUT_OF_RANGE:ae,ERR_STREAM_PUSH_AFTER_EOF:Te,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:S},AbortError:x}=oo,{validateObject:A}=E1,U=w("kPaused"),{StringDecoder:L}=PM,z=sz;c(Le.prototype,C.prototype),c(Le,C);const Y=()=>{},{errorOrDestroy:q}=W,P=1,M=2,Q=4,ie=8,H=16,we=32,Ne=64,ke=128,Ue=256,se=512,fe=1024,de=2048,le=4096,ne=8192,ye=16384,Z=32768,N=65536,B=1<<17,te=1<<18;function oe(be){return{enumerable:!1,get(){return(this.state&be)!==0},set(Ee){Ee?this.state|=be:this.state&=~be}}}o(Ce.prototype,{objectMode:oe(P),ended:oe(M),endEmitted:oe(Q),reading:oe(ie),constructed:oe(H),sync:oe(we),needReadable:oe(Ne),emittedReadable:oe(ke),readableListening:oe(Ue),resumeScheduled:oe(se),errorEmitted:oe(fe),emitClose:oe(de),autoDestroy:oe(le),destroyed:oe(ne),closed:oe(ye),closeEmitted:oe(Z),multiAwaitDrain:oe(N),readingMore:oe(B),dataEmitted:oe(te)});function Ce(be,Ee,pt){typeof pt!="boolean"&&(pt=Ee instanceof xf()),this.state=de|le|H|we,be&&be.objectMode&&(this.state|=P),pt&&be&&be.readableObjectMode&&(this.state|=P),this.highWaterMark=be?pe(this,be,"readableHighWaterMark",pt):ce(!1),this.buffer=new K,this.length=0,this.pipes=[],this.flowing=null,this[U]=null,be&&be.emitClose===!1&&(this.state&=~de),be&&be.autoDestroy===!1&&(this.state&=~le),this.errored=null,this.defaultEncoding=be&&be.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,be&&be.encoding&&(this.decoder=new L(be.encoding),this.encoding=be.encoding)}function Le(be){if(!(this instanceof Le))return new Le(be);const Ee=this instanceof xf();this._readableState=new Ce(be,this,Ee),be&&(typeof be.read=="function"&&(this._read=be.read),typeof be.destroy=="function"&&(this._destroy=be.destroy),typeof be.construct=="function"&&(this._construct=be.construct),be.signal&&!Ee&&O(be.signal,this)),C.call(this,be),W.construct(this,()=>{this._readableState.needReadable&&xe(this,this._readableState)})}Le.prototype.destroy=W.destroy,Le.prototype._undestroy=W.undestroy,Le.prototype._destroy=function(be,Ee){Ee(be)},Le.prototype[v.captureRejectionSymbol]=function(be){this.destroy(be)},Le.prototype[g]=function(){let be;return this.destroyed||(be=this.readableEnded?null:new x,this.destroy(be)),new p((Ee,pt)=>I(this,at=>at&&at!==be?pt(at):Ee(null)))},Le.prototype.push=function(be,Ee){return Xe(this,be,Ee,!1)},Le.prototype.unshift=function(be,Ee){return Xe(this,be,Ee,!0)};function Xe(be,Ee,pt,at){D("readableAddChunk",Ee);const yt=be._readableState;let zn;if(yt.state&P||(typeof Ee=="string"?(pt=pt||yt.defaultEncoding,yt.encoding!==pt&&(at&&yt.encoding?Ee=R.from(Ee,pt).toString(yt.encoding):(Ee=R.from(Ee,pt),pt=""))):Ee instanceof R?pt="":C._isUint8Array(Ee)?(Ee=C._uint8ArrayToBuffer(Ee),pt=""):Ee!=null&&(zn=new Se("chunk",["string","Buffer","Uint8Array"],Ee))),zn)q(be,zn);else if(Ee===null)yt.state&=~ie,$(be,yt);else if(yt.state&P||Ee&&Ee.length>0)if(at)if(yt.state&Q)q(be,new S);else{if(yt.destroyed||yt.errored)return!1;ct(be,yt,Ee,!0)}else if(yt.ended)q(be,new Te);else{if(yt.destroyed||yt.errored)return!1;yt.state&=~ie,yt.decoder&&!pt?(Ee=yt.decoder.write(Ee),yt.objectMode||Ee.length!==0?ct(be,yt,Ee,!1):xe(be,yt)):ct(be,yt,Ee,!1)}else at||(yt.state&=~ie,xe(be,yt));return!yt.ended&&(yt.length<yt.highWaterMark||yt.length===0)}function ct(be,Ee,pt,at){Ee.flowing&&Ee.length===0&&!Ee.sync&&be.listenerCount("data")>0?(Ee.state&N?Ee.awaitDrainWriters.clear():Ee.awaitDrainWriters=null,Ee.dataEmitted=!0,be.emit("data",pt)):(Ee.length+=Ee.objectMode?1:pt.length,at?Ee.buffer.unshift(pt):Ee.buffer.push(pt),Ee.state&Ne&&G(be)),xe(be,Ee)}Le.prototype.isPaused=function(){const be=this._readableState;return be[U]===!0||be.flowing===!1},Le.prototype.setEncoding=function(be){const Ee=new L(be);this._readableState.decoder=Ee,this._readableState.encoding=this._readableState.decoder.encoding;const pt=this._readableState.buffer;let at="";for(const yt of pt)at+=Ee.write(yt);return pt.clear(),at!==""&&pt.push(at),this._readableState.length=at.length,this};const Ct=1073741824;function Mt(be){if(be>Ct)throw new ae("size","<= 1GiB",be);return be--,be|=be>>>1,be|=be>>>2,be|=be>>>4,be|=be>>>8,be|=be>>>16,be++,be}function X(be,Ee){return be<=0||Ee.length===0&&Ee.ended?0:Ee.state&P?1:r(be)?Ee.flowing&&Ee.length?Ee.buffer.first().length:Ee.length:be<=Ee.length?be:Ee.ended?Ee.length:0}Le.prototype.read=function(be){D("read",be),be===void 0?be=NaN:t(be)||(be=i(be,10));const Ee=this._readableState,pt=be;if(be>Ee.highWaterMark&&(Ee.highWaterMark=Mt(be)),be!==0&&(Ee.state&=~ke),be===0&&Ee.needReadable&&((Ee.highWaterMark!==0?Ee.length>=Ee.highWaterMark:Ee.length>0)||Ee.ended))return D("read: emitReadable",Ee.length,Ee.ended),Ee.length===0&&Ee.ended?Yt(this):G(this),null;if(be=X(be,Ee),be===0&&Ee.ended)return Ee.length===0&&Yt(this),null;let at=(Ee.state&Ne)!==0;if(D("need readable",at),(Ee.length===0||Ee.length-be<Ee.highWaterMark)&&(at=!0,D("length less than watermark",at)),Ee.ended||Ee.reading||Ee.destroyed||Ee.errored||!Ee.constructed)at=!1,D("reading, ended or constructing",at);else if(at){D("do read"),Ee.state|=ie|we,Ee.length===0&&(Ee.state|=Ne);try{this._read(Ee.highWaterMark)}catch(zn){q(this,zn)}Ee.state&=~we,Ee.reading||(be=X(pt,Ee))}let yt;return be>0?yt=Zt(be,Ee):yt=null,yt===null?(Ee.needReadable=Ee.length<=Ee.highWaterMark,be=0):(Ee.length-=be,Ee.multiAwaitDrain?Ee.awaitDrainWriters.clear():Ee.awaitDrainWriters=null),Ee.length===0&&(Ee.ended||(Ee.needReadable=!0),pt!==be&&Ee.ended&&Yt(this)),yt!==null&&!Ee.errorEmitted&&!Ee.closeEmitted&&(Ee.dataEmitted=!0,this.emit("data",yt)),yt};function $(be,Ee){if(D("onEofChunk"),!Ee.ended){if(Ee.decoder){const pt=Ee.decoder.end();pt&&pt.length&&(Ee.buffer.push(pt),Ee.length+=Ee.objectMode?1:pt.length)}Ee.ended=!0,Ee.sync?G(be):(Ee.needReadable=!1,Ee.emittedReadable=!0,me(be))}}function G(be){const Ee=be._readableState;D("emitReadable",Ee.needReadable,Ee.emittedReadable),Ee.needReadable=!1,Ee.emittedReadable||(D("emitReadable",Ee.flowing),Ee.emittedReadable=!0,n.nextTick(me,be))}function me(be){const Ee=be._readableState;D("emitReadable_",Ee.destroyed,Ee.length,Ee.ended),!Ee.destroyed&&!Ee.errored&&(Ee.length||Ee.ended)&&(be.emit("readable"),Ee.emittedReadable=!1),Ee.needReadable=!Ee.flowing&&!Ee.ended&&Ee.length<=Ee.highWaterMark,Nt(be)}function xe(be,Ee){!Ee.readingMore&&Ee.constructed&&(Ee.readingMore=!0,n.nextTick(Re,be,Ee))}function Re(be,Ee){for(;!Ee.reading&&!Ee.ended&&(Ee.length<Ee.highWaterMark||Ee.flowing&&Ee.length===0);){const pt=Ee.length;if(D("maybeReadMore read 0"),be.read(0),pt===Ee.length)break}Ee.readingMore=!1}Le.prototype._read=function(be){throw new _e("_read()")},Le.prototype.pipe=function(be,Ee){const pt=this,at=this._readableState;at.pipes.length===1&&(at.multiAwaitDrain||(at.multiAwaitDrain=!0,at.awaitDrainWriters=new h(at.awaitDrainWriters?[at.awaitDrainWriters]:[]))),at.pipes.push(be),D("pipe count=%d opts=%j",at.pipes.length,Ee);const zn=(!Ee||Ee.end!==!1)&&be!==n.stdout&&be!==n.stderr?En:Lt;at.endEmitted?n.nextTick(zn):pt.once("end",zn),be.on("unpipe",mn);function mn(It,In){D("onunpipe"),It===pt&&In&&In.hasUnpiped===!1&&(In.hasUnpiped=!0,Ae())}function En(){D("onend"),be.end()}let mr,Pn=!1;function Ae(){D("cleanup"),be.removeListener("close",nn),be.removeListener("finish",$t),mr&&be.removeListener("drain",mr),be.removeListener("error",ht),be.removeListener("unpipe",mn),pt.removeListener("end",En),pt.removeListener("end",Lt),pt.removeListener("data",lt),Pn=!0,mr&&at.awaitDrainWriters&&(!be._writableState||be._writableState.needDrain)&&mr()}function ut(){Pn||(at.pipes.length===1&&at.pipes[0]===be?(D("false write response, pause",0),at.awaitDrainWriters=be,at.multiAwaitDrain=!1):at.pipes.length>1&&at.pipes.includes(be)&&(D("false write response, pause",at.awaitDrainWriters.size),at.awaitDrainWriters.add(be)),pt.pause()),mr||(mr=Fe(pt,be),be.on("drain",mr))}pt.on("data",lt);function lt(It){D("ondata");const In=be.write(It);D("dest.write",In),In===!1&&ut()}function ht(It){if(D("onerror",It),Lt(),be.removeListener("error",ht),be.listenerCount("error")===0){const In=be._writableState||be._readableState;In&&!In.errorEmitted?q(be,It):be.emit("error",It)}}T(be,"error",ht);function nn(){be.removeListener("finish",$t),Lt()}be.once("close",nn);function $t(){D("onfinish"),be.removeListener("close",nn),Lt()}be.once("finish",$t);function Lt(){D("unpipe"),pt.unpipe(be)}return be.emit("pipe",pt),be.writableNeedDrain===!0?ut():at.flowing||(D("pipe resume"),pt.resume()),be};function Fe(be,Ee){return function(){const at=be._readableState;at.awaitDrainWriters===Ee?(D("pipeOnDrain",1),at.awaitDrainWriters=null):at.multiAwaitDrain&&(D("pipeOnDrain",at.awaitDrainWriters.size),at.awaitDrainWriters.delete(Ee)),(!at.awaitDrainWriters||at.awaitDrainWriters.size===0)&&be.listenerCount("data")&&be.resume()}}Le.prototype.unpipe=function(be){const Ee=this._readableState,pt={hasUnpiped:!1};if(Ee.pipes.length===0)return this;if(!be){const yt=Ee.pipes;Ee.pipes=[],this.pause();for(let zn=0;zn<yt.length;zn++)yt[zn].emit("unpipe",this,{hasUnpiped:!1});return this}const at=e(Ee.pipes,be);return at===-1?this:(Ee.pipes.splice(at,1),Ee.pipes.length===0&&this.pause(),be.emit("unpipe",this,pt),this)},Le.prototype.on=function(be,Ee){const pt=C.prototype.on.call(this,be,Ee),at=this._readableState;return be==="data"?(at.readableListening=this.listenerCount("readable")>0,at.flowing!==!1&&this.resume()):be==="readable"&&!at.endEmitted&&!at.readableListening&&(at.readableListening=at.needReadable=!0,at.flowing=!1,at.emittedReadable=!1,D("on readable",at.length,at.reading),at.length?G(this):at.reading||n.nextTick(vt,this)),pt},Le.prototype.addListener=Le.prototype.on,Le.prototype.removeListener=function(be,Ee){const pt=C.prototype.removeListener.call(this,be,Ee);return be==="readable"&&n.nextTick(Et,this),pt},Le.prototype.off=Le.prototype.removeListener,Le.prototype.removeAllListeners=function(be){const Ee=C.prototype.removeAllListeners.apply(this,arguments);return(be==="readable"||be===void 0)&&n.nextTick(Et,this),Ee};function Et(be){const Ee=be._readableState;Ee.readableListening=be.listenerCount("readable")>0,Ee.resumeScheduled&&Ee[U]===!1?Ee.flowing=!0:be.listenerCount("data")>0?be.resume():Ee.readableListening||(Ee.flowing=null)}function vt(be){D("readable nexttick read 0"),be.read(0)}Le.prototype.resume=function(){const be=this._readableState;return be.flowing||(D("resume"),be.flowing=!be.readableListening,xt(this,be)),be[U]=!1,this};function xt(be,Ee){Ee.resumeScheduled||(Ee.resumeScheduled=!0,n.nextTick(kt,be,Ee))}function kt(be,Ee){D("resume",Ee.reading),Ee.reading||be.read(0),Ee.resumeScheduled=!1,be.emit("resume"),Nt(be),Ee.flowing&&!Ee.reading&&be.read(0)}Le.prototype.pause=function(){return D("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(D("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[U]=!0,this};function Nt(be){const Ee=be._readableState;for(D("flow",Ee.flowing);Ee.flowing&&be.read()!==null;);}Le.prototype.wrap=function(be){let Ee=!1;be.on("data",at=>{!this.push(at)&&be.pause&&(Ee=!0,be.pause())}),be.on("end",()=>{this.push(null)}),be.on("error",at=>{q(this,at)}),be.on("close",()=>{this.destroy()}),be.on("destroy",()=>{this.destroy()}),this._read=()=>{Ee&&be.resume&&(Ee=!1,be.resume())};const pt=u(be);for(let at=1;at<pt.length;at++){const yt=pt[at];this[yt]===void 0&&typeof be[yt]=="function"&&(this[yt]=be[yt].bind(be))}return this},Le.prototype[m]=function(){return en(this)},Le.prototype.iterator=function(be){return be!==void 0&&A(be,"options"),en(this,be)};function en(be,Ee){typeof be.read!="function"&&(be=Le.wrap(be,{objectMode:!0}));const pt=Pr(be,Ee);return pt.stream=be,pt}async function*Pr(be,Ee){let pt=Y;function at(mn){this===be?(pt(),pt=Y):pt=mn}be.on("readable",at);let yt;const zn=I(be,{writable:!1},mn=>{yt=mn?ge(yt,mn):null,pt(),pt=Y});try{for(;;){const mn=be.destroyed?null:be.read();if(mn!==null)yield mn;else{if(yt)throw yt;if(yt===null)return;await new p(at)}}}catch(mn){throw yt=ge(yt,mn),yt}finally{(yt||(Ee==null?void 0:Ee.destroyOnReturn)!==!1)&&(yt===void 0||be._readableState.autoDestroy)?W.destroyer(be,null):(be.off("readable",at),zn())}}o(Le.prototype,{readable:{__proto__:null,get(){const be=this._readableState;return!!be&&be.readable!==!1&&!be.destroyed&&!be.errorEmitted&&!be.endEmitted},set(be){this._readableState&&(this._readableState.readable=!!be)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(be){this._readableState&&(this._readableState.flowing=be)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(be){this._readableState&&(this._readableState.destroyed=be)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(Ce.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[U]!==!1},set(be){this[U]=!!be}}}),Le._fromList=Zt;function Zt(be,Ee){if(Ee.length===0)return null;let pt;return Ee.objectMode?pt=Ee.buffer.shift():!be||be>=Ee.length?(Ee.decoder?pt=Ee.buffer.join(""):Ee.buffer.length===1?pt=Ee.buffer.first():pt=Ee.buffer.concat(Ee.length),Ee.buffer.clear()):pt=Ee.buffer.consume(be,Ee.decoder),pt}function Yt(be){const Ee=be._readableState;D("endReadable",Ee.endEmitted),Ee.endEmitted||(Ee.ended=!0,n.nextTick(aa,Ee,be))}function aa(be,Ee){if(D("endReadableNT",be.endEmitted,be.length),!be.errored&&!be.closeEmitted&&!be.endEmitted&&be.length===0){if(be.endEmitted=!0,Ee.emit("end"),Ee.writable&&Ee.allowHalfOpen===!1)n.nextTick(On,Ee);else if(be.autoDestroy){const pt=Ee._writableState;(!pt||pt.autoDestroy&&(pt.finished||pt.writable===!1))&&Ee.destroy()}}}function On(be){be.writable&&!be.writableEnded&&!be.destroyed&&be.end()}Le.from=function(be,Ee){return z(Le,be,Ee)};let Bn;function Pa(){return Bn===void 0&&(Bn={}),Bn}return Le.fromWeb=function(be,Ee){return Pa().newStreamReadableFromReadableStream(be,Ee)},Le.toWeb=function(be,Ee){return Pa().newReadableStreamFromStreamReadable(be,Ee)},Le.wrap=function(be,Ee){var pt,at;return new Le({objectMode:(pt=(at=be.readableObjectMode)!==null&&at!==void 0?at:be.objectMode)!==null&&pt!==void 0?pt:!0,...Ee,destroy(yt,zn){W.destroyer(be,yt),zn(yt)}}).wrap(be)},J8}var Q8,TP;function DM(){if(TP)return Q8;TP=1;const n=sp(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:o,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:p,SymbolHasInstance:h}=wa;Q8=A,A.WritableState=S;const{EventEmitter:g}=S1,m=NM.Stream,{Buffer:w}=ip,v=jm,{addAbortSignal:C}=_S,{getHighWaterMark:T,getDefaultHighWaterMark:R}=SS,{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_MULTIPLE_CALLBACK:D,ERR_STREAM_CANNOT_PIPE:K,ERR_STREAM_DESTROYED:W,ERR_STREAM_ALREADY_FINISHED:pe,ERR_STREAM_NULL_VALUES:ce,ERR_STREAM_WRITE_AFTER_END:ge,ERR_UNKNOWN_ENCODING:Se}=oo.codes,{errorOrDestroy:_e}=v;u(A.prototype,m.prototype),u(A,m);function ae(){}const Te=p("kOnFinished");function S(le,ne,ye){typeof ye!="boolean"&&(ye=ne instanceof xf()),this.objectMode=!!(le&&le.objectMode),ye&&(this.objectMode=this.objectMode||!!(le&&le.writableObjectMode)),this.highWaterMark=le?T(this,le,"writableHighWaterMark",ye):R(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const Z=!!(le&&le.decodeStrings===!1);this.decodeStrings=!Z,this.defaultEncoding=le&&le.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=q.bind(void 0,ne),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,x(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!le||le.emitClose!==!1,this.autoDestroy=!le||le.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Te]=[]}function x(le){le.buffered=[],le.bufferedIndex=0,le.allBuffers=!0,le.allNoop=!0}S.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(S.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function A(le){const ne=this instanceof xf();if(!ne&&!r(A,this))return new A(le);this._writableState=new S(le,this,ne),le&&(typeof le.write=="function"&&(this._write=le.write),typeof le.writev=="function"&&(this._writev=le.writev),typeof le.destroy=="function"&&(this._destroy=le.destroy),typeof le.final=="function"&&(this._final=le.final),typeof le.construct=="function"&&(this._construct=le.construct),le.signal&&C(le.signal,this)),m.call(this,le),v.construct(this,()=>{const ye=this._writableState;ye.writing||ie(this,ye),ke(this,ye)})}i(A,h,{__proto__:null,value:function(le){return r(this,le)?!0:this!==A?!1:le&&le._writableState instanceof S}}),A.prototype.pipe=function(){_e(this,new K)};function U(le,ne,ye,Z){const N=le._writableState;if(typeof ye=="function")Z=ye,ye=N.defaultEncoding;else{if(!ye)ye=N.defaultEncoding;else if(ye!=="buffer"&&!w.isEncoding(ye))throw new Se(ye);typeof Z!="function"&&(Z=ae)}if(ne===null)throw new ce;if(!N.objectMode)if(typeof ne=="string")N.decodeStrings!==!1&&(ne=w.from(ne,ye),ye="buffer");else if(ne instanceof w)ye="buffer";else if(m._isUint8Array(ne))ne=m._uint8ArrayToBuffer(ne),ye="buffer";else throw new O("chunk",["string","Buffer","Uint8Array"],ne);let B;return N.ending?B=new ge:N.destroyed&&(B=new W("write")),B?(n.nextTick(Z,B),_e(le,B,!0),B):(N.pendingcb++,L(le,N,ne,ye,Z))}A.prototype.write=function(le,ne,ye){return U(this,le,ne,ye)===!0},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){const le=this._writableState;le.corked&&(le.corked--,le.writing||ie(this,le))},A.prototype.setDefaultEncoding=function(ne){if(typeof ne=="string"&&(ne=c(ne)),!w.isEncoding(ne))throw new Se(ne);return this._writableState.defaultEncoding=ne,this};function L(le,ne,ye,Z,N){const B=ne.objectMode?1:ye.length;ne.length+=B;const te=ne.length<ne.highWaterMark;return te||(ne.needDrain=!0),ne.writing||ne.corked||ne.errored||!ne.constructed?(ne.buffered.push({chunk:ye,encoding:Z,callback:N}),ne.allBuffers&&Z!=="buffer"&&(ne.allBuffers=!1),ne.allNoop&&N!==ae&&(ne.allNoop=!1)):(ne.writelen=B,ne.writecb=N,ne.writing=!0,ne.sync=!0,le._write(ye,Z,ne.onwrite),ne.sync=!1),te&&!ne.errored&&!ne.destroyed}function z(le,ne,ye,Z,N,B,te){ne.writelen=Z,ne.writecb=te,ne.writing=!0,ne.sync=!0,ne.destroyed?ne.onwrite(new W("write")):ye?le._writev(N,ne.onwrite):le._write(N,B,ne.onwrite),ne.sync=!1}function Y(le,ne,ye,Z){--ne.pendingcb,Z(ye),Q(ne),_e(le,ye)}function q(le,ne){const ye=le._writableState,Z=ye.sync,N=ye.writecb;if(typeof N!="function"){_e(le,new D);return}ye.writing=!1,ye.writecb=null,ye.length-=ye.writelen,ye.writelen=0,ne?(ne.stack,ye.errored||(ye.errored=ne),le._readableState&&!le._readableState.errored&&(le._readableState.errored=ne),Z?n.nextTick(Y,le,ye,ne,N):Y(le,ye,ne,N)):(ye.buffered.length>ye.bufferedIndex&&ie(le,ye),Z?ye.afterWriteTickInfo!==null&&ye.afterWriteTickInfo.cb===N?ye.afterWriteTickInfo.count++:(ye.afterWriteTickInfo={count:1,cb:N,stream:le,state:ye},n.nextTick(P,ye.afterWriteTickInfo)):M(le,ye,1,N))}function P({stream:le,state:ne,count:ye,cb:Z}){return ne.afterWriteTickInfo=null,M(le,ne,ye,Z)}function M(le,ne,ye,Z){for(!ne.ending&&!le.destroyed&&ne.length===0&&ne.needDrain&&(ne.needDrain=!1,le.emit("drain"));ye-- >0;)ne.pendingcb--,Z();ne.destroyed&&Q(ne),ke(le,ne)}function Q(le){if(le.writing)return;for(let N=le.bufferedIndex;N<le.buffered.length;++N){var ne;const{chunk:B,callback:te}=le.buffered[N],oe=le.objectMode?1:B.length;le.length-=oe,te((ne=le.errored)!==null&&ne!==void 0?ne:new W("write"))}const ye=le[Te].splice(0);for(let N=0;N<ye.length;N++){var Z;ye[N]((Z=le.errored)!==null&&Z!==void 0?Z:new W("end"))}x(le)}function ie(le,ne){if(ne.corked||ne.bufferProcessing||ne.destroyed||!ne.constructed)return;const{buffered:ye,bufferedIndex:Z,objectMode:N}=ne,B=ye.length-Z;if(!B)return;let te=Z;if(ne.bufferProcessing=!0,B>1&&le._writev){ne.pendingcb-=B-1;const oe=ne.allNoop?ae:Le=>{for(let Xe=te;Xe<ye.length;++Xe)ye[Xe].callback(Le)},Ce=ne.allNoop&&te===0?ye:e(ye,te);Ce.allBuffers=ne.allBuffers,z(le,ne,!0,ne.length,Ce,"",oe),x(ne)}else{do{const{chunk:oe,encoding:Ce,callback:Le}=ye[te];ye[te++]=null;const Xe=N?1:oe.length;z(le,ne,!1,Xe,oe,Ce,Le)}while(te<ye.length&&!ne.writing);te===ye.length?x(ne):te>256?(ye.splice(0,te),ne.bufferedIndex=0):ne.bufferedIndex=te}ne.bufferProcessing=!1}A.prototype._write=function(le,ne,ye){if(this._writev)this._writev([{chunk:le,encoding:ne}],ye);else throw new I("_write()")},A.prototype._writev=null,A.prototype.end=function(le,ne,ye){const Z=this._writableState;typeof le=="function"?(ye=le,le=null,ne=null):typeof ne=="function"&&(ye=ne,ne=null);let N;if(le!=null){const B=U(this,le,ne);B instanceof t&&(N=B)}return Z.corked&&(Z.corked=1,this.uncork()),N||(!Z.errored&&!Z.ending?(Z.ending=!0,ke(this,Z,!0),Z.ended=!0):Z.finished?N=new pe("end"):Z.destroyed&&(N=new W("end"))),typeof ye=="function"&&(N||Z.finished?n.nextTick(ye,N):Z[Te].push(ye)),this};function H(le){return le.ending&&!le.destroyed&&le.constructed&&le.length===0&&!le.errored&&le.buffered.length===0&&!le.finished&&!le.writing&&!le.errorEmitted&&!le.closeEmitted}function we(le,ne){let ye=!1;function Z(N){if(ye){_e(le,N??D());return}if(ye=!0,ne.pendingcb--,N){const B=ne[Te].splice(0);for(let te=0;te<B.length;te++)B[te](N);_e(le,N,ne.sync)}else H(ne)&&(ne.prefinished=!0,le.emit("prefinish"),ne.pendingcb++,n.nextTick(Ue,le,ne))}ne.sync=!0,ne.pendingcb++;try{le._final(Z)}catch(N){Z(N)}ne.sync=!1}function Ne(le,ne){!ne.prefinished&&!ne.finalCalled&&(typeof le._final=="function"&&!ne.destroyed?(ne.finalCalled=!0,we(le,ne)):(ne.prefinished=!0,le.emit("prefinish")))}function ke(le,ne,ye){H(ne)&&(Ne(le,ne),ne.pendingcb===0&&(ye?(ne.pendingcb++,n.nextTick((Z,N)=>{H(N)?Ue(Z,N):N.pendingcb--},le,ne)):H(ne)&&(ne.pendingcb++,Ue(le,ne))))}function Ue(le,ne){ne.pendingcb--,ne.finished=!0;const ye=ne[Te].splice(0);for(let Z=0;Z<ye.length;Z++)ye[Z]();if(le.emit("finish"),ne.autoDestroy){const Z=le._readableState;(!Z||Z.autoDestroy&&(Z.endEmitted||Z.readable===!1))&&le.destroy()}}o(A.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(le){this._writableState&&(this._writableState.destroyed=le)}},writable:{__proto__:null,get(){const le=this._writableState;return!!le&&le.writable!==!1&&!le.destroyed&&!le.errored&&!le.ending&&!le.ended},set(le){this._writableState&&(this._writableState.writable=!!le)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const le=this._writableState;return le?!le.destroyed&&!le.ending&&le.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const se=v.destroy;A.prototype.destroy=function(le,ne){const ye=this._writableState;return!ye.destroyed&&(ye.bufferedIndex<ye.buffered.length||ye[Te].length)&&n.nextTick(Q,ye),se.call(this,le,ne),this},A.prototype._undestroy=v.undestroy,A.prototype._destroy=function(le,ne){ne(le)},A.prototype[g.captureRejectionSymbol]=function(le){this.destroy(le)};let fe;function de(){return fe===void 0&&(fe={}),fe}return A.fromWeb=function(le,ne){return de().newStreamWritableFromWritableStream(le,ne)},A.toWeb=function(le){return de().newWritableStreamFromStreamWritable(le)},Q8}var Z8,RP;function soe(){if(RP)return Z8;RP=1;const n=sp(),e=ip,{isReadable:t,isWritable:r,isIterable:i,isNodeStream:o,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:p,isReadableStream:h,isWritableStream:g}=Af,m=op,{AbortError:w,codes:{ERR_INVALID_ARG_TYPE:v,ERR_INVALID_RETURN_VALUE:C}}=oo,{destroyer:T}=jm,R=xf(),O=ES(),I=DM(),{createDeferredPromise:D}=Os,K=sz,W=globalThis.Blob||e.Blob,pe=typeof W<"u"?function(S){return S instanceof W}:function(S){return!1},ce=globalThis.AbortController||r1().AbortController,{FunctionPrototypeCall:ge}=wa;class Se extends R{constructor(S){super(S),(S==null?void 0:S.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(S==null?void 0:S.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Z8=function Te(S,x){if(p(S))return S;if(u(S))return ae({readable:S});if(c(S))return ae({writable:S});if(o(S))return ae({writable:!1,readable:!1});if(h(S))return ae({readable:O.fromWeb(S)});if(g(S))return ae({writable:I.fromWeb(S)});if(typeof S=="function"){const{value:U,write:L,final:z,destroy:Y}=_e(S);if(i(U))return K(Se,U,{objectMode:!0,write:L,final:z,destroy:Y});const q=U==null?void 0:U.then;if(typeof q=="function"){let P;const M=ge(q,U,Q=>{if(Q!=null)throw new C("nully","body",Q)},Q=>{T(P,Q)});return P=new Se({objectMode:!0,readable:!1,write:L,final(Q){z(async()=>{try{await M,n.nextTick(Q,null)}catch(ie){n.nextTick(Q,ie)}})},destroy:Y})}throw new C("Iterable, AsyncIterable or AsyncFunction",x,U)}if(pe(S))return Te(S.arrayBuffer());if(i(S))return K(Se,S,{objectMode:!0,writable:!1});if(h(S==null?void 0:S.readable)&&g(S==null?void 0:S.writable))return Se.fromWeb(S);if(typeof(S==null?void 0:S.writable)=="object"||typeof(S==null?void 0:S.readable)=="object"){const U=S!=null&&S.readable?u(S==null?void 0:S.readable)?S==null?void 0:S.readable:Te(S.readable):void 0,L=S!=null&&S.writable?c(S==null?void 0:S.writable)?S==null?void 0:S.writable:Te(S.writable):void 0;return ae({readable:U,writable:L})}const A=S==null?void 0:S.then;if(typeof A=="function"){let U;return ge(A,S,L=>{L!=null&&U.push(L),U.push(null)},L=>{T(U,L)}),U=new Se({objectMode:!0,writable:!1,read(){}})}throw new v(x,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],S)};function _e(Te){let{promise:S,resolve:x}=D();const A=new ce,U=A.signal;return{value:Te(async function*(){for(;;){const z=S;S=null;const{chunk:Y,done:q,cb:P}=await z;if(n.nextTick(P),q)return;if(U.aborted)throw new w(void 0,{cause:U.reason});({promise:S,resolve:x}=D()),yield Y}}(),{signal:U}),write(z,Y,q){const P=x;x=null,P({chunk:z,done:!1,cb:q})},final(z){const Y=x;x=null,Y({done:!0,cb:z})},destroy(z,Y){A.abort(),Y(z)}}}function ae(Te){const S=Te.readable&&typeof Te.readable.read!="function"?O.wrap(Te.readable):Te.readable,x=Te.writable;let A=!!t(S),U=!!r(x),L,z,Y,q,P;function M(Q){const ie=q;q=null,ie?ie(Q):Q&&P.destroy(Q)}return P=new Se({readableObjectMode:!!(S!=null&&S.readableObjectMode),writableObjectMode:!!(x!=null&&x.writableObjectMode),readable:A,writable:U}),U&&(m(x,Q=>{U=!1,Q&&T(S,Q),M(Q)}),P._write=function(Q,ie,H){x.write(Q,ie)?H():L=H},P._final=function(Q){x.end(),z=Q},x.on("drain",function(){if(L){const Q=L;L=null,Q()}}),x.on("finish",function(){if(z){const Q=z;z=null,Q()}})),A&&(m(S,Q=>{A=!1,Q&&T(S,Q),M(Q)}),S.on("readable",function(){if(Y){const Q=Y;Y=null,Q()}}),S.on("end",function(){P.push(null)}),P._read=function(){for(;;){const Q=S.read();if(Q===null){Y=P._read;return}if(!P.push(Q))return}}),P._destroy=function(Q,ie){!Q&&q!==null&&(Q=new w),Y=null,L=null,z=null,q===null?ie(Q):(q=ie,T(x,Q),T(S,Q))},P}return Z8}var X8,OP;function xf(){if(OP)return X8;OP=1;const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=wa;X8=u;const i=ES(),o=DM();r(u.prototype,i.prototype),r(u,i);{const g=t(o.prototype);for(let m=0;m<g.length;m++){const w=g[m];u.prototype[w]||(u.prototype[w]=o.prototype[w])}}function u(g){if(!(this instanceof u))return new u(g);i.call(this,g),o.call(this,g),g?(this.allowHalfOpen=g.allowHalfOpen!==!1,g.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),g.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(u.prototype,{writable:{__proto__:null,...e(o.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(o.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(o.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(o.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(o.prototype,"writableLength")},writableFinished:{__proto__:null,...e(o.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(o.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(o.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(o.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(g){this._readableState&&this._writableState&&(this._readableState.destroyed=g,this._writableState.destroyed=g)}}});let c;function p(){return c===void 0&&(c={}),c}u.fromWeb=function(g,m){return p().newStreamDuplexFromReadableWritablePair(g,m)},u.toWeb=function(g){return p().newReadableWritablePairFromDuplex(g)};let h;return u.from=function(g){return h||(h=soe()),h(g,"body")},X8}const{ObjectSetPrototypeOf:oz,Symbol:ooe}=wa;var uz=_f;const{ERR_METHOD_NOT_IMPLEMENTED:uoe}=oo.codes,UM=xf(),{getHighWaterMark:loe}=SS;oz(_f.prototype,UM.prototype);oz(_f,UM);const jv=ooe("kCallback");function _f(n){if(!(this instanceof _f))return new _f(n);const e=n?loe(this,n,"readableHighWaterMark",!0):null;e===0&&(n={...n,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:n.writableHighWaterMark||0}),UM.call(this,n),this._readableState.sync=!1,this[jv]=null,n&&(typeof n.transform=="function"&&(this._transform=n.transform),typeof n.flush=="function"&&(this._flush=n.flush)),this.on("prefinish",coe)}function v4(n){typeof this._flush=="function"&&!this.destroyed?this._flush((e,t)=>{if(e){n?n(e):this.destroy(e);return}t!=null&&this.push(t),this.push(null),n&&n()}):(this.push(null),n&&n())}function coe(){this._final!==v4&&v4.call(this)}_f.prototype._final=v4;_f.prototype._transform=function(n,e,t){throw new uoe("_transform()")};_f.prototype._write=function(n,e,t){const r=this._readableState,i=this._writableState,o=r.length;this._transform(n,e,(u,c)=>{if(u){t(u);return}c!=null&&this.push(c),i.ended||o===r.length||r.length<r.highWaterMark?t():this[jv]=t})};_f.prototype._read=function(){if(this[jv]){const n=this[jv];this[jv]=null,n()}};const{ObjectSetPrototypeOf:lz}=wa;var cz=_m;const FM=uz;lz(_m.prototype,FM.prototype);lz(_m,FM);function _m(n){if(!(this instanceof _m))return new _m(n);FM.call(this,n)}_m.prototype._transform=function(n,e,t){t(null,n)};const Mv=sp(),{ArrayIsArray:foe,Promise:doe,SymbolAsyncIterator:poe,SymbolDispose:hoe}=wa,O2=op,{once:yoe}=Os,moe=jm,LP=xf(),{aggregateTwoErrors:goe,codes:{ERR_INVALID_ARG_TYPE:w4,ERR_INVALID_RETURN_VALUE:e5,ERR_MISSING_ARGS:boe,ERR_STREAM_DESTROYED:voe,ERR_STREAM_PREMATURE_CLOSE:woe},AbortError:xoe}=oo,{validateFunction:_oe,validateAbortSignal:Soe}=E1,{isIterable:ph,isReadable:t5,isReadableNodeStream:l2,isNodeStream:NP,isTransformStream:Zy,isWebStream:Eoe,isReadableStream:n5,isReadableFinished:Coe}=Af,Aoe=globalThis.AbortController||r1().AbortController;let r5,a5,i5;function PP(n,e,t){let r=!1;n.on("close",()=>{r=!0});const i=O2(n,{readable:e,writable:t},o=>{r=!o});return{destroy:o=>{r||(r=!0,moe.destroyer(n,o||new voe("pipe")))},cleanup:i}}function Moe(n){return _oe(n[n.length-1],"streams[stream.length - 1]"),n.pop()}function s5(n){if(ph(n))return n;if(l2(n))return koe(n);throw new w4("val",["Readable","Iterable","AsyncIterable"],n)}async function*koe(n){a5||(a5=ES()),yield*a5.prototype[poe].call(n)}async function q_(n,e,t,{end:r}){let i,o=null;const u=h=>{if(h&&(i=h),o){const g=o;o=null,g()}},c=()=>new doe((h,g)=>{i?g(i):o=()=>{i?g(i):h()}});e.on("drain",u);const p=O2(e,{readable:!1},u);try{e.writableNeedDrain&&await c();for await(const h of n)e.write(h)||await c();r&&(e.end(),await c()),t()}catch(h){t(i!==h?goe(i,h):h)}finally{p(),e.off("drain",u)}}async function o5(n,e,t,{end:r}){Zy(e)&&(e=e.writable);const i=e.getWriter();try{for await(const o of n)await i.ready,i.write(o).catch(()=>{});await i.ready,r&&await i.close(),t()}catch(o){try{await i.abort(o),t(o)}catch(u){t(u)}}}function Toe(...n){return fz(n,yoe(Moe(n)))}function fz(n,e,t){if(n.length===1&&foe(n[0])&&(n=n[0]),n.length<2)throw new boe("streams");const r=new Aoe,i=r.signal,o=t==null?void 0:t.signal,u=[];Soe(o,"options.signal");function c(){C(new xoe)}i5=i5||Os.addAbortListener;let p;o&&(p=i5(o,c));let h,g;const m=[];let w=0;function v(I){C(I,--w===0)}function C(I,D){var K;if(I&&(!h||h.code==="ERR_STREAM_PREMATURE_CLOSE")&&(h=I),!(!h&&!D)){for(;m.length;)m.shift()(h);(K=p)===null||K===void 0||K[hoe](),r.abort(),D&&(h||u.forEach(W=>W()),Mv.nextTick(e,h,g))}}let T;for(let I=0;I<n.length;I++){const D=n[I],K=I<n.length-1,W=I>0,pe=K||(t==null?void 0:t.end)!==!1,ce=I===n.length-1;if(NP(D)){let ge=function(Se){Se&&Se.name!=="AbortError"&&Se.code!=="ERR_STREAM_PREMATURE_CLOSE"&&v(Se)};if(pe){const{destroy:Se,cleanup:_e}=PP(D,K,W);m.push(Se),t5(D)&&ce&&u.push(_e)}D.on("error",ge),t5(D)&&ce&&u.push(()=>{D.removeListener("error",ge)})}if(I===0)if(typeof D=="function"){if(T=D({signal:i}),!ph(T))throw new e5("Iterable, AsyncIterable or Stream","source",T)}else ph(D)||l2(D)||Zy(D)?T=D:T=LP.from(D);else if(typeof D=="function"){if(Zy(T)){var R;T=s5((R=T)===null||R===void 0?void 0:R.readable)}else T=s5(T);if(T=D(T,{signal:i}),K){if(!ph(T,!0))throw new e5("AsyncIterable",`transform[${I-1}]`,T)}else{var O;r5||(r5=cz);const ge=new r5({objectMode:!0}),Se=(O=T)===null||O===void 0?void 0:O.then;if(typeof Se=="function")w++,Se.call(T,Te=>{g=Te,Te!=null&&ge.write(Te),pe&&ge.end(),Mv.nextTick(v)},Te=>{ge.destroy(Te),Mv.nextTick(v,Te)});else if(ph(T,!0))w++,q_(T,ge,v,{end:pe});else if(n5(T)||Zy(T)){const Te=T.readable||T;w++,q_(Te,ge,v,{end:pe})}else throw new e5("AsyncIterable or Promise","destination",T);T=ge;const{destroy:_e,cleanup:ae}=PP(T,!1,!0);m.push(_e),ce&&u.push(ae)}}else if(NP(D)){if(l2(T)){w+=2;const ge=Roe(T,D,v,{end:pe});t5(D)&&ce&&u.push(ge)}else if(Zy(T)||n5(T)){const ge=T.readable||T;w++,q_(ge,D,v,{end:pe})}else if(ph(T))w++,q_(T,D,v,{end:pe});else throw new w4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],T);T=D}else if(Eoe(D)){if(l2(T))w++,o5(s5(T),D,v,{end:pe});else if(n5(T)||ph(T))w++,o5(T,D,v,{end:pe});else if(Zy(T))w++,o5(T.readable,D,v,{end:pe});else throw new w4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],T);T=D}else T=LP.from(D)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Mv.nextTick(c),T}function Roe(n,e,t,{end:r}){let i=!1;if(e.on("close",()=>{i||t(new woe)}),n.pipe(e,{end:!1}),r){let o=function(){i=!0,e.end()};Coe(n)?Mv.nextTick(o):n.once("end",o)}else t();return O2(n,{readable:!0,writable:!1},o=>{const u=n._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&u&&u.ended&&!u.errored&&!u.errorEmitted?n.once("end",t).once("error",t):t(o)}),O2(e,{readable:!1,writable:!0},t)}var BM={pipelineImpl:fz,pipeline:Toe};const{pipeline:Ooe}=BM,V_=xf(),{destroyer:Loe}=jm,{isNodeStream:G_,isReadable:IP,isWritable:DP,isWebStream:u5,isTransformStream:fh,isWritableStream:UP,isReadableStream:FP}=Af,{AbortError:Noe,codes:{ERR_INVALID_ARG_VALUE:BP,ERR_MISSING_ARGS:Poe}}=oo,Ioe=op;var dz=function(...e){if(e.length===0)throw new Poe("streams");if(e.length===1)return V_.from(e[0]);const t=[...e];if(typeof e[0]=="function"&&(e[0]=V_.from(e[0])),typeof e[e.length-1]=="function"){const v=e.length-1;e[v]=V_.from(e[v])}for(let v=0;v<e.length;++v)if(!(!G_(e[v])&&!u5(e[v]))){if(v<e.length-1&&!(IP(e[v])||FP(e[v])||fh(e[v])))throw new BP(`streams[${v}]`,t[v],"must be readable");if(v>0&&!(DP(e[v])||UP(e[v])||fh(e[v])))throw new BP(`streams[${v}]`,t[v],"must be writable")}let r,i,o,u,c;function p(v){const C=u;u=null,C?C(v):v?c.destroy(v):!w&&!m&&c.destroy()}const h=e[0],g=Ooe(e,p),m=!!(DP(h)||UP(h)||fh(h)),w=!!(IP(g)||FP(g)||fh(g));if(c=new V_({writableObjectMode:!!(h!=null&&h.writableObjectMode),readableObjectMode:!!(g!=null&&g.readableObjectMode),writable:m,readable:w}),m){if(G_(h))c._write=function(C,T,R){h.write(C,T)?R():r=R},c._final=function(C){h.end(),i=C},h.on("drain",function(){if(r){const C=r;r=null,C()}});else if(u5(h)){const T=(fh(h)?h.writable:h).getWriter();c._write=async function(R,O,I){try{await T.ready,T.write(R).catch(()=>{}),I()}catch(D){I(D)}},c._final=async function(R){try{await T.ready,T.close().catch(()=>{}),i=R}catch(O){R(O)}}}const v=fh(g)?g.readable:g;Ioe(v,()=>{if(i){const C=i;i=null,C()}})}if(w){if(G_(g))g.on("readable",function(){if(o){const v=o;o=null,v()}}),g.on("end",function(){c.push(null)}),c._read=function(){for(;;){const v=g.read();if(v===null){o=c._read;return}if(!c.push(v))return}};else if(u5(g)){const C=(fh(g)?g.readable:g).getReader();c._read=async function(){for(;;)try{const{value:T,done:R}=await C.read();if(!c.push(T))return;if(R){c.push(null);return}}catch{return}}}}return c._destroy=function(v,C){!v&&u!==null&&(v=new Noe),o=null,r=null,i=null,u===null?C(v):(u=C,G_(g)&&Loe(g,v))},c};const Doe=globalThis.AbortController||r1().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Uoe,ERR_INVALID_ARG_TYPE:A1,ERR_MISSING_ARGS:Foe,ERR_OUT_OF_RANGE:Boe},AbortError:fc}=oo,{validateAbortSignal:Wh,validateInteger:zP,validateObject:Kh}=E1,zoe=wa.Symbol("kWeak"),joe=wa.Symbol("kResistStopPropagation"),{finished:$oe}=op,Hoe=dz,{addAbortSignalNoValidate:qoe}=_S,{isWritable:Voe,isNodeStream:Goe}=Af,{deprecate:Woe}=Os,{ArrayPrototypePush:Koe,Boolean:Yoe,MathFloor:jP,Number:Joe,NumberIsNaN:Qoe,Promise:$P,PromiseReject:HP,PromiseResolve:Zoe,PromisePrototypeThen:qP,Symbol:pz}=wa,L2=pz("kEmpty"),VP=pz("kEof");function Xoe(n,e){if(e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal"),Goe(n)&&!Voe(n))throw new Uoe("stream",n,"must be writable");const t=Hoe(this,n);return e!=null&&e.signal&&qoe(e.signal,t),t}function CS(n,e){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal");let t=1;(e==null?void 0:e.concurrency)!=null&&(t=jP(e.concurrency));let r=t-1;return(e==null?void 0:e.highWaterMark)!=null&&(r=jP(e.highWaterMark)),zP(t,"options.concurrency",1),zP(r,"options.highWaterMark",0),r+=t,(async function*(){const o=Os.AbortSignalAny([e==null?void 0:e.signal].filter(Yoe)),u=this,c=[],p={signal:o};let h,g,m=!1,w=0;function v(){m=!0,C()}function C(){w-=1,T()}function T(){g&&!m&&w<t&&c.length<r&&(g(),g=null)}async function R(){try{for await(let O of u){if(m)return;if(o.aborted)throw new fc;try{if(O=n(O,p),O===L2)continue;O=Zoe(O)}catch(I){O=HP(I)}w+=1,qP(O,C,v),c.push(O),h&&(h(),h=null),!m&&(c.length>=r||w>=t)&&await new $P(I=>{g=I})}c.push(VP)}catch(O){const I=HP(O);qP(I,C,v),c.push(I)}finally{m=!0,h&&(h(),h=null)}}R();try{for(;;){for(;c.length>0;){const O=await c[0];if(O===VP)return;if(o.aborted)throw new fc;O!==L2&&(yield O),c.shift(),T()}await new $P(O=>{h=O})}}finally{m=!0,g&&(g(),g=null)}}).call(this)}function eue(n=void 0){return n!=null&&Kh(n,"options"),(n==null?void 0:n.signal)!=null&&Wh(n.signal,"options.signal"),(async function*(){let t=0;for await(const i of this){var r;if(n!=null&&(r=n.signal)!==null&&r!==void 0&&r.aborted)throw new fc({cause:n.signal.reason});yield[t++,i]}}).call(this)}async function hz(n,e=void 0){for await(const t of zM.call(this,n,e))return!0;return!1}async function tue(n,e=void 0){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);return!await hz.call(this,async(...t)=>!await n(...t),e)}async function nue(n,e){for await(const t of zM.call(this,n,e))return t}async function rue(n,e){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i),L2}for await(const r of CS.call(this,t,e));}function zM(n,e){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i)?r:L2}return CS.call(this,t,e)}class aue extends Foe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function iue(n,e,t){var r;if(typeof n!="function")throw new A1("reducer",["Function","AsyncFunction"],n);t!=null&&Kh(t,"options"),(t==null?void 0:t.signal)!=null&&Wh(t.signal,"options.signal");let i=arguments.length>1;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted){const h=new fc(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await $oe(this.destroy(h)),h}const o=new Doe,u=o.signal;if(t!=null&&t.signal){const h={once:!0,[zoe]:this,[joe]:!0};t.signal.addEventListener("abort",()=>o.abort(),h)}let c=!1;try{for await(const h of this){var p;if(c=!0,t!=null&&(p=t.signal)!==null&&p!==void 0&&p.aborted)throw new fc;i?e=await n(e,h,{signal:u}):(e=h,i=!0)}if(!c&&!i)throw new aue}finally{o.abort()}return e}async function sue(n){n!=null&&Kh(n,"options"),(n==null?void 0:n.signal)!=null&&Wh(n.signal,"options.signal");const e=[];for await(const r of this){var t;if(n!=null&&(t=n.signal)!==null&&t!==void 0&&t.aborted)throw new fc(void 0,{cause:n.signal.reason});Koe(e,r)}return e}function oue(n,e){const t=CS.call(this,n,e);return(async function*(){for await(const i of t)yield*i}).call(this)}function yz(n){if(n=Joe(n),Qoe(n))return 0;if(n<0)throw new Boe("number",">= 0",n);return n}function uue(n,e=void 0){return e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal"),n=yz(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new fc;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new fc;n--<=0&&(yield o)}}).call(this)}function lue(n,e=void 0){return e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal"),n=yz(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new fc;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new fc;if(n-- >0&&(yield o),n<=0)return}}).call(this)}kM.streamReturningOperators={asIndexedPairs:Woe(eue,"readable.asIndexedPairs will be removed in a future version."),drop:uue,filter:zM,flatMap:oue,map:CS,take:lue,compose:Xoe};kM.promiseReturningOperators={every:tue,forEach:rue,reduce:iue,toArray:sue,some:hz,find:nue};var l5,GP;function mz(){if(GP)return l5;GP=1;const{ArrayPrototypePop:n,Promise:e}=wa,{isIterable:t,isNodeStream:r,isWebStream:i}=Af,{pipelineImpl:o}=BM,{finished:u}=op;gz();function c(...p){return new e((h,g)=>{let m,w;const v=p[p.length-1];if(v&&typeof v=="object"&&!r(v)&&!t(v)&&!i(v)){const C=n(p);m=C.signal,w=C.end}o(p,(C,T)=>{C?g(C):h(T)},{signal:m,end:w})})}return l5={finished:u,pipeline:c},l5}var WP;function gz(){if(WP)return q8.exports;WP=1;const{Buffer:n}=ip,{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=wa,{promisify:{custom:i}}=Os,{streamReturningOperators:o,promiseReturningOperators:u}=kM,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=oo,p=dz,{setDefaultHighWaterMark:h,getDefaultHighWaterMark:g}=SS,{pipeline:m}=BM,{destroyer:w}=jm,v=op,C=mz(),T=Af,R=q8.exports=NM.Stream;R.isDestroyed=T.isDestroyed,R.isDisturbed=T.isDisturbed,R.isErrored=T.isErrored,R.isReadable=T.isReadable,R.isWritable=T.isWritable,R.Readable=ES();for(const I of t(o)){let K=function(...W){if(new.target)throw c();return R.Readable.from(r(D,this,W))};const D=o[I];e(K,"name",{__proto__:null,value:D.name}),e(K,"length",{__proto__:null,value:D.length}),e(R.Readable.prototype,I,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}for(const I of t(u)){let K=function(...W){if(new.target)throw c();return r(D,this,W)};const D=u[I];e(K,"name",{__proto__:null,value:D.name}),e(K,"length",{__proto__:null,value:D.length}),e(R.Readable.prototype,I,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}R.Writable=DM(),R.Duplex=xf(),R.Transform=uz,R.PassThrough=cz,R.pipeline=m;const{addAbortSignal:O}=_S;return R.addAbortSignal=O,R.finished=v,R.destroy=w,R.compose=p,R.setDefaultHighWaterMark=h,R.getDefaultHighWaterMark=g,e(R,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return C}}),e(m,i,{__proto__:null,enumerable:!0,get(){return C.pipeline}}),e(v,i,{__proto__:null,enumerable:!0,get(){return C.finished}}),R.Stream=R,R._isUint8Array=function(D){return D instanceof Uint8Array},R._uint8ArrayToBuffer=function(D){return n.from(D.buffer,D.byteOffset,D.byteLength)},q8.exports}(function(n){const e=gz(),t=mz(),r=e.Readable.destroy;n.exports=e.Readable,n.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,n.exports._isUint8Array=e._isUint8Array,n.exports.isDisturbed=e.isDisturbed,n.exports.isErrored=e.isErrored,n.exports.isReadable=e.isReadable,n.exports.Readable=e.Readable,n.exports.Writable=e.Writable,n.exports.Duplex=e.Duplex,n.exports.Transform=e.Transform,n.exports.PassThrough=e.PassThrough,n.exports.addAbortSignal=e.addAbortSignal,n.exports.finished=e.finished,n.exports.destroy=e.destroy,n.exports.destroy=r,n.exports.pipeline=e.pipeline,n.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),n.exports.Stream=e.Stream,n.exports.default=n.exports})(vB);var cue=vB.exports;typeof globalThis.Buffer>"u"&&(globalThis.Buffer=u1().Buffer);const $y=uF,KP=cue,fue=Rs;globalThis.process||(globalThis.process=sp());if(typeof crypto>"u"){const n=l1;n.getRandomValues=e=>n.randomBytes(e.length),globalThis.crypto=n}const yi={ElvCrypto:async()=>{try{if(!yi.elvCrypto){const n=(await Promise.resolve().then(()=>require("./index-IJ7cIHhe.js"))).default;yi.elvCrypto=await new n().init()}return yi.elvCrypto}catch(n){console.error("Error initializing ElvCrypto:"),console.error(n)}},EncryptedSize:n=>{const t=Math.floor(n/1e6);let r=yi.EncryptedBlockSize(1e6),i=t*r;return n%1e6!==0&&(i+=yi.EncryptedBlockSize(n%1e6)),i},EncryptedBlockSize:(n,e=!1)=>{let c=Math.floor(n/564)*576;return n%564!==0&&(c+=576),e?c+608:c+129},async EncryptConk(n,e){const t=await yi.ElvCrypto();e=new Uint8Array(Buffer.from(e.replace("0x",""),"hex")),n=new Uint8Array(Buffer.from(JSON.stringify(n)));const{data:r,ephemeralKey:i,tag:o}=await t.encryptECIES(n,e),u=Buffer.concat([Buffer.from(i),Buffer.from(o),Buffer.from(r)]);return fue.B64(u)},async DecryptCap(n,e){const t=await yi.ElvCrypto();e=new Uint8Array(Buffer.from(e.replace("0x",""),"hex")),n=Buffer.from(n,"base64");const r=n.slice(0,65),i=n.slice(65,81),o=n.slice(81),u=t.decryptECIES(new Uint8Array(o),e,new Uint8Array(r),new Uint8Array(i));return JSON.parse(Buffer.from(u).toString())},async GeneratePrimaryConk({spaceId:n,objectId:e}){const t=await yi.ElvCrypto(),{secretKey:r,publicKey:i}=t.generatePrimaryKeys(),o=t.generateSymmetricKey().key;return{symm_key:`kpsy${$y.encode(Buffer.from(o))}`,secret_key:`kpsk${$y.encode(Buffer.from(r))}`,public_key:`kppk${$y.encode(Buffer.from(i))}`,sid:n,qid:e}},async GenerateTargetConk(){const n=await yi.ElvCrypto(),{secretKey:e,publicKey:t}=n.generateTargetKeys();return{secret_key:`kpsk${$y.encode(Buffer.from(e))}`,public_key:`ktpk${$y.encode(Buffer.from(t))}`}},CapToConk(n){const e=t=>new Uint8Array($y.decode(t.slice(4)));return{symmetricKey:e(n.symm_key),secretKey:e(n.secret_key),publicKey:e(n.public_key)}},async EncryptionContext(n){const e=await yi.ElvCrypto(),{symmetricKey:t,secretKey:r,publicKey:i}=yi.CapToConk(n);let o,u;return i.length===e.PRIMARY_PK_KEY_SIZE?(u=e.CRYPTO_TYPE_PRIMARY,o=e.newPrimaryContext(i,r,t)):(u=e.CRYPTO_TYPE_TARGET,o=e.newTargetDecryptionContext(r,t)),{context:o,type:u}},Encrypt:async(n,e)=>{const t=await yi.OpenEncryptionStream(n);!Buffer.isBuffer(e)&&!(e instanceof ArrayBuffer)&&(e=Buffer.from(await new Response(e).arrayBuffer()));const r=new Uint8Array(e);for(let o=0;o<r.length;o+=1e6){const u=Math.min(r.length,o+1e6);t.write(r.slice(o,u))}t.end();let i=[];return await new Promise((o,u)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{u(c)})}),Buffer.concat(i)},OpenEncryptionStream:async n=>{const e=await yi.ElvCrypto(),{context:t}=await yi.EncryptionContext(n),r=new KP.PassThrough,i=e.createCipher(t);return r.pipe(i).on("finish",()=>{t.free()}).on("error",o=>{throw Error(o)})},Decrypt:async(n,e)=>{const t=await yi.OpenDecryptionStream(n),r=new Uint8Array(e);for(let o=0;o<r.length;o+=1e6){const u=Math.min(r.length,o+1e6);t.write(r.slice(o,u))}t.end();let i=[];return await new Promise((o,u)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{u(c)})}),Buffer.concat(i)},OpenDecryptionStream:async n=>{const e=await yi.ElvCrypto(),{context:t,type:r}=await yi.EncryptionContext(n),i=new KP.PassThrough,o=e.createDecipher(r,t);return i.pipe(o).on("finish",()=>{t.free()}).on("error",u=>{throw Error(u)})}};var bz=yi,ra={},YP;function vz(){if(YP)return ra;YP=1;const n=Rs;let e;n.Platform()===n.PLATFORM_NODE&&(globalThis.Response=hM().Response,e=l1);const t=Ro,{ValidatePresence:r,ValidateWriteToken:i,ValidatePartHash:o,ValidateParameters:u}=yc;return ra.ListFiles=async function({libraryId:c,objectId:p,versionHash:h}){u({libraryId:c,objectId:p,versionHash:h}),h&&(p=this.utils.DecodeVersionHash(h).objectId);let g=t("q",h||p,"meta","files");return this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h}),method:"GET",path:g}))},ra.UploadFilesFromS3=async function({libraryId:c,objectId:p,writeToken:h,region:g,bucket:m,fileInfo:w,accessKey:v,secret:C,signedUrl:T,encryption:R="none",copy:O=!1,callback:I}){u({libraryId:c,objectId:p}),i(h);const D=/^s3:\/\/([^/]+)\//i;for(let Se=0;Se<w.length;Se++){const _e=w[Se].source,ae=D.exec(_e);if(ae){if(ae[1]!==m)throw Error('Full S3 file path "'+_e+`" specified, but does not match provided bucket name '`+m+"'");w[Se].source=_e.replace(D,"")}}this.Log(`Uploading files from S3: ${c} ${p} ${h}`);let K;if(R==="cgck"){let Se=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});Se={...Se,secret_key:""},K=`kp__${this.utils.B58(Buffer.from(JSON.stringify(Se)))}`}let W={access_key_id:v,secret_access_key:C};T&&(W={signed_url:T});const pe={encryption_key:K,access:{protocol:"s3",platform:"aws",path:m,storage_endpoint:{region:g},cloud_credentials:W}},ce=w.map(Se=>O?{op:"ingest-copy",path:Se.path,encryption:{scheme:R==="cgck"?"cgck":"none"},ingest:{type:"key",path:Se.source}}:{op:"add-reference",path:Se.path,reference:{type:"key",path:Se.source}}),{id:ge}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:ce,defaults:pe});for(;;){await new Promise(ae=>setTimeout(ae,1e3));const Se=await this.UploadStatus({libraryId:c,objectId:p,writeToken:h,uploadId:ge});if(Se.errors&&Se.errors.length>1)throw Se.errors.join(`
319
+ `;super(C),this.name="AggregateError",this.errors=v}}n.exports={AggregateError:m,kEmptyObject:Object.freeze({}),once(w){let v=!1;return function(...C){v||(v=!0,w.apply(this,C))}},createDeferredPromise:function(){let w,v;return{promise:new Promise((T,R)=>{w=T,v=R}),resolve:w,reject:v}},promisify(w){return new Promise((v,C)=>{w((T,...R)=>T?C(T):v(...R))})},debuglog(){return function(){}},format(w,...v){return w.replace(/%([sdifj])/g,function(...[C,T]){const R=v.shift();return T==="f"?R.toFixed(6):T==="j"?JSON.stringify(R):T==="s"&&typeof R=="object"?`${R.constructor!==Object?R.constructor.name:""} {}`.trim():R.toString()})},inspect(w){switch(typeof w){case"string":if(w.includes("'"))if(w.includes('"')){if(!w.includes("`")&&!w.includes("${"))return`\`${w}\``}else return`"${w}"`;return`'${w}'`;case"number":return isNaN(w)?"NaN":Object.is(w,-0)?String(w):w;case"bigint":return`${String(w)}n`;case"boolean":case"undefined":return String(w);case"object":return"{}"}},types:{isAsyncFunction(w){return w instanceof u},isArrayBufferView(w){return ArrayBuffer.isView(w)}},isBlob:p,deprecate(w,v){return w},addAbortListener:S1.addAbortListener||function(v,C){if(v===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",v);h(v,"signal"),g(C,"listener");let T;return v.aborted?queueMicrotask(()=>C()):(v.addEventListener("abort",C,{__proto__:null,once:!0,[t]:!0}),T=()=>{v.removeEventListener("abort",C)}),{__proto__:null,[r](){var R;(R=T)===null||R===void 0||R()}}},AbortSignalAny:i.any||function(v){if(v.length===1)return v[0];const C=new o,T=()=>C.abort();return v.forEach(R=>{h(R,"signals"),R.addEventListener("abort",T,{once:!0})}),C.signal.addEventListener("abort",()=>{v.forEach(R=>R.removeEventListener("abort",T))},{once:!0}),C.signal}},n.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(wB);var Os=wB.exports,kM={};const{format:qae,inspect:R2,AggregateError:Vae}=Os,Gae=globalThis.AggregateError||Vae,Wae=Symbol("kIsNodeError"),Kae=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Yae=/^([A-Z][a-z0-9]*)+$/,Jae="__node_internal_",yS={};function Sh(n,e){if(!n)throw new yS.ERR_INTERNAL_ASSERTION(e)}function iP(n){let e="",t=n.length;const r=n[0]==="-"?1:0;for(;t>=r+4;t-=3)e=`_${n.slice(t-3,t)}${e}`;return`${n.slice(0,t)}${e}`}function Qae(n,e,t){if(typeof e=="function")return Sh(e.length<=t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${e.length}).`),e(...t);const r=(e.match(/%[dfijoOs]/g)||[]).length;return Sh(r===t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${r}).`),t.length===0?e:qae(e,...t)}function Bi(n,e,t){t||(t=Error);class r extends t{constructor(...o){super(Qae(n,e,o))}toString(){return`${this.name} [${n}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:t.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${n}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=n,r.prototype[Wae]=!0,yS[n]=r}function sP(n){const e=Jae+n.name;return Object.defineProperty(n,"name",{value:e}),n}function Zae(n,e){if(n&&e&&n!==e){if(Array.isArray(e.errors))return e.errors.push(n),e;const t=new Gae([e,n],e.message);return t.code=e.code,t}return n||e}let Xae=class extends Error{constructor(e="The operation was aborted",t=void 0){if(t!==void 0&&typeof t!="object")throw new yS.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Bi("ERR_ASSERTION","%s",Error);Bi("ERR_INVALID_ARG_TYPE",(n,e,t)=>{Sh(typeof n=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let r="The ";n.endsWith(" argument")?r+=`${n} `:r+=`"${n}" ${n.includes(".")?"property":"argument"} `,r+="must be ";const i=[],o=[],u=[];for(const p of e)Sh(typeof p=="string","All expected entries have to be of type string"),Kae.includes(p)?i.push(p.toLowerCase()):Yae.test(p)?o.push(p):(Sh(p!=="object",'The value "object" should be written as "Object"'),u.push(p));if(o.length>0){const p=i.indexOf("object");p!==-1&&(i.splice(i,p,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:r+=`of type ${i[0]}`;break;case 2:r+=`one of type ${i[0]} or ${i[1]}`;break;default:{const p=i.pop();r+=`one of type ${i.join(", ")}, or ${p}`}}(o.length>0||u.length>0)&&(r+=" or ")}if(o.length>0){switch(o.length){case 1:r+=`an instance of ${o[0]}`;break;case 2:r+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const p=o.pop();r+=`an instance of ${o.join(", ")}, or ${p}`}}u.length>0&&(r+=" or ")}switch(u.length){case 0:break;case 1:u[0].toLowerCase()!==u[0]&&(r+="an "),r+=`${u[0]}`;break;case 2:r+=`one of ${u[0]} or ${u[1]}`;break;default:{const p=u.pop();r+=`one of ${u.join(", ")}, or ${p}`}}if(t==null)r+=`. Received ${t}`;else if(typeof t=="function"&&t.name)r+=`. Received function ${t.name}`;else if(typeof t=="object"){var c;if((c=t.constructor)!==null&&c!==void 0&&c.name)r+=`. Received an instance of ${t.constructor.name}`;else{const p=R2(t,{depth:-1});r+=`. Received ${p}`}}else{let p=R2(t,{colors:!1});p.length>25&&(p=`${p.slice(0,25)}...`),r+=`. Received type ${typeof t} (${p})`}return r},TypeError);Bi("ERR_INVALID_ARG_VALUE",(n,e,t="is invalid")=>{let r=R2(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${n.includes(".")?"property":"argument"} '${n}' ${t}. Received ${r}`},TypeError);Bi("ERR_INVALID_RETURN_VALUE",(n,e,t)=>{var r;const i=t!=null&&(r=t.constructor)!==null&&r!==void 0&&r.name?`instance of ${t.constructor.name}`:`type ${typeof t}`;return`Expected ${n} to be returned from the "${e}" function but got ${i}.`},TypeError);Bi("ERR_MISSING_ARGS",(...n)=>{Sh(n.length>0,"At least one arg needs to be specified");let e;const t=n.length;switch(n=(Array.isArray(n)?n:[n]).map(r=>`"${r}"`).join(" or "),t){case 1:e+=`The ${n[0]} argument`;break;case 2:e+=`The ${n[0]} and ${n[1]} arguments`;break;default:{const r=n.pop();e+=`The ${n.join(", ")}, and ${r} arguments`}break}return`${e} must be specified`},TypeError);Bi("ERR_OUT_OF_RANGE",(n,e,t)=>{Sh(e,'Missing "range" argument');let r;return Number.isInteger(t)&&Math.abs(t)>2**32?r=iP(String(t)):typeof t=="bigint"?(r=String(t),(t>2n**32n||t<-(2n**32n))&&(r=iP(r)),r+="n"):r=R2(t),`The value of "${n}" is out of range. It must be ${e}. Received ${r}`},RangeError);Bi("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Bi("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Bi("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Bi("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Bi("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Bi("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Bi("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Bi("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Bi("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Bi("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Bi("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var oo={AbortError:Xae,aggregateTwoErrors:sP(Zae),hideStackFrames:sP,codes:yS};const{ArrayIsArray:TM,ArrayPrototypeIncludes:TB,ArrayPrototypeJoin:RB,ArrayPrototypeMap:eie,NumberIsInteger:RM,NumberIsNaN:tie,NumberMAX_SAFE_INTEGER:nie,NumberMIN_SAFE_INTEGER:rie,NumberParseInt:aie,ObjectPrototypeHasOwnProperty:iie,RegExpPrototypeExec:OB,String:sie,StringPrototypeToUpperCase:oie,StringPrototypeTrim:uie}=wa,{hideStackFrames:iu,codes:{ERR_SOCKET_BAD_PORT:lie,ERR_INVALID_ARG_TYPE:ds,ERR_INVALID_ARG_VALUE:zm,ERR_OUT_OF_RANGE:Lh,ERR_UNKNOWN_SIGNAL:oP}}=oo,{normalizeEncoding:cie}=Os,{isAsyncFunction:fie,isArrayBufferView:die}=Os.types,uP={};function pie(n){return n===(n|0)}function hie(n){return n===n>>>0}const yie=/^[0-7]+$/,mie="must be a 32-bit unsigned integer or an octal string";function gie(n,e,t){if(typeof n>"u"&&(n=t),typeof n=="string"){if(OB(yie,n)===null)throw new zm(e,n,mie);n=aie(n,8)}return LB(n,e),n}const bie=iu((n,e,t=rie,r=nie)=>{if(typeof n!="number")throw new ds(e,"number",n);if(!RM(n))throw new Lh(e,"an integer",n);if(n<t||n>r)throw new Lh(e,`>= ${t} && <= ${r}`,n)}),vie=iu((n,e,t=-2147483648,r=2147483647)=>{if(typeof n!="number")throw new ds(e,"number",n);if(!RM(n))throw new Lh(e,"an integer",n);if(n<t||n>r)throw new Lh(e,`>= ${t} && <= ${r}`,n)}),LB=iu((n,e,t=!1)=>{if(typeof n!="number")throw new ds(e,"number",n);if(!RM(n))throw new Lh(e,"an integer",n);const r=t?1:0,i=4294967295;if(n<r||n>i)throw new Lh(e,`>= ${r} && <= ${i}`,n)});function OM(n,e){if(typeof n!="string")throw new ds(e,"string",n)}function wie(n,e,t=void 0,r){if(typeof n!="number")throw new ds(e,"number",n);if(t!=null&&n<t||r!=null&&n>r||(t!=null||r!=null)&&tie(n))throw new Lh(e,`${t!=null?`>= ${t}`:""}${t!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,n)}const xie=iu((n,e,t)=>{if(!TB(t,n)){const i="must be one of: "+RB(eie(t,o=>typeof o=="string"?`'${o}'`:sie(o)),", ");throw new zm(e,n,i)}});function NB(n,e){if(typeof n!="boolean")throw new ds(e,"boolean",n)}function V8(n,e,t){return n==null||!iie(n,e)?t:n[e]}const _ie=iu((n,e,t=null)=>{const r=V8(t,"allowArray",!1),i=V8(t,"allowFunction",!1);if(!V8(t,"nullable",!1)&&n===null||!r&&TM(n)||typeof n!="object"&&(!i||typeof n!="function"))throw new ds(e,"Object",n)}),Sie=iu((n,e)=>{if(n!=null&&typeof n!="object"&&typeof n!="function")throw new ds(e,"a dictionary",n)}),mS=iu((n,e,t=0)=>{if(!TM(n))throw new ds(e,"Array",n);if(n.length<t){const r=`must be longer than ${t}`;throw new zm(e,n,r)}});function Eie(n,e){mS(n,e);for(let t=0;t<n.length;t++)OM(n[t],`${e}[${t}]`)}function Cie(n,e){mS(n,e);for(let t=0;t<n.length;t++)NB(n[t],`${e}[${t}]`)}function Aie(n,e){mS(n,e);for(let t=0;t<n.length;t++){const r=n[t],i=`${e}[${t}]`;if(r==null)throw new ds(i,"AbortSignal",r);PB(r,i)}}function Mie(n,e="signal"){if(OM(n,e),uP[n]===void 0)throw uP[oie(n)]!==void 0?new oP(n+" (signals must use all capital letters)"):new oP(n)}const kie=iu((n,e="buffer")=>{if(!die(n))throw new ds(e,["Buffer","TypedArray","DataView"],n)});function Tie(n,e){const t=cie(e),r=n.length;if(t==="hex"&&r%2!==0)throw new zm("encoding",e,`is invalid for data of length ${r}`)}function Rie(n,e="Port",t=!0){if(typeof n!="number"&&typeof n!="string"||typeof n=="string"&&uie(n).length===0||+n!==+n>>>0||n>65535||n===0&&!t)throw new lie(e,n,t);return n|0}const PB=iu((n,e)=>{if(n!==void 0&&(n===null||typeof n!="object"||!("aborted"in n)))throw new ds(e,"AbortSignal",n)}),Oie=iu((n,e)=>{if(typeof n!="function")throw new ds(e,"Function",n)}),Lie=iu((n,e)=>{if(typeof n!="function"||fie(n))throw new ds(e,"Function",n)}),Nie=iu((n,e)=>{if(n!==void 0)throw new ds(e,"undefined",n)});function Pie(n,e,t){if(!TB(t,n))throw new ds(e,`('${RB(t,"|")}')`,n)}const Iie=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function lP(n,e){if(typeof n>"u"||!OB(Iie,n))throw new zm(e,n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Die(n){if(typeof n=="string")return lP(n,"hints"),n;if(TM(n)){const e=n.length;let t="";if(e===0)return t;for(let r=0;r<e;r++){const i=n[r];lP(i,"hints"),t+=i,r!==e-1&&(t+=", ")}return t}throw new zm("hints",n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}var E1={isInt32:pie,isUint32:hie,parseFileMode:gie,validateArray:mS,validateStringArray:Eie,validateBooleanArray:Cie,validateAbortSignalArray:Aie,validateBoolean:NB,validateBuffer:kie,validateDictionary:Sie,validateEncoding:Tie,validateFunction:Oie,validateInt32:vie,validateInteger:bie,validateNumber:wie,validateObject:_ie,validateOneOf:xie,validatePlainFunction:Lie,validatePort:Rie,validateSignalName:Mie,validateString:OM,validateUint32:LB,validateUndefined:Nie,validateUnion:Pie,validateAbortSignal:PB,validateLinkHeaderValue:Die},LM={exports:{}},G8={exports:{}},cP;function sp(){if(cP)return G8.exports;cP=1;var n=G8.exports={},e,t;function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function o(T){if(e===setTimeout)return setTimeout(T,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(T,0);try{return e(T,0)}catch{try{return e.call(null,T,0)}catch{return e.call(this,T,0)}}}function u(T){if(t===clearTimeout)return clearTimeout(T);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(T);try{return t(T)}catch{try{return t.call(null,T)}catch{return t.call(this,T)}}}var c=[],p=!1,h,g=-1;function m(){!p||!h||(p=!1,h.length?c=h.concat(c):g=-1,c.length&&w())}function w(){if(!p){var T=o(m);p=!0;for(var R=c.length;R;){for(h=c,c=[];++g<R;)h&&h[g].run();g=-1,R=c.length}h=null,p=!1,u(T)}}n.nextTick=function(T){var R=new Array(arguments.length-1);if(arguments.length>1)for(var O=1;O<arguments.length;O++)R[O-1]=arguments[O];c.push(new v(T,R)),c.length===1&&!p&&o(w)};function v(T,R){this.fun=T,this.array=R}v.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={};function C(){}return n.on=C,n.addListener=C,n.once=C,n.off=C,n.removeListener=C,n.removeAllListeners=C,n.emit=C,n.prependListener=C,n.prependOnceListener=C,n.listeners=function(T){return[]},n.binding=function(T){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(T){throw new Error("process.chdir is not supported")},n.umask=function(){return 0},G8.exports}const{SymbolAsyncIterator:fP,SymbolIterator:dP,SymbolFor:Gh}=wa,IB=Gh("nodejs.stream.destroyed"),DB=Gh("nodejs.stream.errored"),c4=Gh("nodejs.stream.readable"),f4=Gh("nodejs.stream.writable"),UB=Gh("nodejs.stream.disturbed"),Uie=Gh("nodejs.webstream.isClosedPromise"),Fie=Gh("nodejs.webstream.controllerErrorFunction");function gS(n,e=!1){var t;return!!(n&&typeof n.pipe=="function"&&typeof n.on=="function"&&(!e||typeof n.pause=="function"&&typeof n.resume=="function")&&(!n._writableState||((t=n._readableState)===null||t===void 0?void 0:t.readable)!==!1)&&(!n._writableState||n._readableState))}function bS(n){var e;return!!(n&&typeof n.write=="function"&&typeof n.on=="function"&&(!n._readableState||((e=n._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Bie(n){return!!(n&&typeof n.pipe=="function"&&n._readableState&&typeof n.on=="function"&&typeof n.write=="function")}function mc(n){return n&&(n._readableState||n._writableState||typeof n.write=="function"&&typeof n.on=="function"||typeof n.pipe=="function"&&typeof n.on=="function")}function FB(n){return!!(n&&!mc(n)&&typeof n.pipeThrough=="function"&&typeof n.getReader=="function"&&typeof n.cancel=="function")}function BB(n){return!!(n&&!mc(n)&&typeof n.getWriter=="function"&&typeof n.abort=="function")}function zB(n){return!!(n&&!mc(n)&&typeof n.readable=="object"&&typeof n.writable=="object")}function zie(n){return FB(n)||BB(n)||zB(n)}function jie(n,e){return n==null?!1:e===!0?typeof n[fP]=="function":e===!1?typeof n[dP]=="function":typeof n[fP]=="function"||typeof n[dP]=="function"}function vS(n){if(!mc(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!!(n.destroyed||n[IB]||r!=null&&r.destroyed)}function jB(n){if(!bS(n))return null;if(n.writableEnded===!0)return!0;const e=n._writableState;return e!=null&&e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function $ie(n,e){if(!bS(n))return null;if(n.writableFinished===!0)return!0;const t=n._writableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.finished)!="boolean"?null:!!(t.finished||e===!1&&t.ended===!0&&t.length===0)}function Hie(n){if(!gS(n))return null;if(n.readableEnded===!0)return!0;const e=n._readableState;return!e||e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function $B(n,e){if(!gS(n))return null;const t=n._readableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.endEmitted)!="boolean"?null:!!(t.endEmitted||e===!1&&t.ended===!0&&t.length===0)}function HB(n){return n&&n[c4]!=null?n[c4]:typeof(n==null?void 0:n.readable)!="boolean"?null:vS(n)?!1:gS(n)&&n.readable&&!$B(n)}function qB(n){return n&&n[f4]!=null?n[f4]:typeof(n==null?void 0:n.writable)!="boolean"?null:vS(n)?!1:bS(n)&&n.writable&&!jB(n)}function qie(n,e){return mc(n)?vS(n)?!0:!((e==null?void 0:e.readable)!==!1&&HB(n)||(e==null?void 0:e.writable)!==!1&&qB(n)):null}function Vie(n){var e,t;return mc(n)?n.writableErrored?n.writableErrored:(e=(t=n._writableState)===null||t===void 0?void 0:t.errored)!==null&&e!==void 0?e:null:null}function Gie(n){var e,t;return mc(n)?n.readableErrored?n.readableErrored:(e=(t=n._readableState)===null||t===void 0?void 0:t.errored)!==null&&e!==void 0?e:null:null}function Wie(n){if(!mc(n))return null;if(typeof n.closed=="boolean")return n.closed;const e=n._writableState,t=n._readableState;return typeof(e==null?void 0:e.closed)=="boolean"||typeof(t==null?void 0:t.closed)=="boolean"?(e==null?void 0:e.closed)||(t==null?void 0:t.closed):typeof n._closed=="boolean"&&VB(n)?n._closed:null}function VB(n){return typeof n._closed=="boolean"&&typeof n._defaultKeepAlive=="boolean"&&typeof n._removedConnection=="boolean"&&typeof n._removedContLen=="boolean"}function GB(n){return typeof n._sent100=="boolean"&&VB(n)}function Kie(n){var e;return typeof n._consuming=="boolean"&&typeof n._dumped=="boolean"&&((e=n.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function Yie(n){if(!mc(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!r&&GB(n)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function Jie(n){var e;return!!(n&&((e=n[UB])!==null&&e!==void 0?e:n.readableDidRead||n.readableAborted))}function Qie(n){var e,t,r,i,o,u,c,p,h,g;return!!(n&&((e=(t=(r=(i=(o=(u=n[DB])!==null&&u!==void 0?u:n.readableErrored)!==null&&o!==void 0?o:n.writableErrored)!==null&&i!==void 0?i:(c=n._readableState)===null||c===void 0?void 0:c.errorEmitted)!==null&&r!==void 0?r:(p=n._writableState)===null||p===void 0?void 0:p.errorEmitted)!==null&&t!==void 0?t:(h=n._readableState)===null||h===void 0?void 0:h.errored)!==null&&e!==void 0?e:!((g=n._writableState)===null||g===void 0)&&g.errored))}var Af={isDestroyed:vS,kIsDestroyed:IB,isDisturbed:Jie,kIsDisturbed:UB,isErrored:Qie,kIsErrored:DB,isReadable:HB,kIsReadable:c4,kIsClosedPromise:Uie,kControllerErrorFunction:Fie,kIsWritable:f4,isClosed:Wie,isDuplexNodeStream:Bie,isFinished:qie,isIterable:jie,isReadableNodeStream:gS,isReadableStream:FB,isReadableEnded:Hie,isReadableFinished:$B,isReadableErrored:Gie,isNodeStream:mc,isWebStream:zie,isWritable:qB,isWritableNodeStream:bS,isWritableStream:BB,isWritableEnded:jB,isWritableFinished:$ie,isWritableErrored:Vie,isServerRequest:Kie,isServerResponse:GB,willEmitClose:Yie,isTransformStream:zB};const Fd=sp(),{AbortError:WB,codes:Zie}=oo,{ERR_INVALID_ARG_TYPE:Xie,ERR_STREAM_PREMATURE_CLOSE:pP}=Zie,{kEmptyObject:d4,once:p4}=Os,{validateAbortSignal:ese,validateFunction:tse,validateObject:nse,validateBoolean:rse}=E1,{Promise:ase,PromisePrototypeThen:ise,SymbolDispose:KB}=wa,{isClosed:sse,isReadable:hP,isReadableNodeStream:W8,isReadableStream:ose,isReadableFinished:yP,isReadableErrored:mP,isWritable:gP,isWritableNodeStream:bP,isWritableStream:use,isWritableFinished:vP,isWritableErrored:wP,isNodeStream:lse,willEmitClose:cse,kIsClosedPromise:fse}=Af;let fm;function dse(n){return n.setHeader&&typeof n.abort=="function"}const h4=()=>{};function YB(n,e,t){var r,i;if(arguments.length===2?(t=e,e=d4):e==null?e=d4:nse(e,"options"),tse(t,"callback"),ese(e.signal,"options.signal"),t=p4(t),ose(n)||use(n))return pse(n,e,t);if(!lse(n))throw new Xie("stream",["ReadableStream","WritableStream","Stream"],n);const o=(r=e.readable)!==null&&r!==void 0?r:W8(n),u=(i=e.writable)!==null&&i!==void 0?i:bP(n),c=n._writableState,p=n._readableState,h=()=>{n.writable||w()};let g=cse(n)&&W8(n)===o&&bP(n)===u,m=vP(n,!1);const w=()=>{m=!0,n.destroyed&&(g=!1),!(g&&(!n.readable||o))&&(!o||v)&&t.call(n)};let v=yP(n,!1);const C=()=>{v=!0,n.destroyed&&(g=!1),!(g&&(!n.writable||u))&&(!u||m)&&t.call(n)},T=W=>{t.call(n,W)};let R=sse(n);const O=()=>{R=!0;const W=wP(n)||mP(n);if(W&&typeof W!="boolean")return t.call(n,W);if(o&&!v&&W8(n,!0)&&!yP(n,!1))return t.call(n,new pP);if(u&&!m&&!vP(n,!1))return t.call(n,new pP);t.call(n)},I=()=>{R=!0;const W=wP(n)||mP(n);if(W&&typeof W!="boolean")return t.call(n,W);t.call(n)},D=()=>{n.req.on("finish",w)};dse(n)?(n.on("complete",w),g||n.on("abort",O),n.req?D():n.on("request",D)):u&&!c&&(n.on("end",h),n.on("close",h)),!g&&typeof n.aborted=="boolean"&&n.on("aborted",O),n.on("end",C),n.on("finish",w),e.error!==!1&&n.on("error",T),n.on("close",O),R?Fd.nextTick(O):c!=null&&c.errorEmitted||p!=null&&p.errorEmitted?g||Fd.nextTick(I):(!o&&(!g||hP(n))&&(m||gP(n)===!1)||!u&&(!g||gP(n))&&(v||hP(n)===!1)||p&&n.req&&n.aborted)&&Fd.nextTick(I);const K=()=>{t=h4,n.removeListener("aborted",O),n.removeListener("complete",w),n.removeListener("abort",O),n.removeListener("request",D),n.req&&n.req.removeListener("finish",w),n.removeListener("end",h),n.removeListener("close",h),n.removeListener("finish",w),n.removeListener("end",C),n.removeListener("error",T),n.removeListener("close",O)};if(e.signal&&!R){const W=()=>{const pe=t;K(),pe.call(n,new WB(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Fd.nextTick(W);else{fm=fm||Os.addAbortListener;const pe=fm(e.signal,W),ce=t;t=p4((...ge)=>{pe[KB](),ce.apply(n,ge)})}}return K}function pse(n,e,t){let r=!1,i=h4;if(e.signal)if(i=()=>{r=!0,t.call(n,new WB(void 0,{cause:e.signal.reason}))},e.signal.aborted)Fd.nextTick(i);else{fm=fm||Os.addAbortListener;const u=fm(e.signal,i),c=t;t=p4((...p)=>{u[KB](),c.apply(n,p)})}const o=(...u)=>{r||Fd.nextTick(()=>t.apply(n,u))};return ise(n[fse].promise,o,o),h4}function hse(n,e){var t;let r=!1;return e===null&&(e=d4),(t=e)!==null&&t!==void 0&&t.cleanup&&(rse(e.cleanup,"cleanup"),r=e.cleanup),new ase((i,o)=>{const u=YB(n,e,c=>{r&&u(),c?o(c):i()})})}LM.exports=YB;LM.exports.finished=hse;var op=LM.exports;const ic=sp(),{aggregateTwoErrors:yse,codes:{ERR_MULTIPLE_CALLBACK:mse},AbortError:gse}=oo,{Symbol:JB}=wa,{kIsDestroyed:bse,isDestroyed:vse,isFinished:wse,isServerRequest:xse}=Af,QB=JB("kDestroy"),y4=JB("kConstruct");function ZB(n,e,t){n&&(n.stack,e&&!e.errored&&(e.errored=n),t&&!t.errored&&(t.errored=n))}function _se(n,e){const t=this._readableState,r=this._writableState,i=r||t;return r!=null&&r.destroyed||t!=null&&t.destroyed?(typeof e=="function"&&e(),this):(ZB(n,r,t),r&&(r.destroyed=!0),t&&(t.destroyed=!0),i.constructed?xP(this,n,e):this.once(QB,function(o){xP(this,yse(o,n),e)}),this)}function xP(n,e,t){let r=!1;function i(o){if(r)return;r=!0;const u=n._readableState,c=n._writableState;ZB(o,c,u),c&&(c.closed=!0),u&&(u.closed=!0),typeof t=="function"&&t(o),o?ic.nextTick(Sse,n,o):ic.nextTick(XB,n)}try{n._destroy(e||null,i)}catch(o){i(o)}}function Sse(n,e){m4(n,e),XB(n)}function XB(n){const e=n._readableState,t=n._writableState;t&&(t.closeEmitted=!0),e&&(e.closeEmitted=!0),(t!=null&&t.emitClose||e!=null&&e.emitClose)&&n.emit("close")}function m4(n,e){const t=n._readableState,r=n._writableState;r!=null&&r.errorEmitted||t!=null&&t.errorEmitted||(r&&(r.errorEmitted=!0),t&&(t.errorEmitted=!0),n.emit("error",e))}function Ese(){const n=this._readableState,e=this._writableState;n&&(n.constructed=!0,n.closed=!1,n.closeEmitted=!1,n.destroyed=!1,n.errored=null,n.errorEmitted=!1,n.reading=!1,n.ended=n.readable===!1,n.endEmitted=n.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function g4(n,e,t){const r=n._readableState,i=n._writableState;if(i!=null&&i.destroyed||r!=null&&r.destroyed)return this;r!=null&&r.autoDestroy||i!=null&&i.autoDestroy?n.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),r&&!r.errored&&(r.errored=e),t?ic.nextTick(m4,n,e):m4(n,e))}function Cse(n,e){if(typeof n._construct!="function")return;const t=n._readableState,r=n._writableState;t&&(t.constructed=!1),r&&(r.constructed=!1),n.once(y4,e),!(n.listenerCount(y4)>1)&&ic.nextTick(Ase,n)}function Ase(n){let e=!1;function t(r){if(e){g4(n,r??new mse);return}e=!0;const i=n._readableState,o=n._writableState,u=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),u.destroyed?n.emit(QB,r):r?g4(n,r,!0):ic.nextTick(Mse,n)}try{n._construct(r=>{ic.nextTick(t,r)})}catch(r){ic.nextTick(t,r)}}function Mse(n){n.emit(y4)}function _P(n){return(n==null?void 0:n.setHeader)&&typeof n.abort=="function"}function ez(n){n.emit("close")}function kse(n,e){n.emit("error",e),ic.nextTick(ez,n)}function Tse(n,e){!n||vse(n)||(!e&&!wse(n)&&(e=new gse),xse(n)?(n.socket=null,n.destroy(e)):_P(n)?n.abort():_P(n.req)?n.req.abort():typeof n.destroy=="function"?n.destroy(e):typeof n.close=="function"?n.close():e?ic.nextTick(kse,n,e):ic.nextTick(ez,n),n.destroyed||(n[bse]=!0))}var jm={construct:Cse,destroyer:Tse,destroy:_se,undestroy:Ese,errorOrDestroy:g4};const{ArrayIsArray:Rse,ObjectSetPrototypeOf:tz}=wa,{EventEmitter:wS}=S1;function xS(n){wS.call(this,n)}tz(xS.prototype,wS.prototype);tz(xS,wS);xS.prototype.pipe=function(n,e){const t=this;function r(g){n.writable&&n.write(g)===!1&&t.pause&&t.pause()}t.on("data",r);function i(){t.readable&&t.resume&&t.resume()}n.on("drain",i),!n._isStdio&&(!e||e.end!==!1)&&(t.on("end",u),t.on("close",c));let o=!1;function u(){o||(o=!0,n.end())}function c(){o||(o=!0,typeof n.destroy=="function"&&n.destroy())}function p(g){h(),wS.listenerCount(this,"error")===0&&this.emit("error",g)}b4(t,"error",p),b4(n,"error",p);function h(){t.removeListener("data",r),n.removeListener("drain",i),t.removeListener("end",u),t.removeListener("close",c),t.removeListener("error",p),n.removeListener("error",p),t.removeListener("end",h),t.removeListener("close",h),n.removeListener("close",h)}return t.on("end",h),t.on("close",h),n.on("close",h),n.emit("pipe",t),n};function b4(n,e,t){if(typeof n.prependListener=="function")return n.prependListener(e,t);!n._events||!n._events[e]?n.on(e,t):Rse(n._events[e])?n._events[e].unshift(t):n._events[e]=[t,n._events[e]]}var NM={Stream:xS,prependListener:b4},nz={exports:{}};(function(n){const{SymbolDispose:e}=wa,{AbortError:t,codes:r}=oo,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:u}=Af,c=op,{ERR_INVALID_ARG_TYPE:p}=r;let h;const g=(m,w)=>{if(typeof m!="object"||!("aborted"in m))throw new p(w,"AbortSignal",m)};n.exports.addAbortSignal=function(w,v){if(g(w,"signal"),!i(v)&&!o(v))throw new p("stream",["ReadableStream","WritableStream","Stream"],v);return n.exports.addAbortSignalNoValidate(w,v)},n.exports.addAbortSignalNoValidate=function(m,w){if(typeof m!="object"||!("aborted"in m))return w;const v=i(w)?()=>{w.destroy(new t(void 0,{cause:m.reason}))}:()=>{w[u](new t(void 0,{cause:m.reason}))};if(m.aborted)v();else{h=h||Os.addAbortListener;const C=h(m,v);c(w,C[e])}return w}})(nz);var _S=nz.exports;const{StringPrototypeSlice:SP,SymbolIterator:Ose,TypedArrayPrototypeSet:H_,Uint8Array:Lse}=wa,{Buffer:K8}=ip,{inspect:Nse}=Os;var Pse=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){const t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;const e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let t=this.head,r=""+t.data;for(;(t=t.next)!==null;)r+=e+t.data;return r}concat(e){if(this.length===0)return K8.alloc(0);const t=K8.allocUnsafe(e>>>0);let r=this.head,i=0;for(;r;)H_(t,r.data,i),i+=r.data.length,r=r.next;return t}consume(e,t){const r=this.head.data;if(e<r.length){const i=r.slice(0,e);return this.head.data=r.slice(e),i}return e===r.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Ose](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t="",r=this.head,i=0;do{const o=r.data;if(e>o.length)t+=o,e-=o.length;else{e===o.length?(t+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=SP(o,0,e),this.head=r,r.data=SP(o,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){const t=K8.allocUnsafe(e),r=e;let i=this.head,o=0;do{const u=i.data;if(e>u.length)H_(t,u,r-e),e-=u.length;else{e===u.length?(H_(t,u,r-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(H_(t,new Lse(u.buffer,u.byteOffset,e),r-e),this.head=i,i.data=u.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return Nse(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:Ise,NumberIsInteger:Dse}=wa,{validateInteger:Use}=E1,{ERR_INVALID_ARG_VALUE:Fse}=oo.codes;let rz=16*1024,az=16;function Bse(n,e,t){return n.highWaterMark!=null?n.highWaterMark:e?n[t]:null}function iz(n){return n?az:rz}function zse(n,e){Use(e,"value",0),n?az=e:rz=e}function jse(n,e,t,r){const i=Bse(e,r,t);if(i!=null){if(!Dse(i)||i<0){const o=r?`options.${t}`:"options.highWaterMark";throw new Fse(o,i)}return Ise(i)}return iz(n.objectMode)}var SS={getHighWaterMark:jse,getDefaultHighWaterMark:iz,setDefaultHighWaterMark:zse},PM={},IM=oF.Buffer,EP=IM.isEncoding||function(n){switch(n=""+n,n&&n.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function $se(n){if(!n)return"utf8";for(var e;;)switch(n){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return n;default:if(e)return;n=(""+n).toLowerCase(),e=!0}}function Hse(n){var e=$se(n);if(typeof e!="string"&&(IM.isEncoding===EP||!EP(n)))throw new Error("Unknown encoding: "+n);return e||n}PM.StringDecoder=C1;function C1(n){this.encoding=Hse(n);var e;switch(this.encoding){case"utf16le":this.text=Yse,this.end=Jse,e=4;break;case"utf8":this.fillLast=Gse,e=4;break;case"base64":this.text=Qse,this.end=Zse,e=3;break;default:this.write=Xse,this.end=eoe;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=IM.allocUnsafe(e)}C1.prototype.write=function(n){if(n.length===0)return"";var e,t;if(this.lastNeed){if(e=this.fillLast(n),e===void 0)return"";t=this.lastNeed,this.lastNeed=0}else t=0;return t<n.length?e?e+this.text(n,t):this.text(n,t):e||""};C1.prototype.end=Kse;C1.prototype.text=Wse;C1.prototype.fillLast=function(n){if(this.lastNeed<=n.length)return n.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);n.copy(this.lastChar,this.lastTotal-this.lastNeed,0,n.length),this.lastNeed-=n.length};function Y8(n){return n<=127?0:n>>5===6?2:n>>4===14?3:n>>3===30?4:n>>6===2?-1:-2}function qse(n,e,t){var r=e.length-1;if(r<t)return 0;var i=Y8(e[r]);return i>=0?(i>0&&(n.lastNeed=i-1),i):--r<t||i===-2?0:(i=Y8(e[r]),i>=0?(i>0&&(n.lastNeed=i-2),i):--r<t||i===-2?0:(i=Y8(e[r]),i>=0?(i>0&&(i===2?i=0:n.lastNeed=i-3),i):0))}function Vse(n,e,t){if((e[0]&192)!==128)return n.lastNeed=0,"�";if(n.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return n.lastNeed=1,"�";if(n.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return n.lastNeed=2,"�"}}function Gse(n){var e=this.lastTotal-this.lastNeed,t=Vse(this,n);if(t!==void 0)return t;if(this.lastNeed<=n.length)return n.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);n.copy(this.lastChar,e,0,n.length),this.lastNeed-=n.length}function Wse(n,e){var t=qse(this,n,e);if(!this.lastNeed)return n.toString("utf8",e);this.lastTotal=t;var r=n.length-(t-this.lastNeed);return n.copy(this.lastChar,0,r),n.toString("utf8",e,r)}function Kse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+"�":e}function Yse(n,e){if((n.length-e)%2===0){var t=n.toString("utf16le",e);if(t){var r=t.charCodeAt(t.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=n[n.length-2],this.lastChar[1]=n[n.length-1],t.slice(0,-1)}return t}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=n[n.length-1],n.toString("utf16le",e,n.length-1)}function Jse(n){var e=n&&n.length?this.write(n):"";if(this.lastNeed){var t=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,t)}return e}function Qse(n,e){var t=(n.length-e)%3;return t===0?n.toString("base64",e):(this.lastNeed=3-t,this.lastTotal=3,t===1?this.lastChar[0]=n[n.length-1]:(this.lastChar[0]=n[n.length-2],this.lastChar[1]=n[n.length-1]),n.toString("base64",e,n.length-t))}function Zse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Xse(n){return n.toString(this.encoding)}function eoe(n){return n&&n.length?this.write(n):""}const CP=sp(),{PromisePrototypeThen:toe,SymbolAsyncIterator:AP,SymbolIterator:MP}=wa,{Buffer:noe}=ip,{ERR_INVALID_ARG_TYPE:roe,ERR_STREAM_NULL_VALUES:aoe}=oo.codes;function ioe(n,e,t){let r;if(typeof e=="string"||e instanceof noe)return new n({objectMode:!0,...t,read(){this.push(e),this.push(null)}});let i;if(e&&e[AP])i=!0,r=e[AP]();else if(e&&e[MP])i=!1,r=e[MP]();else throw new roe("iterable",["Iterable"],e);const o=new n({objectMode:!0,highWaterMark:1,...t});let u=!1;o._read=function(){u||(u=!0,p())},o._destroy=function(h,g){toe(c(h),()=>CP.nextTick(g,h),m=>CP.nextTick(g,m||h))};async function c(h){const g=h!=null,m=typeof r.throw=="function";if(g&&m){const{value:w,done:v}=await r.throw(h);if(await w,v)return}if(typeof r.return=="function"){const{value:w}=await r.return();await w}}async function p(){for(;;){try{const{value:h,done:g}=i?await r.next():r.next();if(g)o.push(null);else{const m=h&&typeof h.then=="function"?await h:h;if(m===null)throw u=!1,new aoe;if(o.push(m))continue;u=!1}}catch(h){o.destroy(h)}break}}return o}var sz=ioe,J8,kP;function ES(){if(kP)return J8;kP=1;const n=sp(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:i,ObjectDefineProperties:o,ObjectKeys:u,ObjectSetPrototypeOf:c,Promise:p,SafeSet:h,SymbolAsyncDispose:g,SymbolAsyncIterator:m,Symbol:w}=wa;J8=Le,Le.ReadableState=Ce;const{EventEmitter:v}=S1,{Stream:C,prependListener:T}=NM,{Buffer:R}=ip,{addAbortSignal:O}=_S,I=op;let D=Os.debuglog("stream",be=>{D=be});const K=Pse,W=jm,{getHighWaterMark:pe,getDefaultHighWaterMark:ce}=SS,{aggregateTwoErrors:ge,codes:{ERR_INVALID_ARG_TYPE:Se,ERR_METHOD_NOT_IMPLEMENTED:_e,ERR_OUT_OF_RANGE:ae,ERR_STREAM_PUSH_AFTER_EOF:Te,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:S},AbortError:x}=oo,{validateObject:A}=E1,U=w("kPaused"),{StringDecoder:L}=PM,z=sz;c(Le.prototype,C.prototype),c(Le,C);const Y=()=>{},{errorOrDestroy:q}=W,P=1,M=2,Q=4,ie=8,H=16,we=32,Ne=64,ke=128,Ue=256,se=512,fe=1024,de=2048,le=4096,ne=8192,ye=16384,Z=32768,N=65536,B=1<<17,te=1<<18;function oe(be){return{enumerable:!1,get(){return(this.state&be)!==0},set(Ee){Ee?this.state|=be:this.state&=~be}}}o(Ce.prototype,{objectMode:oe(P),ended:oe(M),endEmitted:oe(Q),reading:oe(ie),constructed:oe(H),sync:oe(we),needReadable:oe(Ne),emittedReadable:oe(ke),readableListening:oe(Ue),resumeScheduled:oe(se),errorEmitted:oe(fe),emitClose:oe(de),autoDestroy:oe(le),destroyed:oe(ne),closed:oe(ye),closeEmitted:oe(Z),multiAwaitDrain:oe(N),readingMore:oe(B),dataEmitted:oe(te)});function Ce(be,Ee,pt){typeof pt!="boolean"&&(pt=Ee instanceof xf()),this.state=de|le|H|we,be&&be.objectMode&&(this.state|=P),pt&&be&&be.readableObjectMode&&(this.state|=P),this.highWaterMark=be?pe(this,be,"readableHighWaterMark",pt):ce(!1),this.buffer=new K,this.length=0,this.pipes=[],this.flowing=null,this[U]=null,be&&be.emitClose===!1&&(this.state&=~de),be&&be.autoDestroy===!1&&(this.state&=~le),this.errored=null,this.defaultEncoding=be&&be.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,be&&be.encoding&&(this.decoder=new L(be.encoding),this.encoding=be.encoding)}function Le(be){if(!(this instanceof Le))return new Le(be);const Ee=this instanceof xf();this._readableState=new Ce(be,this,Ee),be&&(typeof be.read=="function"&&(this._read=be.read),typeof be.destroy=="function"&&(this._destroy=be.destroy),typeof be.construct=="function"&&(this._construct=be.construct),be.signal&&!Ee&&O(be.signal,this)),C.call(this,be),W.construct(this,()=>{this._readableState.needReadable&&xe(this,this._readableState)})}Le.prototype.destroy=W.destroy,Le.prototype._undestroy=W.undestroy,Le.prototype._destroy=function(be,Ee){Ee(be)},Le.prototype[v.captureRejectionSymbol]=function(be){this.destroy(be)},Le.prototype[g]=function(){let be;return this.destroyed||(be=this.readableEnded?null:new x,this.destroy(be)),new p((Ee,pt)=>I(this,at=>at&&at!==be?pt(at):Ee(null)))},Le.prototype.push=function(be,Ee){return Xe(this,be,Ee,!1)},Le.prototype.unshift=function(be,Ee){return Xe(this,be,Ee,!0)};function Xe(be,Ee,pt,at){D("readableAddChunk",Ee);const yt=be._readableState;let zn;if(yt.state&P||(typeof Ee=="string"?(pt=pt||yt.defaultEncoding,yt.encoding!==pt&&(at&&yt.encoding?Ee=R.from(Ee,pt).toString(yt.encoding):(Ee=R.from(Ee,pt),pt=""))):Ee instanceof R?pt="":C._isUint8Array(Ee)?(Ee=C._uint8ArrayToBuffer(Ee),pt=""):Ee!=null&&(zn=new Se("chunk",["string","Buffer","Uint8Array"],Ee))),zn)q(be,zn);else if(Ee===null)yt.state&=~ie,$(be,yt);else if(yt.state&P||Ee&&Ee.length>0)if(at)if(yt.state&Q)q(be,new S);else{if(yt.destroyed||yt.errored)return!1;ct(be,yt,Ee,!0)}else if(yt.ended)q(be,new Te);else{if(yt.destroyed||yt.errored)return!1;yt.state&=~ie,yt.decoder&&!pt?(Ee=yt.decoder.write(Ee),yt.objectMode||Ee.length!==0?ct(be,yt,Ee,!1):xe(be,yt)):ct(be,yt,Ee,!1)}else at||(yt.state&=~ie,xe(be,yt));return!yt.ended&&(yt.length<yt.highWaterMark||yt.length===0)}function ct(be,Ee,pt,at){Ee.flowing&&Ee.length===0&&!Ee.sync&&be.listenerCount("data")>0?(Ee.state&N?Ee.awaitDrainWriters.clear():Ee.awaitDrainWriters=null,Ee.dataEmitted=!0,be.emit("data",pt)):(Ee.length+=Ee.objectMode?1:pt.length,at?Ee.buffer.unshift(pt):Ee.buffer.push(pt),Ee.state&Ne&&G(be)),xe(be,Ee)}Le.prototype.isPaused=function(){const be=this._readableState;return be[U]===!0||be.flowing===!1},Le.prototype.setEncoding=function(be){const Ee=new L(be);this._readableState.decoder=Ee,this._readableState.encoding=this._readableState.decoder.encoding;const pt=this._readableState.buffer;let at="";for(const yt of pt)at+=Ee.write(yt);return pt.clear(),at!==""&&pt.push(at),this._readableState.length=at.length,this};const Ct=1073741824;function Mt(be){if(be>Ct)throw new ae("size","<= 1GiB",be);return be--,be|=be>>>1,be|=be>>>2,be|=be>>>4,be|=be>>>8,be|=be>>>16,be++,be}function X(be,Ee){return be<=0||Ee.length===0&&Ee.ended?0:Ee.state&P?1:r(be)?Ee.flowing&&Ee.length?Ee.buffer.first().length:Ee.length:be<=Ee.length?be:Ee.ended?Ee.length:0}Le.prototype.read=function(be){D("read",be),be===void 0?be=NaN:t(be)||(be=i(be,10));const Ee=this._readableState,pt=be;if(be>Ee.highWaterMark&&(Ee.highWaterMark=Mt(be)),be!==0&&(Ee.state&=~ke),be===0&&Ee.needReadable&&((Ee.highWaterMark!==0?Ee.length>=Ee.highWaterMark:Ee.length>0)||Ee.ended))return D("read: emitReadable",Ee.length,Ee.ended),Ee.length===0&&Ee.ended?Yt(this):G(this),null;if(be=X(be,Ee),be===0&&Ee.ended)return Ee.length===0&&Yt(this),null;let at=(Ee.state&Ne)!==0;if(D("need readable",at),(Ee.length===0||Ee.length-be<Ee.highWaterMark)&&(at=!0,D("length less than watermark",at)),Ee.ended||Ee.reading||Ee.destroyed||Ee.errored||!Ee.constructed)at=!1,D("reading, ended or constructing",at);else if(at){D("do read"),Ee.state|=ie|we,Ee.length===0&&(Ee.state|=Ne);try{this._read(Ee.highWaterMark)}catch(zn){q(this,zn)}Ee.state&=~we,Ee.reading||(be=X(pt,Ee))}let yt;return be>0?yt=Zt(be,Ee):yt=null,yt===null?(Ee.needReadable=Ee.length<=Ee.highWaterMark,be=0):(Ee.length-=be,Ee.multiAwaitDrain?Ee.awaitDrainWriters.clear():Ee.awaitDrainWriters=null),Ee.length===0&&(Ee.ended||(Ee.needReadable=!0),pt!==be&&Ee.ended&&Yt(this)),yt!==null&&!Ee.errorEmitted&&!Ee.closeEmitted&&(Ee.dataEmitted=!0,this.emit("data",yt)),yt};function $(be,Ee){if(D("onEofChunk"),!Ee.ended){if(Ee.decoder){const pt=Ee.decoder.end();pt&&pt.length&&(Ee.buffer.push(pt),Ee.length+=Ee.objectMode?1:pt.length)}Ee.ended=!0,Ee.sync?G(be):(Ee.needReadable=!1,Ee.emittedReadable=!0,me(be))}}function G(be){const Ee=be._readableState;D("emitReadable",Ee.needReadable,Ee.emittedReadable),Ee.needReadable=!1,Ee.emittedReadable||(D("emitReadable",Ee.flowing),Ee.emittedReadable=!0,n.nextTick(me,be))}function me(be){const Ee=be._readableState;D("emitReadable_",Ee.destroyed,Ee.length,Ee.ended),!Ee.destroyed&&!Ee.errored&&(Ee.length||Ee.ended)&&(be.emit("readable"),Ee.emittedReadable=!1),Ee.needReadable=!Ee.flowing&&!Ee.ended&&Ee.length<=Ee.highWaterMark,Nt(be)}function xe(be,Ee){!Ee.readingMore&&Ee.constructed&&(Ee.readingMore=!0,n.nextTick(Re,be,Ee))}function Re(be,Ee){for(;!Ee.reading&&!Ee.ended&&(Ee.length<Ee.highWaterMark||Ee.flowing&&Ee.length===0);){const pt=Ee.length;if(D("maybeReadMore read 0"),be.read(0),pt===Ee.length)break}Ee.readingMore=!1}Le.prototype._read=function(be){throw new _e("_read()")},Le.prototype.pipe=function(be,Ee){const pt=this,at=this._readableState;at.pipes.length===1&&(at.multiAwaitDrain||(at.multiAwaitDrain=!0,at.awaitDrainWriters=new h(at.awaitDrainWriters?[at.awaitDrainWriters]:[]))),at.pipes.push(be),D("pipe count=%d opts=%j",at.pipes.length,Ee);const zn=(!Ee||Ee.end!==!1)&&be!==n.stdout&&be!==n.stderr?En:Lt;at.endEmitted?n.nextTick(zn):pt.once("end",zn),be.on("unpipe",mn);function mn(It,In){D("onunpipe"),It===pt&&In&&In.hasUnpiped===!1&&(In.hasUnpiped=!0,Ae())}function En(){D("onend"),be.end()}let mr,Pn=!1;function Ae(){D("cleanup"),be.removeListener("close",nn),be.removeListener("finish",$t),mr&&be.removeListener("drain",mr),be.removeListener("error",ht),be.removeListener("unpipe",mn),pt.removeListener("end",En),pt.removeListener("end",Lt),pt.removeListener("data",lt),Pn=!0,mr&&at.awaitDrainWriters&&(!be._writableState||be._writableState.needDrain)&&mr()}function ut(){Pn||(at.pipes.length===1&&at.pipes[0]===be?(D("false write response, pause",0),at.awaitDrainWriters=be,at.multiAwaitDrain=!1):at.pipes.length>1&&at.pipes.includes(be)&&(D("false write response, pause",at.awaitDrainWriters.size),at.awaitDrainWriters.add(be)),pt.pause()),mr||(mr=Fe(pt,be),be.on("drain",mr))}pt.on("data",lt);function lt(It){D("ondata");const In=be.write(It);D("dest.write",In),In===!1&&ut()}function ht(It){if(D("onerror",It),Lt(),be.removeListener("error",ht),be.listenerCount("error")===0){const In=be._writableState||be._readableState;In&&!In.errorEmitted?q(be,It):be.emit("error",It)}}T(be,"error",ht);function nn(){be.removeListener("finish",$t),Lt()}be.once("close",nn);function $t(){D("onfinish"),be.removeListener("close",nn),Lt()}be.once("finish",$t);function Lt(){D("unpipe"),pt.unpipe(be)}return be.emit("pipe",pt),be.writableNeedDrain===!0?ut():at.flowing||(D("pipe resume"),pt.resume()),be};function Fe(be,Ee){return function(){const at=be._readableState;at.awaitDrainWriters===Ee?(D("pipeOnDrain",1),at.awaitDrainWriters=null):at.multiAwaitDrain&&(D("pipeOnDrain",at.awaitDrainWriters.size),at.awaitDrainWriters.delete(Ee)),(!at.awaitDrainWriters||at.awaitDrainWriters.size===0)&&be.listenerCount("data")&&be.resume()}}Le.prototype.unpipe=function(be){const Ee=this._readableState,pt={hasUnpiped:!1};if(Ee.pipes.length===0)return this;if(!be){const yt=Ee.pipes;Ee.pipes=[],this.pause();for(let zn=0;zn<yt.length;zn++)yt[zn].emit("unpipe",this,{hasUnpiped:!1});return this}const at=e(Ee.pipes,be);return at===-1?this:(Ee.pipes.splice(at,1),Ee.pipes.length===0&&this.pause(),be.emit("unpipe",this,pt),this)},Le.prototype.on=function(be,Ee){const pt=C.prototype.on.call(this,be,Ee),at=this._readableState;return be==="data"?(at.readableListening=this.listenerCount("readable")>0,at.flowing!==!1&&this.resume()):be==="readable"&&!at.endEmitted&&!at.readableListening&&(at.readableListening=at.needReadable=!0,at.flowing=!1,at.emittedReadable=!1,D("on readable",at.length,at.reading),at.length?G(this):at.reading||n.nextTick(vt,this)),pt},Le.prototype.addListener=Le.prototype.on,Le.prototype.removeListener=function(be,Ee){const pt=C.prototype.removeListener.call(this,be,Ee);return be==="readable"&&n.nextTick(Et,this),pt},Le.prototype.off=Le.prototype.removeListener,Le.prototype.removeAllListeners=function(be){const Ee=C.prototype.removeAllListeners.apply(this,arguments);return(be==="readable"||be===void 0)&&n.nextTick(Et,this),Ee};function Et(be){const Ee=be._readableState;Ee.readableListening=be.listenerCount("readable")>0,Ee.resumeScheduled&&Ee[U]===!1?Ee.flowing=!0:be.listenerCount("data")>0?be.resume():Ee.readableListening||(Ee.flowing=null)}function vt(be){D("readable nexttick read 0"),be.read(0)}Le.prototype.resume=function(){const be=this._readableState;return be.flowing||(D("resume"),be.flowing=!be.readableListening,xt(this,be)),be[U]=!1,this};function xt(be,Ee){Ee.resumeScheduled||(Ee.resumeScheduled=!0,n.nextTick(kt,be,Ee))}function kt(be,Ee){D("resume",Ee.reading),Ee.reading||be.read(0),Ee.resumeScheduled=!1,be.emit("resume"),Nt(be),Ee.flowing&&!Ee.reading&&be.read(0)}Le.prototype.pause=function(){return D("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(D("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[U]=!0,this};function Nt(be){const Ee=be._readableState;for(D("flow",Ee.flowing);Ee.flowing&&be.read()!==null;);}Le.prototype.wrap=function(be){let Ee=!1;be.on("data",at=>{!this.push(at)&&be.pause&&(Ee=!0,be.pause())}),be.on("end",()=>{this.push(null)}),be.on("error",at=>{q(this,at)}),be.on("close",()=>{this.destroy()}),be.on("destroy",()=>{this.destroy()}),this._read=()=>{Ee&&be.resume&&(Ee=!1,be.resume())};const pt=u(be);for(let at=1;at<pt.length;at++){const yt=pt[at];this[yt]===void 0&&typeof be[yt]=="function"&&(this[yt]=be[yt].bind(be))}return this},Le.prototype[m]=function(){return en(this)},Le.prototype.iterator=function(be){return be!==void 0&&A(be,"options"),en(this,be)};function en(be,Ee){typeof be.read!="function"&&(be=Le.wrap(be,{objectMode:!0}));const pt=Pr(be,Ee);return pt.stream=be,pt}async function*Pr(be,Ee){let pt=Y;function at(mn){this===be?(pt(),pt=Y):pt=mn}be.on("readable",at);let yt;const zn=I(be,{writable:!1},mn=>{yt=mn?ge(yt,mn):null,pt(),pt=Y});try{for(;;){const mn=be.destroyed?null:be.read();if(mn!==null)yield mn;else{if(yt)throw yt;if(yt===null)return;await new p(at)}}}catch(mn){throw yt=ge(yt,mn),yt}finally{(yt||(Ee==null?void 0:Ee.destroyOnReturn)!==!1)&&(yt===void 0||be._readableState.autoDestroy)?W.destroyer(be,null):(be.off("readable",at),zn())}}o(Le.prototype,{readable:{__proto__:null,get(){const be=this._readableState;return!!be&&be.readable!==!1&&!be.destroyed&&!be.errorEmitted&&!be.endEmitted},set(be){this._readableState&&(this._readableState.readable=!!be)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(be){this._readableState&&(this._readableState.flowing=be)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(be){this._readableState&&(this._readableState.destroyed=be)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(Ce.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[U]!==!1},set(be){this[U]=!!be}}}),Le._fromList=Zt;function Zt(be,Ee){if(Ee.length===0)return null;let pt;return Ee.objectMode?pt=Ee.buffer.shift():!be||be>=Ee.length?(Ee.decoder?pt=Ee.buffer.join(""):Ee.buffer.length===1?pt=Ee.buffer.first():pt=Ee.buffer.concat(Ee.length),Ee.buffer.clear()):pt=Ee.buffer.consume(be,Ee.decoder),pt}function Yt(be){const Ee=be._readableState;D("endReadable",Ee.endEmitted),Ee.endEmitted||(Ee.ended=!0,n.nextTick(aa,Ee,be))}function aa(be,Ee){if(D("endReadableNT",be.endEmitted,be.length),!be.errored&&!be.closeEmitted&&!be.endEmitted&&be.length===0){if(be.endEmitted=!0,Ee.emit("end"),Ee.writable&&Ee.allowHalfOpen===!1)n.nextTick(On,Ee);else if(be.autoDestroy){const pt=Ee._writableState;(!pt||pt.autoDestroy&&(pt.finished||pt.writable===!1))&&Ee.destroy()}}}function On(be){be.writable&&!be.writableEnded&&!be.destroyed&&be.end()}Le.from=function(be,Ee){return z(Le,be,Ee)};let Bn;function Pa(){return Bn===void 0&&(Bn={}),Bn}return Le.fromWeb=function(be,Ee){return Pa().newStreamReadableFromReadableStream(be,Ee)},Le.toWeb=function(be,Ee){return Pa().newReadableStreamFromStreamReadable(be,Ee)},Le.wrap=function(be,Ee){var pt,at;return new Le({objectMode:(pt=(at=be.readableObjectMode)!==null&&at!==void 0?at:be.objectMode)!==null&&pt!==void 0?pt:!0,...Ee,destroy(yt,zn){W.destroyer(be,yt),zn(yt)}}).wrap(be)},J8}var Q8,TP;function DM(){if(TP)return Q8;TP=1;const n=sp(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:o,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:c,Symbol:p,SymbolHasInstance:h}=wa;Q8=A,A.WritableState=S;const{EventEmitter:g}=S1,m=NM.Stream,{Buffer:w}=ip,v=jm,{addAbortSignal:C}=_S,{getHighWaterMark:T,getDefaultHighWaterMark:R}=SS,{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_MULTIPLE_CALLBACK:D,ERR_STREAM_CANNOT_PIPE:K,ERR_STREAM_DESTROYED:W,ERR_STREAM_ALREADY_FINISHED:pe,ERR_STREAM_NULL_VALUES:ce,ERR_STREAM_WRITE_AFTER_END:ge,ERR_UNKNOWN_ENCODING:Se}=oo.codes,{errorOrDestroy:_e}=v;u(A.prototype,m.prototype),u(A,m);function ae(){}const Te=p("kOnFinished");function S(le,ne,ye){typeof ye!="boolean"&&(ye=ne instanceof xf()),this.objectMode=!!(le&&le.objectMode),ye&&(this.objectMode=this.objectMode||!!(le&&le.writableObjectMode)),this.highWaterMark=le?T(this,le,"writableHighWaterMark",ye):R(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const Z=!!(le&&le.decodeStrings===!1);this.decodeStrings=!Z,this.defaultEncoding=le&&le.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=q.bind(void 0,ne),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,x(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!le||le.emitClose!==!1,this.autoDestroy=!le||le.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Te]=[]}function x(le){le.buffered=[],le.bufferedIndex=0,le.allBuffers=!0,le.allNoop=!0}S.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(S.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function A(le){const ne=this instanceof xf();if(!ne&&!r(A,this))return new A(le);this._writableState=new S(le,this,ne),le&&(typeof le.write=="function"&&(this._write=le.write),typeof le.writev=="function"&&(this._writev=le.writev),typeof le.destroy=="function"&&(this._destroy=le.destroy),typeof le.final=="function"&&(this._final=le.final),typeof le.construct=="function"&&(this._construct=le.construct),le.signal&&C(le.signal,this)),m.call(this,le),v.construct(this,()=>{const ye=this._writableState;ye.writing||ie(this,ye),ke(this,ye)})}i(A,h,{__proto__:null,value:function(le){return r(this,le)?!0:this!==A?!1:le&&le._writableState instanceof S}}),A.prototype.pipe=function(){_e(this,new K)};function U(le,ne,ye,Z){const N=le._writableState;if(typeof ye=="function")Z=ye,ye=N.defaultEncoding;else{if(!ye)ye=N.defaultEncoding;else if(ye!=="buffer"&&!w.isEncoding(ye))throw new Se(ye);typeof Z!="function"&&(Z=ae)}if(ne===null)throw new ce;if(!N.objectMode)if(typeof ne=="string")N.decodeStrings!==!1&&(ne=w.from(ne,ye),ye="buffer");else if(ne instanceof w)ye="buffer";else if(m._isUint8Array(ne))ne=m._uint8ArrayToBuffer(ne),ye="buffer";else throw new O("chunk",["string","Buffer","Uint8Array"],ne);let B;return N.ending?B=new ge:N.destroyed&&(B=new W("write")),B?(n.nextTick(Z,B),_e(le,B,!0),B):(N.pendingcb++,L(le,N,ne,ye,Z))}A.prototype.write=function(le,ne,ye){return U(this,le,ne,ye)===!0},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){const le=this._writableState;le.corked&&(le.corked--,le.writing||ie(this,le))},A.prototype.setDefaultEncoding=function(ne){if(typeof ne=="string"&&(ne=c(ne)),!w.isEncoding(ne))throw new Se(ne);return this._writableState.defaultEncoding=ne,this};function L(le,ne,ye,Z,N){const B=ne.objectMode?1:ye.length;ne.length+=B;const te=ne.length<ne.highWaterMark;return te||(ne.needDrain=!0),ne.writing||ne.corked||ne.errored||!ne.constructed?(ne.buffered.push({chunk:ye,encoding:Z,callback:N}),ne.allBuffers&&Z!=="buffer"&&(ne.allBuffers=!1),ne.allNoop&&N!==ae&&(ne.allNoop=!1)):(ne.writelen=B,ne.writecb=N,ne.writing=!0,ne.sync=!0,le._write(ye,Z,ne.onwrite),ne.sync=!1),te&&!ne.errored&&!ne.destroyed}function z(le,ne,ye,Z,N,B,te){ne.writelen=Z,ne.writecb=te,ne.writing=!0,ne.sync=!0,ne.destroyed?ne.onwrite(new W("write")):ye?le._writev(N,ne.onwrite):le._write(N,B,ne.onwrite),ne.sync=!1}function Y(le,ne,ye,Z){--ne.pendingcb,Z(ye),Q(ne),_e(le,ye)}function q(le,ne){const ye=le._writableState,Z=ye.sync,N=ye.writecb;if(typeof N!="function"){_e(le,new D);return}ye.writing=!1,ye.writecb=null,ye.length-=ye.writelen,ye.writelen=0,ne?(ne.stack,ye.errored||(ye.errored=ne),le._readableState&&!le._readableState.errored&&(le._readableState.errored=ne),Z?n.nextTick(Y,le,ye,ne,N):Y(le,ye,ne,N)):(ye.buffered.length>ye.bufferedIndex&&ie(le,ye),Z?ye.afterWriteTickInfo!==null&&ye.afterWriteTickInfo.cb===N?ye.afterWriteTickInfo.count++:(ye.afterWriteTickInfo={count:1,cb:N,stream:le,state:ye},n.nextTick(P,ye.afterWriteTickInfo)):M(le,ye,1,N))}function P({stream:le,state:ne,count:ye,cb:Z}){return ne.afterWriteTickInfo=null,M(le,ne,ye,Z)}function M(le,ne,ye,Z){for(!ne.ending&&!le.destroyed&&ne.length===0&&ne.needDrain&&(ne.needDrain=!1,le.emit("drain"));ye-- >0;)ne.pendingcb--,Z();ne.destroyed&&Q(ne),ke(le,ne)}function Q(le){if(le.writing)return;for(let N=le.bufferedIndex;N<le.buffered.length;++N){var ne;const{chunk:B,callback:te}=le.buffered[N],oe=le.objectMode?1:B.length;le.length-=oe,te((ne=le.errored)!==null&&ne!==void 0?ne:new W("write"))}const ye=le[Te].splice(0);for(let N=0;N<ye.length;N++){var Z;ye[N]((Z=le.errored)!==null&&Z!==void 0?Z:new W("end"))}x(le)}function ie(le,ne){if(ne.corked||ne.bufferProcessing||ne.destroyed||!ne.constructed)return;const{buffered:ye,bufferedIndex:Z,objectMode:N}=ne,B=ye.length-Z;if(!B)return;let te=Z;if(ne.bufferProcessing=!0,B>1&&le._writev){ne.pendingcb-=B-1;const oe=ne.allNoop?ae:Le=>{for(let Xe=te;Xe<ye.length;++Xe)ye[Xe].callback(Le)},Ce=ne.allNoop&&te===0?ye:e(ye,te);Ce.allBuffers=ne.allBuffers,z(le,ne,!0,ne.length,Ce,"",oe),x(ne)}else{do{const{chunk:oe,encoding:Ce,callback:Le}=ye[te];ye[te++]=null;const Xe=N?1:oe.length;z(le,ne,!1,Xe,oe,Ce,Le)}while(te<ye.length&&!ne.writing);te===ye.length?x(ne):te>256?(ye.splice(0,te),ne.bufferedIndex=0):ne.bufferedIndex=te}ne.bufferProcessing=!1}A.prototype._write=function(le,ne,ye){if(this._writev)this._writev([{chunk:le,encoding:ne}],ye);else throw new I("_write()")},A.prototype._writev=null,A.prototype.end=function(le,ne,ye){const Z=this._writableState;typeof le=="function"?(ye=le,le=null,ne=null):typeof ne=="function"&&(ye=ne,ne=null);let N;if(le!=null){const B=U(this,le,ne);B instanceof t&&(N=B)}return Z.corked&&(Z.corked=1,this.uncork()),N||(!Z.errored&&!Z.ending?(Z.ending=!0,ke(this,Z,!0),Z.ended=!0):Z.finished?N=new pe("end"):Z.destroyed&&(N=new W("end"))),typeof ye=="function"&&(N||Z.finished?n.nextTick(ye,N):Z[Te].push(ye)),this};function H(le){return le.ending&&!le.destroyed&&le.constructed&&le.length===0&&!le.errored&&le.buffered.length===0&&!le.finished&&!le.writing&&!le.errorEmitted&&!le.closeEmitted}function we(le,ne){let ye=!1;function Z(N){if(ye){_e(le,N??D());return}if(ye=!0,ne.pendingcb--,N){const B=ne[Te].splice(0);for(let te=0;te<B.length;te++)B[te](N);_e(le,N,ne.sync)}else H(ne)&&(ne.prefinished=!0,le.emit("prefinish"),ne.pendingcb++,n.nextTick(Ue,le,ne))}ne.sync=!0,ne.pendingcb++;try{le._final(Z)}catch(N){Z(N)}ne.sync=!1}function Ne(le,ne){!ne.prefinished&&!ne.finalCalled&&(typeof le._final=="function"&&!ne.destroyed?(ne.finalCalled=!0,we(le,ne)):(ne.prefinished=!0,le.emit("prefinish")))}function ke(le,ne,ye){H(ne)&&(Ne(le,ne),ne.pendingcb===0&&(ye?(ne.pendingcb++,n.nextTick((Z,N)=>{H(N)?Ue(Z,N):N.pendingcb--},le,ne)):H(ne)&&(ne.pendingcb++,Ue(le,ne))))}function Ue(le,ne){ne.pendingcb--,ne.finished=!0;const ye=ne[Te].splice(0);for(let Z=0;Z<ye.length;Z++)ye[Z]();if(le.emit("finish"),ne.autoDestroy){const Z=le._readableState;(!Z||Z.autoDestroy&&(Z.endEmitted||Z.readable===!1))&&le.destroy()}}o(A.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(le){this._writableState&&(this._writableState.destroyed=le)}},writable:{__proto__:null,get(){const le=this._writableState;return!!le&&le.writable!==!1&&!le.destroyed&&!le.errored&&!le.ending&&!le.ended},set(le){this._writableState&&(this._writableState.writable=!!le)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const le=this._writableState;return le?!le.destroyed&&!le.ending&&le.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const se=v.destroy;A.prototype.destroy=function(le,ne){const ye=this._writableState;return!ye.destroyed&&(ye.bufferedIndex<ye.buffered.length||ye[Te].length)&&n.nextTick(Q,ye),se.call(this,le,ne),this},A.prototype._undestroy=v.undestroy,A.prototype._destroy=function(le,ne){ne(le)},A.prototype[g.captureRejectionSymbol]=function(le){this.destroy(le)};let fe;function de(){return fe===void 0&&(fe={}),fe}return A.fromWeb=function(le,ne){return de().newStreamWritableFromWritableStream(le,ne)},A.toWeb=function(le){return de().newWritableStreamFromStreamWritable(le)},Q8}var Z8,RP;function soe(){if(RP)return Z8;RP=1;const n=sp(),e=ip,{isReadable:t,isWritable:r,isIterable:i,isNodeStream:o,isReadableNodeStream:u,isWritableNodeStream:c,isDuplexNodeStream:p,isReadableStream:h,isWritableStream:g}=Af,m=op,{AbortError:w,codes:{ERR_INVALID_ARG_TYPE:v,ERR_INVALID_RETURN_VALUE:C}}=oo,{destroyer:T}=jm,R=xf(),O=ES(),I=DM(),{createDeferredPromise:D}=Os,K=sz,W=globalThis.Blob||e.Blob,pe=typeof W<"u"?function(S){return S instanceof W}:function(S){return!1},ce=globalThis.AbortController||r1().AbortController,{FunctionPrototypeCall:ge}=wa;class Se extends R{constructor(S){super(S),(S==null?void 0:S.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(S==null?void 0:S.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Z8=function Te(S,x){if(p(S))return S;if(u(S))return ae({readable:S});if(c(S))return ae({writable:S});if(o(S))return ae({writable:!1,readable:!1});if(h(S))return ae({readable:O.fromWeb(S)});if(g(S))return ae({writable:I.fromWeb(S)});if(typeof S=="function"){const{value:U,write:L,final:z,destroy:Y}=_e(S);if(i(U))return K(Se,U,{objectMode:!0,write:L,final:z,destroy:Y});const q=U==null?void 0:U.then;if(typeof q=="function"){let P;const M=ge(q,U,Q=>{if(Q!=null)throw new C("nully","body",Q)},Q=>{T(P,Q)});return P=new Se({objectMode:!0,readable:!1,write:L,final(Q){z(async()=>{try{await M,n.nextTick(Q,null)}catch(ie){n.nextTick(Q,ie)}})},destroy:Y})}throw new C("Iterable, AsyncIterable or AsyncFunction",x,U)}if(pe(S))return Te(S.arrayBuffer());if(i(S))return K(Se,S,{objectMode:!0,writable:!1});if(h(S==null?void 0:S.readable)&&g(S==null?void 0:S.writable))return Se.fromWeb(S);if(typeof(S==null?void 0:S.writable)=="object"||typeof(S==null?void 0:S.readable)=="object"){const U=S!=null&&S.readable?u(S==null?void 0:S.readable)?S==null?void 0:S.readable:Te(S.readable):void 0,L=S!=null&&S.writable?c(S==null?void 0:S.writable)?S==null?void 0:S.writable:Te(S.writable):void 0;return ae({readable:U,writable:L})}const A=S==null?void 0:S.then;if(typeof A=="function"){let U;return ge(A,S,L=>{L!=null&&U.push(L),U.push(null)},L=>{T(U,L)}),U=new Se({objectMode:!0,writable:!1,read(){}})}throw new v(x,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],S)};function _e(Te){let{promise:S,resolve:x}=D();const A=new ce,U=A.signal;return{value:Te(async function*(){for(;;){const z=S;S=null;const{chunk:Y,done:q,cb:P}=await z;if(n.nextTick(P),q)return;if(U.aborted)throw new w(void 0,{cause:U.reason});({promise:S,resolve:x}=D()),yield Y}}(),{signal:U}),write(z,Y,q){const P=x;x=null,P({chunk:z,done:!1,cb:q})},final(z){const Y=x;x=null,Y({done:!0,cb:z})},destroy(z,Y){A.abort(),Y(z)}}}function ae(Te){const S=Te.readable&&typeof Te.readable.read!="function"?O.wrap(Te.readable):Te.readable,x=Te.writable;let A=!!t(S),U=!!r(x),L,z,Y,q,P;function M(Q){const ie=q;q=null,ie?ie(Q):Q&&P.destroy(Q)}return P=new Se({readableObjectMode:!!(S!=null&&S.readableObjectMode),writableObjectMode:!!(x!=null&&x.writableObjectMode),readable:A,writable:U}),U&&(m(x,Q=>{U=!1,Q&&T(S,Q),M(Q)}),P._write=function(Q,ie,H){x.write(Q,ie)?H():L=H},P._final=function(Q){x.end(),z=Q},x.on("drain",function(){if(L){const Q=L;L=null,Q()}}),x.on("finish",function(){if(z){const Q=z;z=null,Q()}})),A&&(m(S,Q=>{A=!1,Q&&T(S,Q),M(Q)}),S.on("readable",function(){if(Y){const Q=Y;Y=null,Q()}}),S.on("end",function(){P.push(null)}),P._read=function(){for(;;){const Q=S.read();if(Q===null){Y=P._read;return}if(!P.push(Q))return}}),P._destroy=function(Q,ie){!Q&&q!==null&&(Q=new w),Y=null,L=null,z=null,q===null?ie(Q):(q=ie,T(x,Q),T(S,Q))},P}return Z8}var X8,OP;function xf(){if(OP)return X8;OP=1;const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=wa;X8=u;const i=ES(),o=DM();r(u.prototype,i.prototype),r(u,i);{const g=t(o.prototype);for(let m=0;m<g.length;m++){const w=g[m];u.prototype[w]||(u.prototype[w]=o.prototype[w])}}function u(g){if(!(this instanceof u))return new u(g);i.call(this,g),o.call(this,g),g?(this.allowHalfOpen=g.allowHalfOpen!==!1,g.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),g.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(u.prototype,{writable:{__proto__:null,...e(o.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(o.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(o.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(o.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(o.prototype,"writableLength")},writableFinished:{__proto__:null,...e(o.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(o.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(o.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(o.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(g){this._readableState&&this._writableState&&(this._readableState.destroyed=g,this._writableState.destroyed=g)}}});let c;function p(){return c===void 0&&(c={}),c}u.fromWeb=function(g,m){return p().newStreamDuplexFromReadableWritablePair(g,m)},u.toWeb=function(g){return p().newReadableWritablePairFromDuplex(g)};let h;return u.from=function(g){return h||(h=soe()),h(g,"body")},X8}const{ObjectSetPrototypeOf:oz,Symbol:ooe}=wa;var uz=_f;const{ERR_METHOD_NOT_IMPLEMENTED:uoe}=oo.codes,UM=xf(),{getHighWaterMark:loe}=SS;oz(_f.prototype,UM.prototype);oz(_f,UM);const jv=ooe("kCallback");function _f(n){if(!(this instanceof _f))return new _f(n);const e=n?loe(this,n,"readableHighWaterMark",!0):null;e===0&&(n={...n,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:n.writableHighWaterMark||0}),UM.call(this,n),this._readableState.sync=!1,this[jv]=null,n&&(typeof n.transform=="function"&&(this._transform=n.transform),typeof n.flush=="function"&&(this._flush=n.flush)),this.on("prefinish",coe)}function v4(n){typeof this._flush=="function"&&!this.destroyed?this._flush((e,t)=>{if(e){n?n(e):this.destroy(e);return}t!=null&&this.push(t),this.push(null),n&&n()}):(this.push(null),n&&n())}function coe(){this._final!==v4&&v4.call(this)}_f.prototype._final=v4;_f.prototype._transform=function(n,e,t){throw new uoe("_transform()")};_f.prototype._write=function(n,e,t){const r=this._readableState,i=this._writableState,o=r.length;this._transform(n,e,(u,c)=>{if(u){t(u);return}c!=null&&this.push(c),i.ended||o===r.length||r.length<r.highWaterMark?t():this[jv]=t})};_f.prototype._read=function(){if(this[jv]){const n=this[jv];this[jv]=null,n()}};const{ObjectSetPrototypeOf:lz}=wa;var cz=_m;const FM=uz;lz(_m.prototype,FM.prototype);lz(_m,FM);function _m(n){if(!(this instanceof _m))return new _m(n);FM.call(this,n)}_m.prototype._transform=function(n,e,t){t(null,n)};const Mv=sp(),{ArrayIsArray:foe,Promise:doe,SymbolAsyncIterator:poe,SymbolDispose:hoe}=wa,O2=op,{once:yoe}=Os,moe=jm,LP=xf(),{aggregateTwoErrors:goe,codes:{ERR_INVALID_ARG_TYPE:w4,ERR_INVALID_RETURN_VALUE:e5,ERR_MISSING_ARGS:boe,ERR_STREAM_DESTROYED:voe,ERR_STREAM_PREMATURE_CLOSE:woe},AbortError:xoe}=oo,{validateFunction:_oe,validateAbortSignal:Soe}=E1,{isIterable:ph,isReadable:t5,isReadableNodeStream:l2,isNodeStream:NP,isTransformStream:Zy,isWebStream:Eoe,isReadableStream:n5,isReadableFinished:Coe}=Af,Aoe=globalThis.AbortController||r1().AbortController;let r5,a5,i5;function PP(n,e,t){let r=!1;n.on("close",()=>{r=!0});const i=O2(n,{readable:e,writable:t},o=>{r=!o});return{destroy:o=>{r||(r=!0,moe.destroyer(n,o||new voe("pipe")))},cleanup:i}}function Moe(n){return _oe(n[n.length-1],"streams[stream.length - 1]"),n.pop()}function s5(n){if(ph(n))return n;if(l2(n))return koe(n);throw new w4("val",["Readable","Iterable","AsyncIterable"],n)}async function*koe(n){a5||(a5=ES()),yield*a5.prototype[poe].call(n)}async function q_(n,e,t,{end:r}){let i,o=null;const u=h=>{if(h&&(i=h),o){const g=o;o=null,g()}},c=()=>new doe((h,g)=>{i?g(i):o=()=>{i?g(i):h()}});e.on("drain",u);const p=O2(e,{readable:!1},u);try{e.writableNeedDrain&&await c();for await(const h of n)e.write(h)||await c();r&&(e.end(),await c()),t()}catch(h){t(i!==h?goe(i,h):h)}finally{p(),e.off("drain",u)}}async function o5(n,e,t,{end:r}){Zy(e)&&(e=e.writable);const i=e.getWriter();try{for await(const o of n)await i.ready,i.write(o).catch(()=>{});await i.ready,r&&await i.close(),t()}catch(o){try{await i.abort(o),t(o)}catch(u){t(u)}}}function Toe(...n){return fz(n,yoe(Moe(n)))}function fz(n,e,t){if(n.length===1&&foe(n[0])&&(n=n[0]),n.length<2)throw new boe("streams");const r=new Aoe,i=r.signal,o=t==null?void 0:t.signal,u=[];Soe(o,"options.signal");function c(){C(new xoe)}i5=i5||Os.addAbortListener;let p;o&&(p=i5(o,c));let h,g;const m=[];let w=0;function v(I){C(I,--w===0)}function C(I,D){var K;if(I&&(!h||h.code==="ERR_STREAM_PREMATURE_CLOSE")&&(h=I),!(!h&&!D)){for(;m.length;)m.shift()(h);(K=p)===null||K===void 0||K[hoe](),r.abort(),D&&(h||u.forEach(W=>W()),Mv.nextTick(e,h,g))}}let T;for(let I=0;I<n.length;I++){const D=n[I],K=I<n.length-1,W=I>0,pe=K||(t==null?void 0:t.end)!==!1,ce=I===n.length-1;if(NP(D)){let ge=function(Se){Se&&Se.name!=="AbortError"&&Se.code!=="ERR_STREAM_PREMATURE_CLOSE"&&v(Se)};if(pe){const{destroy:Se,cleanup:_e}=PP(D,K,W);m.push(Se),t5(D)&&ce&&u.push(_e)}D.on("error",ge),t5(D)&&ce&&u.push(()=>{D.removeListener("error",ge)})}if(I===0)if(typeof D=="function"){if(T=D({signal:i}),!ph(T))throw new e5("Iterable, AsyncIterable or Stream","source",T)}else ph(D)||l2(D)||Zy(D)?T=D:T=LP.from(D);else if(typeof D=="function"){if(Zy(T)){var R;T=s5((R=T)===null||R===void 0?void 0:R.readable)}else T=s5(T);if(T=D(T,{signal:i}),K){if(!ph(T,!0))throw new e5("AsyncIterable",`transform[${I-1}]`,T)}else{var O;r5||(r5=cz);const ge=new r5({objectMode:!0}),Se=(O=T)===null||O===void 0?void 0:O.then;if(typeof Se=="function")w++,Se.call(T,Te=>{g=Te,Te!=null&&ge.write(Te),pe&&ge.end(),Mv.nextTick(v)},Te=>{ge.destroy(Te),Mv.nextTick(v,Te)});else if(ph(T,!0))w++,q_(T,ge,v,{end:pe});else if(n5(T)||Zy(T)){const Te=T.readable||T;w++,q_(Te,ge,v,{end:pe})}else throw new e5("AsyncIterable or Promise","destination",T);T=ge;const{destroy:_e,cleanup:ae}=PP(T,!1,!0);m.push(_e),ce&&u.push(ae)}}else if(NP(D)){if(l2(T)){w+=2;const ge=Roe(T,D,v,{end:pe});t5(D)&&ce&&u.push(ge)}else if(Zy(T)||n5(T)){const ge=T.readable||T;w++,q_(ge,D,v,{end:pe})}else if(ph(T))w++,q_(T,D,v,{end:pe});else throw new w4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],T);T=D}else if(Eoe(D)){if(l2(T))w++,o5(s5(T),D,v,{end:pe});else if(n5(T)||ph(T))w++,o5(T,D,v,{end:pe});else if(Zy(T))w++,o5(T.readable,D,v,{end:pe});else throw new w4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],T);T=D}else T=LP.from(D)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Mv.nextTick(c),T}function Roe(n,e,t,{end:r}){let i=!1;if(e.on("close",()=>{i||t(new woe)}),n.pipe(e,{end:!1}),r){let o=function(){i=!0,e.end()};Coe(n)?Mv.nextTick(o):n.once("end",o)}else t();return O2(n,{readable:!0,writable:!1},o=>{const u=n._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&u&&u.ended&&!u.errored&&!u.errorEmitted?n.once("end",t).once("error",t):t(o)}),O2(e,{readable:!1,writable:!0},t)}var BM={pipelineImpl:fz,pipeline:Toe};const{pipeline:Ooe}=BM,V_=xf(),{destroyer:Loe}=jm,{isNodeStream:G_,isReadable:IP,isWritable:DP,isWebStream:u5,isTransformStream:fh,isWritableStream:UP,isReadableStream:FP}=Af,{AbortError:Noe,codes:{ERR_INVALID_ARG_VALUE:BP,ERR_MISSING_ARGS:Poe}}=oo,Ioe=op;var dz=function(...e){if(e.length===0)throw new Poe("streams");if(e.length===1)return V_.from(e[0]);const t=[...e];if(typeof e[0]=="function"&&(e[0]=V_.from(e[0])),typeof e[e.length-1]=="function"){const v=e.length-1;e[v]=V_.from(e[v])}for(let v=0;v<e.length;++v)if(!(!G_(e[v])&&!u5(e[v]))){if(v<e.length-1&&!(IP(e[v])||FP(e[v])||fh(e[v])))throw new BP(`streams[${v}]`,t[v],"must be readable");if(v>0&&!(DP(e[v])||UP(e[v])||fh(e[v])))throw new BP(`streams[${v}]`,t[v],"must be writable")}let r,i,o,u,c;function p(v){const C=u;u=null,C?C(v):v?c.destroy(v):!w&&!m&&c.destroy()}const h=e[0],g=Ooe(e,p),m=!!(DP(h)||UP(h)||fh(h)),w=!!(IP(g)||FP(g)||fh(g));if(c=new V_({writableObjectMode:!!(h!=null&&h.writableObjectMode),readableObjectMode:!!(g!=null&&g.readableObjectMode),writable:m,readable:w}),m){if(G_(h))c._write=function(C,T,R){h.write(C,T)?R():r=R},c._final=function(C){h.end(),i=C},h.on("drain",function(){if(r){const C=r;r=null,C()}});else if(u5(h)){const T=(fh(h)?h.writable:h).getWriter();c._write=async function(R,O,I){try{await T.ready,T.write(R).catch(()=>{}),I()}catch(D){I(D)}},c._final=async function(R){try{await T.ready,T.close().catch(()=>{}),i=R}catch(O){R(O)}}}const v=fh(g)?g.readable:g;Ioe(v,()=>{if(i){const C=i;i=null,C()}})}if(w){if(G_(g))g.on("readable",function(){if(o){const v=o;o=null,v()}}),g.on("end",function(){c.push(null)}),c._read=function(){for(;;){const v=g.read();if(v===null){o=c._read;return}if(!c.push(v))return}};else if(u5(g)){const C=(fh(g)?g.readable:g).getReader();c._read=async function(){for(;;)try{const{value:T,done:R}=await C.read();if(!c.push(T))return;if(R){c.push(null);return}}catch{return}}}}return c._destroy=function(v,C){!v&&u!==null&&(v=new Noe),o=null,r=null,i=null,u===null?C(v):(u=C,G_(g)&&Loe(g,v))},c};const Doe=globalThis.AbortController||r1().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Uoe,ERR_INVALID_ARG_TYPE:A1,ERR_MISSING_ARGS:Foe,ERR_OUT_OF_RANGE:Boe},AbortError:fc}=oo,{validateAbortSignal:Wh,validateInteger:zP,validateObject:Kh}=E1,zoe=wa.Symbol("kWeak"),joe=wa.Symbol("kResistStopPropagation"),{finished:$oe}=op,Hoe=dz,{addAbortSignalNoValidate:qoe}=_S,{isWritable:Voe,isNodeStream:Goe}=Af,{deprecate:Woe}=Os,{ArrayPrototypePush:Koe,Boolean:Yoe,MathFloor:jP,Number:Joe,NumberIsNaN:Qoe,Promise:$P,PromiseReject:HP,PromiseResolve:Zoe,PromisePrototypeThen:qP,Symbol:pz}=wa,L2=pz("kEmpty"),VP=pz("kEof");function Xoe(n,e){if(e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal"),Goe(n)&&!Voe(n))throw new Uoe("stream",n,"must be writable");const t=Hoe(this,n);return e!=null&&e.signal&&qoe(e.signal,t),t}function CS(n,e){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal");let t=1;(e==null?void 0:e.concurrency)!=null&&(t=jP(e.concurrency));let r=t-1;return(e==null?void 0:e.highWaterMark)!=null&&(r=jP(e.highWaterMark)),zP(t,"options.concurrency",1),zP(r,"options.highWaterMark",0),r+=t,(async function*(){const o=Os.AbortSignalAny([e==null?void 0:e.signal].filter(Yoe)),u=this,c=[],p={signal:o};let h,g,m=!1,w=0;function v(){m=!0,C()}function C(){w-=1,T()}function T(){g&&!m&&w<t&&c.length<r&&(g(),g=null)}async function R(){try{for await(let O of u){if(m)return;if(o.aborted)throw new fc;try{if(O=n(O,p),O===L2)continue;O=Zoe(O)}catch(I){O=HP(I)}w+=1,qP(O,C,v),c.push(O),h&&(h(),h=null),!m&&(c.length>=r||w>=t)&&await new $P(I=>{g=I})}c.push(VP)}catch(O){const I=HP(O);qP(I,C,v),c.push(I)}finally{m=!0,h&&(h(),h=null)}}R();try{for(;;){for(;c.length>0;){const O=await c[0];if(O===VP)return;if(o.aborted)throw new fc;O!==L2&&(yield O),c.shift(),T()}await new $P(O=>{h=O})}}finally{m=!0,g&&(g(),g=null)}}).call(this)}function eue(n=void 0){return n!=null&&Kh(n,"options"),(n==null?void 0:n.signal)!=null&&Wh(n.signal,"options.signal"),(async function*(){let t=0;for await(const i of this){var r;if(n!=null&&(r=n.signal)!==null&&r!==void 0&&r.aborted)throw new fc({cause:n.signal.reason});yield[t++,i]}}).call(this)}async function hz(n,e=void 0){for await(const t of zM.call(this,n,e))return!0;return!1}async function tue(n,e=void 0){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);return!await hz.call(this,async(...t)=>!await n(...t),e)}async function nue(n,e){for await(const t of zM.call(this,n,e))return t}async function rue(n,e){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i),L2}for await(const r of CS.call(this,t,e));}function zM(n,e){if(typeof n!="function")throw new A1("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i)?r:L2}return CS.call(this,t,e)}class aue extends Foe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function iue(n,e,t){var r;if(typeof n!="function")throw new A1("reducer",["Function","AsyncFunction"],n);t!=null&&Kh(t,"options"),(t==null?void 0:t.signal)!=null&&Wh(t.signal,"options.signal");let i=arguments.length>1;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted){const h=new fc(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await $oe(this.destroy(h)),h}const o=new Doe,u=o.signal;if(t!=null&&t.signal){const h={once:!0,[zoe]:this,[joe]:!0};t.signal.addEventListener("abort",()=>o.abort(),h)}let c=!1;try{for await(const h of this){var p;if(c=!0,t!=null&&(p=t.signal)!==null&&p!==void 0&&p.aborted)throw new fc;i?e=await n(e,h,{signal:u}):(e=h,i=!0)}if(!c&&!i)throw new aue}finally{o.abort()}return e}async function sue(n){n!=null&&Kh(n,"options"),(n==null?void 0:n.signal)!=null&&Wh(n.signal,"options.signal");const e=[];for await(const r of this){var t;if(n!=null&&(t=n.signal)!==null&&t!==void 0&&t.aborted)throw new fc(void 0,{cause:n.signal.reason});Koe(e,r)}return e}function oue(n,e){const t=CS.call(this,n,e);return(async function*(){for await(const i of t)yield*i}).call(this)}function yz(n){if(n=Joe(n),Qoe(n))return 0;if(n<0)throw new Boe("number",">= 0",n);return n}function uue(n,e=void 0){return e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal"),n=yz(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new fc;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new fc;n--<=0&&(yield o)}}).call(this)}function lue(n,e=void 0){return e!=null&&Kh(e,"options"),(e==null?void 0:e.signal)!=null&&Wh(e.signal,"options.signal"),n=yz(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new fc;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new fc;if(n-- >0&&(yield o),n<=0)return}}).call(this)}kM.streamReturningOperators={asIndexedPairs:Woe(eue,"readable.asIndexedPairs will be removed in a future version."),drop:uue,filter:zM,flatMap:oue,map:CS,take:lue,compose:Xoe};kM.promiseReturningOperators={every:tue,forEach:rue,reduce:iue,toArray:sue,some:hz,find:nue};var l5,GP;function mz(){if(GP)return l5;GP=1;const{ArrayPrototypePop:n,Promise:e}=wa,{isIterable:t,isNodeStream:r,isWebStream:i}=Af,{pipelineImpl:o}=BM,{finished:u}=op;gz();function c(...p){return new e((h,g)=>{let m,w;const v=p[p.length-1];if(v&&typeof v=="object"&&!r(v)&&!t(v)&&!i(v)){const C=n(p);m=C.signal,w=C.end}o(p,(C,T)=>{C?g(C):h(T)},{signal:m,end:w})})}return l5={finished:u,pipeline:c},l5}var WP;function gz(){if(WP)return q8.exports;WP=1;const{Buffer:n}=ip,{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=wa,{promisify:{custom:i}}=Os,{streamReturningOperators:o,promiseReturningOperators:u}=kM,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=oo,p=dz,{setDefaultHighWaterMark:h,getDefaultHighWaterMark:g}=SS,{pipeline:m}=BM,{destroyer:w}=jm,v=op,C=mz(),T=Af,R=q8.exports=NM.Stream;R.isDestroyed=T.isDestroyed,R.isDisturbed=T.isDisturbed,R.isErrored=T.isErrored,R.isReadable=T.isReadable,R.isWritable=T.isWritable,R.Readable=ES();for(const I of t(o)){let K=function(...W){if(new.target)throw c();return R.Readable.from(r(D,this,W))};const D=o[I];e(K,"name",{__proto__:null,value:D.name}),e(K,"length",{__proto__:null,value:D.length}),e(R.Readable.prototype,I,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}for(const I of t(u)){let K=function(...W){if(new.target)throw c();return r(D,this,W)};const D=u[I];e(K,"name",{__proto__:null,value:D.name}),e(K,"length",{__proto__:null,value:D.length}),e(R.Readable.prototype,I,{__proto__:null,value:K,enumerable:!1,configurable:!0,writable:!0})}R.Writable=DM(),R.Duplex=xf(),R.Transform=uz,R.PassThrough=cz,R.pipeline=m;const{addAbortSignal:O}=_S;return R.addAbortSignal=O,R.finished=v,R.destroy=w,R.compose=p,R.setDefaultHighWaterMark=h,R.getDefaultHighWaterMark=g,e(R,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return C}}),e(m,i,{__proto__:null,enumerable:!0,get(){return C.pipeline}}),e(v,i,{__proto__:null,enumerable:!0,get(){return C.finished}}),R.Stream=R,R._isUint8Array=function(D){return D instanceof Uint8Array},R._uint8ArrayToBuffer=function(D){return n.from(D.buffer,D.byteOffset,D.byteLength)},q8.exports}(function(n){const e=gz(),t=mz(),r=e.Readable.destroy;n.exports=e.Readable,n.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,n.exports._isUint8Array=e._isUint8Array,n.exports.isDisturbed=e.isDisturbed,n.exports.isErrored=e.isErrored,n.exports.isReadable=e.isReadable,n.exports.Readable=e.Readable,n.exports.Writable=e.Writable,n.exports.Duplex=e.Duplex,n.exports.Transform=e.Transform,n.exports.PassThrough=e.PassThrough,n.exports.addAbortSignal=e.addAbortSignal,n.exports.finished=e.finished,n.exports.destroy=e.destroy,n.exports.destroy=r,n.exports.pipeline=e.pipeline,n.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),n.exports.Stream=e.Stream,n.exports.default=n.exports})(vB);var cue=vB.exports;typeof globalThis.Buffer>"u"&&(globalThis.Buffer=u1().Buffer);const $y=uF,KP=cue,fue=Rs;globalThis.process||(globalThis.process=sp());if(typeof crypto>"u"){const n=l1;n.getRandomValues=e=>n.randomBytes(e.length),globalThis.crypto=n}const yi={ElvCrypto:async()=>{try{if(!yi.elvCrypto){const n=(await Promise.resolve().then(()=>require("./index-fK0-ixyS.js"))).default;yi.elvCrypto=await new n().init()}return yi.elvCrypto}catch(n){console.error("Error initializing ElvCrypto:"),console.error(n)}},EncryptedSize:n=>{const t=Math.floor(n/1e6);let r=yi.EncryptedBlockSize(1e6),i=t*r;return n%1e6!==0&&(i+=yi.EncryptedBlockSize(n%1e6)),i},EncryptedBlockSize:(n,e=!1)=>{let c=Math.floor(n/564)*576;return n%564!==0&&(c+=576),e?c+608:c+129},async EncryptConk(n,e){const t=await yi.ElvCrypto();e=new Uint8Array(Buffer.from(e.replace("0x",""),"hex")),n=new Uint8Array(Buffer.from(JSON.stringify(n)));const{data:r,ephemeralKey:i,tag:o}=await t.encryptECIES(n,e),u=Buffer.concat([Buffer.from(i),Buffer.from(o),Buffer.from(r)]);return fue.B64(u)},async DecryptCap(n,e){const t=await yi.ElvCrypto();e=new Uint8Array(Buffer.from(e.replace("0x",""),"hex")),n=Buffer.from(n,"base64");const r=n.slice(0,65),i=n.slice(65,81),o=n.slice(81),u=t.decryptECIES(new Uint8Array(o),e,new Uint8Array(r),new Uint8Array(i));return JSON.parse(Buffer.from(u).toString())},async GeneratePrimaryConk({spaceId:n,objectId:e}){const t=await yi.ElvCrypto(),{secretKey:r,publicKey:i}=t.generatePrimaryKeys(),o=t.generateSymmetricKey().key;return{symm_key:`kpsy${$y.encode(Buffer.from(o))}`,secret_key:`kpsk${$y.encode(Buffer.from(r))}`,public_key:`kppk${$y.encode(Buffer.from(i))}`,sid:n,qid:e}},async GenerateTargetConk(){const n=await yi.ElvCrypto(),{secretKey:e,publicKey:t}=n.generateTargetKeys();return{secret_key:`kpsk${$y.encode(Buffer.from(e))}`,public_key:`ktpk${$y.encode(Buffer.from(t))}`}},CapToConk(n){const e=t=>new Uint8Array($y.decode(t.slice(4)));return{symmetricKey:e(n.symm_key),secretKey:e(n.secret_key),publicKey:e(n.public_key)}},async EncryptionContext(n){const e=await yi.ElvCrypto(),{symmetricKey:t,secretKey:r,publicKey:i}=yi.CapToConk(n);let o,u;return i.length===e.PRIMARY_PK_KEY_SIZE?(u=e.CRYPTO_TYPE_PRIMARY,o=e.newPrimaryContext(i,r,t)):(u=e.CRYPTO_TYPE_TARGET,o=e.newTargetDecryptionContext(r,t)),{context:o,type:u}},Encrypt:async(n,e)=>{const t=await yi.OpenEncryptionStream(n);!Buffer.isBuffer(e)&&!(e instanceof ArrayBuffer)&&(e=Buffer.from(await new Response(e).arrayBuffer()));const r=new Uint8Array(e);for(let o=0;o<r.length;o+=1e6){const u=Math.min(r.length,o+1e6);t.write(r.slice(o,u))}t.end();let i=[];return await new Promise((o,u)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{u(c)})}),Buffer.concat(i)},OpenEncryptionStream:async n=>{const e=await yi.ElvCrypto(),{context:t}=await yi.EncryptionContext(n),r=new KP.PassThrough,i=e.createCipher(t);return r.pipe(i).on("finish",()=>{t.free()}).on("error",o=>{throw Error(o)})},Decrypt:async(n,e)=>{const t=await yi.OpenDecryptionStream(n),r=new Uint8Array(e);for(let o=0;o<r.length;o+=1e6){const u=Math.min(r.length,o+1e6);t.write(r.slice(o,u))}t.end();let i=[];return await new Promise((o,u)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{u(c)})}),Buffer.concat(i)},OpenDecryptionStream:async n=>{const e=await yi.ElvCrypto(),{context:t,type:r}=await yi.EncryptionContext(n),i=new KP.PassThrough,o=e.createDecipher(r,t);return i.pipe(o).on("finish",()=>{t.free()}).on("error",u=>{throw Error(u)})}};var bz=yi,ra={},YP;function vz(){if(YP)return ra;YP=1;const n=Rs;let e;n.Platform()===n.PLATFORM_NODE&&(globalThis.Response=hM().Response,e=l1);const t=Ro,{ValidatePresence:r,ValidateWriteToken:i,ValidatePartHash:o,ValidateParameters:u}=yc;return ra.ListFiles=async function({libraryId:c,objectId:p,versionHash:h}){u({libraryId:c,objectId:p,versionHash:h}),h&&(p=this.utils.DecodeVersionHash(h).objectId);let g=t("q",h||p,"meta","files");return this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h}),method:"GET",path:g}))},ra.UploadFilesFromS3=async function({libraryId:c,objectId:p,writeToken:h,region:g,bucket:m,fileInfo:w,accessKey:v,secret:C,signedUrl:T,encryption:R="none",copy:O=!1,callback:I}){u({libraryId:c,objectId:p}),i(h);const D=/^s3:\/\/([^/]+)\//i;for(let Se=0;Se<w.length;Se++){const _e=w[Se].source,ae=D.exec(_e);if(ae){if(ae[1]!==m)throw Error('Full S3 file path "'+_e+`" specified, but does not match provided bucket name '`+m+"'");w[Se].source=_e.replace(D,"")}}this.Log(`Uploading files from S3: ${c} ${p} ${h}`);let K;if(R==="cgck"){let Se=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});Se={...Se,secret_key:""},K=`kp__${this.utils.B58(Buffer.from(JSON.stringify(Se)))}`}let W={access_key_id:v,secret_access_key:C};T&&(W={signed_url:T});const pe={encryption_key:K,access:{protocol:"s3",platform:"aws",path:m,storage_endpoint:{region:g},cloud_credentials:W}},ce=w.map(Se=>O?{op:"ingest-copy",path:Se.path,encryption:{scheme:R==="cgck"?"cgck":"none"},ingest:{type:"key",path:Se.source}}:{op:"add-reference",path:Se.path,reference:{type:"key",path:Se.source}}),{id:ge}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:ce,defaults:pe});for(;;){await new Promise(ae=>setTimeout(ae,1e3));const Se=await this.UploadStatus({libraryId:c,objectId:p,writeToken:h,uploadId:ge});if(Se.errors&&Se.errors.length>1)throw Se.errors.join(`
320
320
  `);if(Se.error)throw this.Log(`S3 file upload failed:
321
321
  ${JSON.stringify(Se,null,2)}`),Se.error;if(Se.status.toLowerCase()==="failed")throw"File upload failed";let _e=!1;if(O){if(_e=Se.ingest_copy.done,I){const ae=Se.ingest_copy.progress;I({done:_e,uploaded:ae.bytes.completed,total:ae.bytes.total,uploadedFiles:ae.files.completed,totalFiles:ae.files.total,fileStatus:ae.files.details})}}else if(_e=Se.add_reference.done,I){const ae=Se.add_reference.progress;I({done:_e,uploadedFiles:ae.completed,totalFiles:ae.total})}if(_e)break}},ra.UploadFiles=async function({libraryId:c,objectId:p,writeToken:h,fileInfo:g,encryption:m="none",callback:w}){u({libraryId:c,objectId:p}),i(h),r("fileInfo",g),this.Log(`Uploading files: ${c} ${p} ${h}`);let v;m==="cgck"&&(v=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h}));let C={},T={},R=g;g=[];for(let S=0;S<R.length;S++){let x={...R[S],data:void 0};x.path=x.path.replace(/^\/+/,""),m==="cgck"&&(x.encryption={scheme:"cgck"}),T[x.path]=R[S].data,x.type="file",C[x.path]={uploaded:0,total:x.size},g.push(x)}this.Log(g),w&&w(C);const{id:O,jobs:I}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:g,encryption:m});this.Log(`Upload ID: ${O}`),this.Log(I);const D=500*1024*1024;let K=[],W=0,pe=0;const ce=async()=>{for(let S=0;S<I.length;S++){for(;W-pe>D;)await new Promise(U=>setTimeout(U,500));const x=I[S];let A=await this.UploadJobStatus({libraryId:c,objectId:p,writeToken:h,uploadId:O,jobId:x});for(let U=0;U<A.files.length;U++){const L=A.files[U];let z;typeof T[L.path]=="number"?(z=Buffer.alloc(L.len),e.readSync(T[L.path],z,0,L.len,L.off)):z=T[L.path].slice(L.off,L.off+L.len),m==="cgck"&&(z=await this.Crypto.Encrypt(v,z)),A.files[U].data=z,W+=L.len}K[S]=A,await new Promise(U=>setTimeout(U,50))}},ge=async(S,x)=>{for(;!K[x];)await new Promise(L=>setTimeout(L,500));const U=K[x].files;for(let L=0;L<U.length;L++){const z=U[L];let Y=0,q=!1;do try{await this.UploadFileData({libraryId:c,objectId:p,writeToken:h,uploadId:O,jobId:S,filePath:z.path,fileData:z.data,encryption:m}),q=!0}catch(P){if(this.Log(P,!0),Y+=1,Y>=10)throw P;await new Promise(M=>setTimeout(M,10*Y*1e3))}while(!q&&Y<10);delete K[x].files[L].data,pe+=z.len,w&&(C[z.path]={...C[z.path],uploaded:C[z.path].uploaded+z.len},w(C))}};ce().catch(S=>{throw S});const Se=Math.min(3,I.length);let _e=[];for(let S=0;S<Se;S++){const x=new Date().getTime();await ge(I[S],S);const A=(new Date().getTime()-x)/1e3,U=K[S].files.map(L=>L.len).reduce((L,z)=>L+z,0);_e.push(U/A/(1024*1024))}const ae=_e.reduce((S,x)=>S+x,0)/Se,Te=Math.min(5,Math.ceil(ae/2));await this.utils.LimitedMap(Te,I,async(S,x)=>{x<Se||await ge(S,x)})},ra.CreateFileUploadJob=async function({libraryId:c,objectId:p,writeToken:h,ops:g,defaults:m={},encryption:w="none"}){u({libraryId:c,objectId:p}),i(h),this.Log(`Creating file upload job: ${c} ${p} ${h}`),this.Log(g),w==="cgck"&&(m.encryption={scheme:"cgck"});const v={seq:0,seq_complete:!0,defaults:m,ops:g},C=t("q",h,"file_jobs");return this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:w}),method:"POST",path:C,body:v,allowFailover:!1}))},ra.UploadStatus=async function({libraryId:c,objectId:p,writeToken:h,uploadId:g}){u({libraryId:c,objectId:p}),i(h);const m=t("q",h,"file_jobs",g);return this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"GET",path:m,allowFailover:!1}))},ra.UploadJobStatus=async function({libraryId:c,objectId:p,writeToken:h,uploadId:g,jobId:m}){u({libraryId:c,objectId:p}),i(h);const w=t("q",h,"file_jobs",g,"uploads",m);let v=await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"GET",path:w,allowFailover:!1,queryParams:{start:0,limit:1e4}}));for(;v.next!==v.total&&v.next>=0;){const C=await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"GET",path:w,allowFailover:!1,queryParams:{start:v.next}}));v.files=[...v.files,...C.files],v.next=C.next}return v},ra.UploadFileData=async function({libraryId:c,objectId:p,writeToken:h,encryption:g,uploadId:m,jobId:w,filePath:v,fileData:C}){u({libraryId:c,objectId:p}),i(h);let R=(await this.UploadJobStatus({libraryId:c,objectId:p,writeToken:h,uploadId:m,jobId:w})).files.find(I=>I.path==v);if(g&&g!=="none"&&(R=R.encrypted),R.rem===0)return;R.skip&&(C=C.slice(R.skip));let O=t("q",h,"file_jobs",m,w);return await this.utils.ResponseToJson(this.HttpClient.Request({method:"POST",path:O,body:C,bodyType:"BINARY",headers:{"Content-type":"application/octet-stream",...await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0})},allowFailover:!1,allowRetry:!1}))},ra.FinalizeUploadJob=async function({libraryId:c,objectId:p,writeToken:h}){u({libraryId:c,objectId:p}),i(h),this.Log(`Finalizing upload job: ${c} ${p} ${h}`);const g=t("q",h,"files");await this.HttpClient.Request({method:"POST",path:g,bodyType:"BINARY",headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),allowFailover:!1})},ra.CreateFileDirectories=async function({libraryId:c,objectId:p,writeToken:h,filePaths:g}){u({libraryId:c,objectId:p}),i(h),this.Log(`Creating Directories: ${c} ${p} ${h}`),this.Log(g);const m=g.map(w=>({op:"add",type:"directory",path:w}));await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:m})},ra.MoveFiles=async function({libraryId:c,objectId:p,writeToken:h,filePaths:g}){u({libraryId:c,objectId:p}),i(h),this.Log(`Moving Files: ${c} ${p} ${h}`),this.Log(g);const m=g.map(({path:w,to:v})=>({op:"move",copy_move_source_path:w,path:v}));await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:m})},ra.DeleteFiles=async function({libraryId:c,objectId:p,writeToken:h,filePaths:g}){u({libraryId:c,objectId:p}),i(h),this.Log(`Deleting Files: ${c} ${p} ${h}`),this.Log(g);const m=g.map(w=>({op:"del",path:w}));await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:m})},ra.DownloadFile=async function({libraryId:c,objectId:p,versionHash:h,writeToken:g,filePath:m,format:w="arrayBuffer",chunked:v=!1,chunkSize:C,clientSideDecryption:T=!1,callback:R}){u({libraryId:c,objectId:p,versionHash:h}),r("filePath",m),h&&(p=this.utils.DecodeVersionHash(h).objectId);const O=await this.ContentObjectMetadata({libraryId:c,objectId:p,versionHash:h,writeToken:g,metadataSubtree:t("files",m)}),I=O&&O["."].encryption&&O["."].encryption.scheme==="cgck",D=I?"cgck":void 0,K=I&&!T?t("q",g||h||p,"rep","files_download",m):t("q",g||h||p,"files",m),W=await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h,encryption:D,makeAccessRequest:D==="cgck"});W.Accept="*/*";const pe=`eluv.caps.iusr${this.utils.AddressToHash(this.signer.address)}`,ce=await this.ContentObjectMetadata({libraryId:c,objectId:p,versionHash:h,metadataSubtree:pe});I&&!this.utils.EqualAddress(this.signer.address,await this.ContentObjectOwner({objectId:p}))&&!ce&&(W["X-Content-Fabric-Decryption-Mode"]="reencrypt"),I&&!T&&(W["X-Content-Fabric-Decryption-Mode"]="decrypt",C=Number.MAX_SAFE_INTEGER);const ge=O["."].size;if(I&&T)return await this.DownloadEncrypted({conk:await this.EncryptionConk({libraryId:c,objectId:p,versionHash:h,download:!0}),downloadPath:K,bytesTotal:ge,headers:W,callback:R,format:w,clientSideDecryption:T,chunked:v});C||(C=1e7);try{return await this.Download({downloadPath:K,bytesTotal:ge,headers:W,callback:R,format:w,chunked:v,chunkSize:C})}catch(Se){if(I&&!T)return this.DownloadFile({...arguments[0],clientSideDecryption:!0});throw Se}},ra.ContentParts=async function({libraryId:c,objectId:p,versionHash:h}){u({libraryId:c,objectId:p,versionHash:h}),this.Log(`Retrieving parts: ${c} ${p||h}`),h&&(p=this.utils.DecodeVersionHash(h).objectId);const g=t("q",h||p,"parts");return(await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h}),method:"GET",path:g}))).parts},ra.ContentPart=async function({libraryId:c,objectId:p,versionHash:h,partHash:g}){u({libraryId:c,objectId:p,versionHash:h}),o(g),this.Log(`Retrieving part: ${c} ${p||h} ${g}`),h&&(p=this.utils.DecodeVersionHash(h).objectId);let m=t("q",h||p,"parts",g);return await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h}),method:"GET",path:m}))},ra.DownloadPart=async function({libraryId:c,objectId:p,versionHash:h,writeToken:g,partHash:m,format:w="arrayBuffer",chunked:v=!1,chunkSize:C=1e7,callback:T}){u({libraryId:c,objectId:p,versionHash:h}),o(m),h&&(p=this.utils.DecodeVersionHash(h).objectId);const R=m.startsWith("hqpe"),O=R?"cgck":void 0,I=t("q",g||h||p,"data",m);let D=await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h,encryption:O,makeAccessRequest:!0});const K=(await this.ContentPart({libraryId:c,objectId:p,versionHash:h,partHash:m})).part.size;return R?(this.utils.EqualAddress(this.signer.address,await this.ContentObjectOwner({objectId:p}))||(D["X-Content-Fabric-Decryption-Mode"]="reencrypt"),await this.DownloadEncrypted({conk:await this.EncryptionConk({libraryId:c,objectId:p,download:!0}),downloadPath:I,bytesTotal:K,headers:D,callback:T,format:w,chunked:v})):await this.Download({downloadPath:I,bytesTotal:K,headers:D,callback:T,format:w,chunked:v,chunkSize:C})},ra.Download=async function({downloadPath:c,headers:p,bytesTotal:h,chunked:g=!1,chunkSize:m=2e6,callback:w,format:v="arrayBuffer"}){if(g&&!w)throw Error("No callback specified for chunked download");let C;g||(C=[]);let T=0;const R=Math.ceil(h/m);for(let O=0;O<R;O++){p.Range=`bytes=${T}-${T+m-1}`;const I=await this.HttpClient.Request({path:c,headers:p,method:"GET"});T=Math.min(T+m,h),g?w({bytesFinished:T,bytesTotal:h,chunk:await this.utils.ResponseToFormat(v,I)}):(C.push(Buffer.from(await I.arrayBuffer())),w&&w({bytesFinished:T,bytesTotal:h}))}if(!g)return await this.utils.ResponseToFormat(v,new Response(Buffer.concat(C)))},ra.DownloadEncrypted=async function({conk:c,downloadPath:p,bytesTotal:h,headers:g,callback:m,format:w="arrayBuffer",chunked:v=!1}){if(v&&!m)throw Error("No callback specified for chunked download");const C=c.public_key.startsWith("ktpk"),T=this.Crypto.EncryptedBlockSize(1e6,C);let R=0;w=w.toLowerCase();let O=[];const I=await this.Crypto.OpenDecryptionStream(c);I.on("data",async K=>{if(v){if(w!=="buffer"){const W=K.buffer.slice(K.byteOffset,K.byteOffset+K.byteLength);w==="arraybuffer"?K=W:K=await this.utils.ResponseToFormat(w,new Response(W))}m({bytesFinished:R,bytesTotal:h,chunk:K})}else m&&m({bytesFinished:R,bytesTotal:h}),O.push(K)});const D=Math.ceil(h/T);for(let K=0;K<D;K++){g.Range=`bytes=${R}-${R+T-1}`;const W=await this.HttpClient.Request({headers:g,method:"GET",path:p});R=Math.min(R+T,h),I.write(new Uint8Array(await W.arrayBuffer()))}if(I.end(),await new Promise(K=>I.on("finish",()=>{K()})),!v)return await this.utils.ResponseToFormat(w,new Response(Buffer.concat(O)))},ra.CreatePart=async function({libraryId:c,objectId:p,writeToken:h,encryption:g}){u({libraryId:c,objectId:p}),i(h);const m=t("q",h,"parts");return(await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:g}),method:"POST",path:m,bodyType:"BINARY",body:"",allowFailover:!1}))).part.write_token},ra.UploadPartChunk=async function({libraryId:c,objectId:p,writeToken:h,partWriteToken:g,chunk:m,encryption:w}){if(u({libraryId:c,objectId:p}),i(h),w&&w!=="none"){const C=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});m=await this.Crypto.Encrypt(C,m)}const v=t("q",h,"parts");await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:w}),method:"POST",path:t(v,g),body:m,bodyType:"BINARY",allowFailover:!1}))},ra.FinalizePart=async function({libraryId:c,objectId:p,writeToken:h,partWriteToken:g,encryption:m}){u({libraryId:c,objectId:p}),i(h);const w=t("q",h,"parts");return await this.utils.ResponseToJson(await this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:m}),method:"POST",path:t(w,g),bodyType:"BINARY",body:"",allowFailover:!1}))},ra.UploadPart=async function({libraryId:c,objectId:p,writeToken:h,data:g,encryption:m="none",chunkSize:w=1e7,callback:v}){u({libraryId:c,objectId:p}),i(h);const C=await this.CreatePart({libraryId:c,objectId:p,writeToken:h,encryption:m}),T=g.length||g.byteLength||g.size;v&&v({bytesFinished:0,bytesTotal:T});for(let R=0;R<T;R+=w){const O=g.slice(R,R+w);await this.UploadPartChunk({libraryId:c,objectId:p,writeToken:h,partWriteToken:C,chunk:O,encryption:m}),v&&v({bytesFinished:Math.min(R+w,T),bytesTotal:T})}return await this.FinalizePart({libraryId:c,objectId:p,writeToken:h,partWriteToken:C,encryption:m})},ra.DeletePart=async function({libraryId:c,objectId:p,writeToken:h,partHash:g}){u({libraryId:c,objectId:p}),i(h),o(g);let m=t("q",h,"parts",g);await this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"DELETE",path:m,allowFailover:!1})},ra}const JP=Ere,due=Rs,pue=bB().permissionLevels,{LogMessage:hue}=Lm,yue=bz;let wz=class x4{Log(e,t=!1){hue(this,e,t)}constructor({target:e,timeout:t=30}={}){this.permissionLevels=pue,!e&&typeof window<"u"&&window.parent&&(e=window.parent),this.target=e,this.timeout=t,this.utils=due,this.Crypto=yue,this.Crypto.ElvCrypto();for(const r of this.AllowedMethods())this[r]=async i=>{let o=i&&i.callback;return o&&delete i.callback,await this.SendMessage({options:{calledMethod:r,args:this.utils.MakeClonable(i)},callback:o})};this.userProfileClient={};for(const r of this.AllowedUserProfileMethods())this.userProfileClient[r]=async i=>{let o=i&&i.callback;return o&&delete i.callback,await this.SendMessage({options:{module:"userProfileClient",calledMethod:r,args:this.utils.MakeClonable(i),prompted:x4.PromptedMethods().includes(r)},callback:o})};this.walletClient={};for(const r of this.AllowedWalletClientMethods())this.walletClient[r]=async i=>{let o=i&&i.callback;return o&&delete i.callback,await this.SendMessage({options:{module:"walletClient",calledMethod:r,args:this.utils.MakeClonable(i)},callback:o})}}async PassRequest({request:e,Respond:t}){let r,i;try{let o;e.callbackId&&(o=u=>t({type:"ElvFrameResponse",requestId:e.callbackId,response:u})),r=await this.SendMessage({options:e,callback:o})}catch(o){i=o}return{type:"ElvFrameResponse",requestId:e.requestId,response:r,error:i}}async SendMessage({options:e={},callback:t,noResponse:r=!1}){const i=JP.next();let o;if(t&&(o=JP.next()),this.target.postMessage({...e,type:"ElvFrameRequest",requestId:i,callbackId:o},"*"),r)return;const u=e.calledMethod||e.operation,c=x4.FileMethods().includes(e.calledMethod);let p=this.timeout;return e.prompted||c?p=0:e.args&&e.args.fcTimeout&&(p=e.args.fcTimeout),await this.AwaitMessage(i,p,t,o,u)}async AwaitMessage(e,t,r,i,o){return await new Promise((u,c)=>{let p,h;const g=()=>{h&&clearTimeout(h),t>0&&(h=setTimeout(()=>{typeof window<"u"&&(window.removeEventListener("message",p),m&&window.removeEventListener("message",m)),c(`Request ${e} timed out (${o})`)},t*1e3))};let m;i&&(m=w=>{try{g();const v=w.data;if(v.type!=="ElvFrameResponse"||v.requestId!==i)return;r(v.response)}catch(v){console.error(v)}},window.addEventListener("message",m)),p=async w=>{try{const v=w.data;if(v.type!=="ElvFrameResponse"||v.requestId!==e)return;clearTimeout(h),window.removeEventListener("message",p),m&&window.removeEventListener("message",m),v.error?c(v.error):u(v.response)}catch(v){clearTimeout(h),window.removeEventListener("message",p),m&&window.removeEventListener("message",m),c(v)}},g(),window.addEventListener("message",p)})}static PromptedMethods(){return["CollectedTags","DeleteUserMetadata","MergeUserMetadata","ReplaceUserMetadata","UserMetadata"]}static MetadataMethods(){return["DeleteUserMetadata","MergeUserMetadata","ReplaceUserMetadata","UserMetadata"]}static FileMethods(){return["CreateFileUploadJob","DownloadEncrypted","DownloadFile","DownloadPart","FinalizeUploadJob","UpdateContentObjectGraph","UploadFileData","UploadFiles","UploadFilesFromS3","UploadJobStatus","UploadPart","UploadPartChunk","UploadStatus"]}OverriddenMethods(){return["UploadFiles"]}AllowedMethods(){return["AccessGroupManagers","AccessGroupMembers","AccessGroupOwner","AccessInfo","AccessRequest","AccessType","AddAccessGroupManager","AddAccessGroupMember","AddContentLibraryGroup","AddContentObjectGroupPermission","AddLibraryContentType","AssetMetadata","AvailableDRMs","AvailableOfferings","AwaitPending","BitmovinPlayoutOptions","BlockNumber","CallBitcodeMethod","CallContractMethod","CallContractMethodAndWait","ClearCache","ClearStaticToken","Collection","CollectionTransactions","ConfigUrl","ContentLibraries","ContentLibrary","ContentLibraryGroupPermissions","ContentLibraryOwner","ContentObject","ContentObjectAccessComplete","ContentObjectGraph","ContentObjectGroupPermissions","ContentObjectImageUrl","ContentObjectLibraryId","ContentObjectMetadata","ContentObjectOwner","ContentObjectTenantId","ContentObjectVersions","ContentObjects","ContentPart","ContentParts","ContentSpaceId","ContentType","ContentTypeOwner","ContentTypes","ContractAbi","ContractEvents","ContractInfo","ContractMetadata","ContractName","CopyContentObject","CreateABRMezzanine","CreateAccessGroup","CreateAndFinalizeContentObject","CreateContentLibrary","CreateContentObject","CreateContentType","CreateEncryptionConk","CreateFabricToken","CreateFileDirectories","CreateFileUploadJob","CreateLinks","CreateNTPInstance","CreateNonOwnerCap","CreatePart","CreateProductionMaster","CreateSignedToken","CurrentAccountAddress","CustomContractAddress","Decrypt","DecryptECIES","DefaultKMSAddress","DeleteAccessGroup","DeleteContentLibrary","DeleteContentObject","DeleteContentVersion","DeleteFiles","DeleteMetadata","DeleteNTPInstance","DeletePart","DeployContract","Download","DownloadEncrypted","DownloadFile","DownloadPart","EditAndFinalizeContentObject","EditContentObject","EmbedUrl","Encrypt","EncryptECIES","EncryptionConk","Events","ExtractEventFromLogs","ExtractValueFromEvent","FabricUrl","FileUrl","FinalizeABRMezzanine","FinalizeContentObject","FinalizePart","FinalizeStateChannelAccess","FinalizeUploadJob","FormatContractArguments","GenerateStateChannelToken","GenerateSignedLinkToken","GetBalance","InitializeAuthPolicy","IssueNTPCode","IssueSignedNTPCode","LatestVersionHash","LibraryContentTypes","LinkAccessGroupToOauth","LinkData","LinkTarget","LinkUrl","ListAccessGroups","ListFiles","ListNTPInstances","LRODraftInfo","LROStatus","MakeAuthServiceRequest","MergeContractMetadata","MergeMetadata","MetadataAuth","MintNFT","MoveFiles","NetworkInfo","NodeId","Nodes","NTPInstance","Permission","PlayoutOptions","PlayoutPathResolution","ProduceMetadataLinks","Proofs","PublicRep","PublishContentVersion","QParts","RecordWriteToken","RedeemCode","RemoveAccessGroupManager","RemoveAccessGroupMember","RemoveContentObjectGroupPermission","RemoveContentLibraryGroup","RemoveLibraryContentType","Rep","ReplaceContractMetadata","ReplaceMetadata","Request","ResetRegion","SendFunds","SetAccessCharge","SetAuth","SetAuthContext","SetAuthPolicy","SetContentLibraryImage","SetContentObjectImage","SetCustomContentContract","SetGroupPermission","SetNodes","SetOauthToken","SetPolicyAuthorization","SetSignerFromOauthToken","SetStaticToken","SetVisibility","SetPermission","SpaceNodes","StartABRMezzanineJobs","StreamConfig","StreamCreate","StreamInitialize","StreamInsertion","StreamStatus","StreamStartOrStopOrReset","StreamStopSession","SuspendNTPInstance","UnlinkAccessGroupFromOauth","UpdateContentObjectGraph","UpdateNTPInstance","UploadFileData","UploadFilesFromS3","UploadJobStatus","UploadPart","UploadPartChunk","UploadStatus","UseRegion","VerifyContentObject","Visibility","WriteTokenNodeUrl"]}AllowedUserProfileMethods(){return["AccessLevel","CollectedTags","CreateWallet","DeleteUserMetadata","MergeUserMetadata","PublicUserMetadata","ReplaceUserMetadata","TenantContractId","TenantId","UserMetadata","UserProfileImage","UserWalletAddress","UserWalletObjectInfo","WalletAddress"]}AllowedWalletClientMethods(){return["AcceptMarketplaceOffer","AddNotificationListener","AvailableMarketplaces","CanSign","CastVote","ClaimItem","ClaimStatus","CollectionRedemptionStatus","CreateListing","CreateMarketplaceOffer","DeployTenant","DropStatus","ExchangeRate","FilteredQuery","LatestMarketplaceHash","Leaderboard","Listing","ListingAttributes","ListingEditionNames","ListingNames","ListingPurchaseStatus","ListingStats","ListingStatus","Listings","LoadAvailableMarketplaces","LoadDrop","LoadMarketplace","Marketplace","MarketplaceCSS","MarketplaceInfo","MarketplaceOffers","MarketplaceStock","MintingStatus","NFT","NFTContractStats","Notifications","PackOpenStatus","Profile","ProfileMetadata","PurchaseStatus","PushNotification","RejectMarketplaceOffer","RemoveListing","RemoveMarketplaceOffer","RemoveProfileMetadata","RevokeVote","Sales","SalesNames","SalesStats","SetProfileMetadata","SubmitDropVote","TenantConfiguration","TransferNFT","Transfers","UserAddress","UserInfo","UserItemAttributes","UserItemEditionNames","UserItemNames","UserItems","UserListings","UserNameToAddress","UserSales","UserTransfers","UserWalletBalance","VoteStatus"]}};const{UploadFiles:mue}=vz();wz.prototype.UploadFiles=mue;eB.FrameClient=wz;const ka=Rs,c5=Ro,{FrameClient:QP}=eB,{LogMessage:gue}=Lm;let bue=class{Log(e,t=!1){gue(this,e,t)}constructor({client:e,debug:t}){this.client=e,this.debug=t,this.userWalletAddresses={},this.walletAddress=void 0,this.walletAddressRetrieved=!1}async CreateWallet(){if(this.creatingWallet)for(;this.creatingWallet;)await new Promise(e=>setTimeout(e,500));this.creatingWallet=!0;try{if(!this.walletAddress||ka.EqualAddress(this.walletAddress,ka.nullAddress)){if(this.Log(`Creating user wallet for user ${this.client.signer.address}`),await this.client.GetBalance({address:this.client.signer.address})<.1)return;const i=await this.client.CallContractMethodAndWait({contractAddress:ka.HashToAddress(this.client.contentSpaceId),methodName:"createAccessWallet",methodArgs:[]}),o=await this.client.ContractAbi({contractAddress:this.client.contentSpaceAddress});this.walletAddress=this.client.ExtractValueFromEvent({abi:o,event:i,eventName:"CreateAccessWallet",eventValue:"wallet"}),this.userWalletAddresses[ka.FormatAddress(this.client.signer.address)]=this.walletAddress}const e=this.client.contentSpaceLibraryId,t=ka.AddressToObjectId(this.walletAddress);try{await this.client.ContentObject({libraryId:e,objectId:t})}catch(r){if(r.status===404){this.Log(`Creating wallet object for user ${this.client.signer.address}`);const i=await this.client.CreateContentObject({libraryId:e,objectId:t});await this.client.FinalizeContentObject({libraryId:e,objectId:t,writeToken:i.write_token,commitMessage:"Create user wallet object"})}}}catch(e){console.error("Failed to create wallet contract:"),console.error(e)}finally{this.creatingWallet=!1}}async WalletAddress(e=!0){if(this.walletAddress||this.walletAddressRetrieved)return this.walletAddress;this.walletAddressPromise||(this.walletAddressPromise=this.client.CallContractMethod({contractAddress:ka.HashToAddress(this.client.contentSpaceId),methodName:"userWallets",methodArgs:[this.client.signer.address]}));const t=await this.walletAddressPromise;return ka.EqualAddress(t,ka.nullAddress)||(this.walletAddress=t),!this.walletAddress&&e&&await this.CreateWallet(),this.walletAddressRetrieved=!0,this.walletAddress}async UserWalletAddress({address:e}){if(ka.EqualAddress(e,this.client.signer.address))return await this.WalletAddress();if(!this.userWalletAddresses[e]){this.Log(`Retrieving user wallet address for user ${e}`);const t=await this.client.CallContractMethod({contractAddress:ka.HashToAddress(this.client.contentSpaceId),methodName:"userWallets",methodArgs:[e]});ka.EqualAddress(t,ka.nullAddress)||(this.userWalletAddresses[e]=t)}return this.userWalletAddresses[e]}async UserWalletObjectInfo({address:e}={}){const t=e?await this.UserWalletAddress({address:e}):await this.WalletAddress();return{libraryId:this.client.contentSpaceLibraryId,objectId:t?ka.AddressToObjectId(t):""}}async PublicUserMetadata({address:e,metadataSubtree:t="/",queryParams:r={},select:i=[],resolveLinks:o=!1,resolveIncludeSource:u=!1,resolveIgnoreErrors:c=!1,linkDepthLimit:p=1}){if(!e||!await this.UserWalletAddress({address:e}))return;t=c5("public",t||"/");const{libraryId:g,objectId:m}=await this.UserWalletObjectInfo({address:e});if(m)return await this.client.ContentObjectMetadata({libraryId:g,objectId:m,queryParams:r,select:i,metadataSubtree:t,resolveLinks:o,resolveIncludeSource:u,resolveIgnoreErrors:c,linkDepthLimit:p})}async UserMetadata({metadataSubtree:e="/",queryParams:t={},select:r=[],resolveLinks:i=!1,resolveIncludeSource:o=!1,resolveIgnoreErrors:u=!1,linkDepthLimit:c=1}={}){this.Log(`Accessing private user metadata at ${e}`);const{libraryId:p,objectId:h}=await this.UserWalletObjectInfo();return await this.client.ContentObjectMetadata({libraryId:p,objectId:h,metadataSubtree:e,queryParams:t,select:r,resolveLinks:i,resolveIncludeSource:o,resolveIgnoreErrors:u,linkDepthLimit:c})}async MergeUserMetadata({metadataSubtree:e="/",metadata:t={}}){this.Log(`Merging user metadata at ${e}`);const{libraryId:r,objectId:i}=await this.UserWalletObjectInfo(),o=await this.client.EditContentObject({libraryId:r,objectId:i});await this.client.MergeMetadata({libraryId:r,objectId:i,writeToken:o.write_token,metadataSubtree:e,metadata:t}),await this.client.FinalizeContentObject({libraryId:r,objectId:i,writeToken:o.write_token,commitMessage:"Merge user metadata"})}async ReplaceUserMetadata({metadataSubtree:e="/",metadata:t={}}){this.Log(`Replacing user metadata at ${e}`);const{libraryId:r,objectId:i}=await this.UserWalletObjectInfo(),o=await this.client.EditContentObject({libraryId:r,objectId:i});await this.client.ReplaceMetadata({libraryId:r,objectId:i,writeToken:o.write_token,metadataSubtree:e,metadata:t}),await this.client.FinalizeContentObject({libraryId:r,objectId:i,writeToken:o.write_token,commitMessage:"Replace user metadata"})}async DeleteUserMetadata({metadataSubtree:e="/"}){this.Log(`Deleting user metadata at ${e}`);const{libraryId:t,objectId:r}=await this.UserWalletObjectInfo(),i=await this.client.EditContentObject({libraryId:t,objectId:r});await this.client.DeleteMetadata({libraryId:t,objectId:r,writeToken:i.write_token,metadataSubtree:e}),await this.client.FinalizeContentObject({libraryId:t,objectId:r,writeToken:i.write_token,commitMessage:"Delete user metadata"})}async AccessLevel(){return await this.UserMetadata({metadataSubtree:"access_level"})||"prompt"}async SetAccessLevel({level:e}){if(e=e.toLowerCase(),!["private","prompt","public"].includes(e))throw new Error("Invalid access level: "+e);await this.ReplaceUserMetadata({metadataSubtree:"access_level",metadata:e})}async TenantId(){return this.tenantId||(this.tenantId=await this.UserMetadata({metadataSubtree:"tenantId"})),this.tenantId}async SetTenantId({id:e,address:t}){if(e&&(!e.startsWith("iten")||!ka.ValidHash(e)))throw Error(`Invalid tenant ID: ${e}`);if(t){if(!ka.ValidAddress(t))throw Error(`Invalid address: ${t}`);e=`iten${ka.AddressToHash(t)}`}try{if(await this.client.AccessType({id:e})!==this.client.authClient.ACCESS_TYPES.GROUP)throw Error("Invalid tenant ID: "+e)}catch{throw Error("Invalid tenant ID: "+e)}await this.ReplaceUserMetadata({metadataSubtree:"tenantId",metadata:e}),this.tenantId=e}async TenantContractId(){return this.tenantContractId||(this.tenantContractId=await this.UserMetadata({metadataSubtree:"tenantContractId"})),this.tenantContractId}async SetTenantContractId({tenantContractId:e,address:t}){if(e&&(!e.startsWith("iten")||!ka.ValidHash(e)))throw Error(`Invalid tenant ID: ${e}`);if(t){if(!ka.ValidAddress(t))throw Error(`Invalid address: ${t}`);e=`iten${ka.AddressToHash(t)}`}try{if(await this.client.AccessType({id:e})!==this.client.authClient.ACCESS_TYPES.TENANT)throw Error("Invalid tenant ID: "+e)}catch{throw Error("Invalid tenant ID: "+e)}const r=await this.client.CallContractMethod({contractAddress:t||ka.HashToAddress(e),methodName:"groupsMapping",methodArgs:["tenant_admin",0],formatArguments:!0});await this.MergeUserMetadata({metadata:{tenantContractId:e,tenantId:r?`iten${ka.AddressToHash(r)}`:void 0}})}async UserProfileImage({address:e,height:t}={}){let r;if(e?r=await this.UserWalletAddress({address:e}):(e=this.client.signer.address,r=this.walletAddress),!r)return;const{libraryId:i,objectId:o}=await this.UserWalletObjectInfo({address:e});return this.client.ContentObjectImageUrl({libraryId:i,objectId:o,height:t,imagePath:"public/profile_image"})}async SetUserProfileImage({image:e}){if(this.Log(`Setting profile image for user ${this.client.signer.address}`),(e.length||e.byteLength||e.size)>5e6)throw Error("Maximum profile image size is 5MB");const{libraryId:r,objectId:i}=await this.UserWalletObjectInfo(),o=await this.client.EditContentObject({libraryId:r,objectId:i});await this.client.SetContentObjectImage({libraryId:r,objectId:i,writeToken:o.write_token,image:e,imageName:"profile_image",imagePath:"public/profile_image"}),await this.client.FinalizeContentObject({libraryId:r,objectId:i,writeToken:o.write_token,commitMessage:"Set user profile image"})}async CollectedTags(){return await this.UserMetadata({metadataSubtree:"collected_data"})||{}}async RecordTags({libraryId:e,objectId:t,versionHash:r}){try{await this.__RecordTags({libraryId:e,objectId:t,versionHash:r})}catch(i){console.error(i)}}async __RecordTags({libraryId:e,objectId:t,versionHash:r}){if(await this.client.AccessType({id:t})!=="object"||(!r&&!e&&(e=await this.client.ContentObjectLibraryId({objectId:t})),r||(r=(await this.client.ContentObject({libraryId:e,objectId:t})).hash),await this.UserMetadata({metadataSubtree:c5("accessed_content",r)})))return;const u=await this.UserWalletObjectInfo(),c=u.libraryId,p=u.objectId,h=await this.client.EditContentObject({libraryId:c,objectId:p});await this.client.ReplaceMetadata({libraryId:c,objectId:p,writeToken:h.write_token,metadataSubtree:c5("accessed_content",r),metadata:Date.now()});const g=await this.client.ContentObjectMetadata({libraryId:e,objectId:t,versionHash:r,metadataSubtree:"video_tags"});if(g&&g.length>0){let m=await this.CollectedTags();const w=this.__FormatVideoTags(g);Object.keys(w).forEach(v=>{m[v]?(m[v].occurrences+=1,m[v].aggregate+=w[v]):m[v]={occurrences:1,aggregate:w[v]}}),await this.client.ReplaceMetadata({libraryId:c,objectId:p,writeToken:h.write_token,metadataSubtree:"collected_data",metadata:m})}await this.client.FinalizeContentObject({libraryId:c,objectId:p,writeToken:h.write_token,commitMessage:"Record user tags",awaitCommitConfirmation:!1})}__FormatVideoTags(e){let t={};e.forEach(i=>{i.tags.forEach(u=>{t[u.tag]?(t[u.tag].occurrences+=1,t[u.tag].aggregate+=u.score):t[u.tag]={occurrences:1,aggregate:u.score}})});let r={};return Object.keys(t).forEach(i=>{r[i]=t[i].aggregate/t[i].occurrences}),r}PromptedMethods(){return QP.PromptedMethods()}MetadataMethods(){return QP.MetadataMethods()}FrameAllowedMethods(){const e=["constructor","FrameAllowedMethods","Log","MetadataMethods","PromptedMethods","RecordTags","SetAccessLevel","SetTenantId","SetUserProfileImage","__IsLibraryCreated","__TouchLibrary","__FormatVideoTags","__RecordTags"];return Object.getOwnPropertyNames(Object.getPrototypeOf(this)).filter(t=>!e.includes(t))}};var vue=bue;const Nd=pc,Hy=Rs,wue=$h,f5=Ro;let xue=class extends Nd.Signer{constructor({signerURIs:e,idToken:t,authToken:r,tenantId:i,provider:o,extraData:u={},unsignedPublicAuth:c=!1}){super(),this.remoteSigner=!0,this.unsignedPublicAuth=c,this.HttpClient=new wue({uris:e}),this.idToken=t,this.tenantId=i,this.authToken=r,this.extraLoginData=u||{},this.provider=o,this.signatureCache={}}async Initialize(){if(!this.authToken){const{addr:e,eth:t,token:r}=await Hy.ResponseToJson(this.HttpClient.Request({path:f5("as","wlt","login","jwt"),method:"POST",body:this.tenantId?{tid:this.tenantId,ext:this.extraLoginData||{}}:{ext:this.extraLoginData||{}},headers:{Authorization:`Bearer ${this.idToken}`}}));this.authToken=r,this.address=Hy.FormatAddress(e),this.id=t}if(!this.address){const e=await Hy.ResponseToJson(this.HttpClient.Request({method:"GET",path:f5("as","wlt","keys"),headers:{Authorization:`Bearer ${this.authToken}`}})),t=e.eth[0];t&&t.startsWith("0x")?this.address=t:this.address=Hy.HashToAddress(e.eth[0])}this.id=this.address?`ikms${Hy.AddressToHash(this.address)}`:void 0,this.signer=this.provider.getSigner(this.address)}getAddress(){return this.address}async signDigest(e){return this.signatureCache[e]||(this.signatureCache[e]=new Promise(async(t,r)=>{try{let i=await Hy.ResponseToJson(this.HttpClient.Request({method:"POST",path:f5("as","wlt","sign","eth",this.id),headers:{Authorization:`Bearer ${this.authToken}`},body:{hash:e}}));i.v=parseInt(i.v,16),i.recoveryParam=i.v-27,t(i)}catch(i){r(i)}})),await this.signatureCache[e]}async signMessage(e){return Promise.resolve(Nd.utils.joinSignature(`0x${await this.signDigest(Nd.utils.hashMessage(e))}`))}async sign(e){e=await Nd.utils.resolveProperties(e);const t=await this.signDigest(Nd.utils.keccak256(Nd.utils.serializeTransaction(e)));return Nd.utils.serializeTransaction(e,t)}async sendTransaction(e){return e.nonce==null&&(e=Nd.utils.shallowCopy(e),e.nonce=await this.provider.getTransactionCount(this.address,"pending")),this.populateTransaction(e,this.provider,this.address).then(t=>this.sign(t).then(r=>this.provider.sendTransaction(r)))}connect(){}};var _ue=xue;let _4;try{_4=new TextDecoder}catch{}let Kt,Eh,ot=0;const Sue=105,Eue=57342,Cue=57343,ZP=57337,XP=6,qy={};let tr={},va,N2,P2=0,a1=0,oi,Gu,Na=[],S4=[],ao,Es,kv,eI={useRecords:!1,mapsAsObjects:!0},i1=!1,xz=2;try{new Function("")}catch{xz=1/0}class Nh{constructor(e){if(e&&((e.keyMap||e._keyMap)&&!e.useRecords&&(e.useRecords=!1,e.mapsAsObjects=!0),e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,r]of Object.entries(e.keyMap))this.mapKey.set(r,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[r,i]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(r)?this._keyMap[r]:r,i);return t}decodeKeys(e){if(!this._keyMap||e.constructor.name!="Map")return e;if(!this._mapKey){this._mapKey=new Map;for(let[r,i]of Object.entries(this._keyMap))this._mapKey.set(i,r)}let t={};return e.forEach((r,i)=>t[Qo(this._mapKey.has(i)?this._mapKey.get(i):i)]=r),t}mapDecode(e,t){let r=this.decode(e);if(this._keyMap)switch(r.constructor.name){case"Array":return r.map(i=>this.decodeKeys(i))}return r}decode(e,t){if(Kt)return Ez(()=>(I2(),this?this.decode(e,t):Nh.prototype.decode.call(eI,e,t)));Eh=t>-1?t:e.length,ot=0,a1=0,N2=null,oi=null,Kt=e;try{Es=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Kt=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Nh){if(tr=this,ao=this.sharedValues&&(this.pack?new Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return va=this.structures,W_();(!va||va.length>0)&&(va=[])}else tr=eI,(!va||va.length>0)&&(va=[]),ao=null;return W_()}decodeMultiple(e,t){let r,i=0;try{let o=e.length;i1=!0;let u=this?this.decode(e,o):HM.decode(e,o);if(t){if(t(u)===!1)return;for(;ot<o;)if(i=ot,t(W_())===!1)return}else{for(r=[u];ot<o;)i=ot,r.push(W_());return r}}catch(o){throw o.lastPosition=i,o.values=r,o}finally{i1=!1,I2()}}}function W_(){try{let n=ar();if(oi){if(ot>=oi.postBundlePosition){let e=new Error("Unexpected bundle position");throw e.incomplete=!0,e}ot=oi.postBundlePosition,oi=null}if(ot==Eh)va=null,Kt=null,Gu&&(Gu=null);else if(ot>Eh){let e=new Error("Unexpected end of CBOR data");throw e.incomplete=!0,e}else if(!i1)throw new Error("Data read, but end of buffer not reached");return n}catch(n){throw I2(),(n instanceof RangeError||n.message.startsWith("Unexpected end of buffer"))&&(n.incomplete=!0),n}}function ar(){let n=Kt[ot++],e=n>>5;if(n=n&31,n>23)switch(n){case 24:n=Kt[ot++];break;case 25:if(e==7)return Rue();n=Es.getUint16(ot),ot+=2;break;case 26:if(e==7){let t=Es.getFloat32(ot);if(tr.useFloat32>2){let r=AS[(Kt[ot]&127)<<1|Kt[ot+1]>>7];return ot+=4,(r*t+(t>0?.5:-.5)>>0)/r}return ot+=4,t}n=Es.getUint32(ot),ot+=4;break;case 27:if(e==7){let t=Es.getFloat64(ot);return ot+=8,t}if(e>1){if(Es.getUint32(ot)>0)throw new Error("JavaScript does not support arrays, maps, or strings with length over 4294967295");n=Es.getUint32(ot+4)}else tr.int64AsNumber?(n=Es.getUint32(ot)*4294967296,n+=Es.getUint32(ot+4)):n=Es.getBigUint64(ot);ot+=8;break;case 31:switch(e){case 2:case 3:throw new Error("Indefinite length not supported for byte or text strings");case 4:let t=[],r,i=0;for(;(r=ar())!=qy;)t[i++]=r;return e==4?t:e==3?t.join(""):Buffer.concat(t);case 5:let o;if(tr.mapsAsObjects){let u={};if(tr.keyMap)for(;(o=ar())!=qy;)u[Qo(tr.decodeKey(o))]=ar();else for(;(o=ar())!=qy;)u[Qo(o)]=ar();return u}else{kv&&(tr.mapsAsObjects=!0,kv=!1);let u=new Map;if(tr.keyMap)for(;(o=ar())!=qy;)u.set(tr.decodeKey(o),ar());else for(;(o=ar())!=qy;)u.set(o,ar());return u}case 7:return qy;default:throw new Error("Invalid major type for indefinite length "+e)}default:throw new Error("Unknown token "+n)}switch(e){case 0:return n;case 1:return~n;case 2:return Tue(n);case 3:if(a1>=ot)return N2.slice(ot-P2,(ot+=n)-P2);if(a1==0&&Eh<140&&n<32){let i=n<16?_z(n):kue(n);if(i!=null)return i}return Aue(n);case 4:let t=new Array(n);for(let i=0;i<n;i++)t[i]=ar();return t;case 5:if(tr.mapsAsObjects){let i={};if(tr.keyMap)for(let o=0;o<n;o++)i[Qo(tr.decodeKey(ar()))]=ar();else for(let o=0;o<n;o++)i[Qo(ar())]=ar();return i}else{kv&&(tr.mapsAsObjects=!0,kv=!1);let i=new Map;if(tr.keyMap)for(let o=0;o<n;o++)i.set(tr.decodeKey(ar()),ar());else for(let o=0;o<n;o++)i.set(ar(),ar());return i}case 6:if(n>=ZP){let i=va[n&8191];if(i)return i.read||(i.read=E4(i)),i.read();if(n<65536){if(n==Cue){let o=am(),u=ar(),c=ar();A4(u,c);let p={};if(tr.keyMap)for(let h=2;h<o;h++){let g=tr.decodeKey(c[h-2]);p[Qo(g)]=ar()}else for(let h=2;h<o;h++){let g=c[h-2];p[Qo(g)]=ar()}return p}else if(n==Eue){let o=am(),u=ar();for(let c=2;c<o;c++)A4(u++,ar());return ar()}else if(n==ZP)return Due();if(tr.getShared&&($M(),i=va[n&8191],i))return i.read||(i.read=E4(i)),i.read()}}let r=Na[n];if(r)return r.handlesRead?r(ar):r(ar());{let i=ar();for(let o=0;o<S4.length;o++){let u=S4[o](n,i);if(u!==void 0)return u}return new ep(i,n)}case 7:switch(n){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;case 31:default:let i=(ao||hh())[n];if(i!==void 0)return i;throw new Error("Unknown token "+n)}default:if(isNaN(n)){let i=new Error("Unexpected end of CBOR data");throw i.incomplete=!0,i}throw new Error("Unknown CBOR token "+n)}}const tI=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function E4(n){function e(){let t=Kt[ot++];if(t=t&31,t>23)switch(t){case 24:t=Kt[ot++];break;case 25:t=Es.getUint16(ot),ot+=2;break;case 26:t=Es.getUint32(ot),ot+=4;break;default:throw new Error("Expected array header, but got "+Kt[ot-1])}let r=this.compiledReader;for(;r;){if(r.propertyCount===t)return r(ar);r=r.next}if(this.slowReads++>=xz){let o=this.length==t?this:this.slice(0,t);return r=tr.keyMap?new Function("r","return {"+o.map(u=>tr.decodeKey(u)).map(u=>tI.test(u)?Qo(u)+":r()":"["+JSON.stringify(u)+"]:r()").join(",")+"}"):new Function("r","return {"+o.map(u=>tI.test(u)?Qo(u)+":r()":"["+JSON.stringify(u)+"]:r()").join(",")+"}"),this.compiledReader&&(r.next=this.compiledReader),r.propertyCount=t,this.compiledReader=r,r(ar)}let i={};if(tr.keyMap)for(let o=0;o<t;o++)i[Qo(tr.decodeKey(this[o]))]=ar();else for(let o=0;o<t;o++)i[Qo(this[o])]=ar();return i}return n.slowReads=0,e}function Qo(n){if(typeof n=="string")return n==="__proto__"?"__proto_":n;if(typeof n!="object")return n.toString();throw new Error("Invalid property name type "+typeof n)}let Aue=C4,Mue=!1;function C4(n){let e;if(n<16&&(e=_z(n)))return e;if(n>64&&_4)return _4.decode(Kt.subarray(ot,ot+=n));const t=ot+n,r=[];for(e="";ot<t;){const i=Kt[ot++];if(!(i&128))r.push(i);else if((i&224)===192){const o=Kt[ot++]&63;r.push((i&31)<<6|o)}else if((i&240)===224){const o=Kt[ot++]&63,u=Kt[ot++]&63;r.push((i&31)<<12|o<<6|u)}else if((i&248)===240){const o=Kt[ot++]&63,u=Kt[ot++]&63,c=Kt[ot++]&63;let p=(i&7)<<18|o<<12|u<<6|c;p>65535&&(p-=65536,r.push(p>>>10&1023|55296),p=56320|p&1023),r.push(p)}else r.push(i);r.length>=4096&&(e+=mi.apply(String,r),r.length=0)}return r.length>0&&(e+=mi.apply(String,r)),e}let mi=String.fromCharCode;function kue(n){let e=ot,t=new Array(n);for(let r=0;r<n;r++){const i=Kt[ot++];if((i&128)>0){ot=e;return}t[r]=i}return mi.apply(String,t)}function _z(n){if(n<4)if(n<2){if(n===0)return"";{let e=Kt[ot++];if((e&128)>1){ot-=1;return}return mi(e)}}else{let e=Kt[ot++],t=Kt[ot++];if((e&128)>0||(t&128)>0){ot-=2;return}if(n<3)return mi(e,t);let r=Kt[ot++];if((r&128)>0){ot-=3;return}return mi(e,t,r)}else{let e=Kt[ot++],t=Kt[ot++],r=Kt[ot++],i=Kt[ot++];if((e&128)>0||(t&128)>0||(r&128)>0||(i&128)>0){ot-=4;return}if(n<6){if(n===4)return mi(e,t,r,i);{let o=Kt[ot++];if((o&128)>0){ot-=5;return}return mi(e,t,r,i,o)}}else if(n<8){let o=Kt[ot++],u=Kt[ot++];if((o&128)>0||(u&128)>0){ot-=6;return}if(n<7)return mi(e,t,r,i,o,u);let c=Kt[ot++];if((c&128)>0){ot-=7;return}return mi(e,t,r,i,o,u,c)}else{let o=Kt[ot++],u=Kt[ot++],c=Kt[ot++],p=Kt[ot++];if((o&128)>0||(u&128)>0||(c&128)>0||(p&128)>0){ot-=8;return}if(n<10){if(n===8)return mi(e,t,r,i,o,u,c,p);{let h=Kt[ot++];if((h&128)>0){ot-=9;return}return mi(e,t,r,i,o,u,c,p,h)}}else if(n<12){let h=Kt[ot++],g=Kt[ot++];if((h&128)>0||(g&128)>0){ot-=10;return}if(n<11)return mi(e,t,r,i,o,u,c,p,h,g);let m=Kt[ot++];if((m&128)>0){ot-=11;return}return mi(e,t,r,i,o,u,c,p,h,g,m)}else{let h=Kt[ot++],g=Kt[ot++],m=Kt[ot++],w=Kt[ot++];if((h&128)>0||(g&128)>0||(m&128)>0||(w&128)>0){ot-=12;return}if(n<14){if(n===12)return mi(e,t,r,i,o,u,c,p,h,g,m,w);{let v=Kt[ot++];if((v&128)>0){ot-=13;return}return mi(e,t,r,i,o,u,c,p,h,g,m,w,v)}}else{let v=Kt[ot++],C=Kt[ot++];if((v&128)>0||(C&128)>0){ot-=14;return}if(n<15)return mi(e,t,r,i,o,u,c,p,h,g,m,w,v,C);let T=Kt[ot++];if((T&128)>0){ot-=15;return}return mi(e,t,r,i,o,u,c,p,h,g,m,w,v,C,T)}}}}}function Tue(n){return tr.copyBuffers?Uint8Array.prototype.slice.call(Kt,ot,ot+=n):Kt.subarray(ot,ot+=n)}let jM=new Float32Array(1),rm=new Uint8Array(jM.buffer,0,4);function Rue(){let n=Kt[ot++],e=Kt[ot++],t=(n&127)>>2;if(t===31)return e||n&3?NaN:n&128?-1/0:1/0;if(t===0){let r=((n&3)<<8|e)/16777216;return n&128?-r:r}return rm[3]=n&128|(t>>1)+56,rm[2]=(n&7)<<5|e>>3,rm[1]=e<<5,rm[0]=0,jM[0]}new Array(4096);class ep{constructor(e,t){this.value=e,this.tag=t}}Na[0]=n=>new Date(n);Na[1]=n=>new Date(Math.round(n*1e3));Na[2]=n=>{let e=BigInt(0);for(let t=0,r=n.byteLength;t<r;t++)e=BigInt(n[t])+e<<BigInt(8);return e};Na[3]=n=>BigInt(-1)-Na[2](n);Na[4]=n=>+(n[1]+"e"+n[0]);Na[5]=n=>n[1]*Math.exp(n[0]*Math.log(2));const A4=(n,e)=>{n=n-57344;let t=va[n];t&&t.isShared&&((va.restoreStructures||(va.restoreStructures=[]))[n]=t),va[n]=e,e.read=E4(e)};Na[Sue]=n=>{let e=n.length,t=n[1];A4(n[0],t);let r={};for(let i=2;i<e;i++){let o=t[i-2];r[Qo(o)]=n[i]}return r};Na[14]=n=>oi?oi[0].slice(oi.position0,oi.position0+=n):new ep(n,14);Na[15]=n=>oi?oi[1].slice(oi.position1,oi.position1+=n):new ep(n,15);let Oue={Error,RegExp};Na[27]=n=>(Oue[n[0]]||Error)(n[1],n[2]);const Sz=n=>{if(Kt[ot++]!=132){let t=new Error("Packed values structure must be followed by a 4 element array");throw Kt.length<ot&&(t.incomplete=!0),t}let e=n();if(!e||!e.length){let t=new Error("Packed values structure must be followed by a 4 element array");throw t.incomplete=!0,t}return ao=ao?e.concat(ao.slice(e.length)):e,ao.prefixes=n(),ao.suffixes=n(),n()};Sz.handlesRead=!0;Na[51]=Sz;Na[XP]=n=>{if(!ao)if(tr.getShared)$M();else return new ep(n,XP);if(typeof n=="number")return ao[16+(n>=0?2*n:-2*n-1)];let e=new Error("No support for non-integer packed references yet");throw n===void 0&&(e.incomplete=!0),e};Na[28]=n=>{Gu||(Gu=new Map,Gu.id=0);let e=Gu.id++,t=Kt[ot],r;t>>5==4?r=[]:r={};let i={target:r};Gu.set(e,i);let o=n();return i.used?Object.assign(r,o):(i.target=o,o)};Na[28].handlesRead=!0;Na[29]=n=>{let e=Gu.get(n);return e.used=!0,e.target};Na[258]=n=>new Set(n);(Na[259]=n=>(tr.mapsAsObjects&&(tr.mapsAsObjects=!1,kv=!0),n())).handlesRead=!0;function Vy(n,e){return typeof n=="string"?n+e:n instanceof Array?n.concat(e):Object.assign({},n,e)}function hh(){if(!ao)if(tr.getShared)$M();else throw new Error("No packed values available");return ao}const Lue=1399353956;S4.push((n,e)=>{if(n>=225&&n<=255)return Vy(hh().prefixes[n-224],e);if(n>=28704&&n<=32767)return Vy(hh().prefixes[n-28672],e);if(n>=1879052288&&n<=2147483647)return Vy(hh().prefixes[n-1879048192],e);if(n>=216&&n<=223)return Vy(e,hh().suffixes[n-216]);if(n>=27647&&n<=28671)return Vy(e,hh().suffixes[n-27639]);if(n>=1811940352&&n<=1879048191)return Vy(e,hh().suffixes[n-1811939328]);if(n==Lue)return{packedValues:ao,structures:va.slice(0),version:e};if(n==55799)return e});const Nue=new Uint8Array(new Uint16Array([1]).buffer)[0]==1,nI=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>"u"?{name:"BigUint64Array"}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>"u"?{name:"BigInt64Array"}:BigInt64Array,Float32Array,Float64Array],Pue=[64,68,69,70,71,72,77,78,79,85,86];for(let n=0;n<nI.length;n++)Iue(nI[n],Pue[n]);function Iue(n,e){let t="get"+n.name.slice(0,-5),r;typeof n=="function"?r=n.BYTES_PER_ELEMENT:n=null;for(let i=0;i<2;i++){if(!i&&r==1)continue;let o=r==2?1:r==4?2:3;Na[i?e:e-4]=r==1||i==Nue?u=>{if(!n)throw new Error("Could not find typed array for code "+e);return!tr.copyBuffers&&(r===1||r===2&&!(u.byteOffset&1)||r===4&&!(u.byteOffset&3)||r===8&&!(u.byteOffset&7))?new n(u.buffer,u.byteOffset,u.byteLength):new n(Uint8Array.prototype.slice.call(u,0).buffer)}:u=>{if(!n)throw new Error("Could not find typed array for code "+e);let c=new DataView(u.buffer,u.byteOffset,u.byteLength),p=u.length>>o,h=new n(p),g=c[t];for(let m=0;m<p;m++)h[m]=g.call(c,m<<o,i);return h}}}function Due(){let n=am(),e=ot+ar();for(let r=2;r<n;r++){let i=am();ot+=i}let t=ot;return ot=e,oi=[C4(am()),C4(am())],oi.position0=0,oi.position1=0,oi.postBundlePosition=ot,ot=t,ar()}function am(){let n=Kt[ot++]&31;if(n>23)switch(n){case 24:n=Kt[ot++];break;case 25:n=Es.getUint16(ot),ot+=2;break;case 26:n=Es.getUint32(ot),ot+=4;break}return n}function $M(){if(tr.getShared){let n=Ez(()=>(Kt=null,tr.getShared()))||{},e=n.structures||[];tr.sharedVersion=n.version,ao=tr.sharedValues=n.packedValues,va===!0?tr.structures=va=e:va.splice.apply(va,[0,e.length].concat(e))}}function Ez(n){let e=Eh,t=ot,r=P2,i=a1,o=N2,u=Gu,c=oi,p=new Uint8Array(Kt.slice(0,Eh)),h=va,g=tr,m=i1,w=n();return Eh=e,ot=t,P2=r,a1=i,N2=o,Gu=u,oi=c,Kt=p,i1=m,va=h,tr=g,Es=new DataView(Kt.buffer,Kt.byteOffset,Kt.byteLength),w}function I2(){Kt=null,Gu=null,va=null}function Uue(n){Na[n.tag]=n.decode}const AS=new Array(147);for(let n=0;n<256;n++)AS[n]=+("1e"+Math.floor(45.15-n*.30103));let HM=new Nh({useRecords:!1});const Fue=HM.decode,Bue=HM.decodeMultiple,Cz={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};function zue(n){jM[0]=n;let e=AS[(rm[3]&127)<<1|rm[2]>>7];return(e*n+(n>0?.5:-.5)>>0)/e}let c2;try{c2=new TextEncoder}catch{}let D2,qM;const MS=typeof globalThis=="object"&&globalThis.Buffer,M1=typeof MS<"u",d5=M1?MS.allocUnsafeSlow:Uint8Array,rI=M1?MS:Uint8Array,aI=256,iI=M1?4294967296:2144337920;let p5,We,Jr,De=0,Pd,ai=null;const jue=61440,$ue=/[\u0080-\uFFFF]/,wo=Symbol("record-id");class kS extends Nh{constructor(e){super(e),this.offset=0;let t,r,i,o,u;e=e||{};let c=rI.prototype.utf8Write?function(S,x,A){return We.utf8Write(S,x,A)}:c2&&c2.encodeInto?function(S,x){return c2.encodeInto(S,We.subarray(x)).written}:!1,p=this,h=e.structures||e.saveStructures,g=e.maxSharedStructures;if(g==null&&(g=h?128:0),g>8190)throw new Error("Maximum maxSharedStructure is 8190");let m=e.sequential;m&&(g=0),this.structures||(this.structures=[]),this.saveStructures&&(this.saveShared=this.saveStructures);let w,v,C=e.sharedValues,T;if(C){T=Object.create(null);for(let S=0,x=C.length;S<x;S++)T[C[S]]=S}let R=[],O=0,I=0;this.mapEncode=function(S,x){if(this._keyMap&&!this._mapped)switch(S.constructor.name){case"Array":S=S.map(A=>this.encodeKeys(A));break}return this.encode(S,x)},this.encode=function(S,x){if(We||(We=new d5(8192),Jr=new DataView(We.buffer,0,8192),De=0),Pd=We.length-10,Pd-De<2048?(We=new d5(We.length),Jr=new DataView(We.buffer,0,We.length),Pd=We.length-10,De=0):x===M4&&(De=De+7&2147483640),t=De,p.useSelfDescribedHeader&&(Jr.setUint32(De,3654940416),De+=3),u=p.structuredClone?new Map:null,p.bundleStrings&&typeof S!="string"?(ai=[],ai.size=1/0):ai=null,r=p.structures,r){if(r.uninitialized){let U=p.getShared()||{};p.structures=r=U.structures||[],p.sharedVersion=U.version;let L=p.sharedValues=U.packedValues;if(L){T={};for(let z=0,Y=L.length;z<Y;z++)T[L[z]]=z}}let A=r.length;if(A>g&&!m&&(A=g),!r.transitions){r.transitions=Object.create(null);for(let U=0;U<A;U++){let L=r[U];if(!L)continue;let z,Y=r.transitions;for(let q=0,P=L.length;q<P;q++){Y[wo]===void 0&&(Y[wo]=U);let M=L[q];z=Y[M],z||(z=Y[M]=Object.create(null)),Y=z}Y[wo]=U|1048576}}m||(r.nextId=A)}if(i&&(i=!1),o=r||[],v=T,e.pack){let A=new Map;if(A.values=[],A.encoder=p,A.maxValues=e.maxPrivatePackedValues||(T?16:1/0),A.objectMap=T||!1,A.samplingPackedValues=w,f2(S,A),A.values.length>0){We[De++]=216,We[De++]=51,Wl(4);let U=A.values;D(U),Wl(0),Wl(0),v=Object.create(T||null);for(let L=0,z=U.length;L<z;L++)v[U[L]]=L}}p5=x&y5;try{if(p5)return;if(D(S),ai&&uI(t,D),p.offset=De,u&&u.idsToInsert){De+=u.idsToInsert.length*2,De>Pd&&W(De),p.offset=De;let A=Vue(We.subarray(t,De),u.idsToInsert);return u=null,A}return x&M4?(We.start=t,We.end=De,We):We.subarray(t,De)}finally{if(r){if(I<10&&I++,r.length>g&&(r.length=g),O>1e4)r.transitions=null,I=0,O=0,R.length>0&&(R=[]);else if(R.length>0&&!m){for(let A=0,U=R.length;A<U;A++)R[A][wo]=void 0;R=[]}}if(i&&p.saveShared){p.structures.length>g&&(p.structures=p.structures.slice(0,g));let A=We.subarray(t,De);return p.updateSharedData()===!1?p.encode(S):A}x&ele&&(De=t)}},this.findCommonStringsToPack=()=>(w=new Map,T||(T=Object.create(null)),S=>{let x=S&&S.threshold||4,A=this.pack?S.maxPrivatePackedValues||16:0;C||(C=this.sharedValues=[]);for(let[U,L]of w)L.count>x&&(T[U]=A++,C.push(U),i=!0);for(;this.saveShared&&this.updateSharedData()===!1;);w=null});const D=S=>{De>Pd&&(We=W(De));var x=typeof S,A;if(x==="string"){if(v){let Y=v[S];if(Y>=0){Y<16?We[De++]=Y+224:(We[De++]=198,Y&1?D(15-Y>>1):D(Y-16>>1));return}else if(w&&!e.pack){let q=w.get(S);q?q.count++:w.set(S,{count:1})}}let U=S.length;if(ai&&U>=4&&U<1024){if((ai.size+=U)>jue){let q,P=(ai[0]?ai[0].length*3+ai[1].length:0)+10;De+P>Pd&&(We=W(De+P)),We[De++]=217,We[De++]=223,We[De++]=249,We[De++]=ai.position?132:130,We[De++]=26,q=De-t,De+=4,ai.position&&uI(t,D),ai=["",""],ai.size=0,ai.position=q}let Y=$ue.test(S);ai[Y?0:1]+=S,We[De++]=Y?206:207,D(U);return}let L;U<32?L=1:U<256?L=2:U<65536?L=3:L=5;let z=U*3;if(De+z>Pd&&(We=W(De+z)),U<64||!c){let Y,q,P,M=De+L;for(Y=0;Y<U;Y++)q=S.charCodeAt(Y),q<128?We[M++]=q:q<2048?(We[M++]=q>>6|192,We[M++]=q&63|128):(q&64512)===55296&&((P=S.charCodeAt(Y+1))&64512)===56320?(q=65536+((q&1023)<<10)+(P&1023),Y++,We[M++]=q>>18|240,We[M++]=q>>12&63|128,We[M++]=q>>6&63|128,We[M++]=q&63|128):(We[M++]=q>>12|224,We[M++]=q>>6&63|128,We[M++]=q&63|128);A=M-De-L}else A=c(S,De+L,z);A<24?We[De++]=96|A:A<256?(L<2&&We.copyWithin(De+2,De+1,De+1+A),We[De++]=120,We[De++]=A):A<65536?(L<3&&We.copyWithin(De+3,De+2,De+2+A),We[De++]=121,We[De++]=A>>8,We[De++]=A&255):(L<5&&We.copyWithin(De+5,De+3,De+3+A),We[De++]=122,Jr.setUint32(De,A),De+=4),De+=A}else if(x==="number")if(!this.alwaysUseFloat&&S>>>0===S)S<24?We[De++]=S:S<256?(We[De++]=24,We[De++]=S):S<65536?(We[De++]=25,We[De++]=S>>8,We[De++]=S&255):(We[De++]=26,Jr.setUint32(De,S),De+=4);else if(!this.alwaysUseFloat&&S>>0===S)S>=-24?We[De++]=31-S:S>=-256?(We[De++]=56,We[De++]=~S):S>=-65536?(We[De++]=57,Jr.setUint16(De,~S),De+=2):(We[De++]=58,Jr.setUint32(De,~S),De+=4);else{let U;if((U=this.useFloat32)>0&&S<4294967296&&S>=-2147483648){We[De++]=250,Jr.setFloat32(De,S);let L;if(U<4||(L=S*AS[(We[De]&127)<<1|We[De+1]>>7])>>0===L){De+=4;return}else De--}We[De++]=251,Jr.setFloat64(De,S),De+=8}else if(x==="object")if(!S)We[De++]=246;else{if(u){let L=u.get(S);if(L){if(We[De++]=216,We[De++]=29,We[De++]=25,!L.references){let z=u.idsToInsert||(u.idsToInsert=[]);L.references=[],z.push(L)}L.references.push(De-t),De+=2;return}else u.set(S,{offset:De-t})}let U=S.constructor;if(U===Object)K(S,!0);else if(U===Array){A=S.length,A<24?We[De++]=128|A:Wl(A);for(let L=0;L<A;L++)D(S[L])}else if(U===Map)if((this.mapsAsObjects?this.useTag259ForMaps!==!1:this.useTag259ForMaps)&&(We[De++]=217,We[De++]=1,We[De++]=3),A=S.size,A<24?We[De++]=160|A:A<256?(We[De++]=184,We[De++]=A):A<65536?(We[De++]=185,We[De++]=A>>8,We[De++]=A&255):(We[De++]=186,Jr.setUint32(De,A),De+=4),p.keyMap)for(let[L,z]of S)D(p.encodeKey(L)),D(z);else for(let[L,z]of S)D(L),D(z);else{for(let L=0,z=D2.length;L<z;L++){let Y=qM[L];if(S instanceof Y){let q=D2[L],P=q.tag;P==null&&(P=q.getTag&&q.getTag.call(this,S)),P<24?We[De++]=192|P:P<256?(We[De++]=216,We[De++]=P):P<65536?(We[De++]=217,We[De++]=P>>8,We[De++]=P&255):P>-1&&(We[De++]=218,Jr.setUint32(De,P),De+=4),q.encode.call(this,S,D,W);return}}if(S[Symbol.iterator]){if(p5){let L=new Error("Iterable should be serialized as iterator");throw L.iteratorNotHandled=!0,L}We[De++]=159;for(let L of S)D(L);We[De++]=255;return}if(S[Symbol.asyncIterator]||h5(S)){let L=new Error("Iterable/blob should be serialized as iterator");throw L.iteratorNotHandled=!0,L}if(this.useToJSON&&S.toJSON){const L=S.toJSON();if(L!==S)return D(L)}K(S,!S.hasOwnProperty)}}else if(x==="boolean")We[De++]=S?245:244;else if(x==="bigint"){if(S<BigInt(1)<<BigInt(64)&&S>=0)We[De++]=27,Jr.setBigUint64(De,S);else if(S>-(BigInt(1)<<BigInt(64))&&S<0)We[De++]=59,Jr.setBigUint64(De,-S-BigInt(1));else if(this.largeBigIntToFloat)We[De++]=251,Jr.setFloat64(De,Number(S));else throw new RangeError(S+" was too large to fit in CBOR 64-bit integer format, set largeBigIntToFloat to convert to float-64");De+=8}else if(x==="undefined")We[De++]=247;else throw new Error("Unknown type: "+x)},K=this.useRecords===!1?this.variableMapSize?S=>{let x=Object.keys(S),A=Object.values(S),U=x.length;if(U<24?We[De++]=160|U:U<256?(We[De++]=184,We[De++]=U):U<65536?(We[De++]=185,We[De++]=U>>8,We[De++]=U&255):(We[De++]=186,Jr.setUint32(De,U),De+=4),p.keyMap)for(let L=0;L<U;L++)D(p.encodeKey(x[L])),D(A[L]);else for(let L=0;L<U;L++)D(x[L]),D(A[L])}:(S,x)=>{We[De++]=185;let A=De-t;De+=2;let U=0;if(p.keyMap)for(let L in S)(x||S.hasOwnProperty(L))&&(D(p.encodeKey(L)),D(S[L]),U++);else for(let L in S)(x||S.hasOwnProperty(L))&&(D(L),D(S[L]),U++);We[A+++t]=U>>8,We[A+t]=U&255}:(S,x)=>{let A,U=o.transitions||(o.transitions=Object.create(null)),L=0,z=0,Y,q;if(this.keyMap){q=Object.keys(S).map(M=>this.encodeKey(M)),z=q.length;for(let M=0;M<z;M++){let Q=q[M];A=U[Q],A||(A=U[Q]=Object.create(null),L++),U=A}}else for(let M in S)(x||S.hasOwnProperty(M))&&(A=U[M],A||(U[wo]&1048576&&(Y=U[wo]&65535),A=U[M]=Object.create(null),L++),U=A,z++);let P=U[wo];if(P!==void 0)P&=65535,We[De++]=217,We[De++]=P>>8|224,We[De++]=P&255;else if(q||(q=U.__keys__||(U.__keys__=Object.keys(S))),Y===void 0?(P=o.nextId++,P||(P=0,o.nextId=1),P>=aI&&(o.nextId=(P=g)+1)):P=Y,o[P]=q,P<g){We[De++]=217,We[De++]=P>>8|224,We[De++]=P&255,U=o.transitions;for(let M=0;M<z;M++)(U[wo]===void 0||U[wo]&1048576)&&(U[wo]=P),U=U[q[M]];U[wo]=P|1048576,i=!0}else{if(U[wo]=P,Jr.setUint32(De,3655335680),De+=3,L&&(O+=I*L),R.length>=aI-g&&(R.shift()[wo]=void 0),R.push(U),Wl(z+2),D(57344+P),D(q),x===null)return;for(let M in S)(x||S.hasOwnProperty(M))&&D(S[M]);return}if(z<24?We[De++]=128|z:Wl(z),x!==null)for(let M in S)(x||S.hasOwnProperty(M))&&D(S[M])},W=S=>{let x;if(S>16777216){if(S-t>iI)throw new Error("Encoded buffer would be larger than maximum buffer size");x=Math.min(iI,Math.round(Math.max((S-t)*(S>67108864?1.25:2),4194304)/4096)*4096)}else x=(Math.max(S-t<<2,We.length-1)>>12)+1<<12;let A=new d5(x);return Jr=new DataView(A.buffer,0,x),We.copy?We.copy(A,0,t,S):A.set(We.slice(t,S)),De-=t,t=0,Pd=A.length-10,We=A};let pe=100,ce=1e3;this.encodeAsIterable=function(S,x){return ae(S,x,ge)},this.encodeAsAsyncIterable=function(S,x){return ae(S,x,Te)};function*ge(S,x,A){let U=S.constructor;if(U===Object){let L=p.useRecords!==!1;L?K(S,null):sI(Object.keys(S).length,160);for(let z in S){let Y=S[z];L||D(z),Y&&typeof Y=="object"?x[z]?yield*ge(Y,x[z]):yield*Se(Y,x,z):D(Y)}}else if(U===Array){let L=S.length;Wl(L);for(let z=0;z<L;z++){let Y=S[z];Y&&(typeof Y=="object"||De-t>pe)?x.element?yield*ge(Y,x.element):yield*Se(Y,x,"element"):D(Y)}}else if(S[Symbol.iterator]){We[De++]=159;for(let L of S)L&&(typeof L=="object"||De-t>pe)?x.element?yield*ge(L,x.element):yield*Se(L,x,"element"):D(L);We[De++]=255}else h5(S)?(sI(S.size,64),yield We.subarray(t,De),yield S,_e()):S[Symbol.asyncIterator]?(We[De++]=159,yield We.subarray(t,De),yield S,_e(),We[De++]=255):D(S);A&&De>t?yield We.subarray(t,De):De-t>pe&&(yield We.subarray(t,De),_e())}function*Se(S,x,A){let U=De-t;try{D(S),De-t>pe&&(yield We.subarray(t,De),_e())}catch(L){if(L.iteratorNotHandled)x[A]={},De=t+U,yield*ge.call(this,S,x[A]);else throw L}}function _e(){pe=ce,p.encode(null,y5)}function ae(S,x,A){return x&&x.chunkThreshold?pe=ce=x.chunkThreshold:pe=100,S&&typeof S=="object"?(p.encode(null,y5),A(S,p.iterateProperties||(p.iterateProperties={}),!0)):[p.encode(S)]}async function*Te(S,x){for(let A of ge(S,x,!0)){let U=A.constructor;if(U===rI||U===Uint8Array)yield A;else if(h5(A)){let L=A.stream().getReader(),z;for(;!(z=await L.read()).done;)yield z.value}else if(A[Symbol.asyncIterator])for await(let L of A)_e(),L?yield*Te(L,x.async||(x.async={})):yield p.encode(L);else yield A}}}useBuffer(e){We=e,Jr=new DataView(We.buffer,We.byteOffset,We.byteLength),De=0}clearSharedData(){this.structures&&(this.structures=[]),this.sharedValues&&(this.sharedValues=void 0)}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),r=new Az(t,this.sharedValues,this.sharedVersion),i=this.saveShared(r,o=>(o&&o.version||0)==e);return i===!1?(r=this.getShared()||{},this.structures=r.structures||[],this.sharedValues=r.packedValues,this.sharedVersion=r.version,this.structures.nextId=this.structures.length):t.forEach((o,u)=>this.structures[u]=o),i}}function sI(n,e){n<24?We[De++]=e|n:n<256?(We[De++]=e|24,We[De++]=n):n<65536?(We[De++]=e|25,We[De++]=n>>8,We[De++]=n&255):(We[De++]=e|26,Jr.setUint32(De,n),De+=4)}class Az{constructor(e,t,r){this.structures=e,this.packedValues=t,this.version=r}}function Wl(n){n<24?We[De++]=128|n:n<256?(We[De++]=152,We[De++]=n):n<65536?(We[De++]=153,We[De++]=n>>8,We[De++]=n&255):(We[De++]=154,Jr.setUint32(De,n),De+=4)}const Hue=typeof Blob>"u"?function(){}:Blob;function h5(n){if(n instanceof Hue)return!0;let e=n[Symbol.toStringTag];return e==="Blob"||e==="File"}function f2(n,e){switch(typeof n){case"string":if(n.length>3){if(e.objectMap[n]>-1||e.values.length>=e.maxValues)return;let r=e.get(n);if(r)++r.count==2&&e.values.push(n);else if(e.set(n,{count:1}),e.samplingPackedValues){let i=e.samplingPackedValues.get(n);i?i.count++:e.samplingPackedValues.set(n,{count:1})}}break;case"object":if(n)if(n instanceof Array)for(let r=0,i=n.length;r<i;r++)f2(n[r],e);else{let r=!e.encoder.useRecords;for(var t in n)n.hasOwnProperty(t)&&(r&&f2(t,e),f2(n[t],e))}break;case"function":console.log(n)}}const que=new Uint8Array(new Uint16Array([1]).buffer)[0]==1;qM=[Date,Set,Error,RegExp,ep,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>"u"?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>"u"?function(){}:BigInt64Array,Float32Array,Float64Array,Az];D2=[{tag:1,encode(n,e){let t=n.getTime()/1e3;(this.useTimestamp32||n.getMilliseconds()===0)&&t>=0&&t<4294967296?(We[De++]=26,Jr.setUint32(De,t),De+=4):(We[De++]=251,Jr.setFloat64(De,t),De+=8)}},{tag:258,encode(n,e){let t=Array.from(n);e(t)}},{tag:27,encode(n,e){e([n.name,n.message])}},{tag:27,encode(n,e){e(["RegExp",n.source,n.flags])}},{getTag(n){return n.tag},encode(n,e){e(n.value)}},{encode(n,e,t){oI(n,t)}},{getTag(n){if(n.constructor===Uint8Array&&(this.tagUint8Array||M1&&this.tagUint8Array!==!1))return 64},encode(n,e,t){oI(n,t)}},Hl(68,1),Hl(69,2),Hl(70,4),Hl(71,8),Hl(72,1),Hl(77,2),Hl(78,4),Hl(79,8),Hl(85,4),Hl(86,8),{encode(n,e){let t=n.packedValues||[],r=n.structures||[];if(t.values.length>0){We[De++]=216,We[De++]=51,Wl(4);let i=t.values;e(i),Wl(0),Wl(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let o=0,u=i.length;o<u;o++)packedObjectMap[i[o]]=o}if(r){Jr.setUint32(De,3655335424),De+=3;let i=r.slice(0);i.unshift(57344),i.push(new ep(n.version,1399353956)),e(i)}else e(new ep(n.version,1399353956))}}];function Hl(n,e){return!que&&e>1&&(n-=4),{tag:n,encode:function(r,i){let o=r.byteLength,u=r.byteOffset||0,c=r.buffer||r;i(M1?MS.from(c,u,o):new Uint8Array(c,u,o))}}}function oI(n,e){let t=n.byteLength;t<24?We[De++]=64+t:t<256?(We[De++]=88,We[De++]=t):t<65536?(We[De++]=89,We[De++]=t>>8,We[De++]=t&255):(We[De++]=90,Jr.setUint32(De,t),De+=4),De+t>=We.length&&e(De+t),We.set(n.buffer?n:new Uint8Array(n),De),De+=t}function Vue(n,e){let t,r=e.length*2,i=n.length-r;e.sort((o,u)=>o.offset>u.offset?1:-1);for(let o=0;o<e.length;o++){let u=e[o];u.id=o;for(let c of u.references)n[c++]=o>>8,n[c]=o&255}for(;t=e.pop();){let o=t.offset;n.copyWithin(o+r,o,i),r-=2;let u=o+r;n[u++]=216,n[u++]=28,i=o}return n}function uI(n,e){Jr.setUint32(ai.position+n,De-ai.position-n+1);let t=ai;ai=null,e(t[0]),e(t[1])}function Gue(n){if(n.Class){if(!n.encode)throw new Error("Extension has no encode function");qM.unshift(n.Class),D2.unshift(n)}Uue(n)}let VM=new kS({useRecords:!1});const Wue=VM.encode,Kue=VM.encodeAsIterable,Yue=VM.encodeAsAsyncIterable,{NEVER:Jue,ALWAYS:Que,DECIMAL_ROUND:Zue,DECIMAL_FIT:Xue}=Cz,M4=512,ele=1024,y5=2048;function tle(n,e={}){if(!n||typeof n!="object")throw new Error("first argument must be an Iterable, Async Iterable, or a Promise for an Async Iterable");if(typeof n[Symbol.iterator]=="function")return nle(n,e);if(typeof n.then=="function"||typeof n[Symbol.asyncIterator]=="function")return rle(n,e);throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a Promise")}function*nle(n,e){const t=new kS(e);for(const r of n)yield t.encode(r)}async function*rle(n,e){const t=new kS(e);for await(const r of n)yield t.encode(r)}function ale(n,e={}){if(!n||typeof n!="object")throw new Error("first argument must be an Iterable, Async Iterable, Iterator, Async Iterator, or a promise");const t=new Nh(e);let r;const i=o=>{let u;r&&(o=Buffer.concat([r,o]),r=void 0);try{u=t.decodeMultiple(o)}catch(c){if(c.incomplete)r=o.slice(c.lastPosition),u=c.values;else throw c}return u};if(typeof n[Symbol.iterator]=="function")return function*(){for(const u of n)yield*i(u)}();if(typeof n[Symbol.asyncIterator]=="function")return async function*(){for await(const u of n)yield*i(u)}()}const ile=Object.freeze(Object.defineProperty({__proto__:null,ALWAYS:Que,DECIMAL_FIT:Xue,DECIMAL_ROUND:Zue,Decoder:Nh,Encoder:kS,FLOAT32_OPTIONS:Cz,NEVER:Jue,REUSE_BUFFER_MODE:M4,Tag:ep,addExtension:Gue,clearSource:I2,decode:Fue,decodeIter:ale,decodeMultiple:Bue,encode:Wue,encodeAsAsyncIterable:Yue,encodeAsIterable:Kue,encodeIter:tle,isNativeAccelerationEnabled:Mue,roundFloat32:zue},Symbol.toStringTag,{value:"Module"})),sle=o1(ile);var ha={},lI;function ole(){if(lI)return ha;lI=1;const{ValidatePresence:n,ValidateLibrary:e,ValidateObject:t,ValidateAddress:r,ValidateUserWallet:i}=yc;return ha.ListAccessGroups=async function(){const o=(await this.Collection({collectionType:"accessGroups"})).map(c=>this.utils.FormatAddress(c));return(await this.utils.LimitedMap(5,o,async c=>{try{const p=this.utils.AddressToHash(c),h=await this.ContentObjectMetadata({libraryId:this.contentSpaceLibraryId,objectId:`iq__${p}`})||{};return{address:c,id:`igrp${p}`,meta:h}}catch(p){this.Log(p,!0)}})).filter(c=>c).sort((c,p)=>{const h=(c.meta.public||{}).name||`zz__${c.address}`,g=(p.meta.public||{}).name||`zz__${p.address}`;return h<g?-1:1})},ha.SetGroupPermission=async function({groupAddress:o,objectId:u,permission:c,remove:p=!1}){const h=await this.authClient.ContractInfo({address:o}),g=await this.authClient.ContractInfo({id:u});if(Object.keys(h).length===0)throw Error(`No information returned for group address ${o}`);let m;if(!g.isV3&&g.accessType===this.authClient.ACCESS_TYPES.GROUP){if(h.isV3)throw Error("Unable to map V3 group to V2 object");m=await this.CallContractMethodAndWait({contractAddress:o,methodName:"setAccessGroupRights",methodArgs:[this.utils.HashToAddress(u),c==="manage"?2:c==="access"?1:0,c==="none"||p?0:2]})}else m=await this.CallContractMethodAndWait({contractAddress:this.utils.HashToAddress(u),methodName:"setRights",methodArgs:[o,c==="manage"?2:c==="access"?1:0,c==="none"||p?0:2]});return await this.ExtractEventFromLogs({abi:h.abi,event:m,eventName:"RightsChanged"})},ha.AccessGroupOwner=async function({contractAddress:o}){return o=r(o),this.Log(`Retrieving owner of access group ${o}`),await this.authClient.Owner({address:o})},ha.AccessGroupMembers=async function({contractAddress:o}){if(o=r(o),this.Log(`Retrieving members for group ${o}`),await this.authClient.ContractHasMethod({contractAddress:o,methodName:"membersList"})){const c=(await this.CallContractMethod({contractAddress:o,methodName:"membersNum"})).toNumber();return await Promise.all([...Array(c)].map(async(p,h)=>this.utils.FormatAddress(await this.CallContractMethod({contractAddress:o,methodName:"membersList",methodArgs:[h]}))))}else{const c=this.utils.FromHex(await this.CallContractMethod({contractAddress:o,methodName:"getMeta",methodArgs:["members"]}));return c&&JSON.parse(c)?JSON.parse(c):[]}},ha.AccessGroupManagers=async function({contractAddress:o}){if(o=r(o),this.Log(`Retrieving managers for group ${o}`),await this.authClient.ContractHasMethod({contractAddress:o,methodName:"managersList"})){const c=(await this.CallContractMethod({contractAddress:o,methodName:"managersNum"})).toNumber();return await Promise.all([...Array(c)].map(async(p,h)=>this.utils.FormatAddress(await this.CallContractMethod({contractAddress:o,methodName:"managersList",methodArgs:[h]}))))}else{const c=this.utils.FromHex(await this.CallContractMethod({contractAddress:o,methodName:"getMeta",methodArgs:["managers"]}));return c&&JSON.parse(c)?JSON.parse(c):[]}},ha.CreateAccessGroup=async function({name:o,description:u,metadata:c={},visibility:p=1}={}){this.Log(`Creating access group: ${o||""} ${u||""}`);let{contractAddress:h}=await this.authClient.CreateAccessGroup();h=this.utils.FormatAddress(h);const g=this.utils.AddressToObjectId(h),m=await this.userProfileClient.TenantId();this.Log(`Access group: ${h} ${g}`);const w=await this.EditContentObject({libraryId:this.contentSpaceLibraryId,objectId:g}),v={public:{name:o,description:u},name:o,description:u,...c};if(m){let C=this.utils.HashToAddress(m);await this.AddContentObjectGroupPermission({objectId:g,groupAddress:C,permission:"manage"}),await this.ReplaceContractMetadata({contractAddress:h,metadataKey:"_tenantId",metadata:m}),v.tenantId=m}else console.warn("No tenant ID associated with current tenant.");return await this.ReplaceMetadata({libraryId:this.contentSpaceLibraryId,objectId:g,writeToken:w.write_token,metadata:v}),await this.CallContractMethodAndWait({contractAddress:h,methodName:"setVisibility",methodArgs:[p]}),await this.FinalizeContentObject({libraryId:this.contentSpaceLibraryId,objectId:g,writeToken:w.write_token,commitMessage:"Create access group"}),h},ha.DeleteAccessGroup=async function({contractAddress:o}){throw Error("Not supported")},ha.AccessGroupMembershipMethod=async function({contractAddress:o,memberAddress:u,methodName:c,eventName:p}){if(o=r(o),u=r(u),!this.utils.EqualAddress(this.signer.address,u)&&!await this.CallContractMethod({contractAddress:o,methodName:"hasManagerAccess",methodArgs:[this.utils.FormatAddress(this.signer.address)]}))throw Error("Manager access required");this.Log(`Calling ${c} on group ${o} for user ${u}`);const h=await this.CallContractMethodAndWait({contractAddress:o,methodName:c,methodArgs:[u],eventName:p,eventValue:"candidate"}),g=await this.ContractAbi({contractAddress:o}),m=this.ExtractValueFromEvent({abi:g,event:h,eventName:p,eventValue:"candidate"});if(this.utils.FormatAddress(m)!==this.utils.FormatAddress(u))throw console.error("Mismatch: "+m+" :: "+u),console.error("Is target user address wallet created?"),Error("Access group method "+c+" failed. Is target user address wallet created?");return h.transactionHash},ha.AddAccessGroupMember=async function({contractAddress:o,memberAddress:u}){o=r(o),u=r(u),await i({address:u,client:this});const c=await this.authClient.ContractHasMethod({contractAddress:o,methodName:"membersList"}),p=await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:u,methodName:"grantAccess",eventName:"MemberAdded"});if(!c){let h=await this.AccessGroupMembers({contractAddress:o});h.push(u),h=h.filter((g,m,w)=>w.indexOf(g)===m),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"members",metadata:h})}return p},ha.RemoveAccessGroupMember=async function({contractAddress:o,memberAddress:u}){o=r(o),u=r(u);const c=await this.authClient.ContractHasMethod({contractAddress:o,methodName:"membersList"}),p=await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:u,methodName:"revokeAccess",eventName:"MemberRevoked"});if(!c){let h=await this.AccessGroupMembers({contractAddress:o});return h=h.filter(g=>g!==u),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"members",metadata:h})}return p},ha.AddAccessGroupManager=async function({contractAddress:o,memberAddress:u}){o=r(o),u=r(u),await i({address:u,client:this});const c=await this.authClient.ContractHasMethod({contractAddress:o,methodName:"membersList"}),p=await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:u,methodName:"grantManagerAccess",eventName:"ManagerAccessGranted"});if(!c){let h=await this.AccessGroupManagers({contractAddress:o});h.push(u),h=h.filter((g,m,w)=>w.indexOf(g)===m),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"managers",metadata:h})}return p},ha.RemoveAccessGroupManager=async function({contractAddress:o,memberAddress:u}){if(o=r(o),u=r(u),!await this.authClient.ContractHasMethod({contractAddress:o,methodName:"managersList"})){let h=await this.AccessGroupManagers({contractAddress:o});h=h.filter(g=>g!==u),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"managers",metadata:h})}return await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:u,methodName:"revokeManagerAccess",eventName:"ManagerAccessRevoked"})},ha.ContentLibraryGroupPermissions=async function({libraryId:o,permissions:u=[]}){e(o);let c={};return!u||u.length===0?u=["accessor","contributor","reviewer"]:u=u.map(p=>{if(p=p.toLowerCase(),!["accessor","contributor","reviewer"].includes(p))throw Error(`Invalid permission: ${p}`);return p}),this.Log(`Retrieving ${u.join(", ")} group(s) for library ${o}`),await Promise.all(u.map(async p=>{let h=await this.CallContractMethod({contractAddress:this.utils.HashToAddress(o),methodName:p+"GroupsLength"});h=parseInt(h._hex,16),(await this.utils.LimitedMap(3,[...Array(h).keys()],async m=>{try{return this.utils.FormatAddress(await this.CallContractMethod({contractAddress:this.utils.HashToAddress(o),methodName:p+"Groups",methodArgs:[m]}))}catch(w){console.error(w)}})).forEach(m=>c[m]=[...c[m]||[],p].sort())})),c},ha.AddContentLibraryGroup=async function({libraryId:o,groupAddress:u,permission:c}){if(e(o),u=r(u),!["accessor","contributor","reviewer"].includes(c.toLowerCase()))throw Error(`Invalid group type: ${c}`);if(this.Log(`Adding ${c} group ${u} to library ${o}`),(await this.ContentLibraryGroupPermissions({libraryId:o,permissions:[c]}))[u])return;c=c.charAt(0).toUpperCase()+c.substr(1).toLowerCase();const h=await this.CallContractMethodAndWait({contractAddress:this.utils.HashToAddress(o),methodName:`add${c}Group`,methodArgs:[u]}),g=await this.ContractAbi({id:o});await this.ExtractEventFromLogs({abi:g,event:h,eventName:`${c}GroupAdded`})},ha.RemoveContentLibraryGroup=async function({libraryId:o,groupAddress:u,permission:c}){if(e(o),u=r(u),!["accessor","contributor","reviewer"].includes(c.toLowerCase()))throw Error(`Invalid group type: ${c}`);if(this.Log(`Removing ${c} group ${u} from library ${o}`),!(await this.ContentLibraryGroupPermissions({libraryId:o,permissions:[c]}))[u])return;c=c.charAt(0).toUpperCase()+c.substr(1).toLowerCase();const h=await this.CallContractMethodAndWait({contractAddress:this.utils.HashToAddress(o),methodName:`remove${c}Group`,methodArgs:[u]}),g=await this.ContractAbi({id:o});await this.ExtractEventFromLogs({abi:g,event:h,eventName:`${c}GroupRemoved`})},ha.ContentObjectGroupPermissions=async function({objectId:o}){t(o),this.Log(`Retrieving group permissions for object ${o}`);const u=this.utils.HashToAddress(o),c=await this.Collection({collectionType:"accessGroups"});let p;switch(await this.AccessType({id:o})){case this.authClient.ACCESS_TYPES.OBJECT:p="getContentObjectRights";break;case this.authClient.ACCESS_TYPES.TYPE:p="getContentTypeRights";break;case this.authClient.ACCESS_TYPES.GROUP:p="getAccessGroupRights";break;case this.authClient.ACCESS_TYPES.LIBRARY:p="getLibraryRights"}const h={};return await Promise.all(c.map(async g=>{try{g=this.utils.FormatAddress(g);let m=await this.CallContractMethod({contractAddress:g,methodName:p,methodArgs:[u]});if(m===0)return;let w=[];m>=100&&w.push("manage"),m%100>=10&&w.push("access"),m%10>0&&w.push("see"),h[g]=w}catch(m){this.Log(`Failed to retrieve group permissions for ${g}`,!0),this.Log(m,!0)}})),h},ha.AddContentObjectGroupPermission=async function({objectId:o,groupAddress:u,permission:c}){if(n("permission",c),t(o),u=r(u),this.utils.EqualAddress(u,this.utils.HashToAddress(o)))throw Error("Group rights cannot be set on the same group");if(c=c.toLowerCase(),!["see","access","manage"].includes(c))throw Error(`Invalid permission type: ${c}`);return this.Log(`Adding ${c} permission to group ${u} for ${o}`),await this.SetGroupPermission({groupAddress:u,objectId:o,permission:c})},ha.RemoveContentObjectGroupPermission=async function({objectId:o,groupAddress:u,permission:c}){if(n("permission",c),t(o),u=r(u),c=c.toLowerCase(),!["see","access","manage"].includes(c))throw Error(`Invalid permission type: ${c}`);return this.Log(`Removing ${c} permission from group ${u} for ${o}`),await this.SetGroupPermission({groupAddress:u,objectId:o,permission:c,remove:!0})},ha.LinkAccessGroupToOauth=async function({groupAddress:o,kmsId:u,oauthConfig:c}){r(o),n("kmsId",u),n("oauthConfig",c),typeof c=="string"&&(c=JSON.parse(c));const{publicKey:p}=await this.authClient.KMSInfo({kmsId:u}),h=`eluv.jwtv.${u}`,g=await this.Crypto.EncryptConk(c,p),m=`eluv.jwtv.iusr${this.utils.AddressToHash(this.signer.address)}`,w=await this.EncryptECIES({message:c}),v=this.utils.AddressToObjectId(o),C=(await this.EditContentObject({libraryId:this.contentSpaceLibraryId,objectId:v})).write_token;await this.ReplaceMetadata({libraryId:this.contentSpaceLibraryId,objectId:v,writeToken:C,metadataSubtree:h,metadata:g}),await this.ReplaceMetadata({libraryId:this.contentSpaceLibraryId,objectId:v,writeToken:C,metadataSubtree:m,metadata:w}),await this.FinalizeContentObject({libraryId:this.contentSpaceLibraryId,objectId:v,writeToken:C,commitMessage:"Bind access group to OAuth"}),await this.CallContractMethodAndWait({contractAddress:o,methodName:"setOAuthEnabled",methodArgs:[!1]}),await this.CallContractMethodAndWait({contractAddress:o,methodName:"setOAuthEnabled",methodArgs:[!0]})},ha.UnlinkAccessGroupFromOauth=async function({groupAddress:o}){r(o),await this.CallContractMethodAndWait({contractAddress:o,methodName:"setOAuthEnabled",methodArgs:[!1]})},ha}var ya={},cI;function ule(){if(cI)return ya;cI=1;const n=pc,{ValidateAddress:e,ValidateParameters:t,ValidatePresence:r}=yc;return ya.ContractName=async function({contractAddress:i}){return i=e(i),await this.ethClient.ContractName(i)},ya.ContractAbi=async function({contractAddress:i,id:o}){const u=await this.authClient.ContractInfo({address:i,id:o});if(!u)throw Error(`Unable to determine contract info for ${i}`);return u.abi},ya.ContractInfo=async function({id:i,address:o}){return this.authClient.ContractInfo({id:i,address:o})},ya.FormatContractArguments=function({abi:i,methodName:o,args:u}){return this.ethClient.FormatContractArguments({abi:i,methodName:o,args:u})},ya.DeployContract=async function({abi:i,bytecode:o,constructorArgs:u,overrides:c={}}){return await this.ethClient.DeployContract({abi:i,bytecode:o,constructorArgs:u,overrides:c,signer:this.signer})},ya.ContractEvents=async function({contractAddress:i,abi:o,fromBlock:u=0,toBlock:c,count:p=1e3,topics:h,includeTransaction:g=!1}){i=e(i),o||(o=await this.ContractAbi({contractAddress:i}));const m=await this.FormatBlockNumbers({fromBlock:u,toBlock:c,count:p});return this.Log(`Querying contract events ${i} - Blocks ${m.fromBlock} to ${m.toBlock}`),await this.ethClient.ContractEvents({contractAddress:i,abi:o,fromBlock:m.fromBlock,toBlock:m.toBlock,topics:h,includeTransaction:g})},ya.CallContractMethod=async function({contractAddress:i,abi:o,methodName:u,methodArgs:c=[],value:p,overrides:h={},formatArguments:g=!0,cacheContract:m=!0,overrideCachedContract:w=!1}){return i=e(i),i=this.utils.FormatAddress(i),u==="setVisibility"&&this.visibilityInfo[i]&&delete this.visibilityInfo[i],o||(o=await this.ContractAbi({contractAddress:i})),await this.ethClient.CallContractMethod({contractAddress:i,abi:o,methodName:u,methodArgs:c,value:p,overrides:h,formatArguments:g,cacheContract:m,overrideCachedContract:w})},ya.CallContractMethodAndWait=async function({contractAddress:i,abi:o,methodName:u,methodArgs:c,value:p,overrides:h={},formatArguments:g=!0,cacheContract:m=!0,overrideCachedContract:w=!1}){return i=e(i),i=this.utils.FormatAddress(i),u==="setVisibility"&&this.visibilityInfo[i]&&delete this.visibilityInfo[i],o||(o=await this.ContractAbi({contractAddress:i})),await this.ethClient.CallContractMethodAndWait({contractAddress:i,abi:o,methodName:u,methodArgs:c,value:p,overrides:h,formatArguments:g,cacheContract:m,overrideCachedContract:w})},ya.ContractMetadata=async function({contractAddress:i,metadataKey:o}){r("contractAddress",i),r("metadataKey",o);try{const u=await this.CallContractMethod({contractAddress:i,methodName:"getMeta",methodArgs:[o]}),c=Buffer.from((u||"").replace("0x",""),"hex").toString("utf-8");try{return JSON.parse(c)}catch{return c}}catch{return""}},ya.MergeContractMetadata=async function({contractAddress:i,metadataKey:o,metadata:u}){r("contractAddress",i),r("metadataKey",o);const c=await this.ContractMetadata({contractAddress:i,metadataKey:o})||{};typeof c=="object"&&(u={...c,...u}),await this.CallContractMethodAndWait({contractAddress:i,methodName:"putMeta",methodArgs:[o,JSON.stringify(u)]})},ya.ReplaceContractMetadata=async function({contractAddress:i,metadataKey:o,metadata:u}){r("contractAddress",i),r("metadataKey",o),await this.CallContractMethodAndWait({contractAddress:i,methodName:"putMeta",methodArgs:[o,JSON.stringify(u)]})},ya.CustomContractAddress=async function({libraryId:i,objectId:o,versionHash:u}){if(t({libraryId:i,objectId:o,versionHash:u}),u&&(o=this.utils.DecodeVersionHash(u).objectId),i===this.contentSpaceLibraryId||this.utils.EqualHash(i,o))return;this.Log(`Retrieving custom contract address: ${o}`);const c=await this.ContractAbi({id:o}),p=await this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(o),abi:c,methodName:"contentContractAddress",methodArgs:[]});if(p!==this.utils.nullAddress)return this.utils.FormatAddress(p)},ya.SetCustomContentContract=async function({libraryId:i,objectId:o,customContractAddress:u,name:c,description:p,abi:h,factoryAbi:g,overrides:m={}}){t({libraryId:i,objectId:o}),u=e(u),u=this.utils.FormatAddress(u),this.Log(`Setting custom contract address: ${o} ${u}`);const w=await this.ethClient.SetCustomContentContract({contentContractAddress:this.utils.HashToAddress(o),customContractAddress:u,overrides:m,signer:this.signer}),v=(await this.EditContentObject({libraryId:i,objectId:o})).write_token;return await this.ReplaceMetadata({libraryId:i,objectId:o,writeToken:v,metadataSubtree:"custom_contract",metadata:{name:c,description:p,address:u,abi:h,factoryAbi:g}}),await this.FinalizeContentObject({libraryId:i,objectId:o,writeToken:v,commitMessage:"Set custom contract"}),w},ya.ExtractEventFromLogs=function({abi:i,event:o,eventName:u}){return this.ethClient.ExtractEventFromLogs({abi:i,event:o,eventName:u})},ya.ExtractValueFromEvent=function({abi:i,event:o,eventName:u,eventValue:c}){const p=this.ethClient.ExtractEventFromLogs({abi:i,event:o,eventName:u,eventValue:c});return p?p.args[c]:void 0},ya.FormatBlockNumbers=async function({fromBlock:i,toBlock:o,count:u=10}){const c=await this.BlockNumber();return o?i||(i=o-u+1):i?o=i+u-1:(o=c,i=o-u+1),o>c&&(o=c),i<0&&(i=0),{fromBlock:i,toBlock:o}},ya.Events=async function({toBlock:i,fromBlock:o,count:u=10,includeTransaction:c=!1}={}){const p=await this.FormatBlockNumbers({fromBlock:o,toBlock:i,count:u});return this.Log(`Querying events - Blocks ${p.fromBlock} to ${p.toBlock}`),await this.ethClient.Events({fromBlock:p.fromBlock,toBlock:p.toBlock,includeTransaction:c})},ya.BlockNumber=async function(){return await this.ethClient.MakeProviderCall({methodName:"getBlockNumber"})},ya.GetBalance=async function({address:i}){i=e(i);const o=await this.ethClient.MakeProviderCall({methodName:"getBalance",args:[i]});return n.utils.formatEther(o)},ya.SendFunds=async function({recipient:i,ether:o}){return i=e(i),await(await this.signer.sendTransaction({to:i,value:n.utils.parseEther(o.toString())})).wait()},ya}var Id={},lle=function(){return!1};const cle=lle;var fle=function(){return!0};const dle=fle,ple={"@@functional/placeholder":!0};function Qr(n){return n!=null&&typeof n=="object"&&n["@@functional/placeholder"]===!0}function Qt(n){return function e(t){return arguments.length===0||Qr(t)?e:n.apply(this,arguments)}}function Qe(n){return function e(t,r){switch(arguments.length){case 0:return e;case 1:return Qr(t)?e:Qt(function(i){return n(t,i)});default:return Qr(t)&&Qr(r)?e:Qr(t)?Qt(function(i){return n(i,r)}):Qr(r)?Qt(function(i){return n(t,i)}):n(t,r)}}}var hle=Qe(function(e,t){return Number(e)+Number(t)});const TS=hle;function Qu(n,e){n=n||[],e=e||[];var t,r=n.length,i=e.length,o=[];for(t=0;t<r;)o[o.length]=n[t],t+=1;for(t=0;t<i;)o[o.length]=e[t],t+=1;return o}function Zu(n,e){switch(n){case 0:return function(){return e.apply(this,arguments)};case 1:return function(t){return e.apply(this,arguments)};case 2:return function(t,r){return e.apply(this,arguments)};case 3:return function(t,r,i){return e.apply(this,arguments)};case 4:return function(t,r,i,o){return e.apply(this,arguments)};case 5:return function(t,r,i,o,u){return e.apply(this,arguments)};case 6:return function(t,r,i,o,u,c){return e.apply(this,arguments)};case 7:return function(t,r,i,o,u,c,p){return e.apply(this,arguments)};case 8:return function(t,r,i,o,u,c,p,h){return e.apply(this,arguments)};case 9:return function(t,r,i,o,u,c,p,h,g){return e.apply(this,arguments)};case 10:return function(t,r,i,o,u,c,p,h,g,m){return e.apply(this,arguments)};default:throw new Error("First argument to _arity must be a non-negative integer no greater than ten")}}function k1(n,e,t){return function(){for(var r=[],i=0,o=n,u=0;u<e.length||i<arguments.length;){var c;u<e.length&&(!Qr(e[u])||i>=arguments.length)?c=e[u]:(c=arguments[i],i+=1),r[u]=c,Qr(c)||(o-=1),u+=1}return o<=0?t.apply(this,r):Zu(o,k1(n,r,t))}}var yle=Qe(function(e,t){return e===1?Qt(t):Zu(e,k1(e,[],t))});const gi=yle;var mle=Qt(function(e){return gi(e.length,function(){var t=0,r=arguments[0],i=arguments[arguments.length-1],o=Array.prototype.slice.call(arguments,0);return o[0]=function(){var u=r.apply(this,Qu(arguments,[t,i]));return t+=1,u},e.apply(this,o)})});const gle=mle;function Sn(n){return function e(t,r,i){switch(arguments.length){case 0:return e;case 1:return Qr(t)?e:Qe(function(o,u){return n(t,o,u)});case 2:return Qr(t)&&Qr(r)?e:Qr(t)?Qe(function(o,u){return n(o,r,u)}):Qr(r)?Qe(function(o,u){return n(t,o,u)}):Qt(function(o){return n(t,r,o)});default:return Qr(t)&&Qr(r)&&Qr(i)?e:Qr(t)&&Qr(r)?Qe(function(o,u){return n(o,u,i)}):Qr(t)&&Qr(i)?Qe(function(o,u){return n(o,r,u)}):Qr(r)&&Qr(i)?Qe(function(o,u){return n(t,o,u)}):Qr(t)?Qt(function(o){return n(o,r,i)}):Qr(r)?Qt(function(o){return n(t,o,i)}):Qr(i)?Qt(function(o){return n(t,r,o)}):n(t,r,i)}}}var ble=Sn(function(e,t,r){if(e>=r.length||e<-r.length)return r;var i=e<0?r.length:0,o=i+e,u=Qu(r);return u[o]=t(r[o]),u});const Mz=ble,Yu=Array.isArray||function(e){return e!=null&&e.length>=0&&Object.prototype.toString.call(e)==="[object Array]"};function GM(n){return n!=null&&typeof n["@@transducer/step"]=="function"}function Ga(n,e,t){return function(){if(arguments.length===0)return t();var r=Array.prototype.slice.call(arguments,0),i=r.pop();if(!Yu(i)){for(var o=0;o<n.length;){if(typeof i[n[o]]=="function")return i[n[o]].apply(i,r);o+=1}if(GM(i)){var u=e.apply(null,r);return u(i)}}return t.apply(this,arguments)}}function up(n){return n&&n["@@transducer/reduced"]?n:{"@@transducer/value":n,"@@transducer/reduced":!0}}const Nr={init:function(){return this.xf["@@transducer/init"]()},result:function(n){return this.xf["@@transducer/result"](n)}};var vle=function(){function n(e,t){this.xf=t,this.f=e,this.all=!0}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.all&&(e=this.xf["@@transducer/step"](e,!0)),this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){return this.f(t)||(this.all=!1,e=up(this.xf["@@transducer/step"](e,!1))),e},n}(),wle=Qe(function(e,t){return new vle(e,t)});const xle=wle;var _le=Qe(Ga(["all"],xle,function(e,t){for(var r=0;r<t.length;){if(!e(t[r]))return!1;r+=1}return!0}));const kz=_le;var Sle=Qe(function(e,t){return t>e?t:e});const $m=Sle;function dm(n,e){for(var t=0,r=e.length,i=Array(r);t<r;)i[t]=n(e[t]),t+=1;return i}function Sm(n){return Object.prototype.toString.call(n)==="[object String]"}var T1=Qt(function(e){return Yu(e)?!0:!e||typeof e!="object"||Sm(e)?!1:e.nodeType===1?!!e.length:e.length===0?!0:e.length>0?e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1):!1}),Ele=function(){function n(e){this.f=e}return n.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},n.prototype["@@transducer/result"]=function(e){return e},n.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},n}();function Tz(n){return new Ele(n)}var Cle=Qe(function(e,t){return Zu(e.length,function(){return e.apply(t,arguments)})});const Rz=Cle;function Ale(n,e,t){for(var r=0,i=t.length;r<i;){if(e=n["@@transducer/step"](e,t[r]),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r+=1}return n["@@transducer/result"](e)}function fI(n,e,t){for(var r=t.next();!r.done;){if(e=n["@@transducer/step"](e,r.value),e&&e["@@transducer/reduced"]){e=e["@@transducer/value"];break}r=t.next()}return n["@@transducer/result"](e)}function dI(n,e,t,r){return n["@@transducer/result"](t[r](Rz(n["@@transducer/step"],n),e))}var pI=typeof Symbol<"u"?Symbol.iterator:"@@iterator";function Ts(n,e,t){if(typeof n=="function"&&(n=Tz(n)),T1(t))return Ale(n,e,t);if(typeof t["fantasy-land/reduce"]=="function")return dI(n,e,t,"fantasy-land/reduce");if(t[pI]!=null)return fI(n,e,t[pI]());if(typeof t.next=="function")return fI(n,e,t);if(typeof t.reduce=="function")return dI(n,e,t,"reduce");throw new TypeError("reduce: list must be array or iterable")}var Mle=function(){function n(e,t){this.xf=t,this.f=e}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){return this.xf["@@transducer/step"](e,this.f(t))},n}(),kle=Qe(function(e,t){return new Mle(e,t)});const Tle=kle;function Ui(n,e){return Object.prototype.hasOwnProperty.call(e,n)}var hI=Object.prototype.toString,Oz=function(){return hI.call(arguments)==="[object Arguments]"?function(e){return hI.call(e)==="[object Arguments]"}:function(e){return Ui("callee",e)}}(),Rle=!{toString:null}.propertyIsEnumerable("toString"),yI=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],mI=function(){return arguments.propertyIsEnumerable("length")}(),Ole=function(e,t){for(var r=0;r<e.length;){if(e[r]===t)return!0;r+=1}return!1},Lle=Qt(typeof Object.keys=="function"&&!mI?function(e){return Object(e)!==e?[]:Object.keys(e)}:function(e){if(Object(e)!==e)return[];var t,r,i=[],o=mI&&Oz(e);for(t in e)Ui(t,e)&&(!o||t!=="length")&&(i[i.length]=t);if(Rle)for(r=yI.length-1;r>=0;)t=yI[r],Ui(t,e)&&!Ole(i,t)&&(i[i.length]=t),r-=1;return i});const Mo=Lle;var su=Qe(Ga(["fantasy-land/map","map"],Tle,function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return gi(t.length,function(){return e.call(this,t.apply(this,arguments))});case"[object Object]":return Ts(function(r,i){return r[i]=e(t[i]),r},{},Mo(t));default:return dm(e,t)}}));const Ph=Number.isInteger||function(e){return e<<0===e};var Hm=Qe(function(e,t){var r=e<0?t.length+e:e;return Sm(t)?t.charAt(r):t[r]}),Nle=Qe(function(e,t){return e.map(function(r){for(var i=t,o=0,u;o<r.length;){if(i==null)return;u=r[o],i=Ph(u)?Hm(u,i):i[u],o+=1}return i})});const Lz=Nle;var Ple=Qe(function(e,t){return Lz([e],t)[0]});const Yh=Ple;var Ile=Qe(function(e,t){return Yh([e],t)});const WM=Ile;var Dle=Qe(function(e,t){return su(WM(e),t)});const R1=Dle;var gc=Sn(Ts),Ule=Qt(function(e){return gi(gc($m,0,R1("length",e)),function(){for(var t=0,r=e.length;t<r;){if(!e[t].apply(this,arguments))return!1;t+=1}return!0})});const Fle=Ule;var Ble=Qt(function(e){return function(){return e}});const RS=Ble;var zle=Qe(function(e,t){return e&&t});const Nz=zle;var jle=function(){function n(e,t){this.xf=t,this.f=e,this.any=!1}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.any||(e=this.xf["@@transducer/step"](e,!1)),this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.any=!0,e=up(this.xf["@@transducer/step"](e,!0))),e},n}(),$le=Qe(function(e,t){return new jle(e,t)});const Hle=$le;var qle=Qe(Ga(["any"],Hle,function(e,t){for(var r=0;r<t.length;){if(e(t[r]))return!0;r+=1}return!1}));const Vle=qle;var Gle=Qt(function(e){return gi(gc($m,0,R1("length",e)),function(){for(var t=0,r=e.length;t<r;){if(e[t].apply(this,arguments))return!0;t+=1}return!1})});const Wle=Gle;var Kle=Qe(function(e,t){return typeof t["fantasy-land/ap"]=="function"?t["fantasy-land/ap"](e):typeof e.ap=="function"?e.ap(t):typeof e=="function"?function(r){return e(r)(t(r))}:Ts(function(r,i){return Qu(r,su(i,t))},[],e)});const KM=Kle;function Yle(n,e){for(var t=0,r=e.length-(n-1),i=new Array(r>=0?r:0);t<r;)i[t]=Array.prototype.slice.call(e,t,t+n),t+=1;return i}var Jle=function(){function n(e,t){this.xf=t,this.pos=0,this.full=!1,this.acc=new Array(e)}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.acc=null,this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){return this.store(t),this.full?this.xf["@@transducer/step"](e,this.getCopy()):e},n.prototype.store=function(e){this.acc[this.pos]=e,this.pos+=1,this.pos===this.acc.length&&(this.pos=0,this.full=!0)},n.prototype.getCopy=function(){return Qu(Array.prototype.slice.call(this.acc,this.pos),Array.prototype.slice.call(this.acc,0,this.pos))},n}(),Qle=Qe(function(e,t){return new Jle(e,t)});const Zle=Qle;var Xle=Qe(Ga([],Zle,Yle));const ece=Xle;var tce=Qe(function(e,t){return Qu(t,[e])});const nce=tce;var rce=Qe(function(e,t){return e.apply(this,t)});const Pz=rce;var ace=Qt(function(e){for(var t=Mo(e),r=t.length,i=[],o=0;o<r;)i[o]=e[t[o]],o+=1;return i});const Iz=ace;function gI(n,e){return Mo(e).reduce(function(t,r){return t[r]=n(e[r]),t},{})}var ice=Qt(function n(e){return e=gI(function(t){return typeof t=="function"?t:n(t)},e),gi(gc($m,0,R1("length",Iz(e))),function(){var t=arguments;return gI(function(r){return Pz(r,t)},e)})});const sce=ice;var oce=Qe(function(e,t){return t(e)});const uce=oce;var lce=Sn(function(e,t,r){var i=e(t),o=e(r);return i<o?-1:i>o?1:0});const cce=lce;var fce=Sn(function(e,t,r){var i={};for(var o in r)i[o]=r[o];return i[e]=t,i});const OS=fce;var dce=Qt(function(e){return e==null});const U2=dce;var pce=Sn(function n(e,t,r){if(e.length===0)return t;var i=e[0];if(e.length>1){var o=!U2(r)&&Ui(i,r)?r[i]:Ph(e[1])?[]:{};t=n(Array.prototype.slice.call(e,1),t,o)}if(Ph(i)&&Yu(r)){var u=[].concat(r);return u[i]=t,u}else return OS(i,t,r)});const Dz=pce;var hce=Qe(function(e,t){switch(e){case 0:return function(){return t.call(this)};case 1:return function(r){return t.call(this,r)};case 2:return function(r,i){return t.call(this,r,i)};case 3:return function(r,i,o){return t.call(this,r,i,o)};case 4:return function(r,i,o,u){return t.call(this,r,i,o,u)};case 5:return function(r,i,o,u,c){return t.call(this,r,i,o,u,c)};case 6:return function(r,i,o,u,c,p){return t.call(this,r,i,o,u,c,p)};case 7:return function(r,i,o,u,c,p,h){return t.call(this,r,i,o,u,c,p,h)};case 8:return function(r,i,o,u,c,p,h,g){return t.call(this,r,i,o,u,c,p,h,g)};case 9:return function(r,i,o,u,c,p,h,g,m){return t.call(this,r,i,o,u,c,p,h,g,m)};case 10:return function(r,i,o,u,c,p,h,g,m,w){return t.call(this,r,i,o,u,c,p,h,g,m,w)};default:throw new Error("First argument to nAry must be a non-negative integer no greater than ten")}});const LS=hce;var yce=Qt(function(e){return LS(2,e)});const mce=yce;function Em(n){var e=Object.prototype.toString.call(n);return e==="[object Function]"||e==="[object AsyncFunction]"||e==="[object GeneratorFunction]"||e==="[object AsyncGeneratorFunction]"}var gce=Qe(function(e,t){var r=gi(e,t);return gi(e,function(){return Ts(KM,su(r,arguments[0]),Array.prototype.slice.call(arguments,1))})});const Uz=gce;var NS=Qt(function(e){return Uz(e.length,e)}),bce=Qe(function(e,t){return Em(e)?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:NS(Nz)(e,t)});const vce=bce;var YM=Qt(function(e){return gi(e.length,e)}),wce=YM(function(e){return e.apply(this,Array.prototype.slice.call(arguments,1))});const xce=wce;function Fz(n){return function e(t){for(var r,i,o,u=[],c=0,p=t.length;c<p;){if(T1(t[c]))for(r=n?e(t[c]):t[c],o=0,i=r.length;o<i;)u[u.length]=r[o],o+=1;else u[u.length]=t[c];c+=1}return u}}function _ce(n){return{"@@transducer/value":n,"@@transducer/reduced":!0}}var Sce=function(n){return{"@@transducer/init":Nr.init,"@@transducer/result":function(e){return n["@@transducer/result"](e)},"@@transducer/step":function(e,t){var r=n["@@transducer/step"](e,t);return r["@@transducer/reduced"]?_ce(r):r}}},Ece=function(e){var t=Sce(e);return{"@@transducer/init":Nr.init,"@@transducer/result":function(r){return t["@@transducer/result"](r)},"@@transducer/step":function(r,i){return T1(i)?Ts(t,r,i):Ts(t,r,[i])}}},Cce=Qe(function(e,t){return su(e,Ece(t))});const Ace=Cce;var Mce=Qe(Ga(["fantasy-land/chain","chain"],Ace,function(e,t){return typeof t=="function"?function(r){return e(t(r))(r)}:Fz(!1)(su(e,t))}));const JM=Mce;var kce=Sn(function(e,t,r){if(e>t)throw new Error("min must not be greater than max in clamp(min, max, value)");return r<e?e:r>t?t:r});const Tce=kce;function Bz(n){return new RegExp(n.source,(n.global?"g":"")+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.sticky?"y":"")+(n.unicode?"u":""))}var Rce=Qt(function(e){return e===null?"Null":e===void 0?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});const F2=Rce;function PS(n,e,t,r){var i=function(u){for(var c=e.length,p=0;p<c;){if(n===e[p])return t[p];p+=1}e[p+1]=n,t[p+1]=u;for(var h in n)u[h]=r?PS(n[h],e,t,!0):n[h];return u};switch(F2(n)){case"Object":return i({});case"Array":return i([]);case"Date":return new Date(n.valueOf());case"RegExp":return Bz(n);default:return n}}var Oce=Qt(function(e){return e!=null&&typeof e.clone=="function"?e.clone():PS(e,[],[],!0)});const Lce=Oce;var Nce=Qt(function(e){return function(t,r){return e(t,r)?-1:e(r,t)?1:0}});const Pce=Nce;var Ice=Qt(function(e){return!e});const zz=Ice;var Dce=NS(zz);const Uce=Dce;function Fce(n,e){return function(){return e.call(this,n.apply(this,arguments))}}function O1(n,e){return function(){var t=arguments.length;if(t===0)return e();var r=arguments[t-1];return Yu(r)||typeof r[n]!="function"?e.apply(this,arguments):r[n].apply(r,Array.prototype.slice.call(arguments,0,t-1))}}var tu=Sn(O1("slice",function(e,t,r){return Array.prototype.slice.call(r,e,t)})),IS=Qt(O1("tail",tu(1,1/0)));function jz(){if(arguments.length===0)throw new Error("pipe requires at least one argument");return Zu(arguments[0].length,gc(Fce,arguments[0],IS(arguments)))}var L1=Qt(function(e){return Sm(e)?e.split("").reverse().join(""):Array.prototype.slice.call(e,0).reverse()});function B2(){if(arguments.length===0)throw new Error("compose requires at least one argument");return jz.apply(this,L1(arguments))}function $z(){if(arguments.length===0)throw new Error("composeK requires at least one argument");var n=Array.prototype.slice.call(arguments),e=n.pop();return B2(B2.apply(this,su(JM,n)),e)}function Bce(n,e){return function(){var t=this;return n.apply(t,arguments).then(function(r){return e.call(t,r)})}}function Hz(){if(arguments.length===0)throw new Error("pipeP requires at least one argument");return Zu(arguments[0].length,gc(Bce,arguments[0],IS(arguments)))}function zce(){if(arguments.length===0)throw new Error("composeP requires at least one argument");return Hz.apply(this,L1(arguments))}var jce=Hm(0);const qz=jce;function N1(n){return n}var $ce=Qt(N1);const DS=$ce;var Hce=Qe(function(e,t){if(t.length<=0)return DS;var r=qz(t),i=IS(t);return Zu(r.length,function(){return Ts(function(o,u){return e.call(this,u,o)},r.apply(this,arguments),i)})});const Vz=Hce;var qce=Qe(function(e,t){return Vz.apply(this,[e,L1(t)])});const Vce=qce;function bI(n){for(var e=[],t;!(t=n.next()).done;)e.push(t.value);return e}function Cm(n,e,t){for(var r=0,i=t.length;r<i;){if(n(e,t[r]))return!0;r+=1}return!1}function Gce(n){var e=String(n).match(/^function (\w*)/);return e==null?"":e[1]}function Wce(n,e){return n===e?n!==0||1/n===1/e:n!==n&&e!==e}const d2=typeof Object.is=="function"?Object.is:Wce;function vI(n,e,t,r){var i=bI(n),o=bI(e);function u(c,p){return QM(c,p,t.slice(),r.slice())}return!Cm(function(c,p){return!Cm(u,p,c)},o,i)}function QM(n,e,t,r){if(d2(n,e))return!0;var i=F2(n);if(i!==F2(e)||n==null||e==null)return!1;if(typeof n["fantasy-land/equals"]=="function"||typeof e["fantasy-land/equals"]=="function")return typeof n["fantasy-land/equals"]=="function"&&n["fantasy-land/equals"](e)&&typeof e["fantasy-land/equals"]=="function"&&e["fantasy-land/equals"](n);if(typeof n.equals=="function"||typeof e.equals=="function")return typeof n.equals=="function"&&n.equals(e)&&typeof e.equals=="function"&&e.equals(n);switch(i){case"Arguments":case"Array":case"Object":if(typeof n.constructor=="function"&&Gce(n.constructor)==="Promise")return n===e;break;case"Boolean":case"Number":case"String":if(!(typeof n==typeof e&&d2(n.valueOf(),e.valueOf())))return!1;break;case"Date":if(!d2(n.valueOf(),e.valueOf()))return!1;break;case"Error":return n.name===e.name&&n.message===e.message;case"RegExp":if(!(n.source===e.source&&n.global===e.global&&n.ignoreCase===e.ignoreCase&&n.multiline===e.multiline&&n.sticky===e.sticky&&n.unicode===e.unicode))return!1;break}for(var o=t.length-1;o>=0;){if(t[o]===n)return r[o]===e;o-=1}switch(i){case"Map":return n.size!==e.size?!1:vI(n.entries(),e.entries(),t.concat([n]),r.concat([e]));case"Set":return n.size!==e.size?!1:vI(n.values(),e.values(),t.concat([n]),r.concat([e]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var u=Mo(n);if(u.length!==Mo(e).length)return!1;var c=t.concat([n]),p=r.concat([e]);for(o=u.length-1;o>=0;){var h=u[o];if(!(Ui(h,e)&&QM(e[h],n[h],c,p)))return!1;o-=1}return!0}var Kce=Qe(function(e,t){return QM(e,t,[],[])});const ko=Kce;function Gz(n,e,t){var r,i;if(typeof n.indexOf=="function")switch(typeof e){case"number":if(e===0){for(r=1/e;t<n.length;){if(i=n[t],i===0&&1/i===r)return t;t+=1}return-1}else if(e!==e){for(;t<n.length;){if(i=n[t],typeof i=="number"&&i!==i)return t;t+=1}return-1}return n.indexOf(e,t);case"string":case"boolean":case"function":case"undefined":return n.indexOf(e,t);case"object":if(e===null)return n.indexOf(e,t)}for(;t<n.length;){if(ko(n[t],e))return t;t+=1}return-1}function Ih(n,e){return Gz(e,n,0)>=0}function m5(n){var e=n.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0");return'"'+e.replace(/"/g,'\\"')+'"'}var pv=function(e){return(e<10?"0":"")+e},Yce=typeof Date.prototype.toISOString=="function"?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+pv(e.getUTCMonth()+1)+"-"+pv(e.getUTCDate())+"T"+pv(e.getUTCHours())+":"+pv(e.getUTCMinutes())+":"+pv(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"};function Wz(n){return function(){return!n.apply(this,arguments)}}function ZM(n,e){for(var t=0,r=e.length,i=[];t<r;)n(e[t])&&(i[i.length]=e[t]),t+=1;return i}function z2(n){return Object.prototype.toString.call(n)==="[object Object]"}var Jce=function(){function n(e,t){this.xf=t,this.f=e}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):e},n}(),Qce=Qe(function(e,t){return new Jce(e,t)});const Zce=Qce;var Xce=Qe(Ga(["filter"],Zce,function(n,e){return z2(e)?Ts(function(t,r){return n(e[r])&&(t[r]=e[r]),t},{},Mo(e)):ZM(n,e)}));const XM=Xce;var efe=Qe(function(e,t){return XM(Wz(e),t)});const US=efe;function ek(n,e){var t=function(u){var c=e.concat([n]);return Ih(u,c)?"<Circular>":ek(u,c)},r=function(o,u){return dm(function(c){return m5(c)+": "+t(o[c])},u.slice().sort())};switch(Object.prototype.toString.call(n)){case"[object Arguments]":return"(function() { return arguments; }("+dm(t,n).join(", ")+"))";case"[object Array]":return"["+dm(t,n).concat(r(n,US(function(o){return/^\d+$/.test(o)},Mo(n)))).join(", ")+"]";case"[object Boolean]":return typeof n=="object"?"new Boolean("+t(n.valueOf())+")":n.toString();case"[object Date]":return"new Date("+(isNaN(n.valueOf())?t(NaN):m5(Yce(n)))+")";case"[object Null]":return"null";case"[object Number]":return typeof n=="object"?"new Number("+t(n.valueOf())+")":1/n===-1/0?"-0":n.toString(10);case"[object String]":return typeof n=="object"?"new String("+t(n.valueOf())+")":m5(n);case"[object Undefined]":return"undefined";default:if(typeof n.toString=="function"){var i=n.toString();if(i!=="[object Object]")return i}return"{"+r(n,Mo(n)).join(", ")+"}"}}var tfe=Qt(function(e){return ek(e,[])});const pm=tfe;var nfe=Qe(function(e,t){if(Yu(e)){if(Yu(t))return e.concat(t);throw new TypeError(pm(t)+" is not an array")}if(Sm(e)){if(Sm(t))return e+t;throw new TypeError(pm(t)+" is not a string")}if(e!=null&&Em(e["fantasy-land/concat"]))return e["fantasy-land/concat"](t);if(e!=null&&Em(e.concat))return e.concat(t);throw new TypeError(pm(e)+' does not have a method named "concat" or "fantasy-land/concat"')});const tk=nfe;var rfe=Qt(function(e){var t=gc($m,0,su(function(r){return r[0].length},e));return Zu(t,function(){for(var r=0;r<e.length;){if(e[r][0].apply(this,arguments))return e[r][1].apply(this,arguments);r+=1}})});const afe=rfe;var ife=Qe(function(e,t){if(e>10)throw new Error("Constructor with greater than ten arguments");return e===0?function(){return new t}:YM(LS(e,function(r,i,o,u,c,p,h,g,m,w){switch(arguments.length){case 1:return new t(r);case 2:return new t(r,i);case 3:return new t(r,i,o);case 4:return new t(r,i,o,u);case 5:return new t(r,i,o,u,c);case 6:return new t(r,i,o,u,c,p);case 7:return new t(r,i,o,u,c,p,h);case 8:return new t(r,i,o,u,c,p,h,g);case 9:return new t(r,i,o,u,c,p,h,g,m);case 10:return new t(r,i,o,u,c,p,h,g,m,w)}}))});const Kz=ife;var sfe=Qt(function(e){return Kz(e.length,e)});const ofe=sfe;var ufe=Qe(Ih);const lfe=ufe;var cfe=Qe(function(e,t){return gi(gc($m,0,R1("length",t)),function(){var r=arguments,i=this;return e.apply(i,dm(function(o){return o.apply(i,r)},t))})});const Yz=cfe;var ffe=function(){function n(e,t,r,i){this.valueFn=e,this.valueAcc=t,this.keyFn=r,this.xf=i,this.inputs={}}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){var t;for(t in this.inputs)if(Ui(t,this.inputs)&&(e=this.xf["@@transducer/step"](e,this.inputs[t]),e["@@transducer/reduced"])){e=e["@@transducer/value"];break}return this.inputs=null,this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){var r=this.keyFn(t);return this.inputs[r]=this.inputs[r]||[r,this.valueAcc],this.inputs[r][1]=this.valueFn(this.inputs[r][1],t),e},n}(),dfe=k1(4,[],function(e,t,r,i){return new ffe(e,t,r,i)});const pfe=dfe;var FS=k1(4,[],Ga([],pfe,function(e,t,r,i){return Ts(function(o,u){var c=r(u);return o[c]=e(Ui(c,o)?o[c]:PS(t,[],[],!1),u),o},{},i)})),hfe=FS(function(n,e){return n+1},0);const yfe=hfe;var mfe=TS(-1);const gfe=mfe;var bfe=Qe(function(e,t){return t==null||t!==t?e:t});const Jz=bfe;var vfe=Sn(function(e,t,r){var i=e(t),o=e(r);return i>o?-1:i<o?1:0});const wfe=vfe;var Qz=function(){function n(){this._nativeSet=typeof Set=="function"?new Set:null,this._items={}}return n.prototype.add=function(e){return!wI(e,!0,this)},n.prototype.has=function(e){return wI(e,!1,this)},n}();function wI(n,e,t){var r=typeof n,i,o;switch(r){case"string":case"number":return n===0&&1/n===-1/0?t._items["-0"]?!0:(e&&(t._items["-0"]=!0),!1):t._nativeSet!==null?e?(i=t._nativeSet.size,t._nativeSet.add(n),o=t._nativeSet.size,o===i):t._nativeSet.has(n):r in t._items?n in t._items[r]?!0:(e&&(t._items[r][n]=!0),!1):(e&&(t._items[r]={},t._items[r][n]=!0),!1);case"boolean":if(r in t._items){var u=n?1:0;return t._items[r][u]?!0:(e&&(t._items[r][u]=!0),!1)}else return e&&(t._items[r]=n?[!1,!0]:[!0,!1]),!1;case"function":return t._nativeSet!==null?e?(i=t._nativeSet.size,t._nativeSet.add(n),o=t._nativeSet.size,o===i):t._nativeSet.has(n):r in t._items?Ih(n,t._items[r])?!0:(e&&t._items[r].push(n),!1):(e&&(t._items[r]=[n]),!1);case"undefined":return t._items[r]?!0:(e&&(t._items[r]=!0),!1);case"object":if(n===null)return t._items.null?!0:(e&&(t._items.null=!0),!1);default:return r=Object.prototype.toString.call(n),r in t._items?Ih(n,t._items[r])?!0:(e&&t._items[r].push(n),!1):(e&&(t._items[r]=[n]),!1)}}var xfe=Qe(function(e,t){for(var r=[],i=0,o=e.length,u=t.length,c=new Qz,p=0;p<u;p+=1)c.add(t[p]);for(;i<o;)c.add(e[i])&&(r[r.length]=e[i]),i+=1;return r});const k4=xfe;var _fe=Sn(function(e,t,r){for(var i=[],o=0,u=t.length;o<u;)!Cm(e,t[o],r)&&!Cm(e,t[o],i)&&i.push(t[o]),o+=1;return i});const T4=_fe;var Sfe=Qe(function(e,t){var r={};for(var i in t)r[i]=t[i];return delete r[e],r});const Zz=Sfe;var Efe=Sn(function(e,t,r){var i=Array.prototype.slice.call(r,0);return i.splice(e,t),i});const Xz=Efe;var Cfe=Sn(function(e,t,r){return Mz(e,RS(t),r)});const nk=Cfe;var Afe=Qe(function n(e,t){switch(e.length){case 0:return t;case 1:return Ph(e[0])&&Yu(t)?Xz(e[0],1,t):Zz(e[0],t);default:var r=e[0],i=Array.prototype.slice.call(e,1);return t[r]==null?t:Ph(r)&&Yu(t)?nk(r,n(i,t[r]),t):OS(r,n(i,t[r]),t)}});const Mfe=Afe;var kfe=Qe(function(e,t){return e/t});const Tfe=kfe;var Rfe=function(){function n(e,t){this.xf=t,this.n=e}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){return this.n>0?(this.n-=1,e):this.xf["@@transducer/step"](e,t)},n}(),Ofe=Qe(function(e,t){return new Rfe(e,t)});const Lfe=Ofe;var Nfe=Qe(Ga(["drop"],Lfe,function(e,t){return tu(Math.max(0,e),1/0,t)}));const ej=Nfe;var Pfe=function(){function n(e,t){this.xf=t,this.n=e,this.i=0}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){this.i+=1;var r=this.n===0?e:this.xf["@@transducer/step"](e,t);return this.n>=0&&this.i>=this.n?up(r):r},n}(),Ife=Qe(function(e,t){return new Pfe(e,t)});const Dfe=Ife;var Ufe=Qe(Ga(["take"],Dfe,function(e,t){return tu(0,e<0?1/0:e,t)}));const rk=Ufe;function Ffe(n,e){return rk(n<e.length?e.length-n:0,e)}var Bfe=function(){function n(e,t){this.xf=t,this.pos=0,this.full=!1,this.acc=new Array(e)}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.acc=null,this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){return this.full&&(e=this.xf["@@transducer/step"](e,this.acc[this.pos])),this.store(t),e},n.prototype.store=function(e){this.acc[this.pos]=e,this.pos+=1,this.pos===this.acc.length&&(this.pos=0,this.full=!0)},n}(),zfe=Qe(function(e,t){return new Bfe(e,t)});const jfe=zfe;var $fe=Qe(Ga([],jfe,Ffe));const Hfe=$fe;function qfe(n,e){for(var t=e.length-1;t>=0&&n(e[t]);)t-=1;return tu(0,t+1,e)}var Vfe=function(){function n(e,t){this.f=e,this.retained=[],this.xf=t}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.retained=null,this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.retain(e,t):this.flush(e,t)},n.prototype.flush=function(e,t){return e=Ts(this.xf["@@transducer/step"],e,this.retained),this.retained=[],this.xf["@@transducer/step"](e,t)},n.prototype.retain=function(e,t){return this.retained.push(t),e},n}(),Gfe=Qe(function(e,t){return new Vfe(e,t)});const Wfe=Gfe;var Kfe=Qe(Ga([],Wfe,qfe));const Yfe=Kfe;var Jfe=function(){function n(e,t){this.xf=t,this.pred=e,this.lastValue=void 0,this.seenFirstValue=!1}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){var r=!1;return this.seenFirstValue?this.pred(this.lastValue,t)&&(r=!0):this.seenFirstValue=!0,this.lastValue=t,r?e:this.xf["@@transducer/step"](e,t)},n}(),Qfe=Qe(function(e,t){return new Jfe(e,t)});const tj=Qfe;var Zfe=Hm(-1);const nj=Zfe;var Xfe=Qe(Ga([],tj,function(e,t){var r=[],i=1,o=t.length;if(o!==0)for(r[0]=t[0];i<o;)e(nj(r),t[i])||(r[r.length]=t[i]),i+=1;return r}));const rj=Xfe;var ede=Qt(Ga([],tj(ko),rj(ko)));const tde=ede;var nde=function(){function n(e,t){this.xf=t,this.f=e}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){if(this.f){if(this.f(t))return e;this.f=null}return this.xf["@@transducer/step"](e,t)},n}(),rde=Qe(function(e,t){return new nde(e,t)});const ade=rde;var ide=Qe(Ga(["dropWhile"],ade,function(e,t){for(var r=0,i=t.length;r<i&&e(t[r]);)r+=1;return tu(r,1/0,t)}));const sde=ide;var ode=Qe(function(e,t){return e||t});const aj=ode;var ude=Qe(function(e,t){return Em(e)?function(){return e.apply(this,arguments)||t.apply(this,arguments)}:NS(aj)(e,t)});const lde=ude;var cde=Qt(function(e){return e!=null&&typeof e["fantasy-land/empty"]=="function"?e["fantasy-land/empty"]():e!=null&&e.constructor!=null&&typeof e.constructor["fantasy-land/empty"]=="function"?e.constructor["fantasy-land/empty"]():e!=null&&typeof e.empty=="function"?e.empty():e!=null&&e.constructor!=null&&typeof e.constructor.empty=="function"?e.constructor.empty():Yu(e)?[]:Sm(e)?"":z2(e)?{}:Oz(e)?function(){return arguments}():void 0});const ij=cde;var fde=Qe(function(e,t){return ej(e>=0?t.length-e:0,t)});const sj=fde;var dde=Qe(function(n,e){return ko(sj(n.length,e),n)});const pde=dde;var hde=Sn(function(e,t,r){return ko(e(t),e(r))});const yde=hde;var mde=Sn(function(e,t,r){return ko(t[e],r[e])});const gde=mde;var bde=Qe(function n(e,t){var r=t instanceof Array?[]:{},i,o,u;for(o in t)i=e[o],u=typeof i,r[o]=u==="function"?i(t[o]):i&&u==="object"?n(i,t[o]):t[o];return r});const vde=bde;var wde=function(){function n(e,t){this.xf=t,this.f=e,this.found=!1}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,void 0)),this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.found=!0,e=up(this.xf["@@transducer/step"](e,t))),e},n}(),xde=Qe(function(e,t){return new wde(e,t)});const _de=xde;var Sde=Qe(Ga(["find"],_de,function(e,t){for(var r=0,i=t.length;r<i;){if(e(t[r]))return t[r];r+=1}}));const Ede=Sde;var Cde=function(){function n(e,t){this.xf=t,this.f=e,this.idx=-1,this.found=!1}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.found||(e=this.xf["@@transducer/step"](e,-1)),this.xf["@@transducer/result"](e)},n.prototype["@@transducer/step"]=function(e,t){return this.idx+=1,this.f(t)&&(this.found=!0,e=up(this.xf["@@transducer/step"](e,this.idx))),e},n}(),Ade=Qe(function(e,t){return new Cde(e,t)});const Mde=Ade;var kde=Qe(Ga([],Mde,function(e,t){for(var r=0,i=t.length;r<i;){if(e(t[r]))return r;r+=1}return-1}));const Tde=kde;var Rde=function(){function n(e,t){this.xf=t,this.f=e}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](e,this.last))},n.prototype["@@transducer/step"]=function(e,t){return this.f(t)&&(this.last=t),e},n}(),Ode=Qe(function(e,t){return new Rde(e,t)});const Lde=Ode;var Nde=Qe(Ga([],Lde,function(e,t){for(var r=t.length-1;r>=0;){if(e(t[r]))return t[r];r-=1}}));const Pde=Nde;var Ide=function(){function n(e,t){this.xf=t,this.f=e,this.idx=-1,this.lastIdx=-1}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=function(e){return this.xf["@@transducer/result"](this.xf["@@transducer/step"](e,this.lastIdx))},n.prototype["@@transducer/step"]=function(e,t){return this.idx+=1,this.f(t)&&(this.lastIdx=this.idx),e},n}(),Dde=Qe(function(e,t){return new Ide(e,t)});const Ude=Dde;var Fde=Qe(Ga([],Ude,function(e,t){for(var r=t.length-1;r>=0;){if(e(t[r]))return r;r-=1}return-1}));const Bde=Fde;var zde=Qt(Fz(!0));const jde=zde;var $de=Qt(function(e){return gi(e.length,function(t,r){var i=Array.prototype.slice.call(arguments,0);return i[0]=r,i[1]=t,e.apply(this,i)})});const BS=$de;var Hde=Qe(O1("forEach",function(e,t){for(var r=t.length,i=0;i<r;)e(t[i]),i+=1;return t}));const qde=Hde;var Vde=Qe(function(e,t){for(var r=Mo(t),i=0;i<r.length;){var o=r[i];e(t[o],o,t),i+=1}return t});const Gde=Vde;var Wde=Qt(function(e){for(var t={},r=0;r<e.length;)t[e[r][0]]=e[r][1],r+=1;return t});const Kde=Wde;var Yde=Qe(O1("groupBy",FS(function(n,e){return n==null&&(n=[]),n.push(e),n},null)));const Jde=Yde;var Qde=Qe(function(n,e){for(var t=[],r=0,i=e.length;r<i;){for(var o=r+1;o<i&&n(e[o-1],e[o]);)o+=1;t.push(e.slice(r,o)),r=o}return t});const Zde=Qde;var Xde=Qe(function(e,t){return e>t});const epe=Xde;var tpe=Qe(function(e,t){return e>=t});const npe=tpe;var rpe=Qe(function(e,t){if(e.length===0||U2(t))return!1;for(var r=t,i=0;i<e.length;)if(!U2(r)&&Ui(e[i],r))r=r[e[i]],i+=1;else return!1;return!0});const oj=rpe;var ape=Qe(function(e,t){return oj([e],t)});const ipe=ape;var spe=Qe(function(e,t){return e in t});const ope=spe;var upe=Qe(d2);const lpe=upe;var cpe=Sn(function(e,t,r){return gi(Math.max(e.length,t.length,r.length),function(){return e.apply(this,arguments)?t.apply(this,arguments):r.apply(this,arguments)})});const fpe=cpe;var dpe=TS(1);const ppe=dpe;var hpe=Qe(Ih);const ype=hpe;var mpe=FS(function(n,e){return e},null);const gpe=mpe;var bpe=Qe(function(e,t){return typeof t.indexOf=="function"&&!Yu(t)?t.indexOf(e):Gz(t,e,0)});const vpe=bpe;var wpe=tu(0,-1);const xpe=wpe;var _pe=Sn(function(e,t,r){return ZM(function(i){return Cm(e,i,r)},t)});const Spe=_pe;var Epe=Sn(function(e,t,r){e=e<r.length&&e>=0?e:r.length;var i=Array.prototype.slice.call(r,0);return i.splice(e,0,t),i});const Cpe=Epe;var Ape=Sn(function(e,t,r){return e=e<r.length&&e>=0?e:r.length,[].concat(Array.prototype.slice.call(r,0,e),t,Array.prototype.slice.call(r,e))});const Mpe=Ape;var uj=Qe(function(e,t){for(var r=new Qz,i=[],o=0,u,c;o<t.length;)c=t[o],u=e(c),r.add(u)&&i.push(c),o+=1;return i}),kpe=uj(DS);const ak=kpe;var Tpe=Qe(function(e,t){var r,i;return e.length>t.length?(r=e,i=t):(r=t,i=e),ak(ZM(BS(Ih)(r),i))});const Rpe=Tpe;var Ope=Qe(O1("intersperse",function(e,t){for(var r=[],i=0,o=t.length;i<o;)i===o-1?r.push(t[i]):r.push(t[i],e),i+=1;return r}));const Lpe=Ope;function Npe(n){if(n==null)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(n),t=1,r=arguments.length;t<r;){var i=arguments[t];if(i!=null)for(var o in i)Ui(o,i)&&(e[o]=i[o]);t+=1}return e}const P1=typeof Object.assign=="function"?Object.assign:Npe;var Ppe=Qe(function(e,t){var r={};return r[e]=t,r});const lj=Ppe;var Ipe={"@@transducer/init":Array,"@@transducer/step":function(n,e){return n.push(e),n},"@@transducer/result":N1},Dpe={"@@transducer/init":String,"@@transducer/step":function(n,e){return n+e},"@@transducer/result":N1},Upe={"@@transducer/init":Object,"@@transducer/step":function(n,e){return P1(n,T1(e)?lj(e[0],e[1]):e)},"@@transducer/result":N1};function Fpe(n){if(GM(n))return n;if(T1(n))return Ipe;if(typeof n=="string")return Dpe;if(typeof n=="object")return Upe;throw new Error("Cannot create transformer for "+n)}var Bpe=Sn(function(e,t,r){return GM(e)?Ts(t(e),e["@@transducer/init"](),r):Ts(t(Fpe(e)),PS(e,[],[],!1),r)});const zpe=Bpe;var jpe=Qt(function(e){for(var t=Mo(e),r=t.length,i=0,o={};i<r;){var u=t[i],c=e[u],p=Ui(c,o)?o[c]:o[c]=[];p[p.length]=u,i+=1}return o});const $pe=jpe;var Hpe=Qt(function(e){for(var t=Mo(e),r=t.length,i=0,o={};i<r;){var u=t[i];o[e[u]]=u,i+=1}return o});const qpe=Hpe;var Vpe=Qe(function(e,t){return gi(e+1,function(){var r=arguments[e];if(r!=null&&Em(r[t]))return r[t].apply(r,Array.prototype.slice.call(arguments,0,e));throw new TypeError(pm(r)+' does not have a method named "'+t+'"')})});const I1=Vpe;var Gpe=Qe(function(e,t){return t!=null&&t.constructor===e||t instanceof e});const cj=Gpe;var Wpe=Qt(function(e){return e!=null&&ko(e,ij(e))});const Kpe=Wpe;var Ype=I1(1,"join");const Jpe=Ype;var Qpe=Qt(function(e){return Yz(function(){return Array.prototype.slice.call(arguments,0)},e)});const fj=Qpe;var Zpe=Qt(function(e){var t,r=[];for(t in e)r[r.length]=t;return r});const Xpe=Zpe;var ehe=Qe(function(e,t){if(typeof t.lastIndexOf=="function"&&!Yu(t))return t.lastIndexOf(e);for(var r=t.length-1;r>=0;){if(ko(t[r],e))return r;r-=1}return-1});const the=ehe;function R4(n){return Object.prototype.toString.call(n)==="[object Number]"}var nhe=Qt(function(e){return e!=null&&R4(e.length)?e.length:NaN});const dj=nhe;var rhe=Qe(function(e,t){return function(r){return function(i){return su(function(o){return t(o,i)},r(e(i)))}}});const zS=rhe;var ahe=Qt(function(e){return zS(Hm(e),nk(e))});const ihe=ahe;var she=Qt(function(e){return zS(Yh(e),Dz(e))});const ohe=she;var uhe=Qt(function(e){return zS(WM(e),OS(e))});const lhe=uhe;var che=Qe(function(e,t){return e<t});const fhe=che;var dhe=Qe(function(e,t){return e<=t});const phe=dhe;var hhe=Sn(function(e,t,r){for(var i=0,o=r.length,u=[],c=[t];i<o;)c=e(c[0],r[i]),u[i]=c[1],i+=1;return[c[0],u]});const yhe=hhe;var mhe=Sn(function(e,t,r){for(var i=r.length-1,o=[],u=[t];i>=0;)u=e(u[0],r[i]),o[i]=u[1],i-=1;return[u[0],o]});const ghe=mhe;var bhe=Qe(function(e,t){return Ts(function(r,i){return r[i]=e(t[i],i,t),r},{},Mo(t))});const vhe=bhe;var whe=Qe(function(e,t){return t.match(e)||[]});const xhe=whe;var _he=Qe(function(e,t){return Ph(e)?!Ph(t)||t<1?NaN:(e%t+t)%t:NaN});const She=_he;var Ehe=Sn(function(e,t,r){return e(r)>e(t)?r:t});const Che=Ehe;var Ahe=gc(TS,0);const pj=Ahe;var Mhe=Qt(function(e){return pj(e)/e.length});const hj=Mhe;var khe=Qt(function(e){var t=e.length;if(t===0)return NaN;var r=2-t%2,i=(t-r)/2;return hj(Array.prototype.slice.call(e,0).sort(function(o,u){return o<u?-1:o>u?1:0}).slice(i,i+r))});const The=khe;var Rhe=Qe(function(e,t){var r={};return Zu(t.length,function(){var i=e.apply(this,arguments);return Ui(i,r)||(r[i]=t.apply(this,arguments)),r[i]})});const Ohe=Rhe;var Lhe=Qe(function(e,t){return P1({},e,t)});const Nhe=Lhe;var Phe=Qt(function(e){return P1.apply(null,[{}].concat(e))});const Ihe=Phe;var Dhe=Sn(function(e,t,r){var i={},o;for(o in t)Ui(o,t)&&(i[o]=Ui(o,r)?e(o,t[o],r[o]):t[o]);for(o in r)Ui(o,r)&&!Ui(o,i)&&(i[o]=r[o]);return i});const ik=Dhe;var Uhe=Sn(function n(e,t,r){return ik(function(i,o,u){return z2(o)&&z2(u)?n(e,o,u):e(i,o,u)},t,r)});const jS=Uhe;var Fhe=Qe(function(e,t){return jS(function(r,i,o){return i},e,t)});const Bhe=Fhe;var zhe=Qe(function(e,t){return jS(function(r,i,o){return o},e,t)});const jhe=zhe;var $he=Sn(function(e,t,r){return jS(function(i,o,u){return e(o,u)},t,r)});const Hhe=$he;var qhe=Qe(function(e,t){return P1({},t,e)});const Vhe=qhe;var Ghe=Qe(function(e,t){return P1({},e,t)});const Whe=Ghe;var Khe=Sn(function(e,t,r){return ik(function(i,o,u){return e(o,u)},t,r)});const Yhe=Khe;var Jhe=Qe(function(e,t){return t<e?t:e});const Qhe=Jhe;var Zhe=Sn(function(e,t,r){return e(r)<e(t)?r:t});const Xhe=Zhe;var e0e=Qe(function(e,t){return e%t});const t0e=e0e;var n0e=Sn(function(n,e,t){var r=t.length,i=t.slice(),o=n<0?r+n:n,u=e<0?r+e:e,c=i.splice(o,1);return o<0||o>=t.length||u<0||u>=t.length?t:[].concat(i.slice(0,u)).concat(c).concat(i.slice(u,t.length))});const r0e=n0e;var a0e=Qe(function(e,t){return e*t});const yj=a0e;var i0e=Qt(function(e){return-e});const s0e=i0e;var o0e=Qe(function(e,t){return kz(Wz(e),t)});const u0e=o0e;var l0e=Qt(function(e){var t=e<0?1:e+1;return gi(t,function(){return Hm(e,arguments)})});const c0e=l0e;var f0e=Sn(function(e,t,r){return e(t(r))});const d0e=f0e;function p0e(n){return[n]}var h0e=Qt(p0e);const y0e=h0e;var m0e=Qe(function(e,t){for(var r={},i={},o=0,u=e.length;o<u;)i[e[o]]=1,o+=1;for(var c in t)i.hasOwnProperty(c)||(r[c]=t[c]);return r});const g0e=m0e;var b0e=Qt(function(e){var t=!1,r;return Zu(e.length,function(){return t||(t=!0,r=e.apply(this,arguments)),r})});const v0e=b0e;function mj(n,e){if(e==null||!Em(e.then))throw new TypeError("`"+n+"` expected a Promise, received "+ek(e,[]))}var w0e=Qe(function(e,t){return mj("otherwise",t),t.then(null,e)});const x0e=w0e;var gj=function(n){return{value:n,map:function(e){return gj(e(n))}}},_0e=Sn(function(e,t,r){return e(function(i){return gj(t(i))})(r).value});const bj=_0e;var S0e=Qe(function(e,t){return[e,t]});const E0e=S0e;function vj(n){return Qe(function(e,t){return Zu(Math.max(0,e.length-t.length),function(){return e.apply(this,n(t,arguments))})})}var C0e=vj(Qu);const A0e=C0e;var M0e=vj(BS(Qu));const k0e=M0e;var T0e=fj([XM,US]);const R0e=T0e;var O0e=Sn(function(e,t,r){return ko(Yh(e,r),t)});const L0e=O0e;var N0e=Sn(function(e,t,r){return Jz(e,Yh(t,r))});const wj=N0e;var P0e=Sn(function(e,t,r){return e(Yh(t,r))});const I0e=P0e;var D0e=Qe(function(e,t){for(var r={},i=0;i<e.length;)e[i]in t&&(r[e[i]]=t[e[i]]),i+=1;return r});const U0e=D0e;var F0e=Qe(function(e,t){for(var r={},i=0,o=e.length;i<o;){var u=e[i];r[u]=t[u],i+=1}return r});const xj=F0e;var B0e=Qe(function(e,t){var r={};for(var i in t)e(t[i],i,t)&&(r[i]=t[i]);return r});const z0e=B0e;function j0e(){if(arguments.length===0)throw new Error("pipeK requires at least one argument");return $z.apply(this,L1(arguments))}var $0e=Qe(function(e,t){return Qu([e],t)});const _j=$0e;var H0e=gc(yj,1);const q0e=H0e;var Sj=Qe(function(e,t){return gi(t.length,function(){for(var r=[],i=0;i<t.length;)r.push(t[i].call(this,arguments[i])),i+=1;return e.apply(this,r.concat(Array.prototype.slice.call(arguments,t.length)))})}),V0e=Sj(dm,[xj,DS]);const G0e=V0e;var W0e=Sn(function(e,t,r){return ko(t,r[e])});const K0e=W0e;var Y0e=Sn(function(e,t,r){return cj(e,r[t])});const J0e=Y0e;var Q0e=Sn(function(e,t,r){return wj(e,[t],r)});const Z0e=Q0e;var X0e=Sn(function(e,t,r){return e(r[t])});const eye=X0e;var tye=Qe(function(e,t){return e.map(function(r){return Yh([r],t)})});const nye=tye;var rye=Qe(function(e,t){if(!(R4(e)&&R4(t)))throw new TypeError("Both arguments to range must be numbers");for(var r=[],i=e;i<t;)r.push(i),i+=1;return r});const aye=rye;var iye=Sn(function(e,t,r){for(var i=r.length-1;i>=0;)t=e(r[i],t),i-=1;return t});const Ej=iye;var sye=k1(4,[],function(e,t,r,i){return Ts(function(o,u){return e(o,u)?t(o,u):up(o)},r,i)});const oye=sye;var uye=Qt(up);const lye=uye;var cye=Qe(function(e,t){var r=Number(t),i=0,o;if(r<0||isNaN(r))throw new RangeError("n must be a non-negative number");for(o=new Array(r);i<r;)o[i]=e(i),i+=1;return o});const Cj=cye;var fye=Qe(function(e,t){return Cj(RS(e),t)});const dye=fye;var pye=Sn(function(e,t,r){return r.replace(e,t)});const hye=pye;var yye=Sn(function(e,t,r){for(var i=0,o=r.length,u=[t];i<o;)t=e(t,r[i]),u[i+1]=t,i+=1;return u});const mye=yye;var gye=Qe(function(e,t){return typeof t.sequence=="function"?t.sequence(e):Ej(function(r,i){return KM(su(_j,r),i)},e([]),t)});const Aj=gye;var bye=Sn(function(e,t,r){return bj(e,RS(t),r)});const vye=bye;var wye=Qe(function(e,t){return Array.prototype.slice.call(t,0).sort(e)});const xye=wye;var _ye=Qe(function(e,t){return Array.prototype.slice.call(t,0).sort(function(r,i){var o=e(r),u=e(i);return o<u?-1:o>u?1:0})});const Sye=_ye;var Eye=Qe(function(e,t){return Array.prototype.slice.call(t,0).sort(function(r,i){for(var o=0,u=0;o===0&&u<e.length;)o=e[u](r,i),u+=1;return o})});const Cye=Eye;var Aye=I1(1,"split");const Mye=Aye;var kye=Qe(function(e,t){return[tu(0,e,t),tu(e,dj(t),t)]});const Tye=kye;var Rye=Qe(function(e,t){if(e<=0)throw new Error("First argument to splitEvery must be a positive integer");for(var r=[],i=0;i<t.length;)r.push(tu(i,i+=e,t));return r});const Oye=Rye;var Lye=Qe(function(e,t){for(var r=0,i=t.length,o=[];r<i&&!e(t[r]);)o.push(t[r]),r+=1;return[o,Array.prototype.slice.call(t,r)]});const Nye=Lye;var Pye=Qe(function(n,e){return ko(rk(n.length,e),n)});const Iye=Pye;var Dye=Qe(function(e,t){return Number(e)-Number(t)});const Uye=Dye;var Fye=Qe(function(e,t){return tk(k4(e,t),k4(t,e))});const Bye=Fye;var zye=Sn(function(e,t,r){return tk(T4(e,t,r),T4(e,r,t))});const jye=zye;var $ye=Qe(function(e,t){for(var r=t.length-1;r>=0&&e(t[r]);)r-=1;return tu(r+1,1/0,t)});const Hye=$ye;var qye=function(){function n(e,t){this.xf=t,this.f=e}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){return this.f(t)?this.xf["@@transducer/step"](e,t):up(e)},n}(),Vye=Qe(function(e,t){return new qye(e,t)});const Gye=Vye;var Wye=Qe(Ga(["takeWhile"],Gye,function(e,t){for(var r=0,i=t.length;r<i&&e(t[r]);)r+=1;return tu(0,r,t)}));const Kye=Wye;var Yye=function(){function n(e,t){this.xf=t,this.f=e}return n.prototype["@@transducer/init"]=Nr.init,n.prototype["@@transducer/result"]=Nr.result,n.prototype["@@transducer/step"]=function(e,t){return this.f(t),this.xf["@@transducer/step"](e,t)},n}(),Jye=Qe(function(e,t){return new Yye(e,t)});const Qye=Jye;var Zye=Qe(Ga([],Qye,function(e,t){return e(t),t}));const Xye=Zye;function eme(n){return Object.prototype.toString.call(n)==="[object RegExp]"}var tme=Qe(function(e,t){if(!eme(e))throw new TypeError("‘test’ requires a value of type RegExp as its first argument; received "+pm(e));return Bz(e).test(t)});const nme=tme;var rme=Qe(function(e,t){return mj("andThen",t),t.then(e)});const ame=rme;var ime=I1(0,"toLowerCase");const sme=ime;var ome=Qt(function(e){var t=[];for(var r in e)Ui(r,e)&&(t[t.length]=[r,e[r]]);return t});const ume=ome;var lme=Qt(function(e){var t=[];for(var r in e)t[t.length]=[r,e[r]];return t});const cme=lme;var fme=I1(0,"toUpperCase");const dme=fme;var pme=gi(4,function(e,t,r,i){return Ts(e(typeof t=="function"?Tz(t):t),r,i)});const hme=pme;var yme=Qt(function(e){for(var t=0,r=[];t<e.length;){for(var i=e[t],o=0;o<i.length;)typeof r[o]>"u"&&(r[o]=[]),r[o].push(i[o]),o+=1;t+=1}return r});const mme=yme;var gme=Sn(function(e,t,r){return typeof r["fantasy-land/traverse"]=="function"?r["fantasy-land/traverse"](t,e):Aj(e,su(t,r))});const bme=gme;var hv=`
322
322
  \v\f\r                 \u2028\u2029\uFEFF`,vme="​",wme=typeof String.prototype.trim=="function",xme=Qt(!wme||hv.trim()||!vme.trim()?function(e){var t=new RegExp("^["+hv+"]["+hv+"]*"),r=new RegExp("["+hv+"]["+hv+"]*$");return e.replace(t,"").replace(r,"")}:function(e){return e.trim()});const _me=xme;var Sme=Qe(function(e,t){return Zu(e.length,function(){try{return e.apply(this,arguments)}catch(r){return t.apply(this,Qu([r],arguments))}})});const Eme=Sme;var Cme=Qt(function(e){return function(){return e(Array.prototype.slice.call(arguments,0))}});const Ame=Cme;var Mme=Qt(function(e){return LS(1,e)});const kme=Mme;var Tme=Qe(function(e,t){return gi(e,function(){for(var r=1,i=t,o=0,u;r<=e&&typeof i=="function";)u=r===e?arguments.length:o+i.length,i=i.apply(this,Array.prototype.slice.call(arguments,o,u)),r+=1,o=u;return i})});const Rme=Tme;var Ome=Qe(function(e,t){for(var r=e(t),i=[];r&&r.length;)i[i.length]=r[0],r=e(r[1]);return i});const Lme=Ome;var Nme=Qe(B2(ak,Qu));const Pme=Nme;var Ime=Qe(function(e,t){for(var r=0,i=t.length,o=[],u;r<i;)u=t[r],Cm(e,u,o)||(o[o.length]=u),r+=1;return o});const Mj=Ime;var Dme=Sn(function(e,t,r){return Mj(e,Qu(t,r))});const Ume=Dme;var Fme=Sn(function(e,t,r){return e(r)?r:t(r)});const Bme=Fme;var zme=JM(N1);const jme=zme;var $me=Sn(function(e,t,r){for(var i=r;!e(i);)i=t(i);return i});const Hme=$me;var qme=Qt(function(e){var t,r=[];for(t in e)r[r.length]=e[t];return r});const Vme=qme;var Gme=function(n){return{value:n,"fantasy-land/map":function(){return this}}},Wme=Qe(function(e,t){return e(Gme)(t).value});const Kme=Wme;var Yme=Sn(function(e,t,r){return e(r)?t(r):r});const Jme=Yme;var Qme=Qe(function(e,t){for(var r in e)if(Ui(r,e)&&!e[r](t[r]))return!1;return!0});const kj=Qme;var Zme=Qe(function(e,t){return kj(su(ko,e),t)});const Xme=Zme;var ege=Qe(function(n,e){return US(BS(Ih)(n),e)});const tge=ege;var nge=Qe(function(e,t){return!!(!e^!t)});const rge=nge;var age=Qe(function(e,t){for(var r=0,i=e.length,o,u=t.length,c=[];r<i;){for(o=0;o<u;)c[c.length]=[e[r],t[o]],o+=1;r+=1}return c});const ige=age;var sge=Qe(function(e,t){for(var r=[],i=0,o=Math.min(e.length,t.length);i<o;)r[i]=[e[i],t[i]],i+=1;return r});const oge=sge;var uge=Qe(function(e,t){for(var r=0,i=Math.min(e.length,t.length),o={};r<i;)o[e[r]]=t[r],r+=1;return o});const lge=uge;var cge=Sn(function(e,t,r){for(var i=[],o=0,u=Math.min(t.length,r.length);o<u;)i[o]=e(t[o],r[o]),o+=1;return i});const fge=cge;var dge=Qt(function(e){return gi(e.length,function(){var r=arguments;return function(){return e.apply(this,r)}})});const pge=dge,hge=Object.freeze(Object.defineProperty({__proto__:null,F:cle,T:dle,__:ple,add:TS,addIndex:gle,adjust:Mz,all:kz,allPass:Fle,always:RS,and:Nz,andThen:ame,any:Vle,anyPass:Wle,ap:KM,aperture:ece,append:nce,apply:Pz,applySpec:sce,applyTo:uce,ascend:cce,assoc:OS,assocPath:Dz,binary:mce,bind:Rz,both:vce,call:xce,chain:JM,clamp:Tce,clone:Lce,comparator:Pce,complement:Uce,compose:B2,composeK:$z,composeP:zce,composeWith:Vce,concat:tk,cond:afe,construct:ofe,constructN:Kz,contains:lfe,converge:Yz,countBy:yfe,curry:YM,curryN:gi,dec:gfe,defaultTo:Jz,descend:wfe,difference:k4,differenceWith:T4,dissoc:Zz,dissocPath:Mfe,divide:Tfe,drop:ej,dropLast:Hfe,dropLastWhile:Yfe,dropRepeats:tde,dropRepeatsWith:rj,dropWhile:sde,either:lde,empty:ij,endsWith:pde,eqBy:yde,eqProps:gde,equals:ko,evolve:vde,filter:XM,find:Ede,findIndex:Tde,findLast:Pde,findLastIndex:Bde,flatten:jde,flip:BS,forEach:qde,forEachObjIndexed:Gde,fromPairs:Kde,groupBy:Jde,groupWith:Zde,gt:epe,gte:npe,has:ipe,hasIn:ope,hasPath:oj,head:qz,identical:lpe,identity:DS,ifElse:fpe,inc:ppe,includes:ype,indexBy:gpe,indexOf:vpe,init:xpe,innerJoin:Spe,insert:Cpe,insertAll:Mpe,intersection:Rpe,intersperse:Lpe,into:zpe,invert:$pe,invertObj:qpe,invoker:I1,is:cj,isEmpty:Kpe,isNil:U2,join:Jpe,juxt:fj,keys:Mo,keysIn:Xpe,last:nj,lastIndexOf:the,length:dj,lens:zS,lensIndex:ihe,lensPath:ohe,lensProp:lhe,lift:NS,liftN:Uz,lt:fhe,lte:phe,map:su,mapAccum:yhe,mapAccumRight:ghe,mapObjIndexed:vhe,match:xhe,mathMod:She,max:$m,maxBy:Che,mean:hj,median:The,memoizeWith:Ohe,merge:Nhe,mergeAll:Ihe,mergeDeepLeft:Bhe,mergeDeepRight:jhe,mergeDeepWith:Hhe,mergeDeepWithKey:jS,mergeLeft:Vhe,mergeRight:Whe,mergeWith:Yhe,mergeWithKey:ik,min:Qhe,minBy:Xhe,modulo:t0e,move:r0e,multiply:yj,nAry:LS,negate:s0e,none:u0e,not:zz,nth:Hm,nthArg:c0e,o:d0e,objOf:lj,of:y0e,omit:g0e,once:v0e,or:aj,otherwise:x0e,over:bj,pair:E0e,partial:A0e,partialRight:k0e,partition:R0e,path:Yh,pathEq:L0e,pathOr:wj,pathSatisfies:I0e,paths:Lz,pick:U0e,pickAll:xj,pickBy:z0e,pipe:jz,pipeK:j0e,pipeP:Hz,pipeWith:Vz,pluck:R1,prepend:_j,product:q0e,project:G0e,prop:WM,propEq:K0e,propIs:J0e,propOr:Z0e,propSatisfies:eye,props:nye,range:aye,reduce:gc,reduceBy:FS,reduceRight:Ej,reduceWhile:oye,reduced:lye,reject:US,remove:Xz,repeat:dye,replace:hye,reverse:L1,scan:mye,sequence:Aj,set:vye,slice:tu,sort:xye,sortBy:Sye,sortWith:Cye,split:Mye,splitAt:Tye,splitEvery:Oye,splitWhen:Nye,startsWith:Iye,subtract:Uye,sum:pj,symmetricDifference:Bye,symmetricDifferenceWith:jye,tail:IS,take:rk,takeLast:sj,takeLastWhile:Hye,takeWhile:Kye,tap:Xye,test:nme,thunkify:pge,times:Cj,toLower:sme,toPairs:ume,toPairsIn:cme,toString:pm,toUpper:dme,transduce:hme,transpose:mme,traverse:bme,trim:_me,tryCatch:Eme,type:F2,unapply:Ame,unary:kme,uncurryN:Rme,unfold:Lme,union:Pme,unionWith:Ume,uniq:ak,uniqBy:uj,uniqWith:Mj,unless:Bme,unnest:jme,until:Hme,update:nk,useWith:Sj,values:Iz,valuesIn:Vme,view:Kme,when:Jme,where:kj,whereEq:Xme,without:tge,xor:rge,xprod:ige,zip:oge,zipObj:lge,zipWith:fge},Symbol.toStringTag,{value:"Module"})),yge=o1(hge);var xI;function mge(){if(xI)return Id;xI=1;const n=yge,e=Ro,{ValidateLibrary:t,ValidateVersion:r,ValidateParameters:i}=yc,o=function(u){if(!u)throw Error("No mezzanine preparation job info found at /abr_mezzanine");const c=Object.keys(u).find(p=>u[p].mez_prep_specs);if(!c)throw Error("Could not determine offering key for last submitted job");return c};return Id.CreateProductionMaster=async function({libraryId:u,type:c,name:p,description:h,metadata:g={},fileInfo:m,encrypt:w=!0,access:v=[],copy:C=!1,callback:T,respLogLevel:R="warn",structLogLevel:O="none"}){t(u);const{id:I,write_token:D}=await this.CreateContentObject({libraryId:u,options:c?{type:c}:{}});if(m)if(v.length>0){const ge=/^s3:\/\/([^/]+)\//i;for(let Se=0;Se<m.length;Se++){const _e=m[Se];let ae=!1;for(let Te=0;!ae&&Te<v.length;Te++){let S=v[Te];const x=S.remote_access.path.replace(/\/$/,""),A=S.path_matchers;for(let U=0;!ae&&U<A.length;U++){const L=new RegExp(A[U]),z=_e.source;if(L.test(z)){ae=!0;const Y=ge.exec(z);if(Y&&Y[1]!==x)throw Error('Full S3 file path "'+z+`" matched to credential set with different bucket name '`+x+"'");S.hasOwnProperty("matched")?S.matched.push(_e):S.matched=[_e]}}}if(!ae)throw Error('no credential set found for file path: "'+filePath+'"')}for(let Se=0;Se<v.length;Se++){const _e=v[Se];if(_e.hasOwnProperty("matched")&&_e.matched.length>0){const ae=_e.remote_access.storage_endpoint.region,Te=_e.remote_access.path.replace(/\/$/,""),S=_e.remote_access.cloud_credentials.access_key_id,x=_e.remote_access.cloud_credentials.secret_access_key;await this.UploadFilesFromS3({libraryId:u,objectId:I,writeToken:D,fileInfo:_e.matched,region:ae,bucket:Te,accessKey:S,secret:x,copy:C,callback:T,encryption:w?"cgck":"none"})}}}else await this.UploadFiles({libraryId:u,objectId:I,writeToken:D,fileInfo:m,callback:T,encryption:w?"cgck":"none"});await this.CreateEncryptionConk({libraryId:u,objectId:I,writeToken:D,createKMSConk:!0});const{logs:K,errors:W,warnings:pe}=await this.CallBitcodeMethod({libraryId:u,objectId:I,writeToken:D,method:e("media","production_master","init"),queryParams:{response_log_level:R,struct_log_level:O},body:{access:v},constant:!1});await this.MergeMetadata({libraryId:u,objectId:I,writeToken:D,metadata:{...g||{},name:p,description:h,reference:v&&!C,public:{...(g||{}).public||{},name:p||"",description:h||""},elv_created_at:new Date().getTime()}});const ce=await this.FinalizeContentObject({libraryId:u,objectId:I,writeToken:D,commitMessage:"Create master",awaitCommitConfirmation:!1});return{errors:W||[],logs:K||[],warnings:pe||[],...ce}},Id.CreateABRMezzanine=async function({libraryId:u,objectId:c,type:p,name:h,description:g,metadata:m,masterVersionHash:w,abrProfile:v,addlOfferingSpecs:C,variant:T="default",offeringKey:R="default",keepOtherStreams:O=!1,respLogLevel:I="warn",structLogLevel:D="none",streamKeys:K}){if(t(u),r(w),!w)throw Error("Master version hash not specified");if(!c&&O)throw Error("Existing mezzanine object ID required in order to use 'keepOtherStreams'");if(C&&!v)throw Error("abrProfile required when using addlOfferingSpecs");const W=!!c;let pe=p?{type:p}:{},ce,ge;if(W){const Y=await this.EditContentObject({libraryId:u,objectId:c,options:pe});ce=Y.id,ge=Y.write_token}else{const Y=await this.CreateContentObject({libraryId:u,options:pe});ce=Y.id,ge=Y.write_token}await this.CreateEncryptionConk({libraryId:u,objectId:ce,writeToken:ge,createKMSConk:!0});const Se=await this.ContentObjectMetadata({versionHash:w,metadataSubtree:"public/name"});let _e=[];_e.push(await this.authClient.AuthorizationToken({libraryId:u,objectId:ce,update:!0})),_e.push(await this.authClient.AuthorizationToken({libraryId:u})),_e.push(await this.authClient.AuthorizationToken({versionHash:w}));const ae={Authorization:_e.map(Y=>`Bearer ${Y}`).join(",")},Te={additional_offering_specs:C,offering_key:R,keep_other_streams:O,prod_master_hash:w,stream_keys:K,variant_key:T};let S=!1;v?(Te.abr_profile=v,S=v.store_clear):S=await this.ContentObjectMetadata({libraryId:u,objectId:this.utils.AddressToObjectId(this.utils.HashToAddress(u)),metadataSubtree:"abr_profile/store_clear"}),S||await this.EncryptionConk({libraryId:u,objectId:ce,writeToken:ge});const{logs:x,errors:A,warnings:U}=await this.CallBitcodeMethod({libraryId:u,objectId:ce,writeToken:ge,method:e("media","abr_mezzanine","init"),queryParams:{response_log_level:I,struct_log_level:D},headers:ae,body:Te,constant:!1});m||(m={}),m.public||(m.public={}),m.public.asset_metadata||(m.public.asset_metadata={}),m.master={name:Se,id:this.utils.DecodeVersionHash(w).objectId,hash:w,variant:T},m.public={...m.public},m.public.asset_metadata={sources:{[R]:{"/":`./rep/playout/${R}/options.json`}},...m.public.asset_metadata},(h||!W)&&(m.name=h||`${Se} Mezzanine`,m.public.name=h||`${Se} Mezzanine`),(g||!W)&&(m.description=g||"",m.public.description=g||"");const L=await this.ContentObjectMetadata({libraryId:u,objectId:ce,writeToken:ge});m=n.mergeDeepRight(L,m),W||(m.elv_created_at=new Date().getTime()),await this.ReplaceMetadata({libraryId:u,objectId:ce,writeToken:ge,metadata:m});const z=await this.FinalizeContentObject({libraryId:u,objectId:ce,writeToken:ge,commitMessage:"Create ABR mezzanine"});return{logs:x||[],warnings:U||[],errors:A||[],...z}},Id.StartABRMezzanineJobs=async function({libraryId:u,objectId:c,access:p=[],jobIndexes:h=null}){i({libraryId:u,objectId:c});const g=await this.ContentObjectMetadata({libraryId:u,objectId:c,metadataSubtree:e("abr_mezzanine","offerings")}),m=o(g),w=g[m].mez_prep_specs;if(!w)throw Error("No stream preparation specs found");let v=Object.keys(w).map(ge=>(w[ge].source_streams||[]).map(Se=>Se.source_hash));v=[].concat.apply([],v).filter(ge=>ge).filter((ge,Se,_e)=>_e.indexOf(ge)===Se);let C=await Promise.all(v.map(async ge=>await this.authClient.AuthorizationToken({versionHash:ge})));C=[await this.authClient.AuthorizationToken({libraryId:u,objectId:c,update:!0}),...C];const T={Authorization:C.map(ge=>`Bearer ${ge}`).join(",")},R=await this.EditContentObject({libraryId:u,objectId:c}),O={write_token:R.write_token,node:R.nodeUrl,offering:m},I=await this.EditContentObject({libraryId:u,objectId:c});await this.ReplaceMetadata({libraryId:u,objectId:c,writeToken:I.write_token,metadataSubtree:"lro_draft",metadata:O});const D=await this.FinalizeContentObject({libraryId:u,objectId:c,writeToken:I.write_token,commitMessage:"Mezzanine LRO status"}),{data:K,errors:W,warnings:pe,logs:ce}=await this.CallBitcodeMethod({libraryId:u,objectId:c,writeToken:R.write_token,headers:T,method:e("media","abr_mezzanine","prep_start"),constant:!1,body:{access:p,offering_key:m,job_indexes:h}});return{hash:D.hash,lro_draft:O,writeToken:R.write_token,nodeUrl:R.nodeUrl,data:K,logs:ce||[],warnings:pe||[],errors:W||[]}},Id.LRODraftInfo=async function({libraryId:u,objectId:c}){const p=await this.ContentObjectMetadata({libraryId:u,objectId:c,metadataSubtree:"lro_draft"});if(p)return p;const h=await this.ContentObjectMetadata({libraryId:u,objectId:c,metadataSubtree:e("abr_mezzanine","offerings")});if(!h)throw Error("No metadata for mezzanine preparation job found at /abr_mezzanine");const g=o(h);if(!g)throw Error("Could not determine offering key for last submitted job");const m=h[g].ready,w=await this.ContentObjectMetadata({libraryId:u,objectId:c,metadataSubtree:`lro_draft_${g}`});if(w)return w;throw Error(m?"No LRO draft found for this mezzanine - looks like last mez prep job was already finalized.":"No LRO draft found for this mezzanine - looks like last mez prep job was either cancelled or discarded.")},Id.LROStatus=async function({libraryId:u,objectId:c}){i({libraryId:u,objectId:c});const p=await this.LRODraftInfo({libraryId:u,objectId:c});return this.RecordWriteToken({writeToken:p.write_token,fabricNodeUrl:p.node}),await this.ContentObjectMetadata({libraryId:u,objectId:c,writeToken:p.write_token,metadataSubtree:"lro_status"})},Id.FinalizeABRMezzanine=async function({libraryId:u,objectId:c,preFinalizeFn:p,preFinalizeThrow:h}){i({libraryId:u,objectId:c});const g=await this.LRODraftInfo({libraryId:u,objectId:c});this.RecordWriteToken({writeToken:g.write_token,fabricNodeUrl:g.node});const m=await this.ContentObjectMetadata({libraryId:u,objectId:c,writeToken:g.write_token,metadataSubtree:e("abr_mezzanine","offerings")}),w=o(m),v=m[w].prod_master_hash,T={Authorization:[await this.authClient.AuthorizationToken({libraryId:u,objectId:c,update:!0}),await this.authClient.AuthorizationToken({versionHash:v})].map(pe=>`Bearer ${pe}`).join(",")},{data:R,errors:O,warnings:I,logs:D}=await this.CallBitcodeMethod({objectId:c,libraryId:u,writeToken:g.write_token,method:e("media","abr_mezzanine","offerings",w,"finalize"),headers:T,constant:!1});let K=[];if(p){const pe={nodeUrl:g.node,offeringKey:w,writeToken:g.write_token};try{await p(pe)}catch(ce){if(h)throw new Error("Error running preFinalize function",{cause:ce});K=`Error running preFinalize function: ${ce}`}}const W=await this.FinalizeContentObject({libraryId:u,objectId:c,writeToken:g.write_token,commitMessage:"Finalize ABR mezzanine",awaitCommitConfirmation:!1});return{data:R,logs:D||[],warnings:(I||[]).concat(K),errors:O||[],...W}},Id}var zu={},g5={},_I;function gge(){if(_I)return g5;_I=1;const n={2160:{bit_rate:14e6,codecs:"avc1.640028,mp4a.40.2",height:2160,media_type:1,representation:"videovideo_3840x2160_h264@14000000",stream_name:"video",width:3840},1080:{bit_rate:95e5,codecs:"avc1.640028,mp4a.40.2",height:1080,media_type:1,representation:"videovideo_1920x1080_h264@9500000",stream_name:"video",width:1920},720:{bit_rate:45e5,codecs:"avc1.640028,mp4a.40.2",height:720,media_type:1,representation:"videovideo_1280x720_h264@4500000",stream_name:"video",width:1280},540:{bit_rate:2e6,codecs:"avc1.640028,mp4a.40.2",height:540,media_type:1,representation:"videovideo_960x540_h264@2000000",stream_name:"video",width:960},"540_low":{bit_rate:9e5,codecs:"avc1.640028,mp4a.40.2",height:540,media_type:1,representation:"videovideo_960x540_h264@900000",stream_name:"video",width:960}},e={live_recording:{fabric_config:{ingress_node_api:"",ingress_node_id:""},playout_config:{rebroadcast_start_time_sec_epoch:0,vod_enabled:!1},recording_config:{recording_params:{description:"",ladder_specs:[{bit_rate:384e3,channels:2,codecs:"mp4a.40.2",media_type:2,representation:"audioaudio_aac@384000",stream_name:"audio"}],listen:!0,live_delay_nano:2e9,max_duration_sec:-1,name:"",origin_url:"",part_ttl:3600,playout_type:"live",source_timescale:null,xc_params:{audio_bitrate:384e3,audio_index:[0,0,0,0,0,0,0,0],audio_seg_duration_ts:null,ecodec2:"aac",enc_height:null,enc_width:null,filter_descriptor:"",force_keyint:null,format:"fmp4-segment",listen:!0,n_audio:1,preset:"faster",sample_rate:48e3,seg_duration:null,skip_decoding:!1,start_segment_str:"1",stream_id:-1,sync_audio_to_stream_id:-1,video_bitrate:null,video_seg_duration_ts:null,xc_type:3}}}}};let t=class{constructor(i,o,u,c,p,h){this.probeData=i,this.nodeId=o,this.nodeUrl=u,this.includeAVSegDurations=c,this.overwriteOriginUrl=p,this.syncAudioToVideo=h}probeKind(){return this.probeData.format.filename.split(":")[0]}getStreamDataForCodecType(i){let o=null;for(let u=0;u<this.probeData.streams.length;u++)this.probeData.streams[u].codec_type==i&&(o=this.probeData.streams[u]);return o}getFrameRate(){let i=this.getStreamDataForCodecType("video");return(i.r_frame_rate||i.frame_rate).split("/")}isFrameRateWhole(){return this.getFrameRate()[1]=="1"}getForceKeyint(){let i=this.getFrameRate(),o=Math.round(i[0]/i[1]);return o>30?o:o*2}calcSegDuration({sourceTimescale:i}){let u=this.getStreamDataForCodecType("video").frame_rate,c={};switch(c.audio=29.76*48e3,u){case"24":c.video=30*i,c.keyint=48,c.duration="30";break;case"25":c.video=30*i,c.keyint=50,c.duration="30";break;case"30":c.video=30*i,c.keyint=60,c.duration="30";break;case"30000/1001":c.video=30.03*i,c.keyint=60,c.duration="30.03";break;case"48":c.video=30*i,c.keyint=96,c.duration="30";break;case"50":c.video=30*i,c.keyint=100,c.duration="30";break;case"60":c.video=30*i,c.keyint=120,c.duration="30";break;case"60000/1001":c.video=30.03*i,c.keyint=120,c.duration="30.03";break;default:console.log("Unsupported frame rate",u);break}return c}syncAudioToStreamIdValue(){let i=-1,o=this.getStreamDataForCodecType("video");switch(this.probeKind()){case"udp":i=o.stream_id;break;case"rtmp":i=-1;break}return i}generateLiveConf({audioBitrate:i,audioIndex:o,partTtl:u,channelLayout:c}){const p=JSON.parse(JSON.stringify(e)),h=this.overwriteOriginUrl||this.probeData.format.filename,g=this.getStreamDataForCodecType("audio"),m=parseInt(g.sample_rate),w=this.getStreamDataForCodecType("video");let v;switch(console.log("AUDIO",g),console.log("VIDEO",w),p.live_recording.fabric_config.ingress_node_api=this.nodeUrl||null,p.live_recording.fabric_config.ingress_node_id=this.nodeId||null,p.live_recording.recording_config.recording_params.description,p.live_recording.recording_config.recording_params.origin_url=h,p.live_recording.recording_config.recording_params.description=`Ingest stream ${h}`,p.live_recording.recording_config.recording_params.name=`Ingest stream ${h}`,p.live_recording.recording_config.recording_params.xc_params.audio_index[0]=o===void 0?g.stream_index:o,p.live_recording.recording_config.recording_params.xc_params.sample_rate=m,p.live_recording.recording_config.recording_params.xc_params.enc_height=w.height,p.live_recording.recording_config.recording_params.xc_params.enc_width=w.width,this.syncAudioToVideo&&(p.live_recording.recording_config.recording_params.xc_params.sync_audio_to_stream_id=this.syncAudioToStreamIdValue()),u&&(p.live_recording.recording_config.recording_params.part_ttl=u),this.probeKind()){case"udp":v=9e4,p.live_recording.recording_config.recording_params.source_timescale=v;break;case"rtmp":v=16e3,p.live_recording.recording_config.recording_params.source_timescale=v;break;case"hls":console.log("HLS detected. Not yet implemented");break;default:console.log("Unsupported media",this.probeKind());break}const C=this.calcSegDuration({sourceTimescale:v});switch(p.live_recording.recording_config.recording_params.xc_params.seg_duration=C.duration,p.live_recording.recording_config.recording_params.xc_params.audio_seg_duration_ts=C.audio,p.live_recording.recording_config.recording_params.xc_params.video_seg_duration_ts=C.video,p.live_recording.recording_config.recording_params.xc_params.force_keyint=C.keyint,w.height){case 2160:p.live_recording.recording_config.recording_params.ladder_specs.unshift(n[2160],n[1080],n[720],n[540],n["540_low"]),p.live_recording.recording_config.recording_params.xc_params.video_bitrate=n[2160].bit_rate,p.live_recording.recording_config.recording_params.xc_params.enc_height=2160,p.live_recording.recording_config.recording_params.xc_params.enc_width=3840;break;case 1080:p.live_recording.recording_config.recording_params.ladder_specs.unshift(n[1080],n[720],n[540],n["540_low"]),p.live_recording.recording_config.recording_params.xc_params.video_bitrate=n[1080].bit_rate,p.live_recording.recording_config.recording_params.xc_params.enc_height=1080,p.live_recording.recording_config.recording_params.xc_params.enc_width=1920;break;case 720:p.live_recording.recording_config.recording_params.ladder_specs.unshift(n[720],n[540],n["540_low"]),p.live_recording.recording_config.recording_params.xc_params.video_bitrate=n[720].bit_rate,p.live_recording.recording_config.recording_params.xc_params.enc_height=720,p.live_recording.recording_config.recording_params.xc_params.enc_width=1280;break;case 540:p.live_recording.recording_config.recording_params.ladder_specs.unshift(n[540],n["540_low"]),p.live_recording.recording_config.recording_params.xc_params.video_bitrate=n[540].bit_rate,p.live_recording.recording_config.recording_params.xc_params.enc_height=540,p.live_recording.recording_config.recording_params.xc_params.enc_width=960;break;default:throw new Error("ERROR: Probed stream does not conform to one of the following built in resolution ladders [4096, 2160], [1920, 1080] [1280, 720], [960, 540]")}if(i||c){const T=p.live_recording.recording_config.recording_params.ladder_specs.find(R=>R.stream_name==="audio");i&&(p.live_recording.recording_config.recording_params.xc_params.audio_bitrate=i,T.bit_rate=i,T.representation=`audioaudio_aac@${i}`),c&&(T.channels=c)}return JSON.stringify(p,null,2)}};return g5.LiveConf=t,g5}var Gy={exports:{}},b5={},v5,SI;function bge(){return SI||(SI=1,v5=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"}),v5}var K_={exports:{}},EI;function vge(){return EI||(EI=1,typeof Object.create=="function"?K_.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:K_.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}),K_.exports}var CI;function wge(){return CI||(CI=1,function(n){var e=/%[sdj%]/g;n.format=function(L){if(!D(L)){for(var z=[],Y=0;Y<arguments.length;Y++)z.push(i(arguments[Y]));return z.join(" ")}for(var Y=1,q=arguments,P=q.length,M=String(L).replace(e,function(ie){if(ie==="%%")return"%";if(Y>=P)return ie;switch(ie){case"%s":return String(q[Y++]);case"%d":return Number(q[Y++]);case"%j":try{return JSON.stringify(q[Y++])}catch{return"[Circular]"}default:return ie}}),Q=q[Y];Y<P;Q=q[++Y])R(Q)||!ce(Q)?M+=" "+Q:M+=" "+i(Q);return M},n.deprecate=function(L,z){if(W(Va.process))return function(){return n.deprecate(L,z).apply(this,arguments)};if(process.noDeprecation===!0)return L;var Y=!1;function q(){if(!Y){if(process.throwDeprecation)throw new Error(z);process.traceDeprecation?console.trace(z):console.error(z),Y=!0}return L.apply(this,arguments)}return q};var t={},r;n.debuglog=function(L){if(W(r)&&(r=process.env.NODE_DEBUG||""),L=L.toUpperCase(),!t[L])if(new RegExp("\\b"+L+"\\b","i").test(r)){var z=process.pid;t[L]=function(){var Y=n.format.apply(n,arguments);console.error("%s %d: %s",L,z,Y)}}else t[L]=function(){};return t[L]};function i(L,z){var Y={seen:[],stylize:u};return arguments.length>=3&&(Y.depth=arguments[2]),arguments.length>=4&&(Y.colors=arguments[3]),T(z)?Y.showHidden=z:z&&n._extend(Y,z),W(Y.showHidden)&&(Y.showHidden=!1),W(Y.depth)&&(Y.depth=2),W(Y.colors)&&(Y.colors=!1),W(Y.customInspect)&&(Y.customInspect=!0),Y.colors&&(Y.stylize=o),p(Y,L,Y.depth)}n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function o(L,z){var Y=i.styles[z];return Y?"\x1B["+i.colors[Y][0]+"m"+L+"\x1B["+i.colors[Y][1]+"m":L}function u(L,z){return L}function c(L){var z={};return L.forEach(function(Y,q){z[Y]=!0}),z}function p(L,z,Y){if(L.customInspect&&z&&_e(z.inspect)&&z.inspect!==n.inspect&&!(z.constructor&&z.constructor.prototype===z)){var q=z.inspect(Y,L);return D(q)||(q=p(L,q,Y)),q}var P=h(L,z);if(P)return P;var M=Object.keys(z),Q=c(M);if(L.showHidden&&(M=Object.getOwnPropertyNames(z)),Se(z)&&(M.indexOf("message")>=0||M.indexOf("description")>=0))return g(z);if(M.length===0){if(_e(z)){var ie=z.name?": "+z.name:"";return L.stylize("[Function"+ie+"]","special")}if(pe(z))return L.stylize(RegExp.prototype.toString.call(z),"regexp");if(ge(z))return L.stylize(Date.prototype.toString.call(z),"date");if(Se(z))return g(z)}var H="",we=!1,Ne=["{","}"];if(C(z)&&(we=!0,Ne=["[","]"]),_e(z)){var ke=z.name?": "+z.name:"";H=" [Function"+ke+"]"}if(pe(z)&&(H=" "+RegExp.prototype.toString.call(z)),ge(z)&&(H=" "+Date.prototype.toUTCString.call(z)),Se(z)&&(H=" "+g(z)),M.length===0&&(!we||z.length==0))return Ne[0]+H+Ne[1];if(Y<0)return pe(z)?L.stylize(RegExp.prototype.toString.call(z),"regexp"):L.stylize("[Object]","special");L.seen.push(z);var Ue;return we?Ue=m(L,z,Y,Q,M):Ue=M.map(function(se){return w(L,z,Y,Q,se,we)}),L.seen.pop(),v(Ue,H,Ne)}function h(L,z){if(W(z))return L.stylize("undefined","undefined");if(D(z)){var Y="'"+JSON.stringify(z).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return L.stylize(Y,"string")}if(I(z))return L.stylize(""+z,"number");if(T(z))return L.stylize(""+z,"boolean");if(R(z))return L.stylize("null","null")}function g(L){return"["+Error.prototype.toString.call(L)+"]"}function m(L,z,Y,q,P){for(var M=[],Q=0,ie=z.length;Q<ie;++Q)U(z,String(Q))?M.push(w(L,z,Y,q,String(Q),!0)):M.push("");return P.forEach(function(H){H.match(/^\d+$/)||M.push(w(L,z,Y,q,H,!0))}),M}function w(L,z,Y,q,P,M){var Q,ie,H;if(H=Object.getOwnPropertyDescriptor(z,P)||{value:z[P]},H.get?H.set?ie=L.stylize("[Getter/Setter]","special"):ie=L.stylize("[Getter]","special"):H.set&&(ie=L.stylize("[Setter]","special")),U(q,P)||(Q="["+P+"]"),ie||(L.seen.indexOf(H.value)<0?(R(Y)?ie=p(L,H.value,null):ie=p(L,H.value,Y-1),ie.indexOf(`
@@ -364,4 +364,4 @@ ${JSON.stringify(c)}`;const h=await this.PersonalSign({message:p,addEthereumPref
364
364
  top=${g},
365
365
  left=${h}
366
366
  `);return m&&window.focus&&m.focus(),m};Jh.ActionPopup=async({mode:n="tab",url:e,onMessage:t,onCancel:r})=>{await new Promise(i=>{const o=n==="popup"?ube({url:e,title:"Eluvio Media Wallet",w:500,h:850}):window.open(e),u=setInterval(async()=>{o.closed&&(clearInterval(u),r&&await r(),i())},1e3);window.addEventListener("message",async c=>{await t(c,()=>{clearInterval(u),o.close(),i()})})})};var tn={},DI;function lbe(){if(DI)return tn;DI=1;const n=Rs,e=Ro,{FormatNFTDetails:t,FormatNFTMetadata:r,FormatNFT:i}=Jh,o=gB();return tn.UserInfo=function(){if(this.loggedIn)return{name:this.__authorization.email||this.UserAddress(),address:this.UserAddress(),email:this.__authorization.email,walletType:this.__authorization.walletType,walletName:this.__authorization.walletName}},tn.UserAddress=function(){if(this.loggedIn)return this.client.utils.DecodeSignedToken(this.AuthToken()).payload.adr},tn.UserWalletBalance=async function(u=!1){if(!this.loggedIn)return;const{balance:c,usage_hold:p,payout_hold:h,locked_offer_balance:g,stripe_id:m,stripe_payouts_enabled:w}=await this.client.utils.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","bal"),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}})),v=m,C=w,T=parseFloat(c||0),R=parseFloat(g||0),O=Math.max(0,T-parseFloat(p||0)-R),I=Math.max(0,T-O),D=Math.max(0,T-parseFloat(Math.max(h,R)||0));if(u&&m&&!w){const W=new URL(e(window.location.origin,window.location.pathname)).toString();return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","onb","stripe"),method:"POST",body:{country:"US",mode:this.mode,refresh_url:W.toString(),return_url:W.toString()},headers:{Authorization:`Bearer ${this.AuthToken()}`}}),await this.UserWalletBalance(!1)}let K={totalWalletBalance:T,availableWalletBalance:O,lockedWalletBalance:R,pendingWalletBalance:I,withdrawableWalletBalance:D};return C&&(K.userStripeId=v,K.userStripeEnabled=C),K},tn.UserItemNames=async function({marketplaceParams:u,userAddress:c}={}){let p=[];return u&&p.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams:u})).tenantId}`),c&&p.push(`wlt:eq:${n.FormatAddress(c)}`),await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","names"),method:"GET",queryParams:{filter:p}}))},tn.UserItemEditionNames=async function({displayName:u}){return await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","editions"),method:"GET",queryParams:{filter:`meta/display_name:eq:${u}`}}))},tn.UserItemAttributes=async function({marketplaceParams:u,displayName:c,userAddress:p}={}){let h=[];return u&&h.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams:u})).tenantId}`),p&&h.push(`wlt:eq:${n.FormatAddress(p)}`),c&&h.push(`meta/display_name:eq:${c}`),(await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","attributes"),method:"GET",queryParams:{filter:h}}))).map(({trait_type:m,values:w})=>({name:m,values:w})).filter(({name:m})=>!["Content Fabric Hash","Total Minted Supply","Creator"].includes(m))},tn.UserItems=async function({sortBy:u="default",includeFullMetadata:c=!1}={}){return c&&this.loggedIn?this.FilteredQuery({mode:"owned-full-meta",sortBy:u,...arguments[0]||{}}):this.FilteredQuery({mode:"owned",sortBy:u,...arguments[0]||{}})},tn.UserListings=async function({userAddress:u,sortBy:c="created",sortDesc:p=!1,contractAddress:h,tokenId:g,marketplaceParams:m}={}){return(await this.FilteredQuery({mode:"listings",start:0,limit:1e4,sortBy:c,sortDesc:p,sellerAddress:u||this.UserAddress(),marketplaceParams:m,contractAddress:h,tokenId:g,includeCheckoutLocked:!0})).results},tn.UserSales=async function({userAddress:u,sortBy:c="created",sortDesc:p=!1,contractAddress:h,tokenId:g,startTime:m,endTime:w,lastNDays:v,marketplaceParams:C}={}){return(await this.FilteredQuery({mode:"sales",start:0,limit:1e4,sortBy:c,sortDesc:p,sellerAddress:u||this.UserAddress(),startTime:m,endTime:w,lastNDays:v,marketplaceParams:C,contractAddress:h,tokenId:g})).results},tn.UserTransfers=async function({userAddress:u,sortBy:c="created",sortDesc:p=!1,contractAddress:h,tokenId:g,startTime:m,endTime:w,lastNDays:v,marketplaceParams:C}={}){return(await this.FilteredQuery({mode:"transfers",start:0,limit:1e4,sortBy:c,sortDesc:p,sellerAddress:u||this.UserAddress(),marketplaceParams:C,contractAddress:h,tokenId:g,startTime:m,endTime:w,lastNDays:v})).results},tn.TenantConfiguration=async function({tenantId:u,contractAddress:c}){try{return c=c?n.FormatAddress(c):void 0,this.tenantConfigs[c||u]||(this.tenantConfigs[c||u]=await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:c?e("as","config","nft",c):e("as","config","tnt",u),method:"GET"}))),this.tenantConfigs[c||u]}catch(p){return this.Log("Failed to load tenant configuration",!0,p),{}}},tn.ExchangeRate=async function({currency:u}){if(!u)throw Error("Eluvio Wallet Client: Invalid or missing currency in ExchangeRate");return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","xr","ebanx",u),method:"GET"}))},tn.TenantCSS=async function({tenantSlug:u}){return this.cachedCSS[u]||(this.cachedCSS[u]=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:e("/public","asset_metadata","tenants",u,"info","branding","wallet_css"),authorizationToken:this.publicStaticToken})),this.cachedCSS[u]||""},tn.MarketplaceStock=async function({marketplaceParams:u,tenantId:c}){return c||(c=this.MarketplaceInfo({marketplaceParams:u}).tenantId),this.loggedIn?await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","nft","info",c),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}})):await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","nft","stock",c),method:"GET"}))},tn.MarketplaceInfo=function({marketplaceParams:u}){let{tenantSlug:c,marketplaceSlug:p,marketplaceId:h,marketplaceHash:g}=u||{},m;if(c&&p?m=(this.availableMarketplaces[c]||{})[p]:(h=g?this.client.utils.DecodeVersionHash(g).objectId:h,m=this.availableMarketplacesById[h]),!m)throw Error(`Eluvio Wallet Client: Unable to find marketplace with parameters ${JSON.stringify(arguments)}`);return m},tn.MarketplaceCSS=async function({marketplaceParams:u}){const p=this.MarketplaceInfo({marketplaceParams:u}).marketplaceHash;return this.cachedCSS[p]||(this.cachedCSS[p]=await this.client.ContentObjectMetadata({versionHash:p,metadataSubtree:"public/asset_metadata/info/branding/custom_css",authorizationToken:this.publicStaticToken,noAuth:!0})),this.cachedCSS[p]||""},tn.AvailableMarketplaces=async function({organizeById:u,forceReload:c=!1}={}){return c&&await this.LoadAvailableMarketplaces(!0),{...u?this.availableMarketplacesById:this.availableMarketplaces}},tn.Marketplace=async function({marketplaceParams:u}){return this.LoadMarketplace(u)},tn.NFTContractStats=async function({contractAddress:u}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","nft","info",u),method:"GET"}))},tn.NFT=async function({tokenId:u,contractAddress:c}){let p=t(await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","nft","info",c,u),method:"GET"})));const h=await this.client.ContentObjectMetadata({versionHash:p.details.VersionHash,metadataSubtree:"public/asset_metadata/nft",produceLinkUrls:!0})||{};if(p.metadata=o({},h,p.metadata,(g,m)=>m===null||m===""?g:void 0),this.localization){const g=await this.client.ContentObjectMetadata({versionHash:p.details.VersionHash,metadataSubtree:e("public","asset_metadata","localizations",this.localization,"nft"),produceLinkUrls:!0})||{};p.metadata=o({},p.metadata,g,(m,w)=>w===null||w===""?m:void 0)}return p.config=await this.TenantConfiguration({contractAddress:c}),r(this,p)},tn.TransferNFT=async function({contractAddress:u,tokenId:c,targetAddress:p}){if(!p||!n.ValidAddress(p))throw Error("Eluvio Wallet Client: Invalid or missing target address in UserTransferNFT");return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","xfer"),method:"POST",body:{contract:n.FormatAddress(u),token:c,to_addr:n.FormatAddress(p)},headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.ListingStatus=async function({listingId:u}){try{return await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","status",u),method:"GET"}))}catch(c){if(c.status===404)return;throw c}},tn.Listing=async function({listingId:u}){return i(this,await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","l",u),method:"GET"})))},tn.Listings=async function(){return this.FilteredQuery({mode:"listings",...arguments[0]||{}})},tn.ListingStats=async function(){return this.FilteredQuery({mode:"listing-stats",...arguments[0]||{}})},tn.Sales=async function(){return this.FilteredQuery({mode:"sales",...arguments[0]||{}})},tn.Transfers=async function(){return this.FilteredQuery({mode:"transfers",...arguments[0]||{}})},tn.SalesStats=async function(){return this.FilteredQuery({mode:"sales-stats",...arguments[0]||{}})},tn.Leaderboard=async function({userAddress:u,marketplaceParams:c}){if(u){let p={addr:n.FormatAddress(u)};return c&&(p.filter=[`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams:c})).tenantId}`]),(await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","ranks"),method:"GET",queryParams:p}))||[])[0]}return this.FilteredQuery({mode:"leaderboard",...arguments[0]||{}})},tn.CreateListing=async function({contractAddress:u,tokenId:c,price:p,listingId:h}){return u=n.FormatAddress(u),h?await n.ResponseToFormat("text",await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt"),method:"PUT",body:{id:h,price:parseFloat(p)},headers:{Authorization:`Bearer ${this.AuthToken()}`}})):await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt"),method:"POST",body:{contract:u,token:c,price:parseFloat(p)},headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.RemoveListing=async function({listingId:u}){await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt",u),method:"DELETE",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.SalesNames=async function({marketplaceParams:u}){let c;return u&&(c=(await this.MarketplaceInfo({marketplaceParams:u})).tenantId),await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","names","hst"),method:"GET",queryParams:c?{filter:`tenant:eq:${c}`}:{}}))},tn.ListingNames=async function({marketplaceParams:u}){let c;return u&&(c=(await this.MarketplaceInfo({marketplaceParams:u})).tenantId),await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","names"),method:"GET",queryParams:c?{filter:`tenant:eq:${c}`}:{}}))},tn.ListingEditionNames=async function({displayName:u}){return await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","editions"),queryParams:{filter:`nft/display_name:eq:${u}`},method:"GET"}))},tn.ListingAttributes=async function({marketplaceParams:u,displayName:c}={}){let p=[];return u&&p.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams:u})).tenantId}`),c&&p.push(`nft/display_name:eq:${c}`),(await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","attributes"),method:"GET",queryParams:{filter:p}}))).map(({trait_type:g,values:m})=>({name:g,values:m})).filter(({name:g})=>!["Content Fabric Hash","Total Minted Supply","Creator"].includes(g))},tn.ClaimGift=async function({code:u}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({method:"POST",path:e("as","wlt","gifts","claim"),body:{otp_code:u},headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.ClaimItem=async function({marketplaceParams:u,sku:c,email:p}){const h=await this.MarketplaceInfo({marketplaceParams:u});await this.client.authClient.MakeAuthServiceRequest({method:"POST",path:e("as","wlt","act",h.tenant_id),body:{op:"nft-claim",sid:h.marketplaceId,sku:c,email:p},headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.PurchaseItem=async function({marketplaceParams:u,sku:c,confirmationId:p,successUrl:h,cancelUrl:g}){const m=await this.MarketplaceInfo({marketplaceParams:u});window.location.href=this.FlowURL({type:"action",flow:"purchase",marketplaceId:m.marketplaceId,parameters:{sku:c,confirmationId:p,successUrl:h,cancelUrl:g,login:!0,auth:this.ClientAuthToken()}})},tn.PurchaseListing=async function({marketplaceParams:u,listingId:c,confirmationId:p,successUrl:h,cancelUrl:g}){let m;u&&(m=await this.MarketplaceInfo({marketplaceParams:u})),window.location.href=this.FlowURL({type:"action",flow:"purchase",marketplaceId:m&&m.marketplaceId,parameters:{listingId:c,confirmationId:p,successUrl:h,cancelUrl:g,login:!0,auth:this.ClientAuthToken()}})},tn.ListingPurchaseStatus=async function({listingId:u,confirmationId:c}){try{const p=await this.ListingStatus({listingId:u});if(!p)throw Error("Unable to find info for listing "+u);return(await this.MintingStatus({tenantId:p.tenant})).find(g=>g.op==="nft-transfer"&&g.extra&&g.extra[0]===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.PurchaseStatus=async function({marketplaceParams:u,confirmationId:c}){try{const p=await this.MarketplaceInfo({marketplaceParams:u});return(await this.MintingStatus({tenantId:p.tenant_id})).find(g=>g.op==="nft-buy"&&g.confirmationId===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.ClaimStatus=async function({marketplaceParams:u,sku:c}){try{const p=await this.MarketplaceInfo({marketplaceParams:u});return(await this.MintingStatus({tenantId:p.tenantId})).find(g=>g.op==="nft-claim"&&g.marketplaceId===p.marketplaceId&&g.confirmationId===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.GiftClaimStatus=async function({marketplaceParams:u,confirmationId:c,giftId:p}){try{const h=await this.MarketplaceInfo({marketplaceParams:u}),m=(await this.MintingStatus({tenantId:h.tenantId})).filter(w=>w.op==="nft-transfer"&&(c&&w.confirmationId===c||p&&w.giftId===p))||{status:"none"};return m.length===0?{status:"none"}:m.find(w=>w.status==="failed")?{status:"failed",op:"nft-transfer",transfer_statuses:m}:m.find(w=>w.status!=="complete")?{status:"pending",op:"nft-transfer",transfer_statuses:m}:{status:"complete",op:"nft-transfer",transfer_statuses:m,items:m.map(w=>({token_addr:w.address,token_id_str:w.tokenId}))}}catch(h){return this.Log(h,!0),{status:"unknown"}}},tn.PackOpenStatus=async function({contractAddress:u,tokenId:c}){try{const p=await this.TenantConfiguration({contractAddress:u});return(await this.MintingStatus({tenantId:p.tenant})).find(g=>g.op==="nft-open"&&n.EqualAddress(u,g.address)&&g.tokenId===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.CollectionRedemptionStatus=async function({marketplaceParams:u,confirmationId:c}){try{return(await this.MintingStatus({marketplaceParams:u})).find(h=>h.op==="nft-redeem"&&h.confirmationId===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.RedeemableOfferStatus=async function({tenantId:u,marketplaceParams:c,contractAddress:p,tokenId:h,offerId:g}){try{const m=await this.MintingStatus({marketplaceParams:c,tenantId:u});return p=n.FormatAddress(p),m.find(w=>w.op==="nft-offer-redeem"&&n.EqualAddress(w.address,p)&&w.tokenId===(h||"").toString()&&w.offerId===(g||"").toString())||{status:"none"}}catch(m){return this.Log(m,!0),{status:"unknown"}}},tn.RedeemableCustomFulfillmentInfo=async function({redeemableTransactionId:u}){return await n.ResponseToJson(this.stateStoreClient.Request({method:"GET",path:e("code-fulfillment",this.network==="main"?"main":"demov3","fulfill",u),headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.LoadDrop=async function({tenantSlug:u,eventSlug:c,dropId:p}){if(this.drops||(this.drops={}),this.drops[u]||(this.drops[u]={}),this.drops[u][c]||(this.drops[u][c]={}),!this.drops[u][c][p]){const h=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:e("public","asset_metadata","tenants",u,"sites",c,"info"),resolveLinks:!0,linkDepthLimit:2,resolveIncludeSource:!0,produceLinkUrls:!0,select:[".","drops"],noAuth:!0})||[],g=n.DecodeVersionHash(h["."].source).objectId;h.drops.forEach(m=>{m={...m,eventId:g},this.drops[u][c][m.uuid]=m,this.drops[m.uuid]=m})}return this.drops[p]},tn.SubmitDropVote=async function({marketplaceParams:u,eventId:c,dropId:p,sku:h}){const g=await this.MarketplaceInfo({marketplaceParams:u});await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","act",g.tenant_id),method:"POST",body:{op:"vote-drop",evt:c,id:p,itm:h},headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.DropStatus=async function({marketplace:u,eventId:c,dropId:p}){try{return(await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","act",u.tenant_id,c,p),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))).sort((g,m)=>g.ts>m.ts?1:-1)[0]||{status:"none"}}catch(h){return this.Log(h,!0),""}},tn.MarketplaceOffers=async function({contractAddress:u,tokenId:c,buyerAddress:p,sellerAddress:h,statuses:g,start:m=0,limit:w=10}){let v=e("as","mkt","offers","ls");p?v=e(v,"b",n.FormatAddress(p)):h&&(v=e(v,"s",n.FormatAddress(h))),u&&(v=e(v,"c",n.FormatAddress(u)),c&&(v=e(v,"t",c)));let C={start:m,limit:w};return g&&g.length>0&&(C.include=g.join(",")),(await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:v,method:"GET",queryParams:C}))).map(R=>({...R,created:R.created*1e3,updated:R.updated*1e3,expiration:R.expiration*1e3}))},tn.CreateMarketplaceOffer=async function({contractAddress:u,tokenId:c,offerId:p,price:h,expiresAt:g}){let m;return p?m=await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers",p),method:"PUT",body:{price:h,expiration:Math.floor(g/1e3)},headers:{Authorization:`Bearer ${this.AuthToken()}`}})):m=await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers",u,c),method:"POST",body:{contract:u,token:c,price:h,expiration:Math.floor(g/1e3)},headers:{Authorization:`Bearer ${this.AuthToken()}`}})),m.offer_id},tn.RemoveMarketplaceOffer=async function({offerId:u}){return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers",u),method:"DELETE",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.AcceptMarketplaceOffer=async function({offerId:u}){return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers","accept",u),method:"PUT",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.RejectMarketplaceOffer=async function({offerId:u}){return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers","decline",u),method:"PUT",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.VoteStatus=async function({tenantId:u,votingEventId:c}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","votes",u,c),headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.CastVote=async function({tenantId:u,votingEventId:c,sku:p}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","votes",u,c,p),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.RevokeVote=async function({tenantId:u,votingEventId:c,sku:p}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","votes",u,c,p),method:"DELETE",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn}var dh={},UI;function cbe(){if(UI)return dh;UI=1;const n=Rs,e=Ro,t=({network:i,path:o})=>e(i==="main"?"/main":"/dv3",o),r=({network:i,appId:o,userAddress:u,key:c,type:p,mode:h})=>t({network:i,path:e(p==="app"?"app":"usr",p==="app"?o:"",u,h==="public"?"pub":"pri",c||"")});return dh.ProfileMetadata=async function({type:i="app",mode:o="public",appId:u,userAddress:c,key:p}){try{const h=await this.stateStoreClient.Request({path:r({network:this.network,appId:u||this.appId,userAddress:c||this.UserAddress(),type:i,mode:o,key:p}),headers:o==="private"?{Authorization:`Bearer ${this.AuthToken()}`}:void 0});if(!h.ok)throw h;return(await n.ResponseToJson(h))[p]}catch(h){if(h.status===404)return;throw h}},dh.SetProfileMetadata=async function({type:i="app",mode:o="public",appId:u,key:c,value:p}){await this.stateStoreClient.Request({method:"POST",path:r({network:this.network,appId:u||this.appId,userAddress:this.UserAddress(),type:i,mode:o,key:c}),body:p,bodyType:typeof p=="object"?"JSON":"string",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},dh.RemoveProfileMetadata=async function({type:i="app",mode:o="public",appId:u,key:c}){await this.stateStoreClient.Request({method:"DELETE",path:r({network:this.network,appId:u||this.appId,userAddress:this.UserAddress(),type:i,mode:o,key:c}),headers:{Authorization:`Bearer ${this.AuthToken()}`}})},dh.Profile=async function({userAddress:i,userName:o}){if(o&&(i=await this.UserNameToAddress({userName:o})),!i)throw Error("Eluvio Wallet Client: Unable to determine profile - user address not specified");o||(o=await this.ProfileMetadata({type:"user",userAddress:i,key:"username"}));const u=await this.ProfileMetadata({type:"user",userAddress:i,key:"icon_url"});let c=await this.ProfileMetadata({type:"app",mode:"public",appId:"elv-badge-srv",userAddress:this.badgerAddress,key:`badges_${n.FormatAddress(i)}`}),p=[];if(c)try{c=JSON.parse(c).badges,p=Object.keys(c).map(h=>({...c[h],name:h}))}catch(h){this.Log(`Failed to load badge info for ${o||i}`,!0),this.Log(h,!0)}return{userAddress:n.FormatAddress(i),userName:o,imageUrl:u,badges:p}},dh.UserNameToAddress=async function({userName:i}){try{const o=await this.stateStoreClient.Request({method:"GET",path:t({network:this.network,path:e("usr","profile_for_username",i)})});if(!o.ok)throw o;return(await n.ResponseToJson(o)).address}catch(o){if(o.status!==404)throw o}},dh}var yv={},FI;function fbe(){if(FI)return yv;FI=1;const n=Rs,e=Ro,t=({network:r,path:i})=>e("/push",r==="main"?"/main":"/dv3",i);return yv.PushNotification=async function({tenantId:r,eventType:i,data:o,userAddress:u}){await this.stateStoreClient.Request({method:"POST",path:t({network:this.network,path:e("notify_user",u||this.UserAddress(),r,i)}),body:o,headers:{Authorization:`Bearer ${this.AuthToken()}`}})},yv.AddNotificationListener=async function({onMessage:r}){if(!r)throw Error("Eluvio Wallet Client: No onMessage callback provided to AddNotificationListener");const i=new URL(this.stateStoreClient.BaseURI().toString());i.pathname=t({network:this.network,path:e("register",this.UserAddress(),this.AuthToken())});const o=new EventSource(i);return o.onmessage=u=>{let c=JSON.parse(u.data);try{c.data=JSON.parse(c.data)}catch{}r(c)},o},yv.Notifications=async function({tenantId:r,types:i,offsetId:o,limit:u=10}={}){let c={limit:u};r&&(c.tenant_id=r),i&&(c.types=Array.isArray(i)?i.join(","):i),o&&(c.offset_by=o);const{records:p}=await n.ResponseToJson(this.stateStoreClient.Request({method:"GET",path:t({network:this.network,path:e("history",this.UserAddress())}),queryParams:c,headers:{Authorization:`Bearer ${this.AuthToken()}`}}));return p.map(h=>{try{h.data=JSON.parse(h.data)}catch{}return h})},yv}const{ElvClient:dbe}=N4,Dd=sbe,{LinkTargetHash:M5,FormatNFT:pbe,ActionPopup:BI}=Jh,hbe=$h,ma=Ro,Ta=Rs,ybe=pc,Tv=typeof window<"u",mbe=Tv&&window.top!==window.self;let p2=!1;try{typeof localStorage<"u"&&localStorage.getItem("test"),p2=!0}catch{}class Wd{constructor({appId:e,client:t,network:r,mode:i,localization:o,marketplaceInfo:u,previewMarketplaceHash:c,storeAuthToken:p}){this.appId=e,this.client=t,this.loggedIn=!1,this.localization=o,this.network=r,this.mode=i,this.purchaseMode=Dd[r][i].purchaseMode,this.mainSiteLibraryId=Dd[r][i].siteLibraryId,this.mainSiteId=Dd[r][i].siteId,this.appUrl=Dd[r][i].appUrl,this.publicStaticToken=t.staticToken,this.storeAuthToken=p,this.selectedMarketplaceInfo=u,this.previewMarketplaceId=c?Ta.DecodeVersionHash(c).objectId:void 0,this.previewMarketplaceHash=c,this.availableMarketplaces={},this.availableMarketplacesById={},this.marketplaceHashes={},this.tenantConfigs={},this.stateStoreUrls=Dd[r].stateStoreUrls,this.stateStoreClient=new hbe({uris:this.stateStoreUrls}),this.badgerAddress=Dd[r].badgerAddress,this.cachedMarketplaces={},this.cachedCSS={},this.utils=t.utils,this.ForbiddenMethods=Wd.ForbiddenMethods}Log(e,t=!1,r){t?console.error("Eluvio Wallet Client:",e):console.log("Eluvio Wallet Client:",e),r&&console.error(r)}static ForbiddenMethods(){return["constructor","Authenticate","AuthenticateOAuth","AuthenticateExternalWallet","AuthToken","ClientAuthToken","Initialize","Log","LogIn","LogOut","PersonalSign","SetAuthorization","SignMetamask"]}static AllowedMethods(){return Object.getOwnPropertyNames(Wd.prototype).filter(e=>!Wd.ForbiddenMethods().includes(e)).sort()}static async Initialize({client:e,appId:t="general",network:r="main",mode:i="production",localization:o,marketplaceParams:u,previewMarketplaceId:c,storeAuthToken:p=!0,skipMarketplaceLoad:h=!1}){let{tenantSlug:g,marketplaceSlug:m,marketplaceId:w,marketplaceHash:v}=u||{};if(Dd[r]){if(!Dd[r][i])throw Error(`ElvWalletClient: Invalid mode ${i}`)}else throw Error(`ElvWalletClient: Invalid network ${r}`);e||(e=await dbe.FromNetworkName({networkName:r,assumeV3:!0}));let C=c;C&&!C.startsWith("hq__")&&(C=await e.LatestVersionHash({objectId:c}));const T=new Wd({appId:t,client:e,network:r,mode:i,localization:o,marketplaceInfo:{tenantSlug:g,marketplaceSlug:m,marketplaceId:v?e.utils.DecodeVersionHash(v).objectId:w,marketplaceHash:v},previewMarketplaceHash:C,storeAuthToken:p});if(Tv&&window.location&&window.location.href){let R=new URL(window.location.href);if(R.searchParams.get("elvToken"))await T.Authenticate({token:R.searchParams.get("elvToken")}),R.searchParams.delete("elvToken"),window.history.replaceState("","",R);else if(p&&p2)try{let O=localStorage.getItem(`__elv-token-${r}`);O&&await T.Authenticate({token:O})}catch{}}return h||await T.LoadAvailableMarketplaces(),T}CanSign(){return this.loggedIn?!!this.__authorization.clusterToken||Tv&&!!(this.UserInfo().walletName.toLowerCase()==="metamask"&&window.ethereum&&window.ethereum.isMetaMask&&window.ethereum.chainId):!1}async PersonalSign({message:e}){if(!this.loggedIn)throw Error("ElvWalletClient: Unable to perform signature - Not logged in");if(this.CanSign()){if(this.__authorization.clusterToken)return e=typeof e=="object"?JSON.stringify(e):e,e=ybe.utils.keccak256(Buffer.from(`Ethereum Signed Message:
367
- ${e.length}${e}`,"utf-8")),await this.client.authClient.Sign(e);if(this.UserInfo().walletName.toLowerCase()==="metamask")return this.SignMetamask({message:e,address:this.UserAddress()});throw Error("ElvWalletClient: Unable to sign")}else if(!Tv)throw Error("ElvWalletClient: Unable to sign");const t={action:"personal-sign",message:e,logIn:!0};let r=new URL(this.appUrl);if(r.hash=ma("/action","sign",Ta.B58(JSON.stringify(t))),r.searchParams.set("origin",window.location.origin),!mbe&&window.location.origin===r.origin)throw Error("ElvWalletClient: Unable to sign");return await new Promise(async(i,o)=>{await BI({mode:"tab",url:r.toString(),onCancel:()=>o("User cancelled sign"),onMessage:async(u,c)=>{if(!(!u||!u.data||u.data.type!=="FlowResponse"))try{i(u.data.response)}catch(p){o(p)}finally{c()}}})})}async LogInURL({mode:e="login",provider:t,marketplaceParams:r,clearLogin:i}){let o=new URL(this.appUrl);return o.hash="/login",o.searchParams.set("action","login"),typeof window<"u"&&o.searchParams.set("origin",window.location.origin),t&&o.searchParams.set("provider",t),e&&o.searchParams.set("mode",e),r?o.searchParams.set("mid",(await this.MarketplaceInfo({marketplaceParams:r})).marketplaceHash):(this.selectedMarketplaceInfo||{}).marketplaceHash&&o.searchParams.set("mid",this.selectedMarketplaceInfo.marketplaceHash),i&&o.searchParams.set("clear",""),o}async LogIn({method:e="redirect",provider:t,mode:r="login",callbackUrl:i,marketplaceParams:o,clearLogin:u=!1,callback:c}){let p=await this.LogInURL({mode:r,provider:t,marketplaceParams:o,clearLogin:u});e==="redirect"?(p.searchParams.set("response","redirect"),p.searchParams.set("source","origin"),p.searchParams.set("redirect",i),window.location=p):(p.searchParams.set("response","message"),p.searchParams.set("source","parent"),await new Promise(async(h,g)=>{await BI({mode:"tab",url:p.toString(),onCancel:()=>g("User cancelled login"),onMessage:async(m,w)=>{if(!(!m||!m.data||m.data.type!=="LoginResponse"))try{c?await c(m.data.params):await this.Authenticate({token:m.data.params.clientSigningToken||m.data.params.clientAuthToken}),h()}catch(v){g(v)}finally{w()}}})}))}LogOut(){if(this.__authorization={},this.loggedIn=!1,this.cachedMarketplaces={},p2)try{localStorage.removeItem(`__elv-token-${this.network}`)}catch{}}async Authenticate({token:e}){let t;try{t=JSON.parse(this.utils.FromB58ToStr(e))||{}}catch{throw new Error("Invalid authorization token "+e)}if(!t.expiresAt||Date.now()>t.expiresAt)throw Error("ElvWalletClient: Provided authorization token has expired");return t.clusterToken&&await this.client.SetRemoteSigner({authToken:t.clusterToken,signerURIs:t.signerURIs}),this.client.SetStaticToken({token:t.fabricToken}),this.SetAuthorization({...t})}async AuthenticateOAuth({idToken:e,tenantId:t,email:r,signerURIs:i,shareEmail:o=!1}){let u=24;!t&&this.selectedMarketplaceInfo&&(await this.AvailableMarketplaces(),t=this.selectedMarketplaceInfo.tenantId),await this.client.SetRemoteSigner({idToken:e,tenantId:t,signerURIs:i,extraData:{share_email:o},unsignedPublicAuth:!0});const c=Date.now()+u*60*60*1e3,p=await this.client.CreateFabricToken({duration:u*60*60*1e3}),h=this.client.utils.FormatAddress(this.client.CurrentAccountAddress());if(!r)try{r=JSON.parse(this.utils.FromB64URL(e.split(".")[1])).email}catch{throw Error("Failed to decode ID token")}return this.client.SetStaticToken({token:p}),{authToken:this.SetAuthorization({fabricToken:p,tenantId:t,address:h,email:r,expiresAt:c,signerURIs:i,walletType:"Custodial",walletName:"Eluvio",register:!0}),signingToken:this.SetAuthorization({clusterToken:this.client.signer.authToken,fabricToken:p,tenantId:t,address:h,email:r,expiresAt:c,signerURIs:i,walletType:"Custodial",walletName:"Eluvio"})}}async AuthenticateExternalWallet({address:e,tokenDuration:t=24,walletName:r="Metamask",Sign:i}){e||(e=window.ethereum.selectedAddress),e=this.utils.FormatAddress(e),i||(i=async c=>this.SignMetamask({message:c,address:e}));const o=Date.now()+t*60*60*1e3,u=await this.client.CreateFabricToken({address:e,duration:t*60*60*1e3,Sign:i,addEthereumPrefix:!1});return this.SetAuthorization({fabricToken:u,address:e,expiresAt:o,walletType:"External",walletName:r,register:!0})}ClientAuthToken(){return this.loggedIn?this.utils.B58(JSON.stringify(this.__authorization)):""}AuthToken(){return this.loggedIn?this.__authorization.fabricToken:this.publicStaticToken}SetAuthorization({clusterToken:e,fabricToken:t,tenantId:r,address:i,email:o,expiresAt:u,signerURIs:c,walletType:p,walletName:h,register:g=!1}){i=this.client.utils.FormatAddress(i),this.__authorization={fabricToken:t,tenantId:r,address:i,email:o,expiresAt:u,walletType:p,walletName:h},e&&(this.__authorization.clusterToken=e,c&&(this.__authorization.signerURIs=c)),this.loggedIn=!0,this.cachedMarketplaces={};const m=this.ClientAuthToken();if(this.storeAuthToken&&p2)try{localStorage.setItem(`__elv-token-${this.network}`,m)}catch{}return g&&this.client.authClient.MakeAuthServiceRequest({path:"/as/wlt/register",method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`}}).catch(w=>{this.Log("Failed to register account: ",!0,w)}),m}async SignMetamask({message:e,address:t}){if(!Tv||!window.ethereum)throw Error("ElvWalletClient: Unable to initialize - Metamask not available");t=t||this.UserAddress();const r=await window.ethereum.request({method:"eth_requestAccounts"});if(t&&!Ta.EqualAddress(r[0],t))throw Error(`ElvWalletClient: Incorrect MetaMask account selected. Expected ${t}, got ${r[0]}`);return await window.ethereum.request({method:"personal_sign",params:[e,t,""]})}FlowURL({type:e="flow",flow:t,marketplaceId:r,parameters:i={}}){const o=new URL(this.appUrl);return r?o.pathname=ma("/",e,t,"marketplace",r,Ta.B58(JSON.stringify(i))):o.pathname=ma("/",e,t,Ta.B58(JSON.stringify(i))),o.searchParams.set("origin",window.location.origin),o.toString()}async GenerateCodeAuth({url:e}={}){e||(e=await this.LogInURL({mode:"login"}),e.searchParams.set("response","code"),e.searchParams.set("source","code"));const t=await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","login","redirect","metamask"),method:"POST",body:{op:"create",dest:e.toString()}}));return t.code=t.id,t.url=t.url.startsWith("https://")?t.url:`https://${t.url}`,t.metamask_url=t.metamask_url.startsWith("https://")?t.metamask_url:`https://${t.metamask_url}`,t}async SetCodeAuth({code:e,address:t,type:r,authToken:i}){await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","login","session",e),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`},body:{op:"set",id:e,format:"auth_token",payload:JSON.stringify({addr:Ta.FormatAddress(t),eth:t?`ikms${Ta.AddressToHash(t)}`:"",type:r,token:i})}}))}async GetCodeAuth({code:e,passcode:t}){try{return await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","login","redirect","metamask",e,t),method:"GET"}))}catch(r){if(r&&r.status===404)return;throw r}}async LoadAvailableMarketplaces(e=!1){if(!e&&Object.keys(this.availableMarketplaces)>0)return;let t=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:"public/asset_metadata",resolveLinks:!0,linkDepthLimit:2,resolveIncludeSource:!0,resolveIgnoreErrors:!0,produceLinkUrls:!0,authorizationToken:this.publicStaticToken,noAuth:!0,select:["info/marketplace_order","tenants/*/.","tenants/*/info/branding","tenants/*/marketplaces/*/.","tenants/*/marketplaces/*/info/tenant_id","tenants/*/marketplaces/*/info/tenant_name","tenants/*/marketplaces/*/info/branding","tenants/*/marketplaces/*/info/storefront/background","tenants/*/marketplaces/*/info/storefront/background_mobile"],remove:["tenants/*/info/branding/wallet_css","tenants/*/marketplaces/*/info/branding/custom_css"]});const r=((t||{}).info||{}).marketplace_order||[];if(t=(t||{}).tenants||{},this.previewMarketplaceId){let u="PREVIEW",c,p;Object.keys(t||{}).forEach(h=>Object.keys(t[h].marketplaces||{}).forEach(g=>{const m=t[h].marketplaces[g]["."].source;this.utils.DecodeVersionHash(m).objectId===this.previewMarketplaceId&&(u=h,c=g,m===this.previewMarketplaceHash&&(p=t[h].marketplaces[g]))})),p||(p=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"public/asset_metadata",produceLinkUrls:!0,authorizationToken:this.publicStaticToken,noAuth:!0,select:["slug","info/tenant_id","info/tenant_name","info/branding"],remove:["info/branding/custom_css"]}),c||(c=p.slug)),p["."]={source:this.previewMarketplaceHash},p.info["."]={source:this.previewMarketplaceHash},p.info.branding.preview=!0,p.info.branding.show=!0,t[u]=t[u]||{},t[u].marketplaces=t[u].marketplaces||{},t[u].marketplaces[c]=p}let i={...this.availableMarketplaces||{}},o={...this.availableMarketplacesById||{}};Object.keys(t||{}).forEach(u=>{try{i[u]=t[u]["."]?{versionHash:t[u]["."].source}:{},Object.keys(t[u].marketplaces||{}).forEach(c=>{try{const p=t[u].marketplaces[c]["."].source,h=this.utils.DecodeVersionHash(p).objectId;i[u][c]={...t[u].marketplaces[c].info||{},tenantName:t[u].marketplaces[c].info.tenant_name,tenantId:t[u].marketplaces[c].info.tenant_id,tenantSlug:u,marketplaceSlug:c,marketplaceId:h,marketplaceHash:p,tenantBranding:(t[u].info||{}).branding||{},order:r.findIndex(g=>g===c)},o[h]=i[u][c],this.marketplaceHashes[h]=p,this.selectedMarketplaceInfo&&(this.selectedMarketplaceInfo.tenantSlug===u&&this.selectedMarketplaceInfo.marketplaceSlug===c||this.selectedMarketplaceInfo.marketplaceId===h)&&(this.selectedMarketplaceInfo=i[u][c])}catch{this.Log(`Eluvio Wallet Client: Unable to load info for marketplace ${u}/${c}`,!0)}})}catch(c){this.Log(`Eluvio Wallet Client: Failed to load tenant info ${u}`,!0,c)}}),this.availableMarketplaces=i,this.availableMarketplacesById=o}async LatestMarketplaceHash({marketplaceParams:e}){const t=await this.MarketplaceInfo({marketplaceParams:e});if(this.previewMarketplaceId&&Ta.EqualHash(this.previewMarketplaceId,t.marketplaceId))return this.previewMarketplaceHash;const r=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug),resolveLinks:!1,noAuth:!0});return M5(r)}async LoadMarketplace(e){const t=this.MarketplaceInfo({marketplaceParams:e}),r=t.marketplaceId,i=await this.LatestMarketplaceHash({marketplaceParams:e});if(this.cachedMarketplaces[r]&&this.cachedMarketplaces[r].versionHash!==i&&delete this.cachedMarketplaces[r],!this.cachedMarketplaces[r]){let o;this.previewMarketplaceId&&Ta.EqualHash(r,this.previewMarketplaceId)?o=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"/public/asset_metadata/info",localizationSubtree:this.localization?ma("public","asset_metadata","localizations",this.localization,"info"):void 0,linkDepthLimit:1,resolveLinks:!0,resolveIgnoreErrors:!0,resolveIncludeSource:!0,produceLinkUrls:!0,authorizationToken:this.publicStaticToken}):o=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"info"),localizationSubtree:this.localization?ma("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"localizations",this.localization,"info"):void 0,linkDepthLimit:1,resolveLinks:!0,resolveIgnoreErrors:!0,resolveIncludeSource:!0,produceLinkUrls:!0,authorizationToken:this.publicStaticToken}),o.branding.use_tenant_styling&&(o.tenantBranding=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("/public","asset_metadata","tenants",t.tenantSlug,"info","branding"),authorizationToken:this.publicStaticToken,produceLinkUrls:!0})||{}),o.items=await Promise.all(o.items.map(async(u,c)=>{if(u.requires_permissions){let p;this.loggedIn||(p=await this.client.CreateFabricToken({}));try{await this.client.ContentObjectMetadata({versionHash:M5(u.nft_template),metadataSubtree:"permissioned",authorizationToken:p}),u.authorized=!0}catch{u.authorized=!1}}return u.nftTemplateMetadata=(u.nft_template||{}).nft||{},u.nftTemplateHash=((u.nft_template||{})["."]||{}).source,u.itemIndex=c,u})),o.collections=(o.collections||[]).map((u,c)=>({...u,collectionIndex:c})),o.retrievedAt=Date.now(),o.marketplaceId=r,o.versionHash=i,o.marketplaceHash=i,this.previewMarketplaceId&&r===this.previewMarketplaceId&&(o.branding.preview=!0),["purchase_animation","purchase_animation_mobile","reveal_animation","reveal_animation_mobile"].forEach(u=>{try{if(o.storefront[u]){let c=new URL("https://embed.v3.contentfabric.io");const p=M5(o.storefront[u]);c.searchParams.set("p",""),c.searchParams.set("net",this.network==="main"?"main":"demo"),c.searchParams.set("ath",(this.__authorization||{}).authToken||this.publicStaticToken),c.searchParams.set("vid",p),c.searchParams.set("ap",""),u.startsWith("reveal")||(c.searchParams.set("m",""),c.searchParams.set("lp","")),o.storefront[`${u}_embed_url`]=c.toString()}}catch{}}),this.cachedMarketplaces[r]=o}return this.cachedMarketplaces[r]}async FilteredQuery({mode:e="listings",sortBy:t="created",sortDesc:r=!1,filter:i,editionFilters:o,attributeFilters:u,contractAddress:c,tokenId:p,currency:h,marketplaceParams:g,tenantId:m,collectionIndexes:w,priceRange:v,tokenIdRange:C,capLimit:T,userAddress:R,sellerAddress:O,lastNDays:I=-1,startTime:D,endTime:K,includeCheckoutLocked:W=!1,start:pe=0,limit:ce=50}={}){w=(w||[]).map(ae=>parseInt(ae));let ge={start:pe,limit:ce,sort_descending:r};e==="owned"&&t==="created"&&(t="default"),e!=="leaderboard"&&(ge.sort_by=t),e.includes("listings")&&W&&(ge.checkout=!0);let Se,_e;g&&(Se=await this.MarketplaceInfo({marketplaceParams:g}),w.length>0&&(_e=await this.Marketplace({marketplaceParams:g})));try{let ae=[];O?ae.push(`seller:eq:${this.client.utils.FormatAddress(O)}`):R&&e!=="owned"&&ae.push(`addr:eq:${this.client.utils.FormatAddress(R)}`),_e&&w.length>=0?w.forEach(L=>{_e.collections[L].items.forEach(Y=>{if(!Y)return;const q=_e.items.find(M=>M.sku===Y);if(!q)return;const P=Ta.SafeTraverse(q,"nft_template","nft","address");P&&ae.push(`${e==="owned"?"contract_addr":"contract"}:eq:${Ta.FormatAddress(P)}`)})}):(Se||m)&&ae.push(`tenant:eq:${Se?Se.tenantId:m}`),c?(e==="owned"?ae.push(`contract_addr:eq:${Ta.FormatAddress(c)}`):ae.push(`contract:eq:${Ta.FormatAddress(c)}`),p&&ae.push(`token:eq:${p}`)):i&&(e.includes("listing")?ae.push(`nft/display_name:eq:${i}`):e==="owned"?ae.push(`meta/display_name:eq:${i}`):ae.push(`name:eq:${i}`)),o&&o.forEach(L=>{e.includes("listing")?ae.push(`nft/edition_name:eq:${L}`):e==="owned"?(ae.push(`meta:@>:{"edition_name":"${L}"}`),ge.exact=!1):ae.push(`edition:eq:${L}`)}),u&&u.map(({name:L,value:z})=>{!L||!z||ae.push(`nft/attributes/${L}:eq:${z}`)}),h&&ae.push("link_type:eq:sol"),D||K?(D&&ae.push(`created:gt:${parseInt(D)/1e3}`),K&&ae.push(`created:lt:${parseInt(K)/1e3}`)):I&&I>0&&ae.push(`created:gt:${(Date.now()/1e3-I*24*60*60).toFixed(0)}`),v&&(v.min&&ae.push(`price:ge:${parseFloat(v.min)}`),v.max&&ae.push(`price:le:${parseFloat(v.max)}`)),C&&(C.min&&ae.push(`info/token_id:ge:${parseInt(C.min)}`),C.max&&ae.push(`info/token_id:le:${parseInt(C.max)}`)),T&&ae.push(`info/cap:le:${parseInt(T)}`);let Te,S;switch(e){case"owned":S=ma("as","wlt",R||this.UserAddress());break;case"owned-full-meta":S=ma("as","apigw","nfts"),Te={Authorization:`Bearer ${this.AuthToken()}`};break;case"listings":S=ma("as","mkt","f");break;case"transfers":S=ma("as","mkt","hst","f"),ae.push("action:eq:TRANSFERRED"),ae.push("action:eq:SOLD");break;case"sales":S=ma("as","mkt","hst","f"),ae.push("action:eq:SOLD"),ae.push("seller:co:0x");break;case"listing-stats":S=ma("as","mkt","stats","listed");break;case"sales-stats":S=ma("as","mkt","stats","sold"),ae.push("seller:co:0x");break;case"leaderboard":S=ma("as","wlt","leaders");break}if(ae.length>0&&(ge.filter=ae),e.includes("stats"))return await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:S,method:"GET",queryParams:ge,headers:Te}));const{contents:x,paging:A}=await Ta.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:S,method:"GET",queryParams:ge,headers:Te}))||[],U=["owned","listings","owned-full-meta"];return{paging:{start:ge.start,limit:ge.limit,total:A.total,more:A.total>pe+ce},results:(x||[]).map(L=>U.includes(e)?pbe(this,L):L)}}catch(ae){if(ae.status&&ae.status.toString()==="404")return{paging:{start:ge.start,limit:ge.limit,total:0,more:!1},results:[]};throw ae}}async MintingStatus({marketplaceParams:e,tenantId:t}){t||(t=(await this.MarketplaceInfo({marketplaceParams:e||this.selectedMarketplaceInfo})).tenantId);try{return(await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","status","act",t),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))).map(i=>{let[o,u,c]=i.op.split(":");u=u.startsWith("0x")?Ta.FormatAddress(u):u;let p,h,g,m;return o==="nft-buy"?p=c:o==="nft-claim"?(p=c,i.marketplaceId=u,i.extra&&i.extra[0]&&(u=i.extra.token_addr,h=i.extra.token_id_str)):o==="nft-redeem"?p=i.op.split(":").slice(-1)[0]:h=c,o==="nft-transfer"&&(p=i.extra&&i.extra.trans_id,h=i.extra&&i.extra.token_id_str||h,i.extra&&i.extra.gift_action==="nft-gift-claim"&&(m=i.extra.gift_id)),o==="nft-offer-redeem"&&(g=i.op.split(":")[3]),{...i,timestamp:new Date(i.ts),state:i.state&&typeof i.state=="object"?Object.values(i.state):i.state,extra:i.extra&&typeof i.extra=="object"?Object.values(i.extra):i.extra,confirmationId:p,op:o,address:Ta.FormatAddress(u),tokenId:h,offerId:g,giftId:m}}).sort((i,o)=>i.ts<o.ts?1:-1)}catch(r){return this.Log("Failed to retrieve minting status",!0,r),[]}}async DeployTenant({tenantId:e,tenantSlug:t="",tenantHash:r}){if(!r){const u=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("public/asset_metadata/tenants",t),resolveLinks:!0,linkDepthLimit:1,resolveIncludeSource:!0,resolveIgnoreErrors:!0,select:["."]});if(!u)throw Error(`Eluvio Wallet Client: Invalid or missing tenancy: ${t}`);const c=u["."].source;r=await this.client.LatestVersionHash({versionHash:c})}const i={content_hash:r,ts:Date.now()},o=await this.client.Sign(JSON.stringify(i));await this.client.authClient.MakeAuthServiceRequest({path:ma("as","tnt","config",e,"metadata"),method:"POST",body:i,headers:{Authorization:`Bearer ${o}`}})}}Object.assign(Wd.prototype,lbe());Object.assign(Wd.prototype,cbe());Object.assign(Wd.prototype,fbe());const{ElvClient:gbe}=N4,bbe=Rs;var vbe=gbe,Ch=bbe;const Ij=Object.freeze(Object.defineProperty({__proto__:null,ElvClient:vbe,Utils:Ch},Symbol.toStringTag,{value:"Module"})),zI={default:{label:"Default",hlsSettings:Ch.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class wbe{constructor({player:e}){this.player=e,this.visible=!0,this.allowRotation=!0}IsVisible(){return this.visible}IsReady(){return!this.player.loading}IsPlaying(){return!this.player.video.paused}HasPlaybackStarted(){return this.player.playbackStarted}async Play(){return await this.player.__Play()}Pause(){this.player.video.pause()}TogglePlay(){return this.player.video.paused?(this.Play(),!0):(this.Pause(),!1)}Stop(){this.Pause(),this.Seek({time:0}),this.player.playbackStarted=!1,this.player.__SettingsUpdate()}GetCurrentTime(){return this.player.video.currentTime}GetDuration(){return this.player.video.duration}Seek({fraction:e,time:t,relativeSeconds:r}){if(!this.player.video||e&&!this.player.video.duration)return;const i=this.player.video.currentTime;return r?this.player.video.currentTime=Math.max(0,Math.min(this.player.video.duration,this.player.video.currentTime+r)):typeof e<"u"?this.player.video.currentTime=this.player.video.duration*e:this.player.video.currentTime=t,i<=this.player.video.currentTime}GetVolume(){return this.player.video.volume}SetVolume({fraction:e,relativeFraction:t}){return t?this.player.video.volume=Math.min(1,Math.max(0,this.GetVolume()+t)):this.player.video.volume=e,this.player.video.volume>0&&this.Unmute(!1),this.player.video.volume}IsMuted(){return this.player.video.muted}Mute(){this.player.video.muted=!0}Unmute(){this.player.video.muted=!1}ToggleMuted(){return this.player.video.muted=!this.player.video.muted,this.player.video.muted}IsFullscreen(){return(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)===this.player.target}Fullscreen(){this.player.target.requestFullscreen?this.player.target.requestFullscreen({navigationUI:"hide"}):this.player.target.mozRequestFullScreen?this.player.target.mozRequestFullScreen({navigationUI:"hide"}):this.player.target.webkitRequestFullscreen?this.player.target.webkitRequestFullscreen({navigationUI:"hide"}):this.player.target.msRequestFullscreen?this.player.target.msRequestFullscreen({navigationUI:"hide"}):this.player.target.querySelector("video").webkitEnterFullScreen()}ExitFullscreen(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()}ToggleFullscreen(){return this.IsFullscreen()?(this.ExitFullscreen(),!1):(this.Fullscreen(),!0)}GetCollectionInfo(){if(!this.player.collectionInfo)return;const e={...this.player.collectionInfo};return e.content=e.content.map(t=>({...t,active:t.mediaIndex===e.mediaIndex})),e.active=e.content[e.mediaIndex],e}CollectionPlay({mediaIndex:e,mediaId:t,autoplay:r}){this.player.loading||(this.player.__CollectionPlay({mediaId:t,mediaIndex:e,autoplay:r}),this.player.__SettingsUpdate())}CollectionPlayNext({autoplay:e}={}){const t=this.GetCollectionInfo();if(!t)return;const r=Math.min(t.mediaIndex+1,t.mediaLength-1);r!==t.mediaIndex&&this.CollectionPlay({mediaIndex:r,autoplay:e})}CollectionPlayPrevious({autoplay:e}={}){const t=this.GetCollectionInfo();if(!t)return;const r=Math.max(0,t.mediaIndex-1);r!==t.mediaIndex&&this.CollectionPlay({mediaIndex:r,autoplay:e})}IsLive(){return this.player.isLive}GetContentInfo(){if(this.player.playerOptions.title!==!1){const e=this.GetCollectionInfo();if(e&&e.active)return{title:e.active.title||"",subtitle:e.active.title||"",description:e.active.description||"",image:e.active.image&&e.active.image.url||"",posterImage:e.active.poster_image&&e.active.poster_image.url||"",headers:e.active.headers||[]};if(this.player.sourceOptions.contentInfo)return{title:this.player.sourceOptions.contentInfo.title,subtitle:this.player.sourceOptions.contentInfo.subtitle,description:this.player.sourceOptions.contentInfo.description,image:this.player.sourceOptions.contentInfo.image,posterImage:this.player.sourceOptions.contentInfo.posterImage,headers:this.player.sourceOptions.contentInfo.headers||[]}}}GetQualityLevels(){let e=[];if(this.player.hlsPlayer){if(e=this.player.hlsPlayer.levels.map((t,r)=>({index:r,active:this.player.hlsPlayer.currentLevel===r&&!this.player.hlsPlayer.autoLevelEnabled,resolution:t.attrs.RESOLUTION,bitrate:t.bitrate,audioTrack:!t.videoCodec,label:t.audioTrack?`${t.bitrate/1e3}kbps`:`${t.attrs.RESOLUTION} (${(t.bitrate/1e3/1e3).toFixed(1)}Mbps)`,activeLabel:t.audioTrack?`${t.bitrate/1e3}kbps`:`${t.attrs.RESOLUTION}`})).sort((t,r)=>t.bitrate<r.bitrate?1:-1),e.length>0){const t=e.find(r=>this.player.hlsPlayer.currentLevel===r.index);e.unshift({index:-1,label:"Auto",activeLabel:t?`Auto (${t.activeLabel})`:"Auto",active:this.player.hlsPlayer.autoLevelEnabled})}}else this.player.dashPlayer&&(e=this.player.dashPlayer.getBitrateInfoListFor("video").map(t=>({index:t.qualityIndex,active:t.qualityIndex===this.player.dashPlayer.getQualityFor("video"),resolution:`${t.width}x${t.height}`,bitrate:t.bitrate,label:`${t.width}x${t.height} (${(t.bitrate/1e3/1e3).toFixed(1)}Mbps)`,activeLabel:`${t.width}x${t.height}`})).sort((t,r)=>t.bitrate<r.bitrate?1:-1));return{options:e,active:e.find(t=>t.active)}}SetQualityLevel(e){this.player.hlsPlayer?(this.player.hlsPlayer.nextLevel=e,this.player.hlsPlayer.streamController.immediateLevelSwitch()):this.player.dashPlayer&&(this.player.dashPlayer.setQualityFor("video",e),this.player.dashPlayer.updateSettings({streaming:{trackSwitchMode:"alwaysReplace",buffer:{fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!0},abr:{autoSwitchBitrate:{video:e===-1}}}})),this.player.__SettingsUpdate()}GetAudioTracks(){let e=[];return this.player.nativeHLS?e=Array.from(this.player.video.audioTracks).map(t=>({index:t.id,label:t.label||t.language,active:t.enabled})):this.player.hlsPlayer?e=this.player.hlsPlayer.audioTracks.map(t=>({index:t.id,label:t.name,active:t.id===this.player.hlsPlayer.audioTrack})):this.player.dashPlayer&&(e=this.player.dashPlayer.getTracksFor("audio").map(t=>({index:t.index,label:t.labels&&t.labels.length>0?t.labels[0].text:t.lang,active:t.index===this.player.dashPlayer.getCurrentTrackFor("audio").index}))),{options:e,active:e.find(t=>t.active)}}SetAudioTrack(e){if(this.player.nativeHLS)Array.from(this.player.video.audioTracks).forEach(t=>t.enabled=e.toString()===t.id);else if(this.player.hlsPlayer)this.player.hlsPlayer.audioTrack=e,this.player.hlsPlayer.streamController.immediateLevelSwitch();else if(this.player.dashPlayer){const t=this.player.dashPlayer.getTracksFor("audio").find(r=>r.index===e);this.player.dashPlayer.setCurrentTrack(t)}}GetTextTracks(){let e=[],t;return this.player.nativeHLS||this.player.hlsPlayer?(t=Array.from(this.player.video.textTracks).findIndex(r=>r.mode==="showing"),e=Array.from(this.player.video.textTracks).map((r,i)=>({index:i,label:r.label||r.language,language:r.language,active:r.mode==="showing"}))):this.player.dashPlayer&&(t=this.player.dashPlayer.getCurrentTextTrackIndex(),e=this.player.dashPlayer.getTracksFor("text").map((r,i)=>({index:i,label:r.labels&&r.labels.length>0?r.labels[0].text:r.lang,language:r.lang,active:i===t}))),e.length>0&&e.unshift({index:-1,label:"Disabled",active:t<0}),{options:e,active:e.find(r=>r.active)}}SetTextTrack(e){if(e=parseInt(e),this.player.nativeHLS||this.player.hlsPlayer){const t=Array.from(this.player.video.textTracks);t.map(r=>r.mode="disabled"),e>=0&&(t[e].mode="showing")}else this.player.dashPlayer&&this.player.dashPlayer.setTextTrack(parseInt(e));e>=0&&(this.__lastTextTrackIndex=e)}ToggleTextTrack(){const{active:e,options:t}=this.GetTextTracks();if(t.length!==0){if(e&&e.index>=0)return this.SetTextTrack(-1),!1;if(this.__lastTextTrackIndex>=0)return this.SetTextTrack(this.__lastTextTrackIndex),!0;for(const r of navigator.languages){const i=t.find(o=>o.language===r||o.language===r.split("-")[0]);if(i)return this.SetTextTrack(i.index),!0}return this.SetTextTrack(0),!0}}GetPlaybackRates(){const e=["0.25","0.5","0.75","1","1.25","1.5","1.75","2"].map((r,i)=>({index:i,rate:parseFloat(r),label:`${r}x`,active:this.player.video.playbackRate.toFixed(2)===parseFloat(r).toFixed(2)}));let t=e.find(r=>r.active);return t||(t={index:-1,rate:this.player.video.playbackRate,label:`${this.player.video.playbackRate}x`,active:!0}),{options:e,active:t}}SetPlaybackRate({index:e,rate:t}){const r=this.player.video.playbackRate;if(t)return this.player.video.playbackRate=t,this.player.__SettingsUpdate(),{rate:t,increase:r<=t};{const i=this.GetPlaybackRates().options[e];if(i)return this.player.video.playbackRate=i.rate,this.player.__SettingsUpdate(),{rate:i.rate,increase:r<=i.rate}}}GetPlayerProfiles(){let e=[];return this.player.hlsPlayer&&(e=Object.keys(zI).map(t=>({index:t,label:zI[t].label,active:this.player.playerOptions.playerProfile===t}))),{options:e,active:e.find(t=>t.active)}}SetPlayerProfile({profile:e,customOptions:t={}}){this.player.SetPlayerProfile({profile:e,customHLSOptions:t})}ShowPlayerProfileForm(){this.player.__showPlayerProfileForm=!0,this.player.__SettingsUpdate()}HidePlayerProfileForm(){this.player.__showPlayerProfileForm=!1,this.player.__SettingsUpdate()}GetOptions(){let e={quality:this.GetQualityLevels(),audio:this.GetAudioTracks(),text:this.GetTextTracks(),profile:this.GetPlayerProfiles(),rate:this.GetPlaybackRates()};return e.hasQualityOptions=e.quality.options.length>0,e.hasAudioOptions=e.audio.options.length>0,e.hasTextOptions=e.text.options.length>0,e.hasProfileOptons=e.profile.options.length>0,e.hasRateOptions=!this.IsLive(),e.hasAnyOptions=e.hasQualityOptions||e.hasAudioOptions||e.hasTextOptions||e.hasProfileOptons||e.hasRateOptions,e}AllowRotation(){return this.allowRotation}SetAllowRotation(e){this.allowRotation=e,this.player.__SettingsUpdate()}IsRotatable(){return this.IsFullscreen()&&window.innerWidth<900&&window.innerHeight>window.innerWidth&&this.player.video.videoWidth>this.player.video.videoHeight}RegisterVideoEventListener(e,t){return this.player.__RegisterVideoEventListener(e,t)}RegisterSettingsListener(e){return this.player.__RegisterSettingsListener(e)}Reset(){this.player.Reset()}Destroy(){this.player.Destroy()}}const Fn={PLAY:"play",PAUSE:"pause",MUTE:"muted",UNMUTE:"unmuted",VOLUME_UP:"volumeup",VOLUME_DOWN:"volumedown",SEEK_BACK:"seekback",SEEK_FORWARD:"seekforward",PLAYBACK_RATE_UP:"playbackrateup",PLAYBACK_RATE_DOWN:"playbackratedown",SUBTITLES_ON:"subtitleson",SUBTITLES_OFF:"subtitlesoff",PLAY_NEXT:"playnext",PLAY_PREVIOUS:"playprevious"},Dj=({player:n,setRecentUserAction:e,sideClickRatio:t=.1,doubleClickDelay:r=300})=>{let i,o,u,c;return window.addEventListener("focus",()=>{u=c||document.activeElement,c=document.activeElement},!0),()=>p=>{if(clearTimeout(o),p.target===p.currentTarget&&p.currentTarget.contains(u)&&!p.currentTarget.classList.contains("menu-active"))if(Date.now()-i<r){const h=p.target.getBoundingClientRect(),g=(p.clientX-h.left)/h.width;g<=t?(n.controls.Seek({relativeSeconds:-10}),e({action:Fn.SEEK_BACK,text:"10 seconds"})):g>=1-t?(n.controls.Seek({relativeSeconds:10}),e({action:Fn.SEEK_FORWARD,text:"10 seconds"})):n.controls.ToggleFullscreen()}else o=setTimeout(()=>{const h=n.controls.TogglePlay();e({action:h?Fn.PLAY:Fn.PAUSE})},r);u=p.target,i=Date.now()}},Uj=(n,e)=>{let t=0;return()=>r=>{r.repeat||(t=0);const i=t<5?5:t<15?10:t<40?30:60;switch(r.key){case"ArrowLeft":r.preventDefault(),n.controls.Seek({relativeSeconds:-i}),e({action:Fn.SEEK_BACK,text:`${i} seconds`});break;case"ArrowRight":r.preventDefault(),n.controls.Seek({relativeSeconds:i}),e({action:Fn.SEEK_FORWARD,text:`${i} seconds`});break;default:return}t+=1}},xbe=n=>e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),n.controls.SetVolume({relativeFraction:-.05});break;case"ArrowRight":e.preventDefault(),n.controls.IsMuted()?n.controls.SetVolume({fraction:.05}):n.controls.SetVolume({relativeFraction:.05});break}},j2=(n,e)=>{if(isNaN(e)||!isFinite(e)||e===0)return"00:00";const t=e>60*60,r=Math.floor(n/60/60),i=Math.floor(n/60%60),o=Math.floor(n%60);let u=`${i.toString().padStart(t&&r>0?2:1,"0")}:${o.toString().padStart(2,"0")}`;return t&&(u=`${r.toString()}:${u}`),u},sk=async({player:n,pathOrUrl:e="",width:t})=>{if(typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")))return e;if(e&&e.url)return e.url;const r=await n.__Client();let i;const{mediaCatalogObjectId:o,mediaCatalogVersionHash:u}=n.sourceOptions&&n.sourceOptions.mediaCollectionOptions||{},c=n.sourceOptions&&n.sourceOptions.playoutParameters||{};return u?i=u:o?i=await r.LatestVersionHash({objectId:o}):c.versionHash?i=c.versionHash:i=await r.LatestVersionHash({objectId:c.objectId}),i?(e=e&&e.toString().trim().replace(/^\./,"").replace(/\/+/,""),e.startsWith("files")?await r.FileUrl({versionHash:i,filePath:e.replace(/^files/,""),queryParams:t?{width:t}:{},authorizationToken:c.authorizationToken}):await r.LinkUrl({versionHash:i,linkPath:e,queryParams:t?{width:t}:{},authorizationToken:c.authorizationToken})):""},Fj=(n,e)=>{let t={};return Object.keys(n).forEach(r=>{if(typeof n[r]=="object"&&!Array.isArray(n[r]))t[r]=Fj(n[r],(e||{})[r]);else{const i=(e||{})[r];t[r]=typeof i<"u"?i:n[r]}}),t},Bj=n=>Fj($W,n),_be={default:{label:"Default",hlsSettings:Ch.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class $2{__RegisterVideoEventListener(e,t){this.video.addEventListener(e,t),this.__listenerDisposers.push(()=>this.video.removeEventListener(e,t))}__RegisterSettingsListener(e){return this.__settingsListeners.push(e),()=>this.__settingsListeners=this.__settingsListeners.filter(t=>t!==e)}constructor({target:e,video:t,parameters:r,SetErrorMessage:i}){this.loading=!0,this.target=e,this.video=t,this.SetErrorMessage=i,this.controls=new wbe({player:this}),this.__settingsListeners=[],this.__listenerDisposers=[],this.__showPlayerProfileForm=!1,this.playbackStarted=!1,this.reloads=0,this.canPlay=!1;try{r.playerOptions.hlsjsOptions&&Object.keys(r.playerOptions.hlsjsOptions).length>0&&(this.customHLSOptions=r.playerOptions.hlsjsOptions,r.playerOptions.playerProfile=fn.playerProfile.CUSTOM)}catch(o){this.Log(o,!0)}this.__Initialize(r)}async __Client(){return this.clientPromise&&await this.clientPromise,this.clientOptions.client||(this.clientPromise=(async()=>{const{ElvClient:e}=await Promise.resolve().then(()=>Ij);return this.clientOptions.client=await e.FromConfigurationUrl({configUrl:this.clientOptions.network}),this.clientOptions.client.SetStaticToken({token:this.clientOptions.staticToken||this.clientOptions.client.utils.B64(JSON.stringify({qspace_id:await this.clientOptions.client.ContentSpaceId()}))}),this.clientOptions.client})(),await this.clientPromise),this.clientOptions.client}async __PlayoutOptions(){const e=await this.__Client(),t=this.sourceOptions.playoutParameters||{};if(this.collectionInfo){const w=this.collectionInfo.content[this.collectionInfo.mediaIndex];t.objectId=e.utils.DecodeVersionHash(w.mediaHash).objectId,t.versionHash=w.mediaHash,this.sourceOptions.playoutOptions=void 0}let r,i,o={};if((t.clipStart||t.clipEnd)&&(o.clip_start=parseFloat(t.clipStart||0),t.clipEnd&&(o.clip_end=parseFloat(t.clipEnd))),o.ignore_trimming=t.ignoreTrimming,o.resolve=t.resolve,t.offering||t.directLink||(t.offerings||[]).length>0){let w=await e.AvailableOfferings({objectId:t.objectId,versionHash:t.versionHash,writeToken:t.writeToken,linkPath:t.linkPath,directLink:t.directLink,resolveIncludeSource:!0,authorizationToken:t.authorizationToken})||{};if(r=Object.keys(w)[0],t.offering?r=w[t.offering]?t.offering:void 0:(t.offerings||[]).length>0&&(r=t.offerings.find(v=>w[v])),!r)throw new Error(`Unable to find offering from '${t.offering||t.offerings}'`);i=w[r].uri}t.directLink?this.sourceOptions.playoutOptions||(this.sourceOptions.playoutOptions=await e.PlayoutOptions({offeringURI:i,options:o})):this.sourceOptions.playoutOptions||(this.sourceOptions.playoutOptions=await e.PlayoutOptions({...t,offering:r,options:o}));let u=(await e.AvailableDRMs()).filter(w=>(this.sourceOptions.drms||[]).includes(w)),c=this.sourceOptions.protocols,p,h;for(;!(p&&h);)if(p=c.find(w=>this.sourceOptions.playoutOptions[w]),h=this.sourceOptions.drms.find(w=>u.includes(w)&&this.sourceOptions.playoutOptions[p].playoutMethods[w]),!h&&(c=c.filter(w=>w!==p),c.length===0))throw Error("No valid protocol / DRM combination available");const{playoutUrl:g,drms:m}=this.sourceOptions.playoutOptions[p].playoutMethods[h];return{protocol:p,drm:h,playoutUrl:g,drms:m,availableDRMs:u,offeringURI:i,offering:r,sessionId:this.sourceOptions.playoutOptions.sessionId,multiviewOptions:{enabled:this.sourceOptions.playoutOptions.multiview,AvailableViews:this.sourceOptions.playoutOptions.AvailableViews,SwitchView:this.sourceOptions.playoutOptions.SwitchView}}}__CollectionPlay({mediaIndex:e,mediaId:t,autoplay:r}){t&&(e=this.collectionInfo.content.find(i=>i.id===t)),this.collectionInfo.mediaIndex=e,this.__SettingsUpdate(),this.__Initialize(this.originalParameters,this.video?{muted:this.video.muted,volume:this.video.volume,playing:typeof r<"u"?r:!this.video.paused}:null)}async __LoadCollection(){if(this.collectionInfo)return;let{mediaCatalogObjectId:e,mediaCatalogVersionHash:t,collectionId:r}=this.sourceOptions&&this.sourceOptions.mediaCollectionOptions||{};if(!r)return;if(!e&&!t)throw{displayMessage:"Invalid collection options: Media catalog not specified"};const i=await this.__Client();try{const o=this.sourceOptions.playoutParameters.authorizationToken;t=t||await i.LatestVersionHash({objectId:e});const c=(await i.ContentObjectMetadata({versionHash:t,metadataSubtree:"public/asset_metadata/info/collections",authorizationToken:o,produceLinkUrls:!0})||[]).find(p=>p.id===r);if(!c)throw{displayMessage:`No collection with ID ${r} found for media catalog ${e||t}`};c.content=c.content.filter(p=>p.media).map((p,h)=>({...p,active:h===0,mediaId:p.id,mediaIndex:h,mediaHash:p.media&&p.media["/"]&&p.media["/"].split("/").find(g=>g.startsWith("hq__"))})),this.collectionInfo={...c,isPlaylist:c.type==="playlist",mediaIndex:0,mediaLength:c.content.length}}catch(o){throw this.Log("Failed to load collection:"),o}}async __Initialize(e,t){if(!this.__destroyed){this.__Reset(),this.loading=!0,this.initTime=Date.now(),this.__SettingsUpdate(),e&&(this.originalParameters=Bj(e),this.clientOptions=e.clientOptions,this.sourceOptions=e.sourceOptions,this.playerOptions=e.playerOptions),this.isLive=e.sourceOptions.contentInfo.type===fn.type.LIVE,this.errors=0,this.__Client();try{t&&(this.video.volume=t.volume,this.video.muted=t.muted,t.playing&&(this.playerOptions.autoplay=fn.autoplay.ON),t.currentTime&&this.__RegisterVideoEventListener("loadedmetadata",()=>this.video.currentTime=t.currentTime)),this.__RegisterVideoEventListener("play",()=>{this.reloads=0,this.playbackStarted=!0,this.__SettingsUpdate()});const r=()=>{this.canPlay&&!isFinite(this.video.duration)?this.isLive=!0:this.video.duration&&this.videoDuration>0&&Math.abs(this.video.duration-this.videoDuration)>1&&(this.isLive=!0)};this.__RegisterVideoEventListener("canplay",()=>{this.initTime&&!this.initTimeLogged&&(this.Log(`Player initialization: ${((Date.now()-this.initTime)/1e3).toFixed(2)} seconds`),this.initTimeLogged=!0,this.canPlay=!0,r(),this.playerOptions.autoplay===fn.autoplay.ON&&this.controls.Play())}),this.__RegisterVideoEventListener("durationchange",()=>{r(),this.videoDuration=this.video.duration}),await this.__LoadCollection(),this.collectionInfo&&this.collectionInfo.isPlaylist&&this.collectionInfo.mediaIndex<this.collectionInfo.mediaLength-1&&this.__RegisterVideoEventListener("ended",()=>this.controls&&this.controls.CollectionPlayNext({autoplay:!0}));let{protocol:i,drm:o,playoutUrl:u,drms:c,multiviewOptions:p}=await this.__PlayoutOptions();u=new URL(u);const h=this.sourceOptions.playoutParameters.authorizationToken||u.searchParams.get("authorization");if(this.__destroyed)return;i==="hls"?await this.__InitializeHLS({playoutUrl:u,authorizationToken:h,drm:o,drms:c,multiviewOptions:p}):await this.__InitializeDash({playoutUrl:u,authorizationToken:h,drm:o,drms:c,multiviewOptions:p}),this.playerOptions.collectVideoAnalytics&&Promise.resolve().then(()=>require("./Analytics-XftohbWA.js")).then(({InitializeMuxMonitoring:g})=>g({appName:this.playerOptions.appName||"elv-player-js",elvPlayer:this,playoutUrl:u,authorizationToken:h,disableCookies:this.playerOptions.collectVideoAnalytics===fn.collectVideoAnalytics.DISABLE_COOKIES})),this.playerOptions.playerCallback&&this.playerOptions.playerCallback({player:this,videoElement:this.video,hlsPlayer:this.hlsPlayer,dashPlayer:this.dashPlayer}),this.__destroyed&&this.__DestroyPlayer()}catch(r){let i;if(r&&[401,403].includes(r.status)||[401,403].includes(r.code))try{const o=await this.__Client(),u=this.sourceOptions.playoutParameters.linkPath?await o.LinkTarget({...this.sourceOptions.playoutParameters}):this.sourceOptions.playoutParameters.versionHash||await o.LatestVersionHash({objectId:this.sourceOptions.playoutParameters.objectId});i=await o.ContentObjectMetadata({versionHash:u,metadataSubtree:"public/asset_metadata/permission_message",authorizationToken:this.sourceOptions.playoutParameters.authorizationToken}),i?(r.permission_message=i,this.SetErrorMessage(i),typeof r=="object"?r.permission_message=i:this.Log(i,!0)):this.SetErrorMessage(r.displayMessage||"Insufficient permissions")}catch(o){this.SetErrorMessage(o.displayMessage||"Insufficient permissions")}else r.status===500?this.__HardReload(r,1e4):this.SetErrorMessage(r.displayMessage||"Something went wrong");this.playerOptions.errorCallback&&this.playerOptions.errorCallback(r,this)}finally{this.loading=!1,this.__SettingsUpdate()}}}async __InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,multiviewOptions:i}){if(this.HLS=(await Promise.resolve().then(()=>require("./hls-6O5SV1FQ.js"))).default,["fairplay","sample-aes"].includes(r)||!this.HLS.isSupported()){if(this.nativeHLS=!0,r==="fairplay"?pK({playoutOptions:this.sourceOptions.playoutOptions,video:this.video}):this.video.src=e.toString(),i.enabled){const o=i.SwitchView;i.SwitchView=async u=>{await o(u)}}}else{e.searchParams.delete("authorization");const o=(_be[this.playerOptions.playerProfile]||{}).hlsSettings||{},u=this.playerOptions.playerProfile===fn.playerProfile.CUSTOM?this.customHLSOptions:{};this.hlsOptions={capLevelToPlayerSize:this.playerOptions.capLevelToPlayerSize,...o,...u};const c=new this.HLS({xhrSetup:p=>(p.setRequestHeader("Authorization",`Bearer ${t}`),(this.playerOptions.hlsjsOptions||{}).xhrSetup&&this.playerOptions.hlsjsOptions.xhrSetup(p),p),...this.hlsOptions});if(this.playerOptions.maxBitrate&&c.on(this.HLS.Events.MANIFEST_PARSED,(p,{levels:h,firstLevel:g})=>{let m=h.map((w,v)=>w.bitrate>this.playerOptions.maxBitrate?v:void 0).filter(w=>typeof w<"u").reverse();m.length===h.length&&(this.Log(`Warning: Max bitrate '${this.playerOptions.maxBitrate}bps' is less than all available levels for this content.`),m=m.filter(w=>w>0)),this.Log("Removing the following levels due to maxBitrate setting:"),this.Log(m.map(w=>[h[w].width,"x",h[w].height,` (${(h[w].bitrate/1e3/1e3).toFixed(1)}Mbps)`].join("")).join(", ")),m.find(w=>g===w)&&(c.startLevel=h.map((w,v)=>v).filter(w=>!m.includes(w)).reverse()[0]),m.map(w=>c.removeLevel(w))}),c.loadSource(e.toString()),c.attachMedia(this.video),this.controls&&i.enabled){const p=i.SwitchView;i.SwitchView=async h=>{await p(h),c.nextLevel=c.currentLevel},this.controls.InitializeMultiViewControls(i)}[this.HLS.Events.SUBTITLE_TRACKS_UPDATED,this.HLS.Events.SUBTITLE_TRACK_SWITCH,this.HLS.Events.LEVEL_UPDATED,this.HLS.Events.LEVEL_SWITCHED,this.HLS.Events.AUDIO_TRACKS_UPDATED,this.HLS.Events.AUDIO_TRACK_SWITCHED,this.HLS.Events.MANIFEST_LOADED].map(p=>c.on(p,()=>this.__SettingsUpdate())),this.SetPlayerProfile=async({profile:p,customHLSOptions:h={}})=>{this.videoDuration=void 0,this.playerOptions.playerProfile=p,this.customHLSOptions=h;const g=!this.video.paused,m=this.video.currentTime;this.hlsPlayer.destroy(),await this.__InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,multiviewOptions:i}),g?this.video.play():this.video.pause(),this.isLive||(this.video.currentTime=m)},c.on(this.HLS.Events.FRAG_LOADED,()=>this.errors=0),c.on(this.HLS.Events.ERROR,async(p,h)=>{this.errors+=1,this.Log(`Encountered ${h.details}`,!0),this.Log(h,!0),h.response&&h.response.code===403?this.SetErrorMessage("Insufficient permissions"):this.errors<5?h.fatal&&(h.data&&h.data.type===this.HLS.ErrorTypes.MEDIA_ERROR?(this.Log("Attempting to recover using hlsPlayer.recoverMediaError"),c.recoverMediaError()):this.__HardReload(h)):this.__HardReload(h)}),this.hlsPlayer=c,this.player=c}}async __InitializeDash({playoutUrl:e,authorizationToken:t,drm:r,drms:i}){this.Dash=(await Promise.resolve().then(()=>require("./dash.all.min-YF2PD14A.js")).then(c=>c.dash_all_min)).default;const o=this.Dash.MediaPlayer().create(),u=this.playerOptions.dashjsOptions||{};if(o.updateSettings({...u,streaming:{buffer:{fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!0,...(u.streaming||{}).buffer||{}},text:{defaultEnabled:!1,...(u.streaming||{}).text||{}},...u.streaming||{}}}),this.playerOptions.capLevelToPlayerSize&&o.updateSettings({streaming:{abr:{limitBitrateByPortal:!0}}}),this.playerOptions.maxBitrate&&o.updateSettings({streaming:{abr:{maxBitrate:{video:this.playerOptions.maxBitrate/1e3}}}}),e.searchParams.delete("authorization"),o.extend("RequestModifier",function(){return{modifyRequestHeader:c=>(c.setRequestHeader("Authorization",`Bearer ${t}`),c),modifyRequestURL:c=>c}}),r===fn.drms.WIDEVINE){const c=i.widevine.licenseServers[0];o.setProtectionData({"com.widevine.alpha":{serverURL:c}})}o.initialize(this.video,e.toString(),this.playerOptions.autoplay===fn.autoplay.ON),[this.Dash.MediaPlayer.events.TRACK_CHANGE_RENDERED,this.Dash.MediaPlayer.events.QUALITY_CHANGE_RENDERED,this.Dash.MediaPlayer.events.REPRESENTATION_SWITCH,this.Dash.MediaPlayer.events.TEXT_TRACKS_ADDED,this.Dash.MediaPlayer.events.TEXT_TRACK_ADDED,this.Dash.MediaPlayer.events.MANIFEST_LOADED,this.Dash.MediaPlayer.events.CAN_PLAY].map(c=>o.on(c,()=>this.__SettingsUpdate())),this.player=o,this.dashPlayer=o}async __Play(){try{return await this.video.play(),!0}catch(e){if(this.Log("Unable to autoplay",!0),this.Log(e,!0),this.playbackStarted=!1,this.playerOptions.muted===fn.muted.OFF_IF_POSSIBLE&&this.video.paused&&!this.video.muted){await new Promise(t=>setTimeout(t,250)),this.Log("Attempting to autoplay muted"),this.video.muted=!0;try{return await this.video.play(),!0}catch{return this.playbackStarted=!1,!1}}else return this.playbackStarted=!1,!1}}__SettingsUpdate(){this.__settingsListeners.forEach(e=>{try{e()}catch(t){this.Log("Failed to call settings listener",!0),this.Log(t,!0)}})}__SetControlsVisibility(e){this.controls.visible!==e&&(this.controls.visible=e,this.__SettingsUpdate())}__DestroyPlayer(){this.__destroyed=!0,this.__Reset()}__Reset(){if(this.player){if(this.Log("Destroying player"),this.video&&this.video.pause(),this.hlsPlayer?this.hlsPlayer.destroy():this.dashPlayer&&this.dashPlayer.destroy(),this.__listenerDisposers.forEach(e=>{try{e()}catch(t){this.Log("Failed to dispose of video event listener",!0),this.Log(t)}}),this.__listenerDisposers=[],this.__showPlayerProfileForm=!1,this.video.mux)try{this.video.mux.destroy()}catch(e){this.Log("Error destroying mux monitoring:"),this.Log(e)}this.nativeHLS=!1,this.hlsPlayer=void 0,this.dashPlayer=void 0,this.player=void 0,this.initTimeLogged=!1,this.canPlay=!1}}async __HardReload(e,t=6e3){if(!this.reloading){if(this.reloading=!0,this.reloads+=1,this.reloads>2){this.SetErrorMessage(e.displayMessage||"Unable to play content");return}try{if(e&&this.playerOptions.restartCallback)try{const i=await this.playerOptions.restartCallback(e);if(i&&typeof i=="boolean"){this.Destroy();return}}catch(i){this.Log("Restart callback failed:"),this.Log(i)}if(this.SetErrorMessage(e.displayMessage||"Something went wrong, reloading player..."),await new Promise(i=>setTimeout(i,t)),this.__destroyed)return;this.Log("Reloading stream");const r=await this.__Client();r&&await r.ResetRegion(),this.restarted=!0,this.SetErrorMessage(void 0),this.__Initialize(this.originalParameters,this.video?{muted:this.video.muted,volume:this.video.volume,currentTime:this.video.currentTime,playing:!this.video.paused}:null)}finally{this.reloading=!1}}}Log(e,t=!1){t?console.error("ELUVIO PLAYER:",e):this.playerOptions.debugLogging&&console.warn("ELUVIO PLAYER:",e)}}$2.EluvioPlayerParameters=fn;$2.EluvioPlayer=$2;var zj=function(){if(typeof Map<"u")return Map;function n(e,t){var r=-1;return e.some(function(i,o){return i[0]===t?(r=o,!0):!1}),r}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(t){var r=n(this.__entries__,t),i=this.__entries__[r];return i&&i[1]},e.prototype.set=function(t,r){var i=n(this.__entries__,t);~i?this.__entries__[i][1]=r:this.__entries__.push([t,r])},e.prototype.delete=function(t){var r=this.__entries__,i=n(r,t);~i&&r.splice(i,1)},e.prototype.has=function(t){return!!~n(this.__entries__,t)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,r){r===void 0&&(r=null);for(var i=0,o=this.__entries__;i<o.length;i++){var u=o[i];t.call(r,u[1],u[0])}},e}()}(),L4=typeof window<"u"&&typeof document<"u"&&window.document===document,H2=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Sbe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(H2):function(n){return setTimeout(function(){return n(Date.now())},1e3/60)}}(),Ebe=2;function Cbe(n,e){var t=!1,r=!1,i=0;function o(){t&&(t=!1,n()),r&&c()}function u(){Sbe(o)}function c(){var p=Date.now();if(t){if(p-i<Ebe)return;r=!0}else t=!0,r=!1,setTimeout(u,e);i=p}return c}var Abe=20,Mbe=["top","right","bottom","left","width","height","size","weight"],kbe=typeof MutationObserver<"u",Tbe=function(){function n(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Cbe(this.refresh.bind(this),Abe)}return n.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},n.prototype.removeObserver=function(e){var t=this.observers_,r=t.indexOf(e);~r&&t.splice(r,1),!t.length&&this.connected_&&this.disconnect_()},n.prototype.refresh=function(){var e=this.updateObservers_();e&&this.refresh()},n.prototype.updateObservers_=function(){var e=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return e.forEach(function(t){return t.broadcastActive()}),e.length>0},n.prototype.connect_=function(){!L4||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),kbe?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},n.prototype.disconnect_=function(){!L4||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},n.prototype.onTransitionEnd_=function(e){var t=e.propertyName,r=t===void 0?"":t,i=Mbe.some(function(o){return!!~r.indexOf(o)});i&&this.refresh()},n.getInstance=function(){return this.instance_||(this.instance_=new n),this.instance_},n.instance_=null,n}(),jj=function(n,e){for(var t=0,r=Object.keys(e);t<r.length;t++){var i=r[t];Object.defineProperty(n,i,{value:e[i],enumerable:!1,writable:!1,configurable:!0})}return n},Am=function(n){var e=n&&n.ownerDocument&&n.ownerDocument.defaultView;return e||H2},$j=VS(0,0,0,0);function q2(n){return parseFloat(n)||0}function jI(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.reduce(function(r,i){var o=n["border-"+i+"-width"];return r+q2(o)},0)}function Rbe(n){for(var e=["top","right","bottom","left"],t={},r=0,i=e;r<i.length;r++){var o=i[r],u=n["padding-"+o];t[o]=q2(u)}return t}function Obe(n){var e=n.getBBox();return VS(0,0,e.width,e.height)}function Lbe(n){var e=n.clientWidth,t=n.clientHeight;if(!e&&!t)return $j;var r=Am(n).getComputedStyle(n),i=Rbe(r),o=i.left+i.right,u=i.top+i.bottom,c=q2(r.width),p=q2(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==e&&(c-=jI(r,"left","right")+o),Math.round(p+u)!==t&&(p-=jI(r,"top","bottom")+u)),!Pbe(n)){var h=Math.round(c+o)-e,g=Math.round(p+u)-t;Math.abs(h)!==1&&(c-=h),Math.abs(g)!==1&&(p-=g)}return VS(i.left,i.top,c,p)}var Nbe=function(){return typeof SVGGraphicsElement<"u"?function(n){return n instanceof Am(n).SVGGraphicsElement}:function(n){return n instanceof Am(n).SVGElement&&typeof n.getBBox=="function"}}();function Pbe(n){return n===Am(n).document.documentElement}function Ibe(n){return L4?Nbe(n)?Obe(n):Lbe(n):$j}function Dbe(n){var e=n.x,t=n.y,r=n.width,i=n.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,u=Object.create(o.prototype);return jj(u,{x:e,y:t,width:r,height:i,top:t,right:e+r,bottom:i+t,left:e}),u}function VS(n,e,t,r){return{x:n,y:e,width:t,height:r}}var Ube=function(){function n(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=VS(0,0,0,0),this.target=e}return n.prototype.isActive=function(){var e=Ibe(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},n.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},n}(),Fbe=function(){function n(e,t){var r=Dbe(t);jj(this,{target:e,contentRect:r})}return n}(),Bbe=function(){function n(e,t,r){if(this.activeObservations_=[],this.observations_=new zj,typeof e!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=r}return n.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof Am(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new Ube(e)),this.controller_.addObserver(this),this.controller_.refresh())}},n.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof Am(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},n.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},n.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},n.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(r){return new Fbe(r.target,r.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},n.prototype.clearActive=function(){this.activeObservations_.splice(0)},n.prototype.hasActive=function(){return this.activeObservations_.length>0},n}(),Hj=typeof WeakMap<"u"?new WeakMap:new zj,qj=function(){function n(e){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var t=Tbe.getInstance(),r=new Bbe(e,t,this);Hj.set(this,r)}return n}();["observe","unobserve","disconnect"].forEach(function(n){qj.prototype[n]=function(){var e;return(e=Hj.get(this))[n].apply(e,arguments)}});var zbe=function(){return typeof H2.ResizeObserver<"u"?H2.ResizeObserver:qj}();const ok=({element:n,Hide:e})=>{if(!n)return;const t=o=>{o&&(o.key||"").toLowerCase()==="escape"&&e()},r=()=>{setTimeout(()=>{n.contains(document.activeElement)||setTimeout(()=>{n.contains(document.activeElement)||e()},250)})};let i=setTimeout(()=>{document.body.addEventListener("keydown",t),n.addEventListener("focusout",r)},0);return()=>{clearTimeout(i),document.body.removeEventListener("keydown",t),n.removeEventListener("focusout",r)}},Vj=({target:n,video:e,setVideoState:t})=>{const r=function(){const o=e.buffered;let u=0;for(let c=0;c<o.length;c++)o.start(c)>e.currentTime||o.end(c)>u&&(u=o.end(c));t({playing:!e.paused,duration:e.duration,volume:e.volume,muted:e.muted,rate:e.playbackRate,fullscreen:!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)})},i=["play","pause","volumechange","seeked","durationchange","ratechange"];return i.map(o=>e.addEventListener(o,r)),n.addEventListener("fullscreenchange",r),()=>{i.map(o=>e.removeEventListener(o,r)),n.removeEventListener("fullscreenchange",r)}},jbe=({video:n,setBufferFraction:e})=>{const t=()=>{if(!isFinite(n.duration))return 1;const r=n.buffered;let i=0;for(let o=0;o<r.length;o++)r.start(o)>n.currentTime||r.end(o)>i&&(i=r.end(o));e(1-(n.duration-i)/n.duration)};return n.addEventListener("progress",t),()=>n.removeEventListener("progress",t)},uk=({video:n,rate:e=10,setCurrentTime:t})=>{const r=setInterval(()=>{t(n.currentTime)},1e3/e);return()=>{clearInterval(r)}},$be=({target:n,setSize:e,setOrientation:t,setDimensions:r})=>{let i;const o=new zbe(u=>{clearTimeout(i);const c=u[0].contentRect;let p="sm",h="landscape";c.width>1400?p="xl":c.width>1e3?p="lg":c.width>650&&(p="md"),c.width<c.height&&(h="portrait"),e(p),t(h),i=setTimeout(()=>{r({width:c.width,height:c.height})},500)});return o.observe(n),()=>o.disconnect()},Hbe=({player:n})=>{const e=n.video,t=n.playerOptions.autoplay===fn.autoplay.WHEN_VISIBLE,r=n.playerOptions.muted===fn.muted.WHEN_NOT_VISIBLE;if(!t&&!r)return;let i,o;const u=async([p])=>{t&&(i!=="play"&&p.isIntersecting&&e.paused?(n.controls.Play(),i="play"):i!=="pause"&&!p.isIntersecting&&!e.paused&&(n.controls.Pause(),i="pause")),r&&(o!=="unmute"&&p.isIntersecting&&e.muted?(e.muted=!1,o="unmute"):o!=="mute"&&!p.isIntersecting&&!e.muted&&(e.muted=!0,o="mute"))},c=new window.IntersectionObserver(u,{threshold:.1}).observe(e);return()=>c&&c.disconnect()},qbe=({player:n,inactivityPeriod:e=3e3,onSleep:t,onWake:r})=>{let i;const o=p=>{clearTimeout(i),r&&r(),i=setTimeout(()=>{t&&t()},p.type==="mouseout"?500:e)},u=["play","pause","volumechange","seeking"];u.forEach(p=>n.video.addEventListener(p,o));const c=["click","dblclick","keydown","mousemove","touchmove","blur","mouseout","fullscreenchange"];return c.forEach(p=>n.target.addEventListener(p,o)),()=>{u.map(p=>n.video.removeEventListener(p,o)),c.map(p=>n.target.removeEventListener(p,o))}},Vbe=({player:n,setRecentUserAction:e})=>{if(n.playerOptions.keyboardControls===fn.keyboardControls.OFF)return;const t=n.playerOptions.keyboardControls===fn.keyboardControls.ARROW_KEYS_DISABLED,r=Uj(n,e)(),i=o=>{if(!(n.target===o.target||n.target.contains(o.target))||["button","input"].includes(document.activeElement&&document.activeElement.tagName.toLowerCase())||n.__showPlayerProfileForm)return;let u;switch(o.key){case" ":case"k":u=n.controls.TogglePlay(),e({action:u?Fn.PLAY:Fn.PAUSE});break;case"f":n.controls.ToggleFullscreen();break;case"m":u=n.controls.ToggleMuted(),e({action:u?Fn.MUTE:Fn.UNMUTE});break;case"ArrowDown":t||(u=n.controls.SetVolume({relativeFraction:-.1}),e({action:u===0?Fn.MUTE:Fn.VOLUME_DOWN,text:(u*100).toFixed(0)+"%"}));break;case"ArrowUp":t||(u=n.controls.SetVolume({relativeFraction:.1}),e({action:Fn.VOLUME_UP,text:(u*100).toFixed(0)+"%"}));break;case",":n.video.paused&&(n.controls.Seek({relativeSeconds:-1/60}),e({action:Fn.SEEK_BACK}));break;case".":n.video.paused&&(n.controls.Seek({relativeSeconds:1/60}),e({action:Fn.SEEK_FORWARD}));break;case"ArrowLeft":case"ArrowRight":t||r(o);break;case"j":n.controls.Seek({relativeSeconds:-10}),e({action:Fn.SEEK_BACK,text:"10 seconds"});break;case"l":n.controls.Seek({relativeSeconds:10}),e({action:Fn.SEEK_FORWARD,text:"10 seconds"});break;case"<":case">":const c=n.controls.GetPlaybackRates();c.active?u=n.controls.SetPlaybackRate({index:c.active.index+(o.key==="<"?-1:1)}):u=n.controls.SetPlaybackRate({rate:1}),e({action:u.increase?Fn.PLAYBACK_RATE_UP:Fn.PLAYBACK_RATE_DOWN,text:`${u.rate.toFixed(2)}x`});break;case"c":u=n.controls.ToggleTextTrack(),e({action:u?Fn.SUBTITLES_ON:Fn.SUBTITLES_OFF});break;case"P":n.controls.CollectionPlayPrevious(),e({action:Fn.PLAY_PREVIOUS});break;case"N":n.controls.CollectionPlayNext(),e({action:Fn.PLAY_NEXT});break;case"Home":n.controls.Seek({fraction:0}),e({action:Fn.SEEK_BACK});break;case"End":n.controls.Seek({fraction:1}),e({action:Fn.SEEK_FORWARD});break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u=n.controls.Seek({fraction:parseFloat(o.key)*.1}),e({action:u?Fn.SEEK_FORWARD:Fn.SEEK_BACK});break;default:return}o.preventDefault()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},Gbe=({player:n})=>{if("mediaSession"in navigator){const e=["play","pause","stop","seekbackward","seekforward","seekto","previoustrack","nexttrack"];e.forEach(i=>{navigator.mediaSession.setActionHandler(i,o=>{switch(i){case"play":n.controls.Play();break;case"pause":n.controls.Pause();break;case"stop":n.controls.Stop();break;case"seekbackward":n.controls.Seek({relativeSeconds:o&&o.seekOffset||-10});break;case"seekforward":n.controls.Seek({relativeSeconds:o&&o.seekOffset||10});break;case"seekto":o&&typeof o.seekTime<"u"&&n.controls.Seek({time:o.seekTime});break;case"previoustrack":n.controls.CollectionPlayPrevious();break;case"nexttrack":n.controls.CollectionPlayNext();break}})});let t=setInterval(()=>{navigator.mediaSession.playbackState=n.video.paused?"paused":"playing",navigator.mediaSession.setPositionState({duration:isFinite(n.video.duration)?n.video.duration||0:n.video.currentTime+1,playbackRate:n.video.playbackRate,position:n.video.currentTime})},1e3);const r=n.controls.RegisterSettingsListener(()=>{const{title:i}=n.controls.GetContentInfo()||{};(!navigator.mediaSession.metadata||navigator.mediaSession.metadata.title!==i)&&(navigator.mediaSession.metadata=new MediaMetadata({title:i}))});return()=>{clearInterval(t),r&&r(),navigator.mediaSession.metadata=null,e.forEach(i=>{navigator.mediaSession.setActionHandler(i,null)})}}},Wbe="_container_iwa6d_1",Kbe="_autohide_iwa6d_40",Ybe="_seek_iwa6d_157",Jbe="_controls_iwa6d_190",Qbe="_time_iwa6d_204",Zbe="_spacer_iwa6d_253",Xbe="_watermark_iwa6d_265",eve="_menu_iwa6d_36",ir={container:Wbe,"container--default-controls":"_container--default-controls_iwa6d_32","bottom-controls-container":"_bottom-controls-container_iwa6d_36",autohide:Kbe,"info-container":"_info-container_iwa6d_40","bottom-controls-container--autohide":"_bottom-controls-container--autohide_iwa6d_41","icon-button":"_icon-button_iwa6d_47","icon-button-active":"_icon-button-active_iwa6d_61","info-image-container":"_info-image-container_iwa6d_90","info-image":"_info-image_iwa6d_90","info-text":"_info-text_iwa6d_106","info-headers":"_info-headers_iwa6d_115","info-description":"_info-description_iwa6d_125","info-title":"_info-title_iwa6d_131","info-subtitle":"_info-subtitle_iwa6d_136","center-play-button":"_center-play-button_iwa6d_144","center-play-button--hidden":"_center-play-button--hidden_iwa6d_150",seek:Ybe,"bottom-controls-gradient":"_bottom-controls-gradient_iwa6d_177",controls:Jbe,"play-pause-button":"_play-pause-button_iwa6d_200",time:Qbe,"live-indicator":"_live-indicator_iwa6d_213","collection-button-container":"_collection-button-container_iwa6d_223","collection-button-text":"_collection-button-text_iwa6d_228","collection-button-container--loading":"_collection-button-container--loading_iwa6d_237",spacer:Zbe,"floating-volume-toggle":"_floating-volume-toggle_iwa6d_257",watermark:Xbe,"menu-control-container":"_menu-control-container_iwa6d_277",menu:eve},Gj='<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"> <circle cx="16" cy="16" r="16" fill="currentColor"/> <path d="M22 15.5L13.75 21.1292L13.75 9.87083L22 15.5Z" fill="black"/></svg>',Wj='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-play"><polygon points="5 3 19 12 5 21 5 3"></polygon></svg>',Kj='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve"><circle cx="16" cy="16" r="16" fill="currentColor"/><path d="M22.8,16l-11.6,7V9L22.8,16z" fill="black"/></svg>',tve='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pause"><rect x="6" y="4" width="4" height="16"></rect><rect x="14" y="4" width="4" height="16"></rect></svg>',Yj='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve"><circle cx="16" cy="16" r="16" fill="currentColor"/><g> <rect x="10.4" y="9" width="4.5" height="14.1" fill="black"/> <rect x="17.5" y="9" width="4.5" height="14.1" fill="black"/></g></svg>',nve='<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.46154 18.9985L5.84615 18.9942C6.03997 18.9942 6.22584 18.9172 6.36289 18.7801C6.49993 18.6431 6.57692 18.4572 6.57692 18.2634C6.57692 18.0696 6.49993 17.8837 6.36289 17.7467C6.22584 17.6096 6.03997 17.5326 5.84615 17.5326L1.46154 17.537V13.1538C1.46154 12.96 1.38455 12.7742 1.2475 12.6371C1.11046 12.5001 0.924581 12.4231 0.730769 12.4231C0.536957 12.4231 0.351083 12.5001 0.214037 12.6371C0.0769915 12.7742 0 12.96 0 13.1538V19H1.46154V18.9985ZM1.46154 0.00146249V3.57628e-07H0V5.84615C0 6.03997 0.0769915 6.22584 0.214037 6.36289C0.351083 6.49993 0.536957 6.57692 0.730769 6.57692C0.924581 6.57692 1.11046 6.49993 1.2475 6.36289C1.38455 6.22584 1.46154 6.03997 1.46154 5.84615V1.463L5.84615 1.46738C6.03997 1.46738 6.22584 1.39039 6.36289 1.25335C6.49993 1.1163 6.57692 0.930427 6.57692 0.736615C6.57692 0.542803 6.49993 0.35693 6.36289 0.219884C6.22584 0.0828385 6.03997 0.00584609 5.84615 0.00584609L1.46154 0.00146249V0.00146249ZM17.5385 18.9985V19H19V13.1538C19 12.96 18.923 12.7742 18.786 12.6371C18.6489 12.5001 18.463 12.4231 18.2692 12.4231C18.0754 12.4231 17.8895 12.5001 17.7525 12.6371C17.6155 12.7742 17.5385 12.96 17.5385 13.1538V17.537L13.1538 17.5326C12.96 17.5326 12.7742 17.6096 12.6371 17.7467C12.5001 17.8837 12.4231 18.0696 12.4231 18.2634C12.4231 18.4572 12.5001 18.6431 12.6371 18.7801C12.7742 18.9172 12.96 18.9942 13.1538 18.9942L17.5385 18.9985V18.9985ZM17.5385 0.00146249L13.1538 0.00584609C12.96 0.00584609 12.7742 0.0828385 12.6371 0.219884C12.5001 0.35693 12.4231 0.542803 12.4231 0.736615C12.4231 0.930427 12.5001 1.1163 12.6371 1.25335C12.7742 1.39039 12.96 1.46738 13.1538 1.46738L17.5385 1.463V5.84615C17.5385 6.03997 17.6155 6.22584 17.7525 6.36289C17.8895 6.49993 18.0754 6.57692 18.2692 6.57692C18.463 6.57692 18.6489 6.49993 18.786 6.36289C18.923 6.22584 19 6.03997 19 5.84615V3.57628e-07H17.5385V0.00146249V0.00146249Z" fill="currentColor"/></svg>',rve='<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 51.94 50.82"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-miterlimit:10;stroke-width:4px;}</style></defs><polyline class="cls-1" points="12.1 49.82 12.1 35.59 1 35.59"/><polyline class="cls-1" points="39.84 1 39.84 15.22 50.94 15.22"/><polyline class="cls-1" points="12.1 1 12.1 15.22 1 15.22"/><polyline class="cls-1" points="39.84 49.82 39.84 35.59 50.94 35.59"/></svg>',ave='<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_363_9540)"><path d="M16.0889 9.77734C12.6223 9.77734 9.8667 12.5329 9.8667 15.9996C9.8667 19.4662 12.6223 22.2218 16.0889 22.2218C19.5556 22.2218 22.3111 19.4662 22.3111 15.9996C22.3111 12.5329 19.5556 9.77734 16.0889 9.77734ZM16.0889 20.444C13.6 20.444 11.6445 18.4885 11.6445 15.9996C11.6445 13.5107 13.6 11.5551 16.0889 11.5551C18.5778 11.5551 20.5334 13.5107 20.5334 15.9996C20.5334 18.4885 18.5778 20.444 16.0889 20.444Z" fill="currentColor"/><path d="M29.1556 13.0662L26.6667 12.2662L26.1334 10.9329L27.3778 8.62179C27.6445 8.08845 27.5556 7.37734 27.1112 6.9329L24.9778 4.79957C24.5334 4.35512 23.8223 4.26623 23.2889 4.5329L20.9778 5.77734L19.6445 5.24401L18.8445 2.75512C18.6667 2.22179 18.1334 1.77734 17.5112 1.77734H14.4889C13.8667 1.77734 13.3334 2.22179 13.2445 2.84401L12.4445 5.3329C11.9112 5.42179 11.4667 5.59957 11.0223 5.86623L8.71117 4.62179C8.17783 4.35512 7.46672 4.44401 7.02228 4.88845L4.88894 7.02179C4.4445 7.46623 4.35561 8.17734 4.62228 8.71068L5.77783 10.9329C5.60005 11.3773 5.42228 11.9107 5.2445 12.3551L2.75561 13.1551C2.22228 13.3329 1.77783 13.8662 1.77783 14.4885V17.5107C1.77783 18.1329 2.22228 18.6662 2.8445 18.844L5.33339 19.644L5.86672 20.9773L4.62228 23.2885C4.35561 23.8218 4.4445 24.5329 4.88894 24.9773L7.02228 27.1107C7.46672 27.5551 8.17783 27.644 8.71117 27.3773L11.0223 26.1329L12.3556 26.6662L13.1556 29.244C13.3334 29.7773 13.8667 30.2218 14.4889 30.2218H17.5112C18.1334 30.2218 18.6667 29.7773 18.8445 29.244L19.6445 26.6662L20.9778 26.1329L23.2889 27.3773C23.8223 27.644 24.5334 27.5551 24.9778 27.1107L27.1112 24.9773C27.5556 24.5329 27.6445 23.8218 27.3778 23.2885L26.1334 20.9773L26.6667 19.644L29.2445 18.844C29.7778 18.6662 30.2223 18.1329 30.2223 17.5107V14.4885C30.2223 13.8662 29.7778 13.244 29.1556 13.0662ZM28.4445 17.244L25.2445 18.2218L25.1556 18.6662L24.3556 20.5329L24.0889 20.9773L25.6889 23.9107L23.9112 25.6885L20.9778 24.0885L20.5334 24.3551C19.9112 24.7107 19.2889 24.9773 18.6667 25.1551L18.2223 25.244L17.2445 28.444H14.7556L13.7778 25.244L13.3334 25.1551L11.4667 24.3551L11.0223 24.0885L8.08894 25.6885L6.31117 23.9107L7.91117 20.9773L7.6445 20.5329C7.28894 19.9107 7.02228 19.2885 6.8445 18.6662L6.75561 18.2218L3.55561 17.244V14.7551L6.57783 13.8662L6.75561 13.4218C6.93339 12.7107 7.20005 12.0885 7.55561 11.4662L7.82228 11.0218L6.31117 8.08846L8.08894 6.31068L10.9334 7.91068L11.3778 7.64401C12.0001 7.28846 12.6223 7.02179 13.3334 6.84401L13.7778 6.66623L14.7556 3.55512H17.2445L18.2223 6.66623L18.6667 6.84401C19.2889 7.02179 19.9112 7.28846 20.5334 7.64401L20.9778 7.91068L23.9112 6.31068L25.6889 8.08846L24.0889 11.0218L24.3556 11.4662C24.7112 12.0885 24.9778 12.7107 25.1556 13.3329L25.2445 13.7773L28.4445 14.7551V17.244Z" fill="currentColor"/></g><defs><clipPath id="clip0_363_9540"><rect width="32" height="32" fill="currentColor"/></clipPath></defs></svg>',lk='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 13 12" style="enable-background:new 0 0 10.2 12;" xml:space="preserve"><path d="M5.3,1.4c0.1,0,0.1,0.1,0.2,0.2c0,0.1,0.1,0.2,0.1,0.2v7.4c0,0.1,0,0.2-0.1,0.2c0,0.1-0.1,0.1-0.2,0.2c-0.1,0-0.2,0.1-0.3,0 c-0.1,0-0.2,0-0.2-0.1L2.6,7.8H0.5c-0.1,0-0.2,0-0.3-0.1C0,7.6,0,7.5,0,7.4V3.7c0-0.1,0-0.2,0.1-0.3c0.1-0.1,0.2-0.1,0.3-0.1h2.1 l2.2-1.7C4.9,1.4,4.9,1.4,5,1.4C5.1,1.4,5.2,1.4,5.3,1.4L5.3,1.4z" fill="currentColor"/><g> <rect x="7.7" y="3.4" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -1.4992 7.4586)" width="1.2" height="4.2" fill="currentColor"/> <rect x="6.1" y="4.9" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -1.5119 7.4281)" width="4.2" height="1.2" fill="currentColor"/></g></svg>',Jj='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 13 12" style="enable-background:new 0 0 10.2 12;" xml:space="preserve"><path d="M7.1,8.5C7.5,8.1,7.8,7.6,8,7.1c0.2-0.5,0.3-1,0.3-1.6C8.3,5,8.2,4.5,8,4C7.8,3.4,7.5,3,7.1,2.6L6.5,3.3 c0.3,0.3,0.5,0.7,0.7,1c0.2,0.4,0.2,0.8,0.2,1.2c0,0.4-0.1,0.8-0.2,1.2C7,7.2,6.8,7.5,6.5,7.8L7.1,8.5z M5.3,1.4 c0.1,0,0.1,0.1,0.2,0.2c0,0.1,0.1,0.2,0.1,0.2v7.4c0,0.1,0,0.2-0.1,0.2c0,0.1-0.1,0.1-0.2,0.2c-0.1,0-0.2,0.1-0.3,0 c-0.1,0-0.2,0-0.2-0.1L2.6,7.8H0.5c-0.1,0-0.2,0-0.3-0.1C0,7.6,0,7.5,0,7.4V3.7c0-0.1,0-0.2,0.1-0.3c0.1-0.1,0.2-0.1,0.3-0.1h2.1 l2.2-1.7C4.9,1.4,4.9,1.4,5,1.4C5.1,1.4,5.2,1.4,5.3,1.4L5.3,1.4z" fill="currentColor"/></svg>',ive='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 13 12" style="enable-background:new 0 0 10.2 12;" xml:space="preserve"><path d="M8.4,9.8c0.6-0.6,1-1.2,1.3-1.9c0.3-0.7,0.5-1.5,0.5-2.3c0-0.8-0.2-1.6-0.5-2.3C9.4,2.5,9,1.9,8.4,1.3L7.8,2 c0.5,0.5,0.8,1,1.1,1.6c0.3,0.6,0.4,1.3,0.4,1.9c0,0.7-0.1,1.3-0.4,1.9C8.6,8.1,8.2,8.7,7.8,9.1L8.4,9.8z" fill="currentColor"/><path d="M7.1,8.5C7.5,8.1,7.8,7.6,8,7.1c0.2-0.5,0.3-1,0.3-1.6C8.3,5,8.2,4.5,8,4C7.8,3.4,7.5,3,7.1,2.6L6.5,3.3 c0.3,0.3,0.5,0.7,0.7,1c0.2,0.4,0.2,0.8,0.2,1.2c0,0.4-0.1,0.8-0.2,1.2C7,7.2,6.8,7.5,6.5,7.8L7.1,8.5z M5.3,1.4 c0.1,0,0.1,0.1,0.2,0.2c0,0.1,0.1,0.2,0.1,0.2v7.4c0,0.1,0,0.2-0.1,0.2c0,0.1-0.1,0.1-0.2,0.2c-0.1,0-0.2,0.1-0.3,0 c-0.1,0-0.2,0-0.2-0.1L2.6,7.8H0.5c-0.1,0-0.2,0-0.3-0.1C0,7.6,0,7.5,0,7.4V3.7c0-0.1,0-0.2,0.1-0.3c0.1-0.1,0.2-0.1,0.3-0.1h2.1 l2.2-1.7C4.9,1.4,4.9,1.4,5,1.4C5.1,1.4,5.2,1.4,5.3,1.4L5.3,1.4z" fill="currentColor"/></svg>',V2='<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.71196 11.08C10.4407 10.3533 11.0186 9.4898 11.4125 8.53906C11.8064 7.58832 12.0085 6.56911 12.0072 5.54C12.0085 4.51089 11.8064 3.49168 11.4125 2.54094C11.0186 1.5902 10.4407 0.726679 9.71196 0L9.05933 0.65171C9.7023 1.2929 10.2122 2.05484 10.5598 2.89374C10.9073 3.73264 11.0856 4.63196 11.0845 5.54C11.0845 7.44904 10.3102 9.17741 9.05933 10.4283L9.71196 11.08V11.08Z" fill="currentColor"/><path d="M8.40781 9.77644C8.96502 9.2207 9.40692 8.56034 9.70812 7.83329C10.0093 7.10624 10.1639 6.32683 10.1629 5.53986C10.1639 4.75289 10.0093 3.97349 9.70812 3.24644C9.40692 2.51939 8.96502 1.85902 8.40781 1.30328L7.7561 1.95499C8.22759 2.42525 8.60149 2.98403 8.85634 3.59924C9.11119 4.21445 9.24195 4.87396 9.24112 5.53986C9.2422 6.20586 9.11164 6.8655 8.85694 7.48087C8.60225 8.09625 8.22845 8.65522 7.75703 9.12565L8.40781 9.77644Z" fill="currentColor"/><path d="M7.10429 8.47307C7.49005 8.08831 7.79596 7.6311 8.00446 7.12773C8.21296 6.62436 8.31993 6.08475 8.31922 5.53991C8.31993 4.99507 8.21296 4.45546 8.00446 3.95209C7.79596 3.44872 7.49005 2.99152 7.10429 2.60675L6.45258 3.25846C6.75261 3.55774 6.99054 3.91337 7.15269 4.30489C7.31483 4.69642 7.39801 5.11614 7.39742 5.53991C7.39795 5.96368 7.31476 6.38338 7.15261 6.7749C6.99047 7.16642 6.75257 7.52205 6.45258 7.82136L7.10429 8.47307ZM5.26991 1.43791C5.348 1.47553 5.4139 1.53441 5.46004 1.60778C5.50618 1.68115 5.5307 1.76605 5.53078 1.85272V9.2271C5.53066 9.31383 5.50607 9.39876 5.45984 9.47214C5.4136 9.54551 5.34761 9.60436 5.26943 9.64191C5.19125 9.67945 5.10407 9.69418 5.01789 9.6844C4.93172 9.67462 4.85005 9.64072 4.78228 9.5866L2.60408 7.8444H0.460899C0.338661 7.8444 0.221429 7.79585 0.134994 7.70941C0.0485588 7.62298 0 7.50574 0 7.38351V3.69632C0 3.57408 0.0485588 3.45685 0.134994 3.37041C0.221429 3.28398 0.338661 3.23542 0.460899 3.23542H2.60408L4.78228 1.49322C4.8501 1.43901 4.93185 1.40506 5.01812 1.39527C5.1044 1.38549 5.19168 1.40027 5.26991 1.43791V1.43791Z" fill="currentColor"/></svg>',sve='<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1.5 8L24 8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M8.5 1L1.5 8L8.5 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',$I='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M62.8896 63.918L62.8897 28.2377L34.8552 46.0779L62.8896 63.918Z" fill="currentColor"/><path d="M45.3281 63.918L45.3281 28.2377L17.2937 46.0779L45.3281 63.918Z" fill="currentColor"/></svg>',ove='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="45.2374" cy="45.798" r="45.2374" fill="currentColor"/><path d="M62.8896 63.918L62.8897 28.2377L34.8552 46.0779L62.8896 63.918Z" fill="black"/><path d="M45.3281 63.918L45.3281 28.2377L17.2937 46.0779L45.3281 63.918Z" fill="black"/></svg>',HI='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M26.8555 28.9512V64.6314L54.8899 46.7913L26.8555 28.9512Z" fill="currentColor"/><path d="M44.417 28.9512V64.6314L72.4515 46.7913L44.417 28.9512Z" fill="currentColor"/></svg>',uve='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="45.7169" cy="45.796" r="45.2374" fill="currentColor"/><path d="M26.8555 28.9512V64.6314L54.8899 46.7913L26.8555 28.9512Z" fill="black"/><path d="M44.417 28.9512V64.6314L72.4515 46.7913L44.417 28.9512Z" fill="black"/></svg>',ck='<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 30.8 32" style="enable-background:new 0 0 30.8 32;" xml:space="preserve"><g> <path d="M3.1,16L30.8,0v32L3.1,16z" fill="currentColor"/> <rect y="3.7" width="6.2" height="24.6" fill="currentColor"/></g></svg>',fk='<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 30.8 32" style="enable-background:new 0 0 30.8 32;" xml:space="preserve"><g> <path d="M27.7,16L0,32V0L27.7,16z" fill="currentColor"/> <rect x="24.6" y="3.7" width="6.2" height="24.6" fill="currentColor"/></g></svg>',Qj='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>',mv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>',lve='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>',cve='<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-badge-cc" width="48" height="48" viewBox="0 0 24 24" stroke="black" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <rect x="3" y="5" width="18" height="14" rx="2" stroke="currentColor"></rect> <path d="M10 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path> <path d="M17 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path></svg>',fve='<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-badge-cc" width="48" height="48" viewBox="0 0 24 24" stroke="black" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <rect x="3" y="5" width="18" height="14" rx="2" stroke="currentColor"></rect> <path d="M10 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path> <path d="M17 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path> <path d="M3 3l18 18" stroke="currentColor"></path></svg>',dve='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rotate-cw"><polyline points="23 4 23 10 17 10"></polyline><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"></path></svg>';(function(n,e){(function(t,r){r()})(Va,function(){function t(i){var o=!0,u=!1,c=null,p={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function h(W){return!!(W&&W!==document&&W.nodeName!=="HTML"&&W.nodeName!=="BODY"&&"classList"in W&&"contains"in W.classList)}function g(W){var pe=W.type,ce=W.tagName;return!!(ce==="INPUT"&&p[pe]&&!W.readOnly||ce==="TEXTAREA"&&!W.readOnly||W.isContentEditable)}function m(W){W.classList.contains("focus-visible")||(W.classList.add("focus-visible"),W.setAttribute("data-focus-visible-added",""))}function w(W){W.hasAttribute("data-focus-visible-added")&&(W.classList.remove("focus-visible"),W.removeAttribute("data-focus-visible-added"))}function v(W){W.metaKey||W.altKey||W.ctrlKey||(h(i.activeElement)&&m(i.activeElement),o=!0)}function C(W){o=!1}function T(W){h(W.target)&&(o||g(W.target))&&m(W.target)}function R(W){h(W.target)&&(W.target.classList.contains("focus-visible")||W.target.hasAttribute("data-focus-visible-added"))&&(u=!0,window.clearTimeout(c),c=window.setTimeout(function(){u=!1},100),w(W.target))}function O(W){document.visibilityState==="hidden"&&(u&&(o=!0),I())}function I(){document.addEventListener("mousemove",K),document.addEventListener("mousedown",K),document.addEventListener("mouseup",K),document.addEventListener("pointermove",K),document.addEventListener("pointerdown",K),document.addEventListener("pointerup",K),document.addEventListener("touchmove",K),document.addEventListener("touchstart",K),document.addEventListener("touchend",K)}function D(){document.removeEventListener("mousemove",K),document.removeEventListener("mousedown",K),document.removeEventListener("mouseup",K),document.removeEventListener("pointermove",K),document.removeEventListener("pointerdown",K),document.removeEventListener("pointerup",K),document.removeEventListener("touchmove",K),document.removeEventListener("touchstart",K),document.removeEventListener("touchend",K)}function K(W){W.target.nodeName&&W.target.nodeName.toLowerCase()==="html"||(o=!1,D())}document.addEventListener("keydown",v,!0),document.addEventListener("mousedown",C,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("touchstart",C,!0),document.addEventListener("visibilitychange",O,!0),I(),i.addEventListener("focus",T,!0),i.addEventListener("blur",R,!0),i.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&i.host?i.host.setAttribute("data-js-focus-visible",""):i.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window<"u"&&typeof document<"u"){window.applyFocusVisiblePolyfill=t;var r;try{r=new CustomEvent("focus-visible-polyfill-ready")}catch{r=document.createEvent("CustomEvent"),r.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(r)}typeof document<"u"&&t(document)})})();const Zj="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAW0AAABSCAYAAACfWoXuAAAACXBIWXMAAC4jAAAuIwF4pT92AAAMX0lEQVR4nO2d/XEbtxbF4Tf+N5ptIEO6gYipQHQDz3QDT0wDkfIKiKUGYvk1IKqBJzoNmKwgZBoINWmApgtQBtJdaSUtDrDLXewCOL8ZjsciRe0H9uDifuC+ur29VYQQQsLgNe8TISRBhkqpUeGVKaWOHC7DV6XUSim1lX8Xhf97Ibe0x5Hds/yC2jCd90ZeoZEPvjIWAZ6PqnFOQ3mVEep9LQM9s77vdSb3qQyvgmZhItdN/zto+LvXct1njtpTm1y0Y/ORLB0nItN5nyulzho+Jh8sgLXwKsDzUTXOST+Q14bPr4G4hISelP4yHO9nuQY+0c/aF8Pfe9uxwaCv1VReTQu1iRul1IUIeOMT1r+a/kJCOmYuD00Zh8AKD4kpONY5B+AdQxFNPbl98CjYSv7WRxmHZ2ClWAuKNokRJFynEZyvSbR3IlQpk4mVq8X6uOPrcCATxk2TK3eKNomRC3BOvl0HTTMCVqPJLZQKExHIk4bOdymvfcnFe9WEe47ZIyRGNuK/Piw5t4H4YEMNzKKVQqpWdibn/q7G7y4LGSAbhyDiuBB4HTtmnOTo8fjHvjEzm2h/bTsS2hIhHjNpFm1tXxq+cRqwaL83/Pwm4HPah5EIdtkEbeJKXGh1/P/5Nc5/NxMLf1Jh0vhQyGKpHKi0ifYqwnRAkgZzINrvLcG8vjKRpXYZKVrZI7GUTdekyE6CgxcNZ3Rs5drPJPh55uhLP5IJYFrVyKRPm8TKViyqMg4CFW10zKmJ9lRcDS6CfS5usbOWc8Y3clxvJPXSxqFMOpX83BRtEjNo+RtaQDIDy+9lREVDLkzBKqqIjmv86EGsn7OR8aVz1P+2fPagqnBTtEnMzGVZXMa7pvNnWwZNMilZ2Vrc/ufwuXP5bJfxLe3++MHB6tbC/bvreKRok9hBFllILhJT1sguoYIa7TPWVul34DM7iVn0paJ5KxPuueVz37sGkinaJHaQFRqKaA9BdsR1j/b2aBs9OSEf9k4CfH2cxPQk8pPlM4eWGoM7KNokdlbi2ywjlLJ25mbfix5K68sFu8/pvjMH4T6xxVso2iQFQre2TQ9xKrnZI8ltNvEtAMHOcRHuK+TfpmiTFAhZtMegbD0VK9t2nj8HVlA3A+moSlxARp88RZukwBZE8Ac936419dzsU4tb5FOg12EK3HZK3CSl45KiTVIBPdh93vnPVLaeQm52Zsm6WAe6733ORFw7JkqDkhRtkgooZ9skjF0zTbxs/dSSLXIaeOaMnnR/Be8flW0jQtEmKWHK2T7oaYWk6ZhSyc3+Bbx3FUkQ9gI07VBlKwmKNkmJkAKSqGw9hdxstMr4Frhb5Dlo7B09T0ulaJOUWAGrpm9l7QxAmvktMn/+wtJs4cm1oGiT1Ailq41JtFPIzUYVoCrSSQuNyyd53RRtkhoh9I9EopWClY0mz6tIs2ZQQ+onMReKNkmNDcjZ7ktZe+pl66l2m0f3lqJNkgY9+H0ISJoszRRys9EqQ1uiqYr2Q+ofRZukyAzkbHct2qmXraP2hrH78jegSnKQrwIp2iRVrg3n3XVZu2nSSCU3G4l2CuePJqa7FRhFm6QKitZ3ZW1noDozlX2z0YSZwo6GaGK6uzYUbZIqKGfbtnVmW7DbutmfvU5k0kITE0WbJI/J2u6qrD31fbNT9mcXQU07KNokafrUrX0IytZTsbKRaySk/bL3BZ3rmKJNUmYDyoePPZe1s9s6vt6xpzoWQeeaUbRJ6jgVNHjAFPxMITc7h5b2PdCv/dryy5nFz9Q3UvJ7kWaYS/eTsgDg1JOVO0q8bD0HWdqpdJy3YhNtPZC+9OA4XXkVxmGSHrGVdLrjkkPKt8Vs29JNPTc7xyTaqC1XjCDjc0j3CCHdu0hMfyOV3Owc02qDVvYjFG1CxLIx5Wy3vfPfhN3WSRUo2oTcYxLItsvaU8/NJhWhaBNyTxetyFDZOq1sUgpFm5B7UM52W2XtLFsnlbGJ9lIyMkJ5EbIPJqFsq6w95X2zSU1oaRPyyFw6fZfRtGizbJ3UgqJNyCM6tez/huvxvuGydjQJpJSbXcTknupTl3wfoPNdUbQJeYpJMJt2kZhSCa+Yl/wC1Jk9RlC20paiTchTUFfspkR7BHKzU7WylW2jJI/H0TXwXCnahLzEJJzvGurWbkohjL1xrQ0k2l22gPMN7N5D0SbkJagVWRPWtimFMGXBVhTtB+geIaQiqCv2voU2KDcbTRYpQNG+B25RS9GOCwawmsMkoId7CojJUl8zN9veHzEBMhDvuMuuoWjHRUobxX9t+fuRq6KutZ0ZtoBVtLIfQP0Rm4gn9B3Uv+Du+aZop0NsA77tCWor6Xdl1PVrMzfbDrK2Q2rIUhc0RijaiRGqaB91+LdNQjqoKdwmC5252Y8g0e6iQ75vrB3pKdokVHz4f7Vo/214r6qADMEERCv7ESTaOuUy5nxtlL//EPOgaMdFbEtLdMy+gnZNlbWjfbMp2o/oFcdn8H7M1jZquPHwbFO00yFE9wg6Zl9B16Z2/jM9kBTslyDjo629zbsG7a2uiuOQoh0XsVnaSLR9WdorkNHgKtpo2cuskZegXQ6PIg1ITkH+/k3RSKFox4dp34xBgNa2Nf3JEyYRcfWxmqxD5maXY3ORxGhtI9fIk4mdoh0fSMxCs1BMgTuT5dsW+7YiM5Wt08o2g67NcWTW9ilYiann44+iHR+xpEyhY/Xd8BZZfjbRRmXr9GebQR3yNWddH2BD6JXaOfiqF+mgFO34QEIQUspUn0RbAWvbVqnH3Oz6IGE+srgUQuECTOqq7BpQtONjY7FQQvAH2iLpXYi2ngx3hvdM4pGBlmK0su3MLGP5PPBK3wnY1kDJxP4i5kHRjhPkgw3BOkEuhc8dWqiXhp+bVgXMzd4fZGQcBHwdM7BNghIDofRZpWjHCRLtQQDWNloWd/mQmq7rwBAYY272/iwsmSSHgTZCXljcIh9NxglFO042oEmq6nkQ5wxE0ncdP6AoZ/v5RDgEvQ2ZNVKNU+CaUuJiCCkNcGbpe7lGzyhFO16QMA96Ktxa6P4L3v/o8VhMmCaN5z545mY3x8bi+1XiugpBuGeWc/lmOw+KdrwsLNb2hx7mumq3wXeG93Y9sVBRt/biw2Z68Ghl12Nu8QGrAITbJtian22FYxTtuLFZ05971BHEtmQ86UmK3Ab4WPPAY1+6rWcyBvQEfitiMAs440K7SWyFVZc99HFncg9sgn3lcuwU7bixWdsH8n7Xwm2zQJY9exBRt/YMBCB95mbre/qnrKjyytJDuc5/BVoKrq/dGGyXm3MsE1QfJqex3AfbvvBL13tC0Y6fqSWIkwt3F9WSmTxcSLB3PRSYGbimU5Bj7svKzuRvfQ8+cxloKbgW7n9bxrSSCWrdYYprJq6wL5b7oOQ4nZ8/inb8uARxtHBfyyDzVTE5lXxl5BJR4hbpY+Du2vDzj4ZULp+52VPLXhY5ofrXV2K52oT7QO7HyvMENRXr+sThs2s5NucVGEU7DbRY/OJwpiciLtMWxXsibptLS56qkoq3vubgVhU8n75sV6st5Ga5K5mYXDYPOxSLd9Hiqi2T797I2LZZ10rcZZUEW/Pq9lbHJ+6CFLHx1qHcOYbzdjnPHJfodc6uENTZdxvUkQzoiaMFqPkUQPXmpsL5vPG4YlhU6K1ZZfyYGIsotvX9iNwN4TquVWFsz/c8tkzOfSIuMZsRUuS8btrt6zq/RIJlWrBybRyI5X0ig/wP+d2Ng/iMC//+WHEwK9nKNIQqtwvH3PE+52aHvmnVVsb1SoTQZawVx7aSmM5Kvssm4mNZnYwcXHtl7CRgXXuyoKUdPnUsmbGkrVUV07bRWQH/6WhDqDoMJRPDhu9J6MLRn3rTkHukS0u7yFCuc5cd/BGfxLrea6KkTztNFrKstxUr+EQP6B8CEmxlydku4nuvkQuHIJ2KsNBnIxPIe8vugL5ZyuR12sTKhqKdLvmy8q0ll7ttluLvbWRAd4BNkLvYN3vjYGlfRVydORer+6cOuhwVycV63KQxQtEmi4Lv+crRQtuXnfytN/K3Q96LA+Vsqw539JvJPX2+ErgRMYu1q3mRmfie33oe25/k2jcq1jm5T5uQnEyi4WN5uWZH2FjLAF5wa9JOGHluhtxXimO7TiCxjHVhXLfu3qNoExtDeY1F0F1K3vMMk60IxYqttUhP0eNaj+l8bNvqE/Kxnb/8xmCUUv8APsi0l8VaI5gAAAAASUVORK5CYII=",pve="_spinner_18usq_1",hve="_spin_18usq_1",yve="_svg_18usq_16",mve="_menu_18usq_276",gve="_fadein_18usq_1",bve="_fadeout_18usq_1",kn={spinner:pve,spin:hve,"spinner--light":"_spinner--light_18usq_12",svg:yve,"user-action-indicator-container":"_user-action-indicator-container_18usq_23","action-indicator-fade-out":"_action-indicator-fade-out_18usq_1","user-action-indicator-text":"_user-action-indicator-text_18usq_40","user-action-indicator":"_user-action-indicator_18usq_23","action-indicator-icon-scale":"_action-indicator-icon-scale_18usq_1","user-action-indicator-icon":"_user-action-indicator-icon_18usq_60","seek-container":"_seek-container_18usq_69","seek-playhead":"_seek-playhead_18usq_92","seek-buffer":"_seek-buffer_18usq_93","seek-input":"_seek-input_18usq_94","volume-controls":"_volume-controls_18usq_201","volume-slider":"_volume-slider_18usq_208","volume-input":"_volume-input_18usq_224","volume-progress":"_volume-progress_18usq_225",menu:mve,fadein:gve,"menu-option":"_menu-option_18usq_296","menu-option-back":"_menu-option-back_18usq_313","menu-option-back-icon":"_menu-option-back-icon_18usq_317","focus-visible":"_focus-visible_18usq_327","menu-option-active":"_menu-option-active_18usq_332","menu-option-icon":"_menu-option-icon_18usq_336","menu-header":"_menu-header_18usq_346",fadeout:bve},G2=({light:n,className:e=""})=>$e.jsx("div",{className:`${e} ${kn.spinner} ${n?kn["spinner--light"]:""}`,children:$e.jsx("div",{className:kn["spinner-inner"]})}),Bd=({icon:n,className:e=""})=>$e.jsx("div",{className:`${kn.svg} ${e}`,dangerouslySetInnerHTML:{__html:n}}),qI={[Fn.PLAY]:Wj,[Fn.PAUSE]:tve,[Fn.MUTE]:lk,[Fn.UNMUTE]:V2,[Fn.VOLUME_DOWN]:Jj,[Fn.VOLUME_UP]:V2,[Fn.SEEK_BACK]:$I,[Fn.SEEK_FORWARD]:HI,[Fn.PLAYBACK_RATE_DOWN]:$I,[Fn.PLAYBACK_RATE_UP]:HI,[Fn.SUBTITLES_ON]:cve,[Fn.SUBTITLES_OFF]:fve,[Fn.PLAY_PREVIOUS]:ck,[Fn.PLAY_NEXT]:fk},vve=({action:n})=>{if(!(!n||!qI[n.action]))return $e.jsxs("div",{className:kn["user-action-indicator-container"],children:[$e.jsx("div",{className:kn["user-action-indicator"],children:$e.jsx(Bd,{icon:qI[n.action],"aria-label":`Action indicator ${n}`,className:kn["user-action-indicator-icon"]})}),n.text?$e.jsx("div",{className:kn["user-action-indicator-text"],children:n.text}):null]})},Xj=({player:n,videoState:e,setRecentUserAction:t,className:r=""})=>{const[i,o]=zt.useState(n.video.currentTime),[u,c]=zt.useState(0),[p,h]=zt.useState(void 0);return zt.useEffect(()=>{h(Uj(n,t));const g=uk({video:n.video,setCurrentTime:o,rate:60}),m=jbe({video:n.video,setBufferFraction:c});return()=>{g&&g(),m&&m()}},[]),n.isLive?null:$e.jsxs("div",{className:`${r} ${kn["seek-container"]} ${r}`,children:[$e.jsx("progress",{max:1,value:u,className:kn["seek-buffer"]}),$e.jsx("progress",{max:1,value:i/e.duration||0,className:kn["seek-playhead"]}),$e.jsx("input",{"aria-label":"Seek slider",type:"range",min:0,max:1,step:1e-5,value:i/e.duration||0,onInput:g=>n.controls.Seek({fraction:g.currentTarget.value}),onKeyDown:p,className:kn["seek-input"]})]})},wve=({player:n,videoState:e})=>$e.jsxs("div",{className:kn["volume-controls"],children:[$e.jsx(gf,{"aria-label":e.muted?"Unmute":"Mute",icon:e.muted||e.volume===0?lk:e.volume<.4?Jj:e.volume<.8?ive:V2,onClick:()=>n.controls.ToggleMuted(),className:kn["volume-button"]},"mute-button"),$e.jsxs("div",{className:kn["volume-slider"],children:[$e.jsx("progress",{max:1,value:e.muted?0:e.volume,className:kn["volume-progress"]}),$e.jsx("input",{"aria-label":"Volume slider",type:"range",min:0,max:1,step:.001,value:e.muted?0:e.volume,onInput:t=>n.controls.SetVolume({fraction:t.currentTarget.value}),onKeyDown:xbe(n),className:kn["volume-input"]})]})]}),e$=({player:n,Hide:e,className:t=""})=>{const[r,i]=zt.useState(void 0),[o,u]=zt.useState(void 0),c=zt.createRef();if(zt.useEffect(()=>{const m=()=>u(n.controls.GetOptions());m();const w=n.controls.RegisterSettingsListener(m);return()=>w&&w()},[]),zt.useEffect(()=>{if(!c||!c.current)return;const m=ok({element:c.current.parentElement,Hide:e});return()=>{m&&m()}},[c]),!o)return null;const p=m=>setTimeout(()=>i(m)),h={quality:{label:"Quality",Update:m=>n.controls.SetQualityLevel(m)},audio:{label:"Audio",Update:m=>n.controls.SetAudioTrack(m)},text:{label:"Subtitles",Update:m=>n.controls.SetTextTrack(m)},profile:{label:"Player Profile",Update:m=>{m==="custom"?(n.controls.ShowPlayerProfileForm(),e()):n.controls.SetPlayerProfile({profile:m})}},rate:{label:"Playback Rate",Update:m=>n.controls.SetPlaybackRate({index:m})}};let g;return r?g=$e.jsxs("div",{role:"menu",className:`${kn.menu} ${kn.submenu} ${kn["settings-menu"]} ${t}`,children:[$e.jsxs("button",{onClick:()=>p(void 0),"aria-label":"Back to settings menu",className:`${kn["menu-option"]} ${kn["menu-option-back"]}`,children:[$e.jsx("div",{dangerouslySetInnerHTML:{__html:sve},className:kn["menu-option-back-icon"]}),$e.jsx("div",{children:h[r].label})]}),o[r].options.map(m=>$e.jsxs("button",{role:"menuitemradio","aria-checked":m.active,autoFocus:m.active,"aria-label":`${h[r].label}: ${m.label||""}`,onClick:()=>{h[r].Update(m.index),p(void 0)},className:`${kn["menu-option"]} ${m.active?kn["menu-option-active"]:""}`,children:[m.label||"",m.active?$e.jsx(Bd,{icon:lve,className:kn["menu-option-icon"]}):null]},`option-${m.index}`))]},"submenu"):g=$e.jsxs("div",{role:"menu",className:`${kn.menu} ${kn["settings-menu"]} ${t}`,children:[!o.hasQualityOptions<=1?null:$e.jsxs("button",{autoFocus:!0,role:"menuitem",onClick:()=>p("quality"),className:kn["menu-option"],children:[`${h.quality.label}: ${o.quality.active&&o.quality.active.activeLabel||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}),o.hasAudioOptions?$e.jsxs("button",{autoFocus:!o.hasQualityOptions,role:"menuitem",onClick:()=>p("audio"),className:kn["menu-option"],children:[`${h.audio.label}: ${o.audio.active&&o.audio.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null,o.hasTextOptions?$e.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions,role:"menuitem",onClick:()=>p("text"),className:kn["menu-option"],children:[`${h.text.label}: ${o.text.active&&o.text.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null,o.hasProfileOptons?$e.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions,role:"menuitem",onClick:()=>p("profile"),className:kn["menu-option"],children:[`${h.profile.label}: ${o.profile.active&&o.profile.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null,o.hasRateOptions?$e.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions&&!o.hasProfileOptons,role:"menuitem",onClick:()=>p("rate"),className:kn["menu-option"],children:[`${h.rate.label}: ${o.rate.active&&o.rate.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null]},"menu"),$e.jsx("div",{ref:c,className:`${kn["menu-container"]}`,children:g})},t$=({player:n,Hide:e,className:t=""})=>{const r=zt.createRef(),[i,o]=zt.useState(void 0);if(zt.useEffect(()=>{const c=()=>o(n.controls.GetCollectionInfo());c();const p=n.controls.RegisterSettingsListener(c);return()=>p&&p()},[]),zt.useEffect(()=>{if(!r||!r.current)return;const c=ok({element:r.current.parentElement,Hide:e});return()=>c&&c()},[r]),!i)return null;const u=c=>{n.controls.CollectionPlay({mediaIndex:c}),e()};return $e.jsxs("div",{role:"menu",className:`${kn.menu} ${kn["collection-menu"]} ${t}`,ref:r,children:[$e.jsx("div",{className:`${kn["menu-option"]} ${kn["menu-header"]}`,children:i.title}),i.content.map(c=>$e.jsx("button",{"aria-label":`${c.title||c.mediaId} ${c.active?"(active)":""}`,role:"menuitemradio","aria-checked":c.active,autoFocus:c.active,onClick:()=>u(c.mediaIndex),className:`${kn["menu-option"]} ${c.active?kn["menu-option-active"]:""}`,children:c.title||c.mediaId},`collection-item-${c.mediaId}`))]},"menu")},gf=({icon:n,...e})=>$e.jsx("button",{...e,className:`${ir["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),xve=({player:n,videoState:e})=>{const[t,r]=zt.useState(n.video.currentTime);return zt.useEffect(()=>{const i=uk({video:n.video,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive?$e.jsx("div",{className:ir["live-indicator"],children:"Live"}):$e.jsxs("div",{className:ir.time,children:[j2(t,e.duration)," / ",j2(e.duration,e.duration)]})},_ve=({player:n})=>{const e=n.controls.GetCollectionInfo();if(!e||e.mediaLength===0||!e.isPlaylist)return null;const t=e.content[e.mediaIndex-1],r=e.content[e.mediaIndex+1],i=n.controls.IsReady();return $e.jsxs($e.Fragment,{children:[t?$e.jsxs("div",{className:`${ir["collection-button-container"]} ${i?"":ir["collection-button-container--loading"]}`,children:[$e.jsx(gf,{"aria-label":`Play Previous: ${t.title}`,disabled:!i,icon:ck,onClick:()=>n.controls.CollectionPlayPrevious()}),$e.jsx("div",{className:ir["collection-button-text"],children:t.title})]},`media-previous-${e.mediaIndex}`):null,r?$e.jsxs("div",{className:`${ir["collection-button-container"]} ${i?"":ir["collection-button-container--loading"]}`,children:[$e.jsx(gf,{"aria-label":`Play Next: ${r.title}`,disabled:!i,icon:fk,onClick:()=>n.controls.CollectionPlayNext()}),$e.jsx("div",{className:ir["collection-button-text"],children:r.title})]},`media-next-${e.mediaIndex}`):null]})},VI=({label:n,icon:e,player:t,setMenuActive:r,MenuComponent:i})=>{const[o,u]=zt.useState(!1);return $e.jsxs("div",{className:ir["menu-control-container"],children:[$e.jsx(gf,{"aria-label":o?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{r(!o),u(!o)},className:o?ir["icon-button-active"]:""}),o?$e.jsx(i,{player:t,Hide:()=>{u(!1),r(!1)}}):null]})},Sve=({player:n})=>{const[e,t]=zt.useState(void 0),{title:r,subtitle:i,description:o,image:u,headers:c}=n.controls.GetContentInfo()||{};return zt.useEffect(()=>{t(void 0),u&&sk({player:n,pathOrUrl:u,width:200}).then(p=>t(p))},[u]),!r||n.playerOptions.title===fn.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()||n.playerOptions.title===fn.title.OFF?null:$e.jsxs("div",{className:ir["info-container"],children:[e?$e.jsx("div",{className:ir["info-image-container"],children:$e.jsx("img",{src:e,alt:"Image",className:ir["info-image"]})}):null,$e.jsxs("div",{className:ir["info-text"],children:[c.length===0?null:$e.jsx("div",{className:ir["info-headers"],children:c.map((p,h)=>$e.jsx("div",{className:ir["info-header"],children:p},`header-${h}`))}),r?$e.jsx("div",{className:ir["info-title"],children:r}):null,i?$e.jsx("div",{className:ir["info-subtitle"],children:i}):null,o?$e.jsx("div",{className:ir["info-description"],children:o}):null]})]})},Eve=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[u,c]=zt.useState(void 0),[p,h]=zt.useState(void 0),[g,m]=zt.useState(0);if(zt.useEffect(()=>{h(Dj({player:n,setRecentUserAction:i}));const O=Vj({target:n.target,video:n.video,setVideoState:c});return()=>O&&O()},[]),!u)return null;const w=n.controls.GetCollectionInfo(),v=g>0,C=O=>m(O?g+1:Math.max(0,g-1)),T=r||!e||v,R=!T&&n.playerOptions.controls===fn.controls.AUTO_HIDE;return n.__SetControlsVisibility(!R),$e.jsxs("div",{onClick:p,className:[o,ir.container,T?"":ir.autohide,n.playerOptions.controls!==fn.controls.DEFAULT?"":ir["container--default-controls"],v?"menu-active":""].join(" "),children:[$e.jsx(Sve,{player:n},`content-info-${w&&w.mediaIndex}`),[fn.controls.DEFAULT,fn.controls.OFF,fn.controls.OFF_WITH_VOLUME_TOGGLE].includes(n.playerOptions.controls)?null:$e.jsxs($e.Fragment,{children:[$e.jsx(gf,{"aria-label":"Play",tabIndex:e?-1:0,icon:Gj,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${ir["center-play-button"]} ${t&&!e?"":ir["center-play-button--hidden"]}`}),$e.jsxs("div",{className:`${ir["bottom-controls-container"]} ${R?ir["bottom-controls-container--autohide"]:""}`,children:[$e.jsx("div",{className:ir["bottom-controls-gradient"]}),$e.jsx(Xj,{player:n,videoState:u,setRecentUserAction:i,className:ir.seek}),$e.jsxs("div",{className:ir.controls,children:[$e.jsx(gf,{"aria-label":u.playing?"Pause":"Play",icon:u.playing?Yj:Kj,onClick:()=>n.controls.TogglePlay(),className:ir["play-pause-button"]}),$e.jsx(_ve,{player:n}),$e.jsx(wve,{player:n,videoState:u}),$e.jsx(xve,{player:n,videoState:u}),$e.jsx("div",{className:ir.spacer}),w?$e.jsx(VI,{label:"Collection Menu",icon:Qj,player:n,setMenuActive:C,MenuComponent:t$}):null,n.controls.IsRotatable()?$e.jsx(gf,{"aria-label":"Rotate Video",icon:dve,onClick:()=>n.controls.SetAllowRotation(!n.controls.AllowRotation())}):null,n.controls.GetOptions().hasAnyOptions?$e.jsx(VI,{label:"Settings Menu",icon:ave,player:n,setMenuActive:C,MenuComponent:e$}):null,$e.jsx(gf,{"aria-label":u.fullscreen?"Exit Fullscreen":"Fullscreen",icon:u.fullscreen?rve:nve,onClick:()=>n.controls.ToggleFullscreen()})]})]})]}),n.playerOptions.controls!==fn.controls.OFF_WITH_VOLUME_TOGGLE?null:$e.jsx("div",{className:ir["floating-volume-toggle"],children:$e.jsx(gf,{"aria-label":u.muted?"Unmute":"Mute",icon:u.muted||u.volume===0?lk:V2,onClick:()=>n.controls.ToggleMuted(),className:ir["volume-button"]},"mute-button")}),n.playerOptions.watermark===fn.watermark.OFF?null:$e.jsx("div",{className:ir.watermark,children:$e.jsx("img",{src:Zj,alt:"Eluvio"})})]})},Cve="_spinner_1c6ar_17",Ave="_text_1c6ar_33",Mve="_title_1c6ar_39",kve="_description_1c6ar_43",Tve="_inputs_1c6ar_47",Rve="_input_1c6ar_47",Ove="_submit_1c6ar_77",Li={"ticket-form-container":"_ticket-form-container_1c6ar_1","ticket-form-overlay":"_ticket-form-overlay_1c6ar_8",spinner:Cve,"ticket-form":"_ticket-form_1c6ar_1",text:Ave,title:Mve,description:kve,inputs:Tve,input:Rve,submit:Ove,"error-message":"_error-message_1c6ar_88","size-md":"_size-md_1c6ar_102","size-sm":"_size-sm_1c6ar_103"},Lve=({parameters:n,dimensions:e,onComplete:t})=>{let{tenantId:r,ntpId:i,ticketCode:o,ticketSubject:u}=n.clientOptions||{};const c=!r||!i,[p,h]=zt.useState(o||""),[g,m]=zt.useState(!!o),[w,v]=zt.useState(!1),[C,T]=zt.useState(c?"Error: Tenant ID or NTP ID not specified":""),[R,O]=zt.useState(void 0),I=async({client:D,code:K})=>{if(!(!K||!D)){T(""),v(!0);try{let W=u;K.includes(":")&&(W=K.split(":")[0],K=K.split(":")[1]),await D.RedeemCode({tenantId:r,ntpId:i,code:K.trim(),email:W}),t(D)}catch(W){console.log(W),T("Invalid Code"),m(!1)}finally{v(!1)}}};return zt.useEffect(()=>{Promise.resolve().then(()=>Ij).then(async({ElvClient:D})=>{const K=await D.FromConfigurationUrl({configUrl:n.clientOptions.network});O(K),o&&I({client:K,code:o})})},[]),g?$e.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[Li["ticket-form-container"],Li[`size-${e.size}`],Li[`orientation-${e.orientation}`]].join(" "),children:$e.jsx("div",{className:Li["ticket-form-overlay"],children:$e.jsx(G2,{className:Li.spinner})})}):$e.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[Li["ticket-form-container"],Li[`size-${e.size}`],Li[`orientation-${e.orientation}`]].join(" "),children:$e.jsx("div",{className:Li["ticket-form-overlay"],children:$e.jsxs("form",{onSubmit:D=>{D.preventDefault(),I({client:R,code:p})},className:Li["ticket-form"],children:[$e.jsxs("div",{className:Li.text,children:[$e.jsx("h2",{className:Li.title,children:n.clientOptions.ticketTitle||"This content requires a code to view"}),$e.jsx("p",{className:Li.description,children:n.clientOptions.ticketDescription||"Please enter your code below"})]}),$e.jsxs("div",{className:Li.inputs,children:[$e.jsx("input",{disabled:c,autoFocus:!0,type:"text",placeholder:"Ticket Code",value:p,"aria-label":"Ticket Code","aria-invalid":!!C&&!c,"aria-errormessage":C,onKeyDown:D=>D.key==="Enter"&&I({client:R,code:p}),onChange:D=>{T(""),h(D.target.value)},className:Li.input}),$e.jsx("button",{type:"submit","aria-label":"Submit Code",disabled:!p||!R||c,className:Li.submit,children:w?$e.jsx(G2,{light:!0}):"Submit"})]}),$e.jsxs("div",{className:Li["error-message"],children:[C," "]})]})})})},Nve="_container_1ln5m_1",Pve="_autohide_1ln5m_34",Ive="_fadein_1ln5m_1",Dve="_title_1ln5m_131",Uve="_spacer_1ln5m_307",Fve="_watermark_1ln5m_311",Bve="_menu_1ln5m_142",yn={container:Nve,"container--default-controls":"_container--default-controls_1ln5m_29",autohide:Pve,"bottom-controls-container--autohide":"_bottom-controls-container--autohide_1ln5m_34","icon-button":"_icon-button_1ln5m_40","icon-button--drop-shadow-focus":"_icon-button--drop-shadow-focus_1ln5m_57","icon-button-active":"_icon-button-active_1ln5m_70","icon-button--circle-focus":"_icon-button--circle-focus_1ln5m_70","text-button":"_text-button_1ln5m_83","text-button--active":"_text-button--active_1ln5m_88","bottom-controls-container":"_bottom-controls-container_1ln5m_34",fadein:Ive,"bottom-controls-gradient":"_bottom-controls-gradient_1ln5m_105","center-play-button":"_center-play-button_1ln5m_117","center-play-button--hidden":"_center-play-button--hidden_1ln5m_124","title-container":"_title-container_1ln5m_131",title:Dve,"menu-control-container":"_menu-control-container_1ln5m_142","time-container":"_time-container_1ln5m_146","live-indicator":"_live-indicator_1ln5m_153","bottom-controls":"_bottom-controls_1ln5m_34","center-buttons":"_center-buttons_1ln5m_173","play-pause-button":"_play-pause-button_1ln5m_183","track-button":"_track-button_1ln5m_186","bottom-left-controls":"_bottom-left-controls_1ln5m_190","bottom-right-controls":"_bottom-right-controls_1ln5m_191","info-box-container":"_info-box-container_1ln5m_208","info-box":"_info-box_1ln5m_208","info-box-image-container":"_info-box-image-container_1ln5m_231","info-box-image":"_info-box-image_1ln5m_231","info-box-text":"_info-box-text_1ln5m_247","info-box-text--top-padding":"_info-box-text--top-padding_1ln5m_254","info-box-headers":"_info-box-headers_1ln5m_258","info-box-description":"_info-box-description_1ln5m_266","info-box-title":"_info-box-title_1ln5m_270","info-box-button":"_info-box-button_1ln5m_275","info-box-button--restart":"_info-box-button--restart_1ln5m_290",spacer:Uve,watermark:Fve,menu:Bve},mh=({icon:n,...e})=>$e.jsx("button",{...e,className:`${yn["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),zve=({player:n,videoState:e})=>{const[t,r]=zt.useState(n.video.currentTime);return zt.useEffect(()=>{const i=uk({video:n.video,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive?null:$e.jsxs("div",{className:yn["time-container"],children:[$e.jsx("div",{className:yn.time,children:j2(t,e.duration)}),$e.jsx("div",{className:yn.spacer}),$e.jsx("div",{className:yn.time,children:j2(e.duration,e.duration)})]})},jve=({player:n,videoState:e})=>{const t=n.controls.GetCollectionInfo(),r=t&&t.isPlaylist&&t.content[t.mediaIndex-1],i=t&&t.isPlaylist&&t.content[t.mediaIndex+1],o=n.controls.IsReady();return $e.jsxs("div",{className:yn["center-buttons"],children:[!r&&!i?null:$e.jsx(mh,{disabled:!o||!r,icon:ck,onClick:()=>n.controls.CollectionPlayPrevious(),className:`${yn["track-button"]} ${yn["icon-button--drop-shadow-focus"]}`}),$e.jsx(mh,{"aria-label":"Back 10 Seconds",icon:ove,onClick:()=>n.controls.Seek({relativeSeconds:-10}),className:yn["icon-button--drop-shadow-focus"]}),$e.jsx(mh,{"aria-label":e.playing?"Pause":"Play",icon:e.playing?Yj:Kj,onClick:()=>n.controls.TogglePlay(),className:`${yn["play-pause-button"]} ${yn["icon-button--drop-shadow-focus"]}`}),$e.jsx(mh,{"aria-label":"Forward 10 Seconds",icon:uve,onClick:()=>n.controls.Seek({relativeSeconds:10}),className:yn["icon-button--drop-shadow-focus"]}),!r&&!i?null:$e.jsx(mh,{disabled:!o||!i,icon:fk,onClick:()=>n.controls.CollectionPlayNext(),className:`${yn["track-button"]} ${yn["icon-button--drop-shadow-focus"]}`})]})},GI=({label:n,icon:e,children:t,player:r,setMenuActive:i,MenuComponent:o})=>{const[u,c]=zt.useState(!1);return $e.jsxs("div",{className:yn["menu-control-container"],children:[e?$e.jsx(mh,{"aria-label":u?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{i(!u),c(!u)},className:`${yn["icon-button--circle-focus"]} ${u?yn["icon-button-active"]:""}`}):$e.jsx("button",{onClick:()=>{i(!u),c(!u)},className:`${yn["text-button"]} ${u?yn["text-button--active"]:""}`,children:t}),u?$e.jsx(o,{player:r,Hide:()=>{c(!1),i(!1)},className:yn.menu}):null]})},$ve=({player:n,Hide:e})=>{const[t,r]=zt.useState(void 0),{title:i,description:o,image:u,headers:c}=n.controls.GetContentInfo()||{};return zt.useEffect(()=>{r(void 0),u&&sk({player:n,pathOrUrl:u,width:200}).then(p=>r(p))},[u]),zt.useEffect(()=>{const p=h=>{h&&(h.key||"").toLowerCase()==="escape"&&e()};return document.body.addEventListener("keydown",p),()=>document.body.removeEventListener("keydown",p)},[]),$e.jsxs("div",{className:yn["info-box-container"],children:[$e.jsx("button",{autoFocus:!0,onClick:()=>e(),className:`${yn["info-box-button"]} ${yn["info-box-button--info"]}`,children:"Info"}),$e.jsxs("div",{className:yn["info-box"],children:[t?$e.jsx("div",{className:yn["info-box-image-container"],children:$e.jsx("img",{src:t,alt:"Image",className:yn["info-box-image"]})}):null,$e.jsxs("div",{className:`${yn["info-box-text"]} ${t&&c&&c.length===0?yn["info-box-text--top-padding"]:""}`,children:[!c||c.length===0?null:$e.jsx("div",{className:yn["info-box-headers"],children:c.map((p,h)=>$e.jsx("div",{className:yn["info-box-header"],children:p},`header-${h}`))}),$e.jsx("div",{className:yn["info-box-title"],children:i||""}),$e.jsx("div",{className:yn["info-box-description"],children:o||""})]}),$e.jsx("div",{className:yn["info-box-actions"],children:$e.jsxs("button",{onClick:()=>{n.controls.Seek({time:0}),e()},className:`${yn["info-box-button"]} ${yn["info-box-button--restart"]}`,children:[$e.jsx(Bd,{icon:Wj}),"From Beginning"]})})]})]})},Hve=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[u,c]=zt.useState(void 0),[p,h]=zt.useState(void 0),[g,m]=zt.useState(!1),[w,v]=zt.useState(!1);if(zt.useEffect(()=>{h(Dj({player:n,setRecentUserAction:i}));const I=Vj({target:n.target,video:n.video,setVideoState:c});return()=>I&&I()},[]),!u)return null;const{title:C}=n.controls.GetContentInfo()||{},T=n.controls.GetCollectionInfo(),R=r||!e||g,O=!R&&n.playerOptions.controls===fn.controls.AUTO_HIDE;return n.__SetControlsVisibility(!O),$e.jsxs("div",{onClick:p,className:[o,yn.container,R?"":yn.autohide,n.playerOptions.controls!==fn.controls.DEFAULT?"":yn["container--default-controls"],g?"menu-active":""].join(" "),children:[$e.jsx(mh,{"aria-label":"Play",tabIndex:e?-1:0,icon:Gj,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${yn["center-play-button"]} ${yn["icon-button--drop-shadow-focus"]} ${t&&!e?"":yn["center-play-button--hidden"]}`}),w?$e.jsx($ve,{player:n,Hide:()=>v(!1)}):$e.jsxs("div",{className:`${yn["bottom-controls-container"]} ${O?yn["bottom-controls-container--autohide"]:""}`,children:[$e.jsx("div",{className:yn["bottom-controls-gradient"]}),$e.jsxs("div",{className:yn["title-container"],children:[$e.jsx("div",{className:yn.title,children:n.playerOptions.title===fn.title.OFF||n.playerOptions.title===fn.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()?"":C||""}),$e.jsx("div",{className:yn.spacer}),n.isLive?$e.jsx("div",{className:yn["live-indicator"],children:"Live"}):null,T?$e.jsx(GI,{label:"Collection Menu",icon:Qj,player:n,setMenuActive:m,MenuComponent:t$}):null]}),$e.jsx(Xj,{player:n,videoState:u,setRecentUserAction:i}),$e.jsx(zve,{player:n,videoState:u}),$e.jsxs("div",{className:yn["bottom-controls"],children:[$e.jsx("div",{className:yn["bottom-left-controls"],children:!C||n.playerOptions.title===fn.title.OFF?null:$e.jsx("button",{className:yn["text-button"],onClick:()=>v(!0),children:"Info"})}),$e.jsx(jve,{player:n,videoState:u}),$e.jsx("div",{className:yn["bottom-right-controls"],children:n.controls.GetOptions().hasAnyOptions?$e.jsx(GI,{label:"Settings",player:n,MenuComponent:e$,setMenuActive:m,children:"Settings"},"settings-button"):null})]})]}),n.playerOptions.watermark===fn.watermark.OFF?null:$e.jsx("div",{className:yn.watermark,children:$e.jsx("img",{src:Zj,alt:"Eluvio"})})]},"controls")},qve="_container_1l7ln_1",Vve="_overlay_1l7ln_9",Gve="_fadein_1l7ln_1",Wve="_form_1l7ln_22",Kve="_header_1l7ln_39",Yve="_input_1l7ln_45",Jve="_actions_1l7ln_92",Qve="_submit_1l7ln_98",Zve="_cancel_1l7ln_99",xo={container:qve,overlay:Vve,fadein:Gve,form:Wve,header:Kve,"input-container":"_input-container_1l7ln_45",input:Yve,"input--invalid":"_input--invalid_1l7ln_65","player-info":"_player-info_1l7ln_74","api-link":"_api-link_1l7ln_83",actions:Jve,submit:Qve,cancel:Zve},Xve=({player:n,Close:e})=>{const[t,r]=zt.useState(JSON.stringify(n.hlsOptions||"{}",null,2)),[i,o]=zt.useState(!1),[u,c]=zt.useState(""),p=zt.useRef();zt.useEffect(()=>{if(!p||!p.current)return;const g=ok({element:p.current,Hide:e});return()=>g&&g()},[p]);const h=async g=>{g.preventDefault();try{o(!0),await n.controls.SetPlayerProfile({profile:"custom",customHLSOptions:JSON.parse(t)}),e()}catch(m){c(m.toString()),o(!1)}};return $e.jsx("div",{role:"complementary",tabIndex:-1,className:xo.container,children:$e.jsx("div",{className:xo.overlay,children:$e.jsxs("form",{onSubmit:h,className:xo.form,ref:p,children:[$e.jsx("h2",{className:xo.header,children:"Custom hls.js Options"}),$e.jsxs("div",{className:xo["input-container"],children:[$e.jsx("textarea",{disabled:i,autoFocus:!0,value:t,title:u,"aria-label":"Player Options","aria-invalid":!!u,"aria-errormessage":u||"",onChange:g=>r(g.currentTarget.value),onFocus:()=>c(""),onBlur:()=>{try{c(""),r(JSON.stringify(JSON.parse(t||"{}"),null,2))}catch(g){c(g.toString())}},className:`${xo.input} ${u?xo["input--invalid"]:""}`}),$e.jsxs("div",{className:xo["player-info"],children:[$e.jsx("a",{tabIndex:0,href:"https://github.com/video-dev/hls.js/blob/master/docs/API.md",rel:"noreferrer",target:"_blank",className:xo["api-link"],children:"API Docs"}),$e.jsxs("div",{className:xo["player-version"],children:["hls.js ",n.HLS.version]})]})]}),$e.jsxs("div",{className:xo.actions,children:[$e.jsx("button",{type:"button","aria-label":"Cancel",onClick:()=>e(),className:xo.cancel,children:"Cancel"}),$e.jsx("button",{type:"submit","aria-label":"Submit",disabled:!!u,className:xo.submit,children:i?$e.jsx(G2,{light:!0}):"Submit"})]})]})})})},e1e=({player:n})=>{const[e,t]=zt.useState(void 0),{posterImage:r}=n.controls.GetContentInfo()||{};return zt.useEffect(()=>{t(void 0),r&&sk({player:n,pathOrUrl:r,width:200}).then(i=>t(i))},[r]),e?$e.jsx("img",{alt:"Video Poster",src:e,className:Vl.poster}):null},t1e=({target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:i,Reset:o})=>{const[u,c]=zt.useState(void 0),[p,h]=zt.useState(void 0),[g,m]=zt.useState("lg"),[w,v]=zt.useState("landscape"),[C,T]=zt.useState({width:n.getBoundingClientRect().width,height:n.getBoundingClientRect().height}),[R,O]=zt.useState(void 0),[I,D]=zt.useState(!1),[K,W]=zt.useState(!1),[pe,ce]=zt.useState(!1),[ge,Se]=zt.useState(!1),[_e,ae]=zt.useState(!1),[Te,S]=zt.useState(!0),[x,A]=zt.useState(void 0),[U,L]=zt.useState(void 0),z=zt.useRef(),Y=!!u,q=({action:M,text:Q})=>A({action:M,text:Q,key:Math.random()});if(zt.useEffect(()=>{Se(!0);const M=$be({target:n,setSize:m,setOrientation:v,setDimensions:T});return()=>{Se(!1),M&&M()}},[]),zt.useEffect(()=>{if(!(!z||!z.current||!ge))try{D(!1),W(!1),e.clientOptions.client=p||e.clientOptions.client;const M=new $2({target:n,video:z.current,parameters:e,SetErrorMessage:O});window.__elvPlayer=M;const Q=M.controls.RegisterSettingsListener(()=>{L(M.controls.AllowRotation()),W(M.playbackStarted),D(!M.loading),ae(M.__showPlayerProfileForm)});M.Destroy=()=>{M.__DestroyPlayer(),i()},M.Reset=()=>{o()};const ie=Hbe({player:M}),H=qbe({player:M,inactivityPeriod:5e3,onWake:()=>S(!0),onSleep:()=>S(!1)}),we=Vbe({player:M,setRecentUserAction:q}),Ne=Gbe({player:M});t(M),c(M);const ke=M.controls.RegisterVideoEventListener("canplay",()=>ce(!0));return()=>{z&&z.current&&z.current.removeEventListener("play",W),Q&&Q(),ie&&ie(),H&&H(),we&&we(),Ne&&Ne(),ke&&ke(),M&&M.__DestroyPlayer()}}catch(M){r(M),i()}},[z,ge,p]),zt.useEffect(()=>{if(Y)return()=>{u&&u.__DestroyPlayer(),c(void 0)}},[Y]),e.clientOptions.promptTicket&&!p)return $e.jsx(Lve,{parameters:e,dimensions:{size:g,orientation:w,...C},onComplete:M=>h(M)});const P=e.playerOptions.ui===fn.ui.WEB&&u&&u.controls.IsRotatable()&&U;return $e.jsxs("div",{role:"complementary","aria-label":"Eluvio Video Player",tabIndex:0,style:{backgroundColor:e.playerOptions.backgroundColor||"transparent","--portal-width":`${C.width}px`,"--portal-height":`${C.height}px`},className:[Vl["player-container"],P?Vl["player-container--rotated"]:"",`__eluvio-player--size-${g}`,`__eluvio-player--orientation-${w}`].join(" "),children:[!_e||!I?null:$e.jsx(Xve,{player:u,Close:()=>u.controls.HidePlayerProfileForm()}),$e.jsx("video",{playsInline:!0,disablePictureInPicture:!0,ref:z,muted:[fn.muted.ON,fn.muted.WHEN_NOT_VISIBLE].includes(e.playerOptions.muted),controls:e.playerOptions.controls===fn.controls.DEFAULT,loop:e.playerOptions.loop===fn.loop.ON,className:Vl.video}),!u||K||!pe?null:$e.jsx(e1e,{player:u}),I||R?null:$e.jsx("div",{className:Vl["spinner-container"],children:$e.jsx(G2,{className:Vl.spinner})}),R?$e.jsx("div",{className:Vl["error-message"],children:R}):null,u?e.playerOptions.ui===fn.ui.WEB?$e.jsx(Eve,{player:u,playbackStarted:!!K,canPlay:pe,recentlyInteracted:Te,setRecentUserAction:q,className:Vl.controls}):$e.jsx(Hve,{player:u,playbackStarted:!!K,canPlay:pe,recentlyInteracted:Te,setRecentUserAction:q,className:Vl.controls}):null,x?$e.jsx(vve,{action:x},`action-indicator-${x&&x.key}`):null]})},n1e=n=>{const[e,t]=zt.useState(Math.random());return zt.createElement(t1e,{...n,key:`player-${e}`,Reset:()=>t(Math.random())})},r1e=(n,e)=>(n.innerHTML="",n.classList.add(YW.reset),n.classList.add(Vl["player-target"]),e=Bj(e),e.playerOptions&&e.playerOptions.backgroundColor&&(n.style.backgroundColor=e.playerOptions.backgroundColor),new Promise((t,r)=>{const i=bv.createRoot(n);i.render($e.jsx(VW.StrictMode,{children:$e.jsx(n1e,{target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:async()=>{try{await i.unmount()}catch(o){console.error("Failed to unmount Eluvio Player"),console.error(o)}}})}))}));exports.Initialize=r1e;exports.PlayerParameters=fn;exports.commonjsGlobal=Va;exports.crypto=XI;exports.eventsExports=S1;exports.getDefaultExportFromCjs=tp;exports.inherits_browserExports=HD;exports.require$$3=l1;exports.requireBuffer=u1;exports.string_decoder=PM;
367
+ ${e.length}${e}`,"utf-8")),await this.client.authClient.Sign(e);if(this.UserInfo().walletName.toLowerCase()==="metamask")return this.SignMetamask({message:e,address:this.UserAddress()});throw Error("ElvWalletClient: Unable to sign")}else if(!Tv)throw Error("ElvWalletClient: Unable to sign");const t={action:"personal-sign",message:e,logIn:!0};let r=new URL(this.appUrl);if(r.hash=ma("/action","sign",Ta.B58(JSON.stringify(t))),r.searchParams.set("origin",window.location.origin),!mbe&&window.location.origin===r.origin)throw Error("ElvWalletClient: Unable to sign");return await new Promise(async(i,o)=>{await BI({mode:"tab",url:r.toString(),onCancel:()=>o("User cancelled sign"),onMessage:async(u,c)=>{if(!(!u||!u.data||u.data.type!=="FlowResponse"))try{i(u.data.response)}catch(p){o(p)}finally{c()}}})})}async LogInURL({mode:e="login",provider:t,marketplaceParams:r,clearLogin:i}){let o=new URL(this.appUrl);return o.hash="/login",o.searchParams.set("action","login"),typeof window<"u"&&o.searchParams.set("origin",window.location.origin),t&&o.searchParams.set("provider",t),e&&o.searchParams.set("mode",e),r?o.searchParams.set("mid",(await this.MarketplaceInfo({marketplaceParams:r})).marketplaceHash):(this.selectedMarketplaceInfo||{}).marketplaceHash&&o.searchParams.set("mid",this.selectedMarketplaceInfo.marketplaceHash),i&&o.searchParams.set("clear",""),o}async LogIn({method:e="redirect",provider:t,mode:r="login",callbackUrl:i,marketplaceParams:o,clearLogin:u=!1,callback:c}){let p=await this.LogInURL({mode:r,provider:t,marketplaceParams:o,clearLogin:u});e==="redirect"?(p.searchParams.set("response","redirect"),p.searchParams.set("source","origin"),p.searchParams.set("redirect",i),window.location=p):(p.searchParams.set("response","message"),p.searchParams.set("source","parent"),await new Promise(async(h,g)=>{await BI({mode:"tab",url:p.toString(),onCancel:()=>g("User cancelled login"),onMessage:async(m,w)=>{if(!(!m||!m.data||m.data.type!=="LoginResponse"))try{c?await c(m.data.params):await this.Authenticate({token:m.data.params.clientSigningToken||m.data.params.clientAuthToken}),h()}catch(v){g(v)}finally{w()}}})}))}LogOut(){if(this.__authorization={},this.loggedIn=!1,this.cachedMarketplaces={},p2)try{localStorage.removeItem(`__elv-token-${this.network}`)}catch{}}async Authenticate({token:e}){let t;try{t=JSON.parse(this.utils.FromB58ToStr(e))||{}}catch{throw new Error("Invalid authorization token "+e)}if(!t.expiresAt||Date.now()>t.expiresAt)throw Error("ElvWalletClient: Provided authorization token has expired");return t.clusterToken&&await this.client.SetRemoteSigner({authToken:t.clusterToken,signerURIs:t.signerURIs}),this.client.SetStaticToken({token:t.fabricToken}),this.SetAuthorization({...t})}async AuthenticateOAuth({idToken:e,tenantId:t,email:r,signerURIs:i,shareEmail:o=!1}){let u=24;!t&&this.selectedMarketplaceInfo&&(await this.AvailableMarketplaces(),t=this.selectedMarketplaceInfo.tenantId),await this.client.SetRemoteSigner({idToken:e,tenantId:t,signerURIs:i,extraData:{share_email:o},unsignedPublicAuth:!0});const c=Date.now()+u*60*60*1e3,p=await this.client.CreateFabricToken({duration:u*60*60*1e3}),h=this.client.utils.FormatAddress(this.client.CurrentAccountAddress());if(!r)try{r=JSON.parse(this.utils.FromB64URL(e.split(".")[1])).email}catch{throw Error("Failed to decode ID token")}return this.client.SetStaticToken({token:p}),{authToken:this.SetAuthorization({fabricToken:p,tenantId:t,address:h,email:r,expiresAt:c,signerURIs:i,walletType:"Custodial",walletName:"Eluvio",register:!0}),signingToken:this.SetAuthorization({clusterToken:this.client.signer.authToken,fabricToken:p,tenantId:t,address:h,email:r,expiresAt:c,signerURIs:i,walletType:"Custodial",walletName:"Eluvio"})}}async AuthenticateExternalWallet({address:e,tokenDuration:t=24,walletName:r="Metamask",Sign:i}){e||(e=window.ethereum.selectedAddress),e=this.utils.FormatAddress(e),i||(i=async c=>this.SignMetamask({message:c,address:e}));const o=Date.now()+t*60*60*1e3,u=await this.client.CreateFabricToken({address:e,duration:t*60*60*1e3,Sign:i,addEthereumPrefix:!1});return this.SetAuthorization({fabricToken:u,address:e,expiresAt:o,walletType:"External",walletName:r,register:!0})}ClientAuthToken(){return this.loggedIn?this.utils.B58(JSON.stringify(this.__authorization)):""}AuthToken(){return this.loggedIn?this.__authorization.fabricToken:this.publicStaticToken}SetAuthorization({clusterToken:e,fabricToken:t,tenantId:r,address:i,email:o,expiresAt:u,signerURIs:c,walletType:p,walletName:h,register:g=!1}){i=this.client.utils.FormatAddress(i),this.__authorization={fabricToken:t,tenantId:r,address:i,email:o,expiresAt:u,walletType:p,walletName:h},e&&(this.__authorization.clusterToken=e,c&&(this.__authorization.signerURIs=c)),this.loggedIn=!0,this.cachedMarketplaces={};const m=this.ClientAuthToken();if(this.storeAuthToken&&p2)try{localStorage.setItem(`__elv-token-${this.network}`,m)}catch{}return g&&this.client.authClient.MakeAuthServiceRequest({path:"/as/wlt/register",method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`}}).catch(w=>{this.Log("Failed to register account: ",!0,w)}),m}async SignMetamask({message:e,address:t}){if(!Tv||!window.ethereum)throw Error("ElvWalletClient: Unable to initialize - Metamask not available");t=t||this.UserAddress();const r=await window.ethereum.request({method:"eth_requestAccounts"});if(t&&!Ta.EqualAddress(r[0],t))throw Error(`ElvWalletClient: Incorrect MetaMask account selected. Expected ${t}, got ${r[0]}`);return await window.ethereum.request({method:"personal_sign",params:[e,t,""]})}FlowURL({type:e="flow",flow:t,marketplaceId:r,parameters:i={}}){const o=new URL(this.appUrl);return r?o.pathname=ma("/",e,t,"marketplace",r,Ta.B58(JSON.stringify(i))):o.pathname=ma("/",e,t,Ta.B58(JSON.stringify(i))),o.searchParams.set("origin",window.location.origin),o.toString()}async GenerateCodeAuth({url:e}={}){e||(e=await this.LogInURL({mode:"login"}),e.searchParams.set("response","code"),e.searchParams.set("source","code"));const t=await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","login","redirect","metamask"),method:"POST",body:{op:"create",dest:e.toString()}}));return t.code=t.id,t.url=t.url.startsWith("https://")?t.url:`https://${t.url}`,t.metamask_url=t.metamask_url.startsWith("https://")?t.metamask_url:`https://${t.metamask_url}`,t}async SetCodeAuth({code:e,address:t,type:r,authToken:i}){await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","login","session",e),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`},body:{op:"set",id:e,format:"auth_token",payload:JSON.stringify({addr:Ta.FormatAddress(t),eth:t?`ikms${Ta.AddressToHash(t)}`:"",type:r,token:i})}}))}async GetCodeAuth({code:e,passcode:t}){try{return await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","login","redirect","metamask",e,t),method:"GET"}))}catch(r){if(r&&r.status===404)return;throw r}}async LoadAvailableMarketplaces(e=!1){if(!e&&Object.keys(this.availableMarketplaces)>0)return;let t=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:"public/asset_metadata",resolveLinks:!0,linkDepthLimit:2,resolveIncludeSource:!0,resolveIgnoreErrors:!0,produceLinkUrls:!0,authorizationToken:this.publicStaticToken,noAuth:!0,select:["info/marketplace_order","tenants/*/.","tenants/*/info/branding","tenants/*/marketplaces/*/.","tenants/*/marketplaces/*/info/tenant_id","tenants/*/marketplaces/*/info/tenant_name","tenants/*/marketplaces/*/info/branding","tenants/*/marketplaces/*/info/storefront/background","tenants/*/marketplaces/*/info/storefront/background_mobile"],remove:["tenants/*/info/branding/wallet_css","tenants/*/marketplaces/*/info/branding/custom_css"]});const r=((t||{}).info||{}).marketplace_order||[];if(t=(t||{}).tenants||{},this.previewMarketplaceId){let u="PREVIEW",c,p;Object.keys(t||{}).forEach(h=>Object.keys(t[h].marketplaces||{}).forEach(g=>{const m=t[h].marketplaces[g]["."].source;this.utils.DecodeVersionHash(m).objectId===this.previewMarketplaceId&&(u=h,c=g,m===this.previewMarketplaceHash&&(p=t[h].marketplaces[g]))})),p||(p=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"public/asset_metadata",produceLinkUrls:!0,authorizationToken:this.publicStaticToken,noAuth:!0,select:["slug","info/tenant_id","info/tenant_name","info/branding"],remove:["info/branding/custom_css"]}),c||(c=p.slug)),p["."]={source:this.previewMarketplaceHash},p.info["."]={source:this.previewMarketplaceHash},p.info.branding.preview=!0,p.info.branding.show=!0,t[u]=t[u]||{},t[u].marketplaces=t[u].marketplaces||{},t[u].marketplaces[c]=p}let i={...this.availableMarketplaces||{}},o={...this.availableMarketplacesById||{}};Object.keys(t||{}).forEach(u=>{try{i[u]=t[u]["."]?{versionHash:t[u]["."].source}:{},Object.keys(t[u].marketplaces||{}).forEach(c=>{try{const p=t[u].marketplaces[c]["."].source,h=this.utils.DecodeVersionHash(p).objectId;i[u][c]={...t[u].marketplaces[c].info||{},tenantName:t[u].marketplaces[c].info.tenant_name,tenantId:t[u].marketplaces[c].info.tenant_id,tenantSlug:u,marketplaceSlug:c,marketplaceId:h,marketplaceHash:p,tenantBranding:(t[u].info||{}).branding||{},order:r.findIndex(g=>g===c)},o[h]=i[u][c],this.marketplaceHashes[h]=p,this.selectedMarketplaceInfo&&(this.selectedMarketplaceInfo.tenantSlug===u&&this.selectedMarketplaceInfo.marketplaceSlug===c||this.selectedMarketplaceInfo.marketplaceId===h)&&(this.selectedMarketplaceInfo=i[u][c])}catch{this.Log(`Eluvio Wallet Client: Unable to load info for marketplace ${u}/${c}`,!0)}})}catch(c){this.Log(`Eluvio Wallet Client: Failed to load tenant info ${u}`,!0,c)}}),this.availableMarketplaces=i,this.availableMarketplacesById=o}async LatestMarketplaceHash({marketplaceParams:e}){const t=await this.MarketplaceInfo({marketplaceParams:e});if(this.previewMarketplaceId&&Ta.EqualHash(this.previewMarketplaceId,t.marketplaceId))return this.previewMarketplaceHash;const r=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug),resolveLinks:!1,noAuth:!0});return M5(r)}async LoadMarketplace(e){const t=this.MarketplaceInfo({marketplaceParams:e}),r=t.marketplaceId,i=await this.LatestMarketplaceHash({marketplaceParams:e});if(this.cachedMarketplaces[r]&&this.cachedMarketplaces[r].versionHash!==i&&delete this.cachedMarketplaces[r],!this.cachedMarketplaces[r]){let o;this.previewMarketplaceId&&Ta.EqualHash(r,this.previewMarketplaceId)?o=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"/public/asset_metadata/info",localizationSubtree:this.localization?ma("public","asset_metadata","localizations",this.localization,"info"):void 0,linkDepthLimit:1,resolveLinks:!0,resolveIgnoreErrors:!0,resolveIncludeSource:!0,produceLinkUrls:!0,authorizationToken:this.publicStaticToken}):o=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"info"),localizationSubtree:this.localization?ma("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"localizations",this.localization,"info"):void 0,linkDepthLimit:1,resolveLinks:!0,resolveIgnoreErrors:!0,resolveIncludeSource:!0,produceLinkUrls:!0,authorizationToken:this.publicStaticToken}),o.branding.use_tenant_styling&&(o.tenantBranding=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("/public","asset_metadata","tenants",t.tenantSlug,"info","branding"),authorizationToken:this.publicStaticToken,produceLinkUrls:!0})||{}),o.items=await Promise.all(o.items.map(async(u,c)=>{if(u.requires_permissions){let p;this.loggedIn||(p=await this.client.CreateFabricToken({}));try{await this.client.ContentObjectMetadata({versionHash:M5(u.nft_template),metadataSubtree:"permissioned",authorizationToken:p}),u.authorized=!0}catch{u.authorized=!1}}return u.nftTemplateMetadata=(u.nft_template||{}).nft||{},u.nftTemplateHash=((u.nft_template||{})["."]||{}).source,u.itemIndex=c,u})),o.collections=(o.collections||[]).map((u,c)=>({...u,collectionIndex:c})),o.retrievedAt=Date.now(),o.marketplaceId=r,o.versionHash=i,o.marketplaceHash=i,this.previewMarketplaceId&&r===this.previewMarketplaceId&&(o.branding.preview=!0),["purchase_animation","purchase_animation_mobile","reveal_animation","reveal_animation_mobile"].forEach(u=>{try{if(o.storefront[u]){let c=new URL("https://embed.v3.contentfabric.io");const p=M5(o.storefront[u]);c.searchParams.set("p",""),c.searchParams.set("net",this.network==="main"?"main":"demo"),c.searchParams.set("ath",(this.__authorization||{}).authToken||this.publicStaticToken),c.searchParams.set("vid",p),c.searchParams.set("ap",""),u.startsWith("reveal")||(c.searchParams.set("m",""),c.searchParams.set("lp","")),o.storefront[`${u}_embed_url`]=c.toString()}}catch{}}),this.cachedMarketplaces[r]=o}return this.cachedMarketplaces[r]}async FilteredQuery({mode:e="listings",sortBy:t="created",sortDesc:r=!1,filter:i,editionFilters:o,attributeFilters:u,contractAddress:c,tokenId:p,currency:h,marketplaceParams:g,tenantId:m,collectionIndexes:w,priceRange:v,tokenIdRange:C,capLimit:T,userAddress:R,sellerAddress:O,lastNDays:I=-1,startTime:D,endTime:K,includeCheckoutLocked:W=!1,start:pe=0,limit:ce=50}={}){w=(w||[]).map(ae=>parseInt(ae));let ge={start:pe,limit:ce,sort_descending:r};e==="owned"&&t==="created"&&(t="default"),e!=="leaderboard"&&(ge.sort_by=t),e.includes("listings")&&W&&(ge.checkout=!0);let Se,_e;g&&(Se=await this.MarketplaceInfo({marketplaceParams:g}),w.length>0&&(_e=await this.Marketplace({marketplaceParams:g})));try{let ae=[];O?ae.push(`seller:eq:${this.client.utils.FormatAddress(O)}`):R&&e!=="owned"&&ae.push(`addr:eq:${this.client.utils.FormatAddress(R)}`),_e&&w.length>=0?w.forEach(L=>{_e.collections[L].items.forEach(Y=>{if(!Y)return;const q=_e.items.find(M=>M.sku===Y);if(!q)return;const P=Ta.SafeTraverse(q,"nft_template","nft","address");P&&ae.push(`${e==="owned"?"contract_addr":"contract"}:eq:${Ta.FormatAddress(P)}`)})}):(Se||m)&&ae.push(`tenant:eq:${Se?Se.tenantId:m}`),c?(e==="owned"?ae.push(`contract_addr:eq:${Ta.FormatAddress(c)}`):ae.push(`contract:eq:${Ta.FormatAddress(c)}`),p&&ae.push(`token:eq:${p}`)):i&&(e.includes("listing")?ae.push(`nft/display_name:eq:${i}`):e==="owned"?ae.push(`meta/display_name:eq:${i}`):ae.push(`name:eq:${i}`)),o&&o.forEach(L=>{e.includes("listing")?ae.push(`nft/edition_name:eq:${L}`):e==="owned"?(ae.push(`meta:@>:{"edition_name":"${L}"}`),ge.exact=!1):ae.push(`edition:eq:${L}`)}),u&&u.map(({name:L,value:z})=>{!L||!z||ae.push(`nft/attributes/${L}:eq:${z}`)}),h&&ae.push("link_type:eq:sol"),D||K?(D&&ae.push(`created:gt:${parseInt(D)/1e3}`),K&&ae.push(`created:lt:${parseInt(K)/1e3}`)):I&&I>0&&ae.push(`created:gt:${(Date.now()/1e3-I*24*60*60).toFixed(0)}`),v&&(v.min&&ae.push(`price:ge:${parseFloat(v.min)}`),v.max&&ae.push(`price:le:${parseFloat(v.max)}`)),C&&(C.min&&ae.push(`info/token_id:ge:${parseInt(C.min)}`),C.max&&ae.push(`info/token_id:le:${parseInt(C.max)}`)),T&&ae.push(`info/cap:le:${parseInt(T)}`);let Te,S;switch(e){case"owned":S=ma("as","wlt",R||this.UserAddress());break;case"owned-full-meta":S=ma("as","apigw","nfts"),Te={Authorization:`Bearer ${this.AuthToken()}`};break;case"listings":S=ma("as","mkt","f");break;case"transfers":S=ma("as","mkt","hst","f"),ae.push("action:eq:TRANSFERRED"),ae.push("action:eq:SOLD");break;case"sales":S=ma("as","mkt","hst","f"),ae.push("action:eq:SOLD"),ae.push("seller:co:0x");break;case"listing-stats":S=ma("as","mkt","stats","listed");break;case"sales-stats":S=ma("as","mkt","stats","sold"),ae.push("seller:co:0x");break;case"leaderboard":S=ma("as","wlt","leaders");break}if(ae.length>0&&(ge.filter=ae),e.includes("stats"))return await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:S,method:"GET",queryParams:ge,headers:Te}));const{contents:x,paging:A}=await Ta.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:S,method:"GET",queryParams:ge,headers:Te}))||[],U=["owned","listings","owned-full-meta"];return{paging:{start:ge.start,limit:ge.limit,total:A.total,more:A.total>pe+ce},results:(x||[]).map(L=>U.includes(e)?pbe(this,L):L)}}catch(ae){if(ae.status&&ae.status.toString()==="404")return{paging:{start:ge.start,limit:ge.limit,total:0,more:!1},results:[]};throw ae}}async MintingStatus({marketplaceParams:e,tenantId:t}){t||(t=(await this.MarketplaceInfo({marketplaceParams:e||this.selectedMarketplaceInfo})).tenantId);try{return(await Ta.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:ma("as","wlt","status","act",t),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))).map(i=>{let[o,u,c]=i.op.split(":");u=u.startsWith("0x")?Ta.FormatAddress(u):u;let p,h,g,m;return o==="nft-buy"?p=c:o==="nft-claim"?(p=c,i.marketplaceId=u,i.extra&&i.extra[0]&&(u=i.extra.token_addr,h=i.extra.token_id_str)):o==="nft-redeem"?p=i.op.split(":").slice(-1)[0]:h=c,o==="nft-transfer"&&(p=i.extra&&i.extra.trans_id,h=i.extra&&i.extra.token_id_str||h,i.extra&&i.extra.gift_action==="nft-gift-claim"&&(m=i.extra.gift_id)),o==="nft-offer-redeem"&&(g=i.op.split(":")[3]),{...i,timestamp:new Date(i.ts),state:i.state&&typeof i.state=="object"?Object.values(i.state):i.state,extra:i.extra&&typeof i.extra=="object"?Object.values(i.extra):i.extra,confirmationId:p,op:o,address:Ta.FormatAddress(u),tokenId:h,offerId:g,giftId:m}}).sort((i,o)=>i.ts<o.ts?1:-1)}catch(r){return this.Log("Failed to retrieve minting status",!0,r),[]}}async DeployTenant({tenantId:e,tenantSlug:t="",tenantHash:r}){if(!r){const u=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:ma("public/asset_metadata/tenants",t),resolveLinks:!0,linkDepthLimit:1,resolveIncludeSource:!0,resolveIgnoreErrors:!0,select:["."]});if(!u)throw Error(`Eluvio Wallet Client: Invalid or missing tenancy: ${t}`);const c=u["."].source;r=await this.client.LatestVersionHash({versionHash:c})}const i={content_hash:r,ts:Date.now()},o=await this.client.Sign(JSON.stringify(i));await this.client.authClient.MakeAuthServiceRequest({path:ma("as","tnt","config",e,"metadata"),method:"POST",body:i,headers:{Authorization:`Bearer ${o}`}})}}Object.assign(Wd.prototype,lbe());Object.assign(Wd.prototype,cbe());Object.assign(Wd.prototype,fbe());const{ElvClient:gbe}=N4,bbe=Rs;var vbe=gbe,Ch=bbe;const Ij=Object.freeze(Object.defineProperty({__proto__:null,ElvClient:vbe,Utils:Ch},Symbol.toStringTag,{value:"Module"})),zI={default:{label:"Default",hlsSettings:Ch.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class wbe{constructor({player:e}){this.player=e,this.visible=!0,this.allowRotation=!0}IsVisible(){return this.visible}IsReady(){return!this.player.loading}IsPlaying(){return!this.player.video.paused}HasPlaybackStarted(){return this.player.playbackStarted}async Play(){return await this.player.__Play()}Pause(){this.player.video.pause()}TogglePlay(){return this.player.video.paused?(this.Play(),!0):(this.Pause(),!1)}Stop(){this.Pause(),this.Seek({time:0}),this.player.playbackStarted=!1,this.player.__SettingsUpdate()}GetCurrentTime(){return this.player.video.currentTime}GetDuration(){return this.player.video.duration}Seek({fraction:e,time:t,relativeSeconds:r}){if(!this.player.video||e&&!this.player.video.duration)return;const i=this.player.video.currentTime;return r?this.player.video.currentTime=Math.max(0,Math.min(this.player.video.duration,this.player.video.currentTime+r)):typeof e<"u"?this.player.video.currentTime=this.player.video.duration*e:this.player.video.currentTime=t,i<=this.player.video.currentTime}GetVolume(){return this.player.video.volume}SetVolume({fraction:e,relativeFraction:t}){return t?this.player.video.volume=Math.min(1,Math.max(0,this.GetVolume()+t)):this.player.video.volume=e,this.player.video.volume>0&&this.Unmute(!1),this.player.video.volume}IsMuted(){return this.player.video.muted}Mute(){this.player.video.muted=!0}Unmute(){this.player.video.muted=!1}ToggleMuted(){return this.player.video.muted=!this.player.video.muted,this.player.video.muted}IsFullscreen(){return(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)===this.player.target}Fullscreen(){this.player.target.requestFullscreen?this.player.target.requestFullscreen({navigationUI:"hide"}):this.player.target.mozRequestFullScreen?this.player.target.mozRequestFullScreen({navigationUI:"hide"}):this.player.target.webkitRequestFullscreen?this.player.target.webkitRequestFullscreen({navigationUI:"hide"}):this.player.target.msRequestFullscreen?this.player.target.msRequestFullscreen({navigationUI:"hide"}):this.player.target.querySelector("video").webkitEnterFullScreen()}ExitFullscreen(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()}ToggleFullscreen(){return this.IsFullscreen()?(this.ExitFullscreen(),!1):(this.Fullscreen(),!0)}GetCollectionInfo(){if(!this.player.collectionInfo)return;const e={...this.player.collectionInfo};return e.content=e.content.map(t=>({...t,active:t.mediaIndex===e.mediaIndex})),e.active=e.content[e.mediaIndex],e}CollectionPlay({mediaIndex:e,mediaId:t,autoplay:r}){this.player.loading||(this.player.__CollectionPlay({mediaId:t,mediaIndex:e,autoplay:r}),this.player.__SettingsUpdate())}CollectionPlayNext({autoplay:e}={}){const t=this.GetCollectionInfo();if(!t)return;const r=Math.min(t.mediaIndex+1,t.mediaLength-1);r!==t.mediaIndex&&this.CollectionPlay({mediaIndex:r,autoplay:e})}CollectionPlayPrevious({autoplay:e}={}){const t=this.GetCollectionInfo();if(!t)return;const r=Math.max(0,t.mediaIndex-1);r!==t.mediaIndex&&this.CollectionPlay({mediaIndex:r,autoplay:e})}IsLive(){return this.player.isLive}GetContentInfo(){if(this.player.playerOptions.title!==!1){const e=this.GetCollectionInfo();if(e&&e.active)return{title:e.active.title||"",subtitle:e.active.title||"",description:e.active.description||"",image:e.active.image&&e.active.image.url||"",posterImage:e.active.poster_image&&e.active.poster_image.url||"",headers:e.active.headers||[]};if(this.player.sourceOptions.contentInfo)return{title:this.player.sourceOptions.contentInfo.title,subtitle:this.player.sourceOptions.contentInfo.subtitle,description:this.player.sourceOptions.contentInfo.description,image:this.player.sourceOptions.contentInfo.image,posterImage:this.player.sourceOptions.contentInfo.posterImage,headers:this.player.sourceOptions.contentInfo.headers||[]}}}GetQualityLevels(){let e=[];if(this.player.hlsPlayer){if(e=this.player.hlsPlayer.levels.map((t,r)=>({index:r,active:this.player.hlsPlayer.currentLevel===r&&!this.player.hlsPlayer.autoLevelEnabled,resolution:t.attrs.RESOLUTION,bitrate:t.bitrate,audioTrack:!t.videoCodec,label:t.audioTrack?`${t.bitrate/1e3}kbps`:`${t.attrs.RESOLUTION} (${(t.bitrate/1e3/1e3).toFixed(1)}Mbps)`,activeLabel:t.audioTrack?`${t.bitrate/1e3}kbps`:`${t.attrs.RESOLUTION}`})).sort((t,r)=>t.bitrate<r.bitrate?1:-1),e.length>0){const t=e.find(r=>this.player.hlsPlayer.currentLevel===r.index);e.unshift({index:-1,label:"Auto",activeLabel:t?`Auto (${t.activeLabel})`:"Auto",active:this.player.hlsPlayer.autoLevelEnabled})}}else this.player.dashPlayer&&(e=this.player.dashPlayer.getBitrateInfoListFor("video").map(t=>({index:t.qualityIndex,active:t.qualityIndex===this.player.dashPlayer.getQualityFor("video"),resolution:`${t.width}x${t.height}`,bitrate:t.bitrate,label:`${t.width}x${t.height} (${(t.bitrate/1e3/1e3).toFixed(1)}Mbps)`,activeLabel:`${t.width}x${t.height}`})).sort((t,r)=>t.bitrate<r.bitrate?1:-1));return{options:e,active:e.find(t=>t.active)}}SetQualityLevel(e){this.player.hlsPlayer?(this.player.hlsPlayer.nextLevel=e,this.player.hlsPlayer.streamController.immediateLevelSwitch()):this.player.dashPlayer&&(this.player.dashPlayer.setQualityFor("video",e),this.player.dashPlayer.updateSettings({streaming:{trackSwitchMode:"alwaysReplace",buffer:{fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!0},abr:{autoSwitchBitrate:{video:e===-1}}}})),this.player.__SettingsUpdate()}GetAudioTracks(){let e=[];return this.player.nativeHLS?e=Array.from(this.player.video.audioTracks).map(t=>({index:t.id,label:t.label||t.language,active:t.enabled})):this.player.hlsPlayer?e=this.player.hlsPlayer.audioTracks.map(t=>({index:t.id,label:t.name,active:t.id===this.player.hlsPlayer.audioTrack})):this.player.dashPlayer&&(e=this.player.dashPlayer.getTracksFor("audio").map(t=>({index:t.index,label:t.labels&&t.labels.length>0?t.labels[0].text:t.lang,active:t.index===this.player.dashPlayer.getCurrentTrackFor("audio").index}))),{options:e,active:e.find(t=>t.active)}}SetAudioTrack(e){if(this.player.nativeHLS)Array.from(this.player.video.audioTracks).forEach(t=>t.enabled=e.toString()===t.id);else if(this.player.hlsPlayer)this.player.hlsPlayer.audioTrack=e,this.player.hlsPlayer.streamController.immediateLevelSwitch();else if(this.player.dashPlayer){const t=this.player.dashPlayer.getTracksFor("audio").find(r=>r.index===e);this.player.dashPlayer.setCurrentTrack(t)}}GetTextTracks(){let e=[],t;return this.player.nativeHLS||this.player.hlsPlayer?(t=Array.from(this.player.video.textTracks).findIndex(r=>r.mode==="showing"),e=Array.from(this.player.video.textTracks).map((r,i)=>({index:i,label:r.label||r.language,language:r.language,active:r.mode==="showing"}))):this.player.dashPlayer&&(t=this.player.dashPlayer.getCurrentTextTrackIndex(),e=this.player.dashPlayer.getTracksFor("text").map((r,i)=>({index:i,label:r.labels&&r.labels.length>0?r.labels[0].text:r.lang,language:r.lang,active:i===t}))),e.length>0&&e.unshift({index:-1,label:"Disabled",active:t<0}),{options:e,active:e.find(r=>r.active)}}SetTextTrack(e){if(e=parseInt(e),this.player.nativeHLS||this.player.hlsPlayer){const t=Array.from(this.player.video.textTracks);t.map(r=>r.mode="disabled"),e>=0&&(t[e].mode="showing")}else this.player.dashPlayer&&this.player.dashPlayer.setTextTrack(parseInt(e));e>=0&&(this.__lastTextTrackIndex=e)}ToggleTextTrack(){const{active:e,options:t}=this.GetTextTracks();if(t.length!==0){if(e&&e.index>=0)return this.SetTextTrack(-1),!1;if(this.__lastTextTrackIndex>=0)return this.SetTextTrack(this.__lastTextTrackIndex),!0;for(const r of navigator.languages){const i=t.find(o=>o.language===r||o.language===r.split("-")[0]);if(i)return this.SetTextTrack(i.index),!0}return this.SetTextTrack(0),!0}}GetPlaybackRates(){const e=["0.25","0.5","0.75","1","1.25","1.5","1.75","2"].map((r,i)=>({index:i,rate:parseFloat(r),label:`${r}x`,active:this.player.video.playbackRate.toFixed(2)===parseFloat(r).toFixed(2)}));let t=e.find(r=>r.active);return t||(t={index:-1,rate:this.player.video.playbackRate,label:`${this.player.video.playbackRate}x`,active:!0}),{options:e,active:t}}SetPlaybackRate({index:e,rate:t}){const r=this.player.video.playbackRate;if(t)return this.player.video.playbackRate=t,this.player.__SettingsUpdate(),{rate:t,increase:r<=t};{const i=this.GetPlaybackRates().options[e];if(i)return this.player.video.playbackRate=i.rate,this.player.__SettingsUpdate(),{rate:i.rate,increase:r<=i.rate}}}GetPlayerProfiles(){let e=[];return this.player.hlsPlayer&&(e=Object.keys(zI).map(t=>({index:t,label:zI[t].label,active:this.player.playerOptions.playerProfile===t}))),{options:e,active:e.find(t=>t.active)}}SetPlayerProfile({profile:e,customOptions:t={}}){this.player.SetPlayerProfile({profile:e,customHLSOptions:t})}ShowPlayerProfileForm(){this.player.__showPlayerProfileForm=!0,this.player.__SettingsUpdate()}HidePlayerProfileForm(){this.player.__showPlayerProfileForm=!1,this.player.__SettingsUpdate()}GetOptions(){let e={quality:this.GetQualityLevels(),audio:this.GetAudioTracks(),text:this.GetTextTracks(),profile:this.GetPlayerProfiles(),rate:this.GetPlaybackRates()};return e.hasQualityOptions=e.quality.options.length>0,e.hasAudioOptions=e.audio.options.length>0,e.hasTextOptions=e.text.options.length>0,e.hasProfileOptons=e.profile.options.length>0,e.hasRateOptions=!this.IsLive(),e.hasAnyOptions=e.hasQualityOptions||e.hasAudioOptions||e.hasTextOptions||e.hasProfileOptons||e.hasRateOptions,e}AllowRotation(){return this.allowRotation}SetAllowRotation(e){this.allowRotation=e,this.player.__SettingsUpdate()}IsRotatable(){return this.IsFullscreen()&&window.innerWidth<900&&window.innerHeight>window.innerWidth&&this.player.video.videoWidth>this.player.video.videoHeight}RegisterVideoEventListener(e,t){return this.player.__RegisterVideoEventListener(e,t)}RegisterSettingsListener(e){return this.player.__RegisterSettingsListener(e)}Reset(){this.player.Reset()}Destroy(){this.player.Destroy()}}const Fn={PLAY:"play",PAUSE:"pause",MUTE:"muted",UNMUTE:"unmuted",VOLUME_UP:"volumeup",VOLUME_DOWN:"volumedown",SEEK_BACK:"seekback",SEEK_FORWARD:"seekforward",PLAYBACK_RATE_UP:"playbackrateup",PLAYBACK_RATE_DOWN:"playbackratedown",SUBTITLES_ON:"subtitleson",SUBTITLES_OFF:"subtitlesoff",PLAY_NEXT:"playnext",PLAY_PREVIOUS:"playprevious"},Dj=({player:n,setRecentUserAction:e,sideClickRatio:t=.1,doubleClickDelay:r=300})=>{let i,o,u,c;return window.addEventListener("focus",()=>{u=c||document.activeElement,c=document.activeElement},!0),()=>p=>{if(clearTimeout(o),p.target===p.currentTarget&&p.currentTarget.contains(u)&&!p.currentTarget.classList.contains("menu-active"))if(Date.now()-i<r){const h=p.target.getBoundingClientRect(),g=(p.clientX-h.left)/h.width;g<=t?(n.controls.Seek({relativeSeconds:-10}),e({action:Fn.SEEK_BACK,text:"10 seconds"})):g>=1-t?(n.controls.Seek({relativeSeconds:10}),e({action:Fn.SEEK_FORWARD,text:"10 seconds"})):n.controls.ToggleFullscreen()}else o=setTimeout(()=>{const h=n.controls.TogglePlay();e({action:h?Fn.PLAY:Fn.PAUSE})},r);u=p.target,i=Date.now()}},Uj=(n,e)=>{let t=0;return()=>r=>{r.repeat||(t=0);const i=t<5?5:t<15?10:t<40?30:60;switch(r.key){case"ArrowLeft":r.preventDefault(),n.controls.Seek({relativeSeconds:-i}),e({action:Fn.SEEK_BACK,text:`${i} seconds`});break;case"ArrowRight":r.preventDefault(),n.controls.Seek({relativeSeconds:i}),e({action:Fn.SEEK_FORWARD,text:`${i} seconds`});break;default:return}t+=1}},xbe=n=>e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),n.controls.SetVolume({relativeFraction:-.05});break;case"ArrowRight":e.preventDefault(),n.controls.IsMuted()?n.controls.SetVolume({fraction:.05}):n.controls.SetVolume({relativeFraction:.05});break}},j2=(n,e)=>{if(isNaN(e)||!isFinite(e)||e===0)return"00:00";const t=e>60*60,r=Math.floor(n/60/60),i=Math.floor(n/60%60),o=Math.floor(n%60);let u=`${i.toString().padStart(t&&r>0?2:1,"0")}:${o.toString().padStart(2,"0")}`;return t&&(u=`${r.toString()}:${u}`),u},sk=async({player:n,pathOrUrl:e="",width:t})=>{if(typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")))return e;if(e&&e.url)return e.url;const r=await n.__Client();let i;const{mediaCatalogObjectId:o,mediaCatalogVersionHash:u}=n.sourceOptions&&n.sourceOptions.mediaCollectionOptions||{},c=n.sourceOptions&&n.sourceOptions.playoutParameters||{};return u?i=u:o?i=await r.LatestVersionHash({objectId:o}):c.versionHash?i=c.versionHash:i=await r.LatestVersionHash({objectId:c.objectId}),i?(e=e&&e.toString().trim().replace(/^\./,"").replace(/\/+/,""),e.startsWith("files")?await r.FileUrl({versionHash:i,filePath:e.replace(/^files/,""),queryParams:t?{width:t}:{},authorizationToken:c.authorizationToken}):await r.LinkUrl({versionHash:i,linkPath:e,queryParams:t?{width:t}:{},authorizationToken:c.authorizationToken})):""},Fj=(n,e)=>{let t={};return Object.keys(n).forEach(r=>{if(typeof n[r]=="object"&&!Array.isArray(n[r]))t[r]=Fj(n[r],(e||{})[r]);else{const i=(e||{})[r];t[r]=typeof i<"u"?i:n[r]}}),t},Bj=n=>Fj($W,n),_be={default:{label:"Default",hlsSettings:Ch.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Ch.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class $2{__RegisterVideoEventListener(e,t){this.video.addEventListener(e,t),this.__listenerDisposers.push(()=>this.video.removeEventListener(e,t))}__RegisterSettingsListener(e){return this.__settingsListeners.push(e),()=>this.__settingsListeners=this.__settingsListeners.filter(t=>t!==e)}constructor({target:e,video:t,parameters:r,SetErrorMessage:i}){this.loading=!0,this.target=e,this.video=t,this.SetErrorMessage=i,this.controls=new wbe({player:this}),this.__settingsListeners=[],this.__listenerDisposers=[],this.__showPlayerProfileForm=!1,this.playbackStarted=!1,this.reloads=0,this.canPlay=!1;try{r.playerOptions.hlsjsOptions&&Object.keys(r.playerOptions.hlsjsOptions).length>0&&(this.customHLSOptions=r.playerOptions.hlsjsOptions,r.playerOptions.playerProfile=fn.playerProfile.CUSTOM)}catch(o){this.Log(o,!0)}this.__Initialize(r)}async __Client(){return this.clientPromise&&await this.clientPromise,this.clientOptions.client||(this.clientPromise=(async()=>{const{ElvClient:e}=await Promise.resolve().then(()=>Ij);return this.clientOptions.client=await e.FromConfigurationUrl({configUrl:this.clientOptions.network}),this.clientOptions.client.SetStaticToken({token:this.clientOptions.staticToken||this.clientOptions.client.utils.B64(JSON.stringify({qspace_id:await this.clientOptions.client.ContentSpaceId()}))}),this.clientOptions.client})(),await this.clientPromise),this.clientOptions.client}async __PlayoutOptions(){const e=await this.__Client(),t=this.sourceOptions.playoutParameters||{};if(this.collectionInfo){const w=this.collectionInfo.content[this.collectionInfo.mediaIndex];t.objectId=e.utils.DecodeVersionHash(w.mediaHash).objectId,t.versionHash=w.mediaHash,this.sourceOptions.playoutOptions=void 0}let r,i,o={};if((t.clipStart||t.clipEnd)&&(o.clip_start=parseFloat(t.clipStart||0),t.clipEnd&&(o.clip_end=parseFloat(t.clipEnd))),o.ignore_trimming=t.ignoreTrimming,o.resolve=t.resolve,t.offering||t.directLink||(t.offerings||[]).length>0){let w=await e.AvailableOfferings({objectId:t.objectId,versionHash:t.versionHash,writeToken:t.writeToken,linkPath:t.linkPath,directLink:t.directLink,resolveIncludeSource:!0,authorizationToken:t.authorizationToken})||{};if(r=Object.keys(w)[0],t.offering?r=w[t.offering]?t.offering:void 0:(t.offerings||[]).length>0&&(r=t.offerings.find(v=>w[v])),!r)throw new Error(`Unable to find offering from '${t.offering||t.offerings}'`);i=w[r].uri}t.directLink?this.sourceOptions.playoutOptions||(this.sourceOptions.playoutOptions=await e.PlayoutOptions({offeringURI:i,options:o})):this.sourceOptions.playoutOptions||(this.sourceOptions.playoutOptions=await e.PlayoutOptions({...t,offering:r,options:o}));let u=(await e.AvailableDRMs()).filter(w=>(this.sourceOptions.drms||[]).includes(w)),c=this.sourceOptions.protocols,p,h;for(;!(p&&h);)if(p=c.find(w=>this.sourceOptions.playoutOptions[w]),h=this.sourceOptions.drms.find(w=>u.includes(w)&&this.sourceOptions.playoutOptions[p].playoutMethods[w]),!h&&(c=c.filter(w=>w!==p),c.length===0))throw Error("No valid protocol / DRM combination available");const{playoutUrl:g,drms:m}=this.sourceOptions.playoutOptions[p].playoutMethods[h];return{protocol:p,drm:h,playoutUrl:g,drms:m,availableDRMs:u,offeringURI:i,offering:r,sessionId:this.sourceOptions.playoutOptions.sessionId,multiviewOptions:{enabled:this.sourceOptions.playoutOptions.multiview,AvailableViews:this.sourceOptions.playoutOptions.AvailableViews,SwitchView:this.sourceOptions.playoutOptions.SwitchView}}}__CollectionPlay({mediaIndex:e,mediaId:t,autoplay:r}){t&&(e=this.collectionInfo.content.find(i=>i.id===t)),this.collectionInfo.mediaIndex=e,this.__SettingsUpdate(),this.__Initialize(this.originalParameters,this.video?{muted:this.video.muted,volume:this.video.volume,playing:typeof r<"u"?r:!this.video.paused}:null)}async __LoadCollection(){if(this.collectionInfo)return;let{mediaCatalogObjectId:e,mediaCatalogVersionHash:t,collectionId:r}=this.sourceOptions&&this.sourceOptions.mediaCollectionOptions||{};if(!r)return;if(!e&&!t)throw{displayMessage:"Invalid collection options: Media catalog not specified"};const i=await this.__Client();try{const o=this.sourceOptions.playoutParameters.authorizationToken;t=t||await i.LatestVersionHash({objectId:e});const c=(await i.ContentObjectMetadata({versionHash:t,metadataSubtree:"public/asset_metadata/info/collections",authorizationToken:o,produceLinkUrls:!0})||[]).find(p=>p.id===r);if(!c)throw{displayMessage:`No collection with ID ${r} found for media catalog ${e||t}`};c.content=c.content.filter(p=>p.media).map((p,h)=>({...p,active:h===0,mediaId:p.id,mediaIndex:h,mediaHash:p.media&&p.media["/"]&&p.media["/"].split("/").find(g=>g.startsWith("hq__"))})),this.collectionInfo={...c,isPlaylist:c.type==="playlist",mediaIndex:0,mediaLength:c.content.length}}catch(o){throw this.Log("Failed to load collection:"),o}}async __Initialize(e,t){if(!this.__destroyed){this.__Reset(),this.loading=!0,this.initTime=Date.now(),this.__SettingsUpdate(),e&&(this.originalParameters=Bj(e),this.clientOptions=e.clientOptions,this.sourceOptions=e.sourceOptions,this.playerOptions=e.playerOptions),this.isLive=e.sourceOptions.contentInfo.type===fn.type.LIVE,this.errors=0,this.__Client();try{t&&(this.video.volume=t.volume,this.video.muted=t.muted,t.playing&&(this.playerOptions.autoplay=fn.autoplay.ON),t.currentTime&&this.__RegisterVideoEventListener("loadedmetadata",()=>this.video.currentTime=t.currentTime)),this.__RegisterVideoEventListener("play",()=>{this.reloads=0,this.playbackStarted=!0,this.__SettingsUpdate()});const r=()=>{this.canPlay&&!isFinite(this.video.duration)?this.isLive=!0:this.video.duration&&this.videoDuration>0&&Math.abs(this.video.duration-this.videoDuration)>1&&(this.isLive=!0)};this.__RegisterVideoEventListener("canplay",()=>{this.initTime&&!this.initTimeLogged&&(this.Log(`Player initialization: ${((Date.now()-this.initTime)/1e3).toFixed(2)} seconds`),this.initTimeLogged=!0,this.canPlay=!0,r(),this.playerOptions.autoplay===fn.autoplay.ON&&this.controls.Play())}),this.__RegisterVideoEventListener("durationchange",()=>{r(),this.videoDuration=this.video.duration}),await this.__LoadCollection(),this.collectionInfo&&this.collectionInfo.isPlaylist&&this.collectionInfo.mediaIndex<this.collectionInfo.mediaLength-1&&this.__RegisterVideoEventListener("ended",()=>this.controls&&this.controls.CollectionPlayNext({autoplay:!0}));let{protocol:i,drm:o,playoutUrl:u,drms:c,multiviewOptions:p}=await this.__PlayoutOptions();u=new URL(u);const h=this.sourceOptions.playoutParameters.authorizationToken||u.searchParams.get("authorization");if(this.__destroyed)return;i==="hls"?await this.__InitializeHLS({playoutUrl:u,authorizationToken:h,drm:o,drms:c,multiviewOptions:p}):await this.__InitializeDash({playoutUrl:u,authorizationToken:h,drm:o,drms:c,multiviewOptions:p}),this.playerOptions.collectVideoAnalytics&&Promise.resolve().then(()=>require("./Analytics-PI86_hOX.js")).then(({InitializeMuxMonitoring:g})=>g({appName:this.playerOptions.appName||"elv-player-js",elvPlayer:this,playoutUrl:u,authorizationToken:h,disableCookies:this.playerOptions.collectVideoAnalytics===fn.collectVideoAnalytics.DISABLE_COOKIES})),this.playerOptions.playerCallback&&this.playerOptions.playerCallback({player:this,videoElement:this.video,hlsPlayer:this.hlsPlayer,dashPlayer:this.dashPlayer}),this.__destroyed&&this.__DestroyPlayer()}catch(r){let i;if(r&&[401,403].includes(r.status)||[401,403].includes(r.code))try{const o=await this.__Client(),u=this.sourceOptions.playoutParameters.linkPath?await o.LinkTarget({...this.sourceOptions.playoutParameters}):this.sourceOptions.playoutParameters.versionHash||await o.LatestVersionHash({objectId:this.sourceOptions.playoutParameters.objectId});i=await o.ContentObjectMetadata({versionHash:u,metadataSubtree:"public/asset_metadata/permission_message",authorizationToken:this.sourceOptions.playoutParameters.authorizationToken}),i?(r.permission_message=i,this.SetErrorMessage(i),typeof r=="object"?r.permission_message=i:this.Log(i,!0)):this.SetErrorMessage(r.displayMessage||"Insufficient permissions")}catch(o){this.SetErrorMessage(o.displayMessage||"Insufficient permissions")}else r.status===500?this.__HardReload(r,1e4):this.SetErrorMessage(r.displayMessage||"Something went wrong");this.playerOptions.errorCallback&&this.playerOptions.errorCallback(r,this)}finally{this.loading=!1,this.__SettingsUpdate()}}}async __InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,multiviewOptions:i}){if(this.HLS=(await Promise.resolve().then(()=>require("./hls-6O5SV1FQ.js"))).default,["fairplay","sample-aes"].includes(r)||!this.HLS.isSupported()){if(this.nativeHLS=!0,r==="fairplay"?pK({playoutOptions:this.sourceOptions.playoutOptions,video:this.video}):this.video.src=e.toString(),i.enabled){const o=i.SwitchView;i.SwitchView=async u=>{await o(u)}}}else{e.searchParams.delete("authorization");const o=(_be[this.playerOptions.playerProfile]||{}).hlsSettings||{},u=this.playerOptions.playerProfile===fn.playerProfile.CUSTOM?this.customHLSOptions:{};this.hlsOptions={capLevelToPlayerSize:this.playerOptions.capLevelToPlayerSize,...o,...u};const c=new this.HLS({xhrSetup:p=>(p.setRequestHeader("Authorization",`Bearer ${t}`),(this.playerOptions.hlsjsOptions||{}).xhrSetup&&this.playerOptions.hlsjsOptions.xhrSetup(p),p),...this.hlsOptions});if(this.playerOptions.maxBitrate&&c.on(this.HLS.Events.MANIFEST_PARSED,(p,{levels:h,firstLevel:g})=>{let m=h.map((w,v)=>w.bitrate>this.playerOptions.maxBitrate?v:void 0).filter(w=>typeof w<"u").reverse();m.length===h.length&&(this.Log(`Warning: Max bitrate '${this.playerOptions.maxBitrate}bps' is less than all available levels for this content.`),m=m.filter(w=>w>0)),this.Log("Removing the following levels due to maxBitrate setting:"),this.Log(m.map(w=>[h[w].width,"x",h[w].height,` (${(h[w].bitrate/1e3/1e3).toFixed(1)}Mbps)`].join("")).join(", ")),m.find(w=>g===w)&&(c.startLevel=h.map((w,v)=>v).filter(w=>!m.includes(w)).reverse()[0]),m.map(w=>c.removeLevel(w))}),c.loadSource(e.toString()),c.attachMedia(this.video),this.controls&&i.enabled){const p=i.SwitchView;i.SwitchView=async h=>{await p(h),c.nextLevel=c.currentLevel},this.controls.InitializeMultiViewControls(i)}[this.HLS.Events.SUBTITLE_TRACKS_UPDATED,this.HLS.Events.SUBTITLE_TRACK_SWITCH,this.HLS.Events.LEVEL_UPDATED,this.HLS.Events.LEVEL_SWITCHED,this.HLS.Events.AUDIO_TRACKS_UPDATED,this.HLS.Events.AUDIO_TRACK_SWITCHED,this.HLS.Events.MANIFEST_LOADED].map(p=>c.on(p,()=>this.__SettingsUpdate())),this.SetPlayerProfile=async({profile:p,customHLSOptions:h={}})=>{this.videoDuration=void 0,this.playerOptions.playerProfile=p,this.customHLSOptions=h;const g=!this.video.paused,m=this.video.currentTime;this.hlsPlayer.destroy(),await this.__InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,multiviewOptions:i}),g?this.video.play():this.video.pause(),this.isLive||(this.video.currentTime=m)},c.on(this.HLS.Events.FRAG_LOADED,()=>this.errors=0),c.on(this.HLS.Events.ERROR,async(p,h)=>{this.errors+=1,this.Log(`Encountered ${h.details}`,!0),this.Log(h,!0),h.response&&h.response.code===403?this.SetErrorMessage("Insufficient permissions"):this.errors<5?h.fatal&&(h.data&&h.data.type===this.HLS.ErrorTypes.MEDIA_ERROR?(this.Log("Attempting to recover using hlsPlayer.recoverMediaError"),c.recoverMediaError()):this.__HardReload(h)):this.__HardReload(h)}),this.hlsPlayer=c,this.player=c}}async __InitializeDash({playoutUrl:e,authorizationToken:t,drm:r,drms:i}){this.Dash=(await Promise.resolve().then(()=>require("./dash.all.min-YnvCBRhl.js")).then(c=>c.dash_all_min)).default;const o=this.Dash.MediaPlayer().create(),u=this.playerOptions.dashjsOptions||{};if(o.updateSettings({...u,streaming:{buffer:{fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!0,...(u.streaming||{}).buffer||{}},text:{defaultEnabled:!1,...(u.streaming||{}).text||{}},...u.streaming||{}}}),this.playerOptions.capLevelToPlayerSize&&o.updateSettings({streaming:{abr:{limitBitrateByPortal:!0}}}),this.playerOptions.maxBitrate&&o.updateSettings({streaming:{abr:{maxBitrate:{video:this.playerOptions.maxBitrate/1e3}}}}),e.searchParams.delete("authorization"),o.extend("RequestModifier",function(){return{modifyRequestHeader:c=>(c.setRequestHeader("Authorization",`Bearer ${t}`),c),modifyRequestURL:c=>c}}),r===fn.drms.WIDEVINE){const c=i.widevine.licenseServers[0];o.setProtectionData({"com.widevine.alpha":{serverURL:c}})}o.initialize(this.video,e.toString(),this.playerOptions.autoplay===fn.autoplay.ON),[this.Dash.MediaPlayer.events.TRACK_CHANGE_RENDERED,this.Dash.MediaPlayer.events.QUALITY_CHANGE_RENDERED,this.Dash.MediaPlayer.events.REPRESENTATION_SWITCH,this.Dash.MediaPlayer.events.TEXT_TRACKS_ADDED,this.Dash.MediaPlayer.events.TEXT_TRACK_ADDED,this.Dash.MediaPlayer.events.MANIFEST_LOADED,this.Dash.MediaPlayer.events.CAN_PLAY].map(c=>o.on(c,()=>this.__SettingsUpdate())),this.player=o,this.dashPlayer=o}async __Play(){try{return await this.video.play(),!0}catch(e){if(this.Log("Unable to autoplay",!0),this.Log(e,!0),this.playbackStarted=!1,this.playerOptions.muted===fn.muted.OFF_IF_POSSIBLE&&this.video.paused&&!this.video.muted){await new Promise(t=>setTimeout(t,250)),this.Log("Attempting to autoplay muted"),this.video.muted=!0;try{return await this.video.play(),!0}catch{return this.playbackStarted=!1,!1}}else return this.playbackStarted=!1,!1}}__SettingsUpdate(){this.__settingsListeners.forEach(e=>{try{e()}catch(t){this.Log("Failed to call settings listener",!0),this.Log(t,!0)}})}__SetControlsVisibility(e){this.controls.visible!==e&&(this.controls.visible=e,this.__SettingsUpdate())}__DestroyPlayer(){this.__destroyed=!0,this.__Reset()}__Reset(){if(this.player){if(this.Log("Destroying player"),this.video&&this.video.pause(),this.hlsPlayer?this.hlsPlayer.destroy():this.dashPlayer&&this.dashPlayer.destroy(),this.__listenerDisposers.forEach(e=>{try{e()}catch(t){this.Log("Failed to dispose of video event listener",!0),this.Log(t)}}),this.__listenerDisposers=[],this.__showPlayerProfileForm=!1,this.video.mux)try{this.video.mux.destroy()}catch(e){this.Log("Error destroying mux monitoring:"),this.Log(e)}this.nativeHLS=!1,this.hlsPlayer=void 0,this.dashPlayer=void 0,this.player=void 0,this.initTimeLogged=!1,this.canPlay=!1}}async __HardReload(e,t=6e3){if(!this.reloading){if(this.reloading=!0,this.reloads+=1,this.reloads>2){this.SetErrorMessage(e.displayMessage||"Unable to play content");return}try{if(e&&this.playerOptions.restartCallback)try{const i=await this.playerOptions.restartCallback(e);if(i&&typeof i=="boolean"){this.Destroy();return}}catch(i){this.Log("Restart callback failed:"),this.Log(i)}if(this.SetErrorMessage(e.displayMessage||"Something went wrong, reloading player..."),await new Promise(i=>setTimeout(i,t)),this.__destroyed)return;this.Log("Reloading stream");const r=await this.__Client();r&&await r.ResetRegion(),this.restarted=!0,this.SetErrorMessage(void 0),this.__Initialize(this.originalParameters,this.video?{muted:this.video.muted,volume:this.video.volume,currentTime:this.video.currentTime,playing:!this.video.paused}:null)}finally{this.reloading=!1}}}Log(e,t=!1){t?console.error("ELUVIO PLAYER:",e):this.playerOptions.debugLogging&&console.warn("ELUVIO PLAYER:",e)}}$2.EluvioPlayerParameters=fn;$2.EluvioPlayer=$2;var zj=function(){if(typeof Map<"u")return Map;function n(e,t){var r=-1;return e.some(function(i,o){return i[0]===t?(r=o,!0):!1}),r}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(t){var r=n(this.__entries__,t),i=this.__entries__[r];return i&&i[1]},e.prototype.set=function(t,r){var i=n(this.__entries__,t);~i?this.__entries__[i][1]=r:this.__entries__.push([t,r])},e.prototype.delete=function(t){var r=this.__entries__,i=n(r,t);~i&&r.splice(i,1)},e.prototype.has=function(t){return!!~n(this.__entries__,t)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,r){r===void 0&&(r=null);for(var i=0,o=this.__entries__;i<o.length;i++){var u=o[i];t.call(r,u[1],u[0])}},e}()}(),L4=typeof window<"u"&&typeof document<"u"&&window.document===document,H2=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),Sbe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(H2):function(n){return setTimeout(function(){return n(Date.now())},1e3/60)}}(),Ebe=2;function Cbe(n,e){var t=!1,r=!1,i=0;function o(){t&&(t=!1,n()),r&&c()}function u(){Sbe(o)}function c(){var p=Date.now();if(t){if(p-i<Ebe)return;r=!0}else t=!0,r=!1,setTimeout(u,e);i=p}return c}var Abe=20,Mbe=["top","right","bottom","left","width","height","size","weight"],kbe=typeof MutationObserver<"u",Tbe=function(){function n(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Cbe(this.refresh.bind(this),Abe)}return n.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},n.prototype.removeObserver=function(e){var t=this.observers_,r=t.indexOf(e);~r&&t.splice(r,1),!t.length&&this.connected_&&this.disconnect_()},n.prototype.refresh=function(){var e=this.updateObservers_();e&&this.refresh()},n.prototype.updateObservers_=function(){var e=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return e.forEach(function(t){return t.broadcastActive()}),e.length>0},n.prototype.connect_=function(){!L4||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),kbe?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},n.prototype.disconnect_=function(){!L4||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},n.prototype.onTransitionEnd_=function(e){var t=e.propertyName,r=t===void 0?"":t,i=Mbe.some(function(o){return!!~r.indexOf(o)});i&&this.refresh()},n.getInstance=function(){return this.instance_||(this.instance_=new n),this.instance_},n.instance_=null,n}(),jj=function(n,e){for(var t=0,r=Object.keys(e);t<r.length;t++){var i=r[t];Object.defineProperty(n,i,{value:e[i],enumerable:!1,writable:!1,configurable:!0})}return n},Am=function(n){var e=n&&n.ownerDocument&&n.ownerDocument.defaultView;return e||H2},$j=VS(0,0,0,0);function q2(n){return parseFloat(n)||0}function jI(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.reduce(function(r,i){var o=n["border-"+i+"-width"];return r+q2(o)},0)}function Rbe(n){for(var e=["top","right","bottom","left"],t={},r=0,i=e;r<i.length;r++){var o=i[r],u=n["padding-"+o];t[o]=q2(u)}return t}function Obe(n){var e=n.getBBox();return VS(0,0,e.width,e.height)}function Lbe(n){var e=n.clientWidth,t=n.clientHeight;if(!e&&!t)return $j;var r=Am(n).getComputedStyle(n),i=Rbe(r),o=i.left+i.right,u=i.top+i.bottom,c=q2(r.width),p=q2(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==e&&(c-=jI(r,"left","right")+o),Math.round(p+u)!==t&&(p-=jI(r,"top","bottom")+u)),!Pbe(n)){var h=Math.round(c+o)-e,g=Math.round(p+u)-t;Math.abs(h)!==1&&(c-=h),Math.abs(g)!==1&&(p-=g)}return VS(i.left,i.top,c,p)}var Nbe=function(){return typeof SVGGraphicsElement<"u"?function(n){return n instanceof Am(n).SVGGraphicsElement}:function(n){return n instanceof Am(n).SVGElement&&typeof n.getBBox=="function"}}();function Pbe(n){return n===Am(n).document.documentElement}function Ibe(n){return L4?Nbe(n)?Obe(n):Lbe(n):$j}function Dbe(n){var e=n.x,t=n.y,r=n.width,i=n.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,u=Object.create(o.prototype);return jj(u,{x:e,y:t,width:r,height:i,top:t,right:e+r,bottom:i+t,left:e}),u}function VS(n,e,t,r){return{x:n,y:e,width:t,height:r}}var Ube=function(){function n(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=VS(0,0,0,0),this.target=e}return n.prototype.isActive=function(){var e=Ibe(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},n.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},n}(),Fbe=function(){function n(e,t){var r=Dbe(t);jj(this,{target:e,contentRect:r})}return n}(),Bbe=function(){function n(e,t,r){if(this.activeObservations_=[],this.observations_=new zj,typeof e!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=r}return n.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof Am(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new Ube(e)),this.controller_.addObserver(this),this.controller_.refresh())}},n.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof Am(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},n.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},n.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},n.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(r){return new Fbe(r.target,r.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},n.prototype.clearActive=function(){this.activeObservations_.splice(0)},n.prototype.hasActive=function(){return this.activeObservations_.length>0},n}(),Hj=typeof WeakMap<"u"?new WeakMap:new zj,qj=function(){function n(e){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var t=Tbe.getInstance(),r=new Bbe(e,t,this);Hj.set(this,r)}return n}();["observe","unobserve","disconnect"].forEach(function(n){qj.prototype[n]=function(){var e;return(e=Hj.get(this))[n].apply(e,arguments)}});var zbe=function(){return typeof H2.ResizeObserver<"u"?H2.ResizeObserver:qj}();const ok=({element:n,Hide:e})=>{if(!n)return;const t=o=>{o&&(o.key||"").toLowerCase()==="escape"&&e()},r=()=>{setTimeout(()=>{n.contains(document.activeElement)||setTimeout(()=>{n.contains(document.activeElement)||e()},250)})};let i=setTimeout(()=>{document.body.addEventListener("keydown",t),n.addEventListener("focusout",r)},0);return()=>{clearTimeout(i),document.body.removeEventListener("keydown",t),n.removeEventListener("focusout",r)}},Vj=({target:n,video:e,setVideoState:t})=>{const r=function(){const o=e.buffered;let u=0;for(let c=0;c<o.length;c++)o.start(c)>e.currentTime||o.end(c)>u&&(u=o.end(c));t({playing:!e.paused,duration:e.duration,volume:e.volume,muted:e.muted,rate:e.playbackRate,fullscreen:!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)})},i=["play","pause","volumechange","seeked","durationchange","ratechange"];return i.map(o=>e.addEventListener(o,r)),n.addEventListener("fullscreenchange",r),()=>{i.map(o=>e.removeEventListener(o,r)),n.removeEventListener("fullscreenchange",r)}},jbe=({video:n,setBufferFraction:e})=>{const t=()=>{if(!isFinite(n.duration))return 1;const r=n.buffered;let i=0;for(let o=0;o<r.length;o++)r.start(o)>n.currentTime||r.end(o)>i&&(i=r.end(o));e(1-(n.duration-i)/n.duration)};return n.addEventListener("progress",t),()=>n.removeEventListener("progress",t)},uk=({video:n,rate:e=10,setCurrentTime:t})=>{const r=setInterval(()=>{t(n.currentTime)},1e3/e);return()=>{clearInterval(r)}},$be=({target:n,setSize:e,setOrientation:t,setDimensions:r})=>{let i;const o=new zbe(u=>{clearTimeout(i);const c=u[0].contentRect;let p="sm",h="landscape";c.width>1400?p="xl":c.width>1e3?p="lg":c.width>650&&(p="md"),c.width<c.height&&(h="portrait"),e(p),t(h),i=setTimeout(()=>{r({width:c.width,height:c.height})},500)});return o.observe(n),()=>o.disconnect()},Hbe=({player:n})=>{const e=n.video,t=n.playerOptions.autoplay===fn.autoplay.WHEN_VISIBLE,r=n.playerOptions.muted===fn.muted.WHEN_NOT_VISIBLE;if(!t&&!r)return;let i,o;const u=async([p])=>{t&&(i!=="play"&&p.isIntersecting&&e.paused?(n.controls.Play(),i="play"):i!=="pause"&&!p.isIntersecting&&!e.paused&&(n.controls.Pause(),i="pause")),r&&(o!=="unmute"&&p.isIntersecting&&e.muted?(e.muted=!1,o="unmute"):o!=="mute"&&!p.isIntersecting&&!e.muted&&(e.muted=!0,o="mute"))},c=new window.IntersectionObserver(u,{threshold:.1}).observe(e);return()=>c&&c.disconnect()},qbe=({player:n,inactivityPeriod:e=3e3,onSleep:t,onWake:r})=>{let i;const o=p=>{clearTimeout(i),r&&r(),i=setTimeout(()=>{t&&t()},p.type==="mouseout"?500:e)},u=["play","pause","volumechange","seeking"];u.forEach(p=>n.video.addEventListener(p,o));const c=["click","dblclick","keydown","mousemove","touchmove","blur","mouseout","fullscreenchange"];return c.forEach(p=>n.target.addEventListener(p,o)),()=>{u.map(p=>n.video.removeEventListener(p,o)),c.map(p=>n.target.removeEventListener(p,o))}},Vbe=({player:n,setRecentUserAction:e})=>{if(n.playerOptions.keyboardControls===fn.keyboardControls.OFF)return;const t=n.playerOptions.keyboardControls===fn.keyboardControls.ARROW_KEYS_DISABLED,r=Uj(n,e)(),i=o=>{if(!(n.target===o.target||n.target.contains(o.target))||["button","input"].includes(document.activeElement&&document.activeElement.tagName.toLowerCase())||n.__showPlayerProfileForm)return;let u;switch(o.key){case" ":case"k":u=n.controls.TogglePlay(),e({action:u?Fn.PLAY:Fn.PAUSE});break;case"f":n.controls.ToggleFullscreen();break;case"m":u=n.controls.ToggleMuted(),e({action:u?Fn.MUTE:Fn.UNMUTE});break;case"ArrowDown":t||(u=n.controls.SetVolume({relativeFraction:-.1}),e({action:u===0?Fn.MUTE:Fn.VOLUME_DOWN,text:(u*100).toFixed(0)+"%"}));break;case"ArrowUp":t||(u=n.controls.SetVolume({relativeFraction:.1}),e({action:Fn.VOLUME_UP,text:(u*100).toFixed(0)+"%"}));break;case",":n.video.paused&&(n.controls.Seek({relativeSeconds:-1/60}),e({action:Fn.SEEK_BACK}));break;case".":n.video.paused&&(n.controls.Seek({relativeSeconds:1/60}),e({action:Fn.SEEK_FORWARD}));break;case"ArrowLeft":case"ArrowRight":t||r(o);break;case"j":n.controls.Seek({relativeSeconds:-10}),e({action:Fn.SEEK_BACK,text:"10 seconds"});break;case"l":n.controls.Seek({relativeSeconds:10}),e({action:Fn.SEEK_FORWARD,text:"10 seconds"});break;case"<":case">":const c=n.controls.GetPlaybackRates();c.active?u=n.controls.SetPlaybackRate({index:c.active.index+(o.key==="<"?-1:1)}):u=n.controls.SetPlaybackRate({rate:1}),e({action:u.increase?Fn.PLAYBACK_RATE_UP:Fn.PLAYBACK_RATE_DOWN,text:`${u.rate.toFixed(2)}x`});break;case"c":u=n.controls.ToggleTextTrack(),e({action:u?Fn.SUBTITLES_ON:Fn.SUBTITLES_OFF});break;case"P":n.controls.CollectionPlayPrevious(),e({action:Fn.PLAY_PREVIOUS});break;case"N":n.controls.CollectionPlayNext(),e({action:Fn.PLAY_NEXT});break;case"Home":n.controls.Seek({fraction:0}),e({action:Fn.SEEK_BACK});break;case"End":n.controls.Seek({fraction:1}),e({action:Fn.SEEK_FORWARD});break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":u=n.controls.Seek({fraction:parseFloat(o.key)*.1}),e({action:u?Fn.SEEK_FORWARD:Fn.SEEK_BACK});break;default:return}o.preventDefault()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},Gbe=({player:n})=>{if("mediaSession"in navigator){const e=["play","pause","stop","seekbackward","seekforward","seekto","previoustrack","nexttrack"];e.forEach(i=>{navigator.mediaSession.setActionHandler(i,o=>{switch(i){case"play":n.controls.Play();break;case"pause":n.controls.Pause();break;case"stop":n.controls.Stop();break;case"seekbackward":n.controls.Seek({relativeSeconds:o&&o.seekOffset||-10});break;case"seekforward":n.controls.Seek({relativeSeconds:o&&o.seekOffset||10});break;case"seekto":o&&typeof o.seekTime<"u"&&n.controls.Seek({time:o.seekTime});break;case"previoustrack":n.controls.CollectionPlayPrevious();break;case"nexttrack":n.controls.CollectionPlayNext();break}})});let t=setInterval(()=>{navigator.mediaSession.playbackState=n.video.paused?"paused":"playing",navigator.mediaSession.setPositionState({duration:isFinite(n.video.duration)?n.video.duration||0:n.video.currentTime+1,playbackRate:n.video.playbackRate,position:n.video.currentTime})},1e3);const r=n.controls.RegisterSettingsListener(()=>{const{title:i}=n.controls.GetContentInfo()||{};(!navigator.mediaSession.metadata||navigator.mediaSession.metadata.title!==i)&&(navigator.mediaSession.metadata=new MediaMetadata({title:i}))});return()=>{clearInterval(t),r&&r(),navigator.mediaSession.metadata=null,e.forEach(i=>{navigator.mediaSession.setActionHandler(i,null)})}}},Wbe="_container_iwa6d_1",Kbe="_autohide_iwa6d_40",Ybe="_seek_iwa6d_157",Jbe="_controls_iwa6d_190",Qbe="_time_iwa6d_204",Zbe="_spacer_iwa6d_253",Xbe="_watermark_iwa6d_265",eve="_menu_iwa6d_36",ir={container:Wbe,"container--default-controls":"_container--default-controls_iwa6d_32","bottom-controls-container":"_bottom-controls-container_iwa6d_36",autohide:Kbe,"info-container":"_info-container_iwa6d_40","bottom-controls-container--autohide":"_bottom-controls-container--autohide_iwa6d_41","icon-button":"_icon-button_iwa6d_47","icon-button-active":"_icon-button-active_iwa6d_61","info-image-container":"_info-image-container_iwa6d_90","info-image":"_info-image_iwa6d_90","info-text":"_info-text_iwa6d_106","info-headers":"_info-headers_iwa6d_115","info-description":"_info-description_iwa6d_125","info-title":"_info-title_iwa6d_131","info-subtitle":"_info-subtitle_iwa6d_136","center-play-button":"_center-play-button_iwa6d_144","center-play-button--hidden":"_center-play-button--hidden_iwa6d_150",seek:Ybe,"bottom-controls-gradient":"_bottom-controls-gradient_iwa6d_177",controls:Jbe,"play-pause-button":"_play-pause-button_iwa6d_200",time:Qbe,"live-indicator":"_live-indicator_iwa6d_213","collection-button-container":"_collection-button-container_iwa6d_223","collection-button-text":"_collection-button-text_iwa6d_228","collection-button-container--loading":"_collection-button-container--loading_iwa6d_237",spacer:Zbe,"floating-volume-toggle":"_floating-volume-toggle_iwa6d_257",watermark:Xbe,"menu-control-container":"_menu-control-container_iwa6d_277",menu:eve},Gj='<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"> <circle cx="16" cy="16" r="16" fill="currentColor"/> <path d="M22 15.5L13.75 21.1292L13.75 9.87083L22 15.5Z" fill="black"/></svg>',Wj='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-play"><polygon points="5 3 19 12 5 21 5 3"></polygon></svg>',Kj='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve"><circle cx="16" cy="16" r="16" fill="currentColor"/><path d="M22.8,16l-11.6,7V9L22.8,16z" fill="black"/></svg>',tve='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-pause"><rect x="6" y="4" width="4" height="16"></rect><rect x="14" y="4" width="4" height="16"></rect></svg>',Yj='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve"><circle cx="16" cy="16" r="16" fill="currentColor"/><g> <rect x="10.4" y="9" width="4.5" height="14.1" fill="black"/> <rect x="17.5" y="9" width="4.5" height="14.1" fill="black"/></g></svg>',nve='<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1.46154 18.9985L5.84615 18.9942C6.03997 18.9942 6.22584 18.9172 6.36289 18.7801C6.49993 18.6431 6.57692 18.4572 6.57692 18.2634C6.57692 18.0696 6.49993 17.8837 6.36289 17.7467C6.22584 17.6096 6.03997 17.5326 5.84615 17.5326L1.46154 17.537V13.1538C1.46154 12.96 1.38455 12.7742 1.2475 12.6371C1.11046 12.5001 0.924581 12.4231 0.730769 12.4231C0.536957 12.4231 0.351083 12.5001 0.214037 12.6371C0.0769915 12.7742 0 12.96 0 13.1538V19H1.46154V18.9985ZM1.46154 0.00146249V3.57628e-07H0V5.84615C0 6.03997 0.0769915 6.22584 0.214037 6.36289C0.351083 6.49993 0.536957 6.57692 0.730769 6.57692C0.924581 6.57692 1.11046 6.49993 1.2475 6.36289C1.38455 6.22584 1.46154 6.03997 1.46154 5.84615V1.463L5.84615 1.46738C6.03997 1.46738 6.22584 1.39039 6.36289 1.25335C6.49993 1.1163 6.57692 0.930427 6.57692 0.736615C6.57692 0.542803 6.49993 0.35693 6.36289 0.219884C6.22584 0.0828385 6.03997 0.00584609 5.84615 0.00584609L1.46154 0.00146249V0.00146249ZM17.5385 18.9985V19H19V13.1538C19 12.96 18.923 12.7742 18.786 12.6371C18.6489 12.5001 18.463 12.4231 18.2692 12.4231C18.0754 12.4231 17.8895 12.5001 17.7525 12.6371C17.6155 12.7742 17.5385 12.96 17.5385 13.1538V17.537L13.1538 17.5326C12.96 17.5326 12.7742 17.6096 12.6371 17.7467C12.5001 17.8837 12.4231 18.0696 12.4231 18.2634C12.4231 18.4572 12.5001 18.6431 12.6371 18.7801C12.7742 18.9172 12.96 18.9942 13.1538 18.9942L17.5385 18.9985V18.9985ZM17.5385 0.00146249L13.1538 0.00584609C12.96 0.00584609 12.7742 0.0828385 12.6371 0.219884C12.5001 0.35693 12.4231 0.542803 12.4231 0.736615C12.4231 0.930427 12.5001 1.1163 12.6371 1.25335C12.7742 1.39039 12.96 1.46738 13.1538 1.46738L17.5385 1.463V5.84615C17.5385 6.03997 17.6155 6.22584 17.7525 6.36289C17.8895 6.49993 18.0754 6.57692 18.2692 6.57692C18.463 6.57692 18.6489 6.49993 18.786 6.36289C18.923 6.22584 19 6.03997 19 5.84615V3.57628e-07H17.5385V0.00146249V0.00146249Z" fill="currentColor"/></svg>',rve='<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 51.94 50.82"><defs><style>.cls-1{fill:none;stroke:#fff;stroke-linecap:round;stroke-miterlimit:10;stroke-width:4px;}</style></defs><polyline class="cls-1" points="12.1 49.82 12.1 35.59 1 35.59"/><polyline class="cls-1" points="39.84 1 39.84 15.22 50.94 15.22"/><polyline class="cls-1" points="12.1 1 12.1 15.22 1 15.22"/><polyline class="cls-1" points="39.84 49.82 39.84 35.59 50.94 35.59"/></svg>',ave='<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_363_9540)"><path d="M16.0889 9.77734C12.6223 9.77734 9.8667 12.5329 9.8667 15.9996C9.8667 19.4662 12.6223 22.2218 16.0889 22.2218C19.5556 22.2218 22.3111 19.4662 22.3111 15.9996C22.3111 12.5329 19.5556 9.77734 16.0889 9.77734ZM16.0889 20.444C13.6 20.444 11.6445 18.4885 11.6445 15.9996C11.6445 13.5107 13.6 11.5551 16.0889 11.5551C18.5778 11.5551 20.5334 13.5107 20.5334 15.9996C20.5334 18.4885 18.5778 20.444 16.0889 20.444Z" fill="currentColor"/><path d="M29.1556 13.0662L26.6667 12.2662L26.1334 10.9329L27.3778 8.62179C27.6445 8.08845 27.5556 7.37734 27.1112 6.9329L24.9778 4.79957C24.5334 4.35512 23.8223 4.26623 23.2889 4.5329L20.9778 5.77734L19.6445 5.24401L18.8445 2.75512C18.6667 2.22179 18.1334 1.77734 17.5112 1.77734H14.4889C13.8667 1.77734 13.3334 2.22179 13.2445 2.84401L12.4445 5.3329C11.9112 5.42179 11.4667 5.59957 11.0223 5.86623L8.71117 4.62179C8.17783 4.35512 7.46672 4.44401 7.02228 4.88845L4.88894 7.02179C4.4445 7.46623 4.35561 8.17734 4.62228 8.71068L5.77783 10.9329C5.60005 11.3773 5.42228 11.9107 5.2445 12.3551L2.75561 13.1551C2.22228 13.3329 1.77783 13.8662 1.77783 14.4885V17.5107C1.77783 18.1329 2.22228 18.6662 2.8445 18.844L5.33339 19.644L5.86672 20.9773L4.62228 23.2885C4.35561 23.8218 4.4445 24.5329 4.88894 24.9773L7.02228 27.1107C7.46672 27.5551 8.17783 27.644 8.71117 27.3773L11.0223 26.1329L12.3556 26.6662L13.1556 29.244C13.3334 29.7773 13.8667 30.2218 14.4889 30.2218H17.5112C18.1334 30.2218 18.6667 29.7773 18.8445 29.244L19.6445 26.6662L20.9778 26.1329L23.2889 27.3773C23.8223 27.644 24.5334 27.5551 24.9778 27.1107L27.1112 24.9773C27.5556 24.5329 27.6445 23.8218 27.3778 23.2885L26.1334 20.9773L26.6667 19.644L29.2445 18.844C29.7778 18.6662 30.2223 18.1329 30.2223 17.5107V14.4885C30.2223 13.8662 29.7778 13.244 29.1556 13.0662ZM28.4445 17.244L25.2445 18.2218L25.1556 18.6662L24.3556 20.5329L24.0889 20.9773L25.6889 23.9107L23.9112 25.6885L20.9778 24.0885L20.5334 24.3551C19.9112 24.7107 19.2889 24.9773 18.6667 25.1551L18.2223 25.244L17.2445 28.444H14.7556L13.7778 25.244L13.3334 25.1551L11.4667 24.3551L11.0223 24.0885L8.08894 25.6885L6.31117 23.9107L7.91117 20.9773L7.6445 20.5329C7.28894 19.9107 7.02228 19.2885 6.8445 18.6662L6.75561 18.2218L3.55561 17.244V14.7551L6.57783 13.8662L6.75561 13.4218C6.93339 12.7107 7.20005 12.0885 7.55561 11.4662L7.82228 11.0218L6.31117 8.08846L8.08894 6.31068L10.9334 7.91068L11.3778 7.64401C12.0001 7.28846 12.6223 7.02179 13.3334 6.84401L13.7778 6.66623L14.7556 3.55512H17.2445L18.2223 6.66623L18.6667 6.84401C19.2889 7.02179 19.9112 7.28846 20.5334 7.64401L20.9778 7.91068L23.9112 6.31068L25.6889 8.08846L24.0889 11.0218L24.3556 11.4662C24.7112 12.0885 24.9778 12.7107 25.1556 13.3329L25.2445 13.7773L28.4445 14.7551V17.244Z" fill="currentColor"/></g><defs><clipPath id="clip0_363_9540"><rect width="32" height="32" fill="currentColor"/></clipPath></defs></svg>',lk='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 13 12" style="enable-background:new 0 0 10.2 12;" xml:space="preserve"><path d="M5.3,1.4c0.1,0,0.1,0.1,0.2,0.2c0,0.1,0.1,0.2,0.1,0.2v7.4c0,0.1,0,0.2-0.1,0.2c0,0.1-0.1,0.1-0.2,0.2c-0.1,0-0.2,0.1-0.3,0 c-0.1,0-0.2,0-0.2-0.1L2.6,7.8H0.5c-0.1,0-0.2,0-0.3-0.1C0,7.6,0,7.5,0,7.4V3.7c0-0.1,0-0.2,0.1-0.3c0.1-0.1,0.2-0.1,0.3-0.1h2.1 l2.2-1.7C4.9,1.4,4.9,1.4,5,1.4C5.1,1.4,5.2,1.4,5.3,1.4L5.3,1.4z" fill="currentColor"/><g> <rect x="7.7" y="3.4" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -1.4992 7.4586)" width="1.2" height="4.2" fill="currentColor"/> <rect x="6.1" y="4.9" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -1.5119 7.4281)" width="4.2" height="1.2" fill="currentColor"/></g></svg>',Jj='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 13 12" style="enable-background:new 0 0 10.2 12;" xml:space="preserve"><path d="M7.1,8.5C7.5,8.1,7.8,7.6,8,7.1c0.2-0.5,0.3-1,0.3-1.6C8.3,5,8.2,4.5,8,4C7.8,3.4,7.5,3,7.1,2.6L6.5,3.3 c0.3,0.3,0.5,0.7,0.7,1c0.2,0.4,0.2,0.8,0.2,1.2c0,0.4-0.1,0.8-0.2,1.2C7,7.2,6.8,7.5,6.5,7.8L7.1,8.5z M5.3,1.4 c0.1,0,0.1,0.1,0.2,0.2c0,0.1,0.1,0.2,0.1,0.2v7.4c0,0.1,0,0.2-0.1,0.2c0,0.1-0.1,0.1-0.2,0.2c-0.1,0-0.2,0.1-0.3,0 c-0.1,0-0.2,0-0.2-0.1L2.6,7.8H0.5c-0.1,0-0.2,0-0.3-0.1C0,7.6,0,7.5,0,7.4V3.7c0-0.1,0-0.2,0.1-0.3c0.1-0.1,0.2-0.1,0.3-0.1h2.1 l2.2-1.7C4.9,1.4,4.9,1.4,5,1.4C5.1,1.4,5.2,1.4,5.3,1.4L5.3,1.4z" fill="currentColor"/></svg>',ive='<?xml version="1.0" encoding="utf-8"?><!-- Generator: Adobe Illustrator 26.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 13 12" style="enable-background:new 0 0 10.2 12;" xml:space="preserve"><path d="M8.4,9.8c0.6-0.6,1-1.2,1.3-1.9c0.3-0.7,0.5-1.5,0.5-2.3c0-0.8-0.2-1.6-0.5-2.3C9.4,2.5,9,1.9,8.4,1.3L7.8,2 c0.5,0.5,0.8,1,1.1,1.6c0.3,0.6,0.4,1.3,0.4,1.9c0,0.7-0.1,1.3-0.4,1.9C8.6,8.1,8.2,8.7,7.8,9.1L8.4,9.8z" fill="currentColor"/><path d="M7.1,8.5C7.5,8.1,7.8,7.6,8,7.1c0.2-0.5,0.3-1,0.3-1.6C8.3,5,8.2,4.5,8,4C7.8,3.4,7.5,3,7.1,2.6L6.5,3.3 c0.3,0.3,0.5,0.7,0.7,1c0.2,0.4,0.2,0.8,0.2,1.2c0,0.4-0.1,0.8-0.2,1.2C7,7.2,6.8,7.5,6.5,7.8L7.1,8.5z M5.3,1.4 c0.1,0,0.1,0.1,0.2,0.2c0,0.1,0.1,0.2,0.1,0.2v7.4c0,0.1,0,0.2-0.1,0.2c0,0.1-0.1,0.1-0.2,0.2c-0.1,0-0.2,0.1-0.3,0 c-0.1,0-0.2,0-0.2-0.1L2.6,7.8H0.5c-0.1,0-0.2,0-0.3-0.1C0,7.6,0,7.5,0,7.4V3.7c0-0.1,0-0.2,0.1-0.3c0.1-0.1,0.2-0.1,0.3-0.1h2.1 l2.2-1.7C4.9,1.4,4.9,1.4,5,1.4C5.1,1.4,5.2,1.4,5.3,1.4L5.3,1.4z" fill="currentColor"/></svg>',V2='<svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.71196 11.08C10.4407 10.3533 11.0186 9.4898 11.4125 8.53906C11.8064 7.58832 12.0085 6.56911 12.0072 5.54C12.0085 4.51089 11.8064 3.49168 11.4125 2.54094C11.0186 1.5902 10.4407 0.726679 9.71196 0L9.05933 0.65171C9.7023 1.2929 10.2122 2.05484 10.5598 2.89374C10.9073 3.73264 11.0856 4.63196 11.0845 5.54C11.0845 7.44904 10.3102 9.17741 9.05933 10.4283L9.71196 11.08V11.08Z" fill="currentColor"/><path d="M8.40781 9.77644C8.96502 9.2207 9.40692 8.56034 9.70812 7.83329C10.0093 7.10624 10.1639 6.32683 10.1629 5.53986C10.1639 4.75289 10.0093 3.97349 9.70812 3.24644C9.40692 2.51939 8.96502 1.85902 8.40781 1.30328L7.7561 1.95499C8.22759 2.42525 8.60149 2.98403 8.85634 3.59924C9.11119 4.21445 9.24195 4.87396 9.24112 5.53986C9.2422 6.20586 9.11164 6.8655 8.85694 7.48087C8.60225 8.09625 8.22845 8.65522 7.75703 9.12565L8.40781 9.77644Z" fill="currentColor"/><path d="M7.10429 8.47307C7.49005 8.08831 7.79596 7.6311 8.00446 7.12773C8.21296 6.62436 8.31993 6.08475 8.31922 5.53991C8.31993 4.99507 8.21296 4.45546 8.00446 3.95209C7.79596 3.44872 7.49005 2.99152 7.10429 2.60675L6.45258 3.25846C6.75261 3.55774 6.99054 3.91337 7.15269 4.30489C7.31483 4.69642 7.39801 5.11614 7.39742 5.53991C7.39795 5.96368 7.31476 6.38338 7.15261 6.7749C6.99047 7.16642 6.75257 7.52205 6.45258 7.82136L7.10429 8.47307ZM5.26991 1.43791C5.348 1.47553 5.4139 1.53441 5.46004 1.60778C5.50618 1.68115 5.5307 1.76605 5.53078 1.85272V9.2271C5.53066 9.31383 5.50607 9.39876 5.45984 9.47214C5.4136 9.54551 5.34761 9.60436 5.26943 9.64191C5.19125 9.67945 5.10407 9.69418 5.01789 9.6844C4.93172 9.67462 4.85005 9.64072 4.78228 9.5866L2.60408 7.8444H0.460899C0.338661 7.8444 0.221429 7.79585 0.134994 7.70941C0.0485588 7.62298 0 7.50574 0 7.38351V3.69632C0 3.57408 0.0485588 3.45685 0.134994 3.37041C0.221429 3.28398 0.338661 3.23542 0.460899 3.23542H2.60408L4.78228 1.49322C4.8501 1.43901 4.93185 1.40506 5.01812 1.39527C5.1044 1.38549 5.19168 1.40027 5.26991 1.43791V1.43791Z" fill="currentColor"/></svg>',sve='<svg width="25" height="16" viewBox="0 0 25 16" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M1.5 8L24 8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M8.5 1L1.5 8L8.5 15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',$I='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M62.8896 63.918L62.8897 28.2377L34.8552 46.0779L62.8896 63.918Z" fill="currentColor"/><path d="M45.3281 63.918L45.3281 28.2377L17.2937 46.0779L45.3281 63.918Z" fill="currentColor"/></svg>',ove='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="45.2374" cy="45.798" r="45.2374" fill="currentColor"/><path d="M62.8896 63.918L62.8897 28.2377L34.8552 46.0779L62.8896 63.918Z" fill="black"/><path d="M45.3281 63.918L45.3281 28.2377L17.2937 46.0779L45.3281 63.918Z" fill="black"/></svg>',HI='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M26.8555 28.9512V64.6314L54.8899 46.7913L26.8555 28.9512Z" fill="currentColor"/><path d="M44.417 28.9512V64.6314L72.4515 46.7913L44.417 28.9512Z" fill="currentColor"/></svg>',uve='<svg width="91" height="92" viewBox="0 0 91 92" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="45.7169" cy="45.796" r="45.2374" fill="currentColor"/><path d="M26.8555 28.9512V64.6314L54.8899 46.7913L26.8555 28.9512Z" fill="black"/><path d="M44.417 28.9512V64.6314L72.4515 46.7913L44.417 28.9512Z" fill="black"/></svg>',ck='<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 30.8 32" style="enable-background:new 0 0 30.8 32;" xml:space="preserve"><g> <path d="M3.1,16L30.8,0v32L3.1,16z" fill="currentColor"/> <rect y="3.7" width="6.2" height="24.6" fill="currentColor"/></g></svg>',fk='<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 30.8 32" style="enable-background:new 0 0 30.8 32;" xml:space="preserve"><g> <path d="M27.7,16L0,32V0L27.7,16z" fill="currentColor"/> <rect x="24.6" y="3.7" width="6.2" height="24.6" fill="currentColor"/></g></svg>',Qj='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list"><line x1="8" y1="6" x2="21" y2="6"></line><line x1="8" y1="12" x2="21" y2="12"></line><line x1="8" y1="18" x2="21" y2="18"></line><line x1="3" y1="6" x2="3.01" y2="6"></line><line x1="3" y1="12" x2="3.01" y2="12"></line><line x1="3" y1="18" x2="3.01" y2="18"></line></svg>',mv='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right"><polyline points="9 18 15 12 9 6"></polyline></svg>',lve='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>',cve='<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-badge-cc" width="48" height="48" viewBox="0 0 24 24" stroke="black" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <rect x="3" y="5" width="18" height="14" rx="2" stroke="currentColor"></rect> <path d="M10 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path> <path d="M17 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path></svg>',fve='<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-badge-cc" width="48" height="48" viewBox="0 0 24 24" stroke="black" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round"> <path stroke="none" d="M0 0h24v24H0z" fill="none"></path> <rect x="3" y="5" width="18" height="14" rx="2" stroke="currentColor"></rect> <path d="M10 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path> <path d="M17 10.5a1.5 1.5 0 0 0 -3 0v3a1.5 1.5 0 0 0 3 0" stroke="currentColor"></path> <path d="M3 3l18 18" stroke="currentColor"></path></svg>',dve='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rotate-cw"><polyline points="23 4 23 10 17 10"></polyline><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"></path></svg>';(function(n,e){(function(t,r){r()})(Va,function(){function t(i){var o=!0,u=!1,c=null,p={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function h(W){return!!(W&&W!==document&&W.nodeName!=="HTML"&&W.nodeName!=="BODY"&&"classList"in W&&"contains"in W.classList)}function g(W){var pe=W.type,ce=W.tagName;return!!(ce==="INPUT"&&p[pe]&&!W.readOnly||ce==="TEXTAREA"&&!W.readOnly||W.isContentEditable)}function m(W){W.classList.contains("focus-visible")||(W.classList.add("focus-visible"),W.setAttribute("data-focus-visible-added",""))}function w(W){W.hasAttribute("data-focus-visible-added")&&(W.classList.remove("focus-visible"),W.removeAttribute("data-focus-visible-added"))}function v(W){W.metaKey||W.altKey||W.ctrlKey||(h(i.activeElement)&&m(i.activeElement),o=!0)}function C(W){o=!1}function T(W){h(W.target)&&(o||g(W.target))&&m(W.target)}function R(W){h(W.target)&&(W.target.classList.contains("focus-visible")||W.target.hasAttribute("data-focus-visible-added"))&&(u=!0,window.clearTimeout(c),c=window.setTimeout(function(){u=!1},100),w(W.target))}function O(W){document.visibilityState==="hidden"&&(u&&(o=!0),I())}function I(){document.addEventListener("mousemove",K),document.addEventListener("mousedown",K),document.addEventListener("mouseup",K),document.addEventListener("pointermove",K),document.addEventListener("pointerdown",K),document.addEventListener("pointerup",K),document.addEventListener("touchmove",K),document.addEventListener("touchstart",K),document.addEventListener("touchend",K)}function D(){document.removeEventListener("mousemove",K),document.removeEventListener("mousedown",K),document.removeEventListener("mouseup",K),document.removeEventListener("pointermove",K),document.removeEventListener("pointerdown",K),document.removeEventListener("pointerup",K),document.removeEventListener("touchmove",K),document.removeEventListener("touchstart",K),document.removeEventListener("touchend",K)}function K(W){W.target.nodeName&&W.target.nodeName.toLowerCase()==="html"||(o=!1,D())}document.addEventListener("keydown",v,!0),document.addEventListener("mousedown",C,!0),document.addEventListener("pointerdown",C,!0),document.addEventListener("touchstart",C,!0),document.addEventListener("visibilitychange",O,!0),I(),i.addEventListener("focus",T,!0),i.addEventListener("blur",R,!0),i.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&i.host?i.host.setAttribute("data-js-focus-visible",""):i.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window<"u"&&typeof document<"u"){window.applyFocusVisiblePolyfill=t;var r;try{r=new CustomEvent("focus-visible-polyfill-ready")}catch{r=document.createEvent("CustomEvent"),r.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(r)}typeof document<"u"&&t(document)})})();const Zj="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAW0AAABSCAYAAACfWoXuAAAACXBIWXMAAC4jAAAuIwF4pT92AAAMX0lEQVR4nO2d/XEbtxbF4Tf+N5ptIEO6gYipQHQDz3QDT0wDkfIKiKUGYvk1IKqBJzoNmKwgZBoINWmApgtQBtJdaSUtDrDLXewCOL8ZjsciRe0H9uDifuC+ur29VYQQQsLgNe8TISRBhkqpUeGVKaWOHC7DV6XUSim1lX8Xhf97Ibe0x5Hds/yC2jCd90ZeoZEPvjIWAZ6PqnFOQ3mVEep9LQM9s77vdSb3qQyvgmZhItdN/zto+LvXct1njtpTm1y0Y/ORLB0nItN5nyulzho+Jh8sgLXwKsDzUTXOST+Q14bPr4G4hISelP4yHO9nuQY+0c/aF8Pfe9uxwaCv1VReTQu1iRul1IUIeOMT1r+a/kJCOmYuD00Zh8AKD4kpONY5B+AdQxFNPbl98CjYSv7WRxmHZ2ClWAuKNokRJFynEZyvSbR3IlQpk4mVq8X6uOPrcCATxk2TK3eKNomRC3BOvl0HTTMCVqPJLZQKExHIk4bOdymvfcnFe9WEe47ZIyRGNuK/Piw5t4H4YEMNzKKVQqpWdibn/q7G7y4LGSAbhyDiuBB4HTtmnOTo8fjHvjEzm2h/bTsS2hIhHjNpFm1tXxq+cRqwaL83/Pwm4HPah5EIdtkEbeJKXGh1/P/5Nc5/NxMLf1Jh0vhQyGKpHKi0ifYqwnRAkgZzINrvLcG8vjKRpXYZKVrZI7GUTdekyE6CgxcNZ3Rs5drPJPh55uhLP5IJYFrVyKRPm8TKViyqMg4CFW10zKmJ9lRcDS6CfS5usbOWc8Y3clxvJPXSxqFMOpX83BRtEjNo+RtaQDIDy+9lREVDLkzBKqqIjmv86EGsn7OR8aVz1P+2fPagqnBTtEnMzGVZXMa7pvNnWwZNMilZ2Vrc/ufwuXP5bJfxLe3++MHB6tbC/bvreKRok9hBFllILhJT1sguoYIa7TPWVul34DM7iVn0paJ5KxPuueVz37sGkinaJHaQFRqKaA9BdsR1j/b2aBs9OSEf9k4CfH2cxPQk8pPlM4eWGoM7KNokdlbi2ywjlLJ25mbfix5K68sFu8/pvjMH4T6xxVso2iQFQre2TQ9xKrnZI8ltNvEtAMHOcRHuK+TfpmiTFAhZtMegbD0VK9t2nj8HVlA3A+moSlxARp88RZukwBZE8Ac936419dzsU4tb5FOg12EK3HZK3CSl45KiTVIBPdh93vnPVLaeQm52Zsm6WAe6733ORFw7JkqDkhRtkgooZ9skjF0zTbxs/dSSLXIaeOaMnnR/Be8flW0jQtEmKWHK2T7oaYWk6ZhSyc3+Bbx3FUkQ9gI07VBlKwmKNkmJkAKSqGw9hdxstMr4Frhb5Dlo7B09T0ulaJOUWAGrpm9l7QxAmvktMn/+wtJs4cm1oGiT1Ailq41JtFPIzUYVoCrSSQuNyyd53RRtkhoh9I9EopWClY0mz6tIs2ZQQ+onMReKNkmNDcjZ7ktZe+pl66l2m0f3lqJNkgY9+H0ISJoszRRys9EqQ1uiqYr2Q+ofRZukyAzkbHct2qmXraP2hrH78jegSnKQrwIp2iRVrg3n3XVZu2nSSCU3G4l2CuePJqa7FRhFm6QKitZ3ZW1noDozlX2z0YSZwo6GaGK6uzYUbZIqKGfbtnVmW7DbutmfvU5k0kITE0WbJI/J2u6qrD31fbNT9mcXQU07KNokafrUrX0IytZTsbKRaySk/bL3BZ3rmKJNUmYDyoePPZe1s9s6vt6xpzoWQeeaUbRJ6jgVNHjAFPxMITc7h5b2PdCv/dryy5nFz9Q3UvJ7kWaYS/eTsgDg1JOVO0q8bD0HWdqpdJy3YhNtPZC+9OA4XXkVxmGSHrGVdLrjkkPKt8Vs29JNPTc7xyTaqC1XjCDjc0j3CCHdu0hMfyOV3Owc02qDVvYjFG1CxLIx5Wy3vfPfhN3WSRUo2oTcYxLItsvaU8/NJhWhaBNyTxetyFDZOq1sUgpFm5B7UM52W2XtLFsnlbGJ9lIyMkJ5EbIPJqFsq6w95X2zSU1oaRPyyFw6fZfRtGizbJ3UgqJNyCM6tez/huvxvuGydjQJpJSbXcTknupTl3wfoPNdUbQJeYpJMJt2kZhSCa+Yl/wC1Jk9RlC20paiTchTUFfspkR7BHKzU7WylW2jJI/H0TXwXCnahLzEJJzvGurWbkohjL1xrQ0k2l22gPMN7N5D0SbkJagVWRPWtimFMGXBVhTtB+geIaQiqCv2voU2KDcbTRYpQNG+B25RS9GOCwawmsMkoId7CojJUl8zN9veHzEBMhDvuMuuoWjHRUobxX9t+fuRq6KutZ0ZtoBVtLIfQP0Rm4gn9B3Uv+Du+aZop0NsA77tCWor6Xdl1PVrMzfbDrK2Q2rIUhc0RijaiRGqaB91+LdNQjqoKdwmC5252Y8g0e6iQ75vrB3pKdokVHz4f7Vo/214r6qADMEERCv7ESTaOuUy5nxtlL//EPOgaMdFbEtLdMy+gnZNlbWjfbMp2o/oFcdn8H7M1jZquPHwbFO00yFE9wg6Zl9B16Z2/jM9kBTslyDjo629zbsG7a2uiuOQoh0XsVnaSLR9WdorkNHgKtpo2cuskZegXQ6PIg1ITkH+/k3RSKFox4dp34xBgNa2Nf3JEyYRcfWxmqxD5maXY3ORxGhtI9fIk4mdoh0fSMxCs1BMgTuT5dsW+7YiM5Wt08o2g67NcWTW9ilYiann44+iHR+xpEyhY/Xd8BZZfjbRRmXr9GebQR3yNWddH2BD6JXaOfiqF+mgFO34QEIQUspUn0RbAWvbVqnH3Oz6IGE+srgUQuECTOqq7BpQtONjY7FQQvAH2iLpXYi2ngx3hvdM4pGBlmK0su3MLGP5PPBK3wnY1kDJxP4i5kHRjhPkgw3BOkEuhc8dWqiXhp+bVgXMzd4fZGQcBHwdM7BNghIDofRZpWjHCRLtQQDWNloWd/mQmq7rwBAYY272/iwsmSSHgTZCXljcIh9NxglFO042oEmq6nkQ5wxE0ncdP6AoZ/v5RDgEvQ2ZNVKNU+CaUuJiCCkNcGbpe7lGzyhFO16QMA96Ktxa6P4L3v/o8VhMmCaN5z545mY3x8bi+1XiugpBuGeWc/lmOw+KdrwsLNb2hx7mumq3wXeG93Y9sVBRt/biw2Z68Ghl12Nu8QGrAITbJtian22FYxTtuLFZ05971BHEtmQ86UmK3Ab4WPPAY1+6rWcyBvQEfitiMAs440K7SWyFVZc99HFncg9sgn3lcuwU7bixWdsH8n7Xwm2zQJY9exBRt/YMBCB95mbre/qnrKjyytJDuc5/BVoKrq/dGGyXm3MsE1QfJqex3AfbvvBL13tC0Y6fqSWIkwt3F9WSmTxcSLB3PRSYGbimU5Bj7svKzuRvfQ8+cxloKbgW7n9bxrSSCWrdYYprJq6wL5b7oOQ4nZ8/inb8uARxtHBfyyDzVTE5lXxl5BJR4hbpY+Du2vDzj4ZULp+52VPLXhY5ofrXV2K52oT7QO7HyvMENRXr+sThs2s5NucVGEU7DbRY/OJwpiciLtMWxXsibptLS56qkoq3vubgVhU8n75sV6st5Ga5K5mYXDYPOxSLd9Hiqi2T797I2LZZ10rcZZUEW/Pq9lbHJ+6CFLHx1qHcOYbzdjnPHJfodc6uENTZdxvUkQzoiaMFqPkUQPXmpsL5vPG4YlhU6K1ZZfyYGIsotvX9iNwN4TquVWFsz/c8tkzOfSIuMZsRUuS8btrt6zq/RIJlWrBybRyI5X0ig/wP+d2Ng/iMC//+WHEwK9nKNIQqtwvH3PE+52aHvmnVVsb1SoTQZawVx7aSmM5Kvssm4mNZnYwcXHtl7CRgXXuyoKUdPnUsmbGkrVUV07bRWQH/6WhDqDoMJRPDhu9J6MLRn3rTkHukS0u7yFCuc5cd/BGfxLrea6KkTztNFrKstxUr+EQP6B8CEmxlydku4nuvkQuHIJ2KsNBnIxPIe8vugL5ZyuR12sTKhqKdLvmy8q0ll7ttluLvbWRAd4BNkLvYN3vjYGlfRVydORer+6cOuhwVycV63KQxQtEmi4Lv+crRQtuXnfytN/K3Q96LA+Vsqw539JvJPX2+ErgRMYu1q3mRmfie33oe25/k2jcq1jm5T5uQnEyi4WN5uWZH2FjLAF5wa9JOGHluhtxXimO7TiCxjHVhXLfu3qNoExtDeY1F0F1K3vMMk60IxYqttUhP0eNaj+l8bNvqE/Kxnb/8xmCUUv8APsi0l8VaI5gAAAAASUVORK5CYII=",pve="_spinner_18usq_1",hve="_spin_18usq_1",yve="_svg_18usq_16",mve="_menu_18usq_276",gve="_fadein_18usq_1",bve="_fadeout_18usq_1",kn={spinner:pve,spin:hve,"spinner--light":"_spinner--light_18usq_12",svg:yve,"user-action-indicator-container":"_user-action-indicator-container_18usq_23","action-indicator-fade-out":"_action-indicator-fade-out_18usq_1","user-action-indicator-text":"_user-action-indicator-text_18usq_40","user-action-indicator":"_user-action-indicator_18usq_23","action-indicator-icon-scale":"_action-indicator-icon-scale_18usq_1","user-action-indicator-icon":"_user-action-indicator-icon_18usq_60","seek-container":"_seek-container_18usq_69","seek-playhead":"_seek-playhead_18usq_92","seek-buffer":"_seek-buffer_18usq_93","seek-input":"_seek-input_18usq_94","volume-controls":"_volume-controls_18usq_201","volume-slider":"_volume-slider_18usq_208","volume-input":"_volume-input_18usq_224","volume-progress":"_volume-progress_18usq_225",menu:mve,fadein:gve,"menu-option":"_menu-option_18usq_296","menu-option-back":"_menu-option-back_18usq_313","menu-option-back-icon":"_menu-option-back-icon_18usq_317","focus-visible":"_focus-visible_18usq_327","menu-option-active":"_menu-option-active_18usq_332","menu-option-icon":"_menu-option-icon_18usq_336","menu-header":"_menu-header_18usq_346",fadeout:bve},G2=({light:n,className:e=""})=>$e.jsx("div",{className:`${e} ${kn.spinner} ${n?kn["spinner--light"]:""}`,children:$e.jsx("div",{className:kn["spinner-inner"]})}),Bd=({icon:n,className:e=""})=>$e.jsx("div",{className:`${kn.svg} ${e}`,dangerouslySetInnerHTML:{__html:n}}),qI={[Fn.PLAY]:Wj,[Fn.PAUSE]:tve,[Fn.MUTE]:lk,[Fn.UNMUTE]:V2,[Fn.VOLUME_DOWN]:Jj,[Fn.VOLUME_UP]:V2,[Fn.SEEK_BACK]:$I,[Fn.SEEK_FORWARD]:HI,[Fn.PLAYBACK_RATE_DOWN]:$I,[Fn.PLAYBACK_RATE_UP]:HI,[Fn.SUBTITLES_ON]:cve,[Fn.SUBTITLES_OFF]:fve,[Fn.PLAY_PREVIOUS]:ck,[Fn.PLAY_NEXT]:fk},vve=({action:n})=>{if(!(!n||!qI[n.action]))return $e.jsxs("div",{className:kn["user-action-indicator-container"],children:[$e.jsx("div",{className:kn["user-action-indicator"],children:$e.jsx(Bd,{icon:qI[n.action],"aria-label":`Action indicator ${n}`,className:kn["user-action-indicator-icon"]})}),n.text?$e.jsx("div",{className:kn["user-action-indicator-text"],children:n.text}):null]})},Xj=({player:n,videoState:e,setRecentUserAction:t,className:r=""})=>{const[i,o]=zt.useState(n.video.currentTime),[u,c]=zt.useState(0),[p,h]=zt.useState(void 0);return zt.useEffect(()=>{h(Uj(n,t));const g=uk({video:n.video,setCurrentTime:o,rate:60}),m=jbe({video:n.video,setBufferFraction:c});return()=>{g&&g(),m&&m()}},[]),n.isLive?null:$e.jsxs("div",{className:`${r} ${kn["seek-container"]} ${r}`,children:[$e.jsx("progress",{max:1,value:u,className:kn["seek-buffer"]}),$e.jsx("progress",{max:1,value:i/e.duration||0,className:kn["seek-playhead"]}),$e.jsx("input",{"aria-label":"Seek slider",type:"range",min:0,max:1,step:1e-5,value:i/e.duration||0,onInput:g=>n.controls.Seek({fraction:g.currentTarget.value}),onKeyDown:p,className:kn["seek-input"]})]})},wve=({player:n,videoState:e})=>$e.jsxs("div",{className:kn["volume-controls"],children:[$e.jsx(gf,{"aria-label":e.muted?"Unmute":"Mute",icon:e.muted||e.volume===0?lk:e.volume<.4?Jj:e.volume<.8?ive:V2,onClick:()=>n.controls.ToggleMuted(),className:kn["volume-button"]},"mute-button"),$e.jsxs("div",{className:kn["volume-slider"],children:[$e.jsx("progress",{max:1,value:e.muted?0:e.volume,className:kn["volume-progress"]}),$e.jsx("input",{"aria-label":"Volume slider",type:"range",min:0,max:1,step:.001,value:e.muted?0:e.volume,onInput:t=>n.controls.SetVolume({fraction:t.currentTarget.value}),onKeyDown:xbe(n),className:kn["volume-input"]})]})]}),e$=({player:n,Hide:e,className:t=""})=>{const[r,i]=zt.useState(void 0),[o,u]=zt.useState(void 0),c=zt.createRef();if(zt.useEffect(()=>{const m=()=>u(n.controls.GetOptions());m();const w=n.controls.RegisterSettingsListener(m);return()=>w&&w()},[]),zt.useEffect(()=>{if(!c||!c.current)return;const m=ok({element:c.current.parentElement,Hide:e});return()=>{m&&m()}},[c]),!o)return null;const p=m=>setTimeout(()=>i(m)),h={quality:{label:"Quality",Update:m=>n.controls.SetQualityLevel(m)},audio:{label:"Audio",Update:m=>n.controls.SetAudioTrack(m)},text:{label:"Subtitles",Update:m=>n.controls.SetTextTrack(m)},profile:{label:"Player Profile",Update:m=>{m==="custom"?(n.controls.ShowPlayerProfileForm(),e()):n.controls.SetPlayerProfile({profile:m})}},rate:{label:"Playback Rate",Update:m=>n.controls.SetPlaybackRate({index:m})}};let g;return r?g=$e.jsxs("div",{role:"menu",className:`${kn.menu} ${kn.submenu} ${kn["settings-menu"]} ${t}`,children:[$e.jsxs("button",{onClick:()=>p(void 0),"aria-label":"Back to settings menu",className:`${kn["menu-option"]} ${kn["menu-option-back"]}`,children:[$e.jsx("div",{dangerouslySetInnerHTML:{__html:sve},className:kn["menu-option-back-icon"]}),$e.jsx("div",{children:h[r].label})]}),o[r].options.map(m=>$e.jsxs("button",{role:"menuitemradio","aria-checked":m.active,autoFocus:m.active,"aria-label":`${h[r].label}: ${m.label||""}`,onClick:()=>{h[r].Update(m.index),p(void 0)},className:`${kn["menu-option"]} ${m.active?kn["menu-option-active"]:""}`,children:[m.label||"",m.active?$e.jsx(Bd,{icon:lve,className:kn["menu-option-icon"]}):null]},`option-${m.index}`))]},"submenu"):g=$e.jsxs("div",{role:"menu",className:`${kn.menu} ${kn["settings-menu"]} ${t}`,children:[o.hasQualityOptions?$e.jsxs("button",{autoFocus:!0,role:"menuitem",onClick:()=>p("quality"),className:kn["menu-option"],children:[`${h.quality.label}: ${o.quality.active&&o.quality.active.activeLabel||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null,o.hasAudioOptions?$e.jsxs("button",{autoFocus:!o.hasQualityOptions,role:"menuitem",onClick:()=>p("audio"),className:kn["menu-option"],children:[`${h.audio.label}: ${o.audio.active&&o.audio.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null,o.hasTextOptions?$e.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions,role:"menuitem",onClick:()=>p("text"),className:kn["menu-option"],children:[`${h.text.label}: ${o.text.active&&o.text.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null,o.hasProfileOptons?$e.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions,role:"menuitem",onClick:()=>p("profile"),className:kn["menu-option"],children:[`${h.profile.label}: ${o.profile.active&&o.profile.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null,o.hasRateOptions?$e.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions&&!o.hasProfileOptons,role:"menuitem",onClick:()=>p("rate"),className:kn["menu-option"],children:[`${h.rate.label}: ${o.rate.active&&o.rate.active.label||""}`,$e.jsx(Bd,{icon:mv,className:kn["menu-option-icon"]})]}):null]},"menu"),$e.jsx("div",{ref:c,className:`${kn["menu-container"]}`,children:g})},t$=({player:n,Hide:e,className:t=""})=>{const r=zt.createRef(),[i,o]=zt.useState(void 0);if(zt.useEffect(()=>{const c=()=>o(n.controls.GetCollectionInfo());c();const p=n.controls.RegisterSettingsListener(c);return()=>p&&p()},[]),zt.useEffect(()=>{if(!r||!r.current)return;const c=ok({element:r.current.parentElement,Hide:e});return()=>c&&c()},[r]),!i)return null;const u=c=>{n.controls.CollectionPlay({mediaIndex:c}),e()};return $e.jsxs("div",{role:"menu",className:`${kn.menu} ${kn["collection-menu"]} ${t}`,ref:r,children:[$e.jsx("div",{className:`${kn["menu-option"]} ${kn["menu-header"]}`,children:i.title}),i.content.map(c=>$e.jsx("button",{"aria-label":`${c.title||c.mediaId} ${c.active?"(active)":""}`,role:"menuitemradio","aria-checked":c.active,autoFocus:c.active,onClick:()=>u(c.mediaIndex),className:`${kn["menu-option"]} ${c.active?kn["menu-option-active"]:""}`,children:c.title||c.mediaId},`collection-item-${c.mediaId}`))]},"menu")},gf=({icon:n,...e})=>$e.jsx("button",{...e,className:`${ir["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),xve=({player:n,videoState:e})=>{const[t,r]=zt.useState(n.video.currentTime);return zt.useEffect(()=>{const i=uk({video:n.video,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive?$e.jsx("div",{className:ir["live-indicator"],children:"Live"}):$e.jsxs("div",{className:ir.time,children:[j2(t,e.duration)," / ",j2(e.duration,e.duration)]})},_ve=({player:n})=>{const e=n.controls.GetCollectionInfo();if(!e||e.mediaLength===0||!e.isPlaylist)return null;const t=e.content[e.mediaIndex-1],r=e.content[e.mediaIndex+1],i=n.controls.IsReady();return $e.jsxs($e.Fragment,{children:[t?$e.jsxs("div",{className:`${ir["collection-button-container"]} ${i?"":ir["collection-button-container--loading"]}`,children:[$e.jsx(gf,{"aria-label":`Play Previous: ${t.title}`,disabled:!i,icon:ck,onClick:()=>n.controls.CollectionPlayPrevious()}),$e.jsx("div",{className:ir["collection-button-text"],children:t.title})]},`media-previous-${e.mediaIndex}`):null,r?$e.jsxs("div",{className:`${ir["collection-button-container"]} ${i?"":ir["collection-button-container--loading"]}`,children:[$e.jsx(gf,{"aria-label":`Play Next: ${r.title}`,disabled:!i,icon:fk,onClick:()=>n.controls.CollectionPlayNext()}),$e.jsx("div",{className:ir["collection-button-text"],children:r.title})]},`media-next-${e.mediaIndex}`):null]})},VI=({label:n,icon:e,player:t,setMenuActive:r,MenuComponent:i})=>{const[o,u]=zt.useState(!1);return $e.jsxs("div",{className:ir["menu-control-container"],children:[$e.jsx(gf,{"aria-label":o?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{r(!o),u(!o)},className:o?ir["icon-button-active"]:""}),o?$e.jsx(i,{player:t,Hide:()=>{u(!1),r(!1)}}):null]})},Sve=({player:n})=>{const[e,t]=zt.useState(void 0),{title:r,subtitle:i,description:o,image:u,headers:c}=n.controls.GetContentInfo()||{};return zt.useEffect(()=>{t(void 0),u&&sk({player:n,pathOrUrl:u,width:200}).then(p=>t(p))},[u]),!r||n.playerOptions.title===fn.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()||n.playerOptions.title===fn.title.OFF?null:$e.jsxs("div",{className:ir["info-container"],children:[e?$e.jsx("div",{className:ir["info-image-container"],children:$e.jsx("img",{src:e,alt:"Image",className:ir["info-image"]})}):null,$e.jsxs("div",{className:ir["info-text"],children:[c.length===0?null:$e.jsx("div",{className:ir["info-headers"],children:c.map((p,h)=>$e.jsx("div",{className:ir["info-header"],children:p},`header-${h}`))}),r?$e.jsx("div",{className:ir["info-title"],children:r}):null,i?$e.jsx("div",{className:ir["info-subtitle"],children:i}):null,o?$e.jsx("div",{className:ir["info-description"],children:o}):null]})]})},Eve=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[u,c]=zt.useState(void 0),[p,h]=zt.useState(void 0),[g,m]=zt.useState(0);if(zt.useEffect(()=>{h(Dj({player:n,setRecentUserAction:i}));const O=Vj({target:n.target,video:n.video,setVideoState:c});return()=>O&&O()},[]),!u)return null;const w=n.controls.GetCollectionInfo(),v=g>0,C=O=>m(O?g+1:Math.max(0,g-1)),T=r||!e||v,R=!T&&n.playerOptions.controls===fn.controls.AUTO_HIDE;return n.__SetControlsVisibility(!R),$e.jsxs("div",{onClick:p,className:[o,ir.container,T?"":ir.autohide,n.playerOptions.controls!==fn.controls.DEFAULT?"":ir["container--default-controls"],v?"menu-active":""].join(" "),children:[$e.jsx(Sve,{player:n},`content-info-${w&&w.mediaIndex}`),[fn.controls.DEFAULT,fn.controls.OFF,fn.controls.OFF_WITH_VOLUME_TOGGLE].includes(n.playerOptions.controls)?null:$e.jsxs($e.Fragment,{children:[$e.jsx(gf,{"aria-label":"Play",tabIndex:e?-1:0,icon:Gj,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${ir["center-play-button"]} ${t&&!e?"":ir["center-play-button--hidden"]}`}),$e.jsxs("div",{className:`${ir["bottom-controls-container"]} ${R?ir["bottom-controls-container--autohide"]:""}`,children:[$e.jsx("div",{className:ir["bottom-controls-gradient"]}),$e.jsx(Xj,{player:n,videoState:u,setRecentUserAction:i,className:ir.seek}),$e.jsxs("div",{className:ir.controls,children:[$e.jsx(gf,{"aria-label":u.playing?"Pause":"Play",icon:u.playing?Yj:Kj,onClick:()=>n.controls.TogglePlay(),className:ir["play-pause-button"]}),$e.jsx(_ve,{player:n}),$e.jsx(wve,{player:n,videoState:u}),$e.jsx(xve,{player:n,videoState:u}),$e.jsx("div",{className:ir.spacer}),w?$e.jsx(VI,{label:"Collection Menu",icon:Qj,player:n,setMenuActive:C,MenuComponent:t$}):null,n.controls.IsRotatable()?$e.jsx(gf,{"aria-label":"Rotate Video",icon:dve,onClick:()=>n.controls.SetAllowRotation(!n.controls.AllowRotation())}):null,n.controls.GetOptions().hasAnyOptions?$e.jsx(VI,{label:"Settings Menu",icon:ave,player:n,setMenuActive:C,MenuComponent:e$}):null,$e.jsx(gf,{"aria-label":u.fullscreen?"Exit Fullscreen":"Fullscreen",icon:u.fullscreen?rve:nve,onClick:()=>n.controls.ToggleFullscreen()})]})]})]}),n.playerOptions.controls!==fn.controls.OFF_WITH_VOLUME_TOGGLE?null:$e.jsx("div",{className:ir["floating-volume-toggle"],children:$e.jsx(gf,{"aria-label":u.muted?"Unmute":"Mute",icon:u.muted||u.volume===0?lk:V2,onClick:()=>n.controls.ToggleMuted(),className:ir["volume-button"]},"mute-button")}),n.playerOptions.watermark===fn.watermark.OFF?null:$e.jsx("div",{className:ir.watermark,children:$e.jsx("img",{src:Zj,alt:"Eluvio"})})]})},Cve="_spinner_1c6ar_17",Ave="_text_1c6ar_33",Mve="_title_1c6ar_39",kve="_description_1c6ar_43",Tve="_inputs_1c6ar_47",Rve="_input_1c6ar_47",Ove="_submit_1c6ar_77",Li={"ticket-form-container":"_ticket-form-container_1c6ar_1","ticket-form-overlay":"_ticket-form-overlay_1c6ar_8",spinner:Cve,"ticket-form":"_ticket-form_1c6ar_1",text:Ave,title:Mve,description:kve,inputs:Tve,input:Rve,submit:Ove,"error-message":"_error-message_1c6ar_88","size-md":"_size-md_1c6ar_102","size-sm":"_size-sm_1c6ar_103"},Lve=({parameters:n,dimensions:e,onComplete:t})=>{let{tenantId:r,ntpId:i,ticketCode:o,ticketSubject:u}=n.clientOptions||{};const c=!r||!i,[p,h]=zt.useState(o||""),[g,m]=zt.useState(!!o),[w,v]=zt.useState(!1),[C,T]=zt.useState(c?"Error: Tenant ID or NTP ID not specified":""),[R,O]=zt.useState(void 0),I=async({client:D,code:K})=>{if(!(!K||!D)){T(""),v(!0);try{let W=u;K.includes(":")&&(W=K.split(":")[0],K=K.split(":")[1]),await D.RedeemCode({tenantId:r,ntpId:i,code:K.trim(),email:W}),t(D)}catch(W){console.log(W),T("Invalid Code"),m(!1)}finally{v(!1)}}};return zt.useEffect(()=>{Promise.resolve().then(()=>Ij).then(async({ElvClient:D})=>{const K=await D.FromConfigurationUrl({configUrl:n.clientOptions.network});O(K),o&&I({client:K,code:o})})},[]),g?$e.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[Li["ticket-form-container"],Li[`size-${e.size}`],Li[`orientation-${e.orientation}`]].join(" "),children:$e.jsx("div",{className:Li["ticket-form-overlay"],children:$e.jsx(G2,{className:Li.spinner})})}):$e.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[Li["ticket-form-container"],Li[`size-${e.size}`],Li[`orientation-${e.orientation}`]].join(" "),children:$e.jsx("div",{className:Li["ticket-form-overlay"],children:$e.jsxs("form",{onSubmit:D=>{D.preventDefault(),I({client:R,code:p})},className:Li["ticket-form"],children:[$e.jsxs("div",{className:Li.text,children:[$e.jsx("h2",{className:Li.title,children:n.clientOptions.ticketTitle||"This content requires a code to view"}),$e.jsx("p",{className:Li.description,children:n.clientOptions.ticketDescription||"Please enter your code below"})]}),$e.jsxs("div",{className:Li.inputs,children:[$e.jsx("input",{disabled:c,autoFocus:!0,type:"text",placeholder:"Ticket Code",value:p,"aria-label":"Ticket Code","aria-invalid":!!C&&!c,"aria-errormessage":C,onKeyDown:D=>D.key==="Enter"&&I({client:R,code:p}),onChange:D=>{T(""),h(D.target.value)},className:Li.input}),$e.jsx("button",{type:"submit","aria-label":"Submit Code",disabled:!p||!R||c,className:Li.submit,children:w?$e.jsx(G2,{light:!0}):"Submit"})]}),$e.jsxs("div",{className:Li["error-message"],children:[C," "]})]})})})},Nve="_container_1ln5m_1",Pve="_autohide_1ln5m_34",Ive="_fadein_1ln5m_1",Dve="_title_1ln5m_131",Uve="_spacer_1ln5m_307",Fve="_watermark_1ln5m_311",Bve="_menu_1ln5m_142",yn={container:Nve,"container--default-controls":"_container--default-controls_1ln5m_29",autohide:Pve,"bottom-controls-container--autohide":"_bottom-controls-container--autohide_1ln5m_34","icon-button":"_icon-button_1ln5m_40","icon-button--drop-shadow-focus":"_icon-button--drop-shadow-focus_1ln5m_57","icon-button-active":"_icon-button-active_1ln5m_70","icon-button--circle-focus":"_icon-button--circle-focus_1ln5m_70","text-button":"_text-button_1ln5m_83","text-button--active":"_text-button--active_1ln5m_88","bottom-controls-container":"_bottom-controls-container_1ln5m_34",fadein:Ive,"bottom-controls-gradient":"_bottom-controls-gradient_1ln5m_105","center-play-button":"_center-play-button_1ln5m_117","center-play-button--hidden":"_center-play-button--hidden_1ln5m_124","title-container":"_title-container_1ln5m_131",title:Dve,"menu-control-container":"_menu-control-container_1ln5m_142","time-container":"_time-container_1ln5m_146","live-indicator":"_live-indicator_1ln5m_153","bottom-controls":"_bottom-controls_1ln5m_34","center-buttons":"_center-buttons_1ln5m_173","play-pause-button":"_play-pause-button_1ln5m_183","track-button":"_track-button_1ln5m_186","bottom-left-controls":"_bottom-left-controls_1ln5m_190","bottom-right-controls":"_bottom-right-controls_1ln5m_191","info-box-container":"_info-box-container_1ln5m_208","info-box":"_info-box_1ln5m_208","info-box-image-container":"_info-box-image-container_1ln5m_231","info-box-image":"_info-box-image_1ln5m_231","info-box-text":"_info-box-text_1ln5m_247","info-box-text--top-padding":"_info-box-text--top-padding_1ln5m_254","info-box-headers":"_info-box-headers_1ln5m_258","info-box-description":"_info-box-description_1ln5m_266","info-box-title":"_info-box-title_1ln5m_270","info-box-button":"_info-box-button_1ln5m_275","info-box-button--restart":"_info-box-button--restart_1ln5m_290",spacer:Uve,watermark:Fve,menu:Bve},mh=({icon:n,...e})=>$e.jsx("button",{...e,className:`${yn["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),zve=({player:n,videoState:e})=>{const[t,r]=zt.useState(n.video.currentTime);return zt.useEffect(()=>{const i=uk({video:n.video,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive?null:$e.jsxs("div",{className:yn["time-container"],children:[$e.jsx("div",{className:yn.time,children:j2(t,e.duration)}),$e.jsx("div",{className:yn.spacer}),$e.jsx("div",{className:yn.time,children:j2(e.duration,e.duration)})]})},jve=({player:n,videoState:e})=>{const t=n.controls.GetCollectionInfo(),r=t&&t.isPlaylist&&t.content[t.mediaIndex-1],i=t&&t.isPlaylist&&t.content[t.mediaIndex+1],o=n.controls.IsReady();return $e.jsxs("div",{className:yn["center-buttons"],children:[!r&&!i?null:$e.jsx(mh,{disabled:!o||!r,icon:ck,onClick:()=>n.controls.CollectionPlayPrevious(),className:`${yn["track-button"]} ${yn["icon-button--drop-shadow-focus"]}`}),$e.jsx(mh,{"aria-label":"Back 10 Seconds",icon:ove,onClick:()=>n.controls.Seek({relativeSeconds:-10}),className:yn["icon-button--drop-shadow-focus"]}),$e.jsx(mh,{"aria-label":e.playing?"Pause":"Play",icon:e.playing?Yj:Kj,onClick:()=>n.controls.TogglePlay(),className:`${yn["play-pause-button"]} ${yn["icon-button--drop-shadow-focus"]}`}),$e.jsx(mh,{"aria-label":"Forward 10 Seconds",icon:uve,onClick:()=>n.controls.Seek({relativeSeconds:10}),className:yn["icon-button--drop-shadow-focus"]}),!r&&!i?null:$e.jsx(mh,{disabled:!o||!i,icon:fk,onClick:()=>n.controls.CollectionPlayNext(),className:`${yn["track-button"]} ${yn["icon-button--drop-shadow-focus"]}`})]})},GI=({label:n,icon:e,children:t,player:r,setMenuActive:i,MenuComponent:o})=>{const[u,c]=zt.useState(!1);return $e.jsxs("div",{className:yn["menu-control-container"],children:[e?$e.jsx(mh,{"aria-label":u?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{i(!u),c(!u)},className:`${yn["icon-button--circle-focus"]} ${u?yn["icon-button-active"]:""}`}):$e.jsx("button",{onClick:()=>{i(!u),c(!u)},className:`${yn["text-button"]} ${u?yn["text-button--active"]:""}`,children:t}),u?$e.jsx(o,{player:r,Hide:()=>{c(!1),i(!1)},className:yn.menu}):null]})},$ve=({player:n,Hide:e})=>{const[t,r]=zt.useState(void 0),{title:i,description:o,image:u,headers:c}=n.controls.GetContentInfo()||{};return zt.useEffect(()=>{r(void 0),u&&sk({player:n,pathOrUrl:u,width:200}).then(p=>r(p))},[u]),zt.useEffect(()=>{const p=h=>{h&&(h.key||"").toLowerCase()==="escape"&&e()};return document.body.addEventListener("keydown",p),()=>document.body.removeEventListener("keydown",p)},[]),$e.jsxs("div",{className:yn["info-box-container"],children:[$e.jsx("button",{autoFocus:!0,onClick:()=>e(),className:`${yn["info-box-button"]} ${yn["info-box-button--info"]}`,children:"Info"}),$e.jsxs("div",{className:yn["info-box"],children:[t?$e.jsx("div",{className:yn["info-box-image-container"],children:$e.jsx("img",{src:t,alt:"Image",className:yn["info-box-image"]})}):null,$e.jsxs("div",{className:`${yn["info-box-text"]} ${t&&c&&c.length===0?yn["info-box-text--top-padding"]:""}`,children:[!c||c.length===0?null:$e.jsx("div",{className:yn["info-box-headers"],children:c.map((p,h)=>$e.jsx("div",{className:yn["info-box-header"],children:p},`header-${h}`))}),$e.jsx("div",{className:yn["info-box-title"],children:i||""}),$e.jsx("div",{className:yn["info-box-description"],children:o||""})]}),$e.jsx("div",{className:yn["info-box-actions"],children:$e.jsxs("button",{onClick:()=>{n.controls.Seek({time:0}),e()},className:`${yn["info-box-button"]} ${yn["info-box-button--restart"]}`,children:[$e.jsx(Bd,{icon:Wj}),"From Beginning"]})})]})]})},Hve=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[u,c]=zt.useState(void 0),[p,h]=zt.useState(void 0),[g,m]=zt.useState(!1),[w,v]=zt.useState(!1);if(zt.useEffect(()=>{h(Dj({player:n,setRecentUserAction:i}));const I=Vj({target:n.target,video:n.video,setVideoState:c});return()=>I&&I()},[]),!u)return null;const{title:C}=n.controls.GetContentInfo()||{},T=n.controls.GetCollectionInfo(),R=r||!e||g,O=!R&&n.playerOptions.controls===fn.controls.AUTO_HIDE;return n.__SetControlsVisibility(!O),$e.jsxs("div",{onClick:p,className:[o,yn.container,R?"":yn.autohide,n.playerOptions.controls!==fn.controls.DEFAULT?"":yn["container--default-controls"],g?"menu-active":""].join(" "),children:[$e.jsx(mh,{"aria-label":"Play",tabIndex:e?-1:0,icon:Gj,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${yn["center-play-button"]} ${yn["icon-button--drop-shadow-focus"]} ${t&&!e?"":yn["center-play-button--hidden"]}`}),w?$e.jsx($ve,{player:n,Hide:()=>v(!1)}):$e.jsxs("div",{className:`${yn["bottom-controls-container"]} ${O?yn["bottom-controls-container--autohide"]:""}`,children:[$e.jsx("div",{className:yn["bottom-controls-gradient"]}),$e.jsxs("div",{className:yn["title-container"],children:[$e.jsx("div",{className:yn.title,children:n.playerOptions.title===fn.title.OFF||n.playerOptions.title===fn.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()?"":C||""}),$e.jsx("div",{className:yn.spacer}),n.isLive?$e.jsx("div",{className:yn["live-indicator"],children:"Live"}):null,T?$e.jsx(GI,{label:"Collection Menu",icon:Qj,player:n,setMenuActive:m,MenuComponent:t$}):null]}),$e.jsx(Xj,{player:n,videoState:u,setRecentUserAction:i}),$e.jsx(zve,{player:n,videoState:u}),$e.jsxs("div",{className:yn["bottom-controls"],children:[$e.jsx("div",{className:yn["bottom-left-controls"],children:!C||n.playerOptions.title===fn.title.OFF?null:$e.jsx("button",{className:yn["text-button"],onClick:()=>v(!0),children:"Info"})}),$e.jsx(jve,{player:n,videoState:u}),$e.jsx("div",{className:yn["bottom-right-controls"],children:n.controls.GetOptions().hasAnyOptions?$e.jsx(GI,{label:"Settings",player:n,MenuComponent:e$,setMenuActive:m,children:"Settings"},"settings-button"):null})]})]}),n.playerOptions.watermark===fn.watermark.OFF?null:$e.jsx("div",{className:yn.watermark,children:$e.jsx("img",{src:Zj,alt:"Eluvio"})})]},"controls")},qve="_container_1l7ln_1",Vve="_overlay_1l7ln_9",Gve="_fadein_1l7ln_1",Wve="_form_1l7ln_22",Kve="_header_1l7ln_39",Yve="_input_1l7ln_45",Jve="_actions_1l7ln_92",Qve="_submit_1l7ln_98",Zve="_cancel_1l7ln_99",xo={container:qve,overlay:Vve,fadein:Gve,form:Wve,header:Kve,"input-container":"_input-container_1l7ln_45",input:Yve,"input--invalid":"_input--invalid_1l7ln_65","player-info":"_player-info_1l7ln_74","api-link":"_api-link_1l7ln_83",actions:Jve,submit:Qve,cancel:Zve},Xve=({player:n,Close:e})=>{const[t,r]=zt.useState(JSON.stringify(n.hlsOptions||"{}",null,2)),[i,o]=zt.useState(!1),[u,c]=zt.useState(""),p=zt.useRef();zt.useEffect(()=>{if(!p||!p.current)return;const g=ok({element:p.current,Hide:e});return()=>g&&g()},[p]);const h=async g=>{g.preventDefault();try{o(!0),await n.controls.SetPlayerProfile({profile:"custom",customHLSOptions:JSON.parse(t)}),e()}catch(m){c(m.toString()),o(!1)}};return $e.jsx("div",{role:"complementary",tabIndex:-1,className:xo.container,children:$e.jsx("div",{className:xo.overlay,children:$e.jsxs("form",{onSubmit:h,className:xo.form,ref:p,children:[$e.jsx("h2",{className:xo.header,children:"Custom hls.js Options"}),$e.jsxs("div",{className:xo["input-container"],children:[$e.jsx("textarea",{disabled:i,autoFocus:!0,value:t,title:u,"aria-label":"Player Options","aria-invalid":!!u,"aria-errormessage":u||"",onChange:g=>r(g.currentTarget.value),onFocus:()=>c(""),onBlur:()=>{try{c(""),r(JSON.stringify(JSON.parse(t||"{}"),null,2))}catch(g){c(g.toString())}},className:`${xo.input} ${u?xo["input--invalid"]:""}`}),$e.jsxs("div",{className:xo["player-info"],children:[$e.jsx("a",{tabIndex:0,href:"https://github.com/video-dev/hls.js/blob/master/docs/API.md",rel:"noreferrer",target:"_blank",className:xo["api-link"],children:"API Docs"}),$e.jsxs("div",{className:xo["player-version"],children:["hls.js ",n.HLS.version]})]})]}),$e.jsxs("div",{className:xo.actions,children:[$e.jsx("button",{type:"button","aria-label":"Cancel",onClick:()=>e(),className:xo.cancel,children:"Cancel"}),$e.jsx("button",{type:"submit","aria-label":"Submit",disabled:!!u,className:xo.submit,children:i?$e.jsx(G2,{light:!0}):"Submit"})]})]})})})},e1e=({player:n})=>{const[e,t]=zt.useState(void 0),{posterImage:r}=n.controls.GetContentInfo()||{};return zt.useEffect(()=>{t(void 0),r&&sk({player:n,pathOrUrl:r,width:200}).then(i=>t(i))},[r]),e?$e.jsx("img",{alt:"Video Poster",src:e,className:Vl.poster}):null},t1e=({target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:i,Reset:o})=>{const[u,c]=zt.useState(void 0),[p,h]=zt.useState(void 0),[g,m]=zt.useState("lg"),[w,v]=zt.useState("landscape"),[C,T]=zt.useState({width:n.getBoundingClientRect().width,height:n.getBoundingClientRect().height}),[R,O]=zt.useState(void 0),[I,D]=zt.useState(!1),[K,W]=zt.useState(!1),[pe,ce]=zt.useState(!1),[ge,Se]=zt.useState(!1),[_e,ae]=zt.useState(!1),[Te,S]=zt.useState(!0),[x,A]=zt.useState(void 0),[U,L]=zt.useState(void 0),z=zt.useRef(),Y=!!u,q=({action:M,text:Q})=>A({action:M,text:Q,key:Math.random()});if(zt.useEffect(()=>{Se(!0);const M=$be({target:n,setSize:m,setOrientation:v,setDimensions:T});return()=>{Se(!1),M&&M()}},[]),zt.useEffect(()=>{if(!(!z||!z.current||!ge))try{D(!1),W(!1),e.clientOptions.client=p||e.clientOptions.client;const M=new $2({target:n,video:z.current,parameters:e,SetErrorMessage:O});window.__elvPlayer=M;const Q=M.controls.RegisterSettingsListener(()=>{L(M.controls.AllowRotation()),W(M.playbackStarted),D(!M.loading),ae(M.__showPlayerProfileForm)});M.Destroy=()=>{M.__DestroyPlayer(),i()},M.Reset=()=>{o()};const ie=Hbe({player:M}),H=qbe({player:M,inactivityPeriod:5e3,onWake:()=>S(!0),onSleep:()=>S(!1)}),we=Vbe({player:M,setRecentUserAction:q}),Ne=Gbe({player:M});t(M),c(M);const ke=M.controls.RegisterVideoEventListener("canplay",()=>ce(!0));return()=>{z&&z.current&&z.current.removeEventListener("play",W),Q&&Q(),ie&&ie(),H&&H(),we&&we(),Ne&&Ne(),ke&&ke(),M&&M.__DestroyPlayer()}}catch(M){r(M),i()}},[z,ge,p]),zt.useEffect(()=>{if(Y)return()=>{u&&u.__DestroyPlayer(),c(void 0)}},[Y]),e.clientOptions.promptTicket&&!p)return $e.jsx(Lve,{parameters:e,dimensions:{size:g,orientation:w,...C},onComplete:M=>h(M)});const P=e.playerOptions.ui===fn.ui.WEB&&u&&u.controls.IsRotatable()&&U;return $e.jsxs("div",{role:"complementary","aria-label":"Eluvio Video Player",tabIndex:0,style:{backgroundColor:e.playerOptions.backgroundColor||"transparent","--portal-width":`${C.width}px`,"--portal-height":`${C.height}px`},className:[Vl["player-container"],P?Vl["player-container--rotated"]:"",`__eluvio-player--size-${g}`,`__eluvio-player--orientation-${w}`].join(" "),children:[!_e||!I?null:$e.jsx(Xve,{player:u,Close:()=>u.controls.HidePlayerProfileForm()}),$e.jsx("video",{playsInline:!0,disablePictureInPicture:!0,ref:z,muted:[fn.muted.ON,fn.muted.WHEN_NOT_VISIBLE].includes(e.playerOptions.muted),controls:e.playerOptions.controls===fn.controls.DEFAULT,loop:e.playerOptions.loop===fn.loop.ON,className:Vl.video}),!u||K||!pe?null:$e.jsx(e1e,{player:u}),I||R?null:$e.jsx("div",{className:Vl["spinner-container"],children:$e.jsx(G2,{className:Vl.spinner})}),R?$e.jsx("div",{className:Vl["error-message"],children:R}):null,u?e.playerOptions.ui===fn.ui.WEB?$e.jsx(Eve,{player:u,playbackStarted:!!K,canPlay:pe,recentlyInteracted:Te,setRecentUserAction:q,className:Vl.controls}):$e.jsx(Hve,{player:u,playbackStarted:!!K,canPlay:pe,recentlyInteracted:Te,setRecentUserAction:q,className:Vl.controls}):null,x?$e.jsx(vve,{action:x},`action-indicator-${x&&x.key}`):null]})},n1e=n=>{const[e,t]=zt.useState(Math.random());return zt.createElement(t1e,{...n,key:`player-${e}`,Reset:()=>t(Math.random())})},r1e=(n,e)=>(n.innerHTML="",n.classList.add(YW.reset),n.classList.add(Vl["player-target"]),e=Bj(e),e.playerOptions&&e.playerOptions.backgroundColor&&(n.style.backgroundColor=e.playerOptions.backgroundColor),new Promise((t,r)=>{const i=bv.createRoot(n);i.render($e.jsx(VW.StrictMode,{children:$e.jsx(n1e,{target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:async()=>{try{await i.unmount()}catch(o){console.error("Failed to unmount Eluvio Player"),console.error(o)}}})}))}));exports.Initialize=r1e;exports.PlayerParameters=fn;exports.commonjsGlobal=Va;exports.crypto=XI;exports.eventsExports=S1;exports.getDefaultExportFromCjs=tp;exports.inherits_browserExports=HD;exports.require$$3=l1;exports.requireBuffer=u1;exports.string_decoder=PM;