petdex 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/petdex.js CHANGED
@@ -1,96 +1,96 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as Bq}from"node:module";var Hq=Object.create;var{getPrototypeOf:Pq,defineProperty:_6,getOwnPropertyNames:Zq}=Object;var zq=Object.prototype.hasOwnProperty;function Lq($){return this[$]}var Mq,Iq,R$=($,Q,J)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?Mq??=new WeakMap:Iq??=new WeakMap,G=Y.get($);if(G)return G}J=$!=null?Hq(Pq($)):{};let X=Q||!$||!$.__esModule?_6(J,"default",{value:$,enumerable:!0}):J;for(let V of Zq($))if(!zq.call(X,V))_6(X,V,{get:Lq.bind($,V),enumerable:!0});if(q)Y.set($,X);return X};var C=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var Nq=($)=>$;function Oq($,Q){this[$]=Nq.bind(null,Q)}var YQ=($,Q)=>{for(var J in Q)_6($,J,{get:Q[J],enumerable:!0,configurable:!0,set:Oq.bind(Q,J)})};var GQ=($,Q)=>()=>($&&(Q=$($=0)),Q);var Y0=Bq(import.meta.url);var d6=C(($F,NQ)=>{var u6={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let J="";if($<0)J+=`\x1B[${-$}D`;else if($>0)J+=`\x1B[${$}C`;if(Q<0)J+=`\x1B[${-Q}A`;else if(Q>0)J+=`\x1B[${Q}B`;return J},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"},hq={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},bq={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 J=0;J<$;J++)Q+=this.line+(J<$-1?u6.up():"");if($)Q+=u6.left;return Q}};NQ.exports={cursor:u6,scroll:hq,erase:bq,beep:"\x07"}});var l1=C((SF,q8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)q8.exports={nextTick:FY};else q8.exports=process;function FY($,Q,J,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,G,X;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,J)});case 4:return process.nextTick(function(){$.call(null,Q,J,q)});default:G=Array(Y-1),X=0;while(X<G.length)G[X++]=arguments[X];return process.nextTick(function(){$.apply(null,G)})}}});var fQ=C((gF,bQ)=>{var HY={}.toString;bQ.exports=Array.isArray||function($){return HY.call($)=="[object Array]"}});var o1=C((Y8,mQ)=>{var b$=Y0("buffer"),x0=b$.Buffer;function _Q($,Q){for(var J in $)Q[J]=$[J]}if(x0.from&&x0.alloc&&x0.allocUnsafe&&x0.allocUnsafeSlow)mQ.exports=b$;else _Q(b$,Y8),Y8.Buffer=H1;function H1($,Q,J){return x0($,Q,J)}_Q(x0,H1);H1.from=function($,Q,J){if(typeof $==="number")throw TypeError("Argument must not be a number");return x0($,Q,J)};H1.alloc=function($,Q,J){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=x0($);if(Q!==void 0)if(typeof J==="string")q.fill(Q,J);else q.fill(Q);else q.fill(0);return q};H1.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return x0($)};H1.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return b$.SlowBuffer($)}});var P1=C((RY)=>{function PY($){if(Array.isArray)return Array.isArray($);return f$($)==="[object Array]"}RY.isArray=PY;function ZY($){return typeof $==="boolean"}RY.isBoolean=ZY;function zY($){return $===null}RY.isNull=zY;function LY($){return $==null}RY.isNullOrUndefined=LY;function MY($){return typeof $==="number"}RY.isNumber=MY;function IY($){return typeof $==="string"}RY.isString=IY;function NY($){return typeof $==="symbol"}RY.isSymbol=NY;function OY($){return $===void 0}RY.isUndefined=OY;function BY($){return f$($)==="[object RegExp]"}RY.isRegExp=BY;function wY($){return typeof $==="object"&&$!==null}RY.isObject=wY;function DY($){return f$($)==="[object Date]"}RY.isDate=DY;function vY($){return f$($)==="[object Error]"||$ instanceof Error}RY.isError=vY;function CY($){return typeof $==="function"}RY.isFunction=CY;function AY($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}RY.isPrimitive=AY;RY.isBuffer=Y0("buffer").Buffer.isBuffer;function f$($){return Object.prototype.toString.call($)}});var cQ=C((yF,G8)=>{if(typeof Object.create==="function")G8.exports=function(Q,J){if(J)Q.super_=J,Q.prototype=Object.create(J.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else G8.exports=function(Q,J){if(J){Q.super_=J;var q=function(){};q.prototype=J.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var Z1=C((hF,X8)=>{try{if(_$=Y0("util"),typeof _$.inherits!=="function")throw"";X8.exports=_$.inherits}catch($){X8.exports=cQ()}var _$});var uQ=C((bF,V8)=>{function dY($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var pQ=o1().Buffer,i1=Y0("util");function lY($,Q,J){$.copy(Q,J)}V8.exports=function(){function $(){dY(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(J){var q={data:J,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(J){var q={data:J,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var J=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,J},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(J){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=J+q.data;return Y},$.prototype.concat=function(J){if(this.length===0)return pQ.alloc(0);var q=pQ.allocUnsafe(J>>>0),Y=this.head,G=0;while(Y)lY(Y.data,q,G),G+=Y.data.length,Y=Y.next;return q},$}();if(i1&&i1.inspect&&i1.inspect.custom)V8.exports.prototype[i1.inspect.custom]=function(){var $=i1.inspect({length:this.length});return this.constructor.name+" "+$}});var K8=C((fF,dQ)=>{var m$=l1();function oY($,Q){var J=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)m$.nextTick(c$,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,m$.nextTick(c$,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(G){if(!Q&&G){if(!J._writableState)m$.nextTick(c$,J,G);else if(!J._writableState.errorEmitted)J._writableState.errorEmitted=!0,m$.nextTick(c$,J,G)}else if(Q)Q(G)}),this}function iY(){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 c$($,Q){$.emit("error",Q)}dQ.exports={destroy:oY,undestroy:iY}});var oQ=C((_F,lQ)=>{lQ.exports=Y0("util").deprecate});var U8=C((mF,$9)=>{var t0=l1();$9.exports=u;function nQ($){var Q=this;this.next=null,this.entry=null,this.finish=function(){j3(Q,$)}}var nY=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t0.nextTick,z1;u.WritableState=r1;var rQ=Object.create(P1());rQ.inherits=Z1();var rY={deprecate:oQ()},aQ=Y0("stream"),u$=o1().Buffer,aY=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function sY($){return u$.from($)}function tY($){return u$.isBuffer($)||$ instanceof aY}var sQ=K8();rQ.inherits(u,aQ);function eY(){}function r1($,Q){z1=z1||e0(),$=$||{};var J=Q instanceof z1;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;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 X=$.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(V){X3(Q,V)},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 nQ(this)}r1.prototype.getBuffer=function(){var Q=this.bufferedRequest,J=[];while(Q)J.push(Q),Q=Q.next;return J};(function(){try{Object.defineProperty(r1.prototype,"buffer",{get:rY.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var p$;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")p$=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function($){if(p$.call(this,$))return!0;if(this!==u)return!1;return $&&$._writableState instanceof r1}});else p$=function($){return $ instanceof this};function u($){if(z1=z1||e0(),!p$.call(u,this)&&!(this instanceof z1))return new u($);if(this._writableState=new r1($,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}aQ.call(this)}u.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function $3($,Q){var J=Error("write after end");$.emit("error",J),t0.nextTick(Q,J)}function Q3($,Q,J,q){var Y=!0,G=!1;if(J===null)G=TypeError("May not write null values to stream");else if(typeof J!=="string"&&J!==void 0&&!Q.objectMode)G=TypeError("Invalid non-string/buffer chunk");if(G)$.emit("error",G),t0.nextTick(q,G),Y=!1;return Y}u.prototype.write=function($,Q,J){var q=this._writableState,Y=!1,G=!q.objectMode&&tY($);if(G&&!u$.isBuffer($))$=sY($);if(typeof Q==="function")J=Q,Q=null;if(G)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof J!=="function")J=eY;if(q.ended)$3(this,J);else if(G||Q3(this,q,$,J))q.pendingcb++,Y=q3(this,q,G,$,Q,J);return Y};u.prototype.cork=function(){var $=this._writableState;$.corked++};u.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)tQ(this,$)}};u.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 J3($,Q,J){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=u$.from(Q,J);return Q}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function q3($,Q,J,q,Y,G){if(!J){var X=J3(Q,q,Y);if(q!==X)J=!0,Y="buffer",q=X}var V=Q.objectMode?1:q.length;Q.length+=V;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:J,callback:G,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else W8($,Q,!1,V,q,Y,G);return U}function W8($,Q,J,q,Y,G,X){if(Q.writelen=q,Q.writecb=X,Q.writing=!0,Q.sync=!0,J)$._writev(Y,Q.onwrite);else $._write(Y,G,Q.onwrite);Q.sync=!1}function Y3($,Q,J,q,Y){if(--Q.pendingcb,J)t0.nextTick(Y,q),t0.nextTick(n1,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),n1($,Q)}function G3($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function X3($,Q){var J=$._writableState,q=J.sync,Y=J.writecb;if(G3(J),Q)Y3($,J,q,Q,Y);else{var G=eQ(J);if(!G&&!J.corked&&!J.bufferProcessing&&J.bufferedRequest)tQ($,J);if(q)nY(iQ,$,J,G,Y);else iQ($,J,G,Y)}}function iQ($,Q,J,q){if(!J)V3($,Q);Q.pendingcb--,q(),n1($,Q)}function V3($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function tQ($,Q){Q.bufferProcessing=!0;var J=Q.bufferedRequest;if($._writev&&J&&J.next){var q=Q.bufferedRequestCount,Y=Array(q),G=Q.corkedRequestsFree;G.entry=J;var X=0,V=!0;while(J){if(Y[X]=J,!J.isBuf)V=!1;J=J.next,X+=1}if(Y.allBuffers=V,W8($,Q,!0,Q.length,Y,"",G.finish),Q.pendingcb++,Q.lastBufferedRequest=null,G.next)Q.corkedRequestsFree=G.next,G.next=null;else Q.corkedRequestsFree=new nQ(Q);Q.bufferedRequestCount=0}else{while(J){var{chunk:U,encoding:K,callback:W}=J,F=Q.objectMode?1:U.length;if(W8($,Q,!1,F,U,K,W),J=J.next,Q.bufferedRequestCount--,Q.writing)break}if(J===null)Q.lastBufferedRequest=null}Q.bufferedRequest=J,Q.bufferProcessing=!1}u.prototype._write=function($,Q,J){J(Error("_write() is not implemented"))};u.prototype._writev=null;u.prototype.end=function($,Q,J){var q=this._writableState;if(typeof $==="function")J=$,$=null,Q=null;else if(typeof Q==="function")J=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)U3(this,q,J)};function eQ($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function K3($,Q){$._final(function(J){if(Q.pendingcb--,J)$.emit("error",J);Q.prefinished=!0,$.emit("prefinish"),n1($,Q)})}function W3($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,t0.nextTick(K3,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function n1($,Q){var J=eQ(Q);if(J){if(W3($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return J}function U3($,Q,J){if(Q.ending=!0,n1($,Q),J)if(Q.finished)t0.nextTick(J);else $.once("finish",J);Q.ended=!0,$.writable=!1}function j3($,Q,J){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(J),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(u.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});u.prototype.destroy=sQ.destroy;u.prototype._undestroy=sQ.undestroy;u.prototype._destroy=function($,Q){this.end(),Q($)}});var e0=C((cF,Y9)=>{var Q9=l1(),F3=Object.keys||function($){var Q=[];for(var J in $)Q.push(J);return Q};Y9.exports=S0;var J9=Object.create(P1());J9.inherits=Z1();var q9=F8(),j8=U8();J9.inherits(S0,q9);{d$=F3(j8.prototype);for(a1=0;a1<d$.length;a1++)if(s1=d$[a1],!S0.prototype[s1])S0.prototype[s1]=j8.prototype[s1]}var d$,s1,a1;function S0($){if(!(this instanceof S0))return new S0($);if(q9.call(this,$),j8.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",H3)}Object.defineProperty(S0.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function H3(){if(this.allowHalfOpen||this._writableState.ended)return;Q9.nextTick(P3,this)}function P3($){$.end()}Object.defineProperty(S0.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=$}});S0.prototype._destroy=function($,Q){this.push(null),this.end(),Q9.nextTick(Q,$)}});var Z8=C((R3)=>{var P8=o1().Buffer,G9=P8.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 Z3($){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 z3($){var Q=Z3($);if(typeof Q!=="string"&&(P8.isEncoding===G9||!G9($)))throw Error("Unknown encoding: "+$);return Q||$}R3.StringDecoder=t1;function t1($){this.encoding=z3($);var Q;switch(this.encoding){case"utf16le":this.text=B3,this.end=w3,Q=4;break;case"utf8":this.fillLast=I3,Q=4;break;case"base64":this.text=D3,this.end=v3,Q=3;break;default:this.write=C3,this.end=A3;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=P8.allocUnsafe(Q)}t1.prototype.write=function($){if($.length===0)return"";var Q,J;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;if(J<$.length)return Q?Q+this.text($,J):this.text($,J);return Q||""};t1.prototype.end=O3;t1.prototype.text=N3;t1.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 H8($){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 L3($,Q,J){var q=Q.length-1;if(q<J)return 0;var Y=H8(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<J||Y===-2)return 0;if(Y=H8(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<J||Y===-2)return 0;if(Y=H8(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function M3($,Q,J){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 I3($){var Q=this.lastTotal-this.lastNeed,J=M3(this,$,Q);if(J!==void 0)return J;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 N3($,Q){var J=L3(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=J;var q=$.length-(J-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function O3($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function B3($,Q){if(($.length-Q)%2===0){var J=$.toString("utf16le",Q);if(J){var q=J.charCodeAt(J.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function w3($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,J)}return Q}function D3($,Q){var J=($.length-Q)%3;if(J===0)return $.toString("base64",Q);if(this.lastNeed=3-J,this.lastTotal=3,J===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-J)}function v3($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function C3($){return $.toString(this.encoding)}function A3($){return $&&$.length?this.write($):""}});var F8=C((dF,L9)=>{var M1=l1();L9.exports=f;var E3=fQ(),e1;f.ReadableState=F9;var uF=Y0("events").EventEmitter,W9=function($,Q){return $.listeners(Q).length},N8=Y0("stream"),$$=o1().Buffer,x3=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function S3($){return $$.from($)}function g3($){return $$.isBuffer($)||$ instanceof x3}var U9=Object.create(P1());U9.inherits=Z1();var z8=Y0("util"),g=void 0;if(z8&&z8.debuglog)g=z8.debuglog("stream");else g=function(){};var T3=uQ(),j9=K8(),L1;U9.inherits(f,N8);var L8=["error","close","destroy","pause","resume"];function y3($,Q,J){if(typeof $.prependListener==="function")return $.prependListener(Q,J);if(!$._events||!$._events[Q])$.on(Q,J);else if(E3($._events[Q]))$._events[Q].unshift(J);else $._events[Q]=[J,$._events[Q]]}function F9($,Q){e1=e1||e0(),$=$||{};var J=Q instanceof e1;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new T3,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(!L1)L1=Z8().StringDecoder;this.decoder=new L1($.encoding),this.encoding=$.encoding}}function f($){if(e1=e1||e0(),!(this instanceof f))return new f($);if(this._readableState=new F9($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}N8.call(this)}Object.defineProperty(f.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});f.prototype.destroy=j9.destroy;f.prototype._undestroy=j9.undestroy;f.prototype._destroy=function($,Q){this.push(null),Q($)};f.prototype.push=function($,Q){var J=this._readableState,q;if(!J.objectMode){if(typeof $==="string"){if(Q=Q||J.defaultEncoding,Q!==J.encoding)$=$$.from($,Q),Q="";q=!0}}else q=!0;return H9(this,$,Q,!1,q)};f.prototype.unshift=function($){return H9(this,$,null,!0,!1)};function H9($,Q,J,q,Y){var G=$._readableState;if(Q===null)G.reading=!1,_3($,G);else{var X;if(!Y)X=h3(G,Q);if(X)$.emit("error",X);else if(G.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!G.objectMode&&Object.getPrototypeOf(Q)!==$$.prototype)Q=S3(Q);if(q)if(G.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else M8($,G,Q,!0);else if(G.ended)$.emit("error",Error("stream.push() after EOF"));else if(G.reading=!1,G.decoder&&!J)if(Q=G.decoder.write(Q),G.objectMode||Q.length!==0)M8($,G,Q,!1);else P9($,G);else M8($,G,Q,!1)}else if(!q)G.reading=!1}return b3(G)}function M8($,Q,J,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",J),$.read(0);else{if(Q.length+=Q.objectMode?1:J.length,q)Q.buffer.unshift(J);else Q.buffer.push(J);if(Q.needReadable)l$($)}P9($,Q)}function h3($,Q){var J;if(!g3(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)J=TypeError("Invalid non-string/buffer chunk");return J}function b3($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}f.prototype.isPaused=function(){return this._readableState.flowing===!1};f.prototype.setEncoding=function($){if(!L1)L1=Z8().StringDecoder;return this._readableState.decoder=new L1($),this._readableState.encoding=$,this};var X9=8388608;function f3($){if($>=X9)$=X9;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function V9($,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=f3($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}f.prototype.read=function($){g("read",$),$=parseInt($,10);var Q=this._readableState,J=$;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)I8(this);else l$(this);return null}if($=V9($,Q),$===0&&Q.ended){if(Q.length===0)I8(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)$=V9(J,Q)}var Y;if($>0)Y=Z9($,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(J!==$&&Q.ended)I8(this)}if(Y!==null)this.emit("data",Y);return Y};function _3($,Q){if(Q.ended)return;if(Q.decoder){var J=Q.decoder.end();if(J&&J.length)Q.buffer.push(J),Q.length+=Q.objectMode?1:J.length}Q.ended=!0,l$($)}function l$($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(g("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)M1.nextTick(K9,$);else K9($)}function K9($){g("emit readable"),$.emit("readable"),O8($)}function P9($,Q){if(!Q.readingMore)Q.readingMore=!0,M1.nextTick(m3,$,Q)}function m3($,Q){var J=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(g("maybeReadMore read 0"),$.read(0),J===Q.length)break;else J=Q.length;Q.readingMore=!1}f.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};f.prototype.pipe=function($,Q){var J=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,G=Y?V:O;if(q.endEmitted)M1.nextTick(G);else J.once("end",G);$.on("unpipe",X);function X(I,P){if(g("onunpipe"),I===J){if(P&&P.hasUnpiped===!1)P.hasUnpiped=!0,W()}}function V(){g("onend"),$.end()}var U=c3(J);$.on("drain",U);var K=!1;function W(){if(g("cleanup"),$.removeListener("close",Z),$.removeListener("finish",L),$.removeListener("drain",U),$.removeListener("error",H),$.removeListener("unpipe",X),J.removeListener("end",V),J.removeListener("end",O),J.removeListener("data",j),K=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var F=!1;J.on("data",j);function j(I){g("ondata"),F=!1;var P=$.write(I);if(P===!1&&!F){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&z9(q.pipes,$)!==-1)&&!K)g("false write response, pause",q.awaitDrain),q.awaitDrain++,F=!0;J.pause()}}function H(I){if(g("onerror",I),O(),$.removeListener("error",H),W9($,"error")===0)$.emit("error",I)}y3($,"error",H);function Z(){$.removeListener("finish",L),O()}$.once("close",Z);function L(){g("onfinish"),$.removeListener("close",Z),O()}$.once("finish",L);function O(){g("unpipe"),J.unpipe($)}if($.emit("pipe",J),!q.flowing)g("pipe resume"),J.resume();return $};function c3($){return function(){var Q=$._readableState;if(g("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&W9($,"data"))Q.flowing=!0,O8($)}}f.prototype.unpipe=function($){var Q=this._readableState,J={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,J);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var G=0;G<Y;G++)q[G].emit("unpipe",this,{hasUnpiped:!1});return this}var X=z9(Q.pipes,$);if(X===-1)return this;if(Q.pipes.splice(X,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,J),this};f.prototype.on=function($,Q){var J=N8.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)M1.nextTick(p3,this);else if(q.length)l$(this)}}return J};f.prototype.addListener=f.prototype.on;function p3($){g("readable nexttick read 0"),$.read(0)}f.prototype.resume=function(){var $=this._readableState;if(!$.flowing)g("resume"),$.flowing=!0,u3(this,$);return this};function u3($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,M1.nextTick(d3,$,Q)}function d3($,Q){if(!Q.reading)g("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),O8($),Q.flowing&&!Q.reading)$.read(0)}f.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 O8($){var Q=$._readableState;g("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}f.prototype.wrap=function($){var Q=this,J=this._readableState,q=!1;$.on("end",function(){if(g("wrapped end"),J.decoder&&!J.ended){var X=J.decoder.end();if(X&&X.length)Q.push(X)}Q.push(null)}),$.on("data",function(X){if(g("wrapped data"),J.decoder)X=J.decoder.write(X);if(J.objectMode&&(X===null||X===void 0))return;else if(!J.objectMode&&(!X||!X.length))return;var V=Q.push(X);if(!V)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(X){return function(){return $[X].apply($,arguments)}}(Y);for(var G=0;G<L8.length;G++)$.on(L8[G],this.emit.bind(this,L8[G]));return this._read=function(X){if(g("wrapped _read",X),q)q=!1,$.resume()},this};Object.defineProperty(f.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});f._fromList=Z9;function Z9($,Q){if(Q.length===0)return null;var J;if(Q.objectMode)J=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)J=Q.buffer.join("");else if(Q.buffer.length===1)J=Q.buffer.head.data;else J=Q.buffer.concat(Q.length);Q.buffer.clear()}else J=l3($,Q.buffer,Q.decoder);return J}function l3($,Q,J){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=J?o3($,Q):i3($,Q);return q}function o3($,Q){var J=Q.head,q=1,Y=J.data;$-=Y.length;while(J=J.next){var G=J.data,X=$>G.length?G.length:$;if(X===G.length)Y+=G;else Y+=G.slice(0,$);if($-=X,$===0){if(X===G.length)if(++q,J.next)Q.head=J.next;else Q.head=Q.tail=null;else Q.head=J,J.data=G.slice(X);break}++q}return Q.length-=q,Y}function i3($,Q){var J=$$.allocUnsafe($),q=Q.head,Y=1;q.data.copy(J),$-=q.data.length;while(q=q.next){var G=q.data,X=$>G.length?G.length:$;if(G.copy(J,J.length-$,0,X),$-=X,$===0){if(X===G.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=G.slice(X);break}++Y}return Q.length-=Y,J}function I8($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,M1.nextTick(n3,Q,$)}function n3($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function z9($,Q){for(var J=0,q=$.length;J<q;J++)if($[J]===Q)return J;return-1}});var B8=C((lF,N9)=>{N9.exports=g0;var o$=e0(),I9=Object.create(P1());I9.inherits=Z1();I9.inherits(g0,o$);function r3($,Q){var J=this._transformState;J.transforming=!1;var q=J.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(J.writechunk=null,J.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 g0($){if(!(this instanceof g0))return new g0($);if(o$.call(this,$),this._transformState={afterTransform:r3.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",a3)}function a3(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,J){M9($,Q,J)});else M9(this,null,null)}g0.prototype.push=function($,Q){return this._transformState.needTransform=!1,o$.prototype.push.call(this,$,Q)};g0.prototype._transform=function($,Q,J){throw Error("_transform() is not implemented")};g0.prototype._write=function($,Q,J){var q=this._transformState;if(q.writecb=J,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};g0.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};g0.prototype._destroy=function($,Q){var J=this;o$.prototype._destroy.call(this,$,function(q){Q(q),J.emit("close")})};function M9($,Q,J){if(Q)return $.emit("error",Q);if(J!=null)$.push(J);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 D9=C((oF,w9)=>{w9.exports=Q$;var O9=B8(),B9=Object.create(P1());B9.inherits=Z1();B9.inherits(Q$,O9);function Q$($){if(!(this instanceof Q$))return new Q$($);O9.call(this,$)}Q$.prototype._transform=function($,Q,J){J(null,$)}});var w8=C((r,i$)=>{var B0=Y0("stream");if(process.env.READABLE_STREAM==="disable"&&B0)i$.exports=B0,r=i$.exports=B0.Readable,r.Readable=B0.Readable,r.Writable=B0.Writable,r.Duplex=B0.Duplex,r.Transform=B0.Transform,r.PassThrough=B0.PassThrough,r.Stream=B0;else r=i$.exports=F8(),r.Stream=B0||r,r.Readable=r,r.Writable=U8(),r.Duplex=e0(),r.Transform=B8(),r.PassThrough=D9()});var T0=C((t3)=>{t3.base64=!0;t3.array=!0;t3.string=!0;t3.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";t3.nodebuffer=typeof Buffer<"u";t3.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")t3.blob=!1;else{n$=new ArrayBuffer(0);try{t3.blob=new Blob([n$],{type:"application/zip"}).size===0}catch($){try{v8=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,r$=new v8,r$.append(n$),t3.blob=r$.getBlob("application/zip").size===0}catch(Q){t3.blob=!1}}}var n$,v8,r$;try{t3.nodestream=!!w8().Readable}catch($){t3.nodestream=!1}});var C8=C((VG)=>{var GG=m(),XG=T0(),w0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";VG.encode=function($){var Q=[],J,q,Y,G,X,V,U,K=0,W=$.length,F=W,j=GG.getTypeOf($)!=="string";while(K<$.length){if(F=W-K,!j)J=$.charCodeAt(K++),q=K<W?$.charCodeAt(K++):0,Y=K<W?$.charCodeAt(K++):0;else J=$[K++],q=K<W?$[K++]:0,Y=K<W?$[K++]:0;G=J>>2,X=(J&3)<<4|q>>4,V=F>1?(q&15)<<2|Y>>6:64,U=F>2?Y&63:64,Q.push(w0.charAt(G)+w0.charAt(X)+w0.charAt(V)+w0.charAt(U))}return Q.join("")};VG.decode=function($){var Q,J,q,Y,G,X,V,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 F=$.length*3/4;if($.charAt($.length-1)===w0.charAt(64))F--;if($.charAt($.length-2)===w0.charAt(64))F--;if(F%1!==0)throw Error("Invalid base64 input, bad content length.");var j;if(XG.uint8array)j=new Uint8Array(F|0);else j=Array(F|0);while(U<$.length){if(Y=w0.indexOf($.charAt(U++)),G=w0.indexOf($.charAt(U++)),X=w0.indexOf($.charAt(U++)),V=w0.indexOf($.charAt(U++)),Q=Y<<2|G>>4,J=(G&15)<<4|X>>2,q=(X&3)<<6|V,j[K++]=Q,X!==64)j[K++]=J;if(V!==64)j[K++]=q}return j}});var J$=C((rF,v9)=>{v9.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 R9=C((sF,A9)=>{var aF=global.MutationObserver||global.WebKitMutationObserver,C9;C9=function(){process.nextTick(PG)};var UG,jG,FG,HG,A8,q$=[];function PG(){A8=!0;var $,Q,J=q$.length;while(J){Q=q$,q$=[],$=-1;while(++$<J)Q[$]();J=q$.length}A8=!1}A9.exports=ZG;function ZG($){if(q$.push($)===1&&!A8)C9()}});var y9=C((tF,T9)=>{var k9=R9();function N1(){}var t={},E9=["REJECTED"],R8=["FULFILLED"],x9=["PENDING"];I1=["UNHANDLED"];var I1;T9.exports=m0;function m0($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=x9,this.queue=[],this.outcome=void 0,this.handled=I1,$!==N1)S9(this,$)}m0.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(J,q);function J(Y){function G(){return Y}return Q.resolve($()).then(G)}function q(Y){function G(){throw Y}return Q.resolve($()).then(G)}};m0.prototype.catch=function($){return this.then(null,$)};m0.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===R8||typeof Q!=="function"&&this.state===E9)return this;var J=new this.constructor(N1);if(this.handled===I1)this.handled=null;if(this.state!==x9){var q=this.state===R8?$:Q;k8(J,q,this.outcome)}else this.queue.push(new Y$(J,$,Q));return J};function Y$($,Q,J){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof J==="function")this.onRejected=J,this.callRejected=this.otherCallRejected}Y$.prototype.callFulfilled=function($){t.resolve(this.promise,$)};Y$.prototype.otherCallFulfilled=function($){k8(this.promise,this.onFulfilled,$)};Y$.prototype.callRejected=function($){t.reject(this.promise,$)};Y$.prototype.otherCallRejected=function($){k8(this.promise,this.onRejected,$)};function k8($,Q,J){k9(function(){var q;try{q=Q(J)}catch(Y){return t.reject($,Y)}if(q===$)t.reject($,TypeError("Cannot resolve promise with itself"));else t.resolve($,q)})}t.resolve=function($,Q){var J=g9(zG,Q);if(J.status==="error")return t.reject($,J.value);var q=J.value;if(q)S9($,q);else{$.state=R8,$.outcome=Q;var Y=-1,G=$.queue.length;while(++Y<G)$.queue[Y].callFulfilled(Q)}return $};t.reject=function($,Q){if($.state=E9,$.outcome=Q,$.handled===I1)k9(function(){if($.handled===I1)process.emit("unhandledRejection",Q,$)});var J=-1,q=$.queue.length;while(++J<q)$.queue[J].callRejected(Q);return $};function zG($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function S9($,Q){var J=!1;function q(V){if(J)return;J=!0,t.reject($,V)}function Y(V){if(J)return;J=!0,t.resolve($,V)}function G(){Q(Y,q)}var X=g9(G);if(X.status==="error")q(X.value)}function g9($,Q){var J={};try{J.value=$(Q),J.status="success"}catch(q){J.status="error",J.value=q}return J}m0.resolve=LG;function LG($){if($ instanceof this)return $;return t.resolve(new this(N1),$)}m0.reject=MG;function MG($){var Q=new this(N1);return t.reject(Q,$)}m0.all=IG;function IG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=Array(J),G=0,X=-1,V=new this(N1);while(++X<J)U($[X],X);return V;function U(K,W){Q.resolve(K).then(F,function(j){if(!q)q=!0,t.reject(V,j)});function F(j){if(Y[W]=j,++G===J&&!q)q=!0,t.resolve(V,Y)}}}m0.race=NG;function NG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=-1,G=new this(N1);while(++Y<J)X($[Y]);return G;function X(V){Q.resolve(V).then(function(U){if(!q)q=!0,t.resolve(G,U)},function(U){if(!q)q=!0,t.reject(G,U)})}}});var O1=C((eF,h9)=>{var E8=null;if(typeof Promise<"u")E8=Promise;else E8=y9();h9.exports={Promise:E8}});var f9=C((b9)=>{(function($,Q){if($.setImmediate)return;var J=1,q={},Y=!1,G=$.document,X;function V(P){if(typeof P!=="function")P=Function(""+P);var B=Array(arguments.length-1);for(var M=0;M<B.length;M++)B[M]=arguments[M+1];var z={callback:P,args:B};return q[J]=z,X(J),J++}function U(P){delete q[P]}function K(P){var{callback:B,args:M}=P;switch(M.length){case 0:B();break;case 1:B(M[0]);break;case 2:B(M[0],M[1]);break;case 3:B(M[0],M[1],M[2]);break;default:B.apply(Q,M);break}}function W(P){if(Y)setTimeout(W,0,P);else{var B=q[P];if(B){Y=!0;try{K(B)}finally{U(P),Y=!1}}}}function F(){X=function(P){process.nextTick(function(){W(P)})}}function j(){if($.postMessage&&!$.importScripts){var P=!0,B=$.onmessage;return $.onmessage=function(){P=!1},$.postMessage("","*"),$.onmessage=B,P}}function H(){var P="setImmediate$"+Math.random()+"$",B=function(M){if(M.source===$&&typeof M.data==="string"&&M.data.indexOf(P)===0)W(+M.data.slice(P.length))};if($.addEventListener)$.addEventListener("message",B,!1);else $.attachEvent("onmessage",B);X=function(M){$.postMessage(P+M,"*")}}function Z(){var P=new MessageChannel;P.port1.onmessage=function(B){var M=B.data;W(M)},X=function(B){P.port2.postMessage(B)}}function L(){var P=G.documentElement;X=function(B){var M=G.createElement("script");M.onreadystatechange=function(){W(B),M.onreadystatechange=null,P.removeChild(M),M=null},P.appendChild(M)}}function O(){X=function(P){setTimeout(W,0,P)}}var I=Object.getPrototypeOf&&Object.getPrototypeOf($);if(I=I&&I.setTimeout?I:$,{}.toString.call($.process)==="[object process]")F();else if(j())H();else if($.MessageChannel)Z();else if(G&&"onreadystatechange"in G.createElement("script"))L();else O();I.setImmediate=V,I.clearImmediate=U})(typeof self>"u"?typeof global>"u"?b9:global:self)});var m=C((wG)=>{var c0=T0(),OG=C8(),B1=J$(),x8=O1();f9();function BG($){var Q=null;if(c0.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return s$($,Q)}wG.newBlob=function($,Q){wG.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var J=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new J;return q.append($),q.getBlob(Q)}catch(G){throw Error("Bug : can't construct the Blob.")}}};function G$($){return $}function s$($,Q){for(var J=0;J<$.length;++J)Q[J]=$.charCodeAt(J)&255;return Q}var a$={stringifyByChunk:function($,Q,J){var q=[],Y=0,G=$.length;if(G<=J)return String.fromCharCode.apply(null,$);while(Y<G){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+J,G))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+J,G))));Y+=J}return q.join("")},stringifyByChar:function($){var Q="";for(var J=0;J<$.length;J++)Q+=String.fromCharCode($[J]);return Q},applyCanBeUsed:{uint8array:function(){try{return c0.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return c0.nodebuffer&&String.fromCharCode.apply(null,B1.allocBuffer(1)).length===1}catch($){return!1}}()}};function X$($){var Q=65536,J=wG.getTypeOf($),q=!0;if(J==="uint8array")q=a$.applyCanBeUsed.uint8array;else if(J==="nodebuffer")q=a$.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return a$.stringifyByChunk($,J,Q)}catch(Y){Q=Math.floor(Q/2)}return a$.stringifyByChar($)}wG.applyFromCharCode=X$;function t$($,Q){for(var J=0;J<$.length;J++)Q[J]=$[J];return Q}var p0={};p0.string={string:G$,array:function($){return s$($,Array($.length))},arraybuffer:function($){return p0.string.uint8array($).buffer},uint8array:function($){return s$($,new Uint8Array($.length))},nodebuffer:function($){return s$($,B1.allocBuffer($.length))}};p0.array={string:X$,array:G$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return B1.newBufferFrom($)}};p0.arraybuffer={string:function($){return X$(new Uint8Array($))},array:function($){return t$(new Uint8Array($),Array($.byteLength))},arraybuffer:G$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return B1.newBufferFrom(new Uint8Array($))}};p0.uint8array={string:X$,array:function($){return t$($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:G$,nodebuffer:function($){return B1.newBufferFrom($)}};p0.nodebuffer={string:X$,array:function($){return t$($,Array($.length))},arraybuffer:function($){return p0.nodebuffer.uint8array($).buffer},uint8array:function($){return t$($,new Uint8Array($.length))},nodebuffer:G$};wG.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;wG.checkSupport($);var J=wG.getTypeOf(Q),q=p0[J][$](Q);return q};wG.resolve=function($){var Q=$.split("/"),J=[];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==="..")J.pop();else J.push(Y)}return J.join("/")};wG.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(c0.nodebuffer&&B1.isBuffer($))return"nodebuffer";if(c0.uint8array&&$ instanceof Uint8Array)return"uint8array";if(c0.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};wG.checkSupport=function($){var Q=c0[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};wG.MAX_VALUE_16BITS=65535;wG.MAX_VALUE_32BITS=-1;wG.pretty=function($){var Q="",J,q;for(q=0;q<($||"").length;q++)J=$.charCodeAt(q),Q+="\\x"+(J<16?"0":"")+J.toString(16).toUpperCase();return Q};wG.delay=function($,Q,J){setImmediate(function(){$.apply(J||null,Q||[])})};wG.inherits=function($,Q){var J=function(){};J.prototype=Q.prototype,$.prototype=new J};wG.extend=function(){var $={},Q,J;for(Q=0;Q<arguments.length;Q++)for(J in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],J)&&typeof $[J]>"u")$[J]=arguments[Q][J];return $};wG.prepareContent=function($,Q,J,q,Y){var G=x8.Promise.resolve(Q).then(function(X){var V=c0.blob&&(X instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(X))!==-1);if(V&&typeof FileReader<"u")return new x8.Promise(function(U,K){var W=new FileReader;W.onload=function(F){U(F.target.result)},W.onerror=function(F){K(F.target.error)},W.readAsArrayBuffer(X)});else return X});return G.then(function(X){var V=wG.getTypeOf(X);if(!V)return x8.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(V==="arraybuffer")X=wG.transformTo("uint8array",X);else if(V==="string"){if(Y)X=OG.decode(X);else if(J){if(q!==!0)X=BG(X)}}return X})}});var X0=C((JH,p9)=>{function c9($){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}c9.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 J=0;J<this._listeners[$].length;J++)this._listeners[$][J].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(J){Q.processChunk(J)}),$.on("end",function(){Q.end()}),$.on("error",function(J){Q.error(J)}),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 $}};p9.exports=c9});var D1=C((fG)=>{var w1=m(),$1=T0(),TG=J$(),e$=X0(),V$=Array(256);for(D0=0;D0<256;D0++)V$[D0]=D0>=252?6:D0>=248?5:D0>=240?4:D0>=224?3:D0>=192?2:1;var D0;V$[254]=V$[254]=1;var yG=function($){var Q,J,q,Y,G,X=$.length,V=0;for(Y=0;Y<X;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<X){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}V+=J<128?1:J<2048?2:J<65536?3:4}if($1.uint8array)Q=new Uint8Array(V);else Q=Array(V);for(G=0,Y=0;G<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<X){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q},hG=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+V$[$[J]]>Q?J:Q},bG=function($){var Q,J,q,Y,G=$.length,X=Array(G*2);for(J=0,Q=0;Q<G;){if(q=$[Q++],q<128){X[J++]=q;continue}if(Y=V$[q],Y>4){X[J++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<G)q=q<<6|$[Q++]&63,Y--;if(Y>1){X[J++]=65533;continue}if(q<65536)X[J++]=q;else q-=65536,X[J++]=55296|q>>10&1023,X[J++]=56320|q&1023}if(X.length!==J)if(X.subarray)X=X.subarray(0,J);else X.length=J;return w1.applyFromCharCode(X)};fG.utf8encode=function(Q){if($1.nodebuffer)return TG.newBufferFrom(Q,"utf-8");return yG(Q)};fG.utf8decode=function(Q){if($1.nodebuffer)return w1.transformTo("nodebuffer",Q).toString("utf-8");return Q=w1.transformTo($1.uint8array?"uint8array":"array",Q),bG(Q)};function $6(){e$.call(this,"utf-8 decode"),this.leftOver=null}w1.inherits($6,e$);$6.prototype.processChunk=function($){var Q=w1.transformTo($1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if($1.uint8array){var J=Q;Q=new Uint8Array(J.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(J,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=hG(Q),Y=Q;if(q!==Q.length)if($1.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:fG.utf8decode(Y),meta:$.meta})};$6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:fG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};fG.Utf8DecodeWorker=$6;function g8(){e$.call(this,"utf-8 encode")}w1.inherits(g8,e$);g8.prototype.processChunk=function($){this.push({data:fG.utf8encode($.data),meta:$.meta})};fG.Utf8EncodeWorker=g8});var i9=C((YH,o9)=>{var d9=X0(),l9=m();function y8($){d9.call(this,"ConvertWorker to "+$),this.destType=$}l9.inherits(y8,d9);y8.prototype.processChunk=function($){this.push({data:l9.transformTo(this.destType,$.data),meta:$.meta})};o9.exports=y8});var a9=C((GH,r9)=>{var n9=w8().Readable,cG=m();cG.inherits(h8,n9);function h8($,Q,J){n9.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,G){if(!q.push(Y))q._helper.pause();if(J)J(G)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}h8.prototype._read=function(){this._helper.resume()};r9.exports=h8});var b8=C((XH,e9)=>{var Q1=m(),pG=i9(),uG=X0(),dG=C8(),lG=T0(),oG=O1(),s9=null;if(lG.nodestream)try{s9=a9()}catch($){}function iG($,Q,J){switch($){case"blob":return Q1.newBlob(Q1.transformTo("arraybuffer",Q),J);case"base64":return dG.encode(Q);default:return Q1.transformTo($,Q)}}function nG($,Q){var J,q=0,Y=null,G=0;for(J=0;J<Q.length;J++)G+=Q[J].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(G);for(J=0;J<Q.length;J++)Y.set(Q[J],q),q+=Q[J].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function rG($,Q){return new oG.Promise(function(J,q){var Y=[],G=$._internalType,X=$._outputType,V=$._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=iG(X,nG(G,Y),V);J(U)}catch(K){q(K)}Y=[]}).resume()})}function t9($,Q,J){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=J,Q1.checkSupport(q),this._worker=$.pipe(new pG(q)),$.lock()}catch(Y){this._worker=new uG("error"),this._worker.error(Y)}}t9.prototype={accumulate:function($){return rG(this,$)},on:function($,Q){var J=this;if($==="data")this._worker.on($,function(q){Q.call(J,q.data,q.meta)});else this._worker.on($,function(){Q1.delay(Q,arguments,J)});return this},resume:function(){return Q1.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(Q1.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new s9(this,{objectMode:this._outputType!=="nodebuffer"},$)}};e9.exports=t9});var f8=C((aG)=>{aG.base64=!1;aG.binary=!1;aG.dir=!1;aG.createFolders=!0;aG.date=null;aG.compression=null;aG.compressionOptions=null;aG.comment=null;aG.unixPermissions=null;aG.dosPermissions=null});var _8=C((KH,$2)=>{var Q6=m(),J6=X0(),VX=16384;function v1($){J6.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(J){if(Q.dataIsReady=!0,Q.data=J,Q.max=J&&J.length||0,Q.type=Q6.getTypeOf(J),!Q.isPaused)Q._tickAndRepeat()},function(J){Q.error(J)})}Q6.inherits(v1,J6);v1.prototype.cleanUp=function(){J6.prototype.cleanUp.call(this),this.data=null};v1.prototype.resume=function(){if(!J6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,Q6.delay(this._tickAndRepeat,[],this);return!0};v1.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)Q6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};v1.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=VX,Q=null,J=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,J);break;case"uint8array":Q=this.data.subarray(this.index,J);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,J);break}return this.index=J,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};$2.exports=v1});var q6=C((WH,J2)=>{var KX=m();function WX(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var Q2=WX();function UX($,Q,J,q){var Y=Q2,G=q+J;$=$^-1;for(var X=q;X<G;X++)$=$>>>8^Y[($^Q[X])&255];return $^-1}function jX($,Q,J,q){var Y=Q2,G=q+J;$=$^-1;for(var X=q;X<G;X++)$=$>>>8^Y[($^Q.charCodeAt(X))&255];return $^-1}J2.exports=function(Q,J){if(typeof Q>"u"||!Q.length)return 0;var q=KX.getTypeOf(Q)!=="string";if(q)return UX(J|0,Q,Q.length,0);else return jX(J|0,Q,Q.length,0)}});var c8=C((UH,Y2)=>{var q2=X0(),FX=q6(),HX=m();function m8(){q2.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}HX.inherits(m8,q2);m8.prototype.processChunk=function($){this.streamInfo.crc32=FX($.data,this.streamInfo.crc32||0),this.push($)};Y2.exports=m8});var X2=C((jH,G2)=>{var PX=m(),p8=X0();function u8($){p8.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}PX.inherits(u8,p8);u8.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}p8.prototype.processChunk.call(this,$)};G2.exports=u8});var Y6=C((FH,W2)=>{var V2=O1(),K2=_8(),ZX=c8(),d8=X2();function l8($,Q,J,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=J,this.compression=q,this.compressedContent=Y}l8.prototype={getContentWorker:function(){var $=new K2(V2.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new d8("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 K2(V2.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};l8.createWorkerFrom=function($,Q,J){return $.pipe(new ZX).pipe(new d8("uncompressedSize")).pipe(Q.compressWorker(J)).pipe(new d8("compressedSize")).withStreamInfo("compression",Q)};W2.exports=l8});var H2=C((HH,F2)=>{var zX=b8(),LX=_8(),o8=D1(),i8=Y6(),U2=X0(),n8=function($,Q,J){this.name=$,this.dir=J.dir,this.date=J.date,this.comment=J.comment,this.unixPermissions=J.unixPermissions,this.dosPermissions=J.dosPermissions,this._data=Q,this._dataBinary=J.binary,this.options={compression:J.compression,compressionOptions:J.compressionOptions}};n8.prototype={internalStream:function($){var Q=null,J="string";try{if(!$)throw Error("No output type specified.");J=$.toLowerCase();var q=J==="string"||J==="text";if(J==="binarystring"||J==="text")J="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new o8.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new o8.Utf8DecodeWorker)}catch(G){Q=new U2("error"),Q.error(G)}return new zX(Q,J,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof i8&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var J=this._decompressWorker();if(!this._dataBinary)J=J.pipe(new o8.Utf8EncodeWorker);return i8.createWorkerFrom(J,$,Q)}},_decompressWorker:function(){if(this._data instanceof i8)return this._data.getContentWorker();else if(this._data instanceof U2)return this._data;else return new LX(this._data)}};var j2=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],MX=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(K$=0;K$<j2.length;K$++)n8.prototype[j2[K$]]=MX;var K$;F2.exports=n8});var y0=C((r8)=>{var BX=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function wX($,Q){return Object.prototype.hasOwnProperty.call($,Q)}r8.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var J=Q.shift();if(!J)continue;if(typeof J!=="object")throw TypeError(J+"must be non-object");for(var q in J)if(wX(J,q))$[q]=J[q]}return $};r8.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var DX={arraySet:function($,Q,J,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(J,J+q),Y);return}for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){var Q,J,q,Y,G,X;q=0;for(Q=0,J=$.length;Q<J;Q++)q+=$[Q].length;X=new Uint8Array(q),Y=0;for(Q=0,J=$.length;Q<J;Q++)G=$[Q],X.set(G,Y),Y+=G.length;return X}},vX={arraySet:function($,Q,J,q,Y){for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){return[].concat.apply([],$)}};r8.setTyped=function($){if($)r8.Buf8=Uint8Array,r8.Buf16=Uint16Array,r8.Buf32=Int32Array,r8.assign(r8,DX);else r8.Buf8=Array,r8.Buf16=Array,r8.Buf32=Array,r8.assign(r8,vX)};r8.setTyped(BX)});var b2=C((nX)=>{var AX=y0(),RX=4,Z2=0,z2=1,kX=2;function A1($){var Q=$.length;while(--Q>=0)$[Q]=0}var EX=0,B2=1,xX=2,SX=3,gX=258,q5=29,P$=256,U$=P$+1+q5,C1=30,Y5=19,w2=2*U$+1,J1=15,s8=16,TX=7,G5=256,D2=16,v2=17,C2=18,Q5=[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],G6=[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],yX=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],A2=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],hX=512,h0=Array((U$+2)*2);A1(h0);var W$=Array(C1*2);A1(W$);var j$=Array(hX);A1(j$);var F$=Array(gX-SX+1);A1(F$);var X5=Array(q5);A1(X5);var X6=Array(C1);A1(X6);function t8($,Q,J,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=J,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var R2,k2,E2;function e8($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function x2($){return $<256?j$[$]:j$[256+($>>>7)]}function H$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function G0($,Q,J){if($.bi_valid>s8-J)$.bi_buf|=Q<<$.bi_valid&65535,H$($,$.bi_buf),$.bi_buf=Q>>s8-$.bi_valid,$.bi_valid+=J-s8;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=J}function v0($,Q,J){G0($,J[Q*2],J[Q*2+1])}function S2($,Q){var J=0;do J|=$&1,$>>>=1,J<<=1;while(--Q>0);return J>>>1}function bX($){if($.bi_valid===16)H$($,$.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 fX($,Q){var{dyn_tree:J,max_code:q}=Q,Y=Q.stat_desc.static_tree,G=Q.stat_desc.has_stree,X=Q.stat_desc.extra_bits,V=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,K,W,F,j,H,Z,L=0;for(j=0;j<=J1;j++)$.bl_count[j]=0;J[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<w2;K++){if(W=$.heap[K],j=J[J[W*2+1]*2+1]+1,j>U)j=U,L++;if(J[W*2+1]=j,W>q)continue;if($.bl_count[j]++,H=0,W>=V)H=X[W-V];if(Z=J[W*2],$.opt_len+=Z*(j+H),G)$.static_len+=Z*(Y[W*2+1]+H)}if(L===0)return;do{j=U-1;while($.bl_count[j]===0)j--;$.bl_count[j]--,$.bl_count[j+1]+=2,$.bl_count[U]--,L-=2}while(L>0);for(j=U;j!==0;j--){W=$.bl_count[j];while(W!==0){if(F=$.heap[--K],F>q)continue;if(J[F*2+1]!==j)$.opt_len+=(j-J[F*2+1])*J[F*2],J[F*2+1]=j;W--}}}function g2($,Q,J){var q=Array(J1+1),Y=0,G,X;for(G=1;G<=J1;G++)q[G]=Y=Y+J[G-1]<<1;for(X=0;X<=Q;X++){var V=$[X*2+1];if(V===0)continue;$[X*2]=S2(q[V]++,V)}}function _X(){var $,Q,J,q,Y,G=Array(J1+1);J=0;for(q=0;q<q5-1;q++){X5[q]=J;for($=0;$<1<<Q5[q];$++)F$[J++]=q}F$[J-1]=q,Y=0;for(q=0;q<16;q++){X6[q]=Y;for($=0;$<1<<G6[q];$++)j$[Y++]=q}Y>>=7;for(;q<C1;q++){X6[q]=Y<<7;for($=0;$<1<<G6[q]-7;$++)j$[256+Y++]=q}for(Q=0;Q<=J1;Q++)G[Q]=0;$=0;while($<=143)h0[$*2+1]=8,$++,G[8]++;while($<=255)h0[$*2+1]=9,$++,G[9]++;while($<=279)h0[$*2+1]=7,$++,G[7]++;while($<=287)h0[$*2+1]=8,$++,G[8]++;g2(h0,U$+1,G);for($=0;$<C1;$++)W$[$*2+1]=5,W$[$*2]=S2($,5);R2=new t8(h0,Q5,P$+1,U$,J1),k2=new t8(W$,G6,0,C1,J1),E2=new t8([],yX,0,Y5,TX)}function T2($){var Q;for(Q=0;Q<U$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<C1;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<Y5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[G5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function y2($){if($.bi_valid>8)H$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function mX($,Q,J,q){if(y2($),q)H$($,J),H$($,~J);AX.arraySet($.pending_buf,$.window,Q,J,$.pending),$.pending+=J}function L2($,Q,J,q){var Y=Q*2,G=J*2;return $[Y]<$[G]||$[Y]===$[G]&&q[Q]<=q[J]}function $5($,Q,J){var q=$.heap[J],Y=J<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&L2(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(L2(Q,q,$.heap[Y],$.depth))break;$.heap[J]=$.heap[Y],J=Y,Y<<=1}$.heap[J]=q}function M2($,Q,J){var q,Y,G=0,X,V;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+G*2]<<8|$.pending_buf[$.d_buf+G*2+1],Y=$.pending_buf[$.l_buf+G],G++,q===0)v0($,Y,Q);else{if(X=F$[Y],v0($,X+P$+1,Q),V=Q5[X],V!==0)Y-=X5[X],G0($,Y,V);if(q--,X=x2(q),v0($,X,J),V=G6[X],V!==0)q-=X6[X],G0($,q,V)}while(G<$.last_lit);v0($,G5,Q)}function J5($,Q){var J=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,G=Q.stat_desc.elems,X,V,U=-1,K;$.heap_len=0,$.heap_max=w2;for(X=0;X<G;X++)if(J[X*2]!==0)$.heap[++$.heap_len]=U=X,$.depth[X]=0;else J[X*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=U<2?++U:0,J[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=q[K*2+1];Q.max_code=U;for(X=$.heap_len>>1;X>=1;X--)$5($,J,X);K=G;do X=$.heap[1],$.heap[1]=$.heap[$.heap_len--],$5($,J,1),V=$.heap[1],$.heap[--$.heap_max]=X,$.heap[--$.heap_max]=V,J[K*2]=J[X*2]+J[V*2],$.depth[K]=($.depth[X]>=$.depth[V]?$.depth[X]:$.depth[V])+1,J[X*2+1]=J[V*2+1]=K,$.heap[1]=K++,$5($,J,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],fX($,Q),g2(J,U,$.bl_count)}function I2($,Q,J){var q,Y=-1,G,X=Q[1],V=0,U=7,K=4;if(X===0)U=138,K=3;Q[(J+1)*2+1]=65535;for(q=0;q<=J;q++){if(G=X,X=Q[(q+1)*2+1],++V<U&&G===X)continue;else if(V<K)$.bl_tree[G*2]+=V;else if(G!==0){if(G!==Y)$.bl_tree[G*2]++;$.bl_tree[D2*2]++}else if(V<=10)$.bl_tree[v2*2]++;else $.bl_tree[C2*2]++;if(V=0,Y=G,X===0)U=138,K=3;else if(G===X)U=6,K=3;else U=7,K=4}}function N2($,Q,J){var q,Y=-1,G,X=Q[1],V=0,U=7,K=4;if(X===0)U=138,K=3;for(q=0;q<=J;q++){if(G=X,X=Q[(q+1)*2+1],++V<U&&G===X)continue;else if(V<K)do v0($,G,$.bl_tree);while(--V!==0);else if(G!==0){if(G!==Y)v0($,G,$.bl_tree),V--;v0($,D2,$.bl_tree),G0($,V-3,2)}else if(V<=10)v0($,v2,$.bl_tree),G0($,V-3,3);else v0($,C2,$.bl_tree),G0($,V-11,7);if(V=0,Y=G,X===0)U=138,K=3;else if(G===X)U=6,K=3;else U=7,K=4}}function cX($){var Q;I2($,$.dyn_ltree,$.l_desc.max_code),I2($,$.dyn_dtree,$.d_desc.max_code),J5($,$.bl_desc);for(Q=Y5-1;Q>=3;Q--)if($.bl_tree[A2[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function pX($,Q,J,q){var Y;G0($,Q-257,5),G0($,J-1,5),G0($,q-4,4);for(Y=0;Y<q;Y++)G0($,$.bl_tree[A2[Y]*2+1],3);N2($,$.dyn_ltree,Q-1),N2($,$.dyn_dtree,J-1)}function uX($){var Q=4093624447,J;for(J=0;J<=31;J++,Q>>>=1)if(Q&1&&$.dyn_ltree[J*2]!==0)return Z2;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return z2;for(J=32;J<P$;J++)if($.dyn_ltree[J*2]!==0)return z2;return Z2}var O2=!1;function dX($){if(!O2)_X(),O2=!0;$.l_desc=new e8($.dyn_ltree,R2),$.d_desc=new e8($.dyn_dtree,k2),$.bl_desc=new e8($.bl_tree,E2),$.bi_buf=0,$.bi_valid=0,T2($)}function h2($,Q,J,q){G0($,(EX<<1)+(q?1:0),3),mX($,Q,J,!0)}function lX($){G0($,B2<<1,3),v0($,G5,h0),bX($)}function oX($,Q,J,q){var Y,G,X=0;if($.level>0){if($.strm.data_type===kX)$.strm.data_type=uX($);if(J5($,$.l_desc),J5($,$.d_desc),X=cX($),Y=$.opt_len+3+7>>>3,G=$.static_len+3+7>>>3,G<=Y)Y=G}else Y=G=J+5;if(J+4<=Y&&Q!==-1)h2($,Q,J,q);else if($.strategy===RX||G===Y)G0($,(B2<<1)+(q?1:0),3),M2($,h0,W$);else G0($,(xX<<1)+(q?1:0),3),pX($,$.l_desc.max_code+1,$.d_desc.max_code+1,X+1),M2($,$.dyn_ltree,$.dyn_dtree);if(T2($),q)y2($)}function iX($,Q,J){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]=J&255,$.last_lit++,Q===0)$.dyn_ltree[J*2]++;else $.matches++,Q--,$.dyn_ltree[(F$[J]+P$+1)*2]++,$.dyn_dtree[x2(Q)*2]++;return $.last_lit===$.lit_bufsize-1}nX._tr_init=dX;nX._tr_stored_block=h2;nX._tr_flush_block=oX;nX._tr_tally=iX;nX._tr_align=lX});var V5=C((zH,f2)=>{function $V($,Q,J,q){var Y=$&65535|0,G=$>>>16&65535|0,X=0;while(J!==0){X=J>2000?2000:J,J-=X;do Y=Y+Q[q++]|0,G=G+Y|0;while(--X);Y%=65521,G%=65521}return Y|G<<16|0}f2.exports=$V});var K5=C((LH,_2)=>{function QV(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var JV=QV();function qV($,Q,J,q){var Y=JV,G=q+J;$^=-1;for(var X=q;X<G;X++)$=$>>>8^Y[($^Q[X])&255];return $^-1}_2.exports=qV});var V6=C((MH,m2)=>{m2.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 r2=C((hV)=>{var Q0=y0(),F0=b2(),d2=V5(),u0=K5(),YV=V6(),X1=0,GV=1,XV=3,n0=4,c2=5,A0=0,p2=1,H0=-2,VV=-3,W5=-5,KV=-1,WV=1,K6=2,UV=3,jV=4,FV=0,HV=2,F6=8,PV=9,ZV=15,zV=8,LV=29,MV=256,j5=MV+1+LV,IV=30,NV=19,OV=2*j5+1,BV=15,x=3,o0=258,L0=o0+x+1,wV=32,H6=42,F5=69,W6=73,U6=91,j6=103,q1=113,z$=666,d=1,L$=2,Y1=3,E1=4,DV=3;function i0($,Q){return $.msg=YV[Q],Q}function u2($){return($<<1)-($>4?9:0)}function l0($){var Q=$.length;while(--Q>=0)$[Q]=0}function d0($){var Q=$.state,J=Q.pending;if(J>$.avail_out)J=$.avail_out;if(J===0)return;if(Q0.arraySet($.output,Q.pending_buf,Q.pending_out,J,$.next_out),$.next_out+=J,Q.pending_out+=J,$.total_out+=J,$.avail_out-=J,Q.pending-=J,Q.pending===0)Q.pending_out=0}function a($,Q){F0._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,d0($.strm)}function S($,Q){$.pending_buf[$.pending++]=Q}function Z$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function vV($,Q,J,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,Q0.arraySet(Q,$.input,$.next_in,Y,J),$.state.wrap===1)$.adler=d2($.adler,Q,Y,J);else if($.state.wrap===2)$.adler=u0($.adler,Q,Y,J);return $.next_in+=Y,$.total_in+=Y,Y}function l2($,Q){var{max_chain_length:J,strstart:q}=$,Y,G,X=$.prev_length,V=$.nice_match,U=$.strstart>$.w_size-L0?$.strstart-($.w_size-L0):0,K=$.window,W=$.w_mask,F=$.prev,j=$.strstart+o0,H=K[q+X-1],Z=K[q+X];if($.prev_length>=$.good_match)J>>=2;if(V>$.lookahead)V=$.lookahead;do{if(Y=Q,K[Y+X]!==Z||K[Y+X-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<j);if(G=o0-(j-q),q=j-o0,G>X){if($.match_start=Q,X=G,G>=V)break;H=K[q+X-1],Z=K[q+X]}}while((Q=F[Q&W])>U&&--J!==0);if(X<=$.lookahead)return X;return $.lookahead}function G1($){var Q=$.w_size,J,q,Y,G,X;do{if(G=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-L0)){Q0.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,J=q;do Y=$.head[--J],$.head[J]=Y>=Q?Y-Q:0;while(--q);q=Q,J=q;do Y=$.prev[--J],$.prev[J]=Y>=Q?Y-Q:0;while(--q);G+=Q}if($.strm.avail_in===0)break;if(q=vV($.strm,$.window,$.strstart+$.lookahead,G),$.lookahead+=q,$.lookahead+$.insert>=x){X=$.strstart-$.insert,$.ins_h=$.window[X],$.ins_h=($.ins_h<<$.hash_shift^$.window[X+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[X+x-1])&$.hash_mask,$.prev[X&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=X,X++,$.insert--,$.lookahead+$.insert<x)break}}while($.lookahead<L0&&$.strm.avail_in!==0)}function CV($,Q){var J=65535;if(J>$.pending_buf_size-5)J=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(G1($),$.lookahead===0&&Q===X1)return d;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+J;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,a($,!1),$.strm.avail_out===0)return d}if($.strstart-$.block_start>=$.w_size-L0){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.strstart>$.block_start){if(a($,!1),$.strm.avail_out===0)return d}return d}function U5($,Q){var J,q;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===X1)return d;if($.lookahead===0)break}if(J=0,$.lookahead>=x)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(J!==0&&$.strstart-J<=$.w_size-L0)$.match_length=l2($,J);if($.match_length>=x)if(q=F0._tr_tally($,$.strstart-$.match_start,$.match_length-x),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=x){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.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=F0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=$.strstart<x-1?$.strstart:x-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function R1($,Q){var J,q,Y;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===X1)return d;if($.lookahead===0)break}if(J=0,$.lookahead>=x)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=x-1,J!==0&&$.prev_length<$.max_lazy_match&&$.strstart-J<=$.w_size-L0){if($.match_length=l2($,J),$.match_length<=5&&($.strategy===WV||$.match_length===x&&$.strstart-$.match_start>4096))$.match_length=x-1}if($.prev_length>=x&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-x,q=F0._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-x),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=x-1,$.strstart++,q){if(a($,!1),$.strm.avail_out===0)return d}}else if($.match_available){if(q=F0._tr_tally($,0,$.window[$.strstart-1]),q)a($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return d}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=F0._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<x-1?$.strstart:x-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function AV($,Q){var J,q,Y,G,X=$.window;for(;;){if($.lookahead<=o0){if(G1($),$.lookahead<=o0&&Q===X1)return d;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=x&&$.strstart>0){if(Y=$.strstart-1,q=X[Y],q===X[++Y]&&q===X[++Y]&&q===X[++Y]){G=$.strstart+o0;do;while(q===X[++Y]&&q===X[++Y]&&q===X[++Y]&&q===X[++Y]&&q===X[++Y]&&q===X[++Y]&&q===X[++Y]&&q===X[++Y]&&Y<G);if($.match_length=o0-(G-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=x)J=F0._tr_tally($,1,$.match_length-x),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else J=F0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(J){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function RV($,Q){var J;for(;;){if($.lookahead===0){if(G1($),$.lookahead===0){if(Q===X1)return d;break}}if($.match_length=0,J=F0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,J){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function C0($,Q,J,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=J,this.max_chain=q,this.func=Y}var k1;k1=[new C0(0,0,0,0,CV),new C0(4,4,8,4,U5),new C0(4,5,16,8,U5),new C0(4,6,32,32,U5),new C0(4,4,16,16,R1),new C0(8,16,32,32,R1),new C0(8,16,128,128,R1),new C0(8,32,128,256,R1),new C0(32,128,258,1024,R1),new C0(32,258,258,4096,R1)];function kV($){$.window_size=2*$.w_size,l0($.head),$.max_lazy_match=k1[$.level].max_lazy,$.good_match=k1[$.level].good_length,$.nice_match=k1[$.level].nice_length,$.max_chain_length=k1[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=x-1,$.match_available=0,$.ins_h=0}function EV(){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=F6,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 Q0.Buf16(OV*2),this.dyn_dtree=new Q0.Buf16((2*IV+1)*2),this.bl_tree=new Q0.Buf16((2*NV+1)*2),l0(this.dyn_ltree),l0(this.dyn_dtree),l0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Q0.Buf16(BV+1),this.heap=new Q0.Buf16(2*j5+1),l0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Q0.Buf16(2*j5+1),l0(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 o2($){var Q;if(!$||!$.state)return i0($,H0);if($.total_in=$.total_out=0,$.data_type=HV,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?H6:q1,$.adler=Q.wrap===2?0:1,Q.last_flush=X1,F0._tr_init(Q),A0}function i2($){var Q=o2($);if(Q===A0)kV($.state);return Q}function xV($,Q){if(!$||!$.state)return H0;if($.state.wrap!==2)return H0;return $.state.gzhead=Q,A0}function n2($,Q,J,q,Y,G){if(!$)return H0;var X=1;if(Q===KV)Q=6;if(q<0)X=0,q=-q;else if(q>15)X=2,q-=16;if(Y<1||Y>PV||J!==F6||q<8||q>15||Q<0||Q>9||G<0||G>jV)return i0($,H0);if(q===8)q=9;var V=new EV;return $.state=V,V.strm=$,V.wrap=X,V.gzhead=null,V.w_bits=q,V.w_size=1<<V.w_bits,V.w_mask=V.w_size-1,V.hash_bits=Y+7,V.hash_size=1<<V.hash_bits,V.hash_mask=V.hash_size-1,V.hash_shift=~~((V.hash_bits+x-1)/x),V.window=new Q0.Buf8(V.w_size*2),V.head=new Q0.Buf16(V.hash_size),V.prev=new Q0.Buf16(V.w_size),V.lit_bufsize=1<<Y+6,V.pending_buf_size=V.lit_bufsize*4,V.pending_buf=new Q0.Buf8(V.pending_buf_size),V.d_buf=1*V.lit_bufsize,V.l_buf=3*V.lit_bufsize,V.level=Q,V.strategy=G,V.method=J,i2($)}function SV($,Q){return n2($,Q,F6,ZV,zV,FV)}function gV($,Q){var J,q,Y,G;if(!$||!$.state||Q>c2||Q<0)return $?i0($,H0):H0;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===z$&&Q!==n0)return i0($,$.avail_out===0?W5:H0);if(q.strm=$,J=q.last_flush,q.last_flush=Q,q.status===H6)if(q.wrap===2)if($.adler=0,S(q,31),S(q,139),S(q,8),!q.gzhead)S(q,0),S(q,0),S(q,0),S(q,0),S(q,0),S(q,q.level===9?2:q.strategy>=K6||q.level<2?4:0),S(q,DV),q.status=q1;else{if(S(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)),S(q,q.gzhead.time&255),S(q,q.gzhead.time>>8&255),S(q,q.gzhead.time>>16&255),S(q,q.gzhead.time>>24&255),S(q,q.level===9?2:q.strategy>=K6||q.level<2?4:0),S(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)S(q,q.gzhead.extra.length&255),S(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=u0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=F5}else{var X=F6+(q.w_bits-8<<4)<<8,V=-1;if(q.strategy>=K6||q.level<2)V=0;else if(q.level<6)V=1;else if(q.level===6)V=2;else V=3;if(X|=V<<6,q.strstart!==0)X|=wV;if(X+=31-X%31,q.status=q1,Z$(q,X),q.strstart!==0)Z$(q,$.adler>>>16),Z$(q,$.adler&65535);$.adler=1}if(q.status===F5)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=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size)break}S(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=W6}else q.status=W6;if(q.status===W6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.name.length)G=q.gzhead.name.charCodeAt(q.gzindex++)&255;else G=0;S(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.gzindex=0,q.status=U6}else q.status=U6;if(q.status===U6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.comment.length)G=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else G=0;S(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.status=j6}else q.status=j6;if(q.status===j6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)d0($);if(q.pending+2<=q.pending_buf_size)S(q,$.adler&255),S(q,$.adler>>8&255),$.adler=0,q.status=q1}else q.status=q1;if(q.pending!==0){if(d0($),$.avail_out===0)return q.last_flush=-1,A0}else if($.avail_in===0&&u2(Q)<=u2(J)&&Q!==n0)return i0($,W5);if(q.status===z$&&$.avail_in!==0)return i0($,W5);if($.avail_in!==0||q.lookahead!==0||Q!==X1&&q.status!==z$){var U=q.strategy===K6?RV(q,Q):q.strategy===UV?AV(q,Q):k1[q.level].func(q,Q);if(U===Y1||U===E1)q.status=z$;if(U===d||U===Y1){if($.avail_out===0)q.last_flush=-1;return A0}if(U===L$){if(Q===GV)F0._tr_align(q);else if(Q!==c2){if(F0._tr_stored_block(q,0,0,!1),Q===XV){if(l0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(d0($),$.avail_out===0)return q.last_flush=-1,A0}}if(Q!==n0)return A0;if(q.wrap<=0)return p2;if(q.wrap===2)S(q,$.adler&255),S(q,$.adler>>8&255),S(q,$.adler>>16&255),S(q,$.adler>>24&255),S(q,$.total_in&255),S(q,$.total_in>>8&255),S(q,$.total_in>>16&255),S(q,$.total_in>>24&255);else Z$(q,$.adler>>>16),Z$(q,$.adler&65535);if(d0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?A0:p2}function TV($){var Q;if(!$||!$.state)return H0;if(Q=$.state.status,Q!==H6&&Q!==F5&&Q!==W6&&Q!==U6&&Q!==j6&&Q!==q1&&Q!==z$)return i0($,H0);return $.state=null,Q===q1?i0($,VV):A0}function yV($,Q){var J=Q.length,q,Y,G,X,V,U,K,W;if(!$||!$.state)return H0;if(q=$.state,X=q.wrap,X===2||X===1&&q.status!==H6||q.lookahead)return H0;if(X===1)$.adler=d2($.adler,Q,J,0);if(q.wrap=0,J>=q.w_size){if(X===0)l0(q.head),q.strstart=0,q.block_start=0,q.insert=0;W=new Q0.Buf8(q.w_size),Q0.arraySet(W,Q,J-q.w_size,q.w_size,0),Q=W,J=q.w_size}V=$.avail_in,U=$.next_in,K=$.input,$.avail_in=J,$.next_in=0,$.input=Q,G1(q);while(q.lookahead>=x){Y=q.strstart,G=q.lookahead-(x-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+x-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--G);q.strstart=Y,q.lookahead=x-1,G1(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=x-1,q.match_available=0,$.next_in=U,$.input=K,$.avail_in=V,q.wrap=X,A0}hV.deflateInit=SV;hV.deflateInit2=n2;hV.deflateReset=i2;hV.deflateResetKeep=o2;hV.deflateSetHeader=xV;hV.deflate=gV;hV.deflateEnd=TV;hV.deflateSetDictionary=yV;hV.deflateInfo="pako deflate (from Nodeca project)"});var H5=C((oV)=>{var P6=y0(),a2=!0,s2=!0;try{String.fromCharCode.apply(null,[0])}catch($){a2=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){s2=!1}var M$=new P6.Buf8(256);for(R0=0;R0<256;R0++)M$[R0]=R0>=252?6:R0>=248?5:R0>=240?4:R0>=224?3:R0>=192?2:1;var R0;M$[254]=M$[254]=1;oV.string2buf=function($){var Q,J,q,Y,G,X=$.length,V=0;for(Y=0;Y<X;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<X){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}V+=J<128?1:J<2048?2:J<65536?3:4}Q=new P6.Buf8(V);for(G=0,Y=0;G<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<X){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q};function t2($,Q){if(Q<65534){if($.subarray&&s2||!$.subarray&&a2)return String.fromCharCode.apply(null,P6.shrinkBuf($,Q))}var J="";for(var q=0;q<Q;q++)J+=String.fromCharCode($[q]);return J}oV.buf2binstring=function($){return t2($,$.length)};oV.binstring2buf=function($){var Q=new P6.Buf8($.length);for(var J=0,q=Q.length;J<q;J++)Q[J]=$.charCodeAt(J);return Q};oV.buf2string=function($,Q){var J,q,Y,G,X=Q||$.length,V=Array(X*2);for(q=0,J=0;J<X;){if(Y=$[J++],Y<128){V[q++]=Y;continue}if(G=M$[Y],G>4){V[q++]=65533,J+=G-1;continue}Y&=G===2?31:G===3?15:7;while(G>1&&J<X)Y=Y<<6|$[J++]&63,G--;if(G>1){V[q++]=65533;continue}if(Y<65536)V[q++]=Y;else Y-=65536,V[q++]=55296|Y>>10&1023,V[q++]=56320|Y&1023}return t2(V,q)};oV.utf8border=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+M$[$[J]]>Q?J:Q}});var P5=C((OH,e2)=>{function tV(){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}e2.exports=tV});var q7=C((XK)=>{var I$=r2(),N$=y0(),z5=H5(),L5=V6(),eV=P5(),J7=Object.prototype.toString,$K=0,Z5=4,x1=0,$7=1,Q7=2,QK=-1,JK=0,qK=8;function V1($){if(!(this instanceof V1))return new V1($);this.options=N$.assign({level:QK,method:qK,chunkSize:16384,windowBits:15,memLevel:8,strategy:JK,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 eV,this.strm.avail_out=0;var J=I$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(J!==x1)throw Error(L5[J]);if(Q.header)I$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=z5.string2buf(Q.dictionary);else if(J7.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(J=I$.deflateSetDictionary(this.strm,q),J!==x1)throw Error(L5[J]);this._dict_set=!0}}V1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y,G;if(this.ended)return!1;if(G=Q===~~Q?Q:Q===!0?Z5:$K,typeof $==="string")J.input=z5.string2buf($);else if(J7.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new N$.Buf8(q),J.next_out=0,J.avail_out=q;if(Y=I$.deflate(J,G),Y!==$7&&Y!==x1)return this.onEnd(Y),this.ended=!0,!1;if(J.avail_out===0||J.avail_in===0&&(G===Z5||G===Q7))if(this.options.to==="string")this.onData(z5.buf2binstring(N$.shrinkBuf(J.output,J.next_out)));else this.onData(N$.shrinkBuf(J.output,J.next_out))}while((J.avail_in>0||J.avail_out===0)&&Y!==$7);if(G===Z5)return Y=I$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===x1;if(G===Q7)return this.onEnd(x1),J.avail_out=0,!0;return!0};V1.prototype.onData=function($){this.chunks.push($)};V1.prototype.onEnd=function($){if($===x1)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=N$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function M5($,Q){var J=new V1(Q);if(J.push($,!0),J.err)throw J.msg||L5[J.err];return J.result}function YK($,Q){return Q=Q||{},Q.raw=!0,M5($,Q)}function GK($,Q){return Q=Q||{},Q.gzip=!0,M5($,Q)}XK.Deflate=V1;XK.deflate=M5;XK.deflateRaw=YK;XK.gzip=GK});var G7=C((wH,Y7)=>{var Z6=30,jK=12;Y7.exports=function(Q,J){var q,Y,G,X,V,U,K,W,F,j,H,Z,L,O,I,P,B,M,z,v,w,D,k,E,A;q=Q.state,Y=Q.next_in,E=Q.input,G=Y+(Q.avail_in-5),X=Q.next_out,A=Q.output,V=X-(J-Q.avail_out),U=X+(Q.avail_out-257),K=q.dmax,W=q.wsize,F=q.whave,j=q.wnext,H=q.window,Z=q.hold,L=q.bits,O=q.lencode,I=q.distcode,P=(1<<q.lenbits)-1,B=(1<<q.distbits)-1;$:do{if(L<15)Z+=E[Y++]<<L,L+=8,Z+=E[Y++]<<L,L+=8;M=O[Z&P];Q:for(;;){if(z=M>>>24,Z>>>=z,L-=z,z=M>>>16&255,z===0)A[X++]=M&65535;else if(z&16){if(v=M&65535,z&=15,z){if(L<z)Z+=E[Y++]<<L,L+=8;v+=Z&(1<<z)-1,Z>>>=z,L-=z}if(L<15)Z+=E[Y++]<<L,L+=8,Z+=E[Y++]<<L,L+=8;M=I[Z&B];J:for(;;){if(z=M>>>24,Z>>>=z,L-=z,z=M>>>16&255,z&16){if(w=M&65535,z&=15,L<z){if(Z+=E[Y++]<<L,L+=8,L<z)Z+=E[Y++]<<L,L+=8}if(w+=Z&(1<<z)-1,w>K){Q.msg="invalid distance too far back",q.mode=Z6;break $}if(Z>>>=z,L-=z,z=X-V,w>z){if(z=w-z,z>F){if(q.sane){Q.msg="invalid distance too far back",q.mode=Z6;break $}}if(D=0,k=H,j===0){if(D+=W-z,z<v){v-=z;do A[X++]=H[D++];while(--z);D=X-w,k=A}}else if(j<z){if(D+=W+j-z,z-=j,z<v){v-=z;do A[X++]=H[D++];while(--z);if(D=0,j<v){z=j,v-=z;do A[X++]=H[D++];while(--z);D=X-w,k=A}}}else if(D+=j-z,z<v){v-=z;do A[X++]=H[D++];while(--z);D=X-w,k=A}while(v>2)A[X++]=k[D++],A[X++]=k[D++],A[X++]=k[D++],v-=3;if(v){if(A[X++]=k[D++],v>1)A[X++]=k[D++]}}else{D=X-w;do A[X++]=A[D++],A[X++]=A[D++],A[X++]=A[D++],v-=3;while(v>2);if(v){if(A[X++]=A[D++],v>1)A[X++]=A[D++]}}}else if((z&64)===0){M=I[(M&65535)+(Z&(1<<z)-1)];continue J}else{Q.msg="invalid distance code",q.mode=Z6;break $}break}}else if((z&64)===0){M=O[(M&65535)+(Z&(1<<z)-1)];continue Q}else if(z&32){q.mode=jK;break $}else{Q.msg="invalid literal/length code",q.mode=Z6;break $}break}}while(Y<G&&X<U);v=L>>3,Y-=v,L-=v<<3,Z&=(1<<L)-1,Q.next_in=Y,Q.next_out=X,Q.avail_in=Y<G?5+(G-Y):5-(Y-G),Q.avail_out=X<U?257+(U-X):257-(X-U),q.hold=Z,q.bits=L;return}});var F7=C((DH,j7)=>{var X7=y0(),S1=15,V7=852,K7=592,W7=0,I5=1,U7=2,FK=[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],HK=[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],PK=[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],ZK=[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];j7.exports=function(Q,J,q,Y,G,X,V,U){var K=U.bits,W=0,F=0,j=0,H=0,Z=0,L=0,O=0,I=0,P=0,B=0,M,z,v,w,D,k=null,E=0,A,o=new X7.Buf16(S1+1),W0=new X7.Buf16(S1+1),y=null,e=0,U0,q0,E0;for(W=0;W<=S1;W++)o[W]=0;for(F=0;F<Y;F++)o[J[q+F]]++;Z=K;for(H=S1;H>=1;H--)if(o[H]!==0)break;if(Z>H)Z=H;if(H===0)return G[X++]=20971520,G[X++]=20971520,U.bits=1,0;for(j=1;j<H;j++)if(o[j]!==0)break;if(Z<j)Z=j;I=1;for(W=1;W<=S1;W++)if(I<<=1,I-=o[W],I<0)return-1;if(I>0&&(Q===W7||H!==1))return-1;W0[1]=0;for(W=1;W<S1;W++)W0[W+1]=W0[W]+o[W];for(F=0;F<Y;F++)if(J[q+F]!==0)V[W0[J[q+F]]++]=F;if(Q===W7)k=y=V,A=19;else if(Q===I5)k=FK,E-=257,y=HK,e-=257,A=256;else k=PK,y=ZK,A=-1;if(B=0,F=0,W=j,D=X,L=Z,O=0,v=-1,P=1<<Z,w=P-1,Q===I5&&P>V7||Q===U7&&P>K7)return 1;for(;;){if(U0=W-O,V[F]<A)q0=0,E0=V[F];else if(V[F]>A)q0=y[e+V[F]],E0=k[E+V[F]];else q0=96,E0=0;M=1<<W-O,z=1<<L,j=z;do z-=M,G[D+(B>>O)+z]=U0<<24|q0<<16|E0|0;while(z!==0);M=1<<W-1;while(B&M)M>>=1;if(M!==0)B&=M-1,B+=M;else B=0;if(F++,--o[W]===0){if(W===H)break;W=J[q+V[F]]}if(W>Z&&(B&w)!==v){if(O===0)O=Z;D+=j,L=W-O,I=1<<L;while(L+O<H){if(I-=o[L+O],I<=0)break;L++,I<<=1}if(P+=1<<L,Q===I5&&P>V7||Q===U7&&P>K7)return 1;v=B&w,G[v]=Z<<24|L<<16|D-X|0}}if(B!==0)G[D+B]=W-O<<24|4194304|0;return U.bits=Z,0}});var i7=C((TK)=>{var V0=y0(),v5=V5(),k0=K5(),zK=G7(),O$=F7(),LK=0,f7=1,_7=2,H7=4,MK=5,z6=6,K1=0,IK=1,NK=2,P0=-2,m7=-3,C5=-4,OK=-5,P7=8,c7=1,Z7=2,z7=3,L7=4,M7=5,I7=6,N7=7,O7=8,B7=9,w7=10,I6=11,b0=12,N5=13,D7=14,O5=15,v7=16,C7=17,A7=18,R7=19,L6=20,M6=21,k7=22,E7=23,x7=24,S7=25,g7=26,B5=27,T7=28,y7=29,_=30,A5=31,BK=32,wK=852,DK=592,vK=15,CK=vK;function h7($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function AK(){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 V0.Buf16(320),this.work=new V0.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function p7($){var Q;if(!$||!$.state)return P0;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=c7,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new V0.Buf32(wK),Q.distcode=Q.distdyn=new V0.Buf32(DK),Q.sane=1,Q.back=-1,K1}function u7($){var Q;if(!$||!$.state)return P0;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,p7($)}function d7($,Q){var J,q;if(!$||!$.state)return P0;if(q=$.state,Q<0)J=0,Q=-Q;else if(J=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return P0;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=J,q.wbits=Q,u7($)}function l7($,Q){var J,q;if(!$)return P0;if(q=new AK,$.state=q,q.window=null,J=d7($,Q),J!==K1)$.state=null;return J}function RK($){return l7($,CK)}var b7=!0,w5,D5;function kK($){if(b7){var Q;w5=new V0.Buf32(512),D5=new V0.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;O$(f7,$.lens,0,288,w5,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;O$(_7,$.lens,0,32,D5,0,$.work,{bits:5}),b7=!1}$.lencode=w5,$.lenbits=9,$.distcode=D5,$.distbits=5}function o7($,Q,J,q){var Y,G=$.state;if(G.window===null)G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new V0.Buf8(G.wsize);if(q>=G.wsize)V0.arraySet(G.window,Q,J-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize;else{if(Y=G.wsize-G.wnext,Y>q)Y=q;if(V0.arraySet(G.window,Q,J-q,Y,G.wnext),q-=Y,q)V0.arraySet(G.window,Q,J-q,q,0),G.wnext=q,G.whave=G.wsize;else{if(G.wnext+=Y,G.wnext===G.wsize)G.wnext=0;if(G.whave<G.wsize)G.whave+=Y}}return 0}function EK($,Q){var J,q,Y,G,X,V,U,K,W,F,j,H,Z,L,O=0,I,P,B,M,z,v,w,D,k=new V0.Buf8(4),E,A,o=[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 P0;if(J=$.state,J.mode===b0)J.mode=N5;X=$.next_out,Y=$.output,U=$.avail_out,G=$.next_in,q=$.input,V=$.avail_in,K=J.hold,W=J.bits,F=V,j=U,D=K1;$:for(;;)switch(J.mode){case c7:if(J.wrap===0){J.mode=N5;break}while(W<16){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(J.wrap&2&&K===35615){J.check=0,k[0]=K&255,k[1]=K>>>8&255,J.check=k0(J.check,k,2,0),K=0,W=0,J.mode=Z7;break}if(J.flags=0,J.head)J.head.done=!1;if(!(J.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",J.mode=_;break}if((K&15)!==P7){$.msg="unknown compression method",J.mode=_;break}if(K>>>=4,W-=4,w=(K&15)+8,J.wbits===0)J.wbits=w;else if(w>J.wbits){$.msg="invalid window size",J.mode=_;break}J.dmax=1<<w,$.adler=J.check=1,J.mode=K&512?w7:b0,K=0,W=0;break;case Z7:while(W<16){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(J.flags=K,(J.flags&255)!==P7){$.msg="unknown compression method",J.mode=_;break}if(J.flags&57344){$.msg="unknown header flags set",J.mode=_;break}if(J.head)J.head.text=K>>8&1;if(J.flags&512)k[0]=K&255,k[1]=K>>>8&255,J.check=k0(J.check,k,2,0);K=0,W=0,J.mode=z7;case z7:while(W<32){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(J.head)J.head.time=K;if(J.flags&512)k[0]=K&255,k[1]=K>>>8&255,k[2]=K>>>16&255,k[3]=K>>>24&255,J.check=k0(J.check,k,4,0);K=0,W=0,J.mode=L7;case L7:while(W<16){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(J.head)J.head.xflags=K&255,J.head.os=K>>8;if(J.flags&512)k[0]=K&255,k[1]=K>>>8&255,J.check=k0(J.check,k,2,0);K=0,W=0,J.mode=M7;case M7:if(J.flags&1024){while(W<16){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(J.length=K,J.head)J.head.extra_len=K;if(J.flags&512)k[0]=K&255,k[1]=K>>>8&255,J.check=k0(J.check,k,2,0);K=0,W=0}else if(J.head)J.head.extra=null;J.mode=I7;case I7:if(J.flags&1024){if(H=J.length,H>V)H=V;if(H){if(J.head){if(w=J.head.extra_len-J.length,!J.head.extra)J.head.extra=Array(J.head.extra_len);V0.arraySet(J.head.extra,q,G,H,w)}if(J.flags&512)J.check=k0(J.check,q,H,G);V-=H,G+=H,J.length-=H}if(J.length)break $}J.length=0,J.mode=N7;case N7:if(J.flags&2048){if(V===0)break $;H=0;do if(w=q[G+H++],J.head&&w&&J.length<65536)J.head.name+=String.fromCharCode(w);while(w&&H<V);if(J.flags&512)J.check=k0(J.check,q,H,G);if(V-=H,G+=H,w)break $}else if(J.head)J.head.name=null;J.length=0,J.mode=O7;case O7:if(J.flags&4096){if(V===0)break $;H=0;do if(w=q[G+H++],J.head&&w&&J.length<65536)J.head.comment+=String.fromCharCode(w);while(w&&H<V);if(J.flags&512)J.check=k0(J.check,q,H,G);if(V-=H,G+=H,w)break $}else if(J.head)J.head.comment=null;J.mode=B7;case B7:if(J.flags&512){while(W<16){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(K!==(J.check&65535)){$.msg="header crc mismatch",J.mode=_;break}K=0,W=0}if(J.head)J.head.hcrc=J.flags>>9&1,J.head.done=!0;$.adler=J.check=0,J.mode=b0;break;case w7:while(W<32){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}$.adler=J.check=h7(K),K=0,W=0,J.mode=I6;case I6:if(J.havedict===0)return $.next_out=X,$.avail_out=U,$.next_in=G,$.avail_in=V,J.hold=K,J.bits=W,NK;$.adler=J.check=1,J.mode=b0;case b0:if(Q===MK||Q===z6)break $;case N5:if(J.last){K>>>=W&7,W-=W&7,J.mode=B5;break}while(W<3){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}switch(J.last=K&1,K>>>=1,W-=1,K&3){case 0:J.mode=D7;break;case 1:if(kK(J),J.mode=L6,Q===z6){K>>>=2,W-=2;break $}break;case 2:J.mode=C7;break;case 3:$.msg="invalid block type",J.mode=_}K>>>=2,W-=2;break;case D7:K>>>=W&7,W-=W&7;while(W<32){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",J.mode=_;break}if(J.length=K&65535,K=0,W=0,J.mode=O5,Q===z6)break $;case O5:J.mode=v7;case v7:if(H=J.length,H){if(H>V)H=V;if(H>U)H=U;if(H===0)break $;V0.arraySet(Y,q,G,H,X),V-=H,G+=H,U-=H,X+=H,J.length-=H;break}J.mode=b0;break;case C7:while(W<14){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(J.nlen=(K&31)+257,K>>>=5,W-=5,J.ndist=(K&31)+1,K>>>=5,W-=5,J.ncode=(K&15)+4,K>>>=4,W-=4,J.nlen>286||J.ndist>30){$.msg="too many length or distance symbols",J.mode=_;break}J.have=0,J.mode=A7;case A7:while(J.have<J.ncode){while(W<3){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}J.lens[o[J.have++]]=K&7,K>>>=3,W-=3}while(J.have<19)J.lens[o[J.have++]]=0;if(J.lencode=J.lendyn,J.lenbits=7,E={bits:J.lenbits},D=O$(LK,J.lens,0,19,J.lencode,0,J.work,E),J.lenbits=E.bits,D){$.msg="invalid code lengths set",J.mode=_;break}J.have=0,J.mode=R7;case R7:while(J.have<J.nlen+J.ndist){for(;;){if(O=J.lencode[K&(1<<J.lenbits)-1],I=O>>>24,P=O>>>16&255,B=O&65535,I<=W)break;if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(B<16)K>>>=I,W-=I,J.lens[J.have++]=B;else{if(B===16){A=I+2;while(W<A){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(K>>>=I,W-=I,J.have===0){$.msg="invalid bit length repeat",J.mode=_;break}w=J.lens[J.have-1],H=3+(K&3),K>>>=2,W-=2}else if(B===17){A=I+3;while(W<A){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}K>>>=I,W-=I,w=0,H=3+(K&7),K>>>=3,W-=3}else{A=I+7;while(W<A){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}K>>>=I,W-=I,w=0,H=11+(K&127),K>>>=7,W-=7}if(J.have+H>J.nlen+J.ndist){$.msg="invalid bit length repeat",J.mode=_;break}while(H--)J.lens[J.have++]=w}}if(J.mode===_)break;if(J.lens[256]===0){$.msg="invalid code -- missing end-of-block",J.mode=_;break}if(J.lenbits=9,E={bits:J.lenbits},D=O$(f7,J.lens,0,J.nlen,J.lencode,0,J.work,E),J.lenbits=E.bits,D){$.msg="invalid literal/lengths set",J.mode=_;break}if(J.distbits=6,J.distcode=J.distdyn,E={bits:J.distbits},D=O$(_7,J.lens,J.nlen,J.ndist,J.distcode,0,J.work,E),J.distbits=E.bits,D){$.msg="invalid distances set",J.mode=_;break}if(J.mode=L6,Q===z6)break $;case L6:J.mode=M6;case M6:if(V>=6&&U>=258){if($.next_out=X,$.avail_out=U,$.next_in=G,$.avail_in=V,J.hold=K,J.bits=W,zK($,j),X=$.next_out,Y=$.output,U=$.avail_out,G=$.next_in,q=$.input,V=$.avail_in,K=J.hold,W=J.bits,J.mode===b0)J.back=-1;break}J.back=0;for(;;){if(O=J.lencode[K&(1<<J.lenbits)-1],I=O>>>24,P=O>>>16&255,B=O&65535,I<=W)break;if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(P&&(P&240)===0){M=I,z=P,v=B;for(;;){if(O=J.lencode[v+((K&(1<<M+z)-1)>>M)],I=O>>>24,P=O>>>16&255,B=O&65535,M+I<=W)break;if(V===0)break $;V--,K+=q[G++]<<W,W+=8}K>>>=M,W-=M,J.back+=M}if(K>>>=I,W-=I,J.back+=I,J.length=B,P===0){J.mode=g7;break}if(P&32){J.back=-1,J.mode=b0;break}if(P&64){$.msg="invalid literal/length code",J.mode=_;break}J.extra=P&15,J.mode=k7;case k7:if(J.extra){A=J.extra;while(W<A){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}J.length+=K&(1<<J.extra)-1,K>>>=J.extra,W-=J.extra,J.back+=J.extra}J.was=J.length,J.mode=E7;case E7:for(;;){if(O=J.distcode[K&(1<<J.distbits)-1],I=O>>>24,P=O>>>16&255,B=O&65535,I<=W)break;if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if((P&240)===0){M=I,z=P,v=B;for(;;){if(O=J.distcode[v+((K&(1<<M+z)-1)>>M)],I=O>>>24,P=O>>>16&255,B=O&65535,M+I<=W)break;if(V===0)break $;V--,K+=q[G++]<<W,W+=8}K>>>=M,W-=M,J.back+=M}if(K>>>=I,W-=I,J.back+=I,P&64){$.msg="invalid distance code",J.mode=_;break}J.offset=B,J.extra=P&15,J.mode=x7;case x7:if(J.extra){A=J.extra;while(W<A){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}J.offset+=K&(1<<J.extra)-1,K>>>=J.extra,W-=J.extra,J.back+=J.extra}if(J.offset>J.dmax){$.msg="invalid distance too far back",J.mode=_;break}J.mode=S7;case S7:if(U===0)break $;if(H=j-U,J.offset>H){if(H=J.offset-H,H>J.whave){if(J.sane){$.msg="invalid distance too far back",J.mode=_;break}}if(H>J.wnext)H-=J.wnext,Z=J.wsize-H;else Z=J.wnext-H;if(H>J.length)H=J.length;L=J.window}else L=Y,Z=X-J.offset,H=J.length;if(H>U)H=U;U-=H,J.length-=H;do Y[X++]=L[Z++];while(--H);if(J.length===0)J.mode=M6;break;case g7:if(U===0)break $;Y[X++]=J.length,U--,J.mode=M6;break;case B5:if(J.wrap){while(W<32){if(V===0)break $;V--,K|=q[G++]<<W,W+=8}if(j-=U,$.total_out+=j,J.total+=j,j)$.adler=J.check=J.flags?k0(J.check,Y,j,X-j):v5(J.check,Y,j,X-j);if(j=U,(J.flags?K:h7(K))!==J.check){$.msg="incorrect data check",J.mode=_;break}K=0,W=0}J.mode=T7;case T7:if(J.wrap&&J.flags){while(W<32){if(V===0)break $;V--,K+=q[G++]<<W,W+=8}if(K!==(J.total&4294967295)){$.msg="incorrect length check",J.mode=_;break}K=0,W=0}J.mode=y7;case y7:D=IK;break $;case _:D=m7;break $;case A5:return C5;case BK:default:return P0}if($.next_out=X,$.avail_out=U,$.next_in=G,$.avail_in=V,J.hold=K,J.bits=W,J.wsize||j!==$.avail_out&&J.mode<_&&(J.mode<B5||Q!==H7)){if(o7($,$.output,$.next_out,j-$.avail_out))return J.mode=A5,C5}if(F-=$.avail_in,j-=$.avail_out,$.total_in+=F,$.total_out+=j,J.total+=j,J.wrap&&j)$.adler=J.check=J.flags?k0(J.check,Y,j,$.next_out-j):v5(J.check,Y,j,$.next_out-j);if($.data_type=J.bits+(J.last?64:0)+(J.mode===b0?128:0)+(J.mode===L6||J.mode===O5?256:0),(F===0&&j===0||Q===H7)&&D===K1)D=OK;return D}function xK($){if(!$||!$.state)return P0;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,K1}function SK($,Q){var J;if(!$||!$.state)return P0;if(J=$.state,(J.wrap&2)===0)return P0;return J.head=Q,Q.done=!1,K1}function gK($,Q){var J=Q.length,q,Y,G;if(!$||!$.state)return P0;if(q=$.state,q.wrap!==0&&q.mode!==I6)return P0;if(q.mode===I6){if(Y=1,Y=v5(Y,Q,J,0),Y!==q.check)return m7}if(G=o7($,Q,J,J),G)return q.mode=A5,C5;return q.havedict=1,K1}TK.inflateReset=u7;TK.inflateReset2=d7;TK.inflateResetKeep=p7;TK.inflateInit=RK;TK.inflateInit2=l7;TK.inflate=EK;TK.inflateEnd=xK;TK.inflateGetHeader=SK;TK.inflateSetDictionary=gK;TK.inflateInfo="pako inflate (from Nodeca project)"});var R5=C((CH,n7)=>{n7.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 a7=C((AH,r7)=>{function lK(){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}r7.exports=lK});var t7=C((rK)=>{var g1=i7(),B$=y0(),N6=H5(),p=R5(),k5=V6(),oK=P5(),iK=a7(),s7=Object.prototype.toString;function W1($){if(!(this instanceof W1))return new W1($);this.options=B$.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 oK,this.strm.avail_out=0;var J=g1.inflateInit2(this.strm,Q.windowBits);if(J!==p.Z_OK)throw Error(k5[J]);if(this.header=new iK,g1.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=N6.string2buf(Q.dictionary);else if(s7.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(J=g1.inflateSetDictionary(this.strm,Q.dictionary),J!==p.Z_OK)throw Error(k5[J])}}}W1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,G,X,V,U,K,W=!1;if(this.ended)return!1;if(X=Q===~~Q?Q:Q===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof $==="string")J.input=N6.binstring2buf($);else if(s7.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new B$.Buf8(q),J.next_out=0,J.avail_out=q;if(G=g1.inflate(J,p.Z_NO_FLUSH),G===p.Z_NEED_DICT&&Y)G=g1.inflateSetDictionary(this.strm,Y);if(G===p.Z_BUF_ERROR&&W===!0)G=p.Z_OK,W=!1;if(G!==p.Z_STREAM_END&&G!==p.Z_OK)return this.onEnd(G),this.ended=!0,!1;if(J.next_out){if(J.avail_out===0||G===p.Z_STREAM_END||J.avail_in===0&&(X===p.Z_FINISH||X===p.Z_SYNC_FLUSH))if(this.options.to==="string"){if(V=N6.utf8border(J.output,J.next_out),U=J.next_out-V,K=N6.buf2string(J.output,V),J.next_out=U,J.avail_out=q-U,U)B$.arraySet(J.output,J.output,V,U,0);this.onData(K)}else this.onData(B$.shrinkBuf(J.output,J.next_out))}if(J.avail_in===0&&J.avail_out===0)W=!0}while((J.avail_in>0||J.avail_out===0)&&G!==p.Z_STREAM_END);if(G===p.Z_STREAM_END)X=p.Z_FINISH;if(X===p.Z_FINISH)return G=g1.inflateEnd(this.strm),this.onEnd(G),this.ended=!0,G===p.Z_OK;if(X===p.Z_SYNC_FLUSH)return this.onEnd(p.Z_OK),J.avail_out=0,!0;return!0};W1.prototype.onData=function($){this.chunks.push($)};W1.prototype.onEnd=function($){if($===p.Z_OK)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 E5($,Q){var J=new W1(Q);if(J.push($,!0),J.err)throw J.msg||k5[J.err];return J.result}function nK($,Q){return Q=Q||{},Q.raw=!0,E5($,Q)}rK.Inflate=W1;rK.inflate=E5;rK.inflateRaw=nK;rK.ungzip=E5});var QJ=C((kH,$J)=>{var $W=y0().assign,QW=q7(),JW=t7(),qW=R5(),e7={};$W(e7,QW,JW,qW);$J.exports=e7});var qJ=C((VW)=>{var YW=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",GW=QJ(),JJ=m(),O6=X0(),XW=YW?"uint8array":"array";VW.magic="\b\x00";function U1($,Q){O6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}JJ.inherits(U1,O6);U1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(JJ.transformTo(XW,$.data),!1)};U1.prototype.flush=function(){if(O6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};U1.prototype.cleanUp=function(){O6.prototype.cleanUp.call(this),this._pako=null};U1.prototype._createPako=function(){this._pako=new GW[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};VW.compressWorker=function($){return new U1("Deflate",$)};VW.uncompressWorker=function(){return new U1("Inflate",{})}});var x5=C((jW)=>{var YJ=X0();jW.STORE={magic:"\x00\x00",compressWorker:function(){return new YJ("STORE compression")},uncompressWorker:function(){return new YJ("STORE decompression")}};jW.DEFLATE=qJ()});var S5=C((PW)=>{PW.LOCAL_FILE_HEADER="PK\x03\x04";PW.CENTRAL_FILE_HEADER="PK\x01\x02";PW.CENTRAL_DIRECTORY_END="PK\x05\x06";PW.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";PW.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";PW.DATA_DESCRIPTOR="PK\x07\b"});var KJ=C((gH,VJ)=>{var T1=m(),y1=X0(),g5=D1(),GJ=q6(),B6=S5(),b=function($,Q){var J="",q;for(q=0;q<Q;q++)J+=String.fromCharCode($&255),$=$>>>8;return J},OW=function($,Q){var J=$;if(!$)J=Q?16893:33204;return(J&65535)<<16},BW=function($){return($||0)&63},XJ=function($,Q,J,q,Y,G){var{file:X,compression:V}=$,U=G!==g5.utf8encode,K=T1.transformTo("string",G(X.name)),W=T1.transformTo("string",g5.utf8encode(X.name)),F=X.comment,j=T1.transformTo("string",G(F)),H=T1.transformTo("string",g5.utf8encode(F)),Z=W.length!==X.name.length,L=H.length!==F.length,O,I,P="",B="",M="",z=X.dir,v=X.date,w={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||J)w.crc32=$.crc32,w.compressedSize=$.compressedSize,w.uncompressedSize=$.uncompressedSize;var D=0;if(Q)D|=8;if(!U&&(Z||L))D|=2048;var k=0,E=0;if(z)k|=16;if(Y==="UNIX")E=798,k|=OW(X.unixPermissions,z);else E=20,k|=BW(X.dosPermissions,z);if(O=v.getUTCHours(),O=O<<6,O=O|v.getUTCMinutes(),O=O<<5,O=O|v.getUTCSeconds()/2,I=v.getUTCFullYear()-1980,I=I<<4,I=I|v.getUTCMonth()+1,I=I<<5,I=I|v.getUTCDate(),Z)B=b(1,1)+b(GJ(K),4)+W,P+="up"+b(B.length,2)+B;if(L)M=b(1,1)+b(GJ(j),4)+H,P+="uc"+b(M.length,2)+M;var A="";A+=`
3
- \x00`,A+=b(D,2),A+=V.magic,A+=b(O,2),A+=b(I,2),A+=b(w.crc32,4),A+=b(w.compressedSize,4),A+=b(w.uncompressedSize,4),A+=b(K.length,2),A+=b(P.length,2);var o=B6.LOCAL_FILE_HEADER+A+K+P,W0=B6.CENTRAL_FILE_HEADER+b(E,2)+A+b(j.length,2)+"\x00\x00\x00\x00"+b(k,4)+b(q,4)+K+P+j;return{fileRecord:o,dirRecord:W0}},wW=function($,Q,J,q,Y){var G="",X=T1.transformTo("string",Y(q));return G=B6.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+b($,2)+b($,2)+b(Q,4)+b(J,4)+b(X.length,2)+X,G},DW=function($){var Q="";return Q=B6.DATA_DESCRIPTOR+b($.crc32,4)+b($.compressedSize,4)+b($.uncompressedSize,4),Q};function M0($,Q,J,q){y1.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=J,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}T1.inherits(M0,y1);M0.prototype.push=function($){var Q=$.meta.percent||0,J=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,y1.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:J?(Q+100*(J-q-1))/J:100}})};M0.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var J=XJ($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:J.fileRecord,meta:{percent:0}})}else this.accumulate=!0};M0.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,J=XJ($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(J.dirRecord),Q)this.push({data:DW($),meta:{percent:100}});else{this.push({data:J.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};M0.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 J=this.bytesWritten-$,q=wW(this.dirRecords.length,J,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};M0.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};M0.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(J){Q.processChunk(J)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(J){Q.error(J)}),this};M0.prototype.resume=function(){if(!y1.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};M0.prototype.error=function($){var Q=this._sources;if(!y1.prototype.error.call(this,$))return!1;for(var J=0;J<Q.length;J++)try{Q[J].error($)}catch(q){}return!0};M0.prototype.lock=function(){y1.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};VJ.exports=M0});var WJ=C((RW)=>{var vW=x5(),CW=KJ(),AW=function($,Q){var J=$||Q,q=vW[J];if(!q)throw Error(J+" is not a valid compression method !");return q};RW.generateWorker=function($,Q,J){var q=new CW(Q.streamFiles,J,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(G,X){Y++;var V=AW(X.options.compression,Q.compression),U=X.options.compressionOptions||Q.compressionOptions||{},K=X.dir,W=X.date;X._compressWorker(V,U).withStreamInfo("file",{name:G,dir:K,date:W,comment:X.comment||"",unixPermissions:X.unixPermissions,dosPermissions:X.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(G){q.error(G)}return q}});var jJ=C((yH,UJ)=>{var EW=m(),w6=X0();function w$($,Q){w6.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}EW.inherits(w$,w6);w$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(J){Q.push({data:J,meta:{percent:0}})}).on("error",function(J){if(Q.isPaused)this.generatedError=J;else Q.error(J)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};w$.prototype.pause=function(){if(!w6.prototype.pause.call(this))return!1;return this._stream.pause(),!0};w$.prototype.resume=function(){if(!w6.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};UJ.exports=w$});var OJ=C((hH,NJ)=>{var xW=D1(),D$=m(),ZJ=X0(),SW=b8(),zJ=f8(),FJ=Y6(),gW=H2(),TW=WJ(),HJ=J$(),yW=jJ(),LJ=function($,Q,J){var q=D$.getTypeOf(Q),Y,G=D$.extend(J||{},zJ);if(G.date=G.date||new Date,G.compression!==null)G.compression=G.compression.toUpperCase();if(typeof G.unixPermissions==="string")G.unixPermissions=parseInt(G.unixPermissions,8);if(G.unixPermissions&&G.unixPermissions&16384)G.dir=!0;if(G.dosPermissions&&G.dosPermissions&16)G.dir=!0;if(G.dir)$=MJ($);if(G.createFolders&&(Y=hW($)))IJ.call(this,Y,!0);var X=q==="string"&&G.binary===!1&&G.base64===!1;if(!J||typeof J.binary>"u")G.binary=!X;var V=Q instanceof FJ&&Q.uncompressedSize===0;if(V||G.dir||!Q||Q.length===0)G.base64=!1,G.binary=!0,Q="",G.compression="STORE",q="string";var U=null;if(Q instanceof FJ||Q instanceof ZJ)U=Q;else if(HJ.isNode&&HJ.isStream(Q))U=new yW($,Q);else U=D$.prepareContent($,Q,G.binary,G.optimizedBinaryString,G.base64);var K=new gW($,U,G);this.files[$]=K},hW=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},MJ=function($){if($.slice(-1)!=="/")$+="/";return $},IJ=function($,Q){if(Q=typeof Q<"u"?Q:zJ.createFolders,$=MJ($),!this.files[$])LJ.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function PJ($){return Object.prototype.toString.call($)==="[object RegExp]"}var bW={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,J,q;for(Q in this.files)if(q=this.files[Q],J=Q.slice(this.root.length,Q.length),J&&Q.slice(0,this.root.length)===this.root)$(J,q)},filter:function($){var Q=[];return this.forEach(function(J,q){if($(J,q))Q.push(q)}),Q},file:function($,Q,J){if(arguments.length===1)if(PJ($)){var q=$;return this.filter(function(G,X){return!X.dir&&q.test(G)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,LJ.call(this,$,Q,J);return this},folder:function($){if(!$)return this;if(PJ($))return this.filter(function(Y,G){return G.dir&&$.test(Y)});var Q=this.root+$,J=IJ.call(this,Q),q=this.clone();return q.root=J.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 J=this.filter(function(Y,G){return G.name.slice(0,$.length)===$});for(var q=0;q<J.length;q++)delete this.files[J[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,J={};try{if(J=D$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:xW.utf8encode}),J.type=J.type.toLowerCase(),J.compression=J.compression.toUpperCase(),J.type==="binarystring")J.type="string";if(!J.type)throw Error("No output type specified.");if(D$.checkSupport(J.type),J.platform==="darwin"||J.platform==="freebsd"||J.platform==="linux"||J.platform==="sunos")J.platform="UNIX";if(J.platform==="win32")J.platform="DOS";var q=J.comment||this.comment||"";Q=TW.generateWorker(this,J,q)}catch(Y){Q=new ZJ("error"),Q.error(Y)}return new SW(Q,J.type||"string",J.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};NJ.exports=bW});var T5=C((bH,wJ)=>{var fW=m();function BJ($){this.data=$,this.length=$.length,this.index=0,this.zero=0}BJ.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,J;this.checkOffset($);for(J=this.index+$-1;J>=this.index;J--)Q=(Q<<8)+this.byteAt(J);return this.index+=$,Q},readString:function($){return fW.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))}};wJ.exports=BJ});var y5=C((fH,vJ)=>{var DJ=T5(),_W=m();function h1($){DJ.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}_W.inherits(h1,DJ);h1.prototype.byteAt=function($){return this.data[this.zero+$]};h1.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var G=this.length-4;G>=0;--G)if(this.data[G]===Q&&this.data[G+1]===J&&this.data[G+2]===q&&this.data[G+3]===Y)return G-this.zero;return-1};h1.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),G=this.readData(4);return Q===G[0]&&J===G[1]&&q===G[2]&&Y===G[3]};h1.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};vJ.exports=h1});var RJ=C((_H,AJ)=>{var CJ=T5(),mW=m();function b1($){CJ.call(this,$)}mW.inherits(b1,CJ);b1.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};b1.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};b1.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};b1.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};AJ.exports=b1});var b5=C((mH,EJ)=>{var kJ=y5(),cW=m();function h5($){kJ.call(this,$)}cW.inherits(h5,kJ);h5.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};EJ.exports=h5});var gJ=C((cH,SJ)=>{var xJ=b5(),pW=m();function f5($){xJ.call(this,$)}pW.inherits(f5,xJ);f5.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};SJ.exports=f5});var _5=C((pH,yJ)=>{var D6=m(),TJ=T0(),uW=y5(),dW=RJ(),lW=gJ(),oW=b5();yJ.exports=function($){var Q=D6.getTypeOf($);if(D6.checkSupport(Q),Q==="string"&&!TJ.uint8array)return new dW($);if(Q==="nodebuffer")return new lW($);if(TJ.uint8array)return new oW(D6.transformTo("uint8array",$));return new uW(D6.transformTo("array",$))}});var _J=C((uH,fJ)=>{var m5=_5(),r0=m(),iW=Y6(),hJ=q6(),v6=D1(),C6=x5(),nW=T0(),rW=0,aW=3,sW=function($){for(var Q in C6){if(!Object.prototype.hasOwnProperty.call(C6,Q))continue;if(C6[Q].magic===$)return C6[Q]}return null};function bJ($,Q){this.options=$,this.loadOptions=Q}bJ.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,J;if($.skip(22),this.fileNameLength=$.readInt(2),J=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(J),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=sW(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+r0.pretty(this.compressionMethod)+" unknown (inner file : "+r0.transformTo("string",this.fileName)+")");this.decompressed=new iW(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,$===rW)this.dosPermissions=this.externalFileAttributes&63;if($===aW)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=m5(this.extraFields[1].value);if(this.uncompressedSize===r0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===r0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===r0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===r0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,J,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)J=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[J]={id:J,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=nW.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=v6.utf8decode(this.fileName),this.fileCommentStr=v6.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var J=r0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(J)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=r0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=m5($.value);if(Q.readInt(1)!==1)return null;if(hJ(this.fileName)!==Q.readInt(4))return null;return v6.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=m5($.value);if(Q.readInt(1)!==1)return null;if(hJ(this.fileComment)!==Q.readInt(4))return null;return v6.utf8decode(Q.readData($.length-5))}return null}};fJ.exports=bJ});var pJ=C((dH,cJ)=>{var tW=_5(),f0=m(),I0=S5(),eW=_J(),$U=T0();function mJ($){this.files=[],this.loadOptions=$}mJ.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 ("+f0.pretty(Q)+", expected "+f0.pretty($)+")")}},isSignature:function($,Q){var J=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(J),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=$U.uint8array?"uint8array":"array",J=f0.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(J)},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,J,q,Y;while(Q<$)J=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[J]={id:J,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(I0.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(I0.CENTRAL_FILE_HEADER))$=new eW({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(I0.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,I0.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 J=$;if(this.checkSignature(I0.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===f0.MAX_VALUE_16BITS||this.diskWithCentralDirStart===f0.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===f0.MAX_VALUE_16BITS||this.centralDirRecords===f0.MAX_VALUE_16BITS||this.centralDirSize===f0.MAX_VALUE_32BITS||this.centralDirOffset===f0.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(I0.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(I0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,I0.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(I0.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(I0.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=J-q;if(Y>0)if(this.isSignature(J,I0.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=tW($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};cJ.exports=mJ});var lJ=C((lH,dJ)=>{var c5=m(),A6=O1(),QU=D1(),JU=pJ(),qU=c8(),uJ=J$();function YU($){return new A6.Promise(function(Q,J){var q=$.decompressed.getContentWorker().pipe(new qU);q.on("error",function(Y){J(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)J(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}dJ.exports=function($,Q){var J=this;if(Q=c5.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:QU.utf8decode}),uJ.isNode&&uJ.isStream($))return A6.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return c5.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new JU(Q);return Y.load(q),Y}).then(function(Y){var G=[A6.Promise.resolve(Y)],X=Y.files;if(Q.checkCRC32)for(var V=0;V<X.length;V++)G.push(YU(X[V]));return A6.Promise.all(G)}).then(function(Y){var G=Y.shift(),X=G.files;for(var V=0;V<X.length;V++){var U=X[V],K=U.fileNameStr,W=c5.resolve(U.fileNameStr);if(J.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)J.file(W).unsafeOriginalName=K}if(G.zipComment.length)J.comment=G.zipComment;return J})}});var iJ=C((oH,oJ)=>{function Z0(){if(!(this instanceof Z0))return new Z0;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 Z0;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}Z0.prototype=OJ();Z0.prototype.loadAsync=lJ();Z0.support=T0();Z0.defaults=f8();Z0.version="3.10.1";Z0.loadAsync=function($,Q){return new Z0().loadAsync($,Q)};Z0.external=O1();oJ.exports=Z0});var aJ=C((iH,p5)=>{var k6=process||{},nJ=k6.argv||[],R6=k6.env||{},GU=!(!!R6.NO_COLOR||nJ.includes("--no-color"))&&(!!R6.FORCE_COLOR||nJ.includes("--color")||k6.platform==="win32"||(k6.stdout||{}).isTTY&&R6.TERM!=="dumb"||!!R6.CI),XU=($,Q,J=$)=>(q)=>{let Y=""+q,G=Y.indexOf(Q,$.length);return~G?$+VU(Y,Q,J,G)+Q:$+Y+Q},VU=($,Q,J,q)=>{let Y="",G=0;do Y+=$.substring(G,q)+J,G=q+Q.length,q=$.indexOf(Q,G);while(~q);return Y+$.substring(G)},rJ=($=GU)=>{let Q=$?XU:()=>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")}};p5.exports=rJ();p5.exports.createColors=rJ});function hU($){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 N0($,Q){if($==null||typeof $!=="object")return null;let J=$[Q];return typeof J==="string"?J:null}function D4($){let Q=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));return Q>=0?$.slice(Q+1):$}function K0($,Q=40){if($.length<=Q)return $;return`${$.slice(0,Q-1)}…`}function v4($){if($.kind==="session.start")return"Thinking…";if($.kind==="session.end")return"Done.";if($.kind==="session.waiting")return"Waiting for you…";let{toolName:Q,phase:J,toolInput:q}=$;if(J==="failed")return Q?`${K0(Q,28)} failed`:"Tool failed";let Y=hU(Q),G=J==="done";switch(Y){case"read":{let X=N0(q,"file_path")??N0(q,"path"),V=X?K0(D4(X)):null;if(V)return G?`Read ${V}`:`Reading ${V}`;return G?"Read file":"Reading file"}case"edit":case"write":{let X=N0(q,"file_path")??N0(q,"path"),V=X?K0(D4(X)):null;if(V)return G?`Edited ${V}`:`Editing ${V}`;return G?"Edited file":"Editing file"}case"bash":{let X=N0(q,"description");if(X)return K0(X,40);let V=N0(q,"command");if(V){let U=K0(V.split(/\s+/)[0]??V,24);return G?`Ran ${U}`:`Running ${U}`}return G?"Ran command":"Running command"}case"grep":{let X=N0(q,"pattern");if(X)return G?`Searched “${K0(X,28)}”`:`Searching “${K0(X,28)}”`;return G?"Searched files":"Searching files"}case"glob":{let X=N0(q,"pattern");if(X)return G?`Listed ${K0(X,28)}`:`Listing ${K0(X,28)}`;return G?"Listed files":"Listing files"}case"webfetch":{let X=N0(q,"url");if(X)try{let V=new URL(X).hostname;return G?`Fetched ${K0(V,28)}`:`Fetching ${K0(V,28)}`}catch{}return G?"Fetched web":"Searching web"}case"task":{let X=N0(q,"description")??N0(q,"subject");if(X)return G?"Subagent done":`Spawning ${K0(X,28)}`;return G?"Subagent done":"Spawning subagent"}default:{let X=K0(Q,28);return G?`Called ${X}`:`Calling ${X}`}}}var u4={};YQ(u4,{stateForEvent:()=>b4,stateBody:()=>_4,sessionTitle:()=>S4,runBubble:()=>Gj,rememberSessionTitle:()=>x4,readStdin:()=>c4,pruneSessions:()=>h4,lastAssistantText:()=>y4,eventFromArgs:()=>p4,clipTitle:()=>g4,clipPreview:()=>T4,bubbleBody:()=>m4,FAILED_DURATION_MS:()=>f4});import{closeSync as bU,existsSync as fU,fstatSync as _U,mkdirSync as mU,openSync as cU,readdirSync as pU,readFileSync as k4,readSync as uU,statSync as dU,unlinkSync as lU,writeFileSync as oU}from"node:fs";import{homedir as iU}from"node:os";import{join as j1}from"node:path";function x4($,Q,J){try{let q=g4(J);if(!q)return;mU($,{recursive:!0}),oU(j1($,`${Q}.json`),JSON.stringify({title:q,at:Date.now()}))}catch{}}function S4($,Q){try{let J=k4(j1($,`${Q}.json`),"utf8"),q=JSON.parse(J);return typeof q.title==="string"&&q.title.length>0?q.title:null}catch{return null}}function g4($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=C4)return Q;return`${Q.slice(0,C4-1)}…`}function T4($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=A4)return Q;return`${Q.slice(0,A4-1)}…`}function y4($){let Q=null;try{Q=cU($,"r");let J=_U(Q).size,q=Math.min(J,eU),Y=Buffer.alloc(q);uU(Q,Y,0,q,J-q);let G=Y.toString("utf8").split(`
4
- `);for(let X=G.length-1;X>=0;X--){let V=G[X]?.trim();if(!V)continue;let U;try{U=JSON.parse(V)}catch{continue}if(U==null||typeof U!=="object"||U.type!=="assistant")continue;let K=U.message;if(K==null||typeof K!=="object")continue;let W=K.content;if(!Array.isArray(W))continue;let F=W.filter((j)=>j!=null&&typeof j==="object"&&j.type==="text"&&typeof j.text==="string").map((j)=>j.text).join(" ").trim();if(F)return F}return null}catch{return null}finally{if(Q!==null)try{bU(Q)}catch{}}}function h4($,Q=Date.now()){try{for(let J of pU($)){if(!J.endsWith(".json"))continue;let q=j1($,J);try{if(Q-dU(q).mtimeMs>$j)lU(q)}catch{}}}catch{}}function Qj($){if(typeof $!=="string")return null;return/^[a-zA-Z0-9_-]{1,64}$/.test($)?$:null}function Jj($){if($<=127)return 0;if($>=194&&$<=223)return 1;if($>=224&&$<=239)return 2;if($>=240&&$<=244)return 3;return null}function qj($){let Q=$.length-1;while(Q>=0&&($[Q]&192)===128)Q-=1;if(Q<0)return $.length;let J=Jj($[Q]),q=$.length-Q-1;if(J!==null&&q<J)return Q;return $.length}function b4($,Q){let J=$[0];if(J==="pre"){if(Q){let q=Q.toLowerCase();if(q==="read"||q==="grep"||q==="glob")return"review"}return"running"}if(J==="post")return"idle";if(J==="tool-failure")return"failed";if(J==="stop"||J==="session-end")return"waving";if(J==="user-prompt"||J==="session-start")return"jumping";if(J==="waiting"||J==="notification")return"waiting";return null}function _4($,Q,J){let q={state:$};if(Q>0)q.duration=Q;return q.agent_source=J,q}function m4($,Q,J,q,Y){let G={text:$,busy:Q,agent_source:J};if(q)G.title=q;if(Y)G.session_id=Y;return G}async function c4($=process.stdin){if($.isTTY)return Promise.resolve("");return await new Promise((Q)=>{let J=[],q=0,Y=!1,G=()=>{if(Y)return;Y=!0,$.off("data",X),$.off("end",G),$.off("error",G);let V=Buffer.concat(J,q);Q(V.toString("utf8",0,qj(V)))},X=(V)=>{if(Y)return;let U=Buffer.isBuffer(V)?V:Buffer.from(V),K=tU-q;if(K<=0)return;let W=Buffer.from(U.subarray(0,K));J.push(W),q+=W.length};$.on("data",X),$.on("end",G),$.on("error",G),$.resume()})}function r5($){if(!$.trim())return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null};try{let Q=JSON.parse($),J=typeof Q.tool_name==="string"?Q.tool_name:null,q=Q.tool_input,Y=typeof Q.agent_source==="string"?Q.agent_source:null,G=Qj(Q.session_id),X=typeof Q.prompt==="string"?Q.prompt:null,V=typeof Q.transcript_path==="string"?Q.transcript_path:null,U=typeof Q.last_assistant_message==="string"?Q.last_assistant_message:null;return{toolName:J,toolInput:q,agentSource:Y,sessionId:G,prompt:X,transcriptPath:V,lastAssistantMessage:U}}catch{return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null}}}function p4($,Q){let J=$[0];if(!J)return null;if(J==="stop"||J==="session-end")return{kind:"session.end"};if(J==="user-prompt"||J==="session-start")return{kind:"session.start"};if(J==="waiting"||J==="notification")return{kind:"session.waiting"};if(J==="tool-failure"){let{toolName:X}=r5(Q);return{kind:"tool",phase:"failed",toolName:X??"",toolInput:void 0}}let q=J==="pre"?"running":J==="post"?"done":null;if(!q)return null;let{toolName:Y,toolInput:G}=r5(Q);if(!Y)return{kind:"tool",phase:q,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:q,toolName:Y,toolInput:G}}function Yj(){try{let $=k4(nU,"utf8").trim();return $.length>0?$:null}catch{return null}}async function R4($,Q,J){let q=new AbortController,Y=setTimeout(()=>q.abort(),300);try{await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":J},body:JSON.stringify(Q),signal:q.signal})}catch{}finally{clearTimeout(Y)}}async function Gj($){let Q=c4();if(fU(rU)){await Q;return}let J=$[1]??null,q=await Q,Y=p4($,q);if(!Y)return;let G=$[0],{toolName:X,agentSource:V,sessionId:U,prompt:K,transcriptPath:W,lastAssistantMessage:F}=r5(q),j=V??J;if(U&&K&&(G==="user-prompt"||G==="session-start"))x4(n5,U,K);let H=U?S4(n5,U):null,Z=v4(Y);if(G==="stop"||G==="session-end"){let P=F??(W?y4(W):null);if(P)Z=T4(P);h4(n5)}let L=b4($,X),O=Yj();if(!O)return;let I=[];if(Z){let P=G==="user-prompt"||G==="session-start"||G==="pre"||G==="post"||G==="tool-failure";I.push(R4(aU,m4(Z,P,j,H,U),O))}if(L){let P=G==="tool-failure"?f4:0;I.push(R4(sU,_4(L,P,j),O))}await Promise.all(I)}var a5,nU,rU,E4="http://127.0.0.1:7777",aU,sU,tU=65536,n5,C4=60,A4=110,eU=65536,$j=86400000,f4=1220;var d4=GQ(()=>{a5=j1(iU(),".petdex","runtime"),nU=j1(a5,"update-token"),rU=j1(a5,"hooks-disabled"),aU=`${E4}/bubble`,sU=`${E4}/state`,n5=j1(a5,"sessions")});var r4={};YQ(r4,{runMcpServer:()=>Zj});import{readFile as o4}from"node:fs/promises";import{homedir as i4}from"node:os";import n4 from"node:path";async function jj(){try{return(await o4(Kj,"utf8")).trim()}catch{return null}}async function Fj(){try{return await o4(Wj),!0}catch{return!1}}async function l4($,Q){let J=await jj();if(!J)return{ok:!1,status:0};try{let q=await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":J},body:JSON.stringify(Q),signal:AbortSignal.timeout(300)});return{ok:q.ok,status:q.status}}catch{return{ok:!1,status:0}}}function z0($){let Q=JSON.stringify($);if(s5==="jsonl"){process.stdout.write(`${Q}
2
+ import{createRequire as yq}from"node:module";var Cq=Object.create;var{getPrototypeOf:Aq,defineProperty:c6,getOwnPropertyNames:Rq}=Object;var kq=Object.prototype.hasOwnProperty;function Eq($){return this[$]}var gq,xq,_1=($,Q,J)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?gq??=new WeakMap:xq??=new WeakMap,G=Y.get($);if(G)return G}J=$!=null?Cq(Aq($)):{};let V=Q||!$||!$.__esModule?c6(J,"default",{value:$,enumerable:!0}):J;for(let X of Rq($))if(!kq.call(V,X))c6(V,X,{get:Eq.bind($,X),enumerable:!0});if(q)Y.set($,V);return V};var D=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var Sq=($)=>$;function Tq($,Q){this[$]=Sq.bind(null,Q)}var W4=($,Q)=>{for(var J in Q)c6($,J,{get:Q[J],enumerable:!0,configurable:!0,set:Tq.bind(Q,J)})};var j4=($,Q)=>()=>($&&(Q=$($=0)),Q);var z0=yq(import.meta.url);var o6=D((CF,C4)=>{var l6={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let J="";if($<0)J+=`\x1B[${-$}D`;else if($>0)J+=`\x1B[${$}C`;if(Q<0)J+=`\x1B[${-Q}A`;else if(Q>0)J+=`\x1B[${Q}B`;return J},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"},rq={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},aq={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 J=0;J<$;J++)Q+=this.line+(J<$-1?l6.up():"");if($)Q+=l6.left;return Q}};C4.exports={cursor:l6,scroll:rq,erase:aq,beep:"\x07"}});var o1=D((YH,G$)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)G$.exports={nextTick:vY};else G$.exports=process;function vY($,Q,J,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,G,V;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,J)});case 4:return process.nextTick(function(){$.call(null,Q,J,q)});default:G=Array(Y-1),V=0;while(V<G.length)G[V++]=arguments[V];return process.nextTick(function(){$.apply(null,G)})}}});var d4=D((GH,u4)=>{var CY={}.toString;u4.exports=Array.isArray||function($){return CY.call($)=="[object Array]"}});var i1=D((V$,o4)=>{var b8=z0("buffer"),g0=b8.Buffer;function l4($,Q){for(var J in $)Q[J]=$[J]}if(g0.from&&g0.alloc&&g0.allocUnsafe&&g0.allocUnsafeSlow)o4.exports=b8;else l4(b8,V$),V$.Buffer=H1;function H1($,Q,J){return g0($,Q,J)}l4(g0,H1);H1.from=function($,Q,J){if(typeof $==="number")throw TypeError("Argument must not be a number");return g0($,Q,J)};H1.alloc=function($,Q,J){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=g0($);if(Q!==void 0)if(typeof J==="string")q.fill(Q,J);else q.fill(Q);else q.fill(0);return q};H1.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return g0($)};H1.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return b8.SlowBuffer($)}});var P1=D((cY)=>{function AY($){if(Array.isArray)return Array.isArray($);return _8($)==="[object Array]"}cY.isArray=AY;function RY($){return typeof $==="boolean"}cY.isBoolean=RY;function kY($){return $===null}cY.isNull=kY;function EY($){return $==null}cY.isNullOrUndefined=EY;function gY($){return typeof $==="number"}cY.isNumber=gY;function xY($){return typeof $==="string"}cY.isString=xY;function SY($){return typeof $==="symbol"}cY.isSymbol=SY;function TY($){return $===void 0}cY.isUndefined=TY;function yY($){return _8($)==="[object RegExp]"}cY.isRegExp=yY;function hY($){return typeof $==="object"&&$!==null}cY.isObject=hY;function fY($){return _8($)==="[object Date]"}cY.isDate=fY;function bY($){return _8($)==="[object Error]"||$ instanceof Error}cY.isError=bY;function _Y($){return typeof $==="function"}cY.isFunction=_Y;function mY($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}cY.isPrimitive=mY;cY.isBuffer=z0("buffer").Buffer.isBuffer;function _8($){return Object.prototype.toString.call($)}});var i4=D((XH,X$)=>{if(typeof Object.create==="function")X$.exports=function(Q,J){if(J)Q.super_=J,Q.prototype=Object.create(J.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else X$.exports=function(Q,J){if(J){Q.super_=J;var q=function(){};q.prototype=J.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var Z1=D((KH,K$)=>{try{if(m8=z0("util"),typeof m8.inherits!=="function")throw"";K$.exports=m8.inherits}catch($){K$.exports=i4()}var m8});var r4=D((UH,U$)=>{function q9($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var n4=i1().Buffer,n1=z0("util");function Y9($,Q,J){$.copy(Q,J)}U$.exports=function(){function $(){q9(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(J){var q={data:J,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(J){var q={data:J,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var J=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,J},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(J){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=J+q.data;return Y},$.prototype.concat=function(J){if(this.length===0)return n4.alloc(0);var q=n4.allocUnsafe(J>>>0),Y=this.head,G=0;while(Y)Y9(Y.data,q,G),G+=Y.data.length,Y=Y.next;return q},$}();if(n1&&n1.inspect&&n1.inspect.custom)U$.exports.prototype[n1.inspect.custom]=function(){var $=n1.inspect({length:this.length});return this.constructor.name+" "+$}});var W$=D((WH,a4)=>{var c8=o1();function G9($,Q){var J=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)c8.nextTick(p8,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,c8.nextTick(p8,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(G){if(!Q&&G){if(!J._writableState)c8.nextTick(p8,J,G);else if(!J._writableState.errorEmitted)J._writableState.errorEmitted=!0,c8.nextTick(p8,J,G)}else if(Q)Q(G)}),this}function V9(){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 p8($,Q){$.emit("error",Q)}a4.exports={destroy:G9,undestroy:V9}});var t4=D((jH,s4)=>{s4.exports=z0("util").deprecate});var F$=D((FH,V5)=>{var t0=o1();V5.exports=d;function $5($){var Q=this;this.next=null,this.entry=null,this.finish=function(){D9(Q,$)}}var X9=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t0.nextTick,z1;d.WritableState=a1;var Q5=Object.create(P1());Q5.inherits=Z1();var K9={deprecate:t4()},J5=z0("stream"),d8=i1().Buffer,U9=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function W9($){return d8.from($)}function j9($){return d8.isBuffer($)||$ instanceof U9}var q5=W$();Q5.inherits(d,J5);function F9(){}function a1($,Q){z1=z1||e0(),$=$||{};var J=Q instanceof z1;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;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 V=$.decodeStrings===!1;this.decodeStrings=!V,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(X){I9(Q,X)},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 $5(this)}a1.prototype.getBuffer=function(){var Q=this.bufferedRequest,J=[];while(Q)J.push(Q),Q=Q.next;return J};(function(){try{Object.defineProperty(a1.prototype,"buffer",{get:K9.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var u8;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")u8=Function.prototype[Symbol.hasInstance],Object.defineProperty(d,Symbol.hasInstance,{value:function($){if(u8.call(this,$))return!0;if(this!==d)return!1;return $&&$._writableState instanceof a1}});else u8=function($){return $ instanceof this};function d($){if(z1=z1||e0(),!u8.call(d,this)&&!(this instanceof z1))return new d($);if(this._writableState=new a1($,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}J5.call(this)}d.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function H9($,Q){var J=Error("write after end");$.emit("error",J),t0.nextTick(Q,J)}function P9($,Q,J,q){var Y=!0,G=!1;if(J===null)G=TypeError("May not write null values to stream");else if(typeof J!=="string"&&J!==void 0&&!Q.objectMode)G=TypeError("Invalid non-string/buffer chunk");if(G)$.emit("error",G),t0.nextTick(q,G),Y=!1;return Y}d.prototype.write=function($,Q,J){var q=this._writableState,Y=!1,G=!q.objectMode&&j9($);if(G&&!d8.isBuffer($))$=W9($);if(typeof Q==="function")J=Q,Q=null;if(G)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof J!=="function")J=F9;if(q.ended)H9(this,J);else if(G||P9(this,q,$,J))q.pendingcb++,Y=z9(this,q,G,$,Q,J);return Y};d.prototype.cork=function(){var $=this._writableState;$.corked++};d.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)Y5(this,$)}};d.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 Z9($,Q,J){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=d8.from(Q,J);return Q}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function z9($,Q,J,q,Y,G){if(!J){var V=Z9(Q,q,Y);if(q!==V)J=!0,Y="buffer",q=V}var X=Q.objectMode?1:q.length;Q.length+=X;var W=Q.length<Q.highWaterMark;if(!W)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:q,encoding:Y,isBuf:J,callback:G,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else j$($,Q,!1,X,q,Y,G);return W}function j$($,Q,J,q,Y,G,V){if(Q.writelen=q,Q.writecb=V,Q.writing=!0,Q.sync=!0,J)$._writev(Y,Q.onwrite);else $._write(Y,G,Q.onwrite);Q.sync=!1}function L9($,Q,J,q,Y){if(--Q.pendingcb,J)t0.nextTick(Y,q),t0.nextTick(r1,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),r1($,Q)}function M9($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function I9($,Q){var J=$._writableState,q=J.sync,Y=J.writecb;if(M9(J),Q)L9($,J,q,Q,Y);else{var G=G5(J);if(!G&&!J.corked&&!J.bufferProcessing&&J.bufferedRequest)Y5($,J);if(q)X9(e4,$,J,G,Y);else e4($,J,G,Y)}}function e4($,Q,J,q){if(!J)N9($,Q);Q.pendingcb--,q(),r1($,Q)}function N9($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function Y5($,Q){Q.bufferProcessing=!0;var J=Q.bufferedRequest;if($._writev&&J&&J.next){var q=Q.bufferedRequestCount,Y=Array(q),G=Q.corkedRequestsFree;G.entry=J;var V=0,X=!0;while(J){if(Y[V]=J,!J.isBuf)X=!1;J=J.next,V+=1}if(Y.allBuffers=X,j$($,Q,!0,Q.length,Y,"",G.finish),Q.pendingcb++,Q.lastBufferedRequest=null,G.next)Q.corkedRequestsFree=G.next,G.next=null;else Q.corkedRequestsFree=new $5(Q);Q.bufferedRequestCount=0}else{while(J){var{chunk:W,encoding:K,callback:U}=J,F=Q.objectMode?1:W.length;if(j$($,Q,!1,F,W,K,U),J=J.next,Q.bufferedRequestCount--,Q.writing)break}if(J===null)Q.lastBufferedRequest=null}Q.bufferedRequest=J,Q.bufferProcessing=!1}d.prototype._write=function($,Q,J){J(Error("_write() is not implemented"))};d.prototype._writev=null;d.prototype.end=function($,Q,J){var q=this._writableState;if(typeof $==="function")J=$,$=null,Q=null;else if(typeof Q==="function")J=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)B9(this,q,J)};function G5($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function w9($,Q){$._final(function(J){if(Q.pendingcb--,J)$.emit("error",J);Q.prefinished=!0,$.emit("prefinish"),r1($,Q)})}function O9($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,t0.nextTick(w9,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function r1($,Q){var J=G5(Q);if(J){if(O9($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return J}function B9($,Q,J){if(Q.ending=!0,r1($,Q),J)if(Q.finished)t0.nextTick(J);else $.once("finish",J);Q.ended=!0,$.writable=!1}function D9($,Q,J){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(J),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(d.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});d.prototype.destroy=q5.destroy;d.prototype._undestroy=q5.undestroy;d.prototype._destroy=function($,Q){this.end(),Q($)}});var e0=D((HH,W5)=>{var X5=o1(),v9=Object.keys||function($){var Q=[];for(var J in $)Q.push(J);return Q};W5.exports=x0;var K5=Object.create(P1());K5.inherits=Z1();var U5=P$(),H$=F$();K5.inherits(x0,U5);{l8=v9(H$.prototype);for(s1=0;s1<l8.length;s1++)if(t1=l8[s1],!x0.prototype[t1])x0.prototype[t1]=H$.prototype[t1]}var l8,t1,s1;function x0($){if(!(this instanceof x0))return new x0($);if(U5.call(this,$),H$.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",C9)}Object.defineProperty(x0.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function C9(){if(this.allowHalfOpen||this._writableState.ended)return;X5.nextTick(A9,this)}function A9($){$.end()}Object.defineProperty(x0.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=$}});x0.prototype._destroy=function($,Q){this.push(null),this.end(),X5.nextTick(Q,$)}});var L$=D((c9)=>{var z$=i1().Buffer,j5=z$.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 R9($){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 k9($){var Q=R9($);if(typeof Q!=="string"&&(z$.isEncoding===j5||!j5($)))throw Error("Unknown encoding: "+$);return Q||$}c9.StringDecoder=e1;function e1($){this.encoding=k9($);var Q;switch(this.encoding){case"utf16le":this.text=y9,this.end=h9,Q=4;break;case"utf8":this.fillLast=x9,Q=4;break;case"base64":this.text=f9,this.end=b9,Q=3;break;default:this.write=_9,this.end=m9;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=z$.allocUnsafe(Q)}e1.prototype.write=function($){if($.length===0)return"";var Q,J;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;if(J<$.length)return Q?Q+this.text($,J):this.text($,J);return Q||""};e1.prototype.end=T9;e1.prototype.text=S9;e1.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 Z$($){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 E9($,Q,J){var q=Q.length-1;if(q<J)return 0;var Y=Z$(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<J||Y===-2)return 0;if(Y=Z$(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<J||Y===-2)return 0;if(Y=Z$(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function g9($,Q,J){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 x9($){var Q=this.lastTotal-this.lastNeed,J=g9(this,$,Q);if(J!==void 0)return J;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 S9($,Q){var J=E9(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=J;var q=$.length-(J-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function T9($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function y9($,Q){if(($.length-Q)%2===0){var J=$.toString("utf16le",Q);if(J){var q=J.charCodeAt(J.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function h9($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,J)}return Q}function f9($,Q){var J=($.length-Q)%3;if(J===0)return $.toString("base64",Q);if(this.lastNeed=3-J,this.lastTotal=3,J===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-J)}function b9($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function _9($){return $.toString(this.encoding)}function m9($){return $&&$.length?this.write($):""}});var P$=D((zH,B5)=>{var M1=o1();B5.exports=b;var u9=d4(),$8;b.ReadableState=M5;var ZH=z0("events").EventEmitter,Z5=function($,Q){return $.listeners(Q).length},O$=z0("stream"),Q8=i1().Buffer,d9=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l9($){return Q8.from($)}function o9($){return Q8.isBuffer($)||$ instanceof d9}var z5=Object.create(P1());z5.inherits=Z1();var M$=z0("util"),S=void 0;if(M$&&M$.debuglog)S=M$.debuglog("stream");else S=function(){};var i9=r4(),L5=W$(),L1;z5.inherits(b,O$);var I$=["error","close","destroy","pause","resume"];function n9($,Q,J){if(typeof $.prependListener==="function")return $.prependListener(Q,J);if(!$._events||!$._events[Q])$.on(Q,J);else if(u9($._events[Q]))$._events[Q].unshift(J);else $._events[Q]=[J,$._events[Q]]}function M5($,Q){$8=$8||e0(),$=$||{};var J=Q instanceof $8;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new i9,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(!L1)L1=L$().StringDecoder;this.decoder=new L1($.encoding),this.encoding=$.encoding}}function b($){if($8=$8||e0(),!(this instanceof b))return new b($);if(this._readableState=new M5($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}O$.call(this)}Object.defineProperty(b.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});b.prototype.destroy=L5.destroy;b.prototype._undestroy=L5.undestroy;b.prototype._destroy=function($,Q){this.push(null),Q($)};b.prototype.push=function($,Q){var J=this._readableState,q;if(!J.objectMode){if(typeof $==="string"){if(Q=Q||J.defaultEncoding,Q!==J.encoding)$=Q8.from($,Q),Q="";q=!0}}else q=!0;return I5(this,$,Q,!1,q)};b.prototype.unshift=function($){return I5(this,$,null,!0,!1)};function I5($,Q,J,q,Y){var G=$._readableState;if(Q===null)G.reading=!1,t9($,G);else{var V;if(!Y)V=r9(G,Q);if(V)$.emit("error",V);else if(G.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!G.objectMode&&Object.getPrototypeOf(Q)!==Q8.prototype)Q=l9(Q);if(q)if(G.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else N$($,G,Q,!0);else if(G.ended)$.emit("error",Error("stream.push() after EOF"));else if(G.reading=!1,G.decoder&&!J)if(Q=G.decoder.write(Q),G.objectMode||Q.length!==0)N$($,G,Q,!1);else N5($,G);else N$($,G,Q,!1)}else if(!q)G.reading=!1}return a9(G)}function N$($,Q,J,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",J),$.read(0);else{if(Q.length+=Q.objectMode?1:J.length,q)Q.buffer.unshift(J);else Q.buffer.push(J);if(Q.needReadable)o8($)}N5($,Q)}function r9($,Q){var J;if(!o9(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)J=TypeError("Invalid non-string/buffer chunk");return J}function a9($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}b.prototype.isPaused=function(){return this._readableState.flowing===!1};b.prototype.setEncoding=function($){if(!L1)L1=L$().StringDecoder;return this._readableState.decoder=new L1($),this._readableState.encoding=$,this};var F5=8388608;function s9($){if($>=F5)$=F5;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function H5($,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=s9($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}b.prototype.read=function($){S("read",$),$=parseInt($,10);var Q=this._readableState,J=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(S("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)w$(this);else o8(this);return null}if($=H5($,Q),$===0&&Q.ended){if(Q.length===0)w$(this);return null}var q=Q.needReadable;if(S("need readable",q),Q.length===0||Q.length-$<Q.highWaterMark)q=!0,S("length less than watermark",q);if(Q.ended||Q.reading)q=!1,S("reading or ended",q);else if(q){if(S("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=H5(J,Q)}var Y;if($>0)Y=w5($,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(J!==$&&Q.ended)w$(this)}if(Y!==null)this.emit("data",Y);return Y};function t9($,Q){if(Q.ended)return;if(Q.decoder){var J=Q.decoder.end();if(J&&J.length)Q.buffer.push(J),Q.length+=Q.objectMode?1:J.length}Q.ended=!0,o8($)}function o8($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(S("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)M1.nextTick(P5,$);else P5($)}function P5($){S("emit readable"),$.emit("readable"),B$($)}function N5($,Q){if(!Q.readingMore)Q.readingMore=!0,M1.nextTick(e9,$,Q)}function e9($,Q){var J=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(S("maybeReadMore read 0"),$.read(0),J===Q.length)break;else J=Q.length;Q.readingMore=!1}b.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};b.prototype.pipe=function($,Q){var J=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,S("pipe count=%d opts=%j",q.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,G=Y?X:w;if(q.endEmitted)M1.nextTick(G);else J.once("end",G);$.on("unpipe",V);function V(N,P){if(S("onunpipe"),N===J){if(P&&P.hasUnpiped===!1)P.hasUnpiped=!0,U()}}function X(){S("onend"),$.end()}var W=$G(J);$.on("drain",W);var K=!1;function U(){if(S("cleanup"),$.removeListener("close",Z),$.removeListener("finish",z),$.removeListener("drain",W),$.removeListener("error",H),$.removeListener("unpipe",V),J.removeListener("end",X),J.removeListener("end",w),J.removeListener("data",j),K=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))W()}var F=!1;J.on("data",j);function j(N){S("ondata"),F=!1;var P=$.write(N);if(P===!1&&!F){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&O5(q.pipes,$)!==-1)&&!K)S("false write response, pause",q.awaitDrain),q.awaitDrain++,F=!0;J.pause()}}function H(N){if(S("onerror",N),w(),$.removeListener("error",H),Z5($,"error")===0)$.emit("error",N)}n9($,"error",H);function Z(){$.removeListener("finish",z),w()}$.once("close",Z);function z(){S("onfinish"),$.removeListener("close",Z),w()}$.once("finish",z);function w(){S("unpipe"),J.unpipe($)}if($.emit("pipe",J),!q.flowing)S("pipe resume"),J.resume();return $};function $G($){return function(){var Q=$._readableState;if(S("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&Z5($,"data"))Q.flowing=!0,B$($)}}b.prototype.unpipe=function($){var Q=this._readableState,J={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,J);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var G=0;G<Y;G++)q[G].emit("unpipe",this,{hasUnpiped:!1});return this}var V=O5(Q.pipes,$);if(V===-1)return this;if(Q.pipes.splice(V,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,J),this};b.prototype.on=function($,Q){var J=O$.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)M1.nextTick(QG,this);else if(q.length)o8(this)}}return J};b.prototype.addListener=b.prototype.on;function QG($){S("readable nexttick read 0"),$.read(0)}b.prototype.resume=function(){var $=this._readableState;if(!$.flowing)S("resume"),$.flowing=!0,JG(this,$);return this};function JG($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,M1.nextTick(qG,$,Q)}function qG($,Q){if(!Q.reading)S("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),B$($),Q.flowing&&!Q.reading)$.read(0)}b.prototype.pause=function(){if(S("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)S("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function B$($){var Q=$._readableState;S("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}b.prototype.wrap=function($){var Q=this,J=this._readableState,q=!1;$.on("end",function(){if(S("wrapped end"),J.decoder&&!J.ended){var V=J.decoder.end();if(V&&V.length)Q.push(V)}Q.push(null)}),$.on("data",function(V){if(S("wrapped data"),J.decoder)V=J.decoder.write(V);if(J.objectMode&&(V===null||V===void 0))return;else if(!J.objectMode&&(!V||!V.length))return;var X=Q.push(V);if(!X)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(V){return function(){return $[V].apply($,arguments)}}(Y);for(var G=0;G<I$.length;G++)$.on(I$[G],this.emit.bind(this,I$[G]));return this._read=function(V){if(S("wrapped _read",V),q)q=!1,$.resume()},this};Object.defineProperty(b.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});b._fromList=w5;function w5($,Q){if(Q.length===0)return null;var J;if(Q.objectMode)J=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)J=Q.buffer.join("");else if(Q.buffer.length===1)J=Q.buffer.head.data;else J=Q.buffer.concat(Q.length);Q.buffer.clear()}else J=YG($,Q.buffer,Q.decoder);return J}function YG($,Q,J){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=J?GG($,Q):VG($,Q);return q}function GG($,Q){var J=Q.head,q=1,Y=J.data;$-=Y.length;while(J=J.next){var G=J.data,V=$>G.length?G.length:$;if(V===G.length)Y+=G;else Y+=G.slice(0,$);if($-=V,$===0){if(V===G.length)if(++q,J.next)Q.head=J.next;else Q.head=Q.tail=null;else Q.head=J,J.data=G.slice(V);break}++q}return Q.length-=q,Y}function VG($,Q){var J=Q8.allocUnsafe($),q=Q.head,Y=1;q.data.copy(J),$-=q.data.length;while(q=q.next){var G=q.data,V=$>G.length?G.length:$;if(G.copy(J,J.length-$,0,V),$-=V,$===0){if(V===G.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=G.slice(V);break}++Y}return Q.length-=Y,J}function w$($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,M1.nextTick(XG,Q,$)}function XG($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function O5($,Q){for(var J=0,q=$.length;J<q;J++)if($[J]===Q)return J;return-1}});var D$=D((LH,C5)=>{C5.exports=S0;var i8=e0(),v5=Object.create(P1());v5.inherits=Z1();v5.inherits(S0,i8);function KG($,Q){var J=this._transformState;J.transforming=!1;var q=J.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(J.writechunk=null,J.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 S0($){if(!(this instanceof S0))return new S0($);if(i8.call(this,$),this._transformState={afterTransform:KG.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",UG)}function UG(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,J){D5($,Q,J)});else D5(this,null,null)}S0.prototype.push=function($,Q){return this._transformState.needTransform=!1,i8.prototype.push.call(this,$,Q)};S0.prototype._transform=function($,Q,J){throw Error("_transform() is not implemented")};S0.prototype._write=function($,Q,J){var q=this._transformState;if(q.writecb=J,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};S0.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};S0.prototype._destroy=function($,Q){var J=this;i8.prototype._destroy.call(this,$,function(q){Q(q),J.emit("close")})};function D5($,Q,J){if(Q)return $.emit("error",Q);if(J!=null)$.push(J);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 E5=D((MH,k5)=>{k5.exports=J8;var A5=D$(),R5=Object.create(P1());R5.inherits=Z1();R5.inherits(J8,A5);function J8($){if(!(this instanceof J8))return new J8($);A5.call(this,$)}J8.prototype._transform=function($,Q,J){J(null,$)}});var v$=D((r,n8)=>{var O0=z0("stream");if(process.env.READABLE_STREAM==="disable"&&O0)n8.exports=O0,r=n8.exports=O0.Readable,r.Readable=O0.Readable,r.Writable=O0.Writable,r.Duplex=O0.Duplex,r.Transform=O0.Transform,r.PassThrough=O0.PassThrough,r.Stream=O0;else r=n8.exports=P$(),r.Stream=O0||r,r.Readable=r,r.Writable=F$(),r.Duplex=e0(),r.Transform=D$(),r.PassThrough=E5()});var T0=D((jG)=>{jG.base64=!0;jG.array=!0;jG.string=!0;jG.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";jG.nodebuffer=typeof Buffer<"u";jG.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")jG.blob=!1;else{r8=new ArrayBuffer(0);try{jG.blob=new Blob([r8],{type:"application/zip"}).size===0}catch($){try{A$=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,a8=new A$,a8.append(r8),jG.blob=a8.getBlob("application/zip").size===0}catch(Q){jG.blob=!1}}}var r8,A$,a8;try{jG.nodestream=!!v$().Readable}catch($){jG.nodestream=!1}});var R$=D((NG)=>{var MG=m(),IG=T0(),B0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";NG.encode=function($){var Q=[],J,q,Y,G,V,X,W,K=0,U=$.length,F=U,j=MG.getTypeOf($)!=="string";while(K<$.length){if(F=U-K,!j)J=$.charCodeAt(K++),q=K<U?$.charCodeAt(K++):0,Y=K<U?$.charCodeAt(K++):0;else J=$[K++],q=K<U?$[K++]:0,Y=K<U?$[K++]:0;G=J>>2,V=(J&3)<<4|q>>4,X=F>1?(q&15)<<2|Y>>6:64,W=F>2?Y&63:64,Q.push(B0.charAt(G)+B0.charAt(V)+B0.charAt(X)+B0.charAt(W))}return Q.join("")};NG.decode=function($){var Q,J,q,Y,G,V,X,W=0,K=0,U="data:";if($.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var F=$.length*3/4;if($.charAt($.length-1)===B0.charAt(64))F--;if($.charAt($.length-2)===B0.charAt(64))F--;if(F%1!==0)throw Error("Invalid base64 input, bad content length.");var j;if(IG.uint8array)j=new Uint8Array(F|0);else j=Array(F|0);while(W<$.length){if(Y=B0.indexOf($.charAt(W++)),G=B0.indexOf($.charAt(W++)),V=B0.indexOf($.charAt(W++)),X=B0.indexOf($.charAt(W++)),Q=Y<<2|G>>4,J=(G&15)<<4|V>>2,q=(V&3)<<6|X,j[K++]=Q,V!==64)j[K++]=J;if(X!==64)j[K++]=q}return j}});var q8=D((wH,g5)=>{g5.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 T5=D((BH,S5)=>{var OH=global.MutationObserver||global.WebKitMutationObserver,x5;x5=function(){process.nextTick(AG)};var BG,DG,vG,CG,k$,Y8=[];function AG(){k$=!0;var $,Q,J=Y8.length;while(J){Q=Y8,Y8=[],$=-1;while(++$<J)Q[$]();J=Y8.length}k$=!1}S5.exports=RG;function RG($){if(Y8.push($)===1&&!k$)x5()}});var c5=D((DH,m5)=>{var y5=T5();function N1(){}var t={},h5=["REJECTED"],E$=["FULFILLED"],f5=["PENDING"];I1=["UNHANDLED"];var I1;m5.exports=m0;function m0($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=f5,this.queue=[],this.outcome=void 0,this.handled=I1,$!==N1)b5(this,$)}m0.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(J,q);function J(Y){function G(){return Y}return Q.resolve($()).then(G)}function q(Y){function G(){throw Y}return Q.resolve($()).then(G)}};m0.prototype.catch=function($){return this.then(null,$)};m0.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===E$||typeof Q!=="function"&&this.state===h5)return this;var J=new this.constructor(N1);if(this.handled===I1)this.handled=null;if(this.state!==f5){var q=this.state===E$?$:Q;g$(J,q,this.outcome)}else this.queue.push(new G8(J,$,Q));return J};function G8($,Q,J){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof J==="function")this.onRejected=J,this.callRejected=this.otherCallRejected}G8.prototype.callFulfilled=function($){t.resolve(this.promise,$)};G8.prototype.otherCallFulfilled=function($){g$(this.promise,this.onFulfilled,$)};G8.prototype.callRejected=function($){t.reject(this.promise,$)};G8.prototype.otherCallRejected=function($){g$(this.promise,this.onRejected,$)};function g$($,Q,J){y5(function(){var q;try{q=Q(J)}catch(Y){return t.reject($,Y)}if(q===$)t.reject($,TypeError("Cannot resolve promise with itself"));else t.resolve($,q)})}t.resolve=function($,Q){var J=_5(kG,Q);if(J.status==="error")return t.reject($,J.value);var q=J.value;if(q)b5($,q);else{$.state=E$,$.outcome=Q;var Y=-1,G=$.queue.length;while(++Y<G)$.queue[Y].callFulfilled(Q)}return $};t.reject=function($,Q){if($.state=h5,$.outcome=Q,$.handled===I1)y5(function(){if($.handled===I1)process.emit("unhandledRejection",Q,$)});var J=-1,q=$.queue.length;while(++J<q)$.queue[J].callRejected(Q);return $};function kG($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function b5($,Q){var J=!1;function q(X){if(J)return;J=!0,t.reject($,X)}function Y(X){if(J)return;J=!0,t.resolve($,X)}function G(){Q(Y,q)}var V=_5(G);if(V.status==="error")q(V.value)}function _5($,Q){var J={};try{J.value=$(Q),J.status="success"}catch(q){J.status="error",J.value=q}return J}m0.resolve=EG;function EG($){if($ instanceof this)return $;return t.resolve(new this(N1),$)}m0.reject=gG;function gG($){var Q=new this(N1);return t.reject(Q,$)}m0.all=xG;function xG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=Array(J),G=0,V=-1,X=new this(N1);while(++V<J)W($[V],V);return X;function W(K,U){Q.resolve(K).then(F,function(j){if(!q)q=!0,t.reject(X,j)});function F(j){if(Y[U]=j,++G===J&&!q)q=!0,t.resolve(X,Y)}}}m0.race=SG;function SG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=-1,G=new this(N1);while(++Y<J)V($[Y]);return G;function V(X){Q.resolve(X).then(function(W){if(!q)q=!0,t.resolve(G,W)},function(W){if(!q)q=!0,t.reject(G,W)})}}});var w1=D((vH,p5)=>{var x$=null;if(typeof Promise<"u")x$=Promise;else x$=c5();p5.exports={Promise:x$}});var d5=D((u5)=>{(function($,Q){if($.setImmediate)return;var J=1,q={},Y=!1,G=$.document,V;function X(P){if(typeof P!=="function")P=Function(""+P);var O=Array(arguments.length-1);for(var M=0;M<O.length;M++)O[M]=arguments[M+1];var L={callback:P,args:O};return q[J]=L,V(J),J++}function W(P){delete q[P]}function K(P){var{callback:O,args:M}=P;switch(M.length){case 0:O();break;case 1:O(M[0]);break;case 2:O(M[0],M[1]);break;case 3:O(M[0],M[1],M[2]);break;default:O.apply(Q,M);break}}function U(P){if(Y)setTimeout(U,0,P);else{var O=q[P];if(O){Y=!0;try{K(O)}finally{W(P),Y=!1}}}}function F(){V=function(P){process.nextTick(function(){U(P)})}}function j(){if($.postMessage&&!$.importScripts){var P=!0,O=$.onmessage;return $.onmessage=function(){P=!1},$.postMessage("","*"),$.onmessage=O,P}}function H(){var P="setImmediate$"+Math.random()+"$",O=function(M){if(M.source===$&&typeof M.data==="string"&&M.data.indexOf(P)===0)U(+M.data.slice(P.length))};if($.addEventListener)$.addEventListener("message",O,!1);else $.attachEvent("onmessage",O);V=function(M){$.postMessage(P+M,"*")}}function Z(){var P=new MessageChannel;P.port1.onmessage=function(O){var M=O.data;U(M)},V=function(O){P.port2.postMessage(O)}}function z(){var P=G.documentElement;V=function(O){var M=G.createElement("script");M.onreadystatechange=function(){U(O),M.onreadystatechange=null,P.removeChild(M),M=null},P.appendChild(M)}}function w(){V=function(P){setTimeout(U,0,P)}}var N=Object.getPrototypeOf&&Object.getPrototypeOf($);if(N=N&&N.setTimeout?N:$,{}.toString.call($.process)==="[object process]")F();else if(j())H();else if($.MessageChannel)Z();else if(G&&"onreadystatechange"in G.createElement("script"))z();else w();N.setImmediate=X,N.clearImmediate=W})(typeof self>"u"?typeof global>"u"?u5:global:self)});var m=D((hG)=>{var c0=T0(),TG=R$(),O1=q8(),S$=w1();d5();function yG($){var Q=null;if(c0.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return t8($,Q)}hG.newBlob=function($,Q){hG.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var J=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new J;return q.append($),q.getBlob(Q)}catch(G){throw Error("Bug : can't construct the Blob.")}}};function V8($){return $}function t8($,Q){for(var J=0;J<$.length;++J)Q[J]=$.charCodeAt(J)&255;return Q}var s8={stringifyByChunk:function($,Q,J){var q=[],Y=0,G=$.length;if(G<=J)return String.fromCharCode.apply(null,$);while(Y<G){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+J,G))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+J,G))));Y+=J}return q.join("")},stringifyByChar:function($){var Q="";for(var J=0;J<$.length;J++)Q+=String.fromCharCode($[J]);return Q},applyCanBeUsed:{uint8array:function(){try{return c0.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return c0.nodebuffer&&String.fromCharCode.apply(null,O1.allocBuffer(1)).length===1}catch($){return!1}}()}};function X8($){var Q=65536,J=hG.getTypeOf($),q=!0;if(J==="uint8array")q=s8.applyCanBeUsed.uint8array;else if(J==="nodebuffer")q=s8.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return s8.stringifyByChunk($,J,Q)}catch(Y){Q=Math.floor(Q/2)}return s8.stringifyByChar($)}hG.applyFromCharCode=X8;function e8($,Q){for(var J=0;J<$.length;J++)Q[J]=$[J];return Q}var p0={};p0.string={string:V8,array:function($){return t8($,Array($.length))},arraybuffer:function($){return p0.string.uint8array($).buffer},uint8array:function($){return t8($,new Uint8Array($.length))},nodebuffer:function($){return t8($,O1.allocBuffer($.length))}};p0.array={string:X8,array:V8,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return O1.newBufferFrom($)}};p0.arraybuffer={string:function($){return X8(new Uint8Array($))},array:function($){return e8(new Uint8Array($),Array($.byteLength))},arraybuffer:V8,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return O1.newBufferFrom(new Uint8Array($))}};p0.uint8array={string:X8,array:function($){return e8($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:V8,nodebuffer:function($){return O1.newBufferFrom($)}};p0.nodebuffer={string:X8,array:function($){return e8($,Array($.length))},arraybuffer:function($){return p0.nodebuffer.uint8array($).buffer},uint8array:function($){return e8($,new Uint8Array($.length))},nodebuffer:V8};hG.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;hG.checkSupport($);var J=hG.getTypeOf(Q),q=p0[J][$](Q);return q};hG.resolve=function($){var Q=$.split("/"),J=[];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==="..")J.pop();else J.push(Y)}return J.join("/")};hG.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(c0.nodebuffer&&O1.isBuffer($))return"nodebuffer";if(c0.uint8array&&$ instanceof Uint8Array)return"uint8array";if(c0.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};hG.checkSupport=function($){var Q=c0[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};hG.MAX_VALUE_16BITS=65535;hG.MAX_VALUE_32BITS=-1;hG.pretty=function($){var Q="",J,q;for(q=0;q<($||"").length;q++)J=$.charCodeAt(q),Q+="\\x"+(J<16?"0":"")+J.toString(16).toUpperCase();return Q};hG.delay=function($,Q,J){setImmediate(function(){$.apply(J||null,Q||[])})};hG.inherits=function($,Q){var J=function(){};J.prototype=Q.prototype,$.prototype=new J};hG.extend=function(){var $={},Q,J;for(Q=0;Q<arguments.length;Q++)for(J in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],J)&&typeof $[J]>"u")$[J]=arguments[Q][J];return $};hG.prepareContent=function($,Q,J,q,Y){var G=S$.Promise.resolve(Q).then(function(V){var X=c0.blob&&(V instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(V))!==-1);if(X&&typeof FileReader<"u")return new S$.Promise(function(W,K){var U=new FileReader;U.onload=function(F){W(F.target.result)},U.onerror=function(F){K(F.target.error)},U.readAsArrayBuffer(V)});else return V});return G.then(function(V){var X=hG.getTypeOf(V);if(!X)return S$.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(X==="arraybuffer")V=hG.transformTo("uint8array",V);else if(X==="string"){if(Y)V=TG.decode(V);else if(J){if(q!==!0)V=yG(V)}}return V})}});var G0=D((RH,n5)=>{function i5($){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}i5.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 J=0;J<this._listeners[$].length;J++)this._listeners[$][J].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(J){Q.processChunk(J)}),$.on("end",function(){Q.end()}),$.on("error",function(J){Q.error(J)}),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 $}};n5.exports=i5});var D1=D((sG)=>{var B1=m(),$1=T0(),iG=q8(),$6=G0(),K8=Array(256);for(D0=0;D0<256;D0++)K8[D0]=D0>=252?6:D0>=248?5:D0>=240?4:D0>=224?3:D0>=192?2:1;var D0;K8[254]=K8[254]=1;var nG=function($){var Q,J,q,Y,G,V=$.length,X=0;for(Y=0;Y<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}X+=J<128?1:J<2048?2:J<65536?3:4}if($1.uint8array)Q=new Uint8Array(X);else Q=Array(X);for(G=0,Y=0;G<X;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q},rG=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+K8[$[J]]>Q?J:Q},aG=function($){var Q,J,q,Y,G=$.length,V=Array(G*2);for(J=0,Q=0;Q<G;){if(q=$[Q++],q<128){V[J++]=q;continue}if(Y=K8[q],Y>4){V[J++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<G)q=q<<6|$[Q++]&63,Y--;if(Y>1){V[J++]=65533;continue}if(q<65536)V[J++]=q;else q-=65536,V[J++]=55296|q>>10&1023,V[J++]=56320|q&1023}if(V.length!==J)if(V.subarray)V=V.subarray(0,J);else V.length=J;return B1.applyFromCharCode(V)};sG.utf8encode=function(Q){if($1.nodebuffer)return iG.newBufferFrom(Q,"utf-8");return nG(Q)};sG.utf8decode=function(Q){if($1.nodebuffer)return B1.transformTo("nodebuffer",Q).toString("utf-8");return Q=B1.transformTo($1.uint8array?"uint8array":"array",Q),aG(Q)};function Q6(){$6.call(this,"utf-8 decode"),this.leftOver=null}B1.inherits(Q6,$6);Q6.prototype.processChunk=function($){var Q=B1.transformTo($1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if($1.uint8array){var J=Q;Q=new Uint8Array(J.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(J,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=rG(Q),Y=Q;if(q!==Q.length)if($1.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:sG.utf8decode(Y),meta:$.meta})};Q6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:sG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};sG.Utf8DecodeWorker=Q6;function y$(){$6.call(this,"utf-8 encode")}B1.inherits(y$,$6);y$.prototype.processChunk=function($){this.push({data:sG.utf8encode($.data),meta:$.meta})};sG.Utf8EncodeWorker=y$});var e5=D((EH,t5)=>{var a5=G0(),s5=m();function f$($){a5.call(this,"ConvertWorker to "+$),this.destType=$}s5.inherits(f$,a5);f$.prototype.processChunk=function($){this.push({data:s5.transformTo(this.destType,$.data),meta:$.meta})};t5.exports=f$});var JQ=D((gH,QQ)=>{var $Q=v$().Readable,$V=m();$V.inherits(b$,$Q);function b$($,Q,J){$Q.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,G){if(!q.push(Y))q._helper.pause();if(J)J(G)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}b$.prototype._read=function(){this._helper.resume()};QQ.exports=b$});var _$=D((xH,GQ)=>{var Q1=m(),QV=e5(),JV=G0(),qV=R$(),YV=T0(),GV=w1(),qQ=null;if(YV.nodestream)try{qQ=JQ()}catch($){}function VV($,Q,J){switch($){case"blob":return Q1.newBlob(Q1.transformTo("arraybuffer",Q),J);case"base64":return qV.encode(Q);default:return Q1.transformTo($,Q)}}function XV($,Q){var J,q=0,Y=null,G=0;for(J=0;J<Q.length;J++)G+=Q[J].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(G);for(J=0;J<Q.length;J++)Y.set(Q[J],q),q+=Q[J].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function KV($,Q){return new GV.Promise(function(J,q){var Y=[],G=$._internalType,V=$._outputType,X=$._mimeType;$.on("data",function(W,K){if(Y.push(W),Q)Q(K)}).on("error",function(W){Y=[],q(W)}).on("end",function(){try{var W=VV(V,XV(G,Y),X);J(W)}catch(K){q(K)}Y=[]}).resume()})}function YQ($,Q,J){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=J,Q1.checkSupport(q),this._worker=$.pipe(new QV(q)),$.lock()}catch(Y){this._worker=new JV("error"),this._worker.error(Y)}}YQ.prototype={accumulate:function($){return KV(this,$)},on:function($,Q){var J=this;if($==="data")this._worker.on($,function(q){Q.call(J,q.data,q.meta)});else this._worker.on($,function(){Q1.delay(Q,arguments,J)});return this},resume:function(){return Q1.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(Q1.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new qQ(this,{objectMode:this._outputType!=="nodebuffer"},$)}};GQ.exports=YQ});var m$=D((UV)=>{UV.base64=!1;UV.binary=!1;UV.dir=!1;UV.createFolders=!0;UV.date=null;UV.compression=null;UV.compressionOptions=null;UV.comment=null;UV.unixPermissions=null;UV.dosPermissions=null});var c$=D((TH,VQ)=>{var J6=m(),q6=G0(),NV=16384;function v1($){q6.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(J){if(Q.dataIsReady=!0,Q.data=J,Q.max=J&&J.length||0,Q.type=J6.getTypeOf(J),!Q.isPaused)Q._tickAndRepeat()},function(J){Q.error(J)})}J6.inherits(v1,q6);v1.prototype.cleanUp=function(){q6.prototype.cleanUp.call(this),this.data=null};v1.prototype.resume=function(){if(!q6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,J6.delay(this._tickAndRepeat,[],this);return!0};v1.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)J6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};v1.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=NV,Q=null,J=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,J);break;case"uint8array":Q=this.data.subarray(this.index,J);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,J);break}return this.index=J,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};VQ.exports=v1});var Y6=D((yH,KQ)=>{var wV=m();function OV(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var XQ=OV();function BV($,Q,J,q){var Y=XQ,G=q+J;$=$^-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q[V])&255];return $^-1}function DV($,Q,J,q){var Y=XQ,G=q+J;$=$^-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q.charCodeAt(V))&255];return $^-1}KQ.exports=function(Q,J){if(typeof Q>"u"||!Q.length)return 0;var q=wV.getTypeOf(Q)!=="string";if(q)return BV(J|0,Q,Q.length,0);else return DV(J|0,Q,Q.length,0)}});var u$=D((hH,WQ)=>{var UQ=G0(),vV=Y6(),CV=m();function p$(){UQ.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}CV.inherits(p$,UQ);p$.prototype.processChunk=function($){this.streamInfo.crc32=vV($.data,this.streamInfo.crc32||0),this.push($)};WQ.exports=p$});var FQ=D((fH,jQ)=>{var AV=m(),d$=G0();function l$($){d$.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}AV.inherits(l$,d$);l$.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}d$.prototype.processChunk.call(this,$)};jQ.exports=l$});var G6=D((bH,ZQ)=>{var HQ=w1(),PQ=c$(),RV=u$(),o$=FQ();function i$($,Q,J,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=J,this.compression=q,this.compressedContent=Y}i$.prototype={getContentWorker:function(){var $=new PQ(HQ.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o$("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 PQ(HQ.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};i$.createWorkerFrom=function($,Q,J){return $.pipe(new RV).pipe(new o$("uncompressedSize")).pipe(Q.compressWorker(J)).pipe(new o$("compressedSize")).withStreamInfo("compression",Q)};ZQ.exports=i$});var IQ=D((_H,MQ)=>{var kV=_$(),EV=c$(),n$=D1(),r$=G6(),zQ=G0(),a$=function($,Q,J){this.name=$,this.dir=J.dir,this.date=J.date,this.comment=J.comment,this.unixPermissions=J.unixPermissions,this.dosPermissions=J.dosPermissions,this._data=Q,this._dataBinary=J.binary,this.options={compression:J.compression,compressionOptions:J.compressionOptions}};a$.prototype={internalStream:function($){var Q=null,J="string";try{if(!$)throw Error("No output type specified.");J=$.toLowerCase();var q=J==="string"||J==="text";if(J==="binarystring"||J==="text")J="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new n$.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new n$.Utf8DecodeWorker)}catch(G){Q=new zQ("error"),Q.error(G)}return new kV(Q,J,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof r$&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var J=this._decompressWorker();if(!this._dataBinary)J=J.pipe(new n$.Utf8EncodeWorker);return r$.createWorkerFrom(J,$,Q)}},_decompressWorker:function(){if(this._data instanceof r$)return this._data.getContentWorker();else if(this._data instanceof zQ)return this._data;else return new EV(this._data)}};var LQ=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],gV=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(U8=0;U8<LQ.length;U8++)a$.prototype[LQ[U8]]=gV;var U8;MQ.exports=a$});var y0=D((s$)=>{var yV=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function hV($,Q){return Object.prototype.hasOwnProperty.call($,Q)}s$.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var J=Q.shift();if(!J)continue;if(typeof J!=="object")throw TypeError(J+"must be non-object");for(var q in J)if(hV(J,q))$[q]=J[q]}return $};s$.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var fV={arraySet:function($,Q,J,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(J,J+q),Y);return}for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){var Q,J,q,Y,G,V;q=0;for(Q=0,J=$.length;Q<J;Q++)q+=$[Q].length;V=new Uint8Array(q),Y=0;for(Q=0,J=$.length;Q<J;Q++)G=$[Q],V.set(G,Y),Y+=G.length;return V}},bV={arraySet:function($,Q,J,q,Y){for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){return[].concat.apply([],$)}};s$.setTyped=function($){if($)s$.Buf8=Uint8Array,s$.Buf16=Uint16Array,s$.Buf32=Int32Array,s$.assign(s$,fV);else s$.Buf8=Array,s$.Buf16=Array,s$.Buf32=Array,s$.assign(s$,bV)};s$.setTyped(yV)});var uQ=D((XX)=>{var mV=y0(),cV=4,wQ=0,OQ=1,pV=2;function A1($){var Q=$.length;while(--Q>=0)$[Q]=0}var uV=0,RQ=1,dV=2,lV=3,oV=258,G2=29,Z8=256,j8=Z8+1+G2,C1=30,V2=19,kQ=2*j8+1,J1=15,e$=16,iV=7,X2=256,EQ=16,gQ=17,xQ=18,q2=[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],V6=[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],nV=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],SQ=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rV=512,h0=Array((j8+2)*2);A1(h0);var W8=Array(C1*2);A1(W8);var F8=Array(rV);A1(F8);var H8=Array(oV-lV+1);A1(H8);var K2=Array(G2);A1(K2);var X6=Array(C1);A1(X6);function $2($,Q,J,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=J,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var TQ,yQ,hQ;function Q2($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function fQ($){return $<256?F8[$]:F8[256+($>>>7)]}function P8($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function Y0($,Q,J){if($.bi_valid>e$-J)$.bi_buf|=Q<<$.bi_valid&65535,P8($,$.bi_buf),$.bi_buf=Q>>e$-$.bi_valid,$.bi_valid+=J-e$;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=J}function v0($,Q,J){Y0($,J[Q*2],J[Q*2+1])}function bQ($,Q){var J=0;do J|=$&1,$>>>=1,J<<=1;while(--Q>0);return J>>>1}function aV($){if($.bi_valid===16)P8($,$.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 sV($,Q){var{dyn_tree:J,max_code:q}=Q,Y=Q.stat_desc.static_tree,G=Q.stat_desc.has_stree,V=Q.stat_desc.extra_bits,X=Q.stat_desc.extra_base,W=Q.stat_desc.max_length,K,U,F,j,H,Z,z=0;for(j=0;j<=J1;j++)$.bl_count[j]=0;J[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<kQ;K++){if(U=$.heap[K],j=J[J[U*2+1]*2+1]+1,j>W)j=W,z++;if(J[U*2+1]=j,U>q)continue;if($.bl_count[j]++,H=0,U>=X)H=V[U-X];if(Z=J[U*2],$.opt_len+=Z*(j+H),G)$.static_len+=Z*(Y[U*2+1]+H)}if(z===0)return;do{j=W-1;while($.bl_count[j]===0)j--;$.bl_count[j]--,$.bl_count[j+1]+=2,$.bl_count[W]--,z-=2}while(z>0);for(j=W;j!==0;j--){U=$.bl_count[j];while(U!==0){if(F=$.heap[--K],F>q)continue;if(J[F*2+1]!==j)$.opt_len+=(j-J[F*2+1])*J[F*2],J[F*2+1]=j;U--}}}function _Q($,Q,J){var q=Array(J1+1),Y=0,G,V;for(G=1;G<=J1;G++)q[G]=Y=Y+J[G-1]<<1;for(V=0;V<=Q;V++){var X=$[V*2+1];if(X===0)continue;$[V*2]=bQ(q[X]++,X)}}function tV(){var $,Q,J,q,Y,G=Array(J1+1);J=0;for(q=0;q<G2-1;q++){K2[q]=J;for($=0;$<1<<q2[q];$++)H8[J++]=q}H8[J-1]=q,Y=0;for(q=0;q<16;q++){X6[q]=Y;for($=0;$<1<<V6[q];$++)F8[Y++]=q}Y>>=7;for(;q<C1;q++){X6[q]=Y<<7;for($=0;$<1<<V6[q]-7;$++)F8[256+Y++]=q}for(Q=0;Q<=J1;Q++)G[Q]=0;$=0;while($<=143)h0[$*2+1]=8,$++,G[8]++;while($<=255)h0[$*2+1]=9,$++,G[9]++;while($<=279)h0[$*2+1]=7,$++,G[7]++;while($<=287)h0[$*2+1]=8,$++,G[8]++;_Q(h0,j8+1,G);for($=0;$<C1;$++)W8[$*2+1]=5,W8[$*2]=bQ($,5);TQ=new $2(h0,q2,Z8+1,j8,J1),yQ=new $2(W8,V6,0,C1,J1),hQ=new $2([],nV,0,V2,iV)}function mQ($){var Q;for(Q=0;Q<j8;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<C1;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<V2;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[X2*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function cQ($){if($.bi_valid>8)P8($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function eV($,Q,J,q){if(cQ($),q)P8($,J),P8($,~J);mV.arraySet($.pending_buf,$.window,Q,J,$.pending),$.pending+=J}function BQ($,Q,J,q){var Y=Q*2,G=J*2;return $[Y]<$[G]||$[Y]===$[G]&&q[Q]<=q[J]}function J2($,Q,J){var q=$.heap[J],Y=J<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&BQ(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(BQ(Q,q,$.heap[Y],$.depth))break;$.heap[J]=$.heap[Y],J=Y,Y<<=1}$.heap[J]=q}function DQ($,Q,J){var q,Y,G=0,V,X;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+G*2]<<8|$.pending_buf[$.d_buf+G*2+1],Y=$.pending_buf[$.l_buf+G],G++,q===0)v0($,Y,Q);else{if(V=H8[Y],v0($,V+Z8+1,Q),X=q2[V],X!==0)Y-=K2[V],Y0($,Y,X);if(q--,V=fQ(q),v0($,V,J),X=V6[V],X!==0)q-=X6[V],Y0($,q,X)}while(G<$.last_lit);v0($,X2,Q)}function Y2($,Q){var J=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,G=Q.stat_desc.elems,V,X,W=-1,K;$.heap_len=0,$.heap_max=kQ;for(V=0;V<G;V++)if(J[V*2]!==0)$.heap[++$.heap_len]=W=V,$.depth[V]=0;else J[V*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=W<2?++W:0,J[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=q[K*2+1];Q.max_code=W;for(V=$.heap_len>>1;V>=1;V--)J2($,J,V);K=G;do V=$.heap[1],$.heap[1]=$.heap[$.heap_len--],J2($,J,1),X=$.heap[1],$.heap[--$.heap_max]=V,$.heap[--$.heap_max]=X,J[K*2]=J[V*2]+J[X*2],$.depth[K]=($.depth[V]>=$.depth[X]?$.depth[V]:$.depth[X])+1,J[V*2+1]=J[X*2+1]=K,$.heap[1]=K++,J2($,J,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],sV($,Q),_Q(J,W,$.bl_count)}function vQ($,Q,J){var q,Y=-1,G,V=Q[1],X=0,W=7,K=4;if(V===0)W=138,K=3;Q[(J+1)*2+1]=65535;for(q=0;q<=J;q++){if(G=V,V=Q[(q+1)*2+1],++X<W&&G===V)continue;else if(X<K)$.bl_tree[G*2]+=X;else if(G!==0){if(G!==Y)$.bl_tree[G*2]++;$.bl_tree[EQ*2]++}else if(X<=10)$.bl_tree[gQ*2]++;else $.bl_tree[xQ*2]++;if(X=0,Y=G,V===0)W=138,K=3;else if(G===V)W=6,K=3;else W=7,K=4}}function CQ($,Q,J){var q,Y=-1,G,V=Q[1],X=0,W=7,K=4;if(V===0)W=138,K=3;for(q=0;q<=J;q++){if(G=V,V=Q[(q+1)*2+1],++X<W&&G===V)continue;else if(X<K)do v0($,G,$.bl_tree);while(--X!==0);else if(G!==0){if(G!==Y)v0($,G,$.bl_tree),X--;v0($,EQ,$.bl_tree),Y0($,X-3,2)}else if(X<=10)v0($,gQ,$.bl_tree),Y0($,X-3,3);else v0($,xQ,$.bl_tree),Y0($,X-11,7);if(X=0,Y=G,V===0)W=138,K=3;else if(G===V)W=6,K=3;else W=7,K=4}}function $X($){var Q;vQ($,$.dyn_ltree,$.l_desc.max_code),vQ($,$.dyn_dtree,$.d_desc.max_code),Y2($,$.bl_desc);for(Q=V2-1;Q>=3;Q--)if($.bl_tree[SQ[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function QX($,Q,J,q){var Y;Y0($,Q-257,5),Y0($,J-1,5),Y0($,q-4,4);for(Y=0;Y<q;Y++)Y0($,$.bl_tree[SQ[Y]*2+1],3);CQ($,$.dyn_ltree,Q-1),CQ($,$.dyn_dtree,J-1)}function JX($){var Q=4093624447,J;for(J=0;J<=31;J++,Q>>>=1)if(Q&1&&$.dyn_ltree[J*2]!==0)return wQ;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return OQ;for(J=32;J<Z8;J++)if($.dyn_ltree[J*2]!==0)return OQ;return wQ}var AQ=!1;function qX($){if(!AQ)tV(),AQ=!0;$.l_desc=new Q2($.dyn_ltree,TQ),$.d_desc=new Q2($.dyn_dtree,yQ),$.bl_desc=new Q2($.bl_tree,hQ),$.bi_buf=0,$.bi_valid=0,mQ($)}function pQ($,Q,J,q){Y0($,(uV<<1)+(q?1:0),3),eV($,Q,J,!0)}function YX($){Y0($,RQ<<1,3),v0($,X2,h0),aV($)}function GX($,Q,J,q){var Y,G,V=0;if($.level>0){if($.strm.data_type===pV)$.strm.data_type=JX($);if(Y2($,$.l_desc),Y2($,$.d_desc),V=$X($),Y=$.opt_len+3+7>>>3,G=$.static_len+3+7>>>3,G<=Y)Y=G}else Y=G=J+5;if(J+4<=Y&&Q!==-1)pQ($,Q,J,q);else if($.strategy===cV||G===Y)Y0($,(RQ<<1)+(q?1:0),3),DQ($,h0,W8);else Y0($,(dV<<1)+(q?1:0),3),QX($,$.l_desc.max_code+1,$.d_desc.max_code+1,V+1),DQ($,$.dyn_ltree,$.dyn_dtree);if(mQ($),q)cQ($)}function VX($,Q,J){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]=J&255,$.last_lit++,Q===0)$.dyn_ltree[J*2]++;else $.matches++,Q--,$.dyn_ltree[(H8[J]+Z8+1)*2]++,$.dyn_dtree[fQ(Q)*2]++;return $.last_lit===$.lit_bufsize-1}XX._tr_init=qX;XX._tr_stored_block=pQ;XX._tr_flush_block=GX;XX._tr_tally=VX;XX._tr_align=YX});var U2=D((pH,dQ)=>{function HX($,Q,J,q){var Y=$&65535|0,G=$>>>16&65535|0,V=0;while(J!==0){V=J>2000?2000:J,J-=V;do Y=Y+Q[q++]|0,G=G+Y|0;while(--V);Y%=65521,G%=65521}return Y|G<<16|0}dQ.exports=HX});var W2=D((uH,lQ)=>{function PX(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var ZX=PX();function zX($,Q,J,q){var Y=ZX,G=q+J;$^=-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q[V])&255];return $^-1}lQ.exports=zX});var K6=D((dH,oQ)=>{oQ.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 Q7=D((rX)=>{var Q0=y0(),j0=uQ(),aQ=U2(),u0=W2(),LX=K6(),V1=0,MX=1,IX=3,n0=4,iQ=5,A0=0,nQ=1,F0=-2,NX=-3,j2=-5,wX=-1,OX=1,U6=2,BX=3,DX=4,vX=0,CX=2,H6=8,AX=9,RX=15,kX=8,EX=29,gX=256,H2=gX+1+EX,xX=30,SX=19,TX=2*H2+1,yX=15,g=3,o0=258,L0=o0+g+1,hX=32,P6=42,P2=69,W6=73,j6=91,F6=103,q1=113,L8=666,l=1,M8=2,Y1=3,E1=4,fX=3;function i0($,Q){return $.msg=LX[Q],Q}function rQ($){return($<<1)-($>4?9:0)}function l0($){var Q=$.length;while(--Q>=0)$[Q]=0}function d0($){var Q=$.state,J=Q.pending;if(J>$.avail_out)J=$.avail_out;if(J===0)return;if(Q0.arraySet($.output,Q.pending_buf,Q.pending_out,J,$.next_out),$.next_out+=J,Q.pending_out+=J,$.total_out+=J,$.avail_out-=J,Q.pending-=J,Q.pending===0)Q.pending_out=0}function a($,Q){j0._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,d0($.strm)}function x($,Q){$.pending_buf[$.pending++]=Q}function z8($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function bX($,Q,J,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,Q0.arraySet(Q,$.input,$.next_in,Y,J),$.state.wrap===1)$.adler=aQ($.adler,Q,Y,J);else if($.state.wrap===2)$.adler=u0($.adler,Q,Y,J);return $.next_in+=Y,$.total_in+=Y,Y}function sQ($,Q){var{max_chain_length:J,strstart:q}=$,Y,G,V=$.prev_length,X=$.nice_match,W=$.strstart>$.w_size-L0?$.strstart-($.w_size-L0):0,K=$.window,U=$.w_mask,F=$.prev,j=$.strstart+o0,H=K[q+V-1],Z=K[q+V];if($.prev_length>=$.good_match)J>>=2;if(X>$.lookahead)X=$.lookahead;do{if(Y=Q,K[Y+V]!==Z||K[Y+V-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<j);if(G=o0-(j-q),q=j-o0,G>V){if($.match_start=Q,V=G,G>=X)break;H=K[q+V-1],Z=K[q+V]}}while((Q=F[Q&U])>W&&--J!==0);if(V<=$.lookahead)return V;return $.lookahead}function G1($){var Q=$.w_size,J,q,Y,G,V;do{if(G=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-L0)){Q0.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,J=q;do Y=$.head[--J],$.head[J]=Y>=Q?Y-Q:0;while(--q);q=Q,J=q;do Y=$.prev[--J],$.prev[J]=Y>=Q?Y-Q:0;while(--q);G+=Q}if($.strm.avail_in===0)break;if(q=bX($.strm,$.window,$.strstart+$.lookahead,G),$.lookahead+=q,$.lookahead+$.insert>=g){V=$.strstart-$.insert,$.ins_h=$.window[V],$.ins_h=($.ins_h<<$.hash_shift^$.window[V+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[V+g-1])&$.hash_mask,$.prev[V&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=V,V++,$.insert--,$.lookahead+$.insert<g)break}}while($.lookahead<L0&&$.strm.avail_in!==0)}function _X($,Q){var J=65535;if(J>$.pending_buf_size-5)J=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(G1($),$.lookahead===0&&Q===V1)return l;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+J;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,a($,!1),$.strm.avail_out===0)return l}if($.strstart-$.block_start>=$.w_size-L0){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.strstart>$.block_start){if(a($,!1),$.strm.avail_out===0)return l}return l}function F2($,Q){var J,q;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===V1)return l;if($.lookahead===0)break}if(J=0,$.lookahead>=g)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(J!==0&&$.strstart-J<=$.w_size-L0)$.match_length=sQ($,J);if($.match_length>=g)if(q=j0._tr_tally($,$.strstart-$.match_start,$.match_length-g),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=g){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.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=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=$.strstart<g-1?$.strstart:g-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function R1($,Q){var J,q,Y;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===V1)return l;if($.lookahead===0)break}if(J=0,$.lookahead>=g)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=g-1,J!==0&&$.prev_length<$.max_lazy_match&&$.strstart-J<=$.w_size-L0){if($.match_length=sQ($,J),$.match_length<=5&&($.strategy===OX||$.match_length===g&&$.strstart-$.match_start>4096))$.match_length=g-1}if($.prev_length>=g&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-g,q=j0._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-g),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+g-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=g-1,$.strstart++,q){if(a($,!1),$.strm.avail_out===0)return l}}else if($.match_available){if(q=j0._tr_tally($,0,$.window[$.strstart-1]),q)a($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return l}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=j0._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<g-1?$.strstart:g-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function mX($,Q){var J,q,Y,G,V=$.window;for(;;){if($.lookahead<=o0){if(G1($),$.lookahead<=o0&&Q===V1)return l;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=g&&$.strstart>0){if(Y=$.strstart-1,q=V[Y],q===V[++Y]&&q===V[++Y]&&q===V[++Y]){G=$.strstart+o0;do;while(q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&Y<G);if($.match_length=o0-(G-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=g)J=j0._tr_tally($,1,$.match_length-g),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else J=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(J){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function cX($,Q){var J;for(;;){if($.lookahead===0){if(G1($),$.lookahead===0){if(Q===V1)return l;break}}if($.match_length=0,J=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,J){if(a($,!1),$.strm.avail_out===0)return l}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return l}return M8}function C0($,Q,J,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=J,this.max_chain=q,this.func=Y}var k1;k1=[new C0(0,0,0,0,_X),new C0(4,4,8,4,F2),new C0(4,5,16,8,F2),new C0(4,6,32,32,F2),new C0(4,4,16,16,R1),new C0(8,16,32,32,R1),new C0(8,16,128,128,R1),new C0(8,32,128,256,R1),new C0(32,128,258,1024,R1),new C0(32,258,258,4096,R1)];function pX($){$.window_size=2*$.w_size,l0($.head),$.max_lazy_match=k1[$.level].max_lazy,$.good_match=k1[$.level].good_length,$.nice_match=k1[$.level].nice_length,$.max_chain_length=k1[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=g-1,$.match_available=0,$.ins_h=0}function uX(){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=H6,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 Q0.Buf16(TX*2),this.dyn_dtree=new Q0.Buf16((2*xX+1)*2),this.bl_tree=new Q0.Buf16((2*SX+1)*2),l0(this.dyn_ltree),l0(this.dyn_dtree),l0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Q0.Buf16(yX+1),this.heap=new Q0.Buf16(2*H2+1),l0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Q0.Buf16(2*H2+1),l0(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 tQ($){var Q;if(!$||!$.state)return i0($,F0);if($.total_in=$.total_out=0,$.data_type=CX,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?P6:q1,$.adler=Q.wrap===2?0:1,Q.last_flush=V1,j0._tr_init(Q),A0}function eQ($){var Q=tQ($);if(Q===A0)pX($.state);return Q}function dX($,Q){if(!$||!$.state)return F0;if($.state.wrap!==2)return F0;return $.state.gzhead=Q,A0}function $7($,Q,J,q,Y,G){if(!$)return F0;var V=1;if(Q===wX)Q=6;if(q<0)V=0,q=-q;else if(q>15)V=2,q-=16;if(Y<1||Y>AX||J!==H6||q<8||q>15||Q<0||Q>9||G<0||G>DX)return i0($,F0);if(q===8)q=9;var X=new uX;return $.state=X,X.strm=$,X.wrap=V,X.gzhead=null,X.w_bits=q,X.w_size=1<<X.w_bits,X.w_mask=X.w_size-1,X.hash_bits=Y+7,X.hash_size=1<<X.hash_bits,X.hash_mask=X.hash_size-1,X.hash_shift=~~((X.hash_bits+g-1)/g),X.window=new Q0.Buf8(X.w_size*2),X.head=new Q0.Buf16(X.hash_size),X.prev=new Q0.Buf16(X.w_size),X.lit_bufsize=1<<Y+6,X.pending_buf_size=X.lit_bufsize*4,X.pending_buf=new Q0.Buf8(X.pending_buf_size),X.d_buf=1*X.lit_bufsize,X.l_buf=3*X.lit_bufsize,X.level=Q,X.strategy=G,X.method=J,eQ($)}function lX($,Q){return $7($,Q,H6,RX,kX,vX)}function oX($,Q){var J,q,Y,G;if(!$||!$.state||Q>iQ||Q<0)return $?i0($,F0):F0;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===L8&&Q!==n0)return i0($,$.avail_out===0?j2:F0);if(q.strm=$,J=q.last_flush,q.last_flush=Q,q.status===P6)if(q.wrap===2)if($.adler=0,x(q,31),x(q,139),x(q,8),!q.gzhead)x(q,0),x(q,0),x(q,0),x(q,0),x(q,0),x(q,q.level===9?2:q.strategy>=U6||q.level<2?4:0),x(q,fX),q.status=q1;else{if(x(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)),x(q,q.gzhead.time&255),x(q,q.gzhead.time>>8&255),x(q,q.gzhead.time>>16&255),x(q,q.gzhead.time>>24&255),x(q,q.level===9?2:q.strategy>=U6||q.level<2?4:0),x(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)x(q,q.gzhead.extra.length&255),x(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=u0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=P2}else{var V=H6+(q.w_bits-8<<4)<<8,X=-1;if(q.strategy>=U6||q.level<2)X=0;else if(q.level<6)X=1;else if(q.level===6)X=2;else X=3;if(V|=X<<6,q.strstart!==0)V|=hX;if(V+=31-V%31,q.status=q1,z8(q,V),q.strstart!==0)z8(q,$.adler>>>16),z8(q,$.adler&65535);$.adler=1}if(q.status===P2)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=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size)break}x(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=W6}else q.status=W6;if(q.status===W6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.name.length)G=q.gzhead.name.charCodeAt(q.gzindex++)&255;else G=0;x(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.gzindex=0,q.status=j6}else q.status=j6;if(q.status===j6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.comment.length)G=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else G=0;x(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.status=F6}else q.status=F6;if(q.status===F6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)d0($);if(q.pending+2<=q.pending_buf_size)x(q,$.adler&255),x(q,$.adler>>8&255),$.adler=0,q.status=q1}else q.status=q1;if(q.pending!==0){if(d0($),$.avail_out===0)return q.last_flush=-1,A0}else if($.avail_in===0&&rQ(Q)<=rQ(J)&&Q!==n0)return i0($,j2);if(q.status===L8&&$.avail_in!==0)return i0($,j2);if($.avail_in!==0||q.lookahead!==0||Q!==V1&&q.status!==L8){var W=q.strategy===U6?cX(q,Q):q.strategy===BX?mX(q,Q):k1[q.level].func(q,Q);if(W===Y1||W===E1)q.status=L8;if(W===l||W===Y1){if($.avail_out===0)q.last_flush=-1;return A0}if(W===M8){if(Q===MX)j0._tr_align(q);else if(Q!==iQ){if(j0._tr_stored_block(q,0,0,!1),Q===IX){if(l0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(d0($),$.avail_out===0)return q.last_flush=-1,A0}}if(Q!==n0)return A0;if(q.wrap<=0)return nQ;if(q.wrap===2)x(q,$.adler&255),x(q,$.adler>>8&255),x(q,$.adler>>16&255),x(q,$.adler>>24&255),x(q,$.total_in&255),x(q,$.total_in>>8&255),x(q,$.total_in>>16&255),x(q,$.total_in>>24&255);else z8(q,$.adler>>>16),z8(q,$.adler&65535);if(d0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?A0:nQ}function iX($){var Q;if(!$||!$.state)return F0;if(Q=$.state.status,Q!==P6&&Q!==P2&&Q!==W6&&Q!==j6&&Q!==F6&&Q!==q1&&Q!==L8)return i0($,F0);return $.state=null,Q===q1?i0($,NX):A0}function nX($,Q){var J=Q.length,q,Y,G,V,X,W,K,U;if(!$||!$.state)return F0;if(q=$.state,V=q.wrap,V===2||V===1&&q.status!==P6||q.lookahead)return F0;if(V===1)$.adler=aQ($.adler,Q,J,0);if(q.wrap=0,J>=q.w_size){if(V===0)l0(q.head),q.strstart=0,q.block_start=0,q.insert=0;U=new Q0.Buf8(q.w_size),Q0.arraySet(U,Q,J-q.w_size,q.w_size,0),Q=U,J=q.w_size}X=$.avail_in,W=$.next_in,K=$.input,$.avail_in=J,$.next_in=0,$.input=Q,G1(q);while(q.lookahead>=g){Y=q.strstart,G=q.lookahead-(g-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+g-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--G);q.strstart=Y,q.lookahead=g-1,G1(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=g-1,q.match_available=0,$.next_in=W,$.input=K,$.avail_in=X,q.wrap=V,A0}rX.deflateInit=lX;rX.deflateInit2=$7;rX.deflateReset=eQ;rX.deflateResetKeep=tQ;rX.deflateSetHeader=dX;rX.deflate=oX;rX.deflateEnd=iX;rX.deflateSetDictionary=nX;rX.deflateInfo="pako deflate (from Nodeca project)"});var Z2=D((GK)=>{var Z6=y0(),J7=!0,q7=!0;try{String.fromCharCode.apply(null,[0])}catch($){J7=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){q7=!1}var I8=new Z6.Buf8(256);for(R0=0;R0<256;R0++)I8[R0]=R0>=252?6:R0>=248?5:R0>=240?4:R0>=224?3:R0>=192?2:1;var R0;I8[254]=I8[254]=1;GK.string2buf=function($){var Q,J,q,Y,G,V=$.length,X=0;for(Y=0;Y<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}X+=J<128?1:J<2048?2:J<65536?3:4}Q=new Z6.Buf8(X);for(G=0,Y=0;G<X;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q};function Y7($,Q){if(Q<65534){if($.subarray&&q7||!$.subarray&&J7)return String.fromCharCode.apply(null,Z6.shrinkBuf($,Q))}var J="";for(var q=0;q<Q;q++)J+=String.fromCharCode($[q]);return J}GK.buf2binstring=function($){return Y7($,$.length)};GK.binstring2buf=function($){var Q=new Z6.Buf8($.length);for(var J=0,q=Q.length;J<q;J++)Q[J]=$.charCodeAt(J);return Q};GK.buf2string=function($,Q){var J,q,Y,G,V=Q||$.length,X=Array(V*2);for(q=0,J=0;J<V;){if(Y=$[J++],Y<128){X[q++]=Y;continue}if(G=I8[Y],G>4){X[q++]=65533,J+=G-1;continue}Y&=G===2?31:G===3?15:7;while(G>1&&J<V)Y=Y<<6|$[J++]&63,G--;if(G>1){X[q++]=65533;continue}if(Y<65536)X[q++]=Y;else Y-=65536,X[q++]=55296|Y>>10&1023,X[q++]=56320|Y&1023}return Y7(X,q)};GK.utf8border=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+I8[$[J]]>Q?J:Q}});var z2=D((iH,G7)=>{function jK(){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}G7.exports=jK});var U7=D((IK)=>{var N8=Q7(),w8=y0(),M2=Z2(),I2=K6(),FK=z2(),K7=Object.prototype.toString,HK=0,L2=4,g1=0,V7=1,X7=2,PK=-1,ZK=0,zK=8;function X1($){if(!(this instanceof X1))return new X1($);this.options=w8.assign({level:PK,method:zK,chunkSize:16384,windowBits:15,memLevel:8,strategy:ZK,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 FK,this.strm.avail_out=0;var J=N8.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(J!==g1)throw Error(I2[J]);if(Q.header)N8.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=M2.string2buf(Q.dictionary);else if(K7.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(J=N8.deflateSetDictionary(this.strm,q),J!==g1)throw Error(I2[J]);this._dict_set=!0}}X1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y,G;if(this.ended)return!1;if(G=Q===~~Q?Q:Q===!0?L2:HK,typeof $==="string")J.input=M2.string2buf($);else if(K7.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new w8.Buf8(q),J.next_out=0,J.avail_out=q;if(Y=N8.deflate(J,G),Y!==V7&&Y!==g1)return this.onEnd(Y),this.ended=!0,!1;if(J.avail_out===0||J.avail_in===0&&(G===L2||G===X7))if(this.options.to==="string")this.onData(M2.buf2binstring(w8.shrinkBuf(J.output,J.next_out)));else this.onData(w8.shrinkBuf(J.output,J.next_out))}while((J.avail_in>0||J.avail_out===0)&&Y!==V7);if(G===L2)return Y=N8.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===g1;if(G===X7)return this.onEnd(g1),J.avail_out=0,!0;return!0};X1.prototype.onData=function($){this.chunks.push($)};X1.prototype.onEnd=function($){if($===g1)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=w8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function N2($,Q){var J=new X1(Q);if(J.push($,!0),J.err)throw J.msg||I2[J.err];return J.result}function LK($,Q){return Q=Q||{},Q.raw=!0,N2($,Q)}function MK($,Q){return Q=Q||{},Q.gzip=!0,N2($,Q)}IK.Deflate=X1;IK.deflate=N2;IK.deflateRaw=LK;IK.gzip=MK});var j7=D((rH,W7)=>{var z6=30,DK=12;W7.exports=function(Q,J){var q,Y,G,V,X,W,K,U,F,j,H,Z,z,w,N,P,O,M,L,A,C,B,R,E,v;q=Q.state,Y=Q.next_in,E=Q.input,G=Y+(Q.avail_in-5),V=Q.next_out,v=Q.output,X=V-(J-Q.avail_out),W=V+(Q.avail_out-257),K=q.dmax,U=q.wsize,F=q.whave,j=q.wnext,H=q.window,Z=q.hold,z=q.bits,w=q.lencode,N=q.distcode,P=(1<<q.lenbits)-1,O=(1<<q.distbits)-1;$:do{if(z<15)Z+=E[Y++]<<z,z+=8,Z+=E[Y++]<<z,z+=8;M=w[Z&P];Q:for(;;){if(L=M>>>24,Z>>>=L,z-=L,L=M>>>16&255,L===0)v[V++]=M&65535;else if(L&16){if(A=M&65535,L&=15,L){if(z<L)Z+=E[Y++]<<z,z+=8;A+=Z&(1<<L)-1,Z>>>=L,z-=L}if(z<15)Z+=E[Y++]<<z,z+=8,Z+=E[Y++]<<z,z+=8;M=N[Z&O];J:for(;;){if(L=M>>>24,Z>>>=L,z-=L,L=M>>>16&255,L&16){if(C=M&65535,L&=15,z<L){if(Z+=E[Y++]<<z,z+=8,z<L)Z+=E[Y++]<<z,z+=8}if(C+=Z&(1<<L)-1,C>K){Q.msg="invalid distance too far back",q.mode=z6;break $}if(Z>>>=L,z-=L,L=V-X,C>L){if(L=C-L,L>F){if(q.sane){Q.msg="invalid distance too far back",q.mode=z6;break $}}if(B=0,R=H,j===0){if(B+=U-L,L<A){A-=L;do v[V++]=H[B++];while(--L);B=V-C,R=v}}else if(j<L){if(B+=U+j-L,L-=j,L<A){A-=L;do v[V++]=H[B++];while(--L);if(B=0,j<A){L=j,A-=L;do v[V++]=H[B++];while(--L);B=V-C,R=v}}}else if(B+=j-L,L<A){A-=L;do v[V++]=H[B++];while(--L);B=V-C,R=v}while(A>2)v[V++]=R[B++],v[V++]=R[B++],v[V++]=R[B++],A-=3;if(A){if(v[V++]=R[B++],A>1)v[V++]=R[B++]}}else{B=V-C;do v[V++]=v[B++],v[V++]=v[B++],v[V++]=v[B++],A-=3;while(A>2);if(A){if(v[V++]=v[B++],A>1)v[V++]=v[B++]}}}else if((L&64)===0){M=N[(M&65535)+(Z&(1<<L)-1)];continue J}else{Q.msg="invalid distance code",q.mode=z6;break $}break}}else if((L&64)===0){M=w[(M&65535)+(Z&(1<<L)-1)];continue Q}else if(L&32){q.mode=DK;break $}else{Q.msg="invalid literal/length code",q.mode=z6;break $}break}}while(Y<G&&V<W);A=z>>3,Y-=A,z-=A<<3,Z&=(1<<z)-1,Q.next_in=Y,Q.next_out=V,Q.avail_in=Y<G?5+(G-Y):5-(Y-G),Q.avail_out=V<W?257+(W-V):257-(V-W),q.hold=Z,q.bits=z;return}});var M7=D((aH,L7)=>{var F7=y0(),x1=15,H7=852,P7=592,Z7=0,w2=1,z7=2,vK=[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],CK=[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],AK=[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],RK=[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];L7.exports=function(Q,J,q,Y,G,V,X,W){var K=W.bits,U=0,F=0,j=0,H=0,Z=0,z=0,w=0,N=0,P=0,O=0,M,L,A,C,B,R=null,E=0,v,i=new F7.Buf16(x1+1),K0=new F7.Buf16(x1+1),y=null,e=0,U0,q0,E0;for(U=0;U<=x1;U++)i[U]=0;for(F=0;F<Y;F++)i[J[q+F]]++;Z=K;for(H=x1;H>=1;H--)if(i[H]!==0)break;if(Z>H)Z=H;if(H===0)return G[V++]=20971520,G[V++]=20971520,W.bits=1,0;for(j=1;j<H;j++)if(i[j]!==0)break;if(Z<j)Z=j;N=1;for(U=1;U<=x1;U++)if(N<<=1,N-=i[U],N<0)return-1;if(N>0&&(Q===Z7||H!==1))return-1;K0[1]=0;for(U=1;U<x1;U++)K0[U+1]=K0[U]+i[U];for(F=0;F<Y;F++)if(J[q+F]!==0)X[K0[J[q+F]]++]=F;if(Q===Z7)R=y=X,v=19;else if(Q===w2)R=vK,E-=257,y=CK,e-=257,v=256;else R=AK,y=RK,v=-1;if(O=0,F=0,U=j,B=V,z=Z,w=0,A=-1,P=1<<Z,C=P-1,Q===w2&&P>H7||Q===z7&&P>P7)return 1;for(;;){if(U0=U-w,X[F]<v)q0=0,E0=X[F];else if(X[F]>v)q0=y[e+X[F]],E0=R[E+X[F]];else q0=96,E0=0;M=1<<U-w,L=1<<z,j=L;do L-=M,G[B+(O>>w)+L]=U0<<24|q0<<16|E0|0;while(L!==0);M=1<<U-1;while(O&M)M>>=1;if(M!==0)O&=M-1,O+=M;else O=0;if(F++,--i[U]===0){if(U===H)break;U=J[q+X[F]]}if(U>Z&&(O&C)!==A){if(w===0)w=Z;B+=j,z=U-w,N=1<<z;while(z+w<H){if(N-=i[z+w],N<=0)break;z++,N<<=1}if(P+=1<<z,Q===w2&&P>H7||Q===z7&&P>P7)return 1;A=O&C,G[A]=Z<<24|z<<16|B-V|0}}if(O!==0)G[B+O]=U-w<<24|4194304|0;return W.bits=Z,0}});var e7=D((iK)=>{var V0=y0(),A2=U2(),k0=W2(),kK=j7(),O8=M7(),EK=0,d7=1,l7=2,I7=4,gK=5,L6=6,K1=0,xK=1,SK=2,H0=-2,o7=-3,R2=-4,TK=-5,N7=8,i7=1,w7=2,O7=3,B7=4,D7=5,v7=6,C7=7,A7=8,R7=9,k7=10,N6=11,f0=12,O2=13,E7=14,B2=15,g7=16,x7=17,S7=18,T7=19,M6=20,I6=21,y7=22,h7=23,f7=24,b7=25,_7=26,D2=27,m7=28,c7=29,_=30,k2=31,yK=32,hK=852,fK=592,bK=15,_K=bK;function p7($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function mK(){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 V0.Buf16(320),this.work=new V0.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function n7($){var Q;if(!$||!$.state)return H0;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=i7,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new V0.Buf32(hK),Q.distcode=Q.distdyn=new V0.Buf32(fK),Q.sane=1,Q.back=-1,K1}function r7($){var Q;if(!$||!$.state)return H0;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,n7($)}function a7($,Q){var J,q;if(!$||!$.state)return H0;if(q=$.state,Q<0)J=0,Q=-Q;else if(J=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return H0;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=J,q.wbits=Q,r7($)}function s7($,Q){var J,q;if(!$)return H0;if(q=new mK,$.state=q,q.window=null,J=a7($,Q),J!==K1)$.state=null;return J}function cK($){return s7($,_K)}var u7=!0,v2,C2;function pK($){if(u7){var Q;v2=new V0.Buf32(512),C2=new V0.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;O8(d7,$.lens,0,288,v2,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;O8(l7,$.lens,0,32,C2,0,$.work,{bits:5}),u7=!1}$.lencode=v2,$.lenbits=9,$.distcode=C2,$.distbits=5}function t7($,Q,J,q){var Y,G=$.state;if(G.window===null)G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new V0.Buf8(G.wsize);if(q>=G.wsize)V0.arraySet(G.window,Q,J-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize;else{if(Y=G.wsize-G.wnext,Y>q)Y=q;if(V0.arraySet(G.window,Q,J-q,Y,G.wnext),q-=Y,q)V0.arraySet(G.window,Q,J-q,q,0),G.wnext=q,G.whave=G.wsize;else{if(G.wnext+=Y,G.wnext===G.wsize)G.wnext=0;if(G.whave<G.wsize)G.whave+=Y}}return 0}function uK($,Q){var J,q,Y,G,V,X,W,K,U,F,j,H,Z,z,w=0,N,P,O,M,L,A,C,B,R=new V0.Buf8(4),E,v,i=[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 H0;if(J=$.state,J.mode===f0)J.mode=O2;V=$.next_out,Y=$.output,W=$.avail_out,G=$.next_in,q=$.input,X=$.avail_in,K=J.hold,U=J.bits,F=X,j=W,B=K1;$:for(;;)switch(J.mode){case i7:if(J.wrap===0){J.mode=O2;break}while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.wrap&2&&K===35615){J.check=0,R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0),K=0,U=0,J.mode=w7;break}if(J.flags=0,J.head)J.head.done=!1;if(!(J.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",J.mode=_;break}if((K&15)!==N7){$.msg="unknown compression method",J.mode=_;break}if(K>>>=4,U-=4,C=(K&15)+8,J.wbits===0)J.wbits=C;else if(C>J.wbits){$.msg="invalid window size",J.mode=_;break}J.dmax=1<<C,$.adler=J.check=1,J.mode=K&512?k7:f0,K=0,U=0;break;case w7:while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.flags=K,(J.flags&255)!==N7){$.msg="unknown compression method",J.mode=_;break}if(J.flags&57344){$.msg="unknown header flags set",J.mode=_;break}if(J.head)J.head.text=K>>8&1;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0);K=0,U=0,J.mode=O7;case O7:while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.head)J.head.time=K;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,R[2]=K>>>16&255,R[3]=K>>>24&255,J.check=k0(J.check,R,4,0);K=0,U=0,J.mode=B7;case B7:while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.head)J.head.xflags=K&255,J.head.os=K>>8;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0);K=0,U=0,J.mode=D7;case D7:if(J.flags&1024){while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.length=K,J.head)J.head.extra_len=K;if(J.flags&512)R[0]=K&255,R[1]=K>>>8&255,J.check=k0(J.check,R,2,0);K=0,U=0}else if(J.head)J.head.extra=null;J.mode=v7;case v7:if(J.flags&1024){if(H=J.length,H>X)H=X;if(H){if(J.head){if(C=J.head.extra_len-J.length,!J.head.extra)J.head.extra=Array(J.head.extra_len);V0.arraySet(J.head.extra,q,G,H,C)}if(J.flags&512)J.check=k0(J.check,q,H,G);X-=H,G+=H,J.length-=H}if(J.length)break $}J.length=0,J.mode=C7;case C7:if(J.flags&2048){if(X===0)break $;H=0;do if(C=q[G+H++],J.head&&C&&J.length<65536)J.head.name+=String.fromCharCode(C);while(C&&H<X);if(J.flags&512)J.check=k0(J.check,q,H,G);if(X-=H,G+=H,C)break $}else if(J.head)J.head.name=null;J.length=0,J.mode=A7;case A7:if(J.flags&4096){if(X===0)break $;H=0;do if(C=q[G+H++],J.head&&C&&J.length<65536)J.head.comment+=String.fromCharCode(C);while(C&&H<X);if(J.flags&512)J.check=k0(J.check,q,H,G);if(X-=H,G+=H,C)break $}else if(J.head)J.head.comment=null;J.mode=R7;case R7:if(J.flags&512){while(U<16){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(K!==(J.check&65535)){$.msg="header crc mismatch",J.mode=_;break}K=0,U=0}if(J.head)J.head.hcrc=J.flags>>9&1,J.head.done=!0;$.adler=J.check=0,J.mode=f0;break;case k7:while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}$.adler=J.check=p7(K),K=0,U=0,J.mode=N6;case N6:if(J.havedict===0)return $.next_out=V,$.avail_out=W,$.next_in=G,$.avail_in=X,J.hold=K,J.bits=U,SK;$.adler=J.check=1,J.mode=f0;case f0:if(Q===gK||Q===L6)break $;case O2:if(J.last){K>>>=U&7,U-=U&7,J.mode=D2;break}while(U<3){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}switch(J.last=K&1,K>>>=1,U-=1,K&3){case 0:J.mode=E7;break;case 1:if(pK(J),J.mode=M6,Q===L6){K>>>=2,U-=2;break $}break;case 2:J.mode=x7;break;case 3:$.msg="invalid block type",J.mode=_}K>>>=2,U-=2;break;case E7:K>>>=U&7,U-=U&7;while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",J.mode=_;break}if(J.length=K&65535,K=0,U=0,J.mode=B2,Q===L6)break $;case B2:J.mode=g7;case g7:if(H=J.length,H){if(H>X)H=X;if(H>W)H=W;if(H===0)break $;V0.arraySet(Y,q,G,H,V),X-=H,G+=H,W-=H,V+=H,J.length-=H;break}J.mode=f0;break;case x7:while(U<14){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(J.nlen=(K&31)+257,K>>>=5,U-=5,J.ndist=(K&31)+1,K>>>=5,U-=5,J.ncode=(K&15)+4,K>>>=4,U-=4,J.nlen>286||J.ndist>30){$.msg="too many length or distance symbols",J.mode=_;break}J.have=0,J.mode=S7;case S7:while(J.have<J.ncode){while(U<3){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}J.lens[i[J.have++]]=K&7,K>>>=3,U-=3}while(J.have<19)J.lens[i[J.have++]]=0;if(J.lencode=J.lendyn,J.lenbits=7,E={bits:J.lenbits},B=O8(EK,J.lens,0,19,J.lencode,0,J.work,E),J.lenbits=E.bits,B){$.msg="invalid code lengths set",J.mode=_;break}J.have=0,J.mode=T7;case T7:while(J.have<J.nlen+J.ndist){for(;;){if(w=J.lencode[K&(1<<J.lenbits)-1],N=w>>>24,P=w>>>16&255,O=w&65535,N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(O<16)K>>>=N,U-=N,J.lens[J.have++]=O;else{if(O===16){v=N+2;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(K>>>=N,U-=N,J.have===0){$.msg="invalid bit length repeat",J.mode=_;break}C=J.lens[J.have-1],H=3+(K&3),K>>>=2,U-=2}else if(O===17){v=N+3;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=N,U-=N,C=0,H=3+(K&7),K>>>=3,U-=3}else{v=N+7;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=N,U-=N,C=0,H=11+(K&127),K>>>=7,U-=7}if(J.have+H>J.nlen+J.ndist){$.msg="invalid bit length repeat",J.mode=_;break}while(H--)J.lens[J.have++]=C}}if(J.mode===_)break;if(J.lens[256]===0){$.msg="invalid code -- missing end-of-block",J.mode=_;break}if(J.lenbits=9,E={bits:J.lenbits},B=O8(d7,J.lens,0,J.nlen,J.lencode,0,J.work,E),J.lenbits=E.bits,B){$.msg="invalid literal/lengths set",J.mode=_;break}if(J.distbits=6,J.distcode=J.distdyn,E={bits:J.distbits},B=O8(l7,J.lens,J.nlen,J.ndist,J.distcode,0,J.work,E),J.distbits=E.bits,B){$.msg="invalid distances set",J.mode=_;break}if(J.mode=M6,Q===L6)break $;case M6:J.mode=I6;case I6:if(X>=6&&W>=258){if($.next_out=V,$.avail_out=W,$.next_in=G,$.avail_in=X,J.hold=K,J.bits=U,kK($,j),V=$.next_out,Y=$.output,W=$.avail_out,G=$.next_in,q=$.input,X=$.avail_in,K=J.hold,U=J.bits,J.mode===f0)J.back=-1;break}J.back=0;for(;;){if(w=J.lencode[K&(1<<J.lenbits)-1],N=w>>>24,P=w>>>16&255,O=w&65535,N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(P&&(P&240)===0){M=N,L=P,A=O;for(;;){if(w=J.lencode[A+((K&(1<<M+L)-1)>>M)],N=w>>>24,P=w>>>16&255,O=w&65535,M+N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=M,U-=M,J.back+=M}if(K>>>=N,U-=N,J.back+=N,J.length=O,P===0){J.mode=_7;break}if(P&32){J.back=-1,J.mode=f0;break}if(P&64){$.msg="invalid literal/length code",J.mode=_;break}J.extra=P&15,J.mode=y7;case y7:if(J.extra){v=J.extra;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}J.length+=K&(1<<J.extra)-1,K>>>=J.extra,U-=J.extra,J.back+=J.extra}J.was=J.length,J.mode=h7;case h7:for(;;){if(w=J.distcode[K&(1<<J.distbits)-1],N=w>>>24,P=w>>>16&255,O=w&65535,N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if((P&240)===0){M=N,L=P,A=O;for(;;){if(w=J.distcode[A+((K&(1<<M+L)-1)>>M)],N=w>>>24,P=w>>>16&255,O=w&65535,M+N<=U)break;if(X===0)break $;X--,K+=q[G++]<<U,U+=8}K>>>=M,U-=M,J.back+=M}if(K>>>=N,U-=N,J.back+=N,P&64){$.msg="invalid distance code",J.mode=_;break}J.offset=O,J.extra=P&15,J.mode=f7;case f7:if(J.extra){v=J.extra;while(U<v){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}J.offset+=K&(1<<J.extra)-1,K>>>=J.extra,U-=J.extra,J.back+=J.extra}if(J.offset>J.dmax){$.msg="invalid distance too far back",J.mode=_;break}J.mode=b7;case b7:if(W===0)break $;if(H=j-W,J.offset>H){if(H=J.offset-H,H>J.whave){if(J.sane){$.msg="invalid distance too far back",J.mode=_;break}}if(H>J.wnext)H-=J.wnext,Z=J.wsize-H;else Z=J.wnext-H;if(H>J.length)H=J.length;z=J.window}else z=Y,Z=V-J.offset,H=J.length;if(H>W)H=W;W-=H,J.length-=H;do Y[V++]=z[Z++];while(--H);if(J.length===0)J.mode=I6;break;case _7:if(W===0)break $;Y[V++]=J.length,W--,J.mode=I6;break;case D2:if(J.wrap){while(U<32){if(X===0)break $;X--,K|=q[G++]<<U,U+=8}if(j-=W,$.total_out+=j,J.total+=j,j)$.adler=J.check=J.flags?k0(J.check,Y,j,V-j):A2(J.check,Y,j,V-j);if(j=W,(J.flags?K:p7(K))!==J.check){$.msg="incorrect data check",J.mode=_;break}K=0,U=0}J.mode=m7;case m7:if(J.wrap&&J.flags){while(U<32){if(X===0)break $;X--,K+=q[G++]<<U,U+=8}if(K!==(J.total&4294967295)){$.msg="incorrect length check",J.mode=_;break}K=0,U=0}J.mode=c7;case c7:B=xK;break $;case _:B=o7;break $;case k2:return R2;case yK:default:return H0}if($.next_out=V,$.avail_out=W,$.next_in=G,$.avail_in=X,J.hold=K,J.bits=U,J.wsize||j!==$.avail_out&&J.mode<_&&(J.mode<D2||Q!==I7)){if(t7($,$.output,$.next_out,j-$.avail_out))return J.mode=k2,R2}if(F-=$.avail_in,j-=$.avail_out,$.total_in+=F,$.total_out+=j,J.total+=j,J.wrap&&j)$.adler=J.check=J.flags?k0(J.check,Y,j,$.next_out-j):A2(J.check,Y,j,$.next_out-j);if($.data_type=J.bits+(J.last?64:0)+(J.mode===f0?128:0)+(J.mode===M6||J.mode===B2?256:0),(F===0&&j===0||Q===I7)&&B===K1)B=TK;return B}function dK($){if(!$||!$.state)return H0;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,K1}function lK($,Q){var J;if(!$||!$.state)return H0;if(J=$.state,(J.wrap&2)===0)return H0;return J.head=Q,Q.done=!1,K1}function oK($,Q){var J=Q.length,q,Y,G;if(!$||!$.state)return H0;if(q=$.state,q.wrap!==0&&q.mode!==N6)return H0;if(q.mode===N6){if(Y=1,Y=A2(Y,Q,J,0),Y!==q.check)return o7}if(G=t7($,Q,J,J),G)return q.mode=k2,R2;return q.havedict=1,K1}iK.inflateReset=r7;iK.inflateReset2=a7;iK.inflateResetKeep=n7;iK.inflateInit=cK;iK.inflateInit2=s7;iK.inflate=uK;iK.inflateEnd=dK;iK.inflateGetHeader=lK;iK.inflateSetDictionary=oK;iK.inflateInfo="pako inflate (from Nodeca project)"});var E2=D((tH,$J)=>{$J.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 JJ=D((eH,QJ)=>{function YU(){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}QJ.exports=YU});var YJ=D((KU)=>{var S1=e7(),B8=y0(),w6=Z2(),p=E2(),g2=K6(),GU=z2(),VU=JJ(),qJ=Object.prototype.toString;function U1($){if(!(this instanceof U1))return new U1($);this.options=B8.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 GU,this.strm.avail_out=0;var J=S1.inflateInit2(this.strm,Q.windowBits);if(J!==p.Z_OK)throw Error(g2[J]);if(this.header=new VU,S1.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=w6.string2buf(Q.dictionary);else if(qJ.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(J=S1.inflateSetDictionary(this.strm,Q.dictionary),J!==p.Z_OK)throw Error(g2[J])}}}U1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,G,V,X,W,K,U=!1;if(this.ended)return!1;if(V=Q===~~Q?Q:Q===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof $==="string")J.input=w6.binstring2buf($);else if(qJ.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new B8.Buf8(q),J.next_out=0,J.avail_out=q;if(G=S1.inflate(J,p.Z_NO_FLUSH),G===p.Z_NEED_DICT&&Y)G=S1.inflateSetDictionary(this.strm,Y);if(G===p.Z_BUF_ERROR&&U===!0)G=p.Z_OK,U=!1;if(G!==p.Z_STREAM_END&&G!==p.Z_OK)return this.onEnd(G),this.ended=!0,!1;if(J.next_out){if(J.avail_out===0||G===p.Z_STREAM_END||J.avail_in===0&&(V===p.Z_FINISH||V===p.Z_SYNC_FLUSH))if(this.options.to==="string"){if(X=w6.utf8border(J.output,J.next_out),W=J.next_out-X,K=w6.buf2string(J.output,X),J.next_out=W,J.avail_out=q-W,W)B8.arraySet(J.output,J.output,X,W,0);this.onData(K)}else this.onData(B8.shrinkBuf(J.output,J.next_out))}if(J.avail_in===0&&J.avail_out===0)U=!0}while((J.avail_in>0||J.avail_out===0)&&G!==p.Z_STREAM_END);if(G===p.Z_STREAM_END)V=p.Z_FINISH;if(V===p.Z_FINISH)return G=S1.inflateEnd(this.strm),this.onEnd(G),this.ended=!0,G===p.Z_OK;if(V===p.Z_SYNC_FLUSH)return this.onEnd(p.Z_OK),J.avail_out=0,!0;return!0};U1.prototype.onData=function($){this.chunks.push($)};U1.prototype.onEnd=function($){if($===p.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=B8.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function x2($,Q){var J=new U1(Q);if(J.push($,!0),J.err)throw J.msg||g2[J.err];return J.result}function XU($,Q){return Q=Q||{},Q.raw=!0,x2($,Q)}KU.Inflate=U1;KU.inflate=x2;KU.inflateRaw=XU;KU.ungzip=x2});var XJ=D((QP,VJ)=>{var HU=y0().assign,PU=U7(),ZU=YJ(),zU=E2(),GJ={};HU(GJ,PU,ZU,zU);VJ.exports=GJ});var UJ=D((NU)=>{var LU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",MU=XJ(),KJ=m(),O6=G0(),IU=LU?"uint8array":"array";NU.magic="\b\x00";function W1($,Q){O6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}KJ.inherits(W1,O6);W1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(KJ.transformTo(IU,$.data),!1)};W1.prototype.flush=function(){if(O6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};W1.prototype.cleanUp=function(){O6.prototype.cleanUp.call(this),this._pako=null};W1.prototype._createPako=function(){this._pako=new MU[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};NU.compressWorker=function($){return new W1("Deflate",$)};NU.uncompressWorker=function(){return new W1("Inflate",{})}});var S2=D((DU)=>{var WJ=G0();DU.STORE={magic:"\x00\x00",compressWorker:function(){return new WJ("STORE compression")},uncompressWorker:function(){return new WJ("STORE decompression")}};DU.DEFLATE=UJ()});var T2=D((AU)=>{AU.LOCAL_FILE_HEADER="PK\x03\x04";AU.CENTRAL_FILE_HEADER="PK\x01\x02";AU.CENTRAL_DIRECTORY_END="PK\x05\x06";AU.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";AU.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";AU.DATA_DESCRIPTOR="PK\x07\b"});var PJ=D((GP,HJ)=>{var T1=m(),y1=G0(),y2=D1(),jJ=Y6(),B6=T2(),f=function($,Q){var J="",q;for(q=0;q<Q;q++)J+=String.fromCharCode($&255),$=$>>>8;return J},TU=function($,Q){var J=$;if(!$)J=Q?16893:33204;return(J&65535)<<16},yU=function($){return($||0)&63},FJ=function($,Q,J,q,Y,G){var{file:V,compression:X}=$,W=G!==y2.utf8encode,K=T1.transformTo("string",G(V.name)),U=T1.transformTo("string",y2.utf8encode(V.name)),F=V.comment,j=T1.transformTo("string",G(F)),H=T1.transformTo("string",y2.utf8encode(F)),Z=U.length!==V.name.length,z=H.length!==F.length,w,N,P="",O="",M="",L=V.dir,A=V.date,C={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||J)C.crc32=$.crc32,C.compressedSize=$.compressedSize,C.uncompressedSize=$.uncompressedSize;var B=0;if(Q)B|=8;if(!W&&(Z||z))B|=2048;var R=0,E=0;if(L)R|=16;if(Y==="UNIX")E=798,R|=TU(V.unixPermissions,L);else E=20,R|=yU(V.dosPermissions,L);if(w=A.getUTCHours(),w=w<<6,w=w|A.getUTCMinutes(),w=w<<5,w=w|A.getUTCSeconds()/2,N=A.getUTCFullYear()-1980,N=N<<4,N=N|A.getUTCMonth()+1,N=N<<5,N=N|A.getUTCDate(),Z)O=f(1,1)+f(jJ(K),4)+U,P+="up"+f(O.length,2)+O;if(z)M=f(1,1)+f(jJ(j),4)+H,P+="uc"+f(M.length,2)+M;var v="";v+=`
3
+ \x00`,v+=f(B,2),v+=X.magic,v+=f(w,2),v+=f(N,2),v+=f(C.crc32,4),v+=f(C.compressedSize,4),v+=f(C.uncompressedSize,4),v+=f(K.length,2),v+=f(P.length,2);var i=B6.LOCAL_FILE_HEADER+v+K+P,K0=B6.CENTRAL_FILE_HEADER+f(E,2)+v+f(j.length,2)+"\x00\x00\x00\x00"+f(R,4)+f(q,4)+K+P+j;return{fileRecord:i,dirRecord:K0}},hU=function($,Q,J,q,Y){var G="",V=T1.transformTo("string",Y(q));return G=B6.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+f($,2)+f($,2)+f(Q,4)+f(J,4)+f(V.length,2)+V,G},fU=function($){var Q="";return Q=B6.DATA_DESCRIPTOR+f($.crc32,4)+f($.compressedSize,4)+f($.uncompressedSize,4),Q};function M0($,Q,J,q){y1.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=J,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}T1.inherits(M0,y1);M0.prototype.push=function($){var Q=$.meta.percent||0,J=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,y1.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:J?(Q+100*(J-q-1))/J:100}})};M0.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var J=FJ($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:J.fileRecord,meta:{percent:0}})}else this.accumulate=!0};M0.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,J=FJ($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(J.dirRecord),Q)this.push({data:fU($),meta:{percent:100}});else{this.push({data:J.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};M0.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 J=this.bytesWritten-$,q=hU(this.dirRecords.length,J,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};M0.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};M0.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(J){Q.processChunk(J)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(J){Q.error(J)}),this};M0.prototype.resume=function(){if(!y1.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};M0.prototype.error=function($){var Q=this._sources;if(!y1.prototype.error.call(this,$))return!1;for(var J=0;J<Q.length;J++)try{Q[J].error($)}catch(q){}return!0};M0.prototype.lock=function(){y1.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};HJ.exports=M0});var ZJ=D((cU)=>{var bU=S2(),_U=PJ(),mU=function($,Q){var J=$||Q,q=bU[J];if(!q)throw Error(J+" is not a valid compression method !");return q};cU.generateWorker=function($,Q,J){var q=new _U(Q.streamFiles,J,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(G,V){Y++;var X=mU(V.options.compression,Q.compression),W=V.options.compressionOptions||Q.compressionOptions||{},K=V.dir,U=V.date;V._compressWorker(X,W).withStreamInfo("file",{name:G,dir:K,date:U,comment:V.comment||"",unixPermissions:V.unixPermissions,dosPermissions:V.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(G){q.error(G)}return q}});var LJ=D((XP,zJ)=>{var uU=m(),D6=G0();function D8($,Q){D6.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}uU.inherits(D8,D6);D8.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(J){Q.push({data:J,meta:{percent:0}})}).on("error",function(J){if(Q.isPaused)this.generatedError=J;else Q.error(J)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};D8.prototype.pause=function(){if(!D6.prototype.pause.call(this))return!1;return this._stream.pause(),!0};D8.prototype.resume=function(){if(!D6.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};zJ.exports=D8});var AJ=D((KP,CJ)=>{var dU=D1(),v8=m(),wJ=G0(),lU=_$(),OJ=m$(),MJ=G6(),oU=IQ(),iU=ZJ(),IJ=q8(),nU=LJ(),BJ=function($,Q,J){var q=v8.getTypeOf(Q),Y,G=v8.extend(J||{},OJ);if(G.date=G.date||new Date,G.compression!==null)G.compression=G.compression.toUpperCase();if(typeof G.unixPermissions==="string")G.unixPermissions=parseInt(G.unixPermissions,8);if(G.unixPermissions&&G.unixPermissions&16384)G.dir=!0;if(G.dosPermissions&&G.dosPermissions&16)G.dir=!0;if(G.dir)$=DJ($);if(G.createFolders&&(Y=rU($)))vJ.call(this,Y,!0);var V=q==="string"&&G.binary===!1&&G.base64===!1;if(!J||typeof J.binary>"u")G.binary=!V;var X=Q instanceof MJ&&Q.uncompressedSize===0;if(X||G.dir||!Q||Q.length===0)G.base64=!1,G.binary=!0,Q="",G.compression="STORE",q="string";var W=null;if(Q instanceof MJ||Q instanceof wJ)W=Q;else if(IJ.isNode&&IJ.isStream(Q))W=new nU($,Q);else W=v8.prepareContent($,Q,G.binary,G.optimizedBinaryString,G.base64);var K=new oU($,W,G);this.files[$]=K},rU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},DJ=function($){if($.slice(-1)!=="/")$+="/";return $},vJ=function($,Q){if(Q=typeof Q<"u"?Q:OJ.createFolders,$=DJ($),!this.files[$])BJ.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function NJ($){return Object.prototype.toString.call($)==="[object RegExp]"}var aU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,J,q;for(Q in this.files)if(q=this.files[Q],J=Q.slice(this.root.length,Q.length),J&&Q.slice(0,this.root.length)===this.root)$(J,q)},filter:function($){var Q=[];return this.forEach(function(J,q){if($(J,q))Q.push(q)}),Q},file:function($,Q,J){if(arguments.length===1)if(NJ($)){var q=$;return this.filter(function(G,V){return!V.dir&&q.test(G)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,BJ.call(this,$,Q,J);return this},folder:function($){if(!$)return this;if(NJ($))return this.filter(function(Y,G){return G.dir&&$.test(Y)});var Q=this.root+$,J=vJ.call(this,Q),q=this.clone();return q.root=J.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 J=this.filter(function(Y,G){return G.name.slice(0,$.length)===$});for(var q=0;q<J.length;q++)delete this.files[J[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,J={};try{if(J=v8.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:dU.utf8encode}),J.type=J.type.toLowerCase(),J.compression=J.compression.toUpperCase(),J.type==="binarystring")J.type="string";if(!J.type)throw Error("No output type specified.");if(v8.checkSupport(J.type),J.platform==="darwin"||J.platform==="freebsd"||J.platform==="linux"||J.platform==="sunos")J.platform="UNIX";if(J.platform==="win32")J.platform="DOS";var q=J.comment||this.comment||"";Q=iU.generateWorker(this,J,q)}catch(Y){Q=new wJ("error"),Q.error(Y)}return new lU(Q,J.type||"string",J.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};CJ.exports=aU});var h2=D((UP,kJ)=>{var sU=m();function RJ($){this.data=$,this.length=$.length,this.index=0,this.zero=0}RJ.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,J;this.checkOffset($);for(J=this.index+$-1;J>=this.index;J--)Q=(Q<<8)+this.byteAt(J);return this.index+=$,Q},readString:function($){return sU.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))}};kJ.exports=RJ});var f2=D((WP,gJ)=>{var EJ=h2(),tU=m();function h1($){EJ.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}tU.inherits(h1,EJ);h1.prototype.byteAt=function($){return this.data[this.zero+$]};h1.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var G=this.length-4;G>=0;--G)if(this.data[G]===Q&&this.data[G+1]===J&&this.data[G+2]===q&&this.data[G+3]===Y)return G-this.zero;return-1};h1.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),G=this.readData(4);return Q===G[0]&&J===G[1]&&q===G[2]&&Y===G[3]};h1.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};gJ.exports=h1});var TJ=D((jP,SJ)=>{var xJ=h2(),eU=m();function f1($){xJ.call(this,$)}eU.inherits(f1,xJ);f1.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};f1.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};f1.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};f1.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};SJ.exports=f1});var _2=D((FP,hJ)=>{var yJ=f2(),$W=m();function b2($){yJ.call(this,$)}$W.inherits(b2,yJ);b2.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};hJ.exports=b2});var _J=D((HP,bJ)=>{var fJ=_2(),QW=m();function m2($){fJ.call(this,$)}QW.inherits(m2,fJ);m2.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};bJ.exports=m2});var c2=D((PP,cJ)=>{var v6=m(),mJ=T0(),JW=f2(),qW=TJ(),YW=_J(),GW=_2();cJ.exports=function($){var Q=v6.getTypeOf($);if(v6.checkSupport(Q),Q==="string"&&!mJ.uint8array)return new qW($);if(Q==="nodebuffer")return new YW($);if(mJ.uint8array)return new GW(v6.transformTo("uint8array",$));return new JW(v6.transformTo("array",$))}});var lJ=D((ZP,dJ)=>{var p2=c2(),r0=m(),VW=G6(),pJ=Y6(),C6=D1(),A6=S2(),XW=T0(),KW=0,UW=3,WW=function($){for(var Q in A6){if(!Object.prototype.hasOwnProperty.call(A6,Q))continue;if(A6[Q].magic===$)return A6[Q]}return null};function uJ($,Q){this.options=$,this.loadOptions=Q}uJ.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,J;if($.skip(22),this.fileNameLength=$.readInt(2),J=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(J),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=WW(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+r0.pretty(this.compressionMethod)+" unknown (inner file : "+r0.transformTo("string",this.fileName)+")");this.decompressed=new VW(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,$===KW)this.dosPermissions=this.externalFileAttributes&63;if($===UW)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=p2(this.extraFields[1].value);if(this.uncompressedSize===r0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===r0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===r0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===r0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,J,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)J=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[J]={id:J,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=XW.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=C6.utf8decode(this.fileName),this.fileCommentStr=C6.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var J=r0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(J)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=r0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=p2($.value);if(Q.readInt(1)!==1)return null;if(pJ(this.fileName)!==Q.readInt(4))return null;return C6.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=p2($.value);if(Q.readInt(1)!==1)return null;if(pJ(this.fileComment)!==Q.readInt(4))return null;return C6.utf8decode(Q.readData($.length-5))}return null}};dJ.exports=uJ});var nJ=D((zP,iJ)=>{var jW=c2(),b0=m(),I0=T2(),FW=lJ(),HW=T0();function oJ($){this.files=[],this.loadOptions=$}oJ.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 ("+b0.pretty(Q)+", expected "+b0.pretty($)+")")}},isSignature:function($,Q){var J=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(J),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=HW.uint8array?"uint8array":"array",J=b0.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(J)},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,J,q,Y;while(Q<$)J=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[J]={id:J,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(I0.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(I0.CENTRAL_FILE_HEADER))$=new FW({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(I0.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,I0.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 J=$;if(this.checkSignature(I0.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===b0.MAX_VALUE_16BITS||this.diskWithCentralDirStart===b0.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===b0.MAX_VALUE_16BITS||this.centralDirRecords===b0.MAX_VALUE_16BITS||this.centralDirSize===b0.MAX_VALUE_32BITS||this.centralDirOffset===b0.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(I0.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(I0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,I0.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(I0.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(I0.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=J-q;if(Y>0)if(this.isSignature(J,I0.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=jW($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};iJ.exports=oJ});var sJ=D((LP,aJ)=>{var u2=m(),R6=w1(),PW=D1(),ZW=nJ(),zW=u$(),rJ=q8();function LW($){return new R6.Promise(function(Q,J){var q=$.decompressed.getContentWorker().pipe(new zW);q.on("error",function(Y){J(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)J(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}aJ.exports=function($,Q){var J=this;if(Q=u2.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:PW.utf8decode}),rJ.isNode&&rJ.isStream($))return R6.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return u2.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new ZW(Q);return Y.load(q),Y}).then(function(Y){var G=[R6.Promise.resolve(Y)],V=Y.files;if(Q.checkCRC32)for(var X=0;X<V.length;X++)G.push(LW(V[X]));return R6.Promise.all(G)}).then(function(Y){var G=Y.shift(),V=G.files;for(var X=0;X<V.length;X++){var W=V[X],K=W.fileNameStr,U=u2.resolve(W.fileNameStr);if(J.file(U,W.decompressed,{binary:!0,optimizedBinaryString:!0,date:W.date,dir:W.dir,comment:W.fileCommentStr.length?W.fileCommentStr:null,unixPermissions:W.unixPermissions,dosPermissions:W.dosPermissions,createFolders:Q.createFolders}),!W.dir)J.file(U).unsafeOriginalName=K}if(G.zipComment.length)J.comment=G.zipComment;return J})}});var d2=D((MP,tJ)=>{function P0(){if(!(this instanceof P0))return new P0;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 P0;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}P0.prototype=AJ();P0.prototype.loadAsync=sJ();P0.support=T0();P0.defaults=m$();P0.version="3.10.1";P0.loadAsync=function($,Q){return new P0().loadAsync($,Q)};P0.external=w1();tJ.exports=P0});var Q3=D((IP,l2)=>{var E6=process||{},eJ=E6.argv||[],k6=E6.env||{},MW=!(!!k6.NO_COLOR||eJ.includes("--no-color"))&&(!!k6.FORCE_COLOR||eJ.includes("--color")||E6.platform==="win32"||(E6.stdout||{}).isTTY&&k6.TERM!=="dumb"||!!k6.CI),IW=($,Q,J=$)=>(q)=>{let Y=""+q,G=Y.indexOf(Q,$.length);return~G?$+NW(Y,Q,J,G)+Q:$+Y+Q},NW=($,Q,J,q)=>{let Y="",G=0;do Y+=$.substring(G,q)+J,G=q+Q.length,q=$.indexOf(Q,G);while(~q);return Y+$.substring(G)},$3=($=MW)=>{let Q=$?IW:()=>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")}};l2.exports=$3();l2.exports.createColors=$3});function jj($){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 N0($,Q){if($==null||typeof $!=="object")return null;let J=$[Q];return typeof J==="string"?J:null}function b3($){let Q=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));return Q>=0?$.slice(Q+1):$}function X0($,Q=40){if($.length<=Q)return $;return`${$.slice(0,Q-1)}…`}function _3($){if($.kind==="session.start")return"Thinking…";if($.kind==="session.end")return"Done.";if($.kind==="session.waiting")return"Waiting for you…";let{toolName:Q,phase:J,toolInput:q}=$;if(J==="failed")return Q?`${X0(Q,28)} failed`:"Tool failed";let Y=jj(Q),G=J==="done";switch(Y){case"read":{let V=N0(q,"file_path")??N0(q,"path"),X=V?X0(b3(V)):null;if(X)return G?`Read ${X}`:`Reading ${X}`;return G?"Read file":"Reading file"}case"edit":case"write":{let V=N0(q,"file_path")??N0(q,"path"),X=V?X0(b3(V)):null;if(X)return G?`Edited ${X}`:`Editing ${X}`;return G?"Edited file":"Editing file"}case"bash":{let V=N0(q,"description");if(V)return X0(V,40);let X=N0(q,"command");if(X){let W=X0(X.split(/\s+/)[0]??X,24);return G?`Ran ${W}`:`Running ${W}`}return G?"Ran command":"Running command"}case"grep":{let V=N0(q,"pattern");if(V)return G?`Searched “${X0(V,28)}”`:`Searching “${X0(V,28)}”`;return G?"Searched files":"Searching files"}case"glob":{let V=N0(q,"pattern");if(V)return G?`Listed ${X0(V,28)}`:`Listing ${X0(V,28)}`;return G?"Listed files":"Listing files"}case"webfetch":{let V=N0(q,"url");if(V)try{let X=new URL(V).hostname;return G?`Fetched ${X0(X,28)}`:`Fetching ${X0(X,28)}`}catch{}return G?"Fetched web":"Searching web"}case"task":{let V=N0(q,"description")??N0(q,"subject");if(V)return G?"Subagent done":`Spawning ${X0(V,28)}`;return G?"Subagent done":"Spawning subagent"}default:{let V=X0(Q,28);return G?`Called ${V}`:`Calling ${V}`}}}var qq={};W4(qq,{stateForEvent:()=>s3,stateBody:()=>e3,sessionTitle:()=>o3,runBubble:()=>Tj,rememberSessionTitle:()=>l3,readStdin:()=>Qq,pruneSessions:()=>a3,lastAssistantText:()=>r3,eventFromArgs:()=>Jq,clipTitle:()=>i3,clipPreview:()=>n3,bubbleBody:()=>$q,FAILED_DURATION_MS:()=>t3});import{closeSync as Fj,existsSync as Hj,fstatSync as Pj,mkdirSync as Zj,openSync as zj,readdirSync as Lj,readFileSync as u3,readSync as Mj,statSync as Ij,unlinkSync as Nj,writeFileSync as wj}from"node:fs";import{homedir as Oj}from"node:os";import{join as j1}from"node:path";function l3($,Q,J){try{let q=i3(J);if(!q)return;Zj($,{recursive:!0}),wj(j1($,`${Q}.json`),JSON.stringify({title:q,at:Date.now()}))}catch{}}function o3($,Q){try{let J=u3(j1($,`${Q}.json`),"utf8"),q=JSON.parse(J);return typeof q.title==="string"&&q.title.length>0?q.title:null}catch{return null}}function i3($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=m3)return Q;return`${Q.slice(0,m3-1)}…`}function n3($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=c3)return Q;return`${Q.slice(0,c3-1)}…`}function r3($){let Q=null;try{Q=zj($,"r");let J=Pj(Q).size,q=Math.min(J,Rj),Y=Buffer.alloc(q);Mj(Q,Y,0,q,J-q);let G=Y.toString("utf8").split(`
4
+ `);for(let V=G.length-1;V>=0;V--){let X=G[V]?.trim();if(!X)continue;let W;try{W=JSON.parse(X)}catch{continue}if(W==null||typeof W!=="object"||W.type!=="assistant")continue;let K=W.message;if(K==null||typeof K!=="object")continue;let U=K.content;if(!Array.isArray(U))continue;let F=U.filter((j)=>j!=null&&typeof j==="object"&&j.type==="text"&&typeof j.text==="string").map((j)=>j.text).join(" ").trim();if(F)return F}return null}catch{return null}finally{if(Q!==null)try{Fj(Q)}catch{}}}function a3($,Q=Date.now()){try{for(let J of Lj($)){if(!J.endsWith(".json"))continue;let q=j1($,J);try{if(Q-Ij(q).mtimeMs>kj)Nj(q)}catch{}}}catch{}}function Ej($){if(typeof $!=="string")return null;return/^[a-zA-Z0-9_-]{1,64}$/.test($)?$:null}function gj($){if($<=127)return 0;if($>=194&&$<=223)return 1;if($>=224&&$<=239)return 2;if($>=240&&$<=244)return 3;return null}function xj($){let Q=$.length-1;while(Q>=0&&($[Q]&192)===128)Q-=1;if(Q<0)return $.length;let J=gj($[Q]),q=$.length-Q-1;if(J!==null&&q<J)return Q;return $.length}function s3($,Q){let J=$[0];if(J==="pre"){if(Q){let q=Q.toLowerCase();if(q==="read"||q==="grep"||q==="glob")return"review"}return"running"}if(J==="post")return"idle";if(J==="tool-failure")return"failed";if(J==="stop"||J==="session-end")return"waving";if(J==="user-prompt"||J==="session-start")return"jumping";if(J==="waiting"||J==="notification")return"waiting";return null}function e3($,Q,J){let q={state:$};if(Q>0)q.duration=Q;return q.agent_source=J,q}function $q($,Q,J,q,Y){let G={text:$,busy:Q,agent_source:J};if(q)G.title=q;if(Y)G.session_id=Y;return G}async function Qq($=process.stdin){if($.isTTY)return Promise.resolve("");return await new Promise((Q)=>{let J=[],q=0,Y=!1,G=()=>{if(Y)return;Y=!0,$.off("data",V),$.off("end",G),$.off("error",G);let X=Buffer.concat(J,q);Q(X.toString("utf8",0,xj(X)))},V=(X)=>{if(Y)return;let W=Buffer.isBuffer(X)?X:Buffer.from(X),K=Aj-q;if(K<=0)return;let U=Buffer.from(W.subarray(0,K));J.push(U),q+=U.length};$.on("data",V),$.on("end",G),$.on("error",G),$.resume()})}function J4($){if(!$.trim())return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null};try{let Q=JSON.parse($),J=typeof Q.tool_name==="string"?Q.tool_name:null,q=Q.tool_input,Y=typeof Q.agent_source==="string"?Q.agent_source:null,G=Ej(Q.session_id),V=typeof Q.prompt==="string"?Q.prompt:null,X=typeof Q.transcript_path==="string"?Q.transcript_path:null,W=typeof Q.last_assistant_message==="string"?Q.last_assistant_message:null;return{toolName:J,toolInput:q,agentSource:Y,sessionId:G,prompt:V,transcriptPath:X,lastAssistantMessage:W}}catch{return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null}}}function Jq($,Q){let J=$[0];if(!J)return null;if(J==="stop"||J==="session-end")return{kind:"session.end"};if(J==="user-prompt"||J==="session-start")return{kind:"session.start"};if(J==="waiting"||J==="notification")return{kind:"session.waiting"};if(J==="tool-failure"){let{toolName:V}=J4(Q);return{kind:"tool",phase:"failed",toolName:V??"",toolInput:void 0}}let q=J==="pre"?"running":J==="post"?"done":null;if(!q)return null;let{toolName:Y,toolInput:G}=J4(Q);if(!Y)return{kind:"tool",phase:q,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:q,toolName:Y,toolInput:G}}function Sj(){try{let $=u3(Bj,"utf8").trim();return $.length>0?$:null}catch{return null}}async function p3($,Q,J){let q=new AbortController,Y=setTimeout(()=>q.abort(),300);try{await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":J},body:JSON.stringify(Q),signal:q.signal})}catch{}finally{clearTimeout(Y)}}async function Tj($){let Q=Qq();if(Hj(Dj)){await Q;return}let J=$[1]??null,q=await Q,Y=Jq($,q);if(!Y)return;let G=$[0],{toolName:V,agentSource:X,sessionId:W,prompt:K,transcriptPath:U,lastAssistantMessage:F}=J4(q),j=X??J;if(W&&K&&(G==="user-prompt"||G==="session-start"))l3(Q4,W,K);let H=W?o3(Q4,W):null,Z=_3(Y);if(G==="stop"||G==="session-end"){let P=F??(U?r3(U):null);if(P)Z=n3(P);a3(Q4)}let z=s3($,V),w=Sj();if(!w)return;let N=[];if(Z){let P=G==="user-prompt"||G==="session-start"||G==="pre"||G==="post"||G==="tool-failure";N.push(p3(vj,$q(Z,P,j,H,W),w))}if(z){let P=G==="tool-failure"?t3:0;N.push(p3(Cj,e3(z,P,j),w))}await Promise.all(N)}var q4,Bj,Dj,d3="http://127.0.0.1:7777",vj,Cj,Aj=65536,Q4,m3=60,c3=110,Rj=65536,kj=86400000,t3=1220;var Yq=j4(()=>{q4=j1(Oj(),".petdex","runtime"),Bj=j1(q4,"update-token"),Dj=j1(q4,"hooks-disabled"),vj=`${d3}/bubble`,Cj=`${d3}/state`,Q4=j1(q4,"sessions")});var Uq={};W4(Uq,{runMcpServer:()=>dj});import{readFile as Vq}from"node:fs/promises";import{homedir as Xq}from"node:os";import Kq from"node:path";async function mj(){try{return(await Vq(fj,"utf8")).trim()}catch{return null}}async function cj(){try{return await Vq(bj),!0}catch{return!1}}async function Gq($,Q){let J=await mj();if(!J)return{ok:!1,status:0};try{let q=await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":J},body:JSON.stringify(Q),signal:AbortSignal.timeout(300)});return{ok:q.ok,status:q.status}}catch{return{ok:!1,status:0}}}function Z0($){let Q=JSON.stringify($);if(Y4==="jsonl"){process.stdout.write(`${Q}
5
5
  `);return}let q=`Content-Length: ${new TextEncoder().encode(Q).length}\r
6
6
  \r
7
- `;process.stdout.write(q),process.stdout.write(Q)}function v$($,Q,J){return{jsonrpc:"2.0",id:$,error:{code:Q,message:J}}}async function Pj($){let{id:Q,method:J,params:q}=$;switch(J){case"initialize":{let Y=q?.protocolVersion??"2025-03-26";z0({jsonrpc:"2.0",id:Q,result:{protocolVersion:Y,capabilities:{tools:{listChanged:!1}},serverInfo:{name:"petdex-mcp-server",version:Uj}}});return}case"tools/list":{z0({jsonrpc:"2.0",id:Q,result:{tools:Hj}});return}case"tools/call":{let Y=q?.name,G=q?.arguments??{};if(await Fj()){z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:"Petdex hooks are disabled. Run /petdex in your agent or `petdex hooks on` to re-enable."}]}});return}switch(Y){case"petdex_set_state":{let X=G.state;if(!X){z0(v$(Q,-32602,"Missing required argument: state"));return}let V={state:X,agent_source:"antigravity"};if(typeof G.duration==="number")V.duration=G.duration;let U=await l4(Xj,V);z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:U.ok?`Pet state set to "${X}"`:"Desktop hook server unreachable; is Petdex Desktop running?"}]}});return}case"petdex_show_bubble":{let X=G.text;if(!X){z0(v$(Q,-32602,"Missing required argument: text"));return}let V=await l4(Vj,{text:X,agent_source:"antigravity"});z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:V.ok?`Bubble shown: "${X}"`:"Desktop hook server unreachable; is Petdex Desktop running?"}]}});return}case"petdex_status":{let X=!1;try{X=(await fetch(`${e5}/health`,{signal:AbortSignal.timeout(500)})).ok}catch{X=!1}z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:X?"Petdex desktop is reachable.":"Petdex desktop not detected. Start it with `petdex up`."}]}});return}default:{z0(v$(Q,-32601,`Unknown tool: ${Y}`));return}}}case"notifications/initialized":return;default:z0(v$(Q,-32601,`Unknown method: ${J}`))}}async function Zj(){let $=new Uint8Array(0),Q=0,J=!1,q=new TextDecoder;function Y(){if(Q===0)process.exit(0)}process.stdin.on("data",(X)=>{let V=typeof X==="string"?new TextEncoder().encode(X):X,U=new Uint8Array($.length+V.length);U.set($),U.set(V,$.length),$=U;while(!0){let K=Lj($);if(K===123||K===91){let M=t5($,new Uint8Array([10]));if(M===-1)break;let z=Mj($.slice(0,M));$=$.slice(M+1);let v=q.decode(z).trim();if(!v)continue;s5="jsonl",G(v);continue}let W=zj($),F=W.index;if(F===-1)break;let j=$.slice(0,F),Z=q.decode(j).match(/Content-Length:\s*(\d+)/i);if(!Z){$=$.slice(F+W.length);continue}let L=parseInt(Z[1],10),O=F+W.length,I=O+L;if($.length<I)break;let P=$.slice(O,I),B=q.decode(P);$=$.slice(I),s5="framed",G(B)}}),process.stdin.on("end",()=>{J=!0,Y(),setTimeout(()=>process.exit(0),3000).unref()});function G(X){try{let V=JSON.parse(X);Q++,Pj(V).catch((U)=>{z0(v$(V.id,-32603,`Internal error: ${U.message}`))}).finally(()=>{if(Q--,J)Y()})}catch(V){z0({jsonrpc:"2.0",id:null,error:{code:-32700,message:`Parse error: ${V.message}`}})}}}function t5($,Q){$:for(let J=0;J<=$.length-Q.length;J++){for(let q=0;q<Q.length;q++)if($[J+q]!==Q[q])continue $;return J}return-1}function zj($){let Q=t5($,new Uint8Array([13,10,13,10]));if(Q!==-1)return{index:Q,length:4};let J=t5($,new Uint8Array([10,10]));if(J!==-1)return{index:J,length:2};return{index:-1,length:0}}function Lj($){for(let Q of $)if(Q!==32&&Q!==9&&Q!==10&&Q!==13)return Q;return null}function Mj($){if($.at(-1)===13)return $.slice(0,-1);return $}var e5="http://127.0.0.1:7777",Xj,Vj,Kj,Wj,Uj="0.1.0",s5="framed",Hj;var a4=GQ(()=>{Xj=`${e5}/state`,Vj=`${e5}/bubble`,Kj=n4.join(i4(),".petdex","runtime","update-token"),Wj=n4.join(i4(),".petdex","runtime","hooks-disabled");Hj=[{name:"petdex_set_state",description:"Set the pet's animation state. Call this before/after tool use to reflect agent activity.",inputSchema:{type:"object",properties:{state:{type:"string",description:"Animation state: idle, running, running-left, running-right, waving, jumping, failed, review, waiting",enum:["idle","running","running-left","running-right","waving","jumping","failed","review","waiting"]},duration:{type:"number",description:"Optional duration in ms to hold this state"}},required:["state"]}},{name:"petdex_show_bubble",description:"Show a speech bubble above the pet with the given text. Use to display what the agent is currently doing.",inputSchema:{type:"object",properties:{text:{type:"string",description:"The bubble text to display (e.g. 'Reading server.ts')"}},required:["text"]}},{name:"petdex_status",description:"Check if the petdex desktop mascot is reachable. Returns connection status.",inputSchema:{type:"object",properties:{}}}]});import{mkdir as s4,readdir as Ij,readFile as JQ,stat as qq,writeFile as T6}from"node:fs/promises";import{homedir as t4}from"node:os";import J0 from"node:path";import{styleText as o6}from"node:util";import{stdout as r6,stdin as DQ}from"node:process";import*as _0 from"node:readline";import fq from"node:readline";var XQ=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(Q)=>{let J=0;$.lastIndex=0;while($.test(Q))J+=1;return Q.length-J}})(),VQ=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},KQ=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var wq=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Dq=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,WQ=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,vq=/\t{1,1000}/y,UQ=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,Cq=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Aq=/\p{M}+/gu,Rq={limit:1/0,ellipsis:""},jQ=($,Q={},J={})=>{let q=Q.limit??1/0,Y=Q.ellipsis??"",G=Q?.ellipsisWidth??(Y?jQ(Y,Rq,J).width:0),X=0,V=J.controlWidth??0,U=J.tabWidth??8,K=J.emojiWidth??2,W=2,F=J.regularWidth??1,j=J.wideWidth??2,H=[[Cq,F],[wq,0],[Dq,V],[vq,U],[UQ,K],[WQ,j]],Z=0,L=0,O=$.length,I=0,P=!1,B=O,M=Math.max(0,q-G),z=0,v=0,w=0,D=0;$:while(!0){if(v>z||L>=O&&L>Z){let k=$.slice(z,v)||$.slice(Z,L);I=0;for(let E of k.replaceAll(Aq,"")){let A=E.codePointAt(0)||0;if(VQ(A))D=2;else if(KQ(A))D=j;else D=F;if(w+D>M)B=Math.min(B,Math.max(z,Z)+I);if(w+D>q){P=!0;break $}I+=E.length,w+=D}z=v=0}if(L>=O)break $;for(let k=0,E=H.length;k<E;k++){let[A,o]=H[k];if(A.lastIndex=L,A.test($)){if(I=A===WQ?XQ($.slice(L,A.lastIndex)):A===UQ?1:A.lastIndex-L,D=I*o,w+D>M)B=Math.min(B,L+Math.floor((M-w)/o));if(w+D>q){P=!0;break $}w+=D,z=Z,v=L,L=Z=A.lastIndex;continue $}}L+=1}return{width:P?M:w,index:P?B:O,truncated:P,ellipsed:P&&q>=G}},FQ=jQ;var kq={limit:1/0,ellipsis:"",ellipsisWidth:0},Eq=($,Q={})=>{return FQ($,kq,Q).width},$0=Eq;var k$="\x1B",LQ="›",xq=39,c6="\x07",MQ="[",Sq="]",IQ="m",p6=`${Sq}8;;`,HQ=new RegExp(`(?:\\${MQ}(?<code>\\d+)m|\\${p6}(?<uri>.*)${c6})`,"y"),PQ=($)=>{if($>=30&&$<=37)return 39;if($>=90&&$<=97)return 39;if($>=40&&$<=47)return 49;if($>=100&&$<=107)return 49;if($===1||$===2)return 22;if($===3)return 23;if($===4)return 24;if($===7)return 27;if($===8)return 28;if($===9)return 29;if($===0)return 0;return},ZQ=($)=>`${k$}${MQ}${$}${IQ}`,zQ=($)=>`${k$}${p6}${$}${c6}`,m6=($,Q,J)=>{let q=Q[Symbol.iterator](),Y=!1,G=!1,X=$.at(-1),V=X===void 0?0:$0(X),U=q.next(),K=q.next(),W=0;while(!U.done){let F=U.value,j=$0(F);if(V+j<=J)$[$.length-1]+=F;else $.push(F),V=0;if(F===k$||F===LQ)Y=!0,G=Q.startsWith(p6,W+1);if(Y){if(G){if(F===c6)Y=!1,G=!1}else if(F===IQ)Y=!1}else if(V+=j,V===J&&!K.done)$.push(""),V=0;U=K,K=q.next(),W+=F.length}if(X=$.at(-1),!V&&X!==void 0&&X.length&&$.length>1)$[$.length-2]+=$.pop()},gq=($)=>{let Q=$.split(" "),J=Q.length;while(J){if($0(Q[J-1]))break;J--}if(J===Q.length)return $;return Q.slice(0,J).join(" ")+Q.slice(J).join("")},Tq=($,Q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let q="",Y,G,X=$.split(" "),V=[""],U=0;for(let F=0;F<X.length;F++){let j=X[F];if(J.trim!==!1){let Z=V.at(-1)??"",L=Z.trimStart();if(Z.length!==L.length)V[V.length-1]=L,U=$0(L)}if(F!==0){if(U>=Q&&(J.wordWrap===!1||J.trim===!1))V.push(""),U=0;if(U||J.trim===!1)V[V.length-1]+=" ",U++}let H=$0(j);if(J.hard&&H>Q){let Z=Q-U,L=1+Math.floor((H-Z-1)/Q);if(Math.floor((H-1)/Q)<L)V.push("");m6(V,j,Q),U=$0(V.at(-1)??"");continue}if(U+H>Q&&U&&H){if(J.wordWrap===!1&&U<Q){m6(V,j,Q),U=$0(V.at(-1)??"");continue}V.push(""),U=0}if(U+H>Q&&J.wordWrap===!1){m6(V,j,Q),U=$0(V.at(-1)??"");continue}V[V.length-1]+=j,U+=H}if(J.trim!==!1)V=V.map((F)=>gq(F));let K=V.join(`
8
- `),W=!1;for(let F=0;F<K.length;F++){let j=K[F];if(q+=j,!W){if(W=j>="\uD800"&&j<="\uDBFF",W)continue}else W=!1;if(j===k$||j===LQ){HQ.lastIndex=F+1;let Z=HQ.exec(K)?.groups;if(Z?.code!==void 0){let L=Number.parseFloat(Z.code);Y=L===xq?void 0:L}else if(Z?.uri!==void 0)G=Z.uri.length===0?void 0:Z.uri}if(K[F+1]===`
9
- `){if(G)q+=zQ("");let H=Y?PQ(Y):void 0;if(Y&&H)q+=ZQ(H)}else if(j===`
10
- `){if(Y&&PQ(Y))q+=ZQ(Y);if(G)q+=zQ(G)}}return q},yq=/\r?\n/;function O0($,Q,J){return String($).normalize().split(yq).map((q)=>Tq(q,Q,J)).join(`
11
- `)}var s=R$(d6(),1);import{ReadStream as OQ}from"node:tty";function F1($,Q,J){if(!J.some((X)=>!X.disabled))return $;let q=$+Q,Y=Math.max(J.length-1,0),G=q<0?Y:q>Y?0:q;return J[G].disabled?F1(G,Q<0?-1:1,J):G}function E$($,Q,J,q){let Y=q.split(`
12
- `),G=0,X=$;for(let U of Y){if(X<=U.length)break;X-=U.length+1,G++}for(G=Math.max(0,Math.min(Y.length-1,G+J)),X=Math.min(X,Y[G].length)+Q;X<0&&G>0;)G--,X+=Y[G].length+1;for(;X>Y[G].length&&G<Y.length-1;)X-=Y[G].length+1,G++;X=Math.max(0,Math.min(Y[G].length,X));let V=0;for(let U=0;U<G;U++)V+=Y[U].length+1;return V+X}var _q=["up","down","left","right","space","enter","cancel"],mq=["January","February","March","April","May","June","July","August","September","October","November","December"],n={actions:new Set(_q),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...mq],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:($,Q)=>`There are only ${$} days in ${Q}`,afterMin:($)=>`Date must be on or after ${$.toISOString().slice(0,10)}`,beforeMax:($)=>`Date must be on or before ${$.toISOString().slice(0,10)}`}}};function a6($,Q){if(typeof $=="string")return n.aliases.get($)===Q;for(let J of $)if(J!==void 0&&a6(J,Q))return!0;return!1}function cq($,Q){if($===Q)return;let J=$.split(`
7
+ `;process.stdout.write(q),process.stdout.write(Q)}function A8($,Q,J){return{jsonrpc:"2.0",id:$,error:{code:Q,message:J}}}async function uj($){let{id:Q,method:J,params:q}=$;switch(J){case"initialize":{let Y=q?.protocolVersion??"2025-03-26";Z0({jsonrpc:"2.0",id:Q,result:{protocolVersion:Y,capabilities:{tools:{listChanged:!1}},serverInfo:{name:"petdex-mcp-server",version:_j}}});return}case"tools/list":{Z0({jsonrpc:"2.0",id:Q,result:{tools:pj}});return}case"tools/call":{let Y=q?.name,G=q?.arguments??{};if(await cj()){Z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:"Petdex hooks are disabled. Run /petdex in your agent or `petdex hooks on` to re-enable."}]}});return}switch(Y){case"petdex_set_state":{let V=G.state;if(!V){Z0(A8(Q,-32602,"Missing required argument: state"));return}let X={state:V,agent_source:"antigravity"};if(typeof G.duration==="number")X.duration=G.duration;let W=await Gq(yj,X);Z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:W.ok?`Pet state set to "${V}"`:"Desktop hook server unreachable; is Petdex Desktop running?"}]}});return}case"petdex_show_bubble":{let V=G.text;if(!V){Z0(A8(Q,-32602,"Missing required argument: text"));return}let X=await Gq(hj,{text:V,agent_source:"antigravity"});Z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:X.ok?`Bubble shown: "${V}"`:"Desktop hook server unreachable; is Petdex Desktop running?"}]}});return}case"petdex_status":{let V=!1;try{V=(await fetch(`${V4}/health`,{signal:AbortSignal.timeout(500)})).ok}catch{V=!1}Z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:V?"Petdex desktop is reachable.":"Petdex desktop not detected. Start it with `petdex up`."}]}});return}default:{Z0(A8(Q,-32601,`Unknown tool: ${Y}`));return}}}case"notifications/initialized":return;default:Z0(A8(Q,-32601,`Unknown method: ${J}`))}}async function dj(){let $=new Uint8Array(0),Q=0,J=!1,q=new TextDecoder;function Y(){if(Q===0)process.exit(0)}process.stdin.on("data",(V)=>{let X=typeof V==="string"?new TextEncoder().encode(V):V,W=new Uint8Array($.length+X.length);W.set($),W.set(X,$.length),$=W;while(!0){let K=oj($);if(K===123||K===91){let M=G4($,new Uint8Array([10]));if(M===-1)break;let L=ij($.slice(0,M));$=$.slice(M+1);let A=q.decode(L).trim();if(!A)continue;Y4="jsonl",G(A);continue}let U=lj($),F=U.index;if(F===-1)break;let j=$.slice(0,F),Z=q.decode(j).match(/Content-Length:\s*(\d+)/i);if(!Z){$=$.slice(F+U.length);continue}let z=parseInt(Z[1],10),w=F+U.length,N=w+z;if($.length<N)break;let P=$.slice(w,N),O=q.decode(P);$=$.slice(N),Y4="framed",G(O)}}),process.stdin.on("end",()=>{J=!0,Y(),setTimeout(()=>process.exit(0),3000).unref()});function G(V){try{let X=JSON.parse(V);Q++,uj(X).catch((W)=>{Z0(A8(X.id,-32603,`Internal error: ${W.message}`))}).finally(()=>{if(Q--,J)Y()})}catch(X){Z0({jsonrpc:"2.0",id:null,error:{code:-32700,message:`Parse error: ${X.message}`}})}}}function G4($,Q){$:for(let J=0;J<=$.length-Q.length;J++){for(let q=0;q<Q.length;q++)if($[J+q]!==Q[q])continue $;return J}return-1}function lj($){let Q=G4($,new Uint8Array([13,10,13,10]));if(Q!==-1)return{index:Q,length:4};let J=G4($,new Uint8Array([10,10]));if(J!==-1)return{index:J,length:2};return{index:-1,length:0}}function oj($){for(let Q of $)if(Q!==32&&Q!==9&&Q!==10&&Q!==13)return Q;return null}function ij($){if($.at(-1)===13)return $.slice(0,-1);return $}var V4="http://127.0.0.1:7777",yj,hj,fj,bj,_j="0.1.0",Y4="framed",pj;var Wq=j4(()=>{yj=`${V4}/state`,hj=`${V4}/bubble`,fj=Kq.join(Xq(),".petdex","runtime","update-token"),bj=Kq.join(Xq(),".petdex","runtime","hooks-disabled");pj=[{name:"petdex_set_state",description:"Set the pet's animation state. Call this before/after tool use to reflect agent activity.",inputSchema:{type:"object",properties:{state:{type:"string",description:"Animation state: idle, running, running-left, running-right, waving, jumping, failed, review, waiting",enum:["idle","running","running-left","running-right","waving","jumping","failed","review","waiting"]},duration:{type:"number",description:"Optional duration in ms to hold this state"}},required:["state"]}},{name:"petdex_show_bubble",description:"Show a speech bubble above the pet with the given text. Use to display what the agent is currently doing.",inputSchema:{type:"object",properties:{text:{type:"string",description:"The bubble text to display (e.g. 'Reading server.ts')"}},required:["text"]}},{name:"petdex_status",description:"Check if the petdex desktop mascot is reachable. Returns connection status.",inputSchema:{type:"object",properties:{}}}]});import{mkdir as jq,readdir as nj,readFile as K4,stat as Lq,writeFile as h6}from"node:fs/promises";import{homedir as Fq}from"node:os";import J0 from"node:path";import{styleText as n6}from"node:util";import{stdout as s6,stdin as E4}from"node:process";import*as _0 from"node:readline";import sq from"node:readline";var F4=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(Q)=>{let J=0;$.lastIndex=0;while($.test(Q))J+=1;return Q.length-J}})(),H4=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},P4=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var hq=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,fq=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Z4=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,bq=/\t{1,1000}/y,z4=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,_q=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,mq=/\p{M}+/gu,cq={limit:1/0,ellipsis:""},L4=($,Q={},J={})=>{let q=Q.limit??1/0,Y=Q.ellipsis??"",G=Q?.ellipsisWidth??(Y?L4(Y,cq,J).width:0),V=0,X=J.controlWidth??0,W=J.tabWidth??8,K=J.emojiWidth??2,U=2,F=J.regularWidth??1,j=J.wideWidth??2,H=[[_q,F],[hq,0],[fq,X],[bq,W],[z4,K],[Z4,j]],Z=0,z=0,w=$.length,N=0,P=!1,O=w,M=Math.max(0,q-G),L=0,A=0,C=0,B=0;$:while(!0){if(A>L||z>=w&&z>Z){let R=$.slice(L,A)||$.slice(Z,z);N=0;for(let E of R.replaceAll(mq,"")){let v=E.codePointAt(0)||0;if(H4(v))B=2;else if(P4(v))B=j;else B=F;if(C+B>M)O=Math.min(O,Math.max(L,Z)+N);if(C+B>q){P=!0;break $}N+=E.length,C+=B}L=A=0}if(z>=w)break $;for(let R=0,E=H.length;R<E;R++){let[v,i]=H[R];if(v.lastIndex=z,v.test($)){if(N=v===Z4?F4($.slice(z,v.lastIndex)):v===z4?1:v.lastIndex-z,B=N*i,C+B>M)O=Math.min(O,z+Math.floor((M-C)/i));if(C+B>q){P=!0;break $}C+=B,L=Z,A=z,z=Z=v.lastIndex;continue $}}z+=1}return{width:P?M:C,index:P?O:w,truncated:P,ellipsed:P&&q>=G}},M4=L4;var pq={limit:1/0,ellipsis:"",ellipsisWidth:0},uq=($,Q={})=>{return M4($,pq,Q).width},$0=uq;var E8="\x1B",B4="›",dq=39,u6="\x07",D4="[",lq="]",v4="m",d6=`${lq}8;;`,I4=new RegExp(`(?:\\${D4}(?<code>\\d+)m|\\${d6}(?<uri>.*)${u6})`,"y"),N4=($)=>{if($>=30&&$<=37)return 39;if($>=90&&$<=97)return 39;if($>=40&&$<=47)return 49;if($>=100&&$<=107)return 49;if($===1||$===2)return 22;if($===3)return 23;if($===4)return 24;if($===7)return 27;if($===8)return 28;if($===9)return 29;if($===0)return 0;return},w4=($)=>`${E8}${D4}${$}${v4}`,O4=($)=>`${E8}${d6}${$}${u6}`,p6=($,Q,J)=>{let q=Q[Symbol.iterator](),Y=!1,G=!1,V=$.at(-1),X=V===void 0?0:$0(V),W=q.next(),K=q.next(),U=0;while(!W.done){let F=W.value,j=$0(F);if(X+j<=J)$[$.length-1]+=F;else $.push(F),X=0;if(F===E8||F===B4)Y=!0,G=Q.startsWith(d6,U+1);if(Y){if(G){if(F===u6)Y=!1,G=!1}else if(F===v4)Y=!1}else if(X+=j,X===J&&!K.done)$.push(""),X=0;W=K,K=q.next(),U+=F.length}if(V=$.at(-1),!X&&V!==void 0&&V.length&&$.length>1)$[$.length-2]+=$.pop()},oq=($)=>{let Q=$.split(" "),J=Q.length;while(J){if($0(Q[J-1]))break;J--}if(J===Q.length)return $;return Q.slice(0,J).join(" ")+Q.slice(J).join("")},iq=($,Q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let q="",Y,G,V=$.split(" "),X=[""],W=0;for(let F=0;F<V.length;F++){let j=V[F];if(J.trim!==!1){let Z=X.at(-1)??"",z=Z.trimStart();if(Z.length!==z.length)X[X.length-1]=z,W=$0(z)}if(F!==0){if(W>=Q&&(J.wordWrap===!1||J.trim===!1))X.push(""),W=0;if(W||J.trim===!1)X[X.length-1]+=" ",W++}let H=$0(j);if(J.hard&&H>Q){let Z=Q-W,z=1+Math.floor((H-Z-1)/Q);if(Math.floor((H-1)/Q)<z)X.push("");p6(X,j,Q),W=$0(X.at(-1)??"");continue}if(W+H>Q&&W&&H){if(J.wordWrap===!1&&W<Q){p6(X,j,Q),W=$0(X.at(-1)??"");continue}X.push(""),W=0}if(W+H>Q&&J.wordWrap===!1){p6(X,j,Q),W=$0(X.at(-1)??"");continue}X[X.length-1]+=j,W+=H}if(J.trim!==!1)X=X.map((F)=>oq(F));let K=X.join(`
8
+ `),U=!1;for(let F=0;F<K.length;F++){let j=K[F];if(q+=j,!U){if(U=j>="\uD800"&&j<="\uDBFF",U)continue}else U=!1;if(j===E8||j===B4){I4.lastIndex=F+1;let Z=I4.exec(K)?.groups;if(Z?.code!==void 0){let z=Number.parseFloat(Z.code);Y=z===dq?void 0:z}else if(Z?.uri!==void 0)G=Z.uri.length===0?void 0:Z.uri}if(K[F+1]===`
9
+ `){if(G)q+=O4("");let H=Y?N4(Y):void 0;if(Y&&H)q+=w4(H)}else if(j===`
10
+ `){if(Y&&N4(Y))q+=w4(Y);if(G)q+=O4(G)}}return q},nq=/\r?\n/;function w0($,Q,J){return String($).normalize().split(nq).map((q)=>iq(q,Q,J)).join(`
11
+ `)}var s=_1(o6(),1);import{ReadStream as A4}from"node:tty";function F1($,Q,J){if(!J.some((V)=>!V.disabled))return $;let q=$+Q,Y=Math.max(J.length-1,0),G=q<0?Y:q>Y?0:q;return J[G].disabled?F1(G,Q<0?-1:1,J):G}function g8($,Q,J,q){let Y=q.split(`
12
+ `),G=0,V=$;for(let W of Y){if(V<=W.length)break;V-=W.length+1,G++}for(G=Math.max(0,Math.min(Y.length-1,G+J)),V=Math.min(V,Y[G].length)+Q;V<0&&G>0;)G--,V+=Y[G].length+1;for(;V>Y[G].length&&G<Y.length-1;)V-=Y[G].length+1,G++;V=Math.max(0,Math.min(Y[G].length,V));let X=0;for(let W=0;W<G;W++)X+=Y[W].length+1;return X+V}var tq=["up","down","left","right","space","enter","cancel"],eq=["January","February","March","April","May","June","July","August","September","October","November","December"],n={actions:new Set(tq),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...eq],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:($,Q)=>`There are only ${$} days in ${Q}`,afterMin:($)=>`Date must be on or after ${$.toISOString().slice(0,10)}`,beforeMax:($)=>`Date must be on or before ${$.toISOString().slice(0,10)}`}}};function t6($,Q){if(typeof $=="string")return n.aliases.get($)===Q;for(let J of $)if(J!==void 0&&t6(J,Q))return!0;return!1}function $Y($,Q){if($===Q)return;let J=$.split(`
13
13
  `),q=Q.split(`
14
- `),Y=Math.max(J.length,q.length),G=[];for(let X=0;X<Y;X++)J[X]!==q[X]&&G.push(X);return{lines:G,numLinesBefore:J.length,numLinesAfter:q.length,numLines:Y}}var pq=globalThis.process.platform.startsWith("win"),i6=Symbol("clack:cancel");function _1($){return $===i6}function x$($,Q){let J=$;J.isTTY&&J.setRawMode(Q)}function vQ({input:$=DQ,output:Q=r6,overwrite:J=!0,hideCursor:q=!0}={}){let Y=_0.createInterface({input:$,output:Q,prompt:"",tabSize:1});_0.emitKeypressEvents($,Y),$ instanceof OQ&&$.isTTY&&$.setRawMode(!0);let G=(X,{name:V,sequence:U})=>{let K=String(X);if(a6([K,V,U],"cancel")){q&&Q.write(s.cursor.show),process.exit(0);return}if(!J)return;_0.moveCursor(Q,V==="return"?0:-1,V==="return"?-1:0,()=>{_0.clearLine(Q,1,()=>{$.once("keypress",G)})})};return q&&Q.write(s.cursor.hide),$.once("keypress",G),()=>{$.off("keypress",G),q&&Q.write(s.cursor.show),$ instanceof OQ&&$.isTTY&&!pq&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}var m1=($)=>("columns"in $)&&typeof $.columns=="number"?$.columns:80,s6=($)=>("rows"in $)&&typeof $.rows=="number"?$.rows:20;function c1($,Q,J,q=J,Y=J,G){let X=m1($??r6);return O0(Q,X-J.length,{hard:!0,trim:!1}).split(`
15
- `).map((V,U,K)=>{let W=G?G(V,U):V;return U===0?`${q}${W}`:U===K.length-1?`${Y}${W}`:`${J}${W}`}).join(`
16
- `)}function CQ($,Q){if("~standard"in $){let J=$["~standard"].validate(Q);if(J instanceof Promise)throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return J.issues?.at(0)?.message}return $(Q)}class a0{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor($,Q=!0){let{input:J=DQ,output:q=r6,render:Y,signal:G,...X}=$;this.opts=X,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=G,this.input=J,this.output=q}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let J=this._subscribers.get($)??[];J.push(Q),this._subscribers.set($,J)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let J=this._subscribers.get($)??[],q=[];for(let Y of J)Y.cb(...Q),Y.once&&q.push(()=>J.splice(J.indexOf(Y),1));for(let Y of q)Y()}prompt(){return new Promise(($)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(i6);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=fq.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),x$(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),x$(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),x$(this.input,!1),$(i6)})})}_isActionKey($,Q){return $==="\t"}_shouldSubmit($,Q){return!0}_setValue($){this.value=$,this.emit("value",this.value)}_setUserInput($,Q){this.userInput=$??"",this.emit("userInput",this.userInput),Q&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress($,Q){if(this._track&&Q.name!=="return"&&(Q.name&&this._isActionKey($,Q)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&n.aliases.has(Q.name)&&this.emit("cursor",n.aliases.get(Q.name)),n.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),this.emit("key",$,Q),Q?.name==="return"&&this._shouldSubmit($,Q)){if(this.opts.validate){let J=CQ(this.opts.validate,this.value);J&&(this.error=J instanceof Error?J.message:J,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}a6([$,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(`
17
- `),x$(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=O0(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
18
- `).length-1;this.output.write(s.cursor.move(-999,$*-1))}render(){let $=O0(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if($!==this._prevFrame){if(this.state==="initial")this.output.write(s.cursor.hide);else{let Q=cq(this._prevFrame,$),J=s6(this.output);if(this.restoreCursor(),Q){let q=Math.max(0,Q.numLinesAfter-J),Y=Math.max(0,Q.numLinesBefore-J),G=Q.lines.find((X)=>X>=q);if(G===void 0){this._prevFrame=$;return}if(Q.lines.length===1){this.output.write(s.cursor.move(0,G-Y)),this.output.write(s.erase.lines(1));let X=$.split(`
19
- `);this.output.write(X[G]),this._prevFrame=$,this.output.write(s.cursor.move(0,X.length-G-1));return}else if(Q.lines.length>1){if(q<Y)G=q;else{let V=G-Y;V>0&&this.output.write(s.cursor.move(0,V))}this.output.write(s.erase.down());let X=$.split(`
20
- `).slice(G);this.output.write(X.join(`
21
- `)),this._prevFrame=$;return}}this.output.write(s.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}function uq($,Q){if($===void 0||Q.length===0)return 0;let J=Q.findIndex((q)=>q.value===$);return J!==-1?J:0}function dq($,Q){return(Q.label??String(Q.value)).toLowerCase().includes($.toLowerCase())}function lq($,Q){if(Q)return $?Q:Q[0]}var oq=class extends a0{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Q=0;#Y="";#$;#G;#V;get cursor(){return this.#Q}get userInputWithCursor(){if(!this.userInput)return o6(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let Q=this.userInput.slice(0,this._cursor),[J,...q]=this.userInput.slice(this._cursor);return`${Q}${o6("inverse",J)}${q.join("")}`}get options(){return typeof this.#G=="function"?this.#G():this.#G}constructor(Q){super(Q),this.#G=Q.options,this.#V=Q.placeholder;let J=this.options;this.filteredOptions=[...J],this.multiple=Q.multiple===!0,this.#$=typeof Q.options=="function"?Q.filter:Q.filter??dq;let q;if(Q.initialValue&&Array.isArray(Q.initialValue)?this.multiple?q=Q.initialValue:q=Q.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(q=[this.options[0].value]),q)for(let Y of q){let G=J.findIndex((X)=>X.value===Y);G!==-1&&(this.toggleSelected(Y),this.#Q=G)}this.focusedValue=this.options[this.#Q]?.value,this.on("key",(Y,G)=>this.#J(Y,G)),this.on("userInput",(Y)=>this.#q(Y))}_isActionKey(Q,J){return Q==="\t"||this.multiple&&this.isNavigating&&J.name==="space"&&Q!==void 0&&Q!==""}#J(Q,J){let q=J.name==="up",Y=J.name==="down",G=J.name==="return",X=this.userInput===""||this.userInput==="\t",V=this.#V,U=this.options,K=V!==void 0&&V!==""&&U.some((W)=>!W.disabled&&(this.#$?this.#$(V,W):!0));if(J.name==="tab"&&X&&K){this.userInput==="\t"&&this._clearUserInput(),this._setUserInput(V,!0),this.isNavigating=!1;return}q||Y?(this.#Q=F1(this.#Q,q?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#Q]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):G?this.value=lq(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(J.name==="tab"||this.isNavigating&&J.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(Q){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(Q)?this.selectedValues=this.selectedValues.filter((J)=>J!==Q):this.selectedValues=[...this.selectedValues,Q]:this.selectedValues=[Q])}#q(Q){if(Q!==this.#Y){this.#Y=Q;let J=this.options;Q&&this.#$?this.filteredOptions=J.filter((G)=>this.#$?.(Q,G)):this.filteredOptions=[...J];let q=uq(this.focusedValue,this.filteredOptions);this.#Q=F1(q,0,this.filteredOptions);let Y=this.filteredOptions[this.#Q];Y&&!Y.disabled?this.focusedValue=Y.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};class t6 extends a0{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(s.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var iq={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};function BQ($){return[...$].map((Q)=>iq[Q])}function nq($){let Q=new Intl.DateTimeFormat($,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2000,0,15)),J=[],q="/";for(let Y of Q)Y.type==="literal"?q=Y.value.trim()||Y.value:(Y.type==="year"||Y.type==="month"||Y.type==="day")&&J.push({type:Y.type,len:Y.type==="year"?4:2});return{segments:J,separator:q}}function l6($){return Number.parseInt(($||"0").replace(/_/g,"0"),10)||0}function S$($){return{year:l6($.year),month:l6($.month),day:l6($.day)}}function n6($,Q){return new Date($||2001,Q||1,0).getDate()}function AQ($){let{year:Q,month:J,day:q}=S$($);if(!Q||Q<0||Q>9999||!J||J<1||J>12||!q||q<1)return;let Y=new Date(Date.UTC(Q,J-1,q));if(!(Y.getUTCFullYear()!==Q||Y.getUTCMonth()!==J-1||Y.getUTCDate()!==q))return{year:Q,month:J,day:q}}function wQ($){let Q=AQ($);return Q?new Date(Date.UTC(Q.year,Q.month-1,Q.day)):void 0}function rq($,Q,J,q){let Y=J?{year:J.getUTCFullYear(),month:J.getUTCMonth()+1,day:J.getUTCDate()}:null,G=q?{year:q.getUTCFullYear(),month:q.getUTCMonth()+1,day:q.getUTCDate()}:null;return $==="year"?{min:Y?.year??1,max:G?.year??9999}:$==="month"?{min:Y&&Q.year===Y.year?Y.month:1,max:G&&Q.year===G.year?G.month:12}:{min:Y&&Q.year===Y.year&&Q.month===Y.month?Y.day:1,max:G&&Q.year===G.year&&Q.month===G.month?G.day:n6(Q.year,Q.month)}}class RQ extends a0{#Q;#Y;#$;#G;#V;#J={segmentIndex:0,positionInSegment:0};#q=!0;#X=null;inlineError="";get segmentCursor(){return{...this.#J}}get segmentValues(){return{...this.#$}}get segments(){return this.#Q}get separator(){return this.#Y}get formattedValue(){return this.#j(this.#$)}#j($){return this.#Q.map((Q)=>$[Q.type]).join(this.#Y)}#K(){this._setUserInput(this.#j(this.#$)),this._setValue(wQ(this.#$)??void 0)}constructor($){let Q=$.format?{segments:BQ($.format),separator:$.separator??"/"}:nq($.locale),J=$.separator??Q.separator,q=$.format?BQ($.format):Q.segments,Y=$.initialValue??$.defaultValue,G=Y?{year:String(Y.getUTCFullYear()).padStart(4,"0"),month:String(Y.getUTCMonth()+1).padStart(2,"0"),day:String(Y.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},X=q.map((V)=>G[V.type]).join(J);super({...$,initialUserInput:X},!1),this.#Q=q,this.#Y=J,this.#$=G,this.#G=$.minDate,this.#V=$.maxDate,this.#K(),this.on("cursor",(V)=>this.#P(V)),this.on("key",(V,U)=>this.#Z(V,U)),this.on("finalize",()=>this.#z($))}#W(){let $=Math.max(0,Math.min(this.#J.segmentIndex,this.#Q.length-1)),Q=this.#Q[$];if(Q)return this.#J.positionInSegment=Math.max(0,Math.min(this.#J.positionInSegment,Q.len-1)),{segment:Q,index:$}}#U($){this.inlineError="",this.#X=null;let Q=this.#W();Q&&(this.#J.segmentIndex=Math.max(0,Math.min(this.#Q.length-1,Q.index+$)),this.#J.positionInSegment=0,this.#q=!0)}#F($){let Q=this.#W();if(!Q)return;let{segment:J}=Q,q=this.#$[J.type],Y=!q||q.replace(/_/g,"")==="",G=Number.parseInt((q||"0").replace(/_/g,"0"),10)||0,X=rq(J.type,S$(this.#$),this.#G,this.#V),V;Y?V=$===1?X.min:X.max:V=Math.max(Math.min(X.max,G+$),X.min),this.#$={...this.#$,[J.type]:V.toString().padStart(J.len,"0")},this.#q=!0,this.#X=null,this.#K()}#P($){if($)switch($){case"right":return this.#U(1);case"left":return this.#U(-1);case"up":return this.#F(1);case"down":return this.#F(-1)}}#Z($,Q){if(Q?.name==="backspace"||Q?.sequence===""||Q?.sequence==="\b"||$===""||$==="\b"){this.inlineError="";let J=this.#W();if(!J)return;if(!this.#$[J.segment.type].replace(/_/g,"")){this.#U(-1);return}this.#$[J.segment.type]="_".repeat(J.segment.len),this.#q=!0,this.#J.positionInSegment=0,this.#K();return}if(Q?.name==="tab"){this.inlineError="";let J=this.#W();if(!J)return;let q=Q.shift?-1:1,Y=J.index+q;Y>=0&&Y<this.#Q.length&&(this.#J.segmentIndex=Y,this.#J.positionInSegment=0,this.#q=!0);return}if($&&/^[0-9]$/.test($)){let J=this.#W();if(!J)return;let{segment:q}=J,Y=!this.#$[q.type].replace(/_/g,"");if(this.#q&&this.#X!==null&&!Y){let j=this.#X+$,H={...this.#$,[q.type]:j},Z=this.#H(H,q);if(Z){this.inlineError=Z,this.#X=null,this.#q=!1;return}this.inlineError="",this.#$[q.type]=j,this.#X=null,this.#q=!1,this.#K(),J.index<this.#Q.length-1&&(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0);return}this.#q&&!Y&&(this.#$[q.type]="_".repeat(q.len),this.#J.positionInSegment=0),this.#q=!1,this.#X=null;let G=this.#$[q.type],X=G.indexOf("_"),V=X>=0?X:Math.min(this.#J.positionInSegment,q.len-1);if(V<0||V>=q.len)return;let U=G.slice(0,V)+$+G.slice(V+1),K=!1;if(V===0&&G==="__"&&(q.type==="month"||q.type==="day")){let j=Number.parseInt($,10);U=`0${$}`,K=j<=(q.type==="month"?1:2)}if(q.type==="year"&&(U=(G.replace(/_/g,"")+$).padStart(q.len,"_")),!U.includes("_")){let j={...this.#$,[q.type]:U},H=this.#H(j,q);if(H){this.inlineError=H;return}}this.inlineError="",this.#$[q.type]=U;let W=U.includes("_")?void 0:AQ(this.#$);if(W){let{year:j,month:H}=W,Z=n6(j,H);this.#$={year:String(Math.max(0,Math.min(9999,j))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,H))).padStart(2,"0"),day:String(Math.max(1,Math.min(Z,W.day))).padStart(2,"0")}}this.#K();let F=U.indexOf("_");K?(this.#q=!0,this.#X=$):F>=0?this.#J.positionInSegment=F:X>=0&&J.index<this.#Q.length-1?(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0):this.#J.positionInSegment=Math.min(V+1,q.len-1)}}#H($,Q){let{month:J,day:q}=S$($);if(Q.type==="month"&&(J<0||J>12))return n.date.messages.invalidMonth;if(Q.type==="day"&&(q<0||q>31))return n.date.messages.invalidDay(31,"any month")}#z($){let{year:Q,month:J,day:q}=S$(this.#$);if(Q&&J&&q){let Y=n6(Q,J);this.#$={...this.#$,day:String(Math.min(q,Y)).padStart(2,"0")}}this.value=wQ(this.#$)??$.defaultValue??void 0}}var aq=class extends a0{options;cursor=0;#Q;getGroupItems(Q){return this.options.filter((J)=>J.group===Q)}isGroupSelected(Q){let J=this.getGroupItems(Q),q=this.value;return q===void 0?!1:J.every((Y)=>q.includes(Y.value))}toggleValue(){let Q=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),Q.group===!0){let J=Q.value,q=this.getGroupItems(J);this.isGroupSelected(J)?this.value=this.value.filter((Y)=>q.findIndex((G)=>G.value===Y)===-1):this.value=[...this.value,...q.map((Y)=>Y.value)],this.value=Array.from(new Set(this.value))}else{let J=this.value.includes(Q.value);this.value=J?this.value.filter((q)=>q!==Q.value):[...this.value,Q.value]}}constructor(Q){super(Q,!1);let{options:J}=Q;this.#Q=Q.selectableGroups!==!1,this.options=Object.entries(J).flatMap(([q,Y])=>[{value:q,group:!0,label:q},...Y.map((G)=>({...G,group:q}))]),this.value=[...Q.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:q})=>q===Q.cursorAt),this.#Q?0:1),this.on("cursor",(q)=>{switch(q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(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;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}},sq=new Set(["up","down","left","right"]);class kQ extends a0{#Q=!1;#Y;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;let $=this.userInput;if(this.cursor>=$.length)return`${$}█`;let Q=$.slice(0,this.cursor),J=$[this.cursor],q=$.slice(this.cursor+1);return J===`
14
+ `),Y=Math.max(J.length,q.length),G=[];for(let V=0;V<Y;V++)J[V]!==q[V]&&G.push(V);return{lines:G,numLinesBefore:J.length,numLinesAfter:q.length,numLines:Y}}var QY=globalThis.process.platform.startsWith("win"),r6=Symbol("clack:cancel");function m1($){return $===r6}function x8($,Q){let J=$;J.isTTY&&J.setRawMode(Q)}function g4({input:$=E4,output:Q=s6,overwrite:J=!0,hideCursor:q=!0}={}){let Y=_0.createInterface({input:$,output:Q,prompt:"",tabSize:1});_0.emitKeypressEvents($,Y),$ instanceof A4&&$.isTTY&&$.setRawMode(!0);let G=(V,{name:X,sequence:W})=>{let K=String(V);if(t6([K,X,W],"cancel")){q&&Q.write(s.cursor.show),process.exit(0);return}if(!J)return;_0.moveCursor(Q,X==="return"?0:-1,X==="return"?-1:0,()=>{_0.clearLine(Q,1,()=>{$.once("keypress",G)})})};return q&&Q.write(s.cursor.hide),$.once("keypress",G),()=>{$.off("keypress",G),q&&Q.write(s.cursor.show),$ instanceof A4&&$.isTTY&&!QY&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}var c1=($)=>("columns"in $)&&typeof $.columns=="number"?$.columns:80,e6=($)=>("rows"in $)&&typeof $.rows=="number"?$.rows:20;function p1($,Q,J,q=J,Y=J,G){let V=c1($??s6);return w0(Q,V-J.length,{hard:!0,trim:!1}).split(`
15
+ `).map((X,W,K)=>{let U=G?G(X,W):X;return W===0?`${q}${U}`:W===K.length-1?`${Y}${U}`:`${J}${U}`}).join(`
16
+ `)}function x4($,Q){if("~standard"in $){let J=$["~standard"].validate(Q);if(J instanceof Promise)throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return J.issues?.at(0)?.message}return $(Q)}class a0{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor($,Q=!0){let{input:J=E4,output:q=s6,render:Y,signal:G,...V}=$;this.opts=V,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=G,this.input=J,this.output=q}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let J=this._subscribers.get($)??[];J.push(Q),this._subscribers.set($,J)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let J=this._subscribers.get($)??[],q=[];for(let Y of J)Y.cb(...Q),Y.once&&q.push(()=>J.splice(J.indexOf(Y),1));for(let Y of q)Y()}prompt(){return new Promise(($)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(r6);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=sq.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),x8(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),x8(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),x8(this.input,!1),$(r6)})})}_isActionKey($,Q){return $==="\t"}_shouldSubmit($,Q){return!0}_setValue($){this.value=$,this.emit("value",this.value)}_setUserInput($,Q){this.userInput=$??"",this.emit("userInput",this.userInput),Q&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress($,Q){if(this._track&&Q.name!=="return"&&(Q.name&&this._isActionKey($,Q)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&n.aliases.has(Q.name)&&this.emit("cursor",n.aliases.get(Q.name)),n.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),this.emit("key",$,Q),Q?.name==="return"&&this._shouldSubmit($,Q)){if(this.opts.validate){let J=x4(this.opts.validate,this.value);J&&(this.error=J instanceof Error?J.message:J,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}t6([$,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(`
17
+ `),x8(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=w0(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
18
+ `).length-1;this.output.write(s.cursor.move(-999,$*-1))}render(){let $=w0(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if($!==this._prevFrame){if(this.state==="initial")this.output.write(s.cursor.hide);else{let Q=$Y(this._prevFrame,$),J=e6(this.output);if(this.restoreCursor(),Q){let q=Math.max(0,Q.numLinesAfter-J),Y=Math.max(0,Q.numLinesBefore-J),G=Q.lines.find((V)=>V>=q);if(G===void 0){this._prevFrame=$;return}if(Q.lines.length===1){this.output.write(s.cursor.move(0,G-Y)),this.output.write(s.erase.lines(1));let V=$.split(`
19
+ `);this.output.write(V[G]),this._prevFrame=$,this.output.write(s.cursor.move(0,V.length-G-1));return}else if(Q.lines.length>1){if(q<Y)G=q;else{let X=G-Y;X>0&&this.output.write(s.cursor.move(0,X))}this.output.write(s.erase.down());let V=$.split(`
20
+ `).slice(G);this.output.write(V.join(`
21
+ `)),this._prevFrame=$;return}}this.output.write(s.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}function JY($,Q){if($===void 0||Q.length===0)return 0;let J=Q.findIndex((q)=>q.value===$);return J!==-1?J:0}function qY($,Q){return(Q.label??String(Q.value)).toLowerCase().includes($.toLowerCase())}function YY($,Q){if(Q)return $?Q:Q[0]}var GY=class extends a0{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Q=0;#Y="";#$;#G;#X;get cursor(){return this.#Q}get userInputWithCursor(){if(!this.userInput)return n6(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let Q=this.userInput.slice(0,this._cursor),[J,...q]=this.userInput.slice(this._cursor);return`${Q}${n6("inverse",J)}${q.join("")}`}get options(){return typeof this.#G=="function"?this.#G():this.#G}constructor(Q){super(Q),this.#G=Q.options,this.#X=Q.placeholder;let J=this.options;this.filteredOptions=[...J],this.multiple=Q.multiple===!0,this.#$=typeof Q.options=="function"?Q.filter:Q.filter??qY;let q;if(Q.initialValue&&Array.isArray(Q.initialValue)?this.multiple?q=Q.initialValue:q=Q.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(q=[this.options[0].value]),q)for(let Y of q){let G=J.findIndex((V)=>V.value===Y);G!==-1&&(this.toggleSelected(Y),this.#Q=G)}this.focusedValue=this.options[this.#Q]?.value,this.on("key",(Y,G)=>this.#J(Y,G)),this.on("userInput",(Y)=>this.#q(Y))}_isActionKey(Q,J){return Q==="\t"||this.multiple&&this.isNavigating&&J.name==="space"&&Q!==void 0&&Q!==""}#J(Q,J){let q=J.name==="up",Y=J.name==="down",G=J.name==="return",V=this.userInput===""||this.userInput==="\t",X=this.#X,W=this.options,K=X!==void 0&&X!==""&&W.some((U)=>!U.disabled&&(this.#$?this.#$(X,U):!0));if(J.name==="tab"&&V&&K){this.userInput==="\t"&&this._clearUserInput(),this._setUserInput(X,!0),this.isNavigating=!1;return}q||Y?(this.#Q=F1(this.#Q,q?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#Q]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):G?this.value=YY(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(J.name==="tab"||this.isNavigating&&J.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(Q){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(Q)?this.selectedValues=this.selectedValues.filter((J)=>J!==Q):this.selectedValues=[...this.selectedValues,Q]:this.selectedValues=[Q])}#q(Q){if(Q!==this.#Y){this.#Y=Q;let J=this.options;Q&&this.#$?this.filteredOptions=J.filter((G)=>this.#$?.(Q,G)):this.filteredOptions=[...J];let q=JY(this.focusedValue,this.filteredOptions);this.#Q=F1(q,0,this.filteredOptions);let Y=this.filteredOptions[this.#Q];Y&&!Y.disabled?this.focusedValue=Y.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};class $$ extends a0{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(s.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var VY={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};function R4($){return[...$].map((Q)=>VY[Q])}function XY($){let Q=new Intl.DateTimeFormat($,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2000,0,15)),J=[],q="/";for(let Y of Q)Y.type==="literal"?q=Y.value.trim()||Y.value:(Y.type==="year"||Y.type==="month"||Y.type==="day")&&J.push({type:Y.type,len:Y.type==="year"?4:2});return{segments:J,separator:q}}function i6($){return Number.parseInt(($||"0").replace(/_/g,"0"),10)||0}function S8($){return{year:i6($.year),month:i6($.month),day:i6($.day)}}function a6($,Q){return new Date($||2001,Q||1,0).getDate()}function S4($){let{year:Q,month:J,day:q}=S8($);if(!Q||Q<0||Q>9999||!J||J<1||J>12||!q||q<1)return;let Y=new Date(Date.UTC(Q,J-1,q));if(!(Y.getUTCFullYear()!==Q||Y.getUTCMonth()!==J-1||Y.getUTCDate()!==q))return{year:Q,month:J,day:q}}function k4($){let Q=S4($);return Q?new Date(Date.UTC(Q.year,Q.month-1,Q.day)):void 0}function KY($,Q,J,q){let Y=J?{year:J.getUTCFullYear(),month:J.getUTCMonth()+1,day:J.getUTCDate()}:null,G=q?{year:q.getUTCFullYear(),month:q.getUTCMonth()+1,day:q.getUTCDate()}:null;return $==="year"?{min:Y?.year??1,max:G?.year??9999}:$==="month"?{min:Y&&Q.year===Y.year?Y.month:1,max:G&&Q.year===G.year?G.month:12}:{min:Y&&Q.year===Y.year&&Q.month===Y.month?Y.day:1,max:G&&Q.year===G.year&&Q.month===G.month?G.day:a6(Q.year,Q.month)}}class T4 extends a0{#Q;#Y;#$;#G;#X;#J={segmentIndex:0,positionInSegment:0};#q=!0;#V=null;inlineError="";get segmentCursor(){return{...this.#J}}get segmentValues(){return{...this.#$}}get segments(){return this.#Q}get separator(){return this.#Y}get formattedValue(){return this.#j(this.#$)}#j($){return this.#Q.map((Q)=>$[Q.type]).join(this.#Y)}#K(){this._setUserInput(this.#j(this.#$)),this._setValue(k4(this.#$)??void 0)}constructor($){let Q=$.format?{segments:R4($.format),separator:$.separator??"/"}:XY($.locale),J=$.separator??Q.separator,q=$.format?R4($.format):Q.segments,Y=$.initialValue??$.defaultValue,G=Y?{year:String(Y.getUTCFullYear()).padStart(4,"0"),month:String(Y.getUTCMonth()+1).padStart(2,"0"),day:String(Y.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},V=q.map((X)=>G[X.type]).join(J);super({...$,initialUserInput:V},!1),this.#Q=q,this.#Y=J,this.#$=G,this.#G=$.minDate,this.#X=$.maxDate,this.#K(),this.on("cursor",(X)=>this.#P(X)),this.on("key",(X,W)=>this.#Z(X,W)),this.on("finalize",()=>this.#z($))}#U(){let $=Math.max(0,Math.min(this.#J.segmentIndex,this.#Q.length-1)),Q=this.#Q[$];if(Q)return this.#J.positionInSegment=Math.max(0,Math.min(this.#J.positionInSegment,Q.len-1)),{segment:Q,index:$}}#W($){this.inlineError="",this.#V=null;let Q=this.#U();Q&&(this.#J.segmentIndex=Math.max(0,Math.min(this.#Q.length-1,Q.index+$)),this.#J.positionInSegment=0,this.#q=!0)}#F($){let Q=this.#U();if(!Q)return;let{segment:J}=Q,q=this.#$[J.type],Y=!q||q.replace(/_/g,"")==="",G=Number.parseInt((q||"0").replace(/_/g,"0"),10)||0,V=KY(J.type,S8(this.#$),this.#G,this.#X),X;Y?X=$===1?V.min:V.max:X=Math.max(Math.min(V.max,G+$),V.min),this.#$={...this.#$,[J.type]:X.toString().padStart(J.len,"0")},this.#q=!0,this.#V=null,this.#K()}#P($){if($)switch($){case"right":return this.#W(1);case"left":return this.#W(-1);case"up":return this.#F(1);case"down":return this.#F(-1)}}#Z($,Q){if(Q?.name==="backspace"||Q?.sequence===""||Q?.sequence==="\b"||$===""||$==="\b"){this.inlineError="";let J=this.#U();if(!J)return;if(!this.#$[J.segment.type].replace(/_/g,"")){this.#W(-1);return}this.#$[J.segment.type]="_".repeat(J.segment.len),this.#q=!0,this.#J.positionInSegment=0,this.#K();return}if(Q?.name==="tab"){this.inlineError="";let J=this.#U();if(!J)return;let q=Q.shift?-1:1,Y=J.index+q;Y>=0&&Y<this.#Q.length&&(this.#J.segmentIndex=Y,this.#J.positionInSegment=0,this.#q=!0);return}if($&&/^[0-9]$/.test($)){let J=this.#U();if(!J)return;let{segment:q}=J,Y=!this.#$[q.type].replace(/_/g,"");if(this.#q&&this.#V!==null&&!Y){let j=this.#V+$,H={...this.#$,[q.type]:j},Z=this.#H(H,q);if(Z){this.inlineError=Z,this.#V=null,this.#q=!1;return}this.inlineError="",this.#$[q.type]=j,this.#V=null,this.#q=!1,this.#K(),J.index<this.#Q.length-1&&(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0);return}this.#q&&!Y&&(this.#$[q.type]="_".repeat(q.len),this.#J.positionInSegment=0),this.#q=!1,this.#V=null;let G=this.#$[q.type],V=G.indexOf("_"),X=V>=0?V:Math.min(this.#J.positionInSegment,q.len-1);if(X<0||X>=q.len)return;let W=G.slice(0,X)+$+G.slice(X+1),K=!1;if(X===0&&G==="__"&&(q.type==="month"||q.type==="day")){let j=Number.parseInt($,10);W=`0${$}`,K=j<=(q.type==="month"?1:2)}if(q.type==="year"&&(W=(G.replace(/_/g,"")+$).padStart(q.len,"_")),!W.includes("_")){let j={...this.#$,[q.type]:W},H=this.#H(j,q);if(H){this.inlineError=H;return}}this.inlineError="",this.#$[q.type]=W;let U=W.includes("_")?void 0:S4(this.#$);if(U){let{year:j,month:H}=U,Z=a6(j,H);this.#$={year:String(Math.max(0,Math.min(9999,j))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,H))).padStart(2,"0"),day:String(Math.max(1,Math.min(Z,U.day))).padStart(2,"0")}}this.#K();let F=W.indexOf("_");K?(this.#q=!0,this.#V=$):F>=0?this.#J.positionInSegment=F:V>=0&&J.index<this.#Q.length-1?(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0):this.#J.positionInSegment=Math.min(X+1,q.len-1)}}#H($,Q){let{month:J,day:q}=S8($);if(Q.type==="month"&&(J<0||J>12))return n.date.messages.invalidMonth;if(Q.type==="day"&&(q<0||q>31))return n.date.messages.invalidDay(31,"any month")}#z($){let{year:Q,month:J,day:q}=S8(this.#$);if(Q&&J&&q){let Y=a6(Q,J);this.#$={...this.#$,day:String(Math.min(q,Y)).padStart(2,"0")}}this.value=k4(this.#$)??$.defaultValue??void 0}}var UY=class extends a0{options;cursor=0;#Q;getGroupItems(Q){return this.options.filter((J)=>J.group===Q)}isGroupSelected(Q){let J=this.getGroupItems(Q),q=this.value;return q===void 0?!1:J.every((Y)=>q.includes(Y.value))}toggleValue(){let Q=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),Q.group===!0){let J=Q.value,q=this.getGroupItems(J);this.isGroupSelected(J)?this.value=this.value.filter((Y)=>q.findIndex((G)=>G.value===Y)===-1):this.value=[...this.value,...q.map((Y)=>Y.value)],this.value=Array.from(new Set(this.value))}else{let J=this.value.includes(Q.value);this.value=J?this.value.filter((q)=>q!==Q.value):[...this.value,Q.value]}}constructor(Q){super(Q,!1);let{options:J}=Q;this.#Q=Q.selectableGroups!==!1,this.options=Object.entries(J).flatMap(([q,Y])=>[{value:q,group:!0,label:q},...Y.map((G)=>({...G,group:q}))]),this.value=[...Q.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:q})=>q===Q.cursorAt),this.#Q?0:1),this.on("cursor",(q)=>{switch(q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(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;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}},WY=new Set(["up","down","left","right"]);class y4 extends a0{#Q=!1;#Y;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;let $=this.userInput;if(this.cursor>=$.length)return`${$}█`;let Q=$.slice(0,this.cursor),J=$[this.cursor],q=$.slice(this.cursor+1);return J===`
22
22
  `?`${Q}█
23
- ${q}`:`${Q}${o6("inverse",J)}${q}`}get cursor(){return this._cursor}#$($){if(this.userInput.length===0){this._setUserInput($);return}this._setUserInput(this.userInput.slice(0,this.cursor)+$+this.userInput.slice(this.cursor))}#G($){let Q=this.value??"";switch($){case"up":this._cursor=E$(this._cursor,0,-1,Q);return;case"down":this._cursor=E$(this._cursor,0,1,Q);return;case"left":this._cursor=E$(this._cursor,-1,0,Q);return;case"right":this._cursor=E$(this._cursor,1,0,Q);return}}_shouldSubmit($,Q){if(this.#Y)return this.focused==="submit"?!0:(this.#$(`
23
+ ${q}`:`${Q}${n6("inverse",J)}${q}`}get cursor(){return this._cursor}#$($){if(this.userInput.length===0){this._setUserInput($);return}this._setUserInput(this.userInput.slice(0,this.cursor)+$+this.userInput.slice(this.cursor))}#G($){let Q=this.value??"";switch($){case"up":this._cursor=g8(this._cursor,0,-1,Q);return;case"down":this._cursor=g8(this._cursor,0,1,Q);return;case"left":this._cursor=g8(this._cursor,-1,0,Q);return;case"right":this._cursor=g8(this._cursor,1,0,Q);return}}_shouldSubmit($,Q){if(this.#Y)return this.focused==="submit"?!0:(this.#$(`
24
24
  `),this._cursor++,!1);let J=this.#Q;return this.#Q=!0,J?(this.userInput[this.cursor-1]===`
25
25
  `&&(this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--),!0):(this.#$(`
26
- `),this._cursor++,!1)}constructor($){super($,!1),this.#Y=$.showSubmit??!1,this.on("key",(Q,J)=>{if(J?.name&&sq.has(J.name)){this.#G(J.name);return}if(Q==="\t"&&this.#Y){this.focused=this.focused==="editor"?"submit":"editor";return}if(J?.name!=="return"){if(this.#Q=!1,J?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(J?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}Q&&(this.#Y&&this.focused==="submit"&&(this.focused="editor"),this.#$(Q??""),this._cursor++)}}),this.on("userInput",(Q)=>{this._setValue(Q)}),this.on("finalize",()=>{this.value||(this.value=$.defaultValue),this.value===void 0&&(this.value="")})}}class e6 extends a0{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor($){super($,!1),this.options=$.options;let Q=this.options.findIndex(({value:q})=>q===$.initialValue),J=Q===-1?0:Q;this.cursor=this.options[J].disabled?F1(J,1,this.options):J,this.changeValue(),this.on("cursor",(q)=>{switch(q){case"left":case"up":this.cursor=F1(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=F1(this.cursor,1,this.options);break}this.changeValue()})}}import{styleText as R,stripVTControlCharacters as PF}from"node:util";import j0 from"node:process";var p1=R$(d6(),1);function tq(){if(j0.platform!=="win32")return j0.env.TERM!=="linux";return Boolean(j0.env.CI)||Boolean(j0.env.WT_SESSION)||Boolean(j0.env.TERMINUS_SUBLIME)||j0.env.ConEmuTask==="{cmd::Cmder}"||j0.env.TERM_PROGRAM==="Terminus-Sublime"||j0.env.TERM_PROGRAM==="vscode"||j0.env.TERM==="xterm-256color"||j0.env.TERM==="alacritty"||j0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var $8=tq(),eq=()=>process.env.CI==="true";var T=($,Q)=>$8?$:Q,$Y=T("◆","*"),SQ=T("■","x"),gQ=T("▲","x"),J8=T("◇","o"),QY=T("┌","T"),c=T("│","|"),y$=T("└","—"),MF=T("┐","T"),IF=T("┘","—"),Q8=T("●",">"),T$=T("○"," "),NF=T("◻","[•]"),OF=T("◼","[+]"),BF=T("◻","[ ]"),wF=T("▪","•"),EQ=T("─","-"),JY=T("╮","+"),qY=T("├","+"),YY=T("╯","+"),GY=T("╰","+"),DF=T("╭","+"),vF=T("●","•"),CF=T("◆","*"),AF=T("▲","!"),RF=T("■","x"),TQ=($)=>{switch($){case"initial":case"active":return R("cyan",$Y);case"cancel":return R("red",SQ);case"error":return R("yellow",gQ);case"submit":return R("green",J8)}},XY=($)=>{switch($){case"initial":case"active":return R("cyan",c);case"cancel":return R("red",c);case"error":return R("yellow",c);case"submit":return R("green",c)}},xQ=($,Q,J,q,Y,G=!1)=>{let X=Q,V=0;if(G)for(let U=q-1;U>=J&&(X-=$[U].length,V++,!(X<=Y));U--);else for(let U=J;U<q&&(X-=$[U].length,V++,!(X<=Y));U++);return{lineCount:X,removals:V}},VY=({cursor:$,options:Q,style:J,output:q=process.stdout,maxItems:Y=Number.POSITIVE_INFINITY,columnPadding:G=0,rowPadding:X=4})=>{let V=m1(q)-G,U=s6(q),K=R("dim","..."),W=Math.max(U-X,0),F=Math.max(Math.min(Y,W),5),j=0;$>=F-3&&(j=Math.max(Math.min($-F+3,Q.length-F),0));let H=F<Q.length&&j>0,Z=F<Q.length&&j+F<Q.length,L=Math.min(j+F,Q.length),O=[],I=0;H&&I++,Z&&I++;let P=j+(H?1:0),B=L-(Z?1:0);for(let z=P;z<B;z++){let v=O0(J(Q[z],z===$),V,{hard:!0,trim:!1}).split(`
27
- `);O.push(v),I+=v.length}if(I>W){let z=0,v=0,w=I,D=$-P,k=W,E=()=>xQ(O,w,0,D,k),A=()=>xQ(O,w,D+1,O.length,k,!0);H?({lineCount:w,removals:z}=E(),w>k&&(Z||(k-=1),{lineCount:w,removals:v}=A())):(Z||(k-=1),{lineCount:w,removals:v}=A(),w>k&&(k-=1,{lineCount:w,removals:z}=E())),z>0&&(H=!0,O.splice(0,z)),v>0&&(Z=!0,O.splice(O.length-v,v))}let M=[];H&&M.push(K);for(let z of O)for(let v of z)M.push(v);return Z&&M.push(K),M};var yQ=($)=>{let Q=$.active??"Yes",J=$.inactive??"No";return new t6({active:Q,inactive:J,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue??!0,render(){let q=$.withGuide??n.withGuide,Y=`${TQ(this.state)} `,G=q?`${R("gray",c)} `:"",X=c1($.output,$.message,G,Y),V=`${q?`${R("gray",c)}
28
- `:""}${X}
29
- `,U=this.value?Q:J;switch(this.state){case"submit":{let K=q?`${R("gray",c)} `:"";return`${V}${K}${R("dim",U)}`}case"cancel":{let K=q?`${R("gray",c)} `:"";return`${V}${K}${R(["strikethrough","dim"],U)}${q?`
30
- ${R("gray",c)}`:""}`}default:{let K=q?`${R("cyan",c)} `:"",W=q?R("cyan",y$):"";return`${V}${K}${this.value?`${R("green",Q8)} ${Q}`:`${R("dim",T$)} ${R("dim",Q)}`}${$.vertical?q?`
31
- ${R("cyan",c)} `:`
32
- `:` ${R("dim","/")} `}${this.value?`${R("dim",T$)} ${R("dim",J)}`:`${R("green",Q8)} ${J}`}
33
- ${W}
34
- `}}}}).prompt()};var i=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${R("gray",y$)} `:"";J.write(`${q}${R("red",$)}
26
+ `),this._cursor++,!1)}constructor($){super($,!1),this.#Y=$.showSubmit??!1,this.on("key",(Q,J)=>{if(J?.name&&WY.has(J.name)){this.#G(J.name);return}if(Q==="\t"&&this.#Y){this.focused=this.focused==="editor"?"submit":"editor";return}if(J?.name!=="return"){if(this.#Q=!1,J?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(J?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}Q&&(this.#Y&&this.focused==="submit"&&(this.focused="editor"),this.#$(Q??""),this._cursor++)}}),this.on("userInput",(Q)=>{this._setValue(Q)}),this.on("finalize",()=>{this.value||(this.value=$.defaultValue),this.value===void 0&&(this.value="")})}}class Q$ extends a0{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor($){super($,!1),this.options=$.options;let Q=this.options.findIndex(({value:q})=>q===$.initialValue),J=Q===-1?0:Q;this.cursor=this.options[J].disabled?F1(J,1,this.options):J,this.changeValue(),this.on("cursor",(q)=>{switch(q){case"left":case"up":this.cursor=F1(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=F1(this.cursor,1,this.options);break}this.changeValue()})}}import{styleText as k,stripVTControlCharacters as mF}from"node:util";import W0 from"node:process";var u1=_1(o6(),1);function jY(){if(W0.platform!=="win32")return W0.env.TERM!=="linux";return Boolean(W0.env.CI)||Boolean(W0.env.WT_SESSION)||Boolean(W0.env.TERMINUS_SUBLIME)||W0.env.ConEmuTask==="{cmd::Cmder}"||W0.env.TERM_PROGRAM==="Terminus-Sublime"||W0.env.TERM_PROGRAM==="vscode"||W0.env.TERM==="xterm-256color"||W0.env.TERM==="alacritty"||W0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var J$=jY(),FY=()=>process.env.CI==="true";var T=($,Q)=>J$?$:Q,HY=T("◆","*"),b4=T("■","x"),_4=T("▲","x"),Y$=T("◇","o"),PY=T("┌","T"),c=T("│","|"),h8=T("└","—"),dF=T("┐","T"),lF=T("┘","—"),q$=T("●",">"),y8=T("○"," "),oF=T("◻","[•]"),iF=T("◼","[+]"),nF=T("◻","[ ]"),rF=T("▪","•"),h4=T("─","-"),ZY=T("╮","+"),zY=T("├","+"),LY=T("╯","+"),MY=T("╰","+"),aF=T("╭","+"),sF=T("●","•"),tF=T("◆","*"),eF=T("▲","!"),$H=T("■","x"),m4=($)=>{switch($){case"initial":case"active":return k("cyan",HY);case"cancel":return k("red",b4);case"error":return k("yellow",_4);case"submit":return k("green",Y$)}},IY=($)=>{switch($){case"initial":case"active":return k("cyan",c);case"cancel":return k("red",c);case"error":return k("yellow",c);case"submit":return k("green",c)}},f4=($,Q,J,q,Y,G=!1)=>{let V=Q,X=0;if(G)for(let W=q-1;W>=J&&(V-=$[W].length,X++,!(V<=Y));W--);else for(let W=J;W<q&&(V-=$[W].length,X++,!(V<=Y));W++);return{lineCount:V,removals:X}},NY=({cursor:$,options:Q,style:J,output:q=process.stdout,maxItems:Y=Number.POSITIVE_INFINITY,columnPadding:G=0,rowPadding:V=4})=>{let X=c1(q)-G,W=e6(q),K=k("dim","..."),U=Math.max(W-V,0),F=Math.max(Math.min(Y,U),5),j=0;$>=F-3&&(j=Math.max(Math.min($-F+3,Q.length-F),0));let H=F<Q.length&&j>0,Z=F<Q.length&&j+F<Q.length,z=Math.min(j+F,Q.length),w=[],N=0;H&&N++,Z&&N++;let P=j+(H?1:0),O=z-(Z?1:0);for(let L=P;L<O;L++){let A=w0(J(Q[L],L===$),X,{hard:!0,trim:!1}).split(`
27
+ `);w.push(A),N+=A.length}if(N>U){let L=0,A=0,C=N,B=$-P,R=U,E=()=>f4(w,C,0,B,R),v=()=>f4(w,C,B+1,w.length,R,!0);H?({lineCount:C,removals:L}=E(),C>R&&(Z||(R-=1),{lineCount:C,removals:A}=v())):(Z||(R-=1),{lineCount:C,removals:A}=v(),C>R&&(R-=1,{lineCount:C,removals:L}=E())),L>0&&(H=!0,w.splice(0,L)),A>0&&(Z=!0,w.splice(w.length-A,A))}let M=[];H&&M.push(K);for(let L of w)for(let A of L)M.push(A);return Z&&M.push(K),M};var c4=($)=>{let Q=$.active??"Yes",J=$.inactive??"No";return new $$({active:Q,inactive:J,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue??!0,render(){let q=$.withGuide??n.withGuide,Y=`${m4(this.state)} `,G=q?`${k("gray",c)} `:"",V=p1($.output,$.message,G,Y),X=`${q?`${k("gray",c)}
28
+ `:""}${V}
29
+ `,W=this.value?Q:J;switch(this.state){case"submit":{let K=q?`${k("gray",c)} `:"";return`${X}${K}${k("dim",W)}`}case"cancel":{let K=q?`${k("gray",c)} `:"";return`${X}${K}${k(["strikethrough","dim"],W)}${q?`
30
+ ${k("gray",c)}`:""}`}default:{let K=q?`${k("cyan",c)} `:"",U=q?k("cyan",h8):"";return`${X}${K}${this.value?`${k("green",q$)} ${Q}`:`${k("dim",y8)} ${k("dim",Q)}`}${$.vertical?q?`
31
+ ${k("cyan",c)} `:`
32
+ `:` ${k("dim","/")} `}${this.value?`${k("dim",y8)} ${k("dim",J)}`:`${k("green",q$)} ${J}`}
33
+ ${U}
34
+ `}}}}).prompt()};var u=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${k("gray",h8)} `:"";J.write(`${q}${k("red",$)}
35
35
 
36
- `)},h$=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${R("gray",QY)} `:"";J.write(`${q}${$}
37
- `)},u1=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${R("gray",c)}
38
- ${R("gray",y$)} `:"";J.write(`${q}${$}
36
+ `)},f8=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${k("gray",PY)} `:"";J.write(`${q}${$}
37
+ `)},d1=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${k("gray",c)}
38
+ ${k("gray",h8)} `:"";J.write(`${q}${$}
39
39
 
40
- `)};var KY=($)=>R("dim",$),WY=($,Q,J)=>{let q={hard:!0,trim:!1},Y=O0($,Q,q).split(`
41
- `),G=Y.reduce((U,K)=>Math.max($0(K),U),0),X=Y.map(J).reduce((U,K)=>Math.max($0(K),U),0),V=Q-(X-G);return O0($,V,q)},d1=($="",Q="",J)=>{let q=J?.output??j0.stdout,Y=J?.withGuide??n.withGuide,G=J?.format??KY,X=["",...WY($,m1(q)-6,G).split(`
42
- `).map(G),""],V=$0(Q),U=Math.max(X.reduce((j,H)=>{let Z=$0(H);return Z>j?Z:j},0),V)+2,K=X.map((j)=>`${R("gray",c)} ${j}${" ".repeat(U-$0(j))}${R("gray",c)}`).join(`
43
- `),W=Y?`${R("gray",c)}
44
- `:"",F=Y?qY:GY;q.write(`${W}${R("green",J8)} ${R("reset",Q)} ${R("gray",EQ.repeat(Math.max(U-V-1,1))+JY)}
40
+ `)};var wY=($)=>k("dim",$),OY=($,Q,J)=>{let q={hard:!0,trim:!1},Y=w0($,Q,q).split(`
41
+ `),G=Y.reduce((W,K)=>Math.max($0(K),W),0),V=Y.map(J).reduce((W,K)=>Math.max($0(K),W),0),X=Q-(V-G);return w0($,X,q)},l1=($="",Q="",J)=>{let q=J?.output??W0.stdout,Y=J?.withGuide??n.withGuide,G=J?.format??wY,V=["",...OY($,c1(q)-6,G).split(`
42
+ `).map(G),""],X=$0(Q),W=Math.max(V.reduce((j,H)=>{let Z=$0(H);return Z>j?Z:j},0),X)+2,K=V.map((j)=>`${k("gray",c)} ${j}${" ".repeat(W-$0(j))}${k("gray",c)}`).join(`
43
+ `),U=Y?`${k("gray",c)}
44
+ `:"",F=Y?zY:MY;q.write(`${U}${k("green",Y$)} ${k("reset",Q)} ${k("gray",h4.repeat(Math.max(W-X-1,1))+ZY)}
45
45
  ${K}
46
- ${R("gray",F+EQ.repeat(U+2)+YY)}
47
- `)};var UY=($)=>R("magenta",$),s0=({indicator:$="dots",onCancel:Q,output:J=process.stdout,cancelMessage:q,errorMessage:Y,frames:G=$8?["◒","◐","◓","◑"]:["•","o","O","0"],delay:X=$8?80:120,signal:V,...U}={})=>{let K=eq(),W,F,j=!1,H=!1,Z="",L,O=performance.now(),I=m1(J),P=U?.styleFrame??UY,B=(y)=>{let e=y>1?Y??n.messages.error:q??n.messages.cancel;H=y===1,j&&(W0(e,y),H&&typeof Q=="function"&&Q())},M=()=>B(2),z=()=>B(1),v=()=>{process.on("uncaughtExceptionMonitor",M),process.on("unhandledRejection",M),process.on("SIGINT",z),process.on("SIGTERM",z),process.on("exit",B),V&&V.addEventListener("abort",z)},w=()=>{process.removeListener("uncaughtExceptionMonitor",M),process.removeListener("unhandledRejection",M),process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),process.removeListener("exit",B),V&&V.removeEventListener("abort",z)},D=()=>{if(L===void 0)return;K&&J.write(`
48
- `);let y=O0(L,I,{hard:!0,trim:!1}).split(`
49
- `);y.length>1&&J.write(p1.cursor.up(y.length-1)),J.write(p1.cursor.to(0)),J.write(p1.erase.down())},k=(y)=>y.replace(/\.+$/,""),E=(y)=>{let e=(performance.now()-y)/1000,U0=Math.floor(e/60),q0=Math.floor(e%60);return U0>0?`[${U0}m ${q0}s]`:`[${q0}s]`},A=U.withGuide??n.withGuide,o=(y="")=>{j=!0,W=vQ({output:J}),Z=k(y),O=performance.now(),A&&J.write(`${R("gray",c)}
50
- `);let e=0,U0=0;v(),F=setInterval(()=>{if(K&&Z===L)return;D(),L=Z;let q0=P(G[e]),E0;if(K)E0=`${q0} ${Z}...`;else if($==="timer")E0=`${q0} ${Z} ${E(O)}`;else{let Fq=".".repeat(Math.floor(U0)).slice(0,3);E0=`${q0} ${Z}${Fq}`}let jq=O0(E0,I,{hard:!0,trim:!1});J.write(jq),e=e+1<G.length?e+1:0,U0=U0<4?U0+0.125:0},X)},W0=(y="",e=0,U0=!1)=>{if(!j)return;j=!1,clearInterval(F),D();let q0=e===0?R("green",J8):e===1?R("red",SQ):R("red",gQ);Z=y??Z,U0||($==="timer"?J.write(`${q0} ${Z} ${E(O)}
46
+ ${k("gray",F+h4.repeat(W+2)+LY)}
47
+ `)};var BY=($)=>k("magenta",$),s0=({indicator:$="dots",onCancel:Q,output:J=process.stdout,cancelMessage:q,errorMessage:Y,frames:G=J$?["◒","◐","◓","◑"]:["•","o","O","0"],delay:V=J$?80:120,signal:X,...W}={})=>{let K=FY(),U,F,j=!1,H=!1,Z="",z,w=performance.now(),N=c1(J),P=W?.styleFrame??BY,O=(y)=>{let e=y>1?Y??n.messages.error:q??n.messages.cancel;H=y===1,j&&(K0(e,y),H&&typeof Q=="function"&&Q())},M=()=>O(2),L=()=>O(1),A=()=>{process.on("uncaughtExceptionMonitor",M),process.on("unhandledRejection",M),process.on("SIGINT",L),process.on("SIGTERM",L),process.on("exit",O),X&&X.addEventListener("abort",L)},C=()=>{process.removeListener("uncaughtExceptionMonitor",M),process.removeListener("unhandledRejection",M),process.removeListener("SIGINT",L),process.removeListener("SIGTERM",L),process.removeListener("exit",O),X&&X.removeEventListener("abort",L)},B=()=>{if(z===void 0)return;K&&J.write(`
48
+ `);let y=w0(z,N,{hard:!0,trim:!1}).split(`
49
+ `);y.length>1&&J.write(u1.cursor.up(y.length-1)),J.write(u1.cursor.to(0)),J.write(u1.erase.down())},R=(y)=>y.replace(/\.+$/,""),E=(y)=>{let e=(performance.now()-y)/1000,U0=Math.floor(e/60),q0=Math.floor(e%60);return U0>0?`[${U0}m ${q0}s]`:`[${q0}s]`},v=W.withGuide??n.withGuide,i=(y="")=>{j=!0,U=g4({output:J}),Z=R(y),w=performance.now(),v&&J.write(`${k("gray",c)}
50
+ `);let e=0,U0=0;A(),F=setInterval(()=>{if(K&&Z===z)return;B(),z=Z;let q0=P(G[e]),E0;if(K)E0=`${q0} ${Z}...`;else if($==="timer")E0=`${q0} ${Z} ${E(w)}`;else{let vq=".".repeat(Math.floor(U0)).slice(0,3);E0=`${q0} ${Z}${vq}`}let Dq=w0(E0,N,{hard:!0,trim:!1});J.write(Dq),e=e+1<G.length?e+1:0,U0=U0<4?U0+0.125:0},V)},K0=(y="",e=0,U0=!1)=>{if(!j)return;j=!1,clearInterval(F),B();let q0=e===0?k("green",Y$):e===1?k("red",b4):k("red",_4);Z=y??Z,U0||($==="timer"?J.write(`${q0} ${Z} ${E(w)}
51
51
  `):J.write(`${q0} ${Z}
52
- `)),w(),W()};return{start:o,stop:(y="")=>W0(y,0),message:(y="")=>{Z=k(y??Z)},cancel:(y="")=>W0(y,1),error:(y="")=>W0(y,2),clear:()=>W0("",0,!0),get isCancelled(){return H}}},kF={light:T("─","-"),heavy:T("━","="),block:T("█","#")};var g$=($,Q)=>$.includes(`
52
+ `)),C(),U()};return{start:i,stop:(y="")=>K0(y,0),message:(y="")=>{Z=R(y??Z)},cancel:(y="")=>K0(y,1),error:(y="")=>K0(y,2),clear:()=>K0("",0,!0),get isCancelled(){return H}}},QH={light:T("─","-"),heavy:T("━","="),block:T("█","#")};var T8=($,Q)=>$.includes(`
53
53
  `)?$.split(`
54
54
  `).map((J)=>Q(J)).join(`
55
- `):Q($),hQ=($)=>{let Q=(J,q)=>{let Y=J.label??String(J.value);switch(q){case"disabled":return`${R("gray",T$)} ${g$(Y,(G)=>R("gray",G))}${J.hint?` ${R("dim",`(${J.hint??"disabled"})`)}`:""}`;case"selected":return`${g$(Y,(G)=>R("dim",G))}`;case"active":return`${R("green",Q8)} ${Y}${J.hint?` ${R("dim",`(${J.hint})`)}`:""}`;case"cancelled":return`${g$(Y,(G)=>R(["strikethrough","dim"],G))}`;default:return`${R("dim",T$)} ${g$(Y,(G)=>R("dim",G))}`}};return new e6({options:$.options,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue,render(){let J=$.withGuide??n.withGuide,q=`${TQ(this.state)} `,Y=`${XY(this.state)} `,G=c1($.output,$.message,Y,q),X=`${J?`${R("gray",c)}
55
+ `):Q($),p4=($)=>{let Q=(J,q)=>{let Y=J.label??String(J.value);switch(q){case"disabled":return`${k("gray",y8)} ${T8(Y,(G)=>k("gray",G))}${J.hint?` ${k("dim",`(${J.hint??"disabled"})`)}`:""}`;case"selected":return`${T8(Y,(G)=>k("dim",G))}`;case"active":return`${k("green",q$)} ${Y}${J.hint?` ${k("dim",`(${J.hint})`)}`:""}`;case"cancelled":return`${T8(Y,(G)=>k(["strikethrough","dim"],G))}`;default:return`${k("dim",y8)} ${T8(Y,(G)=>k("dim",G))}`}};return new Q$({options:$.options,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue,render(){let J=$.withGuide??n.withGuide,q=`${m4(this.state)} `,Y=`${IY(this.state)} `,G=p1($.output,$.message,Y,q),V=`${J?`${k("gray",c)}
56
56
  `:""}${G}
57
- `;switch(this.state){case"submit":{let V=J?`${R("gray",c)} `:"",U=c1($.output,Q(this.options[this.cursor],"selected"),V);return`${X}${U}`}case"cancel":{let V=J?`${R("gray",c)} `:"",U=c1($.output,Q(this.options[this.cursor],"cancelled"),V);return`${X}${U}${J?`
58
- ${R("gray",c)}`:""}`}default:{let V=J?`${R("cyan",c)} `:"",U=J?R("cyan",y$):"",K=X.split(`
59
- `).length,W=J?2:1;return`${X}${V}${VY({output:$.output,cursor:this.cursor,options:this.options,maxItems:$.maxItems,columnPadding:V.length,rowPadding:K+W,style:(F,j)=>Q(F,F.disabled?"disabled":j?"active":"inactive")}).join(`
60
- ${V}`)}
61
- ${U}
62
- `}}}}).prompt()};var EF=`${R("gray",c)} `;var qQ=R$(iJ(),1),N=R$(aJ(),1);var sJ={name:"petdex",version:"1.2.0",description:"CLI for Petdex. Install, browse, and submit Codex pets from your terminal.",keywords:["petdex","codex","openai-codex","pets","pet","mascot","cli","terminal","animated","pixel-art","developer-tools","fun"],homepage:"https://petdex.dev",repository:{type:"git",url:"git+https://github.com/crafter-station/petdex.git",directory:"packages/petdex-cli"},license:"MIT",type:"module",engines:{node:">=20"},bin:{petdex:"dist/petdex.js"},files:["dist","README.md","AGENTS.md","CLAUDE.md"],scripts:{build:"bun build ./bin/petdex.ts --target=node --outfile=./dist/petdex.js --minify --external @napi-rs/keyring",postbuild:`node -e 'const f="./dist/petdex.js";const fs=require("fs");const c=fs.readFileSync(f,"utf8");if(!c.startsWith("#!")){fs.writeFileSync(f,"#!/usr/bin/env node\\n"+c)}fs.chmodSync(f,0o755)'`,typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"^1.3.0",jszip:"^3.10.1",picocolors:"^1.1.1"},optionalDependencies:{"@napi-rs/keyring":"^1.1.6"},devDependencies:{"@types/node":"^26.0.0","bun-types":"^1.3.13",typescript:"^7.0.2"}};var WU=new Set(["assets.petdex.dev"]);function u5($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return WU.has(Q.hostname)}catch{return!1}}import{spawn as wU}from"node:child_process";import{createServer as UU}from"node:http";class h extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var jU=`<!doctype html>
57
+ `;switch(this.state){case"submit":{let X=J?`${k("gray",c)} `:"",W=p1($.output,Q(this.options[this.cursor],"selected"),X);return`${V}${W}`}case"cancel":{let X=J?`${k("gray",c)} `:"",W=p1($.output,Q(this.options[this.cursor],"cancelled"),X);return`${V}${W}${J?`
58
+ ${k("gray",c)}`:""}`}default:{let X=J?`${k("cyan",c)} `:"",W=J?k("cyan",h8):"",K=V.split(`
59
+ `).length,U=J?2:1;return`${V}${X}${NY({output:$.output,cursor:this.cursor,options:this.options,maxItems:$.maxItems,columnPadding:X.length,rowPadding:K+U,style:(F,j)=>Q(F,F.disabled?"disabled":j?"active":"inactive")}).join(`
60
+ ${X}`)}
61
+ ${W}
62
+ `}}}}).prompt()};var JH=`${k("gray",c)} `;var U4=_1(d2(),1),I=_1(Q3(),1);var J3={name:"petdex",version:"1.2.2",description:"CLI for Petdex. Install, browse, and submit Codex pets from your terminal.",keywords:["petdex","codex","openai-codex","pets","pet","mascot","cli","terminal","animated","pixel-art","developer-tools","fun"],homepage:"https://petdex.dev",repository:{type:"git",url:"git+https://github.com/crafter-station/petdex.git",directory:"packages/petdex-cli"},license:"MIT",type:"module",engines:{node:">=20"},bin:{petdex:"dist/petdex.js"},files:["dist","README.md","AGENTS.md","CLAUDE.md"],scripts:{build:"bun build ./bin/petdex.ts --target=node --outfile=./dist/petdex.js --minify --external @napi-rs/keyring",postbuild:`node -e 'const f="./dist/petdex.js";const fs=require("fs");const c=fs.readFileSync(f,"utf8");if(!c.startsWith("#!")){fs.writeFileSync(f,"#!/usr/bin/env node\\n"+c)}fs.chmodSync(f,0o755)'`,typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"^1.3.0",jszip:"^3.10.1",picocolors:"^1.1.1"},optionalDependencies:{"@napi-rs/keyring":"^1.1.6"},devDependencies:{"@types/node":"^26.0.0","bun-types":"^1.3.13",typescript:"^7.0.2"}};var OW=new Set(["assets.petdex.dev"]);function o2($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return OW.has(Q.hostname)}catch{return!1}}var i2=["profile","email","openid","offline_access"];async function q3({petdexUrl:$,env:Q=process.env,fetchImpl:J=fetch,warnOnFallback:q=!0}){let{CLERK_ISSUER:Y,CLERK_OAUTH_CLIENT_ID:G}=Q;if(Y&&G)return{issuer:Y,clientId:G,scopes:i2};try{let V=await J(`${$}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(V.ok){let X=await V.json(),W=typeof X.issuer==="string"?X.issuer:null,K=typeof X.clientId==="string"?X.clientId:null,U=Array.isArray(X.scopes)?X.scopes.filter((F)=>typeof F==="string"):null;if(W&&K)return{issuer:Y??W,clientId:G??K,scopes:U&&U.length>0?U:i2}}}catch{}if(q)console.error("petdex: unable to refresh auth configuration; using fallback authentication values.");return{issuer:Y??"https://clerk.petdex.dev",clientId:G??"LcThwEayl6KAA1Qm",scopes:i2}}import{spawn as hW}from"node:child_process";import{createServer as BW}from"node:http";class h extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var DW=`<!doctype html>
63
63
  <html>
64
64
  <head><meta charset="utf-8"><title>Authentication complete</title></head>
65
65
  <body><h1>Authentication complete</h1><p>You can close this tab and return to your terminal.</p></body>
66
- </html>`,FU=`<!doctype html>
66
+ </html>`,vW=`<!doctype html>
67
67
  <html>
68
68
  <head><meta charset="utf-8"><title>Authentication failed</title></head>
69
69
  <body><h1>Authentication failed</h1><p>You can close this tab and return to your terminal.</p></body>
70
- </html>`;function d5($,Q){return new h($,Q)}function tJ($){let{expectedState:Q,port:J=0,timeoutMs:q=120000,successHtml:Y=jU,errorHtml:G=FU}=$,X,V=!1,U=!1,K,W,F=new Promise((Z,L)=>{K=Z,W=L}),j=(Z)=>{if(U)return;U=!0,Z.close()},H=UU((Z,L)=>{if(V){L.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),L.end("Authentication callback already handled.");return}if(Z.method!=="GET"||!Z.url){L.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),L.end("Not found");return}let O=new URL(Z.url,"http://127.0.0.1");if(O.pathname!=="/callback"){L.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),L.end("Clerk CLI auth server is waiting for /callback.");return}let I=O.searchParams.get("code"),P=O.searchParams.get("state"),B=O.searchParams.get("error"),M=O.searchParams.get("error_description")??B,z=(v,w,D)=>{if(V=!0,X)clearTimeout(X);L.writeHead(v,{"Content-Type":"text/html; charset=utf-8"}),L.end(w,()=>{if(D)W(D);else if(I&&P)K({code:I,state:P});j(H)})};if(B){z(400,G,d5("token_exchange",`OAuth authorization failed: ${M??"unknown error"}`));return}if(P!==Q){z(400,G,d5("state_mismatch","OAuth callback state did not match."));return}if(!I){z(400,G,d5("token_exchange","OAuth callback did not include an authorization code."));return}z(200,Y)});return new Promise((Z,L)=>{H.once("error",(O)=>{L(new h("config",`Failed to start local auth callback server: ${O.message}`))}),H.listen(J,"127.0.0.1",()=>{let I=H.address().port,P=`http://127.0.0.1:${I}/callback`;X=setTimeout(()=>{if(V)return;V=!0,W(new h("timeout",`OAuth callback timed out after ${q}ms.`)),j(H)},q),Z({port:I,redirectUri:P,waitForCallback:()=>F,close:()=>{if(X)clearTimeout(X);if(!V)V=!0,W(new h("timeout","OAuth callback server was closed."));j(H)}})})})}import{chmod as HU,mkdir as PU,readFile as ZU,writeFile as zU}from"node:fs/promises";import{homedir as LU}from"node:os";import{dirname as MU,join as IU}from"node:path";function eJ($,Q){if(Q instanceof h)return Q;let J=Q instanceof Error?Q.message:String(Q);return new h("storage",`${$}: ${J}`)}function Q4($){return $?.environment??"default"}function NU($){return IU(LU(),".config","clerk-cli-auth",`${$}.json`)}class J4{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class q4{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 ZU(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let J={};for(let[q,Y]of Object.entries(Q))if(typeof Y==="string")J[q]=Y;return J}catch($){if($.code==="ENOENT")return{};throw eJ(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await PU(MU(this.filePath),{recursive:!0}),await zU(this.filePath,`${JSON.stringify($,null,2)}
71
- `,{mode:384}),await HU(this.filePath,384)}catch(Q){throw eJ(`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 J=await this.readAll();J[$]=Q,await this.writeAll(J)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class Y4{service;environment;fallback;keyringPromise=null;constructor($,Q,J){this.service=$;this.environment=Q;this.fallback=J}account($){return`${this.environment}:${$}`}warnFallback($,Q){let J=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&J.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${J}`)}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 J=await this.loadKeyring();if(!J){await this.fallback.set($,Q);return}new J.Entry(this.service,this.account($)).setPassword(Q)}catch(J){this.warnFallback("set",J),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 $4($){let Q=Q4($);return new q4($?.filePath??NU(Q))}function G4($,Q){if($==="memory")return new J4;if($==="file")return $4(Q);let J=$4(Q),q=Q?.keychainService??"clerk-cli-auth",Y=Q4(Q);return new Y4(q,Y,J)}import{createHash as OU,randomBytes as X4}from"node:crypto";function l5($){return $.toString("base64url")}function V4(){return l5(X4(32))}async function K4($){return l5(OU("sha256").update($).digest())}function W4(){return l5(X4(32))}function U4($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function j4($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function F4($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let J=$;for(let q of["error_description","message","error"]){let Y=J[q];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function BU($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new h("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 H4($,Q){let J;try{J=await fetch(U4($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new h("token_exchange",`Token request failed: ${Y.message}`)}let q;try{q=await j4(J)}catch(Y){throw new h("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!J.ok)throw new h("token_exchange",F4(q,`Token request failed with HTTP ${J.status}.`));if(!q||typeof q!=="object")throw new h("token_exchange","Token response was not JSON.");return BU(q)}async function P4($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return H4($.issuer,Q)}async function Z4($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return H4($.issuer,Q)}async function o5($){let Q;try{Q=await fetch(U4($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new h("userinfo",`Userinfo request failed: ${Y.message}`)}let J;try{J=await j4(Q)}catch(Y){throw new h("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new h("userinfo",F4(J,`Userinfo request failed with HTTP ${Q.status}.`));if(!J||typeof J!=="object")throw new h("userinfo","Userinfo response was not JSON.");let q=J;if(typeof q.sub!=="string"||q.sub.length===0)throw new h("userinfo","Userinfo response did not include sub.");return q}var DU=["profile","email","openid","offline_access"];function vU($){let Q=$.trim().replace(/\/+$/,"");try{let J=new URL(Q);if(J.protocol!=="http:"&&J.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(J){throw new h("config",`issuer must be a valid URL: ${J.message}`)}}function E6($,Q){if(Q instanceof h)return Q;let J=Q instanceof Error?Q.message:String(Q);return new h("storage",`Failed to ${$}: ${J}`)}async function CU($){console.log(`Open this URL to sign in:
72
- ${$}`);let Q=process.platform,J=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let G=wU(J,q,{detached:!0,stdio:"ignore"});G.once("error",()=>Y()),G.unref(),Y()})}class x6{config;constructor($){if(!$.clientId)throw new h("config","clientId is required");if(!$.issuer)throw new h("config","issuer is required");let Q=$.environment??"default",J=typeof $.storage==="object"&&$.storage!==null?$.storage:G4($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:vU($.issuer),scopes:$.scopes??DU,storage:J,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=V4(),Q=await K4($),J=W4(),q=await tJ({expectedState:J,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",J),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??CU)(Y.toString())}catch(U){throw new h("config",`Failed to open authorization URL: ${U.message}`)}let{code:G}=await q.waitForCallback(),X=await P4({issuer:this.config.issuer,clientId:this.config.clientId,code:G,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",X);let V=await o5({issuer:this.config.issuer,accessToken:X.accessToken});return await this.setJson("user",V),{tokens:X,user:V}}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 J=await Z4({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...J,refreshToken:J.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 J=await o5({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",J),J}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw E6("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(J){throw E6(`read ${$}`,J)}if(!Q)return null;try{return JSON.parse(Q)}catch(J){throw E6(`parse stored ${$}`,J)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(J){throw E6(`write ${$}`,J)}}}import{spawn as AU}from"node:child_process";import{randomUUID as z4}from"node:crypto";import{existsSync as RU,mkdirSync as kU,readFileSync as EU,writeFileSync as xU}from"node:fs";import{homedir as SU}from"node:os";import L4 from"node:path";function S6(){let $=process.env.HOME??SU();return L4.join($,".petdex","telemetry.json")}var gU=process.env.PETDEX_TELEMETRY_URL??"https://petdex.dev/api/telemetry/event",TU=2000;function g6(){if(!RU(S6()))return{kind:"missing"};let $;try{$=EU(S6(),"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 i5($){try{return kU(L4.dirname(S6()),{recursive:!0}),xU(S6(),`${JSON.stringify($,null,2)}
73
- `),!0}catch{return!1}}function M4(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=g6();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:z4(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return i5(Q)?Q:null}function I4(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=g6();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function N4($){let Q=g6(),J;if(Q.kind==="ok")J=Q.config,J.enabled=$;else J={install_id:z4(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return i5(J)}function O4(){let $=g6();return{enabled:I4(),install_id:$.kind==="ok"?$.config.install_id:null}}function B4(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=M4();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.dev/legal/telemetry",""].join(`
74
- `)),$.notice_seen=!0,i5($)}function w4($,Q={}){if(!I4())return;let J=M4();if(!J)return;let q=JSON.stringify({install_id:J.install_id,event:$,...Q});try{let Y=`
70
+ </html>`;function n2($,Q){return new h($,Q)}function Y3($){let{expectedState:Q,port:J=0,timeoutMs:q=120000,successHtml:Y=DW,errorHtml:G=vW}=$,V,X=!1,W=!1,K,U,F=new Promise((Z,z)=>{K=Z,U=z}),j=(Z)=>{if(W)return;W=!0,Z.close()},H=BW((Z,z)=>{if(X){z.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),z.end("Authentication callback already handled.");return}if(Z.method!=="GET"||!Z.url){z.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),z.end("Not found");return}let w=new URL(Z.url,"http://127.0.0.1");if(w.pathname!=="/callback"){z.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),z.end("Clerk CLI auth server is waiting for /callback.");return}let N=w.searchParams.get("code"),P=w.searchParams.get("state"),O=w.searchParams.get("error"),M=w.searchParams.get("error_description")??O,L=(A,C,B)=>{if(X=!0,V)clearTimeout(V);z.writeHead(A,{"Content-Type":"text/html; charset=utf-8"}),z.end(C,()=>{if(B)U(B);else if(N&&P)K({code:N,state:P});j(H)})};if(O){L(400,G,n2("token_exchange",`OAuth authorization failed: ${M??"unknown error"}`));return}if(P!==Q){L(400,G,n2("state_mismatch","OAuth callback state did not match."));return}if(!N){L(400,G,n2("token_exchange","OAuth callback did not include an authorization code."));return}L(200,Y)});return new Promise((Z,z)=>{H.once("error",(w)=>{z(new h("config",`Failed to start local auth callback server: ${w.message}`))}),H.listen(J,"127.0.0.1",()=>{let N=H.address().port,P=`http://127.0.0.1:${N}/callback`;V=setTimeout(()=>{if(X)return;X=!0,U(new h("timeout",`OAuth callback timed out after ${q}ms.`)),j(H)},q),Z({port:N,redirectUri:P,waitForCallback:()=>F,close:()=>{if(V)clearTimeout(V);if(!X)X=!0,U(new h("timeout","OAuth callback server was closed."));j(H)}})})})}import{chmod as CW,mkdir as AW,readFile as RW,writeFile as kW}from"node:fs/promises";import{homedir as EW}from"node:os";import{dirname as gW,join as xW}from"node:path";function G3($,Q){if(Q instanceof h)return Q;let J=Q instanceof Error?Q.message:String(Q);return new h("storage",`${$}: ${J}`)}function X3($){return $?.environment??"default"}function SW($){return xW(EW(),".config","clerk-cli-auth",`${$}.json`)}class K3{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class U3{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 RW(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let J={};for(let[q,Y]of Object.entries(Q))if(typeof Y==="string")J[q]=Y;return J}catch($){if($.code==="ENOENT")return{};throw G3(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await AW(gW(this.filePath),{recursive:!0}),await kW(this.filePath,`${JSON.stringify($,null,2)}
71
+ `,{mode:384}),await CW(this.filePath,384)}catch(Q){throw G3(`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 J=await this.readAll();J[$]=Q,await this.writeAll(J)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class W3{service;environment;fallback;keyringPromise=null;constructor($,Q,J){this.service=$;this.environment=Q;this.fallback=J}account($){return`${this.environment}:${$}`}warnFallback($,Q){let J=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&J.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${J}`)}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 J=await this.loadKeyring();if(!J){await this.fallback.set($,Q);return}new J.Entry(this.service,this.account($)).setPassword(Q)}catch(J){this.warnFallback("set",J),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 V3($){let Q=X3($);return new U3($?.filePath??SW(Q))}function j3($,Q){if($==="memory")return new K3;if($==="file")return V3(Q);let J=V3(Q),q=Q?.keychainService??"clerk-cli-auth",Y=X3(Q);return new W3(q,Y,J)}import{createHash as TW,randomBytes as F3}from"node:crypto";function r2($){return $.toString("base64url")}function H3(){return r2(F3(32))}async function P3($){return r2(TW("sha256").update($).digest())}function Z3(){return r2(F3(32))}function z3($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function L3($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function M3($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let J=$;for(let q of["error_description","message","error"]){let Y=J[q];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function yW($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new h("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 I3($,Q){let J;try{J=await fetch(z3($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new h("token_exchange",`Token request failed: ${Y.message}`)}let q;try{q=await L3(J)}catch(Y){throw new h("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!J.ok)throw new h("token_exchange",M3(q,`Token request failed with HTTP ${J.status}.`));if(!q||typeof q!=="object")throw new h("token_exchange","Token response was not JSON.");return yW(q)}async function N3($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return I3($.issuer,Q)}async function w3($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return I3($.issuer,Q)}async function a2($){let Q;try{Q=await fetch(z3($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new h("userinfo",`Userinfo request failed: ${Y.message}`)}let J;try{J=await L3(Q)}catch(Y){throw new h("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new h("userinfo",M3(J,`Userinfo request failed with HTTP ${Q.status}.`));if(!J||typeof J!=="object")throw new h("userinfo","Userinfo response was not JSON.");let q=J;if(typeof q.sub!=="string"||q.sub.length===0)throw new h("userinfo","Userinfo response did not include sub.");return q}var fW=["profile","email","openid","offline_access"];function bW($){let Q=$.trim().replace(/\/+$/,"");try{let J=new URL(Q);if(J.protocol!=="http:"&&J.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(J){throw new h("config",`issuer must be a valid URL: ${J.message}`)}}function g6($,Q){if(Q instanceof h)return Q;let J=Q instanceof Error?Q.message:String(Q);return new h("storage",`Failed to ${$}: ${J}`)}async function _W($){console.log(`Open this URL to sign in:
72
+ ${$}`);let Q=process.platform,J=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let G=hW(J,q,{detached:!0,stdio:"ignore"});G.once("error",()=>Y()),G.unref(),Y()})}class x6{config;constructor($){if(!$.clientId)throw new h("config","clientId is required");if(!$.issuer)throw new h("config","issuer is required");let Q=$.environment??"default",J=typeof $.storage==="object"&&$.storage!==null?$.storage:j3($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:bW($.issuer),scopes:$.scopes??fW,storage:J,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=H3(),Q=await P3($),J=Z3(),q=await Y3({expectedState:J,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",J),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??_W)(Y.toString())}catch(W){throw new h("config",`Failed to open authorization URL: ${W.message}`)}let{code:G}=await q.waitForCallback(),V=await N3({issuer:this.config.issuer,clientId:this.config.clientId,code:G,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",V);let X=await a2({issuer:this.config.issuer,accessToken:V.accessToken});return await this.setJson("user",X),{tokens:V,user:X}}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 J=await w3({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...J,refreshToken:J.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 J=await a2({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",J),J}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw g6("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(J){throw g6(`read ${$}`,J)}if(!Q)return null;try{return JSON.parse(Q)}catch(J){throw g6(`parse stored ${$}`,J)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(J){throw g6(`write ${$}`,J)}}}var D3=_1(d2(),1);import{readFile as mW,stat as cW}from"node:fs/promises";import{inflateSync as pW}from"node:zlib";var O3=8388608,C8=Buffer.from([137,80,78,71,13,10,26,10]),uW=[[0,0,8,8],[4,0,8,8],[0,4,4,8],[2,0,4,4],[0,2,2,4],[1,0,2,2],[0,1,1,2]],S6=new Uint32Array(256);for(let $=0;$<S6.length;$+=1){let Q=$;for(let J=0;J<8;J+=1)Q=Q&1?3988292384^Q>>>1:Q>>>1;S6[$]=Q>>>0}function dW($){return $.length>=C8.length&&$.subarray(0,C8.length).equals(C8)}function lW($){if($.length<16||$.subarray(0,4).toString("ascii")!=="RIFF"||$.subarray(8,12).toString("ascii")!=="WEBP")return!1;let Q=$.readUInt32LE(4);return Q>=4&&Q+8<=$.length}function oW($,Q){let J=4294967295;for(let q of $)J=S6[(J^q)&255]^J>>>8;for(let q of Q)J=S6[(J^q)&255]^J>>>8;return(J^4294967295)>>>0}function B3($){switch($){case 0:return 1;case 2:return 3;case 3:return 1;case 4:return 2;case 6:return 4;default:return null}}function iW($,Q){return{0:[1,2,4,8,16],2:[8,16],3:[1,2,4,8],4:[8,16],6:[8,16]}[$]?.includes(Q)??!1}function nW($,Q,J,q){if(q===0){let G=Math.ceil($*J/8);return Array.from({length:Q},()=>G)}let Y=[];for(let[G,V,X,W]of uW){let K=$>G?Math.ceil(($-G)/X):0,U=Q>V?Math.ceil((Q-V)/W):0;if(K===0||U===0)continue;let F=Math.ceil(K*J/8);for(let j=0;j<U;j+=1)Y.push(F)}return Y}function rW($){if(!dW($))return null;let Q=C8.length,J=null,q=[],Y=!1;while(Q<$.length){if(Q+12>$.length)return null;let U=$.readUInt32BE(Q),F=Q+12+U;if(F>$.length)return null;let j=$.subarray(Q+4,Q+8),H=$.subarray(Q+8,Q+8+U),Z=$.readUInt32BE(Q+8+U);if(oW(j,H)!==Z)return null;let z=j.toString("ascii");if(z==="IHDR"){if(Q!==C8.length||U!==13)return null;if(J={width:H.readUInt32BE(0),height:H.readUInt32BE(4),bitDepth:H[8],colorType:H[9],interlace:H[12]},H[10]!==0||H[11]!==0)return null}else if(!J)return null;else if(z==="IDAT")q.push(H);else if(z==="IEND"){if(U!==0)return null;Y=!0,Q=F;break}Q=F}if(!Y||Q!==$.length||!J||q.length===0)return null;if(J.width===0||J.height===0||!B3(J.colorType)||!iW(J.colorType,J.bitDepth)||J.interlace!==0&&J.interlace!==1)return null;let G=B3(J.colorType);if(G===null)return null;let V=nW(J.width,J.height,G*J.bitDepth,J.interlace),X=V.reduce((U,F)=>U+F+1,0);if(X>134217728)return null;let W;try{W=pW(Buffer.concat(q))}catch{return null}if(W.length!==X)return null;let K=0;for(let U of V){if(W[K]>4)return null;K+=U+1}return{width:J.width,height:J.height}}function aW($){if(!lW($))return null;let Q=8+$.readUInt32LE(4);if(Q!==$.length)return null;let J=[],q=12;while(q<Q){if(q+8>Q)return null;let Y=$.readUInt32LE(q+4),G=q+8+Y,V=G+(Y&1);if(V>Q)return null;J.push({type:$.subarray(q,q+4).toString("ascii"),data:$.subarray(q+8,G)}),q=V}return q===Q?J:null}function s2($){if($.length<10||$[3]!==157||$[4]!==1||$[5]!==42)return null;let Q=$.readUInt16LE(6)&16383,J=$.readUInt16LE(8)&16383;return Q>0&&J>0?{width:Q,height:J}:null}function t2($){if($.length<5||$[0]!==47)return null;let Q=1+(($[1]|($[2]&63)<<8)>>>0),J=1+(($[2]>>6|$[3]<<2|($[4]&15)<<10)>>>0);return Q>0&&J>0?{width:Q,height:J}:null}function sW($){let Q=16;while(Q<$.length){if(Q+8>$.length)return!1;let J=$.subarray(Q,Q+4).toString("ascii"),q=$.readUInt32LE(Q+4),Y=Q+8+q,G=Y+(q&1);if(G>$.length)return!1;let V=$.subarray(Q+8,Y);if(J==="VP8 "&&s2(V))return!0;if(J==="VP8L"&&t2(V))return!0;Q=G}return!1}function tW($){let Q=aW($);if(!Q)return null;let J=Q.find((X)=>X.type==="VP8X"),q=Q.find((X)=>X.type==="VP8 "),Y=Q.find((X)=>X.type==="VP8L");if(!J)return q?s2(q.data):Y?t2(Y.data):null;if(J.data.length!==10)return null;let G={width:1+((J.data[4]|J.data[5]<<8|J.data[6]<<16)>>>0),height:1+((J.data[7]|J.data[8]<<8|J.data[9]<<16)>>>0)};if(G.width<=0||G.height<=0)return null;if(q&&s2(q.data))return G;if(Y&&t2(Y.data))return G;let V=Q.find((X)=>X.type==="ANMF");return V&&sW(V.data)?G:null}function v3($){let Q=rW($);if(Q)return{...Q,format:"png"};let J=tW($);if(J)return{...J,format:"webp"};return null}function C3($){let Q=v3($);return Q?{width:Q.width,height:Q.height}:{width:0,height:0}}function eW($){let Q=v3($);if(!Q)throw Error("sprite must be a valid PNG or WebP file");return{buffer:$,format:Q.format,contentType:Q.format==="png"?"image/png":"image/webp",width:Q.width,height:Q.height}}function $j($){let Q;try{Q=JSON.parse($.toString("utf8"))}catch{throw Error("metadata is not valid JSON")}if(Q===null||typeof Q!=="object"||Array.isArray(Q))throw Error("metadata must be a JSON object");return Q}async function Qj($){try{await D3.default.loadAsync($,{checkCRC32:!0})}catch{throw Error("zip is not a valid archive")}}async function e2($){let Q=await cW($);if(!Q.isFile())throw Error(`not a file: ${$}`);if(Q.size<=0||Q.size>O3)throw Error(`asset is ${(Q.size/1048576).toFixed(1)} MB; maximum is 8 MB`);let J=await mW($);if(J.length<=0||J.length>O3)throw Error("asset changed while it was being read");return J}async function A3($){return eW(await e2($))}async function R3($){let Q=await e2($);return $j(Q),Q}async function k3($){let Q=await e2($);return await Qj(Q),Q}import{spawn as Jj}from"node:child_process";import{randomUUID as E3}from"node:crypto";import{existsSync as qj,mkdirSync as Yj,readFileSync as Gj,writeFileSync as Vj}from"node:fs";import{homedir as Xj}from"node:os";import g3 from"node:path";function T6(){let $=process.env.HOME??Xj();return g3.join($,".petdex","telemetry.json")}var Kj=process.env.PETDEX_TELEMETRY_URL??"https://petdex.dev/api/telemetry/event",Uj=2000;function y6(){if(!qj(T6()))return{kind:"missing"};let $;try{$=Gj(T6(),"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 $4($){try{return Yj(g3.dirname(T6()),{recursive:!0}),Vj(T6(),`${JSON.stringify($,null,2)}
73
+ `),!0}catch{return!1}}function x3(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=y6();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:E3(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return $4(Q)?Q:null}function S3(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=y6();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function T3($){let Q=y6(),J;if(Q.kind==="ok")J=Q.config,J.enabled=$;else J={install_id:E3(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return $4(J)}function y3(){let $=y6();return{enabled:S3(),install_id:$.kind==="ok"?$.config.install_id:null}}function h3(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=x3();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.dev/legal/telemetry",""].join(`
74
+ `)),$.notice_seen=!0,$4($)}function f3($,Q={}){if(!S3())return;let J=x3();if(!J)return;let q=JSON.stringify({install_id:J.install_id,event:$,...Q});try{let Y=`
75
75
  const controller = new AbortController();
76
- const t = setTimeout(() => controller.abort(), ${TU});
77
- fetch(${JSON.stringify(gU)}, {
76
+ const t = setTimeout(() => controller.abort(), ${Uj});
77
+ fetch(${JSON.stringify(Kj)}, {
78
78
  method: "POST",
79
79
  headers: { "content-type": "application/json" },
80
80
  body: ${JSON.stringify(q)},
81
81
  signal: controller.signal,
82
82
  }).catch(() => {}).finally(() => clearTimeout(t));
83
- `;AU(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var l=process.env.PETDEX_URL??"https://petdex.dev",Nj=`${l.replace(/\/+$/,"")}/`,Yq=`${l.replace(/\/+$/,"")}/download`,$Q="The desktop app runs on its own. Launch Petdex from Applications.",e4="Quit Petdex from its menu bar icon to stop it.",Gq=new Map([["init","The desktop app installs its own agent hooks from Settings."],["up",$Q],["start",$Q],["restart",$Q],["down",e4],["stop",e4],["toggle","Toggle the mascot from the Petdex menu bar icon."],["desktop","The desktop app manages its own lifecycle."],["update","The desktop app updates itself automatically."],["doctor","Petdex Settings shows agent and hook status directly."],["hooks","Install agent hooks from Petdex Settings, one click per agent."]]),Oj="https://clerk.petdex.dev",Bj="LcThwEayl6KAA1Qm",QQ=["profile","email","openid","offline_access"];async function wj(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:QQ};try{let J=await fetch(`${l}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(J.ok){let q=await J.json(),Y=typeof q.issuer==="string"?q.issuer:null,G=typeof q.clientId==="string"?q.clientId:null,X=Array.isArray(q.scopes)?q.scopes.filter((V)=>typeof V==="string"):null;if(Y&&G)return{issuer:$??Y,clientId:Q??G,scopes:X&&X.length>0?X:QQ}}}catch{}return{issuer:$??Oj,clientId:Q??Bj,scopes:QQ}}var y6=null;async function A$(){if(y6)return y6;let $=await wj();return y6=new x6({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),y6}var f6=sJ.version;Dj().catch(($)=>{i(`petdex: ${$.message}`),process.exit(1)});async function Dj(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:q}=await Promise.resolve().then(() => (d4(),u4));await q($.slice(1));return}if(Q==="mcp-server"){let{runMcpServer:q}=await Promise.resolve().then(() => (a4(),r4));await q();return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){$q();return}if(Gq.has(Q)){Xq(Q);return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))B4();switch(Q){case"login":await vj();break;case"logout":await Cj();break;case"whoami":await Aj();break;case"submit":await Sj($.slice(1));break;case"edit":await gj($.slice(1));break;case"install":await Ej($.slice(1));break;case"list":await xj();break;case"telemetry":dj($.slice(1));break;case"version":case"--version":case"-v":console.log(f6);break;default:console.error(N.default.red(`Unknown command: ${Q}`)),$q(),process.exit(1)}}function Xq($){let Q=Gq.get($)??"";console.error(["",` ${N.default.yellow("!")} ${N.default.bold(`petdex ${$}`)} was removed in v${f6.split(".")[0]}.`,"",` ${Q}`,` Get the app: ${N.default.underline(Yq)}`,"",` This CLI now manages the pet catalog: ${N.default.cyan("petdex list")}, ${N.default.cyan("petdex install <slug>")}.`,""].join(`
84
- `))}function $q(){let $=N.default.cyan,Q=N.default.dim;console.log(["",` ${N.default.bold(N.default.magenta("petdex"))} ${Q(f6)} ${Q("Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${N.default.bold("list")} List approved pets`,` ${N.default.bold("install")} <slug...> Install one or more pets into ~/.petdex/pets and ~/.codex/pets`,` ${N.default.bold("login")} Sign in with Clerk OAuth`,` ${N.default.bold("logout")} Clear stored credentials`,` ${N.default.bold("whoami")} Show signed-in user`,` ${N.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${N.default.bold("edit")} <slug> Edit a pet you own (--desc, --displayName, --sprite, --meta, --zip)`,` ${N.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,` ${N.default.bold("version")} Print the CLI version`,"",` ${$("Examples")}`,` ${Q("$")} petdex list ${Q("# browse the gallery")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex install boba doraemon mochi ${Q("# install several at once")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,"",` ${Q("The desktop mascot is now the Petdex app: it installs agent hooks")}`,` ${Q("from Settings and updates itself.")} ${N.default.underline(Yq)}`,"",` ${Q("Gallery & docs:")} ${N.default.underline(l)}`,""].join(`
85
- `))}async function vj(){h$(N.default.bgMagenta(N.default.white(" petdex login ")));let $=s0();$.start("Opening your browser to sign in with Clerk");try{let Q=await A$(),{user:J}=await Q.login(),q=Kq(J.email,J.username,J.sub)??"unknown";$.stop(`${N.default.green("✓ ")}Signed in as ${N.default.cyan(q)}`),u1(`Try ${N.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(N.default.red("× login failed")),Error(mj(Q.message))}}async function Cj(){await(await A$()).logout(),console.log(`${N.default.green("✓ ")}Signed out`)}async function Aj(){try{let Q=await(await A$()).whoami();if(!Q)throw Error("not signed in");let J=[b6(Q.given_name),b6(Q.family_name)].filter(Boolean).join(" ");d1([`${N.default.dim("user: ")}${Q.sub}`,`${N.default.dim("email: ")}${Q.email??"—"}`,`${N.default.dim("name: ")}${J||"—"}`,`${N.default.dim("username:")}${b6(Q.preferred_username)??"—"}`].join(`
86
- `),"Signed in")}catch{i(`Not signed in. Run ${N.default.cyan("petdex login")}.`),process.exit(1)}}function Vq($){let Q=$.spriteVersionNumber;if(Q===void 0||Q===1)return 1;if(Q===2)return 2;throw Error("spriteVersionNumber must be omitted, 1, or 2")}async function Rj(){let $=await fetch(`${l}/api/manifest`);if(!$.ok)throw Error(`manifest fetch ${$.status}`);return(await $.json()).pets}async function kj($){let Q=$.slug;if(!u5($.spritesheetUrl)||!u5($.petJsonUrl))throw Error(`untrusted asset host for ${Q} (admin needs to re-upload)`);let J=J0.join(t4(),".petdex","pets",Q),q=J0.join(t4(),".codex","pets",Q);await Promise.all([s4(J,{recursive:!0}),s4(q,{recursive:!0})]);let Y=$.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(U)=>{let K=await fetch(U,{headers:{Referer:Nj}});if(!K.ok)throw Error(`download ${U} -> ${K.status} ${K.statusText}`);return K.arrayBuffer()},[X,V]=await Promise.all([G($.petJsonUrl),G($.spritesheetUrl)]);await Promise.all([T6(J0.join(J,"pet.json"),Buffer.from(X)),T6(J0.join(J,`spritesheet.${Y}`),Buffer.from(V)),T6(J0.join(q,"pet.json"),Buffer.from(X)),T6(J0.join(q,`spritesheet.${Y}`),Buffer.from(V))]),fetch(`${l}/install/${Q}`,{method:"GET"}).catch(()=>{})}async function Ej($){let Q=$[0];if(!Q)i(`Usage: ${N.default.cyan("petdex install <slug> [slug...]")}`),process.exit(1);if(Q==="desktop"){Xq("desktop");return}let J=Array.from(new Set($)),q=s0();q.start(J.length===1?`Resolving ${J[0]}`:`Resolving ${J.length} pets`);let Y;try{Y=await Rj()}catch(W){throw q.stop(N.default.red("manifest failed")),W}let G=[],X=[];for(let W of J){let F=Y.find((j)=>j.slug===W);if(F)G.push(F);else X.push(W)}if(G.length===0)q.stop(N.default.red("none found")),i(`No pets matched. Try ${N.default.cyan("petdex list")} to see what's available.`),process.exit(1);let V=[],U=[];for(let W=0;W<G.length;W++){let F=G[W];q.message(G.length===1?`Downloading ${F.slug}`:`Downloading ${F.slug} (${W+1}/${G.length})`);try{await kj(F),V.push(F.displayName)}catch(j){U.push({slug:F.slug,reason:j instanceof Error?j.message:String(j)})}}if(V.length===G.length)q.stop(V.length===1?`Installed ${N.default.cyan(V[0])}`:`Installed ${N.default.cyan(V.length)} pets`);else if(V.length>0)q.stop(`Installed ${N.default.cyan(V.length)} of ${G.length} (${N.default.red(`${U.length} failed`)})`);else q.stop(N.default.red("all failed"));let K=[];if(V.length>0)K.push("Paths:"),K.push(` ${N.default.dim("~/.petdex/pets/")} (Petdex Desktop)`),K.push(` ${N.default.dim("~/.codex/pets/")} (Codex Desktop)`),K.push(""),K.push("Activate in Petdex Desktop: right-click the mascot."),K.push("Activate in Codex Desktop:"),K.push(` ${N.default.cyan("Settings -> Appearance -> Pets")}`);if(X.length>0){if(K.length>0)K.push("");K.push(N.default.yellow("Skipped (slug not found):"));for(let W of X)K.push(` ${W}`)}if(U.length>0){if(K.length>0)K.push("");K.push(N.default.red("Failed:"));for(let W of U)K.push(` ${W.slug}: ${W.reason}`)}if(K.length>0)d1(K.join(`
87
- `),"Next steps");if(U.length>0&&V.length===0)process.exit(1)}async function xj(){let $=s0();$.start("Fetching gallery");let Q=await fetch(`${l}/api/manifest`);if(!Q.ok)throw $.stop(N.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let J=await Q.json();$.stop(`${J.total} pets`);let q=J.pets.map((Y)=>{let G=Y.submittedBy?N.default.dim(` by ${Y.submittedBy}`):"";return` ${N.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${G}`});console.log(q.join(`
83
+ `;Jj(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var o=process.env.PETDEX_URL??"https://petdex.dev",rj=`${o.replace(/\/+$/,"")}/`,Mq=`${o.replace(/\/+$/,"")}/download`,X4="The desktop app runs on its own. Launch Petdex from Applications.",Hq="Quit Petdex from its menu bar icon to stop it.",Iq=new Map([["init","The desktop app installs its own agent hooks from Settings."],["up",X4],["start",X4],["restart",X4],["down",Hq],["stop",Hq],["toggle","Toggle the mascot from the Petdex menu bar icon."],["desktop","The desktop app manages its own lifecycle."],["update","The desktop app updates itself automatically."],["doctor","Petdex Settings shows agent and hook status directly."],["hooks","Install agent hooks from Petdex Settings, one click per agent."]]),f6=null;async function k8({warnOnFallback:$=!0}={}){if(f6)return f6;let Q=await q3({petdexUrl:o,warnOnFallback:$});return f6=new x6({clientId:Q.clientId,issuer:Q.issuer,scopes:Q.scopes,storage:"keychain",keychainService:"petdex-cli"}),f6}var m6=J3.version;aj().catch(($)=>{u(`petdex: ${$.message}`),process.exit(1)});async function aj(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:q}=await Promise.resolve().then(() => (Yq(),qq));await q($.slice(1));return}if(Q==="mcp-server"){let{runMcpServer:q}=await Promise.resolve().then(() => (Wq(),Uq));await q();return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){Pq();return}if(Iq.has(Q)){Nq(Q);return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))h3();switch(Q){case"login":await sj();break;case"logout":await tj();break;case"whoami":await ej();break;case"submit":await YF($.slice(1));break;case"edit":await GF($.slice(1));break;case"install":await JF($.slice(1));break;case"list":await qF();break;case"telemetry":zF($.slice(1));break;case"version":case"--version":case"-v":console.log(m6);break;default:console.error(I.default.red(`Unknown command: ${Q}`)),Pq(),process.exit(1)}}function Nq($){let Q=Iq.get($)??"";console.error(["",` ${I.default.yellow("!")} ${I.default.bold(`petdex ${$}`)} was removed in v${m6.split(".")[0]}.`,"",` ${Q}`,` Get the app: ${I.default.underline(Mq)}`,"",` This CLI now manages the pet catalog: ${I.default.cyan("petdex list")}, ${I.default.cyan("petdex install <slug>")}.`,""].join(`
84
+ `))}function Pq(){let $=I.default.cyan,Q=I.default.dim;console.log(["",` ${I.default.bold(I.default.magenta("petdex"))} ${Q(m6)} ${Q("Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${I.default.bold("list")} List approved pets`,` ${I.default.bold("install")} <slug...> Install one or more pets into ~/.petdex/pets and ~/.codex/pets`,` ${I.default.bold("login")} Sign in with Clerk OAuth`,` ${I.default.bold("logout")} Clear stored credentials`,` ${I.default.bold("whoami")} Show signed-in user`,` ${I.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${I.default.bold("edit")} <slug> Edit a pet you own (--desc, --displayName, --sprite, --meta, --zip)`,` ${I.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,` ${I.default.bold("version")} Print the CLI version`,"",` ${$("Examples")}`,` ${Q("$")} petdex list ${Q("# browse the gallery")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex install boba doraemon mochi ${Q("# install several at once")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,"",` ${Q("The desktop mascot is now the Petdex app: it installs agent hooks")}`,` ${Q("from Settings and updates itself.")} ${I.default.underline(Mq)}`,"",` ${Q("Gallery & docs:")} ${I.default.underline(o)}`,""].join(`
85
+ `))}async function sj(){f8(I.default.bgMagenta(I.default.white(" petdex login ")));let $=s0();$.start("Opening your browser to sign in with Clerk");try{let Q=await k8(),{user:J}=await Q.login(),q=Oq(J.email,J.username,J.sub)??"unknown";$.stop(`${I.default.green("✓ ")}Signed in as ${I.default.cyan(q)}`),d1(`Try ${I.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(I.default.red("× login failed")),Error(FF(Q.message))}}async function tj(){await(await k8({warnOnFallback:!1})).logout(),console.log(`${I.default.green("✓ ")}Signed out`)}async function ej(){try{let Q=await(await k8()).whoami();if(!Q)throw Error("not signed in");let J=[_6(Q.given_name),_6(Q.family_name)].filter(Boolean).join(" ");l1([`${I.default.dim("user: ")}${Q.sub}`,`${I.default.dim("email: ")}${Q.email??"—"}`,`${I.default.dim("name: ")}${J||"—"}`,`${I.default.dim("username:")}${_6(Q.preferred_username)??"—"}`].join(`
86
+ `),"Signed in")}catch{u(`Not signed in. Run ${I.default.cyan("petdex login")}.`),process.exit(1)}}function wq($){let Q=$.spriteVersionNumber;if(Q===void 0||Q===1)return 1;if(Q===2)return 2;throw Error("spriteVersionNumber must be omitted, 1, or 2")}async function $F(){let $=await fetch(`${o}/api/manifest`);if(!$.ok)throw Error(`manifest fetch ${$.status}`);return(await $.json()).pets}async function QF($){let Q=$.slug;if(!o2($.spritesheetUrl)||!o2($.petJsonUrl))throw Error(`untrusted asset host for ${Q} (admin needs to re-upload)`);let J=J0.join(Fq(),".petdex","pets",Q),q=J0.join(Fq(),".codex","pets",Q);await Promise.all([jq(J,{recursive:!0}),jq(q,{recursive:!0})]);let Y=$.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let K=await fetch(W,{headers:{Referer:rj}});if(!K.ok)throw Error(`download ${W} -> ${K.status} ${K.statusText}`);return K.arrayBuffer()},[V,X]=await Promise.all([G($.petJsonUrl),G($.spritesheetUrl)]);await Promise.all([h6(J0.join(J,"pet.json"),Buffer.from(V)),h6(J0.join(J,`spritesheet.${Y}`),Buffer.from(X)),h6(J0.join(q,"pet.json"),Buffer.from(V)),h6(J0.join(q,`spritesheet.${Y}`),Buffer.from(X))]),fetch(`${o}/install/${Q}`,{method:"GET"}).catch(()=>{})}async function JF($){let Q=$[0];if(!Q)u(`Usage: ${I.default.cyan("petdex install <slug> [slug...]")}`),process.exit(1);if(Q==="desktop"){Nq("desktop");return}let J=Array.from(new Set($)),q=s0();q.start(J.length===1?`Resolving ${J[0]}`:`Resolving ${J.length} pets`);let Y;try{Y=await $F()}catch(U){throw q.stop(I.default.red("manifest failed")),U}let G=[],V=[];for(let U of J){let F=Y.find((j)=>j.slug===U);if(F)G.push(F);else V.push(U)}if(G.length===0)q.stop(I.default.red("none found")),u(`No pets matched. Try ${I.default.cyan("petdex list")} to see what's available.`),process.exit(1);let X=[],W=[];for(let U=0;U<G.length;U++){let F=G[U];q.message(G.length===1?`Downloading ${F.slug}`:`Downloading ${F.slug} (${U+1}/${G.length})`);try{await QF(F),X.push(F.displayName)}catch(j){W.push({slug:F.slug,reason:j instanceof Error?j.message:String(j)})}}if(X.length===G.length)q.stop(X.length===1?`Installed ${I.default.cyan(X[0])}`:`Installed ${I.default.cyan(X.length)} pets`);else if(X.length>0)q.stop(`Installed ${I.default.cyan(X.length)} of ${G.length} (${I.default.red(`${W.length} failed`)})`);else q.stop(I.default.red("all failed"));let K=[];if(X.length>0)K.push("Paths:"),K.push(` ${I.default.dim("~/.petdex/pets/")} (Petdex Desktop)`),K.push(` ${I.default.dim("~/.codex/pets/")} (Codex Desktop)`),K.push(""),K.push("Activate in Petdex Desktop: right-click the mascot."),K.push("Activate in Codex Desktop:"),K.push(` ${I.default.cyan("Settings -> Appearance -> Pets")}`);if(V.length>0){if(K.length>0)K.push("");K.push(I.default.yellow("Skipped (slug not found):"));for(let U of V)K.push(` ${U}`)}if(W.length>0){if(K.length>0)K.push("");K.push(I.default.red("Failed:"));for(let U of W)K.push(` ${U.slug}: ${U.reason}`)}if(K.length>0)l1(K.join(`
87
+ `),"Next steps");if(W.length>0&&X.length===0)process.exit(1)}async function qF(){let $=s0();$.start("Fetching gallery");let Q=await fetch(`${o}/api/manifest`);if(!Q.ok)throw $.stop(I.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let J=await Q.json();$.stop(`${J.total} pets`);let q=J.pets.map((Y)=>{let G=Y.submittedBy?I.default.dim(` by ${Y.submittedBy}`):"";return` ${I.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${G}`});console.log(q.join(`
88
88
  `)),console.log(`
89
- ${N.default.dim("Install with")} ${N.default.cyan("petdex install <slug>")}
90
- ${N.default.dim("Browse:")} ${N.default.underline(l)}`)}async function Sj($){let J=$.filter((P)=>!P.startsWith("--"))[0];if(!J)i(`Usage: ${N.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let q=await A$(),Y;try{let P=await q.getAccessToken();if(!P)i(`Not signed in. Run ${N.default.cyan("petdex login")}.`),process.exit(1);Y=P}catch{i(`Not signed in. Run ${N.default.cyan("petdex login")}.`),process.exit(1)}let G=l;try{G=pj(await q.whoami())}catch{}let X=J0.resolve(J),V=await qq(X).catch(()=>null);if(!V)i(`No such file or directory: ${J}`),process.exit(1);h$(N.default.bgMagenta(N.default.white(" petdex submit ")));let U=s0();U.start(`Scanning ${X}`);let K=await Tj(X,V.isDirectory());if(U.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:N.default.red("no pets found")),K.length===0)i("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let F=$.includes("--force")?new Map:await _j(K,Y),j=K,H=0;if(F.size>0){let P=K.filter((z)=>F.has(C$(z.petIdHint))),B=K.filter((z)=>!F.has(C$(z.petIdHint)));d1(P.map((z)=>{let w=F.get(C$(z.petIdHint))?.status??"unknown";return`${N.default.yellow("•")} ${N.default.bold(z.label)} ${N.default.dim(`(${w})`)}`}).join(`
91
- `),`${P.length} already submitted by you`);let M=await hQ({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(_1(M)||M==="cancel")i("Aborted."),process.exit(1);if(M==="skip"){if(j=B,H=P.length,j.length===0){u1(`Nothing new to submit. Track approval at ${N.default.underline(G)}.`);return}}}if(j.length>1){let P=await yQ({message:`Submit ${N.default.bold(String(j.length))} pet${j.length===1?"":"s"}?`});if(_1(P)||!P)i("Aborted."),process.exit(1)}let Z=0,L=0,O=[];for(let P of j){let B=s0();B.start(`Submitting ${N.default.cyan(P.label)}`);try{let M=await q.getAccessToken();if(!M)throw Error("session expired");Y=M;let z=await hj(P,Y);G=cj(z.profileUrl)??G,B.stop(`${N.default.green("✓")} ${N.default.cyan(P.label)} → ${bj(z)}`),Z++}catch(M){let z=M.message;B.stop(`${N.default.red("×")} ${N.default.cyan(P.label)} ${N.default.red(z.slice(0,60))}`),O.push({label:P.label,error:z}),L++}}if(O.length>0)d1(O.map((P)=>`${N.default.red("•")} ${N.default.bold(P.label)}: ${P.error}`).join(`
92
- `),"Failures");let I=H>0?`, ${N.default.yellow(String(H))} skipped`:"";if(u1([`${N.default.green(String(Z))} submitted${I}, ${L>0?N.default.red(String(L)):N.default.dim(String(L))} failed.`,`Held submissions stay visible at ${N.default.underline(G)}.`].join(`
93
- `)),L>0)process.exit(1)}async function gj($){let J=$.filter((P)=>!P.startsWith("--"))[0];if(!J)i(`Usage: ${N.default.cyan('petdex edit <slug> [--desc "..."] [--displayName "..."] [--sprite ./new.webp] [--meta ./pet.json] [--zip ./pet.zip]')}`),process.exit(1);let q=await A$(),Y;try{let P=await q.getAccessToken();if(!P)i(`Not signed in. Run ${N.default.cyan("petdex login")}.`),process.exit(1);Y=P}catch{i(`Not signed in. Run ${N.default.cyan("petdex login")}.`),process.exit(1)}function G(P){let B=$.indexOf(P);if(B===-1)return null;let M=$[B+1];return typeof M==="string"&&!M.startsWith("--")?M:null}let X=G("--desc"),V=G("--displayName"),U=G("--sprite"),K=G("--meta"),W=G("--zip");if(!X&&!V&&!U&&!K&&!W)i("Nothing to edit. Provide at least one flag."),process.exit(1);h$(N.default.bgMagenta(N.default.white(" petdex edit ")));let F=s0();F.start(`Resolving ${J}`);let j=await fetch(`${l}/api/pets/${J}`,{headers:{Authorization:`Bearer ${Y}`}});if(!j.ok)F.stop(N.default.red("not found")),i(`Pet "${J}" not found or you don't own it.`),process.exit(1);let Z=(await j.json()).id;if(!Z)F.stop(N.default.red("could not resolve pet id")),process.exit(1);F.stop(`Found ${N.default.cyan(J)}`);let L={};if(X)L.description=X;if(V)L.displayName=V;if(U||K||W){F.start("Uploading assets");let P=await fetch(`${l}/api/cli/edit-presign`,{method:"POST",headers:{Authorization:`Bearer ${Y}`,"Content-Type":"application/json"},body:JSON.stringify({petId:Z,hasSprite:Boolean(U),hasMeta:Boolean(K),hasZip:Boolean(W)})});if(P.ok){let B=await P.json(),M=(z)=>B.files?.find((v)=>v.role===z)??null;if(U){let z=await import("node:fs/promises").then((D)=>D.readFile(U)),v=U.endsWith(".png")?"image/png":"image/webp",w=M("sprite");if(w){await f1(w.uploadUrl,z,v);let{width:D,height:k}=Uq(z);if(L.spritesheetUrl=w.publicUrl,D)L.spritesheetWidth=D;if(k)L.spritesheetHeight=k}}if(K){let z=await import("node:fs/promises").then((D)=>D.readFile(K)),v=JSON.parse(z.toString("utf8")),w=M("petjson");if(w)await f1(w.uploadUrl,z,"application/json"),L.petJsonUrl=w.publicUrl,L.spriteVersionNumber=Vq(v)}if(W){let z=await import("node:fs/promises").then((w)=>w.readFile(W)),v=M("zip");if(v)await f1(v.uploadUrl,z,"application/zip"),L.zipUrl=v.publicUrl}F.stop("Assets uploaded")}else F.stop(N.default.yellow("presign endpoint unavailable, skipping asset upload"))}F.start("Submitting edit");let O=await fetch(`${l}/api/my-pets/${Z}/edit`,{method:"PATCH",headers:{Authorization:`Bearer ${Y}`,"Content-Type":"application/json",Origin:l},body:JSON.stringify(L)});if(!O.ok){let P=await O.text().catch(()=>"");F.stop(N.default.red(`edit failed: ${O.status}`)),i(P.slice(0,120)),process.exit(1)}let I=await O.json();F.stop(I.status==="auto_approved"?`${N.default.green("✓")} Edit auto-approved and live`:`${N.default.yellow("·")} Edit queued for admin review`),w4("cli_edit_invoked",{cli_version:f6}),u1(`Gallery: ${N.default.underline(`${l}/pets/${J}`)}`)}async function Tj($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let G=await yj($);return G?[G]:[]}if(await h6(J0.join($,"pet.json"))){let G=await Qq($);return G?[G]:[]}let q=await Ij($,{withFileTypes:!0}),Y=[];for(let G of q){if(!G.isDirectory())continue;let X=J0.join($,G.name),V=await Qq(X);if(V)Y.push(V)}return Y}async function Qq($){let Q=J0.join($,"pet.json");if(!await h6(Q))return null;let J=J0.join($,"spritesheet.webp"),q="webp";if(!await h6(J)){let W=J0.join($,"spritesheet.png");if(!await h6(W))return null;J=W,q="png"}let Y=await JQ(Q,"utf8"),G={};try{G=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let X=await JQ(J),V=new qQ.default;V.file("pet.json",Y),V.file(`spritesheet.${q}`,X);let U=Buffer.from(await V.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=J0.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:G,zipBuffer:U,zipFileName:`${K}.zip`,spritesheetBuffer:X,spritesheetExt:q,petIdHint:typeof G.id==="string"?G.id:K}}async function yj($){let Q=await JQ($),J=await qQ.default.loadAsync(Q),q=J.file("pet.json"),Y=J.file("spritesheet.webp"),G=J.file("spritesheet.png"),X=Y??G,V=Y?"webp":"png";if(!q||!X)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 X.async("uint8array")),F=J0.basename($,".zip");return{label:F,source:"zip",petJson:U,petJsonObj:K,zipBuffer:Q,zipFileName:J0.basename($),spritesheetBuffer:W,spritesheetExt:V,petIdHint:typeof K.id==="string"?K.id:F}}async function hj($,Q){let{width:J,height:q}=Uq($.spritesheetBuffer);if(J===0||q===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${l}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:C$($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let H=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${H.slice(0,100)}`)}let G=await Y.json(),X=(H)=>{let Z=G.files.find((L)=>L.role===H);if(!Z)throw Error(`presign response missing ${H}`);return Z},V=X("zip"),U=X("sprite"),K=X("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([f1(V.uploadUrl,$.zipBuffer,"application/zip"),f1(U.uploadUrl,$.spritesheetBuffer,W),f1(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let F=await fetch(`${l}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:V.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:Jq($.petJsonObj.displayName,"Untitled pet"),description:Jq($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:J,spritesheetHeight:q,spriteVersionNumber:Vq($.petJsonObj)})});if(!F.ok){let H=await F.text().catch(()=>"");throw Error(`register ${F.status} ${H.slice(0,100)}`)}return await F.json()}function bj($){let Q=N.default.dim($.slug),J=fj($.review);if($.review.decision==="approved")return`${Q} ${N.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${N.default.red("rejected")}${J?N.default.dim(`: ${J}`):""}`;return`${Q} ${N.default.yellow("held for review")}${J?N.default.dim(`: ${J}`):""}`}function fj($){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 f1($,Q,J){let q=await fetch($,{method:"PUT",headers:{"Content-Type":J},body:Q});if(!q.ok)throw Error(`R2 PUT ${q.status}`)}async function _j($,Q){let J=new Map;if($.length===0)return J;try{let q=await fetch(`${l}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((G)=>({petId:G.petIdHint,slugHint:C$(G.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!q.ok)return J;let Y=await q.json();for(let G of Y.existing??[])if(G&&typeof G.slug==="string")J.set(G.slug,G)}catch{}return J}function mj($){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(`
89
+ ${I.default.dim("Install with")} ${I.default.cyan("petdex install <slug>")}
90
+ ${I.default.dim("Browse:")} ${I.default.underline(o)}`)}async function YF($){let J=$.filter((P)=>!P.startsWith("--"))[0];if(!J)u(`Usage: ${I.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let q=await k8(),Y;try{let P=await q.getAccessToken();if(!P)u(`Not signed in. Run ${I.default.cyan("petdex login")}.`),process.exit(1);Y=P}catch{u(`Not signed in. Run ${I.default.cyan("petdex login")}.`),process.exit(1)}let G=o;try{G=PF(await q.whoami())}catch{}let V=J0.resolve(J),X=await Lq(V).catch(()=>null);if(!X)u(`No such file or directory: ${J}`),process.exit(1);f8(I.default.bgMagenta(I.default.white(" petdex submit ")));let W=s0();W.start(`Scanning ${V}`);let K=await VF(V,X.isDirectory());if(W.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:I.default.red("no pets found")),K.length===0)u("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let F=$.includes("--force")?new Map:await jF(K,Y),j=K,H=0;if(F.size>0){let P=K.filter((L)=>F.has(R8(L.petIdHint))),O=K.filter((L)=>!F.has(R8(L.petIdHint)));l1(P.map((L)=>{let C=F.get(R8(L.petIdHint))?.status??"unknown";return`${I.default.yellow("•")} ${I.default.bold(L.label)} ${I.default.dim(`(${C})`)}`}).join(`
91
+ `),`${P.length} already submitted by you`);let M=await p4({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(M)||M==="cancel")u("Aborted."),process.exit(1);if(M==="skip"){if(j=O,H=P.length,j.length===0){d1(`Nothing new to submit. Track approval at ${I.default.underline(G)}.`);return}}}if(j.length>1){let P=await c4({message:`Submit ${I.default.bold(String(j.length))} pet${j.length===1?"":"s"}?`});if(m1(P)||!P)u("Aborted."),process.exit(1)}let Z=0,z=0,w=[];for(let P of j){let O=s0();O.start(`Submitting ${I.default.cyan(P.label)}`);try{let M=await q.getAccessToken();if(!M)throw Error("session expired");Y=M;let L=await KF(P,Y);G=HF(L.profileUrl)??G,O.stop(`${I.default.green("✓")} ${I.default.cyan(P.label)} → ${UF(L)}`),Z++}catch(M){let L=M.message;O.stop(`${I.default.red("×")} ${I.default.cyan(P.label)} ${I.default.red(L.slice(0,60))}`),w.push({label:P.label,error:L}),z++}}if(w.length>0)l1(w.map((P)=>`${I.default.red("•")} ${I.default.bold(P.label)}: ${P.error}`).join(`
92
+ `),"Failures");let N=H>0?`, ${I.default.yellow(String(H))} skipped`:"";if(d1([`${I.default.green(String(Z))} submitted${N}, ${z>0?I.default.red(String(z)):I.default.dim(String(z))} failed.`,`Held submissions stay visible at ${I.default.underline(G)}.`].join(`
93
+ `)),z>0)process.exit(1)}async function GF($){let J=$.filter((P)=>!P.startsWith("--"))[0];if(!J)u(`Usage: ${I.default.cyan('petdex edit <slug> [--desc "..."] [--displayName "..."] [--sprite ./new.webp] [--meta ./pet.json] [--zip ./pet.zip]')}`),process.exit(1);let q=await k8(),Y;try{let P=await q.getAccessToken();if(!P)u(`Not signed in. Run ${I.default.cyan("petdex login")}.`),process.exit(1);Y=P}catch{u(`Not signed in. Run ${I.default.cyan("petdex login")}.`),process.exit(1)}function G(P){let O=$.indexOf(P);if(O===-1)return null;let M=$[O+1];return typeof M==="string"&&!M.startsWith("--")?M:null}let V=G("--desc"),X=G("--displayName"),W=G("--sprite"),K=G("--meta"),U=G("--zip");if(!V&&!X&&!W&&!K&&!U)u("Nothing to edit. Provide at least one flag."),process.exit(1);f8(I.default.bgMagenta(I.default.white(" petdex edit ")));let F=s0();F.start(`Resolving ${J}`);let j=await fetch(`${o}/api/pets/${J}`,{headers:{Authorization:`Bearer ${Y}`}});if(!j.ok)F.stop(I.default.red("not found")),u(`Pet "${J}" not found or you don't own it.`),process.exit(1);let Z=(await j.json()).id;if(!Z)F.stop(I.default.red("could not resolve pet id")),process.exit(1);F.stop(`Found ${I.default.cyan(J)}`);let z={};if(V)z.description=V;if(X)z.displayName=X;if(W||K||U){F.start("Uploading assets");let P=null,O=null,M=null;try{P=W?await A3(W):null,O=K?await R3(K):null,M=U?await k3(U):null}catch(B){let R=B instanceof Error?B.message:String(B);F.stop(I.default.red("asset validation failed")),u(R),process.exit(1)}let L=await fetch(`${o}/api/cli/edit-presign`,{method:"POST",headers:{Authorization:`Bearer ${Y}`,"Content-Type":"application/json"},body:JSON.stringify({petId:Z,hasSprite:Boolean(P),hasMeta:Boolean(O),hasZip:Boolean(M),spritesheetExt:P?.format})});if(!L.ok){let B=await L.text().catch(()=>"");F.stop(I.default.red(`asset presign failed: ${L.status}`)),u(B.slice(0,120)),process.exit(1)}let A=await L.json();if(!Array.isArray(A.files))F.stop(I.default.red("asset presign returned no files")),process.exit(1);let C=(B)=>{let R=A.files?.find((E)=>E.role===B);if(!R)F.stop(I.default.red(`asset presign missing ${B}`)),process.exit(1);return R};if(P){let B=C("sprite");await b1(B.uploadUrl,P.buffer,P.contentType);let{width:R,height:E}=P;z.spritesheetUrl=B.publicUrl,z.spritesheetWidth=R,z.spritesheetHeight=E}if(K&&O){let B=C("petjson");await b1(B.uploadUrl,O,"application/json"),z.petJsonUrl=B.publicUrl,z.spriteVersionNumber=wq(JSON.parse(O.toString("utf8")))}if(U&&M){let B=C("zip");await b1(B.uploadUrl,M,"application/zip"),z.zipUrl=B.publicUrl}F.stop("Assets uploaded")}F.start("Submitting edit");let w=await fetch(`${o}/api/cli/edit`,{method:"PATCH",headers:{Authorization:`Bearer ${Y}`,"Content-Type":"application/json",Origin:o},body:JSON.stringify({...z,petId:Z})});if(!w.ok){let P=await w.text().catch(()=>"");F.stop(I.default.red(`edit failed: ${w.status}`)),u(P.slice(0,120)),process.exit(1)}let N=await w.json();F.stop(N.status==="auto_approved"?`${I.default.green("✓")} Edit auto-approved and live`:`${I.default.yellow("·")} Edit queued for admin review`),f3("cli_edit_invoked",{cli_version:m6}),d1(`Gallery: ${I.default.underline(`${o}/pets/${J}`)}`)}async function VF($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let G=await XF($);return G?[G]:[]}if(await b6(J0.join($,"pet.json"))){let G=await Zq($);return G?[G]:[]}let q=await nj($,{withFileTypes:!0}),Y=[];for(let G of q){if(!G.isDirectory())continue;let V=J0.join($,G.name),X=await Zq(V);if(X)Y.push(X)}return Y}async function Zq($){let Q=J0.join($,"pet.json");if(!await b6(Q))return null;let J=J0.join($,"spritesheet.webp"),q="webp";if(!await b6(J)){let U=J0.join($,"spritesheet.png");if(!await b6(U))return null;J=U,q="png"}let Y=await K4(Q,"utf8"),G={};try{G=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let V=await K4(J),X=new U4.default;X.file("pet.json",Y),X.file(`spritesheet.${q}`,V);let W=Buffer.from(await X.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=J0.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:G,zipBuffer:W,zipFileName:`${K}.zip`,spritesheetBuffer:V,spritesheetExt:q,petIdHint:typeof G.id==="string"?G.id:K}}async function XF($){let Q=await K4($),J=await U4.default.loadAsync(Q),q=J.file("pet.json"),Y=J.file("spritesheet.webp"),G=J.file("spritesheet.png"),V=Y??G,X=Y?"webp":"png";if(!q||!V)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let W=await q.async("string"),K={};try{K=JSON.parse(W)}catch{throw Error("pet.json in zip is not valid JSON")}let U=Buffer.from(await V.async("uint8array")),F=J0.basename($,".zip");return{label:F,source:"zip",petJson:W,petJsonObj:K,zipBuffer:Q,zipFileName:J0.basename($),spritesheetBuffer:U,spritesheetExt:X,petIdHint:typeof K.id==="string"?K.id:F}}async function KF($,Q){let{width:J,height:q}=C3($.spritesheetBuffer);if(J===0||q===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${o}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:R8($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let H=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${H.slice(0,100)}`)}let G=await Y.json(),V=(H)=>{let Z=G.files.find((z)=>z.role===H);if(!Z)throw Error(`presign response missing ${H}`);return Z},X=V("zip"),W=V("sprite"),K=V("petjson"),U=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([b1(X.uploadUrl,$.zipBuffer,"application/zip"),b1(W.uploadUrl,$.spritesheetBuffer,U),b1(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let F=await fetch(`${o}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:X.publicUrl,spritesheetUrl:W.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:zq($.petJsonObj.displayName,"Untitled pet"),description:zq($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:J,spritesheetHeight:q,spriteVersionNumber:wq($.petJsonObj)})});if(!F.ok){let H=await F.text().catch(()=>"");throw Error(`register ${F.status} ${H.slice(0,100)}`)}return await F.json()}function UF($){let Q=I.default.dim($.slug),J=WF($.review);if($.review.decision==="approved")return`${Q} ${I.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${I.default.red("rejected")}${J?I.default.dim(`: ${J}`):""}`;return`${Q} ${I.default.yellow("held for review")}${J?I.default.dim(`: ${J}`):""}`}function WF($){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 b1($,Q,J){let q=await fetch($,{method:"PUT",headers:{"Content-Type":J},body:Q});if(!q.ok)throw Error(`R2 PUT ${q.status}`)}async function jF($,Q){let J=new Map;if($.length===0)return J;try{let q=await fetch(`${o}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((G)=>({petId:G.petIdHint,slugHint:R8(G.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!q.ok)return J;let Y=await q.json();for(let G of Y.existing??[])if(G&&typeof G.slug==="string")J.set(G.slug,G)}catch{}return J}function FF($){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(`
94
94
  `);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(`
95
95
  `);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(`
96
- `);return $}async function h6($){try{return await qq($),!0}catch{return!1}}function Jq($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function b6($){return typeof $==="string"&&$.trim()?$.trim():null}function Kq(...$){for(let Q of $){let J=b6(Q);if(J)return J}return null}function Wq($){let Q=l.replace(/\/+$/,""),J=$.startsWith("/")?$:`/${$}`;return`${Q}${J}`}function cj($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return Wq($)}function pj($){let Q=Kq($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?Wq(`/u/${encodeURIComponent(Q.toLowerCase())}`):l}function uj($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function C$($){let Q=uj($);if(Q)return Q;let J=$.trim();if(!J)return"";let q=2166136261;for(let Y of new TextEncoder().encode(J))q^=Y,q=Math.imul(q,16777619)>>>0;return`pet-${q.toString(36).padStart(7,"0")}`}function Uq($){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 J=$[22],q=$[23],Y=$[24];return{width:(($[21]|(J&63)<<8)>>>0)+1,height:((J>>6|q<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let J=23;J<Math.min(60,$.length-7);J++)if($[J]===157&&$[J+1]===1&&$[J+2]===42)return{width:($[J+3]|$[J+4]<<8)&16383,height:($[J+5]|$[J+6]<<8)&16383}}}return{width:0,height:0}}function dj($){let Q=$[0];if(Q==="on"||Q==="off"){let J=Q==="on";if(N4(J))console.log(J?"Telemetry enabled":"Telemetry disabled");else console.error(N.default.red(`${N.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 J=O4();if(console.log(`Status: ${J.enabled?"enabled":"disabled"}`),J.install_id)console.log(`Install ID: ${J.install_id}`)}else console.error(N.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}
96
+ `);return $}async function b6($){try{return await Lq($),!0}catch{return!1}}function zq($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function _6($){return typeof $==="string"&&$.trim()?$.trim():null}function Oq(...$){for(let Q of $){let J=_6(Q);if(J)return J}return null}function Bq($){let Q=o.replace(/\/+$/,""),J=$.startsWith("/")?$:`/${$}`;return`${Q}${J}`}function HF($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return Bq($)}function PF($){let Q=Oq($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?Bq(`/u/${encodeURIComponent(Q.toLowerCase())}`):o}function ZF($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function R8($){let Q=ZF($);if(Q)return Q;let J=$.trim();if(!J)return"";let q=2166136261;for(let Y of new TextEncoder().encode(J))q^=Y,q=Math.imul(q,16777619)>>>0;return`pet-${q.toString(36).padStart(7,"0")}`}function zF($){let Q=$[0];if(Q==="on"||Q==="off"){let J=Q==="on";if(T3(J))console.log(J?"Telemetry enabled":"Telemetry disabled");else console.error(I.default.red(`${I.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 J=y3();if(console.log(`Status: ${J.enabled?"enabled":"disabled"}`),J.install_id)console.log(`Install ID: ${J.install_id}`)}else console.error(I.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}