@php-wasm/xdebug-bridge 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -26
- package/cli.cjs +1 -20
- package/cli.d.ts +1 -0
- package/cli.js +2 -127
- package/index.cjs +1 -2
- package/index.d.ts +1 -0
- package/index.js +6 -3
- package/lib/cdp-server.d.ts +8 -0
- package/lib/dbgp-session.d.ts +11 -0
- package/lib/index.d.ts +5 -0
- package/lib/run-cli.d.ts +1 -0
- package/lib/start-bridge.d.ts +13 -0
- package/lib/xdebug-cdp-bridge.d.ts +36 -0
- package/package.json +13 -4
- package/run-cli-DpXpnvR3.cjs +111 -0
- package/run-cli-II34aG2V.js +7857 -0
- package/xdebug-bridge.js +2 -0
- package/cli.cjs.map +0 -1
- package/cli.js.map +0 -1
- package/index.cjs.map +0 -1
- package/index.js.map +0 -1
- package/xdebug-bridge-BeKwvQ65.js +0 -78
- package/xdebug-bridge-BeKwvQ65.js.map +0 -1
- package/xdebug-bridge-Dc4daJ9d.cjs +0 -2
- package/xdebug-bridge-Dc4daJ9d.cjs.map +0 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";const fr=require("assert"),xt=require("path"),Bt=require("fs"),Vn=require("util"),as=require("url"),us=require("ws"),cs=require("net"),ls=require("timers");var $e=typeof document<"u"?document.currentScript:null,it=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Hn={exports:{}},ue=typeof Reflect=="object"?Reflect:null,hr=ue&&typeof ue.apply=="function"?ue.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},Se;ue&&typeof ue.ownKeys=="function"?Se=ue.ownKeys:Object.getOwnPropertySymbols?Se=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Se=function(t){return Object.getOwnPropertyNames(t)};function fs(a){console&&console.warn&&console.warn(a)}var Si=Number.isNaN||function(t){return t!==t};function ct(){ct.init.call(this)}Hn.exports=ct;Hn.exports.once=ms;ct.EventEmitter=ct;ct.prototype._events=void 0;ct.prototype._eventsCount=0;ct.prototype._maxListeners=void 0;var pr=10;function Be(a){if(typeof a!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof a)}Object.defineProperty(ct,"defaultMaxListeners",{enumerable:!0,get:function(){return pr},set:function(a){if(typeof a!="number"||a<0||Si(a))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+a+".");pr=a}});ct.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ct.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Si(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 Fi(a){return a._maxListeners===void 0?ct.defaultMaxListeners:a._maxListeners}ct.prototype.getMaxListeners=function(){return Fi(this)};ct.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var o=t==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var r;if(e.length>0&&(r=e[0]),r instanceof Error)throw r;var s=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw s.context=r,s}var f=i[t];if(f===void 0)return!1;if(typeof f=="function")hr(f,this,e);else for(var E=f.length,d=Xi(f,E),n=0;n<E;++n)hr(d[n],this,e);return!0};function ji(a,t,e,n){var o,i,r;if(Be(e),i=a._events,i===void 0?(i=a._events=Object.create(null),a._eventsCount=0):(i.newListener!==void 0&&(a.emit("newListener",t,e.listener?e.listener:e),i=a._events),r=i[t]),r===void 0)r=i[t]=e,++a._eventsCount;else if(typeof r=="function"?r=i[t]=n?[e,r]:[r,e]:n?r.unshift(e):r.push(e),o=Fi(a),o>0&&r.length>o&&!r.warned){r.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+r.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=a,s.type=t,s.count=r.length,fs(s)}return a}ct.prototype.addListener=function(t,e){return ji(this,t,e,!1)};ct.prototype.on=ct.prototype.addListener;ct.prototype.prependListener=function(t,e){return ji(this,t,e,!0)};function hs(){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 Ri(a,t,e){var n={fired:!1,wrapFn:void 0,target:a,type:t,listener:e},o=hs.bind(n);return o.listener=e,n.wrapFn=o,o}ct.prototype.once=function(t,e){return Be(e),this.on(t,Ri(this,t,e)),this};ct.prototype.prependOnceListener=function(t,e){return Be(e),this.prependListener(t,Ri(this,t,e)),this};ct.prototype.removeListener=function(t,e){var n,o,i,r,s;if(Be(e),o=this._events,o===void 0)return this;if(n=o[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.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){s=n[r].listener,i=r;break}if(i<0)return this;i===0?n.shift():ps(n,i),n.length===1&&(o[t]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",t,s||e)}return this};ct.prototype.off=ct.prototype.removeListener;ct.prototype.removeAllListeners=function(t){var e,n,o;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(o=0;o<i.length;++o)r=i[o],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(o=e.length-1;o>=0;o--)this.removeListener(t,e[o]);return this};function Bi(a,t,e){var n=a._events;if(n===void 0)return[];var o=n[t];return o===void 0?[]:typeof o=="function"?e?[o.listener||o]:[o]:e?ds(o):Xi(o,o.length)}ct.prototype.listeners=function(t){return Bi(this,t,!0)};ct.prototype.rawListeners=function(t){return Bi(this,t,!1)};ct.listenerCount=function(a,t){return typeof a.listenerCount=="function"?a.listenerCount(t):Ui.call(a,t)};ct.prototype.listenerCount=Ui;function Ui(a){var t=this._events;if(t!==void 0){var e=t[a];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}ct.prototype.eventNames=function(){return this._eventsCount>0?Se(this._events):[]};function Xi(a,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=a[n];return e}function ps(a,t){for(;t+1<a.length;t++)a[t]=a[t+1];a.pop()}function ds(a){for(var t=new Array(a.length),e=0;e<t.length;++e)t[e]=a[e].listener||a[e];return t}function ms(a,t){return new Promise(function(e,n){function o(r){a.removeListener(t,i),n(r)}function i(){typeof a.removeListener=="function"&&a.removeListener("error",o),e([].slice.call(arguments))}$i(a,t,i,{once:!0}),t!=="error"&&gs(a,o,{once:!0})})}function gs(a,t,e){typeof a.on=="function"&&$i(a,"error",t,e)}function $i(a,t,e,n){if(typeof a.on=="function")n.once?a.once(t,e):a.on(t,e);else if(typeof a.addEventListener=="function")a.addEventListener(t,function o(i){n.once&&a.removeEventListener(t,o),e(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof a)}var zn=Hn.exports;class qi extends zn.EventEmitter{constructor(t=9229){super(),this.ws=null,this.wss=new us.WebSocketServer({port:t}),this.wss.on("connection",e=>{if(this.ws){e.close();return}this.ws=e,this.emit("clientConnected"),e.on("message",n=>{console.log("\x1B[1;32m[CDP][received]\x1B[0m",n.toString());let o;try{o=JSON.parse(n.toString())}catch{return}this.emit("message",o)}),e.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),e.on("error",n=>{this.emit("error",n)})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const e=JSON.stringify(t);console.log("\x1B[1;32m[CDP][send]\x1B[0m",e),this.ws.send(e)}}class Wi extends zn.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=cs.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("close")}),e.on("error",n=>{this.emit("error",n)})}),this.server.listen(t)}onData(t){for(console.log("\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),o=parseInt(n,10);if(isNaN(o)){this.buffer="";break}this.expectedLength=o,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&&this.socket.write(t+"\0")}}const ys={right:Is,center:Cs},bs=0,Fe=1,ws=2,je=3;class Es{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(`
|
|
2
|
+
`).map(o=>o.split(" "));let n=0;return e.forEach(o=>{o.length>1&&Dt.stringWidth(o[0])>n&&(n=Math.min(Math.floor(this.width*.5),Dt.stringWidth(o[0])))}),e.forEach(o=>{this.div(...o.map((i,r)=>({text:i.trim(),padding:this.measurePadding(i),width:r===0&&o.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(`
|
|
3
|
+
`)}rowToString(t,e){return this.rasterize(t).forEach((n,o)=>{let i="";n.forEach((r,s)=>{const{width:f}=t[s],E=this.negatePadding(t[s]);let d=r;if(E>Dt.stringWidth(r)&&(d+=" ".repeat(E-Dt.stringWidth(r))),t[s].align&&t[s].align!=="left"&&this.wrap){const b=ys[t[s].align];d=b(d,E),Dt.stringWidth(d)<E&&(d+=" ".repeat((f||0)-Dt.stringWidth(d)-1))}const p=t[s].padding||[0,0,0,0];p[je]&&(i+=" ".repeat(p[je])),i+=dr(t[s],d,"| "),i+=d,i+=dr(t[s],d," |"),p[Fe]&&(i+=" ".repeat(p[Fe])),o===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(/^ */),o=n?n[0].length:0,i=e.text,r=Dt.stringWidth(i.trimRight());return e.span?this.wrap?o<r?t:(e.hidden=!0,i.trimRight()+" ".repeat(o-r)+t.trimLeft()):(e.hidden=!0,i+t):t}rasterize(t){const e=[],n=this.columnWidths(t);let o;return t.forEach((i,r)=>{i.width=n[r],this.wrap?o=Dt.wrap(i.text,this.negatePadding(i),{hard:!0}).split(`
|
|
4
|
+
`):o=i.text.split(`
|
|
5
|
+
`),i.border&&(o.unshift("."+"-".repeat(this.negatePadding(i)+2)+"."),o.push("'"+"-".repeat(this.negatePadding(i)+2)+"'")),i.padding&&(o.unshift(...new Array(i.padding[bs]||0).fill("")),o.push(...new Array(i.padding[ws]||0).fill(""))),o.forEach((s,f)=>{e[f]||e.push([]);const E=e[f];for(let d=0;d<r;d++)E[d]===void 0&&E.push("");E.push(s)})}),e}negatePadding(t){let e=t.width||0;return t.padding&&(e-=(t.padding[je]||0)+(t.padding[Fe]||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 o=t.map(r=>{if(r.width)return e--,n-=r.width,r.width}),i=e?Math.floor(n/e):0;return o.map((r,s)=>r===void 0?Math.max(i,xs(t[s])):r)}}function dr(a,t,e){return a.border?/[.']-+[.']/.test(t)?"":t.trim().length!==0?e:" ":""}function xs(a){const t=a.padding||[],e=1+(t[je]||0)+(t[Fe]||0);return a.border?e+4:e}function Os(){return typeof process=="object"&&process.stdout&&process.stdout.columns?process.stdout.columns:80}function Is(a,t){a=a.trim();const e=Dt.stringWidth(a);return e<t?" ".repeat(t-e)+a:a}function Cs(a,t){a=a.trim();const e=Dt.stringWidth(a);return e>=t?a:" ".repeat(t-e>>1)+a}let Dt;function Ts(a,t){return Dt=t,new Es({width:a?.width||Os(),wrap:a?.wrap})}const Vi=new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)","g");function Hi(a){return a.replace(Vi,"")}function Ds(a,t){const[e,n]=a.match(Vi)||["",""];a=Hi(a);let o="";for(let i=0;i<a.length;i++)i!==0&&i%t===0&&(o+=`
|
|
6
|
+
`),o+=a.charAt(i);return e&&n&&(o=`${e}${o}${n}`),o}function _s(a){return Ts(a,{stringWidth:t=>[...t].length,stripAnsi:Hi,wrap:Ds})}function vs(a,t){let e=xt.resolve(".",a),n;for(Bt.statSync(e).isDirectory()||(e=xt.dirname(e));;){if(n=t(e,Bt.readdirSync(e)),n)return xt.resolve(e,n);if(e=xt.dirname(n=e),n===e)break}}/**
|
|
7
|
+
* @license
|
|
8
|
+
* Copyright (c) 2016, Contributors
|
|
9
|
+
* SPDX-License-Identifier: ISC
|
|
10
|
+
*/function he(a){if(a!==a.toLowerCase()&&a!==a.toUpperCase()||(a=a.toLowerCase()),a.indexOf("-")===-1&&a.indexOf("_")===-1)return a;{let e="",n=!1;const o=a.match(/^-+/);for(let i=o?o[0].length:0;i<a.length;i++){let r=a.charAt(i);n&&(n=!1,r=r.toUpperCase()),i!==0&&(r==="-"||r==="_")?n=!0:r!=="-"&&r!=="_"&&(e+=r)}return e}}function zi(a,t){const e=a.toLowerCase();t=t||"-";let n="";for(let o=0;o<a.length;o++){const i=e.charAt(o),r=a.charAt(o);i!==r&&o>0?n+=`${t}${e.charAt(o)}`:n+=r}return n}function Yi(a){return a==null?!1:typeof a=="number"||/^0x[0-9a-f]+$/i.test(a)?!0:/^0[^.]/.test(a)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(a)}/**
|
|
11
|
+
* @license
|
|
12
|
+
* Copyright (c) 2016, Contributors
|
|
13
|
+
* SPDX-License-Identifier: ISC
|
|
14
|
+
*/function Ns(a){if(Array.isArray(a))return a.map(r=>typeof r!="string"?r+"":r);a=a.trim();let t=0,e=null,n=null,o=null;const i=[];for(let r=0;r<a.length;r++){if(e=n,n=a.charAt(r),n===" "&&!o){e!==" "&&t++;continue}n===o?o=null:(n==="'"||n==='"')&&!o&&(o=n),i[t]||(i[t]=""),i[t]+=n}return i}/**
|
|
15
|
+
* @license
|
|
16
|
+
* Copyright (c) 2016, Contributors
|
|
17
|
+
* SPDX-License-Identifier: ISC
|
|
18
|
+
*/var St;(function(a){a.BOOLEAN="boolean",a.STRING="string",a.NUMBER="number",a.ARRAY="array"})(St||(St={}));/**
|
|
19
|
+
* @license
|
|
20
|
+
* Copyright (c) 2016, Contributors
|
|
21
|
+
* SPDX-License-Identifier: ISC
|
|
22
|
+
*/let Xt;class As{constructor(t){Xt=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),o=Ns(t),i=typeof t=="string",r=Ms(Object.assign(Object.create(null),n.alias)),s=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),f=Object.assign(Object.create(null),n.default),E=n.configObjects||[],d=n.envPrefix,p=s["populate--"],b=p?"--":"_",w=Object.create(null),T=Object.create(null),v=n.__||Xt.format,I={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:[]},D=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,C=new RegExp("^--"+s["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(A){const l=typeof A=="object"?A.key:A,u=Object.keys(A).map(function(c){return{boolean:"bools",string:"strings",number:"numbers"}[c]}).filter(Boolean).pop();u&&(I[u][l]=!0),I.arrays[l]=!0,I.keys.push(l)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(A){I.bools[A]=!0,I.keys.push(A)}),[].concat(n.string||[]).filter(Boolean).forEach(function(A){I.strings[A]=!0,I.keys.push(A)}),[].concat(n.number||[]).filter(Boolean).forEach(function(A){I.numbers[A]=!0,I.keys.push(A)}),[].concat(n.count||[]).filter(Boolean).forEach(function(A){I.counts[A]=!0,I.keys.push(A)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(A){I.normalize[A]=!0,I.keys.push(A)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([A,l])=>{typeof l=="number"&&(I.nargs[A]=l,I.keys.push(A))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([A,l])=>{typeof l=="function"&&(I.coercions[A]=l,I.keys.push(A))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(A){I.configs[A]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([A,l])=>{(typeof l=="boolean"||typeof l=="function")&&(I.configs[A]=l)})),_t(n.key,r,n.default,I.arrays),Object.keys(f).forEach(function(A){(I.aliases[A]||[]).forEach(function(l){f[l]=f[A]})});let g=null;ht();let _=[];const M=Object.assign(Object.create(null),{_:[]}),X={};for(let A=0;A<o.length;A++){const l=o[A],u=l.replace(/^-{3,}/,"---");let c,h,N,L,F,Z;if(l!=="--"&&/^-/.test(l)&&y(l))q(l);else if(u.match(/^---+(=|$)/)){q(l);continue}else if(l.match(/^--.+=/)||!s["short-option-groups"]&&l.match(/^-.+=/))L=l.match(/^--?([^=]+)=([\s\S]*)$/),L!==null&&Array.isArray(L)&&L.length>=3&&(K(L[1],I.arrays)?A=m(A,L[1],o,L[2]):K(L[1],I.nargs)!==!1?A=U(A,L[1],o,L[2]):R(L[1],L[2],!0));else if(l.match(C)&&s["boolean-negation"])L=l.match(C),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],R(h,K(h,I.arrays)?[!1]:!1));else if(l.match(/^--.+/)||!s["short-option-groups"]&&l.match(/^-[^-]+/))L=l.match(/^--?(.+)/),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],K(h,I.arrays)?A=m(A,h,o):K(h,I.nargs)!==!1?A=U(A,h,o):(F=o[A+1],F!==void 0&&(!F.match(/^-/)||F.match(D))&&!K(h,I.bools)&&!K(h,I.counts)||/^(true|false)$/.test(F)?(R(h,F),A++):R(h,P(h))));else if(l.match(/^-.\..+=/))L=l.match(/^-([^=]+)=([\s\S]*)$/),L!==null&&Array.isArray(L)&&L.length>=3&&R(L[1],L[2]);else if(l.match(/^-.\..+/)&&!l.match(D))F=o[A+1],L=l.match(/^-(.\..+)/),L!==null&&Array.isArray(L)&&L.length>=2&&(h=L[1],F!==void 0&&!F.match(/^-/)&&!K(h,I.bools)&&!K(h,I.counts)?(R(h,F),A++):R(h,P(h)));else if(l.match(/^-[^-]+/)&&!l.match(D)){N=l.slice(1,-1).split(""),c=!1;for(let nt=0;nt<N.length;nt++){if(F=l.slice(nt+2),N[nt+1]&&N[nt+1]==="="){Z=l.slice(nt+3),h=N[nt],K(h,I.arrays)?A=m(A,h,o,Z):K(h,I.nargs)!==!1?A=U(A,h,o,Z):R(h,Z),c=!0;break}if(F==="-"){R(N[nt],F);continue}if(/[A-Za-z]/.test(N[nt])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(F)&&K(F,I.bools)===!1){R(N[nt],F),c=!0;break}if(N[nt+1]&&N[nt+1].match(/\W/)){R(N[nt],F),c=!0;break}else R(N[nt],P(N[nt]))}h=l.slice(-1)[0],!c&&h!=="-"&&(K(h,I.arrays)?A=m(A,h,o):K(h,I.nargs)!==!1?A=U(A,h,o):(F=o[A+1],F!==void 0&&(!/^(-|--)[^-]/.test(F)||F.match(D))&&!K(h,I.bools)&&!K(h,I.counts)||/^(true|false)$/.test(F)?(R(h,F),A++):R(h,P(h))))}else if(l.match(/^-[0-9]$/)&&l.match(D)&&K(l.slice(1),I.bools))h=l.slice(1),R(h,P(h));else if(l==="--"){_=o.slice(A+1);break}else if(s["halt-at-non-option"]){_=o.slice(A);break}else q(l)}V(M,!0),V(M,!1),W(M),k(),at(M,I.aliases,f,!0),ft(M),s["set-placeholder-key"]&&Ot(M),Object.keys(I.counts).forEach(function(A){st(M,A.split("."))||R(A,0)}),p&&_.length&&(M[b]=[]),_.forEach(function(A){M[b].push(A)}),s["camel-case-expansion"]&&s["strip-dashed"]&&Object.keys(M).filter(A=>A!=="--"&&A.includes("-")).forEach(A=>{delete M[A]}),s["strip-aliased"]&&[].concat(...Object.keys(r).map(A=>r[A])).forEach(A=>{s["camel-case-expansion"]&&A.includes("-")&&delete M[A.split(".").map(l=>he(l)).join(".")],delete M[A]});function q(A){const l=$("_",A);(typeof l=="string"||typeof l=="number")&&M._.push(l)}function U(A,l,u,c){let h,N=K(l,I.nargs);if(N=typeof N!="number"||isNaN(N)?1:N,N===0)return rt(c)||(g=Error(v("Argument unexpected for: %s",l))),R(l,P(l)),A;let L=rt(c)?0:1;if(s["nargs-eats-options"])u.length-(A+1)+L<N&&(g=Error(v("Not enough arguments following: %s",l))),L=N;else{for(h=A+1;h<u.length&&(!u[h].match(/^-[^0-9]/)||u[h].match(D)||y(u[h]));h++)L++;L<N&&(g=Error(v("Not enough arguments following: %s",l)))}let F=Math.min(L,N);for(!rt(c)&&F>0&&(R(l,c),F--),h=A+1;h<F+A+1;h++)R(l,u[h]);return A+F}function m(A,l,u,c){let h=[],N=c||u[A+1];const L=K(l,I.nargs);if(K(l,I.bools)&&!/^(true|false)$/.test(N))h.push(!0);else if(rt(N)||rt(c)&&/^-/.test(N)&&!D.test(N)&&!y(N)){if(f[l]!==void 0){const F=f[l];h=Array.isArray(F)?F:[F]}}else{rt(c)||h.push(B(l,c,!0));for(let F=A+1;F<u.length&&!(!s["greedy-arrays"]&&h.length>0||L&&typeof L=="number"&&h.length>=L||(N=u[F],/^-/.test(N)&&!D.test(N)&&!y(N)));F++)A=F,h.push(B(l,N,i))}return typeof L=="number"&&(L&&h.length<L||isNaN(L)&&h.length===0)&&(g=Error(v("Not enough arguments following: %s",l))),R(l,h),A}function R(A,l,u=i){if(/-/.test(A)&&s["camel-case-expansion"]){const N=A.split(".").map(function(L){return he(L)}).join(".");S(A,N)}const c=B(A,l,u),h=A.split(".");ut(M,h,c),I.aliases[A]&&I.aliases[A].forEach(function(N){const L=N.split(".");ut(M,L,c)}),h.length>1&&s["dot-notation"]&&(I.aliases[h[0]]||[]).forEach(function(N){let L=N.split(".");const F=[].concat(h);F.shift(),L=L.concat(F),(I.aliases[A]||[]).includes(L.join("."))||ut(M,L,c)}),K(A,I.normalize)&&!K(A,I.arrays)&&[A].concat(I.aliases[A]||[]).forEach(function(L){Object.defineProperty(X,L,{enumerable:!0,get(){return l},set(F){l=typeof F=="string"?Xt.normalize(F):F}})})}function S(A,l){I.aliases[A]&&I.aliases[A].length||(I.aliases[A]=[l],w[l]=!0),I.aliases[l]&&I.aliases[l].length||S(l,A)}function B(A,l,u){u&&(l=Ps(l)),(K(A,I.bools)||K(A,I.counts))&&typeof l=="string"&&(l=l==="true");let c=Array.isArray(l)?l.map(function(h){return $(A,h)}):$(A,l);return K(A,I.counts)&&(rt(c)||typeof c=="boolean")&&(c=qe()),K(A,I.normalize)&&K(A,I.arrays)&&(Array.isArray(l)?c=l.map(h=>Xt.normalize(h)):c=Xt.normalize(l)),c}function $(A,l){return!s["parse-positional-numbers"]&&A==="_"||!K(A,I.strings)&&!K(A,I.bools)&&!Array.isArray(l)&&(Yi(l)&&s["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${l}`)))||!rt(l)&&K(A,I.numbers))&&(l=Number(l)),l}function W(A){const l=Object.create(null);at(l,I.aliases,f),Object.keys(I.configs).forEach(function(u){const c=A[u]||l[u];if(c)try{let h=null;const N=Xt.resolve(Xt.cwd(),c),L=I.configs[u];if(typeof L=="function"){try{h=L(N)}catch(F){h=F}if(h instanceof Error){g=h;return}}else h=Xt.require(N);Y(h)}catch(h){h.name==="PermissionDenied"?g=h:A[u]&&(g=Error(v("Invalid JSON config file: %s",c)))}})}function Y(A,l){Object.keys(A).forEach(function(u){const c=A[u],h=l?l+"."+u:u;typeof c=="object"&&c!==null&&!Array.isArray(c)&&s["dot-notation"]?Y(c,h):(!st(M,h.split("."))||K(h,I.arrays)&&s["combine-arrays"])&&R(h,c)})}function k(){typeof E<"u"&&E.forEach(function(A){Y(A)})}function V(A,l){if(typeof d>"u")return;const u=typeof d=="string"?d:"",c=Xt.env();Object.keys(c).forEach(function(h){if(u===""||h.lastIndexOf(u,0)===0){const N=h.split("__").map(function(L,F){return F===0&&(L=L.substring(u.length)),he(L)});(l&&I.configs[N.join(".")]||!l)&&!st(A,N)&&R(N.join("."),c[h])}})}function ft(A){let l;const u=new Set;Object.keys(A).forEach(function(c){if(!u.has(c)&&(l=K(c,I.coercions),typeof l=="function"))try{const h=$(c,l(A[c]));[].concat(I.aliases[c]||[],c).forEach(N=>{u.add(N),A[N]=h})}catch(h){g=h}})}function Ot(A){return I.keys.forEach(l=>{~l.indexOf(".")||typeof A[l]>"u"&&(A[l]=void 0)}),A}function at(A,l,u,c=!1){Object.keys(u).forEach(function(h){st(A,h.split("."))||(ut(A,h.split("."),u[h]),c&&(T[h]=!0),(l[h]||[]).forEach(function(N){st(A,N.split("."))||ut(A,N.split("."),u[h])}))})}function st(A,l){let u=A;s["dot-notation"]||(l=[l.join(".")]),l.slice(0,-1).forEach(function(h){u=u[h]||{}});const c=l[l.length-1];return typeof u!="object"?!1:c in u}function ut(A,l,u){let c=A;s["dot-notation"]||(l=[l.join(".")]),l.slice(0,-1).forEach(function(Z){Z=mr(Z),typeof c=="object"&&c[Z]===void 0&&(c[Z]={}),typeof c[Z]!="object"||Array.isArray(c[Z])?(Array.isArray(c[Z])?c[Z].push({}):c[Z]=[c[Z],{}],c=c[Z][c[Z].length-1]):c=c[Z]});const h=mr(l[l.length-1]),N=K(l.join("."),I.arrays),L=Array.isArray(u);let F=s["duplicate-arguments-array"];!F&&K(h,I.nargs)&&(F=!0,(!rt(c[h])&&I.nargs[h]===1||Array.isArray(c[h])&&c[h].length===I.nargs[h])&&(c[h]=void 0)),u===qe()?c[h]=qe(c[h]):Array.isArray(c[h])?F&&N&&L?c[h]=s["flatten-duplicate-arrays"]?c[h].concat(u):(Array.isArray(c[h][0])?c[h]:[c[h]]).concat([u]):!F&&!!N==!!L?c[h]=u:c[h]=c[h].concat([u]):c[h]===void 0&&N?c[h]=L?u:[u]:F&&!(c[h]===void 0||K(h,I.counts)||K(h,I.bools))?c[h]=[c[h],u]:c[h]=u}function _t(...A){A.forEach(function(l){Object.keys(l||{}).forEach(function(u){I.aliases[u]||(I.aliases[u]=[].concat(r[u]||[]),I.aliases[u].concat(u).forEach(function(c){if(/-/.test(c)&&s["camel-case-expansion"]){const h=he(c);h!==u&&I.aliases[u].indexOf(h)===-1&&(I.aliases[u].push(h),w[h]=!0)}}),I.aliases[u].concat(u).forEach(function(c){if(c.length>1&&/[A-Z]/.test(c)&&s["camel-case-expansion"]){const h=zi(c,"-");h!==u&&I.aliases[u].indexOf(h)===-1&&(I.aliases[u].push(h),w[h]=!0)}}),I.aliases[u].forEach(function(c){I.aliases[c]=[u].concat(I.aliases[u].filter(function(h){return c!==h}))}))})})}function K(A,l){const u=[].concat(I.aliases[A]||[],A),c=Object.keys(l),h=u.find(N=>c.includes(N));return h?l[h]:!1}function Ut(A){const l=Object.keys(I);return[].concat(l.map(c=>I[c])).some(function(c){return Array.isArray(c)?c.includes(A):c[A]})}function Q(A,...l){return[].concat(...l).some(function(c){const h=A.match(c);return h&&Ut(h[1])})}function x(A){if(A.match(D)||!A.match(/^-[^-]+/))return!1;let l=!0,u;const c=A.slice(1).split("");for(let h=0;h<c.length;h++){if(u=A.slice(h+2),!Ut(c[h])){l=!1;break}if(c[h+1]&&c[h+1]==="="||u==="-"||/[A-Za-z]/.test(c[h])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(u)||c[h+1]&&c[h+1].match(/\W/))break}return l}function y(A){return s["unknown-options-as-args"]&&j(A)}function j(A){return A=A.replace(/^-{3,}/,"--"),A.match(D)||x(A)?!1:!Q(A,/^-+([^=]+?)=[\s\S]*$/,C,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function P(A){return!K(A,I.bools)&&!K(A,I.counts)&&`${A}`in f?f[A]:J(ot(A))}function J(A){return{[St.BOOLEAN]:!0,[St.STRING]:"",[St.NUMBER]:void 0,[St.ARRAY]:[]}[A]}function ot(A){let l=St.BOOLEAN;return K(A,I.strings)?l=St.STRING:K(A,I.numbers)?l=St.NUMBER:K(A,I.bools)?l=St.BOOLEAN:K(A,I.arrays)&&(l=St.ARRAY),l}function rt(A){return A===void 0}function ht(){Object.keys(I.counts).find(A=>K(A,I.arrays)?(g=Error(v("Invalid configuration: %s, opts.count excludes opts.array.",A)),!0):K(A,I.nargs)?(g=Error(v("Invalid configuration: %s, opts.count excludes opts.narg.",A)),!0):!1)}return{aliases:Object.assign({},I.aliases),argv:Object.assign(X,M),configuration:s,defaulted:Object.assign({},T),error:g,newAliases:Object.assign({},w)}}}function Ms(a){const t=[],e=Object.create(null);let n=!0;for(Object.keys(a).forEach(function(o){t.push([].concat(a[o],o))});n;){n=!1;for(let o=0;o<t.length;o++)for(let i=o+1;i<t.length;i++)if(t[o].filter(function(s){return t[i].indexOf(s)!==-1}).length){t[o]=t[o].concat(t[i]),t.splice(i,1),n=!0;break}}return t.forEach(function(o){o=o.filter(function(r,s,f){return f.indexOf(r)===s});const i=o.pop();i!==void 0&&typeof i=="string"&&(e[i]=o)}),e}function qe(a){return a!==void 0?a+1:1}function mr(a){return a==="__proto__"?"___proto___":a}function Ps(a){return typeof a=="string"&&(a[0]==="'"||a[0]==='"')&&a[a.length-1]===a[0]?a.substring(1,a.length-1):a}/**
|
|
23
|
+
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
24
|
+
* CJS and ESM environments.
|
|
25
|
+
*
|
|
26
|
+
* @license
|
|
27
|
+
* Copyright (c) 2016, Contributors
|
|
28
|
+
* SPDX-License-Identifier: ISC
|
|
29
|
+
*/var We,Ve,He;const gr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,yr=(Ve=(We=process==null?void 0:process.versions)===null||We===void 0?void 0:We.node)!==null&&Ve!==void 0?Ve:(He=process==null?void 0:process.version)===null||He===void 0?void 0:He.slice(1);if(yr&&Number(yr.match(/^([^.]+)/)[1])<gr)throw Error(`yargs parser supports a minimum Node.js version of ${gr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Ls=process?process.env:{},Gi=new As({cwd:process.cwd,env:()=>Ls,format:Vn.format,normalize:xt.normalize,resolve:xt.resolve,require:a=>{if(typeof require<"u")return require(a);if(a.match(/\.json$/))return JSON.parse(Bt.readFileSync(a,"utf8"));throw Error("only .json config files are supported in ESM")}}),Ee=function(t,e){return Gi.parse(t.slice(),e).argv};Ee.detailed=function(a,t){return Gi.parse(a.slice(),t)};Ee.camelCase=he;Ee.decamelize=zi;Ee.looksLikeNumber=Yi;function ki(){return Ss()?0:1}function Ss(){return Fs()&&!process.defaultApp}function Fs(){return!!process.versions.electron}function js(a){return a.slice(ki()+1)}function Rs(){return process.argv[ki()]}class gt extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,gt)}}const Bs={fs:{readFileSync:Bt.readFileSync,writeFile:Bt.writeFile},format:Vn.format,resolve:xt.resolve,exists:a=>{try{return Bt.statSync(a).isFile()}catch{return!1}}};let Lt;class Us{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(),Lt.format.apply(Lt.format,[this.cache[this.locale][e]||e].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),e=t.shift(),n=t.shift(),o=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let r=o===1?e:n;this.cache[this.locale][e]&&(r=this.cache[this.locale][e][o===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 s=[r];return~r.indexOf("%d")&&s.push(o),Lt.format.apply(Lt.format,s.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(o,i){const r=e[i+1];n+=o,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,o=e.locale,i=e.cb,r=this._resolveLocaleFile(n,o),s=JSON.stringify(this.cache[o],null,2);Lt.fs.writeFile(r,s,"utf-8",function(f){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(f)})}_readLocaleFile(){let t={};const e=this._resolveLocaleFile(this.directory,this.locale);try{Lt.fs.readFileSync&&(t=JSON.parse(Lt.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=Lt.resolve(t,"./",e+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~e.lastIndexOf("_")){const o=Lt.resolve(t,"./",e.split("_")[0]+".json");this._fileExistsSync(o)&&(n=o)}return n}_fileExistsSync(t){return Lt.exists(t)}}function Xs(a,t){Lt=t;const e=new Us(a);return{__:e.__.bind(e),__n:e.__n.bind(e),setLocale:e.setLocale.bind(e),getLocale:e.getLocale.bind(e),updateLocale:e.updateLocale.bind(e),locale:e.locale}}const $s=a=>Xs(a,Bs),qs="require is not supported by ESM",br="loading a directory of commands is not supported yet for ESM";let be;try{be=as.fileURLToPath(typeof document>"u"?require("url").pathToFileURL(__filename).href:$e&&$e.tagName.toUpperCase()==="SCRIPT"&&$e.src||new URL("run-cli-DpXpnvR3.cjs",document.baseURI).href)}catch{be=process.cwd()}const Ws=be.substring(0,be.lastIndexOf("node_modules")),Vs={assert:{notStrictEqual:fr.notStrictEqual,strictEqual:fr.strictEqual},cliui:_s,findUp:vs,getEnv:a=>process.env[a],inspect:Vn.inspect,getCallerFile:()=>{throw new gt(br)},getProcessArgvBin:Rs,mainFilename:Ws||process.cwd(),Parser:Ee,path:{basename:xt.basename,dirname:xt.dirname,extname:xt.extname,relative:xt.relative,resolve:xt.resolve},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(a,t)=>process.emitWarning(a,t),execPath:()=>process.execPath,exit:process.exit,nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:Bt.readFileSync,require:()=>{throw new gt(qs)},requireDirectory:()=>{throw new gt(br)},stringWidth:a=>[...a].length,y18n:$s({directory:xt.resolve(be,"../../../locales"),updateFiles:!1})};function Ft(a,t,e,n){e.assert.notStrictEqual(a,t,n)}function wr(a,t){t.assert.strictEqual(typeof a,"string")}function Re(a){return Object.keys(a)}function yt(a){return!!a&&!!a.then&&typeof a.then=="function"}function me(a){const e=a.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),n=/\.*[\][<>]/g,o=e.shift();if(!o)throw new Error(`No command found in: ${a}`);const i={cmd:o.replace(n,""),demanded:[],optional:[]};return e.forEach((r,s)=>{let f=!1;r=r.replace(/\s/g,""),/\.+[\]>]/.test(r)&&s===e.length-1&&(f=!0),/^\[/.test(r)?i.optional.push({cmd:r.replace(n,"").split("|"),variadic:f}):i.demanded.push({cmd:r.replace(n,"").split("|"),variadic:f})}),i}const Hs=["first","second","third","fourth","fifth","sixth"];function z(a,t,e){function n(){return typeof a=="object"?[{demanded:[],optional:[]},a,t]:[me(`cmd ${a}`),t,e]}try{let o=0;const[i,r,s]=n(),f=[].slice.call(r);for(;f.length&&f[f.length-1]===void 0;)f.pop();const E=s||f.length;if(E<i.demanded.length)throw new gt(`Not enough arguments provided. Expected ${i.demanded.length} but received ${f.length}.`);const d=i.demanded.length+i.optional.length;if(E>d)throw new gt(`Too many arguments provided. Expected max ${d} but received ${E}.`);i.demanded.forEach(p=>{const b=f.shift(),w=Er(b);p.cmd.filter(v=>v===w||v==="*").length===0&&xr(w,p.cmd,o),o+=1}),i.optional.forEach(p=>{if(f.length===0)return;const b=f.shift(),w=Er(b);p.cmd.filter(v=>v===w||v==="*").length===0&&xr(w,p.cmd,o),o+=1})}catch(o){console.warn(o.stack)}}function Er(a){return Array.isArray(a)?"array":a===null?"null":typeof a}function xr(a,t,e){throw new gt(`Invalid ${Hs[e]||"manyith"} argument. Expected ${t.join(" or ")} but received ${a}.`)}class zs{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,e,n=!0,o=!1){if(z("<array|function> [boolean] [boolean] [boolean]",[t,e,n],arguments.length),Array.isArray(t)){for(let i=0;i<t.length;i++){if(typeof t[i]!="function")throw Error("middleware must be a function");const r=t[i];r.applyBeforeValidation=e,r.global=n}Array.prototype.push.apply(this.globalMiddleware,t)}else if(typeof t=="function"){const i=t;i.applyBeforeValidation=e,i.global=n,i.mutates=o,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,e){const n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter(o=>{const i=[...n[e]||[],e];return o.option?!i.includes(o.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 Ys(a){return a?a.map(t=>(t.applyBeforeValidation=!1,t)):[]}function ge(a,t,e,n){return e.reduce((o,i)=>{if(i.applyBeforeValidation!==n)return o;if(i.mutates){if(i.applied)return o;i.applied=!0}if(yt(o))return o.then(r=>Promise.all([r,i(r,t)])).then(([r,s])=>Object.assign(r,s));{const r=i(o,t);return yt(r)?r.then(s=>Object.assign(o,s)):Object.assign(o,r)}},a)}function ye(a,t,e=n=>{throw n}){try{const n=Gs(a)?a():a;return yt(n)?n.then(o=>t(o)):t(n)}catch(n){return e(n)}}function Gs(a){return typeof a=="function"}function ks(a){if(typeof require>"u")return null;for(let t=0,e=Object.keys(require.cache),n;t<e.length;t++)if(n=require.cache[e[t]],n.exports===a)return n;return null}const ie=/(^\*)|(^\$0)/;class Ks{constructor(t,e,n,o){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=o,this.usage=t,this.globalMiddleware=n,this.validation=e}addDirectory(t,e,n,o){o=o||{},typeof o.recurse!="boolean"&&(o.recurse=!1),Array.isArray(o.extensions)||(o.extensions=["js"]);const i=typeof o.visit=="function"?o.visit:r=>r;o.visit=(r,s,f)=>{const E=i(r,s,f);if(E){if(this.requireCache.has(s))return E;this.requireCache.add(s),this.addHandler(E)}return E},this.shim.requireDirectory({require:e,filename:n},t,o)}addHandler(t,e,n,o,i,r){let s=[];const f=Ys(i);if(o=o||(()=>{}),Array.isArray(t))if(Js(t))[t,...s]=t;else for(const E of t)this.addHandler(E);else if(to(t)){let E=Array.isArray(t.command)||typeof t.command=="string"?t.command:this.moduleName(t);t.aliases&&(E=[].concat(E).concat(t.aliases)),this.addHandler(E,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated);return}else if(Or(n)){this.addHandler([t].concat(s),e,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof t=="string"){const E=me(t);s=s.map(b=>me(b).cmd);let d=!1;const p=[E.cmd].concat(s).filter(b=>ie.test(b)?(d=!0,!1):!0);p.length===0&&d&&p.push("$0"),d&&(E.cmd=p[0],s=p.slice(1),t=t.replace(ie,E.cmd)),s.forEach(b=>{this.aliasMap[b]=E.cmd}),e!==!1&&this.usage.command(t,e,d,s,r),this.handlers[E.cmd]={original:t,description:e,handler:o,builder:n||{},middlewares:f,deprecated:r,demanded:E.demanded,optional:E.optional},d&&(this.defaultCommand=this.handlers[E.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,e,n,o,i,r){const s=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,f=e.getInternalMethods().getContext(),E=f.commands.slice(),d=!t;t&&(f.commands.push(t),f.fullCommands.push(s.original));const p=this.applyBuilderUpdateUsageAndParse(d,s,e,n.aliases,E,o,i,r);return yt(p)?p.then(b=>this.applyMiddlewareAndGetResult(d,s,b.innerArgv,f,i,b.aliases,e)):this.applyMiddlewareAndGetResult(d,s,p.innerArgv,f,i,p.aliases,e)}applyBuilderUpdateUsageAndParse(t,e,n,o,i,r,s,f){const E=e.builder;let d=n;if($n(E)){n.getInternalMethods().getUsageInstance().freeze();const p=E(n.getInternalMethods().reset(o),f);if(yt(p))return p.then(b=>(d=yo(b)?b:n,this.parseAndUpdateUsage(t,e,d,i,r,s)))}else Zs(E)&&(n.getInternalMethods().getUsageInstance().freeze(),d=n.getInternalMethods().reset(o),Object.keys(e.builder).forEach(p=>{d.option(p,E[p])}));return this.parseAndUpdateUsage(t,e,d,i,r,s)}parseAndUpdateUsage(t,e,n,o,i,r){t&&n.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(n)&&n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(o,e),e.description);const s=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,i,r);return yt(s)?s.then(f=>({aliases:n.parsed.aliases,innerArgv:f})):{aliases:n.parsed.aliases,innerArgv:s}}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,o=t.filter(i=>!ie.test(i));return o.push(n),`$0 ${o.join(" ")}`}handleValidationAndGetResult(t,e,n,o,i,r,s,f){if(!r.getInternalMethods().getHasOutput()){const E=r.getInternalMethods().runValidation(i,f,r.parsed.error,t);n=ye(n,d=>(E(d),d))}if(e.handler&&!r.getInternalMethods().getHasOutput()){r.getInternalMethods().setHasOutput();const E=!!r.getOptions().configuration["populate--"];r.getInternalMethods().postProcess(n,E,!1,!1),n=ge(n,r,s,!1),n=ye(n,d=>{const p=e.handler(d);return yt(p)?p.then(()=>d):d}),t||r.getInternalMethods().getUsageInstance().cacheHelpMessage(),yt(n)&&!r.getInternalMethods().hasParseCallback()&&n.catch(d=>{try{r.getInternalMethods().getUsageInstance().fail(null,d)}catch{}})}return t||(o.commands.pop(),o.fullCommands.pop()),n}applyMiddlewareAndGetResult(t,e,n,o,i,r,s){let f={};if(i)return n;s.getInternalMethods().getHasOutput()||(f=this.populatePositionals(e,n,o,s));const E=this.globalMiddleware.getMiddleware().slice(0).concat(e.middlewares),d=ge(n,s,E,!0);return yt(d)?d.then(p=>this.handleValidationAndGetResult(t,e,p,o,r,s,E,f)):this.handleValidationAndGetResult(t,e,d,o,r,s,E,f)}populatePositionals(t,e,n,o){e._=e._.slice(n.commands.length);const i=t.demanded.slice(0),r=t.optional.slice(0),s={};for(this.validation.positionalCount(i.length,e._.length);i.length;){const f=i.shift();this.populatePositional(f,e,s)}for(;r.length;){const f=r.shift();this.populatePositional(f,e,s)}return e._=n.commands.concat(e._.map(f=>""+f)),this.postProcessPositionals(e,s,this.cmdToParseOptions(t.original),o),s}populatePositional(t,e,n){const o=t.cmd[0];t.variadic?n[o]=e._.splice(0).map(String):e._.length&&(n[o]=[String(e._.shift())])}cmdToParseOptions(t){const e={array:[],default:{},alias:{},demand:{}},n=me(t);return n.demanded.forEach(o=>{const[i,...r]=o.cmd;o.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r,e.demand[i]=!0}),n.optional.forEach(o=>{const[i,...r]=o.cmd;o.variadic&&(e.array.push(i),e.default[i]=[]),e.alias[i]=r}),e}postProcessPositionals(t,e,n,o){const i=Object.assign({},o.getOptions());i.default=Object.assign(n.default,i.default);for(const E of Object.keys(n.alias))i.alias[E]=(i.alias[E]||[]).concat(n.alias[E]);i.array=i.array.concat(n.array),i.config={};const r=[];if(Object.keys(e).forEach(E=>{e[E].map(d=>{i.configuration["unknown-options-as-args"]&&(i.key[E]=!0),r.push(`--${E}`),r.push(d)})}),!r.length)return;const s=Object.assign({},i.configuration,{"populate--":!1}),f=this.shim.Parser.detailed(r,Object.assign({},i,{configuration:s}));if(f.error)o.getInternalMethods().getUsageInstance().fail(f.error.message,f.error);else{const E=Object.keys(e);Object.keys(e).forEach(d=>{E.push(...f.aliases[d])}),Object.keys(f.argv).forEach(d=>{E.includes(d)&&(e[d]||(e[d]=f.argv[d]),!this.isInConfigs(o,d)&&!this.isDefaulted(o,d)&&Object.prototype.hasOwnProperty.call(t,d)&&Object.prototype.hasOwnProperty.call(f.argv,d)&&(Array.isArray(t[d])||Array.isArray(f.argv[d]))?t[d]=[].concat(t[d],f.argv[d]):t[d]=f.argv[d])})}}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(o=>Object.prototype.hasOwnProperty.call(o,e))||n.some(o=>Object.prototype.hasOwnProperty.call(o,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($n(e))return e(t,!0);Or(e)||Object.keys(e).forEach(n=>{t.option(n,e[n])})}moduleName(t){const e=ks(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 o of[t,e,n]){if(typeof o=="string"||o===!1)return o;Ft(o,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();Ft(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 Qs(a,t,e,n){return new Ks(a,t,e,n)}function Or(a){return typeof a=="object"&&!!a.builder&&typeof a.handler=="function"}function Js(a){return a.every(t=>typeof t=="string")}function $n(a){return typeof a=="function"}function Zs(a){return typeof a=="object"}function to(a){return typeof a=="object"&&!Array.isArray(a)}function we(a={},t=()=>!0){const e={};return Re(a).forEach(n=>{t(n,a[n])&&(e[n]=a[n])}),e}function pe(a){typeof process>"u"||[process.stdout,process.stderr].forEach(t=>{const e=t;e._handle&&e.isTTY&&typeof e._handle.setBlocking=="function"&&e._handle.setBlocking(a)})}function eo(a){return typeof a=="boolean"}function no(a,t){const e=t.y18n.__,n={},o=[];n.failFn=function(B){o.push(B)};let i=null,r=null,s=!0;n.showHelpOnFail=function(B=!0,$){const[W,Y]=typeof B=="string"?[!0,B]:[B,$];return a.getInternalMethods().isGlobalContext()&&(r=Y),i=Y,s=W,n};let f=!1;n.fail=function(B,$){const W=a.getInternalMethods().getLoggerInstance();if(o.length)for(let Y=o.length-1;Y>=0;--Y){const k=o[Y];if(eo(k)){if($)throw $;if(B)throw Error(B)}else k(B,$,n)}else{if(a.getExitProcess()&&pe(!0),!f){f=!0,s&&(a.showHelp("error"),W.error()),(B||$)&&W.error(B||$);const Y=i||r;Y&&((B||$)&&W.error(""),W.error(Y))}if($=$||new gt(B),a.getExitProcess())return a.exit(1);if(a.getInternalMethods().hasParseCallback())return a.exit(1,$);throw $}};let E=[],d=!1;n.usage=(S,B)=>S===null?(d=!0,E=[],n):(d=!1,E.push([S,B||""]),n),n.getUsage=()=>E,n.getUsageDisabled=()=>d,n.getPositionalGroupName=()=>e("Positionals:");let p=[];n.example=(S,B)=>{p.push([S,B||""])};let b=[];n.command=function(B,$,W,Y,k=!1){W&&(b=b.map(V=>(V[2]=!1,V))),b.push([B,$||"",W,Y,k])},n.getCommands=()=>b;let w={};n.describe=function(B,$){Array.isArray(B)?B.forEach(W=>{n.describe(W,$)}):typeof B=="object"?Object.keys(B).forEach(W=>{n.describe(W,B[W])}):w[B]=$},n.getDescriptions=()=>w;let T=[];n.epilog=S=>{T.push(S)};let v=!1,I;n.wrap=S=>{v=!0,I=S},n.getWrap=()=>t.getEnv("YARGS_DISABLE_WRAP")?null:(v||(I=U(),v=!0),I);const D="__yargsString__:";n.deferY18nLookup=S=>D+S,n.help=function(){if(_)return _;g();const B=a.customScriptName?a.$0:t.path.basename(a.$0),$=a.getDemandedOptions(),W=a.getDemandedCommands(),Y=a.getDeprecatedOptions(),k=a.getGroups(),V=a.getOptions();let ft=[];ft=ft.concat(Object.keys(w)),ft=ft.concat(Object.keys($)),ft=ft.concat(Object.keys(W)),ft=ft.concat(Object.keys(V.default)),ft=ft.filter(X),ft=Object.keys(ft.reduce((Q,x)=>(x!=="_"&&(Q[x]=!0),Q),{}));const Ot=n.getWrap(),at=t.cliui({width:Ot,wrap:!!Ot});if(!d){if(E.length)E.forEach(Q=>{at.div({text:`${Q[0].replace(/\$0/g,B)}`}),Q[1]&&at.div({text:`${Q[1]}`,padding:[1,0,0,0]})}),at.div();else if(b.length){let Q=null;W._?Q=`${B} <${e("command")}>
|
|
30
|
+
`:Q=`${B} [${e("command")}]
|
|
31
|
+
`,at.div(`${Q}`)}}if(b.length>1||b.length===1&&!b[0][2]){at.div(e("Commands:"));const Q=a.getInternalMethods().getContext(),x=Q.commands.length?`${Q.commands.join(" ")} `:"";a.getInternalMethods().getParserConfiguration()["sort-commands"]===!0&&(b=b.sort((j,P)=>j[0].localeCompare(P[0])));const y=B?`${B} `:"";b.forEach(j=>{const P=`${y}${x}${j[0].replace(/^\$0 ?/,"")}`;at.span({text:P,padding:[0,2,0,2],width:C(b,Ot,`${B}${x}`)+4},{text:j[1]});const J=[];j[2]&&J.push(`[${e("default")}]`),j[3]&&j[3].length&&J.push(`[${e("aliases:")} ${j[3].join(", ")}]`),j[4]&&(typeof j[4]=="string"?J.push(`[${e("deprecated: %s",j[4])}]`):J.push(`[${e("deprecated")}]`)),J.length?at.div({text:J.join(" "),padding:[0,0,0,2],align:"right"}):at.div()}),at.div()}const st=(Object.keys(V.alias)||[]).concat(Object.keys(a.parsed.newAliases)||[]);ft=ft.filter(Q=>!a.parsed.newAliases[Q]&&st.every(x=>(V.alias[x]||[]).indexOf(Q)===-1));const ut=e("Options:");k[ut]||(k[ut]=[]),M(ft,V.alias,k,ut);const _t=Q=>/^--/.test(Oe(Q)),K=Object.keys(k).filter(Q=>k[Q].length>0).map(Q=>{const x=k[Q].filter(X).map(y=>{if(st.includes(y))return y;for(let j=0,P;(P=st[j])!==void 0;j++)if((V.alias[P]||[]).includes(y))return P;return y});return{groupName:Q,normalizedKeys:x}}).filter(({normalizedKeys:Q})=>Q.length>0).map(({groupName:Q,normalizedKeys:x})=>{const y=x.reduce((j,P)=>(j[P]=[P].concat(V.alias[P]||[]).map(J=>Q===n.getPositionalGroupName()?J:(/^[0-9]$/.test(J)?V.boolean.includes(P)?"-":"--":J.length>1?"--":"-")+J).sort((J,ot)=>_t(J)===_t(ot)?0:_t(J)?1:-1).join(", "),j),{});return{groupName:Q,normalizedKeys:x,switches:y}});if(K.filter(({groupName:Q})=>Q!==n.getPositionalGroupName()).some(({normalizedKeys:Q,switches:x})=>!Q.every(y=>_t(x[y])))&&K.filter(({groupName:Q})=>Q!==n.getPositionalGroupName()).forEach(({normalizedKeys:Q,switches:x})=>{Q.forEach(y=>{_t(x[y])&&(x[y]=ro(x[y],4))})}),K.forEach(({groupName:Q,normalizedKeys:x,switches:y})=>{at.div(Q),x.forEach(j=>{const P=y[j];let J=w[j]||"",ot=null;J.includes(D)&&(J=e(J.substring(D.length))),V.boolean.includes(j)&&(ot=`[${e("boolean")}]`),V.count.includes(j)&&(ot=`[${e("count")}]`),V.string.includes(j)&&(ot=`[${e("string")}]`),V.normalize.includes(j)&&(ot=`[${e("string")}]`),V.array.includes(j)&&(ot=`[${e("array")}]`),V.number.includes(j)&&(ot=`[${e("number")}]`);const rt=l=>typeof l=="string"?`[${e("deprecated: %s",l)}]`:`[${e("deprecated")}]`,ht=[j in Y?rt(Y[j]):null,ot,j in $?`[${e("required")}]`:null,V.choices&&V.choices[j]?`[${e("choices:")} ${n.stringifiedValues(V.choices[j])}]`:null,q(V.default[j],V.defaultDescription[j])].filter(Boolean).join(" ");at.span({text:Oe(P),padding:[0,2,0,2+Ir(P)],width:C(y,Ot)+4},J);const A=a.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;ht&&!A?at.div({text:ht,padding:[0,0,0,2],align:"right"}):at.div()}),at.div()}),p.length&&(at.div(e("Examples:")),p.forEach(Q=>{Q[0]=Q[0].replace(/\$0/g,B)}),p.forEach(Q=>{Q[1]===""?at.div({text:Q[0],padding:[0,2,0,2]}):at.div({text:Q[0],padding:[0,2,0,2],width:C(p,Ot)+4},{text:Q[1]})}),at.div()),T.length>0){const Q=T.map(x=>x.replace(/\$0/g,B)).join(`
|
|
32
|
+
`);at.div(`${Q}
|
|
33
|
+
`)}return at.toString().replace(/\s*$/,"")};function C(S,B,$){let W=0;return Array.isArray(S)||(S=Object.values(S).map(Y=>[Y])),S.forEach(Y=>{W=Math.max(t.stringWidth($?`${$} ${Oe(Y[0])}`:Oe(Y[0]))+Ir(Y[0]),W)}),B&&(W=Math.min(W,parseInt((B*.5).toString(),10))),W}function g(){const S=a.getDemandedOptions(),B=a.getOptions();(Object.keys(B.alias)||[]).forEach($=>{B.alias[$].forEach(W=>{w[W]&&n.describe($,w[W]),W in S&&a.demandOption($,S[W]),B.boolean.includes(W)&&a.boolean($),B.count.includes(W)&&a.count($),B.string.includes(W)&&a.string($),B.normalize.includes(W)&&a.normalize($),B.array.includes(W)&&a.array($),B.number.includes(W)&&a.number($)})})}let _;n.cacheHelpMessage=function(){_=this.help()},n.clearCachedHelpMessage=function(){_=void 0},n.hasCachedHelpMessage=function(){return!!_};function M(S,B,$,W){let Y=[],k=null;return Object.keys($).forEach(V=>{Y=Y.concat($[V])}),S.forEach(V=>{k=[V].concat(B[V]),k.some(ft=>Y.indexOf(ft)!==-1)||$[W].push(V)}),Y}function X(S){return a.getOptions().hiddenOptions.indexOf(S)<0||a.parsed.argv[a.getOptions().showHiddenOpt]}n.showHelp=S=>{const B=a.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:B[S])(n.help())},n.functionDescription=S=>["(",S.name?t.Parser.decamelize(S.name,"-"):e("generated-value"),")"].join(""),n.stringifiedValues=function(B,$){let W="";const Y=$||", ",k=[].concat(B);return!B||!k.length||k.forEach(V=>{W.length&&(W+=Y),W+=JSON.stringify(V)}),W};function q(S,B){let $=`[${e("default:")} `;if(S===void 0&&!B)return null;if(B)$+=B;else switch(typeof S){case"string":$+=`"${S}"`;break;case"object":$+=JSON.stringify(S);break;default:$+=S}return`${$}]`}function U(){return t.process.stdColumns?Math.min(80,t.process.stdColumns):80}let m=null;n.version=S=>{m=S},n.showVersion=S=>{const B=a.getInternalMethods().getLoggerInstance();S||(S="error"),(typeof S=="function"?S:B[S])(m)},n.reset=function(B){return i=null,f=!1,E=[],d=!1,T=[],p=[],b=[],w=we(w,$=>!B[$]),n};const R=[];return n.freeze=function(){R.push({failMessage:i,failureOutput:f,usages:E,usageDisabled:d,epilogs:T,examples:p,commands:b,descriptions:w})},n.unfreeze=function(B=!1){const $=R.pop();$&&(B?(w={...$.descriptions,...w},b=[...$.commands,...b],E=[...$.usages,...E],p=[...$.examples,...p],T=[...$.epilogs,...T]):{failMessage:i,failureOutput:f,usages:E,usageDisabled:d,epilogs:T,examples:p,commands:b,descriptions:w}=$)},n}function Yn(a){return typeof a=="object"}function ro(a,t){return Yn(a)?{text:a.text,indentation:a.indentation+t}:{text:a,indentation:t}}function Ir(a){return Yn(a)?a.indentation:0}function Oe(a){return Yn(a)?a.text:a}const io=`###-begin-{{app_name}}-completions-###
|
|
34
|
+
#
|
|
35
|
+
# yargs command completion script
|
|
36
|
+
#
|
|
37
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
|
|
38
|
+
# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
|
|
39
|
+
#
|
|
40
|
+
_{{app_name}}_yargs_completions()
|
|
41
|
+
{
|
|
42
|
+
local cur_word args type_list
|
|
43
|
+
|
|
44
|
+
cur_word="\${COMP_WORDS[COMP_CWORD]}"
|
|
45
|
+
args=("\${COMP_WORDS[@]}")
|
|
46
|
+
|
|
47
|
+
# ask yargs to generate completions.
|
|
48
|
+
type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
|
|
49
|
+
|
|
50
|
+
COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
|
|
51
|
+
|
|
52
|
+
# if no match was found, fall back to filename completion
|
|
53
|
+
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|
|
54
|
+
COMPREPLY=()
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
return 0
|
|
58
|
+
}
|
|
59
|
+
complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
|
|
60
|
+
###-end-{{app_name}}-completions-###
|
|
61
|
+
`,so=`#compdef {{app_name}}
|
|
62
|
+
###-begin-{{app_name}}-completions-###
|
|
63
|
+
#
|
|
64
|
+
# yargs command completion script
|
|
65
|
+
#
|
|
66
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
|
67
|
+
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
|
68
|
+
#
|
|
69
|
+
_{{app_name}}_yargs_completions()
|
|
70
|
+
{
|
|
71
|
+
local reply
|
|
72
|
+
local si=$IFS
|
|
73
|
+
IFS=$'
|
|
74
|
+
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
|
75
|
+
IFS=$si
|
|
76
|
+
_describe 'values' reply
|
|
77
|
+
}
|
|
78
|
+
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
79
|
+
###-end-{{app_name}}-completions-###
|
|
80
|
+
`;class oo{constructor(t,e,n,o){var i,r,s;this.yargs=t,this.usage=e,this.command=n,this.shim=o,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(s=((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&&s!==void 0?s:!1}defaultCompletion(t,e,n,o){const i=this.command.getCommandHandlers();for(let s=0,f=t.length;s<f;++s)if(i[t[s]]&&i[t[s]].builder){const E=i[t[s]].builder;if($n(E)){this.indexAfterLastReset=s+1;const d=this.yargs.getInternalMethods().reset();return E(d,!0),d.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),o(null,r)}commandCompletions(t,e,n){const o=this.yargs.getInternalMethods().getContext().commands;!n.match(/^-/)&&o[o.length-1]!==n&&!this.previousArgHasChoices(e)&&this.usage.getCommands().forEach(i=>{const r=me(i[0]).cmd;if(e.indexOf(r)===-1)if(!this.zshShell)t.push(r);else{const s=i[1]||"";t.push(r.replace(/:/g,"\\:")+":"+s)}})}optionCompletions(t,e,n,o){if((o.match(/^-/)||o===""&&t.length===0)&&!this.previousArgHasChoices(e)){const i=this.yargs.getOptions(),r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(i.key).forEach(s=>{const f=!!i.configuration["boolean-negation"]&&i.boolean.includes(s);!r.includes(s)&&!i.hiddenOptions.includes(s)&&!this.argsContainKey(e,s,f)&&this.completeOptionKey(s,t,o,f&&!!i.default[s])})}}choicesFromOptionsCompletions(t,e,n,o){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,o){if(o===""&&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),s=i[n._.length-r-1];if(!s)return;const f=this.yargs.getOptions().choices[s]||[];for(const E of f)E.startsWith(o)&&t.push(E.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let e=t[t.length-1],n="";if(!e.startsWith("-")&&t.length>1&&(n=e,e=t[t.length-2]),!e.startsWith("-"))return;const o=e.replace(/^-+/,""),i=this.yargs.getOptions(),r=[o,...this.yargs.getAliases()[o]||[]];let s;for(const f of r)if(Object.prototype.hasOwnProperty.call(i.key,f)&&Array.isArray(i.choices[f])){s=i.choices[f];break}if(s)return s.filter(f=>!n||f.startsWith(n))}previousArgHasChoices(t){const e=this.getPreviousArgChoices(t);return e!==void 0&&e.length>0}argsContainKey(t,e,n){const o=i=>t.indexOf((/^[^0-9]$/.test(i)?"-":"--")+i)!==-1;if(o(e)||n&&o(`no-${e}`))return!0;if(this.aliases){for(const i of this.aliases[e])if(o(i))return!0}return!1}completeOptionKey(t,e,n,o){var i,r,s,f;let E=t;if(this.zshShell){const w=this.usage.getDescriptions(),T=(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(D=>{const C=w[D];return typeof C=="string"&&C.length>0}),v=T?w[T]:void 0,I=(f=(s=w[t])!==null&&s!==void 0?s:v)!==null&&f!==void 0?f:"";E=`${t.replace(/:/g,"\\:")}:${I.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const d=w=>/^--/.test(w),p=w=>/^[^0-9]$/.test(w),b=!d(n)&&p(t)?"-":"--";e.push(b+E),o&&e.push(b+"no-"+E)}customCompletion(t,e,n,o){if(Ft(this.customCompletionFunction,null,this.shim),uo(this.customCompletionFunction)){const i=this.customCompletionFunction(n,e);return yt(i)?i.then(r=>{this.shim.process.nextTick(()=>{o(null,r)})}).catch(r=>{this.shim.process.nextTick(()=>{o(r,void 0)})}):o(null,i)}else return co(this.customCompletionFunction)?this.customCompletionFunction(n,e,(i=o)=>this.defaultCompletion(t,e,n,i),i=>{o(null,i)}):this.customCompletionFunction(n,e,i=>{o(null,i)})}getCompletion(t,e){const n=t.length?t[t.length-1]:"",o=this.yargs.parse(t,!0),i=this.customCompletionFunction?r=>this.customCompletion(t,r,n,e):r=>this.defaultCompletion(t,r,n,e);return yt(o)?o.then(i):i(o)}generateCompletionScript(t,e){let n=this.zshShell?so:io;const o=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),n=n.replace(/{{app_name}}/g,o),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 ao(a,t,e,n){return new oo(a,t,e,n)}function uo(a){return a.length<3}function co(a){return a.length>3}function lo(a,t){if(a.length===0)return t.length;if(t.length===0)return a.length;const e=[];let n;for(n=0;n<=t.length;n++)e[n]=[n];let o;for(o=0;o<=a.length;o++)e[0][o]=o;for(n=1;n<=t.length;n++)for(o=1;o<=a.length;o++)t.charAt(n-1)===a.charAt(o-1)?e[n][o]=e[n-1][o-1]:n>1&&o>1&&t.charAt(n-2)===a.charAt(o-1)&&t.charAt(n-1)===a.charAt(o-2)?e[n][o]=e[n-2][o-2]+1:e[n][o]=Math.min(e[n-1][o-1]+1,Math.min(e[n][o-1]+1,e[n-1][o]+1));return e[t.length][a.length]}const Cr=["$0","--","_"];function fo(a,t,e){const n=e.y18n.__,o=e.y18n.__n,i={};i.nonOptionCount=function(p){const b=a.getDemandedCommands(),T=p._.length+(p["--"]?p["--"].length:0)-a.getInternalMethods().getContext().commands.length;b._&&(T<b._.min||T>b._.max)&&(T<b._.min?b._.minMsg!==void 0?t.fail(b._.minMsg?b._.minMsg.replace(/\$0/g,T.toString()).replace(/\$1/,b._.min.toString()):null):t.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",T,T.toString(),b._.min.toString())):T>b._.max&&(b._.maxMsg!==void 0?t.fail(b._.maxMsg?b._.maxMsg.replace(/\$0/g,T.toString()).replace(/\$1/,b._.max.toString()):null):t.fail(o("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",T,T.toString(),b._.max.toString()))))},i.positionalCount=function(p,b){b<p&&t.fail(o("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",b,b+"",p+""))},i.requiredArguments=function(p,b){let w=null;for(const T of Object.keys(b))(!Object.prototype.hasOwnProperty.call(p,T)||typeof p[T]>"u")&&(w=w||{},w[T]=b[T]);if(w){const T=[];for(const I of Object.keys(w)){const D=w[I];D&&T.indexOf(D)<0&&T.push(D)}const v=T.length?`
|
|
81
|
+
${T.join(`
|
|
82
|
+
`)}`:"";t.fail(o("Missing required argument: %s","Missing required arguments: %s",Object.keys(w).length,Object.keys(w).join(", ")+v))}},i.unknownArguments=function(p,b,w,T,v=!0){var I;const D=a.getInternalMethods().getCommandInstance().getCommands(),C=[],g=a.getInternalMethods().getContext();if(Object.keys(p).forEach(_=>{!Cr.includes(_)&&!Object.prototype.hasOwnProperty.call(w,_)&&!Object.prototype.hasOwnProperty.call(a.getInternalMethods().getParseContext(),_)&&!i.isValidAndSomeAliasIsNotNew(_,b)&&C.push(_)}),v&&(g.commands.length>0||D.length>0||T)&&p._.slice(g.commands.length).forEach(_=>{D.includes(""+_)||C.push(""+_)}),v){const M=((I=a.getDemandedCommands()._)===null||I===void 0?void 0:I.max)||0,X=g.commands.length+M;X<p._.length&&p._.slice(X).forEach(q=>{q=String(q),!g.commands.includes(q)&&!C.includes(q)&&C.push(q)})}C.length&&t.fail(o("Unknown argument: %s","Unknown arguments: %s",C.length,C.map(_=>_.trim()?_:`"${_}"`).join(", ")))},i.unknownCommands=function(p){const b=a.getInternalMethods().getCommandInstance().getCommands(),w=[],T=a.getInternalMethods().getContext();return(T.commands.length>0||b.length>0)&&p._.slice(T.commands.length).forEach(v=>{b.includes(""+v)||w.push(""+v)}),w.length>0?(t.fail(o("Unknown command: %s","Unknown commands: %s",w.length,w.join(", "))),!0):!1},i.isValidAndSomeAliasIsNotNew=function(p,b){if(!Object.prototype.hasOwnProperty.call(b,p))return!1;const w=a.parsed.newAliases;return[p,...b[p]].some(T=>!Object.prototype.hasOwnProperty.call(w,T)||!w[p])},i.limitedChoices=function(p){const b=a.getOptions(),w={};if(!Object.keys(b.choices).length)return;Object.keys(p).forEach(I=>{Cr.indexOf(I)===-1&&Object.prototype.hasOwnProperty.call(b.choices,I)&&[].concat(p[I]).forEach(D=>{b.choices[I].indexOf(D)===-1&&D!==void 0&&(w[I]=(w[I]||[]).concat(D))})});const T=Object.keys(w);if(!T.length)return;let v=n("Invalid values:");T.forEach(I=>{v+=`
|
|
83
|
+
${n("Argument: %s, Given: %s, Choices: %s",I,t.stringifiedValues(w[I]),t.stringifiedValues(b.choices[I]))}`}),t.fail(v)};let r={};i.implies=function(p,b){z("<string|object> [array|number|string]",[p,b],arguments.length),typeof p=="object"?Object.keys(p).forEach(w=>{i.implies(w,p[w])}):(a.global(p),r[p]||(r[p]=[]),Array.isArray(b)?b.forEach(w=>i.implies(p,w)):(Ft(b,void 0,e),r[p].push(b)))},i.getImplied=function(){return r};function s(d,p){const b=Number(p);return p=isNaN(b)?p:b,typeof p=="number"?p=d._.length>=p:p.match(/^--no-.+/)?(p=p.match(/^--no-(.+)/)[1],p=!Object.prototype.hasOwnProperty.call(d,p)):p=Object.prototype.hasOwnProperty.call(d,p),p}i.implications=function(p){const b=[];if(Object.keys(r).forEach(w=>{const T=w;(r[w]||[]).forEach(v=>{let I=T;const D=v;I=s(p,I),v=s(p,v),I&&!v&&b.push(` ${T} -> ${D}`)})}),b.length){let w=`${n("Implications failed:")}
|
|
84
|
+
`;b.forEach(T=>{w+=T}),t.fail(w)}};let f={};i.conflicts=function(p,b){z("<string|object> [array|string]",[p,b],arguments.length),typeof p=="object"?Object.keys(p).forEach(w=>{i.conflicts(w,p[w])}):(a.global(p),f[p]||(f[p]=[]),Array.isArray(b)?b.forEach(w=>i.conflicts(p,w)):f[p].push(b))},i.getConflicting=()=>f,i.conflicting=function(p){Object.keys(p).forEach(b=>{f[b]&&f[b].forEach(w=>{w&&p[b]!==void 0&&p[w]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",b,w))})}),a.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(f).forEach(b=>{f[b].forEach(w=>{w&&p[e.Parser.camelCase(b)]!==void 0&&p[e.Parser.camelCase(w)]!==void 0&&t.fail(n("Arguments %s and %s are mutually exclusive",b,w))})})},i.recommendCommands=function(p,b){b=b.sort((I,D)=>D.length-I.length);let T=null,v=1/0;for(let I=0,D;(D=b[I])!==void 0;I++){const C=lo(p,D);C<=3&&C<v&&(v=C,T=D)}T&&t.fail(n("Did you mean %s?",T))},i.reset=function(p){return r=we(r,b=>!p[b]),f=we(f,b=>!p[b]),i};const E=[];return i.freeze=function(){E.push({implied:r,conflicting:f})},i.unfreeze=function(){const p=E.pop();Ft(p,void 0,e),{implied:r,conflicting:f}=p},i}let qn=[],de;function Wn(a,t,e,n){de=n;let o={};if(Object.prototype.hasOwnProperty.call(a,"extends")){if(typeof a.extends!="string")return o;const i=/\.json|\..*rc$/.test(a.extends);let r=null;if(i)r=po(t,a.extends);else try{r=require.resolve(a.extends)}catch{return a}ho(r),qn.push(r),o=i?JSON.parse(de.readFileSync(r,"utf8")):require(a.extends),delete a.extends,o=Wn(o,de.path.dirname(r),e,de)}return qn=[],e?Ki(o,a):Object.assign({},o,a)}function ho(a){if(qn.indexOf(a)>-1)throw new gt(`Circular extended configurations: '${a}'.`)}function po(a,t){return de.path.resolve(a,t)}function Ki(a,t){const e={};function n(o){return o&&typeof o=="object"&&!Array.isArray(o)}Object.assign(e,a);for(const o of Object.keys(t))n(t[o])&&n(e[o])?e[o]=Ki(a[o],t[o]):e[o]=t[o];return e}var H=function(a,t,e,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?a!==t||!o:!t.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(a,e):o?o.value=e:t.set(a,e),e},O=function(a,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?a!==t||!n:!t.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(a):n?n.value:t.get(a)},mt,Yt,ce,vt,It,Ie,Vt,Gt,Ce,Nt,Te,At,jt,Ct,Mt,De,se,wt,G,_e,ve,Tt,kt,oe,Kt,Ht,Ne,tt,Qt,Jt,Zt,et,Ae,Rt,dt;function mo(a){return(t=[],e=a.process.cwd(),n)=>{const o=new go(t,e,n,a);return Object.defineProperty(o,"argv",{get:()=>o.parse(),enumerable:!0}),o.help(),o.version(),o}}const Tr=Symbol("copyDoubleDash"),Dr=Symbol("copyDoubleDash"),ze=Symbol("deleteFromParserHintObject"),_r=Symbol("emitWarning"),vr=Symbol("freeze"),Nr=Symbol("getDollarZero"),te=Symbol("getParserConfiguration"),Ar=Symbol("getUsageConfiguration"),Ye=Symbol("guessLocale"),Mr=Symbol("guessVersion"),Pr=Symbol("parsePositionalNumbers"),Ge=Symbol("pkgUp"),zt=Symbol("populateParserHintArray"),ae=Symbol("populateParserHintSingleValueDictionary"),ke=Symbol("populateParserHintArrayDictionary"),Ke=Symbol("populateParserHintDictionary"),Qe=Symbol("sanitizeKey"),Je=Symbol("setKey"),Ze=Symbol("unfreeze"),Lr=Symbol("validateAsync"),Sr=Symbol("getCommandInstance"),Fr=Symbol("getContext"),jr=Symbol("getHasOutput"),Rr=Symbol("getLoggerInstance"),Br=Symbol("getParseContext"),Ur=Symbol("getUsageInstance"),Xr=Symbol("getValidationInstance"),Me=Symbol("hasParseCallback"),$r=Symbol("isGlobalContext"),ee=Symbol("postProcess"),qr=Symbol("rebase"),tn=Symbol("reset"),le=Symbol("runYargsParserAndExecuteCommands"),en=Symbol("runValidation"),Wr=Symbol("setHasOutput"),ne=Symbol("kTrackManuallySetKeys");class go{constructor(t=[],e,n,o){this.customScriptName=!1,this.parsed=!1,mt.set(this,void 0),Yt.set(this,void 0),ce.set(this,{commands:[],fullCommands:[]}),vt.set(this,null),It.set(this,null),Ie.set(this,"show-hidden"),Vt.set(this,null),Gt.set(this,!0),Ce.set(this,{}),Nt.set(this,!0),Te.set(this,[]),At.set(this,void 0),jt.set(this,{}),Ct.set(this,!1),Mt.set(this,null),De.set(this,!0),se.set(this,void 0),wt.set(this,""),G.set(this,void 0),_e.set(this,void 0),ve.set(this,{}),Tt.set(this,null),kt.set(this,null),oe.set(this,{}),Kt.set(this,{}),Ht.set(this,void 0),Ne.set(this,!1),tt.set(this,void 0),Qt.set(this,!1),Jt.set(this,!1),Zt.set(this,!1),et.set(this,void 0),Ae.set(this,{}),Rt.set(this,null),dt.set(this,void 0),H(this,tt,o,"f"),H(this,Ht,t,"f"),H(this,Yt,e,"f"),H(this,_e,n,"f"),H(this,At,new zs(this),"f"),this.$0=this[Nr](),this[tn](),H(this,mt,O(this,mt,"f"),"f"),H(this,et,O(this,et,"f"),"f"),H(this,dt,O(this,dt,"f"),"f"),H(this,G,O(this,G,"f"),"f"),O(this,G,"f").showHiddenOpt=O(this,Ie,"f"),H(this,se,this[Dr](),"f")}addHelpOpt(t,e){const n="help";return z("[string|boolean] [string]",[t,e],arguments.length),O(this,Mt,"f")&&(this[ze](O(this,Mt,"f")),H(this,Mt,null,"f")),t===!1&&e===void 0?this:(H(this,Mt,typeof t=="string"?t:n,"f"),this.boolean(O(this,Mt,"f")),this.describe(O(this,Mt,"f"),e||O(this,et,"f").deferY18nLookup("Show help")),this)}help(t,e){return this.addHelpOpt(t,e)}addShowHiddenOpt(t,e){if(z("[string|boolean] [string]",[t,e],arguments.length),t===!1&&e===void 0)return this;const n=typeof t=="string"?t:O(this,Ie,"f");return this.boolean(n),this.describe(n,e||O(this,et,"f").deferY18nLookup("Show hidden options")),O(this,G,"f").showHiddenOpt=n,this}showHidden(t,e){return this.addShowHiddenOpt(t,e)}alias(t,e){return z("<object|string|array> [string|array]",[t,e],arguments.length),this[ke](this.alias.bind(this),"alias",t,e),this}array(t){return z("<array|string>",[t],arguments.length),this[zt]("array",t),this[ne](t),this}boolean(t){return z("<array|string>",[t],arguments.length),this[zt]("boolean",t),this[ne](t),this}check(t,e){return z("<function> [boolean]",[t,e],arguments.length),this.middleware((n,o)=>ye(()=>t(n,o.getOptions()),i=>(i?(typeof i=="string"||i instanceof Error)&&O(this,et,"f").fail(i.toString(),i):O(this,et,"f").fail(O(this,tt,"f").y18n.__("Argument check failed: %s",t.toString())),n),i=>(O(this,et,"f").fail(i.message?i.message:i.toString(),i),n)),!1,e),this}choices(t,e){return z("<object|string|array> [string|array]",[t,e],arguments.length),this[ke](this.choices.bind(this),"choices",t,e),this}coerce(t,e){if(z("<object|string|array> [function]",[t,e],arguments.length),Array.isArray(t)){if(!e)throw new gt("coerce callback must be provided");for(const n of t)this.coerce(n,e);return this}else if(typeof t=="object"){for(const n of Object.keys(t))this.coerce(n,t[n]);return this}if(!e)throw new gt("coerce callback must be provided");return O(this,G,"f").key[t]=!0,O(this,At,"f").addCoerceMiddleware((n,o)=>{let i;return Object.prototype.hasOwnProperty.call(n,t)?ye(()=>(i=o.getAliases(),e(n[t])),s=>{n[t]=s;const f=o.getInternalMethods().getParserConfiguration()["strip-aliased"];if(i[t]&&f!==!0)for(const E of i[t])n[E]=s;return n},s=>{throw new gt(s.message)}):n},t),this}conflicts(t,e){return z("<string|object> [string|array]",[t,e],arguments.length),O(this,dt,"f").conflicts(t,e),this}config(t="config",e,n){return z("[object|string] [string|function] [function]",[t,e,n],arguments.length),typeof t=="object"&&!Array.isArray(t)?(t=Wn(t,O(this,Yt,"f"),this[te]()["deep-merge-config"]||!1,O(this,tt,"f")),O(this,G,"f").configObjects=(O(this,G,"f").configObjects||[]).concat(t),this):(typeof e=="function"&&(n=e,e=void 0),this.describe(t,e||O(this,et,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach(o=>{O(this,G,"f").config[o]=n||!0}),this)}completion(t,e,n){return z("[string] [string|boolean|function] [function]",[t,e,n],arguments.length),typeof e=="function"&&(n=e,e=void 0),H(this,It,t||O(this,It,"f")||"completion","f"),!e&&e!==!1&&(e="generate completion script"),this.command(O(this,It,"f"),e),n&&O(this,vt,"f").registerFunction(n),this}command(t,e,n,o,i,r){return z("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,e,n,o,i,r],arguments.length),O(this,mt,"f").addHandler(t,e,n,o,i,r),this}commands(t,e,n,o,i,r){return this.command(t,e,n,o,i,r)}commandDir(t,e){z("<string> [object]",[t,e],arguments.length);const n=O(this,_e,"f")||O(this,tt,"f").require;return O(this,mt,"f").addDirectory(t,n,O(this,tt,"f").getCallerFile(),e),this}count(t){return z("<array|string>",[t],arguments.length),this[zt]("count",t),this[ne](t),this}default(t,e,n){return z("<object|string|array> [*] [string]",[t,e,n],arguments.length),n&&(wr(t,O(this,tt,"f")),O(this,G,"f").defaultDescription[t]=n),typeof e=="function"&&(wr(t,O(this,tt,"f")),O(this,G,"f").defaultDescription[t]||(O(this,G,"f").defaultDescription[t]=O(this,et,"f").functionDescription(e)),e=e.call()),this[ae](this.default.bind(this),"default",t,e),this}defaults(t,e,n){return this.default(t,e,n)}demandCommand(t=1,e,n,o){return z("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,e,n,o],arguments.length),typeof e!="number"&&(n=e,e=1/0),this.global("_",!1),O(this,G,"f").demandedCommands._={min:t,max:e,minMsg:n,maxMsg:o},this}demand(t,e,n){return Array.isArray(e)?(e.forEach(o=>{Ft(n,!0,O(this,tt,"f")),this.demandOption(o,n)}),e=1/0):typeof e!="number"&&(n=e,e=1/0),typeof t=="number"?(Ft(n,!0,O(this,tt,"f")),this.demandCommand(t,e,n,n)):Array.isArray(t)?t.forEach(o=>{Ft(n,!0,O(this,tt,"f")),this.demandOption(o,n)}):typeof n=="string"?this.demandOption(t,n):(n===!0||typeof n>"u")&&this.demandOption(t),this}demandOption(t,e){return z("<object|string|array> [string]",[t,e],arguments.length),this[ae](this.demandOption.bind(this),"demandedOptions",t,e),this}deprecateOption(t,e){return z("<string> [string|boolean]",[t,e],arguments.length),O(this,G,"f").deprecatedOptions[t]=e,this}describe(t,e){return z("<object|string|array> [string]",[t,e],arguments.length),this[Je](t,!0),O(this,et,"f").describe(t,e),this}detectLocale(t){return z("<boolean>",[t],arguments.length),H(this,Gt,t,"f"),this}env(t){return z("[string|boolean]",[t],arguments.length),t===!1?delete O(this,G,"f").envPrefix:O(this,G,"f").envPrefix=t||"",this}epilogue(t){return z("<string>",[t],arguments.length),O(this,et,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,e){return z("<string|array> [string]",[t,e],arguments.length),Array.isArray(t)?t.forEach(n=>this.example(...n)):O(this,et,"f").example(t,e),this}exit(t,e){H(this,Ct,!0,"f"),H(this,Vt,e,"f"),O(this,Nt,"f")&&O(this,tt,"f").process.exit(t)}exitProcess(t=!0){return z("[boolean]",[t],arguments.length),H(this,Nt,t,"f"),this}fail(t){if(z("<function|boolean>",[t],arguments.length),typeof t=="boolean"&&t!==!1)throw new gt("Invalid first argument. Expected function or boolean 'false'");return O(this,et,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,e){return z("<array> [function]",[t,e],arguments.length),e?O(this,vt,"f").getCompletion(t,e):new Promise((n,o)=>{O(this,vt,"f").getCompletion(t,(i,r)=>{i?o(i):n(r)})})}getDemandedOptions(){return z([],0),O(this,G,"f").demandedOptions}getDemandedCommands(){return z([],0),O(this,G,"f").demandedCommands}getDeprecatedOptions(){return z([],0),O(this,G,"f").deprecatedOptions}getDetectLocale(){return O(this,Gt,"f")}getExitProcess(){return O(this,Nt,"f")}getGroups(){return Object.assign({},O(this,jt,"f"),O(this,Kt,"f"))}getHelp(){if(H(this,Ct,!0,"f"),!O(this,et,"f").hasCachedHelpMessage()){if(!this.parsed){const e=this[le](O(this,Ht,"f"),void 0,void 0,0,!0);if(yt(e))return e.then(()=>O(this,et,"f").help())}const t=O(this,mt,"f").runDefaultBuilderOn(this);if(yt(t))return t.then(()=>O(this,et,"f").help())}return Promise.resolve(O(this,et,"f").help())}getOptions(){return O(this,G,"f")}getStrict(){return O(this,Qt,"f")}getStrictCommands(){return O(this,Jt,"f")}getStrictOptions(){return O(this,Zt,"f")}global(t,e){return z("<string|array> [boolean]",[t,e],arguments.length),t=[].concat(t),e!==!1?O(this,G,"f").local=O(this,G,"f").local.filter(n=>t.indexOf(n)===-1):t.forEach(n=>{O(this,G,"f").local.includes(n)||O(this,G,"f").local.push(n)}),this}group(t,e){z("<string|array> <string>",[t,e],arguments.length);const n=O(this,Kt,"f")[e]||O(this,jt,"f")[e];O(this,Kt,"f")[e]&&delete O(this,Kt,"f")[e];const o={};return O(this,jt,"f")[e]=(n||[]).concat(t).filter(i=>o[i]?!1:o[i]=!0),this}hide(t){return z("<string>",[t],arguments.length),O(this,G,"f").hiddenOptions.push(t),this}implies(t,e){return z("<string|object> [number|string|array]",[t,e],arguments.length),O(this,dt,"f").implies(t,e),this}locale(t){return z("[string]",[t],arguments.length),t===void 0?(this[Ye](),O(this,tt,"f").y18n.getLocale()):(H(this,Gt,!1,"f"),O(this,tt,"f").y18n.setLocale(t),this)}middleware(t,e,n){return O(this,At,"f").addMiddleware(t,!!e,n)}nargs(t,e){return z("<string|object|array> [number]",[t,e],arguments.length),this[ae](this.nargs.bind(this),"narg",t,e),this}normalize(t){return z("<array|string>",[t],arguments.length),this[zt]("normalize",t),this}number(t){return z("<array|string>",[t],arguments.length),this[zt]("number",t),this[ne](t),this}option(t,e){if(z("<string|object> [object]",[t,e],arguments.length),typeof t=="object")Object.keys(t).forEach(n=>{this.options(n,t[n])});else{typeof e!="object"&&(e={}),this[ne](t),O(this,Rt,"f")&&(t==="version"||e?.alias==="version")&&this[_r](['"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(`
|
|
85
|
+
`),void 0,"versionWarning"),O(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 o=e.demand||e.required||e.require;o&&this.demand(t,o),e.demandOption&&this.demandOption(t,typeof e.demandOption=="string"?e.demandOption:void 0),e.conflicts&&this.conflicts(t,e.conflicts),"default"in e&&this.default(t,e.default),e.implies!==void 0&&this.implies(t,e.implies),e.nargs!==void 0&&this.nargs(t,e.nargs),e.config&&this.config(t,e.configParser),e.normalize&&this.normalize(t),e.choices&&this.choices(t,e.choices),e.coerce&&this.coerce(t,e.coerce),e.group&&this.group(t,e.group),(e.boolean||e.type==="boolean")&&(this.boolean(t),e.alias&&this.boolean(e.alias)),(e.array||e.type==="array")&&(this.array(t),e.alias&&this.array(e.alias)),(e.number||e.type==="number")&&(this.number(t),e.alias&&this.number(e.alias)),(e.string||e.type==="string")&&(this.string(t),e.alias&&this.string(e.alias)),(e.count||e.type==="count")&&this.count(t),typeof e.global=="boolean"&&this.global(t,e.global),e.defaultDescription&&(O(this,G,"f").defaultDescription[t]=e.defaultDescription),e.skipValidation&&this.skipValidation(t);const i=e.describe||e.description||e.desc,r=O(this,et,"f").getDescriptions();(!Object.prototype.hasOwnProperty.call(r,t)||typeof i=="string")&&this.describe(t,i),e.hidden&&this.hide(t),e.requiresArg&&this.requiresArg(t)}return this}options(t,e){return this.option(t,e)}parse(t,e,n){z("[string|array] [function|boolean|object] [function]",[t,e,n],arguments.length),this[vr](),typeof t>"u"&&(t=O(this,Ht,"f")),typeof e=="object"&&(H(this,kt,e,"f"),e=n),typeof e=="function"&&(H(this,Tt,e,"f"),e=!1),e||H(this,Ht,t,"f"),O(this,Tt,"f")&&H(this,Nt,!1,"f");const o=this[le](t,!!e),i=this.parsed;return O(this,vt,"f").setParsed(this.parsed),yt(o)?o.then(r=>(O(this,Tt,"f")&&O(this,Tt,"f").call(this,O(this,Vt,"f"),r,O(this,wt,"f")),r)).catch(r=>{throw O(this,Tt,"f")&&O(this,Tt,"f")(r,this.parsed.argv,O(this,wt,"f")),r}).finally(()=>{this[Ze](),this.parsed=i}):(O(this,Tt,"f")&&O(this,Tt,"f").call(this,O(this,Vt,"f"),o,O(this,wt,"f")),this[Ze](),this.parsed=i,o)}parseAsync(t,e,n){const o=this.parse(t,e,n);return yt(o)?o:Promise.resolve(o)}parseSync(t,e,n){const o=this.parse(t,e,n);if(yt(o))throw new gt(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return o}parserConfiguration(t){return z("<object>",[t],arguments.length),H(this,ve,t,"f"),this}pkgConf(t,e){z("<string> [string]",[t,e],arguments.length);let n=null;const o=this[Ge](e||O(this,Yt,"f"));return o[t]&&typeof o[t]=="object"&&(n=Wn(o[t],e||O(this,Yt,"f"),this[te]()["deep-merge-config"]||!1,O(this,tt,"f")),O(this,G,"f").configObjects=(O(this,G,"f").configObjects||[]).concat(n)),this}positional(t,e){z("<string> <object>",[t,e],arguments.length);const n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];e=we(e,(r,s)=>r==="type"&&!["string","number","boolean"].includes(s)?!1:n.includes(r));const o=O(this,ce,"f").fullCommands[O(this,ce,"f").fullCommands.length-1],i=o?O(this,mt,"f").cmdToParseOptions(o):{array:[],alias:{},default:{},demand:{}};return Re(i).forEach(r=>{const s=i[r];Array.isArray(s)?s.indexOf(t)!==-1&&(e[r]=!0):s[t]&&!(r in e)&&(e[r]=s[t])}),this.group(t,O(this,et,"f").getPositionalGroupName()),this.option(t,e)}recommendCommands(t=!0){return z("[boolean]",[t],arguments.length),H(this,Ne,t,"f"),this}required(t,e,n){return this.demand(t,e,n)}require(t,e,n){return this.demand(t,e,n)}requiresArg(t){return z("<array|string|object> [number]",[t],arguments.length),typeof t=="string"&&O(this,G,"f").narg[t]?this:(this[ae](this.requiresArg.bind(this),"narg",t,NaN),this)}showCompletionScript(t,e){return z("[string] [string]",[t,e],arguments.length),t=t||this.$0,O(this,se,"f").log(O(this,vt,"f").generateCompletionScript(t,e||O(this,It,"f")||"completion")),this}showHelp(t){if(z("[string|function]",[t],arguments.length),H(this,Ct,!0,"f"),!O(this,et,"f").hasCachedHelpMessage()){if(!this.parsed){const n=this[le](O(this,Ht,"f"),void 0,void 0,0,!0);if(yt(n))return n.then(()=>{O(this,et,"f").showHelp(t)}),this}const e=O(this,mt,"f").runDefaultBuilderOn(this);if(yt(e))return e.then(()=>{O(this,et,"f").showHelp(t)}),this}return O(this,et,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,e){return z("[boolean|string] [string]",[t,e],arguments.length),O(this,et,"f").showHelpOnFail(t,e),this}showVersion(t){return z("[string|function]",[t],arguments.length),O(this,et,"f").showVersion(t),this}skipValidation(t){return z("<array|string>",[t],arguments.length),this[zt]("skipValidation",t),this}strict(t){return z("[boolean]",[t],arguments.length),H(this,Qt,t!==!1,"f"),this}strictCommands(t){return z("[boolean]",[t],arguments.length),H(this,Jt,t!==!1,"f"),this}strictOptions(t){return z("[boolean]",[t],arguments.length),H(this,Zt,t!==!1,"f"),this}string(t){return z("<array|string>",[t],arguments.length),this[zt]("string",t),this[ne](t),this}terminalWidth(){return z([],0),O(this,tt,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return z("<object>",[t],arguments.length),H(this,Gt,!1,"f"),O(this,tt,"f").y18n.updateLocale(t),this}usage(t,e,n,o){if(z("<string|null|undefined> [string|boolean] [function|object] [function]",[t,e,n,o],arguments.length),e!==void 0){if(Ft(t,null,O(this,tt,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,e,n,o);throw new gt(".usage() description must start with $0 if being used as alias for .command()")}else return O(this,et,"f").usage(t),this}usageConfiguration(t){return z("<object>",[t],arguments.length),H(this,Ae,t,"f"),this}version(t,e,n){const o="version";if(z("[boolean|string] [string] [string]",[t,e,n],arguments.length),O(this,Rt,"f")&&(this[ze](O(this,Rt,"f")),O(this,et,"f").version(void 0),H(this,Rt,null,"f")),arguments.length===0)n=this[Mr](),t=o;else if(arguments.length===1){if(t===!1)return this;n=t,t=o}else arguments.length===2&&(n=e,e=void 0);return H(this,Rt,typeof t=="string"?t:o,"f"),e=e||O(this,et,"f").deferY18nLookup("Show version number"),O(this,et,"f").version(n||void 0),this.boolean(O(this,Rt,"f")),this.describe(O(this,Rt,"f"),e),this}wrap(t){return z("<number|null|undefined>",[t],arguments.length),O(this,et,"f").wrap(t),this}[(mt=new WeakMap,Yt=new WeakMap,ce=new WeakMap,vt=new WeakMap,It=new WeakMap,Ie=new WeakMap,Vt=new WeakMap,Gt=new WeakMap,Ce=new WeakMap,Nt=new WeakMap,Te=new WeakMap,At=new WeakMap,jt=new WeakMap,Ct=new WeakMap,Mt=new WeakMap,De=new WeakMap,se=new WeakMap,wt=new WeakMap,G=new WeakMap,_e=new WeakMap,ve=new WeakMap,Tt=new WeakMap,kt=new WeakMap,oe=new WeakMap,Kt=new WeakMap,Ht=new WeakMap,Ne=new WeakMap,tt=new WeakMap,Qt=new WeakMap,Jt=new WeakMap,Zt=new WeakMap,et=new WeakMap,Ae=new WeakMap,Rt=new WeakMap,dt=new WeakMap,Tr)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch{}return t}[Dr](){return{log:(...t)=>{this[Me]()||console.log(...t),H(this,Ct,!0,"f"),O(this,wt,"f").length&&H(this,wt,O(this,wt,"f")+`
|
|
86
|
+
`,"f"),H(this,wt,O(this,wt,"f")+t.join(" "),"f")},error:(...t)=>{this[Me]()||console.error(...t),H(this,Ct,!0,"f"),O(this,wt,"f").length&&H(this,wt,O(this,wt,"f")+`
|
|
87
|
+
`,"f"),H(this,wt,O(this,wt,"f")+t.join(" "),"f")}}}[ze](t){Re(O(this,G,"f")).forEach(e=>{if((o=>o==="configObjects")(e))return;const n=O(this,G,"f")[e];Array.isArray(n)?n.includes(t)&&n.splice(n.indexOf(t),1):typeof n=="object"&&delete n[t]}),delete O(this,et,"f").getDescriptions()[t]}[_r](t,e,n){O(this,Ce,"f")[n]||(O(this,tt,"f").process.emitWarning(t,e),O(this,Ce,"f")[n]=!0)}[vr](){O(this,Te,"f").push({options:O(this,G,"f"),configObjects:O(this,G,"f").configObjects.slice(0),exitProcess:O(this,Nt,"f"),groups:O(this,jt,"f"),strict:O(this,Qt,"f"),strictCommands:O(this,Jt,"f"),strictOptions:O(this,Zt,"f"),completionCommand:O(this,It,"f"),output:O(this,wt,"f"),exitError:O(this,Vt,"f"),hasOutput:O(this,Ct,"f"),parsed:this.parsed,parseFn:O(this,Tt,"f"),parseContext:O(this,kt,"f")}),O(this,et,"f").freeze(),O(this,dt,"f").freeze(),O(this,mt,"f").freeze(),O(this,At,"f").freeze()}[Nr](){let t="",e;return/\b(node|iojs|electron)(\.exe)?$/.test(O(this,tt,"f").process.argv()[0])?e=O(this,tt,"f").process.argv().slice(1,2):e=O(this,tt,"f").process.argv().slice(0,1),t=e.map(n=>{const o=this[qr](O(this,Yt,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&o.length<n.length?o:n}).join(" ").trim(),O(this,tt,"f").getEnv("_")&&O(this,tt,"f").getProcessArgvBin()===O(this,tt,"f").getEnv("_")&&(t=O(this,tt,"f").getEnv("_").replace(`${O(this,tt,"f").path.dirname(O(this,tt,"f").process.execPath())}/`,"")),t}[te](){return O(this,ve,"f")}[Ar](){return O(this,Ae,"f")}[Ye](){if(!O(this,Gt,"f"))return;const t=O(this,tt,"f").getEnv("LC_ALL")||O(this,tt,"f").getEnv("LC_MESSAGES")||O(this,tt,"f").getEnv("LANG")||O(this,tt,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Mr](){return this[Ge]().version||"unknown"}[Pr](t){const e=t["--"]?t["--"]:t._;for(let n=0,o;(o=e[n])!==void 0;n++)O(this,tt,"f").Parser.looksLikeNumber(o)&&Number.isSafeInteger(Math.floor(parseFloat(`${o}`)))&&(e[n]=Number(o));return t}[Ge](t){const e=t||"*";if(O(this,oe,"f")[e])return O(this,oe,"f")[e];let n={};try{let o=t||O(this,tt,"f").mainFilename;!t&&O(this,tt,"f").path.extname(o)&&(o=O(this,tt,"f").path.dirname(o));const i=O(this,tt,"f").findUp(o,(r,s)=>{if(s.includes("package.json"))return"package.json"});Ft(i,void 0,O(this,tt,"f")),n=JSON.parse(O(this,tt,"f").readFileSync(i,"utf8"))}catch{}return O(this,oe,"f")[e]=n||{},O(this,oe,"f")[e]}[zt](t,e){e=[].concat(e),e.forEach(n=>{n=this[Qe](n),O(this,G,"f")[t].push(n)})}[ae](t,e,n,o){this[Ke](t,e,n,o,(i,r,s)=>{O(this,G,"f")[i][r]=s})}[ke](t,e,n,o){this[Ke](t,e,n,o,(i,r,s)=>{O(this,G,"f")[i][r]=(O(this,G,"f")[i][r]||[]).concat(s)})}[Ke](t,e,n,o,i){if(Array.isArray(n))n.forEach(r=>{t(r,o)});else if((r=>typeof r=="object")(n))for(const r of Re(n))t(r,n[r]);else i(e,this[Qe](n),o)}[Qe](t){return t==="__proto__"?"___proto___":t}[Je](t,e){return this[ae](this[Je].bind(this),"key",t,e),this}[Ze](){var t,e,n,o,i,r,s,f,E,d,p,b;const w=O(this,Te,"f").pop();Ft(w,void 0,O(this,tt,"f"));let T;t=this,e=this,n=this,o=this,i=this,r=this,s=this,f=this,E=this,d=this,p=this,b=this,{options:{set value(v){H(t,G,v,"f")}}.value,configObjects:T,exitProcess:{set value(v){H(e,Nt,v,"f")}}.value,groups:{set value(v){H(n,jt,v,"f")}}.value,output:{set value(v){H(o,wt,v,"f")}}.value,exitError:{set value(v){H(i,Vt,v,"f")}}.value,hasOutput:{set value(v){H(r,Ct,v,"f")}}.value,parsed:this.parsed,strict:{set value(v){H(s,Qt,v,"f")}}.value,strictCommands:{set value(v){H(f,Jt,v,"f")}}.value,strictOptions:{set value(v){H(E,Zt,v,"f")}}.value,completionCommand:{set value(v){H(d,It,v,"f")}}.value,parseFn:{set value(v){H(p,Tt,v,"f")}}.value,parseContext:{set value(v){H(b,kt,v,"f")}}.value}=w,O(this,G,"f").configObjects=T,O(this,et,"f").unfreeze(),O(this,dt,"f").unfreeze(),O(this,mt,"f").unfreeze(),O(this,At,"f").unfreeze()}[Lr](t,e){return ye(e,n=>(t(n),n))}getInternalMethods(){return{getCommandInstance:this[Sr].bind(this),getContext:this[Fr].bind(this),getHasOutput:this[jr].bind(this),getLoggerInstance:this[Rr].bind(this),getParseContext:this[Br].bind(this),getParserConfiguration:this[te].bind(this),getUsageConfiguration:this[Ar].bind(this),getUsageInstance:this[Ur].bind(this),getValidationInstance:this[Xr].bind(this),hasParseCallback:this[Me].bind(this),isGlobalContext:this[$r].bind(this),postProcess:this[ee].bind(this),reset:this[tn].bind(this),runValidation:this[en].bind(this),runYargsParserAndExecuteCommands:this[le].bind(this),setHasOutput:this[Wr].bind(this)}}[Sr](){return O(this,mt,"f")}[Fr](){return O(this,ce,"f")}[jr](){return O(this,Ct,"f")}[Rr](){return O(this,se,"f")}[Br](){return O(this,kt,"f")||{}}[Ur](){return O(this,et,"f")}[Xr](){return O(this,dt,"f")}[Me](){return!!O(this,Tt,"f")}[$r](){return O(this,De,"f")}[ee](t,e,n,o){return n||yt(t)||(e||(t=this[Tr](t)),(this[te]()["parse-positional-numbers"]||this[te]()["parse-positional-numbers"]===void 0)&&(t=this[Pr](t)),o&&(t=ge(t,this,O(this,At,"f").getMiddleware(),!1))),t}[tn](t={}){H(this,G,O(this,G,"f")||{},"f");const e={};e.local=O(this,G,"f").local||[],e.configObjects=O(this,G,"f").configObjects||[];const n={};e.local.forEach(r=>{n[r]=!0,(t[r]||[]).forEach(s=>{n[s]=!0})}),Object.assign(O(this,Kt,"f"),Object.keys(O(this,jt,"f")).reduce((r,s)=>{const f=O(this,jt,"f")[s].filter(E=>!(E in n));return f.length>0&&(r[s]=f),r},{})),H(this,jt,{},"f");const o=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],i=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];return o.forEach(r=>{e[r]=(O(this,G,"f")[r]||[]).filter(s=>!n[s])}),i.forEach(r=>{e[r]=we(O(this,G,"f")[r],s=>!n[s])}),e.envPrefix=O(this,G,"f").envPrefix,H(this,G,e,"f"),H(this,et,O(this,et,"f")?O(this,et,"f").reset(n):no(this,O(this,tt,"f")),"f"),H(this,dt,O(this,dt,"f")?O(this,dt,"f").reset(n):fo(this,O(this,et,"f"),O(this,tt,"f")),"f"),H(this,mt,O(this,mt,"f")?O(this,mt,"f").reset():Qs(O(this,et,"f"),O(this,dt,"f"),O(this,At,"f"),O(this,tt,"f")),"f"),O(this,vt,"f")||H(this,vt,ao(this,O(this,et,"f"),O(this,mt,"f"),O(this,tt,"f")),"f"),O(this,At,"f").reset(),H(this,It,null,"f"),H(this,wt,"","f"),H(this,Vt,null,"f"),H(this,Ct,!1,"f"),this.parsed=!1,this}[qr](t,e){return O(this,tt,"f").path.relative(t,e)}[le](t,e,n,o=0,i=!1){let r=!!n||i;t=t||O(this,Ht,"f"),O(this,G,"f").__=O(this,tt,"f").y18n.__,O(this,G,"f").configuration=this[te]();const s=!!O(this,G,"f").configuration["populate--"],f=Object.assign({},O(this,G,"f").configuration,{"populate--":!0}),E=O(this,tt,"f").Parser.detailed(t,Object.assign({},O(this,G,"f"),{configuration:{"parse-positional-numbers":!1,...f}})),d=Object.assign(E.argv,O(this,kt,"f"));let p;const b=E.aliases;let w=!1,T=!1;Object.keys(d).forEach(v=>{v===O(this,Mt,"f")&&d[v]?w=!0:v===O(this,Rt,"f")&&d[v]&&(T=!0)}),d.$0=this.$0,this.parsed=E,o===0&&O(this,et,"f").clearCachedHelpMessage();try{if(this[Ye](),e)return this[ee](d,s,!!n,!1);O(this,Mt,"f")&&[O(this,Mt,"f")].concat(b[O(this,Mt,"f")]||[]).filter(g=>g.length>1).includes(""+d._[d._.length-1])&&(d._.pop(),w=!0),H(this,De,!1,"f");const v=O(this,mt,"f").getCommands(),I=O(this,vt,"f").completionKey in d,D=w||I||i;if(d._.length){if(v.length){let C;for(let g=o||0,_;d._[g]!==void 0;g++)if(_=String(d._[g]),v.includes(_)&&_!==O(this,It,"f")){const M=O(this,mt,"f").runCommand(_,this,E,g+1,i,w||T||i);return this[ee](M,s,!!n,!1)}else if(!C&&_!==O(this,It,"f")){C=_;break}!O(this,mt,"f").hasDefaultCommand()&&O(this,Ne,"f")&&C&&!D&&O(this,dt,"f").recommendCommands(C,v)}O(this,It,"f")&&d._.includes(O(this,It,"f"))&&!I&&(O(this,Nt,"f")&&pe(!0),this.showCompletionScript(),this.exit(0))}if(O(this,mt,"f").hasDefaultCommand()&&!D){const C=O(this,mt,"f").runCommand(null,this,E,0,i,w||T||i);return this[ee](C,s,!!n,!1)}if(I){O(this,Nt,"f")&&pe(!0),t=[].concat(t);const C=t.slice(t.indexOf(`--${O(this,vt,"f").completionKey}`)+1);return O(this,vt,"f").getCompletion(C,(g,_)=>{if(g)throw new gt(g.message);(_||[]).forEach(M=>{O(this,se,"f").log(M)}),this.exit(0)}),this[ee](d,!s,!!n,!1)}if(O(this,Ct,"f")||(w?(O(this,Nt,"f")&&pe(!0),r=!0,this.showHelp("log"),this.exit(0)):T&&(O(this,Nt,"f")&&pe(!0),r=!0,O(this,et,"f").showVersion("log"),this.exit(0))),!r&&O(this,G,"f").skipValidation.length>0&&(r=Object.keys(d).some(C=>O(this,G,"f").skipValidation.indexOf(C)>=0&&d[C]===!0)),!r){if(E.error)throw new gt(E.error.message);if(!I){const C=this[en](b,{},E.error);n||(p=ge(d,this,O(this,At,"f").getMiddleware(),!0)),p=this[Lr](C,p??d),yt(p)&&!n&&(p=p.then(()=>ge(d,this,O(this,At,"f").getMiddleware(),!1)))}}}catch(v){if(v instanceof gt)O(this,et,"f").fail(v.message,v);else throw v}return this[ee](p??d,s,!!n,!0)}[en](t,e,n,o){const i={...this.getDemandedOptions()};return r=>{if(n)throw new gt(n.message);O(this,dt,"f").nonOptionCount(r),O(this,dt,"f").requiredArguments(r,i);let s=!1;O(this,Jt,"f")&&(s=O(this,dt,"f").unknownCommands(r)),O(this,Qt,"f")&&!s?O(this,dt,"f").unknownArguments(r,t,e,!!o):O(this,Zt,"f")&&O(this,dt,"f").unknownArguments(r,t,{},!1,!1),O(this,dt,"f").limitedChoices(r),O(this,dt,"f").implications(r),O(this,dt,"f").conflicting(r)}}[Wr](){H(this,Ct,!0,"f")}[ne](t){if(typeof t=="string")O(this,G,"f").key[t]=!0;else for(const e of t)O(this,G,"f").key[e]=!0}}function yo(a){return!!a&&typeof a.getInternalMethods=="function"}const bo=mo(Vs);var nn={},Vr;function Gn(){return Vr||(Vr=1,function(){nn.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:`
|
|
88
|
+
`},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(it)),nn}var rn={},$t={},qt={},Hr;function Wt(){return Hr||(Hr=1,function(){var a,t,e,n,o,i,r,s=[].slice,f={}.hasOwnProperty;a=function(){var E,d,p,b,w,T;if(T=arguments[0],w=2<=arguments.length?s.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(E=0,p=w.length;E<p;E++)if(b=w[E],b!=null)for(d in b)f.call(b,d)&&(T[d]=b[d]);return T},o=function(E){return!!E&&Object.prototype.toString.call(E)==="[object Function]"},i=function(E){var d;return!!E&&((d=typeof E)=="function"||d==="object")},e=function(E){return o(Array.isArray)?Array.isArray(E):Object.prototype.toString.call(E)==="[object Array]"},n=function(E){var d;if(e(E))return!E.length;for(d in E)if(f.call(E,d))return!1;return!0},r=function(E){var d,p;return i(E)&&(p=Object.getPrototypeOf(E))&&(d=p.constructor)&&typeof d=="function"&&d instanceof d&&Function.prototype.toString.call(d)===Function.prototype.toString.call(Object)},t=function(E){return o(E.valueOf)?E.valueOf():E},qt.assign=a,qt.isFunction=o,qt.isObject=i,qt.isArray=e,qt.isEmpty=n,qt.isPlainObject=r,qt.getValue=t}.call(it)),qt}var sn={exports:{}},zr;function Qi(){return zr||(zr=1,function(){sn.exports=function(){function a(){}return a.prototype.hasFeature=function(t,e){return!0},a.prototype.createDocumentType=function(t,e,n){throw new Error("This DOM method is not implemented.")},a.prototype.createDocument=function(t,e,n){throw new Error("This DOM method is not implemented.")},a.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},a.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented.")},a}()}.call(it)),sn.exports}var on={exports:{}},an={exports:{}},un={exports:{}},Yr;function wo(){return Yr||(Yr=1,function(){un.exports=function(){function a(){}return a.prototype.handleError=function(t){throw new Error(t)},a}()}.call(it)),un.exports}var cn={exports:{}},Gr;function Eo(){return Gr||(Gr=1,function(){cn.exports=function(){function a(t){this.arr=t||[]}return Object.defineProperty(a.prototype,"length",{get:function(){return this.arr.length}}),a.prototype.item=function(t){return this.arr[t]||null},a.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},a}()}.call(it)),cn.exports}var kr;function xo(){return kr||(kr=1,function(){var a,t;a=wo(),t=Eo(),an.exports=function(){function e(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new a,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=Object.create(this.defaultParams)}return Object.defineProperty(e.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),e.prototype.getParameter=function(n){return this.params.hasOwnProperty(n)?this.params[n]:null},e.prototype.canSetParameter=function(n,o){return!0},e.prototype.setParameter=function(n,o){return o!=null?this.params[n]=o:delete this.params[n]},e}()}.call(it)),an.exports}var ln={exports:{}},fn={exports:{}},hn={exports:{}},Kr;function bt(){return Kr||(Kr=1,function(){hn.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}.call(it)),hn.exports}var pn={exports:{}},Qr;function Ji(){return Qr||(Qr=1,function(){var a;a=bt(),Pt(),pn.exports=function(){function t(e,n,o){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(o),this.type=a.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(e){return this.value=e||""}}),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(t.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(t.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"specified",{get:function(){return!0}}),t.prototype.clone=function(){return Object.create(this)},t.prototype.toString=function(e){return this.options.writer.attribute(this,this.options.writer.filterOptions(e))},t.prototype.debugInfo=function(e){return e=e||this.name,e==null?"parent: <"+this.parent.name+">":"attribute: {"+e+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(e){return!(e.namespaceURI!==this.namespaceURI||e.prefix!==this.prefix||e.localName!==this.localName||e.value!==this.value)},t}()}.call(it)),pn.exports}var dn={exports:{}},Jr;function kn(){return Jr||(Jr=1,function(){dn.exports=function(){function a(t){this.nodes=t}return Object.defineProperty(a.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),a.prototype.clone=function(){return this.nodes=null},a.prototype.getNamedItem=function(t){return this.nodes[t]},a.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},a.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},a.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},a.prototype.getNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},a.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},a.prototype.removeNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},a}()}.call(it)),dn.exports}var Zr;function Kn(){return Zr||(Zr=1,function(){var a,t,e,n,o,i,r,s,f=function(d,p){for(var b in p)E.call(p,b)&&(d[b]=p[b]);function w(){this.constructor=d}return w.prototype=p.prototype,d.prototype=new w,d.__super__=p.prototype,d},E={}.hasOwnProperty;s=Wt(),r=s.isObject,i=s.isFunction,o=s.getValue,n=Pt(),a=bt(),t=Ji(),e=kn(),fn.exports=function(d){f(p,d);function p(b,w,T){var v,I,D,C;if(p.__super__.constructor.call(this,b),w==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(w),this.type=a.Element,this.attribs={},this.schemaTypeInfo=null,T!=null&&this.attribute(T),b.type===a.Document&&(this.isRoot=!0,this.documentObject=b,b.rootObject=this,b.children)){for(C=b.children,I=0,D=C.length;I<D;I++)if(v=C[I],v.type===a.DocType){v.name=this.name;break}}}return Object.defineProperty(p.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(p.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(p.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(p.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(p.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new e(this.attribs)),this.attributeMap}}),p.prototype.clone=function(){var b,w,T,v;T=Object.create(this),T.isRoot&&(T.documentObject=null),T.attribs={},v=this.attribs;for(w in v)E.call(v,w)&&(b=v[w],T.attribs[w]=b.clone());return T.children=[],this.children.forEach(function(I){var D;return D=I.clone(),D.parent=T,T.children.push(D)}),T},p.prototype.attribute=function(b,w){var T,v;if(b!=null&&(b=o(b)),r(b))for(T in b)E.call(b,T)&&(v=b[T],this.attribute(T,v));else i(w)&&(w=w.apply()),this.options.keepNullAttributes&&w==null?this.attribs[b]=new t(this,b,""):w!=null&&(this.attribs[b]=new t(this,b,w));return this},p.prototype.removeAttribute=function(b){var w,T,v;if(b==null)throw new Error("Missing attribute name. "+this.debugInfo());if(b=o(b),Array.isArray(b))for(T=0,v=b.length;T<v;T++)w=b[T],delete this.attribs[w];else delete this.attribs[b];return this},p.prototype.toString=function(b){return this.options.writer.element(this,this.options.writer.filterOptions(b))},p.prototype.att=function(b,w){return this.attribute(b,w)},p.prototype.a=function(b,w){return this.attribute(b,w)},p.prototype.getAttribute=function(b){return this.attribs.hasOwnProperty(b)?this.attribs[b].value:null},p.prototype.setAttribute=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNode=function(b){return this.attribs.hasOwnProperty(b)?this.attribs[b]:null},p.prototype.setAttributeNode=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.removeAttributeNode=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNS=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setAttributeNS=function(b,w,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.removeAttributeNS=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNodeNS=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setAttributeNodeNS=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.hasAttribute=function(b){return this.attribs.hasOwnProperty(b)},p.prototype.hasAttributeNS=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setIdAttribute=function(b,w){return this.attribs.hasOwnProperty(b)?this.attribs[b].isId:w},p.prototype.setIdAttributeNS=function(b,w,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setIdAttributeNode=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByClassName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.isEqualNode=function(b){var w,T,v;if(!p.__super__.isEqualNode.apply(this,arguments).isEqualNode(b)||b.namespaceURI!==this.namespaceURI||b.prefix!==this.prefix||b.localName!==this.localName||b.attribs.length!==this.attribs.length)return!1;for(w=T=0,v=this.attribs.length-1;0<=v?T<=v:T>=v;w=0<=v?++T:--T)if(!this.attribs[w].isEqualNode(b.attribs[w]))return!1;return!0},p}(n)}.call(it)),fn.exports}var mn={exports:{}},gn={exports:{}},ti;function Ue(){return ti||(ti=1,function(){var a,t=function(n,o){for(var i in o)e.call(o,i)&&(n[i]=o[i]);function r(){this.constructor=n}return r.prototype=o.prototype,n.prototype=new r,n.__super__=o.prototype,n},e={}.hasOwnProperty;a=Pt(),gn.exports=function(n){t(o,n);function o(i){o.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(o.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(o.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(o.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.substringData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.insertData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.deleteData=function(i,r){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceData=function(i,r,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},o}(a)}.call(it)),gn.exports}var ei;function Qn(){return ei||(ei=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;a=bt(),t=Ue(),mn.exports=function(o){e(i,o);function i(r,s){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=a.CData,this.value=this.stringify.cdata(s)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.cdata(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),mn.exports}var yn={exports:{}},ni;function Jn(){return ni||(ni=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;a=bt(),t=Ue(),yn.exports=function(o){e(i,o);function i(r,s){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=a.Comment,this.value=this.stringify.comment(s)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.comment(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),yn.exports}var bn={exports:{}},ri;function Zn(){return ri||(ri=1,function(){var a,t,e,n=function(i,r){for(var s in r)o.call(r,s)&&(i[s]=r[s]);function f(){this.constructor=i}return f.prototype=r.prototype,i.prototype=new f,i.__super__=r.prototype,i},o={}.hasOwnProperty;e=Wt().isObject,t=Pt(),a=bt(),bn.exports=function(i){n(r,i);function r(s,f,E,d){var p;r.__super__.constructor.call(this,s),e(f)&&(p=f,f=p.version,E=p.encoding,d=p.standalone),f||(f="1.0"),this.type=a.Declaration,this.version=this.stringify.xmlVersion(f),E!=null&&(this.encoding=this.stringify.xmlEncoding(E)),d!=null&&(this.standalone=this.stringify.xmlStandalone(d))}return r.prototype.toString=function(s){return this.options.writer.declaration(this,this.options.writer.filterOptions(s))},r}(t)}.call(it)),bn.exports}var wn={exports:{}},En={exports:{}},ii;function tr(){return ii||(ii=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;t=Pt(),a=bt(),En.exports=function(o){e(i,o);function i(r,s,f,E,d,p){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(f==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(s));if(!E)throw new Error("Missing DTD attribute type. "+this.debugInfo(s));if(!d)throw new Error("Missing DTD attribute default. "+this.debugInfo(s));if(d.indexOf("#")!==0&&(d="#"+d),!d.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(s));if(p&&!d.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(s));this.elementName=this.stringify.name(s),this.type=a.AttributeDeclaration,this.attributeName=this.stringify.name(f),this.attributeType=this.stringify.dtdAttType(E),p&&(this.defaultValue=this.stringify.dtdAttDefault(p)),this.defaultValueType=d}return i.prototype.toString=function(r){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),En.exports}var xn={exports:{}},si;function er(){return si||(si=1,function(){var a,t,e,n=function(i,r){for(var s in r)o.call(r,s)&&(i[s]=r[s]);function f(){this.constructor=i}return f.prototype=r.prototype,i.prototype=new f,i.__super__=r.prototype,i},o={}.hasOwnProperty;e=Wt().isObject,t=Pt(),a=bt(),xn.exports=function(i){n(r,i);function r(s,f,E,d){if(r.__super__.constructor.call(this,s),E==null)throw new Error("Missing DTD entity name. "+this.debugInfo(E));if(d==null)throw new Error("Missing DTD entity value. "+this.debugInfo(E));if(this.pe=!!f,this.name=this.stringify.name(E),this.type=a.EntityDeclaration,!e(d))this.value=this.stringify.dtdEntityValue(d),this.internal=!0;else{if(!d.pubID&&!d.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(E));if(d.pubID&&!d.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(E));if(this.internal=!1,d.pubID!=null&&(this.pubID=this.stringify.dtdPubID(d.pubID)),d.sysID!=null&&(this.sysID=this.stringify.dtdSysID(d.sysID)),d.nData!=null&&(this.nData=this.stringify.dtdNData(d.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(E))}}return Object.defineProperty(r.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(r.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(r.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(r.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(r.prototype,"xmlVersion",{get:function(){return null}}),r.prototype.toString=function(s){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(s))},r}(t)}.call(it)),xn.exports}var On={exports:{}},oi;function nr(){return oi||(oi=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;t=Pt(),a=bt(),On.exports=function(o){e(i,o);function i(r,s,f){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing DTD element name. "+this.debugInfo());f||(f="(#PCDATA)"),Array.isArray(f)&&(f="("+f.join(",")+")"),this.name=this.stringify.name(s),this.type=a.ElementDeclaration,this.value=this.stringify.dtdElementValue(f)}return i.prototype.toString=function(r){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),On.exports}var In={exports:{}},ai;function rr(){return ai||(ai=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;t=Pt(),a=bt(),In.exports=function(o){e(i,o);function i(r,s,f){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing DTD notation name. "+this.debugInfo(s));if(!f.pubID&&!f.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(s));this.name=this.stringify.name(s),this.type=a.NotationDeclaration,f.pubID!=null&&(this.pubID=this.stringify.dtdPubID(f.pubID)),f.sysID!=null&&(this.sysID=this.stringify.dtdSysID(f.sysID))}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),i.prototype.toString=function(r){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),In.exports}var ui;function ir(){return ui||(ui=1,function(){var a,t,e,n,o,i,r,s,f=function(d,p){for(var b in p)E.call(p,b)&&(d[b]=p[b]);function w(){this.constructor=d}return w.prototype=p.prototype,d.prototype=new w,d.__super__=p.prototype,d},E={}.hasOwnProperty;s=Wt().isObject,r=Pt(),a=bt(),t=tr(),n=er(),e=nr(),o=rr(),i=kn(),wn.exports=function(d){f(p,d);function p(b,w,T){var v,I,D,C,g,_;if(p.__super__.constructor.call(this,b),this.type=a.DocType,b.children){for(C=b.children,I=0,D=C.length;I<D;I++)if(v=C[I],v.type===a.Element){this.name=v.name;break}}this.documentObject=b,s(w)&&(g=w,w=g.pubID,T=g.sysID),T==null&&(_=[w,T],T=_[0],w=_[1]),w!=null&&(this.pubID=this.stringify.dtdPubID(w)),T!=null&&(this.sysID=this.stringify.dtdSysID(T))}return Object.defineProperty(p.prototype,"entities",{get:function(){var b,w,T,v,I;for(v={},I=this.children,w=0,T=I.length;w<T;w++)b=I[w],b.type===a.EntityDeclaration&&!b.pe&&(v[b.name]=b);return new i(v)}}),Object.defineProperty(p.prototype,"notations",{get:function(){var b,w,T,v,I;for(v={},I=this.children,w=0,T=I.length;w<T;w++)b=I[w],b.type===a.NotationDeclaration&&(v[b.name]=b);return new i(v)}}),Object.defineProperty(p.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(p.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(p.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),p.prototype.element=function(b,w){var T;return T=new e(this,b,w),this.children.push(T),this},p.prototype.attList=function(b,w,T,v,I){var D;return D=new t(this,b,w,T,v,I),this.children.push(D),this},p.prototype.entity=function(b,w){var T;return T=new n(this,!1,b,w),this.children.push(T),this},p.prototype.pEntity=function(b,w){var T;return T=new n(this,!0,b,w),this.children.push(T),this},p.prototype.notation=function(b,w){var T;return T=new o(this,b,w),this.children.push(T),this},p.prototype.toString=function(b){return this.options.writer.docType(this,this.options.writer.filterOptions(b))},p.prototype.ele=function(b,w){return this.element(b,w)},p.prototype.att=function(b,w,T,v,I){return this.attList(b,w,T,v,I)},p.prototype.ent=function(b,w){return this.entity(b,w)},p.prototype.pent=function(b,w){return this.pEntity(b,w)},p.prototype.not=function(b,w){return this.notation(b,w)},p.prototype.up=function(){return this.root()||this.documentObject},p.prototype.isEqualNode=function(b){return!(!p.__super__.isEqualNode.apply(this,arguments).isEqualNode(b)||b.name!==this.name||b.publicId!==this.publicId||b.systemId!==this.systemId)},p}(r)}.call(it)),wn.exports}var Cn={exports:{}},ci;function sr(){return ci||(ci=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;a=bt(),t=Pt(),Cn.exports=function(o){e(i,o);function i(r,s){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=a.Raw,this.value=this.stringify.raw(s)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.raw(this,this.options.writer.filterOptions(r))},i}(t)}.call(it)),Cn.exports}var Tn={exports:{}},li;function or(){return li||(li=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;a=bt(),t=Ue(),Tn.exports=function(o){e(i,o);function i(r,s){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=a.Text,this.value=this.stringify.text(s)}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,s,f;for(f="",s=this.previousSibling;s;)f=s.data+f,s=s.previousSibling;for(f+=this.data,r=this.nextSibling;r;)f=f+r.data,r=r.nextSibling;return f}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.text(this,this.options.writer.filterOptions(r))},i.prototype.splitText=function(r){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(r){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(it)),Tn.exports}var Dn={exports:{}},fi;function ar(){return fi||(fi=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;a=bt(),t=Ue(),Dn.exports=function(o){e(i,o);function i(r,s,f){if(i.__super__.constructor.call(this,r),s==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=a.ProcessingInstruction,this.target=this.stringify.insTarget(s),this.name=this.target,f&&(this.value=this.stringify.insValue(f))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(r))},i.prototype.isEqualNode=function(r){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(r)||r.target!==this.target)},i}(t)}.call(it)),Dn.exports}var _n={exports:{}},hi;function Zi(){return hi||(hi=1,function(){var a,t,e=function(o,i){for(var r in i)n.call(i,r)&&(o[r]=i[r]);function s(){this.constructor=o}return s.prototype=i.prototype,o.prototype=new s,o.__super__=i.prototype,o},n={}.hasOwnProperty;t=Pt(),a=bt(),_n.exports=function(o){e(i,o);function i(r){i.__super__.constructor.call(this,r),this.type=a.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(r){return""},i}(t)}.call(it)),_n.exports}var vn={exports:{}},pi;function Oo(){return pi||(pi=1,function(){vn.exports=function(){function a(t){this.nodes=t}return Object.defineProperty(a.prototype,"length",{get:function(){return this.nodes.length||0}}),a.prototype.clone=function(){return this.nodes=null},a.prototype.item=function(t){return this.nodes[t]||null},a}()}.call(it)),vn.exports}var Nn={exports:{}},di;function Io(){return di||(di=1,function(){Nn.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(it)),Nn.exports}var mi;function Pt(){return mi||(mi=1,function(){var a,t,e,n,o,i,r,s,f,E,d,p,b,w,T,v,I,D={}.hasOwnProperty;I=Wt(),v=I.isObject,T=I.isFunction,w=I.isEmpty,b=I.getValue,s=null,e=null,n=null,o=null,i=null,d=null,p=null,E=null,r=null,t=null,f=null,a=null,ln.exports=function(){function C(g){this.parent=g,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,s||(s=Kn(),e=Qn(),n=Jn(),o=Zn(),i=ir(),d=sr(),p=or(),E=ar(),r=Zi(),t=bt(),f=Oo(),kn(),a=Io())}return Object.defineProperty(C.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(C.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(C.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(C.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(C.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new f(this.children)),this.childNodeList}}),Object.defineProperty(C.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(C.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(C.prototype,"previousSibling",{get:function(){var g;return g=this.parent.children.indexOf(this),this.parent.children[g-1]||null}}),Object.defineProperty(C.prototype,"nextSibling",{get:function(){var g;return g=this.parent.children.indexOf(this),this.parent.children[g+1]||null}}),Object.defineProperty(C.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(C.prototype,"textContent",{get:function(){var g,_,M,X,q;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(q="",X=this.children,_=0,M=X.length;_<M;_++)g=X[_],g.textContent&&(q+=g.textContent);return q}else return null},set:function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),C.prototype.setParent=function(g){var _,M,X,q,U;for(this.parent=g,g&&(this.options=g.options,this.stringify=g.stringify),q=this.children,U=[],M=0,X=q.length;M<X;M++)_=q[M],U.push(_.setParent(this));return U},C.prototype.element=function(g,_,M){var X,q,U,m,R,S,B,$,W,Y,k;if(S=null,_===null&&M==null&&(W=[{},null],_=W[0],M=W[1]),_==null&&(_={}),_=b(_),v(_)||(Y=[_,M],M=Y[0],_=Y[1]),g!=null&&(g=b(g)),Array.isArray(g))for(U=0,B=g.length;U<B;U++)q=g[U],S=this.element(q);else if(T(g))S=this.element(g.apply());else if(v(g)){for(R in g)if(D.call(g,R))if(k=g[R],T(k)&&(k=k.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&R.indexOf(this.stringify.convertAttKey)===0)S=this.attribute(R.substr(this.stringify.convertAttKey.length),k);else if(!this.options.separateArrayItems&&Array.isArray(k)&&w(k))S=this.dummy();else if(v(k)&&w(k))S=this.element(R);else if(!this.options.keepNullNodes&&k==null)S=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(k))for(m=0,$=k.length;m<$;m++)q=k[m],X={},X[R]=q,S=this.element(X);else v(k)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&R.indexOf(this.stringify.convertTextKey)===0?S=this.element(k):(S=this.element(R),S.element(k)):S=this.element(R,k)}else!this.options.keepNullNodes&&M===null?S=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&g.indexOf(this.stringify.convertTextKey)===0?S=this.text(M):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&g.indexOf(this.stringify.convertCDataKey)===0?S=this.cdata(M):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&g.indexOf(this.stringify.convertCommentKey)===0?S=this.comment(M):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&g.indexOf(this.stringify.convertRawKey)===0?S=this.raw(M):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&g.indexOf(this.stringify.convertPIKey)===0?S=this.instruction(g.substr(this.stringify.convertPIKey.length),M):S=this.node(g,_,M);if(S==null)throw new Error("Could not create any elements with: "+g+". "+this.debugInfo());return S},C.prototype.insertBefore=function(g,_,M){var X,q,U,m,R;if(g?.type)return U=g,m=_,U.setParent(this),m?(q=children.indexOf(m),R=children.splice(q),children.push(U),Array.prototype.push.apply(children,R)):children.push(U),U;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(g));return q=this.parent.children.indexOf(this),R=this.parent.children.splice(q),X=this.parent.element(g,_,M),Array.prototype.push.apply(this.parent.children,R),X},C.prototype.insertAfter=function(g,_,M){var X,q,U;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(g));return q=this.parent.children.indexOf(this),U=this.parent.children.splice(q+1),X=this.parent.element(g,_,M),Array.prototype.push.apply(this.parent.children,U),X},C.prototype.remove=function(){var g;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return g=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[g,g-g+1].concat([])),this.parent},C.prototype.node=function(g,_,M){var X,q;return g!=null&&(g=b(g)),_||(_={}),_=b(_),v(_)||(q=[_,M],M=q[0],_=q[1]),X=new s(this,g,_),M!=null&&X.text(M),this.children.push(X),X},C.prototype.text=function(g){var _;return v(g)&&this.element(g),_=new p(this,g),this.children.push(_),this},C.prototype.cdata=function(g){var _;return _=new e(this,g),this.children.push(_),this},C.prototype.comment=function(g){var _;return _=new n(this,g),this.children.push(_),this},C.prototype.commentBefore=function(g){var _,M;return _=this.parent.children.indexOf(this),M=this.parent.children.splice(_),this.parent.comment(g),Array.prototype.push.apply(this.parent.children,M),this},C.prototype.commentAfter=function(g){var _,M;return _=this.parent.children.indexOf(this),M=this.parent.children.splice(_+1),this.parent.comment(g),Array.prototype.push.apply(this.parent.children,M),this},C.prototype.raw=function(g){var _;return _=new d(this,g),this.children.push(_),this},C.prototype.dummy=function(){var g;return g=new r(this),g},C.prototype.instruction=function(g,_){var M,X,q,U,m;if(g!=null&&(g=b(g)),_!=null&&(_=b(_)),Array.isArray(g))for(U=0,m=g.length;U<m;U++)M=g[U],this.instruction(M);else if(v(g))for(M in g)D.call(g,M)&&(X=g[M],this.instruction(M,X));else T(_)&&(_=_.apply()),q=new E(this,g,_),this.children.push(q);return this},C.prototype.instructionBefore=function(g,_){var M,X;return M=this.parent.children.indexOf(this),X=this.parent.children.splice(M),this.parent.instruction(g,_),Array.prototype.push.apply(this.parent.children,X),this},C.prototype.instructionAfter=function(g,_){var M,X;return M=this.parent.children.indexOf(this),X=this.parent.children.splice(M+1),this.parent.instruction(g,_),Array.prototype.push.apply(this.parent.children,X),this},C.prototype.declaration=function(g,_,M){var X,q;return X=this.document(),q=new o(X,g,_,M),X.children.length===0?X.children.unshift(q):X.children[0].type===t.Declaration?X.children[0]=q:X.children.unshift(q),X.root()||X},C.prototype.dtd=function(g,_){var M,X,q,U,m,R,S,B,$,W;for(X=this.document(),q=new i(X,g,_),$=X.children,U=m=0,S=$.length;m<S;U=++m)if(M=$[U],M.type===t.DocType)return X.children[U]=q,q;for(W=X.children,U=R=0,B=W.length;R<B;U=++R)if(M=W[U],M.isRoot)return X.children.splice(U,0,q),q;return X.children.push(q),q},C.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},C.prototype.root=function(){var g;for(g=this;g;){if(g.type===t.Document)return g.rootObject;if(g.isRoot)return g;g=g.parent}},C.prototype.document=function(){var g;for(g=this;g;){if(g.type===t.Document)return g;g=g.parent}},C.prototype.end=function(g){return this.document().end(g)},C.prototype.prev=function(){var g;if(g=this.parent.children.indexOf(this),g<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[g-1]},C.prototype.next=function(){var g;if(g=this.parent.children.indexOf(this),g===-1||g===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[g+1]},C.prototype.importDocument=function(g){var _;return _=g.root().clone(),_.parent=this,_.isRoot=!1,this.children.push(_),this},C.prototype.debugInfo=function(g){var _,M;return g=g||this.name,g==null&&!((_=this.parent)!=null&&_.name)?"":g==null?"parent: <"+this.parent.name+">":(M=this.parent)!=null&&M.name?"node: <"+g+">, parent: <"+this.parent.name+">":"node: <"+g+">"},C.prototype.ele=function(g,_,M){return this.element(g,_,M)},C.prototype.nod=function(g,_,M){return this.node(g,_,M)},C.prototype.txt=function(g){return this.text(g)},C.prototype.dat=function(g){return this.cdata(g)},C.prototype.com=function(g){return this.comment(g)},C.prototype.ins=function(g,_){return this.instruction(g,_)},C.prototype.doc=function(){return this.document()},C.prototype.dec=function(g,_,M){return this.declaration(g,_,M)},C.prototype.e=function(g,_,M){return this.element(g,_,M)},C.prototype.n=function(g,_,M){return this.node(g,_,M)},C.prototype.t=function(g){return this.text(g)},C.prototype.d=function(g){return this.cdata(g)},C.prototype.c=function(g){return this.comment(g)},C.prototype.r=function(g){return this.raw(g)},C.prototype.i=function(g,_){return this.instruction(g,_)},C.prototype.u=function(){return this.up()},C.prototype.importXMLBuilder=function(g){return this.importDocument(g)},C.prototype.replaceChild=function(g,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.removeChild=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.appendChild=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.hasChildNodes=function(){return this.children.length!==0},C.prototype.cloneNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.isSupported=function(g,_){return!0},C.prototype.hasAttributes=function(){return this.attribs.length!==0},C.prototype.compareDocumentPosition=function(g){var _,M;return _=this,_===g?0:this.document()!==g.document()?(M=a.Disconnected|a.ImplementationSpecific,Math.random()<.5?M|=a.Preceding:M|=a.Following,M):_.isAncestor(g)?a.Contains|a.Preceding:_.isDescendant(g)?a.Contains|a.Following:_.isPreceding(g)?a.Preceding:a.Following},C.prototype.isSameNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.lookupPrefix=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.isDefaultNamespace=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.lookupNamespaceURI=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.isEqualNode=function(g){var _,M,X;if(g.nodeType!==this.nodeType||g.children.length!==this.children.length)return!1;for(_=M=0,X=this.children.length-1;0<=X?M<=X:M>=X;_=0<=X?++M:--M)if(!this.children[_].isEqualNode(g.children[_]))return!1;return!0},C.prototype.getFeature=function(g,_){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.setUserData=function(g,_,M){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.getUserData=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},C.prototype.contains=function(g){return g?g===this||this.isDescendant(g):!1},C.prototype.isDescendant=function(g){var _,M,X,q,U;for(U=this.children,X=0,q=U.length;X<q;X++)if(_=U[X],g===_||(M=_.isDescendant(g),M))return!0;return!1},C.prototype.isAncestor=function(g){return g.isDescendant(this)},C.prototype.isPreceding=function(g){var _,M;return _=this.treePosition(g),M=this.treePosition(this),_===-1||M===-1?!1:_<M},C.prototype.isFollowing=function(g){var _,M;return _=this.treePosition(g),M=this.treePosition(this),_===-1||M===-1?!1:_>M},C.prototype.treePosition=function(g){var _,M;return M=0,_=!1,this.foreachTreeNode(this.document(),function(X){if(M++,!_&&X===g)return _=!0}),_?M:-1},C.prototype.foreachTreeNode=function(g,_){var M,X,q,U,m;for(g||(g=this.document()),U=g.children,X=0,q=U.length;X<q;X++){if(M=U[X],m=_(M))return m;if(m=this.foreachTreeNode(M,_),m)return m}},C}()}.call(it)),ln.exports}var An={exports:{}},gi;function ts(){return gi||(gi=1,function(){var a=function(e,n){return function(){return e.apply(n,arguments)}},t={}.hasOwnProperty;An.exports=function(){function e(n){this.assertLegalName=a(this.assertLegalName,this),this.assertLegalChar=a(this.assertLegalChar,this);var o,i,r;n||(n={}),this.options=n,this.options.version||(this.options.version="1.0"),i=n.stringify||{};for(o in i)t.call(i,o)&&(r=i[o],this[o]=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 o,i;if(this.options.noValidation)return n;if(o="",this.options.version==="1.0"){if(o=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=n.match(o))throw new Error("Invalid character in string: "+n+" at index "+i.index)}else if(this.options.version==="1.1"&&(o=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=n.match(o)))throw new Error("Invalid character in string: "+n+" at index "+i.index);return n},e.prototype.assertLegalName=function(n){var o;if(this.options.noValidation)return n;if(this.assertLegalChar(n),o=/^([: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(o))throw new Error("Invalid character in name");return n},e.prototype.textEscape=function(n){var o;return this.options.noValidation?n:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(o,"&").replace(/</g,"<").replace(/>/g,">").replace(/\r/g,"
"))},e.prototype.attEscape=function(n){var o;return this.options.noValidation?n:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(o,"&").replace(/</g,"<").replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"))},e}()}.call(it)),An.exports}var Mn={exports:{}},Pn={exports:{}},Ln={exports:{}},yi;function Xe(){return yi||(yi=1,function(){Ln.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(it)),Ln.exports}var bi;function es(){return bi||(bi=1,function(){var a,t,e,n={}.hasOwnProperty;e=Wt().assign,a=bt(),Zn(),ir(),Qn(),Jn(),Kn(),sr(),or(),ar(),Zi(),tr(),nr(),er(),rr(),t=Xe(),Pn.exports=function(){function o(i){var r,s,f;i||(i={}),this.options=i,s=i.writer||{};for(r in s)n.call(s,r)&&(f=s[r],this["_"+r]=this[r],this[r]=f)}return o.prototype.filterOptions=function(i){var r,s,f,E,d,p,b,w;return i||(i={}),i=e({},this.options,i),r={writer:this},r.pretty=i.pretty||!1,r.allowEmpty=i.allowEmpty||!1,r.indent=(s=i.indent)!=null?s:" ",r.newline=(f=i.newline)!=null?f:`
|
|
89
|
+
`,r.offset=(E=i.offset)!=null?E:0,r.dontPrettyTextNodes=(d=(p=i.dontPrettyTextNodes)!=null?p:i.dontprettytextnodes)!=null?d:0,r.spaceBeforeSlash=(b=(w=i.spaceBeforeSlash)!=null?w:i.spacebeforeslash)!=null?b:"",r.spaceBeforeSlash===!0&&(r.spaceBeforeSlash=" "),r.suppressPrettyCount=0,r.user={},r.state=t.None,r},o.prototype.indent=function(i,r,s){var f;return!r.pretty||r.suppressPrettyCount?"":r.pretty&&(f=(s||0)+r.offset+1,f>0)?new Array(f).join(r.indent):""},o.prototype.endline=function(i,r,s){return!r.pretty||r.suppressPrettyCount?"":r.newline},o.prototype.attribute=function(i,r,s){var f;return this.openAttribute(i,r,s),f=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,r,s),f},o.prototype.cdata=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<![CDATA[",r.state=t.InsideTag,f+=i.value,r.state=t.CloseTag,f+="]]>"+this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.comment=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<!-- ",r.state=t.InsideTag,f+=i.value,r.state=t.CloseTag,f+=" -->"+this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.declaration=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<?xml",r.state=t.InsideTag,f+=' version="'+i.version+'"',i.encoding!=null&&(f+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(f+=' standalone="'+i.standalone+'"'),r.state=t.CloseTag,f+=r.spaceBeforeSlash+"?>",f+=this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.docType=function(i,r,s){var f,E,d,p,b;if(s||(s=0),this.openNode(i,r,s),r.state=t.OpenTag,p=this.indent(i,r,s),p+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?p+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(p+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(p+=" [",p+=this.endline(i,r,s),r.state=t.InsideTag,b=i.children,E=0,d=b.length;E<d;E++)f=b[E],p+=this.writeChildNode(f,r,s+1);r.state=t.CloseTag,p+="]"}return r.state=t.CloseTag,p+=r.spaceBeforeSlash+">",p+=this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),p},o.prototype.element=function(i,r,s){var f,E,d,p,b,w,T,v,I,D,C,g,_,M;s||(s=0),D=!1,C="",this.openNode(i,r,s),r.state=t.OpenTag,C+=this.indent(i,r,s)+"<"+i.name,g=i.attribs;for(I in g)n.call(g,I)&&(f=g[I],C+=this.attribute(f,r,s));if(d=i.children.length,p=d===0?null:i.children[0],d===0||i.children.every(function(X){return(X.type===a.Text||X.type===a.Raw)&&X.value===""}))r.allowEmpty?(C+=">",r.state=t.CloseTag,C+="</"+i.name+">"+this.endline(i,r,s)):(r.state=t.CloseTag,C+=r.spaceBeforeSlash+"/>"+this.endline(i,r,s));else if(r.pretty&&d===1&&(p.type===a.Text||p.type===a.Raw)&&p.value!=null)C+=">",r.state=t.InsideTag,r.suppressPrettyCount++,D=!0,C+=this.writeChildNode(p,r,s+1),r.suppressPrettyCount--,D=!1,r.state=t.CloseTag,C+="</"+i.name+">"+this.endline(i,r,s);else{if(r.dontPrettyTextNodes){for(_=i.children,b=0,T=_.length;b<T;b++)if(E=_[b],(E.type===a.Text||E.type===a.Raw)&&E.value!=null){r.suppressPrettyCount++,D=!0;break}}for(C+=">"+this.endline(i,r,s),r.state=t.InsideTag,M=i.children,w=0,v=M.length;w<v;w++)E=M[w],C+=this.writeChildNode(E,r,s+1);r.state=t.CloseTag,C+=this.indent(i,r,s)+"</"+i.name+">",D&&r.suppressPrettyCount--,C+=this.endline(i,r,s),r.state=t.None}return this.closeNode(i,r,s),C},o.prototype.writeChildNode=function(i,r,s){switch(i.type){case a.CData:return this.cdata(i,r,s);case a.Comment:return this.comment(i,r,s);case a.Element:return this.element(i,r,s);case a.Raw:return this.raw(i,r,s);case a.Text:return this.text(i,r,s);case a.ProcessingInstruction:return this.processingInstruction(i,r,s);case a.Dummy:return"";case a.Declaration:return this.declaration(i,r,s);case a.DocType:return this.docType(i,r,s);case a.AttributeDeclaration:return this.dtdAttList(i,r,s);case a.ElementDeclaration:return this.dtdElement(i,r,s);case a.EntityDeclaration:return this.dtdEntity(i,r,s);case a.NotationDeclaration:return this.dtdNotation(i,r,s);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},o.prototype.processingInstruction=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<?",r.state=t.InsideTag,f+=i.target,i.value&&(f+=" "+i.value),r.state=t.CloseTag,f+=r.spaceBeforeSlash+"?>",f+=this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.raw=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s),r.state=t.InsideTag,f+=i.value,r.state=t.CloseTag,f+=this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.text=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s),r.state=t.InsideTag,f+=i.value,r.state=t.CloseTag,f+=this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.dtdAttList=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<!ATTLIST",r.state=t.InsideTag,f+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(f+=" "+i.defaultValueType),i.defaultValue&&(f+=' "'+i.defaultValue+'"'),r.state=t.CloseTag,f+=r.spaceBeforeSlash+">"+this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.dtdElement=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<!ELEMENT",r.state=t.InsideTag,f+=" "+i.name+" "+i.value,r.state=t.CloseTag,f+=r.spaceBeforeSlash+">"+this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.dtdEntity=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<!ENTITY",r.state=t.InsideTag,i.pe&&(f+=" %"),f+=" "+i.name,i.value?f+=' "'+i.value+'"':(i.pubID&&i.sysID?f+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(f+=' SYSTEM "'+i.sysID+'"'),i.nData&&(f+=" NDATA "+i.nData)),r.state=t.CloseTag,f+=r.spaceBeforeSlash+">"+this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.dtdNotation=function(i,r,s){var f;return this.openNode(i,r,s),r.state=t.OpenTag,f=this.indent(i,r,s)+"<!NOTATION",r.state=t.InsideTag,f+=" "+i.name,i.pubID&&i.sysID?f+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?f+=' PUBLIC "'+i.pubID+'"':i.sysID&&(f+=' SYSTEM "'+i.sysID+'"'),r.state=t.CloseTag,f+=r.spaceBeforeSlash+">"+this.endline(i,r,s),r.state=t.None,this.closeNode(i,r,s),f},o.prototype.openNode=function(i,r,s){},o.prototype.closeNode=function(i,r,s){},o.prototype.openAttribute=function(i,r,s){},o.prototype.closeAttribute=function(i,r,s){},o}()}.call(it)),Pn.exports}var wi;function ur(){return wi||(wi=1,function(){var a,t=function(n,o){for(var i in o)e.call(o,i)&&(n[i]=o[i]);function r(){this.constructor=n}return r.prototype=o.prototype,n.prototype=new r,n.__super__=o.prototype,n},e={}.hasOwnProperty;a=es(),Mn.exports=function(n){t(o,n);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,r){var s,f,E,d,p;for(r=this.filterOptions(r),d="",p=i.children,f=0,E=p.length;f<E;f++)s=p[f],d+=this.writeChildNode(s,r,0);return r.pretty&&d.slice(-r.newline.length)===r.newline&&(d=d.slice(0,-r.newline.length)),d},o}(a)}.call(it)),Mn.exports}var Ei;function ns(){return Ei||(Ei=1,function(){var a,t,e,n,o,i,r,s=function(E,d){for(var p in d)f.call(d,p)&&(E[p]=d[p]);function b(){this.constructor=E}return b.prototype=d.prototype,E.prototype=new b,E.__super__=d.prototype,E},f={}.hasOwnProperty;r=Wt().isPlainObject,e=Qi(),t=xo(),n=Pt(),a=bt(),i=ts(),o=ur(),on.exports=function(E){s(d,E);function d(p){d.__super__.constructor.call(this,null),this.name="#document",this.type=a.Document,this.documentURI=null,this.domConfig=new t,p||(p={}),p.writer||(p.writer=new o),this.options=p,this.stringify=new i(p)}return Object.defineProperty(d.prototype,"implementation",{value:new e}),Object.defineProperty(d.prototype,"doctype",{get:function(){var p,b,w,T;for(T=this.children,b=0,w=T.length;b<w;b++)if(p=T[b],p.type===a.DocType)return p;return null}}),Object.defineProperty(d.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(d.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(d.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(d.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===a.Declaration?this.children[0].encoding:null}}),Object.defineProperty(d.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===a.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(d.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===a.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(d.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(d.prototype,"origin",{get:function(){return null}}),Object.defineProperty(d.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(d.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(d.prototype,"contentType",{get:function(){return null}}),d.prototype.end=function(p){var b;return b={},p?r(p)&&(b=p,p=this.options.writer):p=this.options.writer,p.document(this,p.filterOptions(b))},d.prototype.toString=function(p){return this.options.writer.document(this,this.options.writer.filterOptions(p))},d.prototype.createElement=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createTextNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createComment=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createCDATASection=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createProcessingInstruction=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createAttribute=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createEntityReference=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.importNode=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createElementNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createAttributeNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(p,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementById=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.adoptNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.renameNode=function(p,b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createEvent=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createNodeIterator=function(p,b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createTreeWalker=function(p,b,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},d}(n)}.call(it)),on.exports}var Sn={exports:{}},xi;function Co(){return xi||(xi=1,function(){var a,t,e,n,o,i,r,s,f,E,d,p,b,w,T,v,I,D,C,g,_,M,X,q={}.hasOwnProperty;X=Wt(),_=X.isObject,g=X.isFunction,M=X.isPlainObject,C=X.getValue,a=bt(),p=ns(),b=Kn(),n=Qn(),o=Jn(),T=sr(),D=or(),w=ar(),E=Zn(),d=ir(),i=tr(),s=er(),r=nr(),f=rr(),e=Ji(),I=ts(),v=ur(),t=Xe(),Sn.exports=function(){function U(m,R,S){var B;this.name="?xml",this.type=a.Document,m||(m={}),B={},m.writer?M(m.writer)&&(B=m.writer,m.writer=new v):m.writer=new v,this.options=m,this.writer=m.writer,this.writerOptions=this.writer.filterOptions(B),this.stringify=new I(m),this.onDataCallback=R||function(){},this.onEndCallback=S||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return U.prototype.createChildNode=function(m){var R,S,B,$,W,Y,k,V;switch(m.type){case a.CData:this.cdata(m.value);break;case a.Comment:this.comment(m.value);break;case a.Element:B={},k=m.attribs;for(S in k)q.call(k,S)&&(R=k[S],B[S]=R.value);this.node(m.name,B);break;case a.Dummy:this.dummy();break;case a.Raw:this.raw(m.value);break;case a.Text:this.text(m.value);break;case a.ProcessingInstruction:this.instruction(m.target,m.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+m.constructor.name)}for(V=m.children,W=0,Y=V.length;W<Y;W++)$=V[W],this.createChildNode($),$.type===a.Element&&this.up();return this},U.prototype.dummy=function(){return this},U.prototype.node=function(m,R,S){var B;if(m==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(m));return this.openCurrent(),m=C(m),R==null&&(R={}),R=C(R),_(R)||(B=[R,S],S=B[0],R=B[1]),this.currentNode=new b(this,m,R),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,S!=null&&this.text(S),this},U.prototype.element=function(m,R,S){var B,$,W,Y,k,V;if(this.currentNode&&this.currentNode.type===a.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(m)||_(m)||g(m))for(Y=this.options.noValidation,this.options.noValidation=!0,V=new p(this.options).element("TEMP_ROOT"),V.element(m),this.options.noValidation=Y,k=V.children,$=0,W=k.length;$<W;$++)B=k[$],this.createChildNode(B),B.type===a.Element&&this.up();else this.node(m,R,S);return this},U.prototype.attribute=function(m,R){var S,B;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(m));if(m!=null&&(m=C(m)),_(m))for(S in m)q.call(m,S)&&(B=m[S],this.attribute(S,B));else g(R)&&(R=R.apply()),this.options.keepNullAttributes&&R==null?this.currentNode.attribs[m]=new e(this,m,""):R!=null&&(this.currentNode.attribs[m]=new e(this,m,R));return this},U.prototype.text=function(m){var R;return this.openCurrent(),R=new D(this,m),this.onData(this.writer.text(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.cdata=function(m){var R;return this.openCurrent(),R=new n(this,m),this.onData(this.writer.cdata(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.comment=function(m){var R;return this.openCurrent(),R=new o(this,m),this.onData(this.writer.comment(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.raw=function(m){var R;return this.openCurrent(),R=new T(this,m),this.onData(this.writer.raw(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.instruction=function(m,R){var S,B,$,W,Y;if(this.openCurrent(),m!=null&&(m=C(m)),R!=null&&(R=C(R)),Array.isArray(m))for(S=0,W=m.length;S<W;S++)B=m[S],this.instruction(B);else if(_(m))for(B in m)q.call(m,B)&&($=m[B],this.instruction(B,$));else g(R)&&(R=R.apply()),Y=new w(this,m,R),this.onData(this.writer.processingInstruction(Y,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},U.prototype.declaration=function(m,R,S){var B;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return B=new E(this,m,R,S),this.onData(this.writer.declaration(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.doctype=function(m,R,S){if(this.openCurrent(),m==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 d(this,R,S),this.currentNode.rootNodeName=m,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},U.prototype.dtdElement=function(m,R){var S;return this.openCurrent(),S=new r(this,m,R),this.onData(this.writer.dtdElement(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.attList=function(m,R,S,B,$){var W;return this.openCurrent(),W=new i(this,m,R,S,B,$),this.onData(this.writer.dtdAttList(W,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.entity=function(m,R){var S;return this.openCurrent(),S=new s(this,!1,m,R),this.onData(this.writer.dtdEntity(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.pEntity=function(m,R){var S;return this.openCurrent(),S=new s(this,!0,m,R),this.onData(this.writer.dtdEntity(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.notation=function(m,R){var S;return this.openCurrent(),S=new f(this,m,R),this.onData(this.writer.dtdNotation(S,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},U.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},U.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},U.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},U.prototype.openNode=function(m){var R,S,B,$;if(!m.isOpen){if(!this.root&&this.currentLevel===0&&m.type===a.Element&&(this.root=m),S="",m.type===a.Element){this.writerOptions.state=t.OpenTag,S=this.writer.indent(m,this.writerOptions,this.currentLevel)+"<"+m.name,$=m.attribs;for(B in $)q.call($,B)&&(R=$[B],S+=this.writer.attribute(R,this.writerOptions,this.currentLevel));S+=(m.children?">":"/>")+this.writer.endline(m,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,S=this.writer.indent(m,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+m.rootNodeName,m.pubID&&m.sysID?S+=' PUBLIC "'+m.pubID+'" "'+m.sysID+'"':m.sysID&&(S+=' SYSTEM "'+m.sysID+'"'),m.children?(S+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,S+=">"),S+=this.writer.endline(m,this.writerOptions,this.currentLevel);return this.onData(S,this.currentLevel),m.isOpen=!0}},U.prototype.closeNode=function(m){var R;if(!m.isClosed)return R="",this.writerOptions.state=t.CloseTag,m.type===a.Element?R=this.writer.indent(m,this.writerOptions,this.currentLevel)+"</"+m.name+">"+this.writer.endline(m,this.writerOptions,this.currentLevel):R=this.writer.indent(m,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(m,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(R,this.currentLevel),m.isClosed=!0},U.prototype.onData=function(m,R){return this.documentStarted=!0,this.onDataCallback(m,R+1)},U.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},U.prototype.debugInfo=function(m){return m==null?"":"node: <"+m+">"},U.prototype.ele=function(){return this.element.apply(this,arguments)},U.prototype.nod=function(m,R,S){return this.node(m,R,S)},U.prototype.txt=function(m){return this.text(m)},U.prototype.dat=function(m){return this.cdata(m)},U.prototype.com=function(m){return this.comment(m)},U.prototype.ins=function(m,R){return this.instruction(m,R)},U.prototype.dec=function(m,R,S){return this.declaration(m,R,S)},U.prototype.dtd=function(m,R,S){return this.doctype(m,R,S)},U.prototype.e=function(m,R,S){return this.element(m,R,S)},U.prototype.n=function(m,R,S){return this.node(m,R,S)},U.prototype.t=function(m){return this.text(m)},U.prototype.d=function(m){return this.cdata(m)},U.prototype.c=function(m){return this.comment(m)},U.prototype.r=function(m){return this.raw(m)},U.prototype.i=function(m,R){return this.instruction(m,R)},U.prototype.att=function(){return this.currentNode&&this.currentNode.type===a.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},U.prototype.a=function(){return this.currentNode&&this.currentNode.type===a.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},U.prototype.ent=function(m,R){return this.entity(m,R)},U.prototype.pent=function(m,R){return this.pEntity(m,R)},U.prototype.not=function(m,R){return this.notation(m,R)},U}()}.call(it)),Sn.exports}var Fn={exports:{}},Oi;function To(){return Oi||(Oi=1,function(){var a,t,e,n=function(i,r){for(var s in r)o.call(r,s)&&(i[s]=r[s]);function f(){this.constructor=i}return f.prototype=r.prototype,i.prototype=new f,i.__super__=r.prototype,i},o={}.hasOwnProperty;a=bt(),e=es(),t=Xe(),Fn.exports=function(i){n(r,i);function r(s,f){this.stream=s,r.__super__.constructor.call(this,f)}return r.prototype.endline=function(s,f,E){return s.isLastRootNode&&f.state===t.CloseTag?"":r.__super__.endline.call(this,s,f,E)},r.prototype.document=function(s,f){var E,d,p,b,w,T,v,I,D;for(v=s.children,d=p=0,w=v.length;p<w;d=++p)E=v[d],E.isLastRootNode=d===s.children.length-1;for(f=this.filterOptions(f),I=s.children,D=[],b=0,T=I.length;b<T;b++)E=I[b],D.push(this.writeChildNode(E,f,0));return D},r.prototype.attribute=function(s,f,E){return this.stream.write(r.__super__.attribute.call(this,s,f,E))},r.prototype.cdata=function(s,f,E){return this.stream.write(r.__super__.cdata.call(this,s,f,E))},r.prototype.comment=function(s,f,E){return this.stream.write(r.__super__.comment.call(this,s,f,E))},r.prototype.declaration=function(s,f,E){return this.stream.write(r.__super__.declaration.call(this,s,f,E))},r.prototype.docType=function(s,f,E){var d,p,b,w;if(E||(E=0),this.openNode(s,f,E),f.state=t.OpenTag,this.stream.write(this.indent(s,f,E)),this.stream.write("<!DOCTYPE "+s.root().name),s.pubID&&s.sysID?this.stream.write(' PUBLIC "'+s.pubID+'" "'+s.sysID+'"'):s.sysID&&this.stream.write(' SYSTEM "'+s.sysID+'"'),s.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(s,f,E)),f.state=t.InsideTag,w=s.children,p=0,b=w.length;p<b;p++)d=w[p],this.writeChildNode(d,f,E+1);f.state=t.CloseTag,this.stream.write("]")}return f.state=t.CloseTag,this.stream.write(f.spaceBeforeSlash+">"),this.stream.write(this.endline(s,f,E)),f.state=t.None,this.closeNode(s,f,E)},r.prototype.element=function(s,f,E){var d,p,b,w,T,v,I,D,C;E||(E=0),this.openNode(s,f,E),f.state=t.OpenTag,this.stream.write(this.indent(s,f,E)+"<"+s.name),D=s.attribs;for(I in D)o.call(D,I)&&(d=D[I],this.attribute(d,f,E));if(b=s.children.length,w=b===0?null:s.children[0],b===0||s.children.every(function(g){return(g.type===a.Text||g.type===a.Raw)&&g.value===""}))f.allowEmpty?(this.stream.write(">"),f.state=t.CloseTag,this.stream.write("</"+s.name+">")):(f.state=t.CloseTag,this.stream.write(f.spaceBeforeSlash+"/>"));else if(f.pretty&&b===1&&(w.type===a.Text||w.type===a.Raw)&&w.value!=null)this.stream.write(">"),f.state=t.InsideTag,f.suppressPrettyCount++,this.writeChildNode(w,f,E+1),f.suppressPrettyCount--,f.state=t.CloseTag,this.stream.write("</"+s.name+">");else{for(this.stream.write(">"+this.endline(s,f,E)),f.state=t.InsideTag,C=s.children,T=0,v=C.length;T<v;T++)p=C[T],this.writeChildNode(p,f,E+1);f.state=t.CloseTag,this.stream.write(this.indent(s,f,E)+"</"+s.name+">")}return this.stream.write(this.endline(s,f,E)),f.state=t.None,this.closeNode(s,f,E)},r.prototype.processingInstruction=function(s,f,E){return this.stream.write(r.__super__.processingInstruction.call(this,s,f,E))},r.prototype.raw=function(s,f,E){return this.stream.write(r.__super__.raw.call(this,s,f,E))},r.prototype.text=function(s,f,E){return this.stream.write(r.__super__.text.call(this,s,f,E))},r.prototype.dtdAttList=function(s,f,E){return this.stream.write(r.__super__.dtdAttList.call(this,s,f,E))},r.prototype.dtdElement=function(s,f,E){return this.stream.write(r.__super__.dtdElement.call(this,s,f,E))},r.prototype.dtdEntity=function(s,f,E){return this.stream.write(r.__super__.dtdEntity.call(this,s,f,E))},r.prototype.dtdNotation=function(s,f,E){return this.stream.write(r.__super__.dtdNotation.call(this,s,f,E))},r}(e)}.call(it)),Fn.exports}var Ii;function Do(){return Ii||(Ii=1,function(){var a,t,e,n,o,i,r,s,f,E;E=Wt(),s=E.assign,f=E.isFunction,e=Qi(),n=ns(),o=Co(),r=ur(),i=To(),a=bt(),t=Xe(),$t.create=function(d,p,b,w){var T,v;if(d==null)throw new Error("Root element needs a name.");return w=s({},p,b,w),T=new n(w),v=T.element(d),w.headless||(T.declaration(w),(w.pubID!=null||w.sysID!=null)&&T.dtd(w)),v},$t.begin=function(d,p,b){var w;return f(d)&&(w=[d,p],p=w[0],b=w[1],d={}),p?new o(d,p,b):new n(d)},$t.stringWriter=function(d){return new r(d)},$t.streamWriter=function(d,p){return new i(d,p)},$t.implementation=new e,$t.nodeType=a,$t.writerState=t}.call(it)),$t}var Ci;function _o(){return Ci||(Ci=1,function(){var a,t,e,n,o,i={}.hasOwnProperty;a=Do(),t=Gn().defaults,n=function(r){return typeof r=="string"&&(r.indexOf("&")>=0||r.indexOf(">")>=0||r.indexOf("<")>=0)},o=function(r){return"<![CDATA["+e(r)+"]]>"},e=function(r){return r.replace("]]>","]]]]><![CDATA[>")},rn.Builder=function(){function r(s){var f,E,d;this.options={},E=t["0.2"];for(f in E)i.call(E,f)&&(d=E[f],this.options[f]=d);for(f in s)i.call(s,f)&&(d=s[f],this.options[f]=d)}return r.prototype.buildObject=function(s){var f,E,d,p,b;return f=this.options.attrkey,E=this.options.charkey,Object.keys(s).length===1&&this.options.rootName===t["0.2"].rootName?(b=Object.keys(s)[0],s=s[b]):b=this.options.rootName,d=function(w){return function(T,v){var I,D,C,g,_,M;if(typeof v!="object")w.options.cdata&&n(v)?T.raw(o(v)):T.txt(v);else if(Array.isArray(v)){for(g in v)if(i.call(v,g)){D=v[g];for(_ in D)C=D[_],T=d(T.ele(_),C).up()}}else for(_ in v)if(i.call(v,_))if(D=v[_],_===f){if(typeof D=="object")for(I in D)M=D[I],T=T.att(I,M)}else if(_===E)w.options.cdata&&n(D)?T=T.raw(o(D)):T=T.txt(D);else if(Array.isArray(D))for(g in D)i.call(D,g)&&(C=D[g],typeof C=="string"?w.options.cdata&&n(C)?T=T.ele(_).raw(o(C)).up():T=T.ele(_,C).up():T=d(T.ele(_),C).up());else typeof D=="object"?T=d(T.ele(_),D).up():typeof D=="string"&&w.options.cdata&&n(D)?T=T.ele(_).raw(o(D)).up():(D==null&&(D=""),T=T.ele(_,D.toString()).up());return T}}(this),p=a.create(b,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),d(p,s).end(this.options.renderOpts)},r}()}.call(it)),rn}var jn={},Rn={},Bn={},Pe={exports:{}},Un={},fe={},Ti;function vo(){if(Ti)return fe;Ti=1,fe.byteLength=s,fe.toByteArray=E,fe.fromByteArray=b;for(var a=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o<i;++o)a[o]=n[o],t[n.charCodeAt(o)]=o;t[45]=62,t[95]=63;function r(w){var T=w.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var v=w.indexOf("=");v===-1&&(v=T);var I=v===T?0:4-v%4;return[v,I]}function s(w){var T=r(w),v=T[0],I=T[1];return(v+I)*3/4-I}function f(w,T,v){return(T+v)*3/4-v}function E(w){var T,v=r(w),I=v[0],D=v[1],C=new e(f(w,I,D)),g=0,_=D>0?I-4:I,M;for(M=0;M<_;M+=4)T=t[w.charCodeAt(M)]<<18|t[w.charCodeAt(M+1)]<<12|t[w.charCodeAt(M+2)]<<6|t[w.charCodeAt(M+3)],C[g++]=T>>16&255,C[g++]=T>>8&255,C[g++]=T&255;return D===2&&(T=t[w.charCodeAt(M)]<<2|t[w.charCodeAt(M+1)]>>4,C[g++]=T&255),D===1&&(T=t[w.charCodeAt(M)]<<10|t[w.charCodeAt(M+1)]<<4|t[w.charCodeAt(M+2)]>>2,C[g++]=T>>8&255,C[g++]=T&255),C}function d(w){return a[w>>18&63]+a[w>>12&63]+a[w>>6&63]+a[w&63]}function p(w,T,v){for(var I,D=[],C=T;C<v;C+=3)I=(w[C]<<16&16711680)+(w[C+1]<<8&65280)+(w[C+2]&255),D.push(d(I));return D.join("")}function b(w){for(var T,v=w.length,I=v%3,D=[],C=16383,g=0,_=v-I;g<_;g+=C)D.push(p(w,g,g+C>_?_:g+C));return I===1?(T=w[v-1],D.push(a[T>>2]+a[T<<4&63]+"==")):I===2&&(T=(w[v-2]<<8)+w[v-1],D.push(a[T>>10]+a[T>>4&63]+a[T<<2&63]+"=")),D.join("")}return fe}var Le={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Di;function No(){return Di||(Di=1,Le.read=function(a,t,e,n,o){var i,r,s=o*8-n-1,f=(1<<s)-1,E=f>>1,d=-7,p=e?o-1:0,b=e?-1:1,w=a[t+p];for(p+=b,i=w&(1<<-d)-1,w>>=-d,d+=s;d>0;i=i*256+a[t+p],p+=b,d-=8);for(r=i&(1<<-d)-1,i>>=-d,d+=n;d>0;r=r*256+a[t+p],p+=b,d-=8);if(i===0)i=1-E;else{if(i===f)return r?NaN:(w?-1:1)*(1/0);r=r+Math.pow(2,n),i=i-E}return(w?-1:1)*r*Math.pow(2,i-n)},Le.write=function(a,t,e,n,o,i){var r,s,f,E=i*8-o-1,d=(1<<E)-1,p=d>>1,b=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,T=n?1:-1,v=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=d):(r=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-r))<1&&(r--,f*=2),r+p>=1?t+=b/f:t+=b*Math.pow(2,1-p),t*f>=2&&(r++,f/=2),r+p>=d?(s=0,r=d):r+p>=1?(s=(t*f-1)*Math.pow(2,o),r=r+p):(s=t*Math.pow(2,p-1)*Math.pow(2,o),r=0));o>=8;a[e+w]=s&255,w+=T,s/=256,o-=8);for(r=r<<o|s,E+=o;E>0;a[e+w]=r&255,w+=T,r/=256,E-=8);a[e+w-T]|=v*128}),Le}/*!
|
|
90
|
+
* The buffer module from node.js, for the browser.
|
|
91
|
+
*
|
|
92
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
93
|
+
* @license MIT
|
|
94
|
+
*/var _i;function Ao(){return _i||(_i=1,function(a){var t=vo(),e=No(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=s,a.SlowBuffer=C,a.INSPECT_MAX_BYTES=50;var o=2147483647;a.kMaxLength=o,s.TYPED_ARRAY_SUPPORT=i(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{var l=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(l,u),l.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function r(l){if(l>o)throw new RangeError('The value "'+l+'" is invalid for option "size"');var u=new Uint8Array(l);return Object.setPrototypeOf(u,s.prototype),u}function s(l,u,c){if(typeof l=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return p(l)}return f(l,u,c)}s.poolSize=8192;function f(l,u,c){if(typeof l=="string")return b(l,u);if(ArrayBuffer.isView(l))return T(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(rt(l,ArrayBuffer)||l&&rt(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(rt(l,SharedArrayBuffer)||l&&rt(l.buffer,SharedArrayBuffer)))return v(l,u,c);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var h=l.valueOf&&l.valueOf();if(h!=null&&h!==l)return s.from(h,u,c);var N=I(l);if(N)return N;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return s.from(l[Symbol.toPrimitive]("string"),u,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}s.from=function(l,u,c){return f(l,u,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function E(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function d(l,u,c){return E(l),l<=0?r(l):u!==void 0?typeof c=="string"?r(l).fill(u,c):r(l).fill(u):r(l)}s.alloc=function(l,u,c){return d(l,u,c)};function p(l){return E(l),r(l<0?0:D(l)|0)}s.allocUnsafe=function(l){return p(l)},s.allocUnsafeSlow=function(l){return p(l)};function b(l,u){if((typeof u!="string"||u==="")&&(u="utf8"),!s.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var c=g(l,u)|0,h=r(c),N=h.write(l,u);return N!==c&&(h=h.slice(0,N)),h}function w(l){for(var u=l.length<0?0:D(l.length)|0,c=r(u),h=0;h<u;h+=1)c[h]=l[h]&255;return c}function T(l){if(rt(l,Uint8Array)){var u=new Uint8Array(l);return v(u.buffer,u.byteOffset,u.byteLength)}return w(l)}function v(l,u,c){if(u<0||l.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');var h;return u===void 0&&c===void 0?h=new Uint8Array(l):c===void 0?h=new Uint8Array(l,u):h=new Uint8Array(l,u,c),Object.setPrototypeOf(h,s.prototype),h}function I(l){if(s.isBuffer(l)){var u=D(l.length)|0,c=r(u);return c.length===0||l.copy(c,0,0,u),c}if(l.length!==void 0)return typeof l.length!="number"||ht(l.length)?r(0):w(l);if(l.type==="Buffer"&&Array.isArray(l.data))return w(l.data)}function D(l){if(l>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return l|0}function C(l){return+l!=l&&(l=0),s.alloc(+l)}s.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==s.prototype},s.compare=function(u,c){if(rt(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),rt(c,Uint8Array)&&(c=s.from(c,c.offset,c.byteLength)),!s.isBuffer(u)||!s.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===c)return 0;for(var h=u.length,N=c.length,L=0,F=Math.min(h,N);L<F;++L)if(u[L]!==c[L]){h=u[L],N=c[L];break}return h<N?-1:N<h?1:0},s.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(u,c){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return s.alloc(0);var h;if(c===void 0)for(c=0,h=0;h<u.length;++h)c+=u[h].length;var N=s.allocUnsafe(c),L=0;for(h=0;h<u.length;++h){var F=u[h];if(rt(F,Uint8Array))L+F.length>N.length?s.from(F).copy(N,L):Uint8Array.prototype.set.call(N,F,L);else if(s.isBuffer(F))F.copy(N,L);else throw new TypeError('"list" argument must be an Array of Buffers');L+=F.length}return N};function g(l,u){if(s.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||rt(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);var c=l.length,h=arguments.length>2&&arguments[2]===!0;if(!h&&c===0)return 0;for(var N=!1;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return y(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return J(l).length;default:if(N)return h?-1:y(l).length;u=(""+u).toLowerCase(),N=!0}}s.byteLength=g;function _(l,u,c){var h=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,u>>>=0,c<=u))return"";for(l||(l="utf8");;)switch(l){case"hex":return Ot(this,u,c);case"utf8":case"utf-8":return W(this,u,c);case"ascii":return V(this,u,c);case"latin1":case"binary":return ft(this,u,c);case"base64":return $(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return at(this,u,c);default:if(h)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),h=!0}}s.prototype._isBuffer=!0;function M(l,u,c){var h=l[u];l[u]=l[c],l[c]=h}s.prototype.swap16=function(){var u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var c=0;c<u;c+=2)M(this,c,c+1);return this},s.prototype.swap32=function(){var u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var c=0;c<u;c+=4)M(this,c,c+3),M(this,c+1,c+2);return this},s.prototype.swap64=function(){var u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var c=0;c<u;c+=8)M(this,c,c+7),M(this,c+1,c+6),M(this,c+2,c+5),M(this,c+3,c+4);return this},s.prototype.toString=function(){var u=this.length;return u===0?"":arguments.length===0?W(this,0,u):_.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(u){if(!s.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:s.compare(this,u)===0},s.prototype.inspect=function(){var u="",c=a.INSPECT_MAX_BYTES;return u=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(u+=" ... "),"<Buffer "+u+">"},n&&(s.prototype[n]=s.prototype.inspect),s.prototype.compare=function(u,c,h,N,L){if(rt(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),!s.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(c===void 0&&(c=0),h===void 0&&(h=u?u.length:0),N===void 0&&(N=0),L===void 0&&(L=this.length),c<0||h>u.length||N<0||L>this.length)throw new RangeError("out of range index");if(N>=L&&c>=h)return 0;if(N>=L)return-1;if(c>=h)return 1;if(c>>>=0,h>>>=0,N>>>=0,L>>>=0,this===u)return 0;for(var F=L-N,Z=h-c,nt=Math.min(F,Z),lt=this.slice(N,L),Et=u.slice(c,h),pt=0;pt<nt;++pt)if(lt[pt]!==Et[pt]){F=lt[pt],Z=Et[pt];break}return F<Z?-1:Z<F?1:0};function X(l,u,c,h,N){if(l.length===0)return-1;if(typeof c=="string"?(h=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,ht(c)&&(c=N?0:l.length-1),c<0&&(c=l.length+c),c>=l.length){if(N)return-1;c=l.length-1}else if(c<0)if(N)c=0;else return-1;if(typeof u=="string"&&(u=s.from(u,h)),s.isBuffer(u))return u.length===0?-1:q(l,u,c,h,N);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?N?Uint8Array.prototype.indexOf.call(l,u,c):Uint8Array.prototype.lastIndexOf.call(l,u,c):q(l,[u],c,h,N);throw new TypeError("val must be string, number or Buffer")}function q(l,u,c,h,N){var L=1,F=l.length,Z=u.length;if(h!==void 0&&(h=String(h).toLowerCase(),h==="ucs2"||h==="ucs-2"||h==="utf16le"||h==="utf-16le")){if(l.length<2||u.length<2)return-1;L=2,F/=2,Z/=2,c/=2}function nt(cr,lr){return L===1?cr[lr]:cr.readUInt16BE(lr*L)}var lt;if(N){var Et=-1;for(lt=c;lt<F;lt++)if(nt(l,lt)===nt(u,Et===-1?0:lt-Et)){if(Et===-1&&(Et=lt),lt-Et+1===Z)return Et*L}else Et!==-1&&(lt-=lt-Et),Et=-1}else for(c+Z>F&&(c=F-Z),lt=c;lt>=0;lt--){for(var pt=!0,xe=0;xe<Z;xe++)if(nt(l,lt+xe)!==nt(u,xe)){pt=!1;break}if(pt)return lt}return-1}s.prototype.includes=function(u,c,h){return this.indexOf(u,c,h)!==-1},s.prototype.indexOf=function(u,c,h){return X(this,u,c,h,!0)},s.prototype.lastIndexOf=function(u,c,h){return X(this,u,c,h,!1)};function U(l,u,c,h){c=Number(c)||0;var N=l.length-c;h?(h=Number(h),h>N&&(h=N)):h=N;var L=u.length;h>L/2&&(h=L/2);for(var F=0;F<h;++F){var Z=parseInt(u.substr(F*2,2),16);if(ht(Z))return F;l[c+F]=Z}return F}function m(l,u,c,h){return ot(y(u,l.length-c),l,c,h)}function R(l,u,c,h){return ot(j(u),l,c,h)}function S(l,u,c,h){return ot(J(u),l,c,h)}function B(l,u,c,h){return ot(P(u,l.length-c),l,c,h)}s.prototype.write=function(u,c,h,N){if(c===void 0)N="utf8",h=this.length,c=0;else if(h===void 0&&typeof c=="string")N=c,h=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(h)?(h=h>>>0,N===void 0&&(N="utf8")):(N=h,h=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var L=this.length-c;if((h===void 0||h>L)&&(h=L),u.length>0&&(h<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");N||(N="utf8");for(var F=!1;;)switch(N){case"hex":return U(this,u,c,h);case"utf8":case"utf-8":return m(this,u,c,h);case"ascii":case"latin1":case"binary":return R(this,u,c,h);case"base64":return S(this,u,c,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,u,c,h);default:if(F)throw new TypeError("Unknown encoding: "+N);N=(""+N).toLowerCase(),F=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $(l,u,c){return u===0&&c===l.length?t.fromByteArray(l):t.fromByteArray(l.slice(u,c))}function W(l,u,c){c=Math.min(l.length,c);for(var h=[],N=u;N<c;){var L=l[N],F=null,Z=L>239?4:L>223?3:L>191?2:1;if(N+Z<=c){var nt,lt,Et,pt;switch(Z){case 1:L<128&&(F=L);break;case 2:nt=l[N+1],(nt&192)===128&&(pt=(L&31)<<6|nt&63,pt>127&&(F=pt));break;case 3:nt=l[N+1],lt=l[N+2],(nt&192)===128&&(lt&192)===128&&(pt=(L&15)<<12|(nt&63)<<6|lt&63,pt>2047&&(pt<55296||pt>57343)&&(F=pt));break;case 4:nt=l[N+1],lt=l[N+2],Et=l[N+3],(nt&192)===128&&(lt&192)===128&&(Et&192)===128&&(pt=(L&15)<<18|(nt&63)<<12|(lt&63)<<6|Et&63,pt>65535&&pt<1114112&&(F=pt))}}F===null?(F=65533,Z=1):F>65535&&(F-=65536,h.push(F>>>10&1023|55296),F=56320|F&1023),h.push(F),N+=Z}return k(h)}var Y=4096;function k(l){var u=l.length;if(u<=Y)return String.fromCharCode.apply(String,l);for(var c="",h=0;h<u;)c+=String.fromCharCode.apply(String,l.slice(h,h+=Y));return c}function V(l,u,c){var h="";c=Math.min(l.length,c);for(var N=u;N<c;++N)h+=String.fromCharCode(l[N]&127);return h}function ft(l,u,c){var h="";c=Math.min(l.length,c);for(var N=u;N<c;++N)h+=String.fromCharCode(l[N]);return h}function Ot(l,u,c){var h=l.length;(!u||u<0)&&(u=0),(!c||c<0||c>h)&&(c=h);for(var N="",L=u;L<c;++L)N+=A[l[L]];return N}function at(l,u,c){for(var h=l.slice(u,c),N="",L=0;L<h.length-1;L+=2)N+=String.fromCharCode(h[L]+h[L+1]*256);return N}s.prototype.slice=function(u,c){var h=this.length;u=~~u,c=c===void 0?h:~~c,u<0?(u+=h,u<0&&(u=0)):u>h&&(u=h),c<0?(c+=h,c<0&&(c=0)):c>h&&(c=h),c<u&&(c=u);var N=this.subarray(u,c);return Object.setPrototypeOf(N,s.prototype),N};function st(l,u,c){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+u>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(u,c,h){u=u>>>0,c=c>>>0,h||st(u,c,this.length);for(var N=this[u],L=1,F=0;++F<c&&(L*=256);)N+=this[u+F]*L;return N},s.prototype.readUintBE=s.prototype.readUIntBE=function(u,c,h){u=u>>>0,c=c>>>0,h||st(u,c,this.length);for(var N=this[u+--c],L=1;c>0&&(L*=256);)N+=this[u+--c]*L;return N},s.prototype.readUint8=s.prototype.readUInt8=function(u,c){return u=u>>>0,c||st(u,1,this.length),this[u]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||st(u,2,this.length),this[u]|this[u+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||st(u,2,this.length),this[u]<<8|this[u+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||st(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(u,c){return u=u>>>0,c||st(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},s.prototype.readIntLE=function(u,c,h){u=u>>>0,c=c>>>0,h||st(u,c,this.length);for(var N=this[u],L=1,F=0;++F<c&&(L*=256);)N+=this[u+F]*L;return L*=128,N>=L&&(N-=Math.pow(2,8*c)),N},s.prototype.readIntBE=function(u,c,h){u=u>>>0,c=c>>>0,h||st(u,c,this.length);for(var N=c,L=1,F=this[u+--N];N>0&&(L*=256);)F+=this[u+--N]*L;return L*=128,F>=L&&(F-=Math.pow(2,8*c)),F},s.prototype.readInt8=function(u,c){return u=u>>>0,c||st(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},s.prototype.readInt16LE=function(u,c){u=u>>>0,c||st(u,2,this.length);var h=this[u]|this[u+1]<<8;return h&32768?h|4294901760:h},s.prototype.readInt16BE=function(u,c){u=u>>>0,c||st(u,2,this.length);var h=this[u+1]|this[u]<<8;return h&32768?h|4294901760:h},s.prototype.readInt32LE=function(u,c){return u=u>>>0,c||st(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},s.prototype.readInt32BE=function(u,c){return u=u>>>0,c||st(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},s.prototype.readFloatLE=function(u,c){return u=u>>>0,c||st(u,4,this.length),e.read(this,u,!0,23,4)},s.prototype.readFloatBE=function(u,c){return u=u>>>0,c||st(u,4,this.length),e.read(this,u,!1,23,4)},s.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||st(u,8,this.length),e.read(this,u,!0,52,8)},s.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||st(u,8,this.length),e.read(this,u,!1,52,8)};function ut(l,u,c,h,N,L){if(!s.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>N||u<L)throw new RangeError('"value" argument is out of bounds');if(c+h>l.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(u,c,h,N){if(u=+u,c=c>>>0,h=h>>>0,!N){var L=Math.pow(2,8*h)-1;ut(this,u,c,h,L,0)}var F=1,Z=0;for(this[c]=u&255;++Z<h&&(F*=256);)this[c+Z]=u/F&255;return c+h},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(u,c,h,N){if(u=+u,c=c>>>0,h=h>>>0,!N){var L=Math.pow(2,8*h)-1;ut(this,u,c,h,L,0)}var F=h-1,Z=1;for(this[c+F]=u&255;--F>=0&&(Z*=256);)this[c+F]=u/Z&255;return c+h},s.prototype.writeUint8=s.prototype.writeUInt8=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,1,255,0),this[c]=u&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,2,65535,0),this[c]=u&255,this[c+1]=u>>>8,c+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,2,65535,0),this[c]=u>>>8,this[c+1]=u&255,c+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,4,4294967295,0),this[c+3]=u>>>24,this[c+2]=u>>>16,this[c+1]=u>>>8,this[c]=u&255,c+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,4,4294967295,0),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4},s.prototype.writeIntLE=function(u,c,h,N){if(u=+u,c=c>>>0,!N){var L=Math.pow(2,8*h-1);ut(this,u,c,h,L-1,-L)}var F=0,Z=1,nt=0;for(this[c]=u&255;++F<h&&(Z*=256);)u<0&&nt===0&&this[c+F-1]!==0&&(nt=1),this[c+F]=(u/Z>>0)-nt&255;return c+h},s.prototype.writeIntBE=function(u,c,h,N){if(u=+u,c=c>>>0,!N){var L=Math.pow(2,8*h-1);ut(this,u,c,h,L-1,-L)}var F=h-1,Z=1,nt=0;for(this[c+F]=u&255;--F>=0&&(Z*=256);)u<0&&nt===0&&this[c+F+1]!==0&&(nt=1),this[c+F]=(u/Z>>0)-nt&255;return c+h},s.prototype.writeInt8=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},s.prototype.writeInt16LE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},s.prototype.writeInt16BE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},s.prototype.writeInt32LE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,4,2147483647,-2147483648),this[c]=u&255,this[c+1]=u>>>8,this[c+2]=u>>>16,this[c+3]=u>>>24,c+4},s.prototype.writeInt32BE=function(u,c,h){return u=+u,c=c>>>0,h||ut(this,u,c,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4};function _t(l,u,c,h,N,L){if(c+h>l.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function K(l,u,c,h,N){return u=+u,c=c>>>0,N||_t(l,u,c,4),e.write(l,u,c,h,23,4),c+4}s.prototype.writeFloatLE=function(u,c,h){return K(this,u,c,!0,h)},s.prototype.writeFloatBE=function(u,c,h){return K(this,u,c,!1,h)};function Ut(l,u,c,h,N){return u=+u,c=c>>>0,N||_t(l,u,c,8),e.write(l,u,c,h,52,8),c+8}s.prototype.writeDoubleLE=function(u,c,h){return Ut(this,u,c,!0,h)},s.prototype.writeDoubleBE=function(u,c,h){return Ut(this,u,c,!1,h)},s.prototype.copy=function(u,c,h,N){if(!s.isBuffer(u))throw new TypeError("argument should be a Buffer");if(h||(h=0),!N&&N!==0&&(N=this.length),c>=u.length&&(c=u.length),c||(c=0),N>0&&N<h&&(N=h),N===h||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(h<0||h>=this.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("sourceEnd out of bounds");N>this.length&&(N=this.length),u.length-c<N-h&&(N=u.length-c+h);var L=N-h;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,h,N):Uint8Array.prototype.set.call(u,this.subarray(h,N),c),L},s.prototype.fill=function(u,c,h,N){if(typeof u=="string"){if(typeof c=="string"?(N=c,c=0,h=this.length):typeof h=="string"&&(N=h,h=this.length),N!==void 0&&typeof N!="string")throw new TypeError("encoding must be a string");if(typeof N=="string"&&!s.isEncoding(N))throw new TypeError("Unknown encoding: "+N);if(u.length===1){var L=u.charCodeAt(0);(N==="utf8"&&L<128||N==="latin1")&&(u=L)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<h)throw new RangeError("Out of range index");if(h<=c)return this;c=c>>>0,h=h===void 0?this.length:h>>>0,u||(u=0);var F;if(typeof u=="number")for(F=c;F<h;++F)this[F]=u;else{var Z=s.isBuffer(u)?u:s.from(u,N),nt=Z.length;if(nt===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(F=0;F<h-c;++F)this[F+c]=Z[F%nt]}return this};var Q=/[^+/0-9A-Za-z-_]/g;function x(l){if(l=l.split("=")[0],l=l.trim().replace(Q,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function y(l,u){u=u||1/0;for(var c,h=l.length,N=null,L=[],F=0;F<h;++F){if(c=l.charCodeAt(F),c>55295&&c<57344){if(!N){if(c>56319){(u-=3)>-1&&L.push(239,191,189);continue}else if(F+1===h){(u-=3)>-1&&L.push(239,191,189);continue}N=c;continue}if(c<56320){(u-=3)>-1&&L.push(239,191,189),N=c;continue}c=(N-55296<<10|c-56320)+65536}else N&&(u-=3)>-1&&L.push(239,191,189);if(N=null,c<128){if((u-=1)<0)break;L.push(c)}else if(c<2048){if((u-=2)<0)break;L.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;L.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;L.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return L}function j(l){for(var u=[],c=0;c<l.length;++c)u.push(l.charCodeAt(c)&255);return u}function P(l,u){for(var c,h,N,L=[],F=0;F<l.length&&!((u-=2)<0);++F)c=l.charCodeAt(F),h=c>>8,N=c%256,L.push(N),L.push(h);return L}function J(l){return t.toByteArray(x(l))}function ot(l,u,c,h){for(var N=0;N<h&&!(N+c>=u.length||N>=l.length);++N)u[N+c]=l[N];return N}function rt(l,u){return l instanceof u||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===u.name}function ht(l){return l!==l}var A=function(){for(var l="0123456789abcdef",u=new Array(256),c=0;c<16;++c)for(var h=c*16,N=0;N<16;++N)u[h+N]=l[c]+l[N];return u}()}(Un)),Un}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var vi;function Mo(){return vi||(vi=1,function(a,t){var e=Ao(),n=e.Buffer;function o(r,s){for(var f in r)s[f]=r[f]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?a.exports=e:(o(e,t),t.Buffer=i);function i(r,s,f){return n(r,s,f)}i.prototype=Object.create(n.prototype),o(n,i),i.from=function(r,s,f){if(typeof r=="number")throw new TypeError("Argument must not be a number");return n(r,s,f)},i.alloc=function(r,s,f){if(typeof r!="number")throw new TypeError("Argument must be a number");var E=n(r);return s!==void 0?typeof f=="string"?E.fill(s,f):E.fill(s):E.fill(0),E},i.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return n(r)},i.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(r)}}(Pe,Pe.exports)),Pe.exports}var Ni;function Po(){if(Ni)return Bn;Ni=1;var a=Mo().Buffer,t=a.isEncoding||function(D){switch(D=""+D,D&&D.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function e(D){if(!D)return"utf8";for(var C;;)switch(D){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return D;default:if(C)return;D=(""+D).toLowerCase(),C=!0}}function n(D){var C=e(D);if(typeof C!="string"&&(a.isEncoding===t||!t(D)))throw new Error("Unknown encoding: "+D);return C||D}Bn.StringDecoder=o;function o(D){this.encoding=n(D);var C;switch(this.encoding){case"utf16le":this.text=p,this.end=b,C=4;break;case"utf8":this.fillLast=f,C=4;break;case"base64":this.text=w,this.end=T,C=3;break;default:this.write=v,this.end=I;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=a.allocUnsafe(C)}o.prototype.write=function(D){if(D.length===0)return"";var C,g;if(this.lastNeed){if(C=this.fillLast(D),C===void 0)return"";g=this.lastNeed,this.lastNeed=0}else g=0;return g<D.length?C?C+this.text(D,g):this.text(D,g):C||""},o.prototype.end=d,o.prototype.text=E,o.prototype.fillLast=function(D){if(this.lastNeed<=D.length)return D.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);D.copy(this.lastChar,this.lastTotal-this.lastNeed,0,D.length),this.lastNeed-=D.length};function i(D){return D<=127?0:D>>5===6?2:D>>4===14?3:D>>3===30?4:D>>6===2?-1:-2}function r(D,C,g){var _=C.length-1;if(_<g)return 0;var M=i(C[_]);return M>=0?(M>0&&(D.lastNeed=M-1),M):--_<g||M===-2?0:(M=i(C[_]),M>=0?(M>0&&(D.lastNeed=M-2),M):--_<g||M===-2?0:(M=i(C[_]),M>=0?(M>0&&(M===2?M=0:D.lastNeed=M-3),M):0))}function s(D,C,g){if((C[0]&192)!==128)return D.lastNeed=0,"�";if(D.lastNeed>1&&C.length>1){if((C[1]&192)!==128)return D.lastNeed=1,"�";if(D.lastNeed>2&&C.length>2&&(C[2]&192)!==128)return D.lastNeed=2,"�"}}function f(D){var C=this.lastTotal-this.lastNeed,g=s(this,D);if(g!==void 0)return g;if(this.lastNeed<=D.length)return D.copy(this.lastChar,C,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);D.copy(this.lastChar,C,0,D.length),this.lastNeed-=D.length}function E(D,C){var g=r(this,D,C);if(!this.lastNeed)return D.toString("utf8",C);this.lastTotal=g;var _=D.length-(g-this.lastNeed);return D.copy(this.lastChar,0,_),D.toString("utf8",C,_)}function d(D){var C=D&&D.length?this.write(D):"";return this.lastNeed?C+"�":C}function p(D,C){if((D.length-C)%2===0){var g=D.toString("utf16le",C);if(g){var _=g.charCodeAt(g.length-1);if(_>=55296&&_<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=D[D.length-2],this.lastChar[1]=D[D.length-1],g.slice(0,-1)}return g}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=D[D.length-1],D.toString("utf16le",C,D.length-1)}function b(D){var C=D&&D.length?this.write(D):"";if(this.lastNeed){var g=this.lastTotal-this.lastNeed;return C+this.lastChar.toString("utf16le",0,g)}return C}function w(D,C){var g=(D.length-C)%3;return g===0?D.toString("base64",C):(this.lastNeed=3-g,this.lastTotal=3,g===1?this.lastChar[0]=D[D.length-1]:(this.lastChar[0]=D[D.length-2],this.lastChar[1]=D[D.length-1]),D.toString("base64",C,D.length-g))}function T(D){var C=D&&D.length?this.write(D):"";return this.lastNeed?C+this.lastChar.toString("base64",0,3-this.lastNeed):C}function v(D){return D.toString(this.encoding)}function I(D){return D&&D.length?this.write(D):""}return Bn}var Ai;function Lo(){return Ai||(Ai=1,function(a){(function(t){t.parser=function(x,y){return new n(x,y)},t.SAXParser=n,t.SAXStream=d,t.createStream=E,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(x,y){if(!(this instanceof n))return new n(x,y);var j=this;i(j),j.q=j.c="",j.bufferCheckPosition=t.MAX_BUFFER_LENGTH,j.opt=y||{},j.opt.lowercase=j.opt.lowercase||j.opt.lowercasetags,j.looseCase=j.opt.lowercase?"toLowerCase":"toUpperCase",j.tags=[],j.closed=j.closedRoot=j.sawRoot=!1,j.tag=j.error=null,j.strict=!!x,j.noscript=!!(x||j.opt.noscript),j.state=m.BEGIN,j.strictEntities=j.opt.strictEntities,j.ENTITIES=j.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),j.attribList=[],j.opt.xmlns&&(j.ns=Object.create(v)),j.opt.unquotedAttributeValues===void 0&&(j.opt.unquotedAttributeValues=!x),j.trackPosition=j.opt.position!==!1,j.trackPosition&&(j.position=j.line=j.column=0),S(j,"onready")}Object.create||(Object.create=function(x){function y(){}y.prototype=x;var j=new y;return j}),Object.keys||(Object.keys=function(x){var y=[];for(var j in x)x.hasOwnProperty(j)&&y.push(j);return y});function o(x){for(var y=Math.max(t.MAX_BUFFER_LENGTH,10),j=0,P=0,J=e.length;P<J;P++){var ot=x[e[P]].length;if(ot>y)switch(e[P]){case"textNode":$(x);break;case"cdata":B(x,"oncdata",x.cdata),x.cdata="";break;case"script":B(x,"onscript",x.script),x.script="";break;default:Y(x,"Max buffer length exceeded: "+e[P])}j=Math.max(j,ot)}var rt=t.MAX_BUFFER_LENGTH-j;x.bufferCheckPosition=rt+x.position}function i(x){for(var y=0,j=e.length;y<j;y++)x[e[y]]=""}function r(x){$(x),x.cdata!==""&&(B(x,"oncdata",x.cdata),x.cdata=""),x.script!==""&&(B(x,"onscript",x.script),x.script="")}n.prototype={end:function(){k(this)},write:Q,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){r(this)}};var s;try{s=require("stream").Stream}catch{s=function(){}}s||(s=function(){});var f=t.EVENTS.filter(function(x){return x!=="error"&&x!=="end"});function E(x,y){return new d(x,y)}function d(x,y){if(!(this instanceof d))return new d(x,y);s.apply(this),this._parser=new n(x,y),this.writable=!0,this.readable=!0;var j=this;this._parser.onend=function(){j.emit("end")},this._parser.onerror=function(P){j.emit("error",P),j._parser.error=null},this._decoder=null,f.forEach(function(P){Object.defineProperty(j,"on"+P,{get:function(){return j._parser["on"+P]},set:function(J){if(!J)return j.removeAllListeners(P),j._parser["on"+P]=J,J;j.on(P,J)},enumerable:!0,configurable:!1})})}d.prototype=Object.create(s.prototype,{constructor:{value:d}}),d.prototype.write=function(x){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(x)){if(!this._decoder){var y=Po().StringDecoder;this._decoder=new y("utf8")}x=this._decoder.write(x)}return this._parser.write(x.toString()),this.emit("data",x),!0},d.prototype.end=function(x){return x&&x.length&&this.write(x),this._parser.end(),!0},d.prototype.on=function(x,y){var j=this;return!j._parser["on"+x]&&f.indexOf(x)!==-1&&(j._parser["on"+x]=function(){var P=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);P.splice(0,0,x),j.emit.apply(j,P)}),s.prototype.on.call(j,x,y)};var p="[CDATA[",b="DOCTYPE",w="http://www.w3.org/XML/1998/namespace",T="http://www.w3.org/2000/xmlns/",v={xml:w,xmlns:T},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]/,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\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,C=/[#:_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]/,g=/[#:_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){return x===" "||x===`
|
|
95
|
+
`||x==="\r"||x===" "}function M(x){return x==='"'||x==="'"}function X(x){return x===">"||_(x)}function q(x,y){return x.test(y)}function U(x,y){return!q(x,y)}var m=0;t.STATE={BEGIN:m++,BEGIN_WHITESPACE:m++,TEXT:m++,TEXT_ENTITY:m++,OPEN_WAKA:m++,SGML_DECL:m++,SGML_DECL_QUOTED:m++,DOCTYPE:m++,DOCTYPE_QUOTED:m++,DOCTYPE_DTD:m++,DOCTYPE_DTD_QUOTED:m++,COMMENT_STARTING:m++,COMMENT:m++,COMMENT_ENDING:m++,COMMENT_ENDED:m++,CDATA:m++,CDATA_ENDING:m++,CDATA_ENDING_2:m++,PROC_INST:m++,PROC_INST_BODY:m++,PROC_INST_ENDING:m++,OPEN_TAG:m++,OPEN_TAG_SLASH:m++,ATTRIB:m++,ATTRIB_NAME:m++,ATTRIB_NAME_SAW_WHITE:m++,ATTRIB_VALUE:m++,ATTRIB_VALUE_QUOTED:m++,ATTRIB_VALUE_CLOSED:m++,ATTRIB_VALUE_UNQUOTED:m++,ATTRIB_VALUE_ENTITY_Q:m++,ATTRIB_VALUE_ENTITY_U:m++,CLOSE_TAG:m++,CLOSE_TAG_SAW_WHITE:m++,SCRIPT:m++,SCRIPT_ENDING:m++},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(x){var y=t.ENTITIES[x],j=typeof y=="number"?String.fromCharCode(y):y;t.ENTITIES[x]=j});for(var R in t.STATE)t.STATE[t.STATE[R]]=R;m=t.STATE;function S(x,y,j){x[y]&&x[y](j)}function B(x,y,j){x.textNode&&$(x),S(x,y,j)}function $(x){x.textNode=W(x.opt,x.textNode),x.textNode&&S(x,"ontext",x.textNode),x.textNode=""}function W(x,y){return x.trim&&(y=y.trim()),x.normalize&&(y=y.replace(/\s+/g," ")),y}function Y(x,y){return $(x),x.trackPosition&&(y+=`
|
|
96
|
+
Line: `+x.line+`
|
|
97
|
+
Column: `+x.column+`
|
|
98
|
+
Char: `+x.c),y=new Error(y),x.error=y,S(x,"onerror",y),x}function k(x){return x.sawRoot&&!x.closedRoot&&V(x,"Unclosed root tag"),x.state!==m.BEGIN&&x.state!==m.BEGIN_WHITESPACE&&x.state!==m.TEXT&&Y(x,"Unexpected end"),$(x),x.c="",x.closed=!0,S(x,"onend"),n.call(x,x.strict,x.opt),x}function V(x,y){if(typeof x!="object"||!(x instanceof n))throw new Error("bad call to strictFail");x.strict&&Y(x,y)}function ft(x){x.strict||(x.tagName=x.tagName[x.looseCase]());var y=x.tags[x.tags.length-1]||x,j=x.tag={name:x.tagName,attributes:{}};x.opt.xmlns&&(j.ns=y.ns),x.attribList.length=0,B(x,"onopentagstart",j)}function Ot(x,y){var j=x.indexOf(":"),P=j<0?["",x]:x.split(":"),J=P[0],ot=P[1];return y&&x==="xmlns"&&(J="xmlns",ot=""),{prefix:J,local:ot}}function at(x){if(x.strict||(x.attribName=x.attribName[x.looseCase]()),x.attribList.indexOf(x.attribName)!==-1||x.tag.attributes.hasOwnProperty(x.attribName)){x.attribName=x.attribValue="";return}if(x.opt.xmlns){var y=Ot(x.attribName,!0),j=y.prefix,P=y.local;if(j==="xmlns")if(P==="xml"&&x.attribValue!==w)V(x,"xml: prefix must be bound to "+w+`
|
|
99
|
+
Actual: `+x.attribValue);else if(P==="xmlns"&&x.attribValue!==T)V(x,"xmlns: prefix must be bound to "+T+`
|
|
100
|
+
Actual: `+x.attribValue);else{var J=x.tag,ot=x.tags[x.tags.length-1]||x;J.ns===ot.ns&&(J.ns=Object.create(ot.ns)),J.ns[P]=x.attribValue}x.attribList.push([x.attribName,x.attribValue])}else x.tag.attributes[x.attribName]=x.attribValue,B(x,"onattribute",{name:x.attribName,value:x.attribValue});x.attribName=x.attribValue=""}function st(x,y){if(x.opt.xmlns){var j=x.tag,P=Ot(x.tagName);j.prefix=P.prefix,j.local=P.local,j.uri=j.ns[P.prefix]||"",j.prefix&&!j.uri&&(V(x,"Unbound namespace prefix: "+JSON.stringify(x.tagName)),j.uri=P.prefix);var J=x.tags[x.tags.length-1]||x;j.ns&&J.ns!==j.ns&&Object.keys(j.ns).forEach(function(F){B(x,"onopennamespace",{prefix:F,uri:j.ns[F]})});for(var ot=0,rt=x.attribList.length;ot<rt;ot++){var ht=x.attribList[ot],A=ht[0],l=ht[1],u=Ot(A,!0),c=u.prefix,h=u.local,N=c===""?"":j.ns[c]||"",L={name:A,value:l,prefix:c,local:h,uri:N};c&&c!=="xmlns"&&!N&&(V(x,"Unbound namespace prefix: "+JSON.stringify(c)),L.uri=c),x.tag.attributes[A]=L,B(x,"onattribute",L)}x.attribList.length=0}x.tag.isSelfClosing=!!y,x.sawRoot=!0,x.tags.push(x.tag),B(x,"onopentag",x.tag),y||(!x.noscript&&x.tagName.toLowerCase()==="script"?x.state=m.SCRIPT:x.state=m.TEXT,x.tag=null,x.tagName=""),x.attribName=x.attribValue="",x.attribList.length=0}function ut(x){if(!x.tagName){V(x,"Weird empty close tag."),x.textNode+="</>",x.state=m.TEXT;return}if(x.script){if(x.tagName!=="script"){x.script+="</"+x.tagName+">",x.tagName="",x.state=m.SCRIPT;return}B(x,"onscript",x.script),x.script=""}var y=x.tags.length,j=x.tagName;x.strict||(j=j[x.looseCase]());for(var P=j;y--;){var J=x.tags[y];if(J.name!==P)V(x,"Unexpected close tag");else break}if(y<0){V(x,"Unmatched closing tag: "+x.tagName),x.textNode+="</"+x.tagName+">",x.state=m.TEXT;return}x.tagName=j;for(var ot=x.tags.length;ot-- >y;){var rt=x.tag=x.tags.pop();x.tagName=x.tag.name,B(x,"onclosetag",x.tagName);var ht={};for(var A in rt.ns)ht[A]=rt.ns[A];var l=x.tags[x.tags.length-1]||x;x.opt.xmlns&&rt.ns!==l.ns&&Object.keys(rt.ns).forEach(function(u){var c=rt.ns[u];B(x,"onclosenamespace",{prefix:u,uri:c})})}y===0&&(x.closedRoot=!0),x.tagName=x.attribValue=x.attribName="",x.attribList.length=0,x.state=m.TEXT}function _t(x){var y=x.entity,j=y.toLowerCase(),P,J="";return x.ENTITIES[y]?x.ENTITIES[y]:x.ENTITIES[j]?x.ENTITIES[j]:(y=j,y.charAt(0)==="#"&&(y.charAt(1)==="x"?(y=y.slice(2),P=parseInt(y,16),J=P.toString(16)):(y=y.slice(1),P=parseInt(y,10),J=P.toString(10))),y=y.replace(/^0+/,""),isNaN(P)||J.toLowerCase()!==y?(V(x,"Invalid character entity"),"&"+x.entity+";"):String.fromCodePoint(P))}function K(x,y){y==="<"?(x.state=m.OPEN_WAKA,x.startTagPosition=x.position):_(y)||(V(x,"Non-whitespace before first tag."),x.textNode=y,x.state=m.TEXT)}function Ut(x,y){var j="";return y<x.length&&(j=x.charAt(y)),j}function Q(x){var y=this;if(this.error)throw this.error;if(y.closed)return Y(y,"Cannot write after close. Assign an onready handler.");if(x===null)return k(y);typeof x=="object"&&(x=x.toString());for(var j=0,P="";P=Ut(x,j++),y.c=P,!!P;)switch(y.trackPosition&&(y.position++,P===`
|
|
101
|
+
`?(y.line++,y.column=0):y.column++),y.state){case m.BEGIN:if(y.state=m.BEGIN_WHITESPACE,P==="\uFEFF")continue;K(y,P);continue;case m.BEGIN_WHITESPACE:K(y,P);continue;case m.TEXT:if(y.sawRoot&&!y.closedRoot){for(var J=j-1;P&&P!=="<"&&P!=="&";)P=Ut(x,j++),P&&y.trackPosition&&(y.position++,P===`
|
|
102
|
+
`?(y.line++,y.column=0):y.column++);y.textNode+=x.substring(J,j-1)}P==="<"&&!(y.sawRoot&&y.closedRoot&&!y.strict)?(y.state=m.OPEN_WAKA,y.startTagPosition=y.position):(!_(P)&&(!y.sawRoot||y.closedRoot)&&V(y,"Text data outside of root node."),P==="&"?y.state=m.TEXT_ENTITY:y.textNode+=P);continue;case m.SCRIPT:P==="<"?y.state=m.SCRIPT_ENDING:y.script+=P;continue;case m.SCRIPT_ENDING:P==="/"?y.state=m.CLOSE_TAG:(y.script+="<"+P,y.state=m.SCRIPT);continue;case m.OPEN_WAKA:if(P==="!")y.state=m.SGML_DECL,y.sgmlDecl="";else if(!_(P))if(q(I,P))y.state=m.OPEN_TAG,y.tagName=P;else if(P==="/")y.state=m.CLOSE_TAG,y.tagName="";else if(P==="?")y.state=m.PROC_INST,y.procInstName=y.procInstBody="";else{if(V(y,"Unencoded <"),y.startTagPosition+1<y.position){var ot=y.position-y.startTagPosition;P=new Array(ot).join(" ")+P}y.textNode+="<"+P,y.state=m.TEXT}continue;case m.SGML_DECL:if(y.sgmlDecl+P==="--"){y.state=m.COMMENT,y.comment="",y.sgmlDecl="";continue}y.doctype&&y.doctype!==!0&&y.sgmlDecl?(y.state=m.DOCTYPE_DTD,y.doctype+="<!"+y.sgmlDecl+P,y.sgmlDecl=""):(y.sgmlDecl+P).toUpperCase()===p?(B(y,"onopencdata"),y.state=m.CDATA,y.sgmlDecl="",y.cdata=""):(y.sgmlDecl+P).toUpperCase()===b?(y.state=m.DOCTYPE,(y.doctype||y.sawRoot)&&V(y,"Inappropriately located doctype declaration"),y.doctype="",y.sgmlDecl=""):P===">"?(B(y,"onsgmldeclaration",y.sgmlDecl),y.sgmlDecl="",y.state=m.TEXT):(M(P)&&(y.state=m.SGML_DECL_QUOTED),y.sgmlDecl+=P);continue;case m.SGML_DECL_QUOTED:P===y.q&&(y.state=m.SGML_DECL,y.q=""),y.sgmlDecl+=P;continue;case m.DOCTYPE:P===">"?(y.state=m.TEXT,B(y,"ondoctype",y.doctype),y.doctype=!0):(y.doctype+=P,P==="["?y.state=m.DOCTYPE_DTD:M(P)&&(y.state=m.DOCTYPE_QUOTED,y.q=P));continue;case m.DOCTYPE_QUOTED:y.doctype+=P,P===y.q&&(y.q="",y.state=m.DOCTYPE);continue;case m.DOCTYPE_DTD:P==="]"?(y.doctype+=P,y.state=m.DOCTYPE):P==="<"?(y.state=m.OPEN_WAKA,y.startTagPosition=y.position):M(P)?(y.doctype+=P,y.state=m.DOCTYPE_DTD_QUOTED,y.q=P):y.doctype+=P;continue;case m.DOCTYPE_DTD_QUOTED:y.doctype+=P,P===y.q&&(y.state=m.DOCTYPE_DTD,y.q="");continue;case m.COMMENT:P==="-"?y.state=m.COMMENT_ENDING:y.comment+=P;continue;case m.COMMENT_ENDING:P==="-"?(y.state=m.COMMENT_ENDED,y.comment=W(y.opt,y.comment),y.comment&&B(y,"oncomment",y.comment),y.comment=""):(y.comment+="-"+P,y.state=m.COMMENT);continue;case m.COMMENT_ENDED:P!==">"?(V(y,"Malformed comment"),y.comment+="--"+P,y.state=m.COMMENT):y.doctype&&y.doctype!==!0?y.state=m.DOCTYPE_DTD:y.state=m.TEXT;continue;case m.CDATA:P==="]"?y.state=m.CDATA_ENDING:y.cdata+=P;continue;case m.CDATA_ENDING:P==="]"?y.state=m.CDATA_ENDING_2:(y.cdata+="]"+P,y.state=m.CDATA);continue;case m.CDATA_ENDING_2:P===">"?(y.cdata&&B(y,"oncdata",y.cdata),B(y,"onclosecdata"),y.cdata="",y.state=m.TEXT):P==="]"?y.cdata+="]":(y.cdata+="]]"+P,y.state=m.CDATA);continue;case m.PROC_INST:P==="?"?y.state=m.PROC_INST_ENDING:_(P)?y.state=m.PROC_INST_BODY:y.procInstName+=P;continue;case m.PROC_INST_BODY:if(!y.procInstBody&&_(P))continue;P==="?"?y.state=m.PROC_INST_ENDING:y.procInstBody+=P;continue;case m.PROC_INST_ENDING:P===">"?(B(y,"onprocessinginstruction",{name:y.procInstName,body:y.procInstBody}),y.procInstName=y.procInstBody="",y.state=m.TEXT):(y.procInstBody+="?"+P,y.state=m.PROC_INST_BODY);continue;case m.OPEN_TAG:q(D,P)?y.tagName+=P:(ft(y),P===">"?st(y):P==="/"?y.state=m.OPEN_TAG_SLASH:(_(P)||V(y,"Invalid character in tag name"),y.state=m.ATTRIB));continue;case m.OPEN_TAG_SLASH:P===">"?(st(y,!0),ut(y)):(V(y,"Forward-slash in opening tag not followed by >"),y.state=m.ATTRIB);continue;case m.ATTRIB:if(_(P))continue;P===">"?st(y):P==="/"?y.state=m.OPEN_TAG_SLASH:q(I,P)?(y.attribName=P,y.attribValue="",y.state=m.ATTRIB_NAME):V(y,"Invalid attribute name");continue;case m.ATTRIB_NAME:P==="="?y.state=m.ATTRIB_VALUE:P===">"?(V(y,"Attribute without value"),y.attribValue=y.attribName,at(y),st(y)):_(P)?y.state=m.ATTRIB_NAME_SAW_WHITE:q(D,P)?y.attribName+=P:V(y,"Invalid attribute name");continue;case m.ATTRIB_NAME_SAW_WHITE:if(P==="=")y.state=m.ATTRIB_VALUE;else{if(_(P))continue;V(y,"Attribute without value"),y.tag.attributes[y.attribName]="",y.attribValue="",B(y,"onattribute",{name:y.attribName,value:""}),y.attribName="",P===">"?st(y):q(I,P)?(y.attribName=P,y.state=m.ATTRIB_NAME):(V(y,"Invalid attribute name"),y.state=m.ATTRIB)}continue;case m.ATTRIB_VALUE:if(_(P))continue;M(P)?(y.q=P,y.state=m.ATTRIB_VALUE_QUOTED):(y.opt.unquotedAttributeValues||Y(y,"Unquoted attribute value"),y.state=m.ATTRIB_VALUE_UNQUOTED,y.attribValue=P);continue;case m.ATTRIB_VALUE_QUOTED:if(P!==y.q){P==="&"?y.state=m.ATTRIB_VALUE_ENTITY_Q:y.attribValue+=P;continue}at(y),y.q="",y.state=m.ATTRIB_VALUE_CLOSED;continue;case m.ATTRIB_VALUE_CLOSED:_(P)?y.state=m.ATTRIB:P===">"?st(y):P==="/"?y.state=m.OPEN_TAG_SLASH:q(I,P)?(V(y,"No whitespace between attributes"),y.attribName=P,y.attribValue="",y.state=m.ATTRIB_NAME):V(y,"Invalid attribute name");continue;case m.ATTRIB_VALUE_UNQUOTED:if(!X(P)){P==="&"?y.state=m.ATTRIB_VALUE_ENTITY_U:y.attribValue+=P;continue}at(y),P===">"?st(y):y.state=m.ATTRIB;continue;case m.CLOSE_TAG:if(y.tagName)P===">"?ut(y):q(D,P)?y.tagName+=P:y.script?(y.script+="</"+y.tagName,y.tagName="",y.state=m.SCRIPT):(_(P)||V(y,"Invalid tagname in closing tag"),y.state=m.CLOSE_TAG_SAW_WHITE);else{if(_(P))continue;U(I,P)?y.script?(y.script+="</"+P,y.state=m.SCRIPT):V(y,"Invalid tagname in closing tag."):y.tagName=P}continue;case m.CLOSE_TAG_SAW_WHITE:if(_(P))continue;P===">"?ut(y):V(y,"Invalid characters in closing tag");continue;case m.TEXT_ENTITY:case m.ATTRIB_VALUE_ENTITY_Q:case m.ATTRIB_VALUE_ENTITY_U:var rt,ht;switch(y.state){case m.TEXT_ENTITY:rt=m.TEXT,ht="textNode";break;case m.ATTRIB_VALUE_ENTITY_Q:rt=m.ATTRIB_VALUE_QUOTED,ht="attribValue";break;case m.ATTRIB_VALUE_ENTITY_U:rt=m.ATTRIB_VALUE_UNQUOTED,ht="attribValue";break}if(P===";"){var A=_t(y);y.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(A)?(y.entity="",y.state=rt,y.write(A)):(y[ht]+=A,y.entity="",y.state=rt)}else q(y.entity.length?g:C,P)?y.entity+=P:(V(y,"Invalid character in entity name"),y[ht]+="&"+y.entity+P,y.entity="",y.state=rt);continue;default:throw new Error(y,"Unknown state: "+y.state)}return y.position>=y.bufferCheckPosition&&o(y),y}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var x=String.fromCharCode,y=Math.floor,j=function(){var P=16384,J=[],ot,rt,ht=-1,A=arguments.length;if(!A)return"";for(var l="";++ht<A;){var u=Number(arguments[ht]);if(!isFinite(u)||u<0||u>1114111||y(u)!==u)throw RangeError("Invalid code point: "+u);u<=65535?J.push(u):(u-=65536,ot=(u>>10)+55296,rt=u%1024+56320,J.push(ot,rt)),(ht+1===A||J.length>P)&&(l+=x.apply(null,J),J.length=0)}return l};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:j,configurable:!0,writable:!0}):String.fromCodePoint=j}()})(a)}(Rn)),Rn}var Xn={},Mi;function So(){return Mi||(Mi=1,function(){Xn.stripBOM=function(a){return a[0]==="\uFEFF"?a.substring(1):a}}.call(it)),Xn}var re={},Pi;function rs(){return Pi||(Pi=1,function(){var a;a=new RegExp(/(?!xmlns)^.*:/),re.normalize=function(t){return t.toLowerCase()},re.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},re.stripPrefix=function(t){return t.replace(a,"")},re.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},re.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(it)),re}var Li;function Fo(){return Li||(Li=1,function(a){(function(){var t,e,n,o,i,r,s,f,E,d=function(w,T){return function(){return w.apply(T,arguments)}},p=function(w,T){for(var v in T)b.call(T,v)&&(w[v]=T[v]);function I(){this.constructor=w}return I.prototype=T.prototype,w.prototype=new I,w.__super__=T.prototype,w},b={}.hasOwnProperty;f=Lo(),o=zn,t=So(),s=rs(),E=ls.setImmediate,e=Gn().defaults,i=function(w){return typeof w=="object"&&w!=null&&Object.keys(w).length===0},r=function(w,T,v){var I,D,C;for(I=0,D=w.length;I<D;I++)C=w[I],T=C(T,v);return T},n=function(w,T,v){var I;return I=Object.create(null),I.value=v,I.writable=!0,I.enumerable=!0,I.configurable=!0,Object.defineProperty(w,T,I)},a.Parser=function(w){p(T,w);function T(v){this.parseStringPromise=d(this.parseStringPromise,this),this.parseString=d(this.parseString,this),this.reset=d(this.reset,this),this.assignOrPush=d(this.assignOrPush,this),this.processAsync=d(this.processAsync,this);var I,D,C;if(!(this instanceof a.Parser))return new a.Parser(v);this.options={},D=e["0.2"];for(I in D)b.call(D,I)&&(C=D[I],this.options[I]=C);for(I in v)b.call(v,I)&&(C=v[I],this.options[I]=C);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(s.normalize)),this.reset()}return T.prototype.processAsync=function(){var v,I;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),E(this.processAsync))}catch(D){if(I=D,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(I)}},T.prototype.assignOrPush=function(v,I,D){return I in v?(v[I]instanceof Array||n(v,I,[v[I]]),v[I].push(D)):this.options.explicitArray?n(v,I,[D]):n(v,I,D)},T.prototype.reset=function(){var v,I,D,C;return this.removeAllListeners(),this.saxParser=f.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(g){return function(_){if(g.saxParser.resume(),!g.saxParser.errThrown)return g.saxParser.errThrown=!0,g.emit("error",_)}}(this),this.saxParser.onend=function(g){return function(){if(!g.saxParser.ended)return g.saxParser.ended=!0,g.emit("end",g.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,C=[],v=this.options.attrkey,I=this.options.charkey,this.saxParser.onopentag=function(g){return function(_){var M,X,q,U,m;if(q={},q[I]="",!g.options.ignoreAttrs){m=_.attributes;for(M in m)b.call(m,M)&&(!(v in q)&&!g.options.mergeAttrs&&(q[v]={}),X=g.options.attrValueProcessors?r(g.options.attrValueProcessors,_.attributes[M],M):_.attributes[M],U=g.options.attrNameProcessors?r(g.options.attrNameProcessors,M):M,g.options.mergeAttrs?g.assignOrPush(q,U,X):n(q[v],U,X))}return q["#name"]=g.options.tagNameProcessors?r(g.options.tagNameProcessors,_.name):_.name,g.options.xmlns&&(q[g.options.xmlnskey]={uri:_.uri,local:_.local}),C.push(q)}}(this),this.saxParser.onclosetag=function(g){return function(){var _,M,X,q,U,m,R,S,B,$;if(m=C.pop(),U=m["#name"],(!g.options.explicitChildren||!g.options.preserveChildrenOrder)&&delete m["#name"],m.cdata===!0&&(_=m.cdata,delete m.cdata),B=C[C.length-1],m[I].match(/^\s*$/)&&!_?(M=m[I],delete m[I]):(g.options.trim&&(m[I]=m[I].trim()),g.options.normalize&&(m[I]=m[I].replace(/\s{2,}/g," ").trim()),m[I]=g.options.valueProcessors?r(g.options.valueProcessors,m[I],U):m[I],Object.keys(m).length===1&&I in m&&!g.EXPLICIT_CHARKEY&&(m=m[I])),i(m)&&(typeof g.options.emptyTag=="function"?m=g.options.emptyTag():m=g.options.emptyTag!==""?g.options.emptyTag:M),g.options.validator!=null&&($="/"+function(){var W,Y,k;for(k=[],W=0,Y=C.length;W<Y;W++)q=C[W],k.push(q["#name"]);return k}().concat(U).join("/"),function(){var W;try{return m=g.options.validator($,B&&B[U],m)}catch(Y){return W=Y,g.emit("error",W)}}()),g.options.explicitChildren&&!g.options.mergeAttrs&&typeof m=="object"){if(!g.options.preserveChildrenOrder)q={},g.options.attrkey in m&&(q[g.options.attrkey]=m[g.options.attrkey],delete m[g.options.attrkey]),!g.options.charsAsChildren&&g.options.charkey in m&&(q[g.options.charkey]=m[g.options.charkey],delete m[g.options.charkey]),Object.getOwnPropertyNames(m).length>0&&(q[g.options.childkey]=m),m=q;else if(B){B[g.options.childkey]=B[g.options.childkey]||[],R={};for(X in m)b.call(m,X)&&n(R,X,m[X]);B[g.options.childkey].push(R),delete m["#name"],Object.keys(m).length===1&&I in m&&!g.EXPLICIT_CHARKEY&&(m=m[I])}}return C.length>0?g.assignOrPush(B,U,m):(g.options.explicitRoot&&(S=m,m={},n(m,U,S)),g.resultObject=m,g.saxParser.ended=!0,g.emit("end",g.resultObject))}}(this),D=function(g){return function(_){var M,X;if(X=C[C.length-1],X)return X[I]+=_,g.options.explicitChildren&&g.options.preserveChildrenOrder&&g.options.charsAsChildren&&(g.options.includeWhiteChars||_.replace(/\\n/g,"").trim()!=="")&&(X[g.options.childkey]=X[g.options.childkey]||[],M={"#name":"__text__"},M[I]=_,g.options.normalize&&(M[I]=M[I].replace(/\s{2,}/g," ").trim()),X[g.options.childkey].push(M)),X}}(this),this.saxParser.ontext=D,this.saxParser.oncdata=function(g){return function(_){var M;if(M=D(_),M)return M.cdata=!0}}()},T.prototype.parseString=function(v,I){var D;I!=null&&typeof I=="function"&&(this.on("end",function(C){return this.reset(),I(null,C)}),this.on("error",function(C){return this.reset(),I(C)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=t.stripBOM(v),this.options.async?(this.remaining=v,E(this.processAsync),this.saxParser):this.saxParser.write(v).close())}catch(C){if(D=C,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw D}else return this.emit("error",D),this.saxParser.errThrown=!0}},T.prototype.parseStringPromise=function(v){return new Promise(function(I){return function(D,C){return I.parseString(v,function(g,_){return g?C(g):D(_)})}}(this))},T}(o),a.parseString=function(w,T,v){var I,D,C;return v!=null?(typeof v=="function"&&(I=v),typeof T=="object"&&(D=T)):(typeof T=="function"&&(I=T),D={}),C=new a.Parser(D),C.parseString(w,I)},a.parseStringPromise=function(w,T){var v,I;return typeof T=="object"&&(v=T),I=new a.Parser(v),I.parseStringPromise(w)}}).call(it)}(jn)),jn}var is;(function(){var a,t,e,n=function(i,r){for(var s in r)o.call(r,s)&&(i[s]=r[s]);function f(){this.constructor=i}return f.prototype=r.prototype,i.prototype=new f,i.__super__=r.prototype,i},o={}.hasOwnProperty;t=Gn(),a=_o(),e=Fo(),rs(),t.defaults,function(i){n(r,i);function r(s){this.message=s}return r}(Error),a.Builder,e.Parser,e.parseString,is=e.parseStringPromise}).call(it);class ss{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.xdebugStatus="starting",this.initFileUri=null,this.dbgp=t,this.cdp=e,this.readPHPFile=n.getPHPFile,this.remoteRoot=n.remoteRoot||"",this.localRoot=n.localRoot||"";for(const o of n.knownScriptUrls)this.scriptIdByUrl.set(o,this.getOrCreateScriptId(o))}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 is(t,{explicitArray:!1});await this.handleDbgpMessage(e)}catch{}}),this.dbgp.on("close",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}}),setTimeout(()=>{this.cdp.ws&&this.cdp.ws.close()},100)}),this.cdp.on("clientConnected",()=>{if(this.xdebugConnected&&(this.sendInitialScripts(),this.xdebugStatus==="starting"||this.xdebugStatus==="break")){const t=this.sendDbgpCommand("stack_get");this.pendingCommands.set(t,{})}}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")})}sendInitialScripts(){if(this.initFileUri&&!this.scriptIdByUrl.has(this.initFileUri)){const t=this.getOrCreateScriptId(this.initFileUri);this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:t,url:this.initFileUri,startLine:0,startColumn:0,executionContextId:1}})}for(const[t,e]of this.scriptIdByUrl.entries())this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:e,url:t,startLine:0,startColumn:0,executionContextId:1}})}getOrCreateScriptId(t){let e=this.scriptIdByUrl.get(t);return e||(e=String(this.nextScriptId++),this.scriptIdByUrl.set(t,e)),e}formatPropertyFullName(t){let e=!1,n="";for(const o of t)o==='"'||o==="\\"||o==="\0"?(n+="\\"+o,e=!0):o===" "?(n+=o,e=!0):n+=o;return(e||t.includes("'"))&&(n=`"${n}"`),n}sendDbgpCommand(t,e){console.log("\x1B[1;32m[XDebug][send]\x1B[0m",t,e);const o=(this.nextTxnId++).toString();let i=`${t} -i ${o}`;return e!==void 0&&(i+=` ${e}`),this.dbgp.sendCommand(i),o}handleCdpMessage(t){const{id:e,method:n,params:o}=t;let i={},r=!0;switch(n){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:s,lineNumber:f}=o,E=s,d=(typeof f=="number"?f:0)+1,p=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(E)} -n ${d}`,w=this.sendDbgpCommand(b);this.pendingCommands.set(w,{cdpId:e,cdpMethod:n,params:{breakpointId:p,fileUri:E,line:d}}),r=!1}else this.breakpoints.set(p,{cdpId:p,xdebugId:null,file:E,line:d}),i={breakpointId:p,locations:[{scriptId:this.getOrCreateScriptId(E),lineNumber:d-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:s}=o,f=String(s),E=this.breakpoints.get(f);if(E){if(E.xdebugId&&this.xdebugConnected){const d=`breakpoint_remove -d ${E.xdebugId}`,p=this.sendDbgpCommand(d);this.pendingCommands.set(p,{cdpId:e,cdpMethod:n}),r=!1}this.breakpoints.delete(f)}i={};break}case"Debugger.resume":{this.xdebugConnected&&(this.xdebugStatus="running",this.sendDbgpCommand("run")),i={};break}case"Debugger.stepOver":{this.xdebugConnected&&(this.xdebugStatus="running",this.sendDbgpCommand("step_over")),i={};break}case"Debugger.stepInto":{this.xdebugConnected&&(this.xdebugStatus="running",this.sendDbgpCommand("step_into")),i={};break}case"Debugger.stepOut":{this.xdebugConnected&&(this.xdebugStatus="running",this.sendDbgpCommand("step_out")),i={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),i={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const s=o.expression||"",f=o.callFrameId;if(n==="Debugger.evaluateOnCallFrame"){if(f===void 0||!this.callFramesMap.has(f)){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(f)!==0){this.cdp.sendMessage({id:e,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const E=Buffer.from(s).toString("base64"),d=this.sendDbgpCommand("eval",`-- ${E}`);this.pendingCommands.set(d,{cdpId:e,cdpMethod:n}),r=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:s}=o,f=this.objectHandles.get(s);if(f&&this.xdebugConnected)if(f.type==="context"){const E=f.contextId??0,p=`context_get -d ${f.depth} -c ${E}`,b=this.sendDbgpCommand(p);this.pendingCommands.set(b,{cdpId:e,cdpMethod:n}),r=!1}else if(f.type==="property"){const E=f.depth,d=f.fullname,p=this.formatPropertyFullName(d),b=`property_get -d ${E} -n ${p}`,w=this.sendDbgpCommand(b);this.pendingCommands.set(w,{cdpId:e,cdpMethod:n,params:{parentObjectId:s}}),r=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const s=o.scriptId,f=[...this.scriptIdByUrl.entries()].find(([,d])=>d===s)?.[0];let E="";f&&(E=this.readPHPFile(this.uriToRemotePath(f))),i={scriptSource:E};break}default:i={};break}r&&this.cdp.sendMessage({id:e,result:i})}uriToRemotePath(t){return t.startsWith("file://")?t.slice(7):t}remoteToLocal(t){let e=t;return this.remoteRoot&&e.startsWith(this.remoteRoot)&&(e=xt.join(this.localRoot||"",e.slice(this.remoteRoot.length))),process.platform==="win32"&&e.startsWith("/")&&(e=e.slice(1)),e}async handleDbgpMessage(t){if(t.init){const e=t.init.$;this.initFileUri=e.fileuri||e.fileuri,this.xdebugStatus="starting";const n=this.sendDbgpCommand("step_into");this.pendingCommands.set(n,{}),this.cdp.ws&&this.sendInitialScripts();return}if(t.response){const e=t.response,n=e.$,o=n.command,i=n.transaction_id,r=this.pendingCommands.get(i);switch(o){case"breakpoint_set":{if(r&&r.cdpId!==void 0&&r.cdpMethod==="Debugger.setBreakpointByUrl"){const s=n.id,f=r.params;if(f){const{breakpointId:E,fileUri:d,line:p}=f;this.breakpoints.set(E,{cdpId:E,xdebugId:s,file:d,line:p});const b=this.getOrCreateScriptId(d),w={breakpointId:E,locations:[{scriptId:b,lineNumber:p-1,columnNumber:0}]};this.cdp.sendMessage({id:r.cdpId,result:w})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{r&&r.cdpId!==void 0&&(this.cdp.sendMessage({id:r.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const s=n.status;if(this.xdebugStatus=s,e["xdebug:message"]){const f=e["xdebug:message"].$.filename;if(f&&!this.scriptIdByUrl.has(f)){const E=this.getOrCreateScriptId(f);this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:E,url:f,startLine:0,startColumn:0,executionContextId:1}})}}if(s==="break"){const f=this.sendDbgpCommand("stack_get");this.pendingCommands.set(f,{}),this.pendingCommands.delete(i)}else(s==="stopping"||s==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(r&&r.cdpId!==void 0){let s;if(e.property){const E=e.property,d=E.$.type,p=E.$.encoding;let b=null;if(Object.prototype.hasOwnProperty.call(E,"_")?b=E._:typeof E.$value<"u"&&(b=E.$value),p==="base64"&&b!==null)try{b=Buffer.from(b,"base64").toString()}catch{}if(d==="string")s={type:"string",value:b??""};else if(d==="int"||d==="float"||d==="bool"||d==="boolen"||d==="integer"||d==="double"){let w=b;d.startsWith("int")||d==="integer"?w=parseInt(b||"0",10):d==="float"||d==="double"?w=parseFloat(b||"0"):d.startsWith("bool")&&(w=b==="1"||b==="true"),s={type:"number",value:w}}else if(d==="array"||d==="object"){const w=E.$.classname||(d==="array"?"Array":"Object"),T=String(this.nextObjectId++),v=E.$.fullname||"";this.objectHandles.set(T,{type:"property",depth:0,contextId:0,fullname:v}),s={type:"object",objectId:T,className:w,description:w}}else d==="null"?s={type:"object",subtype:"null",value:null}:s={type:"undefined",value:void 0}}else s={type:"undefined",value:void 0};const f={result:s};this.cdp.sendMessage({id:r.cdpId,result:f}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(r&&r.cdpId!==void 0){const s=[],f=e.property;if(f){const d=Array.isArray(f)?f:[f];for(const p of d){const b=p.$.name||p.$.fullname||"";let w=p.$.type||"undefined";const T=p.$.children==="1",v=p.$.encoding;let I=null;if(typeof p._<"u"&&(I=p._),v==="base64"&&I!==null)try{I=Buffer.from(I,"base64").toString()}catch{}if(T){const D=p.$.classname||(w==="array"?"Array":"Object"),C=String(this.nextObjectId++),g=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.contextId||0,_=r.cdpMethod==="Runtime.getProperties"&&r.params?.parentObjectId&&this.objectHandles.get(r.params.parentObjectId)?.depth||0;this.objectHandles.set(C,{type:"property",depth:_,contextId:g,fullname:p.$.fullname||b}),s.push({name:p.$.key||b,value:{type:"object",className:D,description:D,objectId:C},writable:!1,configurable:!1,enumerable:!0})}else{let D,C;w==="string"?D=I??"":w==="int"||w==="integer"?D=parseInt(I||"0",10):w==="float"||w==="double"?D=parseFloat(I||"0"):w==="bool"||w==="boolean"?(D=I==="1"||I==="true",w="boolean"):w==="null"?(D=null,C="null"):D=I;const g={type:w==="integer"?"number":w};C&&(g.subtype=C),g.value=D,s.push({name:p.$.key||b,value:g,writable:!1,configurable:!1,enumerable:!0})}}}const E={result:s};this.cdp.sendMessage({id:r.cdpId,result:E}),this.pendingCommands.delete(i)}break}case"stack_get":{if(e.stack){const s=Array.isArray(e.stack)?e.stack:[e.stack],f=[];this.callFramesMap.clear();for(const d of s){const p=d.$.filename,b=this.getOrCreateScriptId(p);this.scriptIdByUrl.has(p)||(this.scriptIdByUrl.set(p,b),this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:b,url:p,startLine:0,startColumn:0,executionContextId:1}}))}for(const d of s){const p=parseInt(d.$.level,10),b=d.$.filename,w=parseInt(d.$.lineno,10),T=d.$.where&&d.$.where!=="{main}"?d.$.where:"(anonymous)",v=this.getOrCreateScriptId(b),I=`frame:${p}`;this.callFramesMap.set(I,p);const D=[],C=String(this.nextObjectId++);this.objectHandles.set(C,{type:"context",contextId:0,depth:p}),D.push({type:"local",object:{objectId:C,className:"Object",description:"Local"}});const g=String(this.nextObjectId++);this.objectHandles.set(g,{type:"context",contextId:1,depth:p}),D.push({type:"global",object:{objectId:g,className:"Object",description:"Global"}}),f.push({callFrameId:I,functionName:T,location:{scriptId:v,lineNumber:w-1,columnNumber:0},scopeChain:D,this:{type:"object",className:"Object",description:"Object",objectId:g}})}let E="pause";if(s.length>0){const d=s[0];if(d.$.filename&&d.$.lineno){const p=d.$.filename,b=parseInt(d.$.lineno,10);for(const w of this.breakpoints.values())if(w.file===p&&w.line===b){E="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:E,callFrames:f,hitBreakpoints:E==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{r&&r.cdpId!==void 0&&(this.cdp.sendMessage({id:r.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const e=t.stream,n=e.$.type,o=e.$.encoding||"none";let i=typeof e._=="string"?e._:"";o==="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 os(a){const t=a.cdpPort??9229,e=a.dbgpPort??9003,n=a.cdpHost??"localhost",o=a.phpRoot??void 0,i=new qi(t);console.log("Connect Chrome DevTools to CDP at:"),console.log(`devtools://devtools/bundled/inspector.html?ws=${n}:${t}`),await new Promise(d=>i.on("clientConnected",d)),await new Promise(d=>setTimeout(d,2e3)),console.log("Chrome connected! Initializing Xdebug receiver...");const r=new Wi(e);console.log(`XDebug receiver running on port ${e}`),console.log("Running a PHP script with Xdebug enabled...");function s(d){const p=[],b=Bt.readdirSync(d);for(const w of b){const T=xt.join(d,w),v=Bt.lstatSync(T);v&&v.isDirectory()?p.push(...s(T)):w.endsWith(".php")&&p.push(`file://${T}`)}return p}const f=a.phpInstance?d=>a.phpInstance.readFileAsText(d):a.getPHPFile?a.getPHPFile:d=>{const p=d.startsWith("file://")?d.replace("file://",""):d;return Bt.readFileSync(p,"utf-8")},E=s(o);return new ss(r,i,{knownScriptUrls:E,remoteRoot:a.remoteRoot,localRoot:a.localRoot,getPHPFile:f})}function jo(){return bo(js(process.argv)).usage(`
|
|
103
|
+
XDebug Bridge Server CLI
|
|
104
|
+
|
|
105
|
+
Usage: xdebug-bridge [options]
|
|
106
|
+
`).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",default:"./"}).help().epilog(`
|
|
107
|
+
Examples:
|
|
108
|
+
xdebug-bridge # Start with default settings
|
|
109
|
+
xdebug-bridge --port 9000 --verbose # Custom port with verbose logging
|
|
110
|
+
xdebug-bridge --php-root /path/to/php/files # Specify PHP root directory
|
|
111
|
+
`).parseSync()}async function Ro(){const a=jo();if(a.help)return;console.log("Starting XDebug Bridge..."),(await os({cdpPort:9229,cdpHost:a.host,dbgpPort:a.port,phpRoot:a.phpRoot})).start()}exports.CDPServer=qi;exports.DbgpSession=Wi;exports.XdebugCDPBridge=ss;exports.main=Ro;exports.startBridge=os;
|