petdex 0.3.0 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/petdex.js +80 -81
  2. package/package.json +1 -1
package/dist/petdex.js CHANGED
@@ -1,85 +1,85 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as qY}from"node:module";var aJ=Object.create;var{getPrototypeOf:sJ,defineProperty:mQ,getOwnPropertyNames:tJ}=Object;var eJ=Object.prototype.hasOwnProperty;function $Y($){return this[$]}var QY,VY,C1=($,Q,V)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?QY??=new WeakMap:VY??=new WeakMap,X=Y.get($);if(X)return X}V=$!=null?aJ(sJ($)):{};let J=Q||!$||!$.__esModule?mQ(V,"default",{value:$,enumerable:!0}):V;for(let G of tJ($))if(!eJ.call(J,G))mQ(J,G,{get:$Y.bind($,G),enumerable:!0});if(q)Y.set($,J);return J};var w=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var i=qY(import.meta.url);var N8=w((YH,cQ)=>{var O8={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let V="";if($<0)V+=`\x1B[${-$}D`;else if($>0)V+=`\x1B[${$}C`;if(Q<0)V+=`\x1B[${-Q}A`;else if(Q>0)V+=`\x1B[${Q}B`;return V},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},JY={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},YY={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Q="";for(let V=0;V<$;V++)Q+=this.line+(V<$-1?O8.up():"");if($)Q+=O8.left;return Q}};cQ.exports={cursor:O8,scroll:JY,erase:YY,beep:"\x07"}});var f1=w((XH,B8)=>{var Y6=process||{},pQ=Y6.argv||[],J6=Y6.env||{},XY=!(!!J6.NO_COLOR||pQ.includes("--no-color"))&&(!!J6.FORCE_COLOR||pQ.includes("--color")||Y6.platform==="win32"||(Y6.stdout||{}).isTTY&&J6.TERM!=="dumb"||!!J6.CI),GY=($,Q,V=$)=>(q)=>{let Y=""+q,X=Y.indexOf(Q,$.length);return~X?$+KY(Y,Q,V,X)+Q:$+Y+Q},KY=($,Q,V,q)=>{let Y="",X=0;do Y+=$.substring(X,q)+V,X=q+Q.length,q=$.indexOf(Q,X);while(~q);return Y+$.substring(X)},uQ=($=XY)=>{let Q=$?GY:()=>String;return{isColorSupported:$,reset:Q("\x1B[0m","\x1B[0m"),bold:Q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Q("\x1B[3m","\x1B[23m"),underline:Q("\x1B[4m","\x1B[24m"),inverse:Q("\x1B[7m","\x1B[27m"),hidden:Q("\x1B[8m","\x1B[28m"),strikethrough:Q("\x1B[9m","\x1B[29m"),black:Q("\x1B[30m","\x1B[39m"),red:Q("\x1B[31m","\x1B[39m"),green:Q("\x1B[32m","\x1B[39m"),yellow:Q("\x1B[33m","\x1B[39m"),blue:Q("\x1B[34m","\x1B[39m"),magenta:Q("\x1B[35m","\x1B[39m"),cyan:Q("\x1B[36m","\x1B[39m"),white:Q("\x1B[37m","\x1B[39m"),gray:Q("\x1B[90m","\x1B[39m"),bgBlack:Q("\x1B[40m","\x1B[49m"),bgRed:Q("\x1B[41m","\x1B[49m"),bgGreen:Q("\x1B[42m","\x1B[49m"),bgYellow:Q("\x1B[43m","\x1B[49m"),bgBlue:Q("\x1B[44m","\x1B[49m"),bgMagenta:Q("\x1B[45m","\x1B[49m"),bgCyan:Q("\x1B[46m","\x1B[49m"),bgWhite:Q("\x1B[47m","\x1B[49m"),blackBright:Q("\x1B[90m","\x1B[39m"),redBright:Q("\x1B[91m","\x1B[39m"),greenBright:Q("\x1B[92m","\x1B[39m"),yellowBright:Q("\x1B[93m","\x1B[39m"),blueBright:Q("\x1B[94m","\x1B[39m"),magentaBright:Q("\x1B[95m","\x1B[39m"),cyanBright:Q("\x1B[96m","\x1B[39m"),whiteBright:Q("\x1B[97m","\x1B[39m"),bgBlackBright:Q("\x1B[100m","\x1B[49m"),bgRedBright:Q("\x1B[101m","\x1B[49m"),bgGreenBright:Q("\x1B[102m","\x1B[49m"),bgYellowBright:Q("\x1B[103m","\x1B[49m"),bgBlueBright:Q("\x1B[104m","\x1B[49m"),bgMagentaBright:Q("\x1B[105m","\x1B[49m"),bgCyanBright:Q("\x1B[106m","\x1B[49m"),bgWhiteBright:Q("\x1B[107m","\x1B[49m")}};B8.exports=uQ();B8.exports.createColors=uQ});var K$=w((wH,D8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)D8.exports={nextTick:iY};else D8.exports=process;function iY($,Q,V,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,X,J;switch(Y){case 0:case 1:return process.nextTick($);case 2:return process.nextTick(function(){$.call(null,Q)});case 3:return process.nextTick(function(){$.call(null,Q,V)});case 4:return process.nextTick(function(){$.call(null,Q,V,q)});default:X=Array(Y-1),J=0;while(J<X.length)X[J++]=arguments[J];return process.nextTick(function(){$.apply(null,X)})}}});var PV=w((TH,zV)=>{var nY={}.toString;zV.exports=Array.isArray||function($){return nY.call($)=="[object Array]"}});var W$=w((h8,IV)=>{var Z6=i("buffer"),c1=Z6.Buffer;function LV($,Q){for(var V in $)Q[V]=$[V]}if(c1.from&&c1.alloc&&c1.allocUnsafe&&c1.allocUnsafeSlow)IV.exports=Z6;else LV(Z6,h8),h8.Buffer=x0;function x0($,Q,V){return c1($,Q,V)}LV(c1,x0);x0.from=function($,Q,V){if(typeof $==="number")throw TypeError("Argument must not be a number");return c1($,Q,V)};x0.alloc=function($,Q,V){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=c1($);if(Q!==void 0)if(typeof V==="string")q.fill(Q,V);else q.fill(Q);else q.fill(0);return q};x0.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return c1($)};x0.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return Z6.SlowBuffer($)}});var S0=w((W4)=>{function rY($){if(Array.isArray)return Array.isArray($);return H6($)==="[object Array]"}W4.isArray=rY;function aY($){return typeof $==="boolean"}W4.isBoolean=aY;function sY($){return $===null}W4.isNull=sY;function tY($){return $==null}W4.isNullOrUndefined=tY;function eY($){return typeof $==="number"}W4.isNumber=eY;function $4($){return typeof $==="string"}W4.isString=$4;function Q4($){return typeof $==="symbol"}W4.isSymbol=Q4;function V4($){return $===void 0}W4.isUndefined=V4;function q4($){return H6($)==="[object RegExp]"}W4.isRegExp=q4;function J4($){return typeof $==="object"&&$!==null}W4.isObject=J4;function Y4($){return H6($)==="[object Date]"}W4.isDate=Y4;function X4($){return H6($)==="[object Error]"||$ instanceof Error}W4.isError=X4;function G4($){return typeof $==="function"}W4.isFunction=G4;function K4($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}W4.isPrimitive=K4;W4.isBuffer=i("buffer").Buffer.isBuffer;function H6($){return Object.prototype.toString.call($)}});var OV=w((RH,b8)=>{if(typeof Object.create==="function")b8.exports=function(Q,V){if(V)Q.super_=V,Q.prototype=Object.create(V.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else b8.exports=function(Q,V){if(V){Q.super_=V;var q=function(){};q.prototype=V.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var E0=w((FH,_8)=>{try{if(z6=i("util"),typeof z6.inherits!=="function")throw"";_8.exports=z6.inherits}catch($){_8.exports=OV()}var z6});var BV=w((vH,f8)=>{function A4($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var NV=W$().Buffer,U$=i("util");function R4($,Q,V){$.copy(Q,V)}f8.exports=function(){function $(){A4(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(V){var q={data:V,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(V){var q={data:V,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var V=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,V},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(V){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=V+q.data;return Y},$.prototype.concat=function(V){if(this.length===0)return NV.alloc(0);var q=NV.allocUnsafe(V>>>0),Y=this.head,X=0;while(Y)R4(Y.data,q,X),X+=Y.data.length,Y=Y.next;return q},$}();if(U$&&U$.inspect&&U$.inspect.custom)f8.exports.prototype[U$.inspect.custom]=function(){var $=U$.inspect({length:this.length});return this.constructor.name+" "+$}});var m8=w((xH,MV)=>{var P6=K$();function F4($,Q){var V=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)P6.nextTick(L6,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,P6.nextTick(L6,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(X){if(!Q&&X){if(!V._writableState)P6.nextTick(L6,V,X);else if(!V._writableState.errorEmitted)V._writableState.errorEmitted=!0,P6.nextTick(L6,V,X)}else if(Q)Q(X)}),this}function v4(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function L6($,Q){$.emit("error",Q)}MV.exports={destroy:F4,undestroy:v4}});var wV=w((SH,CV)=>{CV.exports=i("util").deprecate});var p8=w((EH,EV)=>{var U0=K$();EV.exports=l;function AV($){var Q=this;this.next=null,this.entry=null,this.finish=function(){o4(Q,$)}}var x4=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:U0.nextTick,g0;l.WritableState=Z$;var RV=Object.create(S0());RV.inherits=E0();var S4={deprecate:wV()},FV=i("stream"),O6=W$().Buffer,E4=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function g4($){return O6.from($)}function k4($){return O6.isBuffer($)||$ instanceof E4}var vV=m8();RV.inherits(l,FV);function y4(){}function Z$($,Q){g0=g0||j0(),$=$||{};var V=Q instanceof g0;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=$.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){c4(Q,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new AV(this)}Z$.prototype.getBuffer=function(){var Q=this.bufferedRequest,V=[];while(Q)V.push(Q),Q=Q.next;return V};(function(){try{Object.defineProperty(Z$.prototype,"buffer",{get:S4.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var I6;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")I6=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function($){if(I6.call(this,$))return!0;if(this!==l)return!1;return $&&$._writableState instanceof Z$}});else I6=function($){return $ instanceof this};function l($){if(g0=g0||j0(),!I6.call(l,this)&&!(this instanceof g0))return new l($);if(this._writableState=new Z$($,this),this.writable=!0,$){if(typeof $.write==="function")this._write=$.write;if(typeof $.writev==="function")this._writev=$.writev;if(typeof $.destroy==="function")this._destroy=$.destroy;if(typeof $.final==="function")this._final=$.final}FV.call(this)}l.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function D4($,Q){var V=Error("write after end");$.emit("error",V),U0.nextTick(Q,V)}function h4($,Q,V,q){var Y=!0,X=!1;if(V===null)X=TypeError("May not write null values to stream");else if(typeof V!=="string"&&V!==void 0&&!Q.objectMode)X=TypeError("Invalid non-string/buffer chunk");if(X)$.emit("error",X),U0.nextTick(q,X),Y=!1;return Y}l.prototype.write=function($,Q,V){var q=this._writableState,Y=!1,X=!q.objectMode&&k4($);if(X&&!O6.isBuffer($))$=g4($);if(typeof Q==="function")V=Q,Q=null;if(X)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof V!=="function")V=y4;if(q.ended)D4(this,V);else if(X||h4(this,q,$,V))q.pendingcb++,Y=_4(this,q,X,$,Q,V);return Y};l.prototype.cork=function(){var $=this._writableState;$.corked++};l.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)xV(this,$)}};l.prototype.setDefaultEncoding=function(Q){if(typeof Q==="string")Q=Q.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Q+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+Q);return this._writableState.defaultEncoding=Q,this};function b4($,Q,V){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=O6.from(Q,V);return Q}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function _4($,Q,V,q,Y,X){if(!V){var J=b4(Q,q,Y);if(q!==J)V=!0,Y="buffer",q=J}var G=Q.objectMode?1:q.length;Q.length+=G;var U=Q.length<Q.highWaterMark;if(!U)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:q,encoding:Y,isBuf:V,callback:X,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else c8($,Q,!1,G,q,Y,X);return U}function c8($,Q,V,q,Y,X,J){if(Q.writelen=q,Q.writecb=J,Q.writing=!0,Q.sync=!0,V)$._writev(Y,Q.onwrite);else $._write(Y,X,Q.onwrite);Q.sync=!1}function f4($,Q,V,q,Y){if(--Q.pendingcb,V)U0.nextTick(Y,q),U0.nextTick(j$,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),j$($,Q)}function m4($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function c4($,Q){var V=$._writableState,q=V.sync,Y=V.writecb;if(m4(V),Q)f4($,V,q,Q,Y);else{var X=SV(V);if(!X&&!V.corked&&!V.bufferProcessing&&V.bufferedRequest)xV($,V);if(q)x4(TV,$,V,X,Y);else TV($,V,X,Y)}}function TV($,Q,V,q){if(!V)p4($,Q);Q.pendingcb--,q(),j$($,Q)}function p4($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function xV($,Q){Q.bufferProcessing=!0;var V=Q.bufferedRequest;if($._writev&&V&&V.next){var q=Q.bufferedRequestCount,Y=Array(q),X=Q.corkedRequestsFree;X.entry=V;var J=0,G=!0;while(V){if(Y[J]=V,!V.isBuf)G=!1;V=V.next,J+=1}if(Y.allBuffers=G,c8($,Q,!0,Q.length,Y,"",X.finish),Q.pendingcb++,Q.lastBufferedRequest=null,X.next)Q.corkedRequestsFree=X.next,X.next=null;else Q.corkedRequestsFree=new AV(Q);Q.bufferedRequestCount=0}else{while(V){var{chunk:U,encoding:K,callback:W}=V,j=Q.objectMode?1:U.length;if(c8($,Q,!1,j,U,K,W),V=V.next,Q.bufferedRequestCount--,Q.writing)break}if(V===null)Q.lastBufferedRequest=null}Q.bufferedRequest=V,Q.bufferProcessing=!1}l.prototype._write=function($,Q,V){V(Error("_write() is not implemented"))};l.prototype._writev=null;l.prototype.end=function($,Q,V){var q=this._writableState;if(typeof $==="function")V=$,$=null,Q=null;else if(typeof Q==="function")V=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)l4(this,q,V)};function SV($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function u4($,Q){$._final(function(V){if(Q.pendingcb--,V)$.emit("error",V);Q.prefinished=!0,$.emit("prefinish"),j$($,Q)})}function d4($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,U0.nextTick(u4,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function j$($,Q){var V=SV(Q);if(V){if(d4($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return V}function l4($,Q,V){if(Q.ending=!0,j$($,Q),V)if(Q.finished)U0.nextTick(V);else $.once("finish",V);Q.ended=!0,$.writable=!1}function o4($,Q,V){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(V),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(l.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});l.prototype.destroy=vV.destroy;l.prototype._undestroy=vV.undestroy;l.prototype._destroy=function($,Q){this.end(),Q($)}});var j0=w((gH,DV)=>{var gV=K$(),i4=Object.keys||function($){var Q=[];for(var V in $)Q.push(V);return Q};DV.exports=p1;var kV=Object.create(S0());kV.inherits=E0();var yV=d8(),u8=p8();kV.inherits(p1,yV);{N6=i4(u8.prototype);for(H$=0;H$<N6.length;H$++)if(z$=N6[H$],!p1.prototype[z$])p1.prototype[z$]=u8.prototype[z$]}var N6,z$,H$;function p1($){if(!(this instanceof p1))return new p1($);if(yV.call(this,$),u8.call(this,$),$&&$.readable===!1)this.readable=!1;if($&&$.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,$&&$.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",n4)}Object.defineProperty(p1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function n4(){if(this.allowHalfOpen||this._writableState.ended)return;gV.nextTick(r4,this)}function r4($){$.end()}Object.defineProperty(p1.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function($){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=$,this._writableState.destroyed=$}});p1.prototype._destroy=function($,Q){this.push(null),this.end(),gV.nextTick(Q,$)}});var i8=w((WX)=>{var o8=W$().Buffer,hV=o8.isEncoding||function($){switch($=""+$,$&&$.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 a4($){if(!$)return"utf8";var Q;while(!0)switch($){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 $;default:if(Q)return;$=(""+$).toLowerCase(),Q=!0}}function s4($){var Q=a4($);if(typeof Q!=="string"&&(o8.isEncoding===hV||!hV($)))throw Error("Unknown encoding: "+$);return Q||$}WX.StringDecoder=P$;function P$($){this.encoding=s4($);var Q;switch(this.encoding){case"utf16le":this.text=qX,this.end=JX,Q=4;break;case"utf8":this.fillLast=$X,Q=4;break;case"base64":this.text=YX,this.end=XX,Q=3;break;default:this.write=GX,this.end=KX;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=o8.allocUnsafe(Q)}P$.prototype.write=function($){if($.length===0)return"";var Q,V;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";V=this.lastNeed,this.lastNeed=0}else V=0;if(V<$.length)return Q?Q+this.text($,V):this.text($,V);return Q||""};P$.prototype.end=VX;P$.prototype.text=QX;P$.prototype.fillLast=function($){if(this.lastNeed<=$.length)return $.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length),this.lastNeed-=$.length};function l8($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function t4($,Q,V){var q=Q.length-1;if(q<V)return 0;var Y=l8(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<V||Y===-2)return 0;if(Y=l8(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<V||Y===-2)return 0;if(Y=l8(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function e4($,Q,V){if((Q[0]&192)!==128)return $.lastNeed=0,"�";if($.lastNeed>1&&Q.length>1){if((Q[1]&192)!==128)return $.lastNeed=1,"�";if($.lastNeed>2&&Q.length>2){if((Q[2]&192)!==128)return $.lastNeed=2,"�"}}}function $X($){var Q=this.lastTotal-this.lastNeed,V=e4(this,$,Q);if(V!==void 0)return V;if(this.lastNeed<=$.length)return $.copy(this.lastChar,Q,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,Q,0,$.length),this.lastNeed-=$.length}function QX($,Q){var V=t4(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=V;var q=$.length-(V-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function VX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function qX($,Q){if(($.length-Q)%2===0){var V=$.toString("utf16le",Q);if(V){var q=V.charCodeAt(V.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],V.slice(0,-1)}return V}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function JX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var V=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,V)}return Q}function YX($,Q){var V=($.length-Q)%3;if(V===0)return $.toString("base64",Q);if(this.lastNeed=3-V,this.lastTotal=3,V===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-V)}function XX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function GX($){return $.toString(this.encoding)}function KX($){return $&&$.length?this.write($):""}});var d8=w((DH,nV)=>{var y0=K$();nV.exports=_;var jX=PV(),L$;_.ReadableState=uV;var yH=i("events").EventEmitter,mV=function($,Q){return $.listeners(Q).length},t8=i("stream"),I$=W$().Buffer,ZX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function HX($){return I$.from($)}function zX($){return I$.isBuffer($)||$ instanceof ZX}var cV=Object.create(S0());cV.inherits=E0();var n8=i("util"),k=void 0;if(n8&&n8.debuglog)k=n8.debuglog("stream");else k=function(){};var PX=BV(),pV=m8(),k0;cV.inherits(_,t8);var r8=["error","close","destroy","pause","resume"];function LX($,Q,V){if(typeof $.prependListener==="function")return $.prependListener(Q,V);if(!$._events||!$._events[Q])$.on(Q,V);else if(jX($._events[Q]))$._events[Q].unshift(V);else $._events[Q]=[V,$._events[Q]]}function uV($,Q){L$=L$||j0(),$=$||{};var V=Q instanceof L$;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new PX,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=$.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,$.encoding){if(!k0)k0=i8().StringDecoder;this.decoder=new k0($.encoding),this.encoding=$.encoding}}function _($){if(L$=L$||j0(),!(this instanceof _))return new _($);if(this._readableState=new uV($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}t8.call(this)}Object.defineProperty(_.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});_.prototype.destroy=pV.destroy;_.prototype._undestroy=pV.undestroy;_.prototype._destroy=function($,Q){this.push(null),Q($)};_.prototype.push=function($,Q){var V=this._readableState,q;if(!V.objectMode){if(typeof $==="string"){if(Q=Q||V.defaultEncoding,Q!==V.encoding)$=I$.from($,Q),Q="";q=!0}}else q=!0;return dV(this,$,Q,!1,q)};_.prototype.unshift=function($){return dV(this,$,null,!0,!1)};function dV($,Q,V,q,Y){var X=$._readableState;if(Q===null)X.reading=!1,BX($,X);else{var J;if(!Y)J=IX(X,Q);if(J)$.emit("error",J);else if(X.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!X.objectMode&&Object.getPrototypeOf(Q)!==I$.prototype)Q=HX(Q);if(q)if(X.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else a8($,X,Q,!0);else if(X.ended)$.emit("error",Error("stream.push() after EOF"));else if(X.reading=!1,X.decoder&&!V)if(Q=X.decoder.write(Q),X.objectMode||Q.length!==0)a8($,X,Q,!1);else lV($,X);else a8($,X,Q,!1)}else if(!q)X.reading=!1}return OX(X)}function a8($,Q,V,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",V),$.read(0);else{if(Q.length+=Q.objectMode?1:V.length,q)Q.buffer.unshift(V);else Q.buffer.push(V);if(Q.needReadable)B6($)}lV($,Q)}function IX($,Q){var V;if(!zX(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)V=TypeError("Invalid non-string/buffer chunk");return V}function OX($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}_.prototype.isPaused=function(){return this._readableState.flowing===!1};_.prototype.setEncoding=function($){if(!k0)k0=i8().StringDecoder;return this._readableState.decoder=new k0($),this._readableState.encoding=$,this};var bV=8388608;function NX($){if($>=bV)$=bV;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function _V($,Q){if($<=0||Q.length===0&&Q.ended)return 0;if(Q.objectMode)return 1;if($!==$)if(Q.flowing&&Q.length)return Q.buffer.head.data.length;else return Q.length;if($>Q.highWaterMark)Q.highWaterMark=NX($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}_.prototype.read=function($){k("read",$),$=parseInt($,10);var Q=this._readableState,V=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(k("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)s8(this);else B6(this);return null}if($=_V($,Q),$===0&&Q.ended){if(Q.length===0)s8(this);return null}var q=Q.needReadable;if(k("need readable",q),Q.length===0||Q.length-$<Q.highWaterMark)q=!0,k("length less than watermark",q);if(Q.ended||Q.reading)q=!1,k("reading or ended",q);else if(q){if(k("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=_V(V,Q)}var Y;if($>0)Y=oV($,Q);else Y=null;if(Y===null)Q.needReadable=!0,$=0;else Q.length-=$;if(Q.length===0){if(!Q.ended)Q.needReadable=!0;if(V!==$&&Q.ended)s8(this)}if(Y!==null)this.emit("data",Y);return Y};function BX($,Q){if(Q.ended)return;if(Q.decoder){var V=Q.decoder.end();if(V&&V.length)Q.buffer.push(V),Q.length+=Q.objectMode?1:V.length}Q.ended=!0,B6($)}function B6($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(k("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)y0.nextTick(fV,$);else fV($)}function fV($){k("emit readable"),$.emit("readable"),e8($)}function lV($,Q){if(!Q.readingMore)Q.readingMore=!0,y0.nextTick(MX,$,Q)}function MX($,Q){var V=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(k("maybeReadMore read 0"),$.read(0),V===Q.length)break;else V=Q.length;Q.readingMore=!1}_.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};_.prototype.pipe=function($,Q){var V=this,q=this._readableState;switch(q.pipesCount){case 0:q.pipes=$;break;case 1:q.pipes=[q.pipes,$];break;default:q.pipes.push($);break}q.pipesCount+=1,k("pipe count=%d opts=%j",q.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,X=Y?G:M;if(q.endEmitted)y0.nextTick(X);else V.once("end",X);$.on("unpipe",J);function J(B,L){if(k("onunpipe"),B===V){if(L&&L.hasUnpiped===!1)L.hasUnpiped=!0,W()}}function G(){k("onend"),$.end()}var U=CX(V);$.on("drain",U);var K=!1;function W(){if(k("cleanup"),$.removeListener("close",C),$.removeListener("finish",P),$.removeListener("drain",U),$.removeListener("error",z),$.removeListener("unpipe",J),V.removeListener("end",G),V.removeListener("end",M),V.removeListener("data",H),K=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var j=!1;V.on("data",H);function H(B){k("ondata"),j=!1;var L=$.write(B);if(L===!1&&!j){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&iV(q.pipes,$)!==-1)&&!K)k("false write response, pause",q.awaitDrain),q.awaitDrain++,j=!0;V.pause()}}function z(B){if(k("onerror",B),M(),$.removeListener("error",z),mV($,"error")===0)$.emit("error",B)}LX($,"error",z);function C(){$.removeListener("finish",P),M()}$.once("close",C);function P(){k("onfinish"),$.removeListener("close",C),M()}$.once("finish",P);function M(){k("unpipe"),V.unpipe($)}if($.emit("pipe",V),!q.flowing)k("pipe resume"),V.resume();return $};function CX($){return function(){var Q=$._readableState;if(k("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&mV($,"data"))Q.flowing=!0,e8($)}}_.prototype.unpipe=function($){var Q=this._readableState,V={hasUnpiped:!1};if(Q.pipesCount===0)return this;if(Q.pipesCount===1){if($&&$!==Q.pipes)return this;if(!$)$=Q.pipes;if(Q.pipes=null,Q.pipesCount=0,Q.flowing=!1,$)$.emit("unpipe",this,V);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var X=0;X<Y;X++)q[X].emit("unpipe",this,{hasUnpiped:!1});return this}var J=iV(Q.pipes,$);if(J===-1)return this;if(Q.pipes.splice(J,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,V),this};_.prototype.on=function($,Q){var V=t8.prototype.on.call(this,$,Q);if($==="data"){if(this._readableState.flowing!==!1)this.resume()}else if($==="readable"){var q=this._readableState;if(!q.endEmitted&&!q.readableListening){if(q.readableListening=q.needReadable=!0,q.emittedReadable=!1,!q.reading)y0.nextTick(wX,this);else if(q.length)B6(this)}}return V};_.prototype.addListener=_.prototype.on;function wX($){k("readable nexttick read 0"),$.read(0)}_.prototype.resume=function(){var $=this._readableState;if(!$.flowing)k("resume"),$.flowing=!0,TX(this,$);return this};function TX($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,y0.nextTick(AX,$,Q)}function AX($,Q){if(!Q.reading)k("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),e8($),Q.flowing&&!Q.reading)$.read(0)}_.prototype.pause=function(){if(k("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)k("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function e8($){var Q=$._readableState;k("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}_.prototype.wrap=function($){var Q=this,V=this._readableState,q=!1;$.on("end",function(){if(k("wrapped end"),V.decoder&&!V.ended){var J=V.decoder.end();if(J&&J.length)Q.push(J)}Q.push(null)}),$.on("data",function(J){if(k("wrapped data"),V.decoder)J=V.decoder.write(J);if(V.objectMode&&(J===null||J===void 0))return;else if(!V.objectMode&&(!J||!J.length))return;var G=Q.push(J);if(!G)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(J){return function(){return $[J].apply($,arguments)}}(Y);for(var X=0;X<r8.length;X++)$.on(r8[X],this.emit.bind(this,r8[X]));return this._read=function(J){if(k("wrapped _read",J),q)q=!1,$.resume()},this};Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_._fromList=oV;function oV($,Q){if(Q.length===0)return null;var V;if(Q.objectMode)V=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)V=Q.buffer.join("");else if(Q.buffer.length===1)V=Q.buffer.head.data;else V=Q.buffer.concat(Q.length);Q.buffer.clear()}else V=RX($,Q.buffer,Q.decoder);return V}function RX($,Q,V){var q;if($<Q.head.data.length)q=Q.head.data.slice(0,$),Q.head.data=Q.head.data.slice($);else if($===Q.head.data.length)q=Q.shift();else q=V?FX($,Q):vX($,Q);return q}function FX($,Q){var V=Q.head,q=1,Y=V.data;$-=Y.length;while(V=V.next){var X=V.data,J=$>X.length?X.length:$;if(J===X.length)Y+=X;else Y+=X.slice(0,$);if($-=J,$===0){if(J===X.length)if(++q,V.next)Q.head=V.next;else Q.head=Q.tail=null;else Q.head=V,V.data=X.slice(J);break}++q}return Q.length-=q,Y}function vX($,Q){var V=I$.allocUnsafe($),q=Q.head,Y=1;q.data.copy(V),$-=q.data.length;while(q=q.next){var X=q.data,J=$>X.length?X.length:$;if(X.copy(V,V.length-$,0,J),$-=J,$===0){if(J===X.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=X.slice(J);break}++Y}return Q.length-=Y,V}function s8($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,y0.nextTick(xX,Q,$)}function xX($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function iV($,Q){for(var V=0,q=$.length;V<q;V++)if($[V]===Q)return V;return-1}});var $5=w((hH,sV)=>{sV.exports=u1;var M6=j0(),aV=Object.create(S0());aV.inherits=E0();aV.inherits(u1,M6);function SX($,Q){var V=this._transformState;V.transforming=!1;var q=V.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(V.writechunk=null,V.writecb=null,Q!=null)this.push(Q);q($);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function u1($){if(!(this instanceof u1))return new u1($);if(M6.call(this,$),this._transformState={afterTransform:SX.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,$){if(typeof $.transform==="function")this._transform=$.transform;if(typeof $.flush==="function")this._flush=$.flush}this.on("prefinish",EX)}function EX(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,V){rV($,Q,V)});else rV(this,null,null)}u1.prototype.push=function($,Q){return this._transformState.needTransform=!1,M6.prototype.push.call(this,$,Q)};u1.prototype._transform=function($,Q,V){throw Error("_transform() is not implemented")};u1.prototype._write=function($,Q,V){var q=this._transformState;if(q.writecb=V,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};u1.prototype._read=function($){var Q=this._transformState;if(Q.writechunk!==null&&Q.writecb&&!Q.transforming)Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform);else Q.needTransform=!0};u1.prototype._destroy=function($,Q){var V=this;M6.prototype._destroy.call(this,$,function(q){Q(q),V.emit("close")})};function rV($,Q,V){if(Q)return $.emit("error",Q);if(V!=null)$.push(V);if($._writableState.length)throw Error("Calling transform done when ws.length != 0");if($._transformState.transforming)throw Error("Calling transform done when still transforming");return $.push(null)}});var Qq=w((bH,$q)=>{$q.exports=O$;var tV=$5(),eV=Object.create(S0());eV.inherits=E0();eV.inherits(O$,tV);function O$($){if(!(this instanceof O$))return new O$($);tV.call(this,$)}O$.prototype._transform=function($,Q,V){V(null,$)}});var Q5=w((a,C6)=>{var S1=i("stream");if(process.env.READABLE_STREAM==="disable"&&S1)C6.exports=S1,a=C6.exports=S1.Readable,a.Readable=S1.Readable,a.Writable=S1.Writable,a.Duplex=S1.Duplex,a.Transform=S1.Transform,a.PassThrough=S1.PassThrough,a.Stream=S1;else a=C6.exports=d8(),a.Stream=S1||a,a.Readable=a,a.Writable=p8(),a.Duplex=j0(),a.Transform=$5(),a.PassThrough=Qq()});var d1=w((kX)=>{kX.base64=!0;kX.array=!0;kX.string=!0;kX.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";kX.nodebuffer=typeof Buffer<"u";kX.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")kX.blob=!1;else{w6=new ArrayBuffer(0);try{kX.blob=new Blob([w6],{type:"application/zip"}).size===0}catch($){try{q5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,T6=new q5,T6.append(w6),kX.blob=T6.getBlob("application/zip").size===0}catch(Q){kX.blob=!1}}}var w6,q5,T6;try{kX.nodestream=!!Q5().Readable}catch($){kX.nodestream=!1}});var J5=w((pX)=>{var mX=p(),cX=d1(),E1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";pX.encode=function($){var Q=[],V,q,Y,X,J,G,U,K=0,W=$.length,j=W,H=mX.getTypeOf($)!=="string";while(K<$.length){if(j=W-K,!H)V=$.charCodeAt(K++),q=K<W?$.charCodeAt(K++):0,Y=K<W?$.charCodeAt(K++):0;else V=$[K++],q=K<W?$[K++]:0,Y=K<W?$[K++]:0;X=V>>2,J=(V&3)<<4|q>>4,G=j>1?(q&15)<<2|Y>>6:64,U=j>2?Y&63:64,Q.push(E1.charAt(X)+E1.charAt(J)+E1.charAt(G)+E1.charAt(U))}return Q.join("")};pX.decode=function($){var Q,V,q,Y,X,J,G,U=0,K=0,W="data:";if($.substr(0,W.length)===W)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var j=$.length*3/4;if($.charAt($.length-1)===E1.charAt(64))j--;if($.charAt($.length-2)===E1.charAt(64))j--;if(j%1!==0)throw Error("Invalid base64 input, bad content length.");var H;if(cX.uint8array)H=new Uint8Array(j|0);else H=Array(j|0);while(U<$.length){if(Y=E1.indexOf($.charAt(U++)),X=E1.indexOf($.charAt(U++)),J=E1.indexOf($.charAt(U++)),G=E1.indexOf($.charAt(U++)),Q=Y<<2|X>>4,V=(X&15)<<4|J>>2,q=(J&3)<<6|G,H[K++]=Q,J!==64)H[K++]=V;if(G!==64)H[K++]=q}return H}});var N$=w((mH,Vq)=>{Vq.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,Q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,Q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,Q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var Q=new Buffer($);return Q.fill(0),Q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var Yq=w((pH,Jq)=>{var cH=global.MutationObserver||global.WebKitMutationObserver,qq;qq=function(){process.nextTick(rX)};var lX,oX,iX,nX,Y5,B$=[];function rX(){Y5=!0;var $,Q,V=B$.length;while(V){Q=B$,B$=[],$=-1;while(++$<V)Q[$]();V=B$.length}Y5=!1}Jq.exports=aX;function aX($){if(B$.push($)===1&&!Y5)qq()}});var Zq=w((uH,jq)=>{var Xq=Yq();function h0(){}var $1={},Gq=["REJECTED"],X5=["FULFILLED"],Kq=["PENDING"];D0=["UNHANDLED"];var D0;jq.exports=t1;function t1($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Kq,this.queue=[],this.outcome=void 0,this.handled=D0,$!==h0)Wq(this,$)}t1.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(V,q);function V(Y){function X(){return Y}return Q.resolve($()).then(X)}function q(Y){function X(){throw Y}return Q.resolve($()).then(X)}};t1.prototype.catch=function($){return this.then(null,$)};t1.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===X5||typeof Q!=="function"&&this.state===Gq)return this;var V=new this.constructor(h0);if(this.handled===D0)this.handled=null;if(this.state!==Kq){var q=this.state===X5?$:Q;G5(V,q,this.outcome)}else this.queue.push(new M$(V,$,Q));return V};function M$($,Q,V){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof V==="function")this.onRejected=V,this.callRejected=this.otherCallRejected}M$.prototype.callFulfilled=function($){$1.resolve(this.promise,$)};M$.prototype.otherCallFulfilled=function($){G5(this.promise,this.onFulfilled,$)};M$.prototype.callRejected=function($){$1.reject(this.promise,$)};M$.prototype.otherCallRejected=function($){G5(this.promise,this.onRejected,$)};function G5($,Q,V){Xq(function(){var q;try{q=Q(V)}catch(Y){return $1.reject($,Y)}if(q===$)$1.reject($,TypeError("Cannot resolve promise with itself"));else $1.resolve($,q)})}$1.resolve=function($,Q){var V=Uq(sX,Q);if(V.status==="error")return $1.reject($,V.value);var q=V.value;if(q)Wq($,q);else{$.state=X5,$.outcome=Q;var Y=-1,X=$.queue.length;while(++Y<X)$.queue[Y].callFulfilled(Q)}return $};$1.reject=function($,Q){if($.state=Gq,$.outcome=Q,$.handled===D0)Xq(function(){if($.handled===D0)process.emit("unhandledRejection",Q,$)});var V=-1,q=$.queue.length;while(++V<q)$.queue[V].callRejected(Q);return $};function sX($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function Wq($,Q){var V=!1;function q(G){if(V)return;V=!0,$1.reject($,G)}function Y(G){if(V)return;V=!0,$1.resolve($,G)}function X(){Q(Y,q)}var J=Uq(X);if(J.status==="error")q(J.value)}function Uq($,Q){var V={};try{V.value=$(Q),V.status="success"}catch(q){V.status="error",V.value=q}return V}t1.resolve=tX;function tX($){if($ instanceof this)return $;return $1.resolve(new this(h0),$)}t1.reject=eX;function eX($){var Q=new this(h0);return $1.reject(Q,$)}t1.all=$G;function $G($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=Array(V),X=0,J=-1,G=new this(h0);while(++J<V)U($[J],J);return G;function U(K,W){Q.resolve(K).then(j,function(H){if(!q)q=!0,$1.reject(G,H)});function j(H){if(Y[W]=H,++X===V&&!q)q=!0,$1.resolve(G,Y)}}}t1.race=QG;function QG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=-1,X=new this(h0);while(++Y<V)J($[Y]);return X;function J(G){Q.resolve(G).then(function(U){if(!q)q=!0,$1.resolve(X,U)},function(U){if(!q)q=!0,$1.reject(X,U)})}}});var b0=w((dH,Hq)=>{var K5=null;if(typeof Promise<"u")K5=Promise;else K5=Zq();Hq.exports={Promise:K5}});var Pq=w((zq)=>{(function($,Q){if($.setImmediate)return;var V=1,q={},Y=!1,X=$.document,J;function G(L){if(typeof L!=="function")L=Function(""+L);var T=Array(arguments.length-1);for(var O=0;O<T.length;O++)T[O]=arguments[O+1];var I={callback:L,args:T};return q[V]=I,J(V),V++}function U(L){delete q[L]}function K(L){var{callback:T,args:O}=L;switch(O.length){case 0:T();break;case 1:T(O[0]);break;case 2:T(O[0],O[1]);break;case 3:T(O[0],O[1],O[2]);break;default:T.apply(Q,O);break}}function W(L){if(Y)setTimeout(W,0,L);else{var T=q[L];if(T){Y=!0;try{K(T)}finally{U(L),Y=!1}}}}function j(){J=function(L){process.nextTick(function(){W(L)})}}function H(){if($.postMessage&&!$.importScripts){var L=!0,T=$.onmessage;return $.onmessage=function(){L=!1},$.postMessage("","*"),$.onmessage=T,L}}function z(){var L="setImmediate$"+Math.random()+"$",T=function(O){if(O.source===$&&typeof O.data==="string"&&O.data.indexOf(L)===0)W(+O.data.slice(L.length))};if($.addEventListener)$.addEventListener("message",T,!1);else $.attachEvent("onmessage",T);J=function(O){$.postMessage(L+O,"*")}}function C(){var L=new MessageChannel;L.port1.onmessage=function(T){var O=T.data;W(O)},J=function(T){L.port2.postMessage(T)}}function P(){var L=X.documentElement;J=function(T){var O=X.createElement("script");O.onreadystatechange=function(){W(T),O.onreadystatechange=null,L.removeChild(O),O=null},L.appendChild(O)}}function M(){J=function(L){setTimeout(W,0,L)}}var B=Object.getPrototypeOf&&Object.getPrototypeOf($);if(B=B&&B.setTimeout?B:$,{}.toString.call($.process)==="[object process]")j();else if(H())z();else if($.MessageChannel)C();else if(X&&"onreadystatechange"in X.createElement("script"))P();else M();B.setImmediate=G,B.clearImmediate=U})(typeof self>"u"?typeof global>"u"?zq:global:self)});var p=w((JG)=>{var e1=d1(),VG=J5(),_0=N$(),W5=b0();Pq();function qG($){var Q=null;if(e1.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return R6($,Q)}JG.newBlob=function($,Q){JG.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var V=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new V;return q.append($),q.getBlob(Q)}catch(X){throw Error("Bug : can't construct the Blob.")}}};function C$($){return $}function R6($,Q){for(var V=0;V<$.length;++V)Q[V]=$.charCodeAt(V)&255;return Q}var A6={stringifyByChunk:function($,Q,V){var q=[],Y=0,X=$.length;if(X<=V)return String.fromCharCode.apply(null,$);while(Y<X){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+V,X))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+V,X))));Y+=V}return q.join("")},stringifyByChar:function($){var Q="";for(var V=0;V<$.length;V++)Q+=String.fromCharCode($[V]);return Q},applyCanBeUsed:{uint8array:function(){try{return e1.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return e1.nodebuffer&&String.fromCharCode.apply(null,_0.allocBuffer(1)).length===1}catch($){return!1}}()}};function w$($){var Q=65536,V=JG.getTypeOf($),q=!0;if(V==="uint8array")q=A6.applyCanBeUsed.uint8array;else if(V==="nodebuffer")q=A6.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return A6.stringifyByChunk($,V,Q)}catch(Y){Q=Math.floor(Q/2)}return A6.stringifyByChar($)}JG.applyFromCharCode=w$;function F6($,Q){for(var V=0;V<$.length;V++)Q[V]=$[V];return Q}var $0={};$0.string={string:C$,array:function($){return R6($,Array($.length))},arraybuffer:function($){return $0.string.uint8array($).buffer},uint8array:function($){return R6($,new Uint8Array($.length))},nodebuffer:function($){return R6($,_0.allocBuffer($.length))}};$0.array={string:w$,array:C$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return _0.newBufferFrom($)}};$0.arraybuffer={string:function($){return w$(new Uint8Array($))},array:function($){return F6(new Uint8Array($),Array($.byteLength))},arraybuffer:C$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return _0.newBufferFrom(new Uint8Array($))}};$0.uint8array={string:w$,array:function($){return F6($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:C$,nodebuffer:function($){return _0.newBufferFrom($)}};$0.nodebuffer={string:w$,array:function($){return F6($,Array($.length))},arraybuffer:function($){return $0.nodebuffer.uint8array($).buffer},uint8array:function($){return F6($,new Uint8Array($.length))},nodebuffer:C$};JG.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;JG.checkSupport($);var V=JG.getTypeOf(Q),q=$0[V][$](Q);return q};JG.resolve=function($){var Q=$.split("/"),V=[];for(var q=0;q<Q.length;q++){var Y=Q[q];if(Y==="."||Y===""&&q!==0&&q!==Q.length-1)continue;else if(Y==="..")V.pop();else V.push(Y)}return V.join("/")};JG.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(e1.nodebuffer&&_0.isBuffer($))return"nodebuffer";if(e1.uint8array&&$ instanceof Uint8Array)return"uint8array";if(e1.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};JG.checkSupport=function($){var Q=e1[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};JG.MAX_VALUE_16BITS=65535;JG.MAX_VALUE_32BITS=-1;JG.pretty=function($){var Q="",V,q;for(q=0;q<($||"").length;q++)V=$.charCodeAt(q),Q+="\\x"+(V<16?"0":"")+V.toString(16).toUpperCase();return Q};JG.delay=function($,Q,V){setImmediate(function(){$.apply(V||null,Q||[])})};JG.inherits=function($,Q){var V=function(){};V.prototype=Q.prototype,$.prototype=new V};JG.extend=function(){var $={},Q,V;for(Q=0;Q<arguments.length;Q++)for(V in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],V)&&typeof $[V]>"u")$[V]=arguments[Q][V];return $};JG.prepareContent=function($,Q,V,q,Y){var X=W5.Promise.resolve(Q).then(function(J){var G=e1.blob&&(J instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(J))!==-1);if(G&&typeof FileReader<"u")return new W5.Promise(function(U,K){var W=new FileReader;W.onload=function(j){U(j.target.result)},W.onerror=function(j){K(j.target.error)},W.readAsArrayBuffer(J)});else return J});return X.then(function(J){var G=JG.getTypeOf(J);if(!G)return W5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(G==="arraybuffer")J=JG.transformTo("uint8array",J);else if(G==="string"){if(Y)J=VG.decode(J);else if(V){if(q!==!0)J=qG(J)}}return J})}});var Z1=w((iH,Nq)=>{function Oq($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Oq.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,Q){return this._listeners[$].push(Q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,Q){if(this._listeners[$])for(var V=0;V<this._listeners[$].length;V++)this._listeners[$][V].call(this,Q)},pipe:function($){return $.registerPrevious(this)},registerPrevious:function($){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=$.streamInfo,this.mergeStreamInfo(),this.previous=$;var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){Q.end()}),$.on("error",function(V){Q.error(V)}),this},pause:function(){if(this.isPaused||this.isFinished)return!1;if(this.isPaused=!0,this.previous)this.previous.pause();return!0},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var $=!1;if(this.generatedError)this.error(this.generatedError),$=!0;if(this.previous)this.previous.resume();return!$},flush:function(){},processChunk:function($){this.push($)},withStreamInfo:function($,Q){return this.extraStreamInfo[$]=Q,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var $ in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,$))continue;this.streamInfo[$]=this.extraStreamInfo[$]}},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");if(this.isLocked=!0,this.previous)this.previous.lock()},toString:function(){var $="Worker "+this.name;if(this.previous)return this.previous+" -> "+$;else return $}};Nq.exports=Oq});var m0=w((NG)=>{var f0=p(),Z0=d1(),PG=N$(),v6=Z1(),T$=Array(256);for(g1=0;g1<256;g1++)T$[g1]=g1>=252?6:g1>=248?5:g1>=240?4:g1>=224?3:g1>=192?2:1;var g1;T$[254]=T$[254]=1;var LG=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}if(Z0.uint8array)Q=new Uint8Array(G);else Q=Array(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q},IG=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+T$[$[V]]>Q?V:Q},OG=function($){var Q,V,q,Y,X=$.length,J=Array(X*2);for(V=0,Q=0;Q<X;){if(q=$[Q++],q<128){J[V++]=q;continue}if(Y=T$[q],Y>4){J[V++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<X)q=q<<6|$[Q++]&63,Y--;if(Y>1){J[V++]=65533;continue}if(q<65536)J[V++]=q;else q-=65536,J[V++]=55296|q>>10&1023,J[V++]=56320|q&1023}if(J.length!==V)if(J.subarray)J=J.subarray(0,V);else J.length=V;return f0.applyFromCharCode(J)};NG.utf8encode=function(Q){if(Z0.nodebuffer)return PG.newBufferFrom(Q,"utf-8");return LG(Q)};NG.utf8decode=function(Q){if(Z0.nodebuffer)return f0.transformTo("nodebuffer",Q).toString("utf-8");return Q=f0.transformTo(Z0.uint8array?"uint8array":"array",Q),OG(Q)};function x6(){v6.call(this,"utf-8 decode"),this.leftOver=null}f0.inherits(x6,v6);x6.prototype.processChunk=function($){var Q=f0.transformTo(Z0.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(Z0.uint8array){var V=Q;Q=new Uint8Array(V.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(V,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=IG(Q),Y=Q;if(q!==Q.length)if(Z0.uint8array)Y=Q.subarray(0,q),this.leftOver=Q.subarray(q,Q.length);else Y=Q.slice(0,q),this.leftOver=Q.slice(q,Q.length);this.push({data:NG.utf8decode(Y),meta:$.meta})};x6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:NG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};NG.Utf8DecodeWorker=x6;function j5(){v6.call(this,"utf-8 encode")}f0.inherits(j5,v6);j5.prototype.processChunk=function($){this.push({data:NG.utf8encode($.data),meta:$.meta})};NG.Utf8EncodeWorker=j5});var Tq=w((rH,wq)=>{var Mq=Z1(),Cq=p();function H5($){Mq.call(this,"ConvertWorker to "+$),this.destType=$}Cq.inherits(H5,Mq);H5.prototype.processChunk=function($){this.push({data:Cq.transformTo(this.destType,$.data),meta:$.meta})};wq.exports=H5});var Fq=w((aH,Rq)=>{var Aq=Q5().Readable,CG=p();CG.inherits(z5,Aq);function z5($,Q,V){Aq.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,X){if(!q.push(Y))q._helper.pause();if(V)V(X)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}z5.prototype._read=function(){this._helper.resume()};Rq.exports=z5});var P5=w((sH,Sq)=>{var H0=p(),wG=Tq(),TG=Z1(),AG=J5(),RG=d1(),FG=b0(),vq=null;if(RG.nodestream)try{vq=Fq()}catch($){}function vG($,Q,V){switch($){case"blob":return H0.newBlob(H0.transformTo("arraybuffer",Q),V);case"base64":return AG.encode(Q);default:return H0.transformTo($,Q)}}function xG($,Q){var V,q=0,Y=null,X=0;for(V=0;V<Q.length;V++)X+=Q[V].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(X);for(V=0;V<Q.length;V++)Y.set(Q[V],q),q+=Q[V].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function SG($,Q){return new FG.Promise(function(V,q){var Y=[],X=$._internalType,J=$._outputType,G=$._mimeType;$.on("data",function(U,K){if(Y.push(U),Q)Q(K)}).on("error",function(U){Y=[],q(U)}).on("end",function(){try{var U=vG(J,xG(X,Y),G);V(U)}catch(K){q(K)}Y=[]}).resume()})}function xq($,Q,V){var q=Q;switch(Q){case"blob":case"arraybuffer":q="uint8array";break;case"base64":q="string";break}try{this._internalType=q,this._outputType=Q,this._mimeType=V,H0.checkSupport(q),this._worker=$.pipe(new wG(q)),$.lock()}catch(Y){this._worker=new TG("error"),this._worker.error(Y)}}xq.prototype={accumulate:function($){return SG(this,$)},on:function($,Q){var V=this;if($==="data")this._worker.on($,function(q){Q.call(V,q.data,q.meta)});else this._worker.on($,function(){H0.delay(Q,arguments,V)});return this},resume:function(){return H0.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(H0.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new vq(this,{objectMode:this._outputType!=="nodebuffer"},$)}};Sq.exports=xq});var L5=w((EG)=>{EG.base64=!1;EG.binary=!1;EG.dir=!1;EG.createFolders=!0;EG.date=null;EG.compression=null;EG.compressionOptions=null;EG.comment=null;EG.unixPermissions=null;EG.dosPermissions=null});var I5=w((eH,Eq)=>{var S6=p(),E6=Z1(),pG=16384;function c0($){E6.call(this,"DataWorker");var Q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(V){if(Q.dataIsReady=!0,Q.data=V,Q.max=V&&V.length||0,Q.type=S6.getTypeOf(V),!Q.isPaused)Q._tickAndRepeat()},function(V){Q.error(V)})}S6.inherits(c0,E6);c0.prototype.cleanUp=function(){E6.prototype.cleanUp.call(this),this.data=null};c0.prototype.resume=function(){if(!E6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,S6.delay(this._tickAndRepeat,[],this);return!0};c0.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)S6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};c0.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=pG,Q=null,V=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":Q=this.data.substring(this.index,V);break;case"uint8array":Q=this.data.subarray(this.index,V);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,V);break}return this.index=V,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};Eq.exports=c0});var g6=w(($z,kq)=>{var uG=p();function dG(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var gq=dG();function lG($,Q,V,q){var Y=gq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}function oG($,Q,V,q){var Y=gq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q.charCodeAt(J))&255];return $^-1}kq.exports=function(Q,V){if(typeof Q>"u"||!Q.length)return 0;var q=uG.getTypeOf(Q)!=="string";if(q)return lG(V|0,Q,Q.length,0);else return oG(V|0,Q,Q.length,0)}});var N5=w((Qz,Dq)=>{var yq=Z1(),iG=g6(),nG=p();function O5(){yq.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}nG.inherits(O5,yq);O5.prototype.processChunk=function($){this.streamInfo.crc32=iG($.data,this.streamInfo.crc32||0),this.push($)};Dq.exports=O5});var bq=w((Vz,hq)=>{var rG=p(),B5=Z1();function M5($){B5.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}rG.inherits(M5,B5);M5.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}B5.prototype.processChunk.call(this,$)};hq.exports=M5});var k6=w((qz,mq)=>{var _q=b0(),fq=I5(),aG=N5(),C5=bq();function w5($,Q,V,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=V,this.compression=q,this.compressedContent=Y}w5.prototype={getContentWorker:function(){var $=new fq(_q.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new C5("data_length")),Q=this;return $.on("end",function(){if(this.streamInfo.data_length!==Q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new fq(_q.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};w5.createWorkerFrom=function($,Q,V){return $.pipe(new aG).pipe(new C5("uncompressedSize")).pipe(Q.compressWorker(V)).pipe(new C5("compressedSize")).withStreamInfo("compression",Q)};mq.exports=w5});var dq=w((Jz,uq)=>{var sG=P5(),tG=I5(),T5=m0(),A5=k6(),cq=Z1(),R5=function($,Q,V){this.name=$,this.dir=V.dir,this.date=V.date,this.comment=V.comment,this.unixPermissions=V.unixPermissions,this.dosPermissions=V.dosPermissions,this._data=Q,this._dataBinary=V.binary,this.options={compression:V.compression,compressionOptions:V.compressionOptions}};R5.prototype={internalStream:function($){var Q=null,V="string";try{if(!$)throw Error("No output type specified.");V=$.toLowerCase();var q=V==="string"||V==="text";if(V==="binarystring"||V==="text")V="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new T5.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new T5.Utf8DecodeWorker)}catch(X){Q=new cq("error"),Q.error(X)}return new sG(Q,V,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof A5&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var V=this._decompressWorker();if(!this._dataBinary)V=V.pipe(new T5.Utf8EncodeWorker);return A5.createWorkerFrom(V,$,Q)}},_decompressWorker:function(){if(this._data instanceof A5)return this._data.getContentWorker();else if(this._data instanceof cq)return this._data;else return new tG(this._data)}};var pq=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],eG=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(A$=0;A$<pq.length;A$++)R5.prototype[pq[A$]]=eG;var A$;uq.exports=R5});var l1=w((F5)=>{var q3=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function J3($,Q){return Object.prototype.hasOwnProperty.call($,Q)}F5.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var V=Q.shift();if(!V)continue;if(typeof V!=="object")throw TypeError(V+"must be non-object");for(var q in V)if(J3(V,q))$[q]=V[q]}return $};F5.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var Y3={arraySet:function($,Q,V,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(V,V+q),Y);return}for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){var Q,V,q,Y,X,J;q=0;for(Q=0,V=$.length;Q<V;Q++)q+=$[Q].length;J=new Uint8Array(q),Y=0;for(Q=0,V=$.length;Q<V;Q++)X=$[Q],J.set(X,Y),Y+=X.length;return J}},X3={arraySet:function($,Q,V,q,Y){for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){return[].concat.apply([],$)}};F5.setTyped=function($){if($)F5.Buf8=Uint8Array,F5.Buf16=Uint16Array,F5.Buf32=Int32Array,F5.assign(F5,Y3);else F5.Buf8=Array,F5.Buf16=Array,F5.Buf32=Array,F5.assign(F5,X3)};F5.setTyped(q3)});var z9=w((x3)=>{var K3=l1(),W3=4,oq=0,iq=1,U3=2;function u0($){var Q=$.length;while(--Q>=0)$[Q]=0}var j3=0,eq=1,Z3=2,H3=3,z3=258,D5=29,E$=256,F$=E$+1+D5,p0=30,h5=19,$9=2*F$+1,z0=15,x5=16,P3=7,b5=256,Q9=16,V9=17,q9=18,k5=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],y6=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],L3=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],J9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],I3=512,o1=Array((F$+2)*2);u0(o1);var R$=Array(p0*2);u0(R$);var v$=Array(I3);u0(v$);var x$=Array(z3-H3+1);u0(x$);var _5=Array(D5);u0(_5);var D6=Array(p0);u0(D6);function S5($,Q,V,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=V,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var Y9,X9,G9;function E5($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function K9($){return $<256?v$[$]:v$[256+($>>>7)]}function S$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function G1($,Q,V){if($.bi_valid>x5-V)$.bi_buf|=Q<<$.bi_valid&65535,S$($,$.bi_buf),$.bi_buf=Q>>x5-$.bi_valid,$.bi_valid+=V-x5;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=V}function k1($,Q,V){G1($,V[Q*2],V[Q*2+1])}function W9($,Q){var V=0;do V|=$&1,$>>>=1,V<<=1;while(--Q>0);return V>>>1}function O3($){if($.bi_valid===16)S$($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function N3($,Q){var{dyn_tree:V,max_code:q}=Q,Y=Q.stat_desc.static_tree,X=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,G=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,K,W,j,H,z,C,P=0;for(H=0;H<=z0;H++)$.bl_count[H]=0;V[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<$9;K++){if(W=$.heap[K],H=V[V[W*2+1]*2+1]+1,H>U)H=U,P++;if(V[W*2+1]=H,W>q)continue;if($.bl_count[H]++,z=0,W>=G)z=J[W-G];if(C=V[W*2],$.opt_len+=C*(H+z),X)$.static_len+=C*(Y[W*2+1]+z)}if(P===0)return;do{H=U-1;while($.bl_count[H]===0)H--;$.bl_count[H]--,$.bl_count[H+1]+=2,$.bl_count[U]--,P-=2}while(P>0);for(H=U;H!==0;H--){W=$.bl_count[H];while(W!==0){if(j=$.heap[--K],j>q)continue;if(V[j*2+1]!==H)$.opt_len+=(H-V[j*2+1])*V[j*2],V[j*2+1]=H;W--}}}function U9($,Q,V){var q=Array(z0+1),Y=0,X,J;for(X=1;X<=z0;X++)q[X]=Y=Y+V[X-1]<<1;for(J=0;J<=Q;J++){var G=$[J*2+1];if(G===0)continue;$[J*2]=W9(q[G]++,G)}}function B3(){var $,Q,V,q,Y,X=Array(z0+1);V=0;for(q=0;q<D5-1;q++){_5[q]=V;for($=0;$<1<<k5[q];$++)x$[V++]=q}x$[V-1]=q,Y=0;for(q=0;q<16;q++){D6[q]=Y;for($=0;$<1<<y6[q];$++)v$[Y++]=q}Y>>=7;for(;q<p0;q++){D6[q]=Y<<7;for($=0;$<1<<y6[q]-7;$++)v$[256+Y++]=q}for(Q=0;Q<=z0;Q++)X[Q]=0;$=0;while($<=143)o1[$*2+1]=8,$++,X[8]++;while($<=255)o1[$*2+1]=9,$++,X[9]++;while($<=279)o1[$*2+1]=7,$++,X[7]++;while($<=287)o1[$*2+1]=8,$++,X[8]++;U9(o1,F$+1,X);for($=0;$<p0;$++)R$[$*2+1]=5,R$[$*2]=W9($,5);Y9=new S5(o1,k5,E$+1,F$,z0),X9=new S5(R$,y6,0,p0,z0),G9=new S5([],L3,0,h5,P3)}function j9($){var Q;for(Q=0;Q<F$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<p0;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<h5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[b5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function Z9($){if($.bi_valid>8)S$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function M3($,Q,V,q){if(Z9($),q)S$($,V),S$($,~V);K3.arraySet($.pending_buf,$.window,Q,V,$.pending),$.pending+=V}function nq($,Q,V,q){var Y=Q*2,X=V*2;return $[Y]<$[X]||$[Y]===$[X]&&q[Q]<=q[V]}function g5($,Q,V){var q=$.heap[V],Y=V<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&nq(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(nq(Q,q,$.heap[Y],$.depth))break;$.heap[V]=$.heap[Y],V=Y,Y<<=1}$.heap[V]=q}function rq($,Q,V){var q,Y,X=0,J,G;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+X*2]<<8|$.pending_buf[$.d_buf+X*2+1],Y=$.pending_buf[$.l_buf+X],X++,q===0)k1($,Y,Q);else{if(J=x$[Y],k1($,J+E$+1,Q),G=k5[J],G!==0)Y-=_5[J],G1($,Y,G);if(q--,J=K9(q),k1($,J,V),G=y6[J],G!==0)q-=D6[J],G1($,q,G)}while(X<$.last_lit);k1($,b5,Q)}function y5($,Q){var V=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,X=Q.stat_desc.elems,J,G,U=-1,K;$.heap_len=0,$.heap_max=$9;for(J=0;J<X;J++)if(V[J*2]!==0)$.heap[++$.heap_len]=U=J,$.depth[J]=0;else V[J*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=U<2?++U:0,V[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=q[K*2+1];Q.max_code=U;for(J=$.heap_len>>1;J>=1;J--)g5($,V,J);K=X;do J=$.heap[1],$.heap[1]=$.heap[$.heap_len--],g5($,V,1),G=$.heap[1],$.heap[--$.heap_max]=J,$.heap[--$.heap_max]=G,V[K*2]=V[J*2]+V[G*2],$.depth[K]=($.depth[J]>=$.depth[G]?$.depth[J]:$.depth[G])+1,V[J*2+1]=V[G*2+1]=K,$.heap[1]=K++,g5($,V,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],N3($,Q),U9(V,U,$.bl_count)}function aq($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;Q[(V+1)*2+1]=65535;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)$.bl_tree[X*2]+=G;else if(X!==0){if(X!==Y)$.bl_tree[X*2]++;$.bl_tree[Q9*2]++}else if(G<=10)$.bl_tree[V9*2]++;else $.bl_tree[q9*2]++;if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function sq($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)do k1($,X,$.bl_tree);while(--G!==0);else if(X!==0){if(X!==Y)k1($,X,$.bl_tree),G--;k1($,Q9,$.bl_tree),G1($,G-3,2)}else if(G<=10)k1($,V9,$.bl_tree),G1($,G-3,3);else k1($,q9,$.bl_tree),G1($,G-11,7);if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function C3($){var Q;aq($,$.dyn_ltree,$.l_desc.max_code),aq($,$.dyn_dtree,$.d_desc.max_code),y5($,$.bl_desc);for(Q=h5-1;Q>=3;Q--)if($.bl_tree[J9[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function w3($,Q,V,q){var Y;G1($,Q-257,5),G1($,V-1,5),G1($,q-4,4);for(Y=0;Y<q;Y++)G1($,$.bl_tree[J9[Y]*2+1],3);sq($,$.dyn_ltree,Q-1),sq($,$.dyn_dtree,V-1)}function T3($){var Q=4093624447,V;for(V=0;V<=31;V++,Q>>>=1)if(Q&1&&$.dyn_ltree[V*2]!==0)return oq;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return iq;for(V=32;V<E$;V++)if($.dyn_ltree[V*2]!==0)return iq;return oq}var tq=!1;function A3($){if(!tq)B3(),tq=!0;$.l_desc=new E5($.dyn_ltree,Y9),$.d_desc=new E5($.dyn_dtree,X9),$.bl_desc=new E5($.bl_tree,G9),$.bi_buf=0,$.bi_valid=0,j9($)}function H9($,Q,V,q){G1($,(j3<<1)+(q?1:0),3),M3($,Q,V,!0)}function R3($){G1($,eq<<1,3),k1($,b5,o1),O3($)}function F3($,Q,V,q){var Y,X,J=0;if($.level>0){if($.strm.data_type===U3)$.strm.data_type=T3($);if(y5($,$.l_desc),y5($,$.d_desc),J=C3($),Y=$.opt_len+3+7>>>3,X=$.static_len+3+7>>>3,X<=Y)Y=X}else Y=X=V+5;if(V+4<=Y&&Q!==-1)H9($,Q,V,q);else if($.strategy===W3||X===Y)G1($,(eq<<1)+(q?1:0),3),rq($,o1,R$);else G1($,(Z3<<1)+(q?1:0),3),w3($,$.l_desc.max_code+1,$.d_desc.max_code+1,J+1),rq($,$.dyn_ltree,$.dyn_dtree);if(j9($),q)Z9($)}function v3($,Q,V){if($.pending_buf[$.d_buf+$.last_lit*2]=Q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=Q&255,$.pending_buf[$.l_buf+$.last_lit]=V&255,$.last_lit++,Q===0)$.dyn_ltree[V*2]++;else $.matches++,Q--,$.dyn_ltree[(x$[V]+E$+1)*2]++,$.dyn_dtree[K9(Q)*2]++;return $.last_lit===$.lit_bufsize-1}x3._tr_init=A3;x3._tr_stored_block=H9;x3._tr_flush_block=F3;x3._tr_tally=v3;x3._tr_align=R3});var f5=w((Gz,P9)=>{function D3($,Q,V,q){var Y=$&65535|0,X=$>>>16&65535|0,J=0;while(V!==0){J=V>2000?2000:V,V-=J;do Y=Y+Q[q++]|0,X=X+Y|0;while(--J);Y%=65521,X%=65521}return Y|X<<16|0}P9.exports=D3});var m5=w((Kz,L9)=>{function h3(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var b3=h3();function _3($,Q,V,q){var Y=b3,X=q+V;$^=-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}L9.exports=_3});var h6=w((Wz,I9)=>{I9.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var R9=w((IK)=>{var Y1=l1(),P1=z9(),M9=f5(),Q0=m5(),f3=h6(),O0=0,m3=1,c3=3,X0=4,O9=5,D1=0,N9=1,L1=-2,p3=-3,c5=-5,u3=-1,d3=1,b6=2,l3=3,o3=4,i3=0,n3=2,c6=8,r3=9,a3=15,s3=8,t3=29,e3=256,u5=e3+1+t3,$K=30,QK=19,VK=2*u5+1,qK=15,S=3,J0=258,R1=J0+S+1,JK=32,p6=42,d5=69,_6=73,f6=91,m6=103,P0=113,k$=666,n=1,y$=2,L0=3,o0=4,YK=3;function Y0($,Q){return $.msg=f3[Q],Q}function B9($){return($<<1)-($>4?9:0)}function q0($){var Q=$.length;while(--Q>=0)$[Q]=0}function V0($){var Q=$.state,V=Q.pending;if(V>$.avail_out)V=$.avail_out;if(V===0)return;if(Y1.arraySet($.output,Q.pending_buf,Q.pending_out,V,$.next_out),$.next_out+=V,Q.pending_out+=V,$.total_out+=V,$.avail_out-=V,Q.pending-=V,Q.pending===0)Q.pending_out=0}function s($,Q){P1._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,V0($.strm)}function E($,Q){$.pending_buf[$.pending++]=Q}function g$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function XK($,Q,V,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,Y1.arraySet(Q,$.input,$.next_in,Y,V),$.state.wrap===1)$.adler=M9($.adler,Q,Y,V);else if($.state.wrap===2)$.adler=Q0($.adler,Q,Y,V);return $.next_in+=Y,$.total_in+=Y,Y}function C9($,Q){var{max_chain_length:V,strstart:q}=$,Y,X,J=$.prev_length,G=$.nice_match,U=$.strstart>$.w_size-R1?$.strstart-($.w_size-R1):0,K=$.window,W=$.w_mask,j=$.prev,H=$.strstart+J0,z=K[q+J-1],C=K[q+J];if($.prev_length>=$.good_match)V>>=2;if(G>$.lookahead)G=$.lookahead;do{if(Y=Q,K[Y+J]!==C||K[Y+J-1]!==z||K[Y]!==K[q]||K[++Y]!==K[q+1])continue;q+=2,Y++;do;while(K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&q<H);if(X=J0-(H-q),q=H-J0,X>J){if($.match_start=Q,J=X,X>=G)break;z=K[q+J-1],C=K[q+J]}}while((Q=j[Q&W])>U&&--V!==0);if(J<=$.lookahead)return J;return $.lookahead}function I0($){var Q=$.w_size,V,q,Y,X,J;do{if(X=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-R1)){Y1.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,V=q;do Y=$.head[--V],$.head[V]=Y>=Q?Y-Q:0;while(--q);q=Q,V=q;do Y=$.prev[--V],$.prev[V]=Y>=Q?Y-Q:0;while(--q);X+=Q}if($.strm.avail_in===0)break;if(q=XK($.strm,$.window,$.strstart+$.lookahead,X),$.lookahead+=q,$.lookahead+$.insert>=S){J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[J+S-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,$.lookahead+$.insert<S)break}}while($.lookahead<R1&&$.strm.avail_in!==0)}function GK($,Q){var V=65535;if(V>$.pending_buf_size-5)V=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(I0($),$.lookahead===0&&Q===O0)return n;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+V;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,s($,!1),$.strm.avail_out===0)return n}if($.strstart-$.block_start>=$.w_size-R1){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.strstart>$.block_start){if(s($,!1),$.strm.avail_out===0)return n}return n}function p5($,Q){var V,q;for(;;){if($.lookahead<R1){if(I0($),$.lookahead<R1&&Q===O0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(V!==0&&$.strstart-V<=$.w_size-R1)$.match_length=C9($,V);if($.match_length>=S)if(q=P1._tr_tally($,$.strstart-$.match_start,$.match_length-S),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=S){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else q=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=$.strstart<S-1?$.strstart:S-1,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function d0($,Q){var V,q,Y;for(;;){if($.lookahead<R1){if(I0($),$.lookahead<R1&&Q===O0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=S-1,V!==0&&$.prev_length<$.max_lazy_match&&$.strstart-V<=$.w_size-R1){if($.match_length=C9($,V),$.match_length<=5&&($.strategy===d3||$.match_length===S&&$.strstart-$.match_start>4096))$.match_length=S-1}if($.prev_length>=S&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-S,q=P1._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-S),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=S-1,$.strstart++,q){if(s($,!1),$.strm.avail_out===0)return n}}else if($.match_available){if(q=P1._tr_tally($,0,$.window[$.strstart-1]),q)s($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return n}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=P1._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<S-1?$.strstart:S-1,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function KK($,Q){var V,q,Y,X,J=$.window;for(;;){if($.lookahead<=J0){if(I0($),$.lookahead<=J0&&Q===O0)return n;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=S&&$.strstart>0){if(Y=$.strstart-1,q=J[Y],q===J[++Y]&&q===J[++Y]&&q===J[++Y]){X=$.strstart+J0;do;while(q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&Y<X);if($.match_length=J0-(X-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=S)V=P1._tr_tally($,1,$.match_length-S),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else V=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function WK($,Q){var V;for(;;){if($.lookahead===0){if(I0($),$.lookahead===0){if(Q===O0)return n;break}}if($.match_length=0,V=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===X0){if(s($,!0),$.strm.avail_out===0)return L0;return o0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return y$}function y1($,Q,V,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=V,this.max_chain=q,this.func=Y}var l0;l0=[new y1(0,0,0,0,GK),new y1(4,4,8,4,p5),new y1(4,5,16,8,p5),new y1(4,6,32,32,p5),new y1(4,4,16,16,d0),new y1(8,16,32,32,d0),new y1(8,16,128,128,d0),new y1(8,32,128,256,d0),new y1(32,128,258,1024,d0),new y1(32,258,258,4096,d0)];function UK($){$.window_size=2*$.w_size,q0($.head),$.max_lazy_match=l0[$.level].max_lazy,$.good_match=l0[$.level].good_length,$.nice_match=l0[$.level].nice_length,$.max_chain_length=l0[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=S-1,$.match_available=0,$.ins_h=0}function jK(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=c6,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Y1.Buf16(VK*2),this.dyn_dtree=new Y1.Buf16((2*$K+1)*2),this.bl_tree=new Y1.Buf16((2*QK+1)*2),q0(this.dyn_ltree),q0(this.dyn_dtree),q0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Y1.Buf16(qK+1),this.heap=new Y1.Buf16(2*u5+1),q0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Y1.Buf16(2*u5+1),q0(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function w9($){var Q;if(!$||!$.state)return Y0($,L1);if($.total_in=$.total_out=0,$.data_type=n3,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?p6:P0,$.adler=Q.wrap===2?0:1,Q.last_flush=O0,P1._tr_init(Q),D1}function T9($){var Q=w9($);if(Q===D1)UK($.state);return Q}function ZK($,Q){if(!$||!$.state)return L1;if($.state.wrap!==2)return L1;return $.state.gzhead=Q,D1}function A9($,Q,V,q,Y,X){if(!$)return L1;var J=1;if(Q===u3)Q=6;if(q<0)J=0,q=-q;else if(q>15)J=2,q-=16;if(Y<1||Y>r3||V!==c6||q<8||q>15||Q<0||Q>9||X<0||X>o3)return Y0($,L1);if(q===8)q=9;var G=new jK;return $.state=G,G.strm=$,G.wrap=J,G.gzhead=null,G.w_bits=q,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=Y+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+S-1)/S),G.window=new Y1.Buf8(G.w_size*2),G.head=new Y1.Buf16(G.hash_size),G.prev=new Y1.Buf16(G.w_size),G.lit_bufsize=1<<Y+6,G.pending_buf_size=G.lit_bufsize*4,G.pending_buf=new Y1.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=Q,G.strategy=X,G.method=V,T9($)}function HK($,Q){return A9($,Q,c6,a3,s3,i3)}function zK($,Q){var V,q,Y,X;if(!$||!$.state||Q>O9||Q<0)return $?Y0($,L1):L1;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===k$&&Q!==X0)return Y0($,$.avail_out===0?c5:L1);if(q.strm=$,V=q.last_flush,q.last_flush=Q,q.status===p6)if(q.wrap===2)if($.adler=0,E(q,31),E(q,139),E(q,8),!q.gzhead)E(q,0),E(q,0),E(q,0),E(q,0),E(q,0),E(q,q.level===9?2:q.strategy>=b6||q.level<2?4:0),E(q,YK),q.status=P0;else{if(E(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(!q.gzhead.extra?0:4)+(!q.gzhead.name?0:8)+(!q.gzhead.comment?0:16)),E(q,q.gzhead.time&255),E(q,q.gzhead.time>>8&255),E(q,q.gzhead.time>>16&255),E(q,q.gzhead.time>>24&255),E(q,q.level===9?2:q.strategy>=b6||q.level<2?4:0),E(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)E(q,q.gzhead.extra.length&255),E(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=Q0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=d5}else{var J=c6+(q.w_bits-8<<4)<<8,G=-1;if(q.strategy>=b6||q.level<2)G=0;else if(q.level<6)G=1;else if(q.level===6)G=2;else G=3;if(J|=G<<6,q.strstart!==0)J|=JK;if(J+=31-J%31,q.status=P0,g$(q,J),q.strstart!==0)g$(q,$.adler>>>16),g$(q,$.adler&65535);$.adler=1}if(q.status===d5)if(q.gzhead.extra){Y=q.pending;while(q.gzindex<(q.gzhead.extra.length&65535)){if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size)break}E(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=_6}else q.status=_6;if(q.status===_6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.name.length)X=q.gzhead.name.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.gzindex=0,q.status=f6}else q.status=f6;if(q.status===f6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(V0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.comment.length)X=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=Q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.status=m6}else q.status=m6;if(q.status===m6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)V0($);if(q.pending+2<=q.pending_buf_size)E(q,$.adler&255),E(q,$.adler>>8&255),$.adler=0,q.status=P0}else q.status=P0;if(q.pending!==0){if(V0($),$.avail_out===0)return q.last_flush=-1,D1}else if($.avail_in===0&&B9(Q)<=B9(V)&&Q!==X0)return Y0($,c5);if(q.status===k$&&$.avail_in!==0)return Y0($,c5);if($.avail_in!==0||q.lookahead!==0||Q!==O0&&q.status!==k$){var U=q.strategy===b6?WK(q,Q):q.strategy===l3?KK(q,Q):l0[q.level].func(q,Q);if(U===L0||U===o0)q.status=k$;if(U===n||U===L0){if($.avail_out===0)q.last_flush=-1;return D1}if(U===y$){if(Q===m3)P1._tr_align(q);else if(Q!==O9){if(P1._tr_stored_block(q,0,0,!1),Q===c3){if(q0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(V0($),$.avail_out===0)return q.last_flush=-1,D1}}if(Q!==X0)return D1;if(q.wrap<=0)return N9;if(q.wrap===2)E(q,$.adler&255),E(q,$.adler>>8&255),E(q,$.adler>>16&255),E(q,$.adler>>24&255),E(q,$.total_in&255),E(q,$.total_in>>8&255),E(q,$.total_in>>16&255),E(q,$.total_in>>24&255);else g$(q,$.adler>>>16),g$(q,$.adler&65535);if(V0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?D1:N9}function PK($){var Q;if(!$||!$.state)return L1;if(Q=$.state.status,Q!==p6&&Q!==d5&&Q!==_6&&Q!==f6&&Q!==m6&&Q!==P0&&Q!==k$)return Y0($,L1);return $.state=null,Q===P0?Y0($,p3):D1}function LK($,Q){var V=Q.length,q,Y,X,J,G,U,K,W;if(!$||!$.state)return L1;if(q=$.state,J=q.wrap,J===2||J===1&&q.status!==p6||q.lookahead)return L1;if(J===1)$.adler=M9($.adler,Q,V,0);if(q.wrap=0,V>=q.w_size){if(J===0)q0(q.head),q.strstart=0,q.block_start=0,q.insert=0;W=new Y1.Buf8(q.w_size),Y1.arraySet(W,Q,V-q.w_size,q.w_size,0),Q=W,V=q.w_size}G=$.avail_in,U=$.next_in,K=$.input,$.avail_in=V,$.next_in=0,$.input=Q,I0(q);while(q.lookahead>=S){Y=q.strstart,X=q.lookahead-(S-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+S-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--X);q.strstart=Y,q.lookahead=S-1,I0(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=S-1,q.match_available=0,$.next_in=U,$.input=K,$.avail_in=G,q.wrap=J,D1}IK.deflateInit=HK;IK.deflateInit2=A9;IK.deflateReset=T9;IK.deflateResetKeep=w9;IK.deflateSetHeader=ZK;IK.deflate=zK;IK.deflateEnd=PK;IK.deflateSetDictionary=LK;IK.deflateInfo="pako deflate (from Nodeca project)"});var l5=w((FK)=>{var u6=l1(),F9=!0,v9=!0;try{String.fromCharCode.apply(null,[0])}catch($){F9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){v9=!1}var D$=new u6.Buf8(256);for(h1=0;h1<256;h1++)D$[h1]=h1>=252?6:h1>=248?5:h1>=240?4:h1>=224?3:h1>=192?2:1;var h1;D$[254]=D$[254]=1;FK.string2buf=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}Q=new u6.Buf8(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q};function x9($,Q){if(Q<65534){if($.subarray&&v9||!$.subarray&&F9)return String.fromCharCode.apply(null,u6.shrinkBuf($,Q))}var V="";for(var q=0;q<Q;q++)V+=String.fromCharCode($[q]);return V}FK.buf2binstring=function($){return x9($,$.length)};FK.binstring2buf=function($){var Q=new u6.Buf8($.length);for(var V=0,q=Q.length;V<q;V++)Q[V]=$.charCodeAt(V);return Q};FK.buf2string=function($,Q){var V,q,Y,X,J=Q||$.length,G=Array(J*2);for(q=0,V=0;V<J;){if(Y=$[V++],Y<128){G[q++]=Y;continue}if(X=D$[Y],X>4){G[q++]=65533,V+=X-1;continue}Y&=X===2?31:X===3?15:7;while(X>1&&V<J)Y=Y<<6|$[V++]&63,X--;if(X>1){G[q++]=65533;continue}if(Y<65536)G[q++]=Y;else Y-=65536,G[q++]=55296|Y>>10&1023,G[q++]=56320|Y&1023}return x9(G,q)};FK.utf8border=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+D$[$[V]]>Q?V:Q}});var o5=w((Zz,S9)=>{function kK(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}S9.exports=kK});var y9=w((cK)=>{var h$=R9(),b$=l1(),n5=l5(),r5=h6(),yK=o5(),k9=Object.prototype.toString,DK=0,i5=4,i0=0,E9=1,g9=2,hK=-1,bK=0,_K=8;function N0($){if(!(this instanceof N0))return new N0($);this.options=b$.assign({level:hK,method:_K,chunkSize:16384,windowBits:15,memLevel:8,strategy:bK,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>0)Q.windowBits=-Q.windowBits;else if(Q.gzip&&Q.windowBits>0&&Q.windowBits<16)Q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new yK,this.strm.avail_out=0;var V=h$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(V!==i0)throw Error(r5[V]);if(Q.header)h$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=n5.string2buf(Q.dictionary);else if(k9.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(V=h$.deflateSetDictionary(this.strm,q),V!==i0)throw Error(r5[V]);this._dict_set=!0}}N0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y,X;if(this.ended)return!1;if(X=Q===~~Q?Q:Q===!0?i5:DK,typeof $==="string")V.input=n5.string2buf($);else if(k9.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new b$.Buf8(q),V.next_out=0,V.avail_out=q;if(Y=h$.deflate(V,X),Y!==E9&&Y!==i0)return this.onEnd(Y),this.ended=!0,!1;if(V.avail_out===0||V.avail_in===0&&(X===i5||X===g9))if(this.options.to==="string")this.onData(n5.buf2binstring(b$.shrinkBuf(V.output,V.next_out)));else this.onData(b$.shrinkBuf(V.output,V.next_out))}while((V.avail_in>0||V.avail_out===0)&&Y!==E9);if(X===i5)return Y=h$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===i0;if(X===g9)return this.onEnd(i0),V.avail_out=0,!0;return!0};N0.prototype.onData=function($){this.chunks.push($)};N0.prototype.onEnd=function($){if($===i0)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=b$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function a5($,Q){var V=new N0(Q);if(V.push($,!0),V.err)throw V.msg||r5[V.err];return V.result}function fK($,Q){return Q=Q||{},Q.raw=!0,a5($,Q)}function mK($,Q){return Q=Q||{},Q.gzip=!0,a5($,Q)}cK.Deflate=N0;cK.deflate=a5;cK.deflateRaw=fK;cK.gzip=mK});var h9=w((zz,D9)=>{var d6=30,oK=12;D9.exports=function(Q,V){var q,Y,X,J,G,U,K,W,j,H,z,C,P,M,B,L,T,O,I,R,F,v,x,b,A;q=Q.state,Y=Q.next_in,b=Q.input,X=Y+(Q.avail_in-5),J=Q.next_out,A=Q.output,G=J-(V-Q.avail_out),U=J+(Q.avail_out-257),K=q.dmax,W=q.wsize,j=q.whave,H=q.wnext,z=q.window,C=q.hold,P=q.bits,M=q.lencode,B=q.distcode,L=(1<<q.lenbits)-1,T=(1<<q.distbits)-1;$:do{if(P<15)C+=b[Y++]<<P,P+=8,C+=b[Y++]<<P,P+=8;O=M[C&L];Q:for(;;){if(I=O>>>24,C>>>=I,P-=I,I=O>>>16&255,I===0)A[J++]=O&65535;else if(I&16){if(R=O&65535,I&=15,I){if(P<I)C+=b[Y++]<<P,P+=8;R+=C&(1<<I)-1,C>>>=I,P-=I}if(P<15)C+=b[Y++]<<P,P+=8,C+=b[Y++]<<P,P+=8;O=B[C&T];V:for(;;){if(I=O>>>24,C>>>=I,P-=I,I=O>>>16&255,I&16){if(F=O&65535,I&=15,P<I){if(C+=b[Y++]<<P,P+=8,P<I)C+=b[Y++]<<P,P+=8}if(F+=C&(1<<I)-1,F>K){Q.msg="invalid distance too far back",q.mode=d6;break $}if(C>>>=I,P-=I,I=J-G,F>I){if(I=F-I,I>j){if(q.sane){Q.msg="invalid distance too far back",q.mode=d6;break $}}if(v=0,x=z,H===0){if(v+=W-I,I<R){R-=I;do A[J++]=z[v++];while(--I);v=J-F,x=A}}else if(H<I){if(v+=W+H-I,I-=H,I<R){R-=I;do A[J++]=z[v++];while(--I);if(v=0,H<R){I=H,R-=I;do A[J++]=z[v++];while(--I);v=J-F,x=A}}}else if(v+=H-I,I<R){R-=I;do A[J++]=z[v++];while(--I);v=J-F,x=A}while(R>2)A[J++]=x[v++],A[J++]=x[v++],A[J++]=x[v++],R-=3;if(R){if(A[J++]=x[v++],R>1)A[J++]=x[v++]}}else{v=J-F;do A[J++]=A[v++],A[J++]=A[v++],A[J++]=A[v++],R-=3;while(R>2);if(R){if(A[J++]=A[v++],R>1)A[J++]=A[v++]}}}else if((I&64)===0){O=B[(O&65535)+(C&(1<<I)-1)];continue V}else{Q.msg="invalid distance code",q.mode=d6;break $}break}}else if((I&64)===0){O=M[(O&65535)+(C&(1<<I)-1)];continue Q}else if(I&32){q.mode=oK;break $}else{Q.msg="invalid literal/length code",q.mode=d6;break $}break}}while(Y<X&&J<U);R=P>>3,Y-=R,P-=R<<3,C&=(1<<P)-1,Q.next_in=Y,Q.next_out=J,Q.avail_in=Y<X?5+(X-Y):5-(Y-X),Q.avail_out=J<U?257+(U-J):257-(J-U),q.hold=C,q.bits=P;return}});var u9=w((Pz,p9)=>{var b9=l1(),n0=15,_9=852,f9=592,m9=0,s5=1,c9=2,iK=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],nK=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],rK=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],aK=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];p9.exports=function(Q,V,q,Y,X,J,G,U){var K=U.bits,W=0,j=0,H=0,z=0,C=0,P=0,M=0,B=0,L=0,T=0,O,I,R,F,v,x=null,b=0,A,W1=new b9.Buf16(n0+1),F0=new b9.Buf16(n0+1),Q6=null,_Q=0,fQ,V6,q6;for(W=0;W<=n0;W++)W1[W]=0;for(j=0;j<Y;j++)W1[V[q+j]]++;C=K;for(z=n0;z>=1;z--)if(W1[z]!==0)break;if(C>z)C=z;if(z===0)return X[J++]=20971520,X[J++]=20971520,U.bits=1,0;for(H=1;H<z;H++)if(W1[H]!==0)break;if(C<H)C=H;B=1;for(W=1;W<=n0;W++)if(B<<=1,B-=W1[W],B<0)return-1;if(B>0&&(Q===m9||z!==1))return-1;F0[1]=0;for(W=1;W<n0;W++)F0[W+1]=F0[W]+W1[W];for(j=0;j<Y;j++)if(V[q+j]!==0)G[F0[V[q+j]]++]=j;if(Q===m9)x=Q6=G,A=19;else if(Q===s5)x=iK,b-=257,Q6=nK,_Q-=257,A=256;else x=rK,Q6=aK,A=-1;if(T=0,j=0,W=H,v=J,P=C,M=0,R=-1,L=1<<C,F=L-1,Q===s5&&L>_9||Q===c9&&L>f9)return 1;for(;;){if(fQ=W-M,G[j]<A)V6=0,q6=G[j];else if(G[j]>A)V6=Q6[_Q+G[j]],q6=x[b+G[j]];else V6=96,q6=0;O=1<<W-M,I=1<<P,H=I;do I-=O,X[v+(T>>M)+I]=fQ<<24|V6<<16|q6|0;while(I!==0);O=1<<W-1;while(T&O)O>>=1;if(O!==0)T&=O-1,T+=O;else T=0;if(j++,--W1[W]===0){if(W===z)break;W=V[q+G[j]]}if(W>C&&(T&F)!==R){if(M===0)M=C;v+=H,P=W-M,B=1<<P;while(P+M<z){if(B-=W1[P+M],B<=0)break;P++,B<<=1}if(L+=1<<P,Q===s5&&L>_9||Q===c9&&L>f9)return 1;R=T&F,X[R]=C<<24|P<<16|v-J|0}}if(T!==0)X[v+T]=W-M<<24|4194304|0;return U.bits=C,0}});var T2=w((PW)=>{var H1=l1(),qQ=f5(),b1=m5(),sK=h9(),_$=u9(),tK=0,P2=1,L2=2,d9=4,eK=5,l6=6,B0=0,$W=1,QW=2,I1=-2,I2=-3,JQ=-4,VW=-5,l9=8,O2=1,o9=2,i9=3,n9=4,r9=5,a9=6,s9=7,t9=8,e9=9,$2=10,n6=11,i1=12,t5=13,Q2=14,e5=15,V2=16,q2=17,J2=18,Y2=19,o6=20,i6=21,X2=22,G2=23,K2=24,W2=25,U2=26,$Q=27,j2=28,Z2=29,c=30,YQ=31,qW=32,JW=852,YW=592,XW=15,GW=XW;function H2($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function KW(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new H1.Buf16(320),this.work=new H1.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function N2($){var Q;if(!$||!$.state)return I1;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=O2,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new H1.Buf32(JW),Q.distcode=Q.distdyn=new H1.Buf32(YW),Q.sane=1,Q.back=-1,B0}function B2($){var Q;if(!$||!$.state)return I1;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,N2($)}function M2($,Q){var V,q;if(!$||!$.state)return I1;if(q=$.state,Q<0)V=0,Q=-Q;else if(V=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return I1;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=V,q.wbits=Q,B2($)}function C2($,Q){var V,q;if(!$)return I1;if(q=new KW,$.state=q,q.window=null,V=M2($,Q),V!==B0)$.state=null;return V}function WW($){return C2($,GW)}var z2=!0,QQ,VQ;function UW($){if(z2){var Q;QQ=new H1.Buf32(512),VQ=new H1.Buf32(32),Q=0;while(Q<144)$.lens[Q++]=8;while(Q<256)$.lens[Q++]=9;while(Q<280)$.lens[Q++]=7;while(Q<288)$.lens[Q++]=8;_$(P2,$.lens,0,288,QQ,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;_$(L2,$.lens,0,32,VQ,0,$.work,{bits:5}),z2=!1}$.lencode=QQ,$.lenbits=9,$.distcode=VQ,$.distbits=5}function w2($,Q,V,q){var Y,X=$.state;if(X.window===null)X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new H1.Buf8(X.wsize);if(q>=X.wsize)H1.arraySet(X.window,Q,V-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize;else{if(Y=X.wsize-X.wnext,Y>q)Y=q;if(H1.arraySet(X.window,Q,V-q,Y,X.wnext),q-=Y,q)H1.arraySet(X.window,Q,V-q,q,0),X.wnext=q,X.whave=X.wsize;else{if(X.wnext+=Y,X.wnext===X.wsize)X.wnext=0;if(X.whave<X.wsize)X.whave+=Y}}return 0}function jW($,Q){var V,q,Y,X,J,G,U,K,W,j,H,z,C,P,M=0,B,L,T,O,I,R,F,v,x=new H1.Buf8(4),b,A,W1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return I1;if(V=$.state,V.mode===i1)V.mode=t5;J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,j=G,H=U,v=B0;$:for(;;)switch(V.mode){case O2:if(V.wrap===0){V.mode=t5;break}while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.wrap&2&&K===35615){V.check=0,x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0),K=0,W=0,V.mode=o9;break}if(V.flags=0,V.head)V.head.done=!1;if(!(V.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",V.mode=c;break}if((K&15)!==l9){$.msg="unknown compression method",V.mode=c;break}if(K>>>=4,W-=4,F=(K&15)+8,V.wbits===0)V.wbits=F;else if(F>V.wbits){$.msg="invalid window size",V.mode=c;break}V.dmax=1<<F,$.adler=V.check=1,V.mode=K&512?$2:i1,K=0,W=0;break;case o9:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.flags=K,(V.flags&255)!==l9){$.msg="unknown compression method",V.mode=c;break}if(V.flags&57344){$.msg="unknown header flags set",V.mode=c;break}if(V.head)V.head.text=K>>8&1;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0,V.mode=i9;case i9:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.time=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,x[2]=K>>>16&255,x[3]=K>>>24&255,V.check=b1(V.check,x,4,0);K=0,W=0,V.mode=n9;case n9:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.xflags=K&255,V.head.os=K>>8;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0,V.mode=r9;case r9:if(V.flags&1024){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.length=K,V.head)V.head.extra_len=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=b1(V.check,x,2,0);K=0,W=0}else if(V.head)V.head.extra=null;V.mode=a9;case a9:if(V.flags&1024){if(z=V.length,z>G)z=G;if(z){if(V.head){if(F=V.head.extra_len-V.length,!V.head.extra)V.head.extra=Array(V.head.extra_len);H1.arraySet(V.head.extra,q,X,z,F)}if(V.flags&512)V.check=b1(V.check,q,z,X);G-=z,X+=z,V.length-=z}if(V.length)break $}V.length=0,V.mode=s9;case s9:if(V.flags&2048){if(G===0)break $;z=0;do if(F=q[X+z++],V.head&&F&&V.length<65536)V.head.name+=String.fromCharCode(F);while(F&&z<G);if(V.flags&512)V.check=b1(V.check,q,z,X);if(G-=z,X+=z,F)break $}else if(V.head)V.head.name=null;V.length=0,V.mode=t9;case t9:if(V.flags&4096){if(G===0)break $;z=0;do if(F=q[X+z++],V.head&&F&&V.length<65536)V.head.comment+=String.fromCharCode(F);while(F&&z<G);if(V.flags&512)V.check=b1(V.check,q,z,X);if(G-=z,X+=z,F)break $}else if(V.head)V.head.comment=null;V.mode=e9;case e9:if(V.flags&512){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.check&65535)){$.msg="header crc mismatch",V.mode=c;break}K=0,W=0}if(V.head)V.head.hcrc=V.flags>>9&1,V.head.done=!0;$.adler=V.check=0,V.mode=i1;break;case $2:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}$.adler=V.check=H2(K),K=0,W=0,V.mode=n6;case n6:if(V.havedict===0)return $.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,QW;$.adler=V.check=1,V.mode=i1;case i1:if(Q===eK||Q===l6)break $;case t5:if(V.last){K>>>=W&7,W-=W&7,V.mode=$Q;break}while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}switch(V.last=K&1,K>>>=1,W-=1,K&3){case 0:V.mode=Q2;break;case 1:if(UW(V),V.mode=o6,Q===l6){K>>>=2,W-=2;break $}break;case 2:V.mode=q2;break;case 3:$.msg="invalid block type",V.mode=c}K>>>=2,W-=2;break;case Q2:K>>>=W&7,W-=W&7;while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",V.mode=c;break}if(V.length=K&65535,K=0,W=0,V.mode=e5,Q===l6)break $;case e5:V.mode=V2;case V2:if(z=V.length,z){if(z>G)z=G;if(z>U)z=U;if(z===0)break $;H1.arraySet(Y,q,X,z,J),G-=z,X+=z,U-=z,J+=z,V.length-=z;break}V.mode=i1;break;case q2:while(W<14){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.nlen=(K&31)+257,K>>>=5,W-=5,V.ndist=(K&31)+1,K>>>=5,W-=5,V.ncode=(K&15)+4,K>>>=4,W-=4,V.nlen>286||V.ndist>30){$.msg="too many length or distance symbols",V.mode=c;break}V.have=0,V.mode=J2;case J2:while(V.have<V.ncode){while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.lens[W1[V.have++]]=K&7,K>>>=3,W-=3}while(V.have<19)V.lens[W1[V.have++]]=0;if(V.lencode=V.lendyn,V.lenbits=7,b={bits:V.lenbits},v=_$(tK,V.lens,0,19,V.lencode,0,V.work,b),V.lenbits=b.bits,v){$.msg="invalid code lengths set",V.mode=c;break}V.have=0,V.mode=Y2;case Y2:while(V.have<V.nlen+V.ndist){for(;;){if(M=V.lencode[K&(1<<V.lenbits)-1],B=M>>>24,L=M>>>16&255,T=M&65535,B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(T<16)K>>>=B,W-=B,V.lens[V.have++]=T;else{if(T===16){A=B+2;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K>>>=B,W-=B,V.have===0){$.msg="invalid bit length repeat",V.mode=c;break}F=V.lens[V.have-1],z=3+(K&3),K>>>=2,W-=2}else if(T===17){A=B+3;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,F=0,z=3+(K&7),K>>>=3,W-=3}else{A=B+7;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,F=0,z=11+(K&127),K>>>=7,W-=7}if(V.have+z>V.nlen+V.ndist){$.msg="invalid bit length repeat",V.mode=c;break}while(z--)V.lens[V.have++]=F}}if(V.mode===c)break;if(V.lens[256]===0){$.msg="invalid code -- missing end-of-block",V.mode=c;break}if(V.lenbits=9,b={bits:V.lenbits},v=_$(P2,V.lens,0,V.nlen,V.lencode,0,V.work,b),V.lenbits=b.bits,v){$.msg="invalid literal/lengths set",V.mode=c;break}if(V.distbits=6,V.distcode=V.distdyn,b={bits:V.distbits},v=_$(L2,V.lens,V.nlen,V.ndist,V.distcode,0,V.work,b),V.distbits=b.bits,v){$.msg="invalid distances set",V.mode=c;break}if(V.mode=o6,Q===l6)break $;case o6:V.mode=i6;case i6:if(G>=6&&U>=258){if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,sK($,H),J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,V.mode===i1)V.back=-1;break}V.back=0;for(;;){if(M=V.lencode[K&(1<<V.lenbits)-1],B=M>>>24,L=M>>>16&255,T=M&65535,B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(L&&(L&240)===0){O=B,I=L,R=T;for(;;){if(M=V.lencode[R+((K&(1<<O+I)-1)>>O)],B=M>>>24,L=M>>>16&255,T=M&65535,O+B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=O,W-=O,V.back+=O}if(K>>>=B,W-=B,V.back+=B,V.length=T,L===0){V.mode=U2;break}if(L&32){V.back=-1,V.mode=i1;break}if(L&64){$.msg="invalid literal/length code",V.mode=c;break}V.extra=L&15,V.mode=X2;case X2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.length+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}V.was=V.length,V.mode=G2;case G2:for(;;){if(M=V.distcode[K&(1<<V.distbits)-1],B=M>>>24,L=M>>>16&255,T=M&65535,B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((L&240)===0){O=B,I=L,R=T;for(;;){if(M=V.distcode[R+((K&(1<<O+I)-1)>>O)],B=M>>>24,L=M>>>16&255,T=M&65535,O+B<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=O,W-=O,V.back+=O}if(K>>>=B,W-=B,V.back+=B,L&64){$.msg="invalid distance code",V.mode=c;break}V.offset=T,V.extra=L&15,V.mode=K2;case K2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.offset+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}if(V.offset>V.dmax){$.msg="invalid distance too far back",V.mode=c;break}V.mode=W2;case W2:if(U===0)break $;if(z=H-U,V.offset>z){if(z=V.offset-z,z>V.whave){if(V.sane){$.msg="invalid distance too far back",V.mode=c;break}}if(z>V.wnext)z-=V.wnext,C=V.wsize-z;else C=V.wnext-z;if(z>V.length)z=V.length;P=V.window}else P=Y,C=J-V.offset,z=V.length;if(z>U)z=U;U-=z,V.length-=z;do Y[J++]=P[C++];while(--z);if(V.length===0)V.mode=i6;break;case U2:if(U===0)break $;Y[J++]=V.length,U--,V.mode=i6;break;case $Q:if(V.wrap){while(W<32){if(G===0)break $;G--,K|=q[X++]<<W,W+=8}if(H-=U,$.total_out+=H,V.total+=H,H)$.adler=V.check=V.flags?b1(V.check,Y,H,J-H):qQ(V.check,Y,H,J-H);if(H=U,(V.flags?K:H2(K))!==V.check){$.msg="incorrect data check",V.mode=c;break}K=0,W=0}V.mode=j2;case j2:if(V.wrap&&V.flags){while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.total&4294967295)){$.msg="incorrect length check",V.mode=c;break}K=0,W=0}V.mode=Z2;case Z2:v=$W;break $;case c:v=I2;break $;case YQ:return JQ;case qW:default:return I1}if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,V.wsize||H!==$.avail_out&&V.mode<c&&(V.mode<$Q||Q!==d9)){if(w2($,$.output,$.next_out,H-$.avail_out))return V.mode=YQ,JQ}if(j-=$.avail_in,H-=$.avail_out,$.total_in+=j,$.total_out+=H,V.total+=H,V.wrap&&H)$.adler=V.check=V.flags?b1(V.check,Y,H,$.next_out-H):qQ(V.check,Y,H,$.next_out-H);if($.data_type=V.bits+(V.last?64:0)+(V.mode===i1?128:0)+(V.mode===o6||V.mode===e5?256:0),(j===0&&H===0||Q===d9)&&v===B0)v=VW;return v}function ZW($){if(!$||!$.state)return I1;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,B0}function HW($,Q){var V;if(!$||!$.state)return I1;if(V=$.state,(V.wrap&2)===0)return I1;return V.head=Q,Q.done=!1,B0}function zW($,Q){var V=Q.length,q,Y,X;if(!$||!$.state)return I1;if(q=$.state,q.wrap!==0&&q.mode!==n6)return I1;if(q.mode===n6){if(Y=1,Y=qQ(Y,Q,V,0),Y!==q.check)return I2}if(X=w2($,Q,V,V),X)return q.mode=YQ,JQ;return q.havedict=1,B0}PW.inflateReset=B2;PW.inflateReset2=M2;PW.inflateResetKeep=N2;PW.inflateInit=WW;PW.inflateInit2=C2;PW.inflate=jW;PW.inflateEnd=ZW;PW.inflateGetHeader=HW;PW.inflateSetDictionary=zW;PW.inflateInfo="pako inflate (from Nodeca project)"});var XQ=w((Iz,A2)=>{A2.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var F2=w((Oz,R2)=>{function RW(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}R2.exports=RW});var x2=w((SW)=>{var r0=T2(),f$=l1(),r6=l5(),d=XQ(),GQ=h6(),FW=o5(),vW=F2(),v2=Object.prototype.toString;function M0($){if(!(this instanceof M0))return new M0($);this.options=f$.assign({chunkSize:16384,windowBits:0,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>=0&&Q.windowBits<16){if(Q.windowBits=-Q.windowBits,Q.windowBits===0)Q.windowBits=-15}if(Q.windowBits>=0&&Q.windowBits<16&&!($&&$.windowBits))Q.windowBits+=32;if(Q.windowBits>15&&Q.windowBits<48){if((Q.windowBits&15)===0)Q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new FW,this.strm.avail_out=0;var V=r0.inflateInit2(this.strm,Q.windowBits);if(V!==d.Z_OK)throw Error(GQ[V]);if(this.header=new vW,r0.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=r6.string2buf(Q.dictionary);else if(v2.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(V=r0.inflateSetDictionary(this.strm,Q.dictionary),V!==d.Z_OK)throw Error(GQ[V])}}}M0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,X,J,G,U,K,W=!1;if(this.ended)return!1;if(J=Q===~~Q?Q:Q===!0?d.Z_FINISH:d.Z_NO_FLUSH,typeof $==="string")V.input=r6.binstring2buf($);else if(v2.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new f$.Buf8(q),V.next_out=0,V.avail_out=q;if(X=r0.inflate(V,d.Z_NO_FLUSH),X===d.Z_NEED_DICT&&Y)X=r0.inflateSetDictionary(this.strm,Y);if(X===d.Z_BUF_ERROR&&W===!0)X=d.Z_OK,W=!1;if(X!==d.Z_STREAM_END&&X!==d.Z_OK)return this.onEnd(X),this.ended=!0,!1;if(V.next_out){if(V.avail_out===0||X===d.Z_STREAM_END||V.avail_in===0&&(J===d.Z_FINISH||J===d.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=r6.utf8border(V.output,V.next_out),U=V.next_out-G,K=r6.buf2string(V.output,G),V.next_out=U,V.avail_out=q-U,U)f$.arraySet(V.output,V.output,G,U,0);this.onData(K)}else this.onData(f$.shrinkBuf(V.output,V.next_out))}if(V.avail_in===0&&V.avail_out===0)W=!0}while((V.avail_in>0||V.avail_out===0)&&X!==d.Z_STREAM_END);if(X===d.Z_STREAM_END)J=d.Z_FINISH;if(J===d.Z_FINISH)return X=r0.inflateEnd(this.strm),this.onEnd(X),this.ended=!0,X===d.Z_OK;if(J===d.Z_SYNC_FLUSH)return this.onEnd(d.Z_OK),V.avail_out=0,!0;return!0};M0.prototype.onData=function($){this.chunks.push($)};M0.prototype.onEnd=function($){if($===d.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=f$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function KQ($,Q){var V=new M0(Q);if(V.push($,!0),V.err)throw V.msg||GQ[V.err];return V.result}function xW($,Q){return Q=Q||{},Q.raw=!0,KQ($,Q)}SW.Inflate=M0;SW.inflate=KQ;SW.inflateRaw=xW;SW.ungzip=KQ});var g2=w((Bz,E2)=>{var DW=l1().assign,hW=y9(),bW=x2(),_W=XQ(),S2={};DW(S2,hW,bW,_W);E2.exports=S2});var y2=w((pW)=>{var fW=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",mW=g2(),k2=p(),a6=Z1(),cW=fW?"uint8array":"array";pW.magic="\b\x00";function C0($,Q){a6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}k2.inherits(C0,a6);C0.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(k2.transformTo(cW,$.data),!1)};C0.prototype.flush=function(){if(a6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};C0.prototype.cleanUp=function(){a6.prototype.cleanUp.call(this),this._pako=null};C0.prototype._createPako=function(){this._pako=new mW[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};pW.compressWorker=function($){return new C0("Deflate",$)};pW.uncompressWorker=function(){return new C0("Inflate",{})}});var WQ=w((oW)=>{var D2=Z1();oW.STORE={magic:"\x00\x00",compressWorker:function(){return new D2("STORE compression")},uncompressWorker:function(){return new D2("STORE decompression")}};oW.DEFLATE=y2()});var UQ=w((rW)=>{rW.LOCAL_FILE_HEADER="PK\x03\x04";rW.CENTRAL_FILE_HEADER="PK\x01\x02";rW.CENTRAL_DIRECTORY_END="PK\x05\x06";rW.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";rW.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";rW.DATA_DESCRIPTOR="PK\x07\b"});var f2=w((Tz,_2)=>{var a0=p(),s0=Z1(),jQ=m0(),h2=g6(),s6=UQ(),h=function($,Q){var V="",q;for(q=0;q<Q;q++)V+=String.fromCharCode($&255),$=$>>>8;return V},VU=function($,Q){var V=$;if(!$)V=Q?16893:33204;return(V&65535)<<16},qU=function($){return($||0)&63},b2=function($,Q,V,q,Y,X){var{file:J,compression:G}=$,U=X!==jQ.utf8encode,K=a0.transformTo("string",X(J.name)),W=a0.transformTo("string",jQ.utf8encode(J.name)),j=J.comment,H=a0.transformTo("string",X(j)),z=a0.transformTo("string",jQ.utf8encode(j)),C=W.length!==J.name.length,P=z.length!==j.length,M,B,L="",T="",O="",I=J.dir,R=J.date,F={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||V)F.crc32=$.crc32,F.compressedSize=$.compressedSize,F.uncompressedSize=$.uncompressedSize;var v=0;if(Q)v|=8;if(!U&&(C||P))v|=2048;var x=0,b=0;if(I)x|=16;if(Y==="UNIX")b=798,x|=VU(J.unixPermissions,I);else b=20,x|=qU(J.dosPermissions,I);if(M=R.getUTCHours(),M=M<<6,M=M|R.getUTCMinutes(),M=M<<5,M=M|R.getUTCSeconds()/2,B=R.getUTCFullYear()-1980,B=B<<4,B=B|R.getUTCMonth()+1,B=B<<5,B=B|R.getUTCDate(),C)T=h(1,1)+h(h2(K),4)+W,L+="up"+h(T.length,2)+T;if(P)O=h(1,1)+h(h2(H),4)+z,L+="uc"+h(O.length,2)+O;var A="";A+=`
3
- \x00`,A+=h(v,2),A+=G.magic,A+=h(M,2),A+=h(B,2),A+=h(F.crc32,4),A+=h(F.compressedSize,4),A+=h(F.uncompressedSize,4),A+=h(K.length,2),A+=h(L.length,2);var W1=s6.LOCAL_FILE_HEADER+A+K+L,F0=s6.CENTRAL_FILE_HEADER+h(b,2)+A+h(H.length,2)+"\x00\x00\x00\x00"+h(x,4)+h(q,4)+K+L+H;return{fileRecord:W1,dirRecord:F0}},JU=function($,Q,V,q,Y){var X="",J=a0.transformTo("string",Y(q));return X=s6.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+h($,2)+h($,2)+h(Q,4)+h(V,4)+h(J.length,2)+J,X},YU=function($){var Q="";return Q=s6.DATA_DESCRIPTOR+h($.crc32,4)+h($.compressedSize,4)+h($.uncompressedSize,4),Q};function F1($,Q,V,q){s0.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=V,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a0.inherits(F1,s0);F1.prototype.push=function($){var Q=$.meta.percent||0,V=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,s0.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:V?(Q+100*(V-q-1))/V:100}})};F1.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var V=b2($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:V.fileRecord,meta:{percent:0}})}else this.accumulate=!0};F1.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,V=b2($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(V.dirRecord),Q)this.push({data:YU($),meta:{percent:100}});else{this.push({data:V.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};F1.prototype.flush=function(){var $=this.bytesWritten;for(var Q=0;Q<this.dirRecords.length;Q++)this.push({data:this.dirRecords[Q],meta:{percent:100}});var V=this.bytesWritten-$,q=JU(this.dirRecords.length,V,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};F1.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};F1.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(V){Q.error(V)}),this};F1.prototype.resume=function(){if(!s0.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};F1.prototype.error=function($){var Q=this._sources;if(!s0.prototype.error.call(this,$))return!1;for(var V=0;V<Q.length;V++)try{Q[V].error($)}catch(q){}return!0};F1.prototype.lock=function(){s0.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};_2.exports=F1});var m2=w((WU)=>{var XU=WQ(),GU=f2(),KU=function($,Q){var V=$||Q,q=XU[V];if(!q)throw Error(V+" is not a valid compression method !");return q};WU.generateWorker=function($,Q,V){var q=new GU(Q.streamFiles,V,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(X,J){Y++;var G=KU(J.options.compression,Q.compression),U=J.options.compressionOptions||Q.compressionOptions||{},K=J.dir,W=J.date;J._compressWorker(G,U).withStreamInfo("file",{name:X,dir:K,date:W,comment:J.comment||"",unixPermissions:J.unixPermissions,dosPermissions:J.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(X){q.error(X)}return q}});var p2=w((Rz,c2)=>{var jU=p(),t6=Z1();function m$($,Q){t6.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}jU.inherits(m$,t6);m$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(V){Q.push({data:V,meta:{percent:0}})}).on("error",function(V){if(Q.isPaused)this.generatedError=V;else Q.error(V)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};m$.prototype.pause=function(){if(!t6.prototype.pause.call(this))return!1;return this._stream.pause(),!0};m$.prototype.resume=function(){if(!t6.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};c2.exports=m$});var t2=w((Fz,s2)=>{var ZU=m0(),c$=p(),o2=Z1(),HU=P5(),i2=L5(),u2=k6(),zU=dq(),PU=m2(),d2=N$(),LU=p2(),n2=function($,Q,V){var q=c$.getTypeOf(Q),Y,X=c$.extend(V||{},i2);if(X.date=X.date||new Date,X.compression!==null)X.compression=X.compression.toUpperCase();if(typeof X.unixPermissions==="string")X.unixPermissions=parseInt(X.unixPermissions,8);if(X.unixPermissions&&X.unixPermissions&16384)X.dir=!0;if(X.dosPermissions&&X.dosPermissions&16)X.dir=!0;if(X.dir)$=r2($);if(X.createFolders&&(Y=IU($)))a2.call(this,Y,!0);var J=q==="string"&&X.binary===!1&&X.base64===!1;if(!V||typeof V.binary>"u")X.binary=!J;var G=Q instanceof u2&&Q.uncompressedSize===0;if(G||X.dir||!Q||Q.length===0)X.base64=!1,X.binary=!0,Q="",X.compression="STORE",q="string";var U=null;if(Q instanceof u2||Q instanceof o2)U=Q;else if(d2.isNode&&d2.isStream(Q))U=new LU($,Q);else U=c$.prepareContent($,Q,X.binary,X.optimizedBinaryString,X.base64);var K=new zU($,U,X);this.files[$]=K},IU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},r2=function($){if($.slice(-1)!=="/")$+="/";return $},a2=function($,Q){if(Q=typeof Q<"u"?Q:i2.createFolders,$=r2($),!this.files[$])n2.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function l2($){return Object.prototype.toString.call($)==="[object RegExp]"}var OU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,V,q;for(Q in this.files)if(q=this.files[Q],V=Q.slice(this.root.length,Q.length),V&&Q.slice(0,this.root.length)===this.root)$(V,q)},filter:function($){var Q=[];return this.forEach(function(V,q){if($(V,q))Q.push(q)}),Q},file:function($,Q,V){if(arguments.length===1)if(l2($)){var q=$;return this.filter(function(X,J){return!J.dir&&q.test(X)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,n2.call(this,$,Q,V);return this},folder:function($){if(!$)return this;if(l2($))return this.filter(function(Y,X){return X.dir&&$.test(Y)});var Q=this.root+$,V=a2.call(this,Q),q=this.clone();return q.root=V.name,q},remove:function($){$=this.root+$;var Q=this.files[$];if(!Q){if($.slice(-1)!=="/")$+="/";Q=this.files[$]}if(Q&&!Q.dir)delete this.files[$];else{var V=this.filter(function(Y,X){return X.name.slice(0,$.length)===$});for(var q=0;q<V.length;q++)delete this.files[V[q].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function($){var Q,V={};try{if(V=c$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:ZU.utf8encode}),V.type=V.type.toLowerCase(),V.compression=V.compression.toUpperCase(),V.type==="binarystring")V.type="string";if(!V.type)throw Error("No output type specified.");if(c$.checkSupport(V.type),V.platform==="darwin"||V.platform==="freebsd"||V.platform==="linux"||V.platform==="sunos")V.platform="UNIX";if(V.platform==="win32")V.platform="DOS";var q=V.comment||this.comment||"";Q=PU.generateWorker(this,V,q)}catch(Y){Q=new o2("error"),Q.error(Y)}return new HU(Q,V.type||"string",V.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};s2.exports=OU});var ZQ=w((vz,$7)=>{var NU=p();function e2($){this.data=$,this.length=$.length,this.index=0,this.zero=0}e2.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length<this.zero+$||$<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+$+"). Corrupted zip ?")},setIndex:function($){this.checkIndex($),this.index=$},skip:function($){this.setIndex(this.index+$)},byteAt:function(){},readInt:function($){var Q=0,V;this.checkOffset($);for(V=this.index+$-1;V>=this.index;V--)Q=(Q<<8)+this.byteAt(V);return this.index+=$,Q},readString:function($){return NU.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};$7.exports=e2});var HQ=w((xz,V7)=>{var Q7=ZQ(),BU=p();function t0($){Q7.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}BU.inherits(t0,Q7);t0.prototype.byteAt=function($){return this.data[this.zero+$]};t0.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var X=this.length-4;X>=0;--X)if(this.data[X]===Q&&this.data[X+1]===V&&this.data[X+2]===q&&this.data[X+3]===Y)return X-this.zero;return-1};t0.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),X=this.readData(4);return Q===X[0]&&V===X[1]&&q===X[2]&&Y===X[3]};t0.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};V7.exports=t0});var Y7=w((Sz,J7)=>{var q7=ZQ(),MU=p();function e0($){q7.call(this,$)}MU.inherits(e0,q7);e0.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};e0.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};e0.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};e0.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};J7.exports=e0});var PQ=w((Ez,G7)=>{var X7=HQ(),CU=p();function zQ($){X7.call(this,$)}CU.inherits(zQ,X7);zQ.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var Q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};G7.exports=zQ});var U7=w((gz,W7)=>{var K7=PQ(),wU=p();function LQ($){K7.call(this,$)}wU.inherits(LQ,K7);LQ.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};W7.exports=LQ});var IQ=w((kz,Z7)=>{var e6=p(),j7=d1(),TU=HQ(),AU=Y7(),RU=U7(),FU=PQ();Z7.exports=function($){var Q=e6.getTypeOf($);if(e6.checkSupport(Q),Q==="string"&&!j7.uint8array)return new AU($);if(Q==="nodebuffer")return new RU($);if(j7.uint8array)return new FU(e6.transformTo("uint8array",$));return new TU(e6.transformTo("array",$))}});var L7=w((yz,P7)=>{var OQ=IQ(),G0=p(),vU=k6(),H7=g6(),$8=m0(),Q8=WQ(),xU=d1(),SU=0,EU=3,gU=function($){for(var Q in Q8){if(!Object.prototype.hasOwnProperty.call(Q8,Q))continue;if(Q8[Q].magic===$)return Q8[Q]}return null};function z7($,Q){this.options=$,this.loadOptions=Q}z7.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,V;if($.skip(22),this.fileNameLength=$.readInt(2),V=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(V),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(Q=gU(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+G0.pretty(this.compressionMethod)+" unknown (inner file : "+G0.transformTo("string",this.fileName)+")");this.decompressed=new vU(this.compressedSize,this.uncompressedSize,this.crc32,Q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var Q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(Q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===SU)this.dosPermissions=this.externalFileAttributes&63;if($===EU)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=OQ(this.extraFields[1].value);if(this.uncompressedSize===G0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===G0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===G0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===G0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,V,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)V=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[V]={id:V,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=xU.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=$8.utf8decode(this.fileName),this.fileCommentStr=$8.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var V=G0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(V)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=G0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=OQ($.value);if(Q.readInt(1)!==1)return null;if(H7(this.fileName)!==Q.readInt(4))return null;return $8.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=OQ($.value);if(Q.readInt(1)!==1)return null;if(H7(this.fileComment)!==Q.readInt(4))return null;return $8.utf8decode(Q.readData($.length-5))}return null}};P7.exports=z7});var N7=w((Dz,O7)=>{var kU=IQ(),n1=p(),v1=UQ(),yU=L7(),DU=d1();function I7($){this.files=[],this.loadOptions=$}I7.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var Q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+n1.pretty(Q)+", expected "+n1.pretty($)+")")}},isSignature:function($,Q){var V=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(V),Y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),Q=DU.uint8array?"uint8array":"array",V=n1.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(V)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,Q=0,V,q,Y;while(Q<$)V=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[V]={id:V,length:q,value:Y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,Q;for($=0;$<this.files.length;$++)Q=this.files[$],this.reader.setIndex(Q.localHeaderOffset),this.checkSignature(v1.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(v1.CENTRAL_FILE_HEADER))$=new yU({zip64:this.zip64},this.loadOptions),$.readCentralPart(this.reader),this.files.push($);if(this.centralDirRecords!==this.files.length){if(this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}},readEndOfCentral:function(){var $=this.reader.lastIndexOfSignature(v1.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,v1.LOCAL_FILE_HEADER);if(Q)throw Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");else throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex($);var V=$;if(this.checkSignature(v1.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n1.MAX_VALUE_16BITS||this.centralDirRecords===n1.MAX_VALUE_16BITS||this.centralDirSize===n1.MAX_VALUE_32BITS||this.centralDirOffset===n1.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),$<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex($),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,v1.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory")}this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=V-q;if(Y>0)if(this.isSignature(V,v1.CENTRAL_FILE_HEADER));else this.reader.zero=Y;else if(Y<0)throw Error("Corrupted zip: missing "+Math.abs(Y)+" bytes.")},prepareReader:function($){this.reader=kU($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};O7.exports=I7});var C7=w((hz,M7)=>{var NQ=p(),V8=b0(),hU=m0(),bU=N7(),_U=N5(),B7=N$();function fU($){return new V8.Promise(function(Q,V){var q=$.decompressed.getContentWorker().pipe(new _U);q.on("error",function(Y){V(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)V(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}M7.exports=function($,Q){var V=this;if(Q=NQ.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:hU.utf8decode}),B7.isNode&&B7.isStream($))return V8.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return NQ.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new bU(Q);return Y.load(q),Y}).then(function(Y){var X=[V8.Promise.resolve(Y)],J=Y.files;if(Q.checkCRC32)for(var G=0;G<J.length;G++)X.push(fU(J[G]));return V8.Promise.all(X)}).then(function(Y){var X=Y.shift(),J=X.files;for(var G=0;G<J.length;G++){var U=J[G],K=U.fileNameStr,W=NQ.resolve(U.fileNameStr);if(V.file(W,U.decompressed,{binary:!0,optimizedBinaryString:!0,date:U.date,dir:U.dir,comment:U.fileCommentStr.length?U.fileCommentStr:null,unixPermissions:U.unixPermissions,dosPermissions:U.dosPermissions,createFolders:Q.createFolders}),!U.dir)V.file(W).unsafeOriginalName=K}if(X.zipComment.length)V.comment=X.zipComment;return V})}});var T7=w((bz,w7)=>{function O1(){if(!(this instanceof O1))return new O1;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new O1;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}O1.prototype=t2();O1.prototype.loadAsync=C7();O1.support=d1();O1.defaults=L5();O1.version="3.10.1";O1.loadAsync=function($,Q){return new O1().loadAsync($,Q)};O1.external=b0();w7.exports=O1});import{mkdir as _J,readdir as SZ,readFile as hQ,stat as lJ,writeFile as H8}from"node:fs/promises";import{homedir as fJ}from"node:os";import X1 from"node:path";import{stripVTControlCharacters as x8}from"node:util";var e=C1(N8(),1);import{stdin as eQ,stdout as $V}from"node:process";import*as s1 from"node:readline";import dQ from"node:readline";import{Writable as WY}from"node:stream";function UY({onlyFirst:$=!1}={}){let Q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Q,$?void 0:"g")}var jY=UY();function QV($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(jY,"")}function VV($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var qV={exports:{}};(function($){var Q={};$.exports=Q,Q.eastAsianWidth=function(q){var Y=q.charCodeAt(0),X=q.length==2?q.charCodeAt(1):0,J=Y;return 55296<=Y&&Y<=56319&&56320<=X&&X<=57343&&(Y&=1023,X&=1023,J=Y<<10|X,J+=65536),J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510?"F":J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518?"H":4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141?"W":32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630?"Na":J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109?"A":"N"},Q.characterLength=function(q){var Y=this.eastAsianWidth(q);return Y=="F"||Y=="W"||Y=="A"?2:1};function V(q){return q.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}Q.length=function(q){for(var Y=V(q),X=0,J=0;J<Y.length;J++)X=X+this.characterLength(Y[J]);return X},Q.slice=function(q,Y,X){textLen=Q.length(q),Y=Y||0,X=X||1,Y<0&&(Y=textLen+Y),X<0&&(X=textLen+X);for(var J="",G=0,U=V(q),K=0;K<U.length;K++){var W=U[K],j=Q.length(W);if(G>=Y-(j==2?1:0))if(G+j<=X)J+=W;else break;G+=j}return J}})(qV);var ZY=qV.exports,HY=VV(ZY),zY=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},PY=VV(zY);function Y$($,Q={}){if(typeof $!="string"||$.length===0||(Q={ambiguousIsNarrow:!0,...Q},$=QV($),$.length===0))return 0;$=$.replace(PY()," ");let V=Q.ambiguousIsNarrow?1:2,q=0;for(let Y of $){let X=Y.codePointAt(0);if(X<=31||X>=127&&X<=159||X>=768&&X<=879)continue;switch(HY.eastAsianWidth(Y)){case"F":case"W":q+=2;break;case"A":q+=V;break;default:q+=1}}return q}var M8=10,lQ=($=0)=>(Q)=>`\x1B[${Q+$}m`,oQ=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,iQ=($=0)=>(Q,V,q)=>`\x1B[${38+$};2;${Q};${V};${q}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(f.modifier);var LY=Object.keys(f.color),IY=Object.keys(f.bgColor);[...LY,...IY];function OY(){let $=new Map;for(let[Q,V]of Object.entries(f)){for(let[q,Y]of Object.entries(V))f[q]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},V[q]=f[q],$.set(Y[0],Y[1]);Object.defineProperty(f,Q,{value:V,enumerable:!1})}return Object.defineProperty(f,"codes",{value:$,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=lQ(),f.color.ansi256=oQ(),f.color.ansi16m=iQ(),f.bgColor.ansi=lQ(M8),f.bgColor.ansi256=oQ(M8),f.bgColor.ansi16m=iQ(M8),Object.defineProperties(f,{rgbToAnsi256:{value:(Q,V,q)=>Q===V&&V===q?Q<8?16:Q>248?231:Math.round((Q-8)/247*24)+232:16+36*Math.round(Q/255*5)+6*Math.round(V/255*5)+Math.round(q/255*5),enumerable:!1},hexToRgb:{value:(Q)=>{let V=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!V)return[0,0,0];let[q]=V;q.length===3&&(q=[...q].map((X)=>X+X).join(""));let Y=Number.parseInt(q,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>f.rgbToAnsi256(...f.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value:(Q)=>{if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let V,q,Y;if(Q>=232)V=((Q-232)*10+8)/255,q=V,Y=V;else{Q-=16;let G=Q%36;V=Math.floor(Q/36)/5,q=Math.floor(G/6)/5,Y=G%6/5}let X=Math.max(V,q,Y)*2;if(X===0)return 30;let J=30+(Math.round(Y)<<2|Math.round(q)<<1|Math.round(V));return X===2&&(J+=60),J},enumerable:!1},rgbToAnsi:{value:(Q,V,q)=>f.ansi256ToAnsi(f.rgbToAnsi256(Q,V,q)),enumerable:!1},hexToAnsi:{value:(Q)=>f.ansi256ToAnsi(f.hexToAnsi256(Q)),enumerable:!1}}),f}var NY=OY(),K6=new Set(["\x1B","›"]),BY=39,T8="\x07",JV="[",MY="]",YV="m",A8=`${MY}8;;`,nQ=($)=>`${K6.values().next().value}${JV}${$}${YV}`,rQ=($)=>`${K6.values().next().value}${A8}${$}${T8}`,CY=($)=>$.split(" ").map((Q)=>Y$(Q)),C8=($,Q,V)=>{let q=[...Q],Y=!1,X=!1,J=Y$(QV($[$.length-1]));for(let[G,U]of q.entries()){let K=Y$(U);if(J+K<=V?$[$.length-1]+=U:($.push(U),J=0),K6.has(U)&&(Y=!0,X=q.slice(G+1).join("").startsWith(A8)),Y){X?U===T8&&(Y=!1,X=!1):U===YV&&(Y=!1);continue}J+=K,J===V&&G<q.length-1&&($.push(""),J=0)}!J&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},wY=($)=>{let Q=$.split(" "),V=Q.length;for(;V>0&&!(Y$(Q[V-1])>0);)V--;return V===Q.length?$:Q.slice(0,V).join(" ")+Q.slice(V).join("")},TY=($,Q,V={})=>{if(V.trim!==!1&&$.trim()==="")return"";let q="",Y,X,J=CY($),G=[""];for(let[K,W]of $.split(" ").entries()){V.trim!==!1&&(G[G.length-1]=G[G.length-1].trimStart());let j=Y$(G[G.length-1]);if(K!==0&&(j>=Q&&(V.wordWrap===!1||V.trim===!1)&&(G.push(""),j=0),(j>0||V.trim===!1)&&(G[G.length-1]+=" ",j++)),V.hard&&J[K]>Q){let H=Q-j,z=1+Math.floor((J[K]-H-1)/Q);Math.floor((J[K]-1)/Q)<z&&G.push(""),C8(G,W,Q);continue}if(j+J[K]>Q&&j>0&&J[K]>0){if(V.wordWrap===!1&&j<Q){C8(G,W,Q);continue}G.push("")}if(j+J[K]>Q&&V.wordWrap===!1){C8(G,W,Q);continue}G[G.length-1]+=W}V.trim!==!1&&(G=G.map((K)=>wY(K)));let U=[...G.join(`
4
- `)];for(let[K,W]of U.entries()){if(q+=W,K6.has(W)){let{groups:H}=new RegExp(`(?:\\${JV}(?<code>\\d+)m|\\${A8}(?<uri>.*)${T8})`).exec(U.slice(K).join(""))||{groups:{}};if(H.code!==void 0){let z=Number.parseFloat(H.code);Y=z===BY?void 0:z}else H.uri!==void 0&&(X=H.uri.length===0?void 0:H.uri)}let j=NY.codes.get(Number(Y));U[K+1]===`
5
- `?(X&&(q+=rQ("")),Y&&j&&(q+=nQ(j))):W===`
6
- `&&(Y&&j&&(q+=nQ(Y)),X&&(q+=rQ(X)))}return q};function aQ($,Q,V){return String($).normalize().replace(/\r\n/g,`
2
+ import{createRequire as FY}from"node:module";var OY=Object.create;var{getPrototypeOf:BY,defineProperty:I8,getOwnPropertyNames:NY}=Object;var MY=Object.prototype.hasOwnProperty;function IY($){return this[$]}var CY,wY,I1=($,Q,V)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?CY??=new WeakMap:wY??=new WeakMap,X=Y.get($);if(X)return X}V=$!=null?OY(BY($)):{};let J=Q||!$||!$.__esModule?I8(V,"default",{value:$,enumerable:!0}):V;for(let G of NY($))if(!MY.call(J,G))I8(J,G,{get:IY.bind($,G),enumerable:!0});if(q)Y.set($,J);return J};var w=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var TY=($)=>$;function AY($,Q){this[$]=TY.bind(null,Q)}var iQ=($,Q)=>{for(var V in Q)I8($,V,{get:Q[V],enumerable:!0,configurable:!0,set:AY.bind(Q,V)})};var nQ=($,Q)=>()=>($&&(Q=$($=0)),Q);var d=FY(import.meta.url);var w8=w((lz,rQ)=>{var C8={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let V="";if($<0)V+=`\x1B[${-$}D`;else if($>0)V+=`\x1B[${$}C`;if(Q<0)V+=`\x1B[${-Q}A`;else if(Q>0)V+=`\x1B[${Q}B`;return V},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},RY={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},vY={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Q="";for(let V=0;V<$;V++)Q+=this.line+(V<$-1?C8.up():"");if($)Q+=C8.left;return Q}};rQ.exports={cursor:C8,scroll:RY,erase:vY,beep:"\x07"}});var c1=w((oz,T8)=>{var G6=process||{},aQ=G6.argv||[],X6=G6.env||{},xY=!(!!X6.NO_COLOR||aQ.includes("--no-color"))&&(!!X6.FORCE_COLOR||aQ.includes("--color")||G6.platform==="win32"||(G6.stdout||{}).isTTY&&X6.TERM!=="dumb"||!!X6.CI),SY=($,Q,V=$)=>(q)=>{let Y=""+q,X=Y.indexOf(Q,$.length);return~X?$+EY(Y,Q,V,X)+Q:$+Y+Q},EY=($,Q,V,q)=>{let Y="",X=0;do Y+=$.substring(X,q)+V,X=q+Q.length,q=$.indexOf(Q,X);while(~q);return Y+$.substring(X)},sQ=($=xY)=>{let Q=$?SY:()=>String;return{isColorSupported:$,reset:Q("\x1B[0m","\x1B[0m"),bold:Q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Q("\x1B[3m","\x1B[23m"),underline:Q("\x1B[4m","\x1B[24m"),inverse:Q("\x1B[7m","\x1B[27m"),hidden:Q("\x1B[8m","\x1B[28m"),strikethrough:Q("\x1B[9m","\x1B[29m"),black:Q("\x1B[30m","\x1B[39m"),red:Q("\x1B[31m","\x1B[39m"),green:Q("\x1B[32m","\x1B[39m"),yellow:Q("\x1B[33m","\x1B[39m"),blue:Q("\x1B[34m","\x1B[39m"),magenta:Q("\x1B[35m","\x1B[39m"),cyan:Q("\x1B[36m","\x1B[39m"),white:Q("\x1B[37m","\x1B[39m"),gray:Q("\x1B[90m","\x1B[39m"),bgBlack:Q("\x1B[40m","\x1B[49m"),bgRed:Q("\x1B[41m","\x1B[49m"),bgGreen:Q("\x1B[42m","\x1B[49m"),bgYellow:Q("\x1B[43m","\x1B[49m"),bgBlue:Q("\x1B[44m","\x1B[49m"),bgMagenta:Q("\x1B[45m","\x1B[49m"),bgCyan:Q("\x1B[46m","\x1B[49m"),bgWhite:Q("\x1B[47m","\x1B[49m"),blackBright:Q("\x1B[90m","\x1B[39m"),redBright:Q("\x1B[91m","\x1B[39m"),greenBright:Q("\x1B[92m","\x1B[39m"),yellowBright:Q("\x1B[93m","\x1B[39m"),blueBright:Q("\x1B[94m","\x1B[39m"),magentaBright:Q("\x1B[95m","\x1B[39m"),cyanBright:Q("\x1B[96m","\x1B[39m"),whiteBright:Q("\x1B[97m","\x1B[39m"),bgBlackBright:Q("\x1B[100m","\x1B[49m"),bgRedBright:Q("\x1B[101m","\x1B[49m"),bgGreenBright:Q("\x1B[102m","\x1B[49m"),bgYellowBright:Q("\x1B[103m","\x1B[49m"),bgBlueBright:Q("\x1B[104m","\x1B[49m"),bgMagentaBright:Q("\x1B[105m","\x1B[49m"),bgCyanBright:Q("\x1B[106m","\x1B[49m"),bgWhiteBright:Q("\x1B[107m","\x1B[49m")}};T8.exports=sQ();T8.exports.createColors=sQ});var W$=w((WH,b8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)b8.exports={nextTick:L4};else b8.exports=process;function L4($,Q,V,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,X,J;switch(Y){case 0:case 1:return process.nextTick($);case 2:return process.nextTick(function(){$.call(null,Q)});case 3:return process.nextTick(function(){$.call(null,Q,V)});case 4:return process.nextTick(function(){$.call(null,Q,V,q)});default:X=Array(Y-1),J=0;while(J<X.length)X[J++]=arguments[J];return process.nextTick(function(){$.apply(null,X)})}}});var wV=w((UH,CV)=>{var O4={}.toString;CV.exports=Array.isArray||function($){return O4.call($)=="[object Array]"}});var U$=w((m8,AV)=>{var P6=d("buffer"),p1=P6.Buffer;function TV($,Q){for(var V in $)Q[V]=$[V]}if(p1.from&&p1.alloc&&p1.allocUnsafe&&p1.allocUnsafeSlow)AV.exports=P6;else TV(P6,m8),m8.Buffer=S0;function S0($,Q,V){return p1($,Q,V)}TV(p1,S0);S0.from=function($,Q,V){if(typeof $==="number")throw TypeError("Argument must not be a number");return p1($,Q,V)};S0.alloc=function($,Q,V){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=p1($);if(Q!==void 0)if(typeof V==="string")q.fill(Q,V);else q.fill(Q);else q.fill(0);return q};S0.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return p1($)};S0.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return P6.SlowBuffer($)}});var E0=w((g4)=>{function B4($){if(Array.isArray)return Array.isArray($);return L6($)==="[object Array]"}g4.isArray=B4;function N4($){return typeof $==="boolean"}g4.isBoolean=N4;function M4($){return $===null}g4.isNull=M4;function I4($){return $==null}g4.isNullOrUndefined=I4;function C4($){return typeof $==="number"}g4.isNumber=C4;function w4($){return typeof $==="string"}g4.isString=w4;function T4($){return typeof $==="symbol"}g4.isSymbol=T4;function A4($){return $===void 0}g4.isUndefined=A4;function F4($){return L6($)==="[object RegExp]"}g4.isRegExp=F4;function R4($){return typeof $==="object"&&$!==null}g4.isObject=R4;function v4($){return L6($)==="[object Date]"}g4.isDate=v4;function x4($){return L6($)==="[object Error]"||$ instanceof Error}g4.isError=x4;function S4($){return typeof $==="function"}g4.isFunction=S4;function E4($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}g4.isPrimitive=E4;g4.isBuffer=d("buffer").Buffer.isBuffer;function L6($){return Object.prototype.toString.call($)}});var FV=w((ZH,c8)=>{if(typeof Object.create==="function")c8.exports=function(Q,V){if(V)Q.super_=V,Q.prototype=Object.create(V.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else c8.exports=function(Q,V){if(V){Q.super_=V;var q=function(){};q.prototype=V.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var g0=w((zH,p8)=>{try{if(O6=d("util"),typeof O6.inherits!=="function")throw"";p8.exports=O6.inherits}catch($){p8.exports=FV()}var O6});var vV=w((HH,u8)=>{function n4($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var RV=U$().Buffer,j$=d("util");function r4($,Q,V){$.copy(Q,V)}u8.exports=function(){function $(){n4(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(V){var q={data:V,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(V){var q={data:V,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var V=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,V},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(V){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=V+q.data;return Y},$.prototype.concat=function(V){if(this.length===0)return RV.alloc(0);var q=RV.allocUnsafe(V>>>0),Y=this.head,X=0;while(Y)r4(Y.data,q,X),X+=Y.data.length,Y=Y.next;return q},$}();if(j$&&j$.inspect&&j$.inspect.custom)u8.exports.prototype[j$.inspect.custom]=function(){var $=j$.inspect({length:this.length});return this.constructor.name+" "+$}});var d8=w((PH,xV)=>{var B6=W$();function a4($,Q){var V=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)B6.nextTick(N6,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,B6.nextTick(N6,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(X){if(!Q&&X){if(!V._writableState)B6.nextTick(N6,V,X);else if(!V._writableState.errorEmitted)V._writableState.errorEmitted=!0,B6.nextTick(N6,V,X)}else if(Q)Q(X)}),this}function s4(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function N6($,Q){$.emit("error",Q)}xV.exports={destroy:a4,undestroy:s4}});var EV=w((LH,SV)=>{SV.exports=d("util").deprecate});var o8=w((OH,bV)=>{var j0=W$();bV.exports=l;function yV($){var Q=this;this.next=null,this.entry=null,this.finish=function(){PX(Q,$)}}var t4=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:j0.nextTick,y0;l.WritableState=z$;var kV=Object.create(E0());kV.inherits=g0();var e4={deprecate:EV()},DV=d("stream"),I6=U$().Buffer,$X=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function QX($){return I6.from($)}function VX($){return I6.isBuffer($)||$ instanceof $X}var hV=d8();kV.inherits(l,DV);function qX(){}function z$($,Q){y0=y0||Z0(),$=$||{};var V=Q instanceof y0;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=$.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){UX(Q,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new yV(this)}z$.prototype.getBuffer=function(){var Q=this.bufferedRequest,V=[];while(Q)V.push(Q),Q=Q.next;return V};(function(){try{Object.defineProperty(z$.prototype,"buffer",{get:e4.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var M6;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")M6=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function($){if(M6.call(this,$))return!0;if(this!==l)return!1;return $&&$._writableState instanceof z$}});else M6=function($){return $ instanceof this};function l($){if(y0=y0||Z0(),!M6.call(l,this)&&!(this instanceof y0))return new l($);if(this._writableState=new z$($,this),this.writable=!0,$){if(typeof $.write==="function")this._write=$.write;if(typeof $.writev==="function")this._writev=$.writev;if(typeof $.destroy==="function")this._destroy=$.destroy;if(typeof $.final==="function")this._final=$.final}DV.call(this)}l.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function JX($,Q){var V=Error("write after end");$.emit("error",V),j0.nextTick(Q,V)}function YX($,Q,V,q){var Y=!0,X=!1;if(V===null)X=TypeError("May not write null values to stream");else if(typeof V!=="string"&&V!==void 0&&!Q.objectMode)X=TypeError("Invalid non-string/buffer chunk");if(X)$.emit("error",X),j0.nextTick(q,X),Y=!1;return Y}l.prototype.write=function($,Q,V){var q=this._writableState,Y=!1,X=!q.objectMode&&VX($);if(X&&!I6.isBuffer($))$=QX($);if(typeof Q==="function")V=Q,Q=null;if(X)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof V!=="function")V=qX;if(q.ended)JX(this,V);else if(X||YX(this,q,$,V))q.pendingcb++,Y=GX(this,q,X,$,Q,V);return Y};l.prototype.cork=function(){var $=this._writableState;$.corked++};l.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)_V(this,$)}};l.prototype.setDefaultEncoding=function(Q){if(typeof Q==="string")Q=Q.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Q+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+Q);return this._writableState.defaultEncoding=Q,this};function XX($,Q,V){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=I6.from(Q,V);return Q}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function GX($,Q,V,q,Y,X){if(!V){var J=XX(Q,q,Y);if(q!==J)V=!0,Y="buffer",q=J}var G=Q.objectMode?1:q.length;Q.length+=G;var U=Q.length<Q.highWaterMark;if(!U)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:q,encoding:Y,isBuf:V,callback:X,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else l8($,Q,!1,G,q,Y,X);return U}function l8($,Q,V,q,Y,X,J){if(Q.writelen=q,Q.writecb=J,Q.writing=!0,Q.sync=!0,V)$._writev(Y,Q.onwrite);else $._write(Y,X,Q.onwrite);Q.sync=!1}function KX($,Q,V,q,Y){if(--Q.pendingcb,V)j0.nextTick(Y,q),j0.nextTick(Z$,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),Z$($,Q)}function WX($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function UX($,Q){var V=$._writableState,q=V.sync,Y=V.writecb;if(WX(V),Q)KX($,V,q,Q,Y);else{var X=fV(V);if(!X&&!V.corked&&!V.bufferProcessing&&V.bufferedRequest)_V($,V);if(q)t4(gV,$,V,X,Y);else gV($,V,X,Y)}}function gV($,Q,V,q){if(!V)jX($,Q);Q.pendingcb--,q(),Z$($,Q)}function jX($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function _V($,Q){Q.bufferProcessing=!0;var V=Q.bufferedRequest;if($._writev&&V&&V.next){var q=Q.bufferedRequestCount,Y=Array(q),X=Q.corkedRequestsFree;X.entry=V;var J=0,G=!0;while(V){if(Y[J]=V,!V.isBuf)G=!1;V=V.next,J+=1}if(Y.allBuffers=G,l8($,Q,!0,Q.length,Y,"",X.finish),Q.pendingcb++,Q.lastBufferedRequest=null,X.next)Q.corkedRequestsFree=X.next,X.next=null;else Q.corkedRequestsFree=new yV(Q);Q.bufferedRequestCount=0}else{while(V){var{chunk:U,encoding:K,callback:W}=V,Z=Q.objectMode?1:U.length;if(l8($,Q,!1,Z,U,K,W),V=V.next,Q.bufferedRequestCount--,Q.writing)break}if(V===null)Q.lastBufferedRequest=null}Q.bufferedRequest=V,Q.bufferProcessing=!1}l.prototype._write=function($,Q,V){V(Error("_write() is not implemented"))};l.prototype._writev=null;l.prototype.end=function($,Q,V){var q=this._writableState;if(typeof $==="function")V=$,$=null,Q=null;else if(typeof Q==="function")V=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)HX(this,q,V)};function fV($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function ZX($,Q){$._final(function(V){if(Q.pendingcb--,V)$.emit("error",V);Q.prefinished=!0,$.emit("prefinish"),Z$($,Q)})}function zX($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,j0.nextTick(ZX,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function Z$($,Q){var V=fV(Q);if(V){if(zX($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return V}function HX($,Q,V){if(Q.ending=!0,Z$($,Q),V)if(Q.finished)j0.nextTick(V);else $.once("finish",V);Q.ended=!0,$.writable=!1}function PX($,Q,V){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(V),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(l.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});l.prototype.destroy=hV.destroy;l.prototype._undestroy=hV.undestroy;l.prototype._destroy=function($,Q){this.end(),Q($)}});var Z0=w((BH,uV)=>{var mV=W$(),LX=Object.keys||function($){var Q=[];for(var V in $)Q.push(V);return Q};uV.exports=u1;var cV=Object.create(E0());cV.inherits=g0();var pV=n8(),i8=o8();cV.inherits(u1,pV);{C6=LX(i8.prototype);for(H$=0;H$<C6.length;H$++)if(P$=C6[H$],!u1.prototype[P$])u1.prototype[P$]=i8.prototype[P$]}var C6,P$,H$;function u1($){if(!(this instanceof u1))return new u1($);if(pV.call(this,$),i8.call(this,$),$&&$.readable===!1)this.readable=!1;if($&&$.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,$&&$.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",OX)}Object.defineProperty(u1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function OX(){if(this.allowHalfOpen||this._writableState.ended)return;mV.nextTick(BX,this)}function BX($){$.end()}Object.defineProperty(u1.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function($){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=$,this._writableState.destroyed=$}});u1.prototype._destroy=function($,Q){this.push(null),this.end(),mV.nextTick(Q,$)}});var s8=w((gX)=>{var a8=U$().Buffer,dV=a8.isEncoding||function($){switch($=""+$,$&&$.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 NX($){if(!$)return"utf8";var Q;while(!0)switch($){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 $;default:if(Q)return;$=(""+$).toLowerCase(),Q=!0}}function MX($){var Q=NX($);if(typeof Q!=="string"&&(a8.isEncoding===dV||!dV($)))throw Error("Unknown encoding: "+$);return Q||$}gX.StringDecoder=L$;function L$($){this.encoding=MX($);var Q;switch(this.encoding){case"utf16le":this.text=FX,this.end=RX,Q=4;break;case"utf8":this.fillLast=wX,Q=4;break;case"base64":this.text=vX,this.end=xX,Q=3;break;default:this.write=SX,this.end=EX;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=a8.allocUnsafe(Q)}L$.prototype.write=function($){if($.length===0)return"";var Q,V;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";V=this.lastNeed,this.lastNeed=0}else V=0;if(V<$.length)return Q?Q+this.text($,V):this.text($,V);return Q||""};L$.prototype.end=AX;L$.prototype.text=TX;L$.prototype.fillLast=function($){if(this.lastNeed<=$.length)return $.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length),this.lastNeed-=$.length};function r8($){if($<=127)return 0;else if($>>5===6)return 2;else if($>>4===14)return 3;else if($>>3===30)return 4;return $>>6===2?-1:-2}function IX($,Q,V){var q=Q.length-1;if(q<V)return 0;var Y=r8(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<V||Y===-2)return 0;if(Y=r8(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<V||Y===-2)return 0;if(Y=r8(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function CX($,Q,V){if((Q[0]&192)!==128)return $.lastNeed=0,"�";if($.lastNeed>1&&Q.length>1){if((Q[1]&192)!==128)return $.lastNeed=1,"�";if($.lastNeed>2&&Q.length>2){if((Q[2]&192)!==128)return $.lastNeed=2,"�"}}}function wX($){var Q=this.lastTotal-this.lastNeed,V=CX(this,$,Q);if(V!==void 0)return V;if(this.lastNeed<=$.length)return $.copy(this.lastChar,Q,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,Q,0,$.length),this.lastNeed-=$.length}function TX($,Q){var V=IX(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=V;var q=$.length-(V-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function AX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function FX($,Q){if(($.length-Q)%2===0){var V=$.toString("utf16le",Q);if(V){var q=V.charCodeAt(V.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],V.slice(0,-1)}return V}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function RX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var V=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,V)}return Q}function vX($,Q){var V=($.length-Q)%3;if(V===0)return $.toString("base64",Q);if(this.lastNeed=3-V,this.lastTotal=3,V===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-V)}function xX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function SX($){return $.toString(this.encoding)}function EX($){return $&&$.length?this.write($):""}});var n8=w((IH,Vq)=>{var D0=W$();Vq.exports=_;var kX=wV(),O$;_.ReadableState=sV;var MH=d("events").EventEmitter,nV=function($,Q){return $.listeners(Q).length},V5=d("stream"),B$=U$().Buffer,DX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function hX($){return B$.from($)}function _X($){return B$.isBuffer($)||$ instanceof DX}var rV=Object.create(E0());rV.inherits=g0();var t8=d("util"),g=void 0;if(t8&&t8.debuglog)g=t8.debuglog("stream");else g=function(){};var fX=vV(),aV=d8(),k0;rV.inherits(_,V5);var e8=["error","close","destroy","pause","resume"];function bX($,Q,V){if(typeof $.prependListener==="function")return $.prependListener(Q,V);if(!$._events||!$._events[Q])$.on(Q,V);else if(kX($._events[Q]))$._events[Q].unshift(V);else $._events[Q]=[V,$._events[Q]]}function sV($,Q){O$=O$||Z0(),$=$||{};var V=Q instanceof O$;if(this.objectMode=!!$.objectMode,V)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(V&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new fX,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=$.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,$.encoding){if(!k0)k0=s8().StringDecoder;this.decoder=new k0($.encoding),this.encoding=$.encoding}}function _($){if(O$=O$||Z0(),!(this instanceof _))return new _($);if(this._readableState=new sV($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}V5.call(this)}Object.defineProperty(_.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});_.prototype.destroy=aV.destroy;_.prototype._undestroy=aV.undestroy;_.prototype._destroy=function($,Q){this.push(null),Q($)};_.prototype.push=function($,Q){var V=this._readableState,q;if(!V.objectMode){if(typeof $==="string"){if(Q=Q||V.defaultEncoding,Q!==V.encoding)$=B$.from($,Q),Q="";q=!0}}else q=!0;return tV(this,$,Q,!1,q)};_.prototype.unshift=function($){return tV(this,$,null,!0,!1)};function tV($,Q,V,q,Y){var X=$._readableState;if(Q===null)X.reading=!1,uX($,X);else{var J;if(!Y)J=mX(X,Q);if(J)$.emit("error",J);else if(X.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!X.objectMode&&Object.getPrototypeOf(Q)!==B$.prototype)Q=hX(Q);if(q)if(X.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else $5($,X,Q,!0);else if(X.ended)$.emit("error",Error("stream.push() after EOF"));else if(X.reading=!1,X.decoder&&!V)if(Q=X.decoder.write(Q),X.objectMode||Q.length!==0)$5($,X,Q,!1);else eV($,X);else $5($,X,Q,!1)}else if(!q)X.reading=!1}return cX(X)}function $5($,Q,V,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",V),$.read(0);else{if(Q.length+=Q.objectMode?1:V.length,q)Q.buffer.unshift(V);else Q.buffer.push(V);if(Q.needReadable)w6($)}eV($,Q)}function mX($,Q){var V;if(!_X(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)V=TypeError("Invalid non-string/buffer chunk");return V}function cX($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}_.prototype.isPaused=function(){return this._readableState.flowing===!1};_.prototype.setEncoding=function($){if(!k0)k0=s8().StringDecoder;return this._readableState.decoder=new k0($),this._readableState.encoding=$,this};var lV=8388608;function pX($){if($>=lV)$=lV;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function oV($,Q){if($<=0||Q.length===0&&Q.ended)return 0;if(Q.objectMode)return 1;if($!==$)if(Q.flowing&&Q.length)return Q.buffer.head.data.length;else return Q.length;if($>Q.highWaterMark)Q.highWaterMark=pX($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}_.prototype.read=function($){g("read",$),$=parseInt($,10);var Q=this._readableState,V=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(g("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)Q5(this);else w6(this);return null}if($=oV($,Q),$===0&&Q.ended){if(Q.length===0)Q5(this);return null}var q=Q.needReadable;if(g("need readable",q),Q.length===0||Q.length-$<Q.highWaterMark)q=!0,g("length less than watermark",q);if(Q.ended||Q.reading)q=!1,g("reading or ended",q);else if(q){if(g("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=oV(V,Q)}var Y;if($>0)Y=$q($,Q);else Y=null;if(Y===null)Q.needReadable=!0,$=0;else Q.length-=$;if(Q.length===0){if(!Q.ended)Q.needReadable=!0;if(V!==$&&Q.ended)Q5(this)}if(Y!==null)this.emit("data",Y);return Y};function uX($,Q){if(Q.ended)return;if(Q.decoder){var V=Q.decoder.end();if(V&&V.length)Q.buffer.push(V),Q.length+=Q.objectMode?1:V.length}Q.ended=!0,w6($)}function w6($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(g("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)D0.nextTick(iV,$);else iV($)}function iV($){g("emit readable"),$.emit("readable"),q5($)}function eV($,Q){if(!Q.readingMore)Q.readingMore=!0,D0.nextTick(dX,$,Q)}function dX($,Q){var V=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(g("maybeReadMore read 0"),$.read(0),V===Q.length)break;else V=Q.length;Q.readingMore=!1}_.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};_.prototype.pipe=function($,Q){var V=this,q=this._readableState;switch(q.pipesCount){case 0:q.pipes=$;break;case 1:q.pipes=[q.pipes,$];break;default:q.pipes.push($);break}q.pipesCount+=1,g("pipe count=%d opts=%j",q.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,X=Y?G:I;if(q.endEmitted)D0.nextTick(X);else V.once("end",X);$.on("unpipe",J);function J(M,L){if(g("onunpipe"),M===V){if(L&&L.hasUnpiped===!1)L.hasUnpiped=!0,W()}}function G(){g("onend"),$.end()}var U=lX(V);$.on("drain",U);var K=!1;function W(){if(g("cleanup"),$.removeListener("close",C),$.removeListener("finish",P),$.removeListener("drain",U),$.removeListener("error",H),$.removeListener("unpipe",J),V.removeListener("end",G),V.removeListener("end",I),V.removeListener("data",z),K=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var Z=!1;V.on("data",z);function z(M){g("ondata"),Z=!1;var L=$.write(M);if(L===!1&&!Z){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&Qq(q.pipes,$)!==-1)&&!K)g("false write response, pause",q.awaitDrain),q.awaitDrain++,Z=!0;V.pause()}}function H(M){if(g("onerror",M),I(),$.removeListener("error",H),nV($,"error")===0)$.emit("error",M)}bX($,"error",H);function C(){$.removeListener("finish",P),I()}$.once("close",C);function P(){g("onfinish"),$.removeListener("close",C),I()}$.once("finish",P);function I(){g("unpipe"),V.unpipe($)}if($.emit("pipe",V),!q.flowing)g("pipe resume"),V.resume();return $};function lX($){return function(){var Q=$._readableState;if(g("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&nV($,"data"))Q.flowing=!0,q5($)}}_.prototype.unpipe=function($){var Q=this._readableState,V={hasUnpiped:!1};if(Q.pipesCount===0)return this;if(Q.pipesCount===1){if($&&$!==Q.pipes)return this;if(!$)$=Q.pipes;if(Q.pipes=null,Q.pipesCount=0,Q.flowing=!1,$)$.emit("unpipe",this,V);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var X=0;X<Y;X++)q[X].emit("unpipe",this,{hasUnpiped:!1});return this}var J=Qq(Q.pipes,$);if(J===-1)return this;if(Q.pipes.splice(J,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,V),this};_.prototype.on=function($,Q){var V=V5.prototype.on.call(this,$,Q);if($==="data"){if(this._readableState.flowing!==!1)this.resume()}else if($==="readable"){var q=this._readableState;if(!q.endEmitted&&!q.readableListening){if(q.readableListening=q.needReadable=!0,q.emittedReadable=!1,!q.reading)D0.nextTick(oX,this);else if(q.length)w6(this)}}return V};_.prototype.addListener=_.prototype.on;function oX($){g("readable nexttick read 0"),$.read(0)}_.prototype.resume=function(){var $=this._readableState;if(!$.flowing)g("resume"),$.flowing=!0,iX(this,$);return this};function iX($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,D0.nextTick(nX,$,Q)}function nX($,Q){if(!Q.reading)g("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),q5($),Q.flowing&&!Q.reading)$.read(0)}_.prototype.pause=function(){if(g("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)g("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function q5($){var Q=$._readableState;g("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}_.prototype.wrap=function($){var Q=this,V=this._readableState,q=!1;$.on("end",function(){if(g("wrapped end"),V.decoder&&!V.ended){var J=V.decoder.end();if(J&&J.length)Q.push(J)}Q.push(null)}),$.on("data",function(J){if(g("wrapped data"),V.decoder)J=V.decoder.write(J);if(V.objectMode&&(J===null||J===void 0))return;else if(!V.objectMode&&(!J||!J.length))return;var G=Q.push(J);if(!G)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(J){return function(){return $[J].apply($,arguments)}}(Y);for(var X=0;X<e8.length;X++)$.on(e8[X],this.emit.bind(this,e8[X]));return this._read=function(J){if(g("wrapped _read",J),q)q=!1,$.resume()},this};Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_._fromList=$q;function $q($,Q){if(Q.length===0)return null;var V;if(Q.objectMode)V=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)V=Q.buffer.join("");else if(Q.buffer.length===1)V=Q.buffer.head.data;else V=Q.buffer.concat(Q.length);Q.buffer.clear()}else V=rX($,Q.buffer,Q.decoder);return V}function rX($,Q,V){var q;if($<Q.head.data.length)q=Q.head.data.slice(0,$),Q.head.data=Q.head.data.slice($);else if($===Q.head.data.length)q=Q.shift();else q=V?aX($,Q):sX($,Q);return q}function aX($,Q){var V=Q.head,q=1,Y=V.data;$-=Y.length;while(V=V.next){var X=V.data,J=$>X.length?X.length:$;if(J===X.length)Y+=X;else Y+=X.slice(0,$);if($-=J,$===0){if(J===X.length)if(++q,V.next)Q.head=V.next;else Q.head=Q.tail=null;else Q.head=V,V.data=X.slice(J);break}++q}return Q.length-=q,Y}function sX($,Q){var V=B$.allocUnsafe($),q=Q.head,Y=1;q.data.copy(V),$-=q.data.length;while(q=q.next){var X=q.data,J=$>X.length?X.length:$;if(X.copy(V,V.length-$,0,J),$-=J,$===0){if(J===X.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=X.slice(J);break}++Y}return Q.length-=Y,V}function Q5($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,D0.nextTick(tX,Q,$)}function tX($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function Qq($,Q){for(var V=0,q=$.length;V<q;V++)if($[V]===Q)return V;return-1}});var J5=w((CH,Yq)=>{Yq.exports=d1;var T6=Z0(),Jq=Object.create(E0());Jq.inherits=g0();Jq.inherits(d1,T6);function eX($,Q){var V=this._transformState;V.transforming=!1;var q=V.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(V.writechunk=null,V.writecb=null,Q!=null)this.push(Q);q($);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function d1($){if(!(this instanceof d1))return new d1($);if(T6.call(this,$),this._transformState={afterTransform:eX.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,$){if(typeof $.transform==="function")this._transform=$.transform;if(typeof $.flush==="function")this._flush=$.flush}this.on("prefinish",$G)}function $G(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,V){qq($,Q,V)});else qq(this,null,null)}d1.prototype.push=function($,Q){return this._transformState.needTransform=!1,T6.prototype.push.call(this,$,Q)};d1.prototype._transform=function($,Q,V){throw Error("_transform() is not implemented")};d1.prototype._write=function($,Q,V){var q=this._transformState;if(q.writecb=V,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};d1.prototype._read=function($){var Q=this._transformState;if(Q.writechunk!==null&&Q.writecb&&!Q.transforming)Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform);else Q.needTransform=!0};d1.prototype._destroy=function($,Q){var V=this;T6.prototype._destroy.call(this,$,function(q){Q(q),V.emit("close")})};function qq($,Q,V){if(Q)return $.emit("error",Q);if(V!=null)$.push(V);if($._writableState.length)throw Error("Calling transform done when ws.length != 0");if($._transformState.transforming)throw Error("Calling transform done when still transforming");return $.push(null)}});var Wq=w((wH,Kq)=>{Kq.exports=N$;var Xq=J5(),Gq=Object.create(E0());Gq.inherits=g0();Gq.inherits(N$,Xq);function N$($){if(!(this instanceof N$))return new N$($);Xq.call(this,$)}N$.prototype._transform=function($,Q,V){V(null,$)}});var Y5=w((a,A6)=>{var S1=d("stream");if(process.env.READABLE_STREAM==="disable"&&S1)A6.exports=S1,a=A6.exports=S1.Readable,a.Readable=S1.Readable,a.Writable=S1.Writable,a.Duplex=S1.Duplex,a.Transform=S1.Transform,a.PassThrough=S1.PassThrough,a.Stream=S1;else a=A6.exports=n8(),a.Stream=S1||a,a.Readable=a,a.Writable=o8(),a.Duplex=Z0(),a.Transform=J5(),a.PassThrough=Wq()});var l1=w((VG)=>{VG.base64=!0;VG.array=!0;VG.string=!0;VG.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";VG.nodebuffer=typeof Buffer<"u";VG.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")VG.blob=!1;else{F6=new ArrayBuffer(0);try{VG.blob=new Blob([F6],{type:"application/zip"}).size===0}catch($){try{G5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,R6=new G5,R6.append(F6),VG.blob=R6.getBlob("application/zip").size===0}catch(Q){VG.blob=!1}}}var F6,G5,R6;try{VG.nodestream=!!Y5().Readable}catch($){VG.nodestream=!1}});var K5=w((jG)=>{var WG=m(),UG=l1(),E1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";jG.encode=function($){var Q=[],V,q,Y,X,J,G,U,K=0,W=$.length,Z=W,z=WG.getTypeOf($)!=="string";while(K<$.length){if(Z=W-K,!z)V=$.charCodeAt(K++),q=K<W?$.charCodeAt(K++):0,Y=K<W?$.charCodeAt(K++):0;else V=$[K++],q=K<W?$[K++]:0,Y=K<W?$[K++]:0;X=V>>2,J=(V&3)<<4|q>>4,G=Z>1?(q&15)<<2|Y>>6:64,U=Z>2?Y&63:64,Q.push(E1.charAt(X)+E1.charAt(J)+E1.charAt(G)+E1.charAt(U))}return Q.join("")};jG.decode=function($){var Q,V,q,Y,X,J,G,U=0,K=0,W="data:";if($.substr(0,W.length)===W)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var Z=$.length*3/4;if($.charAt($.length-1)===E1.charAt(64))Z--;if($.charAt($.length-2)===E1.charAt(64))Z--;if(Z%1!==0)throw Error("Invalid base64 input, bad content length.");var z;if(UG.uint8array)z=new Uint8Array(Z|0);else z=Array(Z|0);while(U<$.length){if(Y=E1.indexOf($.charAt(U++)),X=E1.indexOf($.charAt(U++)),J=E1.indexOf($.charAt(U++)),G=E1.indexOf($.charAt(U++)),Q=Y<<2|X>>4,V=(X&15)<<4|J>>2,q=(J&3)<<6|G,z[K++]=Q,J!==64)z[K++]=V;if(G!==64)z[K++]=q}return z}});var M$=w((FH,Uq)=>{Uq.exports={isNode:typeof Buffer<"u",newBufferFrom:function($,Q){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from($,Q);else{if(typeof $==="number")throw Error('The "data" argument must not be a number');return new Buffer($,Q)}},allocBuffer:function($){if(Buffer.alloc)return Buffer.alloc($);else{var Q=new Buffer($);return Q.fill(0),Q}},isBuffer:function($){return Buffer.isBuffer($)},isStream:function($){return $&&typeof $.on==="function"&&typeof $.pause==="function"&&typeof $.resume==="function"}}});var zq=w((vH,Zq)=>{var RH=global.MutationObserver||global.WebKitMutationObserver,jq;jq=function(){process.nextTick(BG)};var HG,PG,LG,OG,W5,I$=[];function BG(){W5=!0;var $,Q,V=I$.length;while(V){Q=I$,I$=[],$=-1;while(++$<V)Q[$]();V=I$.length}W5=!1}Zq.exports=NG;function NG($){if(I$.push($)===1&&!W5)jq()}});var Mq=w((xH,Nq)=>{var Hq=zq();function _0(){}var $1={},Pq=["REJECTED"],U5=["FULFILLED"],Lq=["PENDING"];h0=["UNHANDLED"];var h0;Nq.exports=$0;function $0($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=Lq,this.queue=[],this.outcome=void 0,this.handled=h0,$!==_0)Oq(this,$)}$0.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(V,q);function V(Y){function X(){return Y}return Q.resolve($()).then(X)}function q(Y){function X(){throw Y}return Q.resolve($()).then(X)}};$0.prototype.catch=function($){return this.then(null,$)};$0.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===U5||typeof Q!=="function"&&this.state===Pq)return this;var V=new this.constructor(_0);if(this.handled===h0)this.handled=null;if(this.state!==Lq){var q=this.state===U5?$:Q;j5(V,q,this.outcome)}else this.queue.push(new C$(V,$,Q));return V};function C$($,Q,V){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof V==="function")this.onRejected=V,this.callRejected=this.otherCallRejected}C$.prototype.callFulfilled=function($){$1.resolve(this.promise,$)};C$.prototype.otherCallFulfilled=function($){j5(this.promise,this.onFulfilled,$)};C$.prototype.callRejected=function($){$1.reject(this.promise,$)};C$.prototype.otherCallRejected=function($){j5(this.promise,this.onRejected,$)};function j5($,Q,V){Hq(function(){var q;try{q=Q(V)}catch(Y){return $1.reject($,Y)}if(q===$)$1.reject($,TypeError("Cannot resolve promise with itself"));else $1.resolve($,q)})}$1.resolve=function($,Q){var V=Bq(MG,Q);if(V.status==="error")return $1.reject($,V.value);var q=V.value;if(q)Oq($,q);else{$.state=U5,$.outcome=Q;var Y=-1,X=$.queue.length;while(++Y<X)$.queue[Y].callFulfilled(Q)}return $};$1.reject=function($,Q){if($.state=Pq,$.outcome=Q,$.handled===h0)Hq(function(){if($.handled===h0)process.emit("unhandledRejection",Q,$)});var V=-1,q=$.queue.length;while(++V<q)$.queue[V].callRejected(Q);return $};function MG($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function Oq($,Q){var V=!1;function q(G){if(V)return;V=!0,$1.reject($,G)}function Y(G){if(V)return;V=!0,$1.resolve($,G)}function X(){Q(Y,q)}var J=Bq(X);if(J.status==="error")q(J.value)}function Bq($,Q){var V={};try{V.value=$(Q),V.status="success"}catch(q){V.status="error",V.value=q}return V}$0.resolve=IG;function IG($){if($ instanceof this)return $;return $1.resolve(new this(_0),$)}$0.reject=CG;function CG($){var Q=new this(_0);return $1.reject(Q,$)}$0.all=wG;function wG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=Array(V),X=0,J=-1,G=new this(_0);while(++J<V)U($[J],J);return G;function U(K,W){Q.resolve(K).then(Z,function(z){if(!q)q=!0,$1.reject(G,z)});function Z(z){if(Y[W]=z,++X===V&&!q)q=!0,$1.resolve(G,Y)}}}$0.race=TG;function TG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var V=$.length,q=!1;if(!V)return this.resolve([]);var Y=-1,X=new this(_0);while(++Y<V)J($[Y]);return X;function J(G){Q.resolve(G).then(function(U){if(!q)q=!0,$1.resolve(X,U)},function(U){if(!q)q=!0,$1.reject(X,U)})}}});var f0=w((SH,Iq)=>{var Z5=null;if(typeof Promise<"u")Z5=Promise;else Z5=Mq();Iq.exports={Promise:Z5}});var wq=w((Cq)=>{(function($,Q){if($.setImmediate)return;var V=1,q={},Y=!1,X=$.document,J;function G(L){if(typeof L!=="function")L=Function(""+L);var T=Array(arguments.length-1);for(var B=0;B<T.length;B++)T[B]=arguments[B+1];var O={callback:L,args:T};return q[V]=O,J(V),V++}function U(L){delete q[L]}function K(L){var{callback:T,args:B}=L;switch(B.length){case 0:T();break;case 1:T(B[0]);break;case 2:T(B[0],B[1]);break;case 3:T(B[0],B[1],B[2]);break;default:T.apply(Q,B);break}}function W(L){if(Y)setTimeout(W,0,L);else{var T=q[L];if(T){Y=!0;try{K(T)}finally{U(L),Y=!1}}}}function Z(){J=function(L){process.nextTick(function(){W(L)})}}function z(){if($.postMessage&&!$.importScripts){var L=!0,T=$.onmessage;return $.onmessage=function(){L=!1},$.postMessage("","*"),$.onmessage=T,L}}function H(){var L="setImmediate$"+Math.random()+"$",T=function(B){if(B.source===$&&typeof B.data==="string"&&B.data.indexOf(L)===0)W(+B.data.slice(L.length))};if($.addEventListener)$.addEventListener("message",T,!1);else $.attachEvent("onmessage",T);J=function(B){$.postMessage(L+B,"*")}}function C(){var L=new MessageChannel;L.port1.onmessage=function(T){var B=T.data;W(B)},J=function(T){L.port2.postMessage(T)}}function P(){var L=X.documentElement;J=function(T){var B=X.createElement("script");B.onreadystatechange=function(){W(T),B.onreadystatechange=null,L.removeChild(B),B=null},L.appendChild(B)}}function I(){J=function(L){setTimeout(W,0,L)}}var M=Object.getPrototypeOf&&Object.getPrototypeOf($);if(M=M&&M.setTimeout?M:$,{}.toString.call($.process)==="[object process]")Z();else if(z())H();else if($.MessageChannel)C();else if(X&&"onreadystatechange"in X.createElement("script"))P();else I();M.setImmediate=G,M.clearImmediate=U})(typeof self>"u"?typeof global>"u"?Cq:global:self)});var m=w((RG)=>{var Q0=l1(),AG=K5(),b0=M$(),z5=f0();wq();function FG($){var Q=null;if(Q0.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return x6($,Q)}RG.newBlob=function($,Q){RG.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var V=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new V;return q.append($),q.getBlob(Q)}catch(X){throw Error("Bug : can't construct the Blob.")}}};function w$($){return $}function x6($,Q){for(var V=0;V<$.length;++V)Q[V]=$.charCodeAt(V)&255;return Q}var v6={stringifyByChunk:function($,Q,V){var q=[],Y=0,X=$.length;if(X<=V)return String.fromCharCode.apply(null,$);while(Y<X){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+V,X))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+V,X))));Y+=V}return q.join("")},stringifyByChar:function($){var Q="";for(var V=0;V<$.length;V++)Q+=String.fromCharCode($[V]);return Q},applyCanBeUsed:{uint8array:function(){try{return Q0.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return Q0.nodebuffer&&String.fromCharCode.apply(null,b0.allocBuffer(1)).length===1}catch($){return!1}}()}};function T$($){var Q=65536,V=RG.getTypeOf($),q=!0;if(V==="uint8array")q=v6.applyCanBeUsed.uint8array;else if(V==="nodebuffer")q=v6.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return v6.stringifyByChunk($,V,Q)}catch(Y){Q=Math.floor(Q/2)}return v6.stringifyByChar($)}RG.applyFromCharCode=T$;function S6($,Q){for(var V=0;V<$.length;V++)Q[V]=$[V];return Q}var V0={};V0.string={string:w$,array:function($){return x6($,Array($.length))},arraybuffer:function($){return V0.string.uint8array($).buffer},uint8array:function($){return x6($,new Uint8Array($.length))},nodebuffer:function($){return x6($,b0.allocBuffer($.length))}};V0.array={string:T$,array:w$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return b0.newBufferFrom($)}};V0.arraybuffer={string:function($){return T$(new Uint8Array($))},array:function($){return S6(new Uint8Array($),Array($.byteLength))},arraybuffer:w$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return b0.newBufferFrom(new Uint8Array($))}};V0.uint8array={string:T$,array:function($){return S6($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:w$,nodebuffer:function($){return b0.newBufferFrom($)}};V0.nodebuffer={string:T$,array:function($){return S6($,Array($.length))},arraybuffer:function($){return V0.nodebuffer.uint8array($).buffer},uint8array:function($){return S6($,new Uint8Array($.length))},nodebuffer:w$};RG.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;RG.checkSupport($);var V=RG.getTypeOf(Q),q=V0[V][$](Q);return q};RG.resolve=function($){var Q=$.split("/"),V=[];for(var q=0;q<Q.length;q++){var Y=Q[q];if(Y==="."||Y===""&&q!==0&&q!==Q.length-1)continue;else if(Y==="..")V.pop();else V.push(Y)}return V.join("/")};RG.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(Q0.nodebuffer&&b0.isBuffer($))return"nodebuffer";if(Q0.uint8array&&$ instanceof Uint8Array)return"uint8array";if(Q0.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};RG.checkSupport=function($){var Q=Q0[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};RG.MAX_VALUE_16BITS=65535;RG.MAX_VALUE_32BITS=-1;RG.pretty=function($){var Q="",V,q;for(q=0;q<($||"").length;q++)V=$.charCodeAt(q),Q+="\\x"+(V<16?"0":"")+V.toString(16).toUpperCase();return Q};RG.delay=function($,Q,V){setImmediate(function(){$.apply(V||null,Q||[])})};RG.inherits=function($,Q){var V=function(){};V.prototype=Q.prototype,$.prototype=new V};RG.extend=function(){var $={},Q,V;for(Q=0;Q<arguments.length;Q++)for(V in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],V)&&typeof $[V]>"u")$[V]=arguments[Q][V];return $};RG.prepareContent=function($,Q,V,q,Y){var X=z5.Promise.resolve(Q).then(function(J){var G=Q0.blob&&(J instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(J))!==-1);if(G&&typeof FileReader<"u")return new z5.Promise(function(U,K){var W=new FileReader;W.onload=function(Z){U(Z.target.result)},W.onerror=function(Z){K(Z.target.error)},W.readAsArrayBuffer(J)});else return J});return X.then(function(J){var G=RG.getTypeOf(J);if(!G)return z5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(G==="arraybuffer")J=RG.transformTo("uint8array",J);else if(G==="string"){if(Y)J=AG.decode(J);else if(V){if(q!==!0)J=FG(J)}}return J})}});var j1=w((yH,Rq)=>{function Fq($){this.name=$||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}Fq.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,Q){return this._listeners[$].push(Q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,Q){if(this._listeners[$])for(var V=0;V<this._listeners[$].length;V++)this._listeners[$][V].call(this,Q)},pipe:function($){return $.registerPrevious(this)},registerPrevious:function($){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=$.streamInfo,this.mergeStreamInfo(),this.previous=$;var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){Q.end()}),$.on("error",function(V){Q.error(V)}),this},pause:function(){if(this.isPaused||this.isFinished)return!1;if(this.isPaused=!0,this.previous)this.previous.pause();return!0},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var $=!1;if(this.generatedError)this.error(this.generatedError),$=!0;if(this.previous)this.previous.resume();return!$},flush:function(){},processChunk:function($){this.push($)},withStreamInfo:function($,Q){return this.extraStreamInfo[$]=Q,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var $ in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,$))continue;this.streamInfo[$]=this.extraStreamInfo[$]}},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");if(this.isLocked=!0,this.previous)this.previous.lock()},toString:function(){var $="Worker "+this.name;if(this.previous)return this.previous+" -> "+$;else return $}};Rq.exports=Fq});var c0=w((pG)=>{var m0=m(),z0=l1(),fG=M$(),E6=j1(),A$=Array(256);for(g1=0;g1<256;g1++)A$[g1]=g1>=252?6:g1>=248?5:g1>=240?4:g1>=224?3:g1>=192?2:1;var g1;A$[254]=A$[254]=1;var bG=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}if(z0.uint8array)Q=new Uint8Array(G);else Q=Array(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q},mG=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+A$[$[V]]>Q?V:Q},cG=function($){var Q,V,q,Y,X=$.length,J=Array(X*2);for(V=0,Q=0;Q<X;){if(q=$[Q++],q<128){J[V++]=q;continue}if(Y=A$[q],Y>4){J[V++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<X)q=q<<6|$[Q++]&63,Y--;if(Y>1){J[V++]=65533;continue}if(q<65536)J[V++]=q;else q-=65536,J[V++]=55296|q>>10&1023,J[V++]=56320|q&1023}if(J.length!==V)if(J.subarray)J=J.subarray(0,V);else J.length=V;return m0.applyFromCharCode(J)};pG.utf8encode=function(Q){if(z0.nodebuffer)return fG.newBufferFrom(Q,"utf-8");return bG(Q)};pG.utf8decode=function(Q){if(z0.nodebuffer)return m0.transformTo("nodebuffer",Q).toString("utf-8");return Q=m0.transformTo(z0.uint8array?"uint8array":"array",Q),cG(Q)};function g6(){E6.call(this,"utf-8 decode"),this.leftOver=null}m0.inherits(g6,E6);g6.prototype.processChunk=function($){var Q=m0.transformTo(z0.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(z0.uint8array){var V=Q;Q=new Uint8Array(V.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(V,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=mG(Q),Y=Q;if(q!==Q.length)if(z0.uint8array)Y=Q.subarray(0,q),this.leftOver=Q.subarray(q,Q.length);else Y=Q.slice(0,q),this.leftOver=Q.slice(q,Q.length);this.push({data:pG.utf8decode(Y),meta:$.meta})};g6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:pG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};pG.Utf8DecodeWorker=g6;function P5(){E6.call(this,"utf-8 encode")}m0.inherits(P5,E6);P5.prototype.processChunk=function($){this.push({data:pG.utf8encode($.data),meta:$.meta})};pG.Utf8EncodeWorker=P5});var gq=w((DH,Eq)=>{var xq=j1(),Sq=m();function O5($){xq.call(this,"ConvertWorker to "+$),this.destType=$}Sq.inherits(O5,xq);O5.prototype.processChunk=function($){this.push({data:Sq.transformTo(this.destType,$.data),meta:$.meta})};Eq.exports=O5});var Dq=w((hH,kq)=>{var yq=Y5().Readable,lG=m();lG.inherits(B5,yq);function B5($,Q,V){yq.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,X){if(!q.push(Y))q._helper.pause();if(V)V(X)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}B5.prototype._read=function(){this._helper.resume()};kq.exports=B5});var N5=w((_H,fq)=>{var H0=m(),oG=gq(),iG=j1(),nG=K5(),rG=l1(),aG=f0(),hq=null;if(rG.nodestream)try{hq=Dq()}catch($){}function sG($,Q,V){switch($){case"blob":return H0.newBlob(H0.transformTo("arraybuffer",Q),V);case"base64":return nG.encode(Q);default:return H0.transformTo($,Q)}}function tG($,Q){var V,q=0,Y=null,X=0;for(V=0;V<Q.length;V++)X+=Q[V].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(X);for(V=0;V<Q.length;V++)Y.set(Q[V],q),q+=Q[V].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function eG($,Q){return new aG.Promise(function(V,q){var Y=[],X=$._internalType,J=$._outputType,G=$._mimeType;$.on("data",function(U,K){if(Y.push(U),Q)Q(K)}).on("error",function(U){Y=[],q(U)}).on("end",function(){try{var U=sG(J,tG(X,Y),G);V(U)}catch(K){q(K)}Y=[]}).resume()})}function _q($,Q,V){var q=Q;switch(Q){case"blob":case"arraybuffer":q="uint8array";break;case"base64":q="string";break}try{this._internalType=q,this._outputType=Q,this._mimeType=V,H0.checkSupport(q),this._worker=$.pipe(new oG(q)),$.lock()}catch(Y){this._worker=new iG("error"),this._worker.error(Y)}}_q.prototype={accumulate:function($){return eG(this,$)},on:function($,Q){var V=this;if($==="data")this._worker.on($,function(q){Q.call(V,q.data,q.meta)});else this._worker.on($,function(){H0.delay(Q,arguments,V)});return this},resume:function(){return H0.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(H0.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new hq(this,{objectMode:this._outputType!=="nodebuffer"},$)}};fq.exports=_q});var M5=w(($3)=>{$3.base64=!1;$3.binary=!1;$3.dir=!1;$3.createFolders=!0;$3.date=null;$3.compression=null;$3.compressionOptions=null;$3.comment=null;$3.unixPermissions=null;$3.dosPermissions=null});var I5=w((bH,bq)=>{var y6=m(),k6=j1(),j3=16384;function p0($){k6.call(this,"DataWorker");var Q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(V){if(Q.dataIsReady=!0,Q.data=V,Q.max=V&&V.length||0,Q.type=y6.getTypeOf(V),!Q.isPaused)Q._tickAndRepeat()},function(V){Q.error(V)})}y6.inherits(p0,k6);p0.prototype.cleanUp=function(){k6.prototype.cleanUp.call(this),this.data=null};p0.prototype.resume=function(){if(!k6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,y6.delay(this._tickAndRepeat,[],this);return!0};p0.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)y6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};p0.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=j3,Q=null,V=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":Q=this.data.substring(this.index,V);break;case"uint8array":Q=this.data.subarray(this.index,V);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,V);break}return this.index=V,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};bq.exports=p0});var D6=w((mH,cq)=>{var Z3=m();function z3(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var mq=z3();function H3($,Q,V,q){var Y=mq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}function P3($,Q,V,q){var Y=mq,X=q+V;$=$^-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q.charCodeAt(J))&255];return $^-1}cq.exports=function(Q,V){if(typeof Q>"u"||!Q.length)return 0;var q=Z3.getTypeOf(Q)!=="string";if(q)return H3(V|0,Q,Q.length,0);else return P3(V|0,Q,Q.length,0)}});var w5=w((cH,uq)=>{var pq=j1(),L3=D6(),O3=m();function C5(){pq.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}O3.inherits(C5,pq);C5.prototype.processChunk=function($){this.streamInfo.crc32=L3($.data,this.streamInfo.crc32||0),this.push($)};uq.exports=C5});var lq=w((pH,dq)=>{var B3=m(),T5=j1();function A5($){T5.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}B3.inherits(A5,T5);A5.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}T5.prototype.processChunk.call(this,$)};dq.exports=A5});var h6=w((uH,nq)=>{var oq=f0(),iq=I5(),N3=w5(),F5=lq();function R5($,Q,V,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=V,this.compression=q,this.compressedContent=Y}R5.prototype={getContentWorker:function(){var $=new iq(oq.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new F5("data_length")),Q=this;return $.on("end",function(){if(this.streamInfo.data_length!==Q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new iq(oq.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};R5.createWorkerFrom=function($,Q,V){return $.pipe(new N3).pipe(new F5("uncompressedSize")).pipe(Q.compressWorker(V)).pipe(new F5("compressedSize")).withStreamInfo("compression",Q)};nq.exports=R5});var tq=w((dH,sq)=>{var M3=N5(),I3=I5(),v5=c0(),x5=h6(),rq=j1(),S5=function($,Q,V){this.name=$,this.dir=V.dir,this.date=V.date,this.comment=V.comment,this.unixPermissions=V.unixPermissions,this.dosPermissions=V.dosPermissions,this._data=Q,this._dataBinary=V.binary,this.options={compression:V.compression,compressionOptions:V.compressionOptions}};S5.prototype={internalStream:function($){var Q=null,V="string";try{if(!$)throw Error("No output type specified.");V=$.toLowerCase();var q=V==="string"||V==="text";if(V==="binarystring"||V==="text")V="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new v5.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new v5.Utf8DecodeWorker)}catch(X){Q=new rq("error"),Q.error(X)}return new M3(Q,V,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof x5&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var V=this._decompressWorker();if(!this._dataBinary)V=V.pipe(new v5.Utf8EncodeWorker);return x5.createWorkerFrom(V,$,Q)}},_decompressWorker:function(){if(this._data instanceof x5)return this._data.getContentWorker();else if(this._data instanceof rq)return this._data;else return new I3(this._data)}};var aq=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],C3=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(F$=0;F$<aq.length;F$++)S5.prototype[aq[F$]]=C3;var F$;sq.exports=S5});var o1=w((E5)=>{var F3=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function R3($,Q){return Object.prototype.hasOwnProperty.call($,Q)}E5.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var V=Q.shift();if(!V)continue;if(typeof V!=="object")throw TypeError(V+"must be non-object");for(var q in V)if(R3(V,q))$[q]=V[q]}return $};E5.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var v3={arraySet:function($,Q,V,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(V,V+q),Y);return}for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){var Q,V,q,Y,X,J;q=0;for(Q=0,V=$.length;Q<V;Q++)q+=$[Q].length;J=new Uint8Array(q),Y=0;for(Q=0,V=$.length;Q<V;Q++)X=$[Q],J.set(X,Y),Y+=X.length;return J}},x3={arraySet:function($,Q,V,q,Y){for(var X=0;X<q;X++)$[Y+X]=Q[V+X]},flattenChunks:function($){return[].concat.apply([],$)}};E5.setTyped=function($){if($)E5.Buf8=Uint8Array,E5.Buf16=Uint16Array,E5.Buf32=Int32Array,E5.assign(E5,v3);else E5.Buf8=Array,E5.Buf16=Array,E5.Buf32=Array,E5.assign(E5,x3)};E5.setTyped(F3)});var C9=w((t3)=>{var E3=o1(),g3=4,$9=0,Q9=1,y3=2;function d0($){var Q=$.length;while(--Q>=0)$[Q]=0}var k3=0,G9=1,D3=2,h3=3,_3=258,b5=29,g$=256,v$=g$+1+b5,u0=30,m5=19,K9=2*v$+1,P0=15,y5=16,f3=7,c5=256,W9=16,U9=17,j9=18,_5=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],_6=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],b3=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Z9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],m3=512,i1=Array((v$+2)*2);d0(i1);var R$=Array(u0*2);d0(R$);var x$=Array(m3);d0(x$);var S$=Array(_3-h3+1);d0(S$);var p5=Array(b5);d0(p5);var f6=Array(u0);d0(f6);function k5($,Q,V,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=V,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var z9,H9,P9;function D5($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function L9($){return $<256?x$[$]:x$[256+($>>>7)]}function E$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function G1($,Q,V){if($.bi_valid>y5-V)$.bi_buf|=Q<<$.bi_valid&65535,E$($,$.bi_buf),$.bi_buf=Q>>y5-$.bi_valid,$.bi_valid+=V-y5;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=V}function y1($,Q,V){G1($,V[Q*2],V[Q*2+1])}function O9($,Q){var V=0;do V|=$&1,$>>>=1,V<<=1;while(--Q>0);return V>>>1}function c3($){if($.bi_valid===16)E$($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function p3($,Q){var{dyn_tree:V,max_code:q}=Q,Y=Q.stat_desc.static_tree,X=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,G=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,K,W,Z,z,H,C,P=0;for(z=0;z<=P0;z++)$.bl_count[z]=0;V[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<K9;K++){if(W=$.heap[K],z=V[V[W*2+1]*2+1]+1,z>U)z=U,P++;if(V[W*2+1]=z,W>q)continue;if($.bl_count[z]++,H=0,W>=G)H=J[W-G];if(C=V[W*2],$.opt_len+=C*(z+H),X)$.static_len+=C*(Y[W*2+1]+H)}if(P===0)return;do{z=U-1;while($.bl_count[z]===0)z--;$.bl_count[z]--,$.bl_count[z+1]+=2,$.bl_count[U]--,P-=2}while(P>0);for(z=U;z!==0;z--){W=$.bl_count[z];while(W!==0){if(Z=$.heap[--K],Z>q)continue;if(V[Z*2+1]!==z)$.opt_len+=(z-V[Z*2+1])*V[Z*2],V[Z*2+1]=z;W--}}}function B9($,Q,V){var q=Array(P0+1),Y=0,X,J;for(X=1;X<=P0;X++)q[X]=Y=Y+V[X-1]<<1;for(J=0;J<=Q;J++){var G=$[J*2+1];if(G===0)continue;$[J*2]=O9(q[G]++,G)}}function u3(){var $,Q,V,q,Y,X=Array(P0+1);V=0;for(q=0;q<b5-1;q++){p5[q]=V;for($=0;$<1<<_5[q];$++)S$[V++]=q}S$[V-1]=q,Y=0;for(q=0;q<16;q++){f6[q]=Y;for($=0;$<1<<_6[q];$++)x$[Y++]=q}Y>>=7;for(;q<u0;q++){f6[q]=Y<<7;for($=0;$<1<<_6[q]-7;$++)x$[256+Y++]=q}for(Q=0;Q<=P0;Q++)X[Q]=0;$=0;while($<=143)i1[$*2+1]=8,$++,X[8]++;while($<=255)i1[$*2+1]=9,$++,X[9]++;while($<=279)i1[$*2+1]=7,$++,X[7]++;while($<=287)i1[$*2+1]=8,$++,X[8]++;B9(i1,v$+1,X);for($=0;$<u0;$++)R$[$*2+1]=5,R$[$*2]=O9($,5);z9=new k5(i1,_5,g$+1,v$,P0),H9=new k5(R$,_6,0,u0,P0),P9=new k5([],b3,0,m5,f3)}function N9($){var Q;for(Q=0;Q<v$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<u0;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<m5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[c5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function M9($){if($.bi_valid>8)E$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function d3($,Q,V,q){if(M9($),q)E$($,V),E$($,~V);E3.arraySet($.pending_buf,$.window,Q,V,$.pending),$.pending+=V}function V9($,Q,V,q){var Y=Q*2,X=V*2;return $[Y]<$[X]||$[Y]===$[X]&&q[Q]<=q[V]}function h5($,Q,V){var q=$.heap[V],Y=V<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&V9(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(V9(Q,q,$.heap[Y],$.depth))break;$.heap[V]=$.heap[Y],V=Y,Y<<=1}$.heap[V]=q}function q9($,Q,V){var q,Y,X=0,J,G;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+X*2]<<8|$.pending_buf[$.d_buf+X*2+1],Y=$.pending_buf[$.l_buf+X],X++,q===0)y1($,Y,Q);else{if(J=S$[Y],y1($,J+g$+1,Q),G=_5[J],G!==0)Y-=p5[J],G1($,Y,G);if(q--,J=L9(q),y1($,J,V),G=_6[J],G!==0)q-=f6[J],G1($,q,G)}while(X<$.last_lit);y1($,c5,Q)}function f5($,Q){var V=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,X=Q.stat_desc.elems,J,G,U=-1,K;$.heap_len=0,$.heap_max=K9;for(J=0;J<X;J++)if(V[J*2]!==0)$.heap[++$.heap_len]=U=J,$.depth[J]=0;else V[J*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=U<2?++U:0,V[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=q[K*2+1];Q.max_code=U;for(J=$.heap_len>>1;J>=1;J--)h5($,V,J);K=X;do J=$.heap[1],$.heap[1]=$.heap[$.heap_len--],h5($,V,1),G=$.heap[1],$.heap[--$.heap_max]=J,$.heap[--$.heap_max]=G,V[K*2]=V[J*2]+V[G*2],$.depth[K]=($.depth[J]>=$.depth[G]?$.depth[J]:$.depth[G])+1,V[J*2+1]=V[G*2+1]=K,$.heap[1]=K++,h5($,V,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],p3($,Q),B9(V,U,$.bl_count)}function J9($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;Q[(V+1)*2+1]=65535;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)$.bl_tree[X*2]+=G;else if(X!==0){if(X!==Y)$.bl_tree[X*2]++;$.bl_tree[W9*2]++}else if(G<=10)$.bl_tree[U9*2]++;else $.bl_tree[j9*2]++;if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function Y9($,Q,V){var q,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;for(q=0;q<=V;q++){if(X=J,J=Q[(q+1)*2+1],++G<U&&X===J)continue;else if(G<K)do y1($,X,$.bl_tree);while(--G!==0);else if(X!==0){if(X!==Y)y1($,X,$.bl_tree),G--;y1($,W9,$.bl_tree),G1($,G-3,2)}else if(G<=10)y1($,U9,$.bl_tree),G1($,G-3,3);else y1($,j9,$.bl_tree),G1($,G-11,7);if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function l3($){var Q;J9($,$.dyn_ltree,$.l_desc.max_code),J9($,$.dyn_dtree,$.d_desc.max_code),f5($,$.bl_desc);for(Q=m5-1;Q>=3;Q--)if($.bl_tree[Z9[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function o3($,Q,V,q){var Y;G1($,Q-257,5),G1($,V-1,5),G1($,q-4,4);for(Y=0;Y<q;Y++)G1($,$.bl_tree[Z9[Y]*2+1],3);Y9($,$.dyn_ltree,Q-1),Y9($,$.dyn_dtree,V-1)}function i3($){var Q=4093624447,V;for(V=0;V<=31;V++,Q>>>=1)if(Q&1&&$.dyn_ltree[V*2]!==0)return $9;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return Q9;for(V=32;V<g$;V++)if($.dyn_ltree[V*2]!==0)return Q9;return $9}var X9=!1;function n3($){if(!X9)u3(),X9=!0;$.l_desc=new D5($.dyn_ltree,z9),$.d_desc=new D5($.dyn_dtree,H9),$.bl_desc=new D5($.bl_tree,P9),$.bi_buf=0,$.bi_valid=0,N9($)}function I9($,Q,V,q){G1($,(k3<<1)+(q?1:0),3),d3($,Q,V,!0)}function r3($){G1($,G9<<1,3),y1($,c5,i1),c3($)}function a3($,Q,V,q){var Y,X,J=0;if($.level>0){if($.strm.data_type===y3)$.strm.data_type=i3($);if(f5($,$.l_desc),f5($,$.d_desc),J=l3($),Y=$.opt_len+3+7>>>3,X=$.static_len+3+7>>>3,X<=Y)Y=X}else Y=X=V+5;if(V+4<=Y&&Q!==-1)I9($,Q,V,q);else if($.strategy===g3||X===Y)G1($,(G9<<1)+(q?1:0),3),q9($,i1,R$);else G1($,(D3<<1)+(q?1:0),3),o3($,$.l_desc.max_code+1,$.d_desc.max_code+1,J+1),q9($,$.dyn_ltree,$.dyn_dtree);if(N9($),q)M9($)}function s3($,Q,V){if($.pending_buf[$.d_buf+$.last_lit*2]=Q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=Q&255,$.pending_buf[$.l_buf+$.last_lit]=V&255,$.last_lit++,Q===0)$.dyn_ltree[V*2]++;else $.matches++,Q--,$.dyn_ltree[(S$[V]+g$+1)*2]++,$.dyn_dtree[L9(Q)*2]++;return $.last_lit===$.lit_bufsize-1}t3._tr_init=n3;t3._tr_stored_block=I9;t3._tr_flush_block=a3;t3._tr_tally=s3;t3._tr_align=r3});var u5=w((iH,w9)=>{function JK($,Q,V,q){var Y=$&65535|0,X=$>>>16&65535|0,J=0;while(V!==0){J=V>2000?2000:V,V-=J;do Y=Y+Q[q++]|0,X=X+Y|0;while(--J);Y%=65521,X%=65521}return Y|X<<16|0}w9.exports=JK});var d5=w((nH,T9)=>{function YK(){var $,Q=[];for(var V=0;V<256;V++){$=V;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[V]=$}return Q}var XK=YK();function GK($,Q,V,q){var Y=XK,X=q+V;$^=-1;for(var J=q;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}T9.exports=GK});var b6=w((rH,A9)=>{A9.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var k9=w((mK)=>{var Y1=o1(),H1=C9(),x9=u5(),q0=d5(),KK=b6(),N0=0,WK=1,UK=3,K0=4,F9=5,D1=0,R9=1,P1=-2,jK=-3,l5=-5,ZK=-1,zK=1,m6=2,HK=3,PK=4,LK=0,OK=2,d6=8,BK=9,NK=15,MK=8,IK=29,CK=256,i5=CK+1+IK,wK=30,TK=19,AK=2*i5+1,FK=15,S=3,X0=258,F1=X0+S+1,RK=32,l6=42,n5=69,c6=73,p6=91,u6=103,L0=113,k$=666,n=1,D$=2,O0=3,i0=4,vK=3;function G0($,Q){return $.msg=KK[Q],Q}function v9($){return($<<1)-($>4?9:0)}function Y0($){var Q=$.length;while(--Q>=0)$[Q]=0}function J0($){var Q=$.state,V=Q.pending;if(V>$.avail_out)V=$.avail_out;if(V===0)return;if(Y1.arraySet($.output,Q.pending_buf,Q.pending_out,V,$.next_out),$.next_out+=V,Q.pending_out+=V,$.total_out+=V,$.avail_out-=V,Q.pending-=V,Q.pending===0)Q.pending_out=0}function s($,Q){H1._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,J0($.strm)}function E($,Q){$.pending_buf[$.pending++]=Q}function y$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function xK($,Q,V,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,Y1.arraySet(Q,$.input,$.next_in,Y,V),$.state.wrap===1)$.adler=x9($.adler,Q,Y,V);else if($.state.wrap===2)$.adler=q0($.adler,Q,Y,V);return $.next_in+=Y,$.total_in+=Y,Y}function S9($,Q){var{max_chain_length:V,strstart:q}=$,Y,X,J=$.prev_length,G=$.nice_match,U=$.strstart>$.w_size-F1?$.strstart-($.w_size-F1):0,K=$.window,W=$.w_mask,Z=$.prev,z=$.strstart+X0,H=K[q+J-1],C=K[q+J];if($.prev_length>=$.good_match)V>>=2;if(G>$.lookahead)G=$.lookahead;do{if(Y=Q,K[Y+J]!==C||K[Y+J-1]!==H||K[Y]!==K[q]||K[++Y]!==K[q+1])continue;q+=2,Y++;do;while(K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&K[++q]===K[++Y]&&q<z);if(X=X0-(z-q),q=z-X0,X>J){if($.match_start=Q,J=X,X>=G)break;H=K[q+J-1],C=K[q+J]}}while((Q=Z[Q&W])>U&&--V!==0);if(J<=$.lookahead)return J;return $.lookahead}function B0($){var Q=$.w_size,V,q,Y,X,J;do{if(X=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-F1)){Y1.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,V=q;do Y=$.head[--V],$.head[V]=Y>=Q?Y-Q:0;while(--q);q=Q,V=q;do Y=$.prev[--V],$.prev[V]=Y>=Q?Y-Q:0;while(--q);X+=Q}if($.strm.avail_in===0)break;if(q=xK($.strm,$.window,$.strstart+$.lookahead,X),$.lookahead+=q,$.lookahead+$.insert>=S){J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[J+S-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,$.lookahead+$.insert<S)break}}while($.lookahead<F1&&$.strm.avail_in!==0)}function SK($,Q){var V=65535;if(V>$.pending_buf_size-5)V=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(B0($),$.lookahead===0&&Q===N0)return n;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+V;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,s($,!1),$.strm.avail_out===0)return n}if($.strstart-$.block_start>=$.w_size-F1){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===K0){if(s($,!0),$.strm.avail_out===0)return O0;return i0}if($.strstart>$.block_start){if(s($,!1),$.strm.avail_out===0)return n}return n}function o5($,Q){var V,q;for(;;){if($.lookahead<F1){if(B0($),$.lookahead<F1&&Q===N0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(V!==0&&$.strstart-V<=$.w_size-F1)$.match_length=S9($,V);if($.match_length>=S)if(q=H1._tr_tally($,$.strstart-$.match_start,$.match_length-S),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=S){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else q=H1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=$.strstart<S-1?$.strstart:S-1,Q===K0){if(s($,!0),$.strm.avail_out===0)return O0;return i0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return D$}function l0($,Q){var V,q,Y;for(;;){if($.lookahead<F1){if(B0($),$.lookahead<F1&&Q===N0)return n;if($.lookahead===0)break}if(V=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=S-1,V!==0&&$.prev_length<$.max_lazy_match&&$.strstart-V<=$.w_size-F1){if($.match_length=S9($,V),$.match_length<=5&&($.strategy===zK||$.match_length===S&&$.strstart-$.match_start>4096))$.match_length=S-1}if($.prev_length>=S&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-S,q=H1._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-S),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,V=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=S-1,$.strstart++,q){if(s($,!1),$.strm.avail_out===0)return n}}else if($.match_available){if(q=H1._tr_tally($,0,$.window[$.strstart-1]),q)s($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return n}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=H1._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<S-1?$.strstart:S-1,Q===K0){if(s($,!0),$.strm.avail_out===0)return O0;return i0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return D$}function EK($,Q){var V,q,Y,X,J=$.window;for(;;){if($.lookahead<=X0){if(B0($),$.lookahead<=X0&&Q===N0)return n;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=S&&$.strstart>0){if(Y=$.strstart-1,q=J[Y],q===J[++Y]&&q===J[++Y]&&q===J[++Y]){X=$.strstart+X0;do;while(q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&q===J[++Y]&&Y<X);if($.match_length=X0-(X-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=S)V=H1._tr_tally($,1,$.match_length-S),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else V=H1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===K0){if(s($,!0),$.strm.avail_out===0)return O0;return i0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return D$}function gK($,Q){var V;for(;;){if($.lookahead===0){if(B0($),$.lookahead===0){if(Q===N0)return n;break}}if($.match_length=0,V=H1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===K0){if(s($,!0),$.strm.avail_out===0)return O0;return i0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return D$}function k1($,Q,V,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=V,this.max_chain=q,this.func=Y}var o0;o0=[new k1(0,0,0,0,SK),new k1(4,4,8,4,o5),new k1(4,5,16,8,o5),new k1(4,6,32,32,o5),new k1(4,4,16,16,l0),new k1(8,16,32,32,l0),new k1(8,16,128,128,l0),new k1(8,32,128,256,l0),new k1(32,128,258,1024,l0),new k1(32,258,258,4096,l0)];function yK($){$.window_size=2*$.w_size,Y0($.head),$.max_lazy_match=o0[$.level].max_lazy,$.good_match=o0[$.level].good_length,$.nice_match=o0[$.level].nice_length,$.max_chain_length=o0[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=S-1,$.match_available=0,$.ins_h=0}function kK(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=d6,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Y1.Buf16(AK*2),this.dyn_dtree=new Y1.Buf16((2*wK+1)*2),this.bl_tree=new Y1.Buf16((2*TK+1)*2),Y0(this.dyn_ltree),Y0(this.dyn_dtree),Y0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Y1.Buf16(FK+1),this.heap=new Y1.Buf16(2*i5+1),Y0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Y1.Buf16(2*i5+1),Y0(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E9($){var Q;if(!$||!$.state)return G0($,P1);if($.total_in=$.total_out=0,$.data_type=OK,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?l6:L0,$.adler=Q.wrap===2?0:1,Q.last_flush=N0,H1._tr_init(Q),D1}function g9($){var Q=E9($);if(Q===D1)yK($.state);return Q}function DK($,Q){if(!$||!$.state)return P1;if($.state.wrap!==2)return P1;return $.state.gzhead=Q,D1}function y9($,Q,V,q,Y,X){if(!$)return P1;var J=1;if(Q===ZK)Q=6;if(q<0)J=0,q=-q;else if(q>15)J=2,q-=16;if(Y<1||Y>BK||V!==d6||q<8||q>15||Q<0||Q>9||X<0||X>PK)return G0($,P1);if(q===8)q=9;var G=new kK;return $.state=G,G.strm=$,G.wrap=J,G.gzhead=null,G.w_bits=q,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=Y+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+S-1)/S),G.window=new Y1.Buf8(G.w_size*2),G.head=new Y1.Buf16(G.hash_size),G.prev=new Y1.Buf16(G.w_size),G.lit_bufsize=1<<Y+6,G.pending_buf_size=G.lit_bufsize*4,G.pending_buf=new Y1.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=Q,G.strategy=X,G.method=V,g9($)}function hK($,Q){return y9($,Q,d6,NK,MK,LK)}function _K($,Q){var V,q,Y,X;if(!$||!$.state||Q>F9||Q<0)return $?G0($,P1):P1;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===k$&&Q!==K0)return G0($,$.avail_out===0?l5:P1);if(q.strm=$,V=q.last_flush,q.last_flush=Q,q.status===l6)if(q.wrap===2)if($.adler=0,E(q,31),E(q,139),E(q,8),!q.gzhead)E(q,0),E(q,0),E(q,0),E(q,0),E(q,0),E(q,q.level===9?2:q.strategy>=m6||q.level<2?4:0),E(q,vK),q.status=L0;else{if(E(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(!q.gzhead.extra?0:4)+(!q.gzhead.name?0:8)+(!q.gzhead.comment?0:16)),E(q,q.gzhead.time&255),E(q,q.gzhead.time>>8&255),E(q,q.gzhead.time>>16&255),E(q,q.gzhead.time>>24&255),E(q,q.level===9?2:q.strategy>=m6||q.level<2?4:0),E(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)E(q,q.gzhead.extra.length&255),E(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=q0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=n5}else{var J=d6+(q.w_bits-8<<4)<<8,G=-1;if(q.strategy>=m6||q.level<2)G=0;else if(q.level<6)G=1;else if(q.level===6)G=2;else G=3;if(J|=G<<6,q.strstart!==0)J|=RK;if(J+=31-J%31,q.status=L0,y$(q,J),q.strstart!==0)y$(q,$.adler>>>16),y$(q,$.adler&65535);$.adler=1}if(q.status===n5)if(q.gzhead.extra){Y=q.pending;while(q.gzindex<(q.gzhead.extra.length&65535)){if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=q0($.adler,q.pending_buf,q.pending-Y,Y);if(J0($),Y=q.pending,q.pending===q.pending_buf_size)break}E(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=q0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=c6}else q.status=c6;if(q.status===c6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=q0($.adler,q.pending_buf,q.pending-Y,Y);if(J0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.name.length)X=q.gzhead.name.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.gzindex=0,q.status=p6}else q.status=p6;if(q.status===p6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=q0($.adler,q.pending_buf,q.pending-Y,Y);if(J0($),Y=q.pending,q.pending===q.pending_buf_size){X=1;break}}if(q.gzindex<q.gzhead.comment.length)X=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else X=0;E(q,X)}while(X!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=q0($.adler,q.pending_buf,q.pending-Y,Y);if(X===0)q.status=u6}else q.status=u6;if(q.status===u6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)J0($);if(q.pending+2<=q.pending_buf_size)E(q,$.adler&255),E(q,$.adler>>8&255),$.adler=0,q.status=L0}else q.status=L0;if(q.pending!==0){if(J0($),$.avail_out===0)return q.last_flush=-1,D1}else if($.avail_in===0&&v9(Q)<=v9(V)&&Q!==K0)return G0($,l5);if(q.status===k$&&$.avail_in!==0)return G0($,l5);if($.avail_in!==0||q.lookahead!==0||Q!==N0&&q.status!==k$){var U=q.strategy===m6?gK(q,Q):q.strategy===HK?EK(q,Q):o0[q.level].func(q,Q);if(U===O0||U===i0)q.status=k$;if(U===n||U===O0){if($.avail_out===0)q.last_flush=-1;return D1}if(U===D$){if(Q===WK)H1._tr_align(q);else if(Q!==F9){if(H1._tr_stored_block(q,0,0,!1),Q===UK){if(Y0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(J0($),$.avail_out===0)return q.last_flush=-1,D1}}if(Q!==K0)return D1;if(q.wrap<=0)return R9;if(q.wrap===2)E(q,$.adler&255),E(q,$.adler>>8&255),E(q,$.adler>>16&255),E(q,$.adler>>24&255),E(q,$.total_in&255),E(q,$.total_in>>8&255),E(q,$.total_in>>16&255),E(q,$.total_in>>24&255);else y$(q,$.adler>>>16),y$(q,$.adler&65535);if(J0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?D1:R9}function fK($){var Q;if(!$||!$.state)return P1;if(Q=$.state.status,Q!==l6&&Q!==n5&&Q!==c6&&Q!==p6&&Q!==u6&&Q!==L0&&Q!==k$)return G0($,P1);return $.state=null,Q===L0?G0($,jK):D1}function bK($,Q){var V=Q.length,q,Y,X,J,G,U,K,W;if(!$||!$.state)return P1;if(q=$.state,J=q.wrap,J===2||J===1&&q.status!==l6||q.lookahead)return P1;if(J===1)$.adler=x9($.adler,Q,V,0);if(q.wrap=0,V>=q.w_size){if(J===0)Y0(q.head),q.strstart=0,q.block_start=0,q.insert=0;W=new Y1.Buf8(q.w_size),Y1.arraySet(W,Q,V-q.w_size,q.w_size,0),Q=W,V=q.w_size}G=$.avail_in,U=$.next_in,K=$.input,$.avail_in=V,$.next_in=0,$.input=Q,B0(q);while(q.lookahead>=S){Y=q.strstart,X=q.lookahead-(S-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+S-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--X);q.strstart=Y,q.lookahead=S-1,B0(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=S-1,q.match_available=0,$.next_in=U,$.input=K,$.avail_in=G,q.wrap=J,D1}mK.deflateInit=hK;mK.deflateInit2=y9;mK.deflateReset=g9;mK.deflateResetKeep=E9;mK.deflateSetHeader=DK;mK.deflate=_K;mK.deflateEnd=fK;mK.deflateSetDictionary=bK;mK.deflateInfo="pako deflate (from Nodeca project)"});var r5=w((aK)=>{var o6=o1(),D9=!0,h9=!0;try{String.fromCharCode.apply(null,[0])}catch($){D9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){h9=!1}var h$=new o6.Buf8(256);for(h1=0;h1<256;h1++)h$[h1]=h1>=252?6:h1>=248?5:h1>=240?4:h1>=224?3:h1>=192?2:1;var h1;h$[254]=h$[254]=1;aK.string2buf=function($){var Q,V,q,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}G+=V<128?1:V<2048?2:V<65536?3:4}Q=new o6.Buf8(G);for(X=0,Y=0;X<G;Y++){if(V=$.charCodeAt(Y),(V&64512)===55296&&Y+1<J){if(q=$.charCodeAt(Y+1),(q&64512)===56320)V=65536+(V-55296<<10)+(q-56320),Y++}if(V<128)Q[X++]=V;else if(V<2048)Q[X++]=192|V>>>6,Q[X++]=128|V&63;else if(V<65536)Q[X++]=224|V>>>12,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63;else Q[X++]=240|V>>>18,Q[X++]=128|V>>>12&63,Q[X++]=128|V>>>6&63,Q[X++]=128|V&63}return Q};function _9($,Q){if(Q<65534){if($.subarray&&h9||!$.subarray&&D9)return String.fromCharCode.apply(null,o6.shrinkBuf($,Q))}var V="";for(var q=0;q<Q;q++)V+=String.fromCharCode($[q]);return V}aK.buf2binstring=function($){return _9($,$.length)};aK.binstring2buf=function($){var Q=new o6.Buf8($.length);for(var V=0,q=Q.length;V<q;V++)Q[V]=$.charCodeAt(V);return Q};aK.buf2string=function($,Q){var V,q,Y,X,J=Q||$.length,G=Array(J*2);for(q=0,V=0;V<J;){if(Y=$[V++],Y<128){G[q++]=Y;continue}if(X=h$[Y],X>4){G[q++]=65533,V+=X-1;continue}Y&=X===2?31:X===3?15:7;while(X>1&&V<J)Y=Y<<6|$[V++]&63,X--;if(X>1){G[q++]=65533;continue}if(Y<65536)G[q++]=Y;else Y-=65536,G[q++]=55296|Y>>10&1023,G[q++]=56320|Y&1023}return _9(G,q)};aK.utf8border=function($,Q){var V;if(Q=Q||$.length,Q>$.length)Q=$.length;V=Q-1;while(V>=0&&($[V]&192)===128)V--;if(V<0)return Q;if(V===0)return Q;return V+h$[$[V]]>Q?V:Q}});var a5=w((tH,f9)=>{function VW(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}f9.exports=VW});var p9=w((UW)=>{var _$=k9(),f$=o1(),t5=r5(),e5=b6(),qW=a5(),c9=Object.prototype.toString,JW=0,s5=4,n0=0,b9=1,m9=2,YW=-1,XW=0,GW=8;function M0($){if(!(this instanceof M0))return new M0($);this.options=f$.assign({level:YW,method:GW,chunkSize:16384,windowBits:15,memLevel:8,strategy:XW,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>0)Q.windowBits=-Q.windowBits;else if(Q.gzip&&Q.windowBits>0&&Q.windowBits<16)Q.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qW,this.strm.avail_out=0;var V=_$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(V!==n0)throw Error(e5[V]);if(Q.header)_$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=t5.string2buf(Q.dictionary);else if(c9.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(V=_$.deflateSetDictionary(this.strm,q),V!==n0)throw Error(e5[V]);this._dict_set=!0}}M0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y,X;if(this.ended)return!1;if(X=Q===~~Q?Q:Q===!0?s5:JW,typeof $==="string")V.input=t5.string2buf($);else if(c9.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new f$.Buf8(q),V.next_out=0,V.avail_out=q;if(Y=_$.deflate(V,X),Y!==b9&&Y!==n0)return this.onEnd(Y),this.ended=!0,!1;if(V.avail_out===0||V.avail_in===0&&(X===s5||X===m9))if(this.options.to==="string")this.onData(t5.buf2binstring(f$.shrinkBuf(V.output,V.next_out)));else this.onData(f$.shrinkBuf(V.output,V.next_out))}while((V.avail_in>0||V.avail_out===0)&&Y!==b9);if(X===s5)return Y=_$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===n0;if(X===m9)return this.onEnd(n0),V.avail_out=0,!0;return!0};M0.prototype.onData=function($){this.chunks.push($)};M0.prototype.onEnd=function($){if($===n0)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=f$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function $Q($,Q){var V=new M0(Q);if(V.push($,!0),V.err)throw V.msg||e5[V.err];return V.result}function KW($,Q){return Q=Q||{},Q.raw=!0,$Q($,Q)}function WW($,Q){return Q=Q||{},Q.gzip=!0,$Q($,Q)}UW.Deflate=M0;UW.deflate=$Q;UW.deflateRaw=KW;UW.gzip=WW});var d9=w(($P,u9)=>{var i6=30,PW=12;u9.exports=function(Q,V){var q,Y,X,J,G,U,K,W,Z,z,H,C,P,I,M,L,T,B,O,F,R,v,x,h,A;q=Q.state,Y=Q.next_in,h=Q.input,X=Y+(Q.avail_in-5),J=Q.next_out,A=Q.output,G=J-(V-Q.avail_out),U=J+(Q.avail_out-257),K=q.dmax,W=q.wsize,Z=q.whave,z=q.wnext,H=q.window,C=q.hold,P=q.bits,I=q.lencode,M=q.distcode,L=(1<<q.lenbits)-1,T=(1<<q.distbits)-1;$:do{if(P<15)C+=h[Y++]<<P,P+=8,C+=h[Y++]<<P,P+=8;B=I[C&L];Q:for(;;){if(O=B>>>24,C>>>=O,P-=O,O=B>>>16&255,O===0)A[J++]=B&65535;else if(O&16){if(F=B&65535,O&=15,O){if(P<O)C+=h[Y++]<<P,P+=8;F+=C&(1<<O)-1,C>>>=O,P-=O}if(P<15)C+=h[Y++]<<P,P+=8,C+=h[Y++]<<P,P+=8;B=M[C&T];V:for(;;){if(O=B>>>24,C>>>=O,P-=O,O=B>>>16&255,O&16){if(R=B&65535,O&=15,P<O){if(C+=h[Y++]<<P,P+=8,P<O)C+=h[Y++]<<P,P+=8}if(R+=C&(1<<O)-1,R>K){Q.msg="invalid distance too far back",q.mode=i6;break $}if(C>>>=O,P-=O,O=J-G,R>O){if(O=R-O,O>Z){if(q.sane){Q.msg="invalid distance too far back",q.mode=i6;break $}}if(v=0,x=H,z===0){if(v+=W-O,O<F){F-=O;do A[J++]=H[v++];while(--O);v=J-R,x=A}}else if(z<O){if(v+=W+z-O,O-=z,O<F){F-=O;do A[J++]=H[v++];while(--O);if(v=0,z<F){O=z,F-=O;do A[J++]=H[v++];while(--O);v=J-R,x=A}}}else if(v+=z-O,O<F){F-=O;do A[J++]=H[v++];while(--O);v=J-R,x=A}while(F>2)A[J++]=x[v++],A[J++]=x[v++],A[J++]=x[v++],F-=3;if(F){if(A[J++]=x[v++],F>1)A[J++]=x[v++]}}else{v=J-R;do A[J++]=A[v++],A[J++]=A[v++],A[J++]=A[v++],F-=3;while(F>2);if(F){if(A[J++]=A[v++],F>1)A[J++]=A[v++]}}}else if((O&64)===0){B=M[(B&65535)+(C&(1<<O)-1)];continue V}else{Q.msg="invalid distance code",q.mode=i6;break $}break}}else if((O&64)===0){B=I[(B&65535)+(C&(1<<O)-1)];continue Q}else if(O&32){q.mode=PW;break $}else{Q.msg="invalid literal/length code",q.mode=i6;break $}break}}while(Y<X&&J<U);F=P>>3,Y-=F,P-=F<<3,C&=(1<<P)-1,Q.next_in=Y,Q.next_out=J,Q.avail_in=Y<X?5+(X-Y):5-(Y-X),Q.avail_out=J<U?257+(U-J):257-(J-U),q.hold=C,q.bits=P;return}});var s9=w((QP,a9)=>{var l9=o1(),r0=15,o9=852,i9=592,n9=0,QQ=1,r9=2,LW=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],OW=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],BW=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],NW=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];a9.exports=function(Q,V,q,Y,X,J,G,U){var K=U.bits,W=0,Z=0,z=0,H=0,C=0,P=0,I=0,M=0,L=0,T=0,B,O,F,R,v,x=null,h=0,A,W1=new l9.Buf16(r0+1),v0=new l9.Buf16(r0+1),q6=null,lQ=0,oQ,J6,Y6;for(W=0;W<=r0;W++)W1[W]=0;for(Z=0;Z<Y;Z++)W1[V[q+Z]]++;C=K;for(H=r0;H>=1;H--)if(W1[H]!==0)break;if(C>H)C=H;if(H===0)return X[J++]=20971520,X[J++]=20971520,U.bits=1,0;for(z=1;z<H;z++)if(W1[z]!==0)break;if(C<z)C=z;M=1;for(W=1;W<=r0;W++)if(M<<=1,M-=W1[W],M<0)return-1;if(M>0&&(Q===n9||H!==1))return-1;v0[1]=0;for(W=1;W<r0;W++)v0[W+1]=v0[W]+W1[W];for(Z=0;Z<Y;Z++)if(V[q+Z]!==0)G[v0[V[q+Z]]++]=Z;if(Q===n9)x=q6=G,A=19;else if(Q===QQ)x=LW,h-=257,q6=OW,lQ-=257,A=256;else x=BW,q6=NW,A=-1;if(T=0,Z=0,W=z,v=J,P=C,I=0,F=-1,L=1<<C,R=L-1,Q===QQ&&L>o9||Q===r9&&L>i9)return 1;for(;;){if(oQ=W-I,G[Z]<A)J6=0,Y6=G[Z];else if(G[Z]>A)J6=q6[lQ+G[Z]],Y6=x[h+G[Z]];else J6=96,Y6=0;B=1<<W-I,O=1<<P,z=O;do O-=B,X[v+(T>>I)+O]=oQ<<24|J6<<16|Y6|0;while(O!==0);B=1<<W-1;while(T&B)B>>=1;if(B!==0)T&=B-1,T+=B;else T=0;if(Z++,--W1[W]===0){if(W===H)break;W=V[q+G[Z]]}if(W>C&&(T&R)!==F){if(I===0)I=C;v+=z,P=W-I,M=1<<P;while(P+I<H){if(M-=W1[P+I],M<=0)break;P++,M<<=1}if(L+=1<<P,Q===QQ&&L>o9||Q===r9&&L>i9)return 1;F=T&R,X[F]=C<<24|P<<16|v-J|0}}if(T!==0)X[v+T]=W-I<<24|4194304|0;return U.bits=C,0}});var g2=w((fW)=>{var Z1=o1(),GQ=u5(),_1=d5(),MW=d9(),b$=s9(),IW=0,w2=1,T2=2,t9=4,CW=5,n6=6,I0=0,wW=1,TW=2,L1=-2,A2=-3,KQ=-4,AW=-5,e9=8,F2=1,$2=2,Q2=3,V2=4,q2=5,J2=6,Y2=7,X2=8,G2=9,K2=10,s6=11,n1=12,VQ=13,W2=14,qQ=15,U2=16,j2=17,Z2=18,z2=19,r6=20,a6=21,H2=22,P2=23,L2=24,O2=25,B2=26,JQ=27,N2=28,M2=29,b=30,WQ=31,FW=32,RW=852,vW=592,xW=15,SW=xW;function I2($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function EW(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Z1.Buf16(320),this.work=new Z1.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function R2($){var Q;if(!$||!$.state)return L1;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=F2,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new Z1.Buf32(RW),Q.distcode=Q.distdyn=new Z1.Buf32(vW),Q.sane=1,Q.back=-1,I0}function v2($){var Q;if(!$||!$.state)return L1;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,R2($)}function x2($,Q){var V,q;if(!$||!$.state)return L1;if(q=$.state,Q<0)V=0,Q=-Q;else if(V=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return L1;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=V,q.wbits=Q,v2($)}function S2($,Q){var V,q;if(!$)return L1;if(q=new EW,$.state=q,q.window=null,V=x2($,Q),V!==I0)$.state=null;return V}function gW($){return S2($,SW)}var C2=!0,YQ,XQ;function yW($){if(C2){var Q;YQ=new Z1.Buf32(512),XQ=new Z1.Buf32(32),Q=0;while(Q<144)$.lens[Q++]=8;while(Q<256)$.lens[Q++]=9;while(Q<280)$.lens[Q++]=7;while(Q<288)$.lens[Q++]=8;b$(w2,$.lens,0,288,YQ,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;b$(T2,$.lens,0,32,XQ,0,$.work,{bits:5}),C2=!1}$.lencode=YQ,$.lenbits=9,$.distcode=XQ,$.distbits=5}function E2($,Q,V,q){var Y,X=$.state;if(X.window===null)X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new Z1.Buf8(X.wsize);if(q>=X.wsize)Z1.arraySet(X.window,Q,V-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize;else{if(Y=X.wsize-X.wnext,Y>q)Y=q;if(Z1.arraySet(X.window,Q,V-q,Y,X.wnext),q-=Y,q)Z1.arraySet(X.window,Q,V-q,q,0),X.wnext=q,X.whave=X.wsize;else{if(X.wnext+=Y,X.wnext===X.wsize)X.wnext=0;if(X.whave<X.wsize)X.whave+=Y}}return 0}function kW($,Q){var V,q,Y,X,J,G,U,K,W,Z,z,H,C,P,I=0,M,L,T,B,O,F,R,v,x=new Z1.Buf8(4),h,A,W1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return L1;if(V=$.state,V.mode===n1)V.mode=VQ;J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,Z=G,z=U,v=I0;$:for(;;)switch(V.mode){case F2:if(V.wrap===0){V.mode=VQ;break}while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.wrap&2&&K===35615){V.check=0,x[0]=K&255,x[1]=K>>>8&255,V.check=_1(V.check,x,2,0),K=0,W=0,V.mode=$2;break}if(V.flags=0,V.head)V.head.done=!1;if(!(V.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",V.mode=b;break}if((K&15)!==e9){$.msg="unknown compression method",V.mode=b;break}if(K>>>=4,W-=4,R=(K&15)+8,V.wbits===0)V.wbits=R;else if(R>V.wbits){$.msg="invalid window size",V.mode=b;break}V.dmax=1<<R,$.adler=V.check=1,V.mode=K&512?K2:n1,K=0,W=0;break;case $2:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.flags=K,(V.flags&255)!==e9){$.msg="unknown compression method",V.mode=b;break}if(V.flags&57344){$.msg="unknown header flags set",V.mode=b;break}if(V.head)V.head.text=K>>8&1;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=_1(V.check,x,2,0);K=0,W=0,V.mode=Q2;case Q2:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.time=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,x[2]=K>>>16&255,x[3]=K>>>24&255,V.check=_1(V.check,x,4,0);K=0,W=0,V.mode=V2;case V2:while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.head)V.head.xflags=K&255,V.head.os=K>>8;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=_1(V.check,x,2,0);K=0,W=0,V.mode=q2;case q2:if(V.flags&1024){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.length=K,V.head)V.head.extra_len=K;if(V.flags&512)x[0]=K&255,x[1]=K>>>8&255,V.check=_1(V.check,x,2,0);K=0,W=0}else if(V.head)V.head.extra=null;V.mode=J2;case J2:if(V.flags&1024){if(H=V.length,H>G)H=G;if(H){if(V.head){if(R=V.head.extra_len-V.length,!V.head.extra)V.head.extra=Array(V.head.extra_len);Z1.arraySet(V.head.extra,q,X,H,R)}if(V.flags&512)V.check=_1(V.check,q,H,X);G-=H,X+=H,V.length-=H}if(V.length)break $}V.length=0,V.mode=Y2;case Y2:if(V.flags&2048){if(G===0)break $;H=0;do if(R=q[X+H++],V.head&&R&&V.length<65536)V.head.name+=String.fromCharCode(R);while(R&&H<G);if(V.flags&512)V.check=_1(V.check,q,H,X);if(G-=H,X+=H,R)break $}else if(V.head)V.head.name=null;V.length=0,V.mode=X2;case X2:if(V.flags&4096){if(G===0)break $;H=0;do if(R=q[X+H++],V.head&&R&&V.length<65536)V.head.comment+=String.fromCharCode(R);while(R&&H<G);if(V.flags&512)V.check=_1(V.check,q,H,X);if(G-=H,X+=H,R)break $}else if(V.head)V.head.comment=null;V.mode=G2;case G2:if(V.flags&512){while(W<16){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.check&65535)){$.msg="header crc mismatch",V.mode=b;break}K=0,W=0}if(V.head)V.head.hcrc=V.flags>>9&1,V.head.done=!0;$.adler=V.check=0,V.mode=n1;break;case K2:while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}$.adler=V.check=I2(K),K=0,W=0,V.mode=s6;case s6:if(V.havedict===0)return $.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,TW;$.adler=V.check=1,V.mode=n1;case n1:if(Q===CW||Q===n6)break $;case VQ:if(V.last){K>>>=W&7,W-=W&7,V.mode=JQ;break}while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}switch(V.last=K&1,K>>>=1,W-=1,K&3){case 0:V.mode=W2;break;case 1:if(yW(V),V.mode=r6,Q===n6){K>>>=2,W-=2;break $}break;case 2:V.mode=j2;break;case 3:$.msg="invalid block type",V.mode=b}K>>>=2,W-=2;break;case W2:K>>>=W&7,W-=W&7;while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",V.mode=b;break}if(V.length=K&65535,K=0,W=0,V.mode=qQ,Q===n6)break $;case qQ:V.mode=U2;case U2:if(H=V.length,H){if(H>G)H=G;if(H>U)H=U;if(H===0)break $;Z1.arraySet(Y,q,X,H,J),G-=H,X+=H,U-=H,J+=H,V.length-=H;break}V.mode=n1;break;case j2:while(W<14){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(V.nlen=(K&31)+257,K>>>=5,W-=5,V.ndist=(K&31)+1,K>>>=5,W-=5,V.ncode=(K&15)+4,K>>>=4,W-=4,V.nlen>286||V.ndist>30){$.msg="too many length or distance symbols",V.mode=b;break}V.have=0,V.mode=Z2;case Z2:while(V.have<V.ncode){while(W<3){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.lens[W1[V.have++]]=K&7,K>>>=3,W-=3}while(V.have<19)V.lens[W1[V.have++]]=0;if(V.lencode=V.lendyn,V.lenbits=7,h={bits:V.lenbits},v=b$(IW,V.lens,0,19,V.lencode,0,V.work,h),V.lenbits=h.bits,v){$.msg="invalid code lengths set",V.mode=b;break}V.have=0,V.mode=z2;case z2:while(V.have<V.nlen+V.ndist){for(;;){if(I=V.lencode[K&(1<<V.lenbits)-1],M=I>>>24,L=I>>>16&255,T=I&65535,M<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(T<16)K>>>=M,W-=M,V.lens[V.have++]=T;else{if(T===16){A=M+2;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K>>>=M,W-=M,V.have===0){$.msg="invalid bit length repeat",V.mode=b;break}R=V.lens[V.have-1],H=3+(K&3),K>>>=2,W-=2}else if(T===17){A=M+3;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=M,W-=M,R=0,H=3+(K&7),K>>>=3,W-=3}else{A=M+7;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=M,W-=M,R=0,H=11+(K&127),K>>>=7,W-=7}if(V.have+H>V.nlen+V.ndist){$.msg="invalid bit length repeat",V.mode=b;break}while(H--)V.lens[V.have++]=R}}if(V.mode===b)break;if(V.lens[256]===0){$.msg="invalid code -- missing end-of-block",V.mode=b;break}if(V.lenbits=9,h={bits:V.lenbits},v=b$(w2,V.lens,0,V.nlen,V.lencode,0,V.work,h),V.lenbits=h.bits,v){$.msg="invalid literal/lengths set",V.mode=b;break}if(V.distbits=6,V.distcode=V.distdyn,h={bits:V.distbits},v=b$(T2,V.lens,V.nlen,V.ndist,V.distcode,0,V.work,h),V.distbits=h.bits,v){$.msg="invalid distances set",V.mode=b;break}if(V.mode=r6,Q===n6)break $;case r6:V.mode=a6;case a6:if(G>=6&&U>=258){if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,MW($,z),J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,q=$.input,G=$.avail_in,K=V.hold,W=V.bits,V.mode===n1)V.back=-1;break}V.back=0;for(;;){if(I=V.lencode[K&(1<<V.lenbits)-1],M=I>>>24,L=I>>>16&255,T=I&65535,M<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(L&&(L&240)===0){B=M,O=L,F=T;for(;;){if(I=V.lencode[F+((K&(1<<B+O)-1)>>B)],M=I>>>24,L=I>>>16&255,T=I&65535,B+M<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,V.back+=B}if(K>>>=M,W-=M,V.back+=M,V.length=T,L===0){V.mode=B2;break}if(L&32){V.back=-1,V.mode=n1;break}if(L&64){$.msg="invalid literal/length code",V.mode=b;break}V.extra=L&15,V.mode=H2;case H2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.length+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}V.was=V.length,V.mode=P2;case P2:for(;;){if(I=V.distcode[K&(1<<V.distbits)-1],M=I>>>24,L=I>>>16&255,T=I&65535,M<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if((L&240)===0){B=M,O=L,F=T;for(;;){if(I=V.distcode[F+((K&(1<<B+O)-1)>>B)],M=I>>>24,L=I>>>16&255,T=I&65535,B+M<=W)break;if(G===0)break $;G--,K+=q[X++]<<W,W+=8}K>>>=B,W-=B,V.back+=B}if(K>>>=M,W-=M,V.back+=M,L&64){$.msg="invalid distance code",V.mode=b;break}V.offset=T,V.extra=L&15,V.mode=L2;case L2:if(V.extra){A=V.extra;while(W<A){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}V.offset+=K&(1<<V.extra)-1,K>>>=V.extra,W-=V.extra,V.back+=V.extra}if(V.offset>V.dmax){$.msg="invalid distance too far back",V.mode=b;break}V.mode=O2;case O2:if(U===0)break $;if(H=z-U,V.offset>H){if(H=V.offset-H,H>V.whave){if(V.sane){$.msg="invalid distance too far back",V.mode=b;break}}if(H>V.wnext)H-=V.wnext,C=V.wsize-H;else C=V.wnext-H;if(H>V.length)H=V.length;P=V.window}else P=Y,C=J-V.offset,H=V.length;if(H>U)H=U;U-=H,V.length-=H;do Y[J++]=P[C++];while(--H);if(V.length===0)V.mode=a6;break;case B2:if(U===0)break $;Y[J++]=V.length,U--,V.mode=a6;break;case JQ:if(V.wrap){while(W<32){if(G===0)break $;G--,K|=q[X++]<<W,W+=8}if(z-=U,$.total_out+=z,V.total+=z,z)$.adler=V.check=V.flags?_1(V.check,Y,z,J-z):GQ(V.check,Y,z,J-z);if(z=U,(V.flags?K:I2(K))!==V.check){$.msg="incorrect data check",V.mode=b;break}K=0,W=0}V.mode=N2;case N2:if(V.wrap&&V.flags){while(W<32){if(G===0)break $;G--,K+=q[X++]<<W,W+=8}if(K!==(V.total&4294967295)){$.msg="incorrect length check",V.mode=b;break}K=0,W=0}V.mode=M2;case M2:v=wW;break $;case b:v=A2;break $;case WQ:return KQ;case FW:default:return L1}if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,V.hold=K,V.bits=W,V.wsize||z!==$.avail_out&&V.mode<b&&(V.mode<JQ||Q!==t9)){if(E2($,$.output,$.next_out,z-$.avail_out))return V.mode=WQ,KQ}if(Z-=$.avail_in,z-=$.avail_out,$.total_in+=Z,$.total_out+=z,V.total+=z,V.wrap&&z)$.adler=V.check=V.flags?_1(V.check,Y,z,$.next_out-z):GQ(V.check,Y,z,$.next_out-z);if($.data_type=V.bits+(V.last?64:0)+(V.mode===n1?128:0)+(V.mode===r6||V.mode===qQ?256:0),(Z===0&&z===0||Q===t9)&&v===I0)v=AW;return v}function DW($){if(!$||!$.state)return L1;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,I0}function hW($,Q){var V;if(!$||!$.state)return L1;if(V=$.state,(V.wrap&2)===0)return L1;return V.head=Q,Q.done=!1,I0}function _W($,Q){var V=Q.length,q,Y,X;if(!$||!$.state)return L1;if(q=$.state,q.wrap!==0&&q.mode!==s6)return L1;if(q.mode===s6){if(Y=1,Y=GQ(Y,Q,V,0),Y!==q.check)return A2}if(X=E2($,Q,V,V),X)return q.mode=WQ,KQ;return q.havedict=1,I0}fW.inflateReset=v2;fW.inflateReset2=x2;fW.inflateResetKeep=R2;fW.inflateInit=gW;fW.inflateInit2=S2;fW.inflate=kW;fW.inflateEnd=DW;fW.inflateGetHeader=hW;fW.inflateSetDictionary=_W;fW.inflateInfo="pako inflate (from Nodeca project)"});var UQ=w((qP,y2)=>{y2.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var D2=w((JP,k2)=>{function rW(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}k2.exports=rW});var _2=w((eW)=>{var a0=g2(),m$=o1(),t6=r5(),u=UQ(),jQ=b6(),aW=a5(),sW=D2(),h2=Object.prototype.toString;function C0($){if(!(this instanceof C0))return new C0($);this.options=m$.assign({chunkSize:16384,windowBits:0,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>=0&&Q.windowBits<16){if(Q.windowBits=-Q.windowBits,Q.windowBits===0)Q.windowBits=-15}if(Q.windowBits>=0&&Q.windowBits<16&&!($&&$.windowBits))Q.windowBits+=32;if(Q.windowBits>15&&Q.windowBits<48){if((Q.windowBits&15)===0)Q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new aW,this.strm.avail_out=0;var V=a0.inflateInit2(this.strm,Q.windowBits);if(V!==u.Z_OK)throw Error(jQ[V]);if(this.header=new sW,a0.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=t6.string2buf(Q.dictionary);else if(h2.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(V=a0.inflateSetDictionary(this.strm,Q.dictionary),V!==u.Z_OK)throw Error(jQ[V])}}}C0.prototype.push=function($,Q){var V=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,X,J,G,U,K,W=!1;if(this.ended)return!1;if(J=Q===~~Q?Q:Q===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof $==="string")V.input=t6.binstring2buf($);else if(h2.call($)==="[object ArrayBuffer]")V.input=new Uint8Array($);else V.input=$;V.next_in=0,V.avail_in=V.input.length;do{if(V.avail_out===0)V.output=new m$.Buf8(q),V.next_out=0,V.avail_out=q;if(X=a0.inflate(V,u.Z_NO_FLUSH),X===u.Z_NEED_DICT&&Y)X=a0.inflateSetDictionary(this.strm,Y);if(X===u.Z_BUF_ERROR&&W===!0)X=u.Z_OK,W=!1;if(X!==u.Z_STREAM_END&&X!==u.Z_OK)return this.onEnd(X),this.ended=!0,!1;if(V.next_out){if(V.avail_out===0||X===u.Z_STREAM_END||V.avail_in===0&&(J===u.Z_FINISH||J===u.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=t6.utf8border(V.output,V.next_out),U=V.next_out-G,K=t6.buf2string(V.output,G),V.next_out=U,V.avail_out=q-U,U)m$.arraySet(V.output,V.output,G,U,0);this.onData(K)}else this.onData(m$.shrinkBuf(V.output,V.next_out))}if(V.avail_in===0&&V.avail_out===0)W=!0}while((V.avail_in>0||V.avail_out===0)&&X!==u.Z_STREAM_END);if(X===u.Z_STREAM_END)J=u.Z_FINISH;if(J===u.Z_FINISH)return X=a0.inflateEnd(this.strm),this.onEnd(X),this.ended=!0,X===u.Z_OK;if(J===u.Z_SYNC_FLUSH)return this.onEnd(u.Z_OK),V.avail_out=0,!0;return!0};C0.prototype.onData=function($){this.chunks.push($)};C0.prototype.onEnd=function($){if($===u.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=m$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function ZQ($,Q){var V=new C0(Q);if(V.push($,!0),V.err)throw V.msg||jQ[V.err];return V.result}function tW($,Q){return Q=Q||{},Q.raw=!0,ZQ($,Q)}eW.Inflate=C0;eW.inflate=ZQ;eW.inflateRaw=tW;eW.ungzip=ZQ});var m2=w((XP,b2)=>{var JU=o1().assign,YU=p9(),XU=_2(),GU=UQ(),f2={};JU(f2,YU,XU,GU);b2.exports=f2});var p2=w((jU)=>{var KU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",WU=m2(),c2=m(),e6=j1(),UU=KU?"uint8array":"array";jU.magic="\b\x00";function w0($,Q){e6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}c2.inherits(w0,e6);w0.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(c2.transformTo(UU,$.data),!1)};w0.prototype.flush=function(){if(e6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};w0.prototype.cleanUp=function(){e6.prototype.cleanUp.call(this),this._pako=null};w0.prototype._createPako=function(){this._pako=new WU[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};jU.compressWorker=function($){return new w0("Deflate",$)};jU.uncompressWorker=function(){return new w0("Inflate",{})}});var zQ=w((PU)=>{var u2=j1();PU.STORE={magic:"\x00\x00",compressWorker:function(){return new u2("STORE compression")},uncompressWorker:function(){return new u2("STORE decompression")}};PU.DEFLATE=p2()});var HQ=w((BU)=>{BU.LOCAL_FILE_HEADER="PK\x03\x04";BU.CENTRAL_FILE_HEADER="PK\x01\x02";BU.CENTRAL_DIRECTORY_END="PK\x05\x06";BU.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";BU.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";BU.DATA_DESCRIPTOR="PK\x07\b"});var i2=w((UP,o2)=>{var s0=m(),t0=j1(),PQ=c0(),d2=D6(),$8=HQ(),D=function($,Q){var V="",q;for(q=0;q<Q;q++)V+=String.fromCharCode($&255),$=$>>>8;return V},AU=function($,Q){var V=$;if(!$)V=Q?16893:33204;return(V&65535)<<16},FU=function($){return($||0)&63},l2=function($,Q,V,q,Y,X){var{file:J,compression:G}=$,U=X!==PQ.utf8encode,K=s0.transformTo("string",X(J.name)),W=s0.transformTo("string",PQ.utf8encode(J.name)),Z=J.comment,z=s0.transformTo("string",X(Z)),H=s0.transformTo("string",PQ.utf8encode(Z)),C=W.length!==J.name.length,P=H.length!==Z.length,I,M,L="",T="",B="",O=J.dir,F=J.date,R={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||V)R.crc32=$.crc32,R.compressedSize=$.compressedSize,R.uncompressedSize=$.uncompressedSize;var v=0;if(Q)v|=8;if(!U&&(C||P))v|=2048;var x=0,h=0;if(O)x|=16;if(Y==="UNIX")h=798,x|=AU(J.unixPermissions,O);else h=20,x|=FU(J.dosPermissions,O);if(I=F.getUTCHours(),I=I<<6,I=I|F.getUTCMinutes(),I=I<<5,I=I|F.getUTCSeconds()/2,M=F.getUTCFullYear()-1980,M=M<<4,M=M|F.getUTCMonth()+1,M=M<<5,M=M|F.getUTCDate(),C)T=D(1,1)+D(d2(K),4)+W,L+="up"+D(T.length,2)+T;if(P)B=D(1,1)+D(d2(z),4)+H,L+="uc"+D(B.length,2)+B;var A="";A+=`
3
+ \x00`,A+=D(v,2),A+=G.magic,A+=D(I,2),A+=D(M,2),A+=D(R.crc32,4),A+=D(R.compressedSize,4),A+=D(R.uncompressedSize,4),A+=D(K.length,2),A+=D(L.length,2);var W1=$8.LOCAL_FILE_HEADER+A+K+L,v0=$8.CENTRAL_FILE_HEADER+D(h,2)+A+D(z.length,2)+"\x00\x00\x00\x00"+D(x,4)+D(q,4)+K+L+z;return{fileRecord:W1,dirRecord:v0}},RU=function($,Q,V,q,Y){var X="",J=s0.transformTo("string",Y(q));return X=$8.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+D($,2)+D($,2)+D(Q,4)+D(V,4)+D(J.length,2)+J,X},vU=function($){var Q="";return Q=$8.DATA_DESCRIPTOR+D($.crc32,4)+D($.compressedSize,4)+D($.uncompressedSize,4),Q};function R1($,Q,V,q){t0.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=V,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s0.inherits(R1,t0);R1.prototype.push=function($){var Q=$.meta.percent||0,V=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,t0.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:V?(Q+100*(V-q-1))/V:100}})};R1.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var V=l2($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:V.fileRecord,meta:{percent:0}})}else this.accumulate=!0};R1.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,V=l2($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(V.dirRecord),Q)this.push({data:vU($),meta:{percent:100}});else{this.push({data:V.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};R1.prototype.flush=function(){var $=this.bytesWritten;for(var Q=0;Q<this.dirRecords.length;Q++)this.push({data:this.dirRecords[Q],meta:{percent:100}});var V=this.bytesWritten-$,q=RU(this.dirRecords.length,V,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};R1.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};R1.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(V){Q.processChunk(V)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(V){Q.error(V)}),this};R1.prototype.resume=function(){if(!t0.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};R1.prototype.error=function($){var Q=this._sources;if(!t0.prototype.error.call(this,$))return!1;for(var V=0;V<Q.length;V++)try{Q[V].error($)}catch(q){}return!0};R1.prototype.lock=function(){t0.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};o2.exports=R1});var n2=w((gU)=>{var xU=zQ(),SU=i2(),EU=function($,Q){var V=$||Q,q=xU[V];if(!q)throw Error(V+" is not a valid compression method !");return q};gU.generateWorker=function($,Q,V){var q=new SU(Q.streamFiles,V,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(X,J){Y++;var G=EU(J.options.compression,Q.compression),U=J.options.compressionOptions||Q.compressionOptions||{},K=J.dir,W=J.date;J._compressWorker(G,U).withStreamInfo("file",{name:X,dir:K,date:W,comment:J.comment||"",unixPermissions:J.unixPermissions,dosPermissions:J.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(X){q.error(X)}return q}});var a2=w((ZP,r2)=>{var kU=m(),Q8=j1();function c$($,Q){Q8.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}kU.inherits(c$,Q8);c$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(V){Q.push({data:V,meta:{percent:0}})}).on("error",function(V){if(Q.isPaused)this.generatedError=V;else Q.error(V)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};c$.prototype.pause=function(){if(!Q8.prototype.pause.call(this))return!1;return this._stream.pause(),!0};c$.prototype.resume=function(){if(!Q8.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};r2.exports=c$});var X7=w((zP,Y7)=>{var DU=c0(),p$=m(),$7=j1(),hU=N5(),Q7=M5(),s2=h6(),_U=tq(),fU=n2(),t2=M$(),bU=a2(),V7=function($,Q,V){var q=p$.getTypeOf(Q),Y,X=p$.extend(V||{},Q7);if(X.date=X.date||new Date,X.compression!==null)X.compression=X.compression.toUpperCase();if(typeof X.unixPermissions==="string")X.unixPermissions=parseInt(X.unixPermissions,8);if(X.unixPermissions&&X.unixPermissions&16384)X.dir=!0;if(X.dosPermissions&&X.dosPermissions&16)X.dir=!0;if(X.dir)$=q7($);if(X.createFolders&&(Y=mU($)))J7.call(this,Y,!0);var J=q==="string"&&X.binary===!1&&X.base64===!1;if(!V||typeof V.binary>"u")X.binary=!J;var G=Q instanceof s2&&Q.uncompressedSize===0;if(G||X.dir||!Q||Q.length===0)X.base64=!1,X.binary=!0,Q="",X.compression="STORE",q="string";var U=null;if(Q instanceof s2||Q instanceof $7)U=Q;else if(t2.isNode&&t2.isStream(Q))U=new bU($,Q);else U=p$.prepareContent($,Q,X.binary,X.optimizedBinaryString,X.base64);var K=new _U($,U,X);this.files[$]=K},mU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},q7=function($){if($.slice(-1)!=="/")$+="/";return $},J7=function($,Q){if(Q=typeof Q<"u"?Q:Q7.createFolders,$=q7($),!this.files[$])V7.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function e2($){return Object.prototype.toString.call($)==="[object RegExp]"}var cU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,V,q;for(Q in this.files)if(q=this.files[Q],V=Q.slice(this.root.length,Q.length),V&&Q.slice(0,this.root.length)===this.root)$(V,q)},filter:function($){var Q=[];return this.forEach(function(V,q){if($(V,q))Q.push(q)}),Q},file:function($,Q,V){if(arguments.length===1)if(e2($)){var q=$;return this.filter(function(X,J){return!J.dir&&q.test(X)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,V7.call(this,$,Q,V);return this},folder:function($){if(!$)return this;if(e2($))return this.filter(function(Y,X){return X.dir&&$.test(Y)});var Q=this.root+$,V=J7.call(this,Q),q=this.clone();return q.root=V.name,q},remove:function($){$=this.root+$;var Q=this.files[$];if(!Q){if($.slice(-1)!=="/")$+="/";Q=this.files[$]}if(Q&&!Q.dir)delete this.files[$];else{var V=this.filter(function(Y,X){return X.name.slice(0,$.length)===$});for(var q=0;q<V.length;q++)delete this.files[V[q].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function($){var Q,V={};try{if(V=p$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:DU.utf8encode}),V.type=V.type.toLowerCase(),V.compression=V.compression.toUpperCase(),V.type==="binarystring")V.type="string";if(!V.type)throw Error("No output type specified.");if(p$.checkSupport(V.type),V.platform==="darwin"||V.platform==="freebsd"||V.platform==="linux"||V.platform==="sunos")V.platform="UNIX";if(V.platform==="win32")V.platform="DOS";var q=V.comment||this.comment||"";Q=fU.generateWorker(this,V,q)}catch(Y){Q=new $7("error"),Q.error(Y)}return new hU(Q,V.type||"string",V.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};Y7.exports=cU});var LQ=w((HP,K7)=>{var pU=m();function G7($){this.data=$,this.length=$.length,this.index=0,this.zero=0}G7.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length<this.zero+$||$<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+$+"). Corrupted zip ?")},setIndex:function($){this.checkIndex($),this.index=$},skip:function($){this.setIndex(this.index+$)},byteAt:function(){},readInt:function($){var Q=0,V;this.checkOffset($);for(V=this.index+$-1;V>=this.index;V--)Q=(Q<<8)+this.byteAt(V);return this.index+=$,Q},readString:function($){return pU.transformTo("string",this.readData($))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var $=this.readInt(4);return new Date(Date.UTC(($>>25&127)+1980,($>>21&15)-1,$>>16&31,$>>11&31,$>>5&63,($&31)<<1))}};K7.exports=G7});var OQ=w((PP,U7)=>{var W7=LQ(),uU=m();function e0($){W7.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}uU.inherits(e0,W7);e0.prototype.byteAt=function($){return this.data[this.zero+$]};e0.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var X=this.length-4;X>=0;--X)if(this.data[X]===Q&&this.data[X+1]===V&&this.data[X+2]===q&&this.data[X+3]===Y)return X-this.zero;return-1};e0.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),V=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),X=this.readData(4);return Q===X[0]&&V===X[1]&&q===X[2]&&Y===X[3]};e0.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};U7.exports=e0});var z7=w((LP,Z7)=>{var j7=LQ(),dU=m();function $$($){j7.call(this,$)}dU.inherits($$,j7);$$.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};$$.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};$$.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};$$.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};Z7.exports=$$});var NQ=w((OP,P7)=>{var H7=OQ(),lU=m();function BQ($){H7.call(this,$)}lU.inherits(BQ,H7);BQ.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var Q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};P7.exports=BQ});var B7=w((BP,O7)=>{var L7=NQ(),oU=m();function MQ($){L7.call(this,$)}oU.inherits(MQ,L7);MQ.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};O7.exports=MQ});var IQ=w((NP,M7)=>{var V8=m(),N7=l1(),iU=OQ(),nU=z7(),rU=B7(),aU=NQ();M7.exports=function($){var Q=V8.getTypeOf($);if(V8.checkSupport(Q),Q==="string"&&!N7.uint8array)return new nU($);if(Q==="nodebuffer")return new rU($);if(N7.uint8array)return new aU(V8.transformTo("uint8array",$));return new iU(V8.transformTo("array",$))}});var T7=w((MP,w7)=>{var CQ=IQ(),W0=m(),sU=h6(),I7=D6(),q8=c0(),J8=zQ(),tU=l1(),eU=0,$j=3,Qj=function($){for(var Q in J8){if(!Object.prototype.hasOwnProperty.call(J8,Q))continue;if(J8[Q].magic===$)return J8[Q]}return null};function C7($,Q){this.options=$,this.loadOptions=Q}C7.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,V;if($.skip(22),this.fileNameLength=$.readInt(2),V=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(V),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(Q=Qj(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+W0.pretty(this.compressionMethod)+" unknown (inner file : "+W0.transformTo("string",this.fileName)+")");this.decompressed=new sU(this.compressedSize,this.uncompressedSize,this.crc32,Q,$.readData(this.compressedSize))},readCentralPart:function($){this.versionMadeBy=$.readInt(2),$.skip(2),this.bitFlag=$.readInt(2),this.compressionMethod=$.readString(2),this.date=$.readDate(),this.crc32=$.readInt(4),this.compressedSize=$.readInt(4),this.uncompressedSize=$.readInt(4);var Q=$.readInt(2);if(this.extraFieldsLength=$.readInt(2),this.fileCommentLength=$.readInt(2),this.diskNumberStart=$.readInt(2),this.internalFileAttributes=$.readInt(2),this.externalFileAttributes=$.readInt(4),this.localHeaderOffset=$.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");$.skip(Q),this.readExtraFields($),this.parseZIP64ExtraField($),this.fileComment=$.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var $=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,$===eU)this.dosPermissions=this.externalFileAttributes&63;if($===$j)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=CQ(this.extraFields[1].value);if(this.uncompressedSize===W0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===W0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===W0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===W0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,V,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)V=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[V]={id:V,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=tU.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=q8.utf8decode(this.fileName),this.fileCommentStr=q8.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var V=W0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(V)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=W0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=CQ($.value);if(Q.readInt(1)!==1)return null;if(I7(this.fileName)!==Q.readInt(4))return null;return q8.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=CQ($.value);if(Q.readInt(1)!==1)return null;if(I7(this.fileComment)!==Q.readInt(4))return null;return q8.utf8decode(Q.readData($.length-5))}return null}};w7.exports=C7});var R7=w((IP,F7)=>{var Vj=IQ(),r1=m(),v1=HQ(),qj=T7(),Jj=l1();function A7($){this.files=[],this.loadOptions=$}A7.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var Q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+r1.pretty(Q)+", expected "+r1.pretty($)+")")}},isSignature:function($,Q){var V=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(V),Y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),Q=Jj.uint8array?"uint8array":"array",V=r1.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(V)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,Q=0,V,q,Y;while(Q<$)V=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[V]={id:V,length:q,value:Y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,Q;for($=0;$<this.files.length;$++)Q=this.files[$],this.reader.setIndex(Q.localHeaderOffset),this.checkSignature(v1.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(v1.CENTRAL_FILE_HEADER))$=new qj({zip64:this.zip64},this.loadOptions),$.readCentralPart(this.reader),this.files.push($);if(this.centralDirRecords!==this.files.length){if(this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}},readEndOfCentral:function(){var $=this.reader.lastIndexOfSignature(v1.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,v1.LOCAL_FILE_HEADER);if(Q)throw Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");else throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex($);var V=$;if(this.checkSignature(v1.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r1.MAX_VALUE_16BITS||this.centralDirRecords===r1.MAX_VALUE_16BITS||this.centralDirSize===r1.MAX_VALUE_32BITS||this.centralDirOffset===r1.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),$<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex($),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,v1.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory")}this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=V-q;if(Y>0)if(this.isSignature(V,v1.CENTRAL_FILE_HEADER));else this.reader.zero=Y;else if(Y<0)throw Error("Corrupted zip: missing "+Math.abs(Y)+" bytes.")},prepareReader:function($){this.reader=Vj($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};F7.exports=A7});var S7=w((CP,x7)=>{var wQ=m(),Y8=f0(),Yj=c0(),Xj=R7(),Gj=w5(),v7=M$();function Kj($){return new Y8.Promise(function(Q,V){var q=$.decompressed.getContentWorker().pipe(new Gj);q.on("error",function(Y){V(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)V(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}x7.exports=function($,Q){var V=this;if(Q=wQ.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:Yj.utf8decode}),v7.isNode&&v7.isStream($))return Y8.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return wQ.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new Xj(Q);return Y.load(q),Y}).then(function(Y){var X=[Y8.Promise.resolve(Y)],J=Y.files;if(Q.checkCRC32)for(var G=0;G<J.length;G++)X.push(Kj(J[G]));return Y8.Promise.all(X)}).then(function(Y){var X=Y.shift(),J=X.files;for(var G=0;G<J.length;G++){var U=J[G],K=U.fileNameStr,W=wQ.resolve(U.fileNameStr);if(V.file(W,U.decompressed,{binary:!0,optimizedBinaryString:!0,date:U.date,dir:U.dir,comment:U.fileCommentStr.length?U.fileCommentStr:null,unixPermissions:U.unixPermissions,dosPermissions:U.dosPermissions,createFolders:Q.createFolders}),!U.dir)V.file(W).unsafeOriginalName=K}if(X.zipComment.length)V.comment=X.zipComment;return V})}});var g7=w((wP,E7)=>{function O1(){if(!(this instanceof O1))return new O1;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new O1;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}O1.prototype=X7();O1.prototype.loadAsync=S7();O1.support=l1();O1.defaults=M5();O1.version="3.10.1";O1.loadAsync=function($,Q){return new O1().loadAsync($,Q)};O1.external=f0();E7.exports=O1});var EJ={};iQ(EJ,{persistRunningBinary:()=>kZ,PERSIST_PATH:()=>Y$,PERSIST_DIR:()=>hQ});import{copyFile as EZ,mkdir as gZ}from"node:fs/promises";import{homedir as yZ}from"node:os";import{join as SJ}from"node:path";async function kZ(){let $=process.argv[1];if(!$)return{ok:!1,path:Y$,reason:"no argv[1]"};try{await gZ(hQ,{recursive:!0}),await EZ($,Y$);let{chmod:Q}=await import("node:fs/promises");try{await Q(Y$,493)}catch{}return{ok:!0,path:Y$}}catch(Q){return{ok:!1,path:Y$,reason:Q.message}}}var hQ,Y$;var gJ=nQ(()=>{hQ=SJ(yZ(),".petdex","bin"),Y$=SJ(hQ,"petdex.js")});function Yz($){let Q=$.toLowerCase();if(Q==="read")return"read";if(Q==="edit"||Q==="multiedit")return"edit";if(Q==="write")return"write";if(Q==="bash"||Q==="shell")return"bash";if(Q==="grep")return"grep";if(Q==="glob")return"glob";if(Q==="webfetch"||Q==="websearch")return"webfetch";if(Q==="task"||Q==="agent")return"task";return"unknown"}function m1($,Q){if($==null||typeof $!=="object")return null;let V=$[Q];return typeof V==="string"?V:null}function nJ($){let Q=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));return Q>=0?$.slice(Q+1):$}function x1($,Q=40){if($.length<=Q)return $;return`${$.slice(0,Q-1)}…`}function rJ($){if($.kind==="session.start")return"Thinking…";if($.kind==="session.end")return"Done.";if($.kind==="session.waiting")return"Waiting for you…";let{toolName:Q,phase:V,toolInput:q}=$,Y=Yz(Q),X=V==="done";switch(Y){case"read":{let J=m1(q,"file_path")??m1(q,"path"),G=J?x1(nJ(J)):null;if(G)return X?`Read ${G}`:`Reading ${G}`;return X?"Read file":"Reading file"}case"edit":case"write":{let J=m1(q,"file_path")??m1(q,"path"),G=J?x1(nJ(J)):null;if(G)return X?`Edited ${G}`:`Editing ${G}`;return X?"Edited file":"Editing file"}case"bash":{let J=m1(q,"command");if(J){let G=x1(J.split(/\s+/)[0]??J,24);return X?`Ran ${G}`:`Running ${G}`}return X?"Ran command":"Running command"}case"grep":{let J=m1(q,"pattern");if(J)return X?`Searched "${x1(J,28)}"`:`Searching "${x1(J,28)}"`;return X?"Searched files":"Searching files"}case"glob":{let J=m1(q,"pattern");if(J)return X?`Listed ${x1(J,28)}`:`Listing ${x1(J,28)}`;return X?"Listed files":"Listing files"}case"webfetch":{let J=m1(q,"url");if(J)try{let G=new URL(J).hostname;return X?`Fetched ${x1(G,28)}`:`Fetching ${x1(G,28)}`}catch{}return X?"Fetched web":"Searching web"}case"task":{let J=m1(q,"description")??m1(q,"subject");if(J)return X?"Subagent done":`Spawning ${x1(J,28)}`;return X?"Subagent done":"Spawning subagent"}case"unknown":default:{let J=x1(Q,28);return X?`Called ${J}`:`Calling ${J}`}}}var qY={};iQ(qY,{stateForEvent:()=>$Y,runBubble:()=>Pz,eventFromArgs:()=>VY});import{existsSync as Xz,readFileSync as Gz}from"node:fs";import{homedir as Kz}from"node:os";import{join as mQ}from"node:path";function $Y($,Q){let V=$[0];if(V==="pre"){if(Q){let q=Q.toLowerCase();if(q==="read"||q==="grep"||q==="glob")return"review"}return"running"}if(V==="post")return"idle";if(V==="stop"||V==="session-end")return"waving";if(V==="user-prompt"||V==="session-start")return"jumping";if(V==="waiting"||V==="notification")return"waiting";return null}async function zz(){if(process.stdin.isTTY)return"";return await new Promise(($)=>{let Q="",V=!1;process.stdin.setEncoding("utf8"),process.stdin.on("data",(q)=>{if(V)return;if(Q.length+q.length>aJ){Q+=q.slice(0,aJ-Q.length),V=!0;return}Q+=q}),process.stdin.on("end",()=>$(Q)),process.stdin.on("error",()=>$(Q))})}function QY($){if(!$.trim())return{toolName:null,toolInput:void 0,agentSource:null};try{let Q=JSON.parse($),V=typeof Q.tool_name==="string"?Q.tool_name:null,q=Q.tool_input,Y=typeof Q.agent_source==="string"?Q.agent_source:null;return{toolName:V,toolInput:q,agentSource:Y}}catch{return{toolName:null,toolInput:void 0,agentSource:null}}}function VY($,Q){let V=$[0];if(!V)return null;if(V==="stop"||V==="session-end")return{kind:"session.end"};if(V==="user-prompt"||V==="session-start")return{kind:"session.start"};if(V==="waiting"||V==="notification")return{kind:"session.waiting"};let q=V==="pre"?"running":V==="post"?"done":null;if(!q)return null;let{toolName:Y,toolInput:X}=QY(Q);if(!Y)return{kind:"tool",phase:q,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:q,toolName:Y,toolInput:X}}function Hz(){try{let $=Gz(Wz,"utf8").trim();return $.length>0?$:null}catch{return null}}async function sJ($,Q,V){let q=new AbortController,Y=setTimeout(()=>q.abort(),300);try{await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":V},body:JSON.stringify(Q),signal:q.signal})}catch{}finally{clearTimeout(Y)}}async function Pz($){if(Xz(Uz))return;let Q=$[1]??null,V=await zz(),q=VY($,V);if(!q)return;let{toolName:Y,agentSource:X}=QY(V),J=X??Q,G=rJ(q),U=$Y($,Y),K=Hz();if(!K)return;let W=[];if(G)W.push(sJ(jz,{text:G,agent_source:J},K));if(U)W.push(sJ(Zz,{state:U,agent_source:J},K));await Promise.all(W)}var tJ,Wz,Uz,eJ="http://127.0.0.1:7777",jz,Zz,aJ=65536;var JY=nQ(()=>{tJ=mQ(Kz(),".petdex","runtime"),Wz=mQ(tJ,"update-token"),Uz=mQ(tJ,"hooks-disabled"),jz=`${eJ}/bubble`,Zz=`${eJ}/state`});import{mkdir as YY,readdir as Lz,readFile as uQ,stat as ZY,writeFile as L8}from"node:fs/promises";import{homedir as XY}from"node:os";import X1 from"node:path";import{stripVTControlCharacters as y8}from"node:util";var e=I1(w8(),1);import{stdin as GV,stdout as KV}from"node:process";import*as t1 from"node:readline";import tQ from"node:readline";import{Writable as gY}from"node:stream";function yY({onlyFirst:$=!1}={}){let Q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Q,$?void 0:"g")}var kY=yY();function WV($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(kY,"")}function UV($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}var jV={exports:{}};(function($){var Q={};$.exports=Q,Q.eastAsianWidth=function(q){var Y=q.charCodeAt(0),X=q.length==2?q.charCodeAt(1):0,J=Y;return 55296<=Y&&Y<=56319&&56320<=X&&X<=57343&&(Y&=1023,X&=1023,J=Y<<10|X,J+=65536),J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510?"F":J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518?"H":4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141?"W":32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630?"Na":J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109?"A":"N"},Q.characterLength=function(q){var Y=this.eastAsianWidth(q);return Y=="F"||Y=="W"||Y=="A"?2:1};function V(q){return q.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}Q.length=function(q){for(var Y=V(q),X=0,J=0;J<Y.length;J++)X=X+this.characterLength(Y[J]);return X},Q.slice=function(q,Y,X){textLen=Q.length(q),Y=Y||0,X=X||1,Y<0&&(Y=textLen+Y),X<0&&(X=textLen+X);for(var J="",G=0,U=V(q),K=0;K<U.length;K++){var W=U[K],Z=Q.length(W);if(G>=Y-(Z==2?1:0))if(G+Z<=X)J+=W;else break;G+=Z}return J}})(jV);var DY=jV.exports,hY=UV(DY),_Y=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},fY=UV(_Y);function G$($,Q={}){if(typeof $!="string"||$.length===0||(Q={ambiguousIsNarrow:!0,...Q},$=WV($),$.length===0))return 0;$=$.replace(fY()," ");let V=Q.ambiguousIsNarrow?1:2,q=0;for(let Y of $){let X=Y.codePointAt(0);if(X<=31||X>=127&&X<=159||X>=768&&X<=879)continue;switch(hY.eastAsianWidth(Y)){case"F":case"W":q+=2;break;case"A":q+=V;break;default:q+=1}}return q}var A8=10,eQ=($=0)=>(Q)=>`\x1B[${Q+$}m`,$V=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,QV=($=0)=>(Q,V,q)=>`\x1B[${38+$};2;${Q};${V};${q}m`,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(f.modifier);var bY=Object.keys(f.color),mY=Object.keys(f.bgColor);[...bY,...mY];function cY(){let $=new Map;for(let[Q,V]of Object.entries(f)){for(let[q,Y]of Object.entries(V))f[q]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},V[q]=f[q],$.set(Y[0],Y[1]);Object.defineProperty(f,Q,{value:V,enumerable:!1})}return Object.defineProperty(f,"codes",{value:$,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=eQ(),f.color.ansi256=$V(),f.color.ansi16m=QV(),f.bgColor.ansi=eQ(A8),f.bgColor.ansi256=$V(A8),f.bgColor.ansi16m=QV(A8),Object.defineProperties(f,{rgbToAnsi256:{value:(Q,V,q)=>Q===V&&V===q?Q<8?16:Q>248?231:Math.round((Q-8)/247*24)+232:16+36*Math.round(Q/255*5)+6*Math.round(V/255*5)+Math.round(q/255*5),enumerable:!1},hexToRgb:{value:(Q)=>{let V=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!V)return[0,0,0];let[q]=V;q.length===3&&(q=[...q].map((X)=>X+X).join(""));let Y=Number.parseInt(q,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>f.rgbToAnsi256(...f.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value:(Q)=>{if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let V,q,Y;if(Q>=232)V=((Q-232)*10+8)/255,q=V,Y=V;else{Q-=16;let G=Q%36;V=Math.floor(Q/36)/5,q=Math.floor(G/6)/5,Y=G%6/5}let X=Math.max(V,q,Y)*2;if(X===0)return 30;let J=30+(Math.round(Y)<<2|Math.round(q)<<1|Math.round(V));return X===2&&(J+=60),J},enumerable:!1},rgbToAnsi:{value:(Q,V,q)=>f.ansi256ToAnsi(f.rgbToAnsi256(Q,V,q)),enumerable:!1},hexToAnsi:{value:(Q)=>f.ansi256ToAnsi(f.hexToAnsi256(Q)),enumerable:!1}}),f}var pY=cY(),U6=new Set(["\x1B","›"]),uY=39,v8="\x07",ZV="[",dY="]",zV="m",x8=`${dY}8;;`,VV=($)=>`${U6.values().next().value}${ZV}${$}${zV}`,qV=($)=>`${U6.values().next().value}${x8}${$}${v8}`,lY=($)=>$.split(" ").map((Q)=>G$(Q)),F8=($,Q,V)=>{let q=[...Q],Y=!1,X=!1,J=G$(WV($[$.length-1]));for(let[G,U]of q.entries()){let K=G$(U);if(J+K<=V?$[$.length-1]+=U:($.push(U),J=0),U6.has(U)&&(Y=!0,X=q.slice(G+1).join("").startsWith(x8)),Y){X?U===v8&&(Y=!1,X=!1):U===zV&&(Y=!1);continue}J+=K,J===V&&G<q.length-1&&($.push(""),J=0)}!J&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},oY=($)=>{let Q=$.split(" "),V=Q.length;for(;V>0&&!(G$(Q[V-1])>0);)V--;return V===Q.length?$:Q.slice(0,V).join(" ")+Q.slice(V).join("")},iY=($,Q,V={})=>{if(V.trim!==!1&&$.trim()==="")return"";let q="",Y,X,J=lY($),G=[""];for(let[K,W]of $.split(" ").entries()){V.trim!==!1&&(G[G.length-1]=G[G.length-1].trimStart());let Z=G$(G[G.length-1]);if(K!==0&&(Z>=Q&&(V.wordWrap===!1||V.trim===!1)&&(G.push(""),Z=0),(Z>0||V.trim===!1)&&(G[G.length-1]+=" ",Z++)),V.hard&&J[K]>Q){let z=Q-Z,H=1+Math.floor((J[K]-z-1)/Q);Math.floor((J[K]-1)/Q)<H&&G.push(""),F8(G,W,Q);continue}if(Z+J[K]>Q&&Z>0&&J[K]>0){if(V.wordWrap===!1&&Z<Q){F8(G,W,Q);continue}G.push("")}if(Z+J[K]>Q&&V.wordWrap===!1){F8(G,W,Q);continue}G[G.length-1]+=W}V.trim!==!1&&(G=G.map((K)=>oY(K)));let U=[...G.join(`
4
+ `)];for(let[K,W]of U.entries()){if(q+=W,U6.has(W)){let{groups:z}=new RegExp(`(?:\\${ZV}(?<code>\\d+)m|\\${x8}(?<uri>.*)${v8})`).exec(U.slice(K).join(""))||{groups:{}};if(z.code!==void 0){let H=Number.parseFloat(z.code);Y=H===uY?void 0:H}else z.uri!==void 0&&(X=z.uri.length===0?void 0:z.uri)}let Z=pY.codes.get(Number(Y));U[K+1]===`
5
+ `?(X&&(q+=qV("")),Y&&Z&&(q+=VV(Z))):W===`
6
+ `&&(Y&&Z&&(q+=VV(Y)),X&&(q+=qV(X)))}return q};function JV($,Q,V){return String($).normalize().replace(/\r\n/g,`
7
7
  `).split(`
8
- `).map((q)=>TY(q,Q,V)).join(`
9
- `)}var AY=["up","down","left","right","space","enter","cancel"],G6={actions:new Set(AY),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function R8($,Q){if(typeof $=="string")return G6.aliases.get($)===Q;for(let V of $)if(V!==void 0&&R8(V,Q))return!0;return!1}function RY($,Q){if($===Q)return;let V=$.split(`
8
+ `).map((q)=>iY(q,Q,V)).join(`
9
+ `)}var nY=["up","down","left","right","space","enter","cancel"],W6={actions:new Set(nY),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function S8($,Q){if(typeof $=="string")return W6.aliases.get($)===Q;for(let V of $)if(V!==void 0&&S8(V,Q))return!0;return!1}function rY($,Q){if($===Q)return;let V=$.split(`
10
10
  `),q=Q.split(`
11
- `),Y=[];for(let X=0;X<Math.max(V.length,q.length);X++)V[X]!==q[X]&&Y.push(X);return Y}var FY=globalThis.process.platform.startsWith("win"),w8=Symbol("clack:cancel");function m1($){return $===w8}function X6($,Q){let V=$;V.isTTY&&V.setRawMode(Q)}function XV({input:$=eQ,output:Q=$V,overwrite:V=!0,hideCursor:q=!0}={}){let Y=s1.createInterface({input:$,output:Q,prompt:"",tabSize:1});s1.emitKeypressEvents($,Y),$.isTTY&&$.setRawMode(!0);let X=(J,{name:G,sequence:U})=>{let K=String(J);if(R8([K,G,U],"cancel")){q&&Q.write(e.cursor.show),process.exit(0);return}if(!V)return;s1.moveCursor(Q,G==="return"?0:-1,G==="return"?-1:0,()=>{s1.clearLine(Q,1,()=>{$.once("keypress",X)})})};return q&&Q.write(e.cursor.hide),$.once("keypress",X),()=>{$.off("keypress",X),q&&Q.write(e.cursor.show),$.isTTY&&!FY&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}var vY=Object.defineProperty,xY=($,Q,V)=>(Q in $)?vY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,U1=($,Q,V)=>(xY($,typeof Q!="symbol"?Q+"":Q,V),V);class W6{constructor($,Q=!0){U1(this,"input"),U1(this,"output"),U1(this,"_abortSignal"),U1(this,"rl"),U1(this,"opts"),U1(this,"_render"),U1(this,"_track",!1),U1(this,"_prevFrame",""),U1(this,"_subscribers",new Map),U1(this,"_cursor",0),U1(this,"state","initial"),U1(this,"error",""),U1(this,"value");let{input:V=eQ,output:q=$V,render:Y,signal:X,...J}=$;this.opts=J,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Q,this._abortSignal=X,this.input=V,this.output=q}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let V=this._subscribers.get($)??[];V.push(Q),this._subscribers.set($,V)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let V=this._subscribers.get($)??[],q=[];for(let Y of V)Y.cb(...Q),Y.once&&q.push(()=>V.splice(V.indexOf(Y),1));for(let Y of q)Y()}prompt(){return new Promise(($,Q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(w8);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let V=new WY;V._write=(q,Y,X)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),X()},this.input.pipe(V),this.rl=dQ.createInterface({input:this.input,output:V,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),dQ.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),X6(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),X6(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),X6(this.input,!1),$(w8)})})}onKeypress($,Q){if(this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&G6.aliases.has(Q.name)&&this.emit("cursor",G6.aliases.get(Q.name)),G6.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),Q?.name==="return"){if(this.opts.validate){let V=this.opts.validate(this.value);V&&(this.error=V instanceof Error?V.message:V,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}R8([$,Q?.name,Q?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
12
- `),X6(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=aQ(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
13
- `).length-1;this.output.write(e.cursor.move(-999,$*-1))}render(){let $=aQ(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(e.cursor.hide);else{let Q=RY(this._prevFrame,$);if(this.restoreCursor(),Q&&Q?.length===1){let V=Q[0];this.output.write(e.cursor.move(0,V)),this.output.write(e.erase.lines(1));let q=$.split(`
11
+ `),Y=[];for(let X=0;X<Math.max(V.length,q.length);X++)V[X]!==q[X]&&Y.push(X);return Y}var aY=globalThis.process.platform.startsWith("win"),R8=Symbol("clack:cancel");function e1($){return $===R8}function K6($,Q){let V=$;V.isTTY&&V.setRawMode(Q)}function HV({input:$=GV,output:Q=KV,overwrite:V=!0,hideCursor:q=!0}={}){let Y=t1.createInterface({input:$,output:Q,prompt:"",tabSize:1});t1.emitKeypressEvents($,Y),$.isTTY&&$.setRawMode(!0);let X=(J,{name:G,sequence:U})=>{let K=String(J);if(S8([K,G,U],"cancel")){q&&Q.write(e.cursor.show),process.exit(0);return}if(!V)return;t1.moveCursor(Q,G==="return"?0:-1,G==="return"?-1:0,()=>{t1.clearLine(Q,1,()=>{$.once("keypress",X)})})};return q&&Q.write(e.cursor.hide),$.once("keypress",X),()=>{$.off("keypress",X),q&&Q.write(e.cursor.show),$.isTTY&&!aY&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}var sY=Object.defineProperty,tY=($,Q,V)=>(Q in $)?sY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,U1=($,Q,V)=>(tY($,typeof Q!="symbol"?Q+"":Q,V),V);class j6{constructor($,Q=!0){U1(this,"input"),U1(this,"output"),U1(this,"_abortSignal"),U1(this,"rl"),U1(this,"opts"),U1(this,"_render"),U1(this,"_track",!1),U1(this,"_prevFrame",""),U1(this,"_subscribers",new Map),U1(this,"_cursor",0),U1(this,"state","initial"),U1(this,"error",""),U1(this,"value");let{input:V=GV,output:q=KV,render:Y,signal:X,...J}=$;this.opts=J,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Q,this._abortSignal=X,this.input=V,this.output=q}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let V=this._subscribers.get($)??[];V.push(Q),this._subscribers.set($,V)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let V=this._subscribers.get($)??[],q=[];for(let Y of V)Y.cb(...Q),Y.once&&q.push(()=>V.splice(V.indexOf(Y),1));for(let Y of q)Y()}prompt(){return new Promise(($,Q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(R8);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let V=new gY;V._write=(q,Y,X)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),X()},this.input.pipe(V),this.rl=tQ.createInterface({input:this.input,output:V,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),tQ.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),K6(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),K6(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),K6(this.input,!1),$(R8)})})}onKeypress($,Q){if(this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&W6.aliases.has(Q.name)&&this.emit("cursor",W6.aliases.get(Q.name)),W6.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),Q?.name==="return"){if(this.opts.validate){let V=this.opts.validate(this.value);V&&(this.error=V instanceof Error?V.message:V,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}S8([$,Q?.name,Q?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
12
+ `),K6(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=JV(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
13
+ `).length-1;this.output.write(e.cursor.move(-999,$*-1))}render(){let $=JV(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(e.cursor.hide);else{let Q=rY(this._prevFrame,$);if(this.restoreCursor(),Q&&Q?.length===1){let V=Q[0];this.output.write(e.cursor.move(0,V)),this.output.write(e.erase.lines(1));let q=$.split(`
14
14
  `);this.output.write(q[V]),this._prevFrame=$,this.output.write(e.cursor.move(0,q.length-V-1));return}if(Q&&Q?.length>1){let V=Q[0];this.output.write(e.cursor.move(0,V)),this.output.write(e.erase.down());let q=$.split(`
15
15
  `).slice(V);this.output.write(q.join(`
16
- `)),this._prevFrame=$;return}this.output.write(e.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}class F8 extends W6{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(e.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var SY;SY=new WeakMap;var EY=Object.defineProperty,gY=($,Q,V)=>(Q in $)?EY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,sQ=($,Q,V)=>(gY($,typeof Q!="symbol"?Q+"":Q,V),V),GV=class extends W6{constructor($){super($,!1),sQ(this,"options"),sQ(this,"cursor",0),this.options=$.options,this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===$.cursorAt),0),this.on("key",(Q)=>{Q==="a"&&this.toggleAll()}),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let $=this.value.length===this.options.length;this.value=$?[]:this.options.map((Q)=>Q.value)}toggleValue(){let $=this.value.includes(this._value);this.value=$?this.value.filter((Q)=>Q!==this._value):[...this.value,this._value]}};var kY=Object.defineProperty,yY=($,Q,V)=>(Q in $)?kY($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,tQ=($,Q,V)=>(yY($,typeof Q!="symbol"?Q+"":Q,V),V);class v8 extends W6{constructor($){super($,!1),tQ(this,"options"),tQ(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:Q})=>Q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}var N=C1(f1(),1),U6=C1(N8(),1);import w1 from"node:process";function DY(){return w1.platform!=="win32"?w1.env.TERM!=="linux":!!w1.env.CI||!!w1.env.WT_SESSION||!!w1.env.TERMINUS_SUBLIME||w1.env.ConEmuTask==="{cmd::Cmder}"||w1.env.TERM_PROGRAM==="Terminus-Sublime"||w1.env.TERM_PROGRAM==="vscode"||w1.env.TERM==="xterm-256color"||w1.env.TERM==="alacritty"||w1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var S8=DY(),u=($,Q)=>S8?$:Q,hY=u("◆","*"),UV=u("■","x"),jV=u("▲","x"),j6=u("◇","o"),bY=u("┌","T"),y=u("│","|"),v0=u("└","—"),E8=u("●",">"),g8=u("○"," "),_Y=u("◻","[•]"),KV=u("◼","[+]"),fY=u("◻","[ ]"),BH=u("▪","•"),WV=u("─","-"),mY=u("╮","+"),cY=u("├","+"),pY=u("╯","+"),uY=u("●","•"),dY=u("◆","*"),lY=u("▲","!"),oY=u("■","x"),y8=($)=>{switch($){case"initial":case"active":return N.default.cyan(hY);case"cancel":return N.default.red(UV);case"error":return N.default.yellow(jV);case"submit":return N.default.green(j6)}},k8=($)=>{let{cursor:Q,options:V,style:q}=$,Y=$.maxItems??Number.POSITIVE_INFINITY,X=Math.max(process.stdout.rows-4,0),J=Math.min(X,Math.max(Y,5)),G=0;Q>=G+J-3?G=Math.max(Math.min(Q-J+3,V.length-J),0):Q<G+2&&(G=Math.max(Q-2,0));let U=J<V.length&&G>0,K=J<V.length&&G+J<V.length;return V.slice(G,G+J).map((W,j,H)=>{let z=j===0&&U,C=j===H.length-1&&K;return z||C?N.default.dim("..."):q(W,j+G===Q)})};var X$=($)=>{let Q=$.active??"Yes",V=$.inactive??"No";return new F8({active:Q,inactive:V,initialValue:$.initialValue??!0,render(){let q=`${N.default.gray(y)}
17
- ${y8(this.state)} ${$.message}
16
+ `)),this._prevFrame=$;return}this.output.write(e.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}class E8 extends j6{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(e.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var eY;eY=new WeakMap;var $4=Object.defineProperty,Q4=($,Q,V)=>(Q in $)?$4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,YV=($,Q,V)=>(Q4($,typeof Q!="symbol"?Q+"":Q,V),V),PV=class extends j6{constructor($){super($,!1),YV(this,"options"),YV(this,"cursor",0),this.options=$.options,this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===$.cursorAt),0),this.on("key",(Q)=>{Q==="a"&&this.toggleAll()}),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let $=this.value.length===this.options.length;this.value=$?[]:this.options.map((Q)=>Q.value)}toggleValue(){let $=this.value.includes(this._value);this.value=$?this.value.filter((Q)=>Q!==this._value):[...this.value,this._value]}};var V4=Object.defineProperty,q4=($,Q,V)=>(Q in $)?V4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:V}):$[Q]=V,XV=($,Q,V)=>(q4($,typeof Q!="symbol"?Q+"":Q,V),V);class g8 extends j6{constructor($){super($,!1),XV(this,"options"),XV(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:Q})=>Q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}var N=I1(c1(),1),Z6=I1(w8(),1);import C1 from"node:process";function J4(){return C1.platform!=="win32"?C1.env.TERM!=="linux":!!C1.env.CI||!!C1.env.WT_SESSION||!!C1.env.TERMINUS_SUBLIME||C1.env.ConEmuTask==="{cmd::Cmder}"||C1.env.TERM_PROGRAM==="Terminus-Sublime"||C1.env.TERM_PROGRAM==="vscode"||C1.env.TERM==="xterm-256color"||C1.env.TERM==="alacritty"||C1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var k8=J4(),p=($,Q)=>k8?$:Q,Y4=p("◆","*"),BV=p("■","x"),NV=p("▲","x"),z6=p("◇","o"),X4=p("┌","T"),y=p("│","|"),x0=p("└","—"),D8=p("●",">"),h8=p("○"," "),G4=p("◻","[•]"),LV=p("◼","[+]"),K4=p("◻","[ ]"),XH=p("▪","•"),OV=p("─","-"),W4=p("╮","+"),U4=p("├","+"),j4=p("╯","+"),Z4=p("●","•"),z4=p("◆","*"),H4=p("▲","!"),P4=p("■","x"),f8=($)=>{switch($){case"initial":case"active":return N.default.cyan(Y4);case"cancel":return N.default.red(BV);case"error":return N.default.yellow(NV);case"submit":return N.default.green(z6)}},_8=($)=>{let{cursor:Q,options:V,style:q}=$,Y=$.maxItems??Number.POSITIVE_INFINITY,X=Math.max(process.stdout.rows-4,0),J=Math.min(X,Math.max(Y,5)),G=0;Q>=G+J-3?G=Math.max(Math.min(Q-J+3,V.length-J),0):Q<G+2&&(G=Math.max(Q-2,0));let U=J<V.length&&G>0,K=J<V.length&&G+J<V.length;return V.slice(G,G+J).map((W,Z,z)=>{let H=Z===0&&U,C=Z===z.length-1&&K;return H||C?N.default.dim("..."):q(W,Z+G===Q)})};var H6=($)=>{let Q=$.active??"Yes",V=$.inactive??"No";return new E8({active:Q,inactive:V,initialValue:$.initialValue??!0,render(){let q=`${N.default.gray(y)}
17
+ ${f8(this.state)} ${$.message}
18
18
  `,Y=this.value?Q:V;switch(this.state){case"submit":return`${q}${N.default.gray(y)} ${N.default.dim(Y)}`;case"cancel":return`${q}${N.default.gray(y)} ${N.default.strikethrough(N.default.dim(Y))}
19
- ${N.default.gray(y)}`;default:return`${q}${N.default.cyan(y)} ${this.value?`${N.default.green(E8)} ${Q}`:`${N.default.dim(g8)} ${N.default.dim(Q)}`} ${N.default.dim("/")} ${this.value?`${N.default.dim(g8)} ${N.default.dim(V)}`:`${N.default.green(E8)} ${V}`}
20
- ${N.default.cyan(v0)}
21
- `}}}).prompt()},ZV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);switch(q){case"selected":return`${N.default.dim(Y)}`;case"active":return`${N.default.green(E8)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`;case"cancelled":return`${N.default.strikethrough(N.default.dim(Y))}`;default:return`${N.default.dim(g8)} ${N.default.dim(Y)}`}};return new v8({options:$.options,initialValue:$.initialValue,render(){let V=`${N.default.gray(y)}
22
- ${y8(this.state)} ${$.message}
19
+ ${N.default.gray(y)}`;default:return`${q}${N.default.cyan(y)} ${this.value?`${N.default.green(D8)} ${Q}`:`${N.default.dim(h8)} ${N.default.dim(Q)}`} ${N.default.dim("/")} ${this.value?`${N.default.dim(h8)} ${N.default.dim(V)}`:`${N.default.green(D8)} ${V}`}
20
+ ${N.default.cyan(x0)}
21
+ `}}}).prompt()},MV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);switch(q){case"selected":return`${N.default.dim(Y)}`;case"active":return`${N.default.green(D8)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`;case"cancelled":return`${N.default.strikethrough(N.default.dim(Y))}`;default:return`${N.default.dim(h8)} ${N.default.dim(Y)}`}};return new g8({options:$.options,initialValue:$.initialValue,render(){let V=`${N.default.gray(y)}
22
+ ${f8(this.state)} ${$.message}
23
23
  `;switch(this.state){case"submit":return`${V}${N.default.gray(y)} ${Q(this.options[this.cursor],"selected")}`;case"cancel":return`${V}${N.default.gray(y)} ${Q(this.options[this.cursor],"cancelled")}
24
- ${N.default.gray(y)}`;default:return`${V}${N.default.cyan(y)} ${k8({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(q,Y)=>Q(q,Y?"active":"inactive")}).join(`
24
+ ${N.default.gray(y)}`;default:return`${V}${N.default.cyan(y)} ${_8({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(q,Y)=>Q(q,Y?"active":"inactive")}).join(`
25
25
  ${N.default.cyan(y)} `)}
26
- ${N.default.cyan(v0)}
27
- `}}}).prompt()};var HV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);return q==="active"?`${N.default.cyan(_Y)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="selected"?`${N.default.green(KV)} ${N.default.dim(Y)} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="cancelled"?`${N.default.strikethrough(N.default.dim(Y))}`:q==="active-selected"?`${N.default.green(KV)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="submitted"?`${N.default.dim(Y)}`:`${N.default.dim(fY)} ${N.default.dim(Y)}`};return new GV({options:$.options,initialValues:$.initialValues,required:$.required??!0,cursorAt:$.cursorAt,validate(V){if(this.required&&V.length===0)return`Please select at least one option.
26
+ ${N.default.cyan(x0)}
27
+ `}}}).prompt()};var IV=($)=>{let Q=(V,q)=>{let Y=V.label??String(V.value);return q==="active"?`${N.default.cyan(G4)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="selected"?`${N.default.green(LV)} ${N.default.dim(Y)} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="cancelled"?`${N.default.strikethrough(N.default.dim(Y))}`:q==="active-selected"?`${N.default.green(LV)} ${Y} ${V.hint?N.default.dim(`(${V.hint})`):""}`:q==="submitted"?`${N.default.dim(Y)}`:`${N.default.dim(K4)} ${N.default.dim(Y)}`};return new PV({options:$.options,initialValues:$.initialValues,required:$.required??!0,cursorAt:$.cursorAt,validate(V){if(this.required&&V.length===0)return`Please select at least one option.
28
28
  ${N.default.reset(N.default.dim(`Press ${N.default.gray(N.default.bgWhite(N.default.inverse(" space ")))} to select, ${N.default.gray(N.default.bgWhite(N.default.inverse(" enter ")))} to submit`))}`},render(){let V=`${N.default.gray(y)}
29
- ${y8(this.state)} ${$.message}
29
+ ${f8(this.state)} ${$.message}
30
30
  `,q=(Y,X)=>{let J=this.value.includes(Y.value);return X&&J?Q(Y,"active-selected"):J?Q(Y,"selected"):Q(Y,X?"active":"inactive")};switch(this.state){case"submit":return`${V}${N.default.gray(y)} ${this.options.filter(({value:Y})=>this.value.includes(Y)).map((Y)=>Q(Y,"submitted")).join(N.default.dim(", "))||N.default.dim("none")}`;case"cancel":{let Y=this.options.filter(({value:X})=>this.value.includes(X)).map((X)=>Q(X,"cancelled")).join(N.default.dim(", "));return`${V}${N.default.gray(y)} ${Y.trim()?`${Y}
31
31
  ${N.default.gray(y)}`:""}`}case"error":{let Y=this.error.split(`
32
- `).map((X,J)=>J===0?`${N.default.yellow(v0)} ${N.default.yellow(X)}`:` ${X}`).join(`
33
- `);return`${V+N.default.yellow(y)} ${k8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
32
+ `).map((X,J)=>J===0?`${N.default.yellow(x0)} ${N.default.yellow(X)}`:` ${X}`).join(`
33
+ `);return`${V+N.default.yellow(y)} ${_8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
34
34
  ${N.default.yellow(y)} `)}
35
35
  ${Y}
36
- `}default:return`${V}${N.default.cyan(y)} ${k8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
36
+ `}default:return`${V}${N.default.cyan(y)} ${_8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:q}).join(`
37
37
  ${N.default.cyan(y)} `)}
38
- ${N.default.cyan(v0)}
39
- `}}}).prompt()};var T1=($="",Q="")=>{let V=`
38
+ ${N.default.cyan(x0)}
39
+ `}}}).prompt()};var w1=($="",Q="")=>{let V=`
40
40
  ${$}
41
41
  `.split(`
42
- `),q=x8(Q).length,Y=Math.max(V.reduce((J,G)=>{let U=x8(G);return U.length>J?U.length:J},0),q)+2,X=V.map((J)=>`${N.default.gray(y)} ${N.default.dim(J)}${" ".repeat(Y-x8(J).length)}${N.default.gray(y)}`).join(`
42
+ `),q=y8(Q).length,Y=Math.max(V.reduce((J,G)=>{let U=y8(G);return U.length>J?U.length:J},0),q)+2,X=V.map((J)=>`${N.default.gray(y)} ${N.default.dim(J)}${" ".repeat(Y-y8(J).length)}${N.default.gray(y)}`).join(`
43
43
  `);process.stdout.write(`${N.default.gray(y)}
44
- ${N.default.green(j6)} ${N.default.reset(Q)} ${N.default.gray(WV.repeat(Math.max(Y-q-1,1))+mY)}
44
+ ${N.default.green(z6)} ${N.default.reset(Q)} ${N.default.gray(OV.repeat(Math.max(Y-q-1,1))+W4)}
45
45
  ${X}
46
- ${N.default.gray(cY+WV.repeat(Y+2)+pY)}
47
- `)},J1=($="")=>{process.stdout.write(`${N.default.gray(v0)} ${N.default.red($)}
46
+ ${N.default.gray(U4+OV.repeat(Y+2)+j4)}
47
+ `)},J1=($="")=>{process.stdout.write(`${N.default.gray(x0)} ${N.default.red($)}
48
48
 
49
- `)},A1=($="")=>{process.stdout.write(`${N.default.gray(bY)} ${$}
50
- `)},j1=($="")=>{process.stdout.write(`${N.default.gray(y)}
51
- ${N.default.gray(v0)} ${$}
49
+ `)},T1=($="")=>{process.stdout.write(`${N.default.gray(X4)} ${$}
50
+ `)},A1=($="")=>{process.stdout.write(`${N.default.gray(y)}
51
+ ${N.default.gray(x0)} ${$}
52
52
 
53
- `)},m={message:($="",{symbol:Q=N.default.gray(y)}={})=>{let V=[`${N.default.gray(y)}`];if($){let[q,...Y]=$.split(`
53
+ `)},c={message:($="",{symbol:Q=N.default.gray(y)}={})=>{let V=[`${N.default.gray(y)}`];if($){let[q,...Y]=$.split(`
54
54
  `);V.push(`${Q} ${q}`,...Y.map((X)=>`${N.default.gray(y)} ${X}`))}process.stdout.write(`${V.join(`
55
55
  `)}
56
- `)},info:($)=>{m.message($,{symbol:N.default.blue(uY)})},success:($)=>{m.message($,{symbol:N.default.green(dY)})},step:($)=>{m.message($,{symbol:N.default.green(j6)})},warn:($)=>{m.message($,{symbol:N.default.yellow(lY)})},warning:($)=>{m.warn($)},error:($)=>{m.message($,{symbol:N.default.red(oY)})}},MH=`${N.default.gray(y)} `;var z1=({indicator:$="dots"}={})=>{let Q=S8?["◒","◐","◓","◑"]:["•","o","O","0"],V=S8?80:120,q=process.env.CI==="true",Y,X,J=!1,G="",U,K=performance.now(),W=(O)=>{let I=O>1?"Something went wrong":"Canceled";J&&T(I,O)},j=()=>W(2),H=()=>W(1),z=()=>{process.on("uncaughtExceptionMonitor",j),process.on("unhandledRejection",j),process.on("SIGINT",H),process.on("SIGTERM",H),process.on("exit",W)},C=()=>{process.removeListener("uncaughtExceptionMonitor",j),process.removeListener("unhandledRejection",j),process.removeListener("SIGINT",H),process.removeListener("SIGTERM",H),process.removeListener("exit",W)},P=()=>{if(U===void 0)return;q&&process.stdout.write(`
57
- `);let O=U.split(`
58
- `);process.stdout.write(U6.cursor.move(-999,O.length-1)),process.stdout.write(U6.erase.down(O.length))},M=(O)=>O.replace(/\.+$/,""),B=(O)=>{let I=(performance.now()-O)/1000,R=Math.floor(I/60),F=Math.floor(I%60);return R>0?`[${R}m ${F}s]`:`[${F}s]`},L=(O="")=>{J=!0,Y=XV(),G=M(O),K=performance.now(),process.stdout.write(`${N.default.gray(y)}
59
- `);let I=0,R=0;z(),X=setInterval(()=>{if(q&&G===U)return;P(),U=G;let F=N.default.magenta(Q[I]);if(q)process.stdout.write(`${F} ${G}...`);else if($==="timer")process.stdout.write(`${F} ${G} ${B(K)}`);else{let v=".".repeat(Math.floor(R)).slice(0,3);process.stdout.write(`${F} ${G}${v}`)}I=I+1<Q.length?I+1:0,R=R<Q.length?R+0.125:0},V)},T=(O="",I=0)=>{J=!1,clearInterval(X),P();let R=I===0?N.default.green(j6):I===1?N.default.red(UV):N.default.red(jV);G=M(O??G),$==="timer"?process.stdout.write(`${R} ${G} ${B(K)}
60
- `):process.stdout.write(`${R} ${G}
61
- `),C(),Y()};return{start:L,stop:T,message:(O="")=>{G=M(O??G)}}};var bQ=C1(T7(),1),Z=C1(f1(),1);import{spawn as eU}from"node:child_process";import{createServer as mU}from"node:http";class D extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var cU=`<!doctype html>
56
+ `)},info:($)=>{c.message($,{symbol:N.default.blue(Z4)})},success:($)=>{c.message($,{symbol:N.default.green(z4)})},step:($)=>{c.message($,{symbol:N.default.green(z6)})},warn:($)=>{c.message($,{symbol:N.default.yellow(H4)})},warning:($)=>{c.warn($)},error:($)=>{c.message($,{symbol:N.default.red(P4)})}},GH=`${N.default.gray(y)} `;var z1=({indicator:$="dots"}={})=>{let Q=k8?["◒","◐","◓","◑"]:["•","o","O","0"],V=k8?80:120,q=process.env.CI==="true",Y,X,J=!1,G="",U,K=performance.now(),W=(B)=>{let O=B>1?"Something went wrong":"Canceled";J&&T(O,B)},Z=()=>W(2),z=()=>W(1),H=()=>{process.on("uncaughtExceptionMonitor",Z),process.on("unhandledRejection",Z),process.on("SIGINT",z),process.on("SIGTERM",z),process.on("exit",W)},C=()=>{process.removeListener("uncaughtExceptionMonitor",Z),process.removeListener("unhandledRejection",Z),process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),process.removeListener("exit",W)},P=()=>{if(U===void 0)return;q&&process.stdout.write(`
57
+ `);let B=U.split(`
58
+ `);process.stdout.write(Z6.cursor.move(-999,B.length-1)),process.stdout.write(Z6.erase.down(B.length))},I=(B)=>B.replace(/\.+$/,""),M=(B)=>{let O=(performance.now()-B)/1000,F=Math.floor(O/60),R=Math.floor(O%60);return F>0?`[${F}m ${R}s]`:`[${R}s]`},L=(B="")=>{J=!0,Y=HV(),G=I(B),K=performance.now(),process.stdout.write(`${N.default.gray(y)}
59
+ `);let O=0,F=0;H(),X=setInterval(()=>{if(q&&G===U)return;P(),U=G;let R=N.default.magenta(Q[O]);if(q)process.stdout.write(`${R} ${G}...`);else if($==="timer")process.stdout.write(`${R} ${G} ${M(K)}`);else{let v=".".repeat(Math.floor(F)).slice(0,3);process.stdout.write(`${R} ${G}${v}`)}O=O+1<Q.length?O+1:0,F=F<Q.length?F+0.125:0},V)},T=(B="",O=0)=>{J=!1,clearInterval(X),P();let F=O===0?N.default.green(z6):O===1?N.default.red(BV):N.default.red(NV);G=I(B??G),$==="timer"?process.stdout.write(`${F} ${G} ${M(K)}
60
+ `):process.stdout.write(`${F} ${G}
61
+ `),C(),Y()};return{start:L,stop:T,message:(B="")=>{G=I(B??G)}}};var dQ=I1(g7(),1),j=I1(c1(),1);import{spawn as Cj}from"node:child_process";import{createServer as Wj}from"node:http";class k extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var Uj=`<!doctype html>
62
62
  <html>
63
63
  <head><meta charset="utf-8"><title>Authentication complete</title></head>
64
64
  <body><h1>Authentication complete</h1><p>You can close this tab and return to your terminal.</p></body>
65
- </html>`,pU=`<!doctype html>
65
+ </html>`,jj=`<!doctype html>
66
66
  <html>
67
67
  <head><meta charset="utf-8"><title>Authentication failed</title></head>
68
68
  <body><h1>Authentication failed</h1><p>You can close this tab and return to your terminal.</p></body>
69
- </html>`;function BQ($,Q){return new D($,Q)}function A7($){let{expectedState:Q,port:V=0,timeoutMs:q=120000,successHtml:Y=cU,errorHtml:X=pU}=$,J,G=!1,U=!1,K,W,j=new Promise((C,P)=>{K=C,W=P}),H=(C)=>{if(U)return;U=!0,C.close()},z=mU((C,P)=>{if(G){P.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Authentication callback already handled.");return}if(C.method!=="GET"||!C.url){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Not found");return}let M=new URL(C.url,"http://127.0.0.1");if(M.pathname!=="/callback"){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Clerk CLI auth server is waiting for /callback.");return}let B=M.searchParams.get("code"),L=M.searchParams.get("state"),T=M.searchParams.get("error"),O=M.searchParams.get("error_description")??T,I=(R,F,v)=>{if(G=!0,J)clearTimeout(J);P.writeHead(R,{"Content-Type":"text/html; charset=utf-8"}),P.end(F,()=>{if(v)W(v);else if(B&&L)K({code:B,state:L});H(z)})};if(T){I(400,X,BQ("token_exchange",`OAuth authorization failed: ${O??"unknown error"}`));return}if(L!==Q){I(400,X,BQ("state_mismatch","OAuth callback state did not match."));return}if(!B){I(400,X,BQ("token_exchange","OAuth callback did not include an authorization code."));return}I(200,Y)});return new Promise((C,P)=>{z.once("error",(M)=>{P(new D("config",`Failed to start local auth callback server: ${M.message}`))}),z.listen(V,"127.0.0.1",()=>{let B=z.address().port,L=`http://127.0.0.1:${B}/callback`;J=setTimeout(()=>{if(G)return;G=!0,W(new D("timeout",`OAuth callback timed out after ${q}ms.`)),H(z)},q),C({port:B,redirectUri:L,waitForCallback:()=>j,close:()=>{if(J)clearTimeout(J);if(!G)G=!0,W(new D("timeout","OAuth callback server was closed."));H(z)}})})})}import{chmod as uU,mkdir as dU,readFile as lU,writeFile as oU}from"node:fs/promises";import{homedir as iU}from"node:os";import{dirname as nU,join as rU}from"node:path";function R7($,Q){if(Q instanceof D)return Q;let V=Q instanceof Error?Q.message:String(Q);return new D("storage",`${$}: ${V}`)}function v7($){return $?.environment??"default"}function aU($){return rU(iU(),".config","clerk-cli-auth",`${$}.json`)}class x7{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class S7{filePath;queue=Promise.resolve();constructor($){this.filePath=$}enqueue($){let Q=this.queue.then($,$);return this.queue=Q.catch(()=>{return}),Q}async readAll(){try{let $=await lU(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let V={};for(let[q,Y]of Object.entries(Q))if(typeof Y==="string")V[q]=Y;return V}catch($){if($.code==="ENOENT")return{};throw R7(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await dU(nU(this.filePath),{recursive:!0}),await oU(this.filePath,`${JSON.stringify($,null,2)}
70
- `,{mode:384}),await uU(this.filePath,384)}catch(Q){throw R7(`Failed to write credential file ${this.filePath}`,Q)}}async get($){return this.enqueue(async()=>{return(await this.readAll())[$]??null})}async set($,Q){return this.enqueue(async()=>{let V=await this.readAll();V[$]=Q,await this.writeAll(V)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class E7{service;environment;fallback;keyringPromise=null;constructor($,Q,V){this.service=$;this.environment=Q;this.fallback=V}account($){return`${this.environment}:${$}`}warnFallback($,Q){let V=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&V.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${V}`)}async loadKeyring(){return this.keyringPromise??=import("@napi-rs/keyring").catch(($)=>{return this.warnFallback("initialization",$),null}),this.keyringPromise}async get($){try{let Q=await this.loadKeyring();if(!Q)return this.fallback.get($);return new Q.Entry(this.service,this.account($)).getPassword()??await this.fallback.get($)}catch(Q){return this.warnFallback("get",Q),this.fallback.get($)}}async set($,Q){try{let V=await this.loadKeyring();if(!V){await this.fallback.set($,Q);return}new V.Entry(this.service,this.account($)).setPassword(Q)}catch(V){this.warnFallback("set",V),await this.fallback.set($,Q)}}async delete($){try{let Q=await this.loadKeyring();if(Q)new Q.Entry(this.service,this.account($)).deletePassword()}catch(Q){this.warnFallback("delete",Q)}await this.fallback.delete($)}}function F7($){let Q=v7($);return new S7($?.filePath??aU(Q))}function g7($,Q){if($==="memory")return new x7;if($==="file")return F7(Q);let V=F7(Q),q=Q?.keychainService??"clerk-cli-auth",Y=v7(Q);return new E7(q,Y,V)}import{createHash as sU,randomBytes as k7}from"node:crypto";function MQ($){return $.toString("base64url")}function y7(){return MQ(k7(32))}async function D7($){return MQ(sU("sha256").update($).digest())}function h7(){return MQ(k7(32))}function b7($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function _7($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function f7($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let V=$;for(let q of["error_description","message","error"]){let Y=V[q];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function tU($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new D("token_exchange","Token response did not include access_token.");let Q={accessToken:$.access_token};if(typeof $.refresh_token==="string")Q.refreshToken=$.refresh_token;if(typeof $.id_token==="string")Q.idToken=$.id_token;if(typeof $.scope==="string")Q.scope=$.scope;if(typeof $.token_type==="string")Q.tokenType=$.token_type;if(typeof $.expires_in==="number")Q.expiresAt=Date.now()+$.expires_in*1000;return Q}async function m7($,Q){let V;try{V=await fetch(b7($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new D("token_exchange",`Token request failed: ${Y.message}`)}let q;try{q=await _7(V)}catch(Y){throw new D("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!V.ok)throw new D("token_exchange",f7(q,`Token request failed with HTTP ${V.status}.`));if(!q||typeof q!=="object")throw new D("token_exchange","Token response was not JSON.");return tU(q)}async function c7($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return m7($.issuer,Q)}async function p7($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return m7($.issuer,Q)}async function CQ($){let Q;try{Q=await fetch(b7($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new D("userinfo",`Userinfo request failed: ${Y.message}`)}let V;try{V=await _7(Q)}catch(Y){throw new D("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new D("userinfo",f7(V,`Userinfo request failed with HTTP ${Q.status}.`));if(!V||typeof V!=="object")throw new D("userinfo","Userinfo response was not JSON.");let q=V;if(typeof q.sub!=="string"||q.sub.length===0)throw new D("userinfo","Userinfo response did not include sub.");return q}var $j=["profile","email","openid","offline_access"];function Qj($){let Q=$.trim().replace(/\/+$/,"");try{let V=new URL(Q);if(V.protocol!=="http:"&&V.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(V){throw new D("config",`issuer must be a valid URL: ${V.message}`)}}function q8($,Q){if(Q instanceof D)return Q;let V=Q instanceof Error?Q.message:String(Q);return new D("storage",`Failed to ${$}: ${V}`)}async function Vj($){console.log(`Open this URL to sign in:
71
- ${$}`);let Q=process.platform,V=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let X=eU(V,q,{detached:!0,stdio:"ignore"});X.once("error",()=>Y()),X.unref(),Y()})}class J8{config;constructor($){if(!$.clientId)throw new D("config","clientId is required");if(!$.issuer)throw new D("config","issuer is required");let Q=$.environment??"default",V=typeof $.storage==="object"&&$.storage!==null?$.storage:g7($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:Qj($.issuer),scopes:$.scopes??$j,storage:V,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=y7(),Q=await D7($),V=h7(),q=await A7({expectedState:V,port:this.config.callbackPort,timeoutMs:this.config.timeoutMs});try{let Y=new URL(`${this.config.issuer}/oauth/authorize`);Y.searchParams.set("response_type","code"),Y.searchParams.set("client_id",this.config.clientId),Y.searchParams.set("redirect_uri",q.redirectUri),Y.searchParams.set("scope",this.config.scopes.join(" ")),Y.searchParams.set("state",V),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??Vj)(Y.toString())}catch(U){throw new D("config",`Failed to open authorization URL: ${U.message}`)}let{code:X}=await q.waitForCallback(),J=await c7({issuer:this.config.issuer,clientId:this.config.clientId,code:X,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",J);let G=await CQ({issuer:this.config.issuer,accessToken:J.accessToken});return await this.setJson("user",G),{tokens:J,user:G}}finally{q.close()}}async getAccessToken(){let $=await this.getTokenSet();if(!$)return null;if(($.expiresAt??Number.POSITIVE_INFINITY)>=Date.now()+30000)return $.accessToken;if(!$.refreshToken)return null;let V=await p7({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...V,refreshToken:V.refreshToken??$.refreshToken};return await this.setJson("tokens",q),q.accessToken}async whoami(){let $=await this.getJson("user");if($)return $;let Q=await this.getAccessToken();if(!Q)return null;let V=await CQ({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",V),V}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw q8("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(V){throw q8(`read ${$}`,V)}if(!Q)return null;try{return JSON.parse(Q)}catch(V){throw q8(`parse stored ${$}`,V)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(V){throw q8(`write ${$}`,V)}}}import{randomBytes as qj}from"node:crypto";import{existsSync as wQ,statSync as Jj}from"node:fs";import{chmod as Yj,mkdir as Y8,rename as p$,rm as r1,writeFile as X8}from"node:fs/promises";import{homedir as $$,arch as Xj,platform as u$}from"node:os";import Q1 from"node:path";var r=C1(f1(),1),Gj="https://api.github.com/repos/crafter-station/petdex/releases",u7=30,Kj=5,d7="desktop-v",n7="petdex-desktop-sidecar.js";function r7(){let $=u$(),Q=Xj(),V=$==="darwin"?"darwin":$==="linux"?"linux":$==="win32"?"win32":$,q=Q==="arm64"?"arm64":Q==="x64"?"x64":Q;return{osLabel:V,archLabel:q,assetSuffix:`${V}-${q}`}}function Q$(){let $=u$()==="win32"?".exe":"";if(u$()==="darwin"){let Q=["/Applications/Petdex.app/Contents/MacOS/petdex-desktop",Q1.join($$(),"Applications","Petdex.app","Contents","MacOS","petdex-desktop")];for(let V of Q)if(wQ(V))return V}return Q1.join($$(),".petdex","bin",`petdex-desktop${$}`)}function G8(){if(u$()==="darwin"){let $=["/Applications/Petdex.app/Contents/Resources/sidecar/server.js",Q1.join($$(),"Applications","Petdex.app","Contents","Resources","sidecar","server.js")];for(let Q of $)if(wQ(Q))return Q}return Q1.join($$(),".petdex","sidecar","server.js")}async function TQ($={}){let Q=$.fetchOverride??fetch,V=$.maxPages??Kj,q=0;for(let Y=1;Y<=V;Y++){let X=`${Gj}?per_page=${u7}&page=${Y}`,J=await Q(X,{headers:{Accept:"application/vnd.github+json"}});if(!J.ok)throw Error(`GitHub API ${J.status}`);let G=await J.json();if(!Array.isArray(G)||G.length===0)break;q+=G.length;let U=G.find((K)=>!K.draft&&!K.prerelease&&typeof K.tag_name==="string"&&K.tag_name.startsWith(d7));if(U)return U;if(G.length<u7)break}throw Error(`No ${d7}* release found in the last ${q} releases (scanned ${V} page(s))`)}function Wj($,Q){let V=`petdex-desktop-${Q}`,q=$.assets.find((Y)=>Y.name.startsWith(V));if(!q){let Y=$.assets.map((X)=>` ${X.name}`).join(`
69
+ </html>`;function TQ($,Q){return new k($,Q)}function y7($){let{expectedState:Q,port:V=0,timeoutMs:q=120000,successHtml:Y=Uj,errorHtml:X=jj}=$,J,G=!1,U=!1,K,W,Z=new Promise((C,P)=>{K=C,W=P}),z=(C)=>{if(U)return;U=!0,C.close()},H=Wj((C,P)=>{if(G){P.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Authentication callback already handled.");return}if(C.method!=="GET"||!C.url){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Not found");return}let I=new URL(C.url,"http://127.0.0.1");if(I.pathname!=="/callback"){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Clerk CLI auth server is waiting for /callback.");return}let M=I.searchParams.get("code"),L=I.searchParams.get("state"),T=I.searchParams.get("error"),B=I.searchParams.get("error_description")??T,O=(F,R,v)=>{if(G=!0,J)clearTimeout(J);P.writeHead(F,{"Content-Type":"text/html; charset=utf-8"}),P.end(R,()=>{if(v)W(v);else if(M&&L)K({code:M,state:L});z(H)})};if(T){O(400,X,TQ("token_exchange",`OAuth authorization failed: ${B??"unknown error"}`));return}if(L!==Q){O(400,X,TQ("state_mismatch","OAuth callback state did not match."));return}if(!M){O(400,X,TQ("token_exchange","OAuth callback did not include an authorization code."));return}O(200,Y)});return new Promise((C,P)=>{H.once("error",(I)=>{P(new k("config",`Failed to start local auth callback server: ${I.message}`))}),H.listen(V,"127.0.0.1",()=>{let M=H.address().port,L=`http://127.0.0.1:${M}/callback`;J=setTimeout(()=>{if(G)return;G=!0,W(new k("timeout",`OAuth callback timed out after ${q}ms.`)),z(H)},q),C({port:M,redirectUri:L,waitForCallback:()=>Z,close:()=>{if(J)clearTimeout(J);if(!G)G=!0,W(new k("timeout","OAuth callback server was closed."));z(H)}})})})}import{chmod as Zj,mkdir as zj,readFile as Hj,writeFile as Pj}from"node:fs/promises";import{homedir as Lj}from"node:os";import{dirname as Oj,join as Bj}from"node:path";function k7($,Q){if(Q instanceof k)return Q;let V=Q instanceof Error?Q.message:String(Q);return new k("storage",`${$}: ${V}`)}function h7($){return $?.environment??"default"}function Nj($){return Bj(Lj(),".config","clerk-cli-auth",`${$}.json`)}class _7{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class f7{filePath;queue=Promise.resolve();constructor($){this.filePath=$}enqueue($){let Q=this.queue.then($,$);return this.queue=Q.catch(()=>{return}),Q}async readAll(){try{let $=await Hj(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let V={};for(let[q,Y]of Object.entries(Q))if(typeof Y==="string")V[q]=Y;return V}catch($){if($.code==="ENOENT")return{};throw k7(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await zj(Oj(this.filePath),{recursive:!0}),await Pj(this.filePath,`${JSON.stringify($,null,2)}
70
+ `,{mode:384}),await Zj(this.filePath,384)}catch(Q){throw k7(`Failed to write credential file ${this.filePath}`,Q)}}async get($){return this.enqueue(async()=>{return(await this.readAll())[$]??null})}async set($,Q){return this.enqueue(async()=>{let V=await this.readAll();V[$]=Q,await this.writeAll(V)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class b7{service;environment;fallback;keyringPromise=null;constructor($,Q,V){this.service=$;this.environment=Q;this.fallback=V}account($){return`${this.environment}:${$}`}warnFallback($,Q){let V=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&V.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${V}`)}async loadKeyring(){return this.keyringPromise??=import("@napi-rs/keyring").catch(($)=>{return this.warnFallback("initialization",$),null}),this.keyringPromise}async get($){try{let Q=await this.loadKeyring();if(!Q)return this.fallback.get($);return new Q.Entry(this.service,this.account($)).getPassword()??await this.fallback.get($)}catch(Q){return this.warnFallback("get",Q),this.fallback.get($)}}async set($,Q){try{let V=await this.loadKeyring();if(!V){await this.fallback.set($,Q);return}new V.Entry(this.service,this.account($)).setPassword(Q)}catch(V){this.warnFallback("set",V),await this.fallback.set($,Q)}}async delete($){try{let Q=await this.loadKeyring();if(Q)new Q.Entry(this.service,this.account($)).deletePassword()}catch(Q){this.warnFallback("delete",Q)}await this.fallback.delete($)}}function D7($){let Q=h7($);return new f7($?.filePath??Nj(Q))}function m7($,Q){if($==="memory")return new _7;if($==="file")return D7(Q);let V=D7(Q),q=Q?.keychainService??"clerk-cli-auth",Y=h7(Q);return new b7(q,Y,V)}import{createHash as Mj,randomBytes as c7}from"node:crypto";function AQ($){return $.toString("base64url")}function p7(){return AQ(c7(32))}async function u7($){return AQ(Mj("sha256").update($).digest())}function d7(){return AQ(c7(32))}function l7($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function o7($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function i7($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let V=$;for(let q of["error_description","message","error"]){let Y=V[q];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function Ij($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new k("token_exchange","Token response did not include access_token.");let Q={accessToken:$.access_token};if(typeof $.refresh_token==="string")Q.refreshToken=$.refresh_token;if(typeof $.id_token==="string")Q.idToken=$.id_token;if(typeof $.scope==="string")Q.scope=$.scope;if(typeof $.token_type==="string")Q.tokenType=$.token_type;if(typeof $.expires_in==="number")Q.expiresAt=Date.now()+$.expires_in*1000;return Q}async function n7($,Q){let V;try{V=await fetch(l7($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new k("token_exchange",`Token request failed: ${Y.message}`)}let q;try{q=await o7(V)}catch(Y){throw new k("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!V.ok)throw new k("token_exchange",i7(q,`Token request failed with HTTP ${V.status}.`));if(!q||typeof q!=="object")throw new k("token_exchange","Token response was not JSON.");return Ij(q)}async function r7($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return n7($.issuer,Q)}async function a7($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return n7($.issuer,Q)}async function FQ($){let Q;try{Q=await fetch(l7($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new k("userinfo",`Userinfo request failed: ${Y.message}`)}let V;try{V=await o7(Q)}catch(Y){throw new k("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new k("userinfo",i7(V,`Userinfo request failed with HTTP ${Q.status}.`));if(!V||typeof V!=="object")throw new k("userinfo","Userinfo response was not JSON.");let q=V;if(typeof q.sub!=="string"||q.sub.length===0)throw new k("userinfo","Userinfo response did not include sub.");return q}var wj=["profile","email","openid","offline_access"];function Tj($){let Q=$.trim().replace(/\/+$/,"");try{let V=new URL(Q);if(V.protocol!=="http:"&&V.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(V){throw new k("config",`issuer must be a valid URL: ${V.message}`)}}function X8($,Q){if(Q instanceof k)return Q;let V=Q instanceof Error?Q.message:String(Q);return new k("storage",`Failed to ${$}: ${V}`)}async function Aj($){console.log(`Open this URL to sign in:
71
+ ${$}`);let Q=process.platform,V=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let X=Cj(V,q,{detached:!0,stdio:"ignore"});X.once("error",()=>Y()),X.unref(),Y()})}class G8{config;constructor($){if(!$.clientId)throw new k("config","clientId is required");if(!$.issuer)throw new k("config","issuer is required");let Q=$.environment??"default",V=typeof $.storage==="object"&&$.storage!==null?$.storage:m7($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:Tj($.issuer),scopes:$.scopes??wj,storage:V,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=p7(),Q=await u7($),V=d7(),q=await y7({expectedState:V,port:this.config.callbackPort,timeoutMs:this.config.timeoutMs});try{let Y=new URL(`${this.config.issuer}/oauth/authorize`);Y.searchParams.set("response_type","code"),Y.searchParams.set("client_id",this.config.clientId),Y.searchParams.set("redirect_uri",q.redirectUri),Y.searchParams.set("scope",this.config.scopes.join(" ")),Y.searchParams.set("state",V),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??Aj)(Y.toString())}catch(U){throw new k("config",`Failed to open authorization URL: ${U.message}`)}let{code:X}=await q.waitForCallback(),J=await r7({issuer:this.config.issuer,clientId:this.config.clientId,code:X,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",J);let G=await FQ({issuer:this.config.issuer,accessToken:J.accessToken});return await this.setJson("user",G),{tokens:J,user:G}}finally{q.close()}}async getAccessToken(){let $=await this.getTokenSet();if(!$)return null;if(($.expiresAt??Number.POSITIVE_INFINITY)>=Date.now()+30000)return $.accessToken;if(!$.refreshToken)return null;let V=await a7({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...V,refreshToken:V.refreshToken??$.refreshToken};return await this.setJson("tokens",q),q.accessToken}async whoami(){let $=await this.getJson("user");if($)return $;let Q=await this.getAccessToken();if(!Q)return null;let V=await FQ({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",V),V}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw X8("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(V){throw X8(`read ${$}`,V)}if(!Q)return null;try{return JSON.parse(Q)}catch(V){throw X8(`parse stored ${$}`,V)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(V){throw X8(`write ${$}`,V)}}}import{randomBytes as Fj}from"node:crypto";import{existsSync as RQ,statSync as Rj}from"node:fs";import{chmod as vj,mkdir as K8,rename as u$,rm as a1,writeFile as W8}from"node:fs/promises";import{homedir as Q$,arch as xj,platform as d$}from"node:os";import Q1 from"node:path";var r=I1(c1(),1),Sj="https://api.github.com/repos/crafter-station/petdex/releases",s7=30,Ej=5,t7="desktop-v",VJ="petdex-desktop-sidecar.js";function qJ(){let $=d$(),Q=xj(),V=$==="darwin"?"darwin":$==="linux"?"linux":$==="win32"?"win32":$,q=Q==="arm64"?"arm64":Q==="x64"?"x64":Q;return{osLabel:V,archLabel:q,assetSuffix:`${V}-${q}`}}function V$(){let $=d$()==="win32"?".exe":"";if(d$()==="darwin"){let Q=["/Applications/Petdex.app/Contents/MacOS/petdex-desktop",Q1.join(Q$(),"Applications","Petdex.app","Contents","MacOS","petdex-desktop")];for(let V of Q)if(RQ(V))return V}return Q1.join(Q$(),".petdex","bin",`petdex-desktop${$}`)}function U8(){if(d$()==="darwin"){let $=["/Applications/Petdex.app/Contents/Resources/sidecar/server.js",Q1.join(Q$(),"Applications","Petdex.app","Contents","Resources","sidecar","server.js")];for(let Q of $)if(RQ(Q))return Q}return Q1.join(Q$(),".petdex","sidecar","server.js")}async function vQ($={}){let Q=$.fetchOverride??fetch,V=$.maxPages??Ej,q=0;for(let Y=1;Y<=V;Y++){let X=`${Sj}?per_page=${s7}&page=${Y}`,J=await Q(X,{headers:{Accept:"application/vnd.github+json"}});if(!J.ok)throw Error(`GitHub API ${J.status}`);let G=await J.json();if(!Array.isArray(G)||G.length===0)break;q+=G.length;let U=G.find((K)=>!K.draft&&!K.prerelease&&typeof K.tag_name==="string"&&K.tag_name.startsWith(t7));if(U)return U;if(G.length<s7)break}throw Error(`No ${t7}* release found in the last ${q} releases (scanned ${V} page(s))`)}function gj($,Q){let V=`petdex-desktop-${Q}`,q=$.assets.find((Y)=>Y.name.startsWith(V));if(!q){let Y=$.assets.map((X)=>` ${X.name}`).join(`
72
72
  `);throw Error(`No binary for ${Q} in ${$.tag_name}.
73
73
  Available:
74
- ${Y}`)}return q}function Uj($){return $.assets.find((Q)=>Q.name===n7)??null}async function l7($,Q,V){let q=await fetch($);if(!q.ok||!q.body)throw Error(`download ${$} → ${q.status}`);let Y=Buffer.from(await q.arrayBuffer()),X=`${Q}.tmp`;try{if(await X8(X,Y),V!==void 0)await Yj(X,V);if(u$()==="darwin")try{let{spawnSync:J}=await import("node:child_process");J("xattr",["-d","com.apple.quarantine",X],{stdio:"ignore"})}catch{}return{tmpPath:X,destPath:Q}}catch(J){try{await r1(X,{force:!0})}catch{}throw J}}async function jj($){let Q=[];for(let V of $){let q=null;try{let Y=`${V.destPath}.prev`;try{await p$(V.destPath,Y),q=Y}catch(X){if(X.code!=="ENOENT")throw X}await p$(V.tmpPath,V.destPath),Q.push({dest:V.destPath,backup:q})}catch(Y){if(q)try{await r1(V.destPath,{force:!0}),await p$(q,V.destPath)}catch{}for(let X of Q.reverse())try{if(X.backup)await r1(X.dest,{force:!0}),await p$(X.backup,X.dest);else await r1(X.dest,{force:!0})}catch{}for(let X of $)try{await r1(X.tmpPath,{force:!0})}catch{}throw Y}}for(let V of Q){if(!V.backup)continue;try{await r1(V.backup,{force:!0})}catch{}}}async function AQ($){let Q=r7(),V=Wj($,Q.assetSuffix),q=Uj($),Y=Q$(),X=G8();await Y8(Q1.dirname(Y),{recursive:!0}),await Y8(Q1.dirname(X),{recursive:!0});let J=[];try{if(J.push(await l7(V.browser_download_url,Y,493)),q)J.push(await l7(q.browser_download_url,X))}catch(G){for(let U of J)try{await r1(U.tmpPath,{force:!0})}catch{}throw G}return{binAsset:V,sidecarAsset:q,staged:J}}async function RQ($){await jj($.staged)}async function Zj($){let Q=await AQ($);return await RQ(Q),{binAsset:Q.binAsset,sidecarAsset:Q.sidecarAsset}}var Hj="boba",zj=process.env.PETDEX_URL??"https://petdex.crafter.run",Pj=new Set(["pub-94495283df974cfea5e98d6a9e3fa462.r2.dev","yu2vz9gndp.ufs.sh"]);function d$($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return Pj.has(Q.hostname)}catch{return!1}}function a7(){return process.env.HOME??$$()}function s7(){return Q1.join(a7(),".petdex","pets")}function t7(){return Q1.join(a7(),".codex","pets")}var Lj=16777216;function Ij($){for(let Q of["spritesheet.webp","spritesheet.png"]){let V=Q1.join($,Q);try{let q=Jj(V);if(q.isFile()&&q.size>0&&q.size<=Lj)return!0}catch{}}return!1}async function Oj(){let{readdir:$}=await import("node:fs/promises");for(let Q of[s7(),t7()]){let V;try{V=await $(Q)}catch{continue}for(let q of V)if(Ij(Q1.join(Q,q)))return!0}return!1}async function Nj($={}){let Q=$.fetchOverride??fetch,V=$.petdexUrl??zj,q;try{let G=await Q(`${V}/api/manifest`,{signal:AbortSignal.timeout(8000)});if(!G.ok)return null;let U=await G.json();q=Array.isArray(U?.pets)?U.pets:[]}catch{return null}if(q.length===0)return null;let Y=[],X=new Set,J=q.find((G)=>G.slug===Hj);if(J)Y.push(J),X.add(J.slug);for(let G of q)if(!X.has(G.slug))Y.push(G),X.add(G.slug);for(let G of Y){let U=await Bj(G,Q);if(U)return U}return null}async function Bj($,Q){if(!d$($.spritesheetUrl)||!d$($.petJsonUrl))return null;let V=$.spritesheetUrl.endsWith(".png")?"png":"webp",q=[Q1.join(s7(),$.slug),Q1.join(t7(),$.slug)];for(let K of q)if(wQ(K))return null;let Y=async(K)=>{let W=await Q(K,{signal:AbortSignal.timeout(15000)});if(!W.ok)throw Error(`download ${K} → ${W.status}`);return W.arrayBuffer()},X,J;try{[X,J]=await Promise.all([Y($.petJsonUrl),Y($.spritesheetUrl)])}catch{return null}let G=[],U=[];try{for(let K of q){let W=`${K}.partial-${qj(6).toString("hex")}`;await Y8(W,{recursive:!0}),G.push(W),await Promise.all([X8(Q1.join(W,"pet.json"),Buffer.from(X)),X8(Q1.join(W,`spritesheet.${V}`),Buffer.from(J))]),await Y8(Q1.dirname(K),{recursive:!0}),await p$(W,K),G.pop(),U.push(K)}return $.slug}catch{return await Promise.all([...G.map((K)=>r1(K,{recursive:!0,force:!0})),...U.map((K)=>r1(K,{recursive:!0,force:!0}))]),null}}async function e7(){A1(r.default.bgMagenta(r.default.white(" petdex install desktop ")));let $=r7();m.info(`Platform: ${r.default.cyan(`${$.osLabel} ${$.archLabel}`)}`);let Q=z1();Q.start("Looking up the latest release");let V;try{V=await TQ()}catch(W){throw Q.stop(r.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
75
- ${W.message}`)}Q.stop(`${r.default.green("✓")} Latest: ${r.default.bold(V.tag_name)}`);let q=z1();q.start("Downloading desktop binary and sidecar");let Y;try{Y=await Zj(V)}catch(W){throw q.stop(r.default.red("failed")),W}let X=Q$(),J=Q1.join($$(),".petdex","version");await X8(J,`${V.tag_name}
74
+ ${Y}`)}return q}function yj($){return $.assets.find((Q)=>Q.name===VJ)??null}async function e7($,Q,V){let q=await fetch($);if(!q.ok||!q.body)throw Error(`download ${$} → ${q.status}`);let Y=Buffer.from(await q.arrayBuffer()),X=`${Q}.tmp`;try{if(await W8(X,Y),V!==void 0)await vj(X,V);if(d$()==="darwin")try{let{spawnSync:J}=await import("node:child_process");J("xattr",["-d","com.apple.quarantine",X],{stdio:"ignore"})}catch{}return{tmpPath:X,destPath:Q}}catch(J){try{await a1(X,{force:!0})}catch{}throw J}}async function kj($){let Q=[];for(let V of $){let q=null;try{let Y=`${V.destPath}.prev`;try{await u$(V.destPath,Y),q=Y}catch(X){if(X.code!=="ENOENT")throw X}await u$(V.tmpPath,V.destPath),Q.push({dest:V.destPath,backup:q})}catch(Y){if(q)try{await a1(V.destPath,{force:!0}),await u$(q,V.destPath)}catch{}for(let X of Q.reverse())try{if(X.backup)await a1(X.dest,{force:!0}),await u$(X.backup,X.dest);else await a1(X.dest,{force:!0})}catch{}for(let X of $)try{await a1(X.tmpPath,{force:!0})}catch{}throw Y}}for(let V of Q){if(!V.backup)continue;try{await a1(V.backup,{force:!0})}catch{}}}async function xQ($){let Q=qJ(),V=gj($,Q.assetSuffix),q=yj($),Y=V$(),X=U8();await K8(Q1.dirname(Y),{recursive:!0}),await K8(Q1.dirname(X),{recursive:!0});let J=[];try{if(J.push(await e7(V.browser_download_url,Y,493)),q)J.push(await e7(q.browser_download_url,X))}catch(G){for(let U of J)try{await a1(U.tmpPath,{force:!0})}catch{}throw G}return{binAsset:V,sidecarAsset:q,staged:J}}async function SQ($){await kj($.staged)}async function Dj($){let Q=await xQ($);return await SQ(Q),{binAsset:Q.binAsset,sidecarAsset:Q.sidecarAsset}}var hj="boba",_j=process.env.PETDEX_URL??"https://petdex.crafter.run",fj=new Set(["pub-94495283df974cfea5e98d6a9e3fa462.r2.dev","yu2vz9gndp.ufs.sh"]);function l$($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return fj.has(Q.hostname)}catch{return!1}}function JJ(){return process.env.HOME??Q$()}function YJ(){return Q1.join(JJ(),".petdex","pets")}function XJ(){return Q1.join(JJ(),".codex","pets")}var bj=16777216;function mj($){for(let Q of["spritesheet.webp","spritesheet.png"]){let V=Q1.join($,Q);try{let q=Rj(V);if(q.isFile()&&q.size>0&&q.size<=bj)return!0}catch{}}return!1}async function cj(){let{readdir:$}=await import("node:fs/promises");for(let Q of[YJ(),XJ()]){let V;try{V=await $(Q)}catch{continue}for(let q of V)if(mj(Q1.join(Q,q)))return!0}return!1}async function pj($={}){let Q=$.fetchOverride??fetch,V=$.petdexUrl??_j,q;try{let G=await Q(`${V}/api/manifest`,{signal:AbortSignal.timeout(8000)});if(!G.ok)return null;let U=await G.json();q=Array.isArray(U?.pets)?U.pets:[]}catch{return null}if(q.length===0)return null;let Y=[],X=new Set,J=q.find((G)=>G.slug===hj);if(J)Y.push(J),X.add(J.slug);for(let G of q)if(!X.has(G.slug))Y.push(G),X.add(G.slug);for(let G of Y){let U=await uj(G,Q);if(U)return U}return null}async function uj($,Q){if(!l$($.spritesheetUrl)||!l$($.petJsonUrl))return null;let V=$.spritesheetUrl.endsWith(".png")?"png":"webp",q=[Q1.join(YJ(),$.slug),Q1.join(XJ(),$.slug)];for(let K of q)if(RQ(K))return null;let Y=async(K)=>{let W=await Q(K,{signal:AbortSignal.timeout(15000)});if(!W.ok)throw Error(`download ${K} → ${W.status}`);return W.arrayBuffer()},X,J;try{[X,J]=await Promise.all([Y($.petJsonUrl),Y($.spritesheetUrl)])}catch{return null}let G=[],U=[];try{for(let K of q){let W=`${K}.partial-${Fj(6).toString("hex")}`;await K8(W,{recursive:!0}),G.push(W),await Promise.all([W8(Q1.join(W,"pet.json"),Buffer.from(X)),W8(Q1.join(W,`spritesheet.${V}`),Buffer.from(J))]),await K8(Q1.dirname(K),{recursive:!0}),await u$(W,K),G.pop(),U.push(K)}return $.slug}catch{return await Promise.all([...G.map((K)=>a1(K,{recursive:!0,force:!0})),...U.map((K)=>a1(K,{recursive:!0,force:!0}))]),null}}async function GJ(){T1(r.default.bgMagenta(r.default.white(" petdex install desktop ")));let $=qJ();c.info(`Platform: ${r.default.cyan(`${$.osLabel} ${$.archLabel}`)}`);let Q=z1();Q.start("Looking up the latest release");let V;try{V=await vQ()}catch(W){throw Q.stop(r.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
75
+ ${W.message}`)}Q.stop(`${r.default.green("✓")} Latest: ${r.default.bold(V.tag_name)}`);let q=z1();q.start("Downloading desktop binary and sidecar");let Y;try{Y=await Dj(V)}catch(W){throw q.stop(r.default.red("failed")),W}let X=V$(),J=Q1.join(Q$(),".petdex","version");await W8(J,`${V.tag_name}
76
76
  `);let G=Y.sidecarAsset?`
77
- ${r.default.dim("•")} Sidecar at ${r.default.cyan(i7(G8()))} (${o7(Y.sidecarAsset.size)})`:`
78
- ${r.default.yellow("!")} No sidecar in this release. Hooks won't reach the mascot until a release ships ${n7}.`;q.stop(`${r.default.green("✓")} Binary at ${r.default.cyan(i7(X))} (${o7(Y.binAsset.size)})${G}`);let U=null;if(!await Oj()){let W=z1();if(W.start("Installing a starter pet so the desktop has something to show"),U=await Nj(),U)W.stop(`${r.default.green("✓")} Starter pet: ${r.default.bold(U)}`);else W.stop(`${r.default.yellow("!")} Could not download a starter pet. Run \`petdex install <slug>\` before \`petdex desktop start\`.`)}let K=["Run it with:",` ${r.default.cyan("petdex desktop start")}`,"","Or wire it into your coding agents:",` ${r.default.cyan("petdex hooks install")}`];return T1(K.join(`
79
- `),"Next"),j1(`${r.default.green("✓")} ${V.tag_name}`),{tag:V.tag_name}}function o7($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}function i7($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}var N1=C1(f1(),1);import{execFileSync as $J,spawn as QJ}from"node:child_process";import{existsSync as VJ,readFileSync as Mj,unlinkSync as Cj}from"node:fs";import{mkdir as wj,writeFile as qJ}from"node:fs/promises";import{homedir as JJ}from"node:os";import K0 from"node:path";function i$(){let $=process.env.HOME??JJ();return K0.join($,".petdex","desktop.pid")}function o$(){let $=process.env.HOME??JJ();return K0.join($,".petdex","desktop.log")}function YJ(){if(!VJ(i$()))return null;let $;try{$=Mj(i$(),"utf8").trim()}catch{return null}if($.startsWith("{")){try{let V=JSON.parse($);if(typeof V.pid==="number"&&Number.isFinite(V.pid)&&V.pid>0&&typeof V.lstart==="string"&&V.lstart.length>0)return{pid:V.pid,lstart:V.lstart}}catch{}return null}let Q=Number($);if(Number.isFinite(Q)&&Q>0)return{pid:Q,lstart:""};return null}function FQ($){try{let V=$J("ps",["-p",String($),"-o","lstart="],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return V.length>0?V:null}catch{return null}}function XJ($){if($.lstart.length===0)return!1;let Q=FQ($.pid);return Q!==null&&Q===$.lstart}function l$(){try{Cj(i$())}catch{}}function x1(){let $=YJ();if($==null)return{state:"stopped"};if(XJ($))return{state:"running",pid:$.pid};return{state:"stale",pid:$.pid}}async function w0(){let $=x1();if($.state==="running")return{ok:!0,pid:$.pid,alreadyRunning:!0};if($.state==="stale")l$();let Q=Q$();if(!VJ(Q))return{ok:!1,reason:`petdex-desktop binary not found at ${Q}. Run \`petdex install desktop\` first.`};await wj(K0.dirname(o$()),{recursive:!0});let V=await import("node:fs").then((U)=>U.openSync(o$(),"a")),q=await import("node:fs").then((U)=>U.openSync(o$(),"a")),Y=Tj(Q);if(Y)return Aj(Y);let X=QJ(Q,[],{detached:!0,stdio:["ignore",V,q]});if(X.unref(),!X.pid)return{ok:!1,reason:"Failed to spawn petdex-desktop"};let J=FQ(X.pid)??"",G={pid:X.pid,lstart:J};return await qJ(i$(),JSON.stringify(G)),{ok:!0,pid:X.pid,alreadyRunning:!1}}function Tj($){let Q=K0.dirname($);if(K0.basename(Q)!=="MacOS")return null;let V=K0.dirname(Q);if(K0.basename(V)!=="Contents")return null;let q=K0.dirname(V);if(!q.endsWith(".app"))return null;return q}async function Aj($){QJ("open",["-gj",$],{stdio:"ignore",detached:!0}).unref();let V=Date.now()+3000,q=null;while(Date.now()<V){if(q=Rj(),q)break;await new Promise((J)=>setTimeout(J,100))}if(!q)return{ok:!1,reason:`Launched ${$} but couldn't find the resulting process. Check ${o$()}.`};let Y=FQ(q)??"",X={pid:q,lstart:Y};return await qJ(i$(),JSON.stringify(X)),{ok:!0,pid:q,alreadyRunning:!1}}function Rj(){try{let $=$J("pgrep",["-f","petdex-desktop"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!$)return null;let Q=$.split(`
80
- `).filter((q)=>q.length>0),V=Number(Q[Q.length-1]);return Number.isFinite(V)&&V>0?V:null}catch{return null}}var GJ=7777;async function n$($={}){let Q=$.sidecarPort??GJ,V=$.portWaitTimeoutMs??5000,q=x1();if(q.state==="stopped")return{ok:!1,reason:"petdex-desktop is not running"};if(q.state==="stale")return l$(),{ok:!1,reason:`petdex-desktop is not running (stale pid ${q.pid} cleared)`};let Y=q.pid,X=YJ();if(X===null||!XJ(X))return l$(),{ok:!1,reason:`petdex-desktop exited before stop (pid ${Y} no longer alive)`};try{process.kill(Y,"SIGTERM")}catch(G){if(l$(),G.code==="ESRCH"){let K=await K8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:K}}return{ok:!1,reason:`Failed to signal pid ${Y}: ${G.message}`}}l$();let J=await K8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:J}}async function KJ(){let $=await w0();if(!$.ok)console.error(`${N1.default.red("✗")} ${$.reason}`),process.exit(1);if($.alreadyRunning)console.log(`${N1.default.dim("•")} petdex-desktop already running (pid ${$.pid})`);else console.log(`${N1.default.green("✓")} petdex-desktop started (pid ${$.pid})`),console.log(N1.default.dim(` log: ${o$()}`))}async function WJ(){let $=await n$();if(!$.ok)console.error(`${N1.default.dim("•")} ${$.reason}`),process.exit($.reason.includes("not running")?0:1);if($.portReleased)console.log(`${N1.default.green("✓")} stopped pid ${$.pid}`);else console.log(`${N1.default.yellow("!")} stopped pid ${$.pid}, but :${GJ} still busy`),console.log(N1.default.dim(" if 'petdex desktop start' fails with EADDRINUSE, wait a moment and retry"))}async function K8($,Q={}){let V=Q.timeoutMs??1e4,q=Q.intervalMs??100,Y=Q.host??"127.0.0.1",{createConnection:X}=await import("node:net"),J=Date.now()+V;while(Date.now()<J){if(await new Promise((U)=>{let K=X({host:Y,port:$}),W=(j)=>{K.removeAllListeners(),K.destroy(),U(j)};K.once("connect",()=>W(!1)),K.once("error",(j)=>{W(j.code==="ECONNREFUSED")}),K.setTimeout(q,()=>W(!1))}))return!0;await new Promise((U)=>setTimeout(U,q))}return!1}function UJ(){let $=x1();switch($.state){case"running":console.log(`${N1.default.green("●")} running (pid ${$.pid})`);break;case"stopped":console.log(`${N1.default.dim("○")} stopped`);break;case"stale":console.log(`${N1.default.yellow("?")} pid ${$.pid} written but not alive (run \`petdex desktop start\` to restart)`);break}}var K1=C1(f1(),1);import{execSync as hj}from"node:child_process";import{existsSync as _1,readFileSync as W8,statSync as xQ}from"node:fs";import{homedir as bj}from"node:os";import R0 from"node:path";import{homedir as Fj}from"node:os";import V1 from"node:path";var r$=7777,W0=`http://127.0.0.1:${r$}/state`;var q1=Fj(),A0=[{id:"claude-code",displayName:"Claude Code",configDir:V1.join(q1,".claude"),configFile:V1.join(q1,".claude","settings.json"),slashCommandPath:V1.join(q1,".claude","commands","petdex.md"),docsUrl:"https://docs.anthropic.com/en/docs/claude-code/hooks",hookEntries:[{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Stop",kind:"session.end"}],build(){return{hooks:{PreToolUse:[{hooks:[{type:"command",command:a1("claude-code","running")}]}],PostToolUse:[{hooks:[{type:"command",command:a1("claude-code","idle")}]}],Stop:[{hooks:[{type:"command",command:a1("claude-code","waving",1500)}]}]}}}},{id:"codex",displayName:"Codex CLI",configDir:V1.join(q1,".codex"),configFile:V1.join(q1,".codex","hooks.json"),slashCommandPath:V1.join(q1,".codex","prompts","petdex.md"),docsUrl:"https://developers.openai.com/codex/hooks",hookEntries:[{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Stop",kind:"session.end"}],async postInstallChecks(){let{readFile:$}=await import("node:fs/promises"),Q=V1.join(q1,".codex","config.toml"),V=!0,q="";try{q=await $(Q,"utf8")}catch(J){let G=J.code;if(G==="ENOENT")V=!1;else return[{level:"warn",message:`Could not read ${Q} (${G??"io_error"}). Make sure [features] codex_hooks = true is set there before Codex picks up the hooks.`}]}let Y=V?xj(q):{state:"missing-file"};if(Y.state==="enabled")return[];let X={prompt:Y.state==="missing-file"?`Create ${T0(Q)} with [features] codex_hooks = true?`:Y.state==="wrong-value"?`Set codex_hooks = true under [features] in ${T0(Q)}? (a .bak of the current file is created first)`:`Add codex_hooks = true under [features] in ${T0(Q)}? (a .bak of the current file is created first)`,apply:async()=>{let{writeFile:J,mkdir:G}=await import("node:fs/promises");if(await G(V1.dirname(Q),{recursive:!0}),!V)try{return await J(Q,`[features]
77
+ ${r.default.dim("•")} Sidecar at ${r.default.cyan(QJ(U8()))} (${$J(Y.sidecarAsset.size)})`:`
78
+ ${r.default.yellow("!")} No sidecar in this release. Hooks won't reach the mascot until a release ships ${VJ}.`;q.stop(`${r.default.green("✓")} Binary at ${r.default.cyan(QJ(X))} (${$J(Y.binAsset.size)})${G}`);let U=null;if(!await cj()){let W=z1();if(W.start("Installing a starter pet so the desktop has something to show"),U=await pj(),U)W.stop(`${r.default.green("✓")} Starter pet: ${r.default.bold(U)}`);else W.stop(`${r.default.yellow("!")} Could not download a starter pet. Run \`petdex install <slug>\` before \`petdex desktop start\`.`)}let K=["Run it with:",` ${r.default.cyan("petdex desktop start")}`,"","Or wire it into your coding agents:",` ${r.default.cyan("petdex hooks install")}`];return w1(K.join(`
79
+ `),"Next"),A1(`${r.default.green("✓")} ${V.tag_name}`),{tag:V.tag_name}}function $J($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}function QJ($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}var B1=I1(c1(),1);import{execFileSync as KJ,spawn as WJ}from"node:child_process";import{existsSync as UJ,readFileSync as dj,unlinkSync as lj}from"node:fs";import{mkdir as oj,writeFile as jJ}from"node:fs/promises";import{homedir as ZJ}from"node:os";import U0 from"node:path";function n$(){let $=process.env.HOME??ZJ();return U0.join($,".petdex","desktop.pid")}function i$(){let $=process.env.HOME??ZJ();return U0.join($,".petdex","desktop.log")}function zJ(){if(!UJ(n$()))return null;let $;try{$=dj(n$(),"utf8").trim()}catch{return null}if($.startsWith("{")){try{let V=JSON.parse($);if(typeof V.pid==="number"&&Number.isFinite(V.pid)&&V.pid>0&&typeof V.lstart==="string"&&V.lstart.length>0)return{pid:V.pid,lstart:V.lstart}}catch{}return null}let Q=Number($);if(Number.isFinite(Q)&&Q>0)return{pid:Q,lstart:""};return null}function EQ($){try{let V=KJ("ps",["-p",String($),"-o","lstart="],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return V.length>0?V:null}catch{return null}}function HJ($){if($.lstart.length===0)return!1;let Q=EQ($.pid);return Q!==null&&Q===$.lstart}function o$(){try{lj(n$())}catch{}}function s1(){let $=zJ();if($==null)return{state:"stopped"};if(HJ($))return{state:"running",pid:$.pid};return{state:"stale",pid:$.pid}}async function r$(){let $=s1();if($.state==="running")return{ok:!0,pid:$.pid,alreadyRunning:!0};if($.state==="stale")o$();let Q=V$();if(!UJ(Q))return{ok:!1,reason:`petdex-desktop binary not found at ${Q}. Run \`petdex install desktop\` first.`};await oj(U0.dirname(i$()),{recursive:!0});let V=await import("node:fs").then((U)=>U.openSync(i$(),"a")),q=await import("node:fs").then((U)=>U.openSync(i$(),"a")),Y=ij(Q);if(Y)return nj(Y);let X=WJ(Q,[],{detached:!0,stdio:["ignore",V,q]});if(X.unref(),!X.pid)return{ok:!1,reason:"Failed to spawn petdex-desktop"};let J=EQ(X.pid)??"",G={pid:X.pid,lstart:J};return await jJ(n$(),JSON.stringify(G)),{ok:!0,pid:X.pid,alreadyRunning:!1}}function ij($){let Q=U0.dirname($);if(U0.basename(Q)!=="MacOS")return null;let V=U0.dirname(Q);if(U0.basename(V)!=="Contents")return null;let q=U0.dirname(V);if(!q.endsWith(".app"))return null;return q}async function nj($){WJ("open",["-gj",$],{stdio:"ignore",detached:!0}).unref();let V=Date.now()+3000,q=null;while(Date.now()<V){if(q=rj(),q)break;await new Promise((J)=>setTimeout(J,100))}if(!q)return{ok:!1,reason:`Launched ${$} but couldn't find the resulting process. Check ${i$()}.`};let Y=EQ(q)??"",X={pid:q,lstart:Y};return await jJ(n$(),JSON.stringify(X)),{ok:!0,pid:q,alreadyRunning:!1}}function rj(){try{let $=KJ("pgrep",["-f","petdex-desktop"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!$)return null;let Q=$.split(`
80
+ `).filter((q)=>q.length>0),V=Number(Q[Q.length-1]);return Number.isFinite(V)&&V>0?V:null}catch{return null}}var PJ=7777;async function a$($={}){let Q=$.sidecarPort??PJ,V=$.portWaitTimeoutMs??5000,q=s1();if(q.state==="stopped")return{ok:!1,reason:"petdex-desktop is not running"};if(q.state==="stale")return o$(),{ok:!1,reason:`petdex-desktop is not running (stale pid ${q.pid} cleared)`};let Y=q.pid,X=zJ();if(X===null||!HJ(X))return o$(),{ok:!1,reason:`petdex-desktop exited before stop (pid ${Y} no longer alive)`};try{process.kill(Y,"SIGTERM")}catch(G){if(o$(),G.code==="ESRCH"){let K=await j8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:K}}return{ok:!1,reason:`Failed to signal pid ${Y}: ${G.message}`}}o$();let J=await j8(Q,{timeoutMs:V});return{ok:!0,pid:Y,portReleased:J}}async function LJ(){let $=await r$();if(!$.ok)console.error(`${B1.default.red("✗")} ${$.reason}`),process.exit(1);if($.alreadyRunning)console.log(`${B1.default.dim("•")} petdex-desktop already running (pid ${$.pid})`);else console.log(`${B1.default.green("✓")} petdex-desktop started (pid ${$.pid})`),console.log(B1.default.dim(` log: ${i$()}`))}async function OJ(){let $=await a$();if(!$.ok)console.error(`${B1.default.dim("•")} ${$.reason}`),process.exit($.reason.includes("not running")?0:1);if($.portReleased)console.log(`${B1.default.green("✓")} stopped pid ${$.pid}`);else console.log(`${B1.default.yellow("!")} stopped pid ${$.pid}, but :${PJ} still busy`),console.log(B1.default.dim(" if 'petdex desktop start' fails with EADDRINUSE, wait a moment and retry"))}async function j8($,Q={}){let V=Q.timeoutMs??1e4,q=Q.intervalMs??100,Y=Q.host??"127.0.0.1",{createConnection:X}=await import("node:net"),J=Date.now()+V;while(Date.now()<J){if(await new Promise((U)=>{let K=X({host:Y,port:$}),W=(Z)=>{K.removeAllListeners(),K.destroy(),U(Z)};K.once("connect",()=>W(!1)),K.once("error",(Z)=>{W(Z.code==="ECONNREFUSED")}),K.setTimeout(q,()=>W(!1))}))return!0;await new Promise((U)=>setTimeout(U,q))}return!1}function BJ(){let $=s1();switch($.state){case"running":console.log(`${B1.default.green("●")} running (pid ${$.pid})`);break;case"stopped":console.log(`${B1.default.dim("○")} stopped`);break;case"stale":console.log(`${B1.default.yellow("?")} pid ${$.pid} written but not alive (run \`petdex desktop start\` to restart)`);break}}var K1=I1(c1(),1);import{execSync as XZ}from"node:child_process";import{existsSync as b1,readFileSync as Z8,statSync as kQ}from"node:fs";import{homedir as GZ}from"node:os";import R0 from"node:path";import{homedir as aj}from"node:os";import V1 from"node:path";var s$=7777,A0=`http://127.0.0.1:${s$}/state`;var q1=aj(),F0=[{id:"claude-code",displayName:"Claude Code",configDir:V1.join(q1,".claude"),configFile:V1.join(q1,".claude","settings.json"),slashCommandPath:V1.join(q1,".claude","commands","petdex.md"),docsUrl:"https://docs.anthropic.com/en/docs/claude-code/hooks",hookEntries:[{event:"UserPromptSubmit",kind:"user.prompt"},{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Notification",kind:"session.waiting"},{event:"Stop",kind:"session.end"}],build(){return{hooks:{UserPromptSubmit:[{hooks:[{type:"command",command:f1("claude-code","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:f1("claude-code","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:f1("claude-code","post","idle")}]}],Notification:[{hooks:[{type:"command",command:f1("claude-code","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:f1("claude-code","stop","waving",1500)}]}]}}}},{id:"codex",displayName:"Codex CLI",configDir:V1.join(q1,".codex"),configFile:V1.join(q1,".codex","hooks.json"),slashCommandPath:V1.join(q1,".codex","prompts","petdex.md"),docsUrl:"https://developers.openai.com/codex/hooks",hookEntries:[{event:"UserPromptSubmit",kind:"user.prompt"},{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"PermissionRequest",kind:"session.waiting"},{event:"Stop",kind:"session.end"}],async postInstallChecks(){let{readFile:$}=await import("node:fs/promises"),Q=V1.join(q1,".codex","config.toml"),V=!0,q="";try{q=await $(Q,"utf8")}catch(J){let G=J.code;if(G==="ENOENT")V=!1;else return[{level:"warn",message:`Could not read ${Q} (${G??"io_error"}). Make sure [features] codex_hooks = true is set there before Codex picks up the hooks.`}]}let Y=V?ej(q):{state:"missing-file"};if(Y.state==="enabled")return[];let X={prompt:Y.state==="missing-file"?`Create ${T0(Q)} with [features] codex_hooks = true?`:Y.state==="wrong-value"?`Set codex_hooks = true under [features] in ${T0(Q)}? (a .bak of the current file is created first)`:`Add codex_hooks = true under [features] in ${T0(Q)}? (a .bak of the current file is created first)`,apply:async()=>{let{writeFile:J,mkdir:G}=await import("node:fs/promises");if(await G(V1.dirname(Q),{recursive:!0}),!V)try{return await J(Q,`[features]
81
81
  codex_hooks = true
82
- `,"utf8"),{ok:!0,message:`Created ${T0(Q)} with [features] codex_hooks = true`}}catch(j){return{ok:!1,message:`Write failed: ${j.message}`}}let U=new Date().toISOString().replace(/[:.]/g,"-"),K=`${Q}.${U}.bak`;try{await J(K,q)}catch(j){return{ok:!1,message:`Backup failed: ${j.message}`}}let W=Sj(q,Y);try{return await J(Q,W,"utf8"),{ok:!0,message:`codex_hooks = true set in ${T0(Q)} (backup: ${V1.basename(K)})`}}catch(j){return{ok:!1,message:`Write failed: ${j.message}`}}}};return[{level:"action",message:`Codex needs codex_hooks = true under [features] in ${T0(Q)} before it loads ${T0(V1.join(q1,".codex","hooks.json"))}.`,fix:X}]},build(){return{hooks:{PreToolUse:[{hooks:[{type:"command",command:a1("codex","running")}]}],PostToolUse:[{hooks:[{type:"command",command:a1("codex","idle")}]}],Stop:[{hooks:[{type:"command",command:a1("codex","waving",1500)}]}]}}}},{id:"gemini",displayName:"Gemini CLI",configDir:V1.join(q1,".gemini"),configFile:V1.join(q1,".gemini","settings.json"),slashCommandPath:V1.join(q1,".gemini","antigravity","global_workflows","petdex.md"),docsUrl:"https://google-gemini.github.io/gemini-cli/docs/hooks",hookEntries:[{event:"BeforeTool",kind:"tool.before"},{event:"AfterTool",kind:"tool.after"},{event:"SessionEnd",kind:"session.end"}],build(){return{hooks:{BeforeTool:[{hooks:[{type:"command",command:a1("gemini","running")}]}],AfterTool:[{hooks:[{type:"command",command:a1("gemini","idle")}]}],SessionEnd:[{hooks:[{type:"command",command:a1("gemini","waving",1500)}]}]}}}},{id:"opencode",displayName:"OpenCode",configDir:V1.join(q1,".config","opencode"),configFile:V1.join(q1,".config","opencode","plugins","petdex.js"),slashCommandPath:V1.join(q1,".config","opencode","command","petdex.md"),docsUrl:"https://opencode.ai/docs/plugins",hookEntries:[{event:"tool.execute.before",kind:"tool.before"},{event:"tool.execute.after",kind:"tool.after"},{event:"session.idle",kind:"session.end"},{event:"session.error",kind:"session.error"}],build(){return vj()}}];function a1($,Q,V){let q=V!=null?`{"state":"${Q}","duration":${V},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`,Y='[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0',X='T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"';return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"; ${[`[ -n "$T" ] && curl -s -m 0.3 -X POST ${W0}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${q}'`,">/dev/null 2>&1 || true"].join(" ")}`}function vj(){return`// petdex hook plugin — auto-generated by \`petdex hooks install\`.
82
+ `,"utf8"),{ok:!0,message:`Created ${T0(Q)} with [features] codex_hooks = true`}}catch(Z){return{ok:!1,message:`Write failed: ${Z.message}`}}let U=new Date().toISOString().replace(/[:.]/g,"-"),K=`${Q}.${U}.bak`;try{await J(K,q)}catch(Z){return{ok:!1,message:`Backup failed: ${Z.message}`}}let W=$Z(q,Y);try{return await J(Q,W,"utf8"),{ok:!0,message:`codex_hooks = true set in ${T0(Q)} (backup: ${V1.basename(K)})`}}catch(Z){return{ok:!1,message:`Write failed: ${Z.message}`}}}};return[{level:"action",message:`Codex needs codex_hooks = true under [features] in ${T0(Q)} before it loads ${T0(V1.join(q1,".codex","hooks.json"))}.`,fix:X}]},build(){return{hooks:{UserPromptSubmit:[{hooks:[{type:"command",command:f1("codex","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:f1("codex","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:f1("codex","post","idle")}]}],PermissionRequest:[{hooks:[{type:"command",command:f1("codex","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:f1("codex","stop","waving",1500)}]}]}}}},{id:"gemini",displayName:"Gemini CLI",configDir:V1.join(q1,".gemini"),configFile:V1.join(q1,".gemini","settings.json"),slashCommandPath:V1.join(q1,".gemini","antigravity","global_workflows","petdex.md"),docsUrl:"https://google-gemini.github.io/gemini-cli/docs/hooks",hookEntries:[{event:"BeforeTool",kind:"tool.before"},{event:"AfterTool",kind:"tool.after"},{event:"SessionEnd",kind:"session.end"}],build(){return{hooks:{BeforeTool:[{hooks:[{type:"command",command:gQ("gemini","running")}]}],AfterTool:[{hooks:[{type:"command",command:gQ("gemini","idle")}]}],SessionEnd:[{hooks:[{type:"command",command:gQ("gemini","waving",1500)}]}]}}}},{id:"opencode",displayName:"OpenCode",configDir:V1.join(q1,".config","opencode"),configFile:V1.join(q1,".config","opencode","plugins","petdex.js"),slashCommandPath:V1.join(q1,".config","opencode","command","petdex.md"),docsUrl:"https://opencode.ai/docs/plugins",hookEntries:[{event:"tool.execute.before",kind:"tool.before"},{event:"tool.execute.after",kind:"tool.after"},{event:"session.idle",kind:"session.end"},{event:"session.error",kind:"session.error"}],build(){return tj()}}];function f1($,Q,V,q){return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; ${['if [ -x "$HOME/.petdex/bin/petdex.js" ] || [ -f "$HOME/.petdex/bin/petdex.js" ]; then',` node "$HOME/.petdex/bin/petdex.js" bubble ${Q} ${$} >/dev/null 2>&1 || true;`,"else",` ${sj($,V,q)};`,"fi"].join(" ")}`}function sj($,Q,V){let q=V!=null?`{"state":"${Q}","duration":${V},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`;return['T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"',`[ -n "$T" ] && curl -s -m 0.3 -X POST ${A0}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${q}'`,">/dev/null 2>&1 || true"].join(" ")}function gQ($,Q,V){let q=V!=null?`{"state":"${Q}","duration":${V},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`,Y='[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0',X='T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"';return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"; ${[`[ -n "$T" ] && curl -s -m 0.3 -X POST ${A0}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${q}'`,">/dev/null 2>&1 || true"].join(" ")}`}function tj(){return`// petdex hook plugin — auto-generated by \`petdex hooks install\`.
83
83
  // Forwards OpenCode lifecycle events to the petdex desktop mascot via HTTP.
84
84
  // Edit STATE_MAP below to customize which state each event triggers.
85
85
 
@@ -88,7 +88,7 @@ import { readFile } from "node:fs/promises";
88
88
  import { homedir } from "node:os";
89
89
  import { join } from "node:path";
90
90
 
91
- const SIDECAR_URL = ${JSON.stringify(W0)};
91
+ const SIDECAR_URL = ${JSON.stringify(A0)};
92
92
  const RUNTIME_DIR = join(homedir(), ".petdex", "runtime");
93
93
  const TOKEN_PATH = join(RUNTIME_DIR, "update-token");
94
94
  const KILLSWITCH_PATH = join(RUNTIME_DIR, "hooks-disabled");
@@ -144,8 +144,8 @@ export const PetdexPlugin = async () => ({
144
144
  else if (event.type === "session.error") setState("failed", 2500);
145
145
  },
146
146
  });
147
- `}function T0($){if($.startsWith(q1))return`~${$.slice(q1.length)}`;return $}function xj($){let Q=$.split(`
148
- `),V=/^\s*\[([^[\]]+)\]\s*(?:#.*)?$/,q=/^\s*codex_hooks\s*=\s*(.+?)\s*(?:#.*)?$/,Y=null,X=null;for(let J=0;J<Q.length;J+=1){let G=Q[J],U=G.match(V);if(U){if(Y=U[1].trim(),Y==="features"&&X===null)X=J;continue}if(Y!=="features")continue;let K=G.match(q);if(!K)continue;if(K[1].trim()==="true")return{state:"enabled"};return{state:"wrong-value",replaceLine:J}}if(X===null)return{state:"no-features-section"};return{state:"no-key",insertAfterLine:X}}function Sj($,Q){if(Q.state==="enabled"||Q.state==="missing-file")return $;let V=$.split(`
147
+ `}function T0($){if($.startsWith(q1))return`~${$.slice(q1.length)}`;return $}function ej($){let Q=$.split(`
148
+ `),V=/^\s*\[([^[\]]+)\]\s*(?:#.*)?$/,q=/^\s*codex_hooks\s*=\s*(.+?)\s*(?:#.*)?$/,Y=null,X=null;for(let J=0;J<Q.length;J+=1){let G=Q[J],U=G.match(V);if(U){if(Y=U[1].trim(),Y==="features"&&X===null)X=J;continue}if(Y!=="features")continue;let K=G.match(q);if(!K)continue;if(K[1].trim()==="true")return{state:"enabled"};return{state:"wrong-value",replaceLine:J}}if(X===null)return{state:"no-features-section"};return{state:"no-key",insertAfterLine:X}}function $Z($,Q){if(Q.state==="enabled"||Q.state==="missing-file")return $;let V=$.split(`
149
149
  `);if(Q.state==="wrong-value"){let Y=V[Q.replaceLine],X=/^(\s*codex_hooks\s*=\s*)([^#\n]+?)(\s*(?:#.*)?)$/,J=Y.match(X);return V[Q.replaceLine]=J?`${J[1]}true${J[3]}`:"codex_hooks = true",V.join(`
150
150
  `)}if(Q.state==="no-key")return V.splice(Q.insertAfterLine+1,0,"codex_hooks = true"),V.join(`
151
151
  `);let q=$.endsWith(`
@@ -153,42 +153,41 @@ export const PetdexPlugin = async () => ({
153
153
  `;return`${$}${q}
154
154
  [features]
155
155
  codex_hooks = true
156
- `}import{existsSync as Ej,mkdirSync as gj,unlinkSync as kj,writeFileSync as yj}from"node:fs";import{homedir as Dj}from"node:os";import vQ from"node:path";function jJ(){return process.env.HOME??Dj()}function ZJ(){return vQ.join(jJ(),".petdex","runtime","hooks-disabled")}function a$(){return vQ.join(jJ(),".petdex","runtime","update-token")}function V$(){return Ej(ZJ())?"off":"on"}function q$($){let Q=ZJ();if($==="off")gj(vQ.dirname(Q),{recursive:!0}),yj(Q,`# Petdex hook killswitch.
156
+ `}import{existsSync as QZ,mkdirSync as VZ,unlinkSync as qZ,writeFileSync as JZ}from"node:fs";import{homedir as YZ}from"node:os";import yQ from"node:path";function NJ(){return process.env.HOME??YZ()}function MJ(){return yQ.join(NJ(),".petdex","runtime","hooks-disabled")}function t$(){return yQ.join(NJ(),".petdex","runtime","update-token")}function q$(){return QZ(MJ())?"off":"on"}function J$($){let Q=MJ();if($==="off")VZ(yQ.dirname(Q),{recursive:!0}),JZ(Q,`# Petdex hook killswitch.
157
157
  # Hooks are DISABLED while this file exists.
158
158
  # Re-enable: petdex hooks on (or /petdex from inside your agent).
159
- `,{mode:384});else try{kj(Q)}catch{}return $}function HJ(){return q$(V$()==="on"?"off":"on")}function s$(){return process.env.HOME??bj()}function _j(){return R0.join(s$(),".petdex","runtime","update-token")}function fj(){return R0.join(s$(),".petdex","desktop.pid")}function mj(){let $=Q$();if(!_1($))return{status:"fail",label:"Desktop binary",detail:`not found at ${$}`,hint:"Run `petdex install desktop` to download it."};try{if(!(xQ($).mode&73))return{status:"fail",label:"Desktop binary",detail:`${$} exists but is not executable`,hint:`chmod +x ${$}`}}catch{return{status:"fail",label:"Desktop binary",detail:`${$} unreadable`,hint:"Reinstall: `petdex install desktop`"}}return{status:"ok",label:"Desktop binary",detail:$}}function cj(){let $=G8();if(!_1($))return{status:"fail",label:"Sidecar bundle",detail:`not found at ${$}`,hint:"Reinstall: `petdex install desktop`"};return{status:"ok",label:"Sidecar bundle",detail:$}}async function pj(){try{let $=await fetch("http://127.0.0.1:7777/health",{signal:AbortSignal.timeout(500)});if(!$.ok)return{status:"warn",label:"Sidecar reachable",detail:`:7777 responded ${$.status}`,hint:"Restart: `petdex desktop stop && petdex desktop start`"};let Q=await $.json().catch(()=>null);if(Q?.ok&&Q?.port===7777)return{status:"ok",label:"Sidecar reachable",detail:":7777 healthy"};return{status:"warn",label:"Sidecar reachable",detail:":7777 responded but body shape was unexpected"}}catch{return{status:"info",label:"Sidecar reachable",detail:"not running (this is fine if you haven't started the desktop)",hint:"Start with `petdex desktop start`"}}}function uj(){let $=fj();if(!_1($))return{status:"info",label:"PID file",detail:"not present (desktop not running)"};let Q;try{Q=W8($,"utf8").trim()}catch{return{status:"warn",label:"PID file",detail:`unreadable at ${$}`,hint:`Delete it: rm ${$}`}}if(!Q.startsWith("{"))return{status:"warn",label:"PID file",detail:"legacy bare-pid format detected",hint:"Run `petdex desktop start` to rewrite it in the new format."};try{let V=JSON.parse(Q);if(typeof V.pid!=="number"||typeof V.lstart!=="string")return{status:"warn",label:"PID file",detail:"unexpected JSON shape",hint:`Delete it: rm ${$}`};return{status:"ok",label:"PID file",detail:`pid ${V.pid}, started ${V.lstart}`}}catch{return{status:"warn",label:"PID file",detail:"JSON parse failed",hint:`Delete it: rm ${$}`}}}function dj(){let $=_j();if(!_1($))return{status:"info",label:"Update token",detail:"absent (will be created when sidecar starts)"};try{if(W8($,"utf8").trim().length<16)return{status:"warn",label:"Update token",detail:"present but suspiciously short",hint:"Stop the desktop and run `petdex desktop start` to regenerate."};let q=xQ($).mode&511;if(q!==384)return{status:"warn",label:"Update token",detail:`present, mode ${q.toString(8)} (expected 600)`,hint:`chmod 600 ${$}`};return{status:"ok",label:"Update token",detail:"present, mode 600"}}catch(Q){return{status:"warn",label:"Update token",detail:`read failed: ${Q.message}`}}}function lj(){if(V$()==="off")return{status:"warn",label:"Killswitch",detail:"DISABLED — agent hooks are short-circuited",hint:"Re-enable with `petdex hooks on` or `/petdex on` from inside your agent."};return{status:"ok",label:"Killswitch",detail:"hooks enabled"}}function oj(){let $=[];for(let Q of A0){let V=_1(Q.configFile),q=_1(Q.slashCommandPath);if(!_1(Q.configDir)){$.push({status:"info",label:Q.displayName,detail:"not installed on this machine"});continue}let Y=!1;if(V)try{let X=W8(Q.configFile,"utf8");Y=X.includes("127.0.0.1:7777/state")||X.includes("/state")}catch{Y=!1}if(!Y){$.push({status:"warn",label:Q.displayName,detail:"petdex hook NOT detected",hint:"Run `petdex hooks install`"});continue}if(!q){$.push({status:"warn",label:Q.displayName,detail:"hook installed, but /petdex slash command missing",hint:"Re-run `petdex hooks install` to add the slash command."});continue}$.push({status:"ok",label:Q.displayName,detail:"hooks + /petdex installed"})}return $}function ij(){let $=R0.join(s$(),".codex","config.toml");if(!_1($))return{status:"info",label:"Codex codex_hooks flag",detail:"config.toml absent (Codex not installed?)"};try{let Q=W8($,"utf8");if(/\[features\][\s\S]*?codex_hooks\s*=\s*true/.test(Q))return{status:"ok",label:"Codex codex_hooks flag",detail:"[features] codex_hooks = true"};return{status:"warn",label:"Codex codex_hooks flag",detail:"missing or set to non-true",hint:"Re-run `petdex hooks install` and accept the auto-fix prompt."}}catch{return{status:"warn",label:"Codex codex_hooks flag",detail:"config.toml unreadable"}}}function nj(){let $=[R0.join(s$(),".petdex","pets"),R0.join(s$(),".codex","pets")],Q=0;for(let V of $){if(!_1(V))continue;try{let{readdirSync:q}=i("node:fs"),Y=q(V);for(let X of Y){let J=R0.join(V,X);for(let G of["spritesheet.webp","spritesheet.png"]){let U=R0.join(J,G);if(!_1(U))continue;try{let K=xQ(U);if(K.size>0&&K.size<=16777216){Q+=1;break}}catch{}}}}catch{}}if(Q===0)return{status:"fail",label:"Installed pets",detail:"no usable pets in ~/.petdex/pets or ~/.codex/pets",hint:"Install one with `petdex install <slug>`"};return{status:"ok",label:"Installed pets",detail:`${Q} usable spritesheet(s) on disk`}}function rj($){switch($){case"ok":return K1.default.green("✓");case"warn":return K1.default.yellow("!");case"fail":return K1.default.red("✗");case"info":return K1.default.dim("○")}}function B1($){let Q=$.detail?` ${K1.default.dim($.detail)}`:"";if(console.log(` ${rj($.status)} ${K1.default.bold($.label)}${Q}`),$.hint)console.log(` ${K1.default.cyan("→")} ${$.hint}`)}async function zJ(){console.log(K1.default.bgMagenta(K1.default.white(" petdex doctor "))),console.log(""),console.log(K1.default.bold("Install")),B1(mj()),B1(cj()),B1(nj()),console.log(""),console.log(K1.default.bold("Runtime")),B1(await pj()),B1(uj()),B1(dj()),B1(lj()),console.log(""),console.log(K1.default.bold("Agents"));for(let Q of oj())B1(Q);B1(ij()),console.log(""),console.log(K1.default.bold("Network"));let $=null;try{$=hj("lsof -nP -i:7777 2>/dev/null || true",{encoding:"utf8"}).trim()}catch{$=null}if($===null)B1({status:"info",label:":7777 listener",detail:"lsof unavailable"});else if($.length===0)B1({status:"info",label:":7777 listener",detail:"nothing bound (sidecar offline)"});else{let Q=$.split(`
160
- `).length-1;B1({status:Q===1?"ok":"warn",label:":7777 listener",detail:Q===1?"1 process bound":`${Q} processes bound`,hint:Q>1?"Multiple sidecars contending for the same port. Stop both and start fresh.":void 0})}console.log("")}import{existsSync as aj,readFileSync as LJ}from"node:fs";import{writeFile as sj}from"node:fs/promises";import{homedir as IJ}from"node:os";import OJ from"node:path";var o=C1(f1(),1);var U8=7777,tj="x-petdex-update-token",ej=OJ.join(IJ(),".petdex","runtime","update-token"),SQ=OJ.join(IJ(),".petdex","version");async function $Z($={}){let Q=$.port??U8,V=$.timeoutMs??2000,q=$.tokenPath??ej,Y;try{Y=LJ(q,"utf8").trim()}catch{return!1}if(!Y)return!1;let X=new AbortController,J=setTimeout(()=>X.abort(),V);try{return(await fetch(`http://127.0.0.1:${Q}/update/handoff`,{method:"POST",headers:{[tj]:Y},signal:X.signal})).ok}catch{return!1}finally{clearTimeout(J)}}function QZ(){if(!aj(SQ))return null;try{return LJ(SQ,"utf8").trim()||null}catch{return null}}async function NJ($=[]){let Q=$.includes("--force"),V=$.includes("--silent"),q=(P)=>{if(V)console.log(`[petdex update] ${P}`);else A1(o.default.bgMagenta(o.default.white(` ${P} `)))},Y=(P)=>{if(V)console.log(P);else m.info(P)},X=(P)=>{if(V)console.warn(P);else m.warn(P)},J=(P)=>{if(V)console.log(P);else j1(P)},G=()=>{if(V)return{start:(M)=>console.log(M),stop:(M)=>console.log(M)};let P=z1();return{start:(M)=>P.start(M),stop:(M)=>P.stop(M)}};q("petdex update");let U=QZ();Y(U?`Installed: ${V?U:o.default.cyan(U)}`:"No installed version recorded - treating as fresh install.");let K=G();K.start("Checking GitHub for the latest release");let W;try{W=await TQ()}catch(P){throw K.stop(V?"failed":o.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
161
- ${P.message}`)}if(K.stop(V?`Latest: ${W.tag_name}`:`${o.default.green("✓")} Latest: ${o.default.bold(W.tag_name)}`),!Q&&U&&U===W.tag_name){J(V?"Already up to date.":`${o.default.green("✓")} Already up to date.`);return}let j=G();j.start(`Downloading ${W.tag_name}`);let H;try{H=await AQ(W)}catch(P){throw j.stop(V?"failed":o.default.red("failed")),P}j.stop(V?`Downloaded ${W.tag_name} (${PJ(H.binAsset.size)})`:`${o.default.green("✓")} Downloaded ${o.default.bold(W.tag_name)} (${PJ(H.binAsset.size)})`);let z=x1().state==="running";if(z)Y(V?"Stopping running petdex-desktop":`${o.default.dim("•")} Stopping running petdex-desktop`),await n$();if(await RQ(H),await sj(SQ,`${W.tag_name}
162
- `),z){Y(V?"Asking sidecar to release port":`${o.default.dim("•")} Asking sidecar to release port`);let P=await $Z();if(Y(V?P?"Sidecar acknowledged handoff":"Sidecar handoff unavailable, falling back to port wait":P?`${o.default.dim("•")} Sidecar acknowledged handoff`:`${o.default.dim("•")} Sidecar handoff unavailable, falling back to port wait`),!await K8(U8,{timeoutMs:1e4})){X(V?`Port ${U8} still in use after 10s. Run 'petdex desktop stop && petdex desktop start' to recover.`:`${o.default.yellow("!")} Port ${U8} still in use after 10s. Run \`petdex desktop stop && petdex desktop start\` to recover.`);return}Y(V?"Restarting petdex-desktop":`${o.default.dim("•")} Restarting petdex-desktop`);let B=await w0();if(B.ok)Y(V?`Restarted (pid ${B.pid})`:`${o.default.green("✓")} Restarted (pid ${B.pid})`);else X(V?`Could not restart: ${B.reason}. Run 'petdex desktop start' manually.`:`${o.default.yellow("!")} Could not restart: ${B.reason}. Run \`petdex desktop start\` manually.`)}let C=U?`${U} → ${W.tag_name}`:W.tag_name;J(V?C:`${o.default.green("✓")} ${C}`)}function PJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}import{mkdir as GZ,readFile as wJ,stat as KZ,writeFile as EQ}from"node:fs/promises";import TJ from"node:path";var g=C1(f1(),1);import{mkdir as VZ,rm as qZ,writeFile as JZ}from"node:fs/promises";import YZ from"node:path";var XZ="---\ndescription: Wake or sleep the petdex mascot — toggles the floating pet on/off\n---\n\nThe user wants to control the petdex mascot from inside the agent. The mascot is a floating macOS window driven by hooks installed in agent settings. /petdex is a one-shot toggle that flips the entire state in a single command:\n\n- `/petdex` (no args) → run `petdex toggle` (if mascot is awake, send to sleep; otherwise wake it up)\n- `/petdex up` → run `petdex up` (force-wake: enables hooks AND starts the desktop)\n- `/petdex down` → run `petdex down` (force-sleep: disables hooks AND stops the desktop)\n- `/petdex status` → run `petdex hooks status`\n- `/petdex doctor` → run `petdex doctor` (diagnose install + agents)\n\nShow the command output verbatim to the user. Don't reinterpret, don't explain — the CLI's output is already user-facing.\n\nIf the `petdex` binary isn't on PATH, suggest `npx petdex <subcommand>` instead.\n\nArguments: `$ARGUMENTS`\n";async function BJ($){await VZ(YZ.dirname($.slashCommandPath),{recursive:!0}),await JZ($.slashCommandPath,XZ,"utf8")}async function MJ($){try{await qZ($.slashCommandPath,{force:!0})}catch{}}async function WZ(){return Promise.all(A0.map(async($)=>({agent:$,installed:await AJ($.configDir)})))}async function AJ($){try{return await KZ($),!0}catch{return!1}}async function gQ(){A1(g.default.bgMagenta(g.default.white(" petdex hooks install ")));let $=await WZ(),Q=$.some((U)=>U.installed);m.info(Q?"Found these agents on your system:":"No coding agent configs detected. You can still pre-write hooks for any agent — they'll activate when you install it.");for(let{agent:U,installed:K}of $){let W=K?g.default.green("●"):g.default.dim("○"),j=K?g.default.dim("installed"):g.default.dim("not found");console.log(` ${W} ${g.default.bold(U.displayName)} ${j}`)}let V=await HV({message:"Which agents should drive the mascot?",options:$.map(({agent:U,installed:K})=>({value:U.id,label:U.displayName,hint:K?"installed":"not installed yet"})),initialValues:$.filter((U)=>U.installed).map((U)=>U.agent.id),required:!1});if(m1(V)||V.length===0)return J1("No agents selected. Bye."),{installedAgents:[]};let q=[],Y=[],X=[];for(let U of V){let K=A0.find((W)=>W.id===U);if(!K)continue;try{let W=await UZ(K);if(X.push(K.id),q.push(` ${g.default.green("✓")} ${g.default.bold(K.displayName)} ${g.default.dim(`→ ${PZ(K.configFile)}`)}${W.backupPath?g.default.dim(` (backup: ${TJ.basename(W.backupPath)})`):""}`),K.postInstallChecks)try{let j=await K.postInstallChecks();if(j.length>0)Y.push({agent:K.displayName,notes:j})}catch{}}catch(W){q.push(` ${g.default.red("✗")} ${g.default.bold(K.displayName)} ${g.default.red(W instanceof Error?W.message:String(W))}`)}}T1(q.join(`
163
- `),"Done");for(let{agent:U,notes:K}of Y)for(let W of K){let j=W.level==="action"?g.default.bgYellow(g.default.black(" action needed ")):W.level==="warn"?g.default.yellow("!"):g.default.cyan("i");if(m.warn(`${j} ${g.default.bold(U)}
164
- ${W.message}`),W.fix){let H=await X$({message:W.fix.prompt,initialValue:!0});if(!m1(H)&&H){let z=await W.fix.apply();if(z.ok)m.info(`${g.default.green("✓")} ${z.message}`);else m.warn(`${g.default.red("✗")} ${z.message}`)}}}let J=x1();if(J.state==="running")m.info(`${g.default.green("●")} petdex-desktop already running (pid ${J.pid}).`);else{let U=await X$({message:"Start petdex-desktop now so hooks have somewhere to land?",initialValue:!0});if(!m1(U)&&U){let K=await w0();if(K.ok)m.info(K.alreadyRunning?`${g.default.dim("•")} already running (pid ${K.pid})`:`${g.default.green("✓")} petdex-desktop started (pid ${K.pid})`);else m.warn(`${g.default.yellow("!")} Could not start petdex-desktop: ${K.reason}`),m.info(`Install it with ${g.default.cyan("petdex install desktop")} and then ${g.default.cyan("petdex desktop start")}.`)}}let G=["T=$(cat ~/.petdex/runtime/update-token)",`curl -X POST ${W0}`,'-H "X-Petdex-Update-Token: $T"',`--data-raw '{"state":"waving"}'`].join(" ");return m.info([`Petdex listens on ${g.default.cyan(W0)} when ${g.default.bold("petdex-desktop")} is running.`,`Test it: ${g.default.cyan(G)}`].join(`
165
- `)),j1(g.default.dim("Restart your agent for the hooks to load.")),{installedAgents:X}}async function UZ($){await GZ(TJ.dirname($.configFile),{recursive:!0});let Q=$.build();if(await BJ($),$.id==="opencode"){let J=await CJ($.configFile);return await EQ($.configFile,Q,"utf8"),{backupPath:J}}let V=await jZ($.configFile);if(V.kind==="error")throw Error(`Refusing to overwrite ${$.configFile}: ${V.message}.
166
- Fix the file (or rename it) and run \`petdex hooks install\` again.`);let q=V.kind==="ok"?await CJ($.configFile):null,Y=V.kind==="ok"?V.value:{},X=ZZ(Y,Q);return await EQ($.configFile,`${JSON.stringify(X,null,2)}
167
- `,"utf8"),{backupPath:q}}async function jZ($){let Q;try{Q=await wJ($,"utf8")}catch(V){let q=V.code;if(q==="ENOENT")return{kind:"missing"};return{kind:"error",message:`read failed (${q??V.name}): ${V.message}`}}try{return{kind:"ok",value:JSON.parse(Q)}}catch(V){return{kind:"error",message:`JSON parse failed: ${V.message}`}}}async function CJ($){if(!await AJ($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await wJ($);return await EQ(V,q),V}function ZZ($,Q){let V={...$},q=Q.hooks??{},X={...V.hooks??{}};for(let[J,G]of Object.entries(q)){let K=(Array.isArray(X[J])?X[J]:[]).filter((W)=>!HZ(W));X[J]=[...K,...G]}return V.hooks=X,V}function HZ($){if(typeof $!=="object"||$==null)return!1;return zZ($).some((V)=>V.includes(`localhost:${r$}/state`)||V.includes(W0))}function zZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}function PZ($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}import{existsSync as t$}from"node:fs";import{readFile as FJ,rm as vJ,writeFile as xJ}from"node:fs/promises";import LZ from"node:path";var t=C1(f1(),1);async function SJ($={}){A1(t.default.bgMagenta(t.default.white(" petdex hooks uninstall ")));let V=(await IZ()).filter((X)=>X.installed);if(V.length===0)return j1(t.default.dim("No agent configs found — nothing to uninstall.")),{uninstalledAgents:[]};let q=[],Y=[];for(let{agent:X}of V)try{let J=await OZ(X);if(J.removed){Y.push(X.id);let G=J.backupPath?` ${t.default.dim(`(backup: ${LZ.basename(J.backupPath)})`)}`:"";q.push(` ${t.default.green("✓")} ${t.default.bold(X.displayName)}${G}`)}else q.push(` ${t.default.dim("•")} ${t.default.bold(X.displayName)} ${t.default.dim("(no petdex entries found)")}`);await MJ(X)}catch(J){q.push(` ${t.default.red("✗")} ${t.default.bold(X.displayName)} ${t.default.red(J instanceof Error?J.message:String(J))}`)}if(T1(q.join(`
168
- `),"Done"),$.removeToken)try{await vJ(a$(),{force:!0}),m.info(`${t.default.green("✓")} Removed ${a$()}`)}catch{}else if(t$(a$()))m.info(t.default.dim(`Token file at ${a$()} kept. Pass --remove-token to delete it.`));return j1(`${t.default.green("✓")} Done. Run ${t.default.cyan("petdex hooks install")} to wire petdex back in.`),{uninstalledAgents:Y}}async function IZ(){return Promise.all(A0.map(async($)=>({agent:$,installed:t$($.configDir)})))}async function OZ($){if($.id==="opencode"){if(!t$($.configFile))return{removed:!1,backupPath:null};let X=await RJ($.configFile);return await vJ($.configFile,{force:!0}),{removed:!0,backupPath:X}}if(!t$($.configFile))return{removed:!1,backupPath:null};let Q;try{Q=await FJ($.configFile,"utf8")}catch(X){throw Error(`Could not read ${$.configFile}: ${X.message}`)}let V;try{V=JSON.parse(Q)}catch(X){throw Error(`Refusing to overwrite ${$.configFile}: invalid JSON (${X.message}). Hand-edit the file to remove petdex entries.`)}let q=NZ(V);if(!q.changed)return{removed:!1,backupPath:null};let Y=await RJ($.configFile);return await xJ($.configFile,`${JSON.stringify(q.value,null,2)}
169
- `,"utf8"),{removed:!0,backupPath:Y}}function NZ($){let Q={...$},V=Q.hooks;if(!V||typeof V!=="object"||Array.isArray(V))return{value:Q,changed:!1};let q=!1,Y={};for(let[X,J]of Object.entries(V)){if(!Array.isArray(J)){Y[X]=J;continue}let G=J.filter((U)=>!BZ(U));if(G.length!==J.length)q=!0;if(G.length>0)Y[X]=G}if(!q)return{value:Q,changed:!1};if(Object.keys(Y).length===0){let{hooks:X,...J}=Q;return{value:J,changed:!0}}return Q.hooks=Y,{value:Q,changed:!0}}function BZ($){if(typeof $!=="object"||$==null)return!1;return MZ($).some((V)=>V.includes(`localhost:${r$}/state`)||V.includes(W0))}function MZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}async function RJ($){if(!t$($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await FJ($);return await xJ(V,q),V}import{spawn as CZ}from"node:child_process";import{randomUUID as EJ}from"node:crypto";import{existsSync as wZ,mkdirSync as TZ,readFileSync as AZ,writeFileSync as RZ}from"node:fs";import{homedir as FZ}from"node:os";import gJ from"node:path";function j8(){let $=process.env.HOME??FZ();return gJ.join($,".petdex","telemetry.json")}var vZ=process.env.PETDEX_TELEMETRY_URL??"https://petdex.crafter.run/api/telemetry/event",xZ=2000;function Z8(){if(!wZ(j8()))return{kind:"missing"};let $;try{$=AZ(j8(),"utf8")}catch(Q){return{kind:"error",reason:`read failed: ${Q.message}`}}try{return{kind:"ok",config:JSON.parse($)}}catch(Q){return{kind:"error",reason:`parse failed: ${Q.message}`}}}function kQ($){try{return TZ(gJ.dirname(j8()),{recursive:!0}),RZ(j8(),`${JSON.stringify($,null,2)}
170
- `),!0}catch{return!1}}function kJ(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=Z8();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:EJ(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return kQ(Q)?Q:null}function yJ(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=Z8();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function DJ($){let Q=Z8(),V;if(Q.kind==="ok")V=Q.config,V.enabled=$;else V={install_id:EJ(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return kQ(V)}function hJ(){let $=Z8();return{enabled:yJ(),install_id:$.kind==="ok"?$.config.install_id:null}}function bJ(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=kJ();if(!$)return;if($.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.crafter.run/legal/telemetry",""].join(`
171
- `)),$.notice_seen=!0,kQ($)}function e$($,Q={}){if(!yJ())return;let V=kJ();if(!V)return;let q=JSON.stringify({install_id:V.install_id,event:$,...Q});try{let Y=`
159
+ `,{mode:384});else try{qZ(Q)}catch{}return $}function IJ(){return J$(q$()==="on"?"off":"on")}function e$(){return process.env.HOME??GZ()}function KZ(){return R0.join(e$(),".petdex","runtime","update-token")}function WZ(){return R0.join(e$(),".petdex","desktop.pid")}function UZ(){let $=V$();if(!b1($))return{status:"fail",label:"Desktop binary",detail:`not found at ${$}`,hint:"Run `petdex install desktop` to download it."};try{if(!(kQ($).mode&73))return{status:"fail",label:"Desktop binary",detail:`${$} exists but is not executable`,hint:`chmod +x ${$}`}}catch{return{status:"fail",label:"Desktop binary",detail:`${$} unreadable`,hint:"Reinstall: `petdex install desktop`"}}return{status:"ok",label:"Desktop binary",detail:$}}function jZ(){let $=U8();if(!b1($))return{status:"fail",label:"Sidecar bundle",detail:`not found at ${$}`,hint:"Reinstall: `petdex install desktop`"};return{status:"ok",label:"Sidecar bundle",detail:$}}async function ZZ(){try{let $=await fetch("http://127.0.0.1:7777/health",{signal:AbortSignal.timeout(500)});if(!$.ok)return{status:"warn",label:"Sidecar reachable",detail:`:7777 responded ${$.status}`,hint:"Restart: `petdex desktop stop && petdex desktop start`"};let Q=await $.json().catch(()=>null);if(Q?.ok&&Q?.port===7777)return{status:"ok",label:"Sidecar reachable",detail:":7777 healthy"};return{status:"warn",label:"Sidecar reachable",detail:":7777 responded but body shape was unexpected"}}catch{return{status:"info",label:"Sidecar reachable",detail:"not running (this is fine if you haven't started the desktop)",hint:"Start with `petdex desktop start`"}}}function zZ(){let $=WZ();if(!b1($))return{status:"info",label:"PID file",detail:"not present (desktop not running)"};let Q;try{Q=Z8($,"utf8").trim()}catch{return{status:"warn",label:"PID file",detail:`unreadable at ${$}`,hint:`Delete it: rm ${$}`}}if(!Q.startsWith("{"))return{status:"warn",label:"PID file",detail:"legacy bare-pid format detected",hint:"Run `petdex desktop start` to rewrite it in the new format."};try{let V=JSON.parse(Q);if(typeof V.pid!=="number"||typeof V.lstart!=="string")return{status:"warn",label:"PID file",detail:"unexpected JSON shape",hint:`Delete it: rm ${$}`};return{status:"ok",label:"PID file",detail:`pid ${V.pid}, started ${V.lstart}`}}catch{return{status:"warn",label:"PID file",detail:"JSON parse failed",hint:`Delete it: rm ${$}`}}}function HZ(){let $=KZ();if(!b1($))return{status:"info",label:"Update token",detail:"absent (will be created when sidecar starts)"};try{if(Z8($,"utf8").trim().length<16)return{status:"warn",label:"Update token",detail:"present but suspiciously short",hint:"Stop the desktop and run `petdex desktop start` to regenerate."};let q=kQ($).mode&511;if(q!==384)return{status:"warn",label:"Update token",detail:`present, mode ${q.toString(8)} (expected 600)`,hint:`chmod 600 ${$}`};return{status:"ok",label:"Update token",detail:"present, mode 600"}}catch(Q){return{status:"warn",label:"Update token",detail:`read failed: ${Q.message}`}}}function PZ(){if(q$()==="off")return{status:"warn",label:"Killswitch",detail:"DISABLED — agent hooks are short-circuited",hint:"Re-enable with `petdex hooks on` or `/petdex on` from inside your agent."};return{status:"ok",label:"Killswitch",detail:"hooks enabled"}}function LZ(){let $=[];for(let Q of F0){let V=b1(Q.configFile),q=b1(Q.slashCommandPath);if(!b1(Q.configDir)){$.push({status:"info",label:Q.displayName,detail:"not installed on this machine"});continue}let Y=!1;if(V)try{let X=Z8(Q.configFile,"utf8");Y=X.includes("127.0.0.1:7777/state")||X.includes("/state")}catch{Y=!1}if(!Y){$.push({status:"warn",label:Q.displayName,detail:"petdex hook NOT detected",hint:"Run `petdex hooks install`"});continue}if(!q){$.push({status:"warn",label:Q.displayName,detail:"hook installed, but /petdex slash command missing",hint:"Re-run `petdex hooks install` to add the slash command."});continue}$.push({status:"ok",label:Q.displayName,detail:"hooks + /petdex installed"})}return $}function OZ(){let $=R0.join(e$(),".codex","config.toml");if(!b1($))return{status:"info",label:"Codex codex_hooks flag",detail:"config.toml absent (Codex not installed?)"};try{let Q=Z8($,"utf8");if(/\[features\][\s\S]*?codex_hooks\s*=\s*true/.test(Q))return{status:"ok",label:"Codex codex_hooks flag",detail:"[features] codex_hooks = true"};return{status:"warn",label:"Codex codex_hooks flag",detail:"missing or set to non-true",hint:"Re-run `petdex hooks install` and accept the auto-fix prompt."}}catch{return{status:"warn",label:"Codex codex_hooks flag",detail:"config.toml unreadable"}}}function BZ(){let $=[R0.join(e$(),".petdex","pets"),R0.join(e$(),".codex","pets")],Q=0;for(let V of $){if(!b1(V))continue;try{let{readdirSync:q}=d("node:fs"),Y=q(V);for(let X of Y){let J=R0.join(V,X);for(let G of["spritesheet.webp","spritesheet.png"]){let U=R0.join(J,G);if(!b1(U))continue;try{let K=kQ(U);if(K.size>0&&K.size<=16777216){Q+=1;break}}catch{}}}}catch{}}if(Q===0)return{status:"fail",label:"Installed pets",detail:"no usable pets in ~/.petdex/pets or ~/.codex/pets",hint:"Install one with `petdex install <slug>`"};return{status:"ok",label:"Installed pets",detail:`${Q} usable spritesheet(s) on disk`}}function NZ($){switch($){case"ok":return K1.default.green("✓");case"warn":return K1.default.yellow("!");case"fail":return K1.default.red("✗");case"info":return K1.default.dim("○")}}function N1($){let Q=$.detail?` ${K1.default.dim($.detail)}`:"";if(console.log(` ${NZ($.status)} ${K1.default.bold($.label)}${Q}`),$.hint)console.log(` ${K1.default.cyan("→")} ${$.hint}`)}async function CJ(){console.log(K1.default.bgMagenta(K1.default.white(" petdex doctor "))),console.log(""),console.log(K1.default.bold("Install")),N1(UZ()),N1(jZ()),N1(BZ()),console.log(""),console.log(K1.default.bold("Runtime")),N1(await ZZ()),N1(zZ()),N1(HZ()),N1(PZ()),console.log(""),console.log(K1.default.bold("Agents"));for(let Q of LZ())N1(Q);N1(OZ()),console.log(""),console.log(K1.default.bold("Network"));let $=null;try{$=XZ("lsof -nP -i:7777 2>/dev/null || true",{encoding:"utf8"}).trim()}catch{$=null}if($===null)N1({status:"info",label:":7777 listener",detail:"lsof unavailable"});else if($.length===0)N1({status:"info",label:":7777 listener",detail:"nothing bound (sidecar offline)"});else{let Q=$.split(`
160
+ `).length-1;N1({status:Q===1?"ok":"warn",label:":7777 listener",detail:Q===1?"1 process bound":`${Q} processes bound`,hint:Q>1?"Multiple sidecars contending for the same port. Stop both and start fresh.":void 0})}console.log("")}import{existsSync as MZ,readFileSync as TJ}from"node:fs";import{writeFile as IZ}from"node:fs/promises";import{homedir as AJ}from"node:os";import FJ from"node:path";var o=I1(c1(),1);var z8=7777,CZ="x-petdex-update-token",wZ=FJ.join(AJ(),".petdex","runtime","update-token"),DQ=FJ.join(AJ(),".petdex","version");async function TZ($={}){let Q=$.port??z8,V=$.timeoutMs??2000,q=$.tokenPath??wZ,Y;try{Y=TJ(q,"utf8").trim()}catch{return!1}if(!Y)return!1;let X=new AbortController,J=setTimeout(()=>X.abort(),V);try{return(await fetch(`http://127.0.0.1:${Q}/update/handoff`,{method:"POST",headers:{[CZ]:Y},signal:X.signal})).ok}catch{return!1}finally{clearTimeout(J)}}function AZ(){if(!MZ(DQ))return null;try{return TJ(DQ,"utf8").trim()||null}catch{return null}}async function RJ($=[]){let Q=$.includes("--force"),V=$.includes("--silent"),q=(P)=>{if(V)console.log(`[petdex update] ${P}`);else T1(o.default.bgMagenta(o.default.white(` ${P} `)))},Y=(P)=>{if(V)console.log(P);else c.info(P)},X=(P)=>{if(V)console.warn(P);else c.warn(P)},J=(P)=>{if(V)console.log(P);else A1(P)},G=()=>{if(V)return{start:(I)=>console.log(I),stop:(I)=>console.log(I)};let P=z1();return{start:(I)=>P.start(I),stop:(I)=>P.stop(I)}};q("petdex update");let U=AZ();Y(U?`Installed: ${V?U:o.default.cyan(U)}`:"No installed version recorded - treating as fresh install.");let K=G();K.start("Checking GitHub for the latest release");let W;try{W=await vQ()}catch(P){throw K.stop(V?"failed":o.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
161
+ ${P.message}`)}if(K.stop(V?`Latest: ${W.tag_name}`:`${o.default.green("✓")} Latest: ${o.default.bold(W.tag_name)}`),!Q&&U&&U===W.tag_name){J(V?"Already up to date.":`${o.default.green("✓")} Already up to date.`);return}let Z=G();Z.start(`Downloading ${W.tag_name}`);let z;try{z=await xQ(W)}catch(P){throw Z.stop(V?"failed":o.default.red("failed")),P}Z.stop(V?`Downloaded ${W.tag_name} (${wJ(z.binAsset.size)})`:`${o.default.green("✓")} Downloaded ${o.default.bold(W.tag_name)} (${wJ(z.binAsset.size)})`);let H=s1().state==="running";if(H)Y(V?"Stopping running petdex-desktop":`${o.default.dim("•")} Stopping running petdex-desktop`),await a$();if(await SQ(z),await IZ(DQ,`${W.tag_name}
162
+ `),H){Y(V?"Asking sidecar to release port":`${o.default.dim("•")} Asking sidecar to release port`);let P=await TZ();if(Y(V?P?"Sidecar acknowledged handoff":"Sidecar handoff unavailable, falling back to port wait":P?`${o.default.dim("•")} Sidecar acknowledged handoff`:`${o.default.dim("•")} Sidecar handoff unavailable, falling back to port wait`),!await j8(z8,{timeoutMs:1e4})){X(V?`Port ${z8} still in use after 10s. Run 'petdex desktop stop && petdex desktop start' to recover.`:`${o.default.yellow("!")} Port ${z8} still in use after 10s. Run \`petdex desktop stop && petdex desktop start\` to recover.`);return}Y(V?"Restarting petdex-desktop":`${o.default.dim("•")} Restarting petdex-desktop`);let M=await r$();if(M.ok)Y(V?`Restarted (pid ${M.pid})`:`${o.default.green("✓")} Restarted (pid ${M.pid})`);else X(V?`Could not restart: ${M.reason}. Run 'petdex desktop start' manually.`:`${o.default.yellow("!")} Could not restart: ${M.reason}. Run \`petdex desktop start\` manually.`)}let C=U?`${U} → ${W.tag_name}`:W.tag_name;J(V?C:`${o.default.green("✓")} ${C}`)}function wJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}import{mkdir as DZ,readFile as kJ,stat as hZ,writeFile as _Q}from"node:fs/promises";import _Z from"node:path";var i=I1(c1(),1);import{mkdir as FZ,rm as RZ,writeFile as vZ}from"node:fs/promises";import xZ from"node:path";var SZ="---\ndescription: Wake or sleep the petdex mascot — toggles the floating pet on/off\n---\n\nThe user wants to control the petdex mascot from inside the agent. The mascot is a floating macOS window driven by hooks installed in agent settings. /petdex is a one-shot toggle that flips the entire state in a single command:\n\n- `/petdex` (no args) → run `petdex toggle` (if mascot is awake, send to sleep; otherwise wake it up)\n- `/petdex up` → run `petdex up` (force-wake: enables hooks AND starts the desktop)\n- `/petdex down` → run `petdex down` (force-sleep: disables hooks AND stops the desktop)\n- `/petdex status` → run `petdex hooks status`\n- `/petdex doctor` → run `petdex doctor` (diagnose install + agents)\n\nShow the command output verbatim to the user. Don't reinterpret, don't explain — the CLI's output is already user-facing.\n\nIf the `petdex` binary isn't on PATH, suggest `npx petdex <subcommand>` instead.\n\nArguments: `$ARGUMENTS`\n";async function vJ($){await FZ(xZ.dirname($.slashCommandPath),{recursive:!0}),await vZ($.slashCommandPath,SZ,"utf8")}async function xJ($){try{await RZ($.slashCommandPath,{force:!0})}catch{}}async function fZ(){return Promise.all(F0.map(async($)=>({agent:$,installed:await DJ($.configDir)})))}async function DJ($){try{return await hZ($),!0}catch{return!1}}async function fQ(){T1(i.default.bgMagenta(i.default.white(" petdex hooks install ")));try{let{persistRunningBinary:J}=await Promise.resolve().then(() => (gJ(),EJ)),G=await J();if(!G.ok&&G.reason)c.warn(`Could not persist petdex binary (${G.reason}). Bubbles will be disabled.`)}catch(J){c.warn(`Could not persist petdex binary (${J.message}). Bubbles will be disabled.`)}let $=await fZ(),Q=$.some((J)=>J.installed);c.info(Q?"Found these agents on your system:":"No coding agent configs detected. You can still pre-write hooks for any agent — they'll activate when you install it.");for(let{agent:J,installed:G}of $){let U=G?i.default.green("●"):i.default.dim("○"),K=G?i.default.dim("installed"):i.default.dim("not found");console.log(` ${U} ${i.default.bold(J.displayName)} ${K}`)}let V=await IV({message:"Which agents should drive the mascot?",options:$.map(({agent:J,installed:G})=>({value:J.id,label:J.displayName,hint:G?"installed":"not installed yet"})),initialValues:$.filter((J)=>J.installed).map((J)=>J.agent.id),required:!1});if(e1(V)||V.length===0)return J1("No agents selected. Bye."),{installedAgents:[]};let q=[],Y=[],X=[];for(let J of V){let G=F0.find((U)=>U.id===J);if(!G)continue;try{let U=await bZ(G);if(X.push(G.id),q.push(` ${i.default.green("✓")} ${i.default.bold(G.displayName)}`),G.postInstallChecks)try{let K=await G.postInstallChecks();if(K.length>0)Y.push({agent:G.displayName,notes:K})}catch{}}catch(U){q.push(` ${i.default.red("✗")} ${i.default.bold(G.displayName)} ${i.default.red(U instanceof Error?U.message:String(U))}`)}}w1(q.join(`
163
+ `),"Done");for(let{agent:J,notes:G}of Y)for(let U of G){let K=U.level==="action"?i.default.bgYellow(i.default.black(" action needed ")):U.level==="warn"?i.default.yellow("!"):i.default.cyan("i");if(c.warn(`${K} ${i.default.bold(J)}
164
+ ${U.message}`),U.fix){let W=await H6({message:U.fix.prompt,initialValue:!0});if(!e1(W)&&W){let Z=await U.fix.apply();if(Z.ok)c.info(`${i.default.green("✓")} ${Z.message}`);else c.warn(`${i.default.red("✗")} ${Z.message}`)}}}return{installedAgents:X}}async function bZ($){await DZ(_Z.dirname($.configFile),{recursive:!0});let Q=$.build();if(await vJ($),$.id==="opencode"){let J=await yJ($.configFile);return await _Q($.configFile,Q,"utf8"),{backupPath:J}}let V=await mZ($.configFile);if(V.kind==="error")throw Error(`Refusing to overwrite ${$.configFile}: ${V.message}.
165
+ Fix the file (or rename it) and run \`petdex hooks install\` again.`);let q=V.kind==="ok"?await yJ($.configFile):null,Y=V.kind==="ok"?V.value:{},X=cZ(Y,Q);return await _Q($.configFile,`${JSON.stringify(X,null,2)}
166
+ `,"utf8"),{backupPath:q}}async function mZ($){let Q;try{Q=await kJ($,"utf8")}catch(V){let q=V.code;if(q==="ENOENT")return{kind:"missing"};return{kind:"error",message:`read failed (${q??V.name}): ${V.message}`}}try{return{kind:"ok",value:JSON.parse(Q)}}catch(V){return{kind:"error",message:`JSON parse failed: ${V.message}`}}}async function yJ($){if(!await DJ($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await kJ($);return await _Q(V,q),V}function cZ($,Q){let V={...$},q=Q.hooks??{},X={...V.hooks??{}};for(let[J,G]of Object.entries(q)){let K=(Array.isArray(X[J])?X[J]:[]).filter((W)=>!pZ(W));X[J]=[...K,...G]}return V.hooks=X,V}function pZ($){if(typeof $!=="object"||$==null)return!1;return uZ($).some((V)=>V.includes(`localhost:${s$}/state`)||V.includes(A0))}function uZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}import{existsSync as $6}from"node:fs";import{readFile as _J,rm as fJ,writeFile as bJ}from"node:fs/promises";import dZ from"node:path";var t=I1(c1(),1);async function mJ($={}){T1(t.default.bgMagenta(t.default.white(" petdex hooks uninstall ")));let V=(await lZ()).filter((X)=>X.installed);if(V.length===0)return A1(t.default.dim("No agent configs found — nothing to uninstall.")),{uninstalledAgents:[]};let q=[],Y=[];for(let{agent:X}of V)try{let J=await oZ(X);if(J.removed){Y.push(X.id);let G=J.backupPath?` ${t.default.dim(`(backup: ${dZ.basename(J.backupPath)})`)}`:"";q.push(` ${t.default.green("✓")} ${t.default.bold(X.displayName)}${G}`)}else q.push(` ${t.default.dim("•")} ${t.default.bold(X.displayName)} ${t.default.dim("(no petdex entries found)")}`);await xJ(X)}catch(J){q.push(` ${t.default.red("✗")} ${t.default.bold(X.displayName)} ${t.default.red(J instanceof Error?J.message:String(J))}`)}if(w1(q.join(`
167
+ `),"Done"),$.removeToken)try{await fJ(t$(),{force:!0}),c.info(`${t.default.green("✓")} Removed ${t$()}`)}catch{}else if($6(t$()))c.info(t.default.dim(`Token file at ${t$()} kept. Pass --remove-token to delete it.`));return A1(`${t.default.green("✓")} Done. Run ${t.default.cyan("petdex hooks install")} to wire petdex back in.`),{uninstalledAgents:Y}}async function lZ(){return Promise.all(F0.map(async($)=>({agent:$,installed:$6($.configDir)})))}async function oZ($){if($.id==="opencode"){if(!$6($.configFile))return{removed:!1,backupPath:null};let X=await hJ($.configFile);return await fJ($.configFile,{force:!0}),{removed:!0,backupPath:X}}if(!$6($.configFile))return{removed:!1,backupPath:null};let Q;try{Q=await _J($.configFile,"utf8")}catch(X){throw Error(`Could not read ${$.configFile}: ${X.message}`)}let V;try{V=JSON.parse(Q)}catch(X){throw Error(`Refusing to overwrite ${$.configFile}: invalid JSON (${X.message}). Hand-edit the file to remove petdex entries.`)}let q=iZ(V);if(!q.changed)return{removed:!1,backupPath:null};let Y=await hJ($.configFile);return await bJ($.configFile,`${JSON.stringify(q.value,null,2)}
168
+ `,"utf8"),{removed:!0,backupPath:Y}}function iZ($){let Q={...$},V=Q.hooks;if(!V||typeof V!=="object"||Array.isArray(V))return{value:Q,changed:!1};let q=!1,Y={};for(let[X,J]of Object.entries(V)){if(!Array.isArray(J)){Y[X]=J;continue}let G=J.filter((U)=>!nZ(U));if(G.length!==J.length)q=!0;if(G.length>0)Y[X]=G}if(!q)return{value:Q,changed:!1};if(Object.keys(Y).length===0){let{hooks:X,...J}=Q;return{value:J,changed:!0}}return Q.hooks=Y,{value:Q,changed:!0}}function nZ($){if(typeof $!=="object"||$==null)return!1;return rZ($).some((V)=>V.includes(`localhost:${s$}/state`)||V.includes(A0))}function rZ($){let Q=[];function V(q){if(typeof q==="string"){Q.push(q);return}if(Array.isArray(q)){for(let Y of q)V(Y);return}if(typeof q==="object"&&q!=null)for(let Y of Object.values(q))V(Y)}return V($),Q}async function hJ($){if(!$6($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),V=`${$}.${Q}.bak`,q=await _J($);return await bJ(V,q),V}import{spawn as aZ}from"node:child_process";import{randomUUID as cJ}from"node:crypto";import{existsSync as sZ,mkdirSync as tZ,readFileSync as eZ,writeFileSync as $z}from"node:fs";import{homedir as Qz}from"node:os";import pJ from"node:path";function H8(){let $=process.env.HOME??Qz();return pJ.join($,".petdex","telemetry.json")}var Vz=process.env.PETDEX_TELEMETRY_URL??"https://petdex.crafter.run/api/telemetry/event",qz=2000;function P8(){if(!sZ(H8()))return{kind:"missing"};let $;try{$=eZ(H8(),"utf8")}catch(Q){return{kind:"error",reason:`read failed: ${Q.message}`}}try{return{kind:"ok",config:JSON.parse($)}}catch(Q){return{kind:"error",reason:`parse failed: ${Q.message}`}}}function bQ($){try{return tZ(pJ.dirname(H8()),{recursive:!0}),$z(H8(),`${JSON.stringify($,null,2)}
169
+ `),!0}catch{return!1}}function uJ(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=P8();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:cJ(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return bQ(Q)?Q:null}function dJ(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=P8();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function lJ($){let Q=P8(),V;if(Q.kind==="ok")V=Q.config,V.enabled=$;else V={install_id:cJ(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return bQ(V)}function oJ(){let $=P8();return{enabled:dJ(),install_id:$.kind==="ok"?$.config.install_id:null}}function iJ(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=uJ();if(!$)return;if($.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.crafter.run/legal/telemetry",""].join(`
170
+ `)),$.notice_seen=!0,bQ($)}function Q6($,Q={}){if(!dJ())return;let V=uJ();if(!V)return;let q=JSON.stringify({install_id:V.install_id,event:$,...Q});try{let Y=`
172
171
  const controller = new AbortController();
173
- const t = setTimeout(() => controller.abort(), ${xZ});
174
- fetch(${JSON.stringify(vZ)}, {
172
+ const t = setTimeout(() => controller.abort(), ${qz});
173
+ fetch(${JSON.stringify(Vz)}, {
175
174
  method: "POST",
176
175
  headers: { "content-type": "application/json" },
177
176
  body: ${JSON.stringify(q)},
178
177
  signal: controller.signal,
179
178
  }).catch(() => {}).finally(() => clearTimeout(t));
180
- `;CZ(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var M1=process.env.PETDEX_URL??"https://petdex.crafter.run",EZ="https://clerk.petdex.crafter.run",gZ="LcThwEayl6KAA1Qm",yQ=["profile","email","openid","offline_access"];async function kZ(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:yQ};try{let V=await fetch(`${M1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(V.ok){let q=await V.json(),Y=typeof q.issuer==="string"?q.issuer:null,X=typeof q.clientId==="string"?q.clientId:null,J=Array.isArray(q.scopes)?q.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:yQ}}}catch{}return{issuer:$??EZ,clientId:Q??gZ,scopes:yQ}}var z8=null;async function I8(){if(z8)return z8;let $=await kZ();return z8=new J8({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),z8}var J$="0.3.0";yZ().catch(($)=>{J1(`petdex: ${$.message}`),process.exit(1)});async function yZ(){let $=process.argv.slice(2),Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){mJ();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))bJ();switch(Q){case"login":await DZ();break;case"logout":await hZ();break;case"whoami":await bZ();break;case"submit":await mZ($.slice(1));break;case"install":await _Z($.slice(1));break;case"list":await fZ();break;case"hooks":await sZ($.slice(1));break;case"desktop":await QH($.slice(1));break;case"init":await eZ();break;case"up":await nJ();break;case"down":await rJ();break;case"toggle":await $H();break;case"update":await NJ($.slice(1));break;case"doctor":await zJ();break;case"telemetry":VH($.slice(1));break;case"version":case"--version":case"-v":console.log(J$);break;default:console.error(Z.default.red(`Unknown command: ${Q}`)),mJ(),process.exit(1)}}function mJ(){let $=Z.default.cyan,Q=Z.default.dim;console.log(["",` ${Z.default.bold(Z.default.magenta("petdex"))} ${Q(J$)} ${Q("— Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${Z.default.bold("init")} First-run setup — wires hooks across your agents AND wakes the mascot ${Z.default.green("(start here)")}`,` ${Z.default.bold("login")} Sign in with Clerk OAuth`,` ${Z.default.bold("logout")} Clear stored credentials`,` ${Z.default.bold("whoami")} Show signed-in user`,` ${Z.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${Z.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${Z.default.bold("install desktop")} Install the petdex-desktop binary (alternative to the .dmg)`,` ${Z.default.bold("list")} List approved pets`,` ${Z.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${Z.default.bold("toggle")} One-shot wake/sleep — flips the mascot on or off depending on current state`,` ${Z.default.bold("up")} Force-wake the mascot — enables hooks AND launches petdex-desktop`,` ${Z.default.bold("down")} Force-sleep the mascot — disables hooks AND stops petdex-desktop`,` ${Z.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${Z.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${Z.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${Z.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex init ${Q("# after dragging Petdex.app from the .dmg → just run this")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex toggle ${Q("# wake or sleep the mascot")}`,` ${Q("$")} petdex doctor ${Q("# diagnose install + agents")}`,` ${Q("$")} petdex update ${Q("# pull the latest release")}`,"",` ${Q("Gallery & docs:")} ${Z.default.underline(M1)}`,""].join(`
181
- `))}async function DZ(){A1(Z.default.bgMagenta(Z.default.white(" petdex login ")));let $=z1();$.start("Opening your browser to sign in with Clerk");try{let Q=await I8(),{user:V}=await Q.login(),q=oJ(V.email,V.username,V.sub)??"unknown";$.stop(`${Z.default.green("✓ ")}Signed in as ${Z.default.cyan(q)}`),j1(`Try ${Z.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(Z.default.red("× login failed")),Error(iZ(Q.message))}}async function hZ(){await(await I8()).logout(),console.log(`${Z.default.green("✓ ")}Signed out`)}async function bZ(){try{let Q=await(await I8()).whoami();if(!Q)throw Error("not signed in");let V=[L8(Q.given_name),L8(Q.family_name)].filter(Boolean).join(" ");T1([`${Z.default.dim("user: ")}${Q.sub}`,`${Z.default.dim("email: ")}${Q.email??"—"}`,`${Z.default.dim("name: ")}${V||"—"}`,`${Z.default.dim("username:")}${L8(Q.preferred_username)??"—"}`].join(`
182
- `),"Signed in")}catch{J1(`Not signed in. Run ${Z.default.cyan("petdex login")}.`),process.exit(1)}}async function _Z($){let Q=$[0];if(!Q)J1(`Usage: ${Z.default.cyan("petdex install <slug|desktop>")}`),process.exit(1);if(Q==="desktop"){let{tag:W}=await e7();e$("cli_install_desktop_success",{cli_version:J$,os:process.platform,arch:process.arch,binary_version:W.replace(/^desktop-v/,"")});return}let V=z1();V.start(`Resolving ${Q}`);let q;try{let W=await fetch(`${M1}/api/manifest`);if(!W.ok)throw V.stop(Z.default.red("failed")),Error(`manifest fetch ${W.status}`);let H=(await W.json()).pets.find((z)=>z.slug===Q);if(!H)V.stop(Z.default.red("not found")),J1(`No pet with slug ${Z.default.bold(Q)}. Try ${Z.default.cyan("petdex list")} to see what's available.`),process.exit(1);if(!d$(H.spritesheetUrl)||!d$(H.petJsonUrl))V.stop(Z.default.red("untrusted asset host")),J1(`Refusing to install ${Z.default.bold(Q)}: asset URLs are outside the petdex host allowlist. This row may need to be re-uploaded by an admin.`),process.exit(1);q=H}catch(W){throw V.stop(Z.default.red("failed")),W}let Y=X1.join(fJ(),".petdex","pets",Q),X=X1.join(fJ(),".codex","pets",Q);V.message(`Downloading ${Q}`),await Promise.all([_J(Y,{recursive:!0}),_J(X,{recursive:!0})]);let J=q.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let j=await fetch(W);if(!j.ok)throw Error(`download ${W} → ${j.status} ${j.statusText}`);return j.arrayBuffer()},[U,K]=await Promise.all([G(q.petJsonUrl),G(q.spritesheetUrl)]);await Promise.all([H8(X1.join(Y,"pet.json"),Buffer.from(U)),H8(X1.join(Y,`spritesheet.${J}`),Buffer.from(K)),H8(X1.join(X,"pet.json"),Buffer.from(U)),H8(X1.join(X,`spritesheet.${J}`),Buffer.from(K))]),fetch(`${M1}/install/${Q}`,{method:"GET"}).catch(()=>{}),V.stop(`Installed ${Z.default.cyan(q.displayName)}`),T1(["Paths:",` ${Z.default.dim(`~/.petdex/pets/${Q}`)} (Petdex Desktop)`,` ${Z.default.dim(`~/.codex/pets/${Q}`)} (Codex Desktop)`,"","Activate in Petdex Desktop: right-click the mascot.","Activate in Codex Desktop:",` ${Z.default.cyan("Settings → Appearance → Pets")} → select ${Z.default.bold(q.displayName)}`].join(`
183
- `),"Next steps")}async function fZ(){let $=z1();$.start("Fetching gallery");let Q=await fetch(`${M1}/api/manifest`);if(!Q.ok)throw $.stop(Z.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let V=await Q.json();$.stop(`${V.total} pets`);let q=V.pets.map((Y)=>{let X=Y.submittedBy?Z.default.dim(` — by ${Y.submittedBy}`):"";return` ${Z.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${X}`});console.log(q.join(`
179
+ `;aZ(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var M1=process.env.PETDEX_URL??"https://petdex.crafter.run",Oz="https://clerk.petdex.crafter.run",Bz="LcThwEayl6KAA1Qm",cQ=["profile","email","openid","offline_access"];async function Nz(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:cQ};try{let V=await fetch(`${M1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(V.ok){let q=await V.json(),Y=typeof q.issuer==="string"?q.issuer:null,X=typeof q.clientId==="string"?q.clientId:null,J=Array.isArray(q.scopes)?q.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:cQ}}}catch{}return{issuer:$??Oz,clientId:Q??Bz,scopes:cQ}}var O8=null;async function M8(){if(O8)return O8;let $=await Nz();return O8=new G8({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),O8}var X$="0.3.3";Mz().catch(($)=>{J1(`petdex: ${$.message}`),process.exit(1)});async function Mz(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:q}=await Promise.resolve().then(() => (JY(),qY));await q($.slice(1));return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){GY();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))iJ();switch(Q){case"login":await Iz();break;case"logout":await Cz();break;case"whoami":await wz();break;case"submit":await Fz($.slice(1));break;case"install":await Tz($.slice(1));break;case"list":await Az();break;case"hooks":await _z($.slice(1));break;case"desktop":await cz($.slice(1));break;case"init":await bz();break;case"up":await PY();break;case"down":await LY();break;case"toggle":await mz();break;case"update":await RJ($.slice(1));break;case"doctor":await CJ();break;case"telemetry":pz($.slice(1));break;case"version":case"--version":case"-v":console.log(X$);break;default:console.error(j.default.red(`Unknown command: ${Q}`)),GY(),process.exit(1)}}function GY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex"))} ${Q(X$)} ${Q("— Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${j.default.bold("init")} First-run setup — wires hooks across your agents AND wakes the mascot ${j.default.green("(start here)")}`,` ${j.default.bold("login")} Sign in with Clerk OAuth`,` ${j.default.bold("logout")} Clear stored credentials`,` ${j.default.bold("whoami")} Show signed-in user`,` ${j.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${j.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${j.default.bold("install desktop")} Install the petdex-desktop binary (alternative to the .dmg)`,` ${j.default.bold("list")} List approved pets`,` ${j.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${j.default.bold("toggle")} One-shot wake/sleep — flips the mascot on or off depending on current state`,` ${j.default.bold("up")} Force-wake the mascot — enables hooks AND launches petdex-desktop`,` ${j.default.bold("down")} Force-sleep the mascot — disables hooks AND stops petdex-desktop`,` ${j.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${j.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${j.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${j.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex init ${Q("# after dragging Petdex.app from the .dmg → just run this")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex toggle ${Q("# wake or sleep the mascot")}`,` ${Q("$")} petdex doctor ${Q("# diagnose install + agents")}`,` ${Q("$")} petdex update ${Q("# pull the latest release")}`,"",` ${Q("Gallery & docs:")} ${j.default.underline(M1)}`,""].join(`
180
+ `))}async function Iz(){T1(j.default.bgMagenta(j.default.white(" petdex login ")));let $=z1();$.start("Opening your browser to sign in with Clerk");try{let Q=await M8(),{user:V}=await Q.login(),q=zY(V.email,V.username,V.sub)??"unknown";$.stop(`${j.default.green("✓ ")}Signed in as ${j.default.cyan(q)}`),A1(`Try ${j.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(j.default.red("× login failed")),Error(yz(Q.message))}}async function Cz(){await(await M8()).logout(),console.log(`${j.default.green("✓ ")}Signed out`)}async function wz(){try{let Q=await(await M8()).whoami();if(!Q)throw Error("not signed in");let V=[N8(Q.given_name),N8(Q.family_name)].filter(Boolean).join(" ");w1([`${j.default.dim("user: ")}${Q.sub}`,`${j.default.dim("email: ")}${Q.email??"—"}`,`${j.default.dim("name: ")}${V||"—"}`,`${j.default.dim("username:")}${N8(Q.preferred_username)??"—"}`].join(`
181
+ `),"Signed in")}catch{J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}}async function Tz($){let Q=$[0];if(!Q)J1(`Usage: ${j.default.cyan("petdex install <slug|desktop>")}`),process.exit(1);if(Q==="desktop"){let{tag:W}=await GJ();Q6("cli_install_desktop_success",{cli_version:X$,os:process.platform,arch:process.arch,binary_version:W.replace(/^desktop-v/,"")});return}let V=z1();V.start(`Resolving ${Q}`);let q;try{let W=await fetch(`${M1}/api/manifest`);if(!W.ok)throw V.stop(j.default.red("failed")),Error(`manifest fetch ${W.status}`);let z=(await W.json()).pets.find((H)=>H.slug===Q);if(!z)V.stop(j.default.red("not found")),J1(`No pet with slug ${j.default.bold(Q)}. Try ${j.default.cyan("petdex list")} to see what's available.`),process.exit(1);if(!l$(z.spritesheetUrl)||!l$(z.petJsonUrl))V.stop(j.default.red("untrusted asset host")),J1(`Refusing to install ${j.default.bold(Q)}: asset URLs are outside the petdex host allowlist. This row may need to be re-uploaded by an admin.`),process.exit(1);q=z}catch(W){throw V.stop(j.default.red("failed")),W}let Y=X1.join(XY(),".petdex","pets",Q),X=X1.join(XY(),".codex","pets",Q);V.message(`Downloading ${Q}`),await Promise.all([YY(Y,{recursive:!0}),YY(X,{recursive:!0})]);let J=q.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let Z=await fetch(W);if(!Z.ok)throw Error(`download ${W} → ${Z.status} ${Z.statusText}`);return Z.arrayBuffer()},[U,K]=await Promise.all([G(q.petJsonUrl),G(q.spritesheetUrl)]);await Promise.all([L8(X1.join(Y,"pet.json"),Buffer.from(U)),L8(X1.join(Y,`spritesheet.${J}`),Buffer.from(K)),L8(X1.join(X,"pet.json"),Buffer.from(U)),L8(X1.join(X,`spritesheet.${J}`),Buffer.from(K))]),fetch(`${M1}/install/${Q}`,{method:"GET"}).catch(()=>{}),V.stop(`Installed ${j.default.cyan(q.displayName)}`),w1(["Paths:",` ${j.default.dim(`~/.petdex/pets/${Q}`)} (Petdex Desktop)`,` ${j.default.dim(`~/.codex/pets/${Q}`)} (Codex Desktop)`,"","Activate in Petdex Desktop: right-click the mascot.","Activate in Codex Desktop:",` ${j.default.cyan("Settings → Appearance → Pets")} → select ${j.default.bold(q.displayName)}`].join(`
182
+ `),"Next steps")}async function Az(){let $=z1();$.start("Fetching gallery");let Q=await fetch(`${M1}/api/manifest`);if(!Q.ok)throw $.stop(j.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let V=await Q.json();$.stop(`${V.total} pets`);let q=V.pets.map((Y)=>{let X=Y.submittedBy?j.default.dim(` — by ${Y.submittedBy}`):"";return` ${j.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${X}`});console.log(q.join(`
184
183
  `)),console.log(`
185
- ${Z.default.dim("Install with")} ${Z.default.cyan("petdex install <slug>")}
186
- ${Z.default.dim("Browse:")} ${Z.default.underline(M1)}`)}async function mZ($){let V=$.filter((L)=>!L.startsWith("--"))[0];if(!V)J1(`Usage: ${Z.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let q=await I8(),Y;try{let L=await q.getAccessToken();if(!L)J1(`Not signed in. Run ${Z.default.cyan("petdex login")}.`),process.exit(1);Y=L}catch{J1(`Not signed in. Run ${Z.default.cyan("petdex login")}.`),process.exit(1)}let X=M1;try{X=rZ(await q.whoami())}catch{}let J=X1.resolve(V),G=await lJ(J).catch(()=>null);if(!G)J1(`No such file or directory: ${V}`),process.exit(1);A1(Z.default.bgMagenta(Z.default.white(" petdex submit ")));let U=z1();U.start(`Scanning ${J}`);let K=await cZ(J,G.isDirectory());if(U.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:Z.default.red("no pets found")),K.length===0)J1("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let j=$.includes("--force")?new Map:await oZ(K,Y),H=K,z=0;if(j.size>0){let L=K.filter((I)=>j.has($6(I.petIdHint))),T=K.filter((I)=>!j.has($6(I.petIdHint)));T1(L.map((I)=>{let F=j.get($6(I.petIdHint))?.status??"unknown";return`${Z.default.yellow("•")} ${Z.default.bold(I.label)} ${Z.default.dim(`(${F})`)}`}).join(`
187
- `),`${L.length} already submitted by you`);let O=await ZV({message:"How should we handle these duplicates?",options:[{value:"skip",label:"Skip duplicates (recommended)"},{value:"resubmit",label:"Submit all anyway (will create -2 / -3 slugs)"},{value:"cancel",label:"Cancel"}],initialValue:"skip"});if(m1(O)||O==="cancel")J1("Aborted."),process.exit(1);if(O==="skip"){if(H=T,z=L.length,H.length===0){j1(`Nothing new to submit. Track approval at ${Z.default.underline(X)}.`);return}}}if(H.length>1){let L=await X$({message:`Submit ${Z.default.bold(String(H.length))} pet${H.length===1?"":"s"}?`});if(m1(L)||!L)J1("Aborted."),process.exit(1)}let C=0,P=0,M=[];for(let L of H){let T=z1();T.start(`Submitting ${Z.default.cyan(L.label)}`);try{let O=await q.getAccessToken();if(!O)throw Error("session expired");Y=O;let I=await uZ(L,Y);X=nZ(I.profileUrl)??X,T.stop(`${Z.default.green("✓")} ${Z.default.cyan(L.label)} → ${dZ(I)}`),C++}catch(O){let I=O.message;T.stop(`${Z.default.red("×")} ${Z.default.cyan(L.label)} ${Z.default.red(I.slice(0,60))}`),M.push({label:L.label,error:I}),P++}}if(M.length>0)T1(M.map((L)=>`${Z.default.red("•")} ${Z.default.bold(L.label)}: ${L.error}`).join(`
188
- `),"Failures");let B=z>0?`, ${Z.default.yellow(String(z))} skipped`:"";if(j1([`${Z.default.green(String(C))} submitted${B}, ${P>0?Z.default.red(String(P)):Z.default.dim(String(P))} failed.`,`Held submissions stay visible at ${Z.default.underline(X)}.`].join(`
189
- `)),P>0)process.exit(1)}async function cZ($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let X=await pZ($);return X?[X]:[]}if(await P8(X1.join($,"pet.json"))){let X=await cJ($);return X?[X]:[]}let q=await SZ($,{withFileTypes:!0}),Y=[];for(let X of q){if(!X.isDirectory())continue;let J=X1.join($,X.name),G=await cJ(J);if(G)Y.push(G)}return Y}async function cJ($){let Q=X1.join($,"pet.json");if(!await P8(Q))return null;let V=X1.join($,"spritesheet.webp"),q="webp";if(!await P8(V)){let W=X1.join($,"spritesheet.png");if(!await P8(W))return null;V=W,q="png"}let Y=await hQ(Q,"utf8"),X={};try{X=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let J=await hQ(V),G=new bQ.default;G.file("pet.json",Y),G.file(`spritesheet.${q}`,J);let U=Buffer.from(await G.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=X1.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:X,zipBuffer:U,zipFileName:`${K}.zip`,spritesheetBuffer:J,spritesheetExt:q,petIdHint:typeof X.id==="string"?X.id:K}}async function pZ($){let Q=await hQ($),V=await bQ.default.loadAsync(Q),q=V.file("pet.json"),Y=V.file("spritesheet.webp"),X=V.file("spritesheet.png"),J=Y??X,G=Y?"webp":"png";if(!q||!J)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let U=await q.async("string"),K={};try{K=JSON.parse(U)}catch{throw Error("pet.json in zip is not valid JSON")}let W=Buffer.from(await J.async("uint8array")),j=X1.basename($,".zip");return{label:j,source:"zip",petJson:U,petJsonObj:K,zipBuffer:Q,zipFileName:X1.basename($),spritesheetBuffer:W,spritesheetExt:G,petIdHint:typeof K.id==="string"?K.id:j}}async function uZ($,Q){let{width:V,height:q}=aZ($.spritesheetBuffer);if(V===0||q===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${M1}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:$6($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let z=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${z.slice(0,100)}`)}let X=await Y.json(),J=(z)=>{let C=X.files.find((P)=>P.role===z);if(!C)throw Error(`presign response missing ${z}`);return C},G=J("zip"),U=J("sprite"),K=J("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([DQ(G.uploadUrl,$.zipBuffer,"application/zip"),DQ(U.uploadUrl,$.spritesheetBuffer,W),DQ(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let j=await fetch(`${M1}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:G.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:pJ($.petJsonObj.displayName,"Untitled pet"),description:pJ($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:V,spritesheetHeight:q})});if(!j.ok){let z=await j.text().catch(()=>"");throw Error(`register ${j.status} ${z.slice(0,100)}`)}return await j.json()}function dZ($){let Q=Z.default.dim($.slug),V=lZ($.review);if($.review.decision==="approved")return`${Q} ${Z.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${Z.default.red("rejected")}${V?Z.default.dim(` — ${V}`):""}`;return`${Q} ${Z.default.yellow("held for review")}${V?Z.default.dim(` — ${V}`):""}`}function lZ($){let Q=$.reasonCode??"";if(Q.startsWith("duplicate_"))return $.summary??"appears to duplicate an existing pet";if(Q.startsWith("policy_"))return"possible policy issue";if(Q.startsWith("asset_"))return"package file or spritesheet issue";if(Q==="review_timeout")return"automated review timed out";if(Q==="review_error"||Q==="review_failed")return"automated review failed";if($.decision==="rejected")return"high-confidence automated review issue";if($.decision==="hold")return"not confident enough to approve automatically";return null}async function DQ($,Q,V){let q=await fetch($,{method:"PUT",headers:{"Content-Type":V},body:Q});if(!q.ok)throw Error(`R2 PUT ${q.status}`)}async function oZ($,Q){let V=new Map;if($.length===0)return V;try{let q=await fetch(`${M1}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((X)=>({petId:X.petIdHint,slugHint:$6(X.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!q.ok)return V;let Y=await q.json();for(let X of Y.existing??[])if(X&&typeof X.slug==="string")V.set(X.slug,X)}catch{}return V}function iZ($){let Q=$.toLowerCase();if(Q.includes("invalid_client")||Q.includes("client does not exist"))return["Clerk OAuth rejected this CLI build (invalid_client).","This usually means your installed CLI is out of date. Try:"," npm cache clean --force && npx -y petdex@latest login","If it still fails: https://github.com/crafter-station/petdex/issues"].join(`
184
+ ${j.default.dim("Install with")} ${j.default.cyan("petdex install <slug>")}
185
+ ${j.default.dim("Browse:")} ${j.default.underline(M1)}`)}async function Fz($){let V=$.filter((L)=>!L.startsWith("--"))[0];if(!V)J1(`Usage: ${j.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let q=await M8(),Y;try{let L=await q.getAccessToken();if(!L)J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1);Y=L}catch{J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}let X=M1;try{X=Dz(await q.whoami())}catch{}let J=X1.resolve(V),G=await ZY(J).catch(()=>null);if(!G)J1(`No such file or directory: ${V}`),process.exit(1);T1(j.default.bgMagenta(j.default.white(" petdex submit ")));let U=z1();U.start(`Scanning ${J}`);let K=await Rz(J,G.isDirectory());if(U.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:j.default.red("no pets found")),K.length===0)J1("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let Z=$.includes("--force")?new Map:await gz(K,Y),z=K,H=0;if(Z.size>0){let L=K.filter((O)=>Z.has(V6(O.petIdHint))),T=K.filter((O)=>!Z.has(V6(O.petIdHint)));w1(L.map((O)=>{let R=Z.get(V6(O.petIdHint))?.status??"unknown";return`${j.default.yellow("•")} ${j.default.bold(O.label)} ${j.default.dim(`(${R})`)}`}).join(`
186
+ `),`${L.length} already submitted by you`);let B=await MV({message:"How should we handle these duplicates?",options:[{value:"skip",label:"Skip duplicates (recommended)"},{value:"resubmit",label:"Submit all anyway (will create -2 / -3 slugs)"},{value:"cancel",label:"Cancel"}],initialValue:"skip"});if(e1(B)||B==="cancel")J1("Aborted."),process.exit(1);if(B==="skip"){if(z=T,H=L.length,z.length===0){A1(`Nothing new to submit. Track approval at ${j.default.underline(X)}.`);return}}}if(z.length>1){let L=await H6({message:`Submit ${j.default.bold(String(z.length))} pet${z.length===1?"":"s"}?`});if(e1(L)||!L)J1("Aborted."),process.exit(1)}let C=0,P=0,I=[];for(let L of z){let T=z1();T.start(`Submitting ${j.default.cyan(L.label)}`);try{let B=await q.getAccessToken();if(!B)throw Error("session expired");Y=B;let O=await xz(L,Y);X=kz(O.profileUrl)??X,T.stop(`${j.default.green("✓")} ${j.default.cyan(L.label)} → ${Sz(O)}`),C++}catch(B){let O=B.message;T.stop(`${j.default.red("×")} ${j.default.cyan(L.label)} ${j.default.red(O.slice(0,60))}`),I.push({label:L.label,error:O}),P++}}if(I.length>0)w1(I.map((L)=>`${j.default.red("•")} ${j.default.bold(L.label)}: ${L.error}`).join(`
187
+ `),"Failures");let M=H>0?`, ${j.default.yellow(String(H))} skipped`:"";if(A1([`${j.default.green(String(C))} submitted${M}, ${P>0?j.default.red(String(P)):j.default.dim(String(P))} failed.`,`Held submissions stay visible at ${j.default.underline(X)}.`].join(`
188
+ `)),P>0)process.exit(1)}async function Rz($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let X=await vz($);return X?[X]:[]}if(await B8(X1.join($,"pet.json"))){let X=await KY($);return X?[X]:[]}let q=await Lz($,{withFileTypes:!0}),Y=[];for(let X of q){if(!X.isDirectory())continue;let J=X1.join($,X.name),G=await KY(J);if(G)Y.push(G)}return Y}async function KY($){let Q=X1.join($,"pet.json");if(!await B8(Q))return null;let V=X1.join($,"spritesheet.webp"),q="webp";if(!await B8(V)){let W=X1.join($,"spritesheet.png");if(!await B8(W))return null;V=W,q="png"}let Y=await uQ(Q,"utf8"),X={};try{X=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let J=await uQ(V),G=new dQ.default;G.file("pet.json",Y),G.file(`spritesheet.${q}`,J);let U=Buffer.from(await G.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=X1.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:X,zipBuffer:U,zipFileName:`${K}.zip`,spritesheetBuffer:J,spritesheetExt:q,petIdHint:typeof X.id==="string"?X.id:K}}async function vz($){let Q=await uQ($),V=await dQ.default.loadAsync(Q),q=V.file("pet.json"),Y=V.file("spritesheet.webp"),X=V.file("spritesheet.png"),J=Y??X,G=Y?"webp":"png";if(!q||!J)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let U=await q.async("string"),K={};try{K=JSON.parse(U)}catch{throw Error("pet.json in zip is not valid JSON")}let W=Buffer.from(await J.async("uint8array")),Z=X1.basename($,".zip");return{label:Z,source:"zip",petJson:U,petJsonObj:K,zipBuffer:Q,zipFileName:X1.basename($),spritesheetBuffer:W,spritesheetExt:G,petIdHint:typeof K.id==="string"?K.id:Z}}async function xz($,Q){let{width:V,height:q}=hz($.spritesheetBuffer);if(V===0||q===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${M1}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:V6($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let H=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${H.slice(0,100)}`)}let X=await Y.json(),J=(H)=>{let C=X.files.find((P)=>P.role===H);if(!C)throw Error(`presign response missing ${H}`);return C},G=J("zip"),U=J("sprite"),K=J("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([pQ(G.uploadUrl,$.zipBuffer,"application/zip"),pQ(U.uploadUrl,$.spritesheetBuffer,W),pQ(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let Z=await fetch(`${M1}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:G.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:WY($.petJsonObj.displayName,"Untitled pet"),description:WY($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:V,spritesheetHeight:q})});if(!Z.ok){let H=await Z.text().catch(()=>"");throw Error(`register ${Z.status} ${H.slice(0,100)}`)}return await Z.json()}function Sz($){let Q=j.default.dim($.slug),V=Ez($.review);if($.review.decision==="approved")return`${Q} ${j.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${j.default.red("rejected")}${V?j.default.dim(` — ${V}`):""}`;return`${Q} ${j.default.yellow("held for review")}${V?j.default.dim(` — ${V}`):""}`}function Ez($){let Q=$.reasonCode??"";if(Q.startsWith("duplicate_"))return $.summary??"appears to duplicate an existing pet";if(Q.startsWith("policy_"))return"possible policy issue";if(Q.startsWith("asset_"))return"package file or spritesheet issue";if(Q==="review_timeout")return"automated review timed out";if(Q==="review_error"||Q==="review_failed")return"automated review failed";if($.decision==="rejected")return"high-confidence automated review issue";if($.decision==="hold")return"not confident enough to approve automatically";return null}async function pQ($,Q,V){let q=await fetch($,{method:"PUT",headers:{"Content-Type":V},body:Q});if(!q.ok)throw Error(`R2 PUT ${q.status}`)}async function gz($,Q){let V=new Map;if($.length===0)return V;try{let q=await fetch(`${M1}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((X)=>({petId:X.petIdHint,slugHint:V6(X.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!q.ok)return V;let Y=await q.json();for(let X of Y.existing??[])if(X&&typeof X.slug==="string")V.set(X.slug,X)}catch{}return V}function yz($){let Q=$.toLowerCase();if(Q.includes("invalid_client")||Q.includes("client does not exist"))return["Clerk OAuth rejected this CLI build (invalid_client).","This usually means your installed CLI is out of date. Try:"," npm cache clean --force && npx -y petdex@latest login","If it still fails: https://github.com/crafter-station/petdex/issues"].join(`
190
189
  `);if(Q.includes("invalid_grant")||Q.includes("does not match the redirect"))return["OAuth callback was rejected by Clerk (invalid_grant).","Common cause: you closed the browser before approving, or the local","callback server timed out. Try `petdex login` again."].join(`
191
190
  `);if(Q.includes("redirect_uri")&&Q.includes("pre-registered"))return["Clerk OAuth rejected the local callback URL.","The petdex OAuth Application needs http://127.0.0.1 in its allowed","redirect URLs. Please file an issue:"," https://github.com/crafter-station/petdex/issues"].join(`
192
- `);return $}async function P8($){try{return await lJ($),!0}catch{return!1}}function pJ($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function L8($){return typeof $==="string"&&$.trim()?$.trim():null}function oJ(...$){for(let Q of $){let V=L8(Q);if(V)return V}return null}function iJ($){let Q=M1.replace(/\/+$/,""),V=$.startsWith("/")?$:`/${$}`;return`${Q}${V}`}function nZ($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return iJ($)}function rZ($){let Q=oJ($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?iJ(`/u/${encodeURIComponent(Q.toLowerCase())}`):M1}function $6($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function aZ($){if($.length>24&&$[0]===137&&$[1]===80&&$[2]===78&&$[3]===71)return{width:$.readUInt32BE(16),height:$.readUInt32BE(20)};if($.length>30&&$.slice(0,4).toString()==="RIFF"&&$.slice(8,12).toString()==="WEBP"){let Q=$.slice(12,16).toString();if(Q==="VP8X")return{width:(($[24]|$[25]<<8|$[26]<<16)>>>0)+1,height:(($[27]|$[28]<<8|$[29]<<16)>>>0)+1};if(Q==="VP8L"){let V=$[22],q=$[23],Y=$[24];return{width:(($[21]|(V&63)<<8)>>>0)+1,height:((V>>6|q<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let V=23;V<Math.min(60,$.length-7);V++)if($[V]===157&&$[V+1]===1&&$[V+2]===42)return{width:($[V+3]|$[V+4]<<8)&16383,height:($[V+5]|$[V+6]<<8)&16383}}}return{width:0,height:0}}async function sZ($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){uJ();return}switch(Q){case"install":{let{installedAgents:V}=await gQ();if(V.length>0)e$("cli_hooks_install_success",{cli_version:J$,agents:V});break}case"toggle":case"on":case"off":case"status":{tZ(Q);break}case"uninstall":{let V=$.includes("--remove-token");await SJ({removeToken:V});break}default:console.error(Z.default.red(`Unknown hooks command: ${Q}`)),uJ(),process.exit(1)}}function tZ($){let Q;if($==="toggle")Q=HJ();else if($==="on")Q=q$("on");else if($==="off")Q=q$("off");else Q=V$();if(Q==="on")console.log(`${Z.default.green("●")} Petdex hooks are ${Z.default.bold("ENABLED")}`),console.log(Z.default.dim(" agent tool calls will animate the mascot when petdex-desktop is running"));else console.log(`${Z.default.yellow("○")} Petdex hooks are ${Z.default.bold("DISABLED")}`),console.log(Z.default.dim(" agent hooks short-circuit before any network call. Re-enable: petdex hooks on"))}async function eZ(){let{installedAgents:$}=await gQ();if($.length>0)e$("cli_hooks_install_success",{cli_version:J$,agents:$}),console.log(""),console.log(`${Z.default.green("✓")} ${Z.default.bold("All set.")} Open your agent and run ${Z.default.cyan("/petdex")} to wake the mascot.`),console.log(Z.default.dim(` Or from a shell: ${Z.default.cyan("petdex up")} (force-wake) · ${Z.default.cyan("petdex toggle")} (smart wake/sleep)`))}async function nJ(){q$("on"),console.log(`${Z.default.green("●")} Hooks ${Z.default.bold("ENABLED")}`);let $=x1();if($.state==="running"){console.log(`${Z.default.green("●")} Desktop already running (pid ${$.pid})`);return}let Q=await w0();if(Q.ok)console.log(Q.alreadyRunning?`${Z.default.dim("•")} Desktop already running (pid ${Q.pid})`:`${Z.default.green("✓")} Desktop started (pid ${Q.pid})`);else console.log(`${Z.default.yellow("!")} ${Q.reason}`),console.log(Z.default.dim(` Install the binary first: ${Z.default.cyan("petdex install desktop")}`))}async function $H(){let $=V$()==="on",Q=x1().state==="running";if($&&Q)await rJ();else await nJ()}async function rJ(){if(q$("off"),console.log(`${Z.default.yellow("○")} Hooks ${Z.default.bold("DISABLED")}`),x1().state==="stopped"){console.log(`${Z.default.dim("•")} Desktop wasn't running`);return}let Q=await n$();if(Q.ok)console.log(`${Z.default.green("✓")} Desktop stopped (pid ${Q.pid})`);else console.log(`${Z.default.dim("•")} ${Q.reason}`)}function uJ(){let $=Z.default.cyan,Q=Z.default.dim;console.log(["",` ${Z.default.bold(Z.default.magenta("petdex hooks"))}`,"",` ${$("Usage")}`," petdex hooks <command>","",` ${$("Commands")}`,` ${Z.default.bold("install")} Wire petdex into your coding agents`,` ${Z.default.bold("uninstall")} Remove petdex from your agent configs (--remove-token also drops the auth token)`,` ${Z.default.bold("toggle")} Flip the killswitch — disable/enable hooks without restarting agents`,` ${Z.default.bold("on")} Enable hooks (clears the killswitch)`,` ${Z.default.bold("off")} Disable hooks (sets the killswitch — agent tool calls become no-ops)`,` ${Z.default.bold("status")} Show whether hooks are currently enabled`,"",` ${$("Examples")}`,` ${Q("$")} petdex hooks install`,` ${Q("$")} petdex hooks toggle`,` ${Q("$")} petdex hooks status`,""].join(`
193
- `))}async function QH($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){dJ();return}switch(Q){case"start":await KJ(),e$("cli_desktop_start_success",{cli_version:J$});break;case"stop":await WJ();break;case"status":UJ();break;default:console.error(Z.default.red(`Unknown desktop command: ${Q}`)),dJ(),process.exit(1)}}function dJ(){let $=Z.default.cyan,Q=Z.default.dim;console.log(["",` ${Z.default.bold(Z.default.magenta("petdex desktop"))}`,"",` ${$("Usage")}`," petdex desktop <command>","",` ${$("Commands")}`,` ${Z.default.bold("start")} Launch petdex-desktop in the background`,` ${Z.default.bold("stop")} Terminate the running petdex-desktop process`,` ${Z.default.bold("status")} Show whether petdex-desktop is running`,"",` ${$("Examples")}`,` ${Q("$")} petdex desktop start`,` ${Q("$")} petdex desktop status`,` ${Q("$")} petdex desktop stop`,""].join(`
194
- `))}function VH($){let Q=$[0];if(Q==="on"||Q==="off"){let V=Q==="on";if(DJ(V))console.log(V?"Telemetry enabled":"Telemetry disabled");else console.error(Z.default.red(`${Z.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${Q}\` again.`)),process.exit(1)}else if(Q==="status"||!Q){let V=hJ();if(console.log(`Status: ${V.enabled?"enabled":"disabled"}`),V.install_id)console.log(`Install ID: ${V.install_id}`)}else console.error(Z.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}
191
+ `);return $}async function B8($){try{return await ZY($),!0}catch{return!1}}function WY($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function N8($){return typeof $==="string"&&$.trim()?$.trim():null}function zY(...$){for(let Q of $){let V=N8(Q);if(V)return V}return null}function HY($){let Q=M1.replace(/\/+$/,""),V=$.startsWith("/")?$:`/${$}`;return`${Q}${V}`}function kz($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return HY($)}function Dz($){let Q=zY($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?HY(`/u/${encodeURIComponent(Q.toLowerCase())}`):M1}function V6($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function hz($){if($.length>24&&$[0]===137&&$[1]===80&&$[2]===78&&$[3]===71)return{width:$.readUInt32BE(16),height:$.readUInt32BE(20)};if($.length>30&&$.slice(0,4).toString()==="RIFF"&&$.slice(8,12).toString()==="WEBP"){let Q=$.slice(12,16).toString();if(Q==="VP8X")return{width:(($[24]|$[25]<<8|$[26]<<16)>>>0)+1,height:(($[27]|$[28]<<8|$[29]<<16)>>>0)+1};if(Q==="VP8L"){let V=$[22],q=$[23],Y=$[24];return{width:(($[21]|(V&63)<<8)>>>0)+1,height:((V>>6|q<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let V=23;V<Math.min(60,$.length-7);V++)if($[V]===157&&$[V+1]===1&&$[V+2]===42)return{width:($[V+3]|$[V+4]<<8)&16383,height:($[V+5]|$[V+6]<<8)&16383}}}return{width:0,height:0}}async function _z($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){UY();return}switch(Q){case"install":{let{installedAgents:V}=await fQ();if(V.length>0)Q6("cli_hooks_install_success",{cli_version:X$,agents:V}),console.log(""),console.log(`${j.default.green("✓")} ${j.default.bold("All set.")} Open your agent and run ${j.default.cyan("/petdex")} to wake the mascot.`);break}case"toggle":case"on":case"off":case"status":{fz(Q);break}case"uninstall":{let V=$.includes("--remove-token");await mJ({removeToken:V});break}default:console.error(j.default.red(`Unknown hooks command: ${Q}`)),UY(),process.exit(1)}}function fz($){let Q;if($==="toggle")Q=IJ();else if($==="on")Q=J$("on");else if($==="off")Q=J$("off");else Q=q$();if(Q==="on")console.log(`${j.default.green("●")} Petdex hooks are ${j.default.bold("ENABLED")}`),console.log(j.default.dim(" agent tool calls will animate the mascot when petdex-desktop is running"));else console.log(`${j.default.yellow("○")} Petdex hooks are ${j.default.bold("DISABLED")}`),console.log(j.default.dim(" agent hooks short-circuit before any network call. Re-enable: petdex hooks on"))}async function bz(){let{installedAgents:$}=await fQ();if($.length>0)Q6("cli_hooks_install_success",{cli_version:X$,agents:$}),console.log(""),console.log(`${j.default.green("✓")} ${j.default.bold("All set.")} Open your agent and run ${j.default.cyan("/petdex")} to wake the mascot.`),console.log(j.default.dim(` Or from a shell: ${j.default.cyan("petdex up")} (force-wake) · ${j.default.cyan("petdex toggle")} (smart wake/sleep)`))}async function PY(){J$("on"),console.log(`${j.default.green("●")} Hooks ${j.default.bold("ENABLED")}`);let $=s1();if($.state==="running"){console.log(`${j.default.green("●")} Desktop already running (pid ${$.pid})`);return}let Q=await r$();if(Q.ok)console.log(Q.alreadyRunning?`${j.default.dim("•")} Desktop already running (pid ${Q.pid})`:`${j.default.green("✓")} Desktop started (pid ${Q.pid})`);else console.log(`${j.default.yellow("!")} ${Q.reason}`),console.log(j.default.dim(` Install the binary first: ${j.default.cyan("petdex install desktop")}`))}async function mz(){let $=q$()==="on",Q=s1().state==="running";if($&&Q)await LY();else await PY()}async function LY(){if(J$("off"),console.log(`${j.default.yellow("○")} Hooks ${j.default.bold("DISABLED")}`),s1().state==="stopped"){console.log(`${j.default.dim("•")} Desktop wasn't running`);return}let Q=await a$();if(Q.ok)console.log(`${j.default.green("✓")} Desktop stopped (pid ${Q.pid})`);else console.log(`${j.default.dim("•")} ${Q.reason}`)}function UY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex hooks"))}`,"",` ${$("Usage")}`," petdex hooks <command>","",` ${$("Commands")}`,` ${j.default.bold("install")} Wire petdex into your coding agents`,` ${j.default.bold("uninstall")} Remove petdex from your agent configs (--remove-token also drops the auth token)`,` ${j.default.bold("toggle")} Flip the killswitch — disable/enable hooks without restarting agents`,` ${j.default.bold("on")} Enable hooks (clears the killswitch)`,` ${j.default.bold("off")} Disable hooks (sets the killswitch — agent tool calls become no-ops)`,` ${j.default.bold("status")} Show whether hooks are currently enabled`,"",` ${$("Examples")}`,` ${Q("$")} petdex hooks install`,` ${Q("$")} petdex hooks toggle`,` ${Q("$")} petdex hooks status`,""].join(`
192
+ `))}async function cz($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){jY();return}switch(Q){case"start":await LJ(),Q6("cli_desktop_start_success",{cli_version:X$});break;case"stop":await OJ();break;case"status":BJ();break;default:console.error(j.default.red(`Unknown desktop command: ${Q}`)),jY(),process.exit(1)}}function jY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex desktop"))}`,"",` ${$("Usage")}`," petdex desktop <command>","",` ${$("Commands")}`,` ${j.default.bold("start")} Launch petdex-desktop in the background`,` ${j.default.bold("stop")} Terminate the running petdex-desktop process`,` ${j.default.bold("status")} Show whether petdex-desktop is running`,"",` ${$("Examples")}`,` ${Q("$")} petdex desktop start`,` ${Q("$")} petdex desktop status`,` ${Q("$")} petdex desktop stop`,""].join(`
193
+ `))}function pz($){let Q=$[0];if(Q==="on"||Q==="off"){let V=Q==="on";if(lJ(V))console.log(V?"Telemetry enabled":"Telemetry disabled");else console.error(j.default.red(`${j.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${Q}\` again.`)),process.exit(1)}else if(Q==="status"||!Q){let V=oJ();if(console.log(`Status: ${V.enabled?"enabled":"disabled"}`),V.install_id)console.log(`Install ID: ${V.install_id}`)}else console.error(j.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}