@eluvio/elv-player-js 2.0.34 → 2.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +17 -17
- package/dist/{Analytics-DwDiR9Sr.js → Analytics-DhUprhCa.js} +1 -1
- package/dist/{Analytics-BZAzyza1.mjs → Analytics-IRxf_5ik.mjs} +1 -1
- package/dist/{dash.all.min--CWcdT1A.mjs → dash.all.min-EESJrr2E.mjs} +1 -1
- package/dist/{dash.all.min-CUif2q1p.js → dash.all.min-mUKTGVgu.js} +1 -1
- package/dist/elv-player-js.cjs.js +1 -1
- package/dist/elv-player-js.es.js +1 -1
- package/dist/{index-DHXWR3Eg.js → index-BjTBtYwL.js} +1 -1
- package/dist/{index-BxzOAwpW.mjs → index-CBGyGWTr.mjs} +1 -1
- package/dist/{index-hNvZk_cL.mjs → index-CQ3OP4B6.mjs} +4 -4
- package/dist/{index-B0sVjmN4.js → index-zgAd5s09.js} +2 -2
- package/lib/player/Player.js +3 -3
- package/package.json +1 -1
|
@@ -323,7 +323,7 @@ ${o} ${VZ(e)}
|
|
|
323
323
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
324
324
|
* @license MIT
|
|
325
325
|
*/(function(n){const e=JP(),t=QP(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=c,n.SlowBuffer=L,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 Z=new Uint8Array(1),$={foo:function(){return 42}};return Object.setPrototypeOf($,Uint8Array.prototype),Object.setPrototypeOf(Z,$),Z.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 l(Z){if(Z>i)throw new RangeError('The value "'+Z+'" is invalid for option "size"');const $=new Uint8Array(Z);return Object.setPrototypeOf($,c.prototype),$}function c(Z,$,W){if(typeof Z=="number"){if(typeof $=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(Z)}return p(Z,$,W)}c.poolSize=8192;function p(Z,$,W){if(typeof Z=="string")return b(Z,$);if(ArrayBuffer.isView(Z))return S(Z);if(Z==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z);if(Ne(Z,ArrayBuffer)||Z&&Ne(Z.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ne(Z,SharedArrayBuffer)||Z&&Ne(Z.buffer,SharedArrayBuffer)))return A(Z,$,W);if(typeof Z=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const ge=Z.valueOf&&Z.valueOf();if(ge!=null&&ge!==Z)return c.from(ge,$,W);const _e=k(Z);if(_e)return _e;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Z[Symbol.toPrimitive]=="function")return c.from(Z[Symbol.toPrimitive]("string"),$,W);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z)}c.from=function(Z,$,W){return p(Z,$,W)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function h(Z){if(typeof Z!="number")throw new TypeError('"size" argument must be of type number');if(Z<0)throw new RangeError('The value "'+Z+'" is invalid for option "size"')}function m(Z,$,W){return h(Z),Z<=0?l(Z):$!==void 0?typeof W=="string"?l(Z).fill($,W):l(Z).fill($):l(Z)}c.alloc=function(Z,$,W){return m(Z,$,W)};function w(Z){return h(Z),l(Z<0?0:R(Z)|0)}c.allocUnsafe=function(Z){return w(Z)},c.allocUnsafeSlow=function(Z){return w(Z)};function b(Z,$){if((typeof $!="string"||$==="")&&($="utf8"),!c.isEncoding($))throw new TypeError("Unknown encoding: "+$);const W=I(Z,$)|0;let ge=l(W);const _e=ge.write(Z,$);return _e!==W&&(ge=ge.slice(0,_e)),ge}function g(Z){const $=Z.length<0?0:R(Z.length)|0,W=l($);for(let ge=0;ge<$;ge+=1)W[ge]=Z[ge]&255;return W}function S(Z){if(Ne(Z,Uint8Array)){const $=new Uint8Array(Z);return A($.buffer,$.byteOffset,$.byteLength)}return g(Z)}function A(Z,$,W){if($<0||Z.byteLength<$)throw new RangeError('"offset" is outside of buffer bounds');if(Z.byteLength<$+(W||0))throw new RangeError('"length" is outside of buffer bounds');let ge;return $===void 0&&W===void 0?ge=new Uint8Array(Z):W===void 0?ge=new Uint8Array(Z,$):ge=new Uint8Array(Z,$,W),Object.setPrototypeOf(ge,c.prototype),ge}function k(Z){if(c.isBuffer(Z)){const $=R(Z.length)|0,W=l($);return W.length===0||Z.copy(W,0,0,$),W}if(Z.length!==void 0)return typeof Z.length!="number"||Qe(Z.length)?l(0):g(Z);if(Z.type==="Buffer"&&Array.isArray(Z.data))return g(Z.data)}function R(Z){if(Z>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return Z|0}function L(Z){return+Z!=Z&&(Z=0),c.alloc(+Z)}c.isBuffer=function($){return $!=null&&$._isBuffer===!0&&$!==c.prototype},c.compare=function($,W){if(Ne($,Uint8Array)&&($=c.from($,$.offset,$.byteLength)),Ne(W,Uint8Array)&&(W=c.from(W,W.offset,W.byteLength)),!c.isBuffer($)||!c.isBuffer(W))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if($===W)return 0;let ge=$.length,_e=W.length;for(let Re=0,Be=Math.min(ge,_e);Re<Be;++Re)if($[Re]!==W[Re]){ge=$[Re],_e=W[Re];break}return ge<_e?-1:_e<ge?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($,W){if(!Array.isArray($))throw new TypeError('"list" argument must be an Array of Buffers');if($.length===0)return c.alloc(0);let ge;if(W===void 0)for(W=0,ge=0;ge<$.length;++ge)W+=$[ge].length;const _e=c.allocUnsafe(W);let Re=0;for(ge=0;ge<$.length;++ge){let Be=$[ge];if(Ne(Be,Uint8Array))Re+Be.length>_e.length?(c.isBuffer(Be)||(Be=c.from(Be)),Be.copy(_e,Re)):Uint8Array.prototype.set.call(_e,Be,Re);else if(c.isBuffer(Be))Be.copy(_e,Re);else throw new TypeError('"list" argument must be an Array of Buffers');Re+=Be.length}return _e};function I(Z,$){if(c.isBuffer(Z))return Z.length;if(ArrayBuffer.isView(Z)||Ne(Z,ArrayBuffer))return Z.byteLength;if(typeof Z!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Z);const W=Z.length,ge=arguments.length>2&&arguments[2]===!0;if(!ge&&W===0)return 0;let _e=!1;for(;;)switch($){case"ascii":case"latin1":case"binary":return W;case"utf8":case"utf-8":return P(Z).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W*2;case"hex":return W>>>1;case"base64":return le(Z).length;default:if(_e)return ge?-1:P(Z).length;$=(""+$).toLowerCase(),_e=!0}}c.byteLength=I;function q(Z,$,W){let ge=!1;if(($===void 0||$<0)&&($=0),$>this.length||((W===void 0||W>this.length)&&(W=this.length),W<=0)||(W>>>=0,$>>>=0,W<=$))return"";for(Z||(Z="utf8");;)switch(Z){case"hex":return Q(this,$,W);case"utf8":case"utf-8":return x(this,$,W);case"ascii":return F(this,$,W);case"latin1":case"binary":return H(this,$,W);case"base64":return C(this,$,W);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,$,W);default:if(ge)throw new TypeError("Unknown encoding: "+Z);Z=(Z+"").toLowerCase(),ge=!0}}c.prototype._isBuffer=!0;function G(Z,$,W){const ge=Z[$];Z[$]=Z[W],Z[W]=ge}c.prototype.swap16=function(){const $=this.length;if($%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let W=0;W<$;W+=2)G(this,W,W+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 W=0;W<$;W+=4)G(this,W,W+3),G(this,W+1,W+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 W=0;W<$;W+=8)G(this,W,W+7),G(this,W+1,W+6),G(this,W+2,W+5),G(this,W+3,W+4);return this},c.prototype.toString=function(){const $=this.length;return $===0?"":arguments.length===0?x(this,0,$):q.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 W=n.INSPECT_MAX_BYTES;return $=this.toString("hex",0,W).replace(/(.{2})/g,"$1 ").trim(),this.length>W&&($+=" ... "),"<Buffer "+$+">"},r&&(c.prototype[r]=c.prototype.inspect),c.prototype.compare=function($,W,ge,_e,Re){if(Ne($,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(W===void 0&&(W=0),ge===void 0&&(ge=$?$.length:0),_e===void 0&&(_e=0),Re===void 0&&(Re=this.length),W<0||ge>$.length||_e<0||Re>this.length)throw new RangeError("out of range index");if(_e>=Re&&W>=ge)return 0;if(_e>=Re)return-1;if(W>=ge)return 1;if(W>>>=0,ge>>>=0,_e>>>=0,Re>>>=0,this===$)return 0;let Be=Re-_e,wt=ge-W;const yt=Math.min(Be,wt),gt=this.slice(_e,Re),At=$.slice(W,ge);for(let Ot=0;Ot<yt;++Ot)if(gt[Ot]!==At[Ot]){Be=gt[Ot],wt=At[Ot];break}return Be<wt?-1:wt<Be?1:0};function de(Z,$,W,ge,_e){if(Z.length===0)return-1;if(typeof W=="string"?(ge=W,W=0):W>2147483647?W=2147483647:W<-2147483648&&(W=-2147483648),W=+W,Qe(W)&&(W=_e?0:Z.length-1),W<0&&(W=Z.length+W),W>=Z.length){if(_e)return-1;W=Z.length-1}else if(W<0)if(_e)W=0;else return-1;if(typeof $=="string"&&($=c.from($,ge)),c.isBuffer($))return $.length===0?-1:oe(Z,$,W,ge,_e);if(typeof $=="number")return $=$&255,typeof Uint8Array.prototype.indexOf=="function"?_e?Uint8Array.prototype.indexOf.call(Z,$,W):Uint8Array.prototype.lastIndexOf.call(Z,$,W):oe(Z,[$],W,ge,_e);throw new TypeError("val must be string, number or Buffer")}function oe(Z,$,W,ge,_e){let Re=1,Be=Z.length,wt=$.length;if(ge!==void 0&&(ge=String(ge).toLowerCase(),ge==="ucs2"||ge==="ucs-2"||ge==="utf16le"||ge==="utf-16le")){if(Z.length<2||$.length<2)return-1;Re=2,Be/=2,wt/=2,W/=2}function yt(At,Ot){return Re===1?At[Ot]:At.readUInt16BE(Ot*Re)}let gt;if(_e){let At=-1;for(gt=W;gt<Be;gt++)if(yt(Z,gt)===yt($,At===-1?0:gt-At)){if(At===-1&&(At=gt),gt-At+1===wt)return At*Re}else At!==-1&&(gt-=gt-At),At=-1}else for(W+wt>Be&&(W=Be-wt),gt=W;gt>=0;gt--){let At=!0;for(let Ot=0;Ot<wt;Ot++)if(yt(Z,gt+Ot)!==yt($,Ot)){At=!1;break}if(At)return gt}return-1}c.prototype.includes=function($,W,ge){return this.indexOf($,W,ge)!==-1},c.prototype.indexOf=function($,W,ge){return de(this,$,W,ge,!0)},c.prototype.lastIndexOf=function($,W,ge){return de(this,$,W,ge,!1)};function ye(Z,$,W,ge){W=Number(W)||0;const _e=Z.length-W;ge?(ge=Number(ge),ge>_e&&(ge=_e)):ge=_e;const Re=$.length;ge>Re/2&&(ge=Re/2);let Be;for(Be=0;Be<ge;++Be){const wt=parseInt($.substr(Be*2,2),16);if(Qe(wt))return Be;Z[W+Be]=wt}return Be}function Se(Z,$,W,ge){return Ee(P($,Z.length-W),Z,W,ge)}function Ce(Z,$,W,ge){return Ee(U($),Z,W,ge)}function ne(Z,$,W,ge){return Ee(le($),Z,W,ge)}function Le(Z,$,W,ge){return Ee(te($,Z.length-W),Z,W,ge)}c.prototype.write=function($,W,ge,_e){if(W===void 0)_e="utf8",ge=this.length,W=0;else if(ge===void 0&&typeof W=="string")_e=W,ge=this.length,W=0;else if(isFinite(W))W=W>>>0,isFinite(ge)?(ge=ge>>>0,_e===void 0&&(_e="utf8")):(_e=ge,ge=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Re=this.length-W;if((ge===void 0||ge>Re)&&(ge=Re),$.length>0&&(ge<0||W<0)||W>this.length)throw new RangeError("Attempt to write outside buffer bounds");_e||(_e="utf8");let Be=!1;for(;;)switch(_e){case"hex":return ye(this,$,W,ge);case"utf8":case"utf-8":return Se(this,$,W,ge);case"ascii":case"latin1":case"binary":return Ce(this,$,W,ge);case"base64":return ne(this,$,W,ge);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Le(this,$,W,ge);default:if(Be)throw new TypeError("Unknown encoding: "+_e);_e=(""+_e).toLowerCase(),Be=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(Z,$,W){return $===0&&W===Z.length?e.fromByteArray(Z):e.fromByteArray(Z.slice($,W))}function x(Z,$,W){W=Math.min(Z.length,W);const ge=[];let _e=$;for(;_e<W;){const Re=Z[_e];let Be=null,wt=Re>239?4:Re>223?3:Re>191?2:1;if(_e+wt<=W){let yt,gt,At,Ot;switch(wt){case 1:Re<128&&(Be=Re);break;case 2:yt=Z[_e+1],(yt&192)===128&&(Ot=(Re&31)<<6|yt&63,Ot>127&&(Be=Ot));break;case 3:yt=Z[_e+1],gt=Z[_e+2],(yt&192)===128&&(gt&192)===128&&(Ot=(Re&15)<<12|(yt&63)<<6|gt&63,Ot>2047&&(Ot<55296||Ot>57343)&&(Be=Ot));break;case 4:yt=Z[_e+1],gt=Z[_e+2],At=Z[_e+3],(yt&192)===128&&(gt&192)===128&&(At&192)===128&&(Ot=(Re&15)<<18|(yt&63)<<12|(gt&63)<<6|At&63,Ot>65535&&Ot<1114112&&(Be=Ot))}}Be===null?(Be=65533,wt=1):Be>65535&&(Be-=65536,ge.push(Be>>>10&1023|55296),Be=56320|Be&1023),ge.push(Be),_e+=wt}return z(ge)}const O=4096;function z(Z){const $=Z.length;if($<=O)return String.fromCharCode.apply(String,Z);let W="",ge=0;for(;ge<$;)W+=String.fromCharCode.apply(String,Z.slice(ge,ge+=O));return W}function F(Z,$,W){let ge="";W=Math.min(Z.length,W);for(let _e=$;_e<W;++_e)ge+=String.fromCharCode(Z[_e]&127);return ge}function H(Z,$,W){let ge="";W=Math.min(Z.length,W);for(let _e=$;_e<W;++_e)ge+=String.fromCharCode(Z[_e]);return ge}function Q(Z,$,W){const ge=Z.length;(!$||$<0)&&($=0),(!W||W<0||W>ge)&&(W=ge);let _e="";for(let Re=$;Re<W;++Re)_e+=st[Z[Re]];return _e}function ae(Z,$,W){const ge=Z.slice($,W);let _e="";for(let Re=0;Re<ge.length-1;Re+=2)_e+=String.fromCharCode(ge[Re]+ge[Re+1]*256);return _e}c.prototype.slice=function($,W){const ge=this.length;$=~~$,W=W===void 0?ge:~~W,$<0?($+=ge,$<0&&($=0)):$>ge&&($=ge),W<0?(W+=ge,W<0&&(W=0)):W>ge&&(W=ge),W<$&&(W=$);const _e=this.subarray($,W);return Object.setPrototypeOf(_e,c.prototype),_e};function N(Z,$,W){if(Z%1!==0||Z<0)throw new RangeError("offset is not uint");if(Z+$>W)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function($,W,ge){$=$>>>0,W=W>>>0,ge||N($,W,this.length);let _e=this[$],Re=1,Be=0;for(;++Be<W&&(Re*=256);)_e+=this[$+Be]*Re;return _e},c.prototype.readUintBE=c.prototype.readUIntBE=function($,W,ge){$=$>>>0,W=W>>>0,ge||N($,W,this.length);let _e=this[$+--W],Re=1;for(;W>0&&(Re*=256);)_e+=this[$+--W]*Re;return _e},c.prototype.readUint8=c.prototype.readUInt8=function($,W){return $=$>>>0,W||N($,1,this.length),this[$]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function($,W){return $=$>>>0,W||N($,2,this.length),this[$]|this[$+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function($,W){return $=$>>>0,W||N($,2,this.length),this[$]<<8|this[$+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function($,W){return $=$>>>0,W||N($,4,this.length),(this[$]|this[$+1]<<8|this[$+2]<<16)+this[$+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function($,W){return $=$>>>0,W||N($,4,this.length),this[$]*16777216+(this[$+1]<<16|this[$+2]<<8|this[$+3])},c.prototype.readBigUInt64LE=_t(function($){$=$>>>0,ue($,"offset");const W=this[$],ge=this[$+7];(W===void 0||ge===void 0)&&re($,this.length-8);const _e=W+this[++$]*2**8+this[++$]*2**16+this[++$]*2**24,Re=this[++$]+this[++$]*2**8+this[++$]*2**16+ge*2**24;return BigInt(_e)+(BigInt(Re)<<BigInt(32))}),c.prototype.readBigUInt64BE=_t(function($){$=$>>>0,ue($,"offset");const W=this[$],ge=this[$+7];(W===void 0||ge===void 0)&&re($,this.length-8);const _e=W*2**24+this[++$]*2**16+this[++$]*2**8+this[++$],Re=this[++$]*2**24+this[++$]*2**16+this[++$]*2**8+ge;return(BigInt(_e)<<BigInt(32))+BigInt(Re)}),c.prototype.readIntLE=function($,W,ge){$=$>>>0,W=W>>>0,ge||N($,W,this.length);let _e=this[$],Re=1,Be=0;for(;++Be<W&&(Re*=256);)_e+=this[$+Be]*Re;return Re*=128,_e>=Re&&(_e-=Math.pow(2,8*W)),_e},c.prototype.readIntBE=function($,W,ge){$=$>>>0,W=W>>>0,ge||N($,W,this.length);let _e=W,Re=1,Be=this[$+--_e];for(;_e>0&&(Re*=256);)Be+=this[$+--_e]*Re;return Re*=128,Be>=Re&&(Be-=Math.pow(2,8*W)),Be},c.prototype.readInt8=function($,W){return $=$>>>0,W||N($,1,this.length),this[$]&128?(255-this[$]+1)*-1:this[$]},c.prototype.readInt16LE=function($,W){$=$>>>0,W||N($,2,this.length);const ge=this[$]|this[$+1]<<8;return ge&32768?ge|4294901760:ge},c.prototype.readInt16BE=function($,W){$=$>>>0,W||N($,2,this.length);const ge=this[$+1]|this[$]<<8;return ge&32768?ge|4294901760:ge},c.prototype.readInt32LE=function($,W){return $=$>>>0,W||N($,4,this.length),this[$]|this[$+1]<<8|this[$+2]<<16|this[$+3]<<24},c.prototype.readInt32BE=function($,W){return $=$>>>0,W||N($,4,this.length),this[$]<<24|this[$+1]<<16|this[$+2]<<8|this[$+3]},c.prototype.readBigInt64LE=_t(function($){$=$>>>0,ue($,"offset");const W=this[$],ge=this[$+7];(W===void 0||ge===void 0)&&re($,this.length-8);const _e=this[$+4]+this[$+5]*2**8+this[$+6]*2**16+(ge<<24);return(BigInt(_e)<<BigInt(32))+BigInt(W+this[++$]*2**8+this[++$]*2**16+this[++$]*2**24)}),c.prototype.readBigInt64BE=_t(function($){$=$>>>0,ue($,"offset");const W=this[$],ge=this[$+7];(W===void 0||ge===void 0)&&re($,this.length-8);const _e=(W<<24)+this[++$]*2**16+this[++$]*2**8+this[++$];return(BigInt(_e)<<BigInt(32))+BigInt(this[++$]*2**24+this[++$]*2**16+this[++$]*2**8+ge)}),c.prototype.readFloatLE=function($,W){return $=$>>>0,W||N($,4,this.length),t.read(this,$,!0,23,4)},c.prototype.readFloatBE=function($,W){return $=$>>>0,W||N($,4,this.length),t.read(this,$,!1,23,4)},c.prototype.readDoubleLE=function($,W){return $=$>>>0,W||N($,8,this.length),t.read(this,$,!0,52,8)},c.prototype.readDoubleBE=function($,W){return $=$>>>0,W||N($,8,this.length),t.read(this,$,!1,52,8)};function T(Z,$,W,ge,_e,Re){if(!c.isBuffer(Z))throw new TypeError('"buffer" argument must be a Buffer instance');if($>_e||$<Re)throw new RangeError('"value" argument is out of bounds');if(W+ge>Z.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function($,W,ge,_e){if($=+$,W=W>>>0,ge=ge>>>0,!_e){const wt=Math.pow(2,8*ge)-1;T(this,$,W,ge,wt,0)}let Re=1,Be=0;for(this[W]=$&255;++Be<ge&&(Re*=256);)this[W+Be]=$/Re&255;return W+ge},c.prototype.writeUintBE=c.prototype.writeUIntBE=function($,W,ge,_e){if($=+$,W=W>>>0,ge=ge>>>0,!_e){const wt=Math.pow(2,8*ge)-1;T(this,$,W,ge,wt,0)}let Re=ge-1,Be=1;for(this[W+Re]=$&255;--Re>=0&&(Be*=256);)this[W+Re]=$/Be&255;return W+ge},c.prototype.writeUint8=c.prototype.writeUInt8=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,1,255,0),this[W]=$&255,W+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,2,65535,0),this[W]=$&255,this[W+1]=$>>>8,W+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,2,65535,0),this[W]=$>>>8,this[W+1]=$&255,W+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,4,4294967295,0),this[W+3]=$>>>24,this[W+2]=$>>>16,this[W+1]=$>>>8,this[W]=$&255,W+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,4,4294967295,0),this[W]=$>>>24,this[W+1]=$>>>16,this[W+2]=$>>>8,this[W+3]=$&255,W+4};function Y(Z,$,W,ge,_e){pe($,ge,_e,Z,W,7);let Re=Number($&BigInt(4294967295));Z[W++]=Re,Re=Re>>8,Z[W++]=Re,Re=Re>>8,Z[W++]=Re,Re=Re>>8,Z[W++]=Re;let Be=Number($>>BigInt(32)&BigInt(4294967295));return Z[W++]=Be,Be=Be>>8,Z[W++]=Be,Be=Be>>8,Z[W++]=Be,Be=Be>>8,Z[W++]=Be,W}function ee(Z,$,W,ge,_e){pe($,ge,_e,Z,W,7);let Re=Number($&BigInt(4294967295));Z[W+7]=Re,Re=Re>>8,Z[W+6]=Re,Re=Re>>8,Z[W+5]=Re,Re=Re>>8,Z[W+4]=Re;let Be=Number($>>BigInt(32)&BigInt(4294967295));return Z[W+3]=Be,Be=Be>>8,Z[W+2]=Be,Be=Be>>8,Z[W+1]=Be,Be=Be>>8,Z[W]=Be,W+8}c.prototype.writeBigUInt64LE=_t(function($,W=0){return Y(this,$,W,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=_t(function($,W=0){return ee(this,$,W,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function($,W,ge,_e){if($=+$,W=W>>>0,!_e){const yt=Math.pow(2,8*ge-1);T(this,$,W,ge,yt-1,-yt)}let Re=0,Be=1,wt=0;for(this[W]=$&255;++Re<ge&&(Be*=256);)$<0&&wt===0&&this[W+Re-1]!==0&&(wt=1),this[W+Re]=($/Be>>0)-wt&255;return W+ge},c.prototype.writeIntBE=function($,W,ge,_e){if($=+$,W=W>>>0,!_e){const yt=Math.pow(2,8*ge-1);T(this,$,W,ge,yt-1,-yt)}let Re=ge-1,Be=1,wt=0;for(this[W+Re]=$&255;--Re>=0&&(Be*=256);)$<0&&wt===0&&this[W+Re+1]!==0&&(wt=1),this[W+Re]=($/Be>>0)-wt&255;return W+ge},c.prototype.writeInt8=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,1,127,-128),$<0&&($=255+$+1),this[W]=$&255,W+1},c.prototype.writeInt16LE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,2,32767,-32768),this[W]=$&255,this[W+1]=$>>>8,W+2},c.prototype.writeInt16BE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,2,32767,-32768),this[W]=$>>>8,this[W+1]=$&255,W+2},c.prototype.writeInt32LE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,4,2147483647,-2147483648),this[W]=$&255,this[W+1]=$>>>8,this[W+2]=$>>>16,this[W+3]=$>>>24,W+4},c.prototype.writeInt32BE=function($,W,ge){return $=+$,W=W>>>0,ge||T(this,$,W,4,2147483647,-2147483648),$<0&&($=4294967295+$+1),this[W]=$>>>24,this[W+1]=$>>>16,this[W+2]=$>>>8,this[W+3]=$&255,W+4},c.prototype.writeBigInt64LE=_t(function($,W=0){return Y(this,$,W,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=_t(function($,W=0){return ee(this,$,W,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function j(Z,$,W,ge,_e,Re){if(W+ge>Z.length)throw new RangeError("Index out of range");if(W<0)throw new RangeError("Index out of range")}function be(Z,$,W,ge,_e){return $=+$,W=W>>>0,_e||j(Z,$,W,4),t.write(Z,$,W,ge,23,4),W+4}c.prototype.writeFloatLE=function($,W,ge){return be(this,$,W,!0,ge)},c.prototype.writeFloatBE=function($,W,ge){return be(this,$,W,!1,ge)};function Ie(Z,$,W,ge,_e){return $=+$,W=W>>>0,_e||j(Z,$,W,8),t.write(Z,$,W,ge,52,8),W+8}c.prototype.writeDoubleLE=function($,W,ge){return Ie(this,$,W,!0,ge)},c.prototype.writeDoubleBE=function($,W,ge){return Ie(this,$,W,!1,ge)},c.prototype.copy=function($,W,ge,_e){if(!c.isBuffer($))throw new TypeError("argument should be a Buffer");if(ge||(ge=0),!_e&&_e!==0&&(_e=this.length),W>=$.length&&(W=$.length),W||(W=0),_e>0&&_e<ge&&(_e=ge),_e===ge||$.length===0||this.length===0)return 0;if(W<0)throw new RangeError("targetStart out of bounds");if(ge<0||ge>=this.length)throw new RangeError("Index out of range");if(_e<0)throw new RangeError("sourceEnd out of bounds");_e>this.length&&(_e=this.length),$.length-W<_e-ge&&(_e=$.length-W+ge);const Re=_e-ge;return this===$&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(W,ge,_e):Uint8Array.prototype.set.call($,this.subarray(ge,_e),W),Re},c.prototype.fill=function($,W,ge,_e){if(typeof $=="string"){if(typeof W=="string"?(_e=W,W=0,ge=this.length):typeof ge=="string"&&(_e=ge,ge=this.length),_e!==void 0&&typeof _e!="string")throw new TypeError("encoding must be a string");if(typeof _e=="string"&&!c.isEncoding(_e))throw new TypeError("Unknown encoding: "+_e);if($.length===1){const Be=$.charCodeAt(0);(_e==="utf8"&&Be<128||_e==="latin1")&&($=Be)}}else typeof $=="number"?$=$&255:typeof $=="boolean"&&($=Number($));if(W<0||this.length<W||this.length<ge)throw new RangeError("Out of range index");if(ge<=W)return this;W=W>>>0,ge=ge===void 0?this.length:ge>>>0,$||($=0);let Re;if(typeof $=="number")for(Re=W;Re<ge;++Re)this[Re]=$;else{const Be=c.isBuffer($)?$:c.from($,_e),wt=Be.length;if(wt===0)throw new TypeError('The value "'+$+'" is invalid for argument "value"');for(Re=0;Re<ge-W;++Re)this[Re+W]=Be[Re%wt]}return this};const Me={};function De(Z,$,W){Me[Z]=class extends W{constructor(){super(),Object.defineProperty(this,"message",{value:$.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Z}]`,this.stack,delete this.name}get code(){return Z}set code(_e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:_e,writable:!0})}toString(){return`${this.name} [${Z}]: ${this.message}`}}}De("ERR_BUFFER_OUT_OF_BOUNDS",function(Z){return Z?`${Z} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),De("ERR_INVALID_ARG_TYPE",function(Z,$){return`The "${Z}" argument must be of type number. Received type ${typeof $}`},TypeError),De("ERR_OUT_OF_RANGE",function(Z,$,W){let ge=`The value of "${Z}" is out of range.`,_e=W;return Number.isInteger(W)&&Math.abs(W)>2**32?_e=se(String(W)):typeof W=="bigint"&&(_e=String(W),(W>BigInt(2)**BigInt(32)||W<-(BigInt(2)**BigInt(32)))&&(_e=se(_e)),_e+="n"),ge+=` It must be ${$}. Received ${_e}`,ge},RangeError);function se(Z){let $="",W=Z.length;const ge=Z[0]==="-"?1:0;for(;W>=ge+4;W-=3)$=`_${Z.slice(W-3,W)}${$}`;return`${Z.slice(0,W)}${$}`}function fe(Z,$,W){ue($,"offset"),(Z[$]===void 0||Z[$+W]===void 0)&&re($,Z.length-(W+1))}function pe(Z,$,W,ge,_e,Re){if(Z>W||Z<$){const Be=typeof $=="bigint"?"n":"";let wt;throw $===0||$===BigInt(0)?wt=`>= 0${Be} and < 2${Be} ** ${(Re+1)*8}${Be}`:wt=`>= -(2${Be} ** ${(Re+1)*8-1}${Be}) and < 2 ** ${(Re+1)*8-1}${Be}`,new Me.ERR_OUT_OF_RANGE("value",wt,Z)}fe(ge,_e,Re)}function ue(Z,$){if(typeof Z!="number")throw new Me.ERR_INVALID_ARG_TYPE($,"number",Z)}function re(Z,$,W){throw Math.floor(Z)!==Z?(ue(Z,W),new Me.ERR_OUT_OF_RANGE("offset","an integer",Z)):$<0?new Me.ERR_BUFFER_OUT_OF_BOUNDS:new Me.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${$}`,Z)}const me=/[^+/0-9A-Za-z-_]/g;function J(Z){if(Z=Z.split("=")[0],Z=Z.trim().replace(me,""),Z.length<2)return"";for(;Z.length%4!==0;)Z=Z+"=";return Z}function P(Z,$){$=$||1/0;let W;const ge=Z.length;let _e=null;const Re=[];for(let Be=0;Be<ge;++Be){if(W=Z.charCodeAt(Be),W>55295&&W<57344){if(!_e){if(W>56319){($-=3)>-1&&Re.push(239,191,189);continue}else if(Be+1===ge){($-=3)>-1&&Re.push(239,191,189);continue}_e=W;continue}if(W<56320){($-=3)>-1&&Re.push(239,191,189),_e=W;continue}W=(_e-55296<<10|W-56320)+65536}else _e&&($-=3)>-1&&Re.push(239,191,189);if(_e=null,W<128){if(($-=1)<0)break;Re.push(W)}else if(W<2048){if(($-=2)<0)break;Re.push(W>>6|192,W&63|128)}else if(W<65536){if(($-=3)<0)break;Re.push(W>>12|224,W>>6&63|128,W&63|128)}else if(W<1114112){if(($-=4)<0)break;Re.push(W>>18|240,W>>12&63|128,W>>6&63|128,W&63|128)}else throw new Error("Invalid code point")}return Re}function U(Z){const $=[];for(let W=0;W<Z.length;++W)$.push(Z.charCodeAt(W)&255);return $}function te(Z,$){let W,ge,_e;const Re=[];for(let Be=0;Be<Z.length&&!(($-=2)<0);++Be)W=Z.charCodeAt(Be),ge=W>>8,_e=W%256,Re.push(_e),Re.push(ge);return Re}function le(Z){return e.toByteArray(J(Z))}function Ee(Z,$,W,ge){let _e;for(_e=0;_e<ge&&!(_e+W>=$.length||_e>=Z.length);++_e)$[_e+W]=Z[_e];return _e}function Ne(Z,$){return Z instanceof $||Z!=null&&Z.constructor!=null&&Z.constructor.name!=null&&Z.constructor.name===$.name}function Qe(Z){return Z!==Z}const st=function(){const Z="0123456789abcdef",$=new Array(256);for(let W=0;W<16;++W){const ge=W*16;for(let _e=0;_e<16;++_e)$[ge+_e]=Z[W]+Z[_e]}return $}();function _t(Z){return typeof BigInt>"u"?Et:Z}function Et(){throw new Error("BigInt not supported")}})(Hd);var ma={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},EF={exports:{}},zv={exports:{}},cN;function Tb(){if(cN)return zv.exports;cN=1;const{AbortController:n,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return zv.exports=n,zv.exports.AbortSignal=e,zv.exports.default=n,zv.exports}var U5={exports:{}},$y=typeof Reflect=="object"?Reflect:null,fN=$y&&typeof $y.apply=="function"?$y.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Nx;$y&&typeof $y.ownKeys=="function"?Nx=$y.ownKeys:Object.getOwnPropertySymbols?Nx=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Nx=function(e){return Object.getOwnPropertyNames(e)};function aae(n){console&&console.warn&&console.warn(n)}var AF=Number.isNaN||function(e){return e!==e};function Ar(){Ar.init.call(this)}U5.exports=Ar;U5.exports.once=lae;Ar.EventEmitter=Ar;Ar.prototype._events=void 0;Ar.prototype._eventsCount=0;Ar.prototype._maxListeners=void 0;var dN=10;function F2(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(Ar,"defaultMaxListeners",{enumerable:!0,get:function(){return dN},set:function(n){if(typeof n!="number"||n<0||AF(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");dN=n}});Ar.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};Ar.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||AF(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 kF(n){return n._maxListeners===void 0?Ar.defaultMaxListeners:n._maxListeners}Ar.prototype.getMaxListeners=function(){return kF(this)};Ar.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 l;if(t.length>0&&(l=t[0]),l instanceof Error)throw l;var c=new Error("Unhandled error."+(l?" ("+l.message+")":""));throw c.context=l,c}var p=o[e];if(p===void 0)return!1;if(typeof p=="function")fN(p,this,t);else for(var h=p.length,m=LF(p,h),r=0;r<h;++r)fN(m[r],this,t);return!0};function MF(n,e,t,r){var i,o,l;if(F2(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),l=o[e]),l===void 0)l=o[e]=t,++n._eventsCount;else if(typeof l=="function"?l=o[e]=r?[t,l]:[l,t]:r?l.unshift(t):l.push(t),i=kF(n),i>0&&l.length>i&&!l.warned){l.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=n,c.type=e,c.count=l.length,aae(c)}return n}Ar.prototype.addListener=function(e,t){return MF(this,e,t,!1)};Ar.prototype.on=Ar.prototype.addListener;Ar.prototype.prependListener=function(e,t){return MF(this,e,t,!0)};function iae(){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 TF(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=iae.bind(r);return i.listener=t,r.wrapFn=i,i}Ar.prototype.once=function(e,t){return F2(t),this.on(e,TF(this,e,t)),this};Ar.prototype.prependOnceListener=function(e,t){return F2(t),this.prependListener(e,TF(this,e,t)),this};Ar.prototype.removeListener=function(e,t){var r,i,o,l,c;if(F2(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,l=r.length-1;l>=0;l--)if(r[l]===t||r[l].listener===t){c=r[l].listener,o=l;break}if(o<0)return this;o===0?r.shift():sae(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,c||t)}return this};Ar.prototype.off=Ar.prototype.removeListener;Ar.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),l;for(i=0;i<o.length;++i)l=o[i],l!=="removeListener"&&this.removeAllListeners(l);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 RF(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?oae(i):LF(i,i.length)}Ar.prototype.listeners=function(e){return RF(this,e,!0)};Ar.prototype.rawListeners=function(e){return RF(this,e,!1)};Ar.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):OF.call(n,e)};Ar.prototype.listenerCount=OF;function OF(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}Ar.prototype.eventNames=function(){return this._eventsCount>0?Nx(this._events):[]};function LF(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function sae(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function oae(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function lae(n,e){return new Promise(function(t,r){function i(l){n.removeListener(e,o),r(l)}function o(){typeof n.removeListener=="function"&&n.removeListener("error",i),t([].slice.call(arguments))}NF(n,e,o,{once:!0}),e!=="error"&&uae(n,i,{once:!0})})}function uae(n,e,t){typeof n.on=="function"&&NF(n,"error",e,t)}function NF(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 Gb=U5.exports;(function(n){const e=Hd,{kResistStopPropagation:t,SymbolDispose:r}=ma,i=globalThis.AbortSignal||Tb().AbortSignal,o=globalThis.AbortController||Tb().AbortController,l=Object.getPrototypeOf(async function(){}).constructor,c=globalThis.Blob||e.Blob,p=typeof c<"u"?function(g){return g instanceof c}:function(g){return!1},h=(b,g)=>{if(b!==void 0&&(b===null||typeof b!="object"||!("aborted"in b)))throw new ERR_INVALID_ARG_TYPE(g,"AbortSignal",b)},m=(b,g)=>{if(typeof b!="function")throw new ERR_INVALID_ARG_TYPE(g,"Function",b)};class w extends Error{constructor(g){if(!Array.isArray(g))throw new TypeError(`Expected input to be an Array, got ${typeof g}`);let S="";for(let A=0;A<g.length;A++)S+=` ${g[A].stack}
|
|
326
|
-
`;super(S),this.name="AggregateError",this.errors=g}}n.exports={AggregateError:w,kEmptyObject:Object.freeze({}),once(b){let g=!1;return function(...S){g||(g=!0,b.apply(this,S))}},createDeferredPromise:function(){let b,g;return{promise:new Promise((A,k)=>{b=A,g=k}),resolve:b,reject:g}},promisify(b){return new Promise((g,S)=>{b((A,...k)=>A?S(A):g(...k))})},debuglog(){return function(){}},format(b,...g){return b.replace(/%([sdifj])/g,function(...[S,A]){const k=g.shift();return A==="f"?k.toFixed(6):A==="j"?JSON.stringify(k):A==="s"&&typeof k=="object"?`${k.constructor!==Object?k.constructor.name:""} {}`.trim():k.toString()})},inspect(b){switch(typeof b){case"string":if(b.includes("'"))if(b.includes('"')){if(!b.includes("`")&&!b.includes("${"))return`\`${b}\``}else return`"${b}"`;return`'${b}'`;case"number":return isNaN(b)?"NaN":Object.is(b,-0)?String(b):b;case"bigint":return`${String(b)}n`;case"boolean":case"undefined":return String(b);case"object":return"{}"}},types:{isAsyncFunction(b){return b instanceof l},isArrayBufferView(b){return ArrayBuffer.isView(b)}},isBlob:p,deprecate(b,g){return b},addAbortListener:Gb.addAbortListener||function(g,S){if(g===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",g);h(g,"signal"),m(S,"listener");let A;return g.aborted?queueMicrotask(()=>S()):(g.addEventListener("abort",S,{__proto__:null,once:!0,[t]:!0}),A=()=>{g.removeEventListener("abort",S)}),{__proto__:null,[r](){var k;(k=A)===null||k===void 0||k()}}},AbortSignalAny:i.any||function(g){if(g.length===1)return g[0];const S=new o,A=()=>S.abort();return g.forEach(k=>{h(k,"signals"),k.addEventListener("abort",A,{once:!0})}),S.signal.addEventListener("abort",()=>{g.forEach(k=>k.removeEventListener("abort",A))},{once:!0}),S.signal}},n.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(EF);var xs=EF.exports,F5={};const{format:cae,inspect:Xx,AggregateError:fae}=xs,dae=globalThis.AggregateError||fae,pae=Symbol("kIsNodeError"),hae=["string","function","number","object","Function","Object","boolean","bigint","symbol"],yae=/^([A-Z][a-z0-9]*)+$/,mae="__node_internal_",B2={};function ch(n,e){if(!n)throw new B2.ERR_INTERNAL_ASSERTION(e)}function pN(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 gae(n,e,t){if(typeof e=="function")return ch(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 ch(r===t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${r}).`),t.length===0?e:cae(e,...t)}function Mi(n,e,t){t||(t=Error);class r extends t{constructor(...o){super(gae(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[pae]=!0,B2[n]=r}function hN(n){const e=mae+n.name;return Object.defineProperty(n,"name",{value:e}),n}function vae(n,e){if(n&&e&&n!==e){if(Array.isArray(e.errors))return e.errors.push(n),e;const t=new dae([e,n],e.message);return t.code=e.code,t}return n||e}let bae=class extends Error{constructor(e="The operation was aborted",t=void 0){if(t!==void 0&&typeof t!="object")throw new B2.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Mi("ERR_ASSERTION","%s",Error);Mi("ERR_INVALID_ARG_TYPE",(n,e,t)=>{ch(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=[],l=[];for(const p of e)ch(typeof p=="string","All expected entries have to be of type string"),hae.includes(p)?i.push(p.toLowerCase()):yae.test(p)?o.push(p):(ch(p!=="object",'The value "object" should be written as "Object"'),l.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||l.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}`}}l.length>0&&(r+=" or ")}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(r+="an "),r+=`${l[0]}`;break;case 2:r+=`one of ${l[0]} or ${l[1]}`;break;default:{const p=l.pop();r+=`one of ${l.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=Xx(t,{depth:-1});r+=`. Received ${p}`}}else{let p=Xx(t,{colors:!1});p.length>25&&(p=`${p.slice(0,25)}...`),r+=`. Received type ${typeof t} (${p})`}return r},TypeError);Mi("ERR_INVALID_ARG_VALUE",(n,e,t="is invalid")=>{let r=Xx(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${n.includes(".")?"property":"argument"} '${n}' ${t}. Received ${r}`},TypeError);Mi("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);Mi("ERR_MISSING_ARGS",(...n)=>{ch(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);Mi("ERR_OUT_OF_RANGE",(n,e,t)=>{ch(e,'Missing "range" argument');let r;return Number.isInteger(t)&&Math.abs(t)>2**32?r=pN(String(t)):typeof t=="bigint"?(r=String(t),(t>2n**32n||t<-(2n**32n))&&(r=pN(r)),r+="n"):r=Xx(t),`The value of "${n}" is out of range. It must be ${e}. Received ${r}`},RangeError);Mi("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Mi("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Mi("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Mi("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Mi("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Mi("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Mi("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Mi("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Mi("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Mi("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Mi("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var eo={AbortError:bae,aggregateTwoErrors:hN(vae),hideStackFrames:hN,codes:B2};const{ArrayIsArray:B5,ArrayPrototypeIncludes:PF,ArrayPrototypeJoin:IF,ArrayPrototypeMap:wae,NumberIsInteger:z5,NumberIsNaN:_ae,NumberMAX_SAFE_INTEGER:xae,NumberMIN_SAFE_INTEGER:Sae,NumberParseInt:Cae,ObjectPrototypeHasOwnProperty:Eae,RegExpPrototypeExec:DF,String:Aae,StringPrototypeToUpperCase:kae,StringPrototypeTrim:Mae}=ma,{hideStackFrames:Yo,codes:{ERR_SOCKET_BAD_PORT:Tae,ERR_INVALID_ARG_TYPE:rs,ERR_INVALID_ARG_VALUE:bm,ERR_OUT_OF_RANGE:gh,ERR_UNKNOWN_SIGNAL:yN}}=eo,{normalizeEncoding:Rae}=xs,{isAsyncFunction:Oae,isArrayBufferView:Lae}=xs.types,mN={};function Nae(n){return n===(n|0)}function Pae(n){return n===n>>>0}const Iae=/^[0-7]+$/,Dae="must be a 32-bit unsigned integer or an octal string";function Uae(n,e,t){if(typeof n>"u"&&(n=t),typeof n=="string"){if(DF(Iae,n)===null)throw new bm(e,n,Dae);n=Cae(n,8)}return UF(n,e),n}const Fae=Yo((n,e,t=Sae,r=xae)=>{if(typeof n!="number")throw new rs(e,"number",n);if(!z5(n))throw new gh(e,"an integer",n);if(n<t||n>r)throw new gh(e,`>= ${t} && <= ${r}`,n)}),Bae=Yo((n,e,t=-2147483648,r=2147483647)=>{if(typeof n!="number")throw new rs(e,"number",n);if(!z5(n))throw new gh(e,"an integer",n);if(n<t||n>r)throw new gh(e,`>= ${t} && <= ${r}`,n)}),UF=Yo((n,e,t=!1)=>{if(typeof n!="number")throw new rs(e,"number",n);if(!z5(n))throw new gh(e,"an integer",n);const r=t?1:0,i=4294967295;if(n<r||n>i)throw new gh(e,`>= ${r} && <= ${i}`,n)});function j5(n,e){if(typeof n!="string")throw new rs(e,"string",n)}function zae(n,e,t=void 0,r){if(typeof n!="number")throw new rs(e,"number",n);if(t!=null&&n<t||r!=null&&n>r||(t!=null||r!=null)&&_ae(n))throw new gh(e,`${t!=null?`>= ${t}`:""}${t!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,n)}const jae=Yo((n,e,t)=>{if(!PF(t,n)){const i="must be one of: "+IF(wae(t,o=>typeof o=="string"?`'${o}'`:Aae(o)),", ");throw new bm(e,n,i)}});function FF(n,e){if(typeof n!="boolean")throw new rs(e,"boolean",n)}function h8(n,e,t){return n==null||!Eae(n,e)?t:n[e]}const Hae=Yo((n,e,t=null)=>{const r=h8(t,"allowArray",!1),i=h8(t,"allowFunction",!1);if(!h8(t,"nullable",!1)&&n===null||!r&&B5(n)||typeof n!="object"&&(!i||typeof n!="function"))throw new rs(e,"Object",n)}),$ae=Yo((n,e)=>{if(n!=null&&typeof n!="object"&&typeof n!="function")throw new rs(e,"a dictionary",n)}),z2=Yo((n,e,t=0)=>{if(!B5(n))throw new rs(e,"Array",n);if(n.length<t){const r=`must be longer than ${t}`;throw new bm(e,n,r)}});function qae(n,e){z2(n,e);for(let t=0;t<n.length;t++)j5(n[t],`${e}[${t}]`)}function Vae(n,e){z2(n,e);for(let t=0;t<n.length;t++)FF(n[t],`${e}[${t}]`)}function Gae(n,e){z2(n,e);for(let t=0;t<n.length;t++){const r=n[t],i=`${e}[${t}]`;if(r==null)throw new rs(i,"AbortSignal",r);BF(r,i)}}function Wae(n,e="signal"){if(j5(n,e),mN[n]===void 0)throw mN[kae(n)]!==void 0?new yN(n+" (signals must use all capital letters)"):new yN(n)}const Kae=Yo((n,e="buffer")=>{if(!Lae(n))throw new rs(e,["Buffer","TypedArray","DataView"],n)});function Yae(n,e){const t=Rae(e),r=n.length;if(t==="hex"&&r%2!==0)throw new bm("encoding",e,`is invalid for data of length ${r}`)}function Jae(n,e="Port",t=!0){if(typeof n!="number"&&typeof n!="string"||typeof n=="string"&&Mae(n).length===0||+n!==+n>>>0||n>65535||n===0&&!t)throw new Tae(e,n,t);return n|0}const BF=Yo((n,e)=>{if(n!==void 0&&(n===null||typeof n!="object"||!("aborted"in n)))throw new rs(e,"AbortSignal",n)}),Qae=Yo((n,e)=>{if(typeof n!="function")throw new rs(e,"Function",n)}),Zae=Yo((n,e)=>{if(typeof n!="function"||Oae(n))throw new rs(e,"Function",n)}),Xae=Yo((n,e)=>{if(n!==void 0)throw new rs(e,"undefined",n)});function eie(n,e,t){if(!PF(t,n))throw new rs(e,`('${IF(t,"|")}')`,n)}const tie=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function gN(n,e){if(typeof n>"u"||!DF(tie,n))throw new bm(e,n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function nie(n){if(typeof n=="string")return gN(n,"hints"),n;if(B5(n)){const e=n.length;let t="";if(e===0)return t;for(let r=0;r<e;r++){const i=n[r];gN(i,"hints"),t+=i,r!==e-1&&(t+=", ")}return t}throw new bm("hints",n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}var Wb={isInt32:Nae,isUint32:Pae,parseFileMode:Uae,validateArray:z2,validateStringArray:qae,validateBooleanArray:Vae,validateAbortSignalArray:Gae,validateBoolean:FF,validateBuffer:Kae,validateDictionary:$ae,validateEncoding:Yae,validateFunction:Qae,validateInt32:Bae,validateInteger:Fae,validateNumber:zae,validateObject:Hae,validateOneOf:jae,validatePlainFunction:Zae,validatePort:Jae,validateSignalName:Wae,validateString:j5,validateUint32:UF,validateUndefined:Xae,validateUnion:eie,validateAbortSignal:BF,validateLinkHeaderValue:nie},H5={exports:{}},y8={exports:{}},vN;function $d(){if(vN)return y8.exports;vN=1;var n=y8.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(A){if(e===setTimeout)return setTimeout(A,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(A,0);try{return e(A,0)}catch{try{return e.call(null,A,0)}catch{return e.call(this,A,0)}}}function l(A){if(t===clearTimeout)return clearTimeout(A);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(A);try{return t(A)}catch{try{return t.call(null,A)}catch{return t.call(this,A)}}}var c=[],p=!1,h,m=-1;function w(){!p||!h||(p=!1,h.length?c=h.concat(c):m=-1,c.length&&b())}function b(){if(!p){var A=o(w);p=!0;for(var k=c.length;k;){for(h=c,c=[];++m<k;)h&&h[m].run();m=-1,k=c.length}h=null,p=!1,l(A)}}n.nextTick=function(A){var k=new Array(arguments.length-1);if(arguments.length>1)for(var R=1;R<arguments.length;R++)k[R-1]=arguments[R];c.push(new g(A,k)),c.length===1&&!p&&o(b)};function g(A,k){this.fun=A,this.array=k}g.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={};function S(){}return n.on=S,n.addListener=S,n.once=S,n.off=S,n.removeListener=S,n.removeAllListeners=S,n.emit=S,n.prependListener=S,n.prependOnceListener=S,n.listeners=function(A){return[]},n.binding=function(A){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(A){throw new Error("process.chdir is not supported")},n.umask=function(){return 0},y8.exports}const{SymbolAsyncIterator:bN,SymbolIterator:wN,SymbolFor:Th}=ma,zF=Th("nodejs.stream.destroyed"),jF=Th("nodejs.stream.errored"),C4=Th("nodejs.stream.readable"),E4=Th("nodejs.stream.writable"),HF=Th("nodejs.stream.disturbed"),rie=Th("nodejs.webstream.isClosedPromise"),aie=Th("nodejs.webstream.controllerErrorFunction");function j2(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 H2(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 iie(n){return!!(n&&typeof n.pipe=="function"&&n._readableState&&typeof n.on=="function"&&typeof n.write=="function")}function Qu(n){return n&&(n._readableState||n._writableState||typeof n.write=="function"&&typeof n.on=="function"||typeof n.pipe=="function"&&typeof n.on=="function")}function $F(n){return!!(n&&!Qu(n)&&typeof n.pipeThrough=="function"&&typeof n.getReader=="function"&&typeof n.cancel=="function")}function qF(n){return!!(n&&!Qu(n)&&typeof n.getWriter=="function"&&typeof n.abort=="function")}function VF(n){return!!(n&&!Qu(n)&&typeof n.readable=="object"&&typeof n.writable=="object")}function sie(n){return $F(n)||qF(n)||VF(n)}function oie(n,e){return n==null?!1:e===!0?typeof n[bN]=="function":e===!1?typeof n[wN]=="function":typeof n[bN]=="function"||typeof n[wN]=="function"}function $2(n){if(!Qu(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!!(n.destroyed||n[zF]||r!=null&&r.destroyed)}function GF(n){if(!H2(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 lie(n,e){if(!H2(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 uie(n){if(!j2(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 WF(n,e){if(!j2(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 KF(n){return n&&n[C4]!=null?n[C4]:typeof(n==null?void 0:n.readable)!="boolean"?null:$2(n)?!1:j2(n)&&n.readable&&!WF(n)}function YF(n){return n&&n[E4]!=null?n[E4]:typeof(n==null?void 0:n.writable)!="boolean"?null:$2(n)?!1:H2(n)&&n.writable&&!GF(n)}function cie(n,e){return Qu(n)?$2(n)?!0:!((e==null?void 0:e.readable)!==!1&&KF(n)||(e==null?void 0:e.writable)!==!1&&YF(n)):null}function fie(n){var e,t;return Qu(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 die(n){var e,t;return Qu(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 pie(n){if(!Qu(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"&&JF(n)?n._closed:null}function JF(n){return typeof n._closed=="boolean"&&typeof n._defaultKeepAlive=="boolean"&&typeof n._removedConnection=="boolean"&&typeof n._removedContLen=="boolean"}function QF(n){return typeof n._sent100=="boolean"&&JF(n)}function hie(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(!Qu(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!r&&QF(n)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function mie(n){var e;return!!(n&&((e=n[HF])!==null&&e!==void 0?e:n.readableDidRead||n.readableAborted))}function gie(n){var e,t,r,i,o,l,c,p,h,m;return!!(n&&((e=(t=(r=(i=(o=(l=n[jF])!==null&&l!==void 0?l: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:!((m=n._writableState)===null||m===void 0)&&m.errored))}var ef={isDestroyed:$2,kIsDestroyed:zF,isDisturbed:mie,kIsDisturbed:HF,isErrored:gie,kIsErrored:jF,isReadable:KF,kIsReadable:C4,kIsClosedPromise:rie,kControllerErrorFunction:aie,kIsWritable:E4,isClosed:pie,isDuplexNodeStream:iie,isFinished:cie,isIterable:oie,isReadableNodeStream:j2,isReadableStream:$F,isReadableEnded:uie,isReadableFinished:WF,isReadableErrored:die,isNodeStream:Qu,isWebStream:sie,isWritable:YF,isWritableNodeStream:H2,isWritableStream:qF,isWritableEnded:GF,isWritableFinished:lie,isWritableErrored:fie,isServerRequest:hie,isServerResponse:QF,willEmitClose:yie,isTransformStream:VF};const wd=$d(),{AbortError:ZF,codes:vie}=eo,{ERR_INVALID_ARG_TYPE:bie,ERR_STREAM_PREMATURE_CLOSE:_N}=vie,{kEmptyObject:A4,once:k4}=xs,{validateAbortSignal:wie,validateFunction:_ie,validateObject:xie,validateBoolean:Sie}=Wb,{Promise:Cie,PromisePrototypeThen:Eie,SymbolDispose:XF}=ma,{isClosed:Aie,isReadable:xN,isReadableNodeStream:m8,isReadableStream:kie,isReadableFinished:SN,isReadableErrored:CN,isWritable:EN,isWritableNodeStream:AN,isWritableStream:Mie,isWritableFinished:kN,isWritableErrored:MN,isNodeStream:Tie,willEmitClose:Rie,kIsClosedPromise:Oie}=ef;let qy;function Lie(n){return n.setHeader&&typeof n.abort=="function"}const M4=()=>{};function eB(n,e,t){var r,i;if(arguments.length===2?(t=e,e=A4):e==null?e=A4:xie(e,"options"),_ie(t,"callback"),wie(e.signal,"options.signal"),t=k4(t),kie(n)||Mie(n))return Nie(n,e,t);if(!Tie(n))throw new bie("stream",["ReadableStream","WritableStream","Stream"],n);const o=(r=e.readable)!==null&&r!==void 0?r:m8(n),l=(i=e.writable)!==null&&i!==void 0?i:AN(n),c=n._writableState,p=n._readableState,h=()=>{n.writable||b()};let m=Rie(n)&&m8(n)===o&&AN(n)===l,w=kN(n,!1);const b=()=>{w=!0,n.destroyed&&(m=!1),!(m&&(!n.readable||o))&&(!o||g)&&t.call(n)};let g=SN(n,!1);const S=()=>{g=!0,n.destroyed&&(m=!1),!(m&&(!n.writable||l))&&(!l||w)&&t.call(n)},A=G=>{t.call(n,G)};let k=Aie(n);const R=()=>{k=!0;const G=MN(n)||CN(n);if(G&&typeof G!="boolean")return t.call(n,G);if(o&&!g&&m8(n,!0)&&!SN(n,!1))return t.call(n,new _N);if(l&&!w&&!kN(n,!1))return t.call(n,new _N);t.call(n)},L=()=>{k=!0;const G=MN(n)||CN(n);if(G&&typeof G!="boolean")return t.call(n,G);t.call(n)},I=()=>{n.req.on("finish",b)};Lie(n)?(n.on("complete",b),m||n.on("abort",R),n.req?I():n.on("request",I)):l&&!c&&(n.on("end",h),n.on("close",h)),!m&&typeof n.aborted=="boolean"&&n.on("aborted",R),n.on("end",S),n.on("finish",b),e.error!==!1&&n.on("error",A),n.on("close",R),k?wd.nextTick(R):c!=null&&c.errorEmitted||p!=null&&p.errorEmitted?m||wd.nextTick(L):(!o&&(!m||xN(n))&&(w||EN(n)===!1)||!l&&(!m||EN(n))&&(g||xN(n)===!1)||p&&n.req&&n.aborted)&&wd.nextTick(L);const q=()=>{t=M4,n.removeListener("aborted",R),n.removeListener("complete",b),n.removeListener("abort",R),n.removeListener("request",I),n.req&&n.req.removeListener("finish",b),n.removeListener("end",h),n.removeListener("close",h),n.removeListener("finish",b),n.removeListener("end",S),n.removeListener("error",A),n.removeListener("close",R)};if(e.signal&&!k){const G=()=>{const de=t;q(),de.call(n,new ZF(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)wd.nextTick(G);else{qy=qy||xs.addAbortListener;const de=qy(e.signal,G),oe=t;t=k4((...ye)=>{de[XF](),oe.apply(n,ye)})}}return q}function Nie(n,e,t){let r=!1,i=M4;if(e.signal)if(i=()=>{r=!0,t.call(n,new ZF(void 0,{cause:e.signal.reason}))},e.signal.aborted)wd.nextTick(i);else{qy=qy||xs.addAbortListener;const l=qy(e.signal,i),c=t;t=k4((...p)=>{l[XF](),c.apply(n,p)})}const o=(...l)=>{r||wd.nextTick(()=>t.apply(n,l))};return Eie(n[Oie].promise,o,o),M4}function Pie(n,e){var t;let r=!1;return e===null&&(e=A4),(t=e)!==null&&t!==void 0&&t.cleanup&&(Sie(e.cleanup,"cleanup"),r=e.cleanup),new Cie((i,o)=>{const l=eB(n,e,c=>{r&&l(),c?o(c):i()})})}H5.exports=eB;H5.exports.finished=Pie;var qd=H5.exports;const ju=$d(),{aggregateTwoErrors:Iie,codes:{ERR_MULTIPLE_CALLBACK:Die},AbortError:Uie}=eo,{Symbol:tB}=ma,{kIsDestroyed:Fie,isDestroyed:Bie,isFinished:zie,isServerRequest:jie}=ef,nB=tB("kDestroy"),T4=tB("kConstruct");function rB(n,e,t){n&&(n.stack,e&&!e.errored&&(e.errored=n),t&&!t.errored&&(t.errored=n))}function Hie(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):(rB(n,r,t),r&&(r.destroyed=!0),t&&(t.destroyed=!0),i.constructed?TN(this,n,e):this.once(nB,function(o){TN(this,Iie(o,n),e)}),this)}function TN(n,e,t){let r=!1;function i(o){if(r)return;r=!0;const l=n._readableState,c=n._writableState;rB(o,c,l),c&&(c.closed=!0),l&&(l.closed=!0),typeof t=="function"&&t(o),o?ju.nextTick($ie,n,o):ju.nextTick(aB,n)}try{n._destroy(e||null,i)}catch(o){i(o)}}function $ie(n,e){R4(n,e),aB(n)}function aB(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 R4(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 qie(){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 O4(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?ju.nextTick(R4,n,e):R4(n,e))}function Vie(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(T4,e),!(n.listenerCount(T4)>1)&&ju.nextTick(Gie,n)}function Gie(n){let e=!1;function t(r){if(e){O4(n,r??new Die);return}e=!0;const i=n._readableState,o=n._writableState,l=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),l.destroyed?n.emit(nB,r):r?O4(n,r,!0):ju.nextTick(Wie,n)}try{n._construct(r=>{ju.nextTick(t,r)})}catch(r){ju.nextTick(t,r)}}function Wie(n){n.emit(T4)}function RN(n){return(n==null?void 0:n.setHeader)&&typeof n.abort=="function"}function iB(n){n.emit("close")}function Kie(n,e){n.emit("error",e),ju.nextTick(iB,n)}function Yie(n,e){!n||Bie(n)||(!e&&!zie(n)&&(e=new Uie),jie(n)?(n.socket=null,n.destroy(e)):RN(n)?n.abort():RN(n.req)?n.req.abort():typeof n.destroy=="function"?n.destroy(e):typeof n.close=="function"?n.close():e?ju.nextTick(Kie,n,e):ju.nextTick(iB,n),n.destroyed||(n[Fie]=!0))}var wm={construct:Vie,destroyer:Yie,destroy:Hie,undestroy:qie,errorOrDestroy:O4};const{ArrayIsArray:Jie,ObjectSetPrototypeOf:sB}=ma,{EventEmitter:q2}=Gb;function V2(n){q2.call(this,n)}sB(V2.prototype,q2.prototype);sB(V2,q2);V2.prototype.pipe=function(n,e){const t=this;function r(m){n.writable&&n.write(m)===!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",l),t.on("close",c));let o=!1;function l(){o||(o=!0,n.end())}function c(){o||(o=!0,typeof n.destroy=="function"&&n.destroy())}function p(m){h(),q2.listenerCount(this,"error")===0&&this.emit("error",m)}L4(t,"error",p),L4(n,"error",p);function h(){t.removeListener("data",r),n.removeListener("drain",i),t.removeListener("end",l),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 L4(n,e,t){if(typeof n.prependListener=="function")return n.prependListener(e,t);!n._events||!n._events[e]?n.on(e,t):Jie(n._events[e])?n._events[e].unshift(t):n._events[e]=[t,n._events[e]]}var $5={Stream:V2,prependListener:L4},oB={exports:{}};(function(n){const{SymbolDispose:e}=ma,{AbortError:t,codes:r}=eo,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:l}=ef,c=qd,{ERR_INVALID_ARG_TYPE:p}=r;let h;const m=(w,b)=>{if(typeof w!="object"||!("aborted"in w))throw new p(b,"AbortSignal",w)};n.exports.addAbortSignal=function(b,g){if(m(b,"signal"),!i(g)&&!o(g))throw new p("stream",["ReadableStream","WritableStream","Stream"],g);return n.exports.addAbortSignalNoValidate(b,g)},n.exports.addAbortSignalNoValidate=function(w,b){if(typeof w!="object"||!("aborted"in w))return b;const g=i(b)?()=>{b.destroy(new t(void 0,{cause:w.reason}))}:()=>{b[l](new t(void 0,{cause:w.reason}))};if(w.aborted)g();else{h=h||xs.addAbortListener;const S=h(w,g);c(b,S[e])}return b}})(oB);var G2=oB.exports;const{StringPrototypeSlice:ON,SymbolIterator:Qie,TypedArrayPrototypeSet:mx,Uint8Array:Zie}=ma,{Buffer:g8}=Hd,{inspect:Xie}=xs;var ese=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 g8.alloc(0);const t=g8.allocUnsafe(e>>>0);let r=this.head,i=0;for(;r;)mx(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}*[Qie](){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+=ON(o,0,e),this.head=r,r.data=ON(o,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){const t=g8.allocUnsafe(e),r=e;let i=this.head,o=0;do{const l=i.data;if(e>l.length)mx(t,l,r-e),e-=l.length;else{e===l.length?(mx(t,l,r-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(mx(t,new Zie(l.buffer,l.byteOffset,e),r-e),this.head=i,i.data=l.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return Xie(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:tse,NumberIsInteger:nse}=ma,{validateInteger:rse}=Wb,{ERR_INVALID_ARG_VALUE:ase}=eo.codes;let lB=16*1024,uB=16;function ise(n,e,t){return n.highWaterMark!=null?n.highWaterMark:e?n[t]:null}function cB(n){return n?uB:lB}function sse(n,e){rse(e,"value",0),n?uB=e:lB=e}function ose(n,e,t,r){const i=ise(e,r,t);if(i!=null){if(!nse(i)||i<0){const o=r?`options.${t}`:"options.highWaterMark";throw new ase(o,i)}return tse(i)}return cB(n.objectMode)}var W2={getHighWaterMark:ose,getDefaultHighWaterMark:cB,setDefaultHighWaterMark:sse},q5={},V5=sU.Buffer,LN=V5.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 lse(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 use(n){var e=lse(n);if(typeof e!="string"&&(V5.isEncoding===LN||!LN(n)))throw new Error("Unknown encoding: "+n);return e||n}q5.StringDecoder=Kb;function Kb(n){this.encoding=use(n);var e;switch(this.encoding){case"utf16le":this.text=yse,this.end=mse,e=4;break;case"utf8":this.fillLast=dse,e=4;break;case"base64":this.text=gse,this.end=vse,e=3;break;default:this.write=bse,this.end=wse;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=V5.allocUnsafe(e)}Kb.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||""};Kb.prototype.end=hse;Kb.prototype.text=pse;Kb.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 v8(n){return n<=127?0:n>>5===6?2:n>>4===14?3:n>>3===30?4:n>>6===2?-1:-2}function cse(n,e,t){var r=e.length-1;if(r<t)return 0;var i=v8(e[r]);return i>=0?(i>0&&(n.lastNeed=i-1),i):--r<t||i===-2?0:(i=v8(e[r]),i>=0?(i>0&&(n.lastNeed=i-2),i):--r<t||i===-2?0:(i=v8(e[r]),i>=0?(i>0&&(i===2?i=0:n.lastNeed=i-3),i):0))}function fse(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 dse(n){var e=this.lastTotal-this.lastNeed,t=fse(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 pse(n,e){var t=cse(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 hse(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 mse(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 gse(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 vse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function bse(n){return n.toString(this.encoding)}function wse(n){return n&&n.length?this.write(n):""}const NN=$d(),{PromisePrototypeThen:_se,SymbolAsyncIterator:PN,SymbolIterator:IN}=ma,{Buffer:xse}=Hd,{ERR_INVALID_ARG_TYPE:Sse,ERR_STREAM_NULL_VALUES:Cse}=eo.codes;function Ese(n,e,t){let r;if(typeof e=="string"||e instanceof xse)return new n({objectMode:!0,...t,read(){this.push(e),this.push(null)}});let i;if(e&&e[PN])i=!0,r=e[PN]();else if(e&&e[IN])i=!1,r=e[IN]();else throw new Sse("iterable",["Iterable"],e);const o=new n({objectMode:!0,highWaterMark:1,...t});let l=!1;o._read=function(){l||(l=!0,p())},o._destroy=function(h,m){_se(c(h),()=>NN.nextTick(m,h),w=>NN.nextTick(m,w||h))};async function c(h){const m=h!=null,w=typeof r.throw=="function";if(m&&w){const{value:b,done:g}=await r.throw(h);if(await b,g)return}if(typeof r.return=="function"){const{value:b}=await r.return();await b}}async function p(){for(;;){try{const{value:h,done:m}=i?await r.next():r.next();if(m)o.push(null);else{const w=h&&typeof h.then=="function"?await h:h;if(w===null)throw l=!1,new Cse;if(o.push(w))continue;l=!1}}catch(h){o.destroy(h)}break}}return o}var fB=Ese,b8,DN;function K2(){if(DN)return b8;DN=1;const n=$d(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:i,ObjectDefineProperties:o,ObjectKeys:l,ObjectSetPrototypeOf:c,Promise:p,SafeSet:h,SymbolAsyncDispose:m,SymbolAsyncIterator:w,Symbol:b}=ma;b8=Ne,Ne.ReadableState=Ee;const{EventEmitter:g}=Gb,{Stream:S,prependListener:A}=$5,{Buffer:k}=Hd,{addAbortSignal:R}=G2,L=qd;let I=xs.debuglog("stream",ve=>{I=ve});const q=ese,G=wm,{getHighWaterMark:de,getDefaultHighWaterMark:oe}=W2,{aggregateTwoErrors:ye,codes:{ERR_INVALID_ARG_TYPE:Se,ERR_METHOD_NOT_IMPLEMENTED:Ce,ERR_OUT_OF_RANGE:ne,ERR_STREAM_PUSH_AFTER_EOF:Le,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:C},AbortError:x}=eo,{validateObject:O}=Wb,z=b("kPaused"),{StringDecoder:F}=q5,H=fB;c(Ne.prototype,S.prototype),c(Ne,S);const Q=()=>{},{errorOrDestroy:ae}=G,N=1,T=2,Y=4,ee=8,j=16,be=32,Ie=64,Me=128,De=256,se=512,fe=1024,pe=2048,ue=4096,re=8192,me=16384,J=32768,P=65536,U=1<<17,te=1<<18;function le(ve){return{enumerable:!1,get(){return(this.state&ve)!==0},set(xe){xe?this.state|=ve:this.state&=~ve}}}o(Ee.prototype,{objectMode:le(N),ended:le(T),endEmitted:le(Y),reading:le(ee),constructed:le(j),sync:le(be),needReadable:le(Ie),emittedReadable:le(Me),readableListening:le(De),resumeScheduled:le(se),errorEmitted:le(fe),emitClose:le(pe),autoDestroy:le(ue),destroyed:le(re),closed:le(me),closeEmitted:le(J),multiAwaitDrain:le(P),readingMore:le(U),dataEmitted:le(te)});function Ee(ve,xe,ct){typeof ct!="boolean"&&(ct=xe instanceof Yc()),this.state=pe|ue|j|be,ve&&ve.objectMode&&(this.state|=N),ct&&ve&&ve.readableObjectMode&&(this.state|=N),this.highWaterMark=ve?de(this,ve,"readableHighWaterMark",ct):oe(!1),this.buffer=new q,this.length=0,this.pipes=[],this.flowing=null,this[z]=null,ve&&ve.emitClose===!1&&(this.state&=~pe),ve&&ve.autoDestroy===!1&&(this.state&=~ue),this.errored=null,this.defaultEncoding=ve&&ve.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,ve&&ve.encoding&&(this.decoder=new F(ve.encoding),this.encoding=ve.encoding)}function Ne(ve){if(!(this instanceof Ne))return new Ne(ve);const xe=this instanceof Yc();this._readableState=new Ee(ve,this,xe),ve&&(typeof ve.read=="function"&&(this._read=ve.read),typeof ve.destroy=="function"&&(this._destroy=ve.destroy),typeof ve.construct=="function"&&(this._construct=ve.construct),ve.signal&&!xe&&R(ve.signal,this)),S.call(this,ve),G.construct(this,()=>{this._readableState.needReadable&&_e(this,this._readableState)})}Ne.prototype.destroy=G.destroy,Ne.prototype._undestroy=G.undestroy,Ne.prototype._destroy=function(ve,xe){xe(ve)},Ne.prototype[g.captureRejectionSymbol]=function(ve){this.destroy(ve)},Ne.prototype[m]=function(){let ve;return this.destroyed||(ve=this.readableEnded?null:new x,this.destroy(ve)),new p((xe,ct)=>L(this,at=>at&&at!==ve?ct(at):xe(null)))},Ne.prototype.push=function(ve,xe){return Qe(this,ve,xe,!1)},Ne.prototype.unshift=function(ve,xe){return Qe(this,ve,xe,!0)};function Qe(ve,xe,ct,at){I("readableAddChunk",xe);const ft=ve._readableState;let Dn;if(ft.state&N||(typeof xe=="string"?(ct=ct||ft.defaultEncoding,ft.encoding!==ct&&(at&&ft.encoding?xe=k.from(xe,ct).toString(ft.encoding):(xe=k.from(xe,ct),ct=""))):xe instanceof k?ct="":S._isUint8Array(xe)?(xe=S._uint8ArrayToBuffer(xe),ct=""):xe!=null&&(Dn=new Se("chunk",["string","Buffer","Uint8Array"],xe))),Dn)ae(ve,Dn);else if(xe===null)ft.state&=~ee,$(ve,ft);else if(ft.state&N||xe&&xe.length>0)if(at)if(ft.state&Y)ae(ve,new C);else{if(ft.destroyed||ft.errored)return!1;st(ve,ft,xe,!0)}else if(ft.ended)ae(ve,new Le);else{if(ft.destroyed||ft.errored)return!1;ft.state&=~ee,ft.decoder&&!ct?(xe=ft.decoder.write(xe),ft.objectMode||xe.length!==0?st(ve,ft,xe,!1):_e(ve,ft)):st(ve,ft,xe,!1)}else at||(ft.state&=~ee,_e(ve,ft));return!ft.ended&&(ft.length<ft.highWaterMark||ft.length===0)}function st(ve,xe,ct,at){xe.flowing&&xe.length===0&&!xe.sync&&ve.listenerCount("data")>0?(xe.state&P?xe.awaitDrainWriters.clear():xe.awaitDrainWriters=null,xe.dataEmitted=!0,ve.emit("data",ct)):(xe.length+=xe.objectMode?1:ct.length,at?xe.buffer.unshift(ct):xe.buffer.push(ct),xe.state&Ie&&W(ve)),_e(ve,xe)}Ne.prototype.isPaused=function(){const ve=this._readableState;return ve[z]===!0||ve.flowing===!1},Ne.prototype.setEncoding=function(ve){const xe=new F(ve);this._readableState.decoder=xe,this._readableState.encoding=this._readableState.decoder.encoding;const ct=this._readableState.buffer;let at="";for(const ft of ct)at+=xe.write(ft);return ct.clear(),at!==""&&ct.push(at),this._readableState.length=at.length,this};const _t=1073741824;function Et(ve){if(ve>_t)throw new ne("size","<= 1GiB",ve);return ve--,ve|=ve>>>1,ve|=ve>>>2,ve|=ve>>>4,ve|=ve>>>8,ve|=ve>>>16,ve++,ve}function Z(ve,xe){return ve<=0||xe.length===0&&xe.ended?0:xe.state&N?1:r(ve)?xe.flowing&&xe.length?xe.buffer.first().length:xe.length:ve<=xe.length?ve:xe.ended?xe.length:0}Ne.prototype.read=function(ve){I("read",ve),ve===void 0?ve=NaN:t(ve)||(ve=i(ve,10));const xe=this._readableState,ct=ve;if(ve>xe.highWaterMark&&(xe.highWaterMark=Et(ve)),ve!==0&&(xe.state&=~Me),ve===0&&xe.needReadable&&((xe.highWaterMark!==0?xe.length>=xe.highWaterMark:xe.length>0)||xe.ended))return I("read: emitReadable",xe.length,xe.ended),xe.length===0&&xe.ended?Wt(this):W(this),null;if(ve=Z(ve,xe),ve===0&&xe.ended)return xe.length===0&&Wt(this),null;let at=(xe.state&Ie)!==0;if(I("need readable",at),(xe.length===0||xe.length-ve<xe.highWaterMark)&&(at=!0,I("length less than watermark",at)),xe.ended||xe.reading||xe.destroyed||xe.errored||!xe.constructed)at=!1,I("reading, ended or constructing",at);else if(at){I("do read"),xe.state|=ee|be,xe.length===0&&(xe.state|=Ie);try{this._read(xe.highWaterMark)}catch(Dn){ae(this,Dn)}xe.state&=~be,xe.reading||(ve=Z(ct,xe))}let ft;return ve>0?ft=Zt(ve,xe):ft=null,ft===null?(xe.needReadable=xe.length<=xe.highWaterMark,ve=0):(xe.length-=ve,xe.multiAwaitDrain?xe.awaitDrainWriters.clear():xe.awaitDrainWriters=null),xe.length===0&&(xe.ended||(xe.needReadable=!0),ct!==ve&&xe.ended&&Wt(this)),ft!==null&&!xe.errorEmitted&&!xe.closeEmitted&&(xe.dataEmitted=!0,this.emit("data",ft)),ft};function $(ve,xe){if(I("onEofChunk"),!xe.ended){if(xe.decoder){const ct=xe.decoder.end();ct&&ct.length&&(xe.buffer.push(ct),xe.length+=xe.objectMode?1:ct.length)}xe.ended=!0,xe.sync?W(ve):(xe.needReadable=!1,xe.emittedReadable=!0,ge(ve))}}function W(ve){const xe=ve._readableState;I("emitReadable",xe.needReadable,xe.emittedReadable),xe.needReadable=!1,xe.emittedReadable||(I("emitReadable",xe.flowing),xe.emittedReadable=!0,n.nextTick(ge,ve))}function ge(ve){const xe=ve._readableState;I("emitReadable_",xe.destroyed,xe.length,xe.ended),!xe.destroyed&&!xe.errored&&(xe.length||xe.ended)&&(ve.emit("readable"),xe.emittedReadable=!1),xe.needReadable=!xe.flowing&&!xe.ended&&xe.length<=xe.highWaterMark,Ot(ve)}function _e(ve,xe){!xe.readingMore&&xe.constructed&&(xe.readingMore=!0,n.nextTick(Re,ve,xe))}function Re(ve,xe){for(;!xe.reading&&!xe.ended&&(xe.length<xe.highWaterMark||xe.flowing&&xe.length===0);){const ct=xe.length;if(I("maybeReadMore read 0"),ve.read(0),ct===xe.length)break}xe.readingMore=!1}Ne.prototype._read=function(ve){throw new Ce("_read()")},Ne.prototype.pipe=function(ve,xe){const ct=this,at=this._readableState;at.pipes.length===1&&(at.multiAwaitDrain||(at.multiAwaitDrain=!0,at.awaitDrainWriters=new h(at.awaitDrainWriters?[at.awaitDrainWriters]:[]))),at.pipes.push(ve),I("pipe count=%d opts=%j",at.pipes.length,xe);const Dn=(!xe||xe.end!==!1)&&ve!==n.stdout&&ve!==n.stderr?Sn:zt;at.endEmitted?n.nextTick(Dn):ct.once("end",Dn),ve.on("unpipe",hn);function hn(Dt,Kt){I("onunpipe"),Dt===ct&&Kt&&Kt.hasUnpiped===!1&&(Kt.hasUnpiped=!0,Un())}function Sn(){I("onend"),ve.end()}let fr,On=!1;function Un(){I("cleanup"),ve.removeListener("close",Nt),ve.removeListener("finish",Bt),fr&&ve.removeListener("drain",fr),ve.removeListener("error",rt),ve.removeListener("unpipe",hn),ct.removeListener("end",Sn),ct.removeListener("end",zt),ct.removeListener("data",et),On=!0,fr&&at.awaitDrainWriters&&(!ve._writableState||ve._writableState.needDrain)&&fr()}function Te(){On||(at.pipes.length===1&&at.pipes[0]===ve?(I("false write response, pause",0),at.awaitDrainWriters=ve,at.multiAwaitDrain=!1):at.pipes.length>1&&at.pipes.includes(ve)&&(I("false write response, pause",at.awaitDrainWriters.size),at.awaitDrainWriters.add(ve)),ct.pause()),fr||(fr=Be(ct,ve),ve.on("drain",fr))}ct.on("data",et);function et(Dt){I("ondata");const Kt=ve.write(Dt);I("dest.write",Kt),Kt===!1&&Te()}function rt(Dt){if(I("onerror",Dt),zt(),ve.removeListener("error",rt),ve.listenerCount("error")===0){const Kt=ve._writableState||ve._readableState;Kt&&!Kt.errorEmitted?ae(ve,Dt):ve.emit("error",Dt)}}A(ve,"error",rt);function Nt(){ve.removeListener("finish",Bt),zt()}ve.once("close",Nt);function Bt(){I("onfinish"),ve.removeListener("close",Nt),zt()}ve.once("finish",Bt);function zt(){I("unpipe"),ct.unpipe(ve)}return ve.emit("pipe",ct),ve.writableNeedDrain===!0?Te():at.flowing||(I("pipe resume"),ct.resume()),ve};function Be(ve,xe){return function(){const at=ve._readableState;at.awaitDrainWriters===xe?(I("pipeOnDrain",1),at.awaitDrainWriters=null):at.multiAwaitDrain&&(I("pipeOnDrain",at.awaitDrainWriters.size),at.awaitDrainWriters.delete(xe)),(!at.awaitDrainWriters||at.awaitDrainWriters.size===0)&&ve.listenerCount("data")&&ve.resume()}}Ne.prototype.unpipe=function(ve){const xe=this._readableState,ct={hasUnpiped:!1};if(xe.pipes.length===0)return this;if(!ve){const ft=xe.pipes;xe.pipes=[],this.pause();for(let Dn=0;Dn<ft.length;Dn++)ft[Dn].emit("unpipe",this,{hasUnpiped:!1});return this}const at=e(xe.pipes,ve);return at===-1?this:(xe.pipes.splice(at,1),xe.pipes.length===0&&this.pause(),ve.emit("unpipe",this,ct),this)},Ne.prototype.on=function(ve,xe){const ct=S.prototype.on.call(this,ve,xe),at=this._readableState;return ve==="data"?(at.readableListening=this.listenerCount("readable")>0,at.flowing!==!1&&this.resume()):ve==="readable"&&!at.endEmitted&&!at.readableListening&&(at.readableListening=at.needReadable=!0,at.flowing=!1,at.emittedReadable=!1,I("on readable",at.length,at.reading),at.length?W(this):at.reading||n.nextTick(yt,this)),ct},Ne.prototype.addListener=Ne.prototype.on,Ne.prototype.removeListener=function(ve,xe){const ct=S.prototype.removeListener.call(this,ve,xe);return ve==="readable"&&n.nextTick(wt,this),ct},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(ve){const xe=S.prototype.removeAllListeners.apply(this,arguments);return(ve==="readable"||ve===void 0)&&n.nextTick(wt,this),xe};function wt(ve){const xe=ve._readableState;xe.readableListening=ve.listenerCount("readable")>0,xe.resumeScheduled&&xe[z]===!1?xe.flowing=!0:ve.listenerCount("data")>0?ve.resume():xe.readableListening||(xe.flowing=null)}function yt(ve){I("readable nexttick read 0"),ve.read(0)}Ne.prototype.resume=function(){const ve=this._readableState;return ve.flowing||(I("resume"),ve.flowing=!ve.readableListening,gt(this,ve)),ve[z]=!1,this};function gt(ve,xe){xe.resumeScheduled||(xe.resumeScheduled=!0,n.nextTick(At,ve,xe))}function At(ve,xe){I("resume",xe.reading),xe.reading||ve.read(0),xe.resumeScheduled=!1,ve.emit("resume"),Ot(ve),xe.flowing&&!xe.reading&&ve.read(0)}Ne.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[z]=!0,this};function Ot(ve){const xe=ve._readableState;for(I("flow",xe.flowing);xe.flowing&&ve.read()!==null;);}Ne.prototype.wrap=function(ve){let xe=!1;ve.on("data",at=>{!this.push(at)&&ve.pause&&(xe=!0,ve.pause())}),ve.on("end",()=>{this.push(null)}),ve.on("error",at=>{ae(this,at)}),ve.on("close",()=>{this.destroy()}),ve.on("destroy",()=>{this.destroy()}),this._read=()=>{xe&&ve.resume&&(xe=!1,ve.resume())};const ct=l(ve);for(let at=1;at<ct.length;at++){const ft=ct[at];this[ft]===void 0&&typeof ve[ft]=="function"&&(this[ft]=ve[ft].bind(ve))}return this},Ne.prototype[w]=function(){return nn(this)},Ne.prototype.iterator=function(ve){return ve!==void 0&&O(ve,"options"),nn(this,ve)};function nn(ve,xe){typeof ve.read!="function"&&(ve=Ne.wrap(ve,{objectMode:!0}));const ct=Mr(ve,xe);return ct.stream=ve,ct}async function*Mr(ve,xe){let ct=Q;function at(hn){this===ve?(ct(),ct=Q):ct=hn}ve.on("readable",at);let ft;const Dn=L(ve,{writable:!1},hn=>{ft=hn?ye(ft,hn):null,ct(),ct=Q});try{for(;;){const hn=ve.destroyed?null:ve.read();if(hn!==null)yield hn;else{if(ft)throw ft;if(ft===null)return;await new p(at)}}}catch(hn){throw ft=ye(ft,hn),ft}finally{(ft||(xe==null?void 0:xe.destroyOnReturn)!==!1)&&(ft===void 0||ve._readableState.autoDestroy)?G.destroyer(ve,null):(ve.off("readable",at),Dn())}}o(Ne.prototype,{readable:{__proto__:null,get(){const ve=this._readableState;return!!ve&&ve.readable!==!1&&!ve.destroyed&&!ve.errorEmitted&&!ve.endEmitted},set(ve){this._readableState&&(this._readableState.readable=!!ve)}},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(ve){this._readableState&&(this._readableState.flowing=ve)}},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(ve){this._readableState&&(this._readableState.destroyed=ve)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(Ee.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[z]!==!1},set(ve){this[z]=!!ve}}}),Ne._fromList=Zt;function Zt(ve,xe){if(xe.length===0)return null;let ct;return xe.objectMode?ct=xe.buffer.shift():!ve||ve>=xe.length?(xe.decoder?ct=xe.buffer.join(""):xe.buffer.length===1?ct=xe.buffer.first():ct=xe.buffer.concat(xe.length),xe.buffer.clear()):ct=xe.buffer.consume(ve,xe.decoder),ct}function Wt(ve){const xe=ve._readableState;I("endReadable",xe.endEmitted),xe.endEmitted||(xe.ended=!0,n.nextTick(Xr,xe,ve))}function Xr(ve,xe){if(I("endReadableNT",ve.endEmitted,ve.length),!ve.errored&&!ve.closeEmitted&&!ve.endEmitted&&ve.length===0){if(ve.endEmitted=!0,xe.emit("end"),xe.writable&&xe.allowHalfOpen===!1)n.nextTick(Mn,xe);else if(ve.autoDestroy){const ct=xe._writableState;(!ct||ct.autoDestroy&&(ct.finished||ct.writable===!1))&&xe.destroy()}}}function Mn(ve){ve.writable&&!ve.writableEnded&&!ve.destroyed&&ve.end()}Ne.from=function(ve,xe){return H(Ne,ve,xe)};let In;function Ma(){return In===void 0&&(In={}),In}return Ne.fromWeb=function(ve,xe){return Ma().newStreamReadableFromReadableStream(ve,xe)},Ne.toWeb=function(ve,xe){return Ma().newReadableStreamFromStreamReadable(ve,xe)},Ne.wrap=function(ve,xe){var ct,at;return new Ne({objectMode:(ct=(at=ve.readableObjectMode)!==null&&at!==void 0?at:ve.objectMode)!==null&&ct!==void 0?ct:!0,...xe,destroy(ft,Dn){G.destroyer(ve,ft),Dn(ft)}}).wrap(ve)},b8}var w8,UN;function G5(){if(UN)return w8;UN=1;const n=$d(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:o,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:c,Symbol:p,SymbolHasInstance:h}=ma;w8=O,O.WritableState=C;const{EventEmitter:m}=Gb,w=$5.Stream,{Buffer:b}=Hd,g=wm,{addAbortSignal:S}=G2,{getHighWaterMark:A,getDefaultHighWaterMark:k}=W2,{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:L,ERR_MULTIPLE_CALLBACK:I,ERR_STREAM_CANNOT_PIPE:q,ERR_STREAM_DESTROYED:G,ERR_STREAM_ALREADY_FINISHED:de,ERR_STREAM_NULL_VALUES:oe,ERR_STREAM_WRITE_AFTER_END:ye,ERR_UNKNOWN_ENCODING:Se}=eo.codes,{errorOrDestroy:Ce}=g;l(O.prototype,w.prototype),l(O,w);function ne(){}const Le=p("kOnFinished");function C(ue,re,me){typeof me!="boolean"&&(me=re instanceof Yc()),this.objectMode=!!(ue&&ue.objectMode),me&&(this.objectMode=this.objectMode||!!(ue&&ue.writableObjectMode)),this.highWaterMark=ue?A(this,ue,"writableHighWaterMark",me):k(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const J=!!(ue&&ue.decodeStrings===!1);this.decodeStrings=!J,this.defaultEncoding=ue&&ue.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ae.bind(void 0,re),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=!ue||ue.emitClose!==!1,this.autoDestroy=!ue||ue.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Le]=[]}function x(ue){ue.buffered=[],ue.bufferedIndex=0,ue.allBuffers=!0,ue.allNoop=!0}C.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(C.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function O(ue){const re=this instanceof Yc();if(!re&&!r(O,this))return new O(ue);this._writableState=new C(ue,this,re),ue&&(typeof ue.write=="function"&&(this._write=ue.write),typeof ue.writev=="function"&&(this._writev=ue.writev),typeof ue.destroy=="function"&&(this._destroy=ue.destroy),typeof ue.final=="function"&&(this._final=ue.final),typeof ue.construct=="function"&&(this._construct=ue.construct),ue.signal&&S(ue.signal,this)),w.call(this,ue),g.construct(this,()=>{const me=this._writableState;me.writing||ee(this,me),Me(this,me)})}i(O,h,{__proto__:null,value:function(ue){return r(this,ue)?!0:this!==O?!1:ue&&ue._writableState instanceof C}}),O.prototype.pipe=function(){Ce(this,new q)};function z(ue,re,me,J){const P=ue._writableState;if(typeof me=="function")J=me,me=P.defaultEncoding;else{if(!me)me=P.defaultEncoding;else if(me!=="buffer"&&!b.isEncoding(me))throw new Se(me);typeof J!="function"&&(J=ne)}if(re===null)throw new oe;if(!P.objectMode)if(typeof re=="string")P.decodeStrings!==!1&&(re=b.from(re,me),me="buffer");else if(re instanceof b)me="buffer";else if(w._isUint8Array(re))re=w._uint8ArrayToBuffer(re),me="buffer";else throw new R("chunk",["string","Buffer","Uint8Array"],re);let U;return P.ending?U=new ye:P.destroyed&&(U=new G("write")),U?(n.nextTick(J,U),Ce(ue,U,!0),U):(P.pendingcb++,F(ue,P,re,me,J))}O.prototype.write=function(ue,re,me){return z(this,ue,re,me)===!0},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){const ue=this._writableState;ue.corked&&(ue.corked--,ue.writing||ee(this,ue))},O.prototype.setDefaultEncoding=function(re){if(typeof re=="string"&&(re=c(re)),!b.isEncoding(re))throw new Se(re);return this._writableState.defaultEncoding=re,this};function F(ue,re,me,J,P){const U=re.objectMode?1:me.length;re.length+=U;const te=re.length<re.highWaterMark;return te||(re.needDrain=!0),re.writing||re.corked||re.errored||!re.constructed?(re.buffered.push({chunk:me,encoding:J,callback:P}),re.allBuffers&&J!=="buffer"&&(re.allBuffers=!1),re.allNoop&&P!==ne&&(re.allNoop=!1)):(re.writelen=U,re.writecb=P,re.writing=!0,re.sync=!0,ue._write(me,J,re.onwrite),re.sync=!1),te&&!re.errored&&!re.destroyed}function H(ue,re,me,J,P,U,te){re.writelen=J,re.writecb=te,re.writing=!0,re.sync=!0,re.destroyed?re.onwrite(new G("write")):me?ue._writev(P,re.onwrite):ue._write(P,U,re.onwrite),re.sync=!1}function Q(ue,re,me,J){--re.pendingcb,J(me),Y(re),Ce(ue,me)}function ae(ue,re){const me=ue._writableState,J=me.sync,P=me.writecb;if(typeof P!="function"){Ce(ue,new I);return}me.writing=!1,me.writecb=null,me.length-=me.writelen,me.writelen=0,re?(re.stack,me.errored||(me.errored=re),ue._readableState&&!ue._readableState.errored&&(ue._readableState.errored=re),J?n.nextTick(Q,ue,me,re,P):Q(ue,me,re,P)):(me.buffered.length>me.bufferedIndex&&ee(ue,me),J?me.afterWriteTickInfo!==null&&me.afterWriteTickInfo.cb===P?me.afterWriteTickInfo.count++:(me.afterWriteTickInfo={count:1,cb:P,stream:ue,state:me},n.nextTick(N,me.afterWriteTickInfo)):T(ue,me,1,P))}function N({stream:ue,state:re,count:me,cb:J}){return re.afterWriteTickInfo=null,T(ue,re,me,J)}function T(ue,re,me,J){for(!re.ending&&!ue.destroyed&&re.length===0&&re.needDrain&&(re.needDrain=!1,ue.emit("drain"));me-- >0;)re.pendingcb--,J();re.destroyed&&Y(re),Me(ue,re)}function Y(ue){if(ue.writing)return;for(let P=ue.bufferedIndex;P<ue.buffered.length;++P){var re;const{chunk:U,callback:te}=ue.buffered[P],le=ue.objectMode?1:U.length;ue.length-=le,te((re=ue.errored)!==null&&re!==void 0?re:new G("write"))}const me=ue[Le].splice(0);for(let P=0;P<me.length;P++){var J;me[P]((J=ue.errored)!==null&&J!==void 0?J:new G("end"))}x(ue)}function ee(ue,re){if(re.corked||re.bufferProcessing||re.destroyed||!re.constructed)return;const{buffered:me,bufferedIndex:J,objectMode:P}=re,U=me.length-J;if(!U)return;let te=J;if(re.bufferProcessing=!0,U>1&&ue._writev){re.pendingcb-=U-1;const le=re.allNoop?ne:Ne=>{for(let Qe=te;Qe<me.length;++Qe)me[Qe].callback(Ne)},Ee=re.allNoop&&te===0?me:e(me,te);Ee.allBuffers=re.allBuffers,H(ue,re,!0,re.length,Ee,"",le),x(re)}else{do{const{chunk:le,encoding:Ee,callback:Ne}=me[te];me[te++]=null;const Qe=P?1:le.length;H(ue,re,!1,Qe,le,Ee,Ne)}while(te<me.length&&!re.writing);te===me.length?x(re):te>256?(me.splice(0,te),re.bufferedIndex=0):re.bufferedIndex=te}re.bufferProcessing=!1}O.prototype._write=function(ue,re,me){if(this._writev)this._writev([{chunk:ue,encoding:re}],me);else throw new L("_write()")},O.prototype._writev=null,O.prototype.end=function(ue,re,me){const J=this._writableState;typeof ue=="function"?(me=ue,ue=null,re=null):typeof re=="function"&&(me=re,re=null);let P;if(ue!=null){const U=z(this,ue,re);U instanceof t&&(P=U)}return J.corked&&(J.corked=1,this.uncork()),P||(!J.errored&&!J.ending?(J.ending=!0,Me(this,J,!0),J.ended=!0):J.finished?P=new de("end"):J.destroyed&&(P=new G("end"))),typeof me=="function"&&(P||J.finished?n.nextTick(me,P):J[Le].push(me)),this};function j(ue){return ue.ending&&!ue.destroyed&&ue.constructed&&ue.length===0&&!ue.errored&&ue.buffered.length===0&&!ue.finished&&!ue.writing&&!ue.errorEmitted&&!ue.closeEmitted}function be(ue,re){let me=!1;function J(P){if(me){Ce(ue,P??I());return}if(me=!0,re.pendingcb--,P){const U=re[Le].splice(0);for(let te=0;te<U.length;te++)U[te](P);Ce(ue,P,re.sync)}else j(re)&&(re.prefinished=!0,ue.emit("prefinish"),re.pendingcb++,n.nextTick(De,ue,re))}re.sync=!0,re.pendingcb++;try{ue._final(J)}catch(P){J(P)}re.sync=!1}function Ie(ue,re){!re.prefinished&&!re.finalCalled&&(typeof ue._final=="function"&&!re.destroyed?(re.finalCalled=!0,be(ue,re)):(re.prefinished=!0,ue.emit("prefinish")))}function Me(ue,re,me){j(re)&&(Ie(ue,re),re.pendingcb===0&&(me?(re.pendingcb++,n.nextTick((J,P)=>{j(P)?De(J,P):P.pendingcb--},ue,re)):j(re)&&(re.pendingcb++,De(ue,re))))}function De(ue,re){re.pendingcb--,re.finished=!0;const me=re[Le].splice(0);for(let J=0;J<me.length;J++)me[J]();if(ue.emit("finish"),re.autoDestroy){const J=ue._readableState;(!J||J.autoDestroy&&(J.endEmitted||J.readable===!1))&&ue.destroy()}}o(O.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(ue){this._writableState&&(this._writableState.destroyed=ue)}},writable:{__proto__:null,get(){const ue=this._writableState;return!!ue&&ue.writable!==!1&&!ue.destroyed&&!ue.errored&&!ue.ending&&!ue.ended},set(ue){this._writableState&&(this._writableState.writable=!!ue)}},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 ue=this._writableState;return ue?!ue.destroyed&&!ue.ending&&ue.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=g.destroy;O.prototype.destroy=function(ue,re){const me=this._writableState;return!me.destroyed&&(me.bufferedIndex<me.buffered.length||me[Le].length)&&n.nextTick(Y,me),se.call(this,ue,re),this},O.prototype._undestroy=g.undestroy,O.prototype._destroy=function(ue,re){re(ue)},O.prototype[m.captureRejectionSymbol]=function(ue){this.destroy(ue)};let fe;function pe(){return fe===void 0&&(fe={}),fe}return O.fromWeb=function(ue,re){return pe().newStreamWritableFromWritableStream(ue,re)},O.toWeb=function(ue){return pe().newWritableStreamFromStreamWritable(ue)},w8}var _8,FN;function Ase(){if(FN)return _8;FN=1;const n=$d(),e=Hd,{isReadable:t,isWritable:r,isIterable:i,isNodeStream:o,isReadableNodeStream:l,isWritableNodeStream:c,isDuplexNodeStream:p,isReadableStream:h,isWritableStream:m}=ef,w=qd,{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:S}}=eo,{destroyer:A}=wm,k=Yc(),R=K2(),L=G5(),{createDeferredPromise:I}=xs,q=fB,G=globalThis.Blob||e.Blob,de=typeof G<"u"?function(C){return C instanceof G}:function(C){return!1},oe=globalThis.AbortController||Tb().AbortController,{FunctionPrototypeCall:ye}=ma;class Se extends k{constructor(C){super(C),(C==null?void 0:C.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(C==null?void 0:C.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}_8=function Le(C,x){if(p(C))return C;if(l(C))return ne({readable:C});if(c(C))return ne({writable:C});if(o(C))return ne({writable:!1,readable:!1});if(h(C))return ne({readable:R.fromWeb(C)});if(m(C))return ne({writable:L.fromWeb(C)});if(typeof C=="function"){const{value:z,write:F,final:H,destroy:Q}=Ce(C);if(i(z))return q(Se,z,{objectMode:!0,write:F,final:H,destroy:Q});const ae=z==null?void 0:z.then;if(typeof ae=="function"){let N;const T=ye(ae,z,Y=>{if(Y!=null)throw new S("nully","body",Y)},Y=>{A(N,Y)});return N=new Se({objectMode:!0,readable:!1,write:F,final(Y){H(async()=>{try{await T,n.nextTick(Y,null)}catch(ee){n.nextTick(Y,ee)}})},destroy:Q})}throw new S("Iterable, AsyncIterable or AsyncFunction",x,z)}if(de(C))return Le(C.arrayBuffer());if(i(C))return q(Se,C,{objectMode:!0,writable:!1});if(h(C==null?void 0:C.readable)&&m(C==null?void 0:C.writable))return Se.fromWeb(C);if(typeof(C==null?void 0:C.writable)=="object"||typeof(C==null?void 0:C.readable)=="object"){const z=C!=null&&C.readable?l(C==null?void 0:C.readable)?C==null?void 0:C.readable:Le(C.readable):void 0,F=C!=null&&C.writable?c(C==null?void 0:C.writable)?C==null?void 0:C.writable:Le(C.writable):void 0;return ne({readable:z,writable:F})}const O=C==null?void 0:C.then;if(typeof O=="function"){let z;return ye(O,C,F=>{F!=null&&z.push(F),z.push(null)},F=>{A(z,F)}),z=new Se({objectMode:!0,writable:!1,read(){}})}throw new g(x,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],C)};function Ce(Le){let{promise:C,resolve:x}=I();const O=new oe,z=O.signal;return{value:Le(async function*(){for(;;){const H=C;C=null;const{chunk:Q,done:ae,cb:N}=await H;if(n.nextTick(N),ae)return;if(z.aborted)throw new b(void 0,{cause:z.reason});({promise:C,resolve:x}=I()),yield Q}}(),{signal:z}),write(H,Q,ae){const N=x;x=null,N({chunk:H,done:!1,cb:ae})},final(H){const Q=x;x=null,Q({done:!0,cb:H})},destroy(H,Q){O.abort(),Q(H)}}}function ne(Le){const C=Le.readable&&typeof Le.readable.read!="function"?R.wrap(Le.readable):Le.readable,x=Le.writable;let O=!!t(C),z=!!r(x),F,H,Q,ae,N;function T(Y){const ee=ae;ae=null,ee?ee(Y):Y&&N.destroy(Y)}return N=new Se({readableObjectMode:!!(C!=null&&C.readableObjectMode),writableObjectMode:!!(x!=null&&x.writableObjectMode),readable:O,writable:z}),z&&(w(x,Y=>{z=!1,Y&&A(C,Y),T(Y)}),N._write=function(Y,ee,j){x.write(Y,ee)?j():F=j},N._final=function(Y){x.end(),H=Y},x.on("drain",function(){if(F){const Y=F;F=null,Y()}}),x.on("finish",function(){if(H){const Y=H;H=null,Y()}})),O&&(w(C,Y=>{O=!1,Y&&A(C,Y),T(Y)}),C.on("readable",function(){if(Q){const Y=Q;Q=null,Y()}}),C.on("end",function(){N.push(null)}),N._read=function(){for(;;){const Y=C.read();if(Y===null){Q=N._read;return}if(!N.push(Y))return}}),N._destroy=function(Y,ee){!Y&&ae!==null&&(Y=new b),Q=null,F=null,H=null,ae===null?ee(Y):(ae=ee,A(x,Y),A(C,Y))},N}return _8}var x8,BN;function Yc(){if(BN)return x8;BN=1;const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=ma;x8=l;const i=K2(),o=G5();r(l.prototype,i.prototype),r(l,i);{const m=t(o.prototype);for(let w=0;w<m.length;w++){const b=m[w];l.prototype[b]||(l.prototype[b]=o.prototype[b])}}function l(m){if(!(this instanceof l))return new l(m);i.call(this,m),o.call(this,m),m?(this.allowHalfOpen=m.allowHalfOpen!==!1,m.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),m.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(l.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(m){this._readableState&&this._writableState&&(this._readableState.destroyed=m,this._writableState.destroyed=m)}}});let c;function p(){return c===void 0&&(c={}),c}l.fromWeb=function(m,w){return p().newStreamDuplexFromReadableWritablePair(m,w)},l.toWeb=function(m){return p().newReadableWritablePairFromDuplex(m)};let h;return l.from=function(m){return h||(h=Ase()),h(m,"body")},x8}const{ObjectSetPrototypeOf:dB,Symbol:kse}=ma;var pB=Jc;const{ERR_METHOD_NOT_IMPLEMENTED:Mse}=eo.codes,W5=Yc(),{getHighWaterMark:Tse}=W2;dB(Jc.prototype,W5.prototype);dB(Jc,W5);const pb=kse("kCallback");function Jc(n){if(!(this instanceof Jc))return new Jc(n);const e=n?Tse(this,n,"readableHighWaterMark",!0):null;e===0&&(n={...n,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:n.writableHighWaterMark||0}),W5.call(this,n),this._readableState.sync=!1,this[pb]=null,n&&(typeof n.transform=="function"&&(this._transform=n.transform),typeof n.flush=="function"&&(this._flush=n.flush)),this.on("prefinish",Rse)}function N4(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 Rse(){this._final!==N4&&N4.call(this)}Jc.prototype._final=N4;Jc.prototype._transform=function(n,e,t){throw new Mse("_transform()")};Jc.prototype._write=function(n,e,t){const r=this._readableState,i=this._writableState,o=r.length;this._transform(n,e,(l,c)=>{if(l){t(l);return}c!=null&&this.push(c),i.ended||o===r.length||r.length<r.highWaterMark?t():this[pb]=t})};Jc.prototype._read=function(){if(this[pb]){const n=this[pb];this[pb]=null,n()}};const{ObjectSetPrototypeOf:hB}=ma;var yB=tm;const K5=pB;hB(tm.prototype,K5.prototype);hB(tm,K5);function tm(n){if(!(this instanceof tm))return new tm(n);K5.call(this,n)}tm.prototype._transform=function(n,e,t){t(null,n)};const eb=$d(),{ArrayIsArray:Ose,Promise:Lse,SymbolAsyncIterator:Nse,SymbolDispose:Pse}=ma,e2=qd,{once:Ise}=xs,Dse=wm,zN=Yc(),{aggregateTwoErrors:Use,codes:{ERR_INVALID_ARG_TYPE:P4,ERR_INVALID_RETURN_VALUE:S8,ERR_MISSING_ARGS:Fse,ERR_STREAM_DESTROYED:Bse,ERR_STREAM_PREMATURE_CLOSE:zse},AbortError:jse}=eo,{validateFunction:Hse,validateAbortSignal:$se}=Wb,{isIterable:Xp,isReadable:C8,isReadableNodeStream:Px,isNodeStream:jN,isTransformStream:Iy,isWebStream:qse,isReadableStream:E8,isReadableFinished:Vse}=ef,Gse=globalThis.AbortController||Tb().AbortController;let A8,k8,M8;function HN(n,e,t){let r=!1;n.on("close",()=>{r=!0});const i=e2(n,{readable:e,writable:t},o=>{r=!o});return{destroy:o=>{r||(r=!0,Dse.destroyer(n,o||new Bse("pipe")))},cleanup:i}}function Wse(n){return Hse(n[n.length-1],"streams[stream.length - 1]"),n.pop()}function T8(n){if(Xp(n))return n;if(Px(n))return Kse(n);throw new P4("val",["Readable","Iterable","AsyncIterable"],n)}async function*Kse(n){k8||(k8=K2()),yield*k8.prototype[Nse].call(n)}async function gx(n,e,t,{end:r}){let i,o=null;const l=h=>{if(h&&(i=h),o){const m=o;o=null,m()}},c=()=>new Lse((h,m)=>{i?m(i):o=()=>{i?m(i):h()}});e.on("drain",l);const p=e2(e,{readable:!1},l);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?Use(i,h):h)}finally{p(),e.off("drain",l)}}async function R8(n,e,t,{end:r}){Iy(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(l){t(l)}}}function Yse(...n){return mB(n,Ise(Wse(n)))}function mB(n,e,t){if(n.length===1&&Ose(n[0])&&(n=n[0]),n.length<2)throw new Fse("streams");const r=new Gse,i=r.signal,o=t==null?void 0:t.signal,l=[];$se(o,"options.signal");function c(){S(new jse)}M8=M8||xs.addAbortListener;let p;o&&(p=M8(o,c));let h,m;const w=[];let b=0;function g(L){S(L,--b===0)}function S(L,I){var q;if(L&&(!h||h.code==="ERR_STREAM_PREMATURE_CLOSE")&&(h=L),!(!h&&!I)){for(;w.length;)w.shift()(h);(q=p)===null||q===void 0||q[Pse](),r.abort(),I&&(h||l.forEach(G=>G()),eb.nextTick(e,h,m))}}let A;for(let L=0;L<n.length;L++){const I=n[L],q=L<n.length-1,G=L>0,de=q||(t==null?void 0:t.end)!==!1,oe=L===n.length-1;if(jN(I)){let ye=function(Se){Se&&Se.name!=="AbortError"&&Se.code!=="ERR_STREAM_PREMATURE_CLOSE"&&g(Se)};if(de){const{destroy:Se,cleanup:Ce}=HN(I,q,G);w.push(Se),C8(I)&&oe&&l.push(Ce)}I.on("error",ye),C8(I)&&oe&&l.push(()=>{I.removeListener("error",ye)})}if(L===0)if(typeof I=="function"){if(A=I({signal:i}),!Xp(A))throw new S8("Iterable, AsyncIterable or Stream","source",A)}else Xp(I)||Px(I)||Iy(I)?A=I:A=zN.from(I);else if(typeof I=="function"){if(Iy(A)){var k;A=T8((k=A)===null||k===void 0?void 0:k.readable)}else A=T8(A);if(A=I(A,{signal:i}),q){if(!Xp(A,!0))throw new S8("AsyncIterable",`transform[${L-1}]`,A)}else{var R;A8||(A8=yB);const ye=new A8({objectMode:!0}),Se=(R=A)===null||R===void 0?void 0:R.then;if(typeof Se=="function")b++,Se.call(A,Le=>{m=Le,Le!=null&&ye.write(Le),de&&ye.end(),eb.nextTick(g)},Le=>{ye.destroy(Le),eb.nextTick(g,Le)});else if(Xp(A,!0))b++,gx(A,ye,g,{end:de});else if(E8(A)||Iy(A)){const Le=A.readable||A;b++,gx(Le,ye,g,{end:de})}else throw new S8("AsyncIterable or Promise","destination",A);A=ye;const{destroy:Ce,cleanup:ne}=HN(A,!1,!0);w.push(Ce),oe&&l.push(ne)}}else if(jN(I)){if(Px(A)){b+=2;const ye=Jse(A,I,g,{end:de});C8(I)&&oe&&l.push(ye)}else if(Iy(A)||E8(A)){const ye=A.readable||A;b++,gx(ye,I,g,{end:de})}else if(Xp(A))b++,gx(A,I,g,{end:de});else throw new P4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else if(qse(I)){if(Px(A))b++,R8(T8(A),I,g,{end:de});else if(E8(A)||Xp(A))b++,R8(A,I,g,{end:de});else if(Iy(A))b++,R8(A.readable,I,g,{end:de});else throw new P4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else A=zN.from(I)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&eb.nextTick(c),A}function Jse(n,e,t,{end:r}){let i=!1;if(e.on("close",()=>{i||t(new zse)}),n.pipe(e,{end:!1}),r){let o=function(){i=!0,e.end()};Vse(n)?eb.nextTick(o):n.once("end",o)}else t();return e2(n,{readable:!0,writable:!1},o=>{const l=n._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?n.once("end",t).once("error",t):t(o)}),e2(e,{readable:!1,writable:!0},t)}var Y5={pipelineImpl:mB,pipeline:Yse};const{pipeline:Qse}=Y5,vx=Yc(),{destroyer:Zse}=wm,{isNodeStream:bx,isReadable:$N,isWritable:qN,isWebStream:O8,isTransformStream:Jp,isWritableStream:VN,isReadableStream:GN}=ef,{AbortError:Xse,codes:{ERR_INVALID_ARG_VALUE:WN,ERR_MISSING_ARGS:eoe}}=eo,toe=qd;var gB=function(...e){if(e.length===0)throw new eoe("streams");if(e.length===1)return vx.from(e[0]);const t=[...e];if(typeof e[0]=="function"&&(e[0]=vx.from(e[0])),typeof e[e.length-1]=="function"){const g=e.length-1;e[g]=vx.from(e[g])}for(let g=0;g<e.length;++g)if(!(!bx(e[g])&&!O8(e[g]))){if(g<e.length-1&&!($N(e[g])||GN(e[g])||Jp(e[g])))throw new WN(`streams[${g}]`,t[g],"must be readable");if(g>0&&!(qN(e[g])||VN(e[g])||Jp(e[g])))throw new WN(`streams[${g}]`,t[g],"must be writable")}let r,i,o,l,c;function p(g){const S=l;l=null,S?S(g):g?c.destroy(g):!b&&!w&&c.destroy()}const h=e[0],m=Qse(e,p),w=!!(qN(h)||VN(h)||Jp(h)),b=!!($N(m)||GN(m)||Jp(m));if(c=new vx({writableObjectMode:!!(h!=null&&h.writableObjectMode),readableObjectMode:!!(m!=null&&m.readableObjectMode),writable:w,readable:b}),w){if(bx(h))c._write=function(S,A,k){h.write(S,A)?k():r=k},c._final=function(S){h.end(),i=S},h.on("drain",function(){if(r){const S=r;r=null,S()}});else if(O8(h)){const A=(Jp(h)?h.writable:h).getWriter();c._write=async function(k,R,L){try{await A.ready,A.write(k).catch(()=>{}),L()}catch(I){L(I)}},c._final=async function(k){try{await A.ready,A.close().catch(()=>{}),i=k}catch(R){k(R)}}}const g=Jp(m)?m.readable:m;toe(g,()=>{if(i){const S=i;i=null,S()}})}if(b){if(bx(m))m.on("readable",function(){if(o){const g=o;o=null,g()}}),m.on("end",function(){c.push(null)}),c._read=function(){for(;;){const g=m.read();if(g===null){o=c._read;return}if(!c.push(g))return}};else if(O8(m)){const S=(Jp(m)?m.readable:m).getReader();c._read=async function(){for(;;)try{const{value:A,done:k}=await S.read();if(!c.push(A))return;if(k){c.push(null);return}}catch{return}}}}return c._destroy=function(g,S){!g&&l!==null&&(g=new Xse),o=null,r=null,i=null,l===null?S(g):(l=S,bx(m)&&Zse(m,g))},c};const noe=globalThis.AbortController||Tb().AbortController,{codes:{ERR_INVALID_ARG_VALUE:roe,ERR_INVALID_ARG_TYPE:Yb,ERR_MISSING_ARGS:aoe,ERR_OUT_OF_RANGE:ioe},AbortError:Wu}=eo,{validateAbortSignal:Rh,validateInteger:KN,validateObject:Oh}=Wb,soe=ma.Symbol("kWeak"),ooe=ma.Symbol("kResistStopPropagation"),{finished:loe}=qd,uoe=gB,{addAbortSignalNoValidate:coe}=G2,{isWritable:foe,isNodeStream:doe}=ef,{deprecate:poe}=xs,{ArrayPrototypePush:hoe,Boolean:yoe,MathFloor:YN,Number:moe,NumberIsNaN:goe,Promise:JN,PromiseReject:QN,PromiseResolve:voe,PromisePrototypeThen:ZN,Symbol:vB}=ma,t2=vB("kEmpty"),XN=vB("kEof");function boe(n,e){if(e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal"),doe(n)&&!foe(n))throw new roe("stream",n,"must be writable");const t=uoe(this,n);return e!=null&&e.signal&&coe(e.signal,t),t}function Y2(n,e){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal");let t=1;(e==null?void 0:e.concurrency)!=null&&(t=YN(e.concurrency));let r=t-1;return(e==null?void 0:e.highWaterMark)!=null&&(r=YN(e.highWaterMark)),KN(t,"options.concurrency",1),KN(r,"options.highWaterMark",0),r+=t,(async function*(){const o=xs.AbortSignalAny([e==null?void 0:e.signal].filter(yoe)),l=this,c=[],p={signal:o};let h,m,w=!1,b=0;function g(){w=!0,S()}function S(){b-=1,A()}function A(){m&&!w&&b<t&&c.length<r&&(m(),m=null)}async function k(){try{for await(let R of l){if(w)return;if(o.aborted)throw new Wu;try{if(R=n(R,p),R===t2)continue;R=voe(R)}catch(L){R=QN(L)}b+=1,ZN(R,S,g),c.push(R),h&&(h(),h=null),!w&&(c.length>=r||b>=t)&&await new JN(L=>{m=L})}c.push(XN)}catch(R){const L=QN(R);ZN(L,S,g),c.push(L)}finally{w=!0,h&&(h(),h=null)}}k();try{for(;;){for(;c.length>0;){const R=await c[0];if(R===XN)return;if(o.aborted)throw new Wu;R!==t2&&(yield R),c.shift(),A()}await new JN(R=>{h=R})}}finally{w=!0,m&&(m(),m=null)}}).call(this)}function woe(n=void 0){return n!=null&&Oh(n,"options"),(n==null?void 0:n.signal)!=null&&Rh(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 Wu({cause:n.signal.reason});yield[t++,i]}}).call(this)}async function bB(n,e=void 0){for await(const t of J5.call(this,n,e))return!0;return!1}async function _oe(n,e=void 0){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);return!await bB.call(this,async(...t)=>!await n(...t),e)}async function xoe(n,e){for await(const t of J5.call(this,n,e))return t}async function Soe(n,e){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i),t2}for await(const r of Y2.call(this,t,e));}function J5(n,e){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i)?r:t2}return Y2.call(this,t,e)}class Coe extends aoe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Eoe(n,e,t){var r;if(typeof n!="function")throw new Yb("reducer",["Function","AsyncFunction"],n);t!=null&&Oh(t,"options"),(t==null?void 0:t.signal)!=null&&Rh(t.signal,"options.signal");let i=arguments.length>1;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted){const h=new Wu(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await loe(this.destroy(h)),h}const o=new noe,l=o.signal;if(t!=null&&t.signal){const h={once:!0,[soe]:this,[ooe]:!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 Wu;i?e=await n(e,h,{signal:l}):(e=h,i=!0)}if(!c&&!i)throw new Coe}finally{o.abort()}return e}async function Aoe(n){n!=null&&Oh(n,"options"),(n==null?void 0:n.signal)!=null&&Rh(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 Wu(void 0,{cause:n.signal.reason});hoe(e,r)}return e}function koe(n,e){const t=Y2.call(this,n,e);return(async function*(){for await(const i of t)yield*i}).call(this)}function wB(n){if(n=moe(n),goe(n))return 0;if(n<0)throw new ioe("number",">= 0",n);return n}function Moe(n,e=void 0){return e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal"),n=wB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Wu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Wu;n--<=0&&(yield o)}}).call(this)}function Toe(n,e=void 0){return e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal"),n=wB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Wu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Wu;if(n-- >0&&(yield o),n<=0)return}}).call(this)}F5.streamReturningOperators={asIndexedPairs:poe(woe,"readable.asIndexedPairs will be removed in a future version."),drop:Moe,filter:J5,flatMap:koe,map:Y2,take:Toe,compose:boe};F5.promiseReturningOperators={every:_oe,forEach:Soe,reduce:Eoe,toArray:Aoe,some:bB,find:xoe};var L8,eP;function _B(){if(eP)return L8;eP=1;const{ArrayPrototypePop:n,Promise:e}=ma,{isIterable:t,isNodeStream:r,isWebStream:i}=ef,{pipelineImpl:o}=Y5,{finished:l}=qd;xB();function c(...p){return new e((h,m)=>{let w,b;const g=p[p.length-1];if(g&&typeof g=="object"&&!r(g)&&!t(g)&&!i(g)){const S=n(p);w=S.signal,b=S.end}o(p,(S,A)=>{S?m(S):h(A)},{signal:w,end:b})})}return L8={finished:l,pipeline:c},L8}var tP;function xB(){if(tP)return p8.exports;tP=1;const{Buffer:n}=Hd,{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=ma,{promisify:{custom:i}}=xs,{streamReturningOperators:o,promiseReturningOperators:l}=F5,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=eo,p=gB,{setDefaultHighWaterMark:h,getDefaultHighWaterMark:m}=W2,{pipeline:w}=Y5,{destroyer:b}=wm,g=qd,S=_B(),A=ef,k=p8.exports=$5.Stream;k.isDestroyed=A.isDestroyed,k.isDisturbed=A.isDisturbed,k.isErrored=A.isErrored,k.isReadable=A.isReadable,k.isWritable=A.isWritable,k.Readable=K2();for(const L of t(o)){let q=function(...G){if(new.target)throw c();return k.Readable.from(r(I,this,G))};const I=o[L];e(q,"name",{__proto__:null,value:I.name}),e(q,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,L,{__proto__:null,value:q,enumerable:!1,configurable:!0,writable:!0})}for(const L of t(l)){let q=function(...G){if(new.target)throw c();return r(I,this,G)};const I=l[L];e(q,"name",{__proto__:null,value:I.name}),e(q,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,L,{__proto__:null,value:q,enumerable:!1,configurable:!0,writable:!0})}k.Writable=G5(),k.Duplex=Yc(),k.Transform=pB,k.PassThrough=yB,k.pipeline=w;const{addAbortSignal:R}=G2;return k.addAbortSignal=R,k.finished=g,k.destroy=b,k.compose=p,k.setDefaultHighWaterMark=h,k.getDefaultHighWaterMark=m,e(k,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return S}}),e(w,i,{__proto__:null,enumerable:!0,get(){return S.pipeline}}),e(g,i,{__proto__:null,enumerable:!0,get(){return S.finished}}),k.Stream=k,k._isUint8Array=function(I){return I instanceof Uint8Array},k._uint8ArrayToBuffer=function(I){return n.from(I.buffer,I.byteOffset,I.byteLength)},p8.exports}(function(n){const e=xB(),t=_B(),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})(CF);var Roe=CF.exports;typeof globalThis.Buffer>"u"&&(globalThis.Buffer=Lb().Buffer);const Ty=oU,nP=Roe,Ooe=ki;globalThis.process||(globalThis.process=$d());if(typeof crypto>"u"){const n=p2;n.getRandomValues=e=>n.randomBytes(e.length),globalThis.crypto=n}const ii={ElvCrypto:async()=>{try{if(!ii.elvCrypto){const n=(await Promise.resolve().then(()=>require("./index-DHXWR3Eg.js"))).default;ii.elvCrypto=await new n().init()}return ii.elvCrypto}catch(n){console.error("Error initializing ElvCrypto:"),console.error(n)}},EncryptedSize:n=>{const t=Math.floor(n/1e6);let r=ii.EncryptedBlockSize(1e6),i=t*r;return n%1e6!==0&&(i+=ii.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 ii.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),l=Buffer.concat([Buffer.from(i),Buffer.from(o),Buffer.from(r)]);return Ooe.B64(l)},async DecryptCap(n,e){const t=await ii.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),l=t.decryptECIES(new Uint8Array(o),e,new Uint8Array(r),new Uint8Array(i));return JSON.parse(Buffer.from(l).toString())},async GeneratePrimaryConk({spaceId:n,objectId:e}){const t=await ii.ElvCrypto(),{secretKey:r,publicKey:i}=t.generatePrimaryKeys(),o=t.generateSymmetricKey().key;return{symm_key:`kpsy${Ty.encode(Buffer.from(o))}`,secret_key:`kpsk${Ty.encode(Buffer.from(r))}`,public_key:`kppk${Ty.encode(Buffer.from(i))}`,sid:n,qid:e}},async GenerateTargetConk(){const n=await ii.ElvCrypto(),{secretKey:e,publicKey:t}=n.generateTargetKeys();return{secret_key:`kpsk${Ty.encode(Buffer.from(e))}`,public_key:`ktpk${Ty.encode(Buffer.from(t))}`}},CapToConk(n){const e=t=>new Uint8Array(Ty.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 ii.ElvCrypto(),{symmetricKey:t,secretKey:r,publicKey:i}=ii.CapToConk(n);let o,l;return i.length===e.PRIMARY_PK_KEY_SIZE?(l=e.CRYPTO_TYPE_PRIMARY,o=e.newPrimaryContext(i,r,t)):(l=e.CRYPTO_TYPE_TARGET,o=e.newTargetDecryptionContext(r,t)),{context:o,type:l}},Encrypt:async(n,e)=>{const t=await ii.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 l=Math.min(r.length,o+1e6);t.write(r.slice(o,l))}t.end();let i=[];return await new Promise((o,l)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{l(c)})}),Buffer.concat(i)},OpenEncryptionStream:async n=>{const e=await ii.ElvCrypto(),{context:t}=await ii.EncryptionContext(n),r=new nP.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 ii.OpenDecryptionStream(n),r=new Uint8Array(e);for(let o=0;o<r.length;o+=1e6){const l=Math.min(r.length,o+1e6);t.write(r.slice(o,l))}t.end();let i=[];return await new Promise((o,l)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{l(c)})}),Buffer.concat(i)},OpenDecryptionStream:async n=>{const e=await ii.ElvCrypto(),{context:t,type:r}=await ii.EncryptionContext(n),i=new nP.PassThrough,o=e.createDecipher(r,t);return i.pipe(o).on("finish",()=>{t.free()}).on("error",l=>{throw Error(l)})}};var SB=ii,Zr={},rP;function CB(){if(rP)return Zr;rP=1;const n=ki;let e;n.Platform()===n.PLATFORM_NODE&&(globalThis.Response=S5().Response,e=p2);const t=_s,{ValidatePresence:r,ValidateWriteToken:i,ValidatePartHash:o,ValidateParameters:l}=Ko;return Zr.ListFiles=async function({libraryId:c,objectId:p,path:h="",versionHash:m,writeToken:w}){l({libraryId:c,objectId:p,versionHash:m,writeToken:w}),m&&(p=this.utils.DecodeVersionHash(m).objectId);let b=t("q",w||m||p,"files_list",h);return this.HttpClient.RequestJsonBody({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:m}),method:"GET",path:b})},Zr.UploadFilesFromS3=async function({libraryId:c,objectId:p,writeToken:h,region:m,bucket:w,fileInfo:b,accessKey:g,secret:S,signedUrl:A,encryption:k="none",copy:R=!1,callback:L}){l({libraryId:c,objectId:p}),i(h);const I=/^s3:\/\/([^/]+)\//i;for(let Se=0;Se<b.length;Se++){const Ce=b[Se].source,ne=I.exec(Ce);if(ne){if(ne[1]!==w)throw Error('Full S3 file path "'+Ce+`" specified, but does not match provided bucket name '`+w+"'");b[Se].source=Ce.replace(I,"")}}R?this.Log(`Copying files from S3: ${c} ${p} ${h}`):this.Log(`Adding links to files in S3: ${c} ${p} ${h}`);let q;if(k==="cgck"){let Se=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});Se={...Se,secret_key:""},q=`kp__${this.utils.B58(Buffer.from(JSON.stringify(Se)))}`}let G={access_key_id:g,secret_access_key:S};A&&(G={signed_url:A});const de={encryption_key:q,access:{protocol:"s3",platform:"aws",path:w,storage_endpoint:{region:m},cloud_credentials:G}},oe=b.map(Se=>R?{op:"ingest-copy",path:Se.path,encryption:{scheme:k==="cgck"?"cgck":"none"},ingest:{type:"key",path:Se.source}}:{op:"add-reference",path:Se.path,reference:{type:"key",path:Se.source}}),{id:ye}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:oe,defaults:de});for(;;){await new Promise(ne=>setTimeout(ne,1e3));const Se=await this.UploadStatus({libraryId:c,objectId:p,writeToken:h,uploadId:ye});if(Se.errors&&Se.errors.length>1)throw Se.errors.join(`
|
|
326
|
+
`;super(S),this.name="AggregateError",this.errors=g}}n.exports={AggregateError:w,kEmptyObject:Object.freeze({}),once(b){let g=!1;return function(...S){g||(g=!0,b.apply(this,S))}},createDeferredPromise:function(){let b,g;return{promise:new Promise((A,k)=>{b=A,g=k}),resolve:b,reject:g}},promisify(b){return new Promise((g,S)=>{b((A,...k)=>A?S(A):g(...k))})},debuglog(){return function(){}},format(b,...g){return b.replace(/%([sdifj])/g,function(...[S,A]){const k=g.shift();return A==="f"?k.toFixed(6):A==="j"?JSON.stringify(k):A==="s"&&typeof k=="object"?`${k.constructor!==Object?k.constructor.name:""} {}`.trim():k.toString()})},inspect(b){switch(typeof b){case"string":if(b.includes("'"))if(b.includes('"')){if(!b.includes("`")&&!b.includes("${"))return`\`${b}\``}else return`"${b}"`;return`'${b}'`;case"number":return isNaN(b)?"NaN":Object.is(b,-0)?String(b):b;case"bigint":return`${String(b)}n`;case"boolean":case"undefined":return String(b);case"object":return"{}"}},types:{isAsyncFunction(b){return b instanceof l},isArrayBufferView(b){return ArrayBuffer.isView(b)}},isBlob:p,deprecate(b,g){return b},addAbortListener:Gb.addAbortListener||function(g,S){if(g===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",g);h(g,"signal"),m(S,"listener");let A;return g.aborted?queueMicrotask(()=>S()):(g.addEventListener("abort",S,{__proto__:null,once:!0,[t]:!0}),A=()=>{g.removeEventListener("abort",S)}),{__proto__:null,[r](){var k;(k=A)===null||k===void 0||k()}}},AbortSignalAny:i.any||function(g){if(g.length===1)return g[0];const S=new o,A=()=>S.abort();return g.forEach(k=>{h(k,"signals"),k.addEventListener("abort",A,{once:!0})}),S.signal.addEventListener("abort",()=>{g.forEach(k=>k.removeEventListener("abort",A))},{once:!0}),S.signal}},n.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(EF);var xs=EF.exports,F5={};const{format:cae,inspect:Xx,AggregateError:fae}=xs,dae=globalThis.AggregateError||fae,pae=Symbol("kIsNodeError"),hae=["string","function","number","object","Function","Object","boolean","bigint","symbol"],yae=/^([A-Z][a-z0-9]*)+$/,mae="__node_internal_",B2={};function ch(n,e){if(!n)throw new B2.ERR_INTERNAL_ASSERTION(e)}function pN(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 gae(n,e,t){if(typeof e=="function")return ch(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 ch(r===t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${r}).`),t.length===0?e:cae(e,...t)}function Mi(n,e,t){t||(t=Error);class r extends t{constructor(...o){super(gae(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[pae]=!0,B2[n]=r}function hN(n){const e=mae+n.name;return Object.defineProperty(n,"name",{value:e}),n}function vae(n,e){if(n&&e&&n!==e){if(Array.isArray(e.errors))return e.errors.push(n),e;const t=new dae([e,n],e.message);return t.code=e.code,t}return n||e}let bae=class extends Error{constructor(e="The operation was aborted",t=void 0){if(t!==void 0&&typeof t!="object")throw new B2.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Mi("ERR_ASSERTION","%s",Error);Mi("ERR_INVALID_ARG_TYPE",(n,e,t)=>{ch(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=[],l=[];for(const p of e)ch(typeof p=="string","All expected entries have to be of type string"),hae.includes(p)?i.push(p.toLowerCase()):yae.test(p)?o.push(p):(ch(p!=="object",'The value "object" should be written as "Object"'),l.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||l.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}`}}l.length>0&&(r+=" or ")}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(r+="an "),r+=`${l[0]}`;break;case 2:r+=`one of ${l[0]} or ${l[1]}`;break;default:{const p=l.pop();r+=`one of ${l.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=Xx(t,{depth:-1});r+=`. Received ${p}`}}else{let p=Xx(t,{colors:!1});p.length>25&&(p=`${p.slice(0,25)}...`),r+=`. Received type ${typeof t} (${p})`}return r},TypeError);Mi("ERR_INVALID_ARG_VALUE",(n,e,t="is invalid")=>{let r=Xx(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${n.includes(".")?"property":"argument"} '${n}' ${t}. Received ${r}`},TypeError);Mi("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);Mi("ERR_MISSING_ARGS",(...n)=>{ch(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);Mi("ERR_OUT_OF_RANGE",(n,e,t)=>{ch(e,'Missing "range" argument');let r;return Number.isInteger(t)&&Math.abs(t)>2**32?r=pN(String(t)):typeof t=="bigint"?(r=String(t),(t>2n**32n||t<-(2n**32n))&&(r=pN(r)),r+="n"):r=Xx(t),`The value of "${n}" is out of range. It must be ${e}. Received ${r}`},RangeError);Mi("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Mi("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Mi("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Mi("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Mi("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Mi("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Mi("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Mi("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Mi("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Mi("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Mi("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var eo={AbortError:bae,aggregateTwoErrors:hN(vae),hideStackFrames:hN,codes:B2};const{ArrayIsArray:B5,ArrayPrototypeIncludes:PF,ArrayPrototypeJoin:IF,ArrayPrototypeMap:wae,NumberIsInteger:z5,NumberIsNaN:_ae,NumberMAX_SAFE_INTEGER:xae,NumberMIN_SAFE_INTEGER:Sae,NumberParseInt:Cae,ObjectPrototypeHasOwnProperty:Eae,RegExpPrototypeExec:DF,String:Aae,StringPrototypeToUpperCase:kae,StringPrototypeTrim:Mae}=ma,{hideStackFrames:Yo,codes:{ERR_SOCKET_BAD_PORT:Tae,ERR_INVALID_ARG_TYPE:rs,ERR_INVALID_ARG_VALUE:bm,ERR_OUT_OF_RANGE:gh,ERR_UNKNOWN_SIGNAL:yN}}=eo,{normalizeEncoding:Rae}=xs,{isAsyncFunction:Oae,isArrayBufferView:Lae}=xs.types,mN={};function Nae(n){return n===(n|0)}function Pae(n){return n===n>>>0}const Iae=/^[0-7]+$/,Dae="must be a 32-bit unsigned integer or an octal string";function Uae(n,e,t){if(typeof n>"u"&&(n=t),typeof n=="string"){if(DF(Iae,n)===null)throw new bm(e,n,Dae);n=Cae(n,8)}return UF(n,e),n}const Fae=Yo((n,e,t=Sae,r=xae)=>{if(typeof n!="number")throw new rs(e,"number",n);if(!z5(n))throw new gh(e,"an integer",n);if(n<t||n>r)throw new gh(e,`>= ${t} && <= ${r}`,n)}),Bae=Yo((n,e,t=-2147483648,r=2147483647)=>{if(typeof n!="number")throw new rs(e,"number",n);if(!z5(n))throw new gh(e,"an integer",n);if(n<t||n>r)throw new gh(e,`>= ${t} && <= ${r}`,n)}),UF=Yo((n,e,t=!1)=>{if(typeof n!="number")throw new rs(e,"number",n);if(!z5(n))throw new gh(e,"an integer",n);const r=t?1:0,i=4294967295;if(n<r||n>i)throw new gh(e,`>= ${r} && <= ${i}`,n)});function j5(n,e){if(typeof n!="string")throw new rs(e,"string",n)}function zae(n,e,t=void 0,r){if(typeof n!="number")throw new rs(e,"number",n);if(t!=null&&n<t||r!=null&&n>r||(t!=null||r!=null)&&_ae(n))throw new gh(e,`${t!=null?`>= ${t}`:""}${t!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,n)}const jae=Yo((n,e,t)=>{if(!PF(t,n)){const i="must be one of: "+IF(wae(t,o=>typeof o=="string"?`'${o}'`:Aae(o)),", ");throw new bm(e,n,i)}});function FF(n,e){if(typeof n!="boolean")throw new rs(e,"boolean",n)}function h8(n,e,t){return n==null||!Eae(n,e)?t:n[e]}const Hae=Yo((n,e,t=null)=>{const r=h8(t,"allowArray",!1),i=h8(t,"allowFunction",!1);if(!h8(t,"nullable",!1)&&n===null||!r&&B5(n)||typeof n!="object"&&(!i||typeof n!="function"))throw new rs(e,"Object",n)}),$ae=Yo((n,e)=>{if(n!=null&&typeof n!="object"&&typeof n!="function")throw new rs(e,"a dictionary",n)}),z2=Yo((n,e,t=0)=>{if(!B5(n))throw new rs(e,"Array",n);if(n.length<t){const r=`must be longer than ${t}`;throw new bm(e,n,r)}});function qae(n,e){z2(n,e);for(let t=0;t<n.length;t++)j5(n[t],`${e}[${t}]`)}function Vae(n,e){z2(n,e);for(let t=0;t<n.length;t++)FF(n[t],`${e}[${t}]`)}function Gae(n,e){z2(n,e);for(let t=0;t<n.length;t++){const r=n[t],i=`${e}[${t}]`;if(r==null)throw new rs(i,"AbortSignal",r);BF(r,i)}}function Wae(n,e="signal"){if(j5(n,e),mN[n]===void 0)throw mN[kae(n)]!==void 0?new yN(n+" (signals must use all capital letters)"):new yN(n)}const Kae=Yo((n,e="buffer")=>{if(!Lae(n))throw new rs(e,["Buffer","TypedArray","DataView"],n)});function Yae(n,e){const t=Rae(e),r=n.length;if(t==="hex"&&r%2!==0)throw new bm("encoding",e,`is invalid for data of length ${r}`)}function Jae(n,e="Port",t=!0){if(typeof n!="number"&&typeof n!="string"||typeof n=="string"&&Mae(n).length===0||+n!==+n>>>0||n>65535||n===0&&!t)throw new Tae(e,n,t);return n|0}const BF=Yo((n,e)=>{if(n!==void 0&&(n===null||typeof n!="object"||!("aborted"in n)))throw new rs(e,"AbortSignal",n)}),Qae=Yo((n,e)=>{if(typeof n!="function")throw new rs(e,"Function",n)}),Zae=Yo((n,e)=>{if(typeof n!="function"||Oae(n))throw new rs(e,"Function",n)}),Xae=Yo((n,e)=>{if(n!==void 0)throw new rs(e,"undefined",n)});function eie(n,e,t){if(!PF(t,n))throw new rs(e,`('${IF(t,"|")}')`,n)}const tie=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function gN(n,e){if(typeof n>"u"||!DF(tie,n))throw new bm(e,n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function nie(n){if(typeof n=="string")return gN(n,"hints"),n;if(B5(n)){const e=n.length;let t="";if(e===0)return t;for(let r=0;r<e;r++){const i=n[r];gN(i,"hints"),t+=i,r!==e-1&&(t+=", ")}return t}throw new bm("hints",n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}var Wb={isInt32:Nae,isUint32:Pae,parseFileMode:Uae,validateArray:z2,validateStringArray:qae,validateBooleanArray:Vae,validateAbortSignalArray:Gae,validateBoolean:FF,validateBuffer:Kae,validateDictionary:$ae,validateEncoding:Yae,validateFunction:Qae,validateInt32:Bae,validateInteger:Fae,validateNumber:zae,validateObject:Hae,validateOneOf:jae,validatePlainFunction:Zae,validatePort:Jae,validateSignalName:Wae,validateString:j5,validateUint32:UF,validateUndefined:Xae,validateUnion:eie,validateAbortSignal:BF,validateLinkHeaderValue:nie},H5={exports:{}},y8={exports:{}},vN;function $d(){if(vN)return y8.exports;vN=1;var n=y8.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(A){if(e===setTimeout)return setTimeout(A,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(A,0);try{return e(A,0)}catch{try{return e.call(null,A,0)}catch{return e.call(this,A,0)}}}function l(A){if(t===clearTimeout)return clearTimeout(A);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(A);try{return t(A)}catch{try{return t.call(null,A)}catch{return t.call(this,A)}}}var c=[],p=!1,h,m=-1;function w(){!p||!h||(p=!1,h.length?c=h.concat(c):m=-1,c.length&&b())}function b(){if(!p){var A=o(w);p=!0;for(var k=c.length;k;){for(h=c,c=[];++m<k;)h&&h[m].run();m=-1,k=c.length}h=null,p=!1,l(A)}}n.nextTick=function(A){var k=new Array(arguments.length-1);if(arguments.length>1)for(var R=1;R<arguments.length;R++)k[R-1]=arguments[R];c.push(new g(A,k)),c.length===1&&!p&&o(b)};function g(A,k){this.fun=A,this.array=k}g.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={};function S(){}return n.on=S,n.addListener=S,n.once=S,n.off=S,n.removeListener=S,n.removeAllListeners=S,n.emit=S,n.prependListener=S,n.prependOnceListener=S,n.listeners=function(A){return[]},n.binding=function(A){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(A){throw new Error("process.chdir is not supported")},n.umask=function(){return 0},y8.exports}const{SymbolAsyncIterator:bN,SymbolIterator:wN,SymbolFor:Th}=ma,zF=Th("nodejs.stream.destroyed"),jF=Th("nodejs.stream.errored"),C4=Th("nodejs.stream.readable"),E4=Th("nodejs.stream.writable"),HF=Th("nodejs.stream.disturbed"),rie=Th("nodejs.webstream.isClosedPromise"),aie=Th("nodejs.webstream.controllerErrorFunction");function j2(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 H2(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 iie(n){return!!(n&&typeof n.pipe=="function"&&n._readableState&&typeof n.on=="function"&&typeof n.write=="function")}function Qu(n){return n&&(n._readableState||n._writableState||typeof n.write=="function"&&typeof n.on=="function"||typeof n.pipe=="function"&&typeof n.on=="function")}function $F(n){return!!(n&&!Qu(n)&&typeof n.pipeThrough=="function"&&typeof n.getReader=="function"&&typeof n.cancel=="function")}function qF(n){return!!(n&&!Qu(n)&&typeof n.getWriter=="function"&&typeof n.abort=="function")}function VF(n){return!!(n&&!Qu(n)&&typeof n.readable=="object"&&typeof n.writable=="object")}function sie(n){return $F(n)||qF(n)||VF(n)}function oie(n,e){return n==null?!1:e===!0?typeof n[bN]=="function":e===!1?typeof n[wN]=="function":typeof n[bN]=="function"||typeof n[wN]=="function"}function $2(n){if(!Qu(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!!(n.destroyed||n[zF]||r!=null&&r.destroyed)}function GF(n){if(!H2(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 lie(n,e){if(!H2(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 uie(n){if(!j2(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 WF(n,e){if(!j2(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 KF(n){return n&&n[C4]!=null?n[C4]:typeof(n==null?void 0:n.readable)!="boolean"?null:$2(n)?!1:j2(n)&&n.readable&&!WF(n)}function YF(n){return n&&n[E4]!=null?n[E4]:typeof(n==null?void 0:n.writable)!="boolean"?null:$2(n)?!1:H2(n)&&n.writable&&!GF(n)}function cie(n,e){return Qu(n)?$2(n)?!0:!((e==null?void 0:e.readable)!==!1&&KF(n)||(e==null?void 0:e.writable)!==!1&&YF(n)):null}function fie(n){var e,t;return Qu(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 die(n){var e,t;return Qu(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 pie(n){if(!Qu(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"&&JF(n)?n._closed:null}function JF(n){return typeof n._closed=="boolean"&&typeof n._defaultKeepAlive=="boolean"&&typeof n._removedConnection=="boolean"&&typeof n._removedContLen=="boolean"}function QF(n){return typeof n._sent100=="boolean"&&JF(n)}function hie(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(!Qu(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!r&&QF(n)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function mie(n){var e;return!!(n&&((e=n[HF])!==null&&e!==void 0?e:n.readableDidRead||n.readableAborted))}function gie(n){var e,t,r,i,o,l,c,p,h,m;return!!(n&&((e=(t=(r=(i=(o=(l=n[jF])!==null&&l!==void 0?l: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:!((m=n._writableState)===null||m===void 0)&&m.errored))}var ef={isDestroyed:$2,kIsDestroyed:zF,isDisturbed:mie,kIsDisturbed:HF,isErrored:gie,kIsErrored:jF,isReadable:KF,kIsReadable:C4,kIsClosedPromise:rie,kControllerErrorFunction:aie,kIsWritable:E4,isClosed:pie,isDuplexNodeStream:iie,isFinished:cie,isIterable:oie,isReadableNodeStream:j2,isReadableStream:$F,isReadableEnded:uie,isReadableFinished:WF,isReadableErrored:die,isNodeStream:Qu,isWebStream:sie,isWritable:YF,isWritableNodeStream:H2,isWritableStream:qF,isWritableEnded:GF,isWritableFinished:lie,isWritableErrored:fie,isServerRequest:hie,isServerResponse:QF,willEmitClose:yie,isTransformStream:VF};const wd=$d(),{AbortError:ZF,codes:vie}=eo,{ERR_INVALID_ARG_TYPE:bie,ERR_STREAM_PREMATURE_CLOSE:_N}=vie,{kEmptyObject:A4,once:k4}=xs,{validateAbortSignal:wie,validateFunction:_ie,validateObject:xie,validateBoolean:Sie}=Wb,{Promise:Cie,PromisePrototypeThen:Eie,SymbolDispose:XF}=ma,{isClosed:Aie,isReadable:xN,isReadableNodeStream:m8,isReadableStream:kie,isReadableFinished:SN,isReadableErrored:CN,isWritable:EN,isWritableNodeStream:AN,isWritableStream:Mie,isWritableFinished:kN,isWritableErrored:MN,isNodeStream:Tie,willEmitClose:Rie,kIsClosedPromise:Oie}=ef;let qy;function Lie(n){return n.setHeader&&typeof n.abort=="function"}const M4=()=>{};function eB(n,e,t){var r,i;if(arguments.length===2?(t=e,e=A4):e==null?e=A4:xie(e,"options"),_ie(t,"callback"),wie(e.signal,"options.signal"),t=k4(t),kie(n)||Mie(n))return Nie(n,e,t);if(!Tie(n))throw new bie("stream",["ReadableStream","WritableStream","Stream"],n);const o=(r=e.readable)!==null&&r!==void 0?r:m8(n),l=(i=e.writable)!==null&&i!==void 0?i:AN(n),c=n._writableState,p=n._readableState,h=()=>{n.writable||b()};let m=Rie(n)&&m8(n)===o&&AN(n)===l,w=kN(n,!1);const b=()=>{w=!0,n.destroyed&&(m=!1),!(m&&(!n.readable||o))&&(!o||g)&&t.call(n)};let g=SN(n,!1);const S=()=>{g=!0,n.destroyed&&(m=!1),!(m&&(!n.writable||l))&&(!l||w)&&t.call(n)},A=G=>{t.call(n,G)};let k=Aie(n);const R=()=>{k=!0;const G=MN(n)||CN(n);if(G&&typeof G!="boolean")return t.call(n,G);if(o&&!g&&m8(n,!0)&&!SN(n,!1))return t.call(n,new _N);if(l&&!w&&!kN(n,!1))return t.call(n,new _N);t.call(n)},L=()=>{k=!0;const G=MN(n)||CN(n);if(G&&typeof G!="boolean")return t.call(n,G);t.call(n)},I=()=>{n.req.on("finish",b)};Lie(n)?(n.on("complete",b),m||n.on("abort",R),n.req?I():n.on("request",I)):l&&!c&&(n.on("end",h),n.on("close",h)),!m&&typeof n.aborted=="boolean"&&n.on("aborted",R),n.on("end",S),n.on("finish",b),e.error!==!1&&n.on("error",A),n.on("close",R),k?wd.nextTick(R):c!=null&&c.errorEmitted||p!=null&&p.errorEmitted?m||wd.nextTick(L):(!o&&(!m||xN(n))&&(w||EN(n)===!1)||!l&&(!m||EN(n))&&(g||xN(n)===!1)||p&&n.req&&n.aborted)&&wd.nextTick(L);const q=()=>{t=M4,n.removeListener("aborted",R),n.removeListener("complete",b),n.removeListener("abort",R),n.removeListener("request",I),n.req&&n.req.removeListener("finish",b),n.removeListener("end",h),n.removeListener("close",h),n.removeListener("finish",b),n.removeListener("end",S),n.removeListener("error",A),n.removeListener("close",R)};if(e.signal&&!k){const G=()=>{const de=t;q(),de.call(n,new ZF(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)wd.nextTick(G);else{qy=qy||xs.addAbortListener;const de=qy(e.signal,G),oe=t;t=k4((...ye)=>{de[XF](),oe.apply(n,ye)})}}return q}function Nie(n,e,t){let r=!1,i=M4;if(e.signal)if(i=()=>{r=!0,t.call(n,new ZF(void 0,{cause:e.signal.reason}))},e.signal.aborted)wd.nextTick(i);else{qy=qy||xs.addAbortListener;const l=qy(e.signal,i),c=t;t=k4((...p)=>{l[XF](),c.apply(n,p)})}const o=(...l)=>{r||wd.nextTick(()=>t.apply(n,l))};return Eie(n[Oie].promise,o,o),M4}function Pie(n,e){var t;let r=!1;return e===null&&(e=A4),(t=e)!==null&&t!==void 0&&t.cleanup&&(Sie(e.cleanup,"cleanup"),r=e.cleanup),new Cie((i,o)=>{const l=eB(n,e,c=>{r&&l(),c?o(c):i()})})}H5.exports=eB;H5.exports.finished=Pie;var qd=H5.exports;const ju=$d(),{aggregateTwoErrors:Iie,codes:{ERR_MULTIPLE_CALLBACK:Die},AbortError:Uie}=eo,{Symbol:tB}=ma,{kIsDestroyed:Fie,isDestroyed:Bie,isFinished:zie,isServerRequest:jie}=ef,nB=tB("kDestroy"),T4=tB("kConstruct");function rB(n,e,t){n&&(n.stack,e&&!e.errored&&(e.errored=n),t&&!t.errored&&(t.errored=n))}function Hie(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):(rB(n,r,t),r&&(r.destroyed=!0),t&&(t.destroyed=!0),i.constructed?TN(this,n,e):this.once(nB,function(o){TN(this,Iie(o,n),e)}),this)}function TN(n,e,t){let r=!1;function i(o){if(r)return;r=!0;const l=n._readableState,c=n._writableState;rB(o,c,l),c&&(c.closed=!0),l&&(l.closed=!0),typeof t=="function"&&t(o),o?ju.nextTick($ie,n,o):ju.nextTick(aB,n)}try{n._destroy(e||null,i)}catch(o){i(o)}}function $ie(n,e){R4(n,e),aB(n)}function aB(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 R4(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 qie(){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 O4(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?ju.nextTick(R4,n,e):R4(n,e))}function Vie(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(T4,e),!(n.listenerCount(T4)>1)&&ju.nextTick(Gie,n)}function Gie(n){let e=!1;function t(r){if(e){O4(n,r??new Die);return}e=!0;const i=n._readableState,o=n._writableState,l=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),l.destroyed?n.emit(nB,r):r?O4(n,r,!0):ju.nextTick(Wie,n)}try{n._construct(r=>{ju.nextTick(t,r)})}catch(r){ju.nextTick(t,r)}}function Wie(n){n.emit(T4)}function RN(n){return(n==null?void 0:n.setHeader)&&typeof n.abort=="function"}function iB(n){n.emit("close")}function Kie(n,e){n.emit("error",e),ju.nextTick(iB,n)}function Yie(n,e){!n||Bie(n)||(!e&&!zie(n)&&(e=new Uie),jie(n)?(n.socket=null,n.destroy(e)):RN(n)?n.abort():RN(n.req)?n.req.abort():typeof n.destroy=="function"?n.destroy(e):typeof n.close=="function"?n.close():e?ju.nextTick(Kie,n,e):ju.nextTick(iB,n),n.destroyed||(n[Fie]=!0))}var wm={construct:Vie,destroyer:Yie,destroy:Hie,undestroy:qie,errorOrDestroy:O4};const{ArrayIsArray:Jie,ObjectSetPrototypeOf:sB}=ma,{EventEmitter:q2}=Gb;function V2(n){q2.call(this,n)}sB(V2.prototype,q2.prototype);sB(V2,q2);V2.prototype.pipe=function(n,e){const t=this;function r(m){n.writable&&n.write(m)===!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",l),t.on("close",c));let o=!1;function l(){o||(o=!0,n.end())}function c(){o||(o=!0,typeof n.destroy=="function"&&n.destroy())}function p(m){h(),q2.listenerCount(this,"error")===0&&this.emit("error",m)}L4(t,"error",p),L4(n,"error",p);function h(){t.removeListener("data",r),n.removeListener("drain",i),t.removeListener("end",l),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 L4(n,e,t){if(typeof n.prependListener=="function")return n.prependListener(e,t);!n._events||!n._events[e]?n.on(e,t):Jie(n._events[e])?n._events[e].unshift(t):n._events[e]=[t,n._events[e]]}var $5={Stream:V2,prependListener:L4},oB={exports:{}};(function(n){const{SymbolDispose:e}=ma,{AbortError:t,codes:r}=eo,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:l}=ef,c=qd,{ERR_INVALID_ARG_TYPE:p}=r;let h;const m=(w,b)=>{if(typeof w!="object"||!("aborted"in w))throw new p(b,"AbortSignal",w)};n.exports.addAbortSignal=function(b,g){if(m(b,"signal"),!i(g)&&!o(g))throw new p("stream",["ReadableStream","WritableStream","Stream"],g);return n.exports.addAbortSignalNoValidate(b,g)},n.exports.addAbortSignalNoValidate=function(w,b){if(typeof w!="object"||!("aborted"in w))return b;const g=i(b)?()=>{b.destroy(new t(void 0,{cause:w.reason}))}:()=>{b[l](new t(void 0,{cause:w.reason}))};if(w.aborted)g();else{h=h||xs.addAbortListener;const S=h(w,g);c(b,S[e])}return b}})(oB);var G2=oB.exports;const{StringPrototypeSlice:ON,SymbolIterator:Qie,TypedArrayPrototypeSet:mx,Uint8Array:Zie}=ma,{Buffer:g8}=Hd,{inspect:Xie}=xs;var ese=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 g8.alloc(0);const t=g8.allocUnsafe(e>>>0);let r=this.head,i=0;for(;r;)mx(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}*[Qie](){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+=ON(o,0,e),this.head=r,r.data=ON(o,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){const t=g8.allocUnsafe(e),r=e;let i=this.head,o=0;do{const l=i.data;if(e>l.length)mx(t,l,r-e),e-=l.length;else{e===l.length?(mx(t,l,r-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(mx(t,new Zie(l.buffer,l.byteOffset,e),r-e),this.head=i,i.data=l.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,t}[Symbol.for("nodejs.util.inspect.custom")](e,t){return Xie(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:tse,NumberIsInteger:nse}=ma,{validateInteger:rse}=Wb,{ERR_INVALID_ARG_VALUE:ase}=eo.codes;let lB=16*1024,uB=16;function ise(n,e,t){return n.highWaterMark!=null?n.highWaterMark:e?n[t]:null}function cB(n){return n?uB:lB}function sse(n,e){rse(e,"value",0),n?uB=e:lB=e}function ose(n,e,t,r){const i=ise(e,r,t);if(i!=null){if(!nse(i)||i<0){const o=r?`options.${t}`:"options.highWaterMark";throw new ase(o,i)}return tse(i)}return cB(n.objectMode)}var W2={getHighWaterMark:ose,getDefaultHighWaterMark:cB,setDefaultHighWaterMark:sse},q5={},V5=sU.Buffer,LN=V5.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 lse(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 use(n){var e=lse(n);if(typeof e!="string"&&(V5.isEncoding===LN||!LN(n)))throw new Error("Unknown encoding: "+n);return e||n}q5.StringDecoder=Kb;function Kb(n){this.encoding=use(n);var e;switch(this.encoding){case"utf16le":this.text=yse,this.end=mse,e=4;break;case"utf8":this.fillLast=dse,e=4;break;case"base64":this.text=gse,this.end=vse,e=3;break;default:this.write=bse,this.end=wse;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=V5.allocUnsafe(e)}Kb.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||""};Kb.prototype.end=hse;Kb.prototype.text=pse;Kb.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 v8(n){return n<=127?0:n>>5===6?2:n>>4===14?3:n>>3===30?4:n>>6===2?-1:-2}function cse(n,e,t){var r=e.length-1;if(r<t)return 0;var i=v8(e[r]);return i>=0?(i>0&&(n.lastNeed=i-1),i):--r<t||i===-2?0:(i=v8(e[r]),i>=0?(i>0&&(n.lastNeed=i-2),i):--r<t||i===-2?0:(i=v8(e[r]),i>=0?(i>0&&(i===2?i=0:n.lastNeed=i-3),i):0))}function fse(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 dse(n){var e=this.lastTotal-this.lastNeed,t=fse(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 pse(n,e){var t=cse(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 hse(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 mse(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 gse(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 vse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function bse(n){return n.toString(this.encoding)}function wse(n){return n&&n.length?this.write(n):""}const NN=$d(),{PromisePrototypeThen:_se,SymbolAsyncIterator:PN,SymbolIterator:IN}=ma,{Buffer:xse}=Hd,{ERR_INVALID_ARG_TYPE:Sse,ERR_STREAM_NULL_VALUES:Cse}=eo.codes;function Ese(n,e,t){let r;if(typeof e=="string"||e instanceof xse)return new n({objectMode:!0,...t,read(){this.push(e),this.push(null)}});let i;if(e&&e[PN])i=!0,r=e[PN]();else if(e&&e[IN])i=!1,r=e[IN]();else throw new Sse("iterable",["Iterable"],e);const o=new n({objectMode:!0,highWaterMark:1,...t});let l=!1;o._read=function(){l||(l=!0,p())},o._destroy=function(h,m){_se(c(h),()=>NN.nextTick(m,h),w=>NN.nextTick(m,w||h))};async function c(h){const m=h!=null,w=typeof r.throw=="function";if(m&&w){const{value:b,done:g}=await r.throw(h);if(await b,g)return}if(typeof r.return=="function"){const{value:b}=await r.return();await b}}async function p(){for(;;){try{const{value:h,done:m}=i?await r.next():r.next();if(m)o.push(null);else{const w=h&&typeof h.then=="function"?await h:h;if(w===null)throw l=!1,new Cse;if(o.push(w))continue;l=!1}}catch(h){o.destroy(h)}break}}return o}var fB=Ese,b8,DN;function K2(){if(DN)return b8;DN=1;const n=$d(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:i,ObjectDefineProperties:o,ObjectKeys:l,ObjectSetPrototypeOf:c,Promise:p,SafeSet:h,SymbolAsyncDispose:m,SymbolAsyncIterator:w,Symbol:b}=ma;b8=Ne,Ne.ReadableState=Ee;const{EventEmitter:g}=Gb,{Stream:S,prependListener:A}=$5,{Buffer:k}=Hd,{addAbortSignal:R}=G2,L=qd;let I=xs.debuglog("stream",ve=>{I=ve});const q=ese,G=wm,{getHighWaterMark:de,getDefaultHighWaterMark:oe}=W2,{aggregateTwoErrors:ye,codes:{ERR_INVALID_ARG_TYPE:Se,ERR_METHOD_NOT_IMPLEMENTED:Ce,ERR_OUT_OF_RANGE:ne,ERR_STREAM_PUSH_AFTER_EOF:Le,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:C},AbortError:x}=eo,{validateObject:O}=Wb,z=b("kPaused"),{StringDecoder:F}=q5,H=fB;c(Ne.prototype,S.prototype),c(Ne,S);const Q=()=>{},{errorOrDestroy:ae}=G,N=1,T=2,Y=4,ee=8,j=16,be=32,Ie=64,Me=128,De=256,se=512,fe=1024,pe=2048,ue=4096,re=8192,me=16384,J=32768,P=65536,U=1<<17,te=1<<18;function le(ve){return{enumerable:!1,get(){return(this.state&ve)!==0},set(xe){xe?this.state|=ve:this.state&=~ve}}}o(Ee.prototype,{objectMode:le(N),ended:le(T),endEmitted:le(Y),reading:le(ee),constructed:le(j),sync:le(be),needReadable:le(Ie),emittedReadable:le(Me),readableListening:le(De),resumeScheduled:le(se),errorEmitted:le(fe),emitClose:le(pe),autoDestroy:le(ue),destroyed:le(re),closed:le(me),closeEmitted:le(J),multiAwaitDrain:le(P),readingMore:le(U),dataEmitted:le(te)});function Ee(ve,xe,ct){typeof ct!="boolean"&&(ct=xe instanceof Yc()),this.state=pe|ue|j|be,ve&&ve.objectMode&&(this.state|=N),ct&&ve&&ve.readableObjectMode&&(this.state|=N),this.highWaterMark=ve?de(this,ve,"readableHighWaterMark",ct):oe(!1),this.buffer=new q,this.length=0,this.pipes=[],this.flowing=null,this[z]=null,ve&&ve.emitClose===!1&&(this.state&=~pe),ve&&ve.autoDestroy===!1&&(this.state&=~ue),this.errored=null,this.defaultEncoding=ve&&ve.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,ve&&ve.encoding&&(this.decoder=new F(ve.encoding),this.encoding=ve.encoding)}function Ne(ve){if(!(this instanceof Ne))return new Ne(ve);const xe=this instanceof Yc();this._readableState=new Ee(ve,this,xe),ve&&(typeof ve.read=="function"&&(this._read=ve.read),typeof ve.destroy=="function"&&(this._destroy=ve.destroy),typeof ve.construct=="function"&&(this._construct=ve.construct),ve.signal&&!xe&&R(ve.signal,this)),S.call(this,ve),G.construct(this,()=>{this._readableState.needReadable&&_e(this,this._readableState)})}Ne.prototype.destroy=G.destroy,Ne.prototype._undestroy=G.undestroy,Ne.prototype._destroy=function(ve,xe){xe(ve)},Ne.prototype[g.captureRejectionSymbol]=function(ve){this.destroy(ve)},Ne.prototype[m]=function(){let ve;return this.destroyed||(ve=this.readableEnded?null:new x,this.destroy(ve)),new p((xe,ct)=>L(this,at=>at&&at!==ve?ct(at):xe(null)))},Ne.prototype.push=function(ve,xe){return Qe(this,ve,xe,!1)},Ne.prototype.unshift=function(ve,xe){return Qe(this,ve,xe,!0)};function Qe(ve,xe,ct,at){I("readableAddChunk",xe);const ft=ve._readableState;let Dn;if(ft.state&N||(typeof xe=="string"?(ct=ct||ft.defaultEncoding,ft.encoding!==ct&&(at&&ft.encoding?xe=k.from(xe,ct).toString(ft.encoding):(xe=k.from(xe,ct),ct=""))):xe instanceof k?ct="":S._isUint8Array(xe)?(xe=S._uint8ArrayToBuffer(xe),ct=""):xe!=null&&(Dn=new Se("chunk",["string","Buffer","Uint8Array"],xe))),Dn)ae(ve,Dn);else if(xe===null)ft.state&=~ee,$(ve,ft);else if(ft.state&N||xe&&xe.length>0)if(at)if(ft.state&Y)ae(ve,new C);else{if(ft.destroyed||ft.errored)return!1;st(ve,ft,xe,!0)}else if(ft.ended)ae(ve,new Le);else{if(ft.destroyed||ft.errored)return!1;ft.state&=~ee,ft.decoder&&!ct?(xe=ft.decoder.write(xe),ft.objectMode||xe.length!==0?st(ve,ft,xe,!1):_e(ve,ft)):st(ve,ft,xe,!1)}else at||(ft.state&=~ee,_e(ve,ft));return!ft.ended&&(ft.length<ft.highWaterMark||ft.length===0)}function st(ve,xe,ct,at){xe.flowing&&xe.length===0&&!xe.sync&&ve.listenerCount("data")>0?(xe.state&P?xe.awaitDrainWriters.clear():xe.awaitDrainWriters=null,xe.dataEmitted=!0,ve.emit("data",ct)):(xe.length+=xe.objectMode?1:ct.length,at?xe.buffer.unshift(ct):xe.buffer.push(ct),xe.state&Ie&&W(ve)),_e(ve,xe)}Ne.prototype.isPaused=function(){const ve=this._readableState;return ve[z]===!0||ve.flowing===!1},Ne.prototype.setEncoding=function(ve){const xe=new F(ve);this._readableState.decoder=xe,this._readableState.encoding=this._readableState.decoder.encoding;const ct=this._readableState.buffer;let at="";for(const ft of ct)at+=xe.write(ft);return ct.clear(),at!==""&&ct.push(at),this._readableState.length=at.length,this};const _t=1073741824;function Et(ve){if(ve>_t)throw new ne("size","<= 1GiB",ve);return ve--,ve|=ve>>>1,ve|=ve>>>2,ve|=ve>>>4,ve|=ve>>>8,ve|=ve>>>16,ve++,ve}function Z(ve,xe){return ve<=0||xe.length===0&&xe.ended?0:xe.state&N?1:r(ve)?xe.flowing&&xe.length?xe.buffer.first().length:xe.length:ve<=xe.length?ve:xe.ended?xe.length:0}Ne.prototype.read=function(ve){I("read",ve),ve===void 0?ve=NaN:t(ve)||(ve=i(ve,10));const xe=this._readableState,ct=ve;if(ve>xe.highWaterMark&&(xe.highWaterMark=Et(ve)),ve!==0&&(xe.state&=~Me),ve===0&&xe.needReadable&&((xe.highWaterMark!==0?xe.length>=xe.highWaterMark:xe.length>0)||xe.ended))return I("read: emitReadable",xe.length,xe.ended),xe.length===0&&xe.ended?Wt(this):W(this),null;if(ve=Z(ve,xe),ve===0&&xe.ended)return xe.length===0&&Wt(this),null;let at=(xe.state&Ie)!==0;if(I("need readable",at),(xe.length===0||xe.length-ve<xe.highWaterMark)&&(at=!0,I("length less than watermark",at)),xe.ended||xe.reading||xe.destroyed||xe.errored||!xe.constructed)at=!1,I("reading, ended or constructing",at);else if(at){I("do read"),xe.state|=ee|be,xe.length===0&&(xe.state|=Ie);try{this._read(xe.highWaterMark)}catch(Dn){ae(this,Dn)}xe.state&=~be,xe.reading||(ve=Z(ct,xe))}let ft;return ve>0?ft=Zt(ve,xe):ft=null,ft===null?(xe.needReadable=xe.length<=xe.highWaterMark,ve=0):(xe.length-=ve,xe.multiAwaitDrain?xe.awaitDrainWriters.clear():xe.awaitDrainWriters=null),xe.length===0&&(xe.ended||(xe.needReadable=!0),ct!==ve&&xe.ended&&Wt(this)),ft!==null&&!xe.errorEmitted&&!xe.closeEmitted&&(xe.dataEmitted=!0,this.emit("data",ft)),ft};function $(ve,xe){if(I("onEofChunk"),!xe.ended){if(xe.decoder){const ct=xe.decoder.end();ct&&ct.length&&(xe.buffer.push(ct),xe.length+=xe.objectMode?1:ct.length)}xe.ended=!0,xe.sync?W(ve):(xe.needReadable=!1,xe.emittedReadable=!0,ge(ve))}}function W(ve){const xe=ve._readableState;I("emitReadable",xe.needReadable,xe.emittedReadable),xe.needReadable=!1,xe.emittedReadable||(I("emitReadable",xe.flowing),xe.emittedReadable=!0,n.nextTick(ge,ve))}function ge(ve){const xe=ve._readableState;I("emitReadable_",xe.destroyed,xe.length,xe.ended),!xe.destroyed&&!xe.errored&&(xe.length||xe.ended)&&(ve.emit("readable"),xe.emittedReadable=!1),xe.needReadable=!xe.flowing&&!xe.ended&&xe.length<=xe.highWaterMark,Ot(ve)}function _e(ve,xe){!xe.readingMore&&xe.constructed&&(xe.readingMore=!0,n.nextTick(Re,ve,xe))}function Re(ve,xe){for(;!xe.reading&&!xe.ended&&(xe.length<xe.highWaterMark||xe.flowing&&xe.length===0);){const ct=xe.length;if(I("maybeReadMore read 0"),ve.read(0),ct===xe.length)break}xe.readingMore=!1}Ne.prototype._read=function(ve){throw new Ce("_read()")},Ne.prototype.pipe=function(ve,xe){const ct=this,at=this._readableState;at.pipes.length===1&&(at.multiAwaitDrain||(at.multiAwaitDrain=!0,at.awaitDrainWriters=new h(at.awaitDrainWriters?[at.awaitDrainWriters]:[]))),at.pipes.push(ve),I("pipe count=%d opts=%j",at.pipes.length,xe);const Dn=(!xe||xe.end!==!1)&&ve!==n.stdout&&ve!==n.stderr?Sn:zt;at.endEmitted?n.nextTick(Dn):ct.once("end",Dn),ve.on("unpipe",hn);function hn(Dt,Kt){I("onunpipe"),Dt===ct&&Kt&&Kt.hasUnpiped===!1&&(Kt.hasUnpiped=!0,Un())}function Sn(){I("onend"),ve.end()}let fr,On=!1;function Un(){I("cleanup"),ve.removeListener("close",Nt),ve.removeListener("finish",Bt),fr&&ve.removeListener("drain",fr),ve.removeListener("error",rt),ve.removeListener("unpipe",hn),ct.removeListener("end",Sn),ct.removeListener("end",zt),ct.removeListener("data",et),On=!0,fr&&at.awaitDrainWriters&&(!ve._writableState||ve._writableState.needDrain)&&fr()}function Te(){On||(at.pipes.length===1&&at.pipes[0]===ve?(I("false write response, pause",0),at.awaitDrainWriters=ve,at.multiAwaitDrain=!1):at.pipes.length>1&&at.pipes.includes(ve)&&(I("false write response, pause",at.awaitDrainWriters.size),at.awaitDrainWriters.add(ve)),ct.pause()),fr||(fr=Be(ct,ve),ve.on("drain",fr))}ct.on("data",et);function et(Dt){I("ondata");const Kt=ve.write(Dt);I("dest.write",Kt),Kt===!1&&Te()}function rt(Dt){if(I("onerror",Dt),zt(),ve.removeListener("error",rt),ve.listenerCount("error")===0){const Kt=ve._writableState||ve._readableState;Kt&&!Kt.errorEmitted?ae(ve,Dt):ve.emit("error",Dt)}}A(ve,"error",rt);function Nt(){ve.removeListener("finish",Bt),zt()}ve.once("close",Nt);function Bt(){I("onfinish"),ve.removeListener("close",Nt),zt()}ve.once("finish",Bt);function zt(){I("unpipe"),ct.unpipe(ve)}return ve.emit("pipe",ct),ve.writableNeedDrain===!0?Te():at.flowing||(I("pipe resume"),ct.resume()),ve};function Be(ve,xe){return function(){const at=ve._readableState;at.awaitDrainWriters===xe?(I("pipeOnDrain",1),at.awaitDrainWriters=null):at.multiAwaitDrain&&(I("pipeOnDrain",at.awaitDrainWriters.size),at.awaitDrainWriters.delete(xe)),(!at.awaitDrainWriters||at.awaitDrainWriters.size===0)&&ve.listenerCount("data")&&ve.resume()}}Ne.prototype.unpipe=function(ve){const xe=this._readableState,ct={hasUnpiped:!1};if(xe.pipes.length===0)return this;if(!ve){const ft=xe.pipes;xe.pipes=[],this.pause();for(let Dn=0;Dn<ft.length;Dn++)ft[Dn].emit("unpipe",this,{hasUnpiped:!1});return this}const at=e(xe.pipes,ve);return at===-1?this:(xe.pipes.splice(at,1),xe.pipes.length===0&&this.pause(),ve.emit("unpipe",this,ct),this)},Ne.prototype.on=function(ve,xe){const ct=S.prototype.on.call(this,ve,xe),at=this._readableState;return ve==="data"?(at.readableListening=this.listenerCount("readable")>0,at.flowing!==!1&&this.resume()):ve==="readable"&&!at.endEmitted&&!at.readableListening&&(at.readableListening=at.needReadable=!0,at.flowing=!1,at.emittedReadable=!1,I("on readable",at.length,at.reading),at.length?W(this):at.reading||n.nextTick(yt,this)),ct},Ne.prototype.addListener=Ne.prototype.on,Ne.prototype.removeListener=function(ve,xe){const ct=S.prototype.removeListener.call(this,ve,xe);return ve==="readable"&&n.nextTick(wt,this),ct},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(ve){const xe=S.prototype.removeAllListeners.apply(this,arguments);return(ve==="readable"||ve===void 0)&&n.nextTick(wt,this),xe};function wt(ve){const xe=ve._readableState;xe.readableListening=ve.listenerCount("readable")>0,xe.resumeScheduled&&xe[z]===!1?xe.flowing=!0:ve.listenerCount("data")>0?ve.resume():xe.readableListening||(xe.flowing=null)}function yt(ve){I("readable nexttick read 0"),ve.read(0)}Ne.prototype.resume=function(){const ve=this._readableState;return ve.flowing||(I("resume"),ve.flowing=!ve.readableListening,gt(this,ve)),ve[z]=!1,this};function gt(ve,xe){xe.resumeScheduled||(xe.resumeScheduled=!0,n.nextTick(At,ve,xe))}function At(ve,xe){I("resume",xe.reading),xe.reading||ve.read(0),xe.resumeScheduled=!1,ve.emit("resume"),Ot(ve),xe.flowing&&!xe.reading&&ve.read(0)}Ne.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[z]=!0,this};function Ot(ve){const xe=ve._readableState;for(I("flow",xe.flowing);xe.flowing&&ve.read()!==null;);}Ne.prototype.wrap=function(ve){let xe=!1;ve.on("data",at=>{!this.push(at)&&ve.pause&&(xe=!0,ve.pause())}),ve.on("end",()=>{this.push(null)}),ve.on("error",at=>{ae(this,at)}),ve.on("close",()=>{this.destroy()}),ve.on("destroy",()=>{this.destroy()}),this._read=()=>{xe&&ve.resume&&(xe=!1,ve.resume())};const ct=l(ve);for(let at=1;at<ct.length;at++){const ft=ct[at];this[ft]===void 0&&typeof ve[ft]=="function"&&(this[ft]=ve[ft].bind(ve))}return this},Ne.prototype[w]=function(){return nn(this)},Ne.prototype.iterator=function(ve){return ve!==void 0&&O(ve,"options"),nn(this,ve)};function nn(ve,xe){typeof ve.read!="function"&&(ve=Ne.wrap(ve,{objectMode:!0}));const ct=Mr(ve,xe);return ct.stream=ve,ct}async function*Mr(ve,xe){let ct=Q;function at(hn){this===ve?(ct(),ct=Q):ct=hn}ve.on("readable",at);let ft;const Dn=L(ve,{writable:!1},hn=>{ft=hn?ye(ft,hn):null,ct(),ct=Q});try{for(;;){const hn=ve.destroyed?null:ve.read();if(hn!==null)yield hn;else{if(ft)throw ft;if(ft===null)return;await new p(at)}}}catch(hn){throw ft=ye(ft,hn),ft}finally{(ft||(xe==null?void 0:xe.destroyOnReturn)!==!1)&&(ft===void 0||ve._readableState.autoDestroy)?G.destroyer(ve,null):(ve.off("readable",at),Dn())}}o(Ne.prototype,{readable:{__proto__:null,get(){const ve=this._readableState;return!!ve&&ve.readable!==!1&&!ve.destroyed&&!ve.errorEmitted&&!ve.endEmitted},set(ve){this._readableState&&(this._readableState.readable=!!ve)}},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(ve){this._readableState&&(this._readableState.flowing=ve)}},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(ve){this._readableState&&(this._readableState.destroyed=ve)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(Ee.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[z]!==!1},set(ve){this[z]=!!ve}}}),Ne._fromList=Zt;function Zt(ve,xe){if(xe.length===0)return null;let ct;return xe.objectMode?ct=xe.buffer.shift():!ve||ve>=xe.length?(xe.decoder?ct=xe.buffer.join(""):xe.buffer.length===1?ct=xe.buffer.first():ct=xe.buffer.concat(xe.length),xe.buffer.clear()):ct=xe.buffer.consume(ve,xe.decoder),ct}function Wt(ve){const xe=ve._readableState;I("endReadable",xe.endEmitted),xe.endEmitted||(xe.ended=!0,n.nextTick(Xr,xe,ve))}function Xr(ve,xe){if(I("endReadableNT",ve.endEmitted,ve.length),!ve.errored&&!ve.closeEmitted&&!ve.endEmitted&&ve.length===0){if(ve.endEmitted=!0,xe.emit("end"),xe.writable&&xe.allowHalfOpen===!1)n.nextTick(Mn,xe);else if(ve.autoDestroy){const ct=xe._writableState;(!ct||ct.autoDestroy&&(ct.finished||ct.writable===!1))&&xe.destroy()}}}function Mn(ve){ve.writable&&!ve.writableEnded&&!ve.destroyed&&ve.end()}Ne.from=function(ve,xe){return H(Ne,ve,xe)};let In;function Ma(){return In===void 0&&(In={}),In}return Ne.fromWeb=function(ve,xe){return Ma().newStreamReadableFromReadableStream(ve,xe)},Ne.toWeb=function(ve,xe){return Ma().newReadableStreamFromStreamReadable(ve,xe)},Ne.wrap=function(ve,xe){var ct,at;return new Ne({objectMode:(ct=(at=ve.readableObjectMode)!==null&&at!==void 0?at:ve.objectMode)!==null&&ct!==void 0?ct:!0,...xe,destroy(ft,Dn){G.destroyer(ve,ft),Dn(ft)}}).wrap(ve)},b8}var w8,UN;function G5(){if(UN)return w8;UN=1;const n=$d(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:o,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:c,Symbol:p,SymbolHasInstance:h}=ma;w8=O,O.WritableState=C;const{EventEmitter:m}=Gb,w=$5.Stream,{Buffer:b}=Hd,g=wm,{addAbortSignal:S}=G2,{getHighWaterMark:A,getDefaultHighWaterMark:k}=W2,{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:L,ERR_MULTIPLE_CALLBACK:I,ERR_STREAM_CANNOT_PIPE:q,ERR_STREAM_DESTROYED:G,ERR_STREAM_ALREADY_FINISHED:de,ERR_STREAM_NULL_VALUES:oe,ERR_STREAM_WRITE_AFTER_END:ye,ERR_UNKNOWN_ENCODING:Se}=eo.codes,{errorOrDestroy:Ce}=g;l(O.prototype,w.prototype),l(O,w);function ne(){}const Le=p("kOnFinished");function C(ue,re,me){typeof me!="boolean"&&(me=re instanceof Yc()),this.objectMode=!!(ue&&ue.objectMode),me&&(this.objectMode=this.objectMode||!!(ue&&ue.writableObjectMode)),this.highWaterMark=ue?A(this,ue,"writableHighWaterMark",me):k(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const J=!!(ue&&ue.decodeStrings===!1);this.decodeStrings=!J,this.defaultEncoding=ue&&ue.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ae.bind(void 0,re),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=!ue||ue.emitClose!==!1,this.autoDestroy=!ue||ue.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Le]=[]}function x(ue){ue.buffered=[],ue.bufferedIndex=0,ue.allBuffers=!0,ue.allNoop=!0}C.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(C.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function O(ue){const re=this instanceof Yc();if(!re&&!r(O,this))return new O(ue);this._writableState=new C(ue,this,re),ue&&(typeof ue.write=="function"&&(this._write=ue.write),typeof ue.writev=="function"&&(this._writev=ue.writev),typeof ue.destroy=="function"&&(this._destroy=ue.destroy),typeof ue.final=="function"&&(this._final=ue.final),typeof ue.construct=="function"&&(this._construct=ue.construct),ue.signal&&S(ue.signal,this)),w.call(this,ue),g.construct(this,()=>{const me=this._writableState;me.writing||ee(this,me),Me(this,me)})}i(O,h,{__proto__:null,value:function(ue){return r(this,ue)?!0:this!==O?!1:ue&&ue._writableState instanceof C}}),O.prototype.pipe=function(){Ce(this,new q)};function z(ue,re,me,J){const P=ue._writableState;if(typeof me=="function")J=me,me=P.defaultEncoding;else{if(!me)me=P.defaultEncoding;else if(me!=="buffer"&&!b.isEncoding(me))throw new Se(me);typeof J!="function"&&(J=ne)}if(re===null)throw new oe;if(!P.objectMode)if(typeof re=="string")P.decodeStrings!==!1&&(re=b.from(re,me),me="buffer");else if(re instanceof b)me="buffer";else if(w._isUint8Array(re))re=w._uint8ArrayToBuffer(re),me="buffer";else throw new R("chunk",["string","Buffer","Uint8Array"],re);let U;return P.ending?U=new ye:P.destroyed&&(U=new G("write")),U?(n.nextTick(J,U),Ce(ue,U,!0),U):(P.pendingcb++,F(ue,P,re,me,J))}O.prototype.write=function(ue,re,me){return z(this,ue,re,me)===!0},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){const ue=this._writableState;ue.corked&&(ue.corked--,ue.writing||ee(this,ue))},O.prototype.setDefaultEncoding=function(re){if(typeof re=="string"&&(re=c(re)),!b.isEncoding(re))throw new Se(re);return this._writableState.defaultEncoding=re,this};function F(ue,re,me,J,P){const U=re.objectMode?1:me.length;re.length+=U;const te=re.length<re.highWaterMark;return te||(re.needDrain=!0),re.writing||re.corked||re.errored||!re.constructed?(re.buffered.push({chunk:me,encoding:J,callback:P}),re.allBuffers&&J!=="buffer"&&(re.allBuffers=!1),re.allNoop&&P!==ne&&(re.allNoop=!1)):(re.writelen=U,re.writecb=P,re.writing=!0,re.sync=!0,ue._write(me,J,re.onwrite),re.sync=!1),te&&!re.errored&&!re.destroyed}function H(ue,re,me,J,P,U,te){re.writelen=J,re.writecb=te,re.writing=!0,re.sync=!0,re.destroyed?re.onwrite(new G("write")):me?ue._writev(P,re.onwrite):ue._write(P,U,re.onwrite),re.sync=!1}function Q(ue,re,me,J){--re.pendingcb,J(me),Y(re),Ce(ue,me)}function ae(ue,re){const me=ue._writableState,J=me.sync,P=me.writecb;if(typeof P!="function"){Ce(ue,new I);return}me.writing=!1,me.writecb=null,me.length-=me.writelen,me.writelen=0,re?(re.stack,me.errored||(me.errored=re),ue._readableState&&!ue._readableState.errored&&(ue._readableState.errored=re),J?n.nextTick(Q,ue,me,re,P):Q(ue,me,re,P)):(me.buffered.length>me.bufferedIndex&&ee(ue,me),J?me.afterWriteTickInfo!==null&&me.afterWriteTickInfo.cb===P?me.afterWriteTickInfo.count++:(me.afterWriteTickInfo={count:1,cb:P,stream:ue,state:me},n.nextTick(N,me.afterWriteTickInfo)):T(ue,me,1,P))}function N({stream:ue,state:re,count:me,cb:J}){return re.afterWriteTickInfo=null,T(ue,re,me,J)}function T(ue,re,me,J){for(!re.ending&&!ue.destroyed&&re.length===0&&re.needDrain&&(re.needDrain=!1,ue.emit("drain"));me-- >0;)re.pendingcb--,J();re.destroyed&&Y(re),Me(ue,re)}function Y(ue){if(ue.writing)return;for(let P=ue.bufferedIndex;P<ue.buffered.length;++P){var re;const{chunk:U,callback:te}=ue.buffered[P],le=ue.objectMode?1:U.length;ue.length-=le,te((re=ue.errored)!==null&&re!==void 0?re:new G("write"))}const me=ue[Le].splice(0);for(let P=0;P<me.length;P++){var J;me[P]((J=ue.errored)!==null&&J!==void 0?J:new G("end"))}x(ue)}function ee(ue,re){if(re.corked||re.bufferProcessing||re.destroyed||!re.constructed)return;const{buffered:me,bufferedIndex:J,objectMode:P}=re,U=me.length-J;if(!U)return;let te=J;if(re.bufferProcessing=!0,U>1&&ue._writev){re.pendingcb-=U-1;const le=re.allNoop?ne:Ne=>{for(let Qe=te;Qe<me.length;++Qe)me[Qe].callback(Ne)},Ee=re.allNoop&&te===0?me:e(me,te);Ee.allBuffers=re.allBuffers,H(ue,re,!0,re.length,Ee,"",le),x(re)}else{do{const{chunk:le,encoding:Ee,callback:Ne}=me[te];me[te++]=null;const Qe=P?1:le.length;H(ue,re,!1,Qe,le,Ee,Ne)}while(te<me.length&&!re.writing);te===me.length?x(re):te>256?(me.splice(0,te),re.bufferedIndex=0):re.bufferedIndex=te}re.bufferProcessing=!1}O.prototype._write=function(ue,re,me){if(this._writev)this._writev([{chunk:ue,encoding:re}],me);else throw new L("_write()")},O.prototype._writev=null,O.prototype.end=function(ue,re,me){const J=this._writableState;typeof ue=="function"?(me=ue,ue=null,re=null):typeof re=="function"&&(me=re,re=null);let P;if(ue!=null){const U=z(this,ue,re);U instanceof t&&(P=U)}return J.corked&&(J.corked=1,this.uncork()),P||(!J.errored&&!J.ending?(J.ending=!0,Me(this,J,!0),J.ended=!0):J.finished?P=new de("end"):J.destroyed&&(P=new G("end"))),typeof me=="function"&&(P||J.finished?n.nextTick(me,P):J[Le].push(me)),this};function j(ue){return ue.ending&&!ue.destroyed&&ue.constructed&&ue.length===0&&!ue.errored&&ue.buffered.length===0&&!ue.finished&&!ue.writing&&!ue.errorEmitted&&!ue.closeEmitted}function be(ue,re){let me=!1;function J(P){if(me){Ce(ue,P??I());return}if(me=!0,re.pendingcb--,P){const U=re[Le].splice(0);for(let te=0;te<U.length;te++)U[te](P);Ce(ue,P,re.sync)}else j(re)&&(re.prefinished=!0,ue.emit("prefinish"),re.pendingcb++,n.nextTick(De,ue,re))}re.sync=!0,re.pendingcb++;try{ue._final(J)}catch(P){J(P)}re.sync=!1}function Ie(ue,re){!re.prefinished&&!re.finalCalled&&(typeof ue._final=="function"&&!re.destroyed?(re.finalCalled=!0,be(ue,re)):(re.prefinished=!0,ue.emit("prefinish")))}function Me(ue,re,me){j(re)&&(Ie(ue,re),re.pendingcb===0&&(me?(re.pendingcb++,n.nextTick((J,P)=>{j(P)?De(J,P):P.pendingcb--},ue,re)):j(re)&&(re.pendingcb++,De(ue,re))))}function De(ue,re){re.pendingcb--,re.finished=!0;const me=re[Le].splice(0);for(let J=0;J<me.length;J++)me[J]();if(ue.emit("finish"),re.autoDestroy){const J=ue._readableState;(!J||J.autoDestroy&&(J.endEmitted||J.readable===!1))&&ue.destroy()}}o(O.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(ue){this._writableState&&(this._writableState.destroyed=ue)}},writable:{__proto__:null,get(){const ue=this._writableState;return!!ue&&ue.writable!==!1&&!ue.destroyed&&!ue.errored&&!ue.ending&&!ue.ended},set(ue){this._writableState&&(this._writableState.writable=!!ue)}},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 ue=this._writableState;return ue?!ue.destroyed&&!ue.ending&&ue.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=g.destroy;O.prototype.destroy=function(ue,re){const me=this._writableState;return!me.destroyed&&(me.bufferedIndex<me.buffered.length||me[Le].length)&&n.nextTick(Y,me),se.call(this,ue,re),this},O.prototype._undestroy=g.undestroy,O.prototype._destroy=function(ue,re){re(ue)},O.prototype[m.captureRejectionSymbol]=function(ue){this.destroy(ue)};let fe;function pe(){return fe===void 0&&(fe={}),fe}return O.fromWeb=function(ue,re){return pe().newStreamWritableFromWritableStream(ue,re)},O.toWeb=function(ue){return pe().newWritableStreamFromStreamWritable(ue)},w8}var _8,FN;function Ase(){if(FN)return _8;FN=1;const n=$d(),e=Hd,{isReadable:t,isWritable:r,isIterable:i,isNodeStream:o,isReadableNodeStream:l,isWritableNodeStream:c,isDuplexNodeStream:p,isReadableStream:h,isWritableStream:m}=ef,w=qd,{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:S}}=eo,{destroyer:A}=wm,k=Yc(),R=K2(),L=G5(),{createDeferredPromise:I}=xs,q=fB,G=globalThis.Blob||e.Blob,de=typeof G<"u"?function(C){return C instanceof G}:function(C){return!1},oe=globalThis.AbortController||Tb().AbortController,{FunctionPrototypeCall:ye}=ma;class Se extends k{constructor(C){super(C),(C==null?void 0:C.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(C==null?void 0:C.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}_8=function Le(C,x){if(p(C))return C;if(l(C))return ne({readable:C});if(c(C))return ne({writable:C});if(o(C))return ne({writable:!1,readable:!1});if(h(C))return ne({readable:R.fromWeb(C)});if(m(C))return ne({writable:L.fromWeb(C)});if(typeof C=="function"){const{value:z,write:F,final:H,destroy:Q}=Ce(C);if(i(z))return q(Se,z,{objectMode:!0,write:F,final:H,destroy:Q});const ae=z==null?void 0:z.then;if(typeof ae=="function"){let N;const T=ye(ae,z,Y=>{if(Y!=null)throw new S("nully","body",Y)},Y=>{A(N,Y)});return N=new Se({objectMode:!0,readable:!1,write:F,final(Y){H(async()=>{try{await T,n.nextTick(Y,null)}catch(ee){n.nextTick(Y,ee)}})},destroy:Q})}throw new S("Iterable, AsyncIterable or AsyncFunction",x,z)}if(de(C))return Le(C.arrayBuffer());if(i(C))return q(Se,C,{objectMode:!0,writable:!1});if(h(C==null?void 0:C.readable)&&m(C==null?void 0:C.writable))return Se.fromWeb(C);if(typeof(C==null?void 0:C.writable)=="object"||typeof(C==null?void 0:C.readable)=="object"){const z=C!=null&&C.readable?l(C==null?void 0:C.readable)?C==null?void 0:C.readable:Le(C.readable):void 0,F=C!=null&&C.writable?c(C==null?void 0:C.writable)?C==null?void 0:C.writable:Le(C.writable):void 0;return ne({readable:z,writable:F})}const O=C==null?void 0:C.then;if(typeof O=="function"){let z;return ye(O,C,F=>{F!=null&&z.push(F),z.push(null)},F=>{A(z,F)}),z=new Se({objectMode:!0,writable:!1,read(){}})}throw new g(x,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],C)};function Ce(Le){let{promise:C,resolve:x}=I();const O=new oe,z=O.signal;return{value:Le(async function*(){for(;;){const H=C;C=null;const{chunk:Q,done:ae,cb:N}=await H;if(n.nextTick(N),ae)return;if(z.aborted)throw new b(void 0,{cause:z.reason});({promise:C,resolve:x}=I()),yield Q}}(),{signal:z}),write(H,Q,ae){const N=x;x=null,N({chunk:H,done:!1,cb:ae})},final(H){const Q=x;x=null,Q({done:!0,cb:H})},destroy(H,Q){O.abort(),Q(H)}}}function ne(Le){const C=Le.readable&&typeof Le.readable.read!="function"?R.wrap(Le.readable):Le.readable,x=Le.writable;let O=!!t(C),z=!!r(x),F,H,Q,ae,N;function T(Y){const ee=ae;ae=null,ee?ee(Y):Y&&N.destroy(Y)}return N=new Se({readableObjectMode:!!(C!=null&&C.readableObjectMode),writableObjectMode:!!(x!=null&&x.writableObjectMode),readable:O,writable:z}),z&&(w(x,Y=>{z=!1,Y&&A(C,Y),T(Y)}),N._write=function(Y,ee,j){x.write(Y,ee)?j():F=j},N._final=function(Y){x.end(),H=Y},x.on("drain",function(){if(F){const Y=F;F=null,Y()}}),x.on("finish",function(){if(H){const Y=H;H=null,Y()}})),O&&(w(C,Y=>{O=!1,Y&&A(C,Y),T(Y)}),C.on("readable",function(){if(Q){const Y=Q;Q=null,Y()}}),C.on("end",function(){N.push(null)}),N._read=function(){for(;;){const Y=C.read();if(Y===null){Q=N._read;return}if(!N.push(Y))return}}),N._destroy=function(Y,ee){!Y&&ae!==null&&(Y=new b),Q=null,F=null,H=null,ae===null?ee(Y):(ae=ee,A(x,Y),A(C,Y))},N}return _8}var x8,BN;function Yc(){if(BN)return x8;BN=1;const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=ma;x8=l;const i=K2(),o=G5();r(l.prototype,i.prototype),r(l,i);{const m=t(o.prototype);for(let w=0;w<m.length;w++){const b=m[w];l.prototype[b]||(l.prototype[b]=o.prototype[b])}}function l(m){if(!(this instanceof l))return new l(m);i.call(this,m),o.call(this,m),m?(this.allowHalfOpen=m.allowHalfOpen!==!1,m.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),m.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(l.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(m){this._readableState&&this._writableState&&(this._readableState.destroyed=m,this._writableState.destroyed=m)}}});let c;function p(){return c===void 0&&(c={}),c}l.fromWeb=function(m,w){return p().newStreamDuplexFromReadableWritablePair(m,w)},l.toWeb=function(m){return p().newReadableWritablePairFromDuplex(m)};let h;return l.from=function(m){return h||(h=Ase()),h(m,"body")},x8}const{ObjectSetPrototypeOf:dB,Symbol:kse}=ma;var pB=Jc;const{ERR_METHOD_NOT_IMPLEMENTED:Mse}=eo.codes,W5=Yc(),{getHighWaterMark:Tse}=W2;dB(Jc.prototype,W5.prototype);dB(Jc,W5);const pb=kse("kCallback");function Jc(n){if(!(this instanceof Jc))return new Jc(n);const e=n?Tse(this,n,"readableHighWaterMark",!0):null;e===0&&(n={...n,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:n.writableHighWaterMark||0}),W5.call(this,n),this._readableState.sync=!1,this[pb]=null,n&&(typeof n.transform=="function"&&(this._transform=n.transform),typeof n.flush=="function"&&(this._flush=n.flush)),this.on("prefinish",Rse)}function N4(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 Rse(){this._final!==N4&&N4.call(this)}Jc.prototype._final=N4;Jc.prototype._transform=function(n,e,t){throw new Mse("_transform()")};Jc.prototype._write=function(n,e,t){const r=this._readableState,i=this._writableState,o=r.length;this._transform(n,e,(l,c)=>{if(l){t(l);return}c!=null&&this.push(c),i.ended||o===r.length||r.length<r.highWaterMark?t():this[pb]=t})};Jc.prototype._read=function(){if(this[pb]){const n=this[pb];this[pb]=null,n()}};const{ObjectSetPrototypeOf:hB}=ma;var yB=tm;const K5=pB;hB(tm.prototype,K5.prototype);hB(tm,K5);function tm(n){if(!(this instanceof tm))return new tm(n);K5.call(this,n)}tm.prototype._transform=function(n,e,t){t(null,n)};const eb=$d(),{ArrayIsArray:Ose,Promise:Lse,SymbolAsyncIterator:Nse,SymbolDispose:Pse}=ma,e2=qd,{once:Ise}=xs,Dse=wm,zN=Yc(),{aggregateTwoErrors:Use,codes:{ERR_INVALID_ARG_TYPE:P4,ERR_INVALID_RETURN_VALUE:S8,ERR_MISSING_ARGS:Fse,ERR_STREAM_DESTROYED:Bse,ERR_STREAM_PREMATURE_CLOSE:zse},AbortError:jse}=eo,{validateFunction:Hse,validateAbortSignal:$se}=Wb,{isIterable:Xp,isReadable:C8,isReadableNodeStream:Px,isNodeStream:jN,isTransformStream:Iy,isWebStream:qse,isReadableStream:E8,isReadableFinished:Vse}=ef,Gse=globalThis.AbortController||Tb().AbortController;let A8,k8,M8;function HN(n,e,t){let r=!1;n.on("close",()=>{r=!0});const i=e2(n,{readable:e,writable:t},o=>{r=!o});return{destroy:o=>{r||(r=!0,Dse.destroyer(n,o||new Bse("pipe")))},cleanup:i}}function Wse(n){return Hse(n[n.length-1],"streams[stream.length - 1]"),n.pop()}function T8(n){if(Xp(n))return n;if(Px(n))return Kse(n);throw new P4("val",["Readable","Iterable","AsyncIterable"],n)}async function*Kse(n){k8||(k8=K2()),yield*k8.prototype[Nse].call(n)}async function gx(n,e,t,{end:r}){let i,o=null;const l=h=>{if(h&&(i=h),o){const m=o;o=null,m()}},c=()=>new Lse((h,m)=>{i?m(i):o=()=>{i?m(i):h()}});e.on("drain",l);const p=e2(e,{readable:!1},l);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?Use(i,h):h)}finally{p(),e.off("drain",l)}}async function R8(n,e,t,{end:r}){Iy(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(l){t(l)}}}function Yse(...n){return mB(n,Ise(Wse(n)))}function mB(n,e,t){if(n.length===1&&Ose(n[0])&&(n=n[0]),n.length<2)throw new Fse("streams");const r=new Gse,i=r.signal,o=t==null?void 0:t.signal,l=[];$se(o,"options.signal");function c(){S(new jse)}M8=M8||xs.addAbortListener;let p;o&&(p=M8(o,c));let h,m;const w=[];let b=0;function g(L){S(L,--b===0)}function S(L,I){var q;if(L&&(!h||h.code==="ERR_STREAM_PREMATURE_CLOSE")&&(h=L),!(!h&&!I)){for(;w.length;)w.shift()(h);(q=p)===null||q===void 0||q[Pse](),r.abort(),I&&(h||l.forEach(G=>G()),eb.nextTick(e,h,m))}}let A;for(let L=0;L<n.length;L++){const I=n[L],q=L<n.length-1,G=L>0,de=q||(t==null?void 0:t.end)!==!1,oe=L===n.length-1;if(jN(I)){let ye=function(Se){Se&&Se.name!=="AbortError"&&Se.code!=="ERR_STREAM_PREMATURE_CLOSE"&&g(Se)};if(de){const{destroy:Se,cleanup:Ce}=HN(I,q,G);w.push(Se),C8(I)&&oe&&l.push(Ce)}I.on("error",ye),C8(I)&&oe&&l.push(()=>{I.removeListener("error",ye)})}if(L===0)if(typeof I=="function"){if(A=I({signal:i}),!Xp(A))throw new S8("Iterable, AsyncIterable or Stream","source",A)}else Xp(I)||Px(I)||Iy(I)?A=I:A=zN.from(I);else if(typeof I=="function"){if(Iy(A)){var k;A=T8((k=A)===null||k===void 0?void 0:k.readable)}else A=T8(A);if(A=I(A,{signal:i}),q){if(!Xp(A,!0))throw new S8("AsyncIterable",`transform[${L-1}]`,A)}else{var R;A8||(A8=yB);const ye=new A8({objectMode:!0}),Se=(R=A)===null||R===void 0?void 0:R.then;if(typeof Se=="function")b++,Se.call(A,Le=>{m=Le,Le!=null&&ye.write(Le),de&&ye.end(),eb.nextTick(g)},Le=>{ye.destroy(Le),eb.nextTick(g,Le)});else if(Xp(A,!0))b++,gx(A,ye,g,{end:de});else if(E8(A)||Iy(A)){const Le=A.readable||A;b++,gx(Le,ye,g,{end:de})}else throw new S8("AsyncIterable or Promise","destination",A);A=ye;const{destroy:Ce,cleanup:ne}=HN(A,!1,!0);w.push(Ce),oe&&l.push(ne)}}else if(jN(I)){if(Px(A)){b+=2;const ye=Jse(A,I,g,{end:de});C8(I)&&oe&&l.push(ye)}else if(Iy(A)||E8(A)){const ye=A.readable||A;b++,gx(ye,I,g,{end:de})}else if(Xp(A))b++,gx(A,I,g,{end:de});else throw new P4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else if(qse(I)){if(Px(A))b++,R8(T8(A),I,g,{end:de});else if(E8(A)||Xp(A))b++,R8(A,I,g,{end:de});else if(Iy(A))b++,R8(A.readable,I,g,{end:de});else throw new P4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else A=zN.from(I)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&eb.nextTick(c),A}function Jse(n,e,t,{end:r}){let i=!1;if(e.on("close",()=>{i||t(new zse)}),n.pipe(e,{end:!1}),r){let o=function(){i=!0,e.end()};Vse(n)?eb.nextTick(o):n.once("end",o)}else t();return e2(n,{readable:!0,writable:!1},o=>{const l=n._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?n.once("end",t).once("error",t):t(o)}),e2(e,{readable:!1,writable:!0},t)}var Y5={pipelineImpl:mB,pipeline:Yse};const{pipeline:Qse}=Y5,vx=Yc(),{destroyer:Zse}=wm,{isNodeStream:bx,isReadable:$N,isWritable:qN,isWebStream:O8,isTransformStream:Jp,isWritableStream:VN,isReadableStream:GN}=ef,{AbortError:Xse,codes:{ERR_INVALID_ARG_VALUE:WN,ERR_MISSING_ARGS:eoe}}=eo,toe=qd;var gB=function(...e){if(e.length===0)throw new eoe("streams");if(e.length===1)return vx.from(e[0]);const t=[...e];if(typeof e[0]=="function"&&(e[0]=vx.from(e[0])),typeof e[e.length-1]=="function"){const g=e.length-1;e[g]=vx.from(e[g])}for(let g=0;g<e.length;++g)if(!(!bx(e[g])&&!O8(e[g]))){if(g<e.length-1&&!($N(e[g])||GN(e[g])||Jp(e[g])))throw new WN(`streams[${g}]`,t[g],"must be readable");if(g>0&&!(qN(e[g])||VN(e[g])||Jp(e[g])))throw new WN(`streams[${g}]`,t[g],"must be writable")}let r,i,o,l,c;function p(g){const S=l;l=null,S?S(g):g?c.destroy(g):!b&&!w&&c.destroy()}const h=e[0],m=Qse(e,p),w=!!(qN(h)||VN(h)||Jp(h)),b=!!($N(m)||GN(m)||Jp(m));if(c=new vx({writableObjectMode:!!(h!=null&&h.writableObjectMode),readableObjectMode:!!(m!=null&&m.readableObjectMode),writable:w,readable:b}),w){if(bx(h))c._write=function(S,A,k){h.write(S,A)?k():r=k},c._final=function(S){h.end(),i=S},h.on("drain",function(){if(r){const S=r;r=null,S()}});else if(O8(h)){const A=(Jp(h)?h.writable:h).getWriter();c._write=async function(k,R,L){try{await A.ready,A.write(k).catch(()=>{}),L()}catch(I){L(I)}},c._final=async function(k){try{await A.ready,A.close().catch(()=>{}),i=k}catch(R){k(R)}}}const g=Jp(m)?m.readable:m;toe(g,()=>{if(i){const S=i;i=null,S()}})}if(b){if(bx(m))m.on("readable",function(){if(o){const g=o;o=null,g()}}),m.on("end",function(){c.push(null)}),c._read=function(){for(;;){const g=m.read();if(g===null){o=c._read;return}if(!c.push(g))return}};else if(O8(m)){const S=(Jp(m)?m.readable:m).getReader();c._read=async function(){for(;;)try{const{value:A,done:k}=await S.read();if(!c.push(A))return;if(k){c.push(null);return}}catch{return}}}}return c._destroy=function(g,S){!g&&l!==null&&(g=new Xse),o=null,r=null,i=null,l===null?S(g):(l=S,bx(m)&&Zse(m,g))},c};const noe=globalThis.AbortController||Tb().AbortController,{codes:{ERR_INVALID_ARG_VALUE:roe,ERR_INVALID_ARG_TYPE:Yb,ERR_MISSING_ARGS:aoe,ERR_OUT_OF_RANGE:ioe},AbortError:Wu}=eo,{validateAbortSignal:Rh,validateInteger:KN,validateObject:Oh}=Wb,soe=ma.Symbol("kWeak"),ooe=ma.Symbol("kResistStopPropagation"),{finished:loe}=qd,uoe=gB,{addAbortSignalNoValidate:coe}=G2,{isWritable:foe,isNodeStream:doe}=ef,{deprecate:poe}=xs,{ArrayPrototypePush:hoe,Boolean:yoe,MathFloor:YN,Number:moe,NumberIsNaN:goe,Promise:JN,PromiseReject:QN,PromiseResolve:voe,PromisePrototypeThen:ZN,Symbol:vB}=ma,t2=vB("kEmpty"),XN=vB("kEof");function boe(n,e){if(e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal"),doe(n)&&!foe(n))throw new roe("stream",n,"must be writable");const t=uoe(this,n);return e!=null&&e.signal&&coe(e.signal,t),t}function Y2(n,e){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal");let t=1;(e==null?void 0:e.concurrency)!=null&&(t=YN(e.concurrency));let r=t-1;return(e==null?void 0:e.highWaterMark)!=null&&(r=YN(e.highWaterMark)),KN(t,"options.concurrency",1),KN(r,"options.highWaterMark",0),r+=t,(async function*(){const o=xs.AbortSignalAny([e==null?void 0:e.signal].filter(yoe)),l=this,c=[],p={signal:o};let h,m,w=!1,b=0;function g(){w=!0,S()}function S(){b-=1,A()}function A(){m&&!w&&b<t&&c.length<r&&(m(),m=null)}async function k(){try{for await(let R of l){if(w)return;if(o.aborted)throw new Wu;try{if(R=n(R,p),R===t2)continue;R=voe(R)}catch(L){R=QN(L)}b+=1,ZN(R,S,g),c.push(R),h&&(h(),h=null),!w&&(c.length>=r||b>=t)&&await new JN(L=>{m=L})}c.push(XN)}catch(R){const L=QN(R);ZN(L,S,g),c.push(L)}finally{w=!0,h&&(h(),h=null)}}k();try{for(;;){for(;c.length>0;){const R=await c[0];if(R===XN)return;if(o.aborted)throw new Wu;R!==t2&&(yield R),c.shift(),A()}await new JN(R=>{h=R})}}finally{w=!0,m&&(m(),m=null)}}).call(this)}function woe(n=void 0){return n!=null&&Oh(n,"options"),(n==null?void 0:n.signal)!=null&&Rh(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 Wu({cause:n.signal.reason});yield[t++,i]}}).call(this)}async function bB(n,e=void 0){for await(const t of J5.call(this,n,e))return!0;return!1}async function _oe(n,e=void 0){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);return!await bB.call(this,async(...t)=>!await n(...t),e)}async function xoe(n,e){for await(const t of J5.call(this,n,e))return t}async function Soe(n,e){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i),t2}for await(const r of Y2.call(this,t,e));}function J5(n,e){if(typeof n!="function")throw new Yb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i)?r:t2}return Y2.call(this,t,e)}class Coe extends aoe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Eoe(n,e,t){var r;if(typeof n!="function")throw new Yb("reducer",["Function","AsyncFunction"],n);t!=null&&Oh(t,"options"),(t==null?void 0:t.signal)!=null&&Rh(t.signal,"options.signal");let i=arguments.length>1;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted){const h=new Wu(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await loe(this.destroy(h)),h}const o=new noe,l=o.signal;if(t!=null&&t.signal){const h={once:!0,[soe]:this,[ooe]:!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 Wu;i?e=await n(e,h,{signal:l}):(e=h,i=!0)}if(!c&&!i)throw new Coe}finally{o.abort()}return e}async function Aoe(n){n!=null&&Oh(n,"options"),(n==null?void 0:n.signal)!=null&&Rh(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 Wu(void 0,{cause:n.signal.reason});hoe(e,r)}return e}function koe(n,e){const t=Y2.call(this,n,e);return(async function*(){for await(const i of t)yield*i}).call(this)}function wB(n){if(n=moe(n),goe(n))return 0;if(n<0)throw new ioe("number",">= 0",n);return n}function Moe(n,e=void 0){return e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal"),n=wB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Wu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Wu;n--<=0&&(yield o)}}).call(this)}function Toe(n,e=void 0){return e!=null&&Oh(e,"options"),(e==null?void 0:e.signal)!=null&&Rh(e.signal,"options.signal"),n=wB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Wu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Wu;if(n-- >0&&(yield o),n<=0)return}}).call(this)}F5.streamReturningOperators={asIndexedPairs:poe(woe,"readable.asIndexedPairs will be removed in a future version."),drop:Moe,filter:J5,flatMap:koe,map:Y2,take:Toe,compose:boe};F5.promiseReturningOperators={every:_oe,forEach:Soe,reduce:Eoe,toArray:Aoe,some:bB,find:xoe};var L8,eP;function _B(){if(eP)return L8;eP=1;const{ArrayPrototypePop:n,Promise:e}=ma,{isIterable:t,isNodeStream:r,isWebStream:i}=ef,{pipelineImpl:o}=Y5,{finished:l}=qd;xB();function c(...p){return new e((h,m)=>{let w,b;const g=p[p.length-1];if(g&&typeof g=="object"&&!r(g)&&!t(g)&&!i(g)){const S=n(p);w=S.signal,b=S.end}o(p,(S,A)=>{S?m(S):h(A)},{signal:w,end:b})})}return L8={finished:l,pipeline:c},L8}var tP;function xB(){if(tP)return p8.exports;tP=1;const{Buffer:n}=Hd,{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=ma,{promisify:{custom:i}}=xs,{streamReturningOperators:o,promiseReturningOperators:l}=F5,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=eo,p=gB,{setDefaultHighWaterMark:h,getDefaultHighWaterMark:m}=W2,{pipeline:w}=Y5,{destroyer:b}=wm,g=qd,S=_B(),A=ef,k=p8.exports=$5.Stream;k.isDestroyed=A.isDestroyed,k.isDisturbed=A.isDisturbed,k.isErrored=A.isErrored,k.isReadable=A.isReadable,k.isWritable=A.isWritable,k.Readable=K2();for(const L of t(o)){let q=function(...G){if(new.target)throw c();return k.Readable.from(r(I,this,G))};const I=o[L];e(q,"name",{__proto__:null,value:I.name}),e(q,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,L,{__proto__:null,value:q,enumerable:!1,configurable:!0,writable:!0})}for(const L of t(l)){let q=function(...G){if(new.target)throw c();return r(I,this,G)};const I=l[L];e(q,"name",{__proto__:null,value:I.name}),e(q,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,L,{__proto__:null,value:q,enumerable:!1,configurable:!0,writable:!0})}k.Writable=G5(),k.Duplex=Yc(),k.Transform=pB,k.PassThrough=yB,k.pipeline=w;const{addAbortSignal:R}=G2;return k.addAbortSignal=R,k.finished=g,k.destroy=b,k.compose=p,k.setDefaultHighWaterMark=h,k.getDefaultHighWaterMark=m,e(k,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return S}}),e(w,i,{__proto__:null,enumerable:!0,get(){return S.pipeline}}),e(g,i,{__proto__:null,enumerable:!0,get(){return S.finished}}),k.Stream=k,k._isUint8Array=function(I){return I instanceof Uint8Array},k._uint8ArrayToBuffer=function(I){return n.from(I.buffer,I.byteOffset,I.byteLength)},p8.exports}(function(n){const e=xB(),t=_B(),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})(CF);var Roe=CF.exports;typeof globalThis.Buffer>"u"&&(globalThis.Buffer=Lb().Buffer);const Ty=oU,nP=Roe,Ooe=ki;globalThis.process||(globalThis.process=$d());if(typeof crypto>"u"){const n=p2;n.getRandomValues=e=>n.randomBytes(e.length),globalThis.crypto=n}const ii={ElvCrypto:async()=>{try{if(!ii.elvCrypto){const n=(await Promise.resolve().then(()=>require("./index-BjTBtYwL.js"))).default;ii.elvCrypto=await new n().init()}return ii.elvCrypto}catch(n){console.error("Error initializing ElvCrypto:"),console.error(n)}},EncryptedSize:n=>{const t=Math.floor(n/1e6);let r=ii.EncryptedBlockSize(1e6),i=t*r;return n%1e6!==0&&(i+=ii.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 ii.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),l=Buffer.concat([Buffer.from(i),Buffer.from(o),Buffer.from(r)]);return Ooe.B64(l)},async DecryptCap(n,e){const t=await ii.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),l=t.decryptECIES(new Uint8Array(o),e,new Uint8Array(r),new Uint8Array(i));return JSON.parse(Buffer.from(l).toString())},async GeneratePrimaryConk({spaceId:n,objectId:e}){const t=await ii.ElvCrypto(),{secretKey:r,publicKey:i}=t.generatePrimaryKeys(),o=t.generateSymmetricKey().key;return{symm_key:`kpsy${Ty.encode(Buffer.from(o))}`,secret_key:`kpsk${Ty.encode(Buffer.from(r))}`,public_key:`kppk${Ty.encode(Buffer.from(i))}`,sid:n,qid:e}},async GenerateTargetConk(){const n=await ii.ElvCrypto(),{secretKey:e,publicKey:t}=n.generateTargetKeys();return{secret_key:`kpsk${Ty.encode(Buffer.from(e))}`,public_key:`ktpk${Ty.encode(Buffer.from(t))}`}},CapToConk(n){const e=t=>new Uint8Array(Ty.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 ii.ElvCrypto(),{symmetricKey:t,secretKey:r,publicKey:i}=ii.CapToConk(n);let o,l;return i.length===e.PRIMARY_PK_KEY_SIZE?(l=e.CRYPTO_TYPE_PRIMARY,o=e.newPrimaryContext(i,r,t)):(l=e.CRYPTO_TYPE_TARGET,o=e.newTargetDecryptionContext(r,t)),{context:o,type:l}},Encrypt:async(n,e)=>{const t=await ii.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 l=Math.min(r.length,o+1e6);t.write(r.slice(o,l))}t.end();let i=[];return await new Promise((o,l)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{l(c)})}),Buffer.concat(i)},OpenEncryptionStream:async n=>{const e=await ii.ElvCrypto(),{context:t}=await ii.EncryptionContext(n),r=new nP.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 ii.OpenDecryptionStream(n),r=new Uint8Array(e);for(let o=0;o<r.length;o+=1e6){const l=Math.min(r.length,o+1e6);t.write(r.slice(o,l))}t.end();let i=[];return await new Promise((o,l)=>{t.on("data",c=>{i.push(c)}).on("finish",()=>{o()}).on("error",c=>{l(c)})}),Buffer.concat(i)},OpenDecryptionStream:async n=>{const e=await ii.ElvCrypto(),{context:t,type:r}=await ii.EncryptionContext(n),i=new nP.PassThrough,o=e.createDecipher(r,t);return i.pipe(o).on("finish",()=>{t.free()}).on("error",l=>{throw Error(l)})}};var SB=ii,Zr={},rP;function CB(){if(rP)return Zr;rP=1;const n=ki;let e;n.Platform()===n.PLATFORM_NODE&&(globalThis.Response=S5().Response,e=p2);const t=_s,{ValidatePresence:r,ValidateWriteToken:i,ValidatePartHash:o,ValidateParameters:l}=Ko;return Zr.ListFiles=async function({libraryId:c,objectId:p,path:h="",versionHash:m,writeToken:w}){l({libraryId:c,objectId:p,versionHash:m,writeToken:w}),m&&(p=this.utils.DecodeVersionHash(m).objectId);let b=t("q",w||m||p,"files_list",h);return this.HttpClient.RequestJsonBody({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:m}),method:"GET",path:b})},Zr.UploadFilesFromS3=async function({libraryId:c,objectId:p,writeToken:h,region:m,bucket:w,fileInfo:b,accessKey:g,secret:S,signedUrl:A,encryption:k="none",copy:R=!1,callback:L}){l({libraryId:c,objectId:p}),i(h);const I=/^s3:\/\/([^/]+)\//i;for(let Se=0;Se<b.length;Se++){const Ce=b[Se].source,ne=I.exec(Ce);if(ne){if(ne[1]!==w)throw Error('Full S3 file path "'+Ce+`" specified, but does not match provided bucket name '`+w+"'");b[Se].source=Ce.replace(I,"")}}R?this.Log(`Copying files from S3: ${c} ${p} ${h}`):this.Log(`Adding links to files in S3: ${c} ${p} ${h}`);let q;if(k==="cgck"){let Se=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});Se={...Se,secret_key:""},q=`kp__${this.utils.B58(Buffer.from(JSON.stringify(Se)))}`}let G={access_key_id:g,secret_access_key:S};A&&(G={signed_url:A});const de={encryption_key:q,access:{protocol:"s3",platform:"aws",path:w,storage_endpoint:{region:m},cloud_credentials:G}},oe=b.map(Se=>R?{op:"ingest-copy",path:Se.path,encryption:{scheme:k==="cgck"?"cgck":"none"},ingest:{type:"key",path:Se.source}}:{op:"add-reference",path:Se.path,reference:{type:"key",path:Se.source}}),{id:ye}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:oe,defaults:de});for(;;){await new Promise(ne=>setTimeout(ne,1e3));const Se=await this.UploadStatus({libraryId:c,objectId:p,writeToken:h,uploadId:ye});if(Se.errors&&Se.errors.length>1)throw Se.errors.join(`
|
|
327
327
|
`);if(Se.error)throw this.Log(`S3 file upload failed:
|
|
328
328
|
${JSON.stringify(Se,null,2)}`),Se.error;if(Se.status.toLowerCase()==="failed")throw"File upload failed";let Ce=!1;if(R){if(Ce=Se.ingest_copy.done,L){const ne=Se.ingest_copy.progress;L({done:Ce,uploaded:ne.bytes.completed,total:ne.bytes.total,uploadedFiles:ne.files.completed,totalFiles:ne.files.total,fileStatus:ne.files.details})}}else if(Ce=Se.add_reference.done,L){const ne=Se.add_reference.progress;L({done:Ce,uploadedFiles:ne.completed,totalFiles:ne.total})}if(Ce)break}},Zr.UploadFiles=async function({libraryId:c,objectId:p,writeToken:h,fileInfo:m,encryption:w="none",callback:b}){l({libraryId:c,objectId:p}),i(h),r("fileInfo",m),this.Log(`Uploading files: ${c} ${p} ${h}`);let g;w==="cgck"&&(g=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h}));let S={},A={},k=m;m=[];for(let C=0;C<k.length;C++){let x={...k[C],data:void 0};x.path=x.path.replace(/^\/+/,""),w==="cgck"&&(x.encryption={scheme:"cgck"}),A[x.path]=k[C].data,x.type="file",S[x.path]={uploaded:0,total:x.size},m.push(x)}this.Log(m),b&&b(S);const{id:R,jobs:L}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:m,encryption:w});this.Log(`Upload ID: ${R}`),this.Log(L);const I=500*1024*1024;let q=[],G=0,de=0;const oe=async()=>{for(let C=0;C<L.length;C++){for(;G-de>I;)await new Promise(z=>setTimeout(z,500));const x=L[C];let O=await this.UploadJobStatus({libraryId:c,objectId:p,writeToken:h,uploadId:R,jobId:x});for(let z=0;z<O.files.length;z++){const F=O.files[z];let H;typeof A[F.path]=="number"?(H=Buffer.alloc(F.len),e.readSync(A[F.path],H,0,F.len,F.off)):H=A[F.path].slice(F.off,F.off+F.len),w==="cgck"&&(H=await this.Crypto.Encrypt(g,H)),O.files[z].data=H,G+=F.len}q[C]=O,await new Promise(z=>setTimeout(z,50))}},ye=async(C,x)=>{for(;!q[x];)await new Promise(F=>setTimeout(F,500));const z=q[x].files;for(let F=0;F<z.length;F++){const H=z[F];let Q=0,ae=!1;do try{await this.UploadFileData({libraryId:c,objectId:p,writeToken:h,uploadId:R,jobId:C,filePath:H.path,fileData:H.data,encryption:w}),ae=!0}catch(N){if(this.Log(N,!0),Q+=1,Q>=10)throw N;await new Promise(T=>setTimeout(T,10*Q*1e3))}while(!ae&&Q<10);delete q[x].files[F].data,de+=H.len,b&&(S[H.path]={...S[H.path],uploaded:S[H.path].uploaded+H.len},b(S))}};oe().catch(C=>{throw C});const Se=Math.min(3,L.length);let Ce=[];for(let C=0;C<Se;C++){const x=new Date().getTime();await ye(L[C],C);const O=(new Date().getTime()-x)/1e3,z=q[C].files.map(F=>F.len).reduce((F,H)=>F+H,0);Ce.push(z/O/(1024*1024))}const ne=Ce.reduce((C,x)=>C+x,0)/Se,Le=Math.min(5,Math.ceil(ne/2));await this.utils.LimitedMap(Le,L,async(C,x)=>{x<Se||await ye(C,x)})},Zr.CreateFileUploadJob=async function({libraryId:c,objectId:p,writeToken:h,ops:m,defaults:w={},encryption:b="none"}){l({libraryId:c,objectId:p}),i(h),this.Log(`Creating file upload job: ${c} ${p} ${h}`),this.Log(m),b==="cgck"&&(w.encryption={scheme:"cgck"});const g={seq:0,seq_complete:!0,defaults:w,ops:m},S=t("q",h,"file_jobs");return this.HttpClient.RequestJsonBody({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:b}),method:"POST",path:S,body:g,allowFailover:!1})},Zr.UploadStatus=async function({libraryId:c,objectId:p,writeToken:h,uploadId:m}){l({libraryId:c,objectId:p}),i(h);const w=t("q",h,"file_jobs",m);return this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"GET",path:w,allowFailover:!1}))},Zr.UploadJobStatus=async function({libraryId:c,objectId:p,writeToken:h,uploadId:m,jobId:w}){l({libraryId:c,objectId:p}),i(h);const b=t("q",h,"file_jobs",m,"uploads",w);let g=await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"GET",path:b,allowFailover:!1,queryParams:{start:0,limit:1e4}}));for(;g.next!==g.total&&g.next>=0;){const S=await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"GET",path:b,allowFailover:!1,queryParams:{start:g.next}}));g.files=[...g.files,...S.files],g.next=S.next}return g},Zr.UploadFileData=async function({libraryId:c,objectId:p,writeToken:h,encryption:m,uploadId:w,jobId:b,filePath:g,fileData:S}){l({libraryId:c,objectId:p}),i(h);let k=(await this.UploadJobStatus({libraryId:c,objectId:p,writeToken:h,uploadId:w,jobId:b})).files.find(L=>L.path===g);if(m&&m!=="none"&&(k=k.encrypted),k.rem===0)return;k.skip&&(S=S.slice(k.skip));let R=t("q",h,"file_jobs",w,b);return await this.utils.ResponseToJson(this.HttpClient.Request({method:"POST",path:R,body:S,bodyType:"BINARY",headers:{"Content-type":"application/octet-stream",...await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0})},allowFailover:!1,allowRetry:!1}))},Zr.FinalizeUploadJob=async function({libraryId:c,objectId:p,writeToken:h}){l({libraryId:c,objectId:p}),i(h),this.Log(`Finalizing upload job: ${c} ${p} ${h}`);const m=t("q",h,"files");await this.HttpClient.Request({method:"POST",path:m,bodyType:"BINARY",headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),allowFailover:!1})},Zr.CreateFileDirectories=async function({libraryId:c,objectId:p,writeToken:h,filePaths:m}){l({libraryId:c,objectId:p}),i(h),this.Log(`Creating Directories: ${c} ${p} ${h}`),this.Log(m);const w=m.map(b=>({op:"add",type:"directory",path:b}));await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:w})},Zr.MoveFiles=async function({libraryId:c,objectId:p,writeToken:h,filePaths:m}){l({libraryId:c,objectId:p}),i(h),this.Log(`Moving Files: ${c} ${p} ${h}`),this.Log(m);const w=m.map(({path:b,to:g})=>({op:"move",copy_move_source_path:b,path:g}));await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:w})},Zr.DeleteFiles=async function({libraryId:c,objectId:p,writeToken:h,filePaths:m}){l({libraryId:c,objectId:p}),i(h),this.Log(`Deleting Files: ${c} ${p} ${h}`),this.Log(m);const w=m.map(b=>({op:"del",path:b}));await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:w})},Zr.DownloadFile=async function({libraryId:c,objectId:p,versionHash:h,writeToken:m,filePath:w,format:b="arrayBuffer",chunked:g=!1,chunkSize:S,clientSideDecryption:A=!1,callback:k}){l({libraryId:c,objectId:p,versionHash:h}),r("filePath",w),h&&(p=this.utils.DecodeVersionHash(h).objectId);const R=await this.ContentObjectMetadata({libraryId:c,objectId:p,versionHash:h,writeToken:m,metadataSubtree:t("files",w)}),L=R&&R["."].encryption&&R["."].encryption.scheme==="cgck",I=L?"cgck":void 0,q=L&&!A?t("q",m||h||p,"rep","files_download",w):t("q",m||h||p,"files",w),G=await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h,encryption:I,makeAccessRequest:I==="cgck"});G.Accept="*/*";const de=`eluv.caps.iusr${this.utils.AddressToHash(this.signer.address)}`,oe=await this.ContentObjectMetadata({libraryId:c,objectId:p,versionHash:h,metadataSubtree:de});L&&!this.utils.EqualAddress(this.signer.address,await this.ContentObjectOwner({objectId:p}))&&!oe&&(G["X-Content-Fabric-Decryption-Mode"]="reencrypt"),L&&!A&&(G["X-Content-Fabric-Decryption-Mode"]="decrypt",S=Number.MAX_SAFE_INTEGER);const ye=R["."].size;if(L&&A)return await this.DownloadEncrypted({conk:await this.EncryptionConk({libraryId:c,objectId:p,versionHash:h,download:!0}),downloadPath:q,bytesTotal:ye,headers:G,callback:k,format:b,clientSideDecryption:A,chunked:g});S||(S=1e7);try{return await this.Download({downloadPath:q,bytesTotal:ye,headers:G,callback:k,format:b,chunked:g,chunkSize:S})}catch(Se){if(L&&!A)return this.DownloadFile({...arguments[0],clientSideDecryption:!0});throw Se}},Zr.ContentParts=async function({libraryId:c,objectId:p,versionHash:h}){l({libraryId:c,objectId:p,versionHash:h}),this.Log(`Retrieving parts: ${c} ${p||h}`),h&&(p=this.utils.DecodeVersionHash(h).objectId);const m=t("q",h||p,"parts");return(await this.HttpClient.RequestJsonBody({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h}),method:"GET",path:m})).parts},Zr.ContentPart=async function({libraryId:c,objectId:p,versionHash:h,partHash:m}){l({libraryId:c,objectId:p,versionHash:h}),o(m),this.Log(`Retrieving part: ${c} ${p||h} ${m}`),h&&(p=this.utils.DecodeVersionHash(h).objectId);let w=t("q",h||p,"parts",m);return await this.HttpClient.RequestJsonBody({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h}),method:"GET",path:w})},Zr.DownloadPart=async function({libraryId:c,objectId:p,versionHash:h,writeToken:m,partHash:w,format:b="arrayBuffer",chunked:g=!1,chunkSize:S=1e7,callback:A}){l({libraryId:c,objectId:p,versionHash:h}),o(w),h&&(p=this.utils.DecodeVersionHash(h).objectId);const k=w.startsWith("hqpe"),R=k?"cgck":void 0,L=t("q",m||h||p,"data",w);let I=await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h,encryption:R,makeAccessRequest:!0});const q=(await this.ContentPart({libraryId:c,objectId:p,versionHash:h,partHash:w})).part.size;return k?(this.utils.EqualAddress(this.signer.address,await this.ContentObjectOwner({objectId:p}))||(I["X-Content-Fabric-Decryption-Mode"]="reencrypt"),await this.DownloadEncrypted({conk:await this.EncryptionConk({libraryId:c,objectId:p,download:!0}),downloadPath:L,bytesTotal:q,headers:I,callback:A,format:b,chunked:g})):await this.Download({downloadPath:L,bytesTotal:q,headers:I,callback:A,format:b,chunked:g,chunkSize:S})},Zr.Download=async function({downloadPath:c,headers:p,bytesTotal:h,chunked:m=!1,chunkSize:w=2e6,callback:b,format:g="arrayBuffer"}){if(m&&!b)throw Error("No callback specified for chunked download");let S;m||(S=[]);let A=0;const k=Math.ceil(h/w);for(let R=0;R<k;R++){p.Range=`bytes=${A}-${A+w-1}`;const L=await this.HttpClient.Request({path:c,headers:p,method:"GET"});A=Math.min(A+w,h),m?b({bytesFinished:A,bytesTotal:h,chunk:await this.utils.ResponseToFormat(g,L)}):(S.push(Buffer.from(await L.arrayBuffer())),b&&b({bytesFinished:A,bytesTotal:h}))}if(!m)return await this.utils.ResponseToFormat(g,new Response(Buffer.concat(S)))},Zr.DownloadEncrypted=async function({conk:c,downloadPath:p,bytesTotal:h,headers:m,callback:w,format:b="arrayBuffer",chunked:g=!1}){if(g&&!w)throw Error("No callback specified for chunked download");const S=c.public_key.startsWith("ktpk"),A=this.Crypto.EncryptedBlockSize(1e6,S);let k=0;b=b.toLowerCase();let R=[];const L=await this.Crypto.OpenDecryptionStream(c);L.on("data",async q=>{if(g){if(b!=="buffer"){const G=q.buffer.slice(q.byteOffset,q.byteOffset+q.byteLength);b==="arraybuffer"?q=G:q=await this.utils.ResponseToFormat(b,new Response(G))}w({bytesFinished:k,bytesTotal:h,chunk:q})}else w&&w({bytesFinished:k,bytesTotal:h}),R.push(q)});const I=Math.ceil(h/A);for(let q=0;q<I;q++){m.Range=`bytes=${k}-${k+A-1}`;const G=await this.HttpClient.Request({headers:m,method:"GET",path:p});k=Math.min(k+A,h),L.write(new Uint8Array(await G.arrayBuffer()))}if(L.end(),await new Promise(q=>L.on("finish",()=>{q()})),!g)return await this.utils.ResponseToFormat(b,new Response(Buffer.concat(R)))},Zr.CreatePart=async function({libraryId:c,objectId:p,writeToken:h,encryption:m}){l({libraryId:c,objectId:p}),i(h);const w=t("q",h,"parts");return(await this.HttpClient.RequestJsonBody({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:m}),method:"POST",path:w,bodyType:"BINARY",body:"",allowFailover:!1})).part.write_token},Zr.UploadPartChunk=async function({libraryId:c,objectId:p,writeToken:h,partWriteToken:m,chunk:w,encryption:b}){if(l({libraryId:c,objectId:p}),i(h),b&&b!=="none"){const S=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});w=await this.Crypto.Encrypt(S,w)}const g=t("q",h,"parts");await this.utils.ResponseToJson(this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:b}),method:"POST",path:t(g,m),body:w,bodyType:"BINARY",allowFailover:!1}))},Zr.FinalizePart=async function({libraryId:c,objectId:p,writeToken:h,partWriteToken:m,encryption:w}){l({libraryId:c,objectId:p}),i(h);const b=t("q",h,"parts");return await this.HttpClient.RequestJsonBody({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0,encryption:w}),method:"POST",path:t(b,m),bodyType:"BINARY",body:"",allowFailover:!1})},Zr.UploadPart=async function({libraryId:c,objectId:p,writeToken:h,data:m,encryption:w="none",chunkSize:b=1e7,callback:g}){l({libraryId:c,objectId:p}),i(h);const S=await this.CreatePart({libraryId:c,objectId:p,writeToken:h,encryption:w}),A=m.length||m.byteLength||m.size;g&&g({bytesFinished:0,bytesTotal:A});for(let k=0;k<A;k+=b){const R=m.slice(k,k+b);await this.UploadPartChunk({libraryId:c,objectId:p,writeToken:h,partWriteToken:S,chunk:R,encryption:w}),g&&g({bytesFinished:Math.min(k+b,A),bytesTotal:A})}return await this.FinalizePart({libraryId:c,objectId:p,writeToken:h,partWriteToken:S,encryption:w})},Zr.DeletePart=async function({libraryId:c,objectId:p,writeToken:h,partHash:m}){l({libraryId:c,objectId:p}),i(h),o(m);let w=t("q",h,"parts",m);await this.HttpClient.Request({headers:await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,update:!0}),method:"DELETE",path:w,allowFailover:!1})},Zr}const aP=Ene,Loe=ki,Noe=SF().permissionLevels,{LogMessage:Poe}=fm,Ioe=SB;let EB=class I4{Log(e,t=!1){Poe(this,e,t)}constructor({target:e,timeout:t=30}={}){this.permissionLevels=Noe,!e&&typeof window<"u"&&window.parent&&(e=window.parent),this.target=e,this.timeout=t,this.utils=Loe,this.Crypto=Ioe,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:I4.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=l=>t({type:"ElvFrameResponse",requestId:e.callbackId,response:l})),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=aP.next();let o;if(t&&(o=aP.next()),this.target.postMessage({...e,type:"ElvFrameRequest",requestId:i,callbackId:o},"*"),r)return;const l=e.calledMethod||e.operation,c=I4.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,l)}async AwaitMessage(e,t,r,i,o){return await new Promise((l,c)=>{let p,h;const m=()=>{h&&clearTimeout(h),t>0&&(h=setTimeout(()=>{typeof window<"u"&&(window.removeEventListener("message",p),w&&window.removeEventListener("message",w)),c(`Request ${e} timed out (${o})`)},t*1e3))};let w;i&&(w=b=>{try{m();const g=b.data;if(g.type!=="ElvFrameResponse"||g.requestId!==i)return;r(g.response)}catch(g){console.error(g)}},window.addEventListener("message",w)),p=async b=>{try{const g=b.data;if(g.type!=="ElvFrameResponse"||g.requestId!==e)return;clearTimeout(h),window.removeEventListener("message",p),w&&window.removeEventListener("message",w),g.error?c(g.error):l(g.response)}catch(g){clearTimeout(h),window.removeEventListener("message",p),w&&window.removeEventListener("message",w),c(g)}},m(),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","AuditContentObject","AuditStream","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","DeleteWriteToken","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","MakeFileServiceRequest","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","StreamAddWatermark","StreamConfig","StreamCopyToVod","StreamCreate","StreamInitialize","StreamInsertion","StreamListUrls","StreamRemoveWatermark","StreamStatus","StreamStartOrStopOrReset","StreamStopSession","SuspendNTPInstance","UnlinkAccessGroupFromOauth","UpdateContentObjectGraph","UpdateNTPInstance","UploadFileData","UploadFilesFromS3","UploadJobStatus","UploadPart","UploadPartChunk","UploadStatus","UseRegion","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:Doe}=CB();EB.prototype.UploadFiles=Doe;eF.FrameClient=EB;const Zi=ki,N8=_s,{FrameClient:iP}=eF,{LogMessage:Uoe}=fm;let Foe=class{Log(e,t=!1){Uoe(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||Zi.EqualAddress(this.walletAddress,Zi.nullAddress)){if(this.Log(`Creating user wallet for user ${this.client.signer.address}`),await this.client.GetBalance({address:this.client.signer.address})<.05)return;const i=await this.client.CallContractMethodAndWait({contractAddress:Zi.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[Zi.FormatAddress(this.client.signer.address)]=this.walletAddress}const e=this.client.contentSpaceLibraryId,t=Zi.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:Zi.HashToAddress(this.client.contentSpaceId),methodName:"userWallets",methodArgs:[this.client.signer.address]}));const t=await this.walletAddressPromise;return Zi.EqualAddress(t,Zi.nullAddress)||(this.walletAddress=t),!this.walletAddress&&e&&await this.CreateWallet(),this.walletAddressRetrieved=!0,this.walletAddress}async UserWalletAddress({address:e}){if(Zi.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:Zi.HashToAddress(this.client.contentSpaceId),methodName:"userWallets",methodArgs:[e]});Zi.EqualAddress(t,Zi.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?Zi.AddressToObjectId(t):""}}async PublicUserMetadata({address:e,metadataSubtree:t="/",queryParams:r={},select:i=[],resolveLinks:o=!1,resolveIncludeSource:l=!1,resolveIgnoreErrors:c=!1,linkDepthLimit:p=1}){if(!e||!await this.UserWalletAddress({address:e}))return;t=N8("public",t||"/");const{libraryId:m,objectId:w}=await this.UserWalletObjectInfo({address:e});if(w)return await this.client.ContentObjectMetadata({libraryId:m,objectId:w,queryParams:r,select:i,metadataSubtree:t,resolveLinks:o,resolveIncludeSource:l,resolveIgnoreErrors:c,linkDepthLimit:p})}async UserMetadata({metadataSubtree:e="/",queryParams:t={},select:r=[],resolveLinks:i=!1,resolveIncludeSource:o=!1,resolveIgnoreErrors:l=!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:l,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(){if(!this.tenantId){const{objectId:e}=await this.UserWalletObjectInfo();this.tenantId=await this.client.TenantId({objectId:e})}return this.tenantId}async SetTenantId({id:e,address:t}){if(e&&(!e.startsWith("iten")||!Zi.ValidHash(e)))throw Error(`Invalid tenant ID: ${e}`);if(t){if(!Zi.ValidAddress(t))throw Error(`Invalid address: ${t}`);e=`iten${Zi.AddressToHash(t)}`}const{objectId:r}=await this.UserWalletObjectInfo(),i=await this.client.SetTenantId({objectId:r,tenantId:e});this.tenantContractId=i.tenantContractId,this.tenantId=i.tenantId}async TenantContractId(){if(!this.tenantContractId){const{objectId:e}=await this.UserWalletObjectInfo();this.tenantContractId=await this.client.TenantContractId({objectId:e})}return this.tenantContractId}async SetTenantContractId({tenantContractId:e}){const{objectId:t}=await this.UserWalletObjectInfo(),r=await this.client.SetTenantContractId({objectId:t,tenantContractId:e});this.tenantContractId=r.tenantContractId,this.tenantId=r.tenantId}async ResetTenantId(){const{objectId:e}=await this.UserWalletObjectInfo();await this.client.ResetTenantId({objectId:e}),this.tenantId=this.client.TenantId({objectId:e}),this.tenantContractId=this.client.TenantContractId({objectId:e})}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:N8("accessed_content",r)})))return;const l=await this.UserWalletObjectInfo(),c=l.libraryId,p=l.objectId,h=await this.client.EditContentObject({libraryId:c,objectId:p});await this.client.ReplaceMetadata({libraryId:c,objectId:p,writeToken:h.write_token,metadataSubtree:N8("accessed_content",r),metadata:Date.now()});const m=await this.client.ContentObjectMetadata({libraryId:e,objectId:t,versionHash:r,metadataSubtree:"video_tags"});if(m&&m.length>0){let w=await this.CollectedTags();const b=this.__FormatVideoTags(m);Object.keys(b).forEach(g=>{w[g]?(w[g].occurrences+=1,w[g].aggregate+=b[g]):w[g]={occurrences:1,aggregate:b[g]}}),await this.client.ReplaceMetadata({libraryId:c,objectId:p,writeToken:h.write_token,metadataSubtree:"collected_data",metadata:w})}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(l=>{t[l.tag]?(t[l.tag].occurrences+=1,t[l.tag].aggregate+=l.score):t[l.tag]={occurrences:1,aggregate:l.score}})});let r={};return Object.keys(t).forEach(i=>{r[i]=t[i].aggregate/t[i].occurrences}),r}PromptedMethods(){return iP.PromptedMethods()}MetadataMethods(){return iP.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 Boe=Foe;const yd=Yu,Eu=ki,zoe=jd,Ry=_s,sP=L5;let joe=class extends yd.Signer{constructor({signerURIs:e,idToken:t,authToken:r,tenantId:i,provider:o,extraData:l={},unsignedPublicAuth:c=!1}){super(),this.remoteSigner=!0,this.unsignedPublicAuth=c,this.HttpClient=new zoe({uris:e}),this.idToken=t,this.tenantId=i,this.authToken=r,this.extraLoginData=l||{},this.provider=o,this.signatureCache={}}async Initialize(){if(!this.authToken){const{addr:e,eth:t,token:r}=await Eu.ResponseToJson(this.HttpClient.Request({path:Ry("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=Eu.FormatAddress(e),this.id=t}if(!this.address){const e=await Eu.ResponseToJson(this.HttpClient.Request({method:"GET",path:Ry("as","wlt","keys"),headers:{Authorization:`Bearer ${this.authToken}`}})),t=e.eth[0];t&&t.startsWith("0x")?this.address=t:this.address=Eu.HashToAddress(e.eth[0])}this.id=this.address?`ikms${Eu.AddressToHash(this.address)}`:void 0,this.signer=this.provider.getSigner(this.address)}async RetrieveCSAT({email:e,nonce:t,tenantId:r,force:i=!1}){t=t||Eu.B58(sP.parse(sP.v4()));let o=await Eu.ResponseToJson(this.HttpClient.Request({method:"POST",body:{email:e,nonce:t,force:i,tid:r},path:Ry("as","wlt","sign","csat"),headers:{Authorization:`Bearer ${this.authToken}`}}));return o.nonce=t,o}async CSATStatus({accessToken:e}){try{const t=await Eu.ResponseToJson(this.HttpClient.Request({method:"POST",path:Ry("as","wlt","login","status"),headers:{Authorization:`Bearer ${e}`}}));return t&&t.is_active}catch(t){return!t||t.status!==403}}async ReleaseCSAT({accessToken:e}){return await Eu.ResponseToJson(this.HttpClient.Request({method:"POST",path:Ry("as","wlt","login","release"),headers:{Authorization:`Bearer ${e}`}}))}getAddress(){return this.address}async signDigest(e){return this.signatureCache[e]||(this.signatureCache[e]=new Promise(async(t,r)=>{try{let i=await Eu.ResponseToJson(this.HttpClient.Request({method:"POST",path:Ry("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(yd.utils.joinSignature(`0x${await this.signDigest(yd.utils.hashMessage(e))}`))}async sign(e){e=await yd.utils.resolveProperties(e);const t=await this.signDigest(yd.utils.keccak256(yd.utils.serializeTransaction(e)));return yd.utils.serializeTransaction(e,t)}async sendTransaction(e){return e.nonce==null&&(e=yd.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 Hoe=joe,fa={},oP;function $oe(){if(oP)return fa;oP=1;const{ValidatePresence:n,ValidateLibrary:e,ValidateObject:t,ValidateAddress:r,ValidateUserWallet:i}=Ko;return fa.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}`,m=(p.meta.public||{}).name||`zz__${p.address}`;return h<m?-1:1})},fa.SetGroupPermission=async function({groupAddress:o,objectId:l,permission:c,remove:p=!1}){const h=await this.authClient.ContractInfo({address:o}),m=await this.authClient.ContractInfo({id:l});if(Object.keys(h).length===0)throw Error(`No information returned for group address ${o}`);let w;if(!m.isV3&&m.accessType===this.authClient.ACCESS_TYPES.GROUP){if(h.isV3)throw Error("Unable to map V3 group to V2 object");w=await this.CallContractMethodAndWait({contractAddress:o,methodName:"setAccessGroupRights",methodArgs:[this.utils.HashToAddress(l),c==="manage"?2:c==="access"?1:0,c==="none"||p?0:2]})}else w=await this.CallContractMethodAndWait({contractAddress:this.utils.HashToAddress(l),methodName:"setRights",methodArgs:[o,c==="manage"?2:c==="access"?1:0,c==="none"||p?0:2]});return await this.ExtractEventFromLogs({abi:h.abi,event:w,eventName:"RightsChanged"})},fa.AccessGroupOwner=async function({contractAddress:o}){return o=r(o),this.Log(`Retrieving owner of access group ${o}`),await this.authClient.Owner({address:o})},fa.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):[]}},fa.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):[]}},fa.CreateAccessGroup=async function({name:o,description:l,metadata:c={},visibility:p=1}={}){this.Log(`Creating access group: ${o||""} ${l||""}`);let{contractAddress:h}=await this.authClient.CreateAccessGroup();h=this.utils.FormatAddress(h);const m=this.utils.AddressToObjectId(h),w=await this.userProfileClient.TenantContractId();this.Log(`Access group: ${h} ${m}`);const b=await this.EditContentObject({libraryId:this.contentSpaceLibraryId,objectId:m}),g={public:{name:o,description:l},name:o,description:l,...c};if(await this.ReplaceMetadata({libraryId:this.contentSpaceLibraryId,objectId:m,writeToken:b.write_token,metadata:g}),await this.CallContractMethodAndWait({contractAddress:h,methodName:"setVisibility",methodArgs:[p]}),await this.FinalizeContentObject({libraryId:this.contentSpaceLibraryId,objectId:m,writeToken:b.write_token,commitMessage:"Create access group"}),w){const S=await this.SetTenantContractId({contractAddress:h,tenantContractId:w});if(S.tenantId){let A=this.utils.HashToAddress(S.tenantId);await this.AddContentObjectGroupPermission({objectId:m,groupAddress:A,permission:"manage"})}else console.warn("No tenant ID associated with current tenant.")}return h},fa.DeleteAccessGroup=async function({contractAddress:o}){throw Error("Not supported")},fa.AccessGroupMembershipMethod=async function({contractAddress:o,memberAddress:l,methodName:c,eventName:p}){if(o=r(o),l=r(l),!this.utils.EqualAddress(this.signer.address,l)&&!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 ${l}`);const h=await this.CallContractMethodAndWait({contractAddress:o,methodName:c,methodArgs:[l],eventName:p,eventValue:"candidate"}),m=await this.ContractAbi({contractAddress:o}),w=this.ExtractValueFromEvent({abi:m,event:h,eventName:p,eventValue:"candidate"});if(this.utils.FormatAddress(w)!==this.utils.FormatAddress(l))throw console.error("Mismatch: "+w+" :: "+l),console.error("Is target user address wallet created?"),Error("Access group method "+c+" failed. Is target user address wallet created?");return h.transactionHash},fa.AddAccessGroupMember=async function({contractAddress:o,memberAddress:l}){o=r(o),l=r(l),await i({address:l,client:this});const c=await this.authClient.ContractHasMethod({contractAddress:o,methodName:"membersList"}),p=await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:l,methodName:"grantAccess",eventName:"MemberAdded"});if(!c){let h=await this.AccessGroupMembers({contractAddress:o});h.push(l),h=h.filter((m,w,b)=>b.indexOf(m)===w),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"members",metadata:h})}return p},fa.RemoveAccessGroupMember=async function({contractAddress:o,memberAddress:l}){o=r(o),l=r(l);const c=await this.authClient.ContractHasMethod({contractAddress:o,methodName:"membersList"}),p=await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:l,methodName:"revokeAccess",eventName:"MemberRevoked"});if(!c){let h=await this.AccessGroupMembers({contractAddress:o});return h=h.filter(m=>m!==l),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"members",metadata:h})}return p},fa.AddAccessGroupManager=async function({contractAddress:o,memberAddress:l}){o=r(o),l=r(l),await i({address:l,client:this});const c=await this.authClient.ContractHasMethod({contractAddress:o,methodName:"membersList"}),p=await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:l,methodName:"grantManagerAccess",eventName:"ManagerAccessGranted"});if(!c){let h=await this.AccessGroupManagers({contractAddress:o});h.push(l),h=h.filter((m,w,b)=>b.indexOf(m)===w),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"managers",metadata:h})}return p},fa.RemoveAccessGroupManager=async function({contractAddress:o,memberAddress:l}){if(o=r(o),l=r(l),!await this.authClient.ContractHasMethod({contractAddress:o,methodName:"managersList"})){let h=await this.AccessGroupManagers({contractAddress:o});h=h.filter(m=>m!==l),await this.ReplaceContractMetadata({contractAddress:o,metadataKey:"managers",metadata:h})}return await this.AccessGroupMembershipMethod({contractAddress:o,memberAddress:l,methodName:"revokeManagerAccess",eventName:"ManagerAccessRevoked"})},fa.ContentLibraryGroupPermissions=async function({libraryId:o,permissions:l=[]}){e(o);let c={};return!l||l.length===0?l=["accessor","contributor","reviewer"]:l=l.map(p=>{if(p=p.toLowerCase(),!["accessor","contributor","reviewer"].includes(p))throw Error(`Invalid permission: ${p}`);return p}),this.Log(`Retrieving ${l.join(", ")} group(s) for library ${o}`),await Promise.all(l.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 w=>{try{return this.utils.FormatAddress(await this.CallContractMethod({contractAddress:this.utils.HashToAddress(o),methodName:p+"Groups",methodArgs:[w]}))}catch(b){console.error(b)}})).forEach(w=>c[w]=[...c[w]||[],p].sort())})),c},fa.AddContentLibraryGroup=async function({libraryId:o,groupAddress:l,permission:c}){if(e(o),l=r(l),!["accessor","contributor","reviewer"].includes(c.toLowerCase()))throw Error(`Invalid group type: ${c}`);if(this.Log(`Adding ${c} group ${l} to library ${o}`),(await this.ContentLibraryGroupPermissions({libraryId:o,permissions:[c]}))[l])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:[l]}),m=await this.ContractAbi({id:o});await this.ExtractEventFromLogs({abi:m,event:h,eventName:`${c}GroupAdded`})},fa.RemoveContentLibraryGroup=async function({libraryId:o,groupAddress:l,permission:c}){if(e(o),l=r(l),!["accessor","contributor","reviewer"].includes(c.toLowerCase()))throw Error(`Invalid group type: ${c}`);if(this.Log(`Removing ${c} group ${l} from library ${o}`),!(await this.ContentLibraryGroupPermissions({libraryId:o,permissions:[c]}))[l])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:[l]}),m=await this.ContractAbi({id:o});await this.ExtractEventFromLogs({abi:m,event:h,eventName:`${c}GroupRemoved`})},fa.ContentObjectGroupPermissions=async function({objectId:o}){t(o),this.Log(`Retrieving group permissions for object ${o}`);const l=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 m=>{try{m=this.utils.FormatAddress(m);let w=await this.CallContractMethod({contractAddress:m,methodName:p,methodArgs:[l]});if(w===0)return;let b=[];w>=100&&b.push("manage"),w%100>=10&&b.push("access"),w%10>0&&b.push("see"),h[m]=b}catch(w){this.Log(`Failed to retrieve group permissions for ${m}`,!0),this.Log(w,!0)}})),h},fa.AddContentObjectGroupPermission=async function({objectId:o,groupAddress:l,permission:c}){if(n("permission",c),t(o),l=r(l),this.utils.EqualAddress(l,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 ${l} for ${o}`),await this.SetGroupPermission({groupAddress:l,objectId:o,permission:c})},fa.RemoveContentObjectGroupPermission=async function({objectId:o,groupAddress:l,permission:c}){if(n("permission",c),t(o),l=r(l),c=c.toLowerCase(),!["see","access","manage"].includes(c))throw Error(`Invalid permission type: ${c}`);return this.Log(`Removing ${c} permission from group ${l} for ${o}`),await this.SetGroupPermission({groupAddress:l,objectId:o,permission:c,remove:!0})},fa.LinkAccessGroupToOauth=async function({groupAddress:o,kmsId:l,oauthConfig:c}){r(o),n("kmsId",l),n("oauthConfig",c),typeof c=="string"&&(c=JSON.parse(c));const{publicKey:p}=await this.authClient.KMSInfo({kmsId:l}),h=`eluv.jwtv.${l}`,m=await this.Crypto.EncryptConk(c,p),w=`eluv.jwtv.iusr${this.utils.AddressToHash(this.signer.address)}`,b=await this.EncryptECIES({message:c}),g=this.utils.AddressToObjectId(o),S=(await this.EditContentObject({libraryId:this.contentSpaceLibraryId,objectId:g})).write_token;await this.ReplaceMetadata({libraryId:this.contentSpaceLibraryId,objectId:g,writeToken:S,metadataSubtree:h,metadata:m}),await this.ReplaceMetadata({libraryId:this.contentSpaceLibraryId,objectId:g,writeToken:S,metadataSubtree:w,metadata:b}),await this.FinalizeContentObject({libraryId:this.contentSpaceLibraryId,objectId:g,writeToken:S,commitMessage:"Bind access group to OAuth"}),await this.CallContractMethodAndWait({contractAddress:o,methodName:"setOAuthEnabled",methodArgs:[!1]}),await this.CallContractMethodAndWait({contractAddress:o,methodName:"setOAuthEnabled",methodArgs:[!0]})},fa.UnlinkAccessGroupFromOauth=async function({groupAddress:o}){r(o),await this.CallContractMethodAndWait({contractAddress:o,methodName:"setOAuthEnabled",methodArgs:[!1]})},fa}var Nr={},lP;function qoe(){if(lP)return Nr;lP=1;const n=Yu,{ValidateAddress:e,ValidateParameters:t,ValidatePresence:r,ValidateObject:i,ValidateVersion:o}=Ko,l=ki;Nr.ContractName=async function({contractAddress:p}){return p=e(p),await this.ethClient.ContractName(p)},Nr.ContractAbi=async function({contractAddress:p,id:h}){const m=await this.authClient.ContractInfo({address:p,id:h});if(!m)throw Error(`Unable to determine contract info for ${p}`);return m.abi},Nr.ContractInfo=async function({id:p,address:h}){return this.authClient.ContractInfo({id:p,address:h})},Nr.FormatContractArguments=function({abi:p,methodName:h,args:m}){return this.ethClient.FormatContractArguments({abi:p,methodName:h,args:m})},Nr.DeployContract=async function({abi:p,bytecode:h,constructorArgs:m,overrides:w={}}){return await this.ethClient.DeployContract({abi:p,bytecode:h,constructorArgs:m,overrides:w,signer:this.signer})},Nr.ContractEvents=async function({contractAddress:p,abi:h,fromBlock:m=0,toBlock:w,count:b=1e3,topics:g,includeTransaction:S=!1}){p=e(p),h||(h=await this.ContractAbi({contractAddress:p}));const A=await this.FormatBlockNumbers({fromBlock:m,toBlock:w,count:b});return this.Log(`Querying contract events ${p} - Blocks ${A.fromBlock} to ${A.toBlock}`),await this.ethClient.ContractEvents({contractAddress:p,abi:h,fromBlock:A.fromBlock,toBlock:A.toBlock,topics:g,includeTransaction:S})},Nr.CallContractMethod=async function({contractAddress:p,abi:h,methodName:m,methodArgs:w=[],value:b,overrides:g={},formatArguments:S=!0,cacheContract:A=!0,overrideCachedContract:k=!1}){return p=e(p),p=this.utils.FormatAddress(p),m==="setVisibility"&&this.visibilityInfo[p]&&delete this.visibilityInfo[p],h||(h=await this.ContractAbi({contractAddress:p})),await this.ethClient.CallContractMethod({contractAddress:p,abi:h,methodName:m,methodArgs:w,value:b,overrides:g,formatArguments:S,cacheContract:A,overrideCachedContract:k})},Nr.CallContractMethodAndWait=async function({contractAddress:p,abi:h,methodName:m,methodArgs:w,value:b,overrides:g={},formatArguments:S=!0,cacheContract:A=!0,overrideCachedContract:k=!1}){return p=e(p),p=this.utils.FormatAddress(p),m==="setVisibility"&&this.visibilityInfo[p]&&delete this.visibilityInfo[p],h||(h=await this.ContractAbi({contractAddress:p})),await this.ethClient.CallContractMethodAndWait({contractAddress:p,abi:h,methodName:m,methodArgs:w,value:b,overrides:g,formatArguments:S,cacheContract:A,overrideCachedContract:k})},Nr.ContractMetadata=async function({contractAddress:p,metadataKey:h}){r("contractAddress",p),r("metadataKey",h);try{const m=await this.CallContractMethod({contractAddress:p,methodName:"getMeta",methodArgs:[h]}),w=Buffer.from((m||"").replace("0x",""),"hex").toString("utf-8");try{return JSON.parse(w)}catch{return w}}catch{return""}},Nr.MergeContractMetadata=async function({contractAddress:p,metadataKey:h,metadata:m}){r("contractAddress",p),r("metadataKey",h);const w=await this.ContractMetadata({contractAddress:p,metadataKey:h})||{};typeof w=="object"&&(m={...w,...m}),await this.CallContractMethodAndWait({contractAddress:p,methodName:"putMeta",methodArgs:[h,JSON.stringify(m)]})},Nr.ReplaceContractMetadata=async function({contractAddress:p,metadataKey:h,metadata:m}){r("contractAddress",p),r("metadataKey",h),typeof m=="object"&&(m=JSON.stringify(m)),await this.CallContractMethodAndWait({contractAddress:p,methodName:"putMeta",methodArgs:[h,m]})},Nr.CustomContractAddress=async function({libraryId:p,objectId:h,versionHash:m}){if(t({libraryId:p,objectId:h,versionHash:m}),m&&(h=this.utils.DecodeVersionHash(m).objectId),p===this.contentSpaceLibraryId||this.utils.EqualHash(p,h))return;this.Log(`Retrieving custom contract address: ${h}`);const w=await this.ContractAbi({id:h}),b=await this.ethClient.CallContractMethod({contractAddress:this.utils.HashToAddress(h),abi:w,methodName:"contentContractAddress",methodArgs:[]});if(b!==this.utils.nullAddress)return this.utils.FormatAddress(b)},Nr.SetCustomContentContract=async function({libraryId:p,objectId:h,customContractAddress:m,name:w,description:b,abi:g,factoryAbi:S,overrides:A={}}){t({libraryId:p,objectId:h}),m=e(m),m=this.utils.FormatAddress(m),this.Log(`Setting custom contract address: ${h} ${m}`);const k=await this.ethClient.SetCustomContentContract({contentContractAddress:this.utils.HashToAddress(h),customContractAddress:m,overrides:A,signer:this.signer}),R=(await this.EditContentObject({libraryId:p,objectId:h})).write_token;return await this.ReplaceMetadata({libraryId:p,objectId:h,writeToken:R,metadataSubtree:"custom_contract",metadata:{name:w,description:b,address:m,abi:g,factoryAbi:S}}),await this.FinalizeContentObject({libraryId:p,objectId:h,writeToken:R,commitMessage:"Set custom contract"}),k},Nr.ExtractEventFromLogs=function({abi:p,event:h,eventName:m}){return this.ethClient.ExtractEventFromLogs({abi:p,event:h,eventName:m})},Nr.ExtractValueFromEvent=function({abi:p,event:h,eventName:m,eventValue:w}){const b=this.ethClient.ExtractEventFromLogs({abi:p,event:h,eventName:m,eventValue:w});return b?b.args[w]:void 0},Nr.FormatBlockNumbers=async function({fromBlock:p,toBlock:h,count:m=10}){const w=await this.BlockNumber();return h?p||(p=h-m+1):p?h=p+m-1:(h=w,p=h-m+1),h>w&&(h=w),p<0&&(p=0),{fromBlock:p,toBlock:h}},Nr.Events=async function({toBlock:p,fromBlock:h,count:m=10,includeTransaction:w=!1}={}){const b=await this.FormatBlockNumbers({fromBlock:h,toBlock:p,count:m});return this.Log(`Querying events - Blocks ${b.fromBlock} to ${b.toBlock}`),await this.ethClient.Events({fromBlock:b.fromBlock,toBlock:b.toBlock,includeTransaction:w})},Nr.BlockNumber=async function(){return await this.ethClient.MakeProviderCall({methodName:"getBlockNumber"})},Nr.GetBalance=async function({address:p}){p=e(p);const h=await this.ethClient.MakeProviderCall({methodName:"getBalance",args:[p]});return n.utils.formatEther(h)},Nr.SendFunds=async function({recipient:p,ether:h}){return p=e(p),await(await this.signer.sendTransaction({to:p,value:n.utils.parseEther(h.toString())})).wait()};const c=async function({contractAddress:p,objectId:h,versionHash:m}){if(p)e(p),h=l.AddressToObjectId(p);else if(m)o(m),h=this.utils.DecodeVersionHash(m).objectId,p=l.HashToAddress(h);else if(h)i(h),p=l.HashToAddress(h);else throw Error("contractAddress or objectId or versionHash not specified");return{contractAddress:p,objectId:h}};return Nr.TenantId=async function({contractAddress:p,objectId:h,versionHash:m}){objectInfo=await c({contractAddress:p,objectId:h,versionHash:m}),p=objectInfo.contractAddress,h=objectInfo.objectId;let w;try{if(await this.authClient.ContractHasMethod({contractAddress:p,methodName:"getMeta"})&&(w=await this.ContractMetadata({contractAddress:p,metadataKey:"_tenantId"})),w===void 0){const g=await this.ContentObjectLibraryId({objectId:h});w=await this.ContentObjectMetadata({libraryId:g,objectId:h,metadataSubtree:"tenantId"})}return w}catch{return""}},Nr.TenantContractId=async function({contractAddress:p,objectId:h,versionHash:m}){objectInfo=await c({contractAddress:p,objectId:h,versionHash:m}),p=objectInfo.contractAddress,h=objectInfo.objectId;try{const w=await this.authClient.ContractHasMethod({contractAddress:p,methodName:"getMeta"});let b;if(w&&(b=await this.ContractMetadata({contractAddress:p,metadataKey:"_ELV_TENANT_ID"})),b===void 0){const g=await this.ContentObjectLibraryId({objectId:h});b=await this.ContentObjectMetadata({libraryId:g,objectId:h,metadataSubtree:"tenantContractId"})}return b}catch{return""}},Nr.SetTenantId=async function({contractAddress:p,objectId:h,versionHash:m,tenantId:w}){objectInfo=await c({contractAddress:p,objectId:h,versionHash:m}),p=objectInfo.contractAddress,h=objectInfo.objectId;const b=await this.authClient.AccessType(h);if(b!==this.authClient.ACCESS_TYPES.GROUP&&b!==this.authClient.ACCESS_TYPES.WALLET&&b!==this.authClient.ACCESS_TYPES.LIBRARY&&b!==this.authClient.ACCESS_TYPES.TYPE&&b!==this.authClient.ACCESS_TYPES.TENANT)throw Error(`Invalid object ID: ${h},
|
|
329
329
|
applicable only for wallet,group, library or content_type object.`);if(i(w),!w.startsWith("iten")||!l.ValidHash(w))throw Error(`Invalid tenant ID: ${w}`);if(await this.authClient.AccessType(w)!==this.authClient.ACCESS_TYPES.GROUP)throw Error("Invalid tenant ID: "+w);if(tenantContractId=await this.TenantContractId({objectId:w}),tenantContractId)return await this.SetTenantContractId({contractAddress:p,objectId:h,versionHash:m,tenantContractId});throw Error("Invalid tenantId: tenant contract id not found")},Nr.SetTenantContractId=async function({contractAddress:p,objectId:h,versionHash:m,tenantContractId:w}){objectInfo=await c({contractAddress:p,objectId:h,versionHash:m}),p=objectInfo.contractAddress,h=objectInfo.objectId;const b=await this.authClient.AccessType(h);if(b!==this.authClient.ACCESS_TYPES.GROUP&&b!==this.authClient.ACCESS_TYPES.WALLET&&b!==this.authClient.ACCESS_TYPES.LIBRARY&&b!==this.authClient.ACCESS_TYPES.TYPE&&b!==this.authClient.ACCESS_TYPES.TENANT)throw Error(`Invalid object ID: ${h},
|
|
@@ -375,4 +375,4 @@ ${o.length}${o}`,"utf-8")),p=gd.utils.recoverAddress(c,i);return{type:t,message:
|
|
|
375
375
|
top=${m},
|
|
376
376
|
left=${h}
|
|
377
377
|
`);return w&&window.focus&&w.focus(),w};Nh.ActionPopup=async({mode:n="tab",url:e,onMessage:t,onCancel:r})=>{await new Promise(i=>{const o=n==="popup"?Nde({url:e,title:"Eluvio Media Wallet",w:500,h:850}):window.open(e),l=setInterval(async()=>{o.closed&&(clearInterval(l),r&&await r(),i())},1e3);window.addEventListener("message",async c=>{await t(c,()=>{clearInterval(l),o.close(),i()})})})};var tn={},DP;function Pde(){if(DP)return tn;DP=1;const n=ki,e=_s,{FormatNFTDetails:t,FormatNFTMetadata:r,FormatNFT:i}=Nh,o=xF();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(l=!1){if(!this.loggedIn)return;const{balance:c,usage_hold:p,payout_hold:h,locked_offer_balance:m,stripe_id:w,stripe_payouts_enabled:b}=await this.client.utils.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","bal"),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}})),g=w,S=b,A=parseFloat(c||0),k=parseFloat(m||0),R=Math.max(0,A-parseFloat(p||0)-k),L=Math.max(0,A-R),I=Math.max(0,A-parseFloat(Math.max(h,k)||0));if(l&&w&&!b){const G=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:G.toString(),return_url:G.toString()},headers:{Authorization:`Bearer ${this.AuthToken()}`}}),await this.UserWalletBalance(!1)}let q={totalWalletBalance:A,availableWalletBalance:R,lockedWalletBalance:k,pendingWalletBalance:L,withdrawableWalletBalance:I};return S&&(q.userStripeId=g,q.userStripeEnabled=S),q},tn.UserItemNames=async function({marketplaceParams:l,userAddress:c}={}){let p=[];return l&&p.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams:l})).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:l}){return await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","editions"),method:"GET",queryParams:{filter:`meta/display_name:eq:${l}`}}))},tn.UserItemAttributes=async function({marketplaceParams:l,displayName:c,userAddress:p}={}){let h=[];return l&&h.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams:l})).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:w,values:b})=>({name:w,values:b})).filter(({name:w})=>!["Content Fabric Hash","Total Minted Supply","Creator"].includes(w))},tn.UserItems=async function({sortBy:l="default",includeFullMetadata:c=!1}={}){return c&&this.loggedIn?this.FilteredQuery({mode:"owned-full-meta",sortBy:l,...arguments[0]||{}}):this.FilteredQuery({mode:"owned",sortBy:l,...arguments[0]||{}})},tn.UserListings=async function({userAddress:l,sortBy:c="created",sortDesc:p=!1,contractAddress:h,tokenId:m,marketplaceParams:w}={}){return(await this.FilteredQuery({mode:"listings",start:0,limit:1e4,sortBy:c,sortDesc:p,sellerAddress:l||this.UserAddress(),marketplaceParams:w,contractAddress:h,tokenId:m,includeCheckoutLocked:!0})).results},tn.UserSales=async function({userAddress:l,sortBy:c="created",sortDesc:p=!1,contractAddress:h,tokenId:m,startTime:w,endTime:b,lastNDays:g,marketplaceParams:S}={}){return(await this.FilteredQuery({mode:"sales",start:0,limit:1e4,sortBy:c,sortDesc:p,sellerAddress:l||this.UserAddress(),startTime:w,endTime:b,lastNDays:g,marketplaceParams:S,contractAddress:h,tokenId:m})).results},tn.UserTransfers=async function({userAddress:l,sortBy:c="created",sortDesc:p=!1,contractAddress:h,tokenId:m,startTime:w,endTime:b,lastNDays:g,marketplaceParams:S}={}){return(await this.FilteredQuery({mode:"transfers",start:0,limit:1e4,sortBy:c,sortDesc:p,sellerAddress:l||this.UserAddress(),marketplaceParams:S,contractAddress:h,tokenId:m,startTime:w,endTime:b,lastNDays:g})).results},tn.TenantConfiguration=async function({tenantId:l,contractAddress:c}){try{return c=c?n.FormatAddress(c):void 0,this.tenantConfigs[c||l]||(this.tenantConfigs[c||l]=await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:c?e("as","config","nft",c):e("as","config","tnt",l),method:"GET"}))),this.tenantConfigs[c||l]}catch(p){return this.Log("Failed to load tenant configuration",!0,p),{}}},tn.ExchangeRate=async function({currency:l}){if(!l)throw Error("Eluvio Wallet Client: Invalid or missing currency in ExchangeRate");return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","xr","ebanx",l),method:"GET"}))},tn.TenantCSS=async function({tenantSlug:l}){return this.cachedCSS[l]||(this.cachedCSS[l]=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:e("/public","asset_metadata","tenants",l,"info","branding","wallet_css"),authorizationToken:this.publicStaticToken})),this.cachedCSS[l]||""},tn.MarketplaceStock=async function({marketplaceParams:l,tenantId:c}){return c||(c=this.MarketplaceInfo({marketplaceParams:l}).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:l}){let{tenantSlug:c,marketplaceSlug:p,marketplaceId:h,marketplaceHash:m}=l||{},w;if(c&&p?w=(this.availableMarketplaces[c]||{})[p]:(h=m?this.client.utils.DecodeVersionHash(m).objectId:h,w=this.availableMarketplacesById[h]),!w)throw Error(`Eluvio Wallet Client: Unable to find marketplace with parameters ${JSON.stringify(arguments)}`);return w},tn.MarketplaceCSS=async function({marketplaceParams:l}){const p=this.MarketplaceInfo({marketplaceParams:l}).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:l,forceReload:c=!1}={}){return c&&await this.LoadAvailableMarketplaces(!0),{...l?this.availableMarketplacesById:this.availableMarketplaces}},tn.Marketplace=async function({marketplaceParams:l}){return this.LoadMarketplace(l)},tn.NFTContractStats=async function({contractAddress:l}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","nft","info",l),method:"GET"}))},tn.NFT=async function({tokenId:l,contractAddress:c}){let p=t(await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","nft","info",c,l),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,(m,w)=>w===null||w===""?m:void 0),this.localization){const m=await this.client.ContentObjectMetadata({versionHash:p.details.VersionHash,metadataSubtree:e("public","asset_metadata","localizations",this.localization,"nft"),produceLinkUrls:!0})||{};p.metadata=o({},p.metadata,m,(w,b)=>b===null||b===""?w:void 0)}return p.config=await this.TenantConfiguration({contractAddress:c}),r(this,p)},tn.TransferNFT=async function({contractAddress:l,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(l),token:c,to_addr:n.FormatAddress(p)},headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.ListingStatus=async function({listingId:l}){try{return await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","status",l),method:"GET"}))}catch(c){if(c.status===404)return;throw c}},tn.Listing=async function({listingId:l}){return i(this,await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","l",l),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:l,marketplaceParams:c}){if(l){let p={addr:n.FormatAddress(l)};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:l,tokenId:c,price:p,listingId:h}){return l=n.FormatAddress(l),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:l,token:c,price:parseFloat(p)},headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.RemoveListing=async function({listingId:l}){await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt",l),method:"DELETE",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.SalesNames=async function({marketplaceParams:l}){let c;return l&&(c=(await this.MarketplaceInfo({marketplaceParams:l})).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:l}){let c;return l&&(c=(await this.MarketplaceInfo({marketplaceParams:l})).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:l}){return await n.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:e("as","mkt","editions"),queryParams:{filter:`nft/display_name:eq:${l}`},method:"GET"}))},tn.ListingAttributes=async function({marketplaceParams:l,displayName:c}={}){let p=[];return l&&p.push(`tenant:eq:${(await this.MarketplaceInfo({marketplaceParams:l})).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:m,values:w})=>({name:m,values:w})).filter(({name:m})=>!["Content Fabric Hash","Total Minted Supply","Creator"].includes(m))},tn.ClaimGift=async function({code:l}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({method:"POST",path:e("as","wlt","gifts","claim"),body:{otp_code:l},headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.ClaimItem=async function({marketplaceParams:l,sku:c,email:p}){const h=await this.MarketplaceInfo({marketplaceParams:l});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:l,sku:c,confirmationId:p,successUrl:h,cancelUrl:m}){const w=await this.MarketplaceInfo({marketplaceParams:l});window.location.href=this.FlowURL({type:"action",flow:"purchase",marketplaceId:w.marketplaceId,parameters:{sku:c,confirmationId:p,successUrl:h,cancelUrl:m,login:!0,auth:this.ClientAuthToken()}})},tn.PurchaseListing=async function({marketplaceParams:l,listingId:c,confirmationId:p,successUrl:h,cancelUrl:m}){let w;l&&(w=await this.MarketplaceInfo({marketplaceParams:l})),window.location.href=this.FlowURL({type:"action",flow:"purchase",marketplaceId:w&&w.marketplaceId,parameters:{listingId:c,confirmationId:p,successUrl:h,cancelUrl:m,login:!0,auth:this.ClientAuthToken()}})},tn.ListingPurchaseStatus=async function({listingId:l,confirmationId:c}){try{const p=await this.ListingStatus({listingId:l});if(!p)throw Error("Unable to find info for listing "+l);return(await this.MintingStatus({tenantId:p.tenant})).find(m=>m.op==="nft-transfer"&&m.extra&&m.extra[0]===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.PurchaseStatus=async function({marketplaceParams:l,confirmationId:c}){try{const p=await this.MarketplaceInfo({marketplaceParams:l});return(await this.MintingStatus({tenantId:p.tenant_id})).find(m=>m.op==="nft-buy"&&m.confirmationId===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.ClaimStatus=async function({marketplaceParams:l,sku:c}){try{const p=await this.MarketplaceInfo({marketplaceParams:l});return(await this.MintingStatus({tenantId:p.tenantId})).find(m=>m.op==="nft-claim"&&m.marketplaceId===p.marketplaceId&&m.confirmationId===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.GiftClaimStatus=async function({marketplaceParams:l,confirmationId:c,giftId:p}){try{const h=await this.MarketplaceInfo({marketplaceParams:l}),w=(await this.MintingStatus({tenantId:h.tenantId})).filter(b=>b.op==="nft-transfer"&&(c&&b.confirmationId===c||p&&b.giftId===p))||{status:"none"};return w.length===0?{status:"none"}:w.find(b=>b.status==="failed")?{status:"failed",op:"nft-transfer",transfer_statuses:w}:w.find(b=>b.status!=="complete")?{status:"pending",op:"nft-transfer",transfer_statuses:w}:{status:"complete",op:"nft-transfer",transfer_statuses:w,items:w.map(b=>({token_addr:b.address,token_id_str:b.tokenId}))}}catch(h){return this.Log(h,!0),{status:"unknown"}}},tn.EntitlementClaimStatus=async function({marketplaceParams:l,purchaseId:c}){try{const p=await this.MarketplaceInfo({marketplaceParams:l}),m=(await this.MintingStatus({tenantId:p.tenantId})).filter(w=>w.op==="nft-claim-entitlement"&&c&&c==w.confirmationId)||{status:"none"};return m.length===0?{status:"none"}:m.find(w=>w.status==="complete")?{status:"complete",op:"nft-claim-entitlement",items:[{token_addr:m[0].address,token_id:m[0].tokenId}]}:m.find(w=>w.status==="error")?{status:"error",op:"nft-claim-entitlement"}:{status:"pending",op:"nft-claim-entitlement"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.PackOpenStatus=async function({contractAddress:l,tokenId:c}){try{const p=await this.TenantConfiguration({contractAddress:l});return(await this.MintingStatus({tenantId:p.tenant})).find(m=>m.op==="nft-open"&&n.EqualAddress(l,m.address)&&m.tokenId===c)||{status:"none"}}catch(p){return this.Log(p,!0),{status:"unknown"}}},tn.CollectionRedemptionStatus=async function({marketplaceParams:l,confirmationId:c}){try{return(await this.MintingStatus({marketplaceParams:l})).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:l,marketplaceParams:c,contractAddress:p,tokenId:h,offerId:m}){try{const w=await this.MintingStatus({marketplaceParams:c,tenantId:l});return p=n.FormatAddress(p),w.find(b=>b.op==="nft-offer-redeem"&&n.EqualAddress(b.address,p)&&b.tokenId===(h||"").toString()&&b.offerId===(m||"").toString())||{status:"none"}}catch(w){return this.Log(w,!0),{status:"unknown"}}},tn.RedeemableCustomFulfillmentInfo=async function({redeemableTransactionId:l}){return await n.ResponseToJson(this.stateStoreClient.Request({method:"GET",path:e("code-fulfillment",this.network==="main"?"main":"demov3","fulfill",l),headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.LoadDrop=async function({tenantSlug:l,eventSlug:c,dropId:p}){if(this.drops||(this.drops={}),this.drops[l]||(this.drops[l]={}),this.drops[l][c]||(this.drops[l][c]={}),!this.drops[l][c][p]){const h=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:e("public","asset_metadata","tenants",l,"sites",c,"info"),resolveLinks:!0,linkDepthLimit:2,resolveIncludeSource:!0,produceLinkUrls:!0,select:[".","drops"],noAuth:!0})||[],m=n.DecodeVersionHash(h["."].source).objectId;h.drops.forEach(w=>{w={...w,eventId:m},this.drops[l][c][w.uuid]=w,this.drops[w.uuid]=w})}return this.drops[p]},tn.SubmitDropVote=async function({marketplaceParams:l,eventId:c,dropId:p,sku:h}){const m=await this.MarketplaceInfo({marketplaceParams:l});await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","act",m.tenant_id),method:"POST",body:{op:"vote-drop",evt:c,id:p,itm:h},headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.DropStatus=async function({marketplace:l,eventId:c,dropId:p}){try{return(await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","act",l.tenant_id,c,p),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))).sort((m,w)=>m.ts>w.ts?1:-1)[0]||{status:"none"}}catch(h){return this.Log(h,!0),""}},tn.MarketplaceOffers=async function({contractAddress:l,tokenId:c,buyerAddress:p,sellerAddress:h,statuses:m,start:w=0,limit:b=10}){let g=e("as","mkt","offers","ls");p?g=e(g,"b",n.FormatAddress(p)):h&&(g=e(g,"s",n.FormatAddress(h))),l&&(g=e(g,"c",n.FormatAddress(l)),c&&(g=e(g,"t",c)));let S={start:w,limit:b};return m&&m.length>0&&(S.include=m.join(",")),(await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:g,method:"GET",queryParams:S}))).map(k=>({...k,created:k.created*1e3,updated:k.updated*1e3,expiration:k.expiration*1e3}))},tn.CreateMarketplaceOffer=async function({contractAddress:l,tokenId:c,offerId:p,price:h,expiresAt:m}){let w;return p?w=await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers",p),method:"PUT",body:{price:h,expiration:Math.floor(m/1e3)},headers:{Authorization:`Bearer ${this.AuthToken()}`}})):w=await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers",l,c),method:"POST",body:{contract:l,token:c,price:h,expiration:Math.floor(m/1e3)},headers:{Authorization:`Bearer ${this.AuthToken()}`}})),w.offer_id},tn.RemoveMarketplaceOffer=async function({offerId:l}){return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers",l),method:"DELETE",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.AcceptMarketplaceOffer=async function({offerId:l}){return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers","accept",l),method:"PUT",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.RejectMarketplaceOffer=async function({offerId:l}){return await this.client.authClient.MakeAuthServiceRequest({path:e("as","wlt","mkt","offers","decline",l),method:"PUT",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},tn.VoteStatus=async function({tenantId:l,votingEventId:c}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","votes",l,c),headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.CastVote=async function({tenantId:l,votingEventId:c,sku:p}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","votes",l,c,p),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn.RevokeVote=async function({tenantId:l,votingEventId:c,sku:p}){return await n.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:e("as","votes",l,c,p),method:"DELETE",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))},tn}var Zp={},UP;function Ide(){if(UP)return Zp;UP=1;const n=ki,e=_s,t=({network:i,path:o})=>e(i==="main"?"/main":"/dv3",o),r=({network:i,appId:o,userAddress:l,key:c,type:p,mode:h})=>t({network:i,path:e(p==="app"?"app":"usr",p==="app"?o:"",l,h==="public"?"pub":"pri",c||"")});return Zp.ProfileMetadata=async function({type:i="app",mode:o="public",appId:l,userAddress:c,key:p}){try{const h=await this.stateStoreClient.Request({path:r({network:this.network,appId:l||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}},Zp.SetProfileMetadata=async function({type:i="app",mode:o="public",appId:l,key:c,value:p}){await this.stateStoreClient.Request({method:"POST",path:r({network:this.network,appId:l||this.appId,userAddress:this.UserAddress(),type:i,mode:o,key:c}),body:p,bodyType:typeof p=="object"?"JSON":"string",headers:{Authorization:`Bearer ${this.AuthToken()}`}})},Zp.RemoveProfileMetadata=async function({type:i="app",mode:o="public",appId:l,key:c}){await this.stateStoreClient.Request({method:"DELETE",path:r({network:this.network,appId:l||this.appId,userAddress:this.UserAddress(),type:i,mode:o,key:c}),headers:{Authorization:`Bearer ${this.AuthToken()}`}})},Zp.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 l=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:l,badges:p}},Zp.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}},Zp}var $v={},FP;function Dde(){if(FP)return $v;FP=1;const n=ki,e=_s,t=({network:r,path:i})=>e("/push",r==="main"?"/main":"/dv3",i);return $v.PushNotification=async function({tenantId:r,eventType:i,data:o,userAddress:l}){await this.stateStoreClient.Request({method:"POST",path:t({network:this.network,path:e("notify_user",l||this.UserAddress(),r,i)}),body:o,headers:{Authorization:`Bearer ${this.AuthToken()}`}})},$v.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=l=>{let c=JSON.parse(l.data);try{c.data=JSON.parse(c.data)}catch{}r(c)},o},$v.Notifications=async function({tenantId:r,types:i,offsetId:o,limit:l=10}={}){let c={limit:l};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})},$v}const{ElvClient:Ude}=H4,vd=Ode,{LinkTargetHash:j8,FormatNFT:Fde,ActionPopup:BP}=Nh,Bde=jd,da=_s,pa=ki,zde=Yu,tb=typeof window<"u",jde=tb&&window.top!==window.self;let Dx=!1;try{typeof localStorage<"u"&&localStorage.getItem("test"),Dx=!0}catch{}class Td{constructor({appId:e,client:t,network:r,mode:i,localization:o,marketplaceInfo:l,previewMarketplaceHash:c,storeAuthToken:p}){this.appId=e,this.client=t,this.loggedIn=!1,this.localization=o,this.network=r,this.mode=i,this.purchaseMode=vd[r][i].purchaseMode,this.mainSiteLibraryId=vd[r][i].siteLibraryId,this.mainSiteId=vd[r][i].siteId,this.appUrl=vd[r][i].appUrl,this.publicStaticToken=t.staticToken,this.storeAuthToken=p,this.selectedMarketplaceInfo=l,this.previewMarketplaceId=c?pa.DecodeVersionHash(c).objectId:void 0,this.previewMarketplaceHash=c,this.availableMarketplaces={},this.availableMarketplacesById={},this.marketplaceHashes={},this.tenantConfigs={},this.stateStoreUrls=vd[r].stateStoreUrls,this.stateStoreClient=new Bde({uris:this.stateStoreUrls}),this.badgerAddress=vd[r].badgerAddress,this.cachedMarketplaces={},this.cachedCSS={},this.utils=t.utils,this.ForbiddenMethods=Td.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(Td.prototype).filter(e=>!Td.ForbiddenMethods().includes(e)).sort()}static async Initialize({client:e,appId:t="general",network:r="main",mode:i="production",localization:o,marketplaceParams:l,previewMarketplaceId:c,storeAuthToken:p=!0,skipMarketplaceLoad:h=!1}){let{tenantSlug:m,marketplaceSlug:w,marketplaceId:b,marketplaceHash:g}=l||{};if(vd[r]){if(!vd[r][i])throw Error(`ElvWalletClient: Invalid mode ${i}`)}else throw Error(`ElvWalletClient: Invalid network ${r}`);e||(e=await Ude.FromNetworkName({networkName:r,assumeV3:!0}));let S=c;S&&!S.startsWith("hq__")&&(S=await e.LatestVersionHash({objectId:c}));const A=new Td({appId:t,client:e,network:r,mode:i,localization:o,marketplaceInfo:{tenantSlug:m,marketplaceSlug:w,marketplaceId:g?e.utils.DecodeVersionHash(g).objectId:b,marketplaceHash:g},previewMarketplaceHash:S,storeAuthToken:p});if(tb&&window.location&&window.location.href){let k=new URL(window.location.href);if(k.searchParams.get("elvToken"))await A.Authenticate({token:k.searchParams.get("elvToken")}),k.searchParams.delete("elvToken"),window.history.replaceState("","",k);else if(p&&Dx)try{let R=localStorage.getItem(`__elv-token-${r}`);R&&await A.Authenticate({token:R})}catch{}}return h||await A.LoadAvailableMarketplaces(),A}CanSign(){return this.loggedIn?!!this.__authorization.clusterToken||tb&&!!(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=zde.utils.keccak256(Buffer.from(`Ethereum Signed Message:
|
|
378
|
-
${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(!tb)throw Error("ElvWalletClient: Unable to sign");const t={action:"personal-sign",message:e,logIn:!0};let r=new URL(this.appUrl);if(r.hash=da("/action","sign",pa.B58(JSON.stringify(t))),r.searchParams.set("origin",window.location.origin),!jde&&window.location.origin===r.origin)throw Error("ElvWalletClient: Unable to sign");return await new Promise(async(i,o)=>{await BP({mode:"tab",url:r.toString(),onCancel:()=>o("User cancelled sign"),onMessage:async(l,c)=>{if(!(!l||!l.data||l.data.type!=="FlowResponse"))try{i(l.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:l=!1,callback:c}){let p=await this.LogInURL({mode:r,provider:t,marketplaceParams:o,clearLogin:l});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,m)=>{await BP({mode:"tab",url:p.toString(),onCancel:()=>m("User cancelled login"),onMessage:async(w,b)=>{if(!(!w||!w.data||w.data.type!=="LoginResponse"))try{c?await c(w.data.params):await this.Authenticate({token:w.data.params.clientSigningToken||w.data.params.clientAuthToken}),h()}catch(g){m(g)}finally{b()}}})}))}async LogOut(){if(this.__authorization&&this.__authorization.nonce)try{await this.client.signer.ReleaseCSAT({accessToken:this.AuthToken()})}catch(e){this.Log("Failed to release token",!0,e)}if(this.__authorization={},this.loggedIn=!1,this.cachedMarketplaces={},Dx)try{localStorage.removeItem(`__elv-token-${this.network}`)}catch{}}async TokenStatus(){return!this.__authorization||!this.__authorization.nonce?!0:await this.client.signer.CSATStatus({accessToken:this.AuthToken()})}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,extraData:l={},nonce:c,createRemoteToken:p=!0,force:h=!1}){let m=24;!t&&this.selectedMarketplaceInfo&&(await this.AvailableMarketplaces(),t=this.selectedMarketplaceInfo.tenantId),await this.client.SetRemoteSigner({idToken:e,tenantId:t,signerURIs:i,extraData:{...l,share_email:o},unsignedPublicAuth:!0});let w,b;if(p&&this.client.signer.remoteSigner){b=Date.now()+24*60*60*1e3;const S=await this.client.signer.RetrieveCSAT({email:r,nonce:c,tenantId:t,force:h});w=S.token,c=S.nonce}else b=Date.now()+m*60*60*1e3,w=await this.client.CreateFabricToken({duration:m*60*60*1e3,context:r?{usr:{email:r}}:{}});const g=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:w}),{authToken:this.SetAuthorization({fabricToken:w,tenantId:t,address:g,email:r,expiresAt:b,signerURIs:i,walletType:"Custodial",walletName:"Eluvio",register:!0,nonce:c}),signingToken:this.SetAuthorization({clusterToken:this.client.signer.authToken,fabricToken:w,tenantId:t,address:g,email:r,expiresAt:b,signerURIs:i,walletType:"Custodial",walletName:"Eluvio",nonce:c})}}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,l=await this.client.CreateFabricToken({address:e,duration:t*60*60*1e3,Sign:i,addEthereumPrefix:!1});return this.SetAuthorization({fabricToken:l,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:l,signerURIs:c,walletType:p,walletName:h,nonce:m,register:w=!1}){i=this.client.utils.FormatAddress(i),this.__authorization={fabricToken:t,tenantId:r,address:i,email:o,expiresAt:l,walletType:p,walletName:h,nonce:m},e&&(this.__authorization.clusterToken=e,c&&(this.__authorization.signerURIs=c)),this.loggedIn=!0,this.cachedMarketplaces={};const b=this.ClientAuthToken();if(this.storeAuthToken&&Dx)try{localStorage.setItem(`__elv-token-${this.network}`,b)}catch{}return w&&this.client.authClient.MakeAuthServiceRequest({path:"/as/wlt/register",method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`}}).catch(g=>{this.Log("Failed to register account: ",!0,g)}),b}async SignMetamask({message:e,address:t}){if(!tb||!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&&!pa.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=da("/",e,t,"marketplace",r,pa.B58(JSON.stringify(i))):o.pathname=da("/",e,t,pa.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 pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("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,expiresAt:o,...l}){await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("as","wlt","login","session",e),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`},body:{op:"set",id:e,format:"auth_token",payload:JSON.stringify({addr:pa.FormatAddress(t),eth:t?`ikms${pa.AddressToHash(t)}`:"",type:r,token:i,expiresAt:o,...l})}}))}async GetCodeAuth({code:e,passcode:t}){try{return await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("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/show","tenants/*/info/branding/name","tenants/*/marketplaces/*/.","tenants/*/marketplaces/*/info/tenant_id","tenants/*/marketplaces/*/info/tenant_name","tenants/*/marketplaces/*/info/branding/show","tenants/*/marketplaces/*/info/branding/name"]});const r=((t||{}).info||{}).marketplace_order||[];if(t=(t||{}).tenants||{},this.previewMarketplaceId){let l="PREVIEW",c,p;Object.keys(t||{}).forEach(h=>Object.keys(t[h].marketplaces||{}).forEach(m=>{const w=t[h].marketplaces[m]["."].source;this.utils.DecodeVersionHash(w).objectId===this.previewMarketplaceId&&(l=h,c=m,w===this.previewMarketplaceHash&&(p=t[h].marketplaces[m]))})),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[l]=t[l]||{},t[l].marketplaces=t[l].marketplaces||{},t[l].marketplaces[c]=p}let i={...this.availableMarketplaces||{}},o={...this.availableMarketplacesById||{}};Object.keys(t||{}).forEach(l=>{try{i[l]=t[l]["."]?{versionHash:t[l]["."].source}:{},Object.keys(t[l].marketplaces||{}).forEach(c=>{try{const p=t[l].marketplaces[c]["."].source,h=this.utils.DecodeVersionHash(p).objectId;i[l][c]={...t[l].marketplaces[c].info||{},tenantName:t[l].marketplaces[c].info.tenant_name,tenantId:t[l].marketplaces[c].info.tenant_id,tenantSlug:l,marketplaceSlug:c,marketplaceId:h,marketplaceHash:p,tenantBranding:(t[l].info||{}).branding||{},order:r.findIndex(m=>m===c)},o[h]=i[l][c],this.marketplaceHashes[h]=p,this.selectedMarketplaceInfo&&(this.selectedMarketplaceInfo.tenantSlug===l&&this.selectedMarketplaceInfo.marketplaceSlug===c||this.selectedMarketplaceInfo.marketplaceId===h)&&(this.selectedMarketplaceInfo=i[l][c])}catch{this.Log(`Eluvio Wallet Client: Unable to load info for marketplace ${l}/${c}`,!0)}})}catch(c){this.Log(`Eluvio Wallet Client: Failed to load tenant info ${l}`,!0,c)}}),this.availableMarketplaces=i,this.availableMarketplacesById=o}async LatestMarketplaceHash({marketplaceParams:e}){const t=await this.MarketplaceInfo({marketplaceParams:e});if(this.previewMarketplaceId&&pa.EqualHash(this.previewMarketplaceId,t.marketplaceId))return this.previewMarketplaceHash;const r=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:da("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug),resolveLinks:!1,noAuth:!0});return j8(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&&pa.EqualHash(r,this.previewMarketplaceId)?o=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"/public/asset_metadata/info",localizationSubtree:this.localization?da("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:da("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"info"),localizationSubtree:this.localization?da("/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:da("/public","asset_metadata","tenants",t.tenantSlug,"info","branding"),authorizationToken:this.publicStaticToken,produceLinkUrls:!0})||{}),o.items=await Promise.all(o.items.map(async(l,c)=>{if(l.requires_permissions){let p;this.loggedIn||(p=await this.client.CreateFabricToken({}));try{await this.client.ContentObjectMetadata({versionHash:j8(l.nft_template),metadataSubtree:"permissioned",authorizationToken:p}),l.authorized=!0}catch{l.authorized=!1}}return l.nftTemplateMetadata=(l.nft_template||{}).nft||{},l.nftTemplateHash=((l.nft_template||{})["."]||{}).source,l.itemIndex=c,l})),o.collections=(o.collections||[]).map((l,c)=>({...l,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(l=>{try{if(o.storefront[l]){let c=new URL("https://embed.v3.contentfabric.io");const p=j8(o.storefront[l]);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",""),l.startsWith("reveal")||(c.searchParams.set("m",""),c.searchParams.set("lp","")),o.storefront[`${l}_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:l,contractAddress:c,tokenId:p,currency:h,marketplaceParams:m,tenantId:w,collectionIndexes:b,priceRange:g,tokenIdRange:S,capLimit:A,userAddress:k,sellerAddress:R,lastNDays:L=-1,startTime:I,endTime:q,includeCheckoutLocked:G=!1,start:de=0,limit:oe=50}={}){b=(b||[]).map(ne=>parseInt(ne));let ye={start:de,limit:oe,sort_descending:r};e==="owned"&&t==="created"&&(t="default"),e!=="leaderboard"&&(ye.sort_by=t),e.includes("listings")&&G&&(ye.checkout=!0);let Se,Ce;m&&(Se=await this.MarketplaceInfo({marketplaceParams:m}),b.length>0&&(Ce=await this.Marketplace({marketplaceParams:m})));try{let ne=[];R?ne.push(`seller:eq:${this.client.utils.FormatAddress(R)}`):k&&e!=="owned"&&ne.push(`addr:eq:${this.client.utils.FormatAddress(k)}`),Ce&&b.length>=0?b.forEach(F=>{Ce.collections[F].items.forEach(Q=>{if(!Q)return;const ae=Ce.items.find(T=>T.sku===Q);if(!ae)return;const N=pa.SafeTraverse(ae,"nft_template","nft","address");N&&ne.push(`${e==="owned"?"contract_addr":"contract"}:eq:${pa.FormatAddress(N)}`)})}):(Se||w)&&ne.push(`tenant:eq:${Se?Se.tenantId:w}`),c?(e==="owned"?ne.push(`contract_addr:eq:${pa.FormatAddress(c)}`):ne.push(`contract:eq:${pa.FormatAddress(c)}`),p&&ne.push(`token:eq:${p}`)):i&&(e.includes("listing")?ne.push(`nft/display_name:eq:${i}`):e==="owned"?ne.push(`meta/display_name:eq:${i}`):ne.push(`name:eq:${i}`)),o&&o.forEach(F=>{e.includes("listing")?ne.push(`nft/edition_name:eq:${F}`):e==="owned"?(ne.push(`meta:@>:{"edition_name":"${F}"}`),ye.exact=!1):ne.push(`edition:eq:${F}`)}),l&&l.map(({name:F,value:H})=>{!F||!H||ne.push(`nft/attributes/${F}:eq:${H}`)}),h&&ne.push("link_type:eq:sol"),I||q?(I&&ne.push(`created:gt:${parseInt(I)/1e3}`),q&&ne.push(`created:lt:${parseInt(q)/1e3}`)):L&&L>0&&ne.push(`created:gt:${(Date.now()/1e3-L*24*60*60).toFixed(0)}`),g&&(g.min&&ne.push(`price:ge:${parseFloat(g.min)}`),g.max&&ne.push(`price:le:${parseFloat(g.max)}`)),S&&(S.min&&ne.push(`info/token_id:ge:${parseInt(S.min)}`),S.max&&ne.push(`info/token_id:le:${parseInt(S.max)}`)),A&&ne.push(`info/cap:le:${parseInt(A)}`);let Le,C;switch(e){case"owned":C=da("as","wlt",k||this.UserAddress());break;case"owned-full-meta":C=da("as","apigw","nfts"),Le={Authorization:`Bearer ${this.AuthToken()}`};break;case"listings":C=da("as","mkt","f");break;case"transfers":C=da("as","mkt","hst","f"),ne.push("action:eq:TRANSFERRED"),ne.push("action:eq:SOLD");break;case"sales":C=da("as","mkt","hst","f"),ne.push("action:eq:SOLD"),ne.push("seller:co:0x");break;case"listing-stats":C=da("as","mkt","stats","listed");break;case"sales-stats":C=da("as","mkt","stats","sold"),ne.push("seller:co:0x");break;case"leaderboard":C=da("as","wlt","leaders");break}if(ne.length>0&&(ye.filter=ne),e.includes("stats"))return await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:ye,headers:Le}));const{contents:x,paging:O}=await pa.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:ye,headers:Le}))||[],z=["owned","listings","owned-full-meta"];return{paging:{start:ye.start,limit:ye.limit,total:O.total,more:O.total>de+oe},results:(x||[]).map(F=>z.includes(e)?Fde(this,F):F)}}catch(ne){if(ne.status&&ne.status.toString()==="404")return{paging:{start:ye.start,limit:ye.limit,total:0,more:!1},results:[]};throw ne}}async MintingStatus({marketplaceParams:e,tenantId:t}){t||(t=(await this.MarketplaceInfo({marketplaceParams:e||this.selectedMarketplaceInfo})).tenantId);try{return(await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("as","wlt","status","act",t),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))).map(i=>{let[o,l,c]=i.op.split(":");l=l.startsWith("0x")?pa.FormatAddress(l):l;let p,h,m,w;if(o==="nft-buy"?p=c:o==="nft-claim"?(p=c,i.marketplaceId=l,i.extra&&i.extra[0]&&(l=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"&&(w=i.extra.gift_id)),o==="nft-offer-redeem"&&(m=i.op.split(":")[3]),o==="nft-claim-entitlement"){let[b,g,S,A]=i.op.split(":");p=A,i.extra&&i.extra[0]&&(l=i.extra[0].token_addr,h=i.extra[0].token_id,l=l.startsWith("0x")?pa.FormatAddress(l):l,i.marketplaceId=g)}return{...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:pa.FormatAddress(l),tokenId:h,offerId:m,giftId:w}}).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,environment:i="production"}){if(!r){const c=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:da("public/asset_metadata/tenants",t),resolveLinks:!0,linkDepthLimit:1,resolveIncludeSource:!0,resolveIgnoreErrors:!0,select:["."]});if(!c)throw Error(`Eluvio Wallet Client: Invalid or missing tenancy: ${t}`);const p=c["."].source;r=await this.client.LatestVersionHash({versionHash:p})}const o={content_hash:r,env:i,ts:Date.now()},l=await this.client.Sign(JSON.stringify(o));await this.client.authClient.MakeAuthServiceRequest({path:da("as","tnt","config",e,"metadata"),method:"POST",body:o,headers:{Authorization:`Bearer ${l}`}})}}Object.assign(Td.prototype,Pde());Object.assign(Td.prototype,Ide());Object.assign(Td.prototype,Dde());const{ElvClient:Hde}=H4,$de=ki;var qde=Hde,Pd=$de;const Rz=Object.freeze(Object.defineProperty({__proto__:null,ElvClient:qde,Utils:Pd},Symbol.toStringTag,{value:"Module"})),zP={default:{label:"Default",hlsSettings:Pd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class Vde{constructor({player:e}){this.player=e,this.visible=!0,this.allowRotation=!0,this._activeMenus=0}__ToggleMenu(e){this._activeMenus=e?this._activeMenus+1:Math.max(0,this._activeMenus-1),this.player.__SettingsUpdate()}IsVisible(){return this.visible}IsMenuVisible(){return this._activeMenus>0}IsReady(){return!this.player.loading}IsPlaying(){return this.player.casting?this.player.castHandler.IsPlaying():!this.player.video.paused}HasPlaybackStarted(){return this.player.playbackStarted}async Play(){return this.player.casting?this.player.castHandler.Play():await this.player.__Play()}Pause(){if(this.player.casting)return this.player.castHandler.Pause();this.player.video.pause()}TogglePlay(){return this.player.casting?this.player.castHandler.TogglePlay():this.player.video.paused?(this.Play(),!0):(this.Pause(),!1)}Stop(){if(this.player.casting)return this.player.castHandler.Stop();this.Pause(),this.Seek({time:0}),this.player.playbackStarted=!1,this.player.__SettingsUpdate()}GetCurrentTime(){return this.player.casting?this.player.castHandler.GetCurrentTime():this.player.video.currentTime}GetDuration(){return this.player.casting?this.player.castHandler.GetDuration():this.player.video.duration}Seek({fraction:e,time:t,relativeSeconds:r}){if(this.player.casting)return this.player.castHandler.Seek({fraction:e,time:t,relativeSeconds:r});if(!this.player.video||e&&!this.player.video.duration)return;this.player.canPlay||(this.Play(),this.Pause());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.casting?this.player.castHandler.GetVolume():this.player.video.volume}SetVolume({fraction:e,relativeFraction:t}){return this.player.casting?this.player.castHandler.SetVolume({fraction:e,relativeFraction:t}):(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.casting?this.player.castHandler.IsMuted():this.player.video.muted}Mute(){if(this.player.casting)return this.player.castHandler.Mute();this.player.video.muted=!0}Unmute(){if(this.player.casting)return this.player.castHandler.Unmute();this.player.video.muted=!1}ToggleMuted(){return this.player.casting?this.player.castHandler.ToggleMuted():(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),this.Seek({time:this.GetCurrentTime()-.1});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(e);e>=0&&(this.__lastTextTrackIndex=e),setTimeout(()=>this.player.__SettingsUpdate(),500)}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}}GetPlaybackRate(){return this.player.casting?this.player.castHandler.GetPlaybackRate():this.player.video.playbackRate||1}GetPlaybackRates(){const e=this.GetPlaybackRate();let t=["0.25","0.5","0.75","1","1.25","1.5","1.75","2"];this.player.casting&&(t=["0.5","0.75","1","1.25","1.5","1.75","2"]),t=t.map((i,o)=>({index:o,rate:parseFloat(i),label:`${i}x`,active:e.toFixed(2)===parseFloat(i).toFixed(2)}));let r=t.find(i=>i.active);return r||(r={index:-1,rate:this.GetPlaybackRate(),label:`${this.GetPlaybackRate()}x`,active:!0}),{options:t,active:r}}SetPlaybackRate({index:e,rate:t}){if(this.player.casting)return this.player.castHandler.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}}}IsDVRAvailable(){return this.player.dvrAvailable&&!this.player.casting&&isFinite(this.GetDuration())}IsDVREnabled(){return this.player.dvrEnabled}SetDVREnabled(e){const t=this.player.dvrEnabled;return this.player.dvrEnabled=this.IsDVRAvailable()&&e,this.player.__SettingsUpdate(),t&&!this.player.dvrEnabled&&this.Seek({time:this.GetDuration()-2}),this.player.dvrEnabled}GetPlayerProfiles(){let e=[];return this.player.hlsPlayer&&(e=Object.keys(zP).map(t=>({index:t,label:zP[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()}ContentVerified(){return this.player.contentVerified||!1}GetContentVerificationDetails(){return this.player.contentAudit||!1}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()}GetDebugInfo(){const e=JSON.parse(JSON.stringify(this.player.sourceOptions));delete e.playoutOptions;let t=this.player.__error&&JSON.parse(JSON.stringify(this.player.__error));return t&&Object.keys(t).length===0&&(t=this.player.__error.toString()),{appUrl:window.location.href,userAddress:this.player.userAddress,userAgent:navigator.userAgent,userLanguage:navigator.language,playoutUrl:this.player.playoutUrl,sourceOptions:e,error:t}}}const Pn={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"},Oz=({player:n,setRecentUserAction:e,sideClickRatio:t=.1,doubleClickDelay:r=300})=>{let i,o,l,c;return window.addEventListener("focus",()=>{l=c||document.activeElement,c=document.activeElement},!0),()=>p=>{if(clearTimeout(o),p.target===p.currentTarget&&p.currentTarget.contains(l)&&!p.currentTarget.classList.contains("menu-active"))if(Date.now()-i<r){const h=p.target.getBoundingClientRect(),m=(p.clientX-h.left)/h.width;m<=t?(n.controls.Seek({relativeSeconds:-10}),e({action:Pn.SEEK_BACK,text:"10 seconds"})):m>=1-t?(n.controls.Seek({relativeSeconds:10}),e({action:Pn.SEEK_FORWARD,text:"10 seconds"})):n.controls.ToggleFullscreen()}else o=setTimeout(()=>{const h=n.controls.TogglePlay();e({action:h?Pn.PLAY:Pn.PAUSE})},r);l=p.target,i=Date.now()}},Lz=(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:Pn.SEEK_BACK,text:`${i} seconds`});break;case"ArrowRight":r.preventDefault(),n.controls.Seek({relativeSeconds:i}),e({action:Pn.SEEK_FORWARD,text:`${i} seconds`});break;default:return}t+=1}},Gde=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}},s2=(n,e)=>{if(isNaN(e)||!isFinite(e)||e===0)return"00:00";const t=n>60*60,r=Math.floor(n/60/60),i=Math.floor(n/60%60),o=Math.floor(n%60);let l=`${i.toString().padStart(t?2:1,"0")}:${o.toString().padStart(2,"0")}`;return t&&(l=`${r.toString()}:${l}`),l},fk=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:l}=n.sourceOptions&&n.sourceOptions.mediaCollectionOptions||{},c=n.sourceOptions&&n.sourceOptions.playoutParameters||{};return l?i=l: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})):""},Nz=(n,e)=>{let t={};return Object.keys(n).forEach(r=>{if(typeof n[r]=="object"&&!Array.isArray(n[r]))t[r]=Nz(n[r],(e||{})[r]);else{const i=(e||{})[r];t[r]=typeof i<"u"?i:n[r]}}),t},Pz=n=>Nz(jG,n),Wde=/iPhone|iPad|iPod/i.test(navigator.userAgent),jP=window.__chromecastAvailable||!!(window.chrome&&window.chrome.cast),Kde={default:{label:"Default",hlsSettings:Pd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class o2{__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.latest=!0,this.loading=!0,this.target=e,this.video=t,this.controls=new Vde({player:this}),this.__settingsListeners=[],this.__listenerDisposers=[],this.__showPlayerProfileForm=!1,this.playbackStarted=!1,this.reloads=0,this.canPlay=!1,this.isLive=!1,this.dvrEnabled=!1,this.dvrAvailable=!1,this.behindLiveEdge=!1,this.publicMetadataUrl=void 0,this.airplayAvailable=!1,this.chromecastAvailable=jP&&r.playerOptions.allowCasting,this.casting=!1,this.usePlayerControls=[Ft.controls.ON,Ft.controls.AUTO_HIDE].includes(r.playerOptions.controls),this.__error=void 0,this.SetErrorMessage=(o,l)=>{i(o),this.__error=l};try{r.playerOptions.hlsjsOptions&&Object.keys(r.playerOptions.hlsjsOptions).length>0&&(this.customHLSOptions=r.playerOptions.hlsjsOptions,r.playerOptions.playerProfile=Ft.playerProfile.CUSTOM)}catch(o){this.Log(o,!0)}this.__Initialize(r)}async __Client(){if(this.clientPromise&&await this.clientPromise,this.clientOptions.client||(this.clientPromise=(async()=>{const{ElvClient:e}=await Promise.resolve().then(()=>Rz);return this.clientOptions.client=await e.FromConfigurationUrl({configUrl:this.clientOptions.network}),this.clientOptions.staticToken&&this.clientOptions.client.SetStaticToken({token:this.clientOptions.staticToken}),this.clientOptions.client})(),await this.clientPromise),!this.__tokenResolved){const e=(this.sourceOptions.playoutParameters||{}).authorizationToken||this.clientOptions.client.staticToken;if(e)try{JSON.parse(Pd.FromB64(e)).qspace_id&&(this.sourceOptions.playoutParameters.authorizationToken=await this.clientOptions.client.CreateFabricToken({duration:7*24*60*60*1e3}))}catch{}this.__tokenResolved=!0}return this.userAddress=this.clientOptions.client.CurrentAccountAddress(),this.clientOptions.client}async __PlayoutOptions(){const e=await this.__Client(),t=this.sourceOptions.playoutParameters||{};if(this.collectionInfo){const A=this.collectionInfo.content[this.collectionInfo.mediaIndex];t.objectId=e.utils.DecodeVersionHash(A.mediaHash).objectId,t.versionHash=A.mediaHash,this.sourceOptions.playoutOptions=void 0}let r,i,o={};(t.clipStart||t.clipEnd)&&(o.clip_start=parseFloat(t.clipStart||0),t.clipEnd&&(o.clip_end=parseFloat(t.clipEnd)));let l=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=l.default?"default":Object.keys(l)[0],t.offering?r=l[t.offering]?t.offering:void 0:(t.offerings||[]).length>0?r=t.offerings.find(A=>l[A]):t.offerings&&t.offerings.length>0&&(r=t.offerings.find(A=>l[A])),!r)throw new Error(`Unable to find offering from '${t.offering||t.offerings}'`);const c=l[r]&&l[r].properties||{};i=l[r].uri,o.ignore_trimming=t.ignoreTrimming,o.resolve=t.resolve,this.sourceOptions.contentInfo.liveDVR===Ft.liveDVR.ON&&c.dvr_available?(o.dvr=1,this.dvrAvailable=!0):this.dvrAvailable=!1,c.live?this.isLive=!0:this.isLive=!1,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 p=(await e.AvailableDRMs()).filter(A=>(this.sourceOptions.drms||[]).includes(A)),h=this.sourceOptions.protocols,m,w;for(;!(m&&w);){m=h.find(k=>this.sourceOptions.playoutOptions[k]);const A=Object.keys(this.sourceOptions.playoutOptions[m].playoutMethods);if(w=(this.sourceOptions.drms||[]).length===0?A.find(k=>k!=="clear")||A[0]:this.sourceOptions.drms.find(k=>p.includes(k)&&this.sourceOptions.playoutOptions[m].playoutMethods[k]),!w&&(h=h.filter(k=>k!==m),h.length===0))throw Error("No valid protocol / DRM combination available")}const{playoutUrl:b,drms:g}=this.sourceOptions.playoutOptions[m].playoutMethods[w],S=b.split("/").find(A=>A.startsWith("hq__"));return{playoutParameters:{...t,options:o},protocol:m,drm:w,playoutUrl:b,versionHash:S,drms:g,availableDRMs:p,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(m=>m.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.initialized=!1,this.loading=!0,this.initTime=Date.now(),this.restartParameters=t,this.__SettingsUpdate(),e&&(this.originalParameters=Pz(e),this.clientOptions=e.clientOptions,this.sourceOptions=e.sourceOptions,this.playerOptions=e.playerOptions),this.errors=0,this.__Client();try{t&&(this.video.volume=t.volume,this.video.muted=t.muted,t.playing&&(this.playerOptions.autoplay=Ft.autoplay.ON),t.currentTime&&this.__RegisterVideoEventListener("loadedmetadata",()=>this.video.currentTime=t.currentTime)),this.usePlayerControls&&this.playerOptions.allowCasting&&(this.castHandler=new pW({player:this,onReady:()=>{this.chromecastAvailable=!0,this.__SettingsUpdate()},onUpdate:()=>{this.__SettingsUpdate()}})),this.__RegisterVideoEventListener("webkitplaybacktargetavailabilitychanged",w=>{this.airplayAvailable=w.availability==="available",this.__SettingsUpdate()}),this.__RegisterVideoEventListener("play",()=>{this.reloads=0,this.playbackStarted=!0,this.__SettingsUpdate()}),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,this.video.textTracks&&this.video.textTracks.addEventListener("change",()=>this.__SettingsUpdate()),this.video.audioTracks&&this.video.audioTracks.addEventListener("change",()=>this.__SettingsUpdate()),this.playerOptions.startTime?this.controls.Seek({time:parseFloat(this.playerOptions.startTime)}):this.playerOptions.startProgress&&this.controls.Seek({fraction:parseFloat(this.playerOptions.startProgress)}),this.playerOptions.autoplay===Ft.autoplay.ON&&this.controls.Play())}),this.__RegisterVideoEventListener("seeking",()=>{if(!this.isLive||!this.dvrAvailable)return;const w=this.video.duration-this.video.currentTime;this.behindLiveEdge=w>15,this.__SettingsUpdate()}),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{versionHash:r,playoutUrl:i,protocol:o,drm:l,drms:c,multiviewOptions:p,playoutParameters:h}=await this.__PlayoutOptions();this.contentHash=r,i=new URL(i);const m=this.sourceOptions.playoutParameters.authorizationToken||i.searchParams.get("authorization");if(this.authorizationToken=m,this.playoutUrl=i.toString(),this.castHandler&&this.castHandler.SetMedia({playoutOptions:this.sourceOptions.playoutOptions,playoutParameters:h}),this.__destroyed)return;o==="hls"?await this.__InitializeHLS({playoutUrl:i,authorizationToken:m,drm:l,drms:c,multiviewOptions:p}):await this.__InitializeDash({playoutUrl:i,authorizationToken:m,drm:l,drms:c,multiviewOptions:p}),this.playerOptions.collectVideoAnalytics&&Promise.resolve().then(()=>require("./Analytics-DwDiR9Sr.js")).then(({InitializeMuxMonitoring:w})=>w({appName:this.playerOptions.appName||"elv-player-js",elvPlayer:this,playoutUrl:i,authorizationToken:m,disableCookies:this.playerOptions.collectVideoAnalytics===Ft.collectVideoAnalytics.DISABLE_COOKIES})),this.playerOptions.verifyContent&&setTimeout(()=>{this.__VerifyContent()},1e3),this.playerOptions.playerCallback&&this.playerOptions.playerCallback({player:this,videoElement:this.video,hlsPlayer:this.hlsPlayer,dashPlayer:this.dashPlayer}),this.__destroyed&&this.__DestroyPlayer(),this.initialized=!0,this.restartParameters=void 0}catch(r){let i;if(r&&[401,403].includes(r.status)||[401,403].includes(r.code))try{const o=await this.__Client(),l=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:l,metadataSubtree:"public/asset_metadata/permission_message",authorizationToken:this.sourceOptions.playoutParameters.authorizationToken}),i?(r.permission_message=i,this.SetErrorMessage(i,r),typeof r=="object"?r.permission_message=i:this.Log(i,!0)):this.SetErrorMessage(r.displayMessage||"Insufficient permissions",r)}catch(o){this.SetErrorMessage(o.displayMessage||"Insufficient permissions",o)}else r.status>=500?this.__HardReload(r,1e4):this.__HardReload(r,2e4);this.playerOptions.errorCallback&&this.playerOptions.errorCallback(r,this)}finally{this.loading=!1,this.__SettingsUpdate()}}}async __InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,drms:i,multiviewOptions:o}){this.HLS=(await Promise.resolve().then(()=>require("./hls-VH5py-kh.js"))).default;const l=this.video.canPlayType("application/vnd.apple.mpegURL");if(l&&Wde||[Ft.drms.FAIRPLAY,Ft.drms.SAMPLE_AES].includes(r)||!this.HLS.isSupported()){if(this.nativeHLS=!0,r===Ft.drms.FAIRPLAY?dW({playoutOptions:this.sourceOptions.playoutOptions,video:this.video}):this.video.src=e.toString(),o.enabled){const c=o.SwitchView;o.SwitchView=async p=>{await c(p)}}}else{e.searchParams.delete("authorization");let c={};(r===Ft.drms.PLAYREADY||r===Ft.drms.WIDEVINE)&&(c={drmSystems:{},emeEnabled:!0,licenseXhrSetup:(w,b)=>{w.open("POST",b,!0),w.setRequestHeader("Authorization",`Bearer ${t}`)}},r===Ft.drms.PLAYREADY?c.drmSystems={"com.microsoft.playready":{licenseUrl:i[r].licenseServers[0]}}:r===Ft.drms.WIDEVINE&&(c.drmSystems={"com.widevine.alpha":{licenseUrl:i[r].licenseServers[0]}}));const p=(Kde[this.playerOptions.playerProfile]||{}).hlsSettings||{},h=this.playerOptions.playerProfile===Ft.playerProfile.CUSTOM?this.customHLSOptions:{};this.hlsOptions={capLevelToPlayerSize:this.playerOptions.capLevelToPlayerSize,xhrSetup:w=>(w.setRequestHeader("Authorization",`Bearer ${t}`),(this.playerOptions.hlsjsOptions||{}).xhrSetup&&this.playerOptions.hlsjsOptions.xhrSetup(w),w),...c,...p,...h},this.dvrAvailable&&(delete this.hlsOptions.liveMaxLatencyDuration,delete this.hlsOptions.liveMaxLatencyDurationCount);const m=new this.HLS(this.hlsOptions);if(this.playerOptions.maxBitrate&&m.on(this.HLS.Events.MANIFEST_PARSED,(w,{levels:b,firstLevel:g})=>{let S=b.map((A,k)=>A.bitrate>this.playerOptions.maxBitrate?k:void 0).filter(A=>typeof A<"u").reverse();S.length===b.length&&(this.Log(`Warning: Max bitrate '${this.playerOptions.maxBitrate}bps' is less than all available levels for this content.`),S=S.filter(A=>A>0)),this.Log("Removing the following levels due to maxBitrate setting:"),this.Log(S.map(A=>[b[A].width,"x",b[A].height,` (${(b[A].bitrate/1e3/1e3).toFixed(1)}Mbps)`].join("")).join(", ")),S.find(A=>g===A)&&(m.startLevel=b.map((A,k)=>k).filter(A=>!S.includes(A)).reverse()[0]),S.map(A=>m.removeLevel(A))}),m.loadSource(e.toString()),m.attachMedia(this.video),this.controls&&o.enabled){const w=o.SwitchView;o.SwitchView=async b=>{await w(b),m.nextLevel=m.currentLevel},this.controls.InitializeMultiViewControls(o)}if([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(w=>m.on(w,()=>this.__SettingsUpdate())),typeof this.sourceOptions.playoutParameters.audioTrackLabel<"u"&&m.on(this.HLS.Events.AUDIO_TRACKS_UPDATED,()=>{const w=(this.controls.GetAudioTracks().options||[]).find(b=>b.label===this.sourceOptions.playoutParameters.audioTrackLabel);w&&this.controls.SetAudioTrack(w.index)}),this.SetPlayerProfile=async({profile:w,customHLSOptions:b={}})=>{this.videoDuration=void 0,this.playerOptions.playerProfile=w,this.customHLSOptions=b;const g=!this.video.paused,S=this.video.currentTime;try{this.hlsPlayer.destroy()}catch(A){this.Log("Failed to destroy HLS player",!0),this.Log(A,!0)}await this.__InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,multiviewOptions:o}),g?this.video.play():this.video.pause(),this.isLive||(this.video.currentTime=S)},m.on(this.HLS.Events.FRAG_LOADED,()=>this.errors=0),m.on(this.HLS.Events.ERROR,async(w,b)=>{this.errors+=1,this.Log(`Encountered ${b.details}`,!0),this.Log(b,!0),b.response&&b.response.code===403?this.SetErrorMessage("Insufficient permissions",b):this.errors<5?b.fatal&&(b.data&&b.data.type===this.HLS.ErrorTypes.MEDIA_ERROR?(this.Log("Attempting to recover using hlsPlayer.recoverMediaError"),m.recoverMediaError()):this.__HardReload(b)):this.__HardReload(b)}),this.hlsPlayer=m,this.player=m,l){const w=document.createElement("source");w.src=this.playoutUrl.toString(),this.video.appendChild(w),this.video.disableRemotePlayback=!1}}}async __InitializeDash({playoutUrl:e,authorizationToken:t,drm:r,drms:i}){this.Dash=(await Promise.resolve().then(()=>require("./dash.all.min-CUif2q1p.js")).then(c=>c.dash_all_min)).default;const o=this.Dash.MediaPlayer().create(),l=this.playerOptions.dashjsOptions||{};if(o.updateSettings({...l,streaming:{buffer:{fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!0,...(l.streaming||{}).buffer||{}},text:{defaultEnabled:!1,...(l.streaming||{}).text||{}},...l.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===Ft.drms.WIDEVINE){const c=i.widevine.licenseServers[0];o.setProtectionData({"com.widevine.alpha":{serverURL:c}})}o.initialize(this.video,e.toString(),this.playerOptions.autoplay===Ft.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())),typeof this.sourceOptions.playoutParameters.audioTrackLabel<"u"&&o.on(this.Dash.MediaPlayer.events.CAN_PLAY,()=>{const c=(this.controls.GetAudioTracks().options||[]).find(p=>p.label===this.sourceOptions.playoutParameters.audioTrackLabel);c&&this.controls.SetAudioTrack(c.index)}),this.video.textTracks.addEventListener("change",()=>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===Ft.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}}async __PublicMetadataUrl({versionHash:e,authorizationToken:t}){const r=await this.__Client();let i=!1;try{await r.ContentObjectMetadata({versionHash:e,metadataSubtree:"/public/name",noAuth:!0})}catch{i=!0}let o=new URL(r.NetworkInfo().name==="main"?"https://main.net955305.contentfabric.io":"https://demov3.net955210.contentfabric.io"),l=`s/${r.NetworkInfo().name}`;return i&&(l=`t/${t}`),o.pathname=`${l}/q/${e}/meta/public`,o.toString()}async __VerifyContent(){if(!this.contentHash)return;const e=await this.__Client(),t=this.isLive?await e.AuditStream({versionHash:this.contentHash,authorizationToken:this.authorizationToken}):await e.AuditContentObject({versionHash:this.contentHash,authorizationToken:this.authorizationToken});if(!t.verified)return;t.verifiedAt=Date.now();const r=e.utils.DecodeVersionHash(this.contentHash).objectId;t.details={_state:"initial",versionHash:this.contentHash,objectId:r,address:e.utils.HashToAddress(r),signatureMethod:"ECDSA secp256k1"},this.contentAudit=t,this.contentVerified=t.verified,this.publicMetadataUrl=await this.__PublicMetadataUrl({versionHash:this.contentHash,authorizationToken:this.authorizationToken}),this.__SettingsUpdate()}async __LoadVerificationDetails(){if(!this.contentHash||!this.contentAudit||this.contentAudit.details._state!=="initial"||this.contentAudit.loading)return;this.contentAudit.loading=!0;const e=await this.__Client(),t=e.utils.DecodeVersionHash(this.contentHash).objectId,r=await e.ContentObjectTenantId({objectId:t});let i,o,l;try{o=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"objectTimestamp"}),o&&(o=new Date(parseInt(o._hex,16)*1e3)),l=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"countVersionHashes"}),l&&(l=parseInt(l._hex,16))}catch{}try{i=await e.ContentObjectMetadata({libraryId:e.contentSpaceLibraryId,objectId:r.replace("iten","iq__"),metadataSubtree:"/public/name"})}catch{}this.contentAudit.details={_state:"minus-tx",versionHash:this.contentHash,objectId:t,address:e.utils.HashToAddress(t),explorerUrl:e.NetworkInfo().name!=="main"?void 0:`https://explorer.contentfabric.io/address/${e.utils.HashToAddress(t)}`,tenantId:r,tenantAddress:e.utils.HashToAddress(r),tenantName:i,ownerAddress:await e.ContentObjectOwner({objectId:t}),lastCommittedAt:o,versionCount:l,latestVersionHash:await e.LatestVersionHash({objectId:t}),signatureMethod:"ECDSA secp256k1"},this.__SettingsUpdate();try{if(e.NetworkInfo().name==="main"){const c=new URL("https://explorer.contentfabric.io/api");c.searchParams.set("module","account"),c.searchParams.set("action","txlist"),c.searchParams.set("offset","1"),c.searchParams.set("address",e.utils.HashToAddress(t)),this.contentAudit.details.latestTransactionHash=(await(await fetch(c)).json()).result[0].hash,this.contentAudit.details.latestTransactionHashUrl=`https://explorer.contentfabric.io/tx/${this.contentAudit.details.latestTransactionHash}`}}catch{}finally{this.contentAudit.details._state="full",delete this.contentAudit.loading,this.__SettingsUpdate()}}__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.castHandler&&this.castHandler.Destroy(),this.__destroyed=!0,this.__Reset()}__Reset(){if(this.player){this.Log("Destroying player"),this.video&&this.video.pause();try{this.hlsPlayer?this.hlsPlayer.destroy():this.dashPlayer&&this.dashPlayer.destroy()}catch(e){this.Log("Failed to destroy abr player",!0),this.Log(e,!0)}if(this.__listenerDisposers.forEach(e=>{try{e()}catch(t){this.Log("Failed to dispose of video event listener",!0),this.Log(t,!0)}}),this.__settingsListeners=[],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.contentHash=void 0,this.nativeHLS=!1,this.hlsPlayer=void 0,this.dashPlayer=void 0,this.player=void 0,this.initTimeLogged=!1,this.canPlay=!1,this.isLive=!1,this.behindLiveEdge=!1,this.dvrAvailable=!1,this.dvrEnabled=!1,this.publicMetadataUrl=void 0,this.airplayAvailable=!1,this.chromecastAvailable=jP&&this.playerOptions.allowCasting,this.casting=!1,this.__error=void 0}}async __HardReload(e,t=6e3){if(!this.reloading){if(this.reloading=!0,this.reloads+=1,this.reloads>10){this.SetErrorMessage(e&&e.displayMessage||"Unable to play content",e);return}try{if(e&&this.playerOptions.restartCallback)try{const r=await this.playerOptions.restartCallback(e);if(r&&typeof r=="boolean"){this.Destroy();return}}catch(r){this.Log("Restart callback failed:"),this.Log(r)}if(this.SetErrorMessage(e&&e.displayMessage||"Something went wrong, reloading player...",e),await new Promise(r=>setTimeout(r,t)),this.__destroyed)return;this.Log("Reloading stream");try{const r=await this.__Client();r.region?await r.UseRegion({region:r.region}):r.Nodes().fabricURIs.length>1&&await r.ResetRegion()}catch(r){this.Log("Client region reset failed:"),this.Log(r)}this.restarted=!0,this.SetErrorMessage(void 0),this.__Initialize(this.originalParameters,!this.video||!this.initialized?this.restartParameters:{muted:this.video.muted,volume:this.video.volume,currentTime:this.video.currentTime,playing:!this.video.paused})}finally{this.reloading=!1}}}Log(e,t=!1){t?console.error("ELUVIO PLAYER:",e):this.playerOptions.debugLogging&&console.warn("ELUVIO PLAYER:",e)}__SetCasting(e){e&&(this.controls.SetDVREnabled(!1),this.controls.Pause()),this.casting=e,this.__SettingsUpdate()}}o2.EluvioPlayerParameters=Ft;o2.EluvioPlayer=o2;var Iz=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 l=o[i];t.call(r,l[1],l[0])}},e}()}(),z4=typeof window<"u"&&typeof document<"u"&&window.document===document,l2=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")()}(),Yde=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(l2):function(n){return setTimeout(function(){return n(Date.now())},1e3/60)}}(),Jde=2;function Qde(n,e){var t=!1,r=!1,i=0;function o(){t&&(t=!1,n()),r&&c()}function l(){Yde(o)}function c(){var p=Date.now();if(t){if(p-i<Jde)return;r=!0}else t=!0,r=!1,setTimeout(l,e);i=p}return c}var Zde=20,Xde=["top","right","bottom","left","width","height","size","weight"],epe=typeof MutationObserver<"u",tpe=function(){function n(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Qde(this.refresh.bind(this),Zde)}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(){!z4||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),epe?(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(){!z4||!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=Xde.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}(),Dz=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},im=function(n){var e=n&&n.ownerDocument&&n.ownerDocument.defaultView;return e||l2},Uz=uS(0,0,0,0);function u2(n){return parseFloat(n)||0}function HP(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+u2(o)},0)}function npe(n){for(var e=["top","right","bottom","left"],t={},r=0,i=e;r<i.length;r++){var o=i[r],l=n["padding-"+o];t[o]=u2(l)}return t}function rpe(n){var e=n.getBBox();return uS(0,0,e.width,e.height)}function ape(n){var e=n.clientWidth,t=n.clientHeight;if(!e&&!t)return Uz;var r=im(n).getComputedStyle(n),i=npe(r),o=i.left+i.right,l=i.top+i.bottom,c=u2(r.width),p=u2(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==e&&(c-=HP(r,"left","right")+o),Math.round(p+l)!==t&&(p-=HP(r,"top","bottom")+l)),!spe(n)){var h=Math.round(c+o)-e,m=Math.round(p+l)-t;Math.abs(h)!==1&&(c-=h),Math.abs(m)!==1&&(p-=m)}return uS(i.left,i.top,c,p)}var ipe=function(){return typeof SVGGraphicsElement<"u"?function(n){return n instanceof im(n).SVGGraphicsElement}:function(n){return n instanceof im(n).SVGElement&&typeof n.getBBox=="function"}}();function spe(n){return n===im(n).document.documentElement}function ope(n){return z4?ipe(n)?rpe(n):ape(n):Uz}function lpe(n){var e=n.x,t=n.y,r=n.width,i=n.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,l=Object.create(o.prototype);return Dz(l,{x:e,y:t,width:r,height:i,top:t,right:e+r,bottom:i+t,left:e}),l}function uS(n,e,t,r){return{x:n,y:e,width:t,height:r}}var upe=function(){function n(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=uS(0,0,0,0),this.target=e}return n.prototype.isActive=function(){var e=ope(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}(),cpe=function(){function n(e,t){var r=lpe(t);Dz(this,{target:e,contentRect:r})}return n}(),fpe=function(){function n(e,t,r){if(this.activeObservations_=[],this.observations_=new Iz,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 im(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new upe(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 im(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 cpe(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}(),Fz=typeof WeakMap<"u"?new WeakMap:new Iz,Bz=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=tpe.getInstance(),r=new fpe(e,t,this);Fz.set(this,r)}return n}();["observe","unobserve","disconnect"].forEach(function(n){Bz.prototype[n]=function(){var e;return(e=Fz.get(this))[n].apply(e,arguments)}});var dpe=function(){return typeof l2.ResizeObserver<"u"?l2.ResizeObserver:Bz}();const cS=({element:n,Hide:e})=>{if(!n)return;const t=o=>{o&&(o.key||"").toLowerCase()==="escape"&&e()},r=o=>{n.contains(o.target)||e()};let i=setTimeout(()=>{document.body.addEventListener("keydown",t),document.body.addEventListener("click",r,!0)},0);return()=>{clearTimeout(i),document.body.removeEventListener("keydown",t),document.body.removeEventListener("click",r,!0)}},zz=({player:n,setVideoState:e})=>{const t=function(){if(!n||!n.controls)return;const o=n.video.buffered;let l=0;for(let c=0;c<o.length;c++)o.start(c)>n.controls.GetCurrentTime()||o.end(c)>l&&(l=o.end(c));e({playing:n.controls.IsPlaying(),duration:n.controls.GetDuration(),volume:n.controls.GetVolume(),muted:n.controls.IsMuted(),rate:n.controls.GetPlaybackRate(),fullscreen:!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)})},r=["play","pause","volumechange","seeked","durationchange","ratechange"];r.map(o=>n.video.addEventListener(o,t)),n.target.addEventListener("fullscreenchange",t);const i=n.castHandler&&n.castHandler.RegisterListener(t);return()=>{r.map(o=>n.video.removeEventListener(o,t)),n.target.removeEventListener("fullscreenchange",t),i&&i()}},ppe=({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)},dk=({player:n,rate:e=10,setCurrentTime:t})=>{const r=setInterval(()=>{n.controls&&t(n.controls.GetCurrentTime())},1e3/e);return()=>{clearInterval(r)}},hpe=({target:n,setSize:e,setOrientation:t,setDimensions:r})=>{let i;const o=()=>{clearTimeout(i);const c=n.getBoundingClientRect();let p="sm",h="landscape";c.width>1400&&c.height>600?p="xl":c.width>1e3&&c.height>400?p="lg":c.width>650&&c.height>300&&(p="md"),c.width<c.height&&(h="portrait"),e(p),t(h),i=setTimeout(()=>{r({width:c.width,height:c.height})},500)};o();const l=new dpe(o);return l.observe(n),()=>l.disconnect()},ype=({player:n})=>{const e=n.video,t=n.playerOptions.autoplay===Ft.autoplay.WHEN_VISIBLE,r=n.playerOptions.muted===Ft.muted.WHEN_NOT_VISIBLE;if(!t&&!r)return;let i,o;const l=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(l,{threshold:.1}).observe(e);return()=>c&&c.disconnect()},mpe=({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)},l=["play","pause","volumechange","seeking"];l.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)),()=>{l.map(p=>n.video.removeEventListener(p,o)),c.map(p=>n.target.removeEventListener(p,o))}},gpe=({player:n,setRecentUserAction:e})=>{if(n.playerOptions.keyboardControls===Ft.keyboardControls.OFF)return;const t=n.playerOptions.keyboardControls===Ft.keyboardControls.ARROW_KEYS_DISABLED,r=Lz(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 l;switch(o.key){case" ":case"k":l=n.controls.TogglePlay(),e({action:l?Pn.PLAY:Pn.PAUSE});break;case"f":n.controls.ToggleFullscreen();break;case"m":l=n.controls.ToggleMuted(),e({action:l?Pn.MUTE:Pn.UNMUTE});break;case"ArrowDown":t||(l=n.controls.SetVolume({relativeFraction:-.1}),e({action:l===0?Pn.MUTE:Pn.VOLUME_DOWN,text:(l*100).toFixed(0)+"%"}));break;case"ArrowUp":t||(l=n.controls.SetVolume({relativeFraction:.1}),e({action:Pn.VOLUME_UP,text:(l*100).toFixed(0)+"%"}));break;case",":n.video.paused&&(n.controls.Seek({relativeSeconds:-1/60}),e({action:Pn.SEEK_BACK}));break;case".":n.video.paused&&(n.controls.Seek({relativeSeconds:1/60}),e({action:Pn.SEEK_FORWARD}));break;case"ArrowLeft":case"ArrowRight":t||r(o);break;case"j":n.controls.Seek({relativeSeconds:-10}),e({action:Pn.SEEK_BACK,text:"10 seconds"});break;case"l":n.controls.Seek({relativeSeconds:10}),e({action:Pn.SEEK_FORWARD,text:"10 seconds"});break;case"<":case">":const c=n.controls.GetPlaybackRates();c.active?l=n.controls.SetPlaybackRate({index:c.active.index+(o.key==="<"?-1:1)}):l=n.controls.SetPlaybackRate({rate:1}),l&&e({action:l.increase?Pn.PLAYBACK_RATE_UP:Pn.PLAYBACK_RATE_DOWN,text:`${l.rate.toFixed(2)}x`});break;case"c":l=n.controls.ToggleTextTrack(),e({action:l?Pn.SUBTITLES_ON:Pn.SUBTITLES_OFF});break;case"P":n.controls.CollectionPlayPrevious(),e({action:Pn.PLAY_PREVIOUS});break;case"N":n.controls.CollectionPlayNext(),e({action:Pn.PLAY_NEXT});break;case"Home":n.controls.Seek({fraction:0}),e({action:Pn.SEEK_BACK});break;case"End":n.controls.Seek({fraction:1}),e({action:Pn.SEEK_FORWARD});break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":l=n.controls.Seek({fraction:parseFloat(o.key)*.1}),e({action:l?Pn.SEEK_FORWARD:Pn.SEEK_BACK});break;default:return}o.preventDefault()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},vpe=({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)})}}},bpe="_container_fm2ri_1",wpe="_autohide_fm2ri_41",_pe="_fadein_fm2ri_1",xpe="_seek_fm2ri_174",Spe="_controls_fm2ri_207",Cpe="_time_fm2ri_221",Epe="_spacer_fm2ri_279",Ape="_watermark_fm2ri_291",kpe="_menu_fm2ri_37",zn={container:bpe,"container--default-controls":"_container--default-controls_fm2ri_33","bottom-controls-container":"_bottom-controls-container_fm2ri_37",autohide:wpe,"info-container":"_info-container_fm2ri_44","bottom-controls-container--autohide":"_bottom-controls-container--autohide_fm2ri_45","icon-button":"_icon-button_fm2ri_51","icon-button-active":"_icon-button-active_fm2ri_65",fadein:_pe,"info-image-container":"_info-image-container_fm2ri_106","info-image":"_info-image_fm2ri_106","info-text":"_info-text_fm2ri_122","info-headers":"_info-headers_fm2ri_131","info-description":"_info-description_fm2ri_141","info-title":"_info-title_fm2ri_147","info-subtitle":"_info-subtitle_fm2ri_152","center-play-button":"_center-play-button_fm2ri_160","center-play-button--hidden":"_center-play-button--hidden_fm2ri_167",seek:xpe,"bottom-controls-gradient":"_bottom-controls-gradient_fm2ri_194",controls:Spe,"play-pause-button":"_play-pause-button_fm2ri_217",time:Cpe,"live-indicator":"_live-indicator_fm2ri_231","live-indicator--faded":"_live-indicator--faded_fm2ri_241","collection-button-container":"_collection-button-container_fm2ri_249","collection-button-text":"_collection-button-text_fm2ri_254","collection-button-container--loading":"_collection-button-container--loading_fm2ri_263",spacer:Epe,"floating-volume-toggle":"_floating-volume-toggle_fm2ri_283",watermark:Ape,"content-verified-badge":"_content-verified-badge_fm2ri_302","content-verification-menu-button":"_content-verification-menu-button_fm2ri_303","menu-control-container":"_menu-control-container_fm2ri_317",menu:kpe},jz='<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>',Hz='<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>',$z='<?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>',Mpe='<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>',qz='<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="15" cy="15" r="15" fill="currentColor"/><path d="M10 8H14V22H10V8ZM16 8H20V22H16V8Z" fill="black"/></svg>',Tpe='<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>',Rpe='<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>',Ope='<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>',pk='<?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>',Vz='<?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>',Lpe='<?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>',c2='<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>',Npe='<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>',$P='<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>',Ppe='<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>',qP='<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>',Ipe='<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>',hk='<?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>',yk='<?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>',Dpe='<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>',th='<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>',Upe='<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>',Fpe='<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>',Bpe='<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>',zpe='<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>',f2='<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 27.5C15 27.5 25 22.5 25 15V6.25L15 2.5L5 6.25V15C5 22.5 15 27.5 15 27.5Z" stroke="currentColor" stroke-width="2.14286" stroke-linecap="round" stroke-linejoin="round"/><path d="M19.715 11.3574L13.8221 17.8396L11.1436 14.8931" stroke="currentColor" stroke-width="2.14286" stroke-linecap="round" stroke-linejoin="round"/></svg>',VP='<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M23.7508 12.9997V23.7508H13.0003C7.05943 23.7508 2.24919 18.9406 2.24919 12.9997C2.24919 7.05888 7.05943 2.24864 13.0003 2.24864C18.9411 2.24864 23.7508 7.05888 23.7508 12.9997ZM0 12.9997C0 5.82396 5.82396 0 12.9997 0C20.1755 0 26 5.82396 26 12.9997V25.9995H13.0003C5.82396 25.9995 0 20.1755 0 12.9997ZM5.174 13.5197C5.174 16.1976 6.98078 18.4599 9.85371 18.4599C12.2198 18.4599 13.8185 16.9 14.2084 14.8589H11.8686C11.5698 15.7951 10.8155 16.367 9.85371 16.367C8.39758 16.367 7.44886 15.2227 7.44886 13.5202C7.44886 11.8178 8.39813 10.6735 9.85371 10.6735C10.7899 10.6735 11.5305 11.2066 11.8429 12.0903H14.1959C13.7797 10.1011 12.1941 8.58055 9.85371 8.58055C6.96822 8.58001 5.174 10.8418 5.174 13.5197ZM17.3419 8.83999H15.132V18.2131H17.4331V13.3253C17.4331 12.4022 17.6931 11.8041 18.1349 11.4273C18.5249 11.0761 19.0318 10.8942 19.8642 10.8942H20.4491V8.72256H19.8773C18.668 8.72256 17.8624 9.16442 17.3424 9.8406V8.82633V8.83999H17.3419Z" fill="currentColor"/></svg>',jpe='<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-copy"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>',Gz='<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-airplay"><path d="M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"></path><polygon points="12 15 17 21 7 21 12 15"></polygon></svg>',Hpe='<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-cast"><path d="M2 16.1A5 5 0 0 1 5.9 20M2 12.05A9 9 0 0 1 9.95 20M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6"></path><line x1="2" y1="20" x2="2.01" y2="20"></line></svg>',$pe='<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-info"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>';(function(n,e){(function(t,r){r()})(Fa,function(){function t(i){var o=!0,l=!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(G){return!!(G&&G!==document&&G.nodeName!=="HTML"&&G.nodeName!=="BODY"&&"classList"in G&&"contains"in G.classList)}function m(G){var de=G.type,oe=G.tagName;return!!(oe==="INPUT"&&p[de]&&!G.readOnly||oe==="TEXTAREA"&&!G.readOnly||G.isContentEditable)}function w(G){G.classList.contains("focus-visible")||(G.classList.add("focus-visible"),G.setAttribute("data-focus-visible-added",""))}function b(G){G.hasAttribute("data-focus-visible-added")&&(G.classList.remove("focus-visible"),G.removeAttribute("data-focus-visible-added"))}function g(G){G.metaKey||G.altKey||G.ctrlKey||(h(i.activeElement)&&w(i.activeElement),o=!0)}function S(G){o=!1}function A(G){h(G.target)&&(o||m(G.target))&&w(G.target)}function k(G){h(G.target)&&(G.target.classList.contains("focus-visible")||G.target.hasAttribute("data-focus-visible-added"))&&(l=!0,window.clearTimeout(c),c=window.setTimeout(function(){l=!1},100),b(G.target))}function R(G){document.visibilityState==="hidden"&&(l&&(o=!0),L())}function L(){document.addEventListener("mousemove",q),document.addEventListener("mousedown",q),document.addEventListener("mouseup",q),document.addEventListener("pointermove",q),document.addEventListener("pointerdown",q),document.addEventListener("pointerup",q),document.addEventListener("touchmove",q),document.addEventListener("touchstart",q),document.addEventListener("touchend",q)}function I(){document.removeEventListener("mousemove",q),document.removeEventListener("mousedown",q),document.removeEventListener("mouseup",q),document.removeEventListener("pointermove",q),document.removeEventListener("pointerdown",q),document.removeEventListener("pointerup",q),document.removeEventListener("touchmove",q),document.removeEventListener("touchstart",q),document.removeEventListener("touchend",q)}function q(G){G.target.nodeName&&G.target.nodeName.toLowerCase()==="html"||(o=!1,I())}document.addEventListener("keydown",g,!0),document.addEventListener("mousedown",S,!0),document.addEventListener("pointerdown",S,!0),document.addEventListener("touchstart",S,!0),document.addEventListener("visibilitychange",R,!0),L(),i.addEventListener("focus",A,!0),i.addEventListener("blur",k,!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 Wz="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=",qpe="_spinner_vz46q_1",Vpe="_spin_vz46q_1",Gpe="_svg_vz46q_16",Wpe="_menu_vz46q_276",Kpe="_fadein_vz46q_1",Ype="_fadeout_vz46q_1",Ct={spinner:qpe,spin:Vpe,"spinner--light":"_spinner--light_vz46q_12",svg:Gpe,"user-action-indicator-container":"_user-action-indicator-container_vz46q_23","action-indicator-fade-out":"_action-indicator-fade-out_vz46q_1","user-action-indicator-text":"_user-action-indicator-text_vz46q_40","user-action-indicator":"_user-action-indicator_vz46q_23","action-indicator-icon-scale":"_action-indicator-icon-scale_vz46q_1","user-action-indicator-icon":"_user-action-indicator-icon_vz46q_60","seek-container":"_seek-container_vz46q_69","seek-playhead":"_seek-playhead_vz46q_92","seek-buffer":"_seek-buffer_vz46q_93","seek-input":"_seek-input_vz46q_94","volume-controls":"_volume-controls_vz46q_201","volume-slider":"_volume-slider_vz46q_208","volume-input":"_volume-input_vz46q_224","volume-progress":"_volume-progress_vz46q_225",menu:Wpe,fadein:Kpe,"menu-option":"_menu-option_vz46q_296","menu-option-back":"_menu-option-back_vz46q_313","menu-option-back-icon":"_menu-option-back-icon_vz46q_317","focus-visible":"_focus-visible_vz46q_327","menu-option-active":"_menu-option-active_vz46q_332","menu-option-icon":"_menu-option-icon_vz46q_336","menu-header":"_menu-header_vz46q_346","verification-menu":"_verification-menu_vz46q_353","verification-menu__group":"_verification-menu__group_vz46q_357","verification-menu__group-icon":"_verification-menu__group-icon_vz46q_362","verification-menu__group-icon--cc":"_verification-menu__group-icon--cc_vz46q_366","verification-menu__group-text":"_verification-menu__group-text_vz46q_374","verification-menu__group-title":"_verification-menu__group-title_vz46q_378","verification-menu__group-subtitle":"_verification-menu__group-subtitle_vz46q_378","verification-menu__loader":"_verification-menu__loader_vz46q_393","verification-menu__details":"_verification-menu__details_vz46q_400","verification-menu__detail":"_verification-menu__detail_vz46q_400","verification-menu__detail-label":"_verification-menu__detail-label_vz46q_419","verification-menu__detail-value":"_verification-menu__detail-value_vz46q_423","verification-menu__detail-copy":"_verification-menu__detail-copy_vz46q_430","verification-menu__inline-icon":"_verification-menu__inline-icon_vz46q_440","verification-menu--details":"_verification-menu--details_vz46q_448","dvr-toggle":"_dvr-toggle_vz46q_466","dvr-toggle__border":"_dvr-toggle__border_vz46q_472","dvr-toggle__live":"_dvr-toggle__live_vz46q_481","dvr-toggle__dvr":"_dvr-toggle__dvr_vz46q_481","dvr-toggle__live--active":"_dvr-toggle__live--active_vz46q_496","dvr-toggle__dvr--active":"_dvr-toggle__dvr--active_vz46q_496","copy-button":"_copy-button_vz46q_619","copy-button--copied":"_copy-button--copied_vz46q_622",fadeout:Ype},Ob=({light:n,className:e=""})=>ke.jsx("div",{className:`${e} ${Ct.spinner} ${n?Ct["spinner--light"]:""}`,children:ke.jsx("div",{className:Ct["spinner-inner"]})}),Mu=({icon:n,className:e=""})=>ke.jsx("div",{className:`${Ct.svg} ${e}`,dangerouslySetInnerHTML:{__html:n}}),mk=async n=>{try{n=(n||"").toString(),await navigator.clipboard.writeText(n)}catch{const t=document.createElement("input");t.value=n,t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}},GP={[Pn.PLAY]:Hz,[Pn.PAUSE]:Mpe,[Pn.MUTE]:pk,[Pn.UNMUTE]:c2,[Pn.VOLUME_DOWN]:Vz,[Pn.VOLUME_UP]:c2,[Pn.SEEK_BACK]:$P,[Pn.SEEK_FORWARD]:qP,[Pn.PLAYBACK_RATE_DOWN]:$P,[Pn.PLAYBACK_RATE_UP]:qP,[Pn.SUBTITLES_ON]:Fpe,[Pn.SUBTITLES_OFF]:Bpe,[Pn.PLAY_PREVIOUS]:hk,[Pn.PLAY_NEXT]:yk},Jpe=({action:n})=>{if(!(!n||!GP[n.action]))return ke.jsxs("div",{className:Ct["user-action-indicator-container"],children:[ke.jsx("div",{className:Ct["user-action-indicator"],children:ke.jsx(Mu,{icon:GP[n.action],"aria-label":`Action indicator ${n}`,className:Ct["user-action-indicator-icon"]})}),n.text?ke.jsx("div",{className:Ct["user-action-indicator-text"],children:n.text}):null]})},Kz=({player:n,videoState:e,setRecentUserAction:t,className:r=""})=>{const[i,o]=xt.useState(n.controls.GetCurrentTime()),[l,c]=xt.useState(0),[p,h]=xt.useState(void 0),[m,w]=xt.useState(n.controls.IsDVREnabled());return xt.useEffect(()=>{h(Lz(n,t));const b=dk({player:n,setCurrentTime:o,rate:60}),g=ppe({video:n.video,setBufferFraction:c}),S=n.controls.RegisterSettingsListener(()=>{n.controls&&w(n.controls.IsDVREnabled())});return()=>{b&&b(),g&&g(),S&&S()}},[n&&n.controls]),n.isLive&&!m?null:ke.jsxs("div",{className:`${r} ${Ct["seek-container"]} ${r}`,children:[ke.jsx("progress",{max:1,value:n.casting?0:l,className:Ct["seek-buffer"]}),ke.jsx("progress",{max:1,value:i/e.duration||0,className:Ct["seek-playhead"]}),ke.jsx("input",{"aria-label":"Seek slider",type:"range",min:0,max:1,step:1e-5,value:i/e.duration||0,onInput:b=>n.controls.Seek({fraction:b.currentTarget.value}),onKeyDown:p,className:Ct["seek-input"]})]})},Qpe=({player:n,videoState:e})=>ke.jsxs("div",{className:Ct["volume-controls"],children:[ke.jsx(Ru,{"aria-label":e.muted?"Unmute":"Mute",icon:e.muted||e.volume===0?pk:e.volume<.4?Vz:e.volume<.8?Lpe:c2,onClick:()=>n.controls.ToggleMuted(),className:Ct["volume-button"]},"mute-button"),ke.jsxs("div",{className:Ct["volume-slider"],children:[ke.jsx("progress",{max:1,value:e.muted?0:e.volume,className:Ct["volume-progress"]}),ke.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:Gde(n),className:Ct["volume-input"]})]})]}),Yz=({player:n,Hide:e,className:t=""})=>{const[r,i]=xt.useState(void 0),[o,l]=xt.useState(void 0),c=xt.createRef();if(xt.useEffect(()=>{const w=()=>l(n.controls.GetOptions());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),xt.useEffect(()=>{if(!c||!c.current)return;const w=cS({element:c.current.parentElement,Hide:e});return()=>{w&&w()}},[c]),!o)return null;const p=w=>setTimeout(()=>i(w)),h={quality:{label:"Quality",Update:w=>n.controls.SetQualityLevel(w)},audio:{label:"Audio",Update:w=>n.controls.SetAudioTrack(w)},text:{label:"Subtitles",Update:w=>n.controls.SetTextTrack(w)},profile:{label:"Player Profile",Update:w=>{w==="custom"?(n.controls.ShowPlayerProfileForm(),e()):n.controls.SetPlayerProfile({profile:w})}},rate:{label:"Playback Rate",Update:w=>n.controls.SetPlaybackRate({index:w})},advanced:{label:"Advanced",Update:w=>{w==="copy_debug_info"&&(mk(JSON.stringify(n.controls.GetDebugInfo(),null,2)),e())}}};let m;return r?m=ke.jsxs("div",{role:"menu",className:`${Ct.menu} ${Ct.submenu} ${t}`,children:[ke.jsxs("button",{onClick:()=>p(void 0),"aria-label":"Back to settings menu",className:`${Ct["menu-option"]} ${Ct["menu-option-back"]}`,children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:Npe},className:Ct["menu-option-back-icon"]}),ke.jsx("div",{children:h[r].label})]}),r==="advanced"?ke.jsx("button",{role:"button",autoFocus:!0,"aria-label":"Copy Debug Info",onClick:()=>{h[r].Update("copy_debug_info"),p(void 0)},className:Ct["menu-option"],children:"Copy Debug Info"}):o[r].options.map(w=>ke.jsxs("button",{role:"menuitemradio","aria-checked":w.active,autoFocus:w.active,"aria-label":`${h[r].label}: ${w.label||""}`,onClick:()=>{h[r].Update(w.index),p(void 0)},className:`${Ct["menu-option"]} ${w.active?Ct["menu-option-active"]:""}`,children:[w.label||"",w.active?ke.jsx(Mu,{icon:Upe,className:Ct["menu-option-icon"]}):null]},`option-${w.index}`))]},"submenu"):m=ke.jsxs("div",{role:"menu",className:`${Ct.menu} ${t}`,children:[o.hasQualityOptions?ke.jsxs("button",{autoFocus:!0,role:"menuitem",onClick:()=>p("quality"),className:Ct["menu-option"],children:[`${h.quality.label}: ${o.quality.active&&o.quality.active.activeLabel||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasAudioOptions?ke.jsxs("button",{autoFocus:!o.hasQualityOptions,role:"menuitem",onClick:()=>p("audio"),className:Ct["menu-option"],children:[`${h.audio.label}: ${o.audio.active&&o.audio.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasTextOptions?ke.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions,role:"menuitem",onClick:()=>p("text"),className:Ct["menu-option"],children:[`${h.text.label}: ${o.text.active&&o.text.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasProfileOptons?ke.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions,role:"menuitem",onClick:()=>p("profile"),className:Ct["menu-option"],children:[`${h.profile.label}: ${o.profile.active&&o.profile.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasRateOptions?ke.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions&&!o.hasProfileOptons,role:"menuitem",onClick:()=>p("rate"),className:Ct["menu-option"],children:[`${h.rate.label}: ${o.rate.active&&o.rate.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,ke.jsxs("button",{autoFocus:!o.hasRateOptions&&!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions&&!o.hasProfileOptons,role:"button",onClick:()=>p("advanced"),className:Ct["menu-option"],children:[h.advanced.label,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]})]},"menu"),ke.jsx("div",{ref:c,children:m})},Jz=({player:n})=>{const[e,t]=xt.useState(n.dvrEnabled);return xt.useEffect(()=>{const r=n.controls.RegisterSettingsListener(()=>{n.controls&&t(n.controls.IsDVREnabled())});return()=>r&&r()},[n&&n.controls]),ke.jsxs("div",{className:Ct["dvr-toggle"],children:[ke.jsx("button",{onClick:()=>n.controls.SetDVREnabled(!1),className:`${Ct["dvr-toggle__live"]} ${e?"":Ct["dvr-toggle__live--active"]}`,children:"LIVE"}),ke.jsx("button",{onClick:()=>n.controls.SetDVREnabled(!0),className:`${Ct["dvr-toggle__dvr"]} ${e?Ct["dvr-toggle__dvr--active"]:""}`,children:"DVR"}),ke.jsx("div",{className:Ct["dvr-toggle__border"]})]})},Zpe=({label:n,value:e,className:t=""})=>{const[r,i]=xt.useState(!1);return ke.jsx("button",{onClick:()=>{r||(mk(e),i(!0),setTimeout(()=>i(!1),100))},dangerouslySetInnerHTML:{__html:jpe},className:[Ct["copy-button"],r?Ct["copy-button--copied"]:"",t].join(" "),title:`Copy ${n}`})},Bo=({label:n,value:e,copyable:t})=>e?ke.jsxs("div",{className:Ct["verification-menu__detail"],children:[ke.jsxs("label",{className:Ct["verification-menu__detail-label"],children:[n,":"]}),ke.jsx("div",{className:Ct["verification-menu__detail-value"],children:e}),t?ke.jsx(Zpe,{label:n,value:e,className:Ct["verification-menu__detail-copy"]}):null]}):null,Qz=({player:n,Hide:e,className:t=""})=>{const r=xt.createRef(),[i,o]=xt.useState(),[l,c]=xt.useState(!1),[p,h]=xt.useState(!1);if(xt.useEffect(()=>{n.__LoadVerificationDetails().then(()=>h(!0));const w=()=>o(n.controls.GetContentVerificationDetails());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),xt.useEffect(()=>{if(!r||!r.current)return;const w=cS({element:r.current.parentElement,Hide:e});return()=>{w&&w()}},[r]),!i)return null;let m;return l?m=ke.jsxs(ke.Fragment,{children:[ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:f2},className:Ct["verification-menu__group-icon"]}),ke.jsxs("div",{className:Ct["verification-menu__group-text"],children:[ke.jsx("div",{className:Ct["verification-menu__group-title"],children:"This content has been verified as authentic"}),ke.jsxs("div",{className:Ct["verification-menu__group-subtitle"],children:["Last Verified: ",new Date(i.verifiedAt).toLocaleTimeString(navigator.language||"en-us",{year:"numeric",month:"long",day:"numeric"})]})]})]}),ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:VP},className:[Ct["verification-menu__group-icon"],Ct["verification-menu__group-icon--cc"]].join(" ")}),ke.jsxs("div",{className:Ct["verification-menu__group-text"],children:[ke.jsx("button",{onClick:()=>c(!0),className:Ct["verification-menu__group-title"],children:"Content Credentials"}),ke.jsxs("div",{className:Ct["verification-menu__group-subtitle"],children:["Issued by the",ke.jsx("a",{href:"https://main.net955305.contentfabric.io/config",target:"_blank",rel:"noreferrer",children:"Content Fabric"})]})]})]}),ke.jsxs("div",{className:Ct["verification-menu__details"],children:[ke.jsx(Bo,{label:"Content Fabric Object ID",value:i.details.objectId,copyable:!0}),ke.jsx(Bo,{label:"Organization Address",value:i.details.tenantAddress,copyable:!0}),ke.jsx(Bo,{label:"Organization Name",value:i.details.tenantName&&i.details.tenantName.toString()}),ke.jsx(Bo,{label:"Owner Address",value:i.details.ownerAddress,copyable:!0}),ke.jsx(Bo,{label:"Content Object Contract Address",value:i.details.explorerUrl?ke.jsx("a",{href:i.details.explorerUrl,target:"_blank",rel:"noreferrer",children:i.details.address}):i.details.address,copyable:!0}),ke.jsx(Bo,{label:"Versions",value:i.details.versionCount}),ke.jsx(Bo,{label:"Content Version Hash",value:i.details.versionHash,copyable:!0}),i.details.lastCommittedAt?ke.jsx(Bo,{label:"Latest Commit",value:new Date(i.details.lastCommittedAt).toLocaleTimeString(navigator.language||"en-us",{year:"numeric",month:"long",day:"numeric"})}):null,ke.jsx(Bo,{label:"Latest Version Hash",value:i.details.latestVersionHash,copyable:!0}),ke.jsx(Bo,{label:"Latest Transaction",value:i.details._state!=="full"?ke.jsx(Ob,{className:Ct["verification-menu__loader"]}):i.details.latestTransactionHashUrl?ke.jsx("a",{href:i.details.latestTransactionHashUrl,target:"_blank",rel:"noreferrer",children:i.details.latestTransactionHash&&i.details.latestTransactionHash.toString()}):void 0}),ke.jsx(Bo,{label:"Signature Algorithm",value:i.details.signatureMethod}),n.publicMetadataUrl?ke.jsx(Bo,{label:"Public Metadata",value:ke.jsx("a",{href:n.publicMetadataUrl,target:"_blank",rel:"noreferrer",children:n.publicMetadataUrl})}):null]},`details-${i.details._state}`)]}):m=ke.jsxs(ke.Fragment,{children:[ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:f2},className:Ct["verification-menu__group-icon"]}),ke.jsxs("div",{className:Ct["verification-menu__group-text"],children:[ke.jsx("div",{className:Ct["verification-menu__group-title"],children:"This content has been verified as authentic"}),ke.jsxs("div",{className:Ct["verification-menu__group-subtitle"],children:["Last Verified: ",new Date(i.verifiedAt).toLocaleTimeString(navigator.language||"en-us",{year:"numeric",month:"long",day:"numeric"})]})]})]}),ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:VP},className:[Ct["verification-menu__group-icon"],Ct["verification-menu__group-icon--cc"]].join(" ")}),ke.jsx("div",{className:Ct["verification-menu__group-text"],children:ke.jsxs("button",{onClick:()=>c(!0),className:Ct["verification-menu__group-title"],children:["View Content Credentials",ke.jsx("div",{className:Ct["verification-menu__inline-icon"],dangerouslySetInnerHTML:{__html:th}})]})})]})]}),ke.jsx("div",{ref:r,children:ke.jsx("div",{role:"menu",className:`${Ct.menu} ${Ct["verification-menu"]} ${l?Ct["verification-menu--details"]:""} ${t}`,children:m},"menu")})},Xpe=({player:n,Hide:e,className:t=""})=>{const r=xt.createRef(),[i,o]=xt.useState(void 0);if(xt.useEffect(()=>{const c=()=>o(n.controls.GetCollectionInfo());c();const p=n.controls.RegisterSettingsListener(c);return()=>p&&p()},[]),xt.useEffect(()=>{if(!r||!r.current)return;const c=cS({element:r.current.parentElement,Hide:e});return()=>c&&c()},[r]),!i)return null;const l=c=>{n.controls.CollectionPlay({mediaIndex:c}),e()};return ke.jsxs("div",{role:"menu",className:`${Ct.menu} ${Ct["collection-menu"]} ${t}`,ref:r,children:[ke.jsx("div",{className:`${Ct["menu-option"]} ${Ct["menu-header"]}`,children:i.title}),i.content.map(c=>ke.jsx("button",{"aria-label":`${c.title||c.mediaId} ${c.active?"(active)":""}`,role:"menuitemradio","aria-checked":c.active,autoFocus:c.active,onClick:()=>l(c.mediaIndex),className:`${Ct["menu-option"]} ${c.active?Ct["menu-option-active"]:""}`,children:c.title||c.mediaId},`collection-item-${c.mediaId}`))]},"menu")},Ru=({icon:n,className:e="",...t})=>ke.jsx("button",{...t,className:`${zn["icon-button"]} ${e}`,dangerouslySetInnerHTML:{__html:n}}),ehe=({player:n,videoState:e})=>{const[t,r]=xt.useState(n.video.currentTime);return xt.useEffect(()=>{const i=dk({player:n,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive&&!n.controls.IsDVRAvailable()?ke.jsx("div",{className:zn["live-indicator"],children:"Live"}):ke.jsxs("div",{className:zn.time,children:[!n.isLive||!n.controls.IsDVRAvailable()?null:ke.jsx(Jz,{player:n}),n.isLive&&!n.behindLiveEdge?null:`${s2(t,e.duration)} / `,n.isLive&&!n.dvrEnabled?null:s2(e.duration,e.duration)]})},the=({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 ke.jsxs(ke.Fragment,{children:[t?ke.jsxs("div",{className:`${zn["collection-button-container"]} ${i?"":zn["collection-button-container--loading"]}`,children:[ke.jsx(Ru,{"aria-label":`Play Previous: ${t.title}`,disabled:!i,icon:hk,onClick:()=>n.controls.CollectionPlayPrevious()}),ke.jsx("div",{className:zn["collection-button-text"],children:t.title})]},`media-previous-${e.mediaIndex}`):null,r?ke.jsxs("div",{className:`${zn["collection-button-container"]} ${i?"":zn["collection-button-container--loading"]}`,children:[ke.jsx(Ru,{"aria-label":`Play Next: ${r.title}`,disabled:!i,icon:yk,onClick:()=>n.controls.CollectionPlayNext()}),ke.jsx("div",{className:zn["collection-button-text"],children:r.title})]},`media-next-${e.mediaIndex}`):null]})},Zz=({label:n,icon:e,player:t,MenuComponent:r,className:i=""})=>{const[o,l]=xt.useState(!1);return ke.jsxs("div",{className:[zn["menu-control-container"],i].join(" "),children:[ke.jsx(Ru,{"aria-label":o?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{t.controls.__ToggleMenu(!o),l(!o)},className:o?zn["icon-button-active"]:""}),o?ke.jsx(r,{player:t,Hide:()=>{l(!1),t.controls.__ToggleMenu(!1)}}):null]})},nhe=({player:n})=>{const[e,t]=xt.useState(void 0),{title:r,subtitle:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return xt.useEffect(()=>{t(void 0),l&&fk({player:n,pathOrUrl:l,width:200}).then(p=>t(p))},[l]),!r||n.playerOptions.title===Ft.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()||n.playerOptions.title===Ft.title.OFF?null:ke.jsxs("div",{className:zn["info-container"],children:[e?ke.jsx("div",{className:zn["info-image-container"],children:ke.jsx("img",{src:e,alt:"Image",className:zn["info-image"]})}):null,ke.jsxs("div",{className:zn["info-text"],children:[c.length===0?null:ke.jsx("div",{className:zn["info-headers"],children:c.map((p,h)=>ke.jsx("div",{className:zn["info-header"],children:p},`header-${h}`))}),r?ke.jsx("div",{className:zn["info-title"],children:r}):null,i?ke.jsx("div",{className:zn["info-subtitle"],children:i}):null,o?ke.jsx("div",{className:zn["info-description"],children:o}):null]})]})},rhe=({player:n})=>{const[e,t]=xt.useState(!1);return xt.useEffect(()=>{const r=()=>n&&n.controls&&t(n.controls.ContentVerified());r();const i=n.controls&&n.controls.RegisterSettingsListener(r);return()=>i&&i()},[]),e?ke.jsxs(ke.Fragment,{children:[ke.jsx("div",{className:zn["content-verified-badge"],children:"VERIFIED"}),ke.jsx(Zz,{label:"Content Verification Menu",icon:f2,player:n,MenuComponent:Qz,className:zn["content-verification-menu-button"]})]}):null},ahe=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=xt.useState(void 0),[p,h]=xt.useState(void 0),[m,w]=xt.useState(n.controls.IsMenuVisible());if(xt.useEffect(()=>{if(!n.controls)return;h(Oz({player:n,setRecentUserAction:i}));const A=()=>n&&n.controls&&w(n.controls.IsMenuVisible()),k=n.controls.RegisterSettingsListener(A),R=zz({player:n,setVideoState:c});return()=>{k&&k(),R&&R()}},[]),!l)return null;const b=n.controls.GetCollectionInfo(),g=r||!e||m,S=!g&&n.playerOptions.controls===Ft.controls.AUTO_HIDE;return n.__SetControlsVisibility(!S),ke.jsxs("div",{onClick:p,className:[o,zn.container,g?"":zn.autohide,n.playerOptions.controls!==Ft.controls.DEFAULT?"":zn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(nhe,{player:n},`content-info-${b&&b.mediaIndex}`),[Ft.controls.DEFAULT,Ft.controls.OFF,Ft.controls.OFF_WITH_VOLUME_TOGGLE].includes(n.playerOptions.controls)?null:ke.jsxs(ke.Fragment,{children:[ke.jsx(Ru,{"aria-label":"Play",tabIndex:e?-1:0,icon:jz,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${zn["center-play-button"]} ${t&&!e&&!(n&&n.casting)?"":zn["center-play-button--hidden"]}`}),ke.jsxs("div",{className:`${zn["bottom-controls-container"]} ${S?zn["bottom-controls-container--autohide"]:""}`,children:[ke.jsx("div",{className:zn["bottom-controls-gradient"]}),ke.jsx(Kz,{player:n,videoState:l,setRecentUserAction:i,className:zn.seek}),ke.jsxs("div",{className:zn.controls,children:[ke.jsx(Ru,{"aria-label":l.playing?"Pause":"Play",icon:l.playing?qz:$z,onClick:()=>n.controls.TogglePlay(),className:zn["play-pause-button"]}),ke.jsx(the,{player:n}),ke.jsx(Qpe,{player:n,videoState:l}),ke.jsx(ehe,{player:n,videoState:l}),ke.jsx("div",{className:zn.spacer}),ke.jsx(rhe,{player:n}),n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.airplayAvailable?ke.jsx(Ru,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Gz}):null,n.controls.IsRotatable()?ke.jsx(Ru,{"aria-label":"Rotate Video",icon:zpe,onClick:()=>n.controls.SetAllowRotation(!n.controls.AllowRotation()),className:zn["right-control-button"]}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(Zz,{label:"Settings Menu",icon:Ope,player:n,MenuComponent:Yz}):null,ke.jsx(Ru,{"aria-label":l.fullscreen?"Exit Fullscreen":"Fullscreen",icon:l.fullscreen?Rpe:Tpe,onClick:()=>n.controls.ToggleFullscreen(),className:zn["right-control-button"]})]})]})]}),n.playerOptions.controls!==Ft.controls.OFF_WITH_VOLUME_TOGGLE?null:ke.jsx("div",{className:zn["floating-volume-toggle"],children:ke.jsx(Ru,{"aria-label":l.muted?"Unmute":"Mute",icon:l.muted||l.volume===0?pk:c2,onClick:()=>n.controls.ToggleMuted(),className:zn["volume-button"]},"mute-button")}),n.playerOptions.watermark===Ft.watermark.OFF?null:ke.jsx("div",{className:zn.watermark,children:ke.jsx("img",{src:Wz,alt:"Eluvio"})})]})},ihe="_spinner_1c6ar_17",she="_text_1c6ar_33",ohe="_title_1c6ar_39",lhe="_description_1c6ar_43",uhe="_inputs_1c6ar_47",che="_input_1c6ar_47",fhe="_submit_1c6ar_77",wi={"ticket-form-container":"_ticket-form-container_1c6ar_1","ticket-form-overlay":"_ticket-form-overlay_1c6ar_8",spinner:ihe,"ticket-form":"_ticket-form_1c6ar_1",text:she,title:ohe,description:lhe,inputs:uhe,input:che,submit:fhe,"error-message":"_error-message_1c6ar_88","size-md":"_size-md_1c6ar_102","size-sm":"_size-sm_1c6ar_103"},dhe=({parameters:n,dimensions:e,onComplete:t})=>{let{tenantId:r,ntpId:i,ticketCode:o,ticketSubject:l}=n.clientOptions||{};const c=!r||!i,[p,h]=xt.useState(o||""),[m,w]=xt.useState(!!o),[b,g]=xt.useState(!1),[S,A]=xt.useState(c?"Error: Tenant ID or NTP ID not specified":""),[k,R]=xt.useState(void 0),L=async({client:I,code:q})=>{if(!(!q||!I)){A(""),g(!0);try{let G=l;q.includes(":")&&(G=q.split(":")[0],q=q.split(":")[1]),await I.RedeemCode({tenantId:r,ntpId:i,code:q.trim(),email:G}),t(I)}catch(G){console.log(G),A("Invalid Code"),w(!1)}finally{g(!1)}}};return xt.useEffect(()=>{Promise.resolve().then(()=>Rz).then(async({ElvClient:I})=>{const q=await I.FromConfigurationUrl({configUrl:n.clientOptions.network});R(q),o&&L({client:q,code:o})})},[]),m?ke.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[wi["ticket-form-container"],wi[`size-${e.size}`],wi[`orientation-${e.orientation}`]].join(" "),children:ke.jsx("div",{className:wi["ticket-form-overlay"],children:ke.jsx(Ob,{className:wi.spinner})})}):ke.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[wi["ticket-form-container"],wi[`size-${e.size}`],wi[`orientation-${e.orientation}`]].join(" "),children:ke.jsx("div",{className:wi["ticket-form-overlay"],children:ke.jsxs("form",{onSubmit:I=>{I.preventDefault(),L({client:k,code:p})},className:wi["ticket-form"],children:[ke.jsxs("div",{className:wi.text,children:[ke.jsx("h2",{className:wi.title,children:n.clientOptions.ticketTitle||"This content requires a code to view"}),ke.jsx("p",{className:wi.description,children:n.clientOptions.ticketDescription||"Please enter your code below"})]}),ke.jsxs("div",{className:wi.inputs,children:[ke.jsx("input",{disabled:c,autoFocus:!0,type:"text",placeholder:"Ticket Code",value:p,"aria-label":"Ticket Code","aria-invalid":!!S&&!c,"aria-errormessage":S,onKeyDown:I=>I.key==="Enter"&&L({client:k,code:p}),onChange:I=>{A(""),h(I.target.value)},className:wi.input}),ke.jsx("button",{type:"submit","aria-label":"Submit Code",disabled:!p||!k||c,className:wi.submit,children:b?ke.jsx(Ob,{light:!0}):"Submit"})]}),ke.jsxs("div",{className:wi["error-message"],children:[S," "]})]})})})},phe="_container_m8dfx_1",hhe="_autohide_m8dfx_34",yhe="_fadein_m8dfx_1",mhe="_title_m8dfx_134",ghe="_spacer_m8dfx_319",vhe="_watermark_m8dfx_323",bhe="_menu_m8dfx_145",dn={container:phe,"container--default-controls":"_container--default-controls_m8dfx_29",autohide:hhe,"bottom-controls-container--autohide":"_bottom-controls-container--autohide_m8dfx_37","icon-button":"_icon-button_m8dfx_43","icon-button--drop-shadow-focus":"_icon-button--drop-shadow-focus_m8dfx_60","icon-button-active":"_icon-button-active_m8dfx_73","icon-button--circle-focus":"_icon-button--circle-focus_m8dfx_73","text-button":"_text-button_m8dfx_86","text-button--active":"_text-button--active_m8dfx_91","bottom-controls-container":"_bottom-controls-container_m8dfx_37",fadein:yhe,"bottom-controls-gradient":"_bottom-controls-gradient_m8dfx_108","center-play-button":"_center-play-button_m8dfx_120","center-play-button--hidden":"_center-play-button--hidden_m8dfx_127","title-container":"_title-container_m8dfx_134",title:mhe,"menu-control-container":"_menu-control-container_m8dfx_145","time-container":"_time-container_m8dfx_149","live-indicator":"_live-indicator_m8dfx_156","live-indicator--faded":"_live-indicator--faded_m8dfx_168","bottom-controls":"_bottom-controls_m8dfx_37","center-buttons":"_center-buttons_m8dfx_184","play-pause-button":"_play-pause-button_m8dfx_194","track-button":"_track-button_m8dfx_197","bottom-left-controls":"_bottom-left-controls_m8dfx_201","bottom-right-controls":"_bottom-right-controls_m8dfx_202","info-box-container":"_info-box-container_m8dfx_219","info-box":"_info-box_m8dfx_219","info-box-image-container":"_info-box-image-container_m8dfx_242","info-box-image":"_info-box-image_m8dfx_242","info-box-text":"_info-box-text_m8dfx_258","info-box-text--top-padding":"_info-box-text--top-padding_m8dfx_265","info-box-headers":"_info-box-headers_m8dfx_269","info-box-description":"_info-box-description_m8dfx_277","info-box-title":"_info-box-title_m8dfx_281","info-box-button":"_info-box-button_m8dfx_286","info-box-button--restart":"_info-box-button--restart_m8dfx_301",spacer:ghe,watermark:vhe,menu:bhe},Cd=({icon:n,...e})=>ke.jsx("button",{...e,className:`${dn["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),whe=({player:n,videoState:e})=>{const[t,r]=xt.useState(n.video.currentTime);return xt.useEffect(()=>{const i=dk({player:n,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive&&!n.dvrEnabled?null:ke.jsxs("div",{className:dn["time-container"],children:[n.isLive&&!n.behindLiveEdge?null:ke.jsx("div",{className:dn.time,children:s2(t,e.duration)}),ke.jsx("div",{className:dn.spacer}),ke.jsx("div",{className:dn.time,children:s2(e.duration,e.duration)})]})},_he=({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 ke.jsxs("div",{className:dn["center-buttons"],children:[!r&&!i?null:ke.jsx(Cd,{disabled:!o||!r,icon:hk,onClick:()=>n.controls.CollectionPlayPrevious(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Cd,{"aria-label":"Back 10 Seconds",icon:Ppe,onClick:()=>n.controls.Seek({relativeSeconds:-10}),className:dn["icon-button--drop-shadow-focus"]}),ke.jsx(Cd,{"aria-label":e.playing?"Pause":"Play",icon:e.playing?qz:$z,onClick:()=>n.controls.TogglePlay(),className:`${dn["play-pause-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Cd,{"aria-label":"Forward 10 Seconds",icon:Ipe,onClick:()=>n.controls.Seek({relativeSeconds:10}),className:dn["icon-button--drop-shadow-focus"]}),!r&&!i?null:ke.jsx(Cd,{disabled:!o||!i,icon:yk,onClick:()=>n.controls.CollectionPlayNext(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`})]})},j4=({label:n,icon:e,children:t,player:r,MenuComponent:i})=>{const[o,l]=xt.useState(!1);return ke.jsxs("div",{className:dn["menu-control-container"],children:[e?ke.jsx(Cd,{"aria-label":o?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{r.controls.__ToggleMenu(!o),l(!o)},className:`${dn["icon-button--circle-focus"]} ${o?dn["icon-button-active"]:""}`}):ke.jsx("button",{onClick:()=>{r.controls.__ToggleMenu(!o),l(!o)},className:`${dn["text-button"]} ${o?dn["text-button--active"]:""}`,children:t}),o?ke.jsx(i,{player:r,Hide:()=>{r.controls.__ToggleMenu(!1),l(!1)},className:dn.menu}):null]})},xhe=({player:n,Hide:e})=>{const[t,r]=xt.useState(void 0),{title:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return xt.useEffect(()=>{r(void 0),l&&fk({player:n,pathOrUrl:l,width:200}).then(p=>r(p))},[l]),xt.useEffect(()=>{const p=h=>{h&&(h.key||"").toLowerCase()==="escape"&&e()};return document.body.addEventListener("keydown",p),()=>document.body.removeEventListener("keydown",p)},[]),ke.jsxs("div",{className:dn["info-box-container"],children:[ke.jsx("button",{autoFocus:!0,onClick:()=>e(),className:`${dn["info-box-button"]} ${dn["info-box-button--info"]}`,children:"Info"}),ke.jsxs("div",{className:dn["info-box"],children:[t?ke.jsx("div",{className:dn["info-box-image-container"],children:ke.jsx("img",{src:t,alt:"Image",className:dn["info-box-image"]})}):null,ke.jsxs("div",{className:`${dn["info-box-text"]} ${t&&c&&c.length===0?dn["info-box-text--top-padding"]:""}`,children:[!c||c.length===0?null:ke.jsx("div",{className:dn["info-box-headers"],children:c.map((p,h)=>ke.jsx("div",{className:dn["info-box-header"],children:p},`header-${h}`))}),ke.jsx("div",{className:dn["info-box-title"],children:i||""}),ke.jsx("div",{className:dn["info-box-description"],children:o||""})]}),ke.jsx("div",{className:dn["info-box-actions"],children:ke.jsxs("button",{onClick:()=>{n.controls.Seek({time:0}),e()},className:`${dn["info-box-button"]} ${dn["info-box-button--restart"]}`,children:[ke.jsx(Mu,{icon:Hz}),"From Beginning"]})})]})]})},She=({player:n})=>{const[e,t]=xt.useState(!1);return xt.useEffect(()=>{const r=()=>t(n.controls.ContentVerified());r(),n.controls.RegisterSettingsListener(r)},[]),e?ke.jsx(j4,{label:"Content Verification Menu",icon:f2,player:n,MenuComponent:Qz,className:dn["content-verification-menu-button"],children:"Verified"}):null},Che=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=xt.useState(void 0),[p,h]=xt.useState(void 0),[m,w]=xt.useState(!1);if(xt.useEffect(()=>{h(Oz({player:n,setRecentUserAction:i}));const k=zz({player:n,setVideoState:c});return()=>k&&k()},[]),!l)return null;const{title:b}=n.controls.GetContentInfo()||{},g=n.controls.GetCollectionInfo(),S=r||!e||n.controls.IsMenuVisible(),A=!S&&n.playerOptions.controls===Ft.controls.AUTO_HIDE;return n.__SetControlsVisibility(!A),ke.jsxs("div",{onClick:p,className:[o,dn.container,S?"":dn.autohide,n.playerOptions.controls!==Ft.controls.DEFAULT?"":dn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(Cd,{"aria-label":"Play",tabIndex:e?-1:0,icon:jz,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${dn["center-play-button"]} ${dn["icon-button--drop-shadow-focus"]} ${t&&!e&&!n.casting?"":dn["center-play-button--hidden"]}`}),m?ke.jsx(xhe,{player:n,Hide:()=>w(!1)}):ke.jsxs("div",{className:`${dn["bottom-controls-container"]} ${A?dn["bottom-controls-container--autohide"]:""}`,children:[ke.jsx("div",{className:dn["bottom-controls-gradient"]}),ke.jsxs("div",{className:dn["title-container"],children:[ke.jsx("div",{className:dn.title,children:n.playerOptions.title===Ft.title.OFF||n.playerOptions.title===Ft.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()?"":b||""}),ke.jsx("div",{className:dn.spacer}),n.isLive?n.controls.IsDVRAvailable()?ke.jsx(Jz,{player:n}):ke.jsx("div",{className:dn["live-indicator"],children:"Live"}):null,g?ke.jsx(j4,{label:"Collection Menu",icon:Dpe,player:n,MenuComponent:Xpe}):null]}),ke.jsx(Kz,{player:n,videoState:l,setRecentUserAction:i}),ke.jsx(whe,{player:n,videoState:l}),ke.jsxs("div",{className:dn["bottom-controls"],children:[ke.jsx("div",{className:dn["bottom-left-controls"],children:!b||n.playerOptions.title===Ft.title.OFF?null:ke.jsx("button",{className:dn["text-button"],onClick:()=>w(!0),children:"Info"})}),ke.jsx(_he,{player:n,videoState:l}),ke.jsxs("div",{className:dn["bottom-right-controls"],children:[ke.jsx(She,{player:n}),n.airplayAvailable?ke.jsx(Cd,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Gz}):null,n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(j4,{label:"Settings",player:n,MenuComponent:Yz,children:"Settings"},"settings-button"):null]})]})]}),n.playerOptions.watermark===Ft.watermark.OFF?null:ke.jsx("div",{className:dn.watermark,children:ke.jsx("img",{src:Wz,alt:"Eluvio"})})]},"controls")},Ehe="_container_1l7ln_1",Ahe="_overlay_1l7ln_9",khe="_fadein_1l7ln_1",Mhe="_form_1l7ln_22",The="_header_1l7ln_39",Rhe="_input_1l7ln_45",Ohe="_actions_1l7ln_92",Lhe="_submit_1l7ln_98",Nhe="_cancel_1l7ln_99",fo={container:Ehe,overlay:Ahe,fadein:khe,form:Mhe,header:The,"input-container":"_input-container_1l7ln_45",input:Rhe,"input--invalid":"_input--invalid_1l7ln_65","player-info":"_player-info_1l7ln_74","api-link":"_api-link_1l7ln_83",actions:Ohe,submit:Lhe,cancel:Nhe},Phe=({player:n,Close:e})=>{const[t,r]=xt.useState(JSON.stringify(n.hlsOptions||"{}",null,2)),[i,o]=xt.useState(!1),[l,c]=xt.useState(""),p=xt.useRef();xt.useEffect(()=>{if(!p||!p.current)return;const m=cS({element:p.current,Hide:e});return()=>m&&m()},[p]);const h=async m=>{m.preventDefault();try{o(!0),await n.controls.SetPlayerProfile({profile:"custom",customOptions:JSON.parse(t)}),e()}catch(w){c(w.toString()),o(!1)}};return ke.jsx("div",{role:"complementary",tabIndex:-1,className:fo.container,children:ke.jsx("div",{className:fo.overlay,children:ke.jsxs("form",{onSubmit:h,className:fo.form,ref:p,children:[ke.jsx("h2",{className:fo.header,children:"Custom hls.js Options"}),ke.jsxs("div",{className:fo["input-container"],children:[ke.jsx("textarea",{disabled:i,autoFocus:!0,value:t,title:l,"aria-label":"Player Options","aria-invalid":!!l,"aria-errormessage":l||"",onChange:m=>r(m.currentTarget.value),onFocus:()=>c(""),onBlur:()=>{try{c(""),r(JSON.stringify(JSON.parse(t||"{}"),null,2))}catch(m){c(m.toString())}},className:`${fo.input} ${l?fo["input--invalid"]:""}`}),ke.jsxs("div",{className:fo["player-info"],children:[ke.jsx("a",{tabIndex:0,href:"https://github.com/video-dev/hls.js/blob/master/docs/API.md",rel:"noreferrer",target:"_blank",className:fo["api-link"],children:"API Docs"}),ke.jsxs("div",{className:fo["player-version"],children:["hls.js ",n.HLS.version]})]})]}),ke.jsxs("div",{className:fo.actions,children:[ke.jsx("button",{type:"button","aria-label":"Cancel",onClick:()=>e(),className:fo.cancel,children:"Cancel"}),ke.jsx("button",{type:"submit","aria-label":"Submit",disabled:!!l,className:fo.submit,children:i?ke.jsx(Ob,{light:!0}):"Submit"})]})]})})})},Ihe=({player:n})=>{const[e,t]=xt.useState(void 0),{posterImage:r}=n.controls.GetContentInfo()||{};return xt.useEffect(()=>{t(void 0),r&&fk({player:n,pathOrUrl:r,width:200}).then(i=>t(i))},[r]),e?ke.jsx("img",{alt:"Video Poster",src:e,className:Ys.poster}):null};let Dhe;const Uhe=({target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:i,Reset:o})=>{const[l,c]=xt.useState(void 0),[p,h]=xt.useState(void 0),[m,w]=xt.useState("lg"),[b,g]=xt.useState("landscape"),[S,A]=xt.useState({width:n.getBoundingClientRect().width,height:n.getBoundingClientRect().height}),[k,R]=xt.useState(void 0),[L,I]=xt.useState(!1),[q,G]=xt.useState(!1),[de,oe]=xt.useState(!1),[ye,Se]=xt.useState(!1),[Ce,ne]=xt.useState(!1),[Le,C]=xt.useState(!0),[x,O]=xt.useState(void 0),[z,F]=xt.useState(void 0),[H,Q]=xt.useState(!1),ae=xt.useRef(),N=!!l,T=({action:ee,text:j})=>O({action:ee,text:j,key:Math.random()});if(xt.useEffect(()=>{Se(!0);const ee=hpe({target:n,setSize:w,setOrientation:g,setDimensions:A});return()=>{Se(!1),ee&&ee()}},[]),xt.useEffect(()=>{if(!(!ae||!ae.current||!ye))try{I(!1),G(!1),e.clientOptions.client=p||e.clientOptions.client;const ee=new o2({target:n,video:ae.current,parameters:e,SetErrorMessage:R});window.__elvPlayer=ee;const j=ee.controls.RegisterSettingsListener(()=>{F(ee.controls.AllowRotation()),G(ee.playbackStarted),I(!ee.loading),ne(ee.__showPlayerProfileForm),Q(ee&&ee.casting)});ee.Destroy=()=>{ee.__DestroyPlayer(),i()},ee.Reset=()=>{o()};const be=ype({player:ee}),Ie=mpe({player:ee,inactivityPeriod:5e3,onWake:()=>C(!0),onSleep:()=>C(!1)}),Me=gpe({player:ee,setRecentUserAction:T}),De=vpe({player:ee});t(ee),c(ee);const se=ee.controls.RegisterVideoEventListener("canplay",()=>oe(!0));return()=>{ae&&ae.current&&ae.current.removeEventListener("play",G),j&&j(),be&&be(),Ie&&Ie(),Me&&Me(),De&&De(),se&&se(),ee&&ee.__DestroyPlayer()}}catch(ee){r(ee),i()}},[ae,ye,p]),xt.useEffect(()=>{if(N)return()=>{l&&l.__DestroyPlayer(),c(void 0)}},[N]),xt.useEffect(()=>{x&&(clearTimeout(Dhe),setTimeout(()=>{O(void 0)},1e3))},[x]),e.clientOptions.promptTicket&&!p)return ke.jsx(dhe,{parameters:e,dimensions:{size:m,orientation:b,...S},onComplete:ee=>h(ee)});const Y=e.playerOptions.ui===Ft.ui.WEB&&l&&l.controls.IsRotatable()&&z;return ke.jsxs("div",{role:"complementary","aria-label":"Eluvio Video Player",tabIndex:0,style:{backgroundColor:e.playerOptions.backgroundColor||"transparent","--portal-width":`${Y?S.height:S.width}px`,"--portal-height":`${Y?S.width:S.height}px`},className:[Ys["player-container"],Y?Ys["player-container--rotated"]:"",`__eluvio-player--size-${m}`,`__eluvio-player--orientation-${b}`].join(" "),children:[!Ce||!L?null:ke.jsx(Phe,{player:l,Close:()=>l.controls.HidePlayerProfileForm()}),ke.jsx("video",{playsInline:!0,disablePictureInPicture:!0,ref:ae,muted:[Ft.muted.ON,Ft.muted.WHEN_NOT_VISIBLE].includes(e.playerOptions.muted),controls:e.playerOptions.controls===Ft.controls.DEFAULT,loop:e.playerOptions.loop===Ft.loop.ON,crossOrigin:"anonymous",className:Ys.video}),!l||!de||q&&!e.playerOptions.permanentPoster?null:ke.jsx(Ihe,{player:l}),L||k||!e.playerOptions.showLoader?null:ke.jsx("div",{className:Ys["spinner-container"],children:ke.jsx(Ob,{className:Ys.spinner})}),H?ke.jsx("div",{className:Ys["cast-indicator-container"],children:ke.jsx("div",{dangerouslySetInnerHTML:{__html:Hpe}})}):null,k?ke.jsxs("div",{className:Ys["error-message"],children:[ke.jsx("div",{className:Ys["error-message__message"],children:k}),ke.jsxs("button",{className:Ys["error-message__copy-debug-button"],onClick:()=>mk(JSON.stringify(l.controls.GetDebugInfo(),null,2)),children:[ke.jsx(Mu,{icon:$pe,className:Ys["error-message__icon"]}),"Copy Troubleshooting Info"]})]}):null,l?e.playerOptions.ui===Ft.ui.WEB?ke.jsx(ahe,{player:l,playbackStarted:!!q,canPlay:de,recentlyInteracted:Le,setRecentUserAction:T,className:Ys.controls}):ke.jsx(Che,{player:l,playbackStarted:!!q,canPlay:de,recentlyInteracted:Le,setRecentUserAction:T,className:Ys.controls}):null,x?ke.jsx(Jpe,{action:x},`action-indicator-${x&&x.key}`):null]})},Fhe=n=>{const[e,t]=xt.useState(Math.random());return xt.createElement(Uhe,{...n,key:`player-${e}`,Reset:()=>t(Math.random())})},Bhe=(n,e)=>(n.innerHTML="",n.classList.add(KG.reset),n.classList.add(Ys["player-target"]),e=Pz(e),e.playerOptions&&e.playerOptions.backgroundColor&&(n.style.backgroundColor=e.playerOptions.backgroundColor),new Promise((t,r)=>{const i=Vv.createRoot(n);i.render(ke.jsx(qG.StrictMode,{children:ke.jsx(Fhe,{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=Bhe;exports.PlayerParameters=Ft;exports.commonjsGlobal=Fa;exports.crypto=XP;exports.eventsExports=Gb;exports.getDefaultExportFromCjs=Ud;exports.inherits_browserExports=$I;exports.require$$3=p2;exports.requireBuffer=Lb;exports.string_decoder=q5;
|
|
378
|
+
${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(!tb)throw Error("ElvWalletClient: Unable to sign");const t={action:"personal-sign",message:e,logIn:!0};let r=new URL(this.appUrl);if(r.hash=da("/action","sign",pa.B58(JSON.stringify(t))),r.searchParams.set("origin",window.location.origin),!jde&&window.location.origin===r.origin)throw Error("ElvWalletClient: Unable to sign");return await new Promise(async(i,o)=>{await BP({mode:"tab",url:r.toString(),onCancel:()=>o("User cancelled sign"),onMessage:async(l,c)=>{if(!(!l||!l.data||l.data.type!=="FlowResponse"))try{i(l.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:l=!1,callback:c}){let p=await this.LogInURL({mode:r,provider:t,marketplaceParams:o,clearLogin:l});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,m)=>{await BP({mode:"tab",url:p.toString(),onCancel:()=>m("User cancelled login"),onMessage:async(w,b)=>{if(!(!w||!w.data||w.data.type!=="LoginResponse"))try{c?await c(w.data.params):await this.Authenticate({token:w.data.params.clientSigningToken||w.data.params.clientAuthToken}),h()}catch(g){m(g)}finally{b()}}})}))}async LogOut(){if(this.__authorization&&this.__authorization.nonce)try{await this.client.signer.ReleaseCSAT({accessToken:this.AuthToken()})}catch(e){this.Log("Failed to release token",!0,e)}if(this.__authorization={},this.loggedIn=!1,this.cachedMarketplaces={},Dx)try{localStorage.removeItem(`__elv-token-${this.network}`)}catch{}}async TokenStatus(){return!this.__authorization||!this.__authorization.nonce?!0:await this.client.signer.CSATStatus({accessToken:this.AuthToken()})}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,extraData:l={},nonce:c,createRemoteToken:p=!0,force:h=!1}){let m=24;!t&&this.selectedMarketplaceInfo&&(await this.AvailableMarketplaces(),t=this.selectedMarketplaceInfo.tenantId),await this.client.SetRemoteSigner({idToken:e,tenantId:t,signerURIs:i,extraData:{...l,share_email:o},unsignedPublicAuth:!0});let w,b;if(p&&this.client.signer.remoteSigner){b=Date.now()+24*60*60*1e3;const S=await this.client.signer.RetrieveCSAT({email:r,nonce:c,tenantId:t,force:h});w=S.token,c=S.nonce}else b=Date.now()+m*60*60*1e3,w=await this.client.CreateFabricToken({duration:m*60*60*1e3,context:r?{usr:{email:r}}:{}});const g=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:w}),{authToken:this.SetAuthorization({fabricToken:w,tenantId:t,address:g,email:r,expiresAt:b,signerURIs:i,walletType:"Custodial",walletName:"Eluvio",register:!0,nonce:c}),signingToken:this.SetAuthorization({clusterToken:this.client.signer.authToken,fabricToken:w,tenantId:t,address:g,email:r,expiresAt:b,signerURIs:i,walletType:"Custodial",walletName:"Eluvio",nonce:c})}}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,l=await this.client.CreateFabricToken({address:e,duration:t*60*60*1e3,Sign:i,addEthereumPrefix:!1});return this.SetAuthorization({fabricToken:l,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:l,signerURIs:c,walletType:p,walletName:h,nonce:m,register:w=!1}){i=this.client.utils.FormatAddress(i),this.__authorization={fabricToken:t,tenantId:r,address:i,email:o,expiresAt:l,walletType:p,walletName:h,nonce:m},e&&(this.__authorization.clusterToken=e,c&&(this.__authorization.signerURIs=c)),this.loggedIn=!0,this.cachedMarketplaces={};const b=this.ClientAuthToken();if(this.storeAuthToken&&Dx)try{localStorage.setItem(`__elv-token-${this.network}`,b)}catch{}return w&&this.client.authClient.MakeAuthServiceRequest({path:"/as/wlt/register",method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`}}).catch(g=>{this.Log("Failed to register account: ",!0,g)}),b}async SignMetamask({message:e,address:t}){if(!tb||!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&&!pa.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=da("/",e,t,"marketplace",r,pa.B58(JSON.stringify(i))):o.pathname=da("/",e,t,pa.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 pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("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,expiresAt:o,...l}){await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("as","wlt","login","session",e),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`},body:{op:"set",id:e,format:"auth_token",payload:JSON.stringify({addr:pa.FormatAddress(t),eth:t?`ikms${pa.AddressToHash(t)}`:"",type:r,token:i,expiresAt:o,...l})}}))}async GetCodeAuth({code:e,passcode:t}){try{return await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("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/show","tenants/*/info/branding/name","tenants/*/marketplaces/*/.","tenants/*/marketplaces/*/info/tenant_id","tenants/*/marketplaces/*/info/tenant_name","tenants/*/marketplaces/*/info/branding/show","tenants/*/marketplaces/*/info/branding/name"]});const r=((t||{}).info||{}).marketplace_order||[];if(t=(t||{}).tenants||{},this.previewMarketplaceId){let l="PREVIEW",c,p;Object.keys(t||{}).forEach(h=>Object.keys(t[h].marketplaces||{}).forEach(m=>{const w=t[h].marketplaces[m]["."].source;this.utils.DecodeVersionHash(w).objectId===this.previewMarketplaceId&&(l=h,c=m,w===this.previewMarketplaceHash&&(p=t[h].marketplaces[m]))})),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[l]=t[l]||{},t[l].marketplaces=t[l].marketplaces||{},t[l].marketplaces[c]=p}let i={...this.availableMarketplaces||{}},o={...this.availableMarketplacesById||{}};Object.keys(t||{}).forEach(l=>{try{i[l]=t[l]["."]?{versionHash:t[l]["."].source}:{},Object.keys(t[l].marketplaces||{}).forEach(c=>{try{const p=t[l].marketplaces[c]["."].source,h=this.utils.DecodeVersionHash(p).objectId;i[l][c]={...t[l].marketplaces[c].info||{},tenantName:t[l].marketplaces[c].info.tenant_name,tenantId:t[l].marketplaces[c].info.tenant_id,tenantSlug:l,marketplaceSlug:c,marketplaceId:h,marketplaceHash:p,tenantBranding:(t[l].info||{}).branding||{},order:r.findIndex(m=>m===c)},o[h]=i[l][c],this.marketplaceHashes[h]=p,this.selectedMarketplaceInfo&&(this.selectedMarketplaceInfo.tenantSlug===l&&this.selectedMarketplaceInfo.marketplaceSlug===c||this.selectedMarketplaceInfo.marketplaceId===h)&&(this.selectedMarketplaceInfo=i[l][c])}catch{this.Log(`Eluvio Wallet Client: Unable to load info for marketplace ${l}/${c}`,!0)}})}catch(c){this.Log(`Eluvio Wallet Client: Failed to load tenant info ${l}`,!0,c)}}),this.availableMarketplaces=i,this.availableMarketplacesById=o}async LatestMarketplaceHash({marketplaceParams:e}){const t=await this.MarketplaceInfo({marketplaceParams:e});if(this.previewMarketplaceId&&pa.EqualHash(this.previewMarketplaceId,t.marketplaceId))return this.previewMarketplaceHash;const r=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:da("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug),resolveLinks:!1,noAuth:!0});return j8(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&&pa.EqualHash(r,this.previewMarketplaceId)?o=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"/public/asset_metadata/info",localizationSubtree:this.localization?da("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:da("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"info"),localizationSubtree:this.localization?da("/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:da("/public","asset_metadata","tenants",t.tenantSlug,"info","branding"),authorizationToken:this.publicStaticToken,produceLinkUrls:!0})||{}),o.items=await Promise.all(o.items.map(async(l,c)=>{if(l.requires_permissions){let p;this.loggedIn||(p=await this.client.CreateFabricToken({}));try{await this.client.ContentObjectMetadata({versionHash:j8(l.nft_template),metadataSubtree:"permissioned",authorizationToken:p}),l.authorized=!0}catch{l.authorized=!1}}return l.nftTemplateMetadata=(l.nft_template||{}).nft||{},l.nftTemplateHash=((l.nft_template||{})["."]||{}).source,l.itemIndex=c,l})),o.collections=(o.collections||[]).map((l,c)=>({...l,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(l=>{try{if(o.storefront[l]){let c=new URL("https://embed.v3.contentfabric.io");const p=j8(o.storefront[l]);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",""),l.startsWith("reveal")||(c.searchParams.set("m",""),c.searchParams.set("lp","")),o.storefront[`${l}_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:l,contractAddress:c,tokenId:p,currency:h,marketplaceParams:m,tenantId:w,collectionIndexes:b,priceRange:g,tokenIdRange:S,capLimit:A,userAddress:k,sellerAddress:R,lastNDays:L=-1,startTime:I,endTime:q,includeCheckoutLocked:G=!1,start:de=0,limit:oe=50}={}){b=(b||[]).map(ne=>parseInt(ne));let ye={start:de,limit:oe,sort_descending:r};e==="owned"&&t==="created"&&(t="default"),e!=="leaderboard"&&(ye.sort_by=t),e.includes("listings")&&G&&(ye.checkout=!0);let Se,Ce;m&&(Se=await this.MarketplaceInfo({marketplaceParams:m}),b.length>0&&(Ce=await this.Marketplace({marketplaceParams:m})));try{let ne=[];R?ne.push(`seller:eq:${this.client.utils.FormatAddress(R)}`):k&&e!=="owned"&&ne.push(`addr:eq:${this.client.utils.FormatAddress(k)}`),Ce&&b.length>=0?b.forEach(F=>{Ce.collections[F].items.forEach(Q=>{if(!Q)return;const ae=Ce.items.find(T=>T.sku===Q);if(!ae)return;const N=pa.SafeTraverse(ae,"nft_template","nft","address");N&&ne.push(`${e==="owned"?"contract_addr":"contract"}:eq:${pa.FormatAddress(N)}`)})}):(Se||w)&&ne.push(`tenant:eq:${Se?Se.tenantId:w}`),c?(e==="owned"?ne.push(`contract_addr:eq:${pa.FormatAddress(c)}`):ne.push(`contract:eq:${pa.FormatAddress(c)}`),p&&ne.push(`token:eq:${p}`)):i&&(e.includes("listing")?ne.push(`nft/display_name:eq:${i}`):e==="owned"?ne.push(`meta/display_name:eq:${i}`):ne.push(`name:eq:${i}`)),o&&o.forEach(F=>{e.includes("listing")?ne.push(`nft/edition_name:eq:${F}`):e==="owned"?(ne.push(`meta:@>:{"edition_name":"${F}"}`),ye.exact=!1):ne.push(`edition:eq:${F}`)}),l&&l.map(({name:F,value:H})=>{!F||!H||ne.push(`nft/attributes/${F}:eq:${H}`)}),h&&ne.push("link_type:eq:sol"),I||q?(I&&ne.push(`created:gt:${parseInt(I)/1e3}`),q&&ne.push(`created:lt:${parseInt(q)/1e3}`)):L&&L>0&&ne.push(`created:gt:${(Date.now()/1e3-L*24*60*60).toFixed(0)}`),g&&(g.min&&ne.push(`price:ge:${parseFloat(g.min)}`),g.max&&ne.push(`price:le:${parseFloat(g.max)}`)),S&&(S.min&&ne.push(`info/token_id:ge:${parseInt(S.min)}`),S.max&&ne.push(`info/token_id:le:${parseInt(S.max)}`)),A&&ne.push(`info/cap:le:${parseInt(A)}`);let Le,C;switch(e){case"owned":C=da("as","wlt",k||this.UserAddress());break;case"owned-full-meta":C=da("as","apigw","nfts"),Le={Authorization:`Bearer ${this.AuthToken()}`};break;case"listings":C=da("as","mkt","f");break;case"transfers":C=da("as","mkt","hst","f"),ne.push("action:eq:TRANSFERRED"),ne.push("action:eq:SOLD");break;case"sales":C=da("as","mkt","hst","f"),ne.push("action:eq:SOLD"),ne.push("seller:co:0x");break;case"listing-stats":C=da("as","mkt","stats","listed");break;case"sales-stats":C=da("as","mkt","stats","sold"),ne.push("seller:co:0x");break;case"leaderboard":C=da("as","wlt","leaders");break}if(ne.length>0&&(ye.filter=ne),e.includes("stats"))return await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:ye,headers:Le}));const{contents:x,paging:O}=await pa.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:ye,headers:Le}))||[],z=["owned","listings","owned-full-meta"];return{paging:{start:ye.start,limit:ye.limit,total:O.total,more:O.total>de+oe},results:(x||[]).map(F=>z.includes(e)?Fde(this,F):F)}}catch(ne){if(ne.status&&ne.status.toString()==="404")return{paging:{start:ye.start,limit:ye.limit,total:0,more:!1},results:[]};throw ne}}async MintingStatus({marketplaceParams:e,tenantId:t}){t||(t=(await this.MarketplaceInfo({marketplaceParams:e||this.selectedMarketplaceInfo})).tenantId);try{return(await pa.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:da("as","wlt","status","act",t),method:"GET",headers:{Authorization:`Bearer ${this.AuthToken()}`}}))).map(i=>{let[o,l,c]=i.op.split(":");l=l.startsWith("0x")?pa.FormatAddress(l):l;let p,h,m,w;if(o==="nft-buy"?p=c:o==="nft-claim"?(p=c,i.marketplaceId=l,i.extra&&i.extra[0]&&(l=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"&&(w=i.extra.gift_id)),o==="nft-offer-redeem"&&(m=i.op.split(":")[3]),o==="nft-claim-entitlement"){let[b,g,S,A]=i.op.split(":");p=A,i.extra&&i.extra[0]&&(l=i.extra[0].token_addr,h=i.extra[0].token_id,l=l.startsWith("0x")?pa.FormatAddress(l):l,i.marketplaceId=g)}return{...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:pa.FormatAddress(l),tokenId:h,offerId:m,giftId:w}}).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,environment:i="production"}){if(!r){const c=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:da("public/asset_metadata/tenants",t),resolveLinks:!0,linkDepthLimit:1,resolveIncludeSource:!0,resolveIgnoreErrors:!0,select:["."]});if(!c)throw Error(`Eluvio Wallet Client: Invalid or missing tenancy: ${t}`);const p=c["."].source;r=await this.client.LatestVersionHash({versionHash:p})}const o={content_hash:r,env:i,ts:Date.now()},l=await this.client.Sign(JSON.stringify(o));await this.client.authClient.MakeAuthServiceRequest({path:da("as","tnt","config",e,"metadata"),method:"POST",body:o,headers:{Authorization:`Bearer ${l}`}})}}Object.assign(Td.prototype,Pde());Object.assign(Td.prototype,Ide());Object.assign(Td.prototype,Dde());const{ElvClient:Hde}=H4,$de=ki;var qde=Hde,Pd=$de;const Rz=Object.freeze(Object.defineProperty({__proto__:null,ElvClient:qde,Utils:Pd},Symbol.toStringTag,{value:"Module"})),zP={default:{label:"Default",hlsSettings:Pd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class Vde{constructor({player:e}){this.player=e,this.visible=!0,this.allowRotation=!0,this._activeMenus=0}__ToggleMenu(e){this._activeMenus=e?this._activeMenus+1:Math.max(0,this._activeMenus-1),this.player.__SettingsUpdate()}IsVisible(){return this.visible}IsMenuVisible(){return this._activeMenus>0}IsReady(){return!this.player.loading}IsPlaying(){return this.player.casting?this.player.castHandler.IsPlaying():!this.player.video.paused}HasPlaybackStarted(){return this.player.playbackStarted}async Play(){return this.player.casting?this.player.castHandler.Play():await this.player.__Play()}Pause(){if(this.player.casting)return this.player.castHandler.Pause();this.player.video.pause()}TogglePlay(){return this.player.casting?this.player.castHandler.TogglePlay():this.player.video.paused?(this.Play(),!0):(this.Pause(),!1)}Stop(){if(this.player.casting)return this.player.castHandler.Stop();this.Pause(),this.Seek({time:0}),this.player.playbackStarted=!1,this.player.__SettingsUpdate()}GetCurrentTime(){return this.player.casting?this.player.castHandler.GetCurrentTime():this.player.video.currentTime}GetDuration(){return this.player.casting?this.player.castHandler.GetDuration():this.player.video.duration}Seek({fraction:e,time:t,relativeSeconds:r}){if(this.player.casting)return this.player.castHandler.Seek({fraction:e,time:t,relativeSeconds:r});if(!this.player.video||e&&!this.player.video.duration)return;this.player.canPlay||(this.Play(),this.Pause());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.casting?this.player.castHandler.GetVolume():this.player.video.volume}SetVolume({fraction:e,relativeFraction:t}){return this.player.casting?this.player.castHandler.SetVolume({fraction:e,relativeFraction:t}):(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.casting?this.player.castHandler.IsMuted():this.player.video.muted}Mute(){if(this.player.casting)return this.player.castHandler.Mute();this.player.video.muted=!0}Unmute(){if(this.player.casting)return this.player.castHandler.Unmute();this.player.video.muted=!1}ToggleMuted(){return this.player.casting?this.player.castHandler.ToggleMuted():(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),this.Seek({time:this.GetCurrentTime()-.1});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(e);e>=0&&(this.__lastTextTrackIndex=e),setTimeout(()=>this.player.__SettingsUpdate(),500)}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}}GetPlaybackRate(){return this.player.casting?this.player.castHandler.GetPlaybackRate():this.player.video.playbackRate||1}GetPlaybackRates(){const e=this.GetPlaybackRate();let t=["0.25","0.5","0.75","1","1.25","1.5","1.75","2"];this.player.casting&&(t=["0.5","0.75","1","1.25","1.5","1.75","2"]),t=t.map((i,o)=>({index:o,rate:parseFloat(i),label:`${i}x`,active:e.toFixed(2)===parseFloat(i).toFixed(2)}));let r=t.find(i=>i.active);return r||(r={index:-1,rate:this.GetPlaybackRate(),label:`${this.GetPlaybackRate()}x`,active:!0}),{options:t,active:r}}SetPlaybackRate({index:e,rate:t}){if(this.player.casting)return this.player.castHandler.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}}}IsDVRAvailable(){return this.player.dvrAvailable&&!this.player.casting&&isFinite(this.GetDuration())}IsDVREnabled(){return this.player.dvrEnabled}SetDVREnabled(e){const t=this.player.dvrEnabled;return this.player.dvrEnabled=this.IsDVRAvailable()&&e,this.player.__SettingsUpdate(),t&&!this.player.dvrEnabled&&this.Seek({time:this.GetDuration()-2}),this.player.dvrEnabled}GetPlayerProfiles(){let e=[];return this.player.hlsPlayer&&(e=Object.keys(zP).map(t=>({index:t,label:zP[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()}ContentVerified(){return this.player.contentVerified||!1}GetContentVerificationDetails(){return this.player.contentAudit||!1}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()}GetDebugInfo(){const e=JSON.parse(JSON.stringify(this.player.sourceOptions));delete e.playoutOptions;let t=this.player.__error&&JSON.parse(JSON.stringify(this.player.__error));return t&&Object.keys(t).length===0&&(t=this.player.__error.toString()),{appUrl:window.location.href,userAddress:this.player.userAddress,userAgent:navigator.userAgent,userLanguage:navigator.language,playoutUrl:this.player.playoutUrl,sourceOptions:e,error:t}}}const Pn={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"},Oz=({player:n,setRecentUserAction:e,sideClickRatio:t=.1,doubleClickDelay:r=300})=>{let i,o,l,c;return window.addEventListener("focus",()=>{l=c||document.activeElement,c=document.activeElement},!0),()=>p=>{if(clearTimeout(o),p.target===p.currentTarget&&p.currentTarget.contains(l)&&!p.currentTarget.classList.contains("menu-active"))if(Date.now()-i<r){const h=p.target.getBoundingClientRect(),m=(p.clientX-h.left)/h.width;m<=t?(n.controls.Seek({relativeSeconds:-10}),e({action:Pn.SEEK_BACK,text:"10 seconds"})):m>=1-t?(n.controls.Seek({relativeSeconds:10}),e({action:Pn.SEEK_FORWARD,text:"10 seconds"})):n.controls.ToggleFullscreen()}else o=setTimeout(()=>{const h=n.controls.TogglePlay();e({action:h?Pn.PLAY:Pn.PAUSE})},r);l=p.target,i=Date.now()}},Lz=(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:Pn.SEEK_BACK,text:`${i} seconds`});break;case"ArrowRight":r.preventDefault(),n.controls.Seek({relativeSeconds:i}),e({action:Pn.SEEK_FORWARD,text:`${i} seconds`});break;default:return}t+=1}},Gde=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}},s2=(n,e)=>{if(isNaN(e)||!isFinite(e)||e===0)return"00:00";const t=n>60*60,r=Math.floor(n/60/60),i=Math.floor(n/60%60),o=Math.floor(n%60);let l=`${i.toString().padStart(t?2:1,"0")}:${o.toString().padStart(2,"0")}`;return t&&(l=`${r.toString()}:${l}`),l},fk=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:l}=n.sourceOptions&&n.sourceOptions.mediaCollectionOptions||{},c=n.sourceOptions&&n.sourceOptions.playoutParameters||{};return l?i=l: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})):""},Nz=(n,e)=>{let t={};return Object.keys(n).forEach(r=>{if(typeof n[r]=="object"&&!Array.isArray(n[r]))t[r]=Nz(n[r],(e||{})[r]);else{const i=(e||{})[r];t[r]=typeof i<"u"?i:n[r]}}),t},Pz=n=>Nz(jG,n),Wde=/iPhone|iPad|iPod/i.test(navigator.userAgent),jP=window.__chromecastAvailable||!!(window.chrome&&window.chrome.cast),Kde={default:{label:"Default",hlsSettings:Pd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Pd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class o2{__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.latest=!0,this.loading=!0,this.target=e,this.video=t,this.controls=new Vde({player:this}),this.__settingsListeners=[],this.__listenerDisposers=[],this.__showPlayerProfileForm=!1,this.playbackStarted=!1,this.reloads=0,this.canPlay=!1,this.isLive=!1,this.dvrEnabled=!1,this.dvrAvailable=!1,this.behindLiveEdge=!1,this.publicMetadataUrl=void 0,this.airplayAvailable=!1,this.chromecastAvailable=jP&&r.playerOptions.allowCasting,this.casting=!1,this.usePlayerControls=[Ft.controls.ON,Ft.controls.AUTO_HIDE].includes(r.playerOptions.controls),this.__error=void 0,this.SetErrorMessage=(o,l)=>{i(o),this.__error=l};try{r.playerOptions.hlsjsOptions&&Object.keys(r.playerOptions.hlsjsOptions).length>0&&(this.customHLSOptions=r.playerOptions.hlsjsOptions,r.playerOptions.playerProfile=Ft.playerProfile.CUSTOM)}catch(o){this.Log(o,!0)}this.__Initialize(r)}async __Client(){if(this.clientPromise&&await this.clientPromise,this.clientOptions.client||(this.clientPromise=(async()=>{const{ElvClient:e}=await Promise.resolve().then(()=>Rz);return this.clientOptions.client=await e.FromConfigurationUrl({configUrl:this.clientOptions.network}),this.clientOptions.staticToken&&this.clientOptions.client.SetStaticToken({token:this.clientOptions.staticToken}),this.clientOptions.client})(),await this.clientPromise),!this.__tokenResolved){const e=(this.sourceOptions.playoutParameters||{}).authorizationToken||this.clientOptions.client.staticToken;if(e)try{JSON.parse(Pd.FromB64(e)).qspace_id&&(this.sourceOptions.playoutParameters.authorizationToken=await this.clientOptions.client.CreateFabricToken({duration:7*24*60*60*1e3}))}catch{}this.__tokenResolved=!0}return this.userAddress=this.clientOptions.client.CurrentAccountAddress(),this.clientOptions.client}async __PlayoutOptions(){const e=await this.__Client(),t=this.sourceOptions.playoutParameters||{};if(this.collectionInfo){const A=this.collectionInfo.content[this.collectionInfo.mediaIndex];t.objectId=e.utils.DecodeVersionHash(A.mediaHash).objectId,t.versionHash=A.mediaHash,this.sourceOptions.playoutOptions=void 0}let r,i,o={};(t.clipStart||t.clipEnd)&&(o.clip_start=parseFloat(t.clipStart||0),t.clipEnd&&(o.clip_end=parseFloat(t.clipEnd)));let l=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=l.default?"default":Object.keys(l)[0],t.offering?r=l[t.offering]?t.offering:void 0:(t.offerings||[]).length>0?r=t.offerings.find(A=>l[A]):t.offerings&&t.offerings.length>0&&(r=t.offerings.find(A=>l[A])),!r)throw new Error(`Unable to find offering from '${t.offering||t.offerings}'`);const c=l[r]&&l[r].properties||{};i=l[r].uri,o.ignore_trimming=t.ignoreTrimming,o.resolve=t.resolve,this.sourceOptions.contentInfo.liveDVR===Ft.liveDVR.ON&&c.dvr_available?(o.dvr=1,this.dvrAvailable=!0):this.dvrAvailable=!1,c.live?this.isLive=!0:this.isLive=!1,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 p=(await e.AvailableDRMs()).filter(A=>(this.sourceOptions.drms||[]).includes(A)),h=this.sourceOptions.protocols,m,w;for(;!(m&&w);){m=h.find(k=>this.sourceOptions.playoutOptions[k]);const A=Object.keys(this.sourceOptions.playoutOptions[m].playoutMethods);if(w=(this.sourceOptions.drms||[]).length===0?A.find(k=>k!=="clear")||A[0]:this.sourceOptions.drms.find(k=>p.includes(k)&&this.sourceOptions.playoutOptions[m].playoutMethods[k]),!w&&(h=h.filter(k=>k!==m),h.length===0))throw Error("No valid protocol / DRM combination available")}const{playoutUrl:b,drms:g}=this.sourceOptions.playoutOptions[m].playoutMethods[w],S=b.split("/").find(A=>A.startsWith("hq__"));return{playoutParameters:{...t,options:o},protocol:m,drm:w,playoutUrl:b,versionHash:S,drms:g,availableDRMs:p,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(m=>m.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.initialized=!1,this.loading=!0,this.initTime=Date.now(),this.restartParameters=t,this.__SettingsUpdate(),e&&(this.originalParameters=Pz(e),this.clientOptions=e.clientOptions,this.sourceOptions=e.sourceOptions,this.playerOptions=e.playerOptions),this.errors=0,this.__Client();try{t&&(this.video.volume=t.volume,this.video.muted=t.muted,t.playing&&(this.playerOptions.autoplay=Ft.autoplay.ON),t.currentTime&&this.__RegisterVideoEventListener("loadedmetadata",()=>this.video.currentTime=t.currentTime)),this.usePlayerControls&&this.playerOptions.allowCasting&&(this.castHandler=new pW({player:this,onReady:()=>{this.chromecastAvailable=!0,this.__SettingsUpdate()},onUpdate:()=>{this.__SettingsUpdate()}})),this.__RegisterVideoEventListener("webkitplaybacktargetavailabilitychanged",w=>{this.airplayAvailable=w.availability==="available",this.__SettingsUpdate()}),this.__RegisterVideoEventListener("play",()=>{this.reloads=0,this.playbackStarted=!0,this.__SettingsUpdate()}),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,this.video.textTracks&&this.video.textTracks.addEventListener("change",()=>this.__SettingsUpdate()),this.video.audioTracks&&this.video.audioTracks.addEventListener("change",()=>this.__SettingsUpdate()),this.playerOptions.startTime?this.controls.Seek({time:parseFloat(this.playerOptions.startTime)}):this.playerOptions.startProgress&&this.controls.Seek({fraction:parseFloat(this.playerOptions.startProgress)}),this.playerOptions.autoplay===Ft.autoplay.ON&&this.controls.Play())}),this.__RegisterVideoEventListener("seeking",()=>{if(!this.isLive||!this.dvrAvailable)return;const w=this.video.duration-this.video.currentTime;this.behindLiveEdge=w>15,this.__SettingsUpdate()}),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{versionHash:r,playoutUrl:i,protocol:o,drm:l,drms:c,multiviewOptions:p,playoutParameters:h}=await this.__PlayoutOptions();this.contentHash=r,i=new URL(i);const m=this.sourceOptions.playoutParameters.authorizationToken||i.searchParams.get("authorization");if(this.authorizationToken=m,this.playoutUrl=i.toString(),this.castHandler&&this.castHandler.SetMedia({playoutOptions:this.sourceOptions.playoutOptions,playoutParameters:h}),this.__destroyed)return;o==="hls"?await this.__InitializeHLS({playoutUrl:i,authorizationToken:m,drm:l,drms:c,multiviewOptions:p}):await this.__InitializeDash({playoutUrl:i,authorizationToken:m,drm:l,drms:c,multiviewOptions:p}),this.playerOptions.collectVideoAnalytics&&Promise.resolve().then(()=>require("./Analytics-DhUprhCa.js")).then(({InitializeMuxMonitoring:w})=>w({appName:this.playerOptions.appName||"elv-player-js",elvPlayer:this,playoutUrl:i,authorizationToken:m,disableCookies:this.playerOptions.collectVideoAnalytics===Ft.collectVideoAnalytics.DISABLE_COOKIES})),this.playerOptions.verifyContent&&setTimeout(()=>{this.__VerifyContent()},1e3),this.playerOptions.playerCallback&&this.playerOptions.playerCallback({player:this,videoElement:this.video,hlsPlayer:this.hlsPlayer,dashPlayer:this.dashPlayer}),this.__destroyed&&this.__DestroyPlayer(),this.initialized=!0,this.restartParameters=void 0}catch(r){let i;if(r&&[401,403].includes(r.status)||[401,403].includes(r.code))try{const o=await this.__Client(),l=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:l,metadataSubtree:"public/asset_metadata/permission_message",authorizationToken:this.sourceOptions.playoutParameters.authorizationToken}),i?(r.permission_message=i,this.SetErrorMessage(i,r),typeof r=="object"?r.permission_message=i:this.Log(i,!0)):this.SetErrorMessage(r.displayMessage||"Insufficient permissions",r)}catch(o){this.SetErrorMessage(o.displayMessage||"Insufficient permissions",o)}else r.status>=500?this.__HardReload(r,1e4):this.__HardReload(r,2e4);this.playerOptions.errorCallback&&this.playerOptions.errorCallback(r,this)}finally{this.loading=!1,this.__SettingsUpdate()}}}async __InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,drms:i,multiviewOptions:o}){this.HLS=(await Promise.resolve().then(()=>require("./hls-VH5py-kh.js"))).default;const l=this.video.canPlayType("application/vnd.apple.mpegURL");if(l&&Wde||[Ft.drms.FAIRPLAY,Ft.drms.SAMPLE_AES].includes(r)||!this.HLS.isSupported()){if(this.nativeHLS=!0,r===Ft.drms.FAIRPLAY?dW({playoutOptions:this.sourceOptions.playoutOptions,video:this.video}):this.video.src=e.toString(),o.enabled){const c=o.SwitchView;o.SwitchView=async p=>{await c(p)}}}else{e.searchParams.delete("authorization");let c={};(r===Ft.drms.PLAYREADY||r===Ft.drms.WIDEVINE)&&(c={drmSystems:{},emeEnabled:!0,licenseXhrSetup:(w,b)=>{w.open("POST",b,!0),w.setRequestHeader("Authorization",`Bearer ${t}`)}},r===Ft.drms.PLAYREADY?c.drmSystems={"com.microsoft.playready":{licenseUrl:i[r].licenseServers[0]}}:r===Ft.drms.WIDEVINE&&(c.drmSystems={"com.widevine.alpha":{licenseUrl:i[r].licenseServers[0]}}));const p=(Kde[this.playerOptions.playerProfile]||{}).hlsSettings||{},h=this.playerOptions.playerProfile===Ft.playerProfile.CUSTOM?this.customHLSOptions:{};this.hlsOptions={capLevelToPlayerSize:this.playerOptions.capLevelToPlayerSize,xhrSetup:w=>(w.setRequestHeader("Authorization",`Bearer ${t}`),(this.playerOptions.hlsjsOptions||{}).xhrSetup&&this.playerOptions.hlsjsOptions.xhrSetup(w),w),...c,...p,...h},this.dvrAvailable&&(delete this.hlsOptions.liveMaxLatencyDuration,delete this.hlsOptions.liveMaxLatencyDurationCount);const m=new this.HLS(this.hlsOptions);if(this.playerOptions.maxBitrate&&m.on(this.HLS.Events.MANIFEST_PARSED,(w,{levels:b,firstLevel:g})=>{let S=b.map((A,k)=>A.bitrate>this.playerOptions.maxBitrate?k:void 0).filter(A=>typeof A<"u").reverse();S.length===b.length&&(this.Log(`Warning: Max bitrate '${this.playerOptions.maxBitrate}bps' is less than all available levels for this content.`),S=S.filter(A=>A>0)),this.Log("Removing the following levels due to maxBitrate setting:"),this.Log(S.map(A=>[b[A].width,"x",b[A].height,` (${(b[A].bitrate/1e3/1e3).toFixed(1)}Mbps)`].join("")).join(", ")),S.find(A=>g===A)&&(m.startLevel=b.map((A,k)=>k).filter(A=>!S.includes(A)).reverse()[0]),S.map(A=>m.removeLevel(A))}),m.loadSource(e.toString()),m.attachMedia(this.video),this.controls&&o.enabled){const w=o.SwitchView;o.SwitchView=async b=>{await w(b),m.nextLevel=m.currentLevel},this.controls.InitializeMultiViewControls(o)}if([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(w=>m.on(w,()=>this.__SettingsUpdate())),typeof this.sourceOptions.playoutParameters.audioTrackLabel<"u"&&m.on(this.HLS.Events.AUDIO_TRACKS_UPDATED,()=>{const w=(this.controls.GetAudioTracks().options||[]).find(b=>b.label===this.sourceOptions.playoutParameters.audioTrackLabel);w&&this.controls.SetAudioTrack(w.index)}),this.SetPlayerProfile=async({profile:w,customHLSOptions:b={}})=>{this.videoDuration=void 0,this.playerOptions.playerProfile=w,this.customHLSOptions=b;const g=!this.video.paused,S=this.video.currentTime;try{this.hlsPlayer.destroy()}catch(A){this.Log("Failed to destroy HLS player",!0),this.Log(A,!0)}await this.__InitializeHLS({playoutUrl:e,authorizationToken:t,drm:r,multiviewOptions:o}),g?this.video.play():this.video.pause(),this.isLive||(this.video.currentTime=S)},m.on(this.HLS.Events.FRAG_LOADED,()=>this.errors=0),m.on(this.HLS.Events.ERROR,async(w,b)=>{this.errors+=1,this.Log(`Encountered ${b.details}`,!0),this.Log(b,!0),b.response&&b.response.code===403?this.SetErrorMessage("Insufficient permissions",b):this.errors<5?b.fatal&&(b.data&&b.data.type===this.HLS.ErrorTypes.MEDIA_ERROR?(this.Log("Attempting to recover using hlsPlayer.recoverMediaError"),m.recoverMediaError()):this.__HardReload(b)):this.__HardReload(b)}),this.hlsPlayer=m,this.player=m,l){const w=document.createElement("source");w.src=this.playoutUrl.toString(),this.video.appendChild(w),this.video.disableRemotePlayback=!1}}}async __InitializeDash({playoutUrl:e,authorizationToken:t,drm:r,drms:i}){this.Dash=(await Promise.resolve().then(()=>require("./dash.all.min-mUKTGVgu.js")).then(c=>c.dash_all_min)).default;const o=this.Dash.MediaPlayer().create(),l=this.playerOptions.dashjsOptions||{};if(o.updateSettings({...l,streaming:{buffer:{fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!0,...(l.streaming||{}).buffer||{}},text:{defaultEnabled:!1,...(l.streaming||{}).text||{}},...l.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===Ft.drms.WIDEVINE){const c=i.widevine.licenseServers[0];o.setProtectionData({"com.widevine.alpha":{serverURL:c}})}o.initialize(this.video,e.toString(),this.playerOptions.autoplay===Ft.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())),typeof this.sourceOptions.playoutParameters.audioTrackLabel<"u"&&o.on(this.Dash.MediaPlayer.events.CAN_PLAY,()=>{const c=(this.controls.GetAudioTracks().options||[]).find(p=>p.label===this.sourceOptions.playoutParameters.audioTrackLabel);c&&this.controls.SetAudioTrack(c.index)}),this.video.textTracks.addEventListener("change",()=>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===Ft.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}}async __PublicMetadataUrl({versionHash:e,authorizationToken:t}){const r=await this.__Client();let i=!1;try{await r.ContentObjectMetadata({versionHash:e,metadataSubtree:"/public/name",noAuth:!0})}catch{i=!0}let o=new URL((await r.NetworkInfo()).name==="demov3"?"https://demov3.net955210.contentfabric.io":"https://main.net955305.contentfabric.io"),l=`s/${r.NetworkInfo().name}`;return i&&(l=`t/${t}`),o.pathname=`${l}/q/${e}/meta/public`,o.toString()}async __VerifyContent(){if(!this.contentHash)return;const e=await this.__Client(),t=this.isLive?await e.AuditStream({versionHash:this.contentHash,authorizationToken:this.authorizationToken}):await e.AuditContentObject({versionHash:this.contentHash,authorizationToken:this.authorizationToken});if(!t.verified)return;t.verifiedAt=Date.now();const r=e.utils.DecodeVersionHash(this.contentHash).objectId;t.details={_state:"initial",versionHash:this.contentHash,objectId:r,address:e.utils.HashToAddress(r),signatureMethod:"ECDSA secp256k1"},this.contentAudit=t,this.contentVerified=t.verified,this.publicMetadataUrl=await this.__PublicMetadataUrl({versionHash:this.contentHash,authorizationToken:this.authorizationToken}),this.__SettingsUpdate()}async __LoadVerificationDetails(){if(!this.contentHash||!this.contentAudit||this.contentAudit.details._state!=="initial"||this.contentAudit.loading)return;this.contentAudit.loading=!0;const e=await this.__Client(),t=e.utils.DecodeVersionHash(this.contentHash).objectId,r=await e.ContentObjectTenantId({objectId:t});let i,o,l;try{o=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"objectTimestamp"}),o&&(o=new Date(parseInt(o._hex,16)*1e3)),l=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"countVersionHashes"}),l&&(l=parseInt(l._hex,16))}catch{}try{i=await e.ContentObjectMetadata({libraryId:e.contentSpaceLibraryId,objectId:r.replace("iten","iq__"),metadataSubtree:"/public/name"})}catch{}this.contentAudit.details={_state:"minus-tx",versionHash:this.contentHash,objectId:t,address:e.utils.HashToAddress(t),explorerUrl:e.NetworkInfo().name!=="main"?void 0:`https://explorer.contentfabric.io/address/${e.utils.HashToAddress(t)}`,tenantId:r,tenantAddress:e.utils.HashToAddress(r),tenantName:i,ownerAddress:await e.ContentObjectOwner({objectId:t}),lastCommittedAt:o,versionCount:l,latestVersionHash:await e.LatestVersionHash({objectId:t}),signatureMethod:"ECDSA secp256k1"},this.__SettingsUpdate();try{if(e.NetworkInfo().name==="main"){const c=new URL("https://explorer.contentfabric.io/api");c.searchParams.set("module","account"),c.searchParams.set("action","txlist"),c.searchParams.set("offset","1"),c.searchParams.set("address",e.utils.HashToAddress(t)),this.contentAudit.details.latestTransactionHash=(await(await fetch(c)).json()).result[0].hash,this.contentAudit.details.latestTransactionHashUrl=`https://explorer.contentfabric.io/tx/${this.contentAudit.details.latestTransactionHash}`}}catch{}finally{this.contentAudit.details._state="full",delete this.contentAudit.loading,this.__SettingsUpdate()}}__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.castHandler&&this.castHandler.Destroy(),this.__destroyed=!0,this.__Reset()}__Reset(){if(this.player){this.Log("Destroying player"),this.video&&this.video.pause();try{this.hlsPlayer?this.hlsPlayer.destroy():this.dashPlayer&&this.dashPlayer.destroy()}catch(e){this.Log("Failed to destroy abr player",!0),this.Log(e,!0)}if(this.__listenerDisposers.forEach(e=>{try{e()}catch(t){this.Log("Failed to dispose of video event listener",!0),this.Log(t,!0)}}),this.__settingsListeners=[],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.contentHash=void 0,this.nativeHLS=!1,this.hlsPlayer=void 0,this.dashPlayer=void 0,this.player=void 0,this.initTimeLogged=!1,this.canPlay=!1,this.isLive=!1,this.behindLiveEdge=!1,this.dvrAvailable=!1,this.dvrEnabled=!1,this.publicMetadataUrl=void 0,this.airplayAvailable=!1,this.chromecastAvailable=jP&&this.playerOptions.allowCasting,this.casting=!1,this.__error=void 0}}async __HardReload(e,t=6e3){if(!this.reloading){if(this.reloading=!0,this.reloads+=1,this.reloads>10){this.SetErrorMessage(e&&e.displayMessage||"Unable to play content",e);return}try{if(e&&this.playerOptions.restartCallback)try{const r=await this.playerOptions.restartCallback(e);if(r&&typeof r=="boolean"){this.Destroy();return}}catch(r){this.Log("Restart callback failed:"),this.Log(r)}if(this.SetErrorMessage(e&&e.displayMessage||"Something went wrong, reloading player...",e),await new Promise(r=>setTimeout(r,t)),this.__destroyed)return;this.Log("Reloading stream");try{const r=await this.__Client();r.region?await r.UseRegion({region:r.region}):r.Nodes().fabricURIs.length>1&&await r.ResetRegion()}catch(r){this.Log("Client region reset failed:"),this.Log(r)}this.restarted=!0,this.SetErrorMessage(void 0),this.__Initialize(this.originalParameters,!this.video||!this.initialized?this.restartParameters:{muted:this.video.muted,volume:this.video.volume,currentTime:this.video.currentTime,playing:!this.video.paused})}finally{this.reloading=!1}}}Log(e,t=!1){t?console.error("ELUVIO PLAYER:",e):this.playerOptions.debugLogging&&console.warn("ELUVIO PLAYER:",e)}__SetCasting(e){e&&(this.controls.SetDVREnabled(!1),this.controls.Pause()),this.casting=e,this.__SettingsUpdate()}}o2.EluvioPlayerParameters=Ft;o2.EluvioPlayer=o2;var Iz=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 l=o[i];t.call(r,l[1],l[0])}},e}()}(),z4=typeof window<"u"&&typeof document<"u"&&window.document===document,l2=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")()}(),Yde=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(l2):function(n){return setTimeout(function(){return n(Date.now())},1e3/60)}}(),Jde=2;function Qde(n,e){var t=!1,r=!1,i=0;function o(){t&&(t=!1,n()),r&&c()}function l(){Yde(o)}function c(){var p=Date.now();if(t){if(p-i<Jde)return;r=!0}else t=!0,r=!1,setTimeout(l,e);i=p}return c}var Zde=20,Xde=["top","right","bottom","left","width","height","size","weight"],epe=typeof MutationObserver<"u",tpe=function(){function n(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Qde(this.refresh.bind(this),Zde)}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(){!z4||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),epe?(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(){!z4||!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=Xde.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}(),Dz=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},im=function(n){var e=n&&n.ownerDocument&&n.ownerDocument.defaultView;return e||l2},Uz=uS(0,0,0,0);function u2(n){return parseFloat(n)||0}function HP(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+u2(o)},0)}function npe(n){for(var e=["top","right","bottom","left"],t={},r=0,i=e;r<i.length;r++){var o=i[r],l=n["padding-"+o];t[o]=u2(l)}return t}function rpe(n){var e=n.getBBox();return uS(0,0,e.width,e.height)}function ape(n){var e=n.clientWidth,t=n.clientHeight;if(!e&&!t)return Uz;var r=im(n).getComputedStyle(n),i=npe(r),o=i.left+i.right,l=i.top+i.bottom,c=u2(r.width),p=u2(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==e&&(c-=HP(r,"left","right")+o),Math.round(p+l)!==t&&(p-=HP(r,"top","bottom")+l)),!spe(n)){var h=Math.round(c+o)-e,m=Math.round(p+l)-t;Math.abs(h)!==1&&(c-=h),Math.abs(m)!==1&&(p-=m)}return uS(i.left,i.top,c,p)}var ipe=function(){return typeof SVGGraphicsElement<"u"?function(n){return n instanceof im(n).SVGGraphicsElement}:function(n){return n instanceof im(n).SVGElement&&typeof n.getBBox=="function"}}();function spe(n){return n===im(n).document.documentElement}function ope(n){return z4?ipe(n)?rpe(n):ape(n):Uz}function lpe(n){var e=n.x,t=n.y,r=n.width,i=n.height,o=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,l=Object.create(o.prototype);return Dz(l,{x:e,y:t,width:r,height:i,top:t,right:e+r,bottom:i+t,left:e}),l}function uS(n,e,t,r){return{x:n,y:e,width:t,height:r}}var upe=function(){function n(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=uS(0,0,0,0),this.target=e}return n.prototype.isActive=function(){var e=ope(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}(),cpe=function(){function n(e,t){var r=lpe(t);Dz(this,{target:e,contentRect:r})}return n}(),fpe=function(){function n(e,t,r){if(this.activeObservations_=[],this.observations_=new Iz,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 im(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new upe(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 im(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 cpe(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}(),Fz=typeof WeakMap<"u"?new WeakMap:new Iz,Bz=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=tpe.getInstance(),r=new fpe(e,t,this);Fz.set(this,r)}return n}();["observe","unobserve","disconnect"].forEach(function(n){Bz.prototype[n]=function(){var e;return(e=Fz.get(this))[n].apply(e,arguments)}});var dpe=function(){return typeof l2.ResizeObserver<"u"?l2.ResizeObserver:Bz}();const cS=({element:n,Hide:e})=>{if(!n)return;const t=o=>{o&&(o.key||"").toLowerCase()==="escape"&&e()},r=o=>{n.contains(o.target)||e()};let i=setTimeout(()=>{document.body.addEventListener("keydown",t),document.body.addEventListener("click",r,!0)},0);return()=>{clearTimeout(i),document.body.removeEventListener("keydown",t),document.body.removeEventListener("click",r,!0)}},zz=({player:n,setVideoState:e})=>{const t=function(){if(!n||!n.controls)return;const o=n.video.buffered;let l=0;for(let c=0;c<o.length;c++)o.start(c)>n.controls.GetCurrentTime()||o.end(c)>l&&(l=o.end(c));e({playing:n.controls.IsPlaying(),duration:n.controls.GetDuration(),volume:n.controls.GetVolume(),muted:n.controls.IsMuted(),rate:n.controls.GetPlaybackRate(),fullscreen:!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)})},r=["play","pause","volumechange","seeked","durationchange","ratechange"];r.map(o=>n.video.addEventListener(o,t)),n.target.addEventListener("fullscreenchange",t);const i=n.castHandler&&n.castHandler.RegisterListener(t);return()=>{r.map(o=>n.video.removeEventListener(o,t)),n.target.removeEventListener("fullscreenchange",t),i&&i()}},ppe=({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)},dk=({player:n,rate:e=10,setCurrentTime:t})=>{const r=setInterval(()=>{n.controls&&t(n.controls.GetCurrentTime())},1e3/e);return()=>{clearInterval(r)}},hpe=({target:n,setSize:e,setOrientation:t,setDimensions:r})=>{let i;const o=()=>{clearTimeout(i);const c=n.getBoundingClientRect();let p="sm",h="landscape";c.width>1400&&c.height>600?p="xl":c.width>1e3&&c.height>400?p="lg":c.width>650&&c.height>300&&(p="md"),c.width<c.height&&(h="portrait"),e(p),t(h),i=setTimeout(()=>{r({width:c.width,height:c.height})},500)};o();const l=new dpe(o);return l.observe(n),()=>l.disconnect()},ype=({player:n})=>{const e=n.video,t=n.playerOptions.autoplay===Ft.autoplay.WHEN_VISIBLE,r=n.playerOptions.muted===Ft.muted.WHEN_NOT_VISIBLE;if(!t&&!r)return;let i,o;const l=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(l,{threshold:.1}).observe(e);return()=>c&&c.disconnect()},mpe=({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)},l=["play","pause","volumechange","seeking"];l.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)),()=>{l.map(p=>n.video.removeEventListener(p,o)),c.map(p=>n.target.removeEventListener(p,o))}},gpe=({player:n,setRecentUserAction:e})=>{if(n.playerOptions.keyboardControls===Ft.keyboardControls.OFF)return;const t=n.playerOptions.keyboardControls===Ft.keyboardControls.ARROW_KEYS_DISABLED,r=Lz(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 l;switch(o.key){case" ":case"k":l=n.controls.TogglePlay(),e({action:l?Pn.PLAY:Pn.PAUSE});break;case"f":n.controls.ToggleFullscreen();break;case"m":l=n.controls.ToggleMuted(),e({action:l?Pn.MUTE:Pn.UNMUTE});break;case"ArrowDown":t||(l=n.controls.SetVolume({relativeFraction:-.1}),e({action:l===0?Pn.MUTE:Pn.VOLUME_DOWN,text:(l*100).toFixed(0)+"%"}));break;case"ArrowUp":t||(l=n.controls.SetVolume({relativeFraction:.1}),e({action:Pn.VOLUME_UP,text:(l*100).toFixed(0)+"%"}));break;case",":n.video.paused&&(n.controls.Seek({relativeSeconds:-1/60}),e({action:Pn.SEEK_BACK}));break;case".":n.video.paused&&(n.controls.Seek({relativeSeconds:1/60}),e({action:Pn.SEEK_FORWARD}));break;case"ArrowLeft":case"ArrowRight":t||r(o);break;case"j":n.controls.Seek({relativeSeconds:-10}),e({action:Pn.SEEK_BACK,text:"10 seconds"});break;case"l":n.controls.Seek({relativeSeconds:10}),e({action:Pn.SEEK_FORWARD,text:"10 seconds"});break;case"<":case">":const c=n.controls.GetPlaybackRates();c.active?l=n.controls.SetPlaybackRate({index:c.active.index+(o.key==="<"?-1:1)}):l=n.controls.SetPlaybackRate({rate:1}),l&&e({action:l.increase?Pn.PLAYBACK_RATE_UP:Pn.PLAYBACK_RATE_DOWN,text:`${l.rate.toFixed(2)}x`});break;case"c":l=n.controls.ToggleTextTrack(),e({action:l?Pn.SUBTITLES_ON:Pn.SUBTITLES_OFF});break;case"P":n.controls.CollectionPlayPrevious(),e({action:Pn.PLAY_PREVIOUS});break;case"N":n.controls.CollectionPlayNext(),e({action:Pn.PLAY_NEXT});break;case"Home":n.controls.Seek({fraction:0}),e({action:Pn.SEEK_BACK});break;case"End":n.controls.Seek({fraction:1}),e({action:Pn.SEEK_FORWARD});break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":l=n.controls.Seek({fraction:parseFloat(o.key)*.1}),e({action:l?Pn.SEEK_FORWARD:Pn.SEEK_BACK});break;default:return}o.preventDefault()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},vpe=({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)})}}},bpe="_container_fm2ri_1",wpe="_autohide_fm2ri_41",_pe="_fadein_fm2ri_1",xpe="_seek_fm2ri_174",Spe="_controls_fm2ri_207",Cpe="_time_fm2ri_221",Epe="_spacer_fm2ri_279",Ape="_watermark_fm2ri_291",kpe="_menu_fm2ri_37",zn={container:bpe,"container--default-controls":"_container--default-controls_fm2ri_33","bottom-controls-container":"_bottom-controls-container_fm2ri_37",autohide:wpe,"info-container":"_info-container_fm2ri_44","bottom-controls-container--autohide":"_bottom-controls-container--autohide_fm2ri_45","icon-button":"_icon-button_fm2ri_51","icon-button-active":"_icon-button-active_fm2ri_65",fadein:_pe,"info-image-container":"_info-image-container_fm2ri_106","info-image":"_info-image_fm2ri_106","info-text":"_info-text_fm2ri_122","info-headers":"_info-headers_fm2ri_131","info-description":"_info-description_fm2ri_141","info-title":"_info-title_fm2ri_147","info-subtitle":"_info-subtitle_fm2ri_152","center-play-button":"_center-play-button_fm2ri_160","center-play-button--hidden":"_center-play-button--hidden_fm2ri_167",seek:xpe,"bottom-controls-gradient":"_bottom-controls-gradient_fm2ri_194",controls:Spe,"play-pause-button":"_play-pause-button_fm2ri_217",time:Cpe,"live-indicator":"_live-indicator_fm2ri_231","live-indicator--faded":"_live-indicator--faded_fm2ri_241","collection-button-container":"_collection-button-container_fm2ri_249","collection-button-text":"_collection-button-text_fm2ri_254","collection-button-container--loading":"_collection-button-container--loading_fm2ri_263",spacer:Epe,"floating-volume-toggle":"_floating-volume-toggle_fm2ri_283",watermark:Ape,"content-verified-badge":"_content-verified-badge_fm2ri_302","content-verification-menu-button":"_content-verification-menu-button_fm2ri_303","menu-control-container":"_menu-control-container_fm2ri_317",menu:kpe},jz='<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>',Hz='<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>',$z='<?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>',Mpe='<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>',qz='<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="15" cy="15" r="15" fill="currentColor"/><path d="M10 8H14V22H10V8ZM16 8H20V22H16V8Z" fill="black"/></svg>',Tpe='<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>',Rpe='<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>',Ope='<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>',pk='<?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>',Vz='<?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>',Lpe='<?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>',c2='<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>',Npe='<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>',$P='<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>',Ppe='<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>',qP='<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>',Ipe='<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>',hk='<?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>',yk='<?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>',Dpe='<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>',th='<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>',Upe='<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>',Fpe='<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>',Bpe='<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>',zpe='<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>',f2='<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 27.5C15 27.5 25 22.5 25 15V6.25L15 2.5L5 6.25V15C5 22.5 15 27.5 15 27.5Z" stroke="currentColor" stroke-width="2.14286" stroke-linecap="round" stroke-linejoin="round"/><path d="M19.715 11.3574L13.8221 17.8396L11.1436 14.8931" stroke="currentColor" stroke-width="2.14286" stroke-linecap="round" stroke-linejoin="round"/></svg>',VP='<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M23.7508 12.9997V23.7508H13.0003C7.05943 23.7508 2.24919 18.9406 2.24919 12.9997C2.24919 7.05888 7.05943 2.24864 13.0003 2.24864C18.9411 2.24864 23.7508 7.05888 23.7508 12.9997ZM0 12.9997C0 5.82396 5.82396 0 12.9997 0C20.1755 0 26 5.82396 26 12.9997V25.9995H13.0003C5.82396 25.9995 0 20.1755 0 12.9997ZM5.174 13.5197C5.174 16.1976 6.98078 18.4599 9.85371 18.4599C12.2198 18.4599 13.8185 16.9 14.2084 14.8589H11.8686C11.5698 15.7951 10.8155 16.367 9.85371 16.367C8.39758 16.367 7.44886 15.2227 7.44886 13.5202C7.44886 11.8178 8.39813 10.6735 9.85371 10.6735C10.7899 10.6735 11.5305 11.2066 11.8429 12.0903H14.1959C13.7797 10.1011 12.1941 8.58055 9.85371 8.58055C6.96822 8.58001 5.174 10.8418 5.174 13.5197ZM17.3419 8.83999H15.132V18.2131H17.4331V13.3253C17.4331 12.4022 17.6931 11.8041 18.1349 11.4273C18.5249 11.0761 19.0318 10.8942 19.8642 10.8942H20.4491V8.72256H19.8773C18.668 8.72256 17.8624 9.16442 17.3424 9.8406V8.82633V8.83999H17.3419Z" fill="currentColor"/></svg>',jpe='<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-copy"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>',Gz='<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-airplay"><path d="M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"></path><polygon points="12 15 17 21 7 21 12 15"></polygon></svg>',Hpe='<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-cast"><path d="M2 16.1A5 5 0 0 1 5.9 20M2 12.05A9 9 0 0 1 9.95 20M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6"></path><line x1="2" y1="20" x2="2.01" y2="20"></line></svg>',$pe='<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-info"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>';(function(n,e){(function(t,r){r()})(Fa,function(){function t(i){var o=!0,l=!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(G){return!!(G&&G!==document&&G.nodeName!=="HTML"&&G.nodeName!=="BODY"&&"classList"in G&&"contains"in G.classList)}function m(G){var de=G.type,oe=G.tagName;return!!(oe==="INPUT"&&p[de]&&!G.readOnly||oe==="TEXTAREA"&&!G.readOnly||G.isContentEditable)}function w(G){G.classList.contains("focus-visible")||(G.classList.add("focus-visible"),G.setAttribute("data-focus-visible-added",""))}function b(G){G.hasAttribute("data-focus-visible-added")&&(G.classList.remove("focus-visible"),G.removeAttribute("data-focus-visible-added"))}function g(G){G.metaKey||G.altKey||G.ctrlKey||(h(i.activeElement)&&w(i.activeElement),o=!0)}function S(G){o=!1}function A(G){h(G.target)&&(o||m(G.target))&&w(G.target)}function k(G){h(G.target)&&(G.target.classList.contains("focus-visible")||G.target.hasAttribute("data-focus-visible-added"))&&(l=!0,window.clearTimeout(c),c=window.setTimeout(function(){l=!1},100),b(G.target))}function R(G){document.visibilityState==="hidden"&&(l&&(o=!0),L())}function L(){document.addEventListener("mousemove",q),document.addEventListener("mousedown",q),document.addEventListener("mouseup",q),document.addEventListener("pointermove",q),document.addEventListener("pointerdown",q),document.addEventListener("pointerup",q),document.addEventListener("touchmove",q),document.addEventListener("touchstart",q),document.addEventListener("touchend",q)}function I(){document.removeEventListener("mousemove",q),document.removeEventListener("mousedown",q),document.removeEventListener("mouseup",q),document.removeEventListener("pointermove",q),document.removeEventListener("pointerdown",q),document.removeEventListener("pointerup",q),document.removeEventListener("touchmove",q),document.removeEventListener("touchstart",q),document.removeEventListener("touchend",q)}function q(G){G.target.nodeName&&G.target.nodeName.toLowerCase()==="html"||(o=!1,I())}document.addEventListener("keydown",g,!0),document.addEventListener("mousedown",S,!0),document.addEventListener("pointerdown",S,!0),document.addEventListener("touchstart",S,!0),document.addEventListener("visibilitychange",R,!0),L(),i.addEventListener("focus",A,!0),i.addEventListener("blur",k,!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 Wz="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=",qpe="_spinner_vz46q_1",Vpe="_spin_vz46q_1",Gpe="_svg_vz46q_16",Wpe="_menu_vz46q_276",Kpe="_fadein_vz46q_1",Ype="_fadeout_vz46q_1",Ct={spinner:qpe,spin:Vpe,"spinner--light":"_spinner--light_vz46q_12",svg:Gpe,"user-action-indicator-container":"_user-action-indicator-container_vz46q_23","action-indicator-fade-out":"_action-indicator-fade-out_vz46q_1","user-action-indicator-text":"_user-action-indicator-text_vz46q_40","user-action-indicator":"_user-action-indicator_vz46q_23","action-indicator-icon-scale":"_action-indicator-icon-scale_vz46q_1","user-action-indicator-icon":"_user-action-indicator-icon_vz46q_60","seek-container":"_seek-container_vz46q_69","seek-playhead":"_seek-playhead_vz46q_92","seek-buffer":"_seek-buffer_vz46q_93","seek-input":"_seek-input_vz46q_94","volume-controls":"_volume-controls_vz46q_201","volume-slider":"_volume-slider_vz46q_208","volume-input":"_volume-input_vz46q_224","volume-progress":"_volume-progress_vz46q_225",menu:Wpe,fadein:Kpe,"menu-option":"_menu-option_vz46q_296","menu-option-back":"_menu-option-back_vz46q_313","menu-option-back-icon":"_menu-option-back-icon_vz46q_317","focus-visible":"_focus-visible_vz46q_327","menu-option-active":"_menu-option-active_vz46q_332","menu-option-icon":"_menu-option-icon_vz46q_336","menu-header":"_menu-header_vz46q_346","verification-menu":"_verification-menu_vz46q_353","verification-menu__group":"_verification-menu__group_vz46q_357","verification-menu__group-icon":"_verification-menu__group-icon_vz46q_362","verification-menu__group-icon--cc":"_verification-menu__group-icon--cc_vz46q_366","verification-menu__group-text":"_verification-menu__group-text_vz46q_374","verification-menu__group-title":"_verification-menu__group-title_vz46q_378","verification-menu__group-subtitle":"_verification-menu__group-subtitle_vz46q_378","verification-menu__loader":"_verification-menu__loader_vz46q_393","verification-menu__details":"_verification-menu__details_vz46q_400","verification-menu__detail":"_verification-menu__detail_vz46q_400","verification-menu__detail-label":"_verification-menu__detail-label_vz46q_419","verification-menu__detail-value":"_verification-menu__detail-value_vz46q_423","verification-menu__detail-copy":"_verification-menu__detail-copy_vz46q_430","verification-menu__inline-icon":"_verification-menu__inline-icon_vz46q_440","verification-menu--details":"_verification-menu--details_vz46q_448","dvr-toggle":"_dvr-toggle_vz46q_466","dvr-toggle__border":"_dvr-toggle__border_vz46q_472","dvr-toggle__live":"_dvr-toggle__live_vz46q_481","dvr-toggle__dvr":"_dvr-toggle__dvr_vz46q_481","dvr-toggle__live--active":"_dvr-toggle__live--active_vz46q_496","dvr-toggle__dvr--active":"_dvr-toggle__dvr--active_vz46q_496","copy-button":"_copy-button_vz46q_619","copy-button--copied":"_copy-button--copied_vz46q_622",fadeout:Ype},Ob=({light:n,className:e=""})=>ke.jsx("div",{className:`${e} ${Ct.spinner} ${n?Ct["spinner--light"]:""}`,children:ke.jsx("div",{className:Ct["spinner-inner"]})}),Mu=({icon:n,className:e=""})=>ke.jsx("div",{className:`${Ct.svg} ${e}`,dangerouslySetInnerHTML:{__html:n}}),mk=async n=>{try{n=(n||"").toString(),await navigator.clipboard.writeText(n)}catch{const t=document.createElement("input");t.value=n,t.select(),t.setSelectionRange(0,99999),document.execCommand("copy")}},GP={[Pn.PLAY]:Hz,[Pn.PAUSE]:Mpe,[Pn.MUTE]:pk,[Pn.UNMUTE]:c2,[Pn.VOLUME_DOWN]:Vz,[Pn.VOLUME_UP]:c2,[Pn.SEEK_BACK]:$P,[Pn.SEEK_FORWARD]:qP,[Pn.PLAYBACK_RATE_DOWN]:$P,[Pn.PLAYBACK_RATE_UP]:qP,[Pn.SUBTITLES_ON]:Fpe,[Pn.SUBTITLES_OFF]:Bpe,[Pn.PLAY_PREVIOUS]:hk,[Pn.PLAY_NEXT]:yk},Jpe=({action:n})=>{if(!(!n||!GP[n.action]))return ke.jsxs("div",{className:Ct["user-action-indicator-container"],children:[ke.jsx("div",{className:Ct["user-action-indicator"],children:ke.jsx(Mu,{icon:GP[n.action],"aria-label":`Action indicator ${n}`,className:Ct["user-action-indicator-icon"]})}),n.text?ke.jsx("div",{className:Ct["user-action-indicator-text"],children:n.text}):null]})},Kz=({player:n,videoState:e,setRecentUserAction:t,className:r=""})=>{const[i,o]=xt.useState(n.controls.GetCurrentTime()),[l,c]=xt.useState(0),[p,h]=xt.useState(void 0),[m,w]=xt.useState(n.controls.IsDVREnabled());return xt.useEffect(()=>{h(Lz(n,t));const b=dk({player:n,setCurrentTime:o,rate:60}),g=ppe({video:n.video,setBufferFraction:c}),S=n.controls.RegisterSettingsListener(()=>{n.controls&&w(n.controls.IsDVREnabled())});return()=>{b&&b(),g&&g(),S&&S()}},[n&&n.controls]),n.isLive&&!m?null:ke.jsxs("div",{className:`${r} ${Ct["seek-container"]} ${r}`,children:[ke.jsx("progress",{max:1,value:n.casting?0:l,className:Ct["seek-buffer"]}),ke.jsx("progress",{max:1,value:i/e.duration||0,className:Ct["seek-playhead"]}),ke.jsx("input",{"aria-label":"Seek slider",type:"range",min:0,max:1,step:1e-5,value:i/e.duration||0,onInput:b=>n.controls.Seek({fraction:b.currentTarget.value}),onKeyDown:p,className:Ct["seek-input"]})]})},Qpe=({player:n,videoState:e})=>ke.jsxs("div",{className:Ct["volume-controls"],children:[ke.jsx(Ru,{"aria-label":e.muted?"Unmute":"Mute",icon:e.muted||e.volume===0?pk:e.volume<.4?Vz:e.volume<.8?Lpe:c2,onClick:()=>n.controls.ToggleMuted(),className:Ct["volume-button"]},"mute-button"),ke.jsxs("div",{className:Ct["volume-slider"],children:[ke.jsx("progress",{max:1,value:e.muted?0:e.volume,className:Ct["volume-progress"]}),ke.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:Gde(n),className:Ct["volume-input"]})]})]}),Yz=({player:n,Hide:e,className:t=""})=>{const[r,i]=xt.useState(void 0),[o,l]=xt.useState(void 0),c=xt.createRef();if(xt.useEffect(()=>{const w=()=>l(n.controls.GetOptions());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),xt.useEffect(()=>{if(!c||!c.current)return;const w=cS({element:c.current.parentElement,Hide:e});return()=>{w&&w()}},[c]),!o)return null;const p=w=>setTimeout(()=>i(w)),h={quality:{label:"Quality",Update:w=>n.controls.SetQualityLevel(w)},audio:{label:"Audio",Update:w=>n.controls.SetAudioTrack(w)},text:{label:"Subtitles",Update:w=>n.controls.SetTextTrack(w)},profile:{label:"Player Profile",Update:w=>{w==="custom"?(n.controls.ShowPlayerProfileForm(),e()):n.controls.SetPlayerProfile({profile:w})}},rate:{label:"Playback Rate",Update:w=>n.controls.SetPlaybackRate({index:w})},advanced:{label:"Advanced",Update:w=>{w==="copy_debug_info"&&(mk(JSON.stringify(n.controls.GetDebugInfo(),null,2)),e())}}};let m;return r?m=ke.jsxs("div",{role:"menu",className:`${Ct.menu} ${Ct.submenu} ${t}`,children:[ke.jsxs("button",{onClick:()=>p(void 0),"aria-label":"Back to settings menu",className:`${Ct["menu-option"]} ${Ct["menu-option-back"]}`,children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:Npe},className:Ct["menu-option-back-icon"]}),ke.jsx("div",{children:h[r].label})]}),r==="advanced"?ke.jsx("button",{role:"button",autoFocus:!0,"aria-label":"Copy Debug Info",onClick:()=>{h[r].Update("copy_debug_info"),p(void 0)},className:Ct["menu-option"],children:"Copy Debug Info"}):o[r].options.map(w=>ke.jsxs("button",{role:"menuitemradio","aria-checked":w.active,autoFocus:w.active,"aria-label":`${h[r].label}: ${w.label||""}`,onClick:()=>{h[r].Update(w.index),p(void 0)},className:`${Ct["menu-option"]} ${w.active?Ct["menu-option-active"]:""}`,children:[w.label||"",w.active?ke.jsx(Mu,{icon:Upe,className:Ct["menu-option-icon"]}):null]},`option-${w.index}`))]},"submenu"):m=ke.jsxs("div",{role:"menu",className:`${Ct.menu} ${t}`,children:[o.hasQualityOptions?ke.jsxs("button",{autoFocus:!0,role:"menuitem",onClick:()=>p("quality"),className:Ct["menu-option"],children:[`${h.quality.label}: ${o.quality.active&&o.quality.active.activeLabel||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasAudioOptions?ke.jsxs("button",{autoFocus:!o.hasQualityOptions,role:"menuitem",onClick:()=>p("audio"),className:Ct["menu-option"],children:[`${h.audio.label}: ${o.audio.active&&o.audio.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasTextOptions?ke.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions,role:"menuitem",onClick:()=>p("text"),className:Ct["menu-option"],children:[`${h.text.label}: ${o.text.active&&o.text.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasProfileOptons?ke.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions,role:"menuitem",onClick:()=>p("profile"),className:Ct["menu-option"],children:[`${h.profile.label}: ${o.profile.active&&o.profile.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,o.hasRateOptions?ke.jsxs("button",{autoFocus:!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions&&!o.hasProfileOptons,role:"menuitem",onClick:()=>p("rate"),className:Ct["menu-option"],children:[`${h.rate.label}: ${o.rate.active&&o.rate.active.label||""}`,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]}):null,ke.jsxs("button",{autoFocus:!o.hasRateOptions&&!o.hasQualityOptions&&!o.hasAudioOptions&&!o.hasTextOptions&&!o.hasProfileOptons,role:"button",onClick:()=>p("advanced"),className:Ct["menu-option"],children:[h.advanced.label,ke.jsx(Mu,{icon:th,className:Ct["menu-option-icon"]})]})]},"menu"),ke.jsx("div",{ref:c,children:m})},Jz=({player:n})=>{const[e,t]=xt.useState(n.dvrEnabled);return xt.useEffect(()=>{const r=n.controls.RegisterSettingsListener(()=>{n.controls&&t(n.controls.IsDVREnabled())});return()=>r&&r()},[n&&n.controls]),ke.jsxs("div",{className:Ct["dvr-toggle"],children:[ke.jsx("button",{onClick:()=>n.controls.SetDVREnabled(!1),className:`${Ct["dvr-toggle__live"]} ${e?"":Ct["dvr-toggle__live--active"]}`,children:"LIVE"}),ke.jsx("button",{onClick:()=>n.controls.SetDVREnabled(!0),className:`${Ct["dvr-toggle__dvr"]} ${e?Ct["dvr-toggle__dvr--active"]:""}`,children:"DVR"}),ke.jsx("div",{className:Ct["dvr-toggle__border"]})]})},Zpe=({label:n,value:e,className:t=""})=>{const[r,i]=xt.useState(!1);return ke.jsx("button",{onClick:()=>{r||(mk(e),i(!0),setTimeout(()=>i(!1),100))},dangerouslySetInnerHTML:{__html:jpe},className:[Ct["copy-button"],r?Ct["copy-button--copied"]:"",t].join(" "),title:`Copy ${n}`})},Bo=({label:n,value:e,copyable:t})=>e?ke.jsxs("div",{className:Ct["verification-menu__detail"],children:[ke.jsxs("label",{className:Ct["verification-menu__detail-label"],children:[n,":"]}),ke.jsx("div",{className:Ct["verification-menu__detail-value"],children:e}),t?ke.jsx(Zpe,{label:n,value:e,className:Ct["verification-menu__detail-copy"]}):null]}):null,Qz=({player:n,Hide:e,className:t=""})=>{const r=xt.createRef(),[i,o]=xt.useState(),[l,c]=xt.useState(!1),[p,h]=xt.useState(!1);if(xt.useEffect(()=>{n.__LoadVerificationDetails().then(()=>h(!0));const w=()=>o(n.controls.GetContentVerificationDetails());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),xt.useEffect(()=>{if(!r||!r.current)return;const w=cS({element:r.current.parentElement,Hide:e});return()=>{w&&w()}},[r]),!i)return null;let m;return l?m=ke.jsxs(ke.Fragment,{children:[ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:f2},className:Ct["verification-menu__group-icon"]}),ke.jsxs("div",{className:Ct["verification-menu__group-text"],children:[ke.jsx("div",{className:Ct["verification-menu__group-title"],children:"This content has been verified as authentic"}),ke.jsxs("div",{className:Ct["verification-menu__group-subtitle"],children:["Last Verified: ",new Date(i.verifiedAt).toLocaleTimeString(navigator.language||"en-us",{year:"numeric",month:"long",day:"numeric"})]})]})]}),ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:VP},className:[Ct["verification-menu__group-icon"],Ct["verification-menu__group-icon--cc"]].join(" ")}),ke.jsxs("div",{className:Ct["verification-menu__group-text"],children:[ke.jsx("button",{onClick:()=>c(!0),className:Ct["verification-menu__group-title"],children:"Content Credentials"}),ke.jsxs("div",{className:Ct["verification-menu__group-subtitle"],children:["Issued by the",ke.jsx("a",{href:"https://main.net955305.contentfabric.io/config",target:"_blank",rel:"noreferrer",children:"Content Fabric"})]})]})]}),ke.jsxs("div",{className:Ct["verification-menu__details"],children:[ke.jsx(Bo,{label:"Content Fabric Object ID",value:i.details.objectId,copyable:!0}),ke.jsx(Bo,{label:"Organization Address",value:i.details.tenantAddress,copyable:!0}),ke.jsx(Bo,{label:"Organization Name",value:i.details.tenantName&&i.details.tenantName.toString()}),ke.jsx(Bo,{label:"Owner Address",value:i.details.ownerAddress,copyable:!0}),ke.jsx(Bo,{label:"Content Object Contract Address",value:i.details.explorerUrl?ke.jsx("a",{href:i.details.explorerUrl,target:"_blank",rel:"noreferrer",children:i.details.address}):i.details.address,copyable:!0}),ke.jsx(Bo,{label:"Versions",value:i.details.versionCount}),ke.jsx(Bo,{label:"Content Version Hash",value:i.details.versionHash,copyable:!0}),i.details.lastCommittedAt?ke.jsx(Bo,{label:"Latest Commit",value:new Date(i.details.lastCommittedAt).toLocaleTimeString(navigator.language||"en-us",{year:"numeric",month:"long",day:"numeric"})}):null,ke.jsx(Bo,{label:"Latest Version Hash",value:i.details.latestVersionHash,copyable:!0}),ke.jsx(Bo,{label:"Latest Transaction",value:i.details._state!=="full"?ke.jsx(Ob,{className:Ct["verification-menu__loader"]}):i.details.latestTransactionHashUrl?ke.jsx("a",{href:i.details.latestTransactionHashUrl,target:"_blank",rel:"noreferrer",children:i.details.latestTransactionHash&&i.details.latestTransactionHash.toString()}):void 0}),ke.jsx(Bo,{label:"Signature Algorithm",value:i.details.signatureMethod}),n.publicMetadataUrl?ke.jsx(Bo,{label:"Public Metadata",value:ke.jsx("a",{href:n.publicMetadataUrl,target:"_blank",rel:"noreferrer",children:n.publicMetadataUrl})}):null]},`details-${i.details._state}`)]}):m=ke.jsxs(ke.Fragment,{children:[ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:f2},className:Ct["verification-menu__group-icon"]}),ke.jsxs("div",{className:Ct["verification-menu__group-text"],children:[ke.jsx("div",{className:Ct["verification-menu__group-title"],children:"This content has been verified as authentic"}),ke.jsxs("div",{className:Ct["verification-menu__group-subtitle"],children:["Last Verified: ",new Date(i.verifiedAt).toLocaleTimeString(navigator.language||"en-us",{year:"numeric",month:"long",day:"numeric"})]})]})]}),ke.jsxs("div",{className:Ct["verification-menu__group"],children:[ke.jsx("div",{dangerouslySetInnerHTML:{__html:VP},className:[Ct["verification-menu__group-icon"],Ct["verification-menu__group-icon--cc"]].join(" ")}),ke.jsx("div",{className:Ct["verification-menu__group-text"],children:ke.jsxs("button",{onClick:()=>c(!0),className:Ct["verification-menu__group-title"],children:["View Content Credentials",ke.jsx("div",{className:Ct["verification-menu__inline-icon"],dangerouslySetInnerHTML:{__html:th}})]})})]})]}),ke.jsx("div",{ref:r,children:ke.jsx("div",{role:"menu",className:`${Ct.menu} ${Ct["verification-menu"]} ${l?Ct["verification-menu--details"]:""} ${t}`,children:m},"menu")})},Xpe=({player:n,Hide:e,className:t=""})=>{const r=xt.createRef(),[i,o]=xt.useState(void 0);if(xt.useEffect(()=>{const c=()=>o(n.controls.GetCollectionInfo());c();const p=n.controls.RegisterSettingsListener(c);return()=>p&&p()},[]),xt.useEffect(()=>{if(!r||!r.current)return;const c=cS({element:r.current.parentElement,Hide:e});return()=>c&&c()},[r]),!i)return null;const l=c=>{n.controls.CollectionPlay({mediaIndex:c}),e()};return ke.jsxs("div",{role:"menu",className:`${Ct.menu} ${Ct["collection-menu"]} ${t}`,ref:r,children:[ke.jsx("div",{className:`${Ct["menu-option"]} ${Ct["menu-header"]}`,children:i.title}),i.content.map(c=>ke.jsx("button",{"aria-label":`${c.title||c.mediaId} ${c.active?"(active)":""}`,role:"menuitemradio","aria-checked":c.active,autoFocus:c.active,onClick:()=>l(c.mediaIndex),className:`${Ct["menu-option"]} ${c.active?Ct["menu-option-active"]:""}`,children:c.title||c.mediaId},`collection-item-${c.mediaId}`))]},"menu")},Ru=({icon:n,className:e="",...t})=>ke.jsx("button",{...t,className:`${zn["icon-button"]} ${e}`,dangerouslySetInnerHTML:{__html:n}}),ehe=({player:n,videoState:e})=>{const[t,r]=xt.useState(n.video.currentTime);return xt.useEffect(()=>{const i=dk({player:n,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive&&!n.controls.IsDVRAvailable()?ke.jsx("div",{className:zn["live-indicator"],children:"Live"}):ke.jsxs("div",{className:zn.time,children:[!n.isLive||!n.controls.IsDVRAvailable()?null:ke.jsx(Jz,{player:n}),n.isLive&&!n.behindLiveEdge?null:`${s2(t,e.duration)} / `,n.isLive&&!n.dvrEnabled?null:s2(e.duration,e.duration)]})},the=({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 ke.jsxs(ke.Fragment,{children:[t?ke.jsxs("div",{className:`${zn["collection-button-container"]} ${i?"":zn["collection-button-container--loading"]}`,children:[ke.jsx(Ru,{"aria-label":`Play Previous: ${t.title}`,disabled:!i,icon:hk,onClick:()=>n.controls.CollectionPlayPrevious()}),ke.jsx("div",{className:zn["collection-button-text"],children:t.title})]},`media-previous-${e.mediaIndex}`):null,r?ke.jsxs("div",{className:`${zn["collection-button-container"]} ${i?"":zn["collection-button-container--loading"]}`,children:[ke.jsx(Ru,{"aria-label":`Play Next: ${r.title}`,disabled:!i,icon:yk,onClick:()=>n.controls.CollectionPlayNext()}),ke.jsx("div",{className:zn["collection-button-text"],children:r.title})]},`media-next-${e.mediaIndex}`):null]})},Zz=({label:n,icon:e,player:t,MenuComponent:r,className:i=""})=>{const[o,l]=xt.useState(!1);return ke.jsxs("div",{className:[zn["menu-control-container"],i].join(" "),children:[ke.jsx(Ru,{"aria-label":o?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{t.controls.__ToggleMenu(!o),l(!o)},className:o?zn["icon-button-active"]:""}),o?ke.jsx(r,{player:t,Hide:()=>{l(!1),t.controls.__ToggleMenu(!1)}}):null]})},nhe=({player:n})=>{const[e,t]=xt.useState(void 0),{title:r,subtitle:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return xt.useEffect(()=>{t(void 0),l&&fk({player:n,pathOrUrl:l,width:200}).then(p=>t(p))},[l]),!r||n.playerOptions.title===Ft.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()||n.playerOptions.title===Ft.title.OFF?null:ke.jsxs("div",{className:zn["info-container"],children:[e?ke.jsx("div",{className:zn["info-image-container"],children:ke.jsx("img",{src:e,alt:"Image",className:zn["info-image"]})}):null,ke.jsxs("div",{className:zn["info-text"],children:[c.length===0?null:ke.jsx("div",{className:zn["info-headers"],children:c.map((p,h)=>ke.jsx("div",{className:zn["info-header"],children:p},`header-${h}`))}),r?ke.jsx("div",{className:zn["info-title"],children:r}):null,i?ke.jsx("div",{className:zn["info-subtitle"],children:i}):null,o?ke.jsx("div",{className:zn["info-description"],children:o}):null]})]})},rhe=({player:n})=>{const[e,t]=xt.useState(!1);return xt.useEffect(()=>{const r=()=>n&&n.controls&&t(n.controls.ContentVerified());r();const i=n.controls&&n.controls.RegisterSettingsListener(r);return()=>i&&i()},[]),e?ke.jsxs(ke.Fragment,{children:[ke.jsx("div",{className:zn["content-verified-badge"],children:"VERIFIED"}),ke.jsx(Zz,{label:"Content Verification Menu",icon:f2,player:n,MenuComponent:Qz,className:zn["content-verification-menu-button"]})]}):null},ahe=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=xt.useState(void 0),[p,h]=xt.useState(void 0),[m,w]=xt.useState(n.controls.IsMenuVisible());if(xt.useEffect(()=>{if(!n.controls)return;h(Oz({player:n,setRecentUserAction:i}));const A=()=>n&&n.controls&&w(n.controls.IsMenuVisible()),k=n.controls.RegisterSettingsListener(A),R=zz({player:n,setVideoState:c});return()=>{k&&k(),R&&R()}},[]),!l)return null;const b=n.controls.GetCollectionInfo(),g=r||!e||m,S=!g&&n.playerOptions.controls===Ft.controls.AUTO_HIDE;return n.__SetControlsVisibility(!S),ke.jsxs("div",{onClick:p,className:[o,zn.container,g?"":zn.autohide,n.playerOptions.controls!==Ft.controls.DEFAULT?"":zn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(nhe,{player:n},`content-info-${b&&b.mediaIndex}`),[Ft.controls.DEFAULT,Ft.controls.OFF,Ft.controls.OFF_WITH_VOLUME_TOGGLE].includes(n.playerOptions.controls)?null:ke.jsxs(ke.Fragment,{children:[ke.jsx(Ru,{"aria-label":"Play",tabIndex:e?-1:0,icon:jz,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${zn["center-play-button"]} ${t&&!e&&!(n&&n.casting)?"":zn["center-play-button--hidden"]}`}),ke.jsxs("div",{className:`${zn["bottom-controls-container"]} ${S?zn["bottom-controls-container--autohide"]:""}`,children:[ke.jsx("div",{className:zn["bottom-controls-gradient"]}),ke.jsx(Kz,{player:n,videoState:l,setRecentUserAction:i,className:zn.seek}),ke.jsxs("div",{className:zn.controls,children:[ke.jsx(Ru,{"aria-label":l.playing?"Pause":"Play",icon:l.playing?qz:$z,onClick:()=>n.controls.TogglePlay(),className:zn["play-pause-button"]}),ke.jsx(the,{player:n}),ke.jsx(Qpe,{player:n,videoState:l}),ke.jsx(ehe,{player:n,videoState:l}),ke.jsx("div",{className:zn.spacer}),ke.jsx(rhe,{player:n}),n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.airplayAvailable?ke.jsx(Ru,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Gz}):null,n.controls.IsRotatable()?ke.jsx(Ru,{"aria-label":"Rotate Video",icon:zpe,onClick:()=>n.controls.SetAllowRotation(!n.controls.AllowRotation()),className:zn["right-control-button"]}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(Zz,{label:"Settings Menu",icon:Ope,player:n,MenuComponent:Yz}):null,ke.jsx(Ru,{"aria-label":l.fullscreen?"Exit Fullscreen":"Fullscreen",icon:l.fullscreen?Rpe:Tpe,onClick:()=>n.controls.ToggleFullscreen(),className:zn["right-control-button"]})]})]})]}),n.playerOptions.controls!==Ft.controls.OFF_WITH_VOLUME_TOGGLE?null:ke.jsx("div",{className:zn["floating-volume-toggle"],children:ke.jsx(Ru,{"aria-label":l.muted?"Unmute":"Mute",icon:l.muted||l.volume===0?pk:c2,onClick:()=>n.controls.ToggleMuted(),className:zn["volume-button"]},"mute-button")}),n.playerOptions.watermark===Ft.watermark.OFF?null:ke.jsx("div",{className:zn.watermark,children:ke.jsx("img",{src:Wz,alt:"Eluvio"})})]})},ihe="_spinner_1c6ar_17",she="_text_1c6ar_33",ohe="_title_1c6ar_39",lhe="_description_1c6ar_43",uhe="_inputs_1c6ar_47",che="_input_1c6ar_47",fhe="_submit_1c6ar_77",wi={"ticket-form-container":"_ticket-form-container_1c6ar_1","ticket-form-overlay":"_ticket-form-overlay_1c6ar_8",spinner:ihe,"ticket-form":"_ticket-form_1c6ar_1",text:she,title:ohe,description:lhe,inputs:uhe,input:che,submit:fhe,"error-message":"_error-message_1c6ar_88","size-md":"_size-md_1c6ar_102","size-sm":"_size-sm_1c6ar_103"},dhe=({parameters:n,dimensions:e,onComplete:t})=>{let{tenantId:r,ntpId:i,ticketCode:o,ticketSubject:l}=n.clientOptions||{};const c=!r||!i,[p,h]=xt.useState(o||""),[m,w]=xt.useState(!!o),[b,g]=xt.useState(!1),[S,A]=xt.useState(c?"Error: Tenant ID or NTP ID not specified":""),[k,R]=xt.useState(void 0),L=async({client:I,code:q})=>{if(!(!q||!I)){A(""),g(!0);try{let G=l;q.includes(":")&&(G=q.split(":")[0],q=q.split(":")[1]),await I.RedeemCode({tenantId:r,ntpId:i,code:q.trim(),email:G}),t(I)}catch(G){console.log(G),A("Invalid Code"),w(!1)}finally{g(!1)}}};return xt.useEffect(()=>{Promise.resolve().then(()=>Rz).then(async({ElvClient:I})=>{const q=await I.FromConfigurationUrl({configUrl:n.clientOptions.network});R(q),o&&L({client:q,code:o})})},[]),m?ke.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[wi["ticket-form-container"],wi[`size-${e.size}`],wi[`orientation-${e.orientation}`]].join(" "),children:ke.jsx("div",{className:wi["ticket-form-overlay"],children:ke.jsx(Ob,{className:wi.spinner})})}):ke.jsx("div",{role:"complementary",tabIndex:-1,style:{backgroundColor:n.playerOptions.backgroundColor||"transparent","--portal-width":`${e.width}px`,"--portal-height":`${e.height}px`},className:[wi["ticket-form-container"],wi[`size-${e.size}`],wi[`orientation-${e.orientation}`]].join(" "),children:ke.jsx("div",{className:wi["ticket-form-overlay"],children:ke.jsxs("form",{onSubmit:I=>{I.preventDefault(),L({client:k,code:p})},className:wi["ticket-form"],children:[ke.jsxs("div",{className:wi.text,children:[ke.jsx("h2",{className:wi.title,children:n.clientOptions.ticketTitle||"This content requires a code to view"}),ke.jsx("p",{className:wi.description,children:n.clientOptions.ticketDescription||"Please enter your code below"})]}),ke.jsxs("div",{className:wi.inputs,children:[ke.jsx("input",{disabled:c,autoFocus:!0,type:"text",placeholder:"Ticket Code",value:p,"aria-label":"Ticket Code","aria-invalid":!!S&&!c,"aria-errormessage":S,onKeyDown:I=>I.key==="Enter"&&L({client:k,code:p}),onChange:I=>{A(""),h(I.target.value)},className:wi.input}),ke.jsx("button",{type:"submit","aria-label":"Submit Code",disabled:!p||!k||c,className:wi.submit,children:b?ke.jsx(Ob,{light:!0}):"Submit"})]}),ke.jsxs("div",{className:wi["error-message"],children:[S," "]})]})})})},phe="_container_m8dfx_1",hhe="_autohide_m8dfx_34",yhe="_fadein_m8dfx_1",mhe="_title_m8dfx_134",ghe="_spacer_m8dfx_319",vhe="_watermark_m8dfx_323",bhe="_menu_m8dfx_145",dn={container:phe,"container--default-controls":"_container--default-controls_m8dfx_29",autohide:hhe,"bottom-controls-container--autohide":"_bottom-controls-container--autohide_m8dfx_37","icon-button":"_icon-button_m8dfx_43","icon-button--drop-shadow-focus":"_icon-button--drop-shadow-focus_m8dfx_60","icon-button-active":"_icon-button-active_m8dfx_73","icon-button--circle-focus":"_icon-button--circle-focus_m8dfx_73","text-button":"_text-button_m8dfx_86","text-button--active":"_text-button--active_m8dfx_91","bottom-controls-container":"_bottom-controls-container_m8dfx_37",fadein:yhe,"bottom-controls-gradient":"_bottom-controls-gradient_m8dfx_108","center-play-button":"_center-play-button_m8dfx_120","center-play-button--hidden":"_center-play-button--hidden_m8dfx_127","title-container":"_title-container_m8dfx_134",title:mhe,"menu-control-container":"_menu-control-container_m8dfx_145","time-container":"_time-container_m8dfx_149","live-indicator":"_live-indicator_m8dfx_156","live-indicator--faded":"_live-indicator--faded_m8dfx_168","bottom-controls":"_bottom-controls_m8dfx_37","center-buttons":"_center-buttons_m8dfx_184","play-pause-button":"_play-pause-button_m8dfx_194","track-button":"_track-button_m8dfx_197","bottom-left-controls":"_bottom-left-controls_m8dfx_201","bottom-right-controls":"_bottom-right-controls_m8dfx_202","info-box-container":"_info-box-container_m8dfx_219","info-box":"_info-box_m8dfx_219","info-box-image-container":"_info-box-image-container_m8dfx_242","info-box-image":"_info-box-image_m8dfx_242","info-box-text":"_info-box-text_m8dfx_258","info-box-text--top-padding":"_info-box-text--top-padding_m8dfx_265","info-box-headers":"_info-box-headers_m8dfx_269","info-box-description":"_info-box-description_m8dfx_277","info-box-title":"_info-box-title_m8dfx_281","info-box-button":"_info-box-button_m8dfx_286","info-box-button--restart":"_info-box-button--restart_m8dfx_301",spacer:ghe,watermark:vhe,menu:bhe},Cd=({icon:n,...e})=>ke.jsx("button",{...e,className:`${dn["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),whe=({player:n,videoState:e})=>{const[t,r]=xt.useState(n.video.currentTime);return xt.useEffect(()=>{const i=dk({player:n,setCurrentTime:r,rate:10});return()=>i&&i()},[]),n.isLive&&!n.dvrEnabled?null:ke.jsxs("div",{className:dn["time-container"],children:[n.isLive&&!n.behindLiveEdge?null:ke.jsx("div",{className:dn.time,children:s2(t,e.duration)}),ke.jsx("div",{className:dn.spacer}),ke.jsx("div",{className:dn.time,children:s2(e.duration,e.duration)})]})},_he=({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 ke.jsxs("div",{className:dn["center-buttons"],children:[!r&&!i?null:ke.jsx(Cd,{disabled:!o||!r,icon:hk,onClick:()=>n.controls.CollectionPlayPrevious(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Cd,{"aria-label":"Back 10 Seconds",icon:Ppe,onClick:()=>n.controls.Seek({relativeSeconds:-10}),className:dn["icon-button--drop-shadow-focus"]}),ke.jsx(Cd,{"aria-label":e.playing?"Pause":"Play",icon:e.playing?qz:$z,onClick:()=>n.controls.TogglePlay(),className:`${dn["play-pause-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Cd,{"aria-label":"Forward 10 Seconds",icon:Ipe,onClick:()=>n.controls.Seek({relativeSeconds:10}),className:dn["icon-button--drop-shadow-focus"]}),!r&&!i?null:ke.jsx(Cd,{disabled:!o||!i,icon:yk,onClick:()=>n.controls.CollectionPlayNext(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`})]})},j4=({label:n,icon:e,children:t,player:r,MenuComponent:i})=>{const[o,l]=xt.useState(!1);return ke.jsxs("div",{className:dn["menu-control-container"],children:[e?ke.jsx(Cd,{"aria-label":o?`Hide ${n} Menu`:n,"aria-haspopup":!0,icon:e,onClick:()=>{r.controls.__ToggleMenu(!o),l(!o)},className:`${dn["icon-button--circle-focus"]} ${o?dn["icon-button-active"]:""}`}):ke.jsx("button",{onClick:()=>{r.controls.__ToggleMenu(!o),l(!o)},className:`${dn["text-button"]} ${o?dn["text-button--active"]:""}`,children:t}),o?ke.jsx(i,{player:r,Hide:()=>{r.controls.__ToggleMenu(!1),l(!1)},className:dn.menu}):null]})},xhe=({player:n,Hide:e})=>{const[t,r]=xt.useState(void 0),{title:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return xt.useEffect(()=>{r(void 0),l&&fk({player:n,pathOrUrl:l,width:200}).then(p=>r(p))},[l]),xt.useEffect(()=>{const p=h=>{h&&(h.key||"").toLowerCase()==="escape"&&e()};return document.body.addEventListener("keydown",p),()=>document.body.removeEventListener("keydown",p)},[]),ke.jsxs("div",{className:dn["info-box-container"],children:[ke.jsx("button",{autoFocus:!0,onClick:()=>e(),className:`${dn["info-box-button"]} ${dn["info-box-button--info"]}`,children:"Info"}),ke.jsxs("div",{className:dn["info-box"],children:[t?ke.jsx("div",{className:dn["info-box-image-container"],children:ke.jsx("img",{src:t,alt:"Image",className:dn["info-box-image"]})}):null,ke.jsxs("div",{className:`${dn["info-box-text"]} ${t&&c&&c.length===0?dn["info-box-text--top-padding"]:""}`,children:[!c||c.length===0?null:ke.jsx("div",{className:dn["info-box-headers"],children:c.map((p,h)=>ke.jsx("div",{className:dn["info-box-header"],children:p},`header-${h}`))}),ke.jsx("div",{className:dn["info-box-title"],children:i||""}),ke.jsx("div",{className:dn["info-box-description"],children:o||""})]}),ke.jsx("div",{className:dn["info-box-actions"],children:ke.jsxs("button",{onClick:()=>{n.controls.Seek({time:0}),e()},className:`${dn["info-box-button"]} ${dn["info-box-button--restart"]}`,children:[ke.jsx(Mu,{icon:Hz}),"From Beginning"]})})]})]})},She=({player:n})=>{const[e,t]=xt.useState(!1);return xt.useEffect(()=>{const r=()=>t(n.controls.ContentVerified());r(),n.controls.RegisterSettingsListener(r)},[]),e?ke.jsx(j4,{label:"Content Verification Menu",icon:f2,player:n,MenuComponent:Qz,className:dn["content-verification-menu-button"],children:"Verified"}):null},Che=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=xt.useState(void 0),[p,h]=xt.useState(void 0),[m,w]=xt.useState(!1);if(xt.useEffect(()=>{h(Oz({player:n,setRecentUserAction:i}));const k=zz({player:n,setVideoState:c});return()=>k&&k()},[]),!l)return null;const{title:b}=n.controls.GetContentInfo()||{},g=n.controls.GetCollectionInfo(),S=r||!e||n.controls.IsMenuVisible(),A=!S&&n.playerOptions.controls===Ft.controls.AUTO_HIDE;return n.__SetControlsVisibility(!A),ke.jsxs("div",{onClick:p,className:[o,dn.container,S?"":dn.autohide,n.playerOptions.controls!==Ft.controls.DEFAULT?"":dn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(Cd,{"aria-label":"Play",tabIndex:e?-1:0,icon:jz,onClick:()=>{n.controls.Play(),n.target.firstChild.focus()},className:`${dn["center-play-button"]} ${dn["icon-button--drop-shadow-focus"]} ${t&&!e&&!n.casting?"":dn["center-play-button--hidden"]}`}),m?ke.jsx(xhe,{player:n,Hide:()=>w(!1)}):ke.jsxs("div",{className:`${dn["bottom-controls-container"]} ${A?dn["bottom-controls-container--autohide"]:""}`,children:[ke.jsx("div",{className:dn["bottom-controls-gradient"]}),ke.jsxs("div",{className:dn["title-container"],children:[ke.jsx("div",{className:dn.title,children:n.playerOptions.title===Ft.title.OFF||n.playerOptions.title===Ft.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()?"":b||""}),ke.jsx("div",{className:dn.spacer}),n.isLive?n.controls.IsDVRAvailable()?ke.jsx(Jz,{player:n}):ke.jsx("div",{className:dn["live-indicator"],children:"Live"}):null,g?ke.jsx(j4,{label:"Collection Menu",icon:Dpe,player:n,MenuComponent:Xpe}):null]}),ke.jsx(Kz,{player:n,videoState:l,setRecentUserAction:i}),ke.jsx(whe,{player:n,videoState:l}),ke.jsxs("div",{className:dn["bottom-controls"],children:[ke.jsx("div",{className:dn["bottom-left-controls"],children:!b||n.playerOptions.title===Ft.title.OFF?null:ke.jsx("button",{className:dn["text-button"],onClick:()=>w(!0),children:"Info"})}),ke.jsx(_he,{player:n,videoState:l}),ke.jsxs("div",{className:dn["bottom-right-controls"],children:[ke.jsx(She,{player:n}),n.airplayAvailable?ke.jsx(Cd,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Gz}):null,n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(j4,{label:"Settings",player:n,MenuComponent:Yz,children:"Settings"},"settings-button"):null]})]})]}),n.playerOptions.watermark===Ft.watermark.OFF?null:ke.jsx("div",{className:dn.watermark,children:ke.jsx("img",{src:Wz,alt:"Eluvio"})})]},"controls")},Ehe="_container_1l7ln_1",Ahe="_overlay_1l7ln_9",khe="_fadein_1l7ln_1",Mhe="_form_1l7ln_22",The="_header_1l7ln_39",Rhe="_input_1l7ln_45",Ohe="_actions_1l7ln_92",Lhe="_submit_1l7ln_98",Nhe="_cancel_1l7ln_99",fo={container:Ehe,overlay:Ahe,fadein:khe,form:Mhe,header:The,"input-container":"_input-container_1l7ln_45",input:Rhe,"input--invalid":"_input--invalid_1l7ln_65","player-info":"_player-info_1l7ln_74","api-link":"_api-link_1l7ln_83",actions:Ohe,submit:Lhe,cancel:Nhe},Phe=({player:n,Close:e})=>{const[t,r]=xt.useState(JSON.stringify(n.hlsOptions||"{}",null,2)),[i,o]=xt.useState(!1),[l,c]=xt.useState(""),p=xt.useRef();xt.useEffect(()=>{if(!p||!p.current)return;const m=cS({element:p.current,Hide:e});return()=>m&&m()},[p]);const h=async m=>{m.preventDefault();try{o(!0),await n.controls.SetPlayerProfile({profile:"custom",customOptions:JSON.parse(t)}),e()}catch(w){c(w.toString()),o(!1)}};return ke.jsx("div",{role:"complementary",tabIndex:-1,className:fo.container,children:ke.jsx("div",{className:fo.overlay,children:ke.jsxs("form",{onSubmit:h,className:fo.form,ref:p,children:[ke.jsx("h2",{className:fo.header,children:"Custom hls.js Options"}),ke.jsxs("div",{className:fo["input-container"],children:[ke.jsx("textarea",{disabled:i,autoFocus:!0,value:t,title:l,"aria-label":"Player Options","aria-invalid":!!l,"aria-errormessage":l||"",onChange:m=>r(m.currentTarget.value),onFocus:()=>c(""),onBlur:()=>{try{c(""),r(JSON.stringify(JSON.parse(t||"{}"),null,2))}catch(m){c(m.toString())}},className:`${fo.input} ${l?fo["input--invalid"]:""}`}),ke.jsxs("div",{className:fo["player-info"],children:[ke.jsx("a",{tabIndex:0,href:"https://github.com/video-dev/hls.js/blob/master/docs/API.md",rel:"noreferrer",target:"_blank",className:fo["api-link"],children:"API Docs"}),ke.jsxs("div",{className:fo["player-version"],children:["hls.js ",n.HLS.version]})]})]}),ke.jsxs("div",{className:fo.actions,children:[ke.jsx("button",{type:"button","aria-label":"Cancel",onClick:()=>e(),className:fo.cancel,children:"Cancel"}),ke.jsx("button",{type:"submit","aria-label":"Submit",disabled:!!l,className:fo.submit,children:i?ke.jsx(Ob,{light:!0}):"Submit"})]})]})})})},Ihe=({player:n})=>{const[e,t]=xt.useState(void 0),{posterImage:r}=n.controls.GetContentInfo()||{};return xt.useEffect(()=>{t(void 0),r&&fk({player:n,pathOrUrl:r,width:200}).then(i=>t(i))},[r]),e?ke.jsx("img",{alt:"Video Poster",src:e,className:Ys.poster}):null};let Dhe;const Uhe=({target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:i,Reset:o})=>{const[l,c]=xt.useState(void 0),[p,h]=xt.useState(void 0),[m,w]=xt.useState("lg"),[b,g]=xt.useState("landscape"),[S,A]=xt.useState({width:n.getBoundingClientRect().width,height:n.getBoundingClientRect().height}),[k,R]=xt.useState(void 0),[L,I]=xt.useState(!1),[q,G]=xt.useState(!1),[de,oe]=xt.useState(!1),[ye,Se]=xt.useState(!1),[Ce,ne]=xt.useState(!1),[Le,C]=xt.useState(!0),[x,O]=xt.useState(void 0),[z,F]=xt.useState(void 0),[H,Q]=xt.useState(!1),ae=xt.useRef(),N=!!l,T=({action:ee,text:j})=>O({action:ee,text:j,key:Math.random()});if(xt.useEffect(()=>{Se(!0);const ee=hpe({target:n,setSize:w,setOrientation:g,setDimensions:A});return()=>{Se(!1),ee&&ee()}},[]),xt.useEffect(()=>{if(!(!ae||!ae.current||!ye))try{I(!1),G(!1),e.clientOptions.client=p||e.clientOptions.client;const ee=new o2({target:n,video:ae.current,parameters:e,SetErrorMessage:R});window.__elvPlayer=ee;const j=ee.controls.RegisterSettingsListener(()=>{F(ee.controls.AllowRotation()),G(ee.playbackStarted),I(!ee.loading),ne(ee.__showPlayerProfileForm),Q(ee&&ee.casting)});ee.Destroy=()=>{ee.__DestroyPlayer(),i()},ee.Reset=()=>{o()};const be=ype({player:ee}),Ie=mpe({player:ee,inactivityPeriod:5e3,onWake:()=>C(!0),onSleep:()=>C(!1)}),Me=gpe({player:ee,setRecentUserAction:T}),De=vpe({player:ee});t(ee),c(ee);const se=ee.controls.RegisterVideoEventListener("canplay",()=>oe(!0));return()=>{ae&&ae.current&&ae.current.removeEventListener("play",G),j&&j(),be&&be(),Ie&&Ie(),Me&&Me(),De&&De(),se&&se(),ee&&ee.__DestroyPlayer()}}catch(ee){r(ee),i()}},[ae,ye,p]),xt.useEffect(()=>{if(N)return()=>{l&&l.__DestroyPlayer(),c(void 0)}},[N]),xt.useEffect(()=>{x&&(clearTimeout(Dhe),setTimeout(()=>{O(void 0)},1e3))},[x]),e.clientOptions.promptTicket&&!p)return ke.jsx(dhe,{parameters:e,dimensions:{size:m,orientation:b,...S},onComplete:ee=>h(ee)});const Y=e.playerOptions.ui===Ft.ui.WEB&&l&&l.controls.IsRotatable()&&z;return ke.jsxs("div",{role:"complementary","aria-label":"Eluvio Video Player",tabIndex:0,style:{backgroundColor:e.playerOptions.backgroundColor||"transparent","--portal-width":`${Y?S.height:S.width}px`,"--portal-height":`${Y?S.width:S.height}px`},className:[Ys["player-container"],Y?Ys["player-container--rotated"]:"",`__eluvio-player--size-${m}`,`__eluvio-player--orientation-${b}`].join(" "),children:[!Ce||!L?null:ke.jsx(Phe,{player:l,Close:()=>l.controls.HidePlayerProfileForm()}),ke.jsx("video",{playsInline:!0,disablePictureInPicture:!0,ref:ae,muted:[Ft.muted.ON,Ft.muted.WHEN_NOT_VISIBLE].includes(e.playerOptions.muted),controls:e.playerOptions.controls===Ft.controls.DEFAULT,loop:e.playerOptions.loop===Ft.loop.ON,crossOrigin:"anonymous",className:Ys.video}),!l||!de||q&&!e.playerOptions.permanentPoster?null:ke.jsx(Ihe,{player:l}),L||k||!e.playerOptions.showLoader?null:ke.jsx("div",{className:Ys["spinner-container"],children:ke.jsx(Ob,{className:Ys.spinner})}),H?ke.jsx("div",{className:Ys["cast-indicator-container"],children:ke.jsx("div",{dangerouslySetInnerHTML:{__html:Hpe}})}):null,k?ke.jsxs("div",{className:Ys["error-message"],children:[ke.jsx("div",{className:Ys["error-message__message"],children:k}),ke.jsxs("button",{className:Ys["error-message__copy-debug-button"],onClick:()=>mk(JSON.stringify(l.controls.GetDebugInfo(),null,2)),children:[ke.jsx(Mu,{icon:$pe,className:Ys["error-message__icon"]}),"Copy Troubleshooting Info"]})]}):null,l?e.playerOptions.ui===Ft.ui.WEB?ke.jsx(ahe,{player:l,playbackStarted:!!q,canPlay:de,recentlyInteracted:Le,setRecentUserAction:T,className:Ys.controls}):ke.jsx(Che,{player:l,playbackStarted:!!q,canPlay:de,recentlyInteracted:Le,setRecentUserAction:T,className:Ys.controls}):null,x?ke.jsx(Jpe,{action:x},`action-indicator-${x&&x.key}`):null]})},Fhe=n=>{const[e,t]=xt.useState(Math.random());return xt.createElement(Uhe,{...n,key:`player-${e}`,Reset:()=>t(Math.random())})},Bhe=(n,e)=>(n.innerHTML="",n.classList.add(KG.reset),n.classList.add(Ys["player-target"]),e=Pz(e),e.playerOptions&&e.playerOptions.backgroundColor&&(n.style.backgroundColor=e.playerOptions.backgroundColor),new Promise((t,r)=>{const i=Vv.createRoot(n);i.render(ke.jsx(qG.StrictMode,{children:ke.jsx(Fhe,{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=Bhe;exports.PlayerParameters=Ft;exports.commonjsGlobal=Fa;exports.crypto=XP;exports.eventsExports=Gb;exports.getDefaultExportFromCjs=Ud;exports.inherits_browserExports=$I;exports.require$$3=p2;exports.requireBuffer=Lb;exports.string_decoder=q5;
|