petdex 0.3.5 → 0.3.6

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,64 +1,64 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as _Y}from"node:module";var vY=Object.create;var{getPrototypeOf:xY,defineProperty:T8,getOwnPropertyNames:SY}=Object;var EY=Object.prototype.hasOwnProperty;function yY($){return this[$]}var gY,kY,I1=($,Q,q)=>{var V=$!=null&&typeof $==="object";if(V){var Y=Q?gY??=new WeakMap:kY??=new WeakMap,X=Y.get($);if(X)return X}q=$!=null?vY(xY($)):{};let J=Q||!$||!$.__esModule?T8(q,"default",{value:$,enumerable:!0}):q;for(let G of SY($))if(!EY.call(J,G))T8(J,G,{get:yY.bind($,G),enumerable:!0});if(V)Y.set($,J);return J};var w=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var DY=($)=>$;function hY($,Q){this[$]=DY.bind(null,Q)}var F8=($,Q)=>{for(var q in Q)T8($,q,{get:Q[q],enumerable:!0,configurable:!0,set:hY.bind(Q,q)})};var e1=($,Q)=>()=>($&&(Q=$($=0)),Q);var l=_Y(import.meta.url);var v8=w((qH,Xq)=>{var R8={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let q="";if($<0)q+=`\x1B[${-$}D`;else if($>0)q+=`\x1B[${$}C`;if(Q<0)q+=`\x1B[${-Q}A`;else if(Q>0)q+=`\x1B[${Q}B`;return q},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"},bY={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},fY={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 q=0;q<$;q++)Q+=this.line+(q<$-1?R8.up():"");if($)Q+=R8.left;return Q}};Xq.exports={cursor:R8,scroll:bY,erase:fY,beep:"\x07"}});var c1=w((VH,x8)=>{var j6=process||{},Gq=j6.argv||[],U6=j6.env||{},mY=!(!!U6.NO_COLOR||Gq.includes("--no-color"))&&(!!U6.FORCE_COLOR||Gq.includes("--color")||j6.platform==="win32"||(j6.stdout||{}).isTTY&&U6.TERM!=="dumb"||!!U6.CI),cY=($,Q,q=$)=>(V)=>{let Y=""+V,X=Y.indexOf(Q,$.length);return~X?$+pY(Y,Q,q,X)+Q:$+Y+Q},pY=($,Q,q,V)=>{let Y="",X=0;do Y+=$.substring(X,V)+q,X=V+Q.length,V=$.indexOf(Q,X);while(~V);return Y+$.substring(X)},Kq=($=mY)=>{let Q=$?cY:()=>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")}};x8.exports=Kq();x8.exports.createColors=Kq});import{stdin as Bq,stdout as Nq}from"node:process";import*as $0 from"node:readline";import Wq from"node:readline";import{Writable as uY}from"node:stream";function dY({onlyFirst:$=!1}={}){let Q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Q,$?void 0:"g")}function Mq($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(lY,"")}function Iq($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}function W$($,Q={}){if(typeof $!="string"||$.length===0||(Q={ambiguousIsNarrow:!0,...Q},$=Mq($),$.length===0))return 0;$=$.replace(rY()," ");let q=Q.ambiguousIsNarrow?1:2,V=0;for(let Y of $){let X=Y.codePointAt(0);if(X<=31||X>=127&&X<=159||X>=768&&X<=879)continue;switch(iY.eastAsianWidth(Y)){case"F":case"W":V+=2;break;case"A":V+=q;break;default:V+=1}}return V}function tY(){let $=new Map;for(let[Q,q]of Object.entries(b)){for(let[V,Y]of Object.entries(q))b[V]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},q[V]=b[V],$.set(Y[0],Y[1]);Object.defineProperty(b,Q,{value:q,enumerable:!1})}return Object.defineProperty(b,"codes",{value:$,enumerable:!1}),b.color.close="\x1B[39m",b.bgColor.close="\x1B[49m",b.color.ansi=Uq(),b.color.ansi256=jq(),b.color.ansi16m=Zq(),b.bgColor.ansi=Uq(S8),b.bgColor.ansi256=jq(S8),b.bgColor.ansi16m=Zq(S8),Object.defineProperties(b,{rgbToAnsi256:{value:(Q,q,V)=>Q===q&&q===V?Q<8?16:Q>248?231:Math.round((Q-8)/247*24)+232:16+36*Math.round(Q/255*5)+6*Math.round(q/255*5)+Math.round(V/255*5),enumerable:!1},hexToRgb:{value:(Q)=>{let q=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!q)return[0,0,0];let[V]=q;V.length===3&&(V=[...V].map((X)=>X+X).join(""));let Y=Number.parseInt(V,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>b.rgbToAnsi256(...b.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value:(Q)=>{if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let q,V,Y;if(Q>=232)q=((Q-232)*10+8)/255,V=q,Y=q;else{Q-=16;let G=Q%36;q=Math.floor(Q/36)/5,V=Math.floor(G/6)/5,Y=G%6/5}let X=Math.max(q,V,Y)*2;if(X===0)return 30;let J=30+(Math.round(Y)<<2|Math.round(V)<<1|Math.round(q));return X===2&&(J+=60),J},enumerable:!1},rgbToAnsi:{value:(Q,q,V)=>b.ansi256ToAnsi(b.rgbToAnsi256(Q,q,V)),enumerable:!1},hexToAnsi:{value:(Q)=>b.ansi256ToAnsi(b.hexToAnsi256(Q)),enumerable:!1}}),b}function Pq($,Q,q){return String($).normalize().replace(/\r\n/g,`
2
+ import{createRequire as hY}from"node:module";var RY=Object.create;var{getPrototypeOf:vY,defineProperty:T8,getOwnPropertyNames:xY}=Object;var SY=Object.prototype.hasOwnProperty;function EY($){return this[$]}var yY,gY,C1=($,Q,q)=>{var V=$!=null&&typeof $==="object";if(V){var Y=Q?yY??=new WeakMap:gY??=new WeakMap,X=Y.get($);if(X)return X}q=$!=null?RY(vY($)):{};let J=Q||!$||!$.__esModule?T8(q,"default",{value:$,enumerable:!0}):q;for(let G of xY($))if(!SY.call(J,G))T8(J,G,{get:EY.bind($,G),enumerable:!0});if(V)Y.set($,J);return J};var w=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var kY=($)=>$;function DY($,Q){this[$]=kY.bind(null,Q)}var F8=($,Q)=>{for(var q in Q)T8($,q,{get:Q[q],enumerable:!0,configurable:!0,set:DY.bind(Q,q)})};var e1=($,Q)=>()=>($&&(Q=$($=0)),Q);var l=hY(import.meta.url);var v8=w((QH,Yq)=>{var R8={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let q="";if($<0)q+=`\x1B[${-$}D`;else if($>0)q+=`\x1B[${$}C`;if(Q<0)q+=`\x1B[${-Q}A`;else if(Q>0)q+=`\x1B[${Q}B`;return q},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"},_Y={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},fY={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 q=0;q<$;q++)Q+=this.line+(q<$-1?R8.up():"");if($)Q+=R8.left;return Q}};Yq.exports={cursor:R8,scroll:_Y,erase:fY,beep:"\x07"}});var c1=w((qH,x8)=>{var j6=process||{},Xq=j6.argv||[],U6=j6.env||{},bY=!(!!U6.NO_COLOR||Xq.includes("--no-color"))&&(!!U6.FORCE_COLOR||Xq.includes("--color")||j6.platform==="win32"||(j6.stdout||{}).isTTY&&U6.TERM!=="dumb"||!!U6.CI),mY=($,Q,q=$)=>(V)=>{let Y=""+V,X=Y.indexOf(Q,$.length);return~X?$+cY(Y,Q,q,X)+Q:$+Y+Q},cY=($,Q,q,V)=>{let Y="",X=0;do Y+=$.substring(X,V)+q,X=V+Q.length,V=$.indexOf(Q,X);while(~V);return Y+$.substring(X)},Gq=($=bY)=>{let Q=$?mY:()=>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")}};x8.exports=Gq();x8.exports.createColors=Gq});import{stdin as Oq,stdout as Bq}from"node:process";import*as $0 from"node:readline";import Kq from"node:readline";import{Writable as pY}from"node:stream";function uY({onlyFirst:$=!1}={}){let Q=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(Q,$?void 0:"g")}function Nq($){if(typeof $!="string")throw TypeError(`Expected a \`string\`, got \`${typeof $}\``);return $.replace(dY,"")}function Mq($){return $&&$.__esModule&&Object.prototype.hasOwnProperty.call($,"default")?$.default:$}function W$($,Q={}){if(typeof $!="string"||$.length===0||(Q={ambiguousIsNarrow:!0,...Q},$=Nq($),$.length===0))return 0;$=$.replace(nY()," ");let q=Q.ambiguousIsNarrow?1:2,V=0;for(let Y of $){let X=Y.codePointAt(0);if(X<=31||X>=127&&X<=159||X>=768&&X<=879)continue;switch(oY.eastAsianWidth(Y)){case"F":case"W":V+=2;break;case"A":V+=q;break;default:V+=1}}return V}function sY(){let $=new Map;for(let[Q,q]of Object.entries(f)){for(let[V,Y]of Object.entries(q))f[V]={open:`\x1B[${Y[0]}m`,close:`\x1B[${Y[1]}m`},q[V]=f[V],$.set(Y[0],Y[1]);Object.defineProperty(f,Q,{value:q,enumerable:!1})}return Object.defineProperty(f,"codes",{value:$,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",f.color.ansi=Wq(),f.color.ansi256=Uq(),f.color.ansi16m=jq(),f.bgColor.ansi=Wq(S8),f.bgColor.ansi256=Uq(S8),f.bgColor.ansi16m=jq(S8),Object.defineProperties(f,{rgbToAnsi256:{value:(Q,q,V)=>Q===q&&q===V?Q<8?16:Q>248?231:Math.round((Q-8)/247*24)+232:16+36*Math.round(Q/255*5)+6*Math.round(q/255*5)+Math.round(V/255*5),enumerable:!1},hexToRgb:{value:(Q)=>{let q=/[a-f\d]{6}|[a-f\d]{3}/i.exec(Q.toString(16));if(!q)return[0,0,0];let[V]=q;V.length===3&&(V=[...V].map((X)=>X+X).join(""));let Y=Number.parseInt(V,16);return[Y>>16&255,Y>>8&255,Y&255]},enumerable:!1},hexToAnsi256:{value:(Q)=>f.rgbToAnsi256(...f.hexToRgb(Q)),enumerable:!1},ansi256ToAnsi:{value:(Q)=>{if(Q<8)return 30+Q;if(Q<16)return 90+(Q-8);let q,V,Y;if(Q>=232)q=((Q-232)*10+8)/255,V=q,Y=q;else{Q-=16;let G=Q%36;q=Math.floor(Q/36)/5,V=Math.floor(G/6)/5,Y=G%6/5}let X=Math.max(q,V,Y)*2;if(X===0)return 30;let J=30+(Math.round(Y)<<2|Math.round(V)<<1|Math.round(q));return X===2&&(J+=60),J},enumerable:!1},rgbToAnsi:{value:(Q,q,V)=>f.ansi256ToAnsi(f.rgbToAnsi256(Q,q,V)),enumerable:!1},hexToAnsi:{value:(Q)=>f.ansi256ToAnsi(f.hexToAnsi256(Q)),enumerable:!1}}),f}function Hq($,Q,q){return String($).normalize().replace(/\r\n/g,`
3
3
  `).split(`
4
- `).map((V)=>J4(V,Q,q)).join(`
5
- `)}function D8($,Q){if(typeof $=="string")return z6.aliases.get($)===Q;for(let q of $)if(q!==void 0&&D8(q,Q))return!0;return!1}function X4($,Q){if($===Q)return;let q=$.split(`
4
+ `).map((V)=>V4(V,Q,q)).join(`
5
+ `)}function D8($,Q){if(typeof $=="string")return z6.aliases.get($)===Q;for(let q of $)if(q!==void 0&&D8(q,Q))return!0;return!1}function Y4($,Q){if($===Q)return;let q=$.split(`
6
6
  `),V=Q.split(`
7
- `),Y=[];for(let X=0;X<Math.max(q.length,V.length);X++)q[X]!==V[X]&&Y.push(X);return Y}function Q0($){return $===y8}function Z6($,Q){let q=$;q.isTTY&&q.setRawMode(Q)}function Tq({input:$=Bq,output:Q=Nq,overwrite:q=!0,hideCursor:V=!0}={}){let Y=$0.createInterface({input:$,output:Q,prompt:"",tabSize:1});$0.emitKeypressEvents($,Y),$.isTTY&&$.setRawMode(!0);let X=(J,{name:G,sequence:U})=>{let K=String(J);if(D8([K,G,U],"cancel")){V&&Q.write(e.cursor.show),process.exit(0);return}if(!q)return;$0.moveCursor(Q,G==="return"?0:-1,G==="return"?-1:0,()=>{$0.clearLine(Q,1,()=>{$.once("keypress",X)})})};return V&&Q.write(e.cursor.hide),$.once("keypress",X),()=>{$.off("keypress",X),V&&Q.write(e.cursor.show),$.isTTY&&!G4&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}class P6{constructor($,Q=!0){U1(this,"input"),U1(this,"output"),U1(this,"_abortSignal"),U1(this,"rl"),U1(this,"opts"),U1(this,"_render"),U1(this,"_track",!1),U1(this,"_prevFrame",""),U1(this,"_subscribers",new Map),U1(this,"_cursor",0),U1(this,"state","initial"),U1(this,"error",""),U1(this,"value");let{input:q=Bq,output:V=Nq,render:Y,signal:X,...J}=$;this.opts=J,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Q,this._abortSignal=X,this.input=q,this.output=V}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let q=this._subscribers.get($)??[];q.push(Q),this._subscribers.set($,q)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let q=this._subscribers.get($)??[],V=[];for(let Y of q)Y.cb(...Q),Y.once&&V.push(()=>q.splice(q.indexOf(Y),1));for(let Y of V)Y()}prompt(){return new Promise(($,Q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(y8);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let q=new uY;q._write=(V,Y,X)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),X()},this.input.pipe(q),this.rl=Wq.createInterface({input:this.input,output:q,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Wq.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Z6(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),Z6(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),Z6(this.input,!1),$(y8)})})}onKeypress($,Q){if(this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&z6.aliases.has(Q.name)&&this.emit("cursor",z6.aliases.get(Q.name)),z6.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),Q?.name==="return"){if(this.opts.validate){let q=this.opts.validate(this.value);q&&(this.error=q instanceof Error?q.message:q,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}D8([$,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(`
8
- `),Z6(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=Pq(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
9
- `).length-1;this.output.write(e.cursor.move(-999,$*-1))}render(){let $=Pq(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(e.cursor.hide);else{let Q=X4(this._prevFrame,$);if(this.restoreCursor(),Q&&Q?.length===1){let q=Q[0];this.output.write(e.cursor.move(0,q)),this.output.write(e.erase.lines(1));let V=$.split(`
7
+ `),Y=[];for(let X=0;X<Math.max(q.length,V.length);X++)q[X]!==V[X]&&Y.push(X);return Y}function Q0($){return $===y8}function Z6($,Q){let q=$;q.isTTY&&q.setRawMode(Q)}function Aq({input:$=Oq,output:Q=Bq,overwrite:q=!0,hideCursor:V=!0}={}){let Y=$0.createInterface({input:$,output:Q,prompt:"",tabSize:1});$0.emitKeypressEvents($,Y),$.isTTY&&$.setRawMode(!0);let X=(J,{name:G,sequence:U})=>{let K=String(J);if(D8([K,G,U],"cancel")){V&&Q.write(e.cursor.show),process.exit(0);return}if(!q)return;$0.moveCursor(Q,G==="return"?0:-1,G==="return"?-1:0,()=>{$0.clearLine(Q,1,()=>{$.once("keypress",X)})})};return V&&Q.write(e.cursor.hide),$.once("keypress",X),()=>{$.off("keypress",X),V&&Q.write(e.cursor.show),$.isTTY&&!X4&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}class P6{constructor($,Q=!0){U1(this,"input"),U1(this,"output"),U1(this,"_abortSignal"),U1(this,"rl"),U1(this,"opts"),U1(this,"_render"),U1(this,"_track",!1),U1(this,"_prevFrame",""),U1(this,"_subscribers",new Map),U1(this,"_cursor",0),U1(this,"state","initial"),U1(this,"error",""),U1(this,"value");let{input:q=Oq,output:V=Bq,render:Y,signal:X,...J}=$;this.opts=J,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Q,this._abortSignal=X,this.input=q,this.output=V}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let q=this._subscribers.get($)??[];q.push(Q),this._subscribers.set($,q)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let q=this._subscribers.get($)??[],V=[];for(let Y of q)Y.cb(...Q),Y.once&&V.push(()=>q.splice(q.indexOf(Y),1));for(let Y of V)Y()}prompt(){return new Promise(($,Q)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(y8);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let q=new pY;q._write=(V,Y,X)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),X()},this.input.pipe(q),this.rl=Kq.createInterface({input:this.input,output:q,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),Kq.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),Z6(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),Z6(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(e.cursor.show),this.output.off("resize",this.render),Z6(this.input,!1),$(y8)})})}onKeypress($,Q){if(this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&z6.aliases.has(Q.name)&&this.emit("cursor",z6.aliases.get(Q.name)),z6.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),$==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),$&&this.emit("key",$.toLowerCase()),Q?.name==="return"){if(this.opts.validate){let q=this.opts.validate(this.value);q&&(this.error=q instanceof Error?q.message:q,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}D8([$,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(`
8
+ `),Z6(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=Hq(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
9
+ `).length-1;this.output.write(e.cursor.move(-999,$*-1))}render(){let $=Hq(this._render(this)??"",process.stdout.columns,{hard:!0});if($!==this._prevFrame){if(this.state==="initial")this.output.write(e.cursor.hide);else{let Q=Y4(this._prevFrame,$);if(this.restoreCursor(),Q&&Q?.length===1){let q=Q[0];this.output.write(e.cursor.move(0,q)),this.output.write(e.erase.lines(1));let V=$.split(`
10
10
  `);this.output.write(V[q]),this._prevFrame=$,this.output.write(e.cursor.move(0,V.length-q-1));return}if(Q&&Q?.length>1){let q=Q[0];this.output.write(e.cursor.move(0,q)),this.output.write(e.erase.down());let V=$.split(`
11
11
  `).slice(q);this.output.write(V.join(`
12
- `)),this._prevFrame=$;return}this.output.write(e.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}var e,lY,Cq,oY,iY,nY=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},rY,S8=10,Uq=($=0)=>(Q)=>`\x1B[${Q+$}m`,jq=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,Zq=($=0)=>(Q,q,V)=>`\x1B[${38+$};2;${Q};${q};${V}m`,b,aY,sY,eY,H6,$4=39,g8="\x07",wq="[",Q4="]",Aq="m",k8,zq=($)=>`${H6.values().next().value}${wq}${$}${Aq}`,Hq=($)=>`${H6.values().next().value}${k8}${$}${g8}`,q4=($)=>$.split(" ").map((Q)=>W$(Q)),E8=($,Q,q)=>{let V=[...Q],Y=!1,X=!1,J=W$(Mq($[$.length-1]));for(let[G,U]of V.entries()){let K=W$(U);if(J+K<=q?$[$.length-1]+=U:($.push(U),J=0),H6.has(U)&&(Y=!0,X=V.slice(G+1).join("").startsWith(k8)),Y){X?U===g8&&(Y=!1,X=!1):U===Aq&&(Y=!1);continue}J+=K,J===q&&G<V.length-1&&($.push(""),J=0)}!J&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},V4=($)=>{let Q=$.split(" "),q=Q.length;for(;q>0&&!(W$(Q[q-1])>0);)q--;return q===Q.length?$:Q.slice(0,q).join(" ")+Q.slice(q).join("")},J4=($,Q,q={})=>{if(q.trim!==!1&&$.trim()==="")return"";let V="",Y,X,J=q4($),G=[""];for(let[K,W]of $.split(" ").entries()){q.trim!==!1&&(G[G.length-1]=G[G.length-1].trimStart());let Z=W$(G[G.length-1]);if(K!==0&&(Z>=Q&&(q.wordWrap===!1||q.trim===!1)&&(G.push(""),Z=0),(Z>0||q.trim===!1)&&(G[G.length-1]+=" ",Z++)),q.hard&&J[K]>Q){let z=Q-Z,H=1+Math.floor((J[K]-z-1)/Q);Math.floor((J[K]-1)/Q)<H&&G.push(""),E8(G,W,Q);continue}if(Z+J[K]>Q&&Z>0&&J[K]>0){if(q.wordWrap===!1&&Z<Q){E8(G,W,Q);continue}G.push("")}if(Z+J[K]>Q&&q.wordWrap===!1){E8(G,W,Q);continue}G[G.length-1]+=W}q.trim!==!1&&(G=G.map((K)=>V4(K)));let U=[...G.join(`
13
- `)];for(let[K,W]of U.entries()){if(V+=W,H6.has(W)){let{groups:z}=new RegExp(`(?:\\${wq}(?<code>\\d+)m|\\${k8}(?<uri>.*)${g8})`).exec(U.slice(K).join(""))||{groups:{}};if(z.code!==void 0){let H=Number.parseFloat(z.code);Y=H===$4?void 0:H}else z.uri!==void 0&&(X=z.uri.length===0?void 0:z.uri)}let Z=eY.codes.get(Number(Y));U[K+1]===`
14
- `?(X&&(V+=Hq("")),Y&&Z&&(V+=zq(Z))):W===`
15
- `&&(Y&&Z&&(V+=zq(Y)),X&&(V+=Hq(X)))}return V},Y4,z6,G4,y8,K4,W4=($,Q,q)=>(Q in $)?K4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:q}):$[Q]=q,U1=($,Q,q)=>(W4($,typeof Q!="symbol"?Q+"":Q,q),q),h8,U4,j4,Z4=($,Q,q)=>(Q in $)?j4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:q}):$[Q]=q,Lq=($,Q,q)=>(Z4($,typeof Q!="symbol"?Q+"":Q,q),q),Fq,z4,H4=($,Q,q)=>(Q in $)?z4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:q}):$[Q]=q,Oq=($,Q,q)=>(H4($,typeof Q!="symbol"?Q+"":Q,q),q),_8;var b8=e1(()=>{e=I1(v8(),1);lY=dY();Cq={exports:{}};(function($){var Q={};$.exports=Q,Q.eastAsianWidth=function(V){var Y=V.charCodeAt(0),X=V.length==2?V.charCodeAt(1):0,J=Y;return 55296<=Y&&Y<=56319&&56320<=X&&X<=57343&&(Y&=1023,X&=1023,J=Y<<10|X,J+=65536),J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510?"F":J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518?"H":4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141?"W":32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630?"Na":J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109?"A":"N"},Q.characterLength=function(V){var Y=this.eastAsianWidth(V);return Y=="F"||Y=="W"||Y=="A"?2:1};function q(V){return V.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}Q.length=function(V){for(var Y=q(V),X=0,J=0;J<Y.length;J++)X=X+this.characterLength(Y[J]);return X},Q.slice=function(V,Y,X){textLen=Q.length(V),Y=Y||0,X=X||1,Y<0&&(Y=textLen+Y),X<0&&(X=textLen+X);for(var J="",G=0,U=q(V),K=0;K<U.length;K++){var W=U[K],Z=Q.length(W);if(G>=Y-(Z==2?1:0))if(G+Z<=X)J+=W;else break;G+=Z}return J}})(Cq);oY=Cq.exports,iY=Iq(oY),rY=Iq(nY);b={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(b.modifier);aY=Object.keys(b.color),sY=Object.keys(b.bgColor);[...aY,...sY];eY=tY(),H6=new Set(["\x1B","›"]),k8=`${Q4}8;;`;Y4=["up","down","left","right","space","enter","cancel"],z6={actions:new Set(Y4),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};G4=globalThis.process.platform.startsWith("win"),y8=Symbol("clack:cancel");K4=Object.defineProperty;h8=class h8 extends P6{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(e.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};U4=new WeakMap;j4=Object.defineProperty,Fq=class extends P6{constructor($){super($,!1),Lq(this,"options"),Lq(this,"cursor",0),this.options=$.options,this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===$.cursorAt),0),this.on("key",(Q)=>{Q==="a"&&this.toggleAll()}),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let $=this.value.length===this.options.length;this.value=$?[]:this.options.map((Q)=>Q.value)}toggleValue(){let $=this.value.includes(this._value);this.value=$?this.value.filter((Q)=>Q!==this._value):[...this.value,this._value]}},z4=Object.defineProperty;_8=class _8 extends P6{constructor($){super($,!1),Oq(this,"options"),Oq(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:Q})=>Q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}});import{stripVTControlCharacters as f8}from"node:util";import C1 from"node:process";function P4(){return C1.platform!=="win32"?C1.env.TERM!=="linux":!!C1.env.CI||!!C1.env.WT_SESSION||!!C1.env.TERMINUS_SUBLIME||C1.env.ConEmuTask==="{cmd::Cmder}"||C1.env.TERM_PROGRAM==="Terminus-Sublime"||C1.env.TERM_PROGRAM==="vscode"||C1.env.TERM==="xterm-256color"||C1.env.TERM==="alacritty"||C1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var N,L6,m8,p=($,Q)=>m8?$:Q,L4,xq,Sq,O6,O4,g,S0,c8,p8,B4,Rq,N4,OH,vq,M4,I4,C4,w4,A4,T4,F4,d8=($)=>{switch($){case"initial":case"active":return N.default.cyan(L4);case"cancel":return N.default.red(xq);case"error":return N.default.yellow(Sq);case"submit":return N.default.green(O6)}},u8=($)=>{let{cursor:Q,options:q,style:V}=$,Y=$.maxItems??Number.POSITIVE_INFINITY,X=Math.max(process.stdout.rows-4,0),J=Math.min(X,Math.max(Y,5)),G=0;Q>=G+J-3?G=Math.max(Math.min(Q-J+3,q.length-J),0):Q<G+2&&(G=Math.max(Q-2,0));let U=J<q.length&&G>0,K=J<q.length&&G+J<q.length;return q.slice(G,G+J).map((W,Z,z)=>{let H=Z===0&&U,C=Z===z.length-1&&K;return H||C?N.default.dim("..."):V(W,Z+G===Q)})},B6=($)=>{let Q=$.active??"Yes",q=$.inactive??"No";return new h8({active:Q,inactive:q,initialValue:$.initialValue??!0,render(){let V=`${N.default.gray(g)}
12
+ `)),this._prevFrame=$;return}this.output.write(e.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}var e,dY,Iq,lY,oY,iY=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},nY,S8=10,Wq=($=0)=>(Q)=>`\x1B[${Q+$}m`,Uq=($=0)=>(Q)=>`\x1B[${38+$};5;${Q}m`,jq=($=0)=>(Q,q,V)=>`\x1B[${38+$};2;${Q};${q};${V}m`,f,rY,aY,tY,H6,eY=39,g8="\x07",Cq="[",$4="]",wq="m",k8,Zq=($)=>`${H6.values().next().value}${Cq}${$}${wq}`,zq=($)=>`${H6.values().next().value}${k8}${$}${g8}`,Q4=($)=>$.split(" ").map((Q)=>W$(Q)),E8=($,Q,q)=>{let V=[...Q],Y=!1,X=!1,J=W$(Nq($[$.length-1]));for(let[G,U]of V.entries()){let K=W$(U);if(J+K<=q?$[$.length-1]+=U:($.push(U),J=0),H6.has(U)&&(Y=!0,X=V.slice(G+1).join("").startsWith(k8)),Y){X?U===g8&&(Y=!1,X=!1):U===wq&&(Y=!1);continue}J+=K,J===q&&G<V.length-1&&($.push(""),J=0)}!J&&$[$.length-1].length>0&&$.length>1&&($[$.length-2]+=$.pop())},q4=($)=>{let Q=$.split(" "),q=Q.length;for(;q>0&&!(W$(Q[q-1])>0);)q--;return q===Q.length?$:Q.slice(0,q).join(" ")+Q.slice(q).join("")},V4=($,Q,q={})=>{if(q.trim!==!1&&$.trim()==="")return"";let V="",Y,X,J=Q4($),G=[""];for(let[K,W]of $.split(" ").entries()){q.trim!==!1&&(G[G.length-1]=G[G.length-1].trimStart());let Z=W$(G[G.length-1]);if(K!==0&&(Z>=Q&&(q.wordWrap===!1||q.trim===!1)&&(G.push(""),Z=0),(Z>0||q.trim===!1)&&(G[G.length-1]+=" ",Z++)),q.hard&&J[K]>Q){let z=Q-Z,H=1+Math.floor((J[K]-z-1)/Q);Math.floor((J[K]-1)/Q)<H&&G.push(""),E8(G,W,Q);continue}if(Z+J[K]>Q&&Z>0&&J[K]>0){if(q.wordWrap===!1&&Z<Q){E8(G,W,Q);continue}G.push("")}if(Z+J[K]>Q&&q.wordWrap===!1){E8(G,W,Q);continue}G[G.length-1]+=W}q.trim!==!1&&(G=G.map((K)=>q4(K)));let U=[...G.join(`
13
+ `)];for(let[K,W]of U.entries()){if(V+=W,H6.has(W)){let{groups:z}=new RegExp(`(?:\\${Cq}(?<code>\\d+)m|\\${k8}(?<uri>.*)${g8})`).exec(U.slice(K).join(""))||{groups:{}};if(z.code!==void 0){let H=Number.parseFloat(z.code);Y=H===eY?void 0:H}else z.uri!==void 0&&(X=z.uri.length===0?void 0:z.uri)}let Z=tY.codes.get(Number(Y));U[K+1]===`
14
+ `?(X&&(V+=zq("")),Y&&Z&&(V+=Zq(Z))):W===`
15
+ `&&(Y&&Z&&(V+=Zq(Y)),X&&(V+=zq(X)))}return V},J4,z6,X4,y8,G4,K4=($,Q,q)=>(Q in $)?G4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:q}):$[Q]=q,U1=($,Q,q)=>(K4($,typeof Q!="symbol"?Q+"":Q,q),q),h8,W4,U4,j4=($,Q,q)=>(Q in $)?U4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:q}):$[Q]=q,Pq=($,Q,q)=>(j4($,typeof Q!="symbol"?Q+"":Q,q),q),Tq,Z4,z4=($,Q,q)=>(Q in $)?Z4($,Q,{enumerable:!0,configurable:!0,writable:!0,value:q}):$[Q]=q,Lq=($,Q,q)=>(z4($,typeof Q!="symbol"?Q+"":Q,q),q),_8;var f8=e1(()=>{e=C1(v8(),1);dY=uY();Iq={exports:{}};(function($){var Q={};$.exports=Q,Q.eastAsianWidth=function(V){var Y=V.charCodeAt(0),X=V.length==2?V.charCodeAt(1):0,J=Y;return 55296<=Y&&Y<=56319&&56320<=X&&X<=57343&&(Y&=1023,X&=1023,J=Y<<10|X,J+=65536),J==12288||65281<=J&&J<=65376||65504<=J&&J<=65510?"F":J==8361||65377<=J&&J<=65470||65474<=J&&J<=65479||65482<=J&&J<=65487||65490<=J&&J<=65495||65498<=J&&J<=65500||65512<=J&&J<=65518?"H":4352<=J&&J<=4447||4515<=J&&J<=4519||4602<=J&&J<=4607||9001<=J&&J<=9002||11904<=J&&J<=11929||11931<=J&&J<=12019||12032<=J&&J<=12245||12272<=J&&J<=12283||12289<=J&&J<=12350||12353<=J&&J<=12438||12441<=J&&J<=12543||12549<=J&&J<=12589||12593<=J&&J<=12686||12688<=J&&J<=12730||12736<=J&&J<=12771||12784<=J&&J<=12830||12832<=J&&J<=12871||12880<=J&&J<=13054||13056<=J&&J<=19903||19968<=J&&J<=42124||42128<=J&&J<=42182||43360<=J&&J<=43388||44032<=J&&J<=55203||55216<=J&&J<=55238||55243<=J&&J<=55291||63744<=J&&J<=64255||65040<=J&&J<=65049||65072<=J&&J<=65106||65108<=J&&J<=65126||65128<=J&&J<=65131||110592<=J&&J<=110593||127488<=J&&J<=127490||127504<=J&&J<=127546||127552<=J&&J<=127560||127568<=J&&J<=127569||131072<=J&&J<=194367||177984<=J&&J<=196605||196608<=J&&J<=262141?"W":32<=J&&J<=126||162<=J&&J<=163||165<=J&&J<=166||J==172||J==175||10214<=J&&J<=10221||10629<=J&&J<=10630?"Na":J==161||J==164||167<=J&&J<=168||J==170||173<=J&&J<=174||176<=J&&J<=180||182<=J&&J<=186||188<=J&&J<=191||J==198||J==208||215<=J&&J<=216||222<=J&&J<=225||J==230||232<=J&&J<=234||236<=J&&J<=237||J==240||242<=J&&J<=243||247<=J&&J<=250||J==252||J==254||J==257||J==273||J==275||J==283||294<=J&&J<=295||J==299||305<=J&&J<=307||J==312||319<=J&&J<=322||J==324||328<=J&&J<=331||J==333||338<=J&&J<=339||358<=J&&J<=359||J==363||J==462||J==464||J==466||J==468||J==470||J==472||J==474||J==476||J==593||J==609||J==708||J==711||713<=J&&J<=715||J==717||J==720||728<=J&&J<=731||J==733||J==735||768<=J&&J<=879||913<=J&&J<=929||931<=J&&J<=937||945<=J&&J<=961||963<=J&&J<=969||J==1025||1040<=J&&J<=1103||J==1105||J==8208||8211<=J&&J<=8214||8216<=J&&J<=8217||8220<=J&&J<=8221||8224<=J&&J<=8226||8228<=J&&J<=8231||J==8240||8242<=J&&J<=8243||J==8245||J==8251||J==8254||J==8308||J==8319||8321<=J&&J<=8324||J==8364||J==8451||J==8453||J==8457||J==8467||J==8470||8481<=J&&J<=8482||J==8486||J==8491||8531<=J&&J<=8532||8539<=J&&J<=8542||8544<=J&&J<=8555||8560<=J&&J<=8569||J==8585||8592<=J&&J<=8601||8632<=J&&J<=8633||J==8658||J==8660||J==8679||J==8704||8706<=J&&J<=8707||8711<=J&&J<=8712||J==8715||J==8719||J==8721||J==8725||J==8730||8733<=J&&J<=8736||J==8739||J==8741||8743<=J&&J<=8748||J==8750||8756<=J&&J<=8759||8764<=J&&J<=8765||J==8776||J==8780||J==8786||8800<=J&&J<=8801||8804<=J&&J<=8807||8810<=J&&J<=8811||8814<=J&&J<=8815||8834<=J&&J<=8835||8838<=J&&J<=8839||J==8853||J==8857||J==8869||J==8895||J==8978||9312<=J&&J<=9449||9451<=J&&J<=9547||9552<=J&&J<=9587||9600<=J&&J<=9615||9618<=J&&J<=9621||9632<=J&&J<=9633||9635<=J&&J<=9641||9650<=J&&J<=9651||9654<=J&&J<=9655||9660<=J&&J<=9661||9664<=J&&J<=9665||9670<=J&&J<=9672||J==9675||9678<=J&&J<=9681||9698<=J&&J<=9701||J==9711||9733<=J&&J<=9734||J==9737||9742<=J&&J<=9743||9748<=J&&J<=9749||J==9756||J==9758||J==9792||J==9794||9824<=J&&J<=9825||9827<=J&&J<=9829||9831<=J&&J<=9834||9836<=J&&J<=9837||J==9839||9886<=J&&J<=9887||9918<=J&&J<=9919||9924<=J&&J<=9933||9935<=J&&J<=9953||J==9955||9960<=J&&J<=9983||J==10045||J==10071||10102<=J&&J<=10111||11093<=J&&J<=11097||12872<=J&&J<=12879||57344<=J&&J<=63743||65024<=J&&J<=65039||J==65533||127232<=J&&J<=127242||127248<=J&&J<=127277||127280<=J&&J<=127337||127344<=J&&J<=127386||917760<=J&&J<=917999||983040<=J&&J<=1048573||1048576<=J&&J<=1114109?"A":"N"},Q.characterLength=function(V){var Y=this.eastAsianWidth(V);return Y=="F"||Y=="W"||Y=="A"?2:1};function q(V){return V.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}Q.length=function(V){for(var Y=q(V),X=0,J=0;J<Y.length;J++)X=X+this.characterLength(Y[J]);return X},Q.slice=function(V,Y,X){textLen=Q.length(V),Y=Y||0,X=X||1,Y<0&&(Y=textLen+Y),X<0&&(X=textLen+X);for(var J="",G=0,U=q(V),K=0;K<U.length;K++){var W=U[K],Z=Q.length(W);if(G>=Y-(Z==2?1:0))if(G+Z<=X)J+=W;else break;G+=Z}return J}})(Iq);lY=Iq.exports,oY=Mq(lY),nY=Mq(iY);f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(f.modifier);rY=Object.keys(f.color),aY=Object.keys(f.bgColor);[...rY,...aY];tY=sY(),H6=new Set(["\x1B","›"]),k8=`${$4}8;;`;J4=["up","down","left","right","space","enter","cancel"],z6={actions:new Set(J4),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};X4=globalThis.process.platform.startsWith("win"),y8=Symbol("clack:cancel");G4=Object.defineProperty;h8=class h8 extends P6{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(e.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};W4=new WeakMap;U4=Object.defineProperty,Tq=class extends P6{constructor($){super($,!1),Pq(this,"options"),Pq(this,"cursor",0),this.options=$.options,this.value=[...$.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:Q})=>Q===$.cursorAt),0),this.on("key",(Q)=>{Q==="a"&&this.toggleAll()}),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let $=this.value.length===this.options.length;this.value=$?[]:this.options.map((Q)=>Q.value)}toggleValue(){let $=this.value.includes(this._value);this.value=$?this.value.filter((Q)=>Q!==this._value):[...this.value,this._value]}},Z4=Object.defineProperty;_8=class _8 extends P6{constructor($){super($,!1),Lq(this,"options"),Lq(this,"cursor",0),this.options=$.options,this.cursor=this.options.findIndex(({value:Q})=>Q===$.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(Q)=>{switch(Q){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}});import{stripVTControlCharacters as b8}from"node:util";import w1 from"node:process";function H4(){return w1.platform!=="win32"?w1.env.TERM!=="linux":!!w1.env.CI||!!w1.env.WT_SESSION||!!w1.env.TERMINUS_SUBLIME||w1.env.ConEmuTask==="{cmd::Cmder}"||w1.env.TERM_PROGRAM==="Terminus-Sublime"||w1.env.TERM_PROGRAM==="vscode"||w1.env.TERM==="xterm-256color"||w1.env.TERM==="alacritty"||w1.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var N,L6,m8,p=($,Q)=>m8?$:Q,P4,vq,xq,O6,L4,g,x0,c8,p8,O4,Fq,B4,LH,Rq,N4,M4,I4,C4,w4,A4,T4,d8=($)=>{switch($){case"initial":case"active":return N.default.cyan(P4);case"cancel":return N.default.red(vq);case"error":return N.default.yellow(xq);case"submit":return N.default.green(O6)}},u8=($)=>{let{cursor:Q,options:q,style:V}=$,Y=$.maxItems??Number.POSITIVE_INFINITY,X=Math.max(process.stdout.rows-4,0),J=Math.min(X,Math.max(Y,5)),G=0;Q>=G+J-3?G=Math.max(Math.min(Q-J+3,q.length-J),0):Q<G+2&&(G=Math.max(Q-2,0));let U=J<q.length&&G>0,K=J<q.length&&G+J<q.length;return q.slice(G,G+J).map((W,Z,z)=>{let H=Z===0&&U,C=Z===z.length-1&&K;return H||C?N.default.dim("..."):V(W,Z+G===Q)})},B6=($)=>{let Q=$.active??"Yes",q=$.inactive??"No";return new h8({active:Q,inactive:q,initialValue:$.initialValue??!0,render(){let V=`${N.default.gray(g)}
16
16
  ${d8(this.state)} ${$.message}
17
17
  `,Y=this.value?Q:q;switch(this.state){case"submit":return`${V}${N.default.gray(g)} ${N.default.dim(Y)}`;case"cancel":return`${V}${N.default.gray(g)} ${N.default.strikethrough(N.default.dim(Y))}
18
18
  ${N.default.gray(g)}`;default:return`${V}${N.default.cyan(g)} ${this.value?`${N.default.green(c8)} ${Q}`:`${N.default.dim(p8)} ${N.default.dim(Q)}`} ${N.default.dim("/")} ${this.value?`${N.default.dim(p8)} ${N.default.dim(q)}`:`${N.default.green(c8)} ${q}`}
19
- ${N.default.cyan(S0)}
20
- `}}}).prompt()},Eq=($)=>{let Q=(q,V)=>{let Y=q.label??String(q.value);switch(V){case"selected":return`${N.default.dim(Y)}`;case"active":return`${N.default.green(c8)} ${Y} ${q.hint?N.default.dim(`(${q.hint})`):""}`;case"cancelled":return`${N.default.strikethrough(N.default.dim(Y))}`;default:return`${N.default.dim(p8)} ${N.default.dim(Y)}`}};return new _8({options:$.options,initialValue:$.initialValue,render(){let q=`${N.default.gray(g)}
19
+ ${N.default.cyan(x0)}
20
+ `}}}).prompt()},Sq=($)=>{let Q=(q,V)=>{let Y=q.label??String(q.value);switch(V){case"selected":return`${N.default.dim(Y)}`;case"active":return`${N.default.green(c8)} ${Y} ${q.hint?N.default.dim(`(${q.hint})`):""}`;case"cancelled":return`${N.default.strikethrough(N.default.dim(Y))}`;default:return`${N.default.dim(p8)} ${N.default.dim(Y)}`}};return new _8({options:$.options,initialValue:$.initialValue,render(){let q=`${N.default.gray(g)}
21
21
  ${d8(this.state)} ${$.message}
22
22
  `;switch(this.state){case"submit":return`${q}${N.default.gray(g)} ${Q(this.options[this.cursor],"selected")}`;case"cancel":return`${q}${N.default.gray(g)} ${Q(this.options[this.cursor],"cancelled")}
23
23
  ${N.default.gray(g)}`;default:return`${q}${N.default.cyan(g)} ${u8({cursor:this.cursor,options:this.options,maxItems:$.maxItems,style:(V,Y)=>Q(V,Y?"active":"inactive")}).join(`
24
24
  ${N.default.cyan(g)} `)}
25
- ${N.default.cyan(S0)}
26
- `}}}).prompt()},yq=($)=>{let Q=(q,V)=>{let Y=q.label??String(q.value);return V==="active"?`${N.default.cyan(B4)} ${Y} ${q.hint?N.default.dim(`(${q.hint})`):""}`:V==="selected"?`${N.default.green(Rq)} ${N.default.dim(Y)} ${q.hint?N.default.dim(`(${q.hint})`):""}`:V==="cancelled"?`${N.default.strikethrough(N.default.dim(Y))}`:V==="active-selected"?`${N.default.green(Rq)} ${Y} ${q.hint?N.default.dim(`(${q.hint})`):""}`:V==="submitted"?`${N.default.dim(Y)}`:`${N.default.dim(N4)} ${N.default.dim(Y)}`};return new Fq({options:$.options,initialValues:$.initialValues,required:$.required??!0,cursorAt:$.cursorAt,validate(q){if(this.required&&q.length===0)return`Please select at least one option.
25
+ ${N.default.cyan(x0)}
26
+ `}}}).prompt()},Eq=($)=>{let Q=(q,V)=>{let Y=q.label??String(q.value);return V==="active"?`${N.default.cyan(O4)} ${Y} ${q.hint?N.default.dim(`(${q.hint})`):""}`:V==="selected"?`${N.default.green(Fq)} ${N.default.dim(Y)} ${q.hint?N.default.dim(`(${q.hint})`):""}`:V==="cancelled"?`${N.default.strikethrough(N.default.dim(Y))}`:V==="active-selected"?`${N.default.green(Fq)} ${Y} ${q.hint?N.default.dim(`(${q.hint})`):""}`:V==="submitted"?`${N.default.dim(Y)}`:`${N.default.dim(B4)} ${N.default.dim(Y)}`};return new Tq({options:$.options,initialValues:$.initialValues,required:$.required??!0,cursorAt:$.cursorAt,validate(q){if(this.required&&q.length===0)return`Please select at least one option.
27
27
  ${N.default.reset(N.default.dim(`Press ${N.default.gray(N.default.bgWhite(N.default.inverse(" space ")))} to select, ${N.default.gray(N.default.bgWhite(N.default.inverse(" enter ")))} to submit`))}`},render(){let q=`${N.default.gray(g)}
28
28
  ${d8(this.state)} ${$.message}
29
29
  `,V=(Y,X)=>{let J=this.value.includes(Y.value);return X&&J?Q(Y,"active-selected"):J?Q(Y,"selected"):Q(Y,X?"active":"inactive")};switch(this.state){case"submit":return`${q}${N.default.gray(g)} ${this.options.filter(({value:Y})=>this.value.includes(Y)).map((Y)=>Q(Y,"submitted")).join(N.default.dim(", "))||N.default.dim("none")}`;case"cancel":{let Y=this.options.filter(({value:X})=>this.value.includes(X)).map((X)=>Q(X,"cancelled")).join(N.default.dim(", "));return`${q}${N.default.gray(g)} ${Y.trim()?`${Y}
30
30
  ${N.default.gray(g)}`:""}`}case"error":{let Y=this.error.split(`
31
- `).map((X,J)=>J===0?`${N.default.yellow(S0)} ${N.default.yellow(X)}`:` ${X}`).join(`
31
+ `).map((X,J)=>J===0?`${N.default.yellow(x0)} ${N.default.yellow(X)}`:` ${X}`).join(`
32
32
  `);return`${q+N.default.yellow(g)} ${u8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:V}).join(`
33
33
  ${N.default.yellow(g)} `)}
34
34
  ${Y}
35
35
  `}default:return`${q}${N.default.cyan(g)} ${u8({options:this.options,cursor:this.cursor,maxItems:$.maxItems,style:V}).join(`
36
36
  ${N.default.cyan(g)} `)}
37
- ${N.default.cyan(S0)}
38
- `}}}).prompt()},w1=($="",Q="")=>{let q=`
37
+ ${N.default.cyan(x0)}
38
+ `}}}).prompt()},A1=($="",Q="")=>{let q=`
39
39
  ${$}
40
40
  `.split(`
41
- `),V=f8(Q).length,Y=Math.max(q.reduce((J,G)=>{let U=f8(G);return U.length>J?U.length:J},0),V)+2,X=q.map((J)=>`${N.default.gray(g)} ${N.default.dim(J)}${" ".repeat(Y-f8(J).length)}${N.default.gray(g)}`).join(`
41
+ `),V=b8(Q).length,Y=Math.max(q.reduce((J,G)=>{let U=b8(G);return U.length>J?U.length:J},0),V)+2,X=q.map((J)=>`${N.default.gray(g)} ${N.default.dim(J)}${" ".repeat(Y-b8(J).length)}${N.default.gray(g)}`).join(`
42
42
  `);process.stdout.write(`${N.default.gray(g)}
43
- ${N.default.green(O6)} ${N.default.reset(Q)} ${N.default.gray(vq.repeat(Math.max(Y-V-1,1))+M4)}
43
+ ${N.default.green(O6)} ${N.default.reset(Q)} ${N.default.gray(Rq.repeat(Math.max(Y-V-1,1))+N4)}
44
44
  ${X}
45
- ${N.default.gray(I4+vq.repeat(Y+2)+C4)}
46
- `)},J1=($="")=>{process.stdout.write(`${N.default.gray(S0)} ${N.default.red($)}
45
+ ${N.default.gray(M4+Rq.repeat(Y+2)+I4)}
46
+ `)},J1=($="")=>{process.stdout.write(`${N.default.gray(x0)} ${N.default.red($)}
47
47
 
48
- `)},A1=($="")=>{process.stdout.write(`${N.default.gray(O4)} ${$}
49
- `)},T1=($="")=>{process.stdout.write(`${N.default.gray(g)}
50
- ${N.default.gray(S0)} ${$}
48
+ `)},T1=($="")=>{process.stdout.write(`${N.default.gray(L4)} ${$}
49
+ `)},F1=($="")=>{process.stdout.write(`${N.default.gray(g)}
50
+ ${N.default.gray(x0)} ${$}
51
51
 
52
- `)},c,BH,z1=({indicator:$="dots"}={})=>{let Q=m8?["◒","◐","◓","◑"]:["•","o","O","0"],q=m8?80:120,V=process.env.CI==="true",Y,X,J=!1,G="",U,K=performance.now(),W=(B)=>{let O=B>1?"Something went wrong":"Canceled";J&&A(O,B)},Z=()=>W(2),z=()=>W(1),H=()=>{process.on("uncaughtExceptionMonitor",Z),process.on("unhandledRejection",Z),process.on("SIGINT",z),process.on("SIGTERM",z),process.on("exit",W)},C=()=>{process.removeListener("uncaughtExceptionMonitor",Z),process.removeListener("unhandledRejection",Z),process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),process.removeListener("exit",W)},P=()=>{if(U===void 0)return;V&&process.stdout.write(`
52
+ `)},c,OH,H1=({indicator:$="dots"}={})=>{let Q=m8?["◒","◐","◓","◑"]:["•","o","O","0"],q=m8?80:120,V=process.env.CI==="true",Y,X,J=!1,G="",U,K=performance.now(),W=(B)=>{let O=B>1?"Something went wrong":"Canceled";J&&A(O,B)},Z=()=>W(2),z=()=>W(1),H=()=>{process.on("uncaughtExceptionMonitor",Z),process.on("unhandledRejection",Z),process.on("SIGINT",z),process.on("SIGTERM",z),process.on("exit",W)},C=()=>{process.removeListener("uncaughtExceptionMonitor",Z),process.removeListener("unhandledRejection",Z),process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),process.removeListener("exit",W)},P=()=>{if(U===void 0)return;V&&process.stdout.write(`
53
53
  `);let B=U.split(`
54
- `);process.stdout.write(L6.cursor.move(-999,B.length-1)),process.stdout.write(L6.erase.down(B.length))},I=(B)=>B.replace(/\.+$/,""),M=(B)=>{let O=(performance.now()-B)/1000,F=Math.floor(O/60),R=Math.floor(O%60);return F>0?`[${F}m ${R}s]`:`[${R}s]`},L=(B="")=>{J=!0,Y=Tq(),G=I(B),K=performance.now(),process.stdout.write(`${N.default.gray(g)}
55
- `);let O=0,F=0;H(),X=setInterval(()=>{if(V&&G===U)return;P(),U=G;let R=N.default.magenta(Q[O]);if(V)process.stdout.write(`${R} ${G}...`);else if($==="timer")process.stdout.write(`${R} ${G} ${M(K)}`);else{let v=".".repeat(Math.floor(F)).slice(0,3);process.stdout.write(`${R} ${G}${v}`)}O=O+1<Q.length?O+1:0,F=F<Q.length?F+0.125:0},q)},A=(B="",O=0)=>{J=!1,clearInterval(X),P();let F=O===0?N.default.green(O6):O===1?N.default.red(xq):N.default.red(Sq);G=I(B??G),$==="timer"?process.stdout.write(`${F} ${G} ${M(K)}
54
+ `);process.stdout.write(L6.cursor.move(-999,B.length-1)),process.stdout.write(L6.erase.down(B.length))},I=(B)=>B.replace(/\.+$/,""),M=(B)=>{let O=(performance.now()-B)/1000,F=Math.floor(O/60),R=Math.floor(O%60);return F>0?`[${F}m ${R}s]`:`[${R}s]`},L=(B="")=>{J=!0,Y=Aq(),G=I(B),K=performance.now(),process.stdout.write(`${N.default.gray(g)}
55
+ `);let O=0,F=0;H(),X=setInterval(()=>{if(V&&G===U)return;P(),U=G;let R=N.default.magenta(Q[O]);if(V)process.stdout.write(`${R} ${G}...`);else if($==="timer")process.stdout.write(`${R} ${G} ${M(K)}`);else{let v=".".repeat(Math.floor(F)).slice(0,3);process.stdout.write(`${R} ${G}${v}`)}O=O+1<Q.length?O+1:0,F=F<Q.length?F+0.125:0},q)},A=(B="",O=0)=>{J=!1,clearInterval(X),P();let F=O===0?N.default.green(O6):O===1?N.default.red(vq):N.default.red(xq);G=I(B??G),$==="timer"?process.stdout.write(`${F} ${G} ${M(K)}
56
56
  `):process.stdout.write(`${F} ${G}
57
- `),C(),Y()};return{start:L,stop:A,message:(B="")=>{G=I(B??G)}}};var E0=e1(()=>{b8();b8();N=I1(c1(),1),L6=I1(v8(),1);m8=P4(),L4=p("◆","*"),xq=p("■","x"),Sq=p("▲","x"),O6=p("◇","o"),O4=p("┌","T"),g=p("│","|"),S0=p("└","—"),c8=p("●",">"),p8=p("○"," "),B4=p("◻","[•]"),Rq=p("◼","[+]"),N4=p("◻","[ ]"),OH=p("▪","•"),vq=p("─","-"),M4=p("╮","+"),I4=p("├","+"),C4=p("╯","+"),w4=p("●","•"),A4=p("◆","*"),T4=p("▲","!"),F4=p("■","x"),c={message:($="",{symbol:Q=N.default.gray(g)}={})=>{let q=[`${N.default.gray(g)}`];if($){let[V,...Y]=$.split(`
57
+ `),C(),Y()};return{start:L,stop:A,message:(B="")=>{G=I(B??G)}}};var S0=e1(()=>{f8();f8();N=C1(c1(),1),L6=C1(v8(),1);m8=H4(),P4=p("◆","*"),vq=p("■","x"),xq=p("▲","x"),O6=p("◇","o"),L4=p("┌","T"),g=p("│","|"),x0=p("└","—"),c8=p("●",">"),p8=p("○"," "),O4=p("◻","[•]"),Fq=p("◼","[+]"),B4=p("◻","[ ]"),LH=p("▪","•"),Rq=p("─","-"),N4=p("╮","+"),M4=p("├","+"),I4=p("╯","+"),C4=p("●","•"),w4=p("◆","*"),A4=p("▲","!"),T4=p("■","x"),c={message:($="",{symbol:Q=N.default.gray(g)}={})=>{let q=[`${N.default.gray(g)}`];if($){let[V,...Y]=$.split(`
58
58
  `);q.push(`${Q} ${V}`,...Y.map((X)=>`${N.default.gray(g)} ${X}`))}process.stdout.write(`${q.join(`
59
59
  `)}
60
- `)},info:($)=>{c.message($,{symbol:N.default.blue(w4)})},success:($)=>{c.message($,{symbol:N.default.green(A4)})},step:($)=>{c.message($,{symbol:N.default.green(O6)})},warn:($)=>{c.message($,{symbol:N.default.yellow(T4)})},warning:($)=>{c.warn($)},error:($)=>{c.message($,{symbol:N.default.red(F4)})}},BH=`${N.default.gray(g)} `});var j$=w((MH,l8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)l8.exports={nextTick:R4};else l8.exports=process;function R4($,Q,q,V){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,X,J;switch(Y){case 0:case 1:return process.nextTick($);case 2:return process.nextTick(function(){$.call(null,Q)});case 3:return process.nextTick(function(){$.call(null,Q,q)});case 4:return process.nextTick(function(){$.call(null,Q,q,V)});default:X=Array(Y-1),J=0;while(J<X.length)X[J++]=arguments[J];return process.nextTick(function(){$.apply(null,X)})}}});var kq=w((IH,gq)=>{var v4={}.toString;gq.exports=Array.isArray||function($){return v4.call($)=="[object Array]"}});var Z$=w((o8,hq)=>{var N6=l("buffer"),p1=N6.Buffer;function Dq($,Q){for(var q in $)Q[q]=$[q]}if(p1.from&&p1.alloc&&p1.allocUnsafe&&p1.allocUnsafeSlow)hq.exports=N6;else Dq(N6,o8),o8.Buffer=y0;function y0($,Q,q){return p1($,Q,q)}Dq(p1,y0);y0.from=function($,Q,q){if(typeof $==="number")throw TypeError("Argument must not be a number");return p1($,Q,q)};y0.alloc=function($,Q,q){if(typeof $!=="number")throw TypeError("Argument must be a number");var V=p1($);if(Q!==void 0)if(typeof q==="string")V.fill(Q,q);else V.fill(Q);else V.fill(0);return V};y0.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return p1($)};y0.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return N6.SlowBuffer($)}});var g0=w((u4)=>{function x4($){if(Array.isArray)return Array.isArray($);return M6($)==="[object Array]"}u4.isArray=x4;function S4($){return typeof $==="boolean"}u4.isBoolean=S4;function E4($){return $===null}u4.isNull=E4;function y4($){return $==null}u4.isNullOrUndefined=y4;function g4($){return typeof $==="number"}u4.isNumber=g4;function k4($){return typeof $==="string"}u4.isString=k4;function D4($){return typeof $==="symbol"}u4.isSymbol=D4;function h4($){return $===void 0}u4.isUndefined=h4;function _4($){return M6($)==="[object RegExp]"}u4.isRegExp=_4;function b4($){return typeof $==="object"&&$!==null}u4.isObject=b4;function f4($){return M6($)==="[object Date]"}u4.isDate=f4;function m4($){return M6($)==="[object Error]"||$ instanceof Error}u4.isError=m4;function c4($){return typeof $==="function"}u4.isFunction=c4;function p4($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}u4.isPrimitive=p4;u4.isBuffer=l("buffer").Buffer.isBuffer;function M6($){return Object.prototype.toString.call($)}});var _q=w((wH,i8)=>{if(typeof Object.create==="function")i8.exports=function(Q,q){if(q)Q.super_=q,Q.prototype=Object.create(q.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else i8.exports=function(Q,q){if(q){Q.super_=q;var V=function(){};V.prototype=q.prototype,Q.prototype=new V,Q.prototype.constructor=Q}}});var k0=w((AH,n8)=>{try{if(I6=l("util"),typeof I6.inherits!=="function")throw"";n8.exports=I6.inherits}catch($){n8.exports=_q()}var I6});var fq=w((TH,r8)=>{function YX($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var bq=Z$().Buffer,z$=l("util");function XX($,Q,q){$.copy(Q,q)}r8.exports=function(){function $(){YX(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(q){var V={data:q,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length},$.prototype.unshift=function(q){var V={data:q,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length},$.prototype.shift=function(){if(this.length===0)return;var q=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,q},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(q){if(this.length===0)return"";var V=this.head,Y=""+V.data;while(V=V.next)Y+=q+V.data;return Y},$.prototype.concat=function(q){if(this.length===0)return bq.alloc(0);var V=bq.allocUnsafe(q>>>0),Y=this.head,X=0;while(Y)XX(Y.data,V,X),X+=Y.data.length,Y=Y.next;return V},$}();if(z$&&z$.inspect&&z$.inspect.custom)r8.exports.prototype[z$.inspect.custom]=function(){var $=z$.inspect({length:this.length});return this.constructor.name+" "+$}});var a8=w((FH,mq)=>{var C6=j$();function GX($,Q){var q=this,V=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(V||Y){if(Q)Q($);else if($){if(!this._writableState)C6.nextTick(w6,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,C6.nextTick(w6,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(X){if(!Q&&X){if(!q._writableState)C6.nextTick(w6,q,X);else if(!q._writableState.errorEmitted)q._writableState.errorEmitted=!0,C6.nextTick(w6,q,X)}else if(Q)Q(X)}),this}function KX(){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 w6($,Q){$.emit("error",Q)}mq.exports={destroy:GX,undestroy:KX}});var pq=w((RH,cq)=>{cq.exports=l("util").deprecate});var t8=w((vH,aq)=>{var z0=j$();aq.exports=o;function dq($){var Q=this;this.next=null,this.entry=null,this.finish=function(){FX(Q,$)}}var WX=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:z0.nextTick,D0;o.WritableState=P$;var lq=Object.create(g0());lq.inherits=k0();var UX={deprecate:pq()},oq=l("stream"),T6=Z$().Buffer,jX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ZX($){return T6.from($)}function zX($){return T6.isBuffer($)||$ instanceof jX}var iq=a8();lq.inherits(o,oq);function HX(){}function P$($,Q){D0=D0||H0(),$=$||{};var q=Q instanceof D0;if(this.objectMode=!!$.objectMode,q)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:V,writableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(V||V===0)this.highWaterMark=V;else if(q&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=$.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){IX(Q,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new dq(this)}P$.prototype.getBuffer=function(){var Q=this.bufferedRequest,q=[];while(Q)q.push(Q),Q=Q.next;return q};(function(){try{Object.defineProperty(P$.prototype,"buffer",{get:UX.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var A6;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")A6=Function.prototype[Symbol.hasInstance],Object.defineProperty(o,Symbol.hasInstance,{value:function($){if(A6.call(this,$))return!0;if(this!==o)return!1;return $&&$._writableState instanceof P$}});else A6=function($){return $ instanceof this};function o($){if(D0=D0||H0(),!A6.call(o,this)&&!(this instanceof D0))return new o($);if(this._writableState=new P$($,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}oq.call(this)}o.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function PX($,Q){var q=Error("write after end");$.emit("error",q),z0.nextTick(Q,q)}function LX($,Q,q,V){var Y=!0,X=!1;if(q===null)X=TypeError("May not write null values to stream");else if(typeof q!=="string"&&q!==void 0&&!Q.objectMode)X=TypeError("Invalid non-string/buffer chunk");if(X)$.emit("error",X),z0.nextTick(V,X),Y=!1;return Y}o.prototype.write=function($,Q,q){var V=this._writableState,Y=!1,X=!V.objectMode&&zX($);if(X&&!T6.isBuffer($))$=ZX($);if(typeof Q==="function")q=Q,Q=null;if(X)Q="buffer";else if(!Q)Q=V.defaultEncoding;if(typeof q!=="function")q=HX;if(V.ended)PX(this,q);else if(X||LX(this,V,$,q))V.pendingcb++,Y=BX(this,V,X,$,Q,q);return Y};o.prototype.cork=function(){var $=this._writableState;$.corked++};o.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)nq(this,$)}};o.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 OX($,Q,q){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=T6.from(Q,q);return Q}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function BX($,Q,q,V,Y,X){if(!q){var J=OX(Q,V,Y);if(V!==J)q=!0,Y="buffer",V=J}var G=Q.objectMode?1:V.length;Q.length+=G;var U=Q.length<Q.highWaterMark;if(!U)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:V,encoding:Y,isBuf:q,callback:X,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else s8($,Q,!1,G,V,Y,X);return U}function s8($,Q,q,V,Y,X,J){if(Q.writelen=V,Q.writecb=J,Q.writing=!0,Q.sync=!0,q)$._writev(Y,Q.onwrite);else $._write(Y,X,Q.onwrite);Q.sync=!1}function NX($,Q,q,V,Y){if(--Q.pendingcb,q)z0.nextTick(Y,V),z0.nextTick(H$,$,Q),$._writableState.errorEmitted=!0,$.emit("error",V);else Y(V),$._writableState.errorEmitted=!0,$.emit("error",V),H$($,Q)}function MX($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function IX($,Q){var q=$._writableState,V=q.sync,Y=q.writecb;if(MX(q),Q)NX($,q,V,Q,Y);else{var X=rq(q);if(!X&&!q.corked&&!q.bufferProcessing&&q.bufferedRequest)nq($,q);if(V)WX(uq,$,q,X,Y);else uq($,q,X,Y)}}function uq($,Q,q,V){if(!q)CX($,Q);Q.pendingcb--,V(),H$($,Q)}function CX($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function nq($,Q){Q.bufferProcessing=!0;var q=Q.bufferedRequest;if($._writev&&q&&q.next){var V=Q.bufferedRequestCount,Y=Array(V),X=Q.corkedRequestsFree;X.entry=q;var J=0,G=!0;while(q){if(Y[J]=q,!q.isBuf)G=!1;q=q.next,J+=1}if(Y.allBuffers=G,s8($,Q,!0,Q.length,Y,"",X.finish),Q.pendingcb++,Q.lastBufferedRequest=null,X.next)Q.corkedRequestsFree=X.next,X.next=null;else Q.corkedRequestsFree=new dq(Q);Q.bufferedRequestCount=0}else{while(q){var{chunk:U,encoding:K,callback:W}=q,Z=Q.objectMode?1:U.length;if(s8($,Q,!1,Z,U,K,W),q=q.next,Q.bufferedRequestCount--,Q.writing)break}if(q===null)Q.lastBufferedRequest=null}Q.bufferedRequest=q,Q.bufferProcessing=!1}o.prototype._write=function($,Q,q){q(Error("_write() is not implemented"))};o.prototype._writev=null;o.prototype.end=function($,Q,q){var V=this._writableState;if(typeof $==="function")q=$,$=null,Q=null;else if(typeof Q==="function")q=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(V.corked)V.corked=1,this.uncork();if(!V.ending)TX(this,V,q)};function rq($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function wX($,Q){$._final(function(q){if(Q.pendingcb--,q)$.emit("error",q);Q.prefinished=!0,$.emit("prefinish"),H$($,Q)})}function AX($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,z0.nextTick(wX,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function H$($,Q){var q=rq(Q);if(q){if(AX($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return q}function TX($,Q,q){if(Q.ending=!0,H$($,Q),q)if(Q.finished)z0.nextTick(q);else $.once("finish",q);Q.ended=!0,$.writable=!1}function FX($,Q,q){var V=$.entry;$.entry=null;while(V){var Y=V.callback;Q.pendingcb--,Y(q),V=V.next}Q.corkedRequestsFree.next=$}Object.defineProperty(o.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});o.prototype.destroy=iq.destroy;o.prototype._undestroy=iq.undestroy;o.prototype._destroy=function($,Q){this.end(),Q($)}});var H0=w((xH,$V)=>{var sq=j$(),RX=Object.keys||function($){var Q=[];for(var q in $)Q.push(q);return Q};$V.exports=u1;var tq=Object.create(g0());tq.inherits=k0();var eq=$5(),e8=t8();tq.inherits(u1,eq);{F6=RX(e8.prototype);for(L$=0;L$<F6.length;L$++)if(O$=F6[L$],!u1.prototype[O$])u1.prototype[O$]=e8.prototype[O$]}var F6,O$,L$;function u1($){if(!(this instanceof u1))return new u1($);if(eq.call(this,$),e8.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",vX)}Object.defineProperty(u1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function vX(){if(this.allowHalfOpen||this._writableState.ended)return;sq.nextTick(xX,this)}function xX($){$.end()}Object.defineProperty(u1.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function($){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=$,this._writableState.destroyed=$}});u1.prototype._destroy=function($,Q){this.push(null),this.end(),sq.nextTick(Q,$)}});var V5=w((uX)=>{var q5=Z$().Buffer,QV=q5.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 SX($){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 EX($){var Q=SX($);if(typeof Q!=="string"&&(q5.isEncoding===QV||!QV($)))throw Error("Unknown encoding: "+$);return Q||$}uX.StringDecoder=B$;function B$($){this.encoding=EX($);var Q;switch(this.encoding){case"utf16le":this.text=_X,this.end=bX,Q=4;break;case"utf8":this.fillLast=kX,Q=4;break;case"base64":this.text=fX,this.end=mX,Q=3;break;default:this.write=cX,this.end=pX;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q5.allocUnsafe(Q)}B$.prototype.write=function($){if($.length===0)return"";var Q,q;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";q=this.lastNeed,this.lastNeed=0}else q=0;if(q<$.length)return Q?Q+this.text($,q):this.text($,q);return Q||""};B$.prototype.end=hX;B$.prototype.text=DX;B$.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 Q5($){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 yX($,Q,q){var V=Q.length-1;if(V<q)return 0;var Y=Q5(Q[V]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--V<q||Y===-2)return 0;if(Y=Q5(Q[V]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--V<q||Y===-2)return 0;if(Y=Q5(Q[V]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function gX($,Q,q){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 kX($){var Q=this.lastTotal-this.lastNeed,q=gX(this,$,Q);if(q!==void 0)return q;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 DX($,Q){var q=yX(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=q;var V=$.length-(q-this.lastNeed);return $.copy(this.lastChar,0,V),$.toString("utf8",Q,V)}function hX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function _X($,Q){if(($.length-Q)%2===0){var q=$.toString("utf16le",Q);if(q){var V=q.charCodeAt(q.length-1);if(V>=55296&&V<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],q.slice(0,-1)}return q}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function bX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var q=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,q)}return Q}function fX($,Q){var q=($.length-Q)%3;if(q===0)return $.toString("base64",Q);if(this.lastNeed=3-q,this.lastTotal=3,q===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-q)}function mX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function cX($){return $.toString(this.encoding)}function pX($){return $&&$.length?this.write($):""}});var $5=w((yH,zV)=>{var _0=j$();zV.exports=_;var lX=kq(),N$;_.ReadableState=KV;var EH=l("events").EventEmitter,YV=function($,Q){return $.listeners(Q).length},K5=l("stream"),M$=Z$().Buffer,oX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function iX($){return M$.from($)}function nX($){return M$.isBuffer($)||$ instanceof oX}var XV=Object.create(g0());XV.inherits=k0();var J5=l("util"),y=void 0;if(J5&&J5.debuglog)y=J5.debuglog("stream");else y=function(){};var rX=fq(),GV=a8(),h0;XV.inherits(_,K5);var Y5=["error","close","destroy","pause","resume"];function aX($,Q,q){if(typeof $.prependListener==="function")return $.prependListener(Q,q);if(!$._events||!$._events[Q])$.on(Q,q);else if(lX($._events[Q]))$._events[Q].unshift(q);else $._events[Q]=[q,$._events[Q]]}function KV($,Q){N$=N$||H0(),$=$||{};var q=Q instanceof N$;if(this.objectMode=!!$.objectMode,q)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:V,readableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(V||V===0)this.highWaterMark=V;else if(q&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new rX,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(!h0)h0=V5().StringDecoder;this.decoder=new h0($.encoding),this.encoding=$.encoding}}function _($){if(N$=N$||H0(),!(this instanceof _))return new _($);if(this._readableState=new KV($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}K5.call(this)}Object.defineProperty(_.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});_.prototype.destroy=GV.destroy;_.prototype._undestroy=GV.undestroy;_.prototype._destroy=function($,Q){this.push(null),Q($)};_.prototype.push=function($,Q){var q=this._readableState,V;if(!q.objectMode){if(typeof $==="string"){if(Q=Q||q.defaultEncoding,Q!==q.encoding)$=M$.from($,Q),Q="";V=!0}}else V=!0;return WV(this,$,Q,!1,V)};_.prototype.unshift=function($){return WV(this,$,null,!0,!1)};function WV($,Q,q,V,Y){var X=$._readableState;if(Q===null)X.reading=!1,$3($,X);else{var J;if(!Y)J=sX(X,Q);if(J)$.emit("error",J);else if(X.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!X.objectMode&&Object.getPrototypeOf(Q)!==M$.prototype)Q=iX(Q);if(V)if(X.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else X5($,X,Q,!0);else if(X.ended)$.emit("error",Error("stream.push() after EOF"));else if(X.reading=!1,X.decoder&&!q)if(Q=X.decoder.write(Q),X.objectMode||Q.length!==0)X5($,X,Q,!1);else UV($,X);else X5($,X,Q,!1)}else if(!V)X.reading=!1}return tX(X)}function X5($,Q,q,V){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",q),$.read(0);else{if(Q.length+=Q.objectMode?1:q.length,V)Q.buffer.unshift(q);else Q.buffer.push(q);if(Q.needReadable)R6($)}UV($,Q)}function sX($,Q){var q;if(!nX(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)q=TypeError("Invalid non-string/buffer chunk");return q}function tX($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}_.prototype.isPaused=function(){return this._readableState.flowing===!1};_.prototype.setEncoding=function($){if(!h0)h0=V5().StringDecoder;return this._readableState.decoder=new h0($),this._readableState.encoding=$,this};var qV=8388608;function eX($){if($>=qV)$=qV;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function VV($,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=eX($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}_.prototype.read=function($){y("read",$),$=parseInt($,10);var Q=this._readableState,q=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(y("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)G5(this);else R6(this);return null}if($=VV($,Q),$===0&&Q.ended){if(Q.length===0)G5(this);return null}var V=Q.needReadable;if(y("need readable",V),Q.length===0||Q.length-$<Q.highWaterMark)V=!0,y("length less than watermark",V);if(Q.ended||Q.reading)V=!1,y("reading or ended",V);else if(V){if(y("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=VV(q,Q)}var Y;if($>0)Y=jV($,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(q!==$&&Q.ended)G5(this)}if(Y!==null)this.emit("data",Y);return Y};function $3($,Q){if(Q.ended)return;if(Q.decoder){var q=Q.decoder.end();if(q&&q.length)Q.buffer.push(q),Q.length+=Q.objectMode?1:q.length}Q.ended=!0,R6($)}function R6($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(y("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)_0.nextTick(JV,$);else JV($)}function JV($){y("emit readable"),$.emit("readable"),W5($)}function UV($,Q){if(!Q.readingMore)Q.readingMore=!0,_0.nextTick(Q3,$,Q)}function Q3($,Q){var q=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(y("maybeReadMore read 0"),$.read(0),q===Q.length)break;else q=Q.length;Q.readingMore=!1}_.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};_.prototype.pipe=function($,Q){var q=this,V=this._readableState;switch(V.pipesCount){case 0:V.pipes=$;break;case 1:V.pipes=[V.pipes,$];break;default:V.pipes.push($);break}V.pipesCount+=1,y("pipe count=%d opts=%j",V.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,X=Y?G:I;if(V.endEmitted)_0.nextTick(X);else q.once("end",X);$.on("unpipe",J);function J(M,L){if(y("onunpipe"),M===q){if(L&&L.hasUnpiped===!1)L.hasUnpiped=!0,W()}}function G(){y("onend"),$.end()}var U=q3(q);$.on("drain",U);var K=!1;function W(){if(y("cleanup"),$.removeListener("close",C),$.removeListener("finish",P),$.removeListener("drain",U),$.removeListener("error",H),$.removeListener("unpipe",J),q.removeListener("end",G),q.removeListener("end",I),q.removeListener("data",z),K=!0,V.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var Z=!1;q.on("data",z);function z(M){y("ondata"),Z=!1;var L=$.write(M);if(L===!1&&!Z){if((V.pipesCount===1&&V.pipes===$||V.pipesCount>1&&ZV(V.pipes,$)!==-1)&&!K)y("false write response, pause",V.awaitDrain),V.awaitDrain++,Z=!0;q.pause()}}function H(M){if(y("onerror",M),I(),$.removeListener("error",H),YV($,"error")===0)$.emit("error",M)}aX($,"error",H);function C(){$.removeListener("finish",P),I()}$.once("close",C);function P(){y("onfinish"),$.removeListener("close",C),I()}$.once("finish",P);function I(){y("unpipe"),q.unpipe($)}if($.emit("pipe",q),!V.flowing)y("pipe resume"),q.resume();return $};function q3($){return function(){var Q=$._readableState;if(y("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&YV($,"data"))Q.flowing=!0,W5($)}}_.prototype.unpipe=function($){var Q=this._readableState,q={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,q);return this}if(!$){var{pipes:V,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var X=0;X<Y;X++)V[X].emit("unpipe",this,{hasUnpiped:!1});return this}var J=ZV(Q.pipes,$);if(J===-1)return this;if(Q.pipes.splice(J,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,q),this};_.prototype.on=function($,Q){var q=K5.prototype.on.call(this,$,Q);if($==="data"){if(this._readableState.flowing!==!1)this.resume()}else if($==="readable"){var V=this._readableState;if(!V.endEmitted&&!V.readableListening){if(V.readableListening=V.needReadable=!0,V.emittedReadable=!1,!V.reading)_0.nextTick(V3,this);else if(V.length)R6(this)}}return q};_.prototype.addListener=_.prototype.on;function V3($){y("readable nexttick read 0"),$.read(0)}_.prototype.resume=function(){var $=this._readableState;if(!$.flowing)y("resume"),$.flowing=!0,J3(this,$);return this};function J3($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,_0.nextTick(Y3,$,Q)}function Y3($,Q){if(!Q.reading)y("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),W5($),Q.flowing&&!Q.reading)$.read(0)}_.prototype.pause=function(){if(y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)y("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function W5($){var Q=$._readableState;y("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}_.prototype.wrap=function($){var Q=this,q=this._readableState,V=!1;$.on("end",function(){if(y("wrapped end"),q.decoder&&!q.ended){var J=q.decoder.end();if(J&&J.length)Q.push(J)}Q.push(null)}),$.on("data",function(J){if(y("wrapped data"),q.decoder)J=q.decoder.write(J);if(q.objectMode&&(J===null||J===void 0))return;else if(!q.objectMode&&(!J||!J.length))return;var G=Q.push(J);if(!G)V=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(J){return function(){return $[J].apply($,arguments)}}(Y);for(var X=0;X<Y5.length;X++)$.on(Y5[X],this.emit.bind(this,Y5[X]));return this._read=function(J){if(y("wrapped _read",J),V)V=!1,$.resume()},this};Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_._fromList=jV;function jV($,Q){if(Q.length===0)return null;var q;if(Q.objectMode)q=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)q=Q.buffer.join("");else if(Q.buffer.length===1)q=Q.buffer.head.data;else q=Q.buffer.concat(Q.length);Q.buffer.clear()}else q=X3($,Q.buffer,Q.decoder);return q}function X3($,Q,q){var V;if($<Q.head.data.length)V=Q.head.data.slice(0,$),Q.head.data=Q.head.data.slice($);else if($===Q.head.data.length)V=Q.shift();else V=q?G3($,Q):K3($,Q);return V}function G3($,Q){var q=Q.head,V=1,Y=q.data;$-=Y.length;while(q=q.next){var X=q.data,J=$>X.length?X.length:$;if(J===X.length)Y+=X;else Y+=X.slice(0,$);if($-=J,$===0){if(J===X.length)if(++V,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=X.slice(J);break}++V}return Q.length-=V,Y}function K3($,Q){var q=M$.allocUnsafe($),V=Q.head,Y=1;V.data.copy(q),$-=V.data.length;while(V=V.next){var X=V.data,J=$>X.length?X.length:$;if(X.copy(q,q.length-$,0,J),$-=J,$===0){if(J===X.length)if(++Y,V.next)Q.head=V.next;else Q.head=Q.tail=null;else Q.head=V,V.data=X.slice(J);break}++Y}return Q.length-=Y,q}function G5($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,_0.nextTick(W3,Q,$)}function W3($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function ZV($,Q){for(var q=0,V=$.length;q<V;q++)if($[q]===Q)return q;return-1}});var U5=w((gH,LV)=>{LV.exports=d1;var v6=H0(),PV=Object.create(g0());PV.inherits=k0();PV.inherits(d1,v6);function U3($,Q){var q=this._transformState;q.transforming=!1;var V=q.writecb;if(!V)return this.emit("error",Error("write callback called multiple times"));if(q.writechunk=null,q.writecb=null,Q!=null)this.push(Q);V($);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function d1($){if(!(this instanceof d1))return new d1($);if(v6.call(this,$),this._transformState={afterTransform:U3.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",j3)}function j3(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,q){HV($,Q,q)});else HV(this,null,null)}d1.prototype.push=function($,Q){return this._transformState.needTransform=!1,v6.prototype.push.call(this,$,Q)};d1.prototype._transform=function($,Q,q){throw Error("_transform() is not implemented")};d1.prototype._write=function($,Q,q){var V=this._transformState;if(V.writecb=q,V.writechunk=$,V.writeencoding=Q,!V.transforming){var Y=this._readableState;if(V.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};d1.prototype._read=function($){var Q=this._transformState;if(Q.writechunk!==null&&Q.writecb&&!Q.transforming)Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform);else Q.needTransform=!0};d1.prototype._destroy=function($,Q){var q=this;v6.prototype._destroy.call(this,$,function(V){Q(V),q.emit("close")})};function HV($,Q,q){if(Q)return $.emit("error",Q);if(q!=null)$.push(q);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 MV=w((kH,NV)=>{NV.exports=I$;var OV=U5(),BV=Object.create(g0());BV.inherits=k0();BV.inherits(I$,OV);function I$($){if(!(this instanceof I$))return new I$($);OV.call(this,$)}I$.prototype._transform=function($,Q,q){q(null,$)}});var j5=w((a,x6)=>{var S1=l("stream");if(process.env.READABLE_STREAM==="disable"&&S1)x6.exports=S1,a=x6.exports=S1.Readable,a.Readable=S1.Readable,a.Writable=S1.Writable,a.Duplex=S1.Duplex,a.Transform=S1.Transform,a.PassThrough=S1.PassThrough,a.Stream=S1;else a=x6.exports=$5(),a.Stream=S1||a,a.Readable=a,a.Writable=t8(),a.Duplex=H0(),a.Transform=U5(),a.PassThrough=MV()});var l1=w((z3)=>{z3.base64=!0;z3.array=!0;z3.string=!0;z3.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";z3.nodebuffer=typeof Buffer<"u";z3.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")z3.blob=!1;else{S6=new ArrayBuffer(0);try{z3.blob=new Blob([S6],{type:"application/zip"}).size===0}catch($){try{z5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,E6=new z5,E6.append(S6),z3.blob=E6.getBlob("application/zip").size===0}catch(Q){z3.blob=!1}}}var S6,z5,E6;try{z3.nodestream=!!j5().Readable}catch($){z3.nodestream=!1}});var H5=w((C3)=>{var M3=m(),I3=l1(),E1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";C3.encode=function($){var Q=[],q,V,Y,X,J,G,U,K=0,W=$.length,Z=W,z=M3.getTypeOf($)!=="string";while(K<$.length){if(Z=W-K,!z)q=$.charCodeAt(K++),V=K<W?$.charCodeAt(K++):0,Y=K<W?$.charCodeAt(K++):0;else q=$[K++],V=K<W?$[K++]:0,Y=K<W?$[K++]:0;X=q>>2,J=(q&3)<<4|V>>4,G=Z>1?(V&15)<<2|Y>>6:64,U=Z>2?Y&63:64,Q.push(E1.charAt(X)+E1.charAt(J)+E1.charAt(G)+E1.charAt(U))}return Q.join("")};C3.decode=function($){var Q,q,V,Y,X,J,G,U=0,K=0,W="data:";if($.substr(0,W.length)===W)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var Z=$.length*3/4;if($.charAt($.length-1)===E1.charAt(64))Z--;if($.charAt($.length-2)===E1.charAt(64))Z--;if(Z%1!==0)throw Error("Invalid base64 input, bad content length.");var z;if(I3.uint8array)z=new Uint8Array(Z|0);else z=Array(Z|0);while(U<$.length){if(Y=E1.indexOf($.charAt(U++)),X=E1.indexOf($.charAt(U++)),J=E1.indexOf($.charAt(U++)),G=E1.indexOf($.charAt(U++)),Q=Y<<2|X>>4,q=(X&15)<<4|J>>2,V=(J&3)<<6|G,z[K++]=Q,J!==64)z[K++]=q;if(G!==64)z[K++]=V}return z}});var C$=w((_H,IV)=>{IV.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 AV=w((fH,wV)=>{var bH=global.MutationObserver||global.WebKitMutationObserver,CV;CV=function(){process.nextTick(x3)};var T3,F3,R3,v3,P5,w$=[];function x3(){P5=!0;var $,Q,q=w$.length;while(q){Q=w$,w$=[],$=-1;while(++$<q)Q[$]();q=w$.length}P5=!1}wV.exports=S3;function S3($){if(w$.push($)===1&&!P5)CV()}});var EV=w((mH,SV)=>{var TV=AV();function f0(){}var $1={},FV=["REJECTED"],L5=["FULFILLED"],RV=["PENDING"];b0=["UNHANDLED"];var b0;SV.exports=q0;function q0($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=RV,this.queue=[],this.outcome=void 0,this.handled=b0,$!==f0)vV(this,$)}q0.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(q,V);function q(Y){function X(){return Y}return Q.resolve($()).then(X)}function V(Y){function X(){throw Y}return Q.resolve($()).then(X)}};q0.prototype.catch=function($){return this.then(null,$)};q0.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===L5||typeof Q!=="function"&&this.state===FV)return this;var q=new this.constructor(f0);if(this.handled===b0)this.handled=null;if(this.state!==RV){var V=this.state===L5?$:Q;O5(q,V,this.outcome)}else this.queue.push(new A$(q,$,Q));return q};function A$($,Q,q){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof q==="function")this.onRejected=q,this.callRejected=this.otherCallRejected}A$.prototype.callFulfilled=function($){$1.resolve(this.promise,$)};A$.prototype.otherCallFulfilled=function($){O5(this.promise,this.onFulfilled,$)};A$.prototype.callRejected=function($){$1.reject(this.promise,$)};A$.prototype.otherCallRejected=function($){O5(this.promise,this.onRejected,$)};function O5($,Q,q){TV(function(){var V;try{V=Q(q)}catch(Y){return $1.reject($,Y)}if(V===$)$1.reject($,TypeError("Cannot resolve promise with itself"));else $1.resolve($,V)})}$1.resolve=function($,Q){var q=xV(E3,Q);if(q.status==="error")return $1.reject($,q.value);var V=q.value;if(V)vV($,V);else{$.state=L5,$.outcome=Q;var Y=-1,X=$.queue.length;while(++Y<X)$.queue[Y].callFulfilled(Q)}return $};$1.reject=function($,Q){if($.state=FV,$.outcome=Q,$.handled===b0)TV(function(){if($.handled===b0)process.emit("unhandledRejection",Q,$)});var q=-1,V=$.queue.length;while(++q<V)$.queue[q].callRejected(Q);return $};function E3($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function vV($,Q){var q=!1;function V(G){if(q)return;q=!0,$1.reject($,G)}function Y(G){if(q)return;q=!0,$1.resolve($,G)}function X(){Q(Y,V)}var J=xV(X);if(J.status==="error")V(J.value)}function xV($,Q){var q={};try{q.value=$(Q),q.status="success"}catch(V){q.status="error",q.value=V}return q}q0.resolve=y3;function y3($){if($ instanceof this)return $;return $1.resolve(new this(f0),$)}q0.reject=g3;function g3($){var Q=new this(f0);return $1.reject(Q,$)}q0.all=k3;function k3($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var q=$.length,V=!1;if(!q)return this.resolve([]);var Y=Array(q),X=0,J=-1,G=new this(f0);while(++J<q)U($[J],J);return G;function U(K,W){Q.resolve(K).then(Z,function(z){if(!V)V=!0,$1.reject(G,z)});function Z(z){if(Y[W]=z,++X===q&&!V)V=!0,$1.resolve(G,Y)}}}q0.race=D3;function D3($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var q=$.length,V=!1;if(!q)return this.resolve([]);var Y=-1,X=new this(f0);while(++Y<q)J($[Y]);return X;function J(G){Q.resolve(G).then(function(U){if(!V)V=!0,$1.resolve(X,U)},function(U){if(!V)V=!0,$1.reject(X,U)})}}});var m0=w((cH,yV)=>{var B5=null;if(typeof Promise<"u")B5=Promise;else B5=EV();yV.exports={Promise:B5}});var kV=w((gV)=>{(function($,Q){if($.setImmediate)return;var q=1,V={},Y=!1,X=$.document,J;function G(L){if(typeof L!=="function")L=Function(""+L);var A=Array(arguments.length-1);for(var B=0;B<A.length;B++)A[B]=arguments[B+1];var O={callback:L,args:A};return V[q]=O,J(q),q++}function U(L){delete V[L]}function K(L){var{callback:A,args:B}=L;switch(B.length){case 0:A();break;case 1:A(B[0]);break;case 2:A(B[0],B[1]);break;case 3:A(B[0],B[1],B[2]);break;default:A.apply(Q,B);break}}function W(L){if(Y)setTimeout(W,0,L);else{var A=V[L];if(A){Y=!0;try{K(A)}finally{U(L),Y=!1}}}}function Z(){J=function(L){process.nextTick(function(){W(L)})}}function z(){if($.postMessage&&!$.importScripts){var L=!0,A=$.onmessage;return $.onmessage=function(){L=!1},$.postMessage("","*"),$.onmessage=A,L}}function H(){var L="setImmediate$"+Math.random()+"$",A=function(B){if(B.source===$&&typeof B.data==="string"&&B.data.indexOf(L)===0)W(+B.data.slice(L.length))};if($.addEventListener)$.addEventListener("message",A,!1);else $.attachEvent("onmessage",A);J=function(B){$.postMessage(L+B,"*")}}function C(){var L=new MessageChannel;L.port1.onmessage=function(A){var B=A.data;W(B)},J=function(A){L.port2.postMessage(A)}}function P(){var L=X.documentElement;J=function(A){var B=X.createElement("script");B.onreadystatechange=function(){W(A),B.onreadystatechange=null,L.removeChild(B),B=null},L.appendChild(B)}}function I(){J=function(L){setTimeout(W,0,L)}}var M=Object.getPrototypeOf&&Object.getPrototypeOf($);if(M=M&&M.setTimeout?M:$,{}.toString.call($.process)==="[object process]")Z();else if(z())H();else if($.MessageChannel)C();else if(X&&"onreadystatechange"in X.createElement("script"))P();else I();M.setImmediate=G,M.clearImmediate=U})(typeof self>"u"?typeof global>"u"?gV:global:self)});var m=w((b3)=>{var V0=l1(),h3=H5(),c0=C$(),N5=m0();kV();function _3($){var Q=null;if(V0.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return g6($,Q)}b3.newBlob=function($,Q){b3.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,V=new q;return V.append($),V.getBlob(Q)}catch(X){throw Error("Bug : can't construct the Blob.")}}};function T$($){return $}function g6($,Q){for(var q=0;q<$.length;++q)Q[q]=$.charCodeAt(q)&255;return Q}var y6={stringifyByChunk:function($,Q,q){var V=[],Y=0,X=$.length;if(X<=q)return String.fromCharCode.apply(null,$);while(Y<X){if(Q==="array"||Q==="nodebuffer")V.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+q,X))));else V.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+q,X))));Y+=q}return V.join("")},stringifyByChar:function($){var Q="";for(var q=0;q<$.length;q++)Q+=String.fromCharCode($[q]);return Q},applyCanBeUsed:{uint8array:function(){try{return V0.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return V0.nodebuffer&&String.fromCharCode.apply(null,c0.allocBuffer(1)).length===1}catch($){return!1}}()}};function F$($){var Q=65536,q=b3.getTypeOf($),V=!0;if(q==="uint8array")V=y6.applyCanBeUsed.uint8array;else if(q==="nodebuffer")V=y6.applyCanBeUsed.nodebuffer;if(V)while(Q>1)try{return y6.stringifyByChunk($,q,Q)}catch(Y){Q=Math.floor(Q/2)}return y6.stringifyByChar($)}b3.applyFromCharCode=F$;function k6($,Q){for(var q=0;q<$.length;q++)Q[q]=$[q];return Q}var J0={};J0.string={string:T$,array:function($){return g6($,Array($.length))},arraybuffer:function($){return J0.string.uint8array($).buffer},uint8array:function($){return g6($,new Uint8Array($.length))},nodebuffer:function($){return g6($,c0.allocBuffer($.length))}};J0.array={string:F$,array:T$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return c0.newBufferFrom($)}};J0.arraybuffer={string:function($){return F$(new Uint8Array($))},array:function($){return k6(new Uint8Array($),Array($.byteLength))},arraybuffer:T$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return c0.newBufferFrom(new Uint8Array($))}};J0.uint8array={string:F$,array:function($){return k6($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:T$,nodebuffer:function($){return c0.newBufferFrom($)}};J0.nodebuffer={string:F$,array:function($){return k6($,Array($.length))},arraybuffer:function($){return J0.nodebuffer.uint8array($).buffer},uint8array:function($){return k6($,new Uint8Array($.length))},nodebuffer:T$};b3.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;b3.checkSupport($);var q=b3.getTypeOf(Q),V=J0[q][$](Q);return V};b3.resolve=function($){var Q=$.split("/"),q=[];for(var V=0;V<Q.length;V++){var Y=Q[V];if(Y==="."||Y===""&&V!==0&&V!==Q.length-1)continue;else if(Y==="..")q.pop();else q.push(Y)}return q.join("/")};b3.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(V0.nodebuffer&&c0.isBuffer($))return"nodebuffer";if(V0.uint8array&&$ instanceof Uint8Array)return"uint8array";if(V0.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};b3.checkSupport=function($){var Q=V0[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};b3.MAX_VALUE_16BITS=65535;b3.MAX_VALUE_32BITS=-1;b3.pretty=function($){var Q="",q,V;for(V=0;V<($||"").length;V++)q=$.charCodeAt(V),Q+="\\x"+(q<16?"0":"")+q.toString(16).toUpperCase();return Q};b3.delay=function($,Q,q){setImmediate(function(){$.apply(q||null,Q||[])})};b3.inherits=function($,Q){var q=function(){};q.prototype=Q.prototype,$.prototype=new q};b3.extend=function(){var $={},Q,q;for(Q=0;Q<arguments.length;Q++)for(q in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],q)&&typeof $[q]>"u")$[q]=arguments[Q][q];return $};b3.prepareContent=function($,Q,q,V,Y){var X=N5.Promise.resolve(Q).then(function(J){var G=V0.blob&&(J instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(J))!==-1);if(G&&typeof FileReader<"u")return new N5.Promise(function(U,K){var W=new FileReader;W.onload=function(Z){U(Z.target.result)},W.onerror=function(Z){K(Z.target.error)},W.readAsArrayBuffer(J)});else return J});return X.then(function(J){var G=b3.getTypeOf(J);if(!G)return N5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(G==="arraybuffer")J=b3.transformTo("uint8array",J);else if(G==="string"){if(Y)J=h3.decode(J);else if(q){if(V!==!0)J=_3(J)}}return J})}});var j1=w((dH,bV)=>{function _V($){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}_V.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 q=0;q<this._listeners[$].length;q++)this._listeners[$][q].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(q){Q.processChunk(q)}),$.on("end",function(){Q.end()}),$.on("error",function(q){Q.error(q)}),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 $}};bV.exports=_V});var u0=w((e3)=>{var p0=m(),P0=l1(),r3=C$(),D6=j1(),R$=Array(256);for(y1=0;y1<256;y1++)R$[y1]=y1>=252?6:y1>=248?5:y1>=240?4:y1>=224?3:y1>=192?2:1;var y1;R$[254]=R$[254]=1;var a3=function($){var Q,q,V,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}G+=q<128?1:q<2048?2:q<65536?3:4}if(P0.uint8array)Q=new Uint8Array(G);else Q=Array(G);for(X=0,Y=0;X<G;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}if(q<128)Q[X++]=q;else if(q<2048)Q[X++]=192|q>>>6,Q[X++]=128|q&63;else if(q<65536)Q[X++]=224|q>>>12,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63;else Q[X++]=240|q>>>18,Q[X++]=128|q>>>12&63,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63}return Q},s3=function($,Q){var q;if(Q=Q||$.length,Q>$.length)Q=$.length;q=Q-1;while(q>=0&&($[q]&192)===128)q--;if(q<0)return Q;if(q===0)return Q;return q+R$[$[q]]>Q?q:Q},t3=function($){var Q,q,V,Y,X=$.length,J=Array(X*2);for(q=0,Q=0;Q<X;){if(V=$[Q++],V<128){J[q++]=V;continue}if(Y=R$[V],Y>4){J[q++]=65533,Q+=Y-1;continue}V&=Y===2?31:Y===3?15:7;while(Y>1&&Q<X)V=V<<6|$[Q++]&63,Y--;if(Y>1){J[q++]=65533;continue}if(V<65536)J[q++]=V;else V-=65536,J[q++]=55296|V>>10&1023,J[q++]=56320|V&1023}if(J.length!==q)if(J.subarray)J=J.subarray(0,q);else J.length=q;return p0.applyFromCharCode(J)};e3.utf8encode=function(Q){if(P0.nodebuffer)return r3.newBufferFrom(Q,"utf-8");return a3(Q)};e3.utf8decode=function(Q){if(P0.nodebuffer)return p0.transformTo("nodebuffer",Q).toString("utf-8");return Q=p0.transformTo(P0.uint8array?"uint8array":"array",Q),t3(Q)};function h6(){D6.call(this,"utf-8 decode"),this.leftOver=null}p0.inherits(h6,D6);h6.prototype.processChunk=function($){var Q=p0.transformTo(P0.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(P0.uint8array){var q=Q;Q=new Uint8Array(q.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(q,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var V=s3(Q),Y=Q;if(V!==Q.length)if(P0.uint8array)Y=Q.subarray(0,V),this.leftOver=Q.subarray(V,Q.length);else Y=Q.slice(0,V),this.leftOver=Q.slice(V,Q.length);this.push({data:e3.utf8decode(Y),meta:$.meta})};h6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:e3.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};e3.Utf8DecodeWorker=h6;function I5(){D6.call(this,"utf-8 encode")}p0.inherits(I5,D6);I5.prototype.processChunk=function($){this.push({data:e3.utf8encode($.data),meta:$.meta})};e3.Utf8EncodeWorker=I5});var uV=w((oH,pV)=>{var mV=j1(),cV=m();function w5($){mV.call(this,"ConvertWorker to "+$),this.destType=$}cV.inherits(w5,mV);w5.prototype.processChunk=function($){this.push({data:cV.transformTo(this.destType,$.data),meta:$.meta})};pV.exports=w5});var oV=w((iH,lV)=>{var dV=j5().Readable,qG=m();qG.inherits(A5,dV);function A5($,Q,q){dV.call(this,Q),this._helper=$;var V=this;$.on("data",function(Y,X){if(!V.push(Y))V._helper.pause();if(q)q(X)}).on("error",function(Y){V.emit("error",Y)}).on("end",function(){V.push(null)})}A5.prototype._read=function(){this._helper.resume()};lV.exports=A5});var T5=w((nH,rV)=>{var L0=m(),VG=uV(),JG=j1(),YG=H5(),XG=l1(),GG=m0(),iV=null;if(XG.nodestream)try{iV=oV()}catch($){}function KG($,Q,q){switch($){case"blob":return L0.newBlob(L0.transformTo("arraybuffer",Q),q);case"base64":return YG.encode(Q);default:return L0.transformTo($,Q)}}function WG($,Q){var q,V=0,Y=null,X=0;for(q=0;q<Q.length;q++)X+=Q[q].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(X);for(q=0;q<Q.length;q++)Y.set(Q[q],V),V+=Q[q].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function UG($,Q){return new GG.Promise(function(q,V){var Y=[],X=$._internalType,J=$._outputType,G=$._mimeType;$.on("data",function(U,K){if(Y.push(U),Q)Q(K)}).on("error",function(U){Y=[],V(U)}).on("end",function(){try{var U=KG(J,WG(X,Y),G);q(U)}catch(K){V(K)}Y=[]}).resume()})}function nV($,Q,q){var V=Q;switch(Q){case"blob":case"arraybuffer":V="uint8array";break;case"base64":V="string";break}try{this._internalType=V,this._outputType=Q,this._mimeType=q,L0.checkSupport(V),this._worker=$.pipe(new VG(V)),$.lock()}catch(Y){this._worker=new JG("error"),this._worker.error(Y)}}nV.prototype={accumulate:function($){return UG(this,$)},on:function($,Q){var q=this;if($==="data")this._worker.on($,function(V){Q.call(q,V.data,V.meta)});else this._worker.on($,function(){L0.delay(Q,arguments,q)});return this},resume:function(){return L0.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(L0.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new iV(this,{objectMode:this._outputType!=="nodebuffer"},$)}};rV.exports=nV});var F5=w((jG)=>{jG.base64=!1;jG.binary=!1;jG.dir=!1;jG.createFolders=!0;jG.date=null;jG.compression=null;jG.compressionOptions=null;jG.comment=null;jG.unixPermissions=null;jG.dosPermissions=null});var R5=w((aH,aV)=>{var _6=m(),b6=j1(),CG=16384;function d0($){b6.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(q){if(Q.dataIsReady=!0,Q.data=q,Q.max=q&&q.length||0,Q.type=_6.getTypeOf(q),!Q.isPaused)Q._tickAndRepeat()},function(q){Q.error(q)})}_6.inherits(d0,b6);d0.prototype.cleanUp=function(){b6.prototype.cleanUp.call(this),this.data=null};d0.prototype.resume=function(){if(!b6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,_6.delay(this._tickAndRepeat,[],this);return!0};d0.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)_6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};d0.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=CG,Q=null,q=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,q);break;case"uint8array":Q=this.data.subarray(this.index,q);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,q);break}return this.index=q,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};aV.exports=d0});var f6=w((sH,tV)=>{var wG=m();function AG(){var $,Q=[];for(var q=0;q<256;q++){$=q;for(var V=0;V<8;V++)$=$&1?3988292384^$>>>1:$>>>1;Q[q]=$}return Q}var sV=AG();function TG($,Q,q,V){var Y=sV,X=V+q;$=$^-1;for(var J=V;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}function FG($,Q,q,V){var Y=sV,X=V+q;$=$^-1;for(var J=V;J<X;J++)$=$>>>8^Y[($^Q.charCodeAt(J))&255];return $^-1}tV.exports=function(Q,q){if(typeof Q>"u"||!Q.length)return 0;var V=wG.getTypeOf(Q)!=="string";if(V)return TG(q|0,Q,Q.length,0);else return FG(q|0,Q,Q.length,0)}});var x5=w((tH,$9)=>{var eV=j1(),RG=f6(),vG=m();function v5(){eV.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}vG.inherits(v5,eV);v5.prototype.processChunk=function($){this.streamInfo.crc32=RG($.data,this.streamInfo.crc32||0),this.push($)};$9.exports=v5});var q9=w((eH,Q9)=>{var xG=m(),S5=j1();function E5($){S5.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}xG.inherits(E5,S5);E5.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}S5.prototype.processChunk.call(this,$)};Q9.exports=E5});var m6=w(($P,Y9)=>{var V9=m0(),J9=R5(),SG=x5(),y5=q9();function g5($,Q,q,V,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=q,this.compression=V,this.compressedContent=Y}g5.prototype={getContentWorker:function(){var $=new J9(V9.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new y5("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 J9(V9.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};g5.createWorkerFrom=function($,Q,q){return $.pipe(new SG).pipe(new y5("uncompressedSize")).pipe(Q.compressWorker(q)).pipe(new y5("compressedSize")).withStreamInfo("compression",Q)};Y9.exports=g5});var W9=w((QP,K9)=>{var EG=T5(),yG=R5(),k5=u0(),D5=m6(),X9=j1(),h5=function($,Q,q){this.name=$,this.dir=q.dir,this.date=q.date,this.comment=q.comment,this.unixPermissions=q.unixPermissions,this.dosPermissions=q.dosPermissions,this._data=Q,this._dataBinary=q.binary,this.options={compression:q.compression,compressionOptions:q.compressionOptions}};h5.prototype={internalStream:function($){var Q=null,q="string";try{if(!$)throw Error("No output type specified.");q=$.toLowerCase();var V=q==="string"||q==="text";if(q==="binarystring"||q==="text")q="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!V)Q=Q.pipe(new k5.Utf8EncodeWorker);if(!Y&&V)Q=Q.pipe(new k5.Utf8DecodeWorker)}catch(X){Q=new X9("error"),Q.error(X)}return new EG(Q,q,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof D5&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var q=this._decompressWorker();if(!this._dataBinary)q=q.pipe(new k5.Utf8EncodeWorker);return D5.createWorkerFrom(q,$,Q)}},_decompressWorker:function(){if(this._data instanceof D5)return this._data.getContentWorker();else if(this._data instanceof X9)return this._data;else return new yG(this._data)}};var G9=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],gG=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(v$=0;v$<G9.length;v$++)h5.prototype[G9[v$]]=gG;var v$;K9.exports=h5});var o1=w((_5)=>{var _G=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function bG($,Q){return Object.prototype.hasOwnProperty.call($,Q)}_5.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var q=Q.shift();if(!q)continue;if(typeof q!=="object")throw TypeError(q+"must be non-object");for(var V in q)if(bG(q,V))$[V]=q[V]}return $};_5.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var fG={arraySet:function($,Q,q,V,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(q,q+V),Y);return}for(var X=0;X<V;X++)$[Y+X]=Q[q+X]},flattenChunks:function($){var Q,q,V,Y,X,J;V=0;for(Q=0,q=$.length;Q<q;Q++)V+=$[Q].length;J=new Uint8Array(V),Y=0;for(Q=0,q=$.length;Q<q;Q++)X=$[Q],J.set(X,Y),Y+=X.length;return J}},mG={arraySet:function($,Q,q,V,Y){for(var X=0;X<V;X++)$[Y+X]=Q[q+X]},flattenChunks:function($){return[].concat.apply([],$)}};_5.setTyped=function($){if($)_5.Buf8=Uint8Array,_5.Buf16=Uint16Array,_5.Buf32=Int32Array,_5.assign(_5,fG);else _5.Buf8=Array,_5.Buf16=Array,_5.Buf32=Array,_5.assign(_5,mG)};_5.setTyped(_G)});var g9=w((WK)=>{var pG=o1(),uG=4,j9=0,Z9=1,dG=2;function o0($){var Q=$.length;while(--Q>=0)$[Q]=0}var lG=0,B9=1,oG=2,iG=3,nG=258,l5=29,k$=256,S$=k$+1+l5,l0=30,o5=19,N9=2*S$+1,O0=15,f5=16,rG=7,i5=256,M9=16,I9=17,C9=18,u5=[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],c6=[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],aG=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],w9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],sG=512,i1=Array((S$+2)*2);o0(i1);var x$=Array(l0*2);o0(x$);var E$=Array(sG);o0(E$);var y$=Array(nG-iG+1);o0(y$);var n5=Array(l5);o0(n5);var p6=Array(l0);o0(p6);function m5($,Q,q,V,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=q,this.elems=V,this.max_length=Y,this.has_stree=$&&$.length}var A9,T9,F9;function c5($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function R9($){return $<256?E$[$]:E$[256+($>>>7)]}function g$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function G1($,Q,q){if($.bi_valid>f5-q)$.bi_buf|=Q<<$.bi_valid&65535,g$($,$.bi_buf),$.bi_buf=Q>>f5-$.bi_valid,$.bi_valid+=q-f5;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=q}function g1($,Q,q){G1($,q[Q*2],q[Q*2+1])}function v9($,Q){var q=0;do q|=$&1,$>>>=1,q<<=1;while(--Q>0);return q>>>1}function tG($){if($.bi_valid===16)g$($,$.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 eG($,Q){var{dyn_tree:q,max_code:V}=Q,Y=Q.stat_desc.static_tree,X=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,G=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,K,W,Z,z,H,C,P=0;for(z=0;z<=O0;z++)$.bl_count[z]=0;q[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<N9;K++){if(W=$.heap[K],z=q[q[W*2+1]*2+1]+1,z>U)z=U,P++;if(q[W*2+1]=z,W>V)continue;if($.bl_count[z]++,H=0,W>=G)H=J[W-G];if(C=q[W*2],$.opt_len+=C*(z+H),X)$.static_len+=C*(Y[W*2+1]+H)}if(P===0)return;do{z=U-1;while($.bl_count[z]===0)z--;$.bl_count[z]--,$.bl_count[z+1]+=2,$.bl_count[U]--,P-=2}while(P>0);for(z=U;z!==0;z--){W=$.bl_count[z];while(W!==0){if(Z=$.heap[--K],Z>V)continue;if(q[Z*2+1]!==z)$.opt_len+=(z-q[Z*2+1])*q[Z*2],q[Z*2+1]=z;W--}}}function x9($,Q,q){var V=Array(O0+1),Y=0,X,J;for(X=1;X<=O0;X++)V[X]=Y=Y+q[X-1]<<1;for(J=0;J<=Q;J++){var G=$[J*2+1];if(G===0)continue;$[J*2]=v9(V[G]++,G)}}function $K(){var $,Q,q,V,Y,X=Array(O0+1);q=0;for(V=0;V<l5-1;V++){n5[V]=q;for($=0;$<1<<u5[V];$++)y$[q++]=V}y$[q-1]=V,Y=0;for(V=0;V<16;V++){p6[V]=Y;for($=0;$<1<<c6[V];$++)E$[Y++]=V}Y>>=7;for(;V<l0;V++){p6[V]=Y<<7;for($=0;$<1<<c6[V]-7;$++)E$[256+Y++]=V}for(Q=0;Q<=O0;Q++)X[Q]=0;$=0;while($<=143)i1[$*2+1]=8,$++,X[8]++;while($<=255)i1[$*2+1]=9,$++,X[9]++;while($<=279)i1[$*2+1]=7,$++,X[7]++;while($<=287)i1[$*2+1]=8,$++,X[8]++;x9(i1,S$+1,X);for($=0;$<l0;$++)x$[$*2+1]=5,x$[$*2]=v9($,5);A9=new m5(i1,u5,k$+1,S$,O0),T9=new m5(x$,c6,0,l0,O0),F9=new m5([],aG,0,o5,rG)}function S9($){var Q;for(Q=0;Q<S$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<l0;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<o5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[i5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function E9($){if($.bi_valid>8)g$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function QK($,Q,q,V){if(E9($),V)g$($,q),g$($,~q);pG.arraySet($.pending_buf,$.window,Q,q,$.pending),$.pending+=q}function z9($,Q,q,V){var Y=Q*2,X=q*2;return $[Y]<$[X]||$[Y]===$[X]&&V[Q]<=V[q]}function p5($,Q,q){var V=$.heap[q],Y=q<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&z9(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(z9(Q,V,$.heap[Y],$.depth))break;$.heap[q]=$.heap[Y],q=Y,Y<<=1}$.heap[q]=V}function H9($,Q,q){var V,Y,X=0,J,G;if($.last_lit!==0)do if(V=$.pending_buf[$.d_buf+X*2]<<8|$.pending_buf[$.d_buf+X*2+1],Y=$.pending_buf[$.l_buf+X],X++,V===0)g1($,Y,Q);else{if(J=y$[Y],g1($,J+k$+1,Q),G=u5[J],G!==0)Y-=n5[J],G1($,Y,G);if(V--,J=R9(V),g1($,J,q),G=c6[J],G!==0)V-=p6[J],G1($,V,G)}while(X<$.last_lit);g1($,i5,Q)}function d5($,Q){var q=Q.dyn_tree,V=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,X=Q.stat_desc.elems,J,G,U=-1,K;$.heap_len=0,$.heap_max=N9;for(J=0;J<X;J++)if(q[J*2]!==0)$.heap[++$.heap_len]=U=J,$.depth[J]=0;else q[J*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=U<2?++U:0,q[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=V[K*2+1];Q.max_code=U;for(J=$.heap_len>>1;J>=1;J--)p5($,q,J);K=X;do J=$.heap[1],$.heap[1]=$.heap[$.heap_len--],p5($,q,1),G=$.heap[1],$.heap[--$.heap_max]=J,$.heap[--$.heap_max]=G,q[K*2]=q[J*2]+q[G*2],$.depth[K]=($.depth[J]>=$.depth[G]?$.depth[J]:$.depth[G])+1,q[J*2+1]=q[G*2+1]=K,$.heap[1]=K++,p5($,q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],eG($,Q),x9(q,U,$.bl_count)}function P9($,Q,q){var V,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;Q[(q+1)*2+1]=65535;for(V=0;V<=q;V++){if(X=J,J=Q[(V+1)*2+1],++G<U&&X===J)continue;else if(G<K)$.bl_tree[X*2]+=G;else if(X!==0){if(X!==Y)$.bl_tree[X*2]++;$.bl_tree[M9*2]++}else if(G<=10)$.bl_tree[I9*2]++;else $.bl_tree[C9*2]++;if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function L9($,Q,q){var V,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;for(V=0;V<=q;V++){if(X=J,J=Q[(V+1)*2+1],++G<U&&X===J)continue;else if(G<K)do g1($,X,$.bl_tree);while(--G!==0);else if(X!==0){if(X!==Y)g1($,X,$.bl_tree),G--;g1($,M9,$.bl_tree),G1($,G-3,2)}else if(G<=10)g1($,I9,$.bl_tree),G1($,G-3,3);else g1($,C9,$.bl_tree),G1($,G-11,7);if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function qK($){var Q;P9($,$.dyn_ltree,$.l_desc.max_code),P9($,$.dyn_dtree,$.d_desc.max_code),d5($,$.bl_desc);for(Q=o5-1;Q>=3;Q--)if($.bl_tree[w9[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function VK($,Q,q,V){var Y;G1($,Q-257,5),G1($,q-1,5),G1($,V-4,4);for(Y=0;Y<V;Y++)G1($,$.bl_tree[w9[Y]*2+1],3);L9($,$.dyn_ltree,Q-1),L9($,$.dyn_dtree,q-1)}function JK($){var Q=4093624447,q;for(q=0;q<=31;q++,Q>>>=1)if(Q&1&&$.dyn_ltree[q*2]!==0)return j9;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return Z9;for(q=32;q<k$;q++)if($.dyn_ltree[q*2]!==0)return Z9;return j9}var O9=!1;function YK($){if(!O9)$K(),O9=!0;$.l_desc=new c5($.dyn_ltree,A9),$.d_desc=new c5($.dyn_dtree,T9),$.bl_desc=new c5($.bl_tree,F9),$.bi_buf=0,$.bi_valid=0,S9($)}function y9($,Q,q,V){G1($,(lG<<1)+(V?1:0),3),QK($,Q,q,!0)}function XK($){G1($,B9<<1,3),g1($,i5,i1),tG($)}function GK($,Q,q,V){var Y,X,J=0;if($.level>0){if($.strm.data_type===dG)$.strm.data_type=JK($);if(d5($,$.l_desc),d5($,$.d_desc),J=qK($),Y=$.opt_len+3+7>>>3,X=$.static_len+3+7>>>3,X<=Y)Y=X}else Y=X=q+5;if(q+4<=Y&&Q!==-1)y9($,Q,q,V);else if($.strategy===uG||X===Y)G1($,(B9<<1)+(V?1:0),3),H9($,i1,x$);else G1($,(oG<<1)+(V?1:0),3),VK($,$.l_desc.max_code+1,$.d_desc.max_code+1,J+1),H9($,$.dyn_ltree,$.dyn_dtree);if(S9($),V)E9($)}function KK($,Q,q){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]=q&255,$.last_lit++,Q===0)$.dyn_ltree[q*2]++;else $.matches++,Q--,$.dyn_ltree[(y$[q]+k$+1)*2]++,$.dyn_dtree[R9(Q)*2]++;return $.last_lit===$.lit_bufsize-1}WK._tr_init=YK;WK._tr_stored_block=y9;WK._tr_flush_block=GK;WK._tr_tally=KK;WK._tr_align=XK});var r5=w((JP,k9)=>{function PK($,Q,q,V){var Y=$&65535|0,X=$>>>16&65535|0,J=0;while(q!==0){J=q>2000?2000:q,q-=J;do Y=Y+Q[V++]|0,X=X+Y|0;while(--J);Y%=65521,X%=65521}return Y|X<<16|0}k9.exports=PK});var a5=w((YP,D9)=>{function LK(){var $,Q=[];for(var q=0;q<256;q++){$=q;for(var V=0;V<8;V++)$=$&1?3988292384^$>>>1:$>>>1;Q[q]=$}return Q}var OK=LK();function BK($,Q,q,V){var Y=OK,X=V+q;$^=-1;for(var J=V;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}D9.exports=BK});var u6=w((XP,h9)=>{h9.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 l9=w((sK)=>{var Y1=o1(),H1=g9(),m9=r5(),Y0=a5(),NK=u6(),I0=0,MK=1,IK=3,U0=4,_9=5,D1=0,b9=1,P1=-2,CK=-3,s5=-5,wK=-1,AK=1,d6=2,TK=3,FK=4,RK=0,vK=2,n6=8,xK=9,SK=15,EK=8,yK=29,gK=256,e5=gK+1+yK,kK=30,DK=19,hK=2*e5+1,_K=15,S=3,K0=258,F1=K0+S+1,bK=32,r6=42,$Q=69,l6=73,o6=91,i6=103,B0=113,h$=666,n=1,_$=2,N0=3,r0=4,fK=3;function W0($,Q){return $.msg=NK[Q],Q}function f9($){return($<<1)-($>4?9:0)}function G0($){var Q=$.length;while(--Q>=0)$[Q]=0}function X0($){var Q=$.state,q=Q.pending;if(q>$.avail_out)q=$.avail_out;if(q===0)return;if(Y1.arraySet($.output,Q.pending_buf,Q.pending_out,q,$.next_out),$.next_out+=q,Q.pending_out+=q,$.total_out+=q,$.avail_out-=q,Q.pending-=q,Q.pending===0)Q.pending_out=0}function s($,Q){H1._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,X0($.strm)}function E($,Q){$.pending_buf[$.pending++]=Q}function D$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function mK($,Q,q,V){var Y=$.avail_in;if(Y>V)Y=V;if(Y===0)return 0;if($.avail_in-=Y,Y1.arraySet(Q,$.input,$.next_in,Y,q),$.state.wrap===1)$.adler=m9($.adler,Q,Y,q);else if($.state.wrap===2)$.adler=Y0($.adler,Q,Y,q);return $.next_in+=Y,$.total_in+=Y,Y}function c9($,Q){var{max_chain_length:q,strstart:V}=$,Y,X,J=$.prev_length,G=$.nice_match,U=$.strstart>$.w_size-F1?$.strstart-($.w_size-F1):0,K=$.window,W=$.w_mask,Z=$.prev,z=$.strstart+K0,H=K[V+J-1],C=K[V+J];if($.prev_length>=$.good_match)q>>=2;if(G>$.lookahead)G=$.lookahead;do{if(Y=Q,K[Y+J]!==C||K[Y+J-1]!==H||K[Y]!==K[V]||K[++Y]!==K[V+1])continue;V+=2,Y++;do;while(K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&V<z);if(X=K0-(z-V),V=z-K0,X>J){if($.match_start=Q,J=X,X>=G)break;H=K[V+J-1],C=K[V+J]}}while((Q=Z[Q&W])>U&&--q!==0);if(J<=$.lookahead)return J;return $.lookahead}function M0($){var Q=$.w_size,q,V,Y,X,J;do{if(X=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-F1)){Y1.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,V=$.hash_size,q=V;do Y=$.head[--q],$.head[q]=Y>=Q?Y-Q:0;while(--V);V=Q,q=V;do Y=$.prev[--q],$.prev[q]=Y>=Q?Y-Q:0;while(--V);X+=Q}if($.strm.avail_in===0)break;if(V=mK($.strm,$.window,$.strstart+$.lookahead,X),$.lookahead+=V,$.lookahead+$.insert>=S){J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[J+S-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,$.lookahead+$.insert<S)break}}while($.lookahead<F1&&$.strm.avail_in!==0)}function cK($,Q){var q=65535;if(q>$.pending_buf_size-5)q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(M0($),$.lookahead===0&&Q===I0)return n;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var V=$.block_start+q;if($.strstart===0||$.strstart>=V){if($.lookahead=$.strstart-V,$.strstart=V,s($,!1),$.strm.avail_out===0)return n}if($.strstart-$.block_start>=$.w_size-F1){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return r0}if($.strstart>$.block_start){if(s($,!1),$.strm.avail_out===0)return n}return n}function t5($,Q){var q,V;for(;;){if($.lookahead<F1){if(M0($),$.lookahead<F1&&Q===I0)return n;if($.lookahead===0)break}if(q=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(q!==0&&$.strstart-q<=$.w_size-F1)$.match_length=c9($,q);if($.match_length>=S)if(V=H1._tr_tally($,$.strstart-$.match_start,$.match_length-S),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=S){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.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 V=H1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=$.strstart<S-1?$.strstart:S-1,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return r0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function i0($,Q){var q,V,Y;for(;;){if($.lookahead<F1){if(M0($),$.lookahead<F1&&Q===I0)return n;if($.lookahead===0)break}if(q=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=S-1,q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-q<=$.w_size-F1){if($.match_length=c9($,q),$.match_length<=5&&($.strategy===AK||$.match_length===S&&$.strstart-$.match_start>4096))$.match_length=S-1}if($.prev_length>=S&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-S,V=H1._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-S),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=S-1,$.strstart++,V){if(s($,!1),$.strm.avail_out===0)return n}}else if($.match_available){if(V=H1._tr_tally($,0,$.window[$.strstart-1]),V)s($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return n}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)V=H1._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<S-1?$.strstart:S-1,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return r0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function pK($,Q){var q,V,Y,X,J=$.window;for(;;){if($.lookahead<=K0){if(M0($),$.lookahead<=K0&&Q===I0)return n;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=S&&$.strstart>0){if(Y=$.strstart-1,V=J[Y],V===J[++Y]&&V===J[++Y]&&V===J[++Y]){X=$.strstart+K0;do;while(V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&Y<X);if($.match_length=K0-(X-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=S)q=H1._tr_tally($,1,$.match_length-S),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else q=H1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return r0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function uK($,Q){var q;for(;;){if($.lookahead===0){if(M0($),$.lookahead===0){if(Q===I0)return n;break}}if($.match_length=0,q=H1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return r0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function k1($,Q,q,V,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=q,this.max_chain=V,this.func=Y}var n0;n0=[new k1(0,0,0,0,cK),new k1(4,4,8,4,t5),new k1(4,5,16,8,t5),new k1(4,6,32,32,t5),new k1(4,4,16,16,i0),new k1(8,16,32,32,i0),new k1(8,16,128,128,i0),new k1(8,32,128,256,i0),new k1(32,128,258,1024,i0),new k1(32,258,258,4096,i0)];function dK($){$.window_size=2*$.w_size,G0($.head),$.max_lazy_match=n0[$.level].max_lazy,$.good_match=n0[$.level].good_length,$.nice_match=n0[$.level].nice_length,$.max_chain_length=n0[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=S-1,$.match_available=0,$.ins_h=0}function lK(){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=n6,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Y1.Buf16(hK*2),this.dyn_dtree=new Y1.Buf16((2*kK+1)*2),this.bl_tree=new Y1.Buf16((2*DK+1)*2),G0(this.dyn_ltree),G0(this.dyn_dtree),G0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Y1.Buf16(_K+1),this.heap=new Y1.Buf16(2*e5+1),G0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Y1.Buf16(2*e5+1),G0(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 p9($){var Q;if(!$||!$.state)return W0($,P1);if($.total_in=$.total_out=0,$.data_type=vK,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?r6:B0,$.adler=Q.wrap===2?0:1,Q.last_flush=I0,H1._tr_init(Q),D1}function u9($){var Q=p9($);if(Q===D1)dK($.state);return Q}function oK($,Q){if(!$||!$.state)return P1;if($.state.wrap!==2)return P1;return $.state.gzhead=Q,D1}function d9($,Q,q,V,Y,X){if(!$)return P1;var J=1;if(Q===wK)Q=6;if(V<0)J=0,V=-V;else if(V>15)J=2,V-=16;if(Y<1||Y>xK||q!==n6||V<8||V>15||Q<0||Q>9||X<0||X>FK)return W0($,P1);if(V===8)V=9;var G=new lK;return $.state=G,G.strm=$,G.wrap=J,G.gzhead=null,G.w_bits=V,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=Y+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+S-1)/S),G.window=new Y1.Buf8(G.w_size*2),G.head=new Y1.Buf16(G.hash_size),G.prev=new Y1.Buf16(G.w_size),G.lit_bufsize=1<<Y+6,G.pending_buf_size=G.lit_bufsize*4,G.pending_buf=new Y1.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=Q,G.strategy=X,G.method=q,u9($)}function iK($,Q){return d9($,Q,n6,SK,EK,RK)}function nK($,Q){var q,V,Y,X;if(!$||!$.state||Q>_9||Q<0)return $?W0($,P1):P1;if(V=$.state,!$.output||!$.input&&$.avail_in!==0||V.status===h$&&Q!==U0)return W0($,$.avail_out===0?s5:P1);if(V.strm=$,q=V.last_flush,V.last_flush=Q,V.status===r6)if(V.wrap===2)if($.adler=0,E(V,31),E(V,139),E(V,8),!V.gzhead)E(V,0),E(V,0),E(V,0),E(V,0),E(V,0),E(V,V.level===9?2:V.strategy>=d6||V.level<2?4:0),E(V,fK),V.status=B0;else{if(E(V,(V.gzhead.text?1:0)+(V.gzhead.hcrc?2:0)+(!V.gzhead.extra?0:4)+(!V.gzhead.name?0:8)+(!V.gzhead.comment?0:16)),E(V,V.gzhead.time&255),E(V,V.gzhead.time>>8&255),E(V,V.gzhead.time>>16&255),E(V,V.gzhead.time>>24&255),E(V,V.level===9?2:V.strategy>=d6||V.level<2?4:0),E(V,V.gzhead.os&255),V.gzhead.extra&&V.gzhead.extra.length)E(V,V.gzhead.extra.length&255),E(V,V.gzhead.extra.length>>8&255);if(V.gzhead.hcrc)$.adler=Y0($.adler,V.pending_buf,V.pending,0);V.gzindex=0,V.status=$Q}else{var J=n6+(V.w_bits-8<<4)<<8,G=-1;if(V.strategy>=d6||V.level<2)G=0;else if(V.level<6)G=1;else if(V.level===6)G=2;else G=3;if(J|=G<<6,V.strstart!==0)J|=bK;if(J+=31-J%31,V.status=B0,D$(V,J),V.strstart!==0)D$(V,$.adler>>>16),D$(V,$.adler&65535);$.adler=1}if(V.status===$Q)if(V.gzhead.extra){Y=V.pending;while(V.gzindex<(V.gzhead.extra.length&65535)){if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X0($),Y=V.pending,V.pending===V.pending_buf_size)break}E(V,V.gzhead.extra[V.gzindex]&255),V.gzindex++}if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(V.gzindex===V.gzhead.extra.length)V.gzindex=0,V.status=l6}else V.status=l6;if(V.status===l6)if(V.gzhead.name){Y=V.pending;do{if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X0($),Y=V.pending,V.pending===V.pending_buf_size){X=1;break}}if(V.gzindex<V.gzhead.name.length)X=V.gzhead.name.charCodeAt(V.gzindex++)&255;else X=0;E(V,X)}while(X!==0);if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X===0)V.gzindex=0,V.status=o6}else V.status=o6;if(V.status===o6)if(V.gzhead.comment){Y=V.pending;do{if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X0($),Y=V.pending,V.pending===V.pending_buf_size){X=1;break}}if(V.gzindex<V.gzhead.comment.length)X=V.gzhead.comment.charCodeAt(V.gzindex++)&255;else X=0;E(V,X)}while(X!==0);if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X===0)V.status=i6}else V.status=i6;if(V.status===i6)if(V.gzhead.hcrc){if(V.pending+2>V.pending_buf_size)X0($);if(V.pending+2<=V.pending_buf_size)E(V,$.adler&255),E(V,$.adler>>8&255),$.adler=0,V.status=B0}else V.status=B0;if(V.pending!==0){if(X0($),$.avail_out===0)return V.last_flush=-1,D1}else if($.avail_in===0&&f9(Q)<=f9(q)&&Q!==U0)return W0($,s5);if(V.status===h$&&$.avail_in!==0)return W0($,s5);if($.avail_in!==0||V.lookahead!==0||Q!==I0&&V.status!==h$){var U=V.strategy===d6?uK(V,Q):V.strategy===TK?pK(V,Q):n0[V.level].func(V,Q);if(U===N0||U===r0)V.status=h$;if(U===n||U===N0){if($.avail_out===0)V.last_flush=-1;return D1}if(U===_$){if(Q===MK)H1._tr_align(V);else if(Q!==_9){if(H1._tr_stored_block(V,0,0,!1),Q===IK){if(G0(V.head),V.lookahead===0)V.strstart=0,V.block_start=0,V.insert=0}}if(X0($),$.avail_out===0)return V.last_flush=-1,D1}}if(Q!==U0)return D1;if(V.wrap<=0)return b9;if(V.wrap===2)E(V,$.adler&255),E(V,$.adler>>8&255),E(V,$.adler>>16&255),E(V,$.adler>>24&255),E(V,$.total_in&255),E(V,$.total_in>>8&255),E(V,$.total_in>>16&255),E(V,$.total_in>>24&255);else D$(V,$.adler>>>16),D$(V,$.adler&65535);if(X0($),V.wrap>0)V.wrap=-V.wrap;return V.pending!==0?D1:b9}function rK($){var Q;if(!$||!$.state)return P1;if(Q=$.state.status,Q!==r6&&Q!==$Q&&Q!==l6&&Q!==o6&&Q!==i6&&Q!==B0&&Q!==h$)return W0($,P1);return $.state=null,Q===B0?W0($,CK):D1}function aK($,Q){var q=Q.length,V,Y,X,J,G,U,K,W;if(!$||!$.state)return P1;if(V=$.state,J=V.wrap,J===2||J===1&&V.status!==r6||V.lookahead)return P1;if(J===1)$.adler=m9($.adler,Q,q,0);if(V.wrap=0,q>=V.w_size){if(J===0)G0(V.head),V.strstart=0,V.block_start=0,V.insert=0;W=new Y1.Buf8(V.w_size),Y1.arraySet(W,Q,q-V.w_size,V.w_size,0),Q=W,q=V.w_size}G=$.avail_in,U=$.next_in,K=$.input,$.avail_in=q,$.next_in=0,$.input=Q,M0(V);while(V.lookahead>=S){Y=V.strstart,X=V.lookahead-(S-1);do V.ins_h=(V.ins_h<<V.hash_shift^V.window[Y+S-1])&V.hash_mask,V.prev[Y&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=Y,Y++;while(--X);V.strstart=Y,V.lookahead=S-1,M0(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=S-1,V.match_available=0,$.next_in=U,$.input=K,$.avail_in=G,V.wrap=J,D1}sK.deflateInit=iK;sK.deflateInit2=d9;sK.deflateReset=u9;sK.deflateResetKeep=p9;sK.deflateSetHeader=oK;sK.deflate=nK;sK.deflateEnd=rK;sK.deflateSetDictionary=aK;sK.deflateInfo="pako deflate (from Nodeca project)"});var QQ=w((GW)=>{var a6=o1(),o9=!0,i9=!0;try{String.fromCharCode.apply(null,[0])}catch($){o9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){i9=!1}var b$=new a6.Buf8(256);for(h1=0;h1<256;h1++)b$[h1]=h1>=252?6:h1>=248?5:h1>=240?4:h1>=224?3:h1>=192?2:1;var h1;b$[254]=b$[254]=1;GW.string2buf=function($){var Q,q,V,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}G+=q<128?1:q<2048?2:q<65536?3:4}Q=new a6.Buf8(G);for(X=0,Y=0;X<G;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}if(q<128)Q[X++]=q;else if(q<2048)Q[X++]=192|q>>>6,Q[X++]=128|q&63;else if(q<65536)Q[X++]=224|q>>>12,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63;else Q[X++]=240|q>>>18,Q[X++]=128|q>>>12&63,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63}return Q};function n9($,Q){if(Q<65534){if($.subarray&&i9||!$.subarray&&o9)return String.fromCharCode.apply(null,a6.shrinkBuf($,Q))}var q="";for(var V=0;V<Q;V++)q+=String.fromCharCode($[V]);return q}GW.buf2binstring=function($){return n9($,$.length)};GW.binstring2buf=function($){var Q=new a6.Buf8($.length);for(var q=0,V=Q.length;q<V;q++)Q[q]=$.charCodeAt(q);return Q};GW.buf2string=function($,Q){var q,V,Y,X,J=Q||$.length,G=Array(J*2);for(V=0,q=0;q<J;){if(Y=$[q++],Y<128){G[V++]=Y;continue}if(X=b$[Y],X>4){G[V++]=65533,q+=X-1;continue}Y&=X===2?31:X===3?15:7;while(X>1&&q<J)Y=Y<<6|$[q++]&63,X--;if(X>1){G[V++]=65533;continue}if(Y<65536)G[V++]=Y;else Y-=65536,G[V++]=55296|Y>>10&1023,G[V++]=56320|Y&1023}return n9(G,V)};GW.utf8border=function($,Q){var q;if(Q=Q||$.length,Q>$.length)Q=$.length;q=Q-1;while(q>=0&&($[q]&192)===128)q--;if(q<0)return Q;if(q===0)return Q;return q+b$[$[q]]>Q?q:Q}});var qQ=w((WP,r9)=>{function zW(){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}r9.exports=zW});var e9=w((IW)=>{var f$=l9(),m$=o1(),JQ=QQ(),YQ=u6(),HW=qQ(),t9=Object.prototype.toString,PW=0,VQ=4,a0=0,a9=1,s9=2,LW=-1,OW=0,BW=8;function C0($){if(!(this instanceof C0))return new C0($);this.options=m$.assign({level:LW,method:BW,chunkSize:16384,windowBits:15,memLevel:8,strategy:OW,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 HW,this.strm.avail_out=0;var q=f$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(q!==a0)throw Error(YQ[q]);if(Q.header)f$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var V;if(typeof Q.dictionary==="string")V=JQ.string2buf(Q.dictionary);else if(t9.call(Q.dictionary)==="[object ArrayBuffer]")V=new Uint8Array(Q.dictionary);else V=Q.dictionary;if(q=f$.deflateSetDictionary(this.strm,V),q!==a0)throw Error(YQ[q]);this._dict_set=!0}}C0.prototype.push=function($,Q){var q=this.strm,V=this.options.chunkSize,Y,X;if(this.ended)return!1;if(X=Q===~~Q?Q:Q===!0?VQ:PW,typeof $==="string")q.input=JQ.string2buf($);else if(t9.call($)==="[object ArrayBuffer]")q.input=new Uint8Array($);else q.input=$;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new m$.Buf8(V),q.next_out=0,q.avail_out=V;if(Y=f$.deflate(q,X),Y!==a9&&Y!==a0)return this.onEnd(Y),this.ended=!0,!1;if(q.avail_out===0||q.avail_in===0&&(X===VQ||X===s9))if(this.options.to==="string")this.onData(JQ.buf2binstring(m$.shrinkBuf(q.output,q.next_out)));else this.onData(m$.shrinkBuf(q.output,q.next_out))}while((q.avail_in>0||q.avail_out===0)&&Y!==a9);if(X===VQ)return Y=f$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===a0;if(X===s9)return this.onEnd(a0),q.avail_out=0,!0;return!0};C0.prototype.onData=function($){this.chunks.push($)};C0.prototype.onEnd=function($){if($===a0)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=m$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function XQ($,Q){var q=new C0(Q);if(q.push($,!0),q.err)throw q.msg||YQ[q.err];return q.result}function NW($,Q){return Q=Q||{},Q.raw=!0,XQ($,Q)}function MW($,Q){return Q=Q||{},Q.gzip=!0,XQ($,Q)}IW.Deflate=C0;IW.deflate=XQ;IW.deflateRaw=NW;IW.gzip=MW});var Q2=w((jP,$2)=>{var s6=30,FW=12;$2.exports=function(Q,q){var V,Y,X,J,G,U,K,W,Z,z,H,C,P,I,M,L,A,B,O,F,R,v,x,h,T;V=Q.state,Y=Q.next_in,h=Q.input,X=Y+(Q.avail_in-5),J=Q.next_out,T=Q.output,G=J-(q-Q.avail_out),U=J+(Q.avail_out-257),K=V.dmax,W=V.wsize,Z=V.whave,z=V.wnext,H=V.window,C=V.hold,P=V.bits,I=V.lencode,M=V.distcode,L=(1<<V.lenbits)-1,A=(1<<V.distbits)-1;$:do{if(P<15)C+=h[Y++]<<P,P+=8,C+=h[Y++]<<P,P+=8;B=I[C&L];Q:for(;;){if(O=B>>>24,C>>>=O,P-=O,O=B>>>16&255,O===0)T[J++]=B&65535;else if(O&16){if(F=B&65535,O&=15,O){if(P<O)C+=h[Y++]<<P,P+=8;F+=C&(1<<O)-1,C>>>=O,P-=O}if(P<15)C+=h[Y++]<<P,P+=8,C+=h[Y++]<<P,P+=8;B=M[C&A];q:for(;;){if(O=B>>>24,C>>>=O,P-=O,O=B>>>16&255,O&16){if(R=B&65535,O&=15,P<O){if(C+=h[Y++]<<P,P+=8,P<O)C+=h[Y++]<<P,P+=8}if(R+=C&(1<<O)-1,R>K){Q.msg="invalid distance too far back",V.mode=s6;break $}if(C>>>=O,P-=O,O=J-G,R>O){if(O=R-O,O>Z){if(V.sane){Q.msg="invalid distance too far back",V.mode=s6;break $}}if(v=0,x=H,z===0){if(v+=W-O,O<F){F-=O;do T[J++]=H[v++];while(--O);v=J-R,x=T}}else if(z<O){if(v+=W+z-O,O-=z,O<F){F-=O;do T[J++]=H[v++];while(--O);if(v=0,z<F){O=z,F-=O;do T[J++]=H[v++];while(--O);v=J-R,x=T}}}else if(v+=z-O,O<F){F-=O;do T[J++]=H[v++];while(--O);v=J-R,x=T}while(F>2)T[J++]=x[v++],T[J++]=x[v++],T[J++]=x[v++],F-=3;if(F){if(T[J++]=x[v++],F>1)T[J++]=x[v++]}}else{v=J-R;do T[J++]=T[v++],T[J++]=T[v++],T[J++]=T[v++],F-=3;while(F>2);if(F){if(T[J++]=T[v++],F>1)T[J++]=T[v++]}}}else if((O&64)===0){B=M[(B&65535)+(C&(1<<O)-1)];continue q}else{Q.msg="invalid distance code",V.mode=s6;break $}break}}else if((O&64)===0){B=I[(B&65535)+(C&(1<<O)-1)];continue Q}else if(O&32){V.mode=FW;break $}else{Q.msg="invalid literal/length code",V.mode=s6;break $}break}}while(Y<X&&J<U);F=P>>3,Y-=F,P-=F<<3,C&=(1<<P)-1,Q.next_in=Y,Q.next_out=J,Q.avail_in=Y<X?5+(X-Y):5-(Y-X),Q.avail_out=J<U?257+(U-J):257-(J-U),V.hold=C,V.bits=P;return}});var K2=w((ZP,G2)=>{var q2=o1(),s0=15,V2=852,J2=592,Y2=0,GQ=1,X2=2,RW=[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],vW=[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],xW=[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],SW=[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];G2.exports=function(Q,q,V,Y,X,J,G,U){var K=U.bits,W=0,Z=0,z=0,H=0,C=0,P=0,I=0,M=0,L=0,A=0,B,O,F,R,v,x=null,h=0,T,W1=new q2.Buf16(s0+1),x0=new q2.Buf16(s0+1),G6=null,Jq=0,Yq,K6,W6;for(W=0;W<=s0;W++)W1[W]=0;for(Z=0;Z<Y;Z++)W1[q[V+Z]]++;C=K;for(H=s0;H>=1;H--)if(W1[H]!==0)break;if(C>H)C=H;if(H===0)return X[J++]=20971520,X[J++]=20971520,U.bits=1,0;for(z=1;z<H;z++)if(W1[z]!==0)break;if(C<z)C=z;M=1;for(W=1;W<=s0;W++)if(M<<=1,M-=W1[W],M<0)return-1;if(M>0&&(Q===Y2||H!==1))return-1;x0[1]=0;for(W=1;W<s0;W++)x0[W+1]=x0[W]+W1[W];for(Z=0;Z<Y;Z++)if(q[V+Z]!==0)G[x0[q[V+Z]]++]=Z;if(Q===Y2)x=G6=G,T=19;else if(Q===GQ)x=RW,h-=257,G6=vW,Jq-=257,T=256;else x=xW,G6=SW,T=-1;if(A=0,Z=0,W=z,v=J,P=C,I=0,F=-1,L=1<<C,R=L-1,Q===GQ&&L>V2||Q===X2&&L>J2)return 1;for(;;){if(Yq=W-I,G[Z]<T)K6=0,W6=G[Z];else if(G[Z]>T)K6=G6[Jq+G[Z]],W6=x[h+G[Z]];else K6=96,W6=0;B=1<<W-I,O=1<<P,z=O;do O-=B,X[v+(A>>I)+O]=Yq<<24|K6<<16|W6|0;while(O!==0);B=1<<W-1;while(A&B)B>>=1;if(B!==0)A&=B-1,A+=B;else A=0;if(Z++,--W1[W]===0){if(W===H)break;W=q[V+G[Z]]}if(W>C&&(A&R)!==F){if(I===0)I=C;v+=z,P=W-I,M=1<<P;while(P+I<H){if(M-=W1[P+I],M<=0)break;P++,M<<=1}if(L+=1<<P,Q===GQ&&L>V2||Q===X2&&L>J2)return 1;F=A&R,X[F]=C<<24|P<<16|v-J|0}}if(A!==0)X[v+A]=W-I<<24|4194304|0;return U.bits=C,0}});var u2=w((rW)=>{var Z1=o1(),zQ=r5(),_1=a5(),EW=Q2(),c$=K2(),yW=0,k2=1,D2=2,W2=4,gW=5,t6=6,w0=0,kW=1,DW=2,L1=-2,h2=-3,HQ=-4,hW=-5,U2=8,_2=1,j2=2,Z2=3,z2=4,H2=5,P2=6,L2=7,O2=8,B2=9,N2=10,Q8=11,n1=12,KQ=13,M2=14,WQ=15,I2=16,C2=17,w2=18,A2=19,e6=20,$8=21,T2=22,F2=23,R2=24,v2=25,x2=26,UQ=27,S2=28,E2=29,f=30,PQ=31,_W=32,bW=852,fW=592,mW=15,cW=mW;function y2($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function pW(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Z1.Buf16(320),this.work=new Z1.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b2($){var Q;if(!$||!$.state)return L1;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=_2,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new Z1.Buf32(bW),Q.distcode=Q.distdyn=new Z1.Buf32(fW),Q.sane=1,Q.back=-1,w0}function f2($){var Q;if(!$||!$.state)return L1;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,b2($)}function m2($,Q){var q,V;if(!$||!$.state)return L1;if(V=$.state,Q<0)q=0,Q=-Q;else if(q=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return L1;if(V.window!==null&&V.wbits!==Q)V.window=null;return V.wrap=q,V.wbits=Q,f2($)}function c2($,Q){var q,V;if(!$)return L1;if(V=new pW,$.state=V,V.window=null,q=m2($,Q),q!==w0)$.state=null;return q}function uW($){return c2($,cW)}var g2=!0,jQ,ZQ;function dW($){if(g2){var Q;jQ=new Z1.Buf32(512),ZQ=new Z1.Buf32(32),Q=0;while(Q<144)$.lens[Q++]=8;while(Q<256)$.lens[Q++]=9;while(Q<280)$.lens[Q++]=7;while(Q<288)$.lens[Q++]=8;c$(k2,$.lens,0,288,jQ,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;c$(D2,$.lens,0,32,ZQ,0,$.work,{bits:5}),g2=!1}$.lencode=jQ,$.lenbits=9,$.distcode=ZQ,$.distbits=5}function p2($,Q,q,V){var Y,X=$.state;if(X.window===null)X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new Z1.Buf8(X.wsize);if(V>=X.wsize)Z1.arraySet(X.window,Q,q-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize;else{if(Y=X.wsize-X.wnext,Y>V)Y=V;if(Z1.arraySet(X.window,Q,q-V,Y,X.wnext),V-=Y,V)Z1.arraySet(X.window,Q,q-V,V,0),X.wnext=V,X.whave=X.wsize;else{if(X.wnext+=Y,X.wnext===X.wsize)X.wnext=0;if(X.whave<X.wsize)X.whave+=Y}}return 0}function lW($,Q){var q,V,Y,X,J,G,U,K,W,Z,z,H,C,P,I=0,M,L,A,B,O,F,R,v,x=new Z1.Buf8(4),h,T,W1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return L1;if(q=$.state,q.mode===n1)q.mode=KQ;J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,V=$.input,G=$.avail_in,K=q.hold,W=q.bits,Z=G,z=U,v=w0;$:for(;;)switch(q.mode){case _2:if(q.wrap===0){q.mode=KQ;break}while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.wrap&2&&K===35615){q.check=0,x[0]=K&255,x[1]=K>>>8&255,q.check=_1(q.check,x,2,0),K=0,W=0,q.mode=j2;break}if(q.flags=0,q.head)q.head.done=!1;if(!(q.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",q.mode=f;break}if((K&15)!==U2){$.msg="unknown compression method",q.mode=f;break}if(K>>>=4,W-=4,R=(K&15)+8,q.wbits===0)q.wbits=R;else if(R>q.wbits){$.msg="invalid window size",q.mode=f;break}q.dmax=1<<R,$.adler=q.check=1,q.mode=K&512?N2:n1,K=0,W=0;break;case j2:while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.flags=K,(q.flags&255)!==U2){$.msg="unknown compression method",q.mode=f;break}if(q.flags&57344){$.msg="unknown header flags set",q.mode=f;break}if(q.head)q.head.text=K>>8&1;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,q.check=_1(q.check,x,2,0);K=0,W=0,q.mode=Z2;case Z2:while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.head)q.head.time=K;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,x[2]=K>>>16&255,x[3]=K>>>24&255,q.check=_1(q.check,x,4,0);K=0,W=0,q.mode=z2;case z2:while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.head)q.head.xflags=K&255,q.head.os=K>>8;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,q.check=_1(q.check,x,2,0);K=0,W=0,q.mode=H2;case H2:if(q.flags&1024){while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.length=K,q.head)q.head.extra_len=K;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,q.check=_1(q.check,x,2,0);K=0,W=0}else if(q.head)q.head.extra=null;q.mode=P2;case P2:if(q.flags&1024){if(H=q.length,H>G)H=G;if(H){if(q.head){if(R=q.head.extra_len-q.length,!q.head.extra)q.head.extra=Array(q.head.extra_len);Z1.arraySet(q.head.extra,V,X,H,R)}if(q.flags&512)q.check=_1(q.check,V,H,X);G-=H,X+=H,q.length-=H}if(q.length)break $}q.length=0,q.mode=L2;case L2:if(q.flags&2048){if(G===0)break $;H=0;do if(R=V[X+H++],q.head&&R&&q.length<65536)q.head.name+=String.fromCharCode(R);while(R&&H<G);if(q.flags&512)q.check=_1(q.check,V,H,X);if(G-=H,X+=H,R)break $}else if(q.head)q.head.name=null;q.length=0,q.mode=O2;case O2:if(q.flags&4096){if(G===0)break $;H=0;do if(R=V[X+H++],q.head&&R&&q.length<65536)q.head.comment+=String.fromCharCode(R);while(R&&H<G);if(q.flags&512)q.check=_1(q.check,V,H,X);if(G-=H,X+=H,R)break $}else if(q.head)q.head.comment=null;q.mode=B2;case B2:if(q.flags&512){while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(K!==(q.check&65535)){$.msg="header crc mismatch",q.mode=f;break}K=0,W=0}if(q.head)q.head.hcrc=q.flags>>9&1,q.head.done=!0;$.adler=q.check=0,q.mode=n1;break;case N2:while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}$.adler=q.check=y2(K),K=0,W=0,q.mode=Q8;case Q8:if(q.havedict===0)return $.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,q.hold=K,q.bits=W,DW;$.adler=q.check=1,q.mode=n1;case n1:if(Q===gW||Q===t6)break $;case KQ:if(q.last){K>>>=W&7,W-=W&7,q.mode=UQ;break}while(W<3){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}switch(q.last=K&1,K>>>=1,W-=1,K&3){case 0:q.mode=M2;break;case 1:if(dW(q),q.mode=e6,Q===t6){K>>>=2,W-=2;break $}break;case 2:q.mode=C2;break;case 3:$.msg="invalid block type",q.mode=f}K>>>=2,W-=2;break;case M2:K>>>=W&7,W-=W&7;while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",q.mode=f;break}if(q.length=K&65535,K=0,W=0,q.mode=WQ,Q===t6)break $;case WQ:q.mode=I2;case I2:if(H=q.length,H){if(H>G)H=G;if(H>U)H=U;if(H===0)break $;Z1.arraySet(Y,V,X,H,J),G-=H,X+=H,U-=H,J+=H,q.length-=H;break}q.mode=n1;break;case C2:while(W<14){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.nlen=(K&31)+257,K>>>=5,W-=5,q.ndist=(K&31)+1,K>>>=5,W-=5,q.ncode=(K&15)+4,K>>>=4,W-=4,q.nlen>286||q.ndist>30){$.msg="too many length or distance symbols",q.mode=f;break}q.have=0,q.mode=w2;case w2:while(q.have<q.ncode){while(W<3){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}q.lens[W1[q.have++]]=K&7,K>>>=3,W-=3}while(q.have<19)q.lens[W1[q.have++]]=0;if(q.lencode=q.lendyn,q.lenbits=7,h={bits:q.lenbits},v=c$(yW,q.lens,0,19,q.lencode,0,q.work,h),q.lenbits=h.bits,v){$.msg="invalid code lengths set",q.mode=f;break}q.have=0,q.mode=A2;case A2:while(q.have<q.nlen+q.ndist){for(;;){if(I=q.lencode[K&(1<<q.lenbits)-1],M=I>>>24,L=I>>>16&255,A=I&65535,M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(A<16)K>>>=M,W-=M,q.lens[q.have++]=A;else{if(A===16){T=M+2;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(K>>>=M,W-=M,q.have===0){$.msg="invalid bit length repeat",q.mode=f;break}R=q.lens[q.have-1],H=3+(K&3),K>>>=2,W-=2}else if(A===17){T=M+3;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=M,W-=M,R=0,H=3+(K&7),K>>>=3,W-=3}else{T=M+7;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=M,W-=M,R=0,H=11+(K&127),K>>>=7,W-=7}if(q.have+H>q.nlen+q.ndist){$.msg="invalid bit length repeat",q.mode=f;break}while(H--)q.lens[q.have++]=R}}if(q.mode===f)break;if(q.lens[256]===0){$.msg="invalid code -- missing end-of-block",q.mode=f;break}if(q.lenbits=9,h={bits:q.lenbits},v=c$(k2,q.lens,0,q.nlen,q.lencode,0,q.work,h),q.lenbits=h.bits,v){$.msg="invalid literal/lengths set",q.mode=f;break}if(q.distbits=6,q.distcode=q.distdyn,h={bits:q.distbits},v=c$(D2,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,h),q.distbits=h.bits,v){$.msg="invalid distances set",q.mode=f;break}if(q.mode=e6,Q===t6)break $;case e6:q.mode=$8;case $8:if(G>=6&&U>=258){if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,q.hold=K,q.bits=W,EW($,z),J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,V=$.input,G=$.avail_in,K=q.hold,W=q.bits,q.mode===n1)q.back=-1;break}q.back=0;for(;;){if(I=q.lencode[K&(1<<q.lenbits)-1],M=I>>>24,L=I>>>16&255,A=I&65535,M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(L&&(L&240)===0){B=M,O=L,F=A;for(;;){if(I=q.lencode[F+((K&(1<<B+O)-1)>>B)],M=I>>>24,L=I>>>16&255,A=I&65535,B+M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=B,W-=B,q.back+=B}if(K>>>=M,W-=M,q.back+=M,q.length=A,L===0){q.mode=x2;break}if(L&32){q.back=-1,q.mode=n1;break}if(L&64){$.msg="invalid literal/length code",q.mode=f;break}q.extra=L&15,q.mode=T2;case T2:if(q.extra){T=q.extra;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}q.length+=K&(1<<q.extra)-1,K>>>=q.extra,W-=q.extra,q.back+=q.extra}q.was=q.length,q.mode=F2;case F2:for(;;){if(I=q.distcode[K&(1<<q.distbits)-1],M=I>>>24,L=I>>>16&255,A=I&65535,M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if((L&240)===0){B=M,O=L,F=A;for(;;){if(I=q.distcode[F+((K&(1<<B+O)-1)>>B)],M=I>>>24,L=I>>>16&255,A=I&65535,B+M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=B,W-=B,q.back+=B}if(K>>>=M,W-=M,q.back+=M,L&64){$.msg="invalid distance code",q.mode=f;break}q.offset=A,q.extra=L&15,q.mode=R2;case R2:if(q.extra){T=q.extra;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}q.offset+=K&(1<<q.extra)-1,K>>>=q.extra,W-=q.extra,q.back+=q.extra}if(q.offset>q.dmax){$.msg="invalid distance too far back",q.mode=f;break}q.mode=v2;case v2:if(U===0)break $;if(H=z-U,q.offset>H){if(H=q.offset-H,H>q.whave){if(q.sane){$.msg="invalid distance too far back",q.mode=f;break}}if(H>q.wnext)H-=q.wnext,C=q.wsize-H;else C=q.wnext-H;if(H>q.length)H=q.length;P=q.window}else P=Y,C=J-q.offset,H=q.length;if(H>U)H=U;U-=H,q.length-=H;do Y[J++]=P[C++];while(--H);if(q.length===0)q.mode=$8;break;case x2:if(U===0)break $;Y[J++]=q.length,U--,q.mode=$8;break;case UQ:if(q.wrap){while(W<32){if(G===0)break $;G--,K|=V[X++]<<W,W+=8}if(z-=U,$.total_out+=z,q.total+=z,z)$.adler=q.check=q.flags?_1(q.check,Y,z,J-z):zQ(q.check,Y,z,J-z);if(z=U,(q.flags?K:y2(K))!==q.check){$.msg="incorrect data check",q.mode=f;break}K=0,W=0}q.mode=S2;case S2:if(q.wrap&&q.flags){while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(K!==(q.total&4294967295)){$.msg="incorrect length check",q.mode=f;break}K=0,W=0}q.mode=E2;case E2:v=kW;break $;case f:v=h2;break $;case PQ:return HQ;case _W:default:return L1}if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,q.hold=K,q.bits=W,q.wsize||z!==$.avail_out&&q.mode<f&&(q.mode<UQ||Q!==W2)){if(p2($,$.output,$.next_out,z-$.avail_out))return q.mode=PQ,HQ}if(Z-=$.avail_in,z-=$.avail_out,$.total_in+=Z,$.total_out+=z,q.total+=z,q.wrap&&z)$.adler=q.check=q.flags?_1(q.check,Y,z,$.next_out-z):zQ(q.check,Y,z,$.next_out-z);if($.data_type=q.bits+(q.last?64:0)+(q.mode===n1?128:0)+(q.mode===e6||q.mode===WQ?256:0),(Z===0&&z===0||Q===W2)&&v===w0)v=hW;return v}function oW($){if(!$||!$.state)return L1;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,w0}function iW($,Q){var q;if(!$||!$.state)return L1;if(q=$.state,(q.wrap&2)===0)return L1;return q.head=Q,Q.done=!1,w0}function nW($,Q){var q=Q.length,V,Y,X;if(!$||!$.state)return L1;if(V=$.state,V.wrap!==0&&V.mode!==Q8)return L1;if(V.mode===Q8){if(Y=1,Y=zQ(Y,Q,q,0),Y!==V.check)return h2}if(X=p2($,Q,q,q),X)return V.mode=PQ,HQ;return V.havedict=1,w0}rW.inflateReset=f2;rW.inflateReset2=m2;rW.inflateResetKeep=b2;rW.inflateInit=uW;rW.inflateInit2=c2;rW.inflate=lW;rW.inflateEnd=oW;rW.inflateGetHeader=iW;rW.inflateSetDictionary=nW;rW.inflateInfo="pako inflate (from Nodeca project)"});var LQ=w((HP,d2)=>{d2.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 o2=w((PP,l2)=>{function XU(){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}l2.exports=XU});var n2=w((UU)=>{var t0=u2(),p$=o1(),q8=QQ(),u=LQ(),OQ=u6(),GU=qQ(),KU=o2(),i2=Object.prototype.toString;function A0($){if(!(this instanceof A0))return new A0($);this.options=p$.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 q=t0.inflateInit2(this.strm,Q.windowBits);if(q!==u.Z_OK)throw Error(OQ[q]);if(this.header=new KU,t0.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=q8.string2buf(Q.dictionary);else if(i2.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(q=t0.inflateSetDictionary(this.strm,Q.dictionary),q!==u.Z_OK)throw Error(OQ[q])}}}A0.prototype.push=function($,Q){var q=this.strm,V=this.options.chunkSize,Y=this.options.dictionary,X,J,G,U,K,W=!1;if(this.ended)return!1;if(J=Q===~~Q?Q:Q===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof $==="string")q.input=q8.binstring2buf($);else if(i2.call($)==="[object ArrayBuffer]")q.input=new Uint8Array($);else q.input=$;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new p$.Buf8(V),q.next_out=0,q.avail_out=V;if(X=t0.inflate(q,u.Z_NO_FLUSH),X===u.Z_NEED_DICT&&Y)X=t0.inflateSetDictionary(this.strm,Y);if(X===u.Z_BUF_ERROR&&W===!0)X=u.Z_OK,W=!1;if(X!==u.Z_STREAM_END&&X!==u.Z_OK)return this.onEnd(X),this.ended=!0,!1;if(q.next_out){if(q.avail_out===0||X===u.Z_STREAM_END||q.avail_in===0&&(J===u.Z_FINISH||J===u.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=q8.utf8border(q.output,q.next_out),U=q.next_out-G,K=q8.buf2string(q.output,G),q.next_out=U,q.avail_out=V-U,U)p$.arraySet(q.output,q.output,G,U,0);this.onData(K)}else this.onData(p$.shrinkBuf(q.output,q.next_out))}if(q.avail_in===0&&q.avail_out===0)W=!0}while((q.avail_in>0||q.avail_out===0)&&X!==u.Z_STREAM_END);if(X===u.Z_STREAM_END)J=u.Z_FINISH;if(J===u.Z_FINISH)return X=t0.inflateEnd(this.strm),this.onEnd(X),this.ended=!0,X===u.Z_OK;if(J===u.Z_SYNC_FLUSH)return this.onEnd(u.Z_OK),q.avail_out=0,!0;return!0};A0.prototype.onData=function($){this.chunks.push($)};A0.prototype.onEnd=function($){if($===u.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=p$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function BQ($,Q){var q=new A0(Q);if(q.push($,!0),q.err)throw q.msg||OQ[q.err];return q.result}function WU($,Q){return Q=Q||{},Q.raw=!0,BQ($,Q)}UU.Inflate=A0;UU.inflate=BQ;UU.inflateRaw=WU;UU.ungzip=BQ});var s2=w((OP,a2)=>{var PU=o1().assign,LU=e9(),OU=n2(),BU=LQ(),r2={};PU(r2,LU,OU,BU);a2.exports=r2});var e2=w((CU)=>{var NU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",MU=s2(),t2=m(),V8=j1(),IU=NU?"uint8array":"array";CU.magic="\b\x00";function T0($,Q){V8.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}t2.inherits(T0,V8);T0.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(t2.transformTo(IU,$.data),!1)};T0.prototype.flush=function(){if(V8.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};T0.prototype.cleanUp=function(){V8.prototype.cleanUp.call(this),this._pako=null};T0.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})}};CU.compressWorker=function($){return new T0("Deflate",$)};CU.uncompressWorker=function(){return new T0("Inflate",{})}});var NQ=w((FU)=>{var $7=j1();FU.STORE={magic:"\x00\x00",compressWorker:function(){return new $7("STORE compression")},uncompressWorker:function(){return new $7("STORE decompression")}};FU.DEFLATE=e2()});var MQ=w((xU)=>{xU.LOCAL_FILE_HEADER="PK\x03\x04";xU.CENTRAL_FILE_HEADER="PK\x01\x02";xU.CENTRAL_DIRECTORY_END="PK\x05\x06";xU.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";xU.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";xU.DATA_DESCRIPTOR="PK\x07\b"});var J7=w((IP,V7)=>{var e0=m(),$$=j1(),IQ=u0(),Q7=f6(),J8=MQ(),D=function($,Q){var q="",V;for(V=0;V<Q;V++)q+=String.fromCharCode($&255),$=$>>>8;return q},hU=function($,Q){var q=$;if(!$)q=Q?16893:33204;return(q&65535)<<16},_U=function($){return($||0)&63},q7=function($,Q,q,V,Y,X){var{file:J,compression:G}=$,U=X!==IQ.utf8encode,K=e0.transformTo("string",X(J.name)),W=e0.transformTo("string",IQ.utf8encode(J.name)),Z=J.comment,z=e0.transformTo("string",X(Z)),H=e0.transformTo("string",IQ.utf8encode(Z)),C=W.length!==J.name.length,P=H.length!==Z.length,I,M,L="",A="",B="",O=J.dir,F=J.date,R={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||q)R.crc32=$.crc32,R.compressedSize=$.compressedSize,R.uncompressedSize=$.uncompressedSize;var v=0;if(Q)v|=8;if(!U&&(C||P))v|=2048;var x=0,h=0;if(O)x|=16;if(Y==="UNIX")h=798,x|=hU(J.unixPermissions,O);else h=20,x|=_U(J.dosPermissions,O);if(I=F.getUTCHours(),I=I<<6,I=I|F.getUTCMinutes(),I=I<<5,I=I|F.getUTCSeconds()/2,M=F.getUTCFullYear()-1980,M=M<<4,M=M|F.getUTCMonth()+1,M=M<<5,M=M|F.getUTCDate(),C)A=D(1,1)+D(Q7(K),4)+W,L+="up"+D(A.length,2)+A;if(P)B=D(1,1)+D(Q7(z),4)+H,L+="uc"+D(B.length,2)+B;var T="";T+=`
61
- \x00`,T+=D(v,2),T+=G.magic,T+=D(I,2),T+=D(M,2),T+=D(R.crc32,4),T+=D(R.compressedSize,4),T+=D(R.uncompressedSize,4),T+=D(K.length,2),T+=D(L.length,2);var W1=J8.LOCAL_FILE_HEADER+T+K+L,x0=J8.CENTRAL_FILE_HEADER+D(h,2)+T+D(z.length,2)+"\x00\x00\x00\x00"+D(x,4)+D(V,4)+K+L+z;return{fileRecord:W1,dirRecord:x0}},bU=function($,Q,q,V,Y){var X="",J=e0.transformTo("string",Y(V));return X=J8.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+D($,2)+D($,2)+D(Q,4)+D(q,4)+D(J.length,2)+J,X},fU=function($){var Q="";return Q=J8.DATA_DESCRIPTOR+D($.crc32,4)+D($.compressedSize,4)+D($.uncompressedSize,4),Q};function R1($,Q,q,V){$$.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=q,this.encodeFileName=V,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}e0.inherits(R1,$$);R1.prototype.push=function($){var Q=$.meta.percent||0,q=this.entriesCount,V=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,$$.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:q?(Q+100*(q-V-1))/q:100}})};R1.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var q=q7($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};R1.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,q=q7($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(q.dirRecord),Q)this.push({data:fU($),meta:{percent:100}});else{this.push({data:q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};R1.prototype.flush=function(){var $=this.bytesWritten;for(var Q=0;Q<this.dirRecords.length;Q++)this.push({data:this.dirRecords[Q],meta:{percent:100}});var q=this.bytesWritten-$,V=bU(this.dirRecords.length,q,$,this.zipComment,this.encodeFileName);this.push({data:V,meta:{percent:100}})};R1.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};R1.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(q){Q.processChunk(q)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(q){Q.error(q)}),this};R1.prototype.resume=function(){if(!$$.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};R1.prototype.error=function($){var Q=this._sources;if(!$$.prototype.error.call(this,$))return!1;for(var q=0;q<Q.length;q++)try{Q[q].error($)}catch(V){}return!0};R1.prototype.lock=function(){$$.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};V7.exports=R1});var Y7=w((uU)=>{var mU=NQ(),cU=J7(),pU=function($,Q){var q=$||Q,V=mU[q];if(!V)throw Error(q+" is not a valid compression method !");return V};uU.generateWorker=function($,Q,q){var V=new cU(Q.streamFiles,q,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(X,J){Y++;var G=pU(J.options.compression,Q.compression),U=J.options.compressionOptions||Q.compressionOptions||{},K=J.dir,W=J.date;J._compressWorker(G,U).withStreamInfo("file",{name:X,dir:K,date:W,comment:J.comment||"",unixPermissions:J.unixPermissions,dosPermissions:J.dosPermissions}).pipe(V)}),V.entriesCount=Y}catch(X){V.error(X)}return V}});var G7=w((wP,X7)=>{var lU=m(),Y8=j1();function u$($,Q){Y8.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}lU.inherits(u$,Y8);u$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(q){Q.push({data:q,meta:{percent:0}})}).on("error",function(q){if(Q.isPaused)this.generatedError=q;else Q.error(q)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};u$.prototype.pause=function(){if(!Y8.prototype.pause.call(this))return!1;return this._stream.pause(),!0};u$.prototype.resume=function(){if(!Y8.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};X7.exports=u$});var O7=w((AP,L7)=>{var oU=u0(),d$=m(),j7=j1(),iU=T5(),Z7=F5(),K7=m6(),nU=W9(),rU=Y7(),W7=C$(),aU=G7(),z7=function($,Q,q){var V=d$.getTypeOf(Q),Y,X=d$.extend(q||{},Z7);if(X.date=X.date||new Date,X.compression!==null)X.compression=X.compression.toUpperCase();if(typeof X.unixPermissions==="string")X.unixPermissions=parseInt(X.unixPermissions,8);if(X.unixPermissions&&X.unixPermissions&16384)X.dir=!0;if(X.dosPermissions&&X.dosPermissions&16)X.dir=!0;if(X.dir)$=H7($);if(X.createFolders&&(Y=sU($)))P7.call(this,Y,!0);var J=V==="string"&&X.binary===!1&&X.base64===!1;if(!q||typeof q.binary>"u")X.binary=!J;var G=Q instanceof K7&&Q.uncompressedSize===0;if(G||X.dir||!Q||Q.length===0)X.base64=!1,X.binary=!0,Q="",X.compression="STORE",V="string";var U=null;if(Q instanceof K7||Q instanceof j7)U=Q;else if(W7.isNode&&W7.isStream(Q))U=new aU($,Q);else U=d$.prepareContent($,Q,X.binary,X.optimizedBinaryString,X.base64);var K=new nU($,U,X);this.files[$]=K},sU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},H7=function($){if($.slice(-1)!=="/")$+="/";return $},P7=function($,Q){if(Q=typeof Q<"u"?Q:Z7.createFolders,$=H7($),!this.files[$])z7.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function U7($){return Object.prototype.toString.call($)==="[object RegExp]"}var tU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,q,V;for(Q in this.files)if(V=this.files[Q],q=Q.slice(this.root.length,Q.length),q&&Q.slice(0,this.root.length)===this.root)$(q,V)},filter:function($){var Q=[];return this.forEach(function(q,V){if($(q,V))Q.push(V)}),Q},file:function($,Q,q){if(arguments.length===1)if(U7($)){var V=$;return this.filter(function(X,J){return!J.dir&&V.test(X)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,z7.call(this,$,Q,q);return this},folder:function($){if(!$)return this;if(U7($))return this.filter(function(Y,X){return X.dir&&$.test(Y)});var Q=this.root+$,q=P7.call(this,Q),V=this.clone();return V.root=q.name,V},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 q=this.filter(function(Y,X){return X.name.slice(0,$.length)===$});for(var V=0;V<q.length;V++)delete this.files[q[V].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,q={};try{if(q=d$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:oU.utf8encode}),q.type=q.type.toLowerCase(),q.compression=q.compression.toUpperCase(),q.type==="binarystring")q.type="string";if(!q.type)throw Error("No output type specified.");if(d$.checkSupport(q.type),q.platform==="darwin"||q.platform==="freebsd"||q.platform==="linux"||q.platform==="sunos")q.platform="UNIX";if(q.platform==="win32")q.platform="DOS";var V=q.comment||this.comment||"";Q=rU.generateWorker(this,q,V)}catch(Y){Q=new j7("error"),Q.error(Y)}return new iU(Q,q.type||"string",q.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};L7.exports=tU});var CQ=w((TP,N7)=>{var eU=m();function B7($){this.data=$,this.length=$.length,this.index=0,this.zero=0}B7.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,q;this.checkOffset($);for(q=this.index+$-1;q>=this.index;q--)Q=(Q<<8)+this.byteAt(q);return this.index+=$,Q},readString:function($){return eU.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))}};N7.exports=B7});var wQ=w((FP,I7)=>{var M7=CQ(),$j=m();function Q$($){M7.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}$j.inherits(Q$,M7);Q$.prototype.byteAt=function($){return this.data[this.zero+$]};Q$.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),q=$.charCodeAt(1),V=$.charCodeAt(2),Y=$.charCodeAt(3);for(var X=this.length-4;X>=0;--X)if(this.data[X]===Q&&this.data[X+1]===q&&this.data[X+2]===V&&this.data[X+3]===Y)return X-this.zero;return-1};Q$.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),q=$.charCodeAt(1),V=$.charCodeAt(2),Y=$.charCodeAt(3),X=this.readData(4);return Q===X[0]&&q===X[1]&&V===X[2]&&Y===X[3]};Q$.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};I7.exports=Q$});var A7=w((RP,w7)=>{var C7=CQ(),Qj=m();function q$($){C7.call(this,$)}Qj.inherits(q$,C7);q$.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};q$.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};q$.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};q$.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};w7.exports=q$});var TQ=w((vP,F7)=>{var T7=wQ(),qj=m();function AQ($){T7.call(this,$)}qj.inherits(AQ,T7);AQ.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};F7.exports=AQ});var x7=w((xP,v7)=>{var R7=TQ(),Vj=m();function FQ($){R7.call(this,$)}Vj.inherits(FQ,R7);FQ.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};v7.exports=FQ});var RQ=w((SP,E7)=>{var X8=m(),S7=l1(),Jj=wQ(),Yj=A7(),Xj=x7(),Gj=TQ();E7.exports=function($){var Q=X8.getTypeOf($);if(X8.checkSupport(Q),Q==="string"&&!S7.uint8array)return new Yj($);if(Q==="nodebuffer")return new Xj($);if(S7.uint8array)return new Gj(X8.transformTo("uint8array",$));return new Jj(X8.transformTo("array",$))}});var D7=w((EP,k7)=>{var vQ=RQ(),j0=m(),Kj=m6(),y7=f6(),G8=u0(),K8=NQ(),Wj=l1(),Uj=0,jj=3,Zj=function($){for(var Q in K8){if(!Object.prototype.hasOwnProperty.call(K8,Q))continue;if(K8[Q].magic===$)return K8[Q]}return null};function g7($,Q){this.options=$,this.loadOptions=Q}g7.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,q;if($.skip(22),this.fileNameLength=$.readInt(2),q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(q),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=Zj(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+j0.pretty(this.compressionMethod)+" unknown (inner file : "+j0.transformTo("string",this.fileName)+")");this.decompressed=new Kj(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,$===Uj)this.dosPermissions=this.externalFileAttributes&63;if($===jj)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=vQ(this.extraFields[1].value);if(this.uncompressedSize===j0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===j0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===j0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===j0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,q,V,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)q=$.readInt(2),V=$.readInt(2),Y=$.readData(V),this.extraFields[q]={id:q,length:V,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=Wj.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=G8.utf8decode(this.fileName),this.fileCommentStr=G8.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var q=j0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(q)}var V=this.findExtraFieldUnicodeComment();if(V!==null)this.fileCommentStr=V;else{var Y=j0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=vQ($.value);if(Q.readInt(1)!==1)return null;if(y7(this.fileName)!==Q.readInt(4))return null;return G8.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=vQ($.value);if(Q.readInt(1)!==1)return null;if(y7(this.fileComment)!==Q.readInt(4))return null;return G8.utf8decode(Q.readData($.length-5))}return null}};k7.exports=g7});var b7=w((yP,_7)=>{var zj=RQ(),r1=m(),v1=MQ(),Hj=D7(),Pj=l1();function h7($){this.files=[],this.loadOptions=$}h7.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var Q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+r1.pretty(Q)+", expected "+r1.pretty($)+")")}},isSignature:function($,Q){var q=this.reader.index;this.reader.setIndex($);var V=this.reader.readString(4),Y=V===Q;return this.reader.setIndex(q),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=Pj.uint8array?"uint8array":"array",q=r1.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(q)},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,q,V,Y;while(Q<$)q=this.reader.readInt(2),V=this.reader.readInt(4),Y=this.reader.readData(V),this.zip64ExtensibleData[q]={id:q,length:V,value:Y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,Q;for($=0;$<this.files.length;$++)Q=this.files[$],this.reader.setIndex(Q.localHeaderOffset),this.checkSignature(v1.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(v1.CENTRAL_FILE_HEADER))$=new Hj({zip64:this.zip64},this.loadOptions),$.readCentralPart(this.reader),this.files.push($);if(this.centralDirRecords!==this.files.length){if(this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}},readEndOfCentral:function(){var $=this.reader.lastIndexOfSignature(v1.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,v1.LOCAL_FILE_HEADER);if(Q)throw Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");else throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex($);var q=$;if(this.checkSignature(v1.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r1.MAX_VALUE_16BITS||this.centralDirRecords===r1.MAX_VALUE_16BITS||this.centralDirSize===r1.MAX_VALUE_32BITS||this.centralDirOffset===r1.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),$<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex($),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,v1.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory")}this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(v1.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var V=this.centralDirOffset+this.centralDirSize;if(this.zip64)V+=20,V+=12+this.zip64EndOfCentralSize;var Y=q-V;if(Y>0)if(this.isSignature(q,v1.CENTRAL_FILE_HEADER));else this.reader.zero=Y;else if(Y<0)throw Error("Corrupted zip: missing "+Math.abs(Y)+" bytes.")},prepareReader:function($){this.reader=zj($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};_7.exports=h7});var c7=w((gP,m7)=>{var xQ=m(),W8=m0(),Lj=u0(),Oj=b7(),Bj=x5(),f7=C$();function Nj($){return new W8.Promise(function(Q,q){var V=$.decompressed.getContentWorker().pipe(new Bj);V.on("error",function(Y){q(Y)}).on("end",function(){if(V.streamInfo.crc32!==$.decompressed.crc32)q(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}m7.exports=function($,Q){var q=this;if(Q=xQ.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:Lj.utf8decode}),f7.isNode&&f7.isStream($))return W8.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return xQ.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(V){var Y=new Oj(Q);return Y.load(V),Y}).then(function(Y){var X=[W8.Promise.resolve(Y)],J=Y.files;if(Q.checkCRC32)for(var G=0;G<J.length;G++)X.push(Nj(J[G]));return W8.Promise.all(X)}).then(function(Y){var X=Y.shift(),J=X.files;for(var G=0;G<J.length;G++){var U=J[G],K=U.fileNameStr,W=xQ.resolve(U.fileNameStr);if(q.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)q.file(W).unsafeOriginalName=K}if(X.zipComment.length)q.comment=X.zipComment;return q})}});var u7=w((kP,p7)=>{function O1(){if(!(this instanceof O1))return new O1;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new O1;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}O1.prototype=O7();O1.prototype.loadAsync=c7();O1.support=l1();O1.defaults=F5();O1.version="3.10.1";O1.loadAsync=function($,Q){return new O1().loadAsync($,Q)};O1.external=m0();p7.exports=O1});import{homedir as GZ}from"node:os";import q1 from"node:path";function b1($,Q,q,V){return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; ${['if [ -x "$HOME/.petdex/bin/petdex.js" ] || [ -f "$HOME/.petdex/bin/petdex.js" ]; then',` node "$HOME/.petdex/bin/petdex.js" bubble ${Q} ${$} >/dev/null 2>&1 || true;`,"else",` ${KZ($,q,V)};`,"fi"].join(" ")}`}function KZ($,Q,q){let V=q!=null?`{"state":"${Q}","duration":${q},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`;return['T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"',`[ -n "$T" ] && curl -s -m 0.3 -X POST ${R0}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${V}'`,">/dev/null 2>&1 || true"].join(" ")}function bQ($,Q,q){let V=q!=null?`{"state":"${Q}","duration":${q},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`,Y='[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0',X='T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"';return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"; ${[`[ -n "$T" ] && curl -s -m 0.3 -X POST ${R0}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${V}'`,">/dev/null 2>&1 || true"].join(" ")}`}function WZ(){return`// petdex hook plugin — auto-generated by \`petdex hooks install\`.
60
+ `)},info:($)=>{c.message($,{symbol:N.default.blue(C4)})},success:($)=>{c.message($,{symbol:N.default.green(w4)})},step:($)=>{c.message($,{symbol:N.default.green(O6)})},warn:($)=>{c.message($,{symbol:N.default.yellow(A4)})},warning:($)=>{c.warn($)},error:($)=>{c.message($,{symbol:N.default.red(T4)})}},OH=`${N.default.gray(g)} `});var j$=w((NH,l8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)l8.exports={nextTick:F4};else l8.exports=process;function F4($,Q,q,V){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,X,J;switch(Y){case 0:case 1:return process.nextTick($);case 2:return process.nextTick(function(){$.call(null,Q)});case 3:return process.nextTick(function(){$.call(null,Q,q)});case 4:return process.nextTick(function(){$.call(null,Q,q,V)});default:X=Array(Y-1),J=0;while(J<X.length)X[J++]=arguments[J];return process.nextTick(function(){$.apply(null,X)})}}});var gq=w((MH,yq)=>{var R4={}.toString;yq.exports=Array.isArray||function($){return R4.call($)=="[object Array]"}});var Z$=w((o8,Dq)=>{var N6=l("buffer"),p1=N6.Buffer;function kq($,Q){for(var q in $)Q[q]=$[q]}if(p1.from&&p1.alloc&&p1.allocUnsafe&&p1.allocUnsafeSlow)Dq.exports=N6;else kq(N6,o8),o8.Buffer=E0;function E0($,Q,q){return p1($,Q,q)}kq(p1,E0);E0.from=function($,Q,q){if(typeof $==="number")throw TypeError("Argument must not be a number");return p1($,Q,q)};E0.alloc=function($,Q,q){if(typeof $!=="number")throw TypeError("Argument must be a number");var V=p1($);if(Q!==void 0)if(typeof q==="string")V.fill(Q,q);else V.fill(Q);else V.fill(0);return V};E0.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return p1($)};E0.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return N6.SlowBuffer($)}});var y0=w((p4)=>{function v4($){if(Array.isArray)return Array.isArray($);return M6($)==="[object Array]"}p4.isArray=v4;function x4($){return typeof $==="boolean"}p4.isBoolean=x4;function S4($){return $===null}p4.isNull=S4;function E4($){return $==null}p4.isNullOrUndefined=E4;function y4($){return typeof $==="number"}p4.isNumber=y4;function g4($){return typeof $==="string"}p4.isString=g4;function k4($){return typeof $==="symbol"}p4.isSymbol=k4;function D4($){return $===void 0}p4.isUndefined=D4;function h4($){return M6($)==="[object RegExp]"}p4.isRegExp=h4;function _4($){return typeof $==="object"&&$!==null}p4.isObject=_4;function f4($){return M6($)==="[object Date]"}p4.isDate=f4;function b4($){return M6($)==="[object Error]"||$ instanceof Error}p4.isError=b4;function m4($){return typeof $==="function"}p4.isFunction=m4;function c4($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}p4.isPrimitive=c4;p4.isBuffer=l("buffer").Buffer.isBuffer;function M6($){return Object.prototype.toString.call($)}});var hq=w((CH,i8)=>{if(typeof Object.create==="function")i8.exports=function(Q,q){if(q)Q.super_=q,Q.prototype=Object.create(q.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else i8.exports=function(Q,q){if(q){Q.super_=q;var V=function(){};V.prototype=q.prototype,Q.prototype=new V,Q.prototype.constructor=Q}}});var g0=w((wH,n8)=>{try{if(I6=l("util"),typeof I6.inherits!=="function")throw"";n8.exports=I6.inherits}catch($){n8.exports=hq()}var I6});var fq=w((AH,r8)=>{function JX($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var _q=Z$().Buffer,z$=l("util");function YX($,Q,q){$.copy(Q,q)}r8.exports=function(){function $(){JX(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(q){var V={data:q,next:null};if(this.length>0)this.tail.next=V;else this.head=V;this.tail=V,++this.length},$.prototype.unshift=function(q){var V={data:q,next:this.head};if(this.length===0)this.tail=V;this.head=V,++this.length},$.prototype.shift=function(){if(this.length===0)return;var q=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,q},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(q){if(this.length===0)return"";var V=this.head,Y=""+V.data;while(V=V.next)Y+=q+V.data;return Y},$.prototype.concat=function(q){if(this.length===0)return _q.alloc(0);var V=_q.allocUnsafe(q>>>0),Y=this.head,X=0;while(Y)YX(Y.data,V,X),X+=Y.data.length,Y=Y.next;return V},$}();if(z$&&z$.inspect&&z$.inspect.custom)r8.exports.prototype[z$.inspect.custom]=function(){var $=z$.inspect({length:this.length});return this.constructor.name+" "+$}});var a8=w((TH,bq)=>{var C6=j$();function XX($,Q){var q=this,V=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(V||Y){if(Q)Q($);else if($){if(!this._writableState)C6.nextTick(w6,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,C6.nextTick(w6,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(X){if(!Q&&X){if(!q._writableState)C6.nextTick(w6,q,X);else if(!q._writableState.errorEmitted)q._writableState.errorEmitted=!0,C6.nextTick(w6,q,X)}else if(Q)Q(X)}),this}function GX(){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 w6($,Q){$.emit("error",Q)}bq.exports={destroy:XX,undestroy:GX}});var cq=w((FH,mq)=>{mq.exports=l("util").deprecate});var t8=w((RH,rq)=>{var z0=j$();rq.exports=o;function uq($){var Q=this;this.next=null,this.entry=null,this.finish=function(){TX(Q,$)}}var KX=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:z0.nextTick,k0;o.WritableState=P$;var dq=Object.create(y0());dq.inherits=g0();var WX={deprecate:cq()},lq=l("stream"),T6=Z$().Buffer,UX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function jX($){return T6.from($)}function ZX($){return T6.isBuffer($)||$ instanceof UX}var oq=a8();dq.inherits(o,lq);function zX(){}function P$($,Q){k0=k0||H0(),$=$||{};var q=Q instanceof k0;if(this.objectMode=!!$.objectMode,q)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:V,writableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(V||V===0)this.highWaterMark=V;else if(q&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var J=$.decodeStrings===!1;this.decodeStrings=!J,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){MX(Q,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new uq(this)}P$.prototype.getBuffer=function(){var Q=this.bufferedRequest,q=[];while(Q)q.push(Q),Q=Q.next;return q};(function(){try{Object.defineProperty(P$.prototype,"buffer",{get:WX.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var A6;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")A6=Function.prototype[Symbol.hasInstance],Object.defineProperty(o,Symbol.hasInstance,{value:function($){if(A6.call(this,$))return!0;if(this!==o)return!1;return $&&$._writableState instanceof P$}});else A6=function($){return $ instanceof this};function o($){if(k0=k0||H0(),!A6.call(o,this)&&!(this instanceof k0))return new o($);if(this._writableState=new P$($,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}lq.call(this)}o.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function HX($,Q){var q=Error("write after end");$.emit("error",q),z0.nextTick(Q,q)}function PX($,Q,q,V){var Y=!0,X=!1;if(q===null)X=TypeError("May not write null values to stream");else if(typeof q!=="string"&&q!==void 0&&!Q.objectMode)X=TypeError("Invalid non-string/buffer chunk");if(X)$.emit("error",X),z0.nextTick(V,X),Y=!1;return Y}o.prototype.write=function($,Q,q){var V=this._writableState,Y=!1,X=!V.objectMode&&ZX($);if(X&&!T6.isBuffer($))$=jX($);if(typeof Q==="function")q=Q,Q=null;if(X)Q="buffer";else if(!Q)Q=V.defaultEncoding;if(typeof q!=="function")q=zX;if(V.ended)HX(this,q);else if(X||PX(this,V,$,q))V.pendingcb++,Y=OX(this,V,X,$,Q,q);return Y};o.prototype.cork=function(){var $=this._writableState;$.corked++};o.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)iq(this,$)}};o.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 LX($,Q,q){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=T6.from(Q,q);return Q}Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function OX($,Q,q,V,Y,X){if(!q){var J=LX(Q,V,Y);if(V!==J)q=!0,Y="buffer",V=J}var G=Q.objectMode?1:V.length;Q.length+=G;var U=Q.length<Q.highWaterMark;if(!U)Q.needDrain=!0;if(Q.writing||Q.corked){var K=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:V,encoding:Y,isBuf:q,callback:X,next:null},K)K.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else s8($,Q,!1,G,V,Y,X);return U}function s8($,Q,q,V,Y,X,J){if(Q.writelen=V,Q.writecb=J,Q.writing=!0,Q.sync=!0,q)$._writev(Y,Q.onwrite);else $._write(Y,X,Q.onwrite);Q.sync=!1}function BX($,Q,q,V,Y){if(--Q.pendingcb,q)z0.nextTick(Y,V),z0.nextTick(H$,$,Q),$._writableState.errorEmitted=!0,$.emit("error",V);else Y(V),$._writableState.errorEmitted=!0,$.emit("error",V),H$($,Q)}function NX($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function MX($,Q){var q=$._writableState,V=q.sync,Y=q.writecb;if(NX(q),Q)BX($,q,V,Q,Y);else{var X=nq(q);if(!X&&!q.corked&&!q.bufferProcessing&&q.bufferedRequest)iq($,q);if(V)KX(pq,$,q,X,Y);else pq($,q,X,Y)}}function pq($,Q,q,V){if(!q)IX($,Q);Q.pendingcb--,V(),H$($,Q)}function IX($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function iq($,Q){Q.bufferProcessing=!0;var q=Q.bufferedRequest;if($._writev&&q&&q.next){var V=Q.bufferedRequestCount,Y=Array(V),X=Q.corkedRequestsFree;X.entry=q;var J=0,G=!0;while(q){if(Y[J]=q,!q.isBuf)G=!1;q=q.next,J+=1}if(Y.allBuffers=G,s8($,Q,!0,Q.length,Y,"",X.finish),Q.pendingcb++,Q.lastBufferedRequest=null,X.next)Q.corkedRequestsFree=X.next,X.next=null;else Q.corkedRequestsFree=new uq(Q);Q.bufferedRequestCount=0}else{while(q){var{chunk:U,encoding:K,callback:W}=q,Z=Q.objectMode?1:U.length;if(s8($,Q,!1,Z,U,K,W),q=q.next,Q.bufferedRequestCount--,Q.writing)break}if(q===null)Q.lastBufferedRequest=null}Q.bufferedRequest=q,Q.bufferProcessing=!1}o.prototype._write=function($,Q,q){q(Error("_write() is not implemented"))};o.prototype._writev=null;o.prototype.end=function($,Q,q){var V=this._writableState;if(typeof $==="function")q=$,$=null,Q=null;else if(typeof Q==="function")q=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(V.corked)V.corked=1,this.uncork();if(!V.ending)AX(this,V,q)};function nq($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function CX($,Q){$._final(function(q){if(Q.pendingcb--,q)$.emit("error",q);Q.prefinished=!0,$.emit("prefinish"),H$($,Q)})}function wX($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,z0.nextTick(CX,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function H$($,Q){var q=nq(Q);if(q){if(wX($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return q}function AX($,Q,q){if(Q.ending=!0,H$($,Q),q)if(Q.finished)z0.nextTick(q);else $.once("finish",q);Q.ended=!0,$.writable=!1}function TX($,Q,q){var V=$.entry;$.entry=null;while(V){var Y=V.callback;Q.pendingcb--,Y(q),V=V.next}Q.corkedRequestsFree.next=$}Object.defineProperty(o.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});o.prototype.destroy=oq.destroy;o.prototype._undestroy=oq.undestroy;o.prototype._destroy=function($,Q){this.end(),Q($)}});var H0=w((vH,eq)=>{var aq=j$(),FX=Object.keys||function($){var Q=[];for(var q in $)Q.push(q);return Q};eq.exports=u1;var sq=Object.create(y0());sq.inherits=g0();var tq=$5(),e8=t8();sq.inherits(u1,tq);{F6=FX(e8.prototype);for(L$=0;L$<F6.length;L$++)if(O$=F6[L$],!u1.prototype[O$])u1.prototype[O$]=e8.prototype[O$]}var F6,O$,L$;function u1($){if(!(this instanceof u1))return new u1($);if(tq.call(this,$),e8.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",RX)}Object.defineProperty(u1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function RX(){if(this.allowHalfOpen||this._writableState.ended)return;aq.nextTick(vX,this)}function vX($){$.end()}Object.defineProperty(u1.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function($){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=$,this._writableState.destroyed=$}});u1.prototype._destroy=function($,Q){this.push(null),this.end(),aq.nextTick(Q,$)}});var V5=w((pX)=>{var q5=Z$().Buffer,$V=q5.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 xX($){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 SX($){var Q=xX($);if(typeof Q!=="string"&&(q5.isEncoding===$V||!$V($)))throw Error("Unknown encoding: "+$);return Q||$}pX.StringDecoder=B$;function B$($){this.encoding=SX($);var Q;switch(this.encoding){case"utf16le":this.text=hX,this.end=_X,Q=4;break;case"utf8":this.fillLast=gX,Q=4;break;case"base64":this.text=fX,this.end=bX,Q=3;break;default:this.write=mX,this.end=cX;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=q5.allocUnsafe(Q)}B$.prototype.write=function($){if($.length===0)return"";var Q,q;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";q=this.lastNeed,this.lastNeed=0}else q=0;if(q<$.length)return Q?Q+this.text($,q):this.text($,q);return Q||""};B$.prototype.end=DX;B$.prototype.text=kX;B$.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 Q5($){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 EX($,Q,q){var V=Q.length-1;if(V<q)return 0;var Y=Q5(Q[V]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--V<q||Y===-2)return 0;if(Y=Q5(Q[V]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--V<q||Y===-2)return 0;if(Y=Q5(Q[V]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function yX($,Q,q){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 gX($){var Q=this.lastTotal-this.lastNeed,q=yX(this,$,Q);if(q!==void 0)return q;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 kX($,Q){var q=EX(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=q;var V=$.length-(q-this.lastNeed);return $.copy(this.lastChar,0,V),$.toString("utf8",Q,V)}function DX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function hX($,Q){if(($.length-Q)%2===0){var q=$.toString("utf16le",Q);if(q){var V=q.charCodeAt(q.length-1);if(V>=55296&&V<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],q.slice(0,-1)}return q}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function _X($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var q=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,q)}return Q}function fX($,Q){var q=($.length-Q)%3;if(q===0)return $.toString("base64",Q);if(this.lastNeed=3-q,this.lastTotal=3,q===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-q)}function bX($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function mX($){return $.toString(this.encoding)}function cX($){return $&&$.length?this.write($):""}});var $5=w((EH,ZV)=>{var h0=j$();ZV.exports=_;var dX=gq(),N$;_.ReadableState=GV;var SH=l("events").EventEmitter,JV=function($,Q){return $.listeners(Q).length},K5=l("stream"),M$=Z$().Buffer,lX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function oX($){return M$.from($)}function iX($){return M$.isBuffer($)||$ instanceof lX}var YV=Object.create(y0());YV.inherits=g0();var J5=l("util"),y=void 0;if(J5&&J5.debuglog)y=J5.debuglog("stream");else y=function(){};var nX=fq(),XV=a8(),D0;YV.inherits(_,K5);var Y5=["error","close","destroy","pause","resume"];function rX($,Q,q){if(typeof $.prependListener==="function")return $.prependListener(Q,q);if(!$._events||!$._events[Q])$.on(Q,q);else if(dX($._events[Q]))$._events[Q].unshift(q);else $._events[Q]=[q,$._events[Q]]}function GV($,Q){N$=N$||H0(),$=$||{};var q=Q instanceof N$;if(this.objectMode=!!$.objectMode,q)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:V,readableHighWaterMark:Y}=$,X=this.objectMode?16:16384;if(V||V===0)this.highWaterMark=V;else if(q&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=X;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new nX,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(!D0)D0=V5().StringDecoder;this.decoder=new D0($.encoding),this.encoding=$.encoding}}function _($){if(N$=N$||H0(),!(this instanceof _))return new _($);if(this._readableState=new GV($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}K5.call(this)}Object.defineProperty(_.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});_.prototype.destroy=XV.destroy;_.prototype._undestroy=XV.undestroy;_.prototype._destroy=function($,Q){this.push(null),Q($)};_.prototype.push=function($,Q){var q=this._readableState,V;if(!q.objectMode){if(typeof $==="string"){if(Q=Q||q.defaultEncoding,Q!==q.encoding)$=M$.from($,Q),Q="";V=!0}}else V=!0;return KV(this,$,Q,!1,V)};_.prototype.unshift=function($){return KV(this,$,null,!0,!1)};function KV($,Q,q,V,Y){var X=$._readableState;if(Q===null)X.reading=!1,eX($,X);else{var J;if(!Y)J=aX(X,Q);if(J)$.emit("error",J);else if(X.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!X.objectMode&&Object.getPrototypeOf(Q)!==M$.prototype)Q=oX(Q);if(V)if(X.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else X5($,X,Q,!0);else if(X.ended)$.emit("error",Error("stream.push() after EOF"));else if(X.reading=!1,X.decoder&&!q)if(Q=X.decoder.write(Q),X.objectMode||Q.length!==0)X5($,X,Q,!1);else WV($,X);else X5($,X,Q,!1)}else if(!V)X.reading=!1}return sX(X)}function X5($,Q,q,V){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",q),$.read(0);else{if(Q.length+=Q.objectMode?1:q.length,V)Q.buffer.unshift(q);else Q.buffer.push(q);if(Q.needReadable)R6($)}WV($,Q)}function aX($,Q){var q;if(!iX(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)q=TypeError("Invalid non-string/buffer chunk");return q}function sX($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}_.prototype.isPaused=function(){return this._readableState.flowing===!1};_.prototype.setEncoding=function($){if(!D0)D0=V5().StringDecoder;return this._readableState.decoder=new D0($),this._readableState.encoding=$,this};var QV=8388608;function tX($){if($>=QV)$=QV;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function qV($,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=tX($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}_.prototype.read=function($){y("read",$),$=parseInt($,10);var Q=this._readableState,q=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(y("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)G5(this);else R6(this);return null}if($=qV($,Q),$===0&&Q.ended){if(Q.length===0)G5(this);return null}var V=Q.needReadable;if(y("need readable",V),Q.length===0||Q.length-$<Q.highWaterMark)V=!0,y("length less than watermark",V);if(Q.ended||Q.reading)V=!1,y("reading or ended",V);else if(V){if(y("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=qV(q,Q)}var Y;if($>0)Y=UV($,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(q!==$&&Q.ended)G5(this)}if(Y!==null)this.emit("data",Y);return Y};function eX($,Q){if(Q.ended)return;if(Q.decoder){var q=Q.decoder.end();if(q&&q.length)Q.buffer.push(q),Q.length+=Q.objectMode?1:q.length}Q.ended=!0,R6($)}function R6($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(y("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)h0.nextTick(VV,$);else VV($)}function VV($){y("emit readable"),$.emit("readable"),W5($)}function WV($,Q){if(!Q.readingMore)Q.readingMore=!0,h0.nextTick($3,$,Q)}function $3($,Q){var q=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(y("maybeReadMore read 0"),$.read(0),q===Q.length)break;else q=Q.length;Q.readingMore=!1}_.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};_.prototype.pipe=function($,Q){var q=this,V=this._readableState;switch(V.pipesCount){case 0:V.pipes=$;break;case 1:V.pipes=[V.pipes,$];break;default:V.pipes.push($);break}V.pipesCount+=1,y("pipe count=%d opts=%j",V.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,X=Y?G:I;if(V.endEmitted)h0.nextTick(X);else q.once("end",X);$.on("unpipe",J);function J(M,L){if(y("onunpipe"),M===q){if(L&&L.hasUnpiped===!1)L.hasUnpiped=!0,W()}}function G(){y("onend"),$.end()}var U=Q3(q);$.on("drain",U);var K=!1;function W(){if(y("cleanup"),$.removeListener("close",C),$.removeListener("finish",P),$.removeListener("drain",U),$.removeListener("error",H),$.removeListener("unpipe",J),q.removeListener("end",G),q.removeListener("end",I),q.removeListener("data",z),K=!0,V.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var Z=!1;q.on("data",z);function z(M){y("ondata"),Z=!1;var L=$.write(M);if(L===!1&&!Z){if((V.pipesCount===1&&V.pipes===$||V.pipesCount>1&&jV(V.pipes,$)!==-1)&&!K)y("false write response, pause",V.awaitDrain),V.awaitDrain++,Z=!0;q.pause()}}function H(M){if(y("onerror",M),I(),$.removeListener("error",H),JV($,"error")===0)$.emit("error",M)}rX($,"error",H);function C(){$.removeListener("finish",P),I()}$.once("close",C);function P(){y("onfinish"),$.removeListener("close",C),I()}$.once("finish",P);function I(){y("unpipe"),q.unpipe($)}if($.emit("pipe",q),!V.flowing)y("pipe resume"),q.resume();return $};function Q3($){return function(){var Q=$._readableState;if(y("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&JV($,"data"))Q.flowing=!0,W5($)}}_.prototype.unpipe=function($){var Q=this._readableState,q={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,q);return this}if(!$){var{pipes:V,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var X=0;X<Y;X++)V[X].emit("unpipe",this,{hasUnpiped:!1});return this}var J=jV(Q.pipes,$);if(J===-1)return this;if(Q.pipes.splice(J,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,q),this};_.prototype.on=function($,Q){var q=K5.prototype.on.call(this,$,Q);if($==="data"){if(this._readableState.flowing!==!1)this.resume()}else if($==="readable"){var V=this._readableState;if(!V.endEmitted&&!V.readableListening){if(V.readableListening=V.needReadable=!0,V.emittedReadable=!1,!V.reading)h0.nextTick(q3,this);else if(V.length)R6(this)}}return q};_.prototype.addListener=_.prototype.on;function q3($){y("readable nexttick read 0"),$.read(0)}_.prototype.resume=function(){var $=this._readableState;if(!$.flowing)y("resume"),$.flowing=!0,V3(this,$);return this};function V3($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,h0.nextTick(J3,$,Q)}function J3($,Q){if(!Q.reading)y("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),W5($),Q.flowing&&!Q.reading)$.read(0)}_.prototype.pause=function(){if(y("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)y("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function W5($){var Q=$._readableState;y("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}_.prototype.wrap=function($){var Q=this,q=this._readableState,V=!1;$.on("end",function(){if(y("wrapped end"),q.decoder&&!q.ended){var J=q.decoder.end();if(J&&J.length)Q.push(J)}Q.push(null)}),$.on("data",function(J){if(y("wrapped data"),q.decoder)J=q.decoder.write(J);if(q.objectMode&&(J===null||J===void 0))return;else if(!q.objectMode&&(!J||!J.length))return;var G=Q.push(J);if(!G)V=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(J){return function(){return $[J].apply($,arguments)}}(Y);for(var X=0;X<Y5.length;X++)$.on(Y5[X],this.emit.bind(this,Y5[X]));return this._read=function(J){if(y("wrapped _read",J),V)V=!1,$.resume()},this};Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});_._fromList=UV;function UV($,Q){if(Q.length===0)return null;var q;if(Q.objectMode)q=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)q=Q.buffer.join("");else if(Q.buffer.length===1)q=Q.buffer.head.data;else q=Q.buffer.concat(Q.length);Q.buffer.clear()}else q=Y3($,Q.buffer,Q.decoder);return q}function Y3($,Q,q){var V;if($<Q.head.data.length)V=Q.head.data.slice(0,$),Q.head.data=Q.head.data.slice($);else if($===Q.head.data.length)V=Q.shift();else V=q?X3($,Q):G3($,Q);return V}function X3($,Q){var q=Q.head,V=1,Y=q.data;$-=Y.length;while(q=q.next){var X=q.data,J=$>X.length?X.length:$;if(J===X.length)Y+=X;else Y+=X.slice(0,$);if($-=J,$===0){if(J===X.length)if(++V,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=X.slice(J);break}++V}return Q.length-=V,Y}function G3($,Q){var q=M$.allocUnsafe($),V=Q.head,Y=1;V.data.copy(q),$-=V.data.length;while(V=V.next){var X=V.data,J=$>X.length?X.length:$;if(X.copy(q,q.length-$,0,J),$-=J,$===0){if(J===X.length)if(++Y,V.next)Q.head=V.next;else Q.head=Q.tail=null;else Q.head=V,V.data=X.slice(J);break}++Y}return Q.length-=Y,q}function G5($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,h0.nextTick(K3,Q,$)}function K3($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function jV($,Q){for(var q=0,V=$.length;q<V;q++)if($[q]===Q)return q;return-1}});var U5=w((yH,PV)=>{PV.exports=d1;var v6=H0(),HV=Object.create(y0());HV.inherits=g0();HV.inherits(d1,v6);function W3($,Q){var q=this._transformState;q.transforming=!1;var V=q.writecb;if(!V)return this.emit("error",Error("write callback called multiple times"));if(q.writechunk=null,q.writecb=null,Q!=null)this.push(Q);V($);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function d1($){if(!(this instanceof d1))return new d1($);if(v6.call(this,$),this._transformState={afterTransform:W3.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",U3)}function U3(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,q){zV($,Q,q)});else zV(this,null,null)}d1.prototype.push=function($,Q){return this._transformState.needTransform=!1,v6.prototype.push.call(this,$,Q)};d1.prototype._transform=function($,Q,q){throw Error("_transform() is not implemented")};d1.prototype._write=function($,Q,q){var V=this._transformState;if(V.writecb=q,V.writechunk=$,V.writeencoding=Q,!V.transforming){var Y=this._readableState;if(V.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};d1.prototype._read=function($){var Q=this._transformState;if(Q.writechunk!==null&&Q.writecb&&!Q.transforming)Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform);else Q.needTransform=!0};d1.prototype._destroy=function($,Q){var q=this;v6.prototype._destroy.call(this,$,function(V){Q(V),q.emit("close")})};function zV($,Q,q){if(Q)return $.emit("error",Q);if(q!=null)$.push(q);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 NV=w((gH,BV)=>{BV.exports=I$;var LV=U5(),OV=Object.create(y0());OV.inherits=g0();OV.inherits(I$,LV);function I$($){if(!(this instanceof I$))return new I$($);LV.call(this,$)}I$.prototype._transform=function($,Q,q){q(null,$)}});var j5=w((a,x6)=>{var E1=l("stream");if(process.env.READABLE_STREAM==="disable"&&E1)x6.exports=E1,a=x6.exports=E1.Readable,a.Readable=E1.Readable,a.Writable=E1.Writable,a.Duplex=E1.Duplex,a.Transform=E1.Transform,a.PassThrough=E1.PassThrough,a.Stream=E1;else a=x6.exports=$5(),a.Stream=E1||a,a.Readable=a,a.Writable=t8(),a.Duplex=H0(),a.Transform=U5(),a.PassThrough=NV()});var l1=w((Z3)=>{Z3.base64=!0;Z3.array=!0;Z3.string=!0;Z3.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";Z3.nodebuffer=typeof Buffer<"u";Z3.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")Z3.blob=!1;else{S6=new ArrayBuffer(0);try{Z3.blob=new Blob([S6],{type:"application/zip"}).size===0}catch($){try{z5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,E6=new z5,E6.append(S6),Z3.blob=E6.getBlob("application/zip").size===0}catch(Q){Z3.blob=!1}}}var S6,z5,E6;try{Z3.nodestream=!!j5().Readable}catch($){Z3.nodestream=!1}});var H5=w((I3)=>{var N3=m(),M3=l1(),y1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";I3.encode=function($){var Q=[],q,V,Y,X,J,G,U,K=0,W=$.length,Z=W,z=N3.getTypeOf($)!=="string";while(K<$.length){if(Z=W-K,!z)q=$.charCodeAt(K++),V=K<W?$.charCodeAt(K++):0,Y=K<W?$.charCodeAt(K++):0;else q=$[K++],V=K<W?$[K++]:0,Y=K<W?$[K++]:0;X=q>>2,J=(q&3)<<4|V>>4,G=Z>1?(V&15)<<2|Y>>6:64,U=Z>2?Y&63:64,Q.push(y1.charAt(X)+y1.charAt(J)+y1.charAt(G)+y1.charAt(U))}return Q.join("")};I3.decode=function($){var Q,q,V,Y,X,J,G,U=0,K=0,W="data:";if($.substr(0,W.length)===W)throw Error("Invalid base64 input, it looks like a data url.");$=$.replace(/[^A-Za-z0-9+/=]/g,"");var Z=$.length*3/4;if($.charAt($.length-1)===y1.charAt(64))Z--;if($.charAt($.length-2)===y1.charAt(64))Z--;if(Z%1!==0)throw Error("Invalid base64 input, bad content length.");var z;if(M3.uint8array)z=new Uint8Array(Z|0);else z=Array(Z|0);while(U<$.length){if(Y=y1.indexOf($.charAt(U++)),X=y1.indexOf($.charAt(U++)),J=y1.indexOf($.charAt(U++)),G=y1.indexOf($.charAt(U++)),Q=Y<<2|X>>4,q=(X&15)<<4|J>>2,V=(J&3)<<6|G,z[K++]=Q,J!==64)z[K++]=q;if(G!==64)z[K++]=V}return z}});var C$=w((hH,MV)=>{MV.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 wV=w((fH,CV)=>{var _H=global.MutationObserver||global.WebKitMutationObserver,IV;IV=function(){process.nextTick(v3)};var A3,T3,F3,R3,P5,w$=[];function v3(){P5=!0;var $,Q,q=w$.length;while(q){Q=w$,w$=[],$=-1;while(++$<q)Q[$]();q=w$.length}P5=!1}CV.exports=x3;function x3($){if(w$.push($)===1&&!P5)IV()}});var SV=w((bH,xV)=>{var AV=wV();function f0(){}var $1={},TV=["REJECTED"],L5=["FULFILLED"],FV=["PENDING"];_0=["UNHANDLED"];var _0;xV.exports=q0;function q0($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=FV,this.queue=[],this.outcome=void 0,this.handled=_0,$!==f0)RV(this,$)}q0.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(q,V);function q(Y){function X(){return Y}return Q.resolve($()).then(X)}function V(Y){function X(){throw Y}return Q.resolve($()).then(X)}};q0.prototype.catch=function($){return this.then(null,$)};q0.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===L5||typeof Q!=="function"&&this.state===TV)return this;var q=new this.constructor(f0);if(this.handled===_0)this.handled=null;if(this.state!==FV){var V=this.state===L5?$:Q;O5(q,V,this.outcome)}else this.queue.push(new A$(q,$,Q));return q};function A$($,Q,q){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof q==="function")this.onRejected=q,this.callRejected=this.otherCallRejected}A$.prototype.callFulfilled=function($){$1.resolve(this.promise,$)};A$.prototype.otherCallFulfilled=function($){O5(this.promise,this.onFulfilled,$)};A$.prototype.callRejected=function($){$1.reject(this.promise,$)};A$.prototype.otherCallRejected=function($){O5(this.promise,this.onRejected,$)};function O5($,Q,q){AV(function(){var V;try{V=Q(q)}catch(Y){return $1.reject($,Y)}if(V===$)$1.reject($,TypeError("Cannot resolve promise with itself"));else $1.resolve($,V)})}$1.resolve=function($,Q){var q=vV(S3,Q);if(q.status==="error")return $1.reject($,q.value);var V=q.value;if(V)RV($,V);else{$.state=L5,$.outcome=Q;var Y=-1,X=$.queue.length;while(++Y<X)$.queue[Y].callFulfilled(Q)}return $};$1.reject=function($,Q){if($.state=TV,$.outcome=Q,$.handled===_0)AV(function(){if($.handled===_0)process.emit("unhandledRejection",Q,$)});var q=-1,V=$.queue.length;while(++q<V)$.queue[q].callRejected(Q);return $};function S3($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function RV($,Q){var q=!1;function V(G){if(q)return;q=!0,$1.reject($,G)}function Y(G){if(q)return;q=!0,$1.resolve($,G)}function X(){Q(Y,V)}var J=vV(X);if(J.status==="error")V(J.value)}function vV($,Q){var q={};try{q.value=$(Q),q.status="success"}catch(V){q.status="error",q.value=V}return q}q0.resolve=E3;function E3($){if($ instanceof this)return $;return $1.resolve(new this(f0),$)}q0.reject=y3;function y3($){var Q=new this(f0);return $1.reject(Q,$)}q0.all=g3;function g3($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var q=$.length,V=!1;if(!q)return this.resolve([]);var Y=Array(q),X=0,J=-1,G=new this(f0);while(++J<q)U($[J],J);return G;function U(K,W){Q.resolve(K).then(Z,function(z){if(!V)V=!0,$1.reject(G,z)});function Z(z){if(Y[W]=z,++X===q&&!V)V=!0,$1.resolve(G,Y)}}}q0.race=k3;function k3($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var q=$.length,V=!1;if(!q)return this.resolve([]);var Y=-1,X=new this(f0);while(++Y<q)J($[Y]);return X;function J(G){Q.resolve(G).then(function(U){if(!V)V=!0,$1.resolve(X,U)},function(U){if(!V)V=!0,$1.reject(X,U)})}}});var b0=w((mH,EV)=>{var B5=null;if(typeof Promise<"u")B5=Promise;else B5=SV();EV.exports={Promise:B5}});var gV=w((yV)=>{(function($,Q){if($.setImmediate)return;var q=1,V={},Y=!1,X=$.document,J;function G(L){if(typeof L!=="function")L=Function(""+L);var A=Array(arguments.length-1);for(var B=0;B<A.length;B++)A[B]=arguments[B+1];var O={callback:L,args:A};return V[q]=O,J(q),q++}function U(L){delete V[L]}function K(L){var{callback:A,args:B}=L;switch(B.length){case 0:A();break;case 1:A(B[0]);break;case 2:A(B[0],B[1]);break;case 3:A(B[0],B[1],B[2]);break;default:A.apply(Q,B);break}}function W(L){if(Y)setTimeout(W,0,L);else{var A=V[L];if(A){Y=!0;try{K(A)}finally{U(L),Y=!1}}}}function Z(){J=function(L){process.nextTick(function(){W(L)})}}function z(){if($.postMessage&&!$.importScripts){var L=!0,A=$.onmessage;return $.onmessage=function(){L=!1},$.postMessage("","*"),$.onmessage=A,L}}function H(){var L="setImmediate$"+Math.random()+"$",A=function(B){if(B.source===$&&typeof B.data==="string"&&B.data.indexOf(L)===0)W(+B.data.slice(L.length))};if($.addEventListener)$.addEventListener("message",A,!1);else $.attachEvent("onmessage",A);J=function(B){$.postMessage(L+B,"*")}}function C(){var L=new MessageChannel;L.port1.onmessage=function(A){var B=A.data;W(B)},J=function(A){L.port2.postMessage(A)}}function P(){var L=X.documentElement;J=function(A){var B=X.createElement("script");B.onreadystatechange=function(){W(A),B.onreadystatechange=null,L.removeChild(B),B=null},L.appendChild(B)}}function I(){J=function(L){setTimeout(W,0,L)}}var M=Object.getPrototypeOf&&Object.getPrototypeOf($);if(M=M&&M.setTimeout?M:$,{}.toString.call($.process)==="[object process]")Z();else if(z())H();else if($.MessageChannel)C();else if(X&&"onreadystatechange"in X.createElement("script"))P();else I();M.setImmediate=G,M.clearImmediate=U})(typeof self>"u"?typeof global>"u"?yV:global:self)});var m=w((_3)=>{var V0=l1(),D3=H5(),m0=C$(),N5=b0();gV();function h3($){var Q=null;if(V0.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return g6($,Q)}_3.newBlob=function($,Q){_3.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,V=new q;return V.append($),V.getBlob(Q)}catch(X){throw Error("Bug : can't construct the Blob.")}}};function T$($){return $}function g6($,Q){for(var q=0;q<$.length;++q)Q[q]=$.charCodeAt(q)&255;return Q}var y6={stringifyByChunk:function($,Q,q){var V=[],Y=0,X=$.length;if(X<=q)return String.fromCharCode.apply(null,$);while(Y<X){if(Q==="array"||Q==="nodebuffer")V.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+q,X))));else V.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+q,X))));Y+=q}return V.join("")},stringifyByChar:function($){var Q="";for(var q=0;q<$.length;q++)Q+=String.fromCharCode($[q]);return Q},applyCanBeUsed:{uint8array:function(){try{return V0.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return V0.nodebuffer&&String.fromCharCode.apply(null,m0.allocBuffer(1)).length===1}catch($){return!1}}()}};function F$($){var Q=65536,q=_3.getTypeOf($),V=!0;if(q==="uint8array")V=y6.applyCanBeUsed.uint8array;else if(q==="nodebuffer")V=y6.applyCanBeUsed.nodebuffer;if(V)while(Q>1)try{return y6.stringifyByChunk($,q,Q)}catch(Y){Q=Math.floor(Q/2)}return y6.stringifyByChar($)}_3.applyFromCharCode=F$;function k6($,Q){for(var q=0;q<$.length;q++)Q[q]=$[q];return Q}var J0={};J0.string={string:T$,array:function($){return g6($,Array($.length))},arraybuffer:function($){return J0.string.uint8array($).buffer},uint8array:function($){return g6($,new Uint8Array($.length))},nodebuffer:function($){return g6($,m0.allocBuffer($.length))}};J0.array={string:F$,array:T$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return m0.newBufferFrom($)}};J0.arraybuffer={string:function($){return F$(new Uint8Array($))},array:function($){return k6(new Uint8Array($),Array($.byteLength))},arraybuffer:T$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return m0.newBufferFrom(new Uint8Array($))}};J0.uint8array={string:F$,array:function($){return k6($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:T$,nodebuffer:function($){return m0.newBufferFrom($)}};J0.nodebuffer={string:F$,array:function($){return k6($,Array($.length))},arraybuffer:function($){return J0.nodebuffer.uint8array($).buffer},uint8array:function($){return k6($,new Uint8Array($.length))},nodebuffer:T$};_3.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;_3.checkSupport($);var q=_3.getTypeOf(Q),V=J0[q][$](Q);return V};_3.resolve=function($){var Q=$.split("/"),q=[];for(var V=0;V<Q.length;V++){var Y=Q[V];if(Y==="."||Y===""&&V!==0&&V!==Q.length-1)continue;else if(Y==="..")q.pop();else q.push(Y)}return q.join("/")};_3.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(V0.nodebuffer&&m0.isBuffer($))return"nodebuffer";if(V0.uint8array&&$ instanceof Uint8Array)return"uint8array";if(V0.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};_3.checkSupport=function($){var Q=V0[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};_3.MAX_VALUE_16BITS=65535;_3.MAX_VALUE_32BITS=-1;_3.pretty=function($){var Q="",q,V;for(V=0;V<($||"").length;V++)q=$.charCodeAt(V),Q+="\\x"+(q<16?"0":"")+q.toString(16).toUpperCase();return Q};_3.delay=function($,Q,q){setImmediate(function(){$.apply(q||null,Q||[])})};_3.inherits=function($,Q){var q=function(){};q.prototype=Q.prototype,$.prototype=new q};_3.extend=function(){var $={},Q,q;for(Q=0;Q<arguments.length;Q++)for(q in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],q)&&typeof $[q]>"u")$[q]=arguments[Q][q];return $};_3.prepareContent=function($,Q,q,V,Y){var X=N5.Promise.resolve(Q).then(function(J){var G=V0.blob&&(J instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(J))!==-1);if(G&&typeof FileReader<"u")return new N5.Promise(function(U,K){var W=new FileReader;W.onload=function(Z){U(Z.target.result)},W.onerror=function(Z){K(Z.target.error)},W.readAsArrayBuffer(J)});else return J});return X.then(function(J){var G=_3.getTypeOf(J);if(!G)return N5.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(G==="arraybuffer")J=_3.transformTo("uint8array",J);else if(G==="string"){if(Y)J=D3.decode(J);else if(q){if(V!==!0)J=h3(J)}}return J})}});var j1=w((uH,_V)=>{function hV($){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}hV.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 q=0;q<this._listeners[$].length;q++)this._listeners[$][q].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(q){Q.processChunk(q)}),$.on("end",function(){Q.end()}),$.on("error",function(q){Q.error(q)}),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 $}};_V.exports=hV});var p0=w((t3)=>{var c0=m(),P0=l1(),n3=C$(),D6=j1(),R$=Array(256);for(g1=0;g1<256;g1++)R$[g1]=g1>=252?6:g1>=248?5:g1>=240?4:g1>=224?3:g1>=192?2:1;var g1;R$[254]=R$[254]=1;var r3=function($){var Q,q,V,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}G+=q<128?1:q<2048?2:q<65536?3:4}if(P0.uint8array)Q=new Uint8Array(G);else Q=Array(G);for(X=0,Y=0;X<G;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}if(q<128)Q[X++]=q;else if(q<2048)Q[X++]=192|q>>>6,Q[X++]=128|q&63;else if(q<65536)Q[X++]=224|q>>>12,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63;else Q[X++]=240|q>>>18,Q[X++]=128|q>>>12&63,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63}return Q},a3=function($,Q){var q;if(Q=Q||$.length,Q>$.length)Q=$.length;q=Q-1;while(q>=0&&($[q]&192)===128)q--;if(q<0)return Q;if(q===0)return Q;return q+R$[$[q]]>Q?q:Q},s3=function($){var Q,q,V,Y,X=$.length,J=Array(X*2);for(q=0,Q=0;Q<X;){if(V=$[Q++],V<128){J[q++]=V;continue}if(Y=R$[V],Y>4){J[q++]=65533,Q+=Y-1;continue}V&=Y===2?31:Y===3?15:7;while(Y>1&&Q<X)V=V<<6|$[Q++]&63,Y--;if(Y>1){J[q++]=65533;continue}if(V<65536)J[q++]=V;else V-=65536,J[q++]=55296|V>>10&1023,J[q++]=56320|V&1023}if(J.length!==q)if(J.subarray)J=J.subarray(0,q);else J.length=q;return c0.applyFromCharCode(J)};t3.utf8encode=function(Q){if(P0.nodebuffer)return n3.newBufferFrom(Q,"utf-8");return r3(Q)};t3.utf8decode=function(Q){if(P0.nodebuffer)return c0.transformTo("nodebuffer",Q).toString("utf-8");return Q=c0.transformTo(P0.uint8array?"uint8array":"array",Q),s3(Q)};function h6(){D6.call(this,"utf-8 decode"),this.leftOver=null}c0.inherits(h6,D6);h6.prototype.processChunk=function($){var Q=c0.transformTo(P0.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if(P0.uint8array){var q=Q;Q=new Uint8Array(q.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(q,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var V=a3(Q),Y=Q;if(V!==Q.length)if(P0.uint8array)Y=Q.subarray(0,V),this.leftOver=Q.subarray(V,Q.length);else Y=Q.slice(0,V),this.leftOver=Q.slice(V,Q.length);this.push({data:t3.utf8decode(Y),meta:$.meta})};h6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:t3.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};t3.Utf8DecodeWorker=h6;function I5(){D6.call(this,"utf-8 encode")}c0.inherits(I5,D6);I5.prototype.processChunk=function($){this.push({data:t3.utf8encode($.data),meta:$.meta})};t3.Utf8EncodeWorker=I5});var pV=w((lH,cV)=>{var bV=j1(),mV=m();function w5($){bV.call(this,"ConvertWorker to "+$),this.destType=$}mV.inherits(w5,bV);w5.prototype.processChunk=function($){this.push({data:mV.transformTo(this.destType,$.data),meta:$.meta})};cV.exports=w5});var lV=w((oH,dV)=>{var uV=j5().Readable,QG=m();QG.inherits(A5,uV);function A5($,Q,q){uV.call(this,Q),this._helper=$;var V=this;$.on("data",function(Y,X){if(!V.push(Y))V._helper.pause();if(q)q(X)}).on("error",function(Y){V.emit("error",Y)}).on("end",function(){V.push(null)})}A5.prototype._read=function(){this._helper.resume()};dV.exports=A5});var T5=w((iH,nV)=>{var L0=m(),qG=pV(),VG=j1(),JG=H5(),YG=l1(),XG=b0(),oV=null;if(YG.nodestream)try{oV=lV()}catch($){}function GG($,Q,q){switch($){case"blob":return L0.newBlob(L0.transformTo("arraybuffer",Q),q);case"base64":return JG.encode(Q);default:return L0.transformTo($,Q)}}function KG($,Q){var q,V=0,Y=null,X=0;for(q=0;q<Q.length;q++)X+=Q[q].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(X);for(q=0;q<Q.length;q++)Y.set(Q[q],V),V+=Q[q].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function WG($,Q){return new XG.Promise(function(q,V){var Y=[],X=$._internalType,J=$._outputType,G=$._mimeType;$.on("data",function(U,K){if(Y.push(U),Q)Q(K)}).on("error",function(U){Y=[],V(U)}).on("end",function(){try{var U=GG(J,KG(X,Y),G);q(U)}catch(K){V(K)}Y=[]}).resume()})}function iV($,Q,q){var V=Q;switch(Q){case"blob":case"arraybuffer":V="uint8array";break;case"base64":V="string";break}try{this._internalType=V,this._outputType=Q,this._mimeType=q,L0.checkSupport(V),this._worker=$.pipe(new qG(V)),$.lock()}catch(Y){this._worker=new VG("error"),this._worker.error(Y)}}iV.prototype={accumulate:function($){return WG(this,$)},on:function($,Q){var q=this;if($==="data")this._worker.on($,function(V){Q.call(q,V.data,V.meta)});else this._worker.on($,function(){L0.delay(Q,arguments,q)});return this},resume:function(){return L0.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(L0.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new oV(this,{objectMode:this._outputType!=="nodebuffer"},$)}};nV.exports=iV});var F5=w((UG)=>{UG.base64=!1;UG.binary=!1;UG.dir=!1;UG.createFolders=!0;UG.date=null;UG.compression=null;UG.compressionOptions=null;UG.comment=null;UG.unixPermissions=null;UG.dosPermissions=null});var R5=w((rH,rV)=>{var _6=m(),f6=j1(),IG=16384;function u0($){f6.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(q){if(Q.dataIsReady=!0,Q.data=q,Q.max=q&&q.length||0,Q.type=_6.getTypeOf(q),!Q.isPaused)Q._tickAndRepeat()},function(q){Q.error(q)})}_6.inherits(u0,f6);u0.prototype.cleanUp=function(){f6.prototype.cleanUp.call(this),this.data=null};u0.prototype.resume=function(){if(!f6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,_6.delay(this._tickAndRepeat,[],this);return!0};u0.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)_6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};u0.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=IG,Q=null,q=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,q);break;case"uint8array":Q=this.data.subarray(this.index,q);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,q);break}return this.index=q,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};rV.exports=u0});var b6=w((aH,sV)=>{var CG=m();function wG(){var $,Q=[];for(var q=0;q<256;q++){$=q;for(var V=0;V<8;V++)$=$&1?3988292384^$>>>1:$>>>1;Q[q]=$}return Q}var aV=wG();function AG($,Q,q,V){var Y=aV,X=V+q;$=$^-1;for(var J=V;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}function TG($,Q,q,V){var Y=aV,X=V+q;$=$^-1;for(var J=V;J<X;J++)$=$>>>8^Y[($^Q.charCodeAt(J))&255];return $^-1}sV.exports=function(Q,q){if(typeof Q>"u"||!Q.length)return 0;var V=CG.getTypeOf(Q)!=="string";if(V)return AG(q|0,Q,Q.length,0);else return TG(q|0,Q,Q.length,0)}});var x5=w((sH,eV)=>{var tV=j1(),FG=b6(),RG=m();function v5(){tV.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}RG.inherits(v5,tV);v5.prototype.processChunk=function($){this.streamInfo.crc32=FG($.data,this.streamInfo.crc32||0),this.push($)};eV.exports=v5});var Q9=w((tH,$9)=>{var vG=m(),S5=j1();function E5($){S5.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}vG.inherits(E5,S5);E5.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}S5.prototype.processChunk.call(this,$)};$9.exports=E5});var m6=w((eH,J9)=>{var q9=b0(),V9=R5(),xG=x5(),y5=Q9();function g5($,Q,q,V,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=q,this.compression=V,this.compressedContent=Y}g5.prototype={getContentWorker:function(){var $=new V9(q9.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new y5("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 V9(q9.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};g5.createWorkerFrom=function($,Q,q){return $.pipe(new xG).pipe(new y5("uncompressedSize")).pipe(Q.compressWorker(q)).pipe(new y5("compressedSize")).withStreamInfo("compression",Q)};J9.exports=g5});var K9=w(($P,G9)=>{var SG=T5(),EG=R5(),k5=p0(),D5=m6(),Y9=j1(),h5=function($,Q,q){this.name=$,this.dir=q.dir,this.date=q.date,this.comment=q.comment,this.unixPermissions=q.unixPermissions,this.dosPermissions=q.dosPermissions,this._data=Q,this._dataBinary=q.binary,this.options={compression:q.compression,compressionOptions:q.compressionOptions}};h5.prototype={internalStream:function($){var Q=null,q="string";try{if(!$)throw Error("No output type specified.");q=$.toLowerCase();var V=q==="string"||q==="text";if(q==="binarystring"||q==="text")q="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!V)Q=Q.pipe(new k5.Utf8EncodeWorker);if(!Y&&V)Q=Q.pipe(new k5.Utf8DecodeWorker)}catch(X){Q=new Y9("error"),Q.error(X)}return new SG(Q,q,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof D5&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var q=this._decompressWorker();if(!this._dataBinary)q=q.pipe(new k5.Utf8EncodeWorker);return D5.createWorkerFrom(q,$,Q)}},_decompressWorker:function(){if(this._data instanceof D5)return this._data.getContentWorker();else if(this._data instanceof Y9)return this._data;else return new EG(this._data)}};var X9=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],yG=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(v$=0;v$<X9.length;v$++)h5.prototype[X9[v$]]=yG;var v$;G9.exports=h5});var o1=w((_5)=>{var hG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function _G($,Q){return Object.prototype.hasOwnProperty.call($,Q)}_5.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var q=Q.shift();if(!q)continue;if(typeof q!=="object")throw TypeError(q+"must be non-object");for(var V in q)if(_G(q,V))$[V]=q[V]}return $};_5.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var fG={arraySet:function($,Q,q,V,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(q,q+V),Y);return}for(var X=0;X<V;X++)$[Y+X]=Q[q+X]},flattenChunks:function($){var Q,q,V,Y,X,J;V=0;for(Q=0,q=$.length;Q<q;Q++)V+=$[Q].length;J=new Uint8Array(V),Y=0;for(Q=0,q=$.length;Q<q;Q++)X=$[Q],J.set(X,Y),Y+=X.length;return J}},bG={arraySet:function($,Q,q,V,Y){for(var X=0;X<V;X++)$[Y+X]=Q[q+X]},flattenChunks:function($){return[].concat.apply([],$)}};_5.setTyped=function($){if($)_5.Buf8=Uint8Array,_5.Buf16=Uint16Array,_5.Buf32=Int32Array,_5.assign(_5,fG);else _5.Buf8=Array,_5.Buf16=Array,_5.Buf32=Array,_5.assign(_5,bG)};_5.setTyped(hG)});var y9=w((KK)=>{var cG=o1(),pG=4,U9=0,j9=1,uG=2;function l0($){var Q=$.length;while(--Q>=0)$[Q]=0}var dG=0,O9=1,lG=2,oG=3,iG=258,l5=29,k$=256,S$=k$+1+l5,d0=30,o5=19,B9=2*S$+1,O0=15,b5=16,nG=7,i5=256,N9=16,M9=17,I9=18,u5=[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],c6=[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],rG=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],C9=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],aG=512,i1=Array((S$+2)*2);l0(i1);var x$=Array(d0*2);l0(x$);var E$=Array(aG);l0(E$);var y$=Array(iG-oG+1);l0(y$);var n5=Array(l5);l0(n5);var p6=Array(d0);l0(p6);function m5($,Q,q,V,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=q,this.elems=V,this.max_length=Y,this.has_stree=$&&$.length}var w9,A9,T9;function c5($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function F9($){return $<256?E$[$]:E$[256+($>>>7)]}function g$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function G1($,Q,q){if($.bi_valid>b5-q)$.bi_buf|=Q<<$.bi_valid&65535,g$($,$.bi_buf),$.bi_buf=Q>>b5-$.bi_valid,$.bi_valid+=q-b5;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=q}function k1($,Q,q){G1($,q[Q*2],q[Q*2+1])}function R9($,Q){var q=0;do q|=$&1,$>>>=1,q<<=1;while(--Q>0);return q>>>1}function sG($){if($.bi_valid===16)g$($,$.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 tG($,Q){var{dyn_tree:q,max_code:V}=Q,Y=Q.stat_desc.static_tree,X=Q.stat_desc.has_stree,J=Q.stat_desc.extra_bits,G=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,K,W,Z,z,H,C,P=0;for(z=0;z<=O0;z++)$.bl_count[z]=0;q[$.heap[$.heap_max]*2+1]=0;for(K=$.heap_max+1;K<B9;K++){if(W=$.heap[K],z=q[q[W*2+1]*2+1]+1,z>U)z=U,P++;if(q[W*2+1]=z,W>V)continue;if($.bl_count[z]++,H=0,W>=G)H=J[W-G];if(C=q[W*2],$.opt_len+=C*(z+H),X)$.static_len+=C*(Y[W*2+1]+H)}if(P===0)return;do{z=U-1;while($.bl_count[z]===0)z--;$.bl_count[z]--,$.bl_count[z+1]+=2,$.bl_count[U]--,P-=2}while(P>0);for(z=U;z!==0;z--){W=$.bl_count[z];while(W!==0){if(Z=$.heap[--K],Z>V)continue;if(q[Z*2+1]!==z)$.opt_len+=(z-q[Z*2+1])*q[Z*2],q[Z*2+1]=z;W--}}}function v9($,Q,q){var V=Array(O0+1),Y=0,X,J;for(X=1;X<=O0;X++)V[X]=Y=Y+q[X-1]<<1;for(J=0;J<=Q;J++){var G=$[J*2+1];if(G===0)continue;$[J*2]=R9(V[G]++,G)}}function eG(){var $,Q,q,V,Y,X=Array(O0+1);q=0;for(V=0;V<l5-1;V++){n5[V]=q;for($=0;$<1<<u5[V];$++)y$[q++]=V}y$[q-1]=V,Y=0;for(V=0;V<16;V++){p6[V]=Y;for($=0;$<1<<c6[V];$++)E$[Y++]=V}Y>>=7;for(;V<d0;V++){p6[V]=Y<<7;for($=0;$<1<<c6[V]-7;$++)E$[256+Y++]=V}for(Q=0;Q<=O0;Q++)X[Q]=0;$=0;while($<=143)i1[$*2+1]=8,$++,X[8]++;while($<=255)i1[$*2+1]=9,$++,X[9]++;while($<=279)i1[$*2+1]=7,$++,X[7]++;while($<=287)i1[$*2+1]=8,$++,X[8]++;v9(i1,S$+1,X);for($=0;$<d0;$++)x$[$*2+1]=5,x$[$*2]=R9($,5);w9=new m5(i1,u5,k$+1,S$,O0),A9=new m5(x$,c6,0,d0,O0),T9=new m5([],rG,0,o5,nG)}function x9($){var Q;for(Q=0;Q<S$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<d0;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<o5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[i5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function S9($){if($.bi_valid>8)g$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function $K($,Q,q,V){if(S9($),V)g$($,q),g$($,~q);cG.arraySet($.pending_buf,$.window,Q,q,$.pending),$.pending+=q}function Z9($,Q,q,V){var Y=Q*2,X=q*2;return $[Y]<$[X]||$[Y]===$[X]&&V[Q]<=V[q]}function p5($,Q,q){var V=$.heap[q],Y=q<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&Z9(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(Z9(Q,V,$.heap[Y],$.depth))break;$.heap[q]=$.heap[Y],q=Y,Y<<=1}$.heap[q]=V}function z9($,Q,q){var V,Y,X=0,J,G;if($.last_lit!==0)do if(V=$.pending_buf[$.d_buf+X*2]<<8|$.pending_buf[$.d_buf+X*2+1],Y=$.pending_buf[$.l_buf+X],X++,V===0)k1($,Y,Q);else{if(J=y$[Y],k1($,J+k$+1,Q),G=u5[J],G!==0)Y-=n5[J],G1($,Y,G);if(V--,J=F9(V),k1($,J,q),G=c6[J],G!==0)V-=p6[J],G1($,V,G)}while(X<$.last_lit);k1($,i5,Q)}function d5($,Q){var q=Q.dyn_tree,V=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,X=Q.stat_desc.elems,J,G,U=-1,K;$.heap_len=0,$.heap_max=B9;for(J=0;J<X;J++)if(q[J*2]!==0)$.heap[++$.heap_len]=U=J,$.depth[J]=0;else q[J*2+1]=0;while($.heap_len<2)if(K=$.heap[++$.heap_len]=U<2?++U:0,q[K*2]=1,$.depth[K]=0,$.opt_len--,Y)$.static_len-=V[K*2+1];Q.max_code=U;for(J=$.heap_len>>1;J>=1;J--)p5($,q,J);K=X;do J=$.heap[1],$.heap[1]=$.heap[$.heap_len--],p5($,q,1),G=$.heap[1],$.heap[--$.heap_max]=J,$.heap[--$.heap_max]=G,q[K*2]=q[J*2]+q[G*2],$.depth[K]=($.depth[J]>=$.depth[G]?$.depth[J]:$.depth[G])+1,q[J*2+1]=q[G*2+1]=K,$.heap[1]=K++,p5($,q,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],tG($,Q),v9(q,U,$.bl_count)}function H9($,Q,q){var V,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;Q[(q+1)*2+1]=65535;for(V=0;V<=q;V++){if(X=J,J=Q[(V+1)*2+1],++G<U&&X===J)continue;else if(G<K)$.bl_tree[X*2]+=G;else if(X!==0){if(X!==Y)$.bl_tree[X*2]++;$.bl_tree[N9*2]++}else if(G<=10)$.bl_tree[M9*2]++;else $.bl_tree[I9*2]++;if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function P9($,Q,q){var V,Y=-1,X,J=Q[1],G=0,U=7,K=4;if(J===0)U=138,K=3;for(V=0;V<=q;V++){if(X=J,J=Q[(V+1)*2+1],++G<U&&X===J)continue;else if(G<K)do k1($,X,$.bl_tree);while(--G!==0);else if(X!==0){if(X!==Y)k1($,X,$.bl_tree),G--;k1($,N9,$.bl_tree),G1($,G-3,2)}else if(G<=10)k1($,M9,$.bl_tree),G1($,G-3,3);else k1($,I9,$.bl_tree),G1($,G-11,7);if(G=0,Y=X,J===0)U=138,K=3;else if(X===J)U=6,K=3;else U=7,K=4}}function QK($){var Q;H9($,$.dyn_ltree,$.l_desc.max_code),H9($,$.dyn_dtree,$.d_desc.max_code),d5($,$.bl_desc);for(Q=o5-1;Q>=3;Q--)if($.bl_tree[C9[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function qK($,Q,q,V){var Y;G1($,Q-257,5),G1($,q-1,5),G1($,V-4,4);for(Y=0;Y<V;Y++)G1($,$.bl_tree[C9[Y]*2+1],3);P9($,$.dyn_ltree,Q-1),P9($,$.dyn_dtree,q-1)}function VK($){var Q=4093624447,q;for(q=0;q<=31;q++,Q>>>=1)if(Q&1&&$.dyn_ltree[q*2]!==0)return U9;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return j9;for(q=32;q<k$;q++)if($.dyn_ltree[q*2]!==0)return j9;return U9}var L9=!1;function JK($){if(!L9)eG(),L9=!0;$.l_desc=new c5($.dyn_ltree,w9),$.d_desc=new c5($.dyn_dtree,A9),$.bl_desc=new c5($.bl_tree,T9),$.bi_buf=0,$.bi_valid=0,x9($)}function E9($,Q,q,V){G1($,(dG<<1)+(V?1:0),3),$K($,Q,q,!0)}function YK($){G1($,O9<<1,3),k1($,i5,i1),sG($)}function XK($,Q,q,V){var Y,X,J=0;if($.level>0){if($.strm.data_type===uG)$.strm.data_type=VK($);if(d5($,$.l_desc),d5($,$.d_desc),J=QK($),Y=$.opt_len+3+7>>>3,X=$.static_len+3+7>>>3,X<=Y)Y=X}else Y=X=q+5;if(q+4<=Y&&Q!==-1)E9($,Q,q,V);else if($.strategy===pG||X===Y)G1($,(O9<<1)+(V?1:0),3),z9($,i1,x$);else G1($,(lG<<1)+(V?1:0),3),qK($,$.l_desc.max_code+1,$.d_desc.max_code+1,J+1),z9($,$.dyn_ltree,$.dyn_dtree);if(x9($),V)S9($)}function GK($,Q,q){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]=q&255,$.last_lit++,Q===0)$.dyn_ltree[q*2]++;else $.matches++,Q--,$.dyn_ltree[(y$[q]+k$+1)*2]++,$.dyn_dtree[F9(Q)*2]++;return $.last_lit===$.lit_bufsize-1}KK._tr_init=JK;KK._tr_stored_block=E9;KK._tr_flush_block=XK;KK._tr_tally=GK;KK._tr_align=YK});var r5=w((VP,g9)=>{function HK($,Q,q,V){var Y=$&65535|0,X=$>>>16&65535|0,J=0;while(q!==0){J=q>2000?2000:q,q-=J;do Y=Y+Q[V++]|0,X=X+Y|0;while(--J);Y%=65521,X%=65521}return Y|X<<16|0}g9.exports=HK});var a5=w((JP,k9)=>{function PK(){var $,Q=[];for(var q=0;q<256;q++){$=q;for(var V=0;V<8;V++)$=$&1?3988292384^$>>>1:$>>>1;Q[q]=$}return Q}var LK=PK();function OK($,Q,q,V){var Y=LK,X=V+q;$^=-1;for(var J=V;J<X;J++)$=$>>>8^Y[($^Q[J])&255];return $^-1}k9.exports=OK});var u6=w((YP,D9)=>{D9.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 d9=w((aK)=>{var Y1=o1(),P1=y9(),b9=r5(),Y0=a5(),BK=u6(),I0=0,NK=1,MK=3,U0=4,h9=5,h1=0,_9=1,L1=-2,IK=-3,s5=-5,CK=-1,wK=1,d6=2,AK=3,TK=4,FK=0,RK=2,n6=8,vK=9,xK=15,SK=8,EK=29,yK=256,e5=yK+1+EK,gK=30,kK=19,DK=2*e5+1,hK=15,S=3,K0=258,R1=K0+S+1,_K=32,r6=42,$Q=69,l6=73,o6=91,i6=103,B0=113,h$=666,n=1,_$=2,N0=3,n0=4,fK=3;function W0($,Q){return $.msg=BK[Q],Q}function f9($){return($<<1)-($>4?9:0)}function G0($){var Q=$.length;while(--Q>=0)$[Q]=0}function X0($){var Q=$.state,q=Q.pending;if(q>$.avail_out)q=$.avail_out;if(q===0)return;if(Y1.arraySet($.output,Q.pending_buf,Q.pending_out,q,$.next_out),$.next_out+=q,Q.pending_out+=q,$.total_out+=q,$.avail_out-=q,Q.pending-=q,Q.pending===0)Q.pending_out=0}function s($,Q){P1._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,X0($.strm)}function E($,Q){$.pending_buf[$.pending++]=Q}function D$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function bK($,Q,q,V){var Y=$.avail_in;if(Y>V)Y=V;if(Y===0)return 0;if($.avail_in-=Y,Y1.arraySet(Q,$.input,$.next_in,Y,q),$.state.wrap===1)$.adler=b9($.adler,Q,Y,q);else if($.state.wrap===2)$.adler=Y0($.adler,Q,Y,q);return $.next_in+=Y,$.total_in+=Y,Y}function m9($,Q){var{max_chain_length:q,strstart:V}=$,Y,X,J=$.prev_length,G=$.nice_match,U=$.strstart>$.w_size-R1?$.strstart-($.w_size-R1):0,K=$.window,W=$.w_mask,Z=$.prev,z=$.strstart+K0,H=K[V+J-1],C=K[V+J];if($.prev_length>=$.good_match)q>>=2;if(G>$.lookahead)G=$.lookahead;do{if(Y=Q,K[Y+J]!==C||K[Y+J-1]!==H||K[Y]!==K[V]||K[++Y]!==K[V+1])continue;V+=2,Y++;do;while(K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&K[++V]===K[++Y]&&V<z);if(X=K0-(z-V),V=z-K0,X>J){if($.match_start=Q,J=X,X>=G)break;H=K[V+J-1],C=K[V+J]}}while((Q=Z[Q&W])>U&&--q!==0);if(J<=$.lookahead)return J;return $.lookahead}function M0($){var Q=$.w_size,q,V,Y,X,J;do{if(X=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-R1)){Y1.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,V=$.hash_size,q=V;do Y=$.head[--q],$.head[q]=Y>=Q?Y-Q:0;while(--V);V=Q,q=V;do Y=$.prev[--q],$.prev[q]=Y>=Q?Y-Q:0;while(--V);X+=Q}if($.strm.avail_in===0)break;if(V=bK($.strm,$.window,$.strstart+$.lookahead,X),$.lookahead+=V,$.lookahead+$.insert>=S){J=$.strstart-$.insert,$.ins_h=$.window[J],$.ins_h=($.ins_h<<$.hash_shift^$.window[J+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[J+S-1])&$.hash_mask,$.prev[J&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=J,J++,$.insert--,$.lookahead+$.insert<S)break}}while($.lookahead<R1&&$.strm.avail_in!==0)}function mK($,Q){var q=65535;if(q>$.pending_buf_size-5)q=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(M0($),$.lookahead===0&&Q===I0)return n;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var V=$.block_start+q;if($.strstart===0||$.strstart>=V){if($.lookahead=$.strstart-V,$.strstart=V,s($,!1),$.strm.avail_out===0)return n}if($.strstart-$.block_start>=$.w_size-R1){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return n0}if($.strstart>$.block_start){if(s($,!1),$.strm.avail_out===0)return n}return n}function t5($,Q){var q,V;for(;;){if($.lookahead<R1){if(M0($),$.lookahead<R1&&Q===I0)return n;if($.lookahead===0)break}if(q=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(q!==0&&$.strstart-q<=$.w_size-R1)$.match_length=m9($,q);if($.match_length>=S)if(V=P1._tr_tally($,$.strstart-$.match_start,$.match_length-S),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=S){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.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 V=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(V){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=$.strstart<S-1?$.strstart:S-1,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return n0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function o0($,Q){var q,V,Y;for(;;){if($.lookahead<R1){if(M0($),$.lookahead<R1&&Q===I0)return n;if($.lookahead===0)break}if(q=0,$.lookahead>=S)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=S-1,q!==0&&$.prev_length<$.max_lazy_match&&$.strstart-q<=$.w_size-R1){if($.match_length=m9($,q),$.match_length<=5&&($.strategy===wK||$.match_length===S&&$.strstart-$.match_start>4096))$.match_length=S-1}if($.prev_length>=S&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-S,V=P1._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-S),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+S-1])&$.hash_mask,q=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=S-1,$.strstart++,V){if(s($,!1),$.strm.avail_out===0)return n}}else if($.match_available){if(V=P1._tr_tally($,0,$.window[$.strstart-1]),V)s($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return n}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)V=P1._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<S-1?$.strstart:S-1,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return n0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function cK($,Q){var q,V,Y,X,J=$.window;for(;;){if($.lookahead<=K0){if(M0($),$.lookahead<=K0&&Q===I0)return n;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=S&&$.strstart>0){if(Y=$.strstart-1,V=J[Y],V===J[++Y]&&V===J[++Y]&&V===J[++Y]){X=$.strstart+K0;do;while(V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&V===J[++Y]&&Y<X);if($.match_length=K0-(X-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=S)q=P1._tr_tally($,1,$.match_length-S),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else q=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return n0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function pK($,Q){var q;for(;;){if($.lookahead===0){if(M0($),$.lookahead===0){if(Q===I0)return n;break}}if($.match_length=0,q=P1._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,q){if(s($,!1),$.strm.avail_out===0)return n}}if($.insert=0,Q===U0){if(s($,!0),$.strm.avail_out===0)return N0;return n0}if($.last_lit){if(s($,!1),$.strm.avail_out===0)return n}return _$}function D1($,Q,q,V,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=q,this.max_chain=V,this.func=Y}var i0;i0=[new D1(0,0,0,0,mK),new D1(4,4,8,4,t5),new D1(4,5,16,8,t5),new D1(4,6,32,32,t5),new D1(4,4,16,16,o0),new D1(8,16,32,32,o0),new D1(8,16,128,128,o0),new D1(8,32,128,256,o0),new D1(32,128,258,1024,o0),new D1(32,258,258,4096,o0)];function uK($){$.window_size=2*$.w_size,G0($.head),$.max_lazy_match=i0[$.level].max_lazy,$.good_match=i0[$.level].good_length,$.nice_match=i0[$.level].nice_length,$.max_chain_length=i0[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=S-1,$.match_available=0,$.ins_h=0}function dK(){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=n6,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Y1.Buf16(DK*2),this.dyn_dtree=new Y1.Buf16((2*gK+1)*2),this.bl_tree=new Y1.Buf16((2*kK+1)*2),G0(this.dyn_ltree),G0(this.dyn_dtree),G0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Y1.Buf16(hK+1),this.heap=new Y1.Buf16(2*e5+1),G0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Y1.Buf16(2*e5+1),G0(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 c9($){var Q;if(!$||!$.state)return W0($,L1);if($.total_in=$.total_out=0,$.data_type=RK,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?r6:B0,$.adler=Q.wrap===2?0:1,Q.last_flush=I0,P1._tr_init(Q),h1}function p9($){var Q=c9($);if(Q===h1)uK($.state);return Q}function lK($,Q){if(!$||!$.state)return L1;if($.state.wrap!==2)return L1;return $.state.gzhead=Q,h1}function u9($,Q,q,V,Y,X){if(!$)return L1;var J=1;if(Q===CK)Q=6;if(V<0)J=0,V=-V;else if(V>15)J=2,V-=16;if(Y<1||Y>vK||q!==n6||V<8||V>15||Q<0||Q>9||X<0||X>TK)return W0($,L1);if(V===8)V=9;var G=new dK;return $.state=G,G.strm=$,G.wrap=J,G.gzhead=null,G.w_bits=V,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=Y+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+S-1)/S),G.window=new Y1.Buf8(G.w_size*2),G.head=new Y1.Buf16(G.hash_size),G.prev=new Y1.Buf16(G.w_size),G.lit_bufsize=1<<Y+6,G.pending_buf_size=G.lit_bufsize*4,G.pending_buf=new Y1.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=Q,G.strategy=X,G.method=q,p9($)}function oK($,Q){return u9($,Q,n6,xK,SK,FK)}function iK($,Q){var q,V,Y,X;if(!$||!$.state||Q>h9||Q<0)return $?W0($,L1):L1;if(V=$.state,!$.output||!$.input&&$.avail_in!==0||V.status===h$&&Q!==U0)return W0($,$.avail_out===0?s5:L1);if(V.strm=$,q=V.last_flush,V.last_flush=Q,V.status===r6)if(V.wrap===2)if($.adler=0,E(V,31),E(V,139),E(V,8),!V.gzhead)E(V,0),E(V,0),E(V,0),E(V,0),E(V,0),E(V,V.level===9?2:V.strategy>=d6||V.level<2?4:0),E(V,fK),V.status=B0;else{if(E(V,(V.gzhead.text?1:0)+(V.gzhead.hcrc?2:0)+(!V.gzhead.extra?0:4)+(!V.gzhead.name?0:8)+(!V.gzhead.comment?0:16)),E(V,V.gzhead.time&255),E(V,V.gzhead.time>>8&255),E(V,V.gzhead.time>>16&255),E(V,V.gzhead.time>>24&255),E(V,V.level===9?2:V.strategy>=d6||V.level<2?4:0),E(V,V.gzhead.os&255),V.gzhead.extra&&V.gzhead.extra.length)E(V,V.gzhead.extra.length&255),E(V,V.gzhead.extra.length>>8&255);if(V.gzhead.hcrc)$.adler=Y0($.adler,V.pending_buf,V.pending,0);V.gzindex=0,V.status=$Q}else{var J=n6+(V.w_bits-8<<4)<<8,G=-1;if(V.strategy>=d6||V.level<2)G=0;else if(V.level<6)G=1;else if(V.level===6)G=2;else G=3;if(J|=G<<6,V.strstart!==0)J|=_K;if(J+=31-J%31,V.status=B0,D$(V,J),V.strstart!==0)D$(V,$.adler>>>16),D$(V,$.adler&65535);$.adler=1}if(V.status===$Q)if(V.gzhead.extra){Y=V.pending;while(V.gzindex<(V.gzhead.extra.length&65535)){if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X0($),Y=V.pending,V.pending===V.pending_buf_size)break}E(V,V.gzhead.extra[V.gzindex]&255),V.gzindex++}if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(V.gzindex===V.gzhead.extra.length)V.gzindex=0,V.status=l6}else V.status=l6;if(V.status===l6)if(V.gzhead.name){Y=V.pending;do{if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X0($),Y=V.pending,V.pending===V.pending_buf_size){X=1;break}}if(V.gzindex<V.gzhead.name.length)X=V.gzhead.name.charCodeAt(V.gzindex++)&255;else X=0;E(V,X)}while(X!==0);if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X===0)V.gzindex=0,V.status=o6}else V.status=o6;if(V.status===o6)if(V.gzhead.comment){Y=V.pending;do{if(V.pending===V.pending_buf_size){if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X0($),Y=V.pending,V.pending===V.pending_buf_size){X=1;break}}if(V.gzindex<V.gzhead.comment.length)X=V.gzhead.comment.charCodeAt(V.gzindex++)&255;else X=0;E(V,X)}while(X!==0);if(V.gzhead.hcrc&&V.pending>Y)$.adler=Y0($.adler,V.pending_buf,V.pending-Y,Y);if(X===0)V.status=i6}else V.status=i6;if(V.status===i6)if(V.gzhead.hcrc){if(V.pending+2>V.pending_buf_size)X0($);if(V.pending+2<=V.pending_buf_size)E(V,$.adler&255),E(V,$.adler>>8&255),$.adler=0,V.status=B0}else V.status=B0;if(V.pending!==0){if(X0($),$.avail_out===0)return V.last_flush=-1,h1}else if($.avail_in===0&&f9(Q)<=f9(q)&&Q!==U0)return W0($,s5);if(V.status===h$&&$.avail_in!==0)return W0($,s5);if($.avail_in!==0||V.lookahead!==0||Q!==I0&&V.status!==h$){var U=V.strategy===d6?pK(V,Q):V.strategy===AK?cK(V,Q):i0[V.level].func(V,Q);if(U===N0||U===n0)V.status=h$;if(U===n||U===N0){if($.avail_out===0)V.last_flush=-1;return h1}if(U===_$){if(Q===NK)P1._tr_align(V);else if(Q!==h9){if(P1._tr_stored_block(V,0,0,!1),Q===MK){if(G0(V.head),V.lookahead===0)V.strstart=0,V.block_start=0,V.insert=0}}if(X0($),$.avail_out===0)return V.last_flush=-1,h1}}if(Q!==U0)return h1;if(V.wrap<=0)return _9;if(V.wrap===2)E(V,$.adler&255),E(V,$.adler>>8&255),E(V,$.adler>>16&255),E(V,$.adler>>24&255),E(V,$.total_in&255),E(V,$.total_in>>8&255),E(V,$.total_in>>16&255),E(V,$.total_in>>24&255);else D$(V,$.adler>>>16),D$(V,$.adler&65535);if(X0($),V.wrap>0)V.wrap=-V.wrap;return V.pending!==0?h1:_9}function nK($){var Q;if(!$||!$.state)return L1;if(Q=$.state.status,Q!==r6&&Q!==$Q&&Q!==l6&&Q!==o6&&Q!==i6&&Q!==B0&&Q!==h$)return W0($,L1);return $.state=null,Q===B0?W0($,IK):h1}function rK($,Q){var q=Q.length,V,Y,X,J,G,U,K,W;if(!$||!$.state)return L1;if(V=$.state,J=V.wrap,J===2||J===1&&V.status!==r6||V.lookahead)return L1;if(J===1)$.adler=b9($.adler,Q,q,0);if(V.wrap=0,q>=V.w_size){if(J===0)G0(V.head),V.strstart=0,V.block_start=0,V.insert=0;W=new Y1.Buf8(V.w_size),Y1.arraySet(W,Q,q-V.w_size,V.w_size,0),Q=W,q=V.w_size}G=$.avail_in,U=$.next_in,K=$.input,$.avail_in=q,$.next_in=0,$.input=Q,M0(V);while(V.lookahead>=S){Y=V.strstart,X=V.lookahead-(S-1);do V.ins_h=(V.ins_h<<V.hash_shift^V.window[Y+S-1])&V.hash_mask,V.prev[Y&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=Y,Y++;while(--X);V.strstart=Y,V.lookahead=S-1,M0(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=S-1,V.match_available=0,$.next_in=U,$.input=K,$.avail_in=G,V.wrap=J,h1}aK.deflateInit=oK;aK.deflateInit2=u9;aK.deflateReset=p9;aK.deflateResetKeep=c9;aK.deflateSetHeader=lK;aK.deflate=iK;aK.deflateEnd=nK;aK.deflateSetDictionary=rK;aK.deflateInfo="pako deflate (from Nodeca project)"});var QQ=w((XW)=>{var a6=o1(),l9=!0,o9=!0;try{String.fromCharCode.apply(null,[0])}catch($){l9=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){o9=!1}var f$=new a6.Buf8(256);for(_1=0;_1<256;_1++)f$[_1]=_1>=252?6:_1>=248?5:_1>=240?4:_1>=224?3:_1>=192?2:1;var _1;f$[254]=f$[254]=1;XW.string2buf=function($){var Q,q,V,Y,X,J=$.length,G=0;for(Y=0;Y<J;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}G+=q<128?1:q<2048?2:q<65536?3:4}Q=new a6.Buf8(G);for(X=0,Y=0;X<G;Y++){if(q=$.charCodeAt(Y),(q&64512)===55296&&Y+1<J){if(V=$.charCodeAt(Y+1),(V&64512)===56320)q=65536+(q-55296<<10)+(V-56320),Y++}if(q<128)Q[X++]=q;else if(q<2048)Q[X++]=192|q>>>6,Q[X++]=128|q&63;else if(q<65536)Q[X++]=224|q>>>12,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63;else Q[X++]=240|q>>>18,Q[X++]=128|q>>>12&63,Q[X++]=128|q>>>6&63,Q[X++]=128|q&63}return Q};function i9($,Q){if(Q<65534){if($.subarray&&o9||!$.subarray&&l9)return String.fromCharCode.apply(null,a6.shrinkBuf($,Q))}var q="";for(var V=0;V<Q;V++)q+=String.fromCharCode($[V]);return q}XW.buf2binstring=function($){return i9($,$.length)};XW.binstring2buf=function($){var Q=new a6.Buf8($.length);for(var q=0,V=Q.length;q<V;q++)Q[q]=$.charCodeAt(q);return Q};XW.buf2string=function($,Q){var q,V,Y,X,J=Q||$.length,G=Array(J*2);for(V=0,q=0;q<J;){if(Y=$[q++],Y<128){G[V++]=Y;continue}if(X=f$[Y],X>4){G[V++]=65533,q+=X-1;continue}Y&=X===2?31:X===3?15:7;while(X>1&&q<J)Y=Y<<6|$[q++]&63,X--;if(X>1){G[V++]=65533;continue}if(Y<65536)G[V++]=Y;else Y-=65536,G[V++]=55296|Y>>10&1023,G[V++]=56320|Y&1023}return i9(G,V)};XW.utf8border=function($,Q){var q;if(Q=Q||$.length,Q>$.length)Q=$.length;q=Q-1;while(q>=0&&($[q]&192)===128)q--;if(q<0)return Q;if(q===0)return Q;return q+f$[$[q]]>Q?q:Q}});var qQ=w((KP,n9)=>{function ZW(){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}n9.exports=ZW});var t9=w((MW)=>{var b$=d9(),m$=o1(),JQ=QQ(),YQ=u6(),zW=qQ(),s9=Object.prototype.toString,HW=0,VQ=4,r0=0,r9=1,a9=2,PW=-1,LW=0,OW=8;function C0($){if(!(this instanceof C0))return new C0($);this.options=m$.assign({level:PW,method:OW,chunkSize:16384,windowBits:15,memLevel:8,strategy:LW,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 zW,this.strm.avail_out=0;var q=b$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(q!==r0)throw Error(YQ[q]);if(Q.header)b$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var V;if(typeof Q.dictionary==="string")V=JQ.string2buf(Q.dictionary);else if(s9.call(Q.dictionary)==="[object ArrayBuffer]")V=new Uint8Array(Q.dictionary);else V=Q.dictionary;if(q=b$.deflateSetDictionary(this.strm,V),q!==r0)throw Error(YQ[q]);this._dict_set=!0}}C0.prototype.push=function($,Q){var q=this.strm,V=this.options.chunkSize,Y,X;if(this.ended)return!1;if(X=Q===~~Q?Q:Q===!0?VQ:HW,typeof $==="string")q.input=JQ.string2buf($);else if(s9.call($)==="[object ArrayBuffer]")q.input=new Uint8Array($);else q.input=$;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new m$.Buf8(V),q.next_out=0,q.avail_out=V;if(Y=b$.deflate(q,X),Y!==r9&&Y!==r0)return this.onEnd(Y),this.ended=!0,!1;if(q.avail_out===0||q.avail_in===0&&(X===VQ||X===a9))if(this.options.to==="string")this.onData(JQ.buf2binstring(m$.shrinkBuf(q.output,q.next_out)));else this.onData(m$.shrinkBuf(q.output,q.next_out))}while((q.avail_in>0||q.avail_out===0)&&Y!==r9);if(X===VQ)return Y=b$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===r0;if(X===a9)return this.onEnd(r0),q.avail_out=0,!0;return!0};C0.prototype.onData=function($){this.chunks.push($)};C0.prototype.onEnd=function($){if($===r0)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=m$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function XQ($,Q){var q=new C0(Q);if(q.push($,!0),q.err)throw q.msg||YQ[q.err];return q.result}function BW($,Q){return Q=Q||{},Q.raw=!0,XQ($,Q)}function NW($,Q){return Q=Q||{},Q.gzip=!0,XQ($,Q)}MW.Deflate=C0;MW.deflate=XQ;MW.deflateRaw=BW;MW.gzip=NW});var $2=w((UP,e9)=>{var s6=30,TW=12;e9.exports=function(Q,q){var V,Y,X,J,G,U,K,W,Z,z,H,C,P,I,M,L,A,B,O,F,R,v,x,h,T;V=Q.state,Y=Q.next_in,h=Q.input,X=Y+(Q.avail_in-5),J=Q.next_out,T=Q.output,G=J-(q-Q.avail_out),U=J+(Q.avail_out-257),K=V.dmax,W=V.wsize,Z=V.whave,z=V.wnext,H=V.window,C=V.hold,P=V.bits,I=V.lencode,M=V.distcode,L=(1<<V.lenbits)-1,A=(1<<V.distbits)-1;$:do{if(P<15)C+=h[Y++]<<P,P+=8,C+=h[Y++]<<P,P+=8;B=I[C&L];Q:for(;;){if(O=B>>>24,C>>>=O,P-=O,O=B>>>16&255,O===0)T[J++]=B&65535;else if(O&16){if(F=B&65535,O&=15,O){if(P<O)C+=h[Y++]<<P,P+=8;F+=C&(1<<O)-1,C>>>=O,P-=O}if(P<15)C+=h[Y++]<<P,P+=8,C+=h[Y++]<<P,P+=8;B=M[C&A];q:for(;;){if(O=B>>>24,C>>>=O,P-=O,O=B>>>16&255,O&16){if(R=B&65535,O&=15,P<O){if(C+=h[Y++]<<P,P+=8,P<O)C+=h[Y++]<<P,P+=8}if(R+=C&(1<<O)-1,R>K){Q.msg="invalid distance too far back",V.mode=s6;break $}if(C>>>=O,P-=O,O=J-G,R>O){if(O=R-O,O>Z){if(V.sane){Q.msg="invalid distance too far back",V.mode=s6;break $}}if(v=0,x=H,z===0){if(v+=W-O,O<F){F-=O;do T[J++]=H[v++];while(--O);v=J-R,x=T}}else if(z<O){if(v+=W+z-O,O-=z,O<F){F-=O;do T[J++]=H[v++];while(--O);if(v=0,z<F){O=z,F-=O;do T[J++]=H[v++];while(--O);v=J-R,x=T}}}else if(v+=z-O,O<F){F-=O;do T[J++]=H[v++];while(--O);v=J-R,x=T}while(F>2)T[J++]=x[v++],T[J++]=x[v++],T[J++]=x[v++],F-=3;if(F){if(T[J++]=x[v++],F>1)T[J++]=x[v++]}}else{v=J-R;do T[J++]=T[v++],T[J++]=T[v++],T[J++]=T[v++],F-=3;while(F>2);if(F){if(T[J++]=T[v++],F>1)T[J++]=T[v++]}}}else if((O&64)===0){B=M[(B&65535)+(C&(1<<O)-1)];continue q}else{Q.msg="invalid distance code",V.mode=s6;break $}break}}else if((O&64)===0){B=I[(B&65535)+(C&(1<<O)-1)];continue Q}else if(O&32){V.mode=TW;break $}else{Q.msg="invalid literal/length code",V.mode=s6;break $}break}}while(Y<X&&J<U);F=P>>3,Y-=F,P-=F<<3,C&=(1<<P)-1,Q.next_in=Y,Q.next_out=J,Q.avail_in=Y<X?5+(X-Y):5-(Y-X),Q.avail_out=J<U?257+(U-J):257-(J-U),V.hold=C,V.bits=P;return}});var G2=w((jP,X2)=>{var Q2=o1(),a0=15,q2=852,V2=592,J2=0,GQ=1,Y2=2,FW=[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],RW=[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],vW=[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],xW=[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];X2.exports=function(Q,q,V,Y,X,J,G,U){var K=U.bits,W=0,Z=0,z=0,H=0,C=0,P=0,I=0,M=0,L=0,A=0,B,O,F,R,v,x=null,h=0,T,W1=new Q2.Buf16(a0+1),v0=new Q2.Buf16(a0+1),G6=null,Vq=0,Jq,K6,W6;for(W=0;W<=a0;W++)W1[W]=0;for(Z=0;Z<Y;Z++)W1[q[V+Z]]++;C=K;for(H=a0;H>=1;H--)if(W1[H]!==0)break;if(C>H)C=H;if(H===0)return X[J++]=20971520,X[J++]=20971520,U.bits=1,0;for(z=1;z<H;z++)if(W1[z]!==0)break;if(C<z)C=z;M=1;for(W=1;W<=a0;W++)if(M<<=1,M-=W1[W],M<0)return-1;if(M>0&&(Q===J2||H!==1))return-1;v0[1]=0;for(W=1;W<a0;W++)v0[W+1]=v0[W]+W1[W];for(Z=0;Z<Y;Z++)if(q[V+Z]!==0)G[v0[q[V+Z]]++]=Z;if(Q===J2)x=G6=G,T=19;else if(Q===GQ)x=FW,h-=257,G6=RW,Vq-=257,T=256;else x=vW,G6=xW,T=-1;if(A=0,Z=0,W=z,v=J,P=C,I=0,F=-1,L=1<<C,R=L-1,Q===GQ&&L>q2||Q===Y2&&L>V2)return 1;for(;;){if(Jq=W-I,G[Z]<T)K6=0,W6=G[Z];else if(G[Z]>T)K6=G6[Vq+G[Z]],W6=x[h+G[Z]];else K6=96,W6=0;B=1<<W-I,O=1<<P,z=O;do O-=B,X[v+(A>>I)+O]=Jq<<24|K6<<16|W6|0;while(O!==0);B=1<<W-1;while(A&B)B>>=1;if(B!==0)A&=B-1,A+=B;else A=0;if(Z++,--W1[W]===0){if(W===H)break;W=q[V+G[Z]]}if(W>C&&(A&R)!==F){if(I===0)I=C;v+=z,P=W-I,M=1<<P;while(P+I<H){if(M-=W1[P+I],M<=0)break;P++,M<<=1}if(L+=1<<P,Q===GQ&&L>q2||Q===Y2&&L>V2)return 1;F=A&R,X[F]=C<<24|P<<16|v-J|0}}if(A!==0)X[v+A]=W-I<<24|4194304|0;return U.bits=C,0}});var p2=w((nW)=>{var Z1=o1(),zQ=r5(),f1=a5(),SW=$2(),c$=G2(),EW=0,g2=1,k2=2,K2=4,yW=5,t6=6,w0=0,gW=1,kW=2,O1=-2,D2=-3,HQ=-4,DW=-5,W2=8,h2=1,U2=2,j2=3,Z2=4,z2=5,H2=6,P2=7,L2=8,O2=9,B2=10,Q8=11,n1=12,KQ=13,N2=14,WQ=15,M2=16,I2=17,C2=18,w2=19,e6=20,$8=21,A2=22,T2=23,F2=24,R2=25,v2=26,UQ=27,x2=28,S2=29,b=30,PQ=31,hW=32,_W=852,fW=592,bW=15,mW=bW;function E2($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function cW(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Z1.Buf16(320),this.work=new Z1.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _2($){var Q;if(!$||!$.state)return O1;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=h2,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new Z1.Buf32(_W),Q.distcode=Q.distdyn=new Z1.Buf32(fW),Q.sane=1,Q.back=-1,w0}function f2($){var Q;if(!$||!$.state)return O1;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,_2($)}function b2($,Q){var q,V;if(!$||!$.state)return O1;if(V=$.state,Q<0)q=0,Q=-Q;else if(q=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return O1;if(V.window!==null&&V.wbits!==Q)V.window=null;return V.wrap=q,V.wbits=Q,f2($)}function m2($,Q){var q,V;if(!$)return O1;if(V=new cW,$.state=V,V.window=null,q=b2($,Q),q!==w0)$.state=null;return q}function pW($){return m2($,mW)}var y2=!0,jQ,ZQ;function uW($){if(y2){var Q;jQ=new Z1.Buf32(512),ZQ=new Z1.Buf32(32),Q=0;while(Q<144)$.lens[Q++]=8;while(Q<256)$.lens[Q++]=9;while(Q<280)$.lens[Q++]=7;while(Q<288)$.lens[Q++]=8;c$(g2,$.lens,0,288,jQ,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;c$(k2,$.lens,0,32,ZQ,0,$.work,{bits:5}),y2=!1}$.lencode=jQ,$.lenbits=9,$.distcode=ZQ,$.distbits=5}function c2($,Q,q,V){var Y,X=$.state;if(X.window===null)X.wsize=1<<X.wbits,X.wnext=0,X.whave=0,X.window=new Z1.Buf8(X.wsize);if(V>=X.wsize)Z1.arraySet(X.window,Q,q-X.wsize,X.wsize,0),X.wnext=0,X.whave=X.wsize;else{if(Y=X.wsize-X.wnext,Y>V)Y=V;if(Z1.arraySet(X.window,Q,q-V,Y,X.wnext),V-=Y,V)Z1.arraySet(X.window,Q,q-V,V,0),X.wnext=V,X.whave=X.wsize;else{if(X.wnext+=Y,X.wnext===X.wsize)X.wnext=0;if(X.whave<X.wsize)X.whave+=Y}}return 0}function dW($,Q){var q,V,Y,X,J,G,U,K,W,Z,z,H,C,P,I=0,M,L,A,B,O,F,R,v,x=new Z1.Buf8(4),h,T,W1=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return O1;if(q=$.state,q.mode===n1)q.mode=KQ;J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,V=$.input,G=$.avail_in,K=q.hold,W=q.bits,Z=G,z=U,v=w0;$:for(;;)switch(q.mode){case h2:if(q.wrap===0){q.mode=KQ;break}while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.wrap&2&&K===35615){q.check=0,x[0]=K&255,x[1]=K>>>8&255,q.check=f1(q.check,x,2,0),K=0,W=0,q.mode=U2;break}if(q.flags=0,q.head)q.head.done=!1;if(!(q.wrap&1)||(((K&255)<<8)+(K>>8))%31){$.msg="incorrect header check",q.mode=b;break}if((K&15)!==W2){$.msg="unknown compression method",q.mode=b;break}if(K>>>=4,W-=4,R=(K&15)+8,q.wbits===0)q.wbits=R;else if(R>q.wbits){$.msg="invalid window size",q.mode=b;break}q.dmax=1<<R,$.adler=q.check=1,q.mode=K&512?B2:n1,K=0,W=0;break;case U2:while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.flags=K,(q.flags&255)!==W2){$.msg="unknown compression method",q.mode=b;break}if(q.flags&57344){$.msg="unknown header flags set",q.mode=b;break}if(q.head)q.head.text=K>>8&1;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,q.check=f1(q.check,x,2,0);K=0,W=0,q.mode=j2;case j2:while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.head)q.head.time=K;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,x[2]=K>>>16&255,x[3]=K>>>24&255,q.check=f1(q.check,x,4,0);K=0,W=0,q.mode=Z2;case Z2:while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.head)q.head.xflags=K&255,q.head.os=K>>8;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,q.check=f1(q.check,x,2,0);K=0,W=0,q.mode=z2;case z2:if(q.flags&1024){while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.length=K,q.head)q.head.extra_len=K;if(q.flags&512)x[0]=K&255,x[1]=K>>>8&255,q.check=f1(q.check,x,2,0);K=0,W=0}else if(q.head)q.head.extra=null;q.mode=H2;case H2:if(q.flags&1024){if(H=q.length,H>G)H=G;if(H){if(q.head){if(R=q.head.extra_len-q.length,!q.head.extra)q.head.extra=Array(q.head.extra_len);Z1.arraySet(q.head.extra,V,X,H,R)}if(q.flags&512)q.check=f1(q.check,V,H,X);G-=H,X+=H,q.length-=H}if(q.length)break $}q.length=0,q.mode=P2;case P2:if(q.flags&2048){if(G===0)break $;H=0;do if(R=V[X+H++],q.head&&R&&q.length<65536)q.head.name+=String.fromCharCode(R);while(R&&H<G);if(q.flags&512)q.check=f1(q.check,V,H,X);if(G-=H,X+=H,R)break $}else if(q.head)q.head.name=null;q.length=0,q.mode=L2;case L2:if(q.flags&4096){if(G===0)break $;H=0;do if(R=V[X+H++],q.head&&R&&q.length<65536)q.head.comment+=String.fromCharCode(R);while(R&&H<G);if(q.flags&512)q.check=f1(q.check,V,H,X);if(G-=H,X+=H,R)break $}else if(q.head)q.head.comment=null;q.mode=O2;case O2:if(q.flags&512){while(W<16){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(K!==(q.check&65535)){$.msg="header crc mismatch",q.mode=b;break}K=0,W=0}if(q.head)q.head.hcrc=q.flags>>9&1,q.head.done=!0;$.adler=q.check=0,q.mode=n1;break;case B2:while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}$.adler=q.check=E2(K),K=0,W=0,q.mode=Q8;case Q8:if(q.havedict===0)return $.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,q.hold=K,q.bits=W,kW;$.adler=q.check=1,q.mode=n1;case n1:if(Q===yW||Q===t6)break $;case KQ:if(q.last){K>>>=W&7,W-=W&7,q.mode=UQ;break}while(W<3){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}switch(q.last=K&1,K>>>=1,W-=1,K&3){case 0:q.mode=N2;break;case 1:if(uW(q),q.mode=e6,Q===t6){K>>>=2,W-=2;break $}break;case 2:q.mode=I2;break;case 3:$.msg="invalid block type",q.mode=b}K>>>=2,W-=2;break;case N2:K>>>=W&7,W-=W&7;while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if((K&65535)!==(K>>>16^65535)){$.msg="invalid stored block lengths",q.mode=b;break}if(q.length=K&65535,K=0,W=0,q.mode=WQ,Q===t6)break $;case WQ:q.mode=M2;case M2:if(H=q.length,H){if(H>G)H=G;if(H>U)H=U;if(H===0)break $;Z1.arraySet(Y,V,X,H,J),G-=H,X+=H,U-=H,J+=H,q.length-=H;break}q.mode=n1;break;case I2:while(W<14){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(q.nlen=(K&31)+257,K>>>=5,W-=5,q.ndist=(K&31)+1,K>>>=5,W-=5,q.ncode=(K&15)+4,K>>>=4,W-=4,q.nlen>286||q.ndist>30){$.msg="too many length or distance symbols",q.mode=b;break}q.have=0,q.mode=C2;case C2:while(q.have<q.ncode){while(W<3){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}q.lens[W1[q.have++]]=K&7,K>>>=3,W-=3}while(q.have<19)q.lens[W1[q.have++]]=0;if(q.lencode=q.lendyn,q.lenbits=7,h={bits:q.lenbits},v=c$(EW,q.lens,0,19,q.lencode,0,q.work,h),q.lenbits=h.bits,v){$.msg="invalid code lengths set",q.mode=b;break}q.have=0,q.mode=w2;case w2:while(q.have<q.nlen+q.ndist){for(;;){if(I=q.lencode[K&(1<<q.lenbits)-1],M=I>>>24,L=I>>>16&255,A=I&65535,M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(A<16)K>>>=M,W-=M,q.lens[q.have++]=A;else{if(A===16){T=M+2;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(K>>>=M,W-=M,q.have===0){$.msg="invalid bit length repeat",q.mode=b;break}R=q.lens[q.have-1],H=3+(K&3),K>>>=2,W-=2}else if(A===17){T=M+3;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=M,W-=M,R=0,H=3+(K&7),K>>>=3,W-=3}else{T=M+7;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=M,W-=M,R=0,H=11+(K&127),K>>>=7,W-=7}if(q.have+H>q.nlen+q.ndist){$.msg="invalid bit length repeat",q.mode=b;break}while(H--)q.lens[q.have++]=R}}if(q.mode===b)break;if(q.lens[256]===0){$.msg="invalid code -- missing end-of-block",q.mode=b;break}if(q.lenbits=9,h={bits:q.lenbits},v=c$(g2,q.lens,0,q.nlen,q.lencode,0,q.work,h),q.lenbits=h.bits,v){$.msg="invalid literal/lengths set",q.mode=b;break}if(q.distbits=6,q.distcode=q.distdyn,h={bits:q.distbits},v=c$(k2,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,h),q.distbits=h.bits,v){$.msg="invalid distances set",q.mode=b;break}if(q.mode=e6,Q===t6)break $;case e6:q.mode=$8;case $8:if(G>=6&&U>=258){if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,q.hold=K,q.bits=W,SW($,z),J=$.next_out,Y=$.output,U=$.avail_out,X=$.next_in,V=$.input,G=$.avail_in,K=q.hold,W=q.bits,q.mode===n1)q.back=-1;break}q.back=0;for(;;){if(I=q.lencode[K&(1<<q.lenbits)-1],M=I>>>24,L=I>>>16&255,A=I&65535,M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(L&&(L&240)===0){B=M,O=L,F=A;for(;;){if(I=q.lencode[F+((K&(1<<B+O)-1)>>B)],M=I>>>24,L=I>>>16&255,A=I&65535,B+M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=B,W-=B,q.back+=B}if(K>>>=M,W-=M,q.back+=M,q.length=A,L===0){q.mode=v2;break}if(L&32){q.back=-1,q.mode=n1;break}if(L&64){$.msg="invalid literal/length code",q.mode=b;break}q.extra=L&15,q.mode=A2;case A2:if(q.extra){T=q.extra;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}q.length+=K&(1<<q.extra)-1,K>>>=q.extra,W-=q.extra,q.back+=q.extra}q.was=q.length,q.mode=T2;case T2:for(;;){if(I=q.distcode[K&(1<<q.distbits)-1],M=I>>>24,L=I>>>16&255,A=I&65535,M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if((L&240)===0){B=M,O=L,F=A;for(;;){if(I=q.distcode[F+((K&(1<<B+O)-1)>>B)],M=I>>>24,L=I>>>16&255,A=I&65535,B+M<=W)break;if(G===0)break $;G--,K+=V[X++]<<W,W+=8}K>>>=B,W-=B,q.back+=B}if(K>>>=M,W-=M,q.back+=M,L&64){$.msg="invalid distance code",q.mode=b;break}q.offset=A,q.extra=L&15,q.mode=F2;case F2:if(q.extra){T=q.extra;while(W<T){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}q.offset+=K&(1<<q.extra)-1,K>>>=q.extra,W-=q.extra,q.back+=q.extra}if(q.offset>q.dmax){$.msg="invalid distance too far back",q.mode=b;break}q.mode=R2;case R2:if(U===0)break $;if(H=z-U,q.offset>H){if(H=q.offset-H,H>q.whave){if(q.sane){$.msg="invalid distance too far back",q.mode=b;break}}if(H>q.wnext)H-=q.wnext,C=q.wsize-H;else C=q.wnext-H;if(H>q.length)H=q.length;P=q.window}else P=Y,C=J-q.offset,H=q.length;if(H>U)H=U;U-=H,q.length-=H;do Y[J++]=P[C++];while(--H);if(q.length===0)q.mode=$8;break;case v2:if(U===0)break $;Y[J++]=q.length,U--,q.mode=$8;break;case UQ:if(q.wrap){while(W<32){if(G===0)break $;G--,K|=V[X++]<<W,W+=8}if(z-=U,$.total_out+=z,q.total+=z,z)$.adler=q.check=q.flags?f1(q.check,Y,z,J-z):zQ(q.check,Y,z,J-z);if(z=U,(q.flags?K:E2(K))!==q.check){$.msg="incorrect data check",q.mode=b;break}K=0,W=0}q.mode=x2;case x2:if(q.wrap&&q.flags){while(W<32){if(G===0)break $;G--,K+=V[X++]<<W,W+=8}if(K!==(q.total&4294967295)){$.msg="incorrect length check",q.mode=b;break}K=0,W=0}q.mode=S2;case S2:v=gW;break $;case b:v=D2;break $;case PQ:return HQ;case hW:default:return O1}if($.next_out=J,$.avail_out=U,$.next_in=X,$.avail_in=G,q.hold=K,q.bits=W,q.wsize||z!==$.avail_out&&q.mode<b&&(q.mode<UQ||Q!==K2)){if(c2($,$.output,$.next_out,z-$.avail_out))return q.mode=PQ,HQ}if(Z-=$.avail_in,z-=$.avail_out,$.total_in+=Z,$.total_out+=z,q.total+=z,q.wrap&&z)$.adler=q.check=q.flags?f1(q.check,Y,z,$.next_out-z):zQ(q.check,Y,z,$.next_out-z);if($.data_type=q.bits+(q.last?64:0)+(q.mode===n1?128:0)+(q.mode===e6||q.mode===WQ?256:0),(Z===0&&z===0||Q===K2)&&v===w0)v=DW;return v}function lW($){if(!$||!$.state)return O1;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,w0}function oW($,Q){var q;if(!$||!$.state)return O1;if(q=$.state,(q.wrap&2)===0)return O1;return q.head=Q,Q.done=!1,w0}function iW($,Q){var q=Q.length,V,Y,X;if(!$||!$.state)return O1;if(V=$.state,V.wrap!==0&&V.mode!==Q8)return O1;if(V.mode===Q8){if(Y=1,Y=zQ(Y,Q,q,0),Y!==V.check)return D2}if(X=c2($,Q,q,q),X)return V.mode=PQ,HQ;return V.havedict=1,w0}nW.inflateReset=f2;nW.inflateReset2=b2;nW.inflateResetKeep=_2;nW.inflateInit=pW;nW.inflateInit2=m2;nW.inflate=dW;nW.inflateEnd=lW;nW.inflateGetHeader=oW;nW.inflateSetDictionary=iW;nW.inflateInfo="pako inflate (from Nodeca project)"});var LQ=w((zP,u2)=>{u2.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 l2=w((HP,d2)=>{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}d2.exports=YU});var i2=w((WU)=>{var s0=p2(),p$=o1(),q8=QQ(),u=LQ(),OQ=u6(),XU=qQ(),GU=l2(),o2=Object.prototype.toString;function A0($){if(!(this instanceof A0))return new A0($);this.options=p$.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 XU,this.strm.avail_out=0;var q=s0.inflateInit2(this.strm,Q.windowBits);if(q!==u.Z_OK)throw Error(OQ[q]);if(this.header=new GU,s0.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=q8.string2buf(Q.dictionary);else if(o2.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(q=s0.inflateSetDictionary(this.strm,Q.dictionary),q!==u.Z_OK)throw Error(OQ[q])}}}A0.prototype.push=function($,Q){var q=this.strm,V=this.options.chunkSize,Y=this.options.dictionary,X,J,G,U,K,W=!1;if(this.ended)return!1;if(J=Q===~~Q?Q:Q===!0?u.Z_FINISH:u.Z_NO_FLUSH,typeof $==="string")q.input=q8.binstring2buf($);else if(o2.call($)==="[object ArrayBuffer]")q.input=new Uint8Array($);else q.input=$;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new p$.Buf8(V),q.next_out=0,q.avail_out=V;if(X=s0.inflate(q,u.Z_NO_FLUSH),X===u.Z_NEED_DICT&&Y)X=s0.inflateSetDictionary(this.strm,Y);if(X===u.Z_BUF_ERROR&&W===!0)X=u.Z_OK,W=!1;if(X!==u.Z_STREAM_END&&X!==u.Z_OK)return this.onEnd(X),this.ended=!0,!1;if(q.next_out){if(q.avail_out===0||X===u.Z_STREAM_END||q.avail_in===0&&(J===u.Z_FINISH||J===u.Z_SYNC_FLUSH))if(this.options.to==="string"){if(G=q8.utf8border(q.output,q.next_out),U=q.next_out-G,K=q8.buf2string(q.output,G),q.next_out=U,q.avail_out=V-U,U)p$.arraySet(q.output,q.output,G,U,0);this.onData(K)}else this.onData(p$.shrinkBuf(q.output,q.next_out))}if(q.avail_in===0&&q.avail_out===0)W=!0}while((q.avail_in>0||q.avail_out===0)&&X!==u.Z_STREAM_END);if(X===u.Z_STREAM_END)J=u.Z_FINISH;if(J===u.Z_FINISH)return X=s0.inflateEnd(this.strm),this.onEnd(X),this.ended=!0,X===u.Z_OK;if(J===u.Z_SYNC_FLUSH)return this.onEnd(u.Z_OK),q.avail_out=0,!0;return!0};A0.prototype.onData=function($){this.chunks.push($)};A0.prototype.onEnd=function($){if($===u.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=p$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function BQ($,Q){var q=new A0(Q);if(q.push($,!0),q.err)throw q.msg||OQ[q.err];return q.result}function KU($,Q){return Q=Q||{},Q.raw=!0,BQ($,Q)}WU.Inflate=A0;WU.inflate=BQ;WU.inflateRaw=KU;WU.ungzip=BQ});var a2=w((LP,r2)=>{var HU=o1().assign,PU=t9(),LU=i2(),OU=LQ(),n2={};HU(n2,PU,LU,OU);r2.exports=n2});var t2=w((IU)=>{var BU=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",NU=a2(),s2=m(),V8=j1(),MU=BU?"uint8array":"array";IU.magic="\b\x00";function T0($,Q){V8.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}s2.inherits(T0,V8);T0.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push(s2.transformTo(MU,$.data),!1)};T0.prototype.flush=function(){if(V8.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};T0.prototype.cleanUp=function(){V8.prototype.cleanUp.call(this),this._pako=null};T0.prototype._createPako=function(){this._pako=new NU[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};IU.compressWorker=function($){return new T0("Deflate",$)};IU.uncompressWorker=function(){return new T0("Inflate",{})}});var NQ=w((TU)=>{var e2=j1();TU.STORE={magic:"\x00\x00",compressWorker:function(){return new e2("STORE compression")},uncompressWorker:function(){return new e2("STORE decompression")}};TU.DEFLATE=t2()});var MQ=w((vU)=>{vU.LOCAL_FILE_HEADER="PK\x03\x04";vU.CENTRAL_FILE_HEADER="PK\x01\x02";vU.CENTRAL_DIRECTORY_END="PK\x05\x06";vU.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";vU.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";vU.DATA_DESCRIPTOR="PK\x07\b"});var V7=w((MP,q7)=>{var t0=m(),e0=j1(),IQ=p0(),$7=b6(),J8=MQ(),D=function($,Q){var q="",V;for(V=0;V<Q;V++)q+=String.fromCharCode($&255),$=$>>>8;return q},DU=function($,Q){var q=$;if(!$)q=Q?16893:33204;return(q&65535)<<16},hU=function($){return($||0)&63},Q7=function($,Q,q,V,Y,X){var{file:J,compression:G}=$,U=X!==IQ.utf8encode,K=t0.transformTo("string",X(J.name)),W=t0.transformTo("string",IQ.utf8encode(J.name)),Z=J.comment,z=t0.transformTo("string",X(Z)),H=t0.transformTo("string",IQ.utf8encode(Z)),C=W.length!==J.name.length,P=H.length!==Z.length,I,M,L="",A="",B="",O=J.dir,F=J.date,R={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||q)R.crc32=$.crc32,R.compressedSize=$.compressedSize,R.uncompressedSize=$.uncompressedSize;var v=0;if(Q)v|=8;if(!U&&(C||P))v|=2048;var x=0,h=0;if(O)x|=16;if(Y==="UNIX")h=798,x|=DU(J.unixPermissions,O);else h=20,x|=hU(J.dosPermissions,O);if(I=F.getUTCHours(),I=I<<6,I=I|F.getUTCMinutes(),I=I<<5,I=I|F.getUTCSeconds()/2,M=F.getUTCFullYear()-1980,M=M<<4,M=M|F.getUTCMonth()+1,M=M<<5,M=M|F.getUTCDate(),C)A=D(1,1)+D($7(K),4)+W,L+="up"+D(A.length,2)+A;if(P)B=D(1,1)+D($7(z),4)+H,L+="uc"+D(B.length,2)+B;var T="";T+=`
61
+ \x00`,T+=D(v,2),T+=G.magic,T+=D(I,2),T+=D(M,2),T+=D(R.crc32,4),T+=D(R.compressedSize,4),T+=D(R.uncompressedSize,4),T+=D(K.length,2),T+=D(L.length,2);var W1=J8.LOCAL_FILE_HEADER+T+K+L,v0=J8.CENTRAL_FILE_HEADER+D(h,2)+T+D(z.length,2)+"\x00\x00\x00\x00"+D(x,4)+D(V,4)+K+L+z;return{fileRecord:W1,dirRecord:v0}},_U=function($,Q,q,V,Y){var X="",J=t0.transformTo("string",Y(V));return X=J8.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+D($,2)+D($,2)+D(Q,4)+D(q,4)+D(J.length,2)+J,X},fU=function($){var Q="";return Q=J8.DATA_DESCRIPTOR+D($.crc32,4)+D($.compressedSize,4)+D($.uncompressedSize,4),Q};function v1($,Q,q,V){e0.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=q,this.encodeFileName=V,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}t0.inherits(v1,e0);v1.prototype.push=function($){var Q=$.meta.percent||0,q=this.entriesCount,V=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,e0.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:q?(Q+100*(q-V-1))/q:100}})};v1.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var q=Q7($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};v1.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,q=Q7($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(q.dirRecord),Q)this.push({data:fU($),meta:{percent:100}});else{this.push({data:q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};v1.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 q=this.bytesWritten-$,V=_U(this.dirRecords.length,q,$,this.zipComment,this.encodeFileName);this.push({data:V,meta:{percent:100}})};v1.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};v1.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(q){Q.processChunk(q)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(q){Q.error(q)}),this};v1.prototype.resume=function(){if(!e0.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};v1.prototype.error=function($){var Q=this._sources;if(!e0.prototype.error.call(this,$))return!1;for(var q=0;q<Q.length;q++)try{Q[q].error($)}catch(V){}return!0};v1.prototype.lock=function(){e0.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};q7.exports=v1});var J7=w((pU)=>{var bU=NQ(),mU=V7(),cU=function($,Q){var q=$||Q,V=bU[q];if(!V)throw Error(q+" is not a valid compression method !");return V};pU.generateWorker=function($,Q,q){var V=new mU(Q.streamFiles,q,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(X,J){Y++;var G=cU(J.options.compression,Q.compression),U=J.options.compressionOptions||Q.compressionOptions||{},K=J.dir,W=J.date;J._compressWorker(G,U).withStreamInfo("file",{name:X,dir:K,date:W,comment:J.comment||"",unixPermissions:J.unixPermissions,dosPermissions:J.dosPermissions}).pipe(V)}),V.entriesCount=Y}catch(X){V.error(X)}return V}});var X7=w((CP,Y7)=>{var dU=m(),Y8=j1();function u$($,Q){Y8.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}dU.inherits(u$,Y8);u$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(q){Q.push({data:q,meta:{percent:0}})}).on("error",function(q){if(Q.isPaused)this.generatedError=q;else Q.error(q)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};u$.prototype.pause=function(){if(!Y8.prototype.pause.call(this))return!1;return this._stream.pause(),!0};u$.prototype.resume=function(){if(!Y8.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};Y7.exports=u$});var L7=w((wP,P7)=>{var lU=p0(),d$=m(),U7=j1(),oU=T5(),j7=F5(),G7=m6(),iU=K9(),nU=J7(),K7=C$(),rU=X7(),Z7=function($,Q,q){var V=d$.getTypeOf(Q),Y,X=d$.extend(q||{},j7);if(X.date=X.date||new Date,X.compression!==null)X.compression=X.compression.toUpperCase();if(typeof X.unixPermissions==="string")X.unixPermissions=parseInt(X.unixPermissions,8);if(X.unixPermissions&&X.unixPermissions&16384)X.dir=!0;if(X.dosPermissions&&X.dosPermissions&16)X.dir=!0;if(X.dir)$=z7($);if(X.createFolders&&(Y=aU($)))H7.call(this,Y,!0);var J=V==="string"&&X.binary===!1&&X.base64===!1;if(!q||typeof q.binary>"u")X.binary=!J;var G=Q instanceof G7&&Q.uncompressedSize===0;if(G||X.dir||!Q||Q.length===0)X.base64=!1,X.binary=!0,Q="",X.compression="STORE",V="string";var U=null;if(Q instanceof G7||Q instanceof U7)U=Q;else if(K7.isNode&&K7.isStream(Q))U=new rU($,Q);else U=d$.prepareContent($,Q,X.binary,X.optimizedBinaryString,X.base64);var K=new iU($,U,X);this.files[$]=K},aU=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},z7=function($){if($.slice(-1)!=="/")$+="/";return $},H7=function($,Q){if(Q=typeof Q<"u"?Q:j7.createFolders,$=z7($),!this.files[$])Z7.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function W7($){return Object.prototype.toString.call($)==="[object RegExp]"}var sU={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,q,V;for(Q in this.files)if(V=this.files[Q],q=Q.slice(this.root.length,Q.length),q&&Q.slice(0,this.root.length)===this.root)$(q,V)},filter:function($){var Q=[];return this.forEach(function(q,V){if($(q,V))Q.push(V)}),Q},file:function($,Q,q){if(arguments.length===1)if(W7($)){var V=$;return this.filter(function(X,J){return!J.dir&&V.test(X)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,Z7.call(this,$,Q,q);return this},folder:function($){if(!$)return this;if(W7($))return this.filter(function(Y,X){return X.dir&&$.test(Y)});var Q=this.root+$,q=H7.call(this,Q),V=this.clone();return V.root=q.name,V},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 q=this.filter(function(Y,X){return X.name.slice(0,$.length)===$});for(var V=0;V<q.length;V++)delete this.files[q[V].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,q={};try{if(q=d$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:lU.utf8encode}),q.type=q.type.toLowerCase(),q.compression=q.compression.toUpperCase(),q.type==="binarystring")q.type="string";if(!q.type)throw Error("No output type specified.");if(d$.checkSupport(q.type),q.platform==="darwin"||q.platform==="freebsd"||q.platform==="linux"||q.platform==="sunos")q.platform="UNIX";if(q.platform==="win32")q.platform="DOS";var V=q.comment||this.comment||"";Q=nU.generateWorker(this,q,V)}catch(Y){Q=new U7("error"),Q.error(Y)}return new oU(Q,q.type||"string",q.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};P7.exports=sU});var CQ=w((AP,B7)=>{var tU=m();function O7($){this.data=$,this.length=$.length,this.index=0,this.zero=0}O7.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,q;this.checkOffset($);for(q=this.index+$-1;q>=this.index;q--)Q=(Q<<8)+this.byteAt(q);return this.index+=$,Q},readString:function($){return tU.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))}};B7.exports=O7});var wQ=w((TP,M7)=>{var N7=CQ(),eU=m();function $$($){N7.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}eU.inherits($$,N7);$$.prototype.byteAt=function($){return this.data[this.zero+$]};$$.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),q=$.charCodeAt(1),V=$.charCodeAt(2),Y=$.charCodeAt(3);for(var X=this.length-4;X>=0;--X)if(this.data[X]===Q&&this.data[X+1]===q&&this.data[X+2]===V&&this.data[X+3]===Y)return X-this.zero;return-1};$$.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),q=$.charCodeAt(1),V=$.charCodeAt(2),Y=$.charCodeAt(3),X=this.readData(4);return Q===X[0]&&q===X[1]&&V===X[2]&&Y===X[3]};$$.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};M7.exports=$$});var w7=w((FP,C7)=>{var I7=CQ(),$j=m();function Q$($){I7.call(this,$)}$j.inherits(Q$,I7);Q$.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};Q$.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};Q$.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};Q$.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};C7.exports=Q$});var TQ=w((RP,T7)=>{var A7=wQ(),Qj=m();function AQ($){A7.call(this,$)}Qj.inherits(AQ,A7);AQ.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};T7.exports=AQ});var v7=w((vP,R7)=>{var F7=TQ(),qj=m();function FQ($){F7.call(this,$)}qj.inherits(FQ,F7);FQ.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};R7.exports=FQ});var RQ=w((xP,S7)=>{var X8=m(),x7=l1(),Vj=wQ(),Jj=w7(),Yj=v7(),Xj=TQ();S7.exports=function($){var Q=X8.getTypeOf($);if(X8.checkSupport(Q),Q==="string"&&!x7.uint8array)return new Jj($);if(Q==="nodebuffer")return new Yj($);if(x7.uint8array)return new Xj(X8.transformTo("uint8array",$));return new Vj(X8.transformTo("array",$))}});var k7=w((SP,g7)=>{var vQ=RQ(),j0=m(),Gj=m6(),E7=b6(),G8=p0(),K8=NQ(),Kj=l1(),Wj=0,Uj=3,jj=function($){for(var Q in K8){if(!Object.prototype.hasOwnProperty.call(K8,Q))continue;if(K8[Q].magic===$)return K8[Q]}return null};function y7($,Q){this.options=$,this.loadOptions=Q}y7.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,q;if($.skip(22),this.fileNameLength=$.readInt(2),q=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(q),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=jj(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+j0.pretty(this.compressionMethod)+" unknown (inner file : "+j0.transformTo("string",this.fileName)+")");this.decompressed=new Gj(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,$===Wj)this.dosPermissions=this.externalFileAttributes&63;if($===Uj)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=vQ(this.extraFields[1].value);if(this.uncompressedSize===j0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===j0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===j0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===j0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,q,V,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)q=$.readInt(2),V=$.readInt(2),Y=$.readData(V),this.extraFields[q]={id:q,length:V,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=Kj.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=G8.utf8decode(this.fileName),this.fileCommentStr=G8.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var q=j0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(q)}var V=this.findExtraFieldUnicodeComment();if(V!==null)this.fileCommentStr=V;else{var Y=j0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=vQ($.value);if(Q.readInt(1)!==1)return null;if(E7(this.fileName)!==Q.readInt(4))return null;return G8.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=vQ($.value);if(Q.readInt(1)!==1)return null;if(E7(this.fileComment)!==Q.readInt(4))return null;return G8.utf8decode(Q.readData($.length-5))}return null}};g7.exports=y7});var _7=w((EP,h7)=>{var Zj=RQ(),r1=m(),x1=MQ(),zj=k7(),Hj=l1();function D7($){this.files=[],this.loadOptions=$}D7.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var Q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+r1.pretty(Q)+", expected "+r1.pretty($)+")")}},isSignature:function($,Q){var q=this.reader.index;this.reader.setIndex($);var V=this.reader.readString(4),Y=V===Q;return this.reader.setIndex(q),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=Hj.uint8array?"uint8array":"array",q=r1.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(q)},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,q,V,Y;while(Q<$)q=this.reader.readInt(2),V=this.reader.readInt(4),Y=this.reader.readData(V),this.zip64ExtensibleData[q]={id:q,length:V,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(x1.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(x1.CENTRAL_FILE_HEADER))$=new zj({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(x1.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,x1.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 q=$;if(this.checkSignature(x1.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===r1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===r1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===r1.MAX_VALUE_16BITS||this.centralDirRecords===r1.MAX_VALUE_16BITS||this.centralDirSize===r1.MAX_VALUE_32BITS||this.centralDirOffset===r1.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(x1.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(x1.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,x1.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(x1.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(x1.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var V=this.centralDirOffset+this.centralDirSize;if(this.zip64)V+=20,V+=12+this.zip64EndOfCentralSize;var Y=q-V;if(Y>0)if(this.isSignature(q,x1.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=Zj($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};h7.exports=D7});var m7=w((yP,b7)=>{var xQ=m(),W8=b0(),Pj=p0(),Lj=_7(),Oj=x5(),f7=C$();function Bj($){return new W8.Promise(function(Q,q){var V=$.decompressed.getContentWorker().pipe(new Oj);V.on("error",function(Y){q(Y)}).on("end",function(){if(V.streamInfo.crc32!==$.decompressed.crc32)q(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}b7.exports=function($,Q){var q=this;if(Q=xQ.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:Pj.utf8decode}),f7.isNode&&f7.isStream($))return W8.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return xQ.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(V){var Y=new Lj(Q);return Y.load(V),Y}).then(function(Y){var X=[W8.Promise.resolve(Y)],J=Y.files;if(Q.checkCRC32)for(var G=0;G<J.length;G++)X.push(Bj(J[G]));return W8.Promise.all(X)}).then(function(Y){var X=Y.shift(),J=X.files;for(var G=0;G<J.length;G++){var U=J[G],K=U.fileNameStr,W=xQ.resolve(U.fileNameStr);if(q.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)q.file(W).unsafeOriginalName=K}if(X.zipComment.length)q.comment=X.zipComment;return q})}});var p7=w((gP,c7)=>{function B1(){if(!(this instanceof B1))return new B1;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 B1;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}B1.prototype=L7();B1.prototype.loadAsync=m7();B1.support=l1();B1.defaults=F5();B1.version="3.10.1";B1.loadAsync=function($,Q){return new B1().loadAsync($,Q)};B1.external=b0();c7.exports=B1});import{homedir as XZ}from"node:os";import q1 from"node:path";function z1($,Q,q,V){return`[ -f "$HOME/.petdex/runtime/hooks-disabled" ] && exit 0; ${['if [ -x "$HOME/.petdex/bin/petdex.js" ] || [ -f "$HOME/.petdex/bin/petdex.js" ]; then',` node "$HOME/.petdex/bin/petdex.js" bubble ${Q} ${$} >/dev/null 2>&1 || true;`,"else",` ${GZ($,q,V)};`,"fi"].join(" ")}`}function GZ($,Q,q){let V=q!=null?`{"state":"${Q}","duration":${q},"agent_source":"${$}"}`:`{"state":"${Q}","agent_source":"${$}"}`;return['T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"',`[ -n "$T" ] && curl -s -m 0.3 -X POST ${J$}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${V}'`,">/dev/null 2>&1 || true"].join(" ")}function KZ(){return`// petdex hook plugin. Auto-generated by \`petdex hooks install\`.
62
62
  // Forwards OpenCode lifecycle events to the petdex desktop mascot via HTTP.
63
63
  // Edit STATE_MAP below to customize which state each event triggers.
64
64
 
@@ -67,7 +67,7 @@ import { readFile } from "node:fs/promises";
67
67
  import { homedir } from "node:os";
68
68
  import { join } from "node:path";
69
69
 
70
- const SIDECAR_URL = ${JSON.stringify(R0)};
70
+ const SIDECAR_URL = ${JSON.stringify(J$)};
71
71
  const RUNTIME_DIR = join(homedir(), ".petdex", "runtime");
72
72
  const TOKEN_PATH = join(RUNTIME_DIR, "update-token");
73
73
  const KILLSWITCH_PATH = join(RUNTIME_DIR, "hooks-disabled");
@@ -123,8 +123,8 @@ export const PetdexPlugin = async () => ({
123
123
  else if (event.type === "session.error") setState("failed", 2500);
124
124
  },
125
125
  });
126
- `}function F0($){if($.startsWith(V1))return`~${$.slice(V1.length)}`;return $}function UZ($){let Q=$.split(`
127
- `),q=/^\s*\[([^[\]]+)\]\s*(?:#.*)?$/,V=/^\s*codex_hooks\s*=\s*(.+?)\s*(?:#.*)?$/,Y=null,X=null;for(let J=0;J<Q.length;J+=1){let G=Q[J],U=G.match(q);if(U){if(Y=U[1].trim(),Y==="features"&&X===null)X=J;continue}if(Y!=="features")continue;let K=G.match(V);if(!K)continue;if(K[1].trim()==="true")return{state:"enabled"};return{state:"wrong-value",replaceLine:J}}if(X===null)return{state:"no-features-section"};return{state:"no-key",insertAfterLine:X}}function jZ($,Q){if(Q.state==="enabled"||Q.state==="missing-file")return $;let q=$.split(`
126
+ `}function F0($){if($.startsWith(V1))return`~${$.slice(V1.length)}`;return $}function WZ($){let Q=$.split(`
127
+ `),q=/^\s*\[([^[\]]+)\]\s*(?:#.*)?$/,V=/^\s*codex_hooks\s*=\s*(.+?)\s*(?:#.*)?$/,Y=null,X=null;for(let J=0;J<Q.length;J+=1){let G=Q[J],U=G.match(q);if(U){if(Y=U[1].trim(),Y==="features"&&X===null)X=J;continue}if(Y!=="features")continue;let K=G.match(V);if(!K)continue;if(K[1].trim()==="true")return{state:"enabled"};return{state:"wrong-value",replaceLine:J}}if(X===null)return{state:"no-features-section"};return{state:"no-key",insertAfterLine:X}}function UZ($,Q){if(Q.state==="enabled"||Q.state==="missing-file")return $;let q=$.split(`
128
128
  `);if(Q.state==="wrong-value"){let Y=q[Q.replaceLine],X=/^(\s*codex_hooks\s*=\s*)([^#\n]+?)(\s*(?:#.*)?)$/,J=Y.match(X);return q[Q.replaceLine]=J?`${J[1]}true${J[3]}`:"codex_hooks = true",q.join(`
129
129
  `)}if(Q.state==="no-key")return q.splice(Q.insertAfterLine+1,0,"codex_hooks = true"),q.join(`
130
130
  `);let V=$.endsWith(`
@@ -132,10 +132,10 @@ export const PetdexPlugin = async () => ({
132
132
  `;return`${$}${V}
133
133
  [features]
134
134
  codex_hooks = true
135
- `}var e$=7777,R0,V1,t1;var $6=e1(()=>{R0=`http://127.0.0.1:${e$}/state`,V1=GZ(),t1=[{id:"claude-code",displayName:"Claude Code",configDir:q1.join(V1,".claude"),configFile:q1.join(V1,".claude","settings.json"),slashCommandPath:q1.join(V1,".claude","commands","petdex.md"),docsUrl:"https://docs.anthropic.com/en/docs/claude-code/hooks",hookEntries:[{event:"UserPromptSubmit",kind:"user.prompt"},{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Notification",kind:"session.waiting"},{event:"Stop",kind:"session.end"}],build(){return{hooks:{UserPromptSubmit:[{hooks:[{type:"command",command:b1("claude-code","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:b1("claude-code","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:b1("claude-code","post","idle")}]}],Notification:[{hooks:[{type:"command",command:b1("claude-code","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:b1("claude-code","stop","waving",1500)}]}]}}}},{id:"codex",displayName:"Codex CLI",configDir:q1.join(V1,".codex"),configFile:q1.join(V1,".codex","hooks.json"),slashCommandPath:q1.join(V1,".codex","prompts","petdex.md"),docsUrl:"https://developers.openai.com/codex/hooks",hookEntries:[{event:"UserPromptSubmit",kind:"user.prompt"},{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"PermissionRequest",kind:"session.waiting"},{event:"Stop",kind:"session.end"}],async postInstallChecks(){let{readFile:$}=await import("node:fs/promises"),Q=q1.join(V1,".codex","config.toml"),q=!0,V="";try{V=await $(Q,"utf8")}catch(J){let G=J.code;if(G==="ENOENT")q=!1;else return[{level:"warn",message:`Could not read ${Q} (${G??"io_error"}). Make sure [features] codex_hooks = true is set there before Codex picks up the hooks.`}]}let Y=q?UZ(V):{state:"missing-file"};if(Y.state==="enabled")return[];let X={prompt:Y.state==="missing-file"?`Create ${F0(Q)} with [features] codex_hooks = true?`:Y.state==="wrong-value"?`Set codex_hooks = true under [features] in ${F0(Q)}? (a .bak of the current file is created first)`:`Add codex_hooks = true under [features] in ${F0(Q)}? (a .bak of the current file is created first)`,apply:async()=>{let{writeFile:J,mkdir:G}=await import("node:fs/promises");if(await G(q1.dirname(Q),{recursive:!0}),!q)try{return await J(Q,`[features]
135
+ `}var e$=7777,J$,V1,t1;var $6=e1(()=>{J$=`http://127.0.0.1:${e$}/state`,V1=XZ(),t1=[{id:"claude-code",displayName:"Claude Code",configDir:q1.join(V1,".claude"),configFile:q1.join(V1,".claude","settings.json"),slashCommandPath:q1.join(V1,".claude","commands","petdex.md"),docsUrl:"https://docs.anthropic.com/en/docs/claude-code/hooks",hookEntries:[{event:"UserPromptSubmit",kind:"user.prompt"},{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"Notification",kind:"session.waiting"},{event:"Stop",kind:"session.end"}],build(){return{hooks:{UserPromptSubmit:[{hooks:[{type:"command",command:z1("claude-code","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:z1("claude-code","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:z1("claude-code","post","idle")}]}],Notification:[{hooks:[{type:"command",command:z1("claude-code","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:z1("claude-code","stop","waving",1500)}]}]}}}},{id:"codex",displayName:"Codex CLI",configDir:q1.join(V1,".codex"),configFile:q1.join(V1,".codex","hooks.json"),slashCommandPath:q1.join(V1,".codex","prompts","petdex.md"),docsUrl:"https://developers.openai.com/codex/hooks",hookEntries:[{event:"UserPromptSubmit",kind:"user.prompt"},{event:"PreToolUse",kind:"tool.before"},{event:"PostToolUse",kind:"tool.after"},{event:"PermissionRequest",kind:"session.waiting"},{event:"Stop",kind:"session.end"}],async postInstallChecks(){let{readFile:$}=await import("node:fs/promises"),Q=q1.join(V1,".codex","config.toml"),q=!0,V="";try{V=await $(Q,"utf8")}catch(J){let G=J.code;if(G==="ENOENT")q=!1;else return[{level:"warn",message:`Could not read ${Q} (${G??"io_error"}). Make sure [features] codex_hooks = true is set there before Codex picks up the hooks.`}]}let Y=q?WZ(V):{state:"missing-file"};if(Y.state==="enabled")return[];let X={prompt:Y.state==="missing-file"?`Create ${F0(Q)} with [features] codex_hooks = true?`:Y.state==="wrong-value"?`Set codex_hooks = true under [features] in ${F0(Q)}? (a .bak of the current file is created first)`:`Add codex_hooks = true under [features] in ${F0(Q)}? (a .bak of the current file is created first)`,apply:async()=>{let{writeFile:J,mkdir:G}=await import("node:fs/promises");if(await G(q1.dirname(Q),{recursive:!0}),!q)try{return await J(Q,`[features]
136
136
  codex_hooks = true
137
- `,"utf8"),{ok:!0,message:`Created ${F0(Q)} with [features] codex_hooks = true`}}catch(Z){return{ok:!1,message:`Write failed: ${Z.message}`}}let U=new Date().toISOString().replace(/[:.]/g,"-"),K=`${Q}.${U}.bak`;try{await J(K,V)}catch(Z){return{ok:!1,message:`Backup failed: ${Z.message}`}}let W=jZ(V,Y);try{return await J(Q,W,"utf8"),{ok:!0,message:`codex_hooks = true set in ${F0(Q)} (backup: ${q1.basename(K)})`}}catch(Z){return{ok:!1,message:`Write failed: ${Z.message}`}}}};return[{level:"action",message:`Codex needs codex_hooks = true under [features] in ${F0(Q)} before it loads ${F0(q1.join(V1,".codex","hooks.json"))}.`,fix:X}]},build(){return{hooks:{UserPromptSubmit:[{hooks:[{type:"command",command:b1("codex","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:b1("codex","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:b1("codex","post","idle")}]}],PermissionRequest:[{hooks:[{type:"command",command:b1("codex","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:b1("codex","stop","waving",1500)}]}]}}}},{id:"gemini",displayName:"Gemini CLI",configDir:q1.join(V1,".gemini"),configFile:q1.join(V1,".gemini","settings.json"),slashCommandPath:q1.join(V1,".gemini","antigravity","global_workflows","petdex.md"),docsUrl:"https://google-gemini.github.io/gemini-cli/docs/hooks",hookEntries:[{event:"BeforeTool",kind:"tool.before"},{event:"AfterTool",kind:"tool.after"},{event:"SessionEnd",kind:"session.end"}],build(){return{hooks:{BeforeTool:[{hooks:[{type:"command",command:bQ("gemini","running")}]}],AfterTool:[{hooks:[{type:"command",command:bQ("gemini","idle")}]}],SessionEnd:[{hooks:[{type:"command",command:bQ("gemini","waving",1500)}]}]}}}},{id:"opencode",displayName:"OpenCode",configDir:q1.join(V1,".config","opencode"),configFile:q1.join(V1,".config","opencode","plugins","petdex.js"),slashCommandPath:q1.join(V1,".config","opencode","command","petdex.md"),docsUrl:"https://opencode.ai/docs/plugins",hookEntries:[{event:"tool.execute.before",kind:"tool.before"},{event:"tool.execute.after",kind:"tool.after"},{event:"session.idle",kind:"session.end"},{event:"session.error",kind:"session.error"}],build(){return WZ()}}]});import{mkdir as EZ,rm as yZ,writeFile as gZ}from"node:fs/promises";import kZ from"node:path";async function kJ($){await EZ(kZ.dirname($.slashCommandPath),{recursive:!0}),await gZ($.slashCommandPath,DZ,"utf8")}async function DJ($){try{await yZ($.slashCommandPath,{force:!0})}catch{}}var V6='node "$HOME/.petdex/bin/petdex.js"',DZ;var cQ=e1(()=>{DZ=`---
138
- description: Wake or sleep the petdex mascot — toggles the floating pet on/off
137
+ `,"utf8"),{ok:!0,message:`Created ${F0(Q)} with [features] codex_hooks = true`}}catch(Z){return{ok:!1,message:`Write failed: ${Z.message}`}}let U=new Date().toISOString().replace(/[:.]/g,"-"),K=`${Q}.${U}.bak`;try{await J(K,V)}catch(Z){return{ok:!1,message:`Backup failed: ${Z.message}`}}let W=UZ(V,Y);try{return await J(Q,W,"utf8"),{ok:!0,message:`codex_hooks = true set in ${F0(Q)} (backup: ${q1.basename(K)})`}}catch(Z){return{ok:!1,message:`Write failed: ${Z.message}`}}}};return[{level:"action",message:`Codex needs codex_hooks = true under [features] in ${F0(Q)} before it loads ${F0(q1.join(V1,".codex","hooks.json"))}.`,fix:X}]},build(){return{hooks:{UserPromptSubmit:[{hooks:[{type:"command",command:z1("codex","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:z1("codex","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:z1("codex","post","idle")}]}],PermissionRequest:[{hooks:[{type:"command",command:z1("codex","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:z1("codex","stop","waving",1500)}]}]}}}},{id:"gemini",displayName:"Gemini CLI",configDir:q1.join(V1,".gemini"),configFile:q1.join(V1,".gemini","settings.json"),slashCommandPath:q1.join(V1,".gemini","antigravity","global_workflows","petdex.md"),docsUrl:"https://google-gemini.github.io/gemini-cli/docs/hooks",hookEntries:[{event:"BeforeTool",kind:"tool.before"},{event:"AfterTool",kind:"tool.after"},{event:"SessionEnd",kind:"session.end"}],build(){return{hooks:{BeforeTool:[{hooks:[{type:"command",command:z1("gemini","pre","running")}]}],AfterTool:[{hooks:[{type:"command",command:z1("gemini","post","idle")}]}],SessionEnd:[{hooks:[{type:"command",command:z1("gemini","stop","waving",1500)}]}]}}}},{id:"opencode",displayName:"OpenCode",configDir:q1.join(V1,".config","opencode"),configFile:q1.join(V1,".config","opencode","plugins","petdex.js"),slashCommandPath:q1.join(V1,".config","opencode","command","petdex.md"),docsUrl:"https://opencode.ai/docs/plugins",hookEntries:[{event:"tool.execute.before",kind:"tool.before"},{event:"tool.execute.after",kind:"tool.after"},{event:"session.idle",kind:"session.end"},{event:"session.error",kind:"session.error"}],build(){return KZ()}}]});import{mkdir as SZ,rm as EZ,writeFile as yZ}from"node:fs/promises";import gZ from"node:path";async function gJ($){await SZ(gZ.dirname($.slashCommandPath),{recursive:!0}),await yZ($.slashCommandPath,kZ,"utf8")}async function kJ($){try{await EZ($.slashCommandPath,{force:!0})}catch{}}var V6='node "$HOME/.petdex/bin/petdex.js"',kZ;var mQ=e1(()=>{kZ=`---
138
+ description: Wake or sleep the petdex mascot. Toggles the floating pet on/off
139
139
  ---
140
140
 
141
141
  The user wants to control the petdex mascot from inside the agent. The mascot is a floating macOS window driven by hooks installed in agent settings. /petdex is a one-shot toggle that flips the entire state in a single command.
@@ -148,65 +148,65 @@ Run the matching command using the persisted petdex binary at \`$HOME/.petdex/bi
148
148
  - \`/petdex status\` → run \`${V6} hooks status\`
149
149
  - \`/petdex doctor\` → run \`${V6} doctor\`
150
150
 
151
- Show the command output verbatim to the user. Don't reinterpret, don't explain — the CLI's output is already user-facing.
151
+ Show the command output verbatim to the user. Don't reinterpret, don't explain. The CLI's output is already user-facing.
152
152
 
153
- If \`$HOME/.petdex/bin/petdex.js\` doesn't exist, the user hasn't run \`petdex hooks install\` yet — tell them to run \`npx petdex@latest init\` first, then retry.
153
+ If \`$HOME/.petdex/bin/petdex.js\` doesn't exist, the user hasn't run \`petdex hooks install\` yet. Tell them to run \`npx petdex@latest init\` first, then retry.
154
154
 
155
155
  Arguments: \`$ARGUMENTS\`
156
- `});var _J={};F8(_J,{persistRunningBinary:()=>uQ,PERSIST_PATH:()=>G$,PERSIST_DIR:()=>pQ});import{copyFile as hZ,mkdir as _Z}from"node:fs/promises";import{homedir as bZ}from"node:os";import{join as hJ}from"node:path";async function uQ(){let $=process.argv[1];if(!$)return{ok:!1,path:G$,reason:"no argv[1]"};try{await _Z(pQ,{recursive:!0}),await hZ($,G$);let{chmod:Q}=await import("node:fs/promises");try{await Q(G$,493)}catch{}return{ok:!0,path:G$}}catch(Q){return{ok:!1,path:G$,reason:Q.message}}}var pQ,G$;var dQ=e1(()=>{pQ=hJ(bZ(),".petdex","bin"),G$=hJ(pQ,"petdex.js")});import{mkdir as fZ,readFile as fJ,stat as mZ,writeFile as lQ}from"node:fs/promises";import cZ from"node:path";async function pZ(){return Promise.all(t1.map(async($)=>({agent:$,installed:await mJ($.configDir)})))}async function mJ($){try{return await mZ($),!0}catch{return!1}}async function oQ(){A1(i.default.bgMagenta(i.default.white(" petdex hooks install ")));try{let{persistRunningBinary:J}=await Promise.resolve().then(() => (dQ(),_J)),G=await J();if(!G.ok&&G.reason)c.warn(`Could not persist petdex binary (${G.reason}). Bubbles will be disabled.`)}catch(J){c.warn(`Could not persist petdex binary (${J.message}). Bubbles will be disabled.`)}let $=await pZ(),Q=$.some((J)=>J.installed);c.info(Q?"Found these agents on your system:":"No coding agent configs detected. You can still pre-write hooks for any agent — they'll activate when you install it.");for(let{agent:J,installed:G}of $){let U=G?i.default.green("●"):i.default.dim("○"),K=G?i.default.dim("installed"):i.default.dim("not found");console.log(` ${U} ${i.default.bold(J.displayName)} ${K}`)}let q=await yq({message:"Which agents should drive the mascot?",options:$.map(({agent:J,installed:G})=>({value:J.id,label:J.displayName,hint:G?"installed":"not installed yet"})),initialValues:$.filter((J)=>J.installed).map((J)=>J.agent.id),required:!1});if(Q0(q)||q.length===0)return J1("No agents selected. Bye."),{installedAgents:[]};let V=[],Y=[],X=[];for(let J of q){let G=t1.find((U)=>U.id===J);if(!G)continue;try{let U=await iQ(G);if(X.push(G.id),V.push(` ${i.default.green("✓")} ${i.default.bold(G.displayName)}`),G.postInstallChecks)try{let K=await G.postInstallChecks();if(K.length>0)Y.push({agent:G.displayName,notes:K})}catch{}}catch(U){V.push(` ${i.default.red("✗")} ${i.default.bold(G.displayName)} ${i.default.red(U instanceof Error?U.message:String(U))}`)}}w1(V.join(`
156
+ `});var hJ={};F8(hJ,{persistRunningBinary:()=>pQ,PERSIST_PATH:()=>G$,PERSIST_DIR:()=>cQ});import{copyFile as DZ,mkdir as hZ}from"node:fs/promises";import{homedir as _Z}from"node:os";import{join as DJ}from"node:path";async function pQ(){let $=process.argv[1];if(!$)return{ok:!1,path:G$,reason:"no argv[1]"};try{await hZ(cQ,{recursive:!0}),await DZ($,G$);let{chmod:Q}=await import("node:fs/promises");try{await Q(G$,493)}catch{}return{ok:!0,path:G$}}catch(Q){return{ok:!1,path:G$,reason:Q.message}}}var cQ,G$;var uQ=e1(()=>{cQ=DJ(_Z(),".petdex","bin"),G$=DJ(cQ,"petdex.js")});import{mkdir as fZ,readFile as fJ,stat as bZ,writeFile as dQ}from"node:fs/promises";import mZ from"node:path";async function cZ(){return Promise.all(t1.map(async($)=>({agent:$,installed:await bJ($.configDir)})))}async function bJ($){try{return await bZ($),!0}catch{return!1}}async function lQ(){T1(i.default.bgMagenta(i.default.white(" petdex hooks install ")));try{let{persistRunningBinary:J}=await Promise.resolve().then(() => (uQ(),hJ)),G=await J();if(!G.ok&&G.reason)c.warn(`Could not persist petdex binary (${G.reason}). Bubbles will be disabled.`)}catch(J){c.warn(`Could not persist petdex binary (${J.message}). Bubbles will be disabled.`)}let $=await cZ(),Q=$.some((J)=>J.installed);c.info(Q?"Found these agents on your system:":"No coding agent configs detected. You can still pre-write hooks for any agent. They'll activate when you install it.");for(let{agent:J,installed:G}of $){let U=G?i.default.green("●"):i.default.dim("○"),K=G?i.default.dim("installed"):i.default.dim("not found");console.log(` ${U} ${i.default.bold(J.displayName)} ${K}`)}let q=await Eq({message:"Which agents should drive the mascot?",options:$.map(({agent:J,installed:G})=>({value:J.id,label:J.displayName,hint:G?"installed":"not installed yet"})),initialValues:$.filter((J)=>J.installed).map((J)=>J.agent.id),required:!1});if(Q0(q)||q.length===0)return J1("No agents selected. Bye."),{installedAgents:[]};let V=[],Y=[],X=[];for(let J of q){let G=t1.find((U)=>U.id===J);if(!G)continue;try{let U=await oQ(G);if(X.push(G.id),V.push(` ${i.default.green("✓")} ${i.default.bold(G.displayName)}`),G.postInstallChecks)try{let K=await G.postInstallChecks();if(K.length>0)Y.push({agent:G.displayName,notes:K})}catch{}}catch(U){V.push(` ${i.default.red("✗")} ${i.default.bold(G.displayName)} ${i.default.red(U instanceof Error?U.message:String(U))}`)}}A1(V.join(`
157
157
  `),"Done");for(let{agent:J,notes:G}of Y)for(let U of G){let K=U.level==="action"?i.default.bgYellow(i.default.black(" action needed ")):U.level==="warn"?i.default.yellow("!"):i.default.cyan("i");if(c.warn(`${K} ${i.default.bold(J)}
158
- ${U.message}`),U.fix){let W=await B6({message:U.fix.prompt,initialValue:!0});if(!Q0(W)&&W){let Z=await U.fix.apply();if(Z.ok)c.info(`${i.default.green("✓")} ${Z.message}`);else c.warn(`${i.default.red("✗")} ${Z.message}`)}}}return{installedAgents:X}}async function iQ($){await fZ(cZ.dirname($.configFile),{recursive:!0});let Q=$.build();if(await kJ($),$.id==="opencode"){let J=await bJ($.configFile);return await lQ($.configFile,Q,"utf8"),{backupPath:J}}let q=await uZ($.configFile);if(q.kind==="error")throw Error(`Refusing to overwrite ${$.configFile}: ${q.message}.
159
- Fix the file (or rename it) and run \`petdex hooks install\` again.`);let V=q.kind==="ok"?await bJ($.configFile):null,Y=q.kind==="ok"?q.value:{},X=dZ(Y,Q);return await lQ($.configFile,`${JSON.stringify(X,null,2)}
160
- `,"utf8"),{backupPath:V}}async function uZ($){let Q;try{Q=await fJ($,"utf8")}catch(q){let V=q.code;if(V==="ENOENT")return{kind:"missing"};return{kind:"error",message:`read failed (${V??q.name}): ${q.message}`}}try{return{kind:"ok",value:JSON.parse(Q)}}catch(q){return{kind:"error",message:`JSON parse failed: ${q.message}`}}}async function bJ($){if(!await mJ($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),q=`${$}.${Q}.bak`,V=await fJ($);return await lQ(q,V),q}function dZ($,Q){let q={...$},V=Q.hooks??{},X={...q.hooks??{}};for(let[J,G]of Object.entries(V)){let K=(Array.isArray(X[J])?X[J]:[]).filter((W)=>!lZ(W));X[J]=[...K,...G]}return q.hooks=X,q}function lZ($){if(typeof $!=="object"||$==null)return!1;return oZ($).some((q)=>q.includes(`localhost:${e$}/state`)||q.includes(R0))}function oZ($){let Q=[];function q(V){if(typeof V==="string"){Q.push(V);return}if(Array.isArray(V)){for(let Y of V)q(Y);return}if(typeof V==="object"&&V!=null)for(let Y of Object.values(V))q(Y)}return q($),Q}var i;var nQ=e1(()=>{E0();$6();cQ();i=I1(c1(),1)});var rQ={};F8(rQ,{runRefresh:()=>nZ});import{existsSync as cJ}from"node:fs";function iZ($){return cJ($.configFile)||cJ($.slashCommandPath)}async function nZ(){let $={refreshed:[],skipped:[],binaryPersisted:!1};try{let Q=await uQ();if($.binaryPersisted=Q.ok,!Q.ok)$.binaryReason=Q.reason}catch(Q){$.binaryReason=Q.message}for(let Q of t1){if(!iZ(Q)){$.skipped.push({id:Q.id,reason:"not installed"});continue}try{await iQ(Q),$.refreshed.push(Q.id)}catch(q){$.skipped.push({id:Q.id,reason:q.message})}}return $}var aQ=e1(()=>{$6();nQ();dQ()});function Lz($){let Q=$.toLowerCase();if(Q==="read")return"read";if(Q==="edit"||Q==="multiedit")return"edit";if(Q==="write")return"write";if(Q==="bash"||Q==="shell")return"bash";if(Q==="grep")return"grep";if(Q==="glob")return"glob";if(Q==="webfetch"||Q==="websearch")return"webfetch";if(Q==="task"||Q==="agent")return"task";return"unknown"}function m1($,Q){if($==null||typeof $!=="object")return null;let q=$[Q];return typeof q==="string"?q:null}function YY($){let Q=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));return Q>=0?$.slice(Q+1):$}function x1($,Q=40){if($.length<=Q)return $;return`${$.slice(0,Q-1)}…`}function XY($){if($.kind==="session.start")return"Thinking…";if($.kind==="session.end")return"Done.";if($.kind==="session.waiting")return"Waiting for you…";let{toolName:Q,phase:q,toolInput:V}=$,Y=Lz(Q),X=q==="done";switch(Y){case"read":{let J=m1(V,"file_path")??m1(V,"path"),G=J?x1(YY(J)):null;if(G)return X?`Read ${G}`:`Reading ${G}`;return X?"Read file":"Reading file"}case"edit":case"write":{let J=m1(V,"file_path")??m1(V,"path"),G=J?x1(YY(J)):null;if(G)return X?`Edited ${G}`:`Editing ${G}`;return X?"Edited file":"Editing file"}case"bash":{let J=m1(V,"command");if(J){let G=x1(J.split(/\s+/)[0]??J,24);return X?`Ran ${G}`:`Running ${G}`}return X?"Ran command":"Running command"}case"grep":{let J=m1(V,"pattern");if(J)return X?`Searched "${x1(J,28)}"`:`Searching "${x1(J,28)}"`;return X?"Searched files":"Searching files"}case"glob":{let J=m1(V,"pattern");if(J)return X?`Listed ${x1(J,28)}`:`Listing ${x1(J,28)}`;return X?"Listed files":"Listing files"}case"webfetch":{let J=m1(V,"url");if(J)try{let G=new URL(J).hostname;return X?`Fetched ${x1(G,28)}`:`Fetching ${x1(G,28)}`}catch{}return X?"Fetched web":"Searching web"}case"task":{let J=m1(V,"description")??m1(V,"subject");if(J)return X?"Subagent done":`Spawning ${x1(J,28)}`;return X?"Subagent done":"Spawning subagent"}case"unknown":default:{let J=x1(Q,28);return X?`Called ${J}`:`Calling ${J}`}}}var HY={};F8(HY,{stateForEvent:()=>jY,runBubble:()=>Fz,eventFromArgs:()=>zY});import{existsSync as Oz,readFileSync as Bz}from"node:fs";import{homedir as Nz}from"node:os";import{join as eQ}from"node:path";function jY($,Q){let q=$[0];if(q==="pre"){if(Q){let V=Q.toLowerCase();if(V==="read"||V==="grep"||V==="glob")return"review"}return"running"}if(q==="post")return"idle";if(q==="stop"||q==="session-end")return"waving";if(q==="user-prompt"||q==="session-start")return"jumping";if(q==="waiting"||q==="notification")return"waiting";return null}async function Az(){if(process.stdin.isTTY)return"";return await new Promise(($)=>{let Q="",q=!1;process.stdin.setEncoding("utf8"),process.stdin.on("data",(V)=>{if(q)return;if(Q.length+V.length>GY){Q+=V.slice(0,GY-Q.length),q=!0;return}Q+=V}),process.stdin.on("end",()=>$(Q)),process.stdin.on("error",()=>$(Q))})}function ZY($){if(!$.trim())return{toolName:null,toolInput:void 0,agentSource:null};try{let Q=JSON.parse($),q=typeof Q.tool_name==="string"?Q.tool_name:null,V=Q.tool_input,Y=typeof Q.agent_source==="string"?Q.agent_source:null;return{toolName:q,toolInput:V,agentSource:Y}}catch{return{toolName:null,toolInput:void 0,agentSource:null}}}function zY($,Q){let q=$[0];if(!q)return null;if(q==="stop"||q==="session-end")return{kind:"session.end"};if(q==="user-prompt"||q==="session-start")return{kind:"session.start"};if(q==="waiting"||q==="notification")return{kind:"session.waiting"};let V=q==="pre"?"running":q==="post"?"done":null;if(!V)return null;let{toolName:Y,toolInput:X}=ZY(Q);if(!Y)return{kind:"tool",phase:V,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:V,toolName:Y,toolInput:X}}function Tz(){try{let $=Bz(Mz,"utf8").trim();return $.length>0?$:null}catch{return null}}async function KY($,Q,q){let V=new AbortController,Y=setTimeout(()=>V.abort(),300);try{await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":q},body:JSON.stringify(Q),signal:V.signal})}catch{}finally{clearTimeout(Y)}}async function Fz($){if(Oz(Iz))return;let Q=$[1]??null,q=await Az(),V=zY($,q);if(!V)return;let{toolName:Y,agentSource:X}=ZY(q),J=X??Q,G=XY(V),U=jY($,Y),K=Tz();if(!K)return;let W=[];if(G)W.push(KY(Cz,{text:G,agent_source:J},K));if(U)W.push(KY(wz,{state:U,agent_source:J},K));await Promise.all(W)}var WY,Mz,Iz,UY="http://127.0.0.1:7777",Cz,wz,GY=65536;var PY=e1(()=>{WY=eQ(Nz(),".petdex","runtime"),Mz=eQ(WY,"update-token"),Iz=eQ(WY,"hooks-disabled"),Cz=`${UY}/bubble`,wz=`${UY}/state`});E0();var Vq=I1(u7(),1),j=I1(c1(),1);import{mkdir as LY,readdir as Rz,readFile as qq,stat as wY,writeFile as M8}from"node:fs/promises";import{homedir as OY}from"node:os";import X1 from"node:path";import{spawn as gj}from"node:child_process";import{createServer as Mj}from"node:http";class k extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var Ij=`<!doctype html>
158
+ ${U.message}`),U.fix){let W=await B6({message:U.fix.prompt,initialValue:!0});if(!Q0(W)&&W){let Z=await U.fix.apply();if(Z.ok)c.info(`${i.default.green("✓")} ${Z.message}`);else c.warn(`${i.default.red("✗")} ${Z.message}`)}}}return{installedAgents:X}}async function oQ($){await fZ(mZ.dirname($.configFile),{recursive:!0});let Q=$.build();if(await gJ($),$.id==="opencode"){let J=await _J($.configFile);return await dQ($.configFile,Q,"utf8"),{backupPath:J}}let q=await pZ($.configFile);if(q.kind==="error")throw Error(`Refusing to overwrite ${$.configFile}: ${q.message}.
159
+ Fix the file (or rename it) and run \`petdex hooks install\` again.`);let V=q.kind==="ok"?await _J($.configFile):null,Y=q.kind==="ok"?q.value:{},X=uZ(Y,Q);return await dQ($.configFile,`${JSON.stringify(X,null,2)}
160
+ `,"utf8"),{backupPath:V}}async function pZ($){let Q;try{Q=await fJ($,"utf8")}catch(q){let V=q.code;if(V==="ENOENT")return{kind:"missing"};return{kind:"error",message:`read failed (${V??q.name}): ${q.message}`}}try{return{kind:"ok",value:JSON.parse(Q)}}catch(q){return{kind:"error",message:`JSON parse failed: ${q.message}`}}}async function _J($){if(!await bJ($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),q=`${$}.${Q}.bak`,V=await fJ($);return await dQ(q,V),q}function uZ($,Q){let q={...$},V=Q.hooks??{},X={...q.hooks??{}};for(let[J,G]of Object.entries(V)){let K=(Array.isArray(X[J])?X[J]:[]).filter((W)=>!dZ(W));X[J]=[...K,...G]}return q.hooks=X,q}function dZ($){if(typeof $!=="object"||$==null)return!1;return lZ($).some((q)=>q.includes(`localhost:${e$}/state`)||q.includes(J$))}function lZ($){let Q=[];function q(V){if(typeof V==="string"){Q.push(V);return}if(Array.isArray(V)){for(let Y of V)q(Y);return}if(typeof V==="object"&&V!=null)for(let Y of Object.values(V))q(Y)}return q($),Q}var i;var iQ=e1(()=>{S0();$6();mQ();i=C1(c1(),1)});var nQ={};F8(nQ,{runRefresh:()=>iZ});import{existsSync as mJ}from"node:fs";function oZ($){return mJ($.configFile)||mJ($.slashCommandPath)}async function iZ(){let $={refreshed:[],skipped:[],binaryPersisted:!1};try{let Q=await pQ();if($.binaryPersisted=Q.ok,!Q.ok)$.binaryReason=Q.reason}catch(Q){$.binaryReason=Q.message}for(let Q of t1){if(!oZ(Q)){$.skipped.push({id:Q.id,reason:"not installed"});continue}try{await oQ(Q),$.refreshed.push(Q.id)}catch(q){$.skipped.push({id:Q.id,reason:q.message})}}return $}var rQ=e1(()=>{$6();iQ();uQ()});function Pz($){let Q=$.toLowerCase();if(Q==="read")return"read";if(Q==="edit"||Q==="multiedit")return"edit";if(Q==="write")return"write";if(Q==="bash"||Q==="shell")return"bash";if(Q==="grep")return"grep";if(Q==="glob")return"glob";if(Q==="webfetch"||Q==="websearch")return"webfetch";if(Q==="task"||Q==="agent")return"task";return"unknown"}function m1($,Q){if($==null||typeof $!=="object")return null;let q=$[Q];return typeof q==="string"?q:null}function JY($){let Q=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));return Q>=0?$.slice(Q+1):$}function S1($,Q=40){if($.length<=Q)return $;return`${$.slice(0,Q-1)}…`}function YY($){if($.kind==="session.start")return"Thinking…";if($.kind==="session.end")return"Done.";if($.kind==="session.waiting")return"Waiting for you…";let{toolName:Q,phase:q,toolInput:V}=$,Y=Pz(Q),X=q==="done";switch(Y){case"read":{let J=m1(V,"file_path")??m1(V,"path"),G=J?S1(JY(J)):null;if(G)return X?`Read ${G}`:`Reading ${G}`;return X?"Read file":"Reading file"}case"edit":case"write":{let J=m1(V,"file_path")??m1(V,"path"),G=J?S1(JY(J)):null;if(G)return X?`Edited ${G}`:`Editing ${G}`;return X?"Edited file":"Editing file"}case"bash":{let J=m1(V,"command");if(J){let G=S1(J.split(/\s+/)[0]??J,24);return X?`Ran ${G}`:`Running ${G}`}return X?"Ran command":"Running command"}case"grep":{let J=m1(V,"pattern");if(J)return X?`Searched "${S1(J,28)}"`:`Searching "${S1(J,28)}"`;return X?"Searched files":"Searching files"}case"glob":{let J=m1(V,"pattern");if(J)return X?`Listed ${S1(J,28)}`:`Listing ${S1(J,28)}`;return X?"Listed files":"Listing files"}case"webfetch":{let J=m1(V,"url");if(J)try{let G=new URL(J).hostname;return X?`Fetched ${S1(G,28)}`:`Fetching ${S1(G,28)}`}catch{}return X?"Fetched web":"Searching web"}case"task":{let J=m1(V,"description")??m1(V,"subject");if(J)return X?"Subagent done":`Spawning ${S1(J,28)}`;return X?"Subagent done":"Spawning subagent"}case"unknown":default:{let J=S1(Q,28);return X?`Called ${J}`:`Calling ${J}`}}}var zY={};F8(zY,{stateForEvent:()=>UY,runBubble:()=>Tz,eventFromArgs:()=>ZY});import{existsSync as Lz,readFileSync as Oz}from"node:fs";import{homedir as Bz}from"node:os";import{join as tQ}from"node:path";function UY($,Q){let q=$[0];if(q==="pre"){if(Q){let V=Q.toLowerCase();if(V==="read"||V==="grep"||V==="glob")return"review"}return"running"}if(q==="post")return"idle";if(q==="stop"||q==="session-end")return"waving";if(q==="user-prompt"||q==="session-start")return"jumping";if(q==="waiting"||q==="notification")return"waiting";return null}async function wz(){if(process.stdin.isTTY)return"";return await new Promise(($)=>{let Q="",q=!1;process.stdin.setEncoding("utf8"),process.stdin.on("data",(V)=>{if(q)return;if(Q.length+V.length>XY){Q+=V.slice(0,XY-Q.length),q=!0;return}Q+=V}),process.stdin.on("end",()=>$(Q)),process.stdin.on("error",()=>$(Q))})}function jY($){if(!$.trim())return{toolName:null,toolInput:void 0,agentSource:null};try{let Q=JSON.parse($),q=typeof Q.tool_name==="string"?Q.tool_name:null,V=Q.tool_input,Y=typeof Q.agent_source==="string"?Q.agent_source:null;return{toolName:q,toolInput:V,agentSource:Y}}catch{return{toolName:null,toolInput:void 0,agentSource:null}}}function ZY($,Q){let q=$[0];if(!q)return null;if(q==="stop"||q==="session-end")return{kind:"session.end"};if(q==="user-prompt"||q==="session-start")return{kind:"session.start"};if(q==="waiting"||q==="notification")return{kind:"session.waiting"};let V=q==="pre"?"running":q==="post"?"done":null;if(!V)return null;let{toolName:Y,toolInput:X}=jY(Q);if(!Y)return{kind:"tool",phase:V,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:V,toolName:Y,toolInput:X}}function Az(){try{let $=Oz(Nz,"utf8").trim();return $.length>0?$:null}catch{return null}}async function GY($,Q,q){let V=new AbortController,Y=setTimeout(()=>V.abort(),300);try{await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":q},body:JSON.stringify(Q),signal:V.signal})}catch{}finally{clearTimeout(Y)}}async function Tz($){if(Lz(Mz))return;let Q=$[1]??null,q=await wz(),V=ZY($,q);if(!V)return;let{toolName:Y,agentSource:X}=jY(q),J=X??Q,G=YY(V),U=UY($,Y),K=Az();if(!K)return;let W=[];if(G)W.push(GY(Iz,{text:G,agent_source:J},K));if(U)W.push(GY(Cz,{state:U,agent_source:J},K));await Promise.all(W)}var KY,Nz,Mz,WY="http://127.0.0.1:7777",Iz,Cz,XY=65536;var HY=e1(()=>{KY=tQ(Bz(),".petdex","runtime"),Nz=tQ(KY,"update-token"),Mz=tQ(KY,"hooks-disabled"),Iz=`${WY}/bubble`,Cz=`${WY}/state`});S0();var qq=C1(p7(),1),j=C1(c1(),1);import{mkdir as PY,readdir as Fz,readFile as Qq,stat as CY,writeFile as M8}from"node:fs/promises";import{homedir as LY}from"node:os";import X1 from"node:path";import{spawn as yj}from"node:child_process";import{createServer as Nj}from"node:http";class k extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var Mj=`<!doctype html>
161
161
  <html>
162
162
  <head><meta charset="utf-8"><title>Authentication complete</title></head>
163
163
  <body><h1>Authentication complete</h1><p>You can close this tab and return to your terminal.</p></body>
164
- </html>`,Cj=`<!doctype html>
164
+ </html>`,Ij=`<!doctype html>
165
165
  <html>
166
166
  <head><meta charset="utf-8"><title>Authentication failed</title></head>
167
167
  <body><h1>Authentication failed</h1><p>You can close this tab and return to your terminal.</p></body>
168
- </html>`;function SQ($,Q){return new k($,Q)}function d7($){let{expectedState:Q,port:q=0,timeoutMs:V=120000,successHtml:Y=Ij,errorHtml:X=Cj}=$,J,G=!1,U=!1,K,W,Z=new Promise((C,P)=>{K=C,W=P}),z=(C)=>{if(U)return;U=!0,C.close()},H=Mj((C,P)=>{if(G){P.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Authentication callback already handled.");return}if(C.method!=="GET"||!C.url){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Not found");return}let I=new URL(C.url,"http://127.0.0.1");if(I.pathname!=="/callback"){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Clerk CLI auth server is waiting for /callback.");return}let M=I.searchParams.get("code"),L=I.searchParams.get("state"),A=I.searchParams.get("error"),B=I.searchParams.get("error_description")??A,O=(F,R,v)=>{if(G=!0,J)clearTimeout(J);P.writeHead(F,{"Content-Type":"text/html; charset=utf-8"}),P.end(R,()=>{if(v)W(v);else if(M&&L)K({code:M,state:L});z(H)})};if(A){O(400,X,SQ("token_exchange",`OAuth authorization failed: ${B??"unknown error"}`));return}if(L!==Q){O(400,X,SQ("state_mismatch","OAuth callback state did not match."));return}if(!M){O(400,X,SQ("token_exchange","OAuth callback did not include an authorization code."));return}O(200,Y)});return new Promise((C,P)=>{H.once("error",(I)=>{P(new k("config",`Failed to start local auth callback server: ${I.message}`))}),H.listen(q,"127.0.0.1",()=>{let M=H.address().port,L=`http://127.0.0.1:${M}/callback`;J=setTimeout(()=>{if(G)return;G=!0,W(new k("timeout",`OAuth callback timed out after ${V}ms.`)),z(H)},V),C({port:M,redirectUri:L,waitForCallback:()=>Z,close:()=>{if(J)clearTimeout(J);if(!G)G=!0,W(new k("timeout","OAuth callback server was closed."));z(H)}})})})}import{chmod as wj,mkdir as Aj,readFile as Tj,writeFile as Fj}from"node:fs/promises";import{homedir as Rj}from"node:os";import{dirname as vj,join as xj}from"node:path";function l7($,Q){if(Q instanceof k)return Q;let q=Q instanceof Error?Q.message:String(Q);return new k("storage",`${$}: ${q}`)}function i7($){return $?.environment??"default"}function Sj($){return xj(Rj(),".config","clerk-cli-auth",`${$}.json`)}class n7{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class r7{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 Tj(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let q={};for(let[V,Y]of Object.entries(Q))if(typeof Y==="string")q[V]=Y;return q}catch($){if($.code==="ENOENT")return{};throw l7(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await Aj(vj(this.filePath),{recursive:!0}),await Fj(this.filePath,`${JSON.stringify($,null,2)}
169
- `,{mode:384}),await wj(this.filePath,384)}catch(Q){throw l7(`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 q=await this.readAll();q[$]=Q,await this.writeAll(q)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class a7{service;environment;fallback;keyringPromise=null;constructor($,Q,q){this.service=$;this.environment=Q;this.fallback=q}account($){return`${this.environment}:${$}`}warnFallback($,Q){let q=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&q.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${q}`)}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 q=await this.loadKeyring();if(!q){await this.fallback.set($,Q);return}new q.Entry(this.service,this.account($)).setPassword(Q)}catch(q){this.warnFallback("set",q),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 o7($){let Q=i7($);return new r7($?.filePath??Sj(Q))}function s7($,Q){if($==="memory")return new n7;if($==="file")return o7(Q);let q=o7(Q),V=Q?.keychainService??"clerk-cli-auth",Y=i7(Q);return new a7(V,Y,q)}import{createHash as Ej,randomBytes as t7}from"node:crypto";function EQ($){return $.toString("base64url")}function e7(){return EQ(t7(32))}async function $J($){return EQ(Ej("sha256").update($).digest())}function QJ(){return EQ(t7(32))}function qJ($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function VJ($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function JJ($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let q=$;for(let V of["error_description","message","error"]){let Y=q[V];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function yj($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new k("token_exchange","Token response did not include access_token.");let Q={accessToken:$.access_token};if(typeof $.refresh_token==="string")Q.refreshToken=$.refresh_token;if(typeof $.id_token==="string")Q.idToken=$.id_token;if(typeof $.scope==="string")Q.scope=$.scope;if(typeof $.token_type==="string")Q.tokenType=$.token_type;if(typeof $.expires_in==="number")Q.expiresAt=Date.now()+$.expires_in*1000;return Q}async function YJ($,Q){let q;try{q=await fetch(qJ($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new k("token_exchange",`Token request failed: ${Y.message}`)}let V;try{V=await VJ(q)}catch(Y){throw new k("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!q.ok)throw new k("token_exchange",JJ(V,`Token request failed with HTTP ${q.status}.`));if(!V||typeof V!=="object")throw new k("token_exchange","Token response was not JSON.");return yj(V)}async function XJ($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return YJ($.issuer,Q)}async function GJ($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return YJ($.issuer,Q)}async function yQ($){let Q;try{Q=await fetch(qJ($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new k("userinfo",`Userinfo request failed: ${Y.message}`)}let q;try{q=await VJ(Q)}catch(Y){throw new k("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new k("userinfo",JJ(q,`Userinfo request failed with HTTP ${Q.status}.`));if(!q||typeof q!=="object")throw new k("userinfo","Userinfo response was not JSON.");let V=q;if(typeof V.sub!=="string"||V.sub.length===0)throw new k("userinfo","Userinfo response did not include sub.");return V}var kj=["profile","email","openid","offline_access"];function Dj($){let Q=$.trim().replace(/\/+$/,"");try{let q=new URL(Q);if(q.protocol!=="http:"&&q.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(q){throw new k("config",`issuer must be a valid URL: ${q.message}`)}}function U8($,Q){if(Q instanceof k)return Q;let q=Q instanceof Error?Q.message:String(Q);return new k("storage",`Failed to ${$}: ${q}`)}async function hj($){console.log(`Open this URL to sign in:
170
- ${$}`);let Q=process.platform,q=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",V=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let X=gj(q,V,{detached:!0,stdio:"ignore"});X.once("error",()=>Y()),X.unref(),Y()})}class j8{config;constructor($){if(!$.clientId)throw new k("config","clientId is required");if(!$.issuer)throw new k("config","issuer is required");let Q=$.environment??"default",q=typeof $.storage==="object"&&$.storage!==null?$.storage:s7($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:Dj($.issuer),scopes:$.scopes??kj,storage:q,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=e7(),Q=await $J($),q=QJ(),V=await d7({expectedState:q,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",V.redirectUri),Y.searchParams.set("scope",this.config.scopes.join(" ")),Y.searchParams.set("state",q),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??hj)(Y.toString())}catch(U){throw new k("config",`Failed to open authorization URL: ${U.message}`)}let{code:X}=await V.waitForCallback(),J=await XJ({issuer:this.config.issuer,clientId:this.config.clientId,code:X,codeVerifier:$,redirectUri:V.redirectUri});await this.setJson("tokens",J);let G=await yQ({issuer:this.config.issuer,accessToken:J.accessToken});return await this.setJson("user",G),{tokens:J,user:G}}finally{V.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 q=await GJ({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),V={...$,...q,refreshToken:q.refreshToken??$.refreshToken};return await this.setJson("tokens",V),V.accessToken}async whoami(){let $=await this.getJson("user");if($)return $;let Q=await this.getAccessToken();if(!Q)return null;let q=await yQ({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",q),q}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw U8("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(q){throw U8(`read ${$}`,q)}if(!Q)return null;try{return JSON.parse(Q)}catch(q){throw U8(`parse stored ${$}`,q)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(q){throw U8(`write ${$}`,q)}}}import{randomBytes as _j}from"node:crypto";import{existsSync as gQ,statSync as bj}from"node:fs";import{chmod as fj,mkdir as Z8,rename as l$,rm as a1,writeFile as z8}from"node:fs/promises";import{homedir as V$,arch as mj,platform as o$}from"node:os";import Q1 from"node:path";E0();var r=I1(c1(),1),cj="https://api.github.com/repos/crafter-station/petdex/releases",KJ=30,pj=5,WJ="desktop-v",zJ="petdex-desktop-sidecar.js";function HJ(){let $=o$(),Q=mj(),q=$==="darwin"?"darwin":$==="linux"?"linux":$==="win32"?"win32":$,V=Q==="arm64"?"arm64":Q==="x64"?"x64":Q;return{osLabel:q,archLabel:V,assetSuffix:`${q}-${V}`}}function J$(){let $=o$()==="win32"?".exe":"";if(o$()==="darwin"){let Q=["/Applications/Petdex.app/Contents/MacOS/petdex-desktop",Q1.join(V$(),"Applications","Petdex.app","Contents","MacOS","petdex-desktop")];for(let q of Q)if(gQ(q))return q}return Q1.join(V$(),".petdex","bin",`petdex-desktop${$}`)}function H8(){if(o$()==="darwin"){let $=["/Applications/Petdex.app/Contents/Resources/sidecar/server.js",Q1.join(V$(),"Applications","Petdex.app","Contents","Resources","sidecar","server.js")];for(let Q of $)if(gQ(Q))return Q}return Q1.join(V$(),".petdex","sidecar","server.js")}async function kQ($={}){let Q=$.fetchOverride??fetch,q=$.maxPages??pj,V=0;for(let Y=1;Y<=q;Y++){let X=`${cj}?per_page=${KJ}&page=${Y}`,J=await Q(X,{headers:{Accept:"application/vnd.github+json"}});if(!J.ok)throw Error(`GitHub API ${J.status}`);let G=await J.json();if(!Array.isArray(G)||G.length===0)break;V+=G.length;let U=G.find((K)=>!K.draft&&!K.prerelease&&typeof K.tag_name==="string"&&K.tag_name.startsWith(WJ));if(U)return U;if(G.length<KJ)break}throw Error(`No ${WJ}* release found in the last ${V} releases (scanned ${q} page(s))`)}function uj($,Q){let q=`petdex-desktop-${Q}`,V=$.assets.find((Y)=>Y.name.startsWith(q));if(!V){let Y=$.assets.map((X)=>` ${X.name}`).join(`
168
+ </html>`;function SQ($,Q){return new k($,Q)}function u7($){let{expectedState:Q,port:q=0,timeoutMs:V=120000,successHtml:Y=Mj,errorHtml:X=Ij}=$,J,G=!1,U=!1,K,W,Z=new Promise((C,P)=>{K=C,W=P}),z=(C)=>{if(U)return;U=!0,C.close()},H=Nj((C,P)=>{if(G){P.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Authentication callback already handled.");return}if(C.method!=="GET"||!C.url){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Not found");return}let I=new URL(C.url,"http://127.0.0.1");if(I.pathname!=="/callback"){P.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),P.end("Clerk CLI auth server is waiting for /callback.");return}let M=I.searchParams.get("code"),L=I.searchParams.get("state"),A=I.searchParams.get("error"),B=I.searchParams.get("error_description")??A,O=(F,R,v)=>{if(G=!0,J)clearTimeout(J);P.writeHead(F,{"Content-Type":"text/html; charset=utf-8"}),P.end(R,()=>{if(v)W(v);else if(M&&L)K({code:M,state:L});z(H)})};if(A){O(400,X,SQ("token_exchange",`OAuth authorization failed: ${B??"unknown error"}`));return}if(L!==Q){O(400,X,SQ("state_mismatch","OAuth callback state did not match."));return}if(!M){O(400,X,SQ("token_exchange","OAuth callback did not include an authorization code."));return}O(200,Y)});return new Promise((C,P)=>{H.once("error",(I)=>{P(new k("config",`Failed to start local auth callback server: ${I.message}`))}),H.listen(q,"127.0.0.1",()=>{let M=H.address().port,L=`http://127.0.0.1:${M}/callback`;J=setTimeout(()=>{if(G)return;G=!0,W(new k("timeout",`OAuth callback timed out after ${V}ms.`)),z(H)},V),C({port:M,redirectUri:L,waitForCallback:()=>Z,close:()=>{if(J)clearTimeout(J);if(!G)G=!0,W(new k("timeout","OAuth callback server was closed."));z(H)}})})})}import{chmod as Cj,mkdir as wj,readFile as Aj,writeFile as Tj}from"node:fs/promises";import{homedir as Fj}from"node:os";import{dirname as Rj,join as vj}from"node:path";function d7($,Q){if(Q instanceof k)return Q;let q=Q instanceof Error?Q.message:String(Q);return new k("storage",`${$}: ${q}`)}function o7($){return $?.environment??"default"}function xj($){return vj(Fj(),".config","clerk-cli-auth",`${$}.json`)}class i7{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class n7{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 Aj(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let q={};for(let[V,Y]of Object.entries(Q))if(typeof Y==="string")q[V]=Y;return q}catch($){if($.code==="ENOENT")return{};throw d7(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await wj(Rj(this.filePath),{recursive:!0}),await Tj(this.filePath,`${JSON.stringify($,null,2)}
169
+ `,{mode:384}),await Cj(this.filePath,384)}catch(Q){throw d7(`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 q=await this.readAll();q[$]=Q,await this.writeAll(q)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class r7{service;environment;fallback;keyringPromise=null;constructor($,Q,q){this.service=$;this.environment=Q;this.fallback=q}account($){return`${this.environment}:${$}`}warnFallback($,Q){let q=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&q.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${q}`)}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 q=await this.loadKeyring();if(!q){await this.fallback.set($,Q);return}new q.Entry(this.service,this.account($)).setPassword(Q)}catch(q){this.warnFallback("set",q),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 l7($){let Q=o7($);return new n7($?.filePath??xj(Q))}function a7($,Q){if($==="memory")return new i7;if($==="file")return l7(Q);let q=l7(Q),V=Q?.keychainService??"clerk-cli-auth",Y=o7(Q);return new r7(V,Y,q)}import{createHash as Sj,randomBytes as s7}from"node:crypto";function EQ($){return $.toString("base64url")}function t7(){return EQ(s7(32))}async function e7($){return EQ(Sj("sha256").update($).digest())}function $J(){return EQ(s7(32))}function QJ($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function qJ($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function VJ($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let q=$;for(let V of["error_description","message","error"]){let Y=q[V];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function Ej($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new k("token_exchange","Token response did not include access_token.");let Q={accessToken:$.access_token};if(typeof $.refresh_token==="string")Q.refreshToken=$.refresh_token;if(typeof $.id_token==="string")Q.idToken=$.id_token;if(typeof $.scope==="string")Q.scope=$.scope;if(typeof $.token_type==="string")Q.tokenType=$.token_type;if(typeof $.expires_in==="number")Q.expiresAt=Date.now()+$.expires_in*1000;return Q}async function JJ($,Q){let q;try{q=await fetch(QJ($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new k("token_exchange",`Token request failed: ${Y.message}`)}let V;try{V=await qJ(q)}catch(Y){throw new k("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!q.ok)throw new k("token_exchange",VJ(V,`Token request failed with HTTP ${q.status}.`));if(!V||typeof V!=="object")throw new k("token_exchange","Token response was not JSON.");return Ej(V)}async function YJ($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return JJ($.issuer,Q)}async function XJ($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return JJ($.issuer,Q)}async function yQ($){let Q;try{Q=await fetch(QJ($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new k("userinfo",`Userinfo request failed: ${Y.message}`)}let q;try{q=await qJ(Q)}catch(Y){throw new k("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new k("userinfo",VJ(q,`Userinfo request failed with HTTP ${Q.status}.`));if(!q||typeof q!=="object")throw new k("userinfo","Userinfo response was not JSON.");let V=q;if(typeof V.sub!=="string"||V.sub.length===0)throw new k("userinfo","Userinfo response did not include sub.");return V}var gj=["profile","email","openid","offline_access"];function kj($){let Q=$.trim().replace(/\/+$/,"");try{let q=new URL(Q);if(q.protocol!=="http:"&&q.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(q){throw new k("config",`issuer must be a valid URL: ${q.message}`)}}function U8($,Q){if(Q instanceof k)return Q;let q=Q instanceof Error?Q.message:String(Q);return new k("storage",`Failed to ${$}: ${q}`)}async function Dj($){console.log(`Open this URL to sign in:
170
+ ${$}`);let Q=process.platform,q=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",V=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let X=yj(q,V,{detached:!0,stdio:"ignore"});X.once("error",()=>Y()),X.unref(),Y()})}class j8{config;constructor($){if(!$.clientId)throw new k("config","clientId is required");if(!$.issuer)throw new k("config","issuer is required");let Q=$.environment??"default",q=typeof $.storage==="object"&&$.storage!==null?$.storage:a7($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:kj($.issuer),scopes:$.scopes??gj,storage:q,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=t7(),Q=await e7($),q=$J(),V=await u7({expectedState:q,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",V.redirectUri),Y.searchParams.set("scope",this.config.scopes.join(" ")),Y.searchParams.set("state",q),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??Dj)(Y.toString())}catch(U){throw new k("config",`Failed to open authorization URL: ${U.message}`)}let{code:X}=await V.waitForCallback(),J=await YJ({issuer:this.config.issuer,clientId:this.config.clientId,code:X,codeVerifier:$,redirectUri:V.redirectUri});await this.setJson("tokens",J);let G=await yQ({issuer:this.config.issuer,accessToken:J.accessToken});return await this.setJson("user",G),{tokens:J,user:G}}finally{V.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 q=await XJ({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),V={...$,...q,refreshToken:q.refreshToken??$.refreshToken};return await this.setJson("tokens",V),V.accessToken}async whoami(){let $=await this.getJson("user");if($)return $;let Q=await this.getAccessToken();if(!Q)return null;let q=await yQ({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",q),q}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw U8("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(q){throw U8(`read ${$}`,q)}if(!Q)return null;try{return JSON.parse(Q)}catch(q){throw U8(`parse stored ${$}`,q)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(q){throw U8(`write ${$}`,q)}}}import{randomBytes as hj}from"node:crypto";import{existsSync as gQ,statSync as _j}from"node:fs";import{chmod as fj,mkdir as Z8,rename as l$,rm as a1,writeFile as z8}from"node:fs/promises";import{homedir as q$,arch as bj,platform as o$}from"node:os";import Q1 from"node:path";S0();var r=C1(c1(),1),mj="https://api.github.com/repos/crafter-station/petdex/releases",GJ=30,cj=5,KJ="desktop-v",ZJ="petdex-desktop-sidecar.js";function zJ(){let $=o$(),Q=bj(),q=$==="darwin"?"darwin":$==="linux"?"linux":$==="win32"?"win32":$,V=Q==="arm64"?"arm64":Q==="x64"?"x64":Q;return{osLabel:q,archLabel:V,assetSuffix:`${q}-${V}`}}function V$(){let $=o$()==="win32"?".exe":"";if(o$()==="darwin"){let Q=["/Applications/Petdex.app/Contents/MacOS/petdex-desktop",Q1.join(q$(),"Applications","Petdex.app","Contents","MacOS","petdex-desktop")];for(let q of Q)if(gQ(q))return q}return Q1.join(q$(),".petdex","bin",`petdex-desktop${$}`)}function H8(){if(o$()==="darwin"){let $=["/Applications/Petdex.app/Contents/Resources/sidecar/server.js",Q1.join(q$(),"Applications","Petdex.app","Contents","Resources","sidecar","server.js")];for(let Q of $)if(gQ(Q))return Q}return Q1.join(q$(),".petdex","sidecar","server.js")}async function kQ($={}){let Q=$.fetchOverride??fetch,q=$.maxPages??cj,V=0;for(let Y=1;Y<=q;Y++){let X=`${mj}?per_page=${GJ}&page=${Y}`,J=await Q(X,{headers:{Accept:"application/vnd.github+json"}});if(!J.ok)throw Error(`GitHub API ${J.status}`);let G=await J.json();if(!Array.isArray(G)||G.length===0)break;V+=G.length;let U=G.find((K)=>!K.draft&&!K.prerelease&&typeof K.tag_name==="string"&&K.tag_name.startsWith(KJ));if(U)return U;if(G.length<GJ)break}throw Error(`No ${KJ}* release found in the last ${V} releases (scanned ${q} page(s))`)}function pj($,Q){let q=`petdex-desktop-${Q}`,V=$.assets.find((Y)=>Y.name.startsWith(q));if(!V){let Y=$.assets.map((X)=>` ${X.name}`).join(`
171
171
  `);throw Error(`No binary for ${Q} in ${$.tag_name}.
172
172
  Available:
173
- ${Y}`)}return V}function dj($){return $.assets.find((Q)=>Q.name===zJ)??null}async function UJ($,Q,q){let V=await fetch($);if(!V.ok||!V.body)throw Error(`download ${$} → ${V.status}`);let Y=Buffer.from(await V.arrayBuffer()),X=`${Q}.tmp`;try{if(await z8(X,Y),q!==void 0)await fj(X,q);if(o$()==="darwin")try{let{spawnSync:J}=await import("node:child_process");J("xattr",["-d","com.apple.quarantine",X],{stdio:"ignore"})}catch{}return{tmpPath:X,destPath:Q}}catch(J){try{await a1(X,{force:!0})}catch{}throw J}}async function lj($){let Q=[];for(let q of $){let V=null;try{let Y=`${q.destPath}.prev`;try{await l$(q.destPath,Y),V=Y}catch(X){if(X.code!=="ENOENT")throw X}await l$(q.tmpPath,q.destPath),Q.push({dest:q.destPath,backup:V})}catch(Y){if(V)try{await a1(q.destPath,{force:!0}),await l$(V,q.destPath)}catch{}for(let X of Q.reverse())try{if(X.backup)await a1(X.dest,{force:!0}),await l$(X.backup,X.dest);else await a1(X.dest,{force:!0})}catch{}for(let X of $)try{await a1(X.tmpPath,{force:!0})}catch{}throw Y}}for(let q of Q){if(!q.backup)continue;try{await a1(q.backup,{force:!0})}catch{}}}async function DQ($){let Q=HJ(),q=uj($,Q.assetSuffix),V=dj($),Y=J$(),X=H8();await Z8(Q1.dirname(Y),{recursive:!0}),await Z8(Q1.dirname(X),{recursive:!0});let J=[];try{if(J.push(await UJ(q.browser_download_url,Y,493)),V)J.push(await UJ(V.browser_download_url,X))}catch(G){for(let U of J)try{await a1(U.tmpPath,{force:!0})}catch{}throw G}return{binAsset:q,sidecarAsset:V,staged:J}}async function hQ($){await lj($.staged)}async function oj($){let Q=await DQ($);return await hQ(Q),{binAsset:Q.binAsset,sidecarAsset:Q.sidecarAsset}}var ij="boba",nj=process.env.PETDEX_URL??"https://petdex.crafter.run",rj=new Set(["pub-94495283df974cfea5e98d6a9e3fa462.r2.dev","yu2vz9gndp.ufs.sh"]);function i$($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return rj.has(Q.hostname)}catch{return!1}}function PJ(){return process.env.HOME??V$()}function LJ(){return Q1.join(PJ(),".petdex","pets")}function OJ(){return Q1.join(PJ(),".codex","pets")}var aj=16777216;function sj($){for(let Q of["spritesheet.webp","spritesheet.png"]){let q=Q1.join($,Q);try{let V=bj(q);if(V.isFile()&&V.size>0&&V.size<=aj)return!0}catch{}}return!1}async function tj(){let{readdir:$}=await import("node:fs/promises");for(let Q of[LJ(),OJ()]){let q;try{q=await $(Q)}catch{continue}for(let V of q)if(sj(Q1.join(Q,V)))return!0}return!1}async function ej($={}){let Q=$.fetchOverride??fetch,q=$.petdexUrl??nj,V;try{let G=await Q(`${q}/api/manifest`,{signal:AbortSignal.timeout(8000)});if(!G.ok)return null;let U=await G.json();V=Array.isArray(U?.pets)?U.pets:[]}catch{return null}if(V.length===0)return null;let Y=[],X=new Set,J=V.find((G)=>G.slug===ij);if(J)Y.push(J),X.add(J.slug);for(let G of V)if(!X.has(G.slug))Y.push(G),X.add(G.slug);for(let G of Y){let U=await $Z(G,Q);if(U)return U}return null}async function $Z($,Q){if(!i$($.spritesheetUrl)||!i$($.petJsonUrl))return null;let q=$.spritesheetUrl.endsWith(".png")?"png":"webp",V=[Q1.join(LJ(),$.slug),Q1.join(OJ(),$.slug)];for(let K of V)if(gQ(K))return null;let Y=async(K)=>{let W=await Q(K,{signal:AbortSignal.timeout(15000)});if(!W.ok)throw Error(`download ${K} → ${W.status}`);return W.arrayBuffer()},X,J;try{[X,J]=await Promise.all([Y($.petJsonUrl),Y($.spritesheetUrl)])}catch{return null}let G=[],U=[];try{for(let K of V){let W=`${K}.partial-${_j(6).toString("hex")}`;await Z8(W,{recursive:!0}),G.push(W),await Promise.all([z8(Q1.join(W,"pet.json"),Buffer.from(X)),z8(Q1.join(W,`spritesheet.${q}`),Buffer.from(J))]),await Z8(Q1.dirname(K),{recursive:!0}),await l$(W,K),G.pop(),U.push(K)}return $.slug}catch{return await Promise.all([...G.map((K)=>a1(K,{recursive:!0,force:!0})),...U.map((K)=>a1(K,{recursive:!0,force:!0}))]),null}}async function BJ(){A1(r.default.bgMagenta(r.default.white(" petdex install desktop ")));let $=HJ();c.info(`Platform: ${r.default.cyan(`${$.osLabel} ${$.archLabel}`)}`);let Q=z1();Q.start("Looking up the latest release");let q;try{q=await kQ()}catch(W){throw Q.stop(r.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
174
- ${W.message}`)}Q.stop(`${r.default.green("✓")} Latest: ${r.default.bold(q.tag_name)}`);let V=z1();V.start("Downloading desktop binary and sidecar");let Y;try{Y=await oj(q)}catch(W){throw V.stop(r.default.red("failed")),W}let X=J$(),J=Q1.join(V$(),".petdex","version");await z8(J,`${q.tag_name}
173
+ ${Y}`)}return V}function uj($){return $.assets.find((Q)=>Q.name===ZJ)??null}async function WJ($,Q,q){let V=await fetch($);if(!V.ok||!V.body)throw Error(`download ${$} → ${V.status}`);let Y=Buffer.from(await V.arrayBuffer()),X=`${Q}.tmp`;try{if(await z8(X,Y),q!==void 0)await fj(X,q);if(o$()==="darwin")try{let{spawnSync:J}=await import("node:child_process");J("xattr",["-d","com.apple.quarantine",X],{stdio:"ignore"})}catch{}return{tmpPath:X,destPath:Q}}catch(J){try{await a1(X,{force:!0})}catch{}throw J}}async function dj($){let Q=[];for(let q of $){let V=null;try{let Y=`${q.destPath}.prev`;try{await l$(q.destPath,Y),V=Y}catch(X){if(X.code!=="ENOENT")throw X}await l$(q.tmpPath,q.destPath),Q.push({dest:q.destPath,backup:V})}catch(Y){if(V)try{await a1(q.destPath,{force:!0}),await l$(V,q.destPath)}catch{}for(let X of Q.reverse())try{if(X.backup)await a1(X.dest,{force:!0}),await l$(X.backup,X.dest);else await a1(X.dest,{force:!0})}catch{}for(let X of $)try{await a1(X.tmpPath,{force:!0})}catch{}throw Y}}for(let q of Q){if(!q.backup)continue;try{await a1(q.backup,{force:!0})}catch{}}}async function DQ($){let Q=zJ(),q=pj($,Q.assetSuffix),V=uj($),Y=V$(),X=H8();await Z8(Q1.dirname(Y),{recursive:!0}),await Z8(Q1.dirname(X),{recursive:!0});let J=[];try{if(J.push(await WJ(q.browser_download_url,Y,493)),V)J.push(await WJ(V.browser_download_url,X))}catch(G){for(let U of J)try{await a1(U.tmpPath,{force:!0})}catch{}throw G}return{binAsset:q,sidecarAsset:V,staged:J}}async function hQ($){await dj($.staged)}async function lj($){let Q=await DQ($);return await hQ(Q),{binAsset:Q.binAsset,sidecarAsset:Q.sidecarAsset}}var oj="boba",ij=process.env.PETDEX_URL??"https://petdex.crafter.run",nj=new Set(["pub-94495283df974cfea5e98d6a9e3fa462.r2.dev","yu2vz9gndp.ufs.sh"]);function i$($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return nj.has(Q.hostname)}catch{return!1}}function HJ(){return process.env.HOME??q$()}function PJ(){return Q1.join(HJ(),".petdex","pets")}function LJ(){return Q1.join(HJ(),".codex","pets")}var rj=16777216;function aj($){for(let Q of["spritesheet.webp","spritesheet.png"]){let q=Q1.join($,Q);try{let V=_j(q);if(V.isFile()&&V.size>0&&V.size<=rj)return!0}catch{}}return!1}async function sj(){let{readdir:$}=await import("node:fs/promises");for(let Q of[PJ(),LJ()]){let q;try{q=await $(Q)}catch{continue}for(let V of q)if(aj(Q1.join(Q,V)))return!0}return!1}async function tj($={}){let Q=$.fetchOverride??fetch,q=$.petdexUrl??ij,V;try{let G=await Q(`${q}/api/manifest`,{signal:AbortSignal.timeout(8000)});if(!G.ok)return null;let U=await G.json();V=Array.isArray(U?.pets)?U.pets:[]}catch{return null}if(V.length===0)return null;let Y=[],X=new Set,J=V.find((G)=>G.slug===oj);if(J)Y.push(J),X.add(J.slug);for(let G of V)if(!X.has(G.slug))Y.push(G),X.add(G.slug);for(let G of Y){let U=await ej(G,Q);if(U)return U}return null}async function ej($,Q){if(!i$($.spritesheetUrl)||!i$($.petJsonUrl))return null;let q=$.spritesheetUrl.endsWith(".png")?"png":"webp",V=[Q1.join(PJ(),$.slug),Q1.join(LJ(),$.slug)];for(let K of V)if(gQ(K))return null;let Y=async(K)=>{let W=await Q(K,{signal:AbortSignal.timeout(15000)});if(!W.ok)throw Error(`download ${K} → ${W.status}`);return W.arrayBuffer()},X,J;try{[X,J]=await Promise.all([Y($.petJsonUrl),Y($.spritesheetUrl)])}catch{return null}let G=[],U=[];try{for(let K of V){let W=`${K}.partial-${hj(6).toString("hex")}`;await Z8(W,{recursive:!0}),G.push(W),await Promise.all([z8(Q1.join(W,"pet.json"),Buffer.from(X)),z8(Q1.join(W,`spritesheet.${q}`),Buffer.from(J))]),await Z8(Q1.dirname(K),{recursive:!0}),await l$(W,K),G.pop(),U.push(K)}return $.slug}catch{return await Promise.all([...G.map((K)=>a1(K,{recursive:!0,force:!0})),...U.map((K)=>a1(K,{recursive:!0,force:!0}))]),null}}async function OJ(){T1(r.default.bgMagenta(r.default.white(" petdex install desktop ")));let $=zJ();c.info(`Platform: ${r.default.cyan(`${$.osLabel} ${$.archLabel}`)}`);let Q=H1();Q.start("Looking up the latest release");let q;try{q=await kQ()}catch(W){throw Q.stop(r.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
174
+ ${W.message}`)}Q.stop(`${r.default.green("✓")} Latest: ${r.default.bold(q.tag_name)}`);let V=H1();V.start("Downloading desktop binary and sidecar");let Y;try{Y=await lj(q)}catch(W){throw V.stop(r.default.red("failed")),W}let X=V$(),J=Q1.join(q$(),".petdex","version");await z8(J,`${q.tag_name}
175
175
  `);let G=Y.sidecarAsset?`
176
- ${r.default.dim("•")} Sidecar at ${r.default.cyan(ZJ(H8()))} (${jJ(Y.sidecarAsset.size)})`:`
177
- ${r.default.yellow("!")} No sidecar in this release. Hooks won't reach the mascot until a release ships ${zJ}.`;V.stop(`${r.default.green("✓")} Binary at ${r.default.cyan(ZJ(X))} (${jJ(Y.binAsset.size)})${G}`);let U=null;if(!await tj()){let W=z1();if(W.start("Installing a starter pet so the desktop has something to show"),U=await ej(),U)W.stop(`${r.default.green("✓")} Starter pet: ${r.default.bold(U)}`);else W.stop(`${r.default.yellow("!")} Could not download a starter pet. Run \`petdex install <slug>\` before \`petdex desktop start\`.`)}let K=["Run it with:",` ${r.default.cyan("petdex desktop start")}`,"","Or wire it into your coding agents:",` ${r.default.cyan("petdex hooks install")}`];return w1(K.join(`
178
- `),"Next"),T1(`${r.default.green("✓")} ${q.tag_name}`),{tag:q.tag_name}}function jJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}function ZJ($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}var B1=I1(c1(),1);import{execFileSync as NJ,spawn as MJ}from"node:child_process";import{existsSync as IJ,readFileSync as QZ,unlinkSync as qZ}from"node:fs";import{mkdir as VZ,writeFile as CJ}from"node:fs/promises";import{homedir as wJ}from"node:os";import Z0 from"node:path";function a$(){let $=process.env.HOME??wJ();return Z0.join($,".petdex","desktop.pid")}function r$(){let $=process.env.HOME??wJ();return Z0.join($,".petdex","desktop.log")}function AJ(){if(!IJ(a$()))return null;let $;try{$=QZ(a$(),"utf8").trim()}catch{return null}if($.startsWith("{")){try{let q=JSON.parse($);if(typeof q.pid==="number"&&Number.isFinite(q.pid)&&q.pid>0&&typeof q.lstart==="string"&&q.lstart.length>0)return{pid:q.pid,lstart:q.lstart}}catch{}return null}let Q=Number($);if(Number.isFinite(Q)&&Q>0)return{pid:Q,lstart:""};return null}function _Q($){try{let q=NJ("ps",["-p",String($),"-o","lstart="],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return q.length>0?q:null}catch{return null}}function TJ($){if($.lstart.length===0)return!1;let Q=_Q($.pid);return Q!==null&&Q===$.lstart}function n$(){try{qZ(a$())}catch{}}function s1(){let $=AJ();if($==null)return{state:"stopped"};if(TJ($))return{state:"running",pid:$.pid};return{state:"stale",pid:$.pid}}async function s$(){let $=s1();if($.state==="running")return{ok:!0,pid:$.pid,alreadyRunning:!0};if($.state==="stale")n$();let Q=J$();if(!IJ(Q))return{ok:!1,reason:`petdex-desktop binary not found at ${Q}. Run \`petdex install desktop\` first.`};await VZ(Z0.dirname(r$()),{recursive:!0});let q=await import("node:fs").then((U)=>U.openSync(r$(),"a")),V=await import("node:fs").then((U)=>U.openSync(r$(),"a")),Y=JZ(Q);if(Y)return YZ(Y);let X=MJ(Q,[],{detached:!0,stdio:["ignore",q,V]});if(X.unref(),!X.pid)return{ok:!1,reason:"Failed to spawn petdex-desktop"};let J=_Q(X.pid)??"",G={pid:X.pid,lstart:J};return await CJ(a$(),JSON.stringify(G)),{ok:!0,pid:X.pid,alreadyRunning:!1}}function JZ($){let Q=Z0.dirname($);if(Z0.basename(Q)!=="MacOS")return null;let q=Z0.dirname(Q);if(Z0.basename(q)!=="Contents")return null;let V=Z0.dirname(q);if(!V.endsWith(".app"))return null;return V}async function YZ($){MJ("open",["-gj",$],{stdio:"ignore",detached:!0}).unref();let q=Date.now()+3000,V=null;while(Date.now()<q){if(V=XZ(),V)break;await new Promise((J)=>setTimeout(J,100))}if(!V)return{ok:!1,reason:`Launched ${$} but couldn't find the resulting process. Check ${r$()}.`};let Y=_Q(V)??"",X={pid:V,lstart:Y};return await CJ(a$(),JSON.stringify(X)),{ok:!0,pid:V,alreadyRunning:!1}}function XZ(){try{let $=NJ("pgrep",["-f","petdex-desktop"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!$)return null;let Q=$.split(`
179
- `).filter((V)=>V.length>0),q=Number(Q[Q.length-1]);return Number.isFinite(q)&&q>0?q:null}catch{return null}}var FJ=7777;async function t$($={}){let Q=$.sidecarPort??FJ,q=$.portWaitTimeoutMs??5000,V=s1();if(V.state==="stopped")return{ok:!1,reason:"petdex-desktop is not running"};if(V.state==="stale")return n$(),{ok:!1,reason:`petdex-desktop is not running (stale pid ${V.pid} cleared)`};let Y=V.pid,X=AJ();if(X===null||!TJ(X))return n$(),{ok:!1,reason:`petdex-desktop exited before stop (pid ${Y} no longer alive)`};try{process.kill(Y,"SIGTERM")}catch(G){if(n$(),G.code==="ESRCH"){let K=await P8(Q,{timeoutMs:q});return{ok:!0,pid:Y,portReleased:K}}return{ok:!1,reason:`Failed to signal pid ${Y}: ${G.message}`}}n$();let J=await P8(Q,{timeoutMs:q});return{ok:!0,pid:Y,portReleased:J}}async function RJ(){let $=await s$();if(!$.ok)console.error(`${B1.default.red("✗")} ${$.reason}`),process.exit(1);if($.alreadyRunning)console.log(`${B1.default.dim("•")} petdex-desktop already running (pid ${$.pid})`);else console.log(`${B1.default.green("✓")} petdex-desktop started (pid ${$.pid})`),console.log(B1.default.dim(` log: ${r$()}`))}async function vJ(){let $=await t$();if(!$.ok)console.error(`${B1.default.dim("•")} ${$.reason}`),process.exit($.reason.includes("not running")?0:1);if($.portReleased)console.log(`${B1.default.green("✓")} stopped pid ${$.pid}`);else console.log(`${B1.default.yellow("!")} stopped pid ${$.pid}, but :${FJ} still busy`),console.log(B1.default.dim(" if 'petdex desktop start' fails with EADDRINUSE, wait a moment and retry"))}async function P8($,Q={}){let q=Q.timeoutMs??1e4,V=Q.intervalMs??100,Y=Q.host??"127.0.0.1",{createConnection:X}=await import("node:net"),J=Date.now()+q;while(Date.now()<J){if(await new Promise((U)=>{let K=X({host:Y,port:$}),W=(Z)=>{K.removeAllListeners(),K.destroy(),U(Z)};K.once("connect",()=>W(!1)),K.once("error",(Z)=>{W(Z.code==="ECONNREFUSED")}),K.setTimeout(V,()=>W(!1))}))return!0;await new Promise((U)=>setTimeout(U,V))}return!1}function xJ(){let $=s1();switch($.state){case"running":console.log(`${B1.default.green("●")} running (pid ${$.pid})`);break;case"stopped":console.log(`${B1.default.dim("○")} stopped`);break;case"stale":console.log(`${B1.default.yellow("?")} pid ${$.pid} written but not alive (run \`petdex desktop start\` to restart)`);break}}$6();var K1=I1(c1(),1);import{execSync as OZ}from"node:child_process";import{existsSync as f1,readFileSync as L8,statSync as mQ}from"node:fs";import{homedir as BZ}from"node:os";import v0 from"node:path";import{existsSync as ZZ,mkdirSync as zZ,unlinkSync as HZ,writeFileSync as PZ}from"node:fs";import{homedir as LZ}from"node:os";import fQ from"node:path";function SJ(){return process.env.HOME??LZ()}function EJ(){return fQ.join(SJ(),".petdex","runtime","hooks-disabled")}function Q6(){return fQ.join(SJ(),".petdex","runtime","update-token")}function Y$(){return ZZ(EJ())?"off":"on"}function X$($){let Q=EJ();if($==="off")zZ(fQ.dirname(Q),{recursive:!0}),PZ(Q,`# Petdex hook killswitch.
176
+ ${r.default.dim("•")} Sidecar at ${r.default.cyan(jJ(H8()))} (${UJ(Y.sidecarAsset.size)})`:`
177
+ ${r.default.yellow("!")} No sidecar in this release. Hooks won't reach the mascot until a release ships ${ZJ}.`;V.stop(`${r.default.green("✓")} Binary at ${r.default.cyan(jJ(X))} (${UJ(Y.binAsset.size)})${G}`);let U=null;if(!await sj()){let W=H1();if(W.start("Installing a starter pet so the desktop has something to show"),U=await tj(),U)W.stop(`${r.default.green("✓")} Starter pet: ${r.default.bold(U)}`);else W.stop(`${r.default.yellow("!")} Could not download a starter pet. Run \`petdex install <slug>\` before \`petdex desktop start\`.`)}let K=["Run it with:",` ${r.default.cyan("petdex desktop start")}`,"","Or wire it into your coding agents:",` ${r.default.cyan("petdex hooks install")}`];return A1(K.join(`
178
+ `),"Next"),F1(`${r.default.green("✓")} ${q.tag_name}`),{tag:q.tag_name}}function UJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}function jJ($){let Q=process.env.HOME;if(Q&&$.startsWith(Q))return`~${$.slice(Q.length)}`;return $}var N1=C1(c1(),1);import{execFileSync as BJ,spawn as NJ}from"node:child_process";import{existsSync as MJ,readFileSync as $Z,unlinkSync as QZ}from"node:fs";import{mkdir as qZ,writeFile as IJ}from"node:fs/promises";import{homedir as CJ}from"node:os";import Z0 from"node:path";function a$(){let $=process.env.HOME??CJ();return Z0.join($,".petdex","desktop.pid")}function r$(){let $=process.env.HOME??CJ();return Z0.join($,".petdex","desktop.log")}function wJ(){if(!MJ(a$()))return null;let $;try{$=$Z(a$(),"utf8").trim()}catch{return null}if($.startsWith("{")){try{let q=JSON.parse($);if(typeof q.pid==="number"&&Number.isFinite(q.pid)&&q.pid>0&&typeof q.lstart==="string"&&q.lstart.length>0)return{pid:q.pid,lstart:q.lstart}}catch{}return null}let Q=Number($);if(Number.isFinite(Q)&&Q>0)return{pid:Q,lstart:""};return null}function _Q($){try{let q=BJ("ps",["-p",String($),"-o","lstart="],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return q.length>0?q:null}catch{return null}}function AJ($){if($.lstart.length===0)return!1;let Q=_Q($.pid);return Q!==null&&Q===$.lstart}function n$(){try{QZ(a$())}catch{}}function s1(){let $=wJ();if($==null)return{state:"stopped"};if(AJ($))return{state:"running",pid:$.pid};return{state:"stale",pid:$.pid}}async function s$(){let $=s1();if($.state==="running")return{ok:!0,pid:$.pid,alreadyRunning:!0};if($.state==="stale")n$();let Q=V$();if(!MJ(Q))return{ok:!1,reason:`petdex-desktop binary not found at ${Q}. Run \`petdex install desktop\` first.`};await qZ(Z0.dirname(r$()),{recursive:!0});let q=await import("node:fs").then((U)=>U.openSync(r$(),"a")),V=await import("node:fs").then((U)=>U.openSync(r$(),"a")),Y=VZ(Q);if(Y)return JZ(Y);let X=NJ(Q,[],{detached:!0,stdio:["ignore",q,V]});if(X.unref(),!X.pid)return{ok:!1,reason:"Failed to spawn petdex-desktop"};let J=_Q(X.pid)??"",G={pid:X.pid,lstart:J};return await IJ(a$(),JSON.stringify(G)),{ok:!0,pid:X.pid,alreadyRunning:!1}}function VZ($){let Q=Z0.dirname($);if(Z0.basename(Q)!=="MacOS")return null;let q=Z0.dirname(Q);if(Z0.basename(q)!=="Contents")return null;let V=Z0.dirname(q);if(!V.endsWith(".app"))return null;return V}async function JZ($){NJ("open",["-gj",$],{stdio:"ignore",detached:!0}).unref();let q=Date.now()+3000,V=null;while(Date.now()<q){if(V=YZ(),V)break;await new Promise((J)=>setTimeout(J,100))}if(!V)return{ok:!1,reason:`Launched ${$} but couldn't find the resulting process. Check ${r$()}.`};let Y=_Q(V)??"",X={pid:V,lstart:Y};return await IJ(a$(),JSON.stringify(X)),{ok:!0,pid:V,alreadyRunning:!1}}function YZ(){try{let $=BJ("pgrep",["-f","petdex-desktop"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!$)return null;let Q=$.split(`
179
+ `).filter((V)=>V.length>0),q=Number(Q[Q.length-1]);return Number.isFinite(q)&&q>0?q:null}catch{return null}}var TJ=7777;async function t$($={}){let Q=$.sidecarPort??TJ,q=$.portWaitTimeoutMs??5000,V=s1();if(V.state==="stopped")return{ok:!1,reason:"petdex-desktop is not running"};if(V.state==="stale")return n$(),{ok:!1,reason:`petdex-desktop is not running (stale pid ${V.pid} cleared)`};let Y=V.pid,X=wJ();if(X===null||!AJ(X))return n$(),{ok:!1,reason:`petdex-desktop exited before stop (pid ${Y} no longer alive)`};try{process.kill(Y,"SIGTERM")}catch(G){if(n$(),G.code==="ESRCH"){let K=await P8(Q,{timeoutMs:q});return{ok:!0,pid:Y,portReleased:K}}return{ok:!1,reason:`Failed to signal pid ${Y}: ${G.message}`}}n$();let J=await P8(Q,{timeoutMs:q});return{ok:!0,pid:Y,portReleased:J}}async function FJ(){let $=await s$();if(!$.ok)console.error(`${N1.default.red("✗")} ${$.reason}`),process.exit(1);if($.alreadyRunning)console.log(`${N1.default.dim("•")} petdex-desktop already running (pid ${$.pid})`);else console.log(`${N1.default.green("✓")} petdex-desktop started (pid ${$.pid})`),console.log(N1.default.dim(` log: ${r$()}`))}async function RJ(){let $=await t$();if(!$.ok)console.error(`${N1.default.dim("•")} ${$.reason}`),process.exit($.reason.includes("not running")?0:1);if($.portReleased)console.log(`${N1.default.green("✓")} stopped pid ${$.pid}`);else console.log(`${N1.default.yellow("!")} stopped pid ${$.pid}, but :${TJ} still busy`),console.log(N1.default.dim(" if 'petdex desktop start' fails with EADDRINUSE, wait a moment and retry"))}async function P8($,Q={}){let q=Q.timeoutMs??1e4,V=Q.intervalMs??100,Y=Q.host??"127.0.0.1",{createConnection:X}=await import("node:net"),J=Date.now()+q;while(Date.now()<J){if(await new Promise((U)=>{let K=X({host:Y,port:$}),W=(Z)=>{K.removeAllListeners(),K.destroy(),U(Z)};K.once("connect",()=>W(!1)),K.once("error",(Z)=>{W(Z.code==="ECONNREFUSED")}),K.setTimeout(V,()=>W(!1))}))return!0;await new Promise((U)=>setTimeout(U,V))}return!1}function vJ(){let $=s1();switch($.state){case"running":console.log(`${N1.default.green("●")} running (pid ${$.pid})`);break;case"stopped":console.log(`${N1.default.dim("○")} stopped`);break;case"stale":console.log(`${N1.default.yellow("?")} pid ${$.pid} written but not alive (run \`petdex desktop start\` to restart)`);break}}$6();var K1=C1(c1(),1);import{execSync as LZ}from"node:child_process";import{existsSync as b1,readFileSync as L8,statSync as bQ}from"node:fs";import{homedir as OZ}from"node:os";import R0 from"node:path";import{existsSync as jZ,mkdirSync as ZZ,unlinkSync as zZ,writeFileSync as HZ}from"node:fs";import{homedir as PZ}from"node:os";import fQ from"node:path";function xJ(){return process.env.HOME??PZ()}function SJ(){return fQ.join(xJ(),".petdex","runtime","hooks-disabled")}function Q6(){return fQ.join(xJ(),".petdex","runtime","update-token")}function Y$(){return jZ(SJ())?"off":"on"}function X$($){let Q=SJ();if($==="off")ZZ(fQ.dirname(Q),{recursive:!0}),HZ(Q,`# Petdex hook killswitch.
180
180
  # Hooks are DISABLED while this file exists.
181
181
  # Re-enable: petdex hooks on (or /petdex from inside your agent).
182
- `,{mode:384});else try{HZ(Q)}catch{}return $}function yJ(){return X$(Y$()==="on"?"off":"on")}function q6(){return process.env.HOME??BZ()}function NZ(){return v0.join(q6(),".petdex","runtime","update-token")}function MZ(){return v0.join(q6(),".petdex","desktop.pid")}function IZ(){let $=J$();if(!f1($))return{status:"fail",label:"Desktop binary",detail:`not found at ${$}`,hint:"Run `petdex install desktop` to download it."};try{if(!(mQ($).mode&73))return{status:"fail",label:"Desktop binary",detail:`${$} exists but is not executable`,hint:`chmod +x ${$}`}}catch{return{status:"fail",label:"Desktop binary",detail:`${$} unreadable`,hint:"Reinstall: `petdex install desktop`"}}return{status:"ok",label:"Desktop binary",detail:$}}function CZ(){let $=H8();if(!f1($))return{status:"fail",label:"Sidecar bundle",detail:`not found at ${$}`,hint:"Reinstall: `petdex install desktop`"};return{status:"ok",label:"Sidecar bundle",detail:$}}async function wZ(){try{let $=await fetch("http://127.0.0.1:7777/health",{signal:AbortSignal.timeout(500)});if(!$.ok)return{status:"warn",label:"Sidecar reachable",detail:`:7777 responded ${$.status}`,hint:"Restart: `petdex desktop stop && petdex desktop start`"};let Q=await $.json().catch(()=>null);if(Q?.ok&&Q?.port===7777)return{status:"ok",label:"Sidecar reachable",detail:":7777 healthy"};return{status:"warn",label:"Sidecar reachable",detail:":7777 responded but body shape was unexpected"}}catch{return{status:"info",label:"Sidecar reachable",detail:"not running (this is fine if you haven't started the desktop)",hint:"Start with `petdex desktop start`"}}}function AZ(){let $=MZ();if(!f1($))return{status:"info",label:"PID file",detail:"not present (desktop not running)"};let Q;try{Q=L8($,"utf8").trim()}catch{return{status:"warn",label:"PID file",detail:`unreadable at ${$}`,hint:`Delete it: rm ${$}`}}if(!Q.startsWith("{"))return{status:"warn",label:"PID file",detail:"legacy bare-pid format detected",hint:"Run `petdex desktop start` to rewrite it in the new format."};try{let q=JSON.parse(Q);if(typeof q.pid!=="number"||typeof q.lstart!=="string")return{status:"warn",label:"PID file",detail:"unexpected JSON shape",hint:`Delete it: rm ${$}`};return{status:"ok",label:"PID file",detail:`pid ${q.pid}, started ${q.lstart}`}}catch{return{status:"warn",label:"PID file",detail:"JSON parse failed",hint:`Delete it: rm ${$}`}}}function TZ(){let $=NZ();if(!f1($))return{status:"info",label:"Update token",detail:"absent (will be created when sidecar starts)"};try{if(L8($,"utf8").trim().length<16)return{status:"warn",label:"Update token",detail:"present but suspiciously short",hint:"Stop the desktop and run `petdex desktop start` to regenerate."};let V=mQ($).mode&511;if(V!==384)return{status:"warn",label:"Update token",detail:`present, mode ${V.toString(8)} (expected 600)`,hint:`chmod 600 ${$}`};return{status:"ok",label:"Update token",detail:"present, mode 600"}}catch(Q){return{status:"warn",label:"Update token",detail:`read failed: ${Q.message}`}}}function FZ(){if(Y$()==="off")return{status:"warn",label:"Killswitch",detail:"DISABLED — agent hooks are short-circuited",hint:"Re-enable with `petdex hooks on` or `/petdex on` from inside your agent."};return{status:"ok",label:"Killswitch",detail:"hooks enabled"}}function RZ(){let $=[];for(let Q of t1){let q=f1(Q.configFile),V=f1(Q.slashCommandPath);if(!f1(Q.configDir)){$.push({status:"info",label:Q.displayName,detail:"not installed on this machine"});continue}let Y=!1;if(q)try{let X=L8(Q.configFile,"utf8");Y=X.includes("127.0.0.1:7777/state")||X.includes("/state")}catch{Y=!1}if(!Y){$.push({status:"warn",label:Q.displayName,detail:"petdex hook NOT detected",hint:"Run `petdex hooks install`"});continue}if(!V){$.push({status:"warn",label:Q.displayName,detail:"hook installed, but /petdex slash command missing",hint:"Re-run `petdex hooks install` to add the slash command."});continue}$.push({status:"ok",label:Q.displayName,detail:"hooks + /petdex installed"})}return $}function vZ(){let $=v0.join(q6(),".codex","config.toml");if(!f1($))return{status:"info",label:"Codex codex_hooks flag",detail:"config.toml absent (Codex not installed?)"};try{let Q=L8($,"utf8");if(/\[features\][\s\S]*?codex_hooks\s*=\s*true/.test(Q))return{status:"ok",label:"Codex codex_hooks flag",detail:"[features] codex_hooks = true"};return{status:"warn",label:"Codex codex_hooks flag",detail:"missing or set to non-true",hint:"Re-run `petdex hooks install` and accept the auto-fix prompt."}}catch{return{status:"warn",label:"Codex codex_hooks flag",detail:"config.toml unreadable"}}}function xZ(){let $=[v0.join(q6(),".petdex","pets"),v0.join(q6(),".codex","pets")],Q=0;for(let q of $){if(!f1(q))continue;try{let{readdirSync:V}=l("node:fs"),Y=V(q);for(let X of Y){let J=v0.join(q,X);for(let G of["spritesheet.webp","spritesheet.png"]){let U=v0.join(J,G);if(!f1(U))continue;try{let K=mQ(U);if(K.size>0&&K.size<=16777216){Q+=1;break}}catch{}}}}catch{}}if(Q===0)return{status:"fail",label:"Installed pets",detail:"no usable pets in ~/.petdex/pets or ~/.codex/pets",hint:"Install one with `petdex install <slug>`"};return{status:"ok",label:"Installed pets",detail:`${Q} usable spritesheet(s) on disk`}}function SZ($){switch($){case"ok":return K1.default.green("✓");case"warn":return K1.default.yellow("!");case"fail":return K1.default.red("✗");case"info":return K1.default.dim("○")}}function N1($){let Q=$.detail?` ${K1.default.dim($.detail)}`:"";if(console.log(` ${SZ($.status)} ${K1.default.bold($.label)}${Q}`),$.hint)console.log(` ${K1.default.cyan("→")} ${$.hint}`)}async function gJ(){console.log(K1.default.bgMagenta(K1.default.white(" petdex doctor "))),console.log(""),console.log(K1.default.bold("Install")),N1(IZ()),N1(CZ()),N1(xZ()),console.log(""),console.log(K1.default.bold("Runtime")),N1(await wZ()),N1(AZ()),N1(TZ()),N1(FZ()),console.log(""),console.log(K1.default.bold("Agents"));for(let Q of RZ())N1(Q);N1(vZ()),console.log(""),console.log(K1.default.bold("Network"));let $=null;try{$=OZ("lsof -nP -i:7777 2>/dev/null || true",{encoding:"utf8"}).trim()}catch{$=null}if($===null)N1({status:"info",label:":7777 listener",detail:"lsof unavailable"});else if($.length===0)N1({status:"info",label:":7777 listener",detail:"nothing bound (sidecar offline)"});else{let Q=$.split(`
183
- `).length-1;N1({status:Q===1?"ok":"warn",label:":7777 listener",detail:Q===1?"1 process bound":`${Q} processes bound`,hint:Q>1?"Multiple sidecars contending for the same port. Stop both and start fresh.":void 0})}console.log("")}E0();var d=I1(c1(),1);import{existsSync as rZ,readFileSync as uJ}from"node:fs";import{writeFile as aZ}from"node:fs/promises";import{homedir as dJ}from"node:os";import lJ from"node:path";var O8=7777,sZ="x-petdex-update-token",tZ=lJ.join(dJ(),".petdex","runtime","update-token"),sQ=lJ.join(dJ(),".petdex","version");async function eZ($={}){let Q=$.port??O8,q=$.timeoutMs??2000,V=$.tokenPath??tZ,Y;try{Y=uJ(V,"utf8").trim()}catch{return!1}if(!Y)return!1;let X=new AbortController,J=setTimeout(()=>X.abort(),q);try{return(await fetch(`http://127.0.0.1:${Q}/update/handoff`,{method:"POST",headers:{[sZ]:Y},signal:X.signal})).ok}catch{return!1}finally{clearTimeout(J)}}function $z(){if(!rZ(sQ))return null;try{return uJ(sQ,"utf8").trim()||null}catch{return null}}async function oJ($=[]){let Q=$.includes("--force"),q=$.includes("--silent"),V=(P)=>{if(q)console.log(`[petdex update] ${P}`);else A1(d.default.bgMagenta(d.default.white(` ${P} `)))},Y=(P)=>{if(q)console.log(P);else c.info(P)},X=(P)=>{if(q)console.warn(P);else c.warn(P)},J=(P)=>{if(q)console.log(P);else T1(P)},G=()=>{if(q)return{start:(I)=>console.log(I),stop:(I)=>console.log(I)};let P=z1();return{start:(I)=>P.start(I),stop:(I)=>P.stop(I)}};V("petdex update");let U=$z();Y(U?`Installed: ${q?U:d.default.cyan(U)}`:"No installed version recorded - treating as fresh install.");let K=G();K.start("Checking GitHub for the latest release");let W;try{W=await kQ()}catch(P){throw K.stop(q?"failed":d.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
184
- ${P.message}`)}if(K.stop(q?`Latest: ${W.tag_name}`:`${d.default.green("✓")} Latest: ${d.default.bold(W.tag_name)}`),!Q&&U&&U===W.tag_name){J(q?"Already up to date.":`${d.default.green("✓")} Already up to date.`);return}let Z=G();Z.start(`Downloading ${W.tag_name}`);let z;try{z=await DQ(W)}catch(P){throw Z.stop(q?"failed":d.default.red("failed")),P}Z.stop(q?`Downloaded ${W.tag_name} (${pJ(z.binAsset.size)})`:`${d.default.green("✓")} Downloaded ${d.default.bold(W.tag_name)} (${pJ(z.binAsset.size)})`);let H=s1().state==="running";if(H)Y(q?"Stopping running petdex-desktop":`${d.default.dim("•")} Stopping running petdex-desktop`),await t$();if(await hQ(z),await aZ(sQ,`${W.tag_name}
185
- `),H){Y(q?"Asking sidecar to release port":`${d.default.dim("•")} Asking sidecar to release port`);let P=await eZ();if(Y(q?P?"Sidecar acknowledged handoff":"Sidecar handoff unavailable, falling back to port wait":P?`${d.default.dim("•")} Sidecar acknowledged handoff`:`${d.default.dim("•")} Sidecar handoff unavailable, falling back to port wait`),!await P8(O8,{timeoutMs:1e4})){X(q?`Port ${O8} still in use after 10s. Run 'petdex desktop stop && petdex desktop start' to recover.`:`${d.default.yellow("!")} Port ${O8} still in use after 10s. Run \`petdex desktop stop && petdex desktop start\` to recover.`);return}Y(q?"Restarting petdex-desktop":`${d.default.dim("•")} Restarting petdex-desktop`);let M=await s$();if(M.ok)Y(q?`Restarted (pid ${M.pid})`:`${d.default.green("✓")} Restarted (pid ${M.pid})`);else X(q?`Could not restart: ${M.reason}. Run 'petdex desktop start' manually.`:`${d.default.yellow("!")} Could not restart: ${M.reason}. Run \`petdex desktop start\` manually.`)}try{let{runRefresh:P}=await Promise.resolve().then(() => (aQ(),rQ)),I=await P();if(I.refreshed.length>0)Y(q?`Refreshed hooks for: ${I.refreshed.join(", ")}`:`Refreshed hooks for ${d.default.cyan(I.refreshed.join(", "))}`)}catch(P){X(`Hook refresh failed: ${P.message}`)}let C=U?`${U} → ${W.tag_name}`:W.tag_name;J(q?C:`${d.default.green("✓")} ${C}`)}function pJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}nQ();E0();$6();var t=I1(c1(),1);import{existsSync as J6}from"node:fs";import{readFile as nJ,rm as rJ,writeFile as aJ}from"node:fs/promises";import Qz from"node:path";cQ();async function sJ($={}){A1(t.default.bgMagenta(t.default.white(" petdex hooks uninstall ")));let q=(await qz()).filter((X)=>X.installed);if(q.length===0)return T1(t.default.dim("No agent configs found — nothing to uninstall.")),{uninstalledAgents:[]};let V=[],Y=[];for(let{agent:X}of q)try{let J=await Vz(X);if(J.removed){Y.push(X.id);let G=J.backupPath?` ${t.default.dim(`(backup: ${Qz.basename(J.backupPath)})`)}`:"";V.push(` ${t.default.green("✓")} ${t.default.bold(X.displayName)}${G}`)}else V.push(` ${t.default.dim("•")} ${t.default.bold(X.displayName)} ${t.default.dim("(no petdex entries found)")}`);await DJ(X)}catch(J){V.push(` ${t.default.red("✗")} ${t.default.bold(X.displayName)} ${t.default.red(J instanceof Error?J.message:String(J))}`)}if(w1(V.join(`
186
- `),"Done"),$.removeToken)try{await rJ(Q6(),{force:!0}),c.info(`${t.default.green("✓")} Removed ${Q6()}`)}catch{}else if(J6(Q6()))c.info(t.default.dim(`Token file at ${Q6()} kept. Pass --remove-token to delete it.`));return T1(`${t.default.green("✓")} Done. Run ${t.default.cyan("petdex hooks install")} to wire petdex back in.`),{uninstalledAgents:Y}}async function qz(){return Promise.all(t1.map(async($)=>({agent:$,installed:J6($.configDir)})))}async function Vz($){if($.id==="opencode"){if(!J6($.configFile))return{removed:!1,backupPath:null};let X=await iJ($.configFile);return await rJ($.configFile,{force:!0}),{removed:!0,backupPath:X}}if(!J6($.configFile))return{removed:!1,backupPath:null};let Q;try{Q=await nJ($.configFile,"utf8")}catch(X){throw Error(`Could not read ${$.configFile}: ${X.message}`)}let q;try{q=JSON.parse(Q)}catch(X){throw Error(`Refusing to overwrite ${$.configFile}: invalid JSON (${X.message}). Hand-edit the file to remove petdex entries.`)}let V=Jz(q);if(!V.changed)return{removed:!1,backupPath:null};let Y=await iJ($.configFile);return await aJ($.configFile,`${JSON.stringify(V.value,null,2)}
187
- `,"utf8"),{removed:!0,backupPath:Y}}function Jz($){let Q={...$},q=Q.hooks;if(!q||typeof q!=="object"||Array.isArray(q))return{value:Q,changed:!1};let V=!1,Y={};for(let[X,J]of Object.entries(q)){if(!Array.isArray(J)){Y[X]=J;continue}let G=J.filter((U)=>!Yz(U));if(G.length!==J.length)V=!0;if(G.length>0)Y[X]=G}if(!V)return{value:Q,changed:!1};if(Object.keys(Y).length===0){let{hooks:X,...J}=Q;return{value:J,changed:!0}}return Q.hooks=Y,{value:Q,changed:!0}}function Yz($){if(typeof $!=="object"||$==null)return!1;return Xz($).some((q)=>q.includes(`localhost:${e$}/state`)||q.includes(R0))}function Xz($){let Q=[];function q(V){if(typeof V==="string"){Q.push(V);return}if(Array.isArray(V)){for(let Y of V)q(Y);return}if(typeof V==="object"&&V!=null)for(let Y of Object.values(V))q(Y)}return q($),Q}async function iJ($){if(!J6($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),q=`${$}.${Q}.bak`,V=await nJ($);return await aJ(q,V),q}import{spawn as Gz}from"node:child_process";import{randomUUID as tJ}from"node:crypto";import{existsSync as Kz,mkdirSync as Wz,readFileSync as Uz,writeFileSync as jz}from"node:fs";import{homedir as Zz}from"node:os";import eJ from"node:path";function B8(){let $=process.env.HOME??Zz();return eJ.join($,".petdex","telemetry.json")}var zz=process.env.PETDEX_TELEMETRY_URL??"https://petdex.crafter.run/api/telemetry/event",Hz=2000;function N8(){if(!Kz(B8()))return{kind:"missing"};let $;try{$=Uz(B8(),"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 tQ($){try{return Wz(eJ.dirname(B8()),{recursive:!0}),jz(B8(),`${JSON.stringify($,null,2)}
188
- `),!0}catch{return!1}}function $Y(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=N8();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:tJ(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return tQ(Q)?Q:null}function QY(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=N8();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function qY($){let Q=N8(),q;if(Q.kind==="ok")q=Q.config,q.enabled=$;else q={install_id:tJ(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return tQ(q)}function VY(){let $=N8();return{enabled:QY(),install_id:$.kind==="ok"?$.config.install_id:null}}function JY(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=$Y();if(!$)return;if($.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.crafter.run/legal/telemetry",""].join(`
189
- `)),$.notice_seen=!0,tQ($)}function Y6($,Q={}){if(!QY())return;let q=$Y();if(!q)return;let V=JSON.stringify({install_id:q.install_id,event:$,...Q});try{let Y=`
182
+ `,{mode:384});else try{zZ(Q)}catch{}return $}function EJ(){return X$(Y$()==="on"?"off":"on")}function q6(){return process.env.HOME??OZ()}function BZ(){return R0.join(q6(),".petdex","runtime","update-token")}function NZ(){return R0.join(q6(),".petdex","desktop.pid")}function MZ(){let $=V$();if(!b1($))return{status:"fail",label:"Desktop binary",detail:`not found at ${$}`,hint:"Run `petdex install desktop` to download it."};try{if(!(bQ($).mode&73))return{status:"fail",label:"Desktop binary",detail:`${$} exists but is not executable`,hint:`chmod +x ${$}`}}catch{return{status:"fail",label:"Desktop binary",detail:`${$} unreadable`,hint:"Reinstall: `petdex install desktop`"}}return{status:"ok",label:"Desktop binary",detail:$}}function IZ(){let $=H8();if(!b1($))return{status:"fail",label:"Sidecar bundle",detail:`not found at ${$}`,hint:"Reinstall: `petdex install desktop`"};return{status:"ok",label:"Sidecar bundle",detail:$}}async function CZ(){try{let $=await fetch("http://127.0.0.1:7777/health",{signal:AbortSignal.timeout(500)});if(!$.ok)return{status:"warn",label:"Sidecar reachable",detail:`:7777 responded ${$.status}`,hint:"Restart: `petdex desktop stop && petdex desktop start`"};let Q=await $.json().catch(()=>null);if(Q?.ok&&Q?.port===7777)return{status:"ok",label:"Sidecar reachable",detail:":7777 healthy"};return{status:"warn",label:"Sidecar reachable",detail:":7777 responded but body shape was unexpected"}}catch{return{status:"info",label:"Sidecar reachable",detail:"not running (this is fine if you haven't started the desktop)",hint:"Start with `petdex desktop start`"}}}function wZ(){let $=NZ();if(!b1($))return{status:"info",label:"PID file",detail:"not present (desktop not running)"};let Q;try{Q=L8($,"utf8").trim()}catch{return{status:"warn",label:"PID file",detail:`unreadable at ${$}`,hint:`Delete it: rm ${$}`}}if(!Q.startsWith("{"))return{status:"warn",label:"PID file",detail:"legacy bare-pid format detected",hint:"Run `petdex desktop start` to rewrite it in the new format."};try{let q=JSON.parse(Q);if(typeof q.pid!=="number"||typeof q.lstart!=="string")return{status:"warn",label:"PID file",detail:"unexpected JSON shape",hint:`Delete it: rm ${$}`};return{status:"ok",label:"PID file",detail:`pid ${q.pid}, started ${q.lstart}`}}catch{return{status:"warn",label:"PID file",detail:"JSON parse failed",hint:`Delete it: rm ${$}`}}}function AZ(){let $=BZ();if(!b1($))return{status:"info",label:"Update token",detail:"absent (will be created when sidecar starts)"};try{if(L8($,"utf8").trim().length<16)return{status:"warn",label:"Update token",detail:"present but suspiciously short",hint:"Stop the desktop and run `petdex desktop start` to regenerate."};let V=bQ($).mode&511;if(V!==384)return{status:"warn",label:"Update token",detail:`present, mode ${V.toString(8)} (expected 600)`,hint:`chmod 600 ${$}`};return{status:"ok",label:"Update token",detail:"present, mode 600"}}catch(Q){return{status:"warn",label:"Update token",detail:`read failed: ${Q.message}`}}}function TZ(){if(Y$()==="off")return{status:"warn",label:"Killswitch",detail:"DISABLED. Agent hooks are short-circuited.",hint:"Re-enable with `petdex hooks on` or `/petdex on` from inside your agent."};return{status:"ok",label:"Killswitch",detail:"hooks enabled"}}function FZ(){let $=[];for(let Q of t1){let q=b1(Q.configFile),V=b1(Q.slashCommandPath);if(!b1(Q.configDir)){$.push({status:"info",label:Q.displayName,detail:"not installed on this machine"});continue}let Y=!1;if(q)try{let X=L8(Q.configFile,"utf8");Y=X.includes("127.0.0.1:7777/state")||X.includes("/state")}catch{Y=!1}if(!Y){$.push({status:"warn",label:Q.displayName,detail:"petdex hook NOT detected",hint:"Run `petdex hooks install`"});continue}if(!V){$.push({status:"warn",label:Q.displayName,detail:"hook installed, but /petdex slash command missing",hint:"Re-run `petdex hooks install` to add the slash command."});continue}$.push({status:"ok",label:Q.displayName,detail:"hooks + /petdex installed"})}return $}function RZ(){let $=R0.join(q6(),".codex","config.toml");if(!b1($))return{status:"info",label:"Codex codex_hooks flag",detail:"config.toml absent (Codex not installed?)"};try{let Q=L8($,"utf8");if(/\[features\][\s\S]*?codex_hooks\s*=\s*true/.test(Q))return{status:"ok",label:"Codex codex_hooks flag",detail:"[features] codex_hooks = true"};return{status:"warn",label:"Codex codex_hooks flag",detail:"missing or set to non-true",hint:"Re-run `petdex hooks install` and accept the auto-fix prompt."}}catch{return{status:"warn",label:"Codex codex_hooks flag",detail:"config.toml unreadable"}}}function vZ(){let $=[R0.join(q6(),".petdex","pets"),R0.join(q6(),".codex","pets")],Q=0;for(let q of $){if(!b1(q))continue;try{let{readdirSync:V}=l("node:fs"),Y=V(q);for(let X of Y){let J=R0.join(q,X);for(let G of["spritesheet.webp","spritesheet.png"]){let U=R0.join(J,G);if(!b1(U))continue;try{let K=bQ(U);if(K.size>0&&K.size<=16777216){Q+=1;break}}catch{}}}}catch{}}if(Q===0)return{status:"fail",label:"Installed pets",detail:"no usable pets in ~/.petdex/pets or ~/.codex/pets",hint:"Install one with `petdex install <slug>`"};return{status:"ok",label:"Installed pets",detail:`${Q} usable spritesheet(s) on disk`}}function xZ($){switch($){case"ok":return K1.default.green("✓");case"warn":return K1.default.yellow("!");case"fail":return K1.default.red("✗");case"info":return K1.default.dim("○")}}function M1($){let Q=$.detail?` ${K1.default.dim($.detail)}`:"";if(console.log(` ${xZ($.status)} ${K1.default.bold($.label)}${Q}`),$.hint)console.log(` ${K1.default.cyan("→")} ${$.hint}`)}async function yJ(){console.log(K1.default.bgMagenta(K1.default.white(" petdex doctor "))),console.log(""),console.log(K1.default.bold("Install")),M1(MZ()),M1(IZ()),M1(vZ()),console.log(""),console.log(K1.default.bold("Runtime")),M1(await CZ()),M1(wZ()),M1(AZ()),M1(TZ()),console.log(""),console.log(K1.default.bold("Agents"));for(let Q of FZ())M1(Q);M1(RZ()),console.log(""),console.log(K1.default.bold("Network"));let $=null;try{$=LZ("lsof -nP -i:7777 2>/dev/null || true",{encoding:"utf8"}).trim()}catch{$=null}if($===null)M1({status:"info",label:":7777 listener",detail:"lsof unavailable"});else if($.length===0)M1({status:"info",label:":7777 listener",detail:"nothing bound (sidecar offline)"});else{let Q=$.split(`
183
+ `).length-1;M1({status:Q===1?"ok":"warn",label:":7777 listener",detail:Q===1?"1 process bound":`${Q} processes bound`,hint:Q>1?"Multiple sidecars contending for the same port. Stop both and start fresh.":void 0})}console.log("")}S0();var d=C1(c1(),1);import{existsSync as nZ,readFileSync as pJ}from"node:fs";import{writeFile as rZ}from"node:fs/promises";import{homedir as uJ}from"node:os";import dJ from"node:path";var O8=7777,aZ="x-petdex-update-token",sZ=dJ.join(uJ(),".petdex","runtime","update-token"),aQ=dJ.join(uJ(),".petdex","version");async function tZ($={}){let Q=$.port??O8,q=$.timeoutMs??2000,V=$.tokenPath??sZ,Y;try{Y=pJ(V,"utf8").trim()}catch{return!1}if(!Y)return!1;let X=new AbortController,J=setTimeout(()=>X.abort(),q);try{return(await fetch(`http://127.0.0.1:${Q}/update/handoff`,{method:"POST",headers:{[aZ]:Y},signal:X.signal})).ok}catch{return!1}finally{clearTimeout(J)}}function eZ(){if(!nZ(aQ))return null;try{return pJ(aQ,"utf8").trim()||null}catch{return null}}async function lJ($=[]){let Q=$.includes("--force"),q=$.includes("--silent"),V=(P)=>{if(q)console.log(`[petdex update] ${P}`);else T1(d.default.bgMagenta(d.default.white(` ${P} `)))},Y=(P)=>{if(q)console.log(P);else c.info(P)},X=(P)=>{if(q)console.warn(P);else c.warn(P)},J=(P)=>{if(q)console.log(P);else F1(P)},G=()=>{if(q)return{start:(I)=>console.log(I),stop:(I)=>console.log(I)};let P=H1();return{start:(I)=>P.start(I),stop:(I)=>P.stop(I)}};V("petdex update");let U=eZ();Y(U?`Installed: ${q?U:d.default.cyan(U)}`:"No installed version recorded - treating as fresh install.");let K=G();K.start("Checking GitHub for the latest release");let W;try{W=await kQ()}catch(P){throw K.stop(q?"failed":d.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
184
+ ${P.message}`)}if(K.stop(q?`Latest: ${W.tag_name}`:`${d.default.green("✓")} Latest: ${d.default.bold(W.tag_name)}`),!Q&&U&&U===W.tag_name){J(q?"Already up to date.":`${d.default.green("✓")} Already up to date.`);return}let Z=G();Z.start(`Downloading ${W.tag_name}`);let z;try{z=await DQ(W)}catch(P){throw Z.stop(q?"failed":d.default.red("failed")),P}Z.stop(q?`Downloaded ${W.tag_name} (${cJ(z.binAsset.size)})`:`${d.default.green("✓")} Downloaded ${d.default.bold(W.tag_name)} (${cJ(z.binAsset.size)})`);let H=s1().state==="running";if(H)Y(q?"Stopping running petdex-desktop":`${d.default.dim("•")} Stopping running petdex-desktop`),await t$();if(await hQ(z),await rZ(aQ,`${W.tag_name}
185
+ `),H){Y(q?"Asking sidecar to release port":`${d.default.dim("•")} Asking sidecar to release port`);let P=await tZ();if(Y(q?P?"Sidecar acknowledged handoff":"Sidecar handoff unavailable, falling back to port wait":P?`${d.default.dim("•")} Sidecar acknowledged handoff`:`${d.default.dim("•")} Sidecar handoff unavailable, falling back to port wait`),!await P8(O8,{timeoutMs:1e4})){X(q?`Port ${O8} still in use after 10s. Run 'petdex desktop stop && petdex desktop start' to recover.`:`${d.default.yellow("!")} Port ${O8} still in use after 10s. Run \`petdex desktop stop && petdex desktop start\` to recover.`);return}Y(q?"Restarting petdex-desktop":`${d.default.dim("•")} Restarting petdex-desktop`);let M=await s$();if(M.ok)Y(q?`Restarted (pid ${M.pid})`:`${d.default.green("✓")} Restarted (pid ${M.pid})`);else X(q?`Could not restart: ${M.reason}. Run 'petdex desktop start' manually.`:`${d.default.yellow("!")} Could not restart: ${M.reason}. Run \`petdex desktop start\` manually.`)}try{let{runRefresh:P}=await Promise.resolve().then(() => (rQ(),nQ)),I=await P();if(I.refreshed.length>0)Y(q?`Refreshed hooks for: ${I.refreshed.join(", ")}`:`Refreshed hooks for ${d.default.cyan(I.refreshed.join(", "))}`)}catch(P){X(`Hook refresh failed: ${P.message}`)}let C=U?`${U} → ${W.tag_name}`:W.tag_name;J(q?C:`${d.default.green("✓")} ${C}`)}function cJ($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1024/1024).toFixed(1)} MB`}iQ();S0();$6();var t=C1(c1(),1);import{existsSync as J6}from"node:fs";import{readFile as iJ,rm as nJ,writeFile as rJ}from"node:fs/promises";import $z from"node:path";mQ();async function aJ($={}){T1(t.default.bgMagenta(t.default.white(" petdex hooks uninstall ")));let q=(await Qz()).filter((X)=>X.installed);if(q.length===0)return F1(t.default.dim("No agent configs found. Nothing to uninstall.")),{uninstalledAgents:[]};let V=[],Y=[];for(let{agent:X}of q)try{let J=await qz(X);if(J.removed){Y.push(X.id);let G=J.backupPath?` ${t.default.dim(`(backup: ${$z.basename(J.backupPath)})`)}`:"";V.push(` ${t.default.green("✓")} ${t.default.bold(X.displayName)}${G}`)}else V.push(` ${t.default.dim("•")} ${t.default.bold(X.displayName)} ${t.default.dim("(no petdex entries found)")}`);await kJ(X)}catch(J){V.push(` ${t.default.red("✗")} ${t.default.bold(X.displayName)} ${t.default.red(J instanceof Error?J.message:String(J))}`)}if(A1(V.join(`
186
+ `),"Done"),$.removeToken)try{await nJ(Q6(),{force:!0}),c.info(`${t.default.green("✓")} Removed ${Q6()}`)}catch{}else if(J6(Q6()))c.info(t.default.dim(`Token file at ${Q6()} kept. Pass --remove-token to delete it.`));return F1(`${t.default.green("✓")} Done. Run ${t.default.cyan("petdex hooks install")} to wire petdex back in.`),{uninstalledAgents:Y}}async function Qz(){return Promise.all(t1.map(async($)=>({agent:$,installed:J6($.configDir)})))}async function qz($){if($.id==="opencode"){if(!J6($.configFile))return{removed:!1,backupPath:null};let X=await oJ($.configFile);return await nJ($.configFile,{force:!0}),{removed:!0,backupPath:X}}if(!J6($.configFile))return{removed:!1,backupPath:null};let Q;try{Q=await iJ($.configFile,"utf8")}catch(X){throw Error(`Could not read ${$.configFile}: ${X.message}`)}let q;try{q=JSON.parse(Q)}catch(X){throw Error(`Refusing to overwrite ${$.configFile}: invalid JSON (${X.message}). Hand-edit the file to remove petdex entries.`)}let V=Vz(q);if(!V.changed)return{removed:!1,backupPath:null};let Y=await oJ($.configFile);return await rJ($.configFile,`${JSON.stringify(V.value,null,2)}
187
+ `,"utf8"),{removed:!0,backupPath:Y}}function Vz($){let Q={...$},q=Q.hooks;if(!q||typeof q!=="object"||Array.isArray(q))return{value:Q,changed:!1};let V=!1,Y={};for(let[X,J]of Object.entries(q)){if(!Array.isArray(J)){Y[X]=J;continue}let G=J.filter((U)=>!Jz(U));if(G.length!==J.length)V=!0;if(G.length>0)Y[X]=G}if(!V)return{value:Q,changed:!1};if(Object.keys(Y).length===0){let{hooks:X,...J}=Q;return{value:J,changed:!0}}return Q.hooks=Y,{value:Q,changed:!0}}function Jz($){if(typeof $!=="object"||$==null)return!1;return Yz($).some((q)=>q.includes(`localhost:${e$}/state`)||q.includes(J$))}function Yz($){let Q=[];function q(V){if(typeof V==="string"){Q.push(V);return}if(Array.isArray(V)){for(let Y of V)q(Y);return}if(typeof V==="object"&&V!=null)for(let Y of Object.values(V))q(Y)}return q($),Q}async function oJ($){if(!J6($))return null;let Q=new Date().toISOString().replace(/[:.]/g,"-"),q=`${$}.${Q}.bak`,V=await iJ($);return await rJ(q,V),q}import{spawn as Xz}from"node:child_process";import{randomUUID as sJ}from"node:crypto";import{existsSync as Gz,mkdirSync as Kz,readFileSync as Wz,writeFileSync as Uz}from"node:fs";import{homedir as jz}from"node:os";import tJ from"node:path";function B8(){let $=process.env.HOME??jz();return tJ.join($,".petdex","telemetry.json")}var Zz=process.env.PETDEX_TELEMETRY_URL??"https://petdex.crafter.run/api/telemetry/event",zz=2000;function N8(){if(!Gz(B8()))return{kind:"missing"};let $;try{$=Wz(B8(),"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 sQ($){try{return Kz(tJ.dirname(B8()),{recursive:!0}),Uz(B8(),`${JSON.stringify($,null,2)}
188
+ `),!0}catch{return!1}}function eJ(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=N8();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:sJ(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return sQ(Q)?Q:null}function $Y(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=N8();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function QY($){let Q=N8(),q;if(Q.kind==="ok")q=Q.config,q.enabled=$;else q={install_id:sJ(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return sQ(q)}function qY(){let $=N8();return{enabled:$Y(),install_id:$.kind==="ok"?$.config.install_id:null}}function VY(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=eJ();if(!$)return;if($.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.crafter.run/legal/telemetry",""].join(`
189
+ `)),$.notice_seen=!0,sQ($)}function Y6($,Q={}){if(!$Y())return;let q=eJ();if(!q)return;let V=JSON.stringify({install_id:q.install_id,event:$,...Q});try{let Y=`
190
190
  const controller = new AbortController();
191
- const t = setTimeout(() => controller.abort(), ${Hz});
192
- fetch(${JSON.stringify(zz)}, {
191
+ const t = setTimeout(() => controller.abort(), ${zz});
192
+ fetch(${JSON.stringify(Zz)}, {
193
193
  method: "POST",
194
194
  headers: { "content-type": "application/json" },
195
195
  body: ${JSON.stringify(V)},
196
196
  signal: controller.signal,
197
197
  }).catch(() => {}).finally(() => clearTimeout(t));
198
- `;Gz(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var M1=process.env.PETDEX_URL??"https://petdex.crafter.run",vz="https://clerk.petdex.crafter.run",xz="LcThwEayl6KAA1Qm",$q=["profile","email","openid","offline_access"];async function Sz(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:$q};try{let q=await fetch(`${M1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(q.ok){let V=await q.json(),Y=typeof V.issuer==="string"?V.issuer:null,X=typeof V.clientId==="string"?V.clientId:null,J=Array.isArray(V.scopes)?V.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:$q}}}catch{}return{issuer:$??vz,clientId:Q??xz,scopes:$q}}var I8=null;async function A8(){if(I8)return I8;let $=await Sz();return I8=new j8({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),I8}var K$="0.3.5";Ez().catch(($)=>{J1(`petdex: ${$.message}`),process.exit(1)});async function Ez(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:V}=await Promise.resolve().then(() => (PY(),HY));await V($.slice(1));return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){BY();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))JY();switch(Q){case"login":await yz();break;case"logout":await gz();break;case"whoami":await kz();break;case"submit":await _z($.slice(1));break;case"install":await Dz($.slice(1));break;case"list":await hz();break;case"hooks":await nz($.slice(1));break;case"desktop":await tz($.slice(1));break;case"init":await az();break;case"up":await FY();break;case"down":await RY();break;case"toggle":await sz();break;case"update":await oJ($.slice(1));break;case"doctor":await gJ();break;case"telemetry":ez($.slice(1));break;case"version":case"--version":case"-v":console.log(K$);break;default:console.error(j.default.red(`Unknown command: ${Q}`)),BY(),process.exit(1)}}function BY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex"))} ${Q(K$)} ${Q("— Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${j.default.bold("init")} First-run setup — wires hooks across your agents AND wakes the mascot ${j.default.green("(start here)")}`,` ${j.default.bold("login")} Sign in with Clerk OAuth`,` ${j.default.bold("logout")} Clear stored credentials`,` ${j.default.bold("whoami")} Show signed-in user`,` ${j.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${j.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${j.default.bold("install desktop")} Install the petdex-desktop binary (alternative to the .dmg)`,` ${j.default.bold("list")} List approved pets`,` ${j.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${j.default.bold("toggle")} One-shot wake/sleep — flips the mascot on or off depending on current state`,` ${j.default.bold("up")} Force-wake the mascot — enables hooks AND launches petdex-desktop`,` ${j.default.bold("down")} Force-sleep the mascot — disables hooks AND stops petdex-desktop`,` ${j.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${j.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${j.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${j.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex init ${Q("# after dragging Petdex.app from the .dmg → just run this")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex toggle ${Q("# wake or sleep the mascot")}`,` ${Q("$")} petdex doctor ${Q("# diagnose install + agents")}`,` ${Q("$")} petdex update ${Q("# pull the latest release")}`,"",` ${Q("Gallery & docs:")} ${j.default.underline(M1)}`,""].join(`
199
- `))}async function yz(){A1(j.default.bgMagenta(j.default.white(" petdex login ")));let $=z1();$.start("Opening your browser to sign in with Clerk");try{let Q=await A8(),{user:q}=await Q.login(),V=AY(q.email,q.username,q.sub)??"unknown";$.stop(`${j.default.green("✓ ")}Signed in as ${j.default.cyan(V)}`),T1(`Try ${j.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(j.default.red("× login failed")),Error(dz(Q.message))}}async function gz(){await(await A8()).logout(),console.log(`${j.default.green("✓ ")}Signed out`)}async function kz(){try{let Q=await(await A8()).whoami();if(!Q)throw Error("not signed in");let q=[w8(Q.given_name),w8(Q.family_name)].filter(Boolean).join(" ");w1([`${j.default.dim("user: ")}${Q.sub}`,`${j.default.dim("email: ")}${Q.email??"—"}`,`${j.default.dim("name: ")}${q||"—"}`,`${j.default.dim("username:")}${w8(Q.preferred_username)??"—"}`].join(`
200
- `),"Signed in")}catch{J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}}async function Dz($){let Q=$[0];if(!Q)J1(`Usage: ${j.default.cyan("petdex install <slug|desktop>")}`),process.exit(1);if(Q==="desktop"){let{tag:W}=await BJ();Y6("cli_install_desktop_success",{cli_version:K$,os:process.platform,arch:process.arch,binary_version:W.replace(/^desktop-v/,"")});return}let q=z1();q.start(`Resolving ${Q}`);let V;try{let W=await fetch(`${M1}/api/manifest`);if(!W.ok)throw q.stop(j.default.red("failed")),Error(`manifest fetch ${W.status}`);let z=(await W.json()).pets.find((H)=>H.slug===Q);if(!z)q.stop(j.default.red("not found")),J1(`No pet with slug ${j.default.bold(Q)}. Try ${j.default.cyan("petdex list")} to see what's available.`),process.exit(1);if(!i$(z.spritesheetUrl)||!i$(z.petJsonUrl))q.stop(j.default.red("untrusted asset host")),J1(`Refusing to install ${j.default.bold(Q)}: asset URLs are outside the petdex host allowlist. This row may need to be re-uploaded by an admin.`),process.exit(1);V=z}catch(W){throw q.stop(j.default.red("failed")),W}let Y=X1.join(OY(),".petdex","pets",Q),X=X1.join(OY(),".codex","pets",Q);q.message(`Downloading ${Q}`),await Promise.all([LY(Y,{recursive:!0}),LY(X,{recursive:!0})]);let J=V.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let Z=await fetch(W);if(!Z.ok)throw Error(`download ${W} → ${Z.status} ${Z.statusText}`);return Z.arrayBuffer()},[U,K]=await Promise.all([G(V.petJsonUrl),G(V.spritesheetUrl)]);await Promise.all([M8(X1.join(Y,"pet.json"),Buffer.from(U)),M8(X1.join(Y,`spritesheet.${J}`),Buffer.from(K)),M8(X1.join(X,"pet.json"),Buffer.from(U)),M8(X1.join(X,`spritesheet.${J}`),Buffer.from(K))]),fetch(`${M1}/install/${Q}`,{method:"GET"}).catch(()=>{}),q.stop(`Installed ${j.default.cyan(V.displayName)}`),w1(["Paths:",` ${j.default.dim(`~/.petdex/pets/${Q}`)} (Petdex Desktop)`,` ${j.default.dim(`~/.codex/pets/${Q}`)} (Codex Desktop)`,"","Activate in Petdex Desktop: right-click the mascot.","Activate in Codex Desktop:",` ${j.default.cyan("Settings → Appearance → Pets")} → select ${j.default.bold(V.displayName)}`].join(`
201
- `),"Next steps")}async function hz(){let $=z1();$.start("Fetching gallery");let Q=await fetch(`${M1}/api/manifest`);if(!Q.ok)throw $.stop(j.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let q=await Q.json();$.stop(`${q.total} pets`);let V=q.pets.map((Y)=>{let X=Y.submittedBy?j.default.dim(` — by ${Y.submittedBy}`):"";return` ${j.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${X}`});console.log(V.join(`
198
+ `;Xz(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var I1=process.env.PETDEX_URL??"https://petdex.crafter.run",Rz="https://clerk.petdex.crafter.run",vz="LcThwEayl6KAA1Qm",eQ=["profile","email","openid","offline_access"];async function xz(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:eQ};try{let q=await fetch(`${I1}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(q.ok){let V=await q.json(),Y=typeof V.issuer==="string"?V.issuer:null,X=typeof V.clientId==="string"?V.clientId:null,J=Array.isArray(V.scopes)?V.scopes.filter((G)=>typeof G==="string"):null;if(Y&&X)return{issuer:$??Y,clientId:Q??X,scopes:J&&J.length>0?J:eQ}}}catch{}return{issuer:$??Rz,clientId:Q??vz,scopes:eQ}}var I8=null;async function A8(){if(I8)return I8;let $=await xz();return I8=new j8({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),I8}var K$="0.3.5";Sz().catch(($)=>{J1(`petdex: ${$.message}`),process.exit(1)});async function Sz(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:V}=await Promise.resolve().then(() => (HY(),zY));await V($.slice(1));return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){OY();return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))VY();switch(Q){case"login":await Ez();break;case"logout":await yz();break;case"whoami":await gz();break;case"submit":await hz($.slice(1));break;case"install":await kz($.slice(1));break;case"list":await Dz();break;case"hooks":await iz($.slice(1));break;case"desktop":await sz($.slice(1));break;case"init":await rz();break;case"up":await TY();break;case"down":await FY();break;case"toggle":await az();break;case"update":await lJ($.slice(1));break;case"doctor":await yJ();break;case"telemetry":tz($.slice(1));break;case"version":case"--version":case"-v":console.log(K$);break;default:console.error(j.default.red(`Unknown command: ${Q}`)),OY(),process.exit(1)}}function OY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex"))} ${Q(K$)} ${Q("Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${j.default.bold("init")} First-run setup: wires hooks across your agents AND wakes the mascot ${j.default.green("(start here)")}`,` ${j.default.bold("login")} Sign in with Clerk OAuth`,` ${j.default.bold("logout")} Clear stored credentials`,` ${j.default.bold("whoami")} Show signed-in user`,` ${j.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${j.default.bold("install")} <slug> Install a pet into ~/.petdex/pets and ~/.codex/pets`,` ${j.default.bold("install desktop")} Install the petdex-desktop binary (alternative to the .dmg)`,` ${j.default.bold("list")} List approved pets`,` ${j.default.bold("hooks install")} Wire petdex-desktop into your coding agents`,` ${j.default.bold("toggle")} One-shot wake/sleep. Flips the mascot on or off depending on current state`,` ${j.default.bold("up")} Force-wake the mascot. Enables hooks AND launches petdex-desktop`,` ${j.default.bold("down")} Force-sleep the mascot. Disables hooks AND stops petdex-desktop`,` ${j.default.bold("desktop")} <cmd> Manage petdex-desktop (start | stop | status)`,` ${j.default.bold("update")} Pull the latest petdex-desktop release and restart`,` ${j.default.bold("doctor")} Diagnose install/runtime/agents and surface fixes`,` ${j.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,"",` ${$("Examples")}`,` ${Q("$")} petdex init ${Q("# after dragging Petdex.app from the .dmg → just run this")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex toggle ${Q("# wake or sleep the mascot")}`,` ${Q("$")} petdex doctor ${Q("# diagnose install + agents")}`,` ${Q("$")} petdex update ${Q("# pull the latest release")}`,"",` ${Q("Gallery & docs:")} ${j.default.underline(I1)}`,""].join(`
199
+ `))}async function Ez(){T1(j.default.bgMagenta(j.default.white(" petdex login ")));let $=H1();$.start("Opening your browser to sign in with Clerk");try{let Q=await A8(),{user:q}=await Q.login(),V=wY(q.email,q.username,q.sub)??"unknown";$.stop(`${j.default.green("✓ ")}Signed in as ${j.default.cyan(V)}`),F1(`Try ${j.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(j.default.red("× login failed")),Error(uz(Q.message))}}async function yz(){await(await A8()).logout(),console.log(`${j.default.green("✓ ")}Signed out`)}async function gz(){try{let Q=await(await A8()).whoami();if(!Q)throw Error("not signed in");let q=[w8(Q.given_name),w8(Q.family_name)].filter(Boolean).join(" ");A1([`${j.default.dim("user: ")}${Q.sub}`,`${j.default.dim("email: ")}${Q.email??"—"}`,`${j.default.dim("name: ")}${q||"—"}`,`${j.default.dim("username:")}${w8(Q.preferred_username)??"—"}`].join(`
200
+ `),"Signed in")}catch{J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}}async function kz($){let Q=$[0];if(!Q)J1(`Usage: ${j.default.cyan("petdex install <slug|desktop>")}`),process.exit(1);if(Q==="desktop"){let{tag:W}=await OJ();Y6("cli_install_desktop_success",{cli_version:K$,os:process.platform,arch:process.arch,binary_version:W.replace(/^desktop-v/,"")});return}let q=H1();q.start(`Resolving ${Q}`);let V;try{let W=await fetch(`${I1}/api/manifest`);if(!W.ok)throw q.stop(j.default.red("failed")),Error(`manifest fetch ${W.status}`);let z=(await W.json()).pets.find((H)=>H.slug===Q);if(!z)q.stop(j.default.red("not found")),J1(`No pet with slug ${j.default.bold(Q)}. Try ${j.default.cyan("petdex list")} to see what's available.`),process.exit(1);if(!i$(z.spritesheetUrl)||!i$(z.petJsonUrl))q.stop(j.default.red("untrusted asset host")),J1(`Refusing to install ${j.default.bold(Q)}: asset URLs are outside the petdex host allowlist. This row may need to be re-uploaded by an admin.`),process.exit(1);V=z}catch(W){throw q.stop(j.default.red("failed")),W}let Y=X1.join(LY(),".petdex","pets",Q),X=X1.join(LY(),".codex","pets",Q);q.message(`Downloading ${Q}`),await Promise.all([PY(Y,{recursive:!0}),PY(X,{recursive:!0})]);let J=V.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(W)=>{let Z=await fetch(W);if(!Z.ok)throw Error(`download ${W} → ${Z.status} ${Z.statusText}`);return Z.arrayBuffer()},[U,K]=await Promise.all([G(V.petJsonUrl),G(V.spritesheetUrl)]);await Promise.all([M8(X1.join(Y,"pet.json"),Buffer.from(U)),M8(X1.join(Y,`spritesheet.${J}`),Buffer.from(K)),M8(X1.join(X,"pet.json"),Buffer.from(U)),M8(X1.join(X,`spritesheet.${J}`),Buffer.from(K))]),fetch(`${I1}/install/${Q}`,{method:"GET"}).catch(()=>{}),q.stop(`Installed ${j.default.cyan(V.displayName)}`),A1(["Paths:",` ${j.default.dim(`~/.petdex/pets/${Q}`)} (Petdex Desktop)`,` ${j.default.dim(`~/.codex/pets/${Q}`)} (Codex Desktop)`,"","Activate in Petdex Desktop: right-click the mascot.","Activate in Codex Desktop:",` ${j.default.cyan("Settings → Appearance → Pets")} → select ${j.default.bold(V.displayName)}`].join(`
201
+ `),"Next steps")}async function Dz(){let $=H1();$.start("Fetching gallery");let Q=await fetch(`${I1}/api/manifest`);if(!Q.ok)throw $.stop(j.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let q=await Q.json();$.stop(`${q.total} pets`);let V=q.pets.map((Y)=>{let X=Y.submittedBy?j.default.dim(` by ${Y.submittedBy}`):"";return` ${j.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${X}`});console.log(V.join(`
202
202
  `)),console.log(`
203
203
  ${j.default.dim("Install with")} ${j.default.cyan("petdex install <slug>")}
204
- ${j.default.dim("Browse:")} ${j.default.underline(M1)}`)}async function _z($){let q=$.filter((L)=>!L.startsWith("--"))[0];if(!q)J1(`Usage: ${j.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let V=await A8(),Y;try{let L=await V.getAccessToken();if(!L)J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1);Y=L}catch{J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}let X=M1;try{X=oz(await V.whoami())}catch{}let J=X1.resolve(q),G=await wY(J).catch(()=>null);if(!G)J1(`No such file or directory: ${q}`),process.exit(1);A1(j.default.bgMagenta(j.default.white(" petdex submit ")));let U=z1();U.start(`Scanning ${J}`);let K=await bz(J,G.isDirectory());if(U.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:j.default.red("no pets found")),K.length===0)J1("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let Z=$.includes("--force")?new Map:await uz(K,Y),z=K,H=0;if(Z.size>0){let L=K.filter((O)=>Z.has(X6(O.petIdHint))),A=K.filter((O)=>!Z.has(X6(O.petIdHint)));w1(L.map((O)=>{let R=Z.get(X6(O.petIdHint))?.status??"unknown";return`${j.default.yellow("•")} ${j.default.bold(O.label)} ${j.default.dim(`(${R})`)}`}).join(`
205
- `),`${L.length} already submitted by you`);let B=await Eq({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(Q0(B)||B==="cancel")J1("Aborted."),process.exit(1);if(B==="skip"){if(z=A,H=L.length,z.length===0){T1(`Nothing new to submit. Track approval at ${j.default.underline(X)}.`);return}}}if(z.length>1){let L=await B6({message:`Submit ${j.default.bold(String(z.length))} pet${z.length===1?"":"s"}?`});if(Q0(L)||!L)J1("Aborted."),process.exit(1)}let C=0,P=0,I=[];for(let L of z){let A=z1();A.start(`Submitting ${j.default.cyan(L.label)}`);try{let B=await V.getAccessToken();if(!B)throw Error("session expired");Y=B;let O=await mz(L,Y);X=lz(O.profileUrl)??X,A.stop(`${j.default.green("✓")} ${j.default.cyan(L.label)} → ${cz(O)}`),C++}catch(B){let O=B.message;A.stop(`${j.default.red("×")} ${j.default.cyan(L.label)} ${j.default.red(O.slice(0,60))}`),I.push({label:L.label,error:O}),P++}}if(I.length>0)w1(I.map((L)=>`${j.default.red("•")} ${j.default.bold(L.label)}: ${L.error}`).join(`
206
- `),"Failures");let M=H>0?`, ${j.default.yellow(String(H))} skipped`:"";if(T1([`${j.default.green(String(C))} submitted${M}, ${P>0?j.default.red(String(P)):j.default.dim(String(P))} failed.`,`Held submissions stay visible at ${j.default.underline(X)}.`].join(`
207
- `)),P>0)process.exit(1)}async function bz($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let X=await fz($);return X?[X]:[]}if(await C8(X1.join($,"pet.json"))){let X=await NY($);return X?[X]:[]}let V=await Rz($,{withFileTypes:!0}),Y=[];for(let X of V){if(!X.isDirectory())continue;let J=X1.join($,X.name),G=await NY(J);if(G)Y.push(G)}return Y}async function NY($){let Q=X1.join($,"pet.json");if(!await C8(Q))return null;let q=X1.join($,"spritesheet.webp"),V="webp";if(!await C8(q)){let W=X1.join($,"spritesheet.png");if(!await C8(W))return null;q=W,V="png"}let Y=await qq(Q,"utf8"),X={};try{X=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let J=await qq(q),G=new Vq.default;G.file("pet.json",Y),G.file(`spritesheet.${V}`,J);let U=Buffer.from(await G.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=X1.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:X,zipBuffer:U,zipFileName:`${K}.zip`,spritesheetBuffer:J,spritesheetExt:V,petIdHint:typeof X.id==="string"?X.id:K}}async function fz($){let Q=await qq($),q=await Vq.default.loadAsync(Q),V=q.file("pet.json"),Y=q.file("spritesheet.webp"),X=q.file("spritesheet.png"),J=Y??X,G=Y?"webp":"png";if(!V||!J)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let U=await V.async("string"),K={};try{K=JSON.parse(U)}catch{throw Error("pet.json in zip is not valid JSON")}let W=Buffer.from(await J.async("uint8array")),Z=X1.basename($,".zip");return{label:Z,source:"zip",petJson:U,petJsonObj:K,zipBuffer:Q,zipFileName:X1.basename($),spritesheetBuffer:W,spritesheetExt:G,petIdHint:typeof K.id==="string"?K.id:Z}}async function mz($,Q){let{width:q,height:V}=iz($.spritesheetBuffer);if(q===0||V===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${M1}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:X6($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let H=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${H.slice(0,100)}`)}let X=await Y.json(),J=(H)=>{let C=X.files.find((P)=>P.role===H);if(!C)throw Error(`presign response missing ${H}`);return C},G=J("zip"),U=J("sprite"),K=J("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([Qq(G.uploadUrl,$.zipBuffer,"application/zip"),Qq(U.uploadUrl,$.spritesheetBuffer,W),Qq(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let Z=await fetch(`${M1}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:G.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:MY($.petJsonObj.displayName,"Untitled pet"),description:MY($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:q,spritesheetHeight:V})});if(!Z.ok){let H=await Z.text().catch(()=>"");throw Error(`register ${Z.status} ${H.slice(0,100)}`)}return await Z.json()}function cz($){let Q=j.default.dim($.slug),q=pz($.review);if($.review.decision==="approved")return`${Q} ${j.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${j.default.red("rejected")}${q?j.default.dim(` — ${q}`):""}`;return`${Q} ${j.default.yellow("held for review")}${q?j.default.dim(` — ${q}`):""}`}function pz($){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 Qq($,Q,q){let V=await fetch($,{method:"PUT",headers:{"Content-Type":q},body:Q});if(!V.ok)throw Error(`R2 PUT ${V.status}`)}async function uz($,Q){let q=new Map;if($.length===0)return q;try{let V=await fetch(`${M1}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((X)=>({petId:X.petIdHint,slugHint:X6(X.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!V.ok)return q;let Y=await V.json();for(let X of Y.existing??[])if(X&&typeof X.slug==="string")q.set(X.slug,X)}catch{}return q}function dz($){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(`
204
+ ${j.default.dim("Browse:")} ${j.default.underline(I1)}`)}async function hz($){let q=$.filter((L)=>!L.startsWith("--"))[0];if(!q)J1(`Usage: ${j.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let V=await A8(),Y;try{let L=await V.getAccessToken();if(!L)J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1);Y=L}catch{J1(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}let X=I1;try{X=lz(await V.whoami())}catch{}let J=X1.resolve(q),G=await CY(J).catch(()=>null);if(!G)J1(`No such file or directory: ${q}`),process.exit(1);T1(j.default.bgMagenta(j.default.white(" petdex submit ")));let U=H1();U.start(`Scanning ${J}`);let K=await _z(J,G.isDirectory());if(U.stop(K.length>0?`${K.length} pet${K.length===1?"":"s"} found`:j.default.red("no pets found")),K.length===0)J1("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let Z=$.includes("--force")?new Map:await pz(K,Y),z=K,H=0;if(Z.size>0){let L=K.filter((O)=>Z.has(X6(O.petIdHint))),A=K.filter((O)=>!Z.has(X6(O.petIdHint)));A1(L.map((O)=>{let R=Z.get(X6(O.petIdHint))?.status??"unknown";return`${j.default.yellow("•")} ${j.default.bold(O.label)} ${j.default.dim(`(${R})`)}`}).join(`
205
+ `),`${L.length} already submitted by you`);let B=await Sq({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(Q0(B)||B==="cancel")J1("Aborted."),process.exit(1);if(B==="skip"){if(z=A,H=L.length,z.length===0){F1(`Nothing new to submit. Track approval at ${j.default.underline(X)}.`);return}}}if(z.length>1){let L=await B6({message:`Submit ${j.default.bold(String(z.length))} pet${z.length===1?"":"s"}?`});if(Q0(L)||!L)J1("Aborted."),process.exit(1)}let C=0,P=0,I=[];for(let L of z){let A=H1();A.start(`Submitting ${j.default.cyan(L.label)}`);try{let B=await V.getAccessToken();if(!B)throw Error("session expired");Y=B;let O=await bz(L,Y);X=dz(O.profileUrl)??X,A.stop(`${j.default.green("✓")} ${j.default.cyan(L.label)} → ${mz(O)}`),C++}catch(B){let O=B.message;A.stop(`${j.default.red("×")} ${j.default.cyan(L.label)} ${j.default.red(O.slice(0,60))}`),I.push({label:L.label,error:O}),P++}}if(I.length>0)A1(I.map((L)=>`${j.default.red("•")} ${j.default.bold(L.label)}: ${L.error}`).join(`
206
+ `),"Failures");let M=H>0?`, ${j.default.yellow(String(H))} skipped`:"";if(F1([`${j.default.green(String(C))} submitted${M}, ${P>0?j.default.red(String(P)):j.default.dim(String(P))} failed.`,`Held submissions stay visible at ${j.default.underline(X)}.`].join(`
207
+ `)),P>0)process.exit(1)}async function _z($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let X=await fz($);return X?[X]:[]}if(await C8(X1.join($,"pet.json"))){let X=await BY($);return X?[X]:[]}let V=await Fz($,{withFileTypes:!0}),Y=[];for(let X of V){if(!X.isDirectory())continue;let J=X1.join($,X.name),G=await BY(J);if(G)Y.push(G)}return Y}async function BY($){let Q=X1.join($,"pet.json");if(!await C8(Q))return null;let q=X1.join($,"spritesheet.webp"),V="webp";if(!await C8(q)){let W=X1.join($,"spritesheet.png");if(!await C8(W))return null;q=W,V="png"}let Y=await Qq(Q,"utf8"),X={};try{X=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let J=await Qq(q),G=new qq.default;G.file("pet.json",Y),G.file(`spritesheet.${V}`,J);let U=Buffer.from(await G.generateAsync({type:"uint8array",compression:"DEFLATE"})),K=X1.basename($);return{label:K,source:"folder",petJson:Y,petJsonObj:X,zipBuffer:U,zipFileName:`${K}.zip`,spritesheetBuffer:J,spritesheetExt:V,petIdHint:typeof X.id==="string"?X.id:K}}async function fz($){let Q=await Qq($),q=await qq.default.loadAsync(Q),V=q.file("pet.json"),Y=q.file("spritesheet.webp"),X=q.file("spritesheet.png"),J=Y??X,G=Y?"webp":"png";if(!V||!J)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let U=await V.async("string"),K={};try{K=JSON.parse(U)}catch{throw Error("pet.json in zip is not valid JSON")}let W=Buffer.from(await J.async("uint8array")),Z=X1.basename($,".zip");return{label:Z,source:"zip",petJson:U,petJsonObj:K,zipBuffer:Q,zipFileName:X1.basename($),spritesheetBuffer:W,spritesheetExt:G,petIdHint:typeof K.id==="string"?K.id:Z}}async function bz($,Q){let{width:q,height:V}=oz($.spritesheetBuffer);if(q===0||V===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${I1}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:X6($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let H=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${H.slice(0,100)}`)}let X=await Y.json(),J=(H)=>{let C=X.files.find((P)=>P.role===H);if(!C)throw Error(`presign response missing ${H}`);return C},G=J("zip"),U=J("sprite"),K=J("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([$q(G.uploadUrl,$.zipBuffer,"application/zip"),$q(U.uploadUrl,$.spritesheetBuffer,W),$q(K.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let Z=await fetch(`${I1}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:G.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:K.publicUrl,petId:$.petIdHint,displayName:NY($.petJsonObj.displayName,"Untitled pet"),description:NY($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:q,spritesheetHeight:V})});if(!Z.ok){let H=await Z.text().catch(()=>"");throw Error(`register ${Z.status} ${H.slice(0,100)}`)}return await Z.json()}function mz($){let Q=j.default.dim($.slug),q=cz($.review);if($.review.decision==="approved")return`${Q} ${j.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${j.default.red("rejected")}${q?j.default.dim(`: ${q}`):""}`;return`${Q} ${j.default.yellow("held for review")}${q?j.default.dim(`: ${q}`):""}`}function cz($){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 $q($,Q,q){let V=await fetch($,{method:"PUT",headers:{"Content-Type":q},body:Q});if(!V.ok)throw Error(`R2 PUT ${V.status}`)}async function pz($,Q){let q=new Map;if($.length===0)return q;try{let V=await fetch(`${I1}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((X)=>({petId:X.petIdHint,slugHint:X6(X.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!V.ok)return q;let Y=await V.json();for(let X of Y.existing??[])if(X&&typeof X.slug==="string")q.set(X.slug,X)}catch{}return q}function uz($){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(`
208
208
  `);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(`
209
209
  `);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(`
210
- `);return $}async function C8($){try{return await wY($),!0}catch{return!1}}function MY($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function w8($){return typeof $==="string"&&$.trim()?$.trim():null}function AY(...$){for(let Q of $){let q=w8(Q);if(q)return q}return null}function TY($){let Q=M1.replace(/\/+$/,""),q=$.startsWith("/")?$:`/${$}`;return`${Q}${q}`}function lz($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return TY($)}function oz($){let Q=AY($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?TY(`/u/${encodeURIComponent(Q.toLowerCase())}`):M1}function X6($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function iz($){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 q=$[22],V=$[23],Y=$[24];return{width:(($[21]|(q&63)<<8)>>>0)+1,height:((q>>6|V<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let q=23;q<Math.min(60,$.length-7);q++)if($[q]===157&&$[q+1]===1&&$[q+2]===42)return{width:($[q+3]|$[q+4]<<8)&16383,height:($[q+5]|$[q+6]<<8)&16383}}}return{width:0,height:0}}async function nz($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){IY();return}switch(Q){case"install":{let{installedAgents:q}=await oQ();if(q.length>0)Y6("cli_hooks_install_success",{cli_version:K$,agents:q}),console.log(""),console.log(`${j.default.green("✓")} ${j.default.bold("All set.")} Open your agent and run ${j.default.cyan("/petdex")} to wake the mascot.`);break}case"toggle":case"on":case"off":case"status":{rz(Q);break}case"uninstall":{let q=$.includes("--remove-token");await sJ({removeToken:q});break}case"refresh":{let{runRefresh:q}=await Promise.resolve().then(() => (aQ(),rQ)),V=await q();if(V.binaryPersisted)console.log(`${j.default.green("✓")} Snapshotted petdex binary at ${j.default.dim("~/.petdex/bin/petdex.js")}`);else if(V.binaryReason)console.log(`${j.default.yellow("!")} Binary snapshot skipped: ${V.binaryReason}`);for(let X of V.refreshed)console.log(`${j.default.green("✓")} Refreshed ${X}`);for(let{id:X,reason:J}of V.skipped){if(J==="not installed")continue;console.log(`${j.default.yellow("!")} Skipped ${X}: ${J}`)}let Y=V.refreshed.length;if(console.log(""),Y===0)console.log(`${j.default.dim("No wired agents found. Run")} ${j.default.cyan("petdex init")} ${j.default.dim("first.")}`);else console.log(`${j.default.green("✓")} ${j.default.bold(`${Y} agent${Y===1?"":"s"} refreshed.`)} Restart your agent to load the new hooks.`);break}default:console.error(j.default.red(`Unknown hooks command: ${Q}`)),IY(),process.exit(1)}}function rz($){let Q;if($==="toggle")Q=yJ();else if($==="on")Q=X$("on");else if($==="off")Q=X$("off");else Q=Y$();if(Q==="on")console.log(`${j.default.green("●")} Petdex hooks are ${j.default.bold("ENABLED")}`),console.log(j.default.dim(" agent tool calls will animate the mascot when petdex-desktop is running"));else console.log(`${j.default.yellow("○")} Petdex hooks are ${j.default.bold("DISABLED")}`),console.log(j.default.dim(" agent hooks short-circuit before any network call. Re-enable: petdex hooks on"))}async function az(){let{installedAgents:$}=await oQ();if($.length>0)Y6("cli_hooks_install_success",{cli_version:K$,agents:$}),console.log(""),console.log(`${j.default.green("✓")} ${j.default.bold("All set.")} Open your agent and run ${j.default.cyan("/petdex")} to wake the mascot.`),console.log(j.default.dim(` Or from a shell: ${j.default.cyan("petdex up")} (force-wake) · ${j.default.cyan("petdex toggle")} (smart wake/sleep)`))}async function FY(){X$("on"),console.log(`${j.default.green("●")} Hooks ${j.default.bold("ENABLED")}`);let $=s1();if($.state==="running"){console.log(`${j.default.green("●")} Desktop already running (pid ${$.pid})`);return}let Q=await s$();if(Q.ok)console.log(Q.alreadyRunning?`${j.default.dim("•")} Desktop already running (pid ${Q.pid})`:`${j.default.green("✓")} Desktop started (pid ${Q.pid})`);else console.log(`${j.default.yellow("!")} ${Q.reason}`),console.log(j.default.dim(` Install the binary first: ${j.default.cyan("petdex install desktop")}`))}async function sz(){let $=Y$()==="on",Q=s1().state==="running";if($&&Q)await RY();else await FY()}async function RY(){if(X$("off"),console.log(`${j.default.yellow("○")} Hooks ${j.default.bold("DISABLED")}`),s1().state==="stopped"){console.log(`${j.default.dim("•")} Desktop wasn't running`);return}let Q=await t$();if(Q.ok)console.log(`${j.default.green("✓")} Desktop stopped (pid ${Q.pid})`);else console.log(`${j.default.dim("•")} ${Q.reason}`)}function IY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex hooks"))}`,"",` ${$("Usage")}`," petdex hooks <command>","",` ${$("Commands")}`,` ${j.default.bold("install")} Wire petdex into your coding agents`,` ${j.default.bold("refresh")} Re-write hook configs + slash commands for already-wired agents (non-interactive)`,` ${j.default.bold("uninstall")} Remove petdex from your agent configs (--remove-token also drops the auth token)`,` ${j.default.bold("toggle")} Flip the killswitch — disable/enable hooks without restarting agents`,` ${j.default.bold("on")} Enable hooks (clears the killswitch)`,` ${j.default.bold("off")} Disable hooks (sets the killswitch — agent tool calls become no-ops)`,` ${j.default.bold("status")} Show whether hooks are currently enabled`,"",` ${$("Examples")}`,` ${Q("$")} petdex hooks install`,` ${Q("$")} petdex hooks toggle`,` ${Q("$")} petdex hooks status`,""].join(`
211
- `))}async function tz($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){CY();return}switch(Q){case"start":await RJ(),Y6("cli_desktop_start_success",{cli_version:K$});break;case"stop":await vJ();break;case"status":xJ();break;default:console.error(j.default.red(`Unknown desktop command: ${Q}`)),CY(),process.exit(1)}}function CY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex desktop"))}`,"",` ${$("Usage")}`," petdex desktop <command>","",` ${$("Commands")}`,` ${j.default.bold("start")} Launch petdex-desktop in the background`,` ${j.default.bold("stop")} Terminate the running petdex-desktop process`,` ${j.default.bold("status")} Show whether petdex-desktop is running`,"",` ${$("Examples")}`,` ${Q("$")} petdex desktop start`,` ${Q("$")} petdex desktop status`,` ${Q("$")} petdex desktop stop`,""].join(`
212
- `))}function ez($){let Q=$[0];if(Q==="on"||Q==="off"){let q=Q==="on";if(qY(q))console.log(q?"Telemetry enabled":"Telemetry disabled");else console.error(j.default.red(`${j.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${Q}\` again.`)),process.exit(1)}else if(Q==="status"||!Q){let q=VY();if(console.log(`Status: ${q.enabled?"enabled":"disabled"}`),q.install_id)console.log(`Install ID: ${q.install_id}`)}else console.error(j.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}
210
+ `);return $}async function C8($){try{return await CY($),!0}catch{return!1}}function NY($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function w8($){return typeof $==="string"&&$.trim()?$.trim():null}function wY(...$){for(let Q of $){let q=w8(Q);if(q)return q}return null}function AY($){let Q=I1.replace(/\/+$/,""),q=$.startsWith("/")?$:`/${$}`;return`${Q}${q}`}function dz($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return AY($)}function lz($){let Q=wY($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?AY(`/u/${encodeURIComponent(Q.toLowerCase())}`):I1}function X6($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function oz($){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 q=$[22],V=$[23],Y=$[24];return{width:(($[21]|(q&63)<<8)>>>0)+1,height:((q>>6|V<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let q=23;q<Math.min(60,$.length-7);q++)if($[q]===157&&$[q+1]===1&&$[q+2]===42)return{width:($[q+3]|$[q+4]<<8)&16383,height:($[q+5]|$[q+6]<<8)&16383}}}return{width:0,height:0}}async function iz($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){MY();return}switch(Q){case"install":{let{installedAgents:q}=await lQ();if(q.length>0)Y6("cli_hooks_install_success",{cli_version:K$,agents:q}),console.log(""),console.log(`${j.default.green("✓")} ${j.default.bold("All set.")} Open your agent and run ${j.default.cyan("/petdex")} to wake the mascot.`);break}case"toggle":case"on":case"off":case"status":{nz(Q);break}case"uninstall":{let q=$.includes("--remove-token");await aJ({removeToken:q});break}case"refresh":{let{runRefresh:q}=await Promise.resolve().then(() => (rQ(),nQ)),V=await q();if(V.binaryPersisted)console.log(`${j.default.green("✓")} Snapshotted petdex binary at ${j.default.dim("~/.petdex/bin/petdex.js")}`);else if(V.binaryReason)console.log(`${j.default.yellow("!")} Binary snapshot skipped: ${V.binaryReason}`);for(let X of V.refreshed)console.log(`${j.default.green("✓")} Refreshed ${X}`);for(let{id:X,reason:J}of V.skipped){if(J==="not installed")continue;console.log(`${j.default.yellow("!")} Skipped ${X}: ${J}`)}let Y=V.refreshed.length;if(console.log(""),Y===0)console.log(`${j.default.dim("No wired agents found. Run")} ${j.default.cyan("petdex init")} ${j.default.dim("first.")}`);else console.log(`${j.default.green("✓")} ${j.default.bold(`${Y} agent${Y===1?"":"s"} refreshed.`)} Restart your agent to load the new hooks.`);break}default:console.error(j.default.red(`Unknown hooks command: ${Q}`)),MY(),process.exit(1)}}function nz($){let Q;if($==="toggle")Q=EJ();else if($==="on")Q=X$("on");else if($==="off")Q=X$("off");else Q=Y$();if(Q==="on")console.log(`${j.default.green("●")} Petdex hooks are ${j.default.bold("ENABLED")}`),console.log(j.default.dim(" agent tool calls will animate the mascot when petdex-desktop is running"));else console.log(`${j.default.yellow("○")} Petdex hooks are ${j.default.bold("DISABLED")}`),console.log(j.default.dim(" agent hooks short-circuit before any network call. Re-enable: petdex hooks on"))}async function rz(){let{installedAgents:$}=await lQ();if($.length>0)Y6("cli_hooks_install_success",{cli_version:K$,agents:$}),console.log(""),console.log(`${j.default.green("✓")} ${j.default.bold("All set.")} Open your agent and run ${j.default.cyan("/petdex")} to wake the mascot.`),console.log(j.default.dim(` Or from a shell: ${j.default.cyan("petdex up")} (force-wake) · ${j.default.cyan("petdex toggle")} (smart wake/sleep)`))}async function TY(){X$("on"),console.log(`${j.default.green("●")} Hooks ${j.default.bold("ENABLED")}`);let $=s1();if($.state==="running"){console.log(`${j.default.green("●")} Desktop already running (pid ${$.pid})`);return}let Q=await s$();if(Q.ok)console.log(Q.alreadyRunning?`${j.default.dim("•")} Desktop already running (pid ${Q.pid})`:`${j.default.green("✓")} Desktop started (pid ${Q.pid})`);else console.log(`${j.default.yellow("!")} ${Q.reason}`),console.log(j.default.dim(` Install the binary first: ${j.default.cyan("petdex install desktop")}`))}async function az(){let $=Y$()==="on",Q=s1().state==="running";if($&&Q)await FY();else await TY()}async function FY(){if(X$("off"),console.log(`${j.default.yellow("○")} Hooks ${j.default.bold("DISABLED")}`),s1().state==="stopped"){console.log(`${j.default.dim("•")} Desktop wasn't running`);return}let Q=await t$();if(Q.ok)console.log(`${j.default.green("✓")} Desktop stopped (pid ${Q.pid})`);else console.log(`${j.default.dim("•")} ${Q.reason}`)}function MY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex hooks"))}`,"",` ${$("Usage")}`," petdex hooks <command>","",` ${$("Commands")}`,` ${j.default.bold("install")} Wire petdex into your coding agents`,` ${j.default.bold("refresh")} Re-write hook configs + slash commands for already-wired agents (non-interactive)`,` ${j.default.bold("uninstall")} Remove petdex from your agent configs (--remove-token also drops the auth token)`,` ${j.default.bold("toggle")} Flip the killswitch. Disable/enable hooks without restarting agents`,` ${j.default.bold("on")} Enable hooks (clears the killswitch)`,` ${j.default.bold("off")} Disable hooks (sets the killswitch, agent tool calls become no-ops)`,` ${j.default.bold("status")} Show whether hooks are currently enabled`,"",` ${$("Examples")}`,` ${Q("$")} petdex hooks install`,` ${Q("$")} petdex hooks toggle`,` ${Q("$")} petdex hooks status`,""].join(`
211
+ `))}async function sz($){let Q=$[0];if(!Q||Q==="--help"||Q==="-h"||Q==="help"){IY();return}switch(Q){case"start":await FJ(),Y6("cli_desktop_start_success",{cli_version:K$});break;case"stop":await RJ();break;case"status":vJ();break;default:console.error(j.default.red(`Unknown desktop command: ${Q}`)),IY(),process.exit(1)}}function IY(){let $=j.default.cyan,Q=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex desktop"))}`,"",` ${$("Usage")}`," petdex desktop <command>","",` ${$("Commands")}`,` ${j.default.bold("start")} Launch petdex-desktop in the background`,` ${j.default.bold("stop")} Terminate the running petdex-desktop process`,` ${j.default.bold("status")} Show whether petdex-desktop is running`,"",` ${$("Examples")}`,` ${Q("$")} petdex desktop start`,` ${Q("$")} petdex desktop status`,` ${Q("$")} petdex desktop stop`,""].join(`
212
+ `))}function tz($){let Q=$[0];if(Q==="on"||Q==="off"){let q=Q==="on";if(QY(q))console.log(q?"Telemetry enabled":"Telemetry disabled");else console.error(j.default.red(`${j.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${Q}\` again.`)),process.exit(1)}else if(Q==="status"||!Q){let q=qY();if(console.log(`Status: ${q.enabled?"enabled":"disabled"}`),q.install_id)console.log(`Install ID: ${q.install_id}`)}else console.error(j.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}