@eluvio/elv-player-js 2.0.48 → 2.0.50
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 +15 -15
- package/dist/{dash.all.min-QGl1wpEL.mjs → dash.all.min-BYIiRwuH.mjs} +1 -1
- package/dist/{dash.all.min-C5AV2rW3.js → dash.all.min-BmN834Y_.js} +1 -1
- package/dist/elv-player-js.cjs.js +1 -1
- package/dist/elv-player-js.es.js +1 -1
- package/dist/{index-DwLyci4f.js → index-BzRC8b7B.js} +1 -1
- package/dist/{index-CdPL6p_Q.mjs → index-CiWJ7kFm.mjs} +1 -1
- package/dist/{index-B_ShZAcQ.js → index-Df2RItfZ.js} +3 -3
- package/dist/{index-CzgSAUk0.mjs → index-Inr3N_z2.mjs} +34 -21
- package/lib/player/Player.js +18 -10
- package/lib/player/PlayerParameters.js +2 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const Dt={ui:{WEB:"web",TV:"tv"},networks:{MAIN:"https://main.net955305.contentfabric.io/config",DEMO:"https://demov3.net955210.contentfabric.io/config",DEMO_LOCAL:"http://localhost:8008/config?qspace=demov3&self",TEST:"https://test.net955203.contentfabric.io/config",TESTV4:"https://test.net955205.contentfabric.io/config"},playerProfile:{DEFAULT:"default",LOW_LATENCY:"low_latency",ULTRA_LOW_LATENCY:"ultra_low_latency",CUSTOM:"custom"},drms:{FAIRPLAY:"fairplay",SAMPLE_AES:"sample-aes",AES128:"aes-128",WIDEVINE:"widevine",CLEAR:"clear",PLAYREADY:"playready"},protocols:{HLS:"hls",DASH:"dash"},autoplay:{OFF:!1,WHEN_VISIBLE:"when visible",ON:!0},controls:{OFF:!1,OFF_WITH_VOLUME_TOGGLE:"off_with_volume_toggle",AUTO_HIDE:"autohide",ON:!0,DEFAULT:"default"},title:{ON:!0,OFF:!1,FULLSCREEN_ONLY:"fullscreen_only"},type:{LIVE:"live",VOD:"vod"},loop:{OFF:!1,ON:!0},muted:{OFF:!1,WHEN_NOT_VISIBLE:"when_not_visible",OFF_IF_POSSIBLE:"off_if_possible",ON:!0},watermark:{OFF:!1,ON:!0},accountWatermark:{OFF:!1,ON:!0},capLevelToPlayerSize:{OFF:!1,ON:!0},keyboardControls:{OFF:!1,ON:!0,ARROW_KEYS_DISABLED:"arrow_keys_disabled"},showLoader:{OFF:!1,ON:!0},collectVideoAnalytics:{OFF:!1,ON:!0,DISABLE_COOKIES:"disable_cookies"},verifyContent:{OFF:!1,ON:!0},liveDVR:{OFF:!1,ON:!0},permanentPoster:{OFF:!1,ON:!0},allowCasting:{OFF:!1,ON:!0},preferNativeHLS:{OFF:!1,ON:!0}},VG={clientOptions:{network:Dt.networks.MAIN,client:void 0,staticToken:void 0,tenantId:void 0,ntpId:void 0,promptTicket:!1,ticketCode:void 0,ticketSubject:void 0,ticketTitle:void 0,ticketDescription:void 0},sourceOptions:{protocols:[Dt.protocols.HLS,Dt.protocols.DASH],drms:[Dt.drms.FAIRPLAY,Dt.drms.SAMPLE_AES,Dt.drms.AES128,Dt.drms.WIDEVINE,Dt.drms.CLEAR,Dt.drms.PLAYREADY],contentInfo:{title:void 0,subtitle:void 0,description:void 0,image:void 0,posterImage:void 0,type:Dt.type.VOD,liveDVR:Dt.liveDVR.OFF,headers:[]},playoutOptions:void 0,playoutParameters:{objectId:void 0,versionHash:void 0,writeToken:void 0,linkPath:void 0,signedLink:!1,handler:"playout",offering:void 0,offerings:[],channel:void 0,playoutType:void 0,context:void 0,hlsjsProfile:!0,authorizationToken:void 0,clipStart:void 0,clipEnd:void 0,audioTrackLabel:void 0}},playerOptions:{appName:void 0,backgroundColor:void 0,ui:Dt.ui.WEB,controls:Dt.controls.AUTO_HIDE,autoplay:Dt.autoplay.OFF,muted:Dt.muted.OFF,loop:Dt.loop.OFF,watermark:Dt.watermark.ON,keyboardControls:Dt.keyboardControls.ON,capLevelToPlayerSize:Dt.capLevelToPlayerSize.OFF,title:Dt.title.ON,playerProfile:Dt.playerProfile.DEFAULT,collectVideoAnalytics:Dt.collectVideoAnalytics.ON,verifyContent:Dt.verifyContent.OFF,showLoader:Dt.showLoader.ON,permanentPoster:Dt.permanentPoster.OFF,allowCasting:Dt.allowCasting.ON,preferNativeHLS:Dt.preferNativeHLS.OFF,startTime:void 0,startProgress:void 0,hlsjsOptions:void 0,dashjsOptions:void 0,debugLogging:!1,maxBitrate:void 0,playerCallback:({player:n,videoElement:e,hlsPlayer:t,dashPlayer:r})=>{},errorCallback:(n,e)=>{console.error("ELUVIO PLAYER: Error"),console.error(n)},restartCallback:async n=>{}}};var Fa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function h2(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var $8={exports:{}},Mv={},V8={exports:{}},Vn={};/**
|
|
1
|
+
"use strict";const Dt={ui:{WEB:"web",TV:"tv"},networks:{MAIN:"https://main.net955305.contentfabric.io/config",DEMO:"https://demov3.net955210.contentfabric.io/config",DEMO_LOCAL:"http://localhost:8008/config?qspace=demov3&self",TEST:"https://test.net955203.contentfabric.io/config",TESTV4:"https://test.net955205.contentfabric.io/config"},playerProfile:{DEFAULT:"default",LOW_LATENCY:"low_latency",ULTRA_LOW_LATENCY:"ultra_low_latency",CUSTOM:"custom"},drms:{FAIRPLAY:"fairplay",SAMPLE_AES:"sample-aes",AES128:"aes-128",WIDEVINE:"widevine",CLEAR:"clear",PLAYREADY:"playready"},protocols:{HLS:"hls",DASH:"dash"},autoplay:{OFF:!1,WHEN_VISIBLE:"when visible",ON:!0},controls:{OFF:!1,OFF_WITH_VOLUME_TOGGLE:"off_with_volume_toggle",AUTO_HIDE:"autohide",ON:!0,DEFAULT:"default"},title:{ON:!0,OFF:!1,FULLSCREEN_ONLY:"fullscreen_only"},type:{LIVE:"live",VOD:"vod"},loop:{OFF:!1,ON:!0},muted:{OFF:!1,WHEN_NOT_VISIBLE:"when_not_visible",OFF_IF_POSSIBLE:"off_if_possible",ON:!0},watermark:{OFF:!1,ON:!0},accountWatermark:{OFF:!1,ON:!0},capLevelToPlayerSize:{OFF:!1,ON:!0},keyboardControls:{OFF:!1,ON:!0,ARROW_KEYS_DISABLED:"arrow_keys_disabled"},showLoader:{OFF:!1,ON:!0},collectVideoAnalytics:{OFF:!1,ON:!0,DISABLE_COOKIES:"disable_cookies"},verifyContent:{OFF:!1,ON:!0},liveDVR:{OFF:!1,ON:!0},permanentPoster:{OFF:!1,ON:!0},allowCasting:{OFF:!1,ON:!0},preferNativeHLS:{OFF:!1,ON:!0}},VG={clientOptions:{network:Dt.networks.MAIN,client:void 0,staticToken:void 0,tenantId:void 0,ntpId:void 0,promptTicket:!1,ticketCode:void 0,ticketSubject:void 0,ticketTitle:void 0,ticketDescription:void 0},sourceOptions:{protocols:[Dt.protocols.HLS,Dt.protocols.DASH],drms:[Dt.drms.FAIRPLAY,Dt.drms.SAMPLE_AES,Dt.drms.AES128,Dt.drms.WIDEVINE,Dt.drms.CLEAR,Dt.drms.PLAYREADY],contentInfo:{title:void 0,subtitle:void 0,description:void 0,image:void 0,posterImage:void 0,type:Dt.type.VOD,liveDVR:Dt.liveDVR.OFF,headers:[]},playoutOptions:void 0,playoutParameters:{objectId:void 0,versionHash:void 0,writeToken:void 0,linkPath:void 0,signedLink:!1,handler:"playout",offering:void 0,offerings:[],channel:void 0,playoutType:void 0,context:void 0,hlsjsProfile:!0,authorizationToken:void 0,clipStart:void 0,clipEnd:void 0,audioTrackLabel:void 0,options:void 0}},playerOptions:{appName:void 0,backgroundColor:void 0,ui:Dt.ui.WEB,controls:Dt.controls.AUTO_HIDE,autoplay:Dt.autoplay.OFF,muted:Dt.muted.OFF,loop:Dt.loop.OFF,watermark:Dt.watermark.ON,keyboardControls:Dt.keyboardControls.ON,capLevelToPlayerSize:Dt.capLevelToPlayerSize.OFF,title:Dt.title.ON,playerProfile:Dt.playerProfile.DEFAULT,collectVideoAnalytics:Dt.collectVideoAnalytics.ON,verifyContent:Dt.verifyContent.OFF,showLoader:Dt.showLoader.ON,permanentPoster:Dt.permanentPoster.OFF,allowCasting:Dt.allowCasting.ON,preferNativeHLS:Dt.preferNativeHLS.OFF,startTime:void 0,startProgress:void 0,hlsjsOptions:void 0,dashjsOptions:void 0,debugLogging:!1,maxBitrate:void 0,playerCallback:({player:n,videoElement:e,hlsPlayer:t,dashPlayer:r})=>{},errorCallback:(n,e)=>{console.error("ELUVIO PLAYER: Error"),console.error(n)},restartCallback:async n=>{}}};var Fa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function h2(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var $8={exports:{}},Mv={},V8={exports:{}},Vn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react.production.min.js
|
|
4
4
|
*
|
|
@@ -324,7 +324,7 @@ ${o} ${JZ(e)}
|
|
|
324
324
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
325
325
|
* @license MIT
|
|
326
326
|
*/(function(n){const e=tI(),t=nI(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=c,n.SlowBuffer=N,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),q={foo:function(){return 42}};return Object.setPrototypeOf(q,Uint8Array.prototype),Object.setPrototypeOf(Z,q),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 q=new Uint8Array(Z);return Object.setPrototypeOf(q,c.prototype),q}function c(Z,q,W){if(typeof Z=="number"){if(typeof q=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(Z)}return p(Z,q,W)}c.poolSize=8192;function p(Z,q,W){if(typeof Z=="string")return b(Z,q);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,q,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,q,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"),q,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,q,W){return p(Z,q,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,q,W){return h(Z),Z<=0?l(Z):q!==void 0?typeof W=="string"?l(Z).fill(q,W):l(Z).fill(q):l(Z)}c.alloc=function(Z,q,W){return m(Z,q,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,q){if((typeof q!="string"||q==="")&&(q="utf8"),!c.isEncoding(q))throw new TypeError("Unknown encoding: "+q);const W=I(Z,q)|0;let ge=l(W);const _e=ge.write(Z,q);return _e!==W&&(ge=ge.slice(0,_e)),ge}function g(Z){const q=Z.length<0?0:R(Z.length)|0,W=l(q);for(let ge=0;ge<q;ge+=1)W[ge]=Z[ge]&255;return W}function S(Z){if(Ne(Z,Uint8Array)){const q=new Uint8Array(Z);return A(q.buffer,q.byteOffset,q.byteLength)}return g(Z)}function A(Z,q,W){if(q<0||Z.byteLength<q)throw new RangeError('"offset" is outside of buffer bounds');if(Z.byteLength<q+(W||0))throw new RangeError('"length" is outside of buffer bounds');let ge;return q===void 0&&W===void 0?ge=new Uint8Array(Z):W===void 0?ge=new Uint8Array(Z,q):ge=new Uint8Array(Z,q,W),Object.setPrototypeOf(ge,c.prototype),ge}function k(Z){if(c.isBuffer(Z)){const q=R(Z.length)|0,W=l(q);return W.length===0||Z.copy(W,0,0,q),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 N(Z){return+Z!=Z&&(Z=0),c.alloc(+Z)}c.isBuffer=function(q){return q!=null&&q._isBuffer===!0&&q!==c.prototype},c.compare=function(q,W){if(Ne(q,Uint8Array)&&(q=c.from(q,q.offset,q.byteLength)),Ne(W,Uint8Array)&&(W=c.from(W,W.offset,W.byteLength)),!c.isBuffer(q)||!c.isBuffer(W))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(q===W)return 0;let ge=q.length,_e=W.length;for(let Re=0,Be=Math.min(ge,_e);Re<Be;++Re)if(q[Re]!==W[Re]){ge=q[Re],_e=W[Re];break}return ge<_e?-1:_e<ge?1:0},c.isEncoding=function(q){switch(String(q).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(q,W){if(!Array.isArray(q))throw new TypeError('"list" argument must be an Array of Buffers');if(q.length===0)return c.alloc(0);let ge;if(W===void 0)for(W=0,ge=0;ge<q.length;++ge)W+=q[ge].length;const _e=c.allocUnsafe(W);let Re=0;for(ge=0;ge<q.length;++ge){let Be=q[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,q){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(q){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;q=(""+q).toLowerCase(),_e=!0}}c.byteLength=I;function $(Z,q,W){let ge=!1;if((q===void 0||q<0)&&(q=0),q>this.length||((W===void 0||W>this.length)&&(W=this.length),W<=0)||(W>>>=0,q>>>=0,W<=q))return"";for(Z||(Z="utf8");;)switch(Z){case"hex":return Q(this,q,W);case"utf8":case"utf-8":return x(this,q,W);case"ascii":return F(this,q,W);case"latin1":case"binary":return H(this,q,W);case"base64":return C(this,q,W);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ae(this,q,W);default:if(ge)throw new TypeError("Unknown encoding: "+Z);Z=(Z+"").toLowerCase(),ge=!0}}c.prototype._isBuffer=!0;function V(Z,q,W){const ge=Z[q];Z[q]=Z[W],Z[W]=ge}c.prototype.swap16=function(){const q=this.length;if(q%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let W=0;W<q;W+=2)V(this,W,W+1);return this},c.prototype.swap32=function(){const q=this.length;if(q%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let W=0;W<q;W+=4)V(this,W,W+3),V(this,W+1,W+2);return this},c.prototype.swap64=function(){const q=this.length;if(q%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let W=0;W<q;W+=8)V(this,W,W+7),V(this,W+1,W+6),V(this,W+2,W+5),V(this,W+3,W+4);return this},c.prototype.toString=function(){const q=this.length;return q===0?"":arguments.length===0?x(this,0,q):$.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(q){if(!c.isBuffer(q))throw new TypeError("Argument must be a Buffer");return this===q?!0:c.compare(this,q)===0},c.prototype.inspect=function(){let q="";const W=n.INSPECT_MAX_BYTES;return q=this.toString("hex",0,W).replace(/(.{2})/g,"$1 ").trim(),this.length>W&&(q+=" ... "),"<Buffer "+q+">"},r&&(c.prototype[r]=c.prototype.inspect),c.prototype.compare=function(q,W,ge,_e,Re){if(Ne(q,Uint8Array)&&(q=c.from(q,q.offset,q.byteLength)),!c.isBuffer(q))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof q);if(W===void 0&&(W=0),ge===void 0&&(ge=q?q.length:0),_e===void 0&&(_e=0),Re===void 0&&(Re=this.length),W<0||ge>q.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===q)return 0;let Be=Re-_e,wt=ge-W;const yt=Math.min(Be,wt),gt=this.slice(_e,Re),At=q.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,q,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 q=="string"&&(q=c.from(q,ge)),c.isBuffer(q))return q.length===0?-1:oe(Z,q,W,ge,_e);if(typeof q=="number")return q=q&255,typeof Uint8Array.prototype.indexOf=="function"?_e?Uint8Array.prototype.indexOf.call(Z,q,W):Uint8Array.prototype.lastIndexOf.call(Z,q,W):oe(Z,[q],W,ge,_e);throw new TypeError("val must be string, number or Buffer")}function oe(Z,q,W,ge,_e){let Re=1,Be=Z.length,wt=q.length;if(ge!==void 0&&(ge=String(ge).toLowerCase(),ge==="ucs2"||ge==="ucs-2"||ge==="utf16le"||ge==="utf-16le")){if(Z.length<2||q.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(q,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(q,Ot)){At=!1;break}if(At)return gt}return-1}c.prototype.includes=function(q,W,ge){return this.indexOf(q,W,ge)!==-1},c.prototype.indexOf=function(q,W,ge){return de(this,q,W,ge,!0)},c.prototype.lastIndexOf=function(q,W,ge){return de(this,q,W,ge,!1)};function he(Z,q,W,ge){W=Number(W)||0;const _e=Z.length-W;ge?(ge=Number(ge),ge>_e&&(ge=_e)):ge=_e;const Re=q.length;ge>Re/2&&(ge=Re/2);let Be;for(Be=0;Be<ge;++Be){const wt=parseInt(q.substr(Be*2,2),16);if(Qe(wt))return Be;Z[W+Be]=wt}return Be}function xe(Z,q,W,ge){return Ee(P(q,Z.length-W),Z,W,ge)}function Ce(Z,q,W,ge){return Ee(U(q),Z,W,ge)}function ne(Z,q,W,ge){return Ee(le(q),Z,W,ge)}function Le(Z,q,W,ge){return Ee(ee(q,Z.length-W),Z,W,ge)}c.prototype.write=function(q,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),q.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 he(this,q,W,ge);case"utf8":case"utf-8":return xe(this,q,W,ge);case"ascii":case"latin1":case"binary":return Ce(this,q,W,ge);case"base64":return ne(this,q,W,ge);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Le(this,q,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,q,W){return q===0&&W===Z.length?e.fromByteArray(Z):e.fromByteArray(Z.slice(q,W))}function x(Z,q,W){W=Math.min(Z.length,W);const ge=[];let _e=q;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 j(ge)}const O=4096;function j(Z){const q=Z.length;if(q<=O)return String.fromCharCode.apply(String,Z);let W="",ge=0;for(;ge<q;)W+=String.fromCharCode.apply(String,Z.slice(ge,ge+=O));return W}function F(Z,q,W){let ge="";W=Math.min(Z.length,W);for(let _e=q;_e<W;++_e)ge+=String.fromCharCode(Z[_e]&127);return ge}function H(Z,q,W){let ge="";W=Math.min(Z.length,W);for(let _e=q;_e<W;++_e)ge+=String.fromCharCode(Z[_e]);return ge}function Q(Z,q,W){const ge=Z.length;(!q||q<0)&&(q=0),(!W||W<0||W>ge)&&(W=ge);let _e="";for(let Re=q;Re<W;++Re)_e+=st[Z[Re]];return _e}function ae(Z,q,W){const ge=Z.slice(q,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(q,W){const ge=this.length;q=~~q,W=W===void 0?ge:~~W,q<0?(q+=ge,q<0&&(q=0)):q>ge&&(q=ge),W<0?(W+=ge,W<0&&(W=0)):W>ge&&(W=ge),W<q&&(W=q);const _e=this.subarray(q,W);return Object.setPrototypeOf(_e,c.prototype),_e};function L(Z,q,W){if(Z%1!==0||Z<0)throw new RangeError("offset is not uint");if(Z+q>W)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(q,W,ge){q=q>>>0,W=W>>>0,ge||L(q,W,this.length);let _e=this[q],Re=1,Be=0;for(;++Be<W&&(Re*=256);)_e+=this[q+Be]*Re;return _e},c.prototype.readUintBE=c.prototype.readUIntBE=function(q,W,ge){q=q>>>0,W=W>>>0,ge||L(q,W,this.length);let _e=this[q+--W],Re=1;for(;W>0&&(Re*=256);)_e+=this[q+--W]*Re;return _e},c.prototype.readUint8=c.prototype.readUInt8=function(q,W){return q=q>>>0,W||L(q,1,this.length),this[q]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(q,W){return q=q>>>0,W||L(q,2,this.length),this[q]|this[q+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(q,W){return q=q>>>0,W||L(q,2,this.length),this[q]<<8|this[q+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(q,W){return q=q>>>0,W||L(q,4,this.length),(this[q]|this[q+1]<<8|this[q+2]<<16)+this[q+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(q,W){return q=q>>>0,W||L(q,4,this.length),this[q]*16777216+(this[q+1]<<16|this[q+2]<<8|this[q+3])},c.prototype.readBigUInt64LE=xt(function(q){q=q>>>0,ce(q,"offset");const W=this[q],ge=this[q+7];(W===void 0||ge===void 0)&&te(q,this.length-8);const _e=W+this[++q]*2**8+this[++q]*2**16+this[++q]*2**24,Re=this[++q]+this[++q]*2**8+this[++q]*2**16+ge*2**24;return BigInt(_e)+(BigInt(Re)<<BigInt(32))}),c.prototype.readBigUInt64BE=xt(function(q){q=q>>>0,ce(q,"offset");const W=this[q],ge=this[q+7];(W===void 0||ge===void 0)&&te(q,this.length-8);const _e=W*2**24+this[++q]*2**16+this[++q]*2**8+this[++q],Re=this[++q]*2**24+this[++q]*2**16+this[++q]*2**8+ge;return(BigInt(_e)<<BigInt(32))+BigInt(Re)}),c.prototype.readIntLE=function(q,W,ge){q=q>>>0,W=W>>>0,ge||L(q,W,this.length);let _e=this[q],Re=1,Be=0;for(;++Be<W&&(Re*=256);)_e+=this[q+Be]*Re;return Re*=128,_e>=Re&&(_e-=Math.pow(2,8*W)),_e},c.prototype.readIntBE=function(q,W,ge){q=q>>>0,W=W>>>0,ge||L(q,W,this.length);let _e=W,Re=1,Be=this[q+--_e];for(;_e>0&&(Re*=256);)Be+=this[q+--_e]*Re;return Re*=128,Be>=Re&&(Be-=Math.pow(2,8*W)),Be},c.prototype.readInt8=function(q,W){return q=q>>>0,W||L(q,1,this.length),this[q]&128?(255-this[q]+1)*-1:this[q]},c.prototype.readInt16LE=function(q,W){q=q>>>0,W||L(q,2,this.length);const ge=this[q]|this[q+1]<<8;return ge&32768?ge|4294901760:ge},c.prototype.readInt16BE=function(q,W){q=q>>>0,W||L(q,2,this.length);const ge=this[q+1]|this[q]<<8;return ge&32768?ge|4294901760:ge},c.prototype.readInt32LE=function(q,W){return q=q>>>0,W||L(q,4,this.length),this[q]|this[q+1]<<8|this[q+2]<<16|this[q+3]<<24},c.prototype.readInt32BE=function(q,W){return q=q>>>0,W||L(q,4,this.length),this[q]<<24|this[q+1]<<16|this[q+2]<<8|this[q+3]},c.prototype.readBigInt64LE=xt(function(q){q=q>>>0,ce(q,"offset");const W=this[q],ge=this[q+7];(W===void 0||ge===void 0)&&te(q,this.length-8);const _e=this[q+4]+this[q+5]*2**8+this[q+6]*2**16+(ge<<24);return(BigInt(_e)<<BigInt(32))+BigInt(W+this[++q]*2**8+this[++q]*2**16+this[++q]*2**24)}),c.prototype.readBigInt64BE=xt(function(q){q=q>>>0,ce(q,"offset");const W=this[q],ge=this[q+7];(W===void 0||ge===void 0)&&te(q,this.length-8);const _e=(W<<24)+this[++q]*2**16+this[++q]*2**8+this[++q];return(BigInt(_e)<<BigInt(32))+BigInt(this[++q]*2**24+this[++q]*2**16+this[++q]*2**8+ge)}),c.prototype.readFloatLE=function(q,W){return q=q>>>0,W||L(q,4,this.length),t.read(this,q,!0,23,4)},c.prototype.readFloatBE=function(q,W){return q=q>>>0,W||L(q,4,this.length),t.read(this,q,!1,23,4)},c.prototype.readDoubleLE=function(q,W){return q=q>>>0,W||L(q,8,this.length),t.read(this,q,!0,52,8)},c.prototype.readDoubleBE=function(q,W){return q=q>>>0,W||L(q,8,this.length),t.read(this,q,!1,52,8)};function T(Z,q,W,ge,_e,Re){if(!c.isBuffer(Z))throw new TypeError('"buffer" argument must be a Buffer instance');if(q>_e||q<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(q,W,ge,_e){if(q=+q,W=W>>>0,ge=ge>>>0,!_e){const wt=Math.pow(2,8*ge)-1;T(this,q,W,ge,wt,0)}let Re=1,Be=0;for(this[W]=q&255;++Be<ge&&(Re*=256);)this[W+Be]=q/Re&255;return W+ge},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(q,W,ge,_e){if(q=+q,W=W>>>0,ge=ge>>>0,!_e){const wt=Math.pow(2,8*ge)-1;T(this,q,W,ge,wt,0)}let Re=ge-1,Be=1;for(this[W+Re]=q&255;--Re>=0&&(Be*=256);)this[W+Re]=q/Be&255;return W+ge},c.prototype.writeUint8=c.prototype.writeUInt8=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,1,255,0),this[W]=q&255,W+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,2,65535,0),this[W]=q&255,this[W+1]=q>>>8,W+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,2,65535,0),this[W]=q>>>8,this[W+1]=q&255,W+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,4,4294967295,0),this[W+3]=q>>>24,this[W+2]=q>>>16,this[W+1]=q>>>8,this[W]=q&255,W+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,4,4294967295,0),this[W]=q>>>24,this[W+1]=q>>>16,this[W+2]=q>>>8,this[W+3]=q&255,W+4};function Y(Z,q,W,ge,_e){pe(q,ge,_e,Z,W,7);let Re=Number(q&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(q>>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 ie(Z,q,W,ge,_e){pe(q,ge,_e,Z,W,7);let Re=Number(q&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(q>>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=xt(function(q,W=0){return Y(this,q,W,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=xt(function(q,W=0){return ie(this,q,W,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(q,W,ge,_e){if(q=+q,W=W>>>0,!_e){const yt=Math.pow(2,8*ge-1);T(this,q,W,ge,yt-1,-yt)}let Re=0,Be=1,wt=0;for(this[W]=q&255;++Re<ge&&(Be*=256);)q<0&&wt===0&&this[W+Re-1]!==0&&(wt=1),this[W+Re]=(q/Be>>0)-wt&255;return W+ge},c.prototype.writeIntBE=function(q,W,ge,_e){if(q=+q,W=W>>>0,!_e){const yt=Math.pow(2,8*ge-1);T(this,q,W,ge,yt-1,-yt)}let Re=ge-1,Be=1,wt=0;for(this[W+Re]=q&255;--Re>=0&&(Be*=256);)q<0&&wt===0&&this[W+Re+1]!==0&&(wt=1),this[W+Re]=(q/Be>>0)-wt&255;return W+ge},c.prototype.writeInt8=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,1,127,-128),q<0&&(q=255+q+1),this[W]=q&255,W+1},c.prototype.writeInt16LE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,2,32767,-32768),this[W]=q&255,this[W+1]=q>>>8,W+2},c.prototype.writeInt16BE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,2,32767,-32768),this[W]=q>>>8,this[W+1]=q&255,W+2},c.prototype.writeInt32LE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,4,2147483647,-2147483648),this[W]=q&255,this[W+1]=q>>>8,this[W+2]=q>>>16,this[W+3]=q>>>24,W+4},c.prototype.writeInt32BE=function(q,W,ge){return q=+q,W=W>>>0,ge||T(this,q,W,4,2147483647,-2147483648),q<0&&(q=4294967295+q+1),this[W]=q>>>24,this[W+1]=q>>>16,this[W+2]=q>>>8,this[W+3]=q&255,W+4},c.prototype.writeBigInt64LE=xt(function(q,W=0){return Y(this,q,W,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=xt(function(q,W=0){return ie(this,q,W,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function B(Z,q,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,q,W,ge,_e){return q=+q,W=W>>>0,_e||B(Z,q,W,4),t.write(Z,q,W,ge,23,4),W+4}c.prototype.writeFloatLE=function(q,W,ge){return be(this,q,W,!0,ge)},c.prototype.writeFloatBE=function(q,W,ge){return be(this,q,W,!1,ge)};function Ie(Z,q,W,ge,_e){return q=+q,W=W>>>0,_e||B(Z,q,W,8),t.write(Z,q,W,ge,52,8),W+8}c.prototype.writeDoubleLE=function(q,W,ge){return Ie(this,q,W,!0,ge)},c.prototype.writeDoubleBE=function(q,W,ge){return Ie(this,q,W,!1,ge)},c.prototype.copy=function(q,W,ge,_e){if(!c.isBuffer(q))throw new TypeError("argument should be a Buffer");if(ge||(ge=0),!_e&&_e!==0&&(_e=this.length),W>=q.length&&(W=q.length),W||(W=0),_e>0&&_e<ge&&(_e=ge),_e===ge||q.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),q.length-W<_e-ge&&(_e=q.length-W+ge);const Re=_e-ge;return this===q&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(W,ge,_e):Uint8Array.prototype.set.call(q,this.subarray(ge,_e),W),Re},c.prototype.fill=function(q,W,ge,_e){if(typeof q=="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(q.length===1){const Be=q.charCodeAt(0);(_e==="utf8"&&Be<128||_e==="latin1")&&(q=Be)}}else typeof q=="number"?q=q&255:typeof q=="boolean"&&(q=Number(q));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,q||(q=0);let Re;if(typeof q=="number")for(Re=W;Re<ge;++Re)this[Re]=q;else{const Be=c.isBuffer(q)?q:c.from(q,_e),wt=Be.length;if(wt===0)throw new TypeError('The value "'+q+'" 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,q,W){Me[Z]=class extends W{constructor(){super(),Object.defineProperty(this,"message",{value:q.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,q){return`The "${Z}" argument must be of type number. Received type ${typeof q}`},TypeError),De("ERR_OUT_OF_RANGE",function(Z,q,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 ${q}. Received ${_e}`,ge},RangeError);function se(Z){let q="",W=Z.length;const ge=Z[0]==="-"?1:0;for(;W>=ge+4;W-=3)q=`_${Z.slice(W-3,W)}${q}`;return`${Z.slice(0,W)}${q}`}function ue(Z,q,W){ce(q,"offset"),(Z[q]===void 0||Z[q+W]===void 0)&&te(q,Z.length-(W+1))}function pe(Z,q,W,ge,_e,Re){if(Z>W||Z<q){const Be=typeof q=="bigint"?"n":"";let wt;throw q===0||q===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)}ue(ge,_e,Re)}function ce(Z,q){if(typeof Z!="number")throw new Me.ERR_INVALID_ARG_TYPE(q,"number",Z)}function te(Z,q,W){throw Math.floor(Z)!==Z?(ce(Z,W),new Me.ERR_OUT_OF_RANGE("offset","an integer",Z)):q<0?new Me.ERR_BUFFER_OUT_OF_BOUNDS:new Me.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${q}`,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,q){q=q||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){(q-=3)>-1&&Re.push(239,191,189);continue}else if(Be+1===ge){(q-=3)>-1&&Re.push(239,191,189);continue}_e=W;continue}if(W<56320){(q-=3)>-1&&Re.push(239,191,189),_e=W;continue}W=(_e-55296<<10|W-56320)+65536}else _e&&(q-=3)>-1&&Re.push(239,191,189);if(_e=null,W<128){if((q-=1)<0)break;Re.push(W)}else if(W<2048){if((q-=2)<0)break;Re.push(W>>6|192,W&63|128)}else if(W<65536){if((q-=3)<0)break;Re.push(W>>12|224,W>>6&63|128,W&63|128)}else if(W<1114112){if((q-=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 q=[];for(let W=0;W<Z.length;++W)q.push(Z.charCodeAt(W)&255);return q}function ee(Z,q){let W,ge,_e;const Re=[];for(let Be=0;Be<Z.length&&!((q-=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,q,W,ge){let _e;for(_e=0;_e<ge&&!(_e+W>=q.length||_e>=Z.length);++_e)q[_e+W]=Z[_e];return _e}function Ne(Z,q){return Z instanceof q||Z!=null&&Z.constructor!=null&&Z.constructor.name!=null&&Z.constructor.name===q.name}function Qe(Z){return Z!==Z}const st=function(){const Z="0123456789abcdef",q=new Array(256);for(let W=0;W<16;++W){const ge=W*16;for(let _e=0;_e<16;++_e)q[ge+_e]=Z[W]+Z[_e]}return q}();function xt(Z){return typeof BigInt>"u"?Et:Z}function Et(){throw new Error("BigInt not supported")}})($d);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},RF={exports:{}},Hv={exports:{}},hN;function Ob(){if(hN)return Hv.exports;hN=1;const{AbortController:n,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Hv.exports=n,Hv.exports.AbortSignal=e,Hv.exports.default=n,Hv.exports}var B5={exports:{}},Vy=typeof Reflect=="object"?Reflect:null,yN=Vy&&typeof Vy.apply=="function"?Vy.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Ix;Vy&&typeof Vy.ownKeys=="function"?Ix=Vy.ownKeys:Object.getOwnPropertySymbols?Ix=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ix=function(e){return Object.getOwnPropertyNames(e)};function uae(n){console&&console.warn&&console.warn(n)}var OF=Number.isNaN||function(e){return e!==e};function Ar(){Ar.init.call(this)}B5.exports=Ar;B5.exports.once=pae;Ar.EventEmitter=Ar;Ar.prototype._events=void 0;Ar.prototype._eventsCount=0;Ar.prototype._maxListeners=void 0;var mN=10;function z2(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 mN},set:function(n){if(typeof n!="number"||n<0||OF(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");mN=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||OF(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 LF(n){return n._maxListeners===void 0?Ar.defaultMaxListeners:n._maxListeners}Ar.prototype.getMaxListeners=function(){return LF(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")yN(p,this,t);else for(var h=p.length,m=UF(p,h),r=0;r<h;++r)yN(m[r],this,t);return!0};function NF(n,e,t,r){var i,o,l;if(z2(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=LF(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,uae(c)}return n}Ar.prototype.addListener=function(e,t){return NF(this,e,t,!1)};Ar.prototype.on=Ar.prototype.addListener;Ar.prototype.prependListener=function(e,t){return NF(this,e,t,!0)};function cae(){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 PF(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=cae.bind(r);return i.listener=t,r.wrapFn=i,i}Ar.prototype.once=function(e,t){return z2(t),this.on(e,PF(this,e,t)),this};Ar.prototype.prependOnceListener=function(e,t){return z2(t),this.prependListener(e,PF(this,e,t)),this};Ar.prototype.removeListener=function(e,t){var r,i,o,l,c;if(z2(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():fae(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 IF(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?dae(i):UF(i,i.length)}Ar.prototype.listeners=function(e){return IF(this,e,!0)};Ar.prototype.rawListeners=function(e){return IF(this,e,!1)};Ar.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):DF.call(n,e)};Ar.prototype.listenerCount=DF;function DF(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?Ix(this._events):[]};function UF(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function fae(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function dae(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function pae(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))}FF(n,e,o,{once:!0}),e!=="error"&&hae(n,i,{once:!0})})}function hae(n,e,t){typeof n.on=="function"&&FF(n,"error",e,t)}function FF(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 Kb=B5.exports;(function(n){const e=$d,{kResistStopPropagation:t,SymbolDispose:r}=ma,i=globalThis.AbortSignal||Ob().AbortSignal,o=globalThis.AbortController||Ob().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}
|
|
327
|
-
`;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:Kb.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")})(RF);var xs=RF.exports,z5={};const{format:yae,inspect:t2,AggregateError:mae}=xs,gae=globalThis.AggregateError||mae,vae=Symbol("kIsNodeError"),bae=["string","function","number","object","Function","Object","boolean","bigint","symbol"],wae=/^([A-Z][a-z0-9]*)+$/,_ae="__node_internal_",j2={};function dh(n,e){if(!n)throw new j2.ERR_INTERNAL_ASSERTION(e)}function gN(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 xae(n,e,t){if(typeof e=="function")return dh(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 dh(r===t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${r}).`),t.length===0?e:yae(e,...t)}function Ti(n,e,t){t||(t=Error);class r extends t{constructor(...o){super(xae(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[vae]=!0,j2[n]=r}function vN(n){const e=_ae+n.name;return Object.defineProperty(n,"name",{value:e}),n}function Sae(n,e){if(n&&e&&n!==e){if(Array.isArray(e.errors))return e.errors.push(n),e;const t=new gae([e,n],e.message);return t.code=e.code,t}return n||e}let Cae=class extends Error{constructor(e="The operation was aborted",t=void 0){if(t!==void 0&&typeof t!="object")throw new j2.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Ti("ERR_ASSERTION","%s",Error);Ti("ERR_INVALID_ARG_TYPE",(n,e,t)=>{dh(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)dh(typeof p=="string","All expected entries have to be of type string"),bae.includes(p)?i.push(p.toLowerCase()):wae.test(p)?o.push(p):(dh(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=t2(t,{depth:-1});r+=`. Received ${p}`}}else{let p=t2(t,{colors:!1});p.length>25&&(p=`${p.slice(0,25)}...`),r+=`. Received type ${typeof t} (${p})`}return r},TypeError);Ti("ERR_INVALID_ARG_VALUE",(n,e,t="is invalid")=>{let r=t2(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${n.includes(".")?"property":"argument"} '${n}' ${t}. Received ${r}`},TypeError);Ti("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);Ti("ERR_MISSING_ARGS",(...n)=>{dh(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);Ti("ERR_OUT_OF_RANGE",(n,e,t)=>{dh(e,'Missing "range" argument');let r;return Number.isInteger(t)&&Math.abs(t)>2**32?r=gN(String(t)):typeof t=="bigint"?(r=String(t),(t>2n**32n||t<-(2n**32n))&&(r=gN(r)),r+="n"):r=t2(t),`The value of "${n}" is out of range. It must be ${e}. Received ${r}`},RangeError);Ti("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Ti("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Ti("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Ti("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Ti("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Ti("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ti("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Ti("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Ti("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Ti("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Ti("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var eo={AbortError:Cae,aggregateTwoErrors:vN(Sae),hideStackFrames:vN,codes:j2};const{ArrayIsArray:j5,ArrayPrototypeIncludes:BF,ArrayPrototypeJoin:zF,ArrayPrototypeMap:Eae,NumberIsInteger:H5,NumberIsNaN:Aae,NumberMAX_SAFE_INTEGER:kae,NumberMIN_SAFE_INTEGER:Mae,NumberParseInt:Tae,ObjectPrototypeHasOwnProperty:Rae,RegExpPrototypeExec:jF,String:Oae,StringPrototypeToUpperCase:Lae,StringPrototypeTrim:Nae}=ma,{hideStackFrames:Yo,codes:{ERR_SOCKET_BAD_PORT:Pae,ERR_INVALID_ARG_TYPE:as,ERR_INVALID_ARG_VALUE:_m,ERR_OUT_OF_RANGE:bh,ERR_UNKNOWN_SIGNAL:bN}}=eo,{normalizeEncoding:Iae}=xs,{isAsyncFunction:Dae,isArrayBufferView:Uae}=xs.types,wN={};function Fae(n){return n===(n|0)}function Bae(n){return n===n>>>0}const zae=/^[0-7]+$/,jae="must be a 32-bit unsigned integer or an octal string";function Hae(n,e,t){if(typeof n>"u"&&(n=t),typeof n=="string"){if(jF(zae,n)===null)throw new _m(e,n,jae);n=Tae(n,8)}return HF(n,e),n}const qae=Yo((n,e,t=Mae,r=kae)=>{if(typeof n!="number")throw new as(e,"number",n);if(!H5(n))throw new bh(e,"an integer",n);if(n<t||n>r)throw new bh(e,`>= ${t} && <= ${r}`,n)}),$ae=Yo((n,e,t=-2147483648,r=2147483647)=>{if(typeof n!="number")throw new as(e,"number",n);if(!H5(n))throw new bh(e,"an integer",n);if(n<t||n>r)throw new bh(e,`>= ${t} && <= ${r}`,n)}),HF=Yo((n,e,t=!1)=>{if(typeof n!="number")throw new as(e,"number",n);if(!H5(n))throw new bh(e,"an integer",n);const r=t?1:0,i=4294967295;if(n<r||n>i)throw new bh(e,`>= ${r} && <= ${i}`,n)});function q5(n,e){if(typeof n!="string")throw new as(e,"string",n)}function Vae(n,e,t=void 0,r){if(typeof n!="number")throw new as(e,"number",n);if(t!=null&&n<t||r!=null&&n>r||(t!=null||r!=null)&&Aae(n))throw new bh(e,`${t!=null?`>= ${t}`:""}${t!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,n)}const Gae=Yo((n,e,t)=>{if(!BF(t,n)){const i="must be one of: "+zF(Eae(t,o=>typeof o=="string"?`'${o}'`:Oae(o)),", ");throw new _m(e,n,i)}});function qF(n,e){if(typeof n!="boolean")throw new as(e,"boolean",n)}function m8(n,e,t){return n==null||!Rae(n,e)?t:n[e]}const Wae=Yo((n,e,t=null)=>{const r=m8(t,"allowArray",!1),i=m8(t,"allowFunction",!1);if(!m8(t,"nullable",!1)&&n===null||!r&&j5(n)||typeof n!="object"&&(!i||typeof n!="function"))throw new as(e,"Object",n)}),Kae=Yo((n,e)=>{if(n!=null&&typeof n!="object"&&typeof n!="function")throw new as(e,"a dictionary",n)}),H2=Yo((n,e,t=0)=>{if(!j5(n))throw new as(e,"Array",n);if(n.length<t){const r=`must be longer than ${t}`;throw new _m(e,n,r)}});function Yae(n,e){H2(n,e);for(let t=0;t<n.length;t++)q5(n[t],`${e}[${t}]`)}function Jae(n,e){H2(n,e);for(let t=0;t<n.length;t++)qF(n[t],`${e}[${t}]`)}function Qae(n,e){H2(n,e);for(let t=0;t<n.length;t++){const r=n[t],i=`${e}[${t}]`;if(r==null)throw new as(i,"AbortSignal",r);$F(r,i)}}function Zae(n,e="signal"){if(q5(n,e),wN[n]===void 0)throw wN[Lae(n)]!==void 0?new bN(n+" (signals must use all capital letters)"):new bN(n)}const Xae=Yo((n,e="buffer")=>{if(!Uae(n))throw new as(e,["Buffer","TypedArray","DataView"],n)});function eie(n,e){const t=Iae(e),r=n.length;if(t==="hex"&&r%2!==0)throw new _m("encoding",e,`is invalid for data of length ${r}`)}function tie(n,e="Port",t=!0){if(typeof n!="number"&&typeof n!="string"||typeof n=="string"&&Nae(n).length===0||+n!==+n>>>0||n>65535||n===0&&!t)throw new Pae(e,n,t);return n|0}const $F=Yo((n,e)=>{if(n!==void 0&&(n===null||typeof n!="object"||!("aborted"in n)))throw new as(e,"AbortSignal",n)}),nie=Yo((n,e)=>{if(typeof n!="function")throw new as(e,"Function",n)}),rie=Yo((n,e)=>{if(typeof n!="function"||Dae(n))throw new as(e,"Function",n)}),aie=Yo((n,e)=>{if(n!==void 0)throw new as(e,"undefined",n)});function iie(n,e,t){if(!BF(t,n))throw new as(e,`('${zF(t,"|")}')`,n)}const sie=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function _N(n,e){if(typeof n>"u"||!jF(sie,n))throw new _m(e,n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function oie(n){if(typeof n=="string")return _N(n,"hints"),n;if(j5(n)){const e=n.length;let t="";if(e===0)return t;for(let r=0;r<e;r++){const i=n[r];_N(i,"hints"),t+=i,r!==e-1&&(t+=", ")}return t}throw new _m("hints",n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}var Yb={isInt32:Fae,isUint32:Bae,parseFileMode:Hae,validateArray:H2,validateStringArray:Yae,validateBooleanArray:Jae,validateAbortSignalArray:Qae,validateBoolean:qF,validateBuffer:Xae,validateDictionary:Kae,validateEncoding:eie,validateFunction:nie,validateInt32:$ae,validateInteger:qae,validateNumber:Vae,validateObject:Wae,validateOneOf:Gae,validatePlainFunction:rie,validatePort:tie,validateSignalName:Zae,validateString:q5,validateUint32:HF,validateUndefined:aie,validateUnion:iie,validateAbortSignal:$F,validateLinkHeaderValue:oie},$5={exports:{}},g8={exports:{}},xN;function Vd(){if(xN)return g8.exports;xN=1;var n=g8.exports={},e,t;function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function o(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},g8.exports}const{SymbolAsyncIterator:SN,SymbolIterator:CN,SymbolFor:Oh}=ma,VF=Oh("nodejs.stream.destroyed"),GF=Oh("nodejs.stream.errored"),A4=Oh("nodejs.stream.readable"),k4=Oh("nodejs.stream.writable"),WF=Oh("nodejs.stream.disturbed"),lie=Oh("nodejs.webstream.isClosedPromise"),uie=Oh("nodejs.webstream.controllerErrorFunction");function q2(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 $2(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 cie(n){return!!(n&&typeof n.pipe=="function"&&n._readableState&&typeof n.on=="function"&&typeof n.write=="function")}function ec(n){return n&&(n._readableState||n._writableState||typeof n.write=="function"&&typeof n.on=="function"||typeof n.pipe=="function"&&typeof n.on=="function")}function KF(n){return!!(n&&!ec(n)&&typeof n.pipeThrough=="function"&&typeof n.getReader=="function"&&typeof n.cancel=="function")}function YF(n){return!!(n&&!ec(n)&&typeof n.getWriter=="function"&&typeof n.abort=="function")}function JF(n){return!!(n&&!ec(n)&&typeof n.readable=="object"&&typeof n.writable=="object")}function fie(n){return KF(n)||YF(n)||JF(n)}function die(n,e){return n==null?!1:e===!0?typeof n[SN]=="function":e===!1?typeof n[CN]=="function":typeof n[SN]=="function"||typeof n[CN]=="function"}function V2(n){if(!ec(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!!(n.destroyed||n[VF]||r!=null&&r.destroyed)}function QF(n){if(!$2(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 pie(n,e){if(!$2(n))return null;if(n.writableFinished===!0)return!0;const t=n._writableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.finished)!="boolean"?null:!!(t.finished||e===!1&&t.ended===!0&&t.length===0)}function hie(n){if(!q2(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 ZF(n,e){if(!q2(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 XF(n){return n&&n[A4]!=null?n[A4]:typeof(n==null?void 0:n.readable)!="boolean"?null:V2(n)?!1:q2(n)&&n.readable&&!ZF(n)}function eB(n){return n&&n[k4]!=null?n[k4]:typeof(n==null?void 0:n.writable)!="boolean"?null:V2(n)?!1:$2(n)&&n.writable&&!QF(n)}function yie(n,e){return ec(n)?V2(n)?!0:!((e==null?void 0:e.readable)!==!1&&XF(n)||(e==null?void 0:e.writable)!==!1&&eB(n)):null}function mie(n){var e,t;return ec(n)?n.writableErrored?n.writableErrored:(e=(t=n._writableState)===null||t===void 0?void 0:t.errored)!==null&&e!==void 0?e:null:null}function gie(n){var e,t;return ec(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 vie(n){if(!ec(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"&&tB(n)?n._closed:null}function tB(n){return typeof n._closed=="boolean"&&typeof n._defaultKeepAlive=="boolean"&&typeof n._removedConnection=="boolean"&&typeof n._removedContLen=="boolean"}function nB(n){return typeof n._sent100=="boolean"&&tB(n)}function bie(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 wie(n){if(!ec(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!r&&nB(n)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function _ie(n){var e;return!!(n&&((e=n[WF])!==null&&e!==void 0?e:n.readableDidRead||n.readableAborted))}function xie(n){var e,t,r,i,o,l,c,p,h,m;return!!(n&&((e=(t=(r=(i=(o=(l=n[GF])!==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:V2,kIsDestroyed:VF,isDisturbed:_ie,kIsDisturbed:WF,isErrored:xie,kIsErrored:GF,isReadable:XF,kIsReadable:A4,kIsClosedPromise:lie,kControllerErrorFunction:uie,kIsWritable:k4,isClosed:vie,isDuplexNodeStream:cie,isFinished:yie,isIterable:die,isReadableNodeStream:q2,isReadableStream:KF,isReadableEnded:hie,isReadableFinished:ZF,isReadableErrored:gie,isNodeStream:ec,isWebStream:fie,isWritable:eB,isWritableNodeStream:$2,isWritableStream:YF,isWritableEnded:QF,isWritableFinished:pie,isWritableErrored:mie,isServerRequest:bie,isServerResponse:nB,willEmitClose:wie,isTransformStream:JF};const _d=Vd(),{AbortError:rB,codes:Sie}=eo,{ERR_INVALID_ARG_TYPE:Cie,ERR_STREAM_PREMATURE_CLOSE:EN}=Sie,{kEmptyObject:M4,once:T4}=xs,{validateAbortSignal:Eie,validateFunction:Aie,validateObject:kie,validateBoolean:Mie}=Yb,{Promise:Tie,PromisePrototypeThen:Rie,SymbolDispose:aB}=ma,{isClosed:Oie,isReadable:AN,isReadableNodeStream:v8,isReadableStream:Lie,isReadableFinished:kN,isReadableErrored:MN,isWritable:TN,isWritableNodeStream:RN,isWritableStream:Nie,isWritableFinished:ON,isWritableErrored:LN,isNodeStream:Pie,willEmitClose:Iie,kIsClosedPromise:Die}=ef;let Gy;function Uie(n){return n.setHeader&&typeof n.abort=="function"}const R4=()=>{};function iB(n,e,t){var r,i;if(arguments.length===2?(t=e,e=M4):e==null?e=M4:kie(e,"options"),Aie(t,"callback"),Eie(e.signal,"options.signal"),t=T4(t),Lie(n)||Nie(n))return Fie(n,e,t);if(!Pie(n))throw new Cie("stream",["ReadableStream","WritableStream","Stream"],n);const o=(r=e.readable)!==null&&r!==void 0?r:v8(n),l=(i=e.writable)!==null&&i!==void 0?i:RN(n),c=n._writableState,p=n._readableState,h=()=>{n.writable||b()};let m=Iie(n)&&v8(n)===o&&RN(n)===l,w=ON(n,!1);const b=()=>{w=!0,n.destroyed&&(m=!1),!(m&&(!n.readable||o))&&(!o||g)&&t.call(n)};let g=kN(n,!1);const S=()=>{g=!0,n.destroyed&&(m=!1),!(m&&(!n.writable||l))&&(!l||w)&&t.call(n)},A=V=>{t.call(n,V)};let k=Oie(n);const R=()=>{k=!0;const V=LN(n)||MN(n);if(V&&typeof V!="boolean")return t.call(n,V);if(o&&!g&&v8(n,!0)&&!kN(n,!1))return t.call(n,new EN);if(l&&!w&&!ON(n,!1))return t.call(n,new EN);t.call(n)},N=()=>{k=!0;const V=LN(n)||MN(n);if(V&&typeof V!="boolean")return t.call(n,V);t.call(n)},I=()=>{n.req.on("finish",b)};Uie(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?_d.nextTick(R):c!=null&&c.errorEmitted||p!=null&&p.errorEmitted?m||_d.nextTick(N):(!o&&(!m||AN(n))&&(w||TN(n)===!1)||!l&&(!m||TN(n))&&(g||AN(n)===!1)||p&&n.req&&n.aborted)&&_d.nextTick(N);const $=()=>{t=R4,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 V=()=>{const de=t;$(),de.call(n,new rB(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)_d.nextTick(V);else{Gy=Gy||xs.addAbortListener;const de=Gy(e.signal,V),oe=t;t=T4((...he)=>{de[aB](),oe.apply(n,he)})}}return $}function Fie(n,e,t){let r=!1,i=R4;if(e.signal)if(i=()=>{r=!0,t.call(n,new rB(void 0,{cause:e.signal.reason}))},e.signal.aborted)_d.nextTick(i);else{Gy=Gy||xs.addAbortListener;const l=Gy(e.signal,i),c=t;t=T4((...p)=>{l[aB](),c.apply(n,p)})}const o=(...l)=>{r||_d.nextTick(()=>t.apply(n,l))};return Rie(n[Die].promise,o,o),R4}function Bie(n,e){var t;let r=!1;return e===null&&(e=M4),(t=e)!==null&&t!==void 0&&t.cleanup&&(Mie(e.cleanup,"cleanup"),r=e.cleanup),new Tie((i,o)=>{const l=iB(n,e,c=>{r&&l(),c?o(c):i()})})}$5.exports=iB;$5.exports.finished=Bie;var Gd=$5.exports;const qu=Vd(),{aggregateTwoErrors:zie,codes:{ERR_MULTIPLE_CALLBACK:jie},AbortError:Hie}=eo,{Symbol:sB}=ma,{kIsDestroyed:qie,isDestroyed:$ie,isFinished:Vie,isServerRequest:Gie}=ef,oB=sB("kDestroy"),O4=sB("kConstruct");function lB(n,e,t){n&&(n.stack,e&&!e.errored&&(e.errored=n),t&&!t.errored&&(t.errored=n))}function Wie(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):(lB(n,r,t),r&&(r.destroyed=!0),t&&(t.destroyed=!0),i.constructed?NN(this,n,e):this.once(oB,function(o){NN(this,zie(o,n),e)}),this)}function NN(n,e,t){let r=!1;function i(o){if(r)return;r=!0;const l=n._readableState,c=n._writableState;lB(o,c,l),c&&(c.closed=!0),l&&(l.closed=!0),typeof t=="function"&&t(o),o?qu.nextTick(Kie,n,o):qu.nextTick(uB,n)}try{n._destroy(e||null,i)}catch(o){i(o)}}function Kie(n,e){L4(n,e),uB(n)}function uB(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 L4(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 Yie(){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 N4(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?qu.nextTick(L4,n,e):L4(n,e))}function Jie(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(O4,e),!(n.listenerCount(O4)>1)&&qu.nextTick(Qie,n)}function Qie(n){let e=!1;function t(r){if(e){N4(n,r??new jie);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(oB,r):r?N4(n,r,!0):qu.nextTick(Zie,n)}try{n._construct(r=>{qu.nextTick(t,r)})}catch(r){qu.nextTick(t,r)}}function Zie(n){n.emit(O4)}function PN(n){return(n==null?void 0:n.setHeader)&&typeof n.abort=="function"}function cB(n){n.emit("close")}function Xie(n,e){n.emit("error",e),qu.nextTick(cB,n)}function ese(n,e){!n||$ie(n)||(!e&&!Vie(n)&&(e=new Hie),Gie(n)?(n.socket=null,n.destroy(e)):PN(n)?n.abort():PN(n.req)?n.req.abort():typeof n.destroy=="function"?n.destroy(e):typeof n.close=="function"?n.close():e?qu.nextTick(Xie,n,e):qu.nextTick(cB,n),n.destroyed||(n[qie]=!0))}var xm={construct:Jie,destroyer:ese,destroy:Wie,undestroy:Yie,errorOrDestroy:N4};const{ArrayIsArray:tse,ObjectSetPrototypeOf:fB}=ma,{EventEmitter:G2}=Kb;function W2(n){G2.call(this,n)}fB(W2.prototype,G2.prototype);fB(W2,G2);W2.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(),G2.listenerCount(this,"error")===0&&this.emit("error",m)}P4(t,"error",p),P4(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 P4(n,e,t){if(typeof n.prependListener=="function")return n.prependListener(e,t);!n._events||!n._events[e]?n.on(e,t):tse(n._events[e])?n._events[e].unshift(t):n._events[e]=[t,n._events[e]]}var V5={Stream:W2,prependListener:P4},dB={exports:{}};(function(n){const{SymbolDispose:e}=ma,{AbortError:t,codes:r}=eo,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:l}=ef,c=Gd,{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}})(dB);var K2=dB.exports;const{StringPrototypeSlice:IN,SymbolIterator:nse,TypedArrayPrototypeSet:vx,Uint8Array:rse}=ma,{Buffer:b8}=$d,{inspect:ase}=xs;var ise=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 b8.alloc(0);const t=b8.allocUnsafe(e>>>0);let r=this.head,i=0;for(;r;)vx(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}*[nse](){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+=IN(o,0,e),this.head=r,r.data=IN(o,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){const t=b8.allocUnsafe(e),r=e;let i=this.head,o=0;do{const l=i.data;if(e>l.length)vx(t,l,r-e),e-=l.length;else{e===l.length?(vx(t,l,r-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(vx(t,new rse(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 ase(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:sse,NumberIsInteger:ose}=ma,{validateInteger:lse}=Yb,{ERR_INVALID_ARG_VALUE:use}=eo.codes;let pB=16*1024,hB=16;function cse(n,e,t){return n.highWaterMark!=null?n.highWaterMark:e?n[t]:null}function yB(n){return n?hB:pB}function fse(n,e){lse(e,"value",0),n?hB=e:pB=e}function dse(n,e,t,r){const i=cse(e,r,t);if(i!=null){if(!ose(i)||i<0){const o=r?`options.${t}`:"options.highWaterMark";throw new use(o,i)}return sse(i)}return yB(n.objectMode)}var Y2={getHighWaterMark:dse,getDefaultHighWaterMark:yB,setDefaultHighWaterMark:fse},G5={},W5=fU.Buffer,DN=W5.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 pse(n){if(!n)return"utf8";for(var e;;)switch(n){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return n;default:if(e)return;n=(""+n).toLowerCase(),e=!0}}function hse(n){var e=pse(n);if(typeof e!="string"&&(W5.isEncoding===DN||!DN(n)))throw new Error("Unknown encoding: "+n);return e||n}G5.StringDecoder=Jb;function Jb(n){this.encoding=hse(n);var e;switch(this.encoding){case"utf16le":this.text=wse,this.end=_se,e=4;break;case"utf8":this.fillLast=gse,e=4;break;case"base64":this.text=xse,this.end=Sse,e=3;break;default:this.write=Cse,this.end=Ese;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=W5.allocUnsafe(e)}Jb.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||""};Jb.prototype.end=bse;Jb.prototype.text=vse;Jb.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 w8(n){return n<=127?0:n>>5===6?2:n>>4===14?3:n>>3===30?4:n>>6===2?-1:-2}function yse(n,e,t){var r=e.length-1;if(r<t)return 0;var i=w8(e[r]);return i>=0?(i>0&&(n.lastNeed=i-1),i):--r<t||i===-2?0:(i=w8(e[r]),i>=0?(i>0&&(n.lastNeed=i-2),i):--r<t||i===-2?0:(i=w8(e[r]),i>=0?(i>0&&(i===2?i=0:n.lastNeed=i-3),i):0))}function mse(n,e,t){if((e[0]&192)!==128)return n.lastNeed=0,"�";if(n.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return n.lastNeed=1,"�";if(n.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return n.lastNeed=2,"�"}}function gse(n){var e=this.lastTotal-this.lastNeed,t=mse(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 vse(n,e){var t=yse(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 bse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+"�":e}function wse(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 _se(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 xse(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 Sse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Cse(n){return n.toString(this.encoding)}function Ese(n){return n&&n.length?this.write(n):""}const UN=Vd(),{PromisePrototypeThen:Ase,SymbolAsyncIterator:FN,SymbolIterator:BN}=ma,{Buffer:kse}=$d,{ERR_INVALID_ARG_TYPE:Mse,ERR_STREAM_NULL_VALUES:Tse}=eo.codes;function Rse(n,e,t){let r;if(typeof e=="string"||e instanceof kse)return new n({objectMode:!0,...t,read(){this.push(e),this.push(null)}});let i;if(e&&e[FN])i=!0,r=e[FN]();else if(e&&e[BN])i=!1,r=e[BN]();else throw new Mse("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){Ase(c(h),()=>UN.nextTick(m,h),w=>UN.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 Tse;if(o.push(w))continue;l=!1}}catch(h){o.destroy(h)}break}}return o}var mB=Rse,_8,zN;function J2(){if(zN)return _8;zN=1;const n=Vd(),{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;_8=Ne,Ne.ReadableState=Ee;const{EventEmitter:g}=Kb,{Stream:S,prependListener:A}=V5,{Buffer:k}=$d,{addAbortSignal:R}=K2,N=Gd;let I=xs.debuglog("stream",ve=>{I=ve});const $=ise,V=xm,{getHighWaterMark:de,getDefaultHighWaterMark:oe}=Y2,{aggregateTwoErrors:he,codes:{ERR_INVALID_ARG_TYPE:xe,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}=Yb,j=b("kPaused"),{StringDecoder:F}=G5,H=mB;c(Ne.prototype,S.prototype),c(Ne,S);const Q=()=>{},{errorOrDestroy:ae}=V,L=1,T=2,Y=4,ie=8,B=16,be=32,Ie=64,Me=128,De=256,se=512,ue=1024,pe=2048,ce=4096,te=8192,me=16384,J=32768,P=65536,U=1<<17,ee=1<<18;function le(ve){return{enumerable:!1,get(){return(this.state&ve)!==0},set(Se){Se?this.state|=ve:this.state&=~ve}}}o(Ee.prototype,{objectMode:le(L),ended:le(T),endEmitted:le(Y),reading:le(ie),constructed:le(B),sync:le(be),needReadable:le(Ie),emittedReadable:le(Me),readableListening:le(De),resumeScheduled:le(se),errorEmitted:le(ue),emitClose:le(pe),autoDestroy:le(ce),destroyed:le(te),closed:le(me),closeEmitted:le(J),multiAwaitDrain:le(P),readingMore:le(U),dataEmitted:le(ee)});function Ee(ve,Se,ct){typeof ct!="boolean"&&(ct=Se instanceof Jc()),this.state=pe|ce|B|be,ve&&ve.objectMode&&(this.state|=L),ct&&ve&&ve.readableObjectMode&&(this.state|=L),this.highWaterMark=ve?de(this,ve,"readableHighWaterMark",ct):oe(!1),this.buffer=new $,this.length=0,this.pipes=[],this.flowing=null,this[j]=null,ve&&ve.emitClose===!1&&(this.state&=~pe),ve&&ve.autoDestroy===!1&&(this.state&=~ce),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 Se=this instanceof Jc();this._readableState=new Ee(ve,this,Se),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&&!Se&&R(ve.signal,this)),S.call(this,ve),V.construct(this,()=>{this._readableState.needReadable&&_e(this,this._readableState)})}Ne.prototype.destroy=V.destroy,Ne.prototype._undestroy=V.undestroy,Ne.prototype._destroy=function(ve,Se){Se(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((Se,ct)=>N(this,at=>at&&at!==ve?ct(at):Se(null)))},Ne.prototype.push=function(ve,Se){return Qe(this,ve,Se,!1)},Ne.prototype.unshift=function(ve,Se){return Qe(this,ve,Se,!0)};function Qe(ve,Se,ct,at){I("readableAddChunk",Se);const ft=ve._readableState;let Dn;if(ft.state&L||(typeof Se=="string"?(ct=ct||ft.defaultEncoding,ft.encoding!==ct&&(at&&ft.encoding?Se=k.from(Se,ct).toString(ft.encoding):(Se=k.from(Se,ct),ct=""))):Se instanceof k?ct="":S._isUint8Array(Se)?(Se=S._uint8ArrayToBuffer(Se),ct=""):Se!=null&&(Dn=new xe("chunk",["string","Buffer","Uint8Array"],Se))),Dn)ae(ve,Dn);else if(Se===null)ft.state&=~ie,q(ve,ft);else if(ft.state&L||Se&&Se.length>0)if(at)if(ft.state&Y)ae(ve,new C);else{if(ft.destroyed||ft.errored)return!1;st(ve,ft,Se,!0)}else if(ft.ended)ae(ve,new Le);else{if(ft.destroyed||ft.errored)return!1;ft.state&=~ie,ft.decoder&&!ct?(Se=ft.decoder.write(Se),ft.objectMode||Se.length!==0?st(ve,ft,Se,!1):_e(ve,ft)):st(ve,ft,Se,!1)}else at||(ft.state&=~ie,_e(ve,ft));return!ft.ended&&(ft.length<ft.highWaterMark||ft.length===0)}function st(ve,Se,ct,at){Se.flowing&&Se.length===0&&!Se.sync&&ve.listenerCount("data")>0?(Se.state&P?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null,Se.dataEmitted=!0,ve.emit("data",ct)):(Se.length+=Se.objectMode?1:ct.length,at?Se.buffer.unshift(ct):Se.buffer.push(ct),Se.state&Ie&&W(ve)),_e(ve,Se)}Ne.prototype.isPaused=function(){const ve=this._readableState;return ve[j]===!0||ve.flowing===!1},Ne.prototype.setEncoding=function(ve){const Se=new F(ve);this._readableState.decoder=Se,this._readableState.encoding=this._readableState.decoder.encoding;const ct=this._readableState.buffer;let at="";for(const ft of ct)at+=Se.write(ft);return ct.clear(),at!==""&&ct.push(at),this._readableState.length=at.length,this};const xt=1073741824;function Et(ve){if(ve>xt)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,Se){return ve<=0||Se.length===0&&Se.ended?0:Se.state&L?1:r(ve)?Se.flowing&&Se.length?Se.buffer.first().length:Se.length:ve<=Se.length?ve:Se.ended?Se.length:0}Ne.prototype.read=function(ve){I("read",ve),ve===void 0?ve=NaN:t(ve)||(ve=i(ve,10));const Se=this._readableState,ct=ve;if(ve>Se.highWaterMark&&(Se.highWaterMark=Et(ve)),ve!==0&&(Se.state&=~Me),ve===0&&Se.needReadable&&((Se.highWaterMark!==0?Se.length>=Se.highWaterMark:Se.length>0)||Se.ended))return I("read: emitReadable",Se.length,Se.ended),Se.length===0&&Se.ended?Wt(this):W(this),null;if(ve=Z(ve,Se),ve===0&&Se.ended)return Se.length===0&&Wt(this),null;let at=(Se.state&Ie)!==0;if(I("need readable",at),(Se.length===0||Se.length-ve<Se.highWaterMark)&&(at=!0,I("length less than watermark",at)),Se.ended||Se.reading||Se.destroyed||Se.errored||!Se.constructed)at=!1,I("reading, ended or constructing",at);else if(at){I("do read"),Se.state|=ie|be,Se.length===0&&(Se.state|=Ie);try{this._read(Se.highWaterMark)}catch(Dn){ae(this,Dn)}Se.state&=~be,Se.reading||(ve=Z(ct,Se))}let ft;return ve>0?ft=Zt(ve,Se):ft=null,ft===null?(Se.needReadable=Se.length<=Se.highWaterMark,ve=0):(Se.length-=ve,Se.multiAwaitDrain?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null),Se.length===0&&(Se.ended||(Se.needReadable=!0),ct!==ve&&Se.ended&&Wt(this)),ft!==null&&!Se.errorEmitted&&!Se.closeEmitted&&(Se.dataEmitted=!0,this.emit("data",ft)),ft};function q(ve,Se){if(I("onEofChunk"),!Se.ended){if(Se.decoder){const ct=Se.decoder.end();ct&&ct.length&&(Se.buffer.push(ct),Se.length+=Se.objectMode?1:ct.length)}Se.ended=!0,Se.sync?W(ve):(Se.needReadable=!1,Se.emittedReadable=!0,ge(ve))}}function W(ve){const Se=ve._readableState;I("emitReadable",Se.needReadable,Se.emittedReadable),Se.needReadable=!1,Se.emittedReadable||(I("emitReadable",Se.flowing),Se.emittedReadable=!0,n.nextTick(ge,ve))}function ge(ve){const Se=ve._readableState;I("emitReadable_",Se.destroyed,Se.length,Se.ended),!Se.destroyed&&!Se.errored&&(Se.length||Se.ended)&&(ve.emit("readable"),Se.emittedReadable=!1),Se.needReadable=!Se.flowing&&!Se.ended&&Se.length<=Se.highWaterMark,Ot(ve)}function _e(ve,Se){!Se.readingMore&&Se.constructed&&(Se.readingMore=!0,n.nextTick(Re,ve,Se))}function Re(ve,Se){for(;!Se.reading&&!Se.ended&&(Se.length<Se.highWaterMark||Se.flowing&&Se.length===0);){const ct=Se.length;if(I("maybeReadMore read 0"),ve.read(0),ct===Se.length)break}Se.readingMore=!1}Ne.prototype._read=function(ve){throw new Ce("_read()")},Ne.prototype.pipe=function(ve,Se){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,Se);const Dn=(!Se||Se.end!==!1)&&ve!==n.stdout&&ve!==n.stderr?Cn:zt;at.endEmitted?n.nextTick(Dn):ct.once("end",Dn),ve.on("unpipe",hn);function hn(Ut,Kt){I("onunpipe"),Ut===ct&&Kt&&Kt.hasUnpiped===!1&&(Kt.hasUnpiped=!0,Un())}function Cn(){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",Cn),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(Ut){I("ondata");const Kt=ve.write(Ut);I("dest.write",Kt),Kt===!1&&Te()}function rt(Ut){if(I("onerror",Ut),zt(),ve.removeListener("error",rt),ve.listenerCount("error")===0){const Kt=ve._writableState||ve._readableState;Kt&&!Kt.errorEmitted?ae(ve,Ut):ve.emit("error",Ut)}}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,Se){return function(){const at=ve._readableState;at.awaitDrainWriters===Se?(I("pipeOnDrain",1),at.awaitDrainWriters=null):at.multiAwaitDrain&&(I("pipeOnDrain",at.awaitDrainWriters.size),at.awaitDrainWriters.delete(Se)),(!at.awaitDrainWriters||at.awaitDrainWriters.size===0)&&ve.listenerCount("data")&&ve.resume()}}Ne.prototype.unpipe=function(ve){const Se=this._readableState,ct={hasUnpiped:!1};if(Se.pipes.length===0)return this;if(!ve){const ft=Se.pipes;Se.pipes=[],this.pause();for(let Dn=0;Dn<ft.length;Dn++)ft[Dn].emit("unpipe",this,{hasUnpiped:!1});return this}const at=e(Se.pipes,ve);return at===-1?this:(Se.pipes.splice(at,1),Se.pipes.length===0&&this.pause(),ve.emit("unpipe",this,ct),this)},Ne.prototype.on=function(ve,Se){const ct=S.prototype.on.call(this,ve,Se),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,Se){const ct=S.prototype.removeListener.call(this,ve,Se);return ve==="readable"&&n.nextTick(wt,this),ct},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(ve){const Se=S.prototype.removeAllListeners.apply(this,arguments);return(ve==="readable"||ve===void 0)&&n.nextTick(wt,this),Se};function wt(ve){const Se=ve._readableState;Se.readableListening=ve.listenerCount("readable")>0,Se.resumeScheduled&&Se[j]===!1?Se.flowing=!0:ve.listenerCount("data")>0?ve.resume():Se.readableListening||(Se.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[j]=!1,this};function gt(ve,Se){Se.resumeScheduled||(Se.resumeScheduled=!0,n.nextTick(At,ve,Se))}function At(ve,Se){I("resume",Se.reading),Se.reading||ve.read(0),Se.resumeScheduled=!1,ve.emit("resume"),Ot(ve),Se.flowing&&!Se.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[j]=!0,this};function Ot(ve){const Se=ve._readableState;for(I("flow",Se.flowing);Se.flowing&&ve.read()!==null;);}Ne.prototype.wrap=function(ve){let Se=!1;ve.on("data",at=>{!this.push(at)&&ve.pause&&(Se=!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=()=>{Se&&ve.resume&&(Se=!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,Se){typeof ve.read!="function"&&(ve=Ne.wrap(ve,{objectMode:!0}));const ct=Mr(ve,Se);return ct.stream=ve,ct}async function*Mr(ve,Se){let ct=Q;function at(hn){this===ve?(ct(),ct=Q):ct=hn}ve.on("readable",at);let ft;const Dn=N(ve,{writable:!1},hn=>{ft=hn?he(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=he(ft,hn),ft}finally{(ft||(Se==null?void 0:Se.destroyOnReturn)!==!1)&&(ft===void 0||ve._readableState.autoDestroy)?V.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[j]!==!1},set(ve){this[j]=!!ve}}}),Ne._fromList=Zt;function Zt(ve,Se){if(Se.length===0)return null;let ct;return Se.objectMode?ct=Se.buffer.shift():!ve||ve>=Se.length?(Se.decoder?ct=Se.buffer.join(""):Se.buffer.length===1?ct=Se.buffer.first():ct=Se.buffer.concat(Se.length),Se.buffer.clear()):ct=Se.buffer.consume(ve,Se.decoder),ct}function Wt(ve){const Se=ve._readableState;I("endReadable",Se.endEmitted),Se.endEmitted||(Se.ended=!0,n.nextTick(Xr,Se,ve))}function Xr(ve,Se){if(I("endReadableNT",ve.endEmitted,ve.length),!ve.errored&&!ve.closeEmitted&&!ve.endEmitted&&ve.length===0){if(ve.endEmitted=!0,Se.emit("end"),Se.writable&&Se.allowHalfOpen===!1)n.nextTick(Mn,Se);else if(ve.autoDestroy){const ct=Se._writableState;(!ct||ct.autoDestroy&&(ct.finished||ct.writable===!1))&&Se.destroy()}}}function Mn(ve){ve.writable&&!ve.writableEnded&&!ve.destroyed&&ve.end()}Ne.from=function(ve,Se){return H(Ne,ve,Se)};let In;function Ma(){return In===void 0&&(In={}),In}return Ne.fromWeb=function(ve,Se){return Ma().newStreamReadableFromReadableStream(ve,Se)},Ne.toWeb=function(ve,Se){return Ma().newReadableStreamFromStreamReadable(ve,Se)},Ne.wrap=function(ve,Se){var ct,at;return new Ne({objectMode:(ct=(at=ve.readableObjectMode)!==null&&at!==void 0?at:ve.objectMode)!==null&&ct!==void 0?ct:!0,...Se,destroy(ft,Dn){V.destroyer(ve,ft),Dn(ft)}}).wrap(ve)},_8}var x8,jN;function K5(){if(jN)return x8;jN=1;const n=Vd(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:o,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:c,Symbol:p,SymbolHasInstance:h}=ma;x8=O,O.WritableState=C;const{EventEmitter:m}=Kb,w=V5.Stream,{Buffer:b}=$d,g=xm,{addAbortSignal:S}=K2,{getHighWaterMark:A,getDefaultHighWaterMark:k}=Y2,{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:N,ERR_MULTIPLE_CALLBACK:I,ERR_STREAM_CANNOT_PIPE:$,ERR_STREAM_DESTROYED:V,ERR_STREAM_ALREADY_FINISHED:de,ERR_STREAM_NULL_VALUES:oe,ERR_STREAM_WRITE_AFTER_END:he,ERR_UNKNOWN_ENCODING:xe}=eo.codes,{errorOrDestroy:Ce}=g;l(O.prototype,w.prototype),l(O,w);function ne(){}const Le=p("kOnFinished");function C(ce,te,me){typeof me!="boolean"&&(me=te instanceof Jc()),this.objectMode=!!(ce&&ce.objectMode),me&&(this.objectMode=this.objectMode||!!(ce&&ce.writableObjectMode)),this.highWaterMark=ce?A(this,ce,"writableHighWaterMark",me):k(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const J=!!(ce&&ce.decodeStrings===!1);this.decodeStrings=!J,this.defaultEncoding=ce&&ce.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ae.bind(void 0,te),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=!ce||ce.emitClose!==!1,this.autoDestroy=!ce||ce.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Le]=[]}function x(ce){ce.buffered=[],ce.bufferedIndex=0,ce.allBuffers=!0,ce.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(ce){const te=this instanceof Jc();if(!te&&!r(O,this))return new O(ce);this._writableState=new C(ce,this,te),ce&&(typeof ce.write=="function"&&(this._write=ce.write),typeof ce.writev=="function"&&(this._writev=ce.writev),typeof ce.destroy=="function"&&(this._destroy=ce.destroy),typeof ce.final=="function"&&(this._final=ce.final),typeof ce.construct=="function"&&(this._construct=ce.construct),ce.signal&&S(ce.signal,this)),w.call(this,ce),g.construct(this,()=>{const me=this._writableState;me.writing||ie(this,me),Me(this,me)})}i(O,h,{__proto__:null,value:function(ce){return r(this,ce)?!0:this!==O?!1:ce&&ce._writableState instanceof C}}),O.prototype.pipe=function(){Ce(this,new $)};function j(ce,te,me,J){const P=ce._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 xe(me);typeof J!="function"&&(J=ne)}if(te===null)throw new oe;if(!P.objectMode)if(typeof te=="string")P.decodeStrings!==!1&&(te=b.from(te,me),me="buffer");else if(te instanceof b)me="buffer";else if(w._isUint8Array(te))te=w._uint8ArrayToBuffer(te),me="buffer";else throw new R("chunk",["string","Buffer","Uint8Array"],te);let U;return P.ending?U=new he:P.destroyed&&(U=new V("write")),U?(n.nextTick(J,U),Ce(ce,U,!0),U):(P.pendingcb++,F(ce,P,te,me,J))}O.prototype.write=function(ce,te,me){return j(this,ce,te,me)===!0},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){const ce=this._writableState;ce.corked&&(ce.corked--,ce.writing||ie(this,ce))},O.prototype.setDefaultEncoding=function(te){if(typeof te=="string"&&(te=c(te)),!b.isEncoding(te))throw new xe(te);return this._writableState.defaultEncoding=te,this};function F(ce,te,me,J,P){const U=te.objectMode?1:me.length;te.length+=U;const ee=te.length<te.highWaterMark;return ee||(te.needDrain=!0),te.writing||te.corked||te.errored||!te.constructed?(te.buffered.push({chunk:me,encoding:J,callback:P}),te.allBuffers&&J!=="buffer"&&(te.allBuffers=!1),te.allNoop&&P!==ne&&(te.allNoop=!1)):(te.writelen=U,te.writecb=P,te.writing=!0,te.sync=!0,ce._write(me,J,te.onwrite),te.sync=!1),ee&&!te.errored&&!te.destroyed}function H(ce,te,me,J,P,U,ee){te.writelen=J,te.writecb=ee,te.writing=!0,te.sync=!0,te.destroyed?te.onwrite(new V("write")):me?ce._writev(P,te.onwrite):ce._write(P,U,te.onwrite),te.sync=!1}function Q(ce,te,me,J){--te.pendingcb,J(me),Y(te),Ce(ce,me)}function ae(ce,te){const me=ce._writableState,J=me.sync,P=me.writecb;if(typeof P!="function"){Ce(ce,new I);return}me.writing=!1,me.writecb=null,me.length-=me.writelen,me.writelen=0,te?(te.stack,me.errored||(me.errored=te),ce._readableState&&!ce._readableState.errored&&(ce._readableState.errored=te),J?n.nextTick(Q,ce,me,te,P):Q(ce,me,te,P)):(me.buffered.length>me.bufferedIndex&&ie(ce,me),J?me.afterWriteTickInfo!==null&&me.afterWriteTickInfo.cb===P?me.afterWriteTickInfo.count++:(me.afterWriteTickInfo={count:1,cb:P,stream:ce,state:me},n.nextTick(L,me.afterWriteTickInfo)):T(ce,me,1,P))}function L({stream:ce,state:te,count:me,cb:J}){return te.afterWriteTickInfo=null,T(ce,te,me,J)}function T(ce,te,me,J){for(!te.ending&&!ce.destroyed&&te.length===0&&te.needDrain&&(te.needDrain=!1,ce.emit("drain"));me-- >0;)te.pendingcb--,J();te.destroyed&&Y(te),Me(ce,te)}function Y(ce){if(ce.writing)return;for(let P=ce.bufferedIndex;P<ce.buffered.length;++P){var te;const{chunk:U,callback:ee}=ce.buffered[P],le=ce.objectMode?1:U.length;ce.length-=le,ee((te=ce.errored)!==null&&te!==void 0?te:new V("write"))}const me=ce[Le].splice(0);for(let P=0;P<me.length;P++){var J;me[P]((J=ce.errored)!==null&&J!==void 0?J:new V("end"))}x(ce)}function ie(ce,te){if(te.corked||te.bufferProcessing||te.destroyed||!te.constructed)return;const{buffered:me,bufferedIndex:J,objectMode:P}=te,U=me.length-J;if(!U)return;let ee=J;if(te.bufferProcessing=!0,U>1&&ce._writev){te.pendingcb-=U-1;const le=te.allNoop?ne:Ne=>{for(let Qe=ee;Qe<me.length;++Qe)me[Qe].callback(Ne)},Ee=te.allNoop&&ee===0?me:e(me,ee);Ee.allBuffers=te.allBuffers,H(ce,te,!0,te.length,Ee,"",le),x(te)}else{do{const{chunk:le,encoding:Ee,callback:Ne}=me[ee];me[ee++]=null;const Qe=P?1:le.length;H(ce,te,!1,Qe,le,Ee,Ne)}while(ee<me.length&&!te.writing);ee===me.length?x(te):ee>256?(me.splice(0,ee),te.bufferedIndex=0):te.bufferedIndex=ee}te.bufferProcessing=!1}O.prototype._write=function(ce,te,me){if(this._writev)this._writev([{chunk:ce,encoding:te}],me);else throw new N("_write()")},O.prototype._writev=null,O.prototype.end=function(ce,te,me){const J=this._writableState;typeof ce=="function"?(me=ce,ce=null,te=null):typeof te=="function"&&(me=te,te=null);let P;if(ce!=null){const U=j(this,ce,te);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 V("end"))),typeof me=="function"&&(P||J.finished?n.nextTick(me,P):J[Le].push(me)),this};function B(ce){return ce.ending&&!ce.destroyed&&ce.constructed&&ce.length===0&&!ce.errored&&ce.buffered.length===0&&!ce.finished&&!ce.writing&&!ce.errorEmitted&&!ce.closeEmitted}function be(ce,te){let me=!1;function J(P){if(me){Ce(ce,P??I());return}if(me=!0,te.pendingcb--,P){const U=te[Le].splice(0);for(let ee=0;ee<U.length;ee++)U[ee](P);Ce(ce,P,te.sync)}else B(te)&&(te.prefinished=!0,ce.emit("prefinish"),te.pendingcb++,n.nextTick(De,ce,te))}te.sync=!0,te.pendingcb++;try{ce._final(J)}catch(P){J(P)}te.sync=!1}function Ie(ce,te){!te.prefinished&&!te.finalCalled&&(typeof ce._final=="function"&&!te.destroyed?(te.finalCalled=!0,be(ce,te)):(te.prefinished=!0,ce.emit("prefinish")))}function Me(ce,te,me){B(te)&&(Ie(ce,te),te.pendingcb===0&&(me?(te.pendingcb++,n.nextTick((J,P)=>{B(P)?De(J,P):P.pendingcb--},ce,te)):B(te)&&(te.pendingcb++,De(ce,te))))}function De(ce,te){te.pendingcb--,te.finished=!0;const me=te[Le].splice(0);for(let J=0;J<me.length;J++)me[J]();if(ce.emit("finish"),te.autoDestroy){const J=ce._readableState;(!J||J.autoDestroy&&(J.endEmitted||J.readable===!1))&&ce.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(ce){this._writableState&&(this._writableState.destroyed=ce)}},writable:{__proto__:null,get(){const ce=this._writableState;return!!ce&&ce.writable!==!1&&!ce.destroyed&&!ce.errored&&!ce.ending&&!ce.ended},set(ce){this._writableState&&(this._writableState.writable=!!ce)}},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 ce=this._writableState;return ce?!ce.destroyed&&!ce.ending&&ce.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(ce,te){const me=this._writableState;return!me.destroyed&&(me.bufferedIndex<me.buffered.length||me[Le].length)&&n.nextTick(Y,me),se.call(this,ce,te),this},O.prototype._undestroy=g.undestroy,O.prototype._destroy=function(ce,te){te(ce)},O.prototype[m.captureRejectionSymbol]=function(ce){this.destroy(ce)};let ue;function pe(){return ue===void 0&&(ue={}),ue}return O.fromWeb=function(ce,te){return pe().newStreamWritableFromWritableStream(ce,te)},O.toWeb=function(ce){return pe().newWritableStreamFromStreamWritable(ce)},x8}var S8,HN;function Ose(){if(HN)return S8;HN=1;const n=Vd(),e=$d,{isReadable:t,isWritable:r,isIterable:i,isNodeStream:o,isReadableNodeStream:l,isWritableNodeStream:c,isDuplexNodeStream:p,isReadableStream:h,isWritableStream:m}=ef,w=Gd,{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:S}}=eo,{destroyer:A}=xm,k=Jc(),R=J2(),N=K5(),{createDeferredPromise:I}=xs,$=mB,V=globalThis.Blob||e.Blob,de=typeof V<"u"?function(C){return C instanceof V}:function(C){return!1},oe=globalThis.AbortController||Ob().AbortController,{FunctionPrototypeCall:he}=ma;class xe 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)}}S8=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:N.fromWeb(C)});if(typeof C=="function"){const{value:j,write:F,final:H,destroy:Q}=Ce(C);if(i(j))return $(xe,j,{objectMode:!0,write:F,final:H,destroy:Q});const ae=j==null?void 0:j.then;if(typeof ae=="function"){let L;const T=he(ae,j,Y=>{if(Y!=null)throw new S("nully","body",Y)},Y=>{A(L,Y)});return L=new xe({objectMode:!0,readable:!1,write:F,final(Y){H(async()=>{try{await T,n.nextTick(Y,null)}catch(ie){n.nextTick(Y,ie)}})},destroy:Q})}throw new S("Iterable, AsyncIterable or AsyncFunction",x,j)}if(de(C))return Le(C.arrayBuffer());if(i(C))return $(xe,C,{objectMode:!0,writable:!1});if(h(C==null?void 0:C.readable)&&m(C==null?void 0:C.writable))return xe.fromWeb(C);if(typeof(C==null?void 0:C.writable)=="object"||typeof(C==null?void 0:C.readable)=="object"){const j=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:j,writable:F})}const O=C==null?void 0:C.then;if(typeof O=="function"){let j;return he(O,C,F=>{F!=null&&j.push(F),j.push(null)},F=>{A(j,F)}),j=new xe({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,j=O.signal;return{value:Le(async function*(){for(;;){const H=C;C=null;const{chunk:Q,done:ae,cb:L}=await H;if(n.nextTick(L),ae)return;if(j.aborted)throw new b(void 0,{cause:j.reason});({promise:C,resolve:x}=I()),yield Q}}(),{signal:j}),write(H,Q,ae){const L=x;x=null,L({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),j=!!r(x),F,H,Q,ae,L;function T(Y){const ie=ae;ae=null,ie?ie(Y):Y&&L.destroy(Y)}return L=new xe({readableObjectMode:!!(C!=null&&C.readableObjectMode),writableObjectMode:!!(x!=null&&x.writableObjectMode),readable:O,writable:j}),j&&(w(x,Y=>{j=!1,Y&&A(C,Y),T(Y)}),L._write=function(Y,ie,B){x.write(Y,ie)?B():F=B},L._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(){L.push(null)}),L._read=function(){for(;;){const Y=C.read();if(Y===null){Q=L._read;return}if(!L.push(Y))return}}),L._destroy=function(Y,ie){!Y&&ae!==null&&(Y=new b),Q=null,F=null,H=null,ae===null?ie(Y):(ae=ie,A(x,Y),A(C,Y))},L}return S8}var C8,qN;function Jc(){if(qN)return C8;qN=1;const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=ma;C8=l;const i=J2(),o=K5();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=Ose()),h(m,"body")},C8}const{ObjectSetPrototypeOf:gB,Symbol:Lse}=ma;var vB=Qc;const{ERR_METHOD_NOT_IMPLEMENTED:Nse}=eo.codes,Y5=Jc(),{getHighWaterMark:Pse}=Y2;gB(Qc.prototype,Y5.prototype);gB(Qc,Y5);const yb=Lse("kCallback");function Qc(n){if(!(this instanceof Qc))return new Qc(n);const e=n?Pse(this,n,"readableHighWaterMark",!0):null;e===0&&(n={...n,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:n.writableHighWaterMark||0}),Y5.call(this,n),this._readableState.sync=!1,this[yb]=null,n&&(typeof n.transform=="function"&&(this._transform=n.transform),typeof n.flush=="function"&&(this._flush=n.flush)),this.on("prefinish",Ise)}function I4(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 Ise(){this._final!==I4&&I4.call(this)}Qc.prototype._final=I4;Qc.prototype._transform=function(n,e,t){throw new Nse("_transform()")};Qc.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[yb]=t})};Qc.prototype._read=function(){if(this[yb]){const n=this[yb];this[yb]=null,n()}};const{ObjectSetPrototypeOf:bB}=ma;var wB=rm;const J5=vB;bB(rm.prototype,J5.prototype);bB(rm,J5);function rm(n){if(!(this instanceof rm))return new rm(n);J5.call(this,n)}rm.prototype._transform=function(n,e,t){t(null,n)};const nb=Vd(),{ArrayIsArray:Dse,Promise:Use,SymbolAsyncIterator:Fse,SymbolDispose:Bse}=ma,n2=Gd,{once:zse}=xs,jse=xm,$N=Jc(),{aggregateTwoErrors:Hse,codes:{ERR_INVALID_ARG_TYPE:D4,ERR_INVALID_RETURN_VALUE:E8,ERR_MISSING_ARGS:qse,ERR_STREAM_DESTROYED:$se,ERR_STREAM_PREMATURE_CLOSE:Vse},AbortError:Gse}=eo,{validateFunction:Wse,validateAbortSignal:Kse}=Yb,{isIterable:th,isReadable:A8,isReadableNodeStream:Dx,isNodeStream:VN,isTransformStream:Uy,isWebStream:Yse,isReadableStream:k8,isReadableFinished:Jse}=ef,Qse=globalThis.AbortController||Ob().AbortController;let M8,T8,R8;function GN(n,e,t){let r=!1;n.on("close",()=>{r=!0});const i=n2(n,{readable:e,writable:t},o=>{r=!o});return{destroy:o=>{r||(r=!0,jse.destroyer(n,o||new $se("pipe")))},cleanup:i}}function Zse(n){return Wse(n[n.length-1],"streams[stream.length - 1]"),n.pop()}function O8(n){if(th(n))return n;if(Dx(n))return Xse(n);throw new D4("val",["Readable","Iterable","AsyncIterable"],n)}async function*Xse(n){T8||(T8=J2()),yield*T8.prototype[Fse].call(n)}async function bx(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 Use((h,m)=>{i?m(i):o=()=>{i?m(i):h()}});e.on("drain",l);const p=n2(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?Hse(i,h):h)}finally{p(),e.off("drain",l)}}async function L8(n,e,t,{end:r}){Uy(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 eoe(...n){return _B(n,zse(Zse(n)))}function _B(n,e,t){if(n.length===1&&Dse(n[0])&&(n=n[0]),n.length<2)throw new qse("streams");const r=new Qse,i=r.signal,o=t==null?void 0:t.signal,l=[];Kse(o,"options.signal");function c(){S(new Gse)}R8=R8||xs.addAbortListener;let p;o&&(p=R8(o,c));let h,m;const w=[];let b=0;function g(N){S(N,--b===0)}function S(N,I){var $;if(N&&(!h||h.code==="ERR_STREAM_PREMATURE_CLOSE")&&(h=N),!(!h&&!I)){for(;w.length;)w.shift()(h);($=p)===null||$===void 0||$[Bse](),r.abort(),I&&(h||l.forEach(V=>V()),nb.nextTick(e,h,m))}}let A;for(let N=0;N<n.length;N++){const I=n[N],$=N<n.length-1,V=N>0,de=$||(t==null?void 0:t.end)!==!1,oe=N===n.length-1;if(VN(I)){let he=function(xe){xe&&xe.name!=="AbortError"&&xe.code!=="ERR_STREAM_PREMATURE_CLOSE"&&g(xe)};if(de){const{destroy:xe,cleanup:Ce}=GN(I,$,V);w.push(xe),A8(I)&&oe&&l.push(Ce)}I.on("error",he),A8(I)&&oe&&l.push(()=>{I.removeListener("error",he)})}if(N===0)if(typeof I=="function"){if(A=I({signal:i}),!th(A))throw new E8("Iterable, AsyncIterable or Stream","source",A)}else th(I)||Dx(I)||Uy(I)?A=I:A=$N.from(I);else if(typeof I=="function"){if(Uy(A)){var k;A=O8((k=A)===null||k===void 0?void 0:k.readable)}else A=O8(A);if(A=I(A,{signal:i}),$){if(!th(A,!0))throw new E8("AsyncIterable",`transform[${N-1}]`,A)}else{var R;M8||(M8=wB);const he=new M8({objectMode:!0}),xe=(R=A)===null||R===void 0?void 0:R.then;if(typeof xe=="function")b++,xe.call(A,Le=>{m=Le,Le!=null&&he.write(Le),de&&he.end(),nb.nextTick(g)},Le=>{he.destroy(Le),nb.nextTick(g,Le)});else if(th(A,!0))b++,bx(A,he,g,{end:de});else if(k8(A)||Uy(A)){const Le=A.readable||A;b++,bx(Le,he,g,{end:de})}else throw new E8("AsyncIterable or Promise","destination",A);A=he;const{destroy:Ce,cleanup:ne}=GN(A,!1,!0);w.push(Ce),oe&&l.push(ne)}}else if(VN(I)){if(Dx(A)){b+=2;const he=toe(A,I,g,{end:de});A8(I)&&oe&&l.push(he)}else if(Uy(A)||k8(A)){const he=A.readable||A;b++,bx(he,I,g,{end:de})}else if(th(A))b++,bx(A,I,g,{end:de});else throw new D4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else if(Yse(I)){if(Dx(A))b++,L8(O8(A),I,g,{end:de});else if(k8(A)||th(A))b++,L8(A,I,g,{end:de});else if(Uy(A))b++,L8(A.readable,I,g,{end:de});else throw new D4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else A=$N.from(I)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&nb.nextTick(c),A}function toe(n,e,t,{end:r}){let i=!1;if(e.on("close",()=>{i||t(new Vse)}),n.pipe(e,{end:!1}),r){let o=function(){i=!0,e.end()};Jse(n)?nb.nextTick(o):n.once("end",o)}else t();return n2(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)}),n2(e,{readable:!1,writable:!0},t)}var Q5={pipelineImpl:_B,pipeline:eoe};const{pipeline:noe}=Q5,wx=Jc(),{destroyer:roe}=xm,{isNodeStream:_x,isReadable:WN,isWritable:KN,isWebStream:N8,isTransformStream:Zp,isWritableStream:YN,isReadableStream:JN}=ef,{AbortError:aoe,codes:{ERR_INVALID_ARG_VALUE:QN,ERR_MISSING_ARGS:ioe}}=eo,soe=Gd;var xB=function(...e){if(e.length===0)throw new ioe("streams");if(e.length===1)return wx.from(e[0]);const t=[...e];if(typeof e[0]=="function"&&(e[0]=wx.from(e[0])),typeof e[e.length-1]=="function"){const g=e.length-1;e[g]=wx.from(e[g])}for(let g=0;g<e.length;++g)if(!(!_x(e[g])&&!N8(e[g]))){if(g<e.length-1&&!(WN(e[g])||JN(e[g])||Zp(e[g])))throw new QN(`streams[${g}]`,t[g],"must be readable");if(g>0&&!(KN(e[g])||YN(e[g])||Zp(e[g])))throw new QN(`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=noe(e,p),w=!!(KN(h)||YN(h)||Zp(h)),b=!!(WN(m)||JN(m)||Zp(m));if(c=new wx({writableObjectMode:!!(h!=null&&h.writableObjectMode),readableObjectMode:!!(m!=null&&m.readableObjectMode),writable:w,readable:b}),w){if(_x(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(N8(h)){const A=(Zp(h)?h.writable:h).getWriter();c._write=async function(k,R,N){try{await A.ready,A.write(k).catch(()=>{}),N()}catch(I){N(I)}},c._final=async function(k){try{await A.ready,A.close().catch(()=>{}),i=k}catch(R){k(R)}}}const g=Zp(m)?m.readable:m;soe(g,()=>{if(i){const S=i;i=null,S()}})}if(b){if(_x(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(N8(m)){const S=(Zp(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 aoe),o=null,r=null,i=null,l===null?S(g):(l=S,_x(m)&&roe(m,g))},c};const ooe=globalThis.AbortController||Ob().AbortController,{codes:{ERR_INVALID_ARG_VALUE:loe,ERR_INVALID_ARG_TYPE:Qb,ERR_MISSING_ARGS:uoe,ERR_OUT_OF_RANGE:coe},AbortError:Yu}=eo,{validateAbortSignal:Lh,validateInteger:ZN,validateObject:Nh}=Yb,foe=ma.Symbol("kWeak"),doe=ma.Symbol("kResistStopPropagation"),{finished:poe}=Gd,hoe=xB,{addAbortSignalNoValidate:yoe}=K2,{isWritable:moe,isNodeStream:goe}=ef,{deprecate:voe}=xs,{ArrayPrototypePush:boe,Boolean:woe,MathFloor:XN,Number:_oe,NumberIsNaN:xoe,Promise:eP,PromiseReject:tP,PromiseResolve:Soe,PromisePrototypeThen:nP,Symbol:SB}=ma,r2=SB("kEmpty"),rP=SB("kEof");function Coe(n,e){if(e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal"),goe(n)&&!moe(n))throw new loe("stream",n,"must be writable");const t=hoe(this,n);return e!=null&&e.signal&&yoe(e.signal,t),t}function Q2(n,e){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal");let t=1;(e==null?void 0:e.concurrency)!=null&&(t=XN(e.concurrency));let r=t-1;return(e==null?void 0:e.highWaterMark)!=null&&(r=XN(e.highWaterMark)),ZN(t,"options.concurrency",1),ZN(r,"options.highWaterMark",0),r+=t,(async function*(){const o=xs.AbortSignalAny([e==null?void 0:e.signal].filter(woe)),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 Yu;try{if(R=n(R,p),R===r2)continue;R=Soe(R)}catch(N){R=tP(N)}b+=1,nP(R,S,g),c.push(R),h&&(h(),h=null),!w&&(c.length>=r||b>=t)&&await new eP(N=>{m=N})}c.push(rP)}catch(R){const N=tP(R);nP(N,S,g),c.push(N)}finally{w=!0,h&&(h(),h=null)}}k();try{for(;;){for(;c.length>0;){const R=await c[0];if(R===rP)return;if(o.aborted)throw new Yu;R!==r2&&(yield R),c.shift(),A()}await new eP(R=>{h=R})}}finally{w=!0,m&&(m(),m=null)}}).call(this)}function Eoe(n=void 0){return n!=null&&Nh(n,"options"),(n==null?void 0:n.signal)!=null&&Lh(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 Yu({cause:n.signal.reason});yield[t++,i]}}).call(this)}async function CB(n,e=void 0){for await(const t of Z5.call(this,n,e))return!0;return!1}async function Aoe(n,e=void 0){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);return!await CB.call(this,async(...t)=>!await n(...t),e)}async function koe(n,e){for await(const t of Z5.call(this,n,e))return t}async function Moe(n,e){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i),r2}for await(const r of Q2.call(this,t,e));}function Z5(n,e){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i)?r:r2}return Q2.call(this,t,e)}class Toe extends uoe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Roe(n,e,t){var r;if(typeof n!="function")throw new Qb("reducer",["Function","AsyncFunction"],n);t!=null&&Nh(t,"options"),(t==null?void 0:t.signal)!=null&&Lh(t.signal,"options.signal");let i=arguments.length>1;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted){const h=new Yu(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await poe(this.destroy(h)),h}const o=new ooe,l=o.signal;if(t!=null&&t.signal){const h={once:!0,[foe]:this,[doe]:!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 Yu;i?e=await n(e,h,{signal:l}):(e=h,i=!0)}if(!c&&!i)throw new Toe}finally{o.abort()}return e}async function Ooe(n){n!=null&&Nh(n,"options"),(n==null?void 0:n.signal)!=null&&Lh(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 Yu(void 0,{cause:n.signal.reason});boe(e,r)}return e}function Loe(n,e){const t=Q2.call(this,n,e);return(async function*(){for await(const i of t)yield*i}).call(this)}function EB(n){if(n=_oe(n),xoe(n))return 0;if(n<0)throw new coe("number",">= 0",n);return n}function Noe(n,e=void 0){return e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal"),n=EB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Yu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Yu;n--<=0&&(yield o)}}).call(this)}function Poe(n,e=void 0){return e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal"),n=EB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Yu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Yu;if(n-- >0&&(yield o),n<=0)return}}).call(this)}z5.streamReturningOperators={asIndexedPairs:voe(Eoe,"readable.asIndexedPairs will be removed in a future version."),drop:Noe,filter:Z5,flatMap:Loe,map:Q2,take:Poe,compose:Coe};z5.promiseReturningOperators={every:Aoe,forEach:Moe,reduce:Roe,toArray:Ooe,some:CB,find:koe};var P8,aP;function AB(){if(aP)return P8;aP=1;const{ArrayPrototypePop:n,Promise:e}=ma,{isIterable:t,isNodeStream:r,isWebStream:i}=ef,{pipelineImpl:o}=Q5,{finished:l}=Gd;kB();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 P8={finished:l,pipeline:c},P8}var iP;function kB(){if(iP)return y8.exports;iP=1;const{Buffer:n}=$d,{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=ma,{promisify:{custom:i}}=xs,{streamReturningOperators:o,promiseReturningOperators:l}=z5,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=eo,p=xB,{setDefaultHighWaterMark:h,getDefaultHighWaterMark:m}=Y2,{pipeline:w}=Q5,{destroyer:b}=xm,g=Gd,S=AB(),A=ef,k=y8.exports=V5.Stream;k.isDestroyed=A.isDestroyed,k.isDisturbed=A.isDisturbed,k.isErrored=A.isErrored,k.isReadable=A.isReadable,k.isWritable=A.isWritable,k.Readable=J2();for(const N of t(o)){let $=function(...V){if(new.target)throw c();return k.Readable.from(r(I,this,V))};const I=o[N];e($,"name",{__proto__:null,value:I.name}),e($,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,N,{__proto__:null,value:$,enumerable:!1,configurable:!0,writable:!0})}for(const N of t(l)){let $=function(...V){if(new.target)throw c();return r(I,this,V)};const I=l[N];e($,"name",{__proto__:null,value:I.name}),e($,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,N,{__proto__:null,value:$,enumerable:!1,configurable:!0,writable:!0})}k.Writable=K5(),k.Duplex=Jc(),k.Transform=vB,k.PassThrough=wB,k.pipeline=w;const{addAbortSignal:R}=K2;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)},y8.exports}(function(n){const e=kB(),t=AB(),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})(TF);var Ioe=TF.exports;typeof globalThis.Buffer>"u"&&(globalThis.Buffer=Pb().Buffer);const Oy=dU,sP=Ioe,Doe=Mi;globalThis.process||(globalThis.process=Vd());if(typeof crypto>"u"){const n=y2;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-DwLyci4f.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 Doe.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${Oy.encode(Buffer.from(o))}`,secret_key:`kpsk${Oy.encode(Buffer.from(r))}`,public_key:`kppk${Oy.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${Oy.encode(Buffer.from(e))}`,public_key:`ktpk${Oy.encode(Buffer.from(t))}`}},CapToConk(n){const e=t=>new Uint8Array(Oy.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 sP.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 sP.PassThrough,o=e.createDecipher(r,t);return i.pipe(o).on("finish",()=>{t.free()}).on("error",l=>{throw Error(l)})}};var MB=ii,Zr={},oP;function TB(){if(oP)return Zr;oP=1;const n=Mi;let e;n.Platform()===n.PLATFORM_NODE&&(globalThis.Response=E5().Response,e=y2);const t=rs,{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:N}){l({libraryId:c,objectId:p}),i(h);const I=/^s3:\/\/([^/]+)\//i;for(let xe=0;xe<b.length;xe++){const Ce=b[xe].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[xe].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 $;if(k==="cgck"){let xe=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});xe={...xe,secret_key:""},$=`kp__${this.utils.B58(Buffer.from(JSON.stringify(xe)))}`}let V={access_key_id:g,secret_access_key:S};A&&(V={signed_url:A});const de={encryption_key:$,access:{protocol:"s3",platform:"aws",path:w,storage_endpoint:{region:m},cloud_credentials:V}},oe=b.map(xe=>R?{op:"ingest-copy",path:xe.path,encryption:{scheme:k==="cgck"?"cgck":"none"},ingest:{type:"key",path:xe.source}}:{op:"add-reference",path:xe.path,reference:{type:"key",path:xe.source}}),{id:he}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:oe,defaults:de});for(;;){await new Promise(ne=>setTimeout(ne,1e3));const xe=await this.UploadStatus({libraryId:c,objectId:p,writeToken:h,uploadId:he});if(xe.errors&&xe.errors.length>1)throw xe.errors.join(`
|
|
327
|
+
`;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:Kb.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")})(RF);var xs=RF.exports,z5={};const{format:yae,inspect:t2,AggregateError:mae}=xs,gae=globalThis.AggregateError||mae,vae=Symbol("kIsNodeError"),bae=["string","function","number","object","Function","Object","boolean","bigint","symbol"],wae=/^([A-Z][a-z0-9]*)+$/,_ae="__node_internal_",j2={};function dh(n,e){if(!n)throw new j2.ERR_INTERNAL_ASSERTION(e)}function gN(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 xae(n,e,t){if(typeof e=="function")return dh(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 dh(r===t.length,`Code: ${n}; The provided arguments length (${t.length}) does not match the required ones (${r}).`),t.length===0?e:yae(e,...t)}function Ti(n,e,t){t||(t=Error);class r extends t{constructor(...o){super(xae(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[vae]=!0,j2[n]=r}function vN(n){const e=_ae+n.name;return Object.defineProperty(n,"name",{value:e}),n}function Sae(n,e){if(n&&e&&n!==e){if(Array.isArray(e.errors))return e.errors.push(n),e;const t=new gae([e,n],e.message);return t.code=e.code,t}return n||e}let Cae=class extends Error{constructor(e="The operation was aborted",t=void 0){if(t!==void 0&&typeof t!="object")throw new j2.ERR_INVALID_ARG_TYPE("options","Object",t);super(e,t),this.code="ABORT_ERR",this.name="AbortError"}};Ti("ERR_ASSERTION","%s",Error);Ti("ERR_INVALID_ARG_TYPE",(n,e,t)=>{dh(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)dh(typeof p=="string","All expected entries have to be of type string"),bae.includes(p)?i.push(p.toLowerCase()):wae.test(p)?o.push(p):(dh(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=t2(t,{depth:-1});r+=`. Received ${p}`}}else{let p=t2(t,{colors:!1});p.length>25&&(p=`${p.slice(0,25)}...`),r+=`. Received type ${typeof t} (${p})`}return r},TypeError);Ti("ERR_INVALID_ARG_VALUE",(n,e,t="is invalid")=>{let r=t2(e);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${n.includes(".")?"property":"argument"} '${n}' ${t}. Received ${r}`},TypeError);Ti("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);Ti("ERR_MISSING_ARGS",(...n)=>{dh(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);Ti("ERR_OUT_OF_RANGE",(n,e,t)=>{dh(e,'Missing "range" argument');let r;return Number.isInteger(t)&&Math.abs(t)>2**32?r=gN(String(t)):typeof t=="bigint"?(r=String(t),(t>2n**32n||t<-(2n**32n))&&(r=gN(r)),r+="n"):r=t2(t),`The value of "${n}" is out of range. It must be ${e}. Received ${r}`},RangeError);Ti("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Ti("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Ti("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Ti("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Ti("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Ti("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ti("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Ti("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Ti("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Ti("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Ti("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var eo={AbortError:Cae,aggregateTwoErrors:vN(Sae),hideStackFrames:vN,codes:j2};const{ArrayIsArray:j5,ArrayPrototypeIncludes:BF,ArrayPrototypeJoin:zF,ArrayPrototypeMap:Eae,NumberIsInteger:H5,NumberIsNaN:Aae,NumberMAX_SAFE_INTEGER:kae,NumberMIN_SAFE_INTEGER:Mae,NumberParseInt:Tae,ObjectPrototypeHasOwnProperty:Rae,RegExpPrototypeExec:jF,String:Oae,StringPrototypeToUpperCase:Lae,StringPrototypeTrim:Nae}=ma,{hideStackFrames:Yo,codes:{ERR_SOCKET_BAD_PORT:Pae,ERR_INVALID_ARG_TYPE:as,ERR_INVALID_ARG_VALUE:_m,ERR_OUT_OF_RANGE:bh,ERR_UNKNOWN_SIGNAL:bN}}=eo,{normalizeEncoding:Iae}=xs,{isAsyncFunction:Dae,isArrayBufferView:Uae}=xs.types,wN={};function Fae(n){return n===(n|0)}function Bae(n){return n===n>>>0}const zae=/^[0-7]+$/,jae="must be a 32-bit unsigned integer or an octal string";function Hae(n,e,t){if(typeof n>"u"&&(n=t),typeof n=="string"){if(jF(zae,n)===null)throw new _m(e,n,jae);n=Tae(n,8)}return HF(n,e),n}const qae=Yo((n,e,t=Mae,r=kae)=>{if(typeof n!="number")throw new as(e,"number",n);if(!H5(n))throw new bh(e,"an integer",n);if(n<t||n>r)throw new bh(e,`>= ${t} && <= ${r}`,n)}),$ae=Yo((n,e,t=-2147483648,r=2147483647)=>{if(typeof n!="number")throw new as(e,"number",n);if(!H5(n))throw new bh(e,"an integer",n);if(n<t||n>r)throw new bh(e,`>= ${t} && <= ${r}`,n)}),HF=Yo((n,e,t=!1)=>{if(typeof n!="number")throw new as(e,"number",n);if(!H5(n))throw new bh(e,"an integer",n);const r=t?1:0,i=4294967295;if(n<r||n>i)throw new bh(e,`>= ${r} && <= ${i}`,n)});function q5(n,e){if(typeof n!="string")throw new as(e,"string",n)}function Vae(n,e,t=void 0,r){if(typeof n!="number")throw new as(e,"number",n);if(t!=null&&n<t||r!=null&&n>r||(t!=null||r!=null)&&Aae(n))throw new bh(e,`${t!=null?`>= ${t}`:""}${t!=null&&r!=null?" && ":""}${r!=null?`<= ${r}`:""}`,n)}const Gae=Yo((n,e,t)=>{if(!BF(t,n)){const i="must be one of: "+zF(Eae(t,o=>typeof o=="string"?`'${o}'`:Oae(o)),", ");throw new _m(e,n,i)}});function qF(n,e){if(typeof n!="boolean")throw new as(e,"boolean",n)}function m8(n,e,t){return n==null||!Rae(n,e)?t:n[e]}const Wae=Yo((n,e,t=null)=>{const r=m8(t,"allowArray",!1),i=m8(t,"allowFunction",!1);if(!m8(t,"nullable",!1)&&n===null||!r&&j5(n)||typeof n!="object"&&(!i||typeof n!="function"))throw new as(e,"Object",n)}),Kae=Yo((n,e)=>{if(n!=null&&typeof n!="object"&&typeof n!="function")throw new as(e,"a dictionary",n)}),H2=Yo((n,e,t=0)=>{if(!j5(n))throw new as(e,"Array",n);if(n.length<t){const r=`must be longer than ${t}`;throw new _m(e,n,r)}});function Yae(n,e){H2(n,e);for(let t=0;t<n.length;t++)q5(n[t],`${e}[${t}]`)}function Jae(n,e){H2(n,e);for(let t=0;t<n.length;t++)qF(n[t],`${e}[${t}]`)}function Qae(n,e){H2(n,e);for(let t=0;t<n.length;t++){const r=n[t],i=`${e}[${t}]`;if(r==null)throw new as(i,"AbortSignal",r);$F(r,i)}}function Zae(n,e="signal"){if(q5(n,e),wN[n]===void 0)throw wN[Lae(n)]!==void 0?new bN(n+" (signals must use all capital letters)"):new bN(n)}const Xae=Yo((n,e="buffer")=>{if(!Uae(n))throw new as(e,["Buffer","TypedArray","DataView"],n)});function eie(n,e){const t=Iae(e),r=n.length;if(t==="hex"&&r%2!==0)throw new _m("encoding",e,`is invalid for data of length ${r}`)}function tie(n,e="Port",t=!0){if(typeof n!="number"&&typeof n!="string"||typeof n=="string"&&Nae(n).length===0||+n!==+n>>>0||n>65535||n===0&&!t)throw new Pae(e,n,t);return n|0}const $F=Yo((n,e)=>{if(n!==void 0&&(n===null||typeof n!="object"||!("aborted"in n)))throw new as(e,"AbortSignal",n)}),nie=Yo((n,e)=>{if(typeof n!="function")throw new as(e,"Function",n)}),rie=Yo((n,e)=>{if(typeof n!="function"||Dae(n))throw new as(e,"Function",n)}),aie=Yo((n,e)=>{if(n!==void 0)throw new as(e,"undefined",n)});function iie(n,e,t){if(!BF(t,n))throw new as(e,`('${zF(t,"|")}')`,n)}const sie=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function _N(n,e){if(typeof n>"u"||!jF(sie,n))throw new _m(e,n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function oie(n){if(typeof n=="string")return _N(n,"hints"),n;if(j5(n)){const e=n.length;let t="";if(e===0)return t;for(let r=0;r<e;r++){const i=n[r];_N(i,"hints"),t+=i,r!==e-1&&(t+=", ")}return t}throw new _m("hints",n,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}var Yb={isInt32:Fae,isUint32:Bae,parseFileMode:Hae,validateArray:H2,validateStringArray:Yae,validateBooleanArray:Jae,validateAbortSignalArray:Qae,validateBoolean:qF,validateBuffer:Xae,validateDictionary:Kae,validateEncoding:eie,validateFunction:nie,validateInt32:$ae,validateInteger:qae,validateNumber:Vae,validateObject:Wae,validateOneOf:Gae,validatePlainFunction:rie,validatePort:tie,validateSignalName:Zae,validateString:q5,validateUint32:HF,validateUndefined:aie,validateUnion:iie,validateAbortSignal:$F,validateLinkHeaderValue:oie},$5={exports:{}},g8={exports:{}},xN;function Vd(){if(xN)return g8.exports;xN=1;var n=g8.exports={},e,t;function r(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function o(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},g8.exports}const{SymbolAsyncIterator:SN,SymbolIterator:CN,SymbolFor:Oh}=ma,VF=Oh("nodejs.stream.destroyed"),GF=Oh("nodejs.stream.errored"),A4=Oh("nodejs.stream.readable"),k4=Oh("nodejs.stream.writable"),WF=Oh("nodejs.stream.disturbed"),lie=Oh("nodejs.webstream.isClosedPromise"),uie=Oh("nodejs.webstream.controllerErrorFunction");function q2(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 $2(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 cie(n){return!!(n&&typeof n.pipe=="function"&&n._readableState&&typeof n.on=="function"&&typeof n.write=="function")}function ec(n){return n&&(n._readableState||n._writableState||typeof n.write=="function"&&typeof n.on=="function"||typeof n.pipe=="function"&&typeof n.on=="function")}function KF(n){return!!(n&&!ec(n)&&typeof n.pipeThrough=="function"&&typeof n.getReader=="function"&&typeof n.cancel=="function")}function YF(n){return!!(n&&!ec(n)&&typeof n.getWriter=="function"&&typeof n.abort=="function")}function JF(n){return!!(n&&!ec(n)&&typeof n.readable=="object"&&typeof n.writable=="object")}function fie(n){return KF(n)||YF(n)||JF(n)}function die(n,e){return n==null?!1:e===!0?typeof n[SN]=="function":e===!1?typeof n[CN]=="function":typeof n[SN]=="function"||typeof n[CN]=="function"}function V2(n){if(!ec(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!!(n.destroyed||n[VF]||r!=null&&r.destroyed)}function QF(n){if(!$2(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 pie(n,e){if(!$2(n))return null;if(n.writableFinished===!0)return!0;const t=n._writableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.finished)!="boolean"?null:!!(t.finished||e===!1&&t.ended===!0&&t.length===0)}function hie(n){if(!q2(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 ZF(n,e){if(!q2(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 XF(n){return n&&n[A4]!=null?n[A4]:typeof(n==null?void 0:n.readable)!="boolean"?null:V2(n)?!1:q2(n)&&n.readable&&!ZF(n)}function eB(n){return n&&n[k4]!=null?n[k4]:typeof(n==null?void 0:n.writable)!="boolean"?null:V2(n)?!1:$2(n)&&n.writable&&!QF(n)}function yie(n,e){return ec(n)?V2(n)?!0:!((e==null?void 0:e.readable)!==!1&&XF(n)||(e==null?void 0:e.writable)!==!1&&eB(n)):null}function mie(n){var e,t;return ec(n)?n.writableErrored?n.writableErrored:(e=(t=n._writableState)===null||t===void 0?void 0:t.errored)!==null&&e!==void 0?e:null:null}function gie(n){var e,t;return ec(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 vie(n){if(!ec(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"&&tB(n)?n._closed:null}function tB(n){return typeof n._closed=="boolean"&&typeof n._defaultKeepAlive=="boolean"&&typeof n._removedConnection=="boolean"&&typeof n._removedContLen=="boolean"}function nB(n){return typeof n._sent100=="boolean"&&tB(n)}function bie(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 wie(n){if(!ec(n))return null;const e=n._writableState,t=n._readableState,r=e||t;return!r&&nB(n)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function _ie(n){var e;return!!(n&&((e=n[WF])!==null&&e!==void 0?e:n.readableDidRead||n.readableAborted))}function xie(n){var e,t,r,i,o,l,c,p,h,m;return!!(n&&((e=(t=(r=(i=(o=(l=n[GF])!==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:V2,kIsDestroyed:VF,isDisturbed:_ie,kIsDisturbed:WF,isErrored:xie,kIsErrored:GF,isReadable:XF,kIsReadable:A4,kIsClosedPromise:lie,kControllerErrorFunction:uie,kIsWritable:k4,isClosed:vie,isDuplexNodeStream:cie,isFinished:yie,isIterable:die,isReadableNodeStream:q2,isReadableStream:KF,isReadableEnded:hie,isReadableFinished:ZF,isReadableErrored:gie,isNodeStream:ec,isWebStream:fie,isWritable:eB,isWritableNodeStream:$2,isWritableStream:YF,isWritableEnded:QF,isWritableFinished:pie,isWritableErrored:mie,isServerRequest:bie,isServerResponse:nB,willEmitClose:wie,isTransformStream:JF};const _d=Vd(),{AbortError:rB,codes:Sie}=eo,{ERR_INVALID_ARG_TYPE:Cie,ERR_STREAM_PREMATURE_CLOSE:EN}=Sie,{kEmptyObject:M4,once:T4}=xs,{validateAbortSignal:Eie,validateFunction:Aie,validateObject:kie,validateBoolean:Mie}=Yb,{Promise:Tie,PromisePrototypeThen:Rie,SymbolDispose:aB}=ma,{isClosed:Oie,isReadable:AN,isReadableNodeStream:v8,isReadableStream:Lie,isReadableFinished:kN,isReadableErrored:MN,isWritable:TN,isWritableNodeStream:RN,isWritableStream:Nie,isWritableFinished:ON,isWritableErrored:LN,isNodeStream:Pie,willEmitClose:Iie,kIsClosedPromise:Die}=ef;let Gy;function Uie(n){return n.setHeader&&typeof n.abort=="function"}const R4=()=>{};function iB(n,e,t){var r,i;if(arguments.length===2?(t=e,e=M4):e==null?e=M4:kie(e,"options"),Aie(t,"callback"),Eie(e.signal,"options.signal"),t=T4(t),Lie(n)||Nie(n))return Fie(n,e,t);if(!Pie(n))throw new Cie("stream",["ReadableStream","WritableStream","Stream"],n);const o=(r=e.readable)!==null&&r!==void 0?r:v8(n),l=(i=e.writable)!==null&&i!==void 0?i:RN(n),c=n._writableState,p=n._readableState,h=()=>{n.writable||b()};let m=Iie(n)&&v8(n)===o&&RN(n)===l,w=ON(n,!1);const b=()=>{w=!0,n.destroyed&&(m=!1),!(m&&(!n.readable||o))&&(!o||g)&&t.call(n)};let g=kN(n,!1);const S=()=>{g=!0,n.destroyed&&(m=!1),!(m&&(!n.writable||l))&&(!l||w)&&t.call(n)},A=V=>{t.call(n,V)};let k=Oie(n);const R=()=>{k=!0;const V=LN(n)||MN(n);if(V&&typeof V!="boolean")return t.call(n,V);if(o&&!g&&v8(n,!0)&&!kN(n,!1))return t.call(n,new EN);if(l&&!w&&!ON(n,!1))return t.call(n,new EN);t.call(n)},N=()=>{k=!0;const V=LN(n)||MN(n);if(V&&typeof V!="boolean")return t.call(n,V);t.call(n)},I=()=>{n.req.on("finish",b)};Uie(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?_d.nextTick(R):c!=null&&c.errorEmitted||p!=null&&p.errorEmitted?m||_d.nextTick(N):(!o&&(!m||AN(n))&&(w||TN(n)===!1)||!l&&(!m||TN(n))&&(g||AN(n)===!1)||p&&n.req&&n.aborted)&&_d.nextTick(N);const $=()=>{t=R4,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 V=()=>{const de=t;$(),de.call(n,new rB(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)_d.nextTick(V);else{Gy=Gy||xs.addAbortListener;const de=Gy(e.signal,V),oe=t;t=T4((...he)=>{de[aB](),oe.apply(n,he)})}}return $}function Fie(n,e,t){let r=!1,i=R4;if(e.signal)if(i=()=>{r=!0,t.call(n,new rB(void 0,{cause:e.signal.reason}))},e.signal.aborted)_d.nextTick(i);else{Gy=Gy||xs.addAbortListener;const l=Gy(e.signal,i),c=t;t=T4((...p)=>{l[aB](),c.apply(n,p)})}const o=(...l)=>{r||_d.nextTick(()=>t.apply(n,l))};return Rie(n[Die].promise,o,o),R4}function Bie(n,e){var t;let r=!1;return e===null&&(e=M4),(t=e)!==null&&t!==void 0&&t.cleanup&&(Mie(e.cleanup,"cleanup"),r=e.cleanup),new Tie((i,o)=>{const l=iB(n,e,c=>{r&&l(),c?o(c):i()})})}$5.exports=iB;$5.exports.finished=Bie;var Gd=$5.exports;const qu=Vd(),{aggregateTwoErrors:zie,codes:{ERR_MULTIPLE_CALLBACK:jie},AbortError:Hie}=eo,{Symbol:sB}=ma,{kIsDestroyed:qie,isDestroyed:$ie,isFinished:Vie,isServerRequest:Gie}=ef,oB=sB("kDestroy"),O4=sB("kConstruct");function lB(n,e,t){n&&(n.stack,e&&!e.errored&&(e.errored=n),t&&!t.errored&&(t.errored=n))}function Wie(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):(lB(n,r,t),r&&(r.destroyed=!0),t&&(t.destroyed=!0),i.constructed?NN(this,n,e):this.once(oB,function(o){NN(this,zie(o,n),e)}),this)}function NN(n,e,t){let r=!1;function i(o){if(r)return;r=!0;const l=n._readableState,c=n._writableState;lB(o,c,l),c&&(c.closed=!0),l&&(l.closed=!0),typeof t=="function"&&t(o),o?qu.nextTick(Kie,n,o):qu.nextTick(uB,n)}try{n._destroy(e||null,i)}catch(o){i(o)}}function Kie(n,e){L4(n,e),uB(n)}function uB(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 L4(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 Yie(){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 N4(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?qu.nextTick(L4,n,e):L4(n,e))}function Jie(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(O4,e),!(n.listenerCount(O4)>1)&&qu.nextTick(Qie,n)}function Qie(n){let e=!1;function t(r){if(e){N4(n,r??new jie);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(oB,r):r?N4(n,r,!0):qu.nextTick(Zie,n)}try{n._construct(r=>{qu.nextTick(t,r)})}catch(r){qu.nextTick(t,r)}}function Zie(n){n.emit(O4)}function PN(n){return(n==null?void 0:n.setHeader)&&typeof n.abort=="function"}function cB(n){n.emit("close")}function Xie(n,e){n.emit("error",e),qu.nextTick(cB,n)}function ese(n,e){!n||$ie(n)||(!e&&!Vie(n)&&(e=new Hie),Gie(n)?(n.socket=null,n.destroy(e)):PN(n)?n.abort():PN(n.req)?n.req.abort():typeof n.destroy=="function"?n.destroy(e):typeof n.close=="function"?n.close():e?qu.nextTick(Xie,n,e):qu.nextTick(cB,n),n.destroyed||(n[qie]=!0))}var xm={construct:Jie,destroyer:ese,destroy:Wie,undestroy:Yie,errorOrDestroy:N4};const{ArrayIsArray:tse,ObjectSetPrototypeOf:fB}=ma,{EventEmitter:G2}=Kb;function W2(n){G2.call(this,n)}fB(W2.prototype,G2.prototype);fB(W2,G2);W2.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(),G2.listenerCount(this,"error")===0&&this.emit("error",m)}P4(t,"error",p),P4(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 P4(n,e,t){if(typeof n.prependListener=="function")return n.prependListener(e,t);!n._events||!n._events[e]?n.on(e,t):tse(n._events[e])?n._events[e].unshift(t):n._events[e]=[t,n._events[e]]}var V5={Stream:W2,prependListener:P4},dB={exports:{}};(function(n){const{SymbolDispose:e}=ma,{AbortError:t,codes:r}=eo,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:l}=ef,c=Gd,{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}})(dB);var K2=dB.exports;const{StringPrototypeSlice:IN,SymbolIterator:nse,TypedArrayPrototypeSet:vx,Uint8Array:rse}=ma,{Buffer:b8}=$d,{inspect:ase}=xs;var ise=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 b8.alloc(0);const t=b8.allocUnsafe(e>>>0);let r=this.head,i=0;for(;r;)vx(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}*[nse](){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+=IN(o,0,e),this.head=r,r.data=IN(o,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){const t=b8.allocUnsafe(e),r=e;let i=this.head,o=0;do{const l=i.data;if(e>l.length)vx(t,l,r-e),e-=l.length;else{e===l.length?(vx(t,l,r-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(vx(t,new rse(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 ase(this,{...t,depth:0,customInspect:!1})}};const{MathFloor:sse,NumberIsInteger:ose}=ma,{validateInteger:lse}=Yb,{ERR_INVALID_ARG_VALUE:use}=eo.codes;let pB=16*1024,hB=16;function cse(n,e,t){return n.highWaterMark!=null?n.highWaterMark:e?n[t]:null}function yB(n){return n?hB:pB}function fse(n,e){lse(e,"value",0),n?hB=e:pB=e}function dse(n,e,t,r){const i=cse(e,r,t);if(i!=null){if(!ose(i)||i<0){const o=r?`options.${t}`:"options.highWaterMark";throw new use(o,i)}return sse(i)}return yB(n.objectMode)}var Y2={getHighWaterMark:dse,getDefaultHighWaterMark:yB,setDefaultHighWaterMark:fse},G5={},W5=fU.Buffer,DN=W5.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 pse(n){if(!n)return"utf8";for(var e;;)switch(n){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return n;default:if(e)return;n=(""+n).toLowerCase(),e=!0}}function hse(n){var e=pse(n);if(typeof e!="string"&&(W5.isEncoding===DN||!DN(n)))throw new Error("Unknown encoding: "+n);return e||n}G5.StringDecoder=Jb;function Jb(n){this.encoding=hse(n);var e;switch(this.encoding){case"utf16le":this.text=wse,this.end=_se,e=4;break;case"utf8":this.fillLast=gse,e=4;break;case"base64":this.text=xse,this.end=Sse,e=3;break;default:this.write=Cse,this.end=Ese;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=W5.allocUnsafe(e)}Jb.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||""};Jb.prototype.end=bse;Jb.prototype.text=vse;Jb.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 w8(n){return n<=127?0:n>>5===6?2:n>>4===14?3:n>>3===30?4:n>>6===2?-1:-2}function yse(n,e,t){var r=e.length-1;if(r<t)return 0;var i=w8(e[r]);return i>=0?(i>0&&(n.lastNeed=i-1),i):--r<t||i===-2?0:(i=w8(e[r]),i>=0?(i>0&&(n.lastNeed=i-2),i):--r<t||i===-2?0:(i=w8(e[r]),i>=0?(i>0&&(i===2?i=0:n.lastNeed=i-3),i):0))}function mse(n,e,t){if((e[0]&192)!==128)return n.lastNeed=0,"�";if(n.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return n.lastNeed=1,"�";if(n.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return n.lastNeed=2,"�"}}function gse(n){var e=this.lastTotal-this.lastNeed,t=mse(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 vse(n,e){var t=yse(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 bse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+"�":e}function wse(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 _se(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 xse(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 Sse(n){var e=n&&n.length?this.write(n):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Cse(n){return n.toString(this.encoding)}function Ese(n){return n&&n.length?this.write(n):""}const UN=Vd(),{PromisePrototypeThen:Ase,SymbolAsyncIterator:FN,SymbolIterator:BN}=ma,{Buffer:kse}=$d,{ERR_INVALID_ARG_TYPE:Mse,ERR_STREAM_NULL_VALUES:Tse}=eo.codes;function Rse(n,e,t){let r;if(typeof e=="string"||e instanceof kse)return new n({objectMode:!0,...t,read(){this.push(e),this.push(null)}});let i;if(e&&e[FN])i=!0,r=e[FN]();else if(e&&e[BN])i=!1,r=e[BN]();else throw new Mse("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){Ase(c(h),()=>UN.nextTick(m,h),w=>UN.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 Tse;if(o.push(w))continue;l=!1}}catch(h){o.destroy(h)}break}}return o}var mB=Rse,_8,zN;function J2(){if(zN)return _8;zN=1;const n=Vd(),{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;_8=Ne,Ne.ReadableState=Ee;const{EventEmitter:g}=Kb,{Stream:S,prependListener:A}=V5,{Buffer:k}=$d,{addAbortSignal:R}=K2,N=Gd;let I=xs.debuglog("stream",ve=>{I=ve});const $=ise,V=xm,{getHighWaterMark:de,getDefaultHighWaterMark:oe}=Y2,{aggregateTwoErrors:he,codes:{ERR_INVALID_ARG_TYPE:xe,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}=Yb,j=b("kPaused"),{StringDecoder:F}=G5,H=mB;c(Ne.prototype,S.prototype),c(Ne,S);const Q=()=>{},{errorOrDestroy:ae}=V,L=1,T=2,Y=4,ie=8,B=16,be=32,Ie=64,Me=128,De=256,se=512,ue=1024,pe=2048,ce=4096,te=8192,me=16384,J=32768,P=65536,U=1<<17,ee=1<<18;function le(ve){return{enumerable:!1,get(){return(this.state&ve)!==0},set(Se){Se?this.state|=ve:this.state&=~ve}}}o(Ee.prototype,{objectMode:le(L),ended:le(T),endEmitted:le(Y),reading:le(ie),constructed:le(B),sync:le(be),needReadable:le(Ie),emittedReadable:le(Me),readableListening:le(De),resumeScheduled:le(se),errorEmitted:le(ue),emitClose:le(pe),autoDestroy:le(ce),destroyed:le(te),closed:le(me),closeEmitted:le(J),multiAwaitDrain:le(P),readingMore:le(U),dataEmitted:le(ee)});function Ee(ve,Se,ct){typeof ct!="boolean"&&(ct=Se instanceof Jc()),this.state=pe|ce|B|be,ve&&ve.objectMode&&(this.state|=L),ct&&ve&&ve.readableObjectMode&&(this.state|=L),this.highWaterMark=ve?de(this,ve,"readableHighWaterMark",ct):oe(!1),this.buffer=new $,this.length=0,this.pipes=[],this.flowing=null,this[j]=null,ve&&ve.emitClose===!1&&(this.state&=~pe),ve&&ve.autoDestroy===!1&&(this.state&=~ce),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 Se=this instanceof Jc();this._readableState=new Ee(ve,this,Se),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&&!Se&&R(ve.signal,this)),S.call(this,ve),V.construct(this,()=>{this._readableState.needReadable&&_e(this,this._readableState)})}Ne.prototype.destroy=V.destroy,Ne.prototype._undestroy=V.undestroy,Ne.prototype._destroy=function(ve,Se){Se(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((Se,ct)=>N(this,at=>at&&at!==ve?ct(at):Se(null)))},Ne.prototype.push=function(ve,Se){return Qe(this,ve,Se,!1)},Ne.prototype.unshift=function(ve,Se){return Qe(this,ve,Se,!0)};function Qe(ve,Se,ct,at){I("readableAddChunk",Se);const ft=ve._readableState;let Dn;if(ft.state&L||(typeof Se=="string"?(ct=ct||ft.defaultEncoding,ft.encoding!==ct&&(at&&ft.encoding?Se=k.from(Se,ct).toString(ft.encoding):(Se=k.from(Se,ct),ct=""))):Se instanceof k?ct="":S._isUint8Array(Se)?(Se=S._uint8ArrayToBuffer(Se),ct=""):Se!=null&&(Dn=new xe("chunk",["string","Buffer","Uint8Array"],Se))),Dn)ae(ve,Dn);else if(Se===null)ft.state&=~ie,q(ve,ft);else if(ft.state&L||Se&&Se.length>0)if(at)if(ft.state&Y)ae(ve,new C);else{if(ft.destroyed||ft.errored)return!1;st(ve,ft,Se,!0)}else if(ft.ended)ae(ve,new Le);else{if(ft.destroyed||ft.errored)return!1;ft.state&=~ie,ft.decoder&&!ct?(Se=ft.decoder.write(Se),ft.objectMode||Se.length!==0?st(ve,ft,Se,!1):_e(ve,ft)):st(ve,ft,Se,!1)}else at||(ft.state&=~ie,_e(ve,ft));return!ft.ended&&(ft.length<ft.highWaterMark||ft.length===0)}function st(ve,Se,ct,at){Se.flowing&&Se.length===0&&!Se.sync&&ve.listenerCount("data")>0?(Se.state&P?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null,Se.dataEmitted=!0,ve.emit("data",ct)):(Se.length+=Se.objectMode?1:ct.length,at?Se.buffer.unshift(ct):Se.buffer.push(ct),Se.state&Ie&&W(ve)),_e(ve,Se)}Ne.prototype.isPaused=function(){const ve=this._readableState;return ve[j]===!0||ve.flowing===!1},Ne.prototype.setEncoding=function(ve){const Se=new F(ve);this._readableState.decoder=Se,this._readableState.encoding=this._readableState.decoder.encoding;const ct=this._readableState.buffer;let at="";for(const ft of ct)at+=Se.write(ft);return ct.clear(),at!==""&&ct.push(at),this._readableState.length=at.length,this};const xt=1073741824;function Et(ve){if(ve>xt)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,Se){return ve<=0||Se.length===0&&Se.ended?0:Se.state&L?1:r(ve)?Se.flowing&&Se.length?Se.buffer.first().length:Se.length:ve<=Se.length?ve:Se.ended?Se.length:0}Ne.prototype.read=function(ve){I("read",ve),ve===void 0?ve=NaN:t(ve)||(ve=i(ve,10));const Se=this._readableState,ct=ve;if(ve>Se.highWaterMark&&(Se.highWaterMark=Et(ve)),ve!==0&&(Se.state&=~Me),ve===0&&Se.needReadable&&((Se.highWaterMark!==0?Se.length>=Se.highWaterMark:Se.length>0)||Se.ended))return I("read: emitReadable",Se.length,Se.ended),Se.length===0&&Se.ended?Wt(this):W(this),null;if(ve=Z(ve,Se),ve===0&&Se.ended)return Se.length===0&&Wt(this),null;let at=(Se.state&Ie)!==0;if(I("need readable",at),(Se.length===0||Se.length-ve<Se.highWaterMark)&&(at=!0,I("length less than watermark",at)),Se.ended||Se.reading||Se.destroyed||Se.errored||!Se.constructed)at=!1,I("reading, ended or constructing",at);else if(at){I("do read"),Se.state|=ie|be,Se.length===0&&(Se.state|=Ie);try{this._read(Se.highWaterMark)}catch(Dn){ae(this,Dn)}Se.state&=~be,Se.reading||(ve=Z(ct,Se))}let ft;return ve>0?ft=Zt(ve,Se):ft=null,ft===null?(Se.needReadable=Se.length<=Se.highWaterMark,ve=0):(Se.length-=ve,Se.multiAwaitDrain?Se.awaitDrainWriters.clear():Se.awaitDrainWriters=null),Se.length===0&&(Se.ended||(Se.needReadable=!0),ct!==ve&&Se.ended&&Wt(this)),ft!==null&&!Se.errorEmitted&&!Se.closeEmitted&&(Se.dataEmitted=!0,this.emit("data",ft)),ft};function q(ve,Se){if(I("onEofChunk"),!Se.ended){if(Se.decoder){const ct=Se.decoder.end();ct&&ct.length&&(Se.buffer.push(ct),Se.length+=Se.objectMode?1:ct.length)}Se.ended=!0,Se.sync?W(ve):(Se.needReadable=!1,Se.emittedReadable=!0,ge(ve))}}function W(ve){const Se=ve._readableState;I("emitReadable",Se.needReadable,Se.emittedReadable),Se.needReadable=!1,Se.emittedReadable||(I("emitReadable",Se.flowing),Se.emittedReadable=!0,n.nextTick(ge,ve))}function ge(ve){const Se=ve._readableState;I("emitReadable_",Se.destroyed,Se.length,Se.ended),!Se.destroyed&&!Se.errored&&(Se.length||Se.ended)&&(ve.emit("readable"),Se.emittedReadable=!1),Se.needReadable=!Se.flowing&&!Se.ended&&Se.length<=Se.highWaterMark,Ot(ve)}function _e(ve,Se){!Se.readingMore&&Se.constructed&&(Se.readingMore=!0,n.nextTick(Re,ve,Se))}function Re(ve,Se){for(;!Se.reading&&!Se.ended&&(Se.length<Se.highWaterMark||Se.flowing&&Se.length===0);){const ct=Se.length;if(I("maybeReadMore read 0"),ve.read(0),ct===Se.length)break}Se.readingMore=!1}Ne.prototype._read=function(ve){throw new Ce("_read()")},Ne.prototype.pipe=function(ve,Se){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,Se);const Dn=(!Se||Se.end!==!1)&&ve!==n.stdout&&ve!==n.stderr?Cn:zt;at.endEmitted?n.nextTick(Dn):ct.once("end",Dn),ve.on("unpipe",hn);function hn(Ut,Kt){I("onunpipe"),Ut===ct&&Kt&&Kt.hasUnpiped===!1&&(Kt.hasUnpiped=!0,Un())}function Cn(){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",Cn),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(Ut){I("ondata");const Kt=ve.write(Ut);I("dest.write",Kt),Kt===!1&&Te()}function rt(Ut){if(I("onerror",Ut),zt(),ve.removeListener("error",rt),ve.listenerCount("error")===0){const Kt=ve._writableState||ve._readableState;Kt&&!Kt.errorEmitted?ae(ve,Ut):ve.emit("error",Ut)}}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,Se){return function(){const at=ve._readableState;at.awaitDrainWriters===Se?(I("pipeOnDrain",1),at.awaitDrainWriters=null):at.multiAwaitDrain&&(I("pipeOnDrain",at.awaitDrainWriters.size),at.awaitDrainWriters.delete(Se)),(!at.awaitDrainWriters||at.awaitDrainWriters.size===0)&&ve.listenerCount("data")&&ve.resume()}}Ne.prototype.unpipe=function(ve){const Se=this._readableState,ct={hasUnpiped:!1};if(Se.pipes.length===0)return this;if(!ve){const ft=Se.pipes;Se.pipes=[],this.pause();for(let Dn=0;Dn<ft.length;Dn++)ft[Dn].emit("unpipe",this,{hasUnpiped:!1});return this}const at=e(Se.pipes,ve);return at===-1?this:(Se.pipes.splice(at,1),Se.pipes.length===0&&this.pause(),ve.emit("unpipe",this,ct),this)},Ne.prototype.on=function(ve,Se){const ct=S.prototype.on.call(this,ve,Se),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,Se){const ct=S.prototype.removeListener.call(this,ve,Se);return ve==="readable"&&n.nextTick(wt,this),ct},Ne.prototype.off=Ne.prototype.removeListener,Ne.prototype.removeAllListeners=function(ve){const Se=S.prototype.removeAllListeners.apply(this,arguments);return(ve==="readable"||ve===void 0)&&n.nextTick(wt,this),Se};function wt(ve){const Se=ve._readableState;Se.readableListening=ve.listenerCount("readable")>0,Se.resumeScheduled&&Se[j]===!1?Se.flowing=!0:ve.listenerCount("data")>0?ve.resume():Se.readableListening||(Se.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[j]=!1,this};function gt(ve,Se){Se.resumeScheduled||(Se.resumeScheduled=!0,n.nextTick(At,ve,Se))}function At(ve,Se){I("resume",Se.reading),Se.reading||ve.read(0),Se.resumeScheduled=!1,ve.emit("resume"),Ot(ve),Se.flowing&&!Se.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[j]=!0,this};function Ot(ve){const Se=ve._readableState;for(I("flow",Se.flowing);Se.flowing&&ve.read()!==null;);}Ne.prototype.wrap=function(ve){let Se=!1;ve.on("data",at=>{!this.push(at)&&ve.pause&&(Se=!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=()=>{Se&&ve.resume&&(Se=!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,Se){typeof ve.read!="function"&&(ve=Ne.wrap(ve,{objectMode:!0}));const ct=Mr(ve,Se);return ct.stream=ve,ct}async function*Mr(ve,Se){let ct=Q;function at(hn){this===ve?(ct(),ct=Q):ct=hn}ve.on("readable",at);let ft;const Dn=N(ve,{writable:!1},hn=>{ft=hn?he(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=he(ft,hn),ft}finally{(ft||(Se==null?void 0:Se.destroyOnReturn)!==!1)&&(ft===void 0||ve._readableState.autoDestroy)?V.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[j]!==!1},set(ve){this[j]=!!ve}}}),Ne._fromList=Zt;function Zt(ve,Se){if(Se.length===0)return null;let ct;return Se.objectMode?ct=Se.buffer.shift():!ve||ve>=Se.length?(Se.decoder?ct=Se.buffer.join(""):Se.buffer.length===1?ct=Se.buffer.first():ct=Se.buffer.concat(Se.length),Se.buffer.clear()):ct=Se.buffer.consume(ve,Se.decoder),ct}function Wt(ve){const Se=ve._readableState;I("endReadable",Se.endEmitted),Se.endEmitted||(Se.ended=!0,n.nextTick(Xr,Se,ve))}function Xr(ve,Se){if(I("endReadableNT",ve.endEmitted,ve.length),!ve.errored&&!ve.closeEmitted&&!ve.endEmitted&&ve.length===0){if(ve.endEmitted=!0,Se.emit("end"),Se.writable&&Se.allowHalfOpen===!1)n.nextTick(Mn,Se);else if(ve.autoDestroy){const ct=Se._writableState;(!ct||ct.autoDestroy&&(ct.finished||ct.writable===!1))&&Se.destroy()}}}function Mn(ve){ve.writable&&!ve.writableEnded&&!ve.destroyed&&ve.end()}Ne.from=function(ve,Se){return H(Ne,ve,Se)};let In;function Ma(){return In===void 0&&(In={}),In}return Ne.fromWeb=function(ve,Se){return Ma().newStreamReadableFromReadableStream(ve,Se)},Ne.toWeb=function(ve,Se){return Ma().newReadableStreamFromStreamReadable(ve,Se)},Ne.wrap=function(ve,Se){var ct,at;return new Ne({objectMode:(ct=(at=ve.readableObjectMode)!==null&&at!==void 0?at:ve.objectMode)!==null&&ct!==void 0?ct:!0,...Se,destroy(ft,Dn){V.destroyer(ve,ft),Dn(ft)}}).wrap(ve)},_8}var x8,jN;function K5(){if(jN)return x8;jN=1;const n=Vd(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:o,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:c,Symbol:p,SymbolHasInstance:h}=ma;x8=O,O.WritableState=C;const{EventEmitter:m}=Kb,w=V5.Stream,{Buffer:b}=$d,g=xm,{addAbortSignal:S}=K2,{getHighWaterMark:A,getDefaultHighWaterMark:k}=Y2,{ERR_INVALID_ARG_TYPE:R,ERR_METHOD_NOT_IMPLEMENTED:N,ERR_MULTIPLE_CALLBACK:I,ERR_STREAM_CANNOT_PIPE:$,ERR_STREAM_DESTROYED:V,ERR_STREAM_ALREADY_FINISHED:de,ERR_STREAM_NULL_VALUES:oe,ERR_STREAM_WRITE_AFTER_END:he,ERR_UNKNOWN_ENCODING:xe}=eo.codes,{errorOrDestroy:Ce}=g;l(O.prototype,w.prototype),l(O,w);function ne(){}const Le=p("kOnFinished");function C(ce,te,me){typeof me!="boolean"&&(me=te instanceof Jc()),this.objectMode=!!(ce&&ce.objectMode),me&&(this.objectMode=this.objectMode||!!(ce&&ce.writableObjectMode)),this.highWaterMark=ce?A(this,ce,"writableHighWaterMark",me):k(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const J=!!(ce&&ce.decodeStrings===!1);this.decodeStrings=!J,this.defaultEncoding=ce&&ce.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ae.bind(void 0,te),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=!ce||ce.emitClose!==!1,this.autoDestroy=!ce||ce.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Le]=[]}function x(ce){ce.buffered=[],ce.bufferedIndex=0,ce.allBuffers=!0,ce.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(ce){const te=this instanceof Jc();if(!te&&!r(O,this))return new O(ce);this._writableState=new C(ce,this,te),ce&&(typeof ce.write=="function"&&(this._write=ce.write),typeof ce.writev=="function"&&(this._writev=ce.writev),typeof ce.destroy=="function"&&(this._destroy=ce.destroy),typeof ce.final=="function"&&(this._final=ce.final),typeof ce.construct=="function"&&(this._construct=ce.construct),ce.signal&&S(ce.signal,this)),w.call(this,ce),g.construct(this,()=>{const me=this._writableState;me.writing||ie(this,me),Me(this,me)})}i(O,h,{__proto__:null,value:function(ce){return r(this,ce)?!0:this!==O?!1:ce&&ce._writableState instanceof C}}),O.prototype.pipe=function(){Ce(this,new $)};function j(ce,te,me,J){const P=ce._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 xe(me);typeof J!="function"&&(J=ne)}if(te===null)throw new oe;if(!P.objectMode)if(typeof te=="string")P.decodeStrings!==!1&&(te=b.from(te,me),me="buffer");else if(te instanceof b)me="buffer";else if(w._isUint8Array(te))te=w._uint8ArrayToBuffer(te),me="buffer";else throw new R("chunk",["string","Buffer","Uint8Array"],te);let U;return P.ending?U=new he:P.destroyed&&(U=new V("write")),U?(n.nextTick(J,U),Ce(ce,U,!0),U):(P.pendingcb++,F(ce,P,te,me,J))}O.prototype.write=function(ce,te,me){return j(this,ce,te,me)===!0},O.prototype.cork=function(){this._writableState.corked++},O.prototype.uncork=function(){const ce=this._writableState;ce.corked&&(ce.corked--,ce.writing||ie(this,ce))},O.prototype.setDefaultEncoding=function(te){if(typeof te=="string"&&(te=c(te)),!b.isEncoding(te))throw new xe(te);return this._writableState.defaultEncoding=te,this};function F(ce,te,me,J,P){const U=te.objectMode?1:me.length;te.length+=U;const ee=te.length<te.highWaterMark;return ee||(te.needDrain=!0),te.writing||te.corked||te.errored||!te.constructed?(te.buffered.push({chunk:me,encoding:J,callback:P}),te.allBuffers&&J!=="buffer"&&(te.allBuffers=!1),te.allNoop&&P!==ne&&(te.allNoop=!1)):(te.writelen=U,te.writecb=P,te.writing=!0,te.sync=!0,ce._write(me,J,te.onwrite),te.sync=!1),ee&&!te.errored&&!te.destroyed}function H(ce,te,me,J,P,U,ee){te.writelen=J,te.writecb=ee,te.writing=!0,te.sync=!0,te.destroyed?te.onwrite(new V("write")):me?ce._writev(P,te.onwrite):ce._write(P,U,te.onwrite),te.sync=!1}function Q(ce,te,me,J){--te.pendingcb,J(me),Y(te),Ce(ce,me)}function ae(ce,te){const me=ce._writableState,J=me.sync,P=me.writecb;if(typeof P!="function"){Ce(ce,new I);return}me.writing=!1,me.writecb=null,me.length-=me.writelen,me.writelen=0,te?(te.stack,me.errored||(me.errored=te),ce._readableState&&!ce._readableState.errored&&(ce._readableState.errored=te),J?n.nextTick(Q,ce,me,te,P):Q(ce,me,te,P)):(me.buffered.length>me.bufferedIndex&&ie(ce,me),J?me.afterWriteTickInfo!==null&&me.afterWriteTickInfo.cb===P?me.afterWriteTickInfo.count++:(me.afterWriteTickInfo={count:1,cb:P,stream:ce,state:me},n.nextTick(L,me.afterWriteTickInfo)):T(ce,me,1,P))}function L({stream:ce,state:te,count:me,cb:J}){return te.afterWriteTickInfo=null,T(ce,te,me,J)}function T(ce,te,me,J){for(!te.ending&&!ce.destroyed&&te.length===0&&te.needDrain&&(te.needDrain=!1,ce.emit("drain"));me-- >0;)te.pendingcb--,J();te.destroyed&&Y(te),Me(ce,te)}function Y(ce){if(ce.writing)return;for(let P=ce.bufferedIndex;P<ce.buffered.length;++P){var te;const{chunk:U,callback:ee}=ce.buffered[P],le=ce.objectMode?1:U.length;ce.length-=le,ee((te=ce.errored)!==null&&te!==void 0?te:new V("write"))}const me=ce[Le].splice(0);for(let P=0;P<me.length;P++){var J;me[P]((J=ce.errored)!==null&&J!==void 0?J:new V("end"))}x(ce)}function ie(ce,te){if(te.corked||te.bufferProcessing||te.destroyed||!te.constructed)return;const{buffered:me,bufferedIndex:J,objectMode:P}=te,U=me.length-J;if(!U)return;let ee=J;if(te.bufferProcessing=!0,U>1&&ce._writev){te.pendingcb-=U-1;const le=te.allNoop?ne:Ne=>{for(let Qe=ee;Qe<me.length;++Qe)me[Qe].callback(Ne)},Ee=te.allNoop&&ee===0?me:e(me,ee);Ee.allBuffers=te.allBuffers,H(ce,te,!0,te.length,Ee,"",le),x(te)}else{do{const{chunk:le,encoding:Ee,callback:Ne}=me[ee];me[ee++]=null;const Qe=P?1:le.length;H(ce,te,!1,Qe,le,Ee,Ne)}while(ee<me.length&&!te.writing);ee===me.length?x(te):ee>256?(me.splice(0,ee),te.bufferedIndex=0):te.bufferedIndex=ee}te.bufferProcessing=!1}O.prototype._write=function(ce,te,me){if(this._writev)this._writev([{chunk:ce,encoding:te}],me);else throw new N("_write()")},O.prototype._writev=null,O.prototype.end=function(ce,te,me){const J=this._writableState;typeof ce=="function"?(me=ce,ce=null,te=null):typeof te=="function"&&(me=te,te=null);let P;if(ce!=null){const U=j(this,ce,te);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 V("end"))),typeof me=="function"&&(P||J.finished?n.nextTick(me,P):J[Le].push(me)),this};function B(ce){return ce.ending&&!ce.destroyed&&ce.constructed&&ce.length===0&&!ce.errored&&ce.buffered.length===0&&!ce.finished&&!ce.writing&&!ce.errorEmitted&&!ce.closeEmitted}function be(ce,te){let me=!1;function J(P){if(me){Ce(ce,P??I());return}if(me=!0,te.pendingcb--,P){const U=te[Le].splice(0);for(let ee=0;ee<U.length;ee++)U[ee](P);Ce(ce,P,te.sync)}else B(te)&&(te.prefinished=!0,ce.emit("prefinish"),te.pendingcb++,n.nextTick(De,ce,te))}te.sync=!0,te.pendingcb++;try{ce._final(J)}catch(P){J(P)}te.sync=!1}function Ie(ce,te){!te.prefinished&&!te.finalCalled&&(typeof ce._final=="function"&&!te.destroyed?(te.finalCalled=!0,be(ce,te)):(te.prefinished=!0,ce.emit("prefinish")))}function Me(ce,te,me){B(te)&&(Ie(ce,te),te.pendingcb===0&&(me?(te.pendingcb++,n.nextTick((J,P)=>{B(P)?De(J,P):P.pendingcb--},ce,te)):B(te)&&(te.pendingcb++,De(ce,te))))}function De(ce,te){te.pendingcb--,te.finished=!0;const me=te[Le].splice(0);for(let J=0;J<me.length;J++)me[J]();if(ce.emit("finish"),te.autoDestroy){const J=ce._readableState;(!J||J.autoDestroy&&(J.endEmitted||J.readable===!1))&&ce.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(ce){this._writableState&&(this._writableState.destroyed=ce)}},writable:{__proto__:null,get(){const ce=this._writableState;return!!ce&&ce.writable!==!1&&!ce.destroyed&&!ce.errored&&!ce.ending&&!ce.ended},set(ce){this._writableState&&(this._writableState.writable=!!ce)}},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 ce=this._writableState;return ce?!ce.destroyed&&!ce.ending&&ce.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(ce,te){const me=this._writableState;return!me.destroyed&&(me.bufferedIndex<me.buffered.length||me[Le].length)&&n.nextTick(Y,me),se.call(this,ce,te),this},O.prototype._undestroy=g.undestroy,O.prototype._destroy=function(ce,te){te(ce)},O.prototype[m.captureRejectionSymbol]=function(ce){this.destroy(ce)};let ue;function pe(){return ue===void 0&&(ue={}),ue}return O.fromWeb=function(ce,te){return pe().newStreamWritableFromWritableStream(ce,te)},O.toWeb=function(ce){return pe().newWritableStreamFromStreamWritable(ce)},x8}var S8,HN;function Ose(){if(HN)return S8;HN=1;const n=Vd(),e=$d,{isReadable:t,isWritable:r,isIterable:i,isNodeStream:o,isReadableNodeStream:l,isWritableNodeStream:c,isDuplexNodeStream:p,isReadableStream:h,isWritableStream:m}=ef,w=Gd,{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:S}}=eo,{destroyer:A}=xm,k=Jc(),R=J2(),N=K5(),{createDeferredPromise:I}=xs,$=mB,V=globalThis.Blob||e.Blob,de=typeof V<"u"?function(C){return C instanceof V}:function(C){return!1},oe=globalThis.AbortController||Ob().AbortController,{FunctionPrototypeCall:he}=ma;class xe 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)}}S8=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:N.fromWeb(C)});if(typeof C=="function"){const{value:j,write:F,final:H,destroy:Q}=Ce(C);if(i(j))return $(xe,j,{objectMode:!0,write:F,final:H,destroy:Q});const ae=j==null?void 0:j.then;if(typeof ae=="function"){let L;const T=he(ae,j,Y=>{if(Y!=null)throw new S("nully","body",Y)},Y=>{A(L,Y)});return L=new xe({objectMode:!0,readable:!1,write:F,final(Y){H(async()=>{try{await T,n.nextTick(Y,null)}catch(ie){n.nextTick(Y,ie)}})},destroy:Q})}throw new S("Iterable, AsyncIterable or AsyncFunction",x,j)}if(de(C))return Le(C.arrayBuffer());if(i(C))return $(xe,C,{objectMode:!0,writable:!1});if(h(C==null?void 0:C.readable)&&m(C==null?void 0:C.writable))return xe.fromWeb(C);if(typeof(C==null?void 0:C.writable)=="object"||typeof(C==null?void 0:C.readable)=="object"){const j=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:j,writable:F})}const O=C==null?void 0:C.then;if(typeof O=="function"){let j;return he(O,C,F=>{F!=null&&j.push(F),j.push(null)},F=>{A(j,F)}),j=new xe({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,j=O.signal;return{value:Le(async function*(){for(;;){const H=C;C=null;const{chunk:Q,done:ae,cb:L}=await H;if(n.nextTick(L),ae)return;if(j.aborted)throw new b(void 0,{cause:j.reason});({promise:C,resolve:x}=I()),yield Q}}(),{signal:j}),write(H,Q,ae){const L=x;x=null,L({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),j=!!r(x),F,H,Q,ae,L;function T(Y){const ie=ae;ae=null,ie?ie(Y):Y&&L.destroy(Y)}return L=new xe({readableObjectMode:!!(C!=null&&C.readableObjectMode),writableObjectMode:!!(x!=null&&x.writableObjectMode),readable:O,writable:j}),j&&(w(x,Y=>{j=!1,Y&&A(C,Y),T(Y)}),L._write=function(Y,ie,B){x.write(Y,ie)?B():F=B},L._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(){L.push(null)}),L._read=function(){for(;;){const Y=C.read();if(Y===null){Q=L._read;return}if(!L.push(Y))return}}),L._destroy=function(Y,ie){!Y&&ae!==null&&(Y=new b),Q=null,F=null,H=null,ae===null?ie(Y):(ae=ie,A(x,Y),A(C,Y))},L}return S8}var C8,qN;function Jc(){if(qN)return C8;qN=1;const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=ma;C8=l;const i=J2(),o=K5();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=Ose()),h(m,"body")},C8}const{ObjectSetPrototypeOf:gB,Symbol:Lse}=ma;var vB=Qc;const{ERR_METHOD_NOT_IMPLEMENTED:Nse}=eo.codes,Y5=Jc(),{getHighWaterMark:Pse}=Y2;gB(Qc.prototype,Y5.prototype);gB(Qc,Y5);const yb=Lse("kCallback");function Qc(n){if(!(this instanceof Qc))return new Qc(n);const e=n?Pse(this,n,"readableHighWaterMark",!0):null;e===0&&(n={...n,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:n.writableHighWaterMark||0}),Y5.call(this,n),this._readableState.sync=!1,this[yb]=null,n&&(typeof n.transform=="function"&&(this._transform=n.transform),typeof n.flush=="function"&&(this._flush=n.flush)),this.on("prefinish",Ise)}function I4(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 Ise(){this._final!==I4&&I4.call(this)}Qc.prototype._final=I4;Qc.prototype._transform=function(n,e,t){throw new Nse("_transform()")};Qc.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[yb]=t})};Qc.prototype._read=function(){if(this[yb]){const n=this[yb];this[yb]=null,n()}};const{ObjectSetPrototypeOf:bB}=ma;var wB=rm;const J5=vB;bB(rm.prototype,J5.prototype);bB(rm,J5);function rm(n){if(!(this instanceof rm))return new rm(n);J5.call(this,n)}rm.prototype._transform=function(n,e,t){t(null,n)};const nb=Vd(),{ArrayIsArray:Dse,Promise:Use,SymbolAsyncIterator:Fse,SymbolDispose:Bse}=ma,n2=Gd,{once:zse}=xs,jse=xm,$N=Jc(),{aggregateTwoErrors:Hse,codes:{ERR_INVALID_ARG_TYPE:D4,ERR_INVALID_RETURN_VALUE:E8,ERR_MISSING_ARGS:qse,ERR_STREAM_DESTROYED:$se,ERR_STREAM_PREMATURE_CLOSE:Vse},AbortError:Gse}=eo,{validateFunction:Wse,validateAbortSignal:Kse}=Yb,{isIterable:th,isReadable:A8,isReadableNodeStream:Dx,isNodeStream:VN,isTransformStream:Uy,isWebStream:Yse,isReadableStream:k8,isReadableFinished:Jse}=ef,Qse=globalThis.AbortController||Ob().AbortController;let M8,T8,R8;function GN(n,e,t){let r=!1;n.on("close",()=>{r=!0});const i=n2(n,{readable:e,writable:t},o=>{r=!o});return{destroy:o=>{r||(r=!0,jse.destroyer(n,o||new $se("pipe")))},cleanup:i}}function Zse(n){return Wse(n[n.length-1],"streams[stream.length - 1]"),n.pop()}function O8(n){if(th(n))return n;if(Dx(n))return Xse(n);throw new D4("val",["Readable","Iterable","AsyncIterable"],n)}async function*Xse(n){T8||(T8=J2()),yield*T8.prototype[Fse].call(n)}async function bx(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 Use((h,m)=>{i?m(i):o=()=>{i?m(i):h()}});e.on("drain",l);const p=n2(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?Hse(i,h):h)}finally{p(),e.off("drain",l)}}async function L8(n,e,t,{end:r}){Uy(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 eoe(...n){return _B(n,zse(Zse(n)))}function _B(n,e,t){if(n.length===1&&Dse(n[0])&&(n=n[0]),n.length<2)throw new qse("streams");const r=new Qse,i=r.signal,o=t==null?void 0:t.signal,l=[];Kse(o,"options.signal");function c(){S(new Gse)}R8=R8||xs.addAbortListener;let p;o&&(p=R8(o,c));let h,m;const w=[];let b=0;function g(N){S(N,--b===0)}function S(N,I){var $;if(N&&(!h||h.code==="ERR_STREAM_PREMATURE_CLOSE")&&(h=N),!(!h&&!I)){for(;w.length;)w.shift()(h);($=p)===null||$===void 0||$[Bse](),r.abort(),I&&(h||l.forEach(V=>V()),nb.nextTick(e,h,m))}}let A;for(let N=0;N<n.length;N++){const I=n[N],$=N<n.length-1,V=N>0,de=$||(t==null?void 0:t.end)!==!1,oe=N===n.length-1;if(VN(I)){let he=function(xe){xe&&xe.name!=="AbortError"&&xe.code!=="ERR_STREAM_PREMATURE_CLOSE"&&g(xe)};if(de){const{destroy:xe,cleanup:Ce}=GN(I,$,V);w.push(xe),A8(I)&&oe&&l.push(Ce)}I.on("error",he),A8(I)&&oe&&l.push(()=>{I.removeListener("error",he)})}if(N===0)if(typeof I=="function"){if(A=I({signal:i}),!th(A))throw new E8("Iterable, AsyncIterable or Stream","source",A)}else th(I)||Dx(I)||Uy(I)?A=I:A=$N.from(I);else if(typeof I=="function"){if(Uy(A)){var k;A=O8((k=A)===null||k===void 0?void 0:k.readable)}else A=O8(A);if(A=I(A,{signal:i}),$){if(!th(A,!0))throw new E8("AsyncIterable",`transform[${N-1}]`,A)}else{var R;M8||(M8=wB);const he=new M8({objectMode:!0}),xe=(R=A)===null||R===void 0?void 0:R.then;if(typeof xe=="function")b++,xe.call(A,Le=>{m=Le,Le!=null&&he.write(Le),de&&he.end(),nb.nextTick(g)},Le=>{he.destroy(Le),nb.nextTick(g,Le)});else if(th(A,!0))b++,bx(A,he,g,{end:de});else if(k8(A)||Uy(A)){const Le=A.readable||A;b++,bx(Le,he,g,{end:de})}else throw new E8("AsyncIterable or Promise","destination",A);A=he;const{destroy:Ce,cleanup:ne}=GN(A,!1,!0);w.push(Ce),oe&&l.push(ne)}}else if(VN(I)){if(Dx(A)){b+=2;const he=toe(A,I,g,{end:de});A8(I)&&oe&&l.push(he)}else if(Uy(A)||k8(A)){const he=A.readable||A;b++,bx(he,I,g,{end:de})}else if(th(A))b++,bx(A,I,g,{end:de});else throw new D4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else if(Yse(I)){if(Dx(A))b++,L8(O8(A),I,g,{end:de});else if(k8(A)||th(A))b++,L8(A,I,g,{end:de});else if(Uy(A))b++,L8(A.readable,I,g,{end:de});else throw new D4("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],A);A=I}else A=$N.from(I)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&nb.nextTick(c),A}function toe(n,e,t,{end:r}){let i=!1;if(e.on("close",()=>{i||t(new Vse)}),n.pipe(e,{end:!1}),r){let o=function(){i=!0,e.end()};Jse(n)?nb.nextTick(o):n.once("end",o)}else t();return n2(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)}),n2(e,{readable:!1,writable:!0},t)}var Q5={pipelineImpl:_B,pipeline:eoe};const{pipeline:noe}=Q5,wx=Jc(),{destroyer:roe}=xm,{isNodeStream:_x,isReadable:WN,isWritable:KN,isWebStream:N8,isTransformStream:Zp,isWritableStream:YN,isReadableStream:JN}=ef,{AbortError:aoe,codes:{ERR_INVALID_ARG_VALUE:QN,ERR_MISSING_ARGS:ioe}}=eo,soe=Gd;var xB=function(...e){if(e.length===0)throw new ioe("streams");if(e.length===1)return wx.from(e[0]);const t=[...e];if(typeof e[0]=="function"&&(e[0]=wx.from(e[0])),typeof e[e.length-1]=="function"){const g=e.length-1;e[g]=wx.from(e[g])}for(let g=0;g<e.length;++g)if(!(!_x(e[g])&&!N8(e[g]))){if(g<e.length-1&&!(WN(e[g])||JN(e[g])||Zp(e[g])))throw new QN(`streams[${g}]`,t[g],"must be readable");if(g>0&&!(KN(e[g])||YN(e[g])||Zp(e[g])))throw new QN(`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=noe(e,p),w=!!(KN(h)||YN(h)||Zp(h)),b=!!(WN(m)||JN(m)||Zp(m));if(c=new wx({writableObjectMode:!!(h!=null&&h.writableObjectMode),readableObjectMode:!!(m!=null&&m.readableObjectMode),writable:w,readable:b}),w){if(_x(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(N8(h)){const A=(Zp(h)?h.writable:h).getWriter();c._write=async function(k,R,N){try{await A.ready,A.write(k).catch(()=>{}),N()}catch(I){N(I)}},c._final=async function(k){try{await A.ready,A.close().catch(()=>{}),i=k}catch(R){k(R)}}}const g=Zp(m)?m.readable:m;soe(g,()=>{if(i){const S=i;i=null,S()}})}if(b){if(_x(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(N8(m)){const S=(Zp(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 aoe),o=null,r=null,i=null,l===null?S(g):(l=S,_x(m)&&roe(m,g))},c};const ooe=globalThis.AbortController||Ob().AbortController,{codes:{ERR_INVALID_ARG_VALUE:loe,ERR_INVALID_ARG_TYPE:Qb,ERR_MISSING_ARGS:uoe,ERR_OUT_OF_RANGE:coe},AbortError:Yu}=eo,{validateAbortSignal:Lh,validateInteger:ZN,validateObject:Nh}=Yb,foe=ma.Symbol("kWeak"),doe=ma.Symbol("kResistStopPropagation"),{finished:poe}=Gd,hoe=xB,{addAbortSignalNoValidate:yoe}=K2,{isWritable:moe,isNodeStream:goe}=ef,{deprecate:voe}=xs,{ArrayPrototypePush:boe,Boolean:woe,MathFloor:XN,Number:_oe,NumberIsNaN:xoe,Promise:eP,PromiseReject:tP,PromiseResolve:Soe,PromisePrototypeThen:nP,Symbol:SB}=ma,r2=SB("kEmpty"),rP=SB("kEof");function Coe(n,e){if(e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal"),goe(n)&&!moe(n))throw new loe("stream",n,"must be writable");const t=hoe(this,n);return e!=null&&e.signal&&yoe(e.signal,t),t}function Q2(n,e){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal");let t=1;(e==null?void 0:e.concurrency)!=null&&(t=XN(e.concurrency));let r=t-1;return(e==null?void 0:e.highWaterMark)!=null&&(r=XN(e.highWaterMark)),ZN(t,"options.concurrency",1),ZN(r,"options.highWaterMark",0),r+=t,(async function*(){const o=xs.AbortSignalAny([e==null?void 0:e.signal].filter(woe)),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 Yu;try{if(R=n(R,p),R===r2)continue;R=Soe(R)}catch(N){R=tP(N)}b+=1,nP(R,S,g),c.push(R),h&&(h(),h=null),!w&&(c.length>=r||b>=t)&&await new eP(N=>{m=N})}c.push(rP)}catch(R){const N=tP(R);nP(N,S,g),c.push(N)}finally{w=!0,h&&(h(),h=null)}}k();try{for(;;){for(;c.length>0;){const R=await c[0];if(R===rP)return;if(o.aborted)throw new Yu;R!==r2&&(yield R),c.shift(),A()}await new eP(R=>{h=R})}}finally{w=!0,m&&(m(),m=null)}}).call(this)}function Eoe(n=void 0){return n!=null&&Nh(n,"options"),(n==null?void 0:n.signal)!=null&&Lh(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 Yu({cause:n.signal.reason});yield[t++,i]}}).call(this)}async function CB(n,e=void 0){for await(const t of Z5.call(this,n,e))return!0;return!1}async function Aoe(n,e=void 0){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);return!await CB.call(this,async(...t)=>!await n(...t),e)}async function koe(n,e){for await(const t of Z5.call(this,n,e))return t}async function Moe(n,e){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i),r2}for await(const r of Q2.call(this,t,e));}function Z5(n,e){if(typeof n!="function")throw new Qb("fn",["Function","AsyncFunction"],n);async function t(r,i){return await n(r,i)?r:r2}return Q2.call(this,t,e)}class Toe extends uoe{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Roe(n,e,t){var r;if(typeof n!="function")throw new Qb("reducer",["Function","AsyncFunction"],n);t!=null&&Nh(t,"options"),(t==null?void 0:t.signal)!=null&&Lh(t.signal,"options.signal");let i=arguments.length>1;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted){const h=new Yu(void 0,{cause:t.signal.reason});throw this.once("error",()=>{}),await poe(this.destroy(h)),h}const o=new ooe,l=o.signal;if(t!=null&&t.signal){const h={once:!0,[foe]:this,[doe]:!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 Yu;i?e=await n(e,h,{signal:l}):(e=h,i=!0)}if(!c&&!i)throw new Toe}finally{o.abort()}return e}async function Ooe(n){n!=null&&Nh(n,"options"),(n==null?void 0:n.signal)!=null&&Lh(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 Yu(void 0,{cause:n.signal.reason});boe(e,r)}return e}function Loe(n,e){const t=Q2.call(this,n,e);return(async function*(){for await(const i of t)yield*i}).call(this)}function EB(n){if(n=_oe(n),xoe(n))return 0;if(n<0)throw new coe("number",">= 0",n);return n}function Noe(n,e=void 0){return e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal"),n=EB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Yu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Yu;n--<=0&&(yield o)}}).call(this)}function Poe(n,e=void 0){return e!=null&&Nh(e,"options"),(e==null?void 0:e.signal)!=null&&Lh(e.signal,"options.signal"),n=EB(n),(async function*(){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Yu;for await(const o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Yu;if(n-- >0&&(yield o),n<=0)return}}).call(this)}z5.streamReturningOperators={asIndexedPairs:voe(Eoe,"readable.asIndexedPairs will be removed in a future version."),drop:Noe,filter:Z5,flatMap:Loe,map:Q2,take:Poe,compose:Coe};z5.promiseReturningOperators={every:Aoe,forEach:Moe,reduce:Roe,toArray:Ooe,some:CB,find:koe};var P8,aP;function AB(){if(aP)return P8;aP=1;const{ArrayPrototypePop:n,Promise:e}=ma,{isIterable:t,isNodeStream:r,isWebStream:i}=ef,{pipelineImpl:o}=Q5,{finished:l}=Gd;kB();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 P8={finished:l,pipeline:c},P8}var iP;function kB(){if(iP)return y8.exports;iP=1;const{Buffer:n}=$d,{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=ma,{promisify:{custom:i}}=xs,{streamReturningOperators:o,promiseReturningOperators:l}=z5,{codes:{ERR_ILLEGAL_CONSTRUCTOR:c}}=eo,p=xB,{setDefaultHighWaterMark:h,getDefaultHighWaterMark:m}=Y2,{pipeline:w}=Q5,{destroyer:b}=xm,g=Gd,S=AB(),A=ef,k=y8.exports=V5.Stream;k.isDestroyed=A.isDestroyed,k.isDisturbed=A.isDisturbed,k.isErrored=A.isErrored,k.isReadable=A.isReadable,k.isWritable=A.isWritable,k.Readable=J2();for(const N of t(o)){let $=function(...V){if(new.target)throw c();return k.Readable.from(r(I,this,V))};const I=o[N];e($,"name",{__proto__:null,value:I.name}),e($,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,N,{__proto__:null,value:$,enumerable:!1,configurable:!0,writable:!0})}for(const N of t(l)){let $=function(...V){if(new.target)throw c();return r(I,this,V)};const I=l[N];e($,"name",{__proto__:null,value:I.name}),e($,"length",{__proto__:null,value:I.length}),e(k.Readable.prototype,N,{__proto__:null,value:$,enumerable:!1,configurable:!0,writable:!0})}k.Writable=K5(),k.Duplex=Jc(),k.Transform=vB,k.PassThrough=wB,k.pipeline=w;const{addAbortSignal:R}=K2;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)},y8.exports}(function(n){const e=kB(),t=AB(),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})(TF);var Ioe=TF.exports;typeof globalThis.Buffer>"u"&&(globalThis.Buffer=Pb().Buffer);const Oy=dU,sP=Ioe,Doe=Mi;globalThis.process||(globalThis.process=Vd());if(typeof crypto>"u"){const n=y2;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-BzRC8b7B.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 Doe.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${Oy.encode(Buffer.from(o))}`,secret_key:`kpsk${Oy.encode(Buffer.from(r))}`,public_key:`kppk${Oy.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${Oy.encode(Buffer.from(e))}`,public_key:`ktpk${Oy.encode(Buffer.from(t))}`}},CapToConk(n){const e=t=>new Uint8Array(Oy.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 sP.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 sP.PassThrough,o=e.createDecipher(r,t);return i.pipe(o).on("finish",()=>{t.free()}).on("error",l=>{throw Error(l)})}};var MB=ii,Zr={},oP;function TB(){if(oP)return Zr;oP=1;const n=Mi;let e;n.Platform()===n.PLATFORM_NODE&&(globalThis.Response=E5().Response,e=y2);const t=rs,{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:N}){l({libraryId:c,objectId:p}),i(h);const I=/^s3:\/\/([^/]+)\//i;for(let xe=0;xe<b.length;xe++){const Ce=b[xe].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[xe].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 $;if(k==="cgck"){let xe=await this.EncryptionConk({libraryId:c,objectId:p,writeToken:h});xe={...xe,secret_key:""},$=`kp__${this.utils.B58(Buffer.from(JSON.stringify(xe)))}`}let V={access_key_id:g,secret_access_key:S};A&&(V={signed_url:A});const de={encryption_key:$,access:{protocol:"s3",platform:"aws",path:w,storage_endpoint:{region:m},cloud_credentials:V}},oe=b.map(xe=>R?{op:"ingest-copy",path:xe.path,encryption:{scheme:k==="cgck"?"cgck":"none"},ingest:{type:"key",path:xe.source}}:{op:"add-reference",path:xe.path,reference:{type:"key",path:xe.source}}),{id:he}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:oe,defaults:de});for(;;){await new Promise(ne=>setTimeout(ne,1e3));const xe=await this.UploadStatus({libraryId:c,objectId:p,writeToken:h,uploadId:he});if(xe.errors&&xe.errors.length>1)throw xe.errors.join(`
|
|
328
328
|
`);if(xe.error)throw this.Log(`S3 file upload failed:
|
|
329
329
|
${JSON.stringify(xe,null,2)}`),xe.error;if(xe.status.toLowerCase()==="failed")throw"File upload failed";let Ce=!1;if(R){if(Ce=xe.ingest_copy.done,N){const ne=xe.ingest_copy.progress;N({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=xe.add_reference.done,N){const ne=xe.add_reference.progress;N({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:N}=await this.CreateFileUploadJob({libraryId:c,objectId:p,writeToken:h,ops:m,encryption:w});this.Log(`Upload ID: ${R}`),this.Log(N);const I=500*1024*1024;let $=[],V=0,de=0;const oe=async()=>{for(let C=0;C<N.length;C++){for(;V-de>I;)await new Promise(j=>setTimeout(j,500));const x=N[C];let O=await this.UploadJobStatus({libraryId:c,objectId:p,writeToken:h,uploadId:R,jobId:x});for(let j=0;j<O.files.length;j++){const F=O.files[j];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[j].data=H,V+=F.len}$[C]=O,await new Promise(j=>setTimeout(j,50))}},he=async(C,x)=>{for(;!$[x];)await new Promise(F=>setTimeout(F,500));const j=$[x].files;for(let F=0;F<j.length;F++){const H=j[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(L){if(this.Log(L,!0),Q+=1,Q>=10)throw L;await new Promise(T=>setTimeout(T,10*Q*1e3))}while(!ae&&Q<10);delete $[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 xe=Math.min(3,N.length);let Ce=[];for(let C=0;C<xe;C++){const x=new Date().getTime();await he(N[C],C);const O=(new Date().getTime()-x)/1e3,j=$[C].files.map(F=>F.len).reduce((F,H)=>F+H,0);Ce.push(j/O/(1024*1024))}const ne=Ce.reduce((C,x)=>C+x,0)/xe,Le=Math.min(5,Math.ceil(ne/2));await this.utils.LimitedMap(Le,N,async(C,x)=>{x<xe||await he(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(N=>N.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)}),N=R&&R["."].encryption&&R["."].encryption.scheme==="cgck",I=N?"cgck":void 0,$=N&&!A?t("q",m||h||p,"rep","files_download",w):t("q",m||h||p,"files",w),V=await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h,encryption:I,makeAccessRequest:I==="cgck"});V.Accept="*/*";const de=`eluv.caps.iusr${this.utils.AddressToHash(this.signer.address)}`,oe=await this.ContentObjectMetadata({libraryId:c,objectId:p,versionHash:h,metadataSubtree:de});N&&!this.utils.EqualAddress(this.signer.address,await this.ContentObjectOwner({objectId:p}))&&!oe&&(V["X-Content-Fabric-Decryption-Mode"]="reencrypt"),N&&!A&&(V["X-Content-Fabric-Decryption-Mode"]="decrypt",S=Number.MAX_SAFE_INTEGER);const he=R["."].size;if(N&&A)return await this.DownloadEncrypted({conk:await this.EncryptionConk({libraryId:c,objectId:p,versionHash:h,download:!0}),downloadPath:$,bytesTotal:he,headers:V,callback:k,format:b,clientSideDecryption:A,chunked:g});S||(S=1e7);try{return await this.Download({downloadPath:$,bytesTotal:he,headers:V,callback:k,format:b,chunked:g,chunkSize:S})}catch(xe){if(N&&!A)return this.DownloadFile({...arguments[0],clientSideDecryption:!0});throw xe}},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,N=t("q",m||h||p,"data",w);let I=await this.authClient.AuthorizationHeader({libraryId:c,objectId:p,versionHash:h,encryption:R,makeAccessRequest:!0});const $=(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:N,bytesTotal:$,headers:I,callback:A,format:b,chunked:g})):await this.Download({downloadPath:N,bytesTotal:$,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 N=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,N)}):(S.push(Buffer.from(await N.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 N=await this.Crypto.OpenDecryptionStream(c);N.on("data",async $=>{if(g){if(b!=="buffer"){const V=$.buffer.slice($.byteOffset,$.byteOffset+$.byteLength);b==="arraybuffer"?$=V:$=await this.utils.ResponseToFormat(b,new Response(V))}w({bytesFinished:k,bytesTotal:h,chunk:$})}else w&&w({bytesFinished:k,bytesTotal:h}),R.push($)});const I=Math.ceil(h/A);for(let $=0;$<I;$++){m.Range=`bytes=${k}-${k+A-1}`;const V=await this.HttpClient.Request({headers:m,method:"GET",path:p});k=Math.min(k+A,h),N.write(new Uint8Array(await V.arrayBuffer()))}if(N.end(),await new Promise($=>N.on("finish",()=>{$()})),!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 lP=Rne,Uoe=Mi,Foe=MF().permissionLevels,{LogMessage:Boe}=pm,zoe=MB;let RB=class U4{Log(e,t=!1){Boe(this,e,t)}constructor({target:e,timeout:t=30}={}){this.permissionLevels=Foe,!e&&typeof window<"u"&&window.parent&&(e=window.parent),this.target=e,this.timeout=t,this.utils=Uoe,this.Crypto=zoe,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:U4.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=lP.next();let o;if(t&&(o=lP.next()),this.target.postMessage({...e,type:"ElvFrameRequest",requestId:i,callbackId:o},"*"),r)return;const l=e.calledMethod||e.operation,c=U4.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","CreateAuthorizationToken","CreateContentLibrary","CreateContentObject","CreateContentType","CreateEncryptionConk","CreateFabricToken","CreateFileDirectories","CreateFileUploadJob","CreateLinks","CreateNTPInstance","CreateNonOwnerCap","CreatePart","CreateProductionMaster","CreateShare","CreateSignedToken","CreateStaticToken","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","GlobalUrl","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","RedeemShareToken","RemoveAccessGroupManager","RemoveAccessGroupMember","RemoveContentObjectGroupPermission","RemoveContentLibraryGroup","RemoveLibraryContentType","Rep","ReplaceContractMetadata","ReplaceMetadata","Request","ResetRegion","RevokeShare","SendFunds","SetAccessCharge","SetAuth","SetAuthContext","SetAuthPolicy","SetContentLibraryImage","SetContentObjectImage","SetCustomContentContract","SetGroupPermission","SetNodes","SetOauthToken","SetPolicyAuthorization","SetSignerFromOauthToken","SetStaticToken","SetVisibility","SetPermission","Shares","SpaceNodes","StartABRMezzanineJobs","StreamAddWatermark","StreamConfig","StreamCopyToVod","StreamCreate","StreamInitialize","StreamInsertion","StreamListUrls","StreamRemoveWatermark","StreamStatus","StreamStartOrStopOrReset","StreamStopSession","SuspendNTPInstance","UnlinkAccessGroupFromOauth","UpdateContentObjectGraph","UpdateNTPInstance","UpdateShare","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:joe}=TB();RB.prototype.UploadFiles=joe;iF.FrameClient=RB;const Xi=Mi,I8=rs,{FrameClient:uP}=iF,{LogMessage:Hoe}=pm;let qoe=class{Log(e,t=!1){Hoe(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||Xi.EqualAddress(this.walletAddress,Xi.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:Xi.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[Xi.FormatAddress(this.client.signer.address)]=this.walletAddress}const e=this.client.contentSpaceLibraryId,t=Xi.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:Xi.HashToAddress(this.client.contentSpaceId),methodName:"userWallets",methodArgs:[this.client.signer.address]}));const t=await this.walletAddressPromise;return Xi.EqualAddress(t,Xi.nullAddress)||(this.walletAddress=t),!this.walletAddress&&e&&await this.CreateWallet(),this.walletAddressRetrieved=!0,this.walletAddress}async UserWalletAddress({address:e}){if(Xi.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:Xi.HashToAddress(this.client.contentSpaceId),methodName:"userWallets",methodArgs:[e]});Xi.EqualAddress(t,Xi.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?Xi.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=I8("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")||!Xi.ValidHash(e)))throw Error(`Invalid tenant ID: ${e}`);if(t){if(!Xi.ValidAddress(t))throw Error(`Invalid address: ${t}`);e=`iten${Xi.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:I8("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:I8("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 uP.PromptedMethods()}MetadataMethods(){return uP.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 $oe=qoe;const yd=Zu,ku=Mi,Voe=qd,Ly=rs,cP=P5;let Goe=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 Voe({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 ku.ResponseToJson(this.HttpClient.Request({path:Ly("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=ku.FormatAddress(e),this.id=t}if(!this.address){const e=await ku.ResponseToJson(this.HttpClient.Request({method:"GET",path:Ly("as","wlt","keys"),headers:{Authorization:`Bearer ${this.authToken}`}})),t=e.eth[0];t&&t.startsWith("0x")?this.address=t:this.address=ku.HashToAddress(e.eth[0])}this.id=this.address?`ikms${ku.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||ku.B58(cP.parse(cP.v4()));let o=await ku.ResponseToJson(this.HttpClient.Request({method:"POST",body:{email:e,nonce:t,force:i,tid:r},path:Ly("as","wlt","sign","csat"),headers:{Authorization:`Bearer ${this.authToken}`}}));return o.nonce=t,o}async CSATStatus({accessToken:e}){try{const t=await ku.ResponseToJson(this.HttpClient.Request({method:"POST",path:Ly("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 ku.ResponseToJson(this.HttpClient.Request({method:"POST",path:Ly("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 ku.ResponseToJson(this.HttpClient.Request({method:"POST",path:Ly("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 Woe=Goe,da={},fP;function Koe(){if(fP)return da;fP=1;const{ValidatePresence:n,ValidateLibrary:e,ValidateObject:t,ValidateAddress:r,ValidateUserWallet:i}=Ko;return da.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})},da.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"})},da.AccessGroupOwner=async function({contractAddress:o}){return o=r(o),this.Log(`Retrieving owner of access group ${o}`),await this.authClient.Owner({address:o})},da.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):[]}},da.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):[]}},da.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},da.DeleteAccessGroup=async function({contractAddress:o}){throw Error("Not supported")},da.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},da.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},da.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},da.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},da.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"})},da.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},da.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`})},da.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`})},da.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},da.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})},da.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})},da.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]})},da.UnlinkAccessGroupFromOauth=async function({groupAddress:o}){r(o),await this.CallContractMethodAndWait({contractAddress:o,methodName:"setOAuthEnabled",methodArgs:[!1]})},da}var Nr={},dP;function Yoe(){if(dP)return Nr;dP=1;const n=Zu,{ValidateAddress:e,ValidateParameters:t,ValidatePresence:r,ValidateObject:i,ValidateVersion:o}=Ko,l=Mi;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},
|
|
330
330
|
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},
|
|
@@ -376,4 +376,4 @@ ${o.length}${o}`,"utf-8")),p=vd.utils.recoverAddress(c,i);return{type:t,message:
|
|
|
376
376
|
top=${m},
|
|
377
377
|
left=${h}
|
|
378
378
|
`);return w&&window.focus&&w.focus(),w};Ih.ActionPopup=async({mode:n="tab",url:e,onMessage:t,onCancel:r})=>{await new Promise(i=>{const o=n==="popup"?Bde({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={},jP;function zde(){if(jP)return tn;jP=1;const n=Mi,e=rs,{FormatNFTDetails:t,FormatNFTMetadata:r,FormatNFT:i}=Ih,o=kF();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),N=Math.max(0,A-R),I=Math.max(0,A-parseFloat(Math.max(h,k)||0));if(l&&w&&!b){const V=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:V.toString(),return_url:V.toString()},headers:{Authorization:`Bearer ${this.AuthToken()}`}}),await this.UserWalletBalance(!1)}let $={totalWalletBalance:A,availableWalletBalance:R,lockedWalletBalance:k,pendingWalletBalance:N,withdrawableWalletBalance:I};return S&&($.userStripeId=g,$.userStripeEnabled=S),$},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.tenantId})).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 eh={},HP;function jde(){if(HP)return eh;HP=1;const n=Mi,e=rs,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 eh.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}},eh.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()}`}})},eh.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()}`}})},eh.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}},eh.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}},eh}var Vv={},qP;function Hde(){if(qP)return Vv;qP=1;const n=Mi,e=rs,t=({network:r,path:i})=>e("/push",r==="main"?"/main":"/dv3",i);return Vv.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()}`}})},Vv.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},Vv.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})},Vv}const{ElvClient:qde}=$4,bd=Ude,{LinkTargetHash:q8,FormatNFT:$de,ActionPopup:$P}=Ih,Vde=qd,pa=rs,ia=Mi,Gde=Zu,rb=typeof window<"u",Wde=rb&&window.top!==window.self;let Fx=!1;try{typeof localStorage<"u"&&localStorage.getItem("test"),Fx=!0}catch{}class Od{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=bd[r][i].purchaseMode,this.mainSiteLibraryId=bd[r][i].siteLibraryId,this.mainSiteId=bd[r][i].siteId,this.appUrl=bd[r][i].appUrl,this.publicStaticToken=t.staticToken,this.storeAuthToken=p,this.selectedMarketplaceInfo=l,this.previewMarketplaceId=c?ia.DecodeVersionHash(c).objectId:void 0,this.previewMarketplaceHash=c,this.availableMarketplaces={},this.availableMarketplacesById={},this.marketplaceHashes={},this.tenantConfigs={},this.stateStoreUrls=bd[r].stateStoreUrls,this.stateStoreClient=new Vde({uris:this.stateStoreUrls}),this.badgerAddress=bd[r].badgerAddress,this.cachedMarketplaces={},this.cachedCSS={},this.utils=t.utils,this.ForbiddenMethods=Od.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(Od.prototype).filter(e=>!Od.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(bd[r]){if(!bd[r][i])throw Error(`ElvWalletClient: Invalid mode ${i}`)}else throw Error(`ElvWalletClient: Invalid network ${r}`);e||(e=await qde.FromNetworkName({networkName:r,assumeV3:!0}));let S=c;S&&!S.startsWith("hq__")&&(S=await e.LatestVersionHash({objectId:c}));const A=new Od({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(rb&&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&&Fx)try{let R=localStorage.getItem(`__elv-token-${r}`);R&&await A.Authenticate({token:R})}catch{}}try{A.topLevelInfo=await e.utils.ResponseToJson(e.MakeAuthServiceRequest({path:"/as/mw/toplevel",queryParams:{env:i}}))}catch(k){console.error("Unable to load top level info:"),console.error(k)}return h||await A.LoadAvailableMarketplaces(),A}CanSign(){return this.loggedIn?!!this.__authorization.clusterToken||rb&&!!(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=Gde.utils.keccak256(Buffer.from(`Ethereum Signed Message:
|
|
379
|
-
${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(!rb)throw Error("ElvWalletClient: Unable to sign");const t={action:"personal-sign",message:e,logIn:!0};let r=new URL(this.appUrl);if(r.hash=pa("/action","sign",ia.B58(JSON.stringify(t))),r.searchParams.set("origin",window.location.origin),!Wde&&window.location.origin===r.origin)throw Error("ElvWalletClient: Unable to sign");return await new Promise(async(i,o)=>{await $P({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 $P({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={},Fx)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&&Fx)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(!rb||!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&&!ia.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=pa("/",e,t,"marketplace",r,ia.B58(JSON.stringify(i))):o.pathname=pa("/",e,t,ia.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 ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("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 ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("as","wlt","login","session",e),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`},body:{op:"set",id:e,format:"auth_token",payload:JSON.stringify({addr:ia.FormatAddress(t),eth:t?`ikms${ia.AddressToHash(t)}`:"",type:r,token:i,expiresAt:o,...l})}}))}async GetCodeAuth({code:e,passcode:t}){try{return await ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("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;const t=this.topLevelInfo.marketplaces;let r={...this.availableMarketplaces||{}},i={...this.availableMarketplacesById||{}};t.map(o=>{const l=ia.DecodeVersionHash(o.source_hash).objectId,c=o.slug||o.name;r[o.tenant_slug]=r[o.tenant_slug]||{},r[o.tenant_slug][c]={...o,tenantName:o.tenant_slug,tenantSlug:o.tenant_slug,tenantId:o.tenant_id,marketplaceSlug:c,marketplaceId:l,marketplaceHash:o.source_hash},i[l]=r[o.tenant_slug][c],this.marketplaceHashes[l]=o.source_hash}),this.availableMarketplaces=r,this.availableMarketplacesById=i}async LatestMarketplaceHash({marketplaceParams:e}){const t=await this.MarketplaceInfo({marketplaceParams:e});if(this.previewMarketplaceId&&ia.EqualHash(this.previewMarketplaceId,t.marketplaceId))return this.previewMarketplaceHash;const r=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:pa("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug),resolveLinks:!1,noAuth:!0});return q8(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&&ia.EqualHash(r,this.previewMarketplaceId)?o=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"/public/asset_metadata/info",localizationSubtree:this.localization?pa("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:pa("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"info"),localizationSubtree:this.localization?pa("/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:pa("/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:q8(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=q8(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:N=-1,startTime:I,endTime:$,includeCheckoutLocked:V=!1,start:de=0,limit:oe=50}={}){b=(b||[]).map(ne=>parseInt(ne));let he={start:de,limit:oe,sort_descending:r};e==="owned"&&t==="created"&&(t="default"),e!=="leaderboard"&&(he.sort_by=t),e.includes("listings")&&V&&(he.checkout=!0);let xe,Ce;m&&(xe=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 L=ia.SafeTraverse(ae,"nft_template","nft","address");L&&ne.push(`${e==="owned"?"contract_addr":"contract"}:eq:${ia.FormatAddress(L)}`)})}):(xe||w)&&ne.push(`tenant:eq:${xe?xe.tenantId:w}`),c?(e==="owned"?ne.push(`contract_addr:eq:${ia.FormatAddress(c)}`):ne.push(`contract:eq:${ia.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}"}`),he.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||$?(I&&ne.push(`created:gt:${parseInt(I)/1e3}`),$&&ne.push(`created:lt:${parseInt($)/1e3}`)):N&&N>0&&ne.push(`created:gt:${(Date.now()/1e3-N*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=pa("as","wlt",k||this.UserAddress());break;case"owned-full-meta":C=pa("as","apigw","nfts"),Le={Authorization:`Bearer ${this.AuthToken()}`};break;case"listings":C=pa("as","mkt","f");break;case"transfers":C=pa("as","mkt","hst","f"),ne.push("action:eq:TRANSFERRED"),ne.push("action:eq:SOLD");break;case"sales":C=pa("as","mkt","hst","f"),ne.push("action:eq:SOLD"),ne.push("seller:co:0x");break;case"listing-stats":C=pa("as","mkt","stats","listed");break;case"sales-stats":C=pa("as","mkt","stats","sold"),ne.push("seller:co:0x");break;case"leaderboard":C=pa("as","wlt","leaders");break}if(ne.length>0&&(he.filter=ne),e.includes("stats"))return await ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:he,headers:Le}));const{contents:x,paging:O}=await ia.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:he,headers:Le}))||[],j=["owned","listings","owned-full-meta"];return{paging:{start:he.start,limit:he.limit,total:O.total,more:O.total>de+oe},results:(x||[]).map(F=>j.includes(e)?$de(this,F):F)}}catch(ne){if(ne.status&&ne.status.toString()==="404")return{paging:{start:he.start,limit:he.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 ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("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")?ia.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")?ia.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:ia.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:pa("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:pa("as","tnt","config",e,"metadata"),method:"POST",body:o,headers:{Authorization:`Bearer ${l}`}})}}Object.assign(Od.prototype,zde());Object.assign(Od.prototype,jde());Object.assign(Od.prototype,Hde());const{ElvClient:Kde}=$4,Yde=Mi;var Jde=Kde,Dd=Yde;const Iz=Object.freeze(Object.defineProperty({__proto__:null,ElvClient:Jde,Utils:Dd},Symbol.toStringTag,{value:"Module"})),VP={default:{label:"Default",hlsSettings:Dd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class Qde{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(VP).map(t=>({index:t,label:VP[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"},Dz=({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()}},Uz=(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}},Zde=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}},l2=(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},pk=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})):""},hk=(n,e={},t=1)=>{if(t>10)return{};let r={};return Object.keys(n).forEach(i=>{if(i==="client")r.client=e.client;else if(typeof n[i]=="object"&&!Array.isArray(n[i]))r[i]=hk(n[i],(e||{})[i],t+1);else{const o=(e||{})[i];r[i]=typeof o<"u"?o:n[i]}}),r},Fz=n=>hk(VG,n),Xde=/iPhone|iPad|iPod/i.test(navigator.userAgent),GP=window.__chromecastAvailable||!!(window.chrome&&window.chrome.cast),epe={default:{label:"Default",hlsSettings:Dd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class u2{__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,Reload:i,UpdateParameters:o,SetErrorMessage:l}){this.latest=!0,this.loading=!0,this.target=e,this.video=t,this.controls=new Qde({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=GP&&r.playerOptions.allowCasting,this.casting=!1,this.usePlayerControls=[Dt.controls.ON,Dt.controls.AUTO_HIDE].includes(r.playerOptions.controls),this.__error=void 0,this.__ReloadComponent=i,this.__UpdateParameters=o,this.SetErrorMessage=(c,p)=>{l(c),this.__error=p};try{r.playerOptions.hlsjsOptions&&Object.keys(r.playerOptions.hlsjsOptions).length>0&&(this.customHLSOptions=r.playerOptions.hlsjsOptions,r.playerOptions.playerProfile=Dt.playerProfile.CUSTOM)}catch(c){this.Log(c,!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(()=>Iz);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(Dd.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 g=this.collectionInfo.content[this.collectionInfo.mediaIndex];t.objectId=e.utils.DecodeVersionHash(g.mediaHash).objectId,t.versionHash=g.mediaHash,this.sourceOptions.playoutOptions=void 0}let r,i,o={ignore_trimming:t.ignoreTrimming,resolve:t.resolve};if((t.clipStart||t.clipEnd)&&(o.clip_start=parseFloat(t.clipStart||0),t.clipEnd&&(o.clip_end=parseFloat(t.clipEnd))),!t.channel){let g=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=g.default?"default":Object.keys(g)[0],t.offering?r=g[t.offering]?t.offering:void 0:(t.offerings||[]).length>0?r=t.offerings.find(A=>g[A]):t.offerings&&t.offerings.length>0&&(r=t.offerings.find(A=>g[A])),!r)throw new Error(`Unable to find offering from '${t.offering||t.offerings}'`);const S=g[r]&&g[r].properties||{};i=g[r].uri,this.sourceOptions.contentInfo.liveDVR===Dt.liveDVR.ON&&S.dvr_available?(o.dvr=1,this.dvrAvailable=!0):this.dvrAvailable=!1,this.isLive=S.live}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,handler:t.channel?"channel":"playout",offering:t.channel||r,options:o}));let l=(await e.AvailableDRMs()).filter(g=>(this.sourceOptions.drms||[]).includes(g)),c=this.sourceOptions.protocols,p,h;for(;!(p&&h);){p=c.find(S=>this.sourceOptions.playoutOptions[S]);const g=Object.keys(this.sourceOptions.playoutOptions[p].playoutMethods);if(h=(this.sourceOptions.drms||[]).length===0?g.find(S=>S!=="clear")||g[0]:this.sourceOptions.drms.sort().reverse().find(S=>l.includes(S)&&this.sourceOptions.playoutOptions[p].playoutMethods[S]),!h&&(c=c.filter(S=>S!==p),c.length===0))throw Error("No valid protocol / DRM combination available")}const{playoutUrl:m,drms:w}=this.sourceOptions.playoutOptions[p].playoutMethods[h],b=m.split("/").find(g=>g.startsWith("hq__"));return{playoutParameters:{...t,options:o},protocol:p,drm:h,playoutUrl:m,versionHash:b,drms:w,availableDRMs:l,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=Fz(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=Dt.autoplay.ON),t.currentTime&&this.__RegisterVideoEventListener("loadedmetadata",()=>this.video.currentTime=t.currentTime)),this.usePlayerControls&&this.playerOptions.allowCasting&&(this.castHandler=new gW({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===Dt.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-CrJ6Bi-J.js")).then(({InitializeMuxMonitoring:w})=>w({appName:this.playerOptions.appName||"elv-player-js",elvPlayer:this,playoutUrl:i,authorizationToken:m,disableCookies:this.playerOptions.collectVideoAnalytics===Dt.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-BVyq94RY.js"))).default;const l=this.video.canPlayType("application/vnd.apple.mpegURL");if(l&&Xde&&this.playerOptions.preferNativeHLS||[Dt.drms.FAIRPLAY,Dt.drms.SAMPLE_AES].includes(r)||!this.HLS.isSupported()){if(this.nativeHLS=!0,r===Dt.drms.FAIRPLAY?mW({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===Dt.drms.PLAYREADY||r===Dt.drms.WIDEVINE)&&(c={drmSystems:{},emeEnabled:!0,licenseXhrSetup:(w,b)=>{w.open("POST",b,!0),w.setRequestHeader("Authorization",`Bearer ${t}`)}},r===Dt.drms.PLAYREADY?c.drmSystems={"com.microsoft.playready":{licenseUrl:i[r].licenseServers[0]}}:r===Dt.drms.WIDEVINE&&(c.drmSystems={"com.widevine.alpha":{licenseUrl:i[r].licenseServers[0]}}));let p=(epe[this.playerOptions.playerProfile]||{}).hlsSettings||{};const h=this.playerOptions.playerProfile===Dt.playerProfile.CUSTOM?this.customHLSOptions:{};this.sourceOptions.playoutParameters&&this.sourceOptions.playoutParameters.channel&&Object.keys(h).length===0&&(p.maxBufferHole=4.2),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={}})=>{if(this.playoutUrl&&this.playoutUrl.includes("hls-widevine")){this.__UpdateParameters({playerOptions:{playerProfile:w,hlsjsOptions:b}}),this.__ReloadComponent();return}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,drms:i,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,clearTimeout(this.stallTimeout)}),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",!0),m.recoverMediaError()):this.__HardReload(b):b.details==="bufferStalledError"&&(clearTimeout(this.stallTimeout),this.stallTimeout=setTimeout(()=>{this.Log("Buffer Stalled. Attempting to recover using hlsPlayer.recoverMediaError",!0),m.recoverMediaError(),this.stallTimeout=setTimeout(()=>{this.Log("Buffer Stalled. Reloading player...",!0),this.__HardReload(b,0)},5e3)},2e3)):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-C5AV2rW3.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===Dt.drms.WIDEVINE){const c=i.widevine.licenseServers[0];o.setProtectionData({"com.widevine.alpha":{serverURL:c}})}o.initialize(this.video,e.toString(),this.playerOptions.autoplay===Dt.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===Dt.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}),i=await e.ContentSpaceId();let o,l,c;try{l=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"objectTimestamp"}),l&&(l=new Date(parseInt(l._hex,16)*1e3)),c=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"countVersionHashes"}),c&&(c=parseInt(c._hex,16))}catch{}try{o=await e.ContentObjectMetadata({libraryId:i.replace("ispc","ilib"),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:o,ownerAddress:await e.ContentObjectOwner({objectId:t}),lastCommittedAt:l,versionCount:c,latestVersionHash:await e.LatestVersionHash({objectId:t}),signatureMethod:"ECDSA secp256k1"},this.__SettingsUpdate();try{if(e.NetworkInfo().name==="main"){const p=new URL("https://explorer.contentfabric.io/api");p.searchParams.set("module","account"),p.searchParams.set("action","txlist"),p.searchParams.set("offset","1"),p.searchParams.set("address",e.utils.HashToAddress(t)),this.contentAudit.details.latestTransactionHash=(await(await fetch(p)).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=GP&&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}this.playoutUrl&&this.playoutUrl.includes("hls-widevine")&&this.__ReloadComponent();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()}}u2.EluvioPlayerParameters=Dt;u2.EluvioPlayer=u2;var Bz=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}()}(),H4=typeof window<"u"&&typeof document<"u"&&window.document===document,c2=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")()}(),tpe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(c2):function(n){return setTimeout(function(){return n(Date.now())},1e3/60)}}(),npe=2;function rpe(n,e){var t=!1,r=!1,i=0;function o(){t&&(t=!1,n()),r&&c()}function l(){tpe(o)}function c(){var p=Date.now();if(t){if(p-i<npe)return;r=!0}else t=!0,r=!1,setTimeout(l,e);i=p}return c}var ape=20,ipe=["top","right","bottom","left","width","height","size","weight"],spe=typeof MutationObserver<"u",ope=function(){function n(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=rpe(this.refresh.bind(this),ape)}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(){!H4||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),spe?(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(){!H4||!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=ipe.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}(),zz=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},om=function(n){var e=n&&n.ownerDocument&&n.ownerDocument.defaultView;return e||c2},jz=fS(0,0,0,0);function f2(n){return parseFloat(n)||0}function WP(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+f2(o)},0)}function lpe(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]=f2(l)}return t}function upe(n){var e=n.getBBox();return fS(0,0,e.width,e.height)}function cpe(n){var e=n.clientWidth,t=n.clientHeight;if(!e&&!t)return jz;var r=om(n).getComputedStyle(n),i=lpe(r),o=i.left+i.right,l=i.top+i.bottom,c=f2(r.width),p=f2(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==e&&(c-=WP(r,"left","right")+o),Math.round(p+l)!==t&&(p-=WP(r,"top","bottom")+l)),!dpe(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 fS(i.left,i.top,c,p)}var fpe=function(){return typeof SVGGraphicsElement<"u"?function(n){return n instanceof om(n).SVGGraphicsElement}:function(n){return n instanceof om(n).SVGElement&&typeof n.getBBox=="function"}}();function dpe(n){return n===om(n).document.documentElement}function ppe(n){return H4?fpe(n)?upe(n):cpe(n):jz}function hpe(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 zz(l,{x:e,y:t,width:r,height:i,top:t,right:e+r,bottom:i+t,left:e}),l}function fS(n,e,t,r){return{x:n,y:e,width:t,height:r}}var ype=function(){function n(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=fS(0,0,0,0),this.target=e}return n.prototype.isActive=function(){var e=ppe(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}(),mpe=function(){function n(e,t){var r=hpe(t);zz(this,{target:e,contentRect:r})}return n}(),gpe=function(){function n(e,t,r){if(this.activeObservations_=[],this.observations_=new Bz,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 om(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new ype(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 om(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 mpe(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}(),Hz=typeof WeakMap<"u"?new WeakMap:new Bz,qz=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=ope.getInstance(),r=new gpe(e,t,this);Hz.set(this,r)}return n}();["observe","unobserve","disconnect"].forEach(function(n){qz.prototype[n]=function(){var e;return(e=Hz.get(this))[n].apply(e,arguments)}});var vpe=function(){return typeof c2.ResizeObserver<"u"?c2.ResizeObserver:qz}();const dS=({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)}},$z=({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()}},bpe=({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)},yk=({player:n,rate:e=10,setCurrentTime:t})=>{const r=setInterval(()=>{n.controls&&t(n.controls.GetCurrentTime())},1e3/e);return()=>{clearInterval(r)}},wpe=({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 vpe(o);return l.observe(n),()=>l.disconnect()},_pe=({player:n})=>{const e=n.video,t=n.playerOptions.autoplay===Dt.autoplay.WHEN_VISIBLE,r=n.playerOptions.muted===Dt.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()},xpe=({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))}},Spe=({player:n,setRecentUserAction:e})=>{if(n.playerOptions.keyboardControls===Dt.keyboardControls.OFF)return;const t=n.playerOptions.keyboardControls===Dt.keyboardControls.ARROW_KEYS_DISABLED,r=Uz(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)},Cpe=({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)})}}},Epe="_container_fm2ri_1",Ape="_autohide_fm2ri_41",kpe="_fadein_fm2ri_1",Mpe="_seek_fm2ri_174",Tpe="_controls_fm2ri_207",Rpe="_time_fm2ri_221",Ope="_spacer_fm2ri_279",Lpe="_watermark_fm2ri_291",Npe="_menu_fm2ri_37",zn={container:Epe,"container--default-controls":"_container--default-controls_fm2ri_33","bottom-controls-container":"_bottom-controls-container_fm2ri_37",autohide:Ape,"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:kpe,"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:Mpe,"bottom-controls-gradient":"_bottom-controls-gradient_fm2ri_194",controls:Tpe,"play-pause-button":"_play-pause-button_fm2ri_217",time:Rpe,"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:Ope,"floating-volume-toggle":"_floating-volume-toggle_fm2ri_283",watermark:Lpe,"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:Npe},Vz='<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>',Gz='<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>',Wz='<?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>',Ppe='<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>',Kz='<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>',Ipe='<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>',Dpe='<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>',Upe='<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>',mk='<?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>',Yz='<?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>',Fpe='<?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>',d2='<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>',Bpe='<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>',KP='<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>',zpe='<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>',YP='<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>',jpe='<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>',gk='<?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>',vk='<?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>',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-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>',rh='<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>',qpe='<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>',$pe='<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>',Vpe='<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>',Gpe='<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>',p2='<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>',JP='<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>',Wpe='<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>',Jz='<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>',Kpe='<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>',Ype='<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(V){return!!(V&&V!==document&&V.nodeName!=="HTML"&&V.nodeName!=="BODY"&&"classList"in V&&"contains"in V.classList)}function m(V){var de=V.type,oe=V.tagName;return!!(oe==="INPUT"&&p[de]&&!V.readOnly||oe==="TEXTAREA"&&!V.readOnly||V.isContentEditable)}function w(V){V.classList.contains("focus-visible")||(V.classList.add("focus-visible"),V.setAttribute("data-focus-visible-added",""))}function b(V){V.hasAttribute("data-focus-visible-added")&&(V.classList.remove("focus-visible"),V.removeAttribute("data-focus-visible-added"))}function g(V){V.metaKey||V.altKey||V.ctrlKey||(h(i.activeElement)&&w(i.activeElement),o=!0)}function S(V){o=!1}function A(V){h(V.target)&&(o||m(V.target))&&w(V.target)}function k(V){h(V.target)&&(V.target.classList.contains("focus-visible")||V.target.hasAttribute("data-focus-visible-added"))&&(l=!0,window.clearTimeout(c),c=window.setTimeout(function(){l=!1},100),b(V.target))}function R(V){document.visibilityState==="hidden"&&(l&&(o=!0),N())}function N(){document.addEventListener("mousemove",$),document.addEventListener("mousedown",$),document.addEventListener("mouseup",$),document.addEventListener("pointermove",$),document.addEventListener("pointerdown",$),document.addEventListener("pointerup",$),document.addEventListener("touchmove",$),document.addEventListener("touchstart",$),document.addEventListener("touchend",$)}function I(){document.removeEventListener("mousemove",$),document.removeEventListener("mousedown",$),document.removeEventListener("mouseup",$),document.removeEventListener("pointermove",$),document.removeEventListener("pointerdown",$),document.removeEventListener("pointerup",$),document.removeEventListener("touchmove",$),document.removeEventListener("touchstart",$),document.removeEventListener("touchend",$)}function $(V){V.target.nodeName&&V.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),N(),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 Qz="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=",Jpe="_spinner_vz46q_1",Qpe="_spin_vz46q_1",Zpe="_svg_vz46q_16",Xpe="_menu_vz46q_276",ehe="_fadein_vz46q_1",the="_fadeout_vz46q_1",Ct={spinner:Jpe,spin:Qpe,"spinner--light":"_spinner--light_vz46q_12",svg:Zpe,"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:Xpe,fadein:ehe,"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:the},Nb=({light:n,className:e=""})=>ke.jsx("div",{className:`${e} ${Ct.spinner} ${n?Ct["spinner--light"]:""}`,children:ke.jsx("div",{className:Ct["spinner-inner"]})}),Ru=({icon:n,className:e=""})=>ke.jsx("div",{className:`${Ct.svg} ${e}`,dangerouslySetInnerHTML:{__html:n}}),bk=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")}},QP={[Pn.PLAY]:Gz,[Pn.PAUSE]:Ppe,[Pn.MUTE]:mk,[Pn.UNMUTE]:d2,[Pn.VOLUME_DOWN]:Yz,[Pn.VOLUME_UP]:d2,[Pn.SEEK_BACK]:KP,[Pn.SEEK_FORWARD]:YP,[Pn.PLAYBACK_RATE_DOWN]:KP,[Pn.PLAYBACK_RATE_UP]:YP,[Pn.SUBTITLES_ON]:$pe,[Pn.SUBTITLES_OFF]:Vpe,[Pn.PLAY_PREVIOUS]:gk,[Pn.PLAY_NEXT]:vk},nhe=({action:n})=>{if(!(!n||!QP[n.action]))return ke.jsxs("div",{className:Ct["user-action-indicator-container"],children:[ke.jsx("div",{className:Ct["user-action-indicator"],children:ke.jsx(Ru,{icon:QP[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]})},Zz=({player:n,videoState:e,setRecentUserAction:t,className:r=""})=>{const[i,o]=_t.useState(n.controls.GetCurrentTime()),[l,c]=_t.useState(0),[p,h]=_t.useState(void 0),[m,w]=_t.useState(n.controls.IsDVREnabled());return _t.useEffect(()=>{h(Uz(n,t));const b=yk({player:n,setCurrentTime:o,rate:60}),g=bpe({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"]})]})},rhe=({player:n,videoState:e})=>ke.jsxs("div",{className:Ct["volume-controls"],children:[ke.jsx(Lu,{"aria-label":e.muted?"Unmute":"Mute",icon:e.muted||e.volume===0?mk:e.volume<.4?Yz:e.volume<.8?Fpe:d2,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:Zde(n),className:Ct["volume-input"]})]})]}),Xz=({player:n,Hide:e,className:t=""})=>{const[r,i]=_t.useState(void 0),[o,l]=_t.useState(void 0),c=_t.createRef();if(_t.useEffect(()=>{const w=()=>l(n.controls.GetOptions());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),_t.useEffect(()=>{if(!c||!c.current)return;const w=dS({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"&&(bk(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:Bpe},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(Ru,{icon:qpe,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,className:Ct["menu-option-icon"]})]})]},"menu"),ke.jsx("div",{ref:c,children:m})},ej=({player:n})=>{const[e,t]=_t.useState(n.dvrEnabled);return _t.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"]})]})},ahe=({label:n,value:e,className:t=""})=>{const[r,i]=_t.useState(!1);return ke.jsx("button",{onClick:()=>{r||(bk(e),i(!0),setTimeout(()=>i(!1),100))},dangerouslySetInnerHTML:{__html:Wpe},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(ahe,{label:n,value:e,className:Ct["verification-menu__detail-copy"]}):null]}):null,tj=({player:n,Hide:e,className:t=""})=>{const r=_t.createRef(),[i,o]=_t.useState(),[l,c]=_t.useState(!1),[p,h]=_t.useState(!1);if(_t.useEffect(()=>{n.__LoadVerificationDetails().then(()=>h(!0));const w=()=>o(n.controls.GetContentVerificationDetails());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),_t.useEffect(()=>{if(!r||!r.current)return;const w=dS({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:p2},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:JP},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(Nb,{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:p2},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:JP},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:rh}})]})})]})]}),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")})},ihe=({player:n,Hide:e,className:t=""})=>{const r=_t.createRef(),[i,o]=_t.useState(void 0);if(_t.useEffect(()=>{const c=()=>o(n.controls.GetCollectionInfo());c();const p=n.controls.RegisterSettingsListener(c);return()=>p&&p()},[]),_t.useEffect(()=>{if(!r||!r.current)return;const c=dS({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")},Lu=({icon:n,className:e="",...t})=>ke.jsx("button",{...t,className:`${zn["icon-button"]} ${e}`,dangerouslySetInnerHTML:{__html:n}}),she=({player:n,videoState:e})=>{const[t,r]=_t.useState(n.video.currentTime);return _t.useEffect(()=>{const i=yk({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(ej,{player:n}),n.isLive&&!n.behindLiveEdge?null:`${l2(t,e.duration)} / `,n.isLive&&!n.dvrEnabled?null:l2(e.duration,e.duration)]})},ohe=({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(Lu,{"aria-label":`Play Previous: ${t.title}`,disabled:!i,icon:gk,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(Lu,{"aria-label":`Play Next: ${r.title}`,disabled:!i,icon:vk,onClick:()=>n.controls.CollectionPlayNext()}),ke.jsx("div",{className:zn["collection-button-text"],children:r.title})]},`media-next-${e.mediaIndex}`):null]})},nj=({label:n,icon:e,player:t,MenuComponent:r,className:i=""})=>{const[o,l]=_t.useState(!1);return ke.jsxs("div",{className:[zn["menu-control-container"],i].join(" "),children:[ke.jsx(Lu,{"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]})},lhe=({player:n})=>{const[e,t]=_t.useState(void 0),{title:r,subtitle:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return _t.useEffect(()=>{t(void 0),l&&pk({player:n,pathOrUrl:l,width:200}).then(p=>t(p))},[l]),!r||n.playerOptions.title===Dt.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()||n.playerOptions.title===Dt.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]})]})},uhe=({player:n})=>{const[e,t]=_t.useState(!1);return _t.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(nj,{label:"Content Verification Menu",icon:p2,player:n,MenuComponent:tj,className:zn["content-verification-menu-button"]})]}):null},che=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=_t.useState(void 0),[p,h]=_t.useState(void 0),[m,w]=_t.useState(n.controls.IsMenuVisible());if(_t.useEffect(()=>{if(!n.controls)return;h(Dz({player:n,setRecentUserAction:i}));const A=()=>n&&n.controls&&w(n.controls.IsMenuVisible()),k=n.controls.RegisterSettingsListener(A),R=$z({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===Dt.controls.AUTO_HIDE;return n.__SetControlsVisibility(!S),ke.jsxs("div",{onClick:p,className:[o,zn.container,g?"":zn.autohide,n.playerOptions.controls!==Dt.controls.DEFAULT?"":zn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(lhe,{player:n},`content-info-${b&&b.mediaIndex}`),[Dt.controls.DEFAULT,Dt.controls.OFF,Dt.controls.OFF_WITH_VOLUME_TOGGLE].includes(n.playerOptions.controls)?null:ke.jsxs(ke.Fragment,{children:[ke.jsx(Lu,{"aria-label":"Play",tabIndex:e?-1:0,icon:Vz,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(Zz,{player:n,videoState:l,setRecentUserAction:i,className:zn.seek}),ke.jsxs("div",{className:zn.controls,children:[ke.jsx(Lu,{"aria-label":l.playing?"Pause":"Play",icon:l.playing?Kz:Wz,onClick:()=>n.controls.TogglePlay(),className:zn["play-pause-button"]}),ke.jsx(ohe,{player:n}),ke.jsx(rhe,{player:n,videoState:l}),ke.jsx(she,{player:n,videoState:l}),ke.jsx("div",{className:zn.spacer}),ke.jsx(uhe,{player:n}),n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.airplayAvailable?ke.jsx(Lu,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Jz}):null,n.controls.IsRotatable()?ke.jsx(Lu,{"aria-label":"Rotate Video",icon:Gpe,onClick:()=>n.controls.SetAllowRotation(!n.controls.AllowRotation()),className:zn["right-control-button"]}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(nj,{label:"Settings Menu",icon:Upe,player:n,MenuComponent:Xz}):null,ke.jsx(Lu,{"aria-label":l.fullscreen?"Exit Fullscreen":"Fullscreen",icon:l.fullscreen?Dpe:Ipe,onClick:()=>n.controls.ToggleFullscreen(),className:zn["right-control-button"]})]})]})]}),n.playerOptions.controls!==Dt.controls.OFF_WITH_VOLUME_TOGGLE?null:ke.jsx("div",{className:zn["floating-volume-toggle"],children:ke.jsx(Lu,{"aria-label":l.muted?"Unmute":"Mute",icon:l.muted||l.volume===0?mk:d2,onClick:()=>n.controls.ToggleMuted(),className:zn["volume-button"]},"mute-button")}),n.playerOptions.watermark===Dt.watermark.OFF?null:ke.jsx("div",{className:zn.watermark,children:ke.jsx("img",{src:Qz,alt:"Eluvio"})})]})},fhe="_spinner_1c6ar_17",dhe="_text_1c6ar_33",phe="_title_1c6ar_39",hhe="_description_1c6ar_43",yhe="_inputs_1c6ar_47",mhe="_input_1c6ar_47",ghe="_submit_1c6ar_77",wi={"ticket-form-container":"_ticket-form-container_1c6ar_1","ticket-form-overlay":"_ticket-form-overlay_1c6ar_8",spinner:fhe,"ticket-form":"_ticket-form_1c6ar_1",text:dhe,title:phe,description:hhe,inputs:yhe,input:mhe,submit:ghe,"error-message":"_error-message_1c6ar_88","size-md":"_size-md_1c6ar_102","size-sm":"_size-sm_1c6ar_103"},vhe=({parameters:n,dimensions:e,onComplete:t})=>{let{tenantId:r,ntpId:i,ticketCode:o,ticketSubject:l}=n.clientOptions||{};const c=!r||!i,[p,h]=_t.useState(o||""),[m,w]=_t.useState(!!o),[b,g]=_t.useState(!1),[S,A]=_t.useState(c?"Error: Tenant ID or NTP ID not specified":""),[k,R]=_t.useState(void 0),N=async({client:I,code:$})=>{if(!(!$||!I)){A(""),g(!0);try{let V=l;$.includes(":")&&(V=$.split(":")[0],$=$.split(":")[1]),await I.RedeemCode({tenantId:r,ntpId:i,code:$.trim(),email:V}),t(I)}catch(V){console.log(V),A("Invalid Code"),w(!1)}finally{g(!1)}}};return _t.useEffect(()=>{Promise.resolve().then(()=>Iz).then(async({ElvClient:I})=>{const $=await I.FromConfigurationUrl({configUrl:n.clientOptions.network});R($),o&&N({client:$,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(Nb,{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(),N({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"&&N({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(Nb,{light:!0}):"Submit"})]}),ke.jsxs("div",{className:wi["error-message"],children:[S," "]})]})})})},bhe="_container_m8dfx_1",whe="_autohide_m8dfx_34",_he="_fadein_m8dfx_1",xhe="_title_m8dfx_134",She="_spacer_m8dfx_319",Che="_watermark_m8dfx_323",Ehe="_menu_m8dfx_145",dn={container:bhe,"container--default-controls":"_container--default-controls_m8dfx_29",autohide:whe,"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:_he,"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:xhe,"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:She,watermark:Che,menu:Ehe},Ad=({icon:n,...e})=>ke.jsx("button",{...e,className:`${dn["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),Ahe=({player:n,videoState:e})=>{const[t,r]=_t.useState(n.video.currentTime);return _t.useEffect(()=>{const i=yk({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:l2(t,e.duration)}),ke.jsx("div",{className:dn.spacer}),ke.jsx("div",{className:dn.time,children:l2(e.duration,e.duration)})]})},khe=({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(Ad,{disabled:!o||!r,icon:gk,onClick:()=>n.controls.CollectionPlayPrevious(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Ad,{"aria-label":"Back 10 Seconds",icon:zpe,onClick:()=>n.controls.Seek({relativeSeconds:-10}),className:dn["icon-button--drop-shadow-focus"]}),ke.jsx(Ad,{"aria-label":e.playing?"Pause":"Play",icon:e.playing?Kz:Wz,onClick:()=>n.controls.TogglePlay(),className:`${dn["play-pause-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Ad,{"aria-label":"Forward 10 Seconds",icon:jpe,onClick:()=>n.controls.Seek({relativeSeconds:10}),className:dn["icon-button--drop-shadow-focus"]}),!r&&!i?null:ke.jsx(Ad,{disabled:!o||!i,icon:vk,onClick:()=>n.controls.CollectionPlayNext(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`})]})},q4=({label:n,icon:e,children:t,player:r,MenuComponent:i})=>{const[o,l]=_t.useState(!1);return ke.jsxs("div",{className:dn["menu-control-container"],children:[e?ke.jsx(Ad,{"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]})},Mhe=({player:n,Hide:e})=>{const[t,r]=_t.useState(void 0),{title:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return _t.useEffect(()=>{r(void 0),l&&pk({player:n,pathOrUrl:l,width:200}).then(p=>r(p))},[l]),_t.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(Ru,{icon:Gz}),"From Beginning"]})})]})]})},The=({player:n})=>{const[e,t]=_t.useState(!1);return _t.useEffect(()=>{const r=()=>t(n.controls.ContentVerified());r(),n.controls.RegisterSettingsListener(r)},[]),e?ke.jsx(q4,{label:"Content Verification Menu",icon:p2,player:n,MenuComponent:tj,className:dn["content-verification-menu-button"],children:"Verified"}):null},Rhe=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=_t.useState(void 0),[p,h]=_t.useState(void 0),[m,w]=_t.useState(!1);if(_t.useEffect(()=>{h(Dz({player:n,setRecentUserAction:i}));const k=$z({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===Dt.controls.AUTO_HIDE;return n.__SetControlsVisibility(!A),ke.jsxs("div",{onClick:p,className:[o,dn.container,S?"":dn.autohide,n.playerOptions.controls!==Dt.controls.DEFAULT?"":dn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(Ad,{"aria-label":"Play",tabIndex:e?-1:0,icon:Vz,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(Mhe,{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===Dt.title.OFF||n.playerOptions.title===Dt.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()?"":b||""}),ke.jsx("div",{className:dn.spacer}),n.isLive?n.controls.IsDVRAvailable()?ke.jsx(ej,{player:n}):ke.jsx("div",{className:dn["live-indicator"],children:"Live"}):null,g?ke.jsx(q4,{label:"Collection Menu",icon:Hpe,player:n,MenuComponent:ihe}):null]}),ke.jsx(Zz,{player:n,videoState:l,setRecentUserAction:i}),ke.jsx(Ahe,{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===Dt.title.OFF?null:ke.jsx("button",{className:dn["text-button"],onClick:()=>w(!0),children:"Info"})}),ke.jsx(khe,{player:n,videoState:l}),ke.jsxs("div",{className:dn["bottom-right-controls"],children:[ke.jsx(The,{player:n}),n.airplayAvailable?ke.jsx(Ad,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Jz}):null,n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(q4,{label:"Settings",player:n,MenuComponent:Xz,children:"Settings"},"settings-button"):null]})]})]}),n.playerOptions.watermark===Dt.watermark.OFF?null:ke.jsx("div",{className:dn.watermark,children:ke.jsx("img",{src:Qz,alt:"Eluvio"})})]},"controls")},Ohe="_container_1l7ln_1",Lhe="_overlay_1l7ln_9",Nhe="_fadein_1l7ln_1",Phe="_form_1l7ln_22",Ihe="_header_1l7ln_39",Dhe="_input_1l7ln_45",Uhe="_actions_1l7ln_92",Fhe="_submit_1l7ln_98",Bhe="_cancel_1l7ln_99",fo={container:Ohe,overlay:Lhe,fadein:Nhe,form:Phe,header:Ihe,"input-container":"_input-container_1l7ln_45",input:Dhe,"input--invalid":"_input--invalid_1l7ln_65","player-info":"_player-info_1l7ln_74","api-link":"_api-link_1l7ln_83",actions:Uhe,submit:Fhe,cancel:Bhe},zhe=({player:n,Close:e})=>{const[t,r]=_t.useState(),[i,o]=_t.useState(!1),[l,c]=_t.useState(""),p=_t.useRef();_t.useEffect(()=>{if(!p||!p.current)return;const m=dS({element:p.current,Hide:e});return()=>m&&m()},[p]),_t.useEffect(()=>{let m={...n.hlsOptions||{}};delete m.drmSystems,delete m.emeEnabled,r(JSON.stringify(m,null,2))},[]);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(Nb,{light:!0}):"Submit"})]})]})})})},jhe=({player:n})=>{const[e,t]=_t.useState(void 0),{posterImage:r}=n.controls.GetContentInfo()||{};return _t.useEffect(()=>{t(void 0),r&&pk({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 Hhe;const qhe=({target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:i,Reset:o,SetAdditionalParameters:l})=>{const[c,p]=_t.useState(void 0),[h,m]=_t.useState(void 0),[w,b]=_t.useState("lg"),[g,S]=_t.useState("landscape"),[A,k]=_t.useState({width:n.getBoundingClientRect().width,height:n.getBoundingClientRect().height}),[R,N]=_t.useState(void 0),[I,$]=_t.useState(!1),[V,de]=_t.useState(!1),[oe,he]=_t.useState(!1),[xe,Ce]=_t.useState(!1),[ne,Le]=_t.useState(!1),[C,x]=_t.useState(!0),[O,j]=_t.useState(void 0),[F,H]=_t.useState(void 0),[Q,ae]=_t.useState(!1),L=_t.useRef(),T=!!c,Y=({action:B,text:be})=>j({action:B,text:be,key:Math.random()});if(_t.useEffect(()=>{Ce(!0);const B=wpe({target:n,setSize:b,setOrientation:S,setDimensions:k});return()=>{Ce(!1),B&&B()}},[]),_t.useEffect(()=>{if(!(!L||!L.current||!xe))try{$(!1),de(!1),e.clientOptions.client=h||e.clientOptions.client;const B=new u2({target:n,video:L.current,parameters:e,SetErrorMessage:N,Reload:o,UpdateParameters:pe=>{l(pe)}});window.__elvPlayer=B;const be=B.controls.RegisterSettingsListener(()=>{H(B.controls.AllowRotation()),de(B.playbackStarted),$(!B.loading),Le(B.__showPlayerProfileForm),ae(B&&B.casting)});B.Destroy=()=>{B.__DestroyPlayer(),i()},B.Reset=()=>{o()};const Ie=_pe({player:B}),Me=xpe({player:B,inactivityPeriod:5e3,onWake:()=>x(!0),onSleep:()=>x(!1)}),De=Spe({player:B,setRecentUserAction:Y}),se=Cpe({player:B});t(B),p(B);const ue=B.controls.RegisterVideoEventListener("canplay",()=>he(!0));return()=>{L&&L.current&&L.current.removeEventListener("play",de),be&&be(),Ie&&Ie(),Me&&Me(),De&&De(),se&&se(),ue&&ue(),B&&B.__DestroyPlayer()}}catch(B){r(B),i()}},[L,xe,h]),_t.useEffect(()=>{if(T)return()=>{c&&c.__DestroyPlayer(),p(void 0)}},[T]),_t.useEffect(()=>{O&&(clearTimeout(Hhe),setTimeout(()=>{j(void 0)},1e3))},[O]),e.clientOptions.promptTicket&&!h)return ke.jsx(vhe,{parameters:e,dimensions:{size:w,orientation:g,...A},onComplete:B=>m(B)});const ie=e.playerOptions.ui===Dt.ui.WEB&&c&&c.controls.IsRotatable()&&F;return ke.jsxs("div",{role:"complementary","aria-label":"Eluvio Video Player",tabIndex:0,style:{backgroundColor:e.playerOptions.backgroundColor||"transparent","--portal-width":`${ie?A.height:A.width}px`,"--portal-height":`${ie?A.width:A.height}px`},className:[Ys["player-container"],ie?Ys["player-container--rotated"]:"",`__eluvio-player--size-${w}`,`__eluvio-player--orientation-${g}`].join(" "),children:[!ne||!I?null:ke.jsx(zhe,{player:c,Close:()=>c.controls.HidePlayerProfileForm()}),ke.jsx("video",{playsInline:!0,disablePictureInPicture:!0,ref:L,muted:[Dt.muted.ON,Dt.muted.WHEN_NOT_VISIBLE].includes(e.playerOptions.muted),controls:e.playerOptions.controls===Dt.controls.DEFAULT,loop:e.playerOptions.loop===Dt.loop.ON,crossOrigin:"anonymous",className:Ys.video}),!c||!oe||V&&!e.playerOptions.permanentPoster?null:ke.jsx(jhe,{player:c}),I||R||!e.playerOptions.showLoader?null:ke.jsx("div",{className:Ys["spinner-container"],children:ke.jsx(Nb,{className:Ys.spinner})}),Q?ke.jsx("div",{className:Ys["cast-indicator-container"],children:ke.jsx("div",{dangerouslySetInnerHTML:{__html:Kpe}})}):null,R?ke.jsxs("div",{className:Ys["error-message"],children:[ke.jsx("div",{className:Ys["error-message__message"],children:R}),ke.jsxs("button",{className:Ys["error-message__copy-debug-button"],onClick:()=>bk(JSON.stringify(c.controls.GetDebugInfo(),null,2)),children:[ke.jsx(Ru,{icon:Ype,className:Ys["error-message__icon"]}),"Copy Troubleshooting Info"]})]}):null,c?e.playerOptions.ui===Dt.ui.WEB?ke.jsx(che,{player:c,playbackStarted:!!V,canPlay:oe,recentlyInteracted:C,setRecentUserAction:Y,className:Ys.controls}):ke.jsx(Rhe,{player:c,playbackStarted:!!V,canPlay:oe,recentlyInteracted:C,setRecentUserAction:Y,className:Ys.controls}):null,O?ke.jsx(nhe,{action:O},`action-indicator-${O&&O.key}`):null]})},$he=({parameters:n,...e})=>{const[t,r]=_t.useState(Math.random()),[i,o]=_t.useState();return _t.createElement(qhe,{...e,SetAdditionalParameters:o,parameters:i?hk(n,i):n,key:`player-${t}`,Reset:()=>r(Math.random())})},Vhe=(n,e)=>(n.innerHTML="",n.classList.add(ZG.reset),n.classList.add(Ys["player-target"]),e=Fz(e),e.playerOptions&&e.playerOptions.backgroundColor&&(n.style.backgroundColor=e.playerOptions.backgroundColor),new Promise((t,r)=>{const i=Wv.createRoot(n);i.render(ke.jsx(KG.StrictMode,{children:ke.jsx($he,{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=Vhe;exports.PlayerParameters=Dt;exports.commonjsGlobal=Fa;exports.crypto=aI;exports.eventsExports=Kb;exports.getDefaultExportFromCjs=Bd;exports.inherits_browserExports=KI;exports.require$$3=y2;exports.requireBuffer=Pb;exports.string_decoder=G5;
|
|
379
|
+
${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(!rb)throw Error("ElvWalletClient: Unable to sign");const t={action:"personal-sign",message:e,logIn:!0};let r=new URL(this.appUrl);if(r.hash=pa("/action","sign",ia.B58(JSON.stringify(t))),r.searchParams.set("origin",window.location.origin),!Wde&&window.location.origin===r.origin)throw Error("ElvWalletClient: Unable to sign");return await new Promise(async(i,o)=>{await $P({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 $P({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={},Fx)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&&Fx)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(!rb||!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&&!ia.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=pa("/",e,t,"marketplace",r,ia.B58(JSON.stringify(i))):o.pathname=pa("/",e,t,ia.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 ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("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 ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("as","wlt","login","session",e),method:"POST",headers:{Authorization:`Bearer ${this.AuthToken()}`},body:{op:"set",id:e,format:"auth_token",payload:JSON.stringify({addr:ia.FormatAddress(t),eth:t?`ikms${ia.AddressToHash(t)}`:"",type:r,token:i,expiresAt:o,...l})}}))}async GetCodeAuth({code:e,passcode:t}){try{return await ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("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;const t=this.topLevelInfo.marketplaces;let r={...this.availableMarketplaces||{}},i={...this.availableMarketplacesById||{}};t.map(o=>{const l=ia.DecodeVersionHash(o.source_hash).objectId,c=o.slug||o.name;r[o.tenant_slug]=r[o.tenant_slug]||{},r[o.tenant_slug][c]={...o,tenantName:o.tenant_slug,tenantSlug:o.tenant_slug,tenantId:o.tenant_id,marketplaceSlug:c,marketplaceId:l,marketplaceHash:o.source_hash},i[l]=r[o.tenant_slug][c],this.marketplaceHashes[l]=o.source_hash}),this.availableMarketplaces=r,this.availableMarketplacesById=i}async LatestMarketplaceHash({marketplaceParams:e}){const t=await this.MarketplaceInfo({marketplaceParams:e});if(this.previewMarketplaceId&&ia.EqualHash(this.previewMarketplaceId,t.marketplaceId))return this.previewMarketplaceHash;const r=await this.client.ContentObjectMetadata({libraryId:this.mainSiteLibraryId,objectId:this.mainSiteId,metadataSubtree:pa("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug),resolveLinks:!1,noAuth:!0});return q8(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&&ia.EqualHash(r,this.previewMarketplaceId)?o=await this.client.ContentObjectMetadata({versionHash:this.previewMarketplaceHash,metadataSubtree:"/public/asset_metadata/info",localizationSubtree:this.localization?pa("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:pa("/public","asset_metadata","tenants",t.tenantSlug,"marketplaces",t.marketplaceSlug,"info"),localizationSubtree:this.localization?pa("/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:pa("/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:q8(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=q8(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:N=-1,startTime:I,endTime:$,includeCheckoutLocked:V=!1,start:de=0,limit:oe=50}={}){b=(b||[]).map(ne=>parseInt(ne));let he={start:de,limit:oe,sort_descending:r};e==="owned"&&t==="created"&&(t="default"),e!=="leaderboard"&&(he.sort_by=t),e.includes("listings")&&V&&(he.checkout=!0);let xe,Ce;m&&(xe=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 L=ia.SafeTraverse(ae,"nft_template","nft","address");L&&ne.push(`${e==="owned"?"contract_addr":"contract"}:eq:${ia.FormatAddress(L)}`)})}):(xe||w)&&ne.push(`tenant:eq:${xe?xe.tenantId:w}`),c?(e==="owned"?ne.push(`contract_addr:eq:${ia.FormatAddress(c)}`):ne.push(`contract:eq:${ia.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}"}`),he.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||$?(I&&ne.push(`created:gt:${parseInt(I)/1e3}`),$&&ne.push(`created:lt:${parseInt($)/1e3}`)):N&&N>0&&ne.push(`created:gt:${(Date.now()/1e3-N*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=pa("as","wlt",k||this.UserAddress());break;case"owned-full-meta":C=pa("as","apigw","nfts"),Le={Authorization:`Bearer ${this.AuthToken()}`};break;case"listings":C=pa("as","mkt","f");break;case"transfers":C=pa("as","mkt","hst","f"),ne.push("action:eq:TRANSFERRED"),ne.push("action:eq:SOLD");break;case"sales":C=pa("as","mkt","hst","f"),ne.push("action:eq:SOLD"),ne.push("seller:co:0x");break;case"listing-stats":C=pa("as","mkt","stats","listed");break;case"sales-stats":C=pa("as","mkt","stats","sold"),ne.push("seller:co:0x");break;case"leaderboard":C=pa("as","wlt","leaders");break}if(ne.length>0&&(he.filter=ne),e.includes("stats"))return await ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:he,headers:Le}));const{contents:x,paging:O}=await ia.ResponseToJson(await this.client.authClient.MakeAuthServiceRequest({path:C,method:"GET",queryParams:he,headers:Le}))||[],j=["owned","listings","owned-full-meta"];return{paging:{start:he.start,limit:he.limit,total:O.total,more:O.total>de+oe},results:(x||[]).map(F=>j.includes(e)?$de(this,F):F)}}catch(ne){if(ne.status&&ne.status.toString()==="404")return{paging:{start:he.start,limit:he.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 ia.ResponseToJson(this.client.authClient.MakeAuthServiceRequest({path:pa("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")?ia.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")?ia.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:ia.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:pa("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:pa("as","tnt","config",e,"metadata"),method:"POST",body:o,headers:{Authorization:`Bearer ${l}`}})}}Object.assign(Od.prototype,zde());Object.assign(Od.prototype,jde());Object.assign(Od.prototype,Hde());const{ElvClient:Kde}=$4,Yde=Mi;var Jde=Kde,Dd=Yde;const Iz=Object.freeze(Object.defineProperty({__proto__:null,ElvClient:Jde,Utils:Dd},Symbol.toStringTag,{value:"Module"})),VP={default:{label:"Default",hlsSettings:Dd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class Qde{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(VP).map(t=>({index:t,label:VP[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"},Dz=({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()}},Uz=(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}},Zde=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}},l2=(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},pk=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})):""},hk=(n,e={},t=1)=>{if(t>10)return{};let r={};return Object.keys(n).forEach(i=>{if(i==="client")r.client=e.client;else if(typeof n[i]=="object"&&!Array.isArray(n[i]))r[i]=hk(n[i],(e||{})[i],t+1);else{const o=(e||{})[i];r[i]=typeof o<"u"?o:n[i]}}),r},Fz=n=>hk(VG,n),Xde=/iPhone|iPad|iPod/i.test(navigator.userAgent),GP=window.__chromecastAvailable||!!(window.chrome&&window.chrome.cast),epe={default:{label:"Default",hlsSettings:Dd.HLSJSSettings({profile:"default"})},low_latency:{label:"Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ll"})},ultra_low_latency:{label:"Ultra Low Latency Live",hlsSettings:Dd.HLSJSSettings({profile:"ull"})},custom:{label:"Custom",hlsSettings:{}}};class u2{__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,Reload:i,UpdateParameters:o,SetErrorMessage:l}){this.latest=!0,this.loading=!0,this.target=e,this.video=t,this.controls=new Qde({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=GP&&r.playerOptions.allowCasting,this.casting=!1,this.usePlayerControls=[Dt.controls.ON,Dt.controls.AUTO_HIDE].includes(r.playerOptions.controls),this.__error=void 0,this.__ReloadComponent=i,this.__UpdateParameters=o,this.SetErrorMessage=(c,p)=>{l(c),this.__error=p};try{r.playerOptions.hlsjsOptions&&Object.keys(r.playerOptions.hlsjsOptions).length>0&&(this.customHLSOptions=r.playerOptions.hlsjsOptions,r.playerOptions.playerProfile=Dt.playerProfile.CUSTOM)}catch(c){this.Log(c,!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(()=>Iz);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(Dd.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 g=this.collectionInfo.content[this.collectionInfo.mediaIndex];t.objectId=e.utils.DecodeVersionHash(g.mediaHash).objectId,t.versionHash=g.mediaHash,this.sourceOptions.playoutOptions=void 0}let r,i,o={ignore_trimming:t.ignoreTrimming,resolve:t.resolve,...t.options||{}};if((t.clipStart||t.clipEnd)&&(o.clip_start=parseFloat(t.clipStart||0),t.clipEnd&&(o.clip_end=parseFloat(t.clipEnd))),!t.channel){let g=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=g.default?"default":Object.keys(g)[0],t.offering?r=g[t.offering]?t.offering:void 0:(t.offerings||[]).length>0?r=t.offerings.find(A=>g[A]):t.offerings&&t.offerings.length>0&&(r=t.offerings.find(A=>g[A])),!r)throw new Error(`Unable to find offering from '${t.offering||t.offerings}'`);const S=g[r]&&g[r].properties||{};i=g[r].uri,this.sourceOptions.contentInfo.liveDVR===Dt.liveDVR.ON&&S.dvr_available?(o.dvr=1,this.dvrAvailable=!0):this.dvrAvailable=!1,this.isLive=S.live}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,handler:t.channel?"channel":"playout",offering:t.channel||r,options:o}));let l=(await e.AvailableDRMs()).filter(g=>(this.sourceOptions.drms||[]).includes(g)),c=this.sourceOptions.protocols,p,h;for(;!(p&&h);){p=c.find(S=>this.sourceOptions.playoutOptions[S]);const g=Object.keys(this.sourceOptions.playoutOptions[p].playoutMethods);if(h=(this.sourceOptions.drms||[]).length===0?g.find(S=>S!=="clear")||g[0]:this.sourceOptions.drms.sort().reverse().find(S=>l.includes(S)&&this.sourceOptions.playoutOptions[p].playoutMethods[S]),!h&&(c=c.filter(S=>S!==p),c.length===0))throw Error("No valid protocol / DRM combination available")}const{playoutUrl:m,drms:w}=this.sourceOptions.playoutOptions[p].playoutMethods[h],b=m.split("/").find(g=>g.startsWith("hq__"));return{playoutParameters:{...t,options:o},protocol:p,drm:h,playoutUrl:m,versionHash:b,drms:w,availableDRMs:l,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=Fz(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=Dt.autoplay.ON),t.currentTime&&this.__RegisterVideoEventListener("loadedmetadata",()=>this.video.currentTime=t.currentTime)),this.usePlayerControls&&this.playerOptions.allowCasting&&(this.castHandler=new gW({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===Dt.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-CrJ6Bi-J.js")).then(({InitializeMuxMonitoring:w})=>w({appName:this.playerOptions.appName||"elv-player-js",elvPlayer:this,playoutUrl:i,authorizationToken:m,disableCookies:this.playerOptions.collectVideoAnalytics===Dt.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-BVyq94RY.js"))).default;const l=this.video.canPlayType("application/vnd.apple.mpegURL");if(l&&Xde&&this.playerOptions.preferNativeHLS||[Dt.drms.FAIRPLAY,Dt.drms.SAMPLE_AES].includes(r)||!this.HLS.isSupported()){if(this.nativeHLS=!0,r===Dt.drms.FAIRPLAY?mW({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===Dt.drms.PLAYREADY||r===Dt.drms.WIDEVINE)&&(c={drmSystems:{},emeEnabled:!0,licenseXhrSetup:(w,b)=>{w.open("POST",b,!0),w.setRequestHeader("Authorization",`Bearer ${t}`)}},r===Dt.drms.PLAYREADY?c.drmSystems={"com.microsoft.playready":{licenseUrl:i[r].licenseServers[0]}}:r===Dt.drms.WIDEVINE&&(c.drmSystems={"com.widevine.alpha":{licenseUrl:i[r].licenseServers[0]}}));let p=(epe[this.playerOptions.playerProfile]||{}).hlsSettings||{};const h=this.playerOptions.playerProfile===Dt.playerProfile.CUSTOM?this.customHLSOptions:{};this.sourceOptions.playoutParameters&&this.sourceOptions.playoutParameters.channel&&Object.keys(h).length===0&&(p.maxBufferHole=4.2),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={}})=>{if(this.playoutUrl&&this.playoutUrl.includes("hls-widevine")){this.__UpdateParameters({playerOptions:{playerProfile:w,hlsjsOptions:b}}),this.__ReloadComponent();return}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,drms:i,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,clearTimeout(this.stallTimeout)}),m.on(this.HLS.Events.ERROR,async(w,b)=>{if(this.errors+=1,this.Log(`Encountered ${b.details}`,!0),this.Log(b,!0),b.response&&b.response.code===403)this.SetErrorMessage("Insufficient permissions",b);else if(this.errors<5){if(b.fatal)b.data&&b.data.type===this.HLS.ErrorTypes.MEDIA_ERROR?(this.Log("Attempting to recover using hlsPlayer.recoverMediaError",!0),m.recoverMediaError()):this.__HardReload(b);else if(b.details==="bufferStalledError"){clearTimeout(this.stallTimeout);let g=this.video&&this.video.currentTime;setTimeout(()=>{this.video&&this.video.currentTime>g||(this.Log("Buffer Stalled. Attempting to recover using hlsPlayer.recoverMediaError",!0),m.recoverMediaError(),this.stallTimeout=setTimeout(()=>{this.Log("Buffer Stalled. Reloading player...",!0),this.__HardReload(b,0,g)},5e3))},2e3)}}else 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-BmN834Y_.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===Dt.drms.WIDEVINE){const c=i.widevine.licenseServers[0];o.setProtectionData({"com.widevine.alpha":{serverURL:c}})}o.initialize(this.video,e.toString(),this.playerOptions.autoplay===Dt.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===Dt.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}),i=await e.ContentSpaceId();let o,l,c;try{l=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"objectTimestamp"}),l&&(l=new Date(parseInt(l._hex,16)*1e3)),c=await e.CallContractMethod({contractAddress:e.utils.HashToAddress(t),methodName:"countVersionHashes"}),c&&(c=parseInt(c._hex,16))}catch{}try{o=await e.ContentObjectMetadata({libraryId:i.replace("ispc","ilib"),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:o,ownerAddress:await e.ContentObjectOwner({objectId:t}),lastCommittedAt:l,versionCount:c,latestVersionHash:await e.LatestVersionHash({objectId:t}),signatureMethod:"ECDSA secp256k1"},this.__SettingsUpdate();try{if(e.NetworkInfo().name==="main"){const p=new URL("https://explorer.contentfabric.io/api");p.searchParams.set("module","account"),p.searchParams.set("action","txlist"),p.searchParams.set("offset","1"),p.searchParams.set("address",e.utils.HashToAddress(t)),this.contentAudit.details.latestTransactionHash=(await(await fetch(p)).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=GP&&this.playerOptions.allowCasting,this.casting=!1,this.__error=void 0}}async __HardReload(e,t=6e3,r){if(!this.reloading){if(this.reloading=!0,this.reloads+=1,this.reloads>10){this.SetErrorMessage(e&&e.displayMessage||"Unable to play content",e);return}this.playoutUrl&&this.playoutUrl.includes("hls-widevine")&&this.__ReloadComponent();try{if(e&&this.playerOptions.restartCallback)try{const i=await this.playerOptions.restartCallback(e);if(i&&typeof i=="boolean"){this.Destroy();return}}catch(i){this.Log("Restart callback failed:"),this.Log(i)}if(t>0&&(this.SetErrorMessage(e&&e.displayMessage||"Something went wrong, reloading player...",e),await new Promise(i=>setTimeout(i,t))),this.__destroyed)return;this.Log("Reloading stream");try{const i=await this.__Client();i.region?await i.UseRegion({region:i.region}):i.Nodes().fabricURIs.length>1&&await i.ResetRegion()}catch(i){this.Log("Client region reset failed:"),this.Log(i)}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:r||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()}}u2.EluvioPlayerParameters=Dt;u2.EluvioPlayer=u2;var Bz=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}()}(),H4=typeof window<"u"&&typeof document<"u"&&window.document===document,c2=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")()}(),tpe=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(c2):function(n){return setTimeout(function(){return n(Date.now())},1e3/60)}}(),npe=2;function rpe(n,e){var t=!1,r=!1,i=0;function o(){t&&(t=!1,n()),r&&c()}function l(){tpe(o)}function c(){var p=Date.now();if(t){if(p-i<npe)return;r=!0}else t=!0,r=!1,setTimeout(l,e);i=p}return c}var ape=20,ipe=["top","right","bottom","left","width","height","size","weight"],spe=typeof MutationObserver<"u",ope=function(){function n(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=rpe(this.refresh.bind(this),ape)}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(){!H4||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),spe?(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(){!H4||!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=ipe.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}(),zz=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},om=function(n){var e=n&&n.ownerDocument&&n.ownerDocument.defaultView;return e||c2},jz=fS(0,0,0,0);function f2(n){return parseFloat(n)||0}function WP(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+f2(o)},0)}function lpe(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]=f2(l)}return t}function upe(n){var e=n.getBBox();return fS(0,0,e.width,e.height)}function cpe(n){var e=n.clientWidth,t=n.clientHeight;if(!e&&!t)return jz;var r=om(n).getComputedStyle(n),i=lpe(r),o=i.left+i.right,l=i.top+i.bottom,c=f2(r.width),p=f2(r.height);if(r.boxSizing==="border-box"&&(Math.round(c+o)!==e&&(c-=WP(r,"left","right")+o),Math.round(p+l)!==t&&(p-=WP(r,"top","bottom")+l)),!dpe(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 fS(i.left,i.top,c,p)}var fpe=function(){return typeof SVGGraphicsElement<"u"?function(n){return n instanceof om(n).SVGGraphicsElement}:function(n){return n instanceof om(n).SVGElement&&typeof n.getBBox=="function"}}();function dpe(n){return n===om(n).document.documentElement}function ppe(n){return H4?fpe(n)?upe(n):cpe(n):jz}function hpe(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 zz(l,{x:e,y:t,width:r,height:i,top:t,right:e+r,bottom:i+t,left:e}),l}function fS(n,e,t,r){return{x:n,y:e,width:t,height:r}}var ype=function(){function n(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=fS(0,0,0,0),this.target=e}return n.prototype.isActive=function(){var e=ppe(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}(),mpe=function(){function n(e,t){var r=hpe(t);zz(this,{target:e,contentRect:r})}return n}(),gpe=function(){function n(e,t,r){if(this.activeObservations_=[],this.observations_=new Bz,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 om(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new ype(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 om(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 mpe(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}(),Hz=typeof WeakMap<"u"?new WeakMap:new Bz,qz=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=ope.getInstance(),r=new gpe(e,t,this);Hz.set(this,r)}return n}();["observe","unobserve","disconnect"].forEach(function(n){qz.prototype[n]=function(){var e;return(e=Hz.get(this))[n].apply(e,arguments)}});var vpe=function(){return typeof c2.ResizeObserver<"u"?c2.ResizeObserver:qz}();const dS=({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)}},$z=({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()}},bpe=({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)},yk=({player:n,rate:e=10,setCurrentTime:t})=>{const r=setInterval(()=>{n.controls&&t(n.controls.GetCurrentTime())},1e3/e);return()=>{clearInterval(r)}},wpe=({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 vpe(o);return l.observe(n),()=>l.disconnect()},_pe=({player:n})=>{const e=n.video,t=n.playerOptions.autoplay===Dt.autoplay.WHEN_VISIBLE,r=n.playerOptions.muted===Dt.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()},xpe=({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))}},Spe=({player:n,setRecentUserAction:e})=>{if(n.playerOptions.keyboardControls===Dt.keyboardControls.OFF)return;const t=n.playerOptions.keyboardControls===Dt.keyboardControls.ARROW_KEYS_DISABLED,r=Uz(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)},Cpe=({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)})}}},Epe="_container_fm2ri_1",Ape="_autohide_fm2ri_41",kpe="_fadein_fm2ri_1",Mpe="_seek_fm2ri_174",Tpe="_controls_fm2ri_207",Rpe="_time_fm2ri_221",Ope="_spacer_fm2ri_279",Lpe="_watermark_fm2ri_291",Npe="_menu_fm2ri_37",zn={container:Epe,"container--default-controls":"_container--default-controls_fm2ri_33","bottom-controls-container":"_bottom-controls-container_fm2ri_37",autohide:Ape,"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:kpe,"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:Mpe,"bottom-controls-gradient":"_bottom-controls-gradient_fm2ri_194",controls:Tpe,"play-pause-button":"_play-pause-button_fm2ri_217",time:Rpe,"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:Ope,"floating-volume-toggle":"_floating-volume-toggle_fm2ri_283",watermark:Lpe,"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:Npe},Vz='<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>',Gz='<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>',Wz='<?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>',Ppe='<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>',Kz='<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>',Ipe='<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>',Dpe='<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>',Upe='<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>',mk='<?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>',Yz='<?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>',Fpe='<?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>',d2='<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>',Bpe='<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>',KP='<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>',zpe='<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>',YP='<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>',jpe='<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>',gk='<?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>',vk='<?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>',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-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>',rh='<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>',qpe='<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>',$pe='<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>',Vpe='<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>',Gpe='<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>',p2='<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>',JP='<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>',Wpe='<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>',Jz='<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>',Kpe='<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>',Ype='<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(V){return!!(V&&V!==document&&V.nodeName!=="HTML"&&V.nodeName!=="BODY"&&"classList"in V&&"contains"in V.classList)}function m(V){var de=V.type,oe=V.tagName;return!!(oe==="INPUT"&&p[de]&&!V.readOnly||oe==="TEXTAREA"&&!V.readOnly||V.isContentEditable)}function w(V){V.classList.contains("focus-visible")||(V.classList.add("focus-visible"),V.setAttribute("data-focus-visible-added",""))}function b(V){V.hasAttribute("data-focus-visible-added")&&(V.classList.remove("focus-visible"),V.removeAttribute("data-focus-visible-added"))}function g(V){V.metaKey||V.altKey||V.ctrlKey||(h(i.activeElement)&&w(i.activeElement),o=!0)}function S(V){o=!1}function A(V){h(V.target)&&(o||m(V.target))&&w(V.target)}function k(V){h(V.target)&&(V.target.classList.contains("focus-visible")||V.target.hasAttribute("data-focus-visible-added"))&&(l=!0,window.clearTimeout(c),c=window.setTimeout(function(){l=!1},100),b(V.target))}function R(V){document.visibilityState==="hidden"&&(l&&(o=!0),N())}function N(){document.addEventListener("mousemove",$),document.addEventListener("mousedown",$),document.addEventListener("mouseup",$),document.addEventListener("pointermove",$),document.addEventListener("pointerdown",$),document.addEventListener("pointerup",$),document.addEventListener("touchmove",$),document.addEventListener("touchstart",$),document.addEventListener("touchend",$)}function I(){document.removeEventListener("mousemove",$),document.removeEventListener("mousedown",$),document.removeEventListener("mouseup",$),document.removeEventListener("pointermove",$),document.removeEventListener("pointerdown",$),document.removeEventListener("pointerup",$),document.removeEventListener("touchmove",$),document.removeEventListener("touchstart",$),document.removeEventListener("touchend",$)}function $(V){V.target.nodeName&&V.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),N(),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 Qz="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=",Jpe="_spinner_vz46q_1",Qpe="_spin_vz46q_1",Zpe="_svg_vz46q_16",Xpe="_menu_vz46q_276",ehe="_fadein_vz46q_1",the="_fadeout_vz46q_1",Ct={spinner:Jpe,spin:Qpe,"spinner--light":"_spinner--light_vz46q_12",svg:Zpe,"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:Xpe,fadein:ehe,"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:the},Nb=({light:n,className:e=""})=>ke.jsx("div",{className:`${e} ${Ct.spinner} ${n?Ct["spinner--light"]:""}`,children:ke.jsx("div",{className:Ct["spinner-inner"]})}),Ru=({icon:n,className:e=""})=>ke.jsx("div",{className:`${Ct.svg} ${e}`,dangerouslySetInnerHTML:{__html:n}}),bk=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")}},QP={[Pn.PLAY]:Gz,[Pn.PAUSE]:Ppe,[Pn.MUTE]:mk,[Pn.UNMUTE]:d2,[Pn.VOLUME_DOWN]:Yz,[Pn.VOLUME_UP]:d2,[Pn.SEEK_BACK]:KP,[Pn.SEEK_FORWARD]:YP,[Pn.PLAYBACK_RATE_DOWN]:KP,[Pn.PLAYBACK_RATE_UP]:YP,[Pn.SUBTITLES_ON]:$pe,[Pn.SUBTITLES_OFF]:Vpe,[Pn.PLAY_PREVIOUS]:gk,[Pn.PLAY_NEXT]:vk},nhe=({action:n})=>{if(!(!n||!QP[n.action]))return ke.jsxs("div",{className:Ct["user-action-indicator-container"],children:[ke.jsx("div",{className:Ct["user-action-indicator"],children:ke.jsx(Ru,{icon:QP[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]})},Zz=({player:n,videoState:e,setRecentUserAction:t,className:r=""})=>{const[i,o]=_t.useState(n.controls.GetCurrentTime()),[l,c]=_t.useState(0),[p,h]=_t.useState(void 0),[m,w]=_t.useState(n.controls.IsDVREnabled());return _t.useEffect(()=>{h(Uz(n,t));const b=yk({player:n,setCurrentTime:o,rate:60}),g=bpe({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"]})]})},rhe=({player:n,videoState:e})=>ke.jsxs("div",{className:Ct["volume-controls"],children:[ke.jsx(Lu,{"aria-label":e.muted?"Unmute":"Mute",icon:e.muted||e.volume===0?mk:e.volume<.4?Yz:e.volume<.8?Fpe:d2,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:Zde(n),className:Ct["volume-input"]})]})]}),Xz=({player:n,Hide:e,className:t=""})=>{const[r,i]=_t.useState(void 0),[o,l]=_t.useState(void 0),c=_t.createRef();if(_t.useEffect(()=>{const w=()=>l(n.controls.GetOptions());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),_t.useEffect(()=>{if(!c||!c.current)return;const w=dS({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"&&(bk(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:Bpe},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(Ru,{icon:qpe,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,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(Ru,{icon:rh,className:Ct["menu-option-icon"]})]})]},"menu"),ke.jsx("div",{ref:c,children:m})},ej=({player:n})=>{const[e,t]=_t.useState(n.dvrEnabled);return _t.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"]})]})},ahe=({label:n,value:e,className:t=""})=>{const[r,i]=_t.useState(!1);return ke.jsx("button",{onClick:()=>{r||(bk(e),i(!0),setTimeout(()=>i(!1),100))},dangerouslySetInnerHTML:{__html:Wpe},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(ahe,{label:n,value:e,className:Ct["verification-menu__detail-copy"]}):null]}):null,tj=({player:n,Hide:e,className:t=""})=>{const r=_t.createRef(),[i,o]=_t.useState(),[l,c]=_t.useState(!1),[p,h]=_t.useState(!1);if(_t.useEffect(()=>{n.__LoadVerificationDetails().then(()=>h(!0));const w=()=>o(n.controls.GetContentVerificationDetails());w();const b=n.controls.RegisterSettingsListener(w);return()=>b&&b()},[]),_t.useEffect(()=>{if(!r||!r.current)return;const w=dS({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:p2},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:JP},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(Nb,{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:p2},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:JP},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:rh}})]})})]})]}),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")})},ihe=({player:n,Hide:e,className:t=""})=>{const r=_t.createRef(),[i,o]=_t.useState(void 0);if(_t.useEffect(()=>{const c=()=>o(n.controls.GetCollectionInfo());c();const p=n.controls.RegisterSettingsListener(c);return()=>p&&p()},[]),_t.useEffect(()=>{if(!r||!r.current)return;const c=dS({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")},Lu=({icon:n,className:e="",...t})=>ke.jsx("button",{...t,className:`${zn["icon-button"]} ${e}`,dangerouslySetInnerHTML:{__html:n}}),she=({player:n,videoState:e})=>{const[t,r]=_t.useState(n.video.currentTime);return _t.useEffect(()=>{const i=yk({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(ej,{player:n}),n.isLive&&!n.behindLiveEdge?null:`${l2(t,e.duration)} / `,n.isLive&&!n.dvrEnabled?null:l2(e.duration,e.duration)]})},ohe=({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(Lu,{"aria-label":`Play Previous: ${t.title}`,disabled:!i,icon:gk,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(Lu,{"aria-label":`Play Next: ${r.title}`,disabled:!i,icon:vk,onClick:()=>n.controls.CollectionPlayNext()}),ke.jsx("div",{className:zn["collection-button-text"],children:r.title})]},`media-next-${e.mediaIndex}`):null]})},nj=({label:n,icon:e,player:t,MenuComponent:r,className:i=""})=>{const[o,l]=_t.useState(!1);return ke.jsxs("div",{className:[zn["menu-control-container"],i].join(" "),children:[ke.jsx(Lu,{"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]})},lhe=({player:n})=>{const[e,t]=_t.useState(void 0),{title:r,subtitle:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return _t.useEffect(()=>{t(void 0),l&&pk({player:n,pathOrUrl:l,width:200}).then(p=>t(p))},[l]),!r||n.playerOptions.title===Dt.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()||n.playerOptions.title===Dt.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]})]})},uhe=({player:n})=>{const[e,t]=_t.useState(!1);return _t.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(nj,{label:"Content Verification Menu",icon:p2,player:n,MenuComponent:tj,className:zn["content-verification-menu-button"]})]}):null},che=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=_t.useState(void 0),[p,h]=_t.useState(void 0),[m,w]=_t.useState(n.controls.IsMenuVisible());if(_t.useEffect(()=>{if(!n.controls)return;h(Dz({player:n,setRecentUserAction:i}));const A=()=>n&&n.controls&&w(n.controls.IsMenuVisible()),k=n.controls.RegisterSettingsListener(A),R=$z({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===Dt.controls.AUTO_HIDE;return n.__SetControlsVisibility(!S),ke.jsxs("div",{onClick:p,className:[o,zn.container,g?"":zn.autohide,n.playerOptions.controls!==Dt.controls.DEFAULT?"":zn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(lhe,{player:n},`content-info-${b&&b.mediaIndex}`),[Dt.controls.DEFAULT,Dt.controls.OFF,Dt.controls.OFF_WITH_VOLUME_TOGGLE].includes(n.playerOptions.controls)?null:ke.jsxs(ke.Fragment,{children:[ke.jsx(Lu,{"aria-label":"Play",tabIndex:e?-1:0,icon:Vz,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(Zz,{player:n,videoState:l,setRecentUserAction:i,className:zn.seek}),ke.jsxs("div",{className:zn.controls,children:[ke.jsx(Lu,{"aria-label":l.playing?"Pause":"Play",icon:l.playing?Kz:Wz,onClick:()=>n.controls.TogglePlay(),className:zn["play-pause-button"]}),ke.jsx(ohe,{player:n}),ke.jsx(rhe,{player:n,videoState:l}),ke.jsx(she,{player:n,videoState:l}),ke.jsx("div",{className:zn.spacer}),ke.jsx(uhe,{player:n}),n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.airplayAvailable?ke.jsx(Lu,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Jz}):null,n.controls.IsRotatable()?ke.jsx(Lu,{"aria-label":"Rotate Video",icon:Gpe,onClick:()=>n.controls.SetAllowRotation(!n.controls.AllowRotation()),className:zn["right-control-button"]}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(nj,{label:"Settings Menu",icon:Upe,player:n,MenuComponent:Xz}):null,ke.jsx(Lu,{"aria-label":l.fullscreen?"Exit Fullscreen":"Fullscreen",icon:l.fullscreen?Dpe:Ipe,onClick:()=>n.controls.ToggleFullscreen(),className:zn["right-control-button"]})]})]})]}),n.playerOptions.controls!==Dt.controls.OFF_WITH_VOLUME_TOGGLE?null:ke.jsx("div",{className:zn["floating-volume-toggle"],children:ke.jsx(Lu,{"aria-label":l.muted?"Unmute":"Mute",icon:l.muted||l.volume===0?mk:d2,onClick:()=>n.controls.ToggleMuted(),className:zn["volume-button"]},"mute-button")}),n.playerOptions.watermark===Dt.watermark.OFF?null:ke.jsx("div",{className:zn.watermark,children:ke.jsx("img",{src:Qz,alt:"Eluvio"})})]})},fhe="_spinner_1c6ar_17",dhe="_text_1c6ar_33",phe="_title_1c6ar_39",hhe="_description_1c6ar_43",yhe="_inputs_1c6ar_47",mhe="_input_1c6ar_47",ghe="_submit_1c6ar_77",wi={"ticket-form-container":"_ticket-form-container_1c6ar_1","ticket-form-overlay":"_ticket-form-overlay_1c6ar_8",spinner:fhe,"ticket-form":"_ticket-form_1c6ar_1",text:dhe,title:phe,description:hhe,inputs:yhe,input:mhe,submit:ghe,"error-message":"_error-message_1c6ar_88","size-md":"_size-md_1c6ar_102","size-sm":"_size-sm_1c6ar_103"},vhe=({parameters:n,dimensions:e,onComplete:t})=>{let{tenantId:r,ntpId:i,ticketCode:o,ticketSubject:l}=n.clientOptions||{};const c=!r||!i,[p,h]=_t.useState(o||""),[m,w]=_t.useState(!!o),[b,g]=_t.useState(!1),[S,A]=_t.useState(c?"Error: Tenant ID or NTP ID not specified":""),[k,R]=_t.useState(void 0),N=async({client:I,code:$})=>{if(!(!$||!I)){A(""),g(!0);try{let V=l;$.includes(":")&&(V=$.split(":")[0],$=$.split(":")[1]),await I.RedeemCode({tenantId:r,ntpId:i,code:$.trim(),email:V}),t(I)}catch(V){console.log(V),A("Invalid Code"),w(!1)}finally{g(!1)}}};return _t.useEffect(()=>{Promise.resolve().then(()=>Iz).then(async({ElvClient:I})=>{const $=await I.FromConfigurationUrl({configUrl:n.clientOptions.network});R($),o&&N({client:$,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(Nb,{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(),N({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"&&N({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(Nb,{light:!0}):"Submit"})]}),ke.jsxs("div",{className:wi["error-message"],children:[S," "]})]})})})},bhe="_container_m8dfx_1",whe="_autohide_m8dfx_34",_he="_fadein_m8dfx_1",xhe="_title_m8dfx_134",She="_spacer_m8dfx_319",Che="_watermark_m8dfx_323",Ehe="_menu_m8dfx_145",dn={container:bhe,"container--default-controls":"_container--default-controls_m8dfx_29",autohide:whe,"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:_he,"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:xhe,"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:She,watermark:Che,menu:Ehe},Ad=({icon:n,...e})=>ke.jsx("button",{...e,className:`${dn["icon-button"]} ${e.className||""}`,dangerouslySetInnerHTML:{__html:n}}),Ahe=({player:n,videoState:e})=>{const[t,r]=_t.useState(n.video.currentTime);return _t.useEffect(()=>{const i=yk({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:l2(t,e.duration)}),ke.jsx("div",{className:dn.spacer}),ke.jsx("div",{className:dn.time,children:l2(e.duration,e.duration)})]})},khe=({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(Ad,{disabled:!o||!r,icon:gk,onClick:()=>n.controls.CollectionPlayPrevious(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Ad,{"aria-label":"Back 10 Seconds",icon:zpe,onClick:()=>n.controls.Seek({relativeSeconds:-10}),className:dn["icon-button--drop-shadow-focus"]}),ke.jsx(Ad,{"aria-label":e.playing?"Pause":"Play",icon:e.playing?Kz:Wz,onClick:()=>n.controls.TogglePlay(),className:`${dn["play-pause-button"]} ${dn["icon-button--drop-shadow-focus"]}`}),ke.jsx(Ad,{"aria-label":"Forward 10 Seconds",icon:jpe,onClick:()=>n.controls.Seek({relativeSeconds:10}),className:dn["icon-button--drop-shadow-focus"]}),!r&&!i?null:ke.jsx(Ad,{disabled:!o||!i,icon:vk,onClick:()=>n.controls.CollectionPlayNext(),className:`${dn["track-button"]} ${dn["icon-button--drop-shadow-focus"]}`})]})},q4=({label:n,icon:e,children:t,player:r,MenuComponent:i})=>{const[o,l]=_t.useState(!1);return ke.jsxs("div",{className:dn["menu-control-container"],children:[e?ke.jsx(Ad,{"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]})},Mhe=({player:n,Hide:e})=>{const[t,r]=_t.useState(void 0),{title:i,description:o,image:l,headers:c}=n.controls.GetContentInfo()||{};return _t.useEffect(()=>{r(void 0),l&&pk({player:n,pathOrUrl:l,width:200}).then(p=>r(p))},[l]),_t.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(Ru,{icon:Gz}),"From Beginning"]})})]})]})},The=({player:n})=>{const[e,t]=_t.useState(!1);return _t.useEffect(()=>{const r=()=>t(n.controls.ContentVerified());r(),n.controls.RegisterSettingsListener(r)},[]),e?ke.jsx(q4,{label:"Content Verification Menu",icon:p2,player:n,MenuComponent:tj,className:dn["content-verification-menu-button"],children:"Verified"}):null},Rhe=({player:n,playbackStarted:e,canPlay:t,recentlyInteracted:r,setRecentUserAction:i,className:o=""})=>{const[l,c]=_t.useState(void 0),[p,h]=_t.useState(void 0),[m,w]=_t.useState(!1);if(_t.useEffect(()=>{h(Dz({player:n,setRecentUserAction:i}));const k=$z({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===Dt.controls.AUTO_HIDE;return n.__SetControlsVisibility(!A),ke.jsxs("div",{onClick:p,className:[o,dn.container,S?"":dn.autohide,n.playerOptions.controls!==Dt.controls.DEFAULT?"":dn["container--default-controls"],n.controls.IsMenuVisible()?"menu-active":""].join(" "),children:[ke.jsx(Ad,{"aria-label":"Play",tabIndex:e?-1:0,icon:Vz,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(Mhe,{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===Dt.title.OFF||n.playerOptions.title===Dt.title.FULLSCREEN_ONLY&&!n.controls.IsFullscreen()?"":b||""}),ke.jsx("div",{className:dn.spacer}),n.isLive?n.controls.IsDVRAvailable()?ke.jsx(ej,{player:n}):ke.jsx("div",{className:dn["live-indicator"],children:"Live"}):null,g?ke.jsx(q4,{label:"Collection Menu",icon:Hpe,player:n,MenuComponent:ihe}):null]}),ke.jsx(Zz,{player:n,videoState:l,setRecentUserAction:i}),ke.jsx(Ahe,{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===Dt.title.OFF?null:ke.jsx("button",{className:dn["text-button"],onClick:()=>w(!0),children:"Info"})}),ke.jsx(khe,{player:n,videoState:l}),ke.jsxs("div",{className:dn["bottom-right-controls"],children:[ke.jsx(The,{player:n}),n.airplayAvailable?ke.jsx(Ad,{"aria-label":"Airplay",onClick:()=>n.video.webkitShowPlaybackTargetPicker(),icon:Jz}):null,n.chromecastAvailable?ke.jsx("google-cast-launcher",{}):null,n.controls.GetOptions().hasAnyOptions?ke.jsx(q4,{label:"Settings",player:n,MenuComponent:Xz,children:"Settings"},"settings-button"):null]})]})]}),n.playerOptions.watermark===Dt.watermark.OFF?null:ke.jsx("div",{className:dn.watermark,children:ke.jsx("img",{src:Qz,alt:"Eluvio"})})]},"controls")},Ohe="_container_1l7ln_1",Lhe="_overlay_1l7ln_9",Nhe="_fadein_1l7ln_1",Phe="_form_1l7ln_22",Ihe="_header_1l7ln_39",Dhe="_input_1l7ln_45",Uhe="_actions_1l7ln_92",Fhe="_submit_1l7ln_98",Bhe="_cancel_1l7ln_99",fo={container:Ohe,overlay:Lhe,fadein:Nhe,form:Phe,header:Ihe,"input-container":"_input-container_1l7ln_45",input:Dhe,"input--invalid":"_input--invalid_1l7ln_65","player-info":"_player-info_1l7ln_74","api-link":"_api-link_1l7ln_83",actions:Uhe,submit:Fhe,cancel:Bhe},zhe=({player:n,Close:e})=>{const[t,r]=_t.useState(),[i,o]=_t.useState(!1),[l,c]=_t.useState(""),p=_t.useRef();_t.useEffect(()=>{if(!p||!p.current)return;const m=dS({element:p.current,Hide:e});return()=>m&&m()},[p]),_t.useEffect(()=>{let m={...n.hlsOptions||{}};delete m.drmSystems,delete m.emeEnabled,r(JSON.stringify(m,null,2))},[]);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(Nb,{light:!0}):"Submit"})]})]})})})},jhe=({player:n})=>{const[e,t]=_t.useState(void 0),{posterImage:r}=n.controls.GetContentInfo()||{};return _t.useEffect(()=>{t(void 0),r&&pk({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 Hhe;const qhe=({target:n,parameters:e,InitCallback:t,ErrorCallback:r,Unmount:i,Reset:o,SetAdditionalParameters:l})=>{const[c,p]=_t.useState(void 0),[h,m]=_t.useState(void 0),[w,b]=_t.useState("lg"),[g,S]=_t.useState("landscape"),[A,k]=_t.useState({width:n.getBoundingClientRect().width,height:n.getBoundingClientRect().height}),[R,N]=_t.useState(void 0),[I,$]=_t.useState(!1),[V,de]=_t.useState(!1),[oe,he]=_t.useState(!1),[xe,Ce]=_t.useState(!1),[ne,Le]=_t.useState(!1),[C,x]=_t.useState(!0),[O,j]=_t.useState(void 0),[F,H]=_t.useState(void 0),[Q,ae]=_t.useState(!1),L=_t.useRef(),T=!!c,Y=({action:B,text:be})=>j({action:B,text:be,key:Math.random()});if(_t.useEffect(()=>{Ce(!0);const B=wpe({target:n,setSize:b,setOrientation:S,setDimensions:k});return()=>{Ce(!1),B&&B()}},[]),_t.useEffect(()=>{if(!(!L||!L.current||!xe))try{$(!1),de(!1),e.clientOptions.client=h||e.clientOptions.client;const B=new u2({target:n,video:L.current,parameters:e,SetErrorMessage:N,Reload:o,UpdateParameters:pe=>{l(pe)}});window.__elvPlayer=B;const be=B.controls.RegisterSettingsListener(()=>{H(B.controls.AllowRotation()),de(B.playbackStarted),$(!B.loading),Le(B.__showPlayerProfileForm),ae(B&&B.casting)});B.Destroy=()=>{B.__DestroyPlayer(),i()},B.Reset=()=>{o()};const Ie=_pe({player:B}),Me=xpe({player:B,inactivityPeriod:5e3,onWake:()=>x(!0),onSleep:()=>x(!1)}),De=Spe({player:B,setRecentUserAction:Y}),se=Cpe({player:B});t(B),p(B);const ue=B.controls.RegisterVideoEventListener("canplay",()=>he(!0));return()=>{L&&L.current&&L.current.removeEventListener("play",de),be&&be(),Ie&&Ie(),Me&&Me(),De&&De(),se&&se(),ue&&ue(),B&&B.__DestroyPlayer()}}catch(B){r(B),i()}},[L,xe,h]),_t.useEffect(()=>{if(T)return()=>{c&&c.__DestroyPlayer(),p(void 0)}},[T]),_t.useEffect(()=>{O&&(clearTimeout(Hhe),setTimeout(()=>{j(void 0)},1e3))},[O]),e.clientOptions.promptTicket&&!h)return ke.jsx(vhe,{parameters:e,dimensions:{size:w,orientation:g,...A},onComplete:B=>m(B)});const ie=e.playerOptions.ui===Dt.ui.WEB&&c&&c.controls.IsRotatable()&&F;return ke.jsxs("div",{role:"complementary","aria-label":"Eluvio Video Player",tabIndex:0,style:{backgroundColor:e.playerOptions.backgroundColor||"transparent","--portal-width":`${ie?A.height:A.width}px`,"--portal-height":`${ie?A.width:A.height}px`},className:[Ys["player-container"],ie?Ys["player-container--rotated"]:"",`__eluvio-player--size-${w}`,`__eluvio-player--orientation-${g}`].join(" "),children:[!ne||!I?null:ke.jsx(zhe,{player:c,Close:()=>c.controls.HidePlayerProfileForm()}),ke.jsx("video",{playsInline:!0,disablePictureInPicture:!0,ref:L,muted:[Dt.muted.ON,Dt.muted.WHEN_NOT_VISIBLE].includes(e.playerOptions.muted),controls:e.playerOptions.controls===Dt.controls.DEFAULT,loop:e.playerOptions.loop===Dt.loop.ON,crossOrigin:"anonymous",className:Ys.video}),!c||!oe||V&&!e.playerOptions.permanentPoster?null:ke.jsx(jhe,{player:c}),I||R||!e.playerOptions.showLoader?null:ke.jsx("div",{className:Ys["spinner-container"],children:ke.jsx(Nb,{className:Ys.spinner})}),Q?ke.jsx("div",{className:Ys["cast-indicator-container"],children:ke.jsx("div",{dangerouslySetInnerHTML:{__html:Kpe}})}):null,R?ke.jsxs("div",{className:Ys["error-message"],children:[ke.jsx("div",{className:Ys["error-message__message"],children:R}),ke.jsxs("button",{className:Ys["error-message__copy-debug-button"],onClick:()=>bk(JSON.stringify(c.controls.GetDebugInfo(),null,2)),children:[ke.jsx(Ru,{icon:Ype,className:Ys["error-message__icon"]}),"Copy Troubleshooting Info"]})]}):null,c?e.playerOptions.ui===Dt.ui.WEB?ke.jsx(che,{player:c,playbackStarted:!!V,canPlay:oe,recentlyInteracted:C,setRecentUserAction:Y,className:Ys.controls}):ke.jsx(Rhe,{player:c,playbackStarted:!!V,canPlay:oe,recentlyInteracted:C,setRecentUserAction:Y,className:Ys.controls}):null,O?ke.jsx(nhe,{action:O},`action-indicator-${O&&O.key}`):null]})},$he=({parameters:n,...e})=>{const[t,r]=_t.useState(Math.random()),[i,o]=_t.useState();return _t.createElement(qhe,{...e,SetAdditionalParameters:o,parameters:i?hk(n,i):n,key:`player-${t}`,Reset:()=>r(Math.random())})},Vhe=(n,e)=>(n.innerHTML="",n.classList.add(ZG.reset),n.classList.add(Ys["player-target"]),e=Fz(e),e.playerOptions&&e.playerOptions.backgroundColor&&(n.style.backgroundColor=e.playerOptions.backgroundColor),new Promise((t,r)=>{const i=Wv.createRoot(n);i.render(ke.jsx(KG.StrictMode,{children:ke.jsx($he,{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=Vhe;exports.PlayerParameters=Dt;exports.commonjsGlobal=Fa;exports.crypto=aI;exports.eventsExports=Kb;exports.getDefaultExportFromCjs=Bd;exports.inherits_browserExports=KI;exports.require$$3=y2;exports.requireBuffer=Pb;exports.string_decoder=G5;
|