blink 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/main.cjs +21 -21
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -1,29 +1,29 @@
1
1
  #!/usr/bin/env node
2
- var HY=Object.create;var{getPrototypeOf:jY,defineProperty:EJ,getOwnPropertyNames:VY}=Object;var KY=Object.prototype.hasOwnProperty;var J1=($,J,Q)=>{Q=$!=null?HY(jY($)):{};let X=J||!$||!$.__esModule?EJ(Q,"default",{value:$,enumerable:!0}):Q;for(let Y of VY($))if(!KY.call(X,Y))EJ(X,Y,{get:()=>$[Y],enumerable:!0});return X};var n=($,J)=>()=>(J||$((J={exports:{}}).exports,J),J.exports);var RY=($,J)=>{for(var Q in J)EJ($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(X)=>J[Q]=()=>X})};var q0=n((IJ)=>{class AJ extends Error{constructor($,J,Q){super(Q);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=J,this.exitCode=$,this.nestedError=void 0}}class a6 extends AJ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}IJ.CommanderError=AJ;IJ.InvalidArgumentError=a6});var m0=n((SJ)=>{var{InvalidArgumentError:WY}=q0();class s6{constructor($,J){switch(this.description=J||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue($,J){if(J===this.defaultValue||!Array.isArray(J))return[$];return J.concat($)}default($,J){return this.defaultValue=$,this.defaultValueDescription=J,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(J,Q)=>{if(!this.argChoices.includes(J))throw new WY(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(J,Q);return J},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function qY($){let J=$.name()+($.variadic===!0?"...":"");return $.required?"<"+J+">":"["+J+"]"}SJ.Argument=s6;SJ.humanReadableArgName=qY});var zJ=n((e6)=>{var{humanReadableArgName:MY}=m0();class t6{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands($){let J=$.commands.filter((Q)=>!Q._hidden);if($._hasImplicitHelpCommand()){let[,Q,X]=$._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),Y=$.createCommand(Q).helpOption(!1);if(Y.description($._helpCommandDescription),X)Y.arguments(X);J.push(Y)}if(this.sortSubcommands)J.sort((Q,X)=>{return Q.name().localeCompare(X.name())});return J}compareOptions($,J){let Q=(X)=>{return X.short?X.short.replace(/^-/,""):X.long.replace(/^--/,"")};return Q($).localeCompare(Q(J))}visibleOptions($){let J=$.options.filter((Y)=>!Y.hidden),Q=$._hasHelpOption&&$._helpShortFlag&&!$._findOption($._helpShortFlag),X=$._hasHelpOption&&!$._findOption($._helpLongFlag);if(Q||X){let Y;if(!Q)Y=$.createOption($._helpLongFlag,$._helpDescription);else if(!X)Y=$.createOption($._helpShortFlag,$._helpDescription);else Y=$.createOption($._helpFlags,$._helpDescription);J.push(Y)}if(this.sortOptions)J.sort(this.compareOptions);return J}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let J=[];for(let Q=$.parent;Q;Q=Q.parent){let X=Q.options.filter((Y)=>!Y.hidden);J.push(...X)}if(this.sortOptions)J.sort(this.compareOptions);return J}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((J)=>{J.description=J.description||$._argsDescription[J.name()]||""});if($.registeredArguments.find((J)=>J.description))return $.registeredArguments;return[]}subcommandTerm($){let J=$.registeredArguments.map((Q)=>MY(Q)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(J?" "+J:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,J){return J.visibleCommands($).reduce((Q,X)=>{return Math.max(Q,J.subcommandTerm(X).length)},0)}longestOptionTermLength($,J){return J.visibleOptions($).reduce((Q,X)=>{return Math.max(Q,J.optionTerm(X).length)},0)}longestGlobalOptionTermLength($,J){return J.visibleGlobalOptions($).reduce((Q,X)=>{return Math.max(Q,J.optionTerm(X).length)},0)}longestArgumentTermLength($,J){return J.visibleArguments($).reduce((Q,X)=>{return Math.max(Q,J.argumentTerm(X).length)},0)}commandUsage($){let J=$._name;if($._aliases[0])J=J+"|"+$._aliases[0];let Q="";for(let X=$.parent;X;X=X.parent)Q=X.name()+" "+Q;return Q+J+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let J=[];if($.argChoices)J.push(`choices: ${$.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")J.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)J.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)J.push(`env: ${$.envVar}`);if(J.length>0)return`${$.description} (${J.join(", ")})`;return $.description}argumentDescription($){let J=[];if($.argChoices)J.push(`choices: ${$.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if($.defaultValue!==void 0)J.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(J.length>0){let Q=`(${J.join(", ")})`;if($.description)return`${$.description} ${Q}`;return Q}return $.description}formatHelp($,J){let Q=J.padWidth($,J),X=J.helpWidth||80,Y=2,H=2;function M(R,D){if(D){let j=`${R.padEnd(Q+2)}${D}`;return J.wrap(j,X-2,Q+2)}return R}function G(R){return R.join(`
2
+ var HY=Object.create;var{getPrototypeOf:jY,defineProperty:EJ,getOwnPropertyNames:VY}=Object;var KY=Object.prototype.hasOwnProperty;var J$=($,J,Q)=>{Q=$!=null?HY(jY($)):{};let X=J||!$||!$.__esModule?EJ(Q,"default",{value:$,enumerable:!0}):Q;for(let Y of VY($))if(!KY.call(X,Y))EJ(X,Y,{get:()=>$[Y],enumerable:!0});return X};var n=($,J)=>()=>(J||$((J={exports:{}}).exports,J),J.exports);var RY=($,J)=>{for(var Q in J)EJ($,Q,{get:J[Q],enumerable:!0,configurable:!0,set:(X)=>J[Q]=()=>X})};var M0=n((IJ)=>{class AJ extends Error{constructor($,J,Q){super(Q);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=J,this.exitCode=$,this.nestedError=void 0}}class a6 extends AJ{constructor($){super(1,"commander.invalidArgument",$);Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}}IJ.CommanderError=AJ;IJ.InvalidArgumentError=a6});var u0=n((SJ)=>{var{InvalidArgumentError:WY}=M0();class s6{constructor($,J){switch(this.description=J||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,$[0]){case"<":this.required=!0,this._name=$.slice(1,-1);break;case"[":this.required=!1,this._name=$.slice(1,-1);break;default:this.required=!0,this._name=$;break}if(this._name.length>3&&this._name.slice(-3)==="...")this.variadic=!0,this._name=this._name.slice(0,-3)}name(){return this._name}_concatValue($,J){if(J===this.defaultValue||!Array.isArray(J))return[$];return J.concat($)}default($,J){return this.defaultValue=$,this.defaultValueDescription=J,this}argParser($){return this.parseArg=$,this}choices($){return this.argChoices=$.slice(),this.parseArg=(J,Q)=>{if(!this.argChoices.includes(J))throw new WY(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(J,Q);return J},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}}function qY($){let J=$.name()+($.variadic===!0?"...":"");return $.required?"<"+J+">":"["+J+"]"}SJ.Argument=s6;SJ.humanReadableArgName=qY});var zJ=n((e6)=>{var{humanReadableArgName:MY}=u0();class t6{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands($){let J=$.commands.filter((Q)=>!Q._hidden);if($._hasImplicitHelpCommand()){let[,Q,X]=$._helpCommandnameAndArgs.match(/([^ ]+) *(.*)/),Y=$.createCommand(Q).helpOption(!1);if(Y.description($._helpCommandDescription),X)Y.arguments(X);J.push(Y)}if(this.sortSubcommands)J.sort((Q,X)=>{return Q.name().localeCompare(X.name())});return J}compareOptions($,J){let Q=(X)=>{return X.short?X.short.replace(/^-/,""):X.long.replace(/^--/,"")};return Q($).localeCompare(Q(J))}visibleOptions($){let J=$.options.filter((Y)=>!Y.hidden),Q=$._hasHelpOption&&$._helpShortFlag&&!$._findOption($._helpShortFlag),X=$._hasHelpOption&&!$._findOption($._helpLongFlag);if(Q||X){let Y;if(!Q)Y=$.createOption($._helpLongFlag,$._helpDescription);else if(!X)Y=$.createOption($._helpShortFlag,$._helpDescription);else Y=$.createOption($._helpFlags,$._helpDescription);J.push(Y)}if(this.sortOptions)J.sort(this.compareOptions);return J}visibleGlobalOptions($){if(!this.showGlobalOptions)return[];let J=[];for(let Q=$.parent;Q;Q=Q.parent){let X=Q.options.filter((Y)=>!Y.hidden);J.push(...X)}if(this.sortOptions)J.sort(this.compareOptions);return J}visibleArguments($){if($._argsDescription)$.registeredArguments.forEach((J)=>{J.description=J.description||$._argsDescription[J.name()]||""});if($.registeredArguments.find((J)=>J.description))return $.registeredArguments;return[]}subcommandTerm($){let J=$.registeredArguments.map((Q)=>MY(Q)).join(" ");return $._name+($._aliases[0]?"|"+$._aliases[0]:"")+($.options.length?" [options]":"")+(J?" "+J:"")}optionTerm($){return $.flags}argumentTerm($){return $.name()}longestSubcommandTermLength($,J){return J.visibleCommands($).reduce((Q,X)=>{return Math.max(Q,J.subcommandTerm(X).length)},0)}longestOptionTermLength($,J){return J.visibleOptions($).reduce((Q,X)=>{return Math.max(Q,J.optionTerm(X).length)},0)}longestGlobalOptionTermLength($,J){return J.visibleGlobalOptions($).reduce((Q,X)=>{return Math.max(Q,J.optionTerm(X).length)},0)}longestArgumentTermLength($,J){return J.visibleArguments($).reduce((Q,X)=>{return Math.max(Q,J.argumentTerm(X).length)},0)}commandUsage($){let J=$._name;if($._aliases[0])J=J+"|"+$._aliases[0];let Q="";for(let X=$.parent;X;X=X.parent)Q=X.name()+" "+Q;return Q+J+" "+$.usage()}commandDescription($){return $.description()}subcommandDescription($){return $.summary()||$.description()}optionDescription($){let J=[];if($.argChoices)J.push(`choices: ${$.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if($.defaultValue!==void 0){if($.required||$.optional||$.isBoolean()&&typeof $.defaultValue==="boolean")J.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`)}if($.presetArg!==void 0&&$.optional)J.push(`preset: ${JSON.stringify($.presetArg)}`);if($.envVar!==void 0)J.push(`env: ${$.envVar}`);if(J.length>0)return`${$.description} (${J.join(", ")})`;return $.description}argumentDescription($){let J=[];if($.argChoices)J.push(`choices: ${$.argChoices.map((Q)=>JSON.stringify(Q)).join(", ")}`);if($.defaultValue!==void 0)J.push(`default: ${$.defaultValueDescription||JSON.stringify($.defaultValue)}`);if(J.length>0){let Q=`(${J.join(", ")})`;if($.description)return`${$.description} ${Q}`;return Q}return $.description}formatHelp($,J){let Q=J.padWidth($,J),X=J.helpWidth||80,Y=2,H=2;function M(R,D){if(D){let j=`${R.padEnd(Q+2)}${D}`;return J.wrap(j,X-2,Q+2)}return R}function G(R){return R.join(`
3
3
  `).replace(/^/gm," ".repeat(2))}let K=[`Usage: ${J.commandUsage($)}`,""],q=J.commandDescription($);if(q.length>0)K=K.concat([J.wrap(q,X,0),""]);let W=J.visibleArguments($).map((R)=>{return M(J.argumentTerm(R),J.argumentDescription(R))});if(W.length>0)K=K.concat(["Arguments:",G(W),""]);let B=J.visibleOptions($).map((R)=>{return M(J.optionTerm(R),J.optionDescription(R))});if(B.length>0)K=K.concat(["Options:",G(B),""]);if(this.showGlobalOptions){let R=J.visibleGlobalOptions($).map((D)=>{return M(J.optionTerm(D),J.optionDescription(D))});if(R.length>0)K=K.concat(["Global Options:",G(R),""])}let U=J.visibleCommands($).map((R)=>{return M(J.subcommandTerm(R),J.subcommandDescription(R))});if(U.length>0)K=K.concat(["Commands:",G(U),""]);return K.join(`
4
4
  `)}padWidth($,J){return Math.max(J.longestOptionTermLength($,J),J.longestGlobalOptionTermLength($,J),J.longestSubcommandTermLength($,J),J.longestArgumentTermLength($,J))}wrap($,J,Q,X=40){let H=new RegExp(`[\\n][${" \\f\\t\\v   -    \uFEFF"}]+`);if($.match(H))return $;let M=J-Q;if(M<X)return $;let G=$.slice(0,Q),K=$.slice(Q).replace(`\r
5
5
  `,`
6
6
  `),q=" ".repeat(Q),B=`\\s${"​"}`,U=new RegExp(`
7
7
  |.{1,${M-1}}([${B}]|$)|[^${B}]+?([${B}]|$)`,"g"),R=K.match(U)||[];return G+R.map((D,j)=>{if(D===`
8
8
  `)return"";return(j>0?q:"")+D.trimEnd()}).join(`
9
- `)}}e6.Help=t6});var PJ=n((u0)=>{var{InvalidArgumentError:BY}=q0();class $8{constructor($,J){this.flags=$,this.description=J||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let Q=Q8($);if(this.short=Q.shortFlag,this.long=Q.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default($,J){return this.defaultValue=$,this.defaultValueDescription=J,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let J=$;if(typeof $==="string")J={[$]:!0};return this.implied=Object.assign(this.implied||{},J),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_concatValue($,J){if(J===this.defaultValue||!Array.isArray(J))return[$];return J.concat($)}choices($){return this.argChoices=$.slice(),this.parseArg=(J,Q)=>{if(!this.argChoices.includes(J))throw new BY(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(J,Q);return J},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return NY(this.name().replace(/^no-/,""))}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class J8{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((J)=>{if(J.negate)this.negativeOptions.set(J.attributeName(),J);else this.positiveOptions.set(J.attributeName(),J)}),this.negativeOptions.forEach((J,Q)=>{if(this.positiveOptions.has(Q))this.dualOptions.add(Q)})}valueFromOption($,J){let Q=J.attributeName();if(!this.dualOptions.has(Q))return!0;let X=this.negativeOptions.get(Q).presetArg,Y=X!==void 0?X:!1;return J.negate===(Y===$)}}function NY($){return $.split("-").reduce((J,Q)=>{return J+Q[0].toUpperCase()+Q.slice(1)})}function Q8($){let J,Q,X=$.split(/[ |,]+/);if(X.length>1&&!/^[[<]/.test(X[1]))J=X.shift();if(Q=X.shift(),!J&&/^-[^-]$/.test(Q))J=Q,Q=void 0;return{shortFlag:J,longFlag:Q}}u0.Option=$8;u0.splitOptionFlags=Q8;u0.DualOptions=J8});var Y8=n((X8)=>{function UY($,J){if(Math.abs($.length-J.length)>3)return Math.max($.length,J.length);let Q=[];for(let X=0;X<=$.length;X++)Q[X]=[X];for(let X=0;X<=J.length;X++)Q[0][X]=X;for(let X=1;X<=J.length;X++)for(let Y=1;Y<=$.length;Y++){let H=1;if($[Y-1]===J[X-1])H=0;else H=1;if(Q[Y][X]=Math.min(Q[Y-1][X]+1,Q[Y][X-1]+1,Q[Y-1][X-1]+H),Y>1&&X>1&&$[Y-1]===J[X-2]&&$[Y-2]===J[X-1])Q[Y][X]=Math.min(Q[Y][X],Q[Y-2][X-2]+1)}return Q[$.length][J.length]}function FY($,J){if(!J||J.length===0)return"";J=Array.from(new Set(J));let Q=$.startsWith("--");if(Q)$=$.slice(2),J=J.map((M)=>M.slice(2));let X=[],Y=3,H=0.4;if(J.forEach((M)=>{if(M.length<=1)return;let G=UY($,M),K=Math.max($.length,M.length);if((K-G)/K>H){if(G<Y)Y=G,X=[M];else if(G===Y)X.push(M)}}),X.sort((M,G)=>M.localeCompare(G)),Q)X=X.map((M)=>`--${M}`);if(X.length>1)return`
9
+ `)}}e6.Help=t6});var PJ=n((l0)=>{var{InvalidArgumentError:BY}=M0();class $8{constructor($,J){this.flags=$,this.description=J||"",this.required=$.includes("<"),this.optional=$.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test($),this.mandatory=!1;let Q=Q8($);if(this.short=Q.shortFlag,this.long=Q.longFlag,this.negate=!1,this.long)this.negate=this.long.startsWith("--no-");this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default($,J){return this.defaultValue=$,this.defaultValueDescription=J,this}preset($){return this.presetArg=$,this}conflicts($){return this.conflictsWith=this.conflictsWith.concat($),this}implies($){let J=$;if(typeof $==="string")J={[$]:!0};return this.implied=Object.assign(this.implied||{},J),this}env($){return this.envVar=$,this}argParser($){return this.parseArg=$,this}makeOptionMandatory($=!0){return this.mandatory=!!$,this}hideHelp($=!0){return this.hidden=!!$,this}_concatValue($,J){if(J===this.defaultValue||!Array.isArray(J))return[$];return J.concat($)}choices($){return this.argChoices=$.slice(),this.parseArg=(J,Q)=>{if(!this.argChoices.includes(J))throw new BY(`Allowed choices are ${this.argChoices.join(", ")}.`);if(this.variadic)return this._concatValue(J,Q);return J},this}name(){if(this.long)return this.long.replace(/^--/,"");return this.short.replace(/^-/,"")}attributeName(){return NY(this.name().replace(/^no-/,""))}is($){return this.short===$||this.long===$}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class J8{constructor($){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,$.forEach((J)=>{if(J.negate)this.negativeOptions.set(J.attributeName(),J);else this.positiveOptions.set(J.attributeName(),J)}),this.negativeOptions.forEach((J,Q)=>{if(this.positiveOptions.has(Q))this.dualOptions.add(Q)})}valueFromOption($,J){let Q=J.attributeName();if(!this.dualOptions.has(Q))return!0;let X=this.negativeOptions.get(Q).presetArg,Y=X!==void 0?X:!1;return J.negate===(Y===$)}}function NY($){return $.split("-").reduce((J,Q)=>{return J+Q[0].toUpperCase()+Q.slice(1)})}function Q8($){let J,Q,X=$.split(/[ |,]+/);if(X.length>1&&!/^[[<]/.test(X[1]))J=X.shift();if(Q=X.shift(),!J&&/^-[^-]$/.test(Q))J=Q,Q=void 0;return{shortFlag:J,longFlag:Q}}l0.Option=$8;l0.splitOptionFlags=Q8;l0.DualOptions=J8});var Y8=n((X8)=>{function UY($,J){if(Math.abs($.length-J.length)>3)return Math.max($.length,J.length);let Q=[];for(let X=0;X<=$.length;X++)Q[X]=[X];for(let X=0;X<=J.length;X++)Q[0][X]=X;for(let X=1;X<=J.length;X++)for(let Y=1;Y<=$.length;Y++){let H=1;if($[Y-1]===J[X-1])H=0;else H=1;if(Q[Y][X]=Math.min(Q[Y-1][X]+1,Q[Y][X-1]+1,Q[Y-1][X-1]+H),Y>1&&X>1&&$[Y-1]===J[X-2]&&$[Y-2]===J[X-1])Q[Y][X]=Math.min(Q[Y][X],Q[Y-2][X-2]+1)}return Q[$.length][J.length]}function FY($,J){if(!J||J.length===0)return"";J=Array.from(new Set(J));let Q=$.startsWith("--");if(Q)$=$.slice(2),J=J.map((M)=>M.slice(2));let X=[],Y=3,H=0.4;if(J.forEach((M)=>{if(M.length<=1)return;let G=UY($,M),K=Math.max($.length,M.length);if((K-G)/K>H){if(G<Y)Y=G,X=[M];else if(G===Y)X.push(M)}}),X.sort((M,G)=>M.localeCompare(G)),Q)X=X.map((M)=>`--${M}`);if(X.length>1)return`
10
10
  (Did you mean one of ${X.join(", ")}?)`;if(X.length===1)return`
11
- (Did you mean ${X[0]}?)`;return""}X8.suggestSimilar=FY});var R8=n((K8)=>{var DY=require("events").EventEmitter,CJ=require("child_process"),n1=require("path"),wJ=require("fs"),Y1=require("process"),{Argument:OY,humanReadableArgName:LY}=m0(),{CommanderError:_J}=q0(),{Help:EY}=zJ(),{Option:G8,splitOptionFlags:AY,DualOptions:IY}=PJ(),{suggestSimilar:H8}=Y8();class ZJ extends DY{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:(J)=>Y1.stdout.write(J),writeErr:(J)=>Y1.stderr.write(J),getOutHelpWidth:()=>Y1.stdout.isTTY?Y1.stdout.columns:void 0,getErrHelpWidth:()=>Y1.stderr.isTTY?Y1.stderr.columns:void 0,outputError:(J,Q)=>Q(J)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._hasHelpOption=$._hasHelpOption,this._helpFlags=$._helpFlags,this._helpDescription=$._helpDescription,this._helpShortFlag=$._helpShortFlag,this._helpLongFlag=$._helpLongFlag,this._helpCommandName=$._helpCommandName,this._helpCommandnameAndArgs=$._helpCommandnameAndArgs,this._helpCommandDescription=$._helpCommandDescription,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let J=this;J;J=J.parent)$.push(J);return $}command($,J,Q){let X=J,Y=Q;if(typeof X==="object"&&X!==null)Y=X,X=null;Y=Y||{};let[,H,M]=$.match(/([^ ]+) *(.*)/),G=this.createCommand(H);if(X)G.description(X),G._executableHandler=!0;if(Y.isDefault)this._defaultCommandName=G._name;if(G._hidden=!!(Y.noHelp||Y.hidden),G._executableFile=Y.executableFile||null,M)G.arguments(M);if(this.commands.push(G),G.parent=this,G.copyInheritedSettings(this),X)return this;return G}createCommand($){return new ZJ($)}createHelp(){return Object.assign(new EY,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,$),this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,J){if(!$._name)throw new Error(`Command passed to .addCommand() must have a name
11
+ (Did you mean ${X[0]}?)`;return""}X8.suggestSimilar=FY});var R8=n((K8)=>{var DY=require("events").EventEmitter,CJ=require("child_process"),n$=require("path"),wJ=require("fs"),Y$=require("process"),{Argument:OY,humanReadableArgName:LY}=u0(),{CommanderError:_J}=M0(),{Help:EY}=zJ(),{Option:G8,splitOptionFlags:AY,DualOptions:IY}=PJ(),{suggestSimilar:H8}=Y8();class ZJ extends DY{constructor($){super();this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=$||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:(J)=>Y$.stdout.write(J),writeErr:(J)=>Y$.stderr.write(J),getOutHelpWidth:()=>Y$.stdout.isTTY?Y$.stdout.columns:void 0,getErrHelpWidth:()=>Y$.stderr.isTTY?Y$.stderr.columns:void 0,outputError:(J,Q)=>Q(J)},this._hidden=!1,this._hasHelpOption=!0,this._helpFlags="-h, --help",this._helpDescription="display help for command",this._helpShortFlag="-h",this._helpLongFlag="--help",this._addImplicitHelpCommand=void 0,this._helpCommandName="help",this._helpCommandnameAndArgs="help [command]",this._helpCommandDescription="display help for command",this._helpConfiguration={}}copyInheritedSettings($){return this._outputConfiguration=$._outputConfiguration,this._hasHelpOption=$._hasHelpOption,this._helpFlags=$._helpFlags,this._helpDescription=$._helpDescription,this._helpShortFlag=$._helpShortFlag,this._helpLongFlag=$._helpLongFlag,this._helpCommandName=$._helpCommandName,this._helpCommandnameAndArgs=$._helpCommandnameAndArgs,this._helpCommandDescription=$._helpCommandDescription,this._helpConfiguration=$._helpConfiguration,this._exitCallback=$._exitCallback,this._storeOptionsAsProperties=$._storeOptionsAsProperties,this._combineFlagAndOptionalValue=$._combineFlagAndOptionalValue,this._allowExcessArguments=$._allowExcessArguments,this._enablePositionalOptions=$._enablePositionalOptions,this._showHelpAfterError=$._showHelpAfterError,this._showSuggestionAfterError=$._showSuggestionAfterError,this}_getCommandAndAncestors(){let $=[];for(let J=this;J;J=J.parent)$.push(J);return $}command($,J,Q){let X=J,Y=Q;if(typeof X==="object"&&X!==null)Y=X,X=null;Y=Y||{};let[,H,M]=$.match(/([^ ]+) *(.*)/),G=this.createCommand(H);if(X)G.description(X),G._executableHandler=!0;if(Y.isDefault)this._defaultCommandName=G._name;if(G._hidden=!!(Y.noHelp||Y.hidden),G._executableFile=Y.executableFile||null,M)G.arguments(M);if(this.commands.push(G),G.parent=this,G.copyInheritedSettings(this),X)return this;return G}createCommand($){return new ZJ($)}createHelp(){return Object.assign(new EY,this.configureHelp())}configureHelp($){if($===void 0)return this._helpConfiguration;return this._helpConfiguration=$,this}configureOutput($){if($===void 0)return this._outputConfiguration;return Object.assign(this._outputConfiguration,$),this}showHelpAfterError($=!0){if(typeof $!=="string")$=!!$;return this._showHelpAfterError=$,this}showSuggestionAfterError($=!0){return this._showSuggestionAfterError=!!$,this}addCommand($,J){if(!$._name)throw new Error(`Command passed to .addCommand() must have a name
12
12
  - specify the name in Command constructor or using .name()`);if(J=J||{},J.isDefault)this._defaultCommandName=$._name;if(J.noHelp||J.hidden)$._hidden=!0;return this.commands.push($),$.parent=this,this}createArgument($,J){return new OY($,J)}argument($,J,Q,X){let Y=this.createArgument($,J);if(typeof Q==="function")Y.default(X).argParser(Q);else Y.default(Q);return this.addArgument(Y),this}arguments($){return $.trim().split(/ +/).forEach((J)=>{this.argument(J)}),this}addArgument($){let J=this.registeredArguments.slice(-1)[0];if(J&&J.variadic)throw new Error(`only the last argument can be variadic '${J.name()}'`);if($.required&&$.defaultValue!==void 0&&$.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${$.name()}'`);return this.registeredArguments.push($),this}addHelpCommand($,J){if($===!1)this._addImplicitHelpCommand=!1;else{if(this._addImplicitHelpCommand=!0,typeof $==="string")this._helpCommandName=$.split(" ")[0],this._helpCommandnameAndArgs=$;this._helpCommandDescription=J||this._helpCommandDescription}return this}_hasImplicitHelpCommand(){if(this._addImplicitHelpCommand===void 0)return this.commands.length&&!this._actionHandler&&!this._findCommand("help");return this._addImplicitHelpCommand}hook($,J){let Q=["preSubcommand","preAction","postAction"];if(!Q.includes($))throw new Error(`Unexpected value for event passed to hook : '${$}'.
13
- Expecting one of '${Q.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(J);else this._lifeCycleHooks[$]=[J];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(J)=>{if(J.code!=="commander.executeSubCommandAsync")throw J};return this}_exit($,J,Q){if(this._exitCallback)this._exitCallback(new _J($,J,Q));Y1.exit($)}action($){let J=(Q)=>{let X=this.registeredArguments.length,Y=Q.slice(0,X);if(this._storeOptionsAsProperties)Y[X]=this;else Y[X]=this.opts();return Y.push(this),$.apply(this,Y)};return this._actionHandler=J,this}createOption($,J){return new G8($,J)}_callParseArg($,J,Q,X){try{return $.parseArg(J,Q)}catch(Y){if(Y.code==="commander.invalidArgument"){let H=`${X} ${Y.message}`;this.error(H,{exitCode:Y.exitCode,code:Y.code})}throw Y}}addOption($){let J=$.name(),Q=$.attributeName();if($.negate){let Y=$.long.replace(/^--no-/,"--");if(!this._findOption(Y))this.setOptionValueWithSource(Q,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(Q,$.defaultValue,"default");this.options.push($);let X=(Y,H,M)=>{if(Y==null&&$.presetArg!==void 0)Y=$.presetArg;let G=this.getOptionValue(Q);if(Y!==null&&$.parseArg)Y=this._callParseArg($,Y,G,H);else if(Y!==null&&$.variadic)Y=$._concatValue(Y,G);if(Y==null)if($.negate)Y=!1;else if($.isBoolean()||$.optional)Y=!0;else Y="";this.setOptionValueWithSource(Q,Y,M)};if(this.on("option:"+J,(Y)=>{let H=`error: option '${$.flags}' argument '${Y}' is invalid.`;X(Y,H,"cli")}),$.envVar)this.on("optionEnv:"+J,(Y)=>{let H=`error: option '${$.flags}' value '${Y}' from env '${$.envVar}' is invalid.`;X(Y,H,"env")});return this}_optionEx($,J,Q,X,Y){if(typeof J==="object"&&J instanceof G8)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let H=this.createOption(J,Q);if(H.makeOptionMandatory(!!$.mandatory),typeof X==="function")H.default(Y).argParser(X);else if(X instanceof RegExp){let M=X;X=(G,K)=>{let q=M.exec(G);return q?q[0]:K},H.default(Y).argParser(X)}else H.default(X);return this.addOption(H)}option($,J,Q,X){return this._optionEx({},$,J,Q,X)}requiredOption($,J,Q,X){return this._optionEx({mandatory:!0},$,J,Q,X)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){if(this._passThroughOptions=!!$,!!this.parent&&$&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties($=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,J){return this.setOptionValueWithSource($,J,void 0)}setOptionValueWithSource($,J,Q){if(this._storeOptionsAsProperties)this[$]=J;else this._optionValues[$]=J;return this._optionValueSources[$]=Q,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let J;return this._getCommandAndAncestors().forEach((Q)=>{if(Q.getOptionValueSource($)!==void 0)J=Q.getOptionValueSource($)}),J}_prepareUserArgs($,J){if($!==void 0&&!Array.isArray($))throw new Error("first parameter to parse must be array or undefined");if(J=J||{},$===void 0){if($=Y1.argv,Y1.versions&&Y1.versions.electron)J.from="electron"}this.rawArgs=$.slice();let Q;switch(J.from){case void 0:case"node":this._scriptPath=$[1],Q=$.slice(2);break;case"electron":if(Y1.defaultApp)this._scriptPath=$[1],Q=$.slice(2);else Q=$.slice(1);break;case"user":Q=$.slice(0);break;default:throw new Error(`unexpected parse option { from: '${J.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",Q}parse($,J){let Q=this._prepareUserArgs($,J);return this._parseCommand([],Q),this}async parseAsync($,J){let Q=this._prepareUserArgs($,J);return await this._parseCommand([],Q),this}_executeSubCommand($,J){J=J.slice();let Q=!1,X=[".js",".ts",".tsx",".mjs",".cjs"];function Y(q,W){let B=n1.resolve(q,W);if(wJ.existsSync(B))return B;if(X.includes(n1.extname(W)))return;let U=X.find((R)=>wJ.existsSync(`${B}${R}`));if(U)return`${B}${U}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let H=$._executableFile||`${this._name}-${$._name}`,M=this._executableDir||"";if(this._scriptPath){let q;try{q=wJ.realpathSync(this._scriptPath)}catch(W){q=this._scriptPath}M=n1.resolve(n1.dirname(q),M)}if(M){let q=Y(M,H);if(!q&&!$._executableFile&&this._scriptPath){let W=n1.basename(this._scriptPath,n1.extname(this._scriptPath));if(W!==this._name)q=Y(M,`${W}-${$._name}`)}H=q||H}Q=X.includes(n1.extname(H));let G;if(Y1.platform!=="win32")if(Q)J.unshift(H),J=V8(Y1.execArgv).concat(J),G=CJ.spawn(Y1.argv[0],J,{stdio:"inherit"});else G=CJ.spawn(H,J,{stdio:"inherit"});else J.unshift(H),J=V8(Y1.execArgv).concat(J),G=CJ.spawn(Y1.execPath,J,{stdio:"inherit"});if(!G.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{Y1.on(W,()=>{if(G.killed===!1&&G.exitCode===null)G.kill(W)})});let K=this._exitCallback;if(!K)G.on("close",Y1.exit.bind(Y1));else G.on("close",()=>{K(new _J(Y1.exitCode||0,"commander.executeSubCommandAsync","(close)"))});G.on("error",(q)=>{if(q.code==="ENOENT"){let W=M?`searched for local subcommand relative to directory '${M}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",B=`'${H}' does not exist
13
+ Expecting one of '${Q.join("', '")}'`);if(this._lifeCycleHooks[$])this._lifeCycleHooks[$].push(J);else this._lifeCycleHooks[$]=[J];return this}exitOverride($){if($)this._exitCallback=$;else this._exitCallback=(J)=>{if(J.code!=="commander.executeSubCommandAsync")throw J};return this}_exit($,J,Q){if(this._exitCallback)this._exitCallback(new _J($,J,Q));Y$.exit($)}action($){let J=(Q)=>{let X=this.registeredArguments.length,Y=Q.slice(0,X);if(this._storeOptionsAsProperties)Y[X]=this;else Y[X]=this.opts();return Y.push(this),$.apply(this,Y)};return this._actionHandler=J,this}createOption($,J){return new G8($,J)}_callParseArg($,J,Q,X){try{return $.parseArg(J,Q)}catch(Y){if(Y.code==="commander.invalidArgument"){let H=`${X} ${Y.message}`;this.error(H,{exitCode:Y.exitCode,code:Y.code})}throw Y}}addOption($){let J=$.name(),Q=$.attributeName();if($.negate){let Y=$.long.replace(/^--no-/,"--");if(!this._findOption(Y))this.setOptionValueWithSource(Q,$.defaultValue===void 0?!0:$.defaultValue,"default")}else if($.defaultValue!==void 0)this.setOptionValueWithSource(Q,$.defaultValue,"default");this.options.push($);let X=(Y,H,M)=>{if(Y==null&&$.presetArg!==void 0)Y=$.presetArg;let G=this.getOptionValue(Q);if(Y!==null&&$.parseArg)Y=this._callParseArg($,Y,G,H);else if(Y!==null&&$.variadic)Y=$._concatValue(Y,G);if(Y==null)if($.negate)Y=!1;else if($.isBoolean()||$.optional)Y=!0;else Y="";this.setOptionValueWithSource(Q,Y,M)};if(this.on("option:"+J,(Y)=>{let H=`error: option '${$.flags}' argument '${Y}' is invalid.`;X(Y,H,"cli")}),$.envVar)this.on("optionEnv:"+J,(Y)=>{let H=`error: option '${$.flags}' value '${Y}' from env '${$.envVar}' is invalid.`;X(Y,H,"env")});return this}_optionEx($,J,Q,X,Y){if(typeof J==="object"&&J instanceof G8)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let H=this.createOption(J,Q);if(H.makeOptionMandatory(!!$.mandatory),typeof X==="function")H.default(Y).argParser(X);else if(X instanceof RegExp){let M=X;X=(G,K)=>{let q=M.exec(G);return q?q[0]:K},H.default(Y).argParser(X)}else H.default(X);return this.addOption(H)}option($,J,Q,X){return this._optionEx({},$,J,Q,X)}requiredOption($,J,Q,X){return this._optionEx({mandatory:!0},$,J,Q,X)}combineFlagAndOptionalValue($=!0){return this._combineFlagAndOptionalValue=!!$,this}allowUnknownOption($=!0){return this._allowUnknownOption=!!$,this}allowExcessArguments($=!0){return this._allowExcessArguments=!!$,this}enablePositionalOptions($=!0){return this._enablePositionalOptions=!!$,this}passThroughOptions($=!0){if(this._passThroughOptions=!!$,!!this.parent&&$&&!this.parent._enablePositionalOptions)throw new Error("passThroughOptions can not be used without turning on enablePositionalOptions for parent command(s)");return this}storeOptionsAsProperties($=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");return this._storeOptionsAsProperties=!!$,this}getOptionValue($){if(this._storeOptionsAsProperties)return this[$];return this._optionValues[$]}setOptionValue($,J){return this.setOptionValueWithSource($,J,void 0)}setOptionValueWithSource($,J,Q){if(this._storeOptionsAsProperties)this[$]=J;else this._optionValues[$]=J;return this._optionValueSources[$]=Q,this}getOptionValueSource($){return this._optionValueSources[$]}getOptionValueSourceWithGlobals($){let J;return this._getCommandAndAncestors().forEach((Q)=>{if(Q.getOptionValueSource($)!==void 0)J=Q.getOptionValueSource($)}),J}_prepareUserArgs($,J){if($!==void 0&&!Array.isArray($))throw new Error("first parameter to parse must be array or undefined");if(J=J||{},$===void 0){if($=Y$.argv,Y$.versions&&Y$.versions.electron)J.from="electron"}this.rawArgs=$.slice();let Q;switch(J.from){case void 0:case"node":this._scriptPath=$[1],Q=$.slice(2);break;case"electron":if(Y$.defaultApp)this._scriptPath=$[1],Q=$.slice(2);else Q=$.slice(1);break;case"user":Q=$.slice(0);break;default:throw new Error(`unexpected parse option { from: '${J.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);return this._name=this._name||"program",Q}parse($,J){let Q=this._prepareUserArgs($,J);return this._parseCommand([],Q),this}async parseAsync($,J){let Q=this._prepareUserArgs($,J);return await this._parseCommand([],Q),this}_executeSubCommand($,J){J=J.slice();let Q=!1,X=[".js",".ts",".tsx",".mjs",".cjs"];function Y(q,W){let B=n$.resolve(q,W);if(wJ.existsSync(B))return B;if(X.includes(n$.extname(W)))return;let U=X.find((R)=>wJ.existsSync(`${B}${R}`));if(U)return`${B}${U}`;return}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let H=$._executableFile||`${this._name}-${$._name}`,M=this._executableDir||"";if(this._scriptPath){let q;try{q=wJ.realpathSync(this._scriptPath)}catch(W){q=this._scriptPath}M=n$.resolve(n$.dirname(q),M)}if(M){let q=Y(M,H);if(!q&&!$._executableFile&&this._scriptPath){let W=n$.basename(this._scriptPath,n$.extname(this._scriptPath));if(W!==this._name)q=Y(M,`${W}-${$._name}`)}H=q||H}Q=X.includes(n$.extname(H));let G;if(Y$.platform!=="win32")if(Q)J.unshift(H),J=V8(Y$.execArgv).concat(J),G=CJ.spawn(Y$.argv[0],J,{stdio:"inherit"});else G=CJ.spawn(H,J,{stdio:"inherit"});else J.unshift(H),J=V8(Y$.execArgv).concat(J),G=CJ.spawn(Y$.execPath,J,{stdio:"inherit"});if(!G.killed)["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach((W)=>{Y$.on(W,()=>{if(G.killed===!1&&G.exitCode===null)G.kill(W)})});let K=this._exitCallback;if(!K)G.on("close",Y$.exit.bind(Y$));else G.on("close",()=>{K(new _J(Y$.exitCode||0,"commander.executeSubCommandAsync","(close)"))});G.on("error",(q)=>{if(q.code==="ENOENT"){let W=M?`searched for local subcommand relative to directory '${M}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",B=`'${H}' does not exist
14
14
  - if '${$._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
15
15
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
16
- - ${W}`;throw new Error(B)}else if(q.code==="EACCES")throw new Error(`'${H}' not executable`);if(!K)Y1.exit(1);else{let W=new _J(1,"commander.executeSubCommandAsync","(error)");W.nestedError=q,K(W)}}),this.runningCommand=G}_dispatchSubcommand($,J,Q){let X=this._findCommand($);if(!X)this.help({error:!0});let Y;return Y=this._chainOrCallSubCommandHook(Y,X,"preSubcommand"),Y=this._chainOrCall(Y,()=>{if(X._executableHandler)this._executeSubCommand(X,J.concat(Q));else return X._parseCommand(J,Q)}),Y}_dispatchHelpCommand($){if(!$)this.help();let J=this._findCommand($);if(J&&!J._executableHandler)J.help();return this._dispatchSubcommand($,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,J)=>{if($.required&&this.args[J]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(Q,X,Y)=>{let H=X;if(X!==null&&Q.parseArg){let M=`error: command-argument value '${X}' is invalid for argument '${Q.name()}'.`;H=this._callParseArg(Q,X,Y,M)}return H};this._checkNumberOfArguments();let J=[];this.registeredArguments.forEach((Q,X)=>{let Y=Q.defaultValue;if(Q.variadic){if(X<this.args.length){if(Y=this.args.slice(X),Q.parseArg)Y=Y.reduce((H,M)=>{return $(Q,M,H)},Q.defaultValue)}else if(Y===void 0)Y=[]}else if(X<this.args.length){if(Y=this.args[X],Q.parseArg)Y=$(Q,Y,Q.defaultValue)}J[X]=Y}),this.processedArgs=J}_chainOrCall($,J){if($&&$.then&&typeof $.then==="function")return $.then(()=>J());return J()}_chainOrCallHooks($,J){let Q=$,X=[];if(this._getCommandAndAncestors().reverse().filter((Y)=>Y._lifeCycleHooks[J]!==void 0).forEach((Y)=>{Y._lifeCycleHooks[J].forEach((H)=>{X.push({hookedCommand:Y,callback:H})})}),J==="postAction")X.reverse();return X.forEach((Y)=>{Q=this._chainOrCall(Q,()=>{return Y.callback(Y.hookedCommand,this)})}),Q}_chainOrCallSubCommandHook($,J,Q){let X=$;if(this._lifeCycleHooks[Q]!==void 0)this._lifeCycleHooks[Q].forEach((Y)=>{X=this._chainOrCall(X,()=>{return Y(this,J)})});return X}_parseCommand($,J){let Q=this.parseOptions(J);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(Q.operands),J=Q.unknown,this.args=$.concat(J),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),J);if(this._hasImplicitHelpCommand()&&$[0]===this._helpCommandName)return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return j8(this,J),this._dispatchSubcommand(this._defaultCommandName,$,J);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});j8(this,Q.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let X=()=>{if(Q.unknown.length>0)this.unknownOption(Q.unknown[0])},Y=`command:${this.name()}`;if(this._actionHandler){X(),this._processArguments();let H;if(H=this._chainOrCallHooks(H,"preAction"),H=this._chainOrCall(H,()=>this._actionHandler(this.processedArgs)),this.parent)H=this._chainOrCall(H,()=>{this.parent.emit(Y,$,J)});return H=this._chainOrCallHooks(H,"postAction"),H}if(this.parent&&this.parent.listenerCount(Y))X(),this._processArguments(),this.parent.emit(Y,$,J);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,J);if(this.listenerCount("command:*"))this.emit("command:*",$,J);else if(this.commands.length)this.unknownCommand();else X(),this._processArguments()}else if(this.commands.length)X(),this.help({error:!0});else X(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((J)=>J._name===$||J._aliases.includes($))}_findOption($){return this.options.find((J)=>J.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((J)=>{if(J.mandatory&&$.getOptionValue(J.attributeName())===void 0)$.missingMandatoryOptionValue(J)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((Q)=>{let X=Q.attributeName();if(this.getOptionValue(X)===void 0)return!1;return this.getOptionValueSource(X)!=="default"});$.filter((Q)=>Q.conflictsWith.length>0).forEach((Q)=>{let X=$.find((Y)=>Q.conflictsWith.includes(Y.attributeName()));if(X)this._conflictingOption(Q,X)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let J=[],Q=[],X=J,Y=$.slice();function H(G){return G.length>1&&G[0]==="-"}let M=null;while(Y.length){let G=Y.shift();if(G==="--"){if(X===Q)X.push(G);X.push(...Y);break}if(M&&!H(G)){this.emit(`option:${M.name()}`,G);continue}if(M=null,H(G)){let K=this._findOption(G);if(K){if(K.required){let q=Y.shift();if(q===void 0)this.optionMissingArgument(K);this.emit(`option:${K.name()}`,q)}else if(K.optional){let q=null;if(Y.length>0&&!H(Y[0]))q=Y.shift();this.emit(`option:${K.name()}`,q)}else this.emit(`option:${K.name()}`);M=K.variadic?K:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let K=this._findOption(`-${G[1]}`);if(K){if(K.required||K.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${K.name()}`,G.slice(2));else this.emit(`option:${K.name()}`),Y.unshift(`-${G.slice(2)}`);continue}}if(/^--[^=]+=/.test(G)){let K=G.indexOf("="),q=this._findOption(G.slice(0,K));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,G.slice(K+1));continue}}if(H(G))X=Q;if((this._enablePositionalOptions||this._passThroughOptions)&&J.length===0&&Q.length===0){if(this._findCommand(G)){if(J.push(G),Y.length>0)Q.push(...Y);break}else if(G===this._helpCommandName&&this._hasImplicitHelpCommand()){if(J.push(G),Y.length>0)J.push(...Y);break}else if(this._defaultCommandName){if(Q.push(G),Y.length>0)Q.push(...Y);break}}if(this._passThroughOptions){if(X.push(G),Y.length>0)X.push(...Y);break}X.push(G)}return{operands:J,unknown:Q}}opts(){if(this._storeOptionsAsProperties){let $={},J=this.options.length;for(let Q=0;Q<J;Q++){let X=this.options[Q].attributeName();$[X]=X===this._versionOptionName?this._version:this[X]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,J)=>Object.assign($,J.opts()),{})}error($,J){if(this._outputConfiguration.outputError(`${$}
16
+ - ${W}`;throw new Error(B)}else if(q.code==="EACCES")throw new Error(`'${H}' not executable`);if(!K)Y$.exit(1);else{let W=new _J(1,"commander.executeSubCommandAsync","(error)");W.nestedError=q,K(W)}}),this.runningCommand=G}_dispatchSubcommand($,J,Q){let X=this._findCommand($);if(!X)this.help({error:!0});let Y;return Y=this._chainOrCallSubCommandHook(Y,X,"preSubcommand"),Y=this._chainOrCall(Y,()=>{if(X._executableHandler)this._executeSubCommand(X,J.concat(Q));else return X._parseCommand(J,Q)}),Y}_dispatchHelpCommand($){if(!$)this.help();let J=this._findCommand($);if(J&&!J._executableHandler)J.help();return this._dispatchSubcommand($,[],[this._helpLongFlag||this._helpShortFlag])}_checkNumberOfArguments(){if(this.registeredArguments.forEach(($,J)=>{if($.required&&this.args[J]==null)this.missingArgument($.name())}),this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)return;if(this.args.length>this.registeredArguments.length)this._excessArguments(this.args)}_processArguments(){let $=(Q,X,Y)=>{let H=X;if(X!==null&&Q.parseArg){let M=`error: command-argument value '${X}' is invalid for argument '${Q.name()}'.`;H=this._callParseArg(Q,X,Y,M)}return H};this._checkNumberOfArguments();let J=[];this.registeredArguments.forEach((Q,X)=>{let Y=Q.defaultValue;if(Q.variadic){if(X<this.args.length){if(Y=this.args.slice(X),Q.parseArg)Y=Y.reduce((H,M)=>{return $(Q,M,H)},Q.defaultValue)}else if(Y===void 0)Y=[]}else if(X<this.args.length){if(Y=this.args[X],Q.parseArg)Y=$(Q,Y,Q.defaultValue)}J[X]=Y}),this.processedArgs=J}_chainOrCall($,J){if($&&$.then&&typeof $.then==="function")return $.then(()=>J());return J()}_chainOrCallHooks($,J){let Q=$,X=[];if(this._getCommandAndAncestors().reverse().filter((Y)=>Y._lifeCycleHooks[J]!==void 0).forEach((Y)=>{Y._lifeCycleHooks[J].forEach((H)=>{X.push({hookedCommand:Y,callback:H})})}),J==="postAction")X.reverse();return X.forEach((Y)=>{Q=this._chainOrCall(Q,()=>{return Y.callback(Y.hookedCommand,this)})}),Q}_chainOrCallSubCommandHook($,J,Q){let X=$;if(this._lifeCycleHooks[Q]!==void 0)this._lifeCycleHooks[Q].forEach((Y)=>{X=this._chainOrCall(X,()=>{return Y(this,J)})});return X}_parseCommand($,J){let Q=this.parseOptions(J);if(this._parseOptionsEnv(),this._parseOptionsImplied(),$=$.concat(Q.operands),J=Q.unknown,this.args=$.concat(J),$&&this._findCommand($[0]))return this._dispatchSubcommand($[0],$.slice(1),J);if(this._hasImplicitHelpCommand()&&$[0]===this._helpCommandName)return this._dispatchHelpCommand($[1]);if(this._defaultCommandName)return j8(this,J),this._dispatchSubcommand(this._defaultCommandName,$,J);if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName)this.help({error:!0});j8(this,Q.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let X=()=>{if(Q.unknown.length>0)this.unknownOption(Q.unknown[0])},Y=`command:${this.name()}`;if(this._actionHandler){X(),this._processArguments();let H;if(H=this._chainOrCallHooks(H,"preAction"),H=this._chainOrCall(H,()=>this._actionHandler(this.processedArgs)),this.parent)H=this._chainOrCall(H,()=>{this.parent.emit(Y,$,J)});return H=this._chainOrCallHooks(H,"postAction"),H}if(this.parent&&this.parent.listenerCount(Y))X(),this._processArguments(),this.parent.emit(Y,$,J);else if($.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",$,J);if(this.listenerCount("command:*"))this.emit("command:*",$,J);else if(this.commands.length)this.unknownCommand();else X(),this._processArguments()}else if(this.commands.length)X(),this.help({error:!0});else X(),this._processArguments()}_findCommand($){if(!$)return;return this.commands.find((J)=>J._name===$||J._aliases.includes($))}_findOption($){return this.options.find((J)=>J.is($))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(($)=>{$.options.forEach((J)=>{if(J.mandatory&&$.getOptionValue(J.attributeName())===void 0)$.missingMandatoryOptionValue(J)})})}_checkForConflictingLocalOptions(){let $=this.options.filter((Q)=>{let X=Q.attributeName();if(this.getOptionValue(X)===void 0)return!1;return this.getOptionValueSource(X)!=="default"});$.filter((Q)=>Q.conflictsWith.length>0).forEach((Q)=>{let X=$.find((Y)=>Q.conflictsWith.includes(Y.attributeName()));if(X)this._conflictingOption(Q,X)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(($)=>{$._checkForConflictingLocalOptions()})}parseOptions($){let J=[],Q=[],X=J,Y=$.slice();function H(G){return G.length>1&&G[0]==="-"}let M=null;while(Y.length){let G=Y.shift();if(G==="--"){if(X===Q)X.push(G);X.push(...Y);break}if(M&&!H(G)){this.emit(`option:${M.name()}`,G);continue}if(M=null,H(G)){let K=this._findOption(G);if(K){if(K.required){let q=Y.shift();if(q===void 0)this.optionMissingArgument(K);this.emit(`option:${K.name()}`,q)}else if(K.optional){let q=null;if(Y.length>0&&!H(Y[0]))q=Y.shift();this.emit(`option:${K.name()}`,q)}else this.emit(`option:${K.name()}`);M=K.variadic?K:null;continue}}if(G.length>2&&G[0]==="-"&&G[1]!=="-"){let K=this._findOption(`-${G[1]}`);if(K){if(K.required||K.optional&&this._combineFlagAndOptionalValue)this.emit(`option:${K.name()}`,G.slice(2));else this.emit(`option:${K.name()}`),Y.unshift(`-${G.slice(2)}`);continue}}if(/^--[^=]+=/.test(G)){let K=G.indexOf("="),q=this._findOption(G.slice(0,K));if(q&&(q.required||q.optional)){this.emit(`option:${q.name()}`,G.slice(K+1));continue}}if(H(G))X=Q;if((this._enablePositionalOptions||this._passThroughOptions)&&J.length===0&&Q.length===0){if(this._findCommand(G)){if(J.push(G),Y.length>0)Q.push(...Y);break}else if(G===this._helpCommandName&&this._hasImplicitHelpCommand()){if(J.push(G),Y.length>0)J.push(...Y);break}else if(this._defaultCommandName){if(Q.push(G),Y.length>0)Q.push(...Y);break}}if(this._passThroughOptions){if(X.push(G),Y.length>0)X.push(...Y);break}X.push(G)}return{operands:J,unknown:Q}}opts(){if(this._storeOptionsAsProperties){let $={},J=this.options.length;for(let Q=0;Q<J;Q++){let X=this.options[Q].attributeName();$[X]=X===this._versionOptionName?this._version:this[X]}return $}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(($,J)=>Object.assign($,J.opts()),{})}error($,J){if(this._outputConfiguration.outputError(`${$}
17
17
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==="string")this._outputConfiguration.writeErr(`${this._showHelpAfterError}
18
18
  `);else if(this._showHelpAfterError)this._outputConfiguration.writeErr(`
19
- `),this.outputHelp({error:!0});let Q=J||{},X=Q.exitCode||1,Y=Q.code||"commander.error";this._exit(X,Y,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in Y1.env){let J=$.attributeName();if(this.getOptionValue(J)===void 0||["default","config","env"].includes(this.getOptionValueSource(J)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,Y1.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new IY(this.options),J=(Q)=>{return this.getOptionValue(Q)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(Q))};this.options.filter((Q)=>Q.implied!==void 0&&J(Q.attributeName())&&$.valueFromOption(this.getOptionValue(Q.attributeName()),Q)).forEach((Q)=>{Object.keys(Q.implied).filter((X)=>!J(X)).forEach((X)=>{this.setOptionValueWithSource(X,Q.implied[X],"implied")})})}missingArgument($){let J=`error: missing required argument '${$}'`;this.error(J,{code:"commander.missingArgument"})}optionMissingArgument($){let J=`error: option '${$.flags}' argument missing`;this.error(J,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let J=`error: required option '${$.flags}' not specified`;this.error(J,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,J){let Q=(H)=>{let M=H.attributeName(),G=this.getOptionValue(M),K=this.options.find((W)=>W.negate&&M===W.attributeName()),q=this.options.find((W)=>!W.negate&&M===W.attributeName());if(K&&(K.presetArg===void 0&&G===!1||K.presetArg!==void 0&&G===K.presetArg))return K;return q||H},X=(H)=>{let M=Q(H),G=M.attributeName();if(this.getOptionValueSource(G)==="env")return`environment variable '${M.envVar}'`;return`option '${M.flags}'`},Y=`error: ${X($)} cannot be used with ${X(J)}`;this.error(Y,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let J="";if($.startsWith("--")&&this._showSuggestionAfterError){let X=[],Y=this;do{let H=Y.createHelp().visibleOptions(Y).filter((M)=>M.long).map((M)=>M.long);X=X.concat(H),Y=Y.parent}while(Y&&!Y._enablePositionalOptions);J=H8($,X)}let Q=`error: unknown option '${$}'${J}`;this.error(Q,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let J=this.registeredArguments.length,Q=J===1?"":"s",Y=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${J} argument${Q} but got ${$.length}.`;this.error(Y,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],J="";if(this._showSuggestionAfterError){let X=[];this.createHelp().visibleCommands(this).forEach((Y)=>{if(X.push(Y.name()),Y.alias())X.push(Y.alias())}),J=H8($,X)}let Q=`error: unknown command '${$}'${J}`;this.error(Q,{code:"commander.unknownCommand"})}version($,J,Q){if($===void 0)return this._version;this._version=$,J=J||"-V, --version",Q=Q||"output the version number";let X=this.createOption(J,Q);return this._versionOptionName=X.attributeName(),this.options.push(X),this.on("option:"+X.name(),()=>{this._outputConfiguration.writeOut(`${$}
20
- `),this._exit(0,"commander.version",$)}),this}description($,J){if($===void 0&&J===void 0)return this._description;if(this._description=$,J)this._argsDescription=J;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let J=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)J=this.commands[this.commands.length-1];if($===J._name)throw new Error("Command alias can't be the same as its name");return J._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((J)=>this.alias(J)),this}usage($){if($===void 0){if(this._usage)return this._usage;let J=this.registeredArguments.map((Q)=>{return LY(Q)});return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?J:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}nameFromFilename($){return this._name=n1.basename($,n1.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let J=this.createHelp();if(J.helpWidth===void 0)J.helpWidth=$&&$.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return J.formatHelp(this,J)}_getHelpContext($){$=$||{};let J={error:!!$.error},Q;if(J.error)Q=(X)=>this._outputConfiguration.writeErr(X);else Q=(X)=>this._outputConfiguration.writeOut(X);return J.write=$.write||Q,J.command=this,J}outputHelp($){let J;if(typeof $==="function")J=$,$=void 0;let Q=this._getHelpContext($);this._getCommandAndAncestors().reverse().forEach((Y)=>Y.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation(Q);if(J){if(X=J(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw new Error("outputHelp callback must return a string or a Buffer")}if(Q.write(X),this._helpLongFlag)this.emit(this._helpLongFlag);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((Y)=>Y.emit("afterAllHelp",Q))}helpOption($,J){if(typeof $==="boolean")return this._hasHelpOption=$,this;this._helpFlags=$||this._helpFlags,this._helpDescription=J||this._helpDescription;let Q=AY(this._helpFlags);return this._helpShortFlag=Q.shortFlag,this._helpLongFlag=Q.longFlag,this}help($){this.outputHelp($);let J=Y1.exitCode||0;if(J===0&&$&&typeof $!=="function"&&$.error)J=1;this._exit(J,"commander.help","(outputHelp)")}addHelpText($,J){let Q=["beforeAll","before","after","afterAll"];if(!Q.includes($))throw new Error(`Unexpected value for position to addHelpText.
19
+ `),this.outputHelp({error:!0});let Q=J||{},X=Q.exitCode||1,Y=Q.code||"commander.error";this._exit(X,Y,$)}_parseOptionsEnv(){this.options.forEach(($)=>{if($.envVar&&$.envVar in Y$.env){let J=$.attributeName();if(this.getOptionValue(J)===void 0||["default","config","env"].includes(this.getOptionValueSource(J)))if($.required||$.optional)this.emit(`optionEnv:${$.name()}`,Y$.env[$.envVar]);else this.emit(`optionEnv:${$.name()}`)}})}_parseOptionsImplied(){let $=new IY(this.options),J=(Q)=>{return this.getOptionValue(Q)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(Q))};this.options.filter((Q)=>Q.implied!==void 0&&J(Q.attributeName())&&$.valueFromOption(this.getOptionValue(Q.attributeName()),Q)).forEach((Q)=>{Object.keys(Q.implied).filter((X)=>!J(X)).forEach((X)=>{this.setOptionValueWithSource(X,Q.implied[X],"implied")})})}missingArgument($){let J=`error: missing required argument '${$}'`;this.error(J,{code:"commander.missingArgument"})}optionMissingArgument($){let J=`error: option '${$.flags}' argument missing`;this.error(J,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue($){let J=`error: required option '${$.flags}' not specified`;this.error(J,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption($,J){let Q=(H)=>{let M=H.attributeName(),G=this.getOptionValue(M),K=this.options.find((W)=>W.negate&&M===W.attributeName()),q=this.options.find((W)=>!W.negate&&M===W.attributeName());if(K&&(K.presetArg===void 0&&G===!1||K.presetArg!==void 0&&G===K.presetArg))return K;return q||H},X=(H)=>{let M=Q(H),G=M.attributeName();if(this.getOptionValueSource(G)==="env")return`environment variable '${M.envVar}'`;return`option '${M.flags}'`},Y=`error: ${X($)} cannot be used with ${X(J)}`;this.error(Y,{code:"commander.conflictingOption"})}unknownOption($){if(this._allowUnknownOption)return;let J="";if($.startsWith("--")&&this._showSuggestionAfterError){let X=[],Y=this;do{let H=Y.createHelp().visibleOptions(Y).filter((M)=>M.long).map((M)=>M.long);X=X.concat(H),Y=Y.parent}while(Y&&!Y._enablePositionalOptions);J=H8($,X)}let Q=`error: unknown option '${$}'${J}`;this.error(Q,{code:"commander.unknownOption"})}_excessArguments($){if(this._allowExcessArguments)return;let J=this.registeredArguments.length,Q=J===1?"":"s",Y=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${J} argument${Q} but got ${$.length}.`;this.error(Y,{code:"commander.excessArguments"})}unknownCommand(){let $=this.args[0],J="";if(this._showSuggestionAfterError){let X=[];this.createHelp().visibleCommands(this).forEach((Y)=>{if(X.push(Y.name()),Y.alias())X.push(Y.alias())}),J=H8($,X)}let Q=`error: unknown command '${$}'${J}`;this.error(Q,{code:"commander.unknownCommand"})}version($,J,Q){if($===void 0)return this._version;this._version=$,J=J||"-V, --version",Q=Q||"output the version number";let X=this.createOption(J,Q);return this._versionOptionName=X.attributeName(),this.options.push(X),this.on("option:"+X.name(),()=>{this._outputConfiguration.writeOut(`${$}
20
+ `),this._exit(0,"commander.version",$)}),this}description($,J){if($===void 0&&J===void 0)return this._description;if(this._description=$,J)this._argsDescription=J;return this}summary($){if($===void 0)return this._summary;return this._summary=$,this}alias($){if($===void 0)return this._aliases[0];let J=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler)J=this.commands[this.commands.length-1];if($===J._name)throw new Error("Command alias can't be the same as its name");return J._aliases.push($),this}aliases($){if($===void 0)return this._aliases;return $.forEach((J)=>this.alias(J)),this}usage($){if($===void 0){if(this._usage)return this._usage;let J=this.registeredArguments.map((Q)=>{return LY(Q)});return[].concat(this.options.length||this._hasHelpOption?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?J:[]).join(" ")}return this._usage=$,this}name($){if($===void 0)return this._name;return this._name=$,this}nameFromFilename($){return this._name=n$.basename($,n$.extname($)),this}executableDir($){if($===void 0)return this._executableDir;return this._executableDir=$,this}helpInformation($){let J=this.createHelp();if(J.helpWidth===void 0)J.helpWidth=$&&$.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth();return J.formatHelp(this,J)}_getHelpContext($){$=$||{};let J={error:!!$.error},Q;if(J.error)Q=(X)=>this._outputConfiguration.writeErr(X);else Q=(X)=>this._outputConfiguration.writeOut(X);return J.write=$.write||Q,J.command=this,J}outputHelp($){let J;if(typeof $==="function")J=$,$=void 0;let Q=this._getHelpContext($);this._getCommandAndAncestors().reverse().forEach((Y)=>Y.emit("beforeAllHelp",Q)),this.emit("beforeHelp",Q);let X=this.helpInformation(Q);if(J){if(X=J(X),typeof X!=="string"&&!Buffer.isBuffer(X))throw new Error("outputHelp callback must return a string or a Buffer")}if(Q.write(X),this._helpLongFlag)this.emit(this._helpLongFlag);this.emit("afterHelp",Q),this._getCommandAndAncestors().forEach((Y)=>Y.emit("afterAllHelp",Q))}helpOption($,J){if(typeof $==="boolean")return this._hasHelpOption=$,this;this._helpFlags=$||this._helpFlags,this._helpDescription=J||this._helpDescription;let Q=AY(this._helpFlags);return this._helpShortFlag=Q.shortFlag,this._helpLongFlag=Q.longFlag,this}help($){this.outputHelp($);let J=Y$.exitCode||0;if(J===0&&$&&typeof $!=="function"&&$.error)J=1;this._exit(J,"commander.help","(outputHelp)")}addHelpText($,J){let Q=["beforeAll","before","after","afterAll"];if(!Q.includes($))throw new Error(`Unexpected value for position to addHelpText.
21
21
  Expecting one of '${Q.join("', '")}'`);let X=`${$}Help`;return this.on(X,(Y)=>{let H;if(typeof J==="function")H=J({error:Y.error,command:Y.command});else H=J;if(H)Y.write(`${H}
22
- `)}),this}}function j8($,J){if($._hasHelpOption&&J.find((X)=>X===$._helpLongFlag||X===$._helpShortFlag))$.outputHelp(),$._exit(0,"commander.helpDisplayed","(outputHelp)")}function V8($){return $.map((J)=>{if(!J.startsWith("--inspect"))return J;let Q,X="127.0.0.1",Y="9229",H;if((H=J.match(/^(--inspect(-brk)?)$/))!==null)Q=H[1];else if((H=J.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(Q=H[1],/^\d+$/.test(H[3]))Y=H[3];else X=H[3];else if((H=J.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)Q=H[1],X=H[3],Y=H[4];if(Q&&Y!=="0")return`${Q}=${X}:${parseInt(Y)+1}`;return J})}K8.Command=ZJ});var B8=n((P1,M8)=>{var{Argument:SY}=m0(),{Command:W8}=R8(),{CommanderError:zY,InvalidArgumentError:q8}=q0(),{Help:PY}=zJ(),{Option:CY}=PJ();P1=M8.exports=new W8;P1.program=P1;P1.Command=W8;P1.Option=CY;P1.Argument=SY;P1.Help=PY;P1.CommanderError=zY;P1.InvalidArgumentError=q8;P1.InvalidOptionArgumentError=q8});var O8=n((yJ)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */yJ.read=function($,J,Q,X,Y){var H,M,G=Y*8-X-1,K=(1<<G)-1,q=K>>1,W=-7,B=Q?Y-1:0,U=Q?-1:1,R=$[J+B];B+=U,H=R&(1<<-W)-1,R>>=-W,W+=G;for(;W>0;H=H*256+$[J+B],B+=U,W-=8);M=H&(1<<-W)-1,H>>=-W,W+=X;for(;W>0;M=M*256+$[J+B],B+=U,W-=8);if(H===0)H=1-q;else if(H===K)return M?NaN:(R?-1:1)*(1/0);else M=M+Math.pow(2,X),H=H-q;return(R?-1:1)*M*Math.pow(2,H-X)};yJ.write=function($,J,Q,X,Y,H){var M,G,K,q=H*8-Y-1,W=(1<<q)-1,B=W>>1,U=Y===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=X?0:H-1,D=X?1:-1,j=J<0||J===0&&1/J<0?1:0;if(J=Math.abs(J),isNaN(J)||J===1/0)G=isNaN(J)?1:0,M=W;else{if(M=Math.floor(Math.log(J)/Math.LN2),J*(K=Math.pow(2,-M))<1)M--,K*=2;if(M+B>=1)J+=U/K;else J+=U*Math.pow(2,1-B);if(J*K>=2)M++,K/=2;if(M+B>=W)G=0,M=W;else if(M+B>=1)G=(J*K-1)*Math.pow(2,Y),M=M+B;else G=J*Math.pow(2,B-1)*Math.pow(2,Y),M=0}for(;Y>=8;$[Q+R]=G&255,R+=D,G/=256,Y-=8);M=M<<Y|G,q+=Y;for(;q>0;$[Q+R]=M&255,R+=D,M/=256,q-=8);$[Q+R-D]|=j*128}});var h8=n((Z3,k8)=>{var g$=1000,y$=g$*60,b$=y$*60,D$=b$*24,$4=D$*7,J4=D$*365.25;k8.exports=function($,J){J=J||{};var Q=typeof $;if(Q==="string"&&$.length>0)return Q4($);else if(Q==="number"&&isFinite($))return J.long?Y4($):X4($);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify($))};function Q4($){if($=String($),$.length>100)return;var J=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec($);if(!J)return;var Q=parseFloat(J[1]),X=(J[2]||"ms").toLowerCase();switch(X){case"years":case"year":case"yrs":case"yr":case"y":return Q*J4;case"weeks":case"week":case"w":return Q*$4;case"days":case"day":case"d":return Q*D$;case"hours":case"hour":case"hrs":case"hr":case"h":return Q*b$;case"minutes":case"minute":case"mins":case"min":case"m":return Q*y$;case"seconds":case"second":case"secs":case"sec":case"s":return Q*g$;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return Q;default:return}}function X4($){var J=Math.abs($);if(J>=D$)return Math.round($/D$)+"d";if(J>=b$)return Math.round($/b$)+"h";if(J>=y$)return Math.round($/y$)+"m";if(J>=g$)return Math.round($/g$)+"s";return $+"ms"}function Y4($){var J=Math.abs($);if(J>=D$)return p0($,J,D$,"day");if(J>=b$)return p0($,J,b$,"hour");if(J>=y$)return p0($,J,y$,"minute");if(J>=g$)return p0($,J,g$,"second");return $+" ms"}function p0($,J,Q,X){var Y=J>=Q*1.5;return Math.round($/Q)+" "+X+(Y?"s":"")}});var lJ=n((T3,g8)=>{function G4($){Q.debug=Q,Q.default=Q,Q.coerce=K,Q.disable=M,Q.enable=Y,Q.enabled=G,Q.humanize=h8(),Q.destroy=q,Object.keys($).forEach((W)=>{Q[W]=$[W]}),Q.names=[],Q.skips=[],Q.formatters={};function J(W){let B=0;for(let U=0;U<W.length;U++)B=(B<<5)-B+W.charCodeAt(U),B|=0;return Q.colors[Math.abs(B)%Q.colors.length]}Q.selectColor=J;function Q(W){let B,U=null,R,D;function j(...V){if(!j.enabled)return;let L=j,F=Number(new Date),N=F-(B||F);if(L.diff=N,L.prev=B,L.curr=F,B=F,V[0]=Q.coerce(V[0]),typeof V[0]!=="string")V.unshift("%O");let O=0;V[0]=V[0].replace(/%([a-zA-Z%])/g,(I,w)=>{if(I==="%%")return"%";O++;let Z=Q.formatters[w];if(typeof Z==="function"){let k=V[O];I=Z.call(L,k),V.splice(O,1),O--}return I}),Q.formatArgs.call(L,V),(L.log||Q.log).apply(L,V)}if(j.namespace=W,j.useColors=Q.useColors(),j.color=Q.selectColor(W),j.extend=X,j.destroy=Q.destroy,Object.defineProperty(j,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(U!==null)return U;if(R!==Q.namespaces)R=Q.namespaces,D=Q.enabled(W);return D},set:(V)=>{U=V}}),typeof Q.init==="function")Q.init(j);return j}function X(W,B){let U=Q(this.namespace+(typeof B==="undefined"?":":B)+W);return U.log=this.log,U}function Y(W){Q.save(W),Q.namespaces=W,Q.names=[],Q.skips=[];let B=(typeof W==="string"?W:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let U of B)if(U[0]==="-")Q.skips.push(U.slice(1));else Q.names.push(U)}function H(W,B){let U=0,R=0,D=-1,j=0;while(U<W.length)if(R<B.length&&(B[R]===W[U]||B[R]==="*"))if(B[R]==="*")D=R,j=U,R++;else U++,R++;else if(D!==-1)R=D+1,j++,U=j;else return!1;while(R<B.length&&B[R]==="*")R++;return R===B.length}function M(){let W=[...Q.names,...Q.skips.map((B)=>"-"+B)].join(",");return Q.enable(""),W}function G(W){for(let B of Q.skips)if(H(W,B))return!1;for(let B of Q.names)if(H(W,B))return!0;return!1}function K(W){if(W instanceof Error)return W.stack||W.message;return W}function q(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return Q.enable(Q.load()),Q}g8.exports=G4});var y8=n((F1,d0)=>{F1.formatArgs=j4;F1.save=V4;F1.load=K4;F1.useColors=H4;F1.storage=R4();F1.destroy=(()=>{let $=!1;return()=>{if(!$)$=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();F1.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function H4(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let $;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&($=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt($[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function j4($){if($[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+$[0]+(this.useColors?"%c ":" ")+"+"+d0.exports.humanize(this.diff),!this.useColors)return;let J="color: "+this.color;$.splice(1,0,J,"color: inherit");let Q=0,X=0;$[0].replace(/%[a-zA-Z%]/g,(Y)=>{if(Y==="%%")return;if(Q++,Y==="%c")X=Q}),$.splice(X,0,J)}F1.log=console.debug||console.log||(()=>{});function V4($){try{if($)F1.storage.setItem("debug",$);else F1.storage.removeItem("debug")}catch(J){}}function K4(){let $;try{$=F1.storage.getItem("debug")||F1.storage.getItem("DEBUG")}catch(J){}if(!$&&typeof process!=="undefined"&&"env"in process)$=process.env.DEBUG;return $}function R4(){try{return localStorage}catch($){}}d0.exports=lJ()(F1);var{formatters:W4}=d0.exports;W4.j=function($){try{return JSON.stringify($)}catch(J){return"[UnexpectedJSONParseError]: "+J.message}}});var f8=n((x3,b8)=>{b8.exports=($,J=process.argv)=>{let Q=$.startsWith("-")?"":$.length===1?"-":"--",X=J.indexOf(Q+$),Y=J.indexOf("--");return X!==-1&&(Y===-1||X<Y)}});var l8=n((v3,u8)=>{var q4=require("os"),m8=require("tty"),I1=f8(),{env:K1}=process,J$;if(I1("no-color")||I1("no-colors")||I1("color=false")||I1("color=never"))J$=0;else if(I1("color")||I1("colors")||I1("color=true")||I1("color=always"))J$=1;if("FORCE_COLOR"in K1)if(K1.FORCE_COLOR==="true")J$=1;else if(K1.FORCE_COLOR==="false")J$=0;else J$=K1.FORCE_COLOR.length===0?1:Math.min(parseInt(K1.FORCE_COLOR,10),3);function cJ($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function pJ($,J){if(J$===0)return 0;if(I1("color=16m")||I1("color=full")||I1("color=truecolor"))return 3;if(I1("color=256"))return 2;if($&&!J&&J$===void 0)return 0;let Q=J$||0;if(K1.TERM==="dumb")return Q;if(process.platform==="win32"){let X=q4.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in K1){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((X)=>(X in K1))||K1.CI_NAME==="codeship")return 1;return Q}if("TEAMCITY_VERSION"in K1)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(K1.TEAMCITY_VERSION)?1:0;if(K1.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in K1){let X=parseInt((K1.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(K1.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(K1.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(K1.TERM))return 1;if("COLORTERM"in K1)return 1;return Q}function M4($){let J=pJ($,$&&$.isTTY);return cJ(J)}u8.exports={supportsColor:M4,stdout:cJ(pJ(!0,m8.isatty(1))),stderr:cJ(pJ(!0,m8.isatty(2)))}});var p8=n((R1,i0)=>{var B4=require("tty"),n0=require("util");R1.init=E4;R1.log=D4;R1.formatArgs=U4;R1.save=O4;R1.load=L4;R1.useColors=N4;R1.destroy=n0.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");R1.colors=[6,2,3,4,5,1];try{let $=l8();if($&&($.stderr||$).level>=2)R1.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch($){}R1.inspectOpts=Object.keys(process.env).filter(($)=>{return/^debug_/i.test($)}).reduce(($,J)=>{let Q=J.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,H)=>{return H.toUpperCase()}),X=process.env[J];if(/^(yes|on|true|enabled)$/i.test(X))X=!0;else if(/^(no|off|false|disabled)$/i.test(X))X=!1;else if(X==="null")X=null;else X=Number(X);return $[Q]=X,$},{});function N4(){return"colors"in R1.inspectOpts?Boolean(R1.inspectOpts.colors):B4.isatty(process.stderr.fd)}function U4($){let{namespace:J,useColors:Q}=this;if(Q){let X=this.color,Y="\x1B[3"+(X<8?X:"8;5;"+X),H=` ${Y};1m${J} \x1B[0m`;$[0]=H+$[0].split(`
22
+ `)}),this}}function j8($,J){if($._hasHelpOption&&J.find((X)=>X===$._helpLongFlag||X===$._helpShortFlag))$.outputHelp(),$._exit(0,"commander.helpDisplayed","(outputHelp)")}function V8($){return $.map((J)=>{if(!J.startsWith("--inspect"))return J;let Q,X="127.0.0.1",Y="9229",H;if((H=J.match(/^(--inspect(-brk)?)$/))!==null)Q=H[1];else if((H=J.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null)if(Q=H[1],/^\d+$/.test(H[3]))Y=H[3];else X=H[3];else if((H=J.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null)Q=H[1],X=H[3],Y=H[4];if(Q&&Y!=="0")return`${Q}=${X}:${parseInt(Y)+1}`;return J})}K8.Command=ZJ});var B8=n((P$,M8)=>{var{Argument:SY}=u0(),{Command:W8}=R8(),{CommanderError:zY,InvalidArgumentError:q8}=M0(),{Help:PY}=zJ(),{Option:CY}=PJ();P$=M8.exports=new W8;P$.program=P$;P$.Command=W8;P$.Option=CY;P$.Argument=SY;P$.Help=PY;P$.CommanderError=zY;P$.InvalidArgumentError=q8;P$.InvalidOptionArgumentError=q8});var O8=n((yJ)=>{/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */yJ.read=function($,J,Q,X,Y){var H,M,G=Y*8-X-1,K=(1<<G)-1,q=K>>1,W=-7,B=Q?Y-1:0,U=Q?-1:1,R=$[J+B];B+=U,H=R&(1<<-W)-1,R>>=-W,W+=G;for(;W>0;H=H*256+$[J+B],B+=U,W-=8);M=H&(1<<-W)-1,H>>=-W,W+=X;for(;W>0;M=M*256+$[J+B],B+=U,W-=8);if(H===0)H=1-q;else if(H===K)return M?NaN:(R?-1:1)*(1/0);else M=M+Math.pow(2,X),H=H-q;return(R?-1:1)*M*Math.pow(2,H-X)};yJ.write=function($,J,Q,X,Y,H){var M,G,K,q=H*8-Y-1,W=(1<<q)-1,B=W>>1,U=Y===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=X?0:H-1,D=X?1:-1,j=J<0||J===0&&1/J<0?1:0;if(J=Math.abs(J),isNaN(J)||J===1/0)G=isNaN(J)?1:0,M=W;else{if(M=Math.floor(Math.log(J)/Math.LN2),J*(K=Math.pow(2,-M))<1)M--,K*=2;if(M+B>=1)J+=U/K;else J+=U*Math.pow(2,1-B);if(J*K>=2)M++,K/=2;if(M+B>=W)G=0,M=W;else if(M+B>=1)G=(J*K-1)*Math.pow(2,Y),M=M+B;else G=J*Math.pow(2,B-1)*Math.pow(2,Y),M=0}for(;Y>=8;$[Q+R]=G&255,R+=D,G/=256,Y-=8);M=M<<Y|G,q+=Y;for(;q>0;$[Q+R]=M&255,R+=D,M/=256,q-=8);$[Q+R-D]|=j*128}});var h8=n((Z3,k8)=>{var g1=1000,y1=g1*60,b1=y1*60,D1=b1*24,$4=D1*7,J4=D1*365.25;k8.exports=function($,J){J=J||{};var Q=typeof $;if(Q==="string"&&$.length>0)return Q4($);else if(Q==="number"&&isFinite($))return J.long?Y4($):X4($);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify($))};function Q4($){if($=String($),$.length>100)return;var J=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec($);if(!J)return;var Q=parseFloat(J[1]),X=(J[2]||"ms").toLowerCase();switch(X){case"years":case"year":case"yrs":case"yr":case"y":return Q*J4;case"weeks":case"week":case"w":return Q*$4;case"days":case"day":case"d":return Q*D1;case"hours":case"hour":case"hrs":case"hr":case"h":return Q*b1;case"minutes":case"minute":case"mins":case"min":case"m":return Q*y1;case"seconds":case"second":case"secs":case"sec":case"s":return Q*g1;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return Q;default:return}}function X4($){var J=Math.abs($);if(J>=D1)return Math.round($/D1)+"d";if(J>=b1)return Math.round($/b1)+"h";if(J>=y1)return Math.round($/y1)+"m";if(J>=g1)return Math.round($/g1)+"s";return $+"ms"}function Y4($){var J=Math.abs($);if(J>=D1)return d0($,J,D1,"day");if(J>=b1)return d0($,J,b1,"hour");if(J>=y1)return d0($,J,y1,"minute");if(J>=g1)return d0($,J,g1,"second");return $+" ms"}function d0($,J,Q,X){var Y=J>=Q*1.5;return Math.round($/Q)+" "+X+(Y?"s":"")}});var lJ=n((T3,g8)=>{function G4($){Q.debug=Q,Q.default=Q,Q.coerce=K,Q.disable=M,Q.enable=Y,Q.enabled=G,Q.humanize=h8(),Q.destroy=q,Object.keys($).forEach((W)=>{Q[W]=$[W]}),Q.names=[],Q.skips=[],Q.formatters={};function J(W){let B=0;for(let U=0;U<W.length;U++)B=(B<<5)-B+W.charCodeAt(U),B|=0;return Q.colors[Math.abs(B)%Q.colors.length]}Q.selectColor=J;function Q(W){let B,U=null,R,D;function j(...V){if(!j.enabled)return;let L=j,F=Number(new Date),N=F-(B||F);if(L.diff=N,L.prev=B,L.curr=F,B=F,V[0]=Q.coerce(V[0]),typeof V[0]!=="string")V.unshift("%O");let O=0;V[0]=V[0].replace(/%([a-zA-Z%])/g,(I,w)=>{if(I==="%%")return"%";O++;let Z=Q.formatters[w];if(typeof Z==="function"){let k=V[O];I=Z.call(L,k),V.splice(O,1),O--}return I}),Q.formatArgs.call(L,V),(L.log||Q.log).apply(L,V)}if(j.namespace=W,j.useColors=Q.useColors(),j.color=Q.selectColor(W),j.extend=X,j.destroy=Q.destroy,Object.defineProperty(j,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(U!==null)return U;if(R!==Q.namespaces)R=Q.namespaces,D=Q.enabled(W);return D},set:(V)=>{U=V}}),typeof Q.init==="function")Q.init(j);return j}function X(W,B){let U=Q(this.namespace+(typeof B==="undefined"?":":B)+W);return U.log=this.log,U}function Y(W){Q.save(W),Q.namespaces=W,Q.names=[],Q.skips=[];let B=(typeof W==="string"?W:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let U of B)if(U[0]==="-")Q.skips.push(U.slice(1));else Q.names.push(U)}function H(W,B){let U=0,R=0,D=-1,j=0;while(U<W.length)if(R<B.length&&(B[R]===W[U]||B[R]==="*"))if(B[R]==="*")D=R,j=U,R++;else U++,R++;else if(D!==-1)R=D+1,j++,U=j;else return!1;while(R<B.length&&B[R]==="*")R++;return R===B.length}function M(){let W=[...Q.names,...Q.skips.map((B)=>"-"+B)].join(",");return Q.enable(""),W}function G(W){for(let B of Q.skips)if(H(W,B))return!1;for(let B of Q.names)if(H(W,B))return!0;return!1}function K(W){if(W instanceof Error)return W.stack||W.message;return W}function q(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return Q.enable(Q.load()),Q}g8.exports=G4});var y8=n((F$,n0)=>{F$.formatArgs=j4;F$.save=V4;F$.load=K4;F$.useColors=H4;F$.storage=R4();F$.destroy=(()=>{let $=!1;return()=>{if(!$)$=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();F$.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function H4(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let $;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&($=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt($[1],10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function j4($){if($[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+$[0]+(this.useColors?"%c ":" ")+"+"+n0.exports.humanize(this.diff),!this.useColors)return;let J="color: "+this.color;$.splice(1,0,J,"color: inherit");let Q=0,X=0;$[0].replace(/%[a-zA-Z%]/g,(Y)=>{if(Y==="%%")return;if(Q++,Y==="%c")X=Q}),$.splice(X,0,J)}F$.log=console.debug||console.log||(()=>{});function V4($){try{if($)F$.storage.setItem("debug",$);else F$.storage.removeItem("debug")}catch(J){}}function K4(){let $;try{$=F$.storage.getItem("debug")||F$.storage.getItem("DEBUG")}catch(J){}if(!$&&typeof process!=="undefined"&&"env"in process)$=process.env.DEBUG;return $}function R4(){try{return localStorage}catch($){}}n0.exports=lJ()(F$);var{formatters:W4}=n0.exports;W4.j=function($){try{return JSON.stringify($)}catch(J){return"[UnexpectedJSONParseError]: "+J.message}}});var f8=n((x3,b8)=>{b8.exports=($,J=process.argv)=>{let Q=$.startsWith("-")?"":$.length===1?"-":"--",X=J.indexOf(Q+$),Y=J.indexOf("--");return X!==-1&&(Y===-1||X<Y)}});var l8=n((v3,u8)=>{var q4=require("os"),m8=require("tty"),I$=f8(),{env:K$}=process,J1;if(I$("no-color")||I$("no-colors")||I$("color=false")||I$("color=never"))J1=0;else if(I$("color")||I$("colors")||I$("color=true")||I$("color=always"))J1=1;if("FORCE_COLOR"in K$)if(K$.FORCE_COLOR==="true")J1=1;else if(K$.FORCE_COLOR==="false")J1=0;else J1=K$.FORCE_COLOR.length===0?1:Math.min(parseInt(K$.FORCE_COLOR,10),3);function cJ($){if($===0)return!1;return{level:$,hasBasic:!0,has256:$>=2,has16m:$>=3}}function pJ($,J){if(J1===0)return 0;if(I$("color=16m")||I$("color=full")||I$("color=truecolor"))return 3;if(I$("color=256"))return 2;if($&&!J&&J1===void 0)return 0;let Q=J1||0;if(K$.TERM==="dumb")return Q;if(process.platform==="win32"){let X=q4.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in K$){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((X)=>(X in K$))||K$.CI_NAME==="codeship")return 1;return Q}if("TEAMCITY_VERSION"in K$)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(K$.TEAMCITY_VERSION)?1:0;if(K$.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in K$){let X=parseInt((K$.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(K$.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(K$.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(K$.TERM))return 1;if("COLORTERM"in K$)return 1;return Q}function M4($){let J=pJ($,$&&$.isTTY);return cJ(J)}u8.exports={supportsColor:M4,stdout:cJ(pJ(!0,m8.isatty(1))),stderr:cJ(pJ(!0,m8.isatty(2)))}});var p8=n((R$,o0)=>{var B4=require("tty"),i0=require("util");R$.init=E4;R$.log=D4;R$.formatArgs=U4;R$.save=O4;R$.load=L4;R$.useColors=N4;R$.destroy=i0.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");R$.colors=[6,2,3,4,5,1];try{let $=l8();if($&&($.stderr||$).level>=2)R$.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch($){}R$.inspectOpts=Object.keys(process.env).filter(($)=>{return/^debug_/i.test($)}).reduce(($,J)=>{let Q=J.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,H)=>{return H.toUpperCase()}),X=process.env[J];if(/^(yes|on|true|enabled)$/i.test(X))X=!0;else if(/^(no|off|false|disabled)$/i.test(X))X=!1;else if(X==="null")X=null;else X=Number(X);return $[Q]=X,$},{});function N4(){return"colors"in R$.inspectOpts?Boolean(R$.inspectOpts.colors):B4.isatty(process.stderr.fd)}function U4($){let{namespace:J,useColors:Q}=this;if(Q){let X=this.color,Y="\x1B[3"+(X<8?X:"8;5;"+X),H=` ${Y};1m${J} \x1B[0m`;$[0]=H+$[0].split(`
23
23
  `).join(`
24
- `+H),$.push(Y+"m+"+i0.exports.humanize(this.diff)+"\x1B[0m")}else $[0]=F4()+J+" "+$[0]}function F4(){if(R1.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function D4(...$){return process.stderr.write(n0.formatWithOptions(R1.inspectOpts,...$)+`
25
- `)}function O4($){if($)process.env.DEBUG=$;else delete process.env.DEBUG}function L4(){return process.env.DEBUG}function E4($){$.inspectOpts={};let J=Object.keys(R1.inspectOpts);for(let Q=0;Q<J.length;Q++)$.inspectOpts[J[Q]]=R1.inspectOpts[J[Q]]}i0.exports=lJ()(R1);var{formatters:c8}=i0.exports;c8.o=function($){return this.inspectOpts.colors=this.useColors,n0.inspect($,this.inspectOpts).split(`
26
- `).map((J)=>J.trim()).join(" ")};c8.O=function($){return this.inspectOpts.colors=this.useColors,n0.inspect($,this.inspectOpts)}});var d8=n((k3,dJ)=>{if(typeof process==="undefined"||process.type==="renderer"||!1||process.__nwjs)dJ.exports=y8();else dJ.exports=p8()});var $6=n((eJ)=>{Object.defineProperty(eJ,"__esModule",{value:!0});var C4=function(){function $(){this._listeners=[]}return Object.defineProperty($.prototype,"event",{get:function(){var J=this;if(!this._event)this._event=function(Q){J._listeners.push(Q);var X={dispose:function(){for(var Y=0;Y<J._listeners.length;Y++)if(J._listeners[Y]===Q){J._listeners.splice(Y,1);return}}};return X};return this._event},enumerable:!0,configurable:!0}),$.prototype.fire=function(J){var Q=[];for(var X=0;X<this._listeners.length;X++)Q.push(this._listeners[X]);for(var X=0;X<Q.length;X++)Q[X].call(void 0,J)},$}();eJ.EventEmitter2=C4});var J6=n((D0)=>{Object.defineProperty(D0,"__esModule",{value:!0});var w4=require("events"),XQ=$6();D0.DEFAULT_COLS=80;D0.DEFAULT_ROWS=24;var _4="\x13",Z4="\x11",T4=function(){function $(J){if(this._pid=0,this._fd=0,this._cols=0,this._rows=0,this._readable=!1,this._writable=!1,this._onData=new XQ.EventEmitter2,this._onExit=new XQ.EventEmitter2,this._internalee=new w4.EventEmitter,this.handleFlowControl=!!(J===null||J===void 0?void 0:J.handleFlowControl),this._flowControlPause=(J===null||J===void 0?void 0:J.flowControlPause)||_4,this._flowControlResume=(J===null||J===void 0?void 0:J.flowControlResume)||Z4,!J)return;this._checkType("name",J.name?J.name:void 0,"string"),this._checkType("cols",J.cols?J.cols:void 0,"number"),this._checkType("rows",J.rows?J.rows:void 0,"number"),this._checkType("cwd",J.cwd?J.cwd:void 0,"string"),this._checkType("env",J.env?J.env:void 0,"object"),this._checkType("uid",J.uid?J.uid:void 0,"number"),this._checkType("gid",J.gid?J.gid:void 0,"number"),this._checkType("encoding",J.encoding?J.encoding:void 0,"string")}return Object.defineProperty($.prototype,"onData",{get:function(){return this._onData.event},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"onExit",{get:function(){return this._onExit.event},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"pid",{get:function(){return this._pid},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"cols",{get:function(){return this._cols},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"rows",{get:function(){return this._rows},enumerable:!0,configurable:!0}),$.prototype.write=function(J){if(this.handleFlowControl){if(J===this._flowControlPause){this.pause();return}if(J===this._flowControlResume){this.resume();return}}this._write(J)},$.prototype._forwardEvents=function(){var J=this;this.on("data",function(Q){return J._onData.fire(Q)}),this.on("exit",function(Q,X){return J._onExit.fire({exitCode:Q,signal:X})})},$.prototype._checkType=function(J,Q,X,Y){if(Y===void 0)Y=!1;if(Q===void 0)return;if(Y){if(Array.isArray(Q)){Q.forEach(function(H,M){if(typeof H!==X)throw new Error(J+"["+M+"] must be a "+X+" (not a "+typeof H[M]+")")});return}}if(typeof Q!==X)throw new Error(J+" must be a "+X+" (not a "+typeof Q+")")},$.prototype.end=function(J){this._socket.end(J)},$.prototype.pipe=function(J,Q){return this._socket.pipe(J,Q)},$.prototype.pause=function(){return this._socket.pause()},$.prototype.resume=function(){return this._socket.resume()},$.prototype.setEncoding=function(J){if(this._socket._decoder)delete this._socket._decoder;if(J)this._socket.setEncoding(J)},$.prototype.addListener=function(J,Q){this.on(J,Q)},$.prototype.on=function(J,Q){if(J==="close"){this._internalee.on("close",Q);return}this._socket.on(J,Q)},$.prototype.emit=function(J){var Q=[];for(var X=1;X<arguments.length;X++)Q[X-1]=arguments[X];if(J==="close")return this._internalee.emit.apply(this._internalee,arguments);return this._socket.emit.apply(this._socket,arguments)},$.prototype.listeners=function(J){return this._socket.listeners(J)},$.prototype.removeListener=function(J,Q){this._socket.removeListener(J,Q)},$.prototype.removeAllListeners=function(J){this._socket.removeAllListeners(J)},$.prototype.once=function(J,Q){this._socket.once(J,Q)},$.prototype._close=function(){this._socket.readable=!1,this.write=function(){},this.end=function(){},this._writable=!1,this._readable=!1},$.prototype._parseEnv=function(J){var Q=Object.keys(J||{}),X=[];for(var Y=0;Y<Q.length;Y++){if(Q[Y]===void 0)continue;X.push(Q[Y]+"="+J[Q[Y]])}return X},$}();D0.Terminal=T4});var YQ=n((Q6)=>{Object.defineProperty(Q6,"__esModule",{value:!0});function x4($){return $+"-worker"}Q6.getWorkerPipeName=x4});var GQ=n((L$)=>{var __dirname="/home/kyle/projects/coder/blink/node_modules/@lydell/node-pty",v4=L$&&L$.__awaiter||function($,J,Q,X){function Y(H){return H instanceof Q?H:new Q(function(M){M(H)})}return new(Q||(Q=Promise))(function(H,M){function G(W){try{q(X.next(W))}catch(B){M(B)}}function K(W){try{q(X.throw(W))}catch(B){M(B)}}function q(W){W.done?H(W.value):Y(W.value).then(G,K)}q((X=X.apply($,J||[])).next())})},k4=L$&&L$.__generator||function($,J){var Q={label:0,sent:function(){if(H[0]&1)throw H[1];return H[1]},trys:[],ops:[]},X,Y,H,M;return M={next:G(0),throw:G(1),return:G(2)},typeof Symbol==="function"&&(M[Symbol.iterator]=function(){return this}),M;function G(q){return function(W){return K([q,W])}}function K(q){if(X)throw new TypeError("Generator is already executing.");while(Q)try{if(X=1,Y&&(H=q[0]&2?Y.return:q[0]?Y.throw||((H=Y.return)&&H.call(Y),0):Y.next)&&!(H=H.call(Y,q[1])).done)return H;if(Y=0,H)q=[q[0]&2,H.value];switch(q[0]){case 0:case 1:H=q;break;case 4:return Q.label++,{value:q[1],done:!1};case 5:Q.label++,Y=q[1],q=[0];continue;case 7:q=Q.ops.pop(),Q.trys.pop();continue;default:if((H=Q.trys,!(H=H.length>0&&H[H.length-1]))&&(q[0]===6||q[0]===2)){Q=0;continue}if(q[0]===3&&(!H||q[1]>H[0]&&q[1]<H[3])){Q.label=q[1];break}if(q[0]===6&&Q.label<H[1]){Q.label=H[1],H=q;break}if(H&&Q.label<H[2]){Q.label=H[2],Q.ops.push(q);break}if(H[2])Q.ops.pop();Q.trys.pop();continue}q=J.call($,Q)}catch(W){q=[6,W],Y=0}finally{X=H=0}if(q[0]&5)throw q[1];return{value:q[0]?q[1]:void 0,done:!0}}};Object.defineProperty(L$,"__esModule",{value:!0});var h4=require("worker_threads"),g4=YQ(),y4=require("path"),b4=$6(),f4=1000,m4=function(){function $(J){var Q=this;this._conoutPipeName=J,this._isDisposed=!1,this._onReady=new b4.EventEmitter2;var X={conoutPipeName:J},Y=__dirname.replace("node_modules.asar","node_modules.asar.unpacked");this._worker=new h4.Worker(y4.join(Y,"worker/conoutSocketWorker.js"),{workerData:X}),this._worker.on("message",function(H){switch(H){case 1:Q._onReady.fire();return;default:console.warn("Unexpected ConoutWorkerMessage",H)}})}return Object.defineProperty($.prototype,"onReady",{get:function(){return this._onReady.event},enumerable:!0,configurable:!0}),$.prototype.dispose=function(){if(this._isDisposed)return;this._isDisposed=!0,this._drainDataAndClose()},$.prototype.connectSocket=function(J){J.connect(g4.getWorkerPipeName(this._conoutPipeName))},$.prototype._drainDataAndClose=function(){var J=this;if(this._drainTimeout)clearTimeout(this._drainTimeout);this._drainTimeout=setTimeout(function(){return J._destroySocket()},f4)},$.prototype._destroySocket=function(){return v4(this,void 0,void 0,function(){return k4(this,function(J){switch(J.label){case 0:return[4,this._worker.terminate()];case 1:return J.sent(),[2]}})})},$}();L$.ConoutConnection=m4});var HQ=n((V9,u4)=>{u4.exports={name:"@lydell/node-pty",description:"node-pty with prebuilt binaries",author:"Simon Lydell",version:"1.1.0",license:"MIT",main:"./index.js",types:"./node-pty.d.ts",repository:{type:"git",url:"git://github.com/lydell/node-pty.git"},keywords:["pty","tty","terminal","pseudoterminal","forkpty","openpty","prebuild","prebuilt"],optionalDependencies:{"@lydell/node-pty-darwin-x64":"1.1.0","@lydell/node-pty-darwin-arm64":"1.1.0","@lydell/node-pty-linux-x64":"1.1.0","@lydell/node-pty-linux-arm64":"1.1.0","@lydell/node-pty-win32-x64":"1.1.0","@lydell/node-pty-win32-arm64":"1.1.0"}}});var Y6=n((X6)=>{Object.defineProperty(X6,"__esModule",{value:!0});var r0="@lydell/node-pty-"+process.platform+"-"+process.arch,jQ=`
24
+ `+H),$.push(Y+"m+"+o0.exports.humanize(this.diff)+"\x1B[0m")}else $[0]=F4()+J+" "+$[0]}function F4(){if(R$.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function D4(...$){return process.stderr.write(i0.formatWithOptions(R$.inspectOpts,...$)+`
25
+ `)}function O4($){if($)process.env.DEBUG=$;else delete process.env.DEBUG}function L4(){return process.env.DEBUG}function E4($){$.inspectOpts={};let J=Object.keys(R$.inspectOpts);for(let Q=0;Q<J.length;Q++)$.inspectOpts[J[Q]]=R$.inspectOpts[J[Q]]}o0.exports=lJ()(R$);var{formatters:c8}=o0.exports;c8.o=function($){return this.inspectOpts.colors=this.useColors,i0.inspect($,this.inspectOpts).split(`
26
+ `).map((J)=>J.trim()).join(" ")};c8.O=function($){return this.inspectOpts.colors=this.useColors,i0.inspect($,this.inspectOpts)}});var d8=n((k3,dJ)=>{if(typeof process==="undefined"||process.type==="renderer"||!1||process.__nwjs)dJ.exports=y8();else dJ.exports=p8()});var $6=n((eJ)=>{Object.defineProperty(eJ,"__esModule",{value:!0});var C4=function(){function $(){this._listeners=[]}return Object.defineProperty($.prototype,"event",{get:function(){var J=this;if(!this._event)this._event=function(Q){J._listeners.push(Q);var X={dispose:function(){for(var Y=0;Y<J._listeners.length;Y++)if(J._listeners[Y]===Q){J._listeners.splice(Y,1);return}}};return X};return this._event},enumerable:!0,configurable:!0}),$.prototype.fire=function(J){var Q=[];for(var X=0;X<this._listeners.length;X++)Q.push(this._listeners[X]);for(var X=0;X<Q.length;X++)Q[X].call(void 0,J)},$}();eJ.EventEmitter2=C4});var J6=n((O0)=>{Object.defineProperty(O0,"__esModule",{value:!0});var w4=require("events"),XQ=$6();O0.DEFAULT_COLS=80;O0.DEFAULT_ROWS=24;var _4="\x13",Z4="\x11",T4=function(){function $(J){if(this._pid=0,this._fd=0,this._cols=0,this._rows=0,this._readable=!1,this._writable=!1,this._onData=new XQ.EventEmitter2,this._onExit=new XQ.EventEmitter2,this._internalee=new w4.EventEmitter,this.handleFlowControl=!!(J===null||J===void 0?void 0:J.handleFlowControl),this._flowControlPause=(J===null||J===void 0?void 0:J.flowControlPause)||_4,this._flowControlResume=(J===null||J===void 0?void 0:J.flowControlResume)||Z4,!J)return;this._checkType("name",J.name?J.name:void 0,"string"),this._checkType("cols",J.cols?J.cols:void 0,"number"),this._checkType("rows",J.rows?J.rows:void 0,"number"),this._checkType("cwd",J.cwd?J.cwd:void 0,"string"),this._checkType("env",J.env?J.env:void 0,"object"),this._checkType("uid",J.uid?J.uid:void 0,"number"),this._checkType("gid",J.gid?J.gid:void 0,"number"),this._checkType("encoding",J.encoding?J.encoding:void 0,"string")}return Object.defineProperty($.prototype,"onData",{get:function(){return this._onData.event},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"onExit",{get:function(){return this._onExit.event},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"pid",{get:function(){return this._pid},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"cols",{get:function(){return this._cols},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"rows",{get:function(){return this._rows},enumerable:!0,configurable:!0}),$.prototype.write=function(J){if(this.handleFlowControl){if(J===this._flowControlPause){this.pause();return}if(J===this._flowControlResume){this.resume();return}}this._write(J)},$.prototype._forwardEvents=function(){var J=this;this.on("data",function(Q){return J._onData.fire(Q)}),this.on("exit",function(Q,X){return J._onExit.fire({exitCode:Q,signal:X})})},$.prototype._checkType=function(J,Q,X,Y){if(Y===void 0)Y=!1;if(Q===void 0)return;if(Y){if(Array.isArray(Q)){Q.forEach(function(H,M){if(typeof H!==X)throw new Error(J+"["+M+"] must be a "+X+" (not a "+typeof H[M]+")")});return}}if(typeof Q!==X)throw new Error(J+" must be a "+X+" (not a "+typeof Q+")")},$.prototype.end=function(J){this._socket.end(J)},$.prototype.pipe=function(J,Q){return this._socket.pipe(J,Q)},$.prototype.pause=function(){return this._socket.pause()},$.prototype.resume=function(){return this._socket.resume()},$.prototype.setEncoding=function(J){if(this._socket._decoder)delete this._socket._decoder;if(J)this._socket.setEncoding(J)},$.prototype.addListener=function(J,Q){this.on(J,Q)},$.prototype.on=function(J,Q){if(J==="close"){this._internalee.on("close",Q);return}this._socket.on(J,Q)},$.prototype.emit=function(J){var Q=[];for(var X=1;X<arguments.length;X++)Q[X-1]=arguments[X];if(J==="close")return this._internalee.emit.apply(this._internalee,arguments);return this._socket.emit.apply(this._socket,arguments)},$.prototype.listeners=function(J){return this._socket.listeners(J)},$.prototype.removeListener=function(J,Q){this._socket.removeListener(J,Q)},$.prototype.removeAllListeners=function(J){this._socket.removeAllListeners(J)},$.prototype.once=function(J,Q){this._socket.once(J,Q)},$.prototype._close=function(){this._socket.readable=!1,this.write=function(){},this.end=function(){},this._writable=!1,this._readable=!1},$.prototype._parseEnv=function(J){var Q=Object.keys(J||{}),X=[];for(var Y=0;Y<Q.length;Y++){if(Q[Y]===void 0)continue;X.push(Q[Y]+"="+J[Q[Y]])}return X},$}();O0.Terminal=T4});var YQ=n((Q6)=>{Object.defineProperty(Q6,"__esModule",{value:!0});function x4($){return $+"-worker"}Q6.getWorkerPipeName=x4});var GQ=n((L1)=>{var __dirname="/home/kyle/projects/coder/blink/node_modules/@lydell/node-pty",v4=L1&&L1.__awaiter||function($,J,Q,X){function Y(H){return H instanceof Q?H:new Q(function(M){M(H)})}return new(Q||(Q=Promise))(function(H,M){function G(W){try{q(X.next(W))}catch(B){M(B)}}function K(W){try{q(X.throw(W))}catch(B){M(B)}}function q(W){W.done?H(W.value):Y(W.value).then(G,K)}q((X=X.apply($,J||[])).next())})},k4=L1&&L1.__generator||function($,J){var Q={label:0,sent:function(){if(H[0]&1)throw H[1];return H[1]},trys:[],ops:[]},X,Y,H,M;return M={next:G(0),throw:G(1),return:G(2)},typeof Symbol==="function"&&(M[Symbol.iterator]=function(){return this}),M;function G(q){return function(W){return K([q,W])}}function K(q){if(X)throw new TypeError("Generator is already executing.");while(Q)try{if(X=1,Y&&(H=q[0]&2?Y.return:q[0]?Y.throw||((H=Y.return)&&H.call(Y),0):Y.next)&&!(H=H.call(Y,q[1])).done)return H;if(Y=0,H)q=[q[0]&2,H.value];switch(q[0]){case 0:case 1:H=q;break;case 4:return Q.label++,{value:q[1],done:!1};case 5:Q.label++,Y=q[1],q=[0];continue;case 7:q=Q.ops.pop(),Q.trys.pop();continue;default:if((H=Q.trys,!(H=H.length>0&&H[H.length-1]))&&(q[0]===6||q[0]===2)){Q=0;continue}if(q[0]===3&&(!H||q[1]>H[0]&&q[1]<H[3])){Q.label=q[1];break}if(q[0]===6&&Q.label<H[1]){Q.label=H[1],H=q;break}if(H&&Q.label<H[2]){Q.label=H[2],Q.ops.push(q);break}if(H[2])Q.ops.pop();Q.trys.pop();continue}q=J.call($,Q)}catch(W){q=[6,W],Y=0}finally{X=H=0}if(q[0]&5)throw q[1];return{value:q[0]?q[1]:void 0,done:!0}}};Object.defineProperty(L1,"__esModule",{value:!0});var h4=require("worker_threads"),g4=YQ(),y4=require("path"),b4=$6(),f4=1000,m4=function(){function $(J){var Q=this;this._conoutPipeName=J,this._isDisposed=!1,this._onReady=new b4.EventEmitter2;var X={conoutPipeName:J},Y=__dirname.replace("node_modules.asar","node_modules.asar.unpacked");this._worker=new h4.Worker(y4.join(Y,"worker/conoutSocketWorker.js"),{workerData:X}),this._worker.on("message",function(H){switch(H){case 1:Q._onReady.fire();return;default:console.warn("Unexpected ConoutWorkerMessage",H)}})}return Object.defineProperty($.prototype,"onReady",{get:function(){return this._onReady.event},enumerable:!0,configurable:!0}),$.prototype.dispose=function(){if(this._isDisposed)return;this._isDisposed=!0,this._drainDataAndClose()},$.prototype.connectSocket=function(J){J.connect(g4.getWorkerPipeName(this._conoutPipeName))},$.prototype._drainDataAndClose=function(){var J=this;if(this._drainTimeout)clearTimeout(this._drainTimeout);this._drainTimeout=setTimeout(function(){return J._destroySocket()},f4)},$.prototype._destroySocket=function(){return v4(this,void 0,void 0,function(){return k4(this,function(J){switch(J.label){case 0:return[4,this._worker.terminate()];case 1:return J.sent(),[2]}})})},$}();L1.ConoutConnection=m4});var HQ=n((V9,u4)=>{u4.exports={name:"@lydell/node-pty",description:"node-pty with prebuilt binaries",author:"Simon Lydell",version:"1.1.0",license:"MIT",main:"./index.js",types:"./node-pty.d.ts",repository:{type:"git",url:"git://github.com/lydell/node-pty.git"},keywords:["pty","tty","terminal","pseudoterminal","forkpty","openpty","prebuild","prebuilt"],optionalDependencies:{"@lydell/node-pty-darwin-x64":"1.1.0","@lydell/node-pty-darwin-arm64":"1.1.0","@lydell/node-pty-linux-x64":"1.1.0","@lydell/node-pty-linux-arm64":"1.1.0","@lydell/node-pty-win32-x64":"1.1.0","@lydell/node-pty-win32-arm64":"1.1.0"}}});var Y6=n((X6)=>{Object.defineProperty(X6,"__esModule",{value:!0});var a0="@lydell/node-pty-"+process.platform+"-"+process.arch,jQ=`
27
27
  This can happen if you use the "--omit=optional" (or "--no-optional") npm flag.
28
28
  The "optionalDependencies" package.json feature is used to install the correct
29
29
  binary executable for your current platform. Remove that flag to use @lydell/node-pty.
@@ -31,23 +31,23 @@ binary executable for your current platform. Remove that flag to use @lydell/nod
31
31
  This can also happen if the "node_modules" folder was copied between two operating systems
32
32
  that need different binaries - including "virtual" operating systems like Docker and WSL.
33
33
  If so, try installing with npm rather than copying "node_modules".
34
- `.trim();function l4($){try{return require(r0+"/"+$)}catch(Q){if(Q&&Q.code==="MODULE_NOT_FOUND"){var J=c4();throw new Error(J===void 0?"The @lydell/node-pty package could not find the binary package: "+r0+"/"+$+`
34
+ `.trim();function l4($){try{return require(a0+"/"+$)}catch(Q){if(Q&&Q.code==="MODULE_NOT_FOUND"){var J=c4();throw new Error(J===void 0?"The @lydell/node-pty package could not find the binary package: "+a0+"/"+$+`
35
35
 
36
36
  `+jQ+`
37
37
 
38
- Your platform (`+process.platform+"-"+process.arch+") might not be supported.":(r0 in J)?"The @lydell/node-pty package supports your platform ("+process.platform+"-"+process.arch+"), but it could not find the binary package for it: "+r0+"/"+$+`
38
+ Your platform (`+process.platform+"-"+process.arch+") might not be supported.":(a0 in J)?"The @lydell/node-pty package supports your platform ("+process.platform+"-"+process.arch+"), but it could not find the binary package for it: "+a0+"/"+$+`
39
39
 
40
- `+jQ:"The @lydell/node-pty package currently does not support your platform: "+process.platform+"-"+process.arch,{cause:Q})}else throw Q}}X6.requireBinary=l4;function c4(){try{return HQ().optionalDependencies}catch($){return}}});var RQ=n((s0)=>{var __dirname="/home/kyle/projects/coder/blink/node_modules/@lydell/node-pty";Object.defineProperty(s0,"__esModule",{value:!0});var p4=require("fs"),VQ=require("path"),KQ=require("net"),d4=require("child_process"),n4=GQ(),i4=Y6(),G6,o4=1000,r4=function(){function $(J,Q,X,Y,H,M,G,K){var q=this;if(K===void 0)K=!1;if(this._pid=0,this._innerPid=0,!G6)G6=i4.requireBinary("conpty.node");this._ptyNative=G6,Y=VQ.resolve(Y);var W=H6(J,Q),B=this._ptyNative.startProcess(J,H,M,G,this._generatePipeName(),K);this._fd=B.fd,this._pty=B.pty,this._outSocket=new KQ.Socket,this._outSocket.setEncoding("utf8"),this._conoutSocketWorker=new n4.ConoutConnection(B.conout),this._conoutSocketWorker.onReady(function(){q._conoutSocketWorker.connectSocket(q._outSocket)}),this._outSocket.on("connect",function(){q._outSocket.emit("ready_datapipe")});var U=p4.openSync(B.conin,"w");this._inSocket=new KQ.Socket({fd:U,readable:!1,writable:!0}),this._inSocket.setEncoding("utf8");var R=this._ptyNative.connect(this._pty,W,Y,X,function(D){return q._$onProcessExit(D)});this._innerPid=R.pid}return Object.defineProperty($.prototype,"inSocket",{get:function(){return this._inSocket},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"outSocket",{get:function(){return this._outSocket},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"fd",{get:function(){return this._fd},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"innerPid",{get:function(){return this._innerPid},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"pty",{get:function(){return this._pty},enumerable:!0,configurable:!0}),$.prototype.resize=function(J,Q){if(this._exitCode!==void 0)throw new Error("Cannot resize a pty that has already exited");this._ptyNative.resize(this._pty,J,Q)},$.prototype.clear=function(){this._ptyNative.clear(this._pty)},$.prototype.kill=function(){var J=this;this._inSocket.readable=!1,this._outSocket.readable=!1,this._getConsoleProcessList().then(function(Q){Q.forEach(function(X){try{process.kill(X)}catch(Y){}}),J._ptyNative.kill(J._pty)}),this._conoutSocketWorker.dispose()},$.prototype._getConsoleProcessList=function(){var J=this;return new Promise(function(Q){var X=d4.fork(VQ.join(__dirname,"conpty_console_list_agent"),[J._innerPid.toString()]);X.on("message",function(H){clearTimeout(Y),Q(H.consoleProcessList)});var Y=setTimeout(function(){X.kill(),Q([J._innerPid])},5000)})},Object.defineProperty($.prototype,"exitCode",{get:function(){return this._exitCode},enumerable:!0,configurable:!0}),$.prototype._generatePipeName=function(){return"conpty-"+Math.random()*1e7},$.prototype._$onProcessExit=function(J){var Q=this;this._exitCode=J,this._flushDataAndCleanUp(),this._outSocket.on("data",function(){return Q._flushDataAndCleanUp()})},$.prototype._flushDataAndCleanUp=function(){var J=this;if(this._closeTimeout)clearTimeout(this._closeTimeout);this._closeTimeout=setTimeout(function(){return J._cleanUpProcess()},o4)},$.prototype._cleanUpProcess=function(){this._inSocket.readable=!1,this._outSocket.readable=!1,this._outSocket.destroy()},$}();s0.WindowsPtyAgent=r4;function H6($,J){if(a4(J)){if(J.length===0)return $;return H6($,[])+" "+J}var Q=[$];Array.prototype.push.apply(Q,J);var X="";for(var Y=0;Y<Q.length;Y++){if(Y>0)X+=" ";var H=Q[Y],M=s4(H[0]!=='"',H[H.length-1]!=='"'),G=H[0]!=='"'&&H[H.length-1]!=='"',K=H===""||(H.indexOf(" ")!==-1||H.indexOf("\t")!==-1)&&(H.length>1&&(M||G));if(K)X+='"';var q=0;for(var W=0;W<H.length;W++){var B=H[W];if(B==="\\")q++;else if(B==='"')X+=a0("\\",q*2+1),X+='"',q=0;else X+=a0("\\",q),q=0,X+=B}if(K)X+=a0("\\",q*2),X+='"';else X+=a0("\\",q)}return X}s0.argsToCommandLine=H6;function a4($){return typeof $==="string"}function a0($,J){var Q="";for(var X=0;X<J;X++)Q+=$;return Q}function s4($,J){return $&&!J||!$&&J}});var V6=n((j6)=>{Object.defineProperty(j6,"__esModule",{value:!0});function t4($){var J=[];for(var Q=1;Q<arguments.length;Q++)J[Q-1]=arguments[Q];return J.forEach(function(X){return Object.keys(X).forEach(function(Y){return $[Y]=X[Y]})}),$}j6.assign=t4});var WQ=n((O0)=>{var e4=O0&&O0.__extends||function(){var $=function(J,Q){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,Y){X.__proto__=Y}||function(X,Y){for(var H in Y)if(Y.hasOwnProperty(H))X[H]=Y[H]},$(J,Q)};return function(J,Q){$(J,Q);function X(){this.constructor=J}J.prototype=Q===null?Object.create(Q):(X.prototype=Q.prototype,new X)}}();Object.defineProperty(O0,"__esModule",{value:!0});var K6=J6(),$G=RQ(),JG=V6(),QG="cmd.exe",XG="Windows Shell",YG=function($){e4(J,$);function J(Q,X,Y){var H=$.call(this,Y)||this;if(H._checkType("args",X,"string",!0),X=X||[],Q=Q||QG,Y=Y||{},Y.env=Y.env||process.env,Y.encoding)console.warn("Setting encoding on Windows is not supported");var M=JG.assign({},Y.env);H._cols=Y.cols||K6.DEFAULT_COLS,H._rows=Y.rows||K6.DEFAULT_ROWS;var G=Y.cwd||process.cwd(),K=Y.name||M.TERM||XG,q=H._parseEnv(M);return H._isReady=!1,H._deferreds=[],H._agent=new $G.WindowsPtyAgent(Q,X,q,G,H._cols,H._rows,!1,Y.conptyInheritCursor),H._socket=H._agent.outSocket,H._pid=H._agent.innerPid,H._fd=H._agent.fd,H._pty=H._agent.pty,H._socket.on("ready_datapipe",function(){["connect","data","end","timeout","drain"].forEach(function(W){H._socket.on(W,function(){if(!H._isReady&&W==="data")H._isReady=!0,H._deferreds.forEach(function(B){B.run()}),H._deferreds=[]})}),H._socket.on("error",function(W){if(H._close(),W.code){if(~W.code.indexOf("errno 5")||~W.code.indexOf("EIO"))return}if(H.listeners("error").length<2)throw W}),H._socket.on("close",function(){H.emit("exit",H._agent.exitCode),H._close()})}),H._file=Q,H._name=K,H._readable=!0,H._writable=!0,H._forwardEvents(),H}return J.prototype._write=function(Q){this._defer(this._doWrite,Q)},J.prototype._doWrite=function(Q){this._agent.inSocket.write(Q)},J.open=function(Q){throw new Error("open() not supported on windows, use Fork() instead.")},J.prototype.resize=function(Q,X){var Y=this;if(Q<=0||X<=0||isNaN(Q)||isNaN(X)||Q===1/0||X===1/0)throw new Error("resizing must be done using positive cols and rows");this._deferNoArgs(function(){Y._agent.resize(Q,X),Y._cols=Q,Y._rows=X})},J.prototype.clear=function(){var Q=this;this._deferNoArgs(function(){Q._agent.clear()})},J.prototype.destroy=function(){var Q=this;this._deferNoArgs(function(){Q.kill()})},J.prototype.kill=function(Q){var X=this;this._deferNoArgs(function(){if(Q)throw new Error("Signals not supported on windows.");X._close(),X._agent.kill()})},J.prototype._deferNoArgs=function(Q){var X=this;if(this._isReady){Q.call(this);return}this._deferreds.push({run:function(){return Q.call(X)}})},J.prototype._defer=function(Q,X){var Y=this;if(this._isReady){Q.call(this,X);return}this._deferreds.push({run:function(){return Q.call(Y,X)}})},Object.defineProperty(J.prototype,"process",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"master",{get:function(){throw new Error("master is not supported on Windows")},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"slave",{get:function(){throw new Error("slave is not supported on Windows")},enumerable:!0,configurable:!0}),J}(K6.Terminal);O0.WindowsTerminal=YG});var qQ=n((A0)=>{var GG=A0&&A0.__extends||function(){var $=function(J,Q){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,Y){X.__proto__=Y}||function(X,Y){for(var H in Y)if(Y.hasOwnProperty(H))X[H]=Y[H]},$(J,Q)};return function(J,Q){$(J,Q);function X(){this.constructor=J}J.prototype=Q===null?Object.create(Q):(X.prototype=Q.prototype,new X)}}();Object.defineProperty(A0,"__esModule",{value:!0});var R6=require("tty"),L0=J6(),HG=V6(),jG=Y6(),E0=jG.requireBinary("pty.node"),E$="@lydell/node-pty-"+process.platform+"-"+process.arch+"/spawn-helper";E$=process.platform==="darwin"?require.resolve(E$):"spawn-helper-unused";E$=E$.replace("app.asar","app.asar.unpacked");E$=E$.replace("node_modules.asar","node_modules.asar.unpacked");var VG="sh",KG="xterm",RG=200,WG=function($){GG(J,$);function J(Q,X,Y){var H,M,G=$.call(this,Y)||this;if(G._boundClose=!1,G._emittedClose=!1,typeof X==="string")throw new Error("args as a string is not supported on unix.");X=X||[],Q=Q||VG,Y=Y||{},Y.env=Y.env||process.env,G._cols=Y.cols||L0.DEFAULT_COLS,G._rows=Y.rows||L0.DEFAULT_ROWS;var K=(H=Y.uid)!==null&&H!==void 0?H:-1,q=(M=Y.gid)!==null&&M!==void 0?M:-1,W=HG.assign({},Y.env);if(Y.env===process.env)G._sanitizeEnv(W);var B=Y.cwd||process.cwd();W.PWD=B;var U=Y.name||W.TERM||KG;W.TERM=U;var R=G._parseEnv(W),D=Y.encoding===void 0?"utf8":Y.encoding,j=function(L,F){if(!G._emittedClose){if(G._boundClose)return;G._boundClose=!0;var N=setTimeout(function(){N=null,G._socket.destroy()},RG);G.once("close",function(){if(N!==null)clearTimeout(N);G.emit("exit",L,F)});return}G.emit("exit",L,F)},V=E0.fork(Q,X,R,B,G._cols,G._rows,K,q,D==="utf8",E$,j);if(G._socket=new R6.ReadStream(V.fd),D!==null)G._socket.setEncoding(D);return G._socket.on("error",function(L){if(L.code){if(~L.code.indexOf("EAGAIN"))return}if(G._close(),!G._emittedClose)G._emittedClose=!0,G.emit("close");if(L.code){if(~L.code.indexOf("errno 5")||~L.code.indexOf("EIO"))return}if(G.listeners("error").length<2)throw L}),G._pid=V.pid,G._fd=V.fd,G._pty=V.pty,G._file=Q,G._name=U,G._readable=!0,G._writable=!0,G._socket.on("close",function(){if(G._emittedClose)return;G._emittedClose=!0,G._close(),G.emit("close")}),G._forwardEvents(),G}return Object.defineProperty(J.prototype,"master",{get:function(){return this._master},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"slave",{get:function(){return this._slave},enumerable:!0,configurable:!0}),J.prototype._write=function(Q){this._socket.write(Q)},Object.defineProperty(J.prototype,"fd",{get:function(){return this._fd},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"ptsName",{get:function(){return this._pty},enumerable:!0,configurable:!0}),J.open=function(Q){var X=Object.create(J.prototype);if(Q=Q||{},arguments.length>1)Q={cols:arguments[1],rows:arguments[2]};var Y=Q.cols||L0.DEFAULT_COLS,H=Q.rows||L0.DEFAULT_ROWS,M=Q.encoding===void 0?"utf8":Q.encoding,G=E0.open(Y,H);if(X._master=new R6.ReadStream(G.master),M!==null)X._master.setEncoding(M);if(X._master.resume(),X._slave=new R6.ReadStream(G.slave),M!==null)X._slave.setEncoding(M);return X._slave.resume(),X._socket=X._master,X._pid=-1,X._fd=G.master,X._pty=G.pty,X._file=process.argv[0]||"node",X._name=process.env.TERM||"",X._readable=!0,X._writable=!0,X._socket.on("error",function(K){if(X._close(),X.listeners("error").length<2)throw K}),X._socket.on("close",function(){X._close()}),X},J.prototype.destroy=function(){var Q=this;this._close(),this._socket.once("close",function(){Q.kill("SIGHUP")}),this._socket.destroy()},J.prototype.kill=function(Q){try{process.kill(this.pid,Q||"SIGHUP")}catch(X){}},Object.defineProperty(J.prototype,"process",{get:function(){if(process.platform==="darwin"){var Q=E0.process(this._fd);return Q!=="kernel_task"?Q:this._file}return E0.process(this._fd,this._pty)||this._file},enumerable:!0,configurable:!0}),J.prototype.resize=function(Q,X){if(Q<=0||X<=0||isNaN(Q)||isNaN(X)||Q===1/0||X===1/0)throw new Error("resizing must be done using positive cols and rows");E0.resize(this._fd,Q,X),this._cols=Q,this._rows=X},J.prototype.clear=function(){},J.prototype._sanitizeEnv=function(Q){delete Q.TMUX,delete Q.TMUX_PANE,delete Q.STY,delete Q.WINDOW,delete Q.WINDOWID,delete Q.TERMCAP,delete Q.COLUMNS,delete Q.LINES},J}(L0.Terminal);A0.UnixTerminal=WG});var MQ=n((m$)=>{Object.defineProperty(m$,"__esModule",{value:!0});var f$;if(process.platform==="win32")f$=WQ().WindowsTerminal;else f$=qQ().UnixTerminal;function qG($,J,Q){return new f$($,J,Q)}m$.spawn=qG;function MG($,J,Q){return new f$($,J,Q)}m$.fork=MG;function BG($,J,Q){return new f$($,J,Q)}m$.createTerminal=BG;function NG($){return f$.open($)}m$.open=NG});var BQ=n((I0,W6)=>{(function($,J){typeof I0=="object"&&typeof W6=="object"?W6.exports=J():typeof define=="function"&&define.amd?define([],J):typeof I0=="object"?I0.SerializeAddon=J():$.SerializeAddon=J()})(I0,()=>(()=>{var $={930:(Y,H,M)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.ColorContrastCache=void 0;let G=M(485);H.ColorContrastCache=class{constructor(){this._color=new G.TwoKeyMap,this._css=new G.TwoKeyMap}setCss(K,q,W){this._css.set(K,q,W)}getCss(K,q){return this._css.get(K,q)}setColor(K,q,W){this._color.set(K,q,W)}getColor(K,q){return this._color.get(K,q)}clear(){this._color.clear(),this._css.clear()}}},997:function(Y,H,M){var G=this&&this.__decorate||function(A,I,w,Z){var k,x=arguments.length,T=x<3?I:Z===null?Z=Object.getOwnPropertyDescriptor(I,w):Z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(A,I,w,Z);else for(var g=A.length-1;g>=0;g--)(k=A[g])&&(T=(x<3?k(T):x>3?k(I,w,T):k(I,w))||T);return x>3&&T&&Object.defineProperty(I,w,T),T},K=this&&this.__param||function(A,I){return function(w,Z){I(w,Z,A)}};Object.defineProperty(H,"__esModule",{value:!0}),H.ThemeService=H.DEFAULT_ANSI_COLORS=void 0;let q=M(930),W=M(160),B=M(345),U=M(859),R=M(97),D=W.css.toColor("#ffffff"),j=W.css.toColor("#000000"),V=W.css.toColor("#ffffff"),L=W.css.toColor("#000000"),F={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};H.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let A=[W.css.toColor("#2e3436"),W.css.toColor("#cc0000"),W.css.toColor("#4e9a06"),W.css.toColor("#c4a000"),W.css.toColor("#3465a4"),W.css.toColor("#75507b"),W.css.toColor("#06989a"),W.css.toColor("#d3d7cf"),W.css.toColor("#555753"),W.css.toColor("#ef2929"),W.css.toColor("#8ae234"),W.css.toColor("#fce94f"),W.css.toColor("#729fcf"),W.css.toColor("#ad7fa8"),W.css.toColor("#34e2e2"),W.css.toColor("#eeeeec")],I=[0,95,135,175,215,255];for(let w=0;w<216;w++){let Z=I[w/36%6|0],k=I[w/6%6|0],x=I[w%6];A.push({css:W.channels.toCss(Z,k,x),rgba:W.channels.toRgba(Z,k,x)})}for(let w=0;w<24;w++){let Z=8+10*w;A.push({css:W.channels.toCss(Z,Z,Z),rgba:W.channels.toRgba(Z,Z,Z)})}return A})());let N=H.ThemeService=class extends U.Disposable{get colors(){return this._colors}constructor(A){super(),this._optionsService=A,this._contrastCache=new q.ColorContrastCache,this._halfContrastCache=new q.ColorContrastCache,this._onChangeColors=this.register(new B.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:D,background:j,cursor:V,cursorAccent:L,selectionForeground:void 0,selectionBackgroundTransparent:F,selectionBackgroundOpaque:W.color.blend(j,F),selectionInactiveBackgroundTransparent:F,selectionInactiveBackgroundOpaque:W.color.blend(j,F),ansi:H.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(A={}){let I=this._colors;if(I.foreground=O(A.foreground,D),I.background=O(A.background,j),I.cursor=O(A.cursor,V),I.cursorAccent=O(A.cursorAccent,L),I.selectionBackgroundTransparent=O(A.selectionBackground,F),I.selectionBackgroundOpaque=W.color.blend(I.background,I.selectionBackgroundTransparent),I.selectionInactiveBackgroundTransparent=O(A.selectionInactiveBackground,I.selectionBackgroundTransparent),I.selectionInactiveBackgroundOpaque=W.color.blend(I.background,I.selectionInactiveBackgroundTransparent),I.selectionForeground=A.selectionForeground?O(A.selectionForeground,W.NULL_COLOR):void 0,I.selectionForeground===W.NULL_COLOR&&(I.selectionForeground=void 0),W.color.isOpaque(I.selectionBackgroundTransparent))I.selectionBackgroundTransparent=W.color.opacity(I.selectionBackgroundTransparent,0.3);if(W.color.isOpaque(I.selectionInactiveBackgroundTransparent))I.selectionInactiveBackgroundTransparent=W.color.opacity(I.selectionInactiveBackgroundTransparent,0.3);if(I.ansi=H.DEFAULT_ANSI_COLORS.slice(),I.ansi[0]=O(A.black,H.DEFAULT_ANSI_COLORS[0]),I.ansi[1]=O(A.red,H.DEFAULT_ANSI_COLORS[1]),I.ansi[2]=O(A.green,H.DEFAULT_ANSI_COLORS[2]),I.ansi[3]=O(A.yellow,H.DEFAULT_ANSI_COLORS[3]),I.ansi[4]=O(A.blue,H.DEFAULT_ANSI_COLORS[4]),I.ansi[5]=O(A.magenta,H.DEFAULT_ANSI_COLORS[5]),I.ansi[6]=O(A.cyan,H.DEFAULT_ANSI_COLORS[6]),I.ansi[7]=O(A.white,H.DEFAULT_ANSI_COLORS[7]),I.ansi[8]=O(A.brightBlack,H.DEFAULT_ANSI_COLORS[8]),I.ansi[9]=O(A.brightRed,H.DEFAULT_ANSI_COLORS[9]),I.ansi[10]=O(A.brightGreen,H.DEFAULT_ANSI_COLORS[10]),I.ansi[11]=O(A.brightYellow,H.DEFAULT_ANSI_COLORS[11]),I.ansi[12]=O(A.brightBlue,H.DEFAULT_ANSI_COLORS[12]),I.ansi[13]=O(A.brightMagenta,H.DEFAULT_ANSI_COLORS[13]),I.ansi[14]=O(A.brightCyan,H.DEFAULT_ANSI_COLORS[14]),I.ansi[15]=O(A.brightWhite,H.DEFAULT_ANSI_COLORS[15]),A.extendedAnsi){let w=Math.min(I.ansi.length-16,A.extendedAnsi.length);for(let Z=0;Z<w;Z++)I.ansi[Z+16]=O(A.extendedAnsi[Z],H.DEFAULT_ANSI_COLORS[Z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(A){this._restoreColor(A),this._onChangeColors.fire(this.colors)}_restoreColor(A){if(A!==void 0)switch(A){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[A]=this._restoreColors.ansi[A]}else for(let I=0;I<this._restoreColors.ansi.length;++I)this._colors.ansi[I]=this._restoreColors.ansi[I]}modifyColors(A){A(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function O(A,I){if(A!==void 0)try{return W.css.toColor(A)}catch{}return I}H.ThemeService=N=G([K(0,R.IOptionsService)],N)},160:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.contrastRatio=H.toPaddedHex=H.rgba=H.rgb=H.css=H.color=H.channels=H.NULL_COLOR=void 0;let M=0,G=0,K=0,q=0;var W,B,U,R,D;function j(L){let F=L.toString(16);return F.length<2?"0"+F:F}function V(L,F){return L<F?(F+0.05)/(L+0.05):(L+0.05)/(F+0.05)}H.NULL_COLOR={css:"#00000000",rgba:0},function(L){L.toCss=function(F,N,O,A){return A!==void 0?`#${j(F)}${j(N)}${j(O)}${j(A)}`:`#${j(F)}${j(N)}${j(O)}`},L.toRgba=function(F,N,O,A=255){return(F<<24|N<<16|O<<8|A)>>>0},L.toColor=function(F,N,O,A){return{css:L.toCss(F,N,O,A),rgba:L.toRgba(F,N,O,A)}}}(W||(H.channels=W={})),function(L){function F(N,O){return q=Math.round(255*O),[M,G,K]=D.toChannels(N.rgba),{css:W.toCss(M,G,K,q),rgba:W.toRgba(M,G,K,q)}}L.blend=function(N,O){if(q=(255&O.rgba)/255,q===1)return{css:O.css,rgba:O.rgba};let A=O.rgba>>24&255,I=O.rgba>>16&255,w=O.rgba>>8&255,Z=N.rgba>>24&255,k=N.rgba>>16&255,x=N.rgba>>8&255;return M=Z+Math.round((A-Z)*q),G=k+Math.round((I-k)*q),K=x+Math.round((w-x)*q),{css:W.toCss(M,G,K),rgba:W.toRgba(M,G,K)}},L.isOpaque=function(N){return(255&N.rgba)==255},L.ensureContrastRatio=function(N,O,A){let I=D.ensureContrastRatio(N.rgba,O.rgba,A);if(I)return W.toColor(I>>24&255,I>>16&255,I>>8&255)},L.opaque=function(N){let O=(255|N.rgba)>>>0;return[M,G,K]=D.toChannels(O),{css:W.toCss(M,G,K),rgba:O}},L.opacity=F,L.multiplyOpacity=function(N,O){return q=255&N.rgba,F(N,q*O/255)},L.toColorRGB=function(N){return[N.rgba>>24&255,N.rgba>>16&255,N.rgba>>8&255]}}(B||(H.color=B={})),function(L){let F,N;try{let O=document.createElement("canvas");O.width=1,O.height=1;let A=O.getContext("2d",{willReadFrequently:!0});A&&(F=A,F.globalCompositeOperation="copy",N=F.createLinearGradient(0,0,1,1))}catch{}L.toColor=function(O){if(O.match(/#[\da-f]{3,8}/i))switch(O.length){case 4:return M=parseInt(O.slice(1,2).repeat(2),16),G=parseInt(O.slice(2,3).repeat(2),16),K=parseInt(O.slice(3,4).repeat(2),16),W.toColor(M,G,K);case 5:return M=parseInt(O.slice(1,2).repeat(2),16),G=parseInt(O.slice(2,3).repeat(2),16),K=parseInt(O.slice(3,4).repeat(2),16),q=parseInt(O.slice(4,5).repeat(2),16),W.toColor(M,G,K,q);case 7:return{css:O,rgba:(parseInt(O.slice(1),16)<<8|255)>>>0};case 9:return{css:O,rgba:parseInt(O.slice(1),16)>>>0}}let A=O.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(A)return M=parseInt(A[1]),G=parseInt(A[2]),K=parseInt(A[3]),q=Math.round(255*(A[5]===void 0?1:parseFloat(A[5]))),W.toColor(M,G,K,q);if(!F||!N)throw new Error("css.toColor: Unsupported css format");if(F.fillStyle=N,F.fillStyle=O,typeof F.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(F.fillRect(0,0,1,1),[M,G,K,q]=F.getImageData(0,0,1,1).data,q!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:W.toRgba(M,G,K,q),css:O}}}(U||(H.css=U={})),function(L){function F(N,O,A){let I=N/255,w=O/255,Z=A/255;return 0.2126*(I<=0.03928?I/12.92:Math.pow((I+0.055)/1.055,2.4))+0.7152*(w<=0.03928?w/12.92:Math.pow((w+0.055)/1.055,2.4))+0.0722*(Z<=0.03928?Z/12.92:Math.pow((Z+0.055)/1.055,2.4))}L.relativeLuminance=function(N){return F(N>>16&255,N>>8&255,255&N)},L.relativeLuminance2=F}(R||(H.rgb=R={})),function(L){function F(O,A,I){let w=O>>24&255,Z=O>>16&255,k=O>>8&255,x=A>>24&255,T=A>>16&255,g=A>>8&255,Q1=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));for(;Q1<I&&(x>0||T>0||g>0);)x-=Math.max(0,Math.ceil(0.1*x)),T-=Math.max(0,Math.ceil(0.1*T)),g-=Math.max(0,Math.ceil(0.1*g)),Q1=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));return(x<<24|T<<16|g<<8|255)>>>0}function N(O,A,I){let w=O>>24&255,Z=O>>16&255,k=O>>8&255,x=A>>24&255,T=A>>16&255,g=A>>8&255,Q1=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));for(;Q1<I&&(x<255||T<255||g<255);)x=Math.min(255,x+Math.ceil(0.1*(255-x))),T=Math.min(255,T+Math.ceil(0.1*(255-T))),g=Math.min(255,g+Math.ceil(0.1*(255-g))),Q1=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));return(x<<24|T<<16|g<<8|255)>>>0}L.blend=function(O,A){if(q=(255&A)/255,q===1)return A;let I=A>>24&255,w=A>>16&255,Z=A>>8&255,k=O>>24&255,x=O>>16&255,T=O>>8&255;return M=k+Math.round((I-k)*q),G=x+Math.round((w-x)*q),K=T+Math.round((Z-T)*q),W.toRgba(M,G,K)},L.ensureContrastRatio=function(O,A,I){let w=R.relativeLuminance(O>>8),Z=R.relativeLuminance(A>>8);if(V(w,Z)<I){if(Z<w){let T=F(O,A,I),g=V(w,R.relativeLuminance(T>>8));if(g<I){let Q1=N(O,A,I);return g>V(w,R.relativeLuminance(Q1>>8))?T:Q1}return T}let k=N(O,A,I),x=V(w,R.relativeLuminance(k>>8));if(x<I){let T=F(O,A,I);return x>V(w,R.relativeLuminance(T>>8))?k:T}return k}},L.reduceLuminance=F,L.increaseLuminance=N,L.toChannels=function(O){return[O>>24&255,O>>16&255,O>>8&255,255&O]}}(D||(H.rgba=D={})),H.toPaddedHex=j,H.contrastRatio=V},345:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.runAndSubscribe=H.forwardEvent=H.EventEmitter=void 0,H.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(M)=>(this._listeners.push(M),{dispose:()=>{if(!this._disposed){for(let G=0;G<this._listeners.length;G++)if(this._listeners[G]===M)return void this._listeners.splice(G,1)}}})),this._event}fire(M,G){let K=[];for(let q=0;q<this._listeners.length;q++)K.push(this._listeners[q]);for(let q=0;q<K.length;q++)K[q].call(void 0,M,G)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},H.forwardEvent=function(M,G){return M((K)=>G.fire(K))},H.runAndSubscribe=function(M,G){return G(void 0),M((K)=>G(K))}},859:(Y,H)=>{function M(G){for(let K of G)K.dispose();G.length=0}Object.defineProperty(H,"__esModule",{value:!0}),H.getDisposeArrayDisposable=H.disposeArray=H.toDisposable=H.MutableDisposable=H.Disposable=void 0,H.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let G of this._disposables)G.dispose();this._disposables.length=0}register(G){return this._disposables.push(G),G}unregister(G){let K=this._disposables.indexOf(G);K!==-1&&this._disposables.splice(K,1)}},H.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(G){this._isDisposed||G===this._value||(this._value?.dispose(),this._value=G)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},H.toDisposable=function(G){return{dispose:G}},H.disposeArray=M,H.getDisposeArrayDisposable=function(G){return{dispose:()=>M(G)}}},485:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.FourKeyMap=H.TwoKeyMap=void 0;class M{constructor(){this._data={}}set(G,K,q){this._data[G]||(this._data[G]={}),this._data[G][K]=q}get(G,K){return this._data[G]?this._data[G][K]:void 0}clear(){this._data={}}}H.TwoKeyMap=M,H.FourKeyMap=class{constructor(){this._data=new M}set(G,K,q,W,B){this._data.get(G,K)||this._data.set(G,K,new M),this._data.get(G,K).set(q,W,B)}get(G,K,q,W){return this._data.get(G,K)?.get(q,W)}clear(){this._data.clear()}}},726:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.createDecorator=H.getServiceDependencies=H.serviceRegistry=void 0;let M="di$target",G="di$dependencies";H.serviceRegistry=new Map,H.getServiceDependencies=function(K){return K[G]||[]},H.createDecorator=function(K){if(H.serviceRegistry.has(K))return H.serviceRegistry.get(K);let q=function(W,B,U){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(R,D,j){D[M]===D?D[G].push({id:R,index:j}):(D[G]=[{id:R,index:j}],D[M]=D)})(q,W,U)};return q.toString=()=>K,H.serviceRegistry.set(K,q),q}},97:(Y,H,M)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.IDecorationService=H.IUnicodeService=H.IOscLinkService=H.IOptionsService=H.ILogService=H.LogLevelEnum=H.IInstantiationService=H.ICharsetService=H.ICoreService=H.ICoreMouseService=H.IBufferService=void 0;let G=M(726);var K;H.IBufferService=G.createDecorator("BufferService"),H.ICoreMouseService=G.createDecorator("CoreMouseService"),H.ICoreService=G.createDecorator("CoreService"),H.ICharsetService=G.createDecorator("CharsetService"),H.IInstantiationService=G.createDecorator("InstantiationService"),function(q){q[q.TRACE=0]="TRACE",q[q.DEBUG=1]="DEBUG",q[q.INFO=2]="INFO",q[q.WARN=3]="WARN",q[q.ERROR=4]="ERROR",q[q.OFF=5]="OFF"}(K||(H.LogLevelEnum=K={})),H.ILogService=G.createDecorator("LogService"),H.IOptionsService=G.createDecorator("OptionsService"),H.IOscLinkService=G.createDecorator("OscLinkService"),H.IUnicodeService=G.createDecorator("UnicodeService"),H.IDecorationService=G.createDecorator("DecorationService")}},J={};function Q(Y){var H=J[Y];if(H!==void 0)return H.exports;var M=J[Y]={exports:{}};return $[Y].call(M.exports,M,M.exports,Q),M.exports}var X={};return(()=>{var Y=X;Object.defineProperty(Y,"__esModule",{value:!0}),Y.HTMLSerializeHandler=Y.SerializeAddon=void 0;let H=Q(997);function M(R,D,j){return Math.max(D,Math.min(R,j))}class G{constructor(R){this._buffer=R}serialize(R,D){let j=this._buffer.getNullCell(),V=this._buffer.getNullCell(),L=j,F=R.start.y,N=R.end.y,O=R.start.x,A=R.end.x;this._beforeSerialize(N-F,F,N);for(let I=F;I<=N;I++){let w=this._buffer.getLine(I);if(w){let Z=I===R.start.y?O:0,k=I===R.end.y?A:w.length;for(let x=Z;x<k;x++){let T=w.getCell(x,L===j?V:j);T?(this._nextCell(T,L,I,x),L=T):console.warn(`Can't get cell at row=${I}, col=${x}`)}}this._rowEnd(I,I===N)}return this._afterSerialize(),this._serializeString(D)}_nextCell(R,D,j,V){}_rowEnd(R,D){}_beforeSerialize(R,D,j){}_afterSerialize(){}_serializeString(R){return""}}function K(R,D){return R.getFgColorMode()===D.getFgColorMode()&&R.getFgColor()===D.getFgColor()}function q(R,D){return R.getBgColorMode()===D.getBgColorMode()&&R.getBgColor()===D.getBgColor()}function W(R,D){return R.isInverse()===D.isInverse()&&R.isBold()===D.isBold()&&R.isUnderline()===D.isUnderline()&&R.isOverline()===D.isOverline()&&R.isBlink()===D.isBlink()&&R.isInvisible()===D.isInvisible()&&R.isItalic()===D.isItalic()&&R.isDim()===D.isDim()&&R.isStrikethrough()===D.isStrikethrough()}class B extends G{constructor(R,D){super(R),this._terminal=D,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(R,D,j){this._allRows=new Array(R),this._lastContentCursorRow=D,this._lastCursorRow=D,this._firstRow=D}_rowEnd(R,D){this._nullCellCount>0&&!q(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let j="";if(!D){R-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let V=this._buffer.getLine(R),L=this._buffer.getLine(R+1);if(L.isWrapped){j="";let F=V.getCell(V.length-1,this._thisRowLastChar),N=V.getCell(V.length-2,this._thisRowLastSecondChar),O=L.getCell(0,this._nextRowFirstChar),A=O.getWidth()>1,I=!1;(O.getChars()&&A?this._nullCellCount<=1:this._nullCellCount<=0)&&((F.getChars()||F.getWidth()===0)&&q(F,O)&&(I=!0),A&&(N.getChars()||N.getWidth()===0)&&q(F,O)&&q(N,O)&&(I=!0)),I||(j="-".repeat(this._nullCellCount+1),j+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(j+="\x1B[A",j+=`\x1B[${V.length-this._nullCellCount}C`,j+=`\x1B[${this._nullCellCount}X`,j+=`\x1B[${V.length-this._nullCellCount}D`,j+="\x1B[B"),this._lastContentCursorRow=R+1,this._lastContentCursorCol=0,this._lastCursorRow=R+1,this._lastCursorCol=0)}else j=`\r
41
- `,this._lastCursorRow=R+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=j,this._currentRow="",this._nullCellCount=0}_diffStyle(R,D){let j=[],V=!K(R,D),L=!q(R,D),F=!W(R,D);if(V||L||F)if(R.isAttributeDefault())D.isAttributeDefault()||j.push(0);else{if(V){let N=R.getFgColor();R.isFgRGB()?j.push(38,2,N>>>16&255,N>>>8&255,255&N):R.isFgPalette()?N>=16?j.push(38,5,N):j.push(8&N?90+(7&N):30+(7&N)):j.push(39)}if(L){let N=R.getBgColor();R.isBgRGB()?j.push(48,2,N>>>16&255,N>>>8&255,255&N):R.isBgPalette()?N>=16?j.push(48,5,N):j.push(8&N?100+(7&N):40+(7&N)):j.push(49)}F&&(R.isInverse()!==D.isInverse()&&j.push(R.isInverse()?7:27),R.isBold()!==D.isBold()&&j.push(R.isBold()?1:22),R.isUnderline()!==D.isUnderline()&&j.push(R.isUnderline()?4:24),R.isOverline()!==D.isOverline()&&j.push(R.isOverline()?53:55),R.isBlink()!==D.isBlink()&&j.push(R.isBlink()?5:25),R.isInvisible()!==D.isInvisible()&&j.push(R.isInvisible()?8:28),R.isItalic()!==D.isItalic()&&j.push(R.isItalic()?3:23),R.isDim()!==D.isDim()&&j.push(R.isDim()?2:22),R.isStrikethrough()!==D.isStrikethrough()&&j.push(R.isStrikethrough()?9:29))}return j}_nextCell(R,D,j,V){if(R.getWidth()===0)return;let L=R.getChars()==="",F=this._diffStyle(R,this._cursorStyle);if(L?!q(this._cursorStyle,R):F.length>0){this._nullCellCount>0&&(q(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=j,this._lastContentCursorCol=this._lastCursorCol=V,this._currentRow+=`\x1B[${F.join(";")}m`;let N=this._buffer.getLine(j);N!==void 0&&(N.getCell(V,this._cursorStyle),this._cursorStyleRow=j,this._cursorStyleCol=V)}L?this._nullCellCount+=R.getWidth():(this._nullCellCount>0&&(q(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=R.getChars(),this._lastContentCursorRow=this._lastCursorRow=j,this._lastContentCursorCol=this._lastCursorCol=V+R.getWidth())}_serializeString(R){let D=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(D=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let j="";for(let N=0;N<D;N++)j+=this._allRows[N],N+1<D&&(j+=this._allRowSeparators[N]);if(!R){let N=this._buffer.baseY+this._buffer.cursorY,O=this._buffer.cursorX,A=(I)=>{I>0?j+=`\x1B[${I}C`:I<0&&(j+=`\x1B[${-I}D`)};(N!==this._lastCursorRow||O!==this._lastCursorCol)&&((V=N-this._lastCursorRow)>0?j+=`\x1B[${V}B`:V<0&&(j+=`\x1B[${-V}A`),A(O-this._lastCursorCol))}var V;let L=this._terminal._core._inputHandler._curAttrData,F=this._diffStyle(L,this._cursorStyle);return F.length>0&&(j+=`\x1B[${F.join(";")}m`),j}}Y.SerializeAddon=class{activate(R){this._terminal=R}_serializeBufferByScrollback(R,D,j){let V=D.length,L=j===void 0?V:M(j+R.rows,0,V);return this._serializeBufferByRange(R,D,{start:V-L,end:V-1},!1)}_serializeBufferByRange(R,D,j,V){return new B(D,R).serialize({start:{x:0,y:typeof j.start=="number"?j.start:j.start.line},end:{x:R.cols,y:typeof j.end=="number"?j.end:j.end.line}},V)}_serializeBufferAsHTML(R,D){let j=R.buffer.active,V=new U(j,R,D);if(!D.onlySelection){let F=j.length,N=D.scrollback,O=N===void 0?F:M(N+R.rows,0,F);return V.serialize({start:{x:0,y:F-O},end:{x:R.cols,y:F-1}})}let L=this._terminal?.getSelectionPosition();return L!==void 0?V.serialize({start:{x:L.start.x,y:L.start.y},end:{x:L.end.x,y:L.end.y}}):""}_serializeModes(R){let D="",j=R.modes;if(j.applicationCursorKeysMode&&(D+="\x1B[?1h"),j.applicationKeypadMode&&(D+="\x1B[?66h"),j.bracketedPasteMode&&(D+="\x1B[?2004h"),j.insertMode&&(D+="\x1B[4h"),j.originMode&&(D+="\x1B[?6h"),j.reverseWraparoundMode&&(D+="\x1B[?45h"),j.sendFocusMode&&(D+="\x1B[?1004h"),j.wraparoundMode===!1&&(D+="\x1B[?7l"),j.mouseTrackingMode!=="none")switch(j.mouseTrackingMode){case"x10":D+="\x1B[?9h";break;case"vt200":D+="\x1B[?1000h";break;case"drag":D+="\x1B[?1002h";break;case"any":D+="\x1B[?1003h"}return D}serialize(R){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let D=R?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,R.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,R?.scrollback);return R?.excludeAltBuffer||this._terminal.buffer.active.type!=="alternate"||(D+=`\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0)}`),R?.excludeModes||(D+=this._serializeModes(this._terminal)),D}serializeAsHTML(R){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,R||{})}dispose(){}};class U extends G{constructor(R,D,j){super(R),this._terminal=D,this._options=j,this._currentRow="",this._htmlContent="",D._core._themeService?this._ansiColors=D._core._themeService.colors.ansi:this._ansiColors=H.DEFAULT_ANSI_COLORS}_padStart(R,D,j){return D>>=0,j=j??" ",R.length>D?R:((D-=R.length)>j.length&&(j+=j.repeat(D/j.length)),j.slice(0,D)+R)}_beforeSerialize(R,D,j){this._htmlContent+="<html><body><!--StartFragment--><pre>";let V="#000000",L="#ffffff";this._options.includeGlobalBackground&&(V=this._terminal.options.theme?.foreground??"#ffffff",L=this._terminal.options.theme?.background??"#000000");let F=[];F.push("color: "+V+";"),F.push("background-color: "+L+";"),F.push("font-family: "+this._terminal.options.fontFamily+";"),F.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+F.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(R,D){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(R,D){let j=D?R.getFgColor():R.getBgColor();return(D?R.isFgRGB():R.isBgRGB())?"#"+[j>>16&255,j>>8&255,255&j].map((V)=>this._padStart(V.toString(16),2,"0")).join(""):(D?R.isFgPalette():R.isBgPalette())?this._ansiColors[j].css:void 0}_diffStyle(R,D){let j=[],V=!K(R,D),L=!q(R,D),F=!W(R,D);if(V||L||F){let N=this._getHexColor(R,!0);N&&j.push("color: "+N+";");let O=this._getHexColor(R,!1);return O&&j.push("background-color: "+O+";"),R.isInverse()&&j.push("color: #000000; background-color: #BFBFBF;"),R.isBold()&&j.push("font-weight: bold;"),R.isUnderline()&&R.isOverline()?j.push("text-decoration: overline underline;"):R.isUnderline()?j.push("text-decoration: underline;"):R.isOverline()&&j.push("text-decoration: overline;"),R.isBlink()&&j.push("text-decoration: blink;"),R.isInvisible()&&j.push("visibility: hidden;"),R.isItalic()&&j.push("font-style: italic;"),R.isDim()&&j.push("opacity: 0.5;"),R.isStrikethrough()&&j.push("text-decoration: line-through;"),j}}_nextCell(R,D,j,V){if(R.getWidth()===0)return;let L=R.getChars()==="",F=this._diffStyle(R,D);F&&(this._currentRow+=F.length===0?"</span><span>":"</span><span style='"+F.join(" ")+"'>"),this._currentRow+=L?" ":R.getChars()}_serializeString(){return this._htmlContent}}Y.HTMLSerializeHandler=U})(),X})())});var UQ=n((NQ)=>{(()=>{var $={349:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.CircularList=void 0;let q=K(460),W=K(844);class B extends W.Disposable{constructor(U){super(),this._maxLength=U,this.onDeleteEmitter=this.register(new q.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new q.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new q.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(U){if(this._maxLength===U)return;let R=new Array(U);for(let D=0;D<Math.min(U,this.length);D++)R[D]=this._array[this._getCyclicIndex(D)];this._array=R,this._maxLength=U,this._startIndex=0}get length(){return this._length}set length(U){if(U>this._length)for(let R=this._length;R<U;R++)this._array[R]=void 0;this._length=U}get(U){return this._array[this._getCyclicIndex(U)]}set(U,R){this._array[this._getCyclicIndex(U)]=R}push(U){this._array[this._getCyclicIndex(this._length)]=U,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(U,R,...D){if(R){for(let j=U;j<this._length-R;j++)this._array[this._getCyclicIndex(j)]=this._array[this._getCyclicIndex(j+R)];this._length-=R,this.onDeleteEmitter.fire({index:U,amount:R})}for(let j=this._length-1;j>=U;j--)this._array[this._getCyclicIndex(j+D.length)]=this._array[this._getCyclicIndex(j)];for(let j=0;j<D.length;j++)this._array[this._getCyclicIndex(U+j)]=D[j];if(D.length&&this.onInsertEmitter.fire({index:U,amount:D.length}),this._length+D.length>this._maxLength){let j=this._length+D.length-this._maxLength;this._startIndex+=j,this._length=this._maxLength,this.onTrimEmitter.fire(j)}else this._length+=D.length}trimStart(U){U>this._length&&(U=this._length),this._startIndex+=U,this._length-=U,this.onTrimEmitter.fire(U)}shiftElements(U,R,D){if(!(R<=0)){if(U<0||U>=this._length)throw new Error("start argument out of range");if(U+D<0)throw new Error("Cannot shift elements in list beyond index 0");if(D>0){for(let V=R-1;V>=0;V--)this.set(U+V+D,this.get(U+V));let j=U+R+D-this._length;if(j>0)for(this._length+=j;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let j=0;j<R;j++)this.set(U+j+D,this.get(U+j))}}_getCyclicIndex(U){return(this._startIndex+U)%this._maxLength}}G.CircularList=B},439:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.clone=void 0,G.clone=function K(q,W=5){if(typeof q!="object")return q;let B=Array.isArray(q)?[]:{};for(let U in q)B[U]=W<=1?q[U]:q[U]&&K(q[U],W-1);return B}},969:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.CoreTerminal=void 0;let q=K(844),W=K(585),B=K(348),U=K(866),R=K(744),D=K(302),j=K(83),V=K(460),L=K(753),F=K(480),N=K(994),O=K(282),A=K(435),I=K(981),w=K(660),Z=!1;class k extends q.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new V.EventEmitter),this._onScroll.event((x)=>{this._onScrollApi?.fire(x.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(x){for(let T in x)this.optionsService.options[T]=x[T]}constructor(x){super(),this._windowsWrappingHeuristics=this.register(new q.MutableDisposable),this._onBinary=this.register(new V.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new V.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new V.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new V.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new V.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new V.EventEmitter),this._instantiationService=new B.InstantiationService,this.optionsService=this.register(new D.OptionsService(x)),this._instantiationService.setService(W.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(R.BufferService)),this._instantiationService.setService(W.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(U.LogService)),this._instantiationService.setService(W.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(j.CoreService)),this._instantiationService.setService(W.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(L.CoreMouseService)),this._instantiationService.setService(W.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(F.UnicodeService)),this._instantiationService.setService(W.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(N.CharsetService),this._instantiationService.setService(W.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(W.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register(V.forwardEvent(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register(V.forwardEvent(this._bufferService.onResize,this._onResize)),this.register(V.forwardEvent(this.coreService.onData,this._onData)),this.register(V.forwardEvent(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll((T)=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll((T)=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new I.WriteBuffer((T,g)=>this._inputHandler.parse(T,g))),this.register(V.forwardEvent(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,T){this._writeBuffer.write(x,T)}writeSync(x,T){this._logService.logLevel<=W.LogLevelEnum.WARN&&!Z&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Z=!0),this._writeBuffer.writeSync(x,T)}input(x,T=!0){this.coreService.triggerDataEvent(x,T)}resize(x,T){isNaN(x)||isNaN(T)||(x=Math.max(x,R.MINIMUM_COLS),T=Math.max(T,R.MINIMUM_ROWS),this._bufferService.resize(x,T))}scroll(x,T=!1){this._bufferService.scroll(x,T)}scrollLines(x,T,g){this._bufferService.scrollLines(x,T,g)}scrollPages(x){this.scrollLines(x*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(x){let T=x-this._bufferService.buffer.ydisp;T!==0&&this.scrollLines(T)}registerEscHandler(x,T){return this._inputHandler.registerEscHandler(x,T)}registerDcsHandler(x,T){return this._inputHandler.registerDcsHandler(x,T)}registerCsiHandler(x,T){return this._inputHandler.registerCsiHandler(x,T)}registerOscHandler(x,T){return this._inputHandler.registerOscHandler(x,T)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1,T=this.optionsService.rawOptions.windowsPty;T&&T.buildNumber!==void 0&&T.buildNumber!==void 0?x=T.backend==="conpty"&&T.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let x=[];x.push(this.onLineFeed(O.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},()=>(O.updateWindowsModeWrappedState(this._bufferService),!1))),this._windowsWrappingHeuristics.value=q.toDisposable(()=>{for(let T of x)T.dispose()})}}}G.CoreTerminal=k},460:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.runAndSubscribe=G.forwardEvent=G.EventEmitter=void 0,G.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(K)=>{return this._listeners.push(K),{dispose:()=>{if(!this._disposed){for(let W=0;W<this._listeners.length;W++)if(this._listeners[W]===K)return void this._listeners.splice(W,1)}}}}),this._event}fire(K,q){let W=[];for(let B=0;B<this._listeners.length;B++)W.push(this._listeners[B]);for(let B=0;B<W.length;B++)W[B].call(void 0,K,q)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},G.forwardEvent=function(K,q){return K((W)=>q.fire(W))},G.runAndSubscribe=function(K,q){return q(void 0),K((W)=>q(W))}},435:function(M,G,K){var q=this&&this.__decorate||function(E,S,C,_){var b,c=arguments.length,a=c<3?S:_===null?_=Object.getOwnPropertyDescriptor(S,C):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(E,S,C,_);else for(var e=E.length-1;e>=0;e--)(b=E[e])&&(a=(c<3?b(a):c>3?b(S,C,a):b(S,C))||a);return c>3&&a&&Object.defineProperty(S,C,a),a},W=this&&this.__param||function(E,S){return function(C,_){S(C,_,E)}};Object.defineProperty(G,"__esModule",{value:!0}),G.InputHandler=G.WindowsOptionsReportType=void 0;let B=K(584),U=K(116),R=K(15),D=K(844),j=K(482),V=K(437),L=K(460),F=K(643),N=K(511),O=K(734),A=K(585),I=K(480),w=K(242),Z=K(351),k=K(941),x={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function g(E,S){if(E>24)return S.setWinLines||!1;switch(E){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var Q1;(function(E){E[E.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",E[E.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(Q1||(G.WindowsOptionsReportType=Q1={}));let k1=0;class N1 extends D.Disposable{getAttrData(){return this._curAttrData}constructor(E,S,C,_,b,c,a,e,M1=new R.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=S,this._coreService=C,this._logService=_,this._optionsService=b,this._oscLinkService=c,this._coreMouseService=a,this._unicodeService=e,this._parser=M1,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new j.StringToUtf32,this._utf8Decoder=new j.Utf8ToUtf32,this._workCell=new N.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=V.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=V.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new L.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new L.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new L.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new L.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new L.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new L.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new L.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new L.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new L.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new L.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new L.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new L.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new L.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new t(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P)=>this._activeBuffer=P.activeBuffer)),this._parser.setCsiHandlerFallback((P,$1)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:$1.toArray()})}),this._parser.setEscHandlerFallback((P)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})}),this._parser.setExecuteHandlerFallback((P)=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})}),this._parser.setOscHandlerFallback((P,$1,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:$1,data:u})}),this._parser.setDcsHandlerFallback((P,$1,u)=>{$1==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:$1,payload:u})}),this._parser.setPrintHandler((P,$1,u)=>this.print(P,$1,u)),this._parser.registerCsiHandler({final:"@"},(P)=>this.insertChars(P)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P)=>this.scrollLeft(P)),this._parser.registerCsiHandler({final:"A"},(P)=>this.cursorUp(P)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P)=>this.scrollRight(P)),this._parser.registerCsiHandler({final:"B"},(P)=>this.cursorDown(P)),this._parser.registerCsiHandler({final:"C"},(P)=>this.cursorForward(P)),this._parser.registerCsiHandler({final:"D"},(P)=>this.cursorBackward(P)),this._parser.registerCsiHandler({final:"E"},(P)=>this.cursorNextLine(P)),this._parser.registerCsiHandler({final:"F"},(P)=>this.cursorPrecedingLine(P)),this._parser.registerCsiHandler({final:"G"},(P)=>this.cursorCharAbsolute(P)),this._parser.registerCsiHandler({final:"H"},(P)=>this.cursorPosition(P)),this._parser.registerCsiHandler({final:"I"},(P)=>this.cursorForwardTab(P)),this._parser.registerCsiHandler({final:"J"},(P)=>this.eraseInDisplay(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P)=>this.eraseInDisplay(P,!0)),this._parser.registerCsiHandler({final:"K"},(P)=>this.eraseInLine(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P)=>this.eraseInLine(P,!0)),this._parser.registerCsiHandler({final:"L"},(P)=>this.insertLines(P)),this._parser.registerCsiHandler({final:"M"},(P)=>this.deleteLines(P)),this._parser.registerCsiHandler({final:"P"},(P)=>this.deleteChars(P)),this._parser.registerCsiHandler({final:"S"},(P)=>this.scrollUp(P)),this._parser.registerCsiHandler({final:"T"},(P)=>this.scrollDown(P)),this._parser.registerCsiHandler({final:"X"},(P)=>this.eraseChars(P)),this._parser.registerCsiHandler({final:"Z"},(P)=>this.cursorBackwardTab(P)),this._parser.registerCsiHandler({final:"`"},(P)=>this.charPosAbsolute(P)),this._parser.registerCsiHandler({final:"a"},(P)=>this.hPositionRelative(P)),this._parser.registerCsiHandler({final:"b"},(P)=>this.repeatPrecedingCharacter(P)),this._parser.registerCsiHandler({final:"c"},(P)=>this.sendDeviceAttributesPrimary(P)),this._parser.registerCsiHandler({prefix:">",final:"c"},(P)=>this.sendDeviceAttributesSecondary(P)),this._parser.registerCsiHandler({final:"d"},(P)=>this.linePosAbsolute(P)),this._parser.registerCsiHandler({final:"e"},(P)=>this.vPositionRelative(P)),this._parser.registerCsiHandler({final:"f"},(P)=>this.hVPosition(P)),this._parser.registerCsiHandler({final:"g"},(P)=>this.tabClear(P)),this._parser.registerCsiHandler({final:"h"},(P)=>this.setMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P)=>this.setModePrivate(P)),this._parser.registerCsiHandler({final:"l"},(P)=>this.resetMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P)=>this.resetModePrivate(P)),this._parser.registerCsiHandler({final:"m"},(P)=>this.charAttributes(P)),this._parser.registerCsiHandler({final:"n"},(P)=>this.deviceStatus(P)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P)=>this.deviceStatusPrivate(P)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P)=>this.softReset(P)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P)=>this.setCursorStyle(P)),this._parser.registerCsiHandler({final:"r"},(P)=>this.setScrollRegion(P)),this._parser.registerCsiHandler({final:"s"},(P)=>this.saveCursor(P)),this._parser.registerCsiHandler({final:"t"},(P)=>this.windowOptions(P)),this._parser.registerCsiHandler({final:"u"},(P)=>this.restoreCursor(P)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P)=>this.insertColumns(P)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P)=>this.deleteColumns(P)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P)=>this.selectProtected(P)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P)=>this.requestMode(P,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P)=>this.requestMode(P,!1)),this._parser.setExecuteHandler(B.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(B.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(B.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(B.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(B.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(B.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(B.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(B.C1.IND,()=>this.index()),this._parser.setExecuteHandler(B.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(B.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new w.OscHandler((P)=>(this.setTitle(P),this.setIconName(P),!0))),this._parser.registerOscHandler(1,new w.OscHandler((P)=>this.setIconName(P))),this._parser.registerOscHandler(2,new w.OscHandler((P)=>this.setTitle(P))),this._parser.registerOscHandler(4,new w.OscHandler((P)=>this.setOrReportIndexedColor(P))),this._parser.registerOscHandler(8,new w.OscHandler((P)=>this.setHyperlink(P))),this._parser.registerOscHandler(10,new w.OscHandler((P)=>this.setOrReportFgColor(P))),this._parser.registerOscHandler(11,new w.OscHandler((P)=>this.setOrReportBgColor(P))),this._parser.registerOscHandler(12,new w.OscHandler((P)=>this.setOrReportCursorColor(P))),this._parser.registerOscHandler(104,new w.OscHandler((P)=>this.restoreIndexedColor(P))),this._parser.registerOscHandler(110,new w.OscHandler((P)=>this.restoreFgColor(P))),this._parser.registerOscHandler(111,new w.OscHandler((P)=>this.restoreBgColor(P))),this._parser.registerOscHandler(112,new w.OscHandler((P)=>this.restoreCursorColor(P))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let P in U.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},()=>this.selectCharset("("+P)),this._parser.registerEscHandler({intermediates:")",final:P},()=>this.selectCharset(")"+P)),this._parser.registerEscHandler({intermediates:"*",final:P},()=>this.selectCharset("*"+P)),this._parser.registerEscHandler({intermediates:"+",final:P},()=>this.selectCharset("+"+P)),this._parser.registerEscHandler({intermediates:"-",final:P},()=>this.selectCharset("-"+P)),this._parser.registerEscHandler({intermediates:".",final:P},()=>this.selectCharset("."+P)),this._parser.registerEscHandler({intermediates:"/",final:P},()=>this.selectCharset("/"+P));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((P)=>(this._logService.error("Parsing error: ",P),P)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Z.DcsHandler((P,$1)=>this.requestStatusString(P,$1)))}_preserveStack(E,S,C,_){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=S,this._parseStack.decodedLength=C,this._parseStack.position=_}_logSlowResolvingAsync(E){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([E,new Promise((S,C)=>setTimeout(()=>C("#SLOW_TIMEOUT"),5000))]).catch((S)=>{if(S!=="#SLOW_TIMEOUT")throw S;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,S){let C,_=this._activeBuffer.x,b=this._activeBuffer.y,c=0,a=this._parseStack.paused;if(a){if(C=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,S))return this._logSlowResolvingAsync(C),C;_=this._parseStack.cursorStartX,b=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>T&&(c=this._parseStack.position+T)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,(P)=>String.fromCharCode(P)).join("")}"`),typeof E=="string"?E.split("").map((P)=>P.charCodeAt(0)):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(E.length,T))),a||this._dirtyRowTracker.clearRange(),E.length>T)for(let P=c;P<E.length;P+=T){let $1=P+T<E.length?P+T:E.length,u=typeof E=="string"?this._stringDecoder.decode(E.substring(P,$1),this._parseBuffer):this._utf8Decoder.decode(E.subarray(P,$1),this._parseBuffer);if(C=this._parser.parse(this._parseBuffer,u))return this._preserveStack(_,b,u,P),this._logSlowResolvingAsync(C),C}else if(!a){let P=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(C=this._parser.parse(this._parseBuffer,P))return this._preserveStack(_,b,P,0),this._logSlowResolvingAsync(C),C}this._activeBuffer.x===_&&this._activeBuffer.y===b||this._onCursorMove.fire();let e=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M1=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M1<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M1,this._bufferService.rows-1),Math.min(e,this._bufferService.rows-1))}print(E,S,C){let _,b,c=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,e=this._bufferService.cols,M1=this._coreService.decPrivateModes.wraparound,P=this._coreService.modes.insertMode,$1=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&C-S>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,$1);let s=this._parser.precedingJoinState;for(let p1=S;p1<C;++p1){if(_=E[p1],_<127&&c){let U$=c[String.fromCharCode(_)];U$&&(_=U$.charCodeAt(0))}let d1=this._unicodeService.charProperties(_,s);b=I.UnicodeService.extractWidth(d1);let B$=I.UnicodeService.extractShouldJoin(d1),N$=B$?I.UnicodeService.extractWidth(s):0;if(s=d1,a&&this._onA11yChar.fire(j.stringFromCodePoint(_)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+b-N$>e){if(M1){let U$=u,W0=this._activeBuffer.x-N$;for(this._activeBuffer.x=N$,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),N$>0&&u instanceof V.BufferLine&&u.copyCellsFrom(U$,W0,0,N$,!1);W0<e;)U$.setCellFromCodepoint(W0++,0,1,$1)}else if(this._activeBuffer.x=e-1,b===2)continue}if(B$&&this._activeBuffer.x){let U$=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-U$,_,b);for(let W0=b-N$;--W0>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,$1)}else if(P&&(u.insertCells(this._activeBuffer.x,b-N$,this._activeBuffer.getNullCell($1)),u.getWidth(e-1)===2&&u.setCellFromCodepoint(e-1,F.NULL_CELL_CODE,F.NULL_CELL_WIDTH,$1)),u.setCellFromCodepoint(this._activeBuffer.x++,_,b,$1),b>0)for(;--b;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,$1)}this._parser.precedingJoinState=s,this._activeBuffer.x<e&&C-S>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,$1),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,S){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,S):this._parser.registerCsiHandler(E,(C)=>!g(C.params[0],this._optionsService.rawOptions.windowOptions)||S(C))}registerDcsHandler(E,S){return this._parser.registerDcsHandler(E,new Z.DcsHandler(S))}registerEscHandler(E,S){return this._parser.registerEscHandler(E,S)}registerOscHandler(E,S){return this._parser.registerOscHandler(E,new w.OscHandler(S))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);E.hasWidth(this._activeBuffer.x)&&!E.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(E,S){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+S):(this._activeBuffer.x=E,this._activeBuffer.y=S),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,S){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+S)}cursorUp(E){let S=this._activeBuffer.y-this._activeBuffer.scrollTop;return S>=0?this._moveCursor(0,-Math.min(S,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){let S=this._activeBuffer.scrollBottom-this._activeBuffer.y;return S>=0?this._moveCursor(0,Math.min(S,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){let S=E.params[0];return S===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:S===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=E.params[0]||1;for(;S--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=E.params[0]||1;for(;S--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){let S=E.params[0];return S===1&&(this._curAttrData.bg|=536870912),S!==2&&S!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,S,C,_=!1,b=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);c.replaceCells(S,C,this._activeBuffer.getNullCell(this._eraseAttrData()),b),_&&(c.isWrapped=!1)}_resetBufferLine(E,S=!1){let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);C&&(C.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),S),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),C.isWrapped=!1)}eraseInDisplay(E,S=!1){let C;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(C=this._activeBuffer.y,this._dirtyRowTracker.markDirty(C),this._eraseInBufferLine(C++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,S);C<this._bufferService.rows;C++)this._resetBufferLine(C,S);this._dirtyRowTracker.markDirty(C);break;case 1:for(C=this._activeBuffer.y,this._dirtyRowTracker.markDirty(C),this._eraseInBufferLine(C,0,this._activeBuffer.x+1,!0,S),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(C+1).isWrapped=!1);C--;)this._resetBufferLine(C,S);this._dirtyRowTracker.markDirty(0);break;case 2:for(C=this._bufferService.rows,this._dirtyRowTracker.markDirty(C-1);C--;)this._resetBufferLine(C,S);this._dirtyRowTracker.markDirty(0);break;case 3:let _=this._activeBuffer.lines.length-this._bufferService.rows;_>0&&(this._activeBuffer.lines.trimStart(_),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-_,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-_,0),this._onScroll.fire(0))}return!0}eraseInLine(E,S=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,S);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,S);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,S)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let S=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=this._activeBuffer.ybase+this._activeBuffer.y,_=this._bufferService.rows-1-this._activeBuffer.scrollBottom,b=this._bufferService.rows-1+this._activeBuffer.ybase-_+1;for(;S--;)this._activeBuffer.lines.splice(b-1,1),this._activeBuffer.lines.splice(C,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(E){this._restrictCursor();let S=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=this._activeBuffer.ybase+this._activeBuffer.y,_;for(_=this._bufferService.rows-1-this._activeBuffer.scrollBottom,_=this._bufferService.rows-1+this._activeBuffer.ybase-_;S--;)this._activeBuffer.lines.splice(C,1),this._activeBuffer.lines.splice(_,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return S&&(S.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return S&&(S.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let S=E.params[0]||1;for(;S--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(E){let S=E.params[0]||1;for(;S--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(V.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.deleteCells(0,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.insertCells(0,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.insertCells(this._activeBuffer.x,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.deleteCells(this._activeBuffer.x,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return S&&(S.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){let S=this._parser.precedingJoinState;if(!S)return!0;let C=E.params[0]||1,_=I.UnicodeService.extractWidth(S),b=this._activeBuffer.x-_,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(b),a=new Uint32Array(c.length*C),e=0;for(let P=0;P<c.length;){let $1=c.codePointAt(P)||0;a[e++]=$1,P+=$1>65535?2:1}let M1=e;for(let P=1;P<C;++P)a.copyWithin(M1,0,e),M1+=e;return this.print(a,0,M1),!0}sendDeviceAttributesPrimary(E){return E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(B.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(B.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(E){return E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(B.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(B.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(B.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,U.DEFAULT_CHARSET),this._charsetService.setgCharset(1,U.DEFAULT_CHARSET),this._charsetService.setgCharset(2,U.DEFAULT_CHARSET),this._charsetService.setgCharset(3,U.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1000:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1000:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),E.params[S]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(E,S){let C=this._coreService.decPrivateModes,{activeProtocol:_,activeEncoding:b}=this._coreMouseService,c=this._coreService,{buffers:a,cols:e}=this._bufferService,{active:M1,alt:P}=a,$1=this._optionsService.rawOptions,u=(B$)=>B$?1:2,s=E.params[0];return p1=s,d1=S?s===2?4:s===4?u(c.modes.insertMode):s===12?3:s===20?u($1.convertEol):0:s===1?u(C.applicationCursorKeys):s===3?$1.windowOptions.setWinLines?e===80?2:e===132?1:0:0:s===6?u(C.origin):s===7?u(C.wraparound):s===8?3:s===9?u(_==="X10"):s===12?u($1.cursorBlink):s===25?u(!c.isCursorHidden):s===45?u(C.reverseWraparound):s===66?u(C.applicationKeypad):s===67?4:s===1000?u(_==="VT200"):s===1002?u(_==="DRAG"):s===1003?u(_==="ANY"):s===1004?u(C.sendFocus):s===1005?4:s===1006?u(b==="SGR"):s===1015?4:s===1016?u(b==="SGR_PIXELS"):s===1048?1:s===47||s===1047||s===1049?u(M1===P):s===2004?u(C.bracketedPasteMode):0,c.triggerDataEvent(`${B.C0.ESC}[${S?"":"?"}${p1};${d1}$y`),!0;var p1,d1}_updateAttrColor(E,S,C,_,b){return S===2?(E|=50331648,E&=-16777216,E|=O.AttributeData.fromColorRGB([C,_,b])):S===5&&(E&=-50331904,E|=33554432|255&C),E}_extractColor(E,S,C){let _=[0,0,-1,0,0,0],b=0,c=0;do{if(_[c+b]=E.params[S+c],E.hasSubParams(S+c)){let a=E.getSubParams(S+c),e=0;do _[1]===5&&(b=1),_[c+e+1+b]=a[e];while(++e<a.length&&e+c+1+b<_.length);break}if(_[1]===5&&c+b>=2||_[1]===2&&c+b>=5)break;_[1]&&(b=1)}while(++c+S<E.length&&c+b<_.length);for(let a=2;a<_.length;++a)_[a]===-1&&(_[a]=0);switch(_[0]){case 38:C.fg=this._updateAttrColor(C.fg,_[1],_[3],_[4],_[5]);break;case 48:C.bg=this._updateAttrColor(C.bg,_[1],_[3],_[4],_[5]);break;case 58:C.extended=C.extended.clone(),C.extended.underlineColor=this._updateAttrColor(C.extended.underlineColor,_[1],_[3],_[4],_[5])}return c}_processUnderline(E,S){S.extended=S.extended.clone(),(!~E||E>5)&&(E=1),S.extended.underlineStyle=E,S.fg|=268435456,E===0&&(S.fg&=-268435457),S.updateExtended()}_processSGR0(E){E.fg=V.DEFAULT_ATTR_DATA.fg,E.bg=V.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;let S=E.length,C,_=this._curAttrData;for(let b=0;b<S;b++)C=E.params[b],C>=30&&C<=37?(_.fg&=-50331904,_.fg|=16777216|C-30):C>=40&&C<=47?(_.bg&=-50331904,_.bg|=16777216|C-40):C>=90&&C<=97?(_.fg&=-50331904,_.fg|=16777224|C-90):C>=100&&C<=107?(_.bg&=-50331904,_.bg|=16777224|C-100):C===0?this._processSGR0(_):C===1?_.fg|=134217728:C===3?_.bg|=67108864:C===4?(_.fg|=268435456,this._processUnderline(E.hasSubParams(b)?E.getSubParams(b)[0]:1,_)):C===5?_.fg|=536870912:C===7?_.fg|=67108864:C===8?_.fg|=1073741824:C===9?_.fg|=2147483648:C===2?_.bg|=134217728:C===21?this._processUnderline(2,_):C===22?(_.fg&=-134217729,_.bg&=-134217729):C===23?_.bg&=-67108865:C===24?(_.fg&=-268435457,this._processUnderline(0,_)):C===25?_.fg&=-536870913:C===27?_.fg&=-67108865:C===28?_.fg&=-1073741825:C===29?_.fg&=2147483647:C===39?(_.fg&=-67108864,_.fg|=16777215&V.DEFAULT_ATTR_DATA.fg):C===49?(_.bg&=-67108864,_.bg|=16777215&V.DEFAULT_ATTR_DATA.bg):C===38||C===48||C===58?b+=this._extractColor(E,b,_):C===53?_.bg|=1073741824:C===55?_.bg&=-1073741825:C===59?(_.extended=_.extended.clone(),_.extended.underlineColor=-1,_.updateExtended()):C===100?(_.fg&=-67108864,_.fg|=16777215&V.DEFAULT_ATTR_DATA.fg,_.bg&=-67108864,_.bg|=16777215&V.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",C);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${B.C0.ESC}[0n`);break;case 6:let S=this._activeBuffer.y+1,C=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.C0.ESC}[${S};${C}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){let S=this._activeBuffer.y+1,C=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.C0.ESC}[?${S};${C}R`)}return!0}softReset(E){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=V.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(E){let S=E.params[0]||1;switch(S){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let C=S%2==1;return this._optionsService.options.cursorBlink=C,!0}setScrollRegion(E){let S=E.params[0]||1,C;return(E.length<2||(C=E.params[1])>this._bufferService.rows||C===0)&&(C=this._bufferService.rows),C>S&&(this._activeBuffer.scrollTop=S-1,this._activeBuffer.scrollBottom=C-1,this._setCursor(0,0)),!0}windowOptions(E){if(!g(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;let S=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:S!==2&&this._onRequestWindowsOptionsReport.fire(Q1.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(Q1.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${B.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:S!==0&&S!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),S!==0&&S!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:S!==0&&S!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),S!==0&&S!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(E){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){let S=[],C=E.split(";");for(;C.length>1;){let _=C.shift(),b=C.shift();if(/^\d+$/.exec(_)){let c=parseInt(_);if(V1(c))if(b==="?")S.push({type:0,index:c});else{let a=k.parseColor(b);a&&S.push({type:1,index:c,color:a})}}}return S.length&&this._onColor.fire(S),!0}setHyperlink(E){let S=E.split(";");return!(S.length<2)&&(S[1]?this._createHyperlink(S[0],S[1]):!S[0]&&this._finishHyperlink())}_createHyperlink(E,S){this._getCurrentLinkId()&&this._finishHyperlink();let C=E.split(":"),_,b=C.findIndex((c)=>c.startsWith("id="));return b!==-1&&(_=C[b].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:_,uri:S}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,S){let C=E.split(";");for(let _=0;_<C.length&&!(S>=this._specialColors.length);++_,++S)if(C[_]==="?")this._onColor.fire([{type:0,index:this._specialColors[S]}]);else{let b=k.parseColor(C[_]);b&&this._onColor.fire([{type:1,index:this._specialColors[S],color:b}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;let S=[],C=E.split(";");for(let _=0;_<C.length;++_)if(/^\d+$/.exec(C[_])){let b=parseInt(C[_]);V1(b)&&S.push({type:2,index:b})}return S.length&&this._onColor.fire(S),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,U.DEFAULT_CHARSET),!0}selectCharset(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(x[E[0]],U.CHARSETS[E[1]]||U.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=V.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=V.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){let E=new N.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let S=0;S<this._bufferService.rows;++S){let C=this._activeBuffer.ybase+this._activeBuffer.y+S,_=this._activeBuffer.lines.get(C);_&&(_.fill(E),_.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,S){let C=this._bufferService.buffer,_=this._optionsService.rawOptions;return((b)=>(this._coreService.triggerDataEvent(`${B.C0.ESC}${b}${B.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${C.scrollTop+1};${C.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[_.cursorStyle]-(_.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,S){this._dirtyRowTracker.markRangeDirty(E,S)}}G.InputHandler=N1;let t=class{constructor(E){this._bufferService=E,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(E){E<this.start?this.start=E:E>this.end&&(this.end=E)}markRangeDirty(E,S){E>S&&(k1=E,E=S,S=k1),E<this.start&&(this.start=E),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function V1(E){return 0<=E&&E<256}t=q([W(0,A.IBufferService)],t)},844:(M,G)=>{function K(q){for(let W of q)W.dispose();q.length=0}Object.defineProperty(G,"__esModule",{value:!0}),G.getDisposeArrayDisposable=G.disposeArray=G.toDisposable=G.MutableDisposable=G.Disposable=void 0,G.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let q of this._disposables)q.dispose();this._disposables.length=0}register(q){return this._disposables.push(q),q}unregister(q){let W=this._disposables.indexOf(q);W!==-1&&this._disposables.splice(W,1)}},G.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(q){this._isDisposed||q===this._value||(this._value?.dispose(),this._value=q)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},G.toDisposable=function(q){return{dispose:q}},G.disposeArray=K,G.getDisposeArrayDisposable=function(q){return{dispose:()=>K(q)}}},114:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.isChromeOS=G.isLinux=G.isWindows=G.isIphone=G.isIpad=G.isMac=G.getSafariVersion=G.isSafari=G.isLegacyEdge=G.isFirefox=G.isNode=void 0,G.isNode=typeof process!="undefined"&&"title"in process;let K=G.isNode?"node":navigator.userAgent,q=G.isNode?"node":navigator.platform;G.isFirefox=K.includes("Firefox"),G.isLegacyEdge=K.includes("Edge"),G.isSafari=/^((?!chrome|android).)*safari/i.test(K),G.getSafariVersion=function(){if(!G.isSafari)return 0;let W=K.match(/Version\/(\d+)/);return W===null||W.length<2?0:parseInt(W[1])},G.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(q),G.isIpad=q==="iPad",G.isIphone=q==="iPhone",G.isWindows=["Windows","Win16","Win32","WinCE"].includes(q),G.isLinux=q.indexOf("Linux")>=0,G.isChromeOS=/\bCrOS\b/.test(K)},226:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.DebouncedIdleTask=G.IdleTaskQueue=G.PriorityTaskQueue=void 0;let q=K(114);class W{constructor(){this._tasks=[],this._i=0}enqueue(U){this._tasks.push(U),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(U){this._idleCallback=void 0;let R=0,D=0,j=U.timeRemaining(),V=0;for(;this._i<this._tasks.length;){if(R=Date.now(),this._tasks[this._i]()||this._i++,R=Math.max(1,Date.now()-R),D=Math.max(R,D),V=U.timeRemaining(),1.5*D>V)return j-R<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(j-R))}ms`),void this._start();j=V}this.clear()}}class B extends W{_requestCallback(U){return setTimeout(()=>U(this._createDeadline(16)))}_cancelCallback(U){clearTimeout(U)}_createDeadline(U){let R=Date.now()+U;return{timeRemaining:()=>Math.max(0,R-Date.now())}}}G.PriorityTaskQueue=B,G.IdleTaskQueue=!q.isNode&&"requestIdleCallback"in window?class extends W{_requestCallback(U){return requestIdleCallback(U)}_cancelCallback(U){cancelIdleCallback(U)}}:B,G.DebouncedIdleTask=class{constructor(){this._queue=new G.IdleTaskQueue}set(U){this._queue.clear(),this._queue.enqueue(U)}flush(){this._queue.flush()}}},282:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.updateWindowsModeWrappedState=void 0;let q=K(643);G.updateWindowsModeWrappedState=function(W){let B=W.buffer.lines.get(W.buffer.ybase+W.buffer.y-1),U=B?.get(W.cols-1),R=W.buffer.lines.get(W.buffer.ybase+W.buffer.y);R&&U&&(R.isWrapped=U[q.CHAR_DATA_CODE_INDEX]!==q.NULL_CELL_CODE&&U[q.CHAR_DATA_CODE_INDEX]!==q.WHITESPACE_CELL_CODE)}},734:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.ExtendedAttrs=G.AttributeData=void 0;class K{constructor(){this.fg=0,this.bg=0,this.extended=new q}static toColorRGB(W){return[W>>>16&255,W>>>8&255,255&W]}static fromColorRGB(W){return(255&W[0])<<16|(255&W[1])<<8|255&W[2]}clone(){let W=new K;return W.fg=this.fg,W.bg=this.bg,W.extended=this.extended.clone(),W}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}G.AttributeData=K;class q{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(W){this._ext=W}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(W){this._ext&=-469762049,this._ext|=W<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(W){this._ext&=-67108864,this._ext|=67108863&W}get urlId(){return this._urlId}set urlId(W){this._urlId=W}get underlineVariantOffset(){let W=(3758096384&this._ext)>>29;return W<0?4294967288^W:W}set underlineVariantOffset(W){this._ext&=536870911,this._ext|=W<<29&3758096384}constructor(W=0,B=0){this._ext=0,this._urlId=0,this._ext=W,this._urlId=B}clone(){return new q(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}G.ExtendedAttrs=q},92:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.Buffer=G.MAX_BUFFER_SIZE=void 0;let q=K(349),W=K(226),B=K(734),U=K(437),R=K(634),D=K(511),j=K(643),V=K(863),L=K(116);G.MAX_BUFFER_SIZE=4294967295,G.Buffer=class{constructor(F,N,O){this._hasScrollback=F,this._optionsService=N,this._bufferService=O,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=U.DEFAULT_ATTR_DATA.clone(),this.savedCharset=L.DEFAULT_CHARSET,this.markers=[],this._nullCell=D.CellData.fromCharData([0,j.NULL_CELL_CHAR,j.NULL_CELL_WIDTH,j.NULL_CELL_CODE]),this._whitespaceCell=D.CellData.fromCharData([0,j.WHITESPACE_CELL_CHAR,j.WHITESPACE_CELL_WIDTH,j.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new W.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new q.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(F){return F?(this._nullCell.fg=F.fg,this._nullCell.bg=F.bg,this._nullCell.extended=F.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new B.ExtendedAttrs),this._nullCell}getWhitespaceCell(F){return F?(this._whitespaceCell.fg=F.fg,this._whitespaceCell.bg=F.bg,this._whitespaceCell.extended=F.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new B.ExtendedAttrs),this._whitespaceCell}getBlankLine(F,N){return new U.BufferLine(this._bufferService.cols,this.getNullCell(F),N)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let F=this.ybase+this.y-this.ydisp;return F>=0&&F<this._rows}_getCorrectBufferLength(F){if(!this._hasScrollback)return F;let N=F+this._optionsService.rawOptions.scrollback;return N>G.MAX_BUFFER_SIZE?G.MAX_BUFFER_SIZE:N}fillViewportRows(F){if(this.lines.length===0){F===void 0&&(F=U.DEFAULT_ATTR_DATA);let N=this._rows;for(;N--;)this.lines.push(this.getBlankLine(F))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new q.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(F,N){let O=this.getNullCell(U.DEFAULT_ATTR_DATA),A=0,I=this._getCorrectBufferLength(N);if(I>this.lines.maxLength&&(this.lines.maxLength=I),this.lines.length>0){if(this._cols<F)for(let Z=0;Z<this.lines.length;Z++)A+=+this.lines.get(Z).resize(F,O);let w=0;if(this._rows<N)for(let Z=this._rows;Z<N;Z++)this.lines.length<N+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new U.BufferLine(F,O)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new U.BufferLine(F,O)));else for(let Z=this._rows;Z>N;Z--)this.lines.length>N+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(I<this.lines.maxLength){let Z=this.lines.length-I;Z>0&&(this.lines.trimStart(Z),this.ybase=Math.max(this.ybase-Z,0),this.ydisp=Math.max(this.ydisp-Z,0),this.savedY=Math.max(this.savedY-Z,0)),this.lines.maxLength=I}this.x=Math.min(this.x,F-1),this.y=Math.min(this.y,N-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,F-1),this.scrollTop=0}if(this.scrollBottom=N-1,this._isReflowEnabled&&(this._reflow(F,N),this._cols>F))for(let w=0;w<this.lines.length;w++)A+=+this.lines.get(w).resize(F,O);this._cols=F,this._rows=N,this._memoryCleanupQueue.clear(),A>0.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let F=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,F=!1);let N=0;for(;this._memoryCleanupPosition<this.lines.length;)if(N+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),N>100)return!0;return F}get _isReflowEnabled(){let F=this._optionsService.rawOptions.windowsPty;return F&&F.buildNumber?this._hasScrollback&&F.backend==="conpty"&&F.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(F,N){this._cols!==F&&(F>this._cols?this._reflowLarger(F,N):this._reflowSmaller(F,N))}_reflowLarger(F,N){let O=R.reflowLargerGetLinesToRemove(this.lines,this._cols,F,this.ybase+this.y,this.getNullCell(U.DEFAULT_ATTR_DATA));if(O.length>0){let A=R.reflowLargerCreateNewLayout(this.lines,O);R.reflowLargerApplyNewLayout(this.lines,A.layout),this._reflowLargerAdjustViewport(F,N,A.countRemoved)}}_reflowLargerAdjustViewport(F,N,O){let A=this.getNullCell(U.DEFAULT_ATTR_DATA),I=O;for(;I-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<N&&this.lines.push(new U.BufferLine(F,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-O,0)}_reflowSmaller(F,N){let O=this.getNullCell(U.DEFAULT_ATTR_DATA),A=[],I=0;for(let w=this.lines.length-1;w>=0;w--){let Z=this.lines.get(w);if(!Z||!Z.isWrapped&&Z.getTrimmedLength()<=F)continue;let k=[Z];for(;Z.isWrapped&&w>0;)Z=this.lines.get(--w),k.unshift(Z);let x=this.ybase+this.y;if(x>=w&&x<w+k.length)continue;let T=k[k.length-1].getTrimmedLength(),g=R.reflowSmallerGetNewLineLengths(k,this._cols,F),Q1=g.length-k.length,k1;k1=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+Q1):Math.max(0,this.lines.length-this.lines.maxLength+Q1);let N1=[];for(let _=0;_<Q1;_++){let b=this.getBlankLine(U.DEFAULT_ATTR_DATA,!0);N1.push(b)}N1.length>0&&(A.push({start:w+k.length+I,newLines:N1}),I+=N1.length),k.push(...N1);let t=g.length-1,V1=g[t];V1===0&&(t--,V1=g[t]);let E=k.length-Q1-1,S=T;for(;E>=0;){let _=Math.min(S,V1);if(k[t]===void 0)break;if(k[t].copyCellsFrom(k[E],S-_,V1-_,_,!0),V1-=_,V1===0&&(t--,V1=g[t]),S-=_,S===0){E--;let b=Math.max(E,0);S=R.getWrappedLineTrimmedLength(k,b,this._cols)}}for(let _=0;_<k.length;_++)g[_]<F&&k[_].setCell(g[_],O);let C=Q1-k1;for(;C-- >0;)this.ybase===0?this.y<N-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+I)-N&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+Q1,this.ybase+N-1)}if(A.length>0){let w=[],Z=[];for(let t=0;t<this.lines.length;t++)Z.push(this.lines.get(t));let k=this.lines.length,x=k-1,T=0,g=A[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+I);let Q1=0;for(let t=Math.min(this.lines.maxLength-1,k+I-1);t>=0;t--)if(g&&g.start>x+Q1){for(let V1=g.newLines.length-1;V1>=0;V1--)this.lines.set(t--,g.newLines[V1]);t++,w.push({index:x+1,amount:g.newLines.length}),Q1+=g.newLines.length,g=A[++T]}else this.lines.set(t,Z[x--]);let k1=0;for(let t=w.length-1;t>=0;t--)w[t].index+=k1,this.lines.onInsertEmitter.fire(w[t]),k1+=w[t].amount;let N1=Math.max(0,k+I-this.lines.maxLength);N1>0&&this.lines.onTrimEmitter.fire(N1)}}translateBufferLineToString(F,N,O=0,A){let I=this.lines.get(F);return I?I.translateToString(N,O,A):""}getWrappedRangeForLine(F){let N=F,O=F;for(;N>0&&this.lines.get(N).isWrapped;)N--;for(;O+1<this.lines.length&&this.lines.get(O+1).isWrapped;)O++;return{first:N,last:O}}setupTabStops(F){for(F!=null?this.tabs[F]||(F=this.prevStop(F)):(this.tabs={},F=0);F<this._cols;F+=this._optionsService.rawOptions.tabStopWidth)this.tabs[F]=!0}prevStop(F){for(F==null&&(F=this.x);!this.tabs[--F]&&F>0;);return F>=this._cols?this._cols-1:F<0?0:F}nextStop(F){for(F==null&&(F=this.x);!this.tabs[++F]&&F<this._cols;);return F>=this._cols?this._cols-1:F<0?0:F}clearMarkers(F){this._isClearing=!0;for(let N=0;N<this.markers.length;N++)this.markers[N].line===F&&(this.markers[N].dispose(),this.markers.splice(N--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let F=0;F<this.markers.length;F++)this.markers[F].dispose(),this.markers.splice(F--,1);this._isClearing=!1}addMarker(F){let N=new V.Marker(F);return this.markers.push(N),N.register(this.lines.onTrim((O)=>{N.line-=O,N.line<0&&N.dispose()})),N.register(this.lines.onInsert((O)=>{N.line>=O.index&&(N.line+=O.amount)})),N.register(this.lines.onDelete((O)=>{N.line>=O.index&&N.line<O.index+O.amount&&N.dispose(),N.line>O.index&&(N.line-=O.amount)})),N.register(N.onDispose(()=>this._removeMarker(N))),N}_removeMarker(F){this._isClearing||this.markers.splice(this.markers.indexOf(F),1)}}},437:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.BufferLine=G.DEFAULT_ATTR_DATA=void 0;let q=K(734),W=K(511),B=K(643),U=K(482);G.DEFAULT_ATTR_DATA=Object.freeze(new q.AttributeData);let R=0;class D{constructor(j,V,L=!1){this.isWrapped=L,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*j);let F=V||W.CellData.fromCharData([0,B.NULL_CELL_CHAR,B.NULL_CELL_WIDTH,B.NULL_CELL_CODE]);for(let N=0;N<j;++N)this.setCell(N,F);this.length=j}get(j){let V=this._data[3*j+0],L=2097151&V;return[this._data[3*j+1],2097152&V?this._combined[j]:L?U.stringFromCodePoint(L):"",V>>22,2097152&V?this._combined[j].charCodeAt(this._combined[j].length-1):L]}set(j,V){this._data[3*j+1]=V[B.CHAR_DATA_ATTR_INDEX],V[B.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[j]=V[1],this._data[3*j+0]=2097152|j|V[B.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*j+0]=V[B.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|V[B.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(j){return this._data[3*j+0]>>22}hasWidth(j){return 12582912&this._data[3*j+0]}getFg(j){return this._data[3*j+1]}getBg(j){return this._data[3*j+2]}hasContent(j){return 4194303&this._data[3*j+0]}getCodePoint(j){let V=this._data[3*j+0];return 2097152&V?this._combined[j].charCodeAt(this._combined[j].length-1):2097151&V}isCombined(j){return 2097152&this._data[3*j+0]}getString(j){let V=this._data[3*j+0];return 2097152&V?this._combined[j]:2097151&V?U.stringFromCodePoint(2097151&V):""}isProtected(j){return 536870912&this._data[3*j+2]}loadCell(j,V){return R=3*j,V.content=this._data[R+0],V.fg=this._data[R+1],V.bg=this._data[R+2],2097152&V.content&&(V.combinedData=this._combined[j]),268435456&V.bg&&(V.extended=this._extendedAttrs[j]),V}setCell(j,V){2097152&V.content&&(this._combined[j]=V.combinedData),268435456&V.bg&&(this._extendedAttrs[j]=V.extended),this._data[3*j+0]=V.content,this._data[3*j+1]=V.fg,this._data[3*j+2]=V.bg}setCellFromCodepoint(j,V,L,F){268435456&F.bg&&(this._extendedAttrs[j]=F.extended),this._data[3*j+0]=V|L<<22,this._data[3*j+1]=F.fg,this._data[3*j+2]=F.bg}addCodepointToCell(j,V,L){let F=this._data[3*j+0];2097152&F?this._combined[j]+=U.stringFromCodePoint(V):2097151&F?(this._combined[j]=U.stringFromCodePoint(2097151&F)+U.stringFromCodePoint(V),F&=-2097152,F|=2097152):F=V|4194304,L&&(F&=-12582913,F|=L<<22),this._data[3*j+0]=F}insertCells(j,V,L){if((j%=this.length)&&this.getWidth(j-1)===2&&this.setCellFromCodepoint(j-1,0,1,L),V<this.length-j){let F=new W.CellData;for(let N=this.length-j-V-1;N>=0;--N)this.setCell(j+V+N,this.loadCell(j+N,F));for(let N=0;N<V;++N)this.setCell(j+N,L)}else for(let F=j;F<this.length;++F)this.setCell(F,L);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,L)}deleteCells(j,V,L){if(j%=this.length,V<this.length-j){let F=new W.CellData;for(let N=0;N<this.length-j-V;++N)this.setCell(j+N,this.loadCell(j+V+N,F));for(let N=this.length-V;N<this.length;++N)this.setCell(N,L)}else for(let F=j;F<this.length;++F)this.setCell(F,L);j&&this.getWidth(j-1)===2&&this.setCellFromCodepoint(j-1,0,1,L),this.getWidth(j)!==0||this.hasContent(j)||this.setCellFromCodepoint(j,0,1,L)}replaceCells(j,V,L,F=!1){if(F)for(j&&this.getWidth(j-1)===2&&!this.isProtected(j-1)&&this.setCellFromCodepoint(j-1,0,1,L),V<this.length&&this.getWidth(V-1)===2&&!this.isProtected(V)&&this.setCellFromCodepoint(V,0,1,L);j<V&&j<this.length;)this.isProtected(j)||this.setCell(j,L),j++;else for(j&&this.getWidth(j-1)===2&&this.setCellFromCodepoint(j-1,0,1,L),V<this.length&&this.getWidth(V-1)===2&&this.setCellFromCodepoint(V,0,1,L);j<V&&j<this.length;)this.setCell(j++,L)}resize(j,V){if(j===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let L=3*j;if(j>this.length){if(this._data.buffer.byteLength>=4*L)this._data=new Uint32Array(this._data.buffer,0,L);else{let F=new Uint32Array(L);F.set(this._data),this._data=F}for(let F=this.length;F<j;++F)this.setCell(F,V)}else{this._data=this._data.subarray(0,L);let F=Object.keys(this._combined);for(let O=0;O<F.length;O++){let A=parseInt(F[O],10);A>=j&&delete this._combined[A]}let N=Object.keys(this._extendedAttrs);for(let O=0;O<N.length;O++){let A=parseInt(N[O],10);A>=j&&delete this._extendedAttrs[A]}}return this.length=j,4*L*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let j=new Uint32Array(this._data.length);return j.set(this._data),this._data=j,1}return 0}fill(j,V=!1){if(V)for(let L=0;L<this.length;++L)this.isProtected(L)||this.setCell(L,j);else{this._combined={},this._extendedAttrs={};for(let L=0;L<this.length;++L)this.setCell(L,j)}}copyFrom(j){this.length!==j.length?this._data=new Uint32Array(j._data):this._data.set(j._data),this.length=j.length,this._combined={};for(let V in j._combined)this._combined[V]=j._combined[V];this._extendedAttrs={};for(let V in j._extendedAttrs)this._extendedAttrs[V]=j._extendedAttrs[V];this.isWrapped=j.isWrapped}clone(){let j=new D(0);j._data=new Uint32Array(this._data),j.length=this.length;for(let V in this._combined)j._combined[V]=this._combined[V];for(let V in this._extendedAttrs)j._extendedAttrs[V]=this._extendedAttrs[V];return j.isWrapped=this.isWrapped,j}getTrimmedLength(){for(let j=this.length-1;j>=0;--j)if(4194303&this._data[3*j+0])return j+(this._data[3*j+0]>>22);return 0}getNoBgTrimmedLength(){for(let j=this.length-1;j>=0;--j)if(4194303&this._data[3*j+0]||50331648&this._data[3*j+2])return j+(this._data[3*j+0]>>22);return 0}copyCellsFrom(j,V,L,F,N){let O=j._data;if(N)for(let I=F-1;I>=0;I--){for(let w=0;w<3;w++)this._data[3*(L+I)+w]=O[3*(V+I)+w];268435456&O[3*(V+I)+2]&&(this._extendedAttrs[L+I]=j._extendedAttrs[V+I])}else for(let I=0;I<F;I++){for(let w=0;w<3;w++)this._data[3*(L+I)+w]=O[3*(V+I)+w];268435456&O[3*(V+I)+2]&&(this._extendedAttrs[L+I]=j._extendedAttrs[V+I])}let A=Object.keys(j._combined);for(let I=0;I<A.length;I++){let w=parseInt(A[I],10);w>=V&&(this._combined[w-V+L]=j._combined[w])}}translateToString(j,V,L,F){V=V??0,L=L??this.length,j&&(L=Math.min(L,this.getTrimmedLength())),F&&(F.length=0);let N="";for(;V<L;){let O=this._data[3*V+0],A=2097151&O,I=2097152&O?this._combined[V]:A?U.stringFromCodePoint(A):B.WHITESPACE_CELL_CHAR;if(N+=I,F)for(let w=0;w<I.length;++w)F.push(V);V+=O>>22||1}return F&&F.push(V),N}}G.BufferLine=D},634:(M,G)=>{function K(q,W,B){if(W===q.length-1)return q[W].getTrimmedLength();let U=!q[W].hasContent(B-1)&&q[W].getWidth(B-1)===1,R=q[W+1].getWidth(0)===2;return U&&R?B-1:B}Object.defineProperty(G,"__esModule",{value:!0}),G.getWrappedLineTrimmedLength=G.reflowSmallerGetNewLineLengths=G.reflowLargerApplyNewLayout=G.reflowLargerCreateNewLayout=G.reflowLargerGetLinesToRemove=void 0,G.reflowLargerGetLinesToRemove=function(q,W,B,U,R){let D=[];for(let j=0;j<q.length-1;j++){let V=j,L=q.get(++V);if(!L.isWrapped)continue;let F=[q.get(j)];for(;V<q.length&&L.isWrapped;)F.push(L),L=q.get(++V);if(U>=j&&U<V){j+=F.length-1;continue}let N=0,O=K(F,N,W),A=1,I=0;for(;A<F.length;){let Z=K(F,A,W),k=Z-I,x=B-O,T=Math.min(k,x);F[N].copyCellsFrom(F[A],I,O,T,!1),O+=T,O===B&&(N++,O=0),I+=T,I===Z&&(A++,I=0),O===0&&N!==0&&F[N-1].getWidth(B-1)===2&&(F[N].copyCellsFrom(F[N-1],B-1,O++,1,!1),F[N-1].setCell(B-1,R))}F[N].replaceCells(O,B,R);let w=0;for(let Z=F.length-1;Z>0&&(Z>N||F[Z].getTrimmedLength()===0);Z--)w++;w>0&&(D.push(j+F.length-w),D.push(w)),j+=F.length-1}return D},G.reflowLargerCreateNewLayout=function(q,W){let B=[],U=0,R=W[U],D=0;for(let j=0;j<q.length;j++)if(R===j){let V=W[++U];q.onDeleteEmitter.fire({index:j-D,amount:V}),j+=V-1,D+=V,R=W[++U]}else B.push(j);return{layout:B,countRemoved:D}},G.reflowLargerApplyNewLayout=function(q,W){let B=[];for(let U=0;U<W.length;U++)B.push(q.get(W[U]));for(let U=0;U<B.length;U++)q.set(U,B[U]);q.length=W.length},G.reflowSmallerGetNewLineLengths=function(q,W,B){let U=[],R=q.map((L,F)=>K(q,F,W)).reduce((L,F)=>L+F),D=0,j=0,V=0;for(;V<R;){if(R-V<B){U.push(R-V);break}D+=B;let L=K(q,j,W);D>L&&(D-=L,j++);let F=q[j].getWidth(D-1)===2;F&&D--;let N=F?B-1:B;U.push(N),V+=N}return U},G.getWrappedLineTrimmedLength=K},295:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.BufferSet=void 0;let q=K(460),W=K(844),B=K(92);class U extends W.Disposable{constructor(R,D){super(),this._optionsService=R,this._bufferService=D,this._onBufferActivate=this.register(new q.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new B.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new B.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(R){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(R),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(R,D){this._normal.resize(R,D),this._alt.resize(R,D),this.setupTabStops(R)}setupTabStops(R){this._normal.setupTabStops(R),this._alt.setupTabStops(R)}}G.BufferSet=U},511:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.CellData=void 0;let q=K(482),W=K(643),B=K(734);class U extends B.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new B.ExtendedAttrs,this.combinedData=""}static fromCharData(R){let D=new U;return D.setFromCharData(R),D}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?q.stringFromCodePoint(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(R){this.fg=R[W.CHAR_DATA_ATTR_INDEX],this.bg=0;let D=!1;if(R[W.CHAR_DATA_CHAR_INDEX].length>2)D=!0;else if(R[W.CHAR_DATA_CHAR_INDEX].length===2){let j=R[W.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=j&&j<=56319){let V=R[W.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=V&&V<=57343?this.content=1024*(j-55296)+V-56320+65536|R[W.CHAR_DATA_WIDTH_INDEX]<<22:D=!0}else D=!0}else this.content=R[W.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|R[W.CHAR_DATA_WIDTH_INDEX]<<22;D&&(this.combinedData=R[W.CHAR_DATA_CHAR_INDEX],this.content=2097152|R[W.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}G.CellData=U},643:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.WHITESPACE_CELL_CODE=G.WHITESPACE_CELL_WIDTH=G.WHITESPACE_CELL_CHAR=G.NULL_CELL_CODE=G.NULL_CELL_WIDTH=G.NULL_CELL_CHAR=G.CHAR_DATA_CODE_INDEX=G.CHAR_DATA_WIDTH_INDEX=G.CHAR_DATA_CHAR_INDEX=G.CHAR_DATA_ATTR_INDEX=G.DEFAULT_EXT=G.DEFAULT_ATTR=G.DEFAULT_COLOR=void 0,G.DEFAULT_COLOR=0,G.DEFAULT_ATTR=256|G.DEFAULT_COLOR<<9,G.DEFAULT_EXT=0,G.CHAR_DATA_ATTR_INDEX=0,G.CHAR_DATA_CHAR_INDEX=1,G.CHAR_DATA_WIDTH_INDEX=2,G.CHAR_DATA_CODE_INDEX=3,G.NULL_CELL_CHAR="",G.NULL_CELL_WIDTH=1,G.NULL_CELL_CODE=0,G.WHITESPACE_CELL_CHAR=" ",G.WHITESPACE_CELL_WIDTH=1,G.WHITESPACE_CELL_CODE=32},863:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.Marker=void 0;let q=K(460),W=K(844);class B{get id(){return this._id}constructor(U){this.line=U,this.isDisposed=!1,this._disposables=[],this._id=B._nextId++,this._onDispose=this.register(new q.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),W.disposeArray(this._disposables),this._disposables.length=0)}register(U){return this._disposables.push(U),U}}G.Marker=B,B._nextId=1},116:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.DEFAULT_CHARSET=G.CHARSETS=void 0,G.CHARSETS={},G.DEFAULT_CHARSET=G.CHARSETS.B,G.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},G.CHARSETS.A={"#":"£"},G.CHARSETS.B=void 0,G.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},G.CHARSETS.C=G.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},G.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},G.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},G.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},G.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},G.CHARSETS.E=G.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},G.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},G.CHARSETS.H=G.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},G.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},584:(M,G)=>{var K,q,W;Object.defineProperty(G,"__esModule",{value:!0}),G.C1_ESCAPED=G.C1=G.C0=void 0,function(B){B.NUL="\x00",B.SOH="\x01",B.STX="\x02",B.ETX="\x03",B.EOT="\x04",B.ENQ="\x05",B.ACK="\x06",B.BEL="\x07",B.BS="\b",B.HT="\t",B.LF=`
40
+ `+jQ:"The @lydell/node-pty package currently does not support your platform: "+process.platform+"-"+process.arch,{cause:Q})}else throw Q}}X6.requireBinary=l4;function c4(){try{return HQ().optionalDependencies}catch($){return}}});var RQ=n((t0)=>{var __dirname="/home/kyle/projects/coder/blink/node_modules/@lydell/node-pty";Object.defineProperty(t0,"__esModule",{value:!0});var p4=require("fs"),VQ=require("path"),KQ=require("net"),d4=require("child_process"),n4=GQ(),i4=Y6(),G6,o4=1000,r4=function(){function $(J,Q,X,Y,H,M,G,K){var q=this;if(K===void 0)K=!1;if(this._pid=0,this._innerPid=0,!G6)G6=i4.requireBinary("conpty.node");this._ptyNative=G6,Y=VQ.resolve(Y);var W=H6(J,Q),B=this._ptyNative.startProcess(J,H,M,G,this._generatePipeName(),K);this._fd=B.fd,this._pty=B.pty,this._outSocket=new KQ.Socket,this._outSocket.setEncoding("utf8"),this._conoutSocketWorker=new n4.ConoutConnection(B.conout),this._conoutSocketWorker.onReady(function(){q._conoutSocketWorker.connectSocket(q._outSocket)}),this._outSocket.on("connect",function(){q._outSocket.emit("ready_datapipe")});var U=p4.openSync(B.conin,"w");this._inSocket=new KQ.Socket({fd:U,readable:!1,writable:!0}),this._inSocket.setEncoding("utf8");var R=this._ptyNative.connect(this._pty,W,Y,X,function(D){return q._$onProcessExit(D)});this._innerPid=R.pid}return Object.defineProperty($.prototype,"inSocket",{get:function(){return this._inSocket},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"outSocket",{get:function(){return this._outSocket},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"fd",{get:function(){return this._fd},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"innerPid",{get:function(){return this._innerPid},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"pty",{get:function(){return this._pty},enumerable:!0,configurable:!0}),$.prototype.resize=function(J,Q){if(this._exitCode!==void 0)throw new Error("Cannot resize a pty that has already exited");this._ptyNative.resize(this._pty,J,Q)},$.prototype.clear=function(){this._ptyNative.clear(this._pty)},$.prototype.kill=function(){var J=this;this._inSocket.readable=!1,this._outSocket.readable=!1,this._getConsoleProcessList().then(function(Q){Q.forEach(function(X){try{process.kill(X)}catch(Y){}}),J._ptyNative.kill(J._pty)}),this._conoutSocketWorker.dispose()},$.prototype._getConsoleProcessList=function(){var J=this;return new Promise(function(Q){var X=d4.fork(VQ.join(__dirname,"conpty_console_list_agent"),[J._innerPid.toString()]);X.on("message",function(H){clearTimeout(Y),Q(H.consoleProcessList)});var Y=setTimeout(function(){X.kill(),Q([J._innerPid])},5000)})},Object.defineProperty($.prototype,"exitCode",{get:function(){return this._exitCode},enumerable:!0,configurable:!0}),$.prototype._generatePipeName=function(){return"conpty-"+Math.random()*1e7},$.prototype._$onProcessExit=function(J){var Q=this;this._exitCode=J,this._flushDataAndCleanUp(),this._outSocket.on("data",function(){return Q._flushDataAndCleanUp()})},$.prototype._flushDataAndCleanUp=function(){var J=this;if(this._closeTimeout)clearTimeout(this._closeTimeout);this._closeTimeout=setTimeout(function(){return J._cleanUpProcess()},o4)},$.prototype._cleanUpProcess=function(){this._inSocket.readable=!1,this._outSocket.readable=!1,this._outSocket.destroy()},$}();t0.WindowsPtyAgent=r4;function H6($,J){if(a4(J)){if(J.length===0)return $;return H6($,[])+" "+J}var Q=[$];Array.prototype.push.apply(Q,J);var X="";for(var Y=0;Y<Q.length;Y++){if(Y>0)X+=" ";var H=Q[Y],M=s4(H[0]!=='"',H[H.length-1]!=='"'),G=H[0]!=='"'&&H[H.length-1]!=='"',K=H===""||(H.indexOf(" ")!==-1||H.indexOf("\t")!==-1)&&(H.length>1&&(M||G));if(K)X+='"';var q=0;for(var W=0;W<H.length;W++){var B=H[W];if(B==="\\")q++;else if(B==='"')X+=s0("\\",q*2+1),X+='"',q=0;else X+=s0("\\",q),q=0,X+=B}if(K)X+=s0("\\",q*2),X+='"';else X+=s0("\\",q)}return X}t0.argsToCommandLine=H6;function a4($){return typeof $==="string"}function s0($,J){var Q="";for(var X=0;X<J;X++)Q+=$;return Q}function s4($,J){return $&&!J||!$&&J}});var V6=n((j6)=>{Object.defineProperty(j6,"__esModule",{value:!0});function t4($){var J=[];for(var Q=1;Q<arguments.length;Q++)J[Q-1]=arguments[Q];return J.forEach(function(X){return Object.keys(X).forEach(function(Y){return $[Y]=X[Y]})}),$}j6.assign=t4});var WQ=n((L0)=>{var e4=L0&&L0.__extends||function(){var $=function(J,Q){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,Y){X.__proto__=Y}||function(X,Y){for(var H in Y)if(Y.hasOwnProperty(H))X[H]=Y[H]},$(J,Q)};return function(J,Q){$(J,Q);function X(){this.constructor=J}J.prototype=Q===null?Object.create(Q):(X.prototype=Q.prototype,new X)}}();Object.defineProperty(L0,"__esModule",{value:!0});var K6=J6(),$G=RQ(),JG=V6(),QG="cmd.exe",XG="Windows Shell",YG=function($){e4(J,$);function J(Q,X,Y){var H=$.call(this,Y)||this;if(H._checkType("args",X,"string",!0),X=X||[],Q=Q||QG,Y=Y||{},Y.env=Y.env||process.env,Y.encoding)console.warn("Setting encoding on Windows is not supported");var M=JG.assign({},Y.env);H._cols=Y.cols||K6.DEFAULT_COLS,H._rows=Y.rows||K6.DEFAULT_ROWS;var G=Y.cwd||process.cwd(),K=Y.name||M.TERM||XG,q=H._parseEnv(M);return H._isReady=!1,H._deferreds=[],H._agent=new $G.WindowsPtyAgent(Q,X,q,G,H._cols,H._rows,!1,Y.conptyInheritCursor),H._socket=H._agent.outSocket,H._pid=H._agent.innerPid,H._fd=H._agent.fd,H._pty=H._agent.pty,H._socket.on("ready_datapipe",function(){["connect","data","end","timeout","drain"].forEach(function(W){H._socket.on(W,function(){if(!H._isReady&&W==="data")H._isReady=!0,H._deferreds.forEach(function(B){B.run()}),H._deferreds=[]})}),H._socket.on("error",function(W){if(H._close(),W.code){if(~W.code.indexOf("errno 5")||~W.code.indexOf("EIO"))return}if(H.listeners("error").length<2)throw W}),H._socket.on("close",function(){H.emit("exit",H._agent.exitCode),H._close()})}),H._file=Q,H._name=K,H._readable=!0,H._writable=!0,H._forwardEvents(),H}return J.prototype._write=function(Q){this._defer(this._doWrite,Q)},J.prototype._doWrite=function(Q){this._agent.inSocket.write(Q)},J.open=function(Q){throw new Error("open() not supported on windows, use Fork() instead.")},J.prototype.resize=function(Q,X){var Y=this;if(Q<=0||X<=0||isNaN(Q)||isNaN(X)||Q===1/0||X===1/0)throw new Error("resizing must be done using positive cols and rows");this._deferNoArgs(function(){Y._agent.resize(Q,X),Y._cols=Q,Y._rows=X})},J.prototype.clear=function(){var Q=this;this._deferNoArgs(function(){Q._agent.clear()})},J.prototype.destroy=function(){var Q=this;this._deferNoArgs(function(){Q.kill()})},J.prototype.kill=function(Q){var X=this;this._deferNoArgs(function(){if(Q)throw new Error("Signals not supported on windows.");X._close(),X._agent.kill()})},J.prototype._deferNoArgs=function(Q){var X=this;if(this._isReady){Q.call(this);return}this._deferreds.push({run:function(){return Q.call(X)}})},J.prototype._defer=function(Q,X){var Y=this;if(this._isReady){Q.call(this,X);return}this._deferreds.push({run:function(){return Q.call(Y,X)}})},Object.defineProperty(J.prototype,"process",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"master",{get:function(){throw new Error("master is not supported on Windows")},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"slave",{get:function(){throw new Error("slave is not supported on Windows")},enumerable:!0,configurable:!0}),J}(K6.Terminal);L0.WindowsTerminal=YG});var qQ=n((I0)=>{var GG=I0&&I0.__extends||function(){var $=function(J,Q){return $=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(X,Y){X.__proto__=Y}||function(X,Y){for(var H in Y)if(Y.hasOwnProperty(H))X[H]=Y[H]},$(J,Q)};return function(J,Q){$(J,Q);function X(){this.constructor=J}J.prototype=Q===null?Object.create(Q):(X.prototype=Q.prototype,new X)}}();Object.defineProperty(I0,"__esModule",{value:!0});var R6=require("tty"),E0=J6(),HG=V6(),jG=Y6(),A0=jG.requireBinary("pty.node"),E1="@lydell/node-pty-"+process.platform+"-"+process.arch+"/spawn-helper";E1=process.platform==="darwin"?require.resolve(E1):"spawn-helper-unused";E1=E1.replace("app.asar","app.asar.unpacked");E1=E1.replace("node_modules.asar","node_modules.asar.unpacked");var VG="sh",KG="xterm",RG=200,WG=function($){GG(J,$);function J(Q,X,Y){var H,M,G=$.call(this,Y)||this;if(G._boundClose=!1,G._emittedClose=!1,typeof X==="string")throw new Error("args as a string is not supported on unix.");X=X||[],Q=Q||VG,Y=Y||{},Y.env=Y.env||process.env,G._cols=Y.cols||E0.DEFAULT_COLS,G._rows=Y.rows||E0.DEFAULT_ROWS;var K=(H=Y.uid)!==null&&H!==void 0?H:-1,q=(M=Y.gid)!==null&&M!==void 0?M:-1,W=HG.assign({},Y.env);if(Y.env===process.env)G._sanitizeEnv(W);var B=Y.cwd||process.cwd();W.PWD=B;var U=Y.name||W.TERM||KG;W.TERM=U;var R=G._parseEnv(W),D=Y.encoding===void 0?"utf8":Y.encoding,j=function(L,F){if(!G._emittedClose){if(G._boundClose)return;G._boundClose=!0;var N=setTimeout(function(){N=null,G._socket.destroy()},RG);G.once("close",function(){if(N!==null)clearTimeout(N);G.emit("exit",L,F)});return}G.emit("exit",L,F)},V=A0.fork(Q,X,R,B,G._cols,G._rows,K,q,D==="utf8",E1,j);if(G._socket=new R6.ReadStream(V.fd),D!==null)G._socket.setEncoding(D);return G._socket.on("error",function(L){if(L.code){if(~L.code.indexOf("EAGAIN"))return}if(G._close(),!G._emittedClose)G._emittedClose=!0,G.emit("close");if(L.code){if(~L.code.indexOf("errno 5")||~L.code.indexOf("EIO"))return}if(G.listeners("error").length<2)throw L}),G._pid=V.pid,G._fd=V.fd,G._pty=V.pty,G._file=Q,G._name=U,G._readable=!0,G._writable=!0,G._socket.on("close",function(){if(G._emittedClose)return;G._emittedClose=!0,G._close(),G.emit("close")}),G._forwardEvents(),G}return Object.defineProperty(J.prototype,"master",{get:function(){return this._master},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"slave",{get:function(){return this._slave},enumerable:!0,configurable:!0}),J.prototype._write=function(Q){this._socket.write(Q)},Object.defineProperty(J.prototype,"fd",{get:function(){return this._fd},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"ptsName",{get:function(){return this._pty},enumerable:!0,configurable:!0}),J.open=function(Q){var X=Object.create(J.prototype);if(Q=Q||{},arguments.length>1)Q={cols:arguments[1],rows:arguments[2]};var Y=Q.cols||E0.DEFAULT_COLS,H=Q.rows||E0.DEFAULT_ROWS,M=Q.encoding===void 0?"utf8":Q.encoding,G=A0.open(Y,H);if(X._master=new R6.ReadStream(G.master),M!==null)X._master.setEncoding(M);if(X._master.resume(),X._slave=new R6.ReadStream(G.slave),M!==null)X._slave.setEncoding(M);return X._slave.resume(),X._socket=X._master,X._pid=-1,X._fd=G.master,X._pty=G.pty,X._file=process.argv[0]||"node",X._name=process.env.TERM||"",X._readable=!0,X._writable=!0,X._socket.on("error",function(K){if(X._close(),X.listeners("error").length<2)throw K}),X._socket.on("close",function(){X._close()}),X},J.prototype.destroy=function(){var Q=this;this._close(),this._socket.once("close",function(){Q.kill("SIGHUP")}),this._socket.destroy()},J.prototype.kill=function(Q){try{process.kill(this.pid,Q||"SIGHUP")}catch(X){}},Object.defineProperty(J.prototype,"process",{get:function(){if(process.platform==="darwin"){var Q=A0.process(this._fd);return Q!=="kernel_task"?Q:this._file}return A0.process(this._fd,this._pty)||this._file},enumerable:!0,configurable:!0}),J.prototype.resize=function(Q,X){if(Q<=0||X<=0||isNaN(Q)||isNaN(X)||Q===1/0||X===1/0)throw new Error("resizing must be done using positive cols and rows");A0.resize(this._fd,Q,X),this._cols=Q,this._rows=X},J.prototype.clear=function(){},J.prototype._sanitizeEnv=function(Q){delete Q.TMUX,delete Q.TMUX_PANE,delete Q.STY,delete Q.WINDOW,delete Q.WINDOWID,delete Q.TERMCAP,delete Q.COLUMNS,delete Q.LINES},J}(E0.Terminal);I0.UnixTerminal=WG});var MQ=n((m1)=>{Object.defineProperty(m1,"__esModule",{value:!0});var f1;if(process.platform==="win32")f1=WQ().WindowsTerminal;else f1=qQ().UnixTerminal;function qG($,J,Q){return new f1($,J,Q)}m1.spawn=qG;function MG($,J,Q){return new f1($,J,Q)}m1.fork=MG;function BG($,J,Q){return new f1($,J,Q)}m1.createTerminal=BG;function NG($){return f1.open($)}m1.open=NG});var BQ=n((S0,W6)=>{(function($,J){typeof S0=="object"&&typeof W6=="object"?W6.exports=J():typeof define=="function"&&define.amd?define([],J):typeof S0=="object"?S0.SerializeAddon=J():$.SerializeAddon=J()})(S0,()=>(()=>{var $={930:(Y,H,M)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.ColorContrastCache=void 0;let G=M(485);H.ColorContrastCache=class{constructor(){this._color=new G.TwoKeyMap,this._css=new G.TwoKeyMap}setCss(K,q,W){this._css.set(K,q,W)}getCss(K,q){return this._css.get(K,q)}setColor(K,q,W){this._color.set(K,q,W)}getColor(K,q){return this._color.get(K,q)}clear(){this._color.clear(),this._css.clear()}}},997:function(Y,H,M){var G=this&&this.__decorate||function(A,I,w,Z){var k,x=arguments.length,T=x<3?I:Z===null?Z=Object.getOwnPropertyDescriptor(I,w):Z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(A,I,w,Z);else for(var g=A.length-1;g>=0;g--)(k=A[g])&&(T=(x<3?k(T):x>3?k(I,w,T):k(I,w))||T);return x>3&&T&&Object.defineProperty(I,w,T),T},K=this&&this.__param||function(A,I){return function(w,Z){I(w,Z,A)}};Object.defineProperty(H,"__esModule",{value:!0}),H.ThemeService=H.DEFAULT_ANSI_COLORS=void 0;let q=M(930),W=M(160),B=M(345),U=M(859),R=M(97),D=W.css.toColor("#ffffff"),j=W.css.toColor("#000000"),V=W.css.toColor("#ffffff"),L=W.css.toColor("#000000"),F={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};H.DEFAULT_ANSI_COLORS=Object.freeze((()=>{let A=[W.css.toColor("#2e3436"),W.css.toColor("#cc0000"),W.css.toColor("#4e9a06"),W.css.toColor("#c4a000"),W.css.toColor("#3465a4"),W.css.toColor("#75507b"),W.css.toColor("#06989a"),W.css.toColor("#d3d7cf"),W.css.toColor("#555753"),W.css.toColor("#ef2929"),W.css.toColor("#8ae234"),W.css.toColor("#fce94f"),W.css.toColor("#729fcf"),W.css.toColor("#ad7fa8"),W.css.toColor("#34e2e2"),W.css.toColor("#eeeeec")],I=[0,95,135,175,215,255];for(let w=0;w<216;w++){let Z=I[w/36%6|0],k=I[w/6%6|0],x=I[w%6];A.push({css:W.channels.toCss(Z,k,x),rgba:W.channels.toRgba(Z,k,x)})}for(let w=0;w<24;w++){let Z=8+10*w;A.push({css:W.channels.toCss(Z,Z,Z),rgba:W.channels.toRgba(Z,Z,Z)})}return A})());let N=H.ThemeService=class extends U.Disposable{get colors(){return this._colors}constructor(A){super(),this._optionsService=A,this._contrastCache=new q.ColorContrastCache,this._halfContrastCache=new q.ColorContrastCache,this._onChangeColors=this.register(new B.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:D,background:j,cursor:V,cursorAccent:L,selectionForeground:void 0,selectionBackgroundTransparent:F,selectionBackgroundOpaque:W.color.blend(j,F),selectionInactiveBackgroundTransparent:F,selectionInactiveBackgroundOpaque:W.color.blend(j,F),ansi:H.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(A={}){let I=this._colors;if(I.foreground=O(A.foreground,D),I.background=O(A.background,j),I.cursor=O(A.cursor,V),I.cursorAccent=O(A.cursorAccent,L),I.selectionBackgroundTransparent=O(A.selectionBackground,F),I.selectionBackgroundOpaque=W.color.blend(I.background,I.selectionBackgroundTransparent),I.selectionInactiveBackgroundTransparent=O(A.selectionInactiveBackground,I.selectionBackgroundTransparent),I.selectionInactiveBackgroundOpaque=W.color.blend(I.background,I.selectionInactiveBackgroundTransparent),I.selectionForeground=A.selectionForeground?O(A.selectionForeground,W.NULL_COLOR):void 0,I.selectionForeground===W.NULL_COLOR&&(I.selectionForeground=void 0),W.color.isOpaque(I.selectionBackgroundTransparent))I.selectionBackgroundTransparent=W.color.opacity(I.selectionBackgroundTransparent,0.3);if(W.color.isOpaque(I.selectionInactiveBackgroundTransparent))I.selectionInactiveBackgroundTransparent=W.color.opacity(I.selectionInactiveBackgroundTransparent,0.3);if(I.ansi=H.DEFAULT_ANSI_COLORS.slice(),I.ansi[0]=O(A.black,H.DEFAULT_ANSI_COLORS[0]),I.ansi[1]=O(A.red,H.DEFAULT_ANSI_COLORS[1]),I.ansi[2]=O(A.green,H.DEFAULT_ANSI_COLORS[2]),I.ansi[3]=O(A.yellow,H.DEFAULT_ANSI_COLORS[3]),I.ansi[4]=O(A.blue,H.DEFAULT_ANSI_COLORS[4]),I.ansi[5]=O(A.magenta,H.DEFAULT_ANSI_COLORS[5]),I.ansi[6]=O(A.cyan,H.DEFAULT_ANSI_COLORS[6]),I.ansi[7]=O(A.white,H.DEFAULT_ANSI_COLORS[7]),I.ansi[8]=O(A.brightBlack,H.DEFAULT_ANSI_COLORS[8]),I.ansi[9]=O(A.brightRed,H.DEFAULT_ANSI_COLORS[9]),I.ansi[10]=O(A.brightGreen,H.DEFAULT_ANSI_COLORS[10]),I.ansi[11]=O(A.brightYellow,H.DEFAULT_ANSI_COLORS[11]),I.ansi[12]=O(A.brightBlue,H.DEFAULT_ANSI_COLORS[12]),I.ansi[13]=O(A.brightMagenta,H.DEFAULT_ANSI_COLORS[13]),I.ansi[14]=O(A.brightCyan,H.DEFAULT_ANSI_COLORS[14]),I.ansi[15]=O(A.brightWhite,H.DEFAULT_ANSI_COLORS[15]),A.extendedAnsi){let w=Math.min(I.ansi.length-16,A.extendedAnsi.length);for(let Z=0;Z<w;Z++)I.ansi[Z+16]=O(A.extendedAnsi[Z],H.DEFAULT_ANSI_COLORS[Z+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(A){this._restoreColor(A),this._onChangeColors.fire(this.colors)}_restoreColor(A){if(A!==void 0)switch(A){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[A]=this._restoreColors.ansi[A]}else for(let I=0;I<this._restoreColors.ansi.length;++I)this._colors.ansi[I]=this._restoreColors.ansi[I]}modifyColors(A){A(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function O(A,I){if(A!==void 0)try{return W.css.toColor(A)}catch{}return I}H.ThemeService=N=G([K(0,R.IOptionsService)],N)},160:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.contrastRatio=H.toPaddedHex=H.rgba=H.rgb=H.css=H.color=H.channels=H.NULL_COLOR=void 0;let M=0,G=0,K=0,q=0;var W,B,U,R,D;function j(L){let F=L.toString(16);return F.length<2?"0"+F:F}function V(L,F){return L<F?(F+0.05)/(L+0.05):(L+0.05)/(F+0.05)}H.NULL_COLOR={css:"#00000000",rgba:0},function(L){L.toCss=function(F,N,O,A){return A!==void 0?`#${j(F)}${j(N)}${j(O)}${j(A)}`:`#${j(F)}${j(N)}${j(O)}`},L.toRgba=function(F,N,O,A=255){return(F<<24|N<<16|O<<8|A)>>>0},L.toColor=function(F,N,O,A){return{css:L.toCss(F,N,O,A),rgba:L.toRgba(F,N,O,A)}}}(W||(H.channels=W={})),function(L){function F(N,O){return q=Math.round(255*O),[M,G,K]=D.toChannels(N.rgba),{css:W.toCss(M,G,K,q),rgba:W.toRgba(M,G,K,q)}}L.blend=function(N,O){if(q=(255&O.rgba)/255,q===1)return{css:O.css,rgba:O.rgba};let A=O.rgba>>24&255,I=O.rgba>>16&255,w=O.rgba>>8&255,Z=N.rgba>>24&255,k=N.rgba>>16&255,x=N.rgba>>8&255;return M=Z+Math.round((A-Z)*q),G=k+Math.round((I-k)*q),K=x+Math.round((w-x)*q),{css:W.toCss(M,G,K),rgba:W.toRgba(M,G,K)}},L.isOpaque=function(N){return(255&N.rgba)==255},L.ensureContrastRatio=function(N,O,A){let I=D.ensureContrastRatio(N.rgba,O.rgba,A);if(I)return W.toColor(I>>24&255,I>>16&255,I>>8&255)},L.opaque=function(N){let O=(255|N.rgba)>>>0;return[M,G,K]=D.toChannels(O),{css:W.toCss(M,G,K),rgba:O}},L.opacity=F,L.multiplyOpacity=function(N,O){return q=255&N.rgba,F(N,q*O/255)},L.toColorRGB=function(N){return[N.rgba>>24&255,N.rgba>>16&255,N.rgba>>8&255]}}(B||(H.color=B={})),function(L){let F,N;try{let O=document.createElement("canvas");O.width=1,O.height=1;let A=O.getContext("2d",{willReadFrequently:!0});A&&(F=A,F.globalCompositeOperation="copy",N=F.createLinearGradient(0,0,1,1))}catch{}L.toColor=function(O){if(O.match(/#[\da-f]{3,8}/i))switch(O.length){case 4:return M=parseInt(O.slice(1,2).repeat(2),16),G=parseInt(O.slice(2,3).repeat(2),16),K=parseInt(O.slice(3,4).repeat(2),16),W.toColor(M,G,K);case 5:return M=parseInt(O.slice(1,2).repeat(2),16),G=parseInt(O.slice(2,3).repeat(2),16),K=parseInt(O.slice(3,4).repeat(2),16),q=parseInt(O.slice(4,5).repeat(2),16),W.toColor(M,G,K,q);case 7:return{css:O,rgba:(parseInt(O.slice(1),16)<<8|255)>>>0};case 9:return{css:O,rgba:parseInt(O.slice(1),16)>>>0}}let A=O.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(A)return M=parseInt(A[1]),G=parseInt(A[2]),K=parseInt(A[3]),q=Math.round(255*(A[5]===void 0?1:parseFloat(A[5]))),W.toColor(M,G,K,q);if(!F||!N)throw new Error("css.toColor: Unsupported css format");if(F.fillStyle=N,F.fillStyle=O,typeof F.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(F.fillRect(0,0,1,1),[M,G,K,q]=F.getImageData(0,0,1,1).data,q!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:W.toRgba(M,G,K,q),css:O}}}(U||(H.css=U={})),function(L){function F(N,O,A){let I=N/255,w=O/255,Z=A/255;return 0.2126*(I<=0.03928?I/12.92:Math.pow((I+0.055)/1.055,2.4))+0.7152*(w<=0.03928?w/12.92:Math.pow((w+0.055)/1.055,2.4))+0.0722*(Z<=0.03928?Z/12.92:Math.pow((Z+0.055)/1.055,2.4))}L.relativeLuminance=function(N){return F(N>>16&255,N>>8&255,255&N)},L.relativeLuminance2=F}(R||(H.rgb=R={})),function(L){function F(O,A,I){let w=O>>24&255,Z=O>>16&255,k=O>>8&255,x=A>>24&255,T=A>>16&255,g=A>>8&255,Q$=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));for(;Q$<I&&(x>0||T>0||g>0);)x-=Math.max(0,Math.ceil(0.1*x)),T-=Math.max(0,Math.ceil(0.1*T)),g-=Math.max(0,Math.ceil(0.1*g)),Q$=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));return(x<<24|T<<16|g<<8|255)>>>0}function N(O,A,I){let w=O>>24&255,Z=O>>16&255,k=O>>8&255,x=A>>24&255,T=A>>16&255,g=A>>8&255,Q$=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));for(;Q$<I&&(x<255||T<255||g<255);)x=Math.min(255,x+Math.ceil(0.1*(255-x))),T=Math.min(255,T+Math.ceil(0.1*(255-T))),g=Math.min(255,g+Math.ceil(0.1*(255-g))),Q$=V(R.relativeLuminance2(x,T,g),R.relativeLuminance2(w,Z,k));return(x<<24|T<<16|g<<8|255)>>>0}L.blend=function(O,A){if(q=(255&A)/255,q===1)return A;let I=A>>24&255,w=A>>16&255,Z=A>>8&255,k=O>>24&255,x=O>>16&255,T=O>>8&255;return M=k+Math.round((I-k)*q),G=x+Math.round((w-x)*q),K=T+Math.round((Z-T)*q),W.toRgba(M,G,K)},L.ensureContrastRatio=function(O,A,I){let w=R.relativeLuminance(O>>8),Z=R.relativeLuminance(A>>8);if(V(w,Z)<I){if(Z<w){let T=F(O,A,I),g=V(w,R.relativeLuminance(T>>8));if(g<I){let Q$=N(O,A,I);return g>V(w,R.relativeLuminance(Q$>>8))?T:Q$}return T}let k=N(O,A,I),x=V(w,R.relativeLuminance(k>>8));if(x<I){let T=F(O,A,I);return x>V(w,R.relativeLuminance(T>>8))?k:T}return k}},L.reduceLuminance=F,L.increaseLuminance=N,L.toChannels=function(O){return[O>>24&255,O>>16&255,O>>8&255,255&O]}}(D||(H.rgba=D={})),H.toPaddedHex=j,H.contrastRatio=V},345:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.runAndSubscribe=H.forwardEvent=H.EventEmitter=void 0,H.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(M)=>(this._listeners.push(M),{dispose:()=>{if(!this._disposed){for(let G=0;G<this._listeners.length;G++)if(this._listeners[G]===M)return void this._listeners.splice(G,1)}}})),this._event}fire(M,G){let K=[];for(let q=0;q<this._listeners.length;q++)K.push(this._listeners[q]);for(let q=0;q<K.length;q++)K[q].call(void 0,M,G)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},H.forwardEvent=function(M,G){return M((K)=>G.fire(K))},H.runAndSubscribe=function(M,G){return G(void 0),M((K)=>G(K))}},859:(Y,H)=>{function M(G){for(let K of G)K.dispose();G.length=0}Object.defineProperty(H,"__esModule",{value:!0}),H.getDisposeArrayDisposable=H.disposeArray=H.toDisposable=H.MutableDisposable=H.Disposable=void 0,H.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let G of this._disposables)G.dispose();this._disposables.length=0}register(G){return this._disposables.push(G),G}unregister(G){let K=this._disposables.indexOf(G);K!==-1&&this._disposables.splice(K,1)}},H.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(G){this._isDisposed||G===this._value||(this._value?.dispose(),this._value=G)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},H.toDisposable=function(G){return{dispose:G}},H.disposeArray=M,H.getDisposeArrayDisposable=function(G){return{dispose:()=>M(G)}}},485:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.FourKeyMap=H.TwoKeyMap=void 0;class M{constructor(){this._data={}}set(G,K,q){this._data[G]||(this._data[G]={}),this._data[G][K]=q}get(G,K){return this._data[G]?this._data[G][K]:void 0}clear(){this._data={}}}H.TwoKeyMap=M,H.FourKeyMap=class{constructor(){this._data=new M}set(G,K,q,W,B){this._data.get(G,K)||this._data.set(G,K,new M),this._data.get(G,K).set(q,W,B)}get(G,K,q,W){return this._data.get(G,K)?.get(q,W)}clear(){this._data.clear()}}},726:(Y,H)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.createDecorator=H.getServiceDependencies=H.serviceRegistry=void 0;let M="di$target",G="di$dependencies";H.serviceRegistry=new Map,H.getServiceDependencies=function(K){return K[G]||[]},H.createDecorator=function(K){if(H.serviceRegistry.has(K))return H.serviceRegistry.get(K);let q=function(W,B,U){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(R,D,j){D[M]===D?D[G].push({id:R,index:j}):(D[G]=[{id:R,index:j}],D[M]=D)})(q,W,U)};return q.toString=()=>K,H.serviceRegistry.set(K,q),q}},97:(Y,H,M)=>{Object.defineProperty(H,"__esModule",{value:!0}),H.IDecorationService=H.IUnicodeService=H.IOscLinkService=H.IOptionsService=H.ILogService=H.LogLevelEnum=H.IInstantiationService=H.ICharsetService=H.ICoreService=H.ICoreMouseService=H.IBufferService=void 0;let G=M(726);var K;H.IBufferService=G.createDecorator("BufferService"),H.ICoreMouseService=G.createDecorator("CoreMouseService"),H.ICoreService=G.createDecorator("CoreService"),H.ICharsetService=G.createDecorator("CharsetService"),H.IInstantiationService=G.createDecorator("InstantiationService"),function(q){q[q.TRACE=0]="TRACE",q[q.DEBUG=1]="DEBUG",q[q.INFO=2]="INFO",q[q.WARN=3]="WARN",q[q.ERROR=4]="ERROR",q[q.OFF=5]="OFF"}(K||(H.LogLevelEnum=K={})),H.ILogService=G.createDecorator("LogService"),H.IOptionsService=G.createDecorator("OptionsService"),H.IOscLinkService=G.createDecorator("OscLinkService"),H.IUnicodeService=G.createDecorator("UnicodeService"),H.IDecorationService=G.createDecorator("DecorationService")}},J={};function Q(Y){var H=J[Y];if(H!==void 0)return H.exports;var M=J[Y]={exports:{}};return $[Y].call(M.exports,M,M.exports,Q),M.exports}var X={};return(()=>{var Y=X;Object.defineProperty(Y,"__esModule",{value:!0}),Y.HTMLSerializeHandler=Y.SerializeAddon=void 0;let H=Q(997);function M(R,D,j){return Math.max(D,Math.min(R,j))}class G{constructor(R){this._buffer=R}serialize(R,D){let j=this._buffer.getNullCell(),V=this._buffer.getNullCell(),L=j,F=R.start.y,N=R.end.y,O=R.start.x,A=R.end.x;this._beforeSerialize(N-F,F,N);for(let I=F;I<=N;I++){let w=this._buffer.getLine(I);if(w){let Z=I===R.start.y?O:0,k=I===R.end.y?A:w.length;for(let x=Z;x<k;x++){let T=w.getCell(x,L===j?V:j);T?(this._nextCell(T,L,I,x),L=T):console.warn(`Can't get cell at row=${I}, col=${x}`)}}this._rowEnd(I,I===N)}return this._afterSerialize(),this._serializeString(D)}_nextCell(R,D,j,V){}_rowEnd(R,D){}_beforeSerialize(R,D,j){}_afterSerialize(){}_serializeString(R){return""}}function K(R,D){return R.getFgColorMode()===D.getFgColorMode()&&R.getFgColor()===D.getFgColor()}function q(R,D){return R.getBgColorMode()===D.getBgColorMode()&&R.getBgColor()===D.getBgColor()}function W(R,D){return R.isInverse()===D.isInverse()&&R.isBold()===D.isBold()&&R.isUnderline()===D.isUnderline()&&R.isOverline()===D.isOverline()&&R.isBlink()===D.isBlink()&&R.isInvisible()===D.isInvisible()&&R.isItalic()===D.isItalic()&&R.isDim()===D.isDim()&&R.isStrikethrough()===D.isStrikethrough()}class B extends G{constructor(R,D){super(R),this._terminal=D,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(R,D,j){this._allRows=new Array(R),this._lastContentCursorRow=D,this._lastCursorRow=D,this._firstRow=D}_rowEnd(R,D){this._nullCellCount>0&&!q(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let j="";if(!D){R-this._firstRow>=this._terminal.rows&&this._buffer.getLine(this._cursorStyleRow)?.getCell(this._cursorStyleCol,this._backgroundCell);let V=this._buffer.getLine(R),L=this._buffer.getLine(R+1);if(L.isWrapped){j="";let F=V.getCell(V.length-1,this._thisRowLastChar),N=V.getCell(V.length-2,this._thisRowLastSecondChar),O=L.getCell(0,this._nextRowFirstChar),A=O.getWidth()>1,I=!1;(O.getChars()&&A?this._nullCellCount<=1:this._nullCellCount<=0)&&((F.getChars()||F.getWidth()===0)&&q(F,O)&&(I=!0),A&&(N.getChars()||N.getWidth()===0)&&q(F,O)&&q(N,O)&&(I=!0)),I||(j="-".repeat(this._nullCellCount+1),j+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(j+="\x1B[A",j+=`\x1B[${V.length-this._nullCellCount}C`,j+=`\x1B[${this._nullCellCount}X`,j+=`\x1B[${V.length-this._nullCellCount}D`,j+="\x1B[B"),this._lastContentCursorRow=R+1,this._lastContentCursorCol=0,this._lastCursorRow=R+1,this._lastCursorCol=0)}else j=`\r
41
+ `,this._lastCursorRow=R+1,this._lastCursorCol=0}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=j,this._currentRow="",this._nullCellCount=0}_diffStyle(R,D){let j=[],V=!K(R,D),L=!q(R,D),F=!W(R,D);if(V||L||F)if(R.isAttributeDefault())D.isAttributeDefault()||j.push(0);else{if(V){let N=R.getFgColor();R.isFgRGB()?j.push(38,2,N>>>16&255,N>>>8&255,255&N):R.isFgPalette()?N>=16?j.push(38,5,N):j.push(8&N?90+(7&N):30+(7&N)):j.push(39)}if(L){let N=R.getBgColor();R.isBgRGB()?j.push(48,2,N>>>16&255,N>>>8&255,255&N):R.isBgPalette()?N>=16?j.push(48,5,N):j.push(8&N?100+(7&N):40+(7&N)):j.push(49)}F&&(R.isInverse()!==D.isInverse()&&j.push(R.isInverse()?7:27),R.isBold()!==D.isBold()&&j.push(R.isBold()?1:22),R.isUnderline()!==D.isUnderline()&&j.push(R.isUnderline()?4:24),R.isOverline()!==D.isOverline()&&j.push(R.isOverline()?53:55),R.isBlink()!==D.isBlink()&&j.push(R.isBlink()?5:25),R.isInvisible()!==D.isInvisible()&&j.push(R.isInvisible()?8:28),R.isItalic()!==D.isItalic()&&j.push(R.isItalic()?3:23),R.isDim()!==D.isDim()&&j.push(R.isDim()?2:22),R.isStrikethrough()!==D.isStrikethrough()&&j.push(R.isStrikethrough()?9:29))}return j}_nextCell(R,D,j,V){if(R.getWidth()===0)return;let L=R.getChars()==="",F=this._diffStyle(R,this._cursorStyle);if(L?!q(this._cursorStyle,R):F.length>0){this._nullCellCount>0&&(q(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=j,this._lastContentCursorCol=this._lastCursorCol=V,this._currentRow+=`\x1B[${F.join(";")}m`;let N=this._buffer.getLine(j);N!==void 0&&(N.getCell(V,this._cursorStyle),this._cursorStyleRow=j,this._cursorStyleCol=V)}L?this._nullCellCount+=R.getWidth():(this._nullCellCount>0&&(q(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._currentRow+=R.getChars(),this._lastContentCursorRow=this._lastCursorRow=j,this._lastContentCursorCol=this._lastCursorCol=V+R.getWidth())}_serializeString(R){let D=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(D=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let j="";for(let N=0;N<D;N++)j+=this._allRows[N],N+1<D&&(j+=this._allRowSeparators[N]);if(!R){let N=this._buffer.baseY+this._buffer.cursorY,O=this._buffer.cursorX,A=(I)=>{I>0?j+=`\x1B[${I}C`:I<0&&(j+=`\x1B[${-I}D`)};(N!==this._lastCursorRow||O!==this._lastCursorCol)&&((V=N-this._lastCursorRow)>0?j+=`\x1B[${V}B`:V<0&&(j+=`\x1B[${-V}A`),A(O-this._lastCursorCol))}var V;let L=this._terminal._core._inputHandler._curAttrData,F=this._diffStyle(L,this._cursorStyle);return F.length>0&&(j+=`\x1B[${F.join(";")}m`),j}}Y.SerializeAddon=class{activate(R){this._terminal=R}_serializeBufferByScrollback(R,D,j){let V=D.length,L=j===void 0?V:M(j+R.rows,0,V);return this._serializeBufferByRange(R,D,{start:V-L,end:V-1},!1)}_serializeBufferByRange(R,D,j,V){return new B(D,R).serialize({start:{x:0,y:typeof j.start=="number"?j.start:j.start.line},end:{x:R.cols,y:typeof j.end=="number"?j.end:j.end.line}},V)}_serializeBufferAsHTML(R,D){let j=R.buffer.active,V=new U(j,R,D);if(!D.onlySelection){let F=j.length,N=D.scrollback,O=N===void 0?F:M(N+R.rows,0,F);return V.serialize({start:{x:0,y:F-O},end:{x:R.cols,y:F-1}})}let L=this._terminal?.getSelectionPosition();return L!==void 0?V.serialize({start:{x:L.start.x,y:L.start.y},end:{x:L.end.x,y:L.end.y}}):""}_serializeModes(R){let D="",j=R.modes;if(j.applicationCursorKeysMode&&(D+="\x1B[?1h"),j.applicationKeypadMode&&(D+="\x1B[?66h"),j.bracketedPasteMode&&(D+="\x1B[?2004h"),j.insertMode&&(D+="\x1B[4h"),j.originMode&&(D+="\x1B[?6h"),j.reverseWraparoundMode&&(D+="\x1B[?45h"),j.sendFocusMode&&(D+="\x1B[?1004h"),j.wraparoundMode===!1&&(D+="\x1B[?7l"),j.mouseTrackingMode!=="none")switch(j.mouseTrackingMode){case"x10":D+="\x1B[?9h";break;case"vt200":D+="\x1B[?1000h";break;case"drag":D+="\x1B[?1002h";break;case"any":D+="\x1B[?1003h"}return D}serialize(R){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let D=R?.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,R.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,R?.scrollback);return R?.excludeAltBuffer||this._terminal.buffer.active.type!=="alternate"||(D+=`\x1B[?1049h\x1B[H${this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0)}`),R?.excludeModes||(D+=this._serializeModes(this._terminal)),D}serializeAsHTML(R){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,R||{})}dispose(){}};class U extends G{constructor(R,D,j){super(R),this._terminal=D,this._options=j,this._currentRow="",this._htmlContent="",D._core._themeService?this._ansiColors=D._core._themeService.colors.ansi:this._ansiColors=H.DEFAULT_ANSI_COLORS}_padStart(R,D,j){return D>>=0,j=j??" ",R.length>D?R:((D-=R.length)>j.length&&(j+=j.repeat(D/j.length)),j.slice(0,D)+R)}_beforeSerialize(R,D,j){this._htmlContent+="<html><body><!--StartFragment--><pre>";let V="#000000",L="#ffffff";this._options.includeGlobalBackground&&(V=this._terminal.options.theme?.foreground??"#ffffff",L=this._terminal.options.theme?.background??"#000000");let F=[];F.push("color: "+V+";"),F.push("background-color: "+L+";"),F.push("font-family: "+this._terminal.options.fontFamily+";"),F.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+F.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(R,D){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(R,D){let j=D?R.getFgColor():R.getBgColor();return(D?R.isFgRGB():R.isBgRGB())?"#"+[j>>16&255,j>>8&255,255&j].map((V)=>this._padStart(V.toString(16),2,"0")).join(""):(D?R.isFgPalette():R.isBgPalette())?this._ansiColors[j].css:void 0}_diffStyle(R,D){let j=[],V=!K(R,D),L=!q(R,D),F=!W(R,D);if(V||L||F){let N=this._getHexColor(R,!0);N&&j.push("color: "+N+";");let O=this._getHexColor(R,!1);return O&&j.push("background-color: "+O+";"),R.isInverse()&&j.push("color: #000000; background-color: #BFBFBF;"),R.isBold()&&j.push("font-weight: bold;"),R.isUnderline()&&R.isOverline()?j.push("text-decoration: overline underline;"):R.isUnderline()?j.push("text-decoration: underline;"):R.isOverline()&&j.push("text-decoration: overline;"),R.isBlink()&&j.push("text-decoration: blink;"),R.isInvisible()&&j.push("visibility: hidden;"),R.isItalic()&&j.push("font-style: italic;"),R.isDim()&&j.push("opacity: 0.5;"),R.isStrikethrough()&&j.push("text-decoration: line-through;"),j}}_nextCell(R,D,j,V){if(R.getWidth()===0)return;let L=R.getChars()==="",F=this._diffStyle(R,D);F&&(this._currentRow+=F.length===0?"</span><span>":"</span><span style='"+F.join(" ")+"'>"),this._currentRow+=L?" ":R.getChars()}_serializeString(){return this._htmlContent}}Y.HTMLSerializeHandler=U})(),X})())});var UQ=n((NQ)=>{(()=>{var $={349:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.CircularList=void 0;let q=K(460),W=K(844);class B extends W.Disposable{constructor(U){super(),this._maxLength=U,this.onDeleteEmitter=this.register(new q.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new q.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new q.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(U){if(this._maxLength===U)return;let R=new Array(U);for(let D=0;D<Math.min(U,this.length);D++)R[D]=this._array[this._getCyclicIndex(D)];this._array=R,this._maxLength=U,this._startIndex=0}get length(){return this._length}set length(U){if(U>this._length)for(let R=this._length;R<U;R++)this._array[R]=void 0;this._length=U}get(U){return this._array[this._getCyclicIndex(U)]}set(U,R){this._array[this._getCyclicIndex(U)]=R}push(U){this._array[this._getCyclicIndex(this._length)]=U,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(U,R,...D){if(R){for(let j=U;j<this._length-R;j++)this._array[this._getCyclicIndex(j)]=this._array[this._getCyclicIndex(j+R)];this._length-=R,this.onDeleteEmitter.fire({index:U,amount:R})}for(let j=this._length-1;j>=U;j--)this._array[this._getCyclicIndex(j+D.length)]=this._array[this._getCyclicIndex(j)];for(let j=0;j<D.length;j++)this._array[this._getCyclicIndex(U+j)]=D[j];if(D.length&&this.onInsertEmitter.fire({index:U,amount:D.length}),this._length+D.length>this._maxLength){let j=this._length+D.length-this._maxLength;this._startIndex+=j,this._length=this._maxLength,this.onTrimEmitter.fire(j)}else this._length+=D.length}trimStart(U){U>this._length&&(U=this._length),this._startIndex+=U,this._length-=U,this.onTrimEmitter.fire(U)}shiftElements(U,R,D){if(!(R<=0)){if(U<0||U>=this._length)throw new Error("start argument out of range");if(U+D<0)throw new Error("Cannot shift elements in list beyond index 0");if(D>0){for(let V=R-1;V>=0;V--)this.set(U+V+D,this.get(U+V));let j=U+R+D-this._length;if(j>0)for(this._length+=j;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let j=0;j<R;j++)this.set(U+j+D,this.get(U+j))}}_getCyclicIndex(U){return(this._startIndex+U)%this._maxLength}}G.CircularList=B},439:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.clone=void 0,G.clone=function K(q,W=5){if(typeof q!="object")return q;let B=Array.isArray(q)?[]:{};for(let U in q)B[U]=W<=1?q[U]:q[U]&&K(q[U],W-1);return B}},969:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.CoreTerminal=void 0;let q=K(844),W=K(585),B=K(348),U=K(866),R=K(744),D=K(302),j=K(83),V=K(460),L=K(753),F=K(480),N=K(994),O=K(282),A=K(435),I=K(981),w=K(660),Z=!1;class k extends q.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new V.EventEmitter),this._onScroll.event((x)=>{this._onScrollApi?.fire(x.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(x){for(let T in x)this.optionsService.options[T]=x[T]}constructor(x){super(),this._windowsWrappingHeuristics=this.register(new q.MutableDisposable),this._onBinary=this.register(new V.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new V.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new V.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new V.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new V.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new V.EventEmitter),this._instantiationService=new B.InstantiationService,this.optionsService=this.register(new D.OptionsService(x)),this._instantiationService.setService(W.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(R.BufferService)),this._instantiationService.setService(W.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(U.LogService)),this._instantiationService.setService(W.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(j.CoreService)),this._instantiationService.setService(W.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(L.CoreMouseService)),this._instantiationService.setService(W.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(F.UnicodeService)),this._instantiationService.setService(W.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(N.CharsetService),this._instantiationService.setService(W.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(w.OscLinkService),this._instantiationService.setService(W.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new A.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register(V.forwardEvent(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register(V.forwardEvent(this._bufferService.onResize,this._onResize)),this.register(V.forwardEvent(this.coreService.onData,this._onData)),this.register(V.forwardEvent(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll((T)=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll((T)=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new I.WriteBuffer((T,g)=>this._inputHandler.parse(T,g))),this.register(V.forwardEvent(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(x,T){this._writeBuffer.write(x,T)}writeSync(x,T){this._logService.logLevel<=W.LogLevelEnum.WARN&&!Z&&(this._logService.warn("writeSync is unreliable and will be removed soon."),Z=!0),this._writeBuffer.writeSync(x,T)}input(x,T=!0){this.coreService.triggerDataEvent(x,T)}resize(x,T){isNaN(x)||isNaN(T)||(x=Math.max(x,R.MINIMUM_COLS),T=Math.max(T,R.MINIMUM_ROWS),this._bufferService.resize(x,T))}scroll(x,T=!1){this._bufferService.scroll(x,T)}scrollLines(x,T,g){this._bufferService.scrollLines(x,T,g)}scrollPages(x){this.scrollLines(x*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(x){let T=x-this._bufferService.buffer.ydisp;T!==0&&this.scrollLines(T)}registerEscHandler(x,T){return this._inputHandler.registerEscHandler(x,T)}registerDcsHandler(x,T){return this._inputHandler.registerDcsHandler(x,T)}registerCsiHandler(x,T){return this._inputHandler.registerCsiHandler(x,T)}registerOscHandler(x,T){return this._inputHandler.registerOscHandler(x,T)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let x=!1,T=this.optionsService.rawOptions.windowsPty;T&&T.buildNumber!==void 0&&T.buildNumber!==void 0?x=T.backend==="conpty"&&T.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(x=!0),x?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){let x=[];x.push(this.onLineFeed(O.updateWindowsModeWrappedState.bind(null,this._bufferService))),x.push(this.registerCsiHandler({final:"H"},()=>(O.updateWindowsModeWrappedState(this._bufferService),!1))),this._windowsWrappingHeuristics.value=q.toDisposable(()=>{for(let T of x)T.dispose()})}}}G.CoreTerminal=k},460:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.runAndSubscribe=G.forwardEvent=G.EventEmitter=void 0,G.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=(K)=>{return this._listeners.push(K),{dispose:()=>{if(!this._disposed){for(let W=0;W<this._listeners.length;W++)if(this._listeners[W]===K)return void this._listeners.splice(W,1)}}}}),this._event}fire(K,q){let W=[];for(let B=0;B<this._listeners.length;B++)W.push(this._listeners[B]);for(let B=0;B<W.length;B++)W[B].call(void 0,K,q)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},G.forwardEvent=function(K,q){return K((W)=>q.fire(W))},G.runAndSubscribe=function(K,q){return q(void 0),K((W)=>q(W))}},435:function(M,G,K){var q=this&&this.__decorate||function(E,S,C,_){var b,c=arguments.length,a=c<3?S:_===null?_=Object.getOwnPropertyDescriptor(S,C):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(E,S,C,_);else for(var e=E.length-1;e>=0;e--)(b=E[e])&&(a=(c<3?b(a):c>3?b(S,C,a):b(S,C))||a);return c>3&&a&&Object.defineProperty(S,C,a),a},W=this&&this.__param||function(E,S){return function(C,_){S(C,_,E)}};Object.defineProperty(G,"__esModule",{value:!0}),G.InputHandler=G.WindowsOptionsReportType=void 0;let B=K(584),U=K(116),R=K(15),D=K(844),j=K(482),V=K(437),L=K(460),F=K(643),N=K(511),O=K(734),A=K(585),I=K(480),w=K(242),Z=K(351),k=K(941),x={"(":0,")":1,"*":2,"+":3,"-":1,".":2},T=131072;function g(E,S){if(E>24)return S.setWinLines||!1;switch(E){case 1:return!!S.restoreWin;case 2:return!!S.minimizeWin;case 3:return!!S.setWinPosition;case 4:return!!S.setWinSizePixels;case 5:return!!S.raiseWin;case 6:return!!S.lowerWin;case 7:return!!S.refreshWin;case 8:return!!S.setWinSizeChars;case 9:return!!S.maximizeWin;case 10:return!!S.fullscreenWin;case 11:return!!S.getWinState;case 13:return!!S.getWinPosition;case 14:return!!S.getWinSizePixels;case 15:return!!S.getScreenSizePixels;case 16:return!!S.getCellSizePixels;case 18:return!!S.getWinSizeChars;case 19:return!!S.getScreenSizeChars;case 20:return!!S.getIconTitle;case 21:return!!S.getWinTitle;case 22:return!!S.pushTitle;case 23:return!!S.popTitle;case 24:return!!S.setWinLines}return!1}var Q$;(function(E){E[E.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",E[E.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(Q$||(G.WindowsOptionsReportType=Q$={}));let k$=0;class N$ extends D.Disposable{getAttrData(){return this._curAttrData}constructor(E,S,C,_,b,c,a,e,M$=new R.EscapeSequenceParser){super(),this._bufferService=E,this._charsetService=S,this._coreService=C,this._logService=_,this._optionsService=b,this._oscLinkService=c,this._coreMouseService=a,this._unicodeService=e,this._parser=M$,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new j.StringToUtf32,this._utf8Decoder=new j.Utf8ToUtf32,this._workCell=new N.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=V.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=V.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new L.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new L.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new L.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new L.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new L.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new L.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new L.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new L.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new L.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new L.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new L.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new L.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new L.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new t(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((P)=>this._activeBuffer=P.activeBuffer)),this._parser.setCsiHandlerFallback((P,$$)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(P),params:$$.toArray()})}),this._parser.setEscHandlerFallback((P)=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(P)})}),this._parser.setExecuteHandlerFallback((P)=>{this._logService.debug("Unknown EXECUTE code: ",{code:P})}),this._parser.setOscHandlerFallback((P,$$,u)=>{this._logService.debug("Unknown OSC code: ",{identifier:P,action:$$,data:u})}),this._parser.setDcsHandlerFallback((P,$$,u)=>{$$==="HOOK"&&(u=u.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(P),action:$$,payload:u})}),this._parser.setPrintHandler((P,$$,u)=>this.print(P,$$,u)),this._parser.registerCsiHandler({final:"@"},(P)=>this.insertChars(P)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(P)=>this.scrollLeft(P)),this._parser.registerCsiHandler({final:"A"},(P)=>this.cursorUp(P)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(P)=>this.scrollRight(P)),this._parser.registerCsiHandler({final:"B"},(P)=>this.cursorDown(P)),this._parser.registerCsiHandler({final:"C"},(P)=>this.cursorForward(P)),this._parser.registerCsiHandler({final:"D"},(P)=>this.cursorBackward(P)),this._parser.registerCsiHandler({final:"E"},(P)=>this.cursorNextLine(P)),this._parser.registerCsiHandler({final:"F"},(P)=>this.cursorPrecedingLine(P)),this._parser.registerCsiHandler({final:"G"},(P)=>this.cursorCharAbsolute(P)),this._parser.registerCsiHandler({final:"H"},(P)=>this.cursorPosition(P)),this._parser.registerCsiHandler({final:"I"},(P)=>this.cursorForwardTab(P)),this._parser.registerCsiHandler({final:"J"},(P)=>this.eraseInDisplay(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},(P)=>this.eraseInDisplay(P,!0)),this._parser.registerCsiHandler({final:"K"},(P)=>this.eraseInLine(P,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},(P)=>this.eraseInLine(P,!0)),this._parser.registerCsiHandler({final:"L"},(P)=>this.insertLines(P)),this._parser.registerCsiHandler({final:"M"},(P)=>this.deleteLines(P)),this._parser.registerCsiHandler({final:"P"},(P)=>this.deleteChars(P)),this._parser.registerCsiHandler({final:"S"},(P)=>this.scrollUp(P)),this._parser.registerCsiHandler({final:"T"},(P)=>this.scrollDown(P)),this._parser.registerCsiHandler({final:"X"},(P)=>this.eraseChars(P)),this._parser.registerCsiHandler({final:"Z"},(P)=>this.cursorBackwardTab(P)),this._parser.registerCsiHandler({final:"`"},(P)=>this.charPosAbsolute(P)),this._parser.registerCsiHandler({final:"a"},(P)=>this.hPositionRelative(P)),this._parser.registerCsiHandler({final:"b"},(P)=>this.repeatPrecedingCharacter(P)),this._parser.registerCsiHandler({final:"c"},(P)=>this.sendDeviceAttributesPrimary(P)),this._parser.registerCsiHandler({prefix:">",final:"c"},(P)=>this.sendDeviceAttributesSecondary(P)),this._parser.registerCsiHandler({final:"d"},(P)=>this.linePosAbsolute(P)),this._parser.registerCsiHandler({final:"e"},(P)=>this.vPositionRelative(P)),this._parser.registerCsiHandler({final:"f"},(P)=>this.hVPosition(P)),this._parser.registerCsiHandler({final:"g"},(P)=>this.tabClear(P)),this._parser.registerCsiHandler({final:"h"},(P)=>this.setMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"h"},(P)=>this.setModePrivate(P)),this._parser.registerCsiHandler({final:"l"},(P)=>this.resetMode(P)),this._parser.registerCsiHandler({prefix:"?",final:"l"},(P)=>this.resetModePrivate(P)),this._parser.registerCsiHandler({final:"m"},(P)=>this.charAttributes(P)),this._parser.registerCsiHandler({final:"n"},(P)=>this.deviceStatus(P)),this._parser.registerCsiHandler({prefix:"?",final:"n"},(P)=>this.deviceStatusPrivate(P)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(P)=>this.softReset(P)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(P)=>this.setCursorStyle(P)),this._parser.registerCsiHandler({final:"r"},(P)=>this.setScrollRegion(P)),this._parser.registerCsiHandler({final:"s"},(P)=>this.saveCursor(P)),this._parser.registerCsiHandler({final:"t"},(P)=>this.windowOptions(P)),this._parser.registerCsiHandler({final:"u"},(P)=>this.restoreCursor(P)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(P)=>this.insertColumns(P)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(P)=>this.deleteColumns(P)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(P)=>this.selectProtected(P)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(P)=>this.requestMode(P,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(P)=>this.requestMode(P,!1)),this._parser.setExecuteHandler(B.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(B.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(B.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(B.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(B.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(B.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(B.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(B.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(B.C1.IND,()=>this.index()),this._parser.setExecuteHandler(B.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(B.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new w.OscHandler((P)=>(this.setTitle(P),this.setIconName(P),!0))),this._parser.registerOscHandler(1,new w.OscHandler((P)=>this.setIconName(P))),this._parser.registerOscHandler(2,new w.OscHandler((P)=>this.setTitle(P))),this._parser.registerOscHandler(4,new w.OscHandler((P)=>this.setOrReportIndexedColor(P))),this._parser.registerOscHandler(8,new w.OscHandler((P)=>this.setHyperlink(P))),this._parser.registerOscHandler(10,new w.OscHandler((P)=>this.setOrReportFgColor(P))),this._parser.registerOscHandler(11,new w.OscHandler((P)=>this.setOrReportBgColor(P))),this._parser.registerOscHandler(12,new w.OscHandler((P)=>this.setOrReportCursorColor(P))),this._parser.registerOscHandler(104,new w.OscHandler((P)=>this.restoreIndexedColor(P))),this._parser.registerOscHandler(110,new w.OscHandler((P)=>this.restoreFgColor(P))),this._parser.registerOscHandler(111,new w.OscHandler((P)=>this.restoreBgColor(P))),this._parser.registerOscHandler(112,new w.OscHandler((P)=>this.restoreCursorColor(P))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(let P in U.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:P},()=>this.selectCharset("("+P)),this._parser.registerEscHandler({intermediates:")",final:P},()=>this.selectCharset(")"+P)),this._parser.registerEscHandler({intermediates:"*",final:P},()=>this.selectCharset("*"+P)),this._parser.registerEscHandler({intermediates:"+",final:P},()=>this.selectCharset("+"+P)),this._parser.registerEscHandler({intermediates:"-",final:P},()=>this.selectCharset("-"+P)),this._parser.registerEscHandler({intermediates:".",final:P},()=>this.selectCharset("."+P)),this._parser.registerEscHandler({intermediates:"/",final:P},()=>this.selectCharset("/"+P));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler((P)=>(this._logService.error("Parsing error: ",P),P)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new Z.DcsHandler((P,$$)=>this.requestStatusString(P,$$)))}_preserveStack(E,S,C,_){this._parseStack.paused=!0,this._parseStack.cursorStartX=E,this._parseStack.cursorStartY=S,this._parseStack.decodedLength=C,this._parseStack.position=_}_logSlowResolvingAsync(E){this._logService.logLevel<=A.LogLevelEnum.WARN&&Promise.race([E,new Promise((S,C)=>setTimeout(()=>C("#SLOW_TIMEOUT"),5000))]).catch((S)=>{if(S!=="#SLOW_TIMEOUT")throw S;console.warn("async parser handler taking longer than 5000 ms")})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(E,S){let C,_=this._activeBuffer.x,b=this._activeBuffer.y,c=0,a=this._parseStack.paused;if(a){if(C=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,S))return this._logSlowResolvingAsync(C),C;_=this._parseStack.cursorStartX,b=this._parseStack.cursorStartY,this._parseStack.paused=!1,E.length>T&&(c=this._parseStack.position+T)}if(this._logService.logLevel<=A.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof E=="string"?` "${E}"`:` "${Array.prototype.map.call(E,(P)=>String.fromCharCode(P)).join("")}"`),typeof E=="string"?E.split("").map((P)=>P.charCodeAt(0)):E),this._parseBuffer.length<E.length&&this._parseBuffer.length<T&&(this._parseBuffer=new Uint32Array(Math.min(E.length,T))),a||this._dirtyRowTracker.clearRange(),E.length>T)for(let P=c;P<E.length;P+=T){let $$=P+T<E.length?P+T:E.length,u=typeof E=="string"?this._stringDecoder.decode(E.substring(P,$$),this._parseBuffer):this._utf8Decoder.decode(E.subarray(P,$$),this._parseBuffer);if(C=this._parser.parse(this._parseBuffer,u))return this._preserveStack(_,b,u,P),this._logSlowResolvingAsync(C),C}else if(!a){let P=typeof E=="string"?this._stringDecoder.decode(E,this._parseBuffer):this._utf8Decoder.decode(E,this._parseBuffer);if(C=this._parser.parse(this._parseBuffer,P))return this._preserveStack(_,b,P,0),this._logSlowResolvingAsync(C),C}this._activeBuffer.x===_&&this._activeBuffer.y===b||this._onCursorMove.fire();let e=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),M$=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);M$<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(M$,this._bufferService.rows-1),Math.min(e,this._bufferService.rows-1))}print(E,S,C){let _,b,c=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,e=this._bufferService.cols,M$=this._coreService.decPrivateModes.wraparound,P=this._coreService.modes.insertMode,$$=this._curAttrData,u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&C-S>0&&u.getWidth(this._activeBuffer.x-1)===2&&u.setCellFromCodepoint(this._activeBuffer.x-1,0,1,$$);let s=this._parser.precedingJoinState;for(let p$=S;p$<C;++p$){if(_=E[p$],_<127&&c){let U1=c[String.fromCharCode(_)];U1&&(_=U1.charCodeAt(0))}let d$=this._unicodeService.charProperties(_,s);b=I.UnicodeService.extractWidth(d$);let B1=I.UnicodeService.extractShouldJoin(d$),N1=B1?I.UnicodeService.extractWidth(s):0;if(s=d$,a&&this._onA11yChar.fire(j.stringFromCodePoint(_)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+b-N1>e){if(M$){let U1=u,q0=this._activeBuffer.x-N1;for(this._activeBuffer.x=N1,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),u=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),N1>0&&u instanceof V.BufferLine&&u.copyCellsFrom(U1,q0,0,N1,!1);q0<e;)U1.setCellFromCodepoint(q0++,0,1,$$)}else if(this._activeBuffer.x=e-1,b===2)continue}if(B1&&this._activeBuffer.x){let U1=u.getWidth(this._activeBuffer.x-1)?1:2;u.addCodepointToCell(this._activeBuffer.x-U1,_,b);for(let q0=b-N1;--q0>=0;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,$$)}else if(P&&(u.insertCells(this._activeBuffer.x,b-N1,this._activeBuffer.getNullCell($$)),u.getWidth(e-1)===2&&u.setCellFromCodepoint(e-1,F.NULL_CELL_CODE,F.NULL_CELL_WIDTH,$$)),u.setCellFromCodepoint(this._activeBuffer.x++,_,b,$$),b>0)for(;--b;)u.setCellFromCodepoint(this._activeBuffer.x++,0,0,$$)}this._parser.precedingJoinState=s,this._activeBuffer.x<e&&C-S>0&&u.getWidth(this._activeBuffer.x)===0&&!u.hasContent(this._activeBuffer.x)&&u.setCellFromCodepoint(this._activeBuffer.x,0,1,$$),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(E,S){return E.final!=="t"||E.prefix||E.intermediates?this._parser.registerCsiHandler(E,S):this._parser.registerCsiHandler(E,(C)=>!g(C.params[0],this._optionsService.rawOptions.windowOptions)||S(C))}registerDcsHandler(E,S){return this._parser.registerDcsHandler(E,new Z.DcsHandler(S))}registerEscHandler(E,S){return this._parser.registerEscHandler(E,S)}registerOscHandler(E,S){return this._parser.registerOscHandler(E,new w.OscHandler(S))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let E=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);E.hasWidth(this._activeBuffer.x)&&!E.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let E=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-E),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(E=this._bufferService.cols-1){this._activeBuffer.x=Math.min(E,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(E,S){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=E,this._activeBuffer.y=this._activeBuffer.scrollTop+S):(this._activeBuffer.x=E,this._activeBuffer.y=S),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(E,S){this._restrictCursor(),this._setCursor(this._activeBuffer.x+E,this._activeBuffer.y+S)}cursorUp(E){let S=this._activeBuffer.y-this._activeBuffer.scrollTop;return S>=0?this._moveCursor(0,-Math.min(S,E.params[0]||1)):this._moveCursor(0,-(E.params[0]||1)),!0}cursorDown(E){let S=this._activeBuffer.scrollBottom-this._activeBuffer.y;return S>=0?this._moveCursor(0,Math.min(S,E.params[0]||1)):this._moveCursor(0,E.params[0]||1),!0}cursorForward(E){return this._moveCursor(E.params[0]||1,0),!0}cursorBackward(E){return this._moveCursor(-(E.params[0]||1),0),!0}cursorNextLine(E){return this.cursorDown(E),this._activeBuffer.x=0,!0}cursorPrecedingLine(E){return this.cursorUp(E),this._activeBuffer.x=0,!0}cursorCharAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(E){return this._setCursor(E.length>=2?(E.params[1]||1)-1:0,(E.params[0]||1)-1),!0}charPosAbsolute(E){return this._setCursor((E.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(E){return this._moveCursor(E.params[0]||1,0),!0}linePosAbsolute(E){return this._setCursor(this._activeBuffer.x,(E.params[0]||1)-1),!0}vPositionRelative(E){return this._moveCursor(0,E.params[0]||1),!0}hVPosition(E){return this.cursorPosition(E),!0}tabClear(E){let S=E.params[0];return S===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:S===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=E.params[0]||1;for(;S--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(E){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=E.params[0]||1;for(;S--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(E){let S=E.params[0];return S===1&&(this._curAttrData.bg|=536870912),S!==2&&S!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(E,S,C,_=!1,b=!1){let c=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);c.replaceCells(S,C,this._activeBuffer.getNullCell(this._eraseAttrData()),b),_&&(c.isWrapped=!1)}_resetBufferLine(E,S=!1){let C=this._activeBuffer.lines.get(this._activeBuffer.ybase+E);C&&(C.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),S),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+E),C.isWrapped=!1)}eraseInDisplay(E,S=!1){let C;switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:for(C=this._activeBuffer.y,this._dirtyRowTracker.markDirty(C),this._eraseInBufferLine(C++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,S);C<this._bufferService.rows;C++)this._resetBufferLine(C,S);this._dirtyRowTracker.markDirty(C);break;case 1:for(C=this._activeBuffer.y,this._dirtyRowTracker.markDirty(C),this._eraseInBufferLine(C,0,this._activeBuffer.x+1,!0,S),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(C+1).isWrapped=!1);C--;)this._resetBufferLine(C,S);this._dirtyRowTracker.markDirty(0);break;case 2:for(C=this._bufferService.rows,this._dirtyRowTracker.markDirty(C-1);C--;)this._resetBufferLine(C,S);this._dirtyRowTracker.markDirty(0);break;case 3:let _=this._activeBuffer.lines.length-this._bufferService.rows;_>0&&(this._activeBuffer.lines.trimStart(_),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-_,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-_,0),this._onScroll.fire(0))}return!0}eraseInLine(E,S=!1){switch(this._restrictCursor(this._bufferService.cols),E.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,S);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,S);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,S)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(E){this._restrictCursor();let S=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=this._activeBuffer.ybase+this._activeBuffer.y,_=this._bufferService.rows-1-this._activeBuffer.scrollBottom,b=this._bufferService.rows-1+this._activeBuffer.ybase-_+1;for(;S--;)this._activeBuffer.lines.splice(b-1,1),this._activeBuffer.lines.splice(C,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(E){this._restrictCursor();let S=E.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let C=this._activeBuffer.ybase+this._activeBuffer.y,_;for(_=this._bufferService.rows-1-this._activeBuffer.scrollBottom,_=this._bufferService.rows-1+this._activeBuffer.ybase-_;S--;)this._activeBuffer.lines.splice(C,1),this._activeBuffer.lines.splice(_,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(E){this._restrictCursor();let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return S&&(S.insertCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(E){this._restrictCursor();let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return S&&(S.deleteCells(this._activeBuffer.x,E.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(E){let S=E.params[0]||1;for(;S--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(E){let S=E.params[0]||1;for(;S--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(V.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.deleteCells(0,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.insertCells(0,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.insertCells(this._activeBuffer.x,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(E){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let S=E.params[0]||1;for(let C=this._activeBuffer.scrollTop;C<=this._activeBuffer.scrollBottom;++C){let _=this._activeBuffer.lines.get(this._activeBuffer.ybase+C);_.deleteCells(this._activeBuffer.x,S,this._activeBuffer.getNullCell(this._eraseAttrData())),_.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(E){this._restrictCursor();let S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return S&&(S.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(E.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(E){let S=this._parser.precedingJoinState;if(!S)return!0;let C=E.params[0]||1,_=I.UnicodeService.extractWidth(S),b=this._activeBuffer.x-_,c=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(b),a=new Uint32Array(c.length*C),e=0;for(let P=0;P<c.length;){let $$=c.codePointAt(P)||0;a[e++]=$$,P+=$$>65535?2:1}let M$=e;for(let P=1;P<C;++P)a.copyWithin(M$,0,e),M$+=e;return this.print(a,0,M$),!0}sendDeviceAttributesPrimary(E){return E.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(B.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(B.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(E){return E.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(B.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(B.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(E.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(B.C0.ESC+"[>83;40003;0c")),!0}_is(E){return(this._optionsService.rawOptions.termName+"").indexOf(E)===0}setMode(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,U.DEFAULT_CHARSET),this._charsetService.setgCharset(1,U.DEFAULT_CHARSET),this._charsetService.setgCharset(2,U.DEFAULT_CHARSET),this._charsetService.setgCharset(3,U.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1000:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(E){for(let S=0;S<E.length;S++)switch(E.params[S]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1000:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),E.params[S]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(E,S){let C=this._coreService.decPrivateModes,{activeProtocol:_,activeEncoding:b}=this._coreMouseService,c=this._coreService,{buffers:a,cols:e}=this._bufferService,{active:M$,alt:P}=a,$$=this._optionsService.rawOptions,u=(B1)=>B1?1:2,s=E.params[0];return p$=s,d$=S?s===2?4:s===4?u(c.modes.insertMode):s===12?3:s===20?u($$.convertEol):0:s===1?u(C.applicationCursorKeys):s===3?$$.windowOptions.setWinLines?e===80?2:e===132?1:0:0:s===6?u(C.origin):s===7?u(C.wraparound):s===8?3:s===9?u(_==="X10"):s===12?u($$.cursorBlink):s===25?u(!c.isCursorHidden):s===45?u(C.reverseWraparound):s===66?u(C.applicationKeypad):s===67?4:s===1000?u(_==="VT200"):s===1002?u(_==="DRAG"):s===1003?u(_==="ANY"):s===1004?u(C.sendFocus):s===1005?4:s===1006?u(b==="SGR"):s===1015?4:s===1016?u(b==="SGR_PIXELS"):s===1048?1:s===47||s===1047||s===1049?u(M$===P):s===2004?u(C.bracketedPasteMode):0,c.triggerDataEvent(`${B.C0.ESC}[${S?"":"?"}${p$};${d$}$y`),!0;var p$,d$}_updateAttrColor(E,S,C,_,b){return S===2?(E|=50331648,E&=-16777216,E|=O.AttributeData.fromColorRGB([C,_,b])):S===5&&(E&=-50331904,E|=33554432|255&C),E}_extractColor(E,S,C){let _=[0,0,-1,0,0,0],b=0,c=0;do{if(_[c+b]=E.params[S+c],E.hasSubParams(S+c)){let a=E.getSubParams(S+c),e=0;do _[1]===5&&(b=1),_[c+e+1+b]=a[e];while(++e<a.length&&e+c+1+b<_.length);break}if(_[1]===5&&c+b>=2||_[1]===2&&c+b>=5)break;_[1]&&(b=1)}while(++c+S<E.length&&c+b<_.length);for(let a=2;a<_.length;++a)_[a]===-1&&(_[a]=0);switch(_[0]){case 38:C.fg=this._updateAttrColor(C.fg,_[1],_[3],_[4],_[5]);break;case 48:C.bg=this._updateAttrColor(C.bg,_[1],_[3],_[4],_[5]);break;case 58:C.extended=C.extended.clone(),C.extended.underlineColor=this._updateAttrColor(C.extended.underlineColor,_[1],_[3],_[4],_[5])}return c}_processUnderline(E,S){S.extended=S.extended.clone(),(!~E||E>5)&&(E=1),S.extended.underlineStyle=E,S.fg|=268435456,E===0&&(S.fg&=-268435457),S.updateExtended()}_processSGR0(E){E.fg=V.DEFAULT_ATTR_DATA.fg,E.bg=V.DEFAULT_ATTR_DATA.bg,E.extended=E.extended.clone(),E.extended.underlineStyle=0,E.extended.underlineColor&=-67108864,E.updateExtended()}charAttributes(E){if(E.length===1&&E.params[0]===0)return this._processSGR0(this._curAttrData),!0;let S=E.length,C,_=this._curAttrData;for(let b=0;b<S;b++)C=E.params[b],C>=30&&C<=37?(_.fg&=-50331904,_.fg|=16777216|C-30):C>=40&&C<=47?(_.bg&=-50331904,_.bg|=16777216|C-40):C>=90&&C<=97?(_.fg&=-50331904,_.fg|=16777224|C-90):C>=100&&C<=107?(_.bg&=-50331904,_.bg|=16777224|C-100):C===0?this._processSGR0(_):C===1?_.fg|=134217728:C===3?_.bg|=67108864:C===4?(_.fg|=268435456,this._processUnderline(E.hasSubParams(b)?E.getSubParams(b)[0]:1,_)):C===5?_.fg|=536870912:C===7?_.fg|=67108864:C===8?_.fg|=1073741824:C===9?_.fg|=2147483648:C===2?_.bg|=134217728:C===21?this._processUnderline(2,_):C===22?(_.fg&=-134217729,_.bg&=-134217729):C===23?_.bg&=-67108865:C===24?(_.fg&=-268435457,this._processUnderline(0,_)):C===25?_.fg&=-536870913:C===27?_.fg&=-67108865:C===28?_.fg&=-1073741825:C===29?_.fg&=2147483647:C===39?(_.fg&=-67108864,_.fg|=16777215&V.DEFAULT_ATTR_DATA.fg):C===49?(_.bg&=-67108864,_.bg|=16777215&V.DEFAULT_ATTR_DATA.bg):C===38||C===48||C===58?b+=this._extractColor(E,b,_):C===53?_.bg|=1073741824:C===55?_.bg&=-1073741825:C===59?(_.extended=_.extended.clone(),_.extended.underlineColor=-1,_.updateExtended()):C===100?(_.fg&=-67108864,_.fg|=16777215&V.DEFAULT_ATTR_DATA.fg,_.bg&=-67108864,_.bg|=16777215&V.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",C);return!0}deviceStatus(E){switch(E.params[0]){case 5:this._coreService.triggerDataEvent(`${B.C0.ESC}[0n`);break;case 6:let S=this._activeBuffer.y+1,C=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.C0.ESC}[${S};${C}R`)}return!0}deviceStatusPrivate(E){if(E.params[0]===6){let S=this._activeBuffer.y+1,C=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${B.C0.ESC}[?${S};${C}R`)}return!0}softReset(E){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=V.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(E){let S=E.params[0]||1;switch(S){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}let C=S%2==1;return this._optionsService.options.cursorBlink=C,!0}setScrollRegion(E){let S=E.params[0]||1,C;return(E.length<2||(C=E.params[1])>this._bufferService.rows||C===0)&&(C=this._bufferService.rows),C>S&&(this._activeBuffer.scrollTop=S-1,this._activeBuffer.scrollBottom=C-1,this._setCursor(0,0)),!0}windowOptions(E){if(!g(E.params[0],this._optionsService.rawOptions.windowOptions))return!0;let S=E.length>1?E.params[1]:0;switch(E.params[0]){case 14:S!==2&&this._onRequestWindowsOptionsReport.fire(Q$.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(Q$.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${B.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:S!==0&&S!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),S!==0&&S!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:S!==0&&S!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),S!==0&&S!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(E){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(E){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(E){return this._windowTitle=E,this._onTitleChange.fire(E),!0}setIconName(E){return this._iconName=E,!0}setOrReportIndexedColor(E){let S=[],C=E.split(";");for(;C.length>1;){let _=C.shift(),b=C.shift();if(/^\d+$/.exec(_)){let c=parseInt(_);if(V$(c))if(b==="?")S.push({type:0,index:c});else{let a=k.parseColor(b);a&&S.push({type:1,index:c,color:a})}}}return S.length&&this._onColor.fire(S),!0}setHyperlink(E){let S=E.split(";");return!(S.length<2)&&(S[1]?this._createHyperlink(S[0],S[1]):!S[0]&&this._finishHyperlink())}_createHyperlink(E,S){this._getCurrentLinkId()&&this._finishHyperlink();let C=E.split(":"),_,b=C.findIndex((c)=>c.startsWith("id="));return b!==-1&&(_=C[b].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:_,uri:S}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(E,S){let C=E.split(";");for(let _=0;_<C.length&&!(S>=this._specialColors.length);++_,++S)if(C[_]==="?")this._onColor.fire([{type:0,index:this._specialColors[S]}]);else{let b=k.parseColor(C[_]);b&&this._onColor.fire([{type:1,index:this._specialColors[S],color:b}])}return!0}setOrReportFgColor(E){return this._setOrReportSpecialColor(E,0)}setOrReportBgColor(E){return this._setOrReportSpecialColor(E,1)}setOrReportCursorColor(E){return this._setOrReportSpecialColor(E,2)}restoreIndexedColor(E){if(!E)return this._onColor.fire([{type:2}]),!0;let S=[],C=E.split(";");for(let _=0;_<C.length;++_)if(/^\d+$/.exec(C[_])){let b=parseInt(C[_]);V$(b)&&S.push({type:2,index:b})}return S.length&&this._onColor.fire(S),!0}restoreFgColor(E){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(E){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(E){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,U.DEFAULT_CHARSET),!0}selectCharset(E){return E.length!==2?(this.selectDefaultCharset(),!0):(E[0]==="/"||this._charsetService.setgCharset(x[E[0]],U.CHARSETS[E[1]]||U.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let E=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,E,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=V.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=V.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(E){return this._charsetService.setgLevel(E),!0}screenAlignmentPattern(){let E=new N.CellData;E.content=4194373,E.fg=this._curAttrData.fg,E.bg=this._curAttrData.bg,this._setCursor(0,0);for(let S=0;S<this._bufferService.rows;++S){let C=this._activeBuffer.ybase+this._activeBuffer.y+S,_=this._activeBuffer.lines.get(C);_&&(_.fill(E),_.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(E,S){let C=this._bufferService.buffer,_=this._optionsService.rawOptions;return((b)=>(this._coreService.triggerDataEvent(`${B.C0.ESC}${b}${B.C0.ESC}\\`),!0))(E==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:E==='"p'?'P1$r61;1"p':E==="r"?`P1$r${C.scrollTop+1};${C.scrollBottom+1}r`:E==="m"?"P1$r0m":E===" q"?`P1$r${{block:2,underline:4,bar:6}[_.cursorStyle]-(_.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(E,S){this._dirtyRowTracker.markRangeDirty(E,S)}}G.InputHandler=N$;let t=class{constructor(E){this._bufferService=E,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(E){E<this.start?this.start=E:E>this.end&&(this.end=E)}markRangeDirty(E,S){E>S&&(k$=E,E=S,S=k$),E<this.start&&(this.start=E),S>this.end&&(this.end=S)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function V$(E){return 0<=E&&E<256}t=q([W(0,A.IBufferService)],t)},844:(M,G)=>{function K(q){for(let W of q)W.dispose();q.length=0}Object.defineProperty(G,"__esModule",{value:!0}),G.getDisposeArrayDisposable=G.disposeArray=G.toDisposable=G.MutableDisposable=G.Disposable=void 0,G.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(let q of this._disposables)q.dispose();this._disposables.length=0}register(q){return this._disposables.push(q),q}unregister(q){let W=this._disposables.indexOf(q);W!==-1&&this._disposables.splice(W,1)}},G.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(q){this._isDisposed||q===this._value||(this._value?.dispose(),this._value=q)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},G.toDisposable=function(q){return{dispose:q}},G.disposeArray=K,G.getDisposeArrayDisposable=function(q){return{dispose:()=>K(q)}}},114:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.isChromeOS=G.isLinux=G.isWindows=G.isIphone=G.isIpad=G.isMac=G.getSafariVersion=G.isSafari=G.isLegacyEdge=G.isFirefox=G.isNode=void 0,G.isNode=typeof process!="undefined"&&"title"in process;let K=G.isNode?"node":navigator.userAgent,q=G.isNode?"node":navigator.platform;G.isFirefox=K.includes("Firefox"),G.isLegacyEdge=K.includes("Edge"),G.isSafari=/^((?!chrome|android).)*safari/i.test(K),G.getSafariVersion=function(){if(!G.isSafari)return 0;let W=K.match(/Version\/(\d+)/);return W===null||W.length<2?0:parseInt(W[1])},G.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(q),G.isIpad=q==="iPad",G.isIphone=q==="iPhone",G.isWindows=["Windows","Win16","Win32","WinCE"].includes(q),G.isLinux=q.indexOf("Linux")>=0,G.isChromeOS=/\bCrOS\b/.test(K)},226:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.DebouncedIdleTask=G.IdleTaskQueue=G.PriorityTaskQueue=void 0;let q=K(114);class W{constructor(){this._tasks=[],this._i=0}enqueue(U){this._tasks.push(U),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(U){this._idleCallback=void 0;let R=0,D=0,j=U.timeRemaining(),V=0;for(;this._i<this._tasks.length;){if(R=Date.now(),this._tasks[this._i]()||this._i++,R=Math.max(1,Date.now()-R),D=Math.max(R,D),V=U.timeRemaining(),1.5*D>V)return j-R<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(j-R))}ms`),void this._start();j=V}this.clear()}}class B extends W{_requestCallback(U){return setTimeout(()=>U(this._createDeadline(16)))}_cancelCallback(U){clearTimeout(U)}_createDeadline(U){let R=Date.now()+U;return{timeRemaining:()=>Math.max(0,R-Date.now())}}}G.PriorityTaskQueue=B,G.IdleTaskQueue=!q.isNode&&"requestIdleCallback"in window?class extends W{_requestCallback(U){return requestIdleCallback(U)}_cancelCallback(U){cancelIdleCallback(U)}}:B,G.DebouncedIdleTask=class{constructor(){this._queue=new G.IdleTaskQueue}set(U){this._queue.clear(),this._queue.enqueue(U)}flush(){this._queue.flush()}}},282:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.updateWindowsModeWrappedState=void 0;let q=K(643);G.updateWindowsModeWrappedState=function(W){let B=W.buffer.lines.get(W.buffer.ybase+W.buffer.y-1),U=B?.get(W.cols-1),R=W.buffer.lines.get(W.buffer.ybase+W.buffer.y);R&&U&&(R.isWrapped=U[q.CHAR_DATA_CODE_INDEX]!==q.NULL_CELL_CODE&&U[q.CHAR_DATA_CODE_INDEX]!==q.WHITESPACE_CELL_CODE)}},734:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.ExtendedAttrs=G.AttributeData=void 0;class K{constructor(){this.fg=0,this.bg=0,this.extended=new q}static toColorRGB(W){return[W>>>16&255,W>>>8&255,255&W]}static fromColorRGB(W){return(255&W[0])<<16|(255&W[1])<<8|255&W[2]}clone(){let W=new K;return W.fg=this.fg,W.bg=this.bg,W.extended=this.extended.clone(),W}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}G.AttributeData=K;class q{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(W){this._ext=W}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(W){this._ext&=-469762049,this._ext|=W<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(W){this._ext&=-67108864,this._ext|=67108863&W}get urlId(){return this._urlId}set urlId(W){this._urlId=W}get underlineVariantOffset(){let W=(3758096384&this._ext)>>29;return W<0?4294967288^W:W}set underlineVariantOffset(W){this._ext&=536870911,this._ext|=W<<29&3758096384}constructor(W=0,B=0){this._ext=0,this._urlId=0,this._ext=W,this._urlId=B}clone(){return new q(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}G.ExtendedAttrs=q},92:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.Buffer=G.MAX_BUFFER_SIZE=void 0;let q=K(349),W=K(226),B=K(734),U=K(437),R=K(634),D=K(511),j=K(643),V=K(863),L=K(116);G.MAX_BUFFER_SIZE=4294967295,G.Buffer=class{constructor(F,N,O){this._hasScrollback=F,this._optionsService=N,this._bufferService=O,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=U.DEFAULT_ATTR_DATA.clone(),this.savedCharset=L.DEFAULT_CHARSET,this.markers=[],this._nullCell=D.CellData.fromCharData([0,j.NULL_CELL_CHAR,j.NULL_CELL_WIDTH,j.NULL_CELL_CODE]),this._whitespaceCell=D.CellData.fromCharData([0,j.WHITESPACE_CELL_CHAR,j.WHITESPACE_CELL_WIDTH,j.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new W.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new q.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(F){return F?(this._nullCell.fg=F.fg,this._nullCell.bg=F.bg,this._nullCell.extended=F.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new B.ExtendedAttrs),this._nullCell}getWhitespaceCell(F){return F?(this._whitespaceCell.fg=F.fg,this._whitespaceCell.bg=F.bg,this._whitespaceCell.extended=F.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new B.ExtendedAttrs),this._whitespaceCell}getBlankLine(F,N){return new U.BufferLine(this._bufferService.cols,this.getNullCell(F),N)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let F=this.ybase+this.y-this.ydisp;return F>=0&&F<this._rows}_getCorrectBufferLength(F){if(!this._hasScrollback)return F;let N=F+this._optionsService.rawOptions.scrollback;return N>G.MAX_BUFFER_SIZE?G.MAX_BUFFER_SIZE:N}fillViewportRows(F){if(this.lines.length===0){F===void 0&&(F=U.DEFAULT_ATTR_DATA);let N=this._rows;for(;N--;)this.lines.push(this.getBlankLine(F))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new q.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(F,N){let O=this.getNullCell(U.DEFAULT_ATTR_DATA),A=0,I=this._getCorrectBufferLength(N);if(I>this.lines.maxLength&&(this.lines.maxLength=I),this.lines.length>0){if(this._cols<F)for(let Z=0;Z<this.lines.length;Z++)A+=+this.lines.get(Z).resize(F,O);let w=0;if(this._rows<N)for(let Z=this._rows;Z<N;Z++)this.lines.length<N+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new U.BufferLine(F,O)):this.ybase>0&&this.lines.length<=this.ybase+this.y+w+1?(this.ybase--,w++,this.ydisp>0&&this.ydisp--):this.lines.push(new U.BufferLine(F,O)));else for(let Z=this._rows;Z>N;Z--)this.lines.length>N+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(I<this.lines.maxLength){let Z=this.lines.length-I;Z>0&&(this.lines.trimStart(Z),this.ybase=Math.max(this.ybase-Z,0),this.ydisp=Math.max(this.ydisp-Z,0),this.savedY=Math.max(this.savedY-Z,0)),this.lines.maxLength=I}this.x=Math.min(this.x,F-1),this.y=Math.min(this.y,N-1),w&&(this.y+=w),this.savedX=Math.min(this.savedX,F-1),this.scrollTop=0}if(this.scrollBottom=N-1,this._isReflowEnabled&&(this._reflow(F,N),this._cols>F))for(let w=0;w<this.lines.length;w++)A+=+this.lines.get(w).resize(F,O);this._cols=F,this._rows=N,this._memoryCleanupQueue.clear(),A>0.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let F=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,F=!1);let N=0;for(;this._memoryCleanupPosition<this.lines.length;)if(N+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),N>100)return!0;return F}get _isReflowEnabled(){let F=this._optionsService.rawOptions.windowsPty;return F&&F.buildNumber?this._hasScrollback&&F.backend==="conpty"&&F.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(F,N){this._cols!==F&&(F>this._cols?this._reflowLarger(F,N):this._reflowSmaller(F,N))}_reflowLarger(F,N){let O=R.reflowLargerGetLinesToRemove(this.lines,this._cols,F,this.ybase+this.y,this.getNullCell(U.DEFAULT_ATTR_DATA));if(O.length>0){let A=R.reflowLargerCreateNewLayout(this.lines,O);R.reflowLargerApplyNewLayout(this.lines,A.layout),this._reflowLargerAdjustViewport(F,N,A.countRemoved)}}_reflowLargerAdjustViewport(F,N,O){let A=this.getNullCell(U.DEFAULT_ATTR_DATA),I=O;for(;I-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<N&&this.lines.push(new U.BufferLine(F,A))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-O,0)}_reflowSmaller(F,N){let O=this.getNullCell(U.DEFAULT_ATTR_DATA),A=[],I=0;for(let w=this.lines.length-1;w>=0;w--){let Z=this.lines.get(w);if(!Z||!Z.isWrapped&&Z.getTrimmedLength()<=F)continue;let k=[Z];for(;Z.isWrapped&&w>0;)Z=this.lines.get(--w),k.unshift(Z);let x=this.ybase+this.y;if(x>=w&&x<w+k.length)continue;let T=k[k.length-1].getTrimmedLength(),g=R.reflowSmallerGetNewLineLengths(k,this._cols,F),Q$=g.length-k.length,k$;k$=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+Q$):Math.max(0,this.lines.length-this.lines.maxLength+Q$);let N$=[];for(let _=0;_<Q$;_++){let b=this.getBlankLine(U.DEFAULT_ATTR_DATA,!0);N$.push(b)}N$.length>0&&(A.push({start:w+k.length+I,newLines:N$}),I+=N$.length),k.push(...N$);let t=g.length-1,V$=g[t];V$===0&&(t--,V$=g[t]);let E=k.length-Q$-1,S=T;for(;E>=0;){let _=Math.min(S,V$);if(k[t]===void 0)break;if(k[t].copyCellsFrom(k[E],S-_,V$-_,_,!0),V$-=_,V$===0&&(t--,V$=g[t]),S-=_,S===0){E--;let b=Math.max(E,0);S=R.getWrappedLineTrimmedLength(k,b,this._cols)}}for(let _=0;_<k.length;_++)g[_]<F&&k[_].setCell(g[_],O);let C=Q$-k$;for(;C-- >0;)this.ybase===0?this.y<N-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+I)-N&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+Q$,this.ybase+N-1)}if(A.length>0){let w=[],Z=[];for(let t=0;t<this.lines.length;t++)Z.push(this.lines.get(t));let k=this.lines.length,x=k-1,T=0,g=A[T];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+I);let Q$=0;for(let t=Math.min(this.lines.maxLength-1,k+I-1);t>=0;t--)if(g&&g.start>x+Q$){for(let V$=g.newLines.length-1;V$>=0;V$--)this.lines.set(t--,g.newLines[V$]);t++,w.push({index:x+1,amount:g.newLines.length}),Q$+=g.newLines.length,g=A[++T]}else this.lines.set(t,Z[x--]);let k$=0;for(let t=w.length-1;t>=0;t--)w[t].index+=k$,this.lines.onInsertEmitter.fire(w[t]),k$+=w[t].amount;let N$=Math.max(0,k+I-this.lines.maxLength);N$>0&&this.lines.onTrimEmitter.fire(N$)}}translateBufferLineToString(F,N,O=0,A){let I=this.lines.get(F);return I?I.translateToString(N,O,A):""}getWrappedRangeForLine(F){let N=F,O=F;for(;N>0&&this.lines.get(N).isWrapped;)N--;for(;O+1<this.lines.length&&this.lines.get(O+1).isWrapped;)O++;return{first:N,last:O}}setupTabStops(F){for(F!=null?this.tabs[F]||(F=this.prevStop(F)):(this.tabs={},F=0);F<this._cols;F+=this._optionsService.rawOptions.tabStopWidth)this.tabs[F]=!0}prevStop(F){for(F==null&&(F=this.x);!this.tabs[--F]&&F>0;);return F>=this._cols?this._cols-1:F<0?0:F}nextStop(F){for(F==null&&(F=this.x);!this.tabs[++F]&&F<this._cols;);return F>=this._cols?this._cols-1:F<0?0:F}clearMarkers(F){this._isClearing=!0;for(let N=0;N<this.markers.length;N++)this.markers[N].line===F&&(this.markers[N].dispose(),this.markers.splice(N--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let F=0;F<this.markers.length;F++)this.markers[F].dispose(),this.markers.splice(F--,1);this._isClearing=!1}addMarker(F){let N=new V.Marker(F);return this.markers.push(N),N.register(this.lines.onTrim((O)=>{N.line-=O,N.line<0&&N.dispose()})),N.register(this.lines.onInsert((O)=>{N.line>=O.index&&(N.line+=O.amount)})),N.register(this.lines.onDelete((O)=>{N.line>=O.index&&N.line<O.index+O.amount&&N.dispose(),N.line>O.index&&(N.line-=O.amount)})),N.register(N.onDispose(()=>this._removeMarker(N))),N}_removeMarker(F){this._isClearing||this.markers.splice(this.markers.indexOf(F),1)}}},437:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.BufferLine=G.DEFAULT_ATTR_DATA=void 0;let q=K(734),W=K(511),B=K(643),U=K(482);G.DEFAULT_ATTR_DATA=Object.freeze(new q.AttributeData);let R=0;class D{constructor(j,V,L=!1){this.isWrapped=L,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*j);let F=V||W.CellData.fromCharData([0,B.NULL_CELL_CHAR,B.NULL_CELL_WIDTH,B.NULL_CELL_CODE]);for(let N=0;N<j;++N)this.setCell(N,F);this.length=j}get(j){let V=this._data[3*j+0],L=2097151&V;return[this._data[3*j+1],2097152&V?this._combined[j]:L?U.stringFromCodePoint(L):"",V>>22,2097152&V?this._combined[j].charCodeAt(this._combined[j].length-1):L]}set(j,V){this._data[3*j+1]=V[B.CHAR_DATA_ATTR_INDEX],V[B.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[j]=V[1],this._data[3*j+0]=2097152|j|V[B.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*j+0]=V[B.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|V[B.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(j){return this._data[3*j+0]>>22}hasWidth(j){return 12582912&this._data[3*j+0]}getFg(j){return this._data[3*j+1]}getBg(j){return this._data[3*j+2]}hasContent(j){return 4194303&this._data[3*j+0]}getCodePoint(j){let V=this._data[3*j+0];return 2097152&V?this._combined[j].charCodeAt(this._combined[j].length-1):2097151&V}isCombined(j){return 2097152&this._data[3*j+0]}getString(j){let V=this._data[3*j+0];return 2097152&V?this._combined[j]:2097151&V?U.stringFromCodePoint(2097151&V):""}isProtected(j){return 536870912&this._data[3*j+2]}loadCell(j,V){return R=3*j,V.content=this._data[R+0],V.fg=this._data[R+1],V.bg=this._data[R+2],2097152&V.content&&(V.combinedData=this._combined[j]),268435456&V.bg&&(V.extended=this._extendedAttrs[j]),V}setCell(j,V){2097152&V.content&&(this._combined[j]=V.combinedData),268435456&V.bg&&(this._extendedAttrs[j]=V.extended),this._data[3*j+0]=V.content,this._data[3*j+1]=V.fg,this._data[3*j+2]=V.bg}setCellFromCodepoint(j,V,L,F){268435456&F.bg&&(this._extendedAttrs[j]=F.extended),this._data[3*j+0]=V|L<<22,this._data[3*j+1]=F.fg,this._data[3*j+2]=F.bg}addCodepointToCell(j,V,L){let F=this._data[3*j+0];2097152&F?this._combined[j]+=U.stringFromCodePoint(V):2097151&F?(this._combined[j]=U.stringFromCodePoint(2097151&F)+U.stringFromCodePoint(V),F&=-2097152,F|=2097152):F=V|4194304,L&&(F&=-12582913,F|=L<<22),this._data[3*j+0]=F}insertCells(j,V,L){if((j%=this.length)&&this.getWidth(j-1)===2&&this.setCellFromCodepoint(j-1,0,1,L),V<this.length-j){let F=new W.CellData;for(let N=this.length-j-V-1;N>=0;--N)this.setCell(j+V+N,this.loadCell(j+N,F));for(let N=0;N<V;++N)this.setCell(j+N,L)}else for(let F=j;F<this.length;++F)this.setCell(F,L);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,L)}deleteCells(j,V,L){if(j%=this.length,V<this.length-j){let F=new W.CellData;for(let N=0;N<this.length-j-V;++N)this.setCell(j+N,this.loadCell(j+V+N,F));for(let N=this.length-V;N<this.length;++N)this.setCell(N,L)}else for(let F=j;F<this.length;++F)this.setCell(F,L);j&&this.getWidth(j-1)===2&&this.setCellFromCodepoint(j-1,0,1,L),this.getWidth(j)!==0||this.hasContent(j)||this.setCellFromCodepoint(j,0,1,L)}replaceCells(j,V,L,F=!1){if(F)for(j&&this.getWidth(j-1)===2&&!this.isProtected(j-1)&&this.setCellFromCodepoint(j-1,0,1,L),V<this.length&&this.getWidth(V-1)===2&&!this.isProtected(V)&&this.setCellFromCodepoint(V,0,1,L);j<V&&j<this.length;)this.isProtected(j)||this.setCell(j,L),j++;else for(j&&this.getWidth(j-1)===2&&this.setCellFromCodepoint(j-1,0,1,L),V<this.length&&this.getWidth(V-1)===2&&this.setCellFromCodepoint(V,0,1,L);j<V&&j<this.length;)this.setCell(j++,L)}resize(j,V){if(j===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;let L=3*j;if(j>this.length){if(this._data.buffer.byteLength>=4*L)this._data=new Uint32Array(this._data.buffer,0,L);else{let F=new Uint32Array(L);F.set(this._data),this._data=F}for(let F=this.length;F<j;++F)this.setCell(F,V)}else{this._data=this._data.subarray(0,L);let F=Object.keys(this._combined);for(let O=0;O<F.length;O++){let A=parseInt(F[O],10);A>=j&&delete this._combined[A]}let N=Object.keys(this._extendedAttrs);for(let O=0;O<N.length;O++){let A=parseInt(N[O],10);A>=j&&delete this._extendedAttrs[A]}}return this.length=j,4*L*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){let j=new Uint32Array(this._data.length);return j.set(this._data),this._data=j,1}return 0}fill(j,V=!1){if(V)for(let L=0;L<this.length;++L)this.isProtected(L)||this.setCell(L,j);else{this._combined={},this._extendedAttrs={};for(let L=0;L<this.length;++L)this.setCell(L,j)}}copyFrom(j){this.length!==j.length?this._data=new Uint32Array(j._data):this._data.set(j._data),this.length=j.length,this._combined={};for(let V in j._combined)this._combined[V]=j._combined[V];this._extendedAttrs={};for(let V in j._extendedAttrs)this._extendedAttrs[V]=j._extendedAttrs[V];this.isWrapped=j.isWrapped}clone(){let j=new D(0);j._data=new Uint32Array(this._data),j.length=this.length;for(let V in this._combined)j._combined[V]=this._combined[V];for(let V in this._extendedAttrs)j._extendedAttrs[V]=this._extendedAttrs[V];return j.isWrapped=this.isWrapped,j}getTrimmedLength(){for(let j=this.length-1;j>=0;--j)if(4194303&this._data[3*j+0])return j+(this._data[3*j+0]>>22);return 0}getNoBgTrimmedLength(){for(let j=this.length-1;j>=0;--j)if(4194303&this._data[3*j+0]||50331648&this._data[3*j+2])return j+(this._data[3*j+0]>>22);return 0}copyCellsFrom(j,V,L,F,N){let O=j._data;if(N)for(let I=F-1;I>=0;I--){for(let w=0;w<3;w++)this._data[3*(L+I)+w]=O[3*(V+I)+w];268435456&O[3*(V+I)+2]&&(this._extendedAttrs[L+I]=j._extendedAttrs[V+I])}else for(let I=0;I<F;I++){for(let w=0;w<3;w++)this._data[3*(L+I)+w]=O[3*(V+I)+w];268435456&O[3*(V+I)+2]&&(this._extendedAttrs[L+I]=j._extendedAttrs[V+I])}let A=Object.keys(j._combined);for(let I=0;I<A.length;I++){let w=parseInt(A[I],10);w>=V&&(this._combined[w-V+L]=j._combined[w])}}translateToString(j,V,L,F){V=V??0,L=L??this.length,j&&(L=Math.min(L,this.getTrimmedLength())),F&&(F.length=0);let N="";for(;V<L;){let O=this._data[3*V+0],A=2097151&O,I=2097152&O?this._combined[V]:A?U.stringFromCodePoint(A):B.WHITESPACE_CELL_CHAR;if(N+=I,F)for(let w=0;w<I.length;++w)F.push(V);V+=O>>22||1}return F&&F.push(V),N}}G.BufferLine=D},634:(M,G)=>{function K(q,W,B){if(W===q.length-1)return q[W].getTrimmedLength();let U=!q[W].hasContent(B-1)&&q[W].getWidth(B-1)===1,R=q[W+1].getWidth(0)===2;return U&&R?B-1:B}Object.defineProperty(G,"__esModule",{value:!0}),G.getWrappedLineTrimmedLength=G.reflowSmallerGetNewLineLengths=G.reflowLargerApplyNewLayout=G.reflowLargerCreateNewLayout=G.reflowLargerGetLinesToRemove=void 0,G.reflowLargerGetLinesToRemove=function(q,W,B,U,R){let D=[];for(let j=0;j<q.length-1;j++){let V=j,L=q.get(++V);if(!L.isWrapped)continue;let F=[q.get(j)];for(;V<q.length&&L.isWrapped;)F.push(L),L=q.get(++V);if(U>=j&&U<V){j+=F.length-1;continue}let N=0,O=K(F,N,W),A=1,I=0;for(;A<F.length;){let Z=K(F,A,W),k=Z-I,x=B-O,T=Math.min(k,x);F[N].copyCellsFrom(F[A],I,O,T,!1),O+=T,O===B&&(N++,O=0),I+=T,I===Z&&(A++,I=0),O===0&&N!==0&&F[N-1].getWidth(B-1)===2&&(F[N].copyCellsFrom(F[N-1],B-1,O++,1,!1),F[N-1].setCell(B-1,R))}F[N].replaceCells(O,B,R);let w=0;for(let Z=F.length-1;Z>0&&(Z>N||F[Z].getTrimmedLength()===0);Z--)w++;w>0&&(D.push(j+F.length-w),D.push(w)),j+=F.length-1}return D},G.reflowLargerCreateNewLayout=function(q,W){let B=[],U=0,R=W[U],D=0;for(let j=0;j<q.length;j++)if(R===j){let V=W[++U];q.onDeleteEmitter.fire({index:j-D,amount:V}),j+=V-1,D+=V,R=W[++U]}else B.push(j);return{layout:B,countRemoved:D}},G.reflowLargerApplyNewLayout=function(q,W){let B=[];for(let U=0;U<W.length;U++)B.push(q.get(W[U]));for(let U=0;U<B.length;U++)q.set(U,B[U]);q.length=W.length},G.reflowSmallerGetNewLineLengths=function(q,W,B){let U=[],R=q.map((L,F)=>K(q,F,W)).reduce((L,F)=>L+F),D=0,j=0,V=0;for(;V<R;){if(R-V<B){U.push(R-V);break}D+=B;let L=K(q,j,W);D>L&&(D-=L,j++);let F=q[j].getWidth(D-1)===2;F&&D--;let N=F?B-1:B;U.push(N),V+=N}return U},G.getWrappedLineTrimmedLength=K},295:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.BufferSet=void 0;let q=K(460),W=K(844),B=K(92);class U extends W.Disposable{constructor(R,D){super(),this._optionsService=R,this._bufferService=D,this._onBufferActivate=this.register(new q.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new B.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new B.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(R){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(R),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(R,D){this._normal.resize(R,D),this._alt.resize(R,D),this.setupTabStops(R)}setupTabStops(R){this._normal.setupTabStops(R),this._alt.setupTabStops(R)}}G.BufferSet=U},511:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.CellData=void 0;let q=K(482),W=K(643),B=K(734);class U extends B.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new B.ExtendedAttrs,this.combinedData=""}static fromCharData(R){let D=new U;return D.setFromCharData(R),D}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?q.stringFromCodePoint(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(R){this.fg=R[W.CHAR_DATA_ATTR_INDEX],this.bg=0;let D=!1;if(R[W.CHAR_DATA_CHAR_INDEX].length>2)D=!0;else if(R[W.CHAR_DATA_CHAR_INDEX].length===2){let j=R[W.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=j&&j<=56319){let V=R[W.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=V&&V<=57343?this.content=1024*(j-55296)+V-56320+65536|R[W.CHAR_DATA_WIDTH_INDEX]<<22:D=!0}else D=!0}else this.content=R[W.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|R[W.CHAR_DATA_WIDTH_INDEX]<<22;D&&(this.combinedData=R[W.CHAR_DATA_CHAR_INDEX],this.content=2097152|R[W.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}G.CellData=U},643:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.WHITESPACE_CELL_CODE=G.WHITESPACE_CELL_WIDTH=G.WHITESPACE_CELL_CHAR=G.NULL_CELL_CODE=G.NULL_CELL_WIDTH=G.NULL_CELL_CHAR=G.CHAR_DATA_CODE_INDEX=G.CHAR_DATA_WIDTH_INDEX=G.CHAR_DATA_CHAR_INDEX=G.CHAR_DATA_ATTR_INDEX=G.DEFAULT_EXT=G.DEFAULT_ATTR=G.DEFAULT_COLOR=void 0,G.DEFAULT_COLOR=0,G.DEFAULT_ATTR=256|G.DEFAULT_COLOR<<9,G.DEFAULT_EXT=0,G.CHAR_DATA_ATTR_INDEX=0,G.CHAR_DATA_CHAR_INDEX=1,G.CHAR_DATA_WIDTH_INDEX=2,G.CHAR_DATA_CODE_INDEX=3,G.NULL_CELL_CHAR="",G.NULL_CELL_WIDTH=1,G.NULL_CELL_CODE=0,G.WHITESPACE_CELL_CHAR=" ",G.WHITESPACE_CELL_WIDTH=1,G.WHITESPACE_CELL_CODE=32},863:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.Marker=void 0;let q=K(460),W=K(844);class B{get id(){return this._id}constructor(U){this.line=U,this.isDisposed=!1,this._disposables=[],this._id=B._nextId++,this._onDispose=this.register(new q.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),W.disposeArray(this._disposables),this._disposables.length=0)}register(U){return this._disposables.push(U),U}}G.Marker=B,B._nextId=1},116:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.DEFAULT_CHARSET=G.CHARSETS=void 0,G.CHARSETS={},G.DEFAULT_CHARSET=G.CHARSETS.B,G.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},G.CHARSETS.A={"#":"£"},G.CHARSETS.B=void 0,G.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},G.CHARSETS.C=G.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},G.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},G.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},G.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},G.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},G.CHARSETS.E=G.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},G.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},G.CHARSETS.H=G.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},G.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},584:(M,G)=>{var K,q,W;Object.defineProperty(G,"__esModule",{value:!0}),G.C1_ESCAPED=G.C1=G.C0=void 0,function(B){B.NUL="\x00",B.SOH="\x01",B.STX="\x02",B.ETX="\x03",B.EOT="\x04",B.ENQ="\x05",B.ACK="\x06",B.BEL="\x07",B.BS="\b",B.HT="\t",B.LF=`
42
42
  `,B.VT="\v",B.FF="\f",B.CR="\r",B.SO="\x0E",B.SI="\x0F",B.DLE="\x10",B.DC1="\x11",B.DC2="\x12",B.DC3="\x13",B.DC4="\x14",B.NAK="\x15",B.SYN="\x16",B.ETB="\x17",B.CAN="\x18",B.EM="\x19",B.SUB="\x1A",B.ESC="\x1B",B.FS="\x1C",B.GS="\x1D",B.RS="\x1E",B.US="\x1F",B.SP=" ",B.DEL=""}(K||(G.C0=K={})),function(B){B.PAD="€",B.HOP="",B.BPH="‚",B.NBH="ƒ",B.IND="„",B.NEL="…",B.SSA="†",B.ESA="‡",B.HTS="ˆ",B.HTJ="‰",B.VTS="Š",B.PLD="‹",B.PLU="Œ",B.RI="",B.SS2="Ž",B.SS3="",B.DCS="",B.PU1="‘",B.PU2="’",B.STS="“",B.CCH="”",B.MW="•",B.SPA="–",B.EPA="—",B.SOS="˜",B.SGCI="™",B.SCI="š",B.CSI="›",B.ST="œ",B.OSC="",B.PM="ž",B.APC="Ÿ"}(q||(G.C1=q={})),function(B){B.ST=`${K.ESC}\\`}(W||(G.C1_ESCAPED=W={}))},482:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.Utf8ToUtf32=G.StringToUtf32=G.utf32ToString=G.stringFromCodePoint=void 0,G.stringFromCodePoint=function(K){return K>65535?(K-=65536,String.fromCharCode(55296+(K>>10))+String.fromCharCode(K%1024+56320)):String.fromCharCode(K)},G.utf32ToString=function(K,q=0,W=K.length){let B="";for(let U=q;U<W;++U){let R=K[U];R>65535?(R-=65536,B+=String.fromCharCode(55296+(R>>10))+String.fromCharCode(R%1024+56320)):B+=String.fromCharCode(R)}return B},G.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(K,q){let W=K.length;if(!W)return 0;let B=0,U=0;if(this._interim){let R=K.charCodeAt(U++);56320<=R&&R<=57343?q[B++]=1024*(this._interim-55296)+R-56320+65536:(q[B++]=this._interim,q[B++]=R),this._interim=0}for(let R=U;R<W;++R){let D=K.charCodeAt(R);if(55296<=D&&D<=56319){if(++R>=W)return this._interim=D,B;let j=K.charCodeAt(R);56320<=j&&j<=57343?q[B++]=1024*(D-55296)+j-56320+65536:(q[B++]=D,q[B++]=j)}else D!==65279&&(q[B++]=D)}return B}},G.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(K,q){let W=K.length;if(!W)return 0;let B,U,R,D,j=0,V=0,L=0;if(this.interim[0]){let O=!1,A=this.interim[0];A&=(224&A)==192?31:(240&A)==224?15:7;let I,w=0;for(;(I=63&this.interim[++w])&&w<4;)A<<=6,A|=I;let Z=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,k=Z-w;for(;L<k;){if(L>=W)return 0;if(I=K[L++],(192&I)!=128){L--,O=!0;break}this.interim[w++]=I,A<<=6,A|=63&I}O||(Z===2?A<128?L--:q[j++]=A:Z===3?A<2048||A>=55296&&A<=57343||A===65279||(q[j++]=A):A<65536||A>1114111||(q[j++]=A)),this.interim.fill(0)}let F=W-4,N=L;for(;N<W;){for(;!(!(N<F)||128&(B=K[N])||128&(U=K[N+1])||128&(R=K[N+2])||128&(D=K[N+3]));)q[j++]=B,q[j++]=U,q[j++]=R,q[j++]=D,N+=4;if(B=K[N++],B<128)q[j++]=B;else if((224&B)==192){if(N>=W)return this.interim[0]=B,j;if(U=K[N++],(192&U)!=128){N--;continue}if(V=(31&B)<<6|63&U,V<128){N--;continue}q[j++]=V}else if((240&B)==224){if(N>=W)return this.interim[0]=B,j;if(U=K[N++],(192&U)!=128){N--;continue}if(N>=W)return this.interim[0]=B,this.interim[1]=U,j;if(R=K[N++],(192&R)!=128){N--;continue}if(V=(15&B)<<12|(63&U)<<6|63&R,V<2048||V>=55296&&V<=57343||V===65279)continue;q[j++]=V}else if((248&B)==240){if(N>=W)return this.interim[0]=B,j;if(U=K[N++],(192&U)!=128){N--;continue}if(N>=W)return this.interim[0]=B,this.interim[1]=U,j;if(R=K[N++],(192&R)!=128){N--;continue}if(N>=W)return this.interim[0]=B,this.interim[1]=U,this.interim[2]=R,j;if(D=K[N++],(192&D)!=128){N--;continue}if(V=(7&B)<<18|(63&U)<<12|(63&R)<<6|63&D,V<65536||V>1114111)continue;q[j++]=V}}return j}}},225:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.UnicodeV6=void 0;let q=K(480),W=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],B=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],U;G.UnicodeV6=class{constructor(){if(this.version="6",!U){U=new Uint8Array(65536),U.fill(1),U[0]=0,U.fill(0,1,32),U.fill(0,127,160),U.fill(2,4352,4448),U[9001]=2,U[9002]=2,U.fill(2,11904,42192),U[12351]=1,U.fill(2,44032,55204),U.fill(2,63744,64256),U.fill(2,65040,65050),U.fill(2,65072,65136),U.fill(2,65280,65377),U.fill(2,65504,65511);for(let R=0;R<W.length;++R)U.fill(0,W[R][0],W[R][1]+1)}}wcwidth(R){return R<32?0:R<127?1:R<65536?U[R]:function(D,j){let V,L=0,F=j.length-1;if(D<j[0][0]||D>j[F][1])return!1;for(;F>=L;)if(V=L+F>>1,D>j[V][1])L=V+1;else{if(!(D<j[V][0]))return!0;F=V-1}return!1}(R,B)?0:R>=131072&&R<=196605||R>=196608&&R<=262141?2:1}charProperties(R,D){let j=this.wcwidth(R),V=j===0&&D!==0;if(V){let L=q.UnicodeService.extractWidth(D);L===0?V=!1:L>j&&(j=L)}return q.UnicodeService.createPropertyValue(0,j,V)}}},981:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.WriteBuffer=void 0;let q=K(460),W=K(844);class B extends W.Disposable{constructor(U){super(),this._action=U,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new q.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(U,R){if(R!==void 0&&this._syncCalls>R)return void(this._syncCalls=0);if(this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let D;for(this._isSyncWriting=!0;D=this._writeBuffer.shift();){this._action(D);let j=this._callbacks.shift();j&&j()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(U,R){if(this._pendingData>50000000)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(R),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=U.length,this._writeBuffer.push(U),this._callbacks.push(R)}_innerWrite(U=0,R=!0){let D=U||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){let j=this._writeBuffer[this._bufferOffset],V=this._action(j,R);if(V){let F=(N)=>Date.now()-D>=12?setTimeout(()=>this._innerWrite(0,N)):this._innerWrite(D,N);return void V.catch((N)=>(queueMicrotask(()=>{throw N}),Promise.resolve(!1))).then(F)}let L=this._callbacks[this._bufferOffset];if(L&&L(),this._bufferOffset++,this._pendingData-=j.length,Date.now()-D>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}G.WriteBuffer=B},941:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.toRgbString=G.parseColor=void 0;let K=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,q=/^[\da-f]+$/;function W(B,U){let R=B.toString(16),D=R.length<2?"0"+R:R;switch(U){case 4:return R[0];case 8:return D;case 12:return(D+D).slice(0,3);default:return D+D}}G.parseColor=function(B){if(!B)return;let U=B.toLowerCase();if(U.indexOf("rgb:")===0){U=U.slice(4);let R=K.exec(U);if(R){let D=R[1]?15:R[4]?255:R[7]?4095:65535;return[Math.round(parseInt(R[1]||R[4]||R[7]||R[10],16)/D*255),Math.round(parseInt(R[2]||R[5]||R[8]||R[11],16)/D*255),Math.round(parseInt(R[3]||R[6]||R[9]||R[12],16)/D*255)]}}else if(U.indexOf("#")===0&&(U=U.slice(1),q.exec(U)&&[3,6,9,12].includes(U.length))){let R=U.length/3,D=[0,0,0];for(let j=0;j<3;++j){let V=parseInt(U.slice(R*j,R*j+R),16);D[j]=R===1?V<<4:R===2?V:R===3?V>>4:V>>8}return D}},G.toRgbString=function(B,U=16){let[R,D,j]=B;return`rgb:${W(R,U)}/${W(D,U)}/${W(j,U)}`}},770:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.PAYLOAD_LIMIT=void 0,G.PAYLOAD_LIMIT=1e7},351:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.DcsHandler=G.DcsParser=void 0;let q=K(482),W=K(742),B=K(770),U=[];G.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=U,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=U}registerHandler(D,j){this._handlers[D]===void 0&&(this._handlers[D]=[]);let V=this._handlers[D];return V.push(j),{dispose:()=>{let L=V.indexOf(j);L!==-1&&V.splice(L,1)}}}clearHandler(D){this._handlers[D]&&delete this._handlers[D]}setHandlerFallback(D){this._handlerFb=D}reset(){if(this._active.length)for(let D=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;D>=0;--D)this._active[D].unhook(!1);this._stack.paused=!1,this._active=U,this._ident=0}hook(D,j){if(this.reset(),this._ident=D,this._active=this._handlers[D]||U,this._active.length)for(let V=this._active.length-1;V>=0;V--)this._active[V].hook(j);else this._handlerFb(this._ident,"HOOK",j)}put(D,j,V){if(this._active.length)for(let L=this._active.length-1;L>=0;L--)this._active[L].put(D,j,V);else this._handlerFb(this._ident,"PUT",q.utf32ToString(D,j,V))}unhook(D,j=!0){if(this._active.length){let V=!1,L=this._active.length-1,F=!1;if(this._stack.paused&&(L=this._stack.loopPosition-1,V=j,F=this._stack.fallThrough,this._stack.paused=!1),!F&&V===!1){for(;L>=0&&(V=this._active[L].unhook(D),V!==!0);L--)if(V instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=L,this._stack.fallThrough=!1,V;L--}for(;L>=0;L--)if(V=this._active[L].unhook(!1),V instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=L,this._stack.fallThrough=!0,V}else this._handlerFb(this._ident,"UNHOOK",D);this._active=U,this._ident=0}};let R=new W.Params;R.addParam(0),G.DcsHandler=class{constructor(D){this._handler=D,this._data="",this._params=R,this._hitLimit=!1}hook(D){this._params=D.length>1||D.params[0]?D.clone():R,this._data="",this._hitLimit=!1}put(D,j,V){this._hitLimit||(this._data+=q.utf32ToString(D,j,V),this._data.length>B.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(D){let j=!1;if(this._hitLimit)j=!1;else if(D&&(j=this._handler(this._data,this._params),j instanceof Promise))return j.then((V)=>(this._params=R,this._data="",this._hitLimit=!1,V));return this._params=R,this._data="",this._hitLimit=!1,j}}},15:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.EscapeSequenceParser=G.VT500_TRANSITION_TABLE=G.TransitionTable=void 0;let q=K(844),W=K(742),B=K(242),U=K(351);class R{constructor(V){this.table=new Uint8Array(V)}setDefault(V,L){this.table.fill(V<<4|L)}add(V,L,F,N){this.table[L<<8|V]=F<<4|N}addMany(V,L,F,N){for(let O=0;O<V.length;O++)this.table[L<<8|V[O]]=F<<4|N}}G.TransitionTable=R;let D=160;G.VT500_TRANSITION_TABLE=function(){let V=new R(4095),L=Array.apply(null,Array(256)).map((w,Z)=>Z),F=(w,Z)=>L.slice(w,Z),N=F(32,127),O=F(0,24);O.push(25),O.push.apply(O,F(28,32));let A=F(0,14),I;for(I in V.setDefault(1,0),V.addMany(N,0,2,0),A)V.addMany([24,26,153,154],I,3,0),V.addMany(F(128,144),I,3,0),V.addMany(F(144,152),I,3,0),V.add(156,I,0,0),V.add(27,I,11,1),V.add(157,I,4,8),V.addMany([152,158,159],I,0,7),V.add(155,I,11,3),V.add(144,I,11,9);return V.addMany(O,0,3,0),V.addMany(O,1,3,1),V.add(127,1,0,1),V.addMany(O,8,0,8),V.addMany(O,3,3,3),V.add(127,3,0,3),V.addMany(O,4,3,4),V.add(127,4,0,4),V.addMany(O,6,3,6),V.addMany(O,5,3,5),V.add(127,5,0,5),V.addMany(O,2,3,2),V.add(127,2,0,2),V.add(93,1,4,8),V.addMany(N,8,5,8),V.add(127,8,5,8),V.addMany([156,27,24,26,7],8,6,0),V.addMany(F(28,32),8,0,8),V.addMany([88,94,95],1,0,7),V.addMany(N,7,0,7),V.addMany(O,7,0,7),V.add(156,7,0,0),V.add(127,7,0,7),V.add(91,1,11,3),V.addMany(F(64,127),3,7,0),V.addMany(F(48,60),3,8,4),V.addMany([60,61,62,63],3,9,4),V.addMany(F(48,60),4,8,4),V.addMany(F(64,127),4,7,0),V.addMany([60,61,62,63],4,0,6),V.addMany(F(32,64),6,0,6),V.add(127,6,0,6),V.addMany(F(64,127),6,0,0),V.addMany(F(32,48),3,9,5),V.addMany(F(32,48),5,9,5),V.addMany(F(48,64),5,0,6),V.addMany(F(64,127),5,7,0),V.addMany(F(32,48),4,9,5),V.addMany(F(32,48),1,9,2),V.addMany(F(32,48),2,9,2),V.addMany(F(48,127),2,10,0),V.addMany(F(48,80),1,10,0),V.addMany(F(81,88),1,10,0),V.addMany([89,90,92],1,10,0),V.addMany(F(96,127),1,10,0),V.add(80,1,11,9),V.addMany(O,9,0,9),V.add(127,9,0,9),V.addMany(F(28,32),9,0,9),V.addMany(F(32,48),9,9,12),V.addMany(F(48,60),9,8,10),V.addMany([60,61,62,63],9,9,10),V.addMany(O,11,0,11),V.addMany(F(32,128),11,0,11),V.addMany(F(28,32),11,0,11),V.addMany(O,10,0,10),V.add(127,10,0,10),V.addMany(F(28,32),10,0,10),V.addMany(F(48,60),10,8,10),V.addMany([60,61,62,63],10,0,11),V.addMany(F(32,48),10,9,12),V.addMany(O,12,0,12),V.add(127,12,0,12),V.addMany(F(28,32),12,0,12),V.addMany(F(32,48),12,9,12),V.addMany(F(48,64),12,0,11),V.addMany(F(64,127),12,12,13),V.addMany(F(64,127),10,12,13),V.addMany(F(64,127),9,12,13),V.addMany(O,13,13,13),V.addMany(N,13,13,13),V.add(127,13,0,13),V.addMany([27,156,24,26],13,14,0),V.add(D,0,2,0),V.add(D,8,5,8),V.add(D,6,0,6),V.add(D,11,0,11),V.add(D,13,13,13),V}();class j extends q.Disposable{constructor(V=G.VT500_TRANSITION_TABLE){super(),this._transitions=V,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new W.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(L,F,N)=>{},this._executeHandlerFb=(L)=>{},this._csiHandlerFb=(L,F)=>{},this._escHandlerFb=(L)=>{},this._errorHandlerFb=(L)=>L,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register(q.toDisposable(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new B.OscParser),this._dcsParser=this.register(new U.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(V,L=[64,126]){let F=0;if(V.prefix){if(V.prefix.length>1)throw new Error("only one byte as prefix supported");if(F=V.prefix.charCodeAt(0),F&&60>F||F>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(V.intermediates){if(V.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let O=0;O<V.intermediates.length;++O){let A=V.intermediates.charCodeAt(O);if(32>A||A>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");F<<=8,F|=A}}if(V.final.length!==1)throw new Error("final must be a single byte");let N=V.final.charCodeAt(0);if(L[0]>N||N>L[1])throw new Error(`final must be in range ${L[0]} .. ${L[1]}`);return F<<=8,F|=N,F}identToString(V){let L=[];for(;V;)L.push(String.fromCharCode(255&V)),V>>=8;return L.reverse().join("")}setPrintHandler(V){this._printHandler=V}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(V,L){let F=this._identifier(V,[48,126]);this._escHandlers[F]===void 0&&(this._escHandlers[F]=[]);let N=this._escHandlers[F];return N.push(L),{dispose:()=>{let O=N.indexOf(L);O!==-1&&N.splice(O,1)}}}clearEscHandler(V){this._escHandlers[this._identifier(V,[48,126])]&&delete this._escHandlers[this._identifier(V,[48,126])]}setEscHandlerFallback(V){this._escHandlerFb=V}setExecuteHandler(V,L){this._executeHandlers[V.charCodeAt(0)]=L}clearExecuteHandler(V){this._executeHandlers[V.charCodeAt(0)]&&delete this._executeHandlers[V.charCodeAt(0)]}setExecuteHandlerFallback(V){this._executeHandlerFb=V}registerCsiHandler(V,L){let F=this._identifier(V);this._csiHandlers[F]===void 0&&(this._csiHandlers[F]=[]);let N=this._csiHandlers[F];return N.push(L),{dispose:()=>{let O=N.indexOf(L);O!==-1&&N.splice(O,1)}}}clearCsiHandler(V){this._csiHandlers[this._identifier(V)]&&delete this._csiHandlers[this._identifier(V)]}setCsiHandlerFallback(V){this._csiHandlerFb=V}registerDcsHandler(V,L){return this._dcsParser.registerHandler(this._identifier(V),L)}clearDcsHandler(V){this._dcsParser.clearHandler(this._identifier(V))}setDcsHandlerFallback(V){this._dcsParser.setHandlerFallback(V)}registerOscHandler(V,L){return this._oscParser.registerHandler(V,L)}clearOscHandler(V){this._oscParser.clearHandler(V)}setOscHandlerFallback(V){this._oscParser.setHandlerFallback(V)}setErrorHandler(V){this._errorHandler=V}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(V,L,F,N,O){this._parseStack.state=V,this._parseStack.handlers=L,this._parseStack.handlerPos=F,this._parseStack.transition=N,this._parseStack.chunkPos=O}parse(V,L,F){let N,O=0,A=0,I=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,I=this._parseStack.chunkPos+1;else{if(F===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let w=this._parseStack.handlers,Z=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(F===!1&&Z>-1){for(;Z>=0&&(N=w[Z](this._params),N!==!0);Z--)if(N instanceof Promise)return this._parseStack.handlerPos=Z,N}this._parseStack.handlers=[];break;case 4:if(F===!1&&Z>-1){for(;Z>=0&&(N=w[Z](),N!==!0);Z--)if(N instanceof Promise)return this._parseStack.handlerPos=Z,N}this._parseStack.handlers=[];break;case 6:if(O=V[this._parseStack.chunkPos],N=this._dcsParser.unhook(O!==24&&O!==26,F),N)return N;O===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(O=V[this._parseStack.chunkPos],N=this._oscParser.end(O!==24&&O!==26,F),N)return N;O===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,I=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let w=I;w<L;++w){switch(O=V[w],A=this._transitions.table[this.currentState<<8|(O<160?O:D)],A>>4){case 2:for(let g=w+1;;++g){if(g>=L||(O=V[g])<32||O>126&&O<D){this._printHandler(V,w,g),w=g-1;break}if(++g>=L||(O=V[g])<32||O>126&&O<D){this._printHandler(V,w,g),w=g-1;break}if(++g>=L||(O=V[g])<32||O>126&&O<D){this._printHandler(V,w,g),w=g-1;break}if(++g>=L||(O=V[g])<32||O>126&&O<D){this._printHandler(V,w,g),w=g-1;break}}break;case 3:this._executeHandlers[O]?this._executeHandlers[O]():this._executeHandlerFb(O),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:w,code:O,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let Z=this._csiHandlers[this._collect<<8|O],k=Z?Z.length-1:-1;for(;k>=0&&(N=Z[k](this._params),N!==!0);k--)if(N instanceof Promise)return this._preserveStack(3,Z,k,A,w),N;k<0&&this._csiHandlerFb(this._collect<<8|O,this._params),this.precedingJoinState=0;break;case 8:do switch(O){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(O-48)}while(++w<L&&(O=V[w])>47&&O<60);w--;break;case 9:this._collect<<=8,this._collect|=O;break;case 10:let x=this._escHandlers[this._collect<<8|O],T=x?x.length-1:-1;for(;T>=0&&(N=x[T](),N!==!0);T--)if(N instanceof Promise)return this._preserveStack(4,x,T,A,w),N;T<0&&this._escHandlerFb(this._collect<<8|O),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|O,this._params);break;case 13:for(let g=w+1;;++g)if(g>=L||(O=V[g])===24||O===26||O===27||O>127&&O<D){this._dcsParser.put(V,w,g),w=g-1;break}break;case 14:if(N=this._dcsParser.unhook(O!==24&&O!==26),N)return this._preserveStack(6,[],0,A,w),N;O===27&&(A|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let g=w+1;;g++)if(g>=L||(O=V[g])<32||O>127&&O<D){this._oscParser.put(V,w,g),w=g-1;break}break;case 6:if(N=this._oscParser.end(O!==24&&O!==26),N)return this._preserveStack(5,[],0,A,w),N;O===27&&(A|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&A}}}G.EscapeSequenceParser=j},242:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.OscHandler=G.OscParser=void 0;let q=K(770),W=K(482),B=[];G.OscParser=class{constructor(){this._state=0,this._active=B,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(U,R){this._handlers[U]===void 0&&(this._handlers[U]=[]);let D=this._handlers[U];return D.push(R),{dispose:()=>{let j=D.indexOf(R);j!==-1&&D.splice(j,1)}}}clearHandler(U){this._handlers[U]&&delete this._handlers[U]}setHandlerFallback(U){this._handlerFb=U}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=B}reset(){if(this._state===2)for(let U=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;U>=0;--U)this._active[U].end(!1);this._stack.paused=!1,this._active=B,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||B,this._active.length)for(let U=this._active.length-1;U>=0;U--)this._active[U].start();else this._handlerFb(this._id,"START")}_put(U,R,D){if(this._active.length)for(let j=this._active.length-1;j>=0;j--)this._active[j].put(U,R,D);else this._handlerFb(this._id,"PUT",W.utf32ToString(U,R,D))}start(){this.reset(),this._state=1}put(U,R,D){if(this._state!==3){if(this._state===1)for(;R<D;){let j=U[R++];if(j===59){this._state=2,this._start();break}if(j<48||57<j)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+j-48}this._state===2&&D-R>0&&this._put(U,R,D)}}end(U,R=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let D=!1,j=this._active.length-1,V=!1;if(this._stack.paused&&(j=this._stack.loopPosition-1,D=R,V=this._stack.fallThrough,this._stack.paused=!1),!V&&D===!1){for(;j>=0&&(D=this._active[j].end(U),D!==!0);j--)if(D instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=j,this._stack.fallThrough=!1,D;j--}for(;j>=0;j--)if(D=this._active[j].end(!1),D instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=j,this._stack.fallThrough=!0,D}else this._handlerFb(this._id,"END",U);this._active=B,this._id=-1,this._state=0}}},G.OscHandler=class{constructor(U){this._handler=U,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(U,R,D){this._hitLimit||(this._data+=W.utf32ToString(U,R,D),this._data.length>q.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(U){let R=!1;if(this._hitLimit)R=!1;else if(U&&(R=this._handler(this._data),R instanceof Promise))return R.then((D)=>(this._data="",this._hitLimit=!1,D));return this._data="",this._hitLimit=!1,R}}},742:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.Params=void 0;let K=2147483647;class q{static fromArray(W){let B=new q;if(!W.length)return B;for(let U=Array.isArray(W[0])?1:0;U<W.length;++U){let R=W[U];if(Array.isArray(R))for(let D=0;D<R.length;++D)B.addSubParam(R[D]);else B.addParam(R)}return B}constructor(W=32,B=32){if(this.maxLength=W,this.maxSubParamsLength=B,B>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(W),this.length=0,this._subParams=new Int32Array(B),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(W),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){let W=new q(this.maxLength,this.maxSubParamsLength);return W.params.set(this.params),W.length=this.length,W._subParams.set(this._subParams),W._subParamsLength=this._subParamsLength,W._subParamsIdx.set(this._subParamsIdx),W._rejectDigits=this._rejectDigits,W._rejectSubDigits=this._rejectSubDigits,W._digitIsSub=this._digitIsSub,W}toArray(){let W=[];for(let B=0;B<this.length;++B){W.push(this.params[B]);let U=this._subParamsIdx[B]>>8,R=255&this._subParamsIdx[B];R-U>0&&W.push(Array.prototype.slice.call(this._subParams,U,R))}return W}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(W){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(W<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=W>K?K:W}}addSubParam(W){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(W<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=W>K?K:W,this._subParamsIdx[this.length-1]++}}hasSubParams(W){return(255&this._subParamsIdx[W])-(this._subParamsIdx[W]>>8)>0}getSubParams(W){let B=this._subParamsIdx[W]>>8,U=255&this._subParamsIdx[W];return U-B>0?this._subParams.subarray(B,U):null}getSubParamsAll(){let W={};for(let B=0;B<this.length;++B){let U=this._subParamsIdx[B]>>8,R=255&this._subParamsIdx[B];R-U>0&&(W[B]=this._subParams.slice(U,R))}return W}addDigit(W){let B;if(this._rejectDigits||!(B=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let U=this._digitIsSub?this._subParams:this.params,R=U[B-1];U[B-1]=~R?Math.min(10*R+W,K):W}}G.Params=q},741:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.AddonManager=void 0,G.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let K=this._addons.length-1;K>=0;K--)this._addons[K].instance.dispose()}loadAddon(K,q){let W={instance:q,dispose:q.dispose,isDisposed:!1};this._addons.push(W),q.dispose=()=>this._wrappedAddonDispose(W),q.activate(K)}_wrappedAddonDispose(K){if(K.isDisposed)return;let q=-1;for(let W=0;W<this._addons.length;W++)if(this._addons[W]===K){q=W;break}if(q===-1)throw new Error("Could not dispose an addon that has not been loaded");K.isDisposed=!0,K.dispose.apply(K.instance),this._addons.splice(q,1)}}},771:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.BufferApiView=void 0;let q=K(785),W=K(511);G.BufferApiView=class{constructor(B,U){this._buffer=B,this.type=U}init(B){return this._buffer=B,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(B){let U=this._buffer.lines.get(B);if(U)return new q.BufferLineApiView(U)}getNullCell(){return new W.CellData}}},785:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.BufferLineApiView=void 0;let q=K(511);G.BufferLineApiView=class{constructor(W){this._line=W}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(W,B){if(!(W<0||W>=this._line.length))return B?(this._line.loadCell(W,B),B):this._line.loadCell(W,new q.CellData)}translateToString(W,B,U){return this._line.translateToString(W,B,U)}}},285:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.BufferNamespaceApi=void 0;let q=K(771),W=K(460),B=K(844);class U extends B.Disposable{constructor(R){super(),this._core=R,this._onBufferChange=this.register(new W.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new q.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new q.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}G.BufferNamespaceApi=U},975:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.ParserApi=void 0,G.ParserApi=class{constructor(K){this._core=K}registerCsiHandler(K,q){return this._core.registerCsiHandler(K,(W)=>q(W.toArray()))}addCsiHandler(K,q){return this.registerCsiHandler(K,q)}registerDcsHandler(K,q){return this._core.registerDcsHandler(K,(W,B)=>q(W,B.toArray()))}addDcsHandler(K,q){return this.registerDcsHandler(K,q)}registerEscHandler(K,q){return this._core.registerEscHandler(K,q)}addEscHandler(K,q){return this.registerEscHandler(K,q)}registerOscHandler(K,q){return this._core.registerOscHandler(K,q)}addOscHandler(K,q){return this.registerOscHandler(K,q)}}},90:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.UnicodeApi=void 0,G.UnicodeApi=class{constructor(K){this._core=K}register(K){this._core.unicodeService.register(K)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(K){this._core.unicodeService.activeVersion=K}}},744:function(M,G,K){var q=this&&this.__decorate||function(V,L,F,N){var O,A=arguments.length,I=A<3?L:N===null?N=Object.getOwnPropertyDescriptor(L,F):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(V,L,F,N);else for(var w=V.length-1;w>=0;w--)(O=V[w])&&(I=(A<3?O(I):A>3?O(L,F,I):O(L,F))||I);return A>3&&I&&Object.defineProperty(L,F,I),I},W=this&&this.__param||function(V,L){return function(F,N){L(F,N,V)}};Object.defineProperty(G,"__esModule",{value:!0}),G.BufferService=G.MINIMUM_ROWS=G.MINIMUM_COLS=void 0;let B=K(460),U=K(844),R=K(295),D=K(585);G.MINIMUM_COLS=2,G.MINIMUM_ROWS=1;let j=G.BufferService=class extends U.Disposable{get buffer(){return this.buffers.active}constructor(V){super(),this.isUserScrolling=!1,this._onResize=this.register(new B.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new B.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(V.rawOptions.cols||0,G.MINIMUM_COLS),this.rows=Math.max(V.rawOptions.rows||0,G.MINIMUM_ROWS),this.buffers=this.register(new R.BufferSet(V,this))}resize(V,L){this.cols=V,this.rows=L,this.buffers.resize(V,L),this._onResize.fire({cols:V,rows:L})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(V,L=!1){let F=this.buffer,N;N=this._cachedBlankLine,N&&N.length===this.cols&&N.getFg(0)===V.fg&&N.getBg(0)===V.bg||(N=F.getBlankLine(V,L),this._cachedBlankLine=N),N.isWrapped=L;let O=F.ybase+F.scrollTop,A=F.ybase+F.scrollBottom;if(F.scrollTop===0){let I=F.lines.isFull;A===F.lines.length-1?I?F.lines.recycle().copyFrom(N):F.lines.push(N.clone()):F.lines.splice(A+1,0,N.clone()),I?this.isUserScrolling&&(F.ydisp=Math.max(F.ydisp-1,0)):(F.ybase++,this.isUserScrolling||F.ydisp++)}else{let I=A-O+1;F.lines.shiftElements(O+1,I-1,-1),F.lines.set(A,N.clone())}this.isUserScrolling||(F.ydisp=F.ybase),this._onScroll.fire(F.ydisp)}scrollLines(V,L,F){let N=this.buffer;if(V<0){if(N.ydisp===0)return;this.isUserScrolling=!0}else V+N.ydisp>=N.ybase&&(this.isUserScrolling=!1);let O=N.ydisp;N.ydisp=Math.max(Math.min(N.ydisp+V,N.ybase),0),O!==N.ydisp&&(L||this._onScroll.fire(N.ydisp))}};G.BufferService=j=q([W(0,D.IOptionsService)],j)},994:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.CharsetService=void 0,G.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(K){this.glevel=K,this.charset=this._charsets[K]}setgCharset(K,q){this._charsets[K]=q,this.glevel===K&&(this.charset=q)}}},753:function(M,G,K){var q=this&&this.__decorate||function(N,O,A,I){var w,Z=arguments.length,k=Z<3?O:I===null?I=Object.getOwnPropertyDescriptor(O,A):I;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")k=Reflect.decorate(N,O,A,I);else for(var x=N.length-1;x>=0;x--)(w=N[x])&&(k=(Z<3?w(k):Z>3?w(O,A,k):w(O,A))||k);return Z>3&&k&&Object.defineProperty(O,A,k),k},W=this&&this.__param||function(N,O){return function(A,I){O(A,I,N)}};Object.defineProperty(G,"__esModule",{value:!0}),G.CoreMouseService=void 0;let B=K(585),U=K(460),R=K(844),D={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:(N)=>N.button!==4&&N.action===1&&(N.ctrl=!1,N.alt=!1,N.shift=!1,!0)},VT200:{events:19,restrict:(N)=>N.action!==32},DRAG:{events:23,restrict:(N)=>N.action!==32||N.button!==3},ANY:{events:31,restrict:(N)=>!0}};function j(N,O){let A=(N.ctrl?16:0)|(N.shift?4:0)|(N.alt?8:0);return N.button===4?(A|=64,A|=N.action):(A|=3&N.button,4&N.button&&(A|=64),8&N.button&&(A|=128),N.action===32?A|=32:N.action!==0||O||(A|=3)),A}let V=String.fromCharCode,L={DEFAULT:(N)=>{let O=[j(N,!1)+32,N.col+32,N.row+32];return O[0]>255||O[1]>255||O[2]>255?"":`\x1B[M${V(O[0])}${V(O[1])}${V(O[2])}`},SGR:(N)=>{let O=N.action===0&&N.button!==4?"m":"M";return`\x1B[<${j(N,!0)};${N.col};${N.row}${O}`},SGR_PIXELS:(N)=>{let O=N.action===0&&N.button!==4?"m":"M";return`\x1B[<${j(N,!0)};${N.x};${N.y}${O}`}},F=G.CoreMouseService=class extends R.Disposable{constructor(N,O){super(),this._bufferService=N,this._coreService=O,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new U.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(let A of Object.keys(D))this.addProtocol(A,D[A]);for(let A of Object.keys(L))this.addEncoding(A,L[A]);this.reset()}addProtocol(N,O){this._protocols[N]=O}addEncoding(N,O){this._encodings[N]=O}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(N){if(!this._protocols[N])throw new Error(`unknown protocol "${N}"`);this._activeProtocol=N,this._onProtocolChange.fire(this._protocols[N].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(N){if(!this._encodings[N])throw new Error(`unknown encoding "${N}"`);this._activeEncoding=N}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(N){if(N.col<0||N.col>=this._bufferService.cols||N.row<0||N.row>=this._bufferService.rows)return!1;if(N.button===4&&N.action===32)return!1;if(N.button===3&&N.action!==32)return!1;if(N.button!==4&&(N.action===2||N.action===3))return!1;if(N.col++,N.row++,N.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,N,this._activeEncoding==="SGR_PIXELS"))return!1;if(!this._protocols[this._activeProtocol].restrict(N))return!1;let O=this._encodings[this._activeEncoding](N);return O&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(O):this._coreService.triggerDataEvent(O,!0)),this._lastEvent=N,!0}explainEvents(N){return{down:!!(1&N),up:!!(2&N),drag:!!(4&N),move:!!(8&N),wheel:!!(16&N)}}_equalEvents(N,O,A){if(A){if(N.x!==O.x)return!1;if(N.y!==O.y)return!1}else{if(N.col!==O.col)return!1;if(N.row!==O.row)return!1}return N.button===O.button&&N.action===O.action&&N.ctrl===O.ctrl&&N.alt===O.alt&&N.shift===O.shift}};G.CoreMouseService=F=q([W(0,B.IBufferService),W(1,B.ICoreService)],F)},83:function(M,G,K){var q=this&&this.__decorate||function(F,N,O,A){var I,w=arguments.length,Z=w<3?N:A===null?A=Object.getOwnPropertyDescriptor(N,O):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")Z=Reflect.decorate(F,N,O,A);else for(var k=F.length-1;k>=0;k--)(I=F[k])&&(Z=(w<3?I(Z):w>3?I(N,O,Z):I(N,O))||Z);return w>3&&Z&&Object.defineProperty(N,O,Z),Z},W=this&&this.__param||function(F,N){return function(O,A){N(O,A,F)}};Object.defineProperty(G,"__esModule",{value:!0}),G.CoreService=void 0;let B=K(439),U=K(460),R=K(844),D=K(585),j=Object.freeze({insertMode:!1}),V=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),L=G.CoreService=class extends R.Disposable{constructor(F,N,O){super(),this._bufferService=F,this._logService=N,this._optionsService=O,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new U.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new U.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new U.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new U.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=B.clone(j),this.decPrivateModes=B.clone(V)}reset(){this.modes=B.clone(j),this.decPrivateModes=B.clone(V)}triggerDataEvent(F,N=!1){if(this._optionsService.rawOptions.disableStdin)return;let O=this._bufferService.buffer;N&&this._optionsService.rawOptions.scrollOnUserInput&&O.ybase!==O.ydisp&&this._onRequestScrollToBottom.fire(),N&&this._onUserInput.fire(),this._logService.debug(`sending data "${F}"`,()=>F.split("").map((A)=>A.charCodeAt(0))),this._onData.fire(F)}triggerBinaryEvent(F){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${F}"`,()=>F.split("").map((N)=>N.charCodeAt(0))),this._onBinary.fire(F))}};G.CoreService=L=q([W(0,D.IBufferService),W(1,D.ILogService),W(2,D.IOptionsService)],L)},348:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.InstantiationService=G.ServiceCollection=void 0;let q=K(585),W=K(343);class B{constructor(...U){this._entries=new Map;for(let[R,D]of U)this.set(R,D)}set(U,R){let D=this._entries.get(U);return this._entries.set(U,R),D}forEach(U){for(let[R,D]of this._entries.entries())U(R,D)}has(U){return this._entries.has(U)}get(U){return this._entries.get(U)}}G.ServiceCollection=B,G.InstantiationService=class{constructor(){this._services=new B,this._services.set(q.IInstantiationService,this)}setService(U,R){this._services.set(U,R)}getService(U){return this._services.get(U)}createInstance(U,...R){let D=W.getServiceDependencies(U).sort((L,F)=>L.index-F.index),j=[];for(let L of D){let F=this._services.get(L.id);if(!F)throw new Error(`[createInstance] ${U.name} depends on UNKNOWN service ${L.id}.`);j.push(F)}let V=D.length>0?D[0].index:R.length;if(R.length!==V)throw new Error(`[createInstance] First service dependency of ${U.name} at position ${V+1} conflicts with ${R.length} static arguments`);return new U(...[...R,...j])}}},866:function(M,G,K){var q=this&&this.__decorate||function(V,L,F,N){var O,A=arguments.length,I=A<3?L:N===null?N=Object.getOwnPropertyDescriptor(L,F):N;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")I=Reflect.decorate(V,L,F,N);else for(var w=V.length-1;w>=0;w--)(O=V[w])&&(I=(A<3?O(I):A>3?O(L,F,I):O(L,F))||I);return A>3&&I&&Object.defineProperty(L,F,I),I},W=this&&this.__param||function(V,L){return function(F,N){L(F,N,V)}};Object.defineProperty(G,"__esModule",{value:!0}),G.traceCall=G.setTraceLogger=G.LogService=void 0;let B=K(844),U=K(585),R={trace:U.LogLevelEnum.TRACE,debug:U.LogLevelEnum.DEBUG,info:U.LogLevelEnum.INFO,warn:U.LogLevelEnum.WARN,error:U.LogLevelEnum.ERROR,off:U.LogLevelEnum.OFF},D,j=G.LogService=class extends B.Disposable{get logLevel(){return this._logLevel}constructor(V){super(),this._optionsService=V,this._logLevel=U.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),D=this}_updateLogLevel(){this._logLevel=R[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(V){for(let L=0;L<V.length;L++)typeof V[L]=="function"&&(V[L]=V[L]())}_log(V,L,F){this._evalLazyOptionalParams(F),V.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+L,...F)}trace(V,...L){this._logLevel<=U.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,V,L)}debug(V,...L){this._logLevel<=U.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,V,L)}info(V,...L){this._logLevel<=U.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,V,L)}warn(V,...L){this._logLevel<=U.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,V,L)}error(V,...L){this._logLevel<=U.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,V,L)}};G.LogService=j=q([W(0,U.IOptionsService)],j),G.setTraceLogger=function(V){D=V},G.traceCall=function(V,L,F){if(typeof F.value!="function")throw new Error("not supported");let N=F.value;F.value=function(...O){if(D.logLevel!==U.LogLevelEnum.TRACE)return N.apply(this,O);D.trace(`GlyphRenderer#${N.name}(${O.map((I)=>JSON.stringify(I)).join(", ")})`);let A=N.apply(this,O);return D.trace(`GlyphRenderer#${N.name} return`,A),A}}},302:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.OptionsService=G.DEFAULT_OPTIONS=void 0;let q=K(460),W=K(844),B=K(114);G.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1000,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:B.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};let U=["normal","bold","100","200","300","400","500","600","700","800","900"];class R extends W.Disposable{constructor(D){super(),this._onOptionChange=this.register(new q.EventEmitter),this.onOptionChange=this._onOptionChange.event;let j={...G.DEFAULT_OPTIONS};for(let V in D)if(V in j)try{let L=D[V];j[V]=this._sanitizeAndValidateOption(V,L)}catch(L){console.error(L)}this.rawOptions=j,this.options={...j},this._setupOptions(),this.register(W.toDisposable(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(D,j){return this.onOptionChange((V)=>{V===D&&j(this.rawOptions[D])})}onMultipleOptionChange(D,j){return this.onOptionChange((V)=>{D.indexOf(V)!==-1&&j()})}_setupOptions(){let D=(V)=>{if(!(V in G.DEFAULT_OPTIONS))throw new Error(`No option with key "${V}"`);return this.rawOptions[V]},j=(V,L)=>{if(!(V in G.DEFAULT_OPTIONS))throw new Error(`No option with key "${V}"`);L=this._sanitizeAndValidateOption(V,L),this.rawOptions[V]!==L&&(this.rawOptions[V]=L,this._onOptionChange.fire(V))};for(let V in this.rawOptions){let L={get:D.bind(this,V),set:j.bind(this,V)};Object.defineProperty(this.options,V,L)}}_sanitizeAndValidateOption(D,j){switch(D){case"cursorStyle":if(j||(j=G.DEFAULT_OPTIONS[D]),!function(V){return V==="block"||V==="underline"||V==="bar"}(j))throw new Error(`"${j}" is not a valid value for ${D}`);break;case"wordSeparator":j||(j=G.DEFAULT_OPTIONS[D]);break;case"fontWeight":case"fontWeightBold":if(typeof j=="number"&&1<=j&&j<=1000)break;j=U.includes(j)?j:G.DEFAULT_OPTIONS[D];break;case"cursorWidth":j=Math.floor(j);case"lineHeight":case"tabStopWidth":if(j<1)throw new Error(`${D} cannot be less than 1, value: ${j}`);break;case"minimumContrastRatio":j=Math.max(1,Math.min(21,Math.round(10*j)/10));break;case"scrollback":if((j=Math.min(j,4294967295))<0)throw new Error(`${D} cannot be less than 0, value: ${j}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(j<=0)throw new Error(`${D} cannot be less than or equal to 0, value: ${j}`);break;case"rows":case"cols":if(!j&&j!==0)throw new Error(`${D} must be numeric, value: ${j}`);break;case"windowsPty":j=j??{}}return j}}G.OptionsService=R},660:function(M,G,K){var q=this&&this.__decorate||function(R,D,j,V){var L,F=arguments.length,N=F<3?D:V===null?V=Object.getOwnPropertyDescriptor(D,j):V;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(R,D,j,V);else for(var O=R.length-1;O>=0;O--)(L=R[O])&&(N=(F<3?L(N):F>3?L(D,j,N):L(D,j))||N);return F>3&&N&&Object.defineProperty(D,j,N),N},W=this&&this.__param||function(R,D){return function(j,V){D(j,V,R)}};Object.defineProperty(G,"__esModule",{value:!0}),G.OscLinkService=void 0;let B=K(585),U=G.OscLinkService=class{constructor(R){this._bufferService=R,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(R){let D=this._bufferService.buffer;if(R.id===void 0){let O=D.addMarker(D.ybase+D.y),A={data:R,id:this._nextId++,lines:[O]};return O.onDispose(()=>this._removeMarkerFromLink(A,O)),this._dataByLinkId.set(A.id,A),A.id}let j=R,V=this._getEntryIdKey(j),L=this._entriesWithId.get(V);if(L)return this.addLineToLink(L.id,D.ybase+D.y),L.id;let F=D.addMarker(D.ybase+D.y),N={id:this._nextId++,key:this._getEntryIdKey(j),data:j,lines:[F]};return F.onDispose(()=>this._removeMarkerFromLink(N,F)),this._entriesWithId.set(N.key,N),this._dataByLinkId.set(N.id,N),N.id}addLineToLink(R,D){let j=this._dataByLinkId.get(R);if(j&&j.lines.every((V)=>V.line!==D)){let V=this._bufferService.buffer.addMarker(D);j.lines.push(V),V.onDispose(()=>this._removeMarkerFromLink(j,V))}}getLinkData(R){return this._dataByLinkId.get(R)?.data}_getEntryIdKey(R){return`${R.id};;${R.uri}`}_removeMarkerFromLink(R,D){let j=R.lines.indexOf(D);j!==-1&&(R.lines.splice(j,1),R.lines.length===0&&(R.data.id!==void 0&&this._entriesWithId.delete(R.key),this._dataByLinkId.delete(R.id)))}};G.OscLinkService=U=q([W(0,B.IBufferService)],U)},343:(M,G)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.createDecorator=G.getServiceDependencies=G.serviceRegistry=void 0;let K="di$target",q="di$dependencies";G.serviceRegistry=new Map,G.getServiceDependencies=function(W){return W[q]||[]},G.createDecorator=function(W){if(G.serviceRegistry.has(W))return G.serviceRegistry.get(W);let B=function(U,R,D){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(j,V,L){V[K]===V?V[q].push({id:j,index:L}):(V[q]=[{id:j,index:L}],V[K]=V)})(B,U,D)};return B.toString=()=>W,G.serviceRegistry.set(W,B),B}},585:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.IDecorationService=G.IUnicodeService=G.IOscLinkService=G.IOptionsService=G.ILogService=G.LogLevelEnum=G.IInstantiationService=G.ICharsetService=G.ICoreService=G.ICoreMouseService=G.IBufferService=void 0;let q=K(343);var W;G.IBufferService=q.createDecorator("BufferService"),G.ICoreMouseService=q.createDecorator("CoreMouseService"),G.ICoreService=q.createDecorator("CoreService"),G.ICharsetService=q.createDecorator("CharsetService"),G.IInstantiationService=q.createDecorator("InstantiationService"),function(B){B[B.TRACE=0]="TRACE",B[B.DEBUG=1]="DEBUG",B[B.INFO=2]="INFO",B[B.WARN=3]="WARN",B[B.ERROR=4]="ERROR",B[B.OFF=5]="OFF"}(W||(G.LogLevelEnum=W={})),G.ILogService=q.createDecorator("LogService"),G.IOptionsService=q.createDecorator("OptionsService"),G.IOscLinkService=q.createDecorator("OscLinkService"),G.IUnicodeService=q.createDecorator("UnicodeService"),G.IDecorationService=q.createDecorator("DecorationService")},480:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.UnicodeService=void 0;let q=K(460),W=K(225);class B{static extractShouldJoin(U){return(1&U)!=0}static extractWidth(U){return U>>1&3}static extractCharKind(U){return U>>3}static createPropertyValue(U,R,D=!1){return(16777215&U)<<3|(3&R)<<1|(D?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new q.EventEmitter,this.onChange=this._onChange.event;let U=new W.UnicodeV6;this.register(U),this._active=U.version,this._activeProvider=U}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(U){if(!this._providers[U])throw new Error(`unknown Unicode version "${U}"`);this._active=U,this._activeProvider=this._providers[U],this._onChange.fire(U)}register(U){this._providers[U.version]=U}wcwidth(U){return this._activeProvider.wcwidth(U)}getStringCellWidth(U){let R=0,D=0,j=U.length;for(let V=0;V<j;++V){let L=U.charCodeAt(V);if(55296<=L&&L<=56319){if(++V>=j)return R+this.wcwidth(L);let O=U.charCodeAt(V);56320<=O&&O<=57343?L=1024*(L-55296)+O-56320+65536:R+=this.wcwidth(O)}let F=this.charProperties(L,D),N=B.extractWidth(F);B.extractShouldJoin(F)&&(N-=B.extractWidth(D)),R+=N,D=F}return R}charProperties(U,R){return this._activeProvider.charProperties(U,R)}}G.UnicodeService=B},781:(M,G,K)=>{Object.defineProperty(G,"__esModule",{value:!0}),G.Terminal=void 0;let q=K(437),W=K(969),B=K(460);class U extends W.CoreTerminal{constructor(R={}){super(R),this._onBell=this.register(new B.EventEmitter),this.onBell=this._onBell.event,this._onCursorMove=this.register(new B.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onTitleChange=this.register(new B.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onA11yCharEmitter=this.register(new B.EventEmitter),this.onA11yChar=this._onA11yCharEmitter.event,this._onA11yTabEmitter=this.register(new B.EventEmitter),this.onA11yTab=this._onA11yTabEmitter.event,this._setup(),this.register(this._inputHandler.onRequestBell(()=>this.bell())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(B.forwardEvent(this._inputHandler.onCursorMove,this._onCursorMove)),this.register(B.forwardEvent(this._inputHandler.onTitleChange,this._onTitleChange)),this.register(B.forwardEvent(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register(B.forwardEvent(this._inputHandler.onA11yTab,this._onA11yTabEmitter))}get buffer(){return this.buffers.active}get markers(){return this.buffer.markers}addMarker(R){if(this.buffer===this.buffers.normal)return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+R)}bell(){this._onBell.fire()}input(R,D=!0){this.coreService.triggerDataEvent(R,D)}resize(R,D){R===this.cols&&D===this.rows||super.resize(R,D)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let R=1;R<this.rows;R++)this.buffer.lines.push(this.buffer.getBlankLine(q.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0})}}reset(){this.options.rows=this.rows,this.options.cols=this.cols,this._setup(),super.reset()}}G.Terminal=U}},J={};function Q(M){var G=J[M];if(G!==void 0)return G.exports;var K=J[M]={exports:{}};return $[M].call(K.exports,K,K.exports,Q),K.exports}var X={};(()=>{var M=X;Object.defineProperty(M,"__esModule",{value:!0}),M.Terminal=void 0;let G=Q(285),K=Q(975),q=Q(90),W=Q(781),B=Q(741),U=Q(844),R=["cols","rows"];class D extends U.Disposable{constructor(j){super(),this._core=this.register(new W.Terminal(j)),this._addonManager=this.register(new B.AddonManager),this._publicOptions={...this._core.options};let V=(F)=>this._core.options[F],L=(F,N)=>{this._checkReadonlyOptions(F),this._core.options[F]=N};for(let F in this._core.options){Object.defineProperty(this._publicOptions,F,{get:()=>this._core.options[F],set:(O)=>{this._checkReadonlyOptions(F),this._core.options[F]=O}});let N={get:V.bind(this,F),set:L.bind(this,F)};Object.defineProperty(this._publicOptions,F,N)}}_checkReadonlyOptions(j){if(R.includes(j))throw new Error(`Option "${j}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new K.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new q.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this.register(new G.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let j=this._core.coreService.decPrivateModes,V="none";switch(this._core.coreMouseService.activeProtocol){case"X10":V="x10";break;case"VT200":V="vt200";break;case"DRAG":V="drag";break;case"ANY":V="any"}return{applicationCursorKeysMode:j.applicationCursorKeys,applicationKeypadMode:j.applicationKeypad,bracketedPasteMode:j.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:V,originMode:j.origin,reverseWraparoundMode:j.reverseWraparound,sendFocusMode:j.sendFocus,wraparoundMode:j.wraparound}}get options(){return this._publicOptions}set options(j){for(let V in j)this._publicOptions[V]=j[V]}input(j,V=!0){this._core.input(j,V)}resize(j,V){this._verifyIntegers(j,V),this._core.resize(j,V)}registerMarker(j=0){return this._checkProposedApi(),this._verifyIntegers(j),this._core.addMarker(j)}addMarker(j){return this.registerMarker(j)}dispose(){super.dispose()}scrollLines(j){this._verifyIntegers(j),this._core.scrollLines(j)}scrollPages(j){this._verifyIntegers(j),this._core.scrollPages(j)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(j){this._verifyIntegers(j),this._core.scrollToLine(j)}clear(){this._core.clear()}write(j,V){this._core.write(j,V)}writeln(j,V){this._core.write(j),this._core.write(`\r
43
- `,V)}reset(){this._core.reset()}loadAddon(j){this._addonManager.loadAddon(this,j)}_verifyIntegers(...j){for(let V of j)if(V===1/0||isNaN(V)||V%1!=0)throw new Error("This API only accepts integers")}}M.Terminal=D})();var Y=NQ;for(var H in X)Y[H]=X[H];X.__esModule&&Object.defineProperty(Y,"__esModule",{value:!0})})()});var a1=n((_j,bQ)=>{var gQ=["nodebuffer","arraybuffer","fragments"],yQ=typeof Blob!=="undefined";if(yQ)gQ.push("blob");bQ.exports={BINARY_TYPES:gQ,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:yQ,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var T0=n((Zj,QJ)=>{var{EMPTY_BUFFER:v5}=a1(),F6=Buffer[Symbol.species];function k5($,J){if($.length===0)return v5;if($.length===1)return $[0];let Q=Buffer.allocUnsafe(J),X=0;for(let Y=0;Y<$.length;Y++){let H=$[Y];Q.set(H,X),X+=H.length}if(X<J)return new F6(Q.buffer,Q.byteOffset,X);return Q}function fQ($,J,Q,X,Y){for(let H=0;H<Y;H++)Q[X+H]=$[H]^J[H&3]}function mQ($,J){for(let Q=0;Q<$.length;Q++)$[Q]^=J[Q&3]}function h5($){if($.length===$.buffer.byteLength)return $.buffer;return $.buffer.slice($.byteOffset,$.byteOffset+$.length)}function D6($){if(D6.readOnly=!0,Buffer.isBuffer($))return $;let J;if($ instanceof ArrayBuffer)J=new F6($);else if(ArrayBuffer.isView($))J=new F6($.buffer,$.byteOffset,$.byteLength);else J=Buffer.from($),D6.readOnly=!1;return J}QJ.exports={concat:k5,mask:fQ,toArrayBuffer:h5,toBuffer:D6,unmask:mQ};if(!process.env.WS_NO_BUFFER_UTIL)try{let $=(()=>{throw new Error("Cannot require module "+"bufferutil");})();QJ.exports.mask=function(J,Q,X,Y,H){if(H<48)fQ(J,Q,X,Y,H);else $.mask(J,Q,X,Y,H)},QJ.exports.unmask=function(J,Q){if(J.length<32)mQ(J,Q);else $.unmask(J,Q)}}catch($){}});var pQ=n((Tj,cQ)=>{var uQ=Symbol("kDone"),O6=Symbol("kRun");class lQ{constructor($){this[uQ]=()=>{this.pending--,this[O6]()},this.concurrency=$||1/0,this.jobs=[],this.pending=0}add($){this.jobs.push($),this[O6]()}[O6](){if(this.pending===this.concurrency)return;if(this.jobs.length){let $=this.jobs.shift();this.pending++,$(this[uQ])}}}cQ.exports=lQ});var v0=n((xj,rQ)=>{var x0=require("zlib"),dQ=T0(),g5=pQ(),{kStatusCode:nQ}=a1(),y5=Buffer[Symbol.species],b5=Buffer.from([0,0,255,255]),YJ=Symbol("permessage-deflate"),s1=Symbol("total-length"),Q0=Symbol("callback"),V$=Symbol("buffers"),X0=Symbol("error"),XJ;class iQ{constructor($,J,Q){if(this._maxPayload=Q|0,this._options=$||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!J,this._deflate=null,this._inflate=null,this.params=null,!XJ){let X=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;XJ=new g5(X)}}static get extensionName(){return"permessage-deflate"}offer(){let $={};if(this._options.serverNoContextTakeover)$.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)$.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)$.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)$.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)$.client_max_window_bits=!0;return $}accept($){return $=this.normalizeParams($),this.params=this._isServer?this.acceptAsServer($):this.acceptAsClient($),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let $=this._deflate[Q0];if(this._deflate.close(),this._deflate=null,$)$(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer($){let J=this._options,Q=$.find((X)=>{if(J.serverNoContextTakeover===!1&&X.server_no_context_takeover||X.server_max_window_bits&&(J.serverMaxWindowBits===!1||typeof J.serverMaxWindowBits==="number"&&J.serverMaxWindowBits>X.server_max_window_bits)||typeof J.clientMaxWindowBits==="number"&&!X.client_max_window_bits)return!1;return!0});if(!Q)throw new Error("None of the extension offers can be accepted");if(J.serverNoContextTakeover)Q.server_no_context_takeover=!0;if(J.clientNoContextTakeover)Q.client_no_context_takeover=!0;if(typeof J.serverMaxWindowBits==="number")Q.server_max_window_bits=J.serverMaxWindowBits;if(typeof J.clientMaxWindowBits==="number")Q.client_max_window_bits=J.clientMaxWindowBits;else if(Q.client_max_window_bits===!0||J.clientMaxWindowBits===!1)delete Q.client_max_window_bits;return Q}acceptAsClient($){let J=$[0];if(this._options.clientNoContextTakeover===!1&&J.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!J.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")J.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&J.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return J}normalizeParams($){return $.forEach((J)=>{Object.keys(J).forEach((Q)=>{let X=J[Q];if(X.length>1)throw new Error(`Parameter "${Q}" must have only a single value`);if(X=X[0],Q==="client_max_window_bits"){if(X!==!0){let Y=+X;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`);X=Y}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`)}else if(Q==="server_max_window_bits"){let Y=+X;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`);X=Y}else if(Q==="client_no_context_takeover"||Q==="server_no_context_takeover"){if(X!==!0)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`)}else throw new Error(`Unknown parameter "${Q}"`);J[Q]=X})}),$}decompress($,J,Q){XJ.add((X)=>{this._decompress($,J,(Y,H)=>{X(),Q(Y,H)})})}compress($,J,Q){XJ.add((X)=>{this._compress($,J,(Y,H)=>{X(),Q(Y,H)})})}_decompress($,J,Q){let X=this._isServer?"client":"server";if(!this._inflate){let Y=`${X}_max_window_bits`,H=typeof this.params[Y]!=="number"?x0.Z_DEFAULT_WINDOWBITS:this.params[Y];this._inflate=x0.createInflateRaw({...this._options.zlibInflateOptions,windowBits:H}),this._inflate[YJ]=this,this._inflate[s1]=0,this._inflate[V$]=[],this._inflate.on("error",m5),this._inflate.on("data",oQ)}if(this._inflate[Q0]=Q,this._inflate.write($),J)this._inflate.write(b5);this._inflate.flush(()=>{let Y=this._inflate[X0];if(Y){this._inflate.close(),this._inflate=null,Q(Y);return}let H=dQ.concat(this._inflate[V$],this._inflate[s1]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[s1]=0,this._inflate[V$]=[],J&&this.params[`${X}_no_context_takeover`])this._inflate.reset();Q(null,H)})}_compress($,J,Q){let X=this._isServer?"server":"client";if(!this._deflate){let Y=`${X}_max_window_bits`,H=typeof this.params[Y]!=="number"?x0.Z_DEFAULT_WINDOWBITS:this.params[Y];this._deflate=x0.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:H}),this._deflate[s1]=0,this._deflate[V$]=[],this._deflate.on("data",f5)}this._deflate[Q0]=Q,this._deflate.write($),this._deflate.flush(x0.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let Y=dQ.concat(this._deflate[V$],this._deflate[s1]);if(J)Y=new y5(Y.buffer,Y.byteOffset,Y.length-4);if(this._deflate[Q0]=null,this._deflate[s1]=0,this._deflate[V$]=[],J&&this.params[`${X}_no_context_takeover`])this._deflate.reset();Q(null,Y)})}}rQ.exports=iQ;function f5($){this[V$].push($),this[s1]+=$.length}function oQ($){if(this[s1]+=$.length,this[YJ]._maxPayload<1||this[s1]<=this[YJ]._maxPayload){this[V$].push($);return}this[X0]=new RangeError("Max payload size exceeded"),this[X0].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[X0][nQ]=1009,this.removeListener("data",oQ),this.reset()}function m5($){if(this[YJ]._inflate=null,this[X0]){this[Q0](this[X0]);return}$[nQ]=1007,this[Q0]($)}});var Y0=n((vj,GJ)=>{var{isUtf8:aQ}=require("buffer"),{hasBlob:u5}=a1(),l5=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function c5($){return $>=1000&&$<=1014&&$!==1004&&$!==1005&&$!==1006||$>=3000&&$<=4999}function L6($){let J=$.length,Q=0;while(Q<J)if(($[Q]&128)===0)Q++;else if(($[Q]&224)===192){if(Q+1===J||($[Q+1]&192)!==128||($[Q]&254)===192)return!1;Q+=2}else if(($[Q]&240)===224){if(Q+2>=J||($[Q+1]&192)!==128||($[Q+2]&192)!==128||$[Q]===224&&($[Q+1]&224)===128||$[Q]===237&&($[Q+1]&224)===160)return!1;Q+=3}else if(($[Q]&248)===240){if(Q+3>=J||($[Q+1]&192)!==128||($[Q+2]&192)!==128||($[Q+3]&192)!==128||$[Q]===240&&($[Q+1]&240)===128||$[Q]===244&&$[Q+1]>143||$[Q]>244)return!1;Q+=4}else return!1;return!0}function p5($){return u5&&typeof $==="object"&&typeof $.arrayBuffer==="function"&&typeof $.type==="string"&&typeof $.stream==="function"&&($[Symbol.toStringTag]==="Blob"||$[Symbol.toStringTag]==="File")}GJ.exports={isBlob:p5,isValidStatusCode:c5,isValidUTF8:L6,tokenChars:l5};if(aQ)GJ.exports.isValidUTF8=function($){return $.length<24?L6($):aQ($)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let $=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();GJ.exports.isValidUTF8=function(J){return J.length<32?L6(J):$(J)}}catch($){}});var A6=n((kj,JX)=>{var{Writable:d5}=require("stream"),sQ=v0(),{BINARY_TYPES:n5,EMPTY_BUFFER:tQ,kStatusCode:i5,kWebSocket:o5}=a1(),{concat:E6,toArrayBuffer:r5,unmask:a5}=T0(),{isValidStatusCode:s5,isValidUTF8:eQ}=Y0(),HJ=Buffer[Symbol.species];class $X extends d5{constructor($={}){super();this._allowSynchronousEvents=$.allowSynchronousEvents!==void 0?$.allowSynchronousEvents:!0,this._binaryType=$.binaryType||n5[0],this._extensions=$.extensions||{},this._isServer=!!$.isServer,this._maxPayload=$.maxPayload|0,this._skipUTF8Validation=!!$.skipUTF8Validation,this[o5]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write($,J,Q){if(this._opcode===8&&this._state==0)return Q();this._bufferedBytes+=$.length,this._buffers.push($),this.startLoop(Q)}consume($){if(this._bufferedBytes-=$,$===this._buffers[0].length)return this._buffers.shift();if($<this._buffers[0].length){let Q=this._buffers[0];return this._buffers[0]=new HJ(Q.buffer,Q.byteOffset+$,Q.length-$),new HJ(Q.buffer,Q.byteOffset,$)}let J=Buffer.allocUnsafe($);do{let Q=this._buffers[0],X=J.length-$;if($>=Q.length)J.set(this._buffers.shift(),X);else J.set(new Uint8Array(Q.buffer,Q.byteOffset,$),X),this._buffers[0]=new HJ(Q.buffer,Q.byteOffset+$,Q.length-$);$-=Q.length}while($>0);return J}startLoop($){this._loop=!0;do switch(this._state){case 0:this.getInfo($);break;case 1:this.getPayloadLength16($);break;case 2:this.getPayloadLength64($);break;case 3:this.getMask();break;case 4:this.getData($);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)$()}getInfo($){if(this._bufferedBytes<2){this._loop=!1;return}let J=this.consume(2);if((J[0]&48)!==0){let X=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");$(X);return}let Q=(J[0]&64)===64;if(Q&&!this._extensions[sQ.extensionName]){let X=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(X);return}if(this._fin=(J[0]&128)===128,this._opcode=J[0]&15,this._payloadLength=J[1]&127,this._opcode===0){if(Q){let X=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(X);return}if(!this._fragmented){let X=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");$(X);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let X=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(X);return}this._compressed=Q}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let X=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");$(X);return}if(Q){let X=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(X);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let X=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");$(X);return}}else{let X=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(X);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(J[1]&128)===128,this._isServer){if(!this._masked){let X=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");$(X);return}}else if(this._masked){let X=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");$(X);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength($)}getPayloadLength16($){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength($)}getPayloadLength64($){if(this._bufferedBytes<8){this._loop=!1;return}let J=this.consume(8),Q=J.readUInt32BE(0);if(Q>Math.pow(2,21)-1){let X=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");$(X);return}this._payloadLength=Q*Math.pow(2,32)+J.readUInt32BE(4),this.haveLength($)}haveLength($){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let J=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");$(J);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData($){let J=tQ;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(J=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)a5(J,this._mask)}if(this._opcode>7){this.controlMessage(J,$);return}if(this._compressed){this._state=5,this.decompress(J,$);return}if(J.length)this._messageLength=this._totalPayloadLength,this._fragments.push(J);this.dataMessage($)}decompress($,J){this._extensions[sQ.extensionName].decompress($,this._fin,(X,Y)=>{if(X)return J(X);if(Y.length){if(this._messageLength+=Y.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let H=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");J(H);return}this._fragments.push(Y)}if(this.dataMessage(J),this._state===0)this.startLoop(J)})}dataMessage($){if(!this._fin){this._state=0;return}let J=this._messageLength,Q=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let X;if(this._binaryType==="nodebuffer")X=E6(Q,J);else if(this._binaryType==="arraybuffer")X=r5(E6(Q,J));else if(this._binaryType==="blob")X=new Blob(Q);else X=Q;if(this._allowSynchronousEvents)this.emit("message",X,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",X,!0),this._state=0,this.startLoop($)})}else{let X=E6(Q,J);if(!this._skipUTF8Validation&&!eQ(X)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");$(Y);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",X,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",X,!1),this._state=0,this.startLoop($)})}}controlMessage($,J){if(this._opcode===8){if($.length===0)this._loop=!1,this.emit("conclude",1005,tQ),this.end();else{let Q=$.readUInt16BE(0);if(!s5(Q)){let Y=this.createError(RangeError,`invalid status code ${Q}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");J(Y);return}let X=new HJ($.buffer,$.byteOffset+2,$.length-2);if(!this._skipUTF8Validation&&!eQ(X)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");J(Y);return}this._loop=!1,this.emit("conclude",Q,X),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",$),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",$),this._state=0,this.startLoop(J)})}createError($,J,Q,X,Y){this._loop=!1,this._errored=!0;let H=new $(Q?`Invalid WebSocket frame: ${J}`:J);return Error.captureStackTrace(H,this.createError),H.code=Y,H[i5]=X,H}}JX.exports=$X});var S6=n((gj,YX)=>{var{Duplex:hj}=require("stream"),{randomFillSync:t5}=require("crypto"),QX=v0(),{EMPTY_BUFFER:e5,kWebSocket:$7,NOOP:J7}=a1(),{isBlob:G0,isValidStatusCode:Q7}=Y0(),{mask:XX,toBuffer:C$}=T0(),z1=Symbol("kByteLength"),X7=Buffer.alloc(4),w$,H0=8192,v1=0,Y7=1,G7=2;class K${constructor($,J,Q){if(this._extensions=J||{},Q)this._generateMask=Q,this._maskBuffer=Buffer.alloc(4);this._socket=$,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=v1,this.onerror=J7,this[$7]=void 0}static frame($,J){let Q,X=!1,Y=2,H=!1;if(J.mask){if(Q=J.maskBuffer||X7,J.generateMask)J.generateMask(Q);else{if(H0===8192){if(w$===void 0)w$=Buffer.alloc(8192);t5(w$,0,8192),H0=0}Q[0]=w$[H0++],Q[1]=w$[H0++],Q[2]=w$[H0++],Q[3]=w$[H0++]}H=(Q[0]|Q[1]|Q[2]|Q[3])===0,Y=6}let M;if(typeof $==="string")if((!J.mask||H)&&J[z1]!==void 0)M=J[z1];else $=Buffer.from($),M=$.length;else M=$.length,X=J.mask&&J.readOnly&&!H;let G=M;if(M>=65536)Y+=8,G=127;else if(M>125)Y+=2,G=126;let K=Buffer.allocUnsafe(X?M+Y:Y);if(K[0]=J.fin?J.opcode|128:J.opcode,J.rsv1)K[0]|=64;if(K[1]=G,G===126)K.writeUInt16BE(M,2);else if(G===127)K[2]=K[3]=0,K.writeUIntBE(M,4,6);if(!J.mask)return[K,$];if(K[1]|=128,K[Y-4]=Q[0],K[Y-3]=Q[1],K[Y-2]=Q[2],K[Y-1]=Q[3],H)return[K,$];if(X)return XX($,Q,K,Y,M),[K];return XX($,Q,$,0,M),[K,$]}close($,J,Q,X){let Y;if($===void 0)Y=e5;else if(typeof $!=="number"||!Q7($))throw new TypeError("First argument must be a valid error code number");else if(J===void 0||!J.length)Y=Buffer.allocUnsafe(2),Y.writeUInt16BE($,0);else{let M=Buffer.byteLength(J);if(M>123)throw new RangeError("The message must not be greater than 123 bytes");if(Y=Buffer.allocUnsafe(2+M),Y.writeUInt16BE($,0),typeof J==="string")Y.write(J,2);else Y.set(J,2)}let H={[z1]:Y.length,fin:!0,generateMask:this._generateMask,mask:Q,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==v1)this.enqueue([this.dispatch,Y,!1,H,X]);else this.sendFrame(K$.frame(Y,H),X)}ping($,J,Q){let X,Y;if(typeof $==="string")X=Buffer.byteLength($),Y=!1;else if(G0($))X=$.size,Y=!1;else $=C$($),X=$.length,Y=C$.readOnly;if(X>125)throw new RangeError("The data size must not be greater than 125 bytes");let H={[z1]:X,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:9,readOnly:Y,rsv1:!1};if(G0($))if(this._state!==v1)this.enqueue([this.getBlobData,$,!1,H,Q]);else this.getBlobData($,!1,H,Q);else if(this._state!==v1)this.enqueue([this.dispatch,$,!1,H,Q]);else this.sendFrame(K$.frame($,H),Q)}pong($,J,Q){let X,Y;if(typeof $==="string")X=Buffer.byteLength($),Y=!1;else if(G0($))X=$.size,Y=!1;else $=C$($),X=$.length,Y=C$.readOnly;if(X>125)throw new RangeError("The data size must not be greater than 125 bytes");let H={[z1]:X,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:10,readOnly:Y,rsv1:!1};if(G0($))if(this._state!==v1)this.enqueue([this.getBlobData,$,!1,H,Q]);else this.getBlobData($,!1,H,Q);else if(this._state!==v1)this.enqueue([this.dispatch,$,!1,H,Q]);else this.sendFrame(K$.frame($,H),Q)}send($,J,Q){let X=this._extensions[QX.extensionName],Y=J.binary?2:1,H=J.compress,M,G;if(typeof $==="string")M=Buffer.byteLength($),G=!1;else if(G0($))M=$.size,G=!1;else $=C$($),M=$.length,G=C$.readOnly;if(this._firstFragment){if(this._firstFragment=!1,H&&X&&X.params[X._isServer?"server_no_context_takeover":"client_no_context_takeover"])H=M>=X._threshold;this._compress=H}else H=!1,Y=0;if(J.fin)this._firstFragment=!0;let K={[z1]:M,fin:J.fin,generateMask:this._generateMask,mask:J.mask,maskBuffer:this._maskBuffer,opcode:Y,readOnly:G,rsv1:H};if(G0($))if(this._state!==v1)this.enqueue([this.getBlobData,$,this._compress,K,Q]);else this.getBlobData($,this._compress,K,Q);else if(this._state!==v1)this.enqueue([this.dispatch,$,this._compress,K,Q]);else this.dispatch($,this._compress,K,Q)}getBlobData($,J,Q,X){this._bufferedBytes+=Q[z1],this._state=G7,$.arrayBuffer().then((Y)=>{if(this._socket.destroyed){let M=new Error("The socket was closed while the blob was being read");process.nextTick(I6,this,M,X);return}this._bufferedBytes-=Q[z1];let H=C$(Y);if(!J)this._state=v1,this.sendFrame(K$.frame(H,Q),X),this.dequeue();else this.dispatch(H,J,Q,X)}).catch((Y)=>{process.nextTick(H7,this,Y,X)})}dispatch($,J,Q,X){if(!J){this.sendFrame(K$.frame($,Q),X);return}let Y=this._extensions[QX.extensionName];this._bufferedBytes+=Q[z1],this._state=Y7,Y.compress($,Q.fin,(H,M)=>{if(this._socket.destroyed){let G=new Error("The socket was closed while data was being compressed");I6(this,G,X);return}this._bufferedBytes-=Q[z1],this._state=v1,Q.readOnly=!1,this.sendFrame(K$.frame(M,Q),X),this.dequeue()})}dequeue(){while(this._state===v1&&this._queue.length){let $=this._queue.shift();this._bufferedBytes-=$[3][z1],Reflect.apply($[0],this,$.slice(1))}}enqueue($){this._bufferedBytes+=$[3][z1],this._queue.push($)}sendFrame($,J){if($.length===2)this._socket.cork(),this._socket.write($[0]),this._socket.write($[1],J),this._socket.uncork();else this._socket.write($[0],J)}}YX.exports=K$;function I6($,J,Q){if(typeof Q==="function")Q(J);for(let X=0;X<$._queue.length;X++){let Y=$._queue[X],H=Y[Y.length-1];if(typeof H==="function")H(J)}}function H7($,J,Q){I6($,J,Q),$.onerror(J)}});var MX=n((yj,qX)=>{var{kForOnEventAttribute:k0,kListener:z6}=a1(),GX=Symbol("kCode"),HX=Symbol("kData"),jX=Symbol("kError"),VX=Symbol("kMessage"),KX=Symbol("kReason"),j0=Symbol("kTarget"),RX=Symbol("kType"),WX=Symbol("kWasClean");class R${constructor($){this[j0]=null,this[RX]=$}get target(){return this[j0]}get type(){return this[RX]}}Object.defineProperty(R$.prototype,"target",{enumerable:!0});Object.defineProperty(R$.prototype,"type",{enumerable:!0});class V0 extends R${constructor($,J={}){super($);this[GX]=J.code===void 0?0:J.code,this[KX]=J.reason===void 0?"":J.reason,this[WX]=J.wasClean===void 0?!1:J.wasClean}get code(){return this[GX]}get reason(){return this[KX]}get wasClean(){return this[WX]}}Object.defineProperty(V0.prototype,"code",{enumerable:!0});Object.defineProperty(V0.prototype,"reason",{enumerable:!0});Object.defineProperty(V0.prototype,"wasClean",{enumerable:!0});class h0 extends R${constructor($,J={}){super($);this[jX]=J.error===void 0?null:J.error,this[VX]=J.message===void 0?"":J.message}get error(){return this[jX]}get message(){return this[VX]}}Object.defineProperty(h0.prototype,"error",{enumerable:!0});Object.defineProperty(h0.prototype,"message",{enumerable:!0});class VJ extends R${constructor($,J={}){super($);this[HX]=J.data===void 0?null:J.data}get data(){return this[HX]}}Object.defineProperty(VJ.prototype,"data",{enumerable:!0});var j7={addEventListener($,J,Q={}){for(let Y of this.listeners($))if(!Q[k0]&&Y[z6]===J&&!Y[k0])return;let X;if($==="message")X=function Y(H,M){let G=new VJ("message",{data:M?H:H.toString()});G[j0]=this,jJ(J,this,G)};else if($==="close")X=function Y(H,M){let G=new V0("close",{code:H,reason:M.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});G[j0]=this,jJ(J,this,G)};else if($==="error")X=function Y(H){let M=new h0("error",{error:H,message:H.message});M[j0]=this,jJ(J,this,M)};else if($==="open")X=function Y(){let H=new R$("open");H[j0]=this,jJ(J,this,H)};else return;if(X[k0]=!!Q[k0],X[z6]=J,Q.once)this.once($,X);else this.on($,X)},removeEventListener($,J){for(let Q of this.listeners($))if(Q[z6]===J&&!Q[k0]){this.removeListener($,Q);break}}};qX.exports={CloseEvent:V0,ErrorEvent:h0,Event:R$,EventTarget:j7,MessageEvent:VJ};function jJ($,J,Q){if(typeof $==="object"&&$.handleEvent)$.handleEvent.call($,Q);else $.call(J,Q)}});var P6=n((bj,BX)=>{var{tokenChars:g0}=Y0();function c1($,J,Q){if($[J]===void 0)$[J]=[Q];else $[J].push(Q)}function V7($){let J=Object.create(null),Q=Object.create(null),X=!1,Y=!1,H=!1,M,G,K=-1,q=-1,W=-1,B=0;for(;B<$.length;B++)if(q=$.charCodeAt(B),M===void 0)if(W===-1&&g0[q]===1){if(K===-1)K=B}else if(B!==0&&(q===32||q===9)){if(W===-1&&K!==-1)W=B}else if(q===59||q===44){if(K===-1)throw new SyntaxError(`Unexpected character at index ${B}`);if(W===-1)W=B;let R=$.slice(K,W);if(q===44)c1(J,R,Q),Q=Object.create(null);else M=R;K=W=-1}else throw new SyntaxError(`Unexpected character at index ${B}`);else if(G===void 0)if(W===-1&&g0[q]===1){if(K===-1)K=B}else if(q===32||q===9){if(W===-1&&K!==-1)W=B}else if(q===59||q===44){if(K===-1)throw new SyntaxError(`Unexpected character at index ${B}`);if(W===-1)W=B;if(c1(Q,$.slice(K,W),!0),q===44)c1(J,M,Q),Q=Object.create(null),M=void 0;K=W=-1}else if(q===61&&K!==-1&&W===-1)G=$.slice(K,B),K=W=-1;else throw new SyntaxError(`Unexpected character at index ${B}`);else if(Y){if(g0[q]!==1)throw new SyntaxError(`Unexpected character at index ${B}`);if(K===-1)K=B;else if(!X)X=!0;Y=!1}else if(H)if(g0[q]===1){if(K===-1)K=B}else if(q===34&&K!==-1)H=!1,W=B;else if(q===92)Y=!0;else throw new SyntaxError(`Unexpected character at index ${B}`);else if(q===34&&$.charCodeAt(B-1)===61)H=!0;else if(W===-1&&g0[q]===1){if(K===-1)K=B}else if(K!==-1&&(q===32||q===9)){if(W===-1)W=B}else if(q===59||q===44){if(K===-1)throw new SyntaxError(`Unexpected character at index ${B}`);if(W===-1)W=B;let R=$.slice(K,W);if(X)R=R.replace(/\\/g,""),X=!1;if(c1(Q,G,R),q===44)c1(J,M,Q),Q=Object.create(null),M=void 0;G=void 0,K=W=-1}else throw new SyntaxError(`Unexpected character at index ${B}`);if(K===-1||H||q===32||q===9)throw new SyntaxError("Unexpected end of input");if(W===-1)W=B;let U=$.slice(K,W);if(M===void 0)c1(J,U,Q);else{if(G===void 0)c1(Q,U,!0);else if(X)c1(Q,G,U.replace(/\\/g,""));else c1(Q,G,U);c1(J,M,Q)}return J}function K7($){return Object.keys($).map((J)=>{let Q=$[J];if(!Array.isArray(Q))Q=[Q];return Q.map((X)=>{return[J].concat(Object.keys(X).map((Y)=>{let H=X[Y];if(!Array.isArray(H))H=[H];return H.map((M)=>M===!0?Y:`${Y}=${M}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}BX.exports={format:K7,parse:V7}});var qJ=n((uj,PX)=>{var R7=require("events"),W7=require("https"),q7=require("http"),FX=require("net"),M7=require("tls"),{randomBytes:B7,createHash:N7}=require("crypto"),{Duplex:fj,Readable:mj}=require("stream"),{URL:C6}=require("url"),W$=v0(),U7=A6(),F7=S6(),{isBlob:D7}=Y0(),{BINARY_TYPES:NX,EMPTY_BUFFER:KJ,GUID:O7,kForOnEventAttribute:w6,kListener:L7,kStatusCode:E7,kWebSocket:W1,NOOP:DX}=a1(),{EventTarget:{addEventListener:A7,removeEventListener:I7}}=MX(),{format:S7,parse:z7}=P6(),{toBuffer:P7}=T0(),OX=Symbol("kAborted"),_6=[8,13],t1=["CONNECTING","OPEN","CLOSING","CLOSED"],C7=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class p extends R7{constructor($,J,Q){super();if(this._binaryType=NX[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=KJ,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=p.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,$!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,J===void 0)J=[];else if(!Array.isArray(J))if(typeof J==="object"&&J!==null)Q=J,J=[];else J=[J];LX(this,$,J,Q)}else this._autoPong=Q.autoPong,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType($){if(!NX.includes($))return;if(this._binaryType=$,this._receiver)this._receiver._binaryType=$}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket($,J,Q){let X=new U7({allowSynchronousEvents:Q.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:Q.maxPayload,skipUTF8Validation:Q.skipUTF8Validation}),Y=new F7($,this._extensions,Q.generateMask);if(this._receiver=X,this._sender=Y,this._socket=$,X[W1]=this,Y[W1]=this,$[W1]=this,X.on("conclude",Z7),X.on("drain",T7),X.on("error",x7),X.on("message",v7),X.on("ping",k7),X.on("pong",h7),Y.onerror=g7,$.setTimeout)$.setTimeout(0);if($.setNoDelay)$.setNoDelay();if(J.length>0)$.unshift(J);$.on("close",IX),$.on("data",WJ),$.on("end",SX),$.on("error",zX),this._readyState=p.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=p.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[W$.extensionName])this._extensions[W$.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=p.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close($,J){if(this.readyState===p.CLOSED)return;if(this.readyState===p.CONNECTING){A1(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===p.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=p.CLOSING,this._sender.close($,J,!this._isServer,(Q)=>{if(Q)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),AX(this)}pause(){if(this.readyState===p.CONNECTING||this.readyState===p.CLOSED)return;this._paused=!0,this._socket.pause()}ping($,J,Q){if(this.readyState===p.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")Q=$,$=J=void 0;else if(typeof J==="function")Q=J,J=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==p.OPEN){Z6(this,$,Q);return}if(J===void 0)J=!this._isServer;this._sender.ping($||KJ,J,Q)}pong($,J,Q){if(this.readyState===p.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")Q=$,$=J=void 0;else if(typeof J==="function")Q=J,J=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==p.OPEN){Z6(this,$,Q);return}if(J===void 0)J=!this._isServer;this._sender.pong($||KJ,J,Q)}resume(){if(this.readyState===p.CONNECTING||this.readyState===p.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send($,J,Q){if(this.readyState===p.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")Q=J,J={};if(typeof $==="number")$=$.toString();if(this.readyState!==p.OPEN){Z6(this,$,Q);return}let X={binary:typeof $!=="string",mask:!this._isServer,compress:!0,fin:!0,...J};if(!this._extensions[W$.extensionName])X.compress=!1;this._sender.send($||KJ,X,Q)}terminate(){if(this.readyState===p.CLOSED)return;if(this.readyState===p.CONNECTING){A1(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=p.CLOSING,this._socket.destroy()}}Object.defineProperty(p,"CONNECTING",{enumerable:!0,value:t1.indexOf("CONNECTING")});Object.defineProperty(p.prototype,"CONNECTING",{enumerable:!0,value:t1.indexOf("CONNECTING")});Object.defineProperty(p,"OPEN",{enumerable:!0,value:t1.indexOf("OPEN")});Object.defineProperty(p.prototype,"OPEN",{enumerable:!0,value:t1.indexOf("OPEN")});Object.defineProperty(p,"CLOSING",{enumerable:!0,value:t1.indexOf("CLOSING")});Object.defineProperty(p.prototype,"CLOSING",{enumerable:!0,value:t1.indexOf("CLOSING")});Object.defineProperty(p,"CLOSED",{enumerable:!0,value:t1.indexOf("CLOSED")});Object.defineProperty(p.prototype,"CLOSED",{enumerable:!0,value:t1.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(($)=>{Object.defineProperty(p.prototype,$,{enumerable:!0})});["open","error","close","message"].forEach(($)=>{Object.defineProperty(p.prototype,`on${$}`,{enumerable:!0,get(){for(let J of this.listeners($))if(J[w6])return J[L7];return null},set(J){for(let Q of this.listeners($))if(Q[w6]){this.removeListener($,Q);break}if(typeof J!=="function")return;this.addEventListener($,J,{[w6]:!0})}})});p.prototype.addEventListener=A7;p.prototype.removeEventListener=I7;PX.exports=p;function LX($,J,Q,X){let Y={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:_6[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...X,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if($._autoPong=Y.autoPong,!_6.includes(Y.protocolVersion))throw new RangeError(`Unsupported protocol version: ${Y.protocolVersion} (supported versions: ${_6.join(", ")})`);let H;if(J instanceof C6)H=J;else try{H=new C6(J)}catch(j){throw new SyntaxError(`Invalid URL: ${J}`)}if(H.protocol==="http:")H.protocol="ws:";else if(H.protocol==="https:")H.protocol="wss:";$._url=H.href;let M=H.protocol==="wss:",G=H.protocol==="ws+unix:",K;if(H.protocol!=="ws:"&&!M&&!G)K=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(G&&!H.pathname)K="The URL's pathname is empty";else if(H.hash)K="The URL contains a fragment identifier";if(K){let j=new SyntaxError(K);if($._redirects===0)throw j;else{RJ($,j);return}}let q=M?443:80,W=B7(16).toString("base64"),B=M?W7.request:q7.request,U=new Set,R;if(Y.createConnection=Y.createConnection||(M?_7:w7),Y.defaultPort=Y.defaultPort||q,Y.port=H.port||q,Y.host=H.hostname.startsWith("[")?H.hostname.slice(1,-1):H.hostname,Y.headers={...Y.headers,"Sec-WebSocket-Version":Y.protocolVersion,"Sec-WebSocket-Key":W,Connection:"Upgrade",Upgrade:"websocket"},Y.path=H.pathname+H.search,Y.timeout=Y.handshakeTimeout,Y.perMessageDeflate)R=new W$(Y.perMessageDeflate!==!0?Y.perMessageDeflate:{},!1,Y.maxPayload),Y.headers["Sec-WebSocket-Extensions"]=S7({[W$.extensionName]:R.offer()});if(Q.length){for(let j of Q){if(typeof j!=="string"||!C7.test(j)||U.has(j))throw new SyntaxError("An invalid or duplicated subprotocol was specified");U.add(j)}Y.headers["Sec-WebSocket-Protocol"]=Q.join(",")}if(Y.origin)if(Y.protocolVersion<13)Y.headers["Sec-WebSocket-Origin"]=Y.origin;else Y.headers.Origin=Y.origin;if(H.username||H.password)Y.auth=`${H.username}:${H.password}`;if(G){let j=Y.path.split(":");Y.socketPath=j[0],Y.path=j[1]}let D;if(Y.followRedirects){if($._redirects===0){$._originalIpc=G,$._originalSecure=M,$._originalHostOrSocketPath=G?Y.socketPath:H.host;let j=X&&X.headers;if(X={...X,headers:{}},j)for(let[V,L]of Object.entries(j))X.headers[V.toLowerCase()]=L}else if($.listenerCount("redirect")===0){let j=G?$._originalIpc?Y.socketPath===$._originalHostOrSocketPath:!1:$._originalIpc?!1:H.host===$._originalHostOrSocketPath;if(!j||$._originalSecure&&!M){if(delete Y.headers.authorization,delete Y.headers.cookie,!j)delete Y.headers.host;Y.auth=void 0}}if(Y.auth&&!X.headers.authorization)X.headers.authorization="Basic "+Buffer.from(Y.auth).toString("base64");if(D=$._req=B(Y),$._redirects)$.emit("redirect",$.url,D)}else D=$._req=B(Y);if(Y.timeout)D.on("timeout",()=>{A1($,D,"Opening handshake has timed out")});if(D.on("error",(j)=>{if(D===null||D[OX])return;D=$._req=null,RJ($,j)}),D.on("response",(j)=>{let V=j.headers.location,L=j.statusCode;if(V&&Y.followRedirects&&L>=300&&L<400){if(++$._redirects>Y.maxRedirects){A1($,D,"Maximum redirects exceeded");return}D.abort();let F;try{F=new C6(V,J)}catch(N){let O=new SyntaxError(`Invalid URL: ${V}`);RJ($,O);return}LX($,F,Q,X)}else if(!$.emit("unexpected-response",D,j))A1($,D,`Unexpected server response: ${j.statusCode}`)}),D.on("upgrade",(j,V,L)=>{if($.emit("upgrade",j),$.readyState!==p.CONNECTING)return;D=$._req=null;let F=j.headers.upgrade;if(F===void 0||F.toLowerCase()!=="websocket"){A1($,V,"Invalid Upgrade header");return}let N=N7("sha1").update(W+O7).digest("base64");if(j.headers["sec-websocket-accept"]!==N){A1($,V,"Invalid Sec-WebSocket-Accept header");return}let O=j.headers["sec-websocket-protocol"],A;if(O!==void 0){if(!U.size)A="Server sent a subprotocol but none was requested";else if(!U.has(O))A="Server sent an invalid subprotocol"}else if(U.size)A="Server sent no subprotocol";if(A){A1($,V,A);return}if(O)$._protocol=O;let I=j.headers["sec-websocket-extensions"];if(I!==void 0){if(!R){A1($,V,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let w;try{w=z7(I)}catch(k){A1($,V,"Invalid Sec-WebSocket-Extensions header");return}let Z=Object.keys(w);if(Z.length!==1||Z[0]!==W$.extensionName){A1($,V,"Server indicated an extension that was not requested");return}try{R.accept(w[W$.extensionName])}catch(k){A1($,V,"Invalid Sec-WebSocket-Extensions header");return}$._extensions[W$.extensionName]=R}$.setSocket(V,L,{allowSynchronousEvents:Y.allowSynchronousEvents,generateMask:Y.generateMask,maxPayload:Y.maxPayload,skipUTF8Validation:Y.skipUTF8Validation})}),Y.finishRequest)Y.finishRequest(D,$);else D.end()}function RJ($,J){$._readyState=p.CLOSING,$._errorEmitted=!0,$.emit("error",J),$.emitClose()}function w7($){return $.path=$.socketPath,FX.connect($)}function _7($){if($.path=void 0,!$.servername&&$.servername!=="")$.servername=FX.isIP($.host)?"":$.host;return M7.connect($)}function A1($,J,Q){$._readyState=p.CLOSING;let X=new Error(Q);if(Error.captureStackTrace(X,A1),J.setHeader){if(J[OX]=!0,J.abort(),J.socket&&!J.socket.destroyed)J.socket.destroy();process.nextTick(RJ,$,X)}else J.destroy(X),J.once("error",$.emit.bind($,"error")),J.once("close",$.emitClose.bind($))}function Z6($,J,Q){if(J){let X=D7(J)?J.size:P7(J).length;if($._socket)$._sender._bufferedBytes+=X;else $._bufferedAmount+=X}if(Q){let X=new Error(`WebSocket is not open: readyState ${$.readyState} (${t1[$.readyState]})`);process.nextTick(Q,X)}}function Z7($,J){let Q=this[W1];if(Q._closeFrameReceived=!0,Q._closeMessage=J,Q._closeCode=$,Q._socket[W1]===void 0)return;if(Q._socket.removeListener("data",WJ),process.nextTick(EX,Q._socket),$===1005)Q.close();else Q.close($,J)}function T7(){let $=this[W1];if(!$.isPaused)$._socket.resume()}function x7($){let J=this[W1];if(J._socket[W1]!==void 0)J._socket.removeListener("data",WJ),process.nextTick(EX,J._socket),J.close($[E7]);if(!J._errorEmitted)J._errorEmitted=!0,J.emit("error",$)}function UX(){this[W1].emitClose()}function v7($,J){this[W1].emit("message",$,J)}function k7($){let J=this[W1];if(J._autoPong)J.pong($,!this._isServer,DX);J.emit("ping",$)}function h7($){this[W1].emit("pong",$)}function EX($){$.resume()}function g7($){let J=this[W1];if(J.readyState===p.CLOSED)return;if(J.readyState===p.OPEN)J._readyState=p.CLOSING,AX(J);if(this._socket.end(),!J._errorEmitted)J._errorEmitted=!0,J.emit("error",$)}function AX($){$._closeTimer=setTimeout($._socket.destroy.bind($._socket),30000)}function IX(){let $=this[W1];this.removeListener("close",IX),this.removeListener("data",WJ),this.removeListener("end",SX),$._readyState=p.CLOSING;let J;if(!this._readableState.endEmitted&&!$._closeFrameReceived&&!$._receiver._writableState.errorEmitted&&(J=$._socket.read())!==null)$._receiver.write(J);if($._receiver.end(),this[W1]=void 0,clearTimeout($._closeTimer),$._receiver._writableState.finished||$._receiver._writableState.errorEmitted)$.emitClose();else $._receiver.on("error",UX),$._receiver.on("finish",UX)}function WJ($){if(!this[W1]._receiver.write($))this.pause()}function SX(){let $=this[W1];$._readyState=p.CLOSING,$._receiver.end(),this.end()}function zX(){let $=this[W1];if(this.removeListener("error",zX),this.on("error",DX),$)$._readyState=p.CLOSING,this.destroy()}});var ZX=n((cj,_X)=>{var lj=qJ(),{Duplex:y7}=require("stream");function CX($){$.emit("close")}function b7(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function wX($){if(this.removeListener("error",wX),this.destroy(),this.listenerCount("error")===0)this.emit("error",$)}function f7($,J){let Q=!0,X=new y7({...J,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return $.on("message",function Y(H,M){let G=!M&&X._readableState.objectMode?H.toString():H;if(!X.push(G))$.pause()}),$.once("error",function Y(H){if(X.destroyed)return;Q=!1,X.destroy(H)}),$.once("close",function Y(){if(X.destroyed)return;X.push(null)}),X._destroy=function(Y,H){if($.readyState===$.CLOSED){H(Y),process.nextTick(CX,X);return}let M=!1;if($.once("error",function G(K){M=!0,H(K)}),$.once("close",function G(){if(!M)H(Y);process.nextTick(CX,X)}),Q)$.terminate()},X._final=function(Y){if($.readyState===$.CONNECTING){$.once("open",function H(){X._final(Y)});return}if($._socket===null)return;if($._socket._writableState.finished){if(Y(),X._readableState.endEmitted)X.destroy()}else $._socket.once("finish",function H(){Y()}),$.close()},X._read=function(){if($.isPaused)$.resume()},X._write=function(Y,H,M){if($.readyState===$.CONNECTING){$.once("open",function G(){X._write(Y,H,M)});return}$.send(Y,M)},X.on("end",b7),X.on("error",wX),X}_X.exports=f7});var xX=n((pj,TX)=>{var{tokenChars:m7}=Y0();function u7($){let J=new Set,Q=-1,X=-1,Y=0;for(Y;Y<$.length;Y++){let M=$.charCodeAt(Y);if(X===-1&&m7[M]===1){if(Q===-1)Q=Y}else if(Y!==0&&(M===32||M===9)){if(X===-1&&Q!==-1)X=Y}else if(M===44){if(Q===-1)throw new SyntaxError(`Unexpected character at index ${Y}`);if(X===-1)X=Y;let G=$.slice(Q,X);if(J.has(G))throw new SyntaxError(`The "${G}" subprotocol is duplicated`);J.add(G),Q=X=-1}else throw new SyntaxError(`Unexpected character at index ${Y}`)}if(Q===-1||X!==-1)throw new SyntaxError("Unexpected end of input");let H=$.slice(Q,Y);if(J.has(H))throw new SyntaxError(`The "${H}" subprotocol is duplicated`);return J.add(H),J}TX.exports={parse:u7}});var yX=n((nj,gX)=>{var l7=require("events"),MJ=require("http"),{Duplex:dj}=require("stream"),{createHash:c7}=require("crypto"),vX=P6(),_$=v0(),p7=xX(),d7=qJ(),{GUID:n7,kWebSocket:i7}=a1(),o7=/^[+/0-9A-Za-z]{22}==$/;class hX extends l7{constructor($,J){super();if($={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d7,...$},$.port==null&&!$.server&&!$.noServer||$.port!=null&&($.server||$.noServer)||$.server&&$.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if($.port!=null)this._server=MJ.createServer((Q,X)=>{let Y=MJ.STATUS_CODES[426];X.writeHead(426,{"Content-Length":Y.length,"Content-Type":"text/plain"}),X.end(Y)}),this._server.listen($.port,$.host,$.backlog,J);else if($.server)this._server=$.server;if(this._server){let Q=this.emit.bind(this,"connection");this._removeListeners=r7(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(X,Y,H)=>{this.handleUpgrade(X,Y,H,Q)}})}if($.perMessageDeflate===!0)$.perMessageDeflate={};if($.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=$,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close($){if(this._state===2){if($)this.once("close",()=>{$(new Error("The server is not running"))});process.nextTick(y0,this);return}if($)this.once("close",$);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(y0,this);else this._shouldEmitClose=!0;else process.nextTick(y0,this)}else{let J=this._server;this._removeListeners(),this._removeListeners=this._server=null,J.close(()=>{y0(this)})}}shouldHandle($){if(this.options.path){let J=$.url.indexOf("?");if((J!==-1?$.url.slice(0,J):$.url)!==this.options.path)return!1}return!0}handleUpgrade($,J,Q,X){J.on("error",kX);let Y=$.headers["sec-websocket-key"],H=$.headers.upgrade,M=+$.headers["sec-websocket-version"];if($.method!=="GET"){Z$(this,$,J,405,"Invalid HTTP method");return}if(H===void 0||H.toLowerCase()!=="websocket"){Z$(this,$,J,400,"Invalid Upgrade header");return}if(Y===void 0||!o7.test(Y)){Z$(this,$,J,400,"Missing or invalid Sec-WebSocket-Key header");return}if(M!==8&&M!==13){Z$(this,$,J,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle($)){b0(J,400);return}let G=$.headers["sec-websocket-protocol"],K=new Set;if(G!==void 0)try{K=p7.parse(G)}catch(B){Z$(this,$,J,400,"Invalid Sec-WebSocket-Protocol header");return}let q=$.headers["sec-websocket-extensions"],W={};if(this.options.perMessageDeflate&&q!==void 0){let B=new _$(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let U=vX.parse(q);if(U[_$.extensionName])B.accept(U[_$.extensionName]),W[_$.extensionName]=B}catch(U){Z$(this,$,J,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let B={origin:$.headers[`${M===8?"sec-websocket-origin":"origin"}`],secure:!!($.socket.authorized||$.socket.encrypted),req:$};if(this.options.verifyClient.length===2){this.options.verifyClient(B,(U,R,D,j)=>{if(!U)return b0(J,R||401,D,j);this.completeUpgrade(W,Y,K,$,J,Q,X)});return}if(!this.options.verifyClient(B))return b0(J,401)}this.completeUpgrade(W,Y,K,$,J,Q,X)}completeUpgrade($,J,Q,X,Y,H,M){if(!Y.readable||!Y.writable)return Y.destroy();if(Y[i7])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return b0(Y,503);let K=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${c7("sha1").update(J+n7).digest("base64")}`],q=new this.options.WebSocket(null,void 0,this.options);if(Q.size){let W=this.options.handleProtocols?this.options.handleProtocols(Q,X):Q.values().next().value;if(W)K.push(`Sec-WebSocket-Protocol: ${W}`),q._protocol=W}if($[_$.extensionName]){let W=$[_$.extensionName].params,B=vX.format({[_$.extensionName]:[W]});K.push(`Sec-WebSocket-Extensions: ${B}`),q._extensions=$}if(this.emit("headers",K,X),Y.write(K.concat(`\r
43
+ `,V)}reset(){this._core.reset()}loadAddon(j){this._addonManager.loadAddon(this,j)}_verifyIntegers(...j){for(let V of j)if(V===1/0||isNaN(V)||V%1!=0)throw new Error("This API only accepts integers")}}M.Terminal=D})();var Y=NQ;for(var H in X)Y[H]=X[H];X.__esModule&&Object.defineProperty(Y,"__esModule",{value:!0})})()});var a$=n((_j,bQ)=>{var gQ=["nodebuffer","arraybuffer","fragments"],yQ=typeof Blob!=="undefined";if(yQ)gQ.push("blob");bQ.exports={BINARY_TYPES:gQ,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:yQ,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var x0=n((Zj,XJ)=>{var{EMPTY_BUFFER:v5}=a$(),F6=Buffer[Symbol.species];function k5($,J){if($.length===0)return v5;if($.length===1)return $[0];let Q=Buffer.allocUnsafe(J),X=0;for(let Y=0;Y<$.length;Y++){let H=$[Y];Q.set(H,X),X+=H.length}if(X<J)return new F6(Q.buffer,Q.byteOffset,X);return Q}function fQ($,J,Q,X,Y){for(let H=0;H<Y;H++)Q[X+H]=$[H]^J[H&3]}function mQ($,J){for(let Q=0;Q<$.length;Q++)$[Q]^=J[Q&3]}function h5($){if($.length===$.buffer.byteLength)return $.buffer;return $.buffer.slice($.byteOffset,$.byteOffset+$.length)}function D6($){if(D6.readOnly=!0,Buffer.isBuffer($))return $;let J;if($ instanceof ArrayBuffer)J=new F6($);else if(ArrayBuffer.isView($))J=new F6($.buffer,$.byteOffset,$.byteLength);else J=Buffer.from($),D6.readOnly=!1;return J}XJ.exports={concat:k5,mask:fQ,toArrayBuffer:h5,toBuffer:D6,unmask:mQ};if(!process.env.WS_NO_BUFFER_UTIL)try{let $=(()=>{throw new Error("Cannot require module "+"bufferutil");})();XJ.exports.mask=function(J,Q,X,Y,H){if(H<48)fQ(J,Q,X,Y,H);else $.mask(J,Q,X,Y,H)},XJ.exports.unmask=function(J,Q){if(J.length<32)mQ(J,Q);else $.unmask(J,Q)}}catch($){}});var pQ=n((Tj,cQ)=>{var uQ=Symbol("kDone"),O6=Symbol("kRun");class lQ{constructor($){this[uQ]=()=>{this.pending--,this[O6]()},this.concurrency=$||1/0,this.jobs=[],this.pending=0}add($){this.jobs.push($),this[O6]()}[O6](){if(this.pending===this.concurrency)return;if(this.jobs.length){let $=this.jobs.shift();this.pending++,$(this[uQ])}}}cQ.exports=lQ});var k0=n((xj,rQ)=>{var v0=require("zlib"),dQ=x0(),g5=pQ(),{kStatusCode:nQ}=a$(),y5=Buffer[Symbol.species],b5=Buffer.from([0,0,255,255]),GJ=Symbol("permessage-deflate"),s$=Symbol("total-length"),Q0=Symbol("callback"),V1=Symbol("buffers"),X0=Symbol("error"),YJ;class iQ{constructor($,J,Q){if(this._maxPayload=Q|0,this._options=$||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!J,this._deflate=null,this._inflate=null,this.params=null,!YJ){let X=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;YJ=new g5(X)}}static get extensionName(){return"permessage-deflate"}offer(){let $={};if(this._options.serverNoContextTakeover)$.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)$.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)$.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)$.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)$.client_max_window_bits=!0;return $}accept($){return $=this.normalizeParams($),this.params=this._isServer?this.acceptAsServer($):this.acceptAsClient($),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let $=this._deflate[Q0];if(this._deflate.close(),this._deflate=null,$)$(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer($){let J=this._options,Q=$.find((X)=>{if(J.serverNoContextTakeover===!1&&X.server_no_context_takeover||X.server_max_window_bits&&(J.serverMaxWindowBits===!1||typeof J.serverMaxWindowBits==="number"&&J.serverMaxWindowBits>X.server_max_window_bits)||typeof J.clientMaxWindowBits==="number"&&!X.client_max_window_bits)return!1;return!0});if(!Q)throw new Error("None of the extension offers can be accepted");if(J.serverNoContextTakeover)Q.server_no_context_takeover=!0;if(J.clientNoContextTakeover)Q.client_no_context_takeover=!0;if(typeof J.serverMaxWindowBits==="number")Q.server_max_window_bits=J.serverMaxWindowBits;if(typeof J.clientMaxWindowBits==="number")Q.client_max_window_bits=J.clientMaxWindowBits;else if(Q.client_max_window_bits===!0||J.clientMaxWindowBits===!1)delete Q.client_max_window_bits;return Q}acceptAsClient($){let J=$[0];if(this._options.clientNoContextTakeover===!1&&J.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!J.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")J.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&J.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return J}normalizeParams($){return $.forEach((J)=>{Object.keys(J).forEach((Q)=>{let X=J[Q];if(X.length>1)throw new Error(`Parameter "${Q}" must have only a single value`);if(X=X[0],Q==="client_max_window_bits"){if(X!==!0){let Y=+X;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`);X=Y}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`)}else if(Q==="server_max_window_bits"){let Y=+X;if(!Number.isInteger(Y)||Y<8||Y>15)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`);X=Y}else if(Q==="client_no_context_takeover"||Q==="server_no_context_takeover"){if(X!==!0)throw new TypeError(`Invalid value for parameter "${Q}": ${X}`)}else throw new Error(`Unknown parameter "${Q}"`);J[Q]=X})}),$}decompress($,J,Q){YJ.add((X)=>{this._decompress($,J,(Y,H)=>{X(),Q(Y,H)})})}compress($,J,Q){YJ.add((X)=>{this._compress($,J,(Y,H)=>{X(),Q(Y,H)})})}_decompress($,J,Q){let X=this._isServer?"client":"server";if(!this._inflate){let Y=`${X}_max_window_bits`,H=typeof this.params[Y]!=="number"?v0.Z_DEFAULT_WINDOWBITS:this.params[Y];this._inflate=v0.createInflateRaw({...this._options.zlibInflateOptions,windowBits:H}),this._inflate[GJ]=this,this._inflate[s$]=0,this._inflate[V1]=[],this._inflate.on("error",m5),this._inflate.on("data",oQ)}if(this._inflate[Q0]=Q,this._inflate.write($),J)this._inflate.write(b5);this._inflate.flush(()=>{let Y=this._inflate[X0];if(Y){this._inflate.close(),this._inflate=null,Q(Y);return}let H=dQ.concat(this._inflate[V1],this._inflate[s$]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[s$]=0,this._inflate[V1]=[],J&&this.params[`${X}_no_context_takeover`])this._inflate.reset();Q(null,H)})}_compress($,J,Q){let X=this._isServer?"server":"client";if(!this._deflate){let Y=`${X}_max_window_bits`,H=typeof this.params[Y]!=="number"?v0.Z_DEFAULT_WINDOWBITS:this.params[Y];this._deflate=v0.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:H}),this._deflate[s$]=0,this._deflate[V1]=[],this._deflate.on("data",f5)}this._deflate[Q0]=Q,this._deflate.write($),this._deflate.flush(v0.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let Y=dQ.concat(this._deflate[V1],this._deflate[s$]);if(J)Y=new y5(Y.buffer,Y.byteOffset,Y.length-4);if(this._deflate[Q0]=null,this._deflate[s$]=0,this._deflate[V1]=[],J&&this.params[`${X}_no_context_takeover`])this._deflate.reset();Q(null,Y)})}}rQ.exports=iQ;function f5($){this[V1].push($),this[s$]+=$.length}function oQ($){if(this[s$]+=$.length,this[GJ]._maxPayload<1||this[s$]<=this[GJ]._maxPayload){this[V1].push($);return}this[X0]=new RangeError("Max payload size exceeded"),this[X0].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[X0][nQ]=1009,this.removeListener("data",oQ),this.reset()}function m5($){if(this[GJ]._inflate=null,this[X0]){this[Q0](this[X0]);return}$[nQ]=1007,this[Q0]($)}});var Y0=n((vj,HJ)=>{var{isUtf8:aQ}=require("buffer"),{hasBlob:u5}=a$(),l5=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function c5($){return $>=1000&&$<=1014&&$!==1004&&$!==1005&&$!==1006||$>=3000&&$<=4999}function L6($){let J=$.length,Q=0;while(Q<J)if(($[Q]&128)===0)Q++;else if(($[Q]&224)===192){if(Q+1===J||($[Q+1]&192)!==128||($[Q]&254)===192)return!1;Q+=2}else if(($[Q]&240)===224){if(Q+2>=J||($[Q+1]&192)!==128||($[Q+2]&192)!==128||$[Q]===224&&($[Q+1]&224)===128||$[Q]===237&&($[Q+1]&224)===160)return!1;Q+=3}else if(($[Q]&248)===240){if(Q+3>=J||($[Q+1]&192)!==128||($[Q+2]&192)!==128||($[Q+3]&192)!==128||$[Q]===240&&($[Q+1]&240)===128||$[Q]===244&&$[Q+1]>143||$[Q]>244)return!1;Q+=4}else return!1;return!0}function p5($){return u5&&typeof $==="object"&&typeof $.arrayBuffer==="function"&&typeof $.type==="string"&&typeof $.stream==="function"&&($[Symbol.toStringTag]==="Blob"||$[Symbol.toStringTag]==="File")}HJ.exports={isBlob:p5,isValidStatusCode:c5,isValidUTF8:L6,tokenChars:l5};if(aQ)HJ.exports.isValidUTF8=function($){return $.length<24?L6($):aQ($)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let $=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();HJ.exports.isValidUTF8=function(J){return J.length<32?L6(J):$(J)}}catch($){}});var A6=n((kj,JX)=>{var{Writable:d5}=require("stream"),sQ=k0(),{BINARY_TYPES:n5,EMPTY_BUFFER:tQ,kStatusCode:i5,kWebSocket:o5}=a$(),{concat:E6,toArrayBuffer:r5,unmask:a5}=x0(),{isValidStatusCode:s5,isValidUTF8:eQ}=Y0(),jJ=Buffer[Symbol.species];class $X extends d5{constructor($={}){super();this._allowSynchronousEvents=$.allowSynchronousEvents!==void 0?$.allowSynchronousEvents:!0,this._binaryType=$.binaryType||n5[0],this._extensions=$.extensions||{},this._isServer=!!$.isServer,this._maxPayload=$.maxPayload|0,this._skipUTF8Validation=!!$.skipUTF8Validation,this[o5]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write($,J,Q){if(this._opcode===8&&this._state==0)return Q();this._bufferedBytes+=$.length,this._buffers.push($),this.startLoop(Q)}consume($){if(this._bufferedBytes-=$,$===this._buffers[0].length)return this._buffers.shift();if($<this._buffers[0].length){let Q=this._buffers[0];return this._buffers[0]=new jJ(Q.buffer,Q.byteOffset+$,Q.length-$),new jJ(Q.buffer,Q.byteOffset,$)}let J=Buffer.allocUnsafe($);do{let Q=this._buffers[0],X=J.length-$;if($>=Q.length)J.set(this._buffers.shift(),X);else J.set(new Uint8Array(Q.buffer,Q.byteOffset,$),X),this._buffers[0]=new jJ(Q.buffer,Q.byteOffset+$,Q.length-$);$-=Q.length}while($>0);return J}startLoop($){this._loop=!0;do switch(this._state){case 0:this.getInfo($);break;case 1:this.getPayloadLength16($);break;case 2:this.getPayloadLength64($);break;case 3:this.getMask();break;case 4:this.getData($);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)$()}getInfo($){if(this._bufferedBytes<2){this._loop=!1;return}let J=this.consume(2);if((J[0]&48)!==0){let X=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");$(X);return}let Q=(J[0]&64)===64;if(Q&&!this._extensions[sQ.extensionName]){let X=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(X);return}if(this._fin=(J[0]&128)===128,this._opcode=J[0]&15,this._payloadLength=J[1]&127,this._opcode===0){if(Q){let X=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(X);return}if(!this._fragmented){let X=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");$(X);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let X=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(X);return}this._compressed=Q}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let X=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");$(X);return}if(Q){let X=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");$(X);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let X=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");$(X);return}}else{let X=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");$(X);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(J[1]&128)===128,this._isServer){if(!this._masked){let X=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");$(X);return}}else if(this._masked){let X=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");$(X);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength($)}getPayloadLength16($){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength($)}getPayloadLength64($){if(this._bufferedBytes<8){this._loop=!1;return}let J=this.consume(8),Q=J.readUInt32BE(0);if(Q>Math.pow(2,21)-1){let X=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");$(X);return}this._payloadLength=Q*Math.pow(2,32)+J.readUInt32BE(4),this.haveLength($)}haveLength($){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let J=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");$(J);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData($){let J=tQ;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(J=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)a5(J,this._mask)}if(this._opcode>7){this.controlMessage(J,$);return}if(this._compressed){this._state=5,this.decompress(J,$);return}if(J.length)this._messageLength=this._totalPayloadLength,this._fragments.push(J);this.dataMessage($)}decompress($,J){this._extensions[sQ.extensionName].decompress($,this._fin,(X,Y)=>{if(X)return J(X);if(Y.length){if(this._messageLength+=Y.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let H=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");J(H);return}this._fragments.push(Y)}if(this.dataMessage(J),this._state===0)this.startLoop(J)})}dataMessage($){if(!this._fin){this._state=0;return}let J=this._messageLength,Q=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let X;if(this._binaryType==="nodebuffer")X=E6(Q,J);else if(this._binaryType==="arraybuffer")X=r5(E6(Q,J));else if(this._binaryType==="blob")X=new Blob(Q);else X=Q;if(this._allowSynchronousEvents)this.emit("message",X,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",X,!0),this._state=0,this.startLoop($)})}else{let X=E6(Q,J);if(!this._skipUTF8Validation&&!eQ(X)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");$(Y);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",X,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",X,!1),this._state=0,this.startLoop($)})}}controlMessage($,J){if(this._opcode===8){if($.length===0)this._loop=!1,this.emit("conclude",1005,tQ),this.end();else{let Q=$.readUInt16BE(0);if(!s5(Q)){let Y=this.createError(RangeError,`invalid status code ${Q}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");J(Y);return}let X=new jJ($.buffer,$.byteOffset+2,$.length-2);if(!this._skipUTF8Validation&&!eQ(X)){let Y=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");J(Y);return}this._loop=!1,this.emit("conclude",Q,X),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",$),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",$),this._state=0,this.startLoop(J)})}createError($,J,Q,X,Y){this._loop=!1,this._errored=!0;let H=new $(Q?`Invalid WebSocket frame: ${J}`:J);return Error.captureStackTrace(H,this.createError),H.code=Y,H[i5]=X,H}}JX.exports=$X});var S6=n((gj,YX)=>{var{Duplex:hj}=require("stream"),{randomFillSync:t5}=require("crypto"),QX=k0(),{EMPTY_BUFFER:e5,kWebSocket:$7,NOOP:J7}=a$(),{isBlob:G0,isValidStatusCode:Q7}=Y0(),{mask:XX,toBuffer:C1}=x0(),z$=Symbol("kByteLength"),X7=Buffer.alloc(4),w1,H0=8192,v$=0,Y7=1,G7=2;class K1{constructor($,J,Q){if(this._extensions=J||{},Q)this._generateMask=Q,this._maskBuffer=Buffer.alloc(4);this._socket=$,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=v$,this.onerror=J7,this[$7]=void 0}static frame($,J){let Q,X=!1,Y=2,H=!1;if(J.mask){if(Q=J.maskBuffer||X7,J.generateMask)J.generateMask(Q);else{if(H0===8192){if(w1===void 0)w1=Buffer.alloc(8192);t5(w1,0,8192),H0=0}Q[0]=w1[H0++],Q[1]=w1[H0++],Q[2]=w1[H0++],Q[3]=w1[H0++]}H=(Q[0]|Q[1]|Q[2]|Q[3])===0,Y=6}let M;if(typeof $==="string")if((!J.mask||H)&&J[z$]!==void 0)M=J[z$];else $=Buffer.from($),M=$.length;else M=$.length,X=J.mask&&J.readOnly&&!H;let G=M;if(M>=65536)Y+=8,G=127;else if(M>125)Y+=2,G=126;let K=Buffer.allocUnsafe(X?M+Y:Y);if(K[0]=J.fin?J.opcode|128:J.opcode,J.rsv1)K[0]|=64;if(K[1]=G,G===126)K.writeUInt16BE(M,2);else if(G===127)K[2]=K[3]=0,K.writeUIntBE(M,4,6);if(!J.mask)return[K,$];if(K[1]|=128,K[Y-4]=Q[0],K[Y-3]=Q[1],K[Y-2]=Q[2],K[Y-1]=Q[3],H)return[K,$];if(X)return XX($,Q,K,Y,M),[K];return XX($,Q,$,0,M),[K,$]}close($,J,Q,X){let Y;if($===void 0)Y=e5;else if(typeof $!=="number"||!Q7($))throw new TypeError("First argument must be a valid error code number");else if(J===void 0||!J.length)Y=Buffer.allocUnsafe(2),Y.writeUInt16BE($,0);else{let M=Buffer.byteLength(J);if(M>123)throw new RangeError("The message must not be greater than 123 bytes");if(Y=Buffer.allocUnsafe(2+M),Y.writeUInt16BE($,0),typeof J==="string")Y.write(J,2);else Y.set(J,2)}let H={[z$]:Y.length,fin:!0,generateMask:this._generateMask,mask:Q,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==v$)this.enqueue([this.dispatch,Y,!1,H,X]);else this.sendFrame(K1.frame(Y,H),X)}ping($,J,Q){let X,Y;if(typeof $==="string")X=Buffer.byteLength($),Y=!1;else if(G0($))X=$.size,Y=!1;else $=C1($),X=$.length,Y=C1.readOnly;if(X>125)throw new RangeError("The data size must not be greater than 125 bytes");let H={[z$]:X,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:9,readOnly:Y,rsv1:!1};if(G0($))if(this._state!==v$)this.enqueue([this.getBlobData,$,!1,H,Q]);else this.getBlobData($,!1,H,Q);else if(this._state!==v$)this.enqueue([this.dispatch,$,!1,H,Q]);else this.sendFrame(K1.frame($,H),Q)}pong($,J,Q){let X,Y;if(typeof $==="string")X=Buffer.byteLength($),Y=!1;else if(G0($))X=$.size,Y=!1;else $=C1($),X=$.length,Y=C1.readOnly;if(X>125)throw new RangeError("The data size must not be greater than 125 bytes");let H={[z$]:X,fin:!0,generateMask:this._generateMask,mask:J,maskBuffer:this._maskBuffer,opcode:10,readOnly:Y,rsv1:!1};if(G0($))if(this._state!==v$)this.enqueue([this.getBlobData,$,!1,H,Q]);else this.getBlobData($,!1,H,Q);else if(this._state!==v$)this.enqueue([this.dispatch,$,!1,H,Q]);else this.sendFrame(K1.frame($,H),Q)}send($,J,Q){let X=this._extensions[QX.extensionName],Y=J.binary?2:1,H=J.compress,M,G;if(typeof $==="string")M=Buffer.byteLength($),G=!1;else if(G0($))M=$.size,G=!1;else $=C1($),M=$.length,G=C1.readOnly;if(this._firstFragment){if(this._firstFragment=!1,H&&X&&X.params[X._isServer?"server_no_context_takeover":"client_no_context_takeover"])H=M>=X._threshold;this._compress=H}else H=!1,Y=0;if(J.fin)this._firstFragment=!0;let K={[z$]:M,fin:J.fin,generateMask:this._generateMask,mask:J.mask,maskBuffer:this._maskBuffer,opcode:Y,readOnly:G,rsv1:H};if(G0($))if(this._state!==v$)this.enqueue([this.getBlobData,$,this._compress,K,Q]);else this.getBlobData($,this._compress,K,Q);else if(this._state!==v$)this.enqueue([this.dispatch,$,this._compress,K,Q]);else this.dispatch($,this._compress,K,Q)}getBlobData($,J,Q,X){this._bufferedBytes+=Q[z$],this._state=G7,$.arrayBuffer().then((Y)=>{if(this._socket.destroyed){let M=new Error("The socket was closed while the blob was being read");process.nextTick(I6,this,M,X);return}this._bufferedBytes-=Q[z$];let H=C1(Y);if(!J)this._state=v$,this.sendFrame(K1.frame(H,Q),X),this.dequeue();else this.dispatch(H,J,Q,X)}).catch((Y)=>{process.nextTick(H7,this,Y,X)})}dispatch($,J,Q,X){if(!J){this.sendFrame(K1.frame($,Q),X);return}let Y=this._extensions[QX.extensionName];this._bufferedBytes+=Q[z$],this._state=Y7,Y.compress($,Q.fin,(H,M)=>{if(this._socket.destroyed){let G=new Error("The socket was closed while data was being compressed");I6(this,G,X);return}this._bufferedBytes-=Q[z$],this._state=v$,Q.readOnly=!1,this.sendFrame(K1.frame(M,Q),X),this.dequeue()})}dequeue(){while(this._state===v$&&this._queue.length){let $=this._queue.shift();this._bufferedBytes-=$[3][z$],Reflect.apply($[0],this,$.slice(1))}}enqueue($){this._bufferedBytes+=$[3][z$],this._queue.push($)}sendFrame($,J){if($.length===2)this._socket.cork(),this._socket.write($[0]),this._socket.write($[1],J),this._socket.uncork();else this._socket.write($[0],J)}}YX.exports=K1;function I6($,J,Q){if(typeof Q==="function")Q(J);for(let X=0;X<$._queue.length;X++){let Y=$._queue[X],H=Y[Y.length-1];if(typeof H==="function")H(J)}}function H7($,J,Q){I6($,J,Q),$.onerror(J)}});var MX=n((yj,qX)=>{var{kForOnEventAttribute:h0,kListener:z6}=a$(),GX=Symbol("kCode"),HX=Symbol("kData"),jX=Symbol("kError"),VX=Symbol("kMessage"),KX=Symbol("kReason"),j0=Symbol("kTarget"),RX=Symbol("kType"),WX=Symbol("kWasClean");class R1{constructor($){this[j0]=null,this[RX]=$}get target(){return this[j0]}get type(){return this[RX]}}Object.defineProperty(R1.prototype,"target",{enumerable:!0});Object.defineProperty(R1.prototype,"type",{enumerable:!0});class V0 extends R1{constructor($,J={}){super($);this[GX]=J.code===void 0?0:J.code,this[KX]=J.reason===void 0?"":J.reason,this[WX]=J.wasClean===void 0?!1:J.wasClean}get code(){return this[GX]}get reason(){return this[KX]}get wasClean(){return this[WX]}}Object.defineProperty(V0.prototype,"code",{enumerable:!0});Object.defineProperty(V0.prototype,"reason",{enumerable:!0});Object.defineProperty(V0.prototype,"wasClean",{enumerable:!0});class g0 extends R1{constructor($,J={}){super($);this[jX]=J.error===void 0?null:J.error,this[VX]=J.message===void 0?"":J.message}get error(){return this[jX]}get message(){return this[VX]}}Object.defineProperty(g0.prototype,"error",{enumerable:!0});Object.defineProperty(g0.prototype,"message",{enumerable:!0});class KJ extends R1{constructor($,J={}){super($);this[HX]=J.data===void 0?null:J.data}get data(){return this[HX]}}Object.defineProperty(KJ.prototype,"data",{enumerable:!0});var j7={addEventListener($,J,Q={}){for(let Y of this.listeners($))if(!Q[h0]&&Y[z6]===J&&!Y[h0])return;let X;if($==="message")X=function Y(H,M){let G=new KJ("message",{data:M?H:H.toString()});G[j0]=this,VJ(J,this,G)};else if($==="close")X=function Y(H,M){let G=new V0("close",{code:H,reason:M.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});G[j0]=this,VJ(J,this,G)};else if($==="error")X=function Y(H){let M=new g0("error",{error:H,message:H.message});M[j0]=this,VJ(J,this,M)};else if($==="open")X=function Y(){let H=new R1("open");H[j0]=this,VJ(J,this,H)};else return;if(X[h0]=!!Q[h0],X[z6]=J,Q.once)this.once($,X);else this.on($,X)},removeEventListener($,J){for(let Q of this.listeners($))if(Q[z6]===J&&!Q[h0]){this.removeListener($,Q);break}}};qX.exports={CloseEvent:V0,ErrorEvent:g0,Event:R1,EventTarget:j7,MessageEvent:KJ};function VJ($,J,Q){if(typeof $==="object"&&$.handleEvent)$.handleEvent.call($,Q);else $.call(J,Q)}});var P6=n((bj,BX)=>{var{tokenChars:y0}=Y0();function c$($,J,Q){if($[J]===void 0)$[J]=[Q];else $[J].push(Q)}function V7($){let J=Object.create(null),Q=Object.create(null),X=!1,Y=!1,H=!1,M,G,K=-1,q=-1,W=-1,B=0;for(;B<$.length;B++)if(q=$.charCodeAt(B),M===void 0)if(W===-1&&y0[q]===1){if(K===-1)K=B}else if(B!==0&&(q===32||q===9)){if(W===-1&&K!==-1)W=B}else if(q===59||q===44){if(K===-1)throw new SyntaxError(`Unexpected character at index ${B}`);if(W===-1)W=B;let R=$.slice(K,W);if(q===44)c$(J,R,Q),Q=Object.create(null);else M=R;K=W=-1}else throw new SyntaxError(`Unexpected character at index ${B}`);else if(G===void 0)if(W===-1&&y0[q]===1){if(K===-1)K=B}else if(q===32||q===9){if(W===-1&&K!==-1)W=B}else if(q===59||q===44){if(K===-1)throw new SyntaxError(`Unexpected character at index ${B}`);if(W===-1)W=B;if(c$(Q,$.slice(K,W),!0),q===44)c$(J,M,Q),Q=Object.create(null),M=void 0;K=W=-1}else if(q===61&&K!==-1&&W===-1)G=$.slice(K,B),K=W=-1;else throw new SyntaxError(`Unexpected character at index ${B}`);else if(Y){if(y0[q]!==1)throw new SyntaxError(`Unexpected character at index ${B}`);if(K===-1)K=B;else if(!X)X=!0;Y=!1}else if(H)if(y0[q]===1){if(K===-1)K=B}else if(q===34&&K!==-1)H=!1,W=B;else if(q===92)Y=!0;else throw new SyntaxError(`Unexpected character at index ${B}`);else if(q===34&&$.charCodeAt(B-1)===61)H=!0;else if(W===-1&&y0[q]===1){if(K===-1)K=B}else if(K!==-1&&(q===32||q===9)){if(W===-1)W=B}else if(q===59||q===44){if(K===-1)throw new SyntaxError(`Unexpected character at index ${B}`);if(W===-1)W=B;let R=$.slice(K,W);if(X)R=R.replace(/\\/g,""),X=!1;if(c$(Q,G,R),q===44)c$(J,M,Q),Q=Object.create(null),M=void 0;G=void 0,K=W=-1}else throw new SyntaxError(`Unexpected character at index ${B}`);if(K===-1||H||q===32||q===9)throw new SyntaxError("Unexpected end of input");if(W===-1)W=B;let U=$.slice(K,W);if(M===void 0)c$(J,U,Q);else{if(G===void 0)c$(Q,U,!0);else if(X)c$(Q,G,U.replace(/\\/g,""));else c$(Q,G,U);c$(J,M,Q)}return J}function K7($){return Object.keys($).map((J)=>{let Q=$[J];if(!Array.isArray(Q))Q=[Q];return Q.map((X)=>{return[J].concat(Object.keys(X).map((Y)=>{let H=X[Y];if(!Array.isArray(H))H=[H];return H.map((M)=>M===!0?Y:`${Y}=${M}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}BX.exports={format:K7,parse:V7}});var MJ=n((uj,PX)=>{var R7=require("events"),W7=require("https"),q7=require("http"),FX=require("net"),M7=require("tls"),{randomBytes:B7,createHash:N7}=require("crypto"),{Duplex:fj,Readable:mj}=require("stream"),{URL:C6}=require("url"),W1=k0(),U7=A6(),F7=S6(),{isBlob:D7}=Y0(),{BINARY_TYPES:NX,EMPTY_BUFFER:RJ,GUID:O7,kForOnEventAttribute:w6,kListener:L7,kStatusCode:E7,kWebSocket:W$,NOOP:DX}=a$(),{EventTarget:{addEventListener:A7,removeEventListener:I7}}=MX(),{format:S7,parse:z7}=P6(),{toBuffer:P7}=x0(),OX=Symbol("kAborted"),_6=[8,13],t$=["CONNECTING","OPEN","CLOSING","CLOSED"],C7=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class p extends R7{constructor($,J,Q){super();if(this._binaryType=NX[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=RJ,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=p.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,$!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,J===void 0)J=[];else if(!Array.isArray(J))if(typeof J==="object"&&J!==null)Q=J,J=[];else J=[J];LX(this,$,J,Q)}else this._autoPong=Q.autoPong,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType($){if(!NX.includes($))return;if(this._binaryType=$,this._receiver)this._receiver._binaryType=$}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket($,J,Q){let X=new U7({allowSynchronousEvents:Q.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:Q.maxPayload,skipUTF8Validation:Q.skipUTF8Validation}),Y=new F7($,this._extensions,Q.generateMask);if(this._receiver=X,this._sender=Y,this._socket=$,X[W$]=this,Y[W$]=this,$[W$]=this,X.on("conclude",Z7),X.on("drain",T7),X.on("error",x7),X.on("message",v7),X.on("ping",k7),X.on("pong",h7),Y.onerror=g7,$.setTimeout)$.setTimeout(0);if($.setNoDelay)$.setNoDelay();if(J.length>0)$.unshift(J);$.on("close",IX),$.on("data",qJ),$.on("end",SX),$.on("error",zX),this._readyState=p.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=p.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[W1.extensionName])this._extensions[W1.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=p.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close($,J){if(this.readyState===p.CLOSED)return;if(this.readyState===p.CONNECTING){A$(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===p.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=p.CLOSING,this._sender.close($,J,!this._isServer,(Q)=>{if(Q)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),AX(this)}pause(){if(this.readyState===p.CONNECTING||this.readyState===p.CLOSED)return;this._paused=!0,this._socket.pause()}ping($,J,Q){if(this.readyState===p.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")Q=$,$=J=void 0;else if(typeof J==="function")Q=J,J=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==p.OPEN){Z6(this,$,Q);return}if(J===void 0)J=!this._isServer;this._sender.ping($||RJ,J,Q)}pong($,J,Q){if(this.readyState===p.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof $==="function")Q=$,$=J=void 0;else if(typeof J==="function")Q=J,J=void 0;if(typeof $==="number")$=$.toString();if(this.readyState!==p.OPEN){Z6(this,$,Q);return}if(J===void 0)J=!this._isServer;this._sender.pong($||RJ,J,Q)}resume(){if(this.readyState===p.CONNECTING||this.readyState===p.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send($,J,Q){if(this.readyState===p.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")Q=J,J={};if(typeof $==="number")$=$.toString();if(this.readyState!==p.OPEN){Z6(this,$,Q);return}let X={binary:typeof $!=="string",mask:!this._isServer,compress:!0,fin:!0,...J};if(!this._extensions[W1.extensionName])X.compress=!1;this._sender.send($||RJ,X,Q)}terminate(){if(this.readyState===p.CLOSED)return;if(this.readyState===p.CONNECTING){A$(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=p.CLOSING,this._socket.destroy()}}Object.defineProperty(p,"CONNECTING",{enumerable:!0,value:t$.indexOf("CONNECTING")});Object.defineProperty(p.prototype,"CONNECTING",{enumerable:!0,value:t$.indexOf("CONNECTING")});Object.defineProperty(p,"OPEN",{enumerable:!0,value:t$.indexOf("OPEN")});Object.defineProperty(p.prototype,"OPEN",{enumerable:!0,value:t$.indexOf("OPEN")});Object.defineProperty(p,"CLOSING",{enumerable:!0,value:t$.indexOf("CLOSING")});Object.defineProperty(p.prototype,"CLOSING",{enumerable:!0,value:t$.indexOf("CLOSING")});Object.defineProperty(p,"CLOSED",{enumerable:!0,value:t$.indexOf("CLOSED")});Object.defineProperty(p.prototype,"CLOSED",{enumerable:!0,value:t$.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(($)=>{Object.defineProperty(p.prototype,$,{enumerable:!0})});["open","error","close","message"].forEach(($)=>{Object.defineProperty(p.prototype,`on${$}`,{enumerable:!0,get(){for(let J of this.listeners($))if(J[w6])return J[L7];return null},set(J){for(let Q of this.listeners($))if(Q[w6]){this.removeListener($,Q);break}if(typeof J!=="function")return;this.addEventListener($,J,{[w6]:!0})}})});p.prototype.addEventListener=A7;p.prototype.removeEventListener=I7;PX.exports=p;function LX($,J,Q,X){let Y={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:_6[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...X,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if($._autoPong=Y.autoPong,!_6.includes(Y.protocolVersion))throw new RangeError(`Unsupported protocol version: ${Y.protocolVersion} (supported versions: ${_6.join(", ")})`);let H;if(J instanceof C6)H=J;else try{H=new C6(J)}catch(j){throw new SyntaxError(`Invalid URL: ${J}`)}if(H.protocol==="http:")H.protocol="ws:";else if(H.protocol==="https:")H.protocol="wss:";$._url=H.href;let M=H.protocol==="wss:",G=H.protocol==="ws+unix:",K;if(H.protocol!=="ws:"&&!M&&!G)K=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(G&&!H.pathname)K="The URL's pathname is empty";else if(H.hash)K="The URL contains a fragment identifier";if(K){let j=new SyntaxError(K);if($._redirects===0)throw j;else{WJ($,j);return}}let q=M?443:80,W=B7(16).toString("base64"),B=M?W7.request:q7.request,U=new Set,R;if(Y.createConnection=Y.createConnection||(M?_7:w7),Y.defaultPort=Y.defaultPort||q,Y.port=H.port||q,Y.host=H.hostname.startsWith("[")?H.hostname.slice(1,-1):H.hostname,Y.headers={...Y.headers,"Sec-WebSocket-Version":Y.protocolVersion,"Sec-WebSocket-Key":W,Connection:"Upgrade",Upgrade:"websocket"},Y.path=H.pathname+H.search,Y.timeout=Y.handshakeTimeout,Y.perMessageDeflate)R=new W1(Y.perMessageDeflate!==!0?Y.perMessageDeflate:{},!1,Y.maxPayload),Y.headers["Sec-WebSocket-Extensions"]=S7({[W1.extensionName]:R.offer()});if(Q.length){for(let j of Q){if(typeof j!=="string"||!C7.test(j)||U.has(j))throw new SyntaxError("An invalid or duplicated subprotocol was specified");U.add(j)}Y.headers["Sec-WebSocket-Protocol"]=Q.join(",")}if(Y.origin)if(Y.protocolVersion<13)Y.headers["Sec-WebSocket-Origin"]=Y.origin;else Y.headers.Origin=Y.origin;if(H.username||H.password)Y.auth=`${H.username}:${H.password}`;if(G){let j=Y.path.split(":");Y.socketPath=j[0],Y.path=j[1]}let D;if(Y.followRedirects){if($._redirects===0){$._originalIpc=G,$._originalSecure=M,$._originalHostOrSocketPath=G?Y.socketPath:H.host;let j=X&&X.headers;if(X={...X,headers:{}},j)for(let[V,L]of Object.entries(j))X.headers[V.toLowerCase()]=L}else if($.listenerCount("redirect")===0){let j=G?$._originalIpc?Y.socketPath===$._originalHostOrSocketPath:!1:$._originalIpc?!1:H.host===$._originalHostOrSocketPath;if(!j||$._originalSecure&&!M){if(delete Y.headers.authorization,delete Y.headers.cookie,!j)delete Y.headers.host;Y.auth=void 0}}if(Y.auth&&!X.headers.authorization)X.headers.authorization="Basic "+Buffer.from(Y.auth).toString("base64");if(D=$._req=B(Y),$._redirects)$.emit("redirect",$.url,D)}else D=$._req=B(Y);if(Y.timeout)D.on("timeout",()=>{A$($,D,"Opening handshake has timed out")});if(D.on("error",(j)=>{if(D===null||D[OX])return;D=$._req=null,WJ($,j)}),D.on("response",(j)=>{let V=j.headers.location,L=j.statusCode;if(V&&Y.followRedirects&&L>=300&&L<400){if(++$._redirects>Y.maxRedirects){A$($,D,"Maximum redirects exceeded");return}D.abort();let F;try{F=new C6(V,J)}catch(N){let O=new SyntaxError(`Invalid URL: ${V}`);WJ($,O);return}LX($,F,Q,X)}else if(!$.emit("unexpected-response",D,j))A$($,D,`Unexpected server response: ${j.statusCode}`)}),D.on("upgrade",(j,V,L)=>{if($.emit("upgrade",j),$.readyState!==p.CONNECTING)return;D=$._req=null;let F=j.headers.upgrade;if(F===void 0||F.toLowerCase()!=="websocket"){A$($,V,"Invalid Upgrade header");return}let N=N7("sha1").update(W+O7).digest("base64");if(j.headers["sec-websocket-accept"]!==N){A$($,V,"Invalid Sec-WebSocket-Accept header");return}let O=j.headers["sec-websocket-protocol"],A;if(O!==void 0){if(!U.size)A="Server sent a subprotocol but none was requested";else if(!U.has(O))A="Server sent an invalid subprotocol"}else if(U.size)A="Server sent no subprotocol";if(A){A$($,V,A);return}if(O)$._protocol=O;let I=j.headers["sec-websocket-extensions"];if(I!==void 0){if(!R){A$($,V,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let w;try{w=z7(I)}catch(k){A$($,V,"Invalid Sec-WebSocket-Extensions header");return}let Z=Object.keys(w);if(Z.length!==1||Z[0]!==W1.extensionName){A$($,V,"Server indicated an extension that was not requested");return}try{R.accept(w[W1.extensionName])}catch(k){A$($,V,"Invalid Sec-WebSocket-Extensions header");return}$._extensions[W1.extensionName]=R}$.setSocket(V,L,{allowSynchronousEvents:Y.allowSynchronousEvents,generateMask:Y.generateMask,maxPayload:Y.maxPayload,skipUTF8Validation:Y.skipUTF8Validation})}),Y.finishRequest)Y.finishRequest(D,$);else D.end()}function WJ($,J){$._readyState=p.CLOSING,$._errorEmitted=!0,$.emit("error",J),$.emitClose()}function w7($){return $.path=$.socketPath,FX.connect($)}function _7($){if($.path=void 0,!$.servername&&$.servername!=="")$.servername=FX.isIP($.host)?"":$.host;return M7.connect($)}function A$($,J,Q){$._readyState=p.CLOSING;let X=new Error(Q);if(Error.captureStackTrace(X,A$),J.setHeader){if(J[OX]=!0,J.abort(),J.socket&&!J.socket.destroyed)J.socket.destroy();process.nextTick(WJ,$,X)}else J.destroy(X),J.once("error",$.emit.bind($,"error")),J.once("close",$.emitClose.bind($))}function Z6($,J,Q){if(J){let X=D7(J)?J.size:P7(J).length;if($._socket)$._sender._bufferedBytes+=X;else $._bufferedAmount+=X}if(Q){let X=new Error(`WebSocket is not open: readyState ${$.readyState} (${t$[$.readyState]})`);process.nextTick(Q,X)}}function Z7($,J){let Q=this[W$];if(Q._closeFrameReceived=!0,Q._closeMessage=J,Q._closeCode=$,Q._socket[W$]===void 0)return;if(Q._socket.removeListener("data",qJ),process.nextTick(EX,Q._socket),$===1005)Q.close();else Q.close($,J)}function T7(){let $=this[W$];if(!$.isPaused)$._socket.resume()}function x7($){let J=this[W$];if(J._socket[W$]!==void 0)J._socket.removeListener("data",qJ),process.nextTick(EX,J._socket),J.close($[E7]);if(!J._errorEmitted)J._errorEmitted=!0,J.emit("error",$)}function UX(){this[W$].emitClose()}function v7($,J){this[W$].emit("message",$,J)}function k7($){let J=this[W$];if(J._autoPong)J.pong($,!this._isServer,DX);J.emit("ping",$)}function h7($){this[W$].emit("pong",$)}function EX($){$.resume()}function g7($){let J=this[W$];if(J.readyState===p.CLOSED)return;if(J.readyState===p.OPEN)J._readyState=p.CLOSING,AX(J);if(this._socket.end(),!J._errorEmitted)J._errorEmitted=!0,J.emit("error",$)}function AX($){$._closeTimer=setTimeout($._socket.destroy.bind($._socket),30000)}function IX(){let $=this[W$];this.removeListener("close",IX),this.removeListener("data",qJ),this.removeListener("end",SX),$._readyState=p.CLOSING;let J;if(!this._readableState.endEmitted&&!$._closeFrameReceived&&!$._receiver._writableState.errorEmitted&&(J=$._socket.read())!==null)$._receiver.write(J);if($._receiver.end(),this[W$]=void 0,clearTimeout($._closeTimer),$._receiver._writableState.finished||$._receiver._writableState.errorEmitted)$.emitClose();else $._receiver.on("error",UX),$._receiver.on("finish",UX)}function qJ($){if(!this[W$]._receiver.write($))this.pause()}function SX(){let $=this[W$];$._readyState=p.CLOSING,$._receiver.end(),this.end()}function zX(){let $=this[W$];if(this.removeListener("error",zX),this.on("error",DX),$)$._readyState=p.CLOSING,this.destroy()}});var ZX=n((cj,_X)=>{var lj=MJ(),{Duplex:y7}=require("stream");function CX($){$.emit("close")}function b7(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function wX($){if(this.removeListener("error",wX),this.destroy(),this.listenerCount("error")===0)this.emit("error",$)}function f7($,J){let Q=!0,X=new y7({...J,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return $.on("message",function Y(H,M){let G=!M&&X._readableState.objectMode?H.toString():H;if(!X.push(G))$.pause()}),$.once("error",function Y(H){if(X.destroyed)return;Q=!1,X.destroy(H)}),$.once("close",function Y(){if(X.destroyed)return;X.push(null)}),X._destroy=function(Y,H){if($.readyState===$.CLOSED){H(Y),process.nextTick(CX,X);return}let M=!1;if($.once("error",function G(K){M=!0,H(K)}),$.once("close",function G(){if(!M)H(Y);process.nextTick(CX,X)}),Q)$.terminate()},X._final=function(Y){if($.readyState===$.CONNECTING){$.once("open",function H(){X._final(Y)});return}if($._socket===null)return;if($._socket._writableState.finished){if(Y(),X._readableState.endEmitted)X.destroy()}else $._socket.once("finish",function H(){Y()}),$.close()},X._read=function(){if($.isPaused)$.resume()},X._write=function(Y,H,M){if($.readyState===$.CONNECTING){$.once("open",function G(){X._write(Y,H,M)});return}$.send(Y,M)},X.on("end",b7),X.on("error",wX),X}_X.exports=f7});var xX=n((pj,TX)=>{var{tokenChars:m7}=Y0();function u7($){let J=new Set,Q=-1,X=-1,Y=0;for(Y;Y<$.length;Y++){let M=$.charCodeAt(Y);if(X===-1&&m7[M]===1){if(Q===-1)Q=Y}else if(Y!==0&&(M===32||M===9)){if(X===-1&&Q!==-1)X=Y}else if(M===44){if(Q===-1)throw new SyntaxError(`Unexpected character at index ${Y}`);if(X===-1)X=Y;let G=$.slice(Q,X);if(J.has(G))throw new SyntaxError(`The "${G}" subprotocol is duplicated`);J.add(G),Q=X=-1}else throw new SyntaxError(`Unexpected character at index ${Y}`)}if(Q===-1||X!==-1)throw new SyntaxError("Unexpected end of input");let H=$.slice(Q,Y);if(J.has(H))throw new SyntaxError(`The "${H}" subprotocol is duplicated`);return J.add(H),J}TX.exports={parse:u7}});var yX=n((nj,gX)=>{var l7=require("events"),BJ=require("http"),{Duplex:dj}=require("stream"),{createHash:c7}=require("crypto"),vX=P6(),_1=k0(),p7=xX(),d7=MJ(),{GUID:n7,kWebSocket:i7}=a$(),o7=/^[+/0-9A-Za-z]{22}==$/;class hX extends l7{constructor($,J){super();if($={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:d7,...$},$.port==null&&!$.server&&!$.noServer||$.port!=null&&($.server||$.noServer)||$.server&&$.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if($.port!=null)this._server=BJ.createServer((Q,X)=>{let Y=BJ.STATUS_CODES[426];X.writeHead(426,{"Content-Length":Y.length,"Content-Type":"text/plain"}),X.end(Y)}),this._server.listen($.port,$.host,$.backlog,J);else if($.server)this._server=$.server;if(this._server){let Q=this.emit.bind(this,"connection");this._removeListeners=r7(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(X,Y,H)=>{this.handleUpgrade(X,Y,H,Q)}})}if($.perMessageDeflate===!0)$.perMessageDeflate={};if($.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=$,this._state=0}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close($){if(this._state===2){if($)this.once("close",()=>{$(new Error("The server is not running"))});process.nextTick(b0,this);return}if($)this.once("close",$);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(b0,this);else this._shouldEmitClose=!0;else process.nextTick(b0,this)}else{let J=this._server;this._removeListeners(),this._removeListeners=this._server=null,J.close(()=>{b0(this)})}}shouldHandle($){if(this.options.path){let J=$.url.indexOf("?");if((J!==-1?$.url.slice(0,J):$.url)!==this.options.path)return!1}return!0}handleUpgrade($,J,Q,X){J.on("error",kX);let Y=$.headers["sec-websocket-key"],H=$.headers.upgrade,M=+$.headers["sec-websocket-version"];if($.method!=="GET"){Z1(this,$,J,405,"Invalid HTTP method");return}if(H===void 0||H.toLowerCase()!=="websocket"){Z1(this,$,J,400,"Invalid Upgrade header");return}if(Y===void 0||!o7.test(Y)){Z1(this,$,J,400,"Missing or invalid Sec-WebSocket-Key header");return}if(M!==8&&M!==13){Z1(this,$,J,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle($)){f0(J,400);return}let G=$.headers["sec-websocket-protocol"],K=new Set;if(G!==void 0)try{K=p7.parse(G)}catch(B){Z1(this,$,J,400,"Invalid Sec-WebSocket-Protocol header");return}let q=$.headers["sec-websocket-extensions"],W={};if(this.options.perMessageDeflate&&q!==void 0){let B=new _1(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let U=vX.parse(q);if(U[_1.extensionName])B.accept(U[_1.extensionName]),W[_1.extensionName]=B}catch(U){Z1(this,$,J,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let B={origin:$.headers[`${M===8?"sec-websocket-origin":"origin"}`],secure:!!($.socket.authorized||$.socket.encrypted),req:$};if(this.options.verifyClient.length===2){this.options.verifyClient(B,(U,R,D,j)=>{if(!U)return f0(J,R||401,D,j);this.completeUpgrade(W,Y,K,$,J,Q,X)});return}if(!this.options.verifyClient(B))return f0(J,401)}this.completeUpgrade(W,Y,K,$,J,Q,X)}completeUpgrade($,J,Q,X,Y,H,M){if(!Y.readable||!Y.writable)return Y.destroy();if(Y[i7])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return f0(Y,503);let K=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${c7("sha1").update(J+n7).digest("base64")}`],q=new this.options.WebSocket(null,void 0,this.options);if(Q.size){let W=this.options.handleProtocols?this.options.handleProtocols(Q,X):Q.values().next().value;if(W)K.push(`Sec-WebSocket-Protocol: ${W}`),q._protocol=W}if($[_1.extensionName]){let W=$[_1.extensionName].params,B=vX.format({[_1.extensionName]:[W]});K.push(`Sec-WebSocket-Extensions: ${B}`),q._extensions=$}if(this.emit("headers",K,X),Y.write(K.concat(`\r
44
44
  `).join(`\r
45
- `)),Y.removeListener("error",kX),q.setSocket(Y,H,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(q),q.on("close",()=>{if(this.clients.delete(q),this._shouldEmitClose&&!this.clients.size)process.nextTick(y0,this)});M(q,X)}}gX.exports=hX;function r7($,J){for(let Q of Object.keys(J))$.on(Q,J[Q]);return function Q(){for(let X of Object.keys(J))$.removeListener(X,J[X])}}function y0($){$._state=2,$.emit("close")}function kX(){this.destroy()}function b0($,J,Q,X){Q=Q||MJ.STATUS_CODES[J],X={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(Q),...X},$.once("finish",$.destroy),$.end(`HTTP/1.1 ${J} ${MJ.STATUS_CODES[J]}\r
45
+ `)),Y.removeListener("error",kX),q.setSocket(Y,H,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(q),q.on("close",()=>{if(this.clients.delete(q),this._shouldEmitClose&&!this.clients.size)process.nextTick(b0,this)});M(q,X)}}gX.exports=hX;function r7($,J){for(let Q of Object.keys(J))$.on(Q,J[Q]);return function Q(){for(let X of Object.keys(J))$.removeListener(X,J[X])}}function b0($){$._state=2,$.emit("close")}function kX(){this.destroy()}function f0($,J,Q,X){Q=Q||BJ.STATUS_CODES[J],X={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(Q),...X},$.once("finish",$.destroy),$.end(`HTTP/1.1 ${J} ${BJ.STATUS_CODES[J]}\r
46
46
  `+Object.keys(X).map((Y)=>`${Y}: ${X[Y]}`).join(`\r
47
47
  `)+`\r
48
48
  \r
49
- `+Q)}function Z$($,J,Q,X,Y){if($.listenerCount("wsClientError")){let H=new Error(Y);Error.captureStackTrace(H,Z$),$.emit("wsClientError",H,Q,J)}else b0(Q,X,Y)}});var N8=J1(B8()),{program:F$,createCommand:EH,createArgument:AH,createOption:IH,CommanderError:SH,InvalidArgumentError:zH,InvalidOptionArgumentError:PH,Command:CH,Argument:wH,Option:_H,Help:ZH}=N8.default;class h1{listeners=[];get event(){return($)=>{return this.listeners.push($),{dispose:()=>{this.listeners=this.listeners.filter((J)=>J!==$)}}}}emit($){for(let J=this.listeners.length-1;J>=0;J--)this.listeners[J]?.($)}dispose(){this.listeners=[]}}class TJ{static MAX_POOL_SIZE=100;static COMMON_SIZES=[64,256,1024,4096,16384];static pools=new Map;static{for(let $ of this.COMMON_SIZES)this.pools.set($,[])}static acquire($){for(let J of this.COMMON_SIZES)if(J>=$){let Q=this.pools.get(J);if(Q&&Q.length>0)return Q.pop();break}return new Uint8Array($)}static release($){let J=$.length;for(let Q of this.COMMON_SIZES)if(Q===J){let X=this.pools.get(Q);if(X&&X.length<this.MAX_POOL_SIZE)X.push($);break}}}class g1{static HEADER_SIZE=4;static MAX_FRAME_SIZE=1048576-g1.HEADER_SIZE;static encode($){let J=$.payload.length;if(J>this.MAX_FRAME_SIZE)throw new Error(`Frame payload too large: ${J} > ${this.MAX_FRAME_SIZE}`);let Q=this.HEADER_SIZE+J,X=TJ.acquire(Q),Y=$.streamId<<8|$.type<<4|$.flags&15;if(X[0]=Y>>>24&255,X[1]=Y>>>16&255,X[2]=Y>>>8&255,X[3]=Y&255,J>0)X.set($.payload,this.HEADER_SIZE);return X.length===Q?X:X.subarray(0,Q)}static decode($){if($.length<g1.HEADER_SIZE)throw new Error(`Invalid frame: too short (${$.length} < ${g1.HEADER_SIZE})`);let J=$[0]<<24|$[1]<<16|$[2]<<8|$[3],Q=J>>>8,X=J&255,Y=X>>>4,H=X&15,M=$.length>g1.HEADER_SIZE?$.subarray(g1.HEADER_SIZE):new Uint8Array(0);return{streamId:Q,type:Y,flags:H,payload:M}}static releaseBuffer($){TJ.release($)}static getMaxPayloadSize(){return g1.MAX_FRAME_SIZE}}class U8{send;_onData;_onClose;_onError;_disposed=!1;_id;constructor($,J){this.send=J;this._id=$}get id(){return this._id}get onData(){if(!this._onData)this._onData=new h1;return this._onData.event}get onClose(){if(!this._onClose)this._onClose=new h1;return this._onClose.event}get onError(){if(!this._onError)this._onError=new h1;return this._onError.event}write($,J=!1){if(this._disposed)throw new Error(`Cannot write to disposed stream ${this.id}`);let Q=g1.getMaxPayloadSize();if($.length<=Q){this.send({streamId:this.id,type:0,flags:J?1:0,payload:$});return}let X=0,Y=!0;while(X<$.length){let H=$.length-X,M=H>Q?Q:H,G=$.subarray(X,X+M);this.send({streamId:this.id,type:0,flags:J&&Y?1:0,payload:G}),X+=M,Y=!1}}close(){if(this._disposed)return;this.send({streamId:this.id,type:1,flags:0,payload:new Uint8Array(0)}),this._dispose()}error($){if(this._disposed)return;this.send({streamId:this.id,type:2,flags:0,payload:new TextEncoder().encode($)})}_handleFrame($){if(this._disposed)return;switch($.type){case 0:this._onData?.emit($.payload);break;case 1:this._onClose?.emit(),this._dispose();break;case 2:let J=new TextDecoder().decode($.payload);this._onError?.emit(J),this._dispose();break}}_dispose(){if(this._disposed)return;this._disposed=!0,this._onData?.dispose(),this._onClose?.dispose(),this._onError?.dispose(),this._onData=void 0,this._onClose=void 0,this._onError=void 0}_reset($,J){this._dispose(),this._id=$,this.send=J,this._disposed=!1}get createdByClient(){return this.id%2===1}get disposed(){return this._disposed}}class M0{static MAX_POOL_SIZE=200;static pool=[];static acquire($,J){let Q=this.pool.pop();if(Q)return Q._reset($,J),Q;return new U8($,J)}static release($){if(this.pool.length<this.MAX_POOL_SIZE)this.pool.push($)}}class l0{_onNextStreamIDChange=new h1;onNextStreamIDChange=this._onNextStreamIDChange.event;_onStream=new h1;onStream=this._onStream.event;streams=[];streamCount=0;nextStreamId=1;send;constructor($){this.nextStreamId=$.initialNextStreamID??($.isClient?1:2),this.send=$.send}getStream($){return this.streams[$]}createStream($){if($===void 0)$=this.nextStreamId,this.nextStreamId+=2,this._onNextStreamIDChange.emit(this.nextStreamId);let J=this.streams[$];if(J&&!J.disposed)throw new Error(`Stream ${$} already exists`);let Q=M0.acquire($,(X)=>this.sendFrame(X));return this.streams[$]=Q,this.streamCount++,Q}sendFrame($){let J=g1.encode($);this.send(J)}handleMessage($){this.handleFrame(g1.decode($))}handleFrame($){let J=this.streams[$.streamId];if(!J||J.disposed)J=M0.acquire($.streamId,(Q)=>this.sendFrame(Q)),this.streams[$.streamId]=J,this.streamCount++,this._onStream.emit(J);if(J._handleFrame($),$.type===1||$.type===2)this.streams[$.streamId]=void 0,this.streamCount--,M0.release(J)}get activeStreamCount(){return this.streamCount}dispose(){for(let $ of this.streams)if($&&!$.disposed)$.close(),M0.release($);this.streams.length=0,this.streamCount=0,this._onNextStreamIDChange.dispose(),this._onStream.dispose()}}class X1 extends Error{constructor(){super("End-Of-Stream");this.name="EndOfStreamError"}}class x$ extends Error{constructor($="The operation was aborted"){super($);this.name="AbortError"}}class v${constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek($,J=!1){let Q=await this.read($,J);return this.peekQueue.push($.subarray(0,Q)),Q}async read($,J=!1){if($.length===0)return 0;let Q=this.readFromPeekBuffer($);if(!this.endOfStream)Q+=await this.readRemainderFromStream($.subarray(Q),J);if(Q===0)throw new X1;return Q}readFromPeekBuffer($){let J=$.length,Q=0;while(this.peekQueue.length>0&&J>0){let X=this.peekQueue.pop();if(!X)throw new Error("peekData should be defined");let Y=Math.min(X.length,J);if($.set(X.subarray(0,Y),Q),Q+=Y,J-=Y,Y<X.length)this.peekQueue.push(X.subarray(Y))}return Q}async readRemainderFromStream($,J){let Q=0;while(Q<$.length&&!this.endOfStream){if(this.interrupted)throw new x$;let X=await this.readFromStream($.subarray(Q),J);if(X===0)break;Q+=X}if(!J&&Q<$.length)throw new X1;return Q}}class xJ extends v${constructor($){super();this.reader=$}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class c0 extends xJ{async readFromStream($,J){if($.length===0)return 0;let Q=await this.reader.read(new Uint8Array($.length),{min:J?void 0:$.length});if(Q.done)this.endOfStream=Q.done;if(Q.value)return $.set(Q.value),Q.value.length;return 0}}class B0 extends v${constructor($){super();this.reader=$,this.buffer=null}writeChunk($,J){let Q=Math.min(J.length,$.length);if($.set(J.subarray(0,Q)),Q<J.length)this.buffer=J.subarray(Q);else this.buffer=null;return Q}async readFromStream($,J){if($.length===0)return 0;let Q=0;if(this.buffer)Q+=this.writeChunk($,this.buffer);while(Q<$.length&&!this.endOfStream){let X=await this.reader.read();if(X.done){this.endOfStream=!0;break}if(X.value)Q+=this.writeChunk($.subarray(Q),X.value)}if(Q===0&&this.endOfStream)throw new X1;return Q}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function vJ($){try{let J=$.getReader({mode:"byob"});if(J instanceof ReadableStreamDefaultReader)return new B0(J);return new c0(J)}catch(J){if(J instanceof TypeError)return new B0($.getReader());throw J}}class $${constructor($){if(this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=$?.onClose,$?.abortSignal)$.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken($,J=this.position){let Q=new Uint8Array($.len);if(await this.readBuffer(Q,{position:J})<$.len)throw new X1;return $.get(Q,0)}async peekToken($,J=this.position){let Q=new Uint8Array($.len);if(await this.peekBuffer(Q,{position:J})<$.len)throw new X1;return $.get(Q,0)}async readNumber($){if(await this.readBuffer(this.numBuffer,{length:$.len})<$.len)throw new X1;return $.get(this.numBuffer,0)}async peekNumber($){if(await this.peekBuffer(this.numBuffer,{length:$.len})<$.len)throw new X1;return $.get(this.numBuffer,0)}async ignore($){if(this.fileInfo.size!==void 0){let J=this.fileInfo.size-this.position;if($>J)return this.position+=J,J}return this.position+=$,$}async close(){await this.abort(),await this.onClose?.()}normalizeOptions($,J){if(!this.supportsRandomAccess()&&J&&J.position!==void 0&&J.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{...{mayBeLess:!1,offset:0,length:$.length,position:this.position},...J}}abort(){return Promise.resolve()}}var _Y=256000;class kJ extends $${constructor($,J){super(J);this.streamReader=$,this.fileInfo=J?.fileInfo??{}}async readBuffer($,J){let Q=this.normalizeOptions($,J),X=Q.position-this.position;if(X>0)return await this.ignore(X),this.readBuffer($,J);if(X<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(Q.length===0)return 0;let Y=await this.streamReader.read($.subarray(0,Q.length),Q.mayBeLess);if(this.position+=Y,(!J||!J.mayBeLess)&&Y<Q.length)throw new X1;return Y}async peekBuffer($,J){let Q=this.normalizeOptions($,J),X=0;if(Q.position){let Y=Q.position-this.position;if(Y>0){let H=new Uint8Array(Q.length+Y);return X=await this.peekBuffer(H,{mayBeLess:Q.mayBeLess}),$.set(H.subarray(Y)),X-Y}if(Y<0)throw new Error("Cannot peek from a negative offset in a stream")}if(Q.length>0){try{X=await this.streamReader.peek($.subarray(0,Q.length),Q.mayBeLess)}catch(Y){if(J?.mayBeLess&&Y instanceof X1)return 0;throw Y}if(!Q.mayBeLess&&X<Q.length)throw new X1}return X}async ignore($){let J=Math.min(_Y,$),Q=new Uint8Array(J),X=0;while(X<$){let Y=$-X,H=await this.readBuffer(Q,{length:Math.min(J,Y)});if(H<0)return H;X+=H}return X}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class hJ extends $${constructor($,J){super(J);this.uint8Array=$,this.fileInfo={...J?.fileInfo??{},...{size:$.length}}}async readBuffer($,J){if(J?.position)this.position=J.position;let Q=await this.peekBuffer($,J);return this.position+=Q,Q}async peekBuffer($,J){let Q=this.normalizeOptions($,J),X=Math.min(this.uint8Array.length-Q.position,Q.length);if(!Q.mayBeLess&&X<Q.length)throw new X1;return $.set(this.uint8Array.subarray(Q.position,Q.position+X)),X}close(){return super.close()}supportsRandomAccess(){return!0}setPosition($){this.position=$}}function gJ($,J){let Q=vJ($),X=J??{},Y=X.onClose;return X.onClose=async()=>{if(await Q.close(),Y)return Y()},new kJ(Q,X)}function F8($,J){return new hJ($,J)}var D8=require("node:fs/promises");class N0 extends $${static async fromFile($){let J=await D8.open($,"r"),Q=await J.stat();return new N0(J,{fileInfo:{path:$,size:Q.size}})}constructor($,J){super(J);this.fileHandle=$,this.fileInfo=J.fileInfo}async readBuffer($,J){let Q=this.normalizeOptions($,J);if(this.position=Q.position,Q.length===0)return 0;let X=await this.fileHandle.read($,0,Q.length,Q.position);if(this.position+=X.bytesRead,X.bytesRead<Q.length&&(!J||!J.mayBeLess))throw new X1;return X.bytesRead}async peekBuffer($,J){let Q=this.normalizeOptions($,J),X=await this.fileHandle.read($,0,Q.length,Q.position);if(!Q.mayBeLess&&X.bytesRead<Q.length)throw new X1;return X.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition($){this.position=$}supportsRandomAccess(){return!0}}var TY=N0.fromFile;var L8=J1(O8());function U1($){return new DataView($.buffer,$.byteOffset)}var E8={len:1,get($,J){return U1($).getUint8(J)},put($,J,Q){return U1($).setUint8(J,Q),J+1}},G1={len:2,get($,J){return U1($).getUint16(J,!0)},put($,J,Q){return U1($).setUint16(J,Q,!0),J+2}},k$={len:2,get($,J){return U1($).getUint16(J)},put($,J,Q){return U1($).setUint16(J,Q),J+2}};var j1={len:4,get($,J){return U1($).getUint32(J,!0)},put($,J,Q){return U1($).setUint32(J,Q,!0),J+4}},A8={len:4,get($,J){return U1($).getUint32(J)},put($,J,Q){return U1($).setUint32(J,Q),J+4}};var I8={len:4,get($,J){return U1($).getInt32(J)},put($,J,Q){return U1($).setInt32(J,Q),J+4}};var S8={len:8,get($,J){return U1($).getBigUint64(J,!0)},put($,J,Q){return U1($).setBigUint64(J,Q,!0),J+8}};class O1{constructor($,J){this.len=$,this.encoding=J,this.textDecoder=new TextDecoder(J)}get($,J){return this.textDecoder.decode($.subarray(J,J+this.len))}}var z8=require("module"),kY=z8.createRequire("/"),hY;try{hY=kY("worker_threads").Worker}catch($){}var E1=Uint8Array,h$=Uint16Array,gY=Int32Array,P8=new E1([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,0,0,0]),C8=new E1([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,0,0]),yY=new E1([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w8=function($,J){var Q=new h$(31);for(var X=0;X<31;++X)Q[X]=J+=1<<$[X-1];var Y=new gY(Q[30]);for(var X=1;X<30;++X)for(var H=Q[X];H<Q[X+1];++H)Y[H]=H-Q[X]<<5|X;return{b:Q,r:Y}},_8=w8(P8,2),Z8=_8.b,bY=_8.r;Z8[28]=258,bY[258]=28;var T8=w8(C8,0),fY=T8.b,w3=T8.r,mJ=new h$(32768);for(o=0;o<32768;++o)y1=(o&43690)>>1|(o&21845)<<1,y1=(y1&52428)>>2|(y1&13107)<<2,y1=(y1&61680)>>4|(y1&3855)<<4,mJ[o]=((y1&65280)>>8|(y1&255)<<8)>>1;var y1,o,U0=function($,J,Q){var X=$.length,Y=0,H=new h$(J);for(;Y<X;++Y)if($[Y])++H[$[Y]-1];var M=new h$(J);for(Y=1;Y<J;++Y)M[Y]=M[Y-1]+H[Y-1]<<1;var G;if(Q){G=new h$(1<<J);var K=15-J;for(Y=0;Y<X;++Y)if($[Y]){var q=Y<<4|$[Y],W=J-$[Y],B=M[$[Y]-1]++<<W;for(var U=B|(1<<W)-1;B<=U;++B)G[mJ[B]>>K]=q}}else{G=new h$(X);for(Y=0;Y<X;++Y)if($[Y])G[Y]=mJ[M[$[Y]-1]++]>>15-$[Y]}return G},F0=new E1(288);for(o=0;o<144;++o)F0[o]=8;var o;for(o=144;o<256;++o)F0[o]=9;var o;for(o=256;o<280;++o)F0[o]=7;var o;for(o=280;o<288;++o)F0[o]=8;var o,x8=new E1(32);for(o=0;o<32;++o)x8[o]=5;var o;var mY=U0(F0,9,1);var uY=U0(x8,5,1),bJ=function($){var J=$[0];for(var Q=1;Q<$.length;++Q)if($[Q]>J)J=$[Q];return J},C1=function($,J,Q){var X=J/8|0;return($[X]|$[X+1]<<8)>>(J&7)&Q},fJ=function($,J){var Q=J/8|0;return($[Q]|$[Q+1]<<8|$[Q+2]<<16)>>(J&7)},lY=function($){return($+7)/8|0},cY=function($,J,Q){if(J==null||J<0)J=0;if(Q==null||Q>$.length)Q=$.length;return new E1($.subarray(J,Q))};var pY=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],L1=function($,J,Q){var X=new Error(J||pY[$]);if(X.code=$,Error.captureStackTrace)Error.captureStackTrace(X,L1);if(!Q)throw X;return X},uJ=function($,J,Q,X){var Y=$.length,H=X?X.length:0;if(!Y||J.f&&!J.l)return Q||new E1(0);var M=!Q,G=M||J.i!=2,K=J.i;if(M)Q=new E1(Y*3);var q=function(p1){var d1=Q.length;if(p1>d1){var B$=new E1(Math.max(d1*2,p1));B$.set(Q),Q=B$}},W=J.f||0,B=J.p||0,U=J.b||0,R=J.l,D=J.d,j=J.m,V=J.n,L=Y*8;do{if(!R){W=C1($,B,1);var F=C1($,B+1,3);if(B+=3,!F){var N=lY(B)+4,O=$[N-4]|$[N-3]<<8,A=N+O;if(A>Y){if(K)L1(0);break}if(G)q(U+O);Q.set($.subarray(N,A),U),J.b=U+=O,J.p=B=A*8,J.f=W;continue}else if(F==1)R=mY,D=uY,j=9,V=5;else if(F==2){var I=C1($,B,31)+257,w=C1($,B+10,15)+4,Z=I+C1($,B+5,31)+1;B+=14;var k=new E1(Z),x=new E1(19);for(var T=0;T<w;++T)x[yY[T]]=C1($,B+T*3,7);B+=w*3;var g=bJ(x),Q1=(1<<g)-1,k1=U0(x,g,1);for(var T=0;T<Z;){var N1=k1[C1($,B,Q1)];B+=N1&15;var N=N1>>4;if(N<16)k[T++]=N;else{var t=0,V1=0;if(N==16)V1=3+C1($,B,3),B+=2,t=k[T-1];else if(N==17)V1=3+C1($,B,7),B+=3;else if(N==18)V1=11+C1($,B,127),B+=7;while(V1--)k[T++]=t}}var E=k.subarray(0,I),S=k.subarray(I);j=bJ(E),V=bJ(S),R=U0(E,j,1),D=U0(S,V,1)}else L1(1);if(B>L){if(K)L1(0);break}}if(G)q(U+131072);var C=(1<<j)-1,_=(1<<V)-1,b=B;for(;;b=B){var t=R[fJ($,B)&C],c=t>>4;if(B+=t&15,B>L){if(K)L1(0);break}if(!t)L1(2);if(c<256)Q[U++]=c;else if(c==256){b=B,R=null;break}else{var a=c-254;if(c>264){var T=c-257,e=P8[T];a=C1($,B,(1<<e)-1)+Z8[T],B+=e}var M1=D[fJ($,B)&_],P=M1>>4;if(!M1)L1(3);B+=M1&15;var S=fY[P];if(P>3){var e=C8[P];S+=fJ($,B)&(1<<e)-1,B+=e}if(B>L){if(K)L1(0);break}if(G)q(U+131072);var $1=U+a;if(U<S){var u=H-S,s=Math.min(S,$1);if(u+U<0)L1(3);for(;U<s;++U)Q[U]=X[u+U]}for(;U<$1;++U)Q[U]=Q[U-S]}}if(J.l=R,J.p=b,J.b=U,J.f=W,R)W=1,J.m=j,J.d=D,J.n=V}while(!W);return U!=Q.length&&M?cY(Q,0,U):Q.subarray(0,U)};var dY=new E1(0);var nY=function($){if($[0]!=31||$[1]!=139||$[2]!=8)L1(6,"invalid gzip data");var J=$[3],Q=10;if(J&4)Q+=($[10]|$[11]<<8)+2;for(var X=(J>>3&1)+(J>>4&1);X>0;X-=!$[Q++]);return Q+(J&2)},iY=function($){var J=$.length;return($[J-4]|$[J-3]<<8|$[J-2]<<16|$[J-1]<<24)>>>0};var oY=function($,J){if(($[0]&15)!=8||$[0]>>4>7||($[0]<<8|$[1])%31)L1(6,"invalid zlib data");if(($[1]>>5&1)==+!J)L1(6,"invalid zlib data: "+($[1]&32?"need":"unexpected")+" dictionary");return($[1]>>3&4)+2};function rY($,J){return uJ($,{i:2},J&&J.out,J&&J.dictionary)}function aY($,J){var Q=nY($);if(Q+8>$.length)L1(6,"invalid gzip data");return uJ($.subarray(Q,-8),{i:2},J&&J.out||new E1(iY($)),J&&J.dictionary)}function sY($,J){return uJ($.subarray(oY($,J&&J.dictionary),-4),{i:2},J&&J.out,J&&J.dictionary)}function v8($,J){return $[0]==31&&$[1]==139&&$[2]==8?aY($,J):($[0]&15)!=8||$[0]>>4>7||($[0]<<8|$[1])%31?rY($,J):sY($,J)}var tY=typeof TextDecoder!="undefined"&&new TextDecoder,eY=0;try{tY.decode(dY,{stream:!0}),eY=1}catch($){}var r8=J1(d8());var O$={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},nJ={get($){let J=G1.get($,6);return{signature:j1.get($,0),compressedSize:j1.get($,8),uncompressedSize:j1.get($,12)}},len:16},n8={get($){let J=G1.get($,6);return{signature:j1.get($,0),minVersion:G1.get($,4),dataDescriptor:!!(J&8),compressedMethod:G1.get($,8),compressedSize:j1.get($,18),uncompressedSize:j1.get($,22),filenameLength:G1.get($,26),extraFieldLength:G1.get($,28),filename:null}},len:30},i8={get($){return{signature:j1.get($,0),nrOfThisDisk:G1.get($,4),nrOfThisDiskWithTheStart:G1.get($,6),nrOfEntriesOnThisDisk:G1.get($,8),nrOfEntriesOfSize:G1.get($,10),sizeOfCd:j1.get($,12),offsetOfStartOfCd:j1.get($,16),zipFileCommentLength:G1.get($,20)}},len:22},o8={get($){let J=G1.get($,8);return{signature:j1.get($,0),minVersion:G1.get($,6),dataDescriptor:!!(J&8),compressedMethod:G1.get($,10),compressedSize:j1.get($,20),uncompressedSize:j1.get($,24),filenameLength:G1.get($,28),extraFieldLength:G1.get($,30),fileCommentLength:G1.get($,32),relativeOffsetOfLocalHeader:j1.get($,42),filename:null}},len:46};function a8($){let J=new Uint8Array(j1.len);return j1.put(J,0,$),J}var b1=r8.default("tokenizer:inflate"),iJ=262144,A4=a8(O$.DataDescriptor),o0=a8(O$.EndOfCentralDirectory);class oJ{constructor($){this.tokenizer=$,this.syncBuffer=new Uint8Array(iJ)}async isZip(){return await this.peekSignature()===O$.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(j1)}async findEndOfCentralDirectoryLocator(){let $=this.tokenizer,J=Math.min(16384,$.fileInfo.size),Q=this.syncBuffer.subarray(0,J);await this.tokenizer.readBuffer(Q,{position:$.fileInfo.size-J});for(let X=Q.length-4;X>=0;X--)if(Q[X]===o0[0]&&Q[X+1]===o0[1]&&Q[X+2]===o0[2]&&Q[X+3]===o0[3])return $.fileInfo.size-J+X;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){b1("Cannot reading central-directory without random-read support");return}b1("Reading central-directory...");let $=this.tokenizer.position,J=await this.findEndOfCentralDirectoryLocator();if(J>0){b1("Central-directory 32-bit signature found");let Q=await this.tokenizer.readToken(i8,J),X=[];this.tokenizer.setPosition(Q.offsetOfStartOfCd);for(let Y=0;Y<Q.nrOfEntriesOfSize;++Y){let H=await this.tokenizer.readToken(o8);if(H.signature!==O$.CentralFileHeader)throw new Error("Expected Central-File-Header signature");H.filename=await this.tokenizer.readToken(new O1(H.filenameLength,"utf-8")),await this.tokenizer.ignore(H.extraFieldLength),await this.tokenizer.ignore(H.fileCommentLength),X.push(H),b1(`Add central-directory file-entry: n=${Y+1}/${X.length}: filename=${X[Y].filename}`)}return this.tokenizer.setPosition($),X}this.tokenizer.setPosition($)}async unzip($){let J=await this.readCentralDirectory();if(J)return this.iterateOverCentralDirectory(J,$);let Q=!1;do{let X=await this.readLocalFileHeader();if(!X)break;let Y=$(X);Q=!!Y.stop;let H=void 0;if(await this.tokenizer.ignore(X.extraFieldLength),X.dataDescriptor&&X.compressedSize===0){let M=[],G=iJ;b1("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let K=-1;while(K<0&&G===iJ){G=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),K=I4(this.syncBuffer.subarray(0,G),A4);let q=K>=0?K:G;if(Y.handler){let W=new Uint8Array(q);await this.tokenizer.readBuffer(W),M.push(W)}else await this.tokenizer.ignore(q)}if(b1(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),Y.handler)await this.inflate(X,S4(M),Y.handler)}else if(Y.handler)b1(`Reading compressed-file-data: ${X.compressedSize} bytes`),H=new Uint8Array(X.compressedSize),await this.tokenizer.readBuffer(H),await this.inflate(X,H,Y.handler);else b1(`Ignoring compressed-file-data: ${X.compressedSize} bytes`),await this.tokenizer.ignore(X.compressedSize);if(b1(`Reading data-descriptor at pos=${this.tokenizer.position}`),X.dataDescriptor){if((await this.tokenizer.readToken(nJ)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-nJ.len}`)}}while(!Q)}async iterateOverCentralDirectory($,J){for(let Q of $){let X=J(Q);if(X.handler){this.tokenizer.setPosition(Q.relativeOffsetOfLocalHeader);let Y=await this.readLocalFileHeader();if(Y){await this.tokenizer.ignore(Y.extraFieldLength);let H=new Uint8Array(Q.compressedSize);await this.tokenizer.readBuffer(H),await this.inflate(Y,H,X.handler)}}if(X.stop)break}}inflate($,J,Q){if($.compressedMethod===0)return Q(J);b1(`Decompress filename=${$.filename}, compressed-size=${J.length}`);let X=v8(J);return Q(X)}async readLocalFileHeader(){let $=await this.tokenizer.peekToken(j1);if($===O$.LocalFileHeader){let J=await this.tokenizer.readToken(n8);return J.filename=await this.tokenizer.readToken(new O1(J.filenameLength,"utf-8")),J}if($===O$.CentralFileHeader)return!1;if($===3759263696)throw new Error("Encrypted ZIP");throw new Error("Unexpected signature")}}function I4($,J){let Q=$.length,X=J.length;if(X>Q)return-1;for(let Y=0;Y<=Q-X;Y++){let H=!0;for(let M=0;M<X;M++)if($[Y+M]!==J[M]){H=!1;break}if(H)return Y}return-1}function S4($){let J=$.reduce((Y,H)=>Y+H.length,0),Q=new Uint8Array(J),X=0;for(let Y of $)Q.set(Y,X),X+=Y.length;return Q}var u3={utf8:new globalThis.TextDecoder("utf8")};var l3=new globalThis.TextEncoder;var c3=Array.from({length:256},($,J)=>J.toString(16).padStart(2,"0"));function rJ($){let{byteLength:J}=$;if(J===6)return $.getUint16(0)*4294967296+$.getUint32(2);if(J===5)return $.getUint8(0)*4294967296+$.getUint32(1);if(J===4)return $.getUint32(0);if(J===3)return $.getUint8(0)*65536+$.getUint16(1);if(J===2)return $.getUint16(0);if(J===1)return $.getUint8(0)}function s8($){return[...$].map((J)=>J.charCodeAt(0))}function t8($,J=0){let Q=Number.parseInt(new O1(6).get($,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(Q))return!1;let X=256;for(let Y=J;Y<J+148;Y++)X+=$[Y];for(let Y=J+156;Y<J+512;Y++)X+=$[Y];return Q===X}var e8={get:($,J)=>$[J+3]&127|$[J+2]<<7|$[J+1]<<14|$[J]<<21,len:4};var $Q=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm","ppsm","ppsx"],JQ=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia"];var aJ=4100;async function tJ($,J){return new QQ(J).fromBuffer($)}function sJ($){switch($=$.toLowerCase(),$){case"application/epub+zip":return{ext:"epub",mime:$};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:$};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:$};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:$};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:$};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:$};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:$};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:$};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:$};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:$};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:$};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:$};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:$};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:$};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:$};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:$};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function f1($,J,Q){Q={offset:0,...Q};for(let[X,Y]of J.entries())if(Q.mask){if(Y!==(Q.mask[X]&$[X+Q.offset]))return!1}else if(Y!==$[X+Q.offset])return!1;return!0}class QQ{constructor($){this.options={mpegOffsetTolerance:0,...$},this.detectors=[...$?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:$?.signal}}async fromTokenizer($){let J=$.position;for(let Q of this.detectors){let X=await Q.detect($);if(X)return X;if(J!==$.position)return}}async fromBuffer($){if(!($ instanceof Uint8Array||$ instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof $}\``);let J=$ instanceof Uint8Array?$:new Uint8Array($);if(!(J?.length>1))return;return this.fromTokenizer(F8(J,this.tokenizerOptions))}async fromBlob($){return this.fromStream($.stream())}async fromStream($){let J=await gJ($,this.tokenizerOptions);try{return await this.fromTokenizer(J)}finally{await J.close()}}async toDetectionStream($,J){let{sampleSize:Q=aJ}=J,X,Y,H=$.getReader({mode:"byob"});try{let{value:K,done:q}=await H.read(new Uint8Array(Q));if(Y=K,!q&&K)try{X=await this.fromBuffer(K.subarray(0,Q))}catch(W){if(!(W instanceof X1))throw W;X=void 0}Y=K}finally{H.releaseLock()}let M=new TransformStream({async start(K){K.enqueue(Y)},transform(K,q){q.enqueue(K)}}),G=$.pipeThrough(M);return G.fileType=X,G}check($,J){return f1(this.buffer,$,J)}checkString($,J){return this.check(s8($),J)}detectConfident=async($)=>{if(this.buffer=new Uint8Array(aJ),$.fileInfo.size===void 0)$.fileInfo.size=Number.MAX_SAFE_INTEGER;if(this.tokenizer=$,await $.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33])){if(await $.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14}))return{ext:"eps",mime:"application/eps"};return{ext:"ps",mime:"application/postscript"}}if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident($);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await $.ignore(6);let J=await $.readToken(e8);if($.position+J>$.fileInfo.size)return{ext:"mp3",mime:"audio/mpeg"};return await $.ignore(J),this.fromTokenizer($)}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255])){if(this.check([247],{offset:3}))return{ext:"jls",mime:"image/jls"};return{ext:"jpg",mime:"image/jpeg"}}if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let J;return await new oJ($).unzip((Q)=>{switch(Q.filename){case"META-INF/mozilla.rsa":return J={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return J={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(X){let Y=new TextDecoder("utf-8").decode(X).trim();J=sJ(Y)},stop:!0};case"[Content_Types].xml":return{async handler(X){let Y=new TextDecoder("utf-8").decode(X),H=Y.indexOf('.main+xml"');if(H===-1){if(Y.includes('ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"'))J=sJ("application/vnd.ms-package.3dmanufacturing-3dmodel+xml")}else{Y=Y.slice(0,Math.max(0,H));let M=Y.lastIndexOf('"'),G=Y.slice(Math.max(0,M+1));J=sJ(G)}},stop:!0};default:if(/classes\d*\.dex/.test(Q.filename))return J={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0};return{}}}),J??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await $.ignore(28);let J=new Uint8Array(8);if(await $.readBuffer(J),f1(J,[79,112,117,115,72,101,97,100]))return{ext:"opus",mime:"audio/ogg; codecs=opus"};if(f1(J,[128,116,104,101,111,114,97]))return{ext:"ogv",mime:"video/ogg"};if(f1(J,[1,118,105,100,101,111,0]))return{ext:"ogm",mime:"video/ogg"};if(f1(J,[127,70,76,65,67]))return{ext:"oga",mime:"audio/ogg"};if(f1(J,[83,112,101,101,120,32,32]))return{ext:"spx",mime:"audio/ogg"};if(f1(J,[1,118,111,114,98,105,115]))return{ext:"ogg",mime:"audio/ogg"};return{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let J=await this.readTiffHeader(!1);if(J)return J}if(this.check([77,77])){let J=await this.readTiffHeader(!0);if(J)return J}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function J(){let M=await $.peekNumber(E8),G=128,K=0;while((M&G)===0&&G!==0)++K,G>>=1;let q=new Uint8Array(K+1);return await $.readBuffer(q),q}async function Q(){let M=await J(),G=await J();G[0]^=128>>G.length-1;let K=Math.min(6,G.length),q=new DataView(M.buffer),W=new DataView(G.buffer,G.length-K,K);return{id:rJ(q),len:rJ(W)}}async function X(M){while(M>0){let G=await Q();if(G.id===17026)return(await $.readToken(new O1(G.len))).replaceAll(/\00.*$/g,"");await $.ignore(G.len),--M}}let Y=await Q();switch(await X(Y.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let J=new O1(4,"latin1").get(this.buffer,2);if(J.match("^d*")&&J>=1000&&J<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){if(await $.ignore(8),await $.readToken(new O1(13,"ascii"))==="debian-binary")return{ext:"deb",mime:"application/x-deb"};return{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("WEBVTT")&&[`
50
- `,"\r","\t"," ","\x00"].some((J)=>this.checkString(J,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await $.ignore(8);async function J(){return{length:await $.readToken(I8),type:await $.readToken(new O1(4,"latin1"))}}do{let Q=await J();if(Q.length<0)return;switch(Q.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await $.ignore(Q.length+4)}}while($.position+8<$.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let J=new O1(4,"latin1").get(this.buffer,8).replace("\x00"," ").trim();switch(J){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:if(J.startsWith("3g")){if(J.startsWith("3g2"))return{ext:"3g2",mime:"video/3gpp2"};return{ext:"3gp",mime:"video/3gpp"}}return{ext:"mp4",mime:"video/mp4"}}}if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function J(){let Q=new Uint8Array(16);return await $.readBuffer(Q),{id:Q,size:Number(await $.readToken(S8))}}await $.ignore(30);while($.position+24<$.fileInfo.size){let Q=await J(),X=Q.size-24;if(f1(Q.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let Y=new Uint8Array(16);if(X-=await $.readBuffer(Y),f1(Y,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(f1(Y,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await $.ignore(X)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await $.ignore(20),await $.readToken(new O1(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255])){if(this.check([0,60,0,63,0,120,0,109,0,108],{offset:2}))return{ext:"xml",mime:"application/xml"};return}if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await $.peekBuffer(this.buffer,{length:Math.min(256,$.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let J=new DataView(this.buffer.buffer).getUint32(12,!0);if(J>12&&this.buffer.length>=J+16)try{let Q=new TextDecoder().decode(this.buffer.subarray(16,J+16));if(JSON.parse(Q).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \x00"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await $.peekBuffer(this.buffer,{length:Math.min(512,$.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\x00",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&t8(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){if(this.check([60,0,63,0,120,0,109,0,108,0],{offset:2}))return{ext:"xml",mime:"application/xml"};if(this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2}))return{ext:"skp",mime:"application/vnd.sketchup.skp"};return}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async($)=>{if(this.buffer=new Uint8Array(aJ),await $.peekBuffer(this.buffer,{length:Math.min(8,$.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await $.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,$.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let J=0;J<=this.options.mpegOffsetTolerance;++J){let Q=this.scanMpeg(J);if(Q)return Q}};async readTiffTag($){let J=await this.tokenizer.readToken($?k$:G1);switch(this.tokenizer.ignore(10),J){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD($){let J=await this.tokenizer.readToken($?k$:G1);for(let Q=0;Q<J;++Q){let X=await this.readTiffTag($);if(X)return X}}async readTiffHeader($){let J=($?k$:G1).get(this.buffer,2),Q=($?A8:j1).get(this.buffer,4);if(J===42){if(Q>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(Q>=8){let Y=($?k$:G1).get(this.buffer,8),H=($?k$:G1).get(this.buffer,10);if(Y===28&&H===254||Y===31&&H===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(Q),await this.readTiffIFD($)??{ext:"tif",mime:"image/tiff"}}if(J===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg($){if(this.check([255,224],{offset:$,mask:[255,224]})){if(this.check([16],{offset:$+1,mask:[22]})){if(this.check([8],{offset:$+1,mask:[8]}))return{ext:"aac",mime:"audio/aac"};return{ext:"aac",mime:"audio/aac"}}if(this.check([2],{offset:$+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:$+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:$+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}var z4=new Set($Q),P4=new Set(JQ);var e1=J1(require("fs/promises"));var FQ=J1(MQ()),DQ=J1(BQ()),OQ=J1(UQ());class S1{static COLUMNS=80;static ROWS=24;static SCROLLBACK=128000;globalEnv;processes=new Map;spawnListeners=[];constructor($){this.globalEnv=$??{}}onSpawn($){return this.spawnListeners.push($),{dispose:()=>{this.spawnListeners=this.spawnListeners.filter((J)=>J!==$)}}}setEnv($){this.globalEnv={...this.globalEnv,...$},Object.keys($).forEach((J)=>{if($[J]==="")delete this.globalEnv[J]})}execute($,J,Q){let X=FQ.spawn($,J,{name:"xterm-256color",cols:S1.COLUMNS,rows:S1.ROWS,cwd:Q?.cwd,env:{...globalThis.process.env,...this.globalEnv,...Q?.env}}),Y=new OQ.Terminal({allowProposedApi:!0,convertEol:!0,scrollback:S1.SCROLLBACK,cols:S1.COLUMNS,rows:S1.ROWS}),H=new DQ.SerializeAddon;Y.loadAddon(H);let M;X.onData((K)=>{M=new Promise((q)=>{Y.write(K,q)})}),Y.onData((K)=>{X.write(K)});let G={command:$,args:J,cwd:Q?.cwd??"",env:{...Q?.env},startTimeMS:Date.now(),exitCode:void 0,exitSignal:void 0,pid:X.pid,pty:X,terminal:Y,serializer:H,kill:(K)=>{X.kill(K)},onExit:(K)=>{return X.onExit(({exitCode:q,signal:W})=>{if(M)M.then(()=>{K(q,W)});else K(q,W)})},onOutput:(K)=>{return X.onData((q)=>{K(q)})},sendInput:(K)=>{Y.input(K)}};this.processes.set(X.pid,G),X.onExit(({exitCode:K,signal:q})=>{G.exitCode=K,G.exitSignal=q});for(let K of this.spawnListeners)K(G);return G}status($){let J=this.processes.get($);if(!J)throw new Error(`Process with PID ${$} not found`);let Q=this.readPlainOutput($);return{pid:J.pid,command:J.command,title:J.pty.process,args:J.args,cwd:J.cwd,env:J.env,exit_code:J.exitCode,exit_signal:J.exitSignal,duration_ms:Date.now()-J.startTimeMS,output_total_lines:Q.totalLines}}list($){return Array.from(this.processes.values()).filter((J)=>$||J.exitCode===void 0).map((J)=>this.status(J.pid))}getProcess($){return this.processes.get($)}readANSIOutput($,J){let Q=this.processes.get($);if(!Q)throw new Error(`Process with PID ${$} not found`);return Q.serializer.serialize({scrollback:J})}readPlainOutput($,J,Q){let X=J?Math.max(0,J-1):0,Y=Q?Math.max(0,Q-1):S1.SCROLLBACK+S1.ROWS-1,H=this.processes.get($);if(!H)throw new Error(`Process with PID ${$} not found`);let M=[];for(let G=0;G<S1.SCROLLBACK+S1.ROWS;G++){let K=H.terminal.buffer.normal.getLine(G);if(K)M.push(K.translateToString(!0)??"")}while(M.length>0&&M[M.length-1].trim()==="")M.pop();return{lines:M.slice(X,Y+1),totalLines:M.length}}close(){this.processes.forEach(($)=>{$.pty.kill()})}}var z={};RY(z,{void:()=>eG,util:()=>r,unknown:()=>sG,union:()=>X5,undefined:()=>oG,tuple:()=>H5,transformer:()=>U5,symbol:()=>iG,string:()=>wQ,strictObject:()=>Q5,setErrorMap:()=>DG,set:()=>K5,record:()=>j5,quotelessJson:()=>UG,promise:()=>N5,preprocess:()=>O5,pipeline:()=>L5,ostring:()=>E5,optional:()=>F5,onumber:()=>A5,oboolean:()=>I5,objectUtil:()=>q6,object:()=>J5,number:()=>_Q,nullable:()=>D5,null:()=>rG,never:()=>tG,nativeEnum:()=>B5,nan:()=>pG,map:()=>V5,makeIssue:()=>S0,literal:()=>q5,lazy:()=>W5,late:()=>lG,isValid:()=>Q$,isDirty:()=>e0,isAsync:()=>l$,isAborted:()=>t0,intersection:()=>G5,instanceof:()=>cG,getParsedType:()=>m1,getErrorMap:()=>u$,function:()=>R5,enum:()=>M5,effect:()=>U5,discriminatedUnion:()=>Y5,defaultErrorMap:()=>i1,datetimeRegex:()=>zQ,date:()=>nG,custom:()=>CQ,coerce:()=>S5,boolean:()=>ZQ,bigint:()=>dG,array:()=>$5,any:()=>aG,addIssueToContext:()=>y,ZodVoid:()=>P0,ZodUnknown:()=>X$,ZodUnion:()=>o$,ZodUndefined:()=>n$,ZodType:()=>i,ZodTuple:()=>l1,ZodTransformer:()=>x1,ZodSymbol:()=>z0,ZodString:()=>w1,ZodSet:()=>z$,ZodSchema:()=>i,ZodRecord:()=>C0,ZodReadonly:()=>J0,ZodPromise:()=>P$,ZodPipeline:()=>Z0,ZodParsedType:()=>h,ZodOptional:()=>Z1,ZodObject:()=>H1,ZodNumber:()=>Y$,ZodNullable:()=>r1,ZodNull:()=>i$,ZodNever:()=>u1,ZodNativeEnum:()=>t$,ZodNaN:()=>_0,ZodMap:()=>w0,ZodLiteral:()=>s$,ZodLazy:()=>a$,ZodIssueCode:()=>v,ZodIntersection:()=>r$,ZodFunction:()=>p$,ZodFirstPartyTypeKind:()=>l,ZodError:()=>D1,ZodEnum:()=>H$,ZodEffects:()=>x1,ZodDiscriminatedUnion:()=>$J,ZodDefault:()=>e$,ZodDate:()=>I$,ZodCatch:()=>$0,ZodBranded:()=>JJ,ZodBoolean:()=>d$,ZodBigInt:()=>G$,ZodArray:()=>_1,ZodAny:()=>S$,Schema:()=>i,ParseStatus:()=>q1,OK:()=>B1,NEVER:()=>z5,INVALID:()=>m,EMPTY_PATH:()=>OG,DIRTY:()=>A$,BRAND:()=>uG});var r;(function($){$.assertEqual=(Y)=>{};function J(Y){}$.assertIs=J;function Q(Y){throw new Error}$.assertNever=Q,$.arrayToEnum=(Y)=>{let H={};for(let M of Y)H[M]=M;return H},$.getValidEnumValues=(Y)=>{let H=$.objectKeys(Y).filter((G)=>typeof Y[Y[G]]!=="number"),M={};for(let G of H)M[G]=Y[G];return $.objectValues(M)},$.objectValues=(Y)=>{return $.objectKeys(Y).map(function(H){return Y[H]})},$.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let H=[];for(let M in Y)if(Object.prototype.hasOwnProperty.call(Y,M))H.push(M);return H},$.find=(Y,H)=>{for(let M of Y)if(H(M))return M;return},$.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function X(Y,H=" | "){return Y.map((M)=>typeof M==="string"?`'${M}'`:M).join(H)}$.joinValues=X,$.jsonStringifyReplacer=(Y,H)=>{if(typeof H==="bigint")return H.toString();return H}})(r||(r={}));var q6;(function($){$.mergeShapes=(J,Q)=>{return{...J,...Q}}})(q6||(q6={}));var h=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m1=($)=>{switch(typeof $){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN($)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":if(Array.isArray($))return h.array;if($===null)return h.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return h.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return h.map;if(typeof Set!=="undefined"&&$ instanceof Set)return h.set;if(typeof Date!=="undefined"&&$ instanceof Date)return h.date;return h.object;default:return h.unknown}};var v=r.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),UG=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class D1 extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let J=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,J);else this.__proto__=J;this.name="ZodError",this.issues=$}format($){let J=$||function(Y){return Y.message},Q={_errors:[]},X=(Y)=>{for(let H of Y.issues)if(H.code==="invalid_union")H.unionErrors.map(X);else if(H.code==="invalid_return_type")X(H.returnTypeError);else if(H.code==="invalid_arguments")X(H.argumentsError);else if(H.path.length===0)Q._errors.push(J(H));else{let M=Q,G=0;while(G<H.path.length){let K=H.path[G];if(G!==H.path.length-1)M[K]=M[K]||{_errors:[]};else M[K]=M[K]||{_errors:[]},M[K]._errors.push(J(H));M=M[K],G++}}};return X(this),Q}static assert($){if(!($ instanceof D1))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(J)=>J.message){let J={},Q=[];for(let X of this.issues)if(X.path.length>0)J[X.path[0]]=J[X.path[0]]||[],J[X.path[0]].push($(X));else Q.push($(X));return{formErrors:Q,fieldErrors:J}}get formErrors(){return this.flatten()}}D1.create=($)=>{return new D1($)};var FG=($,J)=>{let Q;switch($.code){case v.invalid_type:if($.received===h.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case v.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,r.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:Q=`Unrecognized key(s) in object: ${r.joinValues($.keys,", ")}`;break;case v.invalid_union:Q="Invalid input";break;case v.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${r.joinValues($.options)}`;break;case v.invalid_enum_value:Q=`Invalid enum value. Expected ${r.joinValues($.options)}, received '${$.received}'`;break;case v.invalid_arguments:Q="Invalid function arguments";break;case v.invalid_return_type:Q="Invalid function return type";break;case v.invalid_date:Q="Invalid date";break;case v.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else r.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case v.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case v.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case v.custom:Q="Invalid input";break;case v.invalid_intersection_types:Q="Intersection results could not be merged";break;case v.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case v.not_finite:Q="Number must be finite";break;default:Q=J.defaultError,r.assertNever($)}return{message:Q}},i1=FG;var LQ=i1;function DG($){LQ=$}function u$(){return LQ}var S0=($)=>{let{data:J,path:Q,errorMaps:X,issueData:Y}=$,H=[...Q,...Y.path||[]],M={...Y,path:H};if(Y.message!==void 0)return{...Y,path:H,message:Y.message};let G="",K=X.filter((q)=>!!q).slice().reverse();for(let q of K)G=q(M,{data:J,defaultError:G}).message;return{...Y,path:H,message:G}},OG=[];function y($,J){let Q=u$(),X=S0({issueData:J,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===i1?void 0:i1].filter((Y)=>!!Y)});$.common.issues.push(X)}class q1{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,J){let Q=[];for(let X of J){if(X.status==="aborted")return m;if(X.status==="dirty")$.dirty();Q.push(X.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,J){let Q=[];for(let X of J){let Y=await X.key,H=await X.value;Q.push({key:Y,value:H})}return q1.mergeObjectSync($,Q)}static mergeObjectSync($,J){let Q={};for(let X of J){let{key:Y,value:H}=X;if(Y.status==="aborted")return m;if(H.status==="aborted")return m;if(Y.status==="dirty")$.dirty();if(H.status==="dirty")$.dirty();if(Y.value!=="__proto__"&&(typeof H.value!=="undefined"||X.alwaysSet))Q[Y.value]=H.value}return{status:$.value,value:Q}}}var m=Object.freeze({status:"aborted"}),A$=($)=>({status:"dirty",value:$}),B1=($)=>({status:"valid",value:$}),t0=($)=>$.status==="aborted",e0=($)=>$.status==="dirty",Q$=($)=>$.status==="valid",l$=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var f;(function($){$.errToObj=(J)=>typeof J==="string"?{message:J}:J||{},$.toString=(J)=>typeof J==="string"?J:J?.message})(f||(f={}));class T1{constructor($,J,Q,X){this._cachedPath=[],this.parent=$,this.data=J,this._path=Q,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var EQ=($,J)=>{if(Q$(J))return{success:!0,data:J.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new D1($.common.issues);return this._error=Q,this._error}}}};function d($){if(!$)return{};let{errorMap:J,invalid_type_error:Q,required_error:X,description:Y}=$;if(J&&(Q||X))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(J)return{errorMap:J,description:Y};return{errorMap:(M,G)=>{let{message:K}=$;if(M.code==="invalid_enum_value")return{message:K??G.defaultError};if(typeof G.data==="undefined")return{message:K??X??G.defaultError};if(M.code!=="invalid_type")return{message:G.defaultError};return{message:K??Q??G.defaultError}},description:Y}}class i{get description(){return this._def.description}_getType($){return m1($.data)}_getOrReturnCtx($,J){return J||{common:$.parent.common,data:$.data,parsedType:m1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new q1,ctx:{common:$.parent.common,data:$.data,parsedType:m1($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let J=this._parse($);if(l$(J))throw new Error("Synchronous parse encountered promise.");return J}_parseAsync($){let J=this._parse($);return Promise.resolve(J)}parse($,J){let Q=this.safeParse($,J);if(Q.success)return Q.data;throw Q.error}safeParse($,J){let Q={common:{issues:[],async:J?.async??!1,contextualErrorMap:J?.errorMap},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:m1($)},X=this._parseSync({data:$,path:Q.path,parent:Q});return EQ(Q,X)}"~validate"($){let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:m1($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:J});return Q$(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((Q)=>Q$(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync($,J){let Q=await this.safeParseAsync($,J);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,J){let Q={common:{issues:[],contextualErrorMap:J?.errorMap,async:!0},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:m1($)},X=this._parse({data:$,path:Q.path,parent:Q}),Y=await(l$(X)?X:Promise.resolve(X));return EQ(Q,Y)}refine($,J){let Q=(X)=>{if(typeof J==="string"||typeof J==="undefined")return{message:J};else if(typeof J==="function")return J(X);else return J};return this._refinement((X,Y)=>{let H=$(X),M=()=>Y.addIssue({code:v.custom,...Q(X)});if(typeof Promise!=="undefined"&&H instanceof Promise)return H.then((G)=>{if(!G)return M(),!1;else return!0});if(!H)return M(),!1;else return!0})}refinement($,J){return this._refinement((Q,X)=>{if(!$(Q))return X.addIssue(typeof J==="function"?J(Q,X):J),!1;else return!0})}_refinement($){return new x1({schema:this,typeName:l.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(J)=>this["~validate"](J)}}optional(){return Z1.create(this,this._def)}nullable(){return r1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _1.create(this)}promise(){return P$.create(this,this._def)}or($){return o$.create([this,$],this._def)}and($){return r$.create(this,$,this._def)}transform($){return new x1({...d(this._def),schema:this,typeName:l.ZodEffects,effect:{type:"transform",transform:$}})}default($){let J=typeof $==="function"?$:()=>$;return new e$({...d(this._def),innerType:this,defaultValue:J,typeName:l.ZodDefault})}brand(){return new JJ({typeName:l.ZodBranded,type:this,...d(this._def)})}catch($){let J=typeof $==="function"?$:()=>$;return new $0({...d(this._def),innerType:this,catchValue:J,typeName:l.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return Z0.create(this,$)}readonly(){return J0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var LG=/^c[^\s-]{8,}$/i,EG=/^[0-9a-z]+$/,AG=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,SG=/^[a-z0-9_-]{21}$/i,zG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,PG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,CG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",M6,_G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ZG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,IQ="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",hG=new RegExp(`^${IQ}$`);function SQ($){let J="[0-5]\\d";if($.precision)J=`${J}\\.\\d{${$.precision}}`;else if($.precision==null)J=`${J}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${J})${Q}`}function gG($){return new RegExp(`^${SQ($)}$`)}function zQ($){let J=`${IQ}T${SQ($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return J=`${J}(${Q.join("|")})`,new RegExp(`^${J}$`)}function yG($,J){if((J==="v4"||!J)&&_G.test($))return!0;if((J==="v6"||!J)&&TG.test($))return!0;return!1}function bG($,J){if(!zG.test($))return!1;try{let[Q]=$.split("."),X=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(X));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(J&&Y.alg!==J)return!1;return!0}catch{return!1}}function fG($,J){if((J==="v4"||!J)&&ZG.test($))return!0;if((J==="v6"||!J)&&xG.test($))return!0;return!1}class w1 extends i{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==h.string){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_type,expected:h.string,received:Y.parsedType}),m}let Q=new q1,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.length<Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if($.data.length>Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let H=$.data.length>Y.value,M=$.data.length<Y.value;if(H||M){if(X=this._getOrReturnCtx($,X),H)y(X,{code:v.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(M)y(X,{code:v.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!CG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"email",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!M6)M6=new RegExp(wG,"u");if(!M6.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"emoji",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!IG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"uuid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!SG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"nanoid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!LG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"cuid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!EG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"cuid2",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!AG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"ulid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL($.data)}catch{X=this._getOrReturnCtx($,X),y(X,{validation:"url",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"regex",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")$.data=$.data.trim();else if(Y.kind==="includes"){if(!$.data.includes(Y.value,Y.position))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Y.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Y.kind==="startsWith"){if(!$.data.startsWith(Y.value))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!$.data.endsWith(Y.value))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!zQ(Y).test($.data))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!hG.test($.data))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!gG(Y).test($.data))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!PG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"duration",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!yG($.data,Y.version))X=this._getOrReturnCtx($,X),y(X,{validation:"ip",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!bG($.data,Y.alg))X=this._getOrReturnCtx($,X),y(X,{validation:"jwt",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!fG($.data,Y.version))X=this._getOrReturnCtx($,X),y(X,{validation:"cidr",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!vG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"base64",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!kG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"base64url",code:v.invalid_string,message:Y.message}),Q.dirty()}else r.assertNever(Y);return{status:Q.value,value:$.data}}_regex($,J,Q){return this.refinement((X)=>$.test(X),{validation:J,code:v.invalid_string,...f.errToObj(Q)})}_addCheck($){return new w1({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...f.errToObj($)})}url($){return this._addCheck({kind:"url",...f.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...f.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...f.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...f.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...f.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...f.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...f.errToObj($)})}base64($){return this._addCheck({kind:"base64",...f.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...f.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...f.errToObj($)})}ip($){return this._addCheck({kind:"ip",...f.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...f.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...f.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision==="undefined"?null:$?.precision,...f.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...f.errToObj($)})}regex($,J){return this._addCheck({kind:"regex",regex:$,...f.errToObj(J)})}includes($,J){return this._addCheck({kind:"includes",value:$,position:J?.position,...f.errToObj(J?.message)})}startsWith($,J){return this._addCheck({kind:"startsWith",value:$,...f.errToObj(J)})}endsWith($,J){return this._addCheck({kind:"endsWith",value:$,...f.errToObj(J)})}min($,J){return this._addCheck({kind:"min",value:$,...f.errToObj(J)})}max($,J){return this._addCheck({kind:"max",value:$,...f.errToObj(J)})}length($,J){return this._addCheck({kind:"length",value:$,...f.errToObj(J)})}nonempty($){return this.min(1,f.errToObj($))}trim(){return new w1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new w1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new w1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxLength(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}w1.create=($)=>{return new w1({checks:[],typeName:l.ZodString,coerce:$?.coerce??!1,...d($)})};function mG($,J){let Q=($.toString().split(".")[1]||"").length,X=(J.toString().split(".")[1]||"").length,Y=Q>X?Q:X,H=Number.parseInt($.toFixed(Y).replace(".","")),M=Number.parseInt(J.toFixed(Y).replace(".",""));return H%M/10**Y}class Y$ extends i{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==h.number){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_type,expected:h.number,received:Y.parsedType}),m}let Q=void 0,X=new q1;for(let Y of this._def.checks)if(Y.kind==="int"){if(!r.isInteger($.data))Q=this._getOrReturnCtx($,Q),y(Q,{code:v.invalid_type,expected:"integer",received:"float",message:Y.message}),X.dirty()}else if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if(mG($.data,Y.value)!==0)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),y(Q,{code:v.not_finite,message:Y.message}),X.dirty()}else r.assertNever(Y);return{status:X.value,value:$.data}}gte($,J){return this.setLimit("min",$,!0,f.toString(J))}gt($,J){return this.setLimit("min",$,!1,f.toString(J))}lte($,J){return this.setLimit("max",$,!0,f.toString(J))}lt($,J){return this.setLimit("max",$,!1,f.toString(J))}setLimit($,J,Q,X){return new Y$({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:f.toString(X)}]})}_addCheck($){return new Y$({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:f.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:f.toString(J)})}finite($){return this._addCheck({kind:"finite",message:f.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString($)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&r.isInteger($.value))}get isFinite(){let $=null,J=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(J)&&Number.isFinite($)}}Y$.create=($)=>{return new Y$({checks:[],typeName:l.ZodNumber,coerce:$?.coerce||!1,...d($)})};class G$ extends i{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==h.bigint)return this._getInvalidInput($);let Q=void 0,X=new q1;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if($.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),y(Q,{code:v.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else r.assertNever(Y);return{status:X.value,value:$.data}}_getInvalidInput($){let J=this._getOrReturnCtx($);return y(J,{code:v.invalid_type,expected:h.bigint,received:J.parsedType}),m}gte($,J){return this.setLimit("min",$,!0,f.toString(J))}gt($,J){return this.setLimit("min",$,!1,f.toString(J))}lte($,J){return this.setLimit("max",$,!0,f.toString(J))}lt($,J){return this.setLimit("max",$,!1,f.toString(J))}setLimit($,J,Q,X){return new G$({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:f.toString(X)}]})}_addCheck($){return new G$({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:f.toString(J)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}G$.create=($)=>{return new G$({checks:[],typeName:l.ZodBigInt,coerce:$?.coerce??!1,...d($)})};class d$ extends i{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==h.boolean){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.boolean,received:Q.parsedType}),m}return B1($.data)}}d$.create=($)=>{return new d$({typeName:l.ZodBoolean,coerce:$?.coerce||!1,...d($)})};class I$ extends i{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==h.date){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_type,expected:h.date,received:Y.parsedType}),m}if(Number.isNaN($.data.getTime())){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_date}),m}let Q=new q1,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.getTime()<Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if($.data.getTime()>Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else r.assertNever(Y);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new I$({...this._def,checks:[...this._def.checks,$]})}min($,J){return this._addCheck({kind:"min",value:$.getTime(),message:f.toString(J)})}max($,J){return this._addCheck({kind:"max",value:$.getTime(),message:f.toString(J)})}get minDate(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $!=null?new Date($):null}}I$.create=($)=>{return new I$({checks:[],coerce:$?.coerce||!1,typeName:l.ZodDate,...d($)})};class z0 extends i{_parse($){if(this._getType($)!==h.symbol){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.symbol,received:Q.parsedType}),m}return B1($.data)}}z0.create=($)=>{return new z0({typeName:l.ZodSymbol,...d($)})};class n$ extends i{_parse($){if(this._getType($)!==h.undefined){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.undefined,received:Q.parsedType}),m}return B1($.data)}}n$.create=($)=>{return new n$({typeName:l.ZodUndefined,...d($)})};class i$ extends i{_parse($){if(this._getType($)!==h.null){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.null,received:Q.parsedType}),m}return B1($.data)}}i$.create=($)=>{return new i$({typeName:l.ZodNull,...d($)})};class S$ extends i{constructor(){super(...arguments);this._any=!0}_parse($){return B1($.data)}}S$.create=($)=>{return new S$({typeName:l.ZodAny,...d($)})};class X$ extends i{constructor(){super(...arguments);this._unknown=!0}_parse($){return B1($.data)}}X$.create=($)=>{return new X$({typeName:l.ZodUnknown,...d($)})};class u1 extends i{_parse($){let J=this._getOrReturnCtx($);return y(J,{code:v.invalid_type,expected:h.never,received:J.parsedType}),m}}u1.create=($)=>{return new u1({typeName:l.ZodNever,...d($)})};class P0 extends i{_parse($){if(this._getType($)!==h.undefined){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.void,received:Q.parsedType}),m}return B1($.data)}}P0.create=($)=>{return new P0({typeName:l.ZodVoid,...d($)})};class _1 extends i{_parse($){let{ctx:J,status:Q}=this._processInputParams($),X=this._def;if(J.parsedType!==h.array)return y(J,{code:v.invalid_type,expected:h.array,received:J.parsedType}),m;if(X.exactLength!==null){let H=J.data.length>X.exactLength.value,M=J.data.length<X.exactLength.value;if(H||M)y(J,{code:H?v.too_big:v.too_small,minimum:M?X.exactLength.value:void 0,maximum:H?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Q.dirty()}if(X.minLength!==null){if(J.data.length<X.minLength.value)y(J,{code:v.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Q.dirty()}if(X.maxLength!==null){if(J.data.length>X.maxLength.value)y(J,{code:v.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Q.dirty()}if(J.common.async)return Promise.all([...J.data].map((H,M)=>{return X.type._parseAsync(new T1(J,H,J.path,M))})).then((H)=>{return q1.mergeArray(Q,H)});let Y=[...J.data].map((H,M)=>{return X.type._parseSync(new T1(J,H,J.path,M))});return q1.mergeArray(Q,Y)}get element(){return this._def.type}min($,J){return new _1({...this._def,minLength:{value:$,message:f.toString(J)}})}max($,J){return new _1({...this._def,maxLength:{value:$,message:f.toString(J)}})}length($,J){return new _1({...this._def,exactLength:{value:$,message:f.toString(J)}})}nonempty($){return this.min(1,$)}}_1.create=($,J)=>{return new _1({type:$,minLength:null,maxLength:null,exactLength:null,typeName:l.ZodArray,...d(J)})};function c$($){if($ instanceof H1){let J={};for(let Q in $.shape){let X=$.shape[Q];J[Q]=Z1.create(c$(X))}return new H1({...$._def,shape:()=>J})}else if($ instanceof _1)return new _1({...$._def,type:c$($.element)});else if($ instanceof Z1)return Z1.create(c$($.unwrap()));else if($ instanceof r1)return r1.create(c$($.unwrap()));else if($ instanceof l1)return l1.create($.items.map((J)=>c$(J)));else return $}class H1 extends i{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),J=r.objectKeys($);return this._cached={shape:$,keys:J},this._cached}_parse($){if(this._getType($)!==h.object){let K=this._getOrReturnCtx($);return y(K,{code:v.invalid_type,expected:h.object,received:K.parsedType}),m}let{status:Q,ctx:X}=this._processInputParams($),{shape:Y,keys:H}=this._getCached(),M=[];if(!(this._def.catchall instanceof u1&&this._def.unknownKeys==="strip")){for(let K in X.data)if(!H.includes(K))M.push(K)}let G=[];for(let K of H){let q=Y[K],W=X.data[K];G.push({key:{status:"valid",value:K},value:q._parse(new T1(X,W,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof u1){let K=this._def.unknownKeys;if(K==="passthrough")for(let q of M)G.push({key:{status:"valid",value:q},value:{status:"valid",value:X.data[q]}});else if(K==="strict"){if(M.length>0)y(X,{code:v.unrecognized_keys,keys:M}),Q.dirty()}else if(K==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let q of M){let W=X.data[q];G.push({key:{status:"valid",value:q},value:K._parse(new T1(X,W,X.path,q)),alwaysSet:q in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let K=[];for(let q of G){let W=await q.key,B=await q.value;K.push({key:W,value:B,alwaysSet:q.alwaysSet})}return K}).then((K)=>{return q1.mergeObjectSync(Q,K)});else return q1.mergeObjectSync(Q,G)}get shape(){return this._def.shape()}strict($){return f.errToObj,new H1({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(J,Q)=>{let X=this._def.errorMap?.(J,Q).message??Q.defaultError;if(J.code==="unrecognized_keys")return{message:f.errToObj($).message??X};return{message:X}}}:{}})}strip(){return new H1({...this._def,unknownKeys:"strip"})}passthrough(){return new H1({...this._def,unknownKeys:"passthrough"})}extend($){return new H1({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new H1({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:l.ZodObject})}setKey($,J){return this.augment({[$]:J})}catchall($){return new H1({...this._def,catchall:$})}pick($){let J={};for(let Q of r.objectKeys($))if($[Q]&&this.shape[Q])J[Q]=this.shape[Q];return new H1({...this._def,shape:()=>J})}omit($){let J={};for(let Q of r.objectKeys(this.shape))if(!$[Q])J[Q]=this.shape[Q];return new H1({...this._def,shape:()=>J})}deepPartial(){return c$(this)}partial($){let J={};for(let Q of r.objectKeys(this.shape)){let X=this.shape[Q];if($&&!$[Q])J[Q]=X;else J[Q]=X.optional()}return new H1({...this._def,shape:()=>J})}required($){let J={};for(let Q of r.objectKeys(this.shape))if($&&!$[Q])J[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof Z1)Y=Y._def.innerType;J[Q]=Y}return new H1({...this._def,shape:()=>J})}keyof(){return PQ(r.objectKeys(this.shape))}}H1.create=($,J)=>{return new H1({shape:()=>$,unknownKeys:"strip",catchall:u1.create(),typeName:l.ZodObject,...d(J)})};H1.strictCreate=($,J)=>{return new H1({shape:()=>$,unknownKeys:"strict",catchall:u1.create(),typeName:l.ZodObject,...d(J)})};H1.lazycreate=($,J)=>{return new H1({shape:$,unknownKeys:"strip",catchall:u1.create(),typeName:l.ZodObject,...d(J)})};class o$ extends i{_parse($){let{ctx:J}=this._processInputParams($),Q=this._def.options;function X(Y){for(let M of Y)if(M.result.status==="valid")return M.result;for(let M of Y)if(M.result.status==="dirty")return J.common.issues.push(...M.ctx.common.issues),M.result;let H=Y.map((M)=>new D1(M.ctx.common.issues));return y(J,{code:v.invalid_union,unionErrors:H}),m}if(J.common.async)return Promise.all(Q.map(async(Y)=>{let H={...J,common:{...J.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:J.data,path:J.path,parent:H}),ctx:H}})).then(X);else{let Y=void 0,H=[];for(let G of Q){let K={...J,common:{...J.common,issues:[]},parent:null},q=G._parseSync({data:J.data,path:J.path,parent:K});if(q.status==="valid")return q;else if(q.status==="dirty"&&!Y)Y={result:q,ctx:K};if(K.common.issues.length)H.push(K.common.issues)}if(Y)return J.common.issues.push(...Y.ctx.common.issues),Y.result;let M=H.map((G)=>new D1(G));return y(J,{code:v.invalid_union,unionErrors:M}),m}}get options(){return this._def.options}}o$.create=($,J)=>{return new o$({options:$,typeName:l.ZodUnion,...d(J)})};var o1=($)=>{if($ instanceof a$)return o1($.schema);else if($ instanceof x1)return o1($.innerType());else if($ instanceof s$)return[$.value];else if($ instanceof H$)return $.options;else if($ instanceof t$)return r.objectValues($.enum);else if($ instanceof e$)return o1($._def.innerType);else if($ instanceof n$)return[void 0];else if($ instanceof i$)return[null];else if($ instanceof Z1)return[void 0,...o1($.unwrap())];else if($ instanceof r1)return[null,...o1($.unwrap())];else if($ instanceof JJ)return o1($.unwrap());else if($ instanceof J0)return o1($.unwrap());else if($ instanceof $0)return o1($._def.innerType);else return[]};class $J extends i{_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==h.object)return y(J,{code:v.invalid_type,expected:h.object,received:J.parsedType}),m;let Q=this.discriminator,X=J.data[Q],Y=this.optionsMap.get(X);if(!Y)return y(J,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),m;if(J.common.async)return Y._parseAsync({data:J.data,path:J.path,parent:J});else return Y._parseSync({data:J.data,path:J.path,parent:J})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,J,Q){let X=new Map;for(let Y of J){let H=o1(Y.shape[$]);if(!H.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let M of H){if(X.has(M))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(M)}`);X.set(M,Y)}}return new $J({typeName:l.ZodDiscriminatedUnion,discriminator:$,options:J,optionsMap:X,...d(Q)})}}function B6($,J){let Q=m1($),X=m1(J);if($===J)return{valid:!0,data:$};else if(Q===h.object&&X===h.object){let Y=r.objectKeys(J),H=r.objectKeys($).filter((G)=>Y.indexOf(G)!==-1),M={...$,...J};for(let G of H){let K=B6($[G],J[G]);if(!K.valid)return{valid:!1};M[G]=K.data}return{valid:!0,data:M}}else if(Q===h.array&&X===h.array){if($.length!==J.length)return{valid:!1};let Y=[];for(let H=0;H<$.length;H++){let M=$[H],G=J[H],K=B6(M,G);if(!K.valid)return{valid:!1};Y.push(K.data)}return{valid:!0,data:Y}}else if(Q===h.date&&X===h.date&&+$===+J)return{valid:!0,data:$};else return{valid:!1}}class r$ extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($),X=(Y,H)=>{if(t0(Y)||t0(H))return m;let M=B6(Y.value,H.value);if(!M.valid)return y(Q,{code:v.invalid_intersection_types}),m;if(e0(Y)||e0(H))J.dirty();return{status:J.value,value:M.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,H])=>X(Y,H));else return X(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}r$.create=($,J,Q)=>{return new r$({left:$,right:J,typeName:l.ZodIntersection,...d(Q)})};class l1 extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.array)return y(Q,{code:v.invalid_type,expected:h.array,received:Q.parsedType}),m;if(Q.data.length<this._def.items.length)return y(Q,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;if(!this._def.rest&&Q.data.length>this._def.items.length)y(Q,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J.dirty();let Y=[...Q.data].map((H,M)=>{let G=this._def.items[M]||this._def.rest;if(!G)return null;return G._parse(new T1(Q,H,Q.path,M))}).filter((H)=>!!H);if(Q.common.async)return Promise.all(Y).then((H)=>{return q1.mergeArray(J,H)});else return q1.mergeArray(J,Y)}get items(){return this._def.items}rest($){return new l1({...this._def,rest:$})}}l1.create=($,J)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new l1({items:$,typeName:l.ZodTuple,rest:null,...d(J)})};class C0 extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.object)return y(Q,{code:v.invalid_type,expected:h.object,received:Q.parsedType}),m;let X=[],Y=this._def.keyType,H=this._def.valueType;for(let M in Q.data)X.push({key:Y._parse(new T1(Q,M,Q.path,M)),value:H._parse(new T1(Q,Q.data[M],Q.path,M)),alwaysSet:M in Q.data});if(Q.common.async)return q1.mergeObjectAsync(J,X);else return q1.mergeObjectSync(J,X)}get element(){return this._def.valueType}static create($,J,Q){if(J instanceof i)return new C0({keyType:$,valueType:J,typeName:l.ZodRecord,...d(Q)});return new C0({keyType:w1.create(),valueType:$,typeName:l.ZodRecord,...d(J)})}}class w0 extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.map)return y(Q,{code:v.invalid_type,expected:h.map,received:Q.parsedType}),m;let X=this._def.keyType,Y=this._def.valueType,H=[...Q.data.entries()].map(([M,G],K)=>{return{key:X._parse(new T1(Q,M,Q.path,[K,"key"])),value:Y._parse(new T1(Q,G,Q.path,[K,"value"]))}});if(Q.common.async){let M=new Map;return Promise.resolve().then(async()=>{for(let G of H){let K=await G.key,q=await G.value;if(K.status==="aborted"||q.status==="aborted")return m;if(K.status==="dirty"||q.status==="dirty")J.dirty();M.set(K.value,q.value)}return{status:J.value,value:M}})}else{let M=new Map;for(let G of H){let{key:K,value:q}=G;if(K.status==="aborted"||q.status==="aborted")return m;if(K.status==="dirty"||q.status==="dirty")J.dirty();M.set(K.value,q.value)}return{status:J.value,value:M}}}}w0.create=($,J,Q)=>{return new w0({valueType:J,keyType:$,typeName:l.ZodMap,...d(Q)})};class z$ extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.set)return y(Q,{code:v.invalid_type,expected:h.set,received:Q.parsedType}),m;let X=this._def;if(X.minSize!==null){if(Q.data.size<X.minSize.value)y(Q,{code:v.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),J.dirty()}if(X.maxSize!==null){if(Q.data.size>X.maxSize.value)y(Q,{code:v.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),J.dirty()}let Y=this._def.valueType;function H(G){let K=new Set;for(let q of G){if(q.status==="aborted")return m;if(q.status==="dirty")J.dirty();K.add(q.value)}return{status:J.value,value:K}}let M=[...Q.data.values()].map((G,K)=>Y._parse(new T1(Q,G,Q.path,K)));if(Q.common.async)return Promise.all(M).then((G)=>H(G));else return H(M)}min($,J){return new z$({...this._def,minSize:{value:$,message:f.toString(J)}})}max($,J){return new z$({...this._def,maxSize:{value:$,message:f.toString(J)}})}size($,J){return this.min($,J).max($,J)}nonempty($){return this.min(1,$)}}z$.create=($,J)=>{return new z$({valueType:$,minSize:null,maxSize:null,typeName:l.ZodSet,...d(J)})};class p$ extends i{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==h.function)return y(J,{code:v.invalid_type,expected:h.function,received:J.parsedType}),m;function Q(M,G){return S0({data:M,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,u$(),i1].filter((K)=>!!K),issueData:{code:v.invalid_arguments,argumentsError:G}})}function X(M,G){return S0({data:M,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,u$(),i1].filter((K)=>!!K),issueData:{code:v.invalid_return_type,returnTypeError:G}})}let Y={errorMap:J.common.contextualErrorMap},H=J.data;if(this._def.returns instanceof P$){let M=this;return B1(async function(...G){let K=new D1([]),q=await M._def.args.parseAsync(G,Y).catch((U)=>{throw K.addIssue(Q(G,U)),K}),W=await Reflect.apply(H,this,q);return await M._def.returns._def.type.parseAsync(W,Y).catch((U)=>{throw K.addIssue(X(W,U)),K})})}else{let M=this;return B1(function(...G){let K=M._def.args.safeParse(G,Y);if(!K.success)throw new D1([Q(G,K.error)]);let q=Reflect.apply(H,this,K.data),W=M._def.returns.safeParse(q,Y);if(!W.success)throw new D1([X(q,W.error)]);return W.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new p$({...this._def,args:l1.create($).rest(X$.create())})}returns($){return new p$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,J,Q){return new p$({args:$?$:l1.create([]).rest(X$.create()),returns:J||X$.create(),typeName:l.ZodFunction,...d(Q)})}}class a$ extends i{get schema(){return this._def.getter()}_parse($){let{ctx:J}=this._processInputParams($);return this._def.getter()._parse({data:J.data,path:J.path,parent:J})}}a$.create=($,J)=>{return new a$({getter:$,typeName:l.ZodLazy,...d(J)})};class s$ extends i{_parse($){if($.data!==this._def.value){let J=this._getOrReturnCtx($);return y(J,{received:J.data,code:v.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:$.data}}get value(){return this._def.value}}s$.create=($,J)=>{return new s$({value:$,typeName:l.ZodLiteral,...d(J)})};function PQ($,J){return new H$({values:$,typeName:l.ZodEnum,...d(J)})}class H$ extends i{_parse($){if(typeof $.data!=="string"){let J=this._getOrReturnCtx($),Q=this._def.values;return y(J,{expected:r.joinValues(Q),received:J.parsedType,code:v.invalid_type}),m}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let J=this._getOrReturnCtx($),Q=this._def.values;return y(J,{received:J.data,code:v.invalid_enum_value,options:Q}),m}return B1($.data)}get options(){return this._def.values}get enum(){let $={};for(let J of this._def.values)$[J]=J;return $}get Values(){let $={};for(let J of this._def.values)$[J]=J;return $}get Enum(){let $={};for(let J of this._def.values)$[J]=J;return $}extract($,J=this._def){return H$.create($,{...this._def,...J})}exclude($,J=this._def){return H$.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...J})}}H$.create=PQ;class t$ extends i{_parse($){let J=r.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==h.string&&Q.parsedType!==h.number){let X=r.objectValues(J);return y(Q,{expected:r.joinValues(X),received:Q.parsedType,code:v.invalid_type}),m}if(!this._cache)this._cache=new Set(r.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let X=r.objectValues(J);return y(Q,{received:Q.data,code:v.invalid_enum_value,options:X}),m}return B1($.data)}get enum(){return this._def.values}}t$.create=($,J)=>{return new t$({values:$,typeName:l.ZodNativeEnum,...d(J)})};class P$ extends i{unwrap(){return this._def.type}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==h.promise&&J.common.async===!1)return y(J,{code:v.invalid_type,expected:h.promise,received:J.parsedType}),m;let Q=J.parsedType===h.promise?J.data:Promise.resolve(J.data);return B1(Q.then((X)=>{return this._def.type.parseAsync(X,{path:J.path,errorMap:J.common.contextualErrorMap})}))}}P$.create=($,J)=>{return new P$({type:$,typeName:l.ZodPromise,...d(J)})};class x1 extends i{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===l.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:J,ctx:Q}=this._processInputParams($),X=this._def.effect||null,Y={addIssue:(H)=>{if(y(Q,H),H.fatal)J.abort();else J.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),X.type==="preprocess"){let H=X.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(H).then(async(M)=>{if(J.value==="aborted")return m;let G=await this._def.schema._parseAsync({data:M,path:Q.path,parent:Q});if(G.status==="aborted")return m;if(G.status==="dirty")return A$(G.value);if(J.value==="dirty")return A$(G.value);return G});else{if(J.value==="aborted")return m;let M=this._def.schema._parseSync({data:H,path:Q.path,parent:Q});if(M.status==="aborted")return m;if(M.status==="dirty")return A$(M.value);if(J.value==="dirty")return A$(M.value);return M}}if(X.type==="refinement"){let H=(M)=>{let G=X.refinement(M,Y);if(Q.common.async)return Promise.resolve(G);if(G instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return M};if(Q.common.async===!1){let M=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(M.status==="aborted")return m;if(M.status==="dirty")J.dirty();return H(M.value),{status:J.value,value:M.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((M)=>{if(M.status==="aborted")return m;if(M.status==="dirty")J.dirty();return H(M.value).then(()=>{return{status:J.value,value:M.value}})})}if(X.type==="transform")if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!Q$(H))return m;let M=X.transform(H.value,Y);if(M instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:J.value,value:M}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(!Q$(H))return m;return Promise.resolve(X.transform(H.value,Y)).then((M)=>({status:J.value,value:M}))});r.assertNever(X)}}x1.create=($,J,Q)=>{return new x1({schema:$,typeName:l.ZodEffects,effect:J,...d(Q)})};x1.createWithPreprocess=($,J,Q)=>{return new x1({schema:J,effect:{type:"preprocess",transform:$},typeName:l.ZodEffects,...d(Q)})};class Z1 extends i{_parse($){if(this._getType($)===h.undefined)return B1(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}Z1.create=($,J)=>{return new Z1({innerType:$,typeName:l.ZodOptional,...d(J)})};class r1 extends i{_parse($){if(this._getType($)===h.null)return B1(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}r1.create=($,J)=>{return new r1({innerType:$,typeName:l.ZodNullable,...d(J)})};class e$ extends i{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;if(J.parsedType===h.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:J.path,parent:J})}removeDefault(){return this._def.innerType}}e$.create=($,J)=>{return new e$({innerType:$,typeName:l.ZodDefault,defaultValue:typeof J.default==="function"?J.default:()=>J.default,...d(J)})};class $0 extends i{_parse($){let{ctx:J}=this._processInputParams($),Q={...J,common:{...J.common,issues:[]}},X=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(l$(X))return X.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new D1(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new D1(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}$0.create=($,J)=>{return new $0({innerType:$,typeName:l.ZodCatch,catchValue:typeof J.catch==="function"?J.catch:()=>J.catch,...d(J)})};class _0 extends i{_parse($){if(this._getType($)!==h.nan){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.nan,received:Q.parsedType}),m}return{status:"valid",value:$.data}}}_0.create=($)=>{return new _0({typeName:l.ZodNaN,...d($)})};var uG=Symbol("zod_brand");class JJ extends i{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;return this._def.type._parse({data:Q,path:J.path,parent:J})}unwrap(){return this._def.type}}class Z0 extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return m;if(Y.status==="dirty")return J.dirty(),A$(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let X=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return m;if(X.status==="dirty")return J.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Q.path,parent:Q})}}static create($,J){return new Z0({in:$,out:J,typeName:l.ZodPipeline})}}class J0 extends i{_parse($){let J=this._def.innerType._parse($),Q=(X)=>{if(Q$(X))X.value=Object.freeze(X.value);return X};return l$(J)?J.then((X)=>Q(X)):Q(J)}unwrap(){return this._def.innerType}}J0.create=($,J)=>{return new J0({innerType:$,typeName:l.ZodReadonly,...d(J)})};function AQ($,J){let Q=typeof $==="function"?$(J):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function CQ($,J={},Q){if($)return S$.create().superRefine((X,Y)=>{let H=$(X);if(H instanceof Promise)return H.then((M)=>{if(!M){let G=AQ(J,X),K=G.fatal??Q??!0;Y.addIssue({code:"custom",...G,fatal:K})}});if(!H){let M=AQ(J,X),G=M.fatal??Q??!0;Y.addIssue({code:"custom",...M,fatal:G})}return});return S$.create()}var lG={object:H1.lazycreate},l;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(l||(l={}));var cG=($,J={message:`Input not instance of ${$.name}`})=>CQ((Q)=>Q instanceof $,J),wQ=w1.create,_Q=Y$.create,pG=_0.create,dG=G$.create,ZQ=d$.create,nG=I$.create,iG=z0.create,oG=n$.create,rG=i$.create,aG=S$.create,sG=X$.create,tG=u1.create,eG=P0.create,$5=_1.create,J5=H1.create,Q5=H1.strictCreate,X5=o$.create,Y5=$J.create,G5=r$.create,H5=l1.create,j5=C0.create,V5=w0.create,K5=z$.create,R5=p$.create,W5=a$.create,q5=s$.create,M5=H$.create,B5=t$.create,N5=P$.create,U5=x1.create,F5=Z1.create,D5=r1.create,O5=x1.createWithPreprocess,L5=Z0.create,E5=()=>wQ().optional(),A5=()=>_Q().optional(),I5=()=>ZQ().optional(),S5={string:($)=>w1.create({...$,coerce:!0}),number:($)=>Y$.create({...$,coerce:!0}),boolean:($)=>d$.create({...$,coerce:!0}),bigint:($)=>G$.create({...$,coerce:!0}),date:($)=>I$.create({...$,coerce:!0})};var z5=m;var j$=($,J)=>{let Q=new Uint8Array(1+J.length);return Q[0]=$,Q.set(J,1),Q},xQ=($,J)=>{let Q=typeof $==="string";if(typeof $==="string")$=J.encode($);let X=new Uint8Array(1+$.byteLength);return X[0]=Q?0:1,X.set(new Uint8Array($),1),X},vQ=($,J)=>{if($[0]===0)return J.decode($.subarray(1));return new Uint8Array($.subarray(1))};var N6={[0]:z.string(),[1]:z.object({method:z.string(),headers:z.record(z.string(),z.string()),url:z.string()}),[2]:z.instanceof(Uint8Array),[3]:z.object({type:z.enum(["text","binary"]),data:z.instanceof(Uint8Array)}),[4]:z.object({code:z.number().optional(),reason:z.string().optional()})},Ij={[0]:z.string(),[1]:z.string(),[2]:z.object({status_code:z.number(),status_message:z.string(),headers:z.record(z.string(),z.string())}),[3]:z.instanceof(Uint8Array),[4]:z.instanceof(Uint8Array),[5]:z.object({code:z.number(),reason:z.string()})},Sj={[1]:{method:z.string(),headers:z.record(z.string(),z.string()),url:z.string()}},kQ={process_execute:z.object({command:z.string(),args:z.array(z.string()),env:z.record(z.string(),z.string()).optional(),cwd:z.string().optional()}),process_send_input:z.object({pid:z.number(),data:z.string()}),process_wait:z.object({pid:z.number(),output_idle_timeout_ms:z.number().optional(),timeout_ms:z.number().optional()}),process_list:z.object({include_dead:z.boolean().optional()}),process_read_plain_output:z.object({pid:z.number(),start_line:z.number().optional(),end_line:z.number().optional()}),process_kill:z.object({pid:z.number(),signal:z.string().optional()}),set_env:z.object({env:z.record(z.string(),z.string())}),read_file:z.object({path:z.string(),line_start:z.number().optional(),line_end:z.number().optional()}),write_file:z.object({path:z.string(),content:z.string(),base64:z.boolean().optional(),mode:z.number().optional()}),read_directory:z.object({path:z.string()}),watch_directory:z.object({path:z.string()})},U6=z.object({pid:z.number(),command:z.string(),args:z.array(z.string()),title:z.string().optional(),cwd:z.string(),env:z.record(z.string(),z.string()),exit_code:z.number().optional(),exit_signal:z.number().optional(),duration_ms:z.number().optional(),output_total_lines:z.number()}),P5=U6.extend({ansi_output:z.string(),plain_output:z.object({lines:z.array(z.string()),total_lines:z.number()})}),zj={process_execute:z.object({pid:z.number()}),process_send_input:z.object({}),process_wait:P5,process_list:z.object({processes:z.array(U6)}),process_read_plain_output:z.object({lines:z.array(z.string()),total_lines:z.number(),duration_ms:z.number(),exit_code:z.number().optional(),exit_signal:z.number().optional()}),process_kill:z.object({}),set_env:z.object({}),read_file:z.object({total_lines:z.number(),lines_read:z.number(),start_line:z.number(),content:z.string(),mime_type:z.string()}),write_file:z.object({}),read_directory:z.object({entries:z.array(z.object({name:z.string(),type:z.enum(["file","directory","symlink"])}))}),watch_directory:z.object({})},C5=z.object({type:z.enum(["create","update","delete"]),path:z.string()}),w5=z.object({type:z.enum(["context","added","deleted"]),content:z.string(),oldLineNumber:z.number().optional(),newLineNumber:z.number().optional()}),_5=z.object({oldStart:z.number(),oldLines:z.number(),newStart:z.number(),newLines:z.number(),lines:z.array(w5)}),hQ=z.object({path:z.string(),status:z.enum(["added","modified","deleted","renamed","copied","untracked","ignored","unmerged","typechange"]),oldPath:z.string().optional(),insertions:z.number(),deletions:z.number(),chunks:z.array(_5)}),TQ=z.object({totalFiles:z.number(),totalInsertions:z.number(),totalDeletions:z.number(),netChange:z.number(),startHash:z.string().optional(),currentHash:z.string().optional(),timespan:z.number(),files:z.array(hQ)}),Z5=z.object({path:z.string(),status:z.enum(["added","modified","deleted","renamed","copied","untracked","ignored","unmerged","typechange"]),staged:z.boolean()}),T5=z.object({hash:z.string(),shortHash:z.string(),message:z.string(),author:z.string(),email:z.string(),date:z.date(),timestamp:z.date(),filesChanged:z.number(),insertions:z.number(),deletions:z.number(),commitDiff:z.array(hQ).optional()}),x5=z.object({files:z.array(Z5),branch:z.string(),ahead:z.number(),behind:z.number(),timestamp:z.date(),sessionDiff:TQ.optional(),workingDirectoryDiff:TQ.optional(),newCommits:z.array(T5),currentCommit:z.object({hash:z.string(),shortHash:z.string(),message:z.string(),author:z.string(),date:z.date()}).optional(),diffSkipped:z.boolean().optional(),payloadTruncated:z.boolean().optional(),estimatedSizeKB:z.number().optional()}),Pj=z.object({debounceDelay:z.number().optional(),gitStatusInterval:z.number().optional(),ignoreDotfiles:z.boolean().optional(),ignored:z.array(z.string()).optional(),watchGit:z.boolean().optional(),includeDiffs:z.boolean().optional(),maxDiffFiles:z.number().optional(),maxPayloadSizeKB:z.number().optional(),truncateLargeDiffs:z.boolean().optional()}),Cj={process_status:z.object({status:U6}),process_output:z.object({pid:z.number(),output:z.string()}),file_change:z.object({changes:z.array(C5)}),git_status:x5};var a7=J1(ZX()),s7=J1(A6()),t7=J1(S6()),BJ=J1(qJ()),e7=J1(yX());var T6=BJ.default;class x6{multiplexer;notificationStream;decoder=new TextDecoder;encoder=new TextEncoder;processManager;constructor($){this.multiplexer=new l0({send:(J)=>{$.send(J)}}),this.multiplexer.onStream((J)=>{this.handleStream(J)}),this.notificationStream=this.multiplexer.createStream(),this.processManager=new S1($.env),this.processManager.onSpawn((J)=>{let Q=()=>{this.sendNotification({type:"process_status",payload:{status:this.processManager.status(J.pid)}})};Q(),J.terminal.onTitleChange(()=>{Q()}),J.onExit(()=>{this.sendNotification({type:"process_status",payload:{status:this.processManager.status(J.pid)}})}),J.onOutput((X)=>{this.sendNotification({type:"process_output",payload:{pid:J.pid,output:X}})})})}handleMessage($){this.multiplexer.handleMessage($)}handleStream($){let J=new AbortController;$.onClose(()=>{J.abort()}),$.onData((Q)=>{let X=Q[0],Y=Q.subarray(1);switch(X){case 0:{let H=JSON.parse(this.decoder.decode(Y));this.handleRequest($,H,J.signal).catch((M)=>{this.sendResponse($,{id:H.id,error:M instanceof Error?M.message:String(M)})});break}case 1:{let H=N6[1].safeParse(JSON.parse(this.decoder.decode(Y)));if(!H.success)throw new Error("Invalid proxy init message");let M;if(H.data.headers.upgrade==="websocket")M=this.handleProxyWebSocket($,H.data);else M=this.handleProxyRequest($,H.data);M.catch((G)=>{$.error(G.message)});break}}})}async handleProxyWebSocket($,J){let Q=new URL(J.url);if(Q.protocol==="http:")Q.protocol="ws:";else if(Q.protocol==="https:")Q.protocol="wss:";let X=new BJ.default(Q.toString(),J.headers["sec-websocket-protocol"]?J.headers["sec-websocket-protocol"]:void 0,{headers:J.headers});X.addEventListener("open",()=>{let Y={status_code:101,status_message:"Switching Protocols",headers:{}};$.write(j$(2,this.encoder.encode(JSON.stringify(Y))))}),X.addEventListener("message",(Y)=>{if($.disposed)return;$.write(j$(4,xQ(Y.data,this.encoder)))}),X.addEventListener("close",(Y)=>{if($.disposed)return;let H={code:Y.code,reason:Y.reason};$.write(j$(5,this.encoder.encode(JSON.stringify(H)))),$.close()}),X.addEventListener("error",(Y)=>{console.log("err",Y)}),$.onClose(()=>{X.close()}),$.onError((Y)=>{X.close(1011,Y)}),$.onData((Y)=>{let H=Y.subarray(1);switch(Y[0]){case 3:{let M=vQ(H,this.decoder);X.send(M);break}case 4:{let M=N6[4].safeParse(JSON.parse(this.decoder.decode(H)));if(!M.success)throw new Error("Invalid proxy websocket close message");try{X.close(M.data.code,M.data.reason)}catch(G){console.error("Error closing websocket",G,M.data)}break}default:$.error(`Unexpected message type: ${Y[0]}`)}})}async handleProxyRequest($,J){let Q,X;if(J.method!=="GET"&&J.method!=="HEAD"&&J.method!=="OPTIONS"){let G=new TransformStream;Q=G.writable.getWriter(),X=G.readable}$.onData((G)=>{switch(G[0]){case 2:{if(Q){let K=G.subarray(1);if(K.length===0)Q.close();else Q.write(K)}break}default:$.error(`Unexpected message type: ${G[0]}`)}});let Y=await fetch(J.url,{headers:J.headers,method:J.method,body:X}),H={};Y.headers.forEach((G,K)=>{H[K]=G});let M={headers:H,status_code:Y.status,status_message:Y.statusText};if($.write(j$(2,this.encoder.encode(JSON.stringify(M)))),Y.body){let G=Y.headers.get("content-length"),K=G?parseInt(G):0,q=524288;if(K>=524288){let W=Y.body.getReader();try{while(!0){let{done:B,value:U}=await W.read();if(B)break;if(U){let R=0;while(R<U.length){let D=Math.min(524288,U.length-R),j=U.subarray(R,R+D);if($.write(j$(3,j)),R+=D,R<U.length)await new Promise((V)=>setImmediate(V))}}}}finally{W.releaseLock()}}else await Y.body.pipeTo(new WritableStream({write:(W)=>{$.write(j$(3,W))}}))}$.close()}async handleRequest($,J,Q){let Y=kQ[J.type].safeParse(J.payload);if(!Y.success)throw new Error(`Invalid request payload: ${Y.error.message}`);switch(J.type){case"process_execute":{let H=this.processManager.execute(J.payload.command,J.payload.args,{cwd:J.payload.cwd,env:J.payload.env});this.sendResponse($,{id:J.id,payload:{pid:H.pid}});break}case"process_wait":{this.handleProcessWait($,J,Q);break}case"process_kill":{this.mustGetProcess(J.payload.pid).kill(J.payload.signal),this.sendResponse($,{id:J.id,payload:{}});break}case"process_list":{this.sendResponse($,{id:J.id,payload:{processes:this.processManager.list(J.payload.include_dead??!1)}});break}case"process_read_plain_output":{let H=this.mustGetProcess(J.payload.pid),M=this.processManager.readPlainOutput(J.payload.pid,J.payload.start_line,J.payload.end_line);this.sendResponse($,{id:J.id,payload:{lines:M.lines,total_lines:M.totalLines,duration_ms:Date.now()-H.startTimeMS,exit_code:H.exitCode,exit_signal:H.exitSignal}});break}case"process_send_input":{this.mustGetProcess(J.payload.pid).sendInput(J.payload.data),this.sendResponse($,{id:J.id,payload:{}});break}case"set_env":{this.processManager.setEnv(J.payload.env),this.sendResponse($,{id:J.id,payload:{}});break}case"read_file":{let H=await e1.readFile(J.payload.path),M=await tJ(H);if(!(!M||M?.mime==="text/plain")){this.sendResponse($,{id:J.id,payload:{content:H.toString("base64"),mime_type:M?.mime,total_lines:0,lines_read:0,start_line:0}});break}let q=H.toString("utf-8").split(`
49
+ `+Q)}function Z1($,J,Q,X,Y){if($.listenerCount("wsClientError")){let H=new Error(Y);Error.captureStackTrace(H,Z1),$.emit("wsClientError",H,Q,J)}else f0(Q,X,Y)}});var N8=J$(B8()),{program:F1,createCommand:EH,createArgument:AH,createOption:IH,CommanderError:SH,InvalidArgumentError:zH,InvalidOptionArgumentError:PH,Command:CH,Argument:wH,Option:_H,Help:ZH}=N8.default;class h${listeners=[];get event(){return($)=>{return this.listeners.push($),{dispose:()=>{this.listeners=this.listeners.filter((J)=>J!==$)}}}}emit($){for(let J=this.listeners.length-1;J>=0;J--)this.listeners[J]?.($)}dispose(){this.listeners=[]}}class TJ{static MAX_POOL_SIZE=100;static COMMON_SIZES=[64,256,1024,4096,16384];static pools=new Map;static{for(let $ of this.COMMON_SIZES)this.pools.set($,[])}static acquire($){for(let J of this.COMMON_SIZES)if(J>=$){let Q=this.pools.get(J);if(Q&&Q.length>0)return Q.pop();break}return new Uint8Array($)}static release($){let J=$.length;for(let Q of this.COMMON_SIZES)if(Q===J){let X=this.pools.get(Q);if(X&&X.length<this.MAX_POOL_SIZE)X.push($);break}}}class g${static HEADER_SIZE=4;static MAX_FRAME_SIZE=1048576-g$.HEADER_SIZE;static encode($){let J=$.payload.length;if(J>this.MAX_FRAME_SIZE)throw new Error(`Frame payload too large: ${J} > ${this.MAX_FRAME_SIZE}`);let Q=this.HEADER_SIZE+J,X=TJ.acquire(Q),Y=$.streamId<<8|$.type<<4|$.flags&15;if(X[0]=Y>>>24&255,X[1]=Y>>>16&255,X[2]=Y>>>8&255,X[3]=Y&255,J>0)X.set($.payload,this.HEADER_SIZE);return X.length===Q?X:X.subarray(0,Q)}static decode($){if($.length<g$.HEADER_SIZE)throw new Error(`Invalid frame: too short (${$.length} < ${g$.HEADER_SIZE})`);let J=$[0]<<24|$[1]<<16|$[2]<<8|$[3],Q=J>>>8,X=J&255,Y=X>>>4,H=X&15,M=$.length>g$.HEADER_SIZE?$.subarray(g$.HEADER_SIZE):new Uint8Array(0);return{streamId:Q,type:Y,flags:H,payload:M}}static releaseBuffer($){TJ.release($)}static getMaxPayloadSize(){return g$.MAX_FRAME_SIZE}}class U8{send;_onData;_onClose;_onError;_disposed=!1;_id;constructor($,J){this.send=J;this._id=$}get id(){return this._id}get onData(){if(!this._onData)this._onData=new h$;return this._onData.event}get onClose(){if(!this._onClose)this._onClose=new h$;return this._onClose.event}get onError(){if(!this._onError)this._onError=new h$;return this._onError.event}write($,J=!1){if(this._disposed)throw new Error(`Cannot write to disposed stream ${this.id}`);let Q=g$.getMaxPayloadSize();if($.length<=Q){this.send({streamId:this.id,type:0,flags:J?1:0,payload:$});return}let X=0,Y=!0;while(X<$.length){let H=$.length-X,M=H>Q?Q:H,G=$.subarray(X,X+M);this.send({streamId:this.id,type:0,flags:J&&Y?1:0,payload:G}),X+=M,Y=!1}}close(){if(this._disposed)return;this.send({streamId:this.id,type:1,flags:0,payload:new Uint8Array(0)}),this._dispose()}error($){if(this._disposed)return;this.send({streamId:this.id,type:2,flags:0,payload:new TextEncoder().encode($)})}_handleFrame($){if(this._disposed)return;switch($.type){case 0:this._onData?.emit($.payload);break;case 1:this._onClose?.emit(),this._dispose();break;case 2:let J=new TextDecoder().decode($.payload);this._onError?.emit(J),this._dispose();break}}_dispose(){if(this._disposed)return;this._disposed=!0,this._onData?.dispose(),this._onClose?.dispose(),this._onError?.dispose(),this._onData=void 0,this._onClose=void 0,this._onError=void 0}_reset($,J){this._dispose(),this._id=$,this.send=J,this._disposed=!1}get createdByClient(){return this.id%2===1}get disposed(){return this._disposed}}class B0{static MAX_POOL_SIZE=200;static pool=[];static acquire($,J){let Q=this.pool.pop();if(Q)return Q._reset($,J),Q;return new U8($,J)}static release($){if(this.pool.length<this.MAX_POOL_SIZE)this.pool.push($)}}class c0{_onNextStreamIDChange=new h$;onNextStreamIDChange=this._onNextStreamIDChange.event;_onStream=new h$;onStream=this._onStream.event;streams=[];streamCount=0;nextStreamId=1;send;constructor($){this.nextStreamId=$.initialNextStreamID??($.isClient?1:2),this.send=$.send}getStream($){return this.streams[$]}createStream($){if($===void 0)$=this.nextStreamId,this.nextStreamId+=2,this._onNextStreamIDChange.emit(this.nextStreamId);let J=this.streams[$];if(J&&!J.disposed)throw new Error(`Stream ${$} already exists`);let Q=B0.acquire($,(X)=>this.sendFrame(X));return this.streams[$]=Q,this.streamCount++,Q}sendFrame($){let J=g$.encode($);this.send(J)}handleMessage($){this.handleFrame(g$.decode($))}handleFrame($){let J=this.streams[$.streamId];if(!J||J.disposed)J=B0.acquire($.streamId,(Q)=>this.sendFrame(Q)),this.streams[$.streamId]=J,this.streamCount++,this._onStream.emit(J);if(J._handleFrame($),$.type===1||$.type===2)this.streams[$.streamId]=void 0,this.streamCount--,B0.release(J)}get activeStreamCount(){return this.streamCount}dispose(){for(let $ of this.streams)if($&&!$.disposed)$.close(),B0.release($);this.streams.length=0,this.streamCount=0,this._onNextStreamIDChange.dispose(),this._onStream.dispose()}}class X$ extends Error{constructor(){super("End-Of-Stream");this.name="EndOfStreamError"}}class x1 extends Error{constructor($="The operation was aborted"){super($);this.name="AbortError"}}class v1{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek($,J=!1){let Q=await this.read($,J);return this.peekQueue.push($.subarray(0,Q)),Q}async read($,J=!1){if($.length===0)return 0;let Q=this.readFromPeekBuffer($);if(!this.endOfStream)Q+=await this.readRemainderFromStream($.subarray(Q),J);if(Q===0)throw new X$;return Q}readFromPeekBuffer($){let J=$.length,Q=0;while(this.peekQueue.length>0&&J>0){let X=this.peekQueue.pop();if(!X)throw new Error("peekData should be defined");let Y=Math.min(X.length,J);if($.set(X.subarray(0,Y),Q),Q+=Y,J-=Y,Y<X.length)this.peekQueue.push(X.subarray(Y))}return Q}async readRemainderFromStream($,J){let Q=0;while(Q<$.length&&!this.endOfStream){if(this.interrupted)throw new x1;let X=await this.readFromStream($.subarray(Q),J);if(X===0)break;Q+=X}if(!J&&Q<$.length)throw new X$;return Q}}class xJ extends v1{constructor($){super();this.reader=$}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class p0 extends xJ{async readFromStream($,J){if($.length===0)return 0;let Q=await this.reader.read(new Uint8Array($.length),{min:J?void 0:$.length});if(Q.done)this.endOfStream=Q.done;if(Q.value)return $.set(Q.value),Q.value.length;return 0}}class N0 extends v1{constructor($){super();this.reader=$,this.buffer=null}writeChunk($,J){let Q=Math.min(J.length,$.length);if($.set(J.subarray(0,Q)),Q<J.length)this.buffer=J.subarray(Q);else this.buffer=null;return Q}async readFromStream($,J){if($.length===0)return 0;let Q=0;if(this.buffer)Q+=this.writeChunk($,this.buffer);while(Q<$.length&&!this.endOfStream){let X=await this.reader.read();if(X.done){this.endOfStream=!0;break}if(X.value)Q+=this.writeChunk($.subarray(Q),X.value)}if(Q===0&&this.endOfStream)throw new X$;return Q}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function vJ($){try{let J=$.getReader({mode:"byob"});if(J instanceof ReadableStreamDefaultReader)return new N0(J);return new p0(J)}catch(J){if(J instanceof TypeError)return new N0($.getReader());throw J}}class $1{constructor($){if(this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=$?.onClose,$?.abortSignal)$.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken($,J=this.position){let Q=new Uint8Array($.len);if(await this.readBuffer(Q,{position:J})<$.len)throw new X$;return $.get(Q,0)}async peekToken($,J=this.position){let Q=new Uint8Array($.len);if(await this.peekBuffer(Q,{position:J})<$.len)throw new X$;return $.get(Q,0)}async readNumber($){if(await this.readBuffer(this.numBuffer,{length:$.len})<$.len)throw new X$;return $.get(this.numBuffer,0)}async peekNumber($){if(await this.peekBuffer(this.numBuffer,{length:$.len})<$.len)throw new X$;return $.get(this.numBuffer,0)}async ignore($){if(this.fileInfo.size!==void 0){let J=this.fileInfo.size-this.position;if($>J)return this.position+=J,J}return this.position+=$,$}async close(){await this.abort(),await this.onClose?.()}normalizeOptions($,J){if(!this.supportsRandomAccess()&&J&&J.position!==void 0&&J.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{...{mayBeLess:!1,offset:0,length:$.length,position:this.position},...J}}abort(){return Promise.resolve()}}var _Y=256000;class kJ extends $1{constructor($,J){super(J);this.streamReader=$,this.fileInfo=J?.fileInfo??{}}async readBuffer($,J){let Q=this.normalizeOptions($,J),X=Q.position-this.position;if(X>0)return await this.ignore(X),this.readBuffer($,J);if(X<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(Q.length===0)return 0;let Y=await this.streamReader.read($.subarray(0,Q.length),Q.mayBeLess);if(this.position+=Y,(!J||!J.mayBeLess)&&Y<Q.length)throw new X$;return Y}async peekBuffer($,J){let Q=this.normalizeOptions($,J),X=0;if(Q.position){let Y=Q.position-this.position;if(Y>0){let H=new Uint8Array(Q.length+Y);return X=await this.peekBuffer(H,{mayBeLess:Q.mayBeLess}),$.set(H.subarray(Y)),X-Y}if(Y<0)throw new Error("Cannot peek from a negative offset in a stream")}if(Q.length>0){try{X=await this.streamReader.peek($.subarray(0,Q.length),Q.mayBeLess)}catch(Y){if(J?.mayBeLess&&Y instanceof X$)return 0;throw Y}if(!Q.mayBeLess&&X<Q.length)throw new X$}return X}async ignore($){let J=Math.min(_Y,$),Q=new Uint8Array(J),X=0;while(X<$){let Y=$-X,H=await this.readBuffer(Q,{length:Math.min(J,Y)});if(H<0)return H;X+=H}return X}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class hJ extends $1{constructor($,J){super(J);this.uint8Array=$,this.fileInfo={...J?.fileInfo??{},...{size:$.length}}}async readBuffer($,J){if(J?.position)this.position=J.position;let Q=await this.peekBuffer($,J);return this.position+=Q,Q}async peekBuffer($,J){let Q=this.normalizeOptions($,J),X=Math.min(this.uint8Array.length-Q.position,Q.length);if(!Q.mayBeLess&&X<Q.length)throw new X$;return $.set(this.uint8Array.subarray(Q.position,Q.position+X)),X}close(){return super.close()}supportsRandomAccess(){return!0}setPosition($){this.position=$}}function gJ($,J){let Q=vJ($),X=J??{},Y=X.onClose;return X.onClose=async()=>{if(await Q.close(),Y)return Y()},new kJ(Q,X)}function F8($,J){return new hJ($,J)}var D8=require("node:fs/promises");class U0 extends $1{static async fromFile($){let J=await D8.open($,"r"),Q=await J.stat();return new U0(J,{fileInfo:{path:$,size:Q.size}})}constructor($,J){super(J);this.fileHandle=$,this.fileInfo=J.fileInfo}async readBuffer($,J){let Q=this.normalizeOptions($,J);if(this.position=Q.position,Q.length===0)return 0;let X=await this.fileHandle.read($,0,Q.length,Q.position);if(this.position+=X.bytesRead,X.bytesRead<Q.length&&(!J||!J.mayBeLess))throw new X$;return X.bytesRead}async peekBuffer($,J){let Q=this.normalizeOptions($,J),X=await this.fileHandle.read($,0,Q.length,Q.position);if(!Q.mayBeLess&&X.bytesRead<Q.length)throw new X$;return X.bytesRead}async close(){return await this.fileHandle.close(),super.close()}setPosition($){this.position=$}supportsRandomAccess(){return!0}}var TY=U0.fromFile;var L8=J$(O8());function U$($){return new DataView($.buffer,$.byteOffset)}var E8={len:1,get($,J){return U$($).getUint8(J)},put($,J,Q){return U$($).setUint8(J,Q),J+1}},G$={len:2,get($,J){return U$($).getUint16(J,!0)},put($,J,Q){return U$($).setUint16(J,Q,!0),J+2}},k1={len:2,get($,J){return U$($).getUint16(J)},put($,J,Q){return U$($).setUint16(J,Q),J+2}};var j$={len:4,get($,J){return U$($).getUint32(J,!0)},put($,J,Q){return U$($).setUint32(J,Q,!0),J+4}},A8={len:4,get($,J){return U$($).getUint32(J)},put($,J,Q){return U$($).setUint32(J,Q),J+4}};var I8={len:4,get($,J){return U$($).getInt32(J)},put($,J,Q){return U$($).setInt32(J,Q),J+4}};var S8={len:8,get($,J){return U$($).getBigUint64(J,!0)},put($,J,Q){return U$($).setBigUint64(J,Q,!0),J+8}};class O${constructor($,J){this.len=$,this.encoding=J,this.textDecoder=new TextDecoder(J)}get($,J){return this.textDecoder.decode($.subarray(J,J+this.len))}}var z8=require("module"),kY=z8.createRequire("/"),hY;try{hY=kY("worker_threads").Worker}catch($){}var E$=Uint8Array,h1=Uint16Array,gY=Int32Array,P8=new E$([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,0,0,0]),C8=new E$([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,0,0]),yY=new E$([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w8=function($,J){var Q=new h1(31);for(var X=0;X<31;++X)Q[X]=J+=1<<$[X-1];var Y=new gY(Q[30]);for(var X=1;X<30;++X)for(var H=Q[X];H<Q[X+1];++H)Y[H]=H-Q[X]<<5|X;return{b:Q,r:Y}},_8=w8(P8,2),Z8=_8.b,bY=_8.r;Z8[28]=258,bY[258]=28;var T8=w8(C8,0),fY=T8.b,w3=T8.r,mJ=new h1(32768);for(o=0;o<32768;++o)y$=(o&43690)>>1|(o&21845)<<1,y$=(y$&52428)>>2|(y$&13107)<<2,y$=(y$&61680)>>4|(y$&3855)<<4,mJ[o]=((y$&65280)>>8|(y$&255)<<8)>>1;var y$,o,F0=function($,J,Q){var X=$.length,Y=0,H=new h1(J);for(;Y<X;++Y)if($[Y])++H[$[Y]-1];var M=new h1(J);for(Y=1;Y<J;++Y)M[Y]=M[Y-1]+H[Y-1]<<1;var G;if(Q){G=new h1(1<<J);var K=15-J;for(Y=0;Y<X;++Y)if($[Y]){var q=Y<<4|$[Y],W=J-$[Y],B=M[$[Y]-1]++<<W;for(var U=B|(1<<W)-1;B<=U;++B)G[mJ[B]>>K]=q}}else{G=new h1(X);for(Y=0;Y<X;++Y)if($[Y])G[Y]=mJ[M[$[Y]-1]++]>>15-$[Y]}return G},D0=new E$(288);for(o=0;o<144;++o)D0[o]=8;var o;for(o=144;o<256;++o)D0[o]=9;var o;for(o=256;o<280;++o)D0[o]=7;var o;for(o=280;o<288;++o)D0[o]=8;var o,x8=new E$(32);for(o=0;o<32;++o)x8[o]=5;var o;var mY=F0(D0,9,1);var uY=F0(x8,5,1),bJ=function($){var J=$[0];for(var Q=1;Q<$.length;++Q)if($[Q]>J)J=$[Q];return J},C$=function($,J,Q){var X=J/8|0;return($[X]|$[X+1]<<8)>>(J&7)&Q},fJ=function($,J){var Q=J/8|0;return($[Q]|$[Q+1]<<8|$[Q+2]<<16)>>(J&7)},lY=function($){return($+7)/8|0},cY=function($,J,Q){if(J==null||J<0)J=0;if(Q==null||Q>$.length)Q=$.length;return new E$($.subarray(J,Q))};var pY=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],L$=function($,J,Q){var X=new Error(J||pY[$]);if(X.code=$,Error.captureStackTrace)Error.captureStackTrace(X,L$);if(!Q)throw X;return X},uJ=function($,J,Q,X){var Y=$.length,H=X?X.length:0;if(!Y||J.f&&!J.l)return Q||new E$(0);var M=!Q,G=M||J.i!=2,K=J.i;if(M)Q=new E$(Y*3);var q=function(p$){var d$=Q.length;if(p$>d$){var B1=new E$(Math.max(d$*2,p$));B1.set(Q),Q=B1}},W=J.f||0,B=J.p||0,U=J.b||0,R=J.l,D=J.d,j=J.m,V=J.n,L=Y*8;do{if(!R){W=C$($,B,1);var F=C$($,B+1,3);if(B+=3,!F){var N=lY(B)+4,O=$[N-4]|$[N-3]<<8,A=N+O;if(A>Y){if(K)L$(0);break}if(G)q(U+O);Q.set($.subarray(N,A),U),J.b=U+=O,J.p=B=A*8,J.f=W;continue}else if(F==1)R=mY,D=uY,j=9,V=5;else if(F==2){var I=C$($,B,31)+257,w=C$($,B+10,15)+4,Z=I+C$($,B+5,31)+1;B+=14;var k=new E$(Z),x=new E$(19);for(var T=0;T<w;++T)x[yY[T]]=C$($,B+T*3,7);B+=w*3;var g=bJ(x),Q$=(1<<g)-1,k$=F0(x,g,1);for(var T=0;T<Z;){var N$=k$[C$($,B,Q$)];B+=N$&15;var N=N$>>4;if(N<16)k[T++]=N;else{var t=0,V$=0;if(N==16)V$=3+C$($,B,3),B+=2,t=k[T-1];else if(N==17)V$=3+C$($,B,7),B+=3;else if(N==18)V$=11+C$($,B,127),B+=7;while(V$--)k[T++]=t}}var E=k.subarray(0,I),S=k.subarray(I);j=bJ(E),V=bJ(S),R=F0(E,j,1),D=F0(S,V,1)}else L$(1);if(B>L){if(K)L$(0);break}}if(G)q(U+131072);var C=(1<<j)-1,_=(1<<V)-1,b=B;for(;;b=B){var t=R[fJ($,B)&C],c=t>>4;if(B+=t&15,B>L){if(K)L$(0);break}if(!t)L$(2);if(c<256)Q[U++]=c;else if(c==256){b=B,R=null;break}else{var a=c-254;if(c>264){var T=c-257,e=P8[T];a=C$($,B,(1<<e)-1)+Z8[T],B+=e}var M$=D[fJ($,B)&_],P=M$>>4;if(!M$)L$(3);B+=M$&15;var S=fY[P];if(P>3){var e=C8[P];S+=fJ($,B)&(1<<e)-1,B+=e}if(B>L){if(K)L$(0);break}if(G)q(U+131072);var $$=U+a;if(U<S){var u=H-S,s=Math.min(S,$$);if(u+U<0)L$(3);for(;U<s;++U)Q[U]=X[u+U]}for(;U<$$;++U)Q[U]=Q[U-S]}}if(J.l=R,J.p=b,J.b=U,J.f=W,R)W=1,J.m=j,J.d=D,J.n=V}while(!W);return U!=Q.length&&M?cY(Q,0,U):Q.subarray(0,U)};var dY=new E$(0);var nY=function($){if($[0]!=31||$[1]!=139||$[2]!=8)L$(6,"invalid gzip data");var J=$[3],Q=10;if(J&4)Q+=($[10]|$[11]<<8)+2;for(var X=(J>>3&1)+(J>>4&1);X>0;X-=!$[Q++]);return Q+(J&2)},iY=function($){var J=$.length;return($[J-4]|$[J-3]<<8|$[J-2]<<16|$[J-1]<<24)>>>0};var oY=function($,J){if(($[0]&15)!=8||$[0]>>4>7||($[0]<<8|$[1])%31)L$(6,"invalid zlib data");if(($[1]>>5&1)==+!J)L$(6,"invalid zlib data: "+($[1]&32?"need":"unexpected")+" dictionary");return($[1]>>3&4)+2};function rY($,J){return uJ($,{i:2},J&&J.out,J&&J.dictionary)}function aY($,J){var Q=nY($);if(Q+8>$.length)L$(6,"invalid gzip data");return uJ($.subarray(Q,-8),{i:2},J&&J.out||new E$(iY($)),J&&J.dictionary)}function sY($,J){return uJ($.subarray(oY($,J&&J.dictionary),-4),{i:2},J&&J.out,J&&J.dictionary)}function v8($,J){return $[0]==31&&$[1]==139&&$[2]==8?aY($,J):($[0]&15)!=8||$[0]>>4>7||($[0]<<8|$[1])%31?rY($,J):sY($,J)}var tY=typeof TextDecoder!="undefined"&&new TextDecoder,eY=0;try{tY.decode(dY,{stream:!0}),eY=1}catch($){}var r8=J$(d8());var O1={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},nJ={get($){let J=G$.get($,6);return{signature:j$.get($,0),compressedSize:j$.get($,8),uncompressedSize:j$.get($,12)}},len:16},n8={get($){let J=G$.get($,6);return{signature:j$.get($,0),minVersion:G$.get($,4),dataDescriptor:!!(J&8),compressedMethod:G$.get($,8),compressedSize:j$.get($,18),uncompressedSize:j$.get($,22),filenameLength:G$.get($,26),extraFieldLength:G$.get($,28),filename:null}},len:30},i8={get($){return{signature:j$.get($,0),nrOfThisDisk:G$.get($,4),nrOfThisDiskWithTheStart:G$.get($,6),nrOfEntriesOnThisDisk:G$.get($,8),nrOfEntriesOfSize:G$.get($,10),sizeOfCd:j$.get($,12),offsetOfStartOfCd:j$.get($,16),zipFileCommentLength:G$.get($,20)}},len:22},o8={get($){let J=G$.get($,8);return{signature:j$.get($,0),minVersion:G$.get($,6),dataDescriptor:!!(J&8),compressedMethod:G$.get($,10),compressedSize:j$.get($,20),uncompressedSize:j$.get($,24),filenameLength:G$.get($,28),extraFieldLength:G$.get($,30),fileCommentLength:G$.get($,32),relativeOffsetOfLocalHeader:j$.get($,42),filename:null}},len:46};function a8($){let J=new Uint8Array(j$.len);return j$.put(J,0,$),J}var b$=r8.default("tokenizer:inflate"),iJ=262144,A4=a8(O1.DataDescriptor),r0=a8(O1.EndOfCentralDirectory);class oJ{constructor($){this.tokenizer=$,this.syncBuffer=new Uint8Array(iJ)}async isZip(){return await this.peekSignature()===O1.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(j$)}async findEndOfCentralDirectoryLocator(){let $=this.tokenizer,J=Math.min(16384,$.fileInfo.size),Q=this.syncBuffer.subarray(0,J);await this.tokenizer.readBuffer(Q,{position:$.fileInfo.size-J});for(let X=Q.length-4;X>=0;X--)if(Q[X]===r0[0]&&Q[X+1]===r0[1]&&Q[X+2]===r0[2]&&Q[X+3]===r0[3])return $.fileInfo.size-J+X;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){b$("Cannot reading central-directory without random-read support");return}b$("Reading central-directory...");let $=this.tokenizer.position,J=await this.findEndOfCentralDirectoryLocator();if(J>0){b$("Central-directory 32-bit signature found");let Q=await this.tokenizer.readToken(i8,J),X=[];this.tokenizer.setPosition(Q.offsetOfStartOfCd);for(let Y=0;Y<Q.nrOfEntriesOfSize;++Y){let H=await this.tokenizer.readToken(o8);if(H.signature!==O1.CentralFileHeader)throw new Error("Expected Central-File-Header signature");H.filename=await this.tokenizer.readToken(new O$(H.filenameLength,"utf-8")),await this.tokenizer.ignore(H.extraFieldLength),await this.tokenizer.ignore(H.fileCommentLength),X.push(H),b$(`Add central-directory file-entry: n=${Y+1}/${X.length}: filename=${X[Y].filename}`)}return this.tokenizer.setPosition($),X}this.tokenizer.setPosition($)}async unzip($){let J=await this.readCentralDirectory();if(J)return this.iterateOverCentralDirectory(J,$);let Q=!1;do{let X=await this.readLocalFileHeader();if(!X)break;let Y=$(X);Q=!!Y.stop;let H=void 0;if(await this.tokenizer.ignore(X.extraFieldLength),X.dataDescriptor&&X.compressedSize===0){let M=[],G=iJ;b$("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let K=-1;while(K<0&&G===iJ){G=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),K=I4(this.syncBuffer.subarray(0,G),A4);let q=K>=0?K:G;if(Y.handler){let W=new Uint8Array(q);await this.tokenizer.readBuffer(W),M.push(W)}else await this.tokenizer.ignore(q)}if(b$(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),Y.handler)await this.inflate(X,S4(M),Y.handler)}else if(Y.handler)b$(`Reading compressed-file-data: ${X.compressedSize} bytes`),H=new Uint8Array(X.compressedSize),await this.tokenizer.readBuffer(H),await this.inflate(X,H,Y.handler);else b$(`Ignoring compressed-file-data: ${X.compressedSize} bytes`),await this.tokenizer.ignore(X.compressedSize);if(b$(`Reading data-descriptor at pos=${this.tokenizer.position}`),X.dataDescriptor){if((await this.tokenizer.readToken(nJ)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-nJ.len}`)}}while(!Q)}async iterateOverCentralDirectory($,J){for(let Q of $){let X=J(Q);if(X.handler){this.tokenizer.setPosition(Q.relativeOffsetOfLocalHeader);let Y=await this.readLocalFileHeader();if(Y){await this.tokenizer.ignore(Y.extraFieldLength);let H=new Uint8Array(Q.compressedSize);await this.tokenizer.readBuffer(H),await this.inflate(Y,H,X.handler)}}if(X.stop)break}}inflate($,J,Q){if($.compressedMethod===0)return Q(J);b$(`Decompress filename=${$.filename}, compressed-size=${J.length}`);let X=v8(J);return Q(X)}async readLocalFileHeader(){let $=await this.tokenizer.peekToken(j$);if($===O1.LocalFileHeader){let J=await this.tokenizer.readToken(n8);return J.filename=await this.tokenizer.readToken(new O$(J.filenameLength,"utf-8")),J}if($===O1.CentralFileHeader)return!1;if($===3759263696)throw new Error("Encrypted ZIP");throw new Error("Unexpected signature")}}function I4($,J){let Q=$.length,X=J.length;if(X>Q)return-1;for(let Y=0;Y<=Q-X;Y++){let H=!0;for(let M=0;M<X;M++)if($[Y+M]!==J[M]){H=!1;break}if(H)return Y}return-1}function S4($){let J=$.reduce((Y,H)=>Y+H.length,0),Q=new Uint8Array(J),X=0;for(let Y of $)Q.set(Y,X),X+=Y.length;return Q}var u3={utf8:new globalThis.TextDecoder("utf8")};var l3=new globalThis.TextEncoder;var c3=Array.from({length:256},($,J)=>J.toString(16).padStart(2,"0"));function rJ($){let{byteLength:J}=$;if(J===6)return $.getUint16(0)*4294967296+$.getUint32(2);if(J===5)return $.getUint8(0)*4294967296+$.getUint32(1);if(J===4)return $.getUint32(0);if(J===3)return $.getUint8(0)*65536+$.getUint16(1);if(J===2)return $.getUint16(0);if(J===1)return $.getUint8(0)}function s8($){return[...$].map((J)=>J.charCodeAt(0))}function t8($,J=0){let Q=Number.parseInt(new O$(6).get($,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(Q))return!1;let X=256;for(let Y=J;Y<J+148;Y++)X+=$[Y];for(let Y=J+156;Y<J+512;Y++)X+=$[Y];return Q===X}var e8={get:($,J)=>$[J+3]&127|$[J+2]<<7|$[J+1]<<14|$[J]<<21,len:4};var $Q=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm","ppsm","ppsx"],JQ=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia"];var aJ=4100;async function tJ($,J){return new QQ(J).fromBuffer($)}function sJ($){switch($=$.toLowerCase(),$){case"application/epub+zip":return{ext:"epub",mime:$};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:$};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:$};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:$};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:$};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:$};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:$};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:$};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:$};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:$};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:$};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:$};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:$};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:$};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:$};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:$};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function f$($,J,Q){Q={offset:0,...Q};for(let[X,Y]of J.entries())if(Q.mask){if(Y!==(Q.mask[X]&$[X+Q.offset]))return!1}else if(Y!==$[X+Q.offset])return!1;return!0}class QQ{constructor($){this.options={mpegOffsetTolerance:0,...$},this.detectors=[...$?.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:$?.signal}}async fromTokenizer($){let J=$.position;for(let Q of this.detectors){let X=await Q.detect($);if(X)return X;if(J!==$.position)return}}async fromBuffer($){if(!($ instanceof Uint8Array||$ instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof $}\``);let J=$ instanceof Uint8Array?$:new Uint8Array($);if(!(J?.length>1))return;return this.fromTokenizer(F8(J,this.tokenizerOptions))}async fromBlob($){return this.fromStream($.stream())}async fromStream($){let J=await gJ($,this.tokenizerOptions);try{return await this.fromTokenizer(J)}finally{await J.close()}}async toDetectionStream($,J){let{sampleSize:Q=aJ}=J,X,Y,H=$.getReader({mode:"byob"});try{let{value:K,done:q}=await H.read(new Uint8Array(Q));if(Y=K,!q&&K)try{X=await this.fromBuffer(K.subarray(0,Q))}catch(W){if(!(W instanceof X$))throw W;X=void 0}Y=K}finally{H.releaseLock()}let M=new TransformStream({async start(K){K.enqueue(Y)},transform(K,q){q.enqueue(K)}}),G=$.pipeThrough(M);return G.fileType=X,G}check($,J){return f$(this.buffer,$,J)}checkString($,J){return this.check(s8($),J)}detectConfident=async($)=>{if(this.buffer=new Uint8Array(aJ),$.fileInfo.size===void 0)$.fileInfo.size=Number.MAX_SAFE_INTEGER;if(this.tokenizer=$,await $.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33])){if(await $.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14}))return{ext:"eps",mime:"application/eps"};return{ext:"ps",mime:"application/postscript"}}if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident($);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await $.ignore(6);let J=await $.readToken(e8);if($.position+J>$.fileInfo.size)return{ext:"mp3",mime:"audio/mpeg"};return await $.ignore(J),this.fromTokenizer($)}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255])){if(this.check([247],{offset:3}))return{ext:"jls",mime:"image/jls"};return{ext:"jpg",mime:"image/jpeg"}}if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let J;return await new oJ($).unzip((Q)=>{switch(Q.filename){case"META-INF/mozilla.rsa":return J={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return J={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(X){let Y=new TextDecoder("utf-8").decode(X).trim();J=sJ(Y)},stop:!0};case"[Content_Types].xml":return{async handler(X){let Y=new TextDecoder("utf-8").decode(X),H=Y.indexOf('.main+xml"');if(H===-1){if(Y.includes('ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"'))J=sJ("application/vnd.ms-package.3dmanufacturing-3dmodel+xml")}else{Y=Y.slice(0,Math.max(0,H));let M=Y.lastIndexOf('"'),G=Y.slice(Math.max(0,M+1));J=sJ(G)}},stop:!0};default:if(/classes\d*\.dex/.test(Q.filename))return J={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0};return{}}}),J??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await $.ignore(28);let J=new Uint8Array(8);if(await $.readBuffer(J),f$(J,[79,112,117,115,72,101,97,100]))return{ext:"opus",mime:"audio/ogg; codecs=opus"};if(f$(J,[128,116,104,101,111,114,97]))return{ext:"ogv",mime:"video/ogg"};if(f$(J,[1,118,105,100,101,111,0]))return{ext:"ogm",mime:"video/ogg"};if(f$(J,[127,70,76,65,67]))return{ext:"oga",mime:"audio/ogg"};if(f$(J,[83,112,101,101,120,32,32]))return{ext:"spx",mime:"audio/ogg"};if(f$(J,[1,118,111,114,98,105,115]))return{ext:"ogg",mime:"audio/ogg"};return{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let J=await this.readTiffHeader(!1);if(J)return J}if(this.check([77,77])){let J=await this.readTiffHeader(!0);if(J)return J}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function J(){let M=await $.peekNumber(E8),G=128,K=0;while((M&G)===0&&G!==0)++K,G>>=1;let q=new Uint8Array(K+1);return await $.readBuffer(q),q}async function Q(){let M=await J(),G=await J();G[0]^=128>>G.length-1;let K=Math.min(6,G.length),q=new DataView(M.buffer),W=new DataView(G.buffer,G.length-K,K);return{id:rJ(q),len:rJ(W)}}async function X(M){while(M>0){let G=await Q();if(G.id===17026)return(await $.readToken(new O$(G.len))).replaceAll(/\00.*$/g,"");await $.ignore(G.len),--M}}let Y=await Q();switch(await X(Y.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let J=new O$(4,"latin1").get(this.buffer,2);if(J.match("^d*")&&J>=1000&&J<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){if(await $.ignore(8),await $.readToken(new O$(13,"ascii"))==="debian-binary")return{ext:"deb",mime:"application/x-deb"};return{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("WEBVTT")&&[`
50
+ `,"\r","\t"," ","\x00"].some((J)=>this.checkString(J,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await $.ignore(8);async function J(){return{length:await $.readToken(I8),type:await $.readToken(new O$(4,"latin1"))}}do{let Q=await J();if(Q.length<0)return;switch(Q.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await $.ignore(Q.length+4)}}while($.position+8<$.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let J=new O$(4,"latin1").get(this.buffer,8).replace("\x00"," ").trim();switch(J){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:if(J.startsWith("3g")){if(J.startsWith("3g2"))return{ext:"3g2",mime:"video/3gpp2"};return{ext:"3gp",mime:"video/3gpp"}}return{ext:"mp4",mime:"video/mp4"}}}if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function J(){let Q=new Uint8Array(16);return await $.readBuffer(Q),{id:Q,size:Number(await $.readToken(S8))}}await $.ignore(30);while($.position+24<$.fileInfo.size){let Q=await J(),X=Q.size-24;if(f$(Q.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let Y=new Uint8Array(16);if(X-=await $.readBuffer(Y),f$(Y,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(f$(Y,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await $.ignore(X)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await $.ignore(20),await $.readToken(new O$(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255])){if(this.check([0,60,0,63,0,120,0,109,0,108],{offset:2}))return{ext:"xml",mime:"application/xml"};return}if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await $.peekBuffer(this.buffer,{length:Math.min(256,$.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let J=new DataView(this.buffer.buffer).getUint32(12,!0);if(J>12&&this.buffer.length>=J+16)try{let Q=new TextDecoder().decode(this.buffer.subarray(16,J+16));if(JSON.parse(Q).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \x00"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await $.peekBuffer(this.buffer,{length:Math.min(512,$.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\x00",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&t8(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){if(this.check([60,0,63,0,120,0,109,0,108,0],{offset:2}))return{ext:"xml",mime:"application/xml"};if(this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2}))return{ext:"skp",mime:"application/vnd.sketchup.skp"};return}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async($)=>{if(this.buffer=new Uint8Array(aJ),await $.peekBuffer(this.buffer,{length:Math.min(8,$.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await $.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,$.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let J=0;J<=this.options.mpegOffsetTolerance;++J){let Q=this.scanMpeg(J);if(Q)return Q}};async readTiffTag($){let J=await this.tokenizer.readToken($?k1:G$);switch(this.tokenizer.ignore(10),J){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD($){let J=await this.tokenizer.readToken($?k1:G$);for(let Q=0;Q<J;++Q){let X=await this.readTiffTag($);if(X)return X}}async readTiffHeader($){let J=($?k1:G$).get(this.buffer,2),Q=($?A8:j$).get(this.buffer,4);if(J===42){if(Q>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(Q>=8){let Y=($?k1:G$).get(this.buffer,8),H=($?k1:G$).get(this.buffer,10);if(Y===28&&H===254||Y===31&&H===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(Q),await this.readTiffIFD($)??{ext:"tif",mime:"image/tiff"}}if(J===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg($){if(this.check([255,224],{offset:$,mask:[255,224]})){if(this.check([16],{offset:$+1,mask:[22]})){if(this.check([8],{offset:$+1,mask:[8]}))return{ext:"aac",mime:"audio/aac"};return{ext:"aac",mime:"audio/aac"}}if(this.check([2],{offset:$+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:$+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:$+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}var z4=new Set($Q),P4=new Set(JQ);var e$=J$(require("fs/promises"));var FQ=J$(MQ()),DQ=J$(BQ()),OQ=J$(UQ());class S${static COLUMNS=80;static ROWS=24;static SCROLLBACK=128000;globalEnv;processes=new Map;spawnListeners=[];constructor($){this.globalEnv=$??{}}onSpawn($){return this.spawnListeners.push($),{dispose:()=>{this.spawnListeners=this.spawnListeners.filter((J)=>J!==$)}}}setEnv($){this.globalEnv={...this.globalEnv,...$},Object.keys($).forEach((J)=>{if($[J]==="")delete this.globalEnv[J]})}execute($,J,Q){let X=FQ.spawn($,J,{name:"xterm-256color",cols:S$.COLUMNS,rows:S$.ROWS,cwd:Q?.cwd,env:{...globalThis.process.env,...this.globalEnv,...Q?.env}}),Y=new OQ.Terminal({allowProposedApi:!0,convertEol:!0,scrollback:S$.SCROLLBACK,cols:S$.COLUMNS,rows:S$.ROWS}),H=new DQ.SerializeAddon;Y.loadAddon(H);let M;X.onData((K)=>{M=new Promise((q)=>{Y.write(K,q)})}),Y.onData((K)=>{X.write(K)});let G={command:$,args:J,cwd:Q?.cwd??"",env:{...Q?.env},startTimeMS:Date.now(),exitCode:void 0,exitSignal:void 0,pid:X.pid,pty:X,terminal:Y,serializer:H,kill:(K)=>{X.kill(K)},onExit:(K)=>{return X.onExit(({exitCode:q,signal:W})=>{if(M)M.then(()=>{K(q,W)});else K(q,W)})},onOutput:(K)=>{return X.onData((q)=>{K(q)})},sendInput:(K)=>{Y.input(K)}};this.processes.set(X.pid,G),X.onExit(({exitCode:K,signal:q})=>{G.exitCode=K,G.exitSignal=q});for(let K of this.spawnListeners)K(G);return G}status($){let J=this.processes.get($);if(!J)throw new Error(`Process with PID ${$} not found`);let Q=this.readPlainOutput($);return{pid:J.pid,command:J.command,title:J.pty.process,args:J.args,cwd:J.cwd,env:J.env,exit_code:J.exitCode,exit_signal:J.exitSignal,duration_ms:Date.now()-J.startTimeMS,output_total_lines:Q.totalLines}}list($){return Array.from(this.processes.values()).filter((J)=>$||J.exitCode===void 0).map((J)=>this.status(J.pid))}getProcess($){return this.processes.get($)}readANSIOutput($,J){let Q=this.processes.get($);if(!Q)throw new Error(`Process with PID ${$} not found`);return Q.serializer.serialize({scrollback:J})}readPlainOutput($,J,Q){let X=J?Math.max(0,J-1):0,Y=Q?Math.max(0,Q-1):S$.SCROLLBACK+S$.ROWS-1,H=this.processes.get($);if(!H)throw new Error(`Process with PID ${$} not found`);let M=[];for(let G=0;G<S$.SCROLLBACK+S$.ROWS;G++){let K=H.terminal.buffer.normal.getLine(G);if(K)M.push(K.translateToString(!0)??"")}while(M.length>0&&M[M.length-1].trim()==="")M.pop();return{lines:M.slice(X,Y+1),totalLines:M.length}}close(){this.processes.forEach(($)=>{$.pty.kill()})}}var z={};RY(z,{void:()=>eG,util:()=>r,unknown:()=>sG,union:()=>X5,undefined:()=>oG,tuple:()=>H5,transformer:()=>U5,symbol:()=>iG,string:()=>wQ,strictObject:()=>Q5,setErrorMap:()=>DG,set:()=>K5,record:()=>j5,quotelessJson:()=>UG,promise:()=>N5,preprocess:()=>O5,pipeline:()=>L5,ostring:()=>E5,optional:()=>F5,onumber:()=>A5,oboolean:()=>I5,objectUtil:()=>q6,object:()=>J5,number:()=>_Q,nullable:()=>D5,null:()=>rG,never:()=>tG,nativeEnum:()=>B5,nan:()=>pG,map:()=>V5,makeIssue:()=>z0,literal:()=>q5,lazy:()=>W5,late:()=>lG,isValid:()=>Q1,isDirty:()=>$J,isAsync:()=>l1,isAborted:()=>e0,intersection:()=>G5,instanceof:()=>cG,getParsedType:()=>m$,getErrorMap:()=>u1,function:()=>R5,enum:()=>M5,effect:()=>U5,discriminatedUnion:()=>Y5,defaultErrorMap:()=>i$,datetimeRegex:()=>zQ,date:()=>nG,custom:()=>CQ,coerce:()=>S5,boolean:()=>ZQ,bigint:()=>dG,array:()=>$5,any:()=>aG,addIssueToContext:()=>y,ZodVoid:()=>C0,ZodUnknown:()=>X1,ZodUnion:()=>o1,ZodUndefined:()=>n1,ZodType:()=>i,ZodTuple:()=>l$,ZodTransformer:()=>x$,ZodSymbol:()=>P0,ZodString:()=>w$,ZodSet:()=>z1,ZodSchema:()=>i,ZodRecord:()=>w0,ZodReadonly:()=>J0,ZodPromise:()=>P1,ZodPipeline:()=>T0,ZodParsedType:()=>h,ZodOptional:()=>Z$,ZodObject:()=>H$,ZodNumber:()=>Y1,ZodNullable:()=>r$,ZodNull:()=>i1,ZodNever:()=>u$,ZodNativeEnum:()=>t1,ZodNaN:()=>Z0,ZodMap:()=>_0,ZodLiteral:()=>s1,ZodLazy:()=>a1,ZodIssueCode:()=>v,ZodIntersection:()=>r1,ZodFunction:()=>p1,ZodFirstPartyTypeKind:()=>l,ZodError:()=>D$,ZodEnum:()=>H1,ZodEffects:()=>x$,ZodDiscriminatedUnion:()=>JJ,ZodDefault:()=>e1,ZodDate:()=>I1,ZodCatch:()=>$0,ZodBranded:()=>QJ,ZodBoolean:()=>d1,ZodBigInt:()=>G1,ZodArray:()=>_$,ZodAny:()=>S1,Schema:()=>i,ParseStatus:()=>q$,OK:()=>B$,NEVER:()=>z5,INVALID:()=>m,EMPTY_PATH:()=>OG,DIRTY:()=>A1,BRAND:()=>uG});var r;(function($){$.assertEqual=(Y)=>{};function J(Y){}$.assertIs=J;function Q(Y){throw new Error}$.assertNever=Q,$.arrayToEnum=(Y)=>{let H={};for(let M of Y)H[M]=M;return H},$.getValidEnumValues=(Y)=>{let H=$.objectKeys(Y).filter((G)=>typeof Y[Y[G]]!=="number"),M={};for(let G of H)M[G]=Y[G];return $.objectValues(M)},$.objectValues=(Y)=>{return $.objectKeys(Y).map(function(H){return Y[H]})},$.objectKeys=typeof Object.keys==="function"?(Y)=>Object.keys(Y):(Y)=>{let H=[];for(let M in Y)if(Object.prototype.hasOwnProperty.call(Y,M))H.push(M);return H},$.find=(Y,H)=>{for(let M of Y)if(H(M))return M;return},$.isInteger=typeof Number.isInteger==="function"?(Y)=>Number.isInteger(Y):(Y)=>typeof Y==="number"&&Number.isFinite(Y)&&Math.floor(Y)===Y;function X(Y,H=" | "){return Y.map((M)=>typeof M==="string"?`'${M}'`:M).join(H)}$.joinValues=X,$.jsonStringifyReplacer=(Y,H)=>{if(typeof H==="bigint")return H.toString();return H}})(r||(r={}));var q6;(function($){$.mergeShapes=(J,Q)=>{return{...J,...Q}}})(q6||(q6={}));var h=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m$=($)=>{switch(typeof $){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN($)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":if(Array.isArray($))return h.array;if($===null)return h.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return h.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return h.map;if(typeof Set!=="undefined"&&$ instanceof Set)return h.set;if(typeof Date!=="undefined"&&$ instanceof Date)return h.date;return h.object;default:return h.unknown}};var v=r.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),UG=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class D$ extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let J=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,J);else this.__proto__=J;this.name="ZodError",this.issues=$}format($){let J=$||function(Y){return Y.message},Q={_errors:[]},X=(Y)=>{for(let H of Y.issues)if(H.code==="invalid_union")H.unionErrors.map(X);else if(H.code==="invalid_return_type")X(H.returnTypeError);else if(H.code==="invalid_arguments")X(H.argumentsError);else if(H.path.length===0)Q._errors.push(J(H));else{let M=Q,G=0;while(G<H.path.length){let K=H.path[G];if(G!==H.path.length-1)M[K]=M[K]||{_errors:[]};else M[K]=M[K]||{_errors:[]},M[K]._errors.push(J(H));M=M[K],G++}}};return X(this),Q}static assert($){if(!($ instanceof D$))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(J)=>J.message){let J={},Q=[];for(let X of this.issues)if(X.path.length>0)J[X.path[0]]=J[X.path[0]]||[],J[X.path[0]].push($(X));else Q.push($(X));return{formErrors:Q,fieldErrors:J}}get formErrors(){return this.flatten()}}D$.create=($)=>{return new D$($)};var FG=($,J)=>{let Q;switch($.code){case v.invalid_type:if($.received===h.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case v.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,r.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:Q=`Unrecognized key(s) in object: ${r.joinValues($.keys,", ")}`;break;case v.invalid_union:Q="Invalid input";break;case v.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${r.joinValues($.options)}`;break;case v.invalid_enum_value:Q=`Invalid enum value. Expected ${r.joinValues($.options)}, received '${$.received}'`;break;case v.invalid_arguments:Q="Invalid function arguments";break;case v.invalid_return_type:Q="Invalid function return type";break;case v.invalid_date:Q="Invalid date";break;case v.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else r.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case v.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case v.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case v.custom:Q="Invalid input";break;case v.invalid_intersection_types:Q="Intersection results could not be merged";break;case v.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case v.not_finite:Q="Number must be finite";break;default:Q=J.defaultError,r.assertNever($)}return{message:Q}},i$=FG;var LQ=i$;function DG($){LQ=$}function u1(){return LQ}var z0=($)=>{let{data:J,path:Q,errorMaps:X,issueData:Y}=$,H=[...Q,...Y.path||[]],M={...Y,path:H};if(Y.message!==void 0)return{...Y,path:H,message:Y.message};let G="",K=X.filter((q)=>!!q).slice().reverse();for(let q of K)G=q(M,{data:J,defaultError:G}).message;return{...Y,path:H,message:G}},OG=[];function y($,J){let Q=u1(),X=z0({issueData:J,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===i$?void 0:i$].filter((Y)=>!!Y)});$.common.issues.push(X)}class q${constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,J){let Q=[];for(let X of J){if(X.status==="aborted")return m;if(X.status==="dirty")$.dirty();Q.push(X.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,J){let Q=[];for(let X of J){let Y=await X.key,H=await X.value;Q.push({key:Y,value:H})}return q$.mergeObjectSync($,Q)}static mergeObjectSync($,J){let Q={};for(let X of J){let{key:Y,value:H}=X;if(Y.status==="aborted")return m;if(H.status==="aborted")return m;if(Y.status==="dirty")$.dirty();if(H.status==="dirty")$.dirty();if(Y.value!=="__proto__"&&(typeof H.value!=="undefined"||X.alwaysSet))Q[Y.value]=H.value}return{status:$.value,value:Q}}}var m=Object.freeze({status:"aborted"}),A1=($)=>({status:"dirty",value:$}),B$=($)=>({status:"valid",value:$}),e0=($)=>$.status==="aborted",$J=($)=>$.status==="dirty",Q1=($)=>$.status==="valid",l1=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var f;(function($){$.errToObj=(J)=>typeof J==="string"?{message:J}:J||{},$.toString=(J)=>typeof J==="string"?J:J?.message})(f||(f={}));class T${constructor($,J,Q,X){this._cachedPath=[],this.parent=$,this.data=J,this._path=Q,this._key=X}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var EQ=($,J)=>{if(Q1(J))return{success:!0,data:J.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new D$($.common.issues);return this._error=Q,this._error}}}};function d($){if(!$)return{};let{errorMap:J,invalid_type_error:Q,required_error:X,description:Y}=$;if(J&&(Q||X))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(J)return{errorMap:J,description:Y};return{errorMap:(M,G)=>{let{message:K}=$;if(M.code==="invalid_enum_value")return{message:K??G.defaultError};if(typeof G.data==="undefined")return{message:K??X??G.defaultError};if(M.code!=="invalid_type")return{message:G.defaultError};return{message:K??Q??G.defaultError}},description:Y}}class i{get description(){return this._def.description}_getType($){return m$($.data)}_getOrReturnCtx($,J){return J||{common:$.parent.common,data:$.data,parsedType:m$($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new q$,ctx:{common:$.parent.common,data:$.data,parsedType:m$($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let J=this._parse($);if(l1(J))throw new Error("Synchronous parse encountered promise.");return J}_parseAsync($){let J=this._parse($);return Promise.resolve(J)}parse($,J){let Q=this.safeParse($,J);if(Q.success)return Q.data;throw Q.error}safeParse($,J){let Q={common:{issues:[],async:J?.async??!1,contextualErrorMap:J?.errorMap},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:m$($)},X=this._parseSync({data:$,path:Q.path,parent:Q});return EQ(Q,X)}"~validate"($){let J={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:m$($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:J});return Q1(Q)?{value:Q.value}:{issues:J.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;J.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:J}).then((Q)=>Q1(Q)?{value:Q.value}:{issues:J.common.issues})}async parseAsync($,J){let Q=await this.safeParseAsync($,J);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,J){let Q={common:{issues:[],contextualErrorMap:J?.errorMap,async:!0},path:J?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:m$($)},X=this._parse({data:$,path:Q.path,parent:Q}),Y=await(l1(X)?X:Promise.resolve(X));return EQ(Q,Y)}refine($,J){let Q=(X)=>{if(typeof J==="string"||typeof J==="undefined")return{message:J};else if(typeof J==="function")return J(X);else return J};return this._refinement((X,Y)=>{let H=$(X),M=()=>Y.addIssue({code:v.custom,...Q(X)});if(typeof Promise!=="undefined"&&H instanceof Promise)return H.then((G)=>{if(!G)return M(),!1;else return!0});if(!H)return M(),!1;else return!0})}refinement($,J){return this._refinement((Q,X)=>{if(!$(Q))return X.addIssue(typeof J==="function"?J(Q,X):J),!1;else return!0})}_refinement($){return new x$({schema:this,typeName:l.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(J)=>this["~validate"](J)}}optional(){return Z$.create(this,this._def)}nullable(){return r$.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _$.create(this)}promise(){return P1.create(this,this._def)}or($){return o1.create([this,$],this._def)}and($){return r1.create(this,$,this._def)}transform($){return new x$({...d(this._def),schema:this,typeName:l.ZodEffects,effect:{type:"transform",transform:$}})}default($){let J=typeof $==="function"?$:()=>$;return new e1({...d(this._def),innerType:this,defaultValue:J,typeName:l.ZodDefault})}brand(){return new QJ({typeName:l.ZodBranded,type:this,...d(this._def)})}catch($){let J=typeof $==="function"?$:()=>$;return new $0({...d(this._def),innerType:this,catchValue:J,typeName:l.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return T0.create(this,$)}readonly(){return J0.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var LG=/^c[^\s-]{8,}$/i,EG=/^[0-9a-z]+$/,AG=/^[0-9A-HJKMNP-TV-Z]{26}$/i,IG=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,SG=/^[a-z0-9_-]{21}$/i,zG=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,PG=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,CG=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,wG="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",M6,_G=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ZG=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xG=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vG=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kG=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,IQ="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",hG=new RegExp(`^${IQ}$`);function SQ($){let J="[0-5]\\d";if($.precision)J=`${J}\\.\\d{${$.precision}}`;else if($.precision==null)J=`${J}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${J})${Q}`}function gG($){return new RegExp(`^${SQ($)}$`)}function zQ($){let J=`${IQ}T${SQ($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return J=`${J}(${Q.join("|")})`,new RegExp(`^${J}$`)}function yG($,J){if((J==="v4"||!J)&&_G.test($))return!0;if((J==="v6"||!J)&&TG.test($))return!0;return!1}function bG($,J){if(!zG.test($))return!1;try{let[Q]=$.split("."),X=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),Y=JSON.parse(atob(X));if(typeof Y!=="object"||Y===null)return!1;if("typ"in Y&&Y?.typ!=="JWT")return!1;if(!Y.alg)return!1;if(J&&Y.alg!==J)return!1;return!0}catch{return!1}}function fG($,J){if((J==="v4"||!J)&&ZG.test($))return!0;if((J==="v6"||!J)&&xG.test($))return!0;return!1}class w$ extends i{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==h.string){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_type,expected:h.string,received:Y.parsedType}),m}let Q=new q$,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.length<Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="max"){if($.data.length>Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!1,message:Y.message}),Q.dirty()}else if(Y.kind==="length"){let H=$.data.length>Y.value,M=$.data.length<Y.value;if(H||M){if(X=this._getOrReturnCtx($,X),H)y(X,{code:v.too_big,maximum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});else if(M)y(X,{code:v.too_small,minimum:Y.value,type:"string",inclusive:!0,exact:!0,message:Y.message});Q.dirty()}}else if(Y.kind==="email"){if(!CG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"email",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="emoji"){if(!M6)M6=new RegExp(wG,"u");if(!M6.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"emoji",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="uuid"){if(!IG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"uuid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="nanoid"){if(!SG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"nanoid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid"){if(!LG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"cuid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cuid2"){if(!EG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"cuid2",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ulid"){if(!AG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"ulid",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="url")try{new URL($.data)}catch{X=this._getOrReturnCtx($,X),y(X,{validation:"url",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="regex"){if(Y.regex.lastIndex=0,!Y.regex.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"regex",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="trim")$.data=$.data.trim();else if(Y.kind==="includes"){if(!$.data.includes(Y.value,Y.position))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:{includes:Y.value,position:Y.position},message:Y.message}),Q.dirty()}else if(Y.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Y.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Y.kind==="startsWith"){if(!$.data.startsWith(Y.value))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:{startsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="endsWith"){if(!$.data.endsWith(Y.value))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:{endsWith:Y.value},message:Y.message}),Q.dirty()}else if(Y.kind==="datetime"){if(!zQ(Y).test($.data))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:"datetime",message:Y.message}),Q.dirty()}else if(Y.kind==="date"){if(!hG.test($.data))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:"date",message:Y.message}),Q.dirty()}else if(Y.kind==="time"){if(!gG(Y).test($.data))X=this._getOrReturnCtx($,X),y(X,{code:v.invalid_string,validation:"time",message:Y.message}),Q.dirty()}else if(Y.kind==="duration"){if(!PG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"duration",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="ip"){if(!yG($.data,Y.version))X=this._getOrReturnCtx($,X),y(X,{validation:"ip",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="jwt"){if(!bG($.data,Y.alg))X=this._getOrReturnCtx($,X),y(X,{validation:"jwt",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="cidr"){if(!fG($.data,Y.version))X=this._getOrReturnCtx($,X),y(X,{validation:"cidr",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64"){if(!vG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"base64",code:v.invalid_string,message:Y.message}),Q.dirty()}else if(Y.kind==="base64url"){if(!kG.test($.data))X=this._getOrReturnCtx($,X),y(X,{validation:"base64url",code:v.invalid_string,message:Y.message}),Q.dirty()}else r.assertNever(Y);return{status:Q.value,value:$.data}}_regex($,J,Q){return this.refinement((X)=>$.test(X),{validation:J,code:v.invalid_string,...f.errToObj(Q)})}_addCheck($){return new w$({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...f.errToObj($)})}url($){return this._addCheck({kind:"url",...f.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...f.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...f.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...f.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...f.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...f.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...f.errToObj($)})}base64($){return this._addCheck({kind:"base64",...f.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...f.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...f.errToObj($)})}ip($){return this._addCheck({kind:"ip",...f.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...f.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...f.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision==="undefined"?null:$?.precision,...f.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...f.errToObj($)})}regex($,J){return this._addCheck({kind:"regex",regex:$,...f.errToObj(J)})}includes($,J){return this._addCheck({kind:"includes",value:$,position:J?.position,...f.errToObj(J?.message)})}startsWith($,J){return this._addCheck({kind:"startsWith",value:$,...f.errToObj(J)})}endsWith($,J){return this._addCheck({kind:"endsWith",value:$,...f.errToObj(J)})}min($,J){return this._addCheck({kind:"min",value:$,...f.errToObj(J)})}max($,J){return this._addCheck({kind:"max",value:$,...f.errToObj(J)})}length($,J){return this._addCheck({kind:"length",value:$,...f.errToObj(J)})}nonempty($){return this.min(1,f.errToObj($))}trim(){return new w$({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new w$({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new w$({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxLength(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}w$.create=($)=>{return new w$({checks:[],typeName:l.ZodString,coerce:$?.coerce??!1,...d($)})};function mG($,J){let Q=($.toString().split(".")[1]||"").length,X=(J.toString().split(".")[1]||"").length,Y=Q>X?Q:X,H=Number.parseInt($.toFixed(Y).replace(".","")),M=Number.parseInt(J.toFixed(Y).replace(".",""));return H%M/10**Y}class Y1 extends i{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==h.number){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_type,expected:h.number,received:Y.parsedType}),m}let Q=void 0,X=new q$;for(let Y of this._def.checks)if(Y.kind==="int"){if(!r.isInteger($.data))Q=this._getOrReturnCtx($,Q),y(Q,{code:v.invalid_type,expected:"integer",received:"float",message:Y.message}),X.dirty()}else if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_small,minimum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_big,maximum:Y.value,type:"number",inclusive:Y.inclusive,exact:!1,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if(mG($.data,Y.value)!==0)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else if(Y.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),y(Q,{code:v.not_finite,message:Y.message}),X.dirty()}else r.assertNever(Y);return{status:X.value,value:$.data}}gte($,J){return this.setLimit("min",$,!0,f.toString(J))}gt($,J){return this.setLimit("min",$,!1,f.toString(J))}lte($,J){return this.setLimit("max",$,!0,f.toString(J))}lt($,J){return this.setLimit("max",$,!1,f.toString(J))}setLimit($,J,Q,X){return new Y1({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:f.toString(X)}]})}_addCheck($){return new Y1({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:f.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:f.toString(J)})}finite($){return this._addCheck({kind:"finite",message:f.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString($)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&r.isInteger($.value))}get isFinite(){let $=null,J=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(J===null||Q.value>J)J=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(J)&&Number.isFinite($)}}Y1.create=($)=>{return new Y1({checks:[],typeName:l.ZodNumber,coerce:$?.coerce||!1,...d($)})};class G1 extends i{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==h.bigint)return this._getInvalidInput($);let Q=void 0,X=new q$;for(let Y of this._def.checks)if(Y.kind==="min"){if(Y.inclusive?$.data<Y.value:$.data<=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_small,type:"bigint",minimum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="max"){if(Y.inclusive?$.data>Y.value:$.data>=Y.value)Q=this._getOrReturnCtx($,Q),y(Q,{code:v.too_big,type:"bigint",maximum:Y.value,inclusive:Y.inclusive,message:Y.message}),X.dirty()}else if(Y.kind==="multipleOf"){if($.data%Y.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),y(Q,{code:v.not_multiple_of,multipleOf:Y.value,message:Y.message}),X.dirty()}else r.assertNever(Y);return{status:X.value,value:$.data}}_getInvalidInput($){let J=this._getOrReturnCtx($);return y(J,{code:v.invalid_type,expected:h.bigint,received:J.parsedType}),m}gte($,J){return this.setLimit("min",$,!0,f.toString(J))}gt($,J){return this.setLimit("min",$,!1,f.toString(J))}lte($,J){return this.setLimit("max",$,!0,f.toString(J))}lt($,J){return this.setLimit("max",$,!1,f.toString(J))}setLimit($,J,Q,X){return new G1({...this._def,checks:[...this._def.checks,{kind:$,value:J,inclusive:Q,message:f.toString(X)}]})}_addCheck($){return new G1({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString($)})}multipleOf($,J){return this._addCheck({kind:"multipleOf",value:$,message:f.toString(J)})}get minValue(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $}get maxValue(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $}}G1.create=($)=>{return new G1({checks:[],typeName:l.ZodBigInt,coerce:$?.coerce??!1,...d($)})};class d1 extends i{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==h.boolean){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.boolean,received:Q.parsedType}),m}return B$($.data)}}d1.create=($)=>{return new d1({typeName:l.ZodBoolean,coerce:$?.coerce||!1,...d($)})};class I1 extends i{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==h.date){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_type,expected:h.date,received:Y.parsedType}),m}if(Number.isNaN($.data.getTime())){let Y=this._getOrReturnCtx($);return y(Y,{code:v.invalid_date}),m}let Q=new q$,X=void 0;for(let Y of this._def.checks)if(Y.kind==="min"){if($.data.getTime()<Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_small,message:Y.message,inclusive:!0,exact:!1,minimum:Y.value,type:"date"}),Q.dirty()}else if(Y.kind==="max"){if($.data.getTime()>Y.value)X=this._getOrReturnCtx($,X),y(X,{code:v.too_big,message:Y.message,inclusive:!0,exact:!1,maximum:Y.value,type:"date"}),Q.dirty()}else r.assertNever(Y);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new I1({...this._def,checks:[...this._def.checks,$]})}min($,J){return this._addCheck({kind:"min",value:$.getTime(),message:f.toString(J)})}max($,J){return this._addCheck({kind:"max",value:$.getTime(),message:f.toString(J)})}get minDate(){let $=null;for(let J of this._def.checks)if(J.kind==="min"){if($===null||J.value>$)$=J.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let J of this._def.checks)if(J.kind==="max"){if($===null||J.value<$)$=J.value}return $!=null?new Date($):null}}I1.create=($)=>{return new I1({checks:[],coerce:$?.coerce||!1,typeName:l.ZodDate,...d($)})};class P0 extends i{_parse($){if(this._getType($)!==h.symbol){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.symbol,received:Q.parsedType}),m}return B$($.data)}}P0.create=($)=>{return new P0({typeName:l.ZodSymbol,...d($)})};class n1 extends i{_parse($){if(this._getType($)!==h.undefined){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.undefined,received:Q.parsedType}),m}return B$($.data)}}n1.create=($)=>{return new n1({typeName:l.ZodUndefined,...d($)})};class i1 extends i{_parse($){if(this._getType($)!==h.null){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.null,received:Q.parsedType}),m}return B$($.data)}}i1.create=($)=>{return new i1({typeName:l.ZodNull,...d($)})};class S1 extends i{constructor(){super(...arguments);this._any=!0}_parse($){return B$($.data)}}S1.create=($)=>{return new S1({typeName:l.ZodAny,...d($)})};class X1 extends i{constructor(){super(...arguments);this._unknown=!0}_parse($){return B$($.data)}}X1.create=($)=>{return new X1({typeName:l.ZodUnknown,...d($)})};class u$ extends i{_parse($){let J=this._getOrReturnCtx($);return y(J,{code:v.invalid_type,expected:h.never,received:J.parsedType}),m}}u$.create=($)=>{return new u$({typeName:l.ZodNever,...d($)})};class C0 extends i{_parse($){if(this._getType($)!==h.undefined){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.void,received:Q.parsedType}),m}return B$($.data)}}C0.create=($)=>{return new C0({typeName:l.ZodVoid,...d($)})};class _$ extends i{_parse($){let{ctx:J,status:Q}=this._processInputParams($),X=this._def;if(J.parsedType!==h.array)return y(J,{code:v.invalid_type,expected:h.array,received:J.parsedType}),m;if(X.exactLength!==null){let H=J.data.length>X.exactLength.value,M=J.data.length<X.exactLength.value;if(H||M)y(J,{code:H?v.too_big:v.too_small,minimum:M?X.exactLength.value:void 0,maximum:H?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),Q.dirty()}if(X.minLength!==null){if(J.data.length<X.minLength.value)y(J,{code:v.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),Q.dirty()}if(X.maxLength!==null){if(J.data.length>X.maxLength.value)y(J,{code:v.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),Q.dirty()}if(J.common.async)return Promise.all([...J.data].map((H,M)=>{return X.type._parseAsync(new T$(J,H,J.path,M))})).then((H)=>{return q$.mergeArray(Q,H)});let Y=[...J.data].map((H,M)=>{return X.type._parseSync(new T$(J,H,J.path,M))});return q$.mergeArray(Q,Y)}get element(){return this._def.type}min($,J){return new _$({...this._def,minLength:{value:$,message:f.toString(J)}})}max($,J){return new _$({...this._def,maxLength:{value:$,message:f.toString(J)}})}length($,J){return new _$({...this._def,exactLength:{value:$,message:f.toString(J)}})}nonempty($){return this.min(1,$)}}_$.create=($,J)=>{return new _$({type:$,minLength:null,maxLength:null,exactLength:null,typeName:l.ZodArray,...d(J)})};function c1($){if($ instanceof H$){let J={};for(let Q in $.shape){let X=$.shape[Q];J[Q]=Z$.create(c1(X))}return new H$({...$._def,shape:()=>J})}else if($ instanceof _$)return new _$({...$._def,type:c1($.element)});else if($ instanceof Z$)return Z$.create(c1($.unwrap()));else if($ instanceof r$)return r$.create(c1($.unwrap()));else if($ instanceof l$)return l$.create($.items.map((J)=>c1(J)));else return $}class H$ extends i{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),J=r.objectKeys($);return this._cached={shape:$,keys:J},this._cached}_parse($){if(this._getType($)!==h.object){let K=this._getOrReturnCtx($);return y(K,{code:v.invalid_type,expected:h.object,received:K.parsedType}),m}let{status:Q,ctx:X}=this._processInputParams($),{shape:Y,keys:H}=this._getCached(),M=[];if(!(this._def.catchall instanceof u$&&this._def.unknownKeys==="strip")){for(let K in X.data)if(!H.includes(K))M.push(K)}let G=[];for(let K of H){let q=Y[K],W=X.data[K];G.push({key:{status:"valid",value:K},value:q._parse(new T$(X,W,X.path,K)),alwaysSet:K in X.data})}if(this._def.catchall instanceof u$){let K=this._def.unknownKeys;if(K==="passthrough")for(let q of M)G.push({key:{status:"valid",value:q},value:{status:"valid",value:X.data[q]}});else if(K==="strict"){if(M.length>0)y(X,{code:v.unrecognized_keys,keys:M}),Q.dirty()}else if(K==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let q of M){let W=X.data[q];G.push({key:{status:"valid",value:q},value:K._parse(new T$(X,W,X.path,q)),alwaysSet:q in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let K=[];for(let q of G){let W=await q.key,B=await q.value;K.push({key:W,value:B,alwaysSet:q.alwaysSet})}return K}).then((K)=>{return q$.mergeObjectSync(Q,K)});else return q$.mergeObjectSync(Q,G)}get shape(){return this._def.shape()}strict($){return f.errToObj,new H$({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(J,Q)=>{let X=this._def.errorMap?.(J,Q).message??Q.defaultError;if(J.code==="unrecognized_keys")return{message:f.errToObj($).message??X};return{message:X}}}:{}})}strip(){return new H$({...this._def,unknownKeys:"strip"})}passthrough(){return new H$({...this._def,unknownKeys:"passthrough"})}extend($){return new H$({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new H$({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:l.ZodObject})}setKey($,J){return this.augment({[$]:J})}catchall($){return new H$({...this._def,catchall:$})}pick($){let J={};for(let Q of r.objectKeys($))if($[Q]&&this.shape[Q])J[Q]=this.shape[Q];return new H$({...this._def,shape:()=>J})}omit($){let J={};for(let Q of r.objectKeys(this.shape))if(!$[Q])J[Q]=this.shape[Q];return new H$({...this._def,shape:()=>J})}deepPartial(){return c1(this)}partial($){let J={};for(let Q of r.objectKeys(this.shape)){let X=this.shape[Q];if($&&!$[Q])J[Q]=X;else J[Q]=X.optional()}return new H$({...this._def,shape:()=>J})}required($){let J={};for(let Q of r.objectKeys(this.shape))if($&&!$[Q])J[Q]=this.shape[Q];else{let Y=this.shape[Q];while(Y instanceof Z$)Y=Y._def.innerType;J[Q]=Y}return new H$({...this._def,shape:()=>J})}keyof(){return PQ(r.objectKeys(this.shape))}}H$.create=($,J)=>{return new H$({shape:()=>$,unknownKeys:"strip",catchall:u$.create(),typeName:l.ZodObject,...d(J)})};H$.strictCreate=($,J)=>{return new H$({shape:()=>$,unknownKeys:"strict",catchall:u$.create(),typeName:l.ZodObject,...d(J)})};H$.lazycreate=($,J)=>{return new H$({shape:$,unknownKeys:"strip",catchall:u$.create(),typeName:l.ZodObject,...d(J)})};class o1 extends i{_parse($){let{ctx:J}=this._processInputParams($),Q=this._def.options;function X(Y){for(let M of Y)if(M.result.status==="valid")return M.result;for(let M of Y)if(M.result.status==="dirty")return J.common.issues.push(...M.ctx.common.issues),M.result;let H=Y.map((M)=>new D$(M.ctx.common.issues));return y(J,{code:v.invalid_union,unionErrors:H}),m}if(J.common.async)return Promise.all(Q.map(async(Y)=>{let H={...J,common:{...J.common,issues:[]},parent:null};return{result:await Y._parseAsync({data:J.data,path:J.path,parent:H}),ctx:H}})).then(X);else{let Y=void 0,H=[];for(let G of Q){let K={...J,common:{...J.common,issues:[]},parent:null},q=G._parseSync({data:J.data,path:J.path,parent:K});if(q.status==="valid")return q;else if(q.status==="dirty"&&!Y)Y={result:q,ctx:K};if(K.common.issues.length)H.push(K.common.issues)}if(Y)return J.common.issues.push(...Y.ctx.common.issues),Y.result;let M=H.map((G)=>new D$(G));return y(J,{code:v.invalid_union,unionErrors:M}),m}}get options(){return this._def.options}}o1.create=($,J)=>{return new o1({options:$,typeName:l.ZodUnion,...d(J)})};var o$=($)=>{if($ instanceof a1)return o$($.schema);else if($ instanceof x$)return o$($.innerType());else if($ instanceof s1)return[$.value];else if($ instanceof H1)return $.options;else if($ instanceof t1)return r.objectValues($.enum);else if($ instanceof e1)return o$($._def.innerType);else if($ instanceof n1)return[void 0];else if($ instanceof i1)return[null];else if($ instanceof Z$)return[void 0,...o$($.unwrap())];else if($ instanceof r$)return[null,...o$($.unwrap())];else if($ instanceof QJ)return o$($.unwrap());else if($ instanceof J0)return o$($.unwrap());else if($ instanceof $0)return o$($._def.innerType);else return[]};class JJ extends i{_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==h.object)return y(J,{code:v.invalid_type,expected:h.object,received:J.parsedType}),m;let Q=this.discriminator,X=J.data[Q],Y=this.optionsMap.get(X);if(!Y)return y(J,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),m;if(J.common.async)return Y._parseAsync({data:J.data,path:J.path,parent:J});else return Y._parseSync({data:J.data,path:J.path,parent:J})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,J,Q){let X=new Map;for(let Y of J){let H=o$(Y.shape[$]);if(!H.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let M of H){if(X.has(M))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(M)}`);X.set(M,Y)}}return new JJ({typeName:l.ZodDiscriminatedUnion,discriminator:$,options:J,optionsMap:X,...d(Q)})}}function B6($,J){let Q=m$($),X=m$(J);if($===J)return{valid:!0,data:$};else if(Q===h.object&&X===h.object){let Y=r.objectKeys(J),H=r.objectKeys($).filter((G)=>Y.indexOf(G)!==-1),M={...$,...J};for(let G of H){let K=B6($[G],J[G]);if(!K.valid)return{valid:!1};M[G]=K.data}return{valid:!0,data:M}}else if(Q===h.array&&X===h.array){if($.length!==J.length)return{valid:!1};let Y=[];for(let H=0;H<$.length;H++){let M=$[H],G=J[H],K=B6(M,G);if(!K.valid)return{valid:!1};Y.push(K.data)}return{valid:!0,data:Y}}else if(Q===h.date&&X===h.date&&+$===+J)return{valid:!0,data:$};else return{valid:!1}}class r1 extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($),X=(Y,H)=>{if(e0(Y)||e0(H))return m;let M=B6(Y.value,H.value);if(!M.valid)return y(Q,{code:v.invalid_intersection_types}),m;if($J(Y)||$J(H))J.dirty();return{status:J.value,value:M.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([Y,H])=>X(Y,H));else return X(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}}r1.create=($,J,Q)=>{return new r1({left:$,right:J,typeName:l.ZodIntersection,...d(Q)})};class l$ extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.array)return y(Q,{code:v.invalid_type,expected:h.array,received:Q.parsedType}),m;if(Q.data.length<this._def.items.length)return y(Q,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;if(!this._def.rest&&Q.data.length>this._def.items.length)y(Q,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),J.dirty();let Y=[...Q.data].map((H,M)=>{let G=this._def.items[M]||this._def.rest;if(!G)return null;return G._parse(new T$(Q,H,Q.path,M))}).filter((H)=>!!H);if(Q.common.async)return Promise.all(Y).then((H)=>{return q$.mergeArray(J,H)});else return q$.mergeArray(J,Y)}get items(){return this._def.items}rest($){return new l$({...this._def,rest:$})}}l$.create=($,J)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new l$({items:$,typeName:l.ZodTuple,rest:null,...d(J)})};class w0 extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.object)return y(Q,{code:v.invalid_type,expected:h.object,received:Q.parsedType}),m;let X=[],Y=this._def.keyType,H=this._def.valueType;for(let M in Q.data)X.push({key:Y._parse(new T$(Q,M,Q.path,M)),value:H._parse(new T$(Q,Q.data[M],Q.path,M)),alwaysSet:M in Q.data});if(Q.common.async)return q$.mergeObjectAsync(J,X);else return q$.mergeObjectSync(J,X)}get element(){return this._def.valueType}static create($,J,Q){if(J instanceof i)return new w0({keyType:$,valueType:J,typeName:l.ZodRecord,...d(Q)});return new w0({keyType:w$.create(),valueType:$,typeName:l.ZodRecord,...d(J)})}}class _0 extends i{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.map)return y(Q,{code:v.invalid_type,expected:h.map,received:Q.parsedType}),m;let X=this._def.keyType,Y=this._def.valueType,H=[...Q.data.entries()].map(([M,G],K)=>{return{key:X._parse(new T$(Q,M,Q.path,[K,"key"])),value:Y._parse(new T$(Q,G,Q.path,[K,"value"]))}});if(Q.common.async){let M=new Map;return Promise.resolve().then(async()=>{for(let G of H){let K=await G.key,q=await G.value;if(K.status==="aborted"||q.status==="aborted")return m;if(K.status==="dirty"||q.status==="dirty")J.dirty();M.set(K.value,q.value)}return{status:J.value,value:M}})}else{let M=new Map;for(let G of H){let{key:K,value:q}=G;if(K.status==="aborted"||q.status==="aborted")return m;if(K.status==="dirty"||q.status==="dirty")J.dirty();M.set(K.value,q.value)}return{status:J.value,value:M}}}}_0.create=($,J,Q)=>{return new _0({valueType:J,keyType:$,typeName:l.ZodMap,...d(Q)})};class z1 extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.parsedType!==h.set)return y(Q,{code:v.invalid_type,expected:h.set,received:Q.parsedType}),m;let X=this._def;if(X.minSize!==null){if(Q.data.size<X.minSize.value)y(Q,{code:v.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),J.dirty()}if(X.maxSize!==null){if(Q.data.size>X.maxSize.value)y(Q,{code:v.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),J.dirty()}let Y=this._def.valueType;function H(G){let K=new Set;for(let q of G){if(q.status==="aborted")return m;if(q.status==="dirty")J.dirty();K.add(q.value)}return{status:J.value,value:K}}let M=[...Q.data.values()].map((G,K)=>Y._parse(new T$(Q,G,Q.path,K)));if(Q.common.async)return Promise.all(M).then((G)=>H(G));else return H(M)}min($,J){return new z1({...this._def,minSize:{value:$,message:f.toString(J)}})}max($,J){return new z1({...this._def,maxSize:{value:$,message:f.toString(J)}})}size($,J){return this.min($,J).max($,J)}nonempty($){return this.min(1,$)}}z1.create=($,J)=>{return new z1({valueType:$,minSize:null,maxSize:null,typeName:l.ZodSet,...d(J)})};class p1 extends i{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==h.function)return y(J,{code:v.invalid_type,expected:h.function,received:J.parsedType}),m;function Q(M,G){return z0({data:M,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,u1(),i$].filter((K)=>!!K),issueData:{code:v.invalid_arguments,argumentsError:G}})}function X(M,G){return z0({data:M,path:J.path,errorMaps:[J.common.contextualErrorMap,J.schemaErrorMap,u1(),i$].filter((K)=>!!K),issueData:{code:v.invalid_return_type,returnTypeError:G}})}let Y={errorMap:J.common.contextualErrorMap},H=J.data;if(this._def.returns instanceof P1){let M=this;return B$(async function(...G){let K=new D$([]),q=await M._def.args.parseAsync(G,Y).catch((U)=>{throw K.addIssue(Q(G,U)),K}),W=await Reflect.apply(H,this,q);return await M._def.returns._def.type.parseAsync(W,Y).catch((U)=>{throw K.addIssue(X(W,U)),K})})}else{let M=this;return B$(function(...G){let K=M._def.args.safeParse(G,Y);if(!K.success)throw new D$([Q(G,K.error)]);let q=Reflect.apply(H,this,K.data),W=M._def.returns.safeParse(q,Y);if(!W.success)throw new D$([X(q,W.error)]);return W.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new p1({...this._def,args:l$.create($).rest(X1.create())})}returns($){return new p1({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,J,Q){return new p1({args:$?$:l$.create([]).rest(X1.create()),returns:J||X1.create(),typeName:l.ZodFunction,...d(Q)})}}class a1 extends i{get schema(){return this._def.getter()}_parse($){let{ctx:J}=this._processInputParams($);return this._def.getter()._parse({data:J.data,path:J.path,parent:J})}}a1.create=($,J)=>{return new a1({getter:$,typeName:l.ZodLazy,...d(J)})};class s1 extends i{_parse($){if($.data!==this._def.value){let J=this._getOrReturnCtx($);return y(J,{received:J.data,code:v.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:$.data}}get value(){return this._def.value}}s1.create=($,J)=>{return new s1({value:$,typeName:l.ZodLiteral,...d(J)})};function PQ($,J){return new H1({values:$,typeName:l.ZodEnum,...d(J)})}class H1 extends i{_parse($){if(typeof $.data!=="string"){let J=this._getOrReturnCtx($),Q=this._def.values;return y(J,{expected:r.joinValues(Q),received:J.parsedType,code:v.invalid_type}),m}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let J=this._getOrReturnCtx($),Q=this._def.values;return y(J,{received:J.data,code:v.invalid_enum_value,options:Q}),m}return B$($.data)}get options(){return this._def.values}get enum(){let $={};for(let J of this._def.values)$[J]=J;return $}get Values(){let $={};for(let J of this._def.values)$[J]=J;return $}get Enum(){let $={};for(let J of this._def.values)$[J]=J;return $}extract($,J=this._def){return H1.create($,{...this._def,...J})}exclude($,J=this._def){return H1.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...J})}}H1.create=PQ;class t1 extends i{_parse($){let J=r.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==h.string&&Q.parsedType!==h.number){let X=r.objectValues(J);return y(Q,{expected:r.joinValues(X),received:Q.parsedType,code:v.invalid_type}),m}if(!this._cache)this._cache=new Set(r.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let X=r.objectValues(J);return y(Q,{received:Q.data,code:v.invalid_enum_value,options:X}),m}return B$($.data)}get enum(){return this._def.values}}t1.create=($,J)=>{return new t1({values:$,typeName:l.ZodNativeEnum,...d(J)})};class P1 extends i{unwrap(){return this._def.type}_parse($){let{ctx:J}=this._processInputParams($);if(J.parsedType!==h.promise&&J.common.async===!1)return y(J,{code:v.invalid_type,expected:h.promise,received:J.parsedType}),m;let Q=J.parsedType===h.promise?J.data:Promise.resolve(J.data);return B$(Q.then((X)=>{return this._def.type.parseAsync(X,{path:J.path,errorMap:J.common.contextualErrorMap})}))}}P1.create=($,J)=>{return new P1({type:$,typeName:l.ZodPromise,...d(J)})};class x$ extends i{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===l.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:J,ctx:Q}=this._processInputParams($),X=this._def.effect||null,Y={addIssue:(H)=>{if(y(Q,H),H.fatal)J.abort();else J.dirty()},get path(){return Q.path}};if(Y.addIssue=Y.addIssue.bind(Y),X.type==="preprocess"){let H=X.transform(Q.data,Y);if(Q.common.async)return Promise.resolve(H).then(async(M)=>{if(J.value==="aborted")return m;let G=await this._def.schema._parseAsync({data:M,path:Q.path,parent:Q});if(G.status==="aborted")return m;if(G.status==="dirty")return A1(G.value);if(J.value==="dirty")return A1(G.value);return G});else{if(J.value==="aborted")return m;let M=this._def.schema._parseSync({data:H,path:Q.path,parent:Q});if(M.status==="aborted")return m;if(M.status==="dirty")return A1(M.value);if(J.value==="dirty")return A1(M.value);return M}}if(X.type==="refinement"){let H=(M)=>{let G=X.refinement(M,Y);if(Q.common.async)return Promise.resolve(G);if(G instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return M};if(Q.common.async===!1){let M=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(M.status==="aborted")return m;if(M.status==="dirty")J.dirty();return H(M.value),{status:J.value,value:M.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((M)=>{if(M.status==="aborted")return m;if(M.status==="dirty")J.dirty();return H(M.value).then(()=>{return{status:J.value,value:M.value}})})}if(X.type==="transform")if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!Q1(H))return m;let M=X.transform(H.value,Y);if(M instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:J.value,value:M}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(!Q1(H))return m;return Promise.resolve(X.transform(H.value,Y)).then((M)=>({status:J.value,value:M}))});r.assertNever(X)}}x$.create=($,J,Q)=>{return new x$({schema:$,typeName:l.ZodEffects,effect:J,...d(Q)})};x$.createWithPreprocess=($,J,Q)=>{return new x$({schema:J,effect:{type:"preprocess",transform:$},typeName:l.ZodEffects,...d(Q)})};class Z$ extends i{_parse($){if(this._getType($)===h.undefined)return B$(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}Z$.create=($,J)=>{return new Z$({innerType:$,typeName:l.ZodOptional,...d(J)})};class r$ extends i{_parse($){if(this._getType($)===h.null)return B$(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}r$.create=($,J)=>{return new r$({innerType:$,typeName:l.ZodNullable,...d(J)})};class e1 extends i{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;if(J.parsedType===h.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:J.path,parent:J})}removeDefault(){return this._def.innerType}}e1.create=($,J)=>{return new e1({innerType:$,typeName:l.ZodDefault,defaultValue:typeof J.default==="function"?J.default:()=>J.default,...d(J)})};class $0 extends i{_parse($){let{ctx:J}=this._processInputParams($),Q={...J,common:{...J.common,issues:[]}},X=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(l1(X))return X.then((Y)=>{return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new D$(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new D$(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}}$0.create=($,J)=>{return new $0({innerType:$,typeName:l.ZodCatch,catchValue:typeof J.catch==="function"?J.catch:()=>J.catch,...d(J)})};class Z0 extends i{_parse($){if(this._getType($)!==h.nan){let Q=this._getOrReturnCtx($);return y(Q,{code:v.invalid_type,expected:h.nan,received:Q.parsedType}),m}return{status:"valid",value:$.data}}}Z0.create=($)=>{return new Z0({typeName:l.ZodNaN,...d($)})};var uG=Symbol("zod_brand");class QJ extends i{_parse($){let{ctx:J}=this._processInputParams($),Q=J.data;return this._def.type._parse({data:Q,path:J.path,parent:J})}unwrap(){return this._def.type}}class T0 extends i{_parse($){let{status:J,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let Y=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return m;if(Y.status==="dirty")return J.dirty(),A1(Y.value);else return this._def.out._parseAsync({data:Y.value,path:Q.path,parent:Q})})();else{let X=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(X.status==="aborted")return m;if(X.status==="dirty")return J.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:Q.path,parent:Q})}}static create($,J){return new T0({in:$,out:J,typeName:l.ZodPipeline})}}class J0 extends i{_parse($){let J=this._def.innerType._parse($),Q=(X)=>{if(Q1(X))X.value=Object.freeze(X.value);return X};return l1(J)?J.then((X)=>Q(X)):Q(J)}unwrap(){return this._def.innerType}}J0.create=($,J)=>{return new J0({innerType:$,typeName:l.ZodReadonly,...d(J)})};function AQ($,J){let Q=typeof $==="function"?$(J):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function CQ($,J={},Q){if($)return S1.create().superRefine((X,Y)=>{let H=$(X);if(H instanceof Promise)return H.then((M)=>{if(!M){let G=AQ(J,X),K=G.fatal??Q??!0;Y.addIssue({code:"custom",...G,fatal:K})}});if(!H){let M=AQ(J,X),G=M.fatal??Q??!0;Y.addIssue({code:"custom",...M,fatal:G})}return});return S1.create()}var lG={object:H$.lazycreate},l;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(l||(l={}));var cG=($,J={message:`Input not instance of ${$.name}`})=>CQ((Q)=>Q instanceof $,J),wQ=w$.create,_Q=Y1.create,pG=Z0.create,dG=G1.create,ZQ=d1.create,nG=I1.create,iG=P0.create,oG=n1.create,rG=i1.create,aG=S1.create,sG=X1.create,tG=u$.create,eG=C0.create,$5=_$.create,J5=H$.create,Q5=H$.strictCreate,X5=o1.create,Y5=JJ.create,G5=r1.create,H5=l$.create,j5=w0.create,V5=_0.create,K5=z1.create,R5=p1.create,W5=a1.create,q5=s1.create,M5=H1.create,B5=t1.create,N5=P1.create,U5=x$.create,F5=Z$.create,D5=r$.create,O5=x$.createWithPreprocess,L5=T0.create,E5=()=>wQ().optional(),A5=()=>_Q().optional(),I5=()=>ZQ().optional(),S5={string:($)=>w$.create({...$,coerce:!0}),number:($)=>Y1.create({...$,coerce:!0}),boolean:($)=>d1.create({...$,coerce:!0}),bigint:($)=>G1.create({...$,coerce:!0}),date:($)=>I1.create({...$,coerce:!0})};var z5=m;var j1=($,J)=>{let Q=new Uint8Array(1+J.length);return Q[0]=$,Q.set(J,1),Q},xQ=($,J)=>{let Q=typeof $==="string";if(typeof $==="string")$=J.encode($);let X=new Uint8Array(1+$.byteLength);return X[0]=Q?0:1,X.set(new Uint8Array($),1),X},vQ=($,J)=>{if($[0]===0)return J.decode($.subarray(1));return new Uint8Array($.subarray(1))};var N6={[0]:z.string(),[1]:z.object({method:z.string(),headers:z.record(z.string(),z.string()),url:z.string()}),[2]:z.instanceof(Uint8Array),[3]:z.object({type:z.enum(["text","binary"]),data:z.instanceof(Uint8Array)}),[4]:z.object({code:z.number().optional(),reason:z.string().optional()})},Ij={[0]:z.string(),[1]:z.string(),[2]:z.object({status_code:z.number(),status_message:z.string(),headers:z.record(z.string(),z.string())}),[3]:z.instanceof(Uint8Array),[4]:z.instanceof(Uint8Array),[5]:z.object({code:z.number(),reason:z.string()})},Sj={[1]:{method:z.string(),headers:z.record(z.string(),z.string()),url:z.string()}},kQ={process_execute:z.object({command:z.string(),args:z.array(z.string()),env:z.record(z.string(),z.string()).optional(),cwd:z.string().optional()}),process_send_input:z.object({pid:z.number(),data:z.string()}),process_wait:z.object({pid:z.number(),output_idle_timeout_ms:z.number().optional(),timeout_ms:z.number().optional()}),process_list:z.object({include_dead:z.boolean().optional()}),process_read_plain_output:z.object({pid:z.number(),start_line:z.number().optional(),end_line:z.number().optional()}),process_kill:z.object({pid:z.number(),signal:z.string().optional()}),set_env:z.object({env:z.record(z.string(),z.string())}),read_file:z.object({path:z.string(),line_start:z.number().optional(),line_end:z.number().optional()}),write_file:z.object({path:z.string(),content:z.string(),base64:z.boolean().optional(),mode:z.number().optional()}),read_directory:z.object({path:z.string()}),watch_directory:z.object({path:z.string()})},U6=z.object({pid:z.number(),command:z.string(),args:z.array(z.string()),title:z.string().optional(),cwd:z.string(),env:z.record(z.string(),z.string()),exit_code:z.number().optional(),exit_signal:z.number().optional(),duration_ms:z.number().optional(),output_total_lines:z.number()}),P5=U6.extend({ansi_output:z.string(),plain_output:z.object({lines:z.array(z.string()),total_lines:z.number()})}),zj={process_execute:z.object({pid:z.number()}),process_send_input:z.object({}),process_wait:P5,process_list:z.object({processes:z.array(U6)}),process_read_plain_output:z.object({lines:z.array(z.string()),total_lines:z.number(),duration_ms:z.number(),exit_code:z.number().optional(),exit_signal:z.number().optional()}),process_kill:z.object({}),set_env:z.object({}),read_file:z.object({total_lines:z.number(),lines_read:z.number(),start_line:z.number(),content:z.string(),mime_type:z.string()}),write_file:z.object({}),read_directory:z.object({entries:z.array(z.object({name:z.string(),type:z.enum(["file","directory","symlink"])}))}),watch_directory:z.object({})},C5=z.object({type:z.enum(["create","update","delete"]),path:z.string()}),w5=z.object({type:z.enum(["context","added","deleted"]),content:z.string(),oldLineNumber:z.number().optional(),newLineNumber:z.number().optional()}),_5=z.object({oldStart:z.number(),oldLines:z.number(),newStart:z.number(),newLines:z.number(),lines:z.array(w5)}),hQ=z.object({path:z.string(),status:z.enum(["added","modified","deleted","renamed","copied","untracked","ignored","unmerged","typechange"]),oldPath:z.string().optional(),insertions:z.number(),deletions:z.number(),chunks:z.array(_5)}),TQ=z.object({totalFiles:z.number(),totalInsertions:z.number(),totalDeletions:z.number(),netChange:z.number(),startHash:z.string().optional(),currentHash:z.string().optional(),timespan:z.number(),files:z.array(hQ)}),Z5=z.object({path:z.string(),status:z.enum(["added","modified","deleted","renamed","copied","untracked","ignored","unmerged","typechange"]),staged:z.boolean()}),T5=z.object({hash:z.string(),shortHash:z.string(),message:z.string(),author:z.string(),email:z.string(),date:z.date(),timestamp:z.date(),filesChanged:z.number(),insertions:z.number(),deletions:z.number(),commitDiff:z.array(hQ).optional()}),x5=z.object({files:z.array(Z5),branch:z.string(),ahead:z.number(),behind:z.number(),timestamp:z.date(),sessionDiff:TQ.optional(),workingDirectoryDiff:TQ.optional(),newCommits:z.array(T5),currentCommit:z.object({hash:z.string(),shortHash:z.string(),message:z.string(),author:z.string(),date:z.date()}).optional(),diffSkipped:z.boolean().optional(),payloadTruncated:z.boolean().optional(),estimatedSizeKB:z.number().optional()}),Pj=z.object({debounceDelay:z.number().optional(),gitStatusInterval:z.number().optional(),ignoreDotfiles:z.boolean().optional(),ignored:z.array(z.string()).optional(),watchGit:z.boolean().optional(),includeDiffs:z.boolean().optional(),maxDiffFiles:z.number().optional(),maxPayloadSizeKB:z.number().optional(),truncateLargeDiffs:z.boolean().optional()}),Cj={process_status:z.object({status:U6}),process_output:z.object({pid:z.number(),output:z.string()}),file_change:z.object({changes:z.array(C5)}),git_status:x5};var a7=J$(ZX()),s7=J$(A6()),t7=J$(S6()),K0=J$(MJ()),e7=J$(yX());var T6=K0.default;class x6{multiplexer;notificationStream;decoder=new TextDecoder;encoder=new TextEncoder;processManager;constructor($){this.multiplexer=new c0({send:(J)=>{$.send(J)}}),this.multiplexer.onStream((J)=>{this.handleStream(J)}),this.notificationStream=this.multiplexer.createStream(),this.processManager=new S$($.env),this.processManager.onSpawn((J)=>{let Q=()=>{this.sendNotification({type:"process_status",payload:{status:this.processManager.status(J.pid)}})};Q(),J.terminal.onTitleChange(()=>{Q()}),J.onExit(()=>{this.sendNotification({type:"process_status",payload:{status:this.processManager.status(J.pid)}})}),J.onOutput((X)=>{this.sendNotification({type:"process_output",payload:{pid:J.pid,output:X}})})})}handleMessage($){this.multiplexer.handleMessage($)}handleStream($){let J=new AbortController;$.onClose(()=>{J.abort()}),$.onData((Q)=>{let X=Q[0],Y=Q.subarray(1);switch(X){case 0:{let H=JSON.parse(this.decoder.decode(Y));this.handleRequest($,H,J.signal).catch((M)=>{this.sendResponse($,{id:H.id,error:M instanceof Error?M.message:String(M)})});break}case 1:{let H=N6[1].safeParse(JSON.parse(this.decoder.decode(Y)));if(!H.success)throw new Error("Invalid proxy init message");let M;if(H.data.headers.upgrade==="websocket")M=this.handleProxyWebSocket($,H.data);else M=this.handleProxyRequest($,H.data);M.catch((G)=>{$.error(G.message)});break}}})}async handleProxyWebSocket($,J){let Q=new URL(J.url);if(Q.protocol==="http:")Q.protocol="ws:";else if(Q.protocol==="https:")Q.protocol="wss:";let X=new K0.default(Q.toString(),J.headers["sec-websocket-protocol"]?J.headers["sec-websocket-protocol"]:void 0,{headers:J.headers});X.addEventListener("open",()=>{let Y={status_code:101,status_message:"Switching Protocols",headers:{}};$.write(j1(2,this.encoder.encode(JSON.stringify(Y))))}),X.addEventListener("message",(Y)=>{if($.disposed)return;$.write(j1(4,xQ(Y.data,this.encoder)))}),X.addEventListener("close",(Y)=>{if($.disposed)return;let H={code:Y.code,reason:Y.reason};$.write(j1(5,this.encoder.encode(JSON.stringify(H)))),$.close()}),X.addEventListener("error",(Y)=>{console.log("err",Y)}),$.onClose(()=>{X.close()}),$.onError((Y)=>{X.close(1011,Y)}),$.onData((Y)=>{let H=Y.subarray(1);switch(Y[0]){case 3:{let M=vQ(H,this.decoder);X.send(M);break}case 4:{let M=N6[4].safeParse(JSON.parse(this.decoder.decode(H)));if(!M.success)throw new Error("Invalid proxy websocket close message");try{X.close(M.data.code,M.data.reason)}catch(G){console.error("Error closing websocket",G,M.data)}break}default:$.error(`Unexpected message type: ${Y[0]}`)}})}async handleProxyRequest($,J){let Q,X;if(J.method!=="GET"&&J.method!=="HEAD"&&J.method!=="OPTIONS"){let G=new TransformStream;Q=G.writable.getWriter(),X=G.readable}$.onData((G)=>{switch(G[0]){case 2:{if(Q){let K=G.subarray(1);if(K.length===0)Q.close();else Q.write(K)}break}default:$.error(`Unexpected message type: ${G[0]}`)}});let Y=await fetch(J.url,{headers:J.headers,method:J.method,body:X}),H={};Y.headers.forEach((G,K)=>{H[K]=G});let M={headers:H,status_code:Y.status,status_message:Y.statusText};if($.write(j1(2,this.encoder.encode(JSON.stringify(M)))),Y.body){let G=Y.headers.get("content-length"),K=G?parseInt(G):0,q=524288;if(K>=524288){let W=Y.body.getReader();try{while(!0){let{done:B,value:U}=await W.read();if(B)break;if(U){let R=0;while(R<U.length){let D=Math.min(524288,U.length-R),j=U.subarray(R,R+D);if($.write(j1(3,j)),R+=D,R<U.length)await new Promise((V)=>setImmediate(V))}}}}finally{W.releaseLock()}}else await Y.body.pipeTo(new WritableStream({write:(W)=>{$.write(j1(3,W))}}))}$.close()}async handleRequest($,J,Q){let Y=kQ[J.type].safeParse(J.payload);if(!Y.success)throw new Error(`Invalid request payload: ${Y.error.message}`);switch(J.type){case"process_execute":{let H=this.processManager.execute(J.payload.command,J.payload.args,{cwd:J.payload.cwd,env:J.payload.env});this.sendResponse($,{id:J.id,payload:{pid:H.pid}});break}case"process_wait":{this.handleProcessWait($,J,Q);break}case"process_kill":{this.mustGetProcess(J.payload.pid).kill(J.payload.signal),this.sendResponse($,{id:J.id,payload:{}});break}case"process_list":{this.sendResponse($,{id:J.id,payload:{processes:this.processManager.list(J.payload.include_dead??!1)}});break}case"process_read_plain_output":{let H=this.mustGetProcess(J.payload.pid),M=this.processManager.readPlainOutput(J.payload.pid,J.payload.start_line,J.payload.end_line);this.sendResponse($,{id:J.id,payload:{lines:M.lines,total_lines:M.totalLines,duration_ms:Date.now()-H.startTimeMS,exit_code:H.exitCode,exit_signal:H.exitSignal}});break}case"process_send_input":{this.mustGetProcess(J.payload.pid).sendInput(J.payload.data),this.sendResponse($,{id:J.id,payload:{}});break}case"set_env":{this.processManager.setEnv(J.payload.env),this.sendResponse($,{id:J.id,payload:{}});break}case"read_file":{let H=await e$.readFile(J.payload.path),M=await tJ(H);if(!(!M||M?.mime==="text/plain")){this.sendResponse($,{id:J.id,payload:{content:H.toString("base64"),mime_type:M?.mime,total_lines:0,lines_read:0,start_line:0}});break}let q=H.toString("utf-8").split(`
51
51
  `),W=(J.payload.line_start??1)-1,B=J.payload.line_end??q.length,U=q.slice(W,B);this.sendResponse($,{id:J.id,payload:{content:U.join(`
52
- `),mime_type:"text/plain",total_lines:q.length,lines_read:U.length,start_line:W}});break}case"write_file":{if(J.payload.base64)await e1.writeFile(J.payload.path,Buffer.from(J.payload.content,"base64"));else await e1.writeFile(J.payload.path,J.payload.content);if(typeof J.payload.mode==="number")await e1.chmod(J.payload.path,J.payload.mode);this.sendResponse($,{id:J.id,payload:{}});break}case"read_directory":{let H=await e1.readdir(J.payload.path,{withFileTypes:!0});this.sendResponse($,{id:J.id,payload:{entries:H.map((M)=>({name:M.name,type:M.isDirectory()?"directory":M.isSymbolicLink()?"symlink":"file"}))}});break}default:throw new Error(`Unknown request type: ${J.type}`)}}sendResponse($,J){$.write(j$(0,this.encoder.encode(JSON.stringify(J))))}sendNotification($){this.notificationStream.write(new Uint8Array([1,...this.encoder.encode(JSON.stringify($))]))}handleProcessWait($,J,Q){let X=J.payload,Y=this.mustGetProcess(X.pid),H,M,G=!1,K,q;if(typeof X.timeout_ms==="number")q=setTimeout(()=>{W()},X.timeout_ms);let W=()=>{if(G)return;if(G=!0,H)H.dispose();if(M)M.dispose();if(q)clearTimeout(q);if(K)clearTimeout(K);if(Q?.aborted)return;let B=this.processManager.status(X.pid),U=this.processManager.readPlainOutput(B.pid);this.sendResponse($,{id:J.id,payload:{...B,ansi_output:this.processManager.readANSIOutput(B.pid),plain_output:{lines:U.lines,total_lines:U.totalLines}}})};if(typeof Y.exitCode==="number"||typeof Y.exitSignal==="number"){W();return}H=Y.onOutput(()=>{if(K)clearTimeout(K);if(typeof X.output_idle_timeout_ms==="number")K=setTimeout(()=>{W()},X.output_idle_timeout_ms)}),M=Y.onExit(()=>{setTimeout(()=>{W()},10)}),Q.addEventListener("abort",()=>{W()})}mustGetProcess($){let J=this.processManager.getProcess($);if(!J)throw new Error(`Process ${$} not found`);return J}}F$.command("connect").description("Chat with your machine by connecting it to Blink.").action(()=>{let $=process.env.BLINK_URL??"wss://blink.so/api/connect",J=new NJ({url:$,token:process.env.BLINK_TOKEN});J.onConnect(()=>{console.log("Connected")}),J.onDisconnect(()=>{console.log("Disconnected")})});class NJ{opts;_onConnect=new h1;onConnect=this._onConnect.event;_onDisconnect=new h1;onDisconnect=this._onDisconnect.event;reconnectTimeout=null;disposed=!1;ws;server;hasReconnectedOnce=!1;constructor($){this.opts=$;this.server=new x6({send:(J)=>{if(this.ws.readyState===T6.OPEN)this.ws.send(J);else console.warn("Message skipped because connection is closed.")}}),this.connect()}dispose(){if(this.disposed)return;if(this.disposed=!0,this.ws.close(),this.reconnectTimeout)clearTimeout(this.reconnectTimeout)}scheduleReconnect(){if(this.disposed)return;let $=this.opts.immediateReconnectFirst??!0,Q=this.opts.reconnectionDelay??2500;if(!this.hasReconnectedOnce&&$)Q=0;if(this.hasReconnectedOnce=!0,this.reconnectTimeout)clearTimeout(this.reconnectTimeout);this.reconnectTimeout=setTimeout(()=>{this.connect()},Q)}connect(){let $=new URL(this.opts.url);if($.protocol==="http:")$.protocol="ws:";else if($.protocol==="https:")$.protocol="wss:";let J={};if(this.opts.token)J.Authorization=`Bearer ${this.opts.token}`;this.ws=new T6($.toString(),{headers:J}),this.ws.addEventListener("open",()=>{this._onConnect.emit()}),this.ws.addEventListener("close",()=>{if(this._onDisconnect.emit(),this.disposed)return;this.scheduleReconnect()}),this.ws.addEventListener("error",(Q)=>{console.error("Error",Q.message??Q);try{this.ws.close()}catch{}}),this.ws.addEventListener("message",(Q)=>{if(typeof Q.data==="string"){console.warn("Message skipped because it is not a buffer.");return}try{this.server.handleMessage(new Uint8Array(Q.data))}catch(X){console.error("message handler error",X);try{this.ws.close(1011)}catch{}}})}}var DJ=J1(require("node:process")),i6=require("node:buffer"),o6=J1(require("node:path")),QY=require("node:url"),XY=require("node:util"),r6=J1(require("node:child_process")),OJ=J1(require("node:fs/promises"));var b6=J1(require("node:process")),f0=J1(require("node:fs/promises"));var y6=J1(require("node:process")),mX=J1(require("node:os")),uX=J1(require("node:fs"));var bX=J1(require("node:fs"));var k6=J1(require("node:fs")),v6;function $H(){try{return k6.default.statSync("/.dockerenv"),!0}catch{return!1}}function JH(){try{return k6.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function h6(){if(v6===void 0)v6=$H()||JH();return v6}var g6,QH=()=>{try{return bX.default.statSync("/run/.containerenv"),!0}catch{return!1}};function K0(){if(g6===void 0)g6=QH()||h6();return g6}var fX=()=>{if(y6.default.platform!=="linux")return!1;if(mX.default.release().toLowerCase().includes("microsoft")){if(K0())return!1;return!0}try{return uX.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!K0():!1}catch{return!1}},q$=y6.default.env.__IS_WSL_TEST__?fX:fX();var XH=(()=>{let J;return async function(){if(J)return J;let Q="/etc/wsl.conf",X=!1;try{await f0.default.access(Q,f0.constants.F_OK),X=!0}catch{}if(!X)return"/mnt/";let Y=await f0.default.readFile(Q,{encoding:"utf8"}),H=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(Y);if(!H)return"/mnt/";return J=H.groups.mountPoint.trim(),J=J.endsWith("/")?J:`${J}/`,J}})(),YH=async()=>{return`${await XH()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},f6=async()=>{if(q$)return YH();return`${b6.default.env.SYSTEMROOT||b6.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`};function M$($,J,Q){let X=(Y)=>Object.defineProperty($,J,{value:Y,enumerable:!0,writable:!0});return Object.defineProperty($,J,{configurable:!0,enumerable:!0,get(){let Y=Q();return X(Y),Y},set(Y){X(Y)}}),$}var aX=require("node:util"),UJ=J1(require("node:process")),sX=require("node:child_process");var lX=require("node:util"),cX=J1(require("node:process")),pX=require("node:child_process"),GH=lX.promisify(pX.execFile);async function m6(){if(cX.default.platform!=="darwin")throw new Error("macOS only");let{stdout:$}=await GH("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec($)?.groups.id??"com.apple.Safari"}var dX=J1(require("node:process")),nX=require("node:util"),u6=require("node:child_process"),HH=nX.promisify(u6.execFile);async function iX($,{humanReadableOutput:J=!0}={}){if(dX.default.platform!=="darwin")throw new Error("macOS only");let Q=J?[]:["-ss"],{stdout:X}=await HH("osascript",["-e",$,Q]);return X.trim()}async function l6($){return iX(`tell application "Finder" to set app_path to application file id "${$}" as string
53
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var oX=require("node:util"),rX=require("node:child_process"),jH=oX.promisify(rX.execFile),VH={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}};class c6 extends Error{}async function p6($=jH){let{stdout:J}=await $("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),Q=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(J);if(!Q)throw new c6(`Cannot find Windows browser in stdout: ${JSON.stringify(J)}`);let{id:X}=Q.groups,Y=VH[X];if(!Y)throw new c6(`Unknown browser ID: ${X}`);return Y}var KH=aX.promisify(sX.execFile),RH=($)=>$.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(J)=>J.toUpperCase());async function d6(){if(UJ.default.platform==="darwin"){let $=await m6();return{name:await l6($),id:$}}if(UJ.default.platform==="linux"){let{stdout:$}=await KH("xdg-mime",["query","default","x-scheme-handler/http"]),J=$.trim();return{name:RH(J.replace(/.desktop$/,"").replace("-"," ")),id:J}}if(UJ.default.platform==="win32")return p6();throw new Error("Only macOS, Linux, and Windows are supported")}var WH=XY.promisify(r6.default.execFile),n6=o6.default.dirname(QY.fileURLToPath("file://"+__filename)),tX=o6.default.join(n6,"xdg-open"),{platform:R0,arch:eX}=DJ.default;async function qH(){let $=await f6(),J=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,Q=i6.Buffer.from(J,"utf16le").toString("base64"),{stdout:X}=await WH($,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",Q],{encoding:"utf8"}),Y=X.trim(),H={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return H[Y]?{id:H[Y]}:{}}var $Y=async($,J)=>{let Q;for(let X of $)try{return await J(X)}catch(Y){Q=Y}throw Q},FJ=async($)=>{if($={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...$},Array.isArray($.app))return $Y($.app,(G)=>FJ({...$,app:G}));let{name:J,arguments:Q=[]}=$.app??{};if(Q=[...Q],Array.isArray(J))return $Y(J,(G)=>FJ({...$,app:{name:G,arguments:Q}}));if(J==="browser"||J==="browserPrivate"){let G={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},K={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},q=q$?await qH():await d6();if(q.id in G){let W=G[q.id];if(J==="browserPrivate")Q.push(K[W]);return FJ({...$,app:{name:T$[W],arguments:Q}})}throw new Error(`${q.name} is not supported as a default browser`)}let X,Y=[],H={};if(R0==="darwin"){if(X="open",$.wait)Y.push("--wait-apps");if($.background)Y.push("--background");if($.newInstance)Y.push("--new");if(J)Y.push("-a",J)}else if(R0==="win32"||q$&&!K0()&&!J){if(X=await f6(),Y.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),!q$)H.windowsVerbatimArguments=!0;let G=["Start"];if($.wait)G.push("-Wait");if(J){if(G.push(`"\`"${J}\`""`),$.target)Q.push($.target)}else if($.target)G.push(`"${$.target}"`);if(Q.length>0)Q=Q.map((K)=>`"\`"${K}\`""`),G.push("-ArgumentList",Q.join(","));$.target=i6.Buffer.from(G.join(" "),"utf16le").toString("base64")}else{if(J)X=J;else{let G=!n6||n6==="/",K=!1;try{await OJ.default.access(tX,OJ.constants.X_OK),K=!0}catch{}X=DJ.default.versions.electron??(R0==="android"||G||!K)?"xdg-open":tX}if(Q.length>0)Y.push(...Q);if(!$.wait)H.stdio="ignore",H.detached=!0}if(R0==="darwin"&&Q.length>0)Y.push("--args",...Q);if($.target)Y.push($.target);let M=r6.default.spawn(X,Y,H);if($.wait)return new Promise((G,K)=>{M.once("error",K),M.once("close",(q)=>{if(!$.allowNonzeroExitCode&&q>0){K(new Error(`Exited with code ${q}`));return}G(M)})});return M.unref(),M},MH=($,J)=>{if(typeof $!=="string")throw new TypeError("Expected a `target`");return FJ({...J,target:$})};function JY($){if(typeof $==="string"||Array.isArray($))return $;let{[eX]:J}=$;if(!J)throw new Error(`${eX} is not supported`);return J}function LJ({[R0]:$},{wsl:J}){if(J&&q$)return JY(J);if(!$)throw new Error(`${R0} is not supported`);return JY($)}var T$={};M$(T$,"chrome",()=>LJ({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));M$(T$,"brave",()=>LJ({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));M$(T$,"firefox",()=>LJ({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));M$(T$,"edge",()=>LJ({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));M$(T$,"browser",()=>"browser");M$(T$,"browserPrivate",()=>"browserPrivate");var YY=MH;F$.command("chat").description("Start a Blink chat connected to your machine.").action(async()=>{let $=crypto.randomUUID(),J=new WebSocket(`wss://blink.so/auth?id=${$}`);await new Promise((G,K)=>{J.onopen=()=>{G()},J.onerror=(q)=>{K(q)}});let X=new Promise((G,K)=>{J.onmessage=(q)=>{let W=JSON.parse(q.data);if(W.type==="connect")G(W.token)}}),Y=`https://blink.so/auth?id=${$}&type=workspace`;console.log(`Opening the following URL in your browser: ${Y}`),await YY(Y);let H=await X,M=new NJ({url:"wss://blink.so/api/connect",token:H});M.onConnect(()=>{console.log("Connected to Blink")}),M.onDisconnect(()=>{console.log("Disconnected from Blink")})});var GY=require("crypto");if(!globalThis.crypto)globalThis.crypto={};if(!globalThis.crypto.randomUUID)globalThis.crypto.randomUUID=()=>{return GY.randomUUID()};F$.name("blink").description("A better chat for developers.").version("v0.0.1");F$.parse(process.argv);
52
+ `),mime_type:"text/plain",total_lines:q.length,lines_read:U.length,start_line:W}});break}case"write_file":{if(J.payload.base64)await e$.writeFile(J.payload.path,Buffer.from(J.payload.content,"base64"));else await e$.writeFile(J.payload.path,J.payload.content);if(typeof J.payload.mode==="number")await e$.chmod(J.payload.path,J.payload.mode);this.sendResponse($,{id:J.id,payload:{}});break}case"read_directory":{let H=await e$.readdir(J.payload.path,{withFileTypes:!0});this.sendResponse($,{id:J.id,payload:{entries:H.map((M)=>({name:M.name,type:M.isDirectory()?"directory":M.isSymbolicLink()?"symlink":"file"}))}});break}default:throw new Error(`Unknown request type: ${J.type}`)}}sendResponse($,J){$.write(j1(0,this.encoder.encode(JSON.stringify(J))))}sendNotification($){this.notificationStream.write(new Uint8Array([1,...this.encoder.encode(JSON.stringify($))]))}handleProcessWait($,J,Q){let X=J.payload,Y=this.mustGetProcess(X.pid),H,M,G=!1,K,q;if(typeof X.timeout_ms==="number")q=setTimeout(()=>{W()},X.timeout_ms);let W=()=>{if(G)return;if(G=!0,H)H.dispose();if(M)M.dispose();if(q)clearTimeout(q);if(K)clearTimeout(K);if(Q?.aborted)return;let B=this.processManager.status(X.pid),U=this.processManager.readPlainOutput(B.pid);this.sendResponse($,{id:J.id,payload:{...B,ansi_output:this.processManager.readANSIOutput(B.pid),plain_output:{lines:U.lines,total_lines:U.totalLines}}})};if(typeof Y.exitCode==="number"||typeof Y.exitSignal==="number"){W();return}H=Y.onOutput(()=>{if(K)clearTimeout(K);if(typeof X.output_idle_timeout_ms==="number")K=setTimeout(()=>{W()},X.output_idle_timeout_ms)}),M=Y.onExit(()=>{setTimeout(()=>{W()},10)}),Q.addEventListener("abort",()=>{W()})}mustGetProcess($){let J=this.processManager.getProcess($);if(!J)throw new Error(`Process ${$} not found`);return J}}F1.command("connect").description("Chat with your machine by connecting it to Blink.").action(()=>{let $=process.env.BLINK_URL??"wss://blink.so/api/connect",J=new NJ({url:$,token:process.env.BLINK_TOKEN});J.onConnect(()=>{console.log("Connected")}),J.onDisconnect(()=>{console.log("Disconnected")})});class NJ{opts;_onConnect=new h$;onConnect=this._onConnect.event;_onDisconnect=new h$;onDisconnect=this._onDisconnect.event;reconnectTimeout=null;disposed=!1;ws;server;hasReconnectedOnce=!1;constructor($){this.opts=$;this.server=new x6({send:(J)=>{if(this.ws.readyState===T6.OPEN)this.ws.send(J);else console.warn("Message skipped because connection is closed.")}}),this.connect()}dispose(){if(this.disposed)return;if(this.disposed=!0,this.ws.close(),this.reconnectTimeout)clearTimeout(this.reconnectTimeout)}scheduleReconnect(){if(this.disposed)return;let $=this.opts.immediateReconnectFirst??!0,Q=this.opts.reconnectionDelay??2500;if(!this.hasReconnectedOnce&&$)Q=0;if(this.hasReconnectedOnce=!0,this.reconnectTimeout)clearTimeout(this.reconnectTimeout);this.reconnectTimeout=setTimeout(()=>{this.connect()},Q)}connect(){let $=new URL(this.opts.url);if($.protocol==="http:")$.protocol="ws:";else if($.protocol==="https:")$.protocol="wss:";let J={};if(this.opts.token)J.Authorization=`Bearer ${this.opts.token}`;this.ws=new T6($.toString(),{headers:J}),this.ws.addEventListener("open",()=>{this._onConnect.emit()}),this.ws.addEventListener("close",()=>{if(this._onDisconnect.emit(),this.disposed)return;this.scheduleReconnect()}),this.ws.addEventListener("error",(Q)=>{console.error("Error",Q.message??Q);try{this.ws.close()}catch{}}),this.ws.addEventListener("message",(Q)=>{if(typeof Q.data==="string"){console.warn("Message skipped because it is not a buffer.");return}try{this.server.handleMessage(new Uint8Array(Q.data))}catch(X){console.error("message handler error",X);try{this.ws.close(1011)}catch{}}})}}var DJ=J$(require("node:process")),i6=require("node:buffer"),o6=J$(require("node:path")),QY=require("node:url"),XY=require("node:util"),r6=J$(require("node:child_process")),OJ=J$(require("node:fs/promises"));var b6=J$(require("node:process")),m0=J$(require("node:fs/promises"));var y6=J$(require("node:process")),mX=J$(require("node:os")),uX=J$(require("node:fs"));var bX=J$(require("node:fs"));var k6=J$(require("node:fs")),v6;function $H(){try{return k6.default.statSync("/.dockerenv"),!0}catch{return!1}}function JH(){try{return k6.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function h6(){if(v6===void 0)v6=$H()||JH();return v6}var g6,QH=()=>{try{return bX.default.statSync("/run/.containerenv"),!0}catch{return!1}};function R0(){if(g6===void 0)g6=QH()||h6();return g6}var fX=()=>{if(y6.default.platform!=="linux")return!1;if(mX.default.release().toLowerCase().includes("microsoft")){if(R0())return!1;return!0}try{return uX.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!R0():!1}catch{return!1}},q1=y6.default.env.__IS_WSL_TEST__?fX:fX();var XH=(()=>{let J;return async function(){if(J)return J;let Q="/etc/wsl.conf",X=!1;try{await m0.default.access(Q,m0.constants.F_OK),X=!0}catch{}if(!X)return"/mnt/";let Y=await m0.default.readFile(Q,{encoding:"utf8"}),H=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(Y);if(!H)return"/mnt/";return J=H.groups.mountPoint.trim(),J=J.endsWith("/")?J:`${J}/`,J}})(),YH=async()=>{return`${await XH()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`},f6=async()=>{if(q1)return YH();return`${b6.default.env.SYSTEMROOT||b6.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`};function M1($,J,Q){let X=(Y)=>Object.defineProperty($,J,{value:Y,enumerable:!0,writable:!0});return Object.defineProperty($,J,{configurable:!0,enumerable:!0,get(){let Y=Q();return X(Y),Y},set(Y){X(Y)}}),$}var aX=require("node:util"),UJ=J$(require("node:process")),sX=require("node:child_process");var lX=require("node:util"),cX=J$(require("node:process")),pX=require("node:child_process"),GH=lX.promisify(pX.execFile);async function m6(){if(cX.default.platform!=="darwin")throw new Error("macOS only");let{stdout:$}=await GH("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec($)?.groups.id??"com.apple.Safari"}var dX=J$(require("node:process")),nX=require("node:util"),u6=require("node:child_process"),HH=nX.promisify(u6.execFile);async function iX($,{humanReadableOutput:J=!0}={}){if(dX.default.platform!=="darwin")throw new Error("macOS only");let Q=J?[]:["-ss"],{stdout:X}=await HH("osascript",["-e",$,Q]);return X.trim()}async function l6($){return iX(`tell application "Finder" to set app_path to application file id "${$}" as string
53
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var oX=require("node:util"),rX=require("node:child_process"),jH=oX.promisify(rX.execFile),VH={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}};class c6 extends Error{}async function p6($=jH){let{stdout:J}=await $("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),Q=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(J);if(!Q)throw new c6(`Cannot find Windows browser in stdout: ${JSON.stringify(J)}`);let{id:X}=Q.groups,Y=VH[X];if(!Y)throw new c6(`Unknown browser ID: ${X}`);return Y}var KH=aX.promisify(sX.execFile),RH=($)=>$.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,(J)=>J.toUpperCase());async function d6(){if(UJ.default.platform==="darwin"){let $=await m6();return{name:await l6($),id:$}}if(UJ.default.platform==="linux"){let{stdout:$}=await KH("xdg-mime",["query","default","x-scheme-handler/http"]),J=$.trim();return{name:RH(J.replace(/.desktop$/,"").replace("-"," ")),id:J}}if(UJ.default.platform==="win32")return p6();throw new Error("Only macOS, Linux, and Windows are supported")}var WH=XY.promisify(r6.default.execFile),n6=o6.default.dirname(QY.fileURLToPath("file://"+__filename)),tX=o6.default.join(n6,"xdg-open"),{platform:W0,arch:eX}=DJ.default;async function qH(){let $=await f6(),J=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,Q=i6.Buffer.from(J,"utf16le").toString("base64"),{stdout:X}=await WH($,["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand",Q],{encoding:"utf8"}),Y=X.trim(),H={ChromeHTML:"com.google.chrome",BraveHTML:"com.brave.Browser",MSEdgeHTM:"com.microsoft.edge",FirefoxURL:"org.mozilla.firefox"};return H[Y]?{id:H[Y]}:{}}var $Y=async($,J)=>{let Q;for(let X of $)try{return await J(X)}catch(Y){Q=Y}throw Q},FJ=async($)=>{if($={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...$},Array.isArray($.app))return $Y($.app,(G)=>FJ({...$,app:G}));let{name:J,arguments:Q=[]}=$.app??{};if(Q=[...Q],Array.isArray(J))return $Y(J,(G)=>FJ({...$,app:{name:G,arguments:Q}}));if(J==="browser"||J==="browserPrivate"){let G={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.Browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge"},K={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},q=q1?await qH():await d6();if(q.id in G){let W=G[q.id];if(J==="browserPrivate")Q.push(K[W]);return FJ({...$,app:{name:T1[W],arguments:Q}})}throw new Error(`${q.name} is not supported as a default browser`)}let X,Y=[],H={};if(W0==="darwin"){if(X="open",$.wait)Y.push("--wait-apps");if($.background)Y.push("--background");if($.newInstance)Y.push("--new");if(J)Y.push("-a",J)}else if(W0==="win32"||q1&&!R0()&&!J){if(X=await f6(),Y.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),!q1)H.windowsVerbatimArguments=!0;let G=["Start"];if($.wait)G.push("-Wait");if(J){if(G.push(`"\`"${J}\`""`),$.target)Q.push($.target)}else if($.target)G.push(`"${$.target}"`);if(Q.length>0)Q=Q.map((K)=>`"\`"${K}\`""`),G.push("-ArgumentList",Q.join(","));$.target=i6.Buffer.from(G.join(" "),"utf16le").toString("base64")}else{if(J)X=J;else{let G=!n6||n6==="/",K=!1;try{await OJ.default.access(tX,OJ.constants.X_OK),K=!0}catch{}X=DJ.default.versions.electron??(W0==="android"||G||!K)?"xdg-open":tX}if(Q.length>0)Y.push(...Q);if(!$.wait)H.stdio="ignore",H.detached=!0}if(W0==="darwin"&&Q.length>0)Y.push("--args",...Q);if($.target)Y.push($.target);let M=r6.default.spawn(X,Y,H);if($.wait)return new Promise((G,K)=>{M.once("error",K),M.once("close",(q)=>{if(!$.allowNonzeroExitCode&&q>0){K(new Error(`Exited with code ${q}`));return}G(M)})});return M.unref(),M},MH=($,J)=>{if(typeof $!=="string")throw new TypeError("Expected a `target`");return FJ({...J,target:$})};function JY($){if(typeof $==="string"||Array.isArray($))return $;let{[eX]:J}=$;if(!J)throw new Error(`${eX} is not supported`);return J}function LJ({[W0]:$},{wsl:J}){if(J&&q1)return JY(J);if(!$)throw new Error(`${W0} is not supported`);return JY($)}var T1={};M1(T1,"chrome",()=>LJ({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));M1(T1,"brave",()=>LJ({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));M1(T1,"firefox",()=>LJ({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));M1(T1,"edge",()=>LJ({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));M1(T1,"browser",()=>"browser");M1(T1,"browserPrivate",()=>"browserPrivate");var YY=MH;F1.command("chat").description("Start a Blink chat connected to your machine.").action(async()=>{let $=crypto.randomUUID(),J=new K0.default(`wss://blink.so/auth?id=${$}`);await new Promise((G,K)=>{J.onopen=()=>{G()},J.onerror=(q)=>{K(q)}});let X=new Promise((G,K)=>{J.onmessage=(q)=>{let W=JSON.parse(q.data.toString());if(W.type==="connect")G(W.token)}}),Y=`https://blink.so/auth?id=${$}&type=workspace`;console.log(`Opening the following URL in your browser: ${Y}`),await YY(Y);let H=await X,M=new NJ({url:"wss://blink.so/api/connect",token:H});M.onConnect(()=>{console.log("Connected to Blink")}),M.onDisconnect(()=>{console.log("Disconnected from Blink")})});var GY=require("crypto");if(!globalThis.crypto)globalThis.crypto={};if(!globalThis.crypto.randomUUID)globalThis.crypto.randomUUID=()=>{return GY.randomUUID()};F1.name("blink").description("A better chat for developers.").version("v0.0.1");F1.parse(process.argv);