@php-wasm/xdebug-bridge 2.0.16 → 2.0.18

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.
@@ -1,12 +1,12 @@
1
- "use strict";const gr=require("assert"),Ot=require("path"),Xt=require("fs"),kn=require("util"),ys=require("url"),bs=require("ws"),ws=require("net"),Es=require("timers");var Ve=typeof document<"u"?document.currentScript:null;const $i=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if($i==="NODE"){let a=function(e){return new Promise(function(n,s){e.onload=e.onerror=function(i){e.onload=e.onerror=null,i.type==="load"?n(e.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const e=new Uint8Array([1,2,3,4]),s=new File([e],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class e extends Blob{constructor(s,i,r){super(s);let o;r?.lastModified&&(o=new Date),(!o||isNaN(o.getFullYear()))&&(o=new Date),this.lastModifiedDate=o,this.lastModified=o.getMilliseconds(),this.name=i||""}}global.File=e}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),a(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),a(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let e=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(s){const i=s.byobRequest.view,o=await n.slice(e,e+i.byteLength).arrayBuffer(),l=new Uint8Array(o);new Uint8Array(i.buffer).set(l);const E=l.byteLength;s.byobRequest.respond(E),e+=E,e>=n.size&&s.close()}})})}if($i==="NODE"&&typeof CustomEvent>"u"){class a extends Event{constructor(e,n={}){super(e,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=a}const xs="playground-log",yr=(a,...t)=>{Lt.dispatchEvent(new CustomEvent(xs,{detail:{log:a,args:t}}))},Os=(a,...t)=>{switch(typeof a.message=="string"?Reflect.set(a,"message",Hn(a.message)):a.message.message&&typeof a.message.message=="string"&&Reflect.set(a.message,"message",Hn(a.message.message)),a.severity){case xt.Debug:console.debug(a.message,...t);break;case xt.Info:console.info(a.message,...t);break;case xt.Warn:console.warn(a.message,...t);break;case xt.Error:console.error(a.message,...t);break;case xt.Fatal:console.error(a.message,...t);break;default:console.log(a.message,...t)}},Cs=a=>a instanceof Error?[a.message,a.stack].join(`
2
- `):JSON.stringify(a,null,2),qi=[],br=a=>{qi.push(a)},Vn=a=>{if(a.raw===!0)br(a.message);else{const t=Ts(typeof a.message=="object"?Cs(a.message):a.message,a.severity,a.prefix??le.JS);br(t)}},xt={Fatal:{name:"fatal",level:0},Error:{name:"error",level:1},Warn:{name:"warn",level:2},Log:{name:"log",level:3},Info:{name:"info",level:4},Debug:{name:"debug",level:5}},le={JS:"JavaScript"};class Is extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=xt.Info,this.handlers=t}getLogs(){return this.handlers.includes(Vn)?[...qi]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
1
+ "use strict";const gr=require("assert"),Ot=require("path"),Xt=require("fs"),kn=require("util"),ys=require("url"),bs=require("ws"),ws=require("net"),Es=require("crypto"),xs=require("timers");var Ve=typeof document<"u"?document.currentScript:null;const $i=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if($i==="NODE"){let a=function(e){return new Promise(function(n,s){e.onload=e.onerror=function(i){e.onload=e.onerror=null,i.type==="load"?n(e.result):s(new Error("Failed to read the blob/file"))}})},t=function(){const e=new Uint8Array([1,2,3,4]),s=new File([e],"test").stream();try{return s.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class e extends Blob{constructor(s,i,r){super(s);let o;r?.lastModified&&(o=new Date),(!o||isNaN(o.getFullYear()))&&(o=new Date),this.lastModifiedDate=o,this.lastModified=o.getMilliseconds(),this.name=i||""}}global.File=e}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),a(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),a(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let e=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(s){const i=s.byobRequest.view,o=await n.slice(e,e+i.byteLength).arrayBuffer(),l=new Uint8Array(o);new Uint8Array(i.buffer).set(l);const E=l.byteLength;s.byobRequest.respond(E),e+=E,e>=n.size&&s.close()}})})}if($i==="NODE"&&typeof CustomEvent>"u"){class a extends Event{constructor(e,n={}){super(e,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=a}const Os="playground-log",yr=(a,...t)=>{Lt.dispatchEvent(new CustomEvent(Os,{detail:{log:a,args:t}}))},Cs=(a,...t)=>{switch(typeof a.message=="string"?Reflect.set(a,"message",Hn(a.message)):a.message.message&&typeof a.message.message=="string"&&Reflect.set(a.message,"message",Hn(a.message.message)),a.severity){case xt.Debug:console.debug(a.message,...t);break;case xt.Info:console.info(a.message,...t);break;case xt.Warn:console.warn(a.message,...t);break;case xt.Error:console.error(a.message,...t);break;case xt.Fatal:console.error(a.message,...t);break;default:console.log(a.message,...t)}},Is=a=>a instanceof Error?[a.message,a.stack].join(`
2
+ `):JSON.stringify(a,null,2),qi=[],br=a=>{qi.push(a)},Vn=a=>{if(a.raw===!0)br(a.message);else{const t=vs(typeof a.message=="object"?Is(a.message):a.message,a.severity,a.prefix??le.JS);br(t)}},xt={Fatal:{name:"fatal",level:0},Error:{name:"error",level:1},Warn:{name:"warn",level:2},Log:{name:"log",level:3},Info:{name:"info",level:4},Debug:{name:"debug",level:5}},le={JS:"JavaScript"};class Ds extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=xt.Info,this.handlers=t}getLogs(){return this.handlers.includes(Vn)?[...qi]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
3
3
  If you're using a custom logger instance, make sure to register logToMemory handler.
4
- `),[])}logMessage(t,...e){const n={...t,severity:t.severity??xt.Log};for(const s of this.handlers)n.severity.level<=this.severity.level&&s(n,...e)}setSeverityFilterLevel(t){this.severity=t}log(t,...e){this.logMessage({message:t,severity:xt.Log,prefix:le.JS,raw:!1},...e)}debug(t,...e){this.logMessage({message:t,severity:xt.Debug,prefix:le.JS,raw:!1},...e)}info(t,...e){this.logMessage({message:t,severity:xt.Info,prefix:le.JS,raw:!1},...e)}warn(t,...e){this.logMessage({message:t,severity:xt.Warn,prefix:le.JS,raw:!1},...e)}error(t,...e){this.logMessage({message:t,severity:xt.Error,prefix:le.JS,raw:!1},...e)}}const Ds=()=>{try{if(process.env.NODE_ENV==="test")return[Vn,yr]}catch{}return[Vn,Os,yr]},Lt=new Is(Ds()),Hn=a=>a.replace(/\t/g,""),Ts=(a,t,e)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),r=s+" "+i;return a=Hn(a),`[${r}] ${e} ${t.name}: ${a}`};var it=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Kn={exports:{}},fe=typeof Reflect=="object"?Reflect:null,wr=fe&&typeof fe.apply=="function"?fe.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},Be;fe&&typeof fe.ownKeys=="function"?Be=fe.ownKeys:Object.getOwnPropertySymbols?Be=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Be=function(t){return Object.getOwnPropertyNames(t)};function vs(a){console&&console.warn&&console.warn(a)}var Wi=Number.isNaN||function(t){return t!==t};function ct(){ct.init.call(this)}Kn.exports=ct;Kn.exports.once=Ms;ct.EventEmitter=ct;ct.prototype._events=void 0;ct.prototype._eventsCount=0;ct.prototype._maxListeners=void 0;var Er=10;function $e(a){if(typeof a!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof a)}Object.defineProperty(ct,"defaultMaxListeners",{enumerable:!0,get:function(){return Er},set:function(a){if(typeof a!="number"||a<0||Wi(a))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+a+".");Er=a}});ct.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ct.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Wi(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Vi(a){return a._maxListeners===void 0?ct.defaultMaxListeners:a._maxListeners}ct.prototype.getMaxListeners=function(){return Vi(this)};ct.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var s=t==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var r;if(e.length>0&&(r=e[0]),r instanceof Error)throw r;var o=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw o.context=r,o}var l=i[t];if(l===void 0)return!1;if(typeof l=="function")wr(l,this,e);else for(var E=l.length,m=ki(l,E),n=0;n<E;++n)wr(m[n],this,e);return!0};function Hi(a,t,e,n){var s,i,r;if($e(e),i=a._events,i===void 0?(i=a._events=Object.create(null),a._eventsCount=0):(i.newListener!==void 0&&(a.emit("newListener",t,e.listener?e.listener:e),i=a._events),r=i[t]),r===void 0)r=i[t]=e,++a._eventsCount;else if(typeof r=="function"?r=i[t]=n?[e,r]:[r,e]:n?r.unshift(e):r.push(e),s=Vi(a),s>0&&r.length>s&&!r.warned){r.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=a,o.type=t,o.count=r.length,vs(o)}return a}ct.prototype.addListener=function(t,e){return Hi(this,t,e,!1)};ct.prototype.on=ct.prototype.addListener;ct.prototype.prependListener=function(t,e){return Hi(this,t,e,!0)};function _s(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function zi(a,t,e){var n={fired:!1,wrapFn:void 0,target:a,type:t,listener:e},s=_s.bind(n);return s.listener=e,n.wrapFn=s,s}ct.prototype.once=function(t,e){return $e(e),this.on(t,zi(this,t,e)),this};ct.prototype.prependOnceListener=function(t,e){return $e(e),this.prependListener(t,zi(this,t,e)),this};ct.prototype.removeListener=function(t,e){var n,s,i,r,o;if($e(e),s=this._events,s===void 0)return this;if(n=s[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete s[t],s.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(i=-1,r=n.length-1;r>=0;r--)if(n[r]===e||n[r].listener===e){o=n[r].listener,i=r;break}if(i<0)return this;i===0?n.shift():Ns(n,i),n.length===1&&(s[t]=n[0]),s.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this};ct.prototype.off=ct.prototype.removeListener;ct.prototype.removeAllListeners=function(t){var e,n,s;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var i=Object.keys(n),r;for(s=0;s<i.length;++s)r=i[s],r!=="removeListener"&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=n[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(s=e.length-1;s>=0;s--)this.removeListener(t,e[s]);return this};function Gi(a,t,e){var n=a._events;if(n===void 0)return[];var s=n[t];return s===void 0?[]:typeof s=="function"?e?[s.listener||s]:[s]:e?As(s):ki(s,s.length)}ct.prototype.listeners=function(t){return Gi(this,t,!0)};ct.prototype.rawListeners=function(t){return Gi(this,t,!1)};ct.listenerCount=function(a,t){return typeof a.listenerCount=="function"?a.listenerCount(t):Yi.call(a,t)};ct.prototype.listenerCount=Yi;function Yi(a){var t=this._events;if(t!==void 0){var e=t[a];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}ct.prototype.eventNames=function(){return this._eventsCount>0?Be(this._events):[]};function ki(a,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=a[n];return e}function Ns(a,t){for(;t+1<a.length;t++)a[t]=a[t+1];a.pop()}function As(a){for(var t=new Array(a.length),e=0;e<t.length;++e)t[e]=a[e].listener||a[e];return t}function Ms(a,t){return new Promise(function(e,n){function s(r){a.removeListener(t,i),n(r)}function i(){typeof a.removeListener=="function"&&a.removeListener("error",s),e([].slice.call(arguments))}Ki(a,t,i,{once:!0}),t!=="error"&&Ps(a,s,{once:!0})})}function Ps(a,t,e){typeof a.on=="function"&&Ki(a,"error",t,e)}function Ki(a,t,e,n){if(typeof a.on=="function")n.once?a.once(t,e):a.on(t,e);else if(typeof a.addEventListener=="function")a.addEventListener(t,function s(i){n.once&&a.removeEventListener(t,s),e(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof a)}var Qn=Kn.exports;class Qi extends Qn.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new bs.WebSocketServer({port:t}),this.wss.on("connection",e=>{if(this.ws){e.close();return}this.ws=e,this.emit("clientConnected"),e.on("message",n=>{Lt.debug("\x1B[1;32m[CDP][received]\x1B[0m",n.toString());let s;try{s=JSON.parse(n.toString())}catch{return}this.connected?this.emit("message",s):this.buffer.push(s)}),e.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),e.on("error",n=>{this.emit("error",n)})}),this.on("newListener",e=>{e==="message"&&process.nextTick(()=>{for(const n of this.buffer)this.emit("message",n);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const e=JSON.stringify(t);Lt.debug("\x1B[1;32m[CDP][send]\x1B[0m",e),this.ws.send(e)}close(){this.wss.close()}}class Ji extends Qn.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=ws.createServer(),this.server.on("connection",e=>{if(this.socket){e.destroy();return}this.socket=e,e.setEncoding("utf8"),this.emit("connected"),e.on("data",n=>this.onData(n.toString())),e.on("close",()=>{this.socket=null,this.emit("disconnected")}),e.on("error",n=>{this.emit("error",n)})}),this.server.listen(t)}onData(t){for(Lt.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const e=this.buffer.indexOf("\0");if(e===-1)break;const n=this.buffer.substring(0,e),s=parseInt(n,10);if(isNaN(s)){this.buffer="";break}this.expectedLength=s,this.buffer=this.buffer.slice(e+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const e=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const n=e.trim();this.expectedLength=null,this.emit("message",n);continue}break}}sendCommand(t){this.socket&&(Lt.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}const Ls={right:Us,center:Xs},Ss=0,Re=1,Fs=2,Ue=3;class js{constructor(t){var e;this.width=t.width,this.wrap=(e=t.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...t){const e=this.div(...t);e.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);const e=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){const e=t.split(`
4
+ `),[])}logMessage(t,...e){const n={...t,severity:t.severity??xt.Log};for(const s of this.handlers)n.severity.level<=this.severity.level&&s(n,...e)}setSeverityFilterLevel(t){this.severity=t}log(t,...e){this.logMessage({message:t,severity:xt.Log,prefix:le.JS,raw:!1},...e)}debug(t,...e){this.logMessage({message:t,severity:xt.Debug,prefix:le.JS,raw:!1},...e)}info(t,...e){this.logMessage({message:t,severity:xt.Info,prefix:le.JS,raw:!1},...e)}warn(t,...e){this.logMessage({message:t,severity:xt.Warn,prefix:le.JS,raw:!1},...e)}error(t,...e){this.logMessage({message:t,severity:xt.Error,prefix:le.JS,raw:!1},...e)}}const Ts=()=>{try{if(process.env.NODE_ENV==="test")return[Vn,yr]}catch{}return[Vn,Cs,yr]},Lt=new Ds(Ts()),Hn=a=>a.replace(/\t/g,""),vs=(a,t,e)=>{const n=new Date,s=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),r=s+" "+i;return a=Hn(a),`[${r}] ${e} ${t.name}: ${a}`};var it=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Kn={exports:{}},fe=typeof Reflect=="object"?Reflect:null,wr=fe&&typeof fe.apply=="function"?fe.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},Be;fe&&typeof fe.ownKeys=="function"?Be=fe.ownKeys:Object.getOwnPropertySymbols?Be=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Be=function(t){return Object.getOwnPropertyNames(t)};function _s(a){console&&console.warn&&console.warn(a)}var Wi=Number.isNaN||function(t){return t!==t};function ct(){ct.init.call(this)}Kn.exports=ct;Kn.exports.once=Ps;ct.EventEmitter=ct;ct.prototype._events=void 0;ct.prototype._eventsCount=0;ct.prototype._maxListeners=void 0;var Er=10;function $e(a){if(typeof a!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof a)}Object.defineProperty(ct,"defaultMaxListeners",{enumerable:!0,get:function(){return Er},set:function(a){if(typeof a!="number"||a<0||Wi(a))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+a+".");Er=a}});ct.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ct.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Wi(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Vi(a){return a._maxListeners===void 0?ct.defaultMaxListeners:a._maxListeners}ct.prototype.getMaxListeners=function(){return Vi(this)};ct.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var s=t==="error",i=this._events;if(i!==void 0)s=s&&i.error===void 0;else if(!s)return!1;if(s){var r;if(e.length>0&&(r=e[0]),r instanceof Error)throw r;var o=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw o.context=r,o}var l=i[t];if(l===void 0)return!1;if(typeof l=="function")wr(l,this,e);else for(var E=l.length,m=ki(l,E),n=0;n<E;++n)wr(m[n],this,e);return!0};function Hi(a,t,e,n){var s,i,r;if($e(e),i=a._events,i===void 0?(i=a._events=Object.create(null),a._eventsCount=0):(i.newListener!==void 0&&(a.emit("newListener",t,e.listener?e.listener:e),i=a._events),r=i[t]),r===void 0)r=i[t]=e,++a._eventsCount;else if(typeof r=="function"?r=i[t]=n?[e,r]:[r,e]:n?r.unshift(e):r.push(e),s=Vi(a),s>0&&r.length>s&&!r.warned){r.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=a,o.type=t,o.count=r.length,_s(o)}return a}ct.prototype.addListener=function(t,e){return Hi(this,t,e,!1)};ct.prototype.on=ct.prototype.addListener;ct.prototype.prependListener=function(t,e){return Hi(this,t,e,!0)};function Ns(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function zi(a,t,e){var n={fired:!1,wrapFn:void 0,target:a,type:t,listener:e},s=Ns.bind(n);return s.listener=e,n.wrapFn=s,s}ct.prototype.once=function(t,e){return $e(e),this.on(t,zi(this,t,e)),this};ct.prototype.prependOnceListener=function(t,e){return $e(e),this.prependListener(t,zi(this,t,e)),this};ct.prototype.removeListener=function(t,e){var n,s,i,r,o;if($e(e),s=this._events,s===void 0)return this;if(n=s[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete s[t],s.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(i=-1,r=n.length-1;r>=0;r--)if(n[r]===e||n[r].listener===e){o=n[r].listener,i=r;break}if(i<0)return this;i===0?n.shift():As(n,i),n.length===1&&(s[t]=n[0]),s.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this};ct.prototype.off=ct.prototype.removeListener;ct.prototype.removeAllListeners=function(t){var e,n,s;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var i=Object.keys(n),r;for(s=0;s<i.length;++s)r=i[s],r!=="removeListener"&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=n[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(s=e.length-1;s>=0;s--)this.removeListener(t,e[s]);return this};function Gi(a,t,e){var n=a._events;if(n===void 0)return[];var s=n[t];return s===void 0?[]:typeof s=="function"?e?[s.listener||s]:[s]:e?Ms(s):ki(s,s.length)}ct.prototype.listeners=function(t){return Gi(this,t,!0)};ct.prototype.rawListeners=function(t){return Gi(this,t,!1)};ct.listenerCount=function(a,t){return typeof a.listenerCount=="function"?a.listenerCount(t):Yi.call(a,t)};ct.prototype.listenerCount=Yi;function Yi(a){var t=this._events;if(t!==void 0){var e=t[a];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}ct.prototype.eventNames=function(){return this._eventsCount>0?Be(this._events):[]};function ki(a,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=a[n];return e}function As(a,t){for(;t+1<a.length;t++)a[t]=a[t+1];a.pop()}function Ms(a){for(var t=new Array(a.length),e=0;e<t.length;++e)t[e]=a[e].listener||a[e];return t}function Ps(a,t){return new Promise(function(e,n){function s(r){a.removeListener(t,i),n(r)}function i(){typeof a.removeListener=="function"&&a.removeListener("error",s),e([].slice.call(arguments))}Ki(a,t,i,{once:!0}),t!=="error"&&Ls(a,s,{once:!0})})}function Ls(a,t,e){typeof a.on=="function"&&Ki(a,"error",t,e)}function Ki(a,t,e,n){if(typeof a.on=="function")n.once?a.once(t,e):a.on(t,e);else if(typeof a.addEventListener=="function")a.addEventListener(t,function s(i){n.once&&a.removeEventListener(t,s),e(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof a)}var Qn=Kn.exports;class Qi extends Qn.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new bs.WebSocketServer({port:t}),this.wss.on("connection",e=>{if(this.ws){e.close();return}this.ws=e,this.emit("clientConnected"),e.on("message",n=>{Lt.debug("\x1B[1;32m[CDP][received]\x1B[0m",n.toString());let s;try{s=JSON.parse(n.toString())}catch{return}this.connected?this.emit("message",s):this.buffer.push(s)}),e.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),e.on("error",n=>{this.emit("error",n)})}),this.on("newListener",e=>{e==="message"&&process.nextTick(()=>{for(const n of this.buffer)this.emit("message",n);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const e=JSON.stringify(t);Lt.debug("\x1B[1;32m[CDP][send]\x1B[0m",e),this.ws.send(e)}close(){this.wss.close()}}class Ji extends Qn.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=ws.createServer(),this.server.on("connection",e=>{if(this.socket){e.destroy();return}this.socket=e,e.setEncoding("utf8"),this.emit("connected"),e.on("data",n=>this.onData(n.toString())),e.on("close",()=>{this.socket=null,this.emit("disconnected")}),e.on("error",n=>{this.emit("error",n)})}),this.server.listen(t)}onData(t){for(Lt.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const e=this.buffer.indexOf("\0");if(e===-1)break;const n=this.buffer.substring(0,e),s=parseInt(n,10);if(isNaN(s)){this.buffer="";break}this.expectedLength=s,this.buffer=this.buffer.slice(e+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const e=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const n=e.trim();this.expectedLength=null,this.emit("message",n);continue}break}}sendCommand(t){this.socket&&(Lt.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}const Ss={right:Xs,center:$s},Fs=0,Re=1,js=2,Ue=3;class Bs{constructor(t){var e;this.width=t.width,this.wrap=(e=t.wrap)!==null&&e!==void 0?e:!0,this.rows=[]}span(...t){const e=this.div(...t);e.span=!0}resetOutput(){this.rows=[]}div(...t){if(t.length===0&&this.div(""),this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]=="string")return this.applyLayoutDSL(t[0]);const e=t.map(n=>typeof n=="string"?this.colFromString(n):n);return this.rows.push(e),e}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]=="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){const e=t.split(`
5
5
  `).map(s=>s.split(" "));let n=0;return e.forEach(s=>{s.length>1&&vt.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),vt.stringWidth(s[0])))}),e.forEach(s=>{this.div(...s.map((i,r)=>({text:i.trim(),padding:this.measurePadding(i),width:r===0&&s.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){const e=vt.stripAnsi(t);return[0,e.match(/\s*$/)[0].length,0,e.match(/^\s*/)[0].length]}toString(){const t=[];return this.rows.forEach(e=>{this.rowToString(e,t)}),t.filter(e=>!e.hidden).map(e=>e.text).join(`
6
- `)}rowToString(t,e){return this.rasterize(t).forEach((n,s)=>{let i="";n.forEach((r,o)=>{const{width:l}=t[o],E=this.negatePadding(t[o]);let m=r;if(E>vt.stringWidth(r)&&(m+=" ".repeat(E-vt.stringWidth(r))),t[o].align&&t[o].align!=="left"&&this.wrap){const y=Ls[t[o].align];m=y(m,E),vt.stringWidth(m)<E&&(m+=" ".repeat((l||0)-vt.stringWidth(m)-1))}const p=t[o].padding||[0,0,0,0];p[Ue]&&(i+=" ".repeat(p[Ue])),i+=xr(t[o],m,"| "),i+=m,i+=xr(t[o],m," |"),p[Re]&&(i+=" ".repeat(p[Re])),s===0&&e.length>0&&(i=this.renderInline(i,e[e.length-1]))}),e.push({text:i.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){const n=t.match(/^ */),s=n?n[0].length:0,i=e.text,r=vt.stringWidth(i.trimRight());return e.span?this.wrap?s<r?t:(e.hidden=!0,i.trimRight()+" ".repeat(s-r)+t.trimLeft()):(e.hidden=!0,i+t):t}rasterize(t){const e=[],n=this.columnWidths(t);let s;return t.forEach((i,r)=>{i.width=n[r],this.wrap?s=vt.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
6
+ `)}rowToString(t,e){return this.rasterize(t).forEach((n,s)=>{let i="";n.forEach((r,o)=>{const{width:l}=t[o],E=this.negatePadding(t[o]);let m=r;if(E>vt.stringWidth(r)&&(m+=" ".repeat(E-vt.stringWidth(r))),t[o].align&&t[o].align!=="left"&&this.wrap){const y=Ss[t[o].align];m=y(m,E),vt.stringWidth(m)<E&&(m+=" ".repeat((l||0)-vt.stringWidth(m)-1))}const p=t[o].padding||[0,0,0,0];p[Ue]&&(i+=" ".repeat(p[Ue])),i+=xr(t[o],m,"| "),i+=m,i+=xr(t[o],m," |"),p[Re]&&(i+=" ".repeat(p[Re])),s===0&&e.length>0&&(i=this.renderInline(i,e[e.length-1]))}),e.push({text:i.replace(/ +$/,""),span:t.span})}),e}renderInline(t,e){const n=t.match(/^ */),s=n?n[0].length:0,i=e.text,r=vt.stringWidth(i.trimRight());return e.span?this.wrap?s<r?t:(e.hidden=!0,i.trimRight()+" ".repeat(s-r)+t.trimLeft()):(e.hidden=!0,i+t):t}rasterize(t){const e=[],n=this.columnWidths(t);let s;return t.forEach((i,r)=>{i.width=n[r],this.wrap?s=vt.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
7
7
  `):s=i.text.split(`
8
- `),i.border&&(s.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(s.unshift(...new Array(i.padding[Ss]||0).fill("")),s.push(...new Array(i.padding[Fs]||0).fill(""))),s.forEach((o,l)=>{e[l]||e.push([]);const E=e[l];for(let m=0;m<r;m++)E[m]===void 0&&E.push("");E.push(o)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[Ue]||0)+(t.padding[Re]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(r=>r.width||vt.stringWidth(r.text));let e=t.length,n=this.width;const s=t.map(r=>{if(r.width)return e--,n-=r.width,r.width}),i=e?Math.floor(n/e):0;return s.map((r,o)=>r===void 0?Math.max(i,Bs(t[o])):r)}}function xr(a,t,e){return a.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function Bs(a){const t=a.padding||[],e=1+(t[Ue]||0)+(t[Re]||0);return a.border?e+4:e}function Rs(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Us(a,t){a=a.trim();const e=vt.stringWidth(a);return e<t?" ".repeat(t-e)+a:a}function Xs(a,t){a=a.trim();const e=vt.stringWidth(a);return e>=t?a:" ".repeat(t-e>>1)+a}let vt;function $s(a,t){return vt=t,new js({width:a?.width||Rs(),wrap:a?.wrap})}const Zi=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function ts(a){return a.replace(Zi,"")}function qs(a,t){const[e,n]=a.match(Zi)||["",""];a=ts(a);let s="";for(let i=0;i<a.length;i++)i!==0&&i%t===0&&(s+=`
9
- `),s+=a.charAt(i);return e&&n&&(s=`${e}${s}${n}`),s}function Ws(a){return $s(a,{stringWidth:t=>[...t].length,stripAnsi:ts,wrap:qs})}function Vs(a,t){let e=Ot.resolve(".",a),n;for(Xt.statSync(e).isDirectory()||(e=Ot.dirname(e));;){if(n=t(e,Xt.readdirSync(e)),n)return Ot.resolve(e,n);if(e=Ot.dirname(n=e),n===e)break}}/**
8
+ `),i.border&&(s.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),s.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(s.unshift(...new Array(i.padding[Fs]||0).fill("")),s.push(...new Array(i.padding[js]||0).fill(""))),s.forEach((o,l)=>{e[l]||e.push([]);const E=e[l];for(let m=0;m<r;m++)E[m]===void 0&&E.push("");E.push(o)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[Ue]||0)+(t.padding[Re]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(r=>r.width||vt.stringWidth(r.text));let e=t.length,n=this.width;const s=t.map(r=>{if(r.width)return e--,n-=r.width,r.width}),i=e?Math.floor(n/e):0;return s.map((r,o)=>r===void 0?Math.max(i,Rs(t[o])):r)}}function xr(a,t,e){return a.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function Rs(a){const t=a.padding||[],e=1+(t[Ue]||0)+(t[Re]||0);return a.border?e+4:e}function Us(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Xs(a,t){a=a.trim();const e=vt.stringWidth(a);return e<t?" ".repeat(t-e)+a:a}function $s(a,t){a=a.trim();const e=vt.stringWidth(a);return e>=t?a:" ".repeat(t-e>>1)+a}let vt;function qs(a,t){return vt=t,new Bs({width:a?.width||Us(),wrap:a?.wrap})}const Zi=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function ts(a){return a.replace(Zi,"")}function Ws(a,t){const[e,n]=a.match(Zi)||["",""];a=ts(a);let s="";for(let i=0;i<a.length;i++)i!==0&&i%t===0&&(s+=`
9
+ `),s+=a.charAt(i);return e&&n&&(s=`${e}${s}${n}`),s}function Vs(a){return qs(a,{stringWidth:t=>[...t].length,stripAnsi:ts,wrap:Ws})}function Hs(a,t){let e=Ot.resolve(".",a),n;for(Xt.statSync(e).isDirectory()||(e=Ot.dirname(e));;){if(n=t(e,Xt.readdirSync(e)),n)return Ot.resolve(e,n);if(e=Ot.dirname(n=e),n===e)break}}/**
10
10
  * @license
11
11
  * Copyright (c) 2016, Contributors
12
12
  * SPDX-License-Identifier: ISC
@@ -14,7 +14,7 @@
14
14
  * @license
15
15
  * Copyright (c) 2016, Contributors
16
16
  * SPDX-License-Identifier: ISC
17
- */function Hs(a){if(Array.isArray(a))return a.map(r=>typeof r!="string"?r+"":r);a=a.trim();let t=0,e=null,n=null,s=null;const i=[];for(let r=0;r<a.length;r++){if(e=n,n=a.charAt(r),n===" "&&!s){e!==" "&&t++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),i[t]||(i[t]=""),i[t]+=n}return i}/**
17
+ */function zs(a){if(Array.isArray(a))return a.map(r=>typeof r!="string"?r+"":r);a=a.trim();let t=0,e=null,n=null,s=null;const i=[];for(let r=0;r<a.length;r++){if(e=n,n=a.charAt(r),n===" "&&!s){e!==" "&&t++;continue}n===s?s=null:(n==="'"||n==='"')&&!s&&(s=n),i[t]||(i[t]=""),i[t]+=n}return i}/**
18
18
  * @license
19
19
  * Copyright (c) 2016, Contributors
20
20
  * SPDX-License-Identifier: ISC
@@ -22,18 +22,18 @@
22
22
  * @license
23
23
  * Copyright (c) 2016, Contributors
24
24
  * SPDX-License-Identifier: ISC
25
- */let qt;class zs{constructor(t){qt=t}parse(t,e){const n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),s=Hs(t),i=typeof t=="string",r=Gs(Object.assign(Object.create(null),n.alias)),o=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),l=Object.assign(Object.create(null),n.default),E=n.configObjects||[],m=n.envPrefix,p=o["populate--"],y=p?"--":"_",w=Object.create(null),D=Object.create(null),_=n.__||qt.format,C={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},T=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,I=new RegExp("^--"+o["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(A){const f=typeof A=="object"?A.key:A,u=Object.keys(A).map(function(c){return{boolean:"bools",string:"strings",number:"numbers"}[c]}).filter(Boolean).pop();u&&(C[u][f]=!0),C.arrays[f]=!0,C.keys.push(f)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(A){C.bools[A]=!0,C.keys.push(A)}),[].concat(n.string||[]).filter(Boolean).forEach(function(A){C.strings[A]=!0,C.keys.push(A)}),[].concat(n.number||[]).filter(Boolean).forEach(function(A){C.numbers[A]=!0,C.keys.push(A)}),[].concat(n.count||[]).filter(Boolean).forEach(function(A){C.counts[A]=!0,C.keys.push(A)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(A){C.normalize[A]=!0,C.keys.push(A)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([A,f])=>{typeof f=="number"&&(C.nargs[A]=f,C.keys.push(A))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([A,f])=>{typeof f=="function"&&(C.coercions[A]=f,C.keys.push(A))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(A){C.configs[A]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([A,f])=>{(typeof f=="boolean"||typeof f=="function")&&(C.configs[A]=f)})),_t(n.key,r,n.default,C.arrays),Object.keys(l).forEach(function(A){(C.aliases[A]||[]).forEach(function(f){l[f]=l[A]})});let g=null;ht();let v=[];const M=Object.assign(Object.create(null),{_:[]}),X={};for(let A=0;A<s.length;A++){const f=s[A],u=f.replace(/^-{3,}/,"---");let c,h,N,L,F,Z;if(f!=="--"&&/^-/.test(f)&&b(f))q(f);else if(u.match(/^---+(=|$)/)){q(f);continue}else if(f.match(/^--.+=/)||!o["short-option-groups"]&&f.match(/^-.+=/))L=f.match(/^--?([^=]+)=([\s\S]*)$/),L!==null&&Array.isArray(L)&&L.length>=3&&(K(L[1],C.arrays)?A=d(A,L[1],s,L[2]):K(L[1],C.nargs)!==!1?A=U(A,L[1],s,L[2]):B(L[1],L[2],!0));else if(f.match(I)&&o["boolean-negation"])L=f.match(I),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],B(h,K(h,C.arrays)?[!1]:!1));else if(f.match(/^--.+/)||!o["short-option-groups"]&&f.match(/^-[^-]+/))L=f.match(/^--?(.+)/),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],K(h,C.arrays)?A=d(A,h,s):K(h,C.nargs)!==!1?A=U(A,h,s):(F=s[A+1],F!==void 0&&(!F.match(/^-/)||F.match(T))&&!K(h,C.bools)&&!K(h,C.counts)||/^(true|false)$/.test(F)?(B(h,F),A++):B(h,P(h))));else if(f.match(/^-.\..+=/))L=f.match(/^-([^=]+)=([\s\S]*)$/),L!==null&&Array.isArray(L)&&L.length>=3&&B(L[1],L[2]);else if(f.match(/^-.\..+/)&&!f.match(T))F=s[A+1],L=f.match(/^-(.\..+)/),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],F!==void 0&&!F.match(/^-/)&&!K(h,C.bools)&&!K(h,C.counts)?(B(h,F),A++):B(h,P(h)));else if(f.match(/^-[^-]+/)&&!f.match(T)){N=f.slice(1,-1).split(""),c=!1;for(let nt=0;nt<N.length;nt++){if(F=f.slice(nt+2),N[nt+1]&&N[nt+1]==="="){Z=f.slice(nt+3),h=N[nt],K(h,C.arrays)?A=d(A,h,s,Z):K(h,C.nargs)!==!1?A=U(A,h,s,Z):B(h,Z),c=!0;break}if(F==="-"){B(N[nt],F);continue}if(/[A-Za-z]/.test(N[nt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(F)&&K(F,C.bools)===!1){B(N[nt],F),c=!0;break}if(N[nt+1]&&N[nt+1].match(/\W/)){B(N[nt],F),c=!0;break}else B(N[nt],P(N[nt]))}h=f.slice(-1)[0],!c&&h!=="-"&&(K(h,C.arrays)?A=d(A,h,s):K(h,C.nargs)!==!1?A=U(A,h,s):(F=s[A+1],F!==void 0&&(!/^(-|--)[^-]/.test(F)||F.match(T))&&!K(h,C.bools)&&!K(h,C.counts)||/^(true|false)$/.test(F)?(B(h,F),A++):B(h,P(h))))}else if(f.match(/^-[0-9]$/)&&f.match(T)&&K(f.slice(1),C.bools))h=f.slice(1),B(h,P(h));else if(f==="--"){v=s.slice(A+1);break}else if(o["halt-at-non-option"]){v=s.slice(A);break}else q(f)}V(M,!0),V(M,!1),W(M),k(),at(M,C.aliases,l,!0),ft(M),o["set-placeholder-key"]&&Ct(M),Object.keys(C.counts).forEach(function(A){st(M,A.split("."))||B(A,0)}),p&&v.length&&(M[y]=[]),v.forEach(function(A){M[y].push(A)}),o["camel-case-expansion"]&&o["strip-dashed"]&&Object.keys(M).filter(A=>A!=="--"&&A.includes("-")).forEach(A=>{delete M[A]}),o["strip-aliased"]&&[].concat(...Object.keys(r).map(A=>r[A])).forEach(A=>{o["camel-case-expansion"]&&A.includes("-")&&delete M[A.split(".").map(f=>me(f)).join(".")],delete M[A]});function q(A){const f=$("_",A);(typeof f=="string"||typeof f=="number")&&M._.push(f)}function U(A,f,u,c){let h,N=K(f,C.nargs);if(N=typeof N!="number"||isNaN(N)?1:N,N===0)return rt(c)||(g=Error(_("Argument unexpected for: %s",f))),B(f,P(f)),A;let L=rt(c)?0:1;if(o["nargs-eats-options"])u.length-(A+1)+L<N&&(g=Error(_("Not enough arguments following: %s",f))),L=N;else{for(h=A+1;h<u.length&&(!u[h].match(/^-[^0-9]/)||u[h].match(T)||b(u[h]));h++)L++;L<N&&(g=Error(_("Not enough arguments following: %s",f)))}let F=Math.min(L,N);for(!rt(c)&&F>0&&(B(f,c),F--),h=A+1;h<F+A+1;h++)B(f,u[h]);return A+F}function d(A,f,u,c){let h=[],N=c||u[A+1];const L=K(f,C.nargs);if(K(f,C.bools)&&!/^(true|false)$/.test(N))h.push(!0);else if(rt(N)||rt(c)&&/^-/.test(N)&&!T.test(N)&&!b(N)){if(l[f]!==void 0){const F=l[f];h=Array.isArray(F)?F:[F]}}else{rt(c)||h.push(R(f,c,!0));for(let F=A+1;F<u.length&&!(!o["greedy-arrays"]&&h.length>0||L&&typeof L=="number"&&h.length>=L||(N=u[F],/^-/.test(N)&&!T.test(N)&&!b(N)));F++)A=F,h.push(R(f,N,i))}return typeof L=="number"&&(L&&h.length<L||isNaN(L)&&h.length===0)&&(g=Error(_("Not enough arguments following: %s",f))),B(f,h),A}function B(A,f,u=i){if(/-/.test(A)&&o["camel-case-expansion"]){const N=A.split(".").map(function(L){return me(L)}).join(".");S(A,N)}const c=R(A,f,u),h=A.split(".");ut(M,h,c),C.aliases[A]&&C.aliases[A].forEach(function(N){const L=N.split(".");ut(M,L,c)}),h.length>1&&o["dot-notation"]&&(C.aliases[h[0]]||[]).forEach(function(N){let L=N.split(".");const F=[].concat(h);F.shift(),L=L.concat(F),(C.aliases[A]||[]).includes(L.join("."))||ut(M,L,c)}),K(A,C.normalize)&&!K(A,C.arrays)&&[A].concat(C.aliases[A]||[]).forEach(function(L){Object.defineProperty(X,L,{enumerable:!0,get(){return f},set(F){f=typeof F=="string"?qt.normalize(F):F}})})}function S(A,f){C.aliases[A]&&C.aliases[A].length||(C.aliases[A]=[f],w[f]=!0),C.aliases[f]&&C.aliases[f].length||S(f,A)}function R(A,f,u){u&&(f=Ys(f)),(K(A,C.bools)||K(A,C.counts))&&typeof f=="string"&&(f=f==="true");let c=Array.isArray(f)?f.map(function(h){return $(A,h)}):$(A,f);return K(A,C.counts)&&(rt(c)||typeof c=="boolean")&&(c=He()),K(A,C.normalize)&&K(A,C.arrays)&&(Array.isArray(f)?c=f.map(h=>qt.normalize(h)):c=qt.normalize(f)),c}function $(A,f){return!o["parse-positional-numbers"]&&A==="_"||!K(A,C.strings)&&!K(A,C.bools)&&!Array.isArray(f)&&(ns(f)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${f}`)))||!rt(f)&&K(A,C.numbers))&&(f=Number(f)),f}function W(A){const f=Object.create(null);at(f,C.aliases,l),Object.keys(C.configs).forEach(function(u){const c=A[u]||f[u];if(c)try{let h=null;const N=qt.resolve(qt.cwd(),c),L=C.configs[u];if(typeof L=="function"){try{h=L(N)}catch(F){h=F}if(h instanceof Error){g=h;return}}else h=qt.require(N);G(h)}catch(h){h.name==="PermissionDenied"?g=h:A[u]&&(g=Error(_("Invalid JSON config file: %s",c)))}})}function G(A,f){Object.keys(A).forEach(function(u){const c=A[u],h=f?f+"."+u:u;typeof c=="object"&&c!==null&&!Array.isArray(c)&&o["dot-notation"]?G(c,h):(!st(M,h.split("."))||K(h,C.arrays)&&o["combine-arrays"])&&B(h,c)})}function k(){typeof E<"u"&&E.forEach(function(A){G(A)})}function V(A,f){if(typeof m>"u")return;const u=typeof m=="string"?m:"",c=qt.env();Object.keys(c).forEach(function(h){if(u===""||h.lastIndexOf(u,0)===0){const N=h.split("__").map(function(L,F){return F===0&&(L=L.substring(u.length)),me(L)});(f&&C.configs[N.join(".")]||!f)&&!st(A,N)&&B(N.join("."),c[h])}})}function ft(A){let f;const u=new Set;Object.keys(A).forEach(function(c){if(!u.has(c)&&(f=K(c,C.coercions),typeof f=="function"))try{const h=$(c,f(A[c]));[].concat(C.aliases[c]||[],c).forEach(N=>{u.add(N),A[N]=h})}catch(h){g=h}})}function Ct(A){return C.keys.forEach(f=>{~f.indexOf(".")||typeof A[f]>"u"&&(A[f]=void 0)}),A}function at(A,f,u,c=!1){Object.keys(u).forEach(function(h){st(A,h.split("."))||(ut(A,h.split("."),u[h]),c&&(D[h]=!0),(f[h]||[]).forEach(function(N){st(A,N.split("."))||ut(A,N.split("."),u[h])}))})}function st(A,f){let u=A;o["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(h){u=u[h]||{}});const c=f[f.length-1];return typeof u!="object"?!1:c in u}function ut(A,f,u){let c=A;o["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(Z){Z=Or(Z),typeof c=="object"&&c[Z]===void 0&&(c[Z]={}),typeof c[Z]!="object"||Array.isArray(c[Z])?(Array.isArray(c[Z])?c[Z].push({}):c[Z]=[c[Z],{}],c=c[Z][c[Z].length-1]):c=c[Z]});const h=Or(f[f.length-1]),N=K(f.join("."),C.arrays),L=Array.isArray(u);let F=o["duplicate-arguments-array"];!F&&K(h,C.nargs)&&(F=!0,(!rt(c[h])&&C.nargs[h]===1||Array.isArray(c[h])&&c[h].length===C.nargs[h])&&(c[h]=void 0)),u===He()?c[h]=He(c[h]):Array.isArray(c[h])?F&&N&&L?c[h]=o["flatten-duplicate-arrays"]?c[h].concat(u):(Array.isArray(c[h][0])?c[h]:[c[h]]).concat([u]):!F&&!!N==!!L?c[h]=u:c[h]=c[h].concat([u]):c[h]===void 0&&N?c[h]=L?u:[u]:F&&!(c[h]===void 0||K(h,C.counts)||K(h,C.bools))?c[h]=[c[h],u]:c[h]=u}function _t(...A){A.forEach(function(f){Object.keys(f||{}).forEach(function(u){C.aliases[u]||(C.aliases[u]=[].concat(r[u]||[]),C.aliases[u].concat(u).forEach(function(c){if(/-/.test(c)&&o["camel-case-expansion"]){const h=me(c);h!==u&&C.aliases[u].indexOf(h)===-1&&(C.aliases[u].push(h),w[h]=!0)}}),C.aliases[u].concat(u).forEach(function(c){if(c.length>1&&/[A-Z]/.test(c)&&o["camel-case-expansion"]){const h=es(c,"-");h!==u&&C.aliases[u].indexOf(h)===-1&&(C.aliases[u].push(h),w[h]=!0)}}),C.aliases[u].forEach(function(c){C.aliases[c]=[u].concat(C.aliases[u].filter(function(h){return c!==h}))}))})})}function K(A,f){const u=[].concat(C.aliases[A]||[],A),c=Object.keys(f),h=u.find(N=>c.includes(N));return h?f[h]:!1}function $t(A){const f=Object.keys(C);return[].concat(f.map(c=>C[c])).some(function(c){return Array.isArray(c)?c.includes(A):c[A]})}function Q(A,...f){return[].concat(...f).some(function(c){const h=A.match(c);return h&&$t(h[1])})}function x(A){if(A.match(T)||!A.match(/^-[^-]+/))return!1;let f=!0,u;const c=A.slice(1).split("");for(let h=0;h<c.length;h++){if(u=A.slice(h+2),!$t(c[h])){f=!1;break}if(c[h+1]&&c[h+1]==="="||u==="-"||/[A-Za-z]/.test(c[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(u)||c[h+1]&&c[h+1].match(/\W/))break}return f}function b(A){return o["unknown-options-as-args"]&&j(A)}function j(A){return A=A.replace(/^-{3,}/,"--"),A.match(T)||x(A)?!1:!Q(A,/^-+([^=]+?)=[\s\S]*$/,I,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function P(A){return!K(A,C.bools)&&!K(A,C.counts)&&`${A}`in l?l[A]:J(ot(A))}function J(A){return{[jt.BOOLEAN]:!0,[jt.STRING]:"",[jt.NUMBER]:void 0,[jt.ARRAY]:[]}[A]}function ot(A){let f=jt.BOOLEAN;return K(A,C.strings)?f=jt.STRING:K(A,C.numbers)?f=jt.NUMBER:K(A,C.bools)?f=jt.BOOLEAN:K(A,C.arrays)&&(f=jt.ARRAY),f}function rt(A){return A===void 0}function ht(){Object.keys(C.counts).find(A=>K(A,C.arrays)?(g=Error(_("Invalid configuration: %s, opts.count excludes opts.array.",A)),!0):K(A,C.nargs)?(g=Error(_("Invalid configuration: %s, opts.count excludes opts.narg.",A)),!0):!1)}return{aliases:Object.assign({},C.aliases),argv:Object.assign(X,M),configuration:o,defaulted:Object.assign({},D),error:g,newAliases:Object.assign({},w)}}}function Gs(a){const t=[],e=Object.create(null);let n=!0;for(Object.keys(a).forEach(function(s){t.push([].concat(a[s],s))});n;){n=!1;for(let s=0;s<t.length;s++)for(let i=s+1;i<t.length;i++)if(t[s].filter(function(o){return t[i].indexOf(o)!==-1}).length){t[s]=t[s].concat(t[i]),t.splice(i,1),n=!0;break}}return t.forEach(function(s){s=s.filter(function(r,o,l){return l.indexOf(r)===o});const i=s.pop();i!==void 0&&typeof i=="string"&&(e[i]=s)}),e}function He(a){return a!==void 0?a+1:1}function Or(a){return a==="__proto__"?"___proto___":a}function Ys(a){return typeof a=="string"&&(a[0]==="'"||a[0]==='"')&&a[a.length-1]===a[0]?a.substring(1,a.length-1):a}/**
25
+ */let qt;class Gs{constructor(t){qt=t}parse(t,e){const n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},e),s=zs(t),i=typeof t=="string",r=Ys(Object.assign(Object.create(null),n.alias)),o=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),l=Object.assign(Object.create(null),n.default),E=n.configObjects||[],m=n.envPrefix,p=o["populate--"],y=p?"--":"_",w=Object.create(null),D=Object.create(null),_=n.__||qt.format,C={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},T=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,I=new RegExp("^--"+o["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(A){const f=typeof A=="object"?A.key:A,u=Object.keys(A).map(function(c){return{boolean:"bools",string:"strings",number:"numbers"}[c]}).filter(Boolean).pop();u&&(C[u][f]=!0),C.arrays[f]=!0,C.keys.push(f)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(A){C.bools[A]=!0,C.keys.push(A)}),[].concat(n.string||[]).filter(Boolean).forEach(function(A){C.strings[A]=!0,C.keys.push(A)}),[].concat(n.number||[]).filter(Boolean).forEach(function(A){C.numbers[A]=!0,C.keys.push(A)}),[].concat(n.count||[]).filter(Boolean).forEach(function(A){C.counts[A]=!0,C.keys.push(A)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(A){C.normalize[A]=!0,C.keys.push(A)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([A,f])=>{typeof f=="number"&&(C.nargs[A]=f,C.keys.push(A))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([A,f])=>{typeof f=="function"&&(C.coercions[A]=f,C.keys.push(A))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(A){C.configs[A]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([A,f])=>{(typeof f=="boolean"||typeof f=="function")&&(C.configs[A]=f)})),_t(n.key,r,n.default,C.arrays),Object.keys(l).forEach(function(A){(C.aliases[A]||[]).forEach(function(f){l[f]=l[A]})});let g=null;ht();let v=[];const M=Object.assign(Object.create(null),{_:[]}),X={};for(let A=0;A<s.length;A++){const f=s[A],u=f.replace(/^-{3,}/,"---");let c,h,N,L,F,Z;if(f!=="--"&&/^-/.test(f)&&b(f))q(f);else if(u.match(/^---+(=|$)/)){q(f);continue}else if(f.match(/^--.+=/)||!o["short-option-groups"]&&f.match(/^-.+=/))L=f.match(/^--?([^=]+)=([\s\S]*)$/),L!==null&&Array.isArray(L)&&L.length>=3&&(K(L[1],C.arrays)?A=d(A,L[1],s,L[2]):K(L[1],C.nargs)!==!1?A=U(A,L[1],s,L[2]):B(L[1],L[2],!0));else if(f.match(I)&&o["boolean-negation"])L=f.match(I),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],B(h,K(h,C.arrays)?[!1]:!1));else if(f.match(/^--.+/)||!o["short-option-groups"]&&f.match(/^-[^-]+/))L=f.match(/^--?(.+)/),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],K(h,C.arrays)?A=d(A,h,s):K(h,C.nargs)!==!1?A=U(A,h,s):(F=s[A+1],F!==void 0&&(!F.match(/^-/)||F.match(T))&&!K(h,C.bools)&&!K(h,C.counts)||/^(true|false)$/.test(F)?(B(h,F),A++):B(h,P(h))));else if(f.match(/^-.\..+=/))L=f.match(/^-([^=]+)=([\s\S]*)$/),L!==null&&Array.isArray(L)&&L.length>=3&&B(L[1],L[2]);else if(f.match(/^-.\..+/)&&!f.match(T))F=s[A+1],L=f.match(/^-(.\..+)/),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],F!==void 0&&!F.match(/^-/)&&!K(h,C.bools)&&!K(h,C.counts)?(B(h,F),A++):B(h,P(h)));else if(f.match(/^-[^-]+/)&&!f.match(T)){N=f.slice(1,-1).split(""),c=!1;for(let nt=0;nt<N.length;nt++){if(F=f.slice(nt+2),N[nt+1]&&N[nt+1]==="="){Z=f.slice(nt+3),h=N[nt],K(h,C.arrays)?A=d(A,h,s,Z):K(h,C.nargs)!==!1?A=U(A,h,s,Z):B(h,Z),c=!0;break}if(F==="-"){B(N[nt],F);continue}if(/[A-Za-z]/.test(N[nt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(F)&&K(F,C.bools)===!1){B(N[nt],F),c=!0;break}if(N[nt+1]&&N[nt+1].match(/\W/)){B(N[nt],F),c=!0;break}else B(N[nt],P(N[nt]))}h=f.slice(-1)[0],!c&&h!=="-"&&(K(h,C.arrays)?A=d(A,h,s):K(h,C.nargs)!==!1?A=U(A,h,s):(F=s[A+1],F!==void 0&&(!/^(-|--)[^-]/.test(F)||F.match(T))&&!K(h,C.bools)&&!K(h,C.counts)||/^(true|false)$/.test(F)?(B(h,F),A++):B(h,P(h))))}else if(f.match(/^-[0-9]$/)&&f.match(T)&&K(f.slice(1),C.bools))h=f.slice(1),B(h,P(h));else if(f==="--"){v=s.slice(A+1);break}else if(o["halt-at-non-option"]){v=s.slice(A);break}else q(f)}V(M,!0),V(M,!1),W(M),k(),at(M,C.aliases,l,!0),ft(M),o["set-placeholder-key"]&&Ct(M),Object.keys(C.counts).forEach(function(A){st(M,A.split("."))||B(A,0)}),p&&v.length&&(M[y]=[]),v.forEach(function(A){M[y].push(A)}),o["camel-case-expansion"]&&o["strip-dashed"]&&Object.keys(M).filter(A=>A!=="--"&&A.includes("-")).forEach(A=>{delete M[A]}),o["strip-aliased"]&&[].concat(...Object.keys(r).map(A=>r[A])).forEach(A=>{o["camel-case-expansion"]&&A.includes("-")&&delete M[A.split(".").map(f=>me(f)).join(".")],delete M[A]});function q(A){const f=$("_",A);(typeof f=="string"||typeof f=="number")&&M._.push(f)}function U(A,f,u,c){let h,N=K(f,C.nargs);if(N=typeof N!="number"||isNaN(N)?1:N,N===0)return rt(c)||(g=Error(_("Argument unexpected for: %s",f))),B(f,P(f)),A;let L=rt(c)?0:1;if(o["nargs-eats-options"])u.length-(A+1)+L<N&&(g=Error(_("Not enough arguments following: %s",f))),L=N;else{for(h=A+1;h<u.length&&(!u[h].match(/^-[^0-9]/)||u[h].match(T)||b(u[h]));h++)L++;L<N&&(g=Error(_("Not enough arguments following: %s",f)))}let F=Math.min(L,N);for(!rt(c)&&F>0&&(B(f,c),F--),h=A+1;h<F+A+1;h++)B(f,u[h]);return A+F}function d(A,f,u,c){let h=[],N=c||u[A+1];const L=K(f,C.nargs);if(K(f,C.bools)&&!/^(true|false)$/.test(N))h.push(!0);else if(rt(N)||rt(c)&&/^-/.test(N)&&!T.test(N)&&!b(N)){if(l[f]!==void 0){const F=l[f];h=Array.isArray(F)?F:[F]}}else{rt(c)||h.push(R(f,c,!0));for(let F=A+1;F<u.length&&!(!o["greedy-arrays"]&&h.length>0||L&&typeof L=="number"&&h.length>=L||(N=u[F],/^-/.test(N)&&!T.test(N)&&!b(N)));F++)A=F,h.push(R(f,N,i))}return typeof L=="number"&&(L&&h.length<L||isNaN(L)&&h.length===0)&&(g=Error(_("Not enough arguments following: %s",f))),B(f,h),A}function B(A,f,u=i){if(/-/.test(A)&&o["camel-case-expansion"]){const N=A.split(".").map(function(L){return me(L)}).join(".");S(A,N)}const c=R(A,f,u),h=A.split(".");ut(M,h,c),C.aliases[A]&&C.aliases[A].forEach(function(N){const L=N.split(".");ut(M,L,c)}),h.length>1&&o["dot-notation"]&&(C.aliases[h[0]]||[]).forEach(function(N){let L=N.split(".");const F=[].concat(h);F.shift(),L=L.concat(F),(C.aliases[A]||[]).includes(L.join("."))||ut(M,L,c)}),K(A,C.normalize)&&!K(A,C.arrays)&&[A].concat(C.aliases[A]||[]).forEach(function(L){Object.defineProperty(X,L,{enumerable:!0,get(){return f},set(F){f=typeof F=="string"?qt.normalize(F):F}})})}function S(A,f){C.aliases[A]&&C.aliases[A].length||(C.aliases[A]=[f],w[f]=!0),C.aliases[f]&&C.aliases[f].length||S(f,A)}function R(A,f,u){u&&(f=ks(f)),(K(A,C.bools)||K(A,C.counts))&&typeof f=="string"&&(f=f==="true");let c=Array.isArray(f)?f.map(function(h){return $(A,h)}):$(A,f);return K(A,C.counts)&&(rt(c)||typeof c=="boolean")&&(c=He()),K(A,C.normalize)&&K(A,C.arrays)&&(Array.isArray(f)?c=f.map(h=>qt.normalize(h)):c=qt.normalize(f)),c}function $(A,f){return!o["parse-positional-numbers"]&&A==="_"||!K(A,C.strings)&&!K(A,C.bools)&&!Array.isArray(f)&&(ns(f)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${f}`)))||!rt(f)&&K(A,C.numbers))&&(f=Number(f)),f}function W(A){const f=Object.create(null);at(f,C.aliases,l),Object.keys(C.configs).forEach(function(u){const c=A[u]||f[u];if(c)try{let h=null;const N=qt.resolve(qt.cwd(),c),L=C.configs[u];if(typeof L=="function"){try{h=L(N)}catch(F){h=F}if(h instanceof Error){g=h;return}}else h=qt.require(N);G(h)}catch(h){h.name==="PermissionDenied"?g=h:A[u]&&(g=Error(_("Invalid JSON config file: %s",c)))}})}function G(A,f){Object.keys(A).forEach(function(u){const c=A[u],h=f?f+"."+u:u;typeof c=="object"&&c!==null&&!Array.isArray(c)&&o["dot-notation"]?G(c,h):(!st(M,h.split("."))||K(h,C.arrays)&&o["combine-arrays"])&&B(h,c)})}function k(){typeof E<"u"&&E.forEach(function(A){G(A)})}function V(A,f){if(typeof m>"u")return;const u=typeof m=="string"?m:"",c=qt.env();Object.keys(c).forEach(function(h){if(u===""||h.lastIndexOf(u,0)===0){const N=h.split("__").map(function(L,F){return F===0&&(L=L.substring(u.length)),me(L)});(f&&C.configs[N.join(".")]||!f)&&!st(A,N)&&B(N.join("."),c[h])}})}function ft(A){let f;const u=new Set;Object.keys(A).forEach(function(c){if(!u.has(c)&&(f=K(c,C.coercions),typeof f=="function"))try{const h=$(c,f(A[c]));[].concat(C.aliases[c]||[],c).forEach(N=>{u.add(N),A[N]=h})}catch(h){g=h}})}function Ct(A){return C.keys.forEach(f=>{~f.indexOf(".")||typeof A[f]>"u"&&(A[f]=void 0)}),A}function at(A,f,u,c=!1){Object.keys(u).forEach(function(h){st(A,h.split("."))||(ut(A,h.split("."),u[h]),c&&(D[h]=!0),(f[h]||[]).forEach(function(N){st(A,N.split("."))||ut(A,N.split("."),u[h])}))})}function st(A,f){let u=A;o["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(h){u=u[h]||{}});const c=f[f.length-1];return typeof u!="object"?!1:c in u}function ut(A,f,u){let c=A;o["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(Z){Z=Or(Z),typeof c=="object"&&c[Z]===void 0&&(c[Z]={}),typeof c[Z]!="object"||Array.isArray(c[Z])?(Array.isArray(c[Z])?c[Z].push({}):c[Z]=[c[Z],{}],c=c[Z][c[Z].length-1]):c=c[Z]});const h=Or(f[f.length-1]),N=K(f.join("."),C.arrays),L=Array.isArray(u);let F=o["duplicate-arguments-array"];!F&&K(h,C.nargs)&&(F=!0,(!rt(c[h])&&C.nargs[h]===1||Array.isArray(c[h])&&c[h].length===C.nargs[h])&&(c[h]=void 0)),u===He()?c[h]=He(c[h]):Array.isArray(c[h])?F&&N&&L?c[h]=o["flatten-duplicate-arrays"]?c[h].concat(u):(Array.isArray(c[h][0])?c[h]:[c[h]]).concat([u]):!F&&!!N==!!L?c[h]=u:c[h]=c[h].concat([u]):c[h]===void 0&&N?c[h]=L?u:[u]:F&&!(c[h]===void 0||K(h,C.counts)||K(h,C.bools))?c[h]=[c[h],u]:c[h]=u}function _t(...A){A.forEach(function(f){Object.keys(f||{}).forEach(function(u){C.aliases[u]||(C.aliases[u]=[].concat(r[u]||[]),C.aliases[u].concat(u).forEach(function(c){if(/-/.test(c)&&o["camel-case-expansion"]){const h=me(c);h!==u&&C.aliases[u].indexOf(h)===-1&&(C.aliases[u].push(h),w[h]=!0)}}),C.aliases[u].concat(u).forEach(function(c){if(c.length>1&&/[A-Z]/.test(c)&&o["camel-case-expansion"]){const h=es(c,"-");h!==u&&C.aliases[u].indexOf(h)===-1&&(C.aliases[u].push(h),w[h]=!0)}}),C.aliases[u].forEach(function(c){C.aliases[c]=[u].concat(C.aliases[u].filter(function(h){return c!==h}))}))})})}function K(A,f){const u=[].concat(C.aliases[A]||[],A),c=Object.keys(f),h=u.find(N=>c.includes(N));return h?f[h]:!1}function $t(A){const f=Object.keys(C);return[].concat(f.map(c=>C[c])).some(function(c){return Array.isArray(c)?c.includes(A):c[A]})}function Q(A,...f){return[].concat(...f).some(function(c){const h=A.match(c);return h&&$t(h[1])})}function x(A){if(A.match(T)||!A.match(/^-[^-]+/))return!1;let f=!0,u;const c=A.slice(1).split("");for(let h=0;h<c.length;h++){if(u=A.slice(h+2),!$t(c[h])){f=!1;break}if(c[h+1]&&c[h+1]==="="||u==="-"||/[A-Za-z]/.test(c[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(u)||c[h+1]&&c[h+1].match(/\W/))break}return f}function b(A){return o["unknown-options-as-args"]&&j(A)}function j(A){return A=A.replace(/^-{3,}/,"--"),A.match(T)||x(A)?!1:!Q(A,/^-+([^=]+?)=[\s\S]*$/,I,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function P(A){return!K(A,C.bools)&&!K(A,C.counts)&&`${A}`in l?l[A]:J(ot(A))}function J(A){return{[jt.BOOLEAN]:!0,[jt.STRING]:"",[jt.NUMBER]:void 0,[jt.ARRAY]:[]}[A]}function ot(A){let f=jt.BOOLEAN;return K(A,C.strings)?f=jt.STRING:K(A,C.numbers)?f=jt.NUMBER:K(A,C.bools)?f=jt.BOOLEAN:K(A,C.arrays)&&(f=jt.ARRAY),f}function rt(A){return A===void 0}function ht(){Object.keys(C.counts).find(A=>K(A,C.arrays)?(g=Error(_("Invalid configuration: %s, opts.count excludes opts.array.",A)),!0):K(A,C.nargs)?(g=Error(_("Invalid configuration: %s, opts.count excludes opts.narg.",A)),!0):!1)}return{aliases:Object.assign({},C.aliases),argv:Object.assign(X,M),configuration:o,defaulted:Object.assign({},D),error:g,newAliases:Object.assign({},w)}}}function Ys(a){const t=[],e=Object.create(null);let n=!0;for(Object.keys(a).forEach(function(s){t.push([].concat(a[s],s))});n;){n=!1;for(let s=0;s<t.length;s++)for(let i=s+1;i<t.length;i++)if(t[s].filter(function(o){return t[i].indexOf(o)!==-1}).length){t[s]=t[s].concat(t[i]),t.splice(i,1),n=!0;break}}return t.forEach(function(s){s=s.filter(function(r,o,l){return l.indexOf(r)===o});const i=s.pop();i!==void 0&&typeof i=="string"&&(e[i]=s)}),e}function He(a){return a!==void 0?a+1:1}function Or(a){return a==="__proto__"?"___proto___":a}function ks(a){return typeof a=="string"&&(a[0]==="'"||a[0]==='"')&&a[a.length-1]===a[0]?a.substring(1,a.length-1):a}/**
26
26
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
27
27
  * CJS and ESM environments.
28
28
  *
29
29
  * @license
30
30
  * Copyright (c) 2016, Contributors
31
31
  * SPDX-License-Identifier: ISC
32
- */var ze,Ge,Ye;const Cr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Ir=(Ge=(ze=process==null?void 0:process.versions)===null||ze===void 0?void 0:ze.node)!==null&&Ge!==void 0?Ge:(Ye=process==null?void 0:process.version)===null||Ye===void 0?void 0:Ye.slice(1);if(Ir&&Number(Ir.match(/^([^.]+)/)[1])<Cr)throw Error(`yargs parser supports a minimum Node.js version of ${Cr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const ks=process?process.env:{},rs=new zs({cwd:process.cwd,env:()=>ks,format:kn.format,normalize:Ot.normalize,resolve:Ot.resolve,require:a=>{if(typeof require<"u")return require(a);if(a.match(/\.json$/))return JSON.parse(Xt.readFileSync(a,"utf8"));throw Error("only .json config files are supported in ESM")}}),Ce=function(t,e){return rs.parse(t.slice(),e).argv};Ce.detailed=function(a,t){return rs.parse(a.slice(),t)};Ce.camelCase=me;Ce.decamelize=es;Ce.looksLikeNumber=ns;function is(){return Ks()?0:1}function Ks(){return Qs()&&!process.defaultApp}function Qs(){return!!process.versions.electron}function Js(a){return a.slice(is()+1)}function Zs(){return process.argv[is()]}class gt extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,gt)}}const to={fs:{readFileSync:Xt.readFileSync,writeFile:Xt.writeFile},format:kn.format,resolve:Ot.resolve,exists:a=>{try{return Xt.statSync(a).isFile()}catch{return!1}}};let Ft;class eo{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const e=t.shift();let n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ft.format.apply(Ft.format,[this.cache[this.locale][e]||e].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),s=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let r=s===1?e:n;this.cache[this.locale][e]&&(r=this.cache[this.locale][e][s===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const o=[r];return~r.indexOf("%d")&&o.push(s),Ft.format.apply(Ft.format,o.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(s,i){const r=e[i+1];n+=s,typeof r<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,e=this.writeQueue[0],n=e.directory,s=e.locale,i=e.cb,r=this._resolveLocaleFile(n,s),o=JSON.stringify(this.cache[s],null,2);Ft.fs.writeFile(r,o,"utf-8",function(l){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(l)})}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{Ft.fs.readFileSync&&(t=JSON.parse(Ft.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=Ft.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){const s=Ft.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(t){return Ft.exists(t)}}function no(a,t){Ft=t;const e=new eo(a);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}const ro=a=>no(a,to),io="require is not supported by ESM",Dr="loading a directory of commands is not supported yet for ESM";let xe;try{xe=ys.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:Ve&&Ve.tagName.toUpperCase()==="SCRIPT"&&Ve.src||new URL("run-cli-Csc9FNng.cjs",document.baseURI).href)}catch{xe=process.cwd()}const so=xe.substring(0,xe.lastIndexOf("node_modules")),oo={assert:{notStrictEqual:gr.notStrictEqual,strictEqual:gr.strictEqual},cliui:Ws,findUp:Vs,getEnv:a=>process.env[a],inspect:kn.inspect,getCallerFile:()=>{throw new gt(Dr)},getProcessArgvBin:Zs,mainFilename:so||process.cwd(),Parser:Ce,path:{basename:Ot.basename,dirname:Ot.dirname,extname:Ot.extname,relative:Ot.relative,resolve:Ot.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(a,t)=>process.emitWarning(a,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Xt.readFileSync,require:()=>{throw new gt(io)},requireDirectory:()=>{throw new gt(Dr)},stringWidth:a=>[...a].length,y18n:ro({directory:Ot.resolve(xe,"../../../locales"),updateFiles:!1})};function Bt(a,t,e,n){e.assert.notStrictEqual(a,t,n)}function Tr(a,t){t.assert.strictEqual(typeof a,"string")}function Xe(a){return Object.keys(a)}function yt(a){return!!a&&!!a.then&&typeof a.then=="function"}function be(a){const e=a.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=e.shift();if(!s)throw new Error(`No command found in: ${a}`);const i={cmd:s.replace(n,""),demanded:[],optional:[]};return e.forEach((r,o)=>{let l=!1;r=r.replace(/\s/g,""),/\.+[\]>]/.test(r)&&o===e.length-1&&(l=!0),/^\[/.test(r)?i.optional.push({cmd:r.replace(n,"").split("|"),variadic:l}):i.demanded.push({cmd:r.replace(n,"").split("|"),variadic:l})}),i}const ao=["first","second","third","fourth","fifth","sixth"];function z(a,t,e){function n(){return typeof a=="object"?[{demanded:[],optional:[]},a,t]:[be(`cmd ${a}`),t,e]}try{let s=0;const[i,r,o]=n(),l=[].slice.call(r);for(;l.length&&l[l.length-1]===void 0;)l.pop();const E=o||l.length;if(E<i.demanded.length)throw new gt(`Not enough arguments provided. Expected ${i.demanded.length} but received ${l.length}.`);const m=i.demanded.length+i.optional.length;if(E>m)throw new gt(`Too many arguments provided. Expected max ${m} but received ${E}.`);i.demanded.forEach(p=>{const y=l.shift(),w=vr(y);p.cmd.filter(_=>_===w||_==="*").length===0&&_r(w,p.cmd,s),s+=1}),i.optional.forEach(p=>{if(l.length===0)return;const y=l.shift(),w=vr(y);p.cmd.filter(_=>_===w||_==="*").length===0&&_r(w,p.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function vr(a){return Array.isArray(a)?"array":a===null?"null":typeof a}function _r(a,t,e){throw new gt(`Invalid ${ao[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${a}.`)}class uo{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,s=!1){if(z("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if(typeof t[i]!="function")throw Error("middleware must be a function");const r=t[i];r.applyBeforeValidation=e,r.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){const i=t;i.applyBeforeValidation=e,i.global=n,i.mutates=s,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{const i=[...n[e]||[],e];return s.option?!i.includes(s.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}}function co(a){return a?a.map(t=>(t.applyBeforeValidation=!1,t)):[]}function we(a,t,e,n){return e.reduce((s,i)=>{if(i.applyBeforeValidation!==n)return s;if(i.mutates){if(i.applied)return s;i.applied=!0}if(yt(s))return s.then(r=>Promise.all([r,i(r,t)])).then(([r,o])=>Object.assign(r,o));{const r=i(s,t);return yt(r)?r.then(o=>Object.assign(s,o)):Object.assign(s,r)}},a)}function Ee(a,t,e=n=>{throw n}){try{const n=lo(a)?a():a;return yt(n)?n.then(s=>t(s)):t(n)}catch(n){return e(n)}}function lo(a){return typeof a=="function"}function fo(a){if(typeof require>"u")return null;for(let t=0,e=Object.keys(require.cache),n;t<e.length;t++)if(n=require.cache[e[t]],n.exports===a)return n;return null}const oe=/(^\*)|(^\$0)/;class ho{constructor(t,e,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);const i=typeof s.visit=="function"?s.visit:r=>r;s.visit=(r,o,l)=>{const E=i(r,o,l);if(E){if(this.requireCache.has(o))return E;this.requireCache.add(o),this.addHandler(E)}return E},this.shim.requireDirectory({require:e,filename:n},t,s)}addHandler(t,e,n,s,i,r){let o=[];const l=co(i);if(s=s||(()=>{}),Array.isArray(t))if(mo(t))[t,...o]=t;else for(const E of t)this.addHandler(E);else if(yo(t)){let E=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(E=[].concat(E).concat(t.aliases)),this.addHandler(E,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Nr(n)){this.addHandler([t].concat(o),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){const E=be(t);o=o.map(y=>be(y).cmd);let m=!1;const p=[E.cmd].concat(o).filter(y=>oe.test(y)?(m=!0,!1):!0);p.length===0&&m&&p.push("$0"),m&&(E.cmd=p[0],o=p.slice(1),t=t.replace(oe,E.cmd)),o.forEach(y=>{this.aliasMap[y]=E.cmd}),e!==!1&&this.usage.command(t,e,m,o,r),this.handlers[E.cmd]={original:t,description:e,handler:s,builder:n||{},middlewares:l,deprecated:r,demanded:E.demanded,optional:E.optional},m&&(this.defaultCommand=this.handlers[E.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,s,i,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,l=e.getInternalMethods().getContext(),E=l.commands.slice(),m=!t;t&&(l.commands.push(t),l.fullCommands.push(o.original));const p=this.applyBuilderUpdateUsageAndParse(m,o,e,n.aliases,E,s,i,r);return yt(p)?p.then(y=>this.applyMiddlewareAndGetResult(m,o,y.innerArgv,l,i,y.aliases,e)):this.applyMiddlewareAndGetResult(m,o,p.innerArgv,l,i,p.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,s,i,r,o,l){const E=e.builder;let m=n;if(zn(E)){n.getInternalMethods().getUsageInstance().freeze();const p=E(n.getInternalMethods().reset(s),l);if(yt(p))return p.then(y=>(m=Lo(y)?y:n,this.parseAndUpdateUsage(t,e,m,i,r,o)))}else go(E)&&(n.getInternalMethods().getUsageInstance().freeze(),m=n.getInternalMethods().reset(s),Object.keys(e.builder).forEach(p=>{m.option(p,E[p])}));return this.parseAndUpdateUsage(t,e,m,i,r,o)}parseAndUpdateUsage(t,e,n,s,i,r){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,e),e.description);const o=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return yt(o)?o.then(l=>({aliases:n.parsed.aliases,innerArgv:l})):{aliases:n.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){const n=oe.test(e.original)?e.original.replace(oe,"").trim():e.original,s=t.filter(i=>!oe.test(i));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(t,e,n,s,i,r,o,l){if(!r.getInternalMethods().getHasOutput()){const E=r.getInternalMethods().runValidation(i,l,r.parsed.error,t);n=Ee(n,m=>(E(m),m))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const E=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(n,E,!1,!1),n=we(n,r,o,!1),n=Ee(n,m=>{const p=e.handler(m);return yt(p)?p.then(()=>m):m}),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),yt(n)&&!r.getInternalMethods().hasParseCallback()&&n.catch(m=>{try{r.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return t||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,s,i,r,o){let l={};if(i)return n;o.getInternalMethods().getHasOutput()||(l=this.populatePositionals(e,n,s,o));const E=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),m=we(n,o,E,!0);return yt(m)?m.then(p=>this.handleValidationAndGetResult(t,e,p,s,r,o,E,l)):this.handleValidationAndGetResult(t,e,m,s,r,o,E,l)}populatePositionals(t,e,n,s){e._=e._.slice(n.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const l=i.shift();this.populatePositional(l,e,o)}for(;r.length;){const l=r.shift();this.populatePositional(l,e,o)}return e._=n.commands.concat(e._.map(l=>""+l)),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),s),o}populatePositional(t,e,n){const s=t.cmd[0];t.variadic?n[s]=e._.splice(0).map(String):e._.length&&(n[s]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},n=be(t);return n.demanded.forEach(s=>{const[i,...r]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r,e.demand[i]=!0}),n.optional.forEach(s=>{const[i,...r]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r}),e}postProcessPositionals(t,e,n,s){const i=Object.assign({},s.getOptions());i.default=Object.assign(n.default,i.default);for(const E of Object.keys(n.alias))i.alias[E]=(i.alias[E]||[]).concat(n.alias[E]);i.array=i.array.concat(n.array),i.config={};const r=[];if(Object.keys(e).forEach(E=>{e[E].map(m=>{i.configuration["unknown-options-as-args"]&&(i.key[E]=!0),r.push(`--${E}`),r.push(m)})}),!r.length)return;const o=Object.assign({},i.configuration,{"populate--":!1}),l=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:o}));if(l.error)s.getInternalMethods().getUsageInstance().fail(l.error.message,l.error);else{const E=Object.keys(e);Object.keys(e).forEach(m=>{E.push(...l.aliases[m])}),Object.keys(l.argv).forEach(m=>{E.includes(m)&&(e[m]||(e[m]=l.argv[m]),!this.isInConfigs(s,m)&&!this.isDefaulted(s,m)&&Object.prototype.hasOwnProperty.call(t,m)&&Object.prototype.hasOwnProperty.call(l.argv,m)&&(Array.isArray(t[m])||Array.isArray(l.argv[m]))?t[m]=[].concat(t[m],l.argv[m]):t[m]=l.argv[m])})}}isDefaulted(t,e){const{default:n}=t.getOptions();return Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:n}=t.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,e))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const n=oe.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(zn(e))return e(t,!0);Nr(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){const e=fo(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(const s of[t,e,n]){if(typeof s=="string"||s===!1)return s;Bt(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();Bt(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function po(a,t,e,n){return new ho(a,t,e,n)}function Nr(a){return typeof a=="object"&&!!a.builder&&typeof a.handler=="function"}function mo(a){return a.every(t=>typeof t=="string")}function zn(a){return typeof a=="function"}function go(a){return typeof a=="object"}function yo(a){return typeof a=="object"&&!Array.isArray(a)}function Oe(a={},t=()=>!0){const e={};return Xe(a).forEach(n=>{t(n,a[n])&&(e[n]=a[n])}),e}function ge(a){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{const e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(a)})}function bo(a){return typeof a=="boolean"}function wo(a,t){const e=t.y18n.__,n={},s=[];n.failFn=function(R){s.push(R)};let i=null,r=null,o=!0;n.showHelpOnFail=function(R=!0,$){const[W,G]=typeof R=="string"?[!0,R]:[R,$];return a.getInternalMethods().isGlobalContext()&&(r=G),i=G,o=W,n};let l=!1;n.fail=function(R,$){const W=a.getInternalMethods().getLoggerInstance();if(s.length)for(let G=s.length-1;G>=0;--G){const k=s[G];if(bo(k)){if($)throw $;if(R)throw Error(R)}else k(R,$,n)}else{if(a.getExitProcess()&&ge(!0),!l){l=!0,o&&(a.showHelp("error"),W.error()),(R||$)&&W.error(R||$);const G=i||r;G&&((R||$)&&W.error(""),W.error(G))}if($=$||new gt(R),a.getExitProcess())return a.exit(1);if(a.getInternalMethods().hasParseCallback())return a.exit(1,$);throw $}};let E=[],m=!1;n.usage=(S,R)=>S===null?(m=!0,E=[],n):(m=!1,E.push([S,R||""]),n),n.getUsage=()=>E,n.getUsageDisabled=()=>m,n.getPositionalGroupName=()=>e("Positionals:");let p=[];n.example=(S,R)=>{p.push([S,R||""])};let y=[];n.command=function(R,$,W,G,k=!1){W&&(y=y.map(V=>(V[2]=!1,V))),y.push([R,$||"",W,G,k])},n.getCommands=()=>y;let w={};n.describe=function(R,$){Array.isArray(R)?R.forEach(W=>{n.describe(W,$)}):typeof R=="object"?Object.keys(R).forEach(W=>{n.describe(W,R[W])}):w[R]=$},n.getDescriptions=()=>w;let D=[];n.epilog=S=>{D.push(S)};let _=!1,C;n.wrap=S=>{_=!0,C=S},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(_||(C=U(),_=!0),C);const T="__yargsString__:";n.deferY18nLookup=S=>T+S,n.help=function(){if(v)return v;g();const R=a.customScriptName?a.$0:t.path.basename(a.$0),$=a.getDemandedOptions(),W=a.getDemandedCommands(),G=a.getDeprecatedOptions(),k=a.getGroups(),V=a.getOptions();let ft=[];ft=ft.concat(Object.keys(w)),ft=ft.concat(Object.keys($)),ft=ft.concat(Object.keys(W)),ft=ft.concat(Object.keys(V.default)),ft=ft.filter(X),ft=Object.keys(ft.reduce((Q,x)=>(x!=="_"&&(Q[x]=!0),Q),{}));const Ct=n.getWrap(),at=t.cliui({width:Ct,wrap:!!Ct});if(!m){if(E.length)E.forEach(Q=>{at.div({text:`${Q[0].replace(/\$0/g,R)}`}),Q[1]&&at.div({text:`${Q[1]}`,padding:[1,0,0,0]})}),at.div();else if(y.length){let Q=null;W._?Q=`${R} <${e("command")}>
32
+ */var ze,Ge,Ye;const Cr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Ir=(Ge=(ze=process==null?void 0:process.versions)===null||ze===void 0?void 0:ze.node)!==null&&Ge!==void 0?Ge:(Ye=process==null?void 0:process.version)===null||Ye===void 0?void 0:Ye.slice(1);if(Ir&&Number(Ir.match(/^([^.]+)/)[1])<Cr)throw Error(`yargs parser supports a minimum Node.js version of ${Cr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Ks=process?process.env:{},rs=new Gs({cwd:process.cwd,env:()=>Ks,format:kn.format,normalize:Ot.normalize,resolve:Ot.resolve,require:a=>{if(typeof require<"u")return require(a);if(a.match(/\.json$/))return JSON.parse(Xt.readFileSync(a,"utf8"));throw Error("only .json config files are supported in ESM")}}),Ce=function(t,e){return rs.parse(t.slice(),e).argv};Ce.detailed=function(a,t){return rs.parse(a.slice(),t)};Ce.camelCase=me;Ce.decamelize=es;Ce.looksLikeNumber=ns;function is(){return Qs()?0:1}function Qs(){return Js()&&!process.defaultApp}function Js(){return!!process.versions.electron}function Zs(a){return a.slice(is()+1)}function to(){return process.argv[is()]}class gt extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,gt)}}const eo={fs:{readFileSync:Xt.readFileSync,writeFile:Xt.writeFile},format:kn.format,resolve:Ot.resolve,exists:a=>{try{return Xt.statSync(a).isFile()}catch{return!1}}};let Ft;class no{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const e=t.shift();let n=function(){};return typeof t[t.length-1]=="function"&&(n=t.pop()),n=n||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]=e,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),Ft.format.apply(Ft.format,[this.cache[this.locale][e]||e].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),s=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let r=s===1?e:n;this.cache[this.locale][e]&&(r=this.cache[this.locale][e][s===1?"one":"other"]),!this.cache[this.locale][e]&&this.updateFiles?(this.cache[this.locale][e]={one:e,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const o=[r];return~r.indexOf("%d")&&o.push(s),Ft.format.apply(Ft.format,o.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(this.cache[this.locale][e]=t[e])}_taggedLiteral(t,...e){let n="";return t.forEach(function(s,i){const r=e[i+1];n+=s,typeof r<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(e,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,e=this.writeQueue[0],n=e.directory,s=e.locale,i=e.cb,r=this._resolveLocaleFile(n,s),o=JSON.stringify(this.cache[s],null,2);Ft.fs.writeFile(r,o,"utf-8",function(l){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(l)})}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{Ft.fs.readFileSync&&(t=JSON.parse(Ft.fs.readFileSync(e,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+e),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,e){let n=Ft.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){const s=Ft.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(t){return Ft.exists(t)}}function ro(a,t){Ft=t;const e=new no(a);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}const io=a=>ro(a,eo),so="require is not supported by ESM",Dr="loading a directory of commands is not supported yet for ESM";let xe;try{xe=ys.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:Ve&&Ve.tagName.toUpperCase()==="SCRIPT"&&Ve.src||new URL("run-cli-Bk1CbeEI.cjs",document.baseURI).href)}catch{xe=process.cwd()}const oo=xe.substring(0,xe.lastIndexOf("node_modules")),ao={assert:{notStrictEqual:gr.notStrictEqual,strictEqual:gr.strictEqual},cliui:Vs,findUp:Hs,getEnv:a=>process.env[a],inspect:kn.inspect,getCallerFile:()=>{throw new gt(Dr)},getProcessArgvBin:to,mainFilename:oo||process.cwd(),Parser:Ce,path:{basename:Ot.basename,dirname:Ot.dirname,extname:Ot.extname,relative:Ot.relative,resolve:Ot.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(a,t)=>process.emitWarning(a,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Xt.readFileSync,require:()=>{throw new gt(so)},requireDirectory:()=>{throw new gt(Dr)},stringWidth:a=>[...a].length,y18n:io({directory:Ot.resolve(xe,"../../../locales"),updateFiles:!1})};function Bt(a,t,e,n){e.assert.notStrictEqual(a,t,n)}function Tr(a,t){t.assert.strictEqual(typeof a,"string")}function Xe(a){return Object.keys(a)}function yt(a){return!!a&&!!a.then&&typeof a.then=="function"}function be(a){const e=a.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=e.shift();if(!s)throw new Error(`No command found in: ${a}`);const i={cmd:s.replace(n,""),demanded:[],optional:[]};return e.forEach((r,o)=>{let l=!1;r=r.replace(/\s/g,""),/\.+[\]>]/.test(r)&&o===e.length-1&&(l=!0),/^\[/.test(r)?i.optional.push({cmd:r.replace(n,"").split("|"),variadic:l}):i.demanded.push({cmd:r.replace(n,"").split("|"),variadic:l})}),i}const uo=["first","second","third","fourth","fifth","sixth"];function z(a,t,e){function n(){return typeof a=="object"?[{demanded:[],optional:[]},a,t]:[be(`cmd ${a}`),t,e]}try{let s=0;const[i,r,o]=n(),l=[].slice.call(r);for(;l.length&&l[l.length-1]===void 0;)l.pop();const E=o||l.length;if(E<i.demanded.length)throw new gt(`Not enough arguments provided. Expected ${i.demanded.length} but received ${l.length}.`);const m=i.demanded.length+i.optional.length;if(E>m)throw new gt(`Too many arguments provided. Expected max ${m} but received ${E}.`);i.demanded.forEach(p=>{const y=l.shift(),w=vr(y);p.cmd.filter(_=>_===w||_==="*").length===0&&_r(w,p.cmd,s),s+=1}),i.optional.forEach(p=>{if(l.length===0)return;const y=l.shift(),w=vr(y);p.cmd.filter(_=>_===w||_==="*").length===0&&_r(w,p.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function vr(a){return Array.isArray(a)?"array":a===null?"null":typeof a}function _r(a,t,e){throw new gt(`Invalid ${uo[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${a}.`)}class co{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,s=!1){if(z("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if(typeof t[i]!="function")throw Error("middleware must be a function");const r=t[i];r.applyBeforeValidation=e,r.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){const i=t;i.applyBeforeValidation=e,i.global=n,i.mutates=s,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(s=>{const i=[...n[e]||[],e];return s.option?!i.includes(s.option):!0}),t.option=e,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();t!==void 0&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter(t=>t.global)}}function lo(a){return a?a.map(t=>(t.applyBeforeValidation=!1,t)):[]}function we(a,t,e,n){return e.reduce((s,i)=>{if(i.applyBeforeValidation!==n)return s;if(i.mutates){if(i.applied)return s;i.applied=!0}if(yt(s))return s.then(r=>Promise.all([r,i(r,t)])).then(([r,o])=>Object.assign(r,o));{const r=i(s,t);return yt(r)?r.then(o=>Object.assign(s,o)):Object.assign(s,r)}},a)}function Ee(a,t,e=n=>{throw n}){try{const n=fo(a)?a():a;return yt(n)?n.then(s=>t(s)):t(n)}catch(n){return e(n)}}function fo(a){return typeof a=="function"}function ho(a){if(typeof require>"u")return null;for(let t=0,e=Object.keys(require.cache),n;t<e.length;t++)if(n=require.cache[e[t]],n.exports===a)return n;return null}const oe=/(^\*)|(^\$0)/;class po{constructor(t,e,n,s){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=s,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,s){s=s||{},typeof s.recurse!="boolean"&&(s.recurse=!1),Array.isArray(s.extensions)||(s.extensions=["js"]);const i=typeof s.visit=="function"?s.visit:r=>r;s.visit=(r,o,l)=>{const E=i(r,o,l);if(E){if(this.requireCache.has(o))return E;this.requireCache.add(o),this.addHandler(E)}return E},this.shim.requireDirectory({require:e,filename:n},t,s)}addHandler(t,e,n,s,i,r){let o=[];const l=lo(i);if(s=s||(()=>{}),Array.isArray(t))if(go(t))[t,...o]=t;else for(const E of t)this.addHandler(E);else if(bo(t)){let E=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(E=[].concat(E).concat(t.aliases)),this.addHandler(E,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Nr(n)){this.addHandler([t].concat(o),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){const E=be(t);o=o.map(y=>be(y).cmd);let m=!1;const p=[E.cmd].concat(o).filter(y=>oe.test(y)?(m=!0,!1):!0);p.length===0&&m&&p.push("$0"),m&&(E.cmd=p[0],o=p.slice(1),t=t.replace(oe,E.cmd)),o.forEach(y=>{this.aliasMap[y]=E.cmd}),e!==!1&&this.usage.command(t,e,m,o,r),this.handlers[E.cmd]={original:t,description:e,handler:s,builder:n||{},middlewares:l,deprecated:r,demanded:E.demanded,optional:E.optional},m&&(this.defaultCommand=this.handlers[E.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,s,i,r){const o=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,l=e.getInternalMethods().getContext(),E=l.commands.slice(),m=!t;t&&(l.commands.push(t),l.fullCommands.push(o.original));const p=this.applyBuilderUpdateUsageAndParse(m,o,e,n.aliases,E,s,i,r);return yt(p)?p.then(y=>this.applyMiddlewareAndGetResult(m,o,y.innerArgv,l,i,y.aliases,e)):this.applyMiddlewareAndGetResult(m,o,p.innerArgv,l,i,p.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,s,i,r,o,l){const E=e.builder;let m=n;if(zn(E)){n.getInternalMethods().getUsageInstance().freeze();const p=E(n.getInternalMethods().reset(s),l);if(yt(p))return p.then(y=>(m=So(y)?y:n,this.parseAndUpdateUsage(t,e,m,i,r,o)))}else yo(E)&&(n.getInternalMethods().getUsageInstance().freeze(),m=n.getInternalMethods().reset(s),Object.keys(e.builder).forEach(p=>{m.option(p,E[p])}));return this.parseAndUpdateUsage(t,e,m,i,r,o)}parseAndUpdateUsage(t,e,n,s,i,r){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(s,e),e.description);const o=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return yt(o)?o.then(l=>({aliases:n.parsed.aliases,innerArgv:l})):{aliases:n.parsed.aliases,innerArgv:o}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){const n=oe.test(e.original)?e.original.replace(oe,"").trim():e.original,s=t.filter(i=>!oe.test(i));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(t,e,n,s,i,r,o,l){if(!r.getInternalMethods().getHasOutput()){const E=r.getInternalMethods().runValidation(i,l,r.parsed.error,t);n=Ee(n,m=>(E(m),m))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const E=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(n,E,!1,!1),n=we(n,r,o,!1),n=Ee(n,m=>{const p=e.handler(m);return yt(p)?p.then(()=>m):m}),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),yt(n)&&!r.getInternalMethods().hasParseCallback()&&n.catch(m=>{try{r.getInternalMethods().getUsageInstance().fail(null,m)}catch{}})}return t||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,s,i,r,o){let l={};if(i)return n;o.getInternalMethods().getHasOutput()||(l=this.populatePositionals(e,n,s,o));const E=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),m=we(n,o,E,!0);return yt(m)?m.then(p=>this.handleValidationAndGetResult(t,e,p,s,r,o,E,l)):this.handleValidationAndGetResult(t,e,m,s,r,o,E,l)}populatePositionals(t,e,n,s){e._=e._.slice(n.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),o={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const l=i.shift();this.populatePositional(l,e,o)}for(;r.length;){const l=r.shift();this.populatePositional(l,e,o)}return e._=n.commands.concat(e._.map(l=>""+l)),this.postProcessPositionals(e,o,this.cmdToParseOptions(t.original),s),o}populatePositional(t,e,n){const s=t.cmd[0];t.variadic?n[s]=e._.splice(0).map(String):e._.length&&(n[s]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},n=be(t);return n.demanded.forEach(s=>{const[i,...r]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r,e.demand[i]=!0}),n.optional.forEach(s=>{const[i,...r]=s.cmd;s.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r}),e}postProcessPositionals(t,e,n,s){const i=Object.assign({},s.getOptions());i.default=Object.assign(n.default,i.default);for(const E of Object.keys(n.alias))i.alias[E]=(i.alias[E]||[]).concat(n.alias[E]);i.array=i.array.concat(n.array),i.config={};const r=[];if(Object.keys(e).forEach(E=>{e[E].map(m=>{i.configuration["unknown-options-as-args"]&&(i.key[E]=!0),r.push(`--${E}`),r.push(m)})}),!r.length)return;const o=Object.assign({},i.configuration,{"populate--":!1}),l=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:o}));if(l.error)s.getInternalMethods().getUsageInstance().fail(l.error.message,l.error);else{const E=Object.keys(e);Object.keys(e).forEach(m=>{E.push(...l.aliases[m])}),Object.keys(l.argv).forEach(m=>{E.includes(m)&&(e[m]||(e[m]=l.argv[m]),!this.isInConfigs(s,m)&&!this.isDefaulted(s,m)&&Object.prototype.hasOwnProperty.call(t,m)&&Object.prototype.hasOwnProperty.call(l.argv,m)&&(Array.isArray(t[m])||Array.isArray(l.argv[m]))?t[m]=[].concat(t[m],l.argv[m]):t[m]=l.argv[m])})}}isDefaulted(t,e){const{default:n}=t.getOptions();return Object.prototype.hasOwnProperty.call(n,e)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(e))}isInConfigs(t,e){const{configObjects:n}=t.getOptions();return n.some(s=>Object.prototype.hasOwnProperty.call(s,e))||n.some(s=>Object.prototype.hasOwnProperty.call(s,this.shim.Parser.camelCase(e)))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const n=oe.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}const e=this.defaultCommand.builder;if(zn(e))return e(t,!0);Nr(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){const e=ho(t);if(!e)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(e.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:e,desc:n}){for(const s of[t,e,n]){if(typeof s=="string"||s===!1)return s;Bt(s,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();Bt(t,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function mo(a,t,e,n){return new po(a,t,e,n)}function Nr(a){return typeof a=="object"&&!!a.builder&&typeof a.handler=="function"}function go(a){return a.every(t=>typeof t=="string")}function zn(a){return typeof a=="function"}function yo(a){return typeof a=="object"}function bo(a){return typeof a=="object"&&!Array.isArray(a)}function Oe(a={},t=()=>!0){const e={};return Xe(a).forEach(n=>{t(n,a[n])&&(e[n]=a[n])}),e}function ge(a){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{const e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(a)})}function wo(a){return typeof a=="boolean"}function Eo(a,t){const e=t.y18n.__,n={},s=[];n.failFn=function(R){s.push(R)};let i=null,r=null,o=!0;n.showHelpOnFail=function(R=!0,$){const[W,G]=typeof R=="string"?[!0,R]:[R,$];return a.getInternalMethods().isGlobalContext()&&(r=G),i=G,o=W,n};let l=!1;n.fail=function(R,$){const W=a.getInternalMethods().getLoggerInstance();if(s.length)for(let G=s.length-1;G>=0;--G){const k=s[G];if(wo(k)){if($)throw $;if(R)throw Error(R)}else k(R,$,n)}else{if(a.getExitProcess()&&ge(!0),!l){l=!0,o&&(a.showHelp("error"),W.error()),(R||$)&&W.error(R||$);const G=i||r;G&&((R||$)&&W.error(""),W.error(G))}if($=$||new gt(R),a.getExitProcess())return a.exit(1);if(a.getInternalMethods().hasParseCallback())return a.exit(1,$);throw $}};let E=[],m=!1;n.usage=(S,R)=>S===null?(m=!0,E=[],n):(m=!1,E.push([S,R||""]),n),n.getUsage=()=>E,n.getUsageDisabled=()=>m,n.getPositionalGroupName=()=>e("Positionals:");let p=[];n.example=(S,R)=>{p.push([S,R||""])};let y=[];n.command=function(R,$,W,G,k=!1){W&&(y=y.map(V=>(V[2]=!1,V))),y.push([R,$||"",W,G,k])},n.getCommands=()=>y;let w={};n.describe=function(R,$){Array.isArray(R)?R.forEach(W=>{n.describe(W,$)}):typeof R=="object"?Object.keys(R).forEach(W=>{n.describe(W,R[W])}):w[R]=$},n.getDescriptions=()=>w;let D=[];n.epilog=S=>{D.push(S)};let _=!1,C;n.wrap=S=>{_=!0,C=S},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(_||(C=U(),_=!0),C);const T="__yargsString__:";n.deferY18nLookup=S=>T+S,n.help=function(){if(v)return v;g();const R=a.customScriptName?a.$0:t.path.basename(a.$0),$=a.getDemandedOptions(),W=a.getDemandedCommands(),G=a.getDeprecatedOptions(),k=a.getGroups(),V=a.getOptions();let ft=[];ft=ft.concat(Object.keys(w)),ft=ft.concat(Object.keys($)),ft=ft.concat(Object.keys(W)),ft=ft.concat(Object.keys(V.default)),ft=ft.filter(X),ft=Object.keys(ft.reduce((Q,x)=>(x!=="_"&&(Q[x]=!0),Q),{}));const Ct=n.getWrap(),at=t.cliui({width:Ct,wrap:!!Ct});if(!m){if(E.length)E.forEach(Q=>{at.div({text:`${Q[0].replace(/\$0/g,R)}`}),Q[1]&&at.div({text:`${Q[1]}`,padding:[1,0,0,0]})}),at.div();else if(y.length){let Q=null;W._?Q=`${R} <${e("command")}>
33
33
  `:Q=`${R} [${e("command")}]
34
- `,at.div(`${Q}`)}}if(y.length>1||y.length===1&&!y[0][2]){at.div(e("Commands:"));const Q=a.getInternalMethods().getContext(),x=Q.commands.length?`${Q.commands.join(" ")} `:"";a.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(y=y.sort((j,P)=>j[0].localeCompare(P[0])));const b=R?`${R} `:"";y.forEach(j=>{const P=`${b}${x}${j[0].replace(/^\$0 ?/,"")}`;at.span({text:P,padding:[0,2,0,2],width:I(y,Ct,`${R}${x}`)+4},{text:j[1]});const J=[];j[2]&&J.push(`[${e("default")}]`),j[3]&&j[3].length&&J.push(`[${e("aliases:")} ${j[3].join(", ")}]`),j[4]&&(typeof j[4]=="string"?J.push(`[${e("deprecated: %s",j[4])}]`):J.push(`[${e("deprecated")}]`)),J.length?at.div({text:J.join(" "),padding:[0,0,0,2],align:"right"}):at.div()}),at.div()}const st=(Object.keys(V.alias)||[]).concat(Object.keys(a.parsed.newAliases)||[]);ft=ft.filter(Q=>!a.parsed.newAliases[Q]&&st.every(x=>(V.alias[x]||[]).indexOf(Q)===-1));const ut=e("Options:");k[ut]||(k[ut]=[]),M(ft,V.alias,k,ut);const _t=Q=>/^--/.test(De(Q)),K=Object.keys(k).filter(Q=>k[Q].length>0).map(Q=>{const x=k[Q].filter(X).map(b=>{if(st.includes(b))return b;for(let j=0,P;(P=st[j])!==void 0;j++)if((V.alias[P]||[]).includes(b))return P;return b});return{groupName:Q,normalizedKeys:x}}).filter(({normalizedKeys:Q})=>Q.length>0).map(({groupName:Q,normalizedKeys:x})=>{const b=x.reduce((j,P)=>(j[P]=[P].concat(V.alias[P]||[]).map(J=>Q===n.getPositionalGroupName()?J:(/^[0-9]$/.test(J)?V.boolean.includes(P)?"-":"--":J.length>1?"--":"-")+J).sort((J,ot)=>_t(J)===_t(ot)?0:_t(J)?1:-1).join(", "),j),{});return{groupName:Q,normalizedKeys:x,switches:b}});if(K.filter(({groupName:Q})=>Q!==n.getPositionalGroupName()).some(({normalizedKeys:Q,switches:x})=>!Q.every(b=>_t(x[b])))&&K.filter(({groupName:Q})=>Q!==n.getPositionalGroupName()).forEach(({normalizedKeys:Q,switches:x})=>{Q.forEach(b=>{_t(x[b])&&(x[b]=Eo(x[b],4))})}),K.forEach(({groupName:Q,normalizedKeys:x,switches:b})=>{at.div(Q),x.forEach(j=>{const P=b[j];let J=w[j]||"",ot=null;J.includes(T)&&(J=e(J.substring(T.length))),V.boolean.includes(j)&&(ot=`[${e("boolean")}]`),V.count.includes(j)&&(ot=`[${e("count")}]`),V.string.includes(j)&&(ot=`[${e("string")}]`),V.normalize.includes(j)&&(ot=`[${e("string")}]`),V.array.includes(j)&&(ot=`[${e("array")}]`),V.number.includes(j)&&(ot=`[${e("number")}]`);const rt=f=>typeof f=="string"?`[${e("deprecated: %s",f)}]`:`[${e("deprecated")}]`,ht=[j in G?rt(G[j]):null,ot,j in $?`[${e("required")}]`:null,V.choices&&V.choices[j]?`[${e("choices:")} ${n.stringifiedValues(V.choices[j])}]`:null,q(V.default[j],V.defaultDescription[j])].filter(Boolean).join(" ");at.span({text:De(P),padding:[0,2,0,2+Ar(P)],width:I(b,Ct)+4},J);const A=a.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;ht&&!A?at.div({text:ht,padding:[0,0,0,2],align:"right"}):at.div()}),at.div()}),p.length&&(at.div(e("Examples:")),p.forEach(Q=>{Q[0]=Q[0].replace(/\$0/g,R)}),p.forEach(Q=>{Q[1]===""?at.div({text:Q[0],padding:[0,2,0,2]}):at.div({text:Q[0],padding:[0,2,0,2],width:I(p,Ct)+4},{text:Q[1]})}),at.div()),D.length>0){const Q=D.map(x=>x.replace(/\$0/g,R)).join(`
34
+ `,at.div(`${Q}`)}}if(y.length>1||y.length===1&&!y[0][2]){at.div(e("Commands:"));const Q=a.getInternalMethods().getContext(),x=Q.commands.length?`${Q.commands.join(" ")} `:"";a.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(y=y.sort((j,P)=>j[0].localeCompare(P[0])));const b=R?`${R} `:"";y.forEach(j=>{const P=`${b}${x}${j[0].replace(/^\$0 ?/,"")}`;at.span({text:P,padding:[0,2,0,2],width:I(y,Ct,`${R}${x}`)+4},{text:j[1]});const J=[];j[2]&&J.push(`[${e("default")}]`),j[3]&&j[3].length&&J.push(`[${e("aliases:")} ${j[3].join(", ")}]`),j[4]&&(typeof j[4]=="string"?J.push(`[${e("deprecated: %s",j[4])}]`):J.push(`[${e("deprecated")}]`)),J.length?at.div({text:J.join(" "),padding:[0,0,0,2],align:"right"}):at.div()}),at.div()}const st=(Object.keys(V.alias)||[]).concat(Object.keys(a.parsed.newAliases)||[]);ft=ft.filter(Q=>!a.parsed.newAliases[Q]&&st.every(x=>(V.alias[x]||[]).indexOf(Q)===-1));const ut=e("Options:");k[ut]||(k[ut]=[]),M(ft,V.alias,k,ut);const _t=Q=>/^--/.test(De(Q)),K=Object.keys(k).filter(Q=>k[Q].length>0).map(Q=>{const x=k[Q].filter(X).map(b=>{if(st.includes(b))return b;for(let j=0,P;(P=st[j])!==void 0;j++)if((V.alias[P]||[]).includes(b))return P;return b});return{groupName:Q,normalizedKeys:x}}).filter(({normalizedKeys:Q})=>Q.length>0).map(({groupName:Q,normalizedKeys:x})=>{const b=x.reduce((j,P)=>(j[P]=[P].concat(V.alias[P]||[]).map(J=>Q===n.getPositionalGroupName()?J:(/^[0-9]$/.test(J)?V.boolean.includes(P)?"-":"--":J.length>1?"--":"-")+J).sort((J,ot)=>_t(J)===_t(ot)?0:_t(J)?1:-1).join(", "),j),{});return{groupName:Q,normalizedKeys:x,switches:b}});if(K.filter(({groupName:Q})=>Q!==n.getPositionalGroupName()).some(({normalizedKeys:Q,switches:x})=>!Q.every(b=>_t(x[b])))&&K.filter(({groupName:Q})=>Q!==n.getPositionalGroupName()).forEach(({normalizedKeys:Q,switches:x})=>{Q.forEach(b=>{_t(x[b])&&(x[b]=xo(x[b],4))})}),K.forEach(({groupName:Q,normalizedKeys:x,switches:b})=>{at.div(Q),x.forEach(j=>{const P=b[j];let J=w[j]||"",ot=null;J.includes(T)&&(J=e(J.substring(T.length))),V.boolean.includes(j)&&(ot=`[${e("boolean")}]`),V.count.includes(j)&&(ot=`[${e("count")}]`),V.string.includes(j)&&(ot=`[${e("string")}]`),V.normalize.includes(j)&&(ot=`[${e("string")}]`),V.array.includes(j)&&(ot=`[${e("array")}]`),V.number.includes(j)&&(ot=`[${e("number")}]`);const rt=f=>typeof f=="string"?`[${e("deprecated: %s",f)}]`:`[${e("deprecated")}]`,ht=[j in G?rt(G[j]):null,ot,j in $?`[${e("required")}]`:null,V.choices&&V.choices[j]?`[${e("choices:")} ${n.stringifiedValues(V.choices[j])}]`:null,q(V.default[j],V.defaultDescription[j])].filter(Boolean).join(" ");at.span({text:De(P),padding:[0,2,0,2+Ar(P)],width:I(b,Ct)+4},J);const A=a.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;ht&&!A?at.div({text:ht,padding:[0,0,0,2],align:"right"}):at.div()}),at.div()}),p.length&&(at.div(e("Examples:")),p.forEach(Q=>{Q[0]=Q[0].replace(/\$0/g,R)}),p.forEach(Q=>{Q[1]===""?at.div({text:Q[0],padding:[0,2,0,2]}):at.div({text:Q[0],padding:[0,2,0,2],width:I(p,Ct)+4},{text:Q[1]})}),at.div()),D.length>0){const Q=D.map(x=>x.replace(/\$0/g,R)).join(`
35
35
  `);at.div(`${Q}
36
- `)}return at.toString().replace(/\s*$/,"")};function I(S,R,$){let W=0;return Array.isArray(S)||(S=Object.values(S).map(G=>[G])),S.forEach(G=>{W=Math.max(t.stringWidth($?`${$} ${De(G[0])}`:De(G[0]))+Ar(G[0]),W)}),R&&(W=Math.min(W,parseInt((R*.5).toString(),10))),W}function g(){const S=a.getDemandedOptions(),R=a.getOptions();(Object.keys(R.alias)||[]).forEach($=>{R.alias[$].forEach(W=>{w[W]&&n.describe($,w[W]),W in S&&a.demandOption($,S[W]),R.boolean.includes(W)&&a.boolean($),R.count.includes(W)&&a.count($),R.string.includes(W)&&a.string($),R.normalize.includes(W)&&a.normalize($),R.array.includes(W)&&a.array($),R.number.includes(W)&&a.number($)})})}let v;n.cacheHelpMessage=function(){v=this.help()},n.clearCachedHelpMessage=function(){v=void 0},n.hasCachedHelpMessage=function(){return!!v};function M(S,R,$,W){let G=[],k=null;return Object.keys($).forEach(V=>{G=G.concat($[V])}),S.forEach(V=>{k=[V].concat(R[V]),k.some(ft=>G.indexOf(ft)!==-1)||$[W].push(V)}),G}function X(S){return a.getOptions().hiddenOptions.indexOf(S)<0||a.parsed.argv[a.getOptions().showHiddenOpt]}n.showHelp=S=>{const R=a.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:R[S])(n.help())},n.functionDescription=S=>["(",S.name?t.Parser.decamelize(S.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(R,$){let W="";const G=$||", ",k=[].concat(R);return!R||!k.length||k.forEach(V=>{W.length&&(W+=G),W+=JSON.stringify(V)}),W};function q(S,R){let $=`[${e("default:")} `;if(S===void 0&&!R)return null;if(R)$+=R;else switch(typeof S){case"string":$+=`"${S}"`;break;case"object":$+=JSON.stringify(S);break;default:$+=S}return`${$}]`}function U(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let d=null;n.version=S=>{d=S},n.showVersion=S=>{const R=a.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:R[S])(d)},n.reset=function(R){return i=null,l=!1,E=[],m=!1,D=[],p=[],y=[],w=Oe(w,$=>!R[$]),n};const B=[];return n.freeze=function(){B.push({failMessage:i,failureOutput:l,usages:E,usageDisabled:m,epilogs:D,examples:p,commands:y,descriptions:w})},n.unfreeze=function(R=!1){const $=B.pop();$&&(R?(w={...$.descriptions,...w},y=[...$.commands,...y],E=[...$.usages,...E],p=[...$.examples,...p],D=[...$.epilogs,...D]):{failMessage:i,failureOutput:l,usages:E,usageDisabled:m,epilogs:D,examples:p,commands:y,descriptions:w}=$)},n}function Jn(a){return typeof a=="object"}function Eo(a,t){return Jn(a)?{text:a.text,indentation:a.indentation+t}:{text:a,indentation:t}}function Ar(a){return Jn(a)?a.indentation:0}function De(a){return Jn(a)?a.text:a}const xo=`###-begin-{{app_name}}-completions-###
36
+ `)}return at.toString().replace(/\s*$/,"")};function I(S,R,$){let W=0;return Array.isArray(S)||(S=Object.values(S).map(G=>[G])),S.forEach(G=>{W=Math.max(t.stringWidth($?`${$} ${De(G[0])}`:De(G[0]))+Ar(G[0]),W)}),R&&(W=Math.min(W,parseInt((R*.5).toString(),10))),W}function g(){const S=a.getDemandedOptions(),R=a.getOptions();(Object.keys(R.alias)||[]).forEach($=>{R.alias[$].forEach(W=>{w[W]&&n.describe($,w[W]),W in S&&a.demandOption($,S[W]),R.boolean.includes(W)&&a.boolean($),R.count.includes(W)&&a.count($),R.string.includes(W)&&a.string($),R.normalize.includes(W)&&a.normalize($),R.array.includes(W)&&a.array($),R.number.includes(W)&&a.number($)})})}let v;n.cacheHelpMessage=function(){v=this.help()},n.clearCachedHelpMessage=function(){v=void 0},n.hasCachedHelpMessage=function(){return!!v};function M(S,R,$,W){let G=[],k=null;return Object.keys($).forEach(V=>{G=G.concat($[V])}),S.forEach(V=>{k=[V].concat(R[V]),k.some(ft=>G.indexOf(ft)!==-1)||$[W].push(V)}),G}function X(S){return a.getOptions().hiddenOptions.indexOf(S)<0||a.parsed.argv[a.getOptions().showHiddenOpt]}n.showHelp=S=>{const R=a.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:R[S])(n.help())},n.functionDescription=S=>["(",S.name?t.Parser.decamelize(S.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(R,$){let W="";const G=$||", ",k=[].concat(R);return!R||!k.length||k.forEach(V=>{W.length&&(W+=G),W+=JSON.stringify(V)}),W};function q(S,R){let $=`[${e("default:")} `;if(S===void 0&&!R)return null;if(R)$+=R;else switch(typeof S){case"string":$+=`"${S}"`;break;case"object":$+=JSON.stringify(S);break;default:$+=S}return`${$}]`}function U(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let d=null;n.version=S=>{d=S},n.showVersion=S=>{const R=a.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:R[S])(d)},n.reset=function(R){return i=null,l=!1,E=[],m=!1,D=[],p=[],y=[],w=Oe(w,$=>!R[$]),n};const B=[];return n.freeze=function(){B.push({failMessage:i,failureOutput:l,usages:E,usageDisabled:m,epilogs:D,examples:p,commands:y,descriptions:w})},n.unfreeze=function(R=!1){const $=B.pop();$&&(R?(w={...$.descriptions,...w},y=[...$.commands,...y],E=[...$.usages,...E],p=[...$.examples,...p],D=[...$.epilogs,...D]):{failMessage:i,failureOutput:l,usages:E,usageDisabled:m,epilogs:D,examples:p,commands:y,descriptions:w}=$)},n}function Jn(a){return typeof a=="object"}function xo(a,t){return Jn(a)?{text:a.text,indentation:a.indentation+t}:{text:a,indentation:t}}function Ar(a){return Jn(a)?a.indentation:0}function De(a){return Jn(a)?a.text:a}const Oo=`###-begin-{{app_name}}-completions-###
37
37
  #
38
38
  # yargs command completion script
39
39
  #
@@ -61,7 +61,7 @@ _{{app_name}}_yargs_completions()
61
61
  }
62
62
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
63
63
  ###-end-{{app_name}}-completions-###
64
- `,Oo=`#compdef {{app_name}}
64
+ `,Co=`#compdef {{app_name}}
65
65
  ###-begin-{{app_name}}-completions-###
66
66
  #
67
67
  # yargs command completion script
@@ -80,14 +80,14 @@ _{{app_name}}_yargs_completions()
80
80
  }
81
81
  compdef _{{app_name}}_yargs_completions {{app_name}}
82
82
  ###-end-{{app_name}}-completions-###
83
- `;class Co{constructor(t,e,n,s){var i,r,o;this.yargs=t,this.usage=e,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(o=((i=this.shim.getEnv("SHELL"))===null||i===void 0?void 0:i.includes("zsh"))||((r=this.shim.getEnv("ZSH_NAME"))===null||r===void 0?void 0:r.includes("zsh")))!==null&&o!==void 0?o:!1}defaultCompletion(t,e,n,s){const i=this.command.getCommandHandlers();for(let o=0,l=t.length;o<l;++o)if(i[t[o]]&&i[t[o]].builder){const E=i[t[o]].builder;if(zn(E)){this.indexAfterLastReset=o+1;const m=this.yargs.getInternalMethods().reset();return E(m,!0),m.argv}}const r=[];this.commandCompletions(r,t,n),this.optionCompletions(r,t,e,n),this.choicesFromOptionsCompletions(r,t,e,n),this.choicesFromPositionalsCompletions(r,t,e,n),s(null,r)}commandCompletions(t,e,n){const s=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&s[s.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(i=>{const r=be(i[0]).cmd;if(e.indexOf(r)===-1)if(!this.zshShell)t.push(r);else{const o=i[1]||"";t.push(r.replace(/:/g,"\\:")+":"+o)}})}optionCompletions(t,e,n,s){if((s.match(/^-/)||s===""&&t.length===0)&&!this.previousArgHasChoices(e)){const i=this.yargs.getOptions(),r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach(o=>{const l=!!i.configuration["boolean-negation"]&&i.boolean.includes(o);!r.includes(o)&&!i.hiddenOptions.includes(o)&&!this.argsContainKey(e,o,l)&&this.completeOptionKey(o,t,s,l&&!!i.default[o])})}}choicesFromOptionsCompletions(t,e,n,s){if(this.previousArgHasChoices(e)){const i=this.getPreviousArgChoices(e);i&&i.length>0&&t.push(...i.map(r=>r.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,s){if(s===""&&t.length>0&&this.previousArgHasChoices(e))return;const i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=i[n._.length-r-1];if(!o)return;const l=this.yargs.getOptions().choices[o]||[];for(const E of l)E.startsWith(s)&&t.push(E.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;const s=e.replace(/^-+/,""),i=this.yargs.getOptions(),r=[s,...this.yargs.getAliases()[s]||[]];let o;for(const l of r)if(Object.prototype.hasOwnProperty.call(i.key,l)&&Array.isArray(i.choices[l])){o=i.choices[l];break}if(o)return o.filter(l=>!n||l.startsWith(n))}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){const s=i=>t.indexOf((/^[^0-9]$/.test(i)?"-":"--")+i)!==-1;if(s(e)||n&&s(`no-${e}`))return!0;if(this.aliases){for(const i of this.aliases[e])if(s(i))return!0}return!1}completeOptionKey(t,e,n,s){var i,r,o,l;let E=t;if(this.zshShell){const w=this.usage.getDescriptions(),D=(r=(i=this===null||this===void 0?void 0:this.aliases)===null||i===void 0?void 0:i[t])===null||r===void 0?void 0:r.find(T=>{const I=w[T];return typeof I=="string"&&I.length>0}),_=D?w[D]:void 0,C=(l=(o=w[t])!==null&&o!==void 0?o:_)!==null&&l!==void 0?l:"";E=`${t.replace(/:/g,"\\:")}:${C.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const m=w=>/^--/.test(w),p=w=>/^[^0-9]$/.test(w),y=!m(n)&&p(t)?"-":"--";e.push(y+E),s&&e.push(y+"no-"+E)}customCompletion(t,e,n,s){if(Bt(this.customCompletionFunction,null,this.shim),Do(this.customCompletionFunction)){const i=this.customCompletionFunction(n,e);return yt(i)?i.then(r=>{this.shim.process.nextTick(()=>{s(null,r)})}).catch(r=>{this.shim.process.nextTick(()=>{s(r,void 0)})}):s(null,i)}else return To(this.customCompletionFunction)?this.customCompletionFunction(n,e,(i=s)=>this.defaultCompletion(t,e,n,i),i=>{s(null,i)}):this.customCompletionFunction(n,e,i=>{s(null,i)})}getCompletion(t,e){const n=t.length?t[t.length-1]:"",s=this.yargs.parse(t,!0),i=this.customCompletionFunction?r=>this.customCompletion(t,r,n,e):r=>this.defaultCompletion(t,r,n,e);return yt(s)?s.then(i):i(s)}generateCompletionScript(t,e){let n=this.zshShell?Oo:xo;const s=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function Io(a,t,e,n){return new Co(a,t,e,n)}function Do(a){return a.length<3}function To(a){return a.length>3}function vo(a,t){if(a.length===0)return t.length;if(t.length===0)return a.length;const e=[];let n;for(n=0;n<=t.length;n++)e[n]=[n];let s;for(s=0;s<=a.length;s++)e[0][s]=s;for(n=1;n<=t.length;n++)for(s=1;s<=a.length;s++)t.charAt(n-1)===a.charAt(s-1)?e[n][s]=e[n-1][s-1]:n>1&&s>1&&t.charAt(n-2)===a.charAt(s-1)&&t.charAt(n-1)===a.charAt(s-2)?e[n][s]=e[n-2][s-2]+1:e[n][s]=Math.min(e[n-1][s-1]+1,Math.min(e[n][s-1]+1,e[n-1][s]+1));return e[t.length][a.length]}const Mr=["$0","--","_"];function _o(a,t,e){const n=e.y18n.__,s=e.y18n.__n,i={};i.nonOptionCount=function(p){const y=a.getDemandedCommands(),D=p._.length+(p["--"]?p["--"].length:0)-a.getInternalMethods().getContext().commands.length;y._&&(D<y._.min||D>y._.max)&&(D<y._.min?y._.minMsg!==void 0?t.fail(y._.minMsg?y._.minMsg.replace(/\$0/g,D.toString()).replace(/\$1/,y._.min.toString()):null):t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",D,D.toString(),y._.min.toString())):D>y._.max&&(y._.maxMsg!==void 0?t.fail(y._.maxMsg?y._.maxMsg.replace(/\$0/g,D.toString()).replace(/\$1/,y._.max.toString()):null):t.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",D,D.toString(),y._.max.toString()))))},i.positionalCount=function(p,y){y<p&&t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",y,y+"",p+""))},i.requiredArguments=function(p,y){let w=null;for(const D of Object.keys(y))(!Object.prototype.hasOwnProperty.call(p,D)||typeof p[D]>"u")&&(w=w||{},w[D]=y[D]);if(w){const D=[];for(const C of Object.keys(w)){const T=w[C];T&&D.indexOf(T)<0&&D.push(T)}const _=D.length?`
83
+ `;class Io{constructor(t,e,n,s){var i,r,o;this.yargs=t,this.usage=e,this.command=n,this.shim=s,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(o=((i=this.shim.getEnv("SHELL"))===null||i===void 0?void 0:i.includes("zsh"))||((r=this.shim.getEnv("ZSH_NAME"))===null||r===void 0?void 0:r.includes("zsh")))!==null&&o!==void 0?o:!1}defaultCompletion(t,e,n,s){const i=this.command.getCommandHandlers();for(let o=0,l=t.length;o<l;++o)if(i[t[o]]&&i[t[o]].builder){const E=i[t[o]].builder;if(zn(E)){this.indexAfterLastReset=o+1;const m=this.yargs.getInternalMethods().reset();return E(m,!0),m.argv}}const r=[];this.commandCompletions(r,t,n),this.optionCompletions(r,t,e,n),this.choicesFromOptionsCompletions(r,t,e,n),this.choicesFromPositionalsCompletions(r,t,e,n),s(null,r)}commandCompletions(t,e,n){const s=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&s[s.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(i=>{const r=be(i[0]).cmd;if(e.indexOf(r)===-1)if(!this.zshShell)t.push(r);else{const o=i[1]||"";t.push(r.replace(/:/g,"\\:")+":"+o)}})}optionCompletions(t,e,n,s){if((s.match(/^-/)||s===""&&t.length===0)&&!this.previousArgHasChoices(e)){const i=this.yargs.getOptions(),r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach(o=>{const l=!!i.configuration["boolean-negation"]&&i.boolean.includes(o);!r.includes(o)&&!i.hiddenOptions.includes(o)&&!this.argsContainKey(e,o,l)&&this.completeOptionKey(o,t,s,l&&!!i.default[o])})}}choicesFromOptionsCompletions(t,e,n,s){if(this.previousArgHasChoices(e)){const i=this.getPreviousArgChoices(e);i&&i.length>0&&t.push(...i.map(r=>r.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(t,e,n,s){if(s===""&&t.length>0&&this.previousArgHasChoices(e))return;const i=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],r=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=i[n._.length-r-1];if(!o)return;const l=this.yargs.getOptions().choices[o]||[];for(const E of l)E.startsWith(s)&&t.push(E.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;const s=e.replace(/^-+/,""),i=this.yargs.getOptions(),r=[s,...this.yargs.getAliases()[s]||[]];let o;for(const l of r)if(Object.prototype.hasOwnProperty.call(i.key,l)&&Array.isArray(i.choices[l])){o=i.choices[l];break}if(o)return o.filter(l=>!n||l.startsWith(n))}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){const s=i=>t.indexOf((/^[^0-9]$/.test(i)?"-":"--")+i)!==-1;if(s(e)||n&&s(`no-${e}`))return!0;if(this.aliases){for(const i of this.aliases[e])if(s(i))return!0}return!1}completeOptionKey(t,e,n,s){var i,r,o,l;let E=t;if(this.zshShell){const w=this.usage.getDescriptions(),D=(r=(i=this===null||this===void 0?void 0:this.aliases)===null||i===void 0?void 0:i[t])===null||r===void 0?void 0:r.find(T=>{const I=w[T];return typeof I=="string"&&I.length>0}),_=D?w[D]:void 0,C=(l=(o=w[t])!==null&&o!==void 0?o:_)!==null&&l!==void 0?l:"";E=`${t.replace(/:/g,"\\:")}:${C.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const m=w=>/^--/.test(w),p=w=>/^[^0-9]$/.test(w),y=!m(n)&&p(t)?"-":"--";e.push(y+E),s&&e.push(y+"no-"+E)}customCompletion(t,e,n,s){if(Bt(this.customCompletionFunction,null,this.shim),To(this.customCompletionFunction)){const i=this.customCompletionFunction(n,e);return yt(i)?i.then(r=>{this.shim.process.nextTick(()=>{s(null,r)})}).catch(r=>{this.shim.process.nextTick(()=>{s(r,void 0)})}):s(null,i)}else return vo(this.customCompletionFunction)?this.customCompletionFunction(n,e,(i=s)=>this.defaultCompletion(t,e,n,i),i=>{s(null,i)}):this.customCompletionFunction(n,e,i=>{s(null,i)})}getCompletion(t,e){const n=t.length?t[t.length-1]:"",s=this.yargs.parse(t,!0),i=this.customCompletionFunction?r=>this.customCompletion(t,r,n,e):r=>this.defaultCompletion(t,r,n,e);return yt(s)?s.then(i):i(s)}generateCompletionScript(t,e){let n=this.zshShell?Co:Oo;const s=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,s),n=n.replace(/{{completion_command}}/g,e),n.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function Do(a,t,e,n){return new Io(a,t,e,n)}function To(a){return a.length<3}function vo(a){return a.length>3}function _o(a,t){if(a.length===0)return t.length;if(t.length===0)return a.length;const e=[];let n;for(n=0;n<=t.length;n++)e[n]=[n];let s;for(s=0;s<=a.length;s++)e[0][s]=s;for(n=1;n<=t.length;n++)for(s=1;s<=a.length;s++)t.charAt(n-1)===a.charAt(s-1)?e[n][s]=e[n-1][s-1]:n>1&&s>1&&t.charAt(n-2)===a.charAt(s-1)&&t.charAt(n-1)===a.charAt(s-2)?e[n][s]=e[n-2][s-2]+1:e[n][s]=Math.min(e[n-1][s-1]+1,Math.min(e[n][s-1]+1,e[n-1][s]+1));return e[t.length][a.length]}const Mr=["$0","--","_"];function No(a,t,e){const n=e.y18n.__,s=e.y18n.__n,i={};i.nonOptionCount=function(p){const y=a.getDemandedCommands(),D=p._.length+(p["--"]?p["--"].length:0)-a.getInternalMethods().getContext().commands.length;y._&&(D<y._.min||D>y._.max)&&(D<y._.min?y._.minMsg!==void 0?t.fail(y._.minMsg?y._.minMsg.replace(/\$0/g,D.toString()).replace(/\$1/,y._.min.toString()):null):t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",D,D.toString(),y._.min.toString())):D>y._.max&&(y._.maxMsg!==void 0?t.fail(y._.maxMsg?y._.maxMsg.replace(/\$0/g,D.toString()).replace(/\$1/,y._.max.toString()):null):t.fail(s("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",D,D.toString(),y._.max.toString()))))},i.positionalCount=function(p,y){y<p&&t.fail(s("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",y,y+"",p+""))},i.requiredArguments=function(p,y){let w=null;for(const D of Object.keys(y))(!Object.prototype.hasOwnProperty.call(p,D)||typeof p[D]>"u")&&(w=w||{},w[D]=y[D]);if(w){const D=[];for(const C of Object.keys(w)){const T=w[C];T&&D.indexOf(T)<0&&D.push(T)}const _=D.length?`
84
84
  ${D.join(`
85
85
  `)}`:"";t.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(w).length,Object.keys(w).join(", ")+_))}},i.unknownArguments=function(p,y,w,D,_=!0){var C;const T=a.getInternalMethods().getCommandInstance().getCommands(),I=[],g=a.getInternalMethods().getContext();if(Object.keys(p).forEach(v=>{!Mr.includes(v)&&!Object.prototype.hasOwnProperty.call(w,v)&&!Object.prototype.hasOwnProperty.call(a.getInternalMethods().getParseContext(),v)&&!i.isValidAndSomeAliasIsNotNew(v,y)&&I.push(v)}),_&&(g.commands.length>0||T.length>0||D)&&p._.slice(g.commands.length).forEach(v=>{T.includes(""+v)||I.push(""+v)}),_){const M=((C=a.getDemandedCommands()._)===null||C===void 0?void 0:C.max)||0,X=g.commands.length+M;X<p._.length&&p._.slice(X).forEach(q=>{q=String(q),!g.commands.includes(q)&&!I.includes(q)&&I.push(q)})}I.length&&t.fail(s("Unknown argument: %s","Unknown arguments: %s",I.length,I.map(v=>v.trim()?v:`"${v}"`).join(", ")))},i.unknownCommands=function(p){const y=a.getInternalMethods().getCommandInstance().getCommands(),w=[],D=a.getInternalMethods().getContext();return(D.commands.length>0||y.length>0)&&p._.slice(D.commands.length).forEach(_=>{y.includes(""+_)||w.push(""+_)}),w.length>0?(t.fail(s("Unknown command: %s","Unknown commands: %s",w.length,w.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(p,y){if(!Object.prototype.hasOwnProperty.call(y,p))return!1;const w=a.parsed.newAliases;return[p,...y[p]].some(D=>!Object.prototype.hasOwnProperty.call(w,D)||!w[p])},i.limitedChoices=function(p){const y=a.getOptions(),w={};if(!Object.keys(y.choices).length)return;Object.keys(p).forEach(C=>{Mr.indexOf(C)===-1&&Object.prototype.hasOwnProperty.call(y.choices,C)&&[].concat(p[C]).forEach(T=>{y.choices[C].indexOf(T)===-1&&T!==void 0&&(w[C]=(w[C]||[]).concat(T))})});const D=Object.keys(w);if(!D.length)return;let _=n("Invalid values:");D.forEach(C=>{_+=`
86
86
  ${n("Argument: %s, Given: %s, Choices: %s",C,t.stringifiedValues(w[C]),t.stringifiedValues(y.choices[C]))}`}),t.fail(_)};let r={};i.implies=function(p,y){z("<string|object> [array|number|string]",[p,y],arguments.length),typeof p=="object"?Object.keys(p).forEach(w=>{i.implies(w,p[w])}):(a.global(p),r[p]||(r[p]=[]),Array.isArray(y)?y.forEach(w=>i.implies(p,w)):(Bt(y,void 0,e),r[p].push(y)))},i.getImplied=function(){return r};function o(m,p){const y=Number(p);return p=isNaN(y)?p:y,typeof p=="number"?p=m._.length>=p:p.match(/^--no-.+/)?(p=p.match(/^--no-(.+)/)[1],p=!Object.prototype.hasOwnProperty.call(m,p)):p=Object.prototype.hasOwnProperty.call(m,p),p}i.implications=function(p){const y=[];if(Object.keys(r).forEach(w=>{const D=w;(r[w]||[]).forEach(_=>{let C=D;const T=_;C=o(p,C),_=o(p,_),C&&!_&&y.push(` ${D} -> ${T}`)})}),y.length){let w=`${n("Implications failed:")}
87
- `;y.forEach(D=>{w+=D}),t.fail(w)}};let l={};i.conflicts=function(p,y){z("<string|object> [array|string]",[p,y],arguments.length),typeof p=="object"?Object.keys(p).forEach(w=>{i.conflicts(w,p[w])}):(a.global(p),l[p]||(l[p]=[]),Array.isArray(y)?y.forEach(w=>i.conflicts(p,w)):l[p].push(y))},i.getConflicting=()=>l,i.conflicting=function(p){Object.keys(p).forEach(y=>{l[y]&&l[y].forEach(w=>{w&&p[y]!==void 0&&p[w]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",y,w))})}),a.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach(y=>{l[y].forEach(w=>{w&&p[e.Parser.camelCase(y)]!==void 0&&p[e.Parser.camelCase(w)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",y,w))})})},i.recommendCommands=function(p,y){y=y.sort((C,T)=>T.length-C.length);let D=null,_=1/0;for(let C=0,T;(T=y[C])!==void 0;C++){const I=vo(p,T);I<=3&&I<_&&(_=I,D=T)}D&&t.fail(n("Did you mean %s?",D))},i.reset=function(p){return r=Oe(r,y=>!p[y]),l=Oe(l,y=>!p[y]),i};const E=[];return i.freeze=function(){E.push({implied:r,conflicting:l})},i.unfreeze=function(){const p=E.pop();Bt(p,void 0,e),{implied:r,conflicting:l}=p},i}let Gn=[],ye;function Yn(a,t,e,n){ye=n;let s={};if(Object.prototype.hasOwnProperty.call(a,"extends")){if(typeof a.extends!="string")return s;const i=/\.json|\..*rc$/.test(a.extends);let r=null;if(i)r=Ao(t,a.extends);else try{r=require.resolve(a.extends)}catch{return a}No(r),Gn.push(r),s=i?JSON.parse(ye.readFileSync(r,"utf8")):require(a.extends),delete a.extends,s=Yn(s,ye.path.dirname(r),e,ye)}return Gn=[],e?ss(s,a):Object.assign({},s,a)}function No(a){if(Gn.indexOf(a)>-1)throw new gt(`Circular extended configurations: '${a}'.`)}function Ao(a,t){return ye.path.resolve(a,t)}function ss(a,t){const e={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(e,a);for(const s of Object.keys(t))n(t[s])&&n(e[s])?e[s]=ss(a[s],t[s]):e[s]=t[s];return e}var H=function(a,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?a!==t||!s:!t.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(a,e):s?s.value=e:t.set(a,e),e},O=function(a,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?a!==t||!n:!t.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(a):n?n.value:t.get(a)},mt,kt,he,Nt,It,Te,zt,Kt,ve,At,_e,Mt,Rt,Dt,Pt,Ne,ae,wt,Y,Ae,Me,Tt,Qt,ue,Jt,Gt,Pe,tt,Zt,te,ee,et,Le,Ut,dt;function Mo(a){return(t=[],e=a.process.cwd(),n)=>{const s=new Po(t,e,n,a);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}const Pr=Symbol("copyDoubleDash"),Lr=Symbol("copyDoubleDash"),ke=Symbol("deleteFromParserHintObject"),Sr=Symbol("emitWarning"),Fr=Symbol("freeze"),jr=Symbol("getDollarZero"),ne=Symbol("getParserConfiguration"),Br=Symbol("getUsageConfiguration"),Ke=Symbol("guessLocale"),Rr=Symbol("guessVersion"),Ur=Symbol("parsePositionalNumbers"),Qe=Symbol("pkgUp"),Yt=Symbol("populateParserHintArray"),ce=Symbol("populateParserHintSingleValueDictionary"),Je=Symbol("populateParserHintArrayDictionary"),Ze=Symbol("populateParserHintDictionary"),tn=Symbol("sanitizeKey"),en=Symbol("setKey"),nn=Symbol("unfreeze"),Xr=Symbol("validateAsync"),$r=Symbol("getCommandInstance"),qr=Symbol("getContext"),Wr=Symbol("getHasOutput"),Vr=Symbol("getLoggerInstance"),Hr=Symbol("getParseContext"),zr=Symbol("getUsageInstance"),Gr=Symbol("getValidationInstance"),Se=Symbol("hasParseCallback"),Yr=Symbol("isGlobalContext"),re=Symbol("postProcess"),kr=Symbol("rebase"),rn=Symbol("reset"),pe=Symbol("runYargsParserAndExecuteCommands"),sn=Symbol("runValidation"),Kr=Symbol("setHasOutput"),ie=Symbol("kTrackManuallySetKeys");class Po{constructor(t=[],e,n,s){this.customScriptName=!1,this.parsed=!1,mt.set(this,void 0),kt.set(this,void 0),he.set(this,{commands:[],fullCommands:[]}),Nt.set(this,null),It.set(this,null),Te.set(this,"show-hidden"),zt.set(this,null),Kt.set(this,!0),ve.set(this,{}),At.set(this,!0),_e.set(this,[]),Mt.set(this,void 0),Rt.set(this,{}),Dt.set(this,!1),Pt.set(this,null),Ne.set(this,!0),ae.set(this,void 0),wt.set(this,""),Y.set(this,void 0),Ae.set(this,void 0),Me.set(this,{}),Tt.set(this,null),Qt.set(this,null),ue.set(this,{}),Jt.set(this,{}),Gt.set(this,void 0),Pe.set(this,!1),tt.set(this,void 0),Zt.set(this,!1),te.set(this,!1),ee.set(this,!1),et.set(this,void 0),Le.set(this,{}),Ut.set(this,null),dt.set(this,void 0),H(this,tt,s,"f"),H(this,Gt,t,"f"),H(this,kt,e,"f"),H(this,Ae,n,"f"),H(this,Mt,new uo(this),"f"),this.$0=this[jr](),this[rn](),H(this,mt,O(this,mt,"f"),"f"),H(this,et,O(this,et,"f"),"f"),H(this,dt,O(this,dt,"f"),"f"),H(this,Y,O(this,Y,"f"),"f"),O(this,Y,"f").showHiddenOpt=O(this,Te,"f"),H(this,ae,this[Lr](),"f")}addHelpOpt(t,e){const n="help";return z("[string|boolean] [string]",[t,e],arguments.length),O(this,Pt,"f")&&(this[ke](O(this,Pt,"f")),H(this,Pt,null,"f")),t===!1&&e===void 0?this:(H(this,Pt,typeof t=="string"?t:n,"f"),this.boolean(O(this,Pt,"f")),this.describe(O(this,Pt,"f"),e||O(this,et,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(z("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;const n=typeof t=="string"?t:O(this,Te,"f");return this.boolean(n),this.describe(n,e||O(this,et,"f").deferY18nLookup("Show hidden options")),O(this,Y,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return z("<object|string|array> [string|array]",[t,e],arguments.length),this[Je](this.alias.bind(this),"alias",t,e),this}array(t){return z("<array|string>",[t],arguments.length),this[Yt]("array",t),this[ie](t),this}boolean(t){return z("<array|string>",[t],arguments.length),this[Yt]("boolean",t),this[ie](t),this}check(t,e){return z("<function> [boolean]",[t,e],arguments.length),this.middleware((n,s)=>Ee(()=>t(n,s.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&O(this,et,"f").fail(i.toString(),i):O(this,et,"f").fail(O(this,tt,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(O(this,et,"f").fail(i.message?i.message:i.toString(),i),n)),!1,e),this}choices(t,e){return z("<object|string|array> [string|array]",[t,e],arguments.length),this[Je](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(z("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new gt("coerce callback must be provided");for(const n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(const n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new gt("coerce callback must be provided");return O(this,Y,"f").key[t]=!0,O(this,Mt,"f").addCoerceMiddleware((n,s)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?Ee(()=>(i=s.getAliases(),e(n[t])),o=>{n[t]=o;const l=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&l!==!0)for(const E of i[t])n[E]=o;return n},o=>{throw new gt(o.message)}):n},t),this}conflicts(t,e){return z("<string|object> [string|array]",[t,e],arguments.length),O(this,dt,"f").conflicts(t,e),this}config(t="config",e,n){return z("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Yn(t,O(this,kt,"f"),this[ne]()["deep-merge-config"]||!1,O(this,tt,"f")),O(this,Y,"f").configObjects=(O(this,Y,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||O(this,et,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(s=>{O(this,Y,"f").config[s]=n||!0}),this)}completion(t,e,n){return z("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),H(this,It,t||O(this,It,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(O(this,It,"f"),e),n&&O(this,Nt,"f").registerFunction(n),this}command(t,e,n,s,i,r){return z("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,s,i,r],arguments.length),O(this,mt,"f").addHandler(t,e,n,s,i,r),this}commands(t,e,n,s,i,r){return this.command(t,e,n,s,i,r)}commandDir(t,e){z("<string> [object]",[t,e],arguments.length);const n=O(this,Ae,"f")||O(this,tt,"f").require;return O(this,mt,"f").addDirectory(t,n,O(this,tt,"f").getCallerFile(),e),this}count(t){return z("<array|string>",[t],arguments.length),this[Yt]("count",t),this[ie](t),this}default(t,e,n){return z("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Tr(t,O(this,tt,"f")),O(this,Y,"f").defaultDescription[t]=n),typeof e=="function"&&(Tr(t,O(this,tt,"f")),O(this,Y,"f").defaultDescription[t]||(O(this,Y,"f").defaultDescription[t]=O(this,et,"f").functionDescription(e)),e=e.call()),this[ce](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,s){return z("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,s],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),O(this,Y,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:s},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(s=>{Bt(n,!0,O(this,tt,"f")),this.demandOption(s,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(Bt(n,!0,O(this,tt,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(s=>{Bt(n,!0,O(this,tt,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return z("<object|string|array> [string]",[t,e],arguments.length),this[ce](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return z("<string> [string|boolean]",[t,e],arguments.length),O(this,Y,"f").deprecatedOptions[t]=e,this}describe(t,e){return z("<object|string|array> [string]",[t,e],arguments.length),this[en](t,!0),O(this,et,"f").describe(t,e),this}detectLocale(t){return z("<boolean>",[t],arguments.length),H(this,Kt,t,"f"),this}env(t){return z("[string|boolean]",[t],arguments.length),t===!1?delete O(this,Y,"f").envPrefix:O(this,Y,"f").envPrefix=t||"",this}epilogue(t){return z("<string>",[t],arguments.length),O(this,et,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return z("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):O(this,et,"f").example(t,e),this}exit(t,e){H(this,Dt,!0,"f"),H(this,zt,e,"f"),O(this,At,"f")&&O(this,tt,"f").process.exit(t)}exitProcess(t=!0){return z("[boolean]",[t],arguments.length),H(this,At,t,"f"),this}fail(t){if(z("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new gt("Invalid first argument. Expected function or boolean 'false'");return O(this,et,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return z("<array> [function]",[t,e],arguments.length),e?O(this,Nt,"f").getCompletion(t,e):new Promise((n,s)=>{O(this,Nt,"f").getCompletion(t,(i,r)=>{i?s(i):n(r)})})}getDemandedOptions(){return z([],0),O(this,Y,"f").demandedOptions}getDemandedCommands(){return z([],0),O(this,Y,"f").demandedCommands}getDeprecatedOptions(){return z([],0),O(this,Y,"f").deprecatedOptions}getDetectLocale(){return O(this,Kt,"f")}getExitProcess(){return O(this,At,"f")}getGroups(){return Object.assign({},O(this,Rt,"f"),O(this,Jt,"f"))}getHelp(){if(H(this,Dt,!0,"f"),!O(this,et,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[pe](O(this,Gt,"f"),void 0,void 0,0,!0);if(yt(e))return e.then(()=>O(this,et,"f").help())}const t=O(this,mt,"f").runDefaultBuilderOn(this);if(yt(t))return t.then(()=>O(this,et,"f").help())}return Promise.resolve(O(this,et,"f").help())}getOptions(){return O(this,Y,"f")}getStrict(){return O(this,Zt,"f")}getStrictCommands(){return O(this,te,"f")}getStrictOptions(){return O(this,ee,"f")}global(t,e){return z("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?O(this,Y,"f").local=O(this,Y,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{O(this,Y,"f").local.includes(n)||O(this,Y,"f").local.push(n)}),this}group(t,e){z("<string|array> <string>",[t,e],arguments.length);const n=O(this,Jt,"f")[e]||O(this,Rt,"f")[e];O(this,Jt,"f")[e]&&delete O(this,Jt,"f")[e];const s={};return O(this,Rt,"f")[e]=(n||[]).concat(t).filter(i=>s[i]?!1:s[i]=!0),this}hide(t){return z("<string>",[t],arguments.length),O(this,Y,"f").hiddenOptions.push(t),this}implies(t,e){return z("<string|object> [number|string|array]",[t,e],arguments.length),O(this,dt,"f").implies(t,e),this}locale(t){return z("[string]",[t],arguments.length),t===void 0?(this[Ke](),O(this,tt,"f").y18n.getLocale()):(H(this,Kt,!1,"f"),O(this,tt,"f").y18n.setLocale(t),this)}middleware(t,e,n){return O(this,Mt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return z("<string|object|array> [number]",[t,e],arguments.length),this[ce](this.nargs.bind(this),"narg",t,e),this}normalize(t){return z("<array|string>",[t],arguments.length),this[Yt]("normalize",t),this}number(t){return z("<array|string>",[t],arguments.length),this[Yt]("number",t),this[ie](t),this}option(t,e){if(z("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[ie](t),O(this,Ut,"f")&&(t==="version"||e?.alias==="version")&&this[Sr](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
87
+ `;y.forEach(D=>{w+=D}),t.fail(w)}};let l={};i.conflicts=function(p,y){z("<string|object> [array|string]",[p,y],arguments.length),typeof p=="object"?Object.keys(p).forEach(w=>{i.conflicts(w,p[w])}):(a.global(p),l[p]||(l[p]=[]),Array.isArray(y)?y.forEach(w=>i.conflicts(p,w)):l[p].push(y))},i.getConflicting=()=>l,i.conflicting=function(p){Object.keys(p).forEach(y=>{l[y]&&l[y].forEach(w=>{w&&p[y]!==void 0&&p[w]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",y,w))})}),a.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(l).forEach(y=>{l[y].forEach(w=>{w&&p[e.Parser.camelCase(y)]!==void 0&&p[e.Parser.camelCase(w)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",y,w))})})},i.recommendCommands=function(p,y){y=y.sort((C,T)=>T.length-C.length);let D=null,_=1/0;for(let C=0,T;(T=y[C])!==void 0;C++){const I=_o(p,T);I<=3&&I<_&&(_=I,D=T)}D&&t.fail(n("Did you mean %s?",D))},i.reset=function(p){return r=Oe(r,y=>!p[y]),l=Oe(l,y=>!p[y]),i};const E=[];return i.freeze=function(){E.push({implied:r,conflicting:l})},i.unfreeze=function(){const p=E.pop();Bt(p,void 0,e),{implied:r,conflicting:l}=p},i}let Gn=[],ye;function Yn(a,t,e,n){ye=n;let s={};if(Object.prototype.hasOwnProperty.call(a,"extends")){if(typeof a.extends!="string")return s;const i=/\.json|\..*rc$/.test(a.extends);let r=null;if(i)r=Mo(t,a.extends);else try{r=require.resolve(a.extends)}catch{return a}Ao(r),Gn.push(r),s=i?JSON.parse(ye.readFileSync(r,"utf8")):require(a.extends),delete a.extends,s=Yn(s,ye.path.dirname(r),e,ye)}return Gn=[],e?ss(s,a):Object.assign({},s,a)}function Ao(a){if(Gn.indexOf(a)>-1)throw new gt(`Circular extended configurations: '${a}'.`)}function Mo(a,t){return ye.path.resolve(a,t)}function ss(a,t){const e={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(e,a);for(const s of Object.keys(t))n(t[s])&&n(e[s])?e[s]=ss(a[s],t[s]):e[s]=t[s];return e}var H=function(a,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?a!==t||!s:!t.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(a,e):s?s.value=e:t.set(a,e),e},O=function(a,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?a!==t||!n:!t.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(a):n?n.value:t.get(a)},mt,kt,he,Nt,It,Te,zt,Kt,ve,At,_e,Mt,Rt,Dt,Pt,Ne,ae,wt,Y,Ae,Me,Tt,Qt,ue,Jt,Gt,Pe,tt,Zt,te,ee,et,Le,Ut,dt;function Po(a){return(t=[],e=a.process.cwd(),n)=>{const s=new Lo(t,e,n,a);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}const Pr=Symbol("copyDoubleDash"),Lr=Symbol("copyDoubleDash"),ke=Symbol("deleteFromParserHintObject"),Sr=Symbol("emitWarning"),Fr=Symbol("freeze"),jr=Symbol("getDollarZero"),ne=Symbol("getParserConfiguration"),Br=Symbol("getUsageConfiguration"),Ke=Symbol("guessLocale"),Rr=Symbol("guessVersion"),Ur=Symbol("parsePositionalNumbers"),Qe=Symbol("pkgUp"),Yt=Symbol("populateParserHintArray"),ce=Symbol("populateParserHintSingleValueDictionary"),Je=Symbol("populateParserHintArrayDictionary"),Ze=Symbol("populateParserHintDictionary"),tn=Symbol("sanitizeKey"),en=Symbol("setKey"),nn=Symbol("unfreeze"),Xr=Symbol("validateAsync"),$r=Symbol("getCommandInstance"),qr=Symbol("getContext"),Wr=Symbol("getHasOutput"),Vr=Symbol("getLoggerInstance"),Hr=Symbol("getParseContext"),zr=Symbol("getUsageInstance"),Gr=Symbol("getValidationInstance"),Se=Symbol("hasParseCallback"),Yr=Symbol("isGlobalContext"),re=Symbol("postProcess"),kr=Symbol("rebase"),rn=Symbol("reset"),pe=Symbol("runYargsParserAndExecuteCommands"),sn=Symbol("runValidation"),Kr=Symbol("setHasOutput"),ie=Symbol("kTrackManuallySetKeys");class Lo{constructor(t=[],e,n,s){this.customScriptName=!1,this.parsed=!1,mt.set(this,void 0),kt.set(this,void 0),he.set(this,{commands:[],fullCommands:[]}),Nt.set(this,null),It.set(this,null),Te.set(this,"show-hidden"),zt.set(this,null),Kt.set(this,!0),ve.set(this,{}),At.set(this,!0),_e.set(this,[]),Mt.set(this,void 0),Rt.set(this,{}),Dt.set(this,!1),Pt.set(this,null),Ne.set(this,!0),ae.set(this,void 0),wt.set(this,""),Y.set(this,void 0),Ae.set(this,void 0),Me.set(this,{}),Tt.set(this,null),Qt.set(this,null),ue.set(this,{}),Jt.set(this,{}),Gt.set(this,void 0),Pe.set(this,!1),tt.set(this,void 0),Zt.set(this,!1),te.set(this,!1),ee.set(this,!1),et.set(this,void 0),Le.set(this,{}),Ut.set(this,null),dt.set(this,void 0),H(this,tt,s,"f"),H(this,Gt,t,"f"),H(this,kt,e,"f"),H(this,Ae,n,"f"),H(this,Mt,new co(this),"f"),this.$0=this[jr](),this[rn](),H(this,mt,O(this,mt,"f"),"f"),H(this,et,O(this,et,"f"),"f"),H(this,dt,O(this,dt,"f"),"f"),H(this,Y,O(this,Y,"f"),"f"),O(this,Y,"f").showHiddenOpt=O(this,Te,"f"),H(this,ae,this[Lr](),"f")}addHelpOpt(t,e){const n="help";return z("[string|boolean] [string]",[t,e],arguments.length),O(this,Pt,"f")&&(this[ke](O(this,Pt,"f")),H(this,Pt,null,"f")),t===!1&&e===void 0?this:(H(this,Pt,typeof t=="string"?t:n,"f"),this.boolean(O(this,Pt,"f")),this.describe(O(this,Pt,"f"),e||O(this,et,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(z("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;const n=typeof t=="string"?t:O(this,Te,"f");return this.boolean(n),this.describe(n,e||O(this,et,"f").deferY18nLookup("Show hidden options")),O(this,Y,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return z("<object|string|array> [string|array]",[t,e],arguments.length),this[Je](this.alias.bind(this),"alias",t,e),this}array(t){return z("<array|string>",[t],arguments.length),this[Yt]("array",t),this[ie](t),this}boolean(t){return z("<array|string>",[t],arguments.length),this[Yt]("boolean",t),this[ie](t),this}check(t,e){return z("<function> [boolean]",[t,e],arguments.length),this.middleware((n,s)=>Ee(()=>t(n,s.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&O(this,et,"f").fail(i.toString(),i):O(this,et,"f").fail(O(this,tt,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(O(this,et,"f").fail(i.message?i.message:i.toString(),i),n)),!1,e),this}choices(t,e){return z("<object|string|array> [string|array]",[t,e],arguments.length),this[Je](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(z("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new gt("coerce callback must be provided");for(const n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(const n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new gt("coerce callback must be provided");return O(this,Y,"f").key[t]=!0,O(this,Mt,"f").addCoerceMiddleware((n,s)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?Ee(()=>(i=s.getAliases(),e(n[t])),o=>{n[t]=o;const l=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&l!==!0)for(const E of i[t])n[E]=o;return n},o=>{throw new gt(o.message)}):n},t),this}conflicts(t,e){return z("<string|object> [string|array]",[t,e],arguments.length),O(this,dt,"f").conflicts(t,e),this}config(t="config",e,n){return z("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Yn(t,O(this,kt,"f"),this[ne]()["deep-merge-config"]||!1,O(this,tt,"f")),O(this,Y,"f").configObjects=(O(this,Y,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||O(this,et,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(s=>{O(this,Y,"f").config[s]=n||!0}),this)}completion(t,e,n){return z("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),H(this,It,t||O(this,It,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(O(this,It,"f"),e),n&&O(this,Nt,"f").registerFunction(n),this}command(t,e,n,s,i,r){return z("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,s,i,r],arguments.length),O(this,mt,"f").addHandler(t,e,n,s,i,r),this}commands(t,e,n,s,i,r){return this.command(t,e,n,s,i,r)}commandDir(t,e){z("<string> [object]",[t,e],arguments.length);const n=O(this,Ae,"f")||O(this,tt,"f").require;return O(this,mt,"f").addDirectory(t,n,O(this,tt,"f").getCallerFile(),e),this}count(t){return z("<array|string>",[t],arguments.length),this[Yt]("count",t),this[ie](t),this}default(t,e,n){return z("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(Tr(t,O(this,tt,"f")),O(this,Y,"f").defaultDescription[t]=n),typeof e=="function"&&(Tr(t,O(this,tt,"f")),O(this,Y,"f").defaultDescription[t]||(O(this,Y,"f").defaultDescription[t]=O(this,et,"f").functionDescription(e)),e=e.call()),this[ce](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,s){return z("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,s],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),O(this,Y,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:s},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(s=>{Bt(n,!0,O(this,tt,"f")),this.demandOption(s,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(Bt(n,!0,O(this,tt,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(s=>{Bt(n,!0,O(this,tt,"f")),this.demandOption(s,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return z("<object|string|array> [string]",[t,e],arguments.length),this[ce](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return z("<string> [string|boolean]",[t,e],arguments.length),O(this,Y,"f").deprecatedOptions[t]=e,this}describe(t,e){return z("<object|string|array> [string]",[t,e],arguments.length),this[en](t,!0),O(this,et,"f").describe(t,e),this}detectLocale(t){return z("<boolean>",[t],arguments.length),H(this,Kt,t,"f"),this}env(t){return z("[string|boolean]",[t],arguments.length),t===!1?delete O(this,Y,"f").envPrefix:O(this,Y,"f").envPrefix=t||"",this}epilogue(t){return z("<string>",[t],arguments.length),O(this,et,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return z("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):O(this,et,"f").example(t,e),this}exit(t,e){H(this,Dt,!0,"f"),H(this,zt,e,"f"),O(this,At,"f")&&O(this,tt,"f").process.exit(t)}exitProcess(t=!0){return z("[boolean]",[t],arguments.length),H(this,At,t,"f"),this}fail(t){if(z("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new gt("Invalid first argument. Expected function or boolean 'false'");return O(this,et,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return z("<array> [function]",[t,e],arguments.length),e?O(this,Nt,"f").getCompletion(t,e):new Promise((n,s)=>{O(this,Nt,"f").getCompletion(t,(i,r)=>{i?s(i):n(r)})})}getDemandedOptions(){return z([],0),O(this,Y,"f").demandedOptions}getDemandedCommands(){return z([],0),O(this,Y,"f").demandedCommands}getDeprecatedOptions(){return z([],0),O(this,Y,"f").deprecatedOptions}getDetectLocale(){return O(this,Kt,"f")}getExitProcess(){return O(this,At,"f")}getGroups(){return Object.assign({},O(this,Rt,"f"),O(this,Jt,"f"))}getHelp(){if(H(this,Dt,!0,"f"),!O(this,et,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[pe](O(this,Gt,"f"),void 0,void 0,0,!0);if(yt(e))return e.then(()=>O(this,et,"f").help())}const t=O(this,mt,"f").runDefaultBuilderOn(this);if(yt(t))return t.then(()=>O(this,et,"f").help())}return Promise.resolve(O(this,et,"f").help())}getOptions(){return O(this,Y,"f")}getStrict(){return O(this,Zt,"f")}getStrictCommands(){return O(this,te,"f")}getStrictOptions(){return O(this,ee,"f")}global(t,e){return z("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?O(this,Y,"f").local=O(this,Y,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{O(this,Y,"f").local.includes(n)||O(this,Y,"f").local.push(n)}),this}group(t,e){z("<string|array> <string>",[t,e],arguments.length);const n=O(this,Jt,"f")[e]||O(this,Rt,"f")[e];O(this,Jt,"f")[e]&&delete O(this,Jt,"f")[e];const s={};return O(this,Rt,"f")[e]=(n||[]).concat(t).filter(i=>s[i]?!1:s[i]=!0),this}hide(t){return z("<string>",[t],arguments.length),O(this,Y,"f").hiddenOptions.push(t),this}implies(t,e){return z("<string|object> [number|string|array]",[t,e],arguments.length),O(this,dt,"f").implies(t,e),this}locale(t){return z("[string]",[t],arguments.length),t===void 0?(this[Ke](),O(this,tt,"f").y18n.getLocale()):(H(this,Kt,!1,"f"),O(this,tt,"f").y18n.setLocale(t),this)}middleware(t,e,n){return O(this,Mt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return z("<string|object|array> [number]",[t,e],arguments.length),this[ce](this.nargs.bind(this),"narg",t,e),this}normalize(t){return z("<array|string>",[t],arguments.length),this[Yt]("normalize",t),this}number(t){return z("<array|string>",[t],arguments.length),this[Yt]("number",t),this[ie](t),this}option(t,e){if(z("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[ie](t),O(this,Ut,"f")&&(t==="version"||e?.alias==="version")&&this[Sr](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
88
88
  `),void 0,"versionWarning"),O(this,Y,"f").key[t]=!0,e.alias&&this.alias(t,e.alias);const n=e.deprecate||e.deprecated;n&&this.deprecateOption(t,n);const s=e.demand||e.required||e.require;s&&this.demand(t,s),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(O(this,Y,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const i=e.describe||e.description||e.desc,r=O(this,et,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(r,t)||typeof i=="string")&&this.describe(t,i),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){z("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[Fr](),typeof t>"u"&&(t=O(this,Gt,"f")),typeof e=="object"&&(H(this,Qt,e,"f"),e=n),typeof e=="function"&&(H(this,Tt,e,"f"),e=!1),e||H(this,Gt,t,"f"),O(this,Tt,"f")&&H(this,At,!1,"f");const s=this[pe](t,!!e),i=this.parsed;return O(this,Nt,"f").setParsed(this.parsed),yt(s)?s.then(r=>(O(this,Tt,"f")&&O(this,Tt,"f").call(this,O(this,zt,"f"),r,O(this,wt,"f")),r)).catch(r=>{throw O(this,Tt,"f")&&O(this,Tt,"f")(r,this.parsed.argv,O(this,wt,"f")),r}).finally(()=>{this[nn](),this.parsed=i}):(O(this,Tt,"f")&&O(this,Tt,"f").call(this,O(this,zt,"f"),s,O(this,wt,"f")),this[nn](),this.parsed=i,s)}parseAsync(t,e,n){const s=this.parse(t,e,n);return yt(s)?s:Promise.resolve(s)}parseSync(t,e,n){const s=this.parse(t,e,n);if(yt(s))throw new gt(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(t){return z("<object>",[t],arguments.length),H(this,Me,t,"f"),this}pkgConf(t,e){z("<string> [string]",[t,e],arguments.length);let n=null;const s=this[Qe](e||O(this,kt,"f"));return s[t]&&typeof s[t]=="object"&&(n=Yn(s[t],e||O(this,kt,"f"),this[ne]()["deep-merge-config"]||!1,O(this,tt,"f")),O(this,Y,"f").configObjects=(O(this,Y,"f").configObjects||[]).concat(n)),this}positional(t,e){z("<string> <object>",[t,e],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=Oe(e,(r,o)=>r==="type"&&!["string","number","boolean"].includes(o)?!1:n.includes(r));const s=O(this,he,"f").fullCommands[O(this,he,"f").fullCommands.length-1],i=s?O(this,mt,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return Xe(i).forEach(r=>{const o=i[r];Array.isArray(o)?o.indexOf(t)!==-1&&(e[r]=!0):o[t]&&!(r in e)&&(e[r]=o[t])}),this.group(t,O(this,et,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return z("[boolean]",[t],arguments.length),H(this,Pe,t,"f"),this}required(t,e,n){return this.demand(t,e,n)}require(t,e,n){return this.demand(t,e,n)}requiresArg(t){return z("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&O(this,Y,"f").narg[t]?this:(this[ce](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return z("[string] [string]",[t,e],arguments.length),t=t||this.$0,O(this,ae,"f").log(O(this,Nt,"f").generateCompletionScript(t,e||O(this,It,"f")||"completion")),this}showHelp(t){if(z("[string|function]",[t],arguments.length),H(this,Dt,!0,"f"),!O(this,et,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[pe](O(this,Gt,"f"),void 0,void 0,0,!0);if(yt(n))return n.then(()=>{O(this,et,"f").showHelp(t)}),this}const e=O(this,mt,"f").runDefaultBuilderOn(this);if(yt(e))return e.then(()=>{O(this,et,"f").showHelp(t)}),this}return O(this,et,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return z("[boolean|string] [string]",[t,e],arguments.length),O(this,et,"f").showHelpOnFail(t,e),this}showVersion(t){return z("[string|function]",[t],arguments.length),O(this,et,"f").showVersion(t),this}skipValidation(t){return z("<array|string>",[t],arguments.length),this[Yt]("skipValidation",t),this}strict(t){return z("[boolean]",[t],arguments.length),H(this,Zt,t!==!1,"f"),this}strictCommands(t){return z("[boolean]",[t],arguments.length),H(this,te,t!==!1,"f"),this}strictOptions(t){return z("[boolean]",[t],arguments.length),H(this,ee,t!==!1,"f"),this}string(t){return z("<array|string>",[t],arguments.length),this[Yt]("string",t),this[ie](t),this}terminalWidth(){return z([],0),O(this,tt,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return z("<object>",[t],arguments.length),H(this,Kt,!1,"f"),O(this,tt,"f").y18n.updateLocale(t),this}usage(t,e,n,s){if(z("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,s],arguments.length),e!==void 0){if(Bt(t,null,O(this,tt,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,s);throw new gt(".usage() description must start with $0 if being used as alias for .command()")}else return O(this,et,"f").usage(t),this}usageConfiguration(t){return z("<object>",[t],arguments.length),H(this,Le,t,"f"),this}version(t,e,n){const s="version";if(z("[boolean|string] [string] [string]",[t,e,n],arguments.length),O(this,Ut,"f")&&(this[ke](O(this,Ut,"f")),O(this,et,"f").version(void 0),H(this,Ut,null,"f")),arguments.length===0)n=this[Rr](),t=s;else if(arguments.length===1){if(t===!1)return this;n=t,t=s}else arguments.length===2&&(n=e,e=void 0);return H(this,Ut,typeof t=="string"?t:s,"f"),e=e||O(this,et,"f").deferY18nLookup("Show version number"),O(this,et,"f").version(n||void 0),this.boolean(O(this,Ut,"f")),this.describe(O(this,Ut,"f"),e),this}wrap(t){return z("<number|null|undefined>",[t],arguments.length),O(this,et,"f").wrap(t),this}[(mt=new WeakMap,kt=new WeakMap,he=new WeakMap,Nt=new WeakMap,It=new WeakMap,Te=new WeakMap,zt=new WeakMap,Kt=new WeakMap,ve=new WeakMap,At=new WeakMap,_e=new WeakMap,Mt=new WeakMap,Rt=new WeakMap,Dt=new WeakMap,Pt=new WeakMap,Ne=new WeakMap,ae=new WeakMap,wt=new WeakMap,Y=new WeakMap,Ae=new WeakMap,Me=new WeakMap,Tt=new WeakMap,Qt=new WeakMap,ue=new WeakMap,Jt=new WeakMap,Gt=new WeakMap,Pe=new WeakMap,tt=new WeakMap,Zt=new WeakMap,te=new WeakMap,ee=new WeakMap,et=new WeakMap,Le=new WeakMap,Ut=new WeakMap,dt=new WeakMap,Pr)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Lr](){return{log:(...t)=>{this[Se]()||console.log(...t),H(this,Dt,!0,"f"),O(this,wt,"f").length&&H(this,wt,O(this,wt,"f")+`
89
89
  `,"f"),H(this,wt,O(this,wt,"f")+t.join(" "),"f")},error:(...t)=>{this[Se]()||console.error(...t),H(this,Dt,!0,"f"),O(this,wt,"f").length&&H(this,wt,O(this,wt,"f")+`
90
- `,"f"),H(this,wt,O(this,wt,"f")+t.join(" "),"f")}}}[ke](t){Xe(O(this,Y,"f")).forEach(e=>{if((s=>s==="configObjects")(e))return;const n=O(this,Y,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete O(this,et,"f").getDescriptions()[t]}[Sr](t,e,n){O(this,ve,"f")[n]||(O(this,tt,"f").process.emitWarning(t,e),O(this,ve,"f")[n]=!0)}[Fr](){O(this,_e,"f").push({options:O(this,Y,"f"),configObjects:O(this,Y,"f").configObjects.slice(0),exitProcess:O(this,At,"f"),groups:O(this,Rt,"f"),strict:O(this,Zt,"f"),strictCommands:O(this,te,"f"),strictOptions:O(this,ee,"f"),completionCommand:O(this,It,"f"),output:O(this,wt,"f"),exitError:O(this,zt,"f"),hasOutput:O(this,Dt,"f"),parsed:this.parsed,parseFn:O(this,Tt,"f"),parseContext:O(this,Qt,"f")}),O(this,et,"f").freeze(),O(this,dt,"f").freeze(),O(this,mt,"f").freeze(),O(this,Mt,"f").freeze()}[jr](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(O(this,tt,"f").process.argv()[0])?e=O(this,tt,"f").process.argv().slice(1,2):e=O(this,tt,"f").process.argv().slice(0,1),t=e.map(n=>{const s=this[kr](O(this,kt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),O(this,tt,"f").getEnv("_")&&O(this,tt,"f").getProcessArgvBin()===O(this,tt,"f").getEnv("_")&&(t=O(this,tt,"f").getEnv("_").replace(`${O(this,tt,"f").path.dirname(O(this,tt,"f").process.execPath())}/`,"")),t}[ne](){return O(this,Me,"f")}[Br](){return O(this,Le,"f")}[Ke](){if(!O(this,Kt,"f"))return;const t=O(this,tt,"f").getEnv("LC_ALL")||O(this,tt,"f").getEnv("LC_MESSAGES")||O(this,tt,"f").getEnv("LANG")||O(this,tt,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Rr](){return this[Qe]().version||"unknown"}[Ur](t){const e=t["--"]?t["--"]:t._;for(let n=0,s;(s=e[n])!==void 0;n++)O(this,tt,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(e[n]=Number(s));return t}[Qe](t){const e=t||"*";if(O(this,ue,"f")[e])return O(this,ue,"f")[e];let n={};try{let s=t||O(this,tt,"f").mainFilename;!t&&O(this,tt,"f").path.extname(s)&&(s=O(this,tt,"f").path.dirname(s));const i=O(this,tt,"f").findUp(s,(r,o)=>{if(o.includes("package.json"))return"package.json"});Bt(i,void 0,O(this,tt,"f")),n=JSON.parse(O(this,tt,"f").readFileSync(i,"utf8"))}catch{}return O(this,ue,"f")[e]=n||{},O(this,ue,"f")[e]}[Yt](t,e){e=[].concat(e),e.forEach(n=>{n=this[tn](n),O(this,Y,"f")[t].push(n)})}[ce](t,e,n,s){this[Ze](t,e,n,s,(i,r,o)=>{O(this,Y,"f")[i][r]=o})}[Je](t,e,n,s){this[Ze](t,e,n,s,(i,r,o)=>{O(this,Y,"f")[i][r]=(O(this,Y,"f")[i][r]||[]).concat(o)})}[Ze](t,e,n,s,i){if(Array.isArray(n))n.forEach(r=>{t(r,s)});else if((r=>typeof r=="object")(n))for(const r of Xe(n))t(r,n[r]);else i(e,this[tn](n),s)}[tn](t){return t==="__proto__"?"___proto___":t}[en](t,e){return this[ce](this[en].bind(this),"key",t,e),this}[nn](){var t,e,n,s,i,r,o,l,E,m,p,y;const w=O(this,_e,"f").pop();Bt(w,void 0,O(this,tt,"f"));let D;t=this,e=this,n=this,s=this,i=this,r=this,o=this,l=this,E=this,m=this,p=this,y=this,{options:{set value(_){H(t,Y,_,"f")}}.value,configObjects:D,exitProcess:{set value(_){H(e,At,_,"f")}}.value,groups:{set value(_){H(n,Rt,_,"f")}}.value,output:{set value(_){H(s,wt,_,"f")}}.value,exitError:{set value(_){H(i,zt,_,"f")}}.value,hasOutput:{set value(_){H(r,Dt,_,"f")}}.value,parsed:this.parsed,strict:{set value(_){H(o,Zt,_,"f")}}.value,strictCommands:{set value(_){H(l,te,_,"f")}}.value,strictOptions:{set value(_){H(E,ee,_,"f")}}.value,completionCommand:{set value(_){H(m,It,_,"f")}}.value,parseFn:{set value(_){H(p,Tt,_,"f")}}.value,parseContext:{set value(_){H(y,Qt,_,"f")}}.value}=w,O(this,Y,"f").configObjects=D,O(this,et,"f").unfreeze(),O(this,dt,"f").unfreeze(),O(this,mt,"f").unfreeze(),O(this,Mt,"f").unfreeze()}[Xr](t,e){return Ee(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[$r].bind(this),getContext:this[qr].bind(this),getHasOutput:this[Wr].bind(this),getLoggerInstance:this[Vr].bind(this),getParseContext:this[Hr].bind(this),getParserConfiguration:this[ne].bind(this),getUsageConfiguration:this[Br].bind(this),getUsageInstance:this[zr].bind(this),getValidationInstance:this[Gr].bind(this),hasParseCallback:this[Se].bind(this),isGlobalContext:this[Yr].bind(this),postProcess:this[re].bind(this),reset:this[rn].bind(this),runValidation:this[sn].bind(this),runYargsParserAndExecuteCommands:this[pe].bind(this),setHasOutput:this[Kr].bind(this)}}[$r](){return O(this,mt,"f")}[qr](){return O(this,he,"f")}[Wr](){return O(this,Dt,"f")}[Vr](){return O(this,ae,"f")}[Hr](){return O(this,Qt,"f")||{}}[zr](){return O(this,et,"f")}[Gr](){return O(this,dt,"f")}[Se](){return!!O(this,Tt,"f")}[Yr](){return O(this,Ne,"f")}[re](t,e,n,s){return n||yt(t)||(e||(t=this[Pr](t)),(this[ne]()["parse-positional-numbers"]||this[ne]()["parse-positional-numbers"]===void 0)&&(t=this[Ur](t)),s&&(t=we(t,this,O(this,Mt,"f").getMiddleware(),!1))),t}[rn](t={}){H(this,Y,O(this,Y,"f")||{},"f");const e={};e.local=O(this,Y,"f").local||[],e.configObjects=O(this,Y,"f").configObjects||[];const n={};e.local.forEach(r=>{n[r]=!0,(t[r]||[]).forEach(o=>{n[o]=!0})}),Object.assign(O(this,Jt,"f"),Object.keys(O(this,Rt,"f")).reduce((r,o)=>{const l=O(this,Rt,"f")[o].filter(E=>!(E in n));return l.length>0&&(r[o]=l),r},{})),H(this,Rt,{},"f");const s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],i=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(r=>{e[r]=(O(this,Y,"f")[r]||[]).filter(o=>!n[o])}),i.forEach(r=>{e[r]=Oe(O(this,Y,"f")[r],o=>!n[o])}),e.envPrefix=O(this,Y,"f").envPrefix,H(this,Y,e,"f"),H(this,et,O(this,et,"f")?O(this,et,"f").reset(n):wo(this,O(this,tt,"f")),"f"),H(this,dt,O(this,dt,"f")?O(this,dt,"f").reset(n):_o(this,O(this,et,"f"),O(this,tt,"f")),"f"),H(this,mt,O(this,mt,"f")?O(this,mt,"f").reset():po(O(this,et,"f"),O(this,dt,"f"),O(this,Mt,"f"),O(this,tt,"f")),"f"),O(this,Nt,"f")||H(this,Nt,Io(this,O(this,et,"f"),O(this,mt,"f"),O(this,tt,"f")),"f"),O(this,Mt,"f").reset(),H(this,It,null,"f"),H(this,wt,"","f"),H(this,zt,null,"f"),H(this,Dt,!1,"f"),this.parsed=!1,this}[kr](t,e){return O(this,tt,"f").path.relative(t,e)}[pe](t,e,n,s=0,i=!1){let r=!!n||i;t=t||O(this,Gt,"f"),O(this,Y,"f").__=O(this,tt,"f").y18n.__,O(this,Y,"f").configuration=this[ne]();const o=!!O(this,Y,"f").configuration["populate--"],l=Object.assign({},O(this,Y,"f").configuration,{"populate--":!0}),E=O(this,tt,"f").Parser.detailed(t,Object.assign({},O(this,Y,"f"),{configuration:{"parse-positional-numbers":!1,...l}})),m=Object.assign(E.argv,O(this,Qt,"f"));let p;const y=E.aliases;let w=!1,D=!1;Object.keys(m).forEach(_=>{_===O(this,Pt,"f")&&m[_]?w=!0:_===O(this,Ut,"f")&&m[_]&&(D=!0)}),m.$0=this.$0,this.parsed=E,s===0&&O(this,et,"f").clearCachedHelpMessage();try{if(this[Ke](),e)return this[re](m,o,!!n,!1);O(this,Pt,"f")&&[O(this,Pt,"f")].concat(y[O(this,Pt,"f")]||[]).filter(g=>g.length>1).includes(""+m._[m._.length-1])&&(m._.pop(),w=!0),H(this,Ne,!1,"f");const _=O(this,mt,"f").getCommands(),C=O(this,Nt,"f").completionKey in m,T=w||C||i;if(m._.length){if(_.length){let I;for(let g=s||0,v;m._[g]!==void 0;g++)if(v=String(m._[g]),_.includes(v)&&v!==O(this,It,"f")){const M=O(this,mt,"f").runCommand(v,this,E,g+1,i,w||D||i);return this[re](M,o,!!n,!1)}else if(!I&&v!==O(this,It,"f")){I=v;break}!O(this,mt,"f").hasDefaultCommand()&&O(this,Pe,"f")&&I&&!T&&O(this,dt,"f").recommendCommands(I,_)}O(this,It,"f")&&m._.includes(O(this,It,"f"))&&!C&&(O(this,At,"f")&&ge(!0),this.showCompletionScript(),this.exit(0))}if(O(this,mt,"f").hasDefaultCommand()&&!T){const I=O(this,mt,"f").runCommand(null,this,E,0,i,w||D||i);return this[re](I,o,!!n,!1)}if(C){O(this,At,"f")&&ge(!0),t=[].concat(t);const I=t.slice(t.indexOf(`--${O(this,Nt,"f").completionKey}`)+1);return O(this,Nt,"f").getCompletion(I,(g,v)=>{if(g)throw new gt(g.message);(v||[]).forEach(M=>{O(this,ae,"f").log(M)}),this.exit(0)}),this[re](m,!o,!!n,!1)}if(O(this,Dt,"f")||(w?(O(this,At,"f")&&ge(!0),r=!0,this.showHelp("log"),this.exit(0)):D&&(O(this,At,"f")&&ge(!0),r=!0,O(this,et,"f").showVersion("log"),this.exit(0))),!r&&O(this,Y,"f").skipValidation.length>0&&(r=Object.keys(m).some(I=>O(this,Y,"f").skipValidation.indexOf(I)>=0&&m[I]===!0)),!r){if(E.error)throw new gt(E.error.message);if(!C){const I=this[sn](y,{},E.error);n||(p=we(m,this,O(this,Mt,"f").getMiddleware(),!0)),p=this[Xr](I,p??m),yt(p)&&!n&&(p=p.then(()=>we(m,this,O(this,Mt,"f").getMiddleware(),!1)))}}}catch(_){if(_ instanceof gt)O(this,et,"f").fail(_.message,_);else throw _}return this[re](p??m,o,!!n,!0)}[sn](t,e,n,s){const i={...this.getDemandedOptions()};return r=>{if(n)throw new gt(n.message);O(this,dt,"f").nonOptionCount(r),O(this,dt,"f").requiredArguments(r,i);let o=!1;O(this,te,"f")&&(o=O(this,dt,"f").unknownCommands(r)),O(this,Zt,"f")&&!o?O(this,dt,"f").unknownArguments(r,t,e,!!s):O(this,ee,"f")&&O(this,dt,"f").unknownArguments(r,t,{},!1,!1),O(this,dt,"f").limitedChoices(r),O(this,dt,"f").implications(r),O(this,dt,"f").conflicting(r)}}[Kr](){H(this,Dt,!0,"f")}[ie](t){if(typeof t=="string")O(this,Y,"f").key[t]=!0;else for(const e of t)O(this,Y,"f").key[e]=!0}}function Lo(a){return!!a&&typeof a.getInternalMethods=="function"}const So=Mo(oo),Fo={};var on={},Qr;function Zn(){return Qr||(Qr=1,function(){on.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
90
+ `,"f"),H(this,wt,O(this,wt,"f")+t.join(" "),"f")}}}[ke](t){Xe(O(this,Y,"f")).forEach(e=>{if((s=>s==="configObjects")(e))return;const n=O(this,Y,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete O(this,et,"f").getDescriptions()[t]}[Sr](t,e,n){O(this,ve,"f")[n]||(O(this,tt,"f").process.emitWarning(t,e),O(this,ve,"f")[n]=!0)}[Fr](){O(this,_e,"f").push({options:O(this,Y,"f"),configObjects:O(this,Y,"f").configObjects.slice(0),exitProcess:O(this,At,"f"),groups:O(this,Rt,"f"),strict:O(this,Zt,"f"),strictCommands:O(this,te,"f"),strictOptions:O(this,ee,"f"),completionCommand:O(this,It,"f"),output:O(this,wt,"f"),exitError:O(this,zt,"f"),hasOutput:O(this,Dt,"f"),parsed:this.parsed,parseFn:O(this,Tt,"f"),parseContext:O(this,Qt,"f")}),O(this,et,"f").freeze(),O(this,dt,"f").freeze(),O(this,mt,"f").freeze(),O(this,Mt,"f").freeze()}[jr](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(O(this,tt,"f").process.argv()[0])?e=O(this,tt,"f").process.argv().slice(1,2):e=O(this,tt,"f").process.argv().slice(0,1),t=e.map(n=>{const s=this[kr](O(this,kt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),O(this,tt,"f").getEnv("_")&&O(this,tt,"f").getProcessArgvBin()===O(this,tt,"f").getEnv("_")&&(t=O(this,tt,"f").getEnv("_").replace(`${O(this,tt,"f").path.dirname(O(this,tt,"f").process.execPath())}/`,"")),t}[ne](){return O(this,Me,"f")}[Br](){return O(this,Le,"f")}[Ke](){if(!O(this,Kt,"f"))return;const t=O(this,tt,"f").getEnv("LC_ALL")||O(this,tt,"f").getEnv("LC_MESSAGES")||O(this,tt,"f").getEnv("LANG")||O(this,tt,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Rr](){return this[Qe]().version||"unknown"}[Ur](t){const e=t["--"]?t["--"]:t._;for(let n=0,s;(s=e[n])!==void 0;n++)O(this,tt,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(e[n]=Number(s));return t}[Qe](t){const e=t||"*";if(O(this,ue,"f")[e])return O(this,ue,"f")[e];let n={};try{let s=t||O(this,tt,"f").mainFilename;!t&&O(this,tt,"f").path.extname(s)&&(s=O(this,tt,"f").path.dirname(s));const i=O(this,tt,"f").findUp(s,(r,o)=>{if(o.includes("package.json"))return"package.json"});Bt(i,void 0,O(this,tt,"f")),n=JSON.parse(O(this,tt,"f").readFileSync(i,"utf8"))}catch{}return O(this,ue,"f")[e]=n||{},O(this,ue,"f")[e]}[Yt](t,e){e=[].concat(e),e.forEach(n=>{n=this[tn](n),O(this,Y,"f")[t].push(n)})}[ce](t,e,n,s){this[Ze](t,e,n,s,(i,r,o)=>{O(this,Y,"f")[i][r]=o})}[Je](t,e,n,s){this[Ze](t,e,n,s,(i,r,o)=>{O(this,Y,"f")[i][r]=(O(this,Y,"f")[i][r]||[]).concat(o)})}[Ze](t,e,n,s,i){if(Array.isArray(n))n.forEach(r=>{t(r,s)});else if((r=>typeof r=="object")(n))for(const r of Xe(n))t(r,n[r]);else i(e,this[tn](n),s)}[tn](t){return t==="__proto__"?"___proto___":t}[en](t,e){return this[ce](this[en].bind(this),"key",t,e),this}[nn](){var t,e,n,s,i,r,o,l,E,m,p,y;const w=O(this,_e,"f").pop();Bt(w,void 0,O(this,tt,"f"));let D;t=this,e=this,n=this,s=this,i=this,r=this,o=this,l=this,E=this,m=this,p=this,y=this,{options:{set value(_){H(t,Y,_,"f")}}.value,configObjects:D,exitProcess:{set value(_){H(e,At,_,"f")}}.value,groups:{set value(_){H(n,Rt,_,"f")}}.value,output:{set value(_){H(s,wt,_,"f")}}.value,exitError:{set value(_){H(i,zt,_,"f")}}.value,hasOutput:{set value(_){H(r,Dt,_,"f")}}.value,parsed:this.parsed,strict:{set value(_){H(o,Zt,_,"f")}}.value,strictCommands:{set value(_){H(l,te,_,"f")}}.value,strictOptions:{set value(_){H(E,ee,_,"f")}}.value,completionCommand:{set value(_){H(m,It,_,"f")}}.value,parseFn:{set value(_){H(p,Tt,_,"f")}}.value,parseContext:{set value(_){H(y,Qt,_,"f")}}.value}=w,O(this,Y,"f").configObjects=D,O(this,et,"f").unfreeze(),O(this,dt,"f").unfreeze(),O(this,mt,"f").unfreeze(),O(this,Mt,"f").unfreeze()}[Xr](t,e){return Ee(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[$r].bind(this),getContext:this[qr].bind(this),getHasOutput:this[Wr].bind(this),getLoggerInstance:this[Vr].bind(this),getParseContext:this[Hr].bind(this),getParserConfiguration:this[ne].bind(this),getUsageConfiguration:this[Br].bind(this),getUsageInstance:this[zr].bind(this),getValidationInstance:this[Gr].bind(this),hasParseCallback:this[Se].bind(this),isGlobalContext:this[Yr].bind(this),postProcess:this[re].bind(this),reset:this[rn].bind(this),runValidation:this[sn].bind(this),runYargsParserAndExecuteCommands:this[pe].bind(this),setHasOutput:this[Kr].bind(this)}}[$r](){return O(this,mt,"f")}[qr](){return O(this,he,"f")}[Wr](){return O(this,Dt,"f")}[Vr](){return O(this,ae,"f")}[Hr](){return O(this,Qt,"f")||{}}[zr](){return O(this,et,"f")}[Gr](){return O(this,dt,"f")}[Se](){return!!O(this,Tt,"f")}[Yr](){return O(this,Ne,"f")}[re](t,e,n,s){return n||yt(t)||(e||(t=this[Pr](t)),(this[ne]()["parse-positional-numbers"]||this[ne]()["parse-positional-numbers"]===void 0)&&(t=this[Ur](t)),s&&(t=we(t,this,O(this,Mt,"f").getMiddleware(),!1))),t}[rn](t={}){H(this,Y,O(this,Y,"f")||{},"f");const e={};e.local=O(this,Y,"f").local||[],e.configObjects=O(this,Y,"f").configObjects||[];const n={};e.local.forEach(r=>{n[r]=!0,(t[r]||[]).forEach(o=>{n[o]=!0})}),Object.assign(O(this,Jt,"f"),Object.keys(O(this,Rt,"f")).reduce((r,o)=>{const l=O(this,Rt,"f")[o].filter(E=>!(E in n));return l.length>0&&(r[o]=l),r},{})),H(this,Rt,{},"f");const s=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],i=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return s.forEach(r=>{e[r]=(O(this,Y,"f")[r]||[]).filter(o=>!n[o])}),i.forEach(r=>{e[r]=Oe(O(this,Y,"f")[r],o=>!n[o])}),e.envPrefix=O(this,Y,"f").envPrefix,H(this,Y,e,"f"),H(this,et,O(this,et,"f")?O(this,et,"f").reset(n):Eo(this,O(this,tt,"f")),"f"),H(this,dt,O(this,dt,"f")?O(this,dt,"f").reset(n):No(this,O(this,et,"f"),O(this,tt,"f")),"f"),H(this,mt,O(this,mt,"f")?O(this,mt,"f").reset():mo(O(this,et,"f"),O(this,dt,"f"),O(this,Mt,"f"),O(this,tt,"f")),"f"),O(this,Nt,"f")||H(this,Nt,Do(this,O(this,et,"f"),O(this,mt,"f"),O(this,tt,"f")),"f"),O(this,Mt,"f").reset(),H(this,It,null,"f"),H(this,wt,"","f"),H(this,zt,null,"f"),H(this,Dt,!1,"f"),this.parsed=!1,this}[kr](t,e){return O(this,tt,"f").path.relative(t,e)}[pe](t,e,n,s=0,i=!1){let r=!!n||i;t=t||O(this,Gt,"f"),O(this,Y,"f").__=O(this,tt,"f").y18n.__,O(this,Y,"f").configuration=this[ne]();const o=!!O(this,Y,"f").configuration["populate--"],l=Object.assign({},O(this,Y,"f").configuration,{"populate--":!0}),E=O(this,tt,"f").Parser.detailed(t,Object.assign({},O(this,Y,"f"),{configuration:{"parse-positional-numbers":!1,...l}})),m=Object.assign(E.argv,O(this,Qt,"f"));let p;const y=E.aliases;let w=!1,D=!1;Object.keys(m).forEach(_=>{_===O(this,Pt,"f")&&m[_]?w=!0:_===O(this,Ut,"f")&&m[_]&&(D=!0)}),m.$0=this.$0,this.parsed=E,s===0&&O(this,et,"f").clearCachedHelpMessage();try{if(this[Ke](),e)return this[re](m,o,!!n,!1);O(this,Pt,"f")&&[O(this,Pt,"f")].concat(y[O(this,Pt,"f")]||[]).filter(g=>g.length>1).includes(""+m._[m._.length-1])&&(m._.pop(),w=!0),H(this,Ne,!1,"f");const _=O(this,mt,"f").getCommands(),C=O(this,Nt,"f").completionKey in m,T=w||C||i;if(m._.length){if(_.length){let I;for(let g=s||0,v;m._[g]!==void 0;g++)if(v=String(m._[g]),_.includes(v)&&v!==O(this,It,"f")){const M=O(this,mt,"f").runCommand(v,this,E,g+1,i,w||D||i);return this[re](M,o,!!n,!1)}else if(!I&&v!==O(this,It,"f")){I=v;break}!O(this,mt,"f").hasDefaultCommand()&&O(this,Pe,"f")&&I&&!T&&O(this,dt,"f").recommendCommands(I,_)}O(this,It,"f")&&m._.includes(O(this,It,"f"))&&!C&&(O(this,At,"f")&&ge(!0),this.showCompletionScript(),this.exit(0))}if(O(this,mt,"f").hasDefaultCommand()&&!T){const I=O(this,mt,"f").runCommand(null,this,E,0,i,w||D||i);return this[re](I,o,!!n,!1)}if(C){O(this,At,"f")&&ge(!0),t=[].concat(t);const I=t.slice(t.indexOf(`--${O(this,Nt,"f").completionKey}`)+1);return O(this,Nt,"f").getCompletion(I,(g,v)=>{if(g)throw new gt(g.message);(v||[]).forEach(M=>{O(this,ae,"f").log(M)}),this.exit(0)}),this[re](m,!o,!!n,!1)}if(O(this,Dt,"f")||(w?(O(this,At,"f")&&ge(!0),r=!0,this.showHelp("log"),this.exit(0)):D&&(O(this,At,"f")&&ge(!0),r=!0,O(this,et,"f").showVersion("log"),this.exit(0))),!r&&O(this,Y,"f").skipValidation.length>0&&(r=Object.keys(m).some(I=>O(this,Y,"f").skipValidation.indexOf(I)>=0&&m[I]===!0)),!r){if(E.error)throw new gt(E.error.message);if(!C){const I=this[sn](y,{},E.error);n||(p=we(m,this,O(this,Mt,"f").getMiddleware(),!0)),p=this[Xr](I,p??m),yt(p)&&!n&&(p=p.then(()=>we(m,this,O(this,Mt,"f").getMiddleware(),!1)))}}}catch(_){if(_ instanceof gt)O(this,et,"f").fail(_.message,_);else throw _}return this[re](p??m,o,!!n,!0)}[sn](t,e,n,s){const i={...this.getDemandedOptions()};return r=>{if(n)throw new gt(n.message);O(this,dt,"f").nonOptionCount(r),O(this,dt,"f").requiredArguments(r,i);let o=!1;O(this,te,"f")&&(o=O(this,dt,"f").unknownCommands(r)),O(this,Zt,"f")&&!o?O(this,dt,"f").unknownArguments(r,t,e,!!s):O(this,ee,"f")&&O(this,dt,"f").unknownArguments(r,t,{},!1,!1),O(this,dt,"f").limitedChoices(r),O(this,dt,"f").implications(r),O(this,dt,"f").conflicting(r)}}[Kr](){H(this,Dt,!0,"f")}[ie](t){if(typeof t=="string")O(this,Y,"f").key[t]=!0;else for(const e of t)O(this,Y,"f").key[e]=!0}}function So(a){return!!a&&typeof a.getInternalMethods=="function"}const Fo=Po(ao);var on={},Qr;function Zn(){return Qr||(Qr=1,function(){on.defaults={"0.1":{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},"0.2":{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:`
91
91
  `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(it)),on}var an={},Wt={},Vt={},Jr;function Ht(){return Jr||(Jr=1,function(){var a,t,e,n,s,i,r,o=[].slice,l={}.hasOwnProperty;a=function(){var E,m,p,y,w,D;if(D=arguments[0],w=2<=arguments.length?o.call(arguments,1):[],s(Object.assign))Object.assign.apply(null,arguments);else for(E=0,p=w.length;E<p;E++)if(y=w[E],y!=null)for(m in y)l.call(y,m)&&(D[m]=y[m]);return D},s=function(E){return!!E&&Object.prototype.toString.call(E)==="[object Function]"},i=function(E){var m;return!!E&&((m=typeof E)=="function"||m==="object")},e=function(E){return s(Array.isArray)?Array.isArray(E):Object.prototype.toString.call(E)==="[object Array]"},n=function(E){var m;if(e(E))return!E.length;for(m in E)if(l.call(E,m))return!1;return!0},r=function(E){var m,p;return i(E)&&(p=Object.getPrototypeOf(E))&&(m=p.constructor)&&typeof m=="function"&&m instanceof m&&Function.prototype.toString.call(m)===Function.prototype.toString.call(Object)},t=function(E){return s(E.valueOf)?E.valueOf():E},Vt.assign=a,Vt.isFunction=s,Vt.isObject=i,Vt.isArray=e,Vt.isEmpty=n,Vt.isPlainObject=r,Vt.getValue=t}.call(it)),Vt}var un={exports:{}},Zr;function os(){return Zr||(Zr=1,function(){un.exports=function(){function a(){}return a.prototype.hasFeature=function(t,e){return!0},a.prototype.createDocumentType=function(t,e,n){throw new Error("This DOM method is not implemented.")},a.prototype.createDocument=function(t,e,n){throw new Error("This DOM method is not implemented.")},a.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},a.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented.")},a}()}.call(it)),un.exports}var cn={exports:{}},ln={exports:{}},fn={exports:{}},ti;function jo(){return ti||(ti=1,function(){fn.exports=function(){function a(){}return a.prototype.handleError=function(t){throw new Error(t)},a}()}.call(it)),fn.exports}var hn={exports:{}},ei;function Bo(){return ei||(ei=1,function(){hn.exports=function(){function a(t){this.arr=t||[]}return Object.defineProperty(a.prototype,"length",{get:function(){return this.arr.length}}),a.prototype.item=function(t){return this.arr[t]||null},a.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},a}()}.call(it)),hn.exports}var ni;function Ro(){return ni||(ni=1,function(){var a,t;a=jo(),t=Bo(),ln.exports=function(){function e(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new a,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(e.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),e.prototype.getParameter=function(n){return this.params.hasOwnProperty(n)?this.params[n]:null},e.prototype.canSetParameter=function(n,s){return!0},e.prototype.setParameter=function(n,s){return s!=null?this.params[n]=s:delete this.params[n]},e}()}.call(it)),ln.exports}var pn={exports:{}},dn={exports:{}},mn={exports:{}},ri;function bt(){return ri||(ri=1,function(){mn.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}.call(it)),mn.exports}var gn={exports:{}},ii;function as(){return ii||(ii=1,function(){var a;a=bt(),St(),gn.exports=function(){function t(e,n,s){if(this.parent=e,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),n==null)throw new Error("Missing attribute name. "+this.debugInfo(n));this.name=this.stringify.name(n),this.value=this.stringify.attValue(s),this.type=a.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(e){return this.value=e||""}}),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(t.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(t.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"specified",{get:function(){return!0}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.toString=function(e){return this.options.writer.attribute(this,this.options.writer.filterOptions(e))},t.prototype.debugInfo=function(e){return e=e||this.name,e==null?"parent: <"+this.parent.name+">":"attribute: {"+e+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(e){return!(e.namespaceURI!==this.namespaceURI||e.prefix!==this.prefix||e.localName!==this.localName||e.value!==this.value)},t}()}.call(it)),gn.exports}var yn={exports:{}},si;function tr(){return si||(si=1,function(){yn.exports=function(){function a(t){this.nodes=t}return Object.defineProperty(a.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),a.prototype.clone=function(){return this.nodes=null},a.prototype.getNamedItem=function(t){return this.nodes[t]},a.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},a.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},a.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},a.prototype.getNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},a.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},a.prototype.removeNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},a}()}.call(it)),yn.exports}var oi;function er(){return oi||(oi=1,function(){var a,t,e,n,s,i,r,o,l=function(m,p){for(var y in p)E.call(p,y)&&(m[y]=p[y]);function w(){this.constructor=m}return w.prototype=p.prototype,m.prototype=new w,m.__super__=p.prototype,m},E={}.hasOwnProperty;o=Ht(),r=o.isObject,i=o.isFunction,s=o.getValue,n=St(),a=bt(),t=as(),e=tr(),dn.exports=function(m){l(p,m);function p(y,w,D){var _,C,T,I;if(p.__super__.constructor.call(this,y),w==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(w),this.type=a.Element,this.attribs={},this.schemaTypeInfo=null,D!=null&&this.attribute(D),y.type===a.Document&&(this.isRoot=!0,this.documentObject=y,y.rootObject=this,y.children)){for(I=y.children,C=0,T=I.length;C<T;C++)if(_=I[C],_.type===a.DocType){_.name=this.name;break}}}return Object.defineProperty(p.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(p.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(p.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(p.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(p.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new e(this.attribs)),this.attributeMap}}),p.prototype.clone=function(){var y,w,D,_;D=Object.create(this),D.isRoot&&(D.documentObject=null),D.attribs={},_=this.attribs;for(w in _)E.call(_,w)&&(y=_[w],D.attribs[w]=y.clone());return D.children=[],this.children.forEach(function(C){var T;return T=C.clone(),T.parent=D,D.children.push(T)}),D},p.prototype.attribute=function(y,w){var D,_;if(y!=null&&(y=s(y)),r(y))for(D in y)E.call(y,D)&&(_=y[D],this.attribute(D,_));else i(w)&&(w=w.apply()),this.options.keepNullAttributes&&w==null?this.attribs[y]=new t(this,y,""):w!=null&&(this.attribs[y]=new t(this,y,w));return this},p.prototype.removeAttribute=function(y){var w,D,_;if(y==null)throw new Error("Missing attribute name. "+this.debugInfo());if(y=s(y),Array.isArray(y))for(D=0,_=y.length;D<_;D++)w=y[D],delete this.attribs[w];else delete this.attribs[y];return this},p.prototype.toString=function(y){return this.options.writer.element(this,this.options.writer.filterOptions(y))},p.prototype.att=function(y,w){return this.attribute(y,w)},p.prototype.a=function(y,w){return this.attribute(y,w)},p.prototype.getAttribute=function(y){return this.attribs.hasOwnProperty(y)?this.attribs[y].value:null},p.prototype.setAttribute=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNode=function(y){return this.attribs.hasOwnProperty(y)?this.attribs[y]:null},p.prototype.setAttributeNode=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.removeAttributeNode=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNS=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setAttributeNS=function(y,w,D){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.removeAttributeNS=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNodeNS=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setAttributeNodeNS=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.hasAttribute=function(y){return this.attribs.hasOwnProperty(y)},p.prototype.hasAttributeNS=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setIdAttribute=function(y,w){return this.attribs.hasOwnProperty(y)?this.attribs[y].isId:w},p.prototype.setIdAttributeNS=function(y,w,D){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setIdAttributeNode=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByClassName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.isEqualNode=function(y){var w,D,_;if(!p.__super__.isEqualNode.apply(this,arguments).isEqualNode(y)||y.namespaceURI!==this.namespaceURI||y.prefix!==this.prefix||y.localName!==this.localName||y.attribs.length!==this.attribs.length)return!1;for(w=D=0,_=this.attribs.length-1;0<=_?D<=_:D>=_;w=0<=_?++D:--D)if(!this.attribs[w].isEqualNode(y.attribs[w]))return!1;return!0},p}(n)}.call(it)),dn.exports}var bn={exports:{}},wn={exports:{}},ai;function qe(){return ai||(ai=1,function(){var a,t=function(n,s){for(var i in s)e.call(s,i)&&(n[i]=s[i]);function r(){this.constructor=n}return r.prototype=s.prototype,n.prototype=new r,n.__super__=s.prototype,n},e={}.hasOwnProperty;a=St(),wn.exports=function(n){t(s,n);function s(i){s.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(s.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(s.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(s.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),s.prototype.clone=function(){return Object.create(this)},s.prototype.substringData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.insertData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.deleteData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.replaceData=function(i,r,o){throw new Error("This DOM method is not implemented."+this.debugInfo())},s.prototype.isEqualNode=function(i){return!(!s.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},s}(a)}.call(it)),wn.exports}var ui;function nr(){return ui||(ui=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;a=bt(),t=qe(),bn.exports=function(s){e(i,s);function i(r,o){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=a.CData,this.value=this.stringify.cdata(o)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.cdata(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),bn.exports}var En={exports:{}},ci;function rr(){return ci||(ci=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;a=bt(),t=qe(),En.exports=function(s){e(i,s);function i(r,o){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=a.Comment,this.value=this.stringify.comment(o)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.comment(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),En.exports}var xn={exports:{}},li;function ir(){return li||(li=1,function(){var a,t,e,n=function(i,r){for(var o in r)s.call(r,o)&&(i[o]=r[o]);function l(){this.constructor=i}return l.prototype=r.prototype,i.prototype=new l,i.__super__=r.prototype,i},s={}.hasOwnProperty;e=Ht().isObject,t=St(),a=bt(),xn.exports=function(i){n(r,i);function r(o,l,E,m){var p;r.__super__.constructor.call(this,o),e(l)&&(p=l,l=p.version,E=p.encoding,m=p.standalone),l||(l="1.0"),this.type=a.Declaration,this.version=this.stringify.xmlVersion(l),E!=null&&(this.encoding=this.stringify.xmlEncoding(E)),m!=null&&(this.standalone=this.stringify.xmlStandalone(m))}return r.prototype.toString=function(o){return this.options.writer.declaration(this,this.options.writer.filterOptions(o))},r}(t)}.call(it)),xn.exports}var On={exports:{}},Cn={exports:{}},fi;function sr(){return fi||(fi=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=St(),a=bt(),Cn.exports=function(s){e(i,s);function i(r,o,l,E,m,p){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(l==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(o));if(!E)throw new Error("Missing DTD attribute type. "+this.debugInfo(o));if(!m)throw new Error("Missing DTD attribute default. "+this.debugInfo(o));if(m.indexOf("#")!==0&&(m="#"+m),!m.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(o));if(p&&!m.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(o));this.elementName=this.stringify.name(o),this.type=a.AttributeDeclaration,this.attributeName=this.stringify.name(l),this.attributeType=this.stringify.dtdAttType(E),p&&(this.defaultValue=this.stringify.dtdAttDefault(p)),this.defaultValueType=m}return i.prototype.toString=function(r){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),Cn.exports}var In={exports:{}},hi;function or(){return hi||(hi=1,function(){var a,t,e,n=function(i,r){for(var o in r)s.call(r,o)&&(i[o]=r[o]);function l(){this.constructor=i}return l.prototype=r.prototype,i.prototype=new l,i.__super__=r.prototype,i},s={}.hasOwnProperty;e=Ht().isObject,t=St(),a=bt(),In.exports=function(i){n(r,i);function r(o,l,E,m){if(r.__super__.constructor.call(this,o),E==null)throw new Error("Missing DTD entity name. "+this.debugInfo(E));if(m==null)throw new Error("Missing DTD entity value. "+this.debugInfo(E));if(this.pe=!!l,this.name=this.stringify.name(E),this.type=a.EntityDeclaration,!e(m))this.value=this.stringify.dtdEntityValue(m),this.internal=!0;else{if(!m.pubID&&!m.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(E));if(m.pubID&&!m.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(E));if(this.internal=!1,m.pubID!=null&&(this.pubID=this.stringify.dtdPubID(m.pubID)),m.sysID!=null&&(this.sysID=this.stringify.dtdSysID(m.sysID)),m.nData!=null&&(this.nData=this.stringify.dtdNData(m.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(E))}}return Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(r.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(r.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlVersion",{get:function(){return null}}),r.prototype.toString=function(o){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(o))},r}(t)}.call(it)),In.exports}var Dn={exports:{}},pi;function ar(){return pi||(pi=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=St(),a=bt(),Dn.exports=function(s){e(i,s);function i(r,o,l){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing DTD element name. "+this.debugInfo());l||(l="(#PCDATA)"),Array.isArray(l)&&(l="("+l.join(",")+")"),this.name=this.stringify.name(o),this.type=a.ElementDeclaration,this.value=this.stringify.dtdElementValue(l)}return i.prototype.toString=function(r){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),Dn.exports}var Tn={exports:{}},di;function ur(){return di||(di=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=St(),a=bt(),Tn.exports=function(s){e(i,s);function i(r,o,l){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing DTD notation name. "+this.debugInfo(o));if(!l.pubID&&!l.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(o));this.name=this.stringify.name(o),this.type=a.NotationDeclaration,l.pubID!=null&&(this.pubID=this.stringify.dtdPubID(l.pubID)),l.sysID!=null&&(this.sysID=this.stringify.dtdSysID(l.sysID))}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),i.prototype.toString=function(r){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),Tn.exports}var mi;function cr(){return mi||(mi=1,function(){var a,t,e,n,s,i,r,o,l=function(m,p){for(var y in p)E.call(p,y)&&(m[y]=p[y]);function w(){this.constructor=m}return w.prototype=p.prototype,m.prototype=new w,m.__super__=p.prototype,m},E={}.hasOwnProperty;o=Ht().isObject,r=St(),a=bt(),t=sr(),n=or(),e=ar(),s=ur(),i=tr(),On.exports=function(m){l(p,m);function p(y,w,D){var _,C,T,I,g,v;if(p.__super__.constructor.call(this,y),this.type=a.DocType,y.children){for(I=y.children,C=0,T=I.length;C<T;C++)if(_=I[C],_.type===a.Element){this.name=_.name;break}}this.documentObject=y,o(w)&&(g=w,w=g.pubID,D=g.sysID),D==null&&(v=[w,D],D=v[0],w=v[1]),w!=null&&(this.pubID=this.stringify.dtdPubID(w)),D!=null&&(this.sysID=this.stringify.dtdSysID(D))}return Object.defineProperty(p.prototype,"entities",{get:function(){var y,w,D,_,C;for(_={},C=this.children,w=0,D=C.length;w<D;w++)y=C[w],y.type===a.EntityDeclaration&&!y.pe&&(_[y.name]=y);return new i(_)}}),Object.defineProperty(p.prototype,"notations",{get:function(){var y,w,D,_,C;for(_={},C=this.children,w=0,D=C.length;w<D;w++)y=C[w],y.type===a.NotationDeclaration&&(_[y.name]=y);return new i(_)}}),Object.defineProperty(p.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(p.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(p.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),p.prototype.element=function(y,w){var D;return D=new e(this,y,w),this.children.push(D),this},p.prototype.attList=function(y,w,D,_,C){var T;return T=new t(this,y,w,D,_,C),this.children.push(T),this},p.prototype.entity=function(y,w){var D;return D=new n(this,!1,y,w),this.children.push(D),this},p.prototype.pEntity=function(y,w){var D;return D=new n(this,!0,y,w),this.children.push(D),this},p.prototype.notation=function(y,w){var D;return D=new s(this,y,w),this.children.push(D),this},p.prototype.toString=function(y){return this.options.writer.docType(this,this.options.writer.filterOptions(y))},p.prototype.ele=function(y,w){return this.element(y,w)},p.prototype.att=function(y,w,D,_,C){return this.attList(y,w,D,_,C)},p.prototype.ent=function(y,w){return this.entity(y,w)},p.prototype.pent=function(y,w){return this.pEntity(y,w)},p.prototype.not=function(y,w){return this.notation(y,w)},p.prototype.up=function(){return this.root()||this.documentObject},p.prototype.isEqualNode=function(y){return!(!p.__super__.isEqualNode.apply(this,arguments).isEqualNode(y)||y.name!==this.name||y.publicId!==this.publicId||y.systemId!==this.systemId)},p}(r)}.call(it)),On.exports}var vn={exports:{}},gi;function lr(){return gi||(gi=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;a=bt(),t=St(),vn.exports=function(s){e(i,s);function i(r,o){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=a.Raw,this.value=this.stringify.raw(o)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.raw(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),vn.exports}var _n={exports:{}},yi;function fr(){return yi||(yi=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;a=bt(),t=qe(),_n.exports=function(s){e(i,s);function i(r,o){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=a.Text,this.value=this.stringify.text(o)}return Object.defineProperty(i.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(i.prototype,"wholeText",{get:function(){var r,o,l;for(l="",o=this.previousSibling;o;)l=o.data+l,o=o.previousSibling;for(l+=this.data,r=this.nextSibling;r;)l=l+r.data,r=r.nextSibling;return l}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.text(this,this.options.writer.filterOptions(r))},i.prototype.splitText=function(r){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(r){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(it)),_n.exports}var Nn={exports:{}},bi;function hr(){return bi||(bi=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;a=bt(),t=qe(),Nn.exports=function(s){e(i,s);function i(r,o,l){if(i.__super__.constructor.call(this,r),o==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=a.ProcessingInstruction,this.target=this.stringify.insTarget(o),this.name=this.target,l&&(this.value=this.stringify.insValue(l))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(r))},i.prototype.isEqualNode=function(r){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(r)||r.target!==this.target)},i}(t)}.call(it)),Nn.exports}var An={exports:{}},wi;function us(){return wi||(wi=1,function(){var a,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function o(){this.constructor=s}return o.prototype=i.prototype,s.prototype=new o,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=St(),a=bt(),An.exports=function(s){e(i,s);function i(r){i.__super__.constructor.call(this,r),this.type=a.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return""},i}(t)}.call(it)),An.exports}var Mn={exports:{}},Ei;function Uo(){return Ei||(Ei=1,function(){Mn.exports=function(){function a(t){this.nodes=t}return Object.defineProperty(a.prototype,"length",{get:function(){return this.nodes.length||0}}),a.prototype.clone=function(){return this.nodes=null},a.prototype.item=function(t){return this.nodes[t]||null},a}()}.call(it)),Mn.exports}var Pn={exports:{}},xi;function Xo(){return xi||(xi=1,function(){Pn.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(it)),Pn.exports}var Oi;function St(){return Oi||(Oi=1,function(){var a,t,e,n,s,i,r,o,l,E,m,p,y,w,D,_,C,T={}.hasOwnProperty;C=Ht(),_=C.isObject,D=C.isFunction,w=C.isEmpty,y=C.getValue,o=null,e=null,n=null,s=null,i=null,m=null,p=null,E=null,r=null,t=null,l=null,a=null,pn.exports=function(){function I(g){this.parent=g,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,o||(o=er(),e=nr(),n=rr(),s=ir(),i=cr(),m=lr(),p=fr(),E=hr(),r=us(),t=bt(),l=Uo(),tr(),a=Xo())}return Object.defineProperty(I.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(I.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(I.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(I.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(I.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(I.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(I.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(I.prototype,"previousSibling",{get:function(){var g;return g=this.parent.children.indexOf(this),this.parent.children[g-1]||null}}),Object.defineProperty(I.prototype,"nextSibling",{get:function(){var g;return g=this.parent.children.indexOf(this),this.parent.children[g+1]||null}}),Object.defineProperty(I.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(I.prototype,"textContent",{get:function(){var g,v,M,X,q;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(q="",X=this.children,v=0,M=X.length;v<M;v++)g=X[v],g.textContent&&(q+=g.textContent);return q}else return null},set:function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),I.prototype.setParent=function(g){var v,M,X,q,U;for(this.parent=g,g&&(this.options=g.options,this.stringify=g.stringify),q=this.children,U=[],M=0,X=q.length;M<X;M++)v=q[M],U.push(v.setParent(this));return U},I.prototype.element=function(g,v,M){var X,q,U,d,B,S,R,$,W,G,k;if(S=null,v===null&&M==null&&(W=[{},null],v=W[0],M=W[1]),v==null&&(v={}),v=y(v),_(v)||(G=[v,M],M=G[0],v=G[1]),g!=null&&(g=y(g)),Array.isArray(g))for(U=0,R=g.length;U<R;U++)q=g[U],S=this.element(q);else if(D(g))S=this.element(g.apply());else if(_(g)){for(B in g)if(T.call(g,B))if(k=g[B],D(k)&&(k=k.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&B.indexOf(this.stringify.convertAttKey)===0)S=this.attribute(B.substr(this.stringify.convertAttKey.length),k);else if(!this.options.separateArrayItems&&Array.isArray(k)&&w(k))S=this.dummy();else if(_(k)&&w(k))S=this.element(B);else if(!this.options.keepNullNodes&&k==null)S=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(k))for(d=0,$=k.length;d<$;d++)q=k[d],X={},X[B]=q,S=this.element(X);else _(k)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&B.indexOf(this.stringify.convertTextKey)===0?S=this.element(k):(S=this.element(B),S.element(k)):S=this.element(B,k)}else!this.options.keepNullNodes&&M===null?S=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&g.indexOf(this.stringify.convertTextKey)===0?S=this.text(M):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&g.indexOf(this.stringify.convertCDataKey)===0?S=this.cdata(M):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&g.indexOf(this.stringify.convertCommentKey)===0?S=this.comment(M):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&g.indexOf(this.stringify.convertRawKey)===0?S=this.raw(M):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&g.indexOf(this.stringify.convertPIKey)===0?S=this.instruction(g.substr(this.stringify.convertPIKey.length),M):S=this.node(g,v,M);if(S==null)throw new Error("Could not create any elements with: "+g+". "+this.debugInfo());return S},I.prototype.insertBefore=function(g,v,M){var X,q,U,d,B;if(g?.type)return U=g,d=v,U.setParent(this),d?(q=children.indexOf(d),B=children.splice(q),children.push(U),Array.prototype.push.apply(children,B)):children.push(U),U;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(g));return q=this.parent.children.indexOf(this),B=this.parent.children.splice(q),X=this.parent.element(g,v,M),Array.prototype.push.apply(this.parent.children,B),X},I.prototype.insertAfter=function(g,v,M){var X,q,U;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(g));return q=this.parent.children.indexOf(this),U=this.parent.children.splice(q+1),X=this.parent.element(g,v,M),Array.prototype.push.apply(this.parent.children,U),X},I.prototype.remove=function(){var g;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return g=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[g,g-g+1].concat([])),this.parent},I.prototype.node=function(g,v,M){var X,q;return g!=null&&(g=y(g)),v||(v={}),v=y(v),_(v)||(q=[v,M],M=q[0],v=q[1]),X=new o(this,g,v),M!=null&&X.text(M),this.children.push(X),X},I.prototype.text=function(g){var v;return _(g)&&this.element(g),v=new p(this,g),this.children.push(v),this},I.prototype.cdata=function(g){var v;return v=new e(this,g),this.children.push(v),this},I.prototype.comment=function(g){var v;return v=new n(this,g),this.children.push(v),this},I.prototype.commentBefore=function(g){var v,M;return v=this.parent.children.indexOf(this),M=this.parent.children.splice(v),this.parent.comment(g),Array.prototype.push.apply(this.parent.children,M),this},I.prototype.commentAfter=function(g){var v,M;return v=this.parent.children.indexOf(this),M=this.parent.children.splice(v+1),this.parent.comment(g),Array.prototype.push.apply(this.parent.children,M),this},I.prototype.raw=function(g){var v;return v=new m(this,g),this.children.push(v),this},I.prototype.dummy=function(){var g;return g=new r(this),g},I.prototype.instruction=function(g,v){var M,X,q,U,d;if(g!=null&&(g=y(g)),v!=null&&(v=y(v)),Array.isArray(g))for(U=0,d=g.length;U<d;U++)M=g[U],this.instruction(M);else if(_(g))for(M in g)T.call(g,M)&&(X=g[M],this.instruction(M,X));else D(v)&&(v=v.apply()),q=new E(this,g,v),this.children.push(q);return this},I.prototype.instructionBefore=function(g,v){var M,X;return M=this.parent.children.indexOf(this),X=this.parent.children.splice(M),this.parent.instruction(g,v),Array.prototype.push.apply(this.parent.children,X),this},I.prototype.instructionAfter=function(g,v){var M,X;return M=this.parent.children.indexOf(this),X=this.parent.children.splice(M+1),this.parent.instruction(g,v),Array.prototype.push.apply(this.parent.children,X),this},I.prototype.declaration=function(g,v,M){var X,q;return X=this.document(),q=new s(X,g,v,M),X.children.length===0?X.children.unshift(q):X.children[0].type===t.Declaration?X.children[0]=q:X.children.unshift(q),X.root()||X},I.prototype.dtd=function(g,v){var M,X,q,U,d,B,S,R,$,W;for(X=this.document(),q=new i(X,g,v),$=X.children,U=d=0,S=$.length;d<S;U=++d)if(M=$[U],M.type===t.DocType)return X.children[U]=q,q;for(W=X.children,U=B=0,R=W.length;B<R;U=++B)if(M=W[U],M.isRoot)return X.children.splice(U,0,q),q;return X.children.push(q),q},I.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},I.prototype.root=function(){var g;for(g=this;g;){if(g.type===t.Document)return g.rootObject;if(g.isRoot)return g;g=g.parent}},I.prototype.document=function(){var g;for(g=this;g;){if(g.type===t.Document)return g;g=g.parent}},I.prototype.end=function(g){return this.document().end(g)},I.prototype.prev=function(){var g;if(g=this.parent.children.indexOf(this),g<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[g-1]},I.prototype.next=function(){var g;if(g=this.parent.children.indexOf(this),g===-1||g===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[g+1]},I.prototype.importDocument=function(g){var v;return v=g.root().clone(),v.parent=this,v.isRoot=!1,this.children.push(v),this},I.prototype.debugInfo=function(g){var v,M;return g=g||this.name,g==null&&!((v=this.parent)!=null&&v.name)?"":g==null?"parent: <"+this.parent.name+">":(M=this.parent)!=null&&M.name?"node: <"+g+">, parent: <"+this.parent.name+">":"node: <"+g+">"},I.prototype.ele=function(g,v,M){return this.element(g,v,M)},I.prototype.nod=function(g,v,M){return this.node(g,v,M)},I.prototype.txt=function(g){return this.text(g)},I.prototype.dat=function(g){return this.cdata(g)},I.prototype.com=function(g){return this.comment(g)},I.prototype.ins=function(g,v){return this.instruction(g,v)},I.prototype.doc=function(){return this.document()},I.prototype.dec=function(g,v,M){return this.declaration(g,v,M)},I.prototype.e=function(g,v,M){return this.element(g,v,M)},I.prototype.n=function(g,v,M){return this.node(g,v,M)},I.prototype.t=function(g){return this.text(g)},I.prototype.d=function(g){return this.cdata(g)},I.prototype.c=function(g){return this.comment(g)},I.prototype.r=function(g){return this.raw(g)},I.prototype.i=function(g,v){return this.instruction(g,v)},I.prototype.u=function(){return this.up()},I.prototype.importXMLBuilder=function(g){return this.importDocument(g)},I.prototype.replaceChild=function(g,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.removeChild=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.appendChild=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.hasChildNodes=function(){return this.children.length!==0},I.prototype.cloneNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.isSupported=function(g,v){return!0},I.prototype.hasAttributes=function(){return this.attribs.length!==0},I.prototype.compareDocumentPosition=function(g){var v,M;return v=this,v===g?0:this.document()!==g.document()?(M=a.Disconnected|a.ImplementationSpecific,Math.random()<.5?M|=a.Preceding:M|=a.Following,M):v.isAncestor(g)?a.Contains|a.Preceding:v.isDescendant(g)?a.Contains|a.Following:v.isPreceding(g)?a.Preceding:a.Following},I.prototype.isSameNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.lookupPrefix=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.isDefaultNamespace=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.lookupNamespaceURI=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.isEqualNode=function(g){var v,M,X;if(g.nodeType!==this.nodeType||g.children.length!==this.children.length)return!1;for(v=M=0,X=this.children.length-1;0<=X?M<=X:M>=X;v=0<=X?++M:--M)if(!this.children[v].isEqualNode(g.children[v]))return!1;return!0},I.prototype.getFeature=function(g,v){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.setUserData=function(g,v,M){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getUserData=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.contains=function(g){return g?g===this||this.isDescendant(g):!1},I.prototype.isDescendant=function(g){var v,M,X,q,U;for(U=this.children,X=0,q=U.length;X<q;X++)if(v=U[X],g===v||(M=v.isDescendant(g),M))return!0;return!1},I.prototype.isAncestor=function(g){return g.isDescendant(this)},I.prototype.isPreceding=function(g){var v,M;return v=this.treePosition(g),M=this.treePosition(this),v===-1||M===-1?!1:v<M},I.prototype.isFollowing=function(g){var v,M;return v=this.treePosition(g),M=this.treePosition(this),v===-1||M===-1?!1:v>M},I.prototype.treePosition=function(g){var v,M;return M=0,v=!1,this.foreachTreeNode(this.document(),function(X){if(M++,!v&&X===g)return v=!0}),v?M:-1},I.prototype.foreachTreeNode=function(g,v){var M,X,q,U,d;for(g||(g=this.document()),U=g.children,X=0,q=U.length;X<q;X++){if(M=U[X],d=v(M))return d;if(d=this.foreachTreeNode(M,v),d)return d}},I}()}.call(it)),pn.exports}var Ln={exports:{}},Ci;function cs(){return Ci||(Ci=1,function(){var a=function(e,n){return function(){return e.apply(n,arguments)}},t={}.hasOwnProperty;Ln.exports=function(){function e(n){this.assertLegalName=a(this.assertLegalName,this),this.assertLegalChar=a(this.assertLegalChar,this);var s,i,r;n||(n={}),this.options=n,this.options.version||(this.options.version="1.0"),i=n.stringify||{};for(s in i)t.call(i,s)&&(r=i[s],this[s]=r)}return e.prototype.name=function(n){return this.options.noValidation?n:this.assertLegalName(""+n||"")},e.prototype.text=function(n){return this.options.noValidation?n:this.assertLegalChar(this.textEscape(""+n||""))},e.prototype.cdata=function(n){return this.options.noValidation?n:(n=""+n||"",n=n.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(n))},e.prototype.comment=function(n){if(this.options.noValidation)return n;if(n=""+n||"",n.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+n);return this.assertLegalChar(n)},e.prototype.raw=function(n){return this.options.noValidation?n:""+n||""},e.prototype.attValue=function(n){return this.options.noValidation?n:this.assertLegalChar(this.attEscape(n=""+n||""))},e.prototype.insTarget=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.insValue=function(n){if(this.options.noValidation)return n;if(n=""+n||"",n.match(/\?>/))throw new Error("Invalid processing instruction value: "+n);return this.assertLegalChar(n)},e.prototype.xmlVersion=function(n){if(this.options.noValidation)return n;if(n=""+n||"",!n.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+n);return n},e.prototype.xmlEncoding=function(n){if(this.options.noValidation)return n;if(n=""+n||"",!n.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+n);return this.assertLegalChar(n)},e.prototype.xmlStandalone=function(n){return this.options.noValidation?n:n?"yes":"no"},e.prototype.dtdPubID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdSysID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdElementValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdAttType=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdAttDefault=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdEntityValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.dtdNData=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},e.prototype.convertAttKey="@",e.prototype.convertPIKey="?",e.prototype.convertTextKey="#text",e.prototype.convertCDataKey="#cdata",e.prototype.convertCommentKey="#comment",e.prototype.convertRawKey="#raw",e.prototype.assertLegalChar=function(n){var s,i;if(this.options.noValidation)return n;if(s="",this.options.version==="1.0"){if(s=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=n.match(s))throw new Error("Invalid character in string: "+n+" at index "+i.index)}else if(this.options.version==="1.1"&&(s=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=n.match(s)))throw new Error("Invalid character in string: "+n+" at index "+i.index);return n},e.prototype.assertLegalName=function(n){var s;if(this.options.noValidation)return n;if(this.assertLegalChar(n),s=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!n.match(s))throw new Error("Invalid character in name");return n},e.prototype.textEscape=function(n){var s;return this.options.noValidation?n:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},e.prototype.attEscape=function(n){var s;return this.options.noValidation?n:(s=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(s,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},e}()}.call(it)),Ln.exports}var Sn={exports:{}},Fn={exports:{}},jn={exports:{}},Ii;function We(){return Ii||(Ii=1,function(){jn.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(it)),jn.exports}var Di;function ls(){return Di||(Di=1,function(){var a,t,e,n={}.hasOwnProperty;e=Ht().assign,a=bt(),ir(),cr(),nr(),rr(),er(),lr(),fr(),hr(),us(),sr(),ar(),or(),ur(),t=We(),Fn.exports=function(){function s(i){var r,o,l;i||(i={}),this.options=i,o=i.writer||{};for(r in o)n.call(o,r)&&(l=o[r],this["_"+r]=this[r],this[r]=l)}return s.prototype.filterOptions=function(i){var r,o,l,E,m,p,y,w;return i||(i={}),i=e({},this.options,i),r={writer:this},r.pretty=i.pretty||!1,r.allowEmpty=i.allowEmpty||!1,r.indent=(o=i.indent)!=null?o:" ",r.newline=(l=i.newline)!=null?l:`
92
92
  `,r.offset=(E=i.offset)!=null?E:0,r.dontPrettyTextNodes=(m=(p=i.dontPrettyTextNodes)!=null?p:i.dontprettytextnodes)!=null?m:0,r.spaceBeforeSlash=(y=(w=i.spaceBeforeSlash)!=null?w:i.spacebeforeslash)!=null?y:"",r.spaceBeforeSlash===!0&&(r.spaceBeforeSlash=" "),r.suppressPrettyCount=0,r.user={},r.state=t.None,r},s.prototype.indent=function(i,r,o){var l;return!r.pretty||r.suppressPrettyCount?"":r.pretty&&(l=(o||0)+r.offset+1,l>0)?new Array(l).join(r.indent):""},s.prototype.endline=function(i,r,o){return!r.pretty||r.suppressPrettyCount?"":r.newline},s.prototype.attribute=function(i,r,o){var l;return this.openAttribute(i,r,o),l=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,r,o),l},s.prototype.cdata=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<![CDATA[",r.state=t.InsideTag,l+=i.value,r.state=t.CloseTag,l+="]]>"+this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.comment=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<!-- ",r.state=t.InsideTag,l+=i.value,r.state=t.CloseTag,l+=" -->"+this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.declaration=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<?xml",r.state=t.InsideTag,l+=' version="'+i.version+'"',i.encoding!=null&&(l+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(l+=' standalone="'+i.standalone+'"'),r.state=t.CloseTag,l+=r.spaceBeforeSlash+"?>",l+=this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.docType=function(i,r,o){var l,E,m,p,y;if(o||(o=0),this.openNode(i,r,o),r.state=t.OpenTag,p=this.indent(i,r,o),p+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?p+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(p+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(p+=" [",p+=this.endline(i,r,o),r.state=t.InsideTag,y=i.children,E=0,m=y.length;E<m;E++)l=y[E],p+=this.writeChildNode(l,r,o+1);r.state=t.CloseTag,p+="]"}return r.state=t.CloseTag,p+=r.spaceBeforeSlash+">",p+=this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),p},s.prototype.element=function(i,r,o){var l,E,m,p,y,w,D,_,C,T,I,g,v,M;o||(o=0),T=!1,I="",this.openNode(i,r,o),r.state=t.OpenTag,I+=this.indent(i,r,o)+"<"+i.name,g=i.attribs;for(C in g)n.call(g,C)&&(l=g[C],I+=this.attribute(l,r,o));if(m=i.children.length,p=m===0?null:i.children[0],m===0||i.children.every(function(X){return(X.type===a.Text||X.type===a.Raw)&&X.value===""}))r.allowEmpty?(I+=">",r.state=t.CloseTag,I+="</"+i.name+">"+this.endline(i,r,o)):(r.state=t.CloseTag,I+=r.spaceBeforeSlash+"/>"+this.endline(i,r,o));else if(r.pretty&&m===1&&(p.type===a.Text||p.type===a.Raw)&&p.value!=null)I+=">",r.state=t.InsideTag,r.suppressPrettyCount++,T=!0,I+=this.writeChildNode(p,r,o+1),r.suppressPrettyCount--,T=!1,r.state=t.CloseTag,I+="</"+i.name+">"+this.endline(i,r,o);else{if(r.dontPrettyTextNodes){for(v=i.children,y=0,D=v.length;y<D;y++)if(E=v[y],(E.type===a.Text||E.type===a.Raw)&&E.value!=null){r.suppressPrettyCount++,T=!0;break}}for(I+=">"+this.endline(i,r,o),r.state=t.InsideTag,M=i.children,w=0,_=M.length;w<_;w++)E=M[w],I+=this.writeChildNode(E,r,o+1);r.state=t.CloseTag,I+=this.indent(i,r,o)+"</"+i.name+">",T&&r.suppressPrettyCount--,I+=this.endline(i,r,o),r.state=t.None}return this.closeNode(i,r,o),I},s.prototype.writeChildNode=function(i,r,o){switch(i.type){case a.CData:return this.cdata(i,r,o);case a.Comment:return this.comment(i,r,o);case a.Element:return this.element(i,r,o);case a.Raw:return this.raw(i,r,o);case a.Text:return this.text(i,r,o);case a.ProcessingInstruction:return this.processingInstruction(i,r,o);case a.Dummy:return"";case a.Declaration:return this.declaration(i,r,o);case a.DocType:return this.docType(i,r,o);case a.AttributeDeclaration:return this.dtdAttList(i,r,o);case a.ElementDeclaration:return this.dtdElement(i,r,o);case a.EntityDeclaration:return this.dtdEntity(i,r,o);case a.NotationDeclaration:return this.dtdNotation(i,r,o);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},s.prototype.processingInstruction=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<?",r.state=t.InsideTag,l+=i.target,i.value&&(l+=" "+i.value),r.state=t.CloseTag,l+=r.spaceBeforeSlash+"?>",l+=this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.raw=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o),r.state=t.InsideTag,l+=i.value,r.state=t.CloseTag,l+=this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.text=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o),r.state=t.InsideTag,l+=i.value,r.state=t.CloseTag,l+=this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.dtdAttList=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<!ATTLIST",r.state=t.InsideTag,l+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(l+=" "+i.defaultValueType),i.defaultValue&&(l+=' "'+i.defaultValue+'"'),r.state=t.CloseTag,l+=r.spaceBeforeSlash+">"+this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.dtdElement=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<!ELEMENT",r.state=t.InsideTag,l+=" "+i.name+" "+i.value,r.state=t.CloseTag,l+=r.spaceBeforeSlash+">"+this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.dtdEntity=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<!ENTITY",r.state=t.InsideTag,i.pe&&(l+=" %"),l+=" "+i.name,i.value?l+=' "'+i.value+'"':(i.pubID&&i.sysID?l+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(l+=' SYSTEM "'+i.sysID+'"'),i.nData&&(l+=" NDATA "+i.nData)),r.state=t.CloseTag,l+=r.spaceBeforeSlash+">"+this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.dtdNotation=function(i,r,o){var l;return this.openNode(i,r,o),r.state=t.OpenTag,l=this.indent(i,r,o)+"<!NOTATION",r.state=t.InsideTag,l+=" "+i.name,i.pubID&&i.sysID?l+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?l+=' PUBLIC "'+i.pubID+'"':i.sysID&&(l+=' SYSTEM "'+i.sysID+'"'),r.state=t.CloseTag,l+=r.spaceBeforeSlash+">"+this.endline(i,r,o),r.state=t.None,this.closeNode(i,r,o),l},s.prototype.openNode=function(i,r,o){},s.prototype.closeNode=function(i,r,o){},s.prototype.openAttribute=function(i,r,o){},s.prototype.closeAttribute=function(i,r,o){},s}()}.call(it)),Fn.exports}var Ti;function pr(){return Ti||(Ti=1,function(){var a,t=function(n,s){for(var i in s)e.call(s,i)&&(n[i]=s[i]);function r(){this.constructor=n}return r.prototype=s.prototype,n.prototype=new r,n.__super__=s.prototype,n},e={}.hasOwnProperty;a=ls(),Sn.exports=function(n){t(s,n);function s(i){s.__super__.constructor.call(this,i)}return s.prototype.document=function(i,r){var o,l,E,m,p;for(r=this.filterOptions(r),m="",p=i.children,l=0,E=p.length;l<E;l++)o=p[l],m+=this.writeChildNode(o,r,0);return r.pretty&&m.slice(-r.newline.length)===r.newline&&(m=m.slice(0,-r.newline.length)),m},s}(a)}.call(it)),Sn.exports}var vi;function fs(){return vi||(vi=1,function(){var a,t,e,n,s,i,r,o=function(E,m){for(var p in m)l.call(m,p)&&(E[p]=m[p]);function y(){this.constructor=E}return y.prototype=m.prototype,E.prototype=new y,E.__super__=m.prototype,E},l={}.hasOwnProperty;r=Ht().isPlainObject,e=os(),t=Ro(),n=St(),a=bt(),i=cs(),s=pr(),cn.exports=function(E){o(m,E);function m(p){m.__super__.constructor.call(this,null),this.name="#document",this.type=a.Document,this.documentURI=null,this.domConfig=new t,p||(p={}),p.writer||(p.writer=new s),this.options=p,this.stringify=new i(p)}return Object.defineProperty(m.prototype,"implementation",{value:new e}),Object.defineProperty(m.prototype,"doctype",{get:function(){var p,y,w,D;for(D=this.children,y=0,w=D.length;y<w;y++)if(p=D[y],p.type===a.DocType)return p;return null}}),Object.defineProperty(m.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(m.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(m.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(m.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===a.Declaration?this.children[0].encoding:null}}),Object.defineProperty(m.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===a.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(m.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===a.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(m.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(m.prototype,"origin",{get:function(){return null}}),Object.defineProperty(m.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(m.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(m.prototype,"contentType",{get:function(){return null}}),m.prototype.end=function(p){var y;return y={},p?r(p)&&(y=p,p=this.options.writer):p=this.options.writer,p.document(this,p.filterOptions(y))},m.prototype.toString=function(p){return this.options.writer.document(this,this.options.writer.filterOptions(p))},m.prototype.createElement=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTextNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createComment=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createCDATASection=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createProcessingInstruction=function(p,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttribute=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEntityReference=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.importNode=function(p,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createElementNS=function(p,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createAttributeNS=function(p,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(p,y){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementById=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.adoptNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.renameNode=function(p,y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByClassName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createEvent=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createNodeIterator=function(p,y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.createTreeWalker=function(p,y,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m}(n)}.call(it)),cn.exports}var Bn={exports:{}},_i;function $o(){return _i||(_i=1,function(){var a,t,e,n,s,i,r,o,l,E,m,p,y,w,D,_,C,T,I,g,v,M,X,q={}.hasOwnProperty;X=Ht(),v=X.isObject,g=X.isFunction,M=X.isPlainObject,I=X.getValue,a=bt(),p=fs(),y=er(),n=nr(),s=rr(),D=lr(),T=fr(),w=hr(),E=ir(),m=cr(),i=sr(),o=or(),r=ar(),l=ur(),e=as(),C=cs(),_=pr(),t=We(),Bn.exports=function(){function U(d,B,S){var R;this.name="?xml",this.type=a.Document,d||(d={}),R={},d.writer?M(d.writer)&&(R=d.writer,d.writer=new _):d.writer=new _,this.options=d,this.writer=d.writer,this.writerOptions=this.writer.filterOptions(R),this.stringify=new C(d),this.onDataCallback=B||function(){},this.onEndCallback=S||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return U.prototype.createChildNode=function(d){var B,S,R,$,W,G,k,V;switch(d.type){case a.CData:this.cdata(d.value);break;case a.Comment:this.comment(d.value);break;case a.Element:R={},k=d.attribs;for(S in k)q.call(k,S)&&(B=k[S],R[S]=B.value);this.node(d.name,R);break;case a.Dummy:this.dummy();break;case a.Raw:this.raw(d.value);break;case a.Text:this.text(d.value);break;case a.ProcessingInstruction:this.instruction(d.target,d.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+d.constructor.name)}for(V=d.children,W=0,G=V.length;W<G;W++)$=V[W],this.createChildNode($),$.type===a.Element&&this.up();return this},U.prototype.dummy=function(){return this},U.prototype.node=function(d,B,S){var R;if(d==null)throw new Error("Missing node name.");if(this.root&&this.currentLevel===-1)throw new Error("Document can only have one root node. "+this.debugInfo(d));return this.openCurrent(),d=I(d),B==null&&(B={}),B=I(B),v(B)||(R=[B,S],S=R[0],B=R[1]),this.currentNode=new y(this,d,B),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,S!=null&&this.text(S),this},U.prototype.element=function(d,B,S){var R,$,W,G,k,V;if(this.currentNode&&this.currentNode.type===a.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(d)||v(d)||g(d))for(G=this.options.noValidation,this.options.noValidation=!0,V=new p(this.options).element("TEMP_ROOT"),V.element(d),this.options.noValidation=G,k=V.children,$=0,W=k.length;$<W;$++)R=k[$],this.createChildNode(R),R.type===a.Element&&this.up();else this.node(d,B,S);return this},U.prototype.attribute=function(d,B){var S,R;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(d));if(d!=null&&(d=I(d)),v(d))for(S in d)q.call(d,S)&&(R=d[S],this.attribute(S,R));else g(B)&&(B=B.apply()),this.options.keepNullAttributes&&B==null?this.currentNode.attribs[d]=new e(this,d,""):B!=null&&(this.currentNode.attribs[d]=new e(this,d,B));return this},U.prototype.text=function(d){var B;return this.openCurrent(),B=new T(this,d),this.onData(this.writer.text(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.cdata=function(d){var B;return this.openCurrent(),B=new n(this,d),this.onData(this.writer.cdata(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.comment=function(d){var B;return this.openCurrent(),B=new s(this,d),this.onData(this.writer.comment(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.raw=function(d){var B;return this.openCurrent(),B=new D(this,d),this.onData(this.writer.raw(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.instruction=function(d,B){var S,R,$,W,G;if(this.openCurrent(),d!=null&&(d=I(d)),B!=null&&(B=I(B)),Array.isArray(d))for(S=0,W=d.length;S<W;S++)R=d[S],this.instruction(R);else if(v(d))for(R in d)q.call(d,R)&&($=d[R],this.instruction(R,$));else g(B)&&(B=B.apply()),G=new w(this,d,B),this.onData(this.writer.processingInstruction(G,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},U.prototype.declaration=function(d,B,S){var R;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return R=new E(this,d,B,S),this.onData(this.writer.declaration(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.doctype=function(d,B,S){if(this.openCurrent(),d==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new m(this,B,S),this.currentNode.rootNodeName=d,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},U.prototype.dtdElement=function(d,B){var S;return this.openCurrent(),S=new r(this,d,B),this.onData(this.writer.dtdElement(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.attList=function(d,B,S,R,$){var W;return this.openCurrent(),W=new i(this,d,B,S,R,$),this.onData(this.writer.dtdAttList(W,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.entity=function(d,B){var S;return this.openCurrent(),S=new o(this,!1,d,B),this.onData(this.writer.dtdEntity(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.pEntity=function(d,B){var S;return this.openCurrent(),S=new o(this,!0,d,B),this.onData(this.writer.dtdEntity(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.notation=function(d,B){var S;return this.openCurrent(),S=new l(this,d,B),this.onData(this.writer.dtdNotation(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},U.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},U.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},U.prototype.openNode=function(d){var B,S,R,$;if(!d.isOpen){if(!this.root&&this.currentLevel===0&&d.type===a.Element&&(this.root=d),S="",d.type===a.Element){this.writerOptions.state=t.OpenTag,S=this.writer.indent(d,this.writerOptions,this.currentLevel)+"<"+d.name,$=d.attribs;for(R in $)q.call($,R)&&(B=$[R],S+=this.writer.attribute(B,this.writerOptions,this.currentLevel));S+=(d.children?">":"/>")+this.writer.endline(d,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,S=this.writer.indent(d,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+d.rootNodeName,d.pubID&&d.sysID?S+=' PUBLIC "'+d.pubID+'" "'+d.sysID+'"':d.sysID&&(S+=' SYSTEM "'+d.sysID+'"'),d.children?(S+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,S+=">"),S+=this.writer.endline(d,this.writerOptions,this.currentLevel);return this.onData(S,this.currentLevel),d.isOpen=!0}},U.prototype.closeNode=function(d){var B;if(!d.isClosed)return B="",this.writerOptions.state=t.CloseTag,d.type===a.Element?B=this.writer.indent(d,this.writerOptions,this.currentLevel)+"</"+d.name+">"+this.writer.endline(d,this.writerOptions,this.currentLevel):B=this.writer.indent(d,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(d,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(B,this.currentLevel),d.isClosed=!0},U.prototype.onData=function(d,B){return this.documentStarted=!0,this.onDataCallback(d,B+1)},U.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},U.prototype.debugInfo=function(d){return d==null?"":"node: <"+d+">"},U.prototype.ele=function(){return this.element.apply(this,arguments)},U.prototype.nod=function(d,B,S){return this.node(d,B,S)},U.prototype.txt=function(d){return this.text(d)},U.prototype.dat=function(d){return this.cdata(d)},U.prototype.com=function(d){return this.comment(d)},U.prototype.ins=function(d,B){return this.instruction(d,B)},U.prototype.dec=function(d,B,S){return this.declaration(d,B,S)},U.prototype.dtd=function(d,B,S){return this.doctype(d,B,S)},U.prototype.e=function(d,B,S){return this.element(d,B,S)},U.prototype.n=function(d,B,S){return this.node(d,B,S)},U.prototype.t=function(d){return this.text(d)},U.prototype.d=function(d){return this.cdata(d)},U.prototype.c=function(d){return this.comment(d)},U.prototype.r=function(d){return this.raw(d)},U.prototype.i=function(d,B){return this.instruction(d,B)},U.prototype.att=function(){return this.currentNode&&this.currentNode.type===a.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},U.prototype.a=function(){return this.currentNode&&this.currentNode.type===a.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},U.prototype.ent=function(d,B){return this.entity(d,B)},U.prototype.pent=function(d,B){return this.pEntity(d,B)},U.prototype.not=function(d,B){return this.notation(d,B)},U}()}.call(it)),Bn.exports}var Rn={exports:{}},Ni;function qo(){return Ni||(Ni=1,function(){var a,t,e,n=function(i,r){for(var o in r)s.call(r,o)&&(i[o]=r[o]);function l(){this.constructor=i}return l.prototype=r.prototype,i.prototype=new l,i.__super__=r.prototype,i},s={}.hasOwnProperty;a=bt(),e=ls(),t=We(),Rn.exports=function(i){n(r,i);function r(o,l){this.stream=o,r.__super__.constructor.call(this,l)}return r.prototype.endline=function(o,l,E){return o.isLastRootNode&&l.state===t.CloseTag?"":r.__super__.endline.call(this,o,l,E)},r.prototype.document=function(o,l){var E,m,p,y,w,D,_,C,T;for(_=o.children,m=p=0,w=_.length;p<w;m=++p)E=_[m],E.isLastRootNode=m===o.children.length-1;for(l=this.filterOptions(l),C=o.children,T=[],y=0,D=C.length;y<D;y++)E=C[y],T.push(this.writeChildNode(E,l,0));return T},r.prototype.attribute=function(o,l,E){return this.stream.write(r.__super__.attribute.call(this,o,l,E))},r.prototype.cdata=function(o,l,E){return this.stream.write(r.__super__.cdata.call(this,o,l,E))},r.prototype.comment=function(o,l,E){return this.stream.write(r.__super__.comment.call(this,o,l,E))},r.prototype.declaration=function(o,l,E){return this.stream.write(r.__super__.declaration.call(this,o,l,E))},r.prototype.docType=function(o,l,E){var m,p,y,w;if(E||(E=0),this.openNode(o,l,E),l.state=t.OpenTag,this.stream.write(this.indent(o,l,E)),this.stream.write("<!DOCTYPE "+o.root().name),o.pubID&&o.sysID?this.stream.write(' PUBLIC "'+o.pubID+'" "'+o.sysID+'"'):o.sysID&&this.stream.write(' SYSTEM "'+o.sysID+'"'),o.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(o,l,E)),l.state=t.InsideTag,w=o.children,p=0,y=w.length;p<y;p++)m=w[p],this.writeChildNode(m,l,E+1);l.state=t.CloseTag,this.stream.write("]")}return l.state=t.CloseTag,this.stream.write(l.spaceBeforeSlash+">"),this.stream.write(this.endline(o,l,E)),l.state=t.None,this.closeNode(o,l,E)},r.prototype.element=function(o,l,E){var m,p,y,w,D,_,C,T,I;E||(E=0),this.openNode(o,l,E),l.state=t.OpenTag,this.stream.write(this.indent(o,l,E)+"<"+o.name),T=o.attribs;for(C in T)s.call(T,C)&&(m=T[C],this.attribute(m,l,E));if(y=o.children.length,w=y===0?null:o.children[0],y===0||o.children.every(function(g){return(g.type===a.Text||g.type===a.Raw)&&g.value===""}))l.allowEmpty?(this.stream.write(">"),l.state=t.CloseTag,this.stream.write("</"+o.name+">")):(l.state=t.CloseTag,this.stream.write(l.spaceBeforeSlash+"/>"));else if(l.pretty&&y===1&&(w.type===a.Text||w.type===a.Raw)&&w.value!=null)this.stream.write(">"),l.state=t.InsideTag,l.suppressPrettyCount++,this.writeChildNode(w,l,E+1),l.suppressPrettyCount--,l.state=t.CloseTag,this.stream.write("</"+o.name+">");else{for(this.stream.write(">"+this.endline(o,l,E)),l.state=t.InsideTag,I=o.children,D=0,_=I.length;D<_;D++)p=I[D],this.writeChildNode(p,l,E+1);l.state=t.CloseTag,this.stream.write(this.indent(o,l,E)+"</"+o.name+">")}return this.stream.write(this.endline(o,l,E)),l.state=t.None,this.closeNode(o,l,E)},r.prototype.processingInstruction=function(o,l,E){return this.stream.write(r.__super__.processingInstruction.call(this,o,l,E))},r.prototype.raw=function(o,l,E){return this.stream.write(r.__super__.raw.call(this,o,l,E))},r.prototype.text=function(o,l,E){return this.stream.write(r.__super__.text.call(this,o,l,E))},r.prototype.dtdAttList=function(o,l,E){return this.stream.write(r.__super__.dtdAttList.call(this,o,l,E))},r.prototype.dtdElement=function(o,l,E){return this.stream.write(r.__super__.dtdElement.call(this,o,l,E))},r.prototype.dtdEntity=function(o,l,E){return this.stream.write(r.__super__.dtdEntity.call(this,o,l,E))},r.prototype.dtdNotation=function(o,l,E){return this.stream.write(r.__super__.dtdNotation.call(this,o,l,E))},r}(e)}.call(it)),Rn.exports}var Ai;function Wo(){return Ai||(Ai=1,function(){var a,t,e,n,s,i,r,o,l,E;E=Ht(),o=E.assign,l=E.isFunction,e=os(),n=fs(),s=$o(),r=pr(),i=qo(),a=bt(),t=We(),Wt.create=function(m,p,y,w){var D,_;if(m==null)throw new Error("Root element needs a name.");return w=o({},p,y,w),D=new n(w),_=D.element(m),w.headless||(D.declaration(w),(w.pubID!=null||w.sysID!=null)&&D.dtd(w)),_},Wt.begin=function(m,p,y){var w;return l(m)&&(w=[m,p],p=w[0],y=w[1],m={}),p?new s(m,p,y):new n(m)},Wt.stringWriter=function(m){return new r(m)},Wt.streamWriter=function(m,p){return new i(m,p)},Wt.implementation=new e,Wt.nodeType=a,Wt.writerState=t}.call(it)),Wt}var Mi;function Vo(){return Mi||(Mi=1,function(){var a,t,e,n,s,i={}.hasOwnProperty;a=Wo(),t=Zn().defaults,n=function(r){return typeof r=="string"&&(r.indexOf("&")>=0||r.indexOf(">")>=0||r.indexOf("<")>=0)},s=function(r){return"<![CDATA["+e(r)+"]]>"},e=function(r){return r.replace("]]>","]]]]><![CDATA[>")},an.Builder=function(){function r(o){var l,E,m;this.options={},E=t["0.2"];for(l in E)i.call(E,l)&&(m=E[l],this.options[l]=m);for(l in o)i.call(o,l)&&(m=o[l],this.options[l]=m)}return r.prototype.buildObject=function(o){var l,E,m,p,y;return l=this.options.attrkey,E=this.options.charkey,Object.keys(o).length===1&&this.options.rootName===t["0.2"].rootName?(y=Object.keys(o)[0],o=o[y]):y=this.options.rootName,m=function(w){return function(D,_){var C,T,I,g,v,M;if(typeof _!="object")w.options.cdata&&n(_)?D.raw(s(_)):D.txt(_);else if(Array.isArray(_)){for(g in _)if(i.call(_,g)){T=_[g];for(v in T)I=T[v],D=m(D.ele(v),I).up()}}else for(v in _)if(i.call(_,v))if(T=_[v],v===l){if(typeof T=="object")for(C in T)M=T[C],D=D.att(C,M)}else if(v===E)w.options.cdata&&n(T)?D=D.raw(s(T)):D=D.txt(T);else if(Array.isArray(T))for(g in T)i.call(T,g)&&(I=T[g],typeof I=="string"?w.options.cdata&&n(I)?D=D.ele(v).raw(s(I)).up():D=D.ele(v,I).up():D=m(D.ele(v),I).up());else typeof T=="object"?D=m(D.ele(v),T).up():typeof T=="string"&&w.options.cdata&&n(T)?D=D.ele(v).raw(s(T)).up():(T==null&&(T=""),D=D.ele(v,T.toString()).up());return D}}(this),p=a.create(y,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),m(p,o).end(this.options.renderOpts)},r}()}.call(it)),an}var Un={},Xn={},$n={},Fe={exports:{}},qn={},de={},Pi;function Ho(){if(Pi)return de;Pi=1,de.byteLength=o,de.toByteArray=E,de.fromByteArray=y;for(var a=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=n.length;s<i;++s)a[s]=n[s],t[n.charCodeAt(s)]=s;t[45]=62,t[95]=63;function r(w){var D=w.length;if(D%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=w.indexOf("=");_===-1&&(_=D);var C=_===D?0:4-_%4;return[_,C]}function o(w){var D=r(w),_=D[0],C=D[1];return(_+C)*3/4-C}function l(w,D,_){return(D+_)*3/4-_}function E(w){var D,_=r(w),C=_[0],T=_[1],I=new e(l(w,C,T)),g=0,v=T>0?C-4:C,M;for(M=0;M<v;M+=4)D=t[w.charCodeAt(M)]<<18|t[w.charCodeAt(M+1)]<<12|t[w.charCodeAt(M+2)]<<6|t[w.charCodeAt(M+3)],I[g++]=D>>16&255,I[g++]=D>>8&255,I[g++]=D&255;return T===2&&(D=t[w.charCodeAt(M)]<<2|t[w.charCodeAt(M+1)]>>4,I[g++]=D&255),T===1&&(D=t[w.charCodeAt(M)]<<10|t[w.charCodeAt(M+1)]<<4|t[w.charCodeAt(M+2)]>>2,I[g++]=D>>8&255,I[g++]=D&255),I}function m(w){return a[w>>18&63]+a[w>>12&63]+a[w>>6&63]+a[w&63]}function p(w,D,_){for(var C,T=[],I=D;I<_;I+=3)C=(w[I]<<16&16711680)+(w[I+1]<<8&65280)+(w[I+2]&255),T.push(m(C));return T.join("")}function y(w){for(var D,_=w.length,C=_%3,T=[],I=16383,g=0,v=_-C;g<v;g+=I)T.push(p(w,g,g+I>v?v:g+I));return C===1?(D=w[_-1],T.push(a[D>>2]+a[D<<4&63]+"==")):C===2&&(D=(w[_-2]<<8)+w[_-1],T.push(a[D>>10]+a[D>>4&63]+a[D<<2&63]+"=")),T.join("")}return de}var je={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Li;function zo(){return Li||(Li=1,je.read=function(a,t,e,n,s){var i,r,o=s*8-n-1,l=(1<<o)-1,E=l>>1,m=-7,p=e?s-1:0,y=e?-1:1,w=a[t+p];for(p+=y,i=w&(1<<-m)-1,w>>=-m,m+=o;m>0;i=i*256+a[t+p],p+=y,m-=8);for(r=i&(1<<-m)-1,i>>=-m,m+=n;m>0;r=r*256+a[t+p],p+=y,m-=8);if(i===0)i=1-E;else{if(i===l)return r?NaN:(w?-1:1)*(1/0);r=r+Math.pow(2,n),i=i-E}return(w?-1:1)*r*Math.pow(2,i-n)},je.write=function(a,t,e,n,s,i){var r,o,l,E=i*8-s-1,m=(1<<E)-1,p=m>>1,y=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,D=n?1:-1,_=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,r=m):(r=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-r))<1&&(r--,l*=2),r+p>=1?t+=y/l:t+=y*Math.pow(2,1-p),t*l>=2&&(r++,l/=2),r+p>=m?(o=0,r=m):r+p>=1?(o=(t*l-1)*Math.pow(2,s),r=r+p):(o=t*Math.pow(2,p-1)*Math.pow(2,s),r=0));s>=8;a[e+w]=o&255,w+=D,o/=256,s-=8);for(r=r<<s|o,E+=s;E>0;a[e+w]=r&255,w+=D,r/=256,E-=8);a[e+w-D]|=_*128}),je}/*!
93
93
  * The buffer module from node.js, for the browser.
@@ -102,7 +102,7 @@ Char: `+x.c),b=new Error(b),x.error=b,S(x,"onerror",b),x}function k(x){return x.
102
102
  Actual: `+x.attribValue);else if(P==="xmlns"&&x.attribValue!==D)V(x,"xmlns: prefix must be bound to "+D+`
103
103
  Actual: `+x.attribValue);else{var J=x.tag,ot=x.tags[x.tags.length-1]||x;J.ns===ot.ns&&(J.ns=Object.create(ot.ns)),J.ns[P]=x.attribValue}x.attribList.push([x.attribName,x.attribValue])}else x.tag.attributes[x.attribName]=x.attribValue,R(x,"onattribute",{name:x.attribName,value:x.attribValue});x.attribName=x.attribValue=""}function st(x,b){if(x.opt.xmlns){var j=x.tag,P=Ct(x.tagName);j.prefix=P.prefix,j.local=P.local,j.uri=j.ns[P.prefix]||"",j.prefix&&!j.uri&&(V(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),j.uri=P.prefix);var J=x.tags[x.tags.length-1]||x;j.ns&&J.ns!==j.ns&&Object.keys(j.ns).forEach(function(F){R(x,"onopennamespace",{prefix:F,uri:j.ns[F]})});for(var ot=0,rt=x.attribList.length;ot<rt;ot++){var ht=x.attribList[ot],A=ht[0],f=ht[1],u=Ct(A,!0),c=u.prefix,h=u.local,N=c===""?"":j.ns[c]||"",L={name:A,value:f,prefix:c,local:h,uri:N};c&&c!=="xmlns"&&!N&&(V(x,"Unbound namespace prefix: "+JSON.stringify(c)),L.uri=c),x.tag.attributes[A]=L,R(x,"onattribute",L)}x.attribList.length=0}x.tag.isSelfClosing=!!b,x.sawRoot=!0,x.tags.push(x.tag),R(x,"onopentag",x.tag),b||(!x.noscript&&x.tagName.toLowerCase()==="script"?x.state=d.SCRIPT:x.state=d.TEXT,x.tag=null,x.tagName=""),x.attribName=x.attribValue="",x.attribList.length=0}function ut(x){if(!x.tagName){V(x,"Weird empty close tag."),x.textNode+="</>",x.state=d.TEXT;return}if(x.script){if(x.tagName!=="script"){x.script+="</"+x.tagName+">",x.tagName="",x.state=d.SCRIPT;return}R(x,"onscript",x.script),x.script=""}var b=x.tags.length,j=x.tagName;x.strict||(j=j[x.looseCase]());for(var P=j;b--;){var J=x.tags[b];if(J.name!==P)V(x,"Unexpected close tag");else break}if(b<0){V(x,"Unmatched closing tag: "+x.tagName),x.textNode+="</"+x.tagName+">",x.state=d.TEXT;return}x.tagName=j;for(var ot=x.tags.length;ot-- >b;){var rt=x.tag=x.tags.pop();x.tagName=x.tag.name,R(x,"onclosetag",x.tagName);var ht={};for(var A in rt.ns)ht[A]=rt.ns[A];var f=x.tags[x.tags.length-1]||x;x.opt.xmlns&&rt.ns!==f.ns&&Object.keys(rt.ns).forEach(function(u){var c=rt.ns[u];R(x,"onclosenamespace",{prefix:u,uri:c})})}b===0&&(x.closedRoot=!0),x.tagName=x.attribValue=x.attribName="",x.attribList.length=0,x.state=d.TEXT}function _t(x){var b=x.entity,j=b.toLowerCase(),P,J="";return x.ENTITIES[b]?x.ENTITIES[b]:x.ENTITIES[j]?x.ENTITIES[j]:(b=j,b.charAt(0)==="#"&&(b.charAt(1)==="x"?(b=b.slice(2),P=parseInt(b,16),J=P.toString(16)):(b=b.slice(1),P=parseInt(b,10),J=P.toString(10))),b=b.replace(/^0+/,""),isNaN(P)||J.toLowerCase()!==b?(V(x,"Invalid character entity"),"&"+x.entity+";"):String.fromCodePoint(P))}function K(x,b){b==="<"?(x.state=d.OPEN_WAKA,x.startTagPosition=x.position):v(b)||(V(x,"Non-whitespace before first tag."),x.textNode=b,x.state=d.TEXT)}function $t(x,b){var j="";return b<x.length&&(j=x.charAt(b)),j}function Q(x){var b=this;if(this.error)throw this.error;if(b.closed)return G(b,"Cannot write after close. Assign an onready handler.");if(x===null)return k(b);typeof x=="object"&&(x=x.toString());for(var j=0,P="";P=$t(x,j++),b.c=P,!!P;)switch(b.trackPosition&&(b.position++,P===`
104
104
  `?(b.line++,b.column=0):b.column++),b.state){case d.BEGIN:if(b.state=d.BEGIN_WHITESPACE,P==="\uFEFF")continue;K(b,P);continue;case d.BEGIN_WHITESPACE:K(b,P);continue;case d.TEXT:if(b.sawRoot&&!b.closedRoot){for(var J=j-1;P&&P!=="<"&&P!=="&";)P=$t(x,j++),P&&b.trackPosition&&(b.position++,P===`
105
- `?(b.line++,b.column=0):b.column++);b.textNode+=x.substring(J,j-1)}P==="<"&&!(b.sawRoot&&b.closedRoot&&!b.strict)?(b.state=d.OPEN_WAKA,b.startTagPosition=b.position):(!v(P)&&(!b.sawRoot||b.closedRoot)&&V(b,"Text data outside of root node."),P==="&"?b.state=d.TEXT_ENTITY:b.textNode+=P);continue;case d.SCRIPT:P==="<"?b.state=d.SCRIPT_ENDING:b.script+=P;continue;case d.SCRIPT_ENDING:P==="/"?b.state=d.CLOSE_TAG:(b.script+="<"+P,b.state=d.SCRIPT);continue;case d.OPEN_WAKA:if(P==="!")b.state=d.SGML_DECL,b.sgmlDecl="";else if(!v(P))if(q(C,P))b.state=d.OPEN_TAG,b.tagName=P;else if(P==="/")b.state=d.CLOSE_TAG,b.tagName="";else if(P==="?")b.state=d.PROC_INST,b.procInstName=b.procInstBody="";else{if(V(b,"Unencoded <"),b.startTagPosition+1<b.position){var ot=b.position-b.startTagPosition;P=new Array(ot).join(" ")+P}b.textNode+="<"+P,b.state=d.TEXT}continue;case d.SGML_DECL:if(b.sgmlDecl+P==="--"){b.state=d.COMMENT,b.comment="",b.sgmlDecl="";continue}b.doctype&&b.doctype!==!0&&b.sgmlDecl?(b.state=d.DOCTYPE_DTD,b.doctype+="<!"+b.sgmlDecl+P,b.sgmlDecl=""):(b.sgmlDecl+P).toUpperCase()===p?(R(b,"onopencdata"),b.state=d.CDATA,b.sgmlDecl="",b.cdata=""):(b.sgmlDecl+P).toUpperCase()===y?(b.state=d.DOCTYPE,(b.doctype||b.sawRoot)&&V(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):P===">"?(R(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=d.TEXT):(M(P)&&(b.state=d.SGML_DECL_QUOTED),b.sgmlDecl+=P);continue;case d.SGML_DECL_QUOTED:P===b.q&&(b.state=d.SGML_DECL,b.q=""),b.sgmlDecl+=P;continue;case d.DOCTYPE:P===">"?(b.state=d.TEXT,R(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=P,P==="["?b.state=d.DOCTYPE_DTD:M(P)&&(b.state=d.DOCTYPE_QUOTED,b.q=P));continue;case d.DOCTYPE_QUOTED:b.doctype+=P,P===b.q&&(b.q="",b.state=d.DOCTYPE);continue;case d.DOCTYPE_DTD:P==="]"?(b.doctype+=P,b.state=d.DOCTYPE):P==="<"?(b.state=d.OPEN_WAKA,b.startTagPosition=b.position):M(P)?(b.doctype+=P,b.state=d.DOCTYPE_DTD_QUOTED,b.q=P):b.doctype+=P;continue;case d.DOCTYPE_DTD_QUOTED:b.doctype+=P,P===b.q&&(b.state=d.DOCTYPE_DTD,b.q="");continue;case d.COMMENT:P==="-"?b.state=d.COMMENT_ENDING:b.comment+=P;continue;case d.COMMENT_ENDING:P==="-"?(b.state=d.COMMENT_ENDED,b.comment=W(b.opt,b.comment),b.comment&&R(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+P,b.state=d.COMMENT);continue;case d.COMMENT_ENDED:P!==">"?(V(b,"Malformed comment"),b.comment+="--"+P,b.state=d.COMMENT):b.doctype&&b.doctype!==!0?b.state=d.DOCTYPE_DTD:b.state=d.TEXT;continue;case d.CDATA:P==="]"?b.state=d.CDATA_ENDING:b.cdata+=P;continue;case d.CDATA_ENDING:P==="]"?b.state=d.CDATA_ENDING_2:(b.cdata+="]"+P,b.state=d.CDATA);continue;case d.CDATA_ENDING_2:P===">"?(b.cdata&&R(b,"oncdata",b.cdata),R(b,"onclosecdata"),b.cdata="",b.state=d.TEXT):P==="]"?b.cdata+="]":(b.cdata+="]]"+P,b.state=d.CDATA);continue;case d.PROC_INST:P==="?"?b.state=d.PROC_INST_ENDING:v(P)?b.state=d.PROC_INST_BODY:b.procInstName+=P;continue;case d.PROC_INST_BODY:if(!b.procInstBody&&v(P))continue;P==="?"?b.state=d.PROC_INST_ENDING:b.procInstBody+=P;continue;case d.PROC_INST_ENDING:P===">"?(R(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=d.TEXT):(b.procInstBody+="?"+P,b.state=d.PROC_INST_BODY);continue;case d.OPEN_TAG:q(T,P)?b.tagName+=P:(ft(b),P===">"?st(b):P==="/"?b.state=d.OPEN_TAG_SLASH:(v(P)||V(b,"Invalid character in tag name"),b.state=d.ATTRIB));continue;case d.OPEN_TAG_SLASH:P===">"?(st(b,!0),ut(b)):(V(b,"Forward-slash in opening tag not followed by >"),b.state=d.ATTRIB);continue;case d.ATTRIB:if(v(P))continue;P===">"?st(b):P==="/"?b.state=d.OPEN_TAG_SLASH:q(C,P)?(b.attribName=P,b.attribValue="",b.state=d.ATTRIB_NAME):V(b,"Invalid attribute name");continue;case d.ATTRIB_NAME:P==="="?b.state=d.ATTRIB_VALUE:P===">"?(V(b,"Attribute without value"),b.attribValue=b.attribName,at(b),st(b)):v(P)?b.state=d.ATTRIB_NAME_SAW_WHITE:q(T,P)?b.attribName+=P:V(b,"Invalid attribute name");continue;case d.ATTRIB_NAME_SAW_WHITE:if(P==="=")b.state=d.ATTRIB_VALUE;else{if(v(P))continue;V(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",R(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",P===">"?st(b):q(C,P)?(b.attribName=P,b.state=d.ATTRIB_NAME):(V(b,"Invalid attribute name"),b.state=d.ATTRIB)}continue;case d.ATTRIB_VALUE:if(v(P))continue;M(P)?(b.q=P,b.state=d.ATTRIB_VALUE_QUOTED):(b.opt.unquotedAttributeValues||G(b,"Unquoted attribute value"),b.state=d.ATTRIB_VALUE_UNQUOTED,b.attribValue=P);continue;case d.ATTRIB_VALUE_QUOTED:if(P!==b.q){P==="&"?b.state=d.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=P;continue}at(b),b.q="",b.state=d.ATTRIB_VALUE_CLOSED;continue;case d.ATTRIB_VALUE_CLOSED:v(P)?b.state=d.ATTRIB:P===">"?st(b):P==="/"?b.state=d.OPEN_TAG_SLASH:q(C,P)?(V(b,"No whitespace between attributes"),b.attribName=P,b.attribValue="",b.state=d.ATTRIB_NAME):V(b,"Invalid attribute name");continue;case d.ATTRIB_VALUE_UNQUOTED:if(!X(P)){P==="&"?b.state=d.ATTRIB_VALUE_ENTITY_U:b.attribValue+=P;continue}at(b),P===">"?st(b):b.state=d.ATTRIB;continue;case d.CLOSE_TAG:if(b.tagName)P===">"?ut(b):q(T,P)?b.tagName+=P:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=d.SCRIPT):(v(P)||V(b,"Invalid tagname in closing tag"),b.state=d.CLOSE_TAG_SAW_WHITE);else{if(v(P))continue;U(C,P)?b.script?(b.script+="</"+P,b.state=d.SCRIPT):V(b,"Invalid tagname in closing tag."):b.tagName=P}continue;case d.CLOSE_TAG_SAW_WHITE:if(v(P))continue;P===">"?ut(b):V(b,"Invalid characters in closing tag");continue;case d.TEXT_ENTITY:case d.ATTRIB_VALUE_ENTITY_Q:case d.ATTRIB_VALUE_ENTITY_U:var rt,ht;switch(b.state){case d.TEXT_ENTITY:rt=d.TEXT,ht="textNode";break;case d.ATTRIB_VALUE_ENTITY_Q:rt=d.ATTRIB_VALUE_QUOTED,ht="attribValue";break;case d.ATTRIB_VALUE_ENTITY_U:rt=d.ATTRIB_VALUE_UNQUOTED,ht="attribValue";break}if(P===";"){var A=_t(b);b.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(A)?(b.entity="",b.state=rt,b.write(A)):(b[ht]+=A,b.entity="",b.state=rt)}else q(b.entity.length?g:I,P)?b.entity+=P:(V(b,"Invalid character in entity name"),b[ht]+="&"+b.entity+P,b.entity="",b.state=rt);continue;default:throw new Error(b,"Unknown state: "+b.state)}return b.position>=b.bufferCheckPosition&&s(b),b}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var x=String.fromCharCode,b=Math.floor,j=function(){var P=16384,J=[],ot,rt,ht=-1,A=arguments.length;if(!A)return"";for(var f="";++ht<A;){var u=Number(arguments[ht]);if(!isFinite(u)||u<0||u>1114111||b(u)!==u)throw RangeError("Invalid code point: "+u);u<=65535?J.push(u):(u-=65536,ot=(u>>10)+55296,rt=u%1024+56320,J.push(ot,rt)),(ht+1===A||J.length>P)&&(f+=x.apply(null,J),J.length=0)}return f};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:j,configurable:!0,writable:!0}):String.fromCodePoint=j}()})(a)}(Xn)),Xn}var Wn={},Ri;function Qo(){return Ri||(Ri=1,function(){Wn.stripBOM=function(a){return a[0]==="\uFEFF"?a.substring(1):a}}.call(it)),Wn}var se={},Ui;function hs(){return Ui||(Ui=1,function(){var a;a=new RegExp(/(?!xmlns)^.*:/),se.normalize=function(t){return t.toLowerCase()},se.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},se.stripPrefix=function(t){return t.replace(a,"")},se.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},se.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(it)),se}var Xi;function Jo(){return Xi||(Xi=1,function(a){(function(){var t,e,n,s,i,r,o,l,E,m=function(w,D){return function(){return w.apply(D,arguments)}},p=function(w,D){for(var _ in D)y.call(D,_)&&(w[_]=D[_]);function C(){this.constructor=w}return C.prototype=D.prototype,w.prototype=new C,w.__super__=D.prototype,w},y={}.hasOwnProperty;l=Ko(),s=Qn,t=Qo(),o=hs(),E=Es.setImmediate,e=Zn().defaults,i=function(w){return typeof w=="object"&&w!=null&&Object.keys(w).length===0},r=function(w,D,_){var C,T,I;for(C=0,T=w.length;C<T;C++)I=w[C],D=I(D,_);return D},n=function(w,D,_){var C;return C=Object.create(null),C.value=_,C.writable=!0,C.enumerable=!0,C.configurable=!0,Object.defineProperty(w,D,C)},a.Parser=function(w){p(D,w);function D(_){this.parseStringPromise=m(this.parseStringPromise,this),this.parseString=m(this.parseString,this),this.reset=m(this.reset,this),this.assignOrPush=m(this.assignOrPush,this),this.processAsync=m(this.processAsync,this);var C,T,I;if(!(this instanceof a.Parser))return new a.Parser(_);this.options={},T=e["0.2"];for(C in T)y.call(T,C)&&(I=T[C],this.options[C]=I);for(C in _)y.call(_,C)&&(I=_[C],this.options[C]=I);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return D.prototype.processAsync=function(){var _,C;try{return this.remaining.length<=this.options.chunkSize?(_=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(_),this.saxParser.close()):(_=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(_),E(this.processAsync))}catch(T){if(C=T,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(C)}},D.prototype.assignOrPush=function(_,C,T){return C in _?(_[C]instanceof Array||n(_,C,[_[C]]),_[C].push(T)):this.options.explicitArray?n(_,C,[T]):n(_,C,T)},D.prototype.reset=function(){var _,C,T,I;return this.removeAllListeners(),this.saxParser=l.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(g){return function(v){if(g.saxParser.resume(),!g.saxParser.errThrown)return g.saxParser.errThrown=!0,g.emit("error",v)}}(this),this.saxParser.onend=function(g){return function(){if(!g.saxParser.ended)return g.saxParser.ended=!0,g.emit("end",g.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,I=[],_=this.options.attrkey,C=this.options.charkey,this.saxParser.onopentag=function(g){return function(v){var M,X,q,U,d;if(q={},q[C]="",!g.options.ignoreAttrs){d=v.attributes;for(M in d)y.call(d,M)&&(!(_ in q)&&!g.options.mergeAttrs&&(q[_]={}),X=g.options.attrValueProcessors?r(g.options.attrValueProcessors,v.attributes[M],M):v.attributes[M],U=g.options.attrNameProcessors?r(g.options.attrNameProcessors,M):M,g.options.mergeAttrs?g.assignOrPush(q,U,X):n(q[_],U,X))}return q["#name"]=g.options.tagNameProcessors?r(g.options.tagNameProcessors,v.name):v.name,g.options.xmlns&&(q[g.options.xmlnskey]={uri:v.uri,local:v.local}),I.push(q)}}(this),this.saxParser.onclosetag=function(g){return function(){var v,M,X,q,U,d,B,S,R,$;if(d=I.pop(),U=d["#name"],(!g.options.explicitChildren||!g.options.preserveChildrenOrder)&&delete d["#name"],d.cdata===!0&&(v=d.cdata,delete d.cdata),R=I[I.length-1],d[C].match(/^\s*$/)&&!v?(M=d[C],delete d[C]):(g.options.trim&&(d[C]=d[C].trim()),g.options.normalize&&(d[C]=d[C].replace(/\s{2,}/g," ").trim()),d[C]=g.options.valueProcessors?r(g.options.valueProcessors,d[C],U):d[C],Object.keys(d).length===1&&C in d&&!g.EXPLICIT_CHARKEY&&(d=d[C])),i(d)&&(typeof g.options.emptyTag=="function"?d=g.options.emptyTag():d=g.options.emptyTag!==""?g.options.emptyTag:M),g.options.validator!=null&&($="/"+function(){var W,G,k;for(k=[],W=0,G=I.length;W<G;W++)q=I[W],k.push(q["#name"]);return k}().concat(U).join("/"),function(){var W;try{return d=g.options.validator($,R&&R[U],d)}catch(G){return W=G,g.emit("error",W)}}()),g.options.explicitChildren&&!g.options.mergeAttrs&&typeof d=="object"){if(!g.options.preserveChildrenOrder)q={},g.options.attrkey in d&&(q[g.options.attrkey]=d[g.options.attrkey],delete d[g.options.attrkey]),!g.options.charsAsChildren&&g.options.charkey in d&&(q[g.options.charkey]=d[g.options.charkey],delete d[g.options.charkey]),Object.getOwnPropertyNames(d).length>0&&(q[g.options.childkey]=d),d=q;else if(R){R[g.options.childkey]=R[g.options.childkey]||[],B={};for(X in d)y.call(d,X)&&n(B,X,d[X]);R[g.options.childkey].push(B),delete d["#name"],Object.keys(d).length===1&&C in d&&!g.EXPLICIT_CHARKEY&&(d=d[C])}}return I.length>0?g.assignOrPush(R,U,d):(g.options.explicitRoot&&(S=d,d={},n(d,U,S)),g.resultObject=d,g.saxParser.ended=!0,g.emit("end",g.resultObject))}}(this),T=function(g){return function(v){var M,X;if(X=I[I.length-1],X)return X[C]+=v,g.options.explicitChildren&&g.options.preserveChildrenOrder&&g.options.charsAsChildren&&(g.options.includeWhiteChars||v.replace(/\\n/g,"").trim()!=="")&&(X[g.options.childkey]=X[g.options.childkey]||[],M={"#name":"__text__"},M[C]=v,g.options.normalize&&(M[C]=M[C].replace(/\s{2,}/g," ").trim()),X[g.options.childkey].push(M)),X}}(this),this.saxParser.ontext=T,this.saxParser.oncdata=function(g){return function(v){var M;if(M=T(v),M)return M.cdata=!0}}()},D.prototype.parseString=function(_,C){var T;C!=null&&typeof C=="function"&&(this.on("end",function(I){return this.reset(),C(null,I)}),this.on("error",function(I){return this.reset(),C(I)}));try{return _=_.toString(),_.trim()===""?(this.emit("end",null),!0):(_=t.stripBOM(_),this.options.async?(this.remaining=_,E(this.processAsync),this.saxParser):this.saxParser.write(_).close())}catch(I){if(T=I,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw T}else return this.emit("error",T),this.saxParser.errThrown=!0}},D.prototype.parseStringPromise=function(_){return new Promise(function(C){return function(T,I){return C.parseString(_,function(g,v){return g?I(g):T(v)})}}(this))},D}(s),a.parseString=function(w,D,_){var C,T,I;return _!=null?(typeof _=="function"&&(C=_),typeof D=="object"&&(T=D)):(typeof D=="function"&&(C=D),T={}),I=new a.Parser(T),I.parseString(w,C)},a.parseStringPromise=function(w,D){var _,C;return typeof D=="object"&&(_=D),C=new a.Parser(_),C.parseStringPromise(w)}}).call(it)}(Un)),Un}var ps;(function(){var a,t,e,n=function(i,r){for(var o in r)s.call(r,o)&&(i[o]=r[o]);function l(){this.constructor=i}return l.prototype=r.prototype,i.prototype=new l,i.__super__=r.prototype,i},s={}.hasOwnProperty;t=Zn(),a=Vo(),e=Jo(),hs(),t.defaults,function(i){n(r,i);function r(o){this.message=o}return r}(Error),a.Builder,e.Parser,e.parseString,ps=e.parseStringPromise}).call(it);class ds{constructor(t,e,n){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=t,this.cdp=e,this.readPHPFile=n.getPHPFile,this.phpRoot=n.phpRoot||"";for(const s of n.knownScriptUrls)this.scriptIdByUrl.set(s,this.getOrCreateScriptId(s));this.breakOnFirstLine=n.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async t=>{try{const e=await ps(t,{explicitArray:!1});await this.handleDbgpMessage(e)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const t=this.scriptIdByUrl.entries().next().value;t&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:t[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
105
+ `?(b.line++,b.column=0):b.column++);b.textNode+=x.substring(J,j-1)}P==="<"&&!(b.sawRoot&&b.closedRoot&&!b.strict)?(b.state=d.OPEN_WAKA,b.startTagPosition=b.position):(!v(P)&&(!b.sawRoot||b.closedRoot)&&V(b,"Text data outside of root node."),P==="&"?b.state=d.TEXT_ENTITY:b.textNode+=P);continue;case d.SCRIPT:P==="<"?b.state=d.SCRIPT_ENDING:b.script+=P;continue;case d.SCRIPT_ENDING:P==="/"?b.state=d.CLOSE_TAG:(b.script+="<"+P,b.state=d.SCRIPT);continue;case d.OPEN_WAKA:if(P==="!")b.state=d.SGML_DECL,b.sgmlDecl="";else if(!v(P))if(q(C,P))b.state=d.OPEN_TAG,b.tagName=P;else if(P==="/")b.state=d.CLOSE_TAG,b.tagName="";else if(P==="?")b.state=d.PROC_INST,b.procInstName=b.procInstBody="";else{if(V(b,"Unencoded <"),b.startTagPosition+1<b.position){var ot=b.position-b.startTagPosition;P=new Array(ot).join(" ")+P}b.textNode+="<"+P,b.state=d.TEXT}continue;case d.SGML_DECL:if(b.sgmlDecl+P==="--"){b.state=d.COMMENT,b.comment="",b.sgmlDecl="";continue}b.doctype&&b.doctype!==!0&&b.sgmlDecl?(b.state=d.DOCTYPE_DTD,b.doctype+="<!"+b.sgmlDecl+P,b.sgmlDecl=""):(b.sgmlDecl+P).toUpperCase()===p?(R(b,"onopencdata"),b.state=d.CDATA,b.sgmlDecl="",b.cdata=""):(b.sgmlDecl+P).toUpperCase()===y?(b.state=d.DOCTYPE,(b.doctype||b.sawRoot)&&V(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):P===">"?(R(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=d.TEXT):(M(P)&&(b.state=d.SGML_DECL_QUOTED),b.sgmlDecl+=P);continue;case d.SGML_DECL_QUOTED:P===b.q&&(b.state=d.SGML_DECL,b.q=""),b.sgmlDecl+=P;continue;case d.DOCTYPE:P===">"?(b.state=d.TEXT,R(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=P,P==="["?b.state=d.DOCTYPE_DTD:M(P)&&(b.state=d.DOCTYPE_QUOTED,b.q=P));continue;case d.DOCTYPE_QUOTED:b.doctype+=P,P===b.q&&(b.q="",b.state=d.DOCTYPE);continue;case d.DOCTYPE_DTD:P==="]"?(b.doctype+=P,b.state=d.DOCTYPE):P==="<"?(b.state=d.OPEN_WAKA,b.startTagPosition=b.position):M(P)?(b.doctype+=P,b.state=d.DOCTYPE_DTD_QUOTED,b.q=P):b.doctype+=P;continue;case d.DOCTYPE_DTD_QUOTED:b.doctype+=P,P===b.q&&(b.state=d.DOCTYPE_DTD,b.q="");continue;case d.COMMENT:P==="-"?b.state=d.COMMENT_ENDING:b.comment+=P;continue;case d.COMMENT_ENDING:P==="-"?(b.state=d.COMMENT_ENDED,b.comment=W(b.opt,b.comment),b.comment&&R(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+P,b.state=d.COMMENT);continue;case d.COMMENT_ENDED:P!==">"?(V(b,"Malformed comment"),b.comment+="--"+P,b.state=d.COMMENT):b.doctype&&b.doctype!==!0?b.state=d.DOCTYPE_DTD:b.state=d.TEXT;continue;case d.CDATA:P==="]"?b.state=d.CDATA_ENDING:b.cdata+=P;continue;case d.CDATA_ENDING:P==="]"?b.state=d.CDATA_ENDING_2:(b.cdata+="]"+P,b.state=d.CDATA);continue;case d.CDATA_ENDING_2:P===">"?(b.cdata&&R(b,"oncdata",b.cdata),R(b,"onclosecdata"),b.cdata="",b.state=d.TEXT):P==="]"?b.cdata+="]":(b.cdata+="]]"+P,b.state=d.CDATA);continue;case d.PROC_INST:P==="?"?b.state=d.PROC_INST_ENDING:v(P)?b.state=d.PROC_INST_BODY:b.procInstName+=P;continue;case d.PROC_INST_BODY:if(!b.procInstBody&&v(P))continue;P==="?"?b.state=d.PROC_INST_ENDING:b.procInstBody+=P;continue;case d.PROC_INST_ENDING:P===">"?(R(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=d.TEXT):(b.procInstBody+="?"+P,b.state=d.PROC_INST_BODY);continue;case d.OPEN_TAG:q(T,P)?b.tagName+=P:(ft(b),P===">"?st(b):P==="/"?b.state=d.OPEN_TAG_SLASH:(v(P)||V(b,"Invalid character in tag name"),b.state=d.ATTRIB));continue;case d.OPEN_TAG_SLASH:P===">"?(st(b,!0),ut(b)):(V(b,"Forward-slash in opening tag not followed by >"),b.state=d.ATTRIB);continue;case d.ATTRIB:if(v(P))continue;P===">"?st(b):P==="/"?b.state=d.OPEN_TAG_SLASH:q(C,P)?(b.attribName=P,b.attribValue="",b.state=d.ATTRIB_NAME):V(b,"Invalid attribute name");continue;case d.ATTRIB_NAME:P==="="?b.state=d.ATTRIB_VALUE:P===">"?(V(b,"Attribute without value"),b.attribValue=b.attribName,at(b),st(b)):v(P)?b.state=d.ATTRIB_NAME_SAW_WHITE:q(T,P)?b.attribName+=P:V(b,"Invalid attribute name");continue;case d.ATTRIB_NAME_SAW_WHITE:if(P==="=")b.state=d.ATTRIB_VALUE;else{if(v(P))continue;V(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",R(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",P===">"?st(b):q(C,P)?(b.attribName=P,b.state=d.ATTRIB_NAME):(V(b,"Invalid attribute name"),b.state=d.ATTRIB)}continue;case d.ATTRIB_VALUE:if(v(P))continue;M(P)?(b.q=P,b.state=d.ATTRIB_VALUE_QUOTED):(b.opt.unquotedAttributeValues||G(b,"Unquoted attribute value"),b.state=d.ATTRIB_VALUE_UNQUOTED,b.attribValue=P);continue;case d.ATTRIB_VALUE_QUOTED:if(P!==b.q){P==="&"?b.state=d.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=P;continue}at(b),b.q="",b.state=d.ATTRIB_VALUE_CLOSED;continue;case d.ATTRIB_VALUE_CLOSED:v(P)?b.state=d.ATTRIB:P===">"?st(b):P==="/"?b.state=d.OPEN_TAG_SLASH:q(C,P)?(V(b,"No whitespace between attributes"),b.attribName=P,b.attribValue="",b.state=d.ATTRIB_NAME):V(b,"Invalid attribute name");continue;case d.ATTRIB_VALUE_UNQUOTED:if(!X(P)){P==="&"?b.state=d.ATTRIB_VALUE_ENTITY_U:b.attribValue+=P;continue}at(b),P===">"?st(b):b.state=d.ATTRIB;continue;case d.CLOSE_TAG:if(b.tagName)P===">"?ut(b):q(T,P)?b.tagName+=P:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=d.SCRIPT):(v(P)||V(b,"Invalid tagname in closing tag"),b.state=d.CLOSE_TAG_SAW_WHITE);else{if(v(P))continue;U(C,P)?b.script?(b.script+="</"+P,b.state=d.SCRIPT):V(b,"Invalid tagname in closing tag."):b.tagName=P}continue;case d.CLOSE_TAG_SAW_WHITE:if(v(P))continue;P===">"?ut(b):V(b,"Invalid characters in closing tag");continue;case d.TEXT_ENTITY:case d.ATTRIB_VALUE_ENTITY_Q:case d.ATTRIB_VALUE_ENTITY_U:var rt,ht;switch(b.state){case d.TEXT_ENTITY:rt=d.TEXT,ht="textNode";break;case d.ATTRIB_VALUE_ENTITY_Q:rt=d.ATTRIB_VALUE_QUOTED,ht="attribValue";break;case d.ATTRIB_VALUE_ENTITY_U:rt=d.ATTRIB_VALUE_UNQUOTED,ht="attribValue";break}if(P===";"){var A=_t(b);b.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(A)?(b.entity="",b.state=rt,b.write(A)):(b[ht]+=A,b.entity="",b.state=rt)}else q(b.entity.length?g:I,P)?b.entity+=P:(V(b,"Invalid character in entity name"),b[ht]+="&"+b.entity+P,b.entity="",b.state=rt);continue;default:throw new Error(b,"Unknown state: "+b.state)}return b.position>=b.bufferCheckPosition&&s(b),b}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var x=String.fromCharCode,b=Math.floor,j=function(){var P=16384,J=[],ot,rt,ht=-1,A=arguments.length;if(!A)return"";for(var f="";++ht<A;){var u=Number(arguments[ht]);if(!isFinite(u)||u<0||u>1114111||b(u)!==u)throw RangeError("Invalid code point: "+u);u<=65535?J.push(u):(u-=65536,ot=(u>>10)+55296,rt=u%1024+56320,J.push(ot,rt)),(ht+1===A||J.length>P)&&(f+=x.apply(null,J),J.length=0)}return f};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:j,configurable:!0,writable:!0}):String.fromCodePoint=j}()})(a)}(Xn)),Xn}var Wn={},Ri;function Qo(){return Ri||(Ri=1,function(){Wn.stripBOM=function(a){return a[0]==="\uFEFF"?a.substring(1):a}}.call(it)),Wn}var se={},Ui;function hs(){return Ui||(Ui=1,function(){var a;a=new RegExp(/(?!xmlns)^.*:/),se.normalize=function(t){return t.toLowerCase()},se.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},se.stripPrefix=function(t){return t.replace(a,"")},se.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},se.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(it)),se}var Xi;function Jo(){return Xi||(Xi=1,function(a){(function(){var t,e,n,s,i,r,o,l,E,m=function(w,D){return function(){return w.apply(D,arguments)}},p=function(w,D){for(var _ in D)y.call(D,_)&&(w[_]=D[_]);function C(){this.constructor=w}return C.prototype=D.prototype,w.prototype=new C,w.__super__=D.prototype,w},y={}.hasOwnProperty;l=Ko(),s=Qn,t=Qo(),o=hs(),E=xs.setImmediate,e=Zn().defaults,i=function(w){return typeof w=="object"&&w!=null&&Object.keys(w).length===0},r=function(w,D,_){var C,T,I;for(C=0,T=w.length;C<T;C++)I=w[C],D=I(D,_);return D},n=function(w,D,_){var C;return C=Object.create(null),C.value=_,C.writable=!0,C.enumerable=!0,C.configurable=!0,Object.defineProperty(w,D,C)},a.Parser=function(w){p(D,w);function D(_){this.parseStringPromise=m(this.parseStringPromise,this),this.parseString=m(this.parseString,this),this.reset=m(this.reset,this),this.assignOrPush=m(this.assignOrPush,this),this.processAsync=m(this.processAsync,this);var C,T,I;if(!(this instanceof a.Parser))return new a.Parser(_);this.options={},T=e["0.2"];for(C in T)y.call(T,C)&&(I=T[C],this.options[C]=I);for(C in _)y.call(_,C)&&(I=_[C],this.options[C]=I);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(o.normalize)),this.reset()}return D.prototype.processAsync=function(){var _,C;try{return this.remaining.length<=this.options.chunkSize?(_=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(_),this.saxParser.close()):(_=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(_),E(this.processAsync))}catch(T){if(C=T,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(C)}},D.prototype.assignOrPush=function(_,C,T){return C in _?(_[C]instanceof Array||n(_,C,[_[C]]),_[C].push(T)):this.options.explicitArray?n(_,C,[T]):n(_,C,T)},D.prototype.reset=function(){var _,C,T,I;return this.removeAllListeners(),this.saxParser=l.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(g){return function(v){if(g.saxParser.resume(),!g.saxParser.errThrown)return g.saxParser.errThrown=!0,g.emit("error",v)}}(this),this.saxParser.onend=function(g){return function(){if(!g.saxParser.ended)return g.saxParser.ended=!0,g.emit("end",g.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,I=[],_=this.options.attrkey,C=this.options.charkey,this.saxParser.onopentag=function(g){return function(v){var M,X,q,U,d;if(q={},q[C]="",!g.options.ignoreAttrs){d=v.attributes;for(M in d)y.call(d,M)&&(!(_ in q)&&!g.options.mergeAttrs&&(q[_]={}),X=g.options.attrValueProcessors?r(g.options.attrValueProcessors,v.attributes[M],M):v.attributes[M],U=g.options.attrNameProcessors?r(g.options.attrNameProcessors,M):M,g.options.mergeAttrs?g.assignOrPush(q,U,X):n(q[_],U,X))}return q["#name"]=g.options.tagNameProcessors?r(g.options.tagNameProcessors,v.name):v.name,g.options.xmlns&&(q[g.options.xmlnskey]={uri:v.uri,local:v.local}),I.push(q)}}(this),this.saxParser.onclosetag=function(g){return function(){var v,M,X,q,U,d,B,S,R,$;if(d=I.pop(),U=d["#name"],(!g.options.explicitChildren||!g.options.preserveChildrenOrder)&&delete d["#name"],d.cdata===!0&&(v=d.cdata,delete d.cdata),R=I[I.length-1],d[C].match(/^\s*$/)&&!v?(M=d[C],delete d[C]):(g.options.trim&&(d[C]=d[C].trim()),g.options.normalize&&(d[C]=d[C].replace(/\s{2,}/g," ").trim()),d[C]=g.options.valueProcessors?r(g.options.valueProcessors,d[C],U):d[C],Object.keys(d).length===1&&C in d&&!g.EXPLICIT_CHARKEY&&(d=d[C])),i(d)&&(typeof g.options.emptyTag=="function"?d=g.options.emptyTag():d=g.options.emptyTag!==""?g.options.emptyTag:M),g.options.validator!=null&&($="/"+function(){var W,G,k;for(k=[],W=0,G=I.length;W<G;W++)q=I[W],k.push(q["#name"]);return k}().concat(U).join("/"),function(){var W;try{return d=g.options.validator($,R&&R[U],d)}catch(G){return W=G,g.emit("error",W)}}()),g.options.explicitChildren&&!g.options.mergeAttrs&&typeof d=="object"){if(!g.options.preserveChildrenOrder)q={},g.options.attrkey in d&&(q[g.options.attrkey]=d[g.options.attrkey],delete d[g.options.attrkey]),!g.options.charsAsChildren&&g.options.charkey in d&&(q[g.options.charkey]=d[g.options.charkey],delete d[g.options.charkey]),Object.getOwnPropertyNames(d).length>0&&(q[g.options.childkey]=d),d=q;else if(R){R[g.options.childkey]=R[g.options.childkey]||[],B={};for(X in d)y.call(d,X)&&n(B,X,d[X]);R[g.options.childkey].push(B),delete d["#name"],Object.keys(d).length===1&&C in d&&!g.EXPLICIT_CHARKEY&&(d=d[C])}}return I.length>0?g.assignOrPush(R,U,d):(g.options.explicitRoot&&(S=d,d={},n(d,U,S)),g.resultObject=d,g.saxParser.ended=!0,g.emit("end",g.resultObject))}}(this),T=function(g){return function(v){var M,X;if(X=I[I.length-1],X)return X[C]+=v,g.options.explicitChildren&&g.options.preserveChildrenOrder&&g.options.charsAsChildren&&(g.options.includeWhiteChars||v.replace(/\\n/g,"").trim()!=="")&&(X[g.options.childkey]=X[g.options.childkey]||[],M={"#name":"__text__"},M[C]=v,g.options.normalize&&(M[C]=M[C].replace(/\s{2,}/g," ").trim()),X[g.options.childkey].push(M)),X}}(this),this.saxParser.ontext=T,this.saxParser.oncdata=function(g){return function(v){var M;if(M=T(v),M)return M.cdata=!0}}()},D.prototype.parseString=function(_,C){var T;C!=null&&typeof C=="function"&&(this.on("end",function(I){return this.reset(),C(null,I)}),this.on("error",function(I){return this.reset(),C(I)}));try{return _=_.toString(),_.trim()===""?(this.emit("end",null),!0):(_=t.stripBOM(_),this.options.async?(this.remaining=_,E(this.processAsync),this.saxParser):this.saxParser.write(_).close())}catch(I){if(T=I,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw T}else return this.emit("error",T),this.saxParser.errThrown=!0}},D.prototype.parseStringPromise=function(_){return new Promise(function(C){return function(T,I){return C.parseString(_,function(g,v){return g?I(g):T(v)})}}(this))},D}(s),a.parseString=function(w,D,_){var C,T,I;return _!=null?(typeof _=="function"&&(C=_),typeof D=="object"&&(T=D)):(typeof D=="function"&&(C=D),T={}),I=new a.Parser(T),I.parseString(w,C)},a.parseStringPromise=function(w,D){var _,C;return typeof D=="object"&&(_=D),C=new a.Parser(_),C.parseStringPromise(w)}}).call(it)}(Un)),Un}var ps;(function(){var a,t,e,n=function(i,r){for(var o in r)s.call(r,o)&&(i[o]=r[o]);function l(){this.constructor=i}return l.prototype=r.prototype,i.prototype=new l,i.__super__=r.prototype,i},s={}.hasOwnProperty;t=Zn(),a=Vo(),e=Jo(),hs(),t.defaults,function(i){n(r,i);function r(o){this.message=o}return r}(Error),a.Builder,e.Parser,e.parseString,ps=e.parseStringPromise}).call(it);class ds{constructor(t,e,n){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=t,this.cdp=e,this.readPHPFile=n.getPHPFile,this.phpRoot=n.phpRoot||"";for(const s of n.knownScriptUrls)this.scriptIdByUrl.set(s,this.getOrCreateScriptId(s));this.breakOnFirstLine=n.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async t=>{try{const e=await ps(t,{explicitArray:!1});await this.handleDbgpMessage(e)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const t=this.scriptIdByUrl.entries().next().value;t&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:t[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
106
106
  ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
107
107
 
108
108
  1. Add breakpoints in your files to start step debugging.
@@ -110,12 +110,12 @@ Actual: `+x.attribValue);else{var J=x.tag,ot=x.tags[x.tags.length-1]||x;J.ns===o
110
110
  2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
111
111
 
112
112
  3. Witness the magic break.`,timestamp:Date.now()}}}),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:" ",timestamp:Date.now()}}})})}stop(){this.dbgp.close(),this.cdp.close()}async sendInitialScripts(){for(const[t,e]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(t,e)}async sendScriptToCDP(t,e){const n=this.uriFromBridgeToCDPSyntaxHighlight(t),s=this.uriFromBridgeToCDP(t),i=await this.readPHPFile(t),r=i.split(`
113
- `),o=r.map((p,y)=>y===0?"AAAA":"AACA").join(";"),l={version:3,file:s,sources:[n],sourcesContent:[i],mappings:o},m=`data:application/json;base64,${Buffer.from(JSON.stringify(l),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:e,url:s,startLine:0,startColumn:0,endLine:r.length,endColumn:0,executionContextId:1,sourceMapURL:m}})}getOrCreateScriptId(t){let e=this.scriptIdByUrl.get(t);return e||(e=Fo.createHash("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,e)),e}formatPropertyFullName(t){let e=!1,n="";for(const s of t)s==='"'||s==="\\"||s==="\0"?(n+="\\"+s,e=!0):s===" "?(n+=s,e=!0):n+=s;return(e||t.includes("'"))&&(n=`"${n}"`),n}sendDbgpCommand(t,e){const s=(this.nextTxnId++).toString();let i=`${t} -i ${s}`;return e!==void 0&&(i+=` ${e}`),this.dbgp.sendCommand(i),s}async handleCdpMessage(t){const{id:e,method:n,params:s}=t;let i={},r=!0;switch(n){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:o,lineNumber:l}=s,E=this.uriFromCDPToBridge(o),m=this.uriFromBridgeToDBGP(E),p=(typeof l=="number"?l:0)+1,y=String(this.breakpoints.size+1);if(this.xdebugConnected){const w=`breakpoint_set -t line -f ${this.formatPropertyFullName(m)} -n ${p}`,D=this.sendDbgpCommand(w);this.pendingCommands.set(D,{cdpId:e,cdpMethod:n,params:{breakpointId:y,fileUri:E,lineNumber:p}}),r=!1}else this.breakpoints.set(y,{cdpId:y,xdebugId:null,fileUri:E,lineNumber:p}),i={breakpointId:y,locations:[{scriptId:this.getOrCreateScriptId(E),lineNumber:p-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:o}=s,l=String(o),E=this.breakpoints.get(l);if(E){if(E.xdebugId&&this.xdebugConnected){const m=`breakpoint_remove -d ${E.xdebugId}`,p=this.sendDbgpCommand(m);this.pendingCommands.set(p,{cdpId:e,cdpMethod:n}),r=!1}this.breakpoints.delete(l)}i={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),i={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),i={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),i={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),i={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),i={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const o=s.expression||"",l=s.callFrameId;if(n==="Debugger.evaluateOnCallFrame"){if(l===void 0||!this.callFramesMap.has(l)){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(l)!==0){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const E=Buffer.from(o).toString("base64"),m=this.sendDbgpCommand("eval",`-- ${E}`);this.pendingCommands.set(m,{cdpId:e,cdpMethod:n}),r=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:o}=s,l=this.objectHandles.get(o);if(l&&this.xdebugConnected)if(l.type==="context"){const E=l.contextId??0,p=`context_get -d ${l.depth} -c ${E} -p 0 -m 32`,y=this.sendDbgpCommand(p),w={...l,currentPage:0,aggregatedProps:[]};this.objectHandles.set(o,w),this.pendingCommands.set(y,{cdpId:e,cdpMethod:n,params:{objectId:o}}),r=!1}else if(l.type==="property"){const E=l.depth,m=l.fullname,p=this.formatPropertyFullName(m),y=`property_get -d ${E} -n ${p} -p 0 -m 32`,w=this.sendDbgpCommand(y),D={...l,currentPage:0,aggregatedProps:[]};this.objectHandles.set(o,D),this.pendingCommands.set(w,{cdpId:e,cdpMethod:n,params:{parentObjectId:o}}),r=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const o=s.scriptId,l=[...this.scriptIdByUrl.entries()].find(([,m])=>m===o)?.[0],E=[];l&&E.push(`Here's the full path for your convenience:
113
+ `),o=r.map((p,y)=>y===0?"AAAA":"AACA").join(";"),l={version:3,file:s,sources:[n],sourcesContent:[i],mappings:o},m=`data:application/json;base64,${Buffer.from(JSON.stringify(l),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:e,url:s,startLine:0,startColumn:0,endLine:r.length,endColumn:0,executionContextId:1,sourceMapURL:m}})}getOrCreateScriptId(t){let e=this.scriptIdByUrl.get(t);return e||(e=Es.createHash("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,e)),e}formatPropertyFullName(t){let e=!1,n="";for(const s of t)s==='"'||s==="\\"||s==="\0"?(n+="\\"+s,e=!0):s===" "?(n+=s,e=!0):n+=s;return(e||t.includes("'"))&&(n=`"${n}"`),n}sendDbgpCommand(t,e){const s=(this.nextTxnId++).toString();let i=`${t} -i ${s}`;return e!==void 0&&(i+=` ${e}`),this.dbgp.sendCommand(i),s}async handleCdpMessage(t){const{id:e,method:n,params:s}=t;let i={},r=!0;switch(n){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:o,lineNumber:l}=s,E=this.uriFromCDPToBridge(o),m=this.uriFromBridgeToDBGP(E),p=(typeof l=="number"?l:0)+1,y=String(this.breakpoints.size+1);if(this.xdebugConnected){const w=`breakpoint_set -t line -f ${this.formatPropertyFullName(m)} -n ${p}`,D=this.sendDbgpCommand(w);this.pendingCommands.set(D,{cdpId:e,cdpMethod:n,params:{breakpointId:y,fileUri:E,lineNumber:p}}),r=!1}else this.breakpoints.set(y,{cdpId:y,xdebugId:null,fileUri:E,lineNumber:p}),i={breakpointId:y,locations:[{scriptId:this.getOrCreateScriptId(E),lineNumber:p-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:o}=s,l=String(o),E=this.breakpoints.get(l);if(E){if(E.xdebugId&&this.xdebugConnected){const m=`breakpoint_remove -d ${E.xdebugId}`,p=this.sendDbgpCommand(m);this.pendingCommands.set(p,{cdpId:e,cdpMethod:n}),r=!1}this.breakpoints.delete(l)}i={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),i={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),i={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),i={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),i={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),i={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const o=s.expression||"",l=s.callFrameId;if(n==="Debugger.evaluateOnCallFrame"){if(l===void 0||!this.callFramesMap.has(l)){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(l)!==0){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const E=Buffer.from(o).toString("base64"),m=this.sendDbgpCommand("eval",`-- ${E}`);this.pendingCommands.set(m,{cdpId:e,cdpMethod:n}),r=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:o}=s,l=this.objectHandles.get(o);if(l&&this.xdebugConnected)if(l.type==="context"){const E=l.contextId??0,p=`context_get -d ${l.depth} -c ${E} -p 0 -m 32`,y=this.sendDbgpCommand(p),w={...l,currentPage:0,aggregatedProps:[]};this.objectHandles.set(o,w),this.pendingCommands.set(y,{cdpId:e,cdpMethod:n,params:{objectId:o}}),r=!1}else if(l.type==="property"){const E=l.depth,m=l.fullname,p=this.formatPropertyFullName(m),y=`property_get -d ${E} -n ${p} -p 0 -m 32`,w=this.sendDbgpCommand(y),D={...l,currentPage:0,aggregatedProps:[]};this.objectHandles.set(o,D),this.pendingCommands.set(w,{cdpId:e,cdpMethod:n,params:{parentObjectId:o}}),r=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const o=s.scriptId,l=[...this.scriptIdByUrl.entries()].find(([,m])=>m===o)?.[0],E=[];l&&E.push(`Here's the full path for your convenience:
114
114
  `,`${this.uriFromBridgeToCDPSyntaxHighlight(l).replace("file://","")}
115
115
  `),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...E,"What is this file, then? It's a placeholder required due to the dev tools limitations.","The XDebug <-> Devtools bridge implement PHP syntax highlighting using source maps,",'and the unfortunate side effect is having a "source" file and a "target" file.',`This is the "source". If you're interested in even more details, see the discussion at:
116
116
  `,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
117
117
  `)};break}default:i={};break}r&&this.cdp.sendMessage({id:e,result:i})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const e="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,n])=>n===t.slice(e.length))?.[0]??""}uriFromBridgeToDBGP(t){return Ot.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const e=t.indexOf(this.phpRoot);return e!==-1?t.slice(e):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(n=>{this.handleCdpMessage({id:n.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(n.fileUri),lineNumber:n.lineNumber-1}})});const e=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(e,{});return}if(t.response){const e=t.response,n=e.$,s=n.command,i=n.transaction_id,r=this.pendingCommands.get(i);switch(s){case"breakpoint_set":{if(r&&r.cdpId!==void 0&&r.cdpMethod==="Debugger.setBreakpointByUrl"){const o=n.id,l=r.params;if(l){const{breakpointId:E,fileUri:m,lineNumber:p}=l;this.breakpoints.set(E,{cdpId:E,xdebugId:o,fileUri:m,lineNumber:p});const y=this.getOrCreateScriptId(m),w={breakpointId:E,locations:[{scriptId:y,lineNumber:p-1,columnNumber:0}]};this.cdp.sendMessage({id:r.cdpId,result:w})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{r&&r.cdpId!==void 0&&(this.cdp.sendMessage({id:r.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const o=n.status;if(e["xdebug:message"]){const l=this.uriFromDBGPToBridge(e["xdebug:message"].$.filename);l&&!this.scriptIdByUrl.has(l)&&await this.sendScriptToCDP(l,this.getOrCreateScriptId(l))}if(o==="break"){const l=this.sendDbgpCommand("stack_get");this.pendingCommands.set(l,{}),this.pendingCommands.delete(i)}else(o==="stopping"||o==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(r&&r.cdpId!==void 0){let o;if(e.property){const E=e.property,m=E.$.type,p=E.$.encoding;let y=null;if(Object.prototype.hasOwnProperty.call(E,"_")?y=E._:typeof E.$value<"u"&&(y=E.$value),p==="base64"&&y!==null)try{y=Buffer.from(y,"base64").toString()}catch{}if(m==="string")o={type:"string",value:y??""};else if(m==="int"||m==="float"||m==="bool"||m==="boolen"||m==="integer"||m==="double"){let w=y;m.startsWith("int")||m==="integer"?w=parseInt(y||"0",10):m==="float"||m==="double"?w=parseFloat(y||"0"):m.startsWith("bool")&&(w=y==="1"||y==="true"),o={type:"number",value:w}}else if(m==="array"||m==="object"){const w=E.$.classname||(m==="array"?"Array":"Object"),D=String(this.nextObjectId++),_=E.$.fullname||"";this.objectHandles.set(D,{type:"property",depth:0,contextId:0,fullname:_}),o={type:"object",objectId:D,className:w,description:w}}else m==="null"?o={type:"object",subtype:"null",value:null}:o={type:"undefined",value:void 0}}else o={type:"undefined",value:void 0};const l={result:o};this.cdp.sendMessage({id:r.cdpId,result:l}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(r&&r.cdpId!==void 0){const o=r.params?.objectId||r.params?.parentObjectId,l=o?this.objectHandles.get(o):null,E=e.property?.property??e.property,m=[];if(E){const p=Array.isArray(E)?E:[E];for(const y of p){const w=y.$.name||y.$.fullname||"";let D=y.$.type||"undefined";const _=y.$.children==="1",C=y.$.encoding;let T=null;if(typeof y._<"u"&&(T=y._),C==="base64"&&T!==null)try{T=Buffer.from(T,"base64").toString()}catch{}if(_){const I=y.$.classname||(D==="array"?"Array":"Object"),g=String(this.nextObjectId++),v=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.contextId||0,M=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.depth||0;this.objectHandles.set(g,{type:"property",depth:M,contextId:v,fullname:y.$.fullname||w}),m.push({name:y.$.key||w,value:{type:"object",className:I,description:I,objectId:g},writable:!1,configurable:!1,enumerable:!0})}else{let I,g;D==="string"?I=T??"":D==="int"||D==="integer"?I=parseInt(T||"0",10):D==="float"||D==="double"?I=parseFloat(T||"0"):D==="bool"||D==="boolean"?(I=T==="1"||T==="true",D="boolean"):D==="null"?(I=null,g="null"):I=T;const v={type:D==="integer"?"number":D};g&&(v.subtype=g),v.value=I,m.push({name:y.$.key||w,value:v,writable:!1,configurable:!1,enumerable:!0})}}}if(l){const p=(l.aggregatedProps||[]).concat(m),y=32;if(m.length===y){const D=(l.currentPage||0)+1,_={...l,currentPage:D,aggregatedProps:p};this.objectHandles.set(o,_);let C;if(s==="context_get"){const I=l.contextId??0;C=`context_get -d ${l.depth} -c ${I} -p ${D} -m ${y}`}else{const I=l.depth,g=l.fullname,v=this.formatPropertyFullName(g);C=`property_get -d ${I} -n ${v} -p ${D} -m ${y}`}const T=this.sendDbgpCommand(C);this.pendingCommands.set(T,{cdpId:r.cdpId,cdpMethod:r.cdpMethod,params:r.params}),this.pendingCommands.delete(i);return}else{const D={result:p};this.cdp.sendMessage({id:r.cdpId,result:D}),this.pendingCommands.delete(i)}}else{const p={result:m};this.cdp.sendMessage({id:r.cdpId,result:p}),this.pendingCommands.delete(i)}}break}case"stack_get":{if(e.stack){const o=Array.isArray(e.stack)?e.stack:[e.stack],l=[];this.callFramesMap.clear();for(const m of o){const p=this.uriFromDBGPToBridge(m.$.filename),y=this.getOrCreateScriptId(p);this.scriptIdByUrl.has(p)||(this.scriptIdByUrl.set(p,y),await this.sendScriptToCDP(p,y))}for(const m of o){const p=parseInt(m.$.level,10),y=this.uriFromDBGPToBridge(m.$.filename),w=parseInt(m.$.lineno,10),D=m.$.where&&m.$.where!=="{main}"?m.$.where:"(anonymous)",_=`frame:${p}`;this.callFramesMap.set(_,p);const C=[],T=String(this.nextObjectId++);this.objectHandles.set(T,{type:"context",contextId:0,depth:p}),C.push({type:"local",object:{objectId:T,className:"Object",description:"Local"}});const I=String(this.nextObjectId++);this.objectHandles.set(I,{type:"context",contextId:1,depth:p}),C.push({type:"global",object:{objectId:I,className:"Object",description:"Global"}}),l.push({callFrameId:_,functionName:D,location:{scriptId:this.getOrCreateScriptId(y),lineNumber:w-1,columnNumber:0},scopeChain:C,this:{type:"object",className:"Object",description:"Object",objectId:I}})}let E="pause";if(o.length>0){const m=o[0];if(m.$.filename&&m.$.lineno){const p=this.uriFromDBGPToBridge(m.$.filename),y=parseInt(m.$.lineno,10);for(const w of this.breakpoints.values())if(w.fileUri===p&&w.lineNumber===y){E="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:E,callFrames:l,hitBreakpoints:E==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{r&&r.cdpId!==void 0&&(this.cdp.sendMessage({id:r.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const e=t.stream,n=e.$.type,s=e.$.encoding||"none";let i=typeof e._=="string"?e._:"";s==="base64"&&(i=Buffer.from(i,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:n==="stderr"?"error":"info",text:i,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function ms(a){const t=a.cdpPort??9229,e=a.dbgpPort??9003,n=a.cdpHost??"localhost",s=a.phpRoot??process.cwd(),i=a.breakOnFirstLine??!1;Lt.log("Starting XDebug Bridge...");const r=new Qi(t);Lt.log("Connect Chrome DevTools to CDP at:"),Lt.log(`devtools://devtools/bundled/inspector.html?ws=${n}:${t}
118
- `),await new Promise(p=>r.on("clientConnected",p)),await new Promise(p=>setTimeout(p,2e3)),Lt.log("Chrome connected! Initializing Xdebug receiver...");const o=new Ji(e);Lt.log(`XDebug receiver running on port ${e}`),Lt.log("Running a PHP script with Xdebug enabled...");function l(p){const y=[],w=Xt.readdirSync(p);for(const D of w){const _=Ot.join(p,D),C=Xt.lstatSync(_);C&&C.isDirectory()?y.push(...l(_)):D.endsWith(".php")&&y.push(_)}return y}const E=a.phpInstance?p=>a.phpInstance.readFileAsText(p):a.getPHPFile?a.getPHPFile:p=>Xt.readFileSync(p,"utf-8"),m=l(s);return new ds(o,r,{knownScriptUrls:m,phpRoot:s,getPHPFile:E,breakOnFirstLine:i})}const gs={Quiet:{name:"quiet",severity:xt.Fatal},Normal:{name:"normal",severity:xt.Info},Debug:{name:"debug",severity:xt.Debug}};function Zo(){return So(Js(process.argv)).usage(`
118
+ `),await new Promise(p=>r.on("clientConnected",p)),await new Promise(p=>setTimeout(p,2e3)),Lt.log("Chrome connected! Initializing Xdebug receiver...");const o=new Ji(e);Lt.log(`XDebug receiver running on port ${e}`),Lt.log("Running a PHP script with Xdebug enabled...");function l(p){const y=[],w=Xt.readdirSync(p);for(const D of w){const _=Ot.join(p,D),C=Xt.lstatSync(_);C&&C.isDirectory()?y.push(...l(_)):D.endsWith(".php")&&y.push(_)}return y}const E=a.phpInstance?p=>a.phpInstance.readFileAsText(p):a.getPHPFile?a.getPHPFile:p=>Xt.readFileSync(p,"utf-8"),m=l(s);return new ds(o,r,{knownScriptUrls:m,phpRoot:s,getPHPFile:E,breakOnFirstLine:i})}const gs={Quiet:{name:"quiet",severity:xt.Fatal},Normal:{name:"normal",severity:xt.Info},Debug:{name:"debug",severity:xt.Debug}};function Zo(){return Fo(Zs(process.argv)).usage(`
119
119
  XDebug Bridge Server CLI
120
120
 
121
121
  Usage: xdebug-bridge [options]