petdex 0.4.7 → 1.0.0
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/README.md +35 -23
- package/dist/petdex.js +81 -429
- package/package.json +2 -2
package/dist/petdex.js
CHANGED
|
@@ -1,444 +1,96 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{createRequire as r3}from"node:module";var m3=Object.create;var{getPrototypeOf:c3,defineProperty:t2,getOwnPropertyNames:u3}=Object;var p3=Object.prototype.hasOwnProperty;function d3(Q){return this[Q]}var l3,o3,p0=(Q,$,q)=>{var J=Q!=null&&typeof Q==="object";if(J){var Y=$?l3??=new WeakMap:o3??=new WeakMap,V=Y.get(Q);if(V)return V}q=Q!=null?m3(c3(Q)):{};let X=$||!Q||!Q.__esModule?t2(q,"default",{value:Q,enumerable:!0}):q;for(let K of u3(Q))if(!p3.call(X,K))t2(X,K,{get:d3.bind(Q,K),enumerable:!0});if(J)Y.set(Q,X);return X};var w=(Q,$)=>()=>($||Q(($={exports:{}}).exports,$),$.exports);var i3=(Q)=>Q;function n3(Q,$){this[Q]=i3.bind(null,$)}var E8=(Q,$)=>{for(var q in $)t2(Q,q,{get:$[q],enumerable:!0,configurable:!0,set:n3.bind($,q)})};var H0=(Q,$)=>()=>(Q&&($=Q(Q=0)),$);var f=r3(import.meta.url);var tQ,eQ=(Q)=>{return Q===12288||Q>=65281&&Q<=65376||Q>=65504&&Q<=65510},Q7=(Q)=>{return Q===8987||Q===9001||Q>=12272&&Q<=12287||Q>=12289&&Q<=12350||Q>=12441&&Q<=12543||Q>=12549&&Q<=12591||Q>=12593&&Q<=12686||Q>=12688&&Q<=12771||Q>=12783&&Q<=12830||Q>=12832&&Q<=12871||Q>=12880&&Q<=19903||Q>=65040&&Q<=65049||Q>=65072&&Q<=65106||Q>=65108&&Q<=65126||Q>=65128&&Q<=65131||Q>=127488&&Q<=127490||Q>=127504&&Q<=127547||Q>=127552&&Q<=127560||Q>=131072&&Q<=196605||Q>=196608&&Q<=262141};var $7=H0(()=>{tQ=(()=>{let Q=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return($)=>{let q=0;Q.lastIndex=0;while(Q.test($))q+=1;return $.length-q}})()});var a3,s3,q7,t3,J7,e3,QV,$V,Y7=(Q,$={},q={})=>{let J=$.limit??1/0,Y=$.ellipsis??"",V=$?.ellipsisWidth??(Y?Y7(Y,$V,q).width:0),X=0,K=q.controlWidth??0,W=q.tabWidth??8,G=q.emojiWidth??2,U=2,z=q.regularWidth??1,Z=q.wideWidth??2,H=[[e3,z],[a3,0],[s3,K],[t3,W],[J7,G],[q7,Z]],F=0,N=0,C=Q.length,P=0,L=!1,A=C,B=Math.max(0,J-V),O=0,M=0,T=0,D=0;Q:while(!0){if(M>O||N>=C&&N>F){let x=Q.slice(O,M)||Q.slice(F,N);P=0;for(let v of x.replaceAll(QV,"")){let R=v.codePointAt(0)||0;if(eQ(R))D=2;else if(Q7(R))D=Z;else D=z;if(T+D>B)A=Math.min(A,Math.max(O,F)+P);if(T+D>J){L=!0;break Q}P+=v.length,T+=D}O=M=0}if(N>=C)break Q;for(let x=0,v=H.length;x<v;x++){let[R,$0]=H[x];if(R.lastIndex=N,R.test(Q)){if(P=R===q7?tQ(Q.slice(N,R.lastIndex)):R===J7?1:R.lastIndex-N,D=P*$0,T+D>B)A=Math.min(A,N+Math.floor((B-T)/$0));if(T+D>J){L=!0;break Q}T+=D,O=F,M=N,N=F=R.lastIndex;continue Q}}N+=1}return{width:L?B:T,index:L?A:C,truncated:L,ellipsed:L&&J>=V}},V7;var X7=H0(()=>{$7();a3=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,s3=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,q7=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,t3=/\t{1,1000}/y,J7=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,e3=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,QV=/\p{M}+/gu,$V={limit:1/0,ellipsis:""},V7=Y7});var qV,JV=(Q,$={})=>{return V7(Q,qV,$).width},W0;var e2=H0(()=>{X7();qV={limit:1/0,ellipsis:"",ellipsisWidth:0},W0=JV});function d0(Q,$,q){return String(Q).normalize().split(GV).map((J)=>KV(J,$,q)).join(`
|
|
3
|
-
`)}var S8="\x1B",j7="",YV=39,$5="\x07",Z7="[",VV="]",z7="m",q5,K7,G7=(Q)=>{if(Q>=30&&Q<=37)return 39;if(Q>=90&&Q<=97)return 39;if(Q>=40&&Q<=47)return 49;if(Q>=100&&Q<=107)return 49;if(Q===1||Q===2)return 22;if(Q===3)return 23;if(Q===4)return 24;if(Q===7)return 27;if(Q===8)return 28;if(Q===9)return 29;if(Q===0)return 0;return},W7=(Q)=>`${S8}${Z7}${Q}${z7}`,U7=(Q)=>`${S8}${q5}${Q}${$5}`,Q5=(Q,$,q)=>{let J=$[Symbol.iterator](),Y=!1,V=!1,X=Q.at(-1),K=X===void 0?0:W0(X),W=J.next(),G=J.next(),U=0;while(!W.done){let z=W.value,Z=W0(z);if(K+Z<=q)Q[Q.length-1]+=z;else Q.push(z),K=0;if(z===S8||z===j7)Y=!0,V=$.startsWith(q5,U+1);if(Y){if(V){if(z===$5)Y=!1,V=!1}else if(z===z7)Y=!1}else if(K+=Z,K===q&&!G.done)Q.push(""),K=0;W=G,G=J.next(),U+=z.length}if(X=Q.at(-1),!K&&X!==void 0&&X.length&&Q.length>1)Q[Q.length-2]+=Q.pop()},XV=(Q)=>{let $=Q.split(" "),q=$.length;while(q){if(W0($[q-1]))break;q--}if(q===$.length)return Q;return $.slice(0,q).join(" ")+$.slice(q).join("")},KV=(Q,$,q={})=>{if(q.trim!==!1&&Q.trim()==="")return"";let J="",Y,V,X=Q.split(" "),K=[""],W=0;for(let z=0;z<X.length;z++){let Z=X[z];if(q.trim!==!1){let F=K.at(-1)??"",N=F.trimStart();if(F.length!==N.length)K[K.length-1]=N,W=W0(N)}if(z!==0){if(W>=$&&(q.wordWrap===!1||q.trim===!1))K.push(""),W=0;if(W||q.trim===!1)K[K.length-1]+=" ",W++}let H=W0(Z);if(q.hard&&H>$){let F=$-W,N=1+Math.floor((H-F-1)/$);if(Math.floor((H-1)/$)<N)K.push("");Q5(K,Z,$),W=W0(K.at(-1)??"");continue}if(W+H>$&&W&&H){if(q.wordWrap===!1&&W<$){Q5(K,Z,$),W=W0(K.at(-1)??"");continue}K.push(""),W=0}if(W+H>$&&q.wordWrap===!1){Q5(K,Z,$),W=W0(K.at(-1)??"");continue}K[K.length-1]+=Z,W+=H}if(q.trim!==!1)K=K.map((z)=>XV(z));let G=K.join(`
|
|
4
|
-
`)
|
|
5
|
-
`)
|
|
6
|
-
|
|
7
|
-
`),V=0,
|
|
8
|
-
`),
|
|
9
|
-
`)
|
|
10
|
-
`)
|
|
11
|
-
`)}
|
|
12
|
-
`),
|
|
13
|
-
`)
|
|
14
|
-
`)
|
|
15
|
-
`).
|
|
16
|
-
`)),this._prevFrame=Q;return}}this.output.write(X0.erase.down())}this.output.write(Q),this.state==="initial"&&(this.state="active"),this._prevFrame=Q}}},BV,z5,MV,P7,I7,C7,T7,H5;var F5=H0(()=>{J5();X0=p0(V5(),1);ZV=["up","down","left","right","space","enter","cancel"],zV=["January","February","March","April","May","June","July","August","September","October","November","December"],r={actions:new Set(ZV),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...zV],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:(Q,$)=>`There are only ${Q} days in ${$}`,afterMin:(Q)=>`Date must be on or after ${Q.toISOString().slice(0,10)}`,beforeMax:(Q)=>`Date must be on or before ${Q.toISOString().slice(0,10)}`}}};FV=globalThis.process.platform.startsWith("win"),G5=Symbol("clack:cancel");BV=class extends g1{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#$=0;#Y="";#Q;#V;#K;get cursor(){return this.#$}get userInputWithCursor(){if(!this.userInput)return K5(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let Q=this.userInput.slice(0,this._cursor),[$,...q]=this.userInput.slice(this._cursor);return`${Q}${K5("inverse",$)}${q.join("")}`}get options(){return typeof this.#V=="function"?this.#V():this.#V}constructor(Q){super(Q),this.#V=Q.options,this.#K=Q.placeholder;let $=this.options;this.filteredOptions=[...$],this.multiple=Q.multiple===!0,this.#Q=typeof Q.options=="function"?Q.filter:Q.filter??OV;let q;if(Q.initialValue&&Array.isArray(Q.initialValue)?this.multiple?q=Q.initialValue:q=Q.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(q=[this.options[0].value]),q)for(let J of q){let Y=$.findIndex((V)=>V.value===J);Y!==-1&&(this.toggleSelected(J),this.#$=Y)}this.focusedValue=this.options[this.#$]?.value,this.on("key",(J,Y)=>this.#q(J,Y)),this.on("userInput",(J)=>this.#J(J))}_isActionKey(Q,$){return Q==="\t"||this.multiple&&this.isNavigating&&$.name==="space"&&Q!==void 0&&Q!==""}#q(Q,$){let q=$.name==="up",J=$.name==="down",Y=$.name==="return",V=this.userInput===""||this.userInput==="\t",X=this.#K,K=this.options,W=X!==void 0&&X!==""&&K.some((G)=>!G.disabled&&(this.#Q?this.#Q(X,G):!0));if($.name==="tab"&&V&&W){this.userInput==="\t"&&this._clearUserInput(),this._setUserInput(X,!0),this.isNavigating=!1;return}q||J?(this.#$=Y1(this.#$,q?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#$]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):Y?this.value=NV(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&($.name==="tab"||this.isNavigating&&$.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(Q){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(Q)?this.selectedValues=this.selectedValues.filter(($)=>$!==Q):this.selectedValues=[...this.selectedValues,Q]:this.selectedValues=[Q])}#J(Q){if(Q!==this.#Y){this.#Y=Q;let $=this.options;Q&&this.#Q?this.filteredOptions=$.filter((Y)=>this.#Q?.(Q,Y)):this.filteredOptions=[...$];let q=LV(this.focusedValue,this.filteredOptions);this.#$=Y1(q,0,this.filteredOptions);let J=this.filteredOptions[this.#$];J&&!J.disabled?this.focusedValue=J.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};z5=class z5 extends g1{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(Q){super(Q,!1),this.value=!!Q.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",($)=>{this.output.write(X0.cursor.move(0,-1)),this.value=$,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}};MV={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};P7=class P7 extends g1{#$;#Y;#Q;#V;#K;#q={segmentIndex:0,positionInSegment:0};#J=!0;#X=null;inlineError="";get segmentCursor(){return{...this.#q}}get segmentValues(){return{...this.#Q}}get segments(){return this.#$}get separator(){return this.#Y}get formattedValue(){return this.#j(this.#Q)}#j(Q){return this.#$.map(($)=>Q[$.type]).join(this.#Y)}#G(){this._setUserInput(this.#j(this.#Q)),this._setValue(O7(this.#Q)??void 0)}constructor(Q){let $=Q.format?{segments:L7(Q.format),separator:Q.separator??"/"}:PV(Q.locale),q=Q.separator??$.separator,J=Q.format?L7(Q.format):$.segments,Y=Q.initialValue??Q.defaultValue,V=Y?{year:String(Y.getUTCFullYear()).padStart(4,"0"),month:String(Y.getUTCMonth()+1).padStart(2,"0"),day:String(Y.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},X=J.map((K)=>V[K.type]).join(q);super({...Q,initialUserInput:X},!1),this.#$=J,this.#Y=q,this.#Q=V,this.#V=Q.minDate,this.#K=Q.maxDate,this.#G(),this.on("cursor",(K)=>this.#H(K)),this.on("key",(K,W)=>this.#F(K,W)),this.on("finalize",()=>this.#L(Q))}#W(){let Q=Math.max(0,Math.min(this.#q.segmentIndex,this.#$.length-1)),$=this.#$[Q];if($)return this.#q.positionInSegment=Math.max(0,Math.min(this.#q.positionInSegment,$.len-1)),{segment:$,index:Q}}#U(Q){this.inlineError="",this.#X=null;let $=this.#W();$&&(this.#q.segmentIndex=Math.max(0,Math.min(this.#$.length-1,$.index+Q)),this.#q.positionInSegment=0,this.#J=!0)}#Z(Q){let $=this.#W();if(!$)return;let{segment:q}=$,J=this.#Q[q.type],Y=!J||J.replace(/_/g,"")==="",V=Number.parseInt((J||"0").replace(/_/g,"0"),10)||0,X=IV(q.type,g8(this.#Q),this.#V,this.#K),K;Y?K=Q===1?X.min:X.max:K=Math.max(Math.min(X.max,V+Q),X.min),this.#Q={...this.#Q,[q.type]:K.toString().padStart(q.len,"0")},this.#J=!0,this.#X=null,this.#G()}#H(Q){if(Q)switch(Q){case"right":return this.#U(1);case"left":return this.#U(-1);case"up":return this.#Z(1);case"down":return this.#Z(-1)}}#F(Q,$){if($?.name==="backspace"||$?.sequence===""||$?.sequence==="\b"||Q===""||Q==="\b"){this.inlineError="";let q=this.#W();if(!q)return;if(!this.#Q[q.segment.type].replace(/_/g,"")){this.#U(-1);return}this.#Q[q.segment.type]="_".repeat(q.segment.len),this.#J=!0,this.#q.positionInSegment=0,this.#G();return}if($?.name==="tab"){this.inlineError="";let q=this.#W();if(!q)return;let J=$.shift?-1:1,Y=q.index+J;Y>=0&&Y<this.#$.length&&(this.#q.segmentIndex=Y,this.#q.positionInSegment=0,this.#J=!0);return}if(Q&&/^[0-9]$/.test(Q)){let q=this.#W();if(!q)return;let{segment:J}=q,Y=!this.#Q[J.type].replace(/_/g,"");if(this.#J&&this.#X!==null&&!Y){let Z=this.#X+Q,H={...this.#Q,[J.type]:Z},F=this.#z(H,J);if(F){this.inlineError=F,this.#X=null,this.#J=!1;return}this.inlineError="",this.#Q[J.type]=Z,this.#X=null,this.#J=!1,this.#G(),q.index<this.#$.length-1&&(this.#q.segmentIndex=q.index+1,this.#q.positionInSegment=0,this.#J=!0);return}this.#J&&!Y&&(this.#Q[J.type]="_".repeat(J.len),this.#q.positionInSegment=0),this.#J=!1,this.#X=null;let V=this.#Q[J.type],X=V.indexOf("_"),K=X>=0?X:Math.min(this.#q.positionInSegment,J.len-1);if(K<0||K>=J.len)return;let W=V.slice(0,K)+Q+V.slice(K+1),G=!1;if(K===0&&V==="__"&&(J.type==="month"||J.type==="day")){let Z=Number.parseInt(Q,10);W=`0${Q}`,G=Z<=(J.type==="month"?1:2)}if(J.type==="year"&&(W=(V.replace(/_/g,"")+Q).padStart(J.len,"_")),!W.includes("_")){let Z={...this.#Q,[J.type]:W},H=this.#z(Z,J);if(H){this.inlineError=H;return}}this.inlineError="",this.#Q[J.type]=W;let U=W.includes("_")?void 0:M7(this.#Q);if(U){let{year:Z,month:H}=U,F=W5(Z,H);this.#Q={year:String(Math.max(0,Math.min(9999,Z))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,H))).padStart(2,"0"),day:String(Math.max(1,Math.min(F,U.day))).padStart(2,"0")}}this.#G();let z=W.indexOf("_");G?(this.#J=!0,this.#X=Q):z>=0?this.#q.positionInSegment=z:X>=0&&q.index<this.#$.length-1?(this.#q.segmentIndex=q.index+1,this.#q.positionInSegment=0,this.#J=!0):this.#q.positionInSegment=Math.min(K+1,J.len-1)}}#z(Q,$){let{month:q,day:J}=g8(Q);if($.type==="month"&&(q<0||q>12))return r.date.messages.invalidMonth;if($.type==="day"&&(J<0||J>31))return r.date.messages.invalidDay(31,"any month")}#L(Q){let{year:$,month:q,day:J}=g8(this.#Q);if($&&q&&J){let Y=W5($,q);this.#Q={...this.#Q,day:String(Math.min(J,Y)).padStart(2,"0")}}this.value=O7(this.#Q)??Q.defaultValue??void 0}};I7=class I7 extends g1{options;cursor=0;#$;getGroupItems(Q){return this.options.filter(($)=>$.group===Q)}isGroupSelected(Q){let $=this.getGroupItems(Q),q=this.value;return q===void 0?!1:$.every((J)=>q.includes(J.value))}toggleValue(){let Q=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),Q.group===!0){let $=Q.value,q=this.getGroupItems($);this.isGroupSelected($)?this.value=this.value.filter((J)=>q.findIndex((Y)=>Y.value===J)===-1):this.value=[...this.value,...q.map((J)=>J.value)],this.value=Array.from(new Set(this.value))}else{let $=this.value.includes(Q.value);this.value=$?this.value.filter((q)=>q!==Q.value):[...this.value,Q.value]}}constructor(Q){super(Q,!1);let{options:$}=Q;this.#$=Q.selectableGroups!==!1,this.options=Object.entries($).flatMap(([q,J])=>[{value:q,group:!0,label:q},...J.map((Y)=>({...Y,group:q}))]),this.value=[...Q.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:q})=>q===Q.cursorAt),this.#$?0:1),this.on("cursor",(q)=>{switch(q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let J=this.options[this.cursor]?.group===!0;!this.#$&&J&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let J=this.options[this.cursor]?.group===!0;!this.#$&&J&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}};C7=class C7 extends g1{#$=!1;#Y;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;let Q=this.userInput;if(this.cursor>=Q.length)return`${Q}█`;let $=Q.slice(0,this.cursor),q=Q[this.cursor],J=Q.slice(this.cursor+1);return q===`
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`),this.
|
|
20
|
-
|
|
21
|
-
`),this._cursor++,!1)}constructor(Q){super(Q,!1),this.#Y=Q.showSubmit??!1,this.on("key",($,q)=>{if(q?.name&&r.actions.has(q.name)){this.#V(q.name);return}if($==="\t"&&this.#Y){this.focused=this.focused==="editor"?"submit":"editor";return}if(q?.name!=="return"){if(this.#$=!1,q?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(q?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}$&&(this.#Y&&this.focused==="submit"&&(this.focused="editor"),this.#Q($??""),this._cursor++)}}),this.on("userInput",($)=>{this._setValue($)}),this.on("finalize",()=>{this.value||(this.value=Q.defaultValue),this.value===void 0&&(this.value="")})}};T7=class extends g1{options;cursor=0;get _value(){return this.options[this.cursor].value}get _enabledOptions(){return this.options.filter((Q)=>Q.disabled!==!0)}toggleAll(){let Q=this._enabledOptions,$=this.value!==void 0&&this.value.length===Q.length;this.value=$?[]:Q.map((q)=>q.value)}toggleInvert(){let Q=this.value;if(!Q)return;let $=this._enabledOptions.filter((q)=>!Q.includes(q.value));this.value=$.map((q)=>q.value)}toggleValue(){this.value===void 0&&(this.value=[]);let Q=this.value.includes(this._value);this.value=Q?this.value.filter(($)=>$!==this._value):[...this.value,this._value]}constructor(Q){super(Q,!1),this.options=Q.options,this.value=[...Q.initialValues??[]];let $=Math.max(this.options.findIndex(({value:q})=>q===Q.cursorAt),0);this.cursor=this.options[$].disabled?Y1($,1,this.options):$,this.on("key",(q)=>{q==="a"&&this.toggleAll(),q==="i"&&this.toggleInvert()}),this.on("cursor",(q)=>{switch(q){case"left":case"up":this.cursor=Y1(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=Y1(this.cursor,1,this.options);break;case"space":this.toggleValue();break}})}};H5=class H5 extends g1{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor(Q){super(Q,!1),this.options=Q.options;let $=this.options.findIndex(({value:J})=>J===Q.initialValue),q=$===-1?0:$;this.cursor=this.options[q].disabled?Y1(q,1,this.options):q,this.changeValue(),this.on("cursor",(J)=>{switch(J){case"left":case"up":this.cursor=Y1(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=Y1(this.cursor,1,this.options);break}this.changeValue()})}}});import{styleText as I,stripVTControlCharacters as DL}from"node:util";import w0 from"node:process";function CV(){return w0.platform!=="win32"?w0.env.TERM!=="linux":!!w0.env.CI||!!w0.env.WT_SESSION||!!w0.env.TERMINUS_SUBLIME||w0.env.ConEmuTask==="{cmd::Cmder}"||w0.env.TERM_PROGRAM==="Terminus-Sublime"||w0.env.TERM_PROGRAM==="vscode"||w0.env.TERM==="xterm-256color"||w0.env.TERM==="alacritty"||w0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var k6,L5,TV=()=>process.env.CI==="true",_=(Q,$)=>L5?Q:$,AV,R7,x7,f8,DV,y,s1,vL,EL,O5,b8,wV,A7,D7,SL,w7,RV,xV,vV,EV,kL,SV,kV,yV,gV,B5=(Q)=>{switch(Q){case"initial":case"active":return I("cyan",AV);case"cancel":return I("red",R7);case"error":return I("yellow",x7);case"submit":return I("green",f8)}},v7=(Q)=>{switch(Q){case"initial":case"active":return I("cyan",y);case"cancel":return I("red",y);case"error":return I("yellow",y);case"submit":return I("green",y)}},_V=(Q,$,q,J,Y)=>{let V=$,X=0;for(let K=q;K<J;K++){let W=Q[K];if(V=V-W.length,X++,V<=Y)break}return{lineCount:V,removals:X}},N5=({cursor:Q,options:$,style:q,output:J=process.stdout,maxItems:Y=Number.POSITIVE_INFINITY,columnPadding:V=0,rowPadding:X=4})=>{let K=E6(J)-V,W=Z5(J),G=I("dim","..."),U=Math.max(W-X,0),z=Math.max(Math.min(Y,U),5),Z=0;Q>=z-3&&(Z=Math.max(Math.min(Q-z+3,$.length-z),0));let H=z<$.length&&Z>0,F=z<$.length&&Z+z<$.length,N=Math.min(Z+z,$.length),C=[],P=0;H&&P++,F&&P++;let L=Z+(H?1:0),A=N-(F?1:0);for(let O=L;O<A;O++){let M=d0(q($[O],O===Q),K,{hard:!0,trim:!1}).split(`
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
${
|
|
27
|
-
|
|
28
|
-
${U}
|
|
29
|
-
`}}}}).prompt()},i,d=(Q="",$)=>{let q=$?.output??process.stdout,J=$?.withGuide??r.withGuide?`${I("gray",s1)} `:"";q.write(`${J}${I("red",Q)}
|
|
30
|
-
|
|
31
|
-
`)},B0=(Q="",$)=>{let q=$?.output??process.stdout,J=$?.withGuide??r.withGuide?`${I("gray",DV)} `:"";q.write(`${J}${Q}
|
|
32
|
-
`)},R0=(Q="",$)=>{let q=$?.output??process.stdout,J=$?.withGuide??r.withGuide?`${I("gray",y)}
|
|
33
|
-
${I("gray",s1)} `:"";q.write(`${J}${Q}
|
|
34
|
-
|
|
35
|
-
`)},S6=(Q,$)=>Q.split(`
|
|
36
|
-
`).map((q)=>$(q)).join(`
|
|
37
|
-
`),E7=(Q)=>{let $=(J,Y)=>{let V=J.label??String(J.value);return Y==="disabled"?`${I("gray",D7)} ${S6(V,(X)=>I(["strikethrough","gray"],X))}${J.hint?` ${I("dim",`(${J.hint??"disabled"})`)}`:""}`:Y==="active"?`${I("cyan",wV)} ${V}${J.hint?` ${I("dim",`(${J.hint})`)}`:""}`:Y==="selected"?`${I("green",A7)} ${S6(V,(X)=>I("dim",X))}${J.hint?` ${I("dim",`(${J.hint})`)}`:""}`:Y==="cancelled"?`${S6(V,(X)=>I(["strikethrough","dim"],X))}`:Y==="active-selected"?`${I("green",A7)} ${V}${J.hint?` ${I("dim",`(${J.hint})`)}`:""}`:Y==="submitted"?`${S6(V,(X)=>I("dim",X))}`:`${I("dim",D7)} ${S6(V,(X)=>I("dim",X))}`},q=Q.required??!0;return new T7({options:Q.options,signal:Q.signal,input:Q.input,output:Q.output,initialValues:Q.initialValues,required:q,cursorAt:Q.cursorAt,validate(J){if(q&&(J===void 0||J.length===0))return`Please select at least one option.
|
|
38
|
-
${I("reset",I("dim",`Press ${I(["gray","bgWhite","inverse"]," space ")} to select, ${I("gray",I("bgWhite",I("inverse"," enter ")))} to submit`))}`},render(){let J=Q.withGuide??r.withGuide,Y=O1(Q.output,Q.message,J?`${v7(this.state)} `:"",`${B5(this.state)} `),V=`${J?`${I("gray",y)}
|
|
39
|
-
`:""}${Y}
|
|
40
|
-
`,X=this.value??[],K=(W,G)=>{if(W.disabled)return $(W,"disabled");let U=X.includes(W.value);return G&&U?$(W,"active-selected"):U?$(W,"selected"):$(W,G?"active":"inactive")};switch(this.state){case"submit":{let W=this.options.filter(({value:U})=>X.includes(U)).map((U)=>$(U,"submitted")).join(I("dim",", "))||I("dim","none"),G=O1(Q.output,W,J?`${I("gray",y)} `:"");return`${V}${G}`}case"cancel":{let W=this.options.filter(({value:U})=>X.includes(U)).map((U)=>$(U,"cancelled")).join(I("dim",", "));if(W.trim()==="")return`${V}${I("gray",y)}`;let G=O1(Q.output,W,J?`${I("gray",y)} `:"");return`${V}${G}${J?`
|
|
41
|
-
${I("gray",y)}`:""}`}case"error":{let W=J?`${I("yellow",y)} `:"",G=this.error.split(`
|
|
42
|
-
`).map((Z,H)=>H===0?`${J?`${I("yellow",s1)} `:""}${I("yellow",Z)}`:` ${Z}`).join(`
|
|
43
|
-
`),U=V.split(`
|
|
44
|
-
`).length,z=G.split(`
|
|
45
|
-
`).length+1;return`${V}${W}${N5({output:Q.output,options:this.options,cursor:this.cursor,maxItems:Q.maxItems,columnPadding:W.length,rowPadding:U+z,style:K}).join(`
|
|
46
|
-
${W}`)}
|
|
47
|
-
${G}
|
|
48
|
-
`}default:{let W=J?`${I("cyan",y)} `:"",G=V.split(`
|
|
49
|
-
`).length,U=J?2:1;return`${V}${W}${N5({output:Q.output,options:this.options,cursor:this.cursor,maxItems:Q.maxItems,columnPadding:W.length,rowPadding:G+U,style:K}).join(`
|
|
50
|
-
${W}`)}
|
|
51
|
-
${J?I("cyan",s1):""}
|
|
52
|
-
`}}}}).prompt()},bV=(Q)=>I("dim",Q),fV=(Q,$,q)=>{let J={hard:!0,trim:!1},Y=d0(Q,$,J).split(`
|
|
53
|
-
`),V=Y.reduce((W,G)=>Math.max(W0(G),W),0),X=Y.map(q).reduce((W,G)=>Math.max(W0(G),W),0),K=$-(X-V);return d0(Q,K,J)},b0=(Q="",$="",q)=>{let J=q?.output??w0.stdout,Y=q?.withGuide??r.withGuide,V=q?.format??bV,X=["",...fV(Q,E6(J)-6,V).split(`
|
|
54
|
-
`).map(V),""],K=W0($),W=Math.max(X.reduce((Z,H)=>{let F=W0(H);return F>Z?F:Z},0),K)+2,G=X.map((Z)=>`${I("gray",y)} ${Z}${" ".repeat(W-W0(Z))}${I("gray",y)}`).join(`
|
|
55
|
-
`),U=Y?`${I("gray",y)}
|
|
56
|
-
`:"",z=Y?xV:EV;J.write(`${U}${I("green",f8)} ${I("reset",$)} ${I("gray",w7.repeat(Math.max(W-K-1,1))+RV)}
|
|
57
|
-
${G}
|
|
58
|
-
${I("gray",z+w7.repeat(W+2)+vV)}
|
|
59
|
-
`)},hV=(Q)=>I("magenta",Q),U0=({indicator:Q="dots",onCancel:$,output:q=process.stdout,cancelMessage:J,errorMessage:Y,frames:V=L5?["◒","◐","◓","◑"]:["•","o","O","0"],delay:X=L5?80:120,signal:K,...W}={})=>{let G=TV(),U,z,Z=!1,H=!1,F="",N,C=performance.now(),P=E6(q),L=W?.styleFrame??hV,A=(b)=>{let G0=b>1?Y??r.messages.error:J??r.messages.cancel;H=b===1,Z&&(A0(G0,b),H&&typeof $=="function"&&$())},B=()=>A(2),O=()=>A(1),M=()=>{process.on("uncaughtExceptionMonitor",B),process.on("unhandledRejection",B),process.on("SIGINT",O),process.on("SIGTERM",O),process.on("exit",A),K&&K.addEventListener("abort",O)},T=()=>{process.removeListener("uncaughtExceptionMonitor",B),process.removeListener("unhandledRejection",B),process.removeListener("SIGINT",O),process.removeListener("SIGTERM",O),process.removeListener("exit",A),K&&K.removeEventListener("abort",O)},D=()=>{if(N===void 0)return;G&&q.write(`
|
|
60
|
-
`);let b=d0(N,P,{hard:!0,trim:!1}).split(`
|
|
61
|
-
`);b.length>1&&q.write(k6.cursor.up(b.length-1)),q.write(k6.cursor.to(0)),q.write(k6.erase.down())},x=(b)=>b.replace(/\.+$/,""),v=(b)=>{let G0=(performance.now()-b)/1000,D0=Math.floor(G0/60),z0=Math.floor(G0%60);return D0>0?`[${D0}m ${z0}s]`:`[${z0}s]`},R=W.withGuide??r.withGuide,$0=(b="")=>{Z=!0,U=B7({output:q}),F=x(b),C=performance.now(),R&&q.write(`${I("gray",y)}
|
|
62
|
-
`);let G0=0,D0=0;M(),z=setInterval(()=>{if(G&&F===N)return;D(),N=F;let z0=L(V[G0]),J1;if(G)J1=`${z0} ${F}...`;else if(Q==="timer")J1=`${z0} ${F} ${v(C)}`;else{let h3=".".repeat(Math.floor(D0)).slice(0,3);J1=`${z0} ${F}${h3}`}let f3=d0(J1,P,{hard:!0,trim:!1});q.write(f3),G0=G0+1<V.length?G0+1:0,D0=D0<4?D0+0.125:0},X)},A0=(b="",G0=0,D0=!1)=>{if(!Z)return;Z=!1,clearInterval(z),D();let z0=G0===0?I("green",f8):G0===1?I("red",R7):I("red",x7);F=b??F,D0||(Q==="timer"?q.write(`${z0} ${F} ${v(C)}
|
|
63
|
-
`):q.write(`${z0} ${F}
|
|
64
|
-
`)),T(),U()};return{start:$0,stop:(b="")=>A0(b,0),message:(b="")=>{F=x(b??F)},cancel:(b="")=>A0(b,1),error:(b="")=>A0(b,2),clear:()=>A0("",0,!0),get isCancelled(){return H}}},yL,_8=(Q,$)=>Q.includes(`
|
|
65
|
-
`)?Q.split(`
|
|
66
|
-
`).map((q)=>$(q)).join(`
|
|
67
|
-
`):$(Q),M5=(Q)=>{let $=(q,J)=>{let Y=q.label??String(q.value);switch(J){case"disabled":return`${I("gray",b8)} ${_8(Y,(V)=>I("gray",V))}${q.hint?` ${I("dim",`(${q.hint??"disabled"})`)}`:""}`;case"selected":return`${_8(Y,(V)=>I("dim",V))}`;case"active":return`${I("green",O5)} ${Y}${q.hint?` ${I("dim",`(${q.hint})`)}`:""}`;case"cancelled":return`${_8(Y,(V)=>I(["strikethrough","dim"],V))}`;default:return`${I("dim",b8)} ${_8(Y,(V)=>I("dim",V))}`}};return new H5({options:Q.options,signal:Q.signal,input:Q.input,output:Q.output,initialValue:Q.initialValue,render(){let q=Q.withGuide??r.withGuide,J=`${B5(this.state)} `,Y=`${v7(this.state)} `,V=O1(Q.output,Q.message,Y,J),X=`${q?`${I("gray",y)}
|
|
2
|
+
import{createRequire as zq}from"node:module";var Kq=Object.create;var{getPrototypeOf:Xq,defineProperty:_6,getOwnPropertyNames:Wq}=Object;var Uq=Object.prototype.hasOwnProperty;function jq($){return this[$]}var Hq,Fq,R$=($,Q,J)=>{var q=$!=null&&typeof $==="object";if(q){var Y=Q?Hq??=new WeakMap:Fq??=new WeakMap,G=Y.get($);if(G)return G}J=$!=null?Kq(Xq($)):{};let V=Q||!$||!$.__esModule?_6(J,"default",{value:$,enumerable:!0}):J;for(let K of Wq($))if(!Uq.call(V,K))_6(V,K,{get:jq.bind($,K),enumerable:!0});if(q)Y.set($,V);return V};var C=($,Q)=>()=>(Q||$((Q={exports:{}}).exports,Q),Q.exports);var Pq=($)=>$;function Zq($,Q){this[$]=Pq.bind(null,Q)}var JQ=($,Q)=>{for(var J in Q)_6($,J,{get:Q[J],enumerable:!0,configurable:!0,set:Zq.bind(Q,J)})};var qQ=($,Q)=>()=>($&&(Q=$($=0)),Q);var Y0=zq(import.meta.url);var d6=C((oj,MQ)=>{var u6={to($,Q){if(!Q)return`\x1B[${$+1}G`;return`\x1B[${Q+1};${$+1}H`},move($,Q){let J="";if($<0)J+=`\x1B[${-$}D`;else if($>0)J+=`\x1B[${$}C`;if(Q<0)J+=`\x1B[${-Q}A`;else if(Q>0)J+=`\x1B[${Q}B`;return J},up:($=1)=>`\x1B[${$}A`,down:($=1)=>`\x1B[${$}B`,forward:($=1)=>`\x1B[${$}C`,backward:($=1)=>`\x1B[${$}D`,nextLine:($=1)=>"\x1B[E".repeat($),prevLine:($=1)=>"\x1B[F".repeat($),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},Eq={up:($=1)=>"\x1B[S".repeat($),down:($=1)=>"\x1B[T".repeat($)},xq={screen:"\x1B[2J",up:($=1)=>"\x1B[1J".repeat($),down:($=1)=>"\x1B[J".repeat($),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines($){let Q="";for(let J=0;J<$;J++)Q+=this.line+(J<$-1?u6.up():"");if($)Q+=u6.left;return Q}};MQ.exports={cursor:u6,scroll:Eq,erase:xq,beep:"\x07"}});var l1=C((wH,q8)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)q8.exports={nextTick:VY};else q8.exports=process;function VY($,Q,J,q){if(typeof $!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,G,V;switch(Y){case 0:case 1:return process.nextTick($);case 2:return process.nextTick(function(){$.call(null,Q)});case 3:return process.nextTick(function(){$.call(null,Q,J)});case 4:return process.nextTick(function(){$.call(null,Q,J,q)});default:G=Array(Y-1),V=0;while(V<G.length)G[V++]=arguments[V];return process.nextTick(function(){$.apply(null,G)})}}});var hQ=C((vH,yQ)=>{var KY={}.toString;yQ.exports=Array.isArray||function($){return KY.call($)=="[object Array]"}});var o1=C((Y8,fQ)=>{var b$=Y0("buffer"),x0=b$.Buffer;function bQ($,Q){for(var J in $)Q[J]=$[J]}if(x0.from&&x0.alloc&&x0.allocUnsafe&&x0.allocUnsafeSlow)fQ.exports=b$;else bQ(b$,Y8),Y8.Buffer=F1;function F1($,Q,J){return x0($,Q,J)}bQ(x0,F1);F1.from=function($,Q,J){if(typeof $==="number")throw TypeError("Argument must not be a number");return x0($,Q,J)};F1.alloc=function($,Q,J){if(typeof $!=="number")throw TypeError("Argument must be a number");var q=x0($);if(Q!==void 0)if(typeof J==="string")q.fill(Q,J);else q.fill(Q);else q.fill(0);return q};F1.allocUnsafe=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return x0($)};F1.allocUnsafeSlow=function($){if(typeof $!=="number")throw TypeError("Argument must be a number");return b$.SlowBuffer($)}});var P1=C((BY)=>{function XY($){if(Array.isArray)return Array.isArray($);return f$($)==="[object Array]"}BY.isArray=XY;function WY($){return typeof $==="boolean"}BY.isBoolean=WY;function UY($){return $===null}BY.isNull=UY;function jY($){return $==null}BY.isNullOrUndefined=jY;function HY($){return typeof $==="number"}BY.isNumber=HY;function FY($){return typeof $==="string"}BY.isString=FY;function PY($){return typeof $==="symbol"}BY.isSymbol=PY;function ZY($){return $===void 0}BY.isUndefined=ZY;function zY($){return f$($)==="[object RegExp]"}BY.isRegExp=zY;function LY($){return typeof $==="object"&&$!==null}BY.isObject=LY;function MY($){return f$($)==="[object Date]"}BY.isDate=MY;function IY($){return f$($)==="[object Error]"||$ instanceof Error}BY.isError=IY;function OY($){return typeof $==="function"}BY.isFunction=OY;function NY($){return $===null||typeof $==="boolean"||typeof $==="number"||typeof $==="string"||typeof $==="symbol"||typeof $>"u"}BY.isPrimitive=NY;BY.isBuffer=Y0("buffer").Buffer.isBuffer;function f$($){return Object.prototype.toString.call($)}});var _Q=C((AH,G8)=>{if(typeof Object.create==="function")G8.exports=function(Q,J){if(J)Q.super_=J,Q.prototype=Object.create(J.prototype,{constructor:{value:Q,enumerable:!1,writable:!0,configurable:!0}})};else G8.exports=function(Q,J){if(J){Q.super_=J;var q=function(){};q.prototype=J.prototype,Q.prototype=new q,Q.prototype.constructor=Q}}});var Z1=C((RH,V8)=>{try{if(_$=Y0("util"),typeof _$.inherits!=="function")throw"";V8.exports=_$.inherits}catch($){V8.exports=_Q()}var _$});var cQ=C((kH,K8)=>{function fY($,Q){if(!($ instanceof Q))throw TypeError("Cannot call a class as a function")}var mQ=o1().Buffer,i1=Y0("util");function _Y($,Q,J){$.copy(Q,J)}K8.exports=function(){function $(){fY(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(J){var q={data:J,next:null};if(this.length>0)this.tail.next=q;else this.head=q;this.tail=q,++this.length},$.prototype.unshift=function(J){var q={data:J,next:this.head};if(this.length===0)this.tail=q;this.head=q,++this.length},$.prototype.shift=function(){if(this.length===0)return;var J=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,J},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(J){if(this.length===0)return"";var q=this.head,Y=""+q.data;while(q=q.next)Y+=J+q.data;return Y},$.prototype.concat=function(J){if(this.length===0)return mQ.alloc(0);var q=mQ.allocUnsafe(J>>>0),Y=this.head,G=0;while(Y)_Y(Y.data,q,G),G+=Y.data.length,Y=Y.next;return q},$}();if(i1&&i1.inspect&&i1.inspect.custom)K8.exports.prototype[i1.inspect.custom]=function(){var $=i1.inspect({length:this.length});return this.constructor.name+" "+$}});var X8=C((EH,pQ)=>{var m$=l1();function mY($,Q){var J=this,q=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(q||Y){if(Q)Q($);else if($){if(!this._writableState)m$.nextTick(c$,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,m$.nextTick(c$,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(G){if(!Q&&G){if(!J._writableState)m$.nextTick(c$,J,G);else if(!J._writableState.errorEmitted)J._writableState.errorEmitted=!0,m$.nextTick(c$,J,G)}else if(Q)Q(G)}),this}function cY(){if(this._readableState)this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1;if(this._writableState)this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1}function c$($,Q){$.emit("error",Q)}pQ.exports={destroy:mY,undestroy:cY}});var dQ=C((xH,uQ)=>{uQ.exports=Y0("util").deprecate});var U8=C((SH,tQ)=>{var t0=l1();tQ.exports=u;function oQ($){var Q=this;this.next=null,this.entry=null,this.finish=function(){G3(Q,$)}}var pY=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:t0.nextTick,z1;u.WritableState=r1;var iQ=Object.create(P1());iQ.inherits=Z1();var uY={deprecate:dQ()},nQ=Y0("stream"),u$=o1().Buffer,dY=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function lY($){return u$.from($)}function oY($){return u$.isBuffer($)||$ instanceof dY}var rQ=X8();iQ.inherits(u,nQ);function iY(){}function r1($,Q){z1=z1||e0(),$=$||{};var J=Q instanceof z1;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.writableObjectMode;var{highWaterMark:q,writableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var V=$.decodeStrings===!1;this.decodeStrings=!V,this.defaultEncoding=$.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(K){$3(Q,K)},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 oQ(this)}r1.prototype.getBuffer=function(){var Q=this.bufferedRequest,J=[];while(Q)J.push(Q),Q=Q.next;return J};(function(){try{Object.defineProperty(r1.prototype,"buffer",{get:uY.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch($){}})();var p$;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")p$=Function.prototype[Symbol.hasInstance],Object.defineProperty(u,Symbol.hasInstance,{value:function($){if(p$.call(this,$))return!0;if(this!==u)return!1;return $&&$._writableState instanceof r1}});else p$=function($){return $ instanceof this};function u($){if(z1=z1||e0(),!p$.call(u,this)&&!(this instanceof z1))return new u($);if(this._writableState=new r1($,this),this.writable=!0,$){if(typeof $.write==="function")this._write=$.write;if(typeof $.writev==="function")this._writev=$.writev;if(typeof $.destroy==="function")this._destroy=$.destroy;if(typeof $.final==="function")this._final=$.final}nQ.call(this)}u.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function nY($,Q){var J=Error("write after end");$.emit("error",J),t0.nextTick(Q,J)}function rY($,Q,J,q){var Y=!0,G=!1;if(J===null)G=TypeError("May not write null values to stream");else if(typeof J!=="string"&&J!==void 0&&!Q.objectMode)G=TypeError("Invalid non-string/buffer chunk");if(G)$.emit("error",G),t0.nextTick(q,G),Y=!1;return Y}u.prototype.write=function($,Q,J){var q=this._writableState,Y=!1,G=!q.objectMode&&oY($);if(G&&!u$.isBuffer($))$=lY($);if(typeof Q==="function")J=Q,Q=null;if(G)Q="buffer";else if(!Q)Q=q.defaultEncoding;if(typeof J!=="function")J=iY;if(q.ended)nY(this,J);else if(G||rY(this,q,$,J))q.pendingcb++,Y=sY(this,q,G,$,Q,J);return Y};u.prototype.cork=function(){var $=this._writableState;$.corked++};u.prototype.uncork=function(){var $=this._writableState;if($.corked){if($.corked--,!$.writing&&!$.corked&&!$.bufferProcessing&&$.bufferedRequest)aQ(this,$)}};u.prototype.setDefaultEncoding=function(Q){if(typeof Q==="string")Q=Q.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Q+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+Q);return this._writableState.defaultEncoding=Q,this};function aY($,Q,J){if(!$.objectMode&&$.decodeStrings!==!1&&typeof Q==="string")Q=u$.from(Q,J);return Q}Object.defineProperty(u.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function sY($,Q,J,q,Y,G){if(!J){var V=aY(Q,q,Y);if(q!==V)J=!0,Y="buffer",q=V}var K=Q.objectMode?1:q.length;Q.length+=K;var U=Q.length<Q.highWaterMark;if(!U)Q.needDrain=!0;if(Q.writing||Q.corked){var X=Q.lastBufferedRequest;if(Q.lastBufferedRequest={chunk:q,encoding:Y,isBuf:J,callback:G,next:null},X)X.next=Q.lastBufferedRequest;else Q.bufferedRequest=Q.lastBufferedRequest;Q.bufferedRequestCount+=1}else W8($,Q,!1,K,q,Y,G);return U}function W8($,Q,J,q,Y,G,V){if(Q.writelen=q,Q.writecb=V,Q.writing=!0,Q.sync=!0,J)$._writev(Y,Q.onwrite);else $._write(Y,G,Q.onwrite);Q.sync=!1}function tY($,Q,J,q,Y){if(--Q.pendingcb,J)t0.nextTick(Y,q),t0.nextTick(n1,$,Q),$._writableState.errorEmitted=!0,$.emit("error",q);else Y(q),$._writableState.errorEmitted=!0,$.emit("error",q),n1($,Q)}function eY($){$.writing=!1,$.writecb=null,$.length-=$.writelen,$.writelen=0}function $3($,Q){var J=$._writableState,q=J.sync,Y=J.writecb;if(eY(J),Q)tY($,J,q,Q,Y);else{var G=sQ(J);if(!G&&!J.corked&&!J.bufferProcessing&&J.bufferedRequest)aQ($,J);if(q)pY(lQ,$,J,G,Y);else lQ($,J,G,Y)}}function lQ($,Q,J,q){if(!J)Q3($,Q);Q.pendingcb--,q(),n1($,Q)}function Q3($,Q){if(Q.length===0&&Q.needDrain)Q.needDrain=!1,$.emit("drain")}function aQ($,Q){Q.bufferProcessing=!0;var J=Q.bufferedRequest;if($._writev&&J&&J.next){var q=Q.bufferedRequestCount,Y=Array(q),G=Q.corkedRequestsFree;G.entry=J;var V=0,K=!0;while(J){if(Y[V]=J,!J.isBuf)K=!1;J=J.next,V+=1}if(Y.allBuffers=K,W8($,Q,!0,Q.length,Y,"",G.finish),Q.pendingcb++,Q.lastBufferedRequest=null,G.next)Q.corkedRequestsFree=G.next,G.next=null;else Q.corkedRequestsFree=new oQ(Q);Q.bufferedRequestCount=0}else{while(J){var{chunk:U,encoding:X,callback:W}=J,H=Q.objectMode?1:U.length;if(W8($,Q,!1,H,U,X,W),J=J.next,Q.bufferedRequestCount--,Q.writing)break}if(J===null)Q.lastBufferedRequest=null}Q.bufferedRequest=J,Q.bufferProcessing=!1}u.prototype._write=function($,Q,J){J(Error("_write() is not implemented"))};u.prototype._writev=null;u.prototype.end=function($,Q,J){var q=this._writableState;if(typeof $==="function")J=$,$=null,Q=null;else if(typeof Q==="function")J=Q,Q=null;if($!==null&&$!==void 0)this.write($,Q);if(q.corked)q.corked=1,this.uncork();if(!q.ending)Y3(this,q,J)};function sQ($){return $.ending&&$.length===0&&$.bufferedRequest===null&&!$.finished&&!$.writing}function J3($,Q){$._final(function(J){if(Q.pendingcb--,J)$.emit("error",J);Q.prefinished=!0,$.emit("prefinish"),n1($,Q)})}function q3($,Q){if(!Q.prefinished&&!Q.finalCalled)if(typeof $._final==="function")Q.pendingcb++,Q.finalCalled=!0,t0.nextTick(J3,$,Q);else Q.prefinished=!0,$.emit("prefinish")}function n1($,Q){var J=sQ(Q);if(J){if(q3($,Q),Q.pendingcb===0)Q.finished=!0,$.emit("finish")}return J}function Y3($,Q,J){if(Q.ending=!0,n1($,Q),J)if(Q.finished)t0.nextTick(J);else $.once("finish",J);Q.ended=!0,$.writable=!1}function G3($,Q,J){var q=$.entry;$.entry=null;while(q){var Y=q.callback;Q.pendingcb--,Y(J),q=q.next}Q.corkedRequestsFree.next=$}Object.defineProperty(u.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function($){if(!this._writableState)return;this._writableState.destroyed=$}});u.prototype.destroy=rQ.destroy;u.prototype._undestroy=rQ.undestroy;u.prototype._destroy=function($,Q){this.end(),Q($)}});var e0=C((gH,J9)=>{var eQ=l1(),V3=Object.keys||function($){var Q=[];for(var J in $)Q.push(J);return Q};J9.exports=S0;var $9=Object.create(P1());$9.inherits=Z1();var Q9=H8(),j8=U8();$9.inherits(S0,Q9);{d$=V3(j8.prototype);for(a1=0;a1<d$.length;a1++)if(s1=d$[a1],!S0.prototype[s1])S0.prototype[s1]=j8.prototype[s1]}var d$,s1,a1;function S0($){if(!(this instanceof S0))return new S0($);if(Q9.call(this,$),j8.call(this,$),$&&$.readable===!1)this.readable=!1;if($&&$.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,$&&$.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",K3)}Object.defineProperty(S0.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function K3(){if(this.allowHalfOpen||this._writableState.ended)return;eQ.nextTick(X3,this)}function X3($){$.end()}Object.defineProperty(S0.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function($){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=$,this._writableState.destroyed=$}});S0.prototype._destroy=function($,Q){this.push(null),this.end(),eQ.nextTick(Q,$)}});var Z8=C((B3)=>{var P8=o1().Buffer,q9=P8.isEncoding||function($){switch($=""+$,$&&$.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function W3($){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 U3($){var Q=W3($);if(typeof Q!=="string"&&(P8.isEncoding===q9||!q9($)))throw Error("Unknown encoding: "+$);return Q||$}B3.StringDecoder=t1;function t1($){this.encoding=U3($);var Q;switch(this.encoding){case"utf16le":this.text=z3,this.end=L3,Q=4;break;case"utf8":this.fillLast=F3,Q=4;break;case"base64":this.text=M3,this.end=I3,Q=3;break;default:this.write=O3,this.end=N3;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=P8.allocUnsafe(Q)}t1.prototype.write=function($){if($.length===0)return"";var Q,J;if(this.lastNeed){if(Q=this.fillLast($),Q===void 0)return"";J=this.lastNeed,this.lastNeed=0}else J=0;if(J<$.length)return Q?Q+this.text($,J):this.text($,J);return Q||""};t1.prototype.end=Z3;t1.prototype.text=P3;t1.prototype.fillLast=function($){if(this.lastNeed<=$.length)return $.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,this.lastTotal-this.lastNeed,0,$.length),this.lastNeed-=$.length};function F8($){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 j3($,Q,J){var q=Q.length-1;if(q<J)return 0;var Y=F8(Q[q]);if(Y>=0){if(Y>0)$.lastNeed=Y-1;return Y}if(--q<J||Y===-2)return 0;if(Y=F8(Q[q]),Y>=0){if(Y>0)$.lastNeed=Y-2;return Y}if(--q<J||Y===-2)return 0;if(Y=F8(Q[q]),Y>=0){if(Y>0)if(Y===2)Y=0;else $.lastNeed=Y-3;return Y}return 0}function H3($,Q,J){if((Q[0]&192)!==128)return $.lastNeed=0,"�";if($.lastNeed>1&&Q.length>1){if((Q[1]&192)!==128)return $.lastNeed=1,"�";if($.lastNeed>2&&Q.length>2){if((Q[2]&192)!==128)return $.lastNeed=2,"�"}}}function F3($){var Q=this.lastTotal-this.lastNeed,J=H3(this,$,Q);if(J!==void 0)return J;if(this.lastNeed<=$.length)return $.copy(this.lastChar,Q,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);$.copy(this.lastChar,Q,0,$.length),this.lastNeed-=$.length}function P3($,Q){var J=j3(this,$,Q);if(!this.lastNeed)return $.toString("utf8",Q);this.lastTotal=J;var q=$.length-(J-this.lastNeed);return $.copy(this.lastChar,0,q),$.toString("utf8",Q,q)}function Z3($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+"�";return Q}function z3($,Q){if(($.length-Q)%2===0){var J=$.toString("utf16le",Q);if(J){var q=J.charCodeAt(J.length-1);if(q>=55296&&q<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1],J.slice(0,-1)}return J}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=$[$.length-1],$.toString("utf16le",Q,$.length-1)}function L3($){var Q=$&&$.length?this.write($):"";if(this.lastNeed){var J=this.lastTotal-this.lastNeed;return Q+this.lastChar.toString("utf16le",0,J)}return Q}function M3($,Q){var J=($.length-Q)%3;if(J===0)return $.toString("base64",Q);if(this.lastNeed=3-J,this.lastTotal=3,J===1)this.lastChar[0]=$[$.length-1];else this.lastChar[0]=$[$.length-2],this.lastChar[1]=$[$.length-1];return $.toString("base64",Q,$.length-J)}function I3($){var Q=$&&$.length?this.write($):"";if(this.lastNeed)return Q+this.lastChar.toString("base64",0,3-this.lastNeed);return Q}function O3($){return $.toString(this.encoding)}function N3($){return $&&$.length?this.write($):""}});var H8=C((hH,Z9)=>{var M1=l1();Z9.exports=f;var w3=hQ(),e1;f.ReadableState=U9;var yH=Y0("events").EventEmitter,K9=function($,Q){return $.listeners(Q).length},O8=Y0("stream"),$$=o1().Buffer,v3=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function C3($){return $$.from($)}function A3($){return $$.isBuffer($)||$ instanceof v3}var X9=Object.create(P1());X9.inherits=Z1();var z8=Y0("util"),g=void 0;if(z8&&z8.debuglog)g=z8.debuglog("stream");else g=function(){};var R3=cQ(),W9=X8(),L1;X9.inherits(f,O8);var L8=["error","close","destroy","pause","resume"];function k3($,Q,J){if(typeof $.prependListener==="function")return $.prependListener(Q,J);if(!$._events||!$._events[Q])$.on(Q,J);else if(w3($._events[Q]))$._events[Q].unshift(J);else $._events[Q]=[J,$._events[Q]]}function U9($,Q){e1=e1||e0(),$=$||{};var J=Q instanceof e1;if(this.objectMode=!!$.objectMode,J)this.objectMode=this.objectMode||!!$.readableObjectMode;var{highWaterMark:q,readableHighWaterMark:Y}=$,G=this.objectMode?16:16384;if(q||q===0)this.highWaterMark=q;else if(J&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=G;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new R3,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=$.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,$.encoding){if(!L1)L1=Z8().StringDecoder;this.decoder=new L1($.encoding),this.encoding=$.encoding}}function f($){if(e1=e1||e0(),!(this instanceof f))return new f($);if(this._readableState=new U9($,this),this.readable=!0,$){if(typeof $.read==="function")this._read=$.read;if(typeof $.destroy==="function")this._destroy=$.destroy}O8.call(this)}Object.defineProperty(f.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function($){if(!this._readableState)return;this._readableState.destroyed=$}});f.prototype.destroy=W9.destroy;f.prototype._undestroy=W9.undestroy;f.prototype._destroy=function($,Q){this.push(null),Q($)};f.prototype.push=function($,Q){var J=this._readableState,q;if(!J.objectMode){if(typeof $==="string"){if(Q=Q||J.defaultEncoding,Q!==J.encoding)$=$$.from($,Q),Q="";q=!0}}else q=!0;return j9(this,$,Q,!1,q)};f.prototype.unshift=function($){return j9(this,$,null,!0,!1)};function j9($,Q,J,q,Y){var G=$._readableState;if(Q===null)G.reading=!1,g3($,G);else{var V;if(!Y)V=E3(G,Q);if(V)$.emit("error",V);else if(G.objectMode||Q&&Q.length>0){if(typeof Q!=="string"&&!G.objectMode&&Object.getPrototypeOf(Q)!==$$.prototype)Q=C3(Q);if(q)if(G.endEmitted)$.emit("error",Error("stream.unshift() after end event"));else M8($,G,Q,!0);else if(G.ended)$.emit("error",Error("stream.push() after EOF"));else if(G.reading=!1,G.decoder&&!J)if(Q=G.decoder.write(Q),G.objectMode||Q.length!==0)M8($,G,Q,!1);else H9($,G);else M8($,G,Q,!1)}else if(!q)G.reading=!1}return x3(G)}function M8($,Q,J,q){if(Q.flowing&&Q.length===0&&!Q.sync)$.emit("data",J),$.read(0);else{if(Q.length+=Q.objectMode?1:J.length,q)Q.buffer.unshift(J);else Q.buffer.push(J);if(Q.needReadable)l$($)}H9($,Q)}function E3($,Q){var J;if(!A3(Q)&&typeof Q!=="string"&&Q!==void 0&&!$.objectMode)J=TypeError("Invalid non-string/buffer chunk");return J}function x3($){return!$.ended&&($.needReadable||$.length<$.highWaterMark||$.length===0)}f.prototype.isPaused=function(){return this._readableState.flowing===!1};f.prototype.setEncoding=function($){if(!L1)L1=Z8().StringDecoder;return this._readableState.decoder=new L1($),this._readableState.encoding=$,this};var Y9=8388608;function S3($){if($>=Y9)$=Y9;else $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++;return $}function G9($,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=S3($);if($<=Q.length)return $;if(!Q.ended)return Q.needReadable=!0,0;return Q.length}f.prototype.read=function($){g("read",$),$=parseInt($,10);var Q=this._readableState,J=$;if($!==0)Q.emittedReadable=!1;if($===0&&Q.needReadable&&(Q.length>=Q.highWaterMark||Q.ended)){if(g("read: emitReadable",Q.length,Q.ended),Q.length===0&&Q.ended)I8(this);else l$(this);return null}if($=G9($,Q),$===0&&Q.ended){if(Q.length===0)I8(this);return null}var q=Q.needReadable;if(g("need readable",q),Q.length===0||Q.length-$<Q.highWaterMark)q=!0,g("length less than watermark",q);if(Q.ended||Q.reading)q=!1,g("reading or ended",q);else if(q){if(g("do read"),Q.reading=!0,Q.sync=!0,Q.length===0)Q.needReadable=!0;if(this._read(Q.highWaterMark),Q.sync=!1,!Q.reading)$=G9(J,Q)}var Y;if($>0)Y=F9($,Q);else Y=null;if(Y===null)Q.needReadable=!0,$=0;else Q.length-=$;if(Q.length===0){if(!Q.ended)Q.needReadable=!0;if(J!==$&&Q.ended)I8(this)}if(Y!==null)this.emit("data",Y);return Y};function g3($,Q){if(Q.ended)return;if(Q.decoder){var J=Q.decoder.end();if(J&&J.length)Q.buffer.push(J),Q.length+=Q.objectMode?1:J.length}Q.ended=!0,l$($)}function l$($){var Q=$._readableState;if(Q.needReadable=!1,!Q.emittedReadable)if(g("emitReadable",Q.flowing),Q.emittedReadable=!0,Q.sync)M1.nextTick(V9,$);else V9($)}function V9($){g("emit readable"),$.emit("readable"),N8($)}function H9($,Q){if(!Q.readingMore)Q.readingMore=!0,M1.nextTick(T3,$,Q)}function T3($,Q){var J=Q.length;while(!Q.reading&&!Q.flowing&&!Q.ended&&Q.length<Q.highWaterMark)if(g("maybeReadMore read 0"),$.read(0),J===Q.length)break;else J=Q.length;Q.readingMore=!1}f.prototype._read=function($){this.emit("error",Error("_read() is not implemented"))};f.prototype.pipe=function($,Q){var J=this,q=this._readableState;switch(q.pipesCount){case 0:q.pipes=$;break;case 1:q.pipes=[q.pipes,$];break;default:q.pipes.push($);break}q.pipesCount+=1,g("pipe count=%d opts=%j",q.pipesCount,Q);var Y=(!Q||Q.end!==!1)&&$!==process.stdout&&$!==process.stderr,G=Y?K:N;if(q.endEmitted)M1.nextTick(G);else J.once("end",G);$.on("unpipe",V);function V(I,P){if(g("onunpipe"),I===J){if(P&&P.hasUnpiped===!1)P.hasUnpiped=!0,W()}}function K(){g("onend"),$.end()}var U=y3(J);$.on("drain",U);var X=!1;function W(){if(g("cleanup"),$.removeListener("close",Z),$.removeListener("finish",L),$.removeListener("drain",U),$.removeListener("error",F),$.removeListener("unpipe",V),J.removeListener("end",K),J.removeListener("end",N),J.removeListener("data",j),X=!0,q.awaitDrain&&(!$._writableState||$._writableState.needDrain))U()}var H=!1;J.on("data",j);function j(I){g("ondata"),H=!1;var P=$.write(I);if(P===!1&&!H){if((q.pipesCount===1&&q.pipes===$||q.pipesCount>1&&P9(q.pipes,$)!==-1)&&!X)g("false write response, pause",q.awaitDrain),q.awaitDrain++,H=!0;J.pause()}}function F(I){if(g("onerror",I),N(),$.removeListener("error",F),K9($,"error")===0)$.emit("error",I)}k3($,"error",F);function Z(){$.removeListener("finish",L),N()}$.once("close",Z);function L(){g("onfinish"),$.removeListener("close",Z),N()}$.once("finish",L);function N(){g("unpipe"),J.unpipe($)}if($.emit("pipe",J),!q.flowing)g("pipe resume"),J.resume();return $};function y3($){return function(){var Q=$._readableState;if(g("pipeOnDrain",Q.awaitDrain),Q.awaitDrain)Q.awaitDrain--;if(Q.awaitDrain===0&&K9($,"data"))Q.flowing=!0,N8($)}}f.prototype.unpipe=function($){var Q=this._readableState,J={hasUnpiped:!1};if(Q.pipesCount===0)return this;if(Q.pipesCount===1){if($&&$!==Q.pipes)return this;if(!$)$=Q.pipes;if(Q.pipes=null,Q.pipesCount=0,Q.flowing=!1,$)$.emit("unpipe",this,J);return this}if(!$){var{pipes:q,pipesCount:Y}=Q;Q.pipes=null,Q.pipesCount=0,Q.flowing=!1;for(var G=0;G<Y;G++)q[G].emit("unpipe",this,{hasUnpiped:!1});return this}var V=P9(Q.pipes,$);if(V===-1)return this;if(Q.pipes.splice(V,1),Q.pipesCount-=1,Q.pipesCount===1)Q.pipes=Q.pipes[0];return $.emit("unpipe",this,J),this};f.prototype.on=function($,Q){var J=O8.prototype.on.call(this,$,Q);if($==="data"){if(this._readableState.flowing!==!1)this.resume()}else if($==="readable"){var q=this._readableState;if(!q.endEmitted&&!q.readableListening){if(q.readableListening=q.needReadable=!0,q.emittedReadable=!1,!q.reading)M1.nextTick(h3,this);else if(q.length)l$(this)}}return J};f.prototype.addListener=f.prototype.on;function h3($){g("readable nexttick read 0"),$.read(0)}f.prototype.resume=function(){var $=this._readableState;if(!$.flowing)g("resume"),$.flowing=!0,b3(this,$);return this};function b3($,Q){if(!Q.resumeScheduled)Q.resumeScheduled=!0,M1.nextTick(f3,$,Q)}function f3($,Q){if(!Q.reading)g("resume read 0"),$.read(0);if(Q.resumeScheduled=!1,Q.awaitDrain=0,$.emit("resume"),N8($),Q.flowing&&!Q.reading)$.read(0)}f.prototype.pause=function(){if(g("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)g("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function N8($){var Q=$._readableState;g("flow",Q.flowing);while(Q.flowing&&$.read()!==null);}f.prototype.wrap=function($){var Q=this,J=this._readableState,q=!1;$.on("end",function(){if(g("wrapped end"),J.decoder&&!J.ended){var V=J.decoder.end();if(V&&V.length)Q.push(V)}Q.push(null)}),$.on("data",function(V){if(g("wrapped data"),J.decoder)V=J.decoder.write(V);if(J.objectMode&&(V===null||V===void 0))return;else if(!J.objectMode&&(!V||!V.length))return;var K=Q.push(V);if(!K)q=!0,$.pause()});for(var Y in $)if(this[Y]===void 0&&typeof $[Y]==="function")this[Y]=function(V){return function(){return $[V].apply($,arguments)}}(Y);for(var G=0;G<L8.length;G++)$.on(L8[G],this.emit.bind(this,L8[G]));return this._read=function(V){if(g("wrapped _read",V),q)q=!1,$.resume()},this};Object.defineProperty(f.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});f._fromList=F9;function F9($,Q){if(Q.length===0)return null;var J;if(Q.objectMode)J=Q.buffer.shift();else if(!$||$>=Q.length){if(Q.decoder)J=Q.buffer.join("");else if(Q.buffer.length===1)J=Q.buffer.head.data;else J=Q.buffer.concat(Q.length);Q.buffer.clear()}else J=_3($,Q.buffer,Q.decoder);return J}function _3($,Q,J){var q;if($<Q.head.data.length)q=Q.head.data.slice(0,$),Q.head.data=Q.head.data.slice($);else if($===Q.head.data.length)q=Q.shift();else q=J?m3($,Q):c3($,Q);return q}function m3($,Q){var J=Q.head,q=1,Y=J.data;$-=Y.length;while(J=J.next){var G=J.data,V=$>G.length?G.length:$;if(V===G.length)Y+=G;else Y+=G.slice(0,$);if($-=V,$===0){if(V===G.length)if(++q,J.next)Q.head=J.next;else Q.head=Q.tail=null;else Q.head=J,J.data=G.slice(V);break}++q}return Q.length-=q,Y}function c3($,Q){var J=$$.allocUnsafe($),q=Q.head,Y=1;q.data.copy(J),$-=q.data.length;while(q=q.next){var G=q.data,V=$>G.length?G.length:$;if(G.copy(J,J.length-$,0,V),$-=V,$===0){if(V===G.length)if(++Y,q.next)Q.head=q.next;else Q.head=Q.tail=null;else Q.head=q,q.data=G.slice(V);break}++Y}return Q.length-=Y,J}function I8($){var Q=$._readableState;if(Q.length>0)throw Error('"endReadable()" called on non-empty stream');if(!Q.endEmitted)Q.ended=!0,M1.nextTick(p3,Q,$)}function p3($,Q){if(!$.endEmitted&&$.length===0)$.endEmitted=!0,Q.readable=!1,Q.emit("end")}function P9($,Q){for(var J=0,q=$.length;J<q;J++)if($[J]===Q)return J;return-1}});var B8=C((bH,M9)=>{M9.exports=g0;var o$=e0(),L9=Object.create(P1());L9.inherits=Z1();L9.inherits(g0,o$);function u3($,Q){var J=this._transformState;J.transforming=!1;var q=J.writecb;if(!q)return this.emit("error",Error("write callback called multiple times"));if(J.writechunk=null,J.writecb=null,Q!=null)this.push(Q);q($);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function g0($){if(!(this instanceof g0))return new g0($);if(o$.call(this,$),this._transformState={afterTransform: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",d3)}function d3(){var $=this;if(typeof this._flush==="function")this._flush(function(Q,J){z9($,Q,J)});else z9(this,null,null)}g0.prototype.push=function($,Q){return this._transformState.needTransform=!1,o$.prototype.push.call(this,$,Q)};g0.prototype._transform=function($,Q,J){throw Error("_transform() is not implemented")};g0.prototype._write=function($,Q,J){var q=this._transformState;if(q.writecb=J,q.writechunk=$,q.writeencoding=Q,!q.transforming){var Y=this._readableState;if(q.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};g0.prototype._read=function($){var Q=this._transformState;if(Q.writechunk!==null&&Q.writecb&&!Q.transforming)Q.transforming=!0,this._transform(Q.writechunk,Q.writeencoding,Q.afterTransform);else Q.needTransform=!0};g0.prototype._destroy=function($,Q){var J=this;o$.prototype._destroy.call(this,$,function(q){Q(q),J.emit("close")})};function z9($,Q,J){if(Q)return $.emit("error",Q);if(J!=null)$.push(J);if($._writableState.length)throw Error("Calling transform done when ws.length != 0");if($._transformState.transforming)throw Error("Calling transform done when still transforming");return $.push(null)}});var B9=C((fH,N9)=>{N9.exports=Q$;var I9=B8(),O9=Object.create(P1());O9.inherits=Z1();O9.inherits(Q$,I9);function Q$($){if(!(this instanceof Q$))return new Q$($);I9.call(this,$)}Q$.prototype._transform=function($,Q,J){J(null,$)}});var D8=C((r,i$)=>{var B0=Y0("stream");if(process.env.READABLE_STREAM==="disable"&&B0)i$.exports=B0,r=i$.exports=B0.Readable,r.Readable=B0.Readable,r.Writable=B0.Writable,r.Duplex=B0.Duplex,r.Transform=B0.Transform,r.PassThrough=B0.PassThrough,r.Stream=B0;else r=i$.exports=H8(),r.Stream=B0||r,r.Readable=r,r.Writable=U8(),r.Duplex=e0(),r.Transform=B8(),r.PassThrough=B9()});var T0=C((o3)=>{o3.base64=!0;o3.array=!0;o3.string=!0;o3.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";o3.nodebuffer=typeof Buffer<"u";o3.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")o3.blob=!1;else{n$=new ArrayBuffer(0);try{o3.blob=new Blob([n$],{type:"application/zip"}).size===0}catch($){try{v8=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,r$=new v8,r$.append(n$),o3.blob=r$.getBlob("application/zip").size===0}catch(Q){o3.blob=!1}}}var n$,v8,r$;try{o3.nodestream=!!D8().Readable}catch($){o3.nodestream=!1}});var C8=C((QG)=>{var e3=m(),$G=T0(),D0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";QG.encode=function($){var Q=[],J,q,Y,G,V,K,U,X=0,W=$.length,H=W,j=e3.getTypeOf($)!=="string";while(X<$.length){if(H=W-X,!j)J=$.charCodeAt(X++),q=X<W?$.charCodeAt(X++):0,Y=X<W?$.charCodeAt(X++):0;else J=$[X++],q=X<W?$[X++]:0,Y=X<W?$[X++]:0;G=J>>2,V=(J&3)<<4|q>>4,K=H>1?(q&15)<<2|Y>>6:64,U=H>2?Y&63:64,Q.push(D0.charAt(G)+D0.charAt(V)+D0.charAt(K)+D0.charAt(U))}return Q.join("")};QG.decode=function($){var Q,J,q,Y,G,V,K,U=0,X=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 H=$.length*3/4;if($.charAt($.length-1)===D0.charAt(64))H--;if($.charAt($.length-2)===D0.charAt(64))H--;if(H%1!==0)throw Error("Invalid base64 input, bad content length.");var j;if($G.uint8array)j=new Uint8Array(H|0);else j=Array(H|0);while(U<$.length){if(Y=D0.indexOf($.charAt(U++)),G=D0.indexOf($.charAt(U++)),V=D0.indexOf($.charAt(U++)),K=D0.indexOf($.charAt(U++)),Q=Y<<2|G>>4,J=(G&15)<<4|V>>2,q=(V&3)<<6|K,j[X++]=Q,V!==64)j[X++]=J;if(K!==64)j[X++]=q}return j}});var J$=C((cH,D9)=>{D9.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 C9=C((uH,v9)=>{var pH=global.MutationObserver||global.WebKitMutationObserver,w9;w9=function(){process.nextTick(XG)};var YG,GG,VG,KG,A8,q$=[];function XG(){A8=!0;var $,Q,J=q$.length;while(J){Q=q$,q$=[],$=-1;while(++$<J)Q[$]();J=q$.length}A8=!1}v9.exports=WG;function WG($){if(q$.push($)===1&&!A8)w9()}});var g9=C((dH,S9)=>{var A9=C9();function O1(){}var t={},R9=["REJECTED"],R8=["FULFILLED"],k9=["PENDING"];I1=["UNHANDLED"];var I1;S9.exports=m0;function m0($){if(typeof $!=="function")throw TypeError("resolver must be a function");if(this.state=k9,this.queue=[],this.outcome=void 0,this.handled=I1,$!==O1)E9(this,$)}m0.prototype.finally=function($){if(typeof $!=="function")return this;var Q=this.constructor;return this.then(J,q);function J(Y){function G(){return Y}return Q.resolve($()).then(G)}function q(Y){function G(){throw Y}return Q.resolve($()).then(G)}};m0.prototype.catch=function($){return this.then(null,$)};m0.prototype.then=function($,Q){if(typeof $!=="function"&&this.state===R8||typeof Q!=="function"&&this.state===R9)return this;var J=new this.constructor(O1);if(this.handled===I1)this.handled=null;if(this.state!==k9){var q=this.state===R8?$:Q;k8(J,q,this.outcome)}else this.queue.push(new Y$(J,$,Q));return J};function Y$($,Q,J){if(this.promise=$,typeof Q==="function")this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled;if(typeof J==="function")this.onRejected=J,this.callRejected=this.otherCallRejected}Y$.prototype.callFulfilled=function($){t.resolve(this.promise,$)};Y$.prototype.otherCallFulfilled=function($){k8(this.promise,this.onFulfilled,$)};Y$.prototype.callRejected=function($){t.reject(this.promise,$)};Y$.prototype.otherCallRejected=function($){k8(this.promise,this.onRejected,$)};function k8($,Q,J){A9(function(){var q;try{q=Q(J)}catch(Y){return t.reject($,Y)}if(q===$)t.reject($,TypeError("Cannot resolve promise with itself"));else t.resolve($,q)})}t.resolve=function($,Q){var J=x9(UG,Q);if(J.status==="error")return t.reject($,J.value);var q=J.value;if(q)E9($,q);else{$.state=R8,$.outcome=Q;var Y=-1,G=$.queue.length;while(++Y<G)$.queue[Y].callFulfilled(Q)}return $};t.reject=function($,Q){if($.state=R9,$.outcome=Q,$.handled===I1)A9(function(){if($.handled===I1)process.emit("unhandledRejection",Q,$)});var J=-1,q=$.queue.length;while(++J<q)$.queue[J].callRejected(Q);return $};function UG($){var Q=$&&$.then;if($&&(typeof $==="object"||typeof $==="function")&&typeof Q==="function")return function(){Q.apply($,arguments)}}function E9($,Q){var J=!1;function q(K){if(J)return;J=!0,t.reject($,K)}function Y(K){if(J)return;J=!0,t.resolve($,K)}function G(){Q(Y,q)}var V=x9(G);if(V.status==="error")q(V.value)}function x9($,Q){var J={};try{J.value=$(Q),J.status="success"}catch(q){J.status="error",J.value=q}return J}m0.resolve=jG;function jG($){if($ instanceof this)return $;return t.resolve(new this(O1),$)}m0.reject=HG;function HG($){var Q=new this(O1);return t.reject(Q,$)}m0.all=FG;function FG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=Array(J),G=0,V=-1,K=new this(O1);while(++V<J)U($[V],V);return K;function U(X,W){Q.resolve(X).then(H,function(j){if(!q)q=!0,t.reject(K,j)});function H(j){if(Y[W]=j,++G===J&&!q)q=!0,t.resolve(K,Y)}}}m0.race=PG;function PG($){var Q=this;if(Object.prototype.toString.call($)!=="[object Array]")return this.reject(TypeError("must be an array"));var J=$.length,q=!1;if(!J)return this.resolve([]);var Y=-1,G=new this(O1);while(++Y<J)V($[Y]);return G;function V(K){Q.resolve(K).then(function(U){if(!q)q=!0,t.resolve(G,U)},function(U){if(!q)q=!0,t.reject(G,U)})}}});var N1=C((lH,T9)=>{var E8=null;if(typeof Promise<"u")E8=Promise;else E8=g9();T9.exports={Promise:E8}});var h9=C((y9)=>{(function($,Q){if($.setImmediate)return;var J=1,q={},Y=!1,G=$.document,V;function K(P){if(typeof P!=="function")P=Function(""+P);var B=Array(arguments.length-1);for(var M=0;M<B.length;M++)B[M]=arguments[M+1];var z={callback:P,args:B};return q[J]=z,V(J),J++}function U(P){delete q[P]}function X(P){var{callback:B,args:M}=P;switch(M.length){case 0:B();break;case 1:B(M[0]);break;case 2:B(M[0],M[1]);break;case 3:B(M[0],M[1],M[2]);break;default:B.apply(Q,M);break}}function W(P){if(Y)setTimeout(W,0,P);else{var B=q[P];if(B){Y=!0;try{X(B)}finally{U(P),Y=!1}}}}function H(){V=function(P){process.nextTick(function(){W(P)})}}function j(){if($.postMessage&&!$.importScripts){var P=!0,B=$.onmessage;return $.onmessage=function(){P=!1},$.postMessage("","*"),$.onmessage=B,P}}function F(){var P="setImmediate$"+Math.random()+"$",B=function(M){if(M.source===$&&typeof M.data==="string"&&M.data.indexOf(P)===0)W(+M.data.slice(P.length))};if($.addEventListener)$.addEventListener("message",B,!1);else $.attachEvent("onmessage",B);V=function(M){$.postMessage(P+M,"*")}}function Z(){var P=new MessageChannel;P.port1.onmessage=function(B){var M=B.data;W(M)},V=function(B){P.port2.postMessage(B)}}function L(){var P=G.documentElement;V=function(B){var M=G.createElement("script");M.onreadystatechange=function(){W(B),M.onreadystatechange=null,P.removeChild(M),M=null},P.appendChild(M)}}function N(){V=function(P){setTimeout(W,0,P)}}var I=Object.getPrototypeOf&&Object.getPrototypeOf($);if(I=I&&I.setTimeout?I:$,{}.toString.call($.process)==="[object process]")H();else if(j())F();else if($.MessageChannel)Z();else if(G&&"onreadystatechange"in G.createElement("script"))L();else N();I.setImmediate=K,I.clearImmediate=U})(typeof self>"u"?typeof global>"u"?y9:global:self)});var m=C((LG)=>{var c0=T0(),ZG=C8(),B1=J$(),x8=N1();h9();function zG($){var Q=null;if(c0.uint8array)Q=new Uint8Array($.length);else Q=Array($.length);return s$($,Q)}LG.newBlob=function($,Q){LG.checkSupport("blob");try{return new Blob([$],{type:Q})}catch(Y){try{var J=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,q=new J;return q.append($),q.getBlob(Q)}catch(G){throw Error("Bug : can't construct the Blob.")}}};function G$($){return $}function s$($,Q){for(var J=0;J<$.length;++J)Q[J]=$.charCodeAt(J)&255;return Q}var a$={stringifyByChunk:function($,Q,J){var q=[],Y=0,G=$.length;if(G<=J)return String.fromCharCode.apply(null,$);while(Y<G){if(Q==="array"||Q==="nodebuffer")q.push(String.fromCharCode.apply(null,$.slice(Y,Math.min(Y+J,G))));else q.push(String.fromCharCode.apply(null,$.subarray(Y,Math.min(Y+J,G))));Y+=J}return q.join("")},stringifyByChar:function($){var Q="";for(var J=0;J<$.length;J++)Q+=String.fromCharCode($[J]);return Q},applyCanBeUsed:{uint8array:function(){try{return c0.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch($){return!1}}(),nodebuffer:function(){try{return c0.nodebuffer&&String.fromCharCode.apply(null,B1.allocBuffer(1)).length===1}catch($){return!1}}()}};function V$($){var Q=65536,J=LG.getTypeOf($),q=!0;if(J==="uint8array")q=a$.applyCanBeUsed.uint8array;else if(J==="nodebuffer")q=a$.applyCanBeUsed.nodebuffer;if(q)while(Q>1)try{return a$.stringifyByChunk($,J,Q)}catch(Y){Q=Math.floor(Q/2)}return a$.stringifyByChar($)}LG.applyFromCharCode=V$;function t$($,Q){for(var J=0;J<$.length;J++)Q[J]=$[J];return Q}var p0={};p0.string={string:G$,array:function($){return s$($,Array($.length))},arraybuffer:function($){return p0.string.uint8array($).buffer},uint8array:function($){return s$($,new Uint8Array($.length))},nodebuffer:function($){return s$($,B1.allocBuffer($.length))}};p0.array={string:V$,array:G$,arraybuffer:function($){return new Uint8Array($).buffer},uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return B1.newBufferFrom($)}};p0.arraybuffer={string:function($){return V$(new Uint8Array($))},array:function($){return t$(new Uint8Array($),Array($.byteLength))},arraybuffer:G$,uint8array:function($){return new Uint8Array($)},nodebuffer:function($){return B1.newBufferFrom(new Uint8Array($))}};p0.uint8array={string:V$,array:function($){return t$($,Array($.length))},arraybuffer:function($){return $.buffer},uint8array:G$,nodebuffer:function($){return B1.newBufferFrom($)}};p0.nodebuffer={string:V$,array:function($){return t$($,Array($.length))},arraybuffer:function($){return p0.nodebuffer.uint8array($).buffer},uint8array:function($){return t$($,new Uint8Array($.length))},nodebuffer:G$};LG.transformTo=function($,Q){if(!Q)Q="";if(!$)return Q;LG.checkSupport($);var J=LG.getTypeOf(Q),q=p0[J][$](Q);return q};LG.resolve=function($){var Q=$.split("/"),J=[];for(var q=0;q<Q.length;q++){var Y=Q[q];if(Y==="."||Y===""&&q!==0&&q!==Q.length-1)continue;else if(Y==="..")J.pop();else J.push(Y)}return J.join("/")};LG.getTypeOf=function($){if(typeof $==="string")return"string";if(Object.prototype.toString.call($)==="[object Array]")return"array";if(c0.nodebuffer&&B1.isBuffer($))return"nodebuffer";if(c0.uint8array&&$ instanceof Uint8Array)return"uint8array";if(c0.arraybuffer&&$ instanceof ArrayBuffer)return"arraybuffer"};LG.checkSupport=function($){var Q=c0[$.toLowerCase()];if(!Q)throw Error($+" is not supported by this platform")};LG.MAX_VALUE_16BITS=65535;LG.MAX_VALUE_32BITS=-1;LG.pretty=function($){var Q="",J,q;for(q=0;q<($||"").length;q++)J=$.charCodeAt(q),Q+="\\x"+(J<16?"0":"")+J.toString(16).toUpperCase();return Q};LG.delay=function($,Q,J){setImmediate(function(){$.apply(J||null,Q||[])})};LG.inherits=function($,Q){var J=function(){};J.prototype=Q.prototype,$.prototype=new J};LG.extend=function(){var $={},Q,J;for(Q=0;Q<arguments.length;Q++)for(J in arguments[Q])if(Object.prototype.hasOwnProperty.call(arguments[Q],J)&&typeof $[J]>"u")$[J]=arguments[Q][J];return $};LG.prepareContent=function($,Q,J,q,Y){var G=x8.Promise.resolve(Q).then(function(V){var K=c0.blob&&(V instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(V))!==-1);if(K&&typeof FileReader<"u")return new x8.Promise(function(U,X){var W=new FileReader;W.onload=function(H){U(H.target.result)},W.onerror=function(H){X(H.target.error)},W.readAsArrayBuffer(V)});else return V});return G.then(function(V){var K=LG.getTypeOf(V);if(!K)return x8.Promise.reject(Error("Can't read the data of '"+$+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(K==="arraybuffer")V=LG.transformTo("uint8array",V);else if(K==="string"){if(Y)V=ZG.decode(V);else if(J){if(q!==!0)V=zG(V)}}return V})}});var V0=C((nH,m9)=>{function _9($){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}_9.prototype={push:function($){this.emit("data",$)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch($){this.emit("error",$)}return!0},error:function($){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=$;else{if(this.isFinished=!0,this.emit("error",$),this.previous)this.previous.error($);this.cleanUp()}return!0},on:function($,Q){return this._listeners[$].push(Q),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function($,Q){if(this._listeners[$])for(var J=0;J<this._listeners[$].length;J++)this._listeners[$][J].call(this,Q)},pipe:function($){return $.registerPrevious(this)},registerPrevious:function($){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=$.streamInfo,this.mergeStreamInfo(),this.previous=$;var Q=this;return $.on("data",function(J){Q.processChunk(J)}),$.on("end",function(){Q.end()}),$.on("error",function(J){Q.error(J)}),this},pause:function(){if(this.isPaused||this.isFinished)return!1;if(this.isPaused=!0,this.previous)this.previous.pause();return!0},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var $=!1;if(this.generatedError)this.error(this.generatedError),$=!0;if(this.previous)this.previous.resume();return!$},flush:function(){},processChunk:function($){this.push($)},withStreamInfo:function($,Q){return this.extraStreamInfo[$]=Q,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var $ in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,$))continue;this.streamInfo[$]=this.extraStreamInfo[$]}},lock:function(){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");if(this.isLocked=!0,this.previous)this.previous.lock()},toString:function(){var $="Worker "+this.name;if(this.previous)return this.previous+" -> "+$;else return $}};m9.exports=_9});var w1=C((SG)=>{var D1=m(),$1=T0(),RG=J$(),e$=V0(),K$=Array(256);for(w0=0;w0<256;w0++)K$[w0]=w0>=252?6:w0>=248?5:w0>=240?4:w0>=224?3:w0>=192?2:1;var w0;K$[254]=K$[254]=1;var kG=function($){var Q,J,q,Y,G,V=$.length,K=0;for(Y=0;Y<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}K+=J<128?1:J<2048?2:J<65536?3:4}if($1.uint8array)Q=new Uint8Array(K);else Q=Array(K);for(G=0,Y=0;G<K;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q},EG=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+K$[$[J]]>Q?J:Q},xG=function($){var Q,J,q,Y,G=$.length,V=Array(G*2);for(J=0,Q=0;Q<G;){if(q=$[Q++],q<128){V[J++]=q;continue}if(Y=K$[q],Y>4){V[J++]=65533,Q+=Y-1;continue}q&=Y===2?31:Y===3?15:7;while(Y>1&&Q<G)q=q<<6|$[Q++]&63,Y--;if(Y>1){V[J++]=65533;continue}if(q<65536)V[J++]=q;else q-=65536,V[J++]=55296|q>>10&1023,V[J++]=56320|q&1023}if(V.length!==J)if(V.subarray)V=V.subarray(0,J);else V.length=J;return D1.applyFromCharCode(V)};SG.utf8encode=function(Q){if($1.nodebuffer)return RG.newBufferFrom(Q,"utf-8");return kG(Q)};SG.utf8decode=function(Q){if($1.nodebuffer)return D1.transformTo("nodebuffer",Q).toString("utf-8");return Q=D1.transformTo($1.uint8array?"uint8array":"array",Q),xG(Q)};function $6(){e$.call(this,"utf-8 decode"),this.leftOver=null}D1.inherits($6,e$);$6.prototype.processChunk=function($){var Q=D1.transformTo($1.uint8array?"uint8array":"array",$.data);if(this.leftOver&&this.leftOver.length){if($1.uint8array){var J=Q;Q=new Uint8Array(J.length+this.leftOver.length),Q.set(this.leftOver,0),Q.set(J,this.leftOver.length)}else Q=this.leftOver.concat(Q);this.leftOver=null}var q=EG(Q),Y=Q;if(q!==Q.length)if($1.uint8array)Y=Q.subarray(0,q),this.leftOver=Q.subarray(q,Q.length);else Y=Q.slice(0,q),this.leftOver=Q.slice(q,Q.length);this.push({data:SG.utf8decode(Y),meta:$.meta})};$6.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:SG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};SG.Utf8DecodeWorker=$6;function g8(){e$.call(this,"utf-8 encode")}D1.inherits(g8,e$);g8.prototype.processChunk=function($){this.push({data:SG.utf8encode($.data),meta:$.meta})};SG.Utf8EncodeWorker=g8});var l9=C((aH,d9)=>{var p9=V0(),u9=m();function y8($){p9.call(this,"ConvertWorker to "+$),this.destType=$}u9.inherits(y8,p9);y8.prototype.processChunk=function($){this.push({data:u9.transformTo(this.destType,$.data),meta:$.meta})};d9.exports=y8});var n9=C((sH,i9)=>{var o9=D8().Readable,yG=m();yG.inherits(h8,o9);function h8($,Q,J){o9.call(this,Q),this._helper=$;var q=this;$.on("data",function(Y,G){if(!q.push(Y))q._helper.pause();if(J)J(G)}).on("error",function(Y){q.emit("error",Y)}).on("end",function(){q.push(null)})}h8.prototype._read=function(){this._helper.resume()};i9.exports=h8});var b8=C((tH,s9)=>{var Q1=m(),hG=l9(),bG=V0(),fG=C8(),_G=T0(),mG=N1(),r9=null;if(_G.nodestream)try{r9=n9()}catch($){}function cG($,Q,J){switch($){case"blob":return Q1.newBlob(Q1.transformTo("arraybuffer",Q),J);case"base64":return fG.encode(Q);default:return Q1.transformTo($,Q)}}function pG($,Q){var J,q=0,Y=null,G=0;for(J=0;J<Q.length;J++)G+=Q[J].length;switch($){case"string":return Q.join("");case"array":return Array.prototype.concat.apply([],Q);case"uint8array":Y=new Uint8Array(G);for(J=0;J<Q.length;J++)Y.set(Q[J],q),q+=Q[J].length;return Y;case"nodebuffer":return Buffer.concat(Q);default:throw Error("concat : unsupported type '"+$+"'")}}function uG($,Q){return new mG.Promise(function(J,q){var Y=[],G=$._internalType,V=$._outputType,K=$._mimeType;$.on("data",function(U,X){if(Y.push(U),Q)Q(X)}).on("error",function(U){Y=[],q(U)}).on("end",function(){try{var U=cG(V,pG(G,Y),K);J(U)}catch(X){q(X)}Y=[]}).resume()})}function a9($,Q,J){var q=Q;switch(Q){case"blob":case"arraybuffer":q="uint8array";break;case"base64":q="string";break}try{this._internalType=q,this._outputType=Q,this._mimeType=J,Q1.checkSupport(q),this._worker=$.pipe(new hG(q)),$.lock()}catch(Y){this._worker=new bG("error"),this._worker.error(Y)}}a9.prototype={accumulate:function($){return uG(this,$)},on:function($,Q){var J=this;if($==="data")this._worker.on($,function(q){Q.call(J,q.data,q.meta)});else this._worker.on($,function(){Q1.delay(Q,arguments,J)});return this},resume:function(){return Q1.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function($){if(Q1.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new r9(this,{objectMode:this._outputType!=="nodebuffer"},$)}};s9.exports=a9});var f8=C((dG)=>{dG.base64=!1;dG.binary=!1;dG.dir=!1;dG.createFolders=!0;dG.date=null;dG.compression=null;dG.compressionOptions=null;dG.comment=null;dG.unixPermissions=null;dG.dosPermissions=null});var _8=C(($F,t9)=>{var Q6=m(),J6=V0(),QV=16384;function v1($){J6.call(this,"DataWorker");var Q=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,$.then(function(J){if(Q.dataIsReady=!0,Q.data=J,Q.max=J&&J.length||0,Q.type=Q6.getTypeOf(J),!Q.isPaused)Q._tickAndRepeat()},function(J){Q.error(J)})}Q6.inherits(v1,J6);v1.prototype.cleanUp=function(){J6.prototype.cleanUp.call(this),this.data=null};v1.prototype.resume=function(){if(!J6.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,Q6.delay(this._tickAndRepeat,[],this);return!0};v1.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)Q6.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};v1.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var $=QV,Q=null,J=Math.min(this.max,this.index+$);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":Q=this.data.substring(this.index,J);break;case"uint8array":Q=this.data.subarray(this.index,J);break;case"array":case"nodebuffer":Q=this.data.slice(this.index,J);break}return this.index=J,this.push({data:Q,meta:{percent:this.max?this.index/this.max*100:0}})}};t9.exports=v1});var q6=C((QF,$2)=>{var JV=m();function qV(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var e9=qV();function YV($,Q,J,q){var Y=e9,G=q+J;$=$^-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q[V])&255];return $^-1}function GV($,Q,J,q){var Y=e9,G=q+J;$=$^-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q.charCodeAt(V))&255];return $^-1}$2.exports=function(Q,J){if(typeof Q>"u"||!Q.length)return 0;var q=JV.getTypeOf(Q)!=="string";if(q)return YV(J|0,Q,Q.length,0);else return GV(J|0,Q,Q.length,0)}});var c8=C((JF,J2)=>{var Q2=V0(),VV=q6(),KV=m();function m8(){Q2.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}KV.inherits(m8,Q2);m8.prototype.processChunk=function($){this.streamInfo.crc32=VV($.data,this.streamInfo.crc32||0),this.push($)};J2.exports=m8});var Y2=C((qF,q2)=>{var XV=m(),p8=V0();function u8($){p8.call(this,"DataLengthProbe for "+$),this.propName=$,this.withStreamInfo($,0)}XV.inherits(u8,p8);u8.prototype.processChunk=function($){if($){var Q=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=Q+$.data.length}p8.prototype.processChunk.call(this,$)};q2.exports=u8});var Y6=C((YF,K2)=>{var G2=N1(),V2=_8(),WV=c8(),d8=Y2();function l8($,Q,J,q,Y){this.compressedSize=$,this.uncompressedSize=Q,this.crc32=J,this.compression=q,this.compressedContent=Y}l8.prototype={getContentWorker:function(){var $=new V2(G2.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new d8("data_length")),Q=this;return $.on("end",function(){if(this.streamInfo.data_length!==Q.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),$},getCompressedWorker:function(){return new V2(G2.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};l8.createWorkerFrom=function($,Q,J){return $.pipe(new WV).pipe(new d8("uncompressedSize")).pipe(Q.compressWorker(J)).pipe(new d8("compressedSize")).withStreamInfo("compression",Q)};K2.exports=l8});var j2=C((GF,U2)=>{var UV=b8(),jV=_8(),o8=w1(),i8=Y6(),X2=V0(),n8=function($,Q,J){this.name=$,this.dir=J.dir,this.date=J.date,this.comment=J.comment,this.unixPermissions=J.unixPermissions,this.dosPermissions=J.dosPermissions,this._data=Q,this._dataBinary=J.binary,this.options={compression:J.compression,compressionOptions:J.compressionOptions}};n8.prototype={internalStream:function($){var Q=null,J="string";try{if(!$)throw Error("No output type specified.");J=$.toLowerCase();var q=J==="string"||J==="text";if(J==="binarystring"||J==="text")J="string";Q=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!q)Q=Q.pipe(new o8.Utf8EncodeWorker);if(!Y&&q)Q=Q.pipe(new o8.Utf8DecodeWorker)}catch(G){Q=new X2("error"),Q.error(G)}return new UV(Q,J,"")},async:function($,Q){return this.internalStream($).accumulate(Q)},nodeStream:function($,Q){return this.internalStream($||"nodebuffer").toNodejsStream(Q)},_compressWorker:function($,Q){if(this._data instanceof i8&&this._data.compression.magic===$.magic)return this._data.getCompressedWorker();else{var J=this._decompressWorker();if(!this._dataBinary)J=J.pipe(new o8.Utf8EncodeWorker);return i8.createWorkerFrom(J,$,Q)}},_decompressWorker:function(){if(this._data instanceof i8)return this._data.getContentWorker();else if(this._data instanceof X2)return this._data;else return new jV(this._data)}};var W2=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],HV=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(X$=0;X$<W2.length;X$++)n8.prototype[W2[X$]]=HV;var X$;U2.exports=n8});var y0=C((r8)=>{var zV=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function LV($,Q){return Object.prototype.hasOwnProperty.call($,Q)}r8.assign=function($){var Q=Array.prototype.slice.call(arguments,1);while(Q.length){var J=Q.shift();if(!J)continue;if(typeof J!=="object")throw TypeError(J+"must be non-object");for(var q in J)if(LV(J,q))$[q]=J[q]}return $};r8.shrinkBuf=function($,Q){if($.length===Q)return $;if($.subarray)return $.subarray(0,Q);return $.length=Q,$};var MV={arraySet:function($,Q,J,q,Y){if(Q.subarray&&$.subarray){$.set(Q.subarray(J,J+q),Y);return}for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){var Q,J,q,Y,G,V;q=0;for(Q=0,J=$.length;Q<J;Q++)q+=$[Q].length;V=new Uint8Array(q),Y=0;for(Q=0,J=$.length;Q<J;Q++)G=$[Q],V.set(G,Y),Y+=G.length;return V}},IV={arraySet:function($,Q,J,q,Y){for(var G=0;G<q;G++)$[Y+G]=Q[J+G]},flattenChunks:function($){return[].concat.apply([],$)}};r8.setTyped=function($){if($)r8.Buf8=Uint8Array,r8.Buf16=Uint16Array,r8.Buf32=Int32Array,r8.assign(r8,MV);else r8.Buf8=Array,r8.Buf16=Array,r8.Buf32=Array,r8.assign(r8,IV)};r8.setTyped(zV)});var y2=C((pV)=>{var NV=y0(),BV=4,F2=0,P2=1,DV=2;function A1($){var Q=$.length;while(--Q>=0)$[Q]=0}var wV=0,O2=1,vV=2,CV=3,AV=258,q5=29,P$=256,U$=P$+1+q5,C1=30,Y5=19,N2=2*U$+1,J1=15,s8=16,RV=7,G5=256,B2=16,D2=17,w2=18,Q5=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],G6=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],kV=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],v2=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],EV=512,h0=Array((U$+2)*2);A1(h0);var W$=Array(C1*2);A1(W$);var j$=Array(EV);A1(j$);var H$=Array(AV-CV+1);A1(H$);var V5=Array(q5);A1(V5);var V6=Array(C1);A1(V6);function t8($,Q,J,q,Y){this.static_tree=$,this.extra_bits=Q,this.extra_base=J,this.elems=q,this.max_length=Y,this.has_stree=$&&$.length}var C2,A2,R2;function e8($,Q){this.dyn_tree=$,this.max_code=0,this.stat_desc=Q}function k2($){return $<256?j$[$]:j$[256+($>>>7)]}function F$($,Q){$.pending_buf[$.pending++]=Q&255,$.pending_buf[$.pending++]=Q>>>8&255}function G0($,Q,J){if($.bi_valid>s8-J)$.bi_buf|=Q<<$.bi_valid&65535,F$($,$.bi_buf),$.bi_buf=Q>>s8-$.bi_valid,$.bi_valid+=J-s8;else $.bi_buf|=Q<<$.bi_valid&65535,$.bi_valid+=J}function v0($,Q,J){G0($,J[Q*2],J[Q*2+1])}function E2($,Q){var J=0;do J|=$&1,$>>>=1,J<<=1;while(--Q>0);return J>>>1}function xV($){if($.bi_valid===16)F$($,$.bi_buf),$.bi_buf=0,$.bi_valid=0;else if($.bi_valid>=8)$.pending_buf[$.pending++]=$.bi_buf&255,$.bi_buf>>=8,$.bi_valid-=8}function SV($,Q){var{dyn_tree:J,max_code:q}=Q,Y=Q.stat_desc.static_tree,G=Q.stat_desc.has_stree,V=Q.stat_desc.extra_bits,K=Q.stat_desc.extra_base,U=Q.stat_desc.max_length,X,W,H,j,F,Z,L=0;for(j=0;j<=J1;j++)$.bl_count[j]=0;J[$.heap[$.heap_max]*2+1]=0;for(X=$.heap_max+1;X<N2;X++){if(W=$.heap[X],j=J[J[W*2+1]*2+1]+1,j>U)j=U,L++;if(J[W*2+1]=j,W>q)continue;if($.bl_count[j]++,F=0,W>=K)F=V[W-K];if(Z=J[W*2],$.opt_len+=Z*(j+F),G)$.static_len+=Z*(Y[W*2+1]+F)}if(L===0)return;do{j=U-1;while($.bl_count[j]===0)j--;$.bl_count[j]--,$.bl_count[j+1]+=2,$.bl_count[U]--,L-=2}while(L>0);for(j=U;j!==0;j--){W=$.bl_count[j];while(W!==0){if(H=$.heap[--X],H>q)continue;if(J[H*2+1]!==j)$.opt_len+=(j-J[H*2+1])*J[H*2],J[H*2+1]=j;W--}}}function x2($,Q,J){var q=Array(J1+1),Y=0,G,V;for(G=1;G<=J1;G++)q[G]=Y=Y+J[G-1]<<1;for(V=0;V<=Q;V++){var K=$[V*2+1];if(K===0)continue;$[V*2]=E2(q[K]++,K)}}function gV(){var $,Q,J,q,Y,G=Array(J1+1);J=0;for(q=0;q<q5-1;q++){V5[q]=J;for($=0;$<1<<Q5[q];$++)H$[J++]=q}H$[J-1]=q,Y=0;for(q=0;q<16;q++){V6[q]=Y;for($=0;$<1<<G6[q];$++)j$[Y++]=q}Y>>=7;for(;q<C1;q++){V6[q]=Y<<7;for($=0;$<1<<G6[q]-7;$++)j$[256+Y++]=q}for(Q=0;Q<=J1;Q++)G[Q]=0;$=0;while($<=143)h0[$*2+1]=8,$++,G[8]++;while($<=255)h0[$*2+1]=9,$++,G[9]++;while($<=279)h0[$*2+1]=7,$++,G[7]++;while($<=287)h0[$*2+1]=8,$++,G[8]++;x2(h0,U$+1,G);for($=0;$<C1;$++)W$[$*2+1]=5,W$[$*2]=E2($,5);C2=new t8(h0,Q5,P$+1,U$,J1),A2=new t8(W$,G6,0,C1,J1),R2=new t8([],kV,0,Y5,RV)}function S2($){var Q;for(Q=0;Q<U$;Q++)$.dyn_ltree[Q*2]=0;for(Q=0;Q<C1;Q++)$.dyn_dtree[Q*2]=0;for(Q=0;Q<Y5;Q++)$.bl_tree[Q*2]=0;$.dyn_ltree[G5*2]=1,$.opt_len=$.static_len=0,$.last_lit=$.matches=0}function g2($){if($.bi_valid>8)F$($,$.bi_buf);else if($.bi_valid>0)$.pending_buf[$.pending++]=$.bi_buf;$.bi_buf=0,$.bi_valid=0}function TV($,Q,J,q){if(g2($),q)F$($,J),F$($,~J);NV.arraySet($.pending_buf,$.window,Q,J,$.pending),$.pending+=J}function Z2($,Q,J,q){var Y=Q*2,G=J*2;return $[Y]<$[G]||$[Y]===$[G]&&q[Q]<=q[J]}function $5($,Q,J){var q=$.heap[J],Y=J<<1;while(Y<=$.heap_len){if(Y<$.heap_len&&Z2(Q,$.heap[Y+1],$.heap[Y],$.depth))Y++;if(Z2(Q,q,$.heap[Y],$.depth))break;$.heap[J]=$.heap[Y],J=Y,Y<<=1}$.heap[J]=q}function z2($,Q,J){var q,Y,G=0,V,K;if($.last_lit!==0)do if(q=$.pending_buf[$.d_buf+G*2]<<8|$.pending_buf[$.d_buf+G*2+1],Y=$.pending_buf[$.l_buf+G],G++,q===0)v0($,Y,Q);else{if(V=H$[Y],v0($,V+P$+1,Q),K=Q5[V],K!==0)Y-=V5[V],G0($,Y,K);if(q--,V=k2(q),v0($,V,J),K=G6[V],K!==0)q-=V6[V],G0($,q,K)}while(G<$.last_lit);v0($,G5,Q)}function J5($,Q){var J=Q.dyn_tree,q=Q.stat_desc.static_tree,Y=Q.stat_desc.has_stree,G=Q.stat_desc.elems,V,K,U=-1,X;$.heap_len=0,$.heap_max=N2;for(V=0;V<G;V++)if(J[V*2]!==0)$.heap[++$.heap_len]=U=V,$.depth[V]=0;else J[V*2+1]=0;while($.heap_len<2)if(X=$.heap[++$.heap_len]=U<2?++U:0,J[X*2]=1,$.depth[X]=0,$.opt_len--,Y)$.static_len-=q[X*2+1];Q.max_code=U;for(V=$.heap_len>>1;V>=1;V--)$5($,J,V);X=G;do V=$.heap[1],$.heap[1]=$.heap[$.heap_len--],$5($,J,1),K=$.heap[1],$.heap[--$.heap_max]=V,$.heap[--$.heap_max]=K,J[X*2]=J[V*2]+J[K*2],$.depth[X]=($.depth[V]>=$.depth[K]?$.depth[V]:$.depth[K])+1,J[V*2+1]=J[K*2+1]=X,$.heap[1]=X++,$5($,J,1);while($.heap_len>=2);$.heap[--$.heap_max]=$.heap[1],SV($,Q),x2(J,U,$.bl_count)}function L2($,Q,J){var q,Y=-1,G,V=Q[1],K=0,U=7,X=4;if(V===0)U=138,X=3;Q[(J+1)*2+1]=65535;for(q=0;q<=J;q++){if(G=V,V=Q[(q+1)*2+1],++K<U&&G===V)continue;else if(K<X)$.bl_tree[G*2]+=K;else if(G!==0){if(G!==Y)$.bl_tree[G*2]++;$.bl_tree[B2*2]++}else if(K<=10)$.bl_tree[D2*2]++;else $.bl_tree[w2*2]++;if(K=0,Y=G,V===0)U=138,X=3;else if(G===V)U=6,X=3;else U=7,X=4}}function M2($,Q,J){var q,Y=-1,G,V=Q[1],K=0,U=7,X=4;if(V===0)U=138,X=3;for(q=0;q<=J;q++){if(G=V,V=Q[(q+1)*2+1],++K<U&&G===V)continue;else if(K<X)do v0($,G,$.bl_tree);while(--K!==0);else if(G!==0){if(G!==Y)v0($,G,$.bl_tree),K--;v0($,B2,$.bl_tree),G0($,K-3,2)}else if(K<=10)v0($,D2,$.bl_tree),G0($,K-3,3);else v0($,w2,$.bl_tree),G0($,K-11,7);if(K=0,Y=G,V===0)U=138,X=3;else if(G===V)U=6,X=3;else U=7,X=4}}function yV($){var Q;L2($,$.dyn_ltree,$.l_desc.max_code),L2($,$.dyn_dtree,$.d_desc.max_code),J5($,$.bl_desc);for(Q=Y5-1;Q>=3;Q--)if($.bl_tree[v2[Q]*2+1]!==0)break;return $.opt_len+=3*(Q+1)+5+5+4,Q}function hV($,Q,J,q){var Y;G0($,Q-257,5),G0($,J-1,5),G0($,q-4,4);for(Y=0;Y<q;Y++)G0($,$.bl_tree[v2[Y]*2+1],3);M2($,$.dyn_ltree,Q-1),M2($,$.dyn_dtree,J-1)}function bV($){var Q=4093624447,J;for(J=0;J<=31;J++,Q>>>=1)if(Q&1&&$.dyn_ltree[J*2]!==0)return F2;if($.dyn_ltree[18]!==0||$.dyn_ltree[20]!==0||$.dyn_ltree[26]!==0)return P2;for(J=32;J<P$;J++)if($.dyn_ltree[J*2]!==0)return P2;return F2}var I2=!1;function fV($){if(!I2)gV(),I2=!0;$.l_desc=new e8($.dyn_ltree,C2),$.d_desc=new e8($.dyn_dtree,A2),$.bl_desc=new e8($.bl_tree,R2),$.bi_buf=0,$.bi_valid=0,S2($)}function T2($,Q,J,q){G0($,(wV<<1)+(q?1:0),3),TV($,Q,J,!0)}function _V($){G0($,O2<<1,3),v0($,G5,h0),xV($)}function mV($,Q,J,q){var Y,G,V=0;if($.level>0){if($.strm.data_type===DV)$.strm.data_type=bV($);if(J5($,$.l_desc),J5($,$.d_desc),V=yV($),Y=$.opt_len+3+7>>>3,G=$.static_len+3+7>>>3,G<=Y)Y=G}else Y=G=J+5;if(J+4<=Y&&Q!==-1)T2($,Q,J,q);else if($.strategy===BV||G===Y)G0($,(O2<<1)+(q?1:0),3),z2($,h0,W$);else G0($,(vV<<1)+(q?1:0),3),hV($,$.l_desc.max_code+1,$.d_desc.max_code+1,V+1),z2($,$.dyn_ltree,$.dyn_dtree);if(S2($),q)g2($)}function cV($,Q,J){if($.pending_buf[$.d_buf+$.last_lit*2]=Q>>>8&255,$.pending_buf[$.d_buf+$.last_lit*2+1]=Q&255,$.pending_buf[$.l_buf+$.last_lit]=J&255,$.last_lit++,Q===0)$.dyn_ltree[J*2]++;else $.matches++,Q--,$.dyn_ltree[(H$[J]+P$+1)*2]++,$.dyn_dtree[k2(Q)*2]++;return $.last_lit===$.lit_bufsize-1}pV._tr_init=fV;pV._tr_stored_block=T2;pV._tr_flush_block=mV;pV._tr_tally=cV;pV._tr_align=_V});var K5=C((XF,h2)=>{function nV($,Q,J,q){var Y=$&65535|0,G=$>>>16&65535|0,V=0;while(J!==0){V=J>2000?2000:J,J-=V;do Y=Y+Q[q++]|0,G=G+Y|0;while(--V);Y%=65521,G%=65521}return Y|G<<16|0}h2.exports=nV});var X5=C((WF,b2)=>{function rV(){var $,Q=[];for(var J=0;J<256;J++){$=J;for(var q=0;q<8;q++)$=$&1?3988292384^$>>>1:$>>>1;Q[J]=$}return Q}var aV=rV();function sV($,Q,J,q){var Y=aV,G=q+J;$^=-1;for(var V=q;V<G;V++)$=$>>>8^Y[($^Q[V])&255];return $^-1}b2.exports=sV});var K6=C((UF,f2)=>{f2.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 i2=C((EK)=>{var Q0=y0(),j0=y2(),p2=K5(),u0=X5(),tV=K6(),V1=0,eV=1,$K=3,n0=4,_2=5,A0=0,m2=1,H0=-2,QK=-3,W5=-5,JK=-1,qK=1,X6=2,YK=3,GK=4,VK=0,KK=2,H6=8,XK=9,WK=15,UK=8,jK=29,HK=256,j5=HK+1+jK,FK=30,PK=19,ZK=2*j5+1,zK=15,x=3,o0=258,L0=o0+x+1,LK=32,F6=42,H5=69,W6=73,U6=91,j6=103,q1=113,z$=666,d=1,L$=2,Y1=3,E1=4,MK=3;function i0($,Q){return $.msg=tV[Q],Q}function c2($){return($<<1)-($>4?9:0)}function l0($){var Q=$.length;while(--Q>=0)$[Q]=0}function d0($){var Q=$.state,J=Q.pending;if(J>$.avail_out)J=$.avail_out;if(J===0)return;if(Q0.arraySet($.output,Q.pending_buf,Q.pending_out,J,$.next_out),$.next_out+=J,Q.pending_out+=J,$.total_out+=J,$.avail_out-=J,Q.pending-=J,Q.pending===0)Q.pending_out=0}function a($,Q){j0._tr_flush_block($,$.block_start>=0?$.block_start:-1,$.strstart-$.block_start,Q),$.block_start=$.strstart,d0($.strm)}function S($,Q){$.pending_buf[$.pending++]=Q}function Z$($,Q){$.pending_buf[$.pending++]=Q>>>8&255,$.pending_buf[$.pending++]=Q&255}function IK($,Q,J,q){var Y=$.avail_in;if(Y>q)Y=q;if(Y===0)return 0;if($.avail_in-=Y,Q0.arraySet(Q,$.input,$.next_in,Y,J),$.state.wrap===1)$.adler=p2($.adler,Q,Y,J);else if($.state.wrap===2)$.adler=u0($.adler,Q,Y,J);return $.next_in+=Y,$.total_in+=Y,Y}function u2($,Q){var{max_chain_length:J,strstart:q}=$,Y,G,V=$.prev_length,K=$.nice_match,U=$.strstart>$.w_size-L0?$.strstart-($.w_size-L0):0,X=$.window,W=$.w_mask,H=$.prev,j=$.strstart+o0,F=X[q+V-1],Z=X[q+V];if($.prev_length>=$.good_match)J>>=2;if(K>$.lookahead)K=$.lookahead;do{if(Y=Q,X[Y+V]!==Z||X[Y+V-1]!==F||X[Y]!==X[q]||X[++Y]!==X[q+1])continue;q+=2,Y++;do;while(X[++q]===X[++Y]&&X[++q]===X[++Y]&&X[++q]===X[++Y]&&X[++q]===X[++Y]&&X[++q]===X[++Y]&&X[++q]===X[++Y]&&X[++q]===X[++Y]&&X[++q]===X[++Y]&&q<j);if(G=o0-(j-q),q=j-o0,G>V){if($.match_start=Q,V=G,G>=K)break;F=X[q+V-1],Z=X[q+V]}}while((Q=H[Q&W])>U&&--J!==0);if(V<=$.lookahead)return V;return $.lookahead}function G1($){var Q=$.w_size,J,q,Y,G,V;do{if(G=$.window_size-$.lookahead-$.strstart,$.strstart>=Q+(Q-L0)){Q0.arraySet($.window,$.window,Q,Q,0),$.match_start-=Q,$.strstart-=Q,$.block_start-=Q,q=$.hash_size,J=q;do Y=$.head[--J],$.head[J]=Y>=Q?Y-Q:0;while(--q);q=Q,J=q;do Y=$.prev[--J],$.prev[J]=Y>=Q?Y-Q:0;while(--q);G+=Q}if($.strm.avail_in===0)break;if(q=IK($.strm,$.window,$.strstart+$.lookahead,G),$.lookahead+=q,$.lookahead+$.insert>=x){V=$.strstart-$.insert,$.ins_h=$.window[V],$.ins_h=($.ins_h<<$.hash_shift^$.window[V+1])&$.hash_mask;while($.insert)if($.ins_h=($.ins_h<<$.hash_shift^$.window[V+x-1])&$.hash_mask,$.prev[V&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=V,V++,$.insert--,$.lookahead+$.insert<x)break}}while($.lookahead<L0&&$.strm.avail_in!==0)}function OK($,Q){var J=65535;if(J>$.pending_buf_size-5)J=$.pending_buf_size-5;for(;;){if($.lookahead<=1){if(G1($),$.lookahead===0&&Q===V1)return d;if($.lookahead===0)break}$.strstart+=$.lookahead,$.lookahead=0;var q=$.block_start+J;if($.strstart===0||$.strstart>=q){if($.lookahead=$.strstart-q,$.strstart=q,a($,!1),$.strm.avail_out===0)return d}if($.strstart-$.block_start>=$.w_size-L0){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.strstart>$.block_start){if(a($,!1),$.strm.avail_out===0)return d}return d}function U5($,Q){var J,q;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===V1)return d;if($.lookahead===0)break}if(J=0,$.lookahead>=x)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if(J!==0&&$.strstart-J<=$.w_size-L0)$.match_length=u2($,J);if($.match_length>=x)if(q=j0._tr_tally($,$.strstart-$.match_start,$.match_length-x),$.lookahead-=$.match_length,$.match_length<=$.max_lazy_match&&$.lookahead>=x){$.match_length--;do $.strstart++,$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.match_length!==0);$.strstart++}else $.strstart+=$.match_length,$.match_length=0,$.ins_h=$.window[$.strstart],$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+1])&$.hash_mask;else q=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(q){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=$.strstart<x-1?$.strstart:x-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function R1($,Q){var J,q,Y;for(;;){if($.lookahead<L0){if(G1($),$.lookahead<L0&&Q===V1)return d;if($.lookahead===0)break}if(J=0,$.lookahead>=x)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;if($.prev_length=$.match_length,$.prev_match=$.match_start,$.match_length=x-1,J!==0&&$.prev_length<$.max_lazy_match&&$.strstart-J<=$.w_size-L0){if($.match_length=u2($,J),$.match_length<=5&&($.strategy===qK||$.match_length===x&&$.strstart-$.match_start>4096))$.match_length=x-1}if($.prev_length>=x&&$.match_length<=$.prev_length){Y=$.strstart+$.lookahead-x,q=j0._tr_tally($,$.strstart-1-$.prev_match,$.prev_length-x),$.lookahead-=$.prev_length-1,$.prev_length-=2;do if(++$.strstart<=Y)$.ins_h=($.ins_h<<$.hash_shift^$.window[$.strstart+x-1])&$.hash_mask,J=$.prev[$.strstart&$.w_mask]=$.head[$.ins_h],$.head[$.ins_h]=$.strstart;while(--$.prev_length!==0);if($.match_available=0,$.match_length=x-1,$.strstart++,q){if(a($,!1),$.strm.avail_out===0)return d}}else if($.match_available){if(q=j0._tr_tally($,0,$.window[$.strstart-1]),q)a($,!1);if($.strstart++,$.lookahead--,$.strm.avail_out===0)return d}else $.match_available=1,$.strstart++,$.lookahead--}if($.match_available)q=j0._tr_tally($,0,$.window[$.strstart-1]),$.match_available=0;if($.insert=$.strstart<x-1?$.strstart:x-1,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function NK($,Q){var J,q,Y,G,V=$.window;for(;;){if($.lookahead<=o0){if(G1($),$.lookahead<=o0&&Q===V1)return d;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=x&&$.strstart>0){if(Y=$.strstart-1,q=V[Y],q===V[++Y]&&q===V[++Y]&&q===V[++Y]){G=$.strstart+o0;do;while(q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&q===V[++Y]&&Y<G);if($.match_length=o0-(G-Y),$.match_length>$.lookahead)$.match_length=$.lookahead}}if($.match_length>=x)J=j0._tr_tally($,1,$.match_length-x),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0;else J=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++;if(J){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function BK($,Q){var J;for(;;){if($.lookahead===0){if(G1($),$.lookahead===0){if(Q===V1)return d;break}}if($.match_length=0,J=j0._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,J){if(a($,!1),$.strm.avail_out===0)return d}}if($.insert=0,Q===n0){if(a($,!0),$.strm.avail_out===0)return Y1;return E1}if($.last_lit){if(a($,!1),$.strm.avail_out===0)return d}return L$}function C0($,Q,J,q,Y){this.good_length=$,this.max_lazy=Q,this.nice_length=J,this.max_chain=q,this.func=Y}var k1;k1=[new C0(0,0,0,0,OK),new C0(4,4,8,4,U5),new C0(4,5,16,8,U5),new C0(4,6,32,32,U5),new C0(4,4,16,16,R1),new C0(8,16,32,32,R1),new C0(8,16,128,128,R1),new C0(8,32,128,256,R1),new C0(32,128,258,1024,R1),new C0(32,258,258,4096,R1)];function DK($){$.window_size=2*$.w_size,l0($.head),$.max_lazy_match=k1[$.level].max_lazy,$.good_match=k1[$.level].good_length,$.nice_match=k1[$.level].nice_length,$.max_chain_length=k1[$.level].max_chain,$.strstart=0,$.block_start=0,$.lookahead=0,$.insert=0,$.match_length=$.prev_length=x-1,$.match_available=0,$.ins_h=0}function wK(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=H6,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Q0.Buf16(ZK*2),this.dyn_dtree=new Q0.Buf16((2*FK+1)*2),this.bl_tree=new Q0.Buf16((2*PK+1)*2),l0(this.dyn_ltree),l0(this.dyn_dtree),l0(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Q0.Buf16(zK+1),this.heap=new Q0.Buf16(2*j5+1),l0(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Q0.Buf16(2*j5+1),l0(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function d2($){var Q;if(!$||!$.state)return i0($,H0);if($.total_in=$.total_out=0,$.data_type=KK,Q=$.state,Q.pending=0,Q.pending_out=0,Q.wrap<0)Q.wrap=-Q.wrap;return Q.status=Q.wrap?F6:q1,$.adler=Q.wrap===2?0:1,Q.last_flush=V1,j0._tr_init(Q),A0}function l2($){var Q=d2($);if(Q===A0)DK($.state);return Q}function vK($,Q){if(!$||!$.state)return H0;if($.state.wrap!==2)return H0;return $.state.gzhead=Q,A0}function o2($,Q,J,q,Y,G){if(!$)return H0;var V=1;if(Q===JK)Q=6;if(q<0)V=0,q=-q;else if(q>15)V=2,q-=16;if(Y<1||Y>XK||J!==H6||q<8||q>15||Q<0||Q>9||G<0||G>GK)return i0($,H0);if(q===8)q=9;var K=new wK;return $.state=K,K.strm=$,K.wrap=V,K.gzhead=null,K.w_bits=q,K.w_size=1<<K.w_bits,K.w_mask=K.w_size-1,K.hash_bits=Y+7,K.hash_size=1<<K.hash_bits,K.hash_mask=K.hash_size-1,K.hash_shift=~~((K.hash_bits+x-1)/x),K.window=new Q0.Buf8(K.w_size*2),K.head=new Q0.Buf16(K.hash_size),K.prev=new Q0.Buf16(K.w_size),K.lit_bufsize=1<<Y+6,K.pending_buf_size=K.lit_bufsize*4,K.pending_buf=new Q0.Buf8(K.pending_buf_size),K.d_buf=1*K.lit_bufsize,K.l_buf=3*K.lit_bufsize,K.level=Q,K.strategy=G,K.method=J,l2($)}function CK($,Q){return o2($,Q,H6,WK,UK,VK)}function AK($,Q){var J,q,Y,G;if(!$||!$.state||Q>_2||Q<0)return $?i0($,H0):H0;if(q=$.state,!$.output||!$.input&&$.avail_in!==0||q.status===z$&&Q!==n0)return i0($,$.avail_out===0?W5:H0);if(q.strm=$,J=q.last_flush,q.last_flush=Q,q.status===F6)if(q.wrap===2)if($.adler=0,S(q,31),S(q,139),S(q,8),!q.gzhead)S(q,0),S(q,0),S(q,0),S(q,0),S(q,0),S(q,q.level===9?2:q.strategy>=X6||q.level<2?4:0),S(q,MK),q.status=q1;else{if(S(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(!q.gzhead.extra?0:4)+(!q.gzhead.name?0:8)+(!q.gzhead.comment?0:16)),S(q,q.gzhead.time&255),S(q,q.gzhead.time>>8&255),S(q,q.gzhead.time>>16&255),S(q,q.gzhead.time>>24&255),S(q,q.level===9?2:q.strategy>=X6||q.level<2?4:0),S(q,q.gzhead.os&255),q.gzhead.extra&&q.gzhead.extra.length)S(q,q.gzhead.extra.length&255),S(q,q.gzhead.extra.length>>8&255);if(q.gzhead.hcrc)$.adler=u0($.adler,q.pending_buf,q.pending,0);q.gzindex=0,q.status=H5}else{var V=H6+(q.w_bits-8<<4)<<8,K=-1;if(q.strategy>=X6||q.level<2)K=0;else if(q.level<6)K=1;else if(q.level===6)K=2;else K=3;if(V|=K<<6,q.strstart!==0)V|=LK;if(V+=31-V%31,q.status=q1,Z$(q,V),q.strstart!==0)Z$(q,$.adler>>>16),Z$(q,$.adler&65535);$.adler=1}if(q.status===H5)if(q.gzhead.extra){Y=q.pending;while(q.gzindex<(q.gzhead.extra.length&65535)){if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size)break}S(q,q.gzhead.extra[q.gzindex]&255),q.gzindex++}if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(q.gzindex===q.gzhead.extra.length)q.gzindex=0,q.status=W6}else q.status=W6;if(q.status===W6)if(q.gzhead.name){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.name.length)G=q.gzhead.name.charCodeAt(q.gzindex++)&255;else G=0;S(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.gzindex=0,q.status=U6}else q.status=U6;if(q.status===U6)if(q.gzhead.comment){Y=q.pending;do{if(q.pending===q.pending_buf_size){if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(d0($),Y=q.pending,q.pending===q.pending_buf_size){G=1;break}}if(q.gzindex<q.gzhead.comment.length)G=q.gzhead.comment.charCodeAt(q.gzindex++)&255;else G=0;S(q,G)}while(G!==0);if(q.gzhead.hcrc&&q.pending>Y)$.adler=u0($.adler,q.pending_buf,q.pending-Y,Y);if(G===0)q.status=j6}else q.status=j6;if(q.status===j6)if(q.gzhead.hcrc){if(q.pending+2>q.pending_buf_size)d0($);if(q.pending+2<=q.pending_buf_size)S(q,$.adler&255),S(q,$.adler>>8&255),$.adler=0,q.status=q1}else q.status=q1;if(q.pending!==0){if(d0($),$.avail_out===0)return q.last_flush=-1,A0}else if($.avail_in===0&&c2(Q)<=c2(J)&&Q!==n0)return i0($,W5);if(q.status===z$&&$.avail_in!==0)return i0($,W5);if($.avail_in!==0||q.lookahead!==0||Q!==V1&&q.status!==z$){var U=q.strategy===X6?BK(q,Q):q.strategy===YK?NK(q,Q):k1[q.level].func(q,Q);if(U===Y1||U===E1)q.status=z$;if(U===d||U===Y1){if($.avail_out===0)q.last_flush=-1;return A0}if(U===L$){if(Q===eV)j0._tr_align(q);else if(Q!==_2){if(j0._tr_stored_block(q,0,0,!1),Q===$K){if(l0(q.head),q.lookahead===0)q.strstart=0,q.block_start=0,q.insert=0}}if(d0($),$.avail_out===0)return q.last_flush=-1,A0}}if(Q!==n0)return A0;if(q.wrap<=0)return m2;if(q.wrap===2)S(q,$.adler&255),S(q,$.adler>>8&255),S(q,$.adler>>16&255),S(q,$.adler>>24&255),S(q,$.total_in&255),S(q,$.total_in>>8&255),S(q,$.total_in>>16&255),S(q,$.total_in>>24&255);else Z$(q,$.adler>>>16),Z$(q,$.adler&65535);if(d0($),q.wrap>0)q.wrap=-q.wrap;return q.pending!==0?A0:m2}function RK($){var Q;if(!$||!$.state)return H0;if(Q=$.state.status,Q!==F6&&Q!==H5&&Q!==W6&&Q!==U6&&Q!==j6&&Q!==q1&&Q!==z$)return i0($,H0);return $.state=null,Q===q1?i0($,QK):A0}function kK($,Q){var J=Q.length,q,Y,G,V,K,U,X,W;if(!$||!$.state)return H0;if(q=$.state,V=q.wrap,V===2||V===1&&q.status!==F6||q.lookahead)return H0;if(V===1)$.adler=p2($.adler,Q,J,0);if(q.wrap=0,J>=q.w_size){if(V===0)l0(q.head),q.strstart=0,q.block_start=0,q.insert=0;W=new Q0.Buf8(q.w_size),Q0.arraySet(W,Q,J-q.w_size,q.w_size,0),Q=W,J=q.w_size}K=$.avail_in,U=$.next_in,X=$.input,$.avail_in=J,$.next_in=0,$.input=Q,G1(q);while(q.lookahead>=x){Y=q.strstart,G=q.lookahead-(x-1);do q.ins_h=(q.ins_h<<q.hash_shift^q.window[Y+x-1])&q.hash_mask,q.prev[Y&q.w_mask]=q.head[q.ins_h],q.head[q.ins_h]=Y,Y++;while(--G);q.strstart=Y,q.lookahead=x-1,G1(q)}return q.strstart+=q.lookahead,q.block_start=q.strstart,q.insert=q.lookahead,q.lookahead=0,q.match_length=q.prev_length=x-1,q.match_available=0,$.next_in=U,$.input=X,$.avail_in=K,q.wrap=V,A0}EK.deflateInit=CK;EK.deflateInit2=o2;EK.deflateReset=l2;EK.deflateResetKeep=d2;EK.deflateSetHeader=vK;EK.deflate=AK;EK.deflateEnd=RK;EK.deflateSetDictionary=kK;EK.deflateInfo="pako deflate (from Nodeca project)"});var F5=C((mK)=>{var P6=y0(),n2=!0,r2=!0;try{String.fromCharCode.apply(null,[0])}catch($){n2=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch($){r2=!1}var M$=new P6.Buf8(256);for(R0=0;R0<256;R0++)M$[R0]=R0>=252?6:R0>=248?5:R0>=240?4:R0>=224?3:R0>=192?2:1;var R0;M$[254]=M$[254]=1;mK.string2buf=function($){var Q,J,q,Y,G,V=$.length,K=0;for(Y=0;Y<V;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}K+=J<128?1:J<2048?2:J<65536?3:4}Q=new P6.Buf8(K);for(G=0,Y=0;G<K;Y++){if(J=$.charCodeAt(Y),(J&64512)===55296&&Y+1<V){if(q=$.charCodeAt(Y+1),(q&64512)===56320)J=65536+(J-55296<<10)+(q-56320),Y++}if(J<128)Q[G++]=J;else if(J<2048)Q[G++]=192|J>>>6,Q[G++]=128|J&63;else if(J<65536)Q[G++]=224|J>>>12,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63;else Q[G++]=240|J>>>18,Q[G++]=128|J>>>12&63,Q[G++]=128|J>>>6&63,Q[G++]=128|J&63}return Q};function a2($,Q){if(Q<65534){if($.subarray&&r2||!$.subarray&&n2)return String.fromCharCode.apply(null,P6.shrinkBuf($,Q))}var J="";for(var q=0;q<Q;q++)J+=String.fromCharCode($[q]);return J}mK.buf2binstring=function($){return a2($,$.length)};mK.binstring2buf=function($){var Q=new P6.Buf8($.length);for(var J=0,q=Q.length;J<q;J++)Q[J]=$.charCodeAt(J);return Q};mK.buf2string=function($,Q){var J,q,Y,G,V=Q||$.length,K=Array(V*2);for(q=0,J=0;J<V;){if(Y=$[J++],Y<128){K[q++]=Y;continue}if(G=M$[Y],G>4){K[q++]=65533,J+=G-1;continue}Y&=G===2?31:G===3?15:7;while(G>1&&J<V)Y=Y<<6|$[J++]&63,G--;if(G>1){K[q++]=65533;continue}if(Y<65536)K[q++]=Y;else Y-=65536,K[q++]=55296|Y>>10&1023,K[q++]=56320|Y&1023}return a2(K,q)};mK.utf8border=function($,Q){var J;if(Q=Q||$.length,Q>$.length)Q=$.length;J=Q-1;while(J>=0&&($[J]&192)===128)J--;if(J<0)return Q;if(J===0)return Q;return J+M$[$[J]]>Q?J:Q}});var P5=C((FF,s2)=>{function oK(){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}s2.exports=oK});var Q7=C(($X)=>{var I$=i2(),O$=y0(),z5=F5(),L5=K6(),iK=P5(),$7=Object.prototype.toString,nK=0,Z5=4,x1=0,t2=1,e2=2,rK=-1,aK=0,sK=8;function K1($){if(!(this instanceof K1))return new K1($);this.options=O$.assign({level:rK,method:sK,chunkSize:16384,windowBits:15,memLevel:8,strategy:aK,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 iK,this.strm.avail_out=0;var J=I$.deflateInit2(this.strm,Q.level,Q.method,Q.windowBits,Q.memLevel,Q.strategy);if(J!==x1)throw Error(L5[J]);if(Q.header)I$.deflateSetHeader(this.strm,Q.header);if(Q.dictionary){var q;if(typeof Q.dictionary==="string")q=z5.string2buf(Q.dictionary);else if($7.call(Q.dictionary)==="[object ArrayBuffer]")q=new Uint8Array(Q.dictionary);else q=Q.dictionary;if(J=I$.deflateSetDictionary(this.strm,q),J!==x1)throw Error(L5[J]);this._dict_set=!0}}K1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y,G;if(this.ended)return!1;if(G=Q===~~Q?Q:Q===!0?Z5:nK,typeof $==="string")J.input=z5.string2buf($);else if($7.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new O$.Buf8(q),J.next_out=0,J.avail_out=q;if(Y=I$.deflate(J,G),Y!==t2&&Y!==x1)return this.onEnd(Y),this.ended=!0,!1;if(J.avail_out===0||J.avail_in===0&&(G===Z5||G===e2))if(this.options.to==="string")this.onData(z5.buf2binstring(O$.shrinkBuf(J.output,J.next_out)));else this.onData(O$.shrinkBuf(J.output,J.next_out))}while((J.avail_in>0||J.avail_out===0)&&Y!==t2);if(G===Z5)return Y=I$.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===x1;if(G===e2)return this.onEnd(x1),J.avail_out=0,!0;return!0};K1.prototype.onData=function($){this.chunks.push($)};K1.prototype.onEnd=function($){if($===x1)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=O$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function M5($,Q){var J=new K1(Q);if(J.push($,!0),J.err)throw J.msg||L5[J.err];return J.result}function tK($,Q){return Q=Q||{},Q.raw=!0,M5($,Q)}function eK($,Q){return Q=Q||{},Q.gzip=!0,M5($,Q)}$X.Deflate=K1;$X.deflate=M5;$X.deflateRaw=tK;$X.gzip=eK});var q7=C((ZF,J7)=>{var Z6=30,GX=12;J7.exports=function(Q,J){var q,Y,G,V,K,U,X,W,H,j,F,Z,L,N,I,P,B,M,z,D,w,v,k,E,A;q=Q.state,Y=Q.next_in,E=Q.input,G=Y+(Q.avail_in-5),V=Q.next_out,A=Q.output,K=V-(J-Q.avail_out),U=V+(Q.avail_out-257),X=q.dmax,W=q.wsize,H=q.whave,j=q.wnext,F=q.window,Z=q.hold,L=q.bits,N=q.lencode,I=q.distcode,P=(1<<q.lenbits)-1,B=(1<<q.distbits)-1;$:do{if(L<15)Z+=E[Y++]<<L,L+=8,Z+=E[Y++]<<L,L+=8;M=N[Z&P];Q:for(;;){if(z=M>>>24,Z>>>=z,L-=z,z=M>>>16&255,z===0)A[V++]=M&65535;else if(z&16){if(D=M&65535,z&=15,z){if(L<z)Z+=E[Y++]<<L,L+=8;D+=Z&(1<<z)-1,Z>>>=z,L-=z}if(L<15)Z+=E[Y++]<<L,L+=8,Z+=E[Y++]<<L,L+=8;M=I[Z&B];J:for(;;){if(z=M>>>24,Z>>>=z,L-=z,z=M>>>16&255,z&16){if(w=M&65535,z&=15,L<z){if(Z+=E[Y++]<<L,L+=8,L<z)Z+=E[Y++]<<L,L+=8}if(w+=Z&(1<<z)-1,w>X){Q.msg="invalid distance too far back",q.mode=Z6;break $}if(Z>>>=z,L-=z,z=V-K,w>z){if(z=w-z,z>H){if(q.sane){Q.msg="invalid distance too far back",q.mode=Z6;break $}}if(v=0,k=F,j===0){if(v+=W-z,z<D){D-=z;do A[V++]=F[v++];while(--z);v=V-w,k=A}}else if(j<z){if(v+=W+j-z,z-=j,z<D){D-=z;do A[V++]=F[v++];while(--z);if(v=0,j<D){z=j,D-=z;do A[V++]=F[v++];while(--z);v=V-w,k=A}}}else if(v+=j-z,z<D){D-=z;do A[V++]=F[v++];while(--z);v=V-w,k=A}while(D>2)A[V++]=k[v++],A[V++]=k[v++],A[V++]=k[v++],D-=3;if(D){if(A[V++]=k[v++],D>1)A[V++]=k[v++]}}else{v=V-w;do A[V++]=A[v++],A[V++]=A[v++],A[V++]=A[v++],D-=3;while(D>2);if(D){if(A[V++]=A[v++],D>1)A[V++]=A[v++]}}}else if((z&64)===0){M=I[(M&65535)+(Z&(1<<z)-1)];continue J}else{Q.msg="invalid distance code",q.mode=Z6;break $}break}}else if((z&64)===0){M=N[(M&65535)+(Z&(1<<z)-1)];continue Q}else if(z&32){q.mode=GX;break $}else{Q.msg="invalid literal/length code",q.mode=Z6;break $}break}}while(Y<G&&V<U);D=L>>3,Y-=D,L-=D<<3,Z&=(1<<L)-1,Q.next_in=Y,Q.next_out=V,Q.avail_in=Y<G?5+(G-Y):5-(Y-G),Q.avail_out=V<U?257+(U-V):257-(V-U),q.hold=Z,q.bits=L;return}});var U7=C((zF,W7)=>{var Y7=y0(),S1=15,G7=852,V7=592,K7=0,I5=1,X7=2,VX=[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],KX=[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],XX=[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],WX=[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];W7.exports=function(Q,J,q,Y,G,V,K,U){var X=U.bits,W=0,H=0,j=0,F=0,Z=0,L=0,N=0,I=0,P=0,B=0,M,z,D,w,v,k=null,E=0,A,o=new Y7.Buf16(S1+1),X0=new Y7.Buf16(S1+1),y=null,e=0,W0,q0,E0;for(W=0;W<=S1;W++)o[W]=0;for(H=0;H<Y;H++)o[J[q+H]]++;Z=X;for(F=S1;F>=1;F--)if(o[F]!==0)break;if(Z>F)Z=F;if(F===0)return G[V++]=20971520,G[V++]=20971520,U.bits=1,0;for(j=1;j<F;j++)if(o[j]!==0)break;if(Z<j)Z=j;I=1;for(W=1;W<=S1;W++)if(I<<=1,I-=o[W],I<0)return-1;if(I>0&&(Q===K7||F!==1))return-1;X0[1]=0;for(W=1;W<S1;W++)X0[W+1]=X0[W]+o[W];for(H=0;H<Y;H++)if(J[q+H]!==0)K[X0[J[q+H]]++]=H;if(Q===K7)k=y=K,A=19;else if(Q===I5)k=VX,E-=257,y=KX,e-=257,A=256;else k=XX,y=WX,A=-1;if(B=0,H=0,W=j,v=V,L=Z,N=0,D=-1,P=1<<Z,w=P-1,Q===I5&&P>G7||Q===X7&&P>V7)return 1;for(;;){if(W0=W-N,K[H]<A)q0=0,E0=K[H];else if(K[H]>A)q0=y[e+K[H]],E0=k[E+K[H]];else q0=96,E0=0;M=1<<W-N,z=1<<L,j=z;do z-=M,G[v+(B>>N)+z]=W0<<24|q0<<16|E0|0;while(z!==0);M=1<<W-1;while(B&M)M>>=1;if(M!==0)B&=M-1,B+=M;else B=0;if(H++,--o[W]===0){if(W===F)break;W=J[q+K[H]]}if(W>Z&&(B&w)!==D){if(N===0)N=Z;v+=j,L=W-N,I=1<<L;while(L+N<F){if(I-=o[L+N],I<=0)break;L++,I<<=1}if(P+=1<<L,Q===I5&&P>G7||Q===X7&&P>V7)return 1;D=B&w,G[D]=Z<<24|L<<16|v-V|0}}if(B!==0)G[v+B]=W-N<<24|4194304|0;return U.bits=Z,0}});var l7=C((RX)=>{var K0=y0(),v5=K5(),k0=X5(),UX=q7(),N$=U7(),jX=0,h7=1,b7=2,j7=4,HX=5,z6=6,X1=0,FX=1,PX=2,F0=-2,f7=-3,C5=-4,ZX=-5,H7=8,_7=1,F7=2,P7=3,Z7=4,z7=5,L7=6,M7=7,I7=8,O7=9,N7=10,I6=11,b0=12,O5=13,B7=14,N5=15,D7=16,w7=17,v7=18,C7=19,L6=20,M6=21,A7=22,R7=23,k7=24,E7=25,x7=26,B5=27,S7=28,g7=29,_=30,A5=31,zX=32,LX=852,MX=592,IX=15,OX=IX;function T7($){return($>>>24&255)+($>>>8&65280)+(($&65280)<<8)+(($&255)<<24)}function NX(){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 K0.Buf16(320),this.work=new K0.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m7($){var Q;if(!$||!$.state)return F0;if(Q=$.state,$.total_in=$.total_out=Q.total=0,$.msg="",Q.wrap)$.adler=Q.wrap&1;return Q.mode=_7,Q.last=0,Q.havedict=0,Q.dmax=32768,Q.head=null,Q.hold=0,Q.bits=0,Q.lencode=Q.lendyn=new K0.Buf32(LX),Q.distcode=Q.distdyn=new K0.Buf32(MX),Q.sane=1,Q.back=-1,X1}function c7($){var Q;if(!$||!$.state)return F0;return Q=$.state,Q.wsize=0,Q.whave=0,Q.wnext=0,m7($)}function p7($,Q){var J,q;if(!$||!$.state)return F0;if(q=$.state,Q<0)J=0,Q=-Q;else if(J=(Q>>4)+1,Q<48)Q&=15;if(Q&&(Q<8||Q>15))return F0;if(q.window!==null&&q.wbits!==Q)q.window=null;return q.wrap=J,q.wbits=Q,c7($)}function u7($,Q){var J,q;if(!$)return F0;if(q=new NX,$.state=q,q.window=null,J=p7($,Q),J!==X1)$.state=null;return J}function BX($){return u7($,OX)}var y7=!0,D5,w5;function DX($){if(y7){var Q;D5=new K0.Buf32(512),w5=new K0.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;N$(h7,$.lens,0,288,D5,0,$.work,{bits:9}),Q=0;while(Q<32)$.lens[Q++]=5;N$(b7,$.lens,0,32,w5,0,$.work,{bits:5}),y7=!1}$.lencode=D5,$.lenbits=9,$.distcode=w5,$.distbits=5}function d7($,Q,J,q){var Y,G=$.state;if(G.window===null)G.wsize=1<<G.wbits,G.wnext=0,G.whave=0,G.window=new K0.Buf8(G.wsize);if(q>=G.wsize)K0.arraySet(G.window,Q,J-G.wsize,G.wsize,0),G.wnext=0,G.whave=G.wsize;else{if(Y=G.wsize-G.wnext,Y>q)Y=q;if(K0.arraySet(G.window,Q,J-q,Y,G.wnext),q-=Y,q)K0.arraySet(G.window,Q,J-q,q,0),G.wnext=q,G.whave=G.wsize;else{if(G.wnext+=Y,G.wnext===G.wsize)G.wnext=0;if(G.whave<G.wsize)G.whave+=Y}}return 0}function wX($,Q){var J,q,Y,G,V,K,U,X,W,H,j,F,Z,L,N=0,I,P,B,M,z,D,w,v,k=new K0.Buf8(4),E,A,o=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!$||!$.state||!$.output||!$.input&&$.avail_in!==0)return F0;if(J=$.state,J.mode===b0)J.mode=O5;V=$.next_out,Y=$.output,U=$.avail_out,G=$.next_in,q=$.input,K=$.avail_in,X=J.hold,W=J.bits,H=K,j=U,v=X1;$:for(;;)switch(J.mode){case _7:if(J.wrap===0){J.mode=O5;break}while(W<16){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(J.wrap&2&&X===35615){J.check=0,k[0]=X&255,k[1]=X>>>8&255,J.check=k0(J.check,k,2,0),X=0,W=0,J.mode=F7;break}if(J.flags=0,J.head)J.head.done=!1;if(!(J.wrap&1)||(((X&255)<<8)+(X>>8))%31){$.msg="incorrect header check",J.mode=_;break}if((X&15)!==H7){$.msg="unknown compression method",J.mode=_;break}if(X>>>=4,W-=4,w=(X&15)+8,J.wbits===0)J.wbits=w;else if(w>J.wbits){$.msg="invalid window size",J.mode=_;break}J.dmax=1<<w,$.adler=J.check=1,J.mode=X&512?N7:b0,X=0,W=0;break;case F7:while(W<16){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(J.flags=X,(J.flags&255)!==H7){$.msg="unknown compression method",J.mode=_;break}if(J.flags&57344){$.msg="unknown header flags set",J.mode=_;break}if(J.head)J.head.text=X>>8&1;if(J.flags&512)k[0]=X&255,k[1]=X>>>8&255,J.check=k0(J.check,k,2,0);X=0,W=0,J.mode=P7;case P7:while(W<32){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(J.head)J.head.time=X;if(J.flags&512)k[0]=X&255,k[1]=X>>>8&255,k[2]=X>>>16&255,k[3]=X>>>24&255,J.check=k0(J.check,k,4,0);X=0,W=0,J.mode=Z7;case Z7:while(W<16){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(J.head)J.head.xflags=X&255,J.head.os=X>>8;if(J.flags&512)k[0]=X&255,k[1]=X>>>8&255,J.check=k0(J.check,k,2,0);X=0,W=0,J.mode=z7;case z7:if(J.flags&1024){while(W<16){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(J.length=X,J.head)J.head.extra_len=X;if(J.flags&512)k[0]=X&255,k[1]=X>>>8&255,J.check=k0(J.check,k,2,0);X=0,W=0}else if(J.head)J.head.extra=null;J.mode=L7;case L7:if(J.flags&1024){if(F=J.length,F>K)F=K;if(F){if(J.head){if(w=J.head.extra_len-J.length,!J.head.extra)J.head.extra=Array(J.head.extra_len);K0.arraySet(J.head.extra,q,G,F,w)}if(J.flags&512)J.check=k0(J.check,q,F,G);K-=F,G+=F,J.length-=F}if(J.length)break $}J.length=0,J.mode=M7;case M7:if(J.flags&2048){if(K===0)break $;F=0;do if(w=q[G+F++],J.head&&w&&J.length<65536)J.head.name+=String.fromCharCode(w);while(w&&F<K);if(J.flags&512)J.check=k0(J.check,q,F,G);if(K-=F,G+=F,w)break $}else if(J.head)J.head.name=null;J.length=0,J.mode=I7;case I7:if(J.flags&4096){if(K===0)break $;F=0;do if(w=q[G+F++],J.head&&w&&J.length<65536)J.head.comment+=String.fromCharCode(w);while(w&&F<K);if(J.flags&512)J.check=k0(J.check,q,F,G);if(K-=F,G+=F,w)break $}else if(J.head)J.head.comment=null;J.mode=O7;case O7:if(J.flags&512){while(W<16){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(X!==(J.check&65535)){$.msg="header crc mismatch",J.mode=_;break}X=0,W=0}if(J.head)J.head.hcrc=J.flags>>9&1,J.head.done=!0;$.adler=J.check=0,J.mode=b0;break;case N7:while(W<32){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}$.adler=J.check=T7(X),X=0,W=0,J.mode=I6;case I6:if(J.havedict===0)return $.next_out=V,$.avail_out=U,$.next_in=G,$.avail_in=K,J.hold=X,J.bits=W,PX;$.adler=J.check=1,J.mode=b0;case b0:if(Q===HX||Q===z6)break $;case O5:if(J.last){X>>>=W&7,W-=W&7,J.mode=B5;break}while(W<3){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}switch(J.last=X&1,X>>>=1,W-=1,X&3){case 0:J.mode=B7;break;case 1:if(DX(J),J.mode=L6,Q===z6){X>>>=2,W-=2;break $}break;case 2:J.mode=w7;break;case 3:$.msg="invalid block type",J.mode=_}X>>>=2,W-=2;break;case B7:X>>>=W&7,W-=W&7;while(W<32){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if((X&65535)!==(X>>>16^65535)){$.msg="invalid stored block lengths",J.mode=_;break}if(J.length=X&65535,X=0,W=0,J.mode=N5,Q===z6)break $;case N5:J.mode=D7;case D7:if(F=J.length,F){if(F>K)F=K;if(F>U)F=U;if(F===0)break $;K0.arraySet(Y,q,G,F,V),K-=F,G+=F,U-=F,V+=F,J.length-=F;break}J.mode=b0;break;case w7:while(W<14){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(J.nlen=(X&31)+257,X>>>=5,W-=5,J.ndist=(X&31)+1,X>>>=5,W-=5,J.ncode=(X&15)+4,X>>>=4,W-=4,J.nlen>286||J.ndist>30){$.msg="too many length or distance symbols",J.mode=_;break}J.have=0,J.mode=v7;case v7:while(J.have<J.ncode){while(W<3){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}J.lens[o[J.have++]]=X&7,X>>>=3,W-=3}while(J.have<19)J.lens[o[J.have++]]=0;if(J.lencode=J.lendyn,J.lenbits=7,E={bits:J.lenbits},v=N$(jX,J.lens,0,19,J.lencode,0,J.work,E),J.lenbits=E.bits,v){$.msg="invalid code lengths set",J.mode=_;break}J.have=0,J.mode=C7;case C7:while(J.have<J.nlen+J.ndist){for(;;){if(N=J.lencode[X&(1<<J.lenbits)-1],I=N>>>24,P=N>>>16&255,B=N&65535,I<=W)break;if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(B<16)X>>>=I,W-=I,J.lens[J.have++]=B;else{if(B===16){A=I+2;while(W<A){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(X>>>=I,W-=I,J.have===0){$.msg="invalid bit length repeat",J.mode=_;break}w=J.lens[J.have-1],F=3+(X&3),X>>>=2,W-=2}else if(B===17){A=I+3;while(W<A){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}X>>>=I,W-=I,w=0,F=3+(X&7),X>>>=3,W-=3}else{A=I+7;while(W<A){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}X>>>=I,W-=I,w=0,F=11+(X&127),X>>>=7,W-=7}if(J.have+F>J.nlen+J.ndist){$.msg="invalid bit length repeat",J.mode=_;break}while(F--)J.lens[J.have++]=w}}if(J.mode===_)break;if(J.lens[256]===0){$.msg="invalid code -- missing end-of-block",J.mode=_;break}if(J.lenbits=9,E={bits:J.lenbits},v=N$(h7,J.lens,0,J.nlen,J.lencode,0,J.work,E),J.lenbits=E.bits,v){$.msg="invalid literal/lengths set",J.mode=_;break}if(J.distbits=6,J.distcode=J.distdyn,E={bits:J.distbits},v=N$(b7,J.lens,J.nlen,J.ndist,J.distcode,0,J.work,E),J.distbits=E.bits,v){$.msg="invalid distances set",J.mode=_;break}if(J.mode=L6,Q===z6)break $;case L6:J.mode=M6;case M6:if(K>=6&&U>=258){if($.next_out=V,$.avail_out=U,$.next_in=G,$.avail_in=K,J.hold=X,J.bits=W,UX($,j),V=$.next_out,Y=$.output,U=$.avail_out,G=$.next_in,q=$.input,K=$.avail_in,X=J.hold,W=J.bits,J.mode===b0)J.back=-1;break}J.back=0;for(;;){if(N=J.lencode[X&(1<<J.lenbits)-1],I=N>>>24,P=N>>>16&255,B=N&65535,I<=W)break;if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(P&&(P&240)===0){M=I,z=P,D=B;for(;;){if(N=J.lencode[D+((X&(1<<M+z)-1)>>M)],I=N>>>24,P=N>>>16&255,B=N&65535,M+I<=W)break;if(K===0)break $;K--,X+=q[G++]<<W,W+=8}X>>>=M,W-=M,J.back+=M}if(X>>>=I,W-=I,J.back+=I,J.length=B,P===0){J.mode=x7;break}if(P&32){J.back=-1,J.mode=b0;break}if(P&64){$.msg="invalid literal/length code",J.mode=_;break}J.extra=P&15,J.mode=A7;case A7:if(J.extra){A=J.extra;while(W<A){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}J.length+=X&(1<<J.extra)-1,X>>>=J.extra,W-=J.extra,J.back+=J.extra}J.was=J.length,J.mode=R7;case R7:for(;;){if(N=J.distcode[X&(1<<J.distbits)-1],I=N>>>24,P=N>>>16&255,B=N&65535,I<=W)break;if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if((P&240)===0){M=I,z=P,D=B;for(;;){if(N=J.distcode[D+((X&(1<<M+z)-1)>>M)],I=N>>>24,P=N>>>16&255,B=N&65535,M+I<=W)break;if(K===0)break $;K--,X+=q[G++]<<W,W+=8}X>>>=M,W-=M,J.back+=M}if(X>>>=I,W-=I,J.back+=I,P&64){$.msg="invalid distance code",J.mode=_;break}J.offset=B,J.extra=P&15,J.mode=k7;case k7:if(J.extra){A=J.extra;while(W<A){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}J.offset+=X&(1<<J.extra)-1,X>>>=J.extra,W-=J.extra,J.back+=J.extra}if(J.offset>J.dmax){$.msg="invalid distance too far back",J.mode=_;break}J.mode=E7;case E7:if(U===0)break $;if(F=j-U,J.offset>F){if(F=J.offset-F,F>J.whave){if(J.sane){$.msg="invalid distance too far back",J.mode=_;break}}if(F>J.wnext)F-=J.wnext,Z=J.wsize-F;else Z=J.wnext-F;if(F>J.length)F=J.length;L=J.window}else L=Y,Z=V-J.offset,F=J.length;if(F>U)F=U;U-=F,J.length-=F;do Y[V++]=L[Z++];while(--F);if(J.length===0)J.mode=M6;break;case x7:if(U===0)break $;Y[V++]=J.length,U--,J.mode=M6;break;case B5:if(J.wrap){while(W<32){if(K===0)break $;K--,X|=q[G++]<<W,W+=8}if(j-=U,$.total_out+=j,J.total+=j,j)$.adler=J.check=J.flags?k0(J.check,Y,j,V-j):v5(J.check,Y,j,V-j);if(j=U,(J.flags?X:T7(X))!==J.check){$.msg="incorrect data check",J.mode=_;break}X=0,W=0}J.mode=S7;case S7:if(J.wrap&&J.flags){while(W<32){if(K===0)break $;K--,X+=q[G++]<<W,W+=8}if(X!==(J.total&4294967295)){$.msg="incorrect length check",J.mode=_;break}X=0,W=0}J.mode=g7;case g7:v=FX;break $;case _:v=f7;break $;case A5:return C5;case zX:default:return F0}if($.next_out=V,$.avail_out=U,$.next_in=G,$.avail_in=K,J.hold=X,J.bits=W,J.wsize||j!==$.avail_out&&J.mode<_&&(J.mode<B5||Q!==j7)){if(d7($,$.output,$.next_out,j-$.avail_out))return J.mode=A5,C5}if(H-=$.avail_in,j-=$.avail_out,$.total_in+=H,$.total_out+=j,J.total+=j,J.wrap&&j)$.adler=J.check=J.flags?k0(J.check,Y,j,$.next_out-j):v5(J.check,Y,j,$.next_out-j);if($.data_type=J.bits+(J.last?64:0)+(J.mode===b0?128:0)+(J.mode===L6||J.mode===N5?256:0),(H===0&&j===0||Q===j7)&&v===X1)v=ZX;return v}function vX($){if(!$||!$.state)return F0;var Q=$.state;if(Q.window)Q.window=null;return $.state=null,X1}function CX($,Q){var J;if(!$||!$.state)return F0;if(J=$.state,(J.wrap&2)===0)return F0;return J.head=Q,Q.done=!1,X1}function AX($,Q){var J=Q.length,q,Y,G;if(!$||!$.state)return F0;if(q=$.state,q.wrap!==0&&q.mode!==I6)return F0;if(q.mode===I6){if(Y=1,Y=v5(Y,Q,J,0),Y!==q.check)return f7}if(G=d7($,Q,J,J),G)return q.mode=A5,C5;return q.havedict=1,X1}RX.inflateReset=c7;RX.inflateReset2=p7;RX.inflateResetKeep=m7;RX.inflateInit=BX;RX.inflateInit2=u7;RX.inflate=wX;RX.inflateEnd=vX;RX.inflateGetHeader=CX;RX.inflateSetDictionary=AX;RX.inflateInfo="pako inflate (from Nodeca project)"});var R5=C((MF,o7)=>{o7.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 n7=C((IF,i7)=>{function _X(){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}i7.exports=_X});var a7=C((uX)=>{var g1=l7(),B$=y0(),O6=F5(),p=R5(),k5=K6(),mX=P5(),cX=n7(),r7=Object.prototype.toString;function W1($){if(!(this instanceof W1))return new W1($);this.options=B$.assign({chunkSize:16384,windowBits:0,to:""},$||{});var Q=this.options;if(Q.raw&&Q.windowBits>=0&&Q.windowBits<16){if(Q.windowBits=-Q.windowBits,Q.windowBits===0)Q.windowBits=-15}if(Q.windowBits>=0&&Q.windowBits<16&&!($&&$.windowBits))Q.windowBits+=32;if(Q.windowBits>15&&Q.windowBits<48){if((Q.windowBits&15)===0)Q.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new mX,this.strm.avail_out=0;var J=g1.inflateInit2(this.strm,Q.windowBits);if(J!==p.Z_OK)throw Error(k5[J]);if(this.header=new cX,g1.inflateGetHeader(this.strm,this.header),Q.dictionary){if(typeof Q.dictionary==="string")Q.dictionary=O6.string2buf(Q.dictionary);else if(r7.call(Q.dictionary)==="[object ArrayBuffer]")Q.dictionary=new Uint8Array(Q.dictionary);if(Q.raw){if(J=g1.inflateSetDictionary(this.strm,Q.dictionary),J!==p.Z_OK)throw Error(k5[J])}}}W1.prototype.push=function($,Q){var J=this.strm,q=this.options.chunkSize,Y=this.options.dictionary,G,V,K,U,X,W=!1;if(this.ended)return!1;if(V=Q===~~Q?Q:Q===!0?p.Z_FINISH:p.Z_NO_FLUSH,typeof $==="string")J.input=O6.binstring2buf($);else if(r7.call($)==="[object ArrayBuffer]")J.input=new Uint8Array($);else J.input=$;J.next_in=0,J.avail_in=J.input.length;do{if(J.avail_out===0)J.output=new B$.Buf8(q),J.next_out=0,J.avail_out=q;if(G=g1.inflate(J,p.Z_NO_FLUSH),G===p.Z_NEED_DICT&&Y)G=g1.inflateSetDictionary(this.strm,Y);if(G===p.Z_BUF_ERROR&&W===!0)G=p.Z_OK,W=!1;if(G!==p.Z_STREAM_END&&G!==p.Z_OK)return this.onEnd(G),this.ended=!0,!1;if(J.next_out){if(J.avail_out===0||G===p.Z_STREAM_END||J.avail_in===0&&(V===p.Z_FINISH||V===p.Z_SYNC_FLUSH))if(this.options.to==="string"){if(K=O6.utf8border(J.output,J.next_out),U=J.next_out-K,X=O6.buf2string(J.output,K),J.next_out=U,J.avail_out=q-U,U)B$.arraySet(J.output,J.output,K,U,0);this.onData(X)}else this.onData(B$.shrinkBuf(J.output,J.next_out))}if(J.avail_in===0&&J.avail_out===0)W=!0}while((J.avail_in>0||J.avail_out===0)&&G!==p.Z_STREAM_END);if(G===p.Z_STREAM_END)V=p.Z_FINISH;if(V===p.Z_FINISH)return G=g1.inflateEnd(this.strm),this.onEnd(G),this.ended=!0,G===p.Z_OK;if(V===p.Z_SYNC_FLUSH)return this.onEnd(p.Z_OK),J.avail_out=0,!0;return!0};W1.prototype.onData=function($){this.chunks.push($)};W1.prototype.onEnd=function($){if($===p.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=B$.flattenChunks(this.chunks);this.chunks=[],this.err=$,this.msg=this.strm.msg};function E5($,Q){var J=new W1(Q);if(J.push($,!0),J.err)throw J.msg||k5[J.err];return J.result}function pX($,Q){return Q=Q||{},Q.raw=!0,E5($,Q)}uX.Inflate=W1;uX.inflate=E5;uX.inflateRaw=pX;uX.ungzip=E5});var e7=C((NF,t7)=>{var nX=y0().assign,rX=Q7(),aX=a7(),sX=R5(),s7={};nX(s7,rX,aX,sX);t7.exports=s7});var QJ=C((QW)=>{var tX=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",eX=e7(),$J=m(),N6=V0(),$W=tX?"uint8array":"array";QW.magic="\b\x00";function U1($,Q){N6.call(this,"FlateWorker/"+$),this._pako=null,this._pakoAction=$,this._pakoOptions=Q,this.meta={}}$J.inherits(U1,N6);U1.prototype.processChunk=function($){if(this.meta=$.meta,this._pako===null)this._createPako();this._pako.push($J.transformTo($W,$.data),!1)};U1.prototype.flush=function(){if(N6.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};U1.prototype.cleanUp=function(){N6.prototype.cleanUp.call(this),this._pako=null};U1.prototype._createPako=function(){this._pako=new eX[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var $=this;this._pako.onData=function(Q){$.push({data:Q,meta:$.meta})}};QW.compressWorker=function($){return new U1("Deflate",$)};QW.uncompressWorker=function(){return new U1("Inflate",{})}});var x5=C((GW)=>{var JJ=V0();GW.STORE={magic:"\x00\x00",compressWorker:function(){return new JJ("STORE compression")},uncompressWorker:function(){return new JJ("STORE decompression")}};GW.DEFLATE=QJ()});var S5=C((XW)=>{XW.LOCAL_FILE_HEADER="PK\x03\x04";XW.CENTRAL_FILE_HEADER="PK\x01\x02";XW.CENTRAL_DIRECTORY_END="PK\x05\x06";XW.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";XW.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";XW.DATA_DESCRIPTOR="PK\x07\b"});var VJ=C((vF,GJ)=>{var T1=m(),y1=V0(),g5=w1(),qJ=q6(),B6=S5(),b=function($,Q){var J="",q;for(q=0;q<Q;q++)J+=String.fromCharCode($&255),$=$>>>8;return J},ZW=function($,Q){var J=$;if(!$)J=Q?16893:33204;return(J&65535)<<16},zW=function($){return($||0)&63},YJ=function($,Q,J,q,Y,G){var{file:V,compression:K}=$,U=G!==g5.utf8encode,X=T1.transformTo("string",G(V.name)),W=T1.transformTo("string",g5.utf8encode(V.name)),H=V.comment,j=T1.transformTo("string",G(H)),F=T1.transformTo("string",g5.utf8encode(H)),Z=W.length!==V.name.length,L=F.length!==H.length,N,I,P="",B="",M="",z=V.dir,D=V.date,w={crc32:0,compressedSize:0,uncompressedSize:0};if(!Q||J)w.crc32=$.crc32,w.compressedSize=$.compressedSize,w.uncompressedSize=$.uncompressedSize;var v=0;if(Q)v|=8;if(!U&&(Z||L))v|=2048;var k=0,E=0;if(z)k|=16;if(Y==="UNIX")E=798,k|=ZW(V.unixPermissions,z);else E=20,k|=zW(V.dosPermissions,z);if(N=D.getUTCHours(),N=N<<6,N=N|D.getUTCMinutes(),N=N<<5,N=N|D.getUTCSeconds()/2,I=D.getUTCFullYear()-1980,I=I<<4,I=I|D.getUTCMonth()+1,I=I<<5,I=I|D.getUTCDate(),Z)B=b(1,1)+b(qJ(X),4)+W,P+="up"+b(B.length,2)+B;if(L)M=b(1,1)+b(qJ(j),4)+F,P+="uc"+b(M.length,2)+M;var A="";A+=`
|
|
3
|
+
\x00`,A+=b(v,2),A+=K.magic,A+=b(N,2),A+=b(I,2),A+=b(w.crc32,4),A+=b(w.compressedSize,4),A+=b(w.uncompressedSize,4),A+=b(X.length,2),A+=b(P.length,2);var o=B6.LOCAL_FILE_HEADER+A+X+P,X0=B6.CENTRAL_FILE_HEADER+b(E,2)+A+b(j.length,2)+"\x00\x00\x00\x00"+b(k,4)+b(q,4)+X+P+j;return{fileRecord:o,dirRecord:X0}},LW=function($,Q,J,q,Y){var G="",V=T1.transformTo("string",Y(q));return G=B6.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+b($,2)+b($,2)+b(Q,4)+b(J,4)+b(V.length,2)+V,G},MW=function($){var Q="";return Q=B6.DATA_DESCRIPTOR+b($.crc32,4)+b($.compressedSize,4)+b($.uncompressedSize,4),Q};function M0($,Q,J,q){y1.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Q,this.zipPlatform=J,this.encodeFileName=q,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}T1.inherits(M0,y1);M0.prototype.push=function($){var Q=$.meta.percent||0,J=this.entriesCount,q=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,y1.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:J?(Q+100*(J-q-1))/J:100}})};M0.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Q=this.streamFiles&&!$.file.dir;if(Q){var J=YJ($,Q,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:J.fileRecord,meta:{percent:0}})}else this.accumulate=!0};M0.prototype.closedSource=function($){this.accumulate=!1;var Q=this.streamFiles&&!$.file.dir,J=YJ($,Q,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(J.dirRecord),Q)this.push({data:MW($),meta:{percent:100}});else{this.push({data:J.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};M0.prototype.flush=function(){var $=this.bytesWritten;for(var Q=0;Q<this.dirRecords.length;Q++)this.push({data:this.dirRecords[Q],meta:{percent:100}});var J=this.bytesWritten-$,q=LW(this.dirRecords.length,J,$,this.zipComment,this.encodeFileName);this.push({data:q,meta:{percent:100}})};M0.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};M0.prototype.registerPrevious=function($){this._sources.push($);var Q=this;return $.on("data",function(J){Q.processChunk(J)}),$.on("end",function(){if(Q.closedSource(Q.previous.streamInfo),Q._sources.length)Q.prepareNextSource();else Q.end()}),$.on("error",function(J){Q.error(J)}),this};M0.prototype.resume=function(){if(!y1.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};M0.prototype.error=function($){var Q=this._sources;if(!y1.prototype.error.call(this,$))return!1;for(var J=0;J<Q.length;J++)try{Q[J].error($)}catch(q){}return!0};M0.prototype.lock=function(){y1.prototype.lock.call(this);var $=this._sources;for(var Q=0;Q<$.length;Q++)$[Q].lock()};GJ.exports=M0});var KJ=C((BW)=>{var IW=x5(),OW=VJ(),NW=function($,Q){var J=$||Q,q=IW[J];if(!q)throw Error(J+" is not a valid compression method !");return q};BW.generateWorker=function($,Q,J){var q=new OW(Q.streamFiles,J,Q.platform,Q.encodeFileName),Y=0;try{$.forEach(function(G,V){Y++;var K=NW(V.options.compression,Q.compression),U=V.options.compressionOptions||Q.compressionOptions||{},X=V.dir,W=V.date;V._compressWorker(K,U).withStreamInfo("file",{name:G,dir:X,date:W,comment:V.comment||"",unixPermissions:V.unixPermissions,dosPermissions:V.dosPermissions}).pipe(q)}),q.entriesCount=Y}catch(G){q.error(G)}return q}});var WJ=C((AF,XJ)=>{var wW=m(),D6=V0();function D$($,Q){D6.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Q)}wW.inherits(D$,D6);D$.prototype._bindStream=function($){var Q=this;this._stream=$,$.pause(),$.on("data",function(J){Q.push({data:J,meta:{percent:0}})}).on("error",function(J){if(Q.isPaused)this.generatedError=J;else Q.error(J)}).on("end",function(){if(Q.isPaused)Q._upstreamEnded=!0;else Q.end()})};D$.prototype.pause=function(){if(!D6.prototype.pause.call(this))return!1;return this._stream.pause(),!0};D$.prototype.resume=function(){if(!D6.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};XJ.exports=D$});var IJ=C((RF,MJ)=>{var vW=w1(),w$=m(),FJ=V0(),CW=b8(),PJ=f8(),UJ=Y6(),AW=j2(),RW=KJ(),jJ=J$(),kW=WJ(),ZJ=function($,Q,J){var q=w$.getTypeOf(Q),Y,G=w$.extend(J||{},PJ);if(G.date=G.date||new Date,G.compression!==null)G.compression=G.compression.toUpperCase();if(typeof G.unixPermissions==="string")G.unixPermissions=parseInt(G.unixPermissions,8);if(G.unixPermissions&&G.unixPermissions&16384)G.dir=!0;if(G.dosPermissions&&G.dosPermissions&16)G.dir=!0;if(G.dir)$=zJ($);if(G.createFolders&&(Y=EW($)))LJ.call(this,Y,!0);var V=q==="string"&&G.binary===!1&&G.base64===!1;if(!J||typeof J.binary>"u")G.binary=!V;var K=Q instanceof UJ&&Q.uncompressedSize===0;if(K||G.dir||!Q||Q.length===0)G.base64=!1,G.binary=!0,Q="",G.compression="STORE",q="string";var U=null;if(Q instanceof UJ||Q instanceof FJ)U=Q;else if(jJ.isNode&&jJ.isStream(Q))U=new kW($,Q);else U=w$.prepareContent($,Q,G.binary,G.optimizedBinaryString,G.base64);var X=new AW($,U,G);this.files[$]=X},EW=function($){if($.slice(-1)==="/")$=$.substring(0,$.length-1);var Q=$.lastIndexOf("/");return Q>0?$.substring(0,Q):""},zJ=function($){if($.slice(-1)!=="/")$+="/";return $},LJ=function($,Q){if(Q=typeof Q<"u"?Q:PJ.createFolders,$=zJ($),!this.files[$])ZJ.call(this,$,null,{dir:!0,createFolders:Q});return this.files[$]};function HJ($){return Object.prototype.toString.call($)==="[object RegExp]"}var xW={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function($){var Q,J,q;for(Q in this.files)if(q=this.files[Q],J=Q.slice(this.root.length,Q.length),J&&Q.slice(0,this.root.length)===this.root)$(J,q)},filter:function($){var Q=[];return this.forEach(function(J,q){if($(J,q))Q.push(q)}),Q},file:function($,Q,J){if(arguments.length===1)if(HJ($)){var q=$;return this.filter(function(G,V){return!V.dir&&q.test(G)})}else{var Y=this.files[this.root+$];if(Y&&!Y.dir)return Y;else return null}else $=this.root+$,ZJ.call(this,$,Q,J);return this},folder:function($){if(!$)return this;if(HJ($))return this.filter(function(Y,G){return G.dir&&$.test(Y)});var Q=this.root+$,J=LJ.call(this,Q),q=this.clone();return q.root=J.name,q},remove:function($){$=this.root+$;var Q=this.files[$];if(!Q){if($.slice(-1)!=="/")$+="/";Q=this.files[$]}if(Q&&!Q.dir)delete this.files[$];else{var J=this.filter(function(Y,G){return G.name.slice(0,$.length)===$});for(var q=0;q<J.length;q++)delete this.files[J[q].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function($){var Q,J={};try{if(J=w$.extend($||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:vW.utf8encode}),J.type=J.type.toLowerCase(),J.compression=J.compression.toUpperCase(),J.type==="binarystring")J.type="string";if(!J.type)throw Error("No output type specified.");if(w$.checkSupport(J.type),J.platform==="darwin"||J.platform==="freebsd"||J.platform==="linux"||J.platform==="sunos")J.platform="UNIX";if(J.platform==="win32")J.platform="DOS";var q=J.comment||this.comment||"";Q=RW.generateWorker(this,J,q)}catch(Y){Q=new FJ("error"),Q.error(Y)}return new CW(Q,J.type||"string",J.mimeType)},generateAsync:function($,Q){return this.generateInternalStream($).accumulate(Q)},generateNodeStream:function($,Q){if($=$||{},!$.type)$.type="nodebuffer";return this.generateInternalStream($).toNodejsStream(Q)}};MJ.exports=xW});var T5=C((kF,NJ)=>{var SW=m();function OJ($){this.data=$,this.length=$.length,this.index=0,this.zero=0}OJ.prototype={checkOffset:function($){this.checkIndex(this.index+$)},checkIndex:function($){if(this.length<this.zero+$||$<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+$+"). Corrupted zip ?")},setIndex:function($){this.checkIndex($),this.index=$},skip:function($){this.setIndex(this.index+$)},byteAt:function(){},readInt:function($){var Q=0,J;this.checkOffset($);for(J=this.index+$-1;J>=this.index;J--)Q=(Q<<8)+this.byteAt(J);return this.index+=$,Q},readString:function($){return SW.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))}};NJ.exports=OJ});var y5=C((EF,DJ)=>{var BJ=T5(),gW=m();function h1($){BJ.call(this,$);for(var Q=0;Q<this.data.length;Q++)$[Q]=$[Q]&255}gW.inherits(h1,BJ);h1.prototype.byteAt=function($){return this.data[this.zero+$]};h1.prototype.lastIndexOfSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3);for(var G=this.length-4;G>=0;--G)if(this.data[G]===Q&&this.data[G+1]===J&&this.data[G+2]===q&&this.data[G+3]===Y)return G-this.zero;return-1};h1.prototype.readAndCheckSignature=function($){var Q=$.charCodeAt(0),J=$.charCodeAt(1),q=$.charCodeAt(2),Y=$.charCodeAt(3),G=this.readData(4);return Q===G[0]&&J===G[1]&&q===G[2]&&Y===G[3]};h1.prototype.readData=function($){if(this.checkOffset($),$===0)return[];var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};DJ.exports=h1});var CJ=C((xF,vJ)=>{var wJ=T5(),TW=m();function b1($){wJ.call(this,$)}TW.inherits(b1,wJ);b1.prototype.byteAt=function($){return this.data.charCodeAt(this.zero+$)};b1.prototype.lastIndexOfSignature=function($){return this.data.lastIndexOf($)-this.zero};b1.prototype.readAndCheckSignature=function($){var Q=this.readData(4);return $===Q};b1.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};vJ.exports=b1});var b5=C((SF,RJ)=>{var AJ=y5(),yW=m();function h5($){AJ.call(this,$)}yW.inherits(h5,AJ);h5.prototype.readData=function($){if(this.checkOffset($),$===0)return new Uint8Array(0);var Q=this.data.subarray(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};RJ.exports=h5});var xJ=C((gF,EJ)=>{var kJ=b5(),hW=m();function f5($){kJ.call(this,$)}hW.inherits(f5,kJ);f5.prototype.readData=function($){this.checkOffset($);var Q=this.data.slice(this.zero+this.index,this.zero+this.index+$);return this.index+=$,Q};EJ.exports=f5});var _5=C((TF,gJ)=>{var w6=m(),SJ=T0(),bW=y5(),fW=CJ(),_W=xJ(),mW=b5();gJ.exports=function($){var Q=w6.getTypeOf($);if(w6.checkSupport(Q),Q==="string"&&!SJ.uint8array)return new fW($);if(Q==="nodebuffer")return new _W($);if(SJ.uint8array)return new mW(w6.transformTo("uint8array",$));return new bW(w6.transformTo("array",$))}});var bJ=C((yF,hJ)=>{var m5=_5(),r0=m(),cW=Y6(),TJ=q6(),v6=w1(),C6=x5(),pW=T0(),uW=0,dW=3,lW=function($){for(var Q in C6){if(!Object.prototype.hasOwnProperty.call(C6,Q))continue;if(C6[Q].magic===$)return C6[Q]}return null};function yJ($,Q){this.options=$,this.loadOptions=Q}yJ.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function($){var Q,J;if($.skip(22),this.fileNameLength=$.readInt(2),J=$.readInt(2),this.fileName=$.readData(this.fileNameLength),$.skip(J),this.compressedSize===-1||this.uncompressedSize===-1)throw Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(Q=lW(this.compressionMethod),Q===null)throw Error("Corrupted zip : compression "+r0.pretty(this.compressionMethod)+" unknown (inner file : "+r0.transformTo("string",this.fileName)+")");this.decompressed=new cW(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,$===uW)this.dosPermissions=this.externalFileAttributes&63;if($===dW)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var $=m5(this.extraFields[1].value);if(this.uncompressedSize===r0.MAX_VALUE_32BITS)this.uncompressedSize=$.readInt(8);if(this.compressedSize===r0.MAX_VALUE_32BITS)this.compressedSize=$.readInt(8);if(this.localHeaderOffset===r0.MAX_VALUE_32BITS)this.localHeaderOffset=$.readInt(8);if(this.diskNumberStart===r0.MAX_VALUE_32BITS)this.diskNumberStart=$.readInt(4)},readExtraFields:function($){var Q=$.index+this.extraFieldsLength,J,q,Y;if(!this.extraFields)this.extraFields={};while($.index+4<Q)J=$.readInt(2),q=$.readInt(2),Y=$.readData(q),this.extraFields[J]={id:J,length:q,value:Y};$.setIndex(Q)},handleUTF8:function(){var $=pW.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=v6.utf8decode(this.fileName),this.fileCommentStr=v6.utf8decode(this.fileComment);else{var Q=this.findExtraFieldUnicodePath();if(Q!==null)this.fileNameStr=Q;else{var J=r0.transformTo($,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(J)}var q=this.findExtraFieldUnicodeComment();if(q!==null)this.fileCommentStr=q;else{var Y=r0.transformTo($,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var $=this.extraFields[28789];if($){var Q=m5($.value);if(Q.readInt(1)!==1)return null;if(TJ(this.fileName)!==Q.readInt(4))return null;return v6.utf8decode(Q.readData($.length-5))}return null},findExtraFieldUnicodeComment:function(){var $=this.extraFields[25461];if($){var Q=m5($.value);if(Q.readInt(1)!==1)return null;if(TJ(this.fileComment)!==Q.readInt(4))return null;return v6.utf8decode(Q.readData($.length-5))}return null}};hJ.exports=yJ});var mJ=C((hF,_J)=>{var oW=_5(),f0=m(),I0=S5(),iW=bJ(),nW=T0();function fJ($){this.files=[],this.loadOptions=$}fJ.prototype={checkSignature:function($){if(!this.reader.readAndCheckSignature($)){this.reader.index-=4;var Q=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+f0.pretty(Q)+", expected "+f0.pretty($)+")")}},isSignature:function($,Q){var J=this.reader.index;this.reader.setIndex($);var q=this.reader.readString(4),Y=q===Q;return this.reader.setIndex(J),Y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var $=this.reader.readData(this.zipCommentLength),Q=nW.uint8array?"uint8array":"array",J=f0.transformTo(Q,$);this.zipComment=this.loadOptions.decodeFileName(J)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};var $=this.zip64EndOfCentralSize-44,Q=0,J,q,Y;while(Q<$)J=this.reader.readInt(2),q=this.reader.readInt(4),Y=this.reader.readData(q),this.zip64ExtensibleData[J]={id:J,length:q,value:Y}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var $,Q;for($=0;$<this.files.length;$++)Q=this.files[$],this.reader.setIndex(Q.localHeaderOffset),this.checkSignature(I0.LOCAL_FILE_HEADER),Q.readLocalPart(this.reader),Q.handleUTF8(),Q.processAttributes()},readCentralDir:function(){var $;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(I0.CENTRAL_FILE_HEADER))$=new iW({zip64:this.zip64},this.loadOptions),$.readCentralPart(this.reader),this.files.push($);if(this.centralDirRecords!==this.files.length){if(this.centralDirRecords!==0&&this.files.length===0)throw Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)}},readEndOfCentral:function(){var $=this.reader.lastIndexOfSignature(I0.CENTRAL_DIRECTORY_END);if($<0){var Q=!this.isSignature(0,I0.LOCAL_FILE_HEADER);if(Q)throw Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");else throw Error("Corrupted zip: can't find end of central directory")}this.reader.setIndex($);var J=$;if(this.checkSignature(I0.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===f0.MAX_VALUE_16BITS||this.diskWithCentralDirStart===f0.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===f0.MAX_VALUE_16BITS||this.centralDirRecords===f0.MAX_VALUE_16BITS||this.centralDirSize===f0.MAX_VALUE_32BITS||this.centralDirOffset===f0.MAX_VALUE_32BITS){if(this.zip64=!0,$=this.reader.lastIndexOfSignature(I0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),$<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex($),this.checkSignature(I0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,I0.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(I0.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory")}this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(I0.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var q=this.centralDirOffset+this.centralDirSize;if(this.zip64)q+=20,q+=12+this.zip64EndOfCentralSize;var Y=J-q;if(Y>0)if(this.isSignature(J,I0.CENTRAL_FILE_HEADER));else this.reader.zero=Y;else if(Y<0)throw Error("Corrupted zip: missing "+Math.abs(Y)+" bytes.")},prepareReader:function($){this.reader=oW($)},load:function($){this.prepareReader($),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};_J.exports=fJ});var uJ=C((bF,pJ)=>{var c5=m(),A6=N1(),rW=w1(),aW=mJ(),sW=c8(),cJ=J$();function tW($){return new A6.Promise(function(Q,J){var q=$.decompressed.getContentWorker().pipe(new sW);q.on("error",function(Y){J(Y)}).on("end",function(){if(q.streamInfo.crc32!==$.decompressed.crc32)J(Error("Corrupted zip : CRC32 mismatch"));else Q()}).resume()})}pJ.exports=function($,Q){var J=this;if(Q=c5.extend(Q||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:rW.utf8decode}),cJ.isNode&&cJ.isStream($))return A6.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return c5.prepareContent("the loaded zip file",$,!0,Q.optimizedBinaryString,Q.base64).then(function(q){var Y=new aW(Q);return Y.load(q),Y}).then(function(Y){var G=[A6.Promise.resolve(Y)],V=Y.files;if(Q.checkCRC32)for(var K=0;K<V.length;K++)G.push(tW(V[K]));return A6.Promise.all(G)}).then(function(Y){var G=Y.shift(),V=G.files;for(var K=0;K<V.length;K++){var U=V[K],X=U.fileNameStr,W=c5.resolve(U.fileNameStr);if(J.file(W,U.decompressed,{binary:!0,optimizedBinaryString:!0,date:U.date,dir:U.dir,comment:U.fileCommentStr.length?U.fileCommentStr:null,unixPermissions:U.unixPermissions,dosPermissions:U.dosPermissions,createFolders:Q.createFolders}),!U.dir)J.file(W).unsafeOriginalName=X}if(G.zipComment.length)J.comment=G.zipComment;return J})}});var lJ=C((fF,dJ)=>{function P0(){if(!(this instanceof P0))return new P0;if(arguments.length)throw Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var $=new P0;for(var Q in this)if(typeof this[Q]!=="function")$[Q]=this[Q];return $}}P0.prototype=IJ();P0.prototype.loadAsync=uJ();P0.support=T0();P0.defaults=f8();P0.version="3.10.1";P0.loadAsync=function($,Q){return new P0().loadAsync($,Q)};P0.external=N1();dJ.exports=P0});var nJ=C((_F,p5)=>{var k6=process||{},oJ=k6.argv||[],R6=k6.env||{},eW=!(!!R6.NO_COLOR||oJ.includes("--no-color"))&&(!!R6.FORCE_COLOR||oJ.includes("--color")||k6.platform==="win32"||(k6.stdout||{}).isTTY&&R6.TERM!=="dumb"||!!R6.CI),$U=($,Q,J=$)=>(q)=>{let Y=""+q,G=Y.indexOf(Q,$.length);return~G?$+QU(Y,Q,J,G)+Q:$+Y+Q},QU=($,Q,J,q)=>{let Y="",G=0;do Y+=$.substring(G,q)+J,G=q+Q.length,q=$.indexOf(Q,G);while(~q);return Y+$.substring(G)},iJ=($=eW)=>{let Q=$?$U:()=>String;return{isColorSupported:$,reset:Q("\x1B[0m","\x1B[0m"),bold:Q("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:Q("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:Q("\x1B[3m","\x1B[23m"),underline:Q("\x1B[4m","\x1B[24m"),inverse:Q("\x1B[7m","\x1B[27m"),hidden:Q("\x1B[8m","\x1B[28m"),strikethrough:Q("\x1B[9m","\x1B[29m"),black:Q("\x1B[30m","\x1B[39m"),red:Q("\x1B[31m","\x1B[39m"),green:Q("\x1B[32m","\x1B[39m"),yellow:Q("\x1B[33m","\x1B[39m"),blue:Q("\x1B[34m","\x1B[39m"),magenta:Q("\x1B[35m","\x1B[39m"),cyan:Q("\x1B[36m","\x1B[39m"),white:Q("\x1B[37m","\x1B[39m"),gray:Q("\x1B[90m","\x1B[39m"),bgBlack:Q("\x1B[40m","\x1B[49m"),bgRed:Q("\x1B[41m","\x1B[49m"),bgGreen:Q("\x1B[42m","\x1B[49m"),bgYellow:Q("\x1B[43m","\x1B[49m"),bgBlue:Q("\x1B[44m","\x1B[49m"),bgMagenta:Q("\x1B[45m","\x1B[49m"),bgCyan:Q("\x1B[46m","\x1B[49m"),bgWhite:Q("\x1B[47m","\x1B[49m"),blackBright:Q("\x1B[90m","\x1B[39m"),redBright:Q("\x1B[91m","\x1B[39m"),greenBright:Q("\x1B[92m","\x1B[39m"),yellowBright:Q("\x1B[93m","\x1B[39m"),blueBright:Q("\x1B[94m","\x1B[39m"),magentaBright:Q("\x1B[95m","\x1B[39m"),cyanBright:Q("\x1B[96m","\x1B[39m"),whiteBright:Q("\x1B[97m","\x1B[39m"),bgBlackBright:Q("\x1B[100m","\x1B[49m"),bgRedBright:Q("\x1B[101m","\x1B[49m"),bgGreenBright:Q("\x1B[102m","\x1B[49m"),bgYellowBright:Q("\x1B[103m","\x1B[49m"),bgBlueBright:Q("\x1B[104m","\x1B[49m"),bgMagentaBright:Q("\x1B[105m","\x1B[49m"),bgCyanBright:Q("\x1B[106m","\x1B[49m"),bgWhiteBright:Q("\x1B[107m","\x1B[49m")}};p5.exports=iJ();p5.exports.createColors=iJ});function EU($){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 O0($,Q){if($==null||typeof $!=="object")return null;let J=$[Q];return typeof J==="string"?J:null}function B4($){let Q=Math.max($.lastIndexOf("/"),$.lastIndexOf("\\"));return Q>=0?$.slice(Q+1):$}function Z0($,Q=40){if($.length<=Q)return $;return`${$.slice(0,Q-1)}…`}function D4($){if($.kind==="session.start")return"Thinking…";if($.kind==="session.end")return"Done.";if($.kind==="session.waiting")return"Waiting for you…";let{toolName:Q,phase:J,toolInput:q}=$,Y=EU(Q),G=J==="done";switch(Y){case"read":{let V=O0(q,"file_path")??O0(q,"path"),K=V?Z0(B4(V)):null;if(K)return G?`Read ${K}`:`Reading ${K}`;return G?"Read file":"Reading file"}case"edit":case"write":{let V=O0(q,"file_path")??O0(q,"path"),K=V?Z0(B4(V)):null;if(K)return G?`Edited ${K}`:`Editing ${K}`;return G?"Edited file":"Editing file"}case"bash":{let V=O0(q,"description");if(V)return Z0(V,40);let K=O0(q,"command");if(K){let U=Z0(K.split(/\s+/)[0]??K,24);return G?`Ran ${U}`:`Running ${U}`}return G?"Ran command":"Running command"}case"grep":{let V=O0(q,"pattern");if(V)return G?`Searched "${Z0(V,28)}"`:`Searching "${Z0(V,28)}"`;return G?"Searched files":"Searching files"}case"glob":{let V=O0(q,"pattern");if(V)return G?`Listed ${Z0(V,28)}`:`Listing ${Z0(V,28)}`;return G?"Listed files":"Listing files"}case"webfetch":{let V=O0(q,"url");if(V)try{let K=new URL(V).hostname;return G?`Fetched ${Z0(K,28)}`:`Fetching ${Z0(K,28)}`}catch{}return G?"Fetched web":"Searching web"}case"task":{let V=O0(q,"description")??O0(q,"subject");if(V)return G?"Subagent done":`Spawning ${Z0(V,28)}`;return G?"Subagent done":"Spawning subagent"}default:{let V=Z0(Q,28);return G?`Called ${V}`:`Calling ${V}`}}}var _4={};JQ(_4,{stateForEvent:()=>h4,sessionTitle:()=>x4,runBubble:()=>sU,rememberSessionTitle:()=>E4,pruneSessions:()=>y4,lastAssistantText:()=>T4,eventFromArgs:()=>f4,clipTitle:()=>S4,clipPreview:()=>g4});import{closeSync as xU,existsSync as SU,fstatSync as gU,mkdirSync as TU,openSync as yU,readdirSync as hU,readFileSync as R4,readSync as bU,statSync as fU,unlinkSync as _U,writeFileSync as mU}from"node:fs";import{homedir as cU}from"node:os";import{join as j1}from"node:path";function E4($,Q,J){try{let q=S4(J);if(!q)return;TU($,{recursive:!0}),mU(j1($,`${Q}.json`),JSON.stringify({title:q,at:Date.now()}))}catch{}}function x4($,Q){try{let J=R4(j1($,`${Q}.json`),"utf8"),q=JSON.parse(J);return typeof q.title==="string"&&q.title.length>0?q.title:null}catch{return null}}function S4($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=v4)return Q;return`${Q.slice(0,v4-1)}…`}function g4($){let Q=$.replace(/\s+/g," ").trim();if(Q.length<=C4)return Q;return`${Q.slice(0,C4-1)}…`}function T4($){let Q=null;try{Q=yU($,"r");let J=gU(Q).size,q=Math.min(J,oU),Y=Buffer.alloc(q);bU(Q,Y,0,q,J-q);let G=Y.toString("utf8").split(`
|
|
4
|
+
`);for(let V=G.length-1;V>=0;V--){let K=G[V]?.trim();if(!K)continue;let U;try{U=JSON.parse(K)}catch{continue}if(U==null||typeof U!=="object"||U.type!=="assistant")continue;let X=U.message;if(X==null||typeof X!=="object")continue;let W=X.content;if(!Array.isArray(W))continue;let H=W.filter((j)=>j!=null&&typeof j==="object"&&j.type==="text"&&typeof j.text==="string").map((j)=>j.text).join(" ").trim();if(H)return H}return null}catch{return null}finally{if(Q!==null)try{xU(Q)}catch{}}}function y4($,Q=Date.now()){try{for(let J of hU($)){if(!J.endsWith(".json"))continue;let q=j1($,J);try{if(Q-fU(q).mtimeMs>iU)_U(q)}catch{}}}catch{}}function nU($){if(typeof $!=="string")return null;return/^[a-zA-Z0-9_-]{1,64}$/.test($)?$:null}function h4($,Q){let J=$[0];if(J==="pre"){if(Q){let q=Q.toLowerCase();if(q==="read"||q==="grep"||q==="glob")return"review"}return"running"}if(J==="post")return"idle";if(J==="stop"||J==="session-end")return"waving";if(J==="user-prompt"||J==="session-start")return"jumping";if(J==="waiting"||J==="notification")return"waiting";return null}async function rU(){if(process.stdin.isTTY)return"";return await new Promise(($)=>{let Q="",J=!1;process.stdin.setEncoding("utf8"),process.stdin.on("data",(q)=>{if(J)return;if(Q.length+q.length>w4){Q+=q.slice(0,w4-Q.length),J=!0;return}Q+=q}),process.stdin.on("end",()=>$(Q)),process.stdin.on("error",()=>$(Q))})}function b4($){if(!$.trim())return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null};try{let Q=JSON.parse($),J=typeof Q.tool_name==="string"?Q.tool_name:null,q=Q.tool_input,Y=typeof Q.agent_source==="string"?Q.agent_source:null,G=nU(Q.session_id),V=typeof Q.prompt==="string"?Q.prompt:null,K=typeof Q.transcript_path==="string"?Q.transcript_path:null,U=typeof Q.last_assistant_message==="string"?Q.last_assistant_message:null;return{toolName:J,toolInput:q,agentSource:Y,sessionId:G,prompt:V,transcriptPath:K,lastAssistantMessage:U}}catch{return{toolName:null,toolInput:void 0,agentSource:null,sessionId:null,prompt:null,transcriptPath:null,lastAssistantMessage:null}}}function f4($,Q){let J=$[0];if(!J)return null;if(J==="stop"||J==="session-end")return{kind:"session.end"};if(J==="user-prompt"||J==="session-start")return{kind:"session.start"};if(J==="waiting"||J==="notification")return{kind:"session.waiting"};let q=J==="pre"?"running":J==="post"?"done":null;if(!q)return null;let{toolName:Y,toolInput:G}=b4(Q);if(!Y)return{kind:"tool",phase:q,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:q,toolName:Y,toolInput:G}}function aU(){try{let $=R4(pU,"utf8").trim();return $.length>0?$:null}catch{return null}}async function A4($,Q,J){let q=new AbortController,Y=setTimeout(()=>q.abort(),300);try{await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":J},body:JSON.stringify(Q),signal:q.signal})}catch{}finally{clearTimeout(Y)}}async function sU($){if(SU(uU))return;let Q=$[1]??null,J=await rU(),q=f4($,J);if(!q)return;let Y=$[0],{toolName:G,agentSource:V,sessionId:K,prompt:U,transcriptPath:X,lastAssistantMessage:W}=b4(J),H=V??Q;if(K&&U&&(Y==="user-prompt"||Y==="session-start"))E4(n5,K,U);let j=K?x4(n5,K):null,F=D4(q);if(Y==="stop"||Y==="session-end"){let I=W??(X?T4(X):null);if(I)F=g4(I);y4(n5)}let Z=h4($,G),L=aU();if(!L)return;let N=[];if(F){let P={text:F,busy:Y==="user-prompt"||Y==="session-start"||Y==="pre"||Y==="post",agent_source:H};if(j)P.title=j;N.push(A4(dU,P,L))}if(Z)N.push(A4(lU,{state:Z,agent_source:H},L));await Promise.all(N)}var r5,pU,uU,k4="http://127.0.0.1:7777",dU,lU,w4=65536,n5,v4=60,C4=110,oU=65536,iU=86400000;var m4=qQ(()=>{r5=j1(cU(),".petdex","runtime"),pU=j1(r5,"update-token"),uU=j1(r5,"hooks-disabled"),dU=`${k4}/bubble`,lU=`${k4}/state`,n5=j1(r5,"sessions")});var l4={};JQ(l4,{runMcpServer:()=>Kj});import{readFile as p4}from"node:fs/promises";import{homedir as u4}from"node:os";import d4 from"node:path";async function qj(){try{return(await p4($j,"utf8")).trim()}catch{return null}}async function Yj(){try{return await p4(Qj),!0}catch{return!1}}async function c4($,Q){let J=await qj();if(!J)return{ok:!1,status:0};try{let q=await fetch($,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":J},body:JSON.stringify(Q),signal:AbortSignal.timeout(300)});return{ok:q.ok,status:q.status}}catch{return{ok:!1,status:0}}}function z0($){let Q=JSON.stringify($);if(a5==="jsonl"){process.stdout.write(`${Q}
|
|
5
|
+
`);return}let q=`Content-Length: ${new TextEncoder().encode(Q).length}\r
|
|
6
|
+
\r
|
|
7
|
+
`;process.stdout.write(q),process.stdout.write(Q)}function v$($,Q,J){return{jsonrpc:"2.0",id:$,error:{code:Q,message:J}}}async function Vj($){let{id:Q,method:J,params:q}=$;switch(J){case"initialize":{let Y=q?.protocolVersion??"2025-03-26";z0({jsonrpc:"2.0",id:Q,result:{protocolVersion:Y,capabilities:{tools:{listChanged:!1}},serverInfo:{name:"petdex-mcp-server",version:Jj}}});return}case"tools/list":{z0({jsonrpc:"2.0",id:Q,result:{tools:Gj}});return}case"tools/call":{let Y=q?.name,G=q?.arguments??{};if(await Yj()){z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:"Petdex hooks are disabled. Run /petdex in your agent or `petdex hooks on` to re-enable."}]}});return}switch(Y){case"petdex_set_state":{let V=G.state;if(!V){z0(v$(Q,-32602,"Missing required argument: state"));return}let K={state:V,agent_source:"antigravity"};if(typeof G.duration==="number")K.duration=G.duration;let U=await c4(tU,K);z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:U.ok?`Pet state set to "${V}"`:"Sidecar unreachable — is petdex-desktop running?"}]}});return}case"petdex_show_bubble":{let V=G.text;if(!V){z0(v$(Q,-32602,"Missing required argument: text"));return}let K=await c4(eU,{text:V,agent_source:"antigravity"});z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:K.ok?`Bubble shown: "${V}"`:"Sidecar unreachable — is petdex-desktop running?"}]}});return}case"petdex_status":{let V=!1;try{V=(await fetch(`${t5}/health`,{signal:AbortSignal.timeout(500)})).ok}catch{V=!1}z0({jsonrpc:"2.0",id:Q,result:{content:[{type:"text",text:V?"Petdex desktop is reachable.":"Petdex desktop not detected. Start it with `petdex up`."}]}});return}default:{z0(v$(Q,-32601,`Unknown tool: ${Y}`));return}}}case"notifications/initialized":return;default:z0(v$(Q,-32601,`Unknown method: ${J}`))}}async function Kj(){let $=new Uint8Array(0),Q=0,J=!1,q=new TextDecoder;function Y(){if(Q===0)process.exit(0)}process.stdin.on("data",(V)=>{let K=typeof V==="string"?new TextEncoder().encode(V):V,U=new Uint8Array($.length+K.length);U.set($),U.set(K,$.length),$=U;while(!0){let X=Wj($);if(X===123||X===91){let M=s5($,new Uint8Array([10]));if(M===-1)break;let z=Uj($.slice(0,M));$=$.slice(M+1);let D=q.decode(z).trim();if(!D)continue;a5="jsonl",G(D);continue}let W=Xj($),H=W.index;if(H===-1)break;let j=$.slice(0,H),Z=q.decode(j).match(/Content-Length:\s*(\d+)/i);if(!Z){$=$.slice(H+W.length);continue}let L=parseInt(Z[1],10),N=H+W.length,I=N+L;if($.length<I)break;let P=$.slice(N,I),B=q.decode(P);$=$.slice(I),a5="framed",G(B)}}),process.stdin.on("end",()=>{J=!0,Y(),setTimeout(()=>process.exit(0),3000).unref()});function G(V){try{let K=JSON.parse(V);Q++,Vj(K).catch((U)=>{z0(v$(K.id,-32603,`Internal error: ${U.message}`))}).finally(()=>{if(Q--,J)Y()})}catch(K){z0({jsonrpc:"2.0",id:null,error:{code:-32700,message:`Parse error: ${K.message}`}})}}}function s5($,Q){$:for(let J=0;J<=$.length-Q.length;J++){for(let q=0;q<Q.length;q++)if($[J+q]!==Q[q])continue $;return J}return-1}function Xj($){let Q=s5($,new Uint8Array([13,10,13,10]));if(Q!==-1)return{index:Q,length:4};let J=s5($,new Uint8Array([10,10]));if(J!==-1)return{index:J,length:2};return{index:-1,length:0}}function Wj($){for(let Q of $)if(Q!==32&&Q!==9&&Q!==10&&Q!==13)return Q;return null}function Uj($){if($.at(-1)===13)return $.slice(0,-1);return $}var t5="http://127.0.0.1:7777",tU,eU,$j,Qj,Jj="0.1.0",a5="framed",Gj;var o4=qQ(()=>{tU=`${t5}/state`,eU=`${t5}/bubble`,$j=d4.join(u4(),".petdex","runtime","update-token"),Qj=d4.join(u4(),".petdex","runtime","hooks-disabled");Gj=[{name:"petdex_set_state",description:"Set the pet's animation state. Call this before/after tool use to reflect agent activity.",inputSchema:{type:"object",properties:{state:{type:"string",description:"Animation state: idle, running, running-left, running-right, waving, jumping, failed, review, waiting",enum:["idle","running","running-left","running-right","waving","jumping","failed","review","waiting"]},duration:{type:"number",description:"Optional duration in ms to hold this state"}},required:["state"]}},{name:"petdex_show_bubble",description:"Show a speech bubble above the pet with the given text. Use to display what the agent is currently doing.",inputSchema:{type:"object",properties:{text:{type:"string",description:"The bubble text to display (e.g. 'Reading server.ts')"}},required:["text"]}},{name:"petdex_status",description:"Check if the petdex desktop mascot is reachable. Returns connection status.",inputSchema:{type:"object",properties:{}}}]});import{mkdir as i4,readdir as jj,readFile as $Q,stat as t4,writeFile as T6}from"node:fs/promises";import{homedir as n4}from"node:os";import J0 from"node:path";import{styleText as o6}from"node:util";import{stdout as r6,stdin as BQ}from"node:process";import*as _0 from"node:readline";import Sq from"node:readline";var YQ=(()=>{let $=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return(Q)=>{let J=0;$.lastIndex=0;while($.test(Q))J+=1;return Q.length-J}})(),GQ=($)=>{return $===12288||$>=65281&&$<=65376||$>=65504&&$<=65510},VQ=($)=>{return $===8987||$===9001||$>=12272&&$<=12287||$>=12289&&$<=12350||$>=12441&&$<=12543||$>=12549&&$<=12591||$>=12593&&$<=12686||$>=12688&&$<=12771||$>=12783&&$<=12830||$>=12832&&$<=12871||$>=12880&&$<=19903||$>=65040&&$<=65049||$>=65072&&$<=65106||$>=65108&&$<=65126||$>=65128&&$<=65131||$>=127488&&$<=127490||$>=127504&&$<=127547||$>=127552&&$<=127560||$>=131072&&$<=196605||$>=196608&&$<=262141};var Lq=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,Mq=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,KQ=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/yu,Iq=/\t{1,1000}/y,XQ=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu,Oq=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Nq=/\p{M}+/gu,Bq={limit:1/0,ellipsis:""},WQ=($,Q={},J={})=>{let q=Q.limit??1/0,Y=Q.ellipsis??"",G=Q?.ellipsisWidth??(Y?WQ(Y,Bq,J).width:0),V=0,K=J.controlWidth??0,U=J.tabWidth??8,X=J.emojiWidth??2,W=2,H=J.regularWidth??1,j=J.wideWidth??2,F=[[Oq,H],[Lq,0],[Mq,K],[Iq,U],[XQ,X],[KQ,j]],Z=0,L=0,N=$.length,I=0,P=!1,B=N,M=Math.max(0,q-G),z=0,D=0,w=0,v=0;$:while(!0){if(D>z||L>=N&&L>Z){let k=$.slice(z,D)||$.slice(Z,L);I=0;for(let E of k.replaceAll(Nq,"")){let A=E.codePointAt(0)||0;if(GQ(A))v=2;else if(VQ(A))v=j;else v=H;if(w+v>M)B=Math.min(B,Math.max(z,Z)+I);if(w+v>q){P=!0;break $}I+=E.length,w+=v}z=D=0}if(L>=N)break $;for(let k=0,E=F.length;k<E;k++){let[A,o]=F[k];if(A.lastIndex=L,A.test($)){if(I=A===KQ?YQ($.slice(L,A.lastIndex)):A===XQ?1:A.lastIndex-L,v=I*o,w+v>M)B=Math.min(B,L+Math.floor((M-w)/o));if(w+v>q){P=!0;break $}w+=v,z=Z,D=L,L=Z=A.lastIndex;continue $}}L+=1}return{width:P?M:w,index:P?B:N,truncated:P,ellipsed:P&&q>=G}},UQ=WQ;var Dq={limit:1/0,ellipsis:"",ellipsisWidth:0},wq=($,Q={})=>{return UQ($,Dq,Q).width},$0=wq;var k$="\x1B",ZQ="",vq=39,c6="\x07",zQ="[",Cq="]",LQ="m",p6=`${Cq}8;;`,jQ=new RegExp(`(?:\\${zQ}(?<code>\\d+)m|\\${p6}(?<uri>.*)${c6})`,"y"),HQ=($)=>{if($>=30&&$<=37)return 39;if($>=90&&$<=97)return 39;if($>=40&&$<=47)return 49;if($>=100&&$<=107)return 49;if($===1||$===2)return 22;if($===3)return 23;if($===4)return 24;if($===7)return 27;if($===8)return 28;if($===9)return 29;if($===0)return 0;return},FQ=($)=>`${k$}${zQ}${$}${LQ}`,PQ=($)=>`${k$}${p6}${$}${c6}`,m6=($,Q,J)=>{let q=Q[Symbol.iterator](),Y=!1,G=!1,V=$.at(-1),K=V===void 0?0:$0(V),U=q.next(),X=q.next(),W=0;while(!U.done){let H=U.value,j=$0(H);if(K+j<=J)$[$.length-1]+=H;else $.push(H),K=0;if(H===k$||H===ZQ)Y=!0,G=Q.startsWith(p6,W+1);if(Y){if(G){if(H===c6)Y=!1,G=!1}else if(H===LQ)Y=!1}else if(K+=j,K===J&&!X.done)$.push(""),K=0;U=X,X=q.next(),W+=H.length}if(V=$.at(-1),!K&&V!==void 0&&V.length&&$.length>1)$[$.length-2]+=$.pop()},Aq=($)=>{let Q=$.split(" "),J=Q.length;while(J){if($0(Q[J-1]))break;J--}if(J===Q.length)return $;return Q.slice(0,J).join(" ")+Q.slice(J).join("")},Rq=($,Q,J={})=>{if(J.trim!==!1&&$.trim()==="")return"";let q="",Y,G,V=$.split(" "),K=[""],U=0;for(let H=0;H<V.length;H++){let j=V[H];if(J.trim!==!1){let Z=K.at(-1)??"",L=Z.trimStart();if(Z.length!==L.length)K[K.length-1]=L,U=$0(L)}if(H!==0){if(U>=Q&&(J.wordWrap===!1||J.trim===!1))K.push(""),U=0;if(U||J.trim===!1)K[K.length-1]+=" ",U++}let F=$0(j);if(J.hard&&F>Q){let Z=Q-U,L=1+Math.floor((F-Z-1)/Q);if(Math.floor((F-1)/Q)<L)K.push("");m6(K,j,Q),U=$0(K.at(-1)??"");continue}if(U+F>Q&&U&&F){if(J.wordWrap===!1&&U<Q){m6(K,j,Q),U=$0(K.at(-1)??"");continue}K.push(""),U=0}if(U+F>Q&&J.wordWrap===!1){m6(K,j,Q),U=$0(K.at(-1)??"");continue}K[K.length-1]+=j,U+=F}if(J.trim!==!1)K=K.map((H)=>Aq(H));let X=K.join(`
|
|
8
|
+
`),W=!1;for(let H=0;H<X.length;H++){let j=X[H];if(q+=j,!W){if(W=j>="\uD800"&&j<="\uDBFF",W)continue}else W=!1;if(j===k$||j===ZQ){jQ.lastIndex=H+1;let Z=jQ.exec(X)?.groups;if(Z?.code!==void 0){let L=Number.parseFloat(Z.code);Y=L===vq?void 0:L}else if(Z?.uri!==void 0)G=Z.uri.length===0?void 0:Z.uri}if(X[H+1]===`
|
|
9
|
+
`){if(G)q+=PQ("");let F=Y?HQ(Y):void 0;if(Y&&F)q+=FQ(F)}else if(j===`
|
|
10
|
+
`){if(Y&&HQ(Y))q+=FQ(Y);if(G)q+=PQ(G)}}return q},kq=/\r?\n/;function N0($,Q,J){return String($).normalize().split(kq).map((q)=>Rq(q,Q,J)).join(`
|
|
11
|
+
`)}var s=R$(d6(),1);import{ReadStream as IQ}from"node:tty";function H1($,Q,J){if(!J.some((V)=>!V.disabled))return $;let q=$+Q,Y=Math.max(J.length-1,0),G=q<0?Y:q>Y?0:q;return J[G].disabled?H1(G,Q<0?-1:1,J):G}function E$($,Q,J,q){let Y=q.split(`
|
|
12
|
+
`),G=0,V=$;for(let U of Y){if(V<=U.length)break;V-=U.length+1,G++}for(G=Math.max(0,Math.min(Y.length-1,G+J)),V=Math.min(V,Y[G].length)+Q;V<0&&G>0;)G--,V+=Y[G].length+1;for(;V>Y[G].length&&G<Y.length-1;)V-=Y[G].length+1,G++;V=Math.max(0,Math.min(Y[G].length,V));let K=0;for(let U=0;U<G;U++)K+=Y[U].length+1;return K+V}var gq=["up","down","left","right","space","enter","cancel"],Tq=["January","February","March","April","May","June","July","August","September","October","November","December"],n={actions:new Set(gq),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]]),messages:{cancel:"Canceled",error:"Something went wrong"},withGuide:!0,date:{monthNames:[...Tq],messages:{required:"Please enter a valid date",invalidMonth:"There are only 12 months in a year",invalidDay:($,Q)=>`There are only ${$} days in ${Q}`,afterMin:($)=>`Date must be on or after ${$.toISOString().slice(0,10)}`,beforeMax:($)=>`Date must be on or before ${$.toISOString().slice(0,10)}`}}};function a6($,Q){if(typeof $=="string")return n.aliases.get($)===Q;for(let J of $)if(J!==void 0&&a6(J,Q))return!0;return!1}function yq($,Q){if($===Q)return;let J=$.split(`
|
|
13
|
+
`),q=Q.split(`
|
|
14
|
+
`),Y=Math.max(J.length,q.length),G=[];for(let V=0;V<Y;V++)J[V]!==q[V]&&G.push(V);return{lines:G,numLinesBefore:J.length,numLinesAfter:q.length,numLines:Y}}var hq=globalThis.process.platform.startsWith("win"),i6=Symbol("clack:cancel");function _1($){return $===i6}function x$($,Q){let J=$;J.isTTY&&J.setRawMode(Q)}function DQ({input:$=BQ,output:Q=r6,overwrite:J=!0,hideCursor:q=!0}={}){let Y=_0.createInterface({input:$,output:Q,prompt:"",tabSize:1});_0.emitKeypressEvents($,Y),$ instanceof IQ&&$.isTTY&&$.setRawMode(!0);let G=(V,{name:K,sequence:U})=>{let X=String(V);if(a6([X,K,U],"cancel")){q&&Q.write(s.cursor.show),process.exit(0);return}if(!J)return;_0.moveCursor(Q,K==="return"?0:-1,K==="return"?-1:0,()=>{_0.clearLine(Q,1,()=>{$.once("keypress",G)})})};return q&&Q.write(s.cursor.hide),$.once("keypress",G),()=>{$.off("keypress",G),q&&Q.write(s.cursor.show),$ instanceof IQ&&$.isTTY&&!hq&&$.setRawMode(!1),Y.terminal=!1,Y.close()}}var m1=($)=>("columns"in $)&&typeof $.columns=="number"?$.columns:80,s6=($)=>("rows"in $)&&typeof $.rows=="number"?$.rows:20;function c1($,Q,J,q=J,Y=J,G){let V=m1($??r6);return N0(Q,V-J.length,{hard:!0,trim:!1}).split(`
|
|
15
|
+
`).map((K,U,X)=>{let W=G?G(K,U):K;return U===0?`${q}${W}`:U===X.length-1?`${Y}${W}`:`${J}${W}`}).join(`
|
|
16
|
+
`)}function wQ($,Q){if("~standard"in $){let J=$["~standard"].validate(Q);if(J instanceof Promise)throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");return J.issues?.at(0)?.message}return $(Q)}class a0{input;output;_abortSignal;rl;opts;_render;_track=!1;_prevFrame="";_subscribers=new Map;_cursor=0;state="initial";error="";value;userInput="";constructor($,Q=!0){let{input:J=BQ,output:q=r6,render:Y,signal:G,...V}=$;this.opts=V,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=Y.bind(this),this._track=Q,this._abortSignal=G,this.input=J,this.output=q}unsubscribe(){this._subscribers.clear()}setSubscriber($,Q){let J=this._subscribers.get($)??[];J.push(Q),this._subscribers.set($,J)}on($,Q){this.setSubscriber($,{cb:Q})}once($,Q){this.setSubscriber($,{cb:Q,once:!0})}emit($,...Q){let J=this._subscribers.get($)??[],q=[];for(let Y of J)Y.cb(...Q),Y.once&&q.push(()=>J.splice(J.indexOf(Y),1));for(let Y of q)Y()}prompt(){return new Promise(($)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),$(i6);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}this.rl=Sq.createInterface({input:this.input,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),this.rl.prompt(),this.opts.initialUserInput!==void 0&&this._setUserInput(this.opts.initialUserInput,!0),this.input.on("keypress",this.onKeypress),x$(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),x$(this.input,!1),$(this.value)}),this.once("cancel",()=>{this.output.write(s.cursor.show),this.output.off("resize",this.render),x$(this.input,!1),$(i6)})})}_isActionKey($,Q){return $==="\t"}_shouldSubmit($,Q){return!0}_setValue($){this.value=$,this.emit("value",this.value)}_setUserInput($,Q){this.userInput=$??"",this.emit("userInput",this.userInput),Q&&this._track&&this.rl&&(this.rl.write(this.userInput),this._cursor=this.rl.cursor)}_clearUserInput(){this.rl?.write(null,{ctrl:!0,name:"u"}),this._setUserInput("")}onKeypress($,Q){if(this._track&&Q.name!=="return"&&(Q.name&&this._isActionKey($,Q)&&this.rl?.write(null,{ctrl:!0,name:"h"}),this._cursor=this.rl?.cursor??0,this._setUserInput(this.rl?.line)),this.state==="error"&&(this.state="active"),Q?.name&&(!this._track&&n.aliases.has(Q.name)&&this.emit("cursor",n.aliases.get(Q.name)),n.actions.has(Q.name)&&this.emit("cursor",Q.name)),$&&($.toLowerCase()==="y"||$.toLowerCase()==="n")&&this.emit("confirm",$.toLowerCase()==="y"),this.emit("key",$,Q),Q?.name==="return"&&this._shouldSubmit($,Q)){if(this.opts.validate){let J=wQ(this.opts.validate,this.value);J&&(this.error=J instanceof Error?J.message:J,this.state="error",this.rl?.write(this.userInput))}this.state!=="error"&&(this.state="submit")}a6([$,Q?.name,Q?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
17
|
+
`),x$(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let $=N0(this._prevFrame,process.stdout.columns,{hard:!0,trim:!1}).split(`
|
|
18
|
+
`).length-1;this.output.write(s.cursor.move(-999,$*-1))}render(){let $=N0(this._render(this)??"",process.stdout.columns,{hard:!0,trim:!1});if($!==this._prevFrame){if(this.state==="initial")this.output.write(s.cursor.hide);else{let Q=yq(this._prevFrame,$),J=s6(this.output);if(this.restoreCursor(),Q){let q=Math.max(0,Q.numLinesAfter-J),Y=Math.max(0,Q.numLinesBefore-J),G=Q.lines.find((V)=>V>=q);if(G===void 0){this._prevFrame=$;return}if(Q.lines.length===1){this.output.write(s.cursor.move(0,G-Y)),this.output.write(s.erase.lines(1));let V=$.split(`
|
|
19
|
+
`);this.output.write(V[G]),this._prevFrame=$,this.output.write(s.cursor.move(0,V.length-G-1));return}else if(Q.lines.length>1){if(q<Y)G=q;else{let K=G-Y;K>0&&this.output.write(s.cursor.move(0,K))}this.output.write(s.erase.down());let V=$.split(`
|
|
20
|
+
`).slice(G);this.output.write(V.join(`
|
|
21
|
+
`)),this._prevFrame=$;return}}this.output.write(s.erase.down())}this.output.write($),this.state==="initial"&&(this.state="active"),this._prevFrame=$}}}function bq($,Q){if($===void 0||Q.length===0)return 0;let J=Q.findIndex((q)=>q.value===$);return J!==-1?J:0}function fq($,Q){return(Q.label??String(Q.value)).toLowerCase().includes($.toLowerCase())}function _q($,Q){if(Q)return $?Q:Q[0]}var mq=class extends a0{filteredOptions;multiple;isNavigating=!1;selectedValues=[];focusedValue;#Q=0;#Y="";#$;#G;#K;get cursor(){return this.#Q}get userInputWithCursor(){if(!this.userInput)return o6(["inverse","hidden"],"_");if(this._cursor>=this.userInput.length)return`${this.userInput}█`;let Q=this.userInput.slice(0,this._cursor),[J,...q]=this.userInput.slice(this._cursor);return`${Q}${o6("inverse",J)}${q.join("")}`}get options(){return typeof this.#G=="function"?this.#G():this.#G}constructor(Q){super(Q),this.#G=Q.options,this.#K=Q.placeholder;let J=this.options;this.filteredOptions=[...J],this.multiple=Q.multiple===!0,this.#$=typeof Q.options=="function"?Q.filter:Q.filter??fq;let q;if(Q.initialValue&&Array.isArray(Q.initialValue)?this.multiple?q=Q.initialValue:q=Q.initialValue.slice(0,1):!this.multiple&&this.options.length>0&&(q=[this.options[0].value]),q)for(let Y of q){let G=J.findIndex((V)=>V.value===Y);G!==-1&&(this.toggleSelected(Y),this.#Q=G)}this.focusedValue=this.options[this.#Q]?.value,this.on("key",(Y,G)=>this.#J(Y,G)),this.on("userInput",(Y)=>this.#q(Y))}_isActionKey(Q,J){return Q==="\t"||this.multiple&&this.isNavigating&&J.name==="space"&&Q!==void 0&&Q!==""}#J(Q,J){let q=J.name==="up",Y=J.name==="down",G=J.name==="return",V=this.userInput===""||this.userInput==="\t",K=this.#K,U=this.options,X=K!==void 0&&K!==""&&U.some((W)=>!W.disabled&&(this.#$?this.#$(K,W):!0));if(J.name==="tab"&&V&&X){this.userInput==="\t"&&this._clearUserInput(),this._setUserInput(K,!0),this.isNavigating=!1;return}q||Y?(this.#Q=H1(this.#Q,q?-1:1,this.filteredOptions),this.focusedValue=this.filteredOptions[this.#Q]?.value,this.multiple||(this.selectedValues=[this.focusedValue]),this.isNavigating=!0):G?this.value=_q(this.multiple,this.selectedValues):this.multiple?this.focusedValue!==void 0&&(J.name==="tab"||this.isNavigating&&J.name==="space")?this.toggleSelected(this.focusedValue):this.isNavigating=!1:(this.focusedValue&&(this.selectedValues=[this.focusedValue]),this.isNavigating=!1)}deselectAll(){this.selectedValues=[]}toggleSelected(Q){this.filteredOptions.length!==0&&(this.multiple?this.selectedValues.includes(Q)?this.selectedValues=this.selectedValues.filter((J)=>J!==Q):this.selectedValues=[...this.selectedValues,Q]:this.selectedValues=[Q])}#q(Q){if(Q!==this.#Y){this.#Y=Q;let J=this.options;Q&&this.#$?this.filteredOptions=J.filter((G)=>this.#$?.(Q,G)):this.filteredOptions=[...J];let q=bq(this.focusedValue,this.filteredOptions);this.#Q=H1(q,0,this.filteredOptions);let Y=this.filteredOptions[this.#Q];Y&&!Y.disabled?this.focusedValue=Y.value:this.focusedValue=void 0,this.multiple||(this.focusedValue!==void 0?this.toggleSelected(this.focusedValue):this.deselectAll())}}};class t6 extends a0{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor($){super($,!1),this.value=!!$.initialValue,this.on("userInput",()=>{this.value=this._value}),this.on("confirm",(Q)=>{this.output.write(s.cursor.move(0,-1)),this.value=Q,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}}var cq={Y:{type:"year",len:4},M:{type:"month",len:2},D:{type:"day",len:2}};function OQ($){return[...$].map((Q)=>cq[Q])}function pq($){let Q=new Intl.DateTimeFormat($,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(new Date(2000,0,15)),J=[],q="/";for(let Y of Q)Y.type==="literal"?q=Y.value.trim()||Y.value:(Y.type==="year"||Y.type==="month"||Y.type==="day")&&J.push({type:Y.type,len:Y.type==="year"?4:2});return{segments:J,separator:q}}function l6($){return Number.parseInt(($||"0").replace(/_/g,"0"),10)||0}function S$($){return{year:l6($.year),month:l6($.month),day:l6($.day)}}function n6($,Q){return new Date($||2001,Q||1,0).getDate()}function vQ($){let{year:Q,month:J,day:q}=S$($);if(!Q||Q<0||Q>9999||!J||J<1||J>12||!q||q<1)return;let Y=new Date(Date.UTC(Q,J-1,q));if(!(Y.getUTCFullYear()!==Q||Y.getUTCMonth()!==J-1||Y.getUTCDate()!==q))return{year:Q,month:J,day:q}}function NQ($){let Q=vQ($);return Q?new Date(Date.UTC(Q.year,Q.month-1,Q.day)):void 0}function uq($,Q,J,q){let Y=J?{year:J.getUTCFullYear(),month:J.getUTCMonth()+1,day:J.getUTCDate()}:null,G=q?{year:q.getUTCFullYear(),month:q.getUTCMonth()+1,day:q.getUTCDate()}:null;return $==="year"?{min:Y?.year??1,max:G?.year??9999}:$==="month"?{min:Y&&Q.year===Y.year?Y.month:1,max:G&&Q.year===G.year?G.month:12}:{min:Y&&Q.year===Y.year&&Q.month===Y.month?Y.day:1,max:G&&Q.year===G.year&&Q.month===G.month?G.day:n6(Q.year,Q.month)}}class CQ extends a0{#Q;#Y;#$;#G;#K;#J={segmentIndex:0,positionInSegment:0};#q=!0;#V=null;inlineError="";get segmentCursor(){return{...this.#J}}get segmentValues(){return{...this.#$}}get segments(){return this.#Q}get separator(){return this.#Y}get formattedValue(){return this.#j(this.#$)}#j($){return this.#Q.map((Q)=>$[Q.type]).join(this.#Y)}#X(){this._setUserInput(this.#j(this.#$)),this._setValue(NQ(this.#$)??void 0)}constructor($){let Q=$.format?{segments:OQ($.format),separator:$.separator??"/"}:pq($.locale),J=$.separator??Q.separator,q=$.format?OQ($.format):Q.segments,Y=$.initialValue??$.defaultValue,G=Y?{year:String(Y.getUTCFullYear()).padStart(4,"0"),month:String(Y.getUTCMonth()+1).padStart(2,"0"),day:String(Y.getUTCDate()).padStart(2,"0")}:{year:"____",month:"__",day:"__"},V=q.map((K)=>G[K.type]).join(J);super({...$,initialUserInput:V},!1),this.#Q=q,this.#Y=J,this.#$=G,this.#G=$.minDate,this.#K=$.maxDate,this.#X(),this.on("cursor",(K)=>this.#P(K)),this.on("key",(K,U)=>this.#Z(K,U)),this.on("finalize",()=>this.#z($))}#W(){let $=Math.max(0,Math.min(this.#J.segmentIndex,this.#Q.length-1)),Q=this.#Q[$];if(Q)return this.#J.positionInSegment=Math.max(0,Math.min(this.#J.positionInSegment,Q.len-1)),{segment:Q,index:$}}#U($){this.inlineError="",this.#V=null;let Q=this.#W();Q&&(this.#J.segmentIndex=Math.max(0,Math.min(this.#Q.length-1,Q.index+$)),this.#J.positionInSegment=0,this.#q=!0)}#H($){let Q=this.#W();if(!Q)return;let{segment:J}=Q,q=this.#$[J.type],Y=!q||q.replace(/_/g,"")==="",G=Number.parseInt((q||"0").replace(/_/g,"0"),10)||0,V=uq(J.type,S$(this.#$),this.#G,this.#K),K;Y?K=$===1?V.min:V.max:K=Math.max(Math.min(V.max,G+$),V.min),this.#$={...this.#$,[J.type]:K.toString().padStart(J.len,"0")},this.#q=!0,this.#V=null,this.#X()}#P($){if($)switch($){case"right":return this.#U(1);case"left":return this.#U(-1);case"up":return this.#H(1);case"down":return this.#H(-1)}}#Z($,Q){if(Q?.name==="backspace"||Q?.sequence===""||Q?.sequence==="\b"||$===""||$==="\b"){this.inlineError="";let J=this.#W();if(!J)return;if(!this.#$[J.segment.type].replace(/_/g,"")){this.#U(-1);return}this.#$[J.segment.type]="_".repeat(J.segment.len),this.#q=!0,this.#J.positionInSegment=0,this.#X();return}if(Q?.name==="tab"){this.inlineError="";let J=this.#W();if(!J)return;let q=Q.shift?-1:1,Y=J.index+q;Y>=0&&Y<this.#Q.length&&(this.#J.segmentIndex=Y,this.#J.positionInSegment=0,this.#q=!0);return}if($&&/^[0-9]$/.test($)){let J=this.#W();if(!J)return;let{segment:q}=J,Y=!this.#$[q.type].replace(/_/g,"");if(this.#q&&this.#V!==null&&!Y){let j=this.#V+$,F={...this.#$,[q.type]:j},Z=this.#F(F,q);if(Z){this.inlineError=Z,this.#V=null,this.#q=!1;return}this.inlineError="",this.#$[q.type]=j,this.#V=null,this.#q=!1,this.#X(),J.index<this.#Q.length-1&&(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0);return}this.#q&&!Y&&(this.#$[q.type]="_".repeat(q.len),this.#J.positionInSegment=0),this.#q=!1,this.#V=null;let G=this.#$[q.type],V=G.indexOf("_"),K=V>=0?V:Math.min(this.#J.positionInSegment,q.len-1);if(K<0||K>=q.len)return;let U=G.slice(0,K)+$+G.slice(K+1),X=!1;if(K===0&&G==="__"&&(q.type==="month"||q.type==="day")){let j=Number.parseInt($,10);U=`0${$}`,X=j<=(q.type==="month"?1:2)}if(q.type==="year"&&(U=(G.replace(/_/g,"")+$).padStart(q.len,"_")),!U.includes("_")){let j={...this.#$,[q.type]:U},F=this.#F(j,q);if(F){this.inlineError=F;return}}this.inlineError="",this.#$[q.type]=U;let W=U.includes("_")?void 0:vQ(this.#$);if(W){let{year:j,month:F}=W,Z=n6(j,F);this.#$={year:String(Math.max(0,Math.min(9999,j))).padStart(4,"0"),month:String(Math.max(1,Math.min(12,F))).padStart(2,"0"),day:String(Math.max(1,Math.min(Z,W.day))).padStart(2,"0")}}this.#X();let H=U.indexOf("_");X?(this.#q=!0,this.#V=$):H>=0?this.#J.positionInSegment=H:V>=0&&J.index<this.#Q.length-1?(this.#J.segmentIndex=J.index+1,this.#J.positionInSegment=0,this.#q=!0):this.#J.positionInSegment=Math.min(K+1,q.len-1)}}#F($,Q){let{month:J,day:q}=S$($);if(Q.type==="month"&&(J<0||J>12))return n.date.messages.invalidMonth;if(Q.type==="day"&&(q<0||q>31))return n.date.messages.invalidDay(31,"any month")}#z($){let{year:Q,month:J,day:q}=S$(this.#$);if(Q&&J&&q){let Y=n6(Q,J);this.#$={...this.#$,day:String(Math.min(q,Y)).padStart(2,"0")}}this.value=NQ(this.#$)??$.defaultValue??void 0}}var dq=class extends a0{options;cursor=0;#Q;getGroupItems(Q){return this.options.filter((J)=>J.group===Q)}isGroupSelected(Q){let J=this.getGroupItems(Q),q=this.value;return q===void 0?!1:J.every((Y)=>q.includes(Y.value))}toggleValue(){let Q=this.options[this.cursor];if(this.value===void 0&&(this.value=[]),Q.group===!0){let J=Q.value,q=this.getGroupItems(J);this.isGroupSelected(J)?this.value=this.value.filter((Y)=>q.findIndex((G)=>G.value===Y)===-1):this.value=[...this.value,...q.map((Y)=>Y.value)],this.value=Array.from(new Set(this.value))}else{let J=this.value.includes(Q.value);this.value=J?this.value.filter((q)=>q!==Q.value):[...this.value,Q.value]}}constructor(Q){super(Q,!1);let{options:J}=Q;this.#Q=Q.selectableGroups!==!1,this.options=Object.entries(J).flatMap(([q,Y])=>[{value:q,group:!0,label:q},...Y.map((G)=>({...G,group:q}))]),this.value=[...Q.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:q})=>q===Q.cursorAt),this.#Q?0:1),this.on("cursor",(q)=>{switch(q){case"left":case"up":{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case"down":case"right":{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let Y=this.options[this.cursor]?.group===!0;!this.#Q&&Y&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case"space":this.toggleValue();break}})}},lq=new Set(["up","down","left","right"]);class AQ extends a0{#Q=!1;#Y;focused="editor";get userInputWithCursor(){if(this.state==="submit")return this.userInput;let $=this.userInput;if(this.cursor>=$.length)return`${$}█`;let Q=$.slice(0,this.cursor),J=$[this.cursor],q=$.slice(this.cursor+1);return J===`
|
|
22
|
+
`?`${Q}█
|
|
23
|
+
${q}`:`${Q}${o6("inverse",J)}${q}`}get cursor(){return this._cursor}#$($){if(this.userInput.length===0){this._setUserInput($);return}this._setUserInput(this.userInput.slice(0,this.cursor)+$+this.userInput.slice(this.cursor))}#G($){let Q=this.value??"";switch($){case"up":this._cursor=E$(this._cursor,0,-1,Q);return;case"down":this._cursor=E$(this._cursor,0,1,Q);return;case"left":this._cursor=E$(this._cursor,-1,0,Q);return;case"right":this._cursor=E$(this._cursor,1,0,Q);return}}_shouldSubmit($,Q){if(this.#Y)return this.focused==="submit"?!0:(this.#$(`
|
|
24
|
+
`),this._cursor++,!1);let J=this.#Q;return this.#Q=!0,J?(this.userInput[this.cursor-1]===`
|
|
25
|
+
`&&(this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--),!0):(this.#$(`
|
|
26
|
+
`),this._cursor++,!1)}constructor($){super($,!1),this.#Y=$.showSubmit??!1,this.on("key",(Q,J)=>{if(J?.name&&lq.has(J.name)){this.#G(J.name);return}if(Q==="\t"&&this.#Y){this.focused=this.focused==="editor"?"submit":"editor";return}if(J?.name!=="return"){if(this.#Q=!1,J?.name==="backspace"&&this.cursor>0){this._setUserInput(this.userInput.slice(0,this.cursor-1)+this.userInput.slice(this.cursor)),this._cursor--;return}if(J?.name==="delete"&&this.cursor<this.userInput.length){this._setUserInput(this.userInput.slice(0,this.cursor)+this.userInput.slice(this.cursor+1));return}Q&&(this.#Y&&this.focused==="submit"&&(this.focused="editor"),this.#$(Q??""),this._cursor++)}}),this.on("userInput",(Q)=>{this._setValue(Q)}),this.on("finalize",()=>{this.value||(this.value=$.defaultValue),this.value===void 0&&(this.value="")})}}class e6 extends a0{options;cursor=0;get _selectedValue(){return this.options[this.cursor]}changeValue(){this.value=this._selectedValue.value}constructor($){super($,!1),this.options=$.options;let Q=this.options.findIndex(({value:q})=>q===$.initialValue),J=Q===-1?0:Q;this.cursor=this.options[J].disabled?H1(J,1,this.options):J,this.changeValue(),this.on("cursor",(q)=>{switch(q){case"left":case"up":this.cursor=H1(this.cursor,-1,this.options);break;case"down":case"right":this.cursor=H1(this.cursor,1,this.options);break}this.changeValue()})}}import{styleText as R,stripVTControlCharacters as VH}from"node:util";import U0 from"node:process";var p1=R$(d6(),1);function oq(){if(U0.platform!=="win32")return U0.env.TERM!=="linux";return Boolean(U0.env.CI)||Boolean(U0.env.WT_SESSION)||Boolean(U0.env.TERMINUS_SUBLIME)||U0.env.ConEmuTask==="{cmd::Cmder}"||U0.env.TERM_PROGRAM==="Terminus-Sublime"||U0.env.TERM_PROGRAM==="vscode"||U0.env.TERM==="xterm-256color"||U0.env.TERM==="alacritty"||U0.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var $8=oq(),iq=()=>process.env.CI==="true";var T=($,Q)=>$8?$:Q,nq=T("◆","*"),EQ=T("■","x"),xQ=T("▲","x"),J8=T("◇","o"),rq=T("┌","T"),c=T("│","|"),y$=T("└","—"),UH=T("┐","T"),jH=T("┘","—"),Q8=T("●",">"),T$=T("○"," "),HH=T("◻","[•]"),FH=T("◼","[+]"),PH=T("◻","[ ]"),ZH=T("▪","•"),RQ=T("─","-"),aq=T("╮","+"),sq=T("├","+"),tq=T("╯","+"),eq=T("╰","+"),zH=T("╭","+"),LH=T("●","•"),MH=T("◆","*"),IH=T("▲","!"),OH=T("■","x"),SQ=($)=>{switch($){case"initial":case"active":return R("cyan",nq);case"cancel":return R("red",EQ);case"error":return R("yellow",xQ);case"submit":return R("green",J8)}},$Y=($)=>{switch($){case"initial":case"active":return R("cyan",c);case"cancel":return R("red",c);case"error":return R("yellow",c);case"submit":return R("green",c)}},kQ=($,Q,J,q,Y,G=!1)=>{let V=Q,K=0;if(G)for(let U=q-1;U>=J&&(V-=$[U].length,K++,!(V<=Y));U--);else for(let U=J;U<q&&(V-=$[U].length,K++,!(V<=Y));U++);return{lineCount:V,removals:K}},QY=({cursor:$,options:Q,style:J,output:q=process.stdout,maxItems:Y=Number.POSITIVE_INFINITY,columnPadding:G=0,rowPadding:V=4})=>{let K=m1(q)-G,U=s6(q),X=R("dim","..."),W=Math.max(U-V,0),H=Math.max(Math.min(Y,W),5),j=0;$>=H-3&&(j=Math.max(Math.min($-H+3,Q.length-H),0));let F=H<Q.length&&j>0,Z=H<Q.length&&j+H<Q.length,L=Math.min(j+H,Q.length),N=[],I=0;F&&I++,Z&&I++;let P=j+(F?1:0),B=L-(Z?1:0);for(let z=P;z<B;z++){let D=N0(J(Q[z],z===$),K,{hard:!0,trim:!1}).split(`
|
|
27
|
+
`);N.push(D),I+=D.length}if(I>W){let z=0,D=0,w=I,v=$-P,k=W,E=()=>kQ(N,w,0,v,k),A=()=>kQ(N,w,v+1,N.length,k,!0);F?({lineCount:w,removals:z}=E(),w>k&&(Z||(k-=1),{lineCount:w,removals:D}=A())):(Z||(k-=1),{lineCount:w,removals:D}=A(),w>k&&(k-=1,{lineCount:w,removals:z}=E())),z>0&&(F=!0,N.splice(0,z)),D>0&&(Z=!0,N.splice(N.length-D,D))}let M=[];F&&M.push(X);for(let z of N)for(let D of z)M.push(D);return Z&&M.push(X),M};var gQ=($)=>{let Q=$.active??"Yes",J=$.inactive??"No";return new t6({active:Q,inactive:J,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue??!0,render(){let q=$.withGuide??n.withGuide,Y=`${SQ(this.state)} `,G=q?`${R("gray",c)} `:"",V=c1($.output,$.message,G,Y),K=`${q?`${R("gray",c)}
|
|
68
28
|
`:""}${V}
|
|
69
|
-
|
|
70
|
-
${
|
|
71
|
-
|
|
72
|
-
${
|
|
29
|
+
`,U=this.value?Q:J;switch(this.state){case"submit":{let X=q?`${R("gray",c)} `:"";return`${K}${X}${R("dim",U)}`}case"cancel":{let X=q?`${R("gray",c)} `:"";return`${K}${X}${R(["strikethrough","dim"],U)}${q?`
|
|
30
|
+
${R("gray",c)}`:""}`}default:{let X=q?`${R("cyan",c)} `:"",W=q?R("cyan",y$):"";return`${K}${X}${this.value?`${R("green",Q8)} ${Q}`:`${R("dim",T$)} ${R("dim",Q)}`}${$.vertical?q?`
|
|
31
|
+
${R("cyan",c)} `:`
|
|
32
|
+
`:` ${R("dim","/")} `}${this.value?`${R("dim",T$)} ${R("dim",J)}`:`${R("green",Q8)} ${J}`}
|
|
73
33
|
${W}
|
|
74
|
-
`}}}}).prompt()}
|
|
75
|
-
|
|
76
|
-
`)}
|
|
77
|
-
`)},info:(Q,$)=>{i.message(Q,{...$,symbol:I("blue",SV)})},success:(Q,$)=>{i.message(Q,{...$,symbol:I("green",kV)})},step:(Q,$)=>{i.message(Q,{...$,symbol:I("green",f8)})},warn:(Q,$)=>{i.message(Q,{...$,symbol:I("yellow",yV)})},warning:(Q,$)=>{i.warn(Q,$)},error:(Q,$)=>{i.message(Q,{...$,symbol:I("red",gV)})}},yL={light:_("─","-"),heavy:_("━","="),block:_("█","#")},gL=`${I("gray",y)} `});var g6=w((bL,P5)=>{if(typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0)P5.exports={nextTick:mV};else P5.exports=process;function mV(Q,$,q,J){if(typeof Q!=="function")throw TypeError('"callback" argument must be a function');var Y=arguments.length,V,X;switch(Y){case 0:case 1:return process.nextTick(Q);case 2:return process.nextTick(function(){Q.call(null,$)});case 3:return process.nextTick(function(){Q.call(null,$,q)});case 4:return process.nextTick(function(){Q.call(null,$,q,J)});default:V=Array(Y-1),X=0;while(X<V.length)V[X++]=arguments[X];return process.nextTick(function(){Q.apply(null,V)})}}});var k7=w((fL,S7)=>{var cV={}.toString;S7.exports=Array.isArray||function(Q){return cV.call(Q)=="[object Array]"}});var _6=w((I5,g7)=>{var m8=f("buffer"),X1=m8.Buffer;function y7(Q,$){for(var q in Q)$[q]=Q[q]}if(X1.from&&X1.alloc&&X1.allocUnsafe&&X1.allocUnsafeSlow)g7.exports=m8;else y7(m8,I5),I5.Buffer=e1;function e1(Q,$,q){return X1(Q,$,q)}y7(X1,e1);e1.from=function(Q,$,q){if(typeof Q==="number")throw TypeError("Argument must not be a number");return X1(Q,$,q)};e1.alloc=function(Q,$,q){if(typeof Q!=="number")throw TypeError("Argument must be a number");var J=X1(Q);if($!==void 0)if(typeof q==="string")J.fill($,q);else J.fill($);else J.fill(0);return J};e1.allocUnsafe=function(Q){if(typeof Q!=="number")throw TypeError("Argument must be a number");return X1(Q)};e1.allocUnsafeSlow=function(Q){if(typeof Q!=="number")throw TypeError("Argument must be a number");return m8.SlowBuffer(Q)}});var Q6=w((qX)=>{function uV(Q){if(Array.isArray)return Array.isArray(Q);return c8(Q)==="[object Array]"}qX.isArray=uV;function pV(Q){return typeof Q==="boolean"}qX.isBoolean=pV;function dV(Q){return Q===null}qX.isNull=dV;function lV(Q){return Q==null}qX.isNullOrUndefined=lV;function oV(Q){return typeof Q==="number"}qX.isNumber=oV;function iV(Q){return typeof Q==="string"}qX.isString=iV;function nV(Q){return typeof Q==="symbol"}qX.isSymbol=nV;function rV(Q){return Q===void 0}qX.isUndefined=rV;function aV(Q){return c8(Q)==="[object RegExp]"}qX.isRegExp=aV;function sV(Q){return typeof Q==="object"&&Q!==null}qX.isObject=sV;function tV(Q){return c8(Q)==="[object Date]"}qX.isDate=tV;function eV(Q){return c8(Q)==="[object Error]"||Q instanceof Error}qX.isError=eV;function QX(Q){return typeof Q==="function"}qX.isFunction=QX;function $X(Q){return Q===null||typeof Q==="boolean"||typeof Q==="number"||typeof Q==="string"||typeof Q==="symbol"||typeof Q>"u"}qX.isPrimitive=$X;qX.isBuffer=f("buffer").Buffer.isBuffer;function c8(Q){return Object.prototype.toString.call(Q)}});var _7=w((mL,C5)=>{if(typeof Object.create==="function")C5.exports=function($,q){if(q)$.super_=q,$.prototype=Object.create(q.prototype,{constructor:{value:$,enumerable:!1,writable:!0,configurable:!0}})};else C5.exports=function($,q){if(q){$.super_=q;var J=function(){};J.prototype=q.prototype,$.prototype=new J,$.prototype.constructor=$}}});var $6=w((cL,T5)=>{try{if(u8=f("util"),typeof u8.inherits!=="function")throw"";T5.exports=u8.inherits}catch(Q){T5.exports=_7()}var u8});var f7=w((uL,A5)=>{function NX(Q,$){if(!(Q instanceof $))throw TypeError("Cannot call a class as a function")}var b7=_6().Buffer,b6=f("util");function BX(Q,$,q){Q.copy($,q)}A5.exports=function(){function Q(){NX(this,Q),this.head=null,this.tail=null,this.length=0}return Q.prototype.push=function(q){var J={data:q,next:null};if(this.length>0)this.tail.next=J;else this.head=J;this.tail=J,++this.length},Q.prototype.unshift=function(q){var J={data:q,next:this.head};if(this.length===0)this.tail=J;this.head=J,++this.length},Q.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},Q.prototype.clear=function(){this.head=this.tail=null,this.length=0},Q.prototype.join=function(q){if(this.length===0)return"";var J=this.head,Y=""+J.data;while(J=J.next)Y+=q+J.data;return Y},Q.prototype.concat=function(q){if(this.length===0)return b7.alloc(0);var J=b7.allocUnsafe(q>>>0),Y=this.head,V=0;while(Y)BX(Y.data,J,V),V+=Y.data.length,Y=Y.next;return J},Q}();if(b6&&b6.inspect&&b6.inspect.custom)A5.exports.prototype[b6.inspect.custom]=function(){var Q=b6.inspect({length:this.length});return this.constructor.name+" "+Q}});var D5=w((pL,h7)=>{var p8=g6();function MX(Q,$){var q=this,J=this._readableState&&this._readableState.destroyed,Y=this._writableState&&this._writableState.destroyed;if(J||Y){if($)$(Q);else if(Q){if(!this._writableState)p8.nextTick(d8,this,Q);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,p8.nextTick(d8,this,Q)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy(Q||null,function(V){if(!$&&V){if(!q._writableState)p8.nextTick(d8,q,V);else if(!q._writableState.errorEmitted)q._writableState.errorEmitted=!0,p8.nextTick(d8,q,V)}else if($)$(V)}),this}function PX(){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 d8(Q,$){Q.emit("error",$)}h7.exports={destroy:MX,undestroy:PX}});var c7=w((dL,m7)=>{m7.exports=f("util").deprecate});var R5=w((lL,r7)=>{var _1=g6();r7.exports=a;function p7(Q){var $=this;this.next=null,this.entry=null,this.finish=function(){hX($,Q)}}var IX=["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:_1.nextTick,q6;a.WritableState=h6;var d7=Object.create(Q6());d7.inherits=$6();var CX={deprecate:c7()},l7=f("stream"),o8=_6().Buffer,TX=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function AX(Q){return o8.from(Q)}function DX(Q){return o8.isBuffer(Q)||Q instanceof TX}var o7=D5();d7.inherits(a,l7);function wX(){}function h6(Q,$){q6=q6||b1(),Q=Q||{};var q=$ instanceof q6;if(this.objectMode=!!Q.objectMode,q)this.objectMode=this.objectMode||!!Q.writableObjectMode;var{highWaterMark:J,writableHighWaterMark:Y}=Q,V=this.objectMode?16:16384;if(J||J===0)this.highWaterMark=J;else if(q&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=V;this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var X=Q.decodeStrings===!1;this.decodeStrings=!X,this.defaultEncoding=Q.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(K){yX($,K)},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 p7(this)}h6.prototype.getBuffer=function(){var $=this.bufferedRequest,q=[];while($)q.push($),$=$.next;return q};(function(){try{Object.defineProperty(h6.prototype,"buffer",{get:CX.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(Q){}})();var l8;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function")l8=Function.prototype[Symbol.hasInstance],Object.defineProperty(a,Symbol.hasInstance,{value:function(Q){if(l8.call(this,Q))return!0;if(this!==a)return!1;return Q&&Q._writableState instanceof h6}});else l8=function(Q){return Q instanceof this};function a(Q){if(q6=q6||b1(),!l8.call(a,this)&&!(this instanceof q6))return new a(Q);if(this._writableState=new h6(Q,this),this.writable=!0,Q){if(typeof Q.write==="function")this._write=Q.write;if(typeof Q.writev==="function")this._writev=Q.writev;if(typeof Q.destroy==="function")this._destroy=Q.destroy;if(typeof Q.final==="function")this._final=Q.final}l7.call(this)}a.prototype.pipe=function(){this.emit("error",Error("Cannot pipe, not readable"))};function RX(Q,$){var q=Error("write after end");Q.emit("error",q),_1.nextTick($,q)}function xX(Q,$,q,J){var Y=!0,V=!1;if(q===null)V=TypeError("May not write null values to stream");else if(typeof q!=="string"&&q!==void 0&&!$.objectMode)V=TypeError("Invalid non-string/buffer chunk");if(V)Q.emit("error",V),_1.nextTick(J,V),Y=!1;return Y}a.prototype.write=function(Q,$,q){var J=this._writableState,Y=!1,V=!J.objectMode&&DX(Q);if(V&&!o8.isBuffer(Q))Q=AX(Q);if(typeof $==="function")q=$,$=null;if(V)$="buffer";else if(!$)$=J.defaultEncoding;if(typeof q!=="function")q=wX;if(J.ended)RX(this,q);else if(V||xX(this,J,Q,q))J.pendingcb++,Y=EX(this,J,V,Q,$,q);return Y};a.prototype.cork=function(){var Q=this._writableState;Q.corked++};a.prototype.uncork=function(){var Q=this._writableState;if(Q.corked){if(Q.corked--,!Q.writing&&!Q.corked&&!Q.bufferProcessing&&Q.bufferedRequest)i7(this,Q)}};a.prototype.setDefaultEncoding=function($){if(typeof $==="string")$=$.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf(($+"").toLowerCase())>-1))throw TypeError("Unknown encoding: "+$);return this._writableState.defaultEncoding=$,this};function vX(Q,$,q){if(!Q.objectMode&&Q.decodeStrings!==!1&&typeof $==="string")$=o8.from($,q);return $}Object.defineProperty(a.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function EX(Q,$,q,J,Y,V){if(!q){var X=vX($,J,Y);if(J!==X)q=!0,Y="buffer",J=X}var K=$.objectMode?1:J.length;$.length+=K;var W=$.length<$.highWaterMark;if(!W)$.needDrain=!0;if($.writing||$.corked){var G=$.lastBufferedRequest;if($.lastBufferedRequest={chunk:J,encoding:Y,isBuf:q,callback:V,next:null},G)G.next=$.lastBufferedRequest;else $.bufferedRequest=$.lastBufferedRequest;$.bufferedRequestCount+=1}else w5(Q,$,!1,K,J,Y,V);return W}function w5(Q,$,q,J,Y,V,X){if($.writelen=J,$.writecb=X,$.writing=!0,$.sync=!0,q)Q._writev(Y,$.onwrite);else Q._write(Y,V,$.onwrite);$.sync=!1}function SX(Q,$,q,J,Y){if(--$.pendingcb,q)_1.nextTick(Y,J),_1.nextTick(f6,Q,$),Q._writableState.errorEmitted=!0,Q.emit("error",J);else Y(J),Q._writableState.errorEmitted=!0,Q.emit("error",J),f6(Q,$)}function kX(Q){Q.writing=!1,Q.writecb=null,Q.length-=Q.writelen,Q.writelen=0}function yX(Q,$){var q=Q._writableState,J=q.sync,Y=q.writecb;if(kX(q),$)SX(Q,q,J,$,Y);else{var V=n7(q);if(!V&&!q.corked&&!q.bufferProcessing&&q.bufferedRequest)i7(Q,q);if(J)IX(u7,Q,q,V,Y);else u7(Q,q,V,Y)}}function u7(Q,$,q,J){if(!q)gX(Q,$);$.pendingcb--,J(),f6(Q,$)}function gX(Q,$){if($.length===0&&$.needDrain)$.needDrain=!1,Q.emit("drain")}function i7(Q,$){$.bufferProcessing=!0;var q=$.bufferedRequest;if(Q._writev&&q&&q.next){var J=$.bufferedRequestCount,Y=Array(J),V=$.corkedRequestsFree;V.entry=q;var X=0,K=!0;while(q){if(Y[X]=q,!q.isBuf)K=!1;q=q.next,X+=1}if(Y.allBuffers=K,w5(Q,$,!0,$.length,Y,"",V.finish),$.pendingcb++,$.lastBufferedRequest=null,V.next)$.corkedRequestsFree=V.next,V.next=null;else $.corkedRequestsFree=new p7($);$.bufferedRequestCount=0}else{while(q){var{chunk:W,encoding:G,callback:U}=q,z=$.objectMode?1:W.length;if(w5(Q,$,!1,z,W,G,U),q=q.next,$.bufferedRequestCount--,$.writing)break}if(q===null)$.lastBufferedRequest=null}$.bufferedRequest=q,$.bufferProcessing=!1}a.prototype._write=function(Q,$,q){q(Error("_write() is not implemented"))};a.prototype._writev=null;a.prototype.end=function(Q,$,q){var J=this._writableState;if(typeof Q==="function")q=Q,Q=null,$=null;else if(typeof $==="function")q=$,$=null;if(Q!==null&&Q!==void 0)this.write(Q,$);if(J.corked)J.corked=1,this.uncork();if(!J.ending)fX(this,J,q)};function n7(Q){return Q.ending&&Q.length===0&&Q.bufferedRequest===null&&!Q.finished&&!Q.writing}function _X(Q,$){Q._final(function(q){if($.pendingcb--,q)Q.emit("error",q);$.prefinished=!0,Q.emit("prefinish"),f6(Q,$)})}function bX(Q,$){if(!$.prefinished&&!$.finalCalled)if(typeof Q._final==="function")$.pendingcb++,$.finalCalled=!0,_1.nextTick(_X,Q,$);else $.prefinished=!0,Q.emit("prefinish")}function f6(Q,$){var q=n7($);if(q){if(bX(Q,$),$.pendingcb===0)$.finished=!0,Q.emit("finish")}return q}function fX(Q,$,q){if($.ending=!0,f6(Q,$),q)if($.finished)_1.nextTick(q);else Q.once("finish",q);$.ended=!0,Q.writable=!1}function hX(Q,$,q){var J=Q.entry;Q.entry=null;while(J){var Y=J.callback;$.pendingcb--,Y(q),J=J.next}$.corkedRequestsFree.next=Q}Object.defineProperty(a.prototype,"destroyed",{get:function(){if(this._writableState===void 0)return!1;return this._writableState.destroyed},set:function(Q){if(!this._writableState)return;this._writableState.destroyed=Q}});a.prototype.destroy=o7.destroy;a.prototype._undestroy=o7.undestroy;a.prototype._destroy=function(Q,$){this.end(),$(Q)}});var b1=w((oL,e7)=>{var a7=g6(),mX=Object.keys||function(Q){var $=[];for(var q in Q)$.push(q);return $};e7.exports=K1;var s7=Object.create(Q6());s7.inherits=$6();var t7=v5(),x5=R5();s7.inherits(K1,t7);{i8=mX(x5.prototype);for(m6=0;m6<i8.length;m6++)if(c6=i8[m6],!K1.prototype[c6])K1.prototype[c6]=x5.prototype[c6]}var i8,c6,m6;function K1(Q){if(!(this instanceof K1))return new K1(Q);if(t7.call(this,Q),x5.call(this,Q),Q&&Q.readable===!1)this.readable=!1;if(Q&&Q.writable===!1)this.writable=!1;if(this.allowHalfOpen=!0,Q&&Q.allowHalfOpen===!1)this.allowHalfOpen=!1;this.once("end",cX)}Object.defineProperty(K1.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function cX(){if(this.allowHalfOpen||this._writableState.ended)return;a7.nextTick(uX,this)}function uX(Q){Q.end()}Object.defineProperty(K1.prototype,"destroyed",{get:function(){if(this._readableState===void 0||this._writableState===void 0)return!1;return this._readableState.destroyed&&this._writableState.destroyed},set:function(Q){if(this._readableState===void 0||this._writableState===void 0)return;this._readableState.destroyed=Q,this._writableState.destroyed=Q}});K1.prototype._destroy=function(Q,$){this.push(null),this.end(),a7.nextTick($,Q)}});var k5=w((qK)=>{var S5=_6().Buffer,Q4=S5.isEncoding||function(Q){switch(Q=""+Q,Q&&Q.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 pX(Q){if(!Q)return"utf8";var $;while(!0)switch(Q){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 Q;default:if($)return;Q=(""+Q).toLowerCase(),$=!0}}function dX(Q){var $=pX(Q);if(typeof $!=="string"&&(S5.isEncoding===Q4||!Q4(Q)))throw Error("Unknown encoding: "+Q);return $||Q}qK.StringDecoder=u6;function u6(Q){this.encoding=dX(Q);var $;switch(this.encoding){case"utf16le":this.text=aX,this.end=sX,$=4;break;case"utf8":this.fillLast=iX,$=4;break;case"base64":this.text=tX,this.end=eX,$=3;break;default:this.write=QK,this.end=$K;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=S5.allocUnsafe($)}u6.prototype.write=function(Q){if(Q.length===0)return"";var $,q;if(this.lastNeed){if($=this.fillLast(Q),$===void 0)return"";q=this.lastNeed,this.lastNeed=0}else q=0;if(q<Q.length)return $?$+this.text(Q,q):this.text(Q,q);return $||""};u6.prototype.end=rX;u6.prototype.text=nX;u6.prototype.fillLast=function(Q){if(this.lastNeed<=Q.length)return Q.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Q.copy(this.lastChar,this.lastTotal-this.lastNeed,0,Q.length),this.lastNeed-=Q.length};function E5(Q){if(Q<=127)return 0;else if(Q>>5===6)return 2;else if(Q>>4===14)return 3;else if(Q>>3===30)return 4;return Q>>6===2?-1:-2}function lX(Q,$,q){var J=$.length-1;if(J<q)return 0;var Y=E5($[J]);if(Y>=0){if(Y>0)Q.lastNeed=Y-1;return Y}if(--J<q||Y===-2)return 0;if(Y=E5($[J]),Y>=0){if(Y>0)Q.lastNeed=Y-2;return Y}if(--J<q||Y===-2)return 0;if(Y=E5($[J]),Y>=0){if(Y>0)if(Y===2)Y=0;else Q.lastNeed=Y-3;return Y}return 0}function oX(Q,$,q){if(($[0]&192)!==128)return Q.lastNeed=0,"�";if(Q.lastNeed>1&&$.length>1){if(($[1]&192)!==128)return Q.lastNeed=1,"�";if(Q.lastNeed>2&&$.length>2){if(($[2]&192)!==128)return Q.lastNeed=2,"�"}}}function iX(Q){var $=this.lastTotal-this.lastNeed,q=oX(this,Q,$);if(q!==void 0)return q;if(this.lastNeed<=Q.length)return Q.copy(this.lastChar,$,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);Q.copy(this.lastChar,$,0,Q.length),this.lastNeed-=Q.length}function nX(Q,$){var q=lX(this,Q,$);if(!this.lastNeed)return Q.toString("utf8",$);this.lastTotal=q;var J=Q.length-(q-this.lastNeed);return Q.copy(this.lastChar,0,J),Q.toString("utf8",$,J)}function rX(Q){var $=Q&&Q.length?this.write(Q):"";if(this.lastNeed)return $+"�";return $}function aX(Q,$){if((Q.length-$)%2===0){var q=Q.toString("utf16le",$);if(q){var J=q.charCodeAt(q.length-1);if(J>=55296&&J<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=Q[Q.length-2],this.lastChar[1]=Q[Q.length-1],q.slice(0,-1)}return q}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=Q[Q.length-1],Q.toString("utf16le",$,Q.length-1)}function sX(Q){var $=Q&&Q.length?this.write(Q):"";if(this.lastNeed){var q=this.lastTotal-this.lastNeed;return $+this.lastChar.toString("utf16le",0,q)}return $}function tX(Q,$){var q=(Q.length-$)%3;if(q===0)return Q.toString("base64",$);if(this.lastNeed=3-q,this.lastTotal=3,q===1)this.lastChar[0]=Q[Q.length-1];else this.lastChar[0]=Q[Q.length-2],this.lastChar[1]=Q[Q.length-1];return Q.toString("base64",$,Q.length-q)}function eX(Q){var $=Q&&Q.length?this.write(Q):"";if(this.lastNeed)return $+this.lastChar.toString("base64",0,3-this.lastNeed);return $}function QK(Q){return Q.toString(this.encoding)}function $K(Q){return Q&&Q.length?this.write(Q):""}});var v5=w((rL,Z4)=>{var Y6=g6();Z4.exports=c;var YK=k7(),p6;c.ReadableState=K4;var nL=f("events").EventEmitter,Y4=function(Q,$){return Q.listeners($).length},f5=f("stream"),d6=_6().Buffer,VK=(typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function XK(Q){return d6.from(Q)}function KK(Q){return d6.isBuffer(Q)||Q instanceof VK}var V4=Object.create(Q6());V4.inherits=$6();var y5=f("util"),g=void 0;if(y5&&y5.debuglog)g=y5.debuglog("stream");else g=function(){};var GK=f7(),X4=D5(),J6;V4.inherits(c,f5);var g5=["error","close","destroy","pause","resume"];function WK(Q,$,q){if(typeof Q.prependListener==="function")return Q.prependListener($,q);if(!Q._events||!Q._events[$])Q.on($,q);else if(YK(Q._events[$]))Q._events[$].unshift(q);else Q._events[$]=[q,Q._events[$]]}function K4(Q,$){p6=p6||b1(),Q=Q||{};var q=$ instanceof p6;if(this.objectMode=!!Q.objectMode,q)this.objectMode=this.objectMode||!!Q.readableObjectMode;var{highWaterMark:J,readableHighWaterMark:Y}=Q,V=this.objectMode?16:16384;if(J||J===0)this.highWaterMark=J;else if(q&&(Y||Y===0))this.highWaterMark=Y;else this.highWaterMark=V;if(this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new GK,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=Q.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,Q.encoding){if(!J6)J6=k5().StringDecoder;this.decoder=new J6(Q.encoding),this.encoding=Q.encoding}}function c(Q){if(p6=p6||b1(),!(this instanceof c))return new c(Q);if(this._readableState=new K4(Q,this),this.readable=!0,Q){if(typeof Q.read==="function")this._read=Q.read;if(typeof Q.destroy==="function")this._destroy=Q.destroy}f5.call(this)}Object.defineProperty(c.prototype,"destroyed",{get:function(){if(this._readableState===void 0)return!1;return this._readableState.destroyed},set:function(Q){if(!this._readableState)return;this._readableState.destroyed=Q}});c.prototype.destroy=X4.destroy;c.prototype._undestroy=X4.undestroy;c.prototype._destroy=function(Q,$){this.push(null),$(Q)};c.prototype.push=function(Q,$){var q=this._readableState,J;if(!q.objectMode){if(typeof Q==="string"){if($=$||q.defaultEncoding,$!==q.encoding)Q=d6.from(Q,$),$="";J=!0}}else J=!0;return G4(this,Q,$,!1,J)};c.prototype.unshift=function(Q){return G4(this,Q,null,!0,!1)};function G4(Q,$,q,J,Y){var V=Q._readableState;if($===null)V.reading=!1,zK(Q,V);else{var X;if(!Y)X=UK(V,$);if(X)Q.emit("error",X);else if(V.objectMode||$&&$.length>0){if(typeof $!=="string"&&!V.objectMode&&Object.getPrototypeOf($)!==d6.prototype)$=XK($);if(J)if(V.endEmitted)Q.emit("error",Error("stream.unshift() after end event"));else _5(Q,V,$,!0);else if(V.ended)Q.emit("error",Error("stream.push() after EOF"));else if(V.reading=!1,V.decoder&&!q)if($=V.decoder.write($),V.objectMode||$.length!==0)_5(Q,V,$,!1);else W4(Q,V);else _5(Q,V,$,!1)}else if(!J)V.reading=!1}return jK(V)}function _5(Q,$,q,J){if($.flowing&&$.length===0&&!$.sync)Q.emit("data",q),Q.read(0);else{if($.length+=$.objectMode?1:q.length,J)$.buffer.unshift(q);else $.buffer.push(q);if($.needReadable)n8(Q)}W4(Q,$)}function UK(Q,$){var q;if(!KK($)&&typeof $!=="string"&&$!==void 0&&!Q.objectMode)q=TypeError("Invalid non-string/buffer chunk");return q}function jK(Q){return!Q.ended&&(Q.needReadable||Q.length<Q.highWaterMark||Q.length===0)}c.prototype.isPaused=function(){return this._readableState.flowing===!1};c.prototype.setEncoding=function(Q){if(!J6)J6=k5().StringDecoder;return this._readableState.decoder=new J6(Q),this._readableState.encoding=Q,this};var $4=8388608;function ZK(Q){if(Q>=$4)Q=$4;else Q--,Q|=Q>>>1,Q|=Q>>>2,Q|=Q>>>4,Q|=Q>>>8,Q|=Q>>>16,Q++;return Q}function q4(Q,$){if(Q<=0||$.length===0&&$.ended)return 0;if($.objectMode)return 1;if(Q!==Q)if($.flowing&&$.length)return $.buffer.head.data.length;else return $.length;if(Q>$.highWaterMark)$.highWaterMark=ZK(Q);if(Q<=$.length)return Q;if(!$.ended)return $.needReadable=!0,0;return $.length}c.prototype.read=function(Q){g("read",Q),Q=parseInt(Q,10);var $=this._readableState,q=Q;if(Q!==0)$.emittedReadable=!1;if(Q===0&&$.needReadable&&($.length>=$.highWaterMark||$.ended)){if(g("read: emitReadable",$.length,$.ended),$.length===0&&$.ended)b5(this);else n8(this);return null}if(Q=q4(Q,$),Q===0&&$.ended){if($.length===0)b5(this);return null}var J=$.needReadable;if(g("need readable",J),$.length===0||$.length-Q<$.highWaterMark)J=!0,g("length less than watermark",J);if($.ended||$.reading)J=!1,g("reading or ended",J);else if(J){if(g("do read"),$.reading=!0,$.sync=!0,$.length===0)$.needReadable=!0;if(this._read($.highWaterMark),$.sync=!1,!$.reading)Q=q4(q,$)}var Y;if(Q>0)Y=U4(Q,$);else Y=null;if(Y===null)$.needReadable=!0,Q=0;else $.length-=Q;if($.length===0){if(!$.ended)$.needReadable=!0;if(q!==Q&&$.ended)b5(this)}if(Y!==null)this.emit("data",Y);return Y};function zK(Q,$){if($.ended)return;if($.decoder){var q=$.decoder.end();if(q&&q.length)$.buffer.push(q),$.length+=$.objectMode?1:q.length}$.ended=!0,n8(Q)}function n8(Q){var $=Q._readableState;if($.needReadable=!1,!$.emittedReadable)if(g("emitReadable",$.flowing),$.emittedReadable=!0,$.sync)Y6.nextTick(J4,Q);else J4(Q)}function J4(Q){g("emit readable"),Q.emit("readable"),h5(Q)}function W4(Q,$){if(!$.readingMore)$.readingMore=!0,Y6.nextTick(HK,Q,$)}function HK(Q,$){var q=$.length;while(!$.reading&&!$.flowing&&!$.ended&&$.length<$.highWaterMark)if(g("maybeReadMore read 0"),Q.read(0),q===$.length)break;else q=$.length;$.readingMore=!1}c.prototype._read=function(Q){this.emit("error",Error("_read() is not implemented"))};c.prototype.pipe=function(Q,$){var q=this,J=this._readableState;switch(J.pipesCount){case 0:J.pipes=Q;break;case 1:J.pipes=[J.pipes,Q];break;default:J.pipes.push(Q);break}J.pipesCount+=1,g("pipe count=%d opts=%j",J.pipesCount,$);var Y=(!$||$.end!==!1)&&Q!==process.stdout&&Q!==process.stderr,V=Y?K:C;if(J.endEmitted)Y6.nextTick(V);else q.once("end",V);Q.on("unpipe",X);function X(P,L){if(g("onunpipe"),P===q){if(L&&L.hasUnpiped===!1)L.hasUnpiped=!0,U()}}function K(){g("onend"),Q.end()}var W=FK(q);Q.on("drain",W);var G=!1;function U(){if(g("cleanup"),Q.removeListener("close",F),Q.removeListener("finish",N),Q.removeListener("drain",W),Q.removeListener("error",H),Q.removeListener("unpipe",X),q.removeListener("end",K),q.removeListener("end",C),q.removeListener("data",Z),G=!0,J.awaitDrain&&(!Q._writableState||Q._writableState.needDrain))W()}var z=!1;q.on("data",Z);function Z(P){g("ondata"),z=!1;var L=Q.write(P);if(L===!1&&!z){if((J.pipesCount===1&&J.pipes===Q||J.pipesCount>1&&j4(J.pipes,Q)!==-1)&&!G)g("false write response, pause",J.awaitDrain),J.awaitDrain++,z=!0;q.pause()}}function H(P){if(g("onerror",P),C(),Q.removeListener("error",H),Y4(Q,"error")===0)Q.emit("error",P)}WK(Q,"error",H);function F(){Q.removeListener("finish",N),C()}Q.once("close",F);function N(){g("onfinish"),Q.removeListener("close",F),C()}Q.once("finish",N);function C(){g("unpipe"),q.unpipe(Q)}if(Q.emit("pipe",q),!J.flowing)g("pipe resume"),q.resume();return Q};function FK(Q){return function(){var $=Q._readableState;if(g("pipeOnDrain",$.awaitDrain),$.awaitDrain)$.awaitDrain--;if($.awaitDrain===0&&Y4(Q,"data"))$.flowing=!0,h5(Q)}}c.prototype.unpipe=function(Q){var $=this._readableState,q={hasUnpiped:!1};if($.pipesCount===0)return this;if($.pipesCount===1){if(Q&&Q!==$.pipes)return this;if(!Q)Q=$.pipes;if($.pipes=null,$.pipesCount=0,$.flowing=!1,Q)Q.emit("unpipe",this,q);return this}if(!Q){var{pipes:J,pipesCount:Y}=$;$.pipes=null,$.pipesCount=0,$.flowing=!1;for(var V=0;V<Y;V++)J[V].emit("unpipe",this,{hasUnpiped:!1});return this}var X=j4($.pipes,Q);if(X===-1)return this;if($.pipes.splice(X,1),$.pipesCount-=1,$.pipesCount===1)$.pipes=$.pipes[0];return Q.emit("unpipe",this,q),this};c.prototype.on=function(Q,$){var q=f5.prototype.on.call(this,Q,$);if(Q==="data"){if(this._readableState.flowing!==!1)this.resume()}else if(Q==="readable"){var J=this._readableState;if(!J.endEmitted&&!J.readableListening){if(J.readableListening=J.needReadable=!0,J.emittedReadable=!1,!J.reading)Y6.nextTick(LK,this);else if(J.length)n8(this)}}return q};c.prototype.addListener=c.prototype.on;function LK(Q){g("readable nexttick read 0"),Q.read(0)}c.prototype.resume=function(){var Q=this._readableState;if(!Q.flowing)g("resume"),Q.flowing=!0,OK(this,Q);return this};function OK(Q,$){if(!$.resumeScheduled)$.resumeScheduled=!0,Y6.nextTick(NK,Q,$)}function NK(Q,$){if(!$.reading)g("resume read 0"),Q.read(0);if($.resumeScheduled=!1,$.awaitDrain=0,Q.emit("resume"),h5(Q),$.flowing&&!$.reading)Q.read(0)}c.prototype.pause=function(){if(g("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1)g("pause"),this._readableState.flowing=!1,this.emit("pause");return this};function h5(Q){var $=Q._readableState;g("flow",$.flowing);while($.flowing&&Q.read()!==null);}c.prototype.wrap=function(Q){var $=this,q=this._readableState,J=!1;Q.on("end",function(){if(g("wrapped end"),q.decoder&&!q.ended){var X=q.decoder.end();if(X&&X.length)$.push(X)}$.push(null)}),Q.on("data",function(X){if(g("wrapped data"),q.decoder)X=q.decoder.write(X);if(q.objectMode&&(X===null||X===void 0))return;else if(!q.objectMode&&(!X||!X.length))return;var K=$.push(X);if(!K)J=!0,Q.pause()});for(var Y in Q)if(this[Y]===void 0&&typeof Q[Y]==="function")this[Y]=function(X){return function(){return Q[X].apply(Q,arguments)}}(Y);for(var V=0;V<g5.length;V++)Q.on(g5[V],this.emit.bind(this,g5[V]));return this._read=function(X){if(g("wrapped _read",X),J)J=!1,Q.resume()},this};Object.defineProperty(c.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}});c._fromList=U4;function U4(Q,$){if($.length===0)return null;var q;if($.objectMode)q=$.buffer.shift();else if(!Q||Q>=$.length){if($.decoder)q=$.buffer.join("");else if($.buffer.length===1)q=$.buffer.head.data;else q=$.buffer.concat($.length);$.buffer.clear()}else q=BK(Q,$.buffer,$.decoder);return q}function BK(Q,$,q){var J;if(Q<$.head.data.length)J=$.head.data.slice(0,Q),$.head.data=$.head.data.slice(Q);else if(Q===$.head.data.length)J=$.shift();else J=q?MK(Q,$):PK(Q,$);return J}function MK(Q,$){var q=$.head,J=1,Y=q.data;Q-=Y.length;while(q=q.next){var V=q.data,X=Q>V.length?V.length:Q;if(X===V.length)Y+=V;else Y+=V.slice(0,Q);if(Q-=X,Q===0){if(X===V.length)if(++J,q.next)$.head=q.next;else $.head=$.tail=null;else $.head=q,q.data=V.slice(X);break}++J}return $.length-=J,Y}function PK(Q,$){var q=d6.allocUnsafe(Q),J=$.head,Y=1;J.data.copy(q),Q-=J.data.length;while(J=J.next){var V=J.data,X=Q>V.length?V.length:Q;if(V.copy(q,q.length-Q,0,X),Q-=X,Q===0){if(X===V.length)if(++Y,J.next)$.head=J.next;else $.head=$.tail=null;else $.head=J,J.data=V.slice(X);break}++Y}return $.length-=Y,q}function b5(Q){var $=Q._readableState;if($.length>0)throw Error('"endReadable()" called on non-empty stream');if(!$.endEmitted)$.ended=!0,Y6.nextTick(IK,$,Q)}function IK(Q,$){if(!Q.endEmitted&&Q.length===0)Q.endEmitted=!0,$.readable=!1,$.emit("end")}function j4(Q,$){for(var q=0,J=Q.length;q<J;q++)if(Q[q]===$)return q;return-1}});var m5=w((aL,F4)=>{F4.exports=G1;var r8=b1(),H4=Object.create(Q6());H4.inherits=$6();H4.inherits(G1,r8);function CK(Q,$){var q=this._transformState;q.transforming=!1;var J=q.writecb;if(!J)return this.emit("error",Error("write callback called multiple times"));if(q.writechunk=null,q.writecb=null,$!=null)this.push($);J(Q);var Y=this._readableState;if(Y.reading=!1,Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}function G1(Q){if(!(this instanceof G1))return new G1(Q);if(r8.call(this,Q),this._transformState={afterTransform:CK.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,Q){if(typeof Q.transform==="function")this._transform=Q.transform;if(typeof Q.flush==="function")this._flush=Q.flush}this.on("prefinish",TK)}function TK(){var Q=this;if(typeof this._flush==="function")this._flush(function($,q){z4(Q,$,q)});else z4(this,null,null)}G1.prototype.push=function(Q,$){return this._transformState.needTransform=!1,r8.prototype.push.call(this,Q,$)};G1.prototype._transform=function(Q,$,q){throw Error("_transform() is not implemented")};G1.prototype._write=function(Q,$,q){var J=this._transformState;if(J.writecb=q,J.writechunk=Q,J.writeencoding=$,!J.transforming){var Y=this._readableState;if(J.needTransform||Y.needReadable||Y.length<Y.highWaterMark)this._read(Y.highWaterMark)}};G1.prototype._read=function(Q){var $=this._transformState;if($.writechunk!==null&&$.writecb&&!$.transforming)$.transforming=!0,this._transform($.writechunk,$.writeencoding,$.afterTransform);else $.needTransform=!0};G1.prototype._destroy=function(Q,$){var q=this;r8.prototype._destroy.call(this,Q,function(J){$(J),q.emit("close")})};function z4(Q,$,q){if($)return Q.emit("error",$);if(q!=null)Q.push(q);if(Q._writableState.length)throw Error("Calling transform done when ws.length != 0");if(Q._transformState.transforming)throw Error("Calling transform done when still transforming");return Q.push(null)}});var B4=w((sL,N4)=>{N4.exports=l6;var L4=m5(),O4=Object.create(Q6());O4.inherits=$6();O4.inherits(l6,L4);function l6(Q){if(!(this instanceof l6))return new l6(Q);L4.call(this,Q)}l6.prototype._transform=function(Q,$,q){q(null,Q)}});var c5=w((J0,a8)=>{var l0=f("stream");if(process.env.READABLE_STREAM==="disable"&&l0)a8.exports=l0,J0=a8.exports=l0.Readable,J0.Readable=l0.Readable,J0.Writable=l0.Writable,J0.Duplex=l0.Duplex,J0.Transform=l0.Transform,J0.PassThrough=l0.PassThrough,J0.Stream=l0;else J0=a8.exports=v5(),J0.Stream=l0||J0,J0.Readable=J0,J0.Writable=R5(),J0.Duplex=b1(),J0.Transform=m5(),J0.PassThrough=B4()});var W1=w((DK)=>{DK.base64=!0;DK.array=!0;DK.string=!0;DK.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u";DK.nodebuffer=typeof Buffer<"u";DK.uint8array=typeof Uint8Array<"u";if(typeof ArrayBuffer>"u")DK.blob=!1;else{s8=new ArrayBuffer(0);try{DK.blob=new Blob([s8],{type:"application/zip"}).size===0}catch(Q){try{p5=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,t8=new p5,t8.append(s8),DK.blob=t8.getBlob("application/zip").size===0}catch($){DK.blob=!1}}}var s8,p5,t8;try{DK.nodestream=!!c5().Readable}catch(Q){DK.nodestream=!1}});var d5=w((gK)=>{var kK=l(),yK=W1(),o0="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";gK.encode=function(Q){var $=[],q,J,Y,V,X,K,W,G=0,U=Q.length,z=U,Z=kK.getTypeOf(Q)!=="string";while(G<Q.length){if(z=U-G,!Z)q=Q.charCodeAt(G++),J=G<U?Q.charCodeAt(G++):0,Y=G<U?Q.charCodeAt(G++):0;else q=Q[G++],J=G<U?Q[G++]:0,Y=G<U?Q[G++]:0;V=q>>2,X=(q&3)<<4|J>>4,K=z>1?(J&15)<<2|Y>>6:64,W=z>2?Y&63:64,$.push(o0.charAt(V)+o0.charAt(X)+o0.charAt(K)+o0.charAt(W))}return $.join("")};gK.decode=function(Q){var $,q,J,Y,V,X,K,W=0,G=0,U="data:";if(Q.substr(0,U.length)===U)throw Error("Invalid base64 input, it looks like a data url.");Q=Q.replace(/[^A-Za-z0-9+/=]/g,"");var z=Q.length*3/4;if(Q.charAt(Q.length-1)===o0.charAt(64))z--;if(Q.charAt(Q.length-2)===o0.charAt(64))z--;if(z%1!==0)throw Error("Invalid base64 input, bad content length.");var Z;if(yK.uint8array)Z=new Uint8Array(z|0);else Z=Array(z|0);while(W<Q.length){if(Y=o0.indexOf(Q.charAt(W++)),V=o0.indexOf(Q.charAt(W++)),X=o0.indexOf(Q.charAt(W++)),K=o0.indexOf(Q.charAt(W++)),$=Y<<2|V>>4,q=(V&15)<<4|X>>2,J=(X&3)<<6|K,Z[G++]=$,X!==64)Z[G++]=q;if(K!==64)Z[G++]=J}return Z}});var o6=w((QO,M4)=>{M4.exports={isNode:typeof Buffer<"u",newBufferFrom:function(Q,$){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(Q,$);else{if(typeof Q==="number")throw Error('The "data" argument must not be a number');return new Buffer(Q,$)}},allocBuffer:function(Q){if(Buffer.alloc)return Buffer.alloc(Q);else{var $=new Buffer(Q);return $.fill(0),$}},isBuffer:function(Q){return Buffer.isBuffer(Q)},isStream:function(Q){return Q&&typeof Q.on==="function"&&typeof Q.pause==="function"&&typeof Q.resume==="function"}}});var C4=w((qO,I4)=>{var $O=global.MutationObserver||global.WebKitMutationObserver,P4;P4=function(){process.nextTick(uK)};var fK,hK,mK,cK,l5,i6=[];function uK(){l5=!0;var Q,$,q=i6.length;while(q){$=i6,i6=[],Q=-1;while(++Q<q)$[Q]();q=i6.length}l5=!1}I4.exports=pK;function pK(Q){if(i6.push(Q)===1&&!l5)P4()}});var v4=w((JO,x4)=>{var T4=C4();function X6(){}var K0={},A4=["REJECTED"],o5=["FULFILLED"],D4=["PENDING"];V6=["UNHANDLED"];var V6;x4.exports=N1;function N1(Q){if(typeof Q!=="function")throw TypeError("resolver must be a function");if(this.state=D4,this.queue=[],this.outcome=void 0,this.handled=V6,Q!==X6)w4(this,Q)}N1.prototype.finally=function(Q){if(typeof Q!=="function")return this;var $=this.constructor;return this.then(q,J);function q(Y){function V(){return Y}return $.resolve(Q()).then(V)}function J(Y){function V(){throw Y}return $.resolve(Q()).then(V)}};N1.prototype.catch=function(Q){return this.then(null,Q)};N1.prototype.then=function(Q,$){if(typeof Q!=="function"&&this.state===o5||typeof $!=="function"&&this.state===A4)return this;var q=new this.constructor(X6);if(this.handled===V6)this.handled=null;if(this.state!==D4){var J=this.state===o5?Q:$;i5(q,J,this.outcome)}else this.queue.push(new n6(q,Q,$));return q};function n6(Q,$,q){if(this.promise=Q,typeof $==="function")this.onFulfilled=$,this.callFulfilled=this.otherCallFulfilled;if(typeof q==="function")this.onRejected=q,this.callRejected=this.otherCallRejected}n6.prototype.callFulfilled=function(Q){K0.resolve(this.promise,Q)};n6.prototype.otherCallFulfilled=function(Q){i5(this.promise,this.onFulfilled,Q)};n6.prototype.callRejected=function(Q){K0.reject(this.promise,Q)};n6.prototype.otherCallRejected=function(Q){i5(this.promise,this.onRejected,Q)};function i5(Q,$,q){T4(function(){var J;try{J=$(q)}catch(Y){return K0.reject(Q,Y)}if(J===Q)K0.reject(Q,TypeError("Cannot resolve promise with itself"));else K0.resolve(Q,J)})}K0.resolve=function(Q,$){var q=R4(dK,$);if(q.status==="error")return K0.reject(Q,q.value);var J=q.value;if(J)w4(Q,J);else{Q.state=o5,Q.outcome=$;var Y=-1,V=Q.queue.length;while(++Y<V)Q.queue[Y].callFulfilled($)}return Q};K0.reject=function(Q,$){if(Q.state=A4,Q.outcome=$,Q.handled===V6)T4(function(){if(Q.handled===V6)process.emit("unhandledRejection",$,Q)});var q=-1,J=Q.queue.length;while(++q<J)Q.queue[q].callRejected($);return Q};function dK(Q){var $=Q&&Q.then;if(Q&&(typeof Q==="object"||typeof Q==="function")&&typeof $==="function")return function(){$.apply(Q,arguments)}}function w4(Q,$){var q=!1;function J(K){if(q)return;q=!0,K0.reject(Q,K)}function Y(K){if(q)return;q=!0,K0.resolve(Q,K)}function V(){$(Y,J)}var X=R4(V);if(X.status==="error")J(X.value)}function R4(Q,$){var q={};try{q.value=Q($),q.status="success"}catch(J){q.status="error",q.value=J}return q}N1.resolve=lK;function lK(Q){if(Q instanceof this)return Q;return K0.resolve(new this(X6),Q)}N1.reject=oK;function oK(Q){var $=new this(X6);return K0.reject($,Q)}N1.all=iK;function iK(Q){var $=this;if(Object.prototype.toString.call(Q)!=="[object Array]")return this.reject(TypeError("must be an array"));var q=Q.length,J=!1;if(!q)return this.resolve([]);var Y=Array(q),V=0,X=-1,K=new this(X6);while(++X<q)W(Q[X],X);return K;function W(G,U){$.resolve(G).then(z,function(Z){if(!J)J=!0,K0.reject(K,Z)});function z(Z){if(Y[U]=Z,++V===q&&!J)J=!0,K0.resolve(K,Y)}}}N1.race=nK;function nK(Q){var $=this;if(Object.prototype.toString.call(Q)!=="[object Array]")return this.reject(TypeError("must be an array"));var q=Q.length,J=!1;if(!q)return this.resolve([]);var Y=-1,V=new this(X6);while(++Y<q)X(Q[Y]);return V;function X(K){$.resolve(K).then(function(W){if(!J)J=!0,K0.resolve(V,W)},function(W){if(!J)J=!0,K0.reject(V,W)})}}});var K6=w((YO,E4)=>{var n5=null;if(typeof Promise<"u")n5=Promise;else n5=v4();E4.exports={Promise:n5}});var k4=w((S4)=>{(function(Q,$){if(Q.setImmediate)return;var q=1,J={},Y=!1,V=Q.document,X;function K(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 J[q]=O,X(q),q++}function W(L){delete J[L]}function G(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($,B);break}}function U(L){if(Y)setTimeout(U,0,L);else{var A=J[L];if(A){Y=!0;try{G(A)}finally{W(L),Y=!1}}}}function z(){X=function(L){process.nextTick(function(){U(L)})}}function Z(){if(Q.postMessage&&!Q.importScripts){var L=!0,A=Q.onmessage;return Q.onmessage=function(){L=!1},Q.postMessage("","*"),Q.onmessage=A,L}}function H(){var L="setImmediate$"+Math.random()+"$",A=function(B){if(B.source===Q&&typeof B.data==="string"&&B.data.indexOf(L)===0)U(+B.data.slice(L.length))};if(Q.addEventListener)Q.addEventListener("message",A,!1);else Q.attachEvent("onmessage",A);X=function(B){Q.postMessage(L+B,"*")}}function F(){var L=new MessageChannel;L.port1.onmessage=function(A){var B=A.data;U(B)},X=function(A){L.port2.postMessage(A)}}function N(){var L=V.documentElement;X=function(A){var B=V.createElement("script");B.onreadystatechange=function(){U(A),B.onreadystatechange=null,L.removeChild(B),B=null},L.appendChild(B)}}function C(){X=function(L){setTimeout(U,0,L)}}var P=Object.getPrototypeOf&&Object.getPrototypeOf(Q);if(P=P&&P.setTimeout?P:Q,{}.toString.call(Q.process)==="[object process]")z();else if(Z())H();else if(Q.MessageChannel)F();else if(V&&"onreadystatechange"in V.createElement("script"))N();else C();P.setImmediate=K,P.clearImmediate=W})(typeof self>"u"?typeof global>"u"?S4:global:self)});var l=w((sK)=>{var B1=W1(),rK=d5(),G6=o6(),r5=K6();k4();function aK(Q){var $=null;if(B1.uint8array)$=new Uint8Array(Q.length);else $=Array(Q.length);return Q2(Q,$)}sK.newBlob=function(Q,$){sK.checkSupport("blob");try{return new Blob([Q],{type:$})}catch(Y){try{var q=self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder,J=new q;return J.append(Q),J.getBlob($)}catch(V){throw Error("Bug : can't construct the Blob.")}}};function r6(Q){return Q}function Q2(Q,$){for(var q=0;q<Q.length;++q)$[q]=Q.charCodeAt(q)&255;return $}var e8={stringifyByChunk:function(Q,$,q){var J=[],Y=0,V=Q.length;if(V<=q)return String.fromCharCode.apply(null,Q);while(Y<V){if($==="array"||$==="nodebuffer")J.push(String.fromCharCode.apply(null,Q.slice(Y,Math.min(Y+q,V))));else J.push(String.fromCharCode.apply(null,Q.subarray(Y,Math.min(Y+q,V))));Y+=q}return J.join("")},stringifyByChar:function(Q){var $="";for(var q=0;q<Q.length;q++)$+=String.fromCharCode(Q[q]);return $},applyCanBeUsed:{uint8array:function(){try{return B1.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch(Q){return!1}}(),nodebuffer:function(){try{return B1.nodebuffer&&String.fromCharCode.apply(null,G6.allocBuffer(1)).length===1}catch(Q){return!1}}()}};function a6(Q){var $=65536,q=sK.getTypeOf(Q),J=!0;if(q==="uint8array")J=e8.applyCanBeUsed.uint8array;else if(q==="nodebuffer")J=e8.applyCanBeUsed.nodebuffer;if(J)while($>1)try{return e8.stringifyByChunk(Q,q,$)}catch(Y){$=Math.floor($/2)}return e8.stringifyByChar(Q)}sK.applyFromCharCode=a6;function $2(Q,$){for(var q=0;q<Q.length;q++)$[q]=Q[q];return $}var M1={};M1.string={string:r6,array:function(Q){return Q2(Q,Array(Q.length))},arraybuffer:function(Q){return M1.string.uint8array(Q).buffer},uint8array:function(Q){return Q2(Q,new Uint8Array(Q.length))},nodebuffer:function(Q){return Q2(Q,G6.allocBuffer(Q.length))}};M1.array={string:a6,array:r6,arraybuffer:function(Q){return new Uint8Array(Q).buffer},uint8array:function(Q){return new Uint8Array(Q)},nodebuffer:function(Q){return G6.newBufferFrom(Q)}};M1.arraybuffer={string:function(Q){return a6(new Uint8Array(Q))},array:function(Q){return $2(new Uint8Array(Q),Array(Q.byteLength))},arraybuffer:r6,uint8array:function(Q){return new Uint8Array(Q)},nodebuffer:function(Q){return G6.newBufferFrom(new Uint8Array(Q))}};M1.uint8array={string:a6,array:function(Q){return $2(Q,Array(Q.length))},arraybuffer:function(Q){return Q.buffer},uint8array:r6,nodebuffer:function(Q){return G6.newBufferFrom(Q)}};M1.nodebuffer={string:a6,array:function(Q){return $2(Q,Array(Q.length))},arraybuffer:function(Q){return M1.nodebuffer.uint8array(Q).buffer},uint8array:function(Q){return $2(Q,new Uint8Array(Q.length))},nodebuffer:r6};sK.transformTo=function(Q,$){if(!$)$="";if(!Q)return $;sK.checkSupport(Q);var q=sK.getTypeOf($),J=M1[q][Q]($);return J};sK.resolve=function(Q){var $=Q.split("/"),q=[];for(var J=0;J<$.length;J++){var Y=$[J];if(Y==="."||Y===""&&J!==0&&J!==$.length-1)continue;else if(Y==="..")q.pop();else q.push(Y)}return q.join("/")};sK.getTypeOf=function(Q){if(typeof Q==="string")return"string";if(Object.prototype.toString.call(Q)==="[object Array]")return"array";if(B1.nodebuffer&&G6.isBuffer(Q))return"nodebuffer";if(B1.uint8array&&Q instanceof Uint8Array)return"uint8array";if(B1.arraybuffer&&Q instanceof ArrayBuffer)return"arraybuffer"};sK.checkSupport=function(Q){var $=B1[Q.toLowerCase()];if(!$)throw Error(Q+" is not supported by this platform")};sK.MAX_VALUE_16BITS=65535;sK.MAX_VALUE_32BITS=-1;sK.pretty=function(Q){var $="",q,J;for(J=0;J<(Q||"").length;J++)q=Q.charCodeAt(J),$+="\\x"+(q<16?"0":"")+q.toString(16).toUpperCase();return $};sK.delay=function(Q,$,q){setImmediate(function(){Q.apply(q||null,$||[])})};sK.inherits=function(Q,$){var q=function(){};q.prototype=$.prototype,Q.prototype=new q};sK.extend=function(){var Q={},$,q;for($=0;$<arguments.length;$++)for(q in arguments[$])if(Object.prototype.hasOwnProperty.call(arguments[$],q)&&typeof Q[q]>"u")Q[q]=arguments[$][q];return Q};sK.prepareContent=function(Q,$,q,J,Y){var V=r5.Promise.resolve($).then(function(X){var K=B1.blob&&(X instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(X))!==-1);if(K&&typeof FileReader<"u")return new r5.Promise(function(W,G){var U=new FileReader;U.onload=function(z){W(z.target.result)},U.onerror=function(z){G(z.target.error)},U.readAsArrayBuffer(X)});else return X});return V.then(function(X){var K=sK.getTypeOf(X);if(!K)return r5.Promise.reject(Error("Can't read the data of '"+Q+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));if(K==="arraybuffer")X=sK.transformTo("uint8array",X);else if(K==="string"){if(Y)X=rK.decode(X);else if(q){if(J!==!0)X=aK(X)}}return X})}});var M0=w((KO,b4)=>{function _4(Q){this.name=Q||"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}_4.prototype={push:function(Q){this.emit("data",Q)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(Q){this.emit("error",Q)}return!0},error:function(Q){if(this.isFinished)return!1;if(this.isPaused)this.generatedError=Q;else{if(this.isFinished=!0,this.emit("error",Q),this.previous)this.previous.error(Q);this.cleanUp()}return!0},on:function(Q,$){return this._listeners[Q].push($),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(Q,$){if(this._listeners[Q])for(var q=0;q<this._listeners[Q].length;q++)this._listeners[Q][q].call(this,$)},pipe:function(Q){return Q.registerPrevious(this)},registerPrevious:function(Q){if(this.isLocked)throw Error("The stream '"+this+"' has already been used.");this.streamInfo=Q.streamInfo,this.mergeStreamInfo(),this.previous=Q;var $=this;return Q.on("data",function(q){$.processChunk(q)}),Q.on("end",function(){$.end()}),Q.on("error",function(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 Q=!1;if(this.generatedError)this.error(this.generatedError),Q=!0;if(this.previous)this.previous.resume();return!Q},flush:function(){},processChunk:function(Q){this.push(Q)},withStreamInfo:function(Q,$){return this.extraStreamInfo[Q]=$,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var Q in this.extraStreamInfo){if(!Object.prototype.hasOwnProperty.call(this.extraStreamInfo,Q))continue;this.streamInfo[Q]=this.extraStreamInfo[Q]}},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 Q="Worker "+this.name;if(this.previous)return this.previous+" -> "+Q;else return Q}};b4.exports=_4});var U6=w((ZG)=>{var W6=l(),f1=W1(),GG=o6(),q2=M0(),s6=Array(256);for(i0=0;i0<256;i0++)s6[i0]=i0>=252?6:i0>=248?5:i0>=240?4:i0>=224?3:i0>=192?2:1;var i0;s6[254]=s6[254]=1;var WG=function(Q){var $,q,J,Y,V,X=Q.length,K=0;for(Y=0;Y<X;Y++){if(q=Q.charCodeAt(Y),(q&64512)===55296&&Y+1<X){if(J=Q.charCodeAt(Y+1),(J&64512)===56320)q=65536+(q-55296<<10)+(J-56320),Y++}K+=q<128?1:q<2048?2:q<65536?3:4}if(f1.uint8array)$=new Uint8Array(K);else $=Array(K);for(V=0,Y=0;V<K;Y++){if(q=Q.charCodeAt(Y),(q&64512)===55296&&Y+1<X){if(J=Q.charCodeAt(Y+1),(J&64512)===56320)q=65536+(q-55296<<10)+(J-56320),Y++}if(q<128)$[V++]=q;else if(q<2048)$[V++]=192|q>>>6,$[V++]=128|q&63;else if(q<65536)$[V++]=224|q>>>12,$[V++]=128|q>>>6&63,$[V++]=128|q&63;else $[V++]=240|q>>>18,$[V++]=128|q>>>12&63,$[V++]=128|q>>>6&63,$[V++]=128|q&63}return $},UG=function(Q,$){var q;if($=$||Q.length,$>Q.length)$=Q.length;q=$-1;while(q>=0&&(Q[q]&192)===128)q--;if(q<0)return $;if(q===0)return $;return q+s6[Q[q]]>$?q:$},jG=function(Q){var $,q,J,Y,V=Q.length,X=Array(V*2);for(q=0,$=0;$<V;){if(J=Q[$++],J<128){X[q++]=J;continue}if(Y=s6[J],Y>4){X[q++]=65533,$+=Y-1;continue}J&=Y===2?31:Y===3?15:7;while(Y>1&&$<V)J=J<<6|Q[$++]&63,Y--;if(Y>1){X[q++]=65533;continue}if(J<65536)X[q++]=J;else J-=65536,X[q++]=55296|J>>10&1023,X[q++]=56320|J&1023}if(X.length!==q)if(X.subarray)X=X.subarray(0,q);else X.length=q;return W6.applyFromCharCode(X)};ZG.utf8encode=function($){if(f1.nodebuffer)return GG.newBufferFrom($,"utf-8");return WG($)};ZG.utf8decode=function($){if(f1.nodebuffer)return W6.transformTo("nodebuffer",$).toString("utf-8");return $=W6.transformTo(f1.uint8array?"uint8array":"array",$),jG($)};function J2(){q2.call(this,"utf-8 decode"),this.leftOver=null}W6.inherits(J2,q2);J2.prototype.processChunk=function(Q){var $=W6.transformTo(f1.uint8array?"uint8array":"array",Q.data);if(this.leftOver&&this.leftOver.length){if(f1.uint8array){var q=$;$=new Uint8Array(q.length+this.leftOver.length),$.set(this.leftOver,0),$.set(q,this.leftOver.length)}else $=this.leftOver.concat($);this.leftOver=null}var J=UG($),Y=$;if(J!==$.length)if(f1.uint8array)Y=$.subarray(0,J),this.leftOver=$.subarray(J,$.length);else Y=$.slice(0,J),this.leftOver=$.slice(J,$.length);this.push({data:ZG.utf8decode(Y),meta:Q.meta})};J2.prototype.flush=function(){if(this.leftOver&&this.leftOver.length)this.push({data:ZG.utf8decode(this.leftOver),meta:{}}),this.leftOver=null};ZG.Utf8DecodeWorker=J2;function s5(){q2.call(this,"utf-8 encode")}W6.inherits(s5,q2);s5.prototype.processChunk=function(Q){this.push({data:ZG.utf8encode(Q.data),meta:Q.meta})};ZG.Utf8EncodeWorker=s5});var u4=w((WO,c4)=>{var h4=M0(),m4=l();function e5(Q){h4.call(this,"ConvertWorker to "+Q),this.destType=Q}m4.inherits(e5,h4);e5.prototype.processChunk=function(Q){this.push({data:m4.transformTo(this.destType,Q.data),meta:Q.meta})};c4.exports=e5});var l4=w((UO,d4)=>{var p4=c5().Readable,FG=l();FG.inherits(Q9,p4);function Q9(Q,$,q){p4.call(this,$),this._helper=Q;var J=this;Q.on("data",function(Y,V){if(!J.push(Y))J._helper.pause();if(q)q(V)}).on("error",function(Y){J.emit("error",Y)}).on("end",function(){J.push(null)})}Q9.prototype._read=function(){this._helper.resume()};d4.exports=Q9});var $9=w((jO,n4)=>{var h1=l(),LG=u4(),OG=M0(),NG=d5(),BG=W1(),MG=K6(),o4=null;if(BG.nodestream)try{o4=l4()}catch(Q){}function PG(Q,$,q){switch(Q){case"blob":return h1.newBlob(h1.transformTo("arraybuffer",$),q);case"base64":return NG.encode($);default:return h1.transformTo(Q,$)}}function IG(Q,$){var q,J=0,Y=null,V=0;for(q=0;q<$.length;q++)V+=$[q].length;switch(Q){case"string":return $.join("");case"array":return Array.prototype.concat.apply([],$);case"uint8array":Y=new Uint8Array(V);for(q=0;q<$.length;q++)Y.set($[q],J),J+=$[q].length;return Y;case"nodebuffer":return Buffer.concat($);default:throw Error("concat : unsupported type '"+Q+"'")}}function CG(Q,$){return new MG.Promise(function(q,J){var Y=[],V=Q._internalType,X=Q._outputType,K=Q._mimeType;Q.on("data",function(W,G){if(Y.push(W),$)$(G)}).on("error",function(W){Y=[],J(W)}).on("end",function(){try{var W=PG(X,IG(V,Y),K);q(W)}catch(G){J(G)}Y=[]}).resume()})}function i4(Q,$,q){var J=$;switch($){case"blob":case"arraybuffer":J="uint8array";break;case"base64":J="string";break}try{this._internalType=J,this._outputType=$,this._mimeType=q,h1.checkSupport(J),this._worker=Q.pipe(new LG(J)),Q.lock()}catch(Y){this._worker=new OG("error"),this._worker.error(Y)}}i4.prototype={accumulate:function(Q){return CG(this,Q)},on:function(Q,$){var q=this;if(Q==="data")this._worker.on(Q,function(J){$.call(q,J.data,J.meta)});else this._worker.on(Q,function(){h1.delay($,arguments,q)});return this},resume:function(){return h1.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(Q){if(h1.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw Error(this._outputType+" is not supported by this method");return new o4(this,{objectMode:this._outputType!=="nodebuffer"},Q)}};n4.exports=i4});var q9=w((TG)=>{TG.base64=!1;TG.binary=!1;TG.dir=!1;TG.createFolders=!0;TG.date=null;TG.compression=null;TG.compressionOptions=null;TG.comment=null;TG.unixPermissions=null;TG.dosPermissions=null});var J9=w((zO,r4)=>{var Y2=l(),V2=M0(),gG=16384;function j6(Q){V2.call(this,"DataWorker");var $=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,Q.then(function(q){if($.dataIsReady=!0,$.data=q,$.max=q&&q.length||0,$.type=Y2.getTypeOf(q),!$.isPaused)$._tickAndRepeat()},function(q){$.error(q)})}Y2.inherits(j6,V2);j6.prototype.cleanUp=function(){V2.prototype.cleanUp.call(this),this.data=null};j6.prototype.resume=function(){if(!V2.prototype.resume.call(this))return!1;if(!this._tickScheduled&&this.dataIsReady)this._tickScheduled=!0,Y2.delay(this._tickAndRepeat,[],this);return!0};j6.prototype._tickAndRepeat=function(){if(this._tickScheduled=!1,this.isPaused||this.isFinished)return;if(this._tick(),!this.isFinished)Y2.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0};j6.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var Q=gG,$=null,q=Math.min(this.max,this.index+Q);if(this.index>=this.max)return this.end();else{switch(this.type){case"string":$=this.data.substring(this.index,q);break;case"uint8array":$=this.data.subarray(this.index,q);break;case"array":case"nodebuffer":$=this.data.slice(this.index,q);break}return this.index=q,this.push({data:$,meta:{percent:this.max?this.index/this.max*100:0}})}};r4.exports=j6});var X2=w((HO,s4)=>{var _G=l();function bG(){var Q,$=[];for(var q=0;q<256;q++){Q=q;for(var J=0;J<8;J++)Q=Q&1?3988292384^Q>>>1:Q>>>1;$[q]=Q}return $}var a4=bG();function fG(Q,$,q,J){var Y=a4,V=J+q;Q=Q^-1;for(var X=J;X<V;X++)Q=Q>>>8^Y[(Q^$[X])&255];return Q^-1}function hG(Q,$,q,J){var Y=a4,V=J+q;Q=Q^-1;for(var X=J;X<V;X++)Q=Q>>>8^Y[(Q^$.charCodeAt(X))&255];return Q^-1}s4.exports=function($,q){if(typeof $>"u"||!$.length)return 0;var J=_G.getTypeOf($)!=="string";if(J)return fG(q|0,$,$.length,0);else return hG(q|0,$,$.length,0)}});var V9=w((FO,e4)=>{var t4=M0(),mG=X2(),cG=l();function Y9(){t4.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}cG.inherits(Y9,t4);Y9.prototype.processChunk=function(Q){this.streamInfo.crc32=mG(Q.data,this.streamInfo.crc32||0),this.push(Q)};e4.exports=Y9});var $$=w((LO,Q$)=>{var uG=l(),X9=M0();function K9(Q){X9.call(this,"DataLengthProbe for "+Q),this.propName=Q,this.withStreamInfo(Q,0)}uG.inherits(K9,X9);K9.prototype.processChunk=function(Q){if(Q){var $=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=$+Q.data.length}X9.prototype.processChunk.call(this,Q)};Q$.exports=K9});var K2=w((OO,Y$)=>{var q$=K6(),J$=J9(),pG=V9(),G9=$$();function W9(Q,$,q,J,Y){this.compressedSize=Q,this.uncompressedSize=$,this.crc32=q,this.compression=J,this.compressedContent=Y}W9.prototype={getContentWorker:function(){var Q=new J$(q$.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new G9("data_length")),$=this;return Q.on("end",function(){if(this.streamInfo.data_length!==$.uncompressedSize)throw Error("Bug : uncompressed data size mismatch")}),Q},getCompressedWorker:function(){return new J$(q$.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}};W9.createWorkerFrom=function(Q,$,q){return Q.pipe(new pG).pipe(new G9("uncompressedSize")).pipe($.compressWorker(q)).pipe(new G9("compressedSize")).withStreamInfo("compression",$)};Y$.exports=W9});var G$=w((NO,K$)=>{var dG=$9(),lG=J9(),U9=U6(),j9=K2(),V$=M0(),Z9=function(Q,$,q){this.name=Q,this.dir=q.dir,this.date=q.date,this.comment=q.comment,this.unixPermissions=q.unixPermissions,this.dosPermissions=q.dosPermissions,this._data=$,this._dataBinary=q.binary,this.options={compression:q.compression,compressionOptions:q.compressionOptions}};Z9.prototype={internalStream:function(Q){var $=null,q="string";try{if(!Q)throw Error("No output type specified.");q=Q.toLowerCase();var J=q==="string"||q==="text";if(q==="binarystring"||q==="text")q="string";$=this._decompressWorker();var Y=!this._dataBinary;if(Y&&!J)$=$.pipe(new U9.Utf8EncodeWorker);if(!Y&&J)$=$.pipe(new U9.Utf8DecodeWorker)}catch(V){$=new V$("error"),$.error(V)}return new dG($,q,"")},async:function(Q,$){return this.internalStream(Q).accumulate($)},nodeStream:function(Q,$){return this.internalStream(Q||"nodebuffer").toNodejsStream($)},_compressWorker:function(Q,$){if(this._data instanceof j9&&this._data.compression.magic===Q.magic)return this._data.getCompressedWorker();else{var q=this._decompressWorker();if(!this._dataBinary)q=q.pipe(new U9.Utf8EncodeWorker);return j9.createWorkerFrom(q,Q,$)}},_decompressWorker:function(){if(this._data instanceof j9)return this._data.getContentWorker();else if(this._data instanceof V$)return this._data;else return new lG(this._data)}};var X$=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],oG=function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")};for(t6=0;t6<X$.length;t6++)Z9.prototype[X$[t6]]=oG;var t6;K$.exports=Z9});var U1=w((z9)=>{var aG=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function sG(Q,$){return Object.prototype.hasOwnProperty.call(Q,$)}z9.assign=function(Q){var $=Array.prototype.slice.call(arguments,1);while($.length){var q=$.shift();if(!q)continue;if(typeof q!=="object")throw TypeError(q+"must be non-object");for(var J in q)if(sG(q,J))Q[J]=q[J]}return Q};z9.shrinkBuf=function(Q,$){if(Q.length===$)return Q;if(Q.subarray)return Q.subarray(0,$);return Q.length=$,Q};var tG={arraySet:function(Q,$,q,J,Y){if($.subarray&&Q.subarray){Q.set($.subarray(q,q+J),Y);return}for(var V=0;V<J;V++)Q[Y+V]=$[q+V]},flattenChunks:function(Q){var $,q,J,Y,V,X;J=0;for($=0,q=Q.length;$<q;$++)J+=Q[$].length;X=new Uint8Array(J),Y=0;for($=0,q=Q.length;$<q;$++)V=Q[$],X.set(V,Y),Y+=V.length;return X}},eG={arraySet:function(Q,$,q,J,Y){for(var V=0;V<J;V++)Q[Y+V]=$[q+V]},flattenChunks:function(Q){return[].concat.apply([],Q)}};z9.setTyped=function(Q){if(Q)z9.Buf8=Uint8Array,z9.Buf16=Uint16Array,z9.Buf32=Int32Array,z9.assign(z9,tG);else z9.Buf8=Array,z9.Buf16=Array,z9.Buf32=Array,z9.assign(z9,eG)};z9.setTyped(aG)});var S$=w((IW)=>{var $W=U1(),qW=4,U$=0,j$=1,JW=2;function z6(Q){var $=Q.length;while(--$>=0)Q[$]=0}var YW=0,O$=1,VW=2,XW=3,KW=258,P9=29,Y8=256,Q8=Y8+1+P9,Z6=30,I9=19,N$=2*Q8+1,m1=15,F9=16,GW=7,C9=256,B$=16,M$=17,P$=18,B9=[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],G2=[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],WW=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I$=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],UW=512,j1=Array((Q8+2)*2);z6(j1);var e6=Array(Z6*2);z6(e6);var $8=Array(UW);z6($8);var q8=Array(KW-XW+1);z6(q8);var T9=Array(P9);z6(T9);var W2=Array(Z6);z6(W2);function L9(Q,$,q,J,Y){this.static_tree=Q,this.extra_bits=$,this.extra_base=q,this.elems=J,this.max_length=Y,this.has_stree=Q&&Q.length}var C$,T$,A$;function O9(Q,$){this.dyn_tree=Q,this.max_code=0,this.stat_desc=$}function D$(Q){return Q<256?$8[Q]:$8[256+(Q>>>7)]}function J8(Q,$){Q.pending_buf[Q.pending++]=$&255,Q.pending_buf[Q.pending++]=$>>>8&255}function F0(Q,$,q){if(Q.bi_valid>F9-q)Q.bi_buf|=$<<Q.bi_valid&65535,J8(Q,Q.bi_buf),Q.bi_buf=$>>F9-Q.bi_valid,Q.bi_valid+=q-F9;else Q.bi_buf|=$<<Q.bi_valid&65535,Q.bi_valid+=q}function n0(Q,$,q){F0(Q,q[$*2],q[$*2+1])}function w$(Q,$){var q=0;do q|=Q&1,Q>>>=1,q<<=1;while(--$>0);return q>>>1}function jW(Q){if(Q.bi_valid===16)J8(Q,Q.bi_buf),Q.bi_buf=0,Q.bi_valid=0;else if(Q.bi_valid>=8)Q.pending_buf[Q.pending++]=Q.bi_buf&255,Q.bi_buf>>=8,Q.bi_valid-=8}function ZW(Q,$){var{dyn_tree:q,max_code:J}=$,Y=$.stat_desc.static_tree,V=$.stat_desc.has_stree,X=$.stat_desc.extra_bits,K=$.stat_desc.extra_base,W=$.stat_desc.max_length,G,U,z,Z,H,F,N=0;for(Z=0;Z<=m1;Z++)Q.bl_count[Z]=0;q[Q.heap[Q.heap_max]*2+1]=0;for(G=Q.heap_max+1;G<N$;G++){if(U=Q.heap[G],Z=q[q[U*2+1]*2+1]+1,Z>W)Z=W,N++;if(q[U*2+1]=Z,U>J)continue;if(Q.bl_count[Z]++,H=0,U>=K)H=X[U-K];if(F=q[U*2],Q.opt_len+=F*(Z+H),V)Q.static_len+=F*(Y[U*2+1]+H)}if(N===0)return;do{Z=W-1;while(Q.bl_count[Z]===0)Z--;Q.bl_count[Z]--,Q.bl_count[Z+1]+=2,Q.bl_count[W]--,N-=2}while(N>0);for(Z=W;Z!==0;Z--){U=Q.bl_count[Z];while(U!==0){if(z=Q.heap[--G],z>J)continue;if(q[z*2+1]!==Z)Q.opt_len+=(Z-q[z*2+1])*q[z*2],q[z*2+1]=Z;U--}}}function R$(Q,$,q){var J=Array(m1+1),Y=0,V,X;for(V=1;V<=m1;V++)J[V]=Y=Y+q[V-1]<<1;for(X=0;X<=$;X++){var K=Q[X*2+1];if(K===0)continue;Q[X*2]=w$(J[K]++,K)}}function zW(){var Q,$,q,J,Y,V=Array(m1+1);q=0;for(J=0;J<P9-1;J++){T9[J]=q;for(Q=0;Q<1<<B9[J];Q++)q8[q++]=J}q8[q-1]=J,Y=0;for(J=0;J<16;J++){W2[J]=Y;for(Q=0;Q<1<<G2[J];Q++)$8[Y++]=J}Y>>=7;for(;J<Z6;J++){W2[J]=Y<<7;for(Q=0;Q<1<<G2[J]-7;Q++)$8[256+Y++]=J}for($=0;$<=m1;$++)V[$]=0;Q=0;while(Q<=143)j1[Q*2+1]=8,Q++,V[8]++;while(Q<=255)j1[Q*2+1]=9,Q++,V[9]++;while(Q<=279)j1[Q*2+1]=7,Q++,V[7]++;while(Q<=287)j1[Q*2+1]=8,Q++,V[8]++;R$(j1,Q8+1,V);for(Q=0;Q<Z6;Q++)e6[Q*2+1]=5,e6[Q*2]=w$(Q,5);C$=new L9(j1,B9,Y8+1,Q8,m1),T$=new L9(e6,G2,0,Z6,m1),A$=new L9([],WW,0,I9,GW)}function x$(Q){var $;for($=0;$<Q8;$++)Q.dyn_ltree[$*2]=0;for($=0;$<Z6;$++)Q.dyn_dtree[$*2]=0;for($=0;$<I9;$++)Q.bl_tree[$*2]=0;Q.dyn_ltree[C9*2]=1,Q.opt_len=Q.static_len=0,Q.last_lit=Q.matches=0}function v$(Q){if(Q.bi_valid>8)J8(Q,Q.bi_buf);else if(Q.bi_valid>0)Q.pending_buf[Q.pending++]=Q.bi_buf;Q.bi_buf=0,Q.bi_valid=0}function HW(Q,$,q,J){if(v$(Q),J)J8(Q,q),J8(Q,~q);$W.arraySet(Q.pending_buf,Q.window,$,q,Q.pending),Q.pending+=q}function Z$(Q,$,q,J){var Y=$*2,V=q*2;return Q[Y]<Q[V]||Q[Y]===Q[V]&&J[$]<=J[q]}function N9(Q,$,q){var J=Q.heap[q],Y=q<<1;while(Y<=Q.heap_len){if(Y<Q.heap_len&&Z$($,Q.heap[Y+1],Q.heap[Y],Q.depth))Y++;if(Z$($,J,Q.heap[Y],Q.depth))break;Q.heap[q]=Q.heap[Y],q=Y,Y<<=1}Q.heap[q]=J}function z$(Q,$,q){var J,Y,V=0,X,K;if(Q.last_lit!==0)do if(J=Q.pending_buf[Q.d_buf+V*2]<<8|Q.pending_buf[Q.d_buf+V*2+1],Y=Q.pending_buf[Q.l_buf+V],V++,J===0)n0(Q,Y,$);else{if(X=q8[Y],n0(Q,X+Y8+1,$),K=B9[X],K!==0)Y-=T9[X],F0(Q,Y,K);if(J--,X=D$(J),n0(Q,X,q),K=G2[X],K!==0)J-=W2[X],F0(Q,J,K)}while(V<Q.last_lit);n0(Q,C9,$)}function M9(Q,$){var q=$.dyn_tree,J=$.stat_desc.static_tree,Y=$.stat_desc.has_stree,V=$.stat_desc.elems,X,K,W=-1,G;Q.heap_len=0,Q.heap_max=N$;for(X=0;X<V;X++)if(q[X*2]!==0)Q.heap[++Q.heap_len]=W=X,Q.depth[X]=0;else q[X*2+1]=0;while(Q.heap_len<2)if(G=Q.heap[++Q.heap_len]=W<2?++W:0,q[G*2]=1,Q.depth[G]=0,Q.opt_len--,Y)Q.static_len-=J[G*2+1];$.max_code=W;for(X=Q.heap_len>>1;X>=1;X--)N9(Q,q,X);G=V;do X=Q.heap[1],Q.heap[1]=Q.heap[Q.heap_len--],N9(Q,q,1),K=Q.heap[1],Q.heap[--Q.heap_max]=X,Q.heap[--Q.heap_max]=K,q[G*2]=q[X*2]+q[K*2],Q.depth[G]=(Q.depth[X]>=Q.depth[K]?Q.depth[X]:Q.depth[K])+1,q[X*2+1]=q[K*2+1]=G,Q.heap[1]=G++,N9(Q,q,1);while(Q.heap_len>=2);Q.heap[--Q.heap_max]=Q.heap[1],ZW(Q,$),R$(q,W,Q.bl_count)}function H$(Q,$,q){var J,Y=-1,V,X=$[1],K=0,W=7,G=4;if(X===0)W=138,G=3;$[(q+1)*2+1]=65535;for(J=0;J<=q;J++){if(V=X,X=$[(J+1)*2+1],++K<W&&V===X)continue;else if(K<G)Q.bl_tree[V*2]+=K;else if(V!==0){if(V!==Y)Q.bl_tree[V*2]++;Q.bl_tree[B$*2]++}else if(K<=10)Q.bl_tree[M$*2]++;else Q.bl_tree[P$*2]++;if(K=0,Y=V,X===0)W=138,G=3;else if(V===X)W=6,G=3;else W=7,G=4}}function F$(Q,$,q){var J,Y=-1,V,X=$[1],K=0,W=7,G=4;if(X===0)W=138,G=3;for(J=0;J<=q;J++){if(V=X,X=$[(J+1)*2+1],++K<W&&V===X)continue;else if(K<G)do n0(Q,V,Q.bl_tree);while(--K!==0);else if(V!==0){if(V!==Y)n0(Q,V,Q.bl_tree),K--;n0(Q,B$,Q.bl_tree),F0(Q,K-3,2)}else if(K<=10)n0(Q,M$,Q.bl_tree),F0(Q,K-3,3);else n0(Q,P$,Q.bl_tree),F0(Q,K-11,7);if(K=0,Y=V,X===0)W=138,G=3;else if(V===X)W=6,G=3;else W=7,G=4}}function FW(Q){var $;H$(Q,Q.dyn_ltree,Q.l_desc.max_code),H$(Q,Q.dyn_dtree,Q.d_desc.max_code),M9(Q,Q.bl_desc);for($=I9-1;$>=3;$--)if(Q.bl_tree[I$[$]*2+1]!==0)break;return Q.opt_len+=3*($+1)+5+5+4,$}function LW(Q,$,q,J){var Y;F0(Q,$-257,5),F0(Q,q-1,5),F0(Q,J-4,4);for(Y=0;Y<J;Y++)F0(Q,Q.bl_tree[I$[Y]*2+1],3);F$(Q,Q.dyn_ltree,$-1),F$(Q,Q.dyn_dtree,q-1)}function OW(Q){var $=4093624447,q;for(q=0;q<=31;q++,$>>>=1)if($&1&&Q.dyn_ltree[q*2]!==0)return U$;if(Q.dyn_ltree[18]!==0||Q.dyn_ltree[20]!==0||Q.dyn_ltree[26]!==0)return j$;for(q=32;q<Y8;q++)if(Q.dyn_ltree[q*2]!==0)return j$;return U$}var L$=!1;function NW(Q){if(!L$)zW(),L$=!0;Q.l_desc=new O9(Q.dyn_ltree,C$),Q.d_desc=new O9(Q.dyn_dtree,T$),Q.bl_desc=new O9(Q.bl_tree,A$),Q.bi_buf=0,Q.bi_valid=0,x$(Q)}function E$(Q,$,q,J){F0(Q,(YW<<1)+(J?1:0),3),HW(Q,$,q,!0)}function BW(Q){F0(Q,O$<<1,3),n0(Q,C9,j1),jW(Q)}function MW(Q,$,q,J){var Y,V,X=0;if(Q.level>0){if(Q.strm.data_type===JW)Q.strm.data_type=OW(Q);if(M9(Q,Q.l_desc),M9(Q,Q.d_desc),X=FW(Q),Y=Q.opt_len+3+7>>>3,V=Q.static_len+3+7>>>3,V<=Y)Y=V}else Y=V=q+5;if(q+4<=Y&&$!==-1)E$(Q,$,q,J);else if(Q.strategy===qW||V===Y)F0(Q,(O$<<1)+(J?1:0),3),z$(Q,j1,e6);else F0(Q,(VW<<1)+(J?1:0),3),LW(Q,Q.l_desc.max_code+1,Q.d_desc.max_code+1,X+1),z$(Q,Q.dyn_ltree,Q.dyn_dtree);if(x$(Q),J)v$(Q)}function PW(Q,$,q){if(Q.pending_buf[Q.d_buf+Q.last_lit*2]=$>>>8&255,Q.pending_buf[Q.d_buf+Q.last_lit*2+1]=$&255,Q.pending_buf[Q.l_buf+Q.last_lit]=q&255,Q.last_lit++,$===0)Q.dyn_ltree[q*2]++;else Q.matches++,$--,Q.dyn_ltree[(q8[q]+Y8+1)*2]++,Q.dyn_dtree[D$($)*2]++;return Q.last_lit===Q.lit_bufsize-1}IW._tr_init=NW;IW._tr_stored_block=E$;IW._tr_flush_block=MW;IW._tr_tally=PW;IW._tr_align=BW});var A9=w((PO,k$)=>{function RW(Q,$,q,J){var Y=Q&65535|0,V=Q>>>16&65535|0,X=0;while(q!==0){X=q>2000?2000:q,q-=X;do Y=Y+$[J++]|0,V=V+Y|0;while(--X);Y%=65521,V%=65521}return Y|V<<16|0}k$.exports=RW});var D9=w((IO,y$)=>{function xW(){var Q,$=[];for(var q=0;q<256;q++){Q=q;for(var J=0;J<8;J++)Q=Q&1?3988292384^Q>>>1:Q>>>1;$[q]=Q}return $}var vW=xW();function EW(Q,$,q,J){var Y=vW,V=J+q;Q^=-1;for(var X=J;X<V;X++)Q=Q>>>8^Y[(Q^$[X])&255];return Q^-1}y$.exports=EW});var U2=w((CO,g$)=>{g$.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 d$=w((UU)=>{var j0=U1(),x0=S$(),h$=A9(),P1=D9(),SW=U2(),d1=0,kW=1,yW=3,D1=4,_$=5,a0=0,b$=1,v0=-2,gW=-3,w9=-5,_W=-1,bW=1,j2=2,fW=3,hW=4,mW=0,cW=2,F2=8,uW=9,pW=15,dW=8,lW=29,oW=256,x9=oW+1+lW,iW=30,nW=19,rW=2*x9+1,aW=15,E=3,T1=258,f0=T1+E+1,sW=32,L2=42,v9=69,Z2=73,z2=91,H2=103,c1=113,X8=666,t=1,K8=2,u1=3,L6=4,tW=3;function A1(Q,$){return Q.msg=SW[$],$}function f$(Q){return(Q<<1)-(Q>4?9:0)}function C1(Q){var $=Q.length;while(--$>=0)Q[$]=0}function I1(Q){var $=Q.state,q=$.pending;if(q>Q.avail_out)q=Q.avail_out;if(q===0)return;if(j0.arraySet(Q.output,$.pending_buf,$.pending_out,q,Q.next_out),Q.next_out+=q,$.pending_out+=q,Q.total_out+=q,Q.avail_out-=q,$.pending-=q,$.pending===0)$.pending_out=0}function Y0(Q,$){x0._tr_flush_block(Q,Q.block_start>=0?Q.block_start:-1,Q.strstart-Q.block_start,$),Q.block_start=Q.strstart,I1(Q.strm)}function k(Q,$){Q.pending_buf[Q.pending++]=$}function V8(Q,$){Q.pending_buf[Q.pending++]=$>>>8&255,Q.pending_buf[Q.pending++]=$&255}function eW(Q,$,q,J){var Y=Q.avail_in;if(Y>J)Y=J;if(Y===0)return 0;if(Q.avail_in-=Y,j0.arraySet($,Q.input,Q.next_in,Y,q),Q.state.wrap===1)Q.adler=h$(Q.adler,$,Y,q);else if(Q.state.wrap===2)Q.adler=P1(Q.adler,$,Y,q);return Q.next_in+=Y,Q.total_in+=Y,Y}function m$(Q,$){var{max_chain_length:q,strstart:J}=Q,Y,V,X=Q.prev_length,K=Q.nice_match,W=Q.strstart>Q.w_size-f0?Q.strstart-(Q.w_size-f0):0,G=Q.window,U=Q.w_mask,z=Q.prev,Z=Q.strstart+T1,H=G[J+X-1],F=G[J+X];if(Q.prev_length>=Q.good_match)q>>=2;if(K>Q.lookahead)K=Q.lookahead;do{if(Y=$,G[Y+X]!==F||G[Y+X-1]!==H||G[Y]!==G[J]||G[++Y]!==G[J+1])continue;J+=2,Y++;do;while(G[++J]===G[++Y]&&G[++J]===G[++Y]&&G[++J]===G[++Y]&&G[++J]===G[++Y]&&G[++J]===G[++Y]&&G[++J]===G[++Y]&&G[++J]===G[++Y]&&G[++J]===G[++Y]&&J<Z);if(V=T1-(Z-J),J=Z-T1,V>X){if(Q.match_start=$,X=V,V>=K)break;H=G[J+X-1],F=G[J+X]}}while(($=z[$&U])>W&&--q!==0);if(X<=Q.lookahead)return X;return Q.lookahead}function p1(Q){var $=Q.w_size,q,J,Y,V,X;do{if(V=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=$+($-f0)){j0.arraySet(Q.window,Q.window,$,$,0),Q.match_start-=$,Q.strstart-=$,Q.block_start-=$,J=Q.hash_size,q=J;do Y=Q.head[--q],Q.head[q]=Y>=$?Y-$:0;while(--J);J=$,q=J;do Y=Q.prev[--q],Q.prev[q]=Y>=$?Y-$:0;while(--J);V+=$}if(Q.strm.avail_in===0)break;if(J=eW(Q.strm,Q.window,Q.strstart+Q.lookahead,V),Q.lookahead+=J,Q.lookahead+Q.insert>=E){X=Q.strstart-Q.insert,Q.ins_h=Q.window[X],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[X+1])&Q.hash_mask;while(Q.insert)if(Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[X+E-1])&Q.hash_mask,Q.prev[X&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=X,X++,Q.insert--,Q.lookahead+Q.insert<E)break}}while(Q.lookahead<f0&&Q.strm.avail_in!==0)}function QU(Q,$){var q=65535;if(q>Q.pending_buf_size-5)q=Q.pending_buf_size-5;for(;;){if(Q.lookahead<=1){if(p1(Q),Q.lookahead===0&&$===d1)return t;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var J=Q.block_start+q;if(Q.strstart===0||Q.strstart>=J){if(Q.lookahead=Q.strstart-J,Q.strstart=J,Y0(Q,!1),Q.strm.avail_out===0)return t}if(Q.strstart-Q.block_start>=Q.w_size-f0){if(Y0(Q,!1),Q.strm.avail_out===0)return t}}if(Q.insert=0,$===D1){if(Y0(Q,!0),Q.strm.avail_out===0)return u1;return L6}if(Q.strstart>Q.block_start){if(Y0(Q,!1),Q.strm.avail_out===0)return t}return t}function R9(Q,$){var q,J;for(;;){if(Q.lookahead<f0){if(p1(Q),Q.lookahead<f0&&$===d1)return t;if(Q.lookahead===0)break}if(q=0,Q.lookahead>=E)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+E-1])&Q.hash_mask,q=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(q!==0&&Q.strstart-q<=Q.w_size-f0)Q.match_length=m$(Q,q);if(Q.match_length>=E)if(J=x0._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-E),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=E){Q.match_length--;do Q.strstart++,Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+E-1])&Q.hash_mask,q=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.match_length!==0);Q.strstart++}else Q.strstart+=Q.match_length,Q.match_length=0,Q.ins_h=Q.window[Q.strstart],Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+1])&Q.hash_mask;else J=x0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(J){if(Y0(Q,!1),Q.strm.avail_out===0)return t}}if(Q.insert=Q.strstart<E-1?Q.strstart:E-1,$===D1){if(Y0(Q,!0),Q.strm.avail_out===0)return u1;return L6}if(Q.last_lit){if(Y0(Q,!1),Q.strm.avail_out===0)return t}return K8}function H6(Q,$){var q,J,Y;for(;;){if(Q.lookahead<f0){if(p1(Q),Q.lookahead<f0&&$===d1)return t;if(Q.lookahead===0)break}if(q=0,Q.lookahead>=E)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+E-1])&Q.hash_mask,q=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;if(Q.prev_length=Q.match_length,Q.prev_match=Q.match_start,Q.match_length=E-1,q!==0&&Q.prev_length<Q.max_lazy_match&&Q.strstart-q<=Q.w_size-f0){if(Q.match_length=m$(Q,q),Q.match_length<=5&&(Q.strategy===bW||Q.match_length===E&&Q.strstart-Q.match_start>4096))Q.match_length=E-1}if(Q.prev_length>=E&&Q.match_length<=Q.prev_length){Y=Q.strstart+Q.lookahead-E,J=x0._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-E),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;do if(++Q.strstart<=Y)Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[Q.strstart+E-1])&Q.hash_mask,q=Q.prev[Q.strstart&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=Q.strstart;while(--Q.prev_length!==0);if(Q.match_available=0,Q.match_length=E-1,Q.strstart++,J){if(Y0(Q,!1),Q.strm.avail_out===0)return t}}else if(Q.match_available){if(J=x0._tr_tally(Q,0,Q.window[Q.strstart-1]),J)Y0(Q,!1);if(Q.strstart++,Q.lookahead--,Q.strm.avail_out===0)return t}else Q.match_available=1,Q.strstart++,Q.lookahead--}if(Q.match_available)J=x0._tr_tally(Q,0,Q.window[Q.strstart-1]),Q.match_available=0;if(Q.insert=Q.strstart<E-1?Q.strstart:E-1,$===D1){if(Y0(Q,!0),Q.strm.avail_out===0)return u1;return L6}if(Q.last_lit){if(Y0(Q,!1),Q.strm.avail_out===0)return t}return K8}function $U(Q,$){var q,J,Y,V,X=Q.window;for(;;){if(Q.lookahead<=T1){if(p1(Q),Q.lookahead<=T1&&$===d1)return t;if(Q.lookahead===0)break}if(Q.match_length=0,Q.lookahead>=E&&Q.strstart>0){if(Y=Q.strstart-1,J=X[Y],J===X[++Y]&&J===X[++Y]&&J===X[++Y]){V=Q.strstart+T1;do;while(J===X[++Y]&&J===X[++Y]&&J===X[++Y]&&J===X[++Y]&&J===X[++Y]&&J===X[++Y]&&J===X[++Y]&&J===X[++Y]&&Y<V);if(Q.match_length=T1-(V-Y),Q.match_length>Q.lookahead)Q.match_length=Q.lookahead}}if(Q.match_length>=E)q=x0._tr_tally(Q,1,Q.match_length-E),Q.lookahead-=Q.match_length,Q.strstart+=Q.match_length,Q.match_length=0;else q=x0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++;if(q){if(Y0(Q,!1),Q.strm.avail_out===0)return t}}if(Q.insert=0,$===D1){if(Y0(Q,!0),Q.strm.avail_out===0)return u1;return L6}if(Q.last_lit){if(Y0(Q,!1),Q.strm.avail_out===0)return t}return K8}function qU(Q,$){var q;for(;;){if(Q.lookahead===0){if(p1(Q),Q.lookahead===0){if($===d1)return t;break}}if(Q.match_length=0,q=x0._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++,q){if(Y0(Q,!1),Q.strm.avail_out===0)return t}}if(Q.insert=0,$===D1){if(Y0(Q,!0),Q.strm.avail_out===0)return u1;return L6}if(Q.last_lit){if(Y0(Q,!1),Q.strm.avail_out===0)return t}return K8}function r0(Q,$,q,J,Y){this.good_length=Q,this.max_lazy=$,this.nice_length=q,this.max_chain=J,this.func=Y}var F6;F6=[new r0(0,0,0,0,QU),new r0(4,4,8,4,R9),new r0(4,5,16,8,R9),new r0(4,6,32,32,R9),new r0(4,4,16,16,H6),new r0(8,16,32,32,H6),new r0(8,16,128,128,H6),new r0(8,32,128,256,H6),new r0(32,128,258,1024,H6),new r0(32,258,258,4096,H6)];function JU(Q){Q.window_size=2*Q.w_size,C1(Q.head),Q.max_lazy_match=F6[Q.level].max_lazy,Q.good_match=F6[Q.level].good_length,Q.nice_match=F6[Q.level].nice_length,Q.max_chain_length=F6[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=E-1,Q.match_available=0,Q.ins_h=0}function YU(){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=F2,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 j0.Buf16(rW*2),this.dyn_dtree=new j0.Buf16((2*iW+1)*2),this.bl_tree=new j0.Buf16((2*nW+1)*2),C1(this.dyn_ltree),C1(this.dyn_dtree),C1(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new j0.Buf16(aW+1),this.heap=new j0.Buf16(2*x9+1),C1(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new j0.Buf16(2*x9+1),C1(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 c$(Q){var $;if(!Q||!Q.state)return A1(Q,v0);if(Q.total_in=Q.total_out=0,Q.data_type=cW,$=Q.state,$.pending=0,$.pending_out=0,$.wrap<0)$.wrap=-$.wrap;return $.status=$.wrap?L2:c1,Q.adler=$.wrap===2?0:1,$.last_flush=d1,x0._tr_init($),a0}function u$(Q){var $=c$(Q);if($===a0)JU(Q.state);return $}function VU(Q,$){if(!Q||!Q.state)return v0;if(Q.state.wrap!==2)return v0;return Q.state.gzhead=$,a0}function p$(Q,$,q,J,Y,V){if(!Q)return v0;var X=1;if($===_W)$=6;if(J<0)X=0,J=-J;else if(J>15)X=2,J-=16;if(Y<1||Y>uW||q!==F2||J<8||J>15||$<0||$>9||V<0||V>hW)return A1(Q,v0);if(J===8)J=9;var K=new YU;return Q.state=K,K.strm=Q,K.wrap=X,K.gzhead=null,K.w_bits=J,K.w_size=1<<K.w_bits,K.w_mask=K.w_size-1,K.hash_bits=Y+7,K.hash_size=1<<K.hash_bits,K.hash_mask=K.hash_size-1,K.hash_shift=~~((K.hash_bits+E-1)/E),K.window=new j0.Buf8(K.w_size*2),K.head=new j0.Buf16(K.hash_size),K.prev=new j0.Buf16(K.w_size),K.lit_bufsize=1<<Y+6,K.pending_buf_size=K.lit_bufsize*4,K.pending_buf=new j0.Buf8(K.pending_buf_size),K.d_buf=1*K.lit_bufsize,K.l_buf=3*K.lit_bufsize,K.level=$,K.strategy=V,K.method=q,u$(Q)}function XU(Q,$){return p$(Q,$,F2,pW,dW,mW)}function KU(Q,$){var q,J,Y,V;if(!Q||!Q.state||$>_$||$<0)return Q?A1(Q,v0):v0;if(J=Q.state,!Q.output||!Q.input&&Q.avail_in!==0||J.status===X8&&$!==D1)return A1(Q,Q.avail_out===0?w9:v0);if(J.strm=Q,q=J.last_flush,J.last_flush=$,J.status===L2)if(J.wrap===2)if(Q.adler=0,k(J,31),k(J,139),k(J,8),!J.gzhead)k(J,0),k(J,0),k(J,0),k(J,0),k(J,0),k(J,J.level===9?2:J.strategy>=j2||J.level<2?4:0),k(J,tW),J.status=c1;else{if(k(J,(J.gzhead.text?1:0)+(J.gzhead.hcrc?2:0)+(!J.gzhead.extra?0:4)+(!J.gzhead.name?0:8)+(!J.gzhead.comment?0:16)),k(J,J.gzhead.time&255),k(J,J.gzhead.time>>8&255),k(J,J.gzhead.time>>16&255),k(J,J.gzhead.time>>24&255),k(J,J.level===9?2:J.strategy>=j2||J.level<2?4:0),k(J,J.gzhead.os&255),J.gzhead.extra&&J.gzhead.extra.length)k(J,J.gzhead.extra.length&255),k(J,J.gzhead.extra.length>>8&255);if(J.gzhead.hcrc)Q.adler=P1(Q.adler,J.pending_buf,J.pending,0);J.gzindex=0,J.status=v9}else{var X=F2+(J.w_bits-8<<4)<<8,K=-1;if(J.strategy>=j2||J.level<2)K=0;else if(J.level<6)K=1;else if(J.level===6)K=2;else K=3;if(X|=K<<6,J.strstart!==0)X|=sW;if(X+=31-X%31,J.status=c1,V8(J,X),J.strstart!==0)V8(J,Q.adler>>>16),V8(J,Q.adler&65535);Q.adler=1}if(J.status===v9)if(J.gzhead.extra){Y=J.pending;while(J.gzindex<(J.gzhead.extra.length&65535)){if(J.pending===J.pending_buf_size){if(J.gzhead.hcrc&&J.pending>Y)Q.adler=P1(Q.adler,J.pending_buf,J.pending-Y,Y);if(I1(Q),Y=J.pending,J.pending===J.pending_buf_size)break}k(J,J.gzhead.extra[J.gzindex]&255),J.gzindex++}if(J.gzhead.hcrc&&J.pending>Y)Q.adler=P1(Q.adler,J.pending_buf,J.pending-Y,Y);if(J.gzindex===J.gzhead.extra.length)J.gzindex=0,J.status=Z2}else J.status=Z2;if(J.status===Z2)if(J.gzhead.name){Y=J.pending;do{if(J.pending===J.pending_buf_size){if(J.gzhead.hcrc&&J.pending>Y)Q.adler=P1(Q.adler,J.pending_buf,J.pending-Y,Y);if(I1(Q),Y=J.pending,J.pending===J.pending_buf_size){V=1;break}}if(J.gzindex<J.gzhead.name.length)V=J.gzhead.name.charCodeAt(J.gzindex++)&255;else V=0;k(J,V)}while(V!==0);if(J.gzhead.hcrc&&J.pending>Y)Q.adler=P1(Q.adler,J.pending_buf,J.pending-Y,Y);if(V===0)J.gzindex=0,J.status=z2}else J.status=z2;if(J.status===z2)if(J.gzhead.comment){Y=J.pending;do{if(J.pending===J.pending_buf_size){if(J.gzhead.hcrc&&J.pending>Y)Q.adler=P1(Q.adler,J.pending_buf,J.pending-Y,Y);if(I1(Q),Y=J.pending,J.pending===J.pending_buf_size){V=1;break}}if(J.gzindex<J.gzhead.comment.length)V=J.gzhead.comment.charCodeAt(J.gzindex++)&255;else V=0;k(J,V)}while(V!==0);if(J.gzhead.hcrc&&J.pending>Y)Q.adler=P1(Q.adler,J.pending_buf,J.pending-Y,Y);if(V===0)J.status=H2}else J.status=H2;if(J.status===H2)if(J.gzhead.hcrc){if(J.pending+2>J.pending_buf_size)I1(Q);if(J.pending+2<=J.pending_buf_size)k(J,Q.adler&255),k(J,Q.adler>>8&255),Q.adler=0,J.status=c1}else J.status=c1;if(J.pending!==0){if(I1(Q),Q.avail_out===0)return J.last_flush=-1,a0}else if(Q.avail_in===0&&f$($)<=f$(q)&&$!==D1)return A1(Q,w9);if(J.status===X8&&Q.avail_in!==0)return A1(Q,w9);if(Q.avail_in!==0||J.lookahead!==0||$!==d1&&J.status!==X8){var W=J.strategy===j2?qU(J,$):J.strategy===fW?$U(J,$):F6[J.level].func(J,$);if(W===u1||W===L6)J.status=X8;if(W===t||W===u1){if(Q.avail_out===0)J.last_flush=-1;return a0}if(W===K8){if($===kW)x0._tr_align(J);else if($!==_$){if(x0._tr_stored_block(J,0,0,!1),$===yW){if(C1(J.head),J.lookahead===0)J.strstart=0,J.block_start=0,J.insert=0}}if(I1(Q),Q.avail_out===0)return J.last_flush=-1,a0}}if($!==D1)return a0;if(J.wrap<=0)return b$;if(J.wrap===2)k(J,Q.adler&255),k(J,Q.adler>>8&255),k(J,Q.adler>>16&255),k(J,Q.adler>>24&255),k(J,Q.total_in&255),k(J,Q.total_in>>8&255),k(J,Q.total_in>>16&255),k(J,Q.total_in>>24&255);else V8(J,Q.adler>>>16),V8(J,Q.adler&65535);if(I1(Q),J.wrap>0)J.wrap=-J.wrap;return J.pending!==0?a0:b$}function GU(Q){var $;if(!Q||!Q.state)return v0;if($=Q.state.status,$!==L2&&$!==v9&&$!==Z2&&$!==z2&&$!==H2&&$!==c1&&$!==X8)return A1(Q,v0);return Q.state=null,$===c1?A1(Q,gW):a0}function WU(Q,$){var q=$.length,J,Y,V,X,K,W,G,U;if(!Q||!Q.state)return v0;if(J=Q.state,X=J.wrap,X===2||X===1&&J.status!==L2||J.lookahead)return v0;if(X===1)Q.adler=h$(Q.adler,$,q,0);if(J.wrap=0,q>=J.w_size){if(X===0)C1(J.head),J.strstart=0,J.block_start=0,J.insert=0;U=new j0.Buf8(J.w_size),j0.arraySet(U,$,q-J.w_size,J.w_size,0),$=U,q=J.w_size}K=Q.avail_in,W=Q.next_in,G=Q.input,Q.avail_in=q,Q.next_in=0,Q.input=$,p1(J);while(J.lookahead>=E){Y=J.strstart,V=J.lookahead-(E-1);do J.ins_h=(J.ins_h<<J.hash_shift^J.window[Y+E-1])&J.hash_mask,J.prev[Y&J.w_mask]=J.head[J.ins_h],J.head[J.ins_h]=Y,Y++;while(--V);J.strstart=Y,J.lookahead=E-1,p1(J)}return J.strstart+=J.lookahead,J.block_start=J.strstart,J.insert=J.lookahead,J.lookahead=0,J.match_length=J.prev_length=E-1,J.match_available=0,Q.next_in=W,Q.input=G,Q.avail_in=K,J.wrap=X,a0}UU.deflateInit=XU;UU.deflateInit2=p$;UU.deflateReset=u$;UU.deflateResetKeep=c$;UU.deflateSetHeader=VU;UU.deflate=KU;UU.deflateEnd=GU;UU.deflateSetDictionary=WU;UU.deflateInfo="pako deflate (from Nodeca project)"});var E9=w((MU)=>{var O2=U1(),l$=!0,o$=!0;try{String.fromCharCode.apply(null,[0])}catch(Q){l$=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(Q){o$=!1}var G8=new O2.Buf8(256);for(s0=0;s0<256;s0++)G8[s0]=s0>=252?6:s0>=248?5:s0>=240?4:s0>=224?3:s0>=192?2:1;var s0;G8[254]=G8[254]=1;MU.string2buf=function(Q){var $,q,J,Y,V,X=Q.length,K=0;for(Y=0;Y<X;Y++){if(q=Q.charCodeAt(Y),(q&64512)===55296&&Y+1<X){if(J=Q.charCodeAt(Y+1),(J&64512)===56320)q=65536+(q-55296<<10)+(J-56320),Y++}K+=q<128?1:q<2048?2:q<65536?3:4}$=new O2.Buf8(K);for(V=0,Y=0;V<K;Y++){if(q=Q.charCodeAt(Y),(q&64512)===55296&&Y+1<X){if(J=Q.charCodeAt(Y+1),(J&64512)===56320)q=65536+(q-55296<<10)+(J-56320),Y++}if(q<128)$[V++]=q;else if(q<2048)$[V++]=192|q>>>6,$[V++]=128|q&63;else if(q<65536)$[V++]=224|q>>>12,$[V++]=128|q>>>6&63,$[V++]=128|q&63;else $[V++]=240|q>>>18,$[V++]=128|q>>>12&63,$[V++]=128|q>>>6&63,$[V++]=128|q&63}return $};function i$(Q,$){if($<65534){if(Q.subarray&&o$||!Q.subarray&&l$)return String.fromCharCode.apply(null,O2.shrinkBuf(Q,$))}var q="";for(var J=0;J<$;J++)q+=String.fromCharCode(Q[J]);return q}MU.buf2binstring=function(Q){return i$(Q,Q.length)};MU.binstring2buf=function(Q){var $=new O2.Buf8(Q.length);for(var q=0,J=$.length;q<J;q++)$[q]=Q.charCodeAt(q);return $};MU.buf2string=function(Q,$){var q,J,Y,V,X=$||Q.length,K=Array(X*2);for(J=0,q=0;q<X;){if(Y=Q[q++],Y<128){K[J++]=Y;continue}if(V=G8[Y],V>4){K[J++]=65533,q+=V-1;continue}Y&=V===2?31:V===3?15:7;while(V>1&&q<X)Y=Y<<6|Q[q++]&63,V--;if(V>1){K[J++]=65533;continue}if(Y<65536)K[J++]=Y;else Y-=65536,K[J++]=55296|Y>>10&1023,K[J++]=56320|Y&1023}return i$(K,J)};MU.utf8border=function(Q,$){var q;if($=$||Q.length,$>Q.length)$=Q.length;q=$-1;while(q>=0&&(Q[q]&192)===128)q--;if(q<0)return $;if(q===0)return $;return q+G8[Q[q]]>$?q:$}});var S9=w((DO,n$)=>{function DU(){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}n$.exports=DU});var t$=w((yU)=>{var W8=d$(),U8=U1(),y9=E9(),g9=U2(),wU=S9(),s$=Object.prototype.toString,RU=0,k9=4,O6=0,r$=1,a$=2,xU=-1,vU=0,EU=8;function l1(Q){if(!(this instanceof l1))return new l1(Q);this.options=U8.assign({level:xU,method:EU,chunkSize:16384,windowBits:15,memLevel:8,strategy:vU,to:""},Q||{});var $=this.options;if($.raw&&$.windowBits>0)$.windowBits=-$.windowBits;else if($.gzip&&$.windowBits>0&&$.windowBits<16)$.windowBits+=16;this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new wU,this.strm.avail_out=0;var q=W8.deflateInit2(this.strm,$.level,$.method,$.windowBits,$.memLevel,$.strategy);if(q!==O6)throw Error(g9[q]);if($.header)W8.deflateSetHeader(this.strm,$.header);if($.dictionary){var J;if(typeof $.dictionary==="string")J=y9.string2buf($.dictionary);else if(s$.call($.dictionary)==="[object ArrayBuffer]")J=new Uint8Array($.dictionary);else J=$.dictionary;if(q=W8.deflateSetDictionary(this.strm,J),q!==O6)throw Error(g9[q]);this._dict_set=!0}}l1.prototype.push=function(Q,$){var q=this.strm,J=this.options.chunkSize,Y,V;if(this.ended)return!1;if(V=$===~~$?$:$===!0?k9:RU,typeof Q==="string")q.input=y9.string2buf(Q);else if(s$.call(Q)==="[object ArrayBuffer]")q.input=new Uint8Array(Q);else q.input=Q;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new U8.Buf8(J),q.next_out=0,q.avail_out=J;if(Y=W8.deflate(q,V),Y!==r$&&Y!==O6)return this.onEnd(Y),this.ended=!0,!1;if(q.avail_out===0||q.avail_in===0&&(V===k9||V===a$))if(this.options.to==="string")this.onData(y9.buf2binstring(U8.shrinkBuf(q.output,q.next_out)));else this.onData(U8.shrinkBuf(q.output,q.next_out))}while((q.avail_in>0||q.avail_out===0)&&Y!==r$);if(V===k9)return Y=W8.deflateEnd(this.strm),this.onEnd(Y),this.ended=!0,Y===O6;if(V===a$)return this.onEnd(O6),q.avail_out=0,!0;return!0};l1.prototype.onData=function(Q){this.chunks.push(Q)};l1.prototype.onEnd=function(Q){if(Q===O6)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=U8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function _9(Q,$){var q=new l1($);if(q.push(Q,!0),q.err)throw q.msg||g9[q.err];return q.result}function SU(Q,$){return $=$||{},$.raw=!0,_9(Q,$)}function kU(Q,$){return $=$||{},$.gzip=!0,_9(Q,$)}yU.Deflate=l1;yU.deflate=_9;yU.deflateRaw=SU;yU.gzip=kU});var Qq=w((RO,e$)=>{var N2=30,hU=12;e$.exports=function($,q){var J,Y,V,X,K,W,G,U,z,Z,H,F,N,C,P,L,A,B,O,M,T,D,x,v,R;J=$.state,Y=$.next_in,v=$.input,V=Y+($.avail_in-5),X=$.next_out,R=$.output,K=X-(q-$.avail_out),W=X+($.avail_out-257),G=J.dmax,U=J.wsize,z=J.whave,Z=J.wnext,H=J.window,F=J.hold,N=J.bits,C=J.lencode,P=J.distcode,L=(1<<J.lenbits)-1,A=(1<<J.distbits)-1;Q:do{if(N<15)F+=v[Y++]<<N,N+=8,F+=v[Y++]<<N,N+=8;B=C[F&L];$:for(;;){if(O=B>>>24,F>>>=O,N-=O,O=B>>>16&255,O===0)R[X++]=B&65535;else if(O&16){if(M=B&65535,O&=15,O){if(N<O)F+=v[Y++]<<N,N+=8;M+=F&(1<<O)-1,F>>>=O,N-=O}if(N<15)F+=v[Y++]<<N,N+=8,F+=v[Y++]<<N,N+=8;B=P[F&A];q:for(;;){if(O=B>>>24,F>>>=O,N-=O,O=B>>>16&255,O&16){if(T=B&65535,O&=15,N<O){if(F+=v[Y++]<<N,N+=8,N<O)F+=v[Y++]<<N,N+=8}if(T+=F&(1<<O)-1,T>G){$.msg="invalid distance too far back",J.mode=N2;break Q}if(F>>>=O,N-=O,O=X-K,T>O){if(O=T-O,O>z){if(J.sane){$.msg="invalid distance too far back",J.mode=N2;break Q}}if(D=0,x=H,Z===0){if(D+=U-O,O<M){M-=O;do R[X++]=H[D++];while(--O);D=X-T,x=R}}else if(Z<O){if(D+=U+Z-O,O-=Z,O<M){M-=O;do R[X++]=H[D++];while(--O);if(D=0,Z<M){O=Z,M-=O;do R[X++]=H[D++];while(--O);D=X-T,x=R}}}else if(D+=Z-O,O<M){M-=O;do R[X++]=H[D++];while(--O);D=X-T,x=R}while(M>2)R[X++]=x[D++],R[X++]=x[D++],R[X++]=x[D++],M-=3;if(M){if(R[X++]=x[D++],M>1)R[X++]=x[D++]}}else{D=X-T;do R[X++]=R[D++],R[X++]=R[D++],R[X++]=R[D++],M-=3;while(M>2);if(M){if(R[X++]=R[D++],M>1)R[X++]=R[D++]}}}else if((O&64)===0){B=P[(B&65535)+(F&(1<<O)-1)];continue q}else{$.msg="invalid distance code",J.mode=N2;break Q}break}}else if((O&64)===0){B=C[(B&65535)+(F&(1<<O)-1)];continue $}else if(O&32){J.mode=hU;break Q}else{$.msg="invalid literal/length code",J.mode=N2;break Q}break}}while(Y<V&&X<W);M=N>>3,Y-=M,N-=M<<3,F&=(1<<N)-1,$.next_in=Y,$.next_out=X,$.avail_in=Y<V?5+(V-Y):5-(Y-V),$.avail_out=X<W?257+(W-X):257-(X-W),J.hold=F,J.bits=N;return}});var Kq=w((xO,Xq)=>{var $q=U1(),N6=15,qq=852,Jq=592,Yq=0,b9=1,Vq=2,mU=[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],cU=[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],uU=[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],pU=[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];Xq.exports=function($,q,J,Y,V,X,K,W){var G=W.bits,U=0,z=0,Z=0,H=0,F=0,N=0,C=0,P=0,L=0,A=0,B,O,M,T,D,x=null,v=0,R,$0=new $q.Buf16(N6+1),A0=new $q.Buf16(N6+1),b=null,G0=0,D0,z0,J1;for(U=0;U<=N6;U++)$0[U]=0;for(z=0;z<Y;z++)$0[q[J+z]]++;F=G;for(H=N6;H>=1;H--)if($0[H]!==0)break;if(F>H)F=H;if(H===0)return V[X++]=20971520,V[X++]=20971520,W.bits=1,0;for(Z=1;Z<H;Z++)if($0[Z]!==0)break;if(F<Z)F=Z;P=1;for(U=1;U<=N6;U++)if(P<<=1,P-=$0[U],P<0)return-1;if(P>0&&($===Yq||H!==1))return-1;A0[1]=0;for(U=1;U<N6;U++)A0[U+1]=A0[U]+$0[U];for(z=0;z<Y;z++)if(q[J+z]!==0)K[A0[q[J+z]]++]=z;if($===Yq)x=b=K,R=19;else if($===b9)x=mU,v-=257,b=cU,G0-=257,R=256;else x=uU,b=pU,R=-1;if(A=0,z=0,U=Z,D=X,N=F,C=0,M=-1,L=1<<F,T=L-1,$===b9&&L>qq||$===Vq&&L>Jq)return 1;for(;;){if(D0=U-C,K[z]<R)z0=0,J1=K[z];else if(K[z]>R)z0=b[G0+K[z]],J1=x[v+K[z]];else z0=96,J1=0;B=1<<U-C,O=1<<N,Z=O;do O-=B,V[D+(A>>C)+O]=D0<<24|z0<<16|J1|0;while(O!==0);B=1<<U-1;while(A&B)B>>=1;if(B!==0)A&=B-1,A+=B;else A=0;if(z++,--$0[U]===0){if(U===H)break;U=q[J+K[z]]}if(U>F&&(A&T)!==M){if(C===0)C=F;D+=Z,N=U-C,P=1<<N;while(N+C<H){if(P-=$0[N+C],P<=0)break;N++,P<<=1}if(L+=1<<N,$===b9&&L>qq||$===Vq&&L>Jq)return 1;M=A&T,V[M]=F<<24|N<<16|D-X|0}}if(A!==0)V[D+A]=U-C<<24|4194304|0;return W.bits=F,0}});var uq=w((Gj)=>{var P0=U1(),p9=A9(),t0=D9(),dU=Qq(),j8=Kq(),lU=0,kq=1,yq=2,Gq=4,oU=5,B2=6,o1=0,iU=1,nU=2,E0=-2,gq=-3,d9=-4,rU=-5,Wq=8,_q=1,Uq=2,jq=3,Zq=4,zq=5,Hq=6,Fq=7,Lq=8,Oq=9,Nq=10,I2=11,Z1=12,f9=13,Bq=14,h9=15,Mq=16,Pq=17,Iq=18,Cq=19,M2=20,P2=21,Tq=22,Aq=23,Dq=24,wq=25,Rq=26,m9=27,xq=28,vq=29,p=30,l9=31,aU=32,sU=852,tU=592,eU=15,Qj=eU;function Eq(Q){return(Q>>>24&255)+(Q>>>8&65280)+((Q&65280)<<8)+((Q&255)<<24)}function $j(){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 P0.Buf16(320),this.work=new P0.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function bq(Q){var $;if(!Q||!Q.state)return E0;if($=Q.state,Q.total_in=Q.total_out=$.total=0,Q.msg="",$.wrap)Q.adler=$.wrap&1;return $.mode=_q,$.last=0,$.havedict=0,$.dmax=32768,$.head=null,$.hold=0,$.bits=0,$.lencode=$.lendyn=new P0.Buf32(sU),$.distcode=$.distdyn=new P0.Buf32(tU),$.sane=1,$.back=-1,o1}function fq(Q){var $;if(!Q||!Q.state)return E0;return $=Q.state,$.wsize=0,$.whave=0,$.wnext=0,bq(Q)}function hq(Q,$){var q,J;if(!Q||!Q.state)return E0;if(J=Q.state,$<0)q=0,$=-$;else if(q=($>>4)+1,$<48)$&=15;if($&&($<8||$>15))return E0;if(J.window!==null&&J.wbits!==$)J.window=null;return J.wrap=q,J.wbits=$,fq(Q)}function mq(Q,$){var q,J;if(!Q)return E0;if(J=new $j,Q.state=J,J.window=null,q=hq(Q,$),q!==o1)Q.state=null;return q}function qj(Q){return mq(Q,Qj)}var Sq=!0,c9,u9;function Jj(Q){if(Sq){var $;c9=new P0.Buf32(512),u9=new P0.Buf32(32),$=0;while($<144)Q.lens[$++]=8;while($<256)Q.lens[$++]=9;while($<280)Q.lens[$++]=7;while($<288)Q.lens[$++]=8;j8(kq,Q.lens,0,288,c9,0,Q.work,{bits:9}),$=0;while($<32)Q.lens[$++]=5;j8(yq,Q.lens,0,32,u9,0,Q.work,{bits:5}),Sq=!1}Q.lencode=c9,Q.lenbits=9,Q.distcode=u9,Q.distbits=5}function cq(Q,$,q,J){var Y,V=Q.state;if(V.window===null)V.wsize=1<<V.wbits,V.wnext=0,V.whave=0,V.window=new P0.Buf8(V.wsize);if(J>=V.wsize)P0.arraySet(V.window,$,q-V.wsize,V.wsize,0),V.wnext=0,V.whave=V.wsize;else{if(Y=V.wsize-V.wnext,Y>J)Y=J;if(P0.arraySet(V.window,$,q-J,Y,V.wnext),J-=Y,J)P0.arraySet(V.window,$,q-J,J,0),V.wnext=J,V.whave=V.wsize;else{if(V.wnext+=Y,V.wnext===V.wsize)V.wnext=0;if(V.whave<V.wsize)V.whave+=Y}}return 0}function Yj(Q,$){var q,J,Y,V,X,K,W,G,U,z,Z,H,F,N,C=0,P,L,A,B,O,M,T,D,x=new P0.Buf8(4),v,R,$0=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!Q||!Q.state||!Q.output||!Q.input&&Q.avail_in!==0)return E0;if(q=Q.state,q.mode===Z1)q.mode=f9;X=Q.next_out,Y=Q.output,W=Q.avail_out,V=Q.next_in,J=Q.input,K=Q.avail_in,G=q.hold,U=q.bits,z=K,Z=W,D=o1;Q:for(;;)switch(q.mode){case _q:if(q.wrap===0){q.mode=f9;break}while(U<16){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(q.wrap&2&&G===35615){q.check=0,x[0]=G&255,x[1]=G>>>8&255,q.check=t0(q.check,x,2,0),G=0,U=0,q.mode=Uq;break}if(q.flags=0,q.head)q.head.done=!1;if(!(q.wrap&1)||(((G&255)<<8)+(G>>8))%31){Q.msg="incorrect header check",q.mode=p;break}if((G&15)!==Wq){Q.msg="unknown compression method",q.mode=p;break}if(G>>>=4,U-=4,T=(G&15)+8,q.wbits===0)q.wbits=T;else if(T>q.wbits){Q.msg="invalid window size",q.mode=p;break}q.dmax=1<<T,Q.adler=q.check=1,q.mode=G&512?Nq:Z1,G=0,U=0;break;case Uq:while(U<16){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(q.flags=G,(q.flags&255)!==Wq){Q.msg="unknown compression method",q.mode=p;break}if(q.flags&57344){Q.msg="unknown header flags set",q.mode=p;break}if(q.head)q.head.text=G>>8&1;if(q.flags&512)x[0]=G&255,x[1]=G>>>8&255,q.check=t0(q.check,x,2,0);G=0,U=0,q.mode=jq;case jq:while(U<32){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(q.head)q.head.time=G;if(q.flags&512)x[0]=G&255,x[1]=G>>>8&255,x[2]=G>>>16&255,x[3]=G>>>24&255,q.check=t0(q.check,x,4,0);G=0,U=0,q.mode=Zq;case Zq:while(U<16){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(q.head)q.head.xflags=G&255,q.head.os=G>>8;if(q.flags&512)x[0]=G&255,x[1]=G>>>8&255,q.check=t0(q.check,x,2,0);G=0,U=0,q.mode=zq;case zq:if(q.flags&1024){while(U<16){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(q.length=G,q.head)q.head.extra_len=G;if(q.flags&512)x[0]=G&255,x[1]=G>>>8&255,q.check=t0(q.check,x,2,0);G=0,U=0}else if(q.head)q.head.extra=null;q.mode=Hq;case Hq:if(q.flags&1024){if(H=q.length,H>K)H=K;if(H){if(q.head){if(T=q.head.extra_len-q.length,!q.head.extra)q.head.extra=Array(q.head.extra_len);P0.arraySet(q.head.extra,J,V,H,T)}if(q.flags&512)q.check=t0(q.check,J,H,V);K-=H,V+=H,q.length-=H}if(q.length)break Q}q.length=0,q.mode=Fq;case Fq:if(q.flags&2048){if(K===0)break Q;H=0;do if(T=J[V+H++],q.head&&T&&q.length<65536)q.head.name+=String.fromCharCode(T);while(T&&H<K);if(q.flags&512)q.check=t0(q.check,J,H,V);if(K-=H,V+=H,T)break Q}else if(q.head)q.head.name=null;q.length=0,q.mode=Lq;case Lq:if(q.flags&4096){if(K===0)break Q;H=0;do if(T=J[V+H++],q.head&&T&&q.length<65536)q.head.comment+=String.fromCharCode(T);while(T&&H<K);if(q.flags&512)q.check=t0(q.check,J,H,V);if(K-=H,V+=H,T)break Q}else if(q.head)q.head.comment=null;q.mode=Oq;case Oq:if(q.flags&512){while(U<16){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(G!==(q.check&65535)){Q.msg="header crc mismatch",q.mode=p;break}G=0,U=0}if(q.head)q.head.hcrc=q.flags>>9&1,q.head.done=!0;Q.adler=q.check=0,q.mode=Z1;break;case Nq:while(U<32){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}Q.adler=q.check=Eq(G),G=0,U=0,q.mode=I2;case I2:if(q.havedict===0)return Q.next_out=X,Q.avail_out=W,Q.next_in=V,Q.avail_in=K,q.hold=G,q.bits=U,nU;Q.adler=q.check=1,q.mode=Z1;case Z1:if($===oU||$===B2)break Q;case f9:if(q.last){G>>>=U&7,U-=U&7,q.mode=m9;break}while(U<3){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}switch(q.last=G&1,G>>>=1,U-=1,G&3){case 0:q.mode=Bq;break;case 1:if(Jj(q),q.mode=M2,$===B2){G>>>=2,U-=2;break Q}break;case 2:q.mode=Pq;break;case 3:Q.msg="invalid block type",q.mode=p}G>>>=2,U-=2;break;case Bq:G>>>=U&7,U-=U&7;while(U<32){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if((G&65535)!==(G>>>16^65535)){Q.msg="invalid stored block lengths",q.mode=p;break}if(q.length=G&65535,G=0,U=0,q.mode=h9,$===B2)break Q;case h9:q.mode=Mq;case Mq:if(H=q.length,H){if(H>K)H=K;if(H>W)H=W;if(H===0)break Q;P0.arraySet(Y,J,V,H,X),K-=H,V+=H,W-=H,X+=H,q.length-=H;break}q.mode=Z1;break;case Pq:while(U<14){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(q.nlen=(G&31)+257,G>>>=5,U-=5,q.ndist=(G&31)+1,G>>>=5,U-=5,q.ncode=(G&15)+4,G>>>=4,U-=4,q.nlen>286||q.ndist>30){Q.msg="too many length or distance symbols",q.mode=p;break}q.have=0,q.mode=Iq;case Iq:while(q.have<q.ncode){while(U<3){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}q.lens[$0[q.have++]]=G&7,G>>>=3,U-=3}while(q.have<19)q.lens[$0[q.have++]]=0;if(q.lencode=q.lendyn,q.lenbits=7,v={bits:q.lenbits},D=j8(lU,q.lens,0,19,q.lencode,0,q.work,v),q.lenbits=v.bits,D){Q.msg="invalid code lengths set",q.mode=p;break}q.have=0,q.mode=Cq;case Cq:while(q.have<q.nlen+q.ndist){for(;;){if(C=q.lencode[G&(1<<q.lenbits)-1],P=C>>>24,L=C>>>16&255,A=C&65535,P<=U)break;if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(A<16)G>>>=P,U-=P,q.lens[q.have++]=A;else{if(A===16){R=P+2;while(U<R){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(G>>>=P,U-=P,q.have===0){Q.msg="invalid bit length repeat",q.mode=p;break}T=q.lens[q.have-1],H=3+(G&3),G>>>=2,U-=2}else if(A===17){R=P+3;while(U<R){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}G>>>=P,U-=P,T=0,H=3+(G&7),G>>>=3,U-=3}else{R=P+7;while(U<R){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}G>>>=P,U-=P,T=0,H=11+(G&127),G>>>=7,U-=7}if(q.have+H>q.nlen+q.ndist){Q.msg="invalid bit length repeat",q.mode=p;break}while(H--)q.lens[q.have++]=T}}if(q.mode===p)break;if(q.lens[256]===0){Q.msg="invalid code -- missing end-of-block",q.mode=p;break}if(q.lenbits=9,v={bits:q.lenbits},D=j8(kq,q.lens,0,q.nlen,q.lencode,0,q.work,v),q.lenbits=v.bits,D){Q.msg="invalid literal/lengths set",q.mode=p;break}if(q.distbits=6,q.distcode=q.distdyn,v={bits:q.distbits},D=j8(yq,q.lens,q.nlen,q.ndist,q.distcode,0,q.work,v),q.distbits=v.bits,D){Q.msg="invalid distances set",q.mode=p;break}if(q.mode=M2,$===B2)break Q;case M2:q.mode=P2;case P2:if(K>=6&&W>=258){if(Q.next_out=X,Q.avail_out=W,Q.next_in=V,Q.avail_in=K,q.hold=G,q.bits=U,dU(Q,Z),X=Q.next_out,Y=Q.output,W=Q.avail_out,V=Q.next_in,J=Q.input,K=Q.avail_in,G=q.hold,U=q.bits,q.mode===Z1)q.back=-1;break}q.back=0;for(;;){if(C=q.lencode[G&(1<<q.lenbits)-1],P=C>>>24,L=C>>>16&255,A=C&65535,P<=U)break;if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(L&&(L&240)===0){B=P,O=L,M=A;for(;;){if(C=q.lencode[M+((G&(1<<B+O)-1)>>B)],P=C>>>24,L=C>>>16&255,A=C&65535,B+P<=U)break;if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}G>>>=B,U-=B,q.back+=B}if(G>>>=P,U-=P,q.back+=P,q.length=A,L===0){q.mode=Rq;break}if(L&32){q.back=-1,q.mode=Z1;break}if(L&64){Q.msg="invalid literal/length code",q.mode=p;break}q.extra=L&15,q.mode=Tq;case Tq:if(q.extra){R=q.extra;while(U<R){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}q.length+=G&(1<<q.extra)-1,G>>>=q.extra,U-=q.extra,q.back+=q.extra}q.was=q.length,q.mode=Aq;case Aq:for(;;){if(C=q.distcode[G&(1<<q.distbits)-1],P=C>>>24,L=C>>>16&255,A=C&65535,P<=U)break;if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if((L&240)===0){B=P,O=L,M=A;for(;;){if(C=q.distcode[M+((G&(1<<B+O)-1)>>B)],P=C>>>24,L=C>>>16&255,A=C&65535,B+P<=U)break;if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}G>>>=B,U-=B,q.back+=B}if(G>>>=P,U-=P,q.back+=P,L&64){Q.msg="invalid distance code",q.mode=p;break}q.offset=A,q.extra=L&15,q.mode=Dq;case Dq:if(q.extra){R=q.extra;while(U<R){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}q.offset+=G&(1<<q.extra)-1,G>>>=q.extra,U-=q.extra,q.back+=q.extra}if(q.offset>q.dmax){Q.msg="invalid distance too far back",q.mode=p;break}q.mode=wq;case wq:if(W===0)break Q;if(H=Z-W,q.offset>H){if(H=q.offset-H,H>q.whave){if(q.sane){Q.msg="invalid distance too far back",q.mode=p;break}}if(H>q.wnext)H-=q.wnext,F=q.wsize-H;else F=q.wnext-H;if(H>q.length)H=q.length;N=q.window}else N=Y,F=X-q.offset,H=q.length;if(H>W)H=W;W-=H,q.length-=H;do Y[X++]=N[F++];while(--H);if(q.length===0)q.mode=P2;break;case Rq:if(W===0)break Q;Y[X++]=q.length,W--,q.mode=P2;break;case m9:if(q.wrap){while(U<32){if(K===0)break Q;K--,G|=J[V++]<<U,U+=8}if(Z-=W,Q.total_out+=Z,q.total+=Z,Z)Q.adler=q.check=q.flags?t0(q.check,Y,Z,X-Z):p9(q.check,Y,Z,X-Z);if(Z=W,(q.flags?G:Eq(G))!==q.check){Q.msg="incorrect data check",q.mode=p;break}G=0,U=0}q.mode=xq;case xq:if(q.wrap&&q.flags){while(U<32){if(K===0)break Q;K--,G+=J[V++]<<U,U+=8}if(G!==(q.total&4294967295)){Q.msg="incorrect length check",q.mode=p;break}G=0,U=0}q.mode=vq;case vq:D=iU;break Q;case p:D=gq;break Q;case l9:return d9;case aU:default:return E0}if(Q.next_out=X,Q.avail_out=W,Q.next_in=V,Q.avail_in=K,q.hold=G,q.bits=U,q.wsize||Z!==Q.avail_out&&q.mode<p&&(q.mode<m9||$!==Gq)){if(cq(Q,Q.output,Q.next_out,Z-Q.avail_out))return q.mode=l9,d9}if(z-=Q.avail_in,Z-=Q.avail_out,Q.total_in+=z,Q.total_out+=Z,q.total+=Z,q.wrap&&Z)Q.adler=q.check=q.flags?t0(q.check,Y,Z,Q.next_out-Z):p9(q.check,Y,Z,Q.next_out-Z);if(Q.data_type=q.bits+(q.last?64:0)+(q.mode===Z1?128:0)+(q.mode===M2||q.mode===h9?256:0),(z===0&&Z===0||$===Gq)&&D===o1)D=rU;return D}function Vj(Q){if(!Q||!Q.state)return E0;var $=Q.state;if($.window)$.window=null;return Q.state=null,o1}function Xj(Q,$){var q;if(!Q||!Q.state)return E0;if(q=Q.state,(q.wrap&2)===0)return E0;return q.head=$,$.done=!1,o1}function Kj(Q,$){var q=$.length,J,Y,V;if(!Q||!Q.state)return E0;if(J=Q.state,J.wrap!==0&&J.mode!==I2)return E0;if(J.mode===I2){if(Y=1,Y=p9(Y,$,q,0),Y!==J.check)return gq}if(V=cq(Q,$,q,q),V)return J.mode=l9,d9;return J.havedict=1,o1}Gj.inflateReset=fq;Gj.inflateReset2=hq;Gj.inflateResetKeep=bq;Gj.inflateInit=qj;Gj.inflateInit2=mq;Gj.inflate=Yj;Gj.inflateEnd=Vj;Gj.inflateGetHeader=Xj;Gj.inflateSetDictionary=Kj;Gj.inflateInfo="pako inflate (from Nodeca project)"});var o9=w((EO,pq)=>{pq.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 lq=w((SO,dq)=>{function Bj(){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}dq.exports=Bj});var iq=w((Cj)=>{var B6=uq(),Z8=U1(),C2=E9(),n=o9(),i9=U2(),Mj=S9(),Pj=lq(),oq=Object.prototype.toString;function i1(Q){if(!(this instanceof i1))return new i1(Q);this.options=Z8.assign({chunkSize:16384,windowBits:0,to:""},Q||{});var $=this.options;if($.raw&&$.windowBits>=0&&$.windowBits<16){if($.windowBits=-$.windowBits,$.windowBits===0)$.windowBits=-15}if($.windowBits>=0&&$.windowBits<16&&!(Q&&Q.windowBits))$.windowBits+=32;if($.windowBits>15&&$.windowBits<48){if(($.windowBits&15)===0)$.windowBits|=15}this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Mj,this.strm.avail_out=0;var q=B6.inflateInit2(this.strm,$.windowBits);if(q!==n.Z_OK)throw Error(i9[q]);if(this.header=new Pj,B6.inflateGetHeader(this.strm,this.header),$.dictionary){if(typeof $.dictionary==="string")$.dictionary=C2.string2buf($.dictionary);else if(oq.call($.dictionary)==="[object ArrayBuffer]")$.dictionary=new Uint8Array($.dictionary);if($.raw){if(q=B6.inflateSetDictionary(this.strm,$.dictionary),q!==n.Z_OK)throw Error(i9[q])}}}i1.prototype.push=function(Q,$){var q=this.strm,J=this.options.chunkSize,Y=this.options.dictionary,V,X,K,W,G,U=!1;if(this.ended)return!1;if(X=$===~~$?$:$===!0?n.Z_FINISH:n.Z_NO_FLUSH,typeof Q==="string")q.input=C2.binstring2buf(Q);else if(oq.call(Q)==="[object ArrayBuffer]")q.input=new Uint8Array(Q);else q.input=Q;q.next_in=0,q.avail_in=q.input.length;do{if(q.avail_out===0)q.output=new Z8.Buf8(J),q.next_out=0,q.avail_out=J;if(V=B6.inflate(q,n.Z_NO_FLUSH),V===n.Z_NEED_DICT&&Y)V=B6.inflateSetDictionary(this.strm,Y);if(V===n.Z_BUF_ERROR&&U===!0)V=n.Z_OK,U=!1;if(V!==n.Z_STREAM_END&&V!==n.Z_OK)return this.onEnd(V),this.ended=!0,!1;if(q.next_out){if(q.avail_out===0||V===n.Z_STREAM_END||q.avail_in===0&&(X===n.Z_FINISH||X===n.Z_SYNC_FLUSH))if(this.options.to==="string"){if(K=C2.utf8border(q.output,q.next_out),W=q.next_out-K,G=C2.buf2string(q.output,K),q.next_out=W,q.avail_out=J-W,W)Z8.arraySet(q.output,q.output,K,W,0);this.onData(G)}else this.onData(Z8.shrinkBuf(q.output,q.next_out))}if(q.avail_in===0&&q.avail_out===0)U=!0}while((q.avail_in>0||q.avail_out===0)&&V!==n.Z_STREAM_END);if(V===n.Z_STREAM_END)X=n.Z_FINISH;if(X===n.Z_FINISH)return V=B6.inflateEnd(this.strm),this.onEnd(V),this.ended=!0,V===n.Z_OK;if(X===n.Z_SYNC_FLUSH)return this.onEnd(n.Z_OK),q.avail_out=0,!0;return!0};i1.prototype.onData=function(Q){this.chunks.push(Q)};i1.prototype.onEnd=function(Q){if(Q===n.Z_OK)if(this.options.to==="string")this.result=this.chunks.join("");else this.result=Z8.flattenChunks(this.chunks);this.chunks=[],this.err=Q,this.msg=this.strm.msg};function n9(Q,$){var q=new i1($);if(q.push(Q,!0),q.err)throw q.msg||i9[q.err];return q.result}function Ij(Q,$){return $=$||{},$.raw=!0,n9(Q,$)}Cj.Inflate=i1;Cj.inflate=n9;Cj.inflateRaw=Ij;Cj.ungzip=n9});var aq=w((yO,rq)=>{var Rj=U1().assign,xj=t$(),vj=iq(),Ej=o9(),nq={};Rj(nq,xj,vj,Ej);rq.exports=nq});var tq=w((gj)=>{var Sj=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",kj=aq(),sq=l(),T2=M0(),yj=Sj?"uint8array":"array";gj.magic="\b\x00";function n1(Q,$){T2.call(this,"FlateWorker/"+Q),this._pako=null,this._pakoAction=Q,this._pakoOptions=$,this.meta={}}sq.inherits(n1,T2);n1.prototype.processChunk=function(Q){if(this.meta=Q.meta,this._pako===null)this._createPako();this._pako.push(sq.transformTo(yj,Q.data),!1)};n1.prototype.flush=function(){if(T2.prototype.flush.call(this),this._pako===null)this._createPako();this._pako.push([],!0)};n1.prototype.cleanUp=function(){T2.prototype.cleanUp.call(this),this._pako=null};n1.prototype._createPako=function(){this._pako=new kj[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var Q=this;this._pako.onData=function($){Q.push({data:$,meta:Q.meta})}};gj.compressWorker=function(Q){return new n1("Deflate",Q)};gj.uncompressWorker=function(){return new n1("Inflate",{})}});var r9=w((hj)=>{var eq=M0();hj.STORE={magic:"\x00\x00",compressWorker:function(){return new eq("STORE compression")},uncompressWorker:function(){return new eq("STORE decompression")}};hj.DEFLATE=tq()});var a9=w((uj)=>{uj.LOCAL_FILE_HEADER="PK\x03\x04";uj.CENTRAL_FILE_HEADER="PK\x01\x02";uj.CENTRAL_DIRECTORY_END="PK\x05\x06";uj.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x06\x07";uj.ZIP64_CENTRAL_DIRECTORY_END="PK\x06\x06";uj.DATA_DESCRIPTOR="PK\x07\b"});var JJ=w((fO,qJ)=>{var M6=l(),P6=M0(),s9=U6(),QJ=X2(),A2=a9(),m=function(Q,$){var q="",J;for(J=0;J<$;J++)q+=String.fromCharCode(Q&255),Q=Q>>>8;return q},rj=function(Q,$){var q=Q;if(!Q)q=$?16893:33204;return(q&65535)<<16},aj=function(Q){return(Q||0)&63},$J=function(Q,$,q,J,Y,V){var{file:X,compression:K}=Q,W=V!==s9.utf8encode,G=M6.transformTo("string",V(X.name)),U=M6.transformTo("string",s9.utf8encode(X.name)),z=X.comment,Z=M6.transformTo("string",V(z)),H=M6.transformTo("string",s9.utf8encode(z)),F=U.length!==X.name.length,N=H.length!==z.length,C,P,L="",A="",B="",O=X.dir,M=X.date,T={crc32:0,compressedSize:0,uncompressedSize:0};if(!$||q)T.crc32=Q.crc32,T.compressedSize=Q.compressedSize,T.uncompressedSize=Q.uncompressedSize;var D=0;if($)D|=8;if(!W&&(F||N))D|=2048;var x=0,v=0;if(O)x|=16;if(Y==="UNIX")v=798,x|=rj(X.unixPermissions,O);else v=20,x|=aj(X.dosPermissions,O);if(C=M.getUTCHours(),C=C<<6,C=C|M.getUTCMinutes(),C=C<<5,C=C|M.getUTCSeconds()/2,P=M.getUTCFullYear()-1980,P=P<<4,P=P|M.getUTCMonth()+1,P=P<<5,P=P|M.getUTCDate(),F)A=m(1,1)+m(QJ(G),4)+U,L+="up"+m(A.length,2)+A;if(N)B=m(1,1)+m(QJ(Z),4)+H,L+="uc"+m(B.length,2)+B;var R="";R+=`
|
|
78
|
-
\x00`,R+=m(D,2),R+=K.magic,R+=m(C,2),R+=m(P,2),R+=m(T.crc32,4),R+=m(T.compressedSize,4),R+=m(T.uncompressedSize,4),R+=m(G.length,2),R+=m(L.length,2);var $0=A2.LOCAL_FILE_HEADER+R+G+L,A0=A2.CENTRAL_FILE_HEADER+m(v,2)+R+m(Z.length,2)+"\x00\x00\x00\x00"+m(x,4)+m(J,4)+G+L+Z;return{fileRecord:$0,dirRecord:A0}},sj=function(Q,$,q,J,Y){var V="",X=M6.transformTo("string",Y(J));return V=A2.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+m(Q,2)+m(Q,2)+m($,4)+m(q,4)+m(X.length,2)+X,V},tj=function(Q){var $="";return $=A2.DATA_DESCRIPTOR+m(Q.crc32,4)+m(Q.compressedSize,4)+m(Q.uncompressedSize,4),$};function h0(Q,$,q,J){P6.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=$,this.zipPlatform=q,this.encodeFileName=J,this.streamFiles=Q,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}M6.inherits(h0,P6);h0.prototype.push=function(Q){var $=Q.meta.percent||0,q=this.entriesCount,J=this._sources.length;if(this.accumulate)this.contentBuffer.push(Q);else this.bytesWritten+=Q.data.length,P6.prototype.push.call(this,{data:Q.data,meta:{currentFile:this.currentFile,percent:q?($+100*(q-J-1))/q:100}})};h0.prototype.openedSource=function(Q){this.currentSourceOffset=this.bytesWritten,this.currentFile=Q.file.name;var $=this.streamFiles&&!Q.file.dir;if($){var q=$J(Q,$,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:q.fileRecord,meta:{percent:0}})}else this.accumulate=!0};h0.prototype.closedSource=function(Q){this.accumulate=!1;var $=this.streamFiles&&!Q.file.dir,q=$J(Q,$,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(q.dirRecord),$)this.push({data:tj(Q),meta:{percent:100}});else{this.push({data:q.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};h0.prototype.flush=function(){var Q=this.bytesWritten;for(var $=0;$<this.dirRecords.length;$++)this.push({data:this.dirRecords[$],meta:{percent:100}});var q=this.bytesWritten-Q,J=sj(this.dirRecords.length,q,Q,this.zipComment,this.encodeFileName);this.push({data:J,meta:{percent:100}})};h0.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};h0.prototype.registerPrevious=function(Q){this._sources.push(Q);var $=this;return Q.on("data",function(q){$.processChunk(q)}),Q.on("end",function(){if($.closedSource($.previous.streamInfo),$._sources.length)$.prepareNextSource();else $.end()}),Q.on("error",function(q){$.error(q)}),this};h0.prototype.resume=function(){if(!P6.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};h0.prototype.error=function(Q){var $=this._sources;if(!P6.prototype.error.call(this,Q))return!1;for(var q=0;q<$.length;q++)try{$[q].error(Q)}catch(J){}return!0};h0.prototype.lock=function(){P6.prototype.lock.call(this);var Q=this._sources;for(var $=0;$<Q.length;$++)Q[$].lock()};qJ.exports=h0});var YJ=w((qZ)=>{var ej=r9(),QZ=JJ(),$Z=function(Q,$){var q=Q||$,J=ej[q];if(!J)throw Error(q+" is not a valid compression method !");return J};qZ.generateWorker=function(Q,$,q){var J=new QZ($.streamFiles,q,$.platform,$.encodeFileName),Y=0;try{Q.forEach(function(V,X){Y++;var K=$Z(X.options.compression,$.compression),W=X.options.compressionOptions||$.compressionOptions||{},G=X.dir,U=X.date;X._compressWorker(K,W).withStreamInfo("file",{name:V,dir:G,date:U,comment:X.comment||"",unixPermissions:X.unixPermissions,dosPermissions:X.dosPermissions}).pipe(J)}),J.entriesCount=Y}catch(V){J.error(V)}return J}});var XJ=w((mO,VJ)=>{var YZ=l(),D2=M0();function z8(Q,$){D2.call(this,"Nodejs stream input adapter for "+Q),this._upstreamEnded=!1,this._bindStream($)}YZ.inherits(z8,D2);z8.prototype._bindStream=function(Q){var $=this;this._stream=Q,Q.pause(),Q.on("data",function(q){$.push({data:q,meta:{percent:0}})}).on("error",function(q){if($.isPaused)this.generatedError=q;else $.error(q)}).on("end",function(){if($.isPaused)$._upstreamEnded=!0;else $.end()})};z8.prototype.pause=function(){if(!D2.prototype.pause.call(this))return!1;return this._stream.pause(),!0};z8.prototype.resume=function(){if(!D2.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};VJ.exports=z8});var LJ=w((cO,FJ)=>{var VZ=U6(),H8=l(),UJ=M0(),XZ=$9(),jJ=q9(),KJ=K2(),KZ=G$(),GZ=YJ(),GJ=o6(),WZ=XJ(),ZJ=function(Q,$,q){var J=H8.getTypeOf($),Y,V=H8.extend(q||{},jJ);if(V.date=V.date||new Date,V.compression!==null)V.compression=V.compression.toUpperCase();if(typeof V.unixPermissions==="string")V.unixPermissions=parseInt(V.unixPermissions,8);if(V.unixPermissions&&V.unixPermissions&16384)V.dir=!0;if(V.dosPermissions&&V.dosPermissions&16)V.dir=!0;if(V.dir)Q=zJ(Q);if(V.createFolders&&(Y=UZ(Q)))HJ.call(this,Y,!0);var X=J==="string"&&V.binary===!1&&V.base64===!1;if(!q||typeof q.binary>"u")V.binary=!X;var K=$ instanceof KJ&&$.uncompressedSize===0;if(K||V.dir||!$||$.length===0)V.base64=!1,V.binary=!0,$="",V.compression="STORE",J="string";var W=null;if($ instanceof KJ||$ instanceof UJ)W=$;else if(GJ.isNode&&GJ.isStream($))W=new WZ(Q,$);else W=H8.prepareContent(Q,$,V.binary,V.optimizedBinaryString,V.base64);var G=new KZ(Q,W,V);this.files[Q]=G},UZ=function(Q){if(Q.slice(-1)==="/")Q=Q.substring(0,Q.length-1);var $=Q.lastIndexOf("/");return $>0?Q.substring(0,$):""},zJ=function(Q){if(Q.slice(-1)!=="/")Q+="/";return Q},HJ=function(Q,$){if($=typeof $<"u"?$:jJ.createFolders,Q=zJ(Q),!this.files[Q])ZJ.call(this,Q,null,{dir:!0,createFolders:$});return this.files[Q]};function WJ(Q){return Object.prototype.toString.call(Q)==="[object RegExp]"}var jZ={load:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(Q){var $,q,J;for($ in this.files)if(J=this.files[$],q=$.slice(this.root.length,$.length),q&&$.slice(0,this.root.length)===this.root)Q(q,J)},filter:function(Q){var $=[];return this.forEach(function(q,J){if(Q(q,J))$.push(J)}),$},file:function(Q,$,q){if(arguments.length===1)if(WJ(Q)){var J=Q;return this.filter(function(V,X){return!X.dir&&J.test(V)})}else{var Y=this.files[this.root+Q];if(Y&&!Y.dir)return Y;else return null}else Q=this.root+Q,ZJ.call(this,Q,$,q);return this},folder:function(Q){if(!Q)return this;if(WJ(Q))return this.filter(function(Y,V){return V.dir&&Q.test(Y)});var $=this.root+Q,q=HJ.call(this,$),J=this.clone();return J.root=q.name,J},remove:function(Q){Q=this.root+Q;var $=this.files[Q];if(!$){if(Q.slice(-1)!=="/")Q+="/";$=this.files[Q]}if($&&!$.dir)delete this.files[Q];else{var q=this.filter(function(Y,V){return V.name.slice(0,Q.length)===Q});for(var J=0;J<q.length;J++)delete this.files[q[J].name]}return this},generate:function(){throw Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(Q){var $,q={};try{if(q=H8.extend(Q||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:VZ.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(H8.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 J=q.comment||this.comment||"";$=GZ.generateWorker(this,q,J)}catch(Y){$=new UJ("error"),$.error(Y)}return new XZ($,q.type||"string",q.mimeType)},generateAsync:function(Q,$){return this.generateInternalStream(Q).accumulate($)},generateNodeStream:function(Q,$){if(Q=Q||{},!Q.type)Q.type="nodebuffer";return this.generateInternalStream(Q).toNodejsStream($)}};FJ.exports=jZ});var t9=w((uO,NJ)=>{var ZZ=l();function OJ(Q){this.data=Q,this.length=Q.length,this.index=0,this.zero=0}OJ.prototype={checkOffset:function(Q){this.checkIndex(this.index+Q)},checkIndex:function(Q){if(this.length<this.zero+Q||Q<0)throw Error("End of data reached (data length = "+this.length+", asked index = "+Q+"). Corrupted zip ?")},setIndex:function(Q){this.checkIndex(Q),this.index=Q},skip:function(Q){this.setIndex(this.index+Q)},byteAt:function(){},readInt:function(Q){var $=0,q;this.checkOffset(Q);for(q=this.index+Q-1;q>=this.index;q--)$=($<<8)+this.byteAt(q);return this.index+=Q,$},readString:function(Q){return ZZ.transformTo("string",this.readData(Q))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var Q=this.readInt(4);return new Date(Date.UTC((Q>>25&127)+1980,(Q>>21&15)-1,Q>>16&31,Q>>11&31,Q>>5&63,(Q&31)<<1))}};NJ.exports=OJ});var e9=w((pO,MJ)=>{var BJ=t9(),zZ=l();function I6(Q){BJ.call(this,Q);for(var $=0;$<this.data.length;$++)Q[$]=Q[$]&255}zZ.inherits(I6,BJ);I6.prototype.byteAt=function(Q){return this.data[this.zero+Q]};I6.prototype.lastIndexOfSignature=function(Q){var $=Q.charCodeAt(0),q=Q.charCodeAt(1),J=Q.charCodeAt(2),Y=Q.charCodeAt(3);for(var V=this.length-4;V>=0;--V)if(this.data[V]===$&&this.data[V+1]===q&&this.data[V+2]===J&&this.data[V+3]===Y)return V-this.zero;return-1};I6.prototype.readAndCheckSignature=function(Q){var $=Q.charCodeAt(0),q=Q.charCodeAt(1),J=Q.charCodeAt(2),Y=Q.charCodeAt(3),V=this.readData(4);return $===V[0]&&q===V[1]&&J===V[2]&&Y===V[3]};I6.prototype.readData=function(Q){if(this.checkOffset(Q),Q===0)return[];var $=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};MJ.exports=I6});var CJ=w((dO,IJ)=>{var PJ=t9(),HZ=l();function C6(Q){PJ.call(this,Q)}HZ.inherits(C6,PJ);C6.prototype.byteAt=function(Q){return this.data.charCodeAt(this.zero+Q)};C6.prototype.lastIndexOfSignature=function(Q){return this.data.lastIndexOf(Q)-this.zero};C6.prototype.readAndCheckSignature=function(Q){var $=this.readData(4);return Q===$};C6.prototype.readData=function(Q){this.checkOffset(Q);var $=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};IJ.exports=C6});var $Q=w((lO,AJ)=>{var TJ=e9(),FZ=l();function QQ(Q){TJ.call(this,Q)}FZ.inherits(QQ,TJ);QQ.prototype.readData=function(Q){if(this.checkOffset(Q),Q===0)return new Uint8Array(0);var $=this.data.subarray(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};AJ.exports=QQ});var RJ=w((oO,wJ)=>{var DJ=$Q(),LZ=l();function qQ(Q){DJ.call(this,Q)}LZ.inherits(qQ,DJ);qQ.prototype.readData=function(Q){this.checkOffset(Q);var $=this.data.slice(this.zero+this.index,this.zero+this.index+Q);return this.index+=Q,$};wJ.exports=qQ});var JQ=w((iO,vJ)=>{var w2=l(),xJ=W1(),OZ=e9(),NZ=CJ(),BZ=RJ(),MZ=$Q();vJ.exports=function(Q){var $=w2.getTypeOf(Q);if(w2.checkSupport($),$==="string"&&!xJ.uint8array)return new NZ(Q);if($==="nodebuffer")return new BZ(Q);if(xJ.uint8array)return new MZ(w2.transformTo("uint8array",Q));return new OZ(w2.transformTo("array",Q))}});var yJ=w((nO,kJ)=>{var YQ=JQ(),w1=l(),PZ=K2(),EJ=X2(),R2=U6(),x2=r9(),IZ=W1(),CZ=0,TZ=3,AZ=function(Q){for(var $ in x2){if(!Object.prototype.hasOwnProperty.call(x2,$))continue;if(x2[$].magic===Q)return x2[$]}return null};function SJ(Q,$){this.options=Q,this.loadOptions=$}SJ.prototype={isEncrypted:function(){return(this.bitFlag&1)===1},useUTF8:function(){return(this.bitFlag&2048)===2048},readLocalPart:function(Q){var $,q;if(Q.skip(22),this.fileNameLength=Q.readInt(2),q=Q.readInt(2),this.fileName=Q.readData(this.fileNameLength),Q.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($=AZ(this.compressionMethod),$===null)throw Error("Corrupted zip : compression "+w1.pretty(this.compressionMethod)+" unknown (inner file : "+w1.transformTo("string",this.fileName)+")");this.decompressed=new PZ(this.compressedSize,this.uncompressedSize,this.crc32,$,Q.readData(this.compressedSize))},readCentralPart:function(Q){this.versionMadeBy=Q.readInt(2),Q.skip(2),this.bitFlag=Q.readInt(2),this.compressionMethod=Q.readString(2),this.date=Q.readDate(),this.crc32=Q.readInt(4),this.compressedSize=Q.readInt(4),this.uncompressedSize=Q.readInt(4);var $=Q.readInt(2);if(this.extraFieldsLength=Q.readInt(2),this.fileCommentLength=Q.readInt(2),this.diskNumberStart=Q.readInt(2),this.internalFileAttributes=Q.readInt(2),this.externalFileAttributes=Q.readInt(4),this.localHeaderOffset=Q.readInt(4),this.isEncrypted())throw Error("Encrypted zip are not supported");Q.skip($),this.readExtraFields(Q),this.parseZIP64ExtraField(Q),this.fileComment=Q.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var Q=this.versionMadeBy>>8;if(this.dir=this.externalFileAttributes&16?!0:!1,Q===CZ)this.dosPermissions=this.externalFileAttributes&63;if(Q===TZ)this.unixPermissions=this.externalFileAttributes>>16&65535;if(!this.dir&&this.fileNameStr.slice(-1)==="/")this.dir=!0},parseZIP64ExtraField:function(){if(!this.extraFields[1])return;var Q=YQ(this.extraFields[1].value);if(this.uncompressedSize===w1.MAX_VALUE_32BITS)this.uncompressedSize=Q.readInt(8);if(this.compressedSize===w1.MAX_VALUE_32BITS)this.compressedSize=Q.readInt(8);if(this.localHeaderOffset===w1.MAX_VALUE_32BITS)this.localHeaderOffset=Q.readInt(8);if(this.diskNumberStart===w1.MAX_VALUE_32BITS)this.diskNumberStart=Q.readInt(4)},readExtraFields:function(Q){var $=Q.index+this.extraFieldsLength,q,J,Y;if(!this.extraFields)this.extraFields={};while(Q.index+4<$)q=Q.readInt(2),J=Q.readInt(2),Y=Q.readData(J),this.extraFields[q]={id:q,length:J,value:Y};Q.setIndex($)},handleUTF8:function(){var Q=IZ.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=R2.utf8decode(this.fileName),this.fileCommentStr=R2.utf8decode(this.fileComment);else{var $=this.findExtraFieldUnicodePath();if($!==null)this.fileNameStr=$;else{var q=w1.transformTo(Q,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(q)}var J=this.findExtraFieldUnicodeComment();if(J!==null)this.fileCommentStr=J;else{var Y=w1.transformTo(Q,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(Y)}}},findExtraFieldUnicodePath:function(){var Q=this.extraFields[28789];if(Q){var $=YQ(Q.value);if($.readInt(1)!==1)return null;if(EJ(this.fileName)!==$.readInt(4))return null;return R2.utf8decode($.readData(Q.length-5))}return null},findExtraFieldUnicodeComment:function(){var Q=this.extraFields[25461];if(Q){var $=YQ(Q.value);if($.readInt(1)!==1)return null;if(EJ(this.fileComment)!==$.readInt(4))return null;return R2.utf8decode($.readData(Q.length-5))}return null}};kJ.exports=SJ});var bJ=w((rO,_J)=>{var DZ=JQ(),z1=l(),m0=a9(),wZ=yJ(),RZ=W1();function gJ(Q){this.files=[],this.loadOptions=Q}gJ.prototype={checkSignature:function(Q){if(!this.reader.readAndCheckSignature(Q)){this.reader.index-=4;var $=this.reader.readString(4);throw Error("Corrupted zip or bug: unexpected signature ("+z1.pretty($)+", expected "+z1.pretty(Q)+")")}},isSignature:function(Q,$){var q=this.reader.index;this.reader.setIndex(Q);var J=this.reader.readString(4),Y=J===$;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 Q=this.reader.readData(this.zipCommentLength),$=RZ.uint8array?"uint8array":"array",q=z1.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 Q=this.zip64EndOfCentralSize-44,$=0,q,J,Y;while($<Q)q=this.reader.readInt(2),J=this.reader.readInt(4),Y=this.reader.readData(J),this.zip64ExtensibleData[q]={id:q,length:J,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(Q=0;Q<this.files.length;Q++)$=this.files[Q],this.reader.setIndex($.localHeaderOffset),this.checkSignature(m0.LOCAL_FILE_HEADER),$.readLocalPart(this.reader),$.handleUTF8(),$.processAttributes()},readCentralDir:function(){var Q;this.reader.setIndex(this.centralDirOffset);while(this.reader.readAndCheckSignature(m0.CENTRAL_FILE_HEADER))Q=new wZ({zip64:this.zip64},this.loadOptions),Q.readCentralPart(this.reader),this.files.push(Q);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 Q=this.reader.lastIndexOfSignature(m0.CENTRAL_DIRECTORY_END);if(Q<0){var $=!this.isSignature(0,m0.LOCAL_FILE_HEADER);if($)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(Q);var q=Q;if(this.checkSignature(m0.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===z1.MAX_VALUE_16BITS||this.diskWithCentralDirStart===z1.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===z1.MAX_VALUE_16BITS||this.centralDirRecords===z1.MAX_VALUE_16BITS||this.centralDirSize===z1.MAX_VALUE_32BITS||this.centralDirOffset===z1.MAX_VALUE_32BITS){if(this.zip64=!0,Q=this.reader.lastIndexOfSignature(m0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),Q<0)throw Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(Q),this.checkSignature(m0.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,m0.ZIP64_CENTRAL_DIRECTORY_END)){if(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(m0.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(m0.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var J=this.centralDirOffset+this.centralDirSize;if(this.zip64)J+=20,J+=12+this.zip64EndOfCentralSize;var Y=q-J;if(Y>0)if(this.isSignature(q,m0.CENTRAL_FILE_HEADER));else this.reader.zero=Y;else if(Y<0)throw Error("Corrupted zip: missing "+Math.abs(Y)+" bytes.")},prepareReader:function(Q){this.reader=DZ(Q)},load:function(Q){this.prepareReader(Q),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}};_J.exports=gJ});var mJ=w((aO,hJ)=>{var VQ=l(),v2=K6(),xZ=U6(),vZ=bJ(),EZ=V9(),fJ=o6();function SZ(Q){return new v2.Promise(function($,q){var J=Q.decompressed.getContentWorker().pipe(new EZ);J.on("error",function(Y){q(Y)}).on("end",function(){if(J.streamInfo.crc32!==Q.decompressed.crc32)q(Error("Corrupted zip : CRC32 mismatch"));else $()}).resume()})}hJ.exports=function(Q,$){var q=this;if($=VQ.extend($||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:xZ.utf8decode}),fJ.isNode&&fJ.isStream(Q))return v2.Promise.reject(Error("JSZip can't accept a stream when loading a zip file."));return VQ.prepareContent("the loaded zip file",Q,!0,$.optimizedBinaryString,$.base64).then(function(J){var Y=new vZ($);return Y.load(J),Y}).then(function(Y){var V=[v2.Promise.resolve(Y)],X=Y.files;if($.checkCRC32)for(var K=0;K<X.length;K++)V.push(SZ(X[K]));return v2.Promise.all(V)}).then(function(Y){var V=Y.shift(),X=V.files;for(var K=0;K<X.length;K++){var W=X[K],G=W.fileNameStr,U=VQ.resolve(W.fileNameStr);if(q.file(U,W.decompressed,{binary:!0,optimizedBinaryString:!0,date:W.date,dir:W.dir,comment:W.fileCommentStr.length?W.fileCommentStr:null,unixPermissions:W.unixPermissions,dosPermissions:W.dosPermissions,createFolders:$.createFolders}),!W.dir)q.file(U).unsafeOriginalName=G}if(V.zipComment.length)q.comment=V.zipComment;return q})}});var uJ=w((sO,cJ)=>{function S0(){if(!(this instanceof S0))return new S0;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 Q=new S0;for(var $ in this)if(typeof this[$]!=="function")Q[$]=this[$];return Q}}S0.prototype=LJ();S0.prototype.loadAsync=mJ();S0.support=W1();S0.defaults=q9();S0.version="3.10.1";S0.loadAsync=function(Q,$){return new S0().loadAsync(Q,$)};S0.external=K6();cJ.exports=S0});var R1=w((tO,XQ)=>{var S2=process||{},pJ=S2.argv||[],E2=S2.env||{},kZ=!(!!E2.NO_COLOR||pJ.includes("--no-color"))&&(!!E2.FORCE_COLOR||pJ.includes("--color")||S2.platform==="win32"||(S2.stdout||{}).isTTY&&E2.TERM!=="dumb"||!!E2.CI),yZ=(Q,$,q=Q)=>(J)=>{let Y=""+J,V=Y.indexOf($,Q.length);return~V?Q+gZ(Y,$,q,V)+$:Q+Y+$},gZ=(Q,$,q,J)=>{let Y="",V=0;do Y+=Q.substring(V,J)+q,V=J+$.length,J=Q.indexOf($,V);while(~J);return Y+Q.substring(V)},dJ=(Q=kZ)=>{let $=Q?yZ:()=>String;return{isColorSupported:Q,reset:$("\x1B[0m","\x1B[0m"),bold:$("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:$("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:$("\x1B[3m","\x1B[23m"),underline:$("\x1B[4m","\x1B[24m"),inverse:$("\x1B[7m","\x1B[27m"),hidden:$("\x1B[8m","\x1B[28m"),strikethrough:$("\x1B[9m","\x1B[29m"),black:$("\x1B[30m","\x1B[39m"),red:$("\x1B[31m","\x1B[39m"),green:$("\x1B[32m","\x1B[39m"),yellow:$("\x1B[33m","\x1B[39m"),blue:$("\x1B[34m","\x1B[39m"),magenta:$("\x1B[35m","\x1B[39m"),cyan:$("\x1B[36m","\x1B[39m"),white:$("\x1B[37m","\x1B[39m"),gray:$("\x1B[90m","\x1B[39m"),bgBlack:$("\x1B[40m","\x1B[49m"),bgRed:$("\x1B[41m","\x1B[49m"),bgGreen:$("\x1B[42m","\x1B[49m"),bgYellow:$("\x1B[43m","\x1B[49m"),bgBlue:$("\x1B[44m","\x1B[49m"),bgMagenta:$("\x1B[45m","\x1B[49m"),bgCyan:$("\x1B[46m","\x1B[49m"),bgWhite:$("\x1B[47m","\x1B[49m"),blackBright:$("\x1B[90m","\x1B[39m"),redBright:$("\x1B[91m","\x1B[39m"),greenBright:$("\x1B[92m","\x1B[39m"),yellowBright:$("\x1B[93m","\x1B[39m"),blueBright:$("\x1B[94m","\x1B[39m"),magentaBright:$("\x1B[95m","\x1B[39m"),cyanBright:$("\x1B[96m","\x1B[39m"),whiteBright:$("\x1B[97m","\x1B[39m"),bgBlackBright:$("\x1B[100m","\x1B[49m"),bgRedBright:$("\x1B[101m","\x1B[49m"),bgGreenBright:$("\x1B[102m","\x1B[49m"),bgYellowBright:$("\x1B[103m","\x1B[49m"),bgBlueBright:$("\x1B[104m","\x1B[49m"),bgMagentaBright:$("\x1B[105m","\x1B[49m"),bgCyanBright:$("\x1B[106m","\x1B[49m"),bgWhiteBright:$("\x1B[107m","\x1B[49m")}};XQ.exports=dJ();XQ.exports.createColors=dJ});import{homedir as eZ}from"node:os";import u from"node:path";function Qz(Q=process.env,$=e){if(Q.OPENCODE_CONFIG_DIR)return Q.OPENCODE_CONFIG_DIR;if(Q.XDG_CONFIG_HOME)return u.join(Q.XDG_CONFIG_HOME,"opencode");return u.join($,".config","opencode")}function v1(){let Q=process.env.LOCALAPPDATA??u.join(e,"AppData","Local"),$=u.join(Q,"Programs","antigravity","User","mcp_config.json"),q=u.join(e,".gemini","antigravity","mcp_config.json"),J=u.join(e,".antigravity","mcp_config.json");if(process.platform==="win32")return[$,q,J];return[q,J,$]}async function WY(){let{stat:Q}=await import("node:fs/promises"),[$,...q]=v1();for(let J of[$,...q])try{return await Q(J),J}catch{}return $}function UY(){let[Q]=v1();return Q}function $z(){return u.dirname(UY())}function E1(){return u.join(e,".gemini","antigravity","skills","petdex")}function I0(Q,$,q,J){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",` ${qz(Q,q,J)};`,"fi"].join(" ")}`}function qz(Q,$,q){let J=q!=null?`{"state":"${$}","duration":${q},"agent_source":"${Q}"}`:`{"state":"${$}","agent_source":"${Q}"}`;return['T="$(cat "$HOME/.petdex/runtime/update-token" 2>/dev/null)"',`[ -n "$T" ] && curl -s -m 0.3 -X POST ${r1}`,'-H "Content-Type: application/json"','-H "X-Petdex-Update-Token: $T"',`--data-raw '${J}'`,">/dev/null 2>&1 || true"].join(" ")}function Jz(){let Q=r1.replace(/\/state$/,"/bubble");return String.raw`// petdex hook plugin. Auto-generated by 'petdex hooks install'.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (
|
|
103
|
-
const value = input[key];
|
|
104
|
-
return typeof value === "string" ? value : null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function basename(filePath) {
|
|
108
|
-
const slash = Math.max(filePath.lastIndexOf("/"), filePath.lastIndexOf("\\"));
|
|
109
|
-
return slash >= 0 ? filePath.slice(slash + 1) : filePath;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function clip(text, max = 40) {
|
|
113
|
-
return text.length <= max ? text : text.slice(0, max - 1) + "…";
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function canonicalToolKind(toolName) {
|
|
117
|
-
const lower = String(toolName || "").toLowerCase();
|
|
118
|
-
if (lower === "read") return "read";
|
|
119
|
-
if (lower === "edit" || lower === "multiedit") return "edit";
|
|
120
|
-
if (lower === "write") return "write";
|
|
121
|
-
if (lower === "bash" || lower === "shell") return "bash";
|
|
122
|
-
if (lower === "grep") return "grep";
|
|
123
|
-
if (lower === "glob") return "glob";
|
|
124
|
-
if (lower === "webfetch" || lower === "websearch") return "webfetch";
|
|
125
|
-
if (lower === "task" || lower === "agent") return "task";
|
|
126
|
-
return "unknown";
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function formatTool(toolName, toolInput, phase) {
|
|
130
|
-
const past = phase === "done";
|
|
131
|
-
switch (canonicalToolKind(toolName)) {
|
|
132
|
-
case "read": {
|
|
133
|
-
const path = fieldFrom(toolInput, "file_path") ?? fieldFrom(toolInput, "filePath") ?? fieldFrom(toolInput, "path");
|
|
134
|
-
const name = path ? clip(basename(path)) : null;
|
|
135
|
-
return name ? (past ? "Read " + name : "Reading " + name) : past ? "Read file" : "Reading file";
|
|
136
|
-
}
|
|
137
|
-
case "edit":
|
|
138
|
-
case "write": {
|
|
139
|
-
const path = fieldFrom(toolInput, "file_path") ?? fieldFrom(toolInput, "filePath") ?? fieldFrom(toolInput, "path");
|
|
140
|
-
const name = path ? clip(basename(path)) : null;
|
|
141
|
-
return name ? (past ? "Edited " + name : "Editing " + name) : past ? "Edited file" : "Editing file";
|
|
142
|
-
}
|
|
143
|
-
case "bash": {
|
|
144
|
-
const command = fieldFrom(toolInput, "command");
|
|
145
|
-
if (command) {
|
|
146
|
-
const head = clip(command.split(/\s+/)[0] || command, 24);
|
|
147
|
-
return past ? "Ran " + head : "Running " + head;
|
|
148
|
-
}
|
|
149
|
-
return past ? "Ran command" : "Running command";
|
|
150
|
-
}
|
|
151
|
-
case "grep": {
|
|
152
|
-
const pattern = fieldFrom(toolInput, "pattern");
|
|
153
|
-
return pattern ? (past ? "Searched \"" + clip(pattern, 28) + "\"" : "Searching \"" + clip(pattern, 28) + "\"") : past ? "Searched files" : "Searching files";
|
|
154
|
-
}
|
|
155
|
-
case "glob": {
|
|
156
|
-
const pattern = fieldFrom(toolInput, "pattern");
|
|
157
|
-
return pattern ? (past ? "Listed " + clip(pattern, 28) : "Listing " + clip(pattern, 28)) : past ? "Listed files" : "Listing files";
|
|
158
|
-
}
|
|
159
|
-
case "webfetch": {
|
|
160
|
-
const url = fieldFrom(toolInput, "url");
|
|
161
|
-
if (url) {
|
|
162
|
-
try {
|
|
163
|
-
const host = new URL(url).hostname;
|
|
164
|
-
return past ? "Fetched " + clip(host, 28) : "Fetching " + clip(host, 28);
|
|
165
|
-
} catch {}
|
|
166
|
-
}
|
|
167
|
-
return past ? "Fetched web" : "Searching web";
|
|
168
|
-
}
|
|
169
|
-
case "task":
|
|
170
|
-
return past ? "Subagent done" : "Spawning subagent";
|
|
171
|
-
default: {
|
|
172
|
-
const name = clip(String(toolName || "tool"), 28);
|
|
173
|
-
return past ? "Called " + name : "Calling " + name;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
async function postJson(url, body, token) {
|
|
179
|
-
try {
|
|
180
|
-
await fetch(url, {
|
|
181
|
-
method: "POST",
|
|
182
|
-
headers: {
|
|
183
|
-
"Content-Type": "application/json",
|
|
184
|
-
"X-Petdex-Update-Token": token,
|
|
185
|
-
},
|
|
186
|
-
body: JSON.stringify(body),
|
|
187
|
-
// 300ms instead of 1s: well above any real localhost roundtrip
|
|
188
|
-
// and below the threshold an agent user notices as latency.
|
|
189
|
-
signal: AbortSignal.timeout(300),
|
|
190
|
-
});
|
|
191
|
-
} catch {
|
|
192
|
-
// sidecar offline: stay quiet, the agent shouldn't notice.
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
async function notify({ state, duration, text }) {
|
|
197
|
-
// Killswitch: users toggle this with /petdex inside their agent
|
|
198
|
-
// (or 'petdex hooks toggle' from a shell). Bail before the token
|
|
199
|
-
// read so the disabled state has zero filesystem cost beyond the
|
|
200
|
-
// existsSync.
|
|
201
|
-
if (existsSync(KILLSWITCH_PATH)) return;
|
|
202
|
-
// Token gate defends against drive-by no-cors POSTs from any site
|
|
203
|
-
// the user visits. The token rotates per sidecar session and lives
|
|
204
|
-
// at mode 0600, so only this user can read it.
|
|
205
|
-
const token = await readToken();
|
|
206
|
-
if (!token) return; // sidecar offline or missing — silently no-op
|
|
207
|
-
// Stamp agent_source so the sidecar can route per-pet when we
|
|
208
|
-
// ship multi-mascot. Today the field is recorded for telemetry
|
|
209
|
-
// but doesn't affect routing.
|
|
210
|
-
const stateBody =
|
|
211
|
-
duration != null
|
|
212
|
-
? { state, duration, agent_source: "opencode" }
|
|
213
|
-
: { state, agent_source: "opencode" };
|
|
214
|
-
await Promise.all([
|
|
215
|
-
postJson(SIDECAR_URL, stateBody, token),
|
|
216
|
-
text ? postJson(SIDECAR_BUBBLE_URL, { text, agent_source: "opencode" }, token) : Promise.resolve(),
|
|
217
|
-
]);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const hooks = {
|
|
221
|
-
"tool.execute.before": async (input, output) => notify({
|
|
222
|
-
state: "running",
|
|
223
|
-
text: formatTool(input.tool, output.args, "running"),
|
|
224
|
-
}),
|
|
225
|
-
"tool.execute.after": async (input) => notify({
|
|
226
|
-
state: "idle",
|
|
227
|
-
text: formatTool(input.tool, input.args, "done"),
|
|
228
|
-
}),
|
|
229
|
-
event: async ({ event }) => {
|
|
230
|
-
if (event.type === "session.idle") notify({ state: "waving", duration: 1500, text: "Done." });
|
|
231
|
-
else if (event.type === "session.error") notify({ state: "failed", duration: 2500, text: "OpenCode hit an error." });
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
const PetdexPlugin = {
|
|
236
|
-
id: "petdex",
|
|
237
|
-
server: async () => hooks,
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
export default PetdexPlugin;
|
|
241
|
-
export { PetdexPlugin };
|
|
242
|
-
`}function x1(Q){if(Q.startsWith(e))return`~${Q.slice(e.length)}`;return Q}function Yz(Q){let $=Q.split(`
|
|
243
|
-
`),q=/^\s*\[([^[\]]+)\]\s*(?:#.*)?$/,J=/^\s*hooks\s*=\s*(.+?)\s*(?:#.*)?$/,Y=/^\s*codex_hooks\s*=\s*(.+?)\s*(?:#.*)?$/,V=null,X=null,K=null,W=null,G=!1;for(let U=0;U<$.length;U+=1){let z=$[U],Z=z.match(q);if(Z){if(V=Z[1].trim(),V==="features"&&X===null)X=U;continue}if(V!=="features")continue;let H=z.match(J);if(H&&K===null){K=U,W=H[1].trim();continue}let F=z.match(Y);if(F&&F[1].trim()==="true")G=!0}if(K!==null){if(W==="true")return{state:"enabled"};return{state:"wrong-value",replaceLine:K}}if(G)return{state:"enabled"};if(X===null)return{state:"no-features-section"};return{state:"no-key",insertAfterLine:X}}function Vz(Q,$){if($.state==="enabled"||$.state==="missing-file")return Q;let q=Q.split(`
|
|
244
|
-
`);if($.state==="wrong-value"){let Y=q[$.replaceLine],V=/^(\s*hooks\s*=\s*)([^#\n]+?)(\s*(?:#.*)?)$/,X=Y.match(V);return q[$.replaceLine]=X?`${X[1]}true${X[3]}`:"hooks = true",q.join(`
|
|
245
|
-
`)}if($.state==="no-key")return q.splice($.insertAfterLine+1,0,"hooks = true"),q.join(`
|
|
246
|
-
`);let J=Q.endsWith(`
|
|
247
|
-
`)||Q.length===0?"":`
|
|
248
|
-
`;return`${Q}${J}
|
|
249
|
-
[features]
|
|
250
|
-
hooks = true
|
|
251
|
-
`}var F8=7777,r1,e,g2,H1;var L8=H0(()=>{r1=`http://127.0.0.1:${F8}/state`,e=eZ(),g2=Qz();H1=[{id:"claude-code",displayName:"Claude Code",configDir:u.join(e,".claude"),configFile:u.join(e,".claude","settings.json"),slashCommandPath:u.join(e,".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:I0("claude-code","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:I0("claude-code","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:I0("claude-code","post","idle")}]}],Notification:[{hooks:[{type:"command",command:I0("claude-code","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:I0("claude-code","stop","waving",1500)}]}]}}}},{id:"codex",displayName:"Codex CLI",configDir:u.join(e,".codex"),configFile:u.join(e,".codex","hooks.json"),slashCommandPath:u.join(e,".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:Q}=await import("node:fs/promises"),$=u.join(e,".codex","config.toml"),q=!0,J="";try{J=await Q($,"utf8")}catch(X){let K=X.code;if(K==="ENOENT")q=!1;else return[{level:"warn",message:`Could not read ${$} (${K??"io_error"}). Make sure [features] hooks = true is set there before Codex picks up the hooks.`}]}let Y=q?Yz(J):{state:"missing-file"};if(Y.state==="enabled")return[];let V={prompt:Y.state==="missing-file"?`Create ${x1($)} with [features] hooks = true?`:Y.state==="wrong-value"?`Set hooks = true under [features] in ${x1($)}? (a .bak of the current file is created first)`:`Add hooks = true under [features] in ${x1($)}? (a .bak of the current file is created first)`,apply:async()=>{let{writeFile:X,mkdir:K}=await import("node:fs/promises");if(await K(u.dirname($),{recursive:!0}),!q)try{return await X($,`[features]
|
|
252
|
-
hooks = true
|
|
253
|
-
`,"utf8"),{ok:!0,message:`Created ${x1($)} with [features] hooks = true`}}catch(z){return{ok:!1,message:`Write failed: ${z.message}`}}let W=new Date().toISOString().replace(/[:.]/g,"-"),G=`${$}.${W}.bak`;try{await X(G,J)}catch(z){return{ok:!1,message:`Backup failed: ${z.message}`}}let U=Vz(J,Y);try{return await X($,U,"utf8"),{ok:!0,message:`hooks = true set in ${x1($)} (backup: ${u.basename(G)})`}}catch(z){return{ok:!1,message:`Write failed: ${z.message}`}}}};return[{level:"action",message:`Codex needs hooks = true under [features] in ${x1($)} before it loads ${x1(u.join(e,".codex","hooks.json"))}.`,fix:V}]},build(){return{hooks:{UserPromptSubmit:[{hooks:[{type:"command",command:I0("codex","user-prompt","jumping",800)}]}],PreToolUse:[{hooks:[{type:"command",command:I0("codex","pre","running")}]}],PostToolUse:[{hooks:[{type:"command",command:I0("codex","post","idle")}]}],PermissionRequest:[{hooks:[{type:"command",command:I0("codex","notification","waiting")}]}],Stop:[{hooks:[{type:"command",command:I0("codex","stop","waving",1500)}]}]}}}},{id:"gemini",displayName:"Gemini CLI",configDir:u.join(e,".gemini"),configFile:u.join(e,".gemini","settings.json"),slashCommandPath:u.join(e,".gemini","commands","petdex.toml"),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:I0("gemini","pre","running")}]}],AfterTool:[{hooks:[{type:"command",command:I0("gemini","post","idle")}]}],SessionEnd:[{hooks:[{type:"command",command:I0("gemini","stop","waving",1500)}]}]}}}},{id:"opencode",displayName:"OpenCode",configDir:g2,configFile:u.join(g2,"plugins","petdex.js"),slashCommandPath:u.join(g2,"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 Jz()},async postInstallChecks(){return[{level:"info",message:`OpenCode plugin installed at ${x1(u.join(g2,"plugins","petdex.js"))}. If hooks still do not load, start OpenCode with the same OPENCODE_CONFIG_DIR/XDG_CONFIG_HOME environment used during install.`}]}},{id:"antigravity",displayName:"Antigravity",configDir:$z(),configFile:UY(),slashCommandPath:u.join(e,".gemini","antigravity","skills","petdex","SKILL.md"),docsUrl:"https://antigravity.google/docs/skills",hookEntries:[],build(){return{}},async postInstallChecks(){return[{level:"action",message:`Antigravity uses MCP instead of hooks. The petdex MCP server was injected into your Antigravity MCP config.
|
|
254
|
-
|
|
255
|
-
To activate:
|
|
256
|
-
1. Open Antigravity → Agent Panel → ... → MCP Servers
|
|
257
|
-
2. Verify "petdex" MCP server is listed and running
|
|
258
|
-
3. The Petdex Agent Skill is installed at ~/.gemini/antigravity/skills/petdex/
|
|
259
|
-
|
|
260
|
-
The agent should start updating the mascot automatically when working in this project.`}]}}]});var dY={};E8(dY,{persistRunningBinary:()=>A8,PERSIST_PATH:()=>g0,PERSIST_DIR:()=>wQ});import{copyFile as zH,mkdir as HH}from"node:fs/promises";import{homedir as FH}from"node:os";import{join as pY}from"node:path";async function A8(){let Q=process.argv[1];if(!Q)return{ok:!1,path:g0,reason:"no argv[1]"};try{await HH(wQ,{recursive:!0}),await zH(Q,g0);let{chmod:$}=await import("node:fs/promises");try{await $(g0,493)}catch{}return{ok:!0,path:g0}}catch($){return{ok:!1,path:g0,reason:$.message}}}var wQ,g0;var D8=H0(()=>{wQ=pY(FH(),".petdex","bin"),g0=pY(wQ,"petdex.js")});function lY(){return`---
|
|
261
|
-
name: petdex
|
|
262
|
-
description: >
|
|
263
|
-
Coordinates with the petdex desktop mascot to reflect agent activity.
|
|
264
|
-
The pet is a transparent, always-on-top companion that animates based
|
|
265
|
-
on what the agent is doing. Call these MCP tools before/after every
|
|
266
|
-
tool use so the pet stays in sync.
|
|
267
|
-
---
|
|
268
|
-
|
|
269
|
-
# Petdex Desktop Mascot
|
|
270
|
-
|
|
271
|
-
When this skill is active, call the petdex MCP tools at the points below.
|
|
272
|
-
**Important:** Do NOT call Petdex MCP tools around calls to Petdex MCP tools
|
|
273
|
-
themselves (petdex_set_state, petdex_show_bubble, petdex_status). Only
|
|
274
|
-
wrap non-Petdex tool calls — otherwise every state update would trigger
|
|
275
|
-
another update in a recursive loop.
|
|
276
|
-
|
|
277
|
-
## Before every non-Petdex tool use
|
|
278
|
-
|
|
279
|
-
Call \`petdex_set_state\` with:
|
|
280
|
-
- state: "running"
|
|
281
|
-
- duration: (no duration — will be updated on tool completion)
|
|
282
|
-
|
|
283
|
-
Call \`petdex_show_bubble\` with a brief description of what you're about
|
|
284
|
-
to do. Examples:
|
|
285
|
-
- "Reading server.ts"
|
|
286
|
-
- "Searching for patterns"
|
|
287
|
-
- "Running git status"
|
|
288
|
-
- "Editing auth middleware"
|
|
289
|
-
- "Writing unit tests"
|
|
290
|
-
|
|
291
|
-
The bubble text should be short (under 40 chars) and in present tense
|
|
292
|
-
("Reading", "Running", "Editing" — never past tense for pre-tool calls).
|
|
293
|
-
|
|
294
|
-
## After every non-Petdex tool use
|
|
295
|
-
|
|
296
|
-
Call \`petdex_set_state\` with:
|
|
297
|
-
- state: "idle"
|
|
298
|
-
|
|
299
|
-
## On session end / task completion
|
|
300
|
-
|
|
301
|
-
Call \`petdex_set_state\` with:
|
|
302
|
-
- state: "waving"
|
|
303
|
-
- duration: 1500
|
|
304
|
-
|
|
305
|
-
## On error
|
|
306
|
-
|
|
307
|
-
If you encounter an error mid-task (from a non-Petdex tool), call
|
|
308
|
-
\`petdex_set_state\` with:
|
|
309
|
-
- state: "failed"
|
|
310
|
-
- duration: 2500
|
|
311
|
-
|
|
312
|
-
## On waiting for user input
|
|
313
|
-
|
|
314
|
-
Call \`petdex_set_state\` with:
|
|
315
|
-
- state: "waiting"
|
|
316
|
-
|
|
317
|
-
## Available MCP tools
|
|
318
|
-
|
|
319
|
-
All tools are exposed via the "petdex" MCP server (configured in
|
|
320
|
-
mcp_config.json):
|
|
321
|
-
|
|
322
|
-
- \`petdex_set_state\`: Set animation state (idle, running, waving,
|
|
323
|
-
jumping, failed, review, waiting)
|
|
324
|
-
- \`petdex_show_bubble\`: Show a speech bubble with text
|
|
325
|
-
- \`petdex_status\`: Check if the mascot is reachable
|
|
326
|
-
|
|
327
|
-
**Do not** wrap these tools with Petdex calls. Only non-Petdex tools
|
|
328
|
-
should trigger petdex_set_state / petdex_show_bubble.
|
|
329
|
-
|
|
330
|
-
## Configuration
|
|
331
|
-
|
|
332
|
-
This skill requires the petdex MCP server to be running.
|
|
333
|
-
Configure it in Antigravity: Agent Panel → ... → MCP Servers.
|
|
334
|
-
The server command is installed with the same Node.js runtime that ran
|
|
335
|
-
\`petdex hooks install\`: \`${process.execPath}\`
|
|
336
|
-
|
|
337
|
-
Make sure petdex-desktop is running (\`petdex up\`) for the mascot to
|
|
338
|
-
appear.
|
|
339
|
-
`}function oY(){return{mcpServers:{petdex:{command:process.execPath,args:[g0,"mcp-server"]}}}}var iY=H0(()=>{D8()});import{mkdir as LH,rm as RQ,writeFile as OH}from"node:fs/promises";import{homedir as NH}from"node:os";import nY from"node:path";async function aY(Q){if(await LH(nY.dirname(Q.slashCommandPath),{recursive:!0}),await OH(Q.slashCommandPath,Q.id==="gemini"?MH:BH,"utf8"),Q.id==="gemini")await RQ(rY,{force:!0})}async function l2(Q){try{if(await RQ(Q.slashCommandPath,{force:!0}),Q.id==="gemini")await RQ(rY,{force:!0})}catch{}}var $1='node "$HOME/.petdex/bin/petdex.js"',BH,MH,rY;var xQ=H0(()=>{BH=`---
|
|
340
|
-
description: Wake or sleep the petdex mascot. Toggles the floating pet on/off
|
|
341
|
-
---
|
|
342
|
-
|
|
343
|
-
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.
|
|
344
|
-
|
|
345
|
-
Run the matching command using the persisted petdex binary at \`$HOME/.petdex/bin/petdex.js\` (always present after \`petdex hooks install\`):
|
|
346
|
-
|
|
347
|
-
- \`/petdex\` (no args) → run \`${$1} toggle\`
|
|
348
|
-
- \`/petdex up\` → run \`${$1} up\`
|
|
349
|
-
- \`/petdex down\` → run \`${$1} down\`
|
|
350
|
-
- \`/petdex status\` → run \`${$1} hooks status\`
|
|
351
|
-
- \`/petdex doctor\` → run \`${$1} doctor\`
|
|
352
|
-
|
|
353
|
-
Show the command output verbatim to the user. Don't reinterpret, don't explain. The CLI's output is already user-facing.
|
|
354
|
-
|
|
355
|
-
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.
|
|
356
|
-
|
|
357
|
-
Arguments: \`$ARGUMENTS\`
|
|
358
|
-
`,MH=`description = "Wake or sleep the petdex mascot. Toggles the floating pet on/off"
|
|
359
|
-
|
|
360
|
-
prompt = """
|
|
361
|
-
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.
|
|
362
|
-
|
|
363
|
-
Run the matching command using the persisted petdex binary at \`$HOME/.petdex/bin/petdex.js\` (always present after \`petdex hooks install\`):
|
|
364
|
-
|
|
365
|
-
- \`/petdex\` (no args) -> run \`${$1} toggle\`
|
|
366
|
-
- \`/petdex up\` -> run \`${$1} up\`
|
|
367
|
-
- \`/petdex down\` -> run \`${$1} down\`
|
|
368
|
-
- \`/petdex status\` -> run \`${$1} hooks status\`
|
|
369
|
-
- \`/petdex doctor\` -> run \`${$1} doctor\`
|
|
370
|
-
|
|
371
|
-
Show the command output verbatim to the user. Don't reinterpret, don't explain. The CLI's output is already user-facing.
|
|
372
|
-
|
|
373
|
-
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.
|
|
374
|
-
|
|
375
|
-
Arguments: \`{{args}}\`
|
|
376
|
-
"""
|
|
377
|
-
`,rY=nY.join(NH(),".gemini","antigravity","global_workflows","petdex.md")});import{spawnSync as PH}from"node:child_process";import{mkdir as vQ,readFile as kQ,rm as IH,stat as sY,writeFile as w8}from"node:fs/promises";import{homedir as CH}from"node:os";import o2 from"node:path";async function AH(){return Promise.all(H1.map(async(Q)=>({agent:Q,installed:await tY(Q.configDir)})))}async function tY(Q){try{return await sY(Q),!0}catch{return!1}}async function yQ(){B0(s.default.bgMagenta(s.default.white(" petdex hooks install ")));try{let{persistRunningBinary:W}=await Promise.resolve().then(() => (D8(),dY)),G=await W();if(!G.ok&&G.reason)i.warn(`Could not persist petdex binary (${G.reason}). Bubbles will be disabled.`)}catch(W){i.warn(`Could not persist petdex binary (${W.message}). Bubbles will be disabled.`)}let Q=await AH(),$=Q.some((W)=>W.installed);i.info($?"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:W,installed:G}of Q){let U=G?s.default.green("●"):s.default.dim("○"),z=G?s.default.dim("installed"):s.default.dim("not found");console.log(` ${U} ${s.default.bold(W.displayName)} ${z}`)}let q=await E7({message:"Which agents should drive the mascot?",options:Q.map(({agent:W,installed:G})=>({value:W.id,label:W.displayName,hint:G?"installed":"not installed yet"})),initialValues:Q.filter((W)=>W.installed).map((W)=>W.agent.id),required:!1});if(V1(q)||q.length===0)return d("No agents selected. Bye."),{installedAgents:[]};let J=[],Y=[],V=[],X=q,K=new Set(X);for(let W of X){let G=H1.find((U)=>U.id===W);if(!G)continue;try{if(await gQ(G,{installSlashCommand:DH(G,K)}),V.push(G.id),J.push(` ${s.default.green("✓")} ${s.default.bold(G.displayName)}`),G.postInstallChecks)try{let U=await G.postInstallChecks();if(U.length>0)Y.push({agent:G.displayName,notes:U})}catch{}}catch(U){J.push(` ${s.default.red("✗")} ${s.default.bold(G.displayName)} ${s.default.red(U instanceof Error?U.message:String(U))}`)}}b0(J.join(`
|
|
378
|
-
`),"Done");for(let{agent:W,notes:G}of Y)for(let U of G){let z=U.level==="action"?s.default.bgYellow(s.default.black(" action needed ")):U.level==="warn"?s.default.yellow("!"):s.default.cyan("i");if(i.warn(`${z} ${s.default.bold(W)}
|
|
379
|
-
${U.message}`),U.fix){let Z=await h8({message:U.fix.prompt,initialValue:!0});if(!V1(Z)&&Z){let H=await U.fix.apply();if(H.ok)i.info(`${s.default.green("✓")} ${H.message}`);else i.warn(`${s.default.red("✗")} ${H.message}`)}}}return{installedAgents:V}}function DH(Q,$){return Q.id!=="antigravity"&&!(Q.id==="gemini"&&$.has("antigravity"))}async function gQ(Q,$={}){await vQ(o2.dirname(Q.configFile),{recursive:!0});let q=Q.build();if(Q.id!=="antigravity")if($.installSlashCommand===!1)await l2(Q);else await aY(Q);if(Q.id==="opencode"){let K=await SQ(Q.configFile);return await w8(Q.configFile,q,"utf8"),{backupPath:K}}if(Q.id==="antigravity")return await EH(),{backupPath:null};let J=await EQ(Q.configFile);if(J.kind==="error")throw Error(`Refusing to overwrite ${Q.configFile}: ${J.message}.
|
|
380
|
-
Fix the file (or rename it) and run \`petdex hooks install\` again.`);let Y=J.kind==="ok"?await SQ(Q.configFile):null,V=J.kind==="ok"?J.value:{},X=wH(V,q);return await w8(Q.configFile,`${JSON.stringify(X,null,2)}
|
|
381
|
-
`,"utf8"),{backupPath:Y}}async function EQ(Q){let $;try{$=await kQ(Q,"utf8")}catch(q){let J=q.code;if(J==="ENOENT")return{kind:"missing"};return{kind:"error",message:`read failed (${J??q.name}): ${q.message}`}}try{return{kind:"ok",value:JSON.parse($)}}catch(q){return{kind:"error",message:`JSON parse failed: ${q.message}`}}}async function SQ(Q){if(!await tY(Q))return null;let $=new Date().toISOString().replace(/[:.]/g,"-"),q=`${Q}.${$}.bak`,J=await kQ(Q);return await w8(q,J),q}function wH(Q,$){let q={...Q},J=$.hooks??{},V={...q.hooks??{}};for(let[X,K]of Object.entries(J)){let G=(Array.isArray(V[X])?V[X]:[]).filter((U)=>!RH(U));V[X]=[...G,...K]}return q.hooks=V,q}function RH(Q){if(typeof Q!=="object"||Q==null)return!1;return xH(Q).some((q)=>q.includes(`localhost:${F8}/state`)||q.includes(r1))}function xH(Q){let $=[];function q(J){if(typeof J==="string"){$.push(J);return}if(Array.isArray(J)){for(let Y of J)q(Y);return}if(typeof J==="object"&&J!=null)for(let Y of Object.values(J))q(Y)}return q(Q),$}async function vH(){try{await sY(g0);let Q=PH(process.execPath,[g0,"mcp-server"],{encoding:"utf8",input:"",timeout:5000});return Q.status===0&&Q.stdout===""}catch{return!1}}async function EH(){if(await A8().catch(()=>{}),!await vH())throw Error(`Petdex persisted binary missing or not functional: ${g0}.
|
|
382
|
-
The mcp-server subcommand is required for Antigravity integration.
|
|
383
|
-
Run \`npx petdex@latest hooks install\` to persist a fresh binary, then re-run.`);let $=await WY();await vQ(o2.dirname($),{recursive:!0});let q=oY(),J=await SH($);if(J.kind==="error")throw Error(`Refusing to overwrite ${$}: ${J.message}.
|
|
384
|
-
Fix the file (or rename it) and run \`petdex hooks install\` again.`);if(J.kind==="ok")await SQ($);let Y=J.kind==="ok"?J.value:{},V=Y.mcpServers??{},X={...Y,mcpServers:{...V,...q.mcpServers}};await w8($,`${JSON.stringify(X,null,2)}
|
|
385
|
-
`,"utf8");let K=E1();await vQ(K,{recursive:!0}),await w8(o2.join(K,"SKILL.md"),lY(),"utf8"),await IH(TH,{recursive:!0,force:!0})}async function SH(Q){try{if((await kQ(Q,"utf8")).trim()==="")return{kind:"missing"}}catch{return EQ(Q)}return EQ(Q)}var s,TH;var _Q=H0(()=>{t1();L8();iY();D8();xQ();s=p0(R1(),1),TH=o2.join(CH(),".antigravity","skills","petdex")});var bQ={};E8(bQ,{runRefresh:()=>yH});import{existsSync as eY}from"node:fs";function kH(Q){return eY(Q.configFile)||eY(Q.slashCommandPath)}async function yH(){let Q={refreshed:[],skipped:[],binaryPersisted:!1};try{let $=await A8();if(Q.binaryPersisted=$.ok,!$.ok)Q.binaryReason=$.reason}catch($){Q.binaryReason=$.message}for(let $ of H1){if(!kH($)){Q.skipped.push({id:$.id,reason:"not installed"});continue}try{await gQ($),Q.refreshed.push($.id)}catch(q){Q.skipped.push({id:$.id,reason:q.message})}}return Q}var fQ=H0(()=>{L8();_Q();D8()});function tH(Q){let $=Q.toLowerCase();if($==="read")return"read";if($==="edit"||$==="multiedit")return"edit";if($==="write")return"write";if($==="bash"||$==="shell")return"bash";if($==="grep")return"grep";if($==="glob")return"glob";if($==="webfetch"||$==="websearch")return"webfetch";if($==="task"||$==="agent")return"task";return"unknown"}function q1(Q,$){if(Q==null||typeof Q!=="object")return null;let q=Q[$];return typeof q==="string"?q:null}function K3(Q){let $=Math.max(Q.lastIndexOf("/"),Q.lastIndexOf("\\"));return $>=0?Q.slice($+1):Q}function c0(Q,$=40){if(Q.length<=$)return Q;return`${Q.slice(0,$-1)}…`}function G3(Q){if(Q.kind==="session.start")return"Thinking…";if(Q.kind==="session.end")return"Done.";if(Q.kind==="session.waiting")return"Waiting for you…";let{toolName:$,phase:q,toolInput:J}=Q,Y=tH($),V=q==="done";switch(Y){case"read":{let X=q1(J,"file_path")??q1(J,"path"),K=X?c0(K3(X)):null;if(K)return V?`Read ${K}`:`Reading ${K}`;return V?"Read file":"Reading file"}case"edit":case"write":{let X=q1(J,"file_path")??q1(J,"path"),K=X?c0(K3(X)):null;if(K)return V?`Edited ${K}`:`Editing ${K}`;return V?"Edited file":"Editing file"}case"bash":{let X=q1(J,"command");if(X){let K=c0(X.split(/\s+/)[0]??X,24);return V?`Ran ${K}`:`Running ${K}`}return V?"Ran command":"Running command"}case"grep":{let X=q1(J,"pattern");if(X)return V?`Searched "${c0(X,28)}"`:`Searching "${c0(X,28)}"`;return V?"Searched files":"Searching files"}case"glob":{let X=q1(J,"pattern");if(X)return V?`Listed ${c0(X,28)}`:`Listing ${c0(X,28)}`;return V?"Listed files":"Listing files"}case"webfetch":{let X=q1(J,"url");if(X)try{let K=new URL(X).hostname;return V?`Fetched ${c0(K,28)}`:`Fetching ${c0(K,28)}`}catch{}return V?"Fetched web":"Searching web"}case"task":{let X=q1(J,"description")??q1(J,"subject");if(X)return V?"Subagent done":`Spawning ${c0(X,28)}`;return V?"Subagent done":"Spawning subagent"}default:{let X=c0($,28);return V?`Called ${X}`:`Calling ${X}`}}}var L3={};E8(L3,{stateForEvent:()=>z3,runBubble:()=>GF,eventFromArgs:()=>F3});import{existsSync as eH,readFileSync as QF}from"node:fs";import{homedir as $F}from"node:os";import{join as lQ}from"node:path";function z3(Q,$){let q=Q[0];if(q==="pre"){if($){let J=$.toLowerCase();if(J==="read"||J==="grep"||J==="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 XF(){if(process.stdin.isTTY)return"";return await new Promise((Q)=>{let $="",q=!1;process.stdin.setEncoding("utf8"),process.stdin.on("data",(J)=>{if(q)return;if($.length+J.length>W3){$+=J.slice(0,W3-$.length),q=!0;return}$+=J}),process.stdin.on("end",()=>Q($)),process.stdin.on("error",()=>Q($))})}function H3(Q){if(!Q.trim())return{toolName:null,toolInput:void 0,agentSource:null};try{let $=JSON.parse(Q),q=typeof $.tool_name==="string"?$.tool_name:null,J=$.tool_input,Y=typeof $.agent_source==="string"?$.agent_source:null;return{toolName:q,toolInput:J,agentSource:Y}}catch{return{toolName:null,toolInput:void 0,agentSource:null}}}function F3(Q,$){let q=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 J=q==="pre"?"running":q==="post"?"done":null;if(!J)return null;let{toolName:Y,toolInput:V}=H3($);if(!Y)return{kind:"tool",phase:J,toolName:"tool",toolInput:void 0};return{kind:"tool",phase:J,toolName:Y,toolInput:V}}function KF(){try{let Q=QF(qF,"utf8").trim();return Q.length>0?Q:null}catch{return null}}async function U3(Q,$,q){let J=new AbortController,Y=setTimeout(()=>J.abort(),300);try{await fetch(Q,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":q},body:JSON.stringify($),signal:J.signal})}catch{}finally{clearTimeout(Y)}}async function GF(Q){if(eH(JF))return;let $=Q[1]??null,q=await XF(),J=F3(Q,q);if(!J)return;let{toolName:Y,agentSource:V}=H3(q),X=V??$,K=G3(J),W=z3(Q,Y),G=KF();if(!G)return;let U=[];if(K)U.push(U3(YF,{text:K,agent_source:X},G));if(W)U.push(U3(VF,{state:W,agent_source:X},G));await Promise.all(U)}var j3,qF,JF,Z3="http://127.0.0.1:7777",YF,VF,W3=65536;var O3=H0(()=>{j3=lQ($F(),".petdex","runtime"),qF=lQ(j3,"update-token"),JF=lQ(j3,"hooks-disabled"),YF=`${Z3}/bubble`,VF=`${Z3}/state`});var I3={};E8(I3,{runMcpServer:()=>NF});import{readFile as B3}from"node:fs/promises";import{homedir as M3}from"node:os";import P3 from"node:path";async function HF(){try{return(await B3(jF,"utf8")).trim()}catch{return null}}async function FF(){try{return await B3(ZF),!0}catch{return!1}}async function N3(Q,$){let q=await HF();if(!q)return{ok:!1,status:0};try{let J=await fetch(Q,{method:"POST",headers:{"Content-Type":"application/json","X-Petdex-Update-Token":q},body:JSON.stringify($),signal:AbortSignal.timeout(300)});return{ok:J.ok,status:J.status}}catch{return{ok:!1,status:0}}}function _0(Q){let $=JSON.stringify(Q);if(oQ==="jsonl"){process.stdout.write(`${$}
|
|
386
|
-
`);return}let J=`Content-Length: ${new TextEncoder().encode($).length}\r
|
|
387
|
-
\r
|
|
388
|
-
`;process.stdout.write(J),process.stdout.write($)}function R8(Q,$,q){return{jsonrpc:"2.0",id:Q,error:{code:$,message:q}}}async function OF(Q){let{id:$,method:q,params:J}=Q;switch(q){case"initialize":{let Y=J?.protocolVersion??"2025-03-26";_0({jsonrpc:"2.0",id:$,result:{protocolVersion:Y,capabilities:{tools:{listChanged:!1}},serverInfo:{name:"petdex-mcp-server",version:zF}}});return}case"tools/list":{_0({jsonrpc:"2.0",id:$,result:{tools:LF}});return}case"tools/call":{let Y=J?.name,V=J?.arguments??{};if(await FF()){_0({jsonrpc:"2.0",id:$,result:{content:[{type:"text",text:"Petdex hooks are disabled. Run /petdex in your agent or `petdex hooks on` to re-enable."}]}});return}switch(Y){case"petdex_set_state":{let X=V.state;if(!X){_0(R8($,-32602,"Missing required argument: state"));return}let K={state:X,agent_source:"antigravity"};if(typeof V.duration==="number")K.duration=V.duration;let W=await N3(WF,K);_0({jsonrpc:"2.0",id:$,result:{content:[{type:"text",text:W.ok?`Pet state set to "${X}"`:"Sidecar unreachable — is petdex-desktop running?"}]}});return}case"petdex_show_bubble":{let X=V.text;if(!X){_0(R8($,-32602,"Missing required argument: text"));return}let K=await N3(UF,{text:X,agent_source:"antigravity"});_0({jsonrpc:"2.0",id:$,result:{content:[{type:"text",text:K.ok?`Bubble shown: "${X}"`:"Sidecar unreachable — is petdex-desktop running?"}]}});return}case"petdex_status":{let X=!1;try{X=(await fetch(`${nQ}/health`,{signal:AbortSignal.timeout(500)})).ok}catch{X=!1}_0({jsonrpc:"2.0",id:$,result:{content:[{type:"text",text:X?"Petdex desktop is reachable.":"Petdex desktop not detected. Start it with `petdex up`."}]}});return}default:{_0(R8($,-32601,`Unknown tool: ${Y}`));return}}}case"notifications/initialized":return;default:_0(R8($,-32601,`Unknown method: ${q}`))}}async function NF(){let Q=new Uint8Array(0),$=0,q=!1,J=new TextDecoder;function Y(){if($===0)process.exit(0)}process.stdin.on("data",(X)=>{let K=typeof X==="string"?new TextEncoder().encode(X):X,W=new Uint8Array(Q.length+K.length);W.set(Q),W.set(K,Q.length),Q=W;while(!0){let G=MF(Q);if(G===123||G===91){let B=iQ(Q,new Uint8Array([10]));if(B===-1)break;let O=PF(Q.slice(0,B));Q=Q.slice(B+1);let M=J.decode(O).trim();if(!M)continue;oQ="jsonl",V(M);continue}let U=BF(Q),z=U.index;if(z===-1)break;let Z=Q.slice(0,z),F=J.decode(Z).match(/Content-Length:\s*(\d+)/i);if(!F){Q=Q.slice(z+U.length);continue}let N=parseInt(F[1],10),C=z+U.length,P=C+N;if(Q.length<P)break;let L=Q.slice(C,P),A=J.decode(L);Q=Q.slice(P),oQ="framed",V(A)}}),process.stdin.on("end",()=>{q=!0,Y(),setTimeout(()=>process.exit(0),3000).unref()});function V(X){try{let K=JSON.parse(X);$++,OF(K).catch((W)=>{_0(R8(K.id,-32603,`Internal error: ${W.message}`))}).finally(()=>{if($--,q)Y()})}catch(K){_0({jsonrpc:"2.0",id:null,error:{code:-32700,message:`Parse error: ${K.message}`}})}}}function iQ(Q,$){Q:for(let q=0;q<=Q.length-$.length;q++){for(let J=0;J<$.length;J++)if(Q[q+J]!==$[J])continue Q;return q}return-1}function BF(Q){let $=iQ(Q,new Uint8Array([13,10,13,10]));if($!==-1)return{index:$,length:4};let q=iQ(Q,new Uint8Array([10,10]));if(q!==-1)return{index:q,length:2};return{index:-1,length:0}}function MF(Q){for(let $ of Q)if($!==32&&$!==9&&$!==10&&$!==13)return $;return null}function PF(Q){if(Q.at(-1)===13)return Q.slice(0,-1);return Q}var nQ="http://127.0.0.1:7777",WF,UF,jF,ZF,zF="0.1.0",oQ="framed",LF;var C3=H0(()=>{WF=`${nQ}/state`,UF=`${nQ}/bubble`,jF=P3.join(M3(),".petdex","runtime","update-token"),ZF=P3.join(M3(),".petdex","runtime","hooks-disabled");LF=[{name:"petdex_set_state",description:"Set the pet's animation state. Call this before/after tool use to reflect agent activity.",inputSchema:{type:"object",properties:{state:{type:"string",description:"Animation state: idle, running, running-left, running-right, waving, jumping, failed, review, waiting",enum:["idle","running","running-left","running-right","waving","jumping","failed","review","waiting"]},duration:{type:"number",description:"Optional duration in ms to hold this state"}},required:["state"]}},{name:"petdex_show_bubble",description:"Show a speech bubble above the pet with the given text. Use to display what the agent is currently doing.",inputSchema:{type:"object",properties:{text:{type:"string",description:"The bubble text to display (e.g. 'Reading server.ts')"}},required:["text"]}},{name:"petdex_status",description:"Check if the petdex desktop mascot is reachable. Returns connection status.",inputSchema:{type:"object",properties:{}}}]});t1();var sQ=p0(uJ(),1),j=p0(R1(),1);import{existsSync as T3}from"node:fs";import{mkdir as A3,readdir as IF,readFile as aQ,stat as S3,writeFile as n2}from"node:fs/promises";import{homedir as D3}from"node:os";import Z0 from"node:path";import{spawn as rZ}from"node:child_process";import{createServer as _Z}from"node:http";class h extends Error{code;constructor(Q,$){super($);this.name="ClerkCliAuthError",this.code=Q}}var bZ=`<!doctype html>
|
|
34
|
+
`}}}}).prompt()};var i=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${R("gray",y$)} `:"";J.write(`${q}${R("red",$)}
|
|
35
|
+
|
|
36
|
+
`)},h$=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${R("gray",rq)} `:"";J.write(`${q}${$}
|
|
37
|
+
`)},u1=($="",Q)=>{let J=Q?.output??process.stdout,q=Q?.withGuide??n.withGuide?`${R("gray",c)}
|
|
38
|
+
${R("gray",y$)} `:"";J.write(`${q}${$}
|
|
39
|
+
|
|
40
|
+
`)};var JY=($)=>R("dim",$),qY=($,Q,J)=>{let q={hard:!0,trim:!1},Y=N0($,Q,q).split(`
|
|
41
|
+
`),G=Y.reduce((U,X)=>Math.max($0(X),U),0),V=Y.map(J).reduce((U,X)=>Math.max($0(X),U),0),K=Q-(V-G);return N0($,K,q)},d1=($="",Q="",J)=>{let q=J?.output??U0.stdout,Y=J?.withGuide??n.withGuide,G=J?.format??JY,V=["",...qY($,m1(q)-6,G).split(`
|
|
42
|
+
`).map(G),""],K=$0(Q),U=Math.max(V.reduce((j,F)=>{let Z=$0(F);return Z>j?Z:j},0),K)+2,X=V.map((j)=>`${R("gray",c)} ${j}${" ".repeat(U-$0(j))}${R("gray",c)}`).join(`
|
|
43
|
+
`),W=Y?`${R("gray",c)}
|
|
44
|
+
`:"",H=Y?sq:eq;q.write(`${W}${R("green",J8)} ${R("reset",Q)} ${R("gray",RQ.repeat(Math.max(U-K-1,1))+aq)}
|
|
45
|
+
${X}
|
|
46
|
+
${R("gray",H+RQ.repeat(U+2)+tq)}
|
|
47
|
+
`)};var YY=($)=>R("magenta",$),s0=({indicator:$="dots",onCancel:Q,output:J=process.stdout,cancelMessage:q,errorMessage:Y,frames:G=$8?["◒","◐","◓","◑"]:["•","o","O","0"],delay:V=$8?80:120,signal:K,...U}={})=>{let X=iq(),W,H,j=!1,F=!1,Z="",L,N=performance.now(),I=m1(J),P=U?.styleFrame??YY,B=(y)=>{let e=y>1?Y??n.messages.error:q??n.messages.cancel;F=y===1,j&&(X0(e,y),F&&typeof Q=="function"&&Q())},M=()=>B(2),z=()=>B(1),D=()=>{process.on("uncaughtExceptionMonitor",M),process.on("unhandledRejection",M),process.on("SIGINT",z),process.on("SIGTERM",z),process.on("exit",B),K&&K.addEventListener("abort",z)},w=()=>{process.removeListener("uncaughtExceptionMonitor",M),process.removeListener("unhandledRejection",M),process.removeListener("SIGINT",z),process.removeListener("SIGTERM",z),process.removeListener("exit",B),K&&K.removeEventListener("abort",z)},v=()=>{if(L===void 0)return;X&&J.write(`
|
|
48
|
+
`);let y=N0(L,I,{hard:!0,trim:!1}).split(`
|
|
49
|
+
`);y.length>1&&J.write(p1.cursor.up(y.length-1)),J.write(p1.cursor.to(0)),J.write(p1.erase.down())},k=(y)=>y.replace(/\.+$/,""),E=(y)=>{let e=(performance.now()-y)/1000,W0=Math.floor(e/60),q0=Math.floor(e%60);return W0>0?`[${W0}m ${q0}s]`:`[${q0}s]`},A=U.withGuide??n.withGuide,o=(y="")=>{j=!0,W=DQ({output:J}),Z=k(y),N=performance.now(),A&&J.write(`${R("gray",c)}
|
|
50
|
+
`);let e=0,W0=0;D(),H=setInterval(()=>{if(X&&Z===L)return;v(),L=Z;let q0=P(G[e]),E0;if(X)E0=`${q0} ${Z}...`;else if($==="timer")E0=`${q0} ${Z} ${E(N)}`;else{let Vq=".".repeat(Math.floor(W0)).slice(0,3);E0=`${q0} ${Z}${Vq}`}let Gq=N0(E0,I,{hard:!0,trim:!1});J.write(Gq),e=e+1<G.length?e+1:0,W0=W0<4?W0+0.125:0},V)},X0=(y="",e=0,W0=!1)=>{if(!j)return;j=!1,clearInterval(H),v();let q0=e===0?R("green",J8):e===1?R("red",EQ):R("red",xQ);Z=y??Z,W0||($==="timer"?J.write(`${q0} ${Z} ${E(N)}
|
|
51
|
+
`):J.write(`${q0} ${Z}
|
|
52
|
+
`)),w(),W()};return{start:o,stop:(y="")=>X0(y,0),message:(y="")=>{Z=k(y??Z)},cancel:(y="")=>X0(y,1),error:(y="")=>X0(y,2),clear:()=>X0("",0,!0),get isCancelled(){return F}}},NH={light:T("─","-"),heavy:T("━","="),block:T("█","#")};var g$=($,Q)=>$.includes(`
|
|
53
|
+
`)?$.split(`
|
|
54
|
+
`).map((J)=>Q(J)).join(`
|
|
55
|
+
`):Q($),TQ=($)=>{let Q=(J,q)=>{let Y=J.label??String(J.value);switch(q){case"disabled":return`${R("gray",T$)} ${g$(Y,(G)=>R("gray",G))}${J.hint?` ${R("dim",`(${J.hint??"disabled"})`)}`:""}`;case"selected":return`${g$(Y,(G)=>R("dim",G))}`;case"active":return`${R("green",Q8)} ${Y}${J.hint?` ${R("dim",`(${J.hint})`)}`:""}`;case"cancelled":return`${g$(Y,(G)=>R(["strikethrough","dim"],G))}`;default:return`${R("dim",T$)} ${g$(Y,(G)=>R("dim",G))}`}};return new e6({options:$.options,signal:$.signal,input:$.input,output:$.output,initialValue:$.initialValue,render(){let J=$.withGuide??n.withGuide,q=`${SQ(this.state)} `,Y=`${$Y(this.state)} `,G=c1($.output,$.message,Y,q),V=`${J?`${R("gray",c)}
|
|
56
|
+
`:""}${G}
|
|
57
|
+
`;switch(this.state){case"submit":{let K=J?`${R("gray",c)} `:"",U=c1($.output,Q(this.options[this.cursor],"selected"),K);return`${V}${U}`}case"cancel":{let K=J?`${R("gray",c)} `:"",U=c1($.output,Q(this.options[this.cursor],"cancelled"),K);return`${V}${U}${J?`
|
|
58
|
+
${R("gray",c)}`:""}`}default:{let K=J?`${R("cyan",c)} `:"",U=J?R("cyan",y$):"",X=V.split(`
|
|
59
|
+
`).length,W=J?2:1;return`${V}${K}${QY({output:$.output,cursor:this.cursor,options:this.options,maxItems:$.maxItems,columnPadding:K.length,rowPadding:X+W,style:(H,j)=>Q(H,H.disabled?"disabled":j?"active":"inactive")}).join(`
|
|
60
|
+
${K}`)}
|
|
61
|
+
${U}
|
|
62
|
+
`}}}}).prompt()};var BH=`${R("gray",c)} `;var QQ=R$(lJ(),1),O=R$(nJ(),1);var rJ={name:"petdex",version:"1.0.0",description:"CLI for Petdex. Install, browse, and submit Codex pets from your terminal.",homepage:"https://petdex.dev",repository:{type:"git",url:"git+https://github.com/crafter-station/petdex.git",directory:"packages/petdex-cli"},license:"MIT",type:"module",engines:{node:">=20"},bin:{petdex:"dist/petdex.js"},files:["dist","README.md"],scripts:{build:"bun build ./bin/petdex.ts --target=node --outfile=./dist/petdex.js --minify --external @napi-rs/keyring",postbuild:`node -e 'const f="./dist/petdex.js";const fs=require("fs");const c=fs.readFileSync(f,"utf8");if(!c.startsWith("#!")){fs.writeFileSync(f,"#!/usr/bin/env node\\n"+c)}fs.chmodSync(f,0o755)'`,typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"^1.3.0",jszip:"^3.10.1",picocolors:"^1.1.1"},optionalDependencies:{"@napi-rs/keyring":"^1.1.6"},devDependencies:{"@types/node":"^26.0.0","bun-types":"^1.3.13",typescript:"^7.0.2"}};var qU=new Set(["assets.petdex.dev"]);function u5($){try{let Q=new URL($);if(Q.protocol!=="https:")return!1;return qU.has(Q.hostname)}catch{return!1}}import{spawn as LU}from"node:child_process";import{createServer as YU}from"node:http";class h extends Error{code;constructor($,Q){super(Q);this.name="ClerkCliAuthError",this.code=$}}var GU=`<!doctype html>
|
|
389
63
|
<html>
|
|
390
64
|
<head><meta charset="utf-8"><title>Authentication complete</title></head>
|
|
391
65
|
<body><h1>Authentication complete</h1><p>You can close this tab and return to your terminal.</p></body>
|
|
392
|
-
</html>`,
|
|
66
|
+
</html>`,VU=`<!doctype html>
|
|
393
67
|
<html>
|
|
394
68
|
<head><meta charset="utf-8"><title>Authentication failed</title></head>
|
|
395
69
|
<body><h1>Authentication failed</h1><p>You can close this tab and return to your terminal.</p></body>
|
|
396
|
-
</html>`;function
|
|
397
|
-
`,{mode:384}),await
|
|
398
|
-
${
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
`,{mode:384});else try{Gz($)}catch{}return Q}function zY(){return A6(T6()==="on"?"off":"on")}import{randomBytes as LY}from"node:crypto";import{existsSync as HQ,statSync as jz}from"node:fs";import{chmod as Zz,mkdir as D6,rename as N8,rm as e0,writeFile as _2}from"node:fs/promises";import{homedir as b2,arch as zz,platform as w6}from"node:os";import Q0 from"node:path";t1();var o=p0(R1(),1),Hz="https://api.github.com/repos/crafter-station/petdex/releases",HY=30,Fz=5,FY="desktop-v",OY="petdex-desktop-sidecar.js";function FQ(){let Q=w6(),$=zz(),q=Q==="darwin"?"darwin":Q==="linux"?"linux":Q==="win32"?"win32":Q,J=$==="arm64"?"arm64":$==="x64"?"x64":$;return{osLabel:q,archLabel:J,assetSuffix:`${q}-${J}`}}function k0(){let Q=w6()==="win32"?".exe":"";if(w6()==="darwin"){let $=C0(),q=["/Applications/Petdex.app/Contents/MacOS/petdex-desktop",Q0.join($,"Applications","Petdex.app","Contents","MacOS","petdex-desktop")];for(let J of q)if(HQ(J))return J}return Q0.join(b2(),".petdex","bin",`petdex-desktop${Q}`)}function f2(){if(w6()==="darwin"){let Q=C0(),$=["/Applications/Petdex.app/Contents/Resources/sidecar/server.js",Q0.join(Q,"Applications","Petdex.app","Contents","Resources","sidecar","server.js")];for(let q of $)if(HQ(q))return q}return Q0.join(b2(),".petdex","sidecar","server.js")}async function LQ(Q={}){let $=Q.fetchOverride??fetch,q=Q.maxPages??Fz,J=0;for(let Y=1;Y<=q;Y++){let V=`${Hz}?per_page=${HY}&page=${Y}`,X=await $(V,{headers:{Accept:"application/vnd.github+json"}});if(!X.ok)throw Error(`GitHub API ${X.status}`);let K=await X.json();if(!Array.isArray(K)||K.length===0)break;J+=K.length;let W=K.find((G)=>!G.draft&&!G.prerelease&&typeof G.tag_name==="string"&&G.tag_name.startsWith(FY));if(W)return W;if(K.length<HY)break}throw Error(`No ${FY}* release found in the last ${J} releases (scanned ${q} page(s))`)}function Lz(Q){return Q.assets.find(($)=>$.name===OY)??null}function h2(Q,$=FQ()){let q=`petdex-desktop-${$.assetSuffix}`,J=Q.assets.find((Y)=>Y.name===q)??Q.assets.find((Y)=>Y.name.startsWith(q));if(J)return{kind:"bare",target:$,binAsset:J,sidecarAsset:Lz(Q)};if($.osLabel==="darwin"){let Y=NY(Q,$.archLabel);if(Y)return{kind:"macos-dmg",target:$,dmgAsset:Y}}if($.osLabel==="linux")return{kind:"unsupported",target:$,reason:`No Linux desktop binary for ${$.archLabel} in ${Q.tag_name}.`,hint:"Hooks-only setup still works on Linux: run `petdex hooks install`. Desktop Linux support is tracked in issue #296."};return{kind:"unsupported",target:$,reason:`No desktop binary for ${$.assetSuffix} in ${Q.tag_name}.`,hint:"Run `petdex hooks install` for hooks-only setup, or download a supported desktop build from https://petdex.dev/download."}}function m2(Q){if(Q.kind!=="unsupported")return Error("Desktop install plan is supported");return Error(`${Q.reason}
|
|
402
|
-
${Q.hint}`)}function NY(Q,$){let q=`Petdex-${$}.dmg`;return Q.assets.find((J)=>J.name===q)??null}function BY(Q){let q=Q.indexOf("/Contents/MacOS/");if(q===-1)return null;return Q.slice(0,q)}async function zQ(Q,$,q){let J=await fetch(Q);if(!J.ok||!J.body)throw Error(`download ${Q} → ${J.status}`);let Y=Buffer.from(await J.arrayBuffer()),V=`${$}.tmp`;try{if(await _2(V,Y),q!==void 0)await Zz(V,q);if(w6()==="darwin")try{let{spawnSync:X}=await import("node:child_process");X("xattr",["-d","com.apple.quarantine",V],{stdio:"ignore"})}catch{}return{tmpPath:V,destPath:$}}catch(X){try{await e0(V,{force:!0})}catch{}throw X}}async function Oz(Q){let $=[];for(let q of Q){let J=null;try{let Y=`${q.destPath}.prev`;try{await N8(q.destPath,Y),J=Y}catch(V){if(V.code!=="ENOENT")throw V}await N8(q.tmpPath,q.destPath),$.push({dest:q.destPath,backup:J})}catch(Y){if(J)try{await e0(q.destPath,{force:!0}),await N8(J,q.destPath)}catch{}for(let V of $.reverse())try{if(V.backup)await e0(V.dest,{force:!0}),await N8(V.backup,V.dest);else await e0(V.dest,{force:!0})}catch{}for(let V of Q)try{await e0(V.tmpPath,{force:!0})}catch{}throw Y}}for(let q of $){if(!q.backup)continue;try{await e0(q.backup,{force:!0})}catch{}}}async function OQ(Q){let $=h2(Q);if($.kind==="unsupported")throw m2($);if($.kind==="macos-dmg")throw Error(`No bare desktop binary for ${$.target.assetSuffix} in ${Q.tag_name}. Use the DMG install path instead.`);let{binAsset:q,sidecarAsset:J}=$,Y=k0(),V=f2();await D6(Q0.dirname(Y),{recursive:!0}),await D6(Q0.dirname(V),{recursive:!0});let X=[];try{if(X.push(await zQ(q.browser_download_url,Y,493)),J)X.push(await zQ(J.browser_download_url,V))}catch(K){for(let W of X)try{await e0(W.tmpPath,{force:!0})}catch{}throw K}return{binAsset:q,sidecarAsset:J,staged:X}}async function NQ(Q){await Oz(Q.staged)}async function Nz(Q){let $=await OQ(Q);return await NQ($),{binAsset:$.binAsset,sidecarAsset:$.sidecarAsset}}async function BQ(Q,$){let q=FQ(),J=NY(Q,q.archLabel);if(!J)throw Error(`No DMG asset (Petdex-${q.archLabel}.dmg) in ${Q.tag_name}. App-bundle update requires a DMG; falling back is not safe.`);let{join:Y}=await import("node:path"),{tmpdir:V}=await import("node:os"),X=Y(V(),`petdex-${LY(8).toString("hex")}-${J.name}`),K=await zQ(J.browser_download_url,X),{rename:W}=await import("node:fs/promises");await W(K.tmpPath,X);let{spawnSync:G}=await import("node:child_process"),U=G("hdiutil",["attach","-nobrowse","-quiet",X],{encoding:"utf8"});if(U.status!==0)throw Error(`hdiutil attach failed (exit ${U.status}): ${U.stderr||U.stdout||"no output"}`);let z=Bz(U.stdout)??"/Volumes/Petdex";try{let Z=`${z}/Petdex.app`,{existsSync:H}=await import("node:fs");if(!H(Z))throw Error(`mounted DMG at ${z} does not contain Petdex.app — is the release shape unchanged?`);let F=G("ditto",[Z,$],{encoding:"utf8"});if(F.status!==0)throw Error(`ditto failed (exit ${F.status}): ${F.stderr||F.stdout||"no output"}`);G("xattr",["-dr","com.apple.quarantine",$],{encoding:"utf8"})}finally{G("hdiutil",["detach","-quiet",z],{encoding:"utf8"});try{await e0(X,{force:!0})}catch{}}return{appBundleRoot:$,dmgAsset:J}}function c2(){return Q0.join(C0(),"Applications","Petdex.app")}async function MQ(Q,$=c2()){return await D6(Q0.dirname($),{recursive:!0}),BQ(Q,$)}function Bz(Q){let $=Q.split(`
|
|
403
|
-
`),q=null;for(let J of $){let Y=J.indexOf("/Volumes/");if(Y===-1)continue;let V=J.slice(Y).trim();if(!q||V.length>q.length)q=V}return q}var Mz="boba",Pz=process.env.PETDEX_URL??"https://petdex.dev",Iz=new Set(["assets.petdex.dev"]);function B8(Q){try{let $=new URL(Q);if($.protocol!=="https:")return!1;return Iz.has($.hostname)}catch{return!1}}function C0(){if(w6()==="win32")return process.env.USERPROFILE??process.env.HOME??b2();return process.env.HOME??process.env.USERPROFILE??b2()}function MY(){return Q0.join(C0(),".petdex","pets")}function PY(){return Q0.join(C0(),".codex","pets")}var Cz=16777216;function PQ(Q){for(let $ of["spritesheet.webp","spritesheet.png"]){let q=Q0.join(Q,$);try{let J=jz(q);if(J.isFile()&&J.size>0&&J.size<=Cz)return!0}catch{}}return!1}async function Tz(){let{readdir:Q}=await import("node:fs/promises");for(let $ of[MY(),PY()]){let q;try{q=await Q($)}catch{continue}for(let J of q)if(PQ(Q0.join($,J)))return!0}return!1}async function IQ(){if(await Tz())return{status:"present"};let Q=await Az();return Q?{status:"installed",slug:Q}:{status:"missing"}}async function Az(Q={}){let $=Q.fetchOverride??fetch,q=Q.petdexUrl??Pz,J=`${q.replace(/\/+$/,"")}/`,Y;try{let W=await $(`${q}/api/manifest`,{signal:AbortSignal.timeout(8000)});if(!W.ok)return null;let G=await W.json();Y=Array.isArray(G?.pets)?G.pets:[]}catch{return null}if(Y.length===0)return null;let V=[],X=new Set,K=Y.find((W)=>W.slug===Mz);if(K)V.push(K),X.add(K.slug);for(let W of Y)if(!X.has(W.slug))V.push(W),X.add(W.slug);for(let W of V){let G=await Dz(W,$,J);if(G)return G}return null}async function Dz(Q,$,q){if(!B8(Q.spritesheetUrl)||!B8(Q.petJsonUrl))return null;let J=Q.spritesheetUrl.endsWith(".png")?"png":"webp",Y=[Q0.join(MY(),Q.slug),Q0.join(PY(),Q.slug)];for(let U of Y)if(HQ(U))return null;let V=async(U)=>{let z=await $(U,{headers:{Referer:q},signal:AbortSignal.timeout(15000)});if(!z.ok)throw Error(`download ${U} → ${z.status}`);return z.arrayBuffer()},X,K;try{[X,K]=await Promise.all([V(Q.petJsonUrl),V(Q.spritesheetUrl)])}catch{return null}let W=[],G=[];try{for(let U of Y){let z=`${U}.partial-${LY(6).toString("hex")}`;await D6(z,{recursive:!0}),W.push(z),await Promise.all([_2(Q0.join(z,"pet.json"),Buffer.from(X)),_2(Q0.join(z,`spritesheet.${J}`),Buffer.from(K))]),await D6(Q0.dirname(U),{recursive:!0}),await N8(z,U),W.pop(),G.push(U)}return Q.slug}catch{return await Promise.all([...W.map((U)=>e0(U,{recursive:!0,force:!0})),...G.map((U)=>e0(U,{recursive:!0,force:!0}))]),null}}async function CQ(){B0(o.default.bgMagenta(o.default.white(" petdex install desktop ")));let Q=FQ();i.info(`Platform: ${o.default.cyan(`${Q.osLabel} ${Q.archLabel}`)}`);let $=U0();$.start("Looking up the latest release");let q;try{q=await LQ()}catch(W){throw $.stop(o.default.red("failed")),Error(`Could not reach GitHub. Check your connection.
|
|
404
|
-
${W.message}`)}$.stop(`${o.default.green("✓")} Latest: ${o.default.bold(q.tag_name)}`);let J=h2(q);if(J.kind==="unsupported")throw m2(J);if(J.kind==="bare"){let W=U0();W.start("Downloading desktop binary and sidecar");let G;try{G=await Nz(q)}catch(Z){throw W.stop(o.default.red("failed")),Z}let U=k0(),z=G.sidecarAsset?`
|
|
405
|
-
${o.default.dim("•")} Sidecar at ${o.default.cyan(ZQ(f2()))} (${jQ(G.sidecarAsset.size)})`:`
|
|
406
|
-
${o.default.yellow("!")} No sidecar in this release. Hooks won't reach the mascot until a release ships ${OY}.`;W.stop(`${o.default.green("✓")} Binary at ${o.default.cyan(ZQ(U))} (${jQ(G.binAsset.size)})${z}`)}else{let W=U0();W.start("Installing macOS app from DMG");try{await MQ(q)}catch(G){throw W.stop(o.default.red("failed")),G}W.stop(`${o.default.green("✓")} App at ${o.default.cyan(ZQ(c2()))} (${jQ(J.dmgAsset.size)})`)}let Y=Q0.join(C0(),".petdex","version");await D6(Q0.dirname(Y),{recursive:!0}),await _2(Y,`${q.tag_name}
|
|
407
|
-
`);let V=U0();V.start("Checking starter pet");let X=await IQ();if(X.status==="installed")V.stop(`${o.default.green("✓")} Starter pet: ${o.default.bold(X.slug)}`);else if(X.status==="present")V.stop(`${o.default.green("✓")} Pet library ready`);else V.stop(`${o.default.yellow("!")} Could not download a starter pet. Run \`petdex install <slug>\` before \`petdex desktop start\`.`);let K=["Run it with:",` ${o.default.cyan("petdex desktop start")}`,"","Or wire it into your coding agents:",` ${o.default.cyan("petdex hooks install")}`];return b0(K.join(`
|
|
408
|
-
`),"Next"),R0(`${o.default.green("✓")} ${q.tag_name}`),{tag:q.tag_name}}function jQ(Q){if(Q<1024)return`${Q} B`;if(Q<1048576)return`${(Q/1024).toFixed(1)} KB`;return`${(Q/1024/1024).toFixed(1)} MB`}function ZQ(Q){let $=C0();if(Q.startsWith($))return`~${Q.slice($.length)}`;return Q}function M8(){return process.env.HOME??Rz()}function xz(){return S1.join(M8(),".petdex","runtime","update-token")}function vz(){return S1.join(M8(),".petdex","desktop.pid")}function Ez(){let Q=k0();if(!O0(Q))return{status:"fail",label:"Desktop binary",detail:`not found at ${Q}`,hint:"Run `petdex install desktop` to download it."};try{if(!(TQ(Q).mode&73))return{status:"fail",label:"Desktop binary",detail:`${Q} exists but is not executable`,hint:`chmod +x ${Q}`}}catch{return{status:"fail",label:"Desktop binary",detail:`${Q} unreadable`,hint:"Reinstall: `petdex install desktop`"}}return{status:"ok",label:"Desktop binary",detail:Q}}function Sz(){let Q=f2();if(!O0(Q))return{status:"fail",label:"Sidecar bundle",detail:`not found at ${Q}`,hint:"Reinstall: `petdex install desktop`"};return{status:"ok",label:"Sidecar bundle",detail:Q}}async function kz(){try{let Q=await fetch("http://127.0.0.1:7777/health",{signal:AbortSignal.timeout(500)});if(!Q.ok)return{status:"warn",label:"Sidecar reachable",detail:`:7777 responded ${Q.status}`,hint:"Restart: `petdex desktop stop && petdex desktop start`"};let $=await Q.json().catch(()=>null);if($?.ok&&$?.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 yz(){let Q=vz();if(!O0(Q))return{status:"info",label:"PID file",detail:"not present (desktop not running)"};let $;try{$=u2(Q,"utf8").trim()}catch{return{status:"warn",label:"PID file",detail:`unreadable at ${Q}`,hint:`Delete it: rm ${Q}`}}if(!$.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($);if(typeof q.pid!=="number"||typeof q.lstart!=="string")return{status:"warn",label:"PID file",detail:"unexpected JSON shape",hint:`Delete it: rm ${Q}`};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 ${Q}`}}}function gz(){let Q=xz();if(!O0(Q))return{status:"info",label:"Update token",detail:"absent (will be created when sidecar starts)"};try{if(u2(Q,"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 J=TQ(Q).mode&511;if(J!==384)return{status:"warn",label:"Update token",detail:`present, mode ${J.toString(8)} (expected 600)`,hint:`chmod 600 ${Q}`};return{status:"ok",label:"Update token",detail:"present, mode 600"}}catch($){return{status:"warn",label:"Update token",detail:`read failed: ${$.message}`}}}function _z(){if(T6()==="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 bz(){let Q=[];for(let $ of H1){let q=$.id==="antigravity"?(()=>{let X=v1(),[K]=X;return X.find((W)=>O0(W))??K})():$.configFile,J=O0(q),Y=O0($.slashCommandPath);if(!fz($)){Q.push({status:"info",label:$.displayName,detail:"not installed on this machine"});continue}let V=!1;if(J)try{let X=u2(q,"utf8");if($.id==="antigravity")V=X.includes('"petdex"')||X.includes("petdex");else V=X.includes("127.0.0.1:7777/state")||X.includes("/state")}catch{V=!1}if(!V){Q.push({status:"warn",label:$.displayName,detail:"petdex hook NOT detected",hint:"Run `petdex hooks install`"});continue}if($.id==="antigravity"){let X=O0(E1());Q.push({status:X?"ok":"warn",label:$.displayName,detail:X?"MCP server + Skill installed":"MCP server configured, but Skill not found",hint:X?void 0:"Re-run `petdex hooks install` to install the Agent Skill."});continue}if(!Y){Q.push({status:"warn",label:$.displayName,detail:"hook installed, but /petdex slash command missing",hint:"Re-run `petdex hooks install` to add the slash command."});continue}Q.push({status:"ok",label:$.displayName,detail:"hooks + /petdex installed"})}return Q}function fz(Q){if(Q.id!=="antigravity")return O0(Q.configDir);return v1().some(($)=>O0(S1.dirname($)))||O0(E1())}function hz(){let Q=S1.join(M8(),".codex","config.toml");if(!O0(Q))return{status:"info",label:"Codex hooks flag",detail:"config.toml absent (Codex not installed?)"};try{let $=u2(Q,"utf8");if(/\[features\][\s\S]*?(?:^|\n)\s*(?:codex_)?hooks\s*=\s*true/.test($))return{status:"ok",label:"Codex hooks flag",detail:"[features] hooks = true"};return{status:"warn",label:"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 hooks flag",detail:"config.toml unreadable"}}}function mz(){let Q=[S1.join(M8(),".petdex","pets"),S1.join(M8(),".codex","pets")],$=0;for(let q of Q){if(!O0(q))continue;try{let{readdirSync:J}=f("node:fs"),Y=J(q);for(let V of Y){let X=S1.join(q,V);for(let K of["spritesheet.webp","spritesheet.png"]){let W=S1.join(X,K);if(!O0(W))continue;try{let G=TQ(W);if(G.size>0&&G.size<=16777216){$+=1;break}}catch{}}}}catch{}}if($===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:`${$} usable spritesheet(s) on disk`}}function cz(Q){switch(Q){case"ok":return L0.default.green("✓");case"warn":return L0.default.yellow("!");case"fail":return L0.default.red("✗");case"info":return L0.default.dim("○")}}function y0(Q){let $=Q.detail?` ${L0.default.dim(Q.detail)}`:"";if(console.log(` ${cz(Q.status)} ${L0.default.bold(Q.label)}${$}`),Q.hint)console.log(` ${L0.default.cyan("→")} ${Q.hint}`)}async function IY(){console.log(L0.default.bgMagenta(L0.default.white(" petdex doctor "))),console.log(""),console.log(L0.default.bold("Install")),y0(Ez()),y0(Sz()),y0(mz()),console.log(""),console.log(L0.default.bold("Runtime")),y0(await kz()),y0(yz()),y0(gz()),y0(_z()),console.log(""),console.log(L0.default.bold("Agents"));for(let $ of bz())y0($);y0(hz()),console.log(""),console.log(L0.default.bold("Network"));let Q=null;try{Q=wz("lsof -nP -iTCP:7777 -sTCP:LISTEN 2>/dev/null || true",{encoding:"utf8"}).trim()}catch{Q=null}if(Q===null)y0({status:"info",label:":7777 listener",detail:"lsof unavailable"});else if(Q.length===0)y0({status:"info",label:":7777 listener",detail:"nothing bound (sidecar offline)"});else{let $=Q.split(`
|
|
409
|
-
`).length-1;y0({status:$===1?"ok":"warn",label:":7777 listener",detail:$===1?"1 process bound":`${$} processes bound`,hint:$>1?"Multiple sidecars contending for the same port. Stop both and start fresh.":void 0})}console.log("")}var N0=p0(R1(),1);import{execFileSync as C8,spawn as uz}from"node:child_process";import{existsSync as CY,openSync as pz,readFileSync as dz,unlinkSync as lz}from"node:fs";import{mkdir as oz,writeFile as iz}from"node:fs/promises";import F1 from"node:path";function I8(){return F1.join(C0(),".petdex","desktop.pid")}function TY(){return F1.join(C0(),".petdex","desktop.log")}function AY(){if(!CY(I8()))return null;let Q;try{Q=dz(I8(),"utf8").trim()}catch{return null}if(Q.startsWith("{")){try{let q=JSON.parse(Q);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 $=Number(Q);if(Number.isFinite($)&&$>0)return{pid:$,lstart:""};return null}function DY(Q){if(process.platform==="win32")return null;try{let q=C8("ps",["-p",String(Q),"-o","lstart="],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return q.length>0?q:null}catch{return null}}function wY(Q){try{let q=C8("tasklist",["/fi",`PID eq ${Q}`,"/fo","csv","/nh"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).match(/^"([^"]+)"/m);return q?q[1].toLowerCase():null}catch{return null}}function nz(Q){if(process.platform==="win32")return F1.basename(k0()).toLowerCase();return DY(Q)??""}function AQ(Q){if(process.platform==="win32")return wY(Q)!==null;try{return C8("ps",["-p",String(Q)],{stdio:["ignore","ignore","ignore"]}),!0}catch{return!1}}function RY(Q){if(Q.lstart.length===0)return!1;if(process.platform==="win32"){let q=wY(Q.pid);return q!==null&&q===Q.lstart}let $=DY(Q.pid);return $!==null&&$===Q.lstart}function R6(){try{lz(I8())}catch{}}function Q1(){let Q=AY();if(Q==null)return{state:"stopped"};if(RY(Q))return{state:"running",pid:Q.pid};return{state:"stale",pid:Q.pid}}var rz={desktopStatus:Q1,clearPidFile:R6,desktopBinPath:k0,existsSync:CY,mkdir:oz,openSync:pz,spawn:uz,writeFile:iz,logFile:TY,recordLstart:nz,pgrepPetdexDesktop:ez};async function k1(Q={}){return az(rz,Q)}async function az(Q,$){let q=Q.desktopStatus();if(q.state==="running")return{ok:!0,pid:q.pid,alreadyRunning:!0};if(q.state==="stale")Q.clearPidFile();let J=Q.desktopBinPath();if(!Q.existsSync(J))return{ok:!1,reason:`petdex-desktop binary not found at ${J}. Run \`petdex install desktop\` first.`};await Q.mkdir(F1.dirname(Q.logFile()),{recursive:!0});let Y=Q.logFile(),V=Q.openSync(Y,"a"),X=Q.openSync(Y,"a"),K=sz(J);if(!$.direct&&K)return tz(K,Q);let W=Q.spawn(J,[],{detached:!0,stdio:["ignore",V,X]});if(W.unref(),!W.pid)return{ok:!1,reason:"Failed to spawn petdex-desktop"};let G={pid:W.pid,lstart:Q.recordLstart(W.pid)};return await Q.writeFile(I8(),JSON.stringify(G)),{ok:!0,pid:W.pid,alreadyRunning:!1}}function sz(Q){let $=F1.dirname(Q);if(F1.basename($)!=="MacOS")return null;let q=F1.dirname($);if(F1.basename(q)!=="Contents")return null;let J=F1.dirname(q);if(!J.endsWith(".app"))return null;return J}async function tz(Q,$){$.spawn("open",["-gj",Q],{stdio:"ignore",detached:!0}).unref();let J=Date.now()+3000,Y=null;while(Date.now()<J){if(Y=$.pgrepPetdexDesktop(),Y)break;await new Promise((X)=>setTimeout(X,100))}if(!Y)return{ok:!1,reason:`Launched ${Q} but couldn't find the resulting process. Check ${$.logFile()}.`};let V={pid:Y,lstart:$.recordLstart(Y)};return await $.writeFile(I8(),JSON.stringify(V)),{ok:!0,pid:Y,alreadyRunning:!1}}function ez(){try{let Q=C8("pgrep",["-f","petdex-desktop"],{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(!Q)return null;let $=Q.split(`
|
|
410
|
-
`).filter((J)=>J.length>0),q=Number($[$.length-1]);return Number.isFinite(q)&&q>0?q:null}catch{return null}}var xY=7777;async function a1(Q={}){let $=Q.sidecarPort??xY,q=Q.portWaitTimeoutMs??5000,J=Q1();if(J.state==="stopped")return{ok:!1,reason:"petdex-desktop is not running"};if(J.state==="stale")return R6(),{ok:!1,reason:`petdex-desktop is not running (stale pid ${J.pid} cleared)`};let Y=J.pid,V=AY();if(V===null||!RY(V))return R6(),{ok:!1,reason:`petdex-desktop exited before stop (pid ${Y} no longer alive)`};if(process.platform==="win32")try{C8("taskkill",["/pid",String(Y),"/t","/f"],{stdio:"ignore",timeout:5000})}catch{if(!AQ(Y)){R6();let K=await P8($,{timeoutMs:q});return{ok:!0,pid:Y,portReleased:K}}return{ok:!1,reason:`taskkill failed and pid ${Y} is still alive`}}else try{process.kill(Y,"SIGTERM")}catch(K){if(R6(),K.code==="ESRCH"){let G=await P8($,{timeoutMs:q});return{ok:!0,pid:Y,portReleased:G}}return{ok:!1,reason:`Failed to signal pid ${Y}: ${K.message}`}}R6();let X=await P8($,{timeoutMs:q});return{ok:!0,pid:Y,portReleased:X}}async function vY(Q=[]){if(Q.includes("--help")||Q.includes("-h")||Q.includes("help")){console.log([""," petdex desktop start [--direct]",""," Options"," --direct Launch the petdex-desktop executable directly instead of the macOS app bundle",""].join(`
|
|
411
|
-
`));return}let $=Q.filter((J)=>J!=="--direct");if($.length>0)console.error(`${N0.default.red("✗")} Unknown option: ${$[0]}`),console.error(N0.default.dim(" Usage: petdex desktop start [--direct]")),process.exit(1);let q=await k1({direct:Q.includes("--direct")});if(!q.ok)console.error(`${N0.default.red("✗")} ${q.reason}`),process.exit(1);if(q.alreadyRunning)console.log(`${N0.default.dim("•")} petdex-desktop already running (pid ${q.pid})`);else console.log(`${N0.default.green("✓")} petdex-desktop started (pid ${q.pid})`),console.log(N0.default.dim(` log: ${TY()}`))}async function EY(){let Q=await a1();if(!Q.ok)console.error(`${N0.default.dim("•")} ${Q.reason}`),process.exit(Q.reason.includes("not running")?0:1);if(Q.portReleased)console.log(`${N0.default.green("✓")} stopped pid ${Q.pid}`);else console.log(`${N0.default.yellow("!")} stopped pid ${Q.pid}, but :${xY} still busy`),console.log(N0.default.dim(" if 'petdex desktop start' fails with EADDRINUSE, wait a moment and retry"))}async function P8(Q,$={}){let q=$.timeoutMs??1e4,J=$.intervalMs??100,Y=$.host??"127.0.0.1",{createConnection:V}=await import("node:net"),X=Date.now()+q;while(Date.now()<X){if(await new Promise((W)=>{let G=V({host:Y,port:Q}),U=(z)=>{G.removeAllListeners(),G.destroy(),W(z)};G.once("connect",()=>U(!1)),G.once("error",(z)=>{U(z.code==="ECONNREFUSED")}),G.setTimeout(J,()=>U(!1))}))return!0;await new Promise((W)=>setTimeout(W,J))}return!1}function SY(){let Q=Q1();switch(Q.state){case"running":console.log(`${N0.default.green("●")} running (pid ${Q.pid})`);break;case"stopped":console.log(`${N0.default.dim("○")} stopped`);break;case"stale":console.log(`${N0.default.yellow("?")} pid ${Q.pid} written but not alive (run \`petdex desktop start\` to restart)`);break}}import{mkdir as QH,readdir as $H,writeFile as qH}from"node:fs/promises";import T8 from"node:path";function JH(Q=C0()){return[T8.join(Q,".petdex","pets"),T8.join(Q,".codex","pets")]}function YH(Q=C0()){return T8.join(Q,".petdex","active.json")}async function kY(Q=JH()){let $=new Set;for(let q of Q)try{let J=await $H(q,{withFileTypes:!0});for(let Y of J){if(!Y.isDirectory())continue;if(PQ(T8.join(q,Y.name)))$.add(Y.name)}}catch{}return[...$].sort()}async function yY(Q,$=YH()){await QH(T8.dirname($),{recursive:!0}),await qH($,`${JSON.stringify({slug:Q})}
|
|
412
|
-
`,"utf8")}async function gY(Q={stopDesktop:a1,startDesktop:k1}){let $=await Q.stopDesktop();if(!$.ok&&!$.reason.includes("not running"))return{status:"manual_restart_required",reason:$.reason};if($.ok&&!$.portReleased)return{status:"manual_restart_required",reason:"desktop sidecar port is still busy"};let q=await Q.startDesktop();if(!q.ok)return{status:"manual_restart_required",reason:q.reason};return{status:"reloaded"}}t1();var S=p0(R1(),1);import{existsSync as gH,readFileSync as Q3}from"node:fs";import{mkdir as _H,writeFile as bH}from"node:fs/promises";import{homedir as $3}from"node:os";import mQ from"node:path";import{spawn as VH}from"node:child_process";import{randomUUID as _Y}from"node:crypto";import{existsSync as XH,mkdirSync as KH,readFileSync as GH,writeFileSync as WH}from"node:fs";import{homedir as UH}from"node:os";import bY from"node:path";function p2(){let Q=process.env.HOME??UH();return bY.join(Q,".petdex","telemetry.json")}var jH=process.env.PETDEX_TELEMETRY_URL??"https://petdex.dev/api/telemetry/event",ZH=2000;function d2(){if(!XH(p2()))return{kind:"missing"};let Q;try{Q=GH(p2(),"utf8")}catch($){return{kind:"error",reason:`read failed: ${$.message}`}}try{return{kind:"ok",config:JSON.parse(Q)}}catch($){return{kind:"error",reason:`parse failed: ${$.message}`}}}function DQ(Q){try{return KH(bY.dirname(p2()),{recursive:!0}),WH(p2(),`${JSON.stringify(Q,null,2)}
|
|
413
|
-
`),!0}catch{return!1}}function fY(){if(process.env.PETDEX_TELEMETRY==="0")return null;let Q=d2();if(Q.kind==="ok")return Q.config;if(Q.kind==="error")return null;let $={install_id:_Y(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return DQ($)?$:null}function hY(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let Q=d2();if(Q.kind==="missing")return!0;if(Q.kind==="error")return!1;return Q.config.enabled}function mY(Q){let $=d2(),q;if($.kind==="ok")q=$.config,q.enabled=Q;else q={install_id:_Y(),enabled:Q,notice_seen:!0,first_seen:new Date().toISOString()};return DQ(q)}function cY(){let Q=d2();return{enabled:hY(),install_id:Q.kind==="ok"?Q.config.install_id:null}}function uY(){if(process.env.PETDEX_TELEMETRY==="0")return;let Q=fY();if(!Q)return;if(Q.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.dev/legal/telemetry",""].join(`
|
|
414
|
-
`)),Q.notice_seen=!0,DQ(Q)}function T0(Q,$={}){if(!hY())return;let q=fY();if(!q)return;let J=JSON.stringify({install_id:q.install_id,event:Q,...$});try{let Y=`
|
|
70
|
+
</html>`;function d5($,Q){return new h($,Q)}function aJ($){let{expectedState:Q,port:J=0,timeoutMs:q=120000,successHtml:Y=GU,errorHtml:G=VU}=$,V,K=!1,U=!1,X,W,H=new Promise((Z,L)=>{X=Z,W=L}),j=(Z)=>{if(U)return;U=!0,Z.close()},F=YU((Z,L)=>{if(K){L.writeHead(410,{"Content-Type":"text/plain; charset=utf-8"}),L.end("Authentication callback already handled.");return}if(Z.method!=="GET"||!Z.url){L.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),L.end("Not found");return}let N=new URL(Z.url,"http://127.0.0.1");if(N.pathname!=="/callback"){L.writeHead(404,{"Content-Type":"text/plain; charset=utf-8"}),L.end("Clerk CLI auth server is waiting for /callback.");return}let I=N.searchParams.get("code"),P=N.searchParams.get("state"),B=N.searchParams.get("error"),M=N.searchParams.get("error_description")??B,z=(D,w,v)=>{if(K=!0,V)clearTimeout(V);L.writeHead(D,{"Content-Type":"text/html; charset=utf-8"}),L.end(w,()=>{if(v)W(v);else if(I&&P)X({code:I,state:P});j(F)})};if(B){z(400,G,d5("token_exchange",`OAuth authorization failed: ${M??"unknown error"}`));return}if(P!==Q){z(400,G,d5("state_mismatch","OAuth callback state did not match."));return}if(!I){z(400,G,d5("token_exchange","OAuth callback did not include an authorization code."));return}z(200,Y)});return new Promise((Z,L)=>{F.once("error",(N)=>{L(new h("config",`Failed to start local auth callback server: ${N.message}`))}),F.listen(J,"127.0.0.1",()=>{let I=F.address().port,P=`http://127.0.0.1:${I}/callback`;V=setTimeout(()=>{if(K)return;K=!0,W(new h("timeout",`OAuth callback timed out after ${q}ms.`)),j(F)},q),Z({port:I,redirectUri:P,waitForCallback:()=>H,close:()=>{if(V)clearTimeout(V);if(!K)K=!0,W(new h("timeout","OAuth callback server was closed."));j(F)}})})})}import{chmod as KU,mkdir as XU,readFile as WU,writeFile as UU}from"node:fs/promises";import{homedir as jU}from"node:os";import{dirname as HU,join as FU}from"node:path";function sJ($,Q){if(Q instanceof h)return Q;let J=Q instanceof Error?Q.message:String(Q);return new h("storage",`${$}: ${J}`)}function eJ($){return $?.environment??"default"}function PU($){return FU(jU(),".config","clerk-cli-auth",`${$}.json`)}class $4{values=new Map;async get($){return this.values.get($)??null}async set($,Q){this.values.set($,Q)}async delete($){this.values.delete($)}}class Q4{filePath;queue=Promise.resolve();constructor($){this.filePath=$}enqueue($){let Q=this.queue.then($,$);return this.queue=Q.catch(()=>{return}),Q}async readAll(){try{let $=await WU(this.filePath,"utf8");if(!$.trim())return{};let Q=JSON.parse($);if(!Q||typeof Q!=="object"||Array.isArray(Q))return{};let J={};for(let[q,Y]of Object.entries(Q))if(typeof Y==="string")J[q]=Y;return J}catch($){if($.code==="ENOENT")return{};throw sJ(`Failed to read credential file ${this.filePath}`,$)}}async writeAll($){try{await XU(HU(this.filePath),{recursive:!0}),await UU(this.filePath,`${JSON.stringify($,null,2)}
|
|
71
|
+
`,{mode:384}),await KU(this.filePath,384)}catch(Q){throw sJ(`Failed to write credential file ${this.filePath}`,Q)}}async get($){return this.enqueue(async()=>{return(await this.readAll())[$]??null})}async set($,Q){return this.enqueue(async()=>{let J=await this.readAll();J[$]=Q,await this.writeAll(J)})}async delete($){return this.enqueue(async()=>{let Q=await this.readAll();delete Q[$],await this.writeAll(Q)})}}class J4{service;environment;fallback;keyringPromise=null;constructor($,Q,J){this.service=$;this.environment=Q;this.fallback=J}account($){return`${this.environment}:${$}`}warnFallback($,Q){let J=Q instanceof Error?Q.message:String(Q);if($==="initialization"&&J.includes("Cannot find package"))return;console.warn(`Keychain ${$} failed; falling back to file store. ${J}`)}async loadKeyring(){return this.keyringPromise??=import("@napi-rs/keyring").catch(($)=>{return this.warnFallback("initialization",$),null}),this.keyringPromise}async get($){try{let Q=await this.loadKeyring();if(!Q)return this.fallback.get($);return new Q.Entry(this.service,this.account($)).getPassword()??await this.fallback.get($)}catch(Q){return this.warnFallback("get",Q),this.fallback.get($)}}async set($,Q){try{let J=await this.loadKeyring();if(!J){await this.fallback.set($,Q);return}new J.Entry(this.service,this.account($)).setPassword(Q)}catch(J){this.warnFallback("set",J),await this.fallback.set($,Q)}}async delete($){try{let Q=await this.loadKeyring();if(Q)new Q.Entry(this.service,this.account($)).deletePassword()}catch(Q){this.warnFallback("delete",Q)}await this.fallback.delete($)}}function tJ($){let Q=eJ($);return new Q4($?.filePath??PU(Q))}function q4($,Q){if($==="memory")return new $4;if($==="file")return tJ(Q);let J=tJ(Q),q=Q?.keychainService??"clerk-cli-auth",Y=eJ(Q);return new J4(q,Y,J)}import{createHash as ZU,randomBytes as Y4}from"node:crypto";function l5($){return $.toString("base64url")}function G4(){return l5(Y4(32))}async function V4($){return l5(ZU("sha256").update($).digest())}function K4(){return l5(Y4(32))}function X4($,Q){return`${$.replace(/\/+$/,"")}${Q}`}async function W4($){if(($.headers.get("content-type")??"").includes("application/json"))return $.json();return $.text()}function U4($,Q){if(typeof $==="string"&&$.trim())return $.trim();if($&&typeof $==="object"){let J=$;for(let q of["error_description","message","error"]){let Y=J[q];if(typeof Y==="string"&&Y.trim())return Y.trim()}}return Q}function zU($){if(typeof $.access_token!=="string"||$.access_token.length===0)throw new h("token_exchange","Token response did not include access_token.");let Q={accessToken:$.access_token};if(typeof $.refresh_token==="string")Q.refreshToken=$.refresh_token;if(typeof $.id_token==="string")Q.idToken=$.id_token;if(typeof $.scope==="string")Q.scope=$.scope;if(typeof $.token_type==="string")Q.tokenType=$.token_type;if(typeof $.expires_in==="number")Q.expiresAt=Date.now()+$.expires_in*1000;return Q}async function j4($,Q){let J;try{J=await fetch(X4($,"/oauth/token"),{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:Q.toString()})}catch(Y){throw new h("token_exchange",`Token request failed: ${Y.message}`)}let q;try{q=await W4(J)}catch(Y){throw new h("token_exchange",`Token response could not be parsed: ${Y.message}`)}if(!J.ok)throw new h("token_exchange",U4(q,`Token request failed with HTTP ${J.status}.`));if(!q||typeof q!=="object")throw new h("token_exchange","Token response was not JSON.");return zU(q)}async function H4($){let Q=new URLSearchParams({grant_type:"authorization_code",client_id:$.clientId,code:$.code,code_verifier:$.codeVerifier,redirect_uri:$.redirectUri});return j4($.issuer,Q)}async function F4($){let Q=new URLSearchParams({grant_type:"refresh_token",client_id:$.clientId,refresh_token:$.refreshToken});if($.scopes?.length)Q.set("scope",$.scopes.join(" "));return j4($.issuer,Q)}async function o5($){let Q;try{Q=await fetch(X4($.issuer,"/oauth/userinfo"),{headers:{Authorization:`Bearer ${$.accessToken}`}})}catch(Y){throw new h("userinfo",`Userinfo request failed: ${Y.message}`)}let J;try{J=await W4(Q)}catch(Y){throw new h("userinfo",`Userinfo response could not be parsed: ${Y.message}`)}if(!Q.ok)throw new h("userinfo",U4(J,`Userinfo request failed with HTTP ${Q.status}.`));if(!J||typeof J!=="object")throw new h("userinfo","Userinfo response was not JSON.");let q=J;if(typeof q.sub!=="string"||q.sub.length===0)throw new h("userinfo","Userinfo response did not include sub.");return q}var MU=["profile","email","openid","offline_access"];function IU($){let Q=$.trim().replace(/\/+$/,"");try{let J=new URL(Q);if(J.protocol!=="http:"&&J.protocol!=="https:")throw Error("issuer must use http or https");return Q}catch(J){throw new h("config",`issuer must be a valid URL: ${J.message}`)}}function E6($,Q){if(Q instanceof h)return Q;let J=Q instanceof Error?Q.message:String(Q);return new h("storage",`Failed to ${$}: ${J}`)}async function OU($){console.log(`Open this URL to sign in:
|
|
72
|
+
${$}`);let Q=process.platform,J=Q==="darwin"?"open":Q==="win32"?"cmd":"xdg-open",q=Q==="win32"?["/c","start","",$]:[$];await new Promise((Y)=>{let G=LU(J,q,{detached:!0,stdio:"ignore"});G.once("error",()=>Y()),G.unref(),Y()})}class x6{config;constructor($){if(!$.clientId)throw new h("config","clientId is required");if(!$.issuer)throw new h("config","issuer is required");let Q=$.environment??"default",J=typeof $.storage==="object"&&$.storage!==null?$.storage:q4($.storage??"keychain",{environment:Q,keychainService:$.keychainService});this.config={clientId:$.clientId,issuer:IU($.issuer),scopes:$.scopes??MU,storage:J,keychainService:$.keychainService??"clerk-cli-auth",environment:Q,callbackPort:$.callbackPort??0,timeoutMs:$.timeoutMs??120000,openBrowser:$.openBrowser}}async login(){let $=G4(),Q=await V4($),J=K4(),q=await aJ({expectedState:J,port:this.config.callbackPort,timeoutMs:this.config.timeoutMs});try{let Y=new URL(`${this.config.issuer}/oauth/authorize`);Y.searchParams.set("response_type","code"),Y.searchParams.set("client_id",this.config.clientId),Y.searchParams.set("redirect_uri",q.redirectUri),Y.searchParams.set("scope",this.config.scopes.join(" ")),Y.searchParams.set("state",J),Y.searchParams.set("code_challenge",Q),Y.searchParams.set("code_challenge_method","S256");try{await(this.config.openBrowser??OU)(Y.toString())}catch(U){throw new h("config",`Failed to open authorization URL: ${U.message}`)}let{code:G}=await q.waitForCallback(),V=await H4({issuer:this.config.issuer,clientId:this.config.clientId,code:G,codeVerifier:$,redirectUri:q.redirectUri});await this.setJson("tokens",V);let K=await o5({issuer:this.config.issuer,accessToken:V.accessToken});return await this.setJson("user",K),{tokens:V,user:K}}finally{q.close()}}async getAccessToken(){let $=await this.getTokenSet();if(!$)return null;if(($.expiresAt??Number.POSITIVE_INFINITY)>=Date.now()+30000)return $.accessToken;if(!$.refreshToken)return null;let J=await F4({issuer:this.config.issuer,clientId:this.config.clientId,refreshToken:$.refreshToken,scopes:this.config.scopes}),q={...$,...J,refreshToken:J.refreshToken??$.refreshToken};return await this.setJson("tokens",q),q.accessToken}async whoami(){let $=await this.getJson("user");if($)return $;let Q=await this.getAccessToken();if(!Q)return null;let J=await o5({issuer:this.config.issuer,accessToken:Q});return await this.setJson("user",J),J}async logout(){try{await Promise.all([this.config.storage.delete("tokens"),this.config.storage.delete("user")])}catch($){throw E6("clear stored credentials",$)}}async getTokenSet(){return this.getJson("tokens")}async getJson($){let Q;try{Q=await this.config.storage.get($)}catch(J){throw E6(`read ${$}`,J)}if(!Q)return null;try{return JSON.parse(Q)}catch(J){throw E6(`parse stored ${$}`,J)}}async setJson($,Q){try{await this.config.storage.set($,JSON.stringify(Q))}catch(J){throw E6(`write ${$}`,J)}}}import{spawn as NU}from"node:child_process";import{randomUUID as P4}from"node:crypto";import{existsSync as BU,mkdirSync as DU,readFileSync as wU,writeFileSync as vU}from"node:fs";import{homedir as CU}from"node:os";import Z4 from"node:path";function S6(){let $=process.env.HOME??CU();return Z4.join($,".petdex","telemetry.json")}var AU=process.env.PETDEX_TELEMETRY_URL??"https://petdex.dev/api/telemetry/event",RU=2000;function g6(){if(!BU(S6()))return{kind:"missing"};let $;try{$=wU(S6(),"utf8")}catch(Q){return{kind:"error",reason:`read failed: ${Q.message}`}}try{return{kind:"ok",config:JSON.parse($)}}catch(Q){return{kind:"error",reason:`parse failed: ${Q.message}`}}}function i5($){try{return DU(Z4.dirname(S6()),{recursive:!0}),vU(S6(),`${JSON.stringify($,null,2)}
|
|
73
|
+
`),!0}catch{return!1}}function z4(){if(process.env.PETDEX_TELEMETRY==="0")return null;let $=g6();if($.kind==="ok")return $.config;if($.kind==="error")return null;let Q={install_id:P4(),enabled:!0,notice_seen:!1,first_seen:new Date().toISOString()};return i5(Q)?Q:null}function L4(){if(process.env.PETDEX_TELEMETRY==="0")return!1;let $=g6();if($.kind==="missing")return!0;if($.kind==="error")return!1;return $.config.enabled}function M4($){let Q=g6(),J;if(Q.kind==="ok")J=Q.config,J.enabled=$;else J={install_id:P4(),enabled:$,notice_seen:!0,first_seen:new Date().toISOString()};return i5(J)}function I4(){let $=g6();return{enabled:L4(),install_id:$.kind==="ok"?$.config.install_id:null}}function O4(){if(process.env.PETDEX_TELEMETRY==="0")return;let $=z4();if(!$)return;if($.notice_seen)return;console.log(["","petdex collects anonymous usage stats (install volume, OS, agents wired up).","No personal data, no file contents. Disable any time:"," petdex telemetry off","Details: https://petdex.dev/legal/telemetry",""].join(`
|
|
74
|
+
`)),$.notice_seen=!0,i5($)}function N4($,Q={}){if(!L4())return;let J=z4();if(!J)return;let q=JSON.stringify({install_id:J.install_id,event:$,...Q});try{let Y=`
|
|
415
75
|
const controller = new AbortController();
|
|
416
|
-
const t = setTimeout(() => controller.abort(), ${
|
|
417
|
-
fetch(${JSON.stringify(
|
|
76
|
+
const t = setTimeout(() => controller.abort(), ${RU});
|
|
77
|
+
fetch(${JSON.stringify(AU)}, {
|
|
418
78
|
method: "POST",
|
|
419
79
|
headers: { "content-type": "application/json" },
|
|
420
|
-
body: ${JSON.stringify(
|
|
80
|
+
body: ${JSON.stringify(q)},
|
|
421
81
|
signal: controller.signal,
|
|
422
82
|
}).catch(() => {}).finally(() => clearTimeout(t));
|
|
423
|
-
`;
|
|
424
|
-
`)}
|
|
425
|
-
|
|
426
|
-
${
|
|
427
|
-
|
|
428
|
-
`),"Done"),Q.removeToken)try{await pQ(O8(),{force:!0}),i.info(`${V0.default.green("✓")} Removed ${O8()}`)}catch{}else if(y1(O8()))i.info(V0.default.dim(`Token file at ${O8()} kept. Pass --remove-token to delete it.`));return R0(`${V0.default.green("✓")} Done. Run ${V0.default.cyan("petdex hooks install")} to wire petdex back in.`),{uninstalledAgents:Y}}async function dH(){return Promise.all(H1.map(async(Q)=>({agent:Q,installed:Q.id==="antigravity"?lH():y1(Q.configDir)})))}function lH(){return v1().some((Q)=>y1(Y3.dirname(Q)))||y1(E1())}async function oH(Q){if(Q.id==="opencode"){if(!y1(Q.configFile))return{removed:!1,backupPath:null};let V=await cQ(Q.configFile);return await pQ(Q.configFile,{force:!0}),{removed:!0,backupPath:V}}if(Q.id==="antigravity"){let V=!1;for(let X of v1())try{if(y1(X)){let K=await uQ(X,"utf8"),W=JSON.parse(K),G=W.mcpServers??{};if(G.petdex){let{petdex:U,...z}=G;W.mcpServers=z,await cQ(X),await dQ(X,`${JSON.stringify(W,null,2)}
|
|
429
|
-
`,"utf8"),V=!0}}}catch{}try{let X=E1(),K=!1;try{await pH(X),K=!0}catch{}if(K)await pQ(X,{recursive:!0,force:!0}),V=!0}catch{}return{removed:V,backupPath:null}}if(!y1(Q.configFile))return{removed:!1,backupPath:null};let $;try{$=await uQ(Q.configFile,"utf8")}catch(V){throw Error(`Could not read ${Q.configFile}: ${V.message}`)}let q;try{q=JSON.parse($)}catch(V){throw Error(`Refusing to overwrite ${Q.configFile}: invalid JSON (${V.message}). Hand-edit the file to remove petdex entries.`)}let J=iH(q);if(!J.changed)return{removed:!1,backupPath:null};let Y=await cQ(Q.configFile);return await dQ(Q.configFile,`${JSON.stringify(J.value,null,2)}
|
|
430
|
-
`,"utf8"),{removed:!0,backupPath:Y}}function iH(Q){let $={...Q},q=$.hooks;if(!q||typeof q!=="object"||Array.isArray(q))return{value:$,changed:!1};let J=!1,Y={};for(let[V,X]of Object.entries(q)){if(!Array.isArray(X)){Y[V]=X;continue}let K=X.filter((W)=>!nH(W));if(K.length!==X.length)J=!0;if(K.length>0)Y[V]=K}if(!J)return{value:$,changed:!1};if(Object.keys(Y).length===0){let{hooks:V,...X}=$;return{value:X,changed:!0}}return $.hooks=Y,{value:$,changed:!0}}function nH(Q){if(typeof Q!=="object"||Q==null)return!1;return rH(Q).some((q)=>q.includes(`localhost:${F8}/state`)||q.includes(r1))}function rH(Q){let $=[];function q(J){if(typeof J==="string"){$.push(J);return}if(Array.isArray(J)){for(let Y of J)q(Y);return}if(typeof J==="object"&&J!=null)for(let Y of Object.values(J))q(Y)}return q(Q),$}async function cQ(Q){if(!y1(Q))return null;let $=new Date().toISOString().replace(/[:.]/g,"-"),q=`${Q}.${$}.bak`,J=await uQ(Q);return await dQ(q,J),q}var X3={name:"petdex",version:"0.4.7",description:"CLI for Petdex. Install, browse, and submit Codex pets from your terminal.",homepage:"https://petdex.dev",repository:{type:"git",url:"git+https://github.com/crafter-station/petdex.git",directory:"packages/petdex-cli"},license:"MIT",type:"module",engines:{node:">=20"},bin:{petdex:"dist/petdex.js"},files:["dist","README.md"],scripts:{build:"bun build ./bin/petdex.ts --target=node --outfile=./dist/petdex.js --minify --external @napi-rs/keyring",postbuild:`node -e 'const f="./dist/petdex.js";const fs=require("fs");const c=fs.readFileSync(f,"utf8");if(!c.startsWith("#!")){fs.writeFileSync(f,"#!/usr/bin/env node\\n"+c)}fs.chmodSync(f,0o755)'`,typecheck:"tsc --noEmit"},dependencies:{"@clack/prompts":"^1.3.0",jszip:"^3.10.1",picocolors:"^1.1.1"},optionalDependencies:{"@napi-rs/keyring":"^1.1.6"},devDependencies:{"@types/node":"^26.0.0","bun-types":"^1.3.13",typescript:"^6.0.3"}};var q0=process.env.PETDEX_URL??"https://petdex.dev",CF=`${q0.replace(/\/+$/,"")}/`,TF="https://clerk.petdex.dev",AF="LcThwEayl6KAA1Qm",rQ=["profile","email","openid","offline_access"];async function DF(){let Q=process.env.CLERK_ISSUER,$=process.env.CLERK_OAUTH_CLIENT_ID;if(Q&&$)return{issuer:Q,clientId:$,scopes:rQ};try{let q=await fetch(`${q0}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(q.ok){let J=await q.json(),Y=typeof J.issuer==="string"?J.issuer:null,V=typeof J.clientId==="string"?J.clientId:null,X=Array.isArray(J.scopes)?J.scopes.filter((K)=>typeof K==="string"):null;if(Y&&V)return{issuer:Q??Y,clientId:$??V,scopes:X&&X.length>0?X:rQ}}}catch{}return{issuer:Q??TF,clientId:$??AF,scopes:rQ}}var r2=null;async function v8(){if(r2)return r2;let Q=await DF();return r2=new y2({clientId:Q.clientId,issuer:Q.issuer,scopes:Q.scopes,storage:"keychain",keychainService:"petdex-cli"}),r2}var u0=X3.version;wF().catch((Q)=>{d(`petdex: ${Q.message}`),process.exit(1)});async function wF(){let Q=process.argv.slice(2),$=Q[0];if($==="bubble"){let{runBubble:J}=await Promise.resolve().then(() => (O3(),L3));await J(Q.slice(1));return}if($==="mcp-server"){let{runMcpServer:J}=await Promise.resolve().then(() => (C3(),I3));await J();return}if(!$||$==="--help"||$==="-h"||$==="help"){w3();return}if(!new Set(["version","--version","-v","telemetry"]).has($))uY();switch($){case"login":await RF();break;case"logout":await xF();break;case"whoami":await vF();break;case"submit":await _F(Q.slice(1));break;case"edit":await bF(Q.slice(1));break;case"install":await kF(Q.slice(1));break;case"list":await yF();break;case"select":await gF(Q.slice(1));break;case"hooks":await nF(Q.slice(1));break;case"desktop":await eF(Q.slice(1));break;case"init":await aF();break;case"up":await _3();break;case"down":await b3();break;case"toggle":await tF();break;case"update":await J3(Q.slice(1),u0);break;case"doctor":await IY();break;case"telemetry":QL(Q.slice(1));break;case"version":case"--version":case"-v":console.log(u0);break;default:console.error(j.default.red(`Unknown command: ${$}`)),w3(),process.exit(1)}}function w3(){let Q=j.default.cyan,$=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex"))} ${$(u0)} ${$("Codex pet gallery CLI")}`,"",` ${Q("Usage")}`," petdex <command> [args]","",` ${Q("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("edit")} <slug> Edit a pet you own (--desc, --displayName, --sprite, --meta, --zip)`,` ${j.default.bold("install")} <slug...> Install one or more pets 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("select")} [slug] Set the active pet shown by the desktop mascot`,` ${j.default.bold("mcp-server")} Start the MCP protocol server for Antigravity integration`,` ${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`,"",` ${Q("Examples")}`,` ${$("$")} petdex init ${$("# after dragging Petdex.app from the .dmg → just run this")}`,` ${$("$")} petdex login`,` ${$("$")} petdex submit ~/.codex/pets/boba ${$("# single folder")}`,` ${$("$")} petdex install boba ${$("# install a pet by slug")}`,` ${$("$")} petdex install boba doraemon mochi ${$("# install several at once")}`,` ${$("$")} petdex select ${$("# pick active mascot from installed pets")}`,` ${$("$")} petdex select boba ${$("# set active mascot directly")}`,` ${$("$")} petdex toggle ${$("# wake or sleep the mascot")}`,` ${$("$")} petdex doctor ${$("# diagnose install + agents")}`,` ${$("$")} petdex update ${$("# pull the latest release")}`,"",` ${$("Gallery & docs:")} ${j.default.underline(q0)}`,""].join(`
|
|
431
|
-
`))}async function RF(){B0(j.default.bgMagenta(j.default.white(" petdex login ")));let Q=U0();Q.start("Opening your browser to sign in with Clerk");try{let $=await v8(),{user:q}=await $.login(),J=k3(q.email,q.username,q.sub)??"unknown";Q.stop(`${j.default.green("✓ ")}Signed in as ${j.default.cyan(J)}`),R0(`Try ${j.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch($){throw Q.stop(j.default.red("× login failed")),Error(dF($.message))}}async function xF(){await(await v8()).logout(),console.log(`${j.default.green("✓ ")}Signed out`)}async function vF(){try{let $=await(await v8()).whoami();if(!$)throw Error("not signed in");let q=[s2($.given_name),s2($.family_name)].filter(Boolean).join(" ");b0([`${j.default.dim("user: ")}${$.sub}`,`${j.default.dim("email: ")}${$.email??"—"}`,`${j.default.dim("name: ")}${q||"—"}`,`${j.default.dim("username:")}${s2($.preferred_username)??"—"}`].join(`
|
|
432
|
-
`),"Signed in")}catch{d(`Not signed in. Run ${j.default.cyan("petdex login")}.`),process.exit(1)}}async function EF(){let Q=await fetch(`${q0}/api/manifest`);if(!Q.ok)throw Error(`manifest fetch ${Q.status}`);return(await Q.json()).pets}async function SF(Q){let $=Q.slug;if(!B8(Q.spritesheetUrl)||!B8(Q.petJsonUrl))throw Error(`untrusted asset host for ${$} (admin needs to re-upload)`);let q=Z0.join(D3(),".petdex","pets",$),J=Z0.join(D3(),".codex","pets",$);await Promise.all([A3(q,{recursive:!0}),A3(J,{recursive:!0})]);let Y=Q.spritesheetUrl.endsWith(".png")?"png":"webp",V=async(W)=>{let G=await fetch(W,{headers:{Referer:CF}});if(!G.ok)throw Error(`download ${W} -> ${G.status} ${G.statusText}`);return G.arrayBuffer()},[X,K]=await Promise.all([V(Q.petJsonUrl),V(Q.spritesheetUrl)]);await Promise.all([n2(Z0.join(q,"pet.json"),Buffer.from(X)),n2(Z0.join(q,`spritesheet.${Y}`),Buffer.from(K)),n2(Z0.join(J,"pet.json"),Buffer.from(X)),n2(Z0.join(J,`spritesheet.${Y}`),Buffer.from(K))]),fetch(`${q0}/install/${$}`,{method:"GET"}).catch(()=>{})}async function kF(Q){let $=Q[0];if(!$)d(`Usage: ${j.default.cyan("petdex install <slug> [slug...]")} or ${j.default.cyan("petdex install desktop")}`),process.exit(1);if($==="desktop"){let{tag:U}=await CQ();T0("cli_install_desktop_success",{cli_version:u0,os:process.platform,arch:process.arch,binary_version:U.replace(/^desktop-v/,"")});return}let q=Array.from(new Set(Q)),J=U0();J.start(q.length===1?`Resolving ${q[0]}`:`Resolving ${q.length} pets`);let Y;try{Y=await EF()}catch(U){throw J.stop(j.default.red("manifest failed")),U}let V=[],X=[];for(let U of q){let z=Y.find((Z)=>Z.slug===U);if(z)V.push(z);else X.push(U)}if(V.length===0)J.stop(j.default.red("none found")),d(`No pets matched. Try ${j.default.cyan("petdex list")} to see what's available.`),process.exit(1);let K=[],W=[];for(let U=0;U<V.length;U++){let z=V[U];J.message(V.length===1?`Downloading ${z.slug}`:`Downloading ${z.slug} (${U+1}/${V.length})`);try{await SF(z),K.push(z.displayName)}catch(Z){W.push({slug:z.slug,reason:Z instanceof Error?Z.message:String(Z)})}}if(K.length===V.length)J.stop(K.length===1?`Installed ${j.default.cyan(K[0])}`:`Installed ${j.default.cyan(K.length)} pets`);else if(K.length>0)J.stop(`Installed ${j.default.cyan(K.length)} of ${V.length} (${j.default.red(`${W.length} failed`)})`);else J.stop(j.default.red("all failed"));let G=[];if(K.length>0)G.push("Paths:"),G.push(` ${j.default.dim("~/.petdex/pets/")} (Petdex Desktop)`),G.push(` ${j.default.dim("~/.codex/pets/")} (Codex Desktop)`),G.push(""),G.push("Activate in Petdex Desktop: right-click the mascot."),G.push("Activate in Codex Desktop:"),G.push(` ${j.default.cyan("Settings -> Appearance -> Pets")}`);if(X.length>0){if(G.length>0)G.push("");G.push(j.default.yellow("Skipped (slug not found):"));for(let U of X)G.push(` ${U}`)}if(W.length>0){if(G.length>0)G.push("");G.push(j.default.red("Failed:"));for(let U of W)G.push(` ${U.slug}: ${U.reason}`)}if(G.length>0)b0(G.join(`
|
|
433
|
-
`),"Next steps");if(W.length>0&&K.length===0)process.exit(1)}async function yF(){let Q=U0();Q.start("Fetching gallery");let $=await fetch(`${q0}/api/manifest`);if(!$.ok)throw Q.stop(j.default.red("failed")),Error(`failed to fetch manifest: ${$.status}`);let q=await $.json();Q.stop(`${q.total} pets`);let J=q.pets.map((Y)=>{let V=Y.submittedBy?j.default.dim(` by ${Y.submittedBy}`):"";return` ${j.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${V}`});console.log(J.join(`
|
|
83
|
+
`;NU(process.execPath,["-e",Y],{detached:!0,stdio:"ignore"}).unref()}catch{}}var l=process.env.PETDEX_URL??"https://petdex.dev",Hj=`${l.replace(/\/+$/,"")}/`,e4=`${l.replace(/\/+$/,"")}/download`,$q=new Map([["init","The desktop app installs its own agent hooks from Settings."],["up","The desktop app runs on its own. Launch Petdex from Applications."],["down","Quit Petdex from its menu bar icon to stop it."],["toggle","Toggle the mascot from the Petdex menu bar icon."],["desktop","The desktop app manages its own lifecycle."],["update","The desktop app updates itself automatically."],["doctor","Petdex Settings shows agent and hook status directly."],["hooks","Install agent hooks from Petdex Settings, one click per agent."]]),Fj="https://clerk.petdex.dev",Pj="LcThwEayl6KAA1Qm",e5=["profile","email","openid","offline_access"];async function Zj(){let $=process.env.CLERK_ISSUER,Q=process.env.CLERK_OAUTH_CLIENT_ID;if($&&Q)return{issuer:$,clientId:Q,scopes:e5};try{let J=await fetch(`${l}/api/cli/auth-config`,{signal:AbortSignal.timeout(3000)});if(J.ok){let q=await J.json(),Y=typeof q.issuer==="string"?q.issuer:null,G=typeof q.clientId==="string"?q.clientId:null,V=Array.isArray(q.scopes)?q.scopes.filter((K)=>typeof K==="string"):null;if(Y&&G)return{issuer:$??Y,clientId:Q??G,scopes:V&&V.length>0?V:e5}}}catch{}return{issuer:$??Fj,clientId:Q??Pj,scopes:e5}}var y6=null;async function A$(){if(y6)return y6;let $=await Zj();return y6=new x6({clientId:$.clientId,issuer:$.issuer,scopes:$.scopes,storage:"keychain",keychainService:"petdex-cli"}),y6}var f6=rJ.version;zj().catch(($)=>{i(`petdex: ${$.message}`),process.exit(1)});async function zj(){let $=process.argv.slice(2),Q=$[0];if(Q==="bubble"){let{runBubble:q}=await Promise.resolve().then(() => (m4(),_4));await q($.slice(1));return}if(Q==="mcp-server"){let{runMcpServer:q}=await Promise.resolve().then(() => (o4(),l4));await q();return}if(!Q||Q==="--help"||Q==="-h"||Q==="help"){r4();return}if($q.has(Q)){Qq(Q);return}if(!new Set(["version","--version","-v","telemetry"]).has(Q))O4();switch(Q){case"login":await Lj();break;case"logout":await Mj();break;case"whoami":await Ij();break;case"submit":await wj($.slice(1));break;case"edit":await vj($.slice(1));break;case"install":await Bj($.slice(1));break;case"list":await Dj();break;case"telemetry":hj($.slice(1));break;case"version":case"--version":case"-v":console.log(f6);break;default:console.error(O.default.red(`Unknown command: ${Q}`)),r4(),process.exit(1)}}function Qq($){let Q=$q.get($)??"";console.error(["",` ${O.default.yellow("!")} ${O.default.bold(`petdex ${$}`)} was removed in v${f6.split(".")[0]}.`,"",` ${Q}`,` Get the app: ${O.default.underline(e4)}`,"",` This CLI now manages the pet catalog: ${O.default.cyan("petdex list")}, ${O.default.cyan("petdex install <slug>")}.`,""].join(`
|
|
84
|
+
`))}function r4(){let $=O.default.cyan,Q=O.default.dim;console.log(["",` ${O.default.bold(O.default.magenta("petdex"))} ${Q(f6)} ${Q("Codex pet gallery CLI")}`,"",` ${$("Usage")}`," petdex <command> [args]","",` ${$("Commands")}`,` ${O.default.bold("list")} List approved pets`,` ${O.default.bold("install")} <slug...> Install one or more pets into ~/.petdex/pets and ~/.codex/pets`,` ${O.default.bold("login")} Sign in with Clerk OAuth`,` ${O.default.bold("logout")} Clear stored credentials`,` ${O.default.bold("whoami")} Show signed-in user`,` ${O.default.bold("submit")} <path> Submit a pet folder, zip, or parent of pets (bulk)`,` ${O.default.bold("edit")} <slug> Edit a pet you own (--desc, --displayName, --sprite, --meta, --zip)`,` ${O.default.bold("telemetry")} [on|off|status] Manage anonymous usage telemetry`,` ${O.default.bold("version")} Print the CLI version`,"",` ${$("Examples")}`,` ${Q("$")} petdex list ${Q("# browse the gallery")}`,` ${Q("$")} petdex install boba ${Q("# install a pet by slug")}`,` ${Q("$")} petdex install boba doraemon mochi ${Q("# install several at once")}`,` ${Q("$")} petdex login`,` ${Q("$")} petdex submit ~/.codex/pets/boba ${Q("# single folder")}`,"",` ${Q("The desktop mascot is now the Petdex app: it installs agent hooks")}`,` ${Q("from Settings and updates itself.")} ${O.default.underline(e4)}`,"",` ${Q("Gallery & docs:")} ${O.default.underline(l)}`,""].join(`
|
|
85
|
+
`))}async function Lj(){h$(O.default.bgMagenta(O.default.white(" petdex login ")));let $=s0();$.start("Opening your browser to sign in with Clerk");try{let Q=await A$(),{user:J}=await Q.login(),q=Jq(J.email,J.username,J.sub)??"unknown";$.stop(`${O.default.green("✓ ")}Signed in as ${O.default.cyan(q)}`),u1(`Try ${O.default.cyan("petdex submit ~/.codex/pets")} to share your pets.`)}catch(Q){throw $.stop(O.default.red("× login failed")),Error(Sj(Q.message))}}async function Mj(){await(await A$()).logout(),console.log(`${O.default.green("✓ ")}Signed out`)}async function Ij(){try{let Q=await(await A$()).whoami();if(!Q)throw Error("not signed in");let J=[b6(Q.given_name),b6(Q.family_name)].filter(Boolean).join(" ");d1([`${O.default.dim("user: ")}${Q.sub}`,`${O.default.dim("email: ")}${Q.email??"—"}`,`${O.default.dim("name: ")}${J||"—"}`,`${O.default.dim("username:")}${b6(Q.preferred_username)??"—"}`].join(`
|
|
86
|
+
`),"Signed in")}catch{i(`Not signed in. Run ${O.default.cyan("petdex login")}.`),process.exit(1)}}async function Oj(){let $=await fetch(`${l}/api/manifest`);if(!$.ok)throw Error(`manifest fetch ${$.status}`);return(await $.json()).pets}async function Nj($){let Q=$.slug;if(!u5($.spritesheetUrl)||!u5($.petJsonUrl))throw Error(`untrusted asset host for ${Q} (admin needs to re-upload)`);let J=J0.join(n4(),".petdex","pets",Q),q=J0.join(n4(),".codex","pets",Q);await Promise.all([i4(J,{recursive:!0}),i4(q,{recursive:!0})]);let Y=$.spritesheetUrl.endsWith(".png")?"png":"webp",G=async(U)=>{let X=await fetch(U,{headers:{Referer:Hj}});if(!X.ok)throw Error(`download ${U} -> ${X.status} ${X.statusText}`);return X.arrayBuffer()},[V,K]=await Promise.all([G($.petJsonUrl),G($.spritesheetUrl)]);await Promise.all([T6(J0.join(J,"pet.json"),Buffer.from(V)),T6(J0.join(J,`spritesheet.${Y}`),Buffer.from(K)),T6(J0.join(q,"pet.json"),Buffer.from(V)),T6(J0.join(q,`spritesheet.${Y}`),Buffer.from(K))]),fetch(`${l}/install/${Q}`,{method:"GET"}).catch(()=>{})}async function Bj($){let Q=$[0];if(!Q)i(`Usage: ${O.default.cyan("petdex install <slug> [slug...]")}`),process.exit(1);if(Q==="desktop"){Qq("desktop");return}let J=Array.from(new Set($)),q=s0();q.start(J.length===1?`Resolving ${J[0]}`:`Resolving ${J.length} pets`);let Y;try{Y=await Oj()}catch(W){throw q.stop(O.default.red("manifest failed")),W}let G=[],V=[];for(let W of J){let H=Y.find((j)=>j.slug===W);if(H)G.push(H);else V.push(W)}if(G.length===0)q.stop(O.default.red("none found")),i(`No pets matched. Try ${O.default.cyan("petdex list")} to see what's available.`),process.exit(1);let K=[],U=[];for(let W=0;W<G.length;W++){let H=G[W];q.message(G.length===1?`Downloading ${H.slug}`:`Downloading ${H.slug} (${W+1}/${G.length})`);try{await Nj(H),K.push(H.displayName)}catch(j){U.push({slug:H.slug,reason:j instanceof Error?j.message:String(j)})}}if(K.length===G.length)q.stop(K.length===1?`Installed ${O.default.cyan(K[0])}`:`Installed ${O.default.cyan(K.length)} pets`);else if(K.length>0)q.stop(`Installed ${O.default.cyan(K.length)} of ${G.length} (${O.default.red(`${U.length} failed`)})`);else q.stop(O.default.red("all failed"));let X=[];if(K.length>0)X.push("Paths:"),X.push(` ${O.default.dim("~/.petdex/pets/")} (Petdex Desktop)`),X.push(` ${O.default.dim("~/.codex/pets/")} (Codex Desktop)`),X.push(""),X.push("Activate in Petdex Desktop: right-click the mascot."),X.push("Activate in Codex Desktop:"),X.push(` ${O.default.cyan("Settings -> Appearance -> Pets")}`);if(V.length>0){if(X.length>0)X.push("");X.push(O.default.yellow("Skipped (slug not found):"));for(let W of V)X.push(` ${W}`)}if(U.length>0){if(X.length>0)X.push("");X.push(O.default.red("Failed:"));for(let W of U)X.push(` ${W.slug}: ${W.reason}`)}if(X.length>0)d1(X.join(`
|
|
87
|
+
`),"Next steps");if(U.length>0&&K.length===0)process.exit(1)}async function Dj(){let $=s0();$.start("Fetching gallery");let Q=await fetch(`${l}/api/manifest`);if(!Q.ok)throw $.stop(O.default.red("failed")),Error(`failed to fetch manifest: ${Q.status}`);let J=await Q.json();$.stop(`${J.total} pets`);let q=J.pets.map((Y)=>{let G=Y.submittedBy?O.default.dim(` by ${Y.submittedBy}`):"";return` ${O.default.cyan(Y.slug.padEnd(26))} ${Y.displayName}${G}`});console.log(q.join(`
|
|
434
88
|
`)),console.log(`
|
|
435
|
-
${
|
|
436
|
-
${
|
|
437
|
-
`),`${
|
|
438
|
-
`),"Failures");let
|
|
439
|
-
`)),
|
|
440
|
-
`);if(
|
|
441
|
-
`);if(
|
|
442
|
-
`);return
|
|
443
|
-
`))}async function eF(Q){let $=Q[0];if(!$||$==="--help"||$==="-h"||$==="help"){E3();return}switch($){case"start":{let q=Q.slice(1);if(await vY(q),!q.some((J)=>["--help","-h","help"].includes(J)))T0("cli_desktop_start_success",{cli_version:u0})}break;case"stop":await EY();break;case"status":SY();break;default:console.error(j.default.red(`Unknown desktop command: ${$}`)),E3(),process.exit(1)}}function E3(){let Q=j.default.cyan,$=j.default.dim;console.log(["",` ${j.default.bold(j.default.magenta("petdex desktop"))}`,"",` ${Q("Usage")}`," petdex desktop <command>","",` ${Q("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`,"",` ${Q("Start options")}`,` ${j.default.bold("--direct")} Launch the executable directly instead of the macOS app bundle`,"",` ${Q("Examples")}`,` ${$("$")} petdex desktop start`,` ${$("$")} petdex desktop start --direct`,` ${$("$")} petdex desktop status`,` ${$("$")} petdex desktop stop`,""].join(`
|
|
444
|
-
`))}function QL(Q){let $=Q[0];if($==="on"||$==="off"){let q=$==="on";if(mY(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 ${$}\` again.`)),process.exit(1)}else if($==="status"||!$){let q=cY();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: ${$}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}
|
|
89
|
+
${O.default.dim("Install with")} ${O.default.cyan("petdex install <slug>")}
|
|
90
|
+
${O.default.dim("Browse:")} ${O.default.underline(l)}`)}async function wj($){let J=$.filter((P)=>!P.startsWith("--"))[0];if(!J)i(`Usage: ${O.default.cyan("petdex submit <path> [--force]")}`),process.exit(1);let q=await A$(),Y;try{let P=await q.getAccessToken();if(!P)i(`Not signed in. Run ${O.default.cyan("petdex login")}.`),process.exit(1);Y=P}catch{i(`Not signed in. Run ${O.default.cyan("petdex login")}.`),process.exit(1)}let G=l;try{G=Tj(await q.whoami())}catch{}let V=J0.resolve(J),K=await t4(V).catch(()=>null);if(!K)i(`No such file or directory: ${J}`),process.exit(1);h$(O.default.bgMagenta(O.default.white(" petdex submit ")));let U=s0();U.start(`Scanning ${V}`);let X=await Cj(V,K.isDirectory());if(U.stop(X.length>0?`${X.length} pet${X.length===1?"":"s"} found`:O.default.red("no pets found")),X.length===0)i("A pet folder must contain pet.json and spritesheet.{webp,png}."),process.exit(1);let H=$.includes("--force")?new Map:await xj(X,Y),j=X,F=0;if(H.size>0){let P=X.filter((z)=>H.has(C$(z.petIdHint))),B=X.filter((z)=>!H.has(C$(z.petIdHint)));d1(P.map((z)=>{let w=H.get(C$(z.petIdHint))?.status??"unknown";return`${O.default.yellow("•")} ${O.default.bold(z.label)} ${O.default.dim(`(${w})`)}`}).join(`
|
|
91
|
+
`),`${P.length} already submitted by you`);let M=await TQ({message:"How should we handle these duplicates?",options:[{value:"skip",label:"Skip duplicates (recommended)"},{value:"resubmit",label:"Submit all anyway (will create -2 / -3 slugs)"},{value:"cancel",label:"Cancel"}],initialValue:"skip"});if(_1(M)||M==="cancel")i("Aborted."),process.exit(1);if(M==="skip"){if(j=B,F=P.length,j.length===0){u1(`Nothing new to submit. Track approval at ${O.default.underline(G)}.`);return}}}if(j.length>1){let P=await gQ({message:`Submit ${O.default.bold(String(j.length))} pet${j.length===1?"":"s"}?`});if(_1(P)||!P)i("Aborted."),process.exit(1)}let Z=0,L=0,N=[];for(let P of j){let B=s0();B.start(`Submitting ${O.default.cyan(P.label)}`);try{let M=await q.getAccessToken();if(!M)throw Error("session expired");Y=M;let z=await Rj(P,Y);G=gj(z.profileUrl)??G,B.stop(`${O.default.green("✓")} ${O.default.cyan(P.label)} → ${kj(z)}`),Z++}catch(M){let z=M.message;B.stop(`${O.default.red("×")} ${O.default.cyan(P.label)} ${O.default.red(z.slice(0,60))}`),N.push({label:P.label,error:z}),L++}}if(N.length>0)d1(N.map((P)=>`${O.default.red("•")} ${O.default.bold(P.label)}: ${P.error}`).join(`
|
|
92
|
+
`),"Failures");let I=F>0?`, ${O.default.yellow(String(F))} skipped`:"";if(u1([`${O.default.green(String(Z))} submitted${I}, ${L>0?O.default.red(String(L)):O.default.dim(String(L))} failed.`,`Held submissions stay visible at ${O.default.underline(G)}.`].join(`
|
|
93
|
+
`)),L>0)process.exit(1)}async function vj($){let J=$.filter((P)=>!P.startsWith("--"))[0];if(!J)i(`Usage: ${O.default.cyan('petdex edit <slug> [--desc "..."] [--displayName "..."] [--sprite ./new.webp] [--meta ./pet.json] [--zip ./pet.zip]')}`),process.exit(1);let q=await A$(),Y;try{let P=await q.getAccessToken();if(!P)i(`Not signed in. Run ${O.default.cyan("petdex login")}.`),process.exit(1);Y=P}catch{i(`Not signed in. Run ${O.default.cyan("petdex login")}.`),process.exit(1)}function G(P){let B=$.indexOf(P);if(B===-1)return null;let M=$[B+1];return typeof M==="string"&&!M.startsWith("--")?M:null}let V=G("--desc"),K=G("--displayName"),U=G("--sprite"),X=G("--meta"),W=G("--zip");if(!V&&!K&&!U&&!X&&!W)i("Nothing to edit. Provide at least one flag."),process.exit(1);h$(O.default.bgMagenta(O.default.white(" petdex edit ")));let H=s0();H.start(`Resolving ${J}`);let j=await fetch(`${l}/api/pets/${J}`,{headers:{Authorization:`Bearer ${Y}`}});if(!j.ok)H.stop(O.default.red("not found")),i(`Pet "${J}" not found or you don't own it.`),process.exit(1);let Z=(await j.json()).id;if(!Z)H.stop(O.default.red("could not resolve pet id")),process.exit(1);H.stop(`Found ${O.default.cyan(J)}`);let L={};if(V)L.description=V;if(K)L.displayName=K;if(U||X||W){H.start("Uploading assets");let P=await fetch(`${l}/api/cli/edit-presign`,{method:"POST",headers:{Authorization:`Bearer ${Y}`,"Content-Type":"application/json"},body:JSON.stringify({petId:Z,hasSprite:Boolean(U),hasMeta:Boolean(X),hasZip:Boolean(W)})});if(P.ok){let B=await P.json(),M=(z)=>B.files?.find((D)=>D.role===z)??null;if(U){let z=await import("node:fs/promises").then((v)=>v.readFile(U)),D=U.endsWith(".png")?"image/png":"image/webp",w=M("sprite");if(w){await f1(w.uploadUrl,z,D);let{width:v,height:k}=Yq(z);if(L.spritesheetUrl=w.publicUrl,v)L.spritesheetWidth=v;if(k)L.spritesheetHeight=k}}if(X){let z=await import("node:fs/promises").then((w)=>w.readFile(X)),D=M("petjson");if(D)await f1(D.uploadUrl,z,"application/json"),L.petJsonUrl=D.publicUrl}if(W){let z=await import("node:fs/promises").then((w)=>w.readFile(W)),D=M("zip");if(D)await f1(D.uploadUrl,z,"application/zip"),L.zipUrl=D.publicUrl}H.stop("Assets uploaded")}else H.stop(O.default.yellow("presign endpoint unavailable, skipping asset upload"))}H.start("Submitting edit");let N=await fetch(`${l}/api/my-pets/${Z}/edit`,{method:"PATCH",headers:{Authorization:`Bearer ${Y}`,"Content-Type":"application/json",Origin:l},body:JSON.stringify(L)});if(!N.ok){let P=await N.text().catch(()=>"");H.stop(O.default.red(`edit failed: ${N.status}`)),i(P.slice(0,120)),process.exit(1)}let I=await N.json();H.stop(I.status==="auto_approved"?`${O.default.green("✓")} Edit auto-approved and live`:`${O.default.yellow("·")} Edit queued for admin review`),N4("cli_edit_invoked",{cli_version:f6}),u1(`Gallery: ${O.default.underline(`${l}/pets/${J}`)}`)}async function Cj($,Q){if(!Q){if(!$.endsWith(".zip"))throw Error(`Expected a .zip file or a folder, got: ${$}`);let G=await Aj($);return G?[G]:[]}if(await h6(J0.join($,"pet.json"))){let G=await a4($);return G?[G]:[]}let q=await jj($,{withFileTypes:!0}),Y=[];for(let G of q){if(!G.isDirectory())continue;let V=J0.join($,G.name),K=await a4(V);if(K)Y.push(K)}return Y}async function a4($){let Q=J0.join($,"pet.json");if(!await h6(Q))return null;let J=J0.join($,"spritesheet.webp"),q="webp";if(!await h6(J)){let W=J0.join($,"spritesheet.png");if(!await h6(W))return null;J=W,q="png"}let Y=await $Q(Q,"utf8"),G={};try{G=JSON.parse(Y)}catch{throw Error(`pet.json in ${$} is not valid JSON`)}let V=await $Q(J),K=new QQ.default;K.file("pet.json",Y),K.file(`spritesheet.${q}`,V);let U=Buffer.from(await K.generateAsync({type:"uint8array",compression:"DEFLATE"})),X=J0.basename($);return{label:X,source:"folder",petJson:Y,petJsonObj:G,zipBuffer:U,zipFileName:`${X}.zip`,spritesheetBuffer:V,spritesheetExt:q,petIdHint:typeof G.id==="string"?G.id:X}}async function Aj($){let Q=await $Q($),J=await QQ.default.loadAsync(Q),q=J.file("pet.json"),Y=J.file("spritesheet.webp"),G=J.file("spritesheet.png"),V=Y??G,K=Y?"webp":"png";if(!q||!V)throw Error(`Zip is missing pet.json or spritesheet.{webp,png}: ${$}`);let U=await q.async("string"),X={};try{X=JSON.parse(U)}catch{throw Error("pet.json in zip is not valid JSON")}let W=Buffer.from(await V.async("uint8array")),H=J0.basename($,".zip");return{label:H,source:"zip",petJson:U,petJsonObj:X,zipBuffer:Q,zipFileName:J0.basename($),spritesheetBuffer:W,spritesheetExt:K,petIdHint:typeof X.id==="string"?X.id:H}}async function Rj($,Q){let{width:J,height:q}=Yq($.spritesheetBuffer);if(J===0||q===0)throw Error("spritesheet dimensions could not be parsed");let Y=await fetch(`${l}/api/cli/submit`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({slugHint:C$($.petIdHint),petId:$.petIdHint,spritesheetExt:$.spritesheetExt})});if(!Y.ok){let F=await Y.text().catch(()=>"");throw Error(`presign ${Y.status} ${F.slice(0,100)}`)}let G=await Y.json(),V=(F)=>{let Z=G.files.find((L)=>L.role===F);if(!Z)throw Error(`presign response missing ${F}`);return Z},K=V("zip"),U=V("sprite"),X=V("petjson"),W=$.spritesheetExt==="png"?"image/png":"image/webp";await Promise.all([f1(K.uploadUrl,$.zipBuffer,"application/zip"),f1(U.uploadUrl,$.spritesheetBuffer,W),f1(X.uploadUrl,Buffer.from($.petJson,"utf8"),"application/json")]);let H=await fetch(`${l}/api/cli/submit/register`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({zipUrl:K.publicUrl,spritesheetUrl:U.publicUrl,petJsonUrl:X.publicUrl,petId:$.petIdHint,displayName:s4($.petJsonObj.displayName,"Untitled pet"),description:s4($.petJsonObj.description,"A Codex-compatible digital pet."),spritesheetWidth:J,spritesheetHeight:q})});if(!H.ok){let F=await H.text().catch(()=>"");throw Error(`register ${H.status} ${F.slice(0,100)}`)}return await H.json()}function kj($){let Q=O.default.dim($.slug),J=Ej($.review);if($.review.decision==="approved")return`${Q} ${O.default.green("approved")}`;if($.review.decision==="rejected")return`${Q} ${O.default.red("rejected")}${J?O.default.dim(`: ${J}`):""}`;return`${Q} ${O.default.yellow("held for review")}${J?O.default.dim(`: ${J}`):""}`}function Ej($){let Q=$.reasonCode??"";if(Q.startsWith("duplicate_"))return $.summary??"appears to duplicate an existing pet";if(Q.startsWith("policy_"))return"possible policy issue";if(Q.startsWith("asset_"))return"package file or spritesheet issue";if(Q==="review_timeout")return"automated review timed out";if(Q==="review_error"||Q==="review_failed")return"automated review failed";if($.decision==="rejected")return"high-confidence automated review issue";if($.decision==="hold")return"not confident enough to approve automatically";return null}async function f1($,Q,J){let q=await fetch($,{method:"PUT",headers:{"Content-Type":J},body:Q});if(!q.ok)throw Error(`R2 PUT ${q.status}`)}async function xj($,Q){let J=new Map;if($.length===0)return J;try{let q=await fetch(`${l}/api/cli/submit/check`,{method:"POST",headers:{Authorization:`Bearer ${Q}`,"Content-Type":"application/json"},body:JSON.stringify({candidates:$.map((G)=>({petId:G.petIdHint,slugHint:C$(G.petIdHint)}))}),signal:AbortSignal.timeout(8000)});if(!q.ok)return J;let Y=await q.json();for(let G of Y.existing??[])if(G&&typeof G.slug==="string")J.set(G.slug,G)}catch{}return J}function Sj($){let Q=$.toLowerCase();if(Q.includes("invalid_client")||Q.includes("client does not exist"))return["Clerk OAuth rejected this CLI build (invalid_client).","This usually means your installed CLI is out of date. Try:"," npm cache clean --force && npx -y petdex@latest login","If it still fails: https://github.com/crafter-station/petdex/issues"].join(`
|
|
94
|
+
`);if(Q.includes("invalid_grant")||Q.includes("does not match the redirect"))return["OAuth callback was rejected by Clerk (invalid_grant).","Common cause: you closed the browser before approving, or the local","callback server timed out. Try `petdex login` again."].join(`
|
|
95
|
+
`);if(Q.includes("redirect_uri")&&Q.includes("pre-registered"))return["Clerk OAuth rejected the local callback URL.","The petdex OAuth Application needs http://127.0.0.1 in its allowed","redirect URLs. Please file an issue:"," https://github.com/crafter-station/petdex/issues"].join(`
|
|
96
|
+
`);return $}async function h6($){try{return await t4($),!0}catch{return!1}}function s4($,Q){if(typeof $==="string"&&$.trim())return $.trim();return Q}function b6($){return typeof $==="string"&&$.trim()?$.trim():null}function Jq(...$){for(let Q of $){let J=b6(Q);if(J)return J}return null}function qq($){let Q=l.replace(/\/+$/,""),J=$.startsWith("/")?$:`/${$}`;return`${Q}${J}`}function gj($){if(!$)return null;if($.startsWith("http://")||$.startsWith("https://"))return $;return qq($)}function Tj($){let Q=Jq($?.preferred_username,$?.username)??(typeof $?.sub==="string"?$.sub.slice(-8).toLowerCase():null);return Q?qq(`/u/${encodeURIComponent(Q.toLowerCase())}`):l}function yj($){return $.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function C$($){let Q=yj($);if(Q)return Q;let J=$.trim();if(!J)return"";let q=2166136261;for(let Y of new TextEncoder().encode(J))q^=Y,q=Math.imul(q,16777619)>>>0;return`pet-${q.toString(36).padStart(7,"0")}`}function Yq($){if($.length>24&&$[0]===137&&$[1]===80&&$[2]===78&&$[3]===71)return{width:$.readUInt32BE(16),height:$.readUInt32BE(20)};if($.length>30&&$.slice(0,4).toString()==="RIFF"&&$.slice(8,12).toString()==="WEBP"){let Q=$.slice(12,16).toString();if(Q==="VP8X")return{width:(($[24]|$[25]<<8|$[26]<<16)>>>0)+1,height:(($[27]|$[28]<<8|$[29]<<16)>>>0)+1};if(Q==="VP8L"){let J=$[22],q=$[23],Y=$[24];return{width:(($[21]|(J&63)<<8)>>>0)+1,height:((J>>6|q<<2|(Y&15)<<10)>>>0)+1}}if(Q==="VP8 "){for(let J=23;J<Math.min(60,$.length-7);J++)if($[J]===157&&$[J+1]===1&&$[J+2]===42)return{width:($[J+3]|$[J+4]<<8)&16383,height:($[J+5]|$[J+6]<<8)&16383}}}return{width:0,height:0}}function hj($){let Q=$[0];if(Q==="on"||Q==="off"){let J=Q==="on";if(M4(J))console.log(J?"Telemetry enabled":"Telemetry disabled");else console.error(O.default.red(`${O.default.bold("Failed to persist preference.")} ~/.petdex/telemetry.json is not writable. Check filesystem permissions, then run \`petdex telemetry ${Q}\` again.`)),process.exit(1)}else if(Q==="status"||!Q){let J=I4();if(console.log(`Status: ${J.enabled?"enabled":"disabled"}`),J.install_id)console.log(`Install ID: ${J.install_id}`)}else console.error(O.default.red(`Unknown telemetry subcommand: ${Q}`)),console.error("Use: petdex telemetry [on|off|status]"),process.exit(1)}
|