@php-wasm/xdebug-bridge 3.1.18 → 3.1.20

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.
@@ -0,0 +1,123 @@
1
+ "use strict";const ci=require("assert"),bt=require("path"),Ft=require("fs"),$n=require("util"),is=require("url"),rs=require("ws"),ss=require("net"),os=require("crypto"),as=require("timers");var Be=typeof document<"u"?document.currentScript:null;const cs="playground-log",ui=(o,...t)=>{vt.dispatchEvent(new CustomEvent(cs,{detail:{log:o,args:t}}))},us=(o,...t)=>{switch(typeof o.message=="string"?Reflect.set(o,"message",Rn(o.message)):o.message.message&&typeof o.message.message=="string"&&Reflect.set(o.message,"message",Rn(o.message.message)),o.severity){case yt.Debug:console.debug(o.message,...t);break;case yt.Info:console.info(o.message,...t);break;case yt.Warn:console.warn(o.message,...t);break;case yt.Error:console.error(o.message,...t);break;case yt.Fatal:console.error(o.message,...t);break;default:console.log(o.message,...t)}},ls=o=>o instanceof Error?[o.message,o.stack].join(`
2
+ `):JSON.stringify(o,null,2),vr=[],li=o=>{vr.push(o)},Fn=o=>{if(o.raw===!0)li(o.message);else{const t=ps(typeof o.message=="object"?ls(o.message):o.message,o.severity,o.prefix??ae.JS);li(t)}},yt={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}},ae={JS:"JavaScript"};class fs extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=yt.Info,this.handlers=t}getLogs(){return this.handlers.includes(Fn)?[...vr]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
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??yt.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:yt.Log,prefix:ae.JS,raw:!1},...e)}debug(t,...e){this.logMessage({message:t,severity:yt.Debug,prefix:ae.JS,raw:!1},...e)}info(t,...e){this.logMessage({message:t,severity:yt.Info,prefix:ae.JS,raw:!1},...e)}warn(t,...e){this.logMessage({message:t,severity:yt.Warn,prefix:ae.JS,raw:!1},...e)}error(t,...e){this.logMessage({message:t,severity:yt.Error,prefix:ae.JS,raw:!1},...e)}}const hs=()=>{try{if(process.env.NODE_ENV==="test")return[Fn,ui]}catch{}return[Fn,us,ui]},vt=new fs(hs()),Rn=o=>o.replace(/\t/g,""),ps=(o,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 o=Rn(o),`[${r}] ${e} ${t.name}: ${o}`};var Z=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},qn={exports:{}},ce=typeof Reflect=="object"?Reflect:null,fi=ce&&typeof ce.apply=="function"?ce.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},Pe;ce&&typeof ce.ownKeys=="function"?Pe=ce.ownKeys:Object.getOwnPropertySymbols?Pe=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Pe=function(t){return Object.getOwnPropertyNames(t)};function ds(o){console&&console.warn&&console.warn(o)}var Nr=Number.isNaN||function(t){return t!==t};function st(){st.init.call(this)}qn.exports=st;qn.exports.once=bs;st.EventEmitter=st;st.prototype._events=void 0;st.prototype._eventsCount=0;st.prototype._maxListeners=void 0;var hi=10;function Se(o){if(typeof o!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof o)}Object.defineProperty(st,"defaultMaxListeners",{enumerable:!0,get:function(){return hi},set:function(o){if(typeof o!="number"||o<0||Nr(o))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+o+".");hi=o}});st.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};st.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Nr(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 Pr(o){return o._maxListeners===void 0?st.defaultMaxListeners:o._maxListeners}st.prototype.getMaxListeners=function(){return Pr(this)};st.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 a=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw a.context=r,a}var c=i[t];if(c===void 0)return!1;if(typeof c=="function")fi(c,this,e);else for(var y=c.length,p=jr(c,y),n=0;n<y;++n)fi(p[n],this,e);return!0};function Ar(o,t,e,n){var s,i,r;if(Se(e),i=o._events,i===void 0?(i=o._events=Object.create(null),o._eventsCount=0):(i.newListener!==void 0&&(o.emit("newListener",t,e.listener?e.listener:e),i=o._events),r=i[t]),r===void 0)r=i[t]=e,++o._eventsCount;else if(typeof r=="function"?r=i[t]=n?[e,r]:[r,e]:n?r.unshift(e):r.push(e),s=Pr(o),s>0&&r.length>s&&!r.warned){r.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=o,a.type=t,a.count=r.length,ds(a)}return o}st.prototype.addListener=function(t,e){return Ar(this,t,e,!1)};st.prototype.on=st.prototype.addListener;st.prototype.prependListener=function(t,e){return Ar(this,t,e,!0)};function ms(){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 Mr(o,t,e){var n={fired:!1,wrapFn:void 0,target:o,type:t,listener:e},s=ms.bind(n);return s.listener=e,n.wrapFn=s,s}st.prototype.once=function(t,e){return Se(e),this.on(t,Mr(this,t,e)),this};st.prototype.prependOnceListener=function(t,e){return Se(e),this.prependListener(t,Mr(this,t,e)),this};st.prototype.removeListener=function(t,e){var n,s,i,r,a;if(Se(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){a=n[r].listener,i=r;break}if(i<0)return this;i===0?n.shift():gs(n,i),n.length===1&&(s[t]=n[0]),s.removeListener!==void 0&&this.emit("removeListener",t,a||e)}return this};st.prototype.off=st.prototype.removeListener;st.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 Lr(o,t,e){var n=o._events;if(n===void 0)return[];var s=n[t];return s===void 0?[]:typeof s=="function"?e?[s.listener||s]:[s]:e?ys(s):jr(s,s.length)}st.prototype.listeners=function(t){return Lr(this,t,!0)};st.prototype.rawListeners=function(t){return Lr(this,t,!1)};st.listenerCount=function(o,t){return typeof o.listenerCount=="function"?o.listenerCount(t):Sr.call(o,t)};st.prototype.listenerCount=Sr;function Sr(o){var t=this._events;if(t!==void 0){var e=t[o];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}st.prototype.eventNames=function(){return this._eventsCount>0?Pe(this._events):[]};function jr(o,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=o[n];return e}function gs(o,t){for(;t+1<o.length;t++)o[t]=o[t+1];o.pop()}function ys(o){for(var t=new Array(o.length),e=0;e<t.length;++e)t[e]=o[e].listener||o[e];return t}function bs(o,t){return new Promise(function(e,n){function s(r){o.removeListener(t,i),n(r)}function i(){typeof o.removeListener=="function"&&o.removeListener("error",s),e([].slice.call(arguments))}Fr(o,t,i,{once:!0}),t!=="error"&&ws(o,s,{once:!0})})}function ws(o,t,e){typeof o.on=="function"&&Fr(o,"error",t,e)}function Fr(o,t,e,n){if(typeof o.on=="function")n.once?o.once(t,e):o.on(t,e);else if(typeof o.addEventListener=="function")o.addEventListener(t,function s(i){n.once&&o.removeEventListener(t,s),e(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof o)}var Wn=qn.exports;class Rr extends Wn.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new rs.WebSocketServer({port:t}),this.wss.on("connection",e=>{if(this.ws){e.close();return}this.ws=e,this.emit("clientConnected"),e.on("message",n=>{vt.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);vt.debug("\x1B[1;32m[CDP][send]\x1B[0m",e),this.ws.send(e)}close(){this.wss.close()}}class Br extends Wn.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=ss.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(vt.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&&(vt.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}const Os={right:Ts,center:xs},Es=0,Ae=1,Ds=2,Me=3;class Cs{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
+ `).map(s=>s.split(" "));let n=0;return e.forEach(s=>{s.length>1&&Dt.stringWidth(s[0])>n&&(n=Math.min(Math.floor(this.width*.5),Dt.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=Dt.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,a)=>{const{width:c}=t[a],y=this.negatePadding(t[a]);let p=r;if(y>Dt.stringWidth(r)&&(p+=" ".repeat(y-Dt.stringWidth(r))),t[a].align&&t[a].align!=="left"&&this.wrap){const h=Os[t[a].align];p=h(p,y),Dt.stringWidth(p)<y&&(p+=" ".repeat((c||0)-Dt.stringWidth(p)-1))}const l=t[a].padding||[0,0,0,0];l[Me]&&(i+=" ".repeat(l[Me])),i+=pi(t[a],p,"| "),i+=p,i+=pi(t[a],p," |"),l[Ae]&&(i+=" ".repeat(l[Ae])),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=Dt.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=Dt.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
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[Es]||0).fill("")),s.push(...new Array(i.padding[Ds]||0).fill(""))),s.forEach((a,c)=>{e[c]||e.push([]);const y=e[c];for(let p=0;p<r;p++)y[p]===void 0&&y.push("");y.push(a)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[Me]||0)+(t.padding[Ae]||0)),t.border&&(e-=4),e}columnWidths(t){if(!this.wrap)return t.map(r=>r.width||Dt.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,a)=>r===void 0?Math.max(i,_s(t[a])):r)}}function pi(o,t,e){return o.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function _s(o){const t=o.padding||[],e=1+(t[Me]||0)+(t[Ae]||0);return o.border?e+4:e}function Is(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Ts(o,t){o=o.trim();const e=Dt.stringWidth(o);return e<t?" ".repeat(t-e)+o:o}function xs(o,t){o=o.trim();const e=Dt.stringWidth(o);return e>=t?o:" ".repeat(t-e>>1)+o}let Dt;function vs(o,t){return Dt=t,new Cs({width:o?.width||Is(),wrap:o?.wrap})}const Ur=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Xr(o){return o.replace(Ur,"")}function Ns(o,t){const[e,n]=o.match(Ur)||["",""];o=Xr(o);let s="";for(let i=0;i<o.length;i++)i!==0&&i%t===0&&(s+=`
9
+ `),s+=o.charAt(i);return e&&n&&(s=`${e}${s}${n}`),s}function Ps(o){return vs(o,{stringWidth:t=>[...t].length,stripAnsi:Xr,wrap:Ns})}function As(o,t){let e=bt.resolve(".",o),n;for(Ft.statSync(e).isDirectory()||(e=bt.dirname(e));;){if(n=t(e,Ft.readdirSync(e)),n)return bt.resolve(e,n);if(e=bt.dirname(n=e),n===e)break}}/**
10
+ * @license
11
+ * Copyright (c) 2016, Contributors
12
+ * SPDX-License-Identifier: ISC
13
+ */function fe(o){if(o!==o.toLowerCase()&&o!==o.toUpperCase()||(o=o.toLowerCase()),o.indexOf("-")===-1&&o.indexOf("_")===-1)return o;{let e="",n=!1;const s=o.match(/^-+/);for(let i=s?s[0].length:0;i<o.length;i++){let r=o.charAt(i);n&&(n=!1,r=r.toUpperCase()),i!==0&&(r==="-"||r==="_")?n=!0:r!=="-"&&r!=="_"&&(e+=r)}return e}}function $r(o,t){const e=o.toLowerCase();t=t||"-";let n="";for(let s=0;s<o.length;s++){const i=e.charAt(s),r=o.charAt(s);i!==r&&s>0?n+=`${t}${e.charAt(s)}`:n+=r}return n}function qr(o){return o==null?!1:typeof o=="number"||/^0x[0-9a-f]+$/i.test(o)?!0:/^0[^.]/.test(o)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(o)}/**
14
+ * @license
15
+ * Copyright (c) 2016, Contributors
16
+ * SPDX-License-Identifier: ISC
17
+ */function Ms(o){if(Array.isArray(o))return o.map(r=>typeof r!="string"?r+"":r);o=o.trim();let t=0,e=null,n=null,s=null;const i=[];for(let r=0;r<o.length;r++){if(e=n,n=o.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
+ * @license
19
+ * Copyright (c) 2016, Contributors
20
+ * SPDX-License-Identifier: ISC
21
+ */var At;(function(o){o.BOOLEAN="boolean",o.STRING="string",o.NUMBER="number",o.ARRAY="array"})(At||(At={}));/**
22
+ * @license
23
+ * Copyright (c) 2016, Contributors
24
+ * SPDX-License-Identifier: ISC
25
+ */let Bt;class Ls{constructor(t){Bt=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=Ms(t),i=typeof t=="string",r=Ss(Object.assign(Object.create(null),n.alias)),a=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),c=Object.assign(Object.create(null),n.default),y=n.configObjects||[],p=n.envPrefix,l=a["populate--"],h=l?"--":"_",w=Object.create(null),E=Object.create(null),C=n.__||Bt.format,O={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:[]},P=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,I=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(f){const T=typeof f=="object"?f.key:f,F=Object.keys(f).map(function(M){return{boolean:"bools",string:"strings",number:"numbers"}[M]}).filter(Boolean).pop();F&&(O[F][T]=!0),O.arrays[T]=!0,O.keys.push(T)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(f){O.bools[f]=!0,O.keys.push(f)}),[].concat(n.string||[]).filter(Boolean).forEach(function(f){O.strings[f]=!0,O.keys.push(f)}),[].concat(n.number||[]).filter(Boolean).forEach(function(f){O.numbers[f]=!0,O.keys.push(f)}),[].concat(n.count||[]).filter(Boolean).forEach(function(f){O.counts[f]=!0,O.keys.push(f)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(f){O.normalize[f]=!0,O.keys.push(f)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([f,T])=>{typeof T=="number"&&(O.nargs[f]=T,O.keys.push(f))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([f,T])=>{typeof T=="function"&&(O.coercions[f]=T,O.keys.push(f))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(f){O.configs[f]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([f,T])=>{(typeof T=="boolean"||typeof T=="function")&&(O.configs[f]=T)})),Rt(n.key,r,n.default,O.arrays),Object.keys(c).forEach(function(f){(O.aliases[f]||[]).forEach(function(T){c[T]=c[f]})});let d=null;A();let _=[];const x=Object.assign(Object.create(null),{_:[]}),j={};for(let f=0;f<s.length;f++){const T=s[f],F=T.replace(/^-{3,}/,"---");let M,v,$,U,q,rt;if(T!=="--"&&/^-/.test(T)&&ct(T))B(T);else if(F.match(/^---+(=|$)/)){B(T);continue}else if(T.match(/^--.+=/)||!a["short-option-groups"]&&T.match(/^-.+=/))U=T.match(/^--?([^=]+)=([\s\S]*)$/),U!==null&&Array.isArray(U)&&U.length>=3&&(K(U[1],O.arrays)?f=D(f,U[1],s,U[2]):K(U[1],O.nargs)!==!1?f=S(f,U[1],s,U[2]):b(U[1],U[2],!0));else if(T.match(I)&&a["boolean-negation"])U=T.match(I),U!==null&&Array.isArray(U)&&U.length>=2&&(v=U[1],b(v,K(v,O.arrays)?[!1]:!1));else if(T.match(/^--.+/)||!a["short-option-groups"]&&T.match(/^-[^-]+/))U=T.match(/^--?(.+)/),U!==null&&Array.isArray(U)&&U.length>=2&&(v=U[1],K(v,O.arrays)?f=D(f,v,s):K(v,O.nargs)!==!1?f=S(f,v,s):(q=s[f+1],q!==void 0&&(!q.match(/^-/)||q.match(P))&&!K(v,O.bools)&&!K(v,O.counts)||/^(true|false)$/.test(q)?(b(v,q),f++):b(v,ot(v))));else if(T.match(/^-.\..+=/))U=T.match(/^-([^=]+)=([\s\S]*)$/),U!==null&&Array.isArray(U)&&U.length>=3&&b(U[1],U[2]);else if(T.match(/^-.\..+/)&&!T.match(P))q=s[f+1],U=T.match(/^-(.\..+)/),U!==null&&Array.isArray(U)&&U.length>=2&&(v=U[1],q!==void 0&&!q.match(/^-/)&&!K(v,O.bools)&&!K(v,O.counts)?(b(v,q),f++):b(v,ot(v)));else if(T.match(/^-[^-]+/)&&!T.match(P)){$=T.slice(1,-1).split(""),M=!1;for(let gt=0;gt<$.length;gt++){if(q=T.slice(gt+2),$[gt+1]&&$[gt+1]==="="){rt=T.slice(gt+3),v=$[gt],K(v,O.arrays)?f=D(f,v,s,rt):K(v,O.nargs)!==!1?f=S(f,v,s,rt):b(v,rt),M=!0;break}if(q==="-"){b($[gt],q);continue}if(/[A-Za-z]/.test($[gt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(q)&&K(q,O.bools)===!1){b($[gt],q),M=!0;break}if($[gt+1]&&$[gt+1].match(/\W/)){b($[gt],q),M=!0;break}else b($[gt],ot($[gt]))}v=T.slice(-1)[0],!M&&v!=="-"&&(K(v,O.arrays)?f=D(f,v,s):K(v,O.nargs)!==!1?f=S(f,v,s):(q=s[f+1],q!==void 0&&(!/^(-|--)[^-]/.test(q)||q.match(P))&&!K(v,O.bools)&&!K(v,O.counts)||/^(true|false)$/.test(q)?(b(v,q),f++):b(v,ot(v))))}else if(T.match(/^-[0-9]$/)&&T.match(P)&&K(T.slice(1),O.bools))v=T.slice(1),b(v,ot(v));else if(T==="--"){_=s.slice(f+1);break}else if(a["halt-at-non-option"]){_=s.slice(f);break}else B(T)}H(x,!0),H(x,!1),X(x),Y(),nt(x,O.aliases,c,!0),at(x),a["set-placeholder-key"]&&Lt(x),Object.keys(O.counts).forEach(function(f){Ct(x,f.split("."))||b(f,0)}),l&&_.length&&(x[h]=[]),_.forEach(function(f){x[h].push(f)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(x).filter(f=>f!=="--"&&f.includes("-")).forEach(f=>{delete x[f]}),a["strip-aliased"]&&[].concat(...Object.keys(r).map(f=>r[f])).forEach(f=>{a["camel-case-expansion"]&&f.includes("-")&&delete x[f.split(".").map(T=>fe(T)).join(".")],delete x[f]});function B(f){const T=R("_",f);(typeof T=="string"||typeof T=="number")&&x._.push(T)}function S(f,T,F,M){let v,$=K(T,O.nargs);if($=typeof $!="number"||isNaN($)?1:$,$===0)return u(M)||(d=Error(C("Argument unexpected for: %s",T))),b(T,ot(T)),f;let U=u(M)?0:1;if(a["nargs-eats-options"])F.length-(f+1)+U<$&&(d=Error(C("Not enough arguments following: %s",T))),U=$;else{for(v=f+1;v<F.length&&(!F[v].match(/^-[^0-9]/)||F[v].match(P)||ct(F[v]));v++)U++;U<$&&(d=Error(C("Not enough arguments following: %s",T)))}let q=Math.min(U,$);for(!u(M)&&q>0&&(b(T,M),q--),v=f+1;v<q+f+1;v++)b(T,F[v]);return f+q}function D(f,T,F,M){let v=[],$=M||F[f+1];const U=K(T,O.nargs);if(K(T,O.bools)&&!/^(true|false)$/.test($))v.push(!0);else if(u($)||u(M)&&/^-/.test($)&&!P.test($)&&!ct($)){if(c[T]!==void 0){const q=c[T];v=Array.isArray(q)?q:[q]}}else{u(M)||v.push(L(T,M,!0));for(let q=f+1;q<F.length&&!(!a["greedy-arrays"]&&v.length>0||U&&typeof U=="number"&&v.length>=U||($=F[q],/^-/.test($)&&!P.test($)&&!ct($)));q++)f=q,v.push(L(T,$,i))}return typeof U=="number"&&(U&&v.length<U||isNaN(U)&&v.length===0)&&(d=Error(C("Not enough arguments following: %s",T))),b(T,v),f}function b(f,T,F=i){if(/-/.test(f)&&a["camel-case-expansion"]){const $=f.split(".").map(function(U){return fe(U)}).join(".");N(f,$)}const M=L(f,T,F),v=f.split(".");tt(x,v,M),O.aliases[f]&&O.aliases[f].forEach(function($){const U=$.split(".");tt(x,U,M)}),v.length>1&&a["dot-notation"]&&(O.aliases[v[0]]||[]).forEach(function($){let U=$.split(".");const q=[].concat(v);q.shift(),U=U.concat(q),(O.aliases[f]||[]).includes(U.join("."))||tt(x,U,M)}),K(f,O.normalize)&&!K(f,O.arrays)&&[f].concat(O.aliases[f]||[]).forEach(function(U){Object.defineProperty(j,U,{enumerable:!0,get(){return T},set(q){T=typeof q=="string"?Bt.normalize(q):q}})})}function N(f,T){O.aliases[f]&&O.aliases[f].length||(O.aliases[f]=[T],w[T]=!0),O.aliases[T]&&O.aliases[T].length||N(T,f)}function L(f,T,F){F&&(T=js(T)),(K(f,O.bools)||K(f,O.counts))&&typeof T=="string"&&(T=T==="true");let M=Array.isArray(T)?T.map(function(v){return R(f,v)}):R(f,T);return K(f,O.counts)&&(u(M)||typeof M=="boolean")&&(M=Ue()),K(f,O.normalize)&&K(f,O.arrays)&&(Array.isArray(T)?M=T.map(v=>Bt.normalize(v)):M=Bt.normalize(T)),M}function R(f,T){return!a["parse-positional-numbers"]&&f==="_"||!K(f,O.strings)&&!K(f,O.bools)&&!Array.isArray(T)&&(qr(T)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${T}`)))||!u(T)&&K(f,O.numbers))&&(T=Number(T)),T}function X(f){const T=Object.create(null);nt(T,O.aliases,c),Object.keys(O.configs).forEach(function(F){const M=f[F]||T[F];if(M)try{let v=null;const $=Bt.resolve(Bt.cwd(),M),U=O.configs[F];if(typeof U=="function"){try{v=U($)}catch(q){v=q}if(v instanceof Error){d=v;return}}else v=Bt.require($);k(v)}catch(v){v.name==="PermissionDenied"?d=v:f[F]&&(d=Error(C("Invalid JSON config file: %s",M)))}})}function k(f,T){Object.keys(f).forEach(function(F){const M=f[F],v=T?T+"."+F:F;typeof M=="object"&&M!==null&&!Array.isArray(M)&&a["dot-notation"]?k(M,v):(!Ct(x,v.split("."))||K(v,O.arrays)&&a["combine-arrays"])&&b(v,M)})}function Y(){typeof y<"u"&&y.forEach(function(f){k(f)})}function H(f,T){if(typeof p>"u")return;const F=typeof p=="string"?p:"",M=Bt.env();Object.keys(M).forEach(function(v){if(F===""||v.lastIndexOf(F,0)===0){const $=v.split("__").map(function(U,q){return q===0&&(U=U.substring(F.length)),fe(U)});(T&&O.configs[$.join(".")]||!T)&&!Ct(f,$)&&b($.join("."),M[v])}})}function at(f){let T;const F=new Set;Object.keys(f).forEach(function(M){if(!F.has(M)&&(T=K(M,O.coercions),typeof T=="function"))try{const v=R(M,T(f[M]));[].concat(O.aliases[M]||[],M).forEach($=>{F.add($),f[$]=v})}catch(v){d=v}})}function Lt(f){return O.keys.forEach(T=>{~T.indexOf(".")||typeof f[T]>"u"&&(f[T]=void 0)}),f}function nt(f,T,F,M=!1){Object.keys(F).forEach(function(v){Ct(f,v.split("."))||(tt(f,v.split("."),F[v]),M&&(E[v]=!0),(T[v]||[]).forEach(function($){Ct(f,$.split("."))||tt(f,$.split("."),F[v])}))})}function Ct(f,T){let F=f;a["dot-notation"]||(T=[T.join(".")]),T.slice(0,-1).forEach(function(v){F=F[v]||{}});const M=T[T.length-1];return typeof F!="object"?!1:M in F}function tt(f,T,F){let M=f;a["dot-notation"]||(T=[T.join(".")]),T.slice(0,-1).forEach(function(rt){rt=di(rt),typeof M=="object"&&M[rt]===void 0&&(M[rt]={}),typeof M[rt]!="object"||Array.isArray(M[rt])?(Array.isArray(M[rt])?M[rt].push({}):M[rt]=[M[rt],{}],M=M[rt][M[rt].length-1]):M=M[rt]});const v=di(T[T.length-1]),$=K(T.join("."),O.arrays),U=Array.isArray(F);let q=a["duplicate-arguments-array"];!q&&K(v,O.nargs)&&(q=!0,(!u(M[v])&&O.nargs[v]===1||Array.isArray(M[v])&&M[v].length===O.nargs[v])&&(M[v]=void 0)),F===Ue()?M[v]=Ue(M[v]):Array.isArray(M[v])?q&&$&&U?M[v]=a["flatten-duplicate-arrays"]?M[v].concat(F):(Array.isArray(M[v][0])?M[v]:[M[v]]).concat([F]):!q&&!!$==!!U?M[v]=F:M[v]=M[v].concat([F]):M[v]===void 0&&$?M[v]=U?F:[F]:q&&!(M[v]===void 0||K(v,O.counts)||K(v,O.bools))?M[v]=[M[v],F]:M[v]=F}function Rt(...f){f.forEach(function(T){Object.keys(T||{}).forEach(function(F){O.aliases[F]||(O.aliases[F]=[].concat(r[F]||[]),O.aliases[F].concat(F).forEach(function(M){if(/-/.test(M)&&a["camel-case-expansion"]){const v=fe(M);v!==F&&O.aliases[F].indexOf(v)===-1&&(O.aliases[F].push(v),w[v]=!0)}}),O.aliases[F].concat(F).forEach(function(M){if(M.length>1&&/[A-Z]/.test(M)&&a["camel-case-expansion"]){const v=$r(M,"-");v!==F&&O.aliases[F].indexOf(v)===-1&&(O.aliases[F].push(v),w[v]=!0)}}),O.aliases[F].forEach(function(M){O.aliases[M]=[F].concat(O.aliases[F].filter(function(v){return M!==v}))}))})})}function K(f,T){const F=[].concat(O.aliases[f]||[],f),M=Object.keys(T),v=F.find($=>M.includes($));return v?T[v]:!1}function Ht(f){const T=Object.keys(O);return[].concat(T.map(M=>O[M])).some(function(M){return Array.isArray(M)?M.includes(f):M[f]})}function z(f,...T){return[].concat(...T).some(function(M){const v=f.match(M);return v&&Ht(v[1])})}function it(f){if(f.match(P)||!f.match(/^-[^-]+/))return!1;let T=!0,F;const M=f.slice(1).split("");for(let v=0;v<M.length;v++){if(F=f.slice(v+2),!Ht(M[v])){T=!1;break}if(M[v+1]&&M[v+1]==="="||F==="-"||/[A-Za-z]/.test(M[v])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(F)||M[v+1]&&M[v+1].match(/\W/))break}return T}function ct(f){return a["unknown-options-as-args"]&&et(f)}function et(f){return f=f.replace(/^-{3,}/,"--"),f.match(P)||it(f)?!1:!z(f,/^-+([^=]+?)=[\s\S]*$/,I,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function ot(f){return!K(f,O.bools)&&!K(f,O.counts)&&`${f}`in c?c[f]:ut(m(f))}function ut(f){return{[At.BOOLEAN]:!0,[At.STRING]:"",[At.NUMBER]:void 0,[At.ARRAY]:[]}[f]}function m(f){let T=At.BOOLEAN;return K(f,O.strings)?T=At.STRING:K(f,O.numbers)?T=At.NUMBER:K(f,O.bools)?T=At.BOOLEAN:K(f,O.arrays)&&(T=At.ARRAY),T}function u(f){return f===void 0}function A(){Object.keys(O.counts).find(f=>K(f,O.arrays)?(d=Error(C("Invalid configuration: %s, opts.count excludes opts.array.",f)),!0):K(f,O.nargs)?(d=Error(C("Invalid configuration: %s, opts.count excludes opts.narg.",f)),!0):!1)}return{aliases:Object.assign({},O.aliases),argv:Object.assign(j,x),configuration:a,defaulted:Object.assign({},E),error:d,newAliases:Object.assign({},w)}}}function Ss(o){const t=[],e=Object.create(null);let n=!0;for(Object.keys(o).forEach(function(s){t.push([].concat(o[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(a){return t[i].indexOf(a)!==-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,a,c){return c.indexOf(r)===a});const i=s.pop();i!==void 0&&typeof i=="string"&&(e[i]=s)}),e}function Ue(o){return o!==void 0?o+1:1}function di(o){return o==="__proto__"?"___proto___":o}function js(o){return typeof o=="string"&&(o[0]==="'"||o[0]==='"')&&o[o.length-1]===o[0]?o.substring(1,o.length-1):o}/**
26
+ * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
27
+ * CJS and ESM environments.
28
+ *
29
+ * @license
30
+ * Copyright (c) 2016, Contributors
31
+ * SPDX-License-Identifier: ISC
32
+ */var Xe,$e,qe;const mi=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,gi=($e=(Xe=process==null?void 0:process.versions)===null||Xe===void 0?void 0:Xe.node)!==null&&$e!==void 0?$e:(qe=process==null?void 0:process.version)===null||qe===void 0?void 0:qe.slice(1);if(gi&&Number(gi.match(/^([^.]+)/)[1])<mi)throw Error(`yargs parser supports a minimum Node.js version of ${mi}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Fs=process?process.env:{},Wr=new Ls({cwd:process.cwd,env:()=>Fs,format:$n.format,normalize:bt.normalize,resolve:bt.resolve,require:o=>{if(typeof require<"u")return require(o);if(o.match(/\.json$/))return JSON.parse(Ft.readFileSync(o,"utf8"));throw Error("only .json config files are supported in ESM")}}),we=function(t,e){return Wr.parse(t.slice(),e).argv};we.detailed=function(o,t){return Wr.parse(o.slice(),t)};we.camelCase=fe;we.decamelize=$r;we.looksLikeNumber=qr;function Vr(){return Rs()?0:1}function Rs(){return Bs()&&!process.defaultApp}function Bs(){return!!process.versions.electron}function Us(o){return o.slice(Vr()+1)}function Xs(){return process.argv[Vr()]}class ht extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,ht)}}const $s={fs:{readFileSync:Ft.readFileSync,writeFile:Ft.writeFile},format:$n.format,resolve:bt.resolve,exists:o=>{try{return Ft.statSync(o).isFile()}catch{return!1}}};let Pt;class qs{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(),Pt.format.apply(Pt.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 a=[r];return~r.indexOf("%d")&&a.push(s),Pt.format.apply(Pt.format,a.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),a=JSON.stringify(this.cache[s],null,2);Pt.fs.writeFile(r,a,"utf-8",function(c){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(c)})}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{Pt.fs.readFileSync&&(t=JSON.parse(Pt.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=Pt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){const s=Pt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(s)&&(n=s)}return n}_fileExistsSync(t){return Pt.exists(t)}}function Ws(o,t){Pt=t;const e=new qs(o);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 Vs=o=>Ws(o,$s),Hs="require is not supported by ESM",yi="loading a directory of commands is not supported yet for ESM";let ye;try{ye=is.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:Be&&Be.tagName.toUpperCase()==="SCRIPT"&&Be.src||new URL("run-cli-C15jrZ5h.cjs",document.baseURI).href)}catch{ye=process.cwd()}const zs=ye.substring(0,ye.lastIndexOf("node_modules")),Gs={assert:{notStrictEqual:ci.notStrictEqual,strictEqual:ci.strictEqual},cliui:Ps,findUp:As,getEnv:o=>process.env[o],inspect:$n.inspect,getCallerFile:()=>{throw new ht(yi)},getProcessArgvBin:Xs,mainFilename:zs||process.cwd(),Parser:we,path:{basename:bt.basename,dirname:bt.dirname,extname:bt.extname,relative:bt.relative,resolve:bt.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(o,t)=>process.emitWarning(o,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Ft.readFileSync,require:()=>{throw new ht(Hs)},requireDirectory:()=>{throw new ht(yi)},stringWidth:o=>[...o].length,y18n:Vs({directory:bt.resolve(ye,"../../../locales"),updateFiles:!1})};function Mt(o,t,e,n){e.assert.notStrictEqual(o,t,n)}function bi(o,t){t.assert.strictEqual(typeof o,"string")}function Le(o){return Object.keys(o)}function pt(o){return!!o&&!!o.then&&typeof o.then=="function"}function de(o){const e=o.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,s=e.shift();if(!s)throw new Error(`No command found in: ${o}`);const i={cmd:s.replace(n,""),demanded:[],optional:[]};return e.forEach((r,a)=>{let c=!1;r=r.replace(/\s/g,""),/\.+[\]>]/.test(r)&&a===e.length-1&&(c=!0),/^\[/.test(r)?i.optional.push({cmd:r.replace(n,"").split("|"),variadic:c}):i.demanded.push({cmd:r.replace(n,"").split("|"),variadic:c})}),i}const Ys=["first","second","third","fourth","fifth","sixth"];function V(o,t,e){function n(){return typeof o=="object"?[{demanded:[],optional:[]},o,t]:[de(`cmd ${o}`),t,e]}try{let s=0;const[i,r,a]=n(),c=[].slice.call(r);for(;c.length&&c[c.length-1]===void 0;)c.pop();const y=a||c.length;if(y<i.demanded.length)throw new ht(`Not enough arguments provided. Expected ${i.demanded.length} but received ${c.length}.`);const p=i.demanded.length+i.optional.length;if(y>p)throw new ht(`Too many arguments provided. Expected max ${p} but received ${y}.`);i.demanded.forEach(l=>{const h=c.shift(),w=wi(h);l.cmd.filter(C=>C===w||C==="*").length===0&&Oi(w,l.cmd,s),s+=1}),i.optional.forEach(l=>{if(c.length===0)return;const h=c.shift(),w=wi(h);l.cmd.filter(C=>C===w||C==="*").length===0&&Oi(w,l.cmd,s),s+=1})}catch(s){console.warn(s.stack)}}function wi(o){return Array.isArray(o)?"array":o===null?"null":typeof o}function Oi(o,t,e){throw new ht(`Invalid ${Ys[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${o}.`)}class Ks{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,s=!1){if(V("<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 ks(o){return o?o.map(t=>(t.applyBeforeValidation=!1,t)):[]}function me(o,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(pt(s))return s.then(r=>Promise.all([r,i(r,t)])).then(([r,a])=>Object.assign(r,a));{const r=i(s,t);return pt(r)?r.then(a=>Object.assign(s,a)):Object.assign(s,r)}},o)}function ge(o,t,e=n=>{throw n}){try{const n=Qs(o)?o():o;return pt(n)?n.then(s=>t(s)):t(n)}catch(n){return e(n)}}function Qs(o){return typeof o=="function"}function Js(o){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===o)return n;return null}const ie=/(^\*)|(^\$0)/;class Zs{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,a,c)=>{const y=i(r,a,c);if(y){if(this.requireCache.has(a))return y;this.requireCache.add(a),this.addHandler(y)}return y},this.shim.requireDirectory({require:e,filename:n},t,s)}addHandler(t,e,n,s,i,r){let a=[];const c=ks(i);if(s=s||(()=>{}),Array.isArray(t))if(eo(t))[t,...a]=t;else for(const y of t)this.addHandler(y);else if(io(t)){let y=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(y=[].concat(y).concat(t.aliases)),this.addHandler(y,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Ei(n)){this.addHandler([t].concat(a),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){const y=de(t);a=a.map(h=>de(h).cmd);let p=!1;const l=[y.cmd].concat(a).filter(h=>ie.test(h)?(p=!0,!1):!0);l.length===0&&p&&l.push("$0"),p&&(y.cmd=l[0],a=l.slice(1),t=t.replace(ie,y.cmd)),a.forEach(h=>{this.aliasMap[h]=y.cmd}),e!==!1&&this.usage.command(t,e,p,a,r),this.handlers[y.cmd]={original:t,description:e,handler:s,builder:n||{},middlewares:c,deprecated:r,demanded:y.demanded,optional:y.optional},p&&(this.defaultCommand=this.handlers[y.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 a=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,c=e.getInternalMethods().getContext(),y=c.commands.slice(),p=!t;t&&(c.commands.push(t),c.fullCommands.push(a.original));const l=this.applyBuilderUpdateUsageAndParse(p,a,e,n.aliases,y,s,i,r);return pt(l)?l.then(h=>this.applyMiddlewareAndGetResult(p,a,h.innerArgv,c,i,h.aliases,e)):this.applyMiddlewareAndGetResult(p,a,l.innerArgv,c,i,l.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,s,i,r,a,c){const y=e.builder;let p=n;if(Bn(y)){n.getInternalMethods().getUsageInstance().freeze();const l=y(n.getInternalMethods().reset(s),c);if(pt(l))return l.then(h=>(p=Oo(h)?h:n,this.parseAndUpdateUsage(t,e,p,i,r,a)))}else no(y)&&(n.getInternalMethods().getUsageInstance().freeze(),p=n.getInternalMethods().reset(s),Object.keys(e.builder).forEach(l=>{p.option(l,y[l])}));return this.parseAndUpdateUsage(t,e,p,i,r,a)}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 a=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return pt(a)?a.then(c=>({aliases:n.parsed.aliases,innerArgv:c})):{aliases:n.parsed.aliases,innerArgv:a}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&t.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(t,e){const n=ie.test(e.original)?e.original.replace(ie,"").trim():e.original,s=t.filter(i=>!ie.test(i));return s.push(n),`$0 ${s.join(" ")}`}handleValidationAndGetResult(t,e,n,s,i,r,a,c){if(!r.getInternalMethods().getHasOutput()){const y=r.getInternalMethods().runValidation(i,c,r.parsed.error,t);n=ge(n,p=>(y(p),p))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const y=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(n,y,!1,!1),n=me(n,r,a,!1),n=ge(n,p=>{const l=e.handler(p);return pt(l)?l.then(()=>p):p}),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),pt(n)&&!r.getInternalMethods().hasParseCallback()&&n.catch(p=>{try{r.getInternalMethods().getUsageInstance().fail(null,p)}catch{}})}return t||(s.commands.pop(),s.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,s,i,r,a){let c={};if(i)return n;a.getInternalMethods().getHasOutput()||(c=this.populatePositionals(e,n,s,a));const y=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),p=me(n,a,y,!0);return pt(p)?p.then(l=>this.handleValidationAndGetResult(t,e,l,s,r,a,y,c)):this.handleValidationAndGetResult(t,e,p,s,r,a,y,c)}populatePositionals(t,e,n,s){e._=e._.slice(n.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),a={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const c=i.shift();this.populatePositional(c,e,a)}for(;r.length;){const c=r.shift();this.populatePositional(c,e,a)}return e._=n.commands.concat(e._.map(c=>""+c)),this.postProcessPositionals(e,a,this.cmdToParseOptions(t.original),s),a}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=de(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 y of Object.keys(n.alias))i.alias[y]=(i.alias[y]||[]).concat(n.alias[y]);i.array=i.array.concat(n.array),i.config={};const r=[];if(Object.keys(e).forEach(y=>{e[y].map(p=>{i.configuration["unknown-options-as-args"]&&(i.key[y]=!0),r.push(`--${y}`),r.push(p)})}),!r.length)return;const a=Object.assign({},i.configuration,{"populate--":!1}),c=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:a}));if(c.error)s.getInternalMethods().getUsageInstance().fail(c.error.message,c.error);else{const y=Object.keys(e);Object.keys(e).forEach(p=>{y.push(...c.aliases[p])}),Object.keys(c.argv).forEach(p=>{y.includes(p)&&(e[p]||(e[p]=c.argv[p]),!this.isInConfigs(s,p)&&!this.isDefaulted(s,p)&&Object.prototype.hasOwnProperty.call(t,p)&&Object.prototype.hasOwnProperty.call(c.argv,p)&&(Array.isArray(t[p])||Array.isArray(c.argv[p]))?t[p]=[].concat(t[p],c.argv[p]):t[p]=c.argv[p])})}}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=ie.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(Bn(e))return e(t,!0);Ei(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){const e=Js(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;Mt(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();Mt(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 to(o,t,e,n){return new Zs(o,t,e,n)}function Ei(o){return typeof o=="object"&&!!o.builder&&typeof o.handler=="function"}function eo(o){return o.every(t=>typeof t=="string")}function Bn(o){return typeof o=="function"}function no(o){return typeof o=="object"}function io(o){return typeof o=="object"&&!Array.isArray(o)}function be(o={},t=()=>!0){const e={};return Le(o).forEach(n=>{t(n,o[n])&&(e[n]=o[n])}),e}function he(o){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{const e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(o)})}function ro(o){return typeof o=="boolean"}function so(o,t){const e=t.y18n.__,n={},s=[];n.failFn=function(L){s.push(L)};let i=null,r=null,a=!0;n.showHelpOnFail=function(L=!0,R){const[X,k]=typeof L=="string"?[!0,L]:[L,R];return o.getInternalMethods().isGlobalContext()&&(r=k),i=k,a=X,n};let c=!1;n.fail=function(L,R){const X=o.getInternalMethods().getLoggerInstance();if(s.length)for(let k=s.length-1;k>=0;--k){const Y=s[k];if(ro(Y)){if(R)throw R;if(L)throw Error(L)}else Y(L,R,n)}else{if(o.getExitProcess()&&he(!0),!c){c=!0,a&&(o.showHelp("error"),X.error()),(L||R)&&X.error(L||R);const k=i||r;k&&((L||R)&&X.error(""),X.error(k))}if(R=R||new ht(L),o.getExitProcess())return o.exit(1);if(o.getInternalMethods().hasParseCallback())return o.exit(1,R);throw R}};let y=[],p=!1;n.usage=(N,L)=>N===null?(p=!0,y=[],n):(p=!1,y.push([N,L||""]),n),n.getUsage=()=>y,n.getUsageDisabled=()=>p,n.getPositionalGroupName=()=>e("Positionals:");let l=[];n.example=(N,L)=>{l.push([N,L||""])};let h=[];n.command=function(L,R,X,k,Y=!1){X&&(h=h.map(H=>(H[2]=!1,H))),h.push([L,R||"",X,k,Y])},n.getCommands=()=>h;let w={};n.describe=function(L,R){Array.isArray(L)?L.forEach(X=>{n.describe(X,R)}):typeof L=="object"?Object.keys(L).forEach(X=>{n.describe(X,L[X])}):w[L]=R},n.getDescriptions=()=>w;let E=[];n.epilog=N=>{E.push(N)};let C=!1,O;n.wrap=N=>{C=!0,O=N},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(C||(O=S(),C=!0),O);const P="__yargsString__:";n.deferY18nLookup=N=>P+N,n.help=function(){if(_)return _;d();const L=o.customScriptName?o.$0:t.path.basename(o.$0),R=o.getDemandedOptions(),X=o.getDemandedCommands(),k=o.getDeprecatedOptions(),Y=o.getGroups(),H=o.getOptions();let at=[];at=at.concat(Object.keys(w)),at=at.concat(Object.keys(R)),at=at.concat(Object.keys(X)),at=at.concat(Object.keys(H.default)),at=at.filter(j),at=Object.keys(at.reduce((z,it)=>(it!=="_"&&(z[it]=!0),z),{}));const Lt=n.getWrap(),nt=t.cliui({width:Lt,wrap:!!Lt});if(!p){if(y.length)y.forEach(z=>{nt.div({text:`${z[0].replace(/\$0/g,L)}`}),z[1]&&nt.div({text:`${z[1]}`,padding:[1,0,0,0]})}),nt.div();else if(h.length){let z=null;X._?z=`${L} <${e("command")}>
33
+ `:z=`${L} [${e("command")}]
34
+ `,nt.div(`${z}`)}}if(h.length>1||h.length===1&&!h[0][2]){nt.div(e("Commands:"));const z=o.getInternalMethods().getContext(),it=z.commands.length?`${z.commands.join(" ")} `:"";o.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(h=h.sort((et,ot)=>et[0].localeCompare(ot[0])));const ct=L?`${L} `:"";h.forEach(et=>{const ot=`${ct}${it}${et[0].replace(/^\$0 ?/,"")}`;nt.span({text:ot,padding:[0,2,0,2],width:I(h,Lt,`${L}${it}`)+4},{text:et[1]});const ut=[];et[2]&&ut.push(`[${e("default")}]`),et[3]&&et[3].length&&ut.push(`[${e("aliases:")} ${et[3].join(", ")}]`),et[4]&&(typeof et[4]=="string"?ut.push(`[${e("deprecated: %s",et[4])}]`):ut.push(`[${e("deprecated")}]`)),ut.length?nt.div({text:ut.join(" "),padding:[0,0,0,2],align:"right"}):nt.div()}),nt.div()}const Ct=(Object.keys(H.alias)||[]).concat(Object.keys(o.parsed.newAliases)||[]);at=at.filter(z=>!o.parsed.newAliases[z]&&Ct.every(it=>(H.alias[it]||[]).indexOf(z)===-1));const tt=e("Options:");Y[tt]||(Y[tt]=[]),x(at,H.alias,Y,tt);const Rt=z=>/^--/.test(Oe(z)),K=Object.keys(Y).filter(z=>Y[z].length>0).map(z=>{const it=Y[z].filter(j).map(ct=>{if(Ct.includes(ct))return ct;for(let et=0,ot;(ot=Ct[et])!==void 0;et++)if((H.alias[ot]||[]).includes(ct))return ot;return ct});return{groupName:z,normalizedKeys:it}}).filter(({normalizedKeys:z})=>z.length>0).map(({groupName:z,normalizedKeys:it})=>{const ct=it.reduce((et,ot)=>(et[ot]=[ot].concat(H.alias[ot]||[]).map(ut=>z===n.getPositionalGroupName()?ut:(/^[0-9]$/.test(ut)?H.boolean.includes(ot)?"-":"--":ut.length>1?"--":"-")+ut).sort((ut,m)=>Rt(ut)===Rt(m)?0:Rt(ut)?1:-1).join(", "),et),{});return{groupName:z,normalizedKeys:it,switches:ct}});if(K.filter(({groupName:z})=>z!==n.getPositionalGroupName()).some(({normalizedKeys:z,switches:it})=>!z.every(ct=>Rt(it[ct])))&&K.filter(({groupName:z})=>z!==n.getPositionalGroupName()).forEach(({normalizedKeys:z,switches:it})=>{z.forEach(ct=>{Rt(it[ct])&&(it[ct]=oo(it[ct],4))})}),K.forEach(({groupName:z,normalizedKeys:it,switches:ct})=>{nt.div(z),it.forEach(et=>{const ot=ct[et];let ut=w[et]||"",m=null;ut.includes(P)&&(ut=e(ut.substring(P.length))),H.boolean.includes(et)&&(m=`[${e("boolean")}]`),H.count.includes(et)&&(m=`[${e("count")}]`),H.string.includes(et)&&(m=`[${e("string")}]`),H.normalize.includes(et)&&(m=`[${e("string")}]`),H.array.includes(et)&&(m=`[${e("array")}]`),H.number.includes(et)&&(m=`[${e("number")}]`);const u=T=>typeof T=="string"?`[${e("deprecated: %s",T)}]`:`[${e("deprecated")}]`,A=[et in k?u(k[et]):null,m,et in R?`[${e("required")}]`:null,H.choices&&H.choices[et]?`[${e("choices:")} ${n.stringifiedValues(H.choices[et])}]`:null,B(H.default[et],H.defaultDescription[et])].filter(Boolean).join(" ");nt.span({text:Oe(ot),padding:[0,2,0,2+Di(ot)],width:I(ct,Lt)+4},ut);const f=o.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;A&&!f?nt.div({text:A,padding:[0,0,0,2],align:"right"}):nt.div()}),nt.div()}),l.length&&(nt.div(e("Examples:")),l.forEach(z=>{z[0]=z[0].replace(/\$0/g,L)}),l.forEach(z=>{z[1]===""?nt.div({text:z[0],padding:[0,2,0,2]}):nt.div({text:z[0],padding:[0,2,0,2],width:I(l,Lt)+4},{text:z[1]})}),nt.div()),E.length>0){const z=E.map(it=>it.replace(/\$0/g,L)).join(`
35
+ `);nt.div(`${z}
36
+ `)}return nt.toString().replace(/\s*$/,"")};function I(N,L,R){let X=0;return Array.isArray(N)||(N=Object.values(N).map(k=>[k])),N.forEach(k=>{X=Math.max(t.stringWidth(R?`${R} ${Oe(k[0])}`:Oe(k[0]))+Di(k[0]),X)}),L&&(X=Math.min(X,parseInt((L*.5).toString(),10))),X}function d(){const N=o.getDemandedOptions(),L=o.getOptions();(Object.keys(L.alias)||[]).forEach(R=>{L.alias[R].forEach(X=>{w[X]&&n.describe(R,w[X]),X in N&&o.demandOption(R,N[X]),L.boolean.includes(X)&&o.boolean(R),L.count.includes(X)&&o.count(R),L.string.includes(X)&&o.string(R),L.normalize.includes(X)&&o.normalize(R),L.array.includes(X)&&o.array(R),L.number.includes(X)&&o.number(R)})})}let _;n.cacheHelpMessage=function(){_=this.help()},n.clearCachedHelpMessage=function(){_=void 0},n.hasCachedHelpMessage=function(){return!!_};function x(N,L,R,X){let k=[],Y=null;return Object.keys(R).forEach(H=>{k=k.concat(R[H])}),N.forEach(H=>{Y=[H].concat(L[H]),Y.some(at=>k.indexOf(at)!==-1)||R[X].push(H)}),k}function j(N){return o.getOptions().hiddenOptions.indexOf(N)<0||o.parsed.argv[o.getOptions().showHiddenOpt]}n.showHelp=N=>{const L=o.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:L[N])(n.help())},n.functionDescription=N=>["(",N.name?t.Parser.decamelize(N.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(L,R){let X="";const k=R||", ",Y=[].concat(L);return!L||!Y.length||Y.forEach(H=>{X.length&&(X+=k),X+=JSON.stringify(H)}),X};function B(N,L){let R=`[${e("default:")} `;if(N===void 0&&!L)return null;if(L)R+=L;else switch(typeof N){case"string":R+=`"${N}"`;break;case"object":R+=JSON.stringify(N);break;default:R+=N}return`${R}]`}function S(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let D=null;n.version=N=>{D=N},n.showVersion=N=>{const L=o.getInternalMethods().getLoggerInstance();N||(N="error"),(typeof N=="function"?N:L[N])(D)},n.reset=function(L){return i=null,c=!1,y=[],p=!1,E=[],l=[],h=[],w=be(w,R=>!L[R]),n};const b=[];return n.freeze=function(){b.push({failMessage:i,failureOutput:c,usages:y,usageDisabled:p,epilogs:E,examples:l,commands:h,descriptions:w})},n.unfreeze=function(L=!1){const R=b.pop();R&&(L?(w={...R.descriptions,...w},h=[...R.commands,...h],y=[...R.usages,...y],l=[...R.examples,...l],E=[...R.epilogs,...E]):{failMessage:i,failureOutput:c,usages:y,usageDisabled:p,epilogs:E,examples:l,commands:h,descriptions:w}=R)},n}function Vn(o){return typeof o=="object"}function oo(o,t){return Vn(o)?{text:o.text,indentation:o.indentation+t}:{text:o,indentation:t}}function Di(o){return Vn(o)?o.indentation:0}function Oe(o){return Vn(o)?o.text:o}const ao=`###-begin-{{app_name}}-completions-###
37
+ #
38
+ # yargs command completion script
39
+ #
40
+ # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
41
+ # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
42
+ #
43
+ _{{app_name}}_yargs_completions()
44
+ {
45
+ local cur_word args type_list
46
+
47
+ cur_word="\${COMP_WORDS[COMP_CWORD]}"
48
+ args=("\${COMP_WORDS[@]}")
49
+
50
+ # ask yargs to generate completions.
51
+ type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
52
+
53
+ COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
54
+
55
+ # if no match was found, fall back to filename completion
56
+ if [ \${#COMPREPLY[@]} -eq 0 ]; then
57
+ COMPREPLY=()
58
+ fi
59
+
60
+ return 0
61
+ }
62
+ complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
63
+ ###-end-{{app_name}}-completions-###
64
+ `,co=`#compdef {{app_name}}
65
+ ###-begin-{{app_name}}-completions-###
66
+ #
67
+ # yargs command completion script
68
+ #
69
+ # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
70
+ # or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
71
+ #
72
+ _{{app_name}}_yargs_completions()
73
+ {
74
+ local reply
75
+ local si=$IFS
76
+ IFS=$'
77
+ ' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
78
+ IFS=$si
79
+ _describe 'values' reply
80
+ }
81
+ compdef _{{app_name}}_yargs_completions {{app_name}}
82
+ ###-end-{{app_name}}-completions-###
83
+ `;class uo{constructor(t,e,n,s){var i,r,a;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=(a=((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&&a!==void 0?a:!1}defaultCompletion(t,e,n,s){const i=this.command.getCommandHandlers();for(let a=0,c=t.length;a<c;++a)if(i[t[a]]&&i[t[a]].builder){const y=i[t[a]].builder;if(Bn(y)){this.indexAfterLastReset=a+1;const p=this.yargs.getInternalMethods().reset();return y(p,!0),p.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=de(i[0]).cmd;if(e.indexOf(r)===-1)if(!this.zshShell)t.push(r);else{const a=i[1]||"";t.push(r.replace(/:/g,"\\:")+":"+a)}})}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(a=>{const c=!!i.configuration["boolean-negation"]&&i.boolean.includes(a);!r.includes(a)&&!i.hiddenOptions.includes(a)&&!this.argsContainKey(e,a,c)&&this.completeOptionKey(a,t,s,c&&!!i.default[a])})}}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),a=i[n._.length-r-1];if(!a)return;const c=this.yargs.getOptions().choices[a]||[];for(const y of c)y.startsWith(s)&&t.push(y.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 a;for(const c of r)if(Object.prototype.hasOwnProperty.call(i.key,c)&&Array.isArray(i.choices[c])){a=i.choices[c];break}if(a)return a.filter(c=>!n||c.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,a,c;let y=t;if(this.zshShell){const w=this.usage.getDescriptions(),E=(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(P=>{const I=w[P];return typeof I=="string"&&I.length>0}),C=E?w[E]:void 0,O=(c=(a=w[t])!==null&&a!==void 0?a:C)!==null&&c!==void 0?c:"";y=`${t.replace(/:/g,"\\:")}:${O.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const p=w=>/^--/.test(w),l=w=>/^[^0-9]$/.test(w),h=!p(n)&&l(t)?"-":"--";e.push(h+y),s&&e.push(h+"no-"+y)}customCompletion(t,e,n,s){if(Mt(this.customCompletionFunction,null,this.shim),fo(this.customCompletionFunction)){const i=this.customCompletionFunction(n,e);return pt(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 ho(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 pt(s)?s.then(i):i(s)}generateCompletionScript(t,e){let n=this.zshShell?co:ao;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 lo(o,t,e,n){return new uo(o,t,e,n)}function fo(o){return o.length<3}function ho(o){return o.length>3}function po(o,t){if(o.length===0)return t.length;if(t.length===0)return o.length;const e=[];let n;for(n=0;n<=t.length;n++)e[n]=[n];let s;for(s=0;s<=o.length;s++)e[0][s]=s;for(n=1;n<=t.length;n++)for(s=1;s<=o.length;s++)t.charAt(n-1)===o.charAt(s-1)?e[n][s]=e[n-1][s-1]:n>1&&s>1&&t.charAt(n-2)===o.charAt(s-1)&&t.charAt(n-1)===o.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][o.length]}const Ci=["$0","--","_"];function mo(o,t,e){const n=e.y18n.__,s=e.y18n.__n,i={};i.nonOptionCount=function(l){const h=o.getDemandedCommands(),E=l._.length+(l["--"]?l["--"].length:0)-o.getInternalMethods().getContext().commands.length;h._&&(E<h._.min||E>h._.max)&&(E<h._.min?h._.minMsg!==void 0?t.fail(h._.minMsg?h._.minMsg.replace(/\$0/g,E.toString()).replace(/\$1/,h._.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",E,E.toString(),h._.min.toString())):E>h._.max&&(h._.maxMsg!==void 0?t.fail(h._.maxMsg?h._.maxMsg.replace(/\$0/g,E.toString()).replace(/\$1/,h._.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",E,E.toString(),h._.max.toString()))))},i.positionalCount=function(l,h){h<l&&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",h,h+"",l+""))},i.requiredArguments=function(l,h){let w=null;for(const E of Object.keys(h))(!Object.prototype.hasOwnProperty.call(l,E)||typeof l[E]>"u")&&(w=w||{},w[E]=h[E]);if(w){const E=[];for(const O of Object.keys(w)){const P=w[O];P&&E.indexOf(P)<0&&E.push(P)}const C=E.length?`
84
+ ${E.join(`
85
+ `)}`:"";t.fail(s("Missing required argument: %s","Missing required arguments: %s",Object.keys(w).length,Object.keys(w).join(", ")+C))}},i.unknownArguments=function(l,h,w,E,C=!0){var O;const P=o.getInternalMethods().getCommandInstance().getCommands(),I=[],d=o.getInternalMethods().getContext();if(Object.keys(l).forEach(_=>{!Ci.includes(_)&&!Object.prototype.hasOwnProperty.call(w,_)&&!Object.prototype.hasOwnProperty.call(o.getInternalMethods().getParseContext(),_)&&!i.isValidAndSomeAliasIsNotNew(_,h)&&I.push(_)}),C&&(d.commands.length>0||P.length>0||E)&&l._.slice(d.commands.length).forEach(_=>{P.includes(""+_)||I.push(""+_)}),C){const x=((O=o.getDemandedCommands()._)===null||O===void 0?void 0:O.max)||0,j=d.commands.length+x;j<l._.length&&l._.slice(j).forEach(B=>{B=String(B),!d.commands.includes(B)&&!I.includes(B)&&I.push(B)})}I.length&&t.fail(s("Unknown argument: %s","Unknown arguments: %s",I.length,I.map(_=>_.trim()?_:`"${_}"`).join(", ")))},i.unknownCommands=function(l){const h=o.getInternalMethods().getCommandInstance().getCommands(),w=[],E=o.getInternalMethods().getContext();return(E.commands.length>0||h.length>0)&&l._.slice(E.commands.length).forEach(C=>{h.includes(""+C)||w.push(""+C)}),w.length>0?(t.fail(s("Unknown command: %s","Unknown commands: %s",w.length,w.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(l,h){if(!Object.prototype.hasOwnProperty.call(h,l))return!1;const w=o.parsed.newAliases;return[l,...h[l]].some(E=>!Object.prototype.hasOwnProperty.call(w,E)||!w[l])},i.limitedChoices=function(l){const h=o.getOptions(),w={};if(!Object.keys(h.choices).length)return;Object.keys(l).forEach(O=>{Ci.indexOf(O)===-1&&Object.prototype.hasOwnProperty.call(h.choices,O)&&[].concat(l[O]).forEach(P=>{h.choices[O].indexOf(P)===-1&&P!==void 0&&(w[O]=(w[O]||[]).concat(P))})});const E=Object.keys(w);if(!E.length)return;let C=n("Invalid values:");E.forEach(O=>{C+=`
86
+ ${n("Argument: %s, Given: %s, Choices: %s",O,t.stringifiedValues(w[O]),t.stringifiedValues(h.choices[O]))}`}),t.fail(C)};let r={};i.implies=function(l,h){V("<string|object> [array|number|string]",[l,h],arguments.length),typeof l=="object"?Object.keys(l).forEach(w=>{i.implies(w,l[w])}):(o.global(l),r[l]||(r[l]=[]),Array.isArray(h)?h.forEach(w=>i.implies(l,w)):(Mt(h,void 0,e),r[l].push(h)))},i.getImplied=function(){return r};function a(p,l){const h=Number(l);return l=isNaN(h)?l:h,typeof l=="number"?l=p._.length>=l:l.match(/^--no-.+/)?(l=l.match(/^--no-(.+)/)[1],l=!Object.prototype.hasOwnProperty.call(p,l)):l=Object.prototype.hasOwnProperty.call(p,l),l}i.implications=function(l){const h=[];if(Object.keys(r).forEach(w=>{const E=w;(r[w]||[]).forEach(C=>{let O=E;const P=C;O=a(l,O),C=a(l,C),O&&!C&&h.push(` ${E} -> ${P}`)})}),h.length){let w=`${n("Implications failed:")}
87
+ `;h.forEach(E=>{w+=E}),t.fail(w)}};let c={};i.conflicts=function(l,h){V("<string|object> [array|string]",[l,h],arguments.length),typeof l=="object"?Object.keys(l).forEach(w=>{i.conflicts(w,l[w])}):(o.global(l),c[l]||(c[l]=[]),Array.isArray(h)?h.forEach(w=>i.conflicts(l,w)):c[l].push(h))},i.getConflicting=()=>c,i.conflicting=function(l){Object.keys(l).forEach(h=>{c[h]&&c[h].forEach(w=>{w&&l[h]!==void 0&&l[w]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,w))})}),o.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(c).forEach(h=>{c[h].forEach(w=>{w&&l[e.Parser.camelCase(h)]!==void 0&&l[e.Parser.camelCase(w)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",h,w))})})},i.recommendCommands=function(l,h){h=h.sort((O,P)=>P.length-O.length);let E=null,C=1/0;for(let O=0,P;(P=h[O])!==void 0;O++){const I=po(l,P);I<=3&&I<C&&(C=I,E=P)}E&&t.fail(n("Did you mean %s?",E))},i.reset=function(l){return r=be(r,h=>!l[h]),c=be(c,h=>!l[h]),i};const y=[];return i.freeze=function(){y.push({implied:r,conflicting:c})},i.unfreeze=function(){const l=y.pop();Mt(l,void 0,e),{implied:r,conflicting:c}=l},i}let Un=[],pe;function Xn(o,t,e,n){pe=n;let s={};if(Object.prototype.hasOwnProperty.call(o,"extends")){if(typeof o.extends!="string")return s;const i=/\.json|\..*rc$/.test(o.extends);let r=null;if(i)r=yo(t,o.extends);else try{r=require.resolve(o.extends)}catch{return o}go(r),Un.push(r),s=i?JSON.parse(pe.readFileSync(r,"utf8")):require(o.extends),delete o.extends,s=Xn(s,pe.path.dirname(r),e,pe)}return Un=[],e?Hr(s,o):Object.assign({},s,o)}function go(o){if(Un.indexOf(o)>-1)throw new ht(`Circular extended configurations: '${o}'.`)}function yo(o,t){return pe.path.resolve(o,t)}function Hr(o,t){const e={};function n(s){return s&&typeof s=="object"&&!Array.isArray(s)}Object.assign(e,o);for(const s of Object.keys(t))n(t[s])&&n(e[s])?e[s]=Hr(o[s],t[s]):e[s]=t[s];return e}var W=function(o,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"?o!==t||!s:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(o,e):s?s.value=e:t.set(o,e),e},g=function(o,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!n:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(o):n?n.value:t.get(o)},ft,zt,ue,_t,wt,Ee,qt,Gt,De,It,Ce,Tt,St,Ot,xt,_e,re,mt,G,Ie,Te,Et,Yt,se,Kt,Wt,xe,Q,kt,Qt,Jt,J,ve,jt,lt;function bo(o){return(t=[],e=o.process.cwd(),n)=>{const s=new wo(t,e,n,o);return Object.defineProperty(s,"argv",{get:()=>s.parse(),enumerable:!0}),s.help(),s.version(),s}}const _i=Symbol("copyDoubleDash"),Ii=Symbol("copyDoubleDash"),We=Symbol("deleteFromParserHintObject"),Ti=Symbol("emitWarning"),xi=Symbol("freeze"),vi=Symbol("getDollarZero"),Zt=Symbol("getParserConfiguration"),Ni=Symbol("getUsageConfiguration"),Ve=Symbol("guessLocale"),Pi=Symbol("guessVersion"),Ai=Symbol("parsePositionalNumbers"),He=Symbol("pkgUp"),Vt=Symbol("populateParserHintArray"),oe=Symbol("populateParserHintSingleValueDictionary"),ze=Symbol("populateParserHintArrayDictionary"),Ge=Symbol("populateParserHintDictionary"),Ye=Symbol("sanitizeKey"),Ke=Symbol("setKey"),ke=Symbol("unfreeze"),Mi=Symbol("validateAsync"),Li=Symbol("getCommandInstance"),Si=Symbol("getContext"),ji=Symbol("getHasOutput"),Fi=Symbol("getLoggerInstance"),Ri=Symbol("getParseContext"),Bi=Symbol("getUsageInstance"),Ui=Symbol("getValidationInstance"),Ne=Symbol("hasParseCallback"),Xi=Symbol("isGlobalContext"),te=Symbol("postProcess"),$i=Symbol("rebase"),Qe=Symbol("reset"),le=Symbol("runYargsParserAndExecuteCommands"),Je=Symbol("runValidation"),qi=Symbol("setHasOutput"),ee=Symbol("kTrackManuallySetKeys");class wo{constructor(t=[],e,n,s){this.customScriptName=!1,this.parsed=!1,ft.set(this,void 0),zt.set(this,void 0),ue.set(this,{commands:[],fullCommands:[]}),_t.set(this,null),wt.set(this,null),Ee.set(this,"show-hidden"),qt.set(this,null),Gt.set(this,!0),De.set(this,{}),It.set(this,!0),Ce.set(this,[]),Tt.set(this,void 0),St.set(this,{}),Ot.set(this,!1),xt.set(this,null),_e.set(this,!0),re.set(this,void 0),mt.set(this,""),G.set(this,void 0),Ie.set(this,void 0),Te.set(this,{}),Et.set(this,null),Yt.set(this,null),se.set(this,{}),Kt.set(this,{}),Wt.set(this,void 0),xe.set(this,!1),Q.set(this,void 0),kt.set(this,!1),Qt.set(this,!1),Jt.set(this,!1),J.set(this,void 0),ve.set(this,{}),jt.set(this,null),lt.set(this,void 0),W(this,Q,s,"f"),W(this,Wt,t,"f"),W(this,zt,e,"f"),W(this,Ie,n,"f"),W(this,Tt,new Ks(this),"f"),this.$0=this[vi](),this[Qe](),W(this,ft,g(this,ft,"f"),"f"),W(this,J,g(this,J,"f"),"f"),W(this,lt,g(this,lt,"f"),"f"),W(this,G,g(this,G,"f"),"f"),g(this,G,"f").showHiddenOpt=g(this,Ee,"f"),W(this,re,this[Ii](),"f")}addHelpOpt(t,e){const n="help";return V("[string|boolean] [string]",[t,e],arguments.length),g(this,xt,"f")&&(this[We](g(this,xt,"f")),W(this,xt,null,"f")),t===!1&&e===void 0?this:(W(this,xt,typeof t=="string"?t:n,"f"),this.boolean(g(this,xt,"f")),this.describe(g(this,xt,"f"),e||g(this,J,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(V("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;const n=typeof t=="string"?t:g(this,Ee,"f");return this.boolean(n),this.describe(n,e||g(this,J,"f").deferY18nLookup("Show hidden options")),g(this,G,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return V("<object|string|array> [string|array]",[t,e],arguments.length),this[ze](this.alias.bind(this),"alias",t,e),this}array(t){return V("<array|string>",[t],arguments.length),this[Vt]("array",t),this[ee](t),this}boolean(t){return V("<array|string>",[t],arguments.length),this[Vt]("boolean",t),this[ee](t),this}check(t,e){return V("<function> [boolean]",[t,e],arguments.length),this.middleware((n,s)=>ge(()=>t(n,s.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&g(this,J,"f").fail(i.toString(),i):g(this,J,"f").fail(g(this,Q,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(g(this,J,"f").fail(i.message?i.message:i.toString(),i),n)),!1,e),this}choices(t,e){return V("<object|string|array> [string|array]",[t,e],arguments.length),this[ze](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(V("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new ht("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 ht("coerce callback must be provided");return g(this,G,"f").key[t]=!0,g(this,Tt,"f").addCoerceMiddleware((n,s)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?ge(()=>(i=s.getAliases(),e(n[t])),a=>{n[t]=a;const c=s.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&c!==!0)for(const y of i[t])n[y]=a;return n},a=>{throw new ht(a.message)}):n},t),this}conflicts(t,e){return V("<string|object> [string|array]",[t,e],arguments.length),g(this,lt,"f").conflicts(t,e),this}config(t="config",e,n){return V("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Xn(t,g(this,zt,"f"),this[Zt]()["deep-merge-config"]||!1,g(this,Q,"f")),g(this,G,"f").configObjects=(g(this,G,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||g(this,J,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(s=>{g(this,G,"f").config[s]=n||!0}),this)}completion(t,e,n){return V("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),W(this,wt,t||g(this,wt,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(g(this,wt,"f"),e),n&&g(this,_t,"f").registerFunction(n),this}command(t,e,n,s,i,r){return V("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,s,i,r],arguments.length),g(this,ft,"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){V("<string> [object]",[t,e],arguments.length);const n=g(this,Ie,"f")||g(this,Q,"f").require;return g(this,ft,"f").addDirectory(t,n,g(this,Q,"f").getCallerFile(),e),this}count(t){return V("<array|string>",[t],arguments.length),this[Vt]("count",t),this[ee](t),this}default(t,e,n){return V("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(bi(t,g(this,Q,"f")),g(this,G,"f").defaultDescription[t]=n),typeof e=="function"&&(bi(t,g(this,Q,"f")),g(this,G,"f").defaultDescription[t]||(g(this,G,"f").defaultDescription[t]=g(this,J,"f").functionDescription(e)),e=e.call()),this[oe](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 V("[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),g(this,G,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:s},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(s=>{Mt(n,!0,g(this,Q,"f")),this.demandOption(s,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(Mt(n,!0,g(this,Q,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(s=>{Mt(n,!0,g(this,Q,"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 V("<object|string|array> [string]",[t,e],arguments.length),this[oe](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return V("<string> [string|boolean]",[t,e],arguments.length),g(this,G,"f").deprecatedOptions[t]=e,this}describe(t,e){return V("<object|string|array> [string]",[t,e],arguments.length),this[Ke](t,!0),g(this,J,"f").describe(t,e),this}detectLocale(t){return V("<boolean>",[t],arguments.length),W(this,Gt,t,"f"),this}env(t){return V("[string|boolean]",[t],arguments.length),t===!1?delete g(this,G,"f").envPrefix:g(this,G,"f").envPrefix=t||"",this}epilogue(t){return V("<string>",[t],arguments.length),g(this,J,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return V("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):g(this,J,"f").example(t,e),this}exit(t,e){W(this,Ot,!0,"f"),W(this,qt,e,"f"),g(this,It,"f")&&g(this,Q,"f").process.exit(t)}exitProcess(t=!0){return V("[boolean]",[t],arguments.length),W(this,It,t,"f"),this}fail(t){if(V("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new ht("Invalid first argument. Expected function or boolean 'false'");return g(this,J,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return V("<array> [function]",[t,e],arguments.length),e?g(this,_t,"f").getCompletion(t,e):new Promise((n,s)=>{g(this,_t,"f").getCompletion(t,(i,r)=>{i?s(i):n(r)})})}getDemandedOptions(){return V([],0),g(this,G,"f").demandedOptions}getDemandedCommands(){return V([],0),g(this,G,"f").demandedCommands}getDeprecatedOptions(){return V([],0),g(this,G,"f").deprecatedOptions}getDetectLocale(){return g(this,Gt,"f")}getExitProcess(){return g(this,It,"f")}getGroups(){return Object.assign({},g(this,St,"f"),g(this,Kt,"f"))}getHelp(){if(W(this,Ot,!0,"f"),!g(this,J,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[le](g(this,Wt,"f"),void 0,void 0,0,!0);if(pt(e))return e.then(()=>g(this,J,"f").help())}const t=g(this,ft,"f").runDefaultBuilderOn(this);if(pt(t))return t.then(()=>g(this,J,"f").help())}return Promise.resolve(g(this,J,"f").help())}getOptions(){return g(this,G,"f")}getStrict(){return g(this,kt,"f")}getStrictCommands(){return g(this,Qt,"f")}getStrictOptions(){return g(this,Jt,"f")}global(t,e){return V("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?g(this,G,"f").local=g(this,G,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{g(this,G,"f").local.includes(n)||g(this,G,"f").local.push(n)}),this}group(t,e){V("<string|array> <string>",[t,e],arguments.length);const n=g(this,Kt,"f")[e]||g(this,St,"f")[e];g(this,Kt,"f")[e]&&delete g(this,Kt,"f")[e];const s={};return g(this,St,"f")[e]=(n||[]).concat(t).filter(i=>s[i]?!1:s[i]=!0),this}hide(t){return V("<string>",[t],arguments.length),g(this,G,"f").hiddenOptions.push(t),this}implies(t,e){return V("<string|object> [number|string|array]",[t,e],arguments.length),g(this,lt,"f").implies(t,e),this}locale(t){return V("[string]",[t],arguments.length),t===void 0?(this[Ve](),g(this,Q,"f").y18n.getLocale()):(W(this,Gt,!1,"f"),g(this,Q,"f").y18n.setLocale(t),this)}middleware(t,e,n){return g(this,Tt,"f").addMiddleware(t,!!e,n)}nargs(t,e){return V("<string|object|array> [number]",[t,e],arguments.length),this[oe](this.nargs.bind(this),"narg",t,e),this}normalize(t){return V("<array|string>",[t],arguments.length),this[Vt]("normalize",t),this}number(t){return V("<array|string>",[t],arguments.length),this[Vt]("number",t),this[ee](t),this}option(t,e){if(V("<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[ee](t),g(this,jt,"f")&&(t==="version"||e?.alias==="version")&&this[Ti](['"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
+ `),void 0,"versionWarning"),g(this,G,"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&&(g(this,G,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const i=e.describe||e.description||e.desc,r=g(this,J,"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){V("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[xi](),typeof t>"u"&&(t=g(this,Wt,"f")),typeof e=="object"&&(W(this,Yt,e,"f"),e=n),typeof e=="function"&&(W(this,Et,e,"f"),e=!1),e||W(this,Wt,t,"f"),g(this,Et,"f")&&W(this,It,!1,"f");const s=this[le](t,!!e),i=this.parsed;return g(this,_t,"f").setParsed(this.parsed),pt(s)?s.then(r=>(g(this,Et,"f")&&g(this,Et,"f").call(this,g(this,qt,"f"),r,g(this,mt,"f")),r)).catch(r=>{throw g(this,Et,"f")&&g(this,Et,"f")(r,this.parsed.argv,g(this,mt,"f")),r}).finally(()=>{this[ke](),this.parsed=i}):(g(this,Et,"f")&&g(this,Et,"f").call(this,g(this,qt,"f"),s,g(this,mt,"f")),this[ke](),this.parsed=i,s)}parseAsync(t,e,n){const s=this.parse(t,e,n);return pt(s)?s:Promise.resolve(s)}parseSync(t,e,n){const s=this.parse(t,e,n);if(pt(s))throw new ht(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return s}parserConfiguration(t){return V("<object>",[t],arguments.length),W(this,Te,t,"f"),this}pkgConf(t,e){V("<string> [string]",[t,e],arguments.length);let n=null;const s=this[He](e||g(this,zt,"f"));return s[t]&&typeof s[t]=="object"&&(n=Xn(s[t],e||g(this,zt,"f"),this[Zt]()["deep-merge-config"]||!1,g(this,Q,"f")),g(this,G,"f").configObjects=(g(this,G,"f").configObjects||[]).concat(n)),this}positional(t,e){V("<string> <object>",[t,e],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=be(e,(r,a)=>r==="type"&&!["string","number","boolean"].includes(a)?!1:n.includes(r));const s=g(this,ue,"f").fullCommands[g(this,ue,"f").fullCommands.length-1],i=s?g(this,ft,"f").cmdToParseOptions(s):{array:[],alias:{},default:{},demand:{}};return Le(i).forEach(r=>{const a=i[r];Array.isArray(a)?a.indexOf(t)!==-1&&(e[r]=!0):a[t]&&!(r in e)&&(e[r]=a[t])}),this.group(t,g(this,J,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return V("[boolean]",[t],arguments.length),W(this,xe,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 V("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&g(this,G,"f").narg[t]?this:(this[oe](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return V("[string] [string]",[t,e],arguments.length),t=t||this.$0,g(this,re,"f").log(g(this,_t,"f").generateCompletionScript(t,e||g(this,wt,"f")||"completion")),this}showHelp(t){if(V("[string|function]",[t],arguments.length),W(this,Ot,!0,"f"),!g(this,J,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[le](g(this,Wt,"f"),void 0,void 0,0,!0);if(pt(n))return n.then(()=>{g(this,J,"f").showHelp(t)}),this}const e=g(this,ft,"f").runDefaultBuilderOn(this);if(pt(e))return e.then(()=>{g(this,J,"f").showHelp(t)}),this}return g(this,J,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return V("[boolean|string] [string]",[t,e],arguments.length),g(this,J,"f").showHelpOnFail(t,e),this}showVersion(t){return V("[string|function]",[t],arguments.length),g(this,J,"f").showVersion(t),this}skipValidation(t){return V("<array|string>",[t],arguments.length),this[Vt]("skipValidation",t),this}strict(t){return V("[boolean]",[t],arguments.length),W(this,kt,t!==!1,"f"),this}strictCommands(t){return V("[boolean]",[t],arguments.length),W(this,Qt,t!==!1,"f"),this}strictOptions(t){return V("[boolean]",[t],arguments.length),W(this,Jt,t!==!1,"f"),this}string(t){return V("<array|string>",[t],arguments.length),this[Vt]("string",t),this[ee](t),this}terminalWidth(){return V([],0),g(this,Q,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return V("<object>",[t],arguments.length),W(this,Gt,!1,"f"),g(this,Q,"f").y18n.updateLocale(t),this}usage(t,e,n,s){if(V("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,s],arguments.length),e!==void 0){if(Mt(t,null,g(this,Q,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,s);throw new ht(".usage() description must start with $0 if being used as alias for .command()")}else return g(this,J,"f").usage(t),this}usageConfiguration(t){return V("<object>",[t],arguments.length),W(this,ve,t,"f"),this}version(t,e,n){const s="version";if(V("[boolean|string] [string] [string]",[t,e,n],arguments.length),g(this,jt,"f")&&(this[We](g(this,jt,"f")),g(this,J,"f").version(void 0),W(this,jt,null,"f")),arguments.length===0)n=this[Pi](),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 W(this,jt,typeof t=="string"?t:s,"f"),e=e||g(this,J,"f").deferY18nLookup("Show version number"),g(this,J,"f").version(n||void 0),this.boolean(g(this,jt,"f")),this.describe(g(this,jt,"f"),e),this}wrap(t){return V("<number|null|undefined>",[t],arguments.length),g(this,J,"f").wrap(t),this}[(ft=new WeakMap,zt=new WeakMap,ue=new WeakMap,_t=new WeakMap,wt=new WeakMap,Ee=new WeakMap,qt=new WeakMap,Gt=new WeakMap,De=new WeakMap,It=new WeakMap,Ce=new WeakMap,Tt=new WeakMap,St=new WeakMap,Ot=new WeakMap,xt=new WeakMap,_e=new WeakMap,re=new WeakMap,mt=new WeakMap,G=new WeakMap,Ie=new WeakMap,Te=new WeakMap,Et=new WeakMap,Yt=new WeakMap,se=new WeakMap,Kt=new WeakMap,Wt=new WeakMap,xe=new WeakMap,Q=new WeakMap,kt=new WeakMap,Qt=new WeakMap,Jt=new WeakMap,J=new WeakMap,ve=new WeakMap,jt=new WeakMap,lt=new WeakMap,_i)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Ii](){return{log:(...t)=>{this[Ne]()||console.log(...t),W(this,Ot,!0,"f"),g(this,mt,"f").length&&W(this,mt,g(this,mt,"f")+`
89
+ `,"f"),W(this,mt,g(this,mt,"f")+t.join(" "),"f")},error:(...t)=>{this[Ne]()||console.error(...t),W(this,Ot,!0,"f"),g(this,mt,"f").length&&W(this,mt,g(this,mt,"f")+`
90
+ `,"f"),W(this,mt,g(this,mt,"f")+t.join(" "),"f")}}}[We](t){Le(g(this,G,"f")).forEach(e=>{if((s=>s==="configObjects")(e))return;const n=g(this,G,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete g(this,J,"f").getDescriptions()[t]}[Ti](t,e,n){g(this,De,"f")[n]||(g(this,Q,"f").process.emitWarning(t,e),g(this,De,"f")[n]=!0)}[xi](){g(this,Ce,"f").push({options:g(this,G,"f"),configObjects:g(this,G,"f").configObjects.slice(0),exitProcess:g(this,It,"f"),groups:g(this,St,"f"),strict:g(this,kt,"f"),strictCommands:g(this,Qt,"f"),strictOptions:g(this,Jt,"f"),completionCommand:g(this,wt,"f"),output:g(this,mt,"f"),exitError:g(this,qt,"f"),hasOutput:g(this,Ot,"f"),parsed:this.parsed,parseFn:g(this,Et,"f"),parseContext:g(this,Yt,"f")}),g(this,J,"f").freeze(),g(this,lt,"f").freeze(),g(this,ft,"f").freeze(),g(this,Tt,"f").freeze()}[vi](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(g(this,Q,"f").process.argv()[0])?e=g(this,Q,"f").process.argv().slice(1,2):e=g(this,Q,"f").process.argv().slice(0,1),t=e.map(n=>{const s=this[$i](g(this,zt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<n.length?s:n}).join(" ").trim(),g(this,Q,"f").getEnv("_")&&g(this,Q,"f").getProcessArgvBin()===g(this,Q,"f").getEnv("_")&&(t=g(this,Q,"f").getEnv("_").replace(`${g(this,Q,"f").path.dirname(g(this,Q,"f").process.execPath())}/`,"")),t}[Zt](){return g(this,Te,"f")}[Ni](){return g(this,ve,"f")}[Ve](){if(!g(this,Gt,"f"))return;const t=g(this,Q,"f").getEnv("LC_ALL")||g(this,Q,"f").getEnv("LC_MESSAGES")||g(this,Q,"f").getEnv("LANG")||g(this,Q,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Pi](){return this[He]().version||"unknown"}[Ai](t){const e=t["--"]?t["--"]:t._;for(let n=0,s;(s=e[n])!==void 0;n++)g(this,Q,"f").Parser.looksLikeNumber(s)&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))&&(e[n]=Number(s));return t}[He](t){const e=t||"*";if(g(this,se,"f")[e])return g(this,se,"f")[e];let n={};try{let s=t||g(this,Q,"f").mainFilename;!t&&g(this,Q,"f").path.extname(s)&&(s=g(this,Q,"f").path.dirname(s));const i=g(this,Q,"f").findUp(s,(r,a)=>{if(a.includes("package.json"))return"package.json"});Mt(i,void 0,g(this,Q,"f")),n=JSON.parse(g(this,Q,"f").readFileSync(i,"utf8"))}catch{}return g(this,se,"f")[e]=n||{},g(this,se,"f")[e]}[Vt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Ye](n),g(this,G,"f")[t].push(n)})}[oe](t,e,n,s){this[Ge](t,e,n,s,(i,r,a)=>{g(this,G,"f")[i][r]=a})}[ze](t,e,n,s){this[Ge](t,e,n,s,(i,r,a)=>{g(this,G,"f")[i][r]=(g(this,G,"f")[i][r]||[]).concat(a)})}[Ge](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 Le(n))t(r,n[r]);else i(e,this[Ye](n),s)}[Ye](t){return t==="__proto__"?"___proto___":t}[Ke](t,e){return this[oe](this[Ke].bind(this),"key",t,e),this}[ke](){var t,e,n,s,i,r,a,c,y,p,l,h;const w=g(this,Ce,"f").pop();Mt(w,void 0,g(this,Q,"f"));let E;t=this,e=this,n=this,s=this,i=this,r=this,a=this,c=this,y=this,p=this,l=this,h=this,{options:{set value(C){W(t,G,C,"f")}}.value,configObjects:E,exitProcess:{set value(C){W(e,It,C,"f")}}.value,groups:{set value(C){W(n,St,C,"f")}}.value,output:{set value(C){W(s,mt,C,"f")}}.value,exitError:{set value(C){W(i,qt,C,"f")}}.value,hasOutput:{set value(C){W(r,Ot,C,"f")}}.value,parsed:this.parsed,strict:{set value(C){W(a,kt,C,"f")}}.value,strictCommands:{set value(C){W(c,Qt,C,"f")}}.value,strictOptions:{set value(C){W(y,Jt,C,"f")}}.value,completionCommand:{set value(C){W(p,wt,C,"f")}}.value,parseFn:{set value(C){W(l,Et,C,"f")}}.value,parseContext:{set value(C){W(h,Yt,C,"f")}}.value}=w,g(this,G,"f").configObjects=E,g(this,J,"f").unfreeze(),g(this,lt,"f").unfreeze(),g(this,ft,"f").unfreeze(),g(this,Tt,"f").unfreeze()}[Mi](t,e){return ge(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Li].bind(this),getContext:this[Si].bind(this),getHasOutput:this[ji].bind(this),getLoggerInstance:this[Fi].bind(this),getParseContext:this[Ri].bind(this),getParserConfiguration:this[Zt].bind(this),getUsageConfiguration:this[Ni].bind(this),getUsageInstance:this[Bi].bind(this),getValidationInstance:this[Ui].bind(this),hasParseCallback:this[Ne].bind(this),isGlobalContext:this[Xi].bind(this),postProcess:this[te].bind(this),reset:this[Qe].bind(this),runValidation:this[Je].bind(this),runYargsParserAndExecuteCommands:this[le].bind(this),setHasOutput:this[qi].bind(this)}}[Li](){return g(this,ft,"f")}[Si](){return g(this,ue,"f")}[ji](){return g(this,Ot,"f")}[Fi](){return g(this,re,"f")}[Ri](){return g(this,Yt,"f")||{}}[Bi](){return g(this,J,"f")}[Ui](){return g(this,lt,"f")}[Ne](){return!!g(this,Et,"f")}[Xi](){return g(this,_e,"f")}[te](t,e,n,s){return n||pt(t)||(e||(t=this[_i](t)),(this[Zt]()["parse-positional-numbers"]||this[Zt]()["parse-positional-numbers"]===void 0)&&(t=this[Ai](t)),s&&(t=me(t,this,g(this,Tt,"f").getMiddleware(),!1))),t}[Qe](t={}){W(this,G,g(this,G,"f")||{},"f");const e={};e.local=g(this,G,"f").local||[],e.configObjects=g(this,G,"f").configObjects||[];const n={};e.local.forEach(r=>{n[r]=!0,(t[r]||[]).forEach(a=>{n[a]=!0})}),Object.assign(g(this,Kt,"f"),Object.keys(g(this,St,"f")).reduce((r,a)=>{const c=g(this,St,"f")[a].filter(y=>!(y in n));return c.length>0&&(r[a]=c),r},{})),W(this,St,{},"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]=(g(this,G,"f")[r]||[]).filter(a=>!n[a])}),i.forEach(r=>{e[r]=be(g(this,G,"f")[r],a=>!n[a])}),e.envPrefix=g(this,G,"f").envPrefix,W(this,G,e,"f"),W(this,J,g(this,J,"f")?g(this,J,"f").reset(n):so(this,g(this,Q,"f")),"f"),W(this,lt,g(this,lt,"f")?g(this,lt,"f").reset(n):mo(this,g(this,J,"f"),g(this,Q,"f")),"f"),W(this,ft,g(this,ft,"f")?g(this,ft,"f").reset():to(g(this,J,"f"),g(this,lt,"f"),g(this,Tt,"f"),g(this,Q,"f")),"f"),g(this,_t,"f")||W(this,_t,lo(this,g(this,J,"f"),g(this,ft,"f"),g(this,Q,"f")),"f"),g(this,Tt,"f").reset(),W(this,wt,null,"f"),W(this,mt,"","f"),W(this,qt,null,"f"),W(this,Ot,!1,"f"),this.parsed=!1,this}[$i](t,e){return g(this,Q,"f").path.relative(t,e)}[le](t,e,n,s=0,i=!1){let r=!!n||i;t=t||g(this,Wt,"f"),g(this,G,"f").__=g(this,Q,"f").y18n.__,g(this,G,"f").configuration=this[Zt]();const a=!!g(this,G,"f").configuration["populate--"],c=Object.assign({},g(this,G,"f").configuration,{"populate--":!0}),y=g(this,Q,"f").Parser.detailed(t,Object.assign({},g(this,G,"f"),{configuration:{"parse-positional-numbers":!1,...c}})),p=Object.assign(y.argv,g(this,Yt,"f"));let l;const h=y.aliases;let w=!1,E=!1;Object.keys(p).forEach(C=>{C===g(this,xt,"f")&&p[C]?w=!0:C===g(this,jt,"f")&&p[C]&&(E=!0)}),p.$0=this.$0,this.parsed=y,s===0&&g(this,J,"f").clearCachedHelpMessage();try{if(this[Ve](),e)return this[te](p,a,!!n,!1);g(this,xt,"f")&&[g(this,xt,"f")].concat(h[g(this,xt,"f")]||[]).filter(d=>d.length>1).includes(""+p._[p._.length-1])&&(p._.pop(),w=!0),W(this,_e,!1,"f");const C=g(this,ft,"f").getCommands(),O=g(this,_t,"f").completionKey in p,P=w||O||i;if(p._.length){if(C.length){let I;for(let d=s||0,_;p._[d]!==void 0;d++)if(_=String(p._[d]),C.includes(_)&&_!==g(this,wt,"f")){const x=g(this,ft,"f").runCommand(_,this,y,d+1,i,w||E||i);return this[te](x,a,!!n,!1)}else if(!I&&_!==g(this,wt,"f")){I=_;break}!g(this,ft,"f").hasDefaultCommand()&&g(this,xe,"f")&&I&&!P&&g(this,lt,"f").recommendCommands(I,C)}g(this,wt,"f")&&p._.includes(g(this,wt,"f"))&&!O&&(g(this,It,"f")&&he(!0),this.showCompletionScript(),this.exit(0))}if(g(this,ft,"f").hasDefaultCommand()&&!P){const I=g(this,ft,"f").runCommand(null,this,y,0,i,w||E||i);return this[te](I,a,!!n,!1)}if(O){g(this,It,"f")&&he(!0),t=[].concat(t);const I=t.slice(t.indexOf(`--${g(this,_t,"f").completionKey}`)+1);return g(this,_t,"f").getCompletion(I,(d,_)=>{if(d)throw new ht(d.message);(_||[]).forEach(x=>{g(this,re,"f").log(x)}),this.exit(0)}),this[te](p,!a,!!n,!1)}if(g(this,Ot,"f")||(w?(g(this,It,"f")&&he(!0),r=!0,this.showHelp("log"),this.exit(0)):E&&(g(this,It,"f")&&he(!0),r=!0,g(this,J,"f").showVersion("log"),this.exit(0))),!r&&g(this,G,"f").skipValidation.length>0&&(r=Object.keys(p).some(I=>g(this,G,"f").skipValidation.indexOf(I)>=0&&p[I]===!0)),!r){if(y.error)throw new ht(y.error.message);if(!O){const I=this[Je](h,{},y.error);n||(l=me(p,this,g(this,Tt,"f").getMiddleware(),!0)),l=this[Mi](I,l??p),pt(l)&&!n&&(l=l.then(()=>me(p,this,g(this,Tt,"f").getMiddleware(),!1)))}}}catch(C){if(C instanceof ht)g(this,J,"f").fail(C.message,C);else throw C}return this[te](l??p,a,!!n,!0)}[Je](t,e,n,s){const i={...this.getDemandedOptions()};return r=>{if(n)throw new ht(n.message);g(this,lt,"f").nonOptionCount(r),g(this,lt,"f").requiredArguments(r,i);let a=!1;g(this,Qt,"f")&&(a=g(this,lt,"f").unknownCommands(r)),g(this,kt,"f")&&!a?g(this,lt,"f").unknownArguments(r,t,e,!!s):g(this,Jt,"f")&&g(this,lt,"f").unknownArguments(r,t,{},!1,!1),g(this,lt,"f").limitedChoices(r),g(this,lt,"f").implications(r),g(this,lt,"f").conflicting(r)}}[qi](){W(this,Ot,!0,"f")}[ee](t){if(typeof t=="string")g(this,G,"f").key[t]=!0;else for(const e of t)g(this,G,"f").key[e]=!0}}function Oo(o){return!!o&&typeof o.getInternalMethods=="function"}const Eo=bo(Gs);var Ze={},Wi;function Hn(){return Wi||(Wi=1,function(){Ze.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
+ `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(Z)),Ze}var tn={},Ut={},Xt={},Vi;function $t(){return Vi||(Vi=1,function(){var o,t,e,n,s,i,r,a=[].slice,c={}.hasOwnProperty;o=function(){var y,p,l,h,w,E;if(E=arguments[0],w=2<=arguments.length?a.call(arguments,1):[],s(Object.assign))Object.assign.apply(null,arguments);else for(y=0,l=w.length;y<l;y++)if(h=w[y],h!=null)for(p in h)c.call(h,p)&&(E[p]=h[p]);return E},s=function(y){return!!y&&Object.prototype.toString.call(y)==="[object Function]"},i=function(y){var p;return!!y&&((p=typeof y)=="function"||p==="object")},e=function(y){return s(Array.isArray)?Array.isArray(y):Object.prototype.toString.call(y)==="[object Array]"},n=function(y){var p;if(e(y))return!y.length;for(p in y)if(c.call(y,p))return!1;return!0},r=function(y){var p,l;return i(y)&&(l=Object.getPrototypeOf(y))&&(p=l.constructor)&&typeof p=="function"&&p instanceof p&&Function.prototype.toString.call(p)===Function.prototype.toString.call(Object)},t=function(y){return s(y.valueOf)?y.valueOf():y},Xt.assign=o,Xt.isFunction=s,Xt.isObject=i,Xt.isArray=e,Xt.isEmpty=n,Xt.isPlainObject=r,Xt.getValue=t}.call(Z)),Xt}var en={exports:{}},Hi;function zr(){return Hi||(Hi=1,function(){en.exports=function(){function o(){}return o.prototype.hasFeature=function(t,e){return!0},o.prototype.createDocumentType=function(t,e,n){throw new Error("This DOM method is not implemented.")},o.prototype.createDocument=function(t,e,n){throw new Error("This DOM method is not implemented.")},o.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},o.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented.")},o}()}.call(Z)),en.exports}var nn={exports:{}},rn={exports:{}},sn={exports:{}},zi;function Do(){return zi||(zi=1,function(){sn.exports=function(){function o(){}return o.prototype.handleError=function(t){throw new Error(t)},o}()}.call(Z)),sn.exports}var on={exports:{}},Gi;function Co(){return Gi||(Gi=1,function(){on.exports=function(){function o(t){this.arr=t||[]}return Object.defineProperty(o.prototype,"length",{get:function(){return this.arr.length}}),o.prototype.item=function(t){return this.arr[t]||null},o.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},o}()}.call(Z)),on.exports}var Yi;function _o(){return Yi||(Yi=1,function(){var o,t;o=Do(),t=Co(),rn.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 o,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(Z)),rn.exports}var an={exports:{}},cn={exports:{}},un={exports:{}},Ki;function dt(){return Ki||(Ki=1,function(){un.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(Z)),un.exports}var ln={exports:{}},ki;function Gr(){return ki||(ki=1,function(){var o;o=dt(),Nt(),ln.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=o.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(Z)),ln.exports}var fn={exports:{}},Qi;function zn(){return Qi||(Qi=1,function(){fn.exports=function(){function o(t){this.nodes=t}return Object.defineProperty(o.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),o.prototype.clone=function(){return this.nodes=null},o.prototype.getNamedItem=function(t){return this.nodes[t]},o.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},o.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},o.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},o.prototype.getNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},o.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},o.prototype.removeNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},o}()}.call(Z)),fn.exports}var Ji;function Gn(){return Ji||(Ji=1,function(){var o,t,e,n,s,i,r,a,c=function(p,l){for(var h in l)y.call(l,h)&&(p[h]=l[h]);function w(){this.constructor=p}return w.prototype=l.prototype,p.prototype=new w,p.__super__=l.prototype,p},y={}.hasOwnProperty;a=$t(),r=a.isObject,i=a.isFunction,s=a.getValue,n=Nt(),o=dt(),t=Gr(),e=zn(),cn.exports=function(p){c(l,p);function l(h,w,E){var C,O,P,I;if(l.__super__.constructor.call(this,h),w==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(w),this.type=o.Element,this.attribs={},this.schemaTypeInfo=null,E!=null&&this.attribute(E),h.type===o.Document&&(this.isRoot=!0,this.documentObject=h,h.rootObject=this,h.children)){for(I=h.children,O=0,P=I.length;O<P;O++)if(C=I[O],C.type===o.DocType){C.name=this.name;break}}}return Object.defineProperty(l.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(l.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(l.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(l.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(l.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new e(this.attribs)),this.attributeMap}}),l.prototype.clone=function(){var h,w,E,C;E=Object.create(this),E.isRoot&&(E.documentObject=null),E.attribs={},C=this.attribs;for(w in C)y.call(C,w)&&(h=C[w],E.attribs[w]=h.clone());return E.children=[],this.children.forEach(function(O){var P;return P=O.clone(),P.parent=E,E.children.push(P)}),E},l.prototype.attribute=function(h,w){var E,C;if(h!=null&&(h=s(h)),r(h))for(E in h)y.call(h,E)&&(C=h[E],this.attribute(E,C));else i(w)&&(w=w.apply()),this.options.keepNullAttributes&&w==null?this.attribs[h]=new t(this,h,""):w!=null&&(this.attribs[h]=new t(this,h,w));return this},l.prototype.removeAttribute=function(h){var w,E,C;if(h==null)throw new Error("Missing attribute name. "+this.debugInfo());if(h=s(h),Array.isArray(h))for(E=0,C=h.length;E<C;E++)w=h[E],delete this.attribs[w];else delete this.attribs[h];return this},l.prototype.toString=function(h){return this.options.writer.element(this,this.options.writer.filterOptions(h))},l.prototype.att=function(h,w){return this.attribute(h,w)},l.prototype.a=function(h,w){return this.attribute(h,w)},l.prototype.getAttribute=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h].value:null},l.prototype.setAttribute=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNode=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h]:null},l.prototype.setAttributeNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.removeAttributeNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNS=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setAttributeNS=function(h,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.removeAttributeNS=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNodeNS=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setAttributeNodeNS=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagNameNS=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.hasAttribute=function(h){return this.attribs.hasOwnProperty(h)},l.prototype.hasAttributeNS=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setIdAttribute=function(h,w){return this.attribs.hasOwnProperty(h)?this.attribs[h].isId:w},l.prototype.setIdAttributeNS=function(h,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setIdAttributeNode=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagNameNS=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByClassName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.isEqualNode=function(h){var w,E,C;if(!l.__super__.isEqualNode.apply(this,arguments).isEqualNode(h)||h.namespaceURI!==this.namespaceURI||h.prefix!==this.prefix||h.localName!==this.localName||h.attribs.length!==this.attribs.length)return!1;for(w=E=0,C=this.attribs.length-1;0<=C?E<=C:E>=C;w=0<=C?++E:--E)if(!this.attribs[w].isEqualNode(h.attribs[w]))return!1;return!0},l}(n)}.call(Z)),cn.exports}var hn={exports:{}},pn={exports:{}},Zi;function je(){return Zi||(Zi=1,function(){var o,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;o=Nt(),pn.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,a){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}(o)}.call(Z)),pn.exports}var tr;function Yn(){return tr||(tr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=dt(),t=je(),hn.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=o.CData,this.value=this.stringify.cdata(a)}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(Z)),hn.exports}var dn={exports:{}},er;function Kn(){return er||(er=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=dt(),t=je(),dn.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=o.Comment,this.value=this.stringify.comment(a)}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(Z)),dn.exports}var mn={exports:{}},nr;function kn(){return nr||(nr=1,function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;e=$t().isObject,t=Nt(),o=dt(),mn.exports=function(i){n(r,i);function r(a,c,y,p){var l;r.__super__.constructor.call(this,a),e(c)&&(l=c,c=l.version,y=l.encoding,p=l.standalone),c||(c="1.0"),this.type=o.Declaration,this.version=this.stringify.xmlVersion(c),y!=null&&(this.encoding=this.stringify.xmlEncoding(y)),p!=null&&(this.standalone=this.stringify.xmlStandalone(p))}return r.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},r}(t)}.call(Z)),mn.exports}var gn={exports:{}},yn={exports:{}},ir;function Qn(){return ir||(ir=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=dt(),yn.exports=function(s){e(i,s);function i(r,a,c,y,p,l){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(c==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(a));if(!y)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!p)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(p.indexOf("#")!==0&&(p="#"+p),!p.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(l&&!p.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.name(a),this.type=o.AttributeDeclaration,this.attributeName=this.stringify.name(c),this.attributeType=this.stringify.dtdAttType(y),l&&(this.defaultValue=this.stringify.dtdAttDefault(l)),this.defaultValueType=p}return i.prototype.toString=function(r){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(r))},i}(t)}.call(Z)),yn.exports}var bn={exports:{}},rr;function Jn(){return rr||(rr=1,function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;e=$t().isObject,t=Nt(),o=dt(),bn.exports=function(i){n(r,i);function r(a,c,y,p){if(r.__super__.constructor.call(this,a),y==null)throw new Error("Missing DTD entity name. "+this.debugInfo(y));if(p==null)throw new Error("Missing DTD entity value. "+this.debugInfo(y));if(this.pe=!!c,this.name=this.stringify.name(y),this.type=o.EntityDeclaration,!e(p))this.value=this.stringify.dtdEntityValue(p),this.internal=!0;else{if(!p.pubID&&!p.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(y));if(p.pubID&&!p.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(y));if(this.internal=!1,p.pubID!=null&&(this.pubID=this.stringify.dtdPubID(p.pubID)),p.sysID!=null&&(this.sysID=this.stringify.dtdSysID(p.sysID)),p.nData!=null&&(this.nData=this.stringify.dtdNData(p.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(y))}}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(a){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(a))},r}(t)}.call(Z)),bn.exports}var wn={exports:{}},sr;function Zn(){return sr||(sr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=dt(),wn.exports=function(s){e(i,s);function i(r,a,c){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());c||(c="(#PCDATA)"),Array.isArray(c)&&(c="("+c.join(",")+")"),this.name=this.stringify.name(a),this.type=o.ElementDeclaration,this.value=this.stringify.dtdElementValue(c)}return i.prototype.toString=function(r){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(r))},i}(t)}.call(Z)),wn.exports}var On={exports:{}},or;function ti(){return or||(or=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=dt(),On.exports=function(s){e(i,s);function i(r,a,c){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!c.pubID&&!c.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(a));this.name=this.stringify.name(a),this.type=o.NotationDeclaration,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.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(Z)),On.exports}var ar;function ei(){return ar||(ar=1,function(){var o,t,e,n,s,i,r,a,c=function(p,l){for(var h in l)y.call(l,h)&&(p[h]=l[h]);function w(){this.constructor=p}return w.prototype=l.prototype,p.prototype=new w,p.__super__=l.prototype,p},y={}.hasOwnProperty;a=$t().isObject,r=Nt(),o=dt(),t=Qn(),n=Jn(),e=Zn(),s=ti(),i=zn(),gn.exports=function(p){c(l,p);function l(h,w,E){var C,O,P,I,d,_;if(l.__super__.constructor.call(this,h),this.type=o.DocType,h.children){for(I=h.children,O=0,P=I.length;O<P;O++)if(C=I[O],C.type===o.Element){this.name=C.name;break}}this.documentObject=h,a(w)&&(d=w,w=d.pubID,E=d.sysID),E==null&&(_=[w,E],E=_[0],w=_[1]),w!=null&&(this.pubID=this.stringify.dtdPubID(w)),E!=null&&(this.sysID=this.stringify.dtdSysID(E))}return Object.defineProperty(l.prototype,"entities",{get:function(){var h,w,E,C,O;for(C={},O=this.children,w=0,E=O.length;w<E;w++)h=O[w],h.type===o.EntityDeclaration&&!h.pe&&(C[h.name]=h);return new i(C)}}),Object.defineProperty(l.prototype,"notations",{get:function(){var h,w,E,C,O;for(C={},O=this.children,w=0,E=O.length;w<E;w++)h=O[w],h.type===o.NotationDeclaration&&(C[h.name]=h);return new i(C)}}),Object.defineProperty(l.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(l.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(l.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),l.prototype.element=function(h,w){var E;return E=new e(this,h,w),this.children.push(E),this},l.prototype.attList=function(h,w,E,C,O){var P;return P=new t(this,h,w,E,C,O),this.children.push(P),this},l.prototype.entity=function(h,w){var E;return E=new n(this,!1,h,w),this.children.push(E),this},l.prototype.pEntity=function(h,w){var E;return E=new n(this,!0,h,w),this.children.push(E),this},l.prototype.notation=function(h,w){var E;return E=new s(this,h,w),this.children.push(E),this},l.prototype.toString=function(h){return this.options.writer.docType(this,this.options.writer.filterOptions(h))},l.prototype.ele=function(h,w){return this.element(h,w)},l.prototype.att=function(h,w,E,C,O){return this.attList(h,w,E,C,O)},l.prototype.ent=function(h,w){return this.entity(h,w)},l.prototype.pent=function(h,w){return this.pEntity(h,w)},l.prototype.not=function(h,w){return this.notation(h,w)},l.prototype.up=function(){return this.root()||this.documentObject},l.prototype.isEqualNode=function(h){return!(!l.__super__.isEqualNode.apply(this,arguments).isEqualNode(h)||h.name!==this.name||h.publicId!==this.publicId||h.systemId!==this.systemId)},l}(r)}.call(Z)),gn.exports}var En={exports:{}},cr;function ni(){return cr||(cr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=dt(),t=Nt(),En.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=o.Raw,this.value=this.stringify.raw(a)}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(Z)),En.exports}var Dn={exports:{}},ur;function ii(){return ur||(ur=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=dt(),t=je(),Dn.exports=function(s){e(i,s);function i(r,a){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=o.Text,this.value=this.stringify.text(a)}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,a,c;for(c="",a=this.previousSibling;a;)c=a.data+c,a=a.previousSibling;for(c+=this.data,r=this.nextSibling;r;)c=c+r.data,r=r.nextSibling;return c}}),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(Z)),Dn.exports}var Cn={exports:{}},lr;function ri(){return lr||(lr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;o=dt(),t=je(),Cn.exports=function(s){e(i,s);function i(r,a,c){if(i.__super__.constructor.call(this,r),a==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=o.ProcessingInstruction,this.target=this.stringify.insTarget(a),this.name=this.target,c&&(this.value=this.stringify.insValue(c))}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(Z)),Cn.exports}var _n={exports:{}},fr;function Yr(){return fr||(fr=1,function(){var o,t,e=function(s,i){for(var r in i)n.call(i,r)&&(s[r]=i[r]);function a(){this.constructor=s}return a.prototype=i.prototype,s.prototype=new a,s.__super__=i.prototype,s},n={}.hasOwnProperty;t=Nt(),o=dt(),_n.exports=function(s){e(i,s);function i(r){i.__super__.constructor.call(this,r),this.type=o.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return""},i}(t)}.call(Z)),_n.exports}var In={exports:{}},hr;function Io(){return hr||(hr=1,function(){In.exports=function(){function o(t){this.nodes=t}return Object.defineProperty(o.prototype,"length",{get:function(){return this.nodes.length||0}}),o.prototype.clone=function(){return this.nodes=null},o.prototype.item=function(t){return this.nodes[t]||null},o}()}.call(Z)),In.exports}var Tn={exports:{}},pr;function To(){return pr||(pr=1,function(){Tn.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(Z)),Tn.exports}var dr;function Nt(){return dr||(dr=1,function(){var o,t,e,n,s,i,r,a,c,y,p,l,h,w,E,C,O,P={}.hasOwnProperty;O=$t(),C=O.isObject,E=O.isFunction,w=O.isEmpty,h=O.getValue,a=null,e=null,n=null,s=null,i=null,p=null,l=null,y=null,r=null,t=null,c=null,o=null,an.exports=function(){function I(d){this.parent=d,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=Gn(),e=Yn(),n=Kn(),s=kn(),i=ei(),p=ni(),l=ii(),y=ri(),r=Yr(),t=dt(),c=Io(),zn(),o=To())}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 c(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 d;return d=this.parent.children.indexOf(this),this.parent.children[d-1]||null}}),Object.defineProperty(I.prototype,"nextSibling",{get:function(){var d;return d=this.parent.children.indexOf(this),this.parent.children[d+1]||null}}),Object.defineProperty(I.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(I.prototype,"textContent",{get:function(){var d,_,x,j,B;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(B="",j=this.children,_=0,x=j.length;_<x;_++)d=j[_],d.textContent&&(B+=d.textContent);return B}else return null},set:function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),I.prototype.setParent=function(d){var _,x,j,B,S;for(this.parent=d,d&&(this.options=d.options,this.stringify=d.stringify),B=this.children,S=[],x=0,j=B.length;x<j;x++)_=B[x],S.push(_.setParent(this));return S},I.prototype.element=function(d,_,x){var j,B,S,D,b,N,L,R,X,k,Y;if(N=null,_===null&&x==null&&(X=[{},null],_=X[0],x=X[1]),_==null&&(_={}),_=h(_),C(_)||(k=[_,x],x=k[0],_=k[1]),d!=null&&(d=h(d)),Array.isArray(d))for(S=0,L=d.length;S<L;S++)B=d[S],N=this.element(B);else if(E(d))N=this.element(d.apply());else if(C(d)){for(b in d)if(P.call(d,b))if(Y=d[b],E(Y)&&(Y=Y.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&b.indexOf(this.stringify.convertAttKey)===0)N=this.attribute(b.substr(this.stringify.convertAttKey.length),Y);else if(!this.options.separateArrayItems&&Array.isArray(Y)&&w(Y))N=this.dummy();else if(C(Y)&&w(Y))N=this.element(b);else if(!this.options.keepNullNodes&&Y==null)N=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(Y))for(D=0,R=Y.length;D<R;D++)B=Y[D],j={},j[b]=B,N=this.element(j);else C(Y)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&b.indexOf(this.stringify.convertTextKey)===0?N=this.element(Y):(N=this.element(b),N.element(Y)):N=this.element(b,Y)}else!this.options.keepNullNodes&&x===null?N=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&d.indexOf(this.stringify.convertTextKey)===0?N=this.text(x):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&d.indexOf(this.stringify.convertCDataKey)===0?N=this.cdata(x):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&d.indexOf(this.stringify.convertCommentKey)===0?N=this.comment(x):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&d.indexOf(this.stringify.convertRawKey)===0?N=this.raw(x):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&d.indexOf(this.stringify.convertPIKey)===0?N=this.instruction(d.substr(this.stringify.convertPIKey.length),x):N=this.node(d,_,x);if(N==null)throw new Error("Could not create any elements with: "+d+". "+this.debugInfo());return N},I.prototype.insertBefore=function(d,_,x){var j,B,S,D,b;if(d?.type)return S=d,D=_,S.setParent(this),D?(B=children.indexOf(D),b=children.splice(B),children.push(S),Array.prototype.push.apply(children,b)):children.push(S),S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(d));return B=this.parent.children.indexOf(this),b=this.parent.children.splice(B),j=this.parent.element(d,_,x),Array.prototype.push.apply(this.parent.children,b),j},I.prototype.insertAfter=function(d,_,x){var j,B,S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(d));return B=this.parent.children.indexOf(this),S=this.parent.children.splice(B+1),j=this.parent.element(d,_,x),Array.prototype.push.apply(this.parent.children,S),j},I.prototype.remove=function(){var d;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return d=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[d,d-d+1].concat([])),this.parent},I.prototype.node=function(d,_,x){var j,B;return d!=null&&(d=h(d)),_||(_={}),_=h(_),C(_)||(B=[_,x],x=B[0],_=B[1]),j=new a(this,d,_),x!=null&&j.text(x),this.children.push(j),j},I.prototype.text=function(d){var _;return C(d)&&this.element(d),_=new l(this,d),this.children.push(_),this},I.prototype.cdata=function(d){var _;return _=new e(this,d),this.children.push(_),this},I.prototype.comment=function(d){var _;return _=new n(this,d),this.children.push(_),this},I.prototype.commentBefore=function(d){var _,x;return _=this.parent.children.indexOf(this),x=this.parent.children.splice(_),this.parent.comment(d),Array.prototype.push.apply(this.parent.children,x),this},I.prototype.commentAfter=function(d){var _,x;return _=this.parent.children.indexOf(this),x=this.parent.children.splice(_+1),this.parent.comment(d),Array.prototype.push.apply(this.parent.children,x),this},I.prototype.raw=function(d){var _;return _=new p(this,d),this.children.push(_),this},I.prototype.dummy=function(){var d;return d=new r(this),d},I.prototype.instruction=function(d,_){var x,j,B,S,D;if(d!=null&&(d=h(d)),_!=null&&(_=h(_)),Array.isArray(d))for(S=0,D=d.length;S<D;S++)x=d[S],this.instruction(x);else if(C(d))for(x in d)P.call(d,x)&&(j=d[x],this.instruction(x,j));else E(_)&&(_=_.apply()),B=new y(this,d,_),this.children.push(B);return this},I.prototype.instructionBefore=function(d,_){var x,j;return x=this.parent.children.indexOf(this),j=this.parent.children.splice(x),this.parent.instruction(d,_),Array.prototype.push.apply(this.parent.children,j),this},I.prototype.instructionAfter=function(d,_){var x,j;return x=this.parent.children.indexOf(this),j=this.parent.children.splice(x+1),this.parent.instruction(d,_),Array.prototype.push.apply(this.parent.children,j),this},I.prototype.declaration=function(d,_,x){var j,B;return j=this.document(),B=new s(j,d,_,x),j.children.length===0?j.children.unshift(B):j.children[0].type===t.Declaration?j.children[0]=B:j.children.unshift(B),j.root()||j},I.prototype.dtd=function(d,_){var x,j,B,S,D,b,N,L,R,X;for(j=this.document(),B=new i(j,d,_),R=j.children,S=D=0,N=R.length;D<N;S=++D)if(x=R[S],x.type===t.DocType)return j.children[S]=B,B;for(X=j.children,S=b=0,L=X.length;b<L;S=++b)if(x=X[S],x.isRoot)return j.children.splice(S,0,B),B;return j.children.push(B),B},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 d;for(d=this;d;){if(d.type===t.Document)return d.rootObject;if(d.isRoot)return d;d=d.parent}},I.prototype.document=function(){var d;for(d=this;d;){if(d.type===t.Document)return d;d=d.parent}},I.prototype.end=function(d){return this.document().end(d)},I.prototype.prev=function(){var d;if(d=this.parent.children.indexOf(this),d<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[d-1]},I.prototype.next=function(){var d;if(d=this.parent.children.indexOf(this),d===-1||d===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[d+1]},I.prototype.importDocument=function(d){var _;return _=d.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},I.prototype.debugInfo=function(d){var _,x;return d=d||this.name,d==null&&!((_=this.parent)!=null&&_.name)?"":d==null?"parent: <"+this.parent.name+">":(x=this.parent)!=null&&x.name?"node: <"+d+">, parent: <"+this.parent.name+">":"node: <"+d+">"},I.prototype.ele=function(d,_,x){return this.element(d,_,x)},I.prototype.nod=function(d,_,x){return this.node(d,_,x)},I.prototype.txt=function(d){return this.text(d)},I.prototype.dat=function(d){return this.cdata(d)},I.prototype.com=function(d){return this.comment(d)},I.prototype.ins=function(d,_){return this.instruction(d,_)},I.prototype.doc=function(){return this.document()},I.prototype.dec=function(d,_,x){return this.declaration(d,_,x)},I.prototype.e=function(d,_,x){return this.element(d,_,x)},I.prototype.n=function(d,_,x){return this.node(d,_,x)},I.prototype.t=function(d){return this.text(d)},I.prototype.d=function(d){return this.cdata(d)},I.prototype.c=function(d){return this.comment(d)},I.prototype.r=function(d){return this.raw(d)},I.prototype.i=function(d,_){return this.instruction(d,_)},I.prototype.u=function(){return this.up()},I.prototype.importXMLBuilder=function(d){return this.importDocument(d)},I.prototype.replaceChild=function(d,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.removeChild=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.appendChild=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.hasChildNodes=function(){return this.children.length!==0},I.prototype.cloneNode=function(d){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(d,_){return!0},I.prototype.hasAttributes=function(){return this.attribs.length!==0},I.prototype.compareDocumentPosition=function(d){var _,x;return _=this,_===d?0:this.document()!==d.document()?(x=o.Disconnected|o.ImplementationSpecific,Math.random()<.5?x|=o.Preceding:x|=o.Following,x):_.isAncestor(d)?o.Contains|o.Preceding:_.isDescendant(d)?o.Contains|o.Following:_.isPreceding(d)?o.Preceding:o.Following},I.prototype.isSameNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.lookupPrefix=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.isDefaultNamespace=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.lookupNamespaceURI=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.isEqualNode=function(d){var _,x,j;if(d.nodeType!==this.nodeType||d.children.length!==this.children.length)return!1;for(_=x=0,j=this.children.length-1;0<=j?x<=j:x>=j;_=0<=j?++x:--x)if(!this.children[_].isEqualNode(d.children[_]))return!1;return!0},I.prototype.getFeature=function(d,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.setUserData=function(d,_,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.getUserData=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},I.prototype.contains=function(d){return d?d===this||this.isDescendant(d):!1},I.prototype.isDescendant=function(d){var _,x,j,B,S;for(S=this.children,j=0,B=S.length;j<B;j++)if(_=S[j],d===_||(x=_.isDescendant(d),x))return!0;return!1},I.prototype.isAncestor=function(d){return d.isDescendant(this)},I.prototype.isPreceding=function(d){var _,x;return _=this.treePosition(d),x=this.treePosition(this),_===-1||x===-1?!1:_<x},I.prototype.isFollowing=function(d){var _,x;return _=this.treePosition(d),x=this.treePosition(this),_===-1||x===-1?!1:_>x},I.prototype.treePosition=function(d){var _,x;return x=0,_=!1,this.foreachTreeNode(this.document(),function(j){if(x++,!_&&j===d)return _=!0}),_?x:-1},I.prototype.foreachTreeNode=function(d,_){var x,j,B,S,D;for(d||(d=this.document()),S=d.children,j=0,B=S.length;j<B;j++){if(x=S[j],D=_(x))return D;if(D=this.foreachTreeNode(x,_),D)return D}},I}()}.call(Z)),an.exports}var xn={exports:{}},mr;function Kr(){return mr||(mr=1,function(){var o=function(e,n){return function(){return e.apply(n,arguments)}},t={}.hasOwnProperty;xn.exports=function(){function e(n){this.assertLegalName=o(this.assertLegalName,this),this.assertLegalChar=o(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(Z)),xn.exports}var vn={exports:{}},Nn={exports:{}},Pn={exports:{}},gr;function Fe(){return gr||(gr=1,function(){Pn.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(Z)),Pn.exports}var yr;function kr(){return yr||(yr=1,function(){var o,t,e,n={}.hasOwnProperty;e=$t().assign,o=dt(),kn(),ei(),Yn(),Kn(),Gn(),ni(),ii(),ri(),Yr(),Qn(),Zn(),Jn(),ti(),t=Fe(),Nn.exports=function(){function s(i){var r,a,c;i||(i={}),this.options=i,a=i.writer||{};for(r in a)n.call(a,r)&&(c=a[r],this["_"+r]=this[r],this[r]=c)}return s.prototype.filterOptions=function(i){var r,a,c,y,p,l,h,w;return i||(i={}),i=e({},this.options,i),r={writer:this},r.pretty=i.pretty||!1,r.allowEmpty=i.allowEmpty||!1,r.indent=(a=i.indent)!=null?a:" ",r.newline=(c=i.newline)!=null?c:`
92
+ `,r.offset=(y=i.offset)!=null?y:0,r.dontPrettyTextNodes=(p=(l=i.dontPrettyTextNodes)!=null?l:i.dontprettytextnodes)!=null?p:0,r.spaceBeforeSlash=(h=(w=i.spaceBeforeSlash)!=null?w:i.spacebeforeslash)!=null?h:"",r.spaceBeforeSlash===!0&&(r.spaceBeforeSlash=" "),r.suppressPrettyCount=0,r.user={},r.state=t.None,r},s.prototype.indent=function(i,r,a){var c;return!r.pretty||r.suppressPrettyCount?"":r.pretty&&(c=(a||0)+r.offset+1,c>0)?new Array(c).join(r.indent):""},s.prototype.endline=function(i,r,a){return!r.pretty||r.suppressPrettyCount?"":r.newline},s.prototype.attribute=function(i,r,a){var c;return this.openAttribute(i,r,a),c=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,r,a),c},s.prototype.cdata=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<![CDATA[",r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+="]]>"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.comment=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!-- ",r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+=" -->"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.declaration=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<?xml",r.state=t.InsideTag,c+=' version="'+i.version+'"',i.encoding!=null&&(c+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(c+=' standalone="'+i.standalone+'"'),r.state=t.CloseTag,c+=r.spaceBeforeSlash+"?>",c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.docType=function(i,r,a){var c,y,p,l,h;if(a||(a=0),this.openNode(i,r,a),r.state=t.OpenTag,l=this.indent(i,r,a),l+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?l+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(l+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(l+=" [",l+=this.endline(i,r,a),r.state=t.InsideTag,h=i.children,y=0,p=h.length;y<p;y++)c=h[y],l+=this.writeChildNode(c,r,a+1);r.state=t.CloseTag,l+="]"}return r.state=t.CloseTag,l+=r.spaceBeforeSlash+">",l+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),l},s.prototype.element=function(i,r,a){var c,y,p,l,h,w,E,C,O,P,I,d,_,x;a||(a=0),P=!1,I="",this.openNode(i,r,a),r.state=t.OpenTag,I+=this.indent(i,r,a)+"<"+i.name,d=i.attribs;for(O in d)n.call(d,O)&&(c=d[O],I+=this.attribute(c,r,a));if(p=i.children.length,l=p===0?null:i.children[0],p===0||i.children.every(function(j){return(j.type===o.Text||j.type===o.Raw)&&j.value===""}))r.allowEmpty?(I+=">",r.state=t.CloseTag,I+="</"+i.name+">"+this.endline(i,r,a)):(r.state=t.CloseTag,I+=r.spaceBeforeSlash+"/>"+this.endline(i,r,a));else if(r.pretty&&p===1&&(l.type===o.Text||l.type===o.Raw)&&l.value!=null)I+=">",r.state=t.InsideTag,r.suppressPrettyCount++,P=!0,I+=this.writeChildNode(l,r,a+1),r.suppressPrettyCount--,P=!1,r.state=t.CloseTag,I+="</"+i.name+">"+this.endline(i,r,a);else{if(r.dontPrettyTextNodes){for(_=i.children,h=0,E=_.length;h<E;h++)if(y=_[h],(y.type===o.Text||y.type===o.Raw)&&y.value!=null){r.suppressPrettyCount++,P=!0;break}}for(I+=">"+this.endline(i,r,a),r.state=t.InsideTag,x=i.children,w=0,C=x.length;w<C;w++)y=x[w],I+=this.writeChildNode(y,r,a+1);r.state=t.CloseTag,I+=this.indent(i,r,a)+"</"+i.name+">",P&&r.suppressPrettyCount--,I+=this.endline(i,r,a),r.state=t.None}return this.closeNode(i,r,a),I},s.prototype.writeChildNode=function(i,r,a){switch(i.type){case o.CData:return this.cdata(i,r,a);case o.Comment:return this.comment(i,r,a);case o.Element:return this.element(i,r,a);case o.Raw:return this.raw(i,r,a);case o.Text:return this.text(i,r,a);case o.ProcessingInstruction:return this.processingInstruction(i,r,a);case o.Dummy:return"";case o.Declaration:return this.declaration(i,r,a);case o.DocType:return this.docType(i,r,a);case o.AttributeDeclaration:return this.dtdAttList(i,r,a);case o.ElementDeclaration:return this.dtdElement(i,r,a);case o.EntityDeclaration:return this.dtdEntity(i,r,a);case o.NotationDeclaration:return this.dtdNotation(i,r,a);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},s.prototype.processingInstruction=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<?",r.state=t.InsideTag,c+=i.target,i.value&&(c+=" "+i.value),r.state=t.CloseTag,c+=r.spaceBeforeSlash+"?>",c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.raw=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a),r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.text=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a),r.state=t.InsideTag,c+=i.value,r.state=t.CloseTag,c+=this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdAttList=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!ATTLIST",r.state=t.InsideTag,c+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(c+=" "+i.defaultValueType),i.defaultValue&&(c+=' "'+i.defaultValue+'"'),r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdElement=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!ELEMENT",r.state=t.InsideTag,c+=" "+i.name+" "+i.value,r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdEntity=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!ENTITY",r.state=t.InsideTag,i.pe&&(c+=" %"),c+=" "+i.name,i.value?c+=' "'+i.value+'"':(i.pubID&&i.sysID?c+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(c+=' SYSTEM "'+i.sysID+'"'),i.nData&&(c+=" NDATA "+i.nData)),r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.dtdNotation=function(i,r,a){var c;return this.openNode(i,r,a),r.state=t.OpenTag,c=this.indent(i,r,a)+"<!NOTATION",r.state=t.InsideTag,c+=" "+i.name,i.pubID&&i.sysID?c+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?c+=' PUBLIC "'+i.pubID+'"':i.sysID&&(c+=' SYSTEM "'+i.sysID+'"'),r.state=t.CloseTag,c+=r.spaceBeforeSlash+">"+this.endline(i,r,a),r.state=t.None,this.closeNode(i,r,a),c},s.prototype.openNode=function(i,r,a){},s.prototype.closeNode=function(i,r,a){},s.prototype.openAttribute=function(i,r,a){},s.prototype.closeAttribute=function(i,r,a){},s}()}.call(Z)),Nn.exports}var br;function si(){return br||(br=1,function(){var o,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;o=kr(),vn.exports=function(n){t(s,n);function s(i){s.__super__.constructor.call(this,i)}return s.prototype.document=function(i,r){var a,c,y,p,l;for(r=this.filterOptions(r),p="",l=i.children,c=0,y=l.length;c<y;c++)a=l[c],p+=this.writeChildNode(a,r,0);return r.pretty&&p.slice(-r.newline.length)===r.newline&&(p=p.slice(0,-r.newline.length)),p},s}(o)}.call(Z)),vn.exports}var wr;function Qr(){return wr||(wr=1,function(){var o,t,e,n,s,i,r,a=function(y,p){for(var l in p)c.call(p,l)&&(y[l]=p[l]);function h(){this.constructor=y}return h.prototype=p.prototype,y.prototype=new h,y.__super__=p.prototype,y},c={}.hasOwnProperty;r=$t().isPlainObject,e=zr(),t=_o(),n=Nt(),o=dt(),i=Kr(),s=si(),nn.exports=function(y){a(p,y);function p(l){p.__super__.constructor.call(this,null),this.name="#document",this.type=o.Document,this.documentURI=null,this.domConfig=new t,l||(l={}),l.writer||(l.writer=new s),this.options=l,this.stringify=new i(l)}return Object.defineProperty(p.prototype,"implementation",{value:new e}),Object.defineProperty(p.prototype,"doctype",{get:function(){var l,h,w,E;for(E=this.children,h=0,w=E.length;h<w;h++)if(l=E[h],l.type===o.DocType)return l;return null}}),Object.defineProperty(p.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(p.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(p.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(p.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===o.Declaration?this.children[0].encoding:null}}),Object.defineProperty(p.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===o.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(p.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===o.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(p.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(p.prototype,"origin",{get:function(){return null}}),Object.defineProperty(p.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(p.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(p.prototype,"contentType",{get:function(){return null}}),p.prototype.end=function(l){var h;return h={},l?r(l)&&(h=l,l=this.options.writer):l=this.options.writer,l.document(this,l.filterOptions(h))},p.prototype.toString=function(l){return this.options.writer.document(this,this.options.writer.filterOptions(l))},p.prototype.createElement=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createTextNode=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createComment=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createCDATASection=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createProcessingInstruction=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createAttribute=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createEntityReference=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.importNode=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createElementNS=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createAttributeNS=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementById=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.adoptNode=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.renameNode=function(l,h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByClassName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createEvent=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createNodeIterator=function(l,h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createTreeWalker=function(l,h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p}(n)}.call(Z)),nn.exports}var An={exports:{}},Or;function xo(){return Or||(Or=1,function(){var o,t,e,n,s,i,r,a,c,y,p,l,h,w,E,C,O,P,I,d,_,x,j,B={}.hasOwnProperty;j=$t(),_=j.isObject,d=j.isFunction,x=j.isPlainObject,I=j.getValue,o=dt(),l=Qr(),h=Gn(),n=Yn(),s=Kn(),E=ni(),P=ii(),w=ri(),y=kn(),p=ei(),i=Qn(),a=Jn(),r=Zn(),c=ti(),e=Gr(),O=Kr(),C=si(),t=Fe(),An.exports=function(){function S(D,b,N){var L;this.name="?xml",this.type=o.Document,D||(D={}),L={},D.writer?x(D.writer)&&(L=D.writer,D.writer=new C):D.writer=new C,this.options=D,this.writer=D.writer,this.writerOptions=this.writer.filterOptions(L),this.stringify=new O(D),this.onDataCallback=b||function(){},this.onEndCallback=N||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return S.prototype.createChildNode=function(D){var b,N,L,R,X,k,Y,H;switch(D.type){case o.CData:this.cdata(D.value);break;case o.Comment:this.comment(D.value);break;case o.Element:L={},Y=D.attribs;for(N in Y)B.call(Y,N)&&(b=Y[N],L[N]=b.value);this.node(D.name,L);break;case o.Dummy:this.dummy();break;case o.Raw:this.raw(D.value);break;case o.Text:this.text(D.value);break;case o.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(H=D.children,X=0,k=H.length;X<k;X++)R=H[X],this.createChildNode(R),R.type===o.Element&&this.up();return this},S.prototype.dummy=function(){return this},S.prototype.node=function(D,b,N){var L;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),_(b)||(L=[b,N],N=L[0],b=L[1]),this.currentNode=new h(this,D,b),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,N!=null&&this.text(N),this},S.prototype.element=function(D,b,N){var L,R,X,k,Y,H;if(this.currentNode&&this.currentNode.type===o.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(D)||_(D)||d(D))for(k=this.options.noValidation,this.options.noValidation=!0,H=new l(this.options).element("TEMP_ROOT"),H.element(D),this.options.noValidation=k,Y=H.children,R=0,X=Y.length;R<X;R++)L=Y[R],this.createChildNode(L),L.type===o.Element&&this.up();else this.node(D,b,N);return this},S.prototype.attribute=function(D,b){var N,L;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)),_(D))for(N in D)B.call(D,N)&&(L=D[N],this.attribute(N,L));else d(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},S.prototype.text=function(D){var b;return this.openCurrent(),b=new P(this,D),this.onData(this.writer.text(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.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},S.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},S.prototype.raw=function(D){var b;return this.openCurrent(),b=new E(this,D),this.onData(this.writer.raw(b,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.instruction=function(D,b){var N,L,R,X,k;if(this.openCurrent(),D!=null&&(D=I(D)),b!=null&&(b=I(b)),Array.isArray(D))for(N=0,X=D.length;N<X;N++)L=D[N],this.instruction(L);else if(_(D))for(L in D)B.call(D,L)&&(R=D[L],this.instruction(L,R));else d(b)&&(b=b.apply()),k=new w(this,D,b),this.onData(this.writer.processingInstruction(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},S.prototype.declaration=function(D,b,N){var L;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return L=new y(this,D,b,N),this.onData(this.writer.declaration(L,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.doctype=function(D,b,N){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 p(this,b,N),this.currentNode.rootNodeName=D,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},S.prototype.dtdElement=function(D,b){var N;return this.openCurrent(),N=new r(this,D,b),this.onData(this.writer.dtdElement(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.attList=function(D,b,N,L,R){var X;return this.openCurrent(),X=new i(this,D,b,N,L,R),this.onData(this.writer.dtdAttList(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.entity=function(D,b){var N;return this.openCurrent(),N=new a(this,!1,D,b),this.onData(this.writer.dtdEntity(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.pEntity=function(D,b){var N;return this.openCurrent(),N=new a(this,!0,D,b),this.onData(this.writer.dtdEntity(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.notation=function(D,b){var N;return this.openCurrent(),N=new c(this,D,b),this.onData(this.writer.dtdNotation(N,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.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},S.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},S.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},S.prototype.openNode=function(D){var b,N,L,R;if(!D.isOpen){if(!this.root&&this.currentLevel===0&&D.type===o.Element&&(this.root=D),N="",D.type===o.Element){this.writerOptions.state=t.OpenTag,N=this.writer.indent(D,this.writerOptions,this.currentLevel)+"<"+D.name,R=D.attribs;for(L in R)B.call(R,L)&&(b=R[L],N+=this.writer.attribute(b,this.writerOptions,this.currentLevel));N+=(D.children?">":"/>")+this.writer.endline(D,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,N=this.writer.indent(D,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+D.rootNodeName,D.pubID&&D.sysID?N+=' PUBLIC "'+D.pubID+'" "'+D.sysID+'"':D.sysID&&(N+=' SYSTEM "'+D.sysID+'"'),D.children?(N+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,N+=">"),N+=this.writer.endline(D,this.writerOptions,this.currentLevel);return this.onData(N,this.currentLevel),D.isOpen=!0}},S.prototype.closeNode=function(D){var b;if(!D.isClosed)return b="",this.writerOptions.state=t.CloseTag,D.type===o.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},S.prototype.onData=function(D,b){return this.documentStarted=!0,this.onDataCallback(D,b+1)},S.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},S.prototype.debugInfo=function(D){return D==null?"":"node: <"+D+">"},S.prototype.ele=function(){return this.element.apply(this,arguments)},S.prototype.nod=function(D,b,N){return this.node(D,b,N)},S.prototype.txt=function(D){return this.text(D)},S.prototype.dat=function(D){return this.cdata(D)},S.prototype.com=function(D){return this.comment(D)},S.prototype.ins=function(D,b){return this.instruction(D,b)},S.prototype.dec=function(D,b,N){return this.declaration(D,b,N)},S.prototype.dtd=function(D,b,N){return this.doctype(D,b,N)},S.prototype.e=function(D,b,N){return this.element(D,b,N)},S.prototype.n=function(D,b,N){return this.node(D,b,N)},S.prototype.t=function(D){return this.text(D)},S.prototype.d=function(D){return this.cdata(D)},S.prototype.c=function(D){return this.comment(D)},S.prototype.r=function(D){return this.raw(D)},S.prototype.i=function(D,b){return this.instruction(D,b)},S.prototype.att=function(){return this.currentNode&&this.currentNode.type===o.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.a=function(){return this.currentNode&&this.currentNode.type===o.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.ent=function(D,b){return this.entity(D,b)},S.prototype.pent=function(D,b){return this.pEntity(D,b)},S.prototype.not=function(D,b){return this.notation(D,b)},S}()}.call(Z)),An.exports}var Mn={exports:{}},Er;function vo(){return Er||(Er=1,function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;o=dt(),e=kr(),t=Fe(),Mn.exports=function(i){n(r,i);function r(a,c){this.stream=a,r.__super__.constructor.call(this,c)}return r.prototype.endline=function(a,c,y){return a.isLastRootNode&&c.state===t.CloseTag?"":r.__super__.endline.call(this,a,c,y)},r.prototype.document=function(a,c){var y,p,l,h,w,E,C,O,P;for(C=a.children,p=l=0,w=C.length;l<w;p=++l)y=C[p],y.isLastRootNode=p===a.children.length-1;for(c=this.filterOptions(c),O=a.children,P=[],h=0,E=O.length;h<E;h++)y=O[h],P.push(this.writeChildNode(y,c,0));return P},r.prototype.attribute=function(a,c,y){return this.stream.write(r.__super__.attribute.call(this,a,c,y))},r.prototype.cdata=function(a,c,y){return this.stream.write(r.__super__.cdata.call(this,a,c,y))},r.prototype.comment=function(a,c,y){return this.stream.write(r.__super__.comment.call(this,a,c,y))},r.prototype.declaration=function(a,c,y){return this.stream.write(r.__super__.declaration.call(this,a,c,y))},r.prototype.docType=function(a,c,y){var p,l,h,w;if(y||(y=0),this.openNode(a,c,y),c.state=t.OpenTag,this.stream.write(this.indent(a,c,y)),this.stream.write("<!DOCTYPE "+a.root().name),a.pubID&&a.sysID?this.stream.write(' PUBLIC "'+a.pubID+'" "'+a.sysID+'"'):a.sysID&&this.stream.write(' SYSTEM "'+a.sysID+'"'),a.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(a,c,y)),c.state=t.InsideTag,w=a.children,l=0,h=w.length;l<h;l++)p=w[l],this.writeChildNode(p,c,y+1);c.state=t.CloseTag,this.stream.write("]")}return c.state=t.CloseTag,this.stream.write(c.spaceBeforeSlash+">"),this.stream.write(this.endline(a,c,y)),c.state=t.None,this.closeNode(a,c,y)},r.prototype.element=function(a,c,y){var p,l,h,w,E,C,O,P,I;y||(y=0),this.openNode(a,c,y),c.state=t.OpenTag,this.stream.write(this.indent(a,c,y)+"<"+a.name),P=a.attribs;for(O in P)s.call(P,O)&&(p=P[O],this.attribute(p,c,y));if(h=a.children.length,w=h===0?null:a.children[0],h===0||a.children.every(function(d){return(d.type===o.Text||d.type===o.Raw)&&d.value===""}))c.allowEmpty?(this.stream.write(">"),c.state=t.CloseTag,this.stream.write("</"+a.name+">")):(c.state=t.CloseTag,this.stream.write(c.spaceBeforeSlash+"/>"));else if(c.pretty&&h===1&&(w.type===o.Text||w.type===o.Raw)&&w.value!=null)this.stream.write(">"),c.state=t.InsideTag,c.suppressPrettyCount++,this.writeChildNode(w,c,y+1),c.suppressPrettyCount--,c.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,c,y)),c.state=t.InsideTag,I=a.children,E=0,C=I.length;E<C;E++)l=I[E],this.writeChildNode(l,c,y+1);c.state=t.CloseTag,this.stream.write(this.indent(a,c,y)+"</"+a.name+">")}return this.stream.write(this.endline(a,c,y)),c.state=t.None,this.closeNode(a,c,y)},r.prototype.processingInstruction=function(a,c,y){return this.stream.write(r.__super__.processingInstruction.call(this,a,c,y))},r.prototype.raw=function(a,c,y){return this.stream.write(r.__super__.raw.call(this,a,c,y))},r.prototype.text=function(a,c,y){return this.stream.write(r.__super__.text.call(this,a,c,y))},r.prototype.dtdAttList=function(a,c,y){return this.stream.write(r.__super__.dtdAttList.call(this,a,c,y))},r.prototype.dtdElement=function(a,c,y){return this.stream.write(r.__super__.dtdElement.call(this,a,c,y))},r.prototype.dtdEntity=function(a,c,y){return this.stream.write(r.__super__.dtdEntity.call(this,a,c,y))},r.prototype.dtdNotation=function(a,c,y){return this.stream.write(r.__super__.dtdNotation.call(this,a,c,y))},r}(e)}.call(Z)),Mn.exports}var Dr;function No(){return Dr||(Dr=1,function(){var o,t,e,n,s,i,r,a,c,y;y=$t(),a=y.assign,c=y.isFunction,e=zr(),n=Qr(),s=xo(),r=si(),i=vo(),o=dt(),t=Fe(),Ut.create=function(p,l,h,w){var E,C;if(p==null)throw new Error("Root element needs a name.");return w=a({},l,h,w),E=new n(w),C=E.element(p),w.headless||(E.declaration(w),(w.pubID!=null||w.sysID!=null)&&E.dtd(w)),C},Ut.begin=function(p,l,h){var w;return c(p)&&(w=[p,l],l=w[0],h=w[1],p={}),l?new s(p,l,h):new n(p)},Ut.stringWriter=function(p){return new r(p)},Ut.streamWriter=function(p,l){return new i(p,l)},Ut.implementation=new e,Ut.nodeType=o,Ut.writerState=t}.call(Z)),Ut}var Cr;function Po(){return Cr||(Cr=1,function(){var o,t,e,n,s,i={}.hasOwnProperty;o=No(),t=Hn().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[>")},tn.Builder=function(){function r(a){var c,y,p;this.options={},y=t["0.2"];for(c in y)i.call(y,c)&&(p=y[c],this.options[c]=p);for(c in a)i.call(a,c)&&(p=a[c],this.options[c]=p)}return r.prototype.buildObject=function(a){var c,y,p,l,h;return c=this.options.attrkey,y=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===t["0.2"].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,p=function(w){return function(E,C){var O,P,I,d,_,x;if(typeof C!="object")w.options.cdata&&n(C)?E.raw(s(C)):E.txt(C);else if(Array.isArray(C)){for(d in C)if(i.call(C,d)){P=C[d];for(_ in P)I=P[_],E=p(E.ele(_),I).up()}}else for(_ in C)if(i.call(C,_))if(P=C[_],_===c){if(typeof P=="object")for(O in P)x=P[O],E=E.att(O,x)}else if(_===y)w.options.cdata&&n(P)?E=E.raw(s(P)):E=E.txt(P);else if(Array.isArray(P))for(d in P)i.call(P,d)&&(I=P[d],typeof I=="string"?w.options.cdata&&n(I)?E=E.ele(_).raw(s(I)).up():E=E.ele(_,I).up():E=p(E.ele(_),I).up());else typeof P=="object"?E=p(E.ele(_),P).up():typeof P=="string"&&w.options.cdata&&n(P)?E=E.ele(_).raw(s(P)).up():(P==null&&(P=""),E=E.ele(_,P.toString()).up());return E}}(this),l=o.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),p(l,a).end(this.options.renderOpts)},r}()}.call(Z)),tn}var Ln={},Sn={},_r;function Ao(){return _r||(_r=1,function(o){(function(t){t.parser=function(m,u){return new n(m,u)},t.SAXParser=n,t.SAXStream=l,t.createStream=y,t.MAX_BUFFER_LENGTH=64*1024;var e=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];t.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function n(m,u){if(!(this instanceof n))return new n(m,u);var A=this;i(A),A.q=A.c="",A.bufferCheckPosition=t.MAX_BUFFER_LENGTH,A.encoding=null,A.opt=u||{},A.opt.lowercase=A.opt.lowercase||A.opt.lowercasetags,A.looseCase=A.opt.lowercase?"toLowerCase":"toUpperCase",A.opt.maxEntityCount=A.opt.maxEntityCount||512,A.opt.maxEntityDepth=A.opt.maxEntityDepth||4,A.entityCount=A.entityDepth=0,A.tags=[],A.closed=A.closedRoot=A.sawRoot=!1,A.tag=A.error=null,A.strict=!!m,A.noscript=!!(m||A.opt.noscript),A.state=b.BEGIN,A.strictEntities=A.opt.strictEntities,A.ENTITIES=A.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),A.attribList=[],A.opt.xmlns&&(A.ns=Object.create(O)),A.opt.unquotedAttributeValues===void 0&&(A.opt.unquotedAttributeValues=!m),A.trackPosition=A.opt.position!==!1,A.trackPosition&&(A.position=A.line=A.column=0),L(A,"onready")}Object.create||(Object.create=function(m){function u(){}u.prototype=m;var A=new u;return A}),Object.keys||(Object.keys=function(m){var u=[];for(var A in m)m.hasOwnProperty(A)&&u.push(A);return u});function s(m){for(var u=Math.max(t.MAX_BUFFER_LENGTH,10),A=0,f=0,T=e.length;f<T;f++){var F=m[e[f]].length;if(F>u)switch(e[f]){case"textNode":at(m);break;case"cdata":H(m,"oncdata",m.cdata),m.cdata="";break;case"script":H(m,"onscript",m.script),m.script="";break;default:nt(m,"Max buffer length exceeded: "+e[f])}A=Math.max(A,F)}var M=t.MAX_BUFFER_LENGTH-A;m.bufferCheckPosition=M+m.position}function i(m){for(var u=0,A=e.length;u<A;u++)m[e[u]]=""}function r(m){at(m),m.cdata!==""&&(H(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(H(m,"onscript",m.script),m.script="")}n.prototype={end:function(){Ct(this)},write:ut,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){r(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var c=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function y(m,u){return new l(m,u)}function p(m,u){if(m.length>=2){if(m[0]===255&&m[1]===254)return"utf-16le";if(m[0]===254&&m[1]===255)return"utf-16be"}return m.length>=3&&m[0]===239&&m[1]===187&&m[2]===191?"utf8":m.length>=4?m[0]===60&&m[1]===0&&m[2]===63&&m[3]===0?"utf-16le":m[0]===0&&m[1]===60&&m[2]===0&&m[3]===63?"utf-16be":"utf8":u?"utf8":null}function l(m,u){if(!(this instanceof l))return new l(m,u);a.apply(this),this._parser=new n(m,u),this.writable=!0,this.readable=!0;var A=this;this._parser.onend=function(){A.emit("end")},this._parser.onerror=function(f){A.emit("error",f),A._parser.error=null},this._decoder=null,this._decoderBuffer=null,c.forEach(function(f){Object.defineProperty(A,"on"+f,{get:function(){return A._parser["on"+f]},set:function(T){if(!T)return A.removeAllListeners(f),A._parser["on"+f]=T,T;A.on(f,T)},enumerable:!0,configurable:!1})})}l.prototype=Object.create(a.prototype,{constructor:{value:l}}),l.prototype._decodeBuffer=function(m,u){if(this._decoderBuffer&&(m=Buffer.concat([this._decoderBuffer,m]),this._decoderBuffer=null),!this._decoder){var A=p(m,u);if(!A)return this._decoderBuffer=m,"";this._parser.encoding=A,this._decoder=new TextDecoder(A)}return this._decoder.decode(m,{stream:!u})},l.prototype.write=function(m){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m))m=this._decodeBuffer(m,!1);else if(this._decoderBuffer){var u=this._decodeBuffer(Buffer.alloc(0),!0);u&&(this._parser.write(u),this.emit("data",u))}return this._parser.write(m.toString()),this.emit("data",m),!0},l.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoderBuffer){var u=this._decodeBuffer(Buffer.alloc(0),!0);u&&(this._parser.write(u),this.emit("data",u))}else if(this._decoder){var A=this._decoder.decode();A&&(this._parser.write(A),this.emit("data",A))}return this._parser.end(),!0},l.prototype.on=function(m,u){var A=this;return!A._parser["on"+m]&&c.indexOf(m)!==-1&&(A._parser["on"+m]=function(){var f=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);f.splice(0,0,m),A.emit.apply(A,f)}),a.prototype.on.call(A,m,u)};var h="[CDATA[",w="DOCTYPE",E="http://www.w3.org/XML/1998/namespace",C="http://www.w3.org/2000/xmlns/",O={xml:E,xmlns:C},P=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,I=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,d=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function x(m){return m===" "||m===`
93
+ `||m==="\r"||m===" "}function j(m){return m==='"'||m==="'"}function B(m){return m===">"||x(m)}function S(m,u){return m.test(u)}function D(m,u){return!S(m,u)}var b=0;t.STATE={BEGIN:b++,BEGIN_WHITESPACE:b++,TEXT:b++,TEXT_ENTITY:b++,OPEN_WAKA:b++,SGML_DECL:b++,SGML_DECL_QUOTED:b++,DOCTYPE:b++,DOCTYPE_QUOTED:b++,DOCTYPE_DTD:b++,DOCTYPE_DTD_QUOTED:b++,COMMENT_STARTING:b++,COMMENT:b++,COMMENT_ENDING:b++,COMMENT_ENDED:b++,CDATA:b++,CDATA_ENDING:b++,CDATA_ENDING_2:b++,PROC_INST:b++,PROC_INST_BODY:b++,PROC_INST_ENDING:b++,OPEN_TAG:b++,OPEN_TAG_SLASH:b++,ATTRIB:b++,ATTRIB_NAME:b++,ATTRIB_NAME_SAW_WHITE:b++,ATTRIB_VALUE:b++,ATTRIB_VALUE_QUOTED:b++,ATTRIB_VALUE_CLOSED:b++,ATTRIB_VALUE_UNQUOTED:b++,ATTRIB_VALUE_ENTITY_Q:b++,ATTRIB_VALUE_ENTITY_U:b++,CLOSE_TAG:b++,CLOSE_TAG_SAW_WHITE:b++,SCRIPT:b++,SCRIPT_ENDING:b++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var u=t.ENTITIES[m],A=typeof u=="number"?String.fromCharCode(u):u;t.ENTITIES[m]=A});for(var N in t.STATE)t.STATE[t.STATE[N]]=N;b=t.STATE;function L(m,u,A){m[u]&&m[u](A)}function R(m){var u=m&&m.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);return u?u[2]:null}function X(m){return m?m.toLowerCase().replace(/[^a-z0-9]/g,""):null}function k(m,u){const A=X(m),f=X(u);return!A||!f?!0:f==="utf16"?A==="utf16le"||A==="utf16be":A===f}function Y(m,u){if(!(!m.strict||!m.encoding||!u||u.name!=="xml")){var A=R(u.body);A&&!k(m.encoding,A)&&tt(m,"XML declaration encoding "+A+" does not match detected stream encoding "+m.encoding.toUpperCase())}}function H(m,u,A){m.textNode&&at(m),L(m,u,A)}function at(m){m.textNode=Lt(m.opt,m.textNode),m.textNode&&L(m,"ontext",m.textNode),m.textNode=""}function Lt(m,u){return m.trim&&(u=u.trim()),m.normalize&&(u=u.replace(/\s+/g," ")),u}function nt(m,u){return at(m),m.trackPosition&&(u+=`
94
+ Line: `+m.line+`
95
+ Column: `+m.column+`
96
+ Char: `+m.c),u=new Error(u),m.error=u,L(m,"onerror",u),m}function Ct(m){return m.sawRoot&&!m.closedRoot&&tt(m,"Unclosed root tag"),m.state!==b.BEGIN&&m.state!==b.BEGIN_WHITESPACE&&m.state!==b.TEXT&&nt(m,"Unexpected end"),at(m),m.c="",m.closed=!0,L(m,"onend"),n.call(m,m.strict,m.opt),m}function tt(m,u){if(typeof m!="object"||!(m instanceof n))throw new Error("bad call to strictFail");m.strict&&nt(m,u)}function Rt(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var u=m.tags[m.tags.length-1]||m,A=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(A.ns=u.ns),m.attribList.length=0,H(m,"onopentagstart",A)}function K(m,u){var A=m.indexOf(":"),f=A<0?["",m]:m.split(":"),T=f[0],F=f[1];return u&&m==="xmlns"&&(T="xmlns",F=""),{prefix:T,local:F}}function Ht(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var u=K(m.attribName,!0),A=u.prefix,f=u.local;if(A==="xmlns")if(f==="xml"&&m.attribValue!==E)tt(m,"xml: prefix must be bound to "+E+`
97
+ Actual: `+m.attribValue);else if(f==="xmlns"&&m.attribValue!==C)tt(m,"xmlns: prefix must be bound to "+C+`
98
+ Actual: `+m.attribValue);else{var T=m.tag,F=m.tags[m.tags.length-1]||m;T.ns===F.ns&&(T.ns=Object.create(F.ns)),T.ns[f]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,H(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function z(m,u){if(m.opt.xmlns){var A=m.tag,f=K(m.tagName);A.prefix=f.prefix,A.local=f.local,A.uri=A.ns[f.prefix]||"",A.prefix&&!A.uri&&(tt(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),A.uri=f.prefix);var T=m.tags[m.tags.length-1]||m;A.ns&&T.ns!==A.ns&&Object.keys(A.ns).forEach(function(ai){H(m,"onopennamespace",{prefix:ai,uri:A.ns[ai]})});for(var F=0,M=m.attribList.length;F<M;F++){var v=m.attribList[F],$=v[0],U=v[1],q=K($,!0),rt=q.prefix,gt=q.local,oi=rt===""?"":A.ns[rt]||"",Re={name:$,value:U,prefix:rt,local:gt,uri:oi};rt&&rt!=="xmlns"&&!oi&&(tt(m,"Unbound namespace prefix: "+JSON.stringify(rt)),Re.uri=rt),m.tag.attributes[$]=Re,H(m,"onattribute",Re)}m.attribList.length=0}m.tag.isSelfClosing=!!u,m.sawRoot=!0,m.tags.push(m.tag),H(m,"onopentag",m.tag),u||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=b.SCRIPT:m.state=b.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function it(m){if(!m.tagName){tt(m,"Weird empty close tag."),m.textNode+="</>",m.state=b.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=b.SCRIPT;return}H(m,"onscript",m.script),m.script=""}var u=m.tags.length,A=m.tagName;m.strict||(A=A[m.looseCase]());for(var f=A;u--;){var T=m.tags[u];if(T.name!==f)tt(m,"Unexpected close tag");else break}if(u<0){tt(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=b.TEXT;return}m.tagName=A;for(var F=m.tags.length;F-- >u;){var M=m.tag=m.tags.pop();m.tagName=m.tag.name,H(m,"onclosetag",m.tagName);var v={};for(var $ in M.ns)v[$]=M.ns[$];var U=m.tags[m.tags.length-1]||m;m.opt.xmlns&&M.ns!==U.ns&&Object.keys(M.ns).forEach(function(q){var rt=M.ns[q];H(m,"onclosenamespace",{prefix:q,uri:rt})})}u===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=b.TEXT}function ct(m){var u=m.entity,A=u.toLowerCase(),f,T="";return m.ENTITIES[u]?m.ENTITIES[u]:m.ENTITIES[A]?m.ENTITIES[A]:(u=A,u.charAt(0)==="#"&&(u.charAt(1)==="x"?(u=u.slice(2),f=parseInt(u,16),T=f.toString(16)):(u=u.slice(1),f=parseInt(u,10),T=f.toString(10))),u=u.replace(/^0+/,""),isNaN(f)||T.toLowerCase()!==u||f<0||f>1114111?(tt(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(f))}function et(m,u){u==="<"?(m.state=b.OPEN_WAKA,m.startTagPosition=m.position):x(u)||(tt(m,"Non-whitespace before first tag."),m.textNode=u,m.state=b.TEXT)}function ot(m,u){var A="";return u<m.length&&(A=m.charAt(u)),A}function ut(m){var u=this;if(this.error)throw this.error;if(u.closed)return nt(u,"Cannot write after close. Assign an onready handler.");if(m===null)return Ct(u);typeof m=="object"&&(m=m.toString());for(var A=0,f="";f=ot(m,A++),u.c=f,!!f;)switch(u.trackPosition&&(u.position++,f===`
99
+ `?(u.line++,u.column=0):u.column++),u.state){case b.BEGIN:if(u.state=b.BEGIN_WHITESPACE,f==="\uFEFF")continue;et(u,f);continue;case b.BEGIN_WHITESPACE:et(u,f);continue;case b.TEXT:if(u.sawRoot&&!u.closedRoot){for(var F=A-1;f&&f!=="<"&&f!=="&";)f=ot(m,A++),f&&u.trackPosition&&(u.position++,f===`
100
+ `?(u.line++,u.column=0):u.column++);u.textNode+=m.substring(F,A-1)}f==="<"&&!(u.sawRoot&&u.closedRoot&&!u.strict)?(u.state=b.OPEN_WAKA,u.startTagPosition=u.position):(!x(f)&&(!u.sawRoot||u.closedRoot)&&tt(u,"Text data outside of root node."),f==="&"?u.state=b.TEXT_ENTITY:u.textNode+=f);continue;case b.SCRIPT:f==="<"?u.state=b.SCRIPT_ENDING:u.script+=f;continue;case b.SCRIPT_ENDING:f==="/"?u.state=b.CLOSE_TAG:(u.script+="<"+f,u.state=b.SCRIPT);continue;case b.OPEN_WAKA:if(f==="!")u.state=b.SGML_DECL,u.sgmlDecl="";else if(!x(f))if(S(P,f))u.state=b.OPEN_TAG,u.tagName=f;else if(f==="/")u.state=b.CLOSE_TAG,u.tagName="";else if(f==="?")u.state=b.PROC_INST,u.procInstName=u.procInstBody="";else{if(tt(u,"Unencoded <"),u.startTagPosition+1<u.position){var T=u.position-u.startTagPosition;f=new Array(T).join(" ")+f}u.textNode+="<"+f,u.state=b.TEXT}continue;case b.SGML_DECL:if(u.sgmlDecl+f==="--"){u.state=b.COMMENT,u.comment="",u.sgmlDecl="";continue}u.doctype&&u.doctype!==!0&&u.sgmlDecl?(u.state=b.DOCTYPE_DTD,u.doctype+="<!"+u.sgmlDecl+f,u.sgmlDecl=""):(u.sgmlDecl+f).toUpperCase()===h?(H(u,"onopencdata"),u.state=b.CDATA,u.sgmlDecl="",u.cdata=""):(u.sgmlDecl+f).toUpperCase()===w?(u.state=b.DOCTYPE,(u.doctype||u.sawRoot)&&tt(u,"Inappropriately located doctype declaration"),u.doctype="",u.sgmlDecl=""):f===">"?(H(u,"onsgmldeclaration",u.sgmlDecl),u.sgmlDecl="",u.state=b.TEXT):(j(f)&&(u.state=b.SGML_DECL_QUOTED),u.sgmlDecl+=f);continue;case b.SGML_DECL_QUOTED:f===u.q&&(u.state=b.SGML_DECL,u.q=""),u.sgmlDecl+=f;continue;case b.DOCTYPE:f===">"?(u.state=b.TEXT,H(u,"ondoctype",u.doctype),u.doctype=!0):(u.doctype+=f,f==="["?u.state=b.DOCTYPE_DTD:j(f)&&(u.state=b.DOCTYPE_QUOTED,u.q=f));continue;case b.DOCTYPE_QUOTED:u.doctype+=f,f===u.q&&(u.q="",u.state=b.DOCTYPE);continue;case b.DOCTYPE_DTD:f==="]"?(u.doctype+=f,u.state=b.DOCTYPE):f==="<"?(u.state=b.OPEN_WAKA,u.startTagPosition=u.position):j(f)?(u.doctype+=f,u.state=b.DOCTYPE_DTD_QUOTED,u.q=f):u.doctype+=f;continue;case b.DOCTYPE_DTD_QUOTED:u.doctype+=f,f===u.q&&(u.state=b.DOCTYPE_DTD,u.q="");continue;case b.COMMENT:f==="-"?u.state=b.COMMENT_ENDING:u.comment+=f;continue;case b.COMMENT_ENDING:f==="-"?(u.state=b.COMMENT_ENDED,u.comment=Lt(u.opt,u.comment),u.comment&&H(u,"oncomment",u.comment),u.comment=""):(u.comment+="-"+f,u.state=b.COMMENT);continue;case b.COMMENT_ENDED:f!==">"?(tt(u,"Malformed comment"),u.comment+="--"+f,u.state=b.COMMENT):u.doctype&&u.doctype!==!0?u.state=b.DOCTYPE_DTD:u.state=b.TEXT;continue;case b.CDATA:for(var F=A-1;f&&f!=="]";)f=ot(m,A++),f&&u.trackPosition&&(u.position++,f===`
101
+ `?(u.line++,u.column=0):u.column++);u.cdata+=m.substring(F,A-1),f==="]"&&(u.state=b.CDATA_ENDING);continue;case b.CDATA_ENDING:f==="]"?u.state=b.CDATA_ENDING_2:(u.cdata+="]"+f,u.state=b.CDATA);continue;case b.CDATA_ENDING_2:f===">"?(u.cdata&&H(u,"oncdata",u.cdata),H(u,"onclosecdata"),u.cdata="",u.state=b.TEXT):f==="]"?u.cdata+="]":(u.cdata+="]]"+f,u.state=b.CDATA);continue;case b.PROC_INST:f==="?"?u.state=b.PROC_INST_ENDING:x(f)?u.state=b.PROC_INST_BODY:u.procInstName+=f;continue;case b.PROC_INST_BODY:if(!u.procInstBody&&x(f))continue;f==="?"?u.state=b.PROC_INST_ENDING:u.procInstBody+=f;continue;case b.PROC_INST_ENDING:if(f===">"){const U={name:u.procInstName,body:u.procInstBody};Y(u,U),H(u,"onprocessinginstruction",U),u.procInstName=u.procInstBody="",u.state=b.TEXT}else u.procInstBody+="?"+f,u.state=b.PROC_INST_BODY;continue;case b.OPEN_TAG:S(I,f)?u.tagName+=f:(Rt(u),f===">"?z(u):f==="/"?u.state=b.OPEN_TAG_SLASH:(x(f)||tt(u,"Invalid character in tag name"),u.state=b.ATTRIB));continue;case b.OPEN_TAG_SLASH:f===">"?(z(u,!0),it(u)):(tt(u,"Forward-slash in opening tag not followed by >"),u.state=b.ATTRIB);continue;case b.ATTRIB:if(x(f))continue;f===">"?z(u):f==="/"?u.state=b.OPEN_TAG_SLASH:S(P,f)?(u.attribName=f,u.attribValue="",u.state=b.ATTRIB_NAME):tt(u,"Invalid attribute name");continue;case b.ATTRIB_NAME:f==="="?u.state=b.ATTRIB_VALUE:f===">"?(tt(u,"Attribute without value"),u.attribValue=u.attribName,Ht(u),z(u)):x(f)?u.state=b.ATTRIB_NAME_SAW_WHITE:S(I,f)?u.attribName+=f:tt(u,"Invalid attribute name");continue;case b.ATTRIB_NAME_SAW_WHITE:if(f==="=")u.state=b.ATTRIB_VALUE;else{if(x(f))continue;tt(u,"Attribute without value"),u.tag.attributes[u.attribName]="",u.attribValue="",H(u,"onattribute",{name:u.attribName,value:""}),u.attribName="",f===">"?z(u):S(P,f)?(u.attribName=f,u.state=b.ATTRIB_NAME):(tt(u,"Invalid attribute name"),u.state=b.ATTRIB)}continue;case b.ATTRIB_VALUE:if(x(f))continue;j(f)?(u.q=f,u.state=b.ATTRIB_VALUE_QUOTED):(u.opt.unquotedAttributeValues||nt(u,"Unquoted attribute value"),u.state=b.ATTRIB_VALUE_UNQUOTED,u.attribValue=f);continue;case b.ATTRIB_VALUE_QUOTED:if(f!==u.q){f==="&"?u.state=b.ATTRIB_VALUE_ENTITY_Q:u.attribValue+=f;continue}Ht(u),u.q="",u.state=b.ATTRIB_VALUE_CLOSED;continue;case b.ATTRIB_VALUE_CLOSED:x(f)?u.state=b.ATTRIB:f===">"?z(u):f==="/"?u.state=b.OPEN_TAG_SLASH:S(P,f)?(tt(u,"No whitespace between attributes"),u.attribName=f,u.attribValue="",u.state=b.ATTRIB_NAME):tt(u,"Invalid attribute name");continue;case b.ATTRIB_VALUE_UNQUOTED:if(!B(f)){f==="&"?u.state=b.ATTRIB_VALUE_ENTITY_U:u.attribValue+=f;continue}Ht(u),f===">"?z(u):u.state=b.ATTRIB;continue;case b.CLOSE_TAG:if(u.tagName)f===">"?it(u):S(I,f)?u.tagName+=f:u.script?(u.script+="</"+u.tagName+f,u.tagName="",u.state=b.SCRIPT):(x(f)||tt(u,"Invalid tagname in closing tag"),u.state=b.CLOSE_TAG_SAW_WHITE);else{if(x(f))continue;D(P,f)?u.script?(u.script+="</"+f,u.state=b.SCRIPT):tt(u,"Invalid tagname in closing tag."):u.tagName=f}continue;case b.CLOSE_TAG_SAW_WHITE:if(x(f))continue;f===">"?it(u):tt(u,"Invalid characters in closing tag");continue;case b.TEXT_ENTITY:case b.ATTRIB_VALUE_ENTITY_Q:case b.ATTRIB_VALUE_ENTITY_U:var M,v;switch(u.state){case b.TEXT_ENTITY:M=b.TEXT,v="textNode";break;case b.ATTRIB_VALUE_ENTITY_Q:M=b.ATTRIB_VALUE_QUOTED,v="attribValue";break;case b.ATTRIB_VALUE_ENTITY_U:M=b.ATTRIB_VALUE_UNQUOTED,v="attribValue";break}if(f===";"){var $=ct(u);u.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes($)?((u.entityCount+=1)>u.opt.maxEntityCount&&nt(u,"Parsed entity count exceeds max entity count"),(u.entityDepth+=1)>u.opt.maxEntityDepth&&nt(u,"Parsed entity depth exceeds max entity depth"),u.entity="",u.state=M,u.write($),u.entityDepth-=1):(u[v]+=$,u.entity="",u.state=M)}else S(u.entity.length?_:d,f)?u.entity+=f:(tt(u,"Invalid character in entity name"),u[v]+="&"+u.entity+f,u.entity="",u.state=M);continue;default:throw new Error(u,"Unknown state: "+u.state)}return u.position>=u.bufferCheckPosition&&s(u),u}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,u=Math.floor,A=function(){var f=16384,T=[],F,M,v=-1,$=arguments.length;if(!$)return"";for(var U="";++v<$;){var q=Number(arguments[v]);if(!isFinite(q)||q<0||q>1114111||u(q)!==q)throw RangeError("Invalid code point: "+q);q<=65535?T.push(q):(q-=65536,F=(q>>10)+55296,M=q%1024+56320,T.push(F,M)),(v+1===$||T.length>f)&&(U+=m.apply(null,T),T.length=0)}return U};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:A,configurable:!0,writable:!0}):String.fromCodePoint=A}()})(o)}(Sn)),Sn}var jn={},Ir;function Mo(){return Ir||(Ir=1,function(){jn.stripBOM=function(o){return o[0]==="\uFEFF"?o.substring(1):o}}.call(Z)),jn}var ne={},Tr;function Jr(){return Tr||(Tr=1,function(){var o;o=new RegExp(/(?!xmlns)^.*:/),ne.normalize=function(t){return t.toLowerCase()},ne.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},ne.stripPrefix=function(t){return t.replace(o,"")},ne.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},ne.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(Z)),ne}var xr;function Lo(){return xr||(xr=1,function(o){(function(){var t,e,n,s,i,r,a,c,y,p=function(w,E){return function(){return w.apply(E,arguments)}},l=function(w,E){for(var C in E)h.call(E,C)&&(w[C]=E[C]);function O(){this.constructor=w}return O.prototype=E.prototype,w.prototype=new O,w.__super__=E.prototype,w},h={}.hasOwnProperty;c=Ao(),s=Wn,t=Mo(),a=Jr(),y=as.setImmediate,e=Hn().defaults,i=function(w){return typeof w=="object"&&w!=null&&Object.keys(w).length===0},r=function(w,E,C){var O,P,I;for(O=0,P=w.length;O<P;O++)I=w[O],E=I(E,C);return E},n=function(w,E,C){var O;return O=Object.create(null),O.value=C,O.writable=!0,O.enumerable=!0,O.configurable=!0,Object.defineProperty(w,E,O)},o.Parser=function(w){l(E,w);function E(C){this.parseStringPromise=p(this.parseStringPromise,this),this.parseString=p(this.parseString,this),this.reset=p(this.reset,this),this.assignOrPush=p(this.assignOrPush,this),this.processAsync=p(this.processAsync,this);var O,P,I;if(!(this instanceof o.Parser))return new o.Parser(C);this.options={},P=e["0.2"];for(O in P)h.call(P,O)&&(I=P[O],this.options[O]=I);for(O in C)h.call(C,O)&&(I=C[O],this.options[O]=I);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return E.prototype.processAsync=function(){var C,O;try{return this.remaining.length<=this.options.chunkSize?(C=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(C),this.saxParser.close()):(C=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(C),y(this.processAsync))}catch(P){if(O=P,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(O)}},E.prototype.assignOrPush=function(C,O,P){return O in C?(C[O]instanceof Array||n(C,O,[C[O]]),C[O].push(P)):this.options.explicitArray?n(C,O,[P]):n(C,O,P)},E.prototype.reset=function(){var C,O,P,I;return this.removeAllListeners(),this.saxParser=c.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(d){return function(_){if(d.saxParser.resume(),!d.saxParser.errThrown)return d.saxParser.errThrown=!0,d.emit("error",_)}}(this),this.saxParser.onend=function(d){return function(){if(!d.saxParser.ended)return d.saxParser.ended=!0,d.emit("end",d.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,I=[],C=this.options.attrkey,O=this.options.charkey,this.saxParser.onopentag=function(d){return function(_){var x,j,B,S,D;if(B={},B[O]="",!d.options.ignoreAttrs){D=_.attributes;for(x in D)h.call(D,x)&&(!(C in B)&&!d.options.mergeAttrs&&(B[C]={}),j=d.options.attrValueProcessors?r(d.options.attrValueProcessors,_.attributes[x],x):_.attributes[x],S=d.options.attrNameProcessors?r(d.options.attrNameProcessors,x):x,d.options.mergeAttrs?d.assignOrPush(B,S,j):n(B[C],S,j))}return B["#name"]=d.options.tagNameProcessors?r(d.options.tagNameProcessors,_.name):_.name,d.options.xmlns&&(B[d.options.xmlnskey]={uri:_.uri,local:_.local}),I.push(B)}}(this),this.saxParser.onclosetag=function(d){return function(){var _,x,j,B,S,D,b,N,L,R;if(D=I.pop(),S=D["#name"],(!d.options.explicitChildren||!d.options.preserveChildrenOrder)&&delete D["#name"],D.cdata===!0&&(_=D.cdata,delete D.cdata),L=I[I.length-1],D[O].match(/^\s*$/)&&!_?(x=D[O],delete D[O]):(d.options.trim&&(D[O]=D[O].trim()),d.options.normalize&&(D[O]=D[O].replace(/\s{2,}/g," ").trim()),D[O]=d.options.valueProcessors?r(d.options.valueProcessors,D[O],S):D[O],Object.keys(D).length===1&&O in D&&!d.EXPLICIT_CHARKEY&&(D=D[O])),i(D)&&(typeof d.options.emptyTag=="function"?D=d.options.emptyTag():D=d.options.emptyTag!==""?d.options.emptyTag:x),d.options.validator!=null&&(R="/"+function(){var X,k,Y;for(Y=[],X=0,k=I.length;X<k;X++)B=I[X],Y.push(B["#name"]);return Y}().concat(S).join("/"),function(){var X;try{return D=d.options.validator(R,L&&L[S],D)}catch(k){return X=k,d.emit("error",X)}}()),d.options.explicitChildren&&!d.options.mergeAttrs&&typeof D=="object"){if(!d.options.preserveChildrenOrder)B={},d.options.attrkey in D&&(B[d.options.attrkey]=D[d.options.attrkey],delete D[d.options.attrkey]),!d.options.charsAsChildren&&d.options.charkey in D&&(B[d.options.charkey]=D[d.options.charkey],delete D[d.options.charkey]),Object.getOwnPropertyNames(D).length>0&&(B[d.options.childkey]=D),D=B;else if(L){L[d.options.childkey]=L[d.options.childkey]||[],b={};for(j in D)h.call(D,j)&&n(b,j,D[j]);L[d.options.childkey].push(b),delete D["#name"],Object.keys(D).length===1&&O in D&&!d.EXPLICIT_CHARKEY&&(D=D[O])}}return I.length>0?d.assignOrPush(L,S,D):(d.options.explicitRoot&&(N=D,D={},n(D,S,N)),d.resultObject=D,d.saxParser.ended=!0,d.emit("end",d.resultObject))}}(this),P=function(d){return function(_){var x,j;if(j=I[I.length-1],j)return j[O]+=_,d.options.explicitChildren&&d.options.preserveChildrenOrder&&d.options.charsAsChildren&&(d.options.includeWhiteChars||_.replace(/\\n/g,"").trim()!=="")&&(j[d.options.childkey]=j[d.options.childkey]||[],x={"#name":"__text__"},x[O]=_,d.options.normalize&&(x[O]=x[O].replace(/\s{2,}/g," ").trim()),j[d.options.childkey].push(x)),j}}(this),this.saxParser.ontext=P,this.saxParser.oncdata=function(d){return function(_){var x;if(x=P(_),x)return x.cdata=!0}}()},E.prototype.parseString=function(C,O){var P;O!=null&&typeof O=="function"&&(this.on("end",function(I){return this.reset(),O(null,I)}),this.on("error",function(I){return this.reset(),O(I)}));try{return C=C.toString(),C.trim()===""?(this.emit("end",null),!0):(C=t.stripBOM(C),this.options.async?(this.remaining=C,y(this.processAsync),this.saxParser):this.saxParser.write(C).close())}catch(I){if(P=I,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw P}else return this.emit("error",P),this.saxParser.errThrown=!0}},E.prototype.parseStringPromise=function(C){return new Promise(function(O){return function(P,I){return O.parseString(C,function(d,_){return d?I(d):P(_)})}}(this))},E}(s),o.parseString=function(w,E,C){var O,P,I;return C!=null?(typeof C=="function"&&(O=C),typeof E=="object"&&(P=E)):(typeof E=="function"&&(O=E),P={}),I=new o.Parser(P),I.parseString(w,O)},o.parseStringPromise=function(w,E){var C,O;return typeof E=="object"&&(C=E),O=new o.Parser(C),O.parseStringPromise(w)}}).call(Z)}(Ln)),Ln}var Zr;(function(){var o,t,e,n=function(i,r){for(var a in r)s.call(r,a)&&(i[a]=r[a]);function c(){this.constructor=i}return c.prototype=r.prototype,i.prototype=new c,i.__super__=r.prototype,i},s={}.hasOwnProperty;t=Hn(),o=Po(),e=Lo(),Jr(),t.defaults,function(i){n(r,i);function r(a){this.message=a}return r}(Error),o.Builder,e.Parser,e.parseString,Zr=e.parseStringPromise}).call(Z);class ts{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 Zr(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! 🎉
102
+ ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
103
+
104
+ 1. Add breakpoints in your files to start step debugging.
105
+
106
+ 2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
107
+
108
+ 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);try{const i=await this.readPHPFile(t),r=i.split(`
109
+ `),a=r.map((l,h)=>h===0?"AAAA":"AACA").join(";"),c={version:3,file:s,sources:[n],sourcesContent:[i],mappings:a},p=`data:application/json;base64,${Buffer.from(JSON.stringify(c),"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:p}})}catch(i){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:i.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let e=this.scriptIdByUrl.get(t);return e||(e=os.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:a,lineNumber:c}=s;if(!a){r=!1;break}const y=this.uriFromCDPToBridge(a),p=this.uriFromBridgeToDBGP(y),l=(typeof c=="number"?c:0)+1,h=String(this.breakpoints.size+1);if(this.xdebugConnected){const w=`breakpoint_set -t line -f ${this.formatPropertyFullName(p)} -n ${l}`,E=this.sendDbgpCommand(w);this.pendingCommands.set(E,{cdpId:e,cdpMethod:n,params:{breakpointId:h,fileUri:y,lineNumber:l}}),r=!1}else this.breakpoints.set(h,{cdpId:h,xdebugId:null,fileUri:y,lineNumber:l}),i={breakpointId:h,locations:[{scriptId:this.getOrCreateScriptId(y),lineNumber:l-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=s,c=String(a),y=this.breakpoints.get(c);if(y){if(y.xdebugId&&this.xdebugConnected){const p=`breakpoint_remove -d ${y.xdebugId}`,l=this.sendDbgpCommand(p);this.pendingCommands.set(l,{cdpId:e,cdpMethod:n}),r=!1}this.breakpoints.delete(c)}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 a=s.expression||"",c=s.callFrameId;if(n==="Debugger.evaluateOnCallFrame"){if(c===void 0||!this.callFramesMap.has(c)){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(c)!==0){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const y=Buffer.from(a).toString("base64"),p=this.sendDbgpCommand("eval",`-- ${y}`);this.pendingCommands.set(p,{cdpId:e,cdpMethod:n}),r=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:a}=s,c=this.objectHandles.get(a);if(c&&this.xdebugConnected)if(c.type==="context"){const y=c.contextId??0,l=`context_get -d ${c.depth} -c ${y} -p 0 -m 32`,h=this.sendDbgpCommand(l),w={...c,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,w),this.pendingCommands.set(h,{cdpId:e,cdpMethod:n,params:{objectId:a}}),r=!1}else if(c.type==="property"){const y=c.depth,p=c.fullname,l=this.formatPropertyFullName(p),h=`property_get -d ${y} -n ${l} -p 0 -m 32`,w=this.sendDbgpCommand(h),E={...c,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,E),this.pendingCommands.set(w,{cdpId:e,cdpMethod:n,params:{parentObjectId:a}}),r=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const a=s.scriptId,c=[...this.scriptIdByUrl.entries()].find(([,p])=>p===a)?.[0],y=[];c&&y.push(`Here's the full path for your convenience:
110
+ `,`${this.uriFromBridgeToCDPSyntaxHighlight(c).replace("file://","")}
111
+ `),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...y,"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:
112
+ `,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
113
+ `)};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 bt.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 a=n.id,c=r.params;if(c){const{breakpointId:y,fileUri:p,lineNumber:l}=c;this.breakpoints.set(y,{cdpId:y,xdebugId:a,fileUri:p,lineNumber:l});const h=this.getOrCreateScriptId(p),w={breakpointId:y,locations:[{scriptId:h,lineNumber:l-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 a=n.status;if(e["xdebug:message"]){const c=this.uriFromDBGPToBridge(e["xdebug:message"].$.filename);c&&!this.scriptIdByUrl.has(c)&&await this.sendScriptToCDP(c,this.getOrCreateScriptId(c))}if(a==="break"){const c=this.sendDbgpCommand("stack_get");this.pendingCommands.set(c,{}),this.pendingCommands.delete(i)}else(a==="stopping"||a==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(r&&r.cdpId!==void 0){let a;if(e.property){const y=e.property,p=y.$.type,l=y.$.encoding;let h=null;if(Object.prototype.hasOwnProperty.call(y,"_")?h=y._:typeof y.$value<"u"&&(h=y.$value),l==="base64"&&h!==null)try{h=Buffer.from(h,"base64").toString()}catch{}if(p==="string")a={type:"string",value:h??""};else if(p==="int"||p==="float"||p==="bool"||p==="boolen"||p==="integer"||p==="double"){let w=h;p.startsWith("int")||p==="integer"?w=parseInt(h||"0",10):p==="float"||p==="double"?w=parseFloat(h||"0"):p.startsWith("bool")&&(w=h==="1"||h==="true"),a={type:"number",value:w}}else if(p==="array"||p==="object"){const w=y.$.classname||(p==="array"?"Array":"Object"),E=String(this.nextObjectId++),C=y.$.fullname||"";this.objectHandles.set(E,{type:"property",depth:0,contextId:0,fullname:C}),a={type:"object",objectId:E,className:w,description:w}}else p==="null"?a={type:"object",subtype:"null",value:null}:a={type:"undefined",value:void 0}}else a={type:"undefined",value:void 0};const c={result:a};this.cdp.sendMessage({id:r.cdpId,result:c}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(r&&r.cdpId!==void 0){const a=r.params?.objectId||r.params?.parentObjectId,c=a?this.objectHandles.get(a):null,y=e.property?.property??e.property,p=[];if(y){const l=Array.isArray(y)?y:[y];for(const h of l){const w=h.$.name||h.$.fullname||"";let E=h.$.type||"undefined";const C=h.$.children==="1",O=h.$.encoding;let P=null;if(typeof h._<"u"&&(P=h._),O==="base64"&&P!==null)try{P=Buffer.from(P,"base64").toString()}catch{}if(C){const I=h.$.classname||(E==="array"?"Array":"Object"),d=String(this.nextObjectId++),_=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.contextId||0,x=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.depth||0;this.objectHandles.set(d,{type:"property",depth:x,contextId:_,fullname:h.$.fullname||w}),p.push({name:h.$.key||w,value:{type:"object",className:I,description:I,objectId:d},writable:!1,configurable:!1,enumerable:!0})}else{let I,d;E==="string"?I=P??"":E==="int"||E==="integer"?I=parseInt(P||"0",10):E==="float"||E==="double"?I=parseFloat(P||"0"):E==="bool"||E==="boolean"?(I=P==="1"||P==="true",E="boolean"):E==="null"?(I=null,d="null"):I=P;const _={type:E==="integer"?"number":E};d&&(_.subtype=d),_.value=I,p.push({name:h.$.key||w,value:_,writable:!1,configurable:!1,enumerable:!0})}}}if(c){const l=(c.aggregatedProps||[]).concat(p),h=32;if(p.length===h){const E=(c.currentPage||0)+1,C={...c,currentPage:E,aggregatedProps:l};this.objectHandles.set(a,C);let O;if(s==="context_get"){const I=c.contextId??0;O=`context_get -d ${c.depth} -c ${I} -p ${E} -m ${h}`}else{const I=c.depth,d=c.fullname,_=this.formatPropertyFullName(d);O=`property_get -d ${I} -n ${_} -p ${E} -m ${h}`}const P=this.sendDbgpCommand(O);this.pendingCommands.set(P,{cdpId:r.cdpId,cdpMethod:r.cdpMethod,params:r.params}),this.pendingCommands.delete(i);return}else{const E={result:l};this.cdp.sendMessage({id:r.cdpId,result:E}),this.pendingCommands.delete(i)}}else{const l={result:p};this.cdp.sendMessage({id:r.cdpId,result:l}),this.pendingCommands.delete(i)}}break}case"stack_get":{if(e.stack){const a=Array.isArray(e.stack)?e.stack:[e.stack],c=[];this.callFramesMap.clear();for(const p of a){const l=this.uriFromDBGPToBridge(p.$.filename),h=this.getOrCreateScriptId(l);this.scriptIdByUrl.has(l)||(this.scriptIdByUrl.set(l,h),await this.sendScriptToCDP(l,h))}for(const p of a){const l=parseInt(p.$.level,10),h=this.uriFromDBGPToBridge(p.$.filename),w=parseInt(p.$.lineno,10),E=p.$.where&&p.$.where!=="{main}"?p.$.where:"(anonymous)",C=`frame:${l}`;this.callFramesMap.set(C,l);const O=[],P=String(this.nextObjectId++);this.objectHandles.set(P,{type:"context",contextId:0,depth:l}),O.push({type:"local",object:{objectId:P,className:"Object",description:"Local"}});const I=String(this.nextObjectId++);this.objectHandles.set(I,{type:"context",contextId:1,depth:l}),O.push({type:"global",object:{objectId:I,className:"Object",description:"Global"}}),c.push({callFrameId:C,functionName:E,location:{scriptId:this.getOrCreateScriptId(h),lineNumber:w-1,columnNumber:0},scopeChain:O,this:{type:"object",className:"Object",description:"Object",objectId:I}})}let y="pause";if(a.length>0){const p=a[0];if(p.$.filename&&p.$.lineno){const l=this.uriFromDBGPToBridge(p.$.filename),h=parseInt(p.$.lineno,10);for(const w of this.breakpoints.values())if(w.fileUri===l&&w.lineNumber===h){y="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:y,callFrames:c,hitBreakpoints:y==="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 es(o){const t=o.cdpPort??9229,e=o.dbgpPort??9003,n=o.cdpHost??"127.0.0.1",s=o.phpRoot??process.cwd(),i=o.breakOnFirstLine??!1;vt.log("Starting XDebug Bridge...");const r=new Rr(t);vt.log("Connect Chrome DevTools to CDP at:"),vt.log(`devtools://devtools/bundled/inspector.html?ws=${n}:${t}
114
+ `),await new Promise(l=>r.on("clientConnected",l)),await new Promise(l=>setTimeout(l,2e3)),vt.log("Chrome connected! Initializing Xdebug receiver...");const a=new Br(e);vt.log(`XDebug receiver running on port ${e}`),vt.log("Running a PHP script with Xdebug enabled...");async function c(l){const h=[],w=o.phpInstance?await o.phpInstance.listFiles(l):Ft.readdirSync(l);for(const E of w){const C=bt.join(l,E);try{(o.phpInstance?await o.phpInstance.isDir(C):Ft.lstatSync(C).isDirectory())?h.push(...await c(C)):E.endsWith(".php")&&h.push(C)}catch{}}return h}const y=o.phpInstance?l=>o.phpInstance.readFileAsText(l):o.getPHPFile?o.getPHPFile:l=>Ft.readFileSync(l,"utf-8"),p=await c(s);return new ts(a,r,{knownScriptUrls:p,phpRoot:s,getPHPFile:y,breakOnFirstLine:i})}const ns={Quiet:{name:"quiet",severity:yt.Fatal},Normal:{name:"normal",severity:yt.Info},Debug:{name:"debug",severity:yt.Debug}};function So(){return Eo(Us(process.argv)).usage(`
115
+ XDebug Bridge Server CLI
116
+
117
+ Usage: xdebug-bridge [options]
118
+ `).option("port",{alias:"p",type:"number",description:"Xdebug port to listen on",default:9003}).option("host",{alias:"h",type:"string",description:"Xdebug host to bind to",default:"localhost"}).option("php-root",{type:"string",description:"Path to PHP root directory"}).option("verbosity",{type:"string",describe:"Output logs",choices:Object.values(ns).map(o=>o.name),default:"normal"}).help().epilog(`
119
+ Examples:
120
+ xdebug-bridge # Start with default settings
121
+ xdebug-bridge --port 9000 --verbosity debug # Custom port with debug logs
122
+ xdebug-bridge --php-root /path/to/php/files # Specify PHP root directory
123
+ `).wrap(null).strict().parseSync()}async function jo(){const o=So();if(o.help)return;if(o.verbosity){const e=Object.values(ns).find(n=>n.name===o.verbosity).severity;vt.setSeverityFilterLevel(e)}(await es({cdpPort:9229,cdpHost:"127.0.0.1",dbgpPort:o.port,phpRoot:o.phpRoot})).start()}exports.CDPServer=Rr;exports.DbgpSession=Br;exports.XdebugCDPBridge=ts;exports.main=jo;exports.startBridge=es;