@php-wasm/cli 3.0.22 → 3.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/main.js +67 -27
  2. package/main.js.map +1 -1
  3. package/package.json +10 -7
package/main.js CHANGED
@@ -1,59 +1,99 @@
1
- import Ye from"os";import{readFileSync as Oe,writeFile as mn,statSync as yn,readdirSync as gn,lstatSync as wn,existsSync as bn,writeFileSync as Hr,mkdtempSync as ze,chmodSync as En}from"fs";import{rootCertificates as Tn}from"tls";import{LatestSupportedPHPVersion as xn,SupportedPHPVersionsList as Dn,PHP as vn}from"@php-wasm/universal";import{loadNodeRuntime as In,FileLockManagerForNode as Nn,useHostFilesystem as On}from"@php-wasm/node";import{WebSocketServer as Cn}from"ws";import An from"net";import"assert";import Pt,{resolve as Ce,normalize as Ln}from"path";import{format as Gr}from"util";import{fileURLToPath as _n}from"url";import{createHash as Mn}from"crypto";import Pn from"timers";const Yr=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(Yr==="NODE"){let u=function(c){return new Promise(function(a,f){c.onload=c.onerror=function(o){c.onload=c.onerror=null,o.type==="load"?a(c.result):f(new Error("Failed to read the blob/file"))}})},n=function(){const c=new Uint8Array([1,2,3,4]),f=new File([c],"test").stream();try{return f.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class c extends Blob{constructor(f,o,t){super(f);let i;t?.lastModified&&(i=new Date),(!i||isNaN(i.getFullYear()))&&(i=new Date),this.lastModifiedDate=i,this.lastModified=i.getMilliseconds(),this.name=o||""}}global.File=c}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const a=new FileReader;return a.readAsArrayBuffer(this),u(a)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const a=new FileReader;return a.readAsText(this),u(a)}),(typeof Blob.prototype.stream>"u"||!n())&&(Blob.prototype.stream=function(){let c=0;const a=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(f){const o=f.byobRequest.view,i=await a.slice(c,c+o.byteLength).arrayBuffer(),m=new Uint8Array(i);new Uint8Array(o.buffer).set(m);const N=m.byteLength;f.byobRequest.respond(N),c+=N,c>=a.size&&f.close()}})})}if(Yr==="NODE"&&typeof CustomEvent>"u"){class u extends Event{constructor(c,a={}){super(c,a),this.detail=a.detail}initCustomEvent(){}}globalThis.CustomEvent=u}const Fn="playground-log",Sn=(u,...n)=>{ht.dispatchEvent(new CustomEvent(Fn,{detail:{log:u,args:n}}))},Bn=(u,...n)=>{switch(typeof u.message=="string"?Reflect.set(u,"message",Ie(u.message)):u.message.message&&typeof u.message.message=="string"&&Reflect.set(u.message,"message",Ie(u.message.message)),u.severity){case ut.Debug:console.debug(u.message,...n);break;case ut.Info:console.info(u.message,...n);break;case ut.Warn:console.warn(u.message,...n);break;case ut.Error:console.error(u.message,...n);break;case ut.Fatal:console.error(u.message,...n);break;default:console.log(u.message,...n)}},Rn=u=>u instanceof Error?[u.message,u.stack].join(`
2
- `):JSON.stringify(u,null,2),zr=[],Ke=u=>{zr.push(u)},Kr=u=>{if(u.raw===!0)Ke(u.message);else{const n=Xn(typeof u.message=="object"?Rn(u.message):u.message,u.severity,u.prefix??xt.JS);Ke(n)}},ut={Fatal:{},Error:{name:"error",level:1},Warn:{name:"warn",level:2},Log:{name:"log",level:3},Info:{name:"info",level:4},Debug:{name:"debug",level:5}},xt={JS:"JavaScript"};class jn extends EventTarget{constructor(n=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=ut.Info,this.handlers=n}getLogs(){return this.handlers.includes(Kr)?[...zr]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
1
+ import{LatestSupportedPHPVersion as yi,SupportedPHPVersionsList as wi,PHP as bi}from"@php-wasm/universal";import{spawn as Ei}from"child_process";import se,{readFileSync as or,writeFile as Ti,statSync as Ni,readdirSync as vi,lstatSync as Ii,existsSync as xi,writeFileSync as Bn,mkdtempSync as Or,chmodSync as Oi}from"fs";import Ar from"os";import{rootCertificates as Ai}from"tls";import ue,{resolve as sr,normalize as Li}from"path";import{loadNodeRuntime as Pi,FileLockManagerForNode as _i,useHostFilesystem as Di}from"@php-wasm/node";import{WebSocketServer as Si}from"ws";import Mi from"net";import"assert";import{format as kn}from"util";import{fileURLToPath as Fi}from"url";import{createHash as Ci}from"crypto";import Bi from"timers";const Rn=":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",ki=Rn+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ri="["+Rn+"]["+ki+"]*",ji=new RegExp("^"+Ri+"$");function jn(e,t){const r=[];let n=t.exec(e);for(;n;){const a=[];a.startIndex=t.lastIndex-n[0].length;const o=n.length;for(let i=0;i<o;i++)a.push(n[i]);r.push(a),n=t.exec(e)}return r}const it=function(e){const t=ji.exec(e);return!(t===null||typeof t>"u")};function Ui(e){return typeof e<"u"}const Xi={allowBooleanAttributes:!1,unpairedTags:[]};function Vi(e,t){t=Object.assign({},Xi,t);const r=[];let n=!1,a=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=Pr(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=_r(e,o);continue}else{let s=!1;e[o]==="/"&&(s=!0,o++);let l="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
2
+ `&&e[o]!=="\r";o++)l+=e[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!Qi(l)){let m;return l.trim().length===0?m="Invalid space after '<'.":m="Tag '"+l+"' is an invalid name.",ie("InvalidTag",m,le(e,o))}const d=Wi(e,o);if(d===!1)return ie("InvalidAttr","Attributes for '"+l+"' have open quote.",le(e,o));let g=d.value;if(o=d.index,g[g.length-1]==="/"){const m=o-g.length;g=g.substring(0,g.length-1);const w=Dr(g,t);if(w===!0)n=!0;else return ie(w.err.code,w.err.msg,le(e,m+w.err.line))}else if(s)if(d.tagClosed){if(g.trim().length>0)return ie("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",le(e,i));if(r.length===0)return ie("InvalidTag","Closing tag '"+l+"' has not been opened.",le(e,i));{const m=r.pop();if(l!==m.tagName){let w=le(e,m.tagStartPos);return ie("InvalidTag","Expected closing tag '"+m.tagName+"' (opened in line "+w.line+", col "+w.col+") instead of closing tag '"+l+"'.",le(e,i))}r.length==0&&(a=!0)}}else return ie("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",le(e,o));else{const m=Dr(g,t);if(m!==!0)return ie(m.err.code,m.err.msg,le(e,o-g.length+m.err.line));if(a===!0)return ie("InvalidXml","Multiple possible root nodes found.",le(e,o));t.unpairedTags.indexOf(l)!==-1||r.push({tagName:l,tagStartPos:i}),n=!0}for(o++;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="!"){o++,o=_r(e,o);continue}else if(e[o+1]==="?"){if(o=Pr(e,++o),o.err)return o}else break;else if(e[o]==="&"){const m=Yi(e,o);if(m==-1)return ie("InvalidChar","char '&' is not expected.",le(e,o));o=m}else if(a===!0&&!Lr(e[o]))return ie("InvalidXml","Extra text at the end",le(e,o));e[o]==="<"&&o--}}else{if(Lr(e[o]))continue;return ie("InvalidChar","char '"+e[o]+"' is not expected.",le(e,o))}if(n){if(r.length==1)return ie("InvalidTag","Unclosed tag '"+r[0].tagName+"'.",le(e,r[0].tagStartPos));if(r.length>0)return ie("InvalidXml","Invalid '"+JSON.stringify(r.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return ie("InvalidXml","Start tag expected.",1);return!0}function Lr(e){return e===" "||e===" "||e===`
3
+ `||e==="\r"}function Pr(e,t){const r=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const n=e.substr(r,t-r);if(t>5&&n==="xml")return ie("InvalidXml","XML declaration allowed only at the start of the document.",le(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function _r(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t<e.length;t++)if(e[t]==="-"&&e[t+1]==="-"&&e[t+2]===">"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let r=1;for(t+=8;t<e.length;t++)if(e[t]==="<")r++;else if(e[t]===">"&&(r--,r===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t<e.length;t++)if(e[t]==="]"&&e[t+1]==="]"&&e[t+2]===">"){t+=2;break}}return t}const $i='"',qi="'";function Wi(e,t){let r="",n="",a=!1;for(;t<e.length;t++){if(e[t]===$i||e[t]===qi)n===""?n=e[t]:n!==e[t]||(n="");else if(e[t]===">"&&n===""){a=!0;break}r+=e[t]}return n!==""?!1:{value:r,index:t,tagClosed:a}}const Hi=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Dr(e,t){const r=jn(e,Hi),n={};for(let a=0;a<r.length;a++){if(r[a][1].length===0)return ie("InvalidAttr","Attribute '"+r[a][2]+"' has no space in starting.",Ve(r[a]));if(r[a][3]!==void 0&&r[a][4]===void 0)return ie("InvalidAttr","Attribute '"+r[a][2]+"' is without value.",Ve(r[a]));if(r[a][3]===void 0&&!t.allowBooleanAttributes)return ie("InvalidAttr","boolean attribute '"+r[a][2]+"' is not allowed.",Ve(r[a]));const o=r[a][2];if(!zi(o))return ie("InvalidAttr","Attribute '"+o+"' is an invalid name.",Ve(r[a]));if(!n.hasOwnProperty(o))n[o]=1;else return ie("InvalidAttr","Attribute '"+o+"' is repeated.",Ve(r[a]))}return!0}function Gi(e,t){let r=/\d/;for(e[t]==="x"&&(t++,r=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(r))break}return-1}function Yi(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Gi(e,t);let r=0;for(;t<e.length;t++,r++)if(!(e[t].match(/\w/)&&r<20)){if(e[t]===";")break;return-1}return t}function ie(e,t,r){return{err:{code:e,msg:t,line:r.line||r,col:r.col}}}function zi(e){return it(e)}function Qi(e){return it(e)}function le(e,t){const r=e.substring(0,t).split(/\r?\n/);return{line:r.length,col:r[r.length-1].length+1}}function Ve(e){return e.startIndex+e[1].length}const Ji={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,r){return e},captureMetaData:!1},Zi=function(e){return Object.assign({},Ji,e)};let Ke;typeof Symbol!="function"?Ke="@@xmlMetadata":Ke=Symbol("XML Node Metadata");class De{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,r){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:r})}addChild(t,r){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child}),r!==void 0&&(this.child[this.child.length-1][Ke]={startIndex:r})}static getMetaDataSymbol(){return Ke}}class Ki{constructor(t){this.suppressValidationErr=!t}readDocType(t,r){const n={};if(t[r+3]==="O"&&t[r+4]==="C"&&t[r+5]==="T"&&t[r+6]==="Y"&&t[r+7]==="P"&&t[r+8]==="E"){r=r+9;let a=1,o=!1,i=!1,s="";for(;r<t.length;r++)if(t[r]==="<"&&!i){if(o&&Le(t,"!ENTITY",r)){r+=7;let l,d;[l,d,r]=this.readEntityExp(t,r+1,this.suppressValidationErr),d.indexOf("&")===-1&&(n[l]={regx:RegExp(`&${l};`,"g"),val:d})}else if(o&&Le(t,"!ELEMENT",r)){r+=8;const{index:l}=this.readElementExp(t,r+1);r=l}else if(o&&Le(t,"!ATTLIST",r))r+=8;else if(o&&Le(t,"!NOTATION",r)){r+=9;const{index:l}=this.readNotationExp(t,r+1,this.suppressValidationErr);r=l}else if(Le(t,"!--",r))i=!0;else throw new Error("Invalid DOCTYPE");a++,s=""}else if(t[r]===">"){if(i?t[r-1]==="-"&&t[r-2]==="-"&&(i=!1,a--):a--,a===0)break}else t[r]==="["?o=!0:s+=t[r];if(a!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:r}}readEntityExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r])&&t[r]!=='"'&&t[r]!=="'";)n+=t[r],r++;if($e(n),r=he(t,r),!this.suppressValidationErr){if(t.substring(r,r+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[r]==="%")throw new Error("Parameter entities are not supported")}let a="";return[r,a]=this.readIdentifierVal(t,r,"entity"),r--,[n,a,r]}readNotationExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r]);)n+=t[r],r++;!this.suppressValidationErr&&$e(n),r=he(t,r);const a=t.substring(r,r+6).toUpperCase();if(!this.suppressValidationErr&&a!=="SYSTEM"&&a!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${a}"`);r+=a.length,r=he(t,r);let o=null,i=null;if(a==="PUBLIC")[r,o]=this.readIdentifierVal(t,r,"publicIdentifier"),r=he(t,r),(t[r]==='"'||t[r]==="'")&&([r,i]=this.readIdentifierVal(t,r,"systemIdentifier"));else if(a==="SYSTEM"&&([r,i]=this.readIdentifierVal(t,r,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:n,publicIdentifier:o,systemIdentifier:i,index:--r}}readIdentifierVal(t,r,n){let a="";const o=t[r];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(r++;r<t.length&&t[r]!==o;)a+=t[r],r++;if(t[r]!==o)throw new Error(`Unterminated ${n} value`);return r++,[r,a]}readElementExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r]);)n+=t[r],r++;if(!this.suppressValidationErr&&!it(n))throw new Error(`Invalid element name: "${n}"`);r=he(t,r);let a="";if(t[r]==="E"&&Le(t,"MPTY",r))r+=4;else if(t[r]==="A"&&Le(t,"NY",r))r+=2;else if(t[r]==="("){for(r++;r<t.length&&t[r]!==")";)a+=t[r],r++;if(t[r]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[r]}"`);return{elementName:n,contentModel:a.trim(),index:r}}readAttlistExp(t,r){r=he(t,r);let n="";for(;r<t.length&&!/\s/.test(t[r]);)n+=t[r],r++;$e(n),r=he(t,r);let a="";for(;r<t.length&&!/\s/.test(t[r]);)a+=t[r],r++;if(!$e(a))throw new Error(`Invalid attribute name: "${a}"`);r=he(t,r);let o="";if(t.substring(r,r+8).toUpperCase()==="NOTATION"){if(o="NOTATION",r+=8,r=he(t,r),t[r]!=="(")throw new Error(`Expected '(', found "${t[r]}"`);r++;let s=[];for(;r<t.length&&t[r]!==")";){let l="";for(;r<t.length&&t[r]!=="|"&&t[r]!==")";)l+=t[r],r++;if(l=l.trim(),!$e(l))throw new Error(`Invalid notation name: "${l}"`);s.push(l),t[r]==="|"&&(r++,r=he(t,r))}if(t[r]!==")")throw new Error("Unterminated list of notations");r++,o+=" ("+s.join("|")+")"}else{for(;r<t.length&&!/\s/.test(t[r]);)o+=t[r],r++;const s=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!s.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}r=he(t,r);let i="";return t.substring(r,r+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",r+=8):t.substring(r,r+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",r+=7):[r,i]=this.readIdentifierVal(t,r,"ATTLIST"),{elementName:n,attributeName:a,attributeType:o,defaultValue:i,index:r}}}const he=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Le(e,t,r){for(let n=0;n<t.length;n++)if(t[n]!==e[r+n+1])return!1;return!0}function $e(e){if(it(e))return e;throw new Error(`Invalid entity name ${e}`)}const eo=/^[-+]?0x[a-fA-F0-9]+$/,to=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,ro={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function no(e,t={}){if(t=Object.assign({},ro,t),!e||typeof e!="string")return e;let r=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(r))return e;if(e==="0")return 0;if(t.hex&&eo.test(r))return ao(r,16);if(r.includes("e")||r.includes("E"))return oo(e,r,t);{const n=to.exec(r);if(n){const a=n[1]||"",o=n[2];let i=so(n[3]);const s=a?e[o.length+1]===".":e[o.length]===".";if(!t.leadingZeros&&(o.length>1||o.length===1&&!s))return e;{const l=Number(r),d=String(l);if(l===0)return l;if(d.search(/[eE]/)!==-1)return t.eNotation?l:e;if(r.indexOf(".")!==-1)return d==="0"||d===i||d===`${a}${i}`?l:e;let g=o?i:r;return o?g===d||a+g===d?l:e:g===d||g===a+d?l:e}}else return e}}const io=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function oo(e,t,r){if(!r.eNotation)return e;const n=t.match(io);if(n){let a=n[1]||"";const o=n[3].indexOf("e")===-1?"E":"e",i=n[2],s=a?e[i.length+1]===o:e[i.length]===o;return i.length>1&&s?e:i.length===1&&(n[3].startsWith(`.${o}`)||n[3][0]===o)?Number(t):r.leadingZeros&&!s?(t=(n[1]||"")+n[3],Number(t)):e}else return e}function so(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substring(0,e.length-1))),e}function ao(e,t){if(parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw new Error("parseInt, Number.parseInt, window.parseInt are not supported")}function Un(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const r of e)if(typeof r=="string"&&t===r||r instanceof RegExp&&r.test(t))return!0}:()=>!1}class uo{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCodePoint(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCodePoint(Number.parseInt(n,16))}},this.addExternalEntities=co,this.parseXml=go,this.parseTextData=lo,this.resolveNameSpace=fo,this.buildAttributesMap=po,this.isItStopNode=bo,this.replaceEntitiesValue=yo,this.readStopNodeData=To,this.saveTextToParentTag=wo,this.addChild=mo,this.ignoreAttributesFn=Un(this.options.ignoreAttributes)}}function co(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];this.lastEntities[n]={regex:new RegExp("&"+n+";","g"),val:e[n]}}}function lo(e,t,r,n,a,o,i){if(e!==void 0&&(this.options.trimValues&&!n&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));const s=this.options.tagValueProcessor(t,e,r,a,o);return s==null?e:typeof s!=typeof e||s!==e?s:this.options.trimValues?Kt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Kt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function fo(e){if(this.options.removeNSPrefix){const t=e.split(":"),r=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=r+t[1])}return e}const ho=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function po(e,t,r){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const n=jn(e,ho),a=n.length,o={};for(let i=0;i<a;i++){const s=this.resolveNameSpace(n[i][1]);if(this.ignoreAttributesFn(s,t))continue;let l=n[i][4],d=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const g=this.options.attributeValueProcessor(s,l,t);g==null?o[d]=l:typeof g!=typeof l||g!==l?o[d]=g:o[d]=Kt(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[d]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const go=function(e){e=e.replace(/\r\n?/g,`
4
+ `);const t=new De("!xml");let r=t,n="",a="";const o=new Ki(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const l=Se(e,">",i,"Closing Tag is not closed.");let d=e.substring(i+2,l).trim();if(this.options.removeNSPrefix){const w=d.indexOf(":");w!==-1&&(d=d.substr(w+1))}this.options.transformTagName&&(d=this.options.transformTagName(d)),r&&(n=this.saveTextToParentTag(n,r,a));const g=a.substring(a.lastIndexOf(".")+1);if(d&&this.options.unpairedTags.indexOf(d)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${d}>`);let m=0;g&&this.options.unpairedTags.indexOf(g)!==-1?(m=a.lastIndexOf(".",a.lastIndexOf(".")-1),this.tagsNodeStack.pop()):m=a.lastIndexOf("."),a=a.substring(0,m),r=this.tagsNodeStack.pop(),n="",i=l}else if(e[i+1]==="?"){let l=Zt(e,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,a),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const d=new De(l.tagName);d.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(d[":@"]=this.buildAttributesMap(l.tagExp,a,l.tagName)),this.addChild(r,d,a,i)}i=l.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const l=Se(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const d=e.substring(i+4,l-2);n=this.saveTextToParentTag(n,r,a),r.add(this.options.commentPropName,[{[this.options.textNodeName]:d}])}i=l}else if(e.substr(i+1,2)==="!D"){const l=o.readDocType(e,i);this.docTypeEntities=l.entities,i=l.i}else if(e.substr(i+1,2)==="!["){const l=Se(e,"]]>",i,"CDATA is not closed.")-2,d=e.substring(i+9,l);n=this.saveTextToParentTag(n,r,a);let g=this.parseTextData(d,r.tagname,a,!0,!1,!0,!0);g==null&&(g=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:d}]):r.add(this.options.textNodeName,g),i=l+2}else{let l=Zt(e,i,this.options.removeNSPrefix),d=l.tagName;const g=l.rawTagName;let m=l.tagExp,w=l.attrExpPresent,E=l.closeIndex;this.options.transformTagName&&(d=this.options.transformTagName(d)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,a,!1));const I=r;I&&this.options.unpairedTags.indexOf(I.tagname)!==-1&&(r=this.tagsNodeStack.pop(),a=a.substring(0,a.lastIndexOf("."))),d!==t.tagname&&(a+=a?"."+d:d);const _=i;if(this.isItStopNode(this.options.stopNodes,a,d)){let T="";if(m.length>0&&m.lastIndexOf("/")===m.length-1)d[d.length-1]==="/"?(d=d.substr(0,d.length-1),a=a.substr(0,a.length-1),m=d):m=m.substr(0,m.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(d)!==-1)i=l.closeIndex;else{const v=this.readStopNodeData(e,g,E+1);if(!v)throw new Error(`Unexpected end of ${g}`);i=v.i,T=v.tagContent}const x=new De(d);d!==m&&w&&(x[":@"]=this.buildAttributesMap(m,a,d)),T&&(T=this.parseTextData(T,d,a,!0,w,!0,!0)),a=a.substr(0,a.lastIndexOf(".")),x.add(this.options.textNodeName,T),this.addChild(r,x,a,_)}else{if(m.length>0&&m.lastIndexOf("/")===m.length-1){d[d.length-1]==="/"?(d=d.substr(0,d.length-1),a=a.substr(0,a.length-1),m=d):m=m.substr(0,m.length-1),this.options.transformTagName&&(d=this.options.transformTagName(d));const T=new De(d);d!==m&&w&&(T[":@"]=this.buildAttributesMap(m,a,d)),this.addChild(r,T,a,_),a=a.substr(0,a.lastIndexOf("."))}else{const T=new De(d);this.tagsNodeStack.push(r),d!==m&&w&&(T[":@"]=this.buildAttributesMap(m,a,d)),this.addChild(r,T,a,_),r=T}n="",i=E}}else n+=e[i];return t.child};function mo(e,t,r,n){this.options.captureMetaData||(n=void 0);const a=this.options.updateTag(t.tagname,r,t[":@"]);a===!1||(typeof a=="string"&&(t.tagname=a),e.addChild(t,n))}const yo=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const r=this.docTypeEntities[t];e=e.replace(r.regx,r.val)}for(let t in this.lastEntities){const r=this.lastEntities[t];e=e.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const r=this.htmlEntities[t];e=e.replace(r.regex,r.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function wo(e,t,r,n){return e&&(n===void 0&&(n=t.child.length===0),e=this.parseTextData(e,t.tagname,r,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,n),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function bo(e,t,r){const n="*."+r;for(const a in e){const o=e[a];if(n===o||t===o)return!0}return!1}function Eo(e,t,r=">"){let n,a="";for(let o=t;o<e.length;o++){let i=e[o];if(n)i===n&&(n="");else if(i==='"'||i==="'")n=i;else if(i===r[0])if(r[1]){if(e[o+1]===r[1])return{data:a,index:o}}else return{data:a,index:o};else i===" "&&(i=" ");a+=i}}function Se(e,t,r,n){const a=e.indexOf(t,r);if(a===-1)throw new Error(n);return a+t.length-1}function Zt(e,t,r,n=">"){const a=Eo(e,t+1,n);if(!a)return;let o=a.data;const i=a.index,s=o.search(/\s/);let l=o,d=!0;s!==-1&&(l=o.substring(0,s),o=o.substring(s+1).trimStart());const g=l;if(r){const m=l.indexOf(":");m!==-1&&(l=l.substr(m+1),d=l!==a.data.substr(m+1))}return{tagName:l,tagExp:o,closeIndex:i,attrExpPresent:d,rawTagName:g}}function To(e,t,r){const n=r;let a=1;for(;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){const o=Se(e,">",r,`${t} is not closed`);if(e.substring(r+2,o).trim()===t&&(a--,a===0))return{tagContent:e.substring(n,r),i:o};r=o}else if(e[r+1]==="?")r=Se(e,"?>",r+1,"StopNode is not closed.");else if(e.substr(r+1,3)==="!--")r=Se(e,"-->",r+3,"StopNode is not closed.");else if(e.substr(r+1,2)==="![")r=Se(e,"]]>",r,"StopNode is not closed.")-2;else{const o=Zt(e,r,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&a++,r=o.closeIndex)}}function Kt(e,t,r){if(t&&typeof e=="string"){const n=e.trim();return n==="true"?!0:n==="false"?!1:no(e,r)}else return Ui(e)?e:""}const ut=De.getMetaDataSymbol();function No(e,t){return Xn(e,t)}function Xn(e,t,r){let n;const a={};for(let o=0;o<e.length;o++){const i=e[o],s=vo(i);let l="";if(r===void 0?l=s:l=r+"."+s,s===t.textNodeName)n===void 0?n=i[s]:n+=""+i[s];else{if(s===void 0)continue;if(i[s]){let d=Xn(i[s],t,l);const g=xo(d,t);i[ut]!==void 0&&(d[ut]=i[ut]),i[":@"]?Io(d,i[":@"],l,t):Object.keys(d).length===1&&d[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?d=d[t.textNodeName]:Object.keys(d).length===0&&(t.alwaysCreateTextNode?d[t.textNodeName]="":d=""),a[s]!==void 0&&a.hasOwnProperty(s)?(Array.isArray(a[s])||(a[s]=[a[s]]),a[s].push(d)):t.isArray(s,l,g)?a[s]=[d]:a[s]=d}}}return typeof n=="string"?n.length>0&&(a[t.textNodeName]=n):n!==void 0&&(a[t.textNodeName]=n),a}function vo(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];if(n!==":@")return n}}function Io(e,t,r,n){if(t){const a=Object.keys(t),o=a.length;for(let i=0;i<o;i++){const s=a[i];n.isArray(s,r+"."+s,!0,!0)?e[s]=[t[s]]:e[s]=t[s]}}}function xo(e,t){const{textNodeName:r}=t,n=Object.keys(e).length;return!!(n===0||n===1&&(e[r]||typeof e[r]=="boolean"||e[r]===0))}class Vn{constructor(t){this.externalEntities={},this.options=Zi(t)}parse(t,r){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});const o=Vi(t,r);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const n=new uo(this.options);n.addExternalEntities(this.externalEntities);const a=n.parseXml(t);return this.options.preserveOrder||a===void 0?a:No(a,this.options)}addEntity(t,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=r}static getMetaDataSymbol(){return De.getMetaDataSymbol()}}const Oo=`
5
+ `;function Ao(e,t){let r="";return t.format&&t.indentBy.length>0&&(r=Oo),$n(e,t,"",r)}function $n(e,t,r,n){let a="",o=!1;for(let i=0;i<e.length;i++){const s=e[i],l=Lo(s);if(l===void 0)continue;let d="";if(r.length===0?d=l:d=`${r}.${l}`,l===t.textNodeName){let I=s[l];Po(d,t)||(I=t.tagValueProcessor(l,I),I=qn(I,t)),o&&(a+=n),a+=I,o=!1;continue}else if(l===t.cdataPropName){o&&(a+=n),a+=`<![CDATA[${s[l][0][t.textNodeName]}]]>`,o=!1;continue}else if(l===t.commentPropName){a+=n+`<!--${s[l][0][t.textNodeName]}-->`,o=!0;continue}else if(l[0]==="?"){const I=Sr(s[":@"],t),_=l==="?xml"?"":n;let T=s[l][0][t.textNodeName];T=T.length!==0?" "+T:"",a+=_+`<${l}${T}${I}?>`,o=!0;continue}let g=n;g!==""&&(g+=t.indentBy);const m=Sr(s[":@"],t),w=n+`<${l}${m}`,E=$n(s[l],t,d,g);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?a+=w+">":a+=w+"/>":(!E||E.length===0)&&t.suppressEmptyNode?a+=w+"/>":E&&E.endsWith(">")?a+=w+`>${E}${n}</${l}>`:(a+=w+">",E&&n!==""&&(E.includes("/>")||E.includes("</"))?a+=n+t.indentBy+E+n:a+=E,a+=`</${l}>`),o=!0}return a}function Lo(e){const t=Object.keys(e);for(let r=0;r<t.length;r++){const n=t[r];if(e.hasOwnProperty(n)&&n!==":@")return n}}function Sr(e,t){let r="";if(e&&!t.ignoreAttributes)for(let n in e){if(!e.hasOwnProperty(n))continue;let a=t.attributeValueProcessor(n,e[n]);a=qn(a,t),a===!0&&t.suppressBooleanAttributes?r+=` ${n.substr(t.attributeNamePrefix.length)}`:r+=` ${n.substr(t.attributeNamePrefix.length)}="${a}"`}return r}function Po(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let r=e.substr(e.lastIndexOf(".")+1);for(let n in t.stopNodes)if(t.stopNodes[n]===e||t.stopNodes[n]==="*."+r)return!0;return!1}function qn(e,t){if(e&&e.length>0&&t.processEntities)for(let r=0;r<t.entities.length;r++){const n=t.entities[r];e=e.replace(n.regex,n.val)}return e}const _o={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function ve(e){this.options=Object.assign({},_o,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Un(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Mo),this.processTextOrObjNode=Do,this.options.format?(this.indentate=So,this.tagEndChar=`>
6
+ `,this.newLine=`
7
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}ve.prototype.build=function(e){return this.options.preserveOrder?Ao(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};ve.prototype.j2x=function(e,t,r){let n="",a="";const o=r.join(".");for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(a+="");else if(e[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?a+="":i[0]==="?"?a+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:a+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)a+=this.buildTextValNode(e[i],i,"",t);else if(typeof e[i]!="object"){const s=this.isAttribute(i);if(s&&!this.ignoreAttributesFn(s,o))n+=this.buildAttrPairStr(s,""+e[i]);else if(!s)if(i===this.options.textNodeName){let l=this.options.tagValueProcessor(i,""+e[i]);a+=this.replaceEntitiesValue(l)}else a+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const s=e[i].length;let l="",d="";for(let g=0;g<s;g++){const m=e[i][g];if(!(typeof m>"u"))if(m===null)i[0]==="?"?a+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:a+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(typeof m=="object")if(this.options.oneListGroup){const w=this.j2x(m,t+1,r.concat(i));l+=w.val,this.options.attributesGroupName&&m.hasOwnProperty(this.options.attributesGroupName)&&(d+=w.attrStr)}else l+=this.processTextOrObjNode(m,i,t,r);else if(this.options.oneListGroup){let w=this.options.tagValueProcessor(i,m);w=this.replaceEntitiesValue(w),l+=w}else l+=this.buildTextValNode(m,i,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,i,d,t)),a+=l}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const s=Object.keys(e[i]),l=s.length;for(let d=0;d<l;d++)n+=this.buildAttrPairStr(s[d],""+e[i][s[d]])}else a+=this.processTextOrObjNode(e[i],i,t,r);return{attrStr:n,val:a}};ve.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function Do(e,t,r,n){const a=this.j2x(e,r+1,n.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,a.attrStr,r):this.buildObjectNode(a.val,t,a.attrStr,r)}ve.prototype.buildObjectNode=function(e,t,r,n){if(e==="")return t[0]==="?"?this.indentate(n)+"<"+t+r+"?"+this.tagEndChar:this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar;{let a="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",a=""),(r||r==="")&&e.indexOf("<")===-1?this.indentate(n)+"<"+t+r+o+">"+e+a:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(n)+`<!--${e}-->`+this.newLine:this.indentate(n)+"<"+t+r+o+this.tagEndChar+e+this.indentate(n)+a}};ve.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};ve.prototype.buildTextValNode=function(e,t,r,n){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(n)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(n)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(n)+"<"+t+r+"?"+this.tagEndChar;{let a=this.options.tagValueProcessor(t,e);return a=this.replaceEntitiesValue(a),a===""?this.indentate(n)+"<"+t+r+this.closeTag(t)+this.tagEndChar:this.indentate(n)+"<"+t+r+">"+a+"</"+t+this.tagEndChar}};ve.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const r=this.options.entities[t];e=e.replace(r.regex,r.val)}return e};function So(e){return this.options.indentBy.repeat(e)}function Mo(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}function Wn(e,t=!1){const r=e.length;let n=0,a="",o=0,i=16,s=0,l=0,d=0,g=0,m=0;function w(h,O){let A=0,F=0;for(;A<h;){let M=e.charCodeAt(n);if(M>=48&&M<=57)F=F*16+M-48;else if(M>=65&&M<=70)F=F*16+M-65+10;else if(M>=97&&M<=102)F=F*16+M-97+10;else break;n++,A++}return A<h&&(F=-1),F}function E(h){n=h,a="",o=0,i=16,m=0}function I(){let h=n;if(e.charCodeAt(n)===48)n++;else for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;if(n<e.length&&e.charCodeAt(n)===46)if(n++,n<e.length&&Fe(e.charCodeAt(n)))for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;else return m=3,e.substring(h,n);let O=n;if(n<e.length&&(e.charCodeAt(n)===69||e.charCodeAt(n)===101))if(n++,(n<e.length&&e.charCodeAt(n)===43||e.charCodeAt(n)===45)&&n++,n<e.length&&Fe(e.charCodeAt(n))){for(n++;n<e.length&&Fe(e.charCodeAt(n));)n++;O=n}else m=3;return e.substring(h,O)}function _(){let h="",O=n;for(;;){if(n>=r){h+=e.substring(O,n),m=2;break}const A=e.charCodeAt(n);if(A===34){h+=e.substring(O,n),n++;break}if(A===92){if(h+=e.substring(O,n),n++,n>=r){m=2;break}switch(e.charCodeAt(n++)){case 34:h+='"';break;case 92:h+="\\";break;case 47:h+="/";break;case 98:h+="\b";break;case 102:h+="\f";break;case 110:h+=`
8
+ `;break;case 114:h+="\r";break;case 116:h+=" ";break;case 117:const M=w(4);M>=0?h+=String.fromCharCode(M):m=4;break;default:m=5}O=n;continue}if(A>=0&&A<=31)if(qe(A)){h+=e.substring(O,n),m=2;break}else m=6;n++}return h}function T(){if(a="",m=0,o=n,l=s,g=d,n>=r)return o=r,i=17;let h=e.charCodeAt(n);if(ct(h)){do n++,a+=String.fromCharCode(h),h=e.charCodeAt(n);while(ct(h));return i=15}if(qe(h))return n++,a+=String.fromCharCode(h),h===13&&e.charCodeAt(n)===10&&(n++,a+=`
9
+ `),s++,d=n,i=14;switch(h){case 123:return n++,i=1;case 125:return n++,i=2;case 91:return n++,i=3;case 93:return n++,i=4;case 58:return n++,i=6;case 44:return n++,i=5;case 34:return n++,a=_(),i=10;case 47:const O=n-1;if(e.charCodeAt(n+1)===47){for(n+=2;n<r&&!qe(e.charCodeAt(n));)n++;return a=e.substring(O,n),i=12}if(e.charCodeAt(n+1)===42){n+=2;const A=r-1;let F=!1;for(;n<A;){const M=e.charCodeAt(n);if(M===42&&e.charCodeAt(n+1)===47){n+=2,F=!0;break}n++,qe(M)&&(M===13&&e.charCodeAt(n)===10&&n++,s++,d=n)}return F||(n++,m=1),a=e.substring(O,n),i=13}return a+=String.fromCharCode(h),n++,i=16;case 45:if(a+=String.fromCharCode(h),n++,n===r||!Fe(e.charCodeAt(n)))return i=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return a+=I(),i=11;default:for(;n<r&&x(h);)n++,h=e.charCodeAt(n);if(o!==n){switch(a=e.substring(o,n),a){case"true":return i=8;case"false":return i=9;case"null":return i=7}return i=16}return a+=String.fromCharCode(h),n++,i=16}}function x(h){if(ct(h)||qe(h))return!1;switch(h){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let h;do h=T();while(h>=12&&h<=15);return h}return{setPosition:E,getPosition:()=>n,scan:t?v:T,getToken:()=>i,getTokenValue:()=>a,getTokenOffset:()=>o,getTokenLength:()=>n-o,getTokenStartLine:()=>l,getTokenStartCharacter:()=>o-g,getTokenError:()=>m}}function ct(e){return e===32||e===9}function qe(e){return e===10||e===13}function Fe(e){return e>=48&&e<=57}var Mr;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(Mr||(Mr={}));const pe=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),Ce=200,Fr={" ":{"\n":new Array(Ce).fill(0).map((e,t)=>`
10
+ `+" ".repeat(t)),"\r":new Array(Ce).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Ce).fill(0).map((e,t)=>`\r
11
+ `+" ".repeat(t))}," ":{"\n":new Array(Ce).fill(0).map((e,t)=>`
12
+ `+" ".repeat(t)),"\r":new Array(Ce).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(Ce).fill(0).map((e,t)=>`\r
13
+ `+" ".repeat(t))}},Fo=[`
14
+ `,"\r",`\r
15
+ `];function Co(e,t,r){let n,a,o,i,s;if(t){for(i=t.offset,s=i+t.length,o=i;o>0&&!et(e,o-1);)o--;let A=s;for(;A<e.length&&!et(e,A);)A++;a=e.substring(o,A),n=Bo(a,r)}else a=e,n=0,o=0,i=0,s=e.length;const l=ko(r,e),d=Fo.includes(l);let g=0,m=0,w;r.insertSpaces?w=pe[r.tabSize||4]??Be(pe[1],r.tabSize||4):w=" ";const E=w===" "?" ":" ";let I=Wn(a,!1),_=!1;function T(){if(g>1)return Be(l,g)+Be(w,n+m);const A=w.length*(n+m);return!d||A>Fr[E][l].length?l+Be(w,n+m):A<=0?l:Fr[E][l][A]}function x(){let A=I.scan();for(g=0;A===15||A===14;)A===14&&r.keepLines?g+=1:A===14&&(g=1),A=I.scan();return _=A===16||I.getTokenError()!==0,A}const v=[];function h(A,F,M){!_&&(!t||F<s&&M>i)&&e.substring(F,M)!==A&&v.push({offset:F,length:M-F,content:A})}let O=x();if(r.keepLines&&g>0&&h(Be(l,g),0,0),O!==17){let A=I.getTokenOffset()+o,F=w.length*n<20&&r.insertSpaces?pe[w.length*n]:Be(w,n);h(F,o,A)}for(;O!==17;){let A=I.getTokenOffset()+I.getTokenLength()+o,F=x(),M="",k=!1;for(;g===0&&(F===12||F===13);){let B=I.getTokenOffset()+o;h(pe[1],A,B),A=I.getTokenOffset()+I.getTokenLength()+o,k=F===12,M=k?T():"",F=x()}if(F===2)O!==1&&m--,r.keepLines&&g>0||!r.keepLines&&O!==1?M=T():r.keepLines&&(M=pe[1]);else if(F===4)O!==3&&m--,r.keepLines&&g>0||!r.keepLines&&O!==3?M=T():r.keepLines&&(M=pe[1]);else{switch(O){case 3:case 1:m++,r.keepLines&&g>0||!r.keepLines?M=T():M=pe[1];break;case 5:r.keepLines&&g>0||!r.keepLines?M=T():M=pe[1];break;case 12:M=T();break;case 13:g>0?M=T():k||(M=pe[1]);break;case 6:r.keepLines&&g>0?M=T():k||(M=pe[1]);break;case 10:r.keepLines&&g>0?M=T():F===6&&!k&&(M="");break;case 7:case 8:case 9:case 11:case 2:case 4:r.keepLines&&g>0?M=T():(F===12||F===13)&&!k?M=pe[1]:F!==5&&F!==17&&(_=!0);break;case 16:_=!0;break}g>0&&(F===12||F===13)&&(M=T())}F===17&&(r.keepLines&&g>0?M=T():M=r.insertFinalNewline?l:"");const y=I.getTokenOffset()+o;h(M,A,y),O=F}return v}function Be(e,t){let r="";for(let n=0;n<t;n++)r+=e;return r}function Bo(e,t){let r=0,n=0;const a=t.tabSize||4;for(;r<e.length;){let o=e.charAt(r);if(o===pe[1])n++;else if(o===" ")n+=a;else break;r++}return Math.floor(n/a)}function ko(e,t){for(let r=0;r<t.length;r++){const n=t.charAt(r);if(n==="\r")return r+1<t.length&&t.charAt(r+1)===`
16
+ `?`\r
17
+ `:"\r";if(n===`
18
+ `)return`
19
+ `}return e&&e.eol||`
20
+ `}function et(e,t){return`\r
21
+ `.indexOf(e.charAt(t))!==-1}var tt;(function(e){e.DEFAULT={allowTrailingComma:!1}})(tt||(tt={}));function Hn(e,t=[],r=tt.DEFAULT){let n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function a(l){n.type==="property"&&(n.length=l-n.offset,n=n.parent)}function o(l){return n.children.push(l),l}Ro(e,{onObjectBegin:l=>{n=o({type:"object",offset:l,length:-1,parent:n,children:[]})},onObjectProperty:(l,d,g)=>{n=o({type:"property",offset:d,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:l,offset:d,length:g,parent:n})},onObjectEnd:(l,d)=>{a(l+d),n.length=l+d-n.offset,n=n.parent,a(l+d)},onArrayBegin:(l,d)=>{n=o({type:"array",offset:l,length:-1,parent:n,children:[]})},onArrayEnd:(l,d)=>{n.length=l+d-n.offset,n=n.parent,a(l+d)},onLiteralValue:(l,d,g)=>{o({type:jo(l),offset:d,length:g,parent:n,value:l}),a(d+g)},onSeparator:(l,d,g)=>{n.type==="property"&&(l===":"?n.colonOffset=d:l===","&&a(d))},onError:(l,d,g)=>{t.push({error:l,offset:d,length:g})}},r);const s=n.children[0];return s&&delete s.parent,s}function er(e,t){if(!e)return;let r=e;for(let n of t)if(typeof n=="string"){if(r.type!=="object"||!Array.isArray(r.children))return;let a=!1;for(const o of r.children)if(Array.isArray(o.children)&&o.children[0].value===n&&o.children.length===2){r=o.children[1],a=!0;break}if(!a)return}else{const a=n;if(r.type!=="array"||a<0||!Array.isArray(r.children)||a>=r.children.length)return;r=r.children[a]}return r}function Ro(e,t,r=tt.DEFAULT){const n=Wn(e,!1),a=[];let o=0;function i(X){return X?()=>o===0&&X(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function s(X){return X?$=>o===0&&X($,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter()):()=>!0}function l(X){return X?$=>o===0&&X($,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>a.slice()):()=>!0}function d(X){return X?()=>{o>0?o++:X(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter(),()=>a.slice())===!1&&(o=1)}:()=>!0}function g(X){return X?()=>{o>0&&o--,o===0&&X(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:()=>!0}const m=d(t.onObjectBegin),w=l(t.onObjectProperty),E=g(t.onObjectEnd),I=d(t.onArrayBegin),_=g(t.onArrayEnd),T=l(t.onLiteralValue),x=s(t.onSeparator),v=i(t.onComment),h=s(t.onError),O=r&&r.disallowComments,A=r&&r.allowTrailingComma;function F(){for(;;){const X=n.scan();switch(n.getTokenError()){case 4:M(14);break;case 5:M(15);break;case 3:M(13);break;case 1:O||M(11);break;case 2:M(12);break;case 6:M(16);break}switch(X){case 12:case 13:O?M(10):v();break;case 16:M(1);break;case 15:case 14:break;default:return X}}}function M(X,$=[],Y=[]){if(h(X),$.length+Y.length>0){let H=n.getToken();for(;H!==17;){if($.indexOf(H)!==-1){F();break}else if(Y.indexOf(H)!==-1)break;H=F()}}}function k(X){const $=n.getTokenValue();return X?T($):(w($),a.push($)),F(),!0}function y(){switch(n.getToken()){case 11:const X=n.getTokenValue();let $=Number(X);isNaN($)&&(M(2),$=0),T($);break;case 7:T(null);break;case 8:T(!0);break;case 9:T(!1);break;default:return!1}return F(),!0}function B(){return n.getToken()!==10?(M(3,[],[2,5]),!1):(k(!1),n.getToken()===6?(x(":"),F(),W()||M(4,[],[2,5])):M(5,[],[2,5]),a.pop(),!0)}function j(){m(),F();let X=!1;for(;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(X||M(4,[],[]),x(","),F(),n.getToken()===2&&A)break}else X&&M(6,[],[]);B()||M(4,[],[2,5]),X=!0}return E(),n.getToken()!==2?M(7,[2],[]):F(),!0}function U(){I(),F();let X=!0,$=!1;for(;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if($||M(4,[],[]),x(","),F(),n.getToken()===4&&A)break}else $&&M(6,[],[]);X?(a.push(0),X=!1):a[a.length-1]++,W()||M(4,[],[4,5]),$=!0}return _(),X||a.pop(),n.getToken()!==4?M(8,[4],[]):F(),!0}function W(){switch(n.getToken()){case 3:return U();case 1:return j();case 10:return k(!0);default:return y()}}return F(),n.getToken()===17?r.allowEmptyContent?!0:(M(4,[],[]),!1):W()?(n.getToken()!==17&&M(9,[],[]),!0):(M(4,[],[]),!1)}function jo(e){switch(typeof e){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(e){if(Array.isArray(e))return"array"}else return"null";return"object"}default:return"null"}}function Uo(e,t,r,n){const a=t.slice(),i=Hn(e,[]);let s,l;for(;a.length>0&&(l=a.pop(),s=er(i,a),s===void 0&&r!==void 0);)typeof l=="string"?r={[l]:r}:r=[r];if(s)if(s.type==="object"&&typeof l=="string"&&Array.isArray(s.children)){const d=er(s,[l]);if(d!==void 0)if(r===void 0){if(!d.parent)throw new Error("Malformed AST");const g=s.children.indexOf(d.parent);let m,w=d.parent.offset+d.parent.length;if(g>0){let E=s.children[g-1];m=E.offset+E.length}else m=s.offset+1,s.children.length>1&&(w=s.children[1].offset);return Pe(e,{offset:m,length:w-m,content:""},n)}else return Pe(e,{offset:d.offset,length:d.length,content:JSON.stringify(r)},n);else{if(r===void 0)return[];const g=`${JSON.stringify(l)}: ${JSON.stringify(r)}`,m=n.getInsertionIndex?n.getInsertionIndex(s.children.map(E=>E.children[0].value)):s.children.length;let w;if(m>0){let E=s.children[m-1];w={offset:E.offset+E.length,length:0,content:","+g}}else s.children.length===0?w={offset:s.offset+1,length:0,content:g}:w={offset:s.offset+1,length:0,content:g+","};return Pe(e,w,n)}}else if(s.type==="array"&&typeof l=="number"&&Array.isArray(s.children)){const d=l;if(d===-1){const g=`${JSON.stringify(r)}`;let m;if(s.children.length===0)m={offset:s.offset+1,length:0,content:g};else{const w=s.children[s.children.length-1];m={offset:w.offset+w.length,length:0,content:","+g}}return Pe(e,m,n)}else if(r===void 0&&s.children.length>=0){const g=l,m=s.children[g];let w;if(s.children.length===1)w={offset:s.offset+1,length:s.length-2,content:""};else if(s.children.length-1===g){let E=s.children[g-1],I=E.offset+E.length,_=s.offset+s.length;w={offset:I,length:_-2-I,content:""}}else w={offset:m.offset,length:s.children[g+1].offset-m.offset,content:""};return Pe(e,w,n)}else if(r!==void 0){let g;const m=`${JSON.stringify(r)}`;if(!n.isArrayInsertion&&s.children.length>l){const w=s.children[l];g={offset:w.offset,length:w.length,content:m}}else if(s.children.length===0||l===0)g={offset:s.offset+1,length:0,content:s.children.length===0?m:m+","};else{const w=l>s.children.length?s.children.length:l,E=s.children[w-1];g={offset:E.offset+E.length,length:0,content:","+m}}return Pe(e,g,n)}else throw new Error(`Can not ${r===void 0?"remove":n.isArrayInsertion?"insert":"modify"} Array index ${d} as length is not sufficient`)}else throw new Error(`Can not add ${typeof l!="number"?"index":"property"} to parent of type ${s.type}`);else{if(r===void 0)throw new Error("Can not delete in empty document");return Pe(e,{offset:i?i.offset:0,length:i?i.length:0,content:JSON.stringify(r)},n)}}function Pe(e,t,r){if(!r.formattingOptions)return[t];let n=tr(e,t),a=t.offset,o=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;a>0&&!et(n,a-1);)a--;for(;o<n.length&&!et(n,o);)o++}const i=Co(n,{offset:a,length:o-a},{...r.formattingOptions,keepLines:!1});for(let l=i.length-1;l>=0;l--){const d=i[l];n=tr(n,d),a=Math.min(a,d.offset),o=Math.max(o,d.offset+d.length),o+=d.content.length-d.length}const s=e.length-(n.length-o)-a;return[{offset:a,length:s,content:n.substring(a,o)}]}function tr(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var Cr;(function(e){e[e.None=0]="None",e[e.UnexpectedEndOfComment=1]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=2]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=3]="UnexpectedEndOfNumber",e[e.InvalidUnicode=4]="InvalidUnicode",e[e.InvalidEscapeCharacter=5]="InvalidEscapeCharacter",e[e.InvalidCharacter=6]="InvalidCharacter"})(Cr||(Cr={}));var Br;(function(e){e[e.OpenBraceToken=1]="OpenBraceToken",e[e.CloseBraceToken=2]="CloseBraceToken",e[e.OpenBracketToken=3]="OpenBracketToken",e[e.CloseBracketToken=4]="CloseBracketToken",e[e.CommaToken=5]="CommaToken",e[e.ColonToken=6]="ColonToken",e[e.NullKeyword=7]="NullKeyword",e[e.TrueKeyword=8]="TrueKeyword",e[e.FalseKeyword=9]="FalseKeyword",e[e.StringLiteral=10]="StringLiteral",e[e.NumericLiteral=11]="NumericLiteral",e[e.LineCommentTrivia=12]="LineCommentTrivia",e[e.BlockCommentTrivia=13]="BlockCommentTrivia",e[e.LineBreakTrivia=14]="LineBreakTrivia",e[e.Trivia=15]="Trivia",e[e.Unknown=16]="Unknown",e[e.EOF=17]="EOF"})(Br||(Br={}));const rt=Hn,He=er;var kr;(function(e){e[e.InvalidSymbol=1]="InvalidSymbol",e[e.InvalidNumberFormat=2]="InvalidNumberFormat",e[e.PropertyNameExpected=3]="PropertyNameExpected",e[e.ValueExpected=4]="ValueExpected",e[e.ColonExpected=5]="ColonExpected",e[e.CommaExpected=6]="CommaExpected",e[e.CloseBraceExpected=7]="CloseBraceExpected",e[e.CloseBracketExpected=8]="CloseBracketExpected",e[e.EndOfFileExpected=9]="EndOfFileExpected",e[e.InvalidCommentToken=10]="InvalidCommentToken",e[e.UnexpectedEndOfComment=11]="UnexpectedEndOfComment",e[e.UnexpectedEndOfString=12]="UnexpectedEndOfString",e[e.UnexpectedEndOfNumber=13]="UnexpectedEndOfNumber",e[e.InvalidUnicode=14]="InvalidUnicode",e[e.InvalidEscapeCharacter=15]="InvalidEscapeCharacter",e[e.InvalidCharacter=16]="InvalidCharacter"})(kr||(kr={}));function Xo(e){switch(e){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function rr(e,t,r,n){return Uo(e,t,r,n)}function Gn(e,t){let r=t.slice(0).sort((a,o)=>{const i=a.offset-o.offset;return i===0?a.length-o.length:i}),n=e.length;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.offset+o.length<=n)e=tr(e,o);else throw new Error("Overlapping edit");n=o.offset}return e}function Vo(e,t){return t.filter(r=>{const n=ue.resolve(r.hostPath),a=ue.join(e,ue.sep);return n===e||n.startsWith(a)})}const Oe={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},Yn={ignoreAttributes:Oe.ignoreAttributes,attributeNamePrefix:Oe.attributeNamePrefix,preserveOrder:Oe.preserveOrder,cdataPropName:Oe.cdataPropName,commentPropName:Oe.commentPropName,suppressBooleanAttributes:!Oe.allowBooleanAttributes,format:!0,indentBy:" "},nt={allowEmptyContent:!0,allowTrailingComma:!0};function $o(e,t){const{name:r,host:n,port:a,mappings:o,ideKey:i}=t,s=new Vn(Oe),l=(()=>{try{return s.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),d={server:[{}],":@":{name:r,host:`${n}:${a}`,use_path_mappings:"true"}};o&&o.length&&(d.server[0].path_mappings=o.map(v=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Qn(ue.relative(t.projectDir,v.hostPath))}`,"remote-root":v.vfsPath}})));let g=l?.find(v=>!!v?.project);if(g){const v=g[":@"]?.version;if(v===void 0)throw new Error('PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but the <project> configuration has no version number.');if(v!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${v}".`)}g===void 0&&(g={project:[],":@":{version:"4"}},l.push(g));let m=g.project?.find(v=>!!v?.component&&v?.[":@"]?.name==="PhpServers");m===void 0&&(m={component:[],":@":{name:"PhpServers"}},g.project===void 0&&(g.project=[]),g.project.push(m));let w=m.component?.find(v=>!!v?.servers);w===void 0&&(w={servers:[]},m.component===void 0&&(m.component=[]),m.component.push(w));const E=w.servers?.findIndex(v=>!!v?.server&&v?.[":@"]?.name===r);(E===void 0||E<0)&&(w.servers===void 0&&(w.servers=[]),w.servers.push(d));let I=g.project?.find(v=>!!v?.component&&v?.[":@"]?.name==="RunManager");if(I===void 0&&(I={component:[],":@":{name:"RunManager"}},g.project===void 0&&(g.project=[]),g.project.push(I)),(I.component?.findIndex(v=>!!v?.configuration&&v?.[":@"]?.name===r)??-1)<0){const v={configuration:[{method:[],":@":{v:"2"}}],":@":{name:r,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:r,session_id:i}};I.component===void 0&&(I.component=[]),I.component.push(v)}const x=new ve(Yn).build(l);try{s.parse(x,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return x}function qo(e,t){const{name:r,mappings:n}=t,a=[];let o=e,i=rt(o,a,nt);if(i===void 0||a.length)throw new Error("VS Code configuration file is not valid JSON.");let s=He(i,["configurations"]);if(s===void 0||s.children===void 0){const d=rr(o,["configurations"],[],{});o=Gn(o,d),i=rt(o,[],nt),s=He(i,["configurations"])}const l=s?.children?.findIndex(d=>He(d,["name"])?.value===r);if(l===void 0||l<0){const d={name:r,type:"php",request:"launch",port:9003};n&&n.length&&(d.pathMappings=n.reduce((w,E)=>(w[E.vfsPath]=`\${workspaceFolder}/${Qn(ue.relative(t.workspaceDir,E.hostPath))}`,w),{}));const g=s?.children?.length||0,m=rr(o,["configurations",g],d,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
22
+ `}});o=zn(o,m)}return o}async function Wo({name:e,ides:t,host:r,port:n,cwd:a,mounts:o,ideKey:i="PHPWASMCLI"}){const s=o?Vo(a,o):[],l={};if(t.includes("phpstorm")){const d=".idea/workspace.xml",g=ue.join(a,d);if(!se.existsSync(g)){if(se.existsSync(ue.dirname(g)))se.writeFileSync(g,`<?xml version="1.0" encoding="UTF-8"?>
23
+ <project version="4">
24
+ </project>`);else if(t.length==1)throw new Error("PhpStorm IDE integration requested, but no '.idea' directory was found in the current working directory.")}if(se.existsSync(g)){const m=se.readFileSync(g,"utf8"),w=$o(m,{name:e,host:r,port:n,projectDir:a,mappings:s,ideKey:i});se.writeFileSync(g,w),l.phpstorm=d}}if(t.includes("vscode")){const d=".vscode/launch.json",g=ue.join(a,d);if(!se.existsSync(g)){if(se.existsSync(ue.dirname(g)))se.writeFileSync(g,`{
25
+ "configurations": []
26
+ }`);else if(t.length==1)throw new Error("VS Code IDE integration requested, but no '.vscode' directory was found in the current working directory.")}if(se.existsSync(g)){const m=se.readFileSync(g,"utf-8"),w=qo(m,{name:e,workspaceDir:a,mappings:s});w!==m&&(se.writeFileSync(g,w),l.vscode=d)}}return l}async function Ho(e,t){const r=ue.join(t,".idea/workspace.xml");if(se.existsSync(r)){const a=se.readFileSync(r,"utf8"),o=new Vn(Oe),i=(()=>{try{return o.parse(a,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),d=i.find(m=>!!m?.project)?.project?.find(m=>!!m?.component&&m?.[":@"]?.name==="PhpServers")?.component?.find(m=>!!m?.servers),g=d?.servers?.findIndex(m=>!!m?.server&&m?.[":@"]?.name===e);if(g!==void 0&&g>=0){d.servers.splice(g,1);const w=new ve(Yn).build(i);try{o.parse(w,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}w===`<?xml version="1.0" encoding="UTF-8"?>
27
+ <project version="4">
28
+ <component name="PhpServers">
29
+ <servers></servers>
30
+ </component>
31
+ </project>`?se.unlinkSync(r):se.writeFileSync(r,w)}}const n=ue.join(t,".vscode/launch.json");if(se.existsSync(n)){const a=[],o=se.readFileSync(n,"utf-8"),i=rt(o,a,nt);if(i===void 0||a.length)throw new Error("VS Code configuration file is not valid JSON.");const l=He(i,["configurations"])?.children?.findIndex(d=>He(d,["name"])?.value===e);if(l!==void 0&&l>=0){const d=rr(o,["configurations",l],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
32
+ `}}),g=zn(o,d);g===`{
33
+ "configurations": []
34
+ }`?se.unlinkSync(n):se.writeFileSync(n,g)}}}function zn(e,t){const r=[],n=Gn(e,t);if(r.length=0,rt(n,r,nt),r.length){const a=r.map(i=>({message:Xo(i.error),offset:i.offset,length:i.length,fragment:n.slice(Math.max(0,i.offset-20),Math.min(n.length,i.offset+i.length+10))})).map(i=>`${i.message} at ${i.offset}:${i.length} (${i.fragment})`),o=t.map(i=>`At ${i.offset}:${i.length} - (${i.content})`);throw new Error(`VS Code configuration file (.vscode/launch.json) is not valid a JSONC after CLI modifications. This is likely a CLI bug. Please report it at https://github.com/WordPress/wordpress-playground/issues and include the contents of your ".vscode/launch.json" file.
35
+
36
+ Applied edits: ${o.join(`
37
+ `)}
38
+
39
+ The errors are: ${a.join(`
40
+ `)}`)}return n}function Qn(e){return e.replaceAll(ue.sep,ue.posix.sep)}const Jn=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(Jn==="NODE"){let e=function(r){return new Promise(function(n,a){r.onload=r.onerror=function(o){r.onload=r.onerror=null,o.type==="load"?n(r.result):a(new Error("Failed to read the blob/file"))}})},t=function(){const r=new Uint8Array([1,2,3,4]),a=new File([r],"test").stream();try{return a.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class r extends Blob{constructor(a,o,i){super(a);let s;i?.lastModified&&(s=new Date),(!s||isNaN(s.getFullYear()))&&(s=new Date),this.lastModifiedDate=s,this.lastModified=s.getMilliseconds(),this.name=o||""}}global.File=r}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const n=new FileReader;return n.readAsArrayBuffer(this),e(n)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const n=new FileReader;return n.readAsText(this),e(n)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let r=0;const n=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(a){const o=a.byobRequest.view,s=await n.slice(r,r+o.byteLength).arrayBuffer(),l=new Uint8Array(s);new Uint8Array(o.buffer).set(l);const d=l.byteLength;a.byobRequest.respond(d),r+=d,r>=n.size&&a.close()}})})}if(Jn==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(r,n={}){super(r,n),this.detail=n.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Go="playground-log",Yo=(e,...t)=>{we.dispatchEvent(new CustomEvent(Go,{detail:{log:e,args:t}}))},zo=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",nr(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",nr(e.message.message)),e.severity){case de.Debug:console.debug(e.message,...t);break;case de.Info:console.info(e.message,...t);break;case de.Warn:console.warn(e.message,...t);break;case de.Error:console.error(e.message,...t);break;case de.Fatal:console.error(e.message,...t);break;default:console.log(e.message,...t)}},Qo=e=>e instanceof Error?[e.message,e.stack].join(`
41
+ `):JSON.stringify(e,null,2),Zn=[],Rr=e=>{Zn.push(e)},Kn=e=>{if(e.raw===!0)Rr(e.message);else{const t=Ko(typeof e.message=="object"?Qo(e.message):e.message,e.severity,e.prefix??Re.JS);Rr(t)}},de={Fatal:{},Error:{name:"error",level:1},Warn:{name:"warn",level:2},Log:{name:"log",level:3},Info:{name:"info",level:4},Debug:{name:"debug",level:5}},Re={JS:"JavaScript"};class Jo extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=de.Info,this.handlers=t}getLogs(){return this.handlers.includes(Kn)?[...Zn]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
3
42
  If you're using a custom logger instance, make sure to register logToMemory handler.
4
- `),[])}logMessage(n,...c){const a={...n,severity:n.severity??ut.Log};for(const f of this.handlers)a.severity.level<=this.severity.level&&f(a,...c)}setSeverityFilterLevel(n){this.severity=n}log(n,...c){this.logMessage({message:n,severity:ut.Log,prefix:xt.JS,raw:!1},...c)}debug(n,...c){this.logMessage({message:n,severity:ut.Debug,prefix:xt.JS,raw:!1},...c)}info(n,...c){this.logMessage({message:n,severity:ut.Info,prefix:xt.JS,raw:!1},...c)}warn(n,...c){this.logMessage({message:n,severity:ut.Warn,prefix:xt.JS,raw:!1},...c)}error(n,...c){this.logMessage({message:n,severity:ut.Error,prefix:xt.JS,raw:!1},...c)}}const Un=()=>{try{}catch{}return[Kr,Bn,Sn]},ht=new jn(Un()),Ie=u=>u.replace(/\t/g,""),Xn=(u,n,c)=>{const a=new Date,f=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(a).replace(/ /g,"-"),o=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(a),t=f+" "+o;return u=Ie(u),`[${t}] ${c} ${n.name}: ${u}`};var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ae={exports:{}},Dt=typeof Reflect=="object"?Reflect:null,Qe=Dt&&typeof Dt.apply=="function"?Dt.apply:function(n,c,a){return Function.prototype.apply.call(n,c,a)},Mt;Dt&&typeof Dt.ownKeys=="function"?Mt=Dt.ownKeys:Object.getOwnPropertySymbols?Mt=function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Mt=function(n){return Object.getOwnPropertyNames(n)};function qn(u){console&&console.warn&&console.warn(u)}var Qr=Number.isNaN||function(n){return n!==n};function Z(){Z.init.call(this)}Ae.exports=Z;Ae.exports.once=Wn;Z.EventEmitter=Z;Z.prototype._events=void 0;Z.prototype._eventsCount=0;Z.prototype._maxListeners=void 0;var Je=10;function Ft(u){if(typeof u!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof u)}Object.defineProperty(Z,"defaultMaxListeners",{enumerable:!0,get:function(){return Je},set:function(u){if(typeof u!="number"||u<0||Qr(u))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+u+".");Je=u}});Z.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};Z.prototype.setMaxListeners=function(n){if(typeof n!="number"||n<0||Qr(n))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+n+".");return this._maxListeners=n,this};function Jr(u){return u._maxListeners===void 0?Z.defaultMaxListeners:u._maxListeners}Z.prototype.getMaxListeners=function(){return Jr(this)};Z.prototype.emit=function(n){for(var c=[],a=1;a<arguments.length;a++)c.push(arguments[a]);var f=n==="error",o=this._events;if(o!==void 0)f=f&&o.error===void 0;else if(!f)return!1;if(f){var t;if(c.length>0&&(t=c[0]),t instanceof Error)throw t;var i=new Error("Unhandled error."+(t?" ("+t.message+")":""));throw i.context=t,i}var m=o[n];if(m===void 0)return!1;if(typeof m=="function")Qe(m,this,c);else for(var N=m.length,w=nn(m,N),a=0;a<N;++a)Qe(w[a],this,c);return!0};function Zr(u,n,c,a){var f,o,t;if(Ft(c),o=u._events,o===void 0?(o=u._events=Object.create(null),u._eventsCount=0):(o.newListener!==void 0&&(u.emit("newListener",n,c.listener?c.listener:c),o=u._events),t=o[n]),t===void 0)t=o[n]=c,++u._eventsCount;else if(typeof t=="function"?t=o[n]=a?[c,t]:[t,c]:a?t.unshift(c):t.push(c),f=Jr(u),f>0&&t.length>f&&!t.warned){t.warned=!0;var i=new Error("Possible EventEmitter memory leak detected. "+t.length+" "+String(n)+" listeners added. Use emitter.setMaxListeners() to increase limit");i.name="MaxListenersExceededWarning",i.emitter=u,i.type=n,i.count=t.length,qn(i)}return u}Z.prototype.addListener=function(n,c){return Zr(this,n,c,!1)};Z.prototype.on=Z.prototype.addListener;Z.prototype.prependListener=function(n,c){return Zr(this,n,c,!0)};function kn(){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 tn(u,n,c){var a={fired:!1,wrapFn:void 0,target:u,type:n,listener:c},f=kn.bind(a);return f.listener=c,a.wrapFn=f,f}Z.prototype.once=function(n,c){return Ft(c),this.on(n,tn(this,n,c)),this};Z.prototype.prependOnceListener=function(n,c){return Ft(c),this.prependListener(n,tn(this,n,c)),this};Z.prototype.removeListener=function(n,c){var a,f,o,t,i;if(Ft(c),f=this._events,f===void 0)return this;if(a=f[n],a===void 0)return this;if(a===c||a.listener===c)--this._eventsCount===0?this._events=Object.create(null):(delete f[n],f.removeListener&&this.emit("removeListener",n,a.listener||c));else if(typeof a!="function"){for(o=-1,t=a.length-1;t>=0;t--)if(a[t]===c||a[t].listener===c){i=a[t].listener,o=t;break}if(o<0)return this;o===0?a.shift():Vn(a,o),a.length===1&&(f[n]=a[0]),f.removeListener!==void 0&&this.emit("removeListener",n,i||c)}return this};Z.prototype.off=Z.prototype.removeListener;Z.prototype.removeAllListeners=function(n){var c,a,f;if(a=this._events,a===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[n]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete a[n]),this;if(arguments.length===0){var o=Object.keys(a),t;for(f=0;f<o.length;++f)t=o[f],t!=="removeListener"&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(c=a[n],typeof c=="function")this.removeListener(n,c);else if(c!==void 0)for(f=c.length-1;f>=0;f--)this.removeListener(n,c[f]);return this};function en(u,n,c){var a=u._events;if(a===void 0)return[];var f=a[n];return f===void 0?[]:typeof f=="function"?c?[f.listener||f]:[f]:c?$n(f):nn(f,f.length)}Z.prototype.listeners=function(n){return en(this,n,!0)};Z.prototype.rawListeners=function(n){return en(this,n,!1)};Z.listenerCount=function(u,n){return typeof u.listenerCount=="function"?u.listenerCount(n):rn.call(u,n)};Z.prototype.listenerCount=rn;function rn(u){var n=this._events;if(n!==void 0){var c=n[u];if(typeof c=="function")return 1;if(c!==void 0)return c.length}return 0}Z.prototype.eventNames=function(){return this._eventsCount>0?Mt(this._events):[]};function nn(u,n){for(var c=new Array(n),a=0;a<n;++a)c[a]=u[a];return c}function Vn(u,n){for(;n+1<u.length;n++)u[n]=u[n+1];u.pop()}function $n(u){for(var n=new Array(u.length),c=0;c<n.length;++c)n[c]=u[c].listener||u[c];return n}function Wn(u,n){return new Promise(function(c,a){function f(t){u.removeListener(n,o),a(t)}function o(){typeof u.removeListener=="function"&&u.removeListener("error",f),c([].slice.call(arguments))}on(u,n,o,{once:!0}),n!=="error"&&Hn(u,f,{once:!0})})}function Hn(u,n,c){typeof u.on=="function"&&on(u,"error",n,c)}function on(u,n,c,a){if(typeof u.on=="function")a.once?u.once(n,c):u.on(n,c);else if(typeof u.addEventListener=="function")u.addEventListener(n,function f(o){a.once&&u.removeEventListener(n,f),c(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof u)}var Le=Ae.exports;class Gn extends Le.EventEmitter{constructor(n=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new Cn({port:n}),this.wss.on("connection",c=>{if(this.ws){c.close();return}this.ws=c,this.emit("clientConnected"),c.on("message",a=>{ht.debug("\x1B[1;32m[CDP][received]\x1B[0m",a.toString());let f;try{f=JSON.parse(a.toString())}catch{return}this.connected?this.emit("message",f):this.buffer.push(f)}),c.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),c.on("error",a=>{this.emit("error",a)})}),this.on("newListener",c=>{c==="message"&&process.nextTick(()=>{for(const a of this.buffer)this.emit("message",a);this.buffer=[],this.connected=!0})})}sendMessage(n){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const c=JSON.stringify(n);ht.debug("\x1B[1;32m[CDP][send]\x1B[0m",c),this.ws.send(c)}close(){this.wss.close()}}class Yn extends Le.EventEmitter{constructor(n=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=An.createServer(),this.server.on("connection",c=>{if(this.socket){c.destroy();return}this.socket=c,c.setEncoding("utf8"),this.emit("connected"),c.on("data",a=>this.onData(a.toString())),c.on("close",()=>{this.socket=null,this.emit("disconnected")}),c.on("error",a=>{this.emit("error",a)})}),this.server.listen(n)}onData(n){for(ht.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",n),this.buffer+=n;;){if(this.expectedLength===null){const c=this.buffer.indexOf("\0");if(c===-1)break;const a=this.buffer.substring(0,c),f=parseInt(a,10);if(isNaN(f)){this.buffer="";break}this.expectedLength=f,this.buffer=this.buffer.slice(c+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const c=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const a=c.trim();this.expectedLength=null,this.emit("message",a);continue}break}}sendCommand(n){this.socket&&(ht.debug("\x1B[1;32m[XDebug][send]\x1B[0m",n),this.socket.write(n+"\0"))}close(){this.server.close()}}/**
43
+ `),[])}logMessage(t,...r){const n={...t,severity:t.severity??de.Log};for(const a of this.handlers)n.severity.level<=this.severity.level&&a(n,...r)}setSeverityFilterLevel(t){this.severity=t}log(t,...r){this.logMessage({message:t,severity:de.Log,prefix:Re.JS,raw:!1},...r)}debug(t,...r){this.logMessage({message:t,severity:de.Debug,prefix:Re.JS,raw:!1},...r)}info(t,...r){this.logMessage({message:t,severity:de.Info,prefix:Re.JS,raw:!1},...r)}warn(t,...r){this.logMessage({message:t,severity:de.Warn,prefix:Re.JS,raw:!1},...r)}error(t,...r){this.logMessage({message:t,severity:de.Error,prefix:Re.JS,raw:!1},...r)}}const Zo=()=>{try{}catch{}return[Kn,zo,Yo]},we=new Jo(Zo()),nr=e=>e.replace(/\t/g,""),Ko=(e,t,r)=>{const n=new Date,a=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(n).replace(/ /g,"-"),o=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(n),i=a+" "+o;return e=nr(e),`[${i}] ${r} ${t.name}: ${e}`};var Q=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ar={exports:{}},je=typeof Reflect=="object"?Reflect:null,jr=je&&typeof je.apply=="function"?je.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},Ze;je&&typeof je.ownKeys=="function"?Ze=je.ownKeys:Object.getOwnPropertySymbols?Ze=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ze=function(t){return Object.getOwnPropertyNames(t)};function es(e){console&&console.warn&&console.warn(e)}var ei=Number.isNaN||function(t){return t!==t};function ee(){ee.init.call(this)}ar.exports=ee;ar.exports.once=is;ee.EventEmitter=ee;ee.prototype._events=void 0;ee.prototype._eventsCount=0;ee.prototype._maxListeners=void 0;var Ur=10;function ot(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(ee,"defaultMaxListeners",{enumerable:!0,get:function(){return Ur},set:function(e){if(typeof e!="number"||e<0||ei(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Ur=e}});ee.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};ee.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||ei(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 ti(e){return e._maxListeners===void 0?ee.defaultMaxListeners:e._maxListeners}ee.prototype.getMaxListeners=function(){return ti(this)};ee.prototype.emit=function(t){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var a=t==="error",o=this._events;if(o!==void 0)a=a&&o.error===void 0;else if(!a)return!1;if(a){var i;if(r.length>0&&(i=r[0]),i instanceof Error)throw i;var s=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw s.context=i,s}var l=o[t];if(l===void 0)return!1;if(typeof l=="function")jr(l,this,r);else for(var d=l.length,g=si(l,d),n=0;n<d;++n)jr(g[n],this,r);return!0};function ri(e,t,r,n){var a,o,i;if(ot(r),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),i=o[t]),i===void 0)i=o[t]=r,++e._eventsCount;else if(typeof i=="function"?i=o[t]=n?[r,i]:[i,r]:n?i.unshift(r):i.push(r),a=ti(e),a>0&&i.length>a&&!i.warned){i.warned=!0;var s=new Error("Possible EventEmitter memory leak detected. "+i.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");s.name="MaxListenersExceededWarning",s.emitter=e,s.type=t,s.count=i.length,es(s)}return e}ee.prototype.addListener=function(t,r){return ri(this,t,r,!1)};ee.prototype.on=ee.prototype.addListener;ee.prototype.prependListener=function(t,r){return ri(this,t,r,!0)};function ts(){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 ni(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=ts.bind(n);return a.listener=r,n.wrapFn=a,a}ee.prototype.once=function(t,r){return ot(r),this.on(t,ni(this,t,r)),this};ee.prototype.prependOnceListener=function(t,r){return ot(r),this.prependListener(t,ni(this,t,r)),this};ee.prototype.removeListener=function(t,r){var n,a,o,i,s;if(ot(r),a=this._events,a===void 0)return this;if(n=a[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(o=-1,i=n.length-1;i>=0;i--)if(n[i]===r||n[i].listener===r){s=n[i].listener,o=i;break}if(o<0)return this;o===0?n.shift():rs(n,o),n.length===1&&(a[t]=n[0]),a.removeListener!==void 0&&this.emit("removeListener",t,s||r)}return this};ee.prototype.off=ee.prototype.removeListener;ee.prototype.removeAllListeners=function(t){var r,n,a;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 o=Object.keys(n),i;for(a=0;a<o.length;++a)i=o[a],i!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[t],typeof r=="function")this.removeListener(t,r);else if(r!==void 0)for(a=r.length-1;a>=0;a--)this.removeListener(t,r[a]);return this};function ii(e,t,r){var n=e._events;if(n===void 0)return[];var a=n[t];return a===void 0?[]:typeof a=="function"?r?[a.listener||a]:[a]:r?ns(a):si(a,a.length)}ee.prototype.listeners=function(t){return ii(this,t,!0)};ee.prototype.rawListeners=function(t){return ii(this,t,!1)};ee.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):oi.call(e,t)};ee.prototype.listenerCount=oi;function oi(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}ee.prototype.eventNames=function(){return this._eventsCount>0?Ze(this._events):[]};function si(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function rs(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function ns(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function is(e,t){return new Promise(function(r,n){function a(i){e.removeListener(t,o),n(i)}function o(){typeof e.removeListener=="function"&&e.removeListener("error",a),r([].slice.call(arguments))}ai(e,t,o,{once:!0}),t!=="error"&&os(e,a,{once:!0})})}function os(e,t,r){typeof e.on=="function"&&ai(e,"error",t,r)}function ai(e,t,r,n){if(typeof e.on=="function")n.once?e.once(t,r):e.on(t,r);else if(typeof e.addEventListener=="function")e.addEventListener(t,function a(o){n.once&&e.removeEventListener(t,a),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var ur=ar.exports;class ss extends ur.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new Si({port:t}),this.wss.on("connection",r=>{if(this.ws){r.close();return}this.ws=r,this.emit("clientConnected"),r.on("message",n=>{we.debug("\x1B[1;32m[CDP][received]\x1B[0m",n.toString());let a;try{a=JSON.parse(n.toString())}catch{return}this.connected?this.emit("message",a):this.buffer.push(a)}),r.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),r.on("error",n=>{this.emit("error",n)})}),this.on("newListener",r=>{r==="message"&&process.nextTick(()=>{for(const n of this.buffer)this.emit("message",n);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const r=JSON.stringify(t);we.debug("\x1B[1;32m[CDP][send]\x1B[0m",r),this.ws.send(r)}close(){this.wss.close()}}class as extends ur.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=Mi.createServer(),this.server.on("connection",r=>{if(this.socket){r.destroy();return}this.socket=r,r.setEncoding("utf8"),this.emit("connected"),r.on("data",n=>this.onData(n.toString())),r.on("close",()=>{this.socket=null,this.emit("disconnected")}),r.on("error",n=>{this.emit("error",n)})}),this.server.listen(t)}onData(t){for(we.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const r=this.buffer.indexOf("\0");if(r===-1)break;const n=this.buffer.substring(0,r),a=parseInt(n,10);if(isNaN(a)){this.buffer="";break}this.expectedLength=a,this.buffer=this.buffer.slice(r+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const r=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=r.trim();this.expectedLength=null,this.emit("message",n);continue}break}}sendCommand(t){this.socket&&(we.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}/**
5
44
  * @license
6
45
  * Copyright (c) 2016, Contributors
7
46
  * SPDX-License-Identifier: ISC
8
- */function At(u){if(u!==u.toLowerCase()&&u!==u.toUpperCase()||(u=u.toLowerCase()),u.indexOf("-")===-1&&u.indexOf("_")===-1)return u;{let c="",a=!1;const f=u.match(/^-+/);for(let o=f?f[0].length:0;o<u.length;o++){let t=u.charAt(o);a&&(a=!1,t=t.toUpperCase()),o!==0&&(t==="-"||t==="_")?a=!0:t!=="-"&&t!=="_"&&(c+=t)}return c}}function zn(u,n){const c=u.toLowerCase();n=n||"-";let a="";for(let f=0;f<u.length;f++){const o=c.charAt(f),t=u.charAt(f);o!==t&&f>0?a+=`${n}${c.charAt(f)}`:a+=t}return a}function Kn(u){return u==null?!1:typeof u=="number"||/^0x[0-9a-f]+$/i.test(u)?!0:/^0[^.]/.test(u)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(u)}/**
47
+ */function ze(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let r="",n=!1;const a=e.match(/^-+/);for(let o=a?a[0].length:0;o<e.length;o++){let i=e.charAt(o);n&&(n=!1,i=i.toUpperCase()),o!==0&&(i==="-"||i==="_")?n=!0:i!=="-"&&i!=="_"&&(r+=i)}return r}}function us(e,t){const r=e.toLowerCase();t=t||"-";let n="";for(let a=0;a<e.length;a++){const o=r.charAt(a),i=e.charAt(a);o!==i&&a>0?n+=`${t}${r.charAt(a)}`:n+=i}return n}function cs(e){return e==null?!1:typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^0[^.]/.test(e)?!1:/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}/**
9
48
  * @license
10
49
  * Copyright (c) 2016, Contributors
11
50
  * SPDX-License-Identifier: ISC
12
- */function Qn(u){if(Array.isArray(u))return u.map(t=>typeof t!="string"?t+"":t);u=u.trim();let n=0,c=null,a=null,f=null;const o=[];for(let t=0;t<u.length;t++){if(c=a,a=u.charAt(t),a===" "&&!f){c!==" "&&n++;continue}a===f?f=null:(a==="'"||a==='"')&&!f&&(f=a),o[n]||(o[n]=""),o[n]+=a}return o}/**
51
+ */function ls(e){if(Array.isArray(e))return e.map(i=>typeof i!="string"?i+"":i);e=e.trim();let t=0,r=null,n=null,a=null;const o=[];for(let i=0;i<e.length;i++){if(r=n,n=e.charAt(i),n===" "&&!a){r!==" "&&t++;continue}n===a?a=null:(n==="'"||n==='"')&&!a&&(a=n),o[t]||(o[t]=""),o[t]+=n}return o}/**
13
52
  * @license
14
53
  * Copyright (c) 2016, Contributors
15
54
  * SPDX-License-Identifier: ISC
16
- */var ft;(function(u){u.BOOLEAN="boolean",u.STRING="string",u.NUMBER="number",u.ARRAY="array"})(ft||(ft={}));/**
55
+ */var ye;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(ye||(ye={}));/**
17
56
  * @license
18
57
  * Copyright (c) 2016, Contributors
19
58
  * SPDX-License-Identifier: ISC
20
- */let pt;class Jn{constructor(n){pt=n}parse(n,c){const a=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},c),f=Qn(n),o=typeof n=="string",t=Zn(Object.assign(Object.create(null),a.alias)),i=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},a.configuration),m=Object.assign(Object.create(null),a.default),N=a.configObjects||[],w=a.envPrefix,y=i["populate--"],b=y?"--":"_",x=Object.create(null),O=Object.create(null),_=a.__||pt.format,E={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]+)$/,T=new RegExp("^--"+i["negation-prefix"]+"(.+)");[].concat(a.array||[]).filter(Boolean).forEach(function(C){const s=typeof C=="object"?C.key:C,e=Object.keys(C).map(function(r){return{boolean:"bools",string:"strings",number:"numbers"}[r]}).filter(Boolean).pop();e&&(E[e][s]=!0),E.arrays[s]=!0,E.keys.push(s)}),[].concat(a.boolean||[]).filter(Boolean).forEach(function(C){E.bools[C]=!0,E.keys.push(C)}),[].concat(a.string||[]).filter(Boolean).forEach(function(C){E.strings[C]=!0,E.keys.push(C)}),[].concat(a.number||[]).filter(Boolean).forEach(function(C){E.numbers[C]=!0,E.keys.push(C)}),[].concat(a.count||[]).filter(Boolean).forEach(function(C){E.counts[C]=!0,E.keys.push(C)}),[].concat(a.normalize||[]).filter(Boolean).forEach(function(C){E.normalize[C]=!0,E.keys.push(C)}),typeof a.narg=="object"&&Object.entries(a.narg).forEach(([C,s])=>{typeof s=="number"&&(E.nargs[C]=s,E.keys.push(C))}),typeof a.coerce=="object"&&Object.entries(a.coerce).forEach(([C,s])=>{typeof s=="function"&&(E.coercions[C]=s,E.keys.push(C))}),typeof a.config<"u"&&(Array.isArray(a.config)||typeof a.config=="string"?[].concat(a.config).filter(Boolean).forEach(function(C){E.configs[C]=!0}):typeof a.config=="object"&&Object.entries(a.config).forEach(([C,s])=>{(typeof s=="boolean"||typeof s=="function")&&(E.configs[C]=s)})),Tt(a.key,t,a.default,E.arrays),Object.keys(m).forEach(function(C){(E.aliases[C]||[]).forEach(function(s){m[s]=m[C]})});let p=null;it();let I=[];const A=Object.assign(Object.create(null),{_:[]}),j={};for(let C=0;C<f.length;C++){const s=f[C],e=s.replace(/^-{3,}/,"---");let r,l,v,M,P,q;if(s!=="--"&&/^-/.test(s)&&d(s))U(s);else if(e.match(/^---+(=|$)/)){U(s);continue}else if(s.match(/^--.+=/)||!i["short-option-groups"]&&s.match(/^-.+=/))M=s.match(/^--?([^=]+)=([\s\S]*)$/),M!==null&&Array.isArray(M)&&M.length>=3&&(k(M[1],E.arrays)?C=h(C,M[1],f,M[2]):k(M[1],E.nargs)!==!1?C=B(C,M[1],f,M[2]):F(M[1],M[2],!0));else if(s.match(T)&&i["boolean-negation"])M=s.match(T),M!==null&&Array.isArray(M)&&M.length>=2&&(l=M[1],F(l,k(l,E.arrays)?[!1]:!1));else if(s.match(/^--.+/)||!i["short-option-groups"]&&s.match(/^-[^-]+/))M=s.match(/^--?(.+)/),M!==null&&Array.isArray(M)&&M.length>=2&&(l=M[1],k(l,E.arrays)?C=h(C,l,f):k(l,E.nargs)!==!1?C=B(C,l,f):(P=f[C+1],P!==void 0&&(!P.match(/^-/)||P.match(D))&&!k(l,E.bools)&&!k(l,E.counts)||/^(true|false)$/.test(P)?(F(l,P),C++):F(l,L(l))));else if(s.match(/^-.\..+=/))M=s.match(/^-([^=]+)=([\s\S]*)$/),M!==null&&Array.isArray(M)&&M.length>=3&&F(M[1],M[2]);else if(s.match(/^-.\..+/)&&!s.match(D))P=f[C+1],M=s.match(/^-(.\..+)/),M!==null&&Array.isArray(M)&&M.length>=2&&(l=M[1],P!==void 0&&!P.match(/^-/)&&!k(l,E.bools)&&!k(l,E.counts)?(F(l,P),C++):F(l,L(l)));else if(s.match(/^-[^-]+/)&&!s.match(D)){v=s.slice(1,-1).split(""),r=!1;for(let V=0;V<v.length;V++){if(P=s.slice(V+2),v[V+1]&&v[V+1]==="="){q=s.slice(V+3),l=v[V],k(l,E.arrays)?C=h(C,l,f,q):k(l,E.nargs)!==!1?C=B(C,l,f,q):F(l,q),r=!0;break}if(P==="-"){F(v[V],P);continue}if(/[A-Za-z]/.test(v[V])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(P)&&k(P,E.bools)===!1){F(v[V],P),r=!0;break}if(v[V+1]&&v[V+1].match(/\W/)){F(v[V],P),r=!0;break}else F(v[V],L(v[V]))}l=s.slice(-1)[0],!r&&l!=="-"&&(k(l,E.arrays)?C=h(C,l,f):k(l,E.nargs)!==!1?C=B(C,l,f):(P=f[C+1],P!==void 0&&(!/^(-|--)[^-]/.test(P)||P.match(D))&&!k(l,E.bools)&&!k(l,E.counts)||/^(true|false)$/.test(P)?(F(l,P),C++):F(l,L(l))))}else if(s.match(/^-[0-9]$/)&&s.match(D)&&k(s.slice(1),E.bools))l=s.slice(1),F(l,L(l));else if(s==="--"){I=f.slice(C+1);break}else if(i["halt-at-non-option"]){I=f.slice(C);break}else U(s)}W(A,!0),W(A,!1),Y(A),z(),gt(A,E.aliases,m,!0),vt(A),i["set-placeholder-key"]&&bt(A),Object.keys(E.counts).forEach(function(C){Q(A,C.split("."))||F(C,0)}),y&&I.length&&(A[b]=[]),I.forEach(function(C){A[b].push(C)}),i["camel-case-expansion"]&&i["strip-dashed"]&&Object.keys(A).filter(C=>C!=="--"&&C.includes("-")).forEach(C=>{delete A[C]}),i["strip-aliased"]&&[].concat(...Object.keys(t).map(C=>t[C])).forEach(C=>{i["camel-case-expansion"]&&C.includes("-")&&delete A[C.split(".").map(s=>At(s)).join(".")],delete A[C]});function U(C){const s=$("_",C);(typeof s=="string"||typeof s=="number")&&A._.push(s)}function B(C,s,e,r){let l,v=k(s,E.nargs);if(v=typeof v!="number"||isNaN(v)?1:v,v===0)return H(r)||(p=Error(_("Argument unexpected for: %s",s))),F(s,L(s)),C;let M=H(r)?0:1;if(i["nargs-eats-options"])e.length-(C+1)+M<v&&(p=Error(_("Not enough arguments following: %s",s))),M=v;else{for(l=C+1;l<e.length&&(!e[l].match(/^-[^0-9]/)||e[l].match(D)||d(e[l]));l++)M++;M<v&&(p=Error(_("Not enough arguments following: %s",s)))}let P=Math.min(M,v);for(!H(r)&&P>0&&(F(s,r),P--),l=C+1;l<P+C+1;l++)F(s,e[l]);return C+P}function h(C,s,e,r){let l=[],v=r||e[C+1];const M=k(s,E.nargs);if(k(s,E.bools)&&!/^(true|false)$/.test(v))l.push(!0);else if(H(v)||H(r)&&/^-/.test(v)&&!D.test(v)&&!d(v)){if(m[s]!==void 0){const P=m[s];l=Array.isArray(P)?P:[P]}}else{H(r)||l.push(X(s,r,!0));for(let P=C+1;P<e.length&&!(!i["greedy-arrays"]&&l.length>0||M&&typeof M=="number"&&l.length>=M||(v=e[P],/^-/.test(v)&&!D.test(v)&&!d(v)));P++)C=P,l.push(X(s,v,o))}return typeof M=="number"&&(M&&l.length<M||isNaN(M)&&l.length===0)&&(p=Error(_("Not enough arguments following: %s",s))),F(s,l),C}function F(C,s,e=o){if(/-/.test(C)&&i["camel-case-expansion"]){const v=C.split(".").map(function(M){return At(M)}).join(".");R(C,v)}const r=X(C,s,e),l=C.split(".");et(A,l,r),E.aliases[C]&&E.aliases[C].forEach(function(v){const M=v.split(".");et(A,M,r)}),l.length>1&&i["dot-notation"]&&(E.aliases[l[0]]||[]).forEach(function(v){let M=v.split(".");const P=[].concat(l);P.shift(),M=M.concat(P),(E.aliases[C]||[]).includes(M.join("."))||et(A,M,r)}),k(C,E.normalize)&&!k(C,E.arrays)&&[C].concat(E.aliases[C]||[]).forEach(function(M){Object.defineProperty(j,M,{enumerable:!0,get(){return s},set(P){s=typeof P=="string"?pt.normalize(P):P}})})}function R(C,s){E.aliases[C]&&E.aliases[C].length||(E.aliases[C]=[s],x[s]=!0),E.aliases[s]&&E.aliases[s].length||R(s,C)}function X(C,s,e){e&&(s=ti(s)),(k(C,E.bools)||k(C,E.counts))&&typeof s=="string"&&(s=s==="true");let r=Array.isArray(s)?s.map(function(l){return $(C,l)}):$(C,s);return k(C,E.counts)&&(H(r)||typeof r=="boolean")&&(r=Rt()),k(C,E.normalize)&&k(C,E.arrays)&&(Array.isArray(s)?r=s.map(l=>pt.normalize(l)):r=pt.normalize(s)),r}function $(C,s){return!i["parse-positional-numbers"]&&C==="_"||!k(C,E.strings)&&!k(C,E.bools)&&!Array.isArray(s)&&(Kn(s)&&i["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)))||!H(s)&&k(C,E.numbers))&&(s=Number(s)),s}function Y(C){const s=Object.create(null);gt(s,E.aliases,m),Object.keys(E.configs).forEach(function(e){const r=C[e]||s[e];if(r)try{let l=null;const v=pt.resolve(pt.cwd(),r),M=E.configs[e];if(typeof M=="function"){try{l=M(v)}catch(P){l=P}if(l instanceof Error){p=l;return}}else l=pt.require(v);J(l)}catch(l){l.name==="PermissionDenied"?p=l:C[e]&&(p=Error(_("Invalid JSON config file: %s",r)))}})}function J(C,s){Object.keys(C).forEach(function(e){const r=C[e],l=s?s+"."+e:e;typeof r=="object"&&r!==null&&!Array.isArray(r)&&i["dot-notation"]?J(r,l):(!Q(A,l.split("."))||k(l,E.arrays)&&i["combine-arrays"])&&F(l,r)})}function z(){typeof N<"u"&&N.forEach(function(C){J(C)})}function W(C,s){if(typeof w>"u")return;const e=typeof w=="string"?w:"",r=pt.env();Object.keys(r).forEach(function(l){if(e===""||l.lastIndexOf(e,0)===0){const v=l.split("__").map(function(M,P){return P===0&&(M=M.substring(e.length)),At(M)});(s&&E.configs[v.join(".")]||!s)&&!Q(C,v)&&F(v.join("."),r[l])}})}function vt(C){let s;const e=new Set;Object.keys(C).forEach(function(r){if(!e.has(r)&&(s=k(r,E.coercions),typeof s=="function"))try{const l=$(r,s(C[r]));[].concat(E.aliases[r]||[],r).forEach(v=>{e.add(v),C[v]=l})}catch(l){p=l}})}function bt(C){return E.keys.forEach(s=>{~s.indexOf(".")||typeof C[s]>"u"&&(C[s]=void 0)}),C}function gt(C,s,e,r=!1){Object.keys(e).forEach(function(l){Q(C,l.split("."))||(et(C,l.split("."),e[l]),r&&(O[l]=!0),(s[l]||[]).forEach(function(v){Q(C,v.split("."))||et(C,v.split("."),e[l])}))})}function Q(C,s){let e=C;i["dot-notation"]||(s=[s.join(".")]),s.slice(0,-1).forEach(function(l){e=e[l]||{}});const r=s[s.length-1];return typeof e!="object"?!1:r in e}function et(C,s,e){let r=C;i["dot-notation"]||(s=[s.join(".")]),s.slice(0,-1).forEach(function(q){q=Ze(q),typeof r=="object"&&r[q]===void 0&&(r[q]={}),typeof r[q]!="object"||Array.isArray(r[q])?(Array.isArray(r[q])?r[q].push({}):r[q]=[r[q],{}],r=r[q][r[q].length-1]):r=r[q]});const l=Ze(s[s.length-1]),v=k(s.join("."),E.arrays),M=Array.isArray(e);let P=i["duplicate-arguments-array"];!P&&k(l,E.nargs)&&(P=!0,(!H(r[l])&&E.nargs[l]===1||Array.isArray(r[l])&&r[l].length===E.nargs[l])&&(r[l]=void 0)),e===Rt()?r[l]=Rt(r[l]):Array.isArray(r[l])?P&&v&&M?r[l]=i["flatten-duplicate-arrays"]?r[l].concat(e):(Array.isArray(r[l][0])?r[l]:[r[l]]).concat([e]):!P&&!!v==!!M?r[l]=e:r[l]=r[l].concat([e]):r[l]===void 0&&v?r[l]=M?e:[e]:P&&!(r[l]===void 0||k(l,E.counts)||k(l,E.bools))?r[l]=[r[l],e]:r[l]=e}function Tt(...C){C.forEach(function(s){Object.keys(s||{}).forEach(function(e){E.aliases[e]||(E.aliases[e]=[].concat(t[e]||[]),E.aliases[e].concat(e).forEach(function(r){if(/-/.test(r)&&i["camel-case-expansion"]){const l=At(r);l!==e&&E.aliases[e].indexOf(l)===-1&&(E.aliases[e].push(l),x[l]=!0)}}),E.aliases[e].concat(e).forEach(function(r){if(r.length>1&&/[A-Z]/.test(r)&&i["camel-case-expansion"]){const l=zn(r,"-");l!==e&&E.aliases[e].indexOf(l)===-1&&(E.aliases[e].push(l),x[l]=!0)}}),E.aliases[e].forEach(function(r){E.aliases[r]=[e].concat(E.aliases[e].filter(function(l){return r!==l}))}))})})}function k(C,s){const e=[].concat(E.aliases[C]||[],C),r=Object.keys(s),l=e.find(v=>r.includes(v));return l?s[l]:!1}function wt(C){const s=Object.keys(E);return[].concat(s.map(r=>E[r])).some(function(r){return Array.isArray(r)?r.includes(C):r[C]})}function It(C,...s){return[].concat(...s).some(function(r){const l=C.match(r);return l&&wt(l[1])})}function g(C){if(C.match(D)||!C.match(/^-[^-]+/))return!1;let s=!0,e;const r=C.slice(1).split("");for(let l=0;l<r.length;l++){if(e=C.slice(l+2),!wt(r[l])){s=!1;break}if(r[l+1]&&r[l+1]==="="||e==="-"||/[A-Za-z]/.test(r[l])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(e)||r[l+1]&&r[l+1].match(/\W/))break}return s}function d(C){return i["unknown-options-as-args"]&&S(C)}function S(C){return C=C.replace(/^-{3,}/,"--"),C.match(D)||g(C)?!1:!It(C,/^-+([^=]+?)=[\s\S]*$/,T,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function L(C){return!k(C,E.bools)&&!k(C,E.counts)&&`${C}`in m?m[C]:K(tt(C))}function K(C){return{[ft.BOOLEAN]:!0,[ft.STRING]:"",[ft.NUMBER]:void 0,[ft.ARRAY]:[]}[C]}function tt(C){let s=ft.BOOLEAN;return k(C,E.strings)?s=ft.STRING:k(C,E.numbers)?s=ft.NUMBER:k(C,E.bools)?s=ft.BOOLEAN:k(C,E.arrays)&&(s=ft.ARRAY),s}function H(C){return C===void 0}function it(){Object.keys(E.counts).find(C=>k(C,E.arrays)?(p=Error(_("Invalid configuration: %s, opts.count excludes opts.array.",C)),!0):k(C,E.nargs)?(p=Error(_("Invalid configuration: %s, opts.count excludes opts.narg.",C)),!0):!1)}return{aliases:Object.assign({},E.aliases),argv:Object.assign(j,A),configuration:i,defaulted:Object.assign({},O),error:p,newAliases:Object.assign({},x)}}}function Zn(u){const n=[],c=Object.create(null);let a=!0;for(Object.keys(u).forEach(function(f){n.push([].concat(u[f],f))});a;){a=!1;for(let f=0;f<n.length;f++)for(let o=f+1;o<n.length;o++)if(n[f].filter(function(i){return n[o].indexOf(i)!==-1}).length){n[f]=n[f].concat(n[o]),n.splice(o,1),a=!0;break}}return n.forEach(function(f){f=f.filter(function(t,i,m){return m.indexOf(t)===i});const o=f.pop();o!==void 0&&typeof o=="string"&&(c[o]=f)}),c}function Rt(u){return u!==void 0?u+1:1}function Ze(u){return u==="__proto__"?"___proto___":u}function ti(u){return typeof u=="string"&&(u[0]==="'"||u[0]==='"')&&u[u.length-1]===u[0]?u.substring(1,u.length-1):u}/**
59
+ */let Ee;class fs{constructor(t){Ee=t}parse(t,r){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},r),a=ls(t),o=typeof t=="string",i=hs(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),l=Object.assign(Object.create(null),n.default),d=n.configObjects||[],g=n.envPrefix,m=s["populate--"],w=m?"--":"_",E=Object.create(null),I=Object.create(null),_=n.__||Ee.format,T={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:[]},x=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,v=new RegExp("^--"+s["negation-prefix"]+"(.+)");[].concat(n.array||[]).filter(Boolean).forEach(function(P){const f=typeof P=="object"?P.key:P,u=Object.keys(P).map(function(c){return{boolean:"bools",string:"strings",number:"numbers"}[c]}).filter(Boolean).pop();u&&(T[u][f]=!0),T.arrays[f]=!0,T.keys.push(f)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(P){T.bools[P]=!0,T.keys.push(P)}),[].concat(n.string||[]).filter(Boolean).forEach(function(P){T.strings[P]=!0,T.keys.push(P)}),[].concat(n.number||[]).filter(Boolean).forEach(function(P){T.numbers[P]=!0,T.keys.push(P)}),[].concat(n.count||[]).filter(Boolean).forEach(function(P){T.counts[P]=!0,T.keys.push(P)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(P){T.normalize[P]=!0,T.keys.push(P)}),typeof n.narg=="object"&&Object.entries(n.narg).forEach(([P,f])=>{typeof f=="number"&&(T.nargs[P]=f,T.keys.push(P))}),typeof n.coerce=="object"&&Object.entries(n.coerce).forEach(([P,f])=>{typeof f=="function"&&(T.coercions[P]=f,T.keys.push(P))}),typeof n.config<"u"&&(Array.isArray(n.config)||typeof n.config=="string"?[].concat(n.config).filter(Boolean).forEach(function(P){T.configs[P]=!0}):typeof n.config=="object"&&Object.entries(n.config).forEach(([P,f])=>{(typeof f=="boolean"||typeof f=="function")&&(T.configs[P]=f)})),Me(n.key,i,n.default,T.arrays),Object.keys(l).forEach(function(P){(T.aliases[P]||[]).forEach(function(f){l[f]=l[P]})});let h=null;oe();let O=[];const A=Object.assign(Object.create(null),{_:[]}),F={};for(let P=0;P<a.length;P++){const f=a[P],u=f.replace(/^-{3,}/,"---");let c,p,L,S,C,V;if(f!=="--"&&/^-/.test(f)&&b(f))M(f);else if(u.match(/^---+(=|$)/)){M(f);continue}else if(f.match(/^--.+=/)||!s["short-option-groups"]&&f.match(/^-.+=/))S=f.match(/^--?([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&(q(S[1],T.arrays)?P=y(P,S[1],a,S[2]):q(S[1],T.nargs)!==!1?P=k(P,S[1],a,S[2]):B(S[1],S[2],!0));else if(f.match(v)&&s["boolean-negation"])S=f.match(v),S!==null&&Array.isArray(S)&&S.length>=2&&(p=S[1],B(p,q(p,T.arrays)?[!1]:!1));else if(f.match(/^--.+/)||!s["short-option-groups"]&&f.match(/^-[^-]+/))S=f.match(/^--?(.+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(p=S[1],q(p,T.arrays)?P=y(P,p,a):q(p,T.nargs)!==!1?P=k(P,p,a):(C=a[P+1],C!==void 0&&(!C.match(/^-/)||C.match(x))&&!q(p,T.bools)&&!q(p,T.counts)||/^(true|false)$/.test(C)?(B(p,C),P++):B(p,D(p))));else if(f.match(/^-.\..+=/))S=f.match(/^-([^=]+)=([\s\S]*)$/),S!==null&&Array.isArray(S)&&S.length>=3&&B(S[1],S[2]);else if(f.match(/^-.\..+/)&&!f.match(x))C=a[P+1],S=f.match(/^-(.\..+)/),S!==null&&Array.isArray(S)&&S.length>=2&&(p=S[1],C!==void 0&&!C.match(/^-/)&&!q(p,T.bools)&&!q(p,T.counts)?(B(p,C),P++):B(p,D(p)));else if(f.match(/^-[^-]+/)&&!f.match(x)){L=f.slice(1,-1).split(""),c=!1;for(let G=0;G<L.length;G++){if(C=f.slice(G+2),L[G+1]&&L[G+1]==="="){V=f.slice(G+3),p=L[G],q(p,T.arrays)?P=y(P,p,a,V):q(p,T.nargs)!==!1?P=k(P,p,a,V):B(p,V),c=!0;break}if(C==="-"){B(L[G],C);continue}if(/[A-Za-z]/.test(L[G])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(C)&&q(C,T.bools)===!1){B(L[G],C),c=!0;break}if(L[G+1]&&L[G+1].match(/\W/)){B(L[G],C),c=!0;break}else B(L[G],D(L[G]))}p=f.slice(-1)[0],!c&&p!=="-"&&(q(p,T.arrays)?P=y(P,p,a):q(p,T.nargs)!==!1?P=k(P,p,a):(C=a[P+1],C!==void 0&&(!/^(-|--)[^-]/.test(C)||C.match(x))&&!q(p,T.bools)&&!q(p,T.counts)||/^(true|false)$/.test(C)?(B(p,C),P++):B(p,D(p))))}else if(f.match(/^-[0-9]$/)&&f.match(x)&&q(f.slice(1),T.bools))p=f.slice(1),B(p,D(p));else if(f==="--"){O=a.slice(P+1);break}else if(s["halt-at-non-option"]){O=a.slice(P);break}else M(f)}H(A,!0),H(A,!1),X(A),Y(),xe(A,T.aliases,l,!0),Ue(A),s["set-placeholder-key"]&&Ae(A),Object.keys(T.counts).forEach(function(P){Z(A,P.split("."))||B(P,0)}),m&&O.length&&(A[w]=[]),O.forEach(function(P){A[w].push(P)}),s["camel-case-expansion"]&&s["strip-dashed"]&&Object.keys(A).filter(P=>P!=="--"&&P.includes("-")).forEach(P=>{delete A[P]}),s["strip-aliased"]&&[].concat(...Object.keys(i).map(P=>i[P])).forEach(P=>{s["camel-case-expansion"]&&P.includes("-")&&delete A[P.split(".").map(f=>ze(f)).join(".")],delete A[P]});function M(P){const f=W("_",P);(typeof f=="string"||typeof f=="number")&&A._.push(f)}function k(P,f,u,c){let p,L=q(f,T.nargs);if(L=typeof L!="number"||isNaN(L)?1:L,L===0)return z(c)||(h=Error(_("Argument unexpected for: %s",f))),B(f,D(f)),P;let S=z(c)?0:1;if(s["nargs-eats-options"])u.length-(P+1)+S<L&&(h=Error(_("Not enough arguments following: %s",f))),S=L;else{for(p=P+1;p<u.length&&(!u[p].match(/^-[^0-9]/)||u[p].match(x)||b(u[p]));p++)S++;S<L&&(h=Error(_("Not enough arguments following: %s",f)))}let C=Math.min(S,L);for(!z(c)&&C>0&&(B(f,c),C--),p=P+1;p<C+P+1;p++)B(f,u[p]);return P+C}function y(P,f,u,c){let p=[],L=c||u[P+1];const S=q(f,T.nargs);if(q(f,T.bools)&&!/^(true|false)$/.test(L))p.push(!0);else if(z(L)||z(c)&&/^-/.test(L)&&!x.test(L)&&!b(L)){if(l[f]!==void 0){const C=l[f];p=Array.isArray(C)?C:[C]}}else{z(c)||p.push(U(f,c,!0));for(let C=P+1;C<u.length&&!(!s["greedy-arrays"]&&p.length>0||S&&typeof S=="number"&&p.length>=S||(L=u[C],/^-/.test(L)&&!x.test(L)&&!b(L)));C++)P=C,p.push(U(f,L,o))}return typeof S=="number"&&(S&&p.length<S||isNaN(S)&&p.length===0)&&(h=Error(_("Not enough arguments following: %s",f))),B(f,p),P}function B(P,f,u=o){if(/-/.test(P)&&s["camel-case-expansion"]){const L=P.split(".").map(function(S){return ze(S)}).join(".");j(P,L)}const c=U(P,f,u),p=P.split(".");te(A,p,c),T.aliases[P]&&T.aliases[P].forEach(function(L){const S=L.split(".");te(A,S,c)}),p.length>1&&s["dot-notation"]&&(T.aliases[p[0]]||[]).forEach(function(L){let S=L.split(".");const C=[].concat(p);C.shift(),S=S.concat(C),(T.aliases[P]||[]).includes(S.join("."))||te(A,S,c)}),q(P,T.normalize)&&!q(P,T.arrays)&&[P].concat(T.aliases[P]||[]).forEach(function(S){Object.defineProperty(F,S,{enumerable:!0,get(){return f},set(C){f=typeof C=="string"?Ee.normalize(C):C}})})}function j(P,f){T.aliases[P]&&T.aliases[P].length||(T.aliases[P]=[f],E[f]=!0),T.aliases[f]&&T.aliases[f].length||j(f,P)}function U(P,f,u){u&&(f=ps(f)),(q(P,T.bools)||q(P,T.counts))&&typeof f=="string"&&(f=f==="true");let c=Array.isArray(f)?f.map(function(p){return W(P,p)}):W(P,f);return q(P,T.counts)&&(z(c)||typeof c=="boolean")&&(c=lt()),q(P,T.normalize)&&q(P,T.arrays)&&(Array.isArray(f)?c=f.map(p=>Ee.normalize(p)):c=Ee.normalize(f)),c}function W(P,f){return!s["parse-positional-numbers"]&&P==="_"||!q(P,T.strings)&&!q(P,T.bools)&&!Array.isArray(f)&&(cs(f)&&s["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${f}`)))||!z(f)&&q(P,T.numbers))&&(f=Number(f)),f}function X(P){const f=Object.create(null);xe(f,T.aliases,l),Object.keys(T.configs).forEach(function(u){const c=P[u]||f[u];if(c)try{let p=null;const L=Ee.resolve(Ee.cwd(),c),S=T.configs[u];if(typeof S=="function"){try{p=S(L)}catch(C){p=C}if(p instanceof Error){h=p;return}}else p=Ee.require(L);$(p)}catch(p){p.name==="PermissionDenied"?h=p:P[u]&&(h=Error(_("Invalid JSON config file: %s",c)))}})}function $(P,f){Object.keys(P).forEach(function(u){const c=P[u],p=f?f+"."+u:u;typeof c=="object"&&c!==null&&!Array.isArray(c)&&s["dot-notation"]?$(c,p):(!Z(A,p.split("."))||q(p,T.arrays)&&s["combine-arrays"])&&B(p,c)})}function Y(){typeof d<"u"&&d.forEach(function(P){$(P)})}function H(P,f){if(typeof g>"u")return;const u=typeof g=="string"?g:"",c=Ee.env();Object.keys(c).forEach(function(p){if(u===""||p.lastIndexOf(u,0)===0){const L=p.split("__").map(function(S,C){return C===0&&(S=S.substring(u.length)),ze(S)});(f&&T.configs[L.join(".")]||!f)&&!Z(P,L)&&B(L.join("."),c[p])}})}function Ue(P){let f;const u=new Set;Object.keys(P).forEach(function(c){if(!u.has(c)&&(f=q(c,T.coercions),typeof f=="function"))try{const p=W(c,f(P[c]));[].concat(T.aliases[c]||[],c).forEach(L=>{u.add(L),P[L]=p})}catch(p){h=p}})}function Ae(P){return T.keys.forEach(f=>{~f.indexOf(".")||typeof P[f]>"u"&&(P[f]=void 0)}),P}function xe(P,f,u,c=!1){Object.keys(u).forEach(function(p){Z(P,p.split("."))||(te(P,p.split("."),u[p]),c&&(I[p]=!0),(f[p]||[]).forEach(function(L){Z(P,L.split("."))||te(P,L.split("."),u[p])}))})}function Z(P,f){let u=P;s["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(p){u=u[p]||{}});const c=f[f.length-1];return typeof u!="object"?!1:c in u}function te(P,f,u){let c=P;s["dot-notation"]||(f=[f.join(".")]),f.slice(0,-1).forEach(function(V){V=Xr(V),typeof c=="object"&&c[V]===void 0&&(c[V]={}),typeof c[V]!="object"||Array.isArray(c[V])?(Array.isArray(c[V])?c[V].push({}):c[V]=[c[V],{}],c=c[V][c[V].length-1]):c=c[V]});const p=Xr(f[f.length-1]),L=q(f.join("."),T.arrays),S=Array.isArray(u);let C=s["duplicate-arguments-array"];!C&&q(p,T.nargs)&&(C=!0,(!z(c[p])&&T.nargs[p]===1||Array.isArray(c[p])&&c[p].length===T.nargs[p])&&(c[p]=void 0)),u===lt()?c[p]=lt(c[p]):Array.isArray(c[p])?C&&L&&S?c[p]=s["flatten-duplicate-arrays"]?c[p].concat(u):(Array.isArray(c[p][0])?c[p]:[c[p]]).concat([u]):!C&&!!L==!!S?c[p]=u:c[p]=c[p].concat([u]):c[p]===void 0&&L?c[p]=S?u:[u]:C&&!(c[p]===void 0||q(p,T.counts)||q(p,T.bools))?c[p]=[c[p],u]:c[p]=u}function Me(...P){P.forEach(function(f){Object.keys(f||{}).forEach(function(u){T.aliases[u]||(T.aliases[u]=[].concat(i[u]||[]),T.aliases[u].concat(u).forEach(function(c){if(/-/.test(c)&&s["camel-case-expansion"]){const p=ze(c);p!==u&&T.aliases[u].indexOf(p)===-1&&(T.aliases[u].push(p),E[p]=!0)}}),T.aliases[u].concat(u).forEach(function(c){if(c.length>1&&/[A-Z]/.test(c)&&s["camel-case-expansion"]){const p=us(c,"-");p!==u&&T.aliases[u].indexOf(p)===-1&&(T.aliases[u].push(p),E[p]=!0)}}),T.aliases[u].forEach(function(c){T.aliases[c]=[u].concat(T.aliases[u].filter(function(p){return c!==p}))}))})})}function q(P,f){const u=[].concat(T.aliases[P]||[],P),c=Object.keys(f),p=u.find(L=>c.includes(L));return p?f[p]:!1}function be(P){const f=Object.keys(T);return[].concat(f.map(c=>T[c])).some(function(c){return Array.isArray(c)?c.includes(P):c[P]})}function Xe(P,...f){return[].concat(...f).some(function(c){const p=P.match(c);return p&&be(p[1])})}function N(P){if(P.match(x)||!P.match(/^-[^-]+/))return!1;let f=!0,u;const c=P.slice(1).split("");for(let p=0;p<c.length;p++){if(u=P.slice(p+2),!be(c[p])){f=!1;break}if(c[p+1]&&c[p+1]==="="||u==="-"||/[A-Za-z]/.test(c[p])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(u)||c[p+1]&&c[p+1].match(/\W/))break}return f}function b(P){return s["unknown-options-as-args"]&&R(P)}function R(P){return P=P.replace(/^-{3,}/,"--"),P.match(x)||N(P)?!1:!Xe(P,/^-+([^=]+?)=[\s\S]*$/,v,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function D(P){return!q(P,T.bools)&&!q(P,T.counts)&&`${P}`in l?l[P]:J(K(P))}function J(P){return{[ye.BOOLEAN]:!0,[ye.STRING]:"",[ye.NUMBER]:void 0,[ye.ARRAY]:[]}[P]}function K(P){let f=ye.BOOLEAN;return q(P,T.strings)?f=ye.STRING:q(P,T.numbers)?f=ye.NUMBER:q(P,T.bools)?f=ye.BOOLEAN:q(P,T.arrays)&&(f=ye.ARRAY),f}function z(P){return P===void 0}function oe(){Object.keys(T.counts).find(P=>q(P,T.arrays)?(h=Error(_("Invalid configuration: %s, opts.count excludes opts.array.",P)),!0):q(P,T.nargs)?(h=Error(_("Invalid configuration: %s, opts.count excludes opts.narg.",P)),!0):!1)}return{aliases:Object.assign({},T.aliases),argv:Object.assign(F,A),configuration:s,defaulted:Object.assign({},I),error:h,newAliases:Object.assign({},E)}}}function hs(e){const t=[],r=Object.create(null);let n=!0;for(Object.keys(e).forEach(function(a){t.push([].concat(e[a],a))});n;){n=!1;for(let a=0;a<t.length;a++)for(let o=a+1;o<t.length;o++)if(t[a].filter(function(s){return t[o].indexOf(s)!==-1}).length){t[a]=t[a].concat(t[o]),t.splice(o,1),n=!0;break}}return t.forEach(function(a){a=a.filter(function(i,s,l){return l.indexOf(i)===s});const o=a.pop();o!==void 0&&typeof o=="string"&&(r[o]=a)}),r}function lt(e){return e!==void 0?e+1:1}function Xr(e){return e==="__proto__"?"___proto___":e}function ps(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
21
60
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
22
61
  * CJS and ESM environments.
23
62
  *
24
63
  * @license
25
64
  * Copyright (c) 2016, Contributors
26
65
  * SPDX-License-Identifier: ISC
27
- */var jt,Ut,Xt;const tr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,er=(Ut=(jt=process==null?void 0:process.versions)===null||jt===void 0?void 0:jt.node)!==null&&Ut!==void 0?Ut:(Xt=process==null?void 0:process.version)===null||Xt===void 0?void 0:Xt.slice(1);if(er&&Number(er.match(/^([^.]+)/)[1])<tr)throw Error(`yargs parser supports a minimum Node.js version of ${tr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const ei=process?process.env:{};new Jn({cwd:process.cwd,env:()=>ei,format:Gr,normalize:Ln,resolve:Ce,require:u=>{if(typeof require<"u")return require(u);if(u.match(/\.json$/))return JSON.parse(Oe(u,"utf8"));throw Error("only .json config files are supported in ESM")}});const ri={fs:{readFileSync:Oe,writeFile:mn},format:Gr,resolve:Ce,exists:u=>{try{return yn(u).isFile()}catch{return!1}}};let lt;class ni{constructor(n){n=n||{},this.directory=n.directory||"./locales",this.updateFiles=typeof n.updateFiles=="boolean"?n.updateFiles:!0,this.locale=n.locale||"en",this.fallbackToLanguage=typeof n.fallbackToLanguage=="boolean"?n.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...n){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const c=n.shift();let a=function(){};return typeof n[n.length-1]=="function"&&(a=n.pop()),a=a||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][c]&&this.updateFiles?(this.cache[this.locale][c]=c,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:a})):a(),lt.format.apply(lt.format,[this.cache[this.locale][c]||c].concat(n))}__n(){const n=Array.prototype.slice.call(arguments),c=n.shift(),a=n.shift(),f=n.shift();let o=function(){};typeof n[n.length-1]=="function"&&(o=n.pop()),this.cache[this.locale]||this._readLocaleFile();let t=f===1?c:a;this.cache[this.locale][c]&&(t=this.cache[this.locale][c][f===1?"one":"other"]),!this.cache[this.locale][c]&&this.updateFiles?(this.cache[this.locale][c]={one:c,other:a},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();const i=[t];return~t.indexOf("%d")&&i.push(f),lt.format.apply(lt.format,i.concat(n))}setLocale(n){this.locale=n}getLocale(){return this.locale}updateLocale(n){this.cache[this.locale]||this._readLocaleFile();for(const c in n)Object.prototype.hasOwnProperty.call(n,c)&&(this.cache[this.locale][c]=n[c])}_taggedLiteral(n,...c){let a="";return n.forEach(function(f,o){const t=c[o+1];a+=f,typeof t<"u"&&(a+="%s")}),this.__.apply(this,[a].concat([].slice.call(c,1)))}_enqueueWrite(n){this.writeQueue.push(n),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const n=this,c=this.writeQueue[0],a=c.directory,f=c.locale,o=c.cb,t=this._resolveLocaleFile(a,f),i=JSON.stringify(this.cache[f],null,2);lt.fs.writeFile(t,i,"utf-8",function(m){n.writeQueue.shift(),n.writeQueue.length>0&&n._processWriteQueue(),o(m)})}_readLocaleFile(){let n={};const c=this._resolveLocaleFile(this.directory,this.locale);try{lt.fs.readFileSync&&(n=JSON.parse(lt.fs.readFileSync(c,"utf-8")))}catch(a){if(a instanceof SyntaxError&&(a.message="syntax error in "+c),a.code==="ENOENT")n={};else throw a}this.cache[this.locale]=n}_resolveLocaleFile(n,c){let a=lt.resolve(n,"./",c+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(a)&&~c.lastIndexOf("_")){const f=lt.resolve(n,"./",c.split("_")[0]+".json");this._fileExistsSync(f)&&(a=f)}return a}_fileExistsSync(n){return lt.exists(n)}}function ii(u,n){lt=n;const c=new ni(u);return{__:c.__.bind(c),__n:c.__n.bind(c),setLocale:c.setLocale.bind(c),getLocale:c.getLocale.bind(c),updateLocale:c.updateLocale.bind(c),locale:c.locale}}const oi=u=>ii(u,ri);let Ot;try{Ot=_n(import.meta.url)}catch{Ot=process.cwd()}const si=Ot.substring(0,Ot.lastIndexOf("node_modules"));si||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,oi({directory:Ce(Ot,"../../../locales"),updateFiles:!1});var qt={},rr;function _e(){return rr||(rr=1,function(){qt.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:`
28
- `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(G)),qt}var kt={},dt={},mt={},nr;function yt(){return nr||(nr=1,function(){var u,n,c,a,f,o,t,i=[].slice,m={}.hasOwnProperty;u=function(){var N,w,y,b,x,O;if(O=arguments[0],x=2<=arguments.length?i.call(arguments,1):[],f(Object.assign))Object.assign.apply(null,arguments);else for(N=0,y=x.length;N<y;N++)if(b=x[N],b!=null)for(w in b)m.call(b,w)&&(O[w]=b[w]);return O},f=function(N){return!!N&&Object.prototype.toString.call(N)==="[object Function]"},o=function(N){var w;return!!N&&((w=typeof N)=="function"||w==="object")},c=function(N){return f(Array.isArray)?Array.isArray(N):Object.prototype.toString.call(N)==="[object Array]"},a=function(N){var w;if(c(N))return!N.length;for(w in N)if(m.call(N,w))return!1;return!0},t=function(N){var w,y;return o(N)&&(y=Object.getPrototypeOf(N))&&(w=y.constructor)&&typeof w=="function"&&w instanceof w&&Function.prototype.toString.call(w)===Function.prototype.toString.call(Object)},n=function(N){return f(N.valueOf)?N.valueOf():N},mt.assign=u,mt.isFunction=f,mt.isObject=o,mt.isArray=c,mt.isEmpty=a,mt.isPlainObject=t,mt.getValue=n}.call(G)),mt}var Vt={exports:{}},ir;function sn(){return ir||(ir=1,function(){Vt.exports=function(){function u(){}return u.prototype.hasFeature=function(n,c){return!0},u.prototype.createDocumentType=function(n,c,a){throw new Error("This DOM method is not implemented.")},u.prototype.createDocument=function(n,c,a){throw new Error("This DOM method is not implemented.")},u.prototype.createHTMLDocument=function(n){throw new Error("This DOM method is not implemented.")},u.prototype.getFeature=function(n,c){throw new Error("This DOM method is not implemented.")},u}()}.call(G)),Vt.exports}var $t={exports:{}},Wt={exports:{}},Ht={exports:{}},or;function ai(){return or||(or=1,function(){Ht.exports=function(){function u(){}return u.prototype.handleError=function(n){throw new Error(n)},u}()}.call(G)),Ht.exports}var Gt={exports:{}},sr;function ui(){return sr||(sr=1,function(){Gt.exports=function(){function u(n){this.arr=n||[]}return Object.defineProperty(u.prototype,"length",{get:function(){return this.arr.length}}),u.prototype.item=function(n){return this.arr[n]||null},u.prototype.contains=function(n){return this.arr.indexOf(n)!==-1},u}()}.call(G)),Gt.exports}var ar;function ci(){return ar||(ar=1,function(){var u,n;u=ai(),n=ui(),Wt.exports=function(){function c(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new u,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(c.prototype,"parameterNames",{get:function(){return new n(Object.keys(this.defaultParams))}}),c.prototype.getParameter=function(a){return this.params.hasOwnProperty(a)?this.params[a]:null},c.prototype.canSetParameter=function(a,f){return!0},c.prototype.setParameter=function(a,f){return f!=null?this.params[a]=f:delete this.params[a]},c}()}.call(G)),Wt.exports}var Yt={exports:{}},zt={exports:{}},Kt={exports:{}},ur;function ot(){return ur||(ur=1,function(){Kt.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(G)),Kt.exports}var Qt={exports:{}},cr;function an(){return cr||(cr=1,function(){var u;u=ot(),ct(),Qt.exports=function(){function n(c,a,f){if(this.parent=c,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),a==null)throw new Error("Missing attribute name. "+this.debugInfo(a));this.name=this.stringify.name(a),this.value=this.stringify.attValue(f),this.type=u.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(n.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(n.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(n.prototype,"textContent",{get:function(){return this.value},set:function(c){return this.value=c||""}}),Object.defineProperty(n.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(n.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(n.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(n.prototype,"specified",{get:function(){return!0}}),n.prototype.clone=function(){return Object.create(this)},n.prototype.toString=function(c){return this.options.writer.attribute(this,this.options.writer.filterOptions(c))},n.prototype.debugInfo=function(c){return c=c||this.name,c==null?"parent: <"+this.parent.name+">":"attribute: {"+c+"}, parent: <"+this.parent.name+">"},n.prototype.isEqualNode=function(c){return!(c.namespaceURI!==this.namespaceURI||c.prefix!==this.prefix||c.localName!==this.localName||c.value!==this.value)},n}()}.call(G)),Qt.exports}var Jt={exports:{}},lr;function Me(){return lr||(lr=1,function(){Jt.exports=function(){function u(n){this.nodes=n}return Object.defineProperty(u.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),u.prototype.clone=function(){return this.nodes=null},u.prototype.getNamedItem=function(n){return this.nodes[n]},u.prototype.setNamedItem=function(n){var c;return c=this.nodes[n.nodeName],this.nodes[n.nodeName]=n,c||null},u.prototype.removeNamedItem=function(n){var c;return c=this.nodes[n],delete this.nodes[n],c||null},u.prototype.item=function(n){return this.nodes[Object.keys(this.nodes)[n]]||null},u.prototype.getNamedItemNS=function(n,c){throw new Error("This DOM method is not implemented.")},u.prototype.setNamedItemNS=function(n){throw new Error("This DOM method is not implemented.")},u.prototype.removeNamedItemNS=function(n,c){throw new Error("This DOM method is not implemented.")},u}()}.call(G)),Jt.exports}var fr;function Pe(){return fr||(fr=1,function(){var u,n,c,a,f,o,t,i,m=function(w,y){for(var b in y)N.call(y,b)&&(w[b]=y[b]);function x(){this.constructor=w}return x.prototype=y.prototype,w.prototype=new x,w.__super__=y.prototype,w},N={}.hasOwnProperty;i=yt(),t=i.isObject,o=i.isFunction,f=i.getValue,a=ct(),u=ot(),n=an(),c=Me(),zt.exports=function(w){m(y,w);function y(b,x,O){var _,E,D,T;if(y.__super__.constructor.call(this,b),x==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(x),this.type=u.Element,this.attribs={},this.schemaTypeInfo=null,O!=null&&this.attribute(O),b.type===u.Document&&(this.isRoot=!0,this.documentObject=b,b.rootObject=this,b.children)){for(T=b.children,E=0,D=T.length;E<D;E++)if(_=T[E],_.type===u.DocType){_.name=this.name;break}}}return Object.defineProperty(y.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(y.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(y.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(y.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(y.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(y.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(y.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(y.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new c(this.attribs)),this.attributeMap}}),y.prototype.clone=function(){var b,x,O,_;O=Object.create(this),O.isRoot&&(O.documentObject=null),O.attribs={},_=this.attribs;for(x in _)N.call(_,x)&&(b=_[x],O.attribs[x]=b.clone());return O.children=[],this.children.forEach(function(E){var D;return D=E.clone(),D.parent=O,O.children.push(D)}),O},y.prototype.attribute=function(b,x){var O,_;if(b!=null&&(b=f(b)),t(b))for(O in b)N.call(b,O)&&(_=b[O],this.attribute(O,_));else o(x)&&(x=x.apply()),this.options.keepNullAttributes&&x==null?this.attribs[b]=new n(this,b,""):x!=null&&(this.attribs[b]=new n(this,b,x));return this},y.prototype.removeAttribute=function(b){var x,O,_;if(b==null)throw new Error("Missing attribute name. "+this.debugInfo());if(b=f(b),Array.isArray(b))for(O=0,_=b.length;O<_;O++)x=b[O],delete this.attribs[x];else delete this.attribs[b];return this},y.prototype.toString=function(b){return this.options.writer.element(this,this.options.writer.filterOptions(b))},y.prototype.att=function(b,x){return this.attribute(b,x)},y.prototype.a=function(b,x){return this.attribute(b,x)},y.prototype.getAttribute=function(b){return this.attribs.hasOwnProperty(b)?this.attribs[b].value:null},y.prototype.setAttribute=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getAttributeNode=function(b){return this.attribs.hasOwnProperty(b)?this.attribs[b]:null},y.prototype.setAttributeNode=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.removeAttributeNode=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getElementsByTagName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getAttributeNS=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setAttributeNS=function(b,x,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.removeAttributeNS=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getAttributeNodeNS=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setAttributeNodeNS=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getElementsByTagNameNS=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.hasAttribute=function(b){return this.attribs.hasOwnProperty(b)},y.prototype.hasAttributeNS=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setIdAttribute=function(b,x){return this.attribs.hasOwnProperty(b)?this.attribs[b].isId:x},y.prototype.setIdAttributeNS=function(b,x,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.setIdAttributeNode=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getElementsByTagName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getElementsByTagNameNS=function(b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.getElementsByClassName=function(b){throw new Error("This DOM method is not implemented."+this.debugInfo())},y.prototype.isEqualNode=function(b){var x,O,_;if(!y.__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(x=O=0,_=this.attribs.length-1;0<=_?O<=_:O>=_;x=0<=_?++O:--O)if(!this.attribs[x].isEqualNode(b.attribs[x]))return!1;return!0},y}(a)}.call(G)),zt.exports}var Zt={exports:{}},te={exports:{}},hr;function St(){return hr||(hr=1,function(){var u,n=function(a,f){for(var o in f)c.call(f,o)&&(a[o]=f[o]);function t(){this.constructor=a}return t.prototype=f.prototype,a.prototype=new t,a.__super__=f.prototype,a},c={}.hasOwnProperty;u=ct(),te.exports=function(a){n(f,a);function f(o){f.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(f.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(f.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(f.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),f.prototype.clone=function(){return Object.create(this)},f.prototype.substringData=function(o,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.insertData=function(o,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.deleteData=function(o,t){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.replaceData=function(o,t,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.isEqualNode=function(o){return!(!f.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},f}(u)}.call(G)),te.exports}var pr;function Fe(){return pr||(pr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;u=ot(),n=St(),Zt.exports=function(f){c(o,f);function o(t,i){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=u.CData,this.value=this.stringify.cdata(i)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(t){return this.options.writer.cdata(this,this.options.writer.filterOptions(t))},o}(n)}.call(G)),Zt.exports}var ee={exports:{}},dr;function Se(){return dr||(dr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;u=ot(),n=St(),ee.exports=function(f){c(o,f);function o(t,i){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=u.Comment,this.value=this.stringify.comment(i)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(t){return this.options.writer.comment(this,this.options.writer.filterOptions(t))},o}(n)}.call(G)),ee.exports}var re={exports:{}},mr;function Be(){return mr||(mr=1,function(){var u,n,c,a=function(o,t){for(var i in t)f.call(t,i)&&(o[i]=t[i]);function m(){this.constructor=o}return m.prototype=t.prototype,o.prototype=new m,o.__super__=t.prototype,o},f={}.hasOwnProperty;c=yt().isObject,n=ct(),u=ot(),re.exports=function(o){a(t,o);function t(i,m,N,w){var y;t.__super__.constructor.call(this,i),c(m)&&(y=m,m=y.version,N=y.encoding,w=y.standalone),m||(m="1.0"),this.type=u.Declaration,this.version=this.stringify.xmlVersion(m),N!=null&&(this.encoding=this.stringify.xmlEncoding(N)),w!=null&&(this.standalone=this.stringify.xmlStandalone(w))}return t.prototype.toString=function(i){return this.options.writer.declaration(this,this.options.writer.filterOptions(i))},t}(n)}.call(G)),re.exports}var ne={exports:{}},ie={exports:{}},yr;function Re(){return yr||(yr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;n=ct(),u=ot(),ie.exports=function(f){c(o,f);function o(t,i,m,N,w,y){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(m==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(i));if(!N)throw new Error("Missing DTD attribute type. "+this.debugInfo(i));if(!w)throw new Error("Missing DTD attribute default. "+this.debugInfo(i));if(w.indexOf("#")!==0&&(w="#"+w),!w.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(i));if(y&&!w.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(i));this.elementName=this.stringify.name(i),this.type=u.AttributeDeclaration,this.attributeName=this.stringify.name(m),this.attributeType=this.stringify.dtdAttType(N),y&&(this.defaultValue=this.stringify.dtdAttDefault(y)),this.defaultValueType=w}return o.prototype.toString=function(t){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(t))},o}(n)}.call(G)),ie.exports}var oe={exports:{}},gr;function je(){return gr||(gr=1,function(){var u,n,c,a=function(o,t){for(var i in t)f.call(t,i)&&(o[i]=t[i]);function m(){this.constructor=o}return m.prototype=t.prototype,o.prototype=new m,o.__super__=t.prototype,o},f={}.hasOwnProperty;c=yt().isObject,n=ct(),u=ot(),oe.exports=function(o){a(t,o);function t(i,m,N,w){if(t.__super__.constructor.call(this,i),N==null)throw new Error("Missing DTD entity name. "+this.debugInfo(N));if(w==null)throw new Error("Missing DTD entity value. "+this.debugInfo(N));if(this.pe=!!m,this.name=this.stringify.name(N),this.type=u.EntityDeclaration,!c(w))this.value=this.stringify.dtdEntityValue(w),this.internal=!0;else{if(!w.pubID&&!w.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(N));if(w.pubID&&!w.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(N));if(this.internal=!1,w.pubID!=null&&(this.pubID=this.stringify.dtdPubID(w.pubID)),w.sysID!=null&&(this.sysID=this.stringify.dtdSysID(w.sysID)),w.nData!=null&&(this.nData=this.stringify.dtdNData(w.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(N))}}return Object.defineProperty(t.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(t.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(t.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(t.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(t.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(t.prototype,"xmlVersion",{get:function(){return null}}),t.prototype.toString=function(i){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(i))},t}(n)}.call(G)),oe.exports}var se={exports:{}},wr;function Ue(){return wr||(wr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;n=ct(),u=ot(),se.exports=function(f){c(o,f);function o(t,i,m){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing DTD element name. "+this.debugInfo());m||(m="(#PCDATA)"),Array.isArray(m)&&(m="("+m.join(",")+")"),this.name=this.stringify.name(i),this.type=u.ElementDeclaration,this.value=this.stringify.dtdElementValue(m)}return o.prototype.toString=function(t){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(t))},o}(n)}.call(G)),se.exports}var ae={exports:{}},br;function Xe(){return br||(br=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;n=ct(),u=ot(),ae.exports=function(f){c(o,f);function o(t,i,m){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing DTD notation name. "+this.debugInfo(i));if(!m.pubID&&!m.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(i));this.name=this.stringify.name(i),this.type=u.NotationDeclaration,m.pubID!=null&&(this.pubID=this.stringify.dtdPubID(m.pubID)),m.sysID!=null&&(this.sysID=this.stringify.dtdSysID(m.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(t){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(t))},o}(n)}.call(G)),ae.exports}var Er;function qe(){return Er||(Er=1,function(){var u,n,c,a,f,o,t,i,m=function(w,y){for(var b in y)N.call(y,b)&&(w[b]=y[b]);function x(){this.constructor=w}return x.prototype=y.prototype,w.prototype=new x,w.__super__=y.prototype,w},N={}.hasOwnProperty;i=yt().isObject,t=ct(),u=ot(),n=Re(),a=je(),c=Ue(),f=Xe(),o=Me(),ne.exports=function(w){m(y,w);function y(b,x,O){var _,E,D,T,p,I;if(y.__super__.constructor.call(this,b),this.type=u.DocType,b.children){for(T=b.children,E=0,D=T.length;E<D;E++)if(_=T[E],_.type===u.Element){this.name=_.name;break}}this.documentObject=b,i(x)&&(p=x,x=p.pubID,O=p.sysID),O==null&&(I=[x,O],O=I[0],x=I[1]),x!=null&&(this.pubID=this.stringify.dtdPubID(x)),O!=null&&(this.sysID=this.stringify.dtdSysID(O))}return Object.defineProperty(y.prototype,"entities",{get:function(){var b,x,O,_,E;for(_={},E=this.children,x=0,O=E.length;x<O;x++)b=E[x],b.type===u.EntityDeclaration&&!b.pe&&(_[b.name]=b);return new o(_)}}),Object.defineProperty(y.prototype,"notations",{get:function(){var b,x,O,_,E;for(_={},E=this.children,x=0,O=E.length;x<O;x++)b=E[x],b.type===u.NotationDeclaration&&(_[b.name]=b);return new o(_)}}),Object.defineProperty(y.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(y.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(y.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),y.prototype.element=function(b,x){var O;return O=new c(this,b,x),this.children.push(O),this},y.prototype.attList=function(b,x,O,_,E){var D;return D=new n(this,b,x,O,_,E),this.children.push(D),this},y.prototype.entity=function(b,x){var O;return O=new a(this,!1,b,x),this.children.push(O),this},y.prototype.pEntity=function(b,x){var O;return O=new a(this,!0,b,x),this.children.push(O),this},y.prototype.notation=function(b,x){var O;return O=new f(this,b,x),this.children.push(O),this},y.prototype.toString=function(b){return this.options.writer.docType(this,this.options.writer.filterOptions(b))},y.prototype.ele=function(b,x){return this.element(b,x)},y.prototype.att=function(b,x,O,_,E){return this.attList(b,x,O,_,E)},y.prototype.ent=function(b,x){return this.entity(b,x)},y.prototype.pent=function(b,x){return this.pEntity(b,x)},y.prototype.not=function(b,x){return this.notation(b,x)},y.prototype.up=function(){return this.root()||this.documentObject},y.prototype.isEqualNode=function(b){return!(!y.__super__.isEqualNode.apply(this,arguments).isEqualNode(b)||b.name!==this.name||b.publicId!==this.publicId||b.systemId!==this.systemId)},y}(t)}.call(G)),ne.exports}var ue={exports:{}},Tr;function ke(){return Tr||(Tr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;u=ot(),n=ct(),ue.exports=function(f){c(o,f);function o(t,i){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=u.Raw,this.value=this.stringify.raw(i)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(t){return this.options.writer.raw(this,this.options.writer.filterOptions(t))},o}(n)}.call(G)),ue.exports}var ce={exports:{}},xr;function Ve(){return xr||(xr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;u=ot(),n=St(),ce.exports=function(f){c(o,f);function o(t,i){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=u.Text,this.value=this.stringify.text(i)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var t,i,m;for(m="",i=this.previousSibling;i;)m=i.data+m,i=i.previousSibling;for(m+=this.data,t=this.nextSibling;t;)m=m+t.data,t=t.nextSibling;return m}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(t){return this.options.writer.text(this,this.options.writer.filterOptions(t))},o.prototype.splitText=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},o}(n)}.call(G)),ce.exports}var le={exports:{}},Dr;function $e(){return Dr||(Dr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;u=ot(),n=St(),le.exports=function(f){c(o,f);function o(t,i,m){if(o.__super__.constructor.call(this,t),i==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=u.ProcessingInstruction,this.target=this.stringify.insTarget(i),this.name=this.target,m&&(this.value=this.stringify.insValue(m))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(t){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(t))},o.prototype.isEqualNode=function(t){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)||t.target!==this.target)},o}(n)}.call(G)),le.exports}var fe={exports:{}},vr;function un(){return vr||(vr=1,function(){var u,n,c=function(f,o){for(var t in o)a.call(o,t)&&(f[t]=o[t]);function i(){this.constructor=f}return i.prototype=o.prototype,f.prototype=new i,f.__super__=o.prototype,f},a={}.hasOwnProperty;n=ct(),u=ot(),fe.exports=function(f){c(o,f);function o(t){o.__super__.constructor.call(this,t),this.type=u.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(t){return""},o}(n)}.call(G)),fe.exports}var he={exports:{}},Ir;function li(){return Ir||(Ir=1,function(){he.exports=function(){function u(n){this.nodes=n}return Object.defineProperty(u.prototype,"length",{get:function(){return this.nodes.length||0}}),u.prototype.clone=function(){return this.nodes=null},u.prototype.item=function(n){return this.nodes[n]||null},u}()}.call(G)),he.exports}var pe={exports:{}},Nr;function fi(){return Nr||(Nr=1,function(){pe.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(G)),pe.exports}var Or;function ct(){return Or||(Or=1,function(){var u,n,c,a,f,o,t,i,m,N,w,y,b,x,O,_,E,D={}.hasOwnProperty;E=yt(),_=E.isObject,O=E.isFunction,x=E.isEmpty,b=E.getValue,i=null,c=null,a=null,f=null,o=null,w=null,y=null,N=null,t=null,n=null,m=null,u=null,Yt.exports=function(){function T(p){this.parent=p,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,i||(i=Pe(),c=Fe(),a=Se(),f=Be(),o=qe(),w=ke(),y=Ve(),N=$e(),t=un(),n=ot(),m=li(),Me(),u=fi())}return Object.defineProperty(T.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(T.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(T.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(T.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(T.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new m(this.children)),this.childNodeList}}),Object.defineProperty(T.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(T.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(T.prototype,"previousSibling",{get:function(){var p;return p=this.parent.children.indexOf(this),this.parent.children[p-1]||null}}),Object.defineProperty(T.prototype,"nextSibling",{get:function(){var p;return p=this.parent.children.indexOf(this),this.parent.children[p+1]||null}}),Object.defineProperty(T.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(T.prototype,"textContent",{get:function(){var p,I,A,j,U;if(this.nodeType===n.Element||this.nodeType===n.DocumentFragment){for(U="",j=this.children,I=0,A=j.length;I<A;I++)p=j[I],p.textContent&&(U+=p.textContent);return U}else return null},set:function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),T.prototype.setParent=function(p){var I,A,j,U,B;for(this.parent=p,p&&(this.options=p.options,this.stringify=p.stringify),U=this.children,B=[],A=0,j=U.length;A<j;A++)I=U[A],B.push(I.setParent(this));return B},T.prototype.element=function(p,I,A){var j,U,B,h,F,R,X,$,Y,J,z;if(R=null,I===null&&A==null&&(Y=[{},null],I=Y[0],A=Y[1]),I==null&&(I={}),I=b(I),_(I)||(J=[I,A],A=J[0],I=J[1]),p!=null&&(p=b(p)),Array.isArray(p))for(B=0,X=p.length;B<X;B++)U=p[B],R=this.element(U);else if(O(p))R=this.element(p.apply());else if(_(p)){for(F in p)if(D.call(p,F))if(z=p[F],O(z)&&(z=z.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&F.indexOf(this.stringify.convertAttKey)===0)R=this.attribute(F.substr(this.stringify.convertAttKey.length),z);else if(!this.options.separateArrayItems&&Array.isArray(z)&&x(z))R=this.dummy();else if(_(z)&&x(z))R=this.element(F);else if(!this.options.keepNullNodes&&z==null)R=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(z))for(h=0,$=z.length;h<$;h++)U=z[h],j={},j[F]=U,R=this.element(j);else _(z)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&F.indexOf(this.stringify.convertTextKey)===0?R=this.element(z):(R=this.element(F),R.element(z)):R=this.element(F,z)}else!this.options.keepNullNodes&&A===null?R=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&p.indexOf(this.stringify.convertTextKey)===0?R=this.text(A):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&p.indexOf(this.stringify.convertCDataKey)===0?R=this.cdata(A):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&p.indexOf(this.stringify.convertCommentKey)===0?R=this.comment(A):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&p.indexOf(this.stringify.convertRawKey)===0?R=this.raw(A):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&p.indexOf(this.stringify.convertPIKey)===0?R=this.instruction(p.substr(this.stringify.convertPIKey.length),A):R=this.node(p,I,A);if(R==null)throw new Error("Could not create any elements with: "+p+". "+this.debugInfo());return R},T.prototype.insertBefore=function(p,I,A){var j,U,B,h,F;if(p?.type)return B=p,h=I,B.setParent(this),h?(U=children.indexOf(h),F=children.splice(U),children.push(B),Array.prototype.push.apply(children,F)):children.push(B),B;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(p));return U=this.parent.children.indexOf(this),F=this.parent.children.splice(U),j=this.parent.element(p,I,A),Array.prototype.push.apply(this.parent.children,F),j},T.prototype.insertAfter=function(p,I,A){var j,U,B;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(p));return U=this.parent.children.indexOf(this),B=this.parent.children.splice(U+1),j=this.parent.element(p,I,A),Array.prototype.push.apply(this.parent.children,B),j},T.prototype.remove=function(){var p;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return p=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[p,p-p+1].concat([])),this.parent},T.prototype.node=function(p,I,A){var j,U;return p!=null&&(p=b(p)),I||(I={}),I=b(I),_(I)||(U=[I,A],A=U[0],I=U[1]),j=new i(this,p,I),A!=null&&j.text(A),this.children.push(j),j},T.prototype.text=function(p){var I;return _(p)&&this.element(p),I=new y(this,p),this.children.push(I),this},T.prototype.cdata=function(p){var I;return I=new c(this,p),this.children.push(I),this},T.prototype.comment=function(p){var I;return I=new a(this,p),this.children.push(I),this},T.prototype.commentBefore=function(p){var I,A;return I=this.parent.children.indexOf(this),A=this.parent.children.splice(I),this.parent.comment(p),Array.prototype.push.apply(this.parent.children,A),this},T.prototype.commentAfter=function(p){var I,A;return I=this.parent.children.indexOf(this),A=this.parent.children.splice(I+1),this.parent.comment(p),Array.prototype.push.apply(this.parent.children,A),this},T.prototype.raw=function(p){var I;return I=new w(this,p),this.children.push(I),this},T.prototype.dummy=function(){var p;return p=new t(this),p},T.prototype.instruction=function(p,I){var A,j,U,B,h;if(p!=null&&(p=b(p)),I!=null&&(I=b(I)),Array.isArray(p))for(B=0,h=p.length;B<h;B++)A=p[B],this.instruction(A);else if(_(p))for(A in p)D.call(p,A)&&(j=p[A],this.instruction(A,j));else O(I)&&(I=I.apply()),U=new N(this,p,I),this.children.push(U);return this},T.prototype.instructionBefore=function(p,I){var A,j;return A=this.parent.children.indexOf(this),j=this.parent.children.splice(A),this.parent.instruction(p,I),Array.prototype.push.apply(this.parent.children,j),this},T.prototype.instructionAfter=function(p,I){var A,j;return A=this.parent.children.indexOf(this),j=this.parent.children.splice(A+1),this.parent.instruction(p,I),Array.prototype.push.apply(this.parent.children,j),this},T.prototype.declaration=function(p,I,A){var j,U;return j=this.document(),U=new f(j,p,I,A),j.children.length===0?j.children.unshift(U):j.children[0].type===n.Declaration?j.children[0]=U:j.children.unshift(U),j.root()||j},T.prototype.dtd=function(p,I){var A,j,U,B,h,F,R,X,$,Y;for(j=this.document(),U=new o(j,p,I),$=j.children,B=h=0,R=$.length;h<R;B=++h)if(A=$[B],A.type===n.DocType)return j.children[B]=U,U;for(Y=j.children,B=F=0,X=Y.length;F<X;B=++F)if(A=Y[B],A.isRoot)return j.children.splice(B,0,U),U;return j.children.push(U),U},T.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},T.prototype.root=function(){var p;for(p=this;p;){if(p.type===n.Document)return p.rootObject;if(p.isRoot)return p;p=p.parent}},T.prototype.document=function(){var p;for(p=this;p;){if(p.type===n.Document)return p;p=p.parent}},T.prototype.end=function(p){return this.document().end(p)},T.prototype.prev=function(){var p;if(p=this.parent.children.indexOf(this),p<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[p-1]},T.prototype.next=function(){var p;if(p=this.parent.children.indexOf(this),p===-1||p===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[p+1]},T.prototype.importDocument=function(p){var I;return I=p.root().clone(),I.parent=this,I.isRoot=!1,this.children.push(I),this},T.prototype.debugInfo=function(p){var I,A;return p=p||this.name,p==null&&!((I=this.parent)!=null&&I.name)?"":p==null?"parent: <"+this.parent.name+">":(A=this.parent)!=null&&A.name?"node: <"+p+">, parent: <"+this.parent.name+">":"node: <"+p+">"},T.prototype.ele=function(p,I,A){return this.element(p,I,A)},T.prototype.nod=function(p,I,A){return this.node(p,I,A)},T.prototype.txt=function(p){return this.text(p)},T.prototype.dat=function(p){return this.cdata(p)},T.prototype.com=function(p){return this.comment(p)},T.prototype.ins=function(p,I){return this.instruction(p,I)},T.prototype.doc=function(){return this.document()},T.prototype.dec=function(p,I,A){return this.declaration(p,I,A)},T.prototype.e=function(p,I,A){return this.element(p,I,A)},T.prototype.n=function(p,I,A){return this.node(p,I,A)},T.prototype.t=function(p){return this.text(p)},T.prototype.d=function(p){return this.cdata(p)},T.prototype.c=function(p){return this.comment(p)},T.prototype.r=function(p){return this.raw(p)},T.prototype.i=function(p,I){return this.instruction(p,I)},T.prototype.u=function(){return this.up()},T.prototype.importXMLBuilder=function(p){return this.importDocument(p)},T.prototype.replaceChild=function(p,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.removeChild=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.appendChild=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.hasChildNodes=function(){return this.children.length!==0},T.prototype.cloneNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.isSupported=function(p,I){return!0},T.prototype.hasAttributes=function(){return this.attribs.length!==0},T.prototype.compareDocumentPosition=function(p){var I,A;return I=this,I===p?0:this.document()!==p.document()?(A=u.Disconnected|u.ImplementationSpecific,Math.random()<.5?A|=u.Preceding:A|=u.Following,A):I.isAncestor(p)?u.Contains|u.Preceding:I.isDescendant(p)?u.Contains|u.Following:I.isPreceding(p)?u.Preceding:u.Following},T.prototype.isSameNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.lookupPrefix=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.isDefaultNamespace=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.lookupNamespaceURI=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.isEqualNode=function(p){var I,A,j;if(p.nodeType!==this.nodeType||p.children.length!==this.children.length)return!1;for(I=A=0,j=this.children.length-1;0<=j?A<=j:A>=j;I=0<=j?++A:--A)if(!this.children[I].isEqualNode(p.children[I]))return!1;return!0},T.prototype.getFeature=function(p,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.setUserData=function(p,I,A){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.getUserData=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.contains=function(p){return p?p===this||this.isDescendant(p):!1},T.prototype.isDescendant=function(p){var I,A,j,U,B;for(B=this.children,j=0,U=B.length;j<U;j++)if(I=B[j],p===I||(A=I.isDescendant(p),A))return!0;return!1},T.prototype.isAncestor=function(p){return p.isDescendant(this)},T.prototype.isPreceding=function(p){var I,A;return I=this.treePosition(p),A=this.treePosition(this),I===-1||A===-1?!1:I<A},T.prototype.isFollowing=function(p){var I,A;return I=this.treePosition(p),A=this.treePosition(this),I===-1||A===-1?!1:I>A},T.prototype.treePosition=function(p){var I,A;return A=0,I=!1,this.foreachTreeNode(this.document(),function(j){if(A++,!I&&j===p)return I=!0}),I?A:-1},T.prototype.foreachTreeNode=function(p,I){var A,j,U,B,h;for(p||(p=this.document()),B=p.children,j=0,U=B.length;j<U;j++){if(A=B[j],h=I(A))return h;if(h=this.foreachTreeNode(A,I),h)return h}},T}()}.call(G)),Yt.exports}var de={exports:{}},Cr;function cn(){return Cr||(Cr=1,function(){var u=function(c,a){return function(){return c.apply(a,arguments)}},n={}.hasOwnProperty;de.exports=function(){function c(a){this.assertLegalName=u(this.assertLegalName,this),this.assertLegalChar=u(this.assertLegalChar,this);var f,o,t;a||(a={}),this.options=a,this.options.version||(this.options.version="1.0"),o=a.stringify||{};for(f in o)n.call(o,f)&&(t=o[f],this[f]=t)}return c.prototype.name=function(a){return this.options.noValidation?a:this.assertLegalName(""+a||"")},c.prototype.text=function(a){return this.options.noValidation?a:this.assertLegalChar(this.textEscape(""+a||""))},c.prototype.cdata=function(a){return this.options.noValidation?a:(a=""+a||"",a=a.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(a))},c.prototype.comment=function(a){if(this.options.noValidation)return a;if(a=""+a||"",a.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+a);return this.assertLegalChar(a)},c.prototype.raw=function(a){return this.options.noValidation?a:""+a||""},c.prototype.attValue=function(a){return this.options.noValidation?a:this.assertLegalChar(this.attEscape(a=""+a||""))},c.prototype.insTarget=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.insValue=function(a){if(this.options.noValidation)return a;if(a=""+a||"",a.match(/\?>/))throw new Error("Invalid processing instruction value: "+a);return this.assertLegalChar(a)},c.prototype.xmlVersion=function(a){if(this.options.noValidation)return a;if(a=""+a||"",!a.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+a);return a},c.prototype.xmlEncoding=function(a){if(this.options.noValidation)return a;if(a=""+a||"",!a.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+a);return this.assertLegalChar(a)},c.prototype.xmlStandalone=function(a){return this.options.noValidation?a:a?"yes":"no"},c.prototype.dtdPubID=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.dtdSysID=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.dtdElementValue=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.dtdAttType=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.dtdAttDefault=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.dtdEntityValue=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.dtdNData=function(a){return this.options.noValidation?a:this.assertLegalChar(""+a||"")},c.prototype.convertAttKey="@",c.prototype.convertPIKey="?",c.prototype.convertTextKey="#text",c.prototype.convertCDataKey="#cdata",c.prototype.convertCommentKey="#comment",c.prototype.convertRawKey="#raw",c.prototype.assertLegalChar=function(a){var f,o;if(this.options.noValidation)return a;if(f="",this.options.version==="1.0"){if(f=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=a.match(f))throw new Error("Invalid character in string: "+a+" at index "+o.index)}else if(this.options.version==="1.1"&&(f=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=a.match(f)))throw new Error("Invalid character in string: "+a+" at index "+o.index);return a},c.prototype.assertLegalName=function(a){var f;if(this.options.noValidation)return a;if(this.assertLegalChar(a),f=/^([: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])*$/,!a.match(f))throw new Error("Invalid character in name");return a},c.prototype.textEscape=function(a){var f;return this.options.noValidation?a:(f=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,a.replace(f,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},c.prototype.attEscape=function(a){var f;return this.options.noValidation?a:(f=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,a.replace(f,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},c}()}.call(G)),de.exports}var me={exports:{}},ye={exports:{}},ge={exports:{}},Ar;function Bt(){return Ar||(Ar=1,function(){ge.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(G)),ge.exports}var Lr;function ln(){return Lr||(Lr=1,function(){var u,n,c,a={}.hasOwnProperty;c=yt().assign,u=ot(),Be(),qe(),Fe(),Se(),Pe(),ke(),Ve(),$e(),un(),Re(),Ue(),je(),Xe(),n=Bt(),ye.exports=function(){function f(o){var t,i,m;o||(o={}),this.options=o,i=o.writer||{};for(t in i)a.call(i,t)&&(m=i[t],this["_"+t]=this[t],this[t]=m)}return f.prototype.filterOptions=function(o){var t,i,m,N,w,y,b,x;return o||(o={}),o=c({},this.options,o),t={writer:this},t.pretty=o.pretty||!1,t.allowEmpty=o.allowEmpty||!1,t.indent=(i=o.indent)!=null?i:" ",t.newline=(m=o.newline)!=null?m:`
29
- `,t.offset=(N=o.offset)!=null?N:0,t.dontPrettyTextNodes=(w=(y=o.dontPrettyTextNodes)!=null?y:o.dontprettytextnodes)!=null?w:0,t.spaceBeforeSlash=(b=(x=o.spaceBeforeSlash)!=null?x:o.spacebeforeslash)!=null?b:"",t.spaceBeforeSlash===!0&&(t.spaceBeforeSlash=" "),t.suppressPrettyCount=0,t.user={},t.state=n.None,t},f.prototype.indent=function(o,t,i){var m;return!t.pretty||t.suppressPrettyCount?"":t.pretty&&(m=(i||0)+t.offset+1,m>0)?new Array(m).join(t.indent):""},f.prototype.endline=function(o,t,i){return!t.pretty||t.suppressPrettyCount?"":t.newline},f.prototype.attribute=function(o,t,i){var m;return this.openAttribute(o,t,i),m=" "+o.name+'="'+o.value+'"',this.closeAttribute(o,t,i),m},f.prototype.cdata=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<![CDATA[",t.state=n.InsideTag,m+=o.value,t.state=n.CloseTag,m+="]]>"+this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.comment=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<!-- ",t.state=n.InsideTag,m+=o.value,t.state=n.CloseTag,m+=" -->"+this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.declaration=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<?xml",t.state=n.InsideTag,m+=' version="'+o.version+'"',o.encoding!=null&&(m+=' encoding="'+o.encoding+'"'),o.standalone!=null&&(m+=' standalone="'+o.standalone+'"'),t.state=n.CloseTag,m+=t.spaceBeforeSlash+"?>",m+=this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.docType=function(o,t,i){var m,N,w,y,b;if(i||(i=0),this.openNode(o,t,i),t.state=n.OpenTag,y=this.indent(o,t,i),y+="<!DOCTYPE "+o.root().name,o.pubID&&o.sysID?y+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.sysID&&(y+=' SYSTEM "'+o.sysID+'"'),o.children.length>0){for(y+=" [",y+=this.endline(o,t,i),t.state=n.InsideTag,b=o.children,N=0,w=b.length;N<w;N++)m=b[N],y+=this.writeChildNode(m,t,i+1);t.state=n.CloseTag,y+="]"}return t.state=n.CloseTag,y+=t.spaceBeforeSlash+">",y+=this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),y},f.prototype.element=function(o,t,i){var m,N,w,y,b,x,O,_,E,D,T,p,I,A;i||(i=0),D=!1,T="",this.openNode(o,t,i),t.state=n.OpenTag,T+=this.indent(o,t,i)+"<"+o.name,p=o.attribs;for(E in p)a.call(p,E)&&(m=p[E],T+=this.attribute(m,t,i));if(w=o.children.length,y=w===0?null:o.children[0],w===0||o.children.every(function(j){return(j.type===u.Text||j.type===u.Raw)&&j.value===""}))t.allowEmpty?(T+=">",t.state=n.CloseTag,T+="</"+o.name+">"+this.endline(o,t,i)):(t.state=n.CloseTag,T+=t.spaceBeforeSlash+"/>"+this.endline(o,t,i));else if(t.pretty&&w===1&&(y.type===u.Text||y.type===u.Raw)&&y.value!=null)T+=">",t.state=n.InsideTag,t.suppressPrettyCount++,D=!0,T+=this.writeChildNode(y,t,i+1),t.suppressPrettyCount--,D=!1,t.state=n.CloseTag,T+="</"+o.name+">"+this.endline(o,t,i);else{if(t.dontPrettyTextNodes){for(I=o.children,b=0,O=I.length;b<O;b++)if(N=I[b],(N.type===u.Text||N.type===u.Raw)&&N.value!=null){t.suppressPrettyCount++,D=!0;break}}for(T+=">"+this.endline(o,t,i),t.state=n.InsideTag,A=o.children,x=0,_=A.length;x<_;x++)N=A[x],T+=this.writeChildNode(N,t,i+1);t.state=n.CloseTag,T+=this.indent(o,t,i)+"</"+o.name+">",D&&t.suppressPrettyCount--,T+=this.endline(o,t,i),t.state=n.None}return this.closeNode(o,t,i),T},f.prototype.writeChildNode=function(o,t,i){switch(o.type){case u.CData:return this.cdata(o,t,i);case u.Comment:return this.comment(o,t,i);case u.Element:return this.element(o,t,i);case u.Raw:return this.raw(o,t,i);case u.Text:return this.text(o,t,i);case u.ProcessingInstruction:return this.processingInstruction(o,t,i);case u.Dummy:return"";case u.Declaration:return this.declaration(o,t,i);case u.DocType:return this.docType(o,t,i);case u.AttributeDeclaration:return this.dtdAttList(o,t,i);case u.ElementDeclaration:return this.dtdElement(o,t,i);case u.EntityDeclaration:return this.dtdEntity(o,t,i);case u.NotationDeclaration:return this.dtdNotation(o,t,i);default:throw new Error("Unknown XML node type: "+o.constructor.name)}},f.prototype.processingInstruction=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<?",t.state=n.InsideTag,m+=o.target,o.value&&(m+=" "+o.value),t.state=n.CloseTag,m+=t.spaceBeforeSlash+"?>",m+=this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.raw=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i),t.state=n.InsideTag,m+=o.value,t.state=n.CloseTag,m+=this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.text=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i),t.state=n.InsideTag,m+=o.value,t.state=n.CloseTag,m+=this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.dtdAttList=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<!ATTLIST",t.state=n.InsideTag,m+=" "+o.elementName+" "+o.attributeName+" "+o.attributeType,o.defaultValueType!=="#DEFAULT"&&(m+=" "+o.defaultValueType),o.defaultValue&&(m+=' "'+o.defaultValue+'"'),t.state=n.CloseTag,m+=t.spaceBeforeSlash+">"+this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.dtdElement=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<!ELEMENT",t.state=n.InsideTag,m+=" "+o.name+" "+o.value,t.state=n.CloseTag,m+=t.spaceBeforeSlash+">"+this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.dtdEntity=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<!ENTITY",t.state=n.InsideTag,o.pe&&(m+=" %"),m+=" "+o.name,o.value?m+=' "'+o.value+'"':(o.pubID&&o.sysID?m+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.sysID&&(m+=' SYSTEM "'+o.sysID+'"'),o.nData&&(m+=" NDATA "+o.nData)),t.state=n.CloseTag,m+=t.spaceBeforeSlash+">"+this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.dtdNotation=function(o,t,i){var m;return this.openNode(o,t,i),t.state=n.OpenTag,m=this.indent(o,t,i)+"<!NOTATION",t.state=n.InsideTag,m+=" "+o.name,o.pubID&&o.sysID?m+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.pubID?m+=' PUBLIC "'+o.pubID+'"':o.sysID&&(m+=' SYSTEM "'+o.sysID+'"'),t.state=n.CloseTag,m+=t.spaceBeforeSlash+">"+this.endline(o,t,i),t.state=n.None,this.closeNode(o,t,i),m},f.prototype.openNode=function(o,t,i){},f.prototype.closeNode=function(o,t,i){},f.prototype.openAttribute=function(o,t,i){},f.prototype.closeAttribute=function(o,t,i){},f}()}.call(G)),ye.exports}var _r;function We(){return _r||(_r=1,function(){var u,n=function(a,f){for(var o in f)c.call(f,o)&&(a[o]=f[o]);function t(){this.constructor=a}return t.prototype=f.prototype,a.prototype=new t,a.__super__=f.prototype,a},c={}.hasOwnProperty;u=ln(),me.exports=function(a){n(f,a);function f(o){f.__super__.constructor.call(this,o)}return f.prototype.document=function(o,t){var i,m,N,w,y;for(t=this.filterOptions(t),w="",y=o.children,m=0,N=y.length;m<N;m++)i=y[m],w+=this.writeChildNode(i,t,0);return t.pretty&&w.slice(-t.newline.length)===t.newline&&(w=w.slice(0,-t.newline.length)),w},f}(u)}.call(G)),me.exports}var Mr;function fn(){return Mr||(Mr=1,function(){var u,n,c,a,f,o,t,i=function(N,w){for(var y in w)m.call(w,y)&&(N[y]=w[y]);function b(){this.constructor=N}return b.prototype=w.prototype,N.prototype=new b,N.__super__=w.prototype,N},m={}.hasOwnProperty;t=yt().isPlainObject,c=sn(),n=ci(),a=ct(),u=ot(),o=cn(),f=We(),$t.exports=function(N){i(w,N);function w(y){w.__super__.constructor.call(this,null),this.name="#document",this.type=u.Document,this.documentURI=null,this.domConfig=new n,y||(y={}),y.writer||(y.writer=new f),this.options=y,this.stringify=new o(y)}return Object.defineProperty(w.prototype,"implementation",{value:new c}),Object.defineProperty(w.prototype,"doctype",{get:function(){var y,b,x,O;for(O=this.children,b=0,x=O.length;b<x;b++)if(y=O[b],y.type===u.DocType)return y;return null}}),Object.defineProperty(w.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(w.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(w.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(w.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===u.Declaration?this.children[0].encoding:null}}),Object.defineProperty(w.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===u.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(w.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===u.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(w.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(w.prototype,"origin",{get:function(){return null}}),Object.defineProperty(w.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(w.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(w.prototype,"contentType",{get:function(){return null}}),w.prototype.end=function(y){var b;return b={},y?t(y)&&(b=y,y=this.options.writer):y=this.options.writer,y.document(this,y.filterOptions(b))},w.prototype.toString=function(y){return this.options.writer.document(this,this.options.writer.filterOptions(y))},w.prototype.createElement=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createTextNode=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createComment=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createCDATASection=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createProcessingInstruction=function(y,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createAttribute=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createEntityReference=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.getElementsByTagName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.importNode=function(y,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createElementNS=function(y,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createAttributeNS=function(y,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.getElementsByTagNameNS=function(y,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.getElementById=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.adoptNode=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.renameNode=function(y,b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.getElementsByClassName=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createEvent=function(y){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createNodeIterator=function(y,b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.createTreeWalker=function(y,b,x){throw new Error("This DOM method is not implemented."+this.debugInfo())},w}(a)}.call(G)),$t.exports}var we={exports:{}},Pr;function hi(){return Pr||(Pr=1,function(){var u,n,c,a,f,o,t,i,m,N,w,y,b,x,O,_,E,D,T,p,I,A,j,U={}.hasOwnProperty;j=yt(),I=j.isObject,p=j.isFunction,A=j.isPlainObject,T=j.getValue,u=ot(),y=fn(),b=Pe(),a=Fe(),f=Se(),O=ke(),D=Ve(),x=$e(),N=Be(),w=qe(),o=Re(),i=je(),t=Ue(),m=Xe(),c=an(),E=cn(),_=We(),n=Bt(),we.exports=function(){function B(h,F,R){var X;this.name="?xml",this.type=u.Document,h||(h={}),X={},h.writer?A(h.writer)&&(X=h.writer,h.writer=new _):h.writer=new _,this.options=h,this.writer=h.writer,this.writerOptions=this.writer.filterOptions(X),this.stringify=new E(h),this.onDataCallback=F||function(){},this.onEndCallback=R||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return B.prototype.createChildNode=function(h){var F,R,X,$,Y,J,z,W;switch(h.type){case u.CData:this.cdata(h.value);break;case u.Comment:this.comment(h.value);break;case u.Element:X={},z=h.attribs;for(R in z)U.call(z,R)&&(F=z[R],X[R]=F.value);this.node(h.name,X);break;case u.Dummy:this.dummy();break;case u.Raw:this.raw(h.value);break;case u.Text:this.text(h.value);break;case u.ProcessingInstruction:this.instruction(h.target,h.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+h.constructor.name)}for(W=h.children,Y=0,J=W.length;Y<J;Y++)$=W[Y],this.createChildNode($),$.type===u.Element&&this.up();return this},B.prototype.dummy=function(){return this},B.prototype.node=function(h,F,R){var X;if(h==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(h));return this.openCurrent(),h=T(h),F==null&&(F={}),F=T(F),I(F)||(X=[F,R],R=X[0],F=X[1]),this.currentNode=new b(this,h,F),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,R!=null&&this.text(R),this},B.prototype.element=function(h,F,R){var X,$,Y,J,z,W;if(this.currentNode&&this.currentNode.type===u.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(h)||I(h)||p(h))for(J=this.options.noValidation,this.options.noValidation=!0,W=new y(this.options).element("TEMP_ROOT"),W.element(h),this.options.noValidation=J,z=W.children,$=0,Y=z.length;$<Y;$++)X=z[$],this.createChildNode(X),X.type===u.Element&&this.up();else this.node(h,F,R);return this},B.prototype.attribute=function(h,F){var R,X;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(h));if(h!=null&&(h=T(h)),I(h))for(R in h)U.call(h,R)&&(X=h[R],this.attribute(R,X));else p(F)&&(F=F.apply()),this.options.keepNullAttributes&&F==null?this.currentNode.attribs[h]=new c(this,h,""):F!=null&&(this.currentNode.attribs[h]=new c(this,h,F));return this},B.prototype.text=function(h){var F;return this.openCurrent(),F=new D(this,h),this.onData(this.writer.text(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.cdata=function(h){var F;return this.openCurrent(),F=new a(this,h),this.onData(this.writer.cdata(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.comment=function(h){var F;return this.openCurrent(),F=new f(this,h),this.onData(this.writer.comment(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.raw=function(h){var F;return this.openCurrent(),F=new O(this,h),this.onData(this.writer.raw(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.instruction=function(h,F){var R,X,$,Y,J;if(this.openCurrent(),h!=null&&(h=T(h)),F!=null&&(F=T(F)),Array.isArray(h))for(R=0,Y=h.length;R<Y;R++)X=h[R],this.instruction(X);else if(I(h))for(X in h)U.call(h,X)&&($=h[X],this.instruction(X,$));else p(F)&&(F=F.apply()),J=new x(this,h,F),this.onData(this.writer.processingInstruction(J,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},B.prototype.declaration=function(h,F,R){var X;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return X=new N(this,h,F,R),this.onData(this.writer.declaration(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.doctype=function(h,F,R){if(this.openCurrent(),h==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 w(this,F,R),this.currentNode.rootNodeName=h,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},B.prototype.dtdElement=function(h,F){var R;return this.openCurrent(),R=new t(this,h,F),this.onData(this.writer.dtdElement(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.attList=function(h,F,R,X,$){var Y;return this.openCurrent(),Y=new o(this,h,F,R,X,$),this.onData(this.writer.dtdAttList(Y,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.entity=function(h,F){var R;return this.openCurrent(),R=new i(this,!1,h,F),this.onData(this.writer.dtdEntity(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.pEntity=function(h,F){var R;return this.openCurrent(),R=new i(this,!0,h,F),this.onData(this.writer.dtdEntity(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.prototype.notation=function(h,F){var R;return this.openCurrent(),R=new m(this,h,F),this.onData(this.writer.dtdNotation(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},B.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},B.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},B.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},B.prototype.openNode=function(h){var F,R,X,$;if(!h.isOpen){if(!this.root&&this.currentLevel===0&&h.type===u.Element&&(this.root=h),R="",h.type===u.Element){this.writerOptions.state=n.OpenTag,R=this.writer.indent(h,this.writerOptions,this.currentLevel)+"<"+h.name,$=h.attribs;for(X in $)U.call($,X)&&(F=$[X],R+=this.writer.attribute(F,this.writerOptions,this.currentLevel));R+=(h.children?">":"/>")+this.writer.endline(h,this.writerOptions,this.currentLevel),this.writerOptions.state=n.InsideTag}else this.writerOptions.state=n.OpenTag,R=this.writer.indent(h,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+h.rootNodeName,h.pubID&&h.sysID?R+=' PUBLIC "'+h.pubID+'" "'+h.sysID+'"':h.sysID&&(R+=' SYSTEM "'+h.sysID+'"'),h.children?(R+=" [",this.writerOptions.state=n.InsideTag):(this.writerOptions.state=n.CloseTag,R+=">"),R+=this.writer.endline(h,this.writerOptions,this.currentLevel);return this.onData(R,this.currentLevel),h.isOpen=!0}},B.prototype.closeNode=function(h){var F;if(!h.isClosed)return F="",this.writerOptions.state=n.CloseTag,h.type===u.Element?F=this.writer.indent(h,this.writerOptions,this.currentLevel)+"</"+h.name+">"+this.writer.endline(h,this.writerOptions,this.currentLevel):F=this.writer.indent(h,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(h,this.writerOptions,this.currentLevel),this.writerOptions.state=n.None,this.onData(F,this.currentLevel),h.isClosed=!0},B.prototype.onData=function(h,F){return this.documentStarted=!0,this.onDataCallback(h,F+1)},B.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},B.prototype.debugInfo=function(h){return h==null?"":"node: <"+h+">"},B.prototype.ele=function(){return this.element.apply(this,arguments)},B.prototype.nod=function(h,F,R){return this.node(h,F,R)},B.prototype.txt=function(h){return this.text(h)},B.prototype.dat=function(h){return this.cdata(h)},B.prototype.com=function(h){return this.comment(h)},B.prototype.ins=function(h,F){return this.instruction(h,F)},B.prototype.dec=function(h,F,R){return this.declaration(h,F,R)},B.prototype.dtd=function(h,F,R){return this.doctype(h,F,R)},B.prototype.e=function(h,F,R){return this.element(h,F,R)},B.prototype.n=function(h,F,R){return this.node(h,F,R)},B.prototype.t=function(h){return this.text(h)},B.prototype.d=function(h){return this.cdata(h)},B.prototype.c=function(h){return this.comment(h)},B.prototype.r=function(h){return this.raw(h)},B.prototype.i=function(h,F){return this.instruction(h,F)},B.prototype.att=function(){return this.currentNode&&this.currentNode.type===u.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},B.prototype.a=function(){return this.currentNode&&this.currentNode.type===u.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},B.prototype.ent=function(h,F){return this.entity(h,F)},B.prototype.pent=function(h,F){return this.pEntity(h,F)},B.prototype.not=function(h,F){return this.notation(h,F)},B}()}.call(G)),we.exports}var be={exports:{}},Fr;function pi(){return Fr||(Fr=1,function(){var u,n,c,a=function(o,t){for(var i in t)f.call(t,i)&&(o[i]=t[i]);function m(){this.constructor=o}return m.prototype=t.prototype,o.prototype=new m,o.__super__=t.prototype,o},f={}.hasOwnProperty;u=ot(),c=ln(),n=Bt(),be.exports=function(o){a(t,o);function t(i,m){this.stream=i,t.__super__.constructor.call(this,m)}return t.prototype.endline=function(i,m,N){return i.isLastRootNode&&m.state===n.CloseTag?"":t.__super__.endline.call(this,i,m,N)},t.prototype.document=function(i,m){var N,w,y,b,x,O,_,E,D;for(_=i.children,w=y=0,x=_.length;y<x;w=++y)N=_[w],N.isLastRootNode=w===i.children.length-1;for(m=this.filterOptions(m),E=i.children,D=[],b=0,O=E.length;b<O;b++)N=E[b],D.push(this.writeChildNode(N,m,0));return D},t.prototype.attribute=function(i,m,N){return this.stream.write(t.__super__.attribute.call(this,i,m,N))},t.prototype.cdata=function(i,m,N){return this.stream.write(t.__super__.cdata.call(this,i,m,N))},t.prototype.comment=function(i,m,N){return this.stream.write(t.__super__.comment.call(this,i,m,N))},t.prototype.declaration=function(i,m,N){return this.stream.write(t.__super__.declaration.call(this,i,m,N))},t.prototype.docType=function(i,m,N){var w,y,b,x;if(N||(N=0),this.openNode(i,m,N),m.state=n.OpenTag,this.stream.write(this.indent(i,m,N)),this.stream.write("<!DOCTYPE "+i.root().name),i.pubID&&i.sysID?this.stream.write(' PUBLIC "'+i.pubID+'" "'+i.sysID+'"'):i.sysID&&this.stream.write(' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(i,m,N)),m.state=n.InsideTag,x=i.children,y=0,b=x.length;y<b;y++)w=x[y],this.writeChildNode(w,m,N+1);m.state=n.CloseTag,this.stream.write("]")}return m.state=n.CloseTag,this.stream.write(m.spaceBeforeSlash+">"),this.stream.write(this.endline(i,m,N)),m.state=n.None,this.closeNode(i,m,N)},t.prototype.element=function(i,m,N){var w,y,b,x,O,_,E,D,T;N||(N=0),this.openNode(i,m,N),m.state=n.OpenTag,this.stream.write(this.indent(i,m,N)+"<"+i.name),D=i.attribs;for(E in D)f.call(D,E)&&(w=D[E],this.attribute(w,m,N));if(b=i.children.length,x=b===0?null:i.children[0],b===0||i.children.every(function(p){return(p.type===u.Text||p.type===u.Raw)&&p.value===""}))m.allowEmpty?(this.stream.write(">"),m.state=n.CloseTag,this.stream.write("</"+i.name+">")):(m.state=n.CloseTag,this.stream.write(m.spaceBeforeSlash+"/>"));else if(m.pretty&&b===1&&(x.type===u.Text||x.type===u.Raw)&&x.value!=null)this.stream.write(">"),m.state=n.InsideTag,m.suppressPrettyCount++,this.writeChildNode(x,m,N+1),m.suppressPrettyCount--,m.state=n.CloseTag,this.stream.write("</"+i.name+">");else{for(this.stream.write(">"+this.endline(i,m,N)),m.state=n.InsideTag,T=i.children,O=0,_=T.length;O<_;O++)y=T[O],this.writeChildNode(y,m,N+1);m.state=n.CloseTag,this.stream.write(this.indent(i,m,N)+"</"+i.name+">")}return this.stream.write(this.endline(i,m,N)),m.state=n.None,this.closeNode(i,m,N)},t.prototype.processingInstruction=function(i,m,N){return this.stream.write(t.__super__.processingInstruction.call(this,i,m,N))},t.prototype.raw=function(i,m,N){return this.stream.write(t.__super__.raw.call(this,i,m,N))},t.prototype.text=function(i,m,N){return this.stream.write(t.__super__.text.call(this,i,m,N))},t.prototype.dtdAttList=function(i,m,N){return this.stream.write(t.__super__.dtdAttList.call(this,i,m,N))},t.prototype.dtdElement=function(i,m,N){return this.stream.write(t.__super__.dtdElement.call(this,i,m,N))},t.prototype.dtdEntity=function(i,m,N){return this.stream.write(t.__super__.dtdEntity.call(this,i,m,N))},t.prototype.dtdNotation=function(i,m,N){return this.stream.write(t.__super__.dtdNotation.call(this,i,m,N))},t}(c)}.call(G)),be.exports}var Sr;function di(){return Sr||(Sr=1,function(){var u,n,c,a,f,o,t,i,m,N;N=yt(),i=N.assign,m=N.isFunction,c=sn(),a=fn(),f=hi(),t=We(),o=pi(),u=ot(),n=Bt(),dt.create=function(w,y,b,x){var O,_;if(w==null)throw new Error("Root element needs a name.");return x=i({},y,b,x),O=new a(x),_=O.element(w),x.headless||(O.declaration(x),(x.pubID!=null||x.sysID!=null)&&O.dtd(x)),_},dt.begin=function(w,y,b){var x;return m(w)&&(x=[w,y],y=x[0],b=x[1],w={}),y?new f(w,y,b):new a(w)},dt.stringWriter=function(w){return new t(w)},dt.streamWriter=function(w,y){return new o(w,y)},dt.implementation=new c,dt.nodeType=u,dt.writerState=n}.call(G)),dt}var Br;function mi(){return Br||(Br=1,function(){var u,n,c,a,f,o={}.hasOwnProperty;u=di(),n=_e().defaults,a=function(t){return typeof t=="string"&&(t.indexOf("&")>=0||t.indexOf(">")>=0||t.indexOf("<")>=0)},f=function(t){return"<![CDATA["+c(t)+"]]>"},c=function(t){return t.replace("]]>","]]]]><![CDATA[>")},kt.Builder=function(){function t(i){var m,N,w;this.options={},N=n["0.2"];for(m in N)o.call(N,m)&&(w=N[m],this.options[m]=w);for(m in i)o.call(i,m)&&(w=i[m],this.options[m]=w)}return t.prototype.buildObject=function(i){var m,N,w,y,b;return m=this.options.attrkey,N=this.options.charkey,Object.keys(i).length===1&&this.options.rootName===n["0.2"].rootName?(b=Object.keys(i)[0],i=i[b]):b=this.options.rootName,w=function(x){return function(O,_){var E,D,T,p,I,A;if(typeof _!="object")x.options.cdata&&a(_)?O.raw(f(_)):O.txt(_);else if(Array.isArray(_)){for(p in _)if(o.call(_,p)){D=_[p];for(I in D)T=D[I],O=w(O.ele(I),T).up()}}else for(I in _)if(o.call(_,I))if(D=_[I],I===m){if(typeof D=="object")for(E in D)A=D[E],O=O.att(E,A)}else if(I===N)x.options.cdata&&a(D)?O=O.raw(f(D)):O=O.txt(D);else if(Array.isArray(D))for(p in D)o.call(D,p)&&(T=D[p],typeof T=="string"?x.options.cdata&&a(T)?O=O.ele(I).raw(f(T)).up():O=O.ele(I,T).up():O=w(O.ele(I),T).up());else typeof D=="object"?O=w(O.ele(I),D).up():typeof D=="string"&&x.options.cdata&&a(D)?O=O.ele(I).raw(f(D)).up():(D==null&&(D=""),O=O.ele(I,D.toString()).up());return O}}(this),y=u.create(b,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),w(y,i).end(this.options.renderOpts)},t}()}.call(G)),kt}var Ee={},Te={},xe={},Lt={exports:{}},De={},Nt={},Rr;function yi(){if(Rr)return Nt;Rr=1,Nt.byteLength=i,Nt.toByteArray=N,Nt.fromByteArray=b;for(var u=[],n=[],c=typeof Uint8Array<"u"?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,o=a.length;f<o;++f)u[f]=a[f],n[a.charCodeAt(f)]=f;n[45]=62,n[95]=63;function t(x){var O=x.length;if(O%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=x.indexOf("=");_===-1&&(_=O);var E=_===O?0:4-_%4;return[_,E]}function i(x){var O=t(x),_=O[0],E=O[1];return(_+E)*3/4-E}function m(x,O,_){return(O+_)*3/4-_}function N(x){var O,_=t(x),E=_[0],D=_[1],T=new c(m(x,E,D)),p=0,I=D>0?E-4:E,A;for(A=0;A<I;A+=4)O=n[x.charCodeAt(A)]<<18|n[x.charCodeAt(A+1)]<<12|n[x.charCodeAt(A+2)]<<6|n[x.charCodeAt(A+3)],T[p++]=O>>16&255,T[p++]=O>>8&255,T[p++]=O&255;return D===2&&(O=n[x.charCodeAt(A)]<<2|n[x.charCodeAt(A+1)]>>4,T[p++]=O&255),D===1&&(O=n[x.charCodeAt(A)]<<10|n[x.charCodeAt(A+1)]<<4|n[x.charCodeAt(A+2)]>>2,T[p++]=O>>8&255,T[p++]=O&255),T}function w(x){return u[x>>18&63]+u[x>>12&63]+u[x>>6&63]+u[x&63]}function y(x,O,_){for(var E,D=[],T=O;T<_;T+=3)E=(x[T]<<16&16711680)+(x[T+1]<<8&65280)+(x[T+2]&255),D.push(w(E));return D.join("")}function b(x){for(var O,_=x.length,E=_%3,D=[],T=16383,p=0,I=_-E;p<I;p+=T)D.push(y(x,p,p+T>I?I:p+T));return E===1?(O=x[_-1],D.push(u[O>>2]+u[O<<4&63]+"==")):E===2&&(O=(x[_-2]<<8)+x[_-1],D.push(u[O>>10]+u[O>>4&63]+u[O<<2&63]+"=")),D.join("")}return Nt}var _t={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var jr;function gi(){return jr||(jr=1,_t.read=function(u,n,c,a,f){var o,t,i=f*8-a-1,m=(1<<i)-1,N=m>>1,w=-7,y=c?f-1:0,b=c?-1:1,x=u[n+y];for(y+=b,o=x&(1<<-w)-1,x>>=-w,w+=i;w>0;o=o*256+u[n+y],y+=b,w-=8);for(t=o&(1<<-w)-1,o>>=-w,w+=a;w>0;t=t*256+u[n+y],y+=b,w-=8);if(o===0)o=1-N;else{if(o===m)return t?NaN:(x?-1:1)*(1/0);t=t+Math.pow(2,a),o=o-N}return(x?-1:1)*t*Math.pow(2,o-a)},_t.write=function(u,n,c,a,f,o){var t,i,m,N=o*8-f-1,w=(1<<N)-1,y=w>>1,b=f===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=a?0:o-1,O=a?1:-1,_=n<0||n===0&&1/n<0?1:0;for(n=Math.abs(n),isNaN(n)||n===1/0?(i=isNaN(n)?1:0,t=w):(t=Math.floor(Math.log(n)/Math.LN2),n*(m=Math.pow(2,-t))<1&&(t--,m*=2),t+y>=1?n+=b/m:n+=b*Math.pow(2,1-y),n*m>=2&&(t++,m/=2),t+y>=w?(i=0,t=w):t+y>=1?(i=(n*m-1)*Math.pow(2,f),t=t+y):(i=n*Math.pow(2,y-1)*Math.pow(2,f),t=0));f>=8;u[c+x]=i&255,x+=O,i/=256,f-=8);for(t=t<<f|i,N+=f;N>0;u[c+x]=t&255,x+=O,t/=256,N-=8);u[c+x-O]|=_*128}),_t}/*!
66
+ */var ft,ht,pt;const Vr=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,$r=(ht=(ft=process==null?void 0:process.versions)===null||ft===void 0?void 0:ft.node)!==null&&ht!==void 0?ht:(pt=process==null?void 0:process.version)===null||pt===void 0?void 0:pt.slice(1);if($r&&Number($r.match(/^([^.]+)/)[1])<Vr)throw Error(`yargs parser supports a minimum Node.js version of ${Vr}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const ds=process?process.env:{};new fs({cwd:process.cwd,env:()=>ds,format:kn,normalize:Li,resolve:sr,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(or(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const gs={fs:{readFileSync:or,writeFile:Ti},format:kn,resolve:sr,exists:e=>{try{return Ni(e).isFile()}catch{return!1}}};let me;class ms{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 r=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][r]&&this.updateFiles?(this.cache[this.locale][r]=r,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n})):n(),me.format.apply(me.format,[this.cache[this.locale][r]||r].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),r=t.shift(),n=t.shift(),a=t.shift();let o=function(){};typeof t[t.length-1]=="function"&&(o=t.pop()),this.cache[this.locale]||this._readLocaleFile();let i=a===1?r:n;this.cache[this.locale][r]&&(i=this.cache[this.locale][r][a===1?"one":"other"]),!this.cache[this.locale][r]&&this.updateFiles?(this.cache[this.locale][r]={one:r,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:o})):o();const s=[i];return~i.indexOf("%d")&&s.push(a),me.format.apply(me.format,s.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(this.cache[this.locale][r]=t[r])}_taggedLiteral(t,...r){let n="";return t.forEach(function(a,o){const i=r[o+1];n+=a,typeof i<"u"&&(n+="%s")}),this.__.apply(this,[n].concat([].slice.call(r,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,r=this.writeQueue[0],n=r.directory,a=r.locale,o=r.cb,i=this._resolveLocaleFile(n,a),s=JSON.stringify(this.cache[a],null,2);me.fs.writeFile(i,s,"utf-8",function(l){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),o(l)})}_readLocaleFile(){let t={};const r=this._resolveLocaleFile(this.directory,this.locale);try{me.fs.readFileSync&&(t=JSON.parse(me.fs.readFileSync(r,"utf-8")))}catch(n){if(n instanceof SyntaxError&&(n.message="syntax error in "+r),n.code==="ENOENT")t={};else throw n}this.cache[this.locale]=t}_resolveLocaleFile(t,r){let n=me.resolve(t,"./",r+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~r.lastIndexOf("_")){const a=me.resolve(t,"./",r.split("_")[0]+".json");this._fileExistsSync(a)&&(n=a)}return n}_fileExistsSync(t){return me.exists(t)}}function ys(e,t){me=t;const r=new ms(e);return{__:r.__.bind(r),__n:r.__n.bind(r),setLocale:r.setLocale.bind(r),getLocale:r.getLocale.bind(r),updateLocale:r.updateLocale.bind(r),locale:r.locale}}const ws=e=>ys(e,gs);let Ge;try{Ge=Fi(import.meta.url)}catch{Ge=process.cwd()}const bs=Ge.substring(0,Ge.lastIndexOf("node_modules"));bs||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,ws({directory:sr(Ge,"../../../locales"),updateFiles:!1});var dt={},qr;function cr(){return qr||(qr=1,function(){dt.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:`
67
+ `},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}.call(Q)),dt}var gt={},Te={},Ne={},Wr;function Ie(){return Wr||(Wr=1,function(){var e,t,r,n,a,o,i,s=[].slice,l={}.hasOwnProperty;e=function(){var d,g,m,w,E,I;if(I=arguments[0],E=2<=arguments.length?s.call(arguments,1):[],a(Object.assign))Object.assign.apply(null,arguments);else for(d=0,m=E.length;d<m;d++)if(w=E[d],w!=null)for(g in w)l.call(w,g)&&(I[g]=w[g]);return I},a=function(d){return!!d&&Object.prototype.toString.call(d)==="[object Function]"},o=function(d){var g;return!!d&&((g=typeof d)=="function"||g==="object")},r=function(d){return a(Array.isArray)?Array.isArray(d):Object.prototype.toString.call(d)==="[object Array]"},n=function(d){var g;if(r(d))return!d.length;for(g in d)if(l.call(d,g))return!1;return!0},i=function(d){var g,m;return o(d)&&(m=Object.getPrototypeOf(d))&&(g=m.constructor)&&typeof g=="function"&&g instanceof g&&Function.prototype.toString.call(g)===Function.prototype.toString.call(Object)},t=function(d){return a(d.valueOf)?d.valueOf():d},Ne.assign=e,Ne.isFunction=a,Ne.isObject=o,Ne.isArray=r,Ne.isEmpty=n,Ne.isPlainObject=i,Ne.getValue=t}.call(Q)),Ne}var mt={exports:{}},Hr;function ui(){return Hr||(Hr=1,function(){mt.exports=function(){function e(){}return e.prototype.hasFeature=function(t,r){return!0},e.prototype.createDocumentType=function(t,r,n){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,r,n){throw new Error("This DOM method is not implemented.")},e.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.getFeature=function(t,r){throw new Error("This DOM method is not implemented.")},e}()}.call(Q)),mt.exports}var yt={exports:{}},wt={exports:{}},bt={exports:{}},Gr;function Es(){return Gr||(Gr=1,function(){bt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(Q)),bt.exports}var Et={exports:{}},Yr;function Ts(){return Yr||(Yr=1,function(){Et.exports=function(){function e(t){this.arr=t||[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.arr.length}}),e.prototype.item=function(t){return this.arr[t]||null},e.prototype.contains=function(t){return this.arr.indexOf(t)!==-1},e}()}.call(Q)),Et.exports}var zr;function Ns(){return zr||(zr=1,function(){var e,t;e=Es(),t=Ts(),wt.exports=function(){function r(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new e,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(r.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),r.prototype.getParameter=function(n){return this.params.hasOwnProperty(n)?this.params[n]:null},r.prototype.canSetParameter=function(n,a){return!0},r.prototype.setParameter=function(n,a){return a!=null?this.params[n]=a:delete this.params[n]},r}()}.call(Q)),wt.exports}var Tt={exports:{}},Nt={exports:{}},vt={exports:{}},Qr;function ae(){return Qr||(Qr=1,function(){vt.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(Q)),vt.exports}var It={exports:{}},Jr;function ci(){return Jr||(Jr=1,function(){var e;e=ae(),ge(),It.exports=function(){function t(r,n,a){if(this.parent=r,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(a),this.type=e.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(r){return this.value=r||""}}),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(r){return this.options.writer.attribute(this,this.options.writer.filterOptions(r))},t.prototype.debugInfo=function(r){return r=r||this.name,r==null?"parent: <"+this.parent.name+">":"attribute: {"+r+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(r){return!(r.namespaceURI!==this.namespaceURI||r.prefix!==this.prefix||r.localName!==this.localName||r.value!==this.value)},t}()}.call(Q)),It.exports}var xt={exports:{}},Zr;function lr(){return Zr||(Zr=1,function(){xt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return Object.keys(this.nodes).length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.getNamedItem=function(t){return this.nodes[t]},e.prototype.setNamedItem=function(t){var r;return r=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,r||null},e.prototype.removeNamedItem=function(t){var r;return r=this.nodes[t],delete this.nodes[t],r||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,r){throw new Error("This DOM method is not implemented.")},e.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},e.prototype.removeNamedItemNS=function(t,r){throw new Error("This DOM method is not implemented.")},e}()}.call(Q)),xt.exports}var Kr;function fr(){return Kr||(Kr=1,function(){var e,t,r,n,a,o,i,s,l=function(g,m){for(var w in m)d.call(m,w)&&(g[w]=m[w]);function E(){this.constructor=g}return E.prototype=m.prototype,g.prototype=new E,g.__super__=m.prototype,g},d={}.hasOwnProperty;s=Ie(),i=s.isObject,o=s.isFunction,a=s.getValue,n=ge(),e=ae(),t=ci(),r=lr(),Nt.exports=function(g){l(m,g);function m(w,E,I){var _,T,x,v;if(m.__super__.constructor.call(this,w),E==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(E),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,I!=null&&this.attribute(I),w.type===e.Document&&(this.isRoot=!0,this.documentObject=w,w.rootObject=this,w.children)){for(v=w.children,T=0,x=v.length;T<x;T++)if(_=v[T],_.type===e.DocType){_.name=this.name;break}}}return Object.defineProperty(m.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(m.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(m.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(m.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(m.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(m.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(m.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(m.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new r(this.attribs)),this.attributeMap}}),m.prototype.clone=function(){var w,E,I,_;I=Object.create(this),I.isRoot&&(I.documentObject=null),I.attribs={},_=this.attribs;for(E in _)d.call(_,E)&&(w=_[E],I.attribs[E]=w.clone());return I.children=[],this.children.forEach(function(T){var x;return x=T.clone(),x.parent=I,I.children.push(x)}),I},m.prototype.attribute=function(w,E){var I,_;if(w!=null&&(w=a(w)),i(w))for(I in w)d.call(w,I)&&(_=w[I],this.attribute(I,_));else o(E)&&(E=E.apply()),this.options.keepNullAttributes&&E==null?this.attribs[w]=new t(this,w,""):E!=null&&(this.attribs[w]=new t(this,w,E));return this},m.prototype.removeAttribute=function(w){var E,I,_;if(w==null)throw new Error("Missing attribute name. "+this.debugInfo());if(w=a(w),Array.isArray(w))for(I=0,_=w.length;I<_;I++)E=w[I],delete this.attribs[E];else delete this.attribs[w];return this},m.prototype.toString=function(w){return this.options.writer.element(this,this.options.writer.filterOptions(w))},m.prototype.att=function(w,E){return this.attribute(w,E)},m.prototype.a=function(w,E){return this.attribute(w,E)},m.prototype.getAttribute=function(w){return this.attribs.hasOwnProperty(w)?this.attribs[w].value:null},m.prototype.setAttribute=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getAttributeNode=function(w){return this.attribs.hasOwnProperty(w)?this.attribs[w]:null},m.prototype.setAttributeNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.removeAttributeNode=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getAttributeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setAttributeNS=function(w,E,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.removeAttributeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getAttributeNodeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setAttributeNodeNS=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.hasAttribute=function(w){return this.attribs.hasOwnProperty(w)},m.prototype.hasAttributeNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setIdAttribute=function(w,E){return this.attribs.hasOwnProperty(w)?this.attribs[w].isId:E},m.prototype.setIdAttributeNS=function(w,E,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.setIdAttributeNode=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagName=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByTagNameNS=function(w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.getElementsByClassName=function(w){throw new Error("This DOM method is not implemented."+this.debugInfo())},m.prototype.isEqualNode=function(w){var E,I,_;if(!m.__super__.isEqualNode.apply(this,arguments).isEqualNode(w)||w.namespaceURI!==this.namespaceURI||w.prefix!==this.prefix||w.localName!==this.localName||w.attribs.length!==this.attribs.length)return!1;for(E=I=0,_=this.attribs.length-1;0<=_?I<=_:I>=_;E=0<=_?++I:--I)if(!this.attribs[E].isEqualNode(w.attribs[E]))return!1;return!0},m}(n)}.call(Q)),Nt.exports}var Ot={exports:{}},At={exports:{}},en;function st(){return en||(en=1,function(){var e,t=function(n,a){for(var o in a)r.call(a,o)&&(n[o]=a[o]);function i(){this.constructor=n}return i.prototype=a.prototype,n.prototype=new i,n.__super__=a.prototype,n},r={}.hasOwnProperty;e=ge(),At.exports=function(n){t(a,n);function a(o){a.__super__.constructor.call(this,o),this.value=""}return Object.defineProperty(a.prototype,"data",{get:function(){return this.value},set:function(o){return this.value=o||""}}),Object.defineProperty(a.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(a.prototype,"textContent",{get:function(){return this.value},set:function(o){return this.value=o||""}}),a.prototype.clone=function(){return Object.create(this)},a.prototype.substringData=function(o,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.appendData=function(o){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.insertData=function(o,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.deleteData=function(o,i){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.replaceData=function(o,i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},a.prototype.isEqualNode=function(o){return!(!a.__super__.isEqualNode.apply(this,arguments).isEqualNode(o)||o.data!==this.data)},a}(e)}.call(Q)),At.exports}var tn;function hr(){return tn||(tn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),Ot.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(s)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.cdata(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Ot.exports}var Lt={exports:{}},rn;function pr(){return rn||(rn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),Lt.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(s)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.comment(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Lt.exports}var Pt={exports:{}},nn;function dr(){return nn||(nn=1,function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;r=Ie().isObject,t=ge(),e=ae(),Pt.exports=function(o){n(i,o);function i(s,l,d,g){var m;i.__super__.constructor.call(this,s),r(l)&&(m=l,l=m.version,d=m.encoding,g=m.standalone),l||(l="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(l),d!=null&&(this.encoding=this.stringify.xmlEncoding(d)),g!=null&&(this.standalone=this.stringify.xmlStandalone(g))}return i.prototype.toString=function(s){return this.options.writer.declaration(this,this.options.writer.filterOptions(s))},i}(t)}.call(Q)),Pt.exports}var _t={exports:{}},Dt={exports:{}},on;function gr(){return on||(on=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Dt.exports=function(a){r(o,a);function o(i,s,l,d,g,m){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(l==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(s));if(!d)throw new Error("Missing DTD attribute type. "+this.debugInfo(s));if(!g)throw new Error("Missing DTD attribute default. "+this.debugInfo(s));if(g.indexOf("#")!==0&&(g="#"+g),!g.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(s));if(m&&!g.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=e.AttributeDeclaration,this.attributeName=this.stringify.name(l),this.attributeType=this.stringify.dtdAttType(d),m&&(this.defaultValue=this.stringify.dtdAttDefault(m)),this.defaultValueType=g}return o.prototype.toString=function(i){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Dt.exports}var St={exports:{}},sn;function mr(){return sn||(sn=1,function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;r=Ie().isObject,t=ge(),e=ae(),St.exports=function(o){n(i,o);function i(s,l,d,g){if(i.__super__.constructor.call(this,s),d==null)throw new Error("Missing DTD entity name. "+this.debugInfo(d));if(g==null)throw new Error("Missing DTD entity value. "+this.debugInfo(d));if(this.pe=!!l,this.name=this.stringify.name(d),this.type=e.EntityDeclaration,!r(g))this.value=this.stringify.dtdEntityValue(g),this.internal=!0;else{if(!g.pubID&&!g.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(d));if(g.pubID&&!g.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(d));if(this.internal=!1,g.pubID!=null&&(this.pubID=this.stringify.dtdPubID(g.pubID)),g.sysID!=null&&(this.sysID=this.stringify.dtdSysID(g.sysID)),g.nData!=null&&(this.nData=this.stringify.dtdNData(g.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(d))}}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(i.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(i.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(i.prototype,"xmlVersion",{get:function(){return null}}),i.prototype.toString=function(s){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(s))},i}(t)}.call(Q)),St.exports}var Mt={exports:{}},an;function yr(){return an||(an=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Mt.exports=function(a){r(o,a);function o(i,s,l){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing DTD element name. "+this.debugInfo());l||(l="(#PCDATA)"),Array.isArray(l)&&(l="("+l.join(",")+")"),this.name=this.stringify.name(s),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(l)}return o.prototype.toString=function(i){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Mt.exports}var Ft={exports:{}},un;function wr(){return un||(un=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Ft.exports=function(a){r(o,a);function o(i,s,l){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing DTD notation name. "+this.debugInfo(s));if(!l.pubID&&!l.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=e.NotationDeclaration,l.pubID!=null&&(this.pubID=this.stringify.dtdPubID(l.pubID)),l.sysID!=null&&(this.sysID=this.stringify.dtdSysID(l.sysID))}return Object.defineProperty(o.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(o.prototype,"systemId",{get:function(){return this.sysID}}),o.prototype.toString=function(i){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Ft.exports}var cn;function br(){return cn||(cn=1,function(){var e,t,r,n,a,o,i,s,l=function(g,m){for(var w in m)d.call(m,w)&&(g[w]=m[w]);function E(){this.constructor=g}return E.prototype=m.prototype,g.prototype=new E,g.__super__=m.prototype,g},d={}.hasOwnProperty;s=Ie().isObject,i=ge(),e=ae(),t=gr(),n=mr(),r=yr(),a=wr(),o=lr(),_t.exports=function(g){l(m,g);function m(w,E,I){var _,T,x,v,h,O;if(m.__super__.constructor.call(this,w),this.type=e.DocType,w.children){for(v=w.children,T=0,x=v.length;T<x;T++)if(_=v[T],_.type===e.Element){this.name=_.name;break}}this.documentObject=w,s(E)&&(h=E,E=h.pubID,I=h.sysID),I==null&&(O=[E,I],I=O[0],E=O[1]),E!=null&&(this.pubID=this.stringify.dtdPubID(E)),I!=null&&(this.sysID=this.stringify.dtdSysID(I))}return Object.defineProperty(m.prototype,"entities",{get:function(){var w,E,I,_,T;for(_={},T=this.children,E=0,I=T.length;E<I;E++)w=T[E],w.type===e.EntityDeclaration&&!w.pe&&(_[w.name]=w);return new o(_)}}),Object.defineProperty(m.prototype,"notations",{get:function(){var w,E,I,_,T;for(_={},T=this.children,E=0,I=T.length;E<I;E++)w=T[E],w.type===e.NotationDeclaration&&(_[w.name]=w);return new o(_)}}),Object.defineProperty(m.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(m.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(m.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),m.prototype.element=function(w,E){var I;return I=new r(this,w,E),this.children.push(I),this},m.prototype.attList=function(w,E,I,_,T){var x;return x=new t(this,w,E,I,_,T),this.children.push(x),this},m.prototype.entity=function(w,E){var I;return I=new n(this,!1,w,E),this.children.push(I),this},m.prototype.pEntity=function(w,E){var I;return I=new n(this,!0,w,E),this.children.push(I),this},m.prototype.notation=function(w,E){var I;return I=new a(this,w,E),this.children.push(I),this},m.prototype.toString=function(w){return this.options.writer.docType(this,this.options.writer.filterOptions(w))},m.prototype.ele=function(w,E){return this.element(w,E)},m.prototype.att=function(w,E,I,_,T){return this.attList(w,E,I,_,T)},m.prototype.ent=function(w,E){return this.entity(w,E)},m.prototype.pent=function(w,E){return this.pEntity(w,E)},m.prototype.not=function(w,E){return this.notation(w,E)},m.prototype.up=function(){return this.root()||this.documentObject},m.prototype.isEqualNode=function(w){return!(!m.__super__.isEqualNode.apply(this,arguments).isEqualNode(w)||w.name!==this.name||w.publicId!==this.publicId||w.systemId!==this.systemId)},m}(i)}.call(Q)),_t.exports}var Ct={exports:{}},ln;function Er(){return ln||(ln=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=ge(),Ct.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=e.Raw,this.value=this.stringify.raw(s)}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.raw(this,this.options.writer.filterOptions(i))},o}(t)}.call(Q)),Ct.exports}var Bt={exports:{}},fn;function Tr(){return fn||(fn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),Bt.exports=function(a){r(o,a);function o(i,s){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=e.Text,this.value=this.stringify.text(s)}return Object.defineProperty(o.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(o.prototype,"wholeText",{get:function(){var i,s,l;for(l="",s=this.previousSibling;s;)l=s.data+l,s=s.previousSibling;for(l+=this.data,i=this.nextSibling;i;)l=l+i.data,i=i.nextSibling;return l}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.text(this,this.options.writer.filterOptions(i))},o.prototype.splitText=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceWholeText=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o}(t)}.call(Q)),Bt.exports}var kt={exports:{}},hn;function Nr(){return hn||(hn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;e=ae(),t=st(),kt.exports=function(a){r(o,a);function o(i,s,l){if(o.__super__.constructor.call(this,i),s==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=e.ProcessingInstruction,this.target=this.stringify.insTarget(s),this.name=this.target,l&&(this.value=this.stringify.insValue(l))}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(i))},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.target!==this.target)},o}(t)}.call(Q)),kt.exports}var Rt={exports:{}},pn;function li(){return pn||(pn=1,function(){var e,t,r=function(a,o){for(var i in o)n.call(o,i)&&(a[i]=o[i]);function s(){this.constructor=a}return s.prototype=o.prototype,a.prototype=new s,a.__super__=o.prototype,a},n={}.hasOwnProperty;t=ge(),e=ae(),Rt.exports=function(a){r(o,a);function o(i){o.__super__.constructor.call(this,i),this.type=e.Dummy}return o.prototype.clone=function(){return Object.create(this)},o.prototype.toString=function(i){return""},o}(t)}.call(Q)),Rt.exports}var jt={exports:{}},dn;function vs(){return dn||(dn=1,function(){jt.exports=function(){function e(t){this.nodes=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this.nodes.length||0}}),e.prototype.clone=function(){return this.nodes=null},e.prototype.item=function(t){return this.nodes[t]||null},e}()}.call(Q)),jt.exports}var Ut={exports:{}},gn;function Is(){return gn||(gn=1,function(){Ut.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(Q)),Ut.exports}var mn;function ge(){return mn||(mn=1,function(){var e,t,r,n,a,o,i,s,l,d,g,m,w,E,I,_,T,x={}.hasOwnProperty;T=Ie(),_=T.isObject,I=T.isFunction,E=T.isEmpty,w=T.getValue,s=null,r=null,n=null,a=null,o=null,g=null,m=null,d=null,i=null,t=null,l=null,e=null,Tt.exports=function(){function v(h){this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,s||(s=fr(),r=hr(),n=pr(),a=dr(),o=br(),g=Er(),m=Tr(),d=Nr(),i=li(),t=ae(),l=vs(),lr(),e=Is())}return Object.defineProperty(v.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(v.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(v.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(v.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(v.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(v.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(v.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(v.prototype,"previousSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h-1]||null}}),Object.defineProperty(v.prototype,"nextSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h+1]||null}}),Object.defineProperty(v.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(v.prototype,"textContent",{get:function(){var h,O,A,F,M;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(M="",F=this.children,O=0,A=F.length;O<A;O++)h=F[O],h.textContent&&(M+=h.textContent);return M}else return null},set:function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),v.prototype.setParent=function(h){var O,A,F,M,k;for(this.parent=h,h&&(this.options=h.options,this.stringify=h.stringify),M=this.children,k=[],A=0,F=M.length;A<F;A++)O=M[A],k.push(O.setParent(this));return k},v.prototype.element=function(h,O,A){var F,M,k,y,B,j,U,W,X,$,Y;if(j=null,O===null&&A==null&&(X=[{},null],O=X[0],A=X[1]),O==null&&(O={}),O=w(O),_(O)||($=[O,A],A=$[0],O=$[1]),h!=null&&(h=w(h)),Array.isArray(h))for(k=0,U=h.length;k<U;k++)M=h[k],j=this.element(M);else if(I(h))j=this.element(h.apply());else if(_(h)){for(B in h)if(x.call(h,B))if(Y=h[B],I(Y)&&(Y=Y.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&B.indexOf(this.stringify.convertAttKey)===0)j=this.attribute(B.substr(this.stringify.convertAttKey.length),Y);else if(!this.options.separateArrayItems&&Array.isArray(Y)&&E(Y))j=this.dummy();else if(_(Y)&&E(Y))j=this.element(B);else if(!this.options.keepNullNodes&&Y==null)j=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(Y))for(y=0,W=Y.length;y<W;y++)M=Y[y],F={},F[B]=M,j=this.element(F);else _(Y)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&B.indexOf(this.stringify.convertTextKey)===0?j=this.element(Y):(j=this.element(B),j.element(Y)):j=this.element(B,Y)}else!this.options.keepNullNodes&&A===null?j=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&h.indexOf(this.stringify.convertTextKey)===0?j=this.text(A):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&h.indexOf(this.stringify.convertCDataKey)===0?j=this.cdata(A):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&h.indexOf(this.stringify.convertCommentKey)===0?j=this.comment(A):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&h.indexOf(this.stringify.convertRawKey)===0?j=this.raw(A):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&h.indexOf(this.stringify.convertPIKey)===0?j=this.instruction(h.substr(this.stringify.convertPIKey.length),A):j=this.node(h,O,A);if(j==null)throw new Error("Could not create any elements with: "+h+". "+this.debugInfo());return j},v.prototype.insertBefore=function(h,O,A){var F,M,k,y,B;if(h?.type)return k=h,y=O,k.setParent(this),y?(M=children.indexOf(y),B=children.splice(M),children.push(k),Array.prototype.push.apply(children,B)):children.push(k),k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return M=this.parent.children.indexOf(this),B=this.parent.children.splice(M),F=this.parent.element(h,O,A),Array.prototype.push.apply(this.parent.children,B),F},v.prototype.insertAfter=function(h,O,A){var F,M,k;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return M=this.parent.children.indexOf(this),k=this.parent.children.splice(M+1),F=this.parent.element(h,O,A),Array.prototype.push.apply(this.parent.children,k),F},v.prototype.remove=function(){var h;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return h=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[h,h-h+1].concat([])),this.parent},v.prototype.node=function(h,O,A){var F,M;return h!=null&&(h=w(h)),O||(O={}),O=w(O),_(O)||(M=[O,A],A=M[0],O=M[1]),F=new s(this,h,O),A!=null&&F.text(A),this.children.push(F),F},v.prototype.text=function(h){var O;return _(h)&&this.element(h),O=new m(this,h),this.children.push(O),this},v.prototype.cdata=function(h){var O;return O=new r(this,h),this.children.push(O),this},v.prototype.comment=function(h){var O;return O=new n(this,h),this.children.push(O),this},v.prototype.commentBefore=function(h){var O,A;return O=this.parent.children.indexOf(this),A=this.parent.children.splice(O),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,A),this},v.prototype.commentAfter=function(h){var O,A;return O=this.parent.children.indexOf(this),A=this.parent.children.splice(O+1),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,A),this},v.prototype.raw=function(h){var O;return O=new g(this,h),this.children.push(O),this},v.prototype.dummy=function(){var h;return h=new i(this),h},v.prototype.instruction=function(h,O){var A,F,M,k,y;if(h!=null&&(h=w(h)),O!=null&&(O=w(O)),Array.isArray(h))for(k=0,y=h.length;k<y;k++)A=h[k],this.instruction(A);else if(_(h))for(A in h)x.call(h,A)&&(F=h[A],this.instruction(A,F));else I(O)&&(O=O.apply()),M=new d(this,h,O),this.children.push(M);return this},v.prototype.instructionBefore=function(h,O){var A,F;return A=this.parent.children.indexOf(this),F=this.parent.children.splice(A),this.parent.instruction(h,O),Array.prototype.push.apply(this.parent.children,F),this},v.prototype.instructionAfter=function(h,O){var A,F;return A=this.parent.children.indexOf(this),F=this.parent.children.splice(A+1),this.parent.instruction(h,O),Array.prototype.push.apply(this.parent.children,F),this},v.prototype.declaration=function(h,O,A){var F,M;return F=this.document(),M=new a(F,h,O,A),F.children.length===0?F.children.unshift(M):F.children[0].type===t.Declaration?F.children[0]=M:F.children.unshift(M),F.root()||F},v.prototype.dtd=function(h,O){var A,F,M,k,y,B,j,U,W,X;for(F=this.document(),M=new o(F,h,O),W=F.children,k=y=0,j=W.length;y<j;k=++y)if(A=W[k],A.type===t.DocType)return F.children[k]=M,M;for(X=F.children,k=B=0,U=X.length;B<U;k=++B)if(A=X[k],A.isRoot)return F.children.splice(k,0,M),M;return F.children.push(M),M},v.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},v.prototype.root=function(){var h;for(h=this;h;){if(h.type===t.Document)return h.rootObject;if(h.isRoot)return h;h=h.parent}},v.prototype.document=function(){var h;for(h=this;h;){if(h.type===t.Document)return h;h=h.parent}},v.prototype.end=function(h){return this.document().end(h)},v.prototype.prev=function(){var h;if(h=this.parent.children.indexOf(this),h<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[h-1]},v.prototype.next=function(){var h;if(h=this.parent.children.indexOf(this),h===-1||h===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[h+1]},v.prototype.importDocument=function(h){var O;return O=h.root().clone(),O.parent=this,O.isRoot=!1,this.children.push(O),this},v.prototype.debugInfo=function(h){var O,A;return h=h||this.name,h==null&&!((O=this.parent)!=null&&O.name)?"":h==null?"parent: <"+this.parent.name+">":(A=this.parent)!=null&&A.name?"node: <"+h+">, parent: <"+this.parent.name+">":"node: <"+h+">"},v.prototype.ele=function(h,O,A){return this.element(h,O,A)},v.prototype.nod=function(h,O,A){return this.node(h,O,A)},v.prototype.txt=function(h){return this.text(h)},v.prototype.dat=function(h){return this.cdata(h)},v.prototype.com=function(h){return this.comment(h)},v.prototype.ins=function(h,O){return this.instruction(h,O)},v.prototype.doc=function(){return this.document()},v.prototype.dec=function(h,O,A){return this.declaration(h,O,A)},v.prototype.e=function(h,O,A){return this.element(h,O,A)},v.prototype.n=function(h,O,A){return this.node(h,O,A)},v.prototype.t=function(h){return this.text(h)},v.prototype.d=function(h){return this.cdata(h)},v.prototype.c=function(h){return this.comment(h)},v.prototype.r=function(h){return this.raw(h)},v.prototype.i=function(h,O){return this.instruction(h,O)},v.prototype.u=function(){return this.up()},v.prototype.importXMLBuilder=function(h){return this.importDocument(h)},v.prototype.replaceChild=function(h,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.removeChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.appendChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.hasChildNodes=function(){return this.children.length!==0},v.prototype.cloneNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.isSupported=function(h,O){return!0},v.prototype.hasAttributes=function(){return this.attribs.length!==0},v.prototype.compareDocumentPosition=function(h){var O,A;return O=this,O===h?0:this.document()!==h.document()?(A=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?A|=e.Preceding:A|=e.Following,A):O.isAncestor(h)?e.Contains|e.Preceding:O.isDescendant(h)?e.Contains|e.Following:O.isPreceding(h)?e.Preceding:e.Following},v.prototype.isSameNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.lookupPrefix=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.isDefaultNamespace=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.lookupNamespaceURI=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.isEqualNode=function(h){var O,A,F;if(h.nodeType!==this.nodeType||h.children.length!==this.children.length)return!1;for(O=A=0,F=this.children.length-1;0<=F?A<=F:A>=F;O=0<=F?++A:--A)if(!this.children[O].isEqualNode(h.children[O]))return!1;return!0},v.prototype.getFeature=function(h,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.setUserData=function(h,O,A){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.getUserData=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},v.prototype.contains=function(h){return h?h===this||this.isDescendant(h):!1},v.prototype.isDescendant=function(h){var O,A,F,M,k;for(k=this.children,F=0,M=k.length;F<M;F++)if(O=k[F],h===O||(A=O.isDescendant(h),A))return!0;return!1},v.prototype.isAncestor=function(h){return h.isDescendant(this)},v.prototype.isPreceding=function(h){var O,A;return O=this.treePosition(h),A=this.treePosition(this),O===-1||A===-1?!1:O<A},v.prototype.isFollowing=function(h){var O,A;return O=this.treePosition(h),A=this.treePosition(this),O===-1||A===-1?!1:O>A},v.prototype.treePosition=function(h){var O,A;return A=0,O=!1,this.foreachTreeNode(this.document(),function(F){if(A++,!O&&F===h)return O=!0}),O?A:-1},v.prototype.foreachTreeNode=function(h,O){var A,F,M,k,y;for(h||(h=this.document()),k=h.children,F=0,M=k.length;F<M;F++){if(A=k[F],y=O(A))return y;if(y=this.foreachTreeNode(A,O),y)return y}},v}()}.call(Q)),Tt.exports}var Xt={exports:{}},yn;function fi(){return yn||(yn=1,function(){var e=function(r,n){return function(){return r.apply(n,arguments)}},t={}.hasOwnProperty;Xt.exports=function(){function r(n){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var a,o,i;n||(n={}),this.options=n,this.options.version||(this.options.version="1.0"),o=n.stringify||{};for(a in o)t.call(o,a)&&(i=o[a],this[a]=i)}return r.prototype.name=function(n){return this.options.noValidation?n:this.assertLegalName(""+n||"")},r.prototype.text=function(n){return this.options.noValidation?n:this.assertLegalChar(this.textEscape(""+n||""))},r.prototype.cdata=function(n){return this.options.noValidation?n:(n=""+n||"",n=n.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(n))},r.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)},r.prototype.raw=function(n){return this.options.noValidation?n:""+n||""},r.prototype.attValue=function(n){return this.options.noValidation?n:this.assertLegalChar(this.attEscape(n=""+n||""))},r.prototype.insTarget=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.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)},r.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},r.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)},r.prototype.xmlStandalone=function(n){return this.options.noValidation?n:n?"yes":"no"},r.prototype.dtdPubID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdSysID=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdElementValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdAttType=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdAttDefault=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdEntityValue=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.dtdNData=function(n){return this.options.noValidation?n:this.assertLegalChar(""+n||"")},r.prototype.convertAttKey="@",r.prototype.convertPIKey="?",r.prototype.convertTextKey="#text",r.prototype.convertCDataKey="#cdata",r.prototype.convertCommentKey="#comment",r.prototype.convertRawKey="#raw",r.prototype.assertLegalChar=function(n){var a,o;if(this.options.noValidation)return n;if(a="",this.options.version==="1.0"){if(a=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=n.match(a))throw new Error("Invalid character in string: "+n+" at index "+o.index)}else if(this.options.version==="1.1"&&(a=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,o=n.match(a)))throw new Error("Invalid character in string: "+n+" at index "+o.index);return n},r.prototype.assertLegalName=function(n){var a;if(this.options.noValidation)return n;if(this.assertLegalChar(n),a=/^([: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(a))throw new Error("Invalid character in name");return n},r.prototype.textEscape=function(n){var a;return this.options.noValidation?n:(a=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(a,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},r.prototype.attEscape=function(n){var a;return this.options.noValidation?n:(a=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,n.replace(a,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},r}()}.call(Q)),Xt.exports}var Vt={exports:{}},$t={exports:{}},qt={exports:{}},wn;function at(){return wn||(wn=1,function(){qt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(Q)),qt.exports}var bn;function hi(){return bn||(bn=1,function(){var e,t,r,n={}.hasOwnProperty;r=Ie().assign,e=ae(),dr(),br(),hr(),pr(),fr(),Er(),Tr(),Nr(),li(),gr(),yr(),mr(),wr(),t=at(),$t.exports=function(){function a(o){var i,s,l;o||(o={}),this.options=o,s=o.writer||{};for(i in s)n.call(s,i)&&(l=s[i],this["_"+i]=this[i],this[i]=l)}return a.prototype.filterOptions=function(o){var i,s,l,d,g,m,w,E;return o||(o={}),o=r({},this.options,o),i={writer:this},i.pretty=o.pretty||!1,i.allowEmpty=o.allowEmpty||!1,i.indent=(s=o.indent)!=null?s:" ",i.newline=(l=o.newline)!=null?l:`
68
+ `,i.offset=(d=o.offset)!=null?d:0,i.dontPrettyTextNodes=(g=(m=o.dontPrettyTextNodes)!=null?m:o.dontprettytextnodes)!=null?g:0,i.spaceBeforeSlash=(w=(E=o.spaceBeforeSlash)!=null?E:o.spacebeforeslash)!=null?w:"",i.spaceBeforeSlash===!0&&(i.spaceBeforeSlash=" "),i.suppressPrettyCount=0,i.user={},i.state=t.None,i},a.prototype.indent=function(o,i,s){var l;return!i.pretty||i.suppressPrettyCount?"":i.pretty&&(l=(s||0)+i.offset+1,l>0)?new Array(l).join(i.indent):""},a.prototype.endline=function(o,i,s){return!i.pretty||i.suppressPrettyCount?"":i.newline},a.prototype.attribute=function(o,i,s){var l;return this.openAttribute(o,i,s),l=" "+o.name+'="'+o.value+'"',this.closeAttribute(o,i,s),l},a.prototype.cdata=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<![CDATA[",i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+="]]>"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.comment=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!-- ",i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+=" -->"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.declaration=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<?xml",i.state=t.InsideTag,l+=' version="'+o.version+'"',o.encoding!=null&&(l+=' encoding="'+o.encoding+'"'),o.standalone!=null&&(l+=' standalone="'+o.standalone+'"'),i.state=t.CloseTag,l+=i.spaceBeforeSlash+"?>",l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.docType=function(o,i,s){var l,d,g,m,w;if(s||(s=0),this.openNode(o,i,s),i.state=t.OpenTag,m=this.indent(o,i,s),m+="<!DOCTYPE "+o.root().name,o.pubID&&o.sysID?m+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.sysID&&(m+=' SYSTEM "'+o.sysID+'"'),o.children.length>0){for(m+=" [",m+=this.endline(o,i,s),i.state=t.InsideTag,w=o.children,d=0,g=w.length;d<g;d++)l=w[d],m+=this.writeChildNode(l,i,s+1);i.state=t.CloseTag,m+="]"}return i.state=t.CloseTag,m+=i.spaceBeforeSlash+">",m+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),m},a.prototype.element=function(o,i,s){var l,d,g,m,w,E,I,_,T,x,v,h,O,A;s||(s=0),x=!1,v="",this.openNode(o,i,s),i.state=t.OpenTag,v+=this.indent(o,i,s)+"<"+o.name,h=o.attribs;for(T in h)n.call(h,T)&&(l=h[T],v+=this.attribute(l,i,s));if(g=o.children.length,m=g===0?null:o.children[0],g===0||o.children.every(function(F){return(F.type===e.Text||F.type===e.Raw)&&F.value===""}))i.allowEmpty?(v+=">",i.state=t.CloseTag,v+="</"+o.name+">"+this.endline(o,i,s)):(i.state=t.CloseTag,v+=i.spaceBeforeSlash+"/>"+this.endline(o,i,s));else if(i.pretty&&g===1&&(m.type===e.Text||m.type===e.Raw)&&m.value!=null)v+=">",i.state=t.InsideTag,i.suppressPrettyCount++,x=!0,v+=this.writeChildNode(m,i,s+1),i.suppressPrettyCount--,x=!1,i.state=t.CloseTag,v+="</"+o.name+">"+this.endline(o,i,s);else{if(i.dontPrettyTextNodes){for(O=o.children,w=0,I=O.length;w<I;w++)if(d=O[w],(d.type===e.Text||d.type===e.Raw)&&d.value!=null){i.suppressPrettyCount++,x=!0;break}}for(v+=">"+this.endline(o,i,s),i.state=t.InsideTag,A=o.children,E=0,_=A.length;E<_;E++)d=A[E],v+=this.writeChildNode(d,i,s+1);i.state=t.CloseTag,v+=this.indent(o,i,s)+"</"+o.name+">",x&&i.suppressPrettyCount--,v+=this.endline(o,i,s),i.state=t.None}return this.closeNode(o,i,s),v},a.prototype.writeChildNode=function(o,i,s){switch(o.type){case e.CData:return this.cdata(o,i,s);case e.Comment:return this.comment(o,i,s);case e.Element:return this.element(o,i,s);case e.Raw:return this.raw(o,i,s);case e.Text:return this.text(o,i,s);case e.ProcessingInstruction:return this.processingInstruction(o,i,s);case e.Dummy:return"";case e.Declaration:return this.declaration(o,i,s);case e.DocType:return this.docType(o,i,s);case e.AttributeDeclaration:return this.dtdAttList(o,i,s);case e.ElementDeclaration:return this.dtdElement(o,i,s);case e.EntityDeclaration:return this.dtdEntity(o,i,s);case e.NotationDeclaration:return this.dtdNotation(o,i,s);default:throw new Error("Unknown XML node type: "+o.constructor.name)}},a.prototype.processingInstruction=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<?",i.state=t.InsideTag,l+=o.target,o.value&&(l+=" "+o.value),i.state=t.CloseTag,l+=i.spaceBeforeSlash+"?>",l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.raw=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s),i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.text=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s),i.state=t.InsideTag,l+=o.value,i.state=t.CloseTag,l+=this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdAttList=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!ATTLIST",i.state=t.InsideTag,l+=" "+o.elementName+" "+o.attributeName+" "+o.attributeType,o.defaultValueType!=="#DEFAULT"&&(l+=" "+o.defaultValueType),o.defaultValue&&(l+=' "'+o.defaultValue+'"'),i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdElement=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!ELEMENT",i.state=t.InsideTag,l+=" "+o.name+" "+o.value,i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdEntity=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!ENTITY",i.state=t.InsideTag,o.pe&&(l+=" %"),l+=" "+o.name,o.value?l+=' "'+o.value+'"':(o.pubID&&o.sysID?l+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.sysID&&(l+=' SYSTEM "'+o.sysID+'"'),o.nData&&(l+=" NDATA "+o.nData)),i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.dtdNotation=function(o,i,s){var l;return this.openNode(o,i,s),i.state=t.OpenTag,l=this.indent(o,i,s)+"<!NOTATION",i.state=t.InsideTag,l+=" "+o.name,o.pubID&&o.sysID?l+=' PUBLIC "'+o.pubID+'" "'+o.sysID+'"':o.pubID?l+=' PUBLIC "'+o.pubID+'"':o.sysID&&(l+=' SYSTEM "'+o.sysID+'"'),i.state=t.CloseTag,l+=i.spaceBeforeSlash+">"+this.endline(o,i,s),i.state=t.None,this.closeNode(o,i,s),l},a.prototype.openNode=function(o,i,s){},a.prototype.closeNode=function(o,i,s){},a.prototype.openAttribute=function(o,i,s){},a.prototype.closeAttribute=function(o,i,s){},a}()}.call(Q)),$t.exports}var En;function vr(){return En||(En=1,function(){var e,t=function(n,a){for(var o in a)r.call(a,o)&&(n[o]=a[o]);function i(){this.constructor=n}return i.prototype=a.prototype,n.prototype=new i,n.__super__=a.prototype,n},r={}.hasOwnProperty;e=hi(),Vt.exports=function(n){t(a,n);function a(o){a.__super__.constructor.call(this,o)}return a.prototype.document=function(o,i){var s,l,d,g,m;for(i=this.filterOptions(i),g="",m=o.children,l=0,d=m.length;l<d;l++)s=m[l],g+=this.writeChildNode(s,i,0);return i.pretty&&g.slice(-i.newline.length)===i.newline&&(g=g.slice(0,-i.newline.length)),g},a}(e)}.call(Q)),Vt.exports}var Tn;function pi(){return Tn||(Tn=1,function(){var e,t,r,n,a,o,i,s=function(d,g){for(var m in g)l.call(g,m)&&(d[m]=g[m]);function w(){this.constructor=d}return w.prototype=g.prototype,d.prototype=new w,d.__super__=g.prototype,d},l={}.hasOwnProperty;i=Ie().isPlainObject,r=ui(),t=Ns(),n=ge(),e=ae(),o=fi(),a=vr(),yt.exports=function(d){s(g,d);function g(m){g.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,m||(m={}),m.writer||(m.writer=new a),this.options=m,this.stringify=new o(m)}return Object.defineProperty(g.prototype,"implementation",{value:new r}),Object.defineProperty(g.prototype,"doctype",{get:function(){var m,w,E,I;for(I=this.children,w=0,E=I.length;w<E;w++)if(m=I[w],m.type===e.DocType)return m;return null}}),Object.defineProperty(g.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(g.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(g.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(g.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(g.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(g.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(g.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(g.prototype,"origin",{get:function(){return null}}),Object.defineProperty(g.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(g.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(g.prototype,"contentType",{get:function(){return null}}),g.prototype.end=function(m){var w;return w={},m?i(m)&&(w=m,m=this.options.writer):m=this.options.writer,m.document(this,m.filterOptions(w))},g.prototype.toString=function(m){return this.options.writer.document(this,this.options.writer.filterOptions(m))},g.prototype.createElement=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createTextNode=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createComment=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createCDATASection=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createProcessingInstruction=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createAttribute=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createEntityReference=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.importNode=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createElementNS=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createAttributeNS=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(m,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementById=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.adoptNode=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.renameNode=function(m,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByClassName=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createEvent=function(m){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createNodeIterator=function(m,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.createTreeWalker=function(m,w,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},g}(n)}.call(Q)),yt.exports}var Wt={exports:{}},Nn;function xs(){return Nn||(Nn=1,function(){var e,t,r,n,a,o,i,s,l,d,g,m,w,E,I,_,T,x,v,h,O,A,F,M={}.hasOwnProperty;F=Ie(),O=F.isObject,h=F.isFunction,A=F.isPlainObject,v=F.getValue,e=ae(),m=pi(),w=fr(),n=hr(),a=pr(),I=Er(),x=Tr(),E=Nr(),d=dr(),g=br(),o=gr(),s=mr(),i=yr(),l=wr(),r=ci(),T=fi(),_=vr(),t=at(),Wt.exports=function(){function k(y,B,j){var U;this.name="?xml",this.type=e.Document,y||(y={}),U={},y.writer?A(y.writer)&&(U=y.writer,y.writer=new _):y.writer=new _,this.options=y,this.writer=y.writer,this.writerOptions=this.writer.filterOptions(U),this.stringify=new T(y),this.onDataCallback=B||function(){},this.onEndCallback=j||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return k.prototype.createChildNode=function(y){var B,j,U,W,X,$,Y,H;switch(y.type){case e.CData:this.cdata(y.value);break;case e.Comment:this.comment(y.value);break;case e.Element:U={},Y=y.attribs;for(j in Y)M.call(Y,j)&&(B=Y[j],U[j]=B.value);this.node(y.name,U);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(y.value);break;case e.Text:this.text(y.value);break;case e.ProcessingInstruction:this.instruction(y.target,y.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+y.constructor.name)}for(H=y.children,X=0,$=H.length;X<$;X++)W=H[X],this.createChildNode(W),W.type===e.Element&&this.up();return this},k.prototype.dummy=function(){return this},k.prototype.node=function(y,B,j){var U;if(y==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(y));return this.openCurrent(),y=v(y),B==null&&(B={}),B=v(B),O(B)||(U=[B,j],j=U[0],B=U[1]),this.currentNode=new w(this,y,B),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,j!=null&&this.text(j),this},k.prototype.element=function(y,B,j){var U,W,X,$,Y,H;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(y)||O(y)||h(y))for($=this.options.noValidation,this.options.noValidation=!0,H=new m(this.options).element("TEMP_ROOT"),H.element(y),this.options.noValidation=$,Y=H.children,W=0,X=Y.length;W<X;W++)U=Y[W],this.createChildNode(U),U.type===e.Element&&this.up();else this.node(y,B,j);return this},k.prototype.attribute=function(y,B){var j,U;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(y));if(y!=null&&(y=v(y)),O(y))for(j in y)M.call(y,j)&&(U=y[j],this.attribute(j,U));else h(B)&&(B=B.apply()),this.options.keepNullAttributes&&B==null?this.currentNode.attribs[y]=new r(this,y,""):B!=null&&(this.currentNode.attribs[y]=new r(this,y,B));return this},k.prototype.text=function(y){var B;return this.openCurrent(),B=new x(this,y),this.onData(this.writer.text(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.cdata=function(y){var B;return this.openCurrent(),B=new n(this,y),this.onData(this.writer.cdata(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.comment=function(y){var B;return this.openCurrent(),B=new a(this,y),this.onData(this.writer.comment(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.raw=function(y){var B;return this.openCurrent(),B=new I(this,y),this.onData(this.writer.raw(B,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.instruction=function(y,B){var j,U,W,X,$;if(this.openCurrent(),y!=null&&(y=v(y)),B!=null&&(B=v(B)),Array.isArray(y))for(j=0,X=y.length;j<X;j++)U=y[j],this.instruction(U);else if(O(y))for(U in y)M.call(y,U)&&(W=y[U],this.instruction(U,W));else h(B)&&(B=B.apply()),$=new E(this,y,B),this.onData(this.writer.processingInstruction($,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},k.prototype.declaration=function(y,B,j){var U;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return U=new d(this,y,B,j),this.onData(this.writer.declaration(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.doctype=function(y,B,j){if(this.openCurrent(),y==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 g(this,B,j),this.currentNode.rootNodeName=y,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},k.prototype.dtdElement=function(y,B){var j;return this.openCurrent(),j=new i(this,y,B),this.onData(this.writer.dtdElement(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.attList=function(y,B,j,U,W){var X;return this.openCurrent(),X=new o(this,y,B,j,U,W),this.onData(this.writer.dtdAttList(X,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.entity=function(y,B){var j;return this.openCurrent(),j=new s(this,!1,y,B),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.pEntity=function(y,B){var j;return this.openCurrent(),j=new s(this,!0,y,B),this.onData(this.writer.dtdEntity(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.prototype.notation=function(y,B){var j;return this.openCurrent(),j=new l(this,y,B),this.onData(this.writer.dtdNotation(j,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},k.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},k.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},k.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},k.prototype.openNode=function(y){var B,j,U,W;if(!y.isOpen){if(!this.root&&this.currentLevel===0&&y.type===e.Element&&(this.root=y),j="",y.type===e.Element){this.writerOptions.state=t.OpenTag,j=this.writer.indent(y,this.writerOptions,this.currentLevel)+"<"+y.name,W=y.attribs;for(U in W)M.call(W,U)&&(B=W[U],j+=this.writer.attribute(B,this.writerOptions,this.currentLevel));j+=(y.children?">":"/>")+this.writer.endline(y,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,j=this.writer.indent(y,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+y.rootNodeName,y.pubID&&y.sysID?j+=' PUBLIC "'+y.pubID+'" "'+y.sysID+'"':y.sysID&&(j+=' SYSTEM "'+y.sysID+'"'),y.children?(j+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,j+=">"),j+=this.writer.endline(y,this.writerOptions,this.currentLevel);return this.onData(j,this.currentLevel),y.isOpen=!0}},k.prototype.closeNode=function(y){var B;if(!y.isClosed)return B="",this.writerOptions.state=t.CloseTag,y.type===e.Element?B=this.writer.indent(y,this.writerOptions,this.currentLevel)+"</"+y.name+">"+this.writer.endline(y,this.writerOptions,this.currentLevel):B=this.writer.indent(y,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(y,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(B,this.currentLevel),y.isClosed=!0},k.prototype.onData=function(y,B){return this.documentStarted=!0,this.onDataCallback(y,B+1)},k.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},k.prototype.debugInfo=function(y){return y==null?"":"node: <"+y+">"},k.prototype.ele=function(){return this.element.apply(this,arguments)},k.prototype.nod=function(y,B,j){return this.node(y,B,j)},k.prototype.txt=function(y){return this.text(y)},k.prototype.dat=function(y){return this.cdata(y)},k.prototype.com=function(y){return this.comment(y)},k.prototype.ins=function(y,B){return this.instruction(y,B)},k.prototype.dec=function(y,B,j){return this.declaration(y,B,j)},k.prototype.dtd=function(y,B,j){return this.doctype(y,B,j)},k.prototype.e=function(y,B,j){return this.element(y,B,j)},k.prototype.n=function(y,B,j){return this.node(y,B,j)},k.prototype.t=function(y){return this.text(y)},k.prototype.d=function(y){return this.cdata(y)},k.prototype.c=function(y){return this.comment(y)},k.prototype.r=function(y){return this.raw(y)},k.prototype.i=function(y,B){return this.instruction(y,B)},k.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},k.prototype.ent=function(y,B){return this.entity(y,B)},k.prototype.pent=function(y,B){return this.pEntity(y,B)},k.prototype.not=function(y,B){return this.notation(y,B)},k}()}.call(Q)),Wt.exports}var Ht={exports:{}},vn;function Os(){return vn||(vn=1,function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;e=ae(),r=hi(),t=at(),Ht.exports=function(o){n(i,o);function i(s,l){this.stream=s,i.__super__.constructor.call(this,l)}return i.prototype.endline=function(s,l,d){return s.isLastRootNode&&l.state===t.CloseTag?"":i.__super__.endline.call(this,s,l,d)},i.prototype.document=function(s,l){var d,g,m,w,E,I,_,T,x;for(_=s.children,g=m=0,E=_.length;m<E;g=++m)d=_[g],d.isLastRootNode=g===s.children.length-1;for(l=this.filterOptions(l),T=s.children,x=[],w=0,I=T.length;w<I;w++)d=T[w],x.push(this.writeChildNode(d,l,0));return x},i.prototype.attribute=function(s,l,d){return this.stream.write(i.__super__.attribute.call(this,s,l,d))},i.prototype.cdata=function(s,l,d){return this.stream.write(i.__super__.cdata.call(this,s,l,d))},i.prototype.comment=function(s,l,d){return this.stream.write(i.__super__.comment.call(this,s,l,d))},i.prototype.declaration=function(s,l,d){return this.stream.write(i.__super__.declaration.call(this,s,l,d))},i.prototype.docType=function(s,l,d){var g,m,w,E;if(d||(d=0),this.openNode(s,l,d),l.state=t.OpenTag,this.stream.write(this.indent(s,l,d)),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,l,d)),l.state=t.InsideTag,E=s.children,m=0,w=E.length;m<w;m++)g=E[m],this.writeChildNode(g,l,d+1);l.state=t.CloseTag,this.stream.write("]")}return l.state=t.CloseTag,this.stream.write(l.spaceBeforeSlash+">"),this.stream.write(this.endline(s,l,d)),l.state=t.None,this.closeNode(s,l,d)},i.prototype.element=function(s,l,d){var g,m,w,E,I,_,T,x,v;d||(d=0),this.openNode(s,l,d),l.state=t.OpenTag,this.stream.write(this.indent(s,l,d)+"<"+s.name),x=s.attribs;for(T in x)a.call(x,T)&&(g=x[T],this.attribute(g,l,d));if(w=s.children.length,E=w===0?null:s.children[0],w===0||s.children.every(function(h){return(h.type===e.Text||h.type===e.Raw)&&h.value===""}))l.allowEmpty?(this.stream.write(">"),l.state=t.CloseTag,this.stream.write("</"+s.name+">")):(l.state=t.CloseTag,this.stream.write(l.spaceBeforeSlash+"/>"));else if(l.pretty&&w===1&&(E.type===e.Text||E.type===e.Raw)&&E.value!=null)this.stream.write(">"),l.state=t.InsideTag,l.suppressPrettyCount++,this.writeChildNode(E,l,d+1),l.suppressPrettyCount--,l.state=t.CloseTag,this.stream.write("</"+s.name+">");else{for(this.stream.write(">"+this.endline(s,l,d)),l.state=t.InsideTag,v=s.children,I=0,_=v.length;I<_;I++)m=v[I],this.writeChildNode(m,l,d+1);l.state=t.CloseTag,this.stream.write(this.indent(s,l,d)+"</"+s.name+">")}return this.stream.write(this.endline(s,l,d)),l.state=t.None,this.closeNode(s,l,d)},i.prototype.processingInstruction=function(s,l,d){return this.stream.write(i.__super__.processingInstruction.call(this,s,l,d))},i.prototype.raw=function(s,l,d){return this.stream.write(i.__super__.raw.call(this,s,l,d))},i.prototype.text=function(s,l,d){return this.stream.write(i.__super__.text.call(this,s,l,d))},i.prototype.dtdAttList=function(s,l,d){return this.stream.write(i.__super__.dtdAttList.call(this,s,l,d))},i.prototype.dtdElement=function(s,l,d){return this.stream.write(i.__super__.dtdElement.call(this,s,l,d))},i.prototype.dtdEntity=function(s,l,d){return this.stream.write(i.__super__.dtdEntity.call(this,s,l,d))},i.prototype.dtdNotation=function(s,l,d){return this.stream.write(i.__super__.dtdNotation.call(this,s,l,d))},i}(r)}.call(Q)),Ht.exports}var In;function As(){return In||(In=1,function(){var e,t,r,n,a,o,i,s,l,d;d=Ie(),s=d.assign,l=d.isFunction,r=ui(),n=pi(),a=xs(),i=vr(),o=Os(),e=ae(),t=at(),Te.create=function(g,m,w,E){var I,_;if(g==null)throw new Error("Root element needs a name.");return E=s({},m,w,E),I=new n(E),_=I.element(g),E.headless||(I.declaration(E),(E.pubID!=null||E.sysID!=null)&&I.dtd(E)),_},Te.begin=function(g,m,w){var E;return l(g)&&(E=[g,m],m=E[0],w=E[1],g={}),m?new a(g,m,w):new n(g)},Te.stringWriter=function(g){return new i(g)},Te.streamWriter=function(g,m){return new o(g,m)},Te.implementation=new r,Te.nodeType=e,Te.writerState=t}.call(Q)),Te}var xn;function Ls(){return xn||(xn=1,function(){var e,t,r,n,a,o={}.hasOwnProperty;e=As(),t=cr().defaults,n=function(i){return typeof i=="string"&&(i.indexOf("&")>=0||i.indexOf(">")>=0||i.indexOf("<")>=0)},a=function(i){return"<![CDATA["+r(i)+"]]>"},r=function(i){return i.replace("]]>","]]]]><![CDATA[>")},gt.Builder=function(){function i(s){var l,d,g;this.options={},d=t["0.2"];for(l in d)o.call(d,l)&&(g=d[l],this.options[l]=g);for(l in s)o.call(s,l)&&(g=s[l],this.options[l]=g)}return i.prototype.buildObject=function(s){var l,d,g,m,w;return l=this.options.attrkey,d=this.options.charkey,Object.keys(s).length===1&&this.options.rootName===t["0.2"].rootName?(w=Object.keys(s)[0],s=s[w]):w=this.options.rootName,g=function(E){return function(I,_){var T,x,v,h,O,A;if(typeof _!="object")E.options.cdata&&n(_)?I.raw(a(_)):I.txt(_);else if(Array.isArray(_)){for(h in _)if(o.call(_,h)){x=_[h];for(O in x)v=x[O],I=g(I.ele(O),v).up()}}else for(O in _)if(o.call(_,O))if(x=_[O],O===l){if(typeof x=="object")for(T in x)A=x[T],I=I.att(T,A)}else if(O===d)E.options.cdata&&n(x)?I=I.raw(a(x)):I=I.txt(x);else if(Array.isArray(x))for(h in x)o.call(x,h)&&(v=x[h],typeof v=="string"?E.options.cdata&&n(v)?I=I.ele(O).raw(a(v)).up():I=I.ele(O,v).up():I=g(I.ele(O),v).up());else typeof x=="object"?I=g(I.ele(O),x).up():typeof x=="string"&&E.options.cdata&&n(x)?I=I.ele(O).raw(a(x)).up():(x==null&&(x=""),I=I.ele(O,x.toString()).up());return I}}(this),m=e.create(w,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),g(m,s).end(this.options.renderOpts)},i}()}.call(Q)),gt}var Gt={},Yt={},zt={},Qe={exports:{}},Qt={},We={},On;function Ps(){if(On)return We;On=1,We.byteLength=s,We.toByteArray=d,We.fromByteArray=w;for(var e=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=n.length;a<o;++a)e[a]=n[a],t[n.charCodeAt(a)]=a;t[45]=62,t[95]=63;function i(E){var I=E.length;if(I%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=E.indexOf("=");_===-1&&(_=I);var T=_===I?0:4-_%4;return[_,T]}function s(E){var I=i(E),_=I[0],T=I[1];return(_+T)*3/4-T}function l(E,I,_){return(I+_)*3/4-_}function d(E){var I,_=i(E),T=_[0],x=_[1],v=new r(l(E,T,x)),h=0,O=x>0?T-4:T,A;for(A=0;A<O;A+=4)I=t[E.charCodeAt(A)]<<18|t[E.charCodeAt(A+1)]<<12|t[E.charCodeAt(A+2)]<<6|t[E.charCodeAt(A+3)],v[h++]=I>>16&255,v[h++]=I>>8&255,v[h++]=I&255;return x===2&&(I=t[E.charCodeAt(A)]<<2|t[E.charCodeAt(A+1)]>>4,v[h++]=I&255),x===1&&(I=t[E.charCodeAt(A)]<<10|t[E.charCodeAt(A+1)]<<4|t[E.charCodeAt(A+2)]>>2,v[h++]=I>>8&255,v[h++]=I&255),v}function g(E){return e[E>>18&63]+e[E>>12&63]+e[E>>6&63]+e[E&63]}function m(E,I,_){for(var T,x=[],v=I;v<_;v+=3)T=(E[v]<<16&16711680)+(E[v+1]<<8&65280)+(E[v+2]&255),x.push(g(T));return x.join("")}function w(E){for(var I,_=E.length,T=_%3,x=[],v=16383,h=0,O=_-T;h<O;h+=v)x.push(m(E,h,h+v>O?O:h+v));return T===1?(I=E[_-1],x.push(e[I>>2]+e[I<<4&63]+"==")):T===2&&(I=(E[_-2]<<8)+E[_-1],x.push(e[I>>10]+e[I>>4&63]+e[I<<2&63]+"=")),x.join("")}return We}var Je={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var An;function _s(){return An||(An=1,Je.read=function(e,t,r,n,a){var o,i,s=a*8-n-1,l=(1<<s)-1,d=l>>1,g=-7,m=r?a-1:0,w=r?-1:1,E=e[t+m];for(m+=w,o=E&(1<<-g)-1,E>>=-g,g+=s;g>0;o=o*256+e[t+m],m+=w,g-=8);for(i=o&(1<<-g)-1,o>>=-g,g+=n;g>0;i=i*256+e[t+m],m+=w,g-=8);if(o===0)o=1-d;else{if(o===l)return i?NaN:(E?-1:1)*(1/0);i=i+Math.pow(2,n),o=o-d}return(E?-1:1)*i*Math.pow(2,o-n)},Je.write=function(e,t,r,n,a,o){var i,s,l,d=o*8-a-1,g=(1<<d)-1,m=g>>1,w=a===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,I=n?1:-1,_=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,i=g):(i=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-i))<1&&(i--,l*=2),i+m>=1?t+=w/l:t+=w*Math.pow(2,1-m),t*l>=2&&(i++,l/=2),i+m>=g?(s=0,i=g):i+m>=1?(s=(t*l-1)*Math.pow(2,a),i=i+m):(s=t*Math.pow(2,m-1)*Math.pow(2,a),i=0));a>=8;e[r+E]=s&255,E+=I,s/=256,a-=8);for(i=i<<a|s,d+=a;d>0;e[r+E]=i&255,E+=I,i/=256,d-=8);e[r+E-I]|=_*128}),Je}/*!
30
69
  * The buffer module from node.js, for the browser.
31
70
  *
32
71
  * @author Feross Aboukhadijeh <https://feross.org>
33
72
  * @license MIT
34
- */var Ur;function wi(){return Ur||(Ur=1,function(u){var n=yi(),c=gi(),a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;u.Buffer=i,u.SlowBuffer=T,u.INSPECT_MAX_BYTES=50;var f=2147483647;u.kMaxLength=f,i.TYPED_ARRAY_SUPPORT=o(),!i.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 o(){try{var s=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(s,e),s.foo()===42}catch{return!1}}Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}});function t(s){if(s>f)throw new RangeError('The value "'+s+'" is invalid for option "size"');var e=new Uint8Array(s);return Object.setPrototypeOf(e,i.prototype),e}function i(s,e,r){if(typeof s=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(s)}return m(s,e,r)}i.poolSize=8192;function m(s,e,r){if(typeof s=="string")return b(s,e);if(ArrayBuffer.isView(s))return O(s);if(s==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s);if(H(s,ArrayBuffer)||s&&H(s.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(H(s,SharedArrayBuffer)||s&&H(s.buffer,SharedArrayBuffer)))return _(s,e,r);if(typeof s=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var l=s.valueOf&&s.valueOf();if(l!=null&&l!==s)return i.from(l,e,r);var v=E(s);if(v)return v;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof s[Symbol.toPrimitive]=="function")return i.from(s[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s)}i.from=function(s,e,r){return m(s,e,r)},Object.setPrototypeOf(i.prototype,Uint8Array.prototype),Object.setPrototypeOf(i,Uint8Array);function N(s){if(typeof s!="number")throw new TypeError('"size" argument must be of type number');if(s<0)throw new RangeError('The value "'+s+'" is invalid for option "size"')}function w(s,e,r){return N(s),s<=0?t(s):e!==void 0?typeof r=="string"?t(s).fill(e,r):t(s).fill(e):t(s)}i.alloc=function(s,e,r){return w(s,e,r)};function y(s){return N(s),t(s<0?0:D(s)|0)}i.allocUnsafe=function(s){return y(s)},i.allocUnsafeSlow=function(s){return y(s)};function b(s,e){if((typeof e!="string"||e==="")&&(e="utf8"),!i.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=p(s,e)|0,l=t(r),v=l.write(s,e);return v!==r&&(l=l.slice(0,v)),l}function x(s){for(var e=s.length<0?0:D(s.length)|0,r=t(e),l=0;l<e;l+=1)r[l]=s[l]&255;return r}function O(s){if(H(s,Uint8Array)){var e=new Uint8Array(s);return _(e.buffer,e.byteOffset,e.byteLength)}return x(s)}function _(s,e,r){if(e<0||s.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(s.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var l;return e===void 0&&r===void 0?l=new Uint8Array(s):r===void 0?l=new Uint8Array(s,e):l=new Uint8Array(s,e,r),Object.setPrototypeOf(l,i.prototype),l}function E(s){if(i.isBuffer(s)){var e=D(s.length)|0,r=t(e);return r.length===0||s.copy(r,0,0,e),r}if(s.length!==void 0)return typeof s.length!="number"||it(s.length)?t(0):x(s);if(s.type==="Buffer"&&Array.isArray(s.data))return x(s.data)}function D(s){if(s>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return s|0}function T(s){return+s!=s&&(s=0),i.alloc(+s)}i.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==i.prototype},i.compare=function(e,r){if(H(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),H(r,Uint8Array)&&(r=i.from(r,r.offset,r.byteLength)),!i.isBuffer(e)||!i.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var l=e.length,v=r.length,M=0,P=Math.min(l,v);M<P;++M)if(e[M]!==r[M]){l=e[M],v=r[M];break}return l<v?-1:v<l?1:0},i.isEncoding=function(e){switch(String(e).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}},i.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return i.alloc(0);var l;if(r===void 0)for(r=0,l=0;l<e.length;++l)r+=e[l].length;var v=i.allocUnsafe(r),M=0;for(l=0;l<e.length;++l){var P=e[l];if(H(P,Uint8Array))M+P.length>v.length?i.from(P).copy(v,M):Uint8Array.prototype.set.call(v,P,M);else if(i.isBuffer(P))P.copy(v,M);else throw new TypeError('"list" argument must be an Array of Buffers');M+=P.length}return v};function p(s,e){if(i.isBuffer(s))return s.length;if(ArrayBuffer.isView(s)||H(s,ArrayBuffer))return s.byteLength;if(typeof s!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof s);var r=s.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&r===0)return 0;for(var v=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return d(s).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return K(s).length;default:if(v)return l?-1:d(s).length;e=(""+e).toLowerCase(),v=!0}}i.byteLength=p;function I(s,e,r){var l=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(s||(s="utf8");;)switch(s){case"hex":return bt(this,e,r);case"utf8":case"utf-8":return Y(this,e,r);case"ascii":return W(this,e,r);case"latin1":case"binary":return vt(this,e,r);case"base64":return $(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gt(this,e,r);default:if(l)throw new TypeError("Unknown encoding: "+s);s=(s+"").toLowerCase(),l=!0}}i.prototype._isBuffer=!0;function A(s,e,r){var l=s[e];s[e]=s[r],s[r]=l}i.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)A(this,r,r+1);return this},i.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)A(this,r,r+3),A(this,r+1,r+2);return this},i.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)A(this,r,r+7),A(this,r+1,r+6),A(this,r+2,r+5),A(this,r+3,r+4);return this},i.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?Y(this,0,e):I.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(e){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:i.compare(this,e)===0},i.prototype.inspect=function(){var e="",r=u.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},a&&(i.prototype[a]=i.prototype.inspect),i.prototype.compare=function(e,r,l,v,M){if(H(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),l===void 0&&(l=e?e.length:0),v===void 0&&(v=0),M===void 0&&(M=this.length),r<0||l>e.length||v<0||M>this.length)throw new RangeError("out of range index");if(v>=M&&r>=l)return 0;if(v>=M)return-1;if(r>=l)return 1;if(r>>>=0,l>>>=0,v>>>=0,M>>>=0,this===e)return 0;for(var P=M-v,q=l-r,V=Math.min(P,q),rt=this.slice(v,M),st=e.slice(r,l),nt=0;nt<V;++nt)if(rt[nt]!==st[nt]){P=rt[nt],q=st[nt];break}return P<q?-1:q<P?1:0};function j(s,e,r,l,v){if(s.length===0)return-1;if(typeof r=="string"?(l=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,it(r)&&(r=v?0:s.length-1),r<0&&(r=s.length+r),r>=s.length){if(v)return-1;r=s.length-1}else if(r<0)if(v)r=0;else return-1;if(typeof e=="string"&&(e=i.from(e,l)),i.isBuffer(e))return e.length===0?-1:U(s,e,r,l,v);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?v?Uint8Array.prototype.indexOf.call(s,e,r):Uint8Array.prototype.lastIndexOf.call(s,e,r):U(s,[e],r,l,v);throw new TypeError("val must be string, number or Buffer")}function U(s,e,r,l,v){var M=1,P=s.length,q=e.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(s.length<2||e.length<2)return-1;M=2,P/=2,q/=2,r/=2}function V(He,Ge){return M===1?He[Ge]:He.readUInt16BE(Ge*M)}var rt;if(v){var st=-1;for(rt=r;rt<P;rt++)if(V(s,rt)===V(e,st===-1?0:rt-st)){if(st===-1&&(st=rt),rt-st+1===q)return st*M}else st!==-1&&(rt-=rt-st),st=-1}else for(r+q>P&&(r=P-q),rt=r;rt>=0;rt--){for(var nt=!0,Ct=0;Ct<q;Ct++)if(V(s,rt+Ct)!==V(e,Ct)){nt=!1;break}if(nt)return rt}return-1}i.prototype.includes=function(e,r,l){return this.indexOf(e,r,l)!==-1},i.prototype.indexOf=function(e,r,l){return j(this,e,r,l,!0)},i.prototype.lastIndexOf=function(e,r,l){return j(this,e,r,l,!1)};function B(s,e,r,l){r=Number(r)||0;var v=s.length-r;l?(l=Number(l),l>v&&(l=v)):l=v;var M=e.length;l>M/2&&(l=M/2);for(var P=0;P<l;++P){var q=parseInt(e.substr(P*2,2),16);if(it(q))return P;s[r+P]=q}return P}function h(s,e,r,l){return tt(d(e,s.length-r),s,r,l)}function F(s,e,r,l){return tt(S(e),s,r,l)}function R(s,e,r,l){return tt(K(e),s,r,l)}function X(s,e,r,l){return tt(L(e,s.length-r),s,r,l)}i.prototype.write=function(e,r,l,v){if(r===void 0)v="utf8",l=this.length,r=0;else if(l===void 0&&typeof r=="string")v=r,l=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(l)?(l=l>>>0,v===void 0&&(v="utf8")):(v=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var M=this.length-r;if((l===void 0||l>M)&&(l=M),e.length>0&&(l<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");v||(v="utf8");for(var P=!1;;)switch(v){case"hex":return B(this,e,r,l);case"utf8":case"utf-8":return h(this,e,r,l);case"ascii":case"latin1":case"binary":return F(this,e,r,l);case"base64":return R(this,e,r,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X(this,e,r,l);default:if(P)throw new TypeError("Unknown encoding: "+v);v=(""+v).toLowerCase(),P=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $(s,e,r){return e===0&&r===s.length?n.fromByteArray(s):n.fromByteArray(s.slice(e,r))}function Y(s,e,r){r=Math.min(s.length,r);for(var l=[],v=e;v<r;){var M=s[v],P=null,q=M>239?4:M>223?3:M>191?2:1;if(v+q<=r){var V,rt,st,nt;switch(q){case 1:M<128&&(P=M);break;case 2:V=s[v+1],(V&192)===128&&(nt=(M&31)<<6|V&63,nt>127&&(P=nt));break;case 3:V=s[v+1],rt=s[v+2],(V&192)===128&&(rt&192)===128&&(nt=(M&15)<<12|(V&63)<<6|rt&63,nt>2047&&(nt<55296||nt>57343)&&(P=nt));break;case 4:V=s[v+1],rt=s[v+2],st=s[v+3],(V&192)===128&&(rt&192)===128&&(st&192)===128&&(nt=(M&15)<<18|(V&63)<<12|(rt&63)<<6|st&63,nt>65535&&nt<1114112&&(P=nt))}}P===null?(P=65533,q=1):P>65535&&(P-=65536,l.push(P>>>10&1023|55296),P=56320|P&1023),l.push(P),v+=q}return z(l)}var J=4096;function z(s){var e=s.length;if(e<=J)return String.fromCharCode.apply(String,s);for(var r="",l=0;l<e;)r+=String.fromCharCode.apply(String,s.slice(l,l+=J));return r}function W(s,e,r){var l="";r=Math.min(s.length,r);for(var v=e;v<r;++v)l+=String.fromCharCode(s[v]&127);return l}function vt(s,e,r){var l="";r=Math.min(s.length,r);for(var v=e;v<r;++v)l+=String.fromCharCode(s[v]);return l}function bt(s,e,r){var l=s.length;(!e||e<0)&&(e=0),(!r||r<0||r>l)&&(r=l);for(var v="",M=e;M<r;++M)v+=C[s[M]];return v}function gt(s,e,r){for(var l=s.slice(e,r),v="",M=0;M<l.length-1;M+=2)v+=String.fromCharCode(l[M]+l[M+1]*256);return v}i.prototype.slice=function(e,r){var l=this.length;e=~~e,r=r===void 0?l:~~r,e<0?(e+=l,e<0&&(e=0)):e>l&&(e=l),r<0?(r+=l,r<0&&(r=0)):r>l&&(r=l),r<e&&(r=e);var v=this.subarray(e,r);return Object.setPrototypeOf(v,i.prototype),v};function Q(s,e,r){if(s%1!==0||s<0)throw new RangeError("offset is not uint");if(s+e>r)throw new RangeError("Trying to access beyond buffer length")}i.prototype.readUintLE=i.prototype.readUIntLE=function(e,r,l){e=e>>>0,r=r>>>0,l||Q(e,r,this.length);for(var v=this[e],M=1,P=0;++P<r&&(M*=256);)v+=this[e+P]*M;return v},i.prototype.readUintBE=i.prototype.readUIntBE=function(e,r,l){e=e>>>0,r=r>>>0,l||Q(e,r,this.length);for(var v=this[e+--r],M=1;r>0&&(M*=256);)v+=this[e+--r]*M;return v},i.prototype.readUint8=i.prototype.readUInt8=function(e,r){return e=e>>>0,r||Q(e,1,this.length),this[e]},i.prototype.readUint16LE=i.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Q(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUint16BE=i.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Q(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUint32LE=i.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},i.prototype.readUint32BE=i.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,r,l){e=e>>>0,r=r>>>0,l||Q(e,r,this.length);for(var v=this[e],M=1,P=0;++P<r&&(M*=256);)v+=this[e+P]*M;return M*=128,v>=M&&(v-=Math.pow(2,8*r)),v},i.prototype.readIntBE=function(e,r,l){e=e>>>0,r=r>>>0,l||Q(e,r,this.length);for(var v=r,M=1,P=this[e+--v];v>0&&(M*=256);)P+=this[e+--v]*M;return M*=128,P>=M&&(P-=Math.pow(2,8*r)),P},i.prototype.readInt8=function(e,r){return e=e>>>0,r||Q(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},i.prototype.readInt16LE=function(e,r){e=e>>>0,r||Q(e,2,this.length);var l=this[e]|this[e+1]<<8;return l&32768?l|4294901760:l},i.prototype.readInt16BE=function(e,r){e=e>>>0,r||Q(e,2,this.length);var l=this[e+1]|this[e]<<8;return l&32768?l|4294901760:l},i.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,r){return e=e>>>0,r||Q(e,4,this.length),c.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Q(e,4,this.length),c.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Q(e,8,this.length),c.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Q(e,8,this.length),c.read(this,e,!1,52,8)};function et(s,e,r,l,v,M){if(!i.isBuffer(s))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>v||e<M)throw new RangeError('"value" argument is out of bounds');if(r+l>s.length)throw new RangeError("Index out of range")}i.prototype.writeUintLE=i.prototype.writeUIntLE=function(e,r,l,v){if(e=+e,r=r>>>0,l=l>>>0,!v){var M=Math.pow(2,8*l)-1;et(this,e,r,l,M,0)}var P=1,q=0;for(this[r]=e&255;++q<l&&(P*=256);)this[r+q]=e/P&255;return r+l},i.prototype.writeUintBE=i.prototype.writeUIntBE=function(e,r,l,v){if(e=+e,r=r>>>0,l=l>>>0,!v){var M=Math.pow(2,8*l)-1;et(this,e,r,l,M,0)}var P=l-1,q=1;for(this[r+P]=e&255;--P>=0&&(q*=256);)this[r+P]=e/q&255;return r+l},i.prototype.writeUint8=i.prototype.writeUInt8=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,1,255,0),this[r]=e&255,r+1},i.prototype.writeUint16LE=i.prototype.writeUInt16LE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2},i.prototype.writeUint16BE=i.prototype.writeUInt16BE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2},i.prototype.writeUint32LE=i.prototype.writeUInt32LE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4},i.prototype.writeUint32BE=i.prototype.writeUInt32BE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4},i.prototype.writeIntLE=function(e,r,l,v){if(e=+e,r=r>>>0,!v){var M=Math.pow(2,8*l-1);et(this,e,r,l,M-1,-M)}var P=0,q=1,V=0;for(this[r]=e&255;++P<l&&(q*=256);)e<0&&V===0&&this[r+P-1]!==0&&(V=1),this[r+P]=(e/q>>0)-V&255;return r+l},i.prototype.writeIntBE=function(e,r,l,v){if(e=+e,r=r>>>0,!v){var M=Math.pow(2,8*l-1);et(this,e,r,l,M-1,-M)}var P=l-1,q=1,V=0;for(this[r+P]=e&255;--P>=0&&(q*=256);)e<0&&V===0&&this[r+P+1]!==0&&(V=1),this[r+P]=(e/q>>0)-V&255;return r+l},i.prototype.writeInt8=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1},i.prototype.writeInt16LE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2},i.prototype.writeInt16BE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2},i.prototype.writeInt32LE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4},i.prototype.writeInt32BE=function(e,r,l){return e=+e,r=r>>>0,l||et(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Tt(s,e,r,l,v,M){if(r+l>s.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function k(s,e,r,l,v){return e=+e,r=r>>>0,v||Tt(s,e,r,4),c.write(s,e,r,l,23,4),r+4}i.prototype.writeFloatLE=function(e,r,l){return k(this,e,r,!0,l)},i.prototype.writeFloatBE=function(e,r,l){return k(this,e,r,!1,l)};function wt(s,e,r,l,v){return e=+e,r=r>>>0,v||Tt(s,e,r,8),c.write(s,e,r,l,52,8),r+8}i.prototype.writeDoubleLE=function(e,r,l){return wt(this,e,r,!0,l)},i.prototype.writeDoubleBE=function(e,r,l){return wt(this,e,r,!1,l)},i.prototype.copy=function(e,r,l,v){if(!i.isBuffer(e))throw new TypeError("argument should be a Buffer");if(l||(l=0),!v&&v!==0&&(v=this.length),r>=e.length&&(r=e.length),r||(r=0),v>0&&v<l&&(v=l),v===l||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(v<0)throw new RangeError("sourceEnd out of bounds");v>this.length&&(v=this.length),e.length-r<v-l&&(v=e.length-r+l);var M=v-l;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,l,v):Uint8Array.prototype.set.call(e,this.subarray(l,v),r),M},i.prototype.fill=function(e,r,l,v){if(typeof e=="string"){if(typeof r=="string"?(v=r,r=0,l=this.length):typeof l=="string"&&(v=l,l=this.length),v!==void 0&&typeof v!="string")throw new TypeError("encoding must be a string");if(typeof v=="string"&&!i.isEncoding(v))throw new TypeError("Unknown encoding: "+v);if(e.length===1){var M=e.charCodeAt(0);(v==="utf8"&&M<128||v==="latin1")&&(e=M)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<l)throw new RangeError("Out of range index");if(l<=r)return this;r=r>>>0,l=l===void 0?this.length:l>>>0,e||(e=0);var P;if(typeof e=="number")for(P=r;P<l;++P)this[P]=e;else{var q=i.isBuffer(e)?e:i.from(e,v),V=q.length;if(V===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(P=0;P<l-r;++P)this[P+r]=q[P%V]}return this};var It=/[^+/0-9A-Za-z-_]/g;function g(s){if(s=s.split("=")[0],s=s.trim().replace(It,""),s.length<2)return"";for(;s.length%4!==0;)s=s+"=";return s}function d(s,e){e=e||1/0;for(var r,l=s.length,v=null,M=[],P=0;P<l;++P){if(r=s.charCodeAt(P),r>55295&&r<57344){if(!v){if(r>56319){(e-=3)>-1&&M.push(239,191,189);continue}else if(P+1===l){(e-=3)>-1&&M.push(239,191,189);continue}v=r;continue}if(r<56320){(e-=3)>-1&&M.push(239,191,189),v=r;continue}r=(v-55296<<10|r-56320)+65536}else v&&(e-=3)>-1&&M.push(239,191,189);if(v=null,r<128){if((e-=1)<0)break;M.push(r)}else if(r<2048){if((e-=2)<0)break;M.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;M.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;M.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return M}function S(s){for(var e=[],r=0;r<s.length;++r)e.push(s.charCodeAt(r)&255);return e}function L(s,e){for(var r,l,v,M=[],P=0;P<s.length&&!((e-=2)<0);++P)r=s.charCodeAt(P),l=r>>8,v=r%256,M.push(v),M.push(l);return M}function K(s){return n.toByteArray(g(s))}function tt(s,e,r,l){for(var v=0;v<l&&!(v+r>=e.length||v>=s.length);++v)e[v+r]=s[v];return v}function H(s,e){return s instanceof e||s!=null&&s.constructor!=null&&s.constructor.name!=null&&s.constructor.name===e.name}function it(s){return s!==s}var C=function(){for(var s="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var l=r*16,v=0;v<16;++v)e[l+v]=s[r]+s[v];return e}()}(De)),De}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Xr;function bi(){return Xr||(Xr=1,function(u,n){var c=wi(),a=c.Buffer;function f(t,i){for(var m in t)i[m]=t[m]}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?u.exports=c:(f(c,n),n.Buffer=o);function o(t,i,m){return a(t,i,m)}o.prototype=Object.create(a.prototype),f(a,o),o.from=function(t,i,m){if(typeof t=="number")throw new TypeError("Argument must not be a number");return a(t,i,m)},o.alloc=function(t,i,m){if(typeof t!="number")throw new TypeError("Argument must be a number");var N=a(t);return i!==void 0?typeof m=="string"?N.fill(i,m):N.fill(i):N.fill(0),N},o.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return a(t)},o.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return c.SlowBuffer(t)}}(Lt,Lt.exports)),Lt.exports}var qr;function Ei(){if(qr)return xe;qr=1;var u=bi().Buffer,n=u.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 c(D){if(!D)return"utf8";for(var T;;)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(T)return;D=(""+D).toLowerCase(),T=!0}}function a(D){var T=c(D);if(typeof T!="string"&&(u.isEncoding===n||!n(D)))throw new Error("Unknown encoding: "+D);return T||D}xe.StringDecoder=f;function f(D){this.encoding=a(D);var T;switch(this.encoding){case"utf16le":this.text=y,this.end=b,T=4;break;case"utf8":this.fillLast=m,T=4;break;case"base64":this.text=x,this.end=O,T=3;break;default:this.write=_,this.end=E;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=u.allocUnsafe(T)}f.prototype.write=function(D){if(D.length===0)return"";var T,p;if(this.lastNeed){if(T=this.fillLast(D),T===void 0)return"";p=this.lastNeed,this.lastNeed=0}else p=0;return p<D.length?T?T+this.text(D,p):this.text(D,p):T||""},f.prototype.end=w,f.prototype.text=N,f.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 o(D){return D<=127?0:D>>5===6?2:D>>4===14?3:D>>3===30?4:D>>6===2?-1:-2}function t(D,T,p){var I=T.length-1;if(I<p)return 0;var A=o(T[I]);return A>=0?(A>0&&(D.lastNeed=A-1),A):--I<p||A===-2?0:(A=o(T[I]),A>=0?(A>0&&(D.lastNeed=A-2),A):--I<p||A===-2?0:(A=o(T[I]),A>=0?(A>0&&(A===2?A=0:D.lastNeed=A-3),A):0))}function i(D,T,p){if((T[0]&192)!==128)return D.lastNeed=0,"�";if(D.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return D.lastNeed=1,"�";if(D.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return D.lastNeed=2,"�"}}function m(D){var T=this.lastTotal-this.lastNeed,p=i(this,D);if(p!==void 0)return p;if(this.lastNeed<=D.length)return D.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);D.copy(this.lastChar,T,0,D.length),this.lastNeed-=D.length}function N(D,T){var p=t(this,D,T);if(!this.lastNeed)return D.toString("utf8",T);this.lastTotal=p;var I=D.length-(p-this.lastNeed);return D.copy(this.lastChar,0,I),D.toString("utf8",T,I)}function w(D){var T=D&&D.length?this.write(D):"";return this.lastNeed?T+"�":T}function y(D,T){if((D.length-T)%2===0){var p=D.toString("utf16le",T);if(p){var I=p.charCodeAt(p.length-1);if(I>=55296&&I<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=D[D.length-2],this.lastChar[1]=D[D.length-1],p.slice(0,-1)}return p}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=D[D.length-1],D.toString("utf16le",T,D.length-1)}function b(D){var T=D&&D.length?this.write(D):"";if(this.lastNeed){var p=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,p)}return T}function x(D,T){var p=(D.length-T)%3;return p===0?D.toString("base64",T):(this.lastNeed=3-p,this.lastTotal=3,p===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",T,D.length-p))}function O(D){var T=D&&D.length?this.write(D):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function _(D){return D.toString(this.encoding)}function E(D){return D&&D.length?this.write(D):""}return xe}var kr;function Ti(){return kr||(kr=1,function(u){(function(n){n.parser=function(g,d){return new a(g,d)},n.SAXParser=a,n.SAXStream=w,n.createStream=N,n.MAX_BUFFER_LENGTH=64*1024;var c=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];n.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"];function a(g,d){if(!(this instanceof a))return new a(g,d);var S=this;o(S),S.q=S.c="",S.bufferCheckPosition=n.MAX_BUFFER_LENGTH,S.opt=d||{},S.opt.lowercase=S.opt.lowercase||S.opt.lowercasetags,S.looseCase=S.opt.lowercase?"toLowerCase":"toUpperCase",S.tags=[],S.closed=S.closedRoot=S.sawRoot=!1,S.tag=S.error=null,S.strict=!!g,S.noscript=!!(g||S.opt.noscript),S.state=h.BEGIN,S.strictEntities=S.opt.strictEntities,S.ENTITIES=S.strictEntities?Object.create(n.XML_ENTITIES):Object.create(n.ENTITIES),S.attribList=[],S.opt.xmlns&&(S.ns=Object.create(_)),S.opt.unquotedAttributeValues===void 0&&(S.opt.unquotedAttributeValues=!g),S.trackPosition=S.opt.position!==!1,S.trackPosition&&(S.position=S.line=S.column=0),R(S,"onready")}Object.create||(Object.create=function(g){function d(){}d.prototype=g;var S=new d;return S}),Object.keys||(Object.keys=function(g){var d=[];for(var S in g)g.hasOwnProperty(S)&&d.push(S);return d});function f(g){for(var d=Math.max(n.MAX_BUFFER_LENGTH,10),S=0,L=0,K=c.length;L<K;L++){var tt=g[c[L]].length;if(tt>d)switch(c[L]){case"textNode":$(g);break;case"cdata":X(g,"oncdata",g.cdata),g.cdata="";break;case"script":X(g,"onscript",g.script),g.script="";break;default:J(g,"Max buffer length exceeded: "+c[L])}S=Math.max(S,tt)}var H=n.MAX_BUFFER_LENGTH-S;g.bufferCheckPosition=H+g.position}function o(g){for(var d=0,S=c.length;d<S;d++)g[c[d]]=""}function t(g){$(g),g.cdata!==""&&(X(g,"oncdata",g.cdata),g.cdata=""),g.script!==""&&(X(g,"onscript",g.script),g.script="")}a.prototype={end:function(){z(this)},write:It,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){t(this)}};var i;try{i=require("stream").Stream}catch{i=function(){}}i||(i=function(){});var m=n.EVENTS.filter(function(g){return g!=="error"&&g!=="end"});function N(g,d){return new w(g,d)}function w(g,d){if(!(this instanceof w))return new w(g,d);i.apply(this),this._parser=new a(g,d),this.writable=!0,this.readable=!0;var S=this;this._parser.onend=function(){S.emit("end")},this._parser.onerror=function(L){S.emit("error",L),S._parser.error=null},this._decoder=null,m.forEach(function(L){Object.defineProperty(S,"on"+L,{get:function(){return S._parser["on"+L]},set:function(K){if(!K)return S.removeAllListeners(L),S._parser["on"+L]=K,K;S.on(L,K)},enumerable:!0,configurable:!1})})}w.prototype=Object.create(i.prototype,{constructor:{value:w}}),w.prototype.write=function(g){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(g)){if(!this._decoder){var d=Ei().StringDecoder;this._decoder=new d("utf8")}g=this._decoder.write(g)}return this._parser.write(g.toString()),this.emit("data",g),!0},w.prototype.end=function(g){return g&&g.length&&this.write(g),this._parser.end(),!0},w.prototype.on=function(g,d){var S=this;return!S._parser["on"+g]&&m.indexOf(g)!==-1&&(S._parser["on"+g]=function(){var L=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);L.splice(0,0,g),S.emit.apply(S,L)}),i.prototype.on.call(S,g,d)};var y="[CDATA[",b="DOCTYPE",x="http://www.w3.org/XML/1998/namespace",O="http://www.w3.org/2000/xmlns/",_={xml:x,xmlns:O},E=/[:_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-]/,T=/[#:_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]/,p=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function I(g){return g===" "||g===`
35
- `||g==="\r"||g===" "}function A(g){return g==='"'||g==="'"}function j(g){return g===">"||I(g)}function U(g,d){return g.test(d)}function B(g,d){return!U(g,d)}var h=0;n.STATE={BEGIN:h++,BEGIN_WHITESPACE:h++,TEXT:h++,TEXT_ENTITY:h++,OPEN_WAKA:h++,SGML_DECL:h++,SGML_DECL_QUOTED:h++,DOCTYPE:h++,DOCTYPE_QUOTED:h++,DOCTYPE_DTD:h++,DOCTYPE_DTD_QUOTED:h++,COMMENT_STARTING:h++,COMMENT:h++,COMMENT_ENDING:h++,COMMENT_ENDED:h++,CDATA:h++,CDATA_ENDING:h++,CDATA_ENDING_2:h++,PROC_INST:h++,PROC_INST_BODY:h++,PROC_INST_ENDING:h++,OPEN_TAG:h++,OPEN_TAG_SLASH:h++,ATTRIB:h++,ATTRIB_NAME:h++,ATTRIB_NAME_SAW_WHITE:h++,ATTRIB_VALUE:h++,ATTRIB_VALUE_QUOTED:h++,ATTRIB_VALUE_CLOSED:h++,ATTRIB_VALUE_UNQUOTED:h++,ATTRIB_VALUE_ENTITY_Q:h++,ATTRIB_VALUE_ENTITY_U:h++,CLOSE_TAG:h++,CLOSE_TAG_SAW_WHITE:h++,SCRIPT:h++,SCRIPT_ENDING:h++},n.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},n.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(n.ENTITIES).forEach(function(g){var d=n.ENTITIES[g],S=typeof d=="number"?String.fromCharCode(d):d;n.ENTITIES[g]=S});for(var F in n.STATE)n.STATE[n.STATE[F]]=F;h=n.STATE;function R(g,d,S){g[d]&&g[d](S)}function X(g,d,S){g.textNode&&$(g),R(g,d,S)}function $(g){g.textNode=Y(g.opt,g.textNode),g.textNode&&R(g,"ontext",g.textNode),g.textNode=""}function Y(g,d){return g.trim&&(d=d.trim()),g.normalize&&(d=d.replace(/\s+/g," ")),d}function J(g,d){return $(g),g.trackPosition&&(d+=`
36
- Line: `+g.line+`
37
- Column: `+g.column+`
38
- Char: `+g.c),d=new Error(d),g.error=d,R(g,"onerror",d),g}function z(g){return g.sawRoot&&!g.closedRoot&&W(g,"Unclosed root tag"),g.state!==h.BEGIN&&g.state!==h.BEGIN_WHITESPACE&&g.state!==h.TEXT&&J(g,"Unexpected end"),$(g),g.c="",g.closed=!0,R(g,"onend"),a.call(g,g.strict,g.opt),g}function W(g,d){if(typeof g!="object"||!(g instanceof a))throw new Error("bad call to strictFail");g.strict&&J(g,d)}function vt(g){g.strict||(g.tagName=g.tagName[g.looseCase]());var d=g.tags[g.tags.length-1]||g,S=g.tag={name:g.tagName,attributes:{}};g.opt.xmlns&&(S.ns=d.ns),g.attribList.length=0,X(g,"onopentagstart",S)}function bt(g,d){var S=g.indexOf(":"),L=S<0?["",g]:g.split(":"),K=L[0],tt=L[1];return d&&g==="xmlns"&&(K="xmlns",tt=""),{prefix:K,local:tt}}function gt(g){if(g.strict||(g.attribName=g.attribName[g.looseCase]()),g.attribList.indexOf(g.attribName)!==-1||g.tag.attributes.hasOwnProperty(g.attribName)){g.attribName=g.attribValue="";return}if(g.opt.xmlns){var d=bt(g.attribName,!0),S=d.prefix,L=d.local;if(S==="xmlns")if(L==="xml"&&g.attribValue!==x)W(g,"xml: prefix must be bound to "+x+`
39
- Actual: `+g.attribValue);else if(L==="xmlns"&&g.attribValue!==O)W(g,"xmlns: prefix must be bound to "+O+`
40
- Actual: `+g.attribValue);else{var K=g.tag,tt=g.tags[g.tags.length-1]||g;K.ns===tt.ns&&(K.ns=Object.create(tt.ns)),K.ns[L]=g.attribValue}g.attribList.push([g.attribName,g.attribValue])}else g.tag.attributes[g.attribName]=g.attribValue,X(g,"onattribute",{name:g.attribName,value:g.attribValue});g.attribName=g.attribValue=""}function Q(g,d){if(g.opt.xmlns){var S=g.tag,L=bt(g.tagName);S.prefix=L.prefix,S.local=L.local,S.uri=S.ns[L.prefix]||"",S.prefix&&!S.uri&&(W(g,"Unbound namespace prefix: "+JSON.stringify(g.tagName)),S.uri=L.prefix);var K=g.tags[g.tags.length-1]||g;S.ns&&K.ns!==S.ns&&Object.keys(S.ns).forEach(function(P){X(g,"onopennamespace",{prefix:P,uri:S.ns[P]})});for(var tt=0,H=g.attribList.length;tt<H;tt++){var it=g.attribList[tt],C=it[0],s=it[1],e=bt(C,!0),r=e.prefix,l=e.local,v=r===""?"":S.ns[r]||"",M={name:C,value:s,prefix:r,local:l,uri:v};r&&r!=="xmlns"&&!v&&(W(g,"Unbound namespace prefix: "+JSON.stringify(r)),M.uri=r),g.tag.attributes[C]=M,X(g,"onattribute",M)}g.attribList.length=0}g.tag.isSelfClosing=!!d,g.sawRoot=!0,g.tags.push(g.tag),X(g,"onopentag",g.tag),d||(!g.noscript&&g.tagName.toLowerCase()==="script"?g.state=h.SCRIPT:g.state=h.TEXT,g.tag=null,g.tagName=""),g.attribName=g.attribValue="",g.attribList.length=0}function et(g){if(!g.tagName){W(g,"Weird empty close tag."),g.textNode+="</>",g.state=h.TEXT;return}if(g.script){if(g.tagName!=="script"){g.script+="</"+g.tagName+">",g.tagName="",g.state=h.SCRIPT;return}X(g,"onscript",g.script),g.script=""}var d=g.tags.length,S=g.tagName;g.strict||(S=S[g.looseCase]());for(var L=S;d--;){var K=g.tags[d];if(K.name!==L)W(g,"Unexpected close tag");else break}if(d<0){W(g,"Unmatched closing tag: "+g.tagName),g.textNode+="</"+g.tagName+">",g.state=h.TEXT;return}g.tagName=S;for(var tt=g.tags.length;tt-- >d;){var H=g.tag=g.tags.pop();g.tagName=g.tag.name,X(g,"onclosetag",g.tagName);var it={};for(var C in H.ns)it[C]=H.ns[C];var s=g.tags[g.tags.length-1]||g;g.opt.xmlns&&H.ns!==s.ns&&Object.keys(H.ns).forEach(function(e){var r=H.ns[e];X(g,"onclosenamespace",{prefix:e,uri:r})})}d===0&&(g.closedRoot=!0),g.tagName=g.attribValue=g.attribName="",g.attribList.length=0,g.state=h.TEXT}function Tt(g){var d=g.entity,S=d.toLowerCase(),L,K="";return g.ENTITIES[d]?g.ENTITIES[d]:g.ENTITIES[S]?g.ENTITIES[S]:(d=S,d.charAt(0)==="#"&&(d.charAt(1)==="x"?(d=d.slice(2),L=parseInt(d,16),K=L.toString(16)):(d=d.slice(1),L=parseInt(d,10),K=L.toString(10))),d=d.replace(/^0+/,""),isNaN(L)||K.toLowerCase()!==d?(W(g,"Invalid character entity"),"&"+g.entity+";"):String.fromCodePoint(L))}function k(g,d){d==="<"?(g.state=h.OPEN_WAKA,g.startTagPosition=g.position):I(d)||(W(g,"Non-whitespace before first tag."),g.textNode=d,g.state=h.TEXT)}function wt(g,d){var S="";return d<g.length&&(S=g.charAt(d)),S}function It(g){var d=this;if(this.error)throw this.error;if(d.closed)return J(d,"Cannot write after close. Assign an onready handler.");if(g===null)return z(d);typeof g=="object"&&(g=g.toString());for(var S=0,L="";L=wt(g,S++),d.c=L,!!L;)switch(d.trackPosition&&(d.position++,L===`
41
- `?(d.line++,d.column=0):d.column++),d.state){case h.BEGIN:if(d.state=h.BEGIN_WHITESPACE,L==="\uFEFF")continue;k(d,L);continue;case h.BEGIN_WHITESPACE:k(d,L);continue;case h.TEXT:if(d.sawRoot&&!d.closedRoot){for(var K=S-1;L&&L!=="<"&&L!=="&";)L=wt(g,S++),L&&d.trackPosition&&(d.position++,L===`
42
- `?(d.line++,d.column=0):d.column++);d.textNode+=g.substring(K,S-1)}L==="<"&&!(d.sawRoot&&d.closedRoot&&!d.strict)?(d.state=h.OPEN_WAKA,d.startTagPosition=d.position):(!I(L)&&(!d.sawRoot||d.closedRoot)&&W(d,"Text data outside of root node."),L==="&"?d.state=h.TEXT_ENTITY:d.textNode+=L);continue;case h.SCRIPT:L==="<"?d.state=h.SCRIPT_ENDING:d.script+=L;continue;case h.SCRIPT_ENDING:L==="/"?d.state=h.CLOSE_TAG:(d.script+="<"+L,d.state=h.SCRIPT);continue;case h.OPEN_WAKA:if(L==="!")d.state=h.SGML_DECL,d.sgmlDecl="";else if(!I(L))if(U(E,L))d.state=h.OPEN_TAG,d.tagName=L;else if(L==="/")d.state=h.CLOSE_TAG,d.tagName="";else if(L==="?")d.state=h.PROC_INST,d.procInstName=d.procInstBody="";else{if(W(d,"Unencoded <"),d.startTagPosition+1<d.position){var tt=d.position-d.startTagPosition;L=new Array(tt).join(" ")+L}d.textNode+="<"+L,d.state=h.TEXT}continue;case h.SGML_DECL:if(d.sgmlDecl+L==="--"){d.state=h.COMMENT,d.comment="",d.sgmlDecl="";continue}d.doctype&&d.doctype!==!0&&d.sgmlDecl?(d.state=h.DOCTYPE_DTD,d.doctype+="<!"+d.sgmlDecl+L,d.sgmlDecl=""):(d.sgmlDecl+L).toUpperCase()===y?(X(d,"onopencdata"),d.state=h.CDATA,d.sgmlDecl="",d.cdata=""):(d.sgmlDecl+L).toUpperCase()===b?(d.state=h.DOCTYPE,(d.doctype||d.sawRoot)&&W(d,"Inappropriately located doctype declaration"),d.doctype="",d.sgmlDecl=""):L===">"?(X(d,"onsgmldeclaration",d.sgmlDecl),d.sgmlDecl="",d.state=h.TEXT):(A(L)&&(d.state=h.SGML_DECL_QUOTED),d.sgmlDecl+=L);continue;case h.SGML_DECL_QUOTED:L===d.q&&(d.state=h.SGML_DECL,d.q=""),d.sgmlDecl+=L;continue;case h.DOCTYPE:L===">"?(d.state=h.TEXT,X(d,"ondoctype",d.doctype),d.doctype=!0):(d.doctype+=L,L==="["?d.state=h.DOCTYPE_DTD:A(L)&&(d.state=h.DOCTYPE_QUOTED,d.q=L));continue;case h.DOCTYPE_QUOTED:d.doctype+=L,L===d.q&&(d.q="",d.state=h.DOCTYPE);continue;case h.DOCTYPE_DTD:L==="]"?(d.doctype+=L,d.state=h.DOCTYPE):L==="<"?(d.state=h.OPEN_WAKA,d.startTagPosition=d.position):A(L)?(d.doctype+=L,d.state=h.DOCTYPE_DTD_QUOTED,d.q=L):d.doctype+=L;continue;case h.DOCTYPE_DTD_QUOTED:d.doctype+=L,L===d.q&&(d.state=h.DOCTYPE_DTD,d.q="");continue;case h.COMMENT:L==="-"?d.state=h.COMMENT_ENDING:d.comment+=L;continue;case h.COMMENT_ENDING:L==="-"?(d.state=h.COMMENT_ENDED,d.comment=Y(d.opt,d.comment),d.comment&&X(d,"oncomment",d.comment),d.comment=""):(d.comment+="-"+L,d.state=h.COMMENT);continue;case h.COMMENT_ENDED:L!==">"?(W(d,"Malformed comment"),d.comment+="--"+L,d.state=h.COMMENT):d.doctype&&d.doctype!==!0?d.state=h.DOCTYPE_DTD:d.state=h.TEXT;continue;case h.CDATA:L==="]"?d.state=h.CDATA_ENDING:d.cdata+=L;continue;case h.CDATA_ENDING:L==="]"?d.state=h.CDATA_ENDING_2:(d.cdata+="]"+L,d.state=h.CDATA);continue;case h.CDATA_ENDING_2:L===">"?(d.cdata&&X(d,"oncdata",d.cdata),X(d,"onclosecdata"),d.cdata="",d.state=h.TEXT):L==="]"?d.cdata+="]":(d.cdata+="]]"+L,d.state=h.CDATA);continue;case h.PROC_INST:L==="?"?d.state=h.PROC_INST_ENDING:I(L)?d.state=h.PROC_INST_BODY:d.procInstName+=L;continue;case h.PROC_INST_BODY:if(!d.procInstBody&&I(L))continue;L==="?"?d.state=h.PROC_INST_ENDING:d.procInstBody+=L;continue;case h.PROC_INST_ENDING:L===">"?(X(d,"onprocessinginstruction",{name:d.procInstName,body:d.procInstBody}),d.procInstName=d.procInstBody="",d.state=h.TEXT):(d.procInstBody+="?"+L,d.state=h.PROC_INST_BODY);continue;case h.OPEN_TAG:U(D,L)?d.tagName+=L:(vt(d),L===">"?Q(d):L==="/"?d.state=h.OPEN_TAG_SLASH:(I(L)||W(d,"Invalid character in tag name"),d.state=h.ATTRIB));continue;case h.OPEN_TAG_SLASH:L===">"?(Q(d,!0),et(d)):(W(d,"Forward-slash in opening tag not followed by >"),d.state=h.ATTRIB);continue;case h.ATTRIB:if(I(L))continue;L===">"?Q(d):L==="/"?d.state=h.OPEN_TAG_SLASH:U(E,L)?(d.attribName=L,d.attribValue="",d.state=h.ATTRIB_NAME):W(d,"Invalid attribute name");continue;case h.ATTRIB_NAME:L==="="?d.state=h.ATTRIB_VALUE:L===">"?(W(d,"Attribute without value"),d.attribValue=d.attribName,gt(d),Q(d)):I(L)?d.state=h.ATTRIB_NAME_SAW_WHITE:U(D,L)?d.attribName+=L:W(d,"Invalid attribute name");continue;case h.ATTRIB_NAME_SAW_WHITE:if(L==="=")d.state=h.ATTRIB_VALUE;else{if(I(L))continue;W(d,"Attribute without value"),d.tag.attributes[d.attribName]="",d.attribValue="",X(d,"onattribute",{name:d.attribName,value:""}),d.attribName="",L===">"?Q(d):U(E,L)?(d.attribName=L,d.state=h.ATTRIB_NAME):(W(d,"Invalid attribute name"),d.state=h.ATTRIB)}continue;case h.ATTRIB_VALUE:if(I(L))continue;A(L)?(d.q=L,d.state=h.ATTRIB_VALUE_QUOTED):(d.opt.unquotedAttributeValues||J(d,"Unquoted attribute value"),d.state=h.ATTRIB_VALUE_UNQUOTED,d.attribValue=L);continue;case h.ATTRIB_VALUE_QUOTED:if(L!==d.q){L==="&"?d.state=h.ATTRIB_VALUE_ENTITY_Q:d.attribValue+=L;continue}gt(d),d.q="",d.state=h.ATTRIB_VALUE_CLOSED;continue;case h.ATTRIB_VALUE_CLOSED:I(L)?d.state=h.ATTRIB:L===">"?Q(d):L==="/"?d.state=h.OPEN_TAG_SLASH:U(E,L)?(W(d,"No whitespace between attributes"),d.attribName=L,d.attribValue="",d.state=h.ATTRIB_NAME):W(d,"Invalid attribute name");continue;case h.ATTRIB_VALUE_UNQUOTED:if(!j(L)){L==="&"?d.state=h.ATTRIB_VALUE_ENTITY_U:d.attribValue+=L;continue}gt(d),L===">"?Q(d):d.state=h.ATTRIB;continue;case h.CLOSE_TAG:if(d.tagName)L===">"?et(d):U(D,L)?d.tagName+=L:d.script?(d.script+="</"+d.tagName,d.tagName="",d.state=h.SCRIPT):(I(L)||W(d,"Invalid tagname in closing tag"),d.state=h.CLOSE_TAG_SAW_WHITE);else{if(I(L))continue;B(E,L)?d.script?(d.script+="</"+L,d.state=h.SCRIPT):W(d,"Invalid tagname in closing tag."):d.tagName=L}continue;case h.CLOSE_TAG_SAW_WHITE:if(I(L))continue;L===">"?et(d):W(d,"Invalid characters in closing tag");continue;case h.TEXT_ENTITY:case h.ATTRIB_VALUE_ENTITY_Q:case h.ATTRIB_VALUE_ENTITY_U:var H,it;switch(d.state){case h.TEXT_ENTITY:H=h.TEXT,it="textNode";break;case h.ATTRIB_VALUE_ENTITY_Q:H=h.ATTRIB_VALUE_QUOTED,it="attribValue";break;case h.ATTRIB_VALUE_ENTITY_U:H=h.ATTRIB_VALUE_UNQUOTED,it="attribValue";break}if(L===";"){var C=Tt(d);d.opt.unparsedEntities&&!Object.values(n.XML_ENTITIES).includes(C)?(d.entity="",d.state=H,d.write(C)):(d[it]+=C,d.entity="",d.state=H)}else U(d.entity.length?p:T,L)?d.entity+=L:(W(d,"Invalid character in entity name"),d[it]+="&"+d.entity+L,d.entity="",d.state=H);continue;default:throw new Error(d,"Unknown state: "+d.state)}return d.position>=d.bufferCheckPosition&&f(d),d}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var g=String.fromCharCode,d=Math.floor,S=function(){var L=16384,K=[],tt,H,it=-1,C=arguments.length;if(!C)return"";for(var s="";++it<C;){var e=Number(arguments[it]);if(!isFinite(e)||e<0||e>1114111||d(e)!==e)throw RangeError("Invalid code point: "+e);e<=65535?K.push(e):(e-=65536,tt=(e>>10)+55296,H=e%1024+56320,K.push(tt,H)),(it+1===C||K.length>L)&&(s+=g.apply(null,K),K.length=0)}return s};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:S,configurable:!0,writable:!0}):String.fromCodePoint=S}()})(u)}(Te)),Te}var ve={},Vr;function xi(){return Vr||(Vr=1,function(){ve.stripBOM=function(u){return u[0]==="\uFEFF"?u.substring(1):u}}.call(G)),ve}var Et={},$r;function hn(){return $r||($r=1,function(){var u;u=new RegExp(/(?!xmlns)^.*:/),Et.normalize=function(n){return n.toLowerCase()},Et.firstCharLowerCase=function(n){return n.charAt(0).toLowerCase()+n.slice(1)},Et.stripPrefix=function(n){return n.replace(u,"")},Et.parseNumbers=function(n){return isNaN(n)||(n=n%1===0?parseInt(n,10):parseFloat(n)),n},Et.parseBooleans=function(n){return/^(?:true|false)$/i.test(n)&&(n=n.toLowerCase()==="true"),n}}.call(G)),Et}var Wr;function Di(){return Wr||(Wr=1,function(u){(function(){var n,c,a,f,o,t,i,m,N,w=function(x,O){return function(){return x.apply(O,arguments)}},y=function(x,O){for(var _ in O)b.call(O,_)&&(x[_]=O[_]);function E(){this.constructor=x}return E.prototype=O.prototype,x.prototype=new E,x.__super__=O.prototype,x},b={}.hasOwnProperty;m=Ti(),f=Le,n=xi(),i=hn(),N=Pn.setImmediate,c=_e().defaults,o=function(x){return typeof x=="object"&&x!=null&&Object.keys(x).length===0},t=function(x,O,_){var E,D,T;for(E=0,D=x.length;E<D;E++)T=x[E],O=T(O,_);return O},a=function(x,O,_){var E;return E=Object.create(null),E.value=_,E.writable=!0,E.enumerable=!0,E.configurable=!0,Object.defineProperty(x,O,E)},u.Parser=function(x){y(O,x);function O(_){this.parseStringPromise=w(this.parseStringPromise,this),this.parseString=w(this.parseString,this),this.reset=w(this.reset,this),this.assignOrPush=w(this.assignOrPush,this),this.processAsync=w(this.processAsync,this);var E,D,T;if(!(this instanceof u.Parser))return new u.Parser(_);this.options={},D=c["0.2"];for(E in D)b.call(D,E)&&(T=D[E],this.options[E]=T);for(E in _)b.call(_,E)&&(T=_[E],this.options[E]=T);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(i.normalize)),this.reset()}return O.prototype.processAsync=function(){var _,E;try{return this.remaining.length<=this.options.chunkSize?(_=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(_),this.saxParser.close()):(_=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(_),N(this.processAsync))}catch(D){if(E=D,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(E)}},O.prototype.assignOrPush=function(_,E,D){return E in _?(_[E]instanceof Array||a(_,E,[_[E]]),_[E].push(D)):this.options.explicitArray?a(_,E,[D]):a(_,E,D)},O.prototype.reset=function(){var _,E,D,T;return this.removeAllListeners(),this.saxParser=m.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(p){return function(I){if(p.saxParser.resume(),!p.saxParser.errThrown)return p.saxParser.errThrown=!0,p.emit("error",I)}}(this),this.saxParser.onend=function(p){return function(){if(!p.saxParser.ended)return p.saxParser.ended=!0,p.emit("end",p.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,T=[],_=this.options.attrkey,E=this.options.charkey,this.saxParser.onopentag=function(p){return function(I){var A,j,U,B,h;if(U={},U[E]="",!p.options.ignoreAttrs){h=I.attributes;for(A in h)b.call(h,A)&&(!(_ in U)&&!p.options.mergeAttrs&&(U[_]={}),j=p.options.attrValueProcessors?t(p.options.attrValueProcessors,I.attributes[A],A):I.attributes[A],B=p.options.attrNameProcessors?t(p.options.attrNameProcessors,A):A,p.options.mergeAttrs?p.assignOrPush(U,B,j):a(U[_],B,j))}return U["#name"]=p.options.tagNameProcessors?t(p.options.tagNameProcessors,I.name):I.name,p.options.xmlns&&(U[p.options.xmlnskey]={uri:I.uri,local:I.local}),T.push(U)}}(this),this.saxParser.onclosetag=function(p){return function(){var I,A,j,U,B,h,F,R,X,$;if(h=T.pop(),B=h["#name"],(!p.options.explicitChildren||!p.options.preserveChildrenOrder)&&delete h["#name"],h.cdata===!0&&(I=h.cdata,delete h.cdata),X=T[T.length-1],h[E].match(/^\s*$/)&&!I?(A=h[E],delete h[E]):(p.options.trim&&(h[E]=h[E].trim()),p.options.normalize&&(h[E]=h[E].replace(/\s{2,}/g," ").trim()),h[E]=p.options.valueProcessors?t(p.options.valueProcessors,h[E],B):h[E],Object.keys(h).length===1&&E in h&&!p.EXPLICIT_CHARKEY&&(h=h[E])),o(h)&&(typeof p.options.emptyTag=="function"?h=p.options.emptyTag():h=p.options.emptyTag!==""?p.options.emptyTag:A),p.options.validator!=null&&($="/"+function(){var Y,J,z;for(z=[],Y=0,J=T.length;Y<J;Y++)U=T[Y],z.push(U["#name"]);return z}().concat(B).join("/"),function(){var Y;try{return h=p.options.validator($,X&&X[B],h)}catch(J){return Y=J,p.emit("error",Y)}}()),p.options.explicitChildren&&!p.options.mergeAttrs&&typeof h=="object"){if(!p.options.preserveChildrenOrder)U={},p.options.attrkey in h&&(U[p.options.attrkey]=h[p.options.attrkey],delete h[p.options.attrkey]),!p.options.charsAsChildren&&p.options.charkey in h&&(U[p.options.charkey]=h[p.options.charkey],delete h[p.options.charkey]),Object.getOwnPropertyNames(h).length>0&&(U[p.options.childkey]=h),h=U;else if(X){X[p.options.childkey]=X[p.options.childkey]||[],F={};for(j in h)b.call(h,j)&&a(F,j,h[j]);X[p.options.childkey].push(F),delete h["#name"],Object.keys(h).length===1&&E in h&&!p.EXPLICIT_CHARKEY&&(h=h[E])}}return T.length>0?p.assignOrPush(X,B,h):(p.options.explicitRoot&&(R=h,h={},a(h,B,R)),p.resultObject=h,p.saxParser.ended=!0,p.emit("end",p.resultObject))}}(this),D=function(p){return function(I){var A,j;if(j=T[T.length-1],j)return j[E]+=I,p.options.explicitChildren&&p.options.preserveChildrenOrder&&p.options.charsAsChildren&&(p.options.includeWhiteChars||I.replace(/\\n/g,"").trim()!=="")&&(j[p.options.childkey]=j[p.options.childkey]||[],A={"#name":"__text__"},A[E]=I,p.options.normalize&&(A[E]=A[E].replace(/\s{2,}/g," ").trim()),j[p.options.childkey].push(A)),j}}(this),this.saxParser.ontext=D,this.saxParser.oncdata=function(p){return function(I){var A;if(A=D(I),A)return A.cdata=!0}}()},O.prototype.parseString=function(_,E){var D;E!=null&&typeof E=="function"&&(this.on("end",function(T){return this.reset(),E(null,T)}),this.on("error",function(T){return this.reset(),E(T)}));try{return _=_.toString(),_.trim()===""?(this.emit("end",null),!0):(_=n.stripBOM(_),this.options.async?(this.remaining=_,N(this.processAsync),this.saxParser):this.saxParser.write(_).close())}catch(T){if(D=T,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw D}else return this.emit("error",D),this.saxParser.errThrown=!0}},O.prototype.parseStringPromise=function(_){return new Promise(function(E){return function(D,T){return E.parseString(_,function(p,I){return p?T(p):D(I)})}}(this))},O}(f),u.parseString=function(x,O,_){var E,D,T;return _!=null?(typeof _=="function"&&(E=_),typeof O=="object"&&(D=O)):(typeof O=="function"&&(E=O),D={}),T=new u.Parser(D),T.parseString(x,E)},u.parseStringPromise=function(x,O){var _,E;return typeof O=="object"&&(_=O),E=new u.Parser(_),E.parseStringPromise(x)}}).call(G)}(Ee)),Ee}var pn;(function(){var u,n,c,a=function(o,t){for(var i in t)f.call(t,i)&&(o[i]=t[i]);function m(){this.constructor=o}return m.prototype=t.prototype,o.prototype=new m,o.__super__=t.prototype,o},f={}.hasOwnProperty;n=_e(),u=mi(),c=Di(),hn(),n.defaults,function(o){a(t,o);function t(i){this.message=i}return t}(Error),u.Builder,c.Parser,c.parseString,pn=c.parseStringPromise}).call(G);class vi{constructor(n,c,a){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=n,this.cdp=c,this.readPHPFile=a.getPHPFile,this.phpRoot=a.phpRoot||"";for(const f of a.knownScriptUrls)this.scriptIdByUrl.set(f,this.getOrCreateScriptId(f));this.breakOnFirstLine=a.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async n=>{try{const c=await pn(n,{explicitArray:!1});await this.handleDbgpMessage(c)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",n=>{this.handleCdpMessage(n)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const n=this.scriptIdByUrl.entries().next().value;n&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:n[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
73
+ */var Ln;function Ds(){return Ln||(Ln=1,function(e){var t=Ps(),r=_s(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var a=2147483647;e.kMaxLength=a,s.TYPED_ARRAY_SUPPORT=o(),!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 o(){try{var f=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(f,u),f.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 i(f){if(f>a)throw new RangeError('The value "'+f+'" is invalid for option "size"');var u=new Uint8Array(f);return Object.setPrototypeOf(u,s.prototype),u}function s(f,u,c){if(typeof f=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(f)}return l(f,u,c)}s.poolSize=8192;function l(f,u,c){if(typeof f=="string")return w(f,u);if(ArrayBuffer.isView(f))return I(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(z(f,ArrayBuffer)||f&&z(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(z(f,SharedArrayBuffer)||f&&z(f.buffer,SharedArrayBuffer)))return _(f,u,c);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var p=f.valueOf&&f.valueOf();if(p!=null&&p!==f)return s.from(p,u,c);var L=T(f);if(L)return L;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return s.from(f[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 f)}s.from=function(f,u,c){return l(f,u,c)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function d(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function g(f,u,c){return d(f),f<=0?i(f):u!==void 0?typeof c=="string"?i(f).fill(u,c):i(f).fill(u):i(f)}s.alloc=function(f,u,c){return g(f,u,c)};function m(f){return d(f),i(f<0?0:x(f)|0)}s.allocUnsafe=function(f){return m(f)},s.allocUnsafeSlow=function(f){return m(f)};function w(f,u){if((typeof u!="string"||u==="")&&(u="utf8"),!s.isEncoding(u))throw new TypeError("Unknown encoding: "+u);var c=h(f,u)|0,p=i(c),L=p.write(f,u);return L!==c&&(p=p.slice(0,L)),p}function E(f){for(var u=f.length<0?0:x(f.length)|0,c=i(u),p=0;p<u;p+=1)c[p]=f[p]&255;return c}function I(f){if(z(f,Uint8Array)){var u=new Uint8Array(f);return _(u.buffer,u.byteOffset,u.byteLength)}return E(f)}function _(f,u,c){if(u<0||f.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');var p;return u===void 0&&c===void 0?p=new Uint8Array(f):c===void 0?p=new Uint8Array(f,u):p=new Uint8Array(f,u,c),Object.setPrototypeOf(p,s.prototype),p}function T(f){if(s.isBuffer(f)){var u=x(f.length)|0,c=i(u);return c.length===0||f.copy(c,0,0,u),c}if(f.length!==void 0)return typeof f.length!="number"||oe(f.length)?i(0):E(f);if(f.type==="Buffer"&&Array.isArray(f.data))return E(f.data)}function x(f){if(f>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return f|0}function v(f){return+f!=f&&(f=0),s.alloc(+f)}s.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==s.prototype},s.compare=function(u,c){if(z(u,Uint8Array)&&(u=s.from(u,u.offset,u.byteLength)),z(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 p=u.length,L=c.length,S=0,C=Math.min(p,L);S<C;++S)if(u[S]!==c[S]){p=u[S],L=c[S];break}return p<L?-1:L<p?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 p;if(c===void 0)for(c=0,p=0;p<u.length;++p)c+=u[p].length;var L=s.allocUnsafe(c),S=0;for(p=0;p<u.length;++p){var C=u[p];if(z(C,Uint8Array))S+C.length>L.length?s.from(C).copy(L,S):Uint8Array.prototype.set.call(L,C,S);else if(s.isBuffer(C))C.copy(L,S);else throw new TypeError('"list" argument must be an Array of Buffers');S+=C.length}return L};function h(f,u){if(s.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||z(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);var c=f.length,p=arguments.length>2&&arguments[2]===!0;if(!p&&c===0)return 0;for(var L=!1;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return b(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return J(f).length;default:if(L)return p?-1:b(f).length;u=(""+u).toLowerCase(),L=!0}}s.byteLength=h;function O(f,u,c){var p=!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(f||(f="utf8");;)switch(f){case"hex":return Ae(this,u,c);case"utf8":case"utf-8":return X(this,u,c);case"ascii":return H(this,u,c);case"latin1":case"binary":return Ue(this,u,c);case"base64":return W(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xe(this,u,c);default:if(p)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),p=!0}}s.prototype._isBuffer=!0;function A(f,u,c){var p=f[u];f[u]=f[c],f[c]=p}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)A(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)A(this,c,c+3),A(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)A(this,c,c+7),A(this,c+1,c+6),A(this,c+2,c+5),A(this,c+3,c+4);return this},s.prototype.toString=function(){var u=this.length;return u===0?"":arguments.length===0?X(this,0,u):O.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=e.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,p,L,S){if(z(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),p===void 0&&(p=u?u.length:0),L===void 0&&(L=0),S===void 0&&(S=this.length),c<0||p>u.length||L<0||S>this.length)throw new RangeError("out of range index");if(L>=S&&c>=p)return 0;if(L>=S)return-1;if(c>=p)return 1;if(c>>>=0,p>>>=0,L>>>=0,S>>>=0,this===u)return 0;for(var C=S-L,V=p-c,G=Math.min(C,V),re=this.slice(L,S),ce=u.slice(c,p),ne=0;ne<G;++ne)if(re[ne]!==ce[ne]){C=re[ne],V=ce[ne];break}return C<V?-1:V<C?1:0};function F(f,u,c,p,L){if(f.length===0)return-1;if(typeof c=="string"?(p=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,oe(c)&&(c=L?0:f.length-1),c<0&&(c=f.length+c),c>=f.length){if(L)return-1;c=f.length-1}else if(c<0)if(L)c=0;else return-1;if(typeof u=="string"&&(u=s.from(u,p)),s.isBuffer(u))return u.length===0?-1:M(f,u,c,p,L);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?L?Uint8Array.prototype.indexOf.call(f,u,c):Uint8Array.prototype.lastIndexOf.call(f,u,c):M(f,[u],c,p,L);throw new TypeError("val must be string, number or Buffer")}function M(f,u,c,p,L){var S=1,C=f.length,V=u.length;if(p!==void 0&&(p=String(p).toLowerCase(),p==="ucs2"||p==="ucs-2"||p==="utf16le"||p==="utf-16le")){if(f.length<2||u.length<2)return-1;S=2,C/=2,V/=2,c/=2}function G(Ir,xr){return S===1?Ir[xr]:Ir.readUInt16BE(xr*S)}var re;if(L){var ce=-1;for(re=c;re<C;re++)if(G(f,re)===G(u,ce===-1?0:re-ce)){if(ce===-1&&(ce=re),re-ce+1===V)return ce*S}else ce!==-1&&(re-=re-ce),ce=-1}else for(c+V>C&&(c=C-V),re=c;re>=0;re--){for(var ne=!0,Ye=0;Ye<V;Ye++)if(G(f,re+Ye)!==G(u,Ye)){ne=!1;break}if(ne)return re}return-1}s.prototype.includes=function(u,c,p){return this.indexOf(u,c,p)!==-1},s.prototype.indexOf=function(u,c,p){return F(this,u,c,p,!0)},s.prototype.lastIndexOf=function(u,c,p){return F(this,u,c,p,!1)};function k(f,u,c,p){c=Number(c)||0;var L=f.length-c;p?(p=Number(p),p>L&&(p=L)):p=L;var S=u.length;p>S/2&&(p=S/2);for(var C=0;C<p;++C){var V=parseInt(u.substr(C*2,2),16);if(oe(V))return C;f[c+C]=V}return C}function y(f,u,c,p){return K(b(u,f.length-c),f,c,p)}function B(f,u,c,p){return K(R(u),f,c,p)}function j(f,u,c,p){return K(J(u),f,c,p)}function U(f,u,c,p){return K(D(u,f.length-c),f,c,p)}s.prototype.write=function(u,c,p,L){if(c===void 0)L="utf8",p=this.length,c=0;else if(p===void 0&&typeof c=="string")L=c,p=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(p)?(p=p>>>0,L===void 0&&(L="utf8")):(L=p,p=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var S=this.length-c;if((p===void 0||p>S)&&(p=S),u.length>0&&(p<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");L||(L="utf8");for(var C=!1;;)switch(L){case"hex":return k(this,u,c,p);case"utf8":case"utf-8":return y(this,u,c,p);case"ascii":case"latin1":case"binary":return B(this,u,c,p);case"base64":return j(this,u,c,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,u,c,p);default:if(C)throw new TypeError("Unknown encoding: "+L);L=(""+L).toLowerCase(),C=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function W(f,u,c){return u===0&&c===f.length?t.fromByteArray(f):t.fromByteArray(f.slice(u,c))}function X(f,u,c){c=Math.min(f.length,c);for(var p=[],L=u;L<c;){var S=f[L],C=null,V=S>239?4:S>223?3:S>191?2:1;if(L+V<=c){var G,re,ce,ne;switch(V){case 1:S<128&&(C=S);break;case 2:G=f[L+1],(G&192)===128&&(ne=(S&31)<<6|G&63,ne>127&&(C=ne));break;case 3:G=f[L+1],re=f[L+2],(G&192)===128&&(re&192)===128&&(ne=(S&15)<<12|(G&63)<<6|re&63,ne>2047&&(ne<55296||ne>57343)&&(C=ne));break;case 4:G=f[L+1],re=f[L+2],ce=f[L+3],(G&192)===128&&(re&192)===128&&(ce&192)===128&&(ne=(S&15)<<18|(G&63)<<12|(re&63)<<6|ce&63,ne>65535&&ne<1114112&&(C=ne))}}C===null?(C=65533,V=1):C>65535&&(C-=65536,p.push(C>>>10&1023|55296),C=56320|C&1023),p.push(C),L+=V}return Y(p)}var $=4096;function Y(f){var u=f.length;if(u<=$)return String.fromCharCode.apply(String,f);for(var c="",p=0;p<u;)c+=String.fromCharCode.apply(String,f.slice(p,p+=$));return c}function H(f,u,c){var p="";c=Math.min(f.length,c);for(var L=u;L<c;++L)p+=String.fromCharCode(f[L]&127);return p}function Ue(f,u,c){var p="";c=Math.min(f.length,c);for(var L=u;L<c;++L)p+=String.fromCharCode(f[L]);return p}function Ae(f,u,c){var p=f.length;(!u||u<0)&&(u=0),(!c||c<0||c>p)&&(c=p);for(var L="",S=u;S<c;++S)L+=P[f[S]];return L}function xe(f,u,c){for(var p=f.slice(u,c),L="",S=0;S<p.length-1;S+=2)L+=String.fromCharCode(p[S]+p[S+1]*256);return L}s.prototype.slice=function(u,c){var p=this.length;u=~~u,c=c===void 0?p:~~c,u<0?(u+=p,u<0&&(u=0)):u>p&&(u=p),c<0?(c+=p,c<0&&(c=0)):c>p&&(c=p),c<u&&(c=u);var L=this.subarray(u,c);return Object.setPrototypeOf(L,s.prototype),L};function Z(f,u,c){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+u>c)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=this[u],S=1,C=0;++C<c&&(S*=256);)L+=this[u+C]*S;return L},s.prototype.readUintBE=s.prototype.readUIntBE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=this[u+--c],S=1;c>0&&(S*=256);)L+=this[u+--c]*S;return L},s.prototype.readUint8=s.prototype.readUInt8=function(u,c){return u=u>>>0,c||Z(u,1,this.length),this[u]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||Z(u,2,this.length),this[u]|this[u+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||Z(u,2,this.length),this[u]<<8|this[u+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||Z(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||Z(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},s.prototype.readIntLE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=this[u],S=1,C=0;++C<c&&(S*=256);)L+=this[u+C]*S;return S*=128,L>=S&&(L-=Math.pow(2,8*c)),L},s.prototype.readIntBE=function(u,c,p){u=u>>>0,c=c>>>0,p||Z(u,c,this.length);for(var L=c,S=1,C=this[u+--L];L>0&&(S*=256);)C+=this[u+--L]*S;return S*=128,C>=S&&(C-=Math.pow(2,8*c)),C},s.prototype.readInt8=function(u,c){return u=u>>>0,c||Z(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},s.prototype.readInt16LE=function(u,c){u=u>>>0,c||Z(u,2,this.length);var p=this[u]|this[u+1]<<8;return p&32768?p|4294901760:p},s.prototype.readInt16BE=function(u,c){u=u>>>0,c||Z(u,2,this.length);var p=this[u+1]|this[u]<<8;return p&32768?p|4294901760:p},s.prototype.readInt32LE=function(u,c){return u=u>>>0,c||Z(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||Z(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||Z(u,4,this.length),r.read(this,u,!0,23,4)},s.prototype.readFloatBE=function(u,c){return u=u>>>0,c||Z(u,4,this.length),r.read(this,u,!1,23,4)},s.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||Z(u,8,this.length),r.read(this,u,!0,52,8)},s.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||Z(u,8,this.length),r.read(this,u,!1,52,8)};function te(f,u,c,p,L,S){if(!s.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>L||u<S)throw new RangeError('"value" argument is out of bounds');if(c+p>f.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(u,c,p,L){if(u=+u,c=c>>>0,p=p>>>0,!L){var S=Math.pow(2,8*p)-1;te(this,u,c,p,S,0)}var C=1,V=0;for(this[c]=u&255;++V<p&&(C*=256);)this[c+V]=u/C&255;return c+p},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(u,c,p,L){if(u=+u,c=c>>>0,p=p>>>0,!L){var S=Math.pow(2,8*p)-1;te(this,u,c,p,S,0)}var C=p-1,V=1;for(this[c+C]=u&255;--C>=0&&(V*=256);)this[c+C]=u/V&255;return c+p},s.prototype.writeUint8=s.prototype.writeUInt8=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,1,255,0),this[c]=u&255,c+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(u,c,p){return u=+u,c=c>>>0,p||te(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,p){return u=+u,c=c>>>0,p||te(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,p){return u=+u,c=c>>>0,p||te(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,p){return u=+u,c=c>>>0,p||te(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,p,L){if(u=+u,c=c>>>0,!L){var S=Math.pow(2,8*p-1);te(this,u,c,p,S-1,-S)}var C=0,V=1,G=0;for(this[c]=u&255;++C<p&&(V*=256);)u<0&&G===0&&this[c+C-1]!==0&&(G=1),this[c+C]=(u/V>>0)-G&255;return c+p},s.prototype.writeIntBE=function(u,c,p,L){if(u=+u,c=c>>>0,!L){var S=Math.pow(2,8*p-1);te(this,u,c,p,S-1,-S)}var C=p-1,V=1,G=0;for(this[c+C]=u&255;--C>=0&&(V*=256);)u<0&&G===0&&this[c+C+1]!==0&&(G=1),this[c+C]=(u/V>>0)-G&255;return c+p},s.prototype.writeInt8=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},s.prototype.writeInt16LE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},s.prototype.writeInt16BE=function(u,c,p){return u=+u,c=c>>>0,p||te(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},s.prototype.writeInt32LE=function(u,c,p){return u=+u,c=c>>>0,p||te(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,p){return u=+u,c=c>>>0,p||te(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 Me(f,u,c,p,L,S){if(c+p>f.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function q(f,u,c,p,L){return u=+u,c=c>>>0,L||Me(f,u,c,4),r.write(f,u,c,p,23,4),c+4}s.prototype.writeFloatLE=function(u,c,p){return q(this,u,c,!0,p)},s.prototype.writeFloatBE=function(u,c,p){return q(this,u,c,!1,p)};function be(f,u,c,p,L){return u=+u,c=c>>>0,L||Me(f,u,c,8),r.write(f,u,c,p,52,8),c+8}s.prototype.writeDoubleLE=function(u,c,p){return be(this,u,c,!0,p)},s.prototype.writeDoubleBE=function(u,c,p){return be(this,u,c,!1,p)},s.prototype.copy=function(u,c,p,L){if(!s.isBuffer(u))throw new TypeError("argument should be a Buffer");if(p||(p=0),!L&&L!==0&&(L=this.length),c>=u.length&&(c=u.length),c||(c=0),L>0&&L<p&&(L=p),L===p||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(p<0||p>=this.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("sourceEnd out of bounds");L>this.length&&(L=this.length),u.length-c<L-p&&(L=u.length-c+p);var S=L-p;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,p,L):Uint8Array.prototype.set.call(u,this.subarray(p,L),c),S},s.prototype.fill=function(u,c,p,L){if(typeof u=="string"){if(typeof c=="string"?(L=c,c=0,p=this.length):typeof p=="string"&&(L=p,p=this.length),L!==void 0&&typeof L!="string")throw new TypeError("encoding must be a string");if(typeof L=="string"&&!s.isEncoding(L))throw new TypeError("Unknown encoding: "+L);if(u.length===1){var S=u.charCodeAt(0);(L==="utf8"&&S<128||L==="latin1")&&(u=S)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<p)throw new RangeError("Out of range index");if(p<=c)return this;c=c>>>0,p=p===void 0?this.length:p>>>0,u||(u=0);var C;if(typeof u=="number")for(C=c;C<p;++C)this[C]=u;else{var V=s.isBuffer(u)?u:s.from(u,L),G=V.length;if(G===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(C=0;C<p-c;++C)this[C+c]=V[C%G]}return this};var Xe=/[^+/0-9A-Za-z-_]/g;function N(f){if(f=f.split("=")[0],f=f.trim().replace(Xe,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function b(f,u){u=u||1/0;for(var c,p=f.length,L=null,S=[],C=0;C<p;++C){if(c=f.charCodeAt(C),c>55295&&c<57344){if(!L){if(c>56319){(u-=3)>-1&&S.push(239,191,189);continue}else if(C+1===p){(u-=3)>-1&&S.push(239,191,189);continue}L=c;continue}if(c<56320){(u-=3)>-1&&S.push(239,191,189),L=c;continue}c=(L-55296<<10|c-56320)+65536}else L&&(u-=3)>-1&&S.push(239,191,189);if(L=null,c<128){if((u-=1)<0)break;S.push(c)}else if(c<2048){if((u-=2)<0)break;S.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;S.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;S.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return S}function R(f){for(var u=[],c=0;c<f.length;++c)u.push(f.charCodeAt(c)&255);return u}function D(f,u){for(var c,p,L,S=[],C=0;C<f.length&&!((u-=2)<0);++C)c=f.charCodeAt(C),p=c>>8,L=c%256,S.push(L),S.push(p);return S}function J(f){return t.toByteArray(N(f))}function K(f,u,c,p){for(var L=0;L<p&&!(L+c>=u.length||L>=f.length);++L)u[L+c]=f[L];return L}function z(f,u){return f instanceof u||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===u.name}function oe(f){return f!==f}var P=function(){for(var f="0123456789abcdef",u=new Array(256),c=0;c<16;++c)for(var p=c*16,L=0;L<16;++L)u[p+L]=f[c]+f[L];return u}()}(Qt)),Qt}/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Pn;function Ss(){return Pn||(Pn=1,function(e,t){var r=Ds(),n=r.Buffer;function a(i,s){for(var l in i)s[l]=i[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(a(r,t),t.Buffer=o);function o(i,s,l){return n(i,s,l)}o.prototype=Object.create(n.prototype),a(n,o),o.from=function(i,s,l){if(typeof i=="number")throw new TypeError("Argument must not be a number");return n(i,s,l)},o.alloc=function(i,s,l){if(typeof i!="number")throw new TypeError("Argument must be a number");var d=n(i);return s!==void 0?typeof l=="string"?d.fill(s,l):d.fill(s):d.fill(0),d},o.allocUnsafe=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return n(i)},o.allocUnsafeSlow=function(i){if(typeof i!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(i)}}(Qe,Qe.exports)),Qe.exports}var _n;function Ms(){if(_n)return zt;_n=1;var e=Ss().Buffer,t=e.isEncoding||function(x){switch(x=""+x,x&&x.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 r(x){if(!x)return"utf8";for(var v;;)switch(x){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 x;default:if(v)return;x=(""+x).toLowerCase(),v=!0}}function n(x){var v=r(x);if(typeof v!="string"&&(e.isEncoding===t||!t(x)))throw new Error("Unknown encoding: "+x);return v||x}zt.StringDecoder=a;function a(x){this.encoding=n(x);var v;switch(this.encoding){case"utf16le":this.text=m,this.end=w,v=4;break;case"utf8":this.fillLast=l,v=4;break;case"base64":this.text=E,this.end=I,v=3;break;default:this.write=_,this.end=T;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(v)}a.prototype.write=function(x){if(x.length===0)return"";var v,h;if(this.lastNeed){if(v=this.fillLast(x),v===void 0)return"";h=this.lastNeed,this.lastNeed=0}else h=0;return h<x.length?v?v+this.text(x,h):this.text(x,h):v||""},a.prototype.end=g,a.prototype.text=d,a.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function o(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function i(x,v,h){var O=v.length-1;if(O<h)return 0;var A=o(v[O]);return A>=0?(A>0&&(x.lastNeed=A-1),A):--O<h||A===-2?0:(A=o(v[O]),A>=0?(A>0&&(x.lastNeed=A-2),A):--O<h||A===-2?0:(A=o(v[O]),A>=0?(A>0&&(A===2?A=0:x.lastNeed=A-3),A):0))}function s(x,v,h){if((v[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&v.length>1){if((v[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&v.length>2&&(v[2]&192)!==128)return x.lastNeed=2,"�"}}function l(x){var v=this.lastTotal-this.lastNeed,h=s(this,x);if(h!==void 0)return h;if(this.lastNeed<=x.length)return x.copy(this.lastChar,v,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,v,0,x.length),this.lastNeed-=x.length}function d(x,v){var h=i(this,x,v);if(!this.lastNeed)return x.toString("utf8",v);this.lastTotal=h;var O=x.length-(h-this.lastNeed);return x.copy(this.lastChar,0,O),x.toString("utf8",v,O)}function g(x){var v=x&&x.length?this.write(x):"";return this.lastNeed?v+"�":v}function m(x,v){if((x.length-v)%2===0){var h=x.toString("utf16le",v);if(h){var O=h.charCodeAt(h.length-1);if(O>=55296&&O<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],h.slice(0,-1)}return h}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",v,x.length-1)}function w(x){var v=x&&x.length?this.write(x):"";if(this.lastNeed){var h=this.lastTotal-this.lastNeed;return v+this.lastChar.toString("utf16le",0,h)}return v}function E(x,v){var h=(x.length-v)%3;return h===0?x.toString("base64",v):(this.lastNeed=3-h,this.lastTotal=3,h===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",v,x.length-h))}function I(x){var v=x&&x.length?this.write(x):"";return this.lastNeed?v+this.lastChar.toString("base64",0,3-this.lastNeed):v}function _(x){return x.toString(this.encoding)}function T(x){return x&&x.length?this.write(x):""}return zt}var Dn;function Fs(){return Dn||(Dn=1,function(e){(function(t){t.parser=function(N,b){return new n(N,b)},t.SAXParser=n,t.SAXStream=g,t.createStream=d,t.MAX_BUFFER_LENGTH=64*1024;var r=["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(N,b){if(!(this instanceof n))return new n(N,b);var R=this;o(R),R.q=R.c="",R.bufferCheckPosition=t.MAX_BUFFER_LENGTH,R.opt=b||{},R.opt.lowercase=R.opt.lowercase||R.opt.lowercasetags,R.looseCase=R.opt.lowercase?"toLowerCase":"toUpperCase",R.tags=[],R.closed=R.closedRoot=R.sawRoot=!1,R.tag=R.error=null,R.strict=!!N,R.noscript=!!(N||R.opt.noscript),R.state=y.BEGIN,R.strictEntities=R.opt.strictEntities,R.ENTITIES=R.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),R.attribList=[],R.opt.xmlns&&(R.ns=Object.create(_)),R.opt.unquotedAttributeValues===void 0&&(R.opt.unquotedAttributeValues=!N),R.trackPosition=R.opt.position!==!1,R.trackPosition&&(R.position=R.line=R.column=0),j(R,"onready")}Object.create||(Object.create=function(N){function b(){}b.prototype=N;var R=new b;return R}),Object.keys||(Object.keys=function(N){var b=[];for(var R in N)N.hasOwnProperty(R)&&b.push(R);return b});function a(N){for(var b=Math.max(t.MAX_BUFFER_LENGTH,10),R=0,D=0,J=r.length;D<J;D++){var K=N[r[D]].length;if(K>b)switch(r[D]){case"textNode":W(N);break;case"cdata":U(N,"oncdata",N.cdata),N.cdata="";break;case"script":U(N,"onscript",N.script),N.script="";break;default:$(N,"Max buffer length exceeded: "+r[D])}R=Math.max(R,K)}var z=t.MAX_BUFFER_LENGTH-R;N.bufferCheckPosition=z+N.position}function o(N){for(var b=0,R=r.length;b<R;b++)N[r[b]]=""}function i(N){W(N),N.cdata!==""&&(U(N,"oncdata",N.cdata),N.cdata=""),N.script!==""&&(U(N,"onscript",N.script),N.script="")}n.prototype={end:function(){Y(this)},write:Xe,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){i(this)}};var s;try{s=require("stream").Stream}catch{s=function(){}}s||(s=function(){});var l=t.EVENTS.filter(function(N){return N!=="error"&&N!=="end"});function d(N,b){return new g(N,b)}function g(N,b){if(!(this instanceof g))return new g(N,b);s.apply(this),this._parser=new n(N,b),this.writable=!0,this.readable=!0;var R=this;this._parser.onend=function(){R.emit("end")},this._parser.onerror=function(D){R.emit("error",D),R._parser.error=null},this._decoder=null,l.forEach(function(D){Object.defineProperty(R,"on"+D,{get:function(){return R._parser["on"+D]},set:function(J){if(!J)return R.removeAllListeners(D),R._parser["on"+D]=J,J;R.on(D,J)},enumerable:!0,configurable:!1})})}g.prototype=Object.create(s.prototype,{constructor:{value:g}}),g.prototype.write=function(N){if(typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(N)){if(!this._decoder){var b=Ms().StringDecoder;this._decoder=new b("utf8")}N=this._decoder.write(N)}return this._parser.write(N.toString()),this.emit("data",N),!0},g.prototype.end=function(N){return N&&N.length&&this.write(N),this._parser.end(),!0},g.prototype.on=function(N,b){var R=this;return!R._parser["on"+N]&&l.indexOf(N)!==-1&&(R._parser["on"+N]=function(){var D=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);D.splice(0,0,N),R.emit.apply(R,D)}),s.prototype.on.call(R,N,b)};var m="[CDATA[",w="DOCTYPE",E="http://www.w3.org/XML/1998/namespace",I="http://www.w3.org/2000/xmlns/",_={xml:E,xmlns:I},T=/[:_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]/,x=/[:_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-]/,v=/[#:_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]/,h=/[#:_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 O(N){return N===" "||N===`
74
+ `||N==="\r"||N===" "}function A(N){return N==='"'||N==="'"}function F(N){return N===">"||O(N)}function M(N,b){return N.test(b)}function k(N,b){return!M(N,b)}var y=0;t.STATE={BEGIN:y++,BEGIN_WHITESPACE:y++,TEXT:y++,TEXT_ENTITY:y++,OPEN_WAKA:y++,SGML_DECL:y++,SGML_DECL_QUOTED:y++,DOCTYPE:y++,DOCTYPE_QUOTED:y++,DOCTYPE_DTD:y++,DOCTYPE_DTD_QUOTED:y++,COMMENT_STARTING:y++,COMMENT:y++,COMMENT_ENDING:y++,COMMENT_ENDED:y++,CDATA:y++,CDATA_ENDING:y++,CDATA_ENDING_2:y++,PROC_INST:y++,PROC_INST_BODY:y++,PROC_INST_ENDING:y++,OPEN_TAG:y++,OPEN_TAG_SLASH:y++,ATTRIB:y++,ATTRIB_NAME:y++,ATTRIB_NAME_SAW_WHITE:y++,ATTRIB_VALUE:y++,ATTRIB_VALUE_QUOTED:y++,ATTRIB_VALUE_CLOSED:y++,ATTRIB_VALUE_UNQUOTED:y++,ATTRIB_VALUE_ENTITY_Q:y++,ATTRIB_VALUE_ENTITY_U:y++,CLOSE_TAG:y++,CLOSE_TAG_SAW_WHITE:y++,SCRIPT:y++,SCRIPT_ENDING:y++},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(N){var b=t.ENTITIES[N],R=typeof b=="number"?String.fromCharCode(b):b;t.ENTITIES[N]=R});for(var B in t.STATE)t.STATE[t.STATE[B]]=B;y=t.STATE;function j(N,b,R){N[b]&&N[b](R)}function U(N,b,R){N.textNode&&W(N),j(N,b,R)}function W(N){N.textNode=X(N.opt,N.textNode),N.textNode&&j(N,"ontext",N.textNode),N.textNode=""}function X(N,b){return N.trim&&(b=b.trim()),N.normalize&&(b=b.replace(/\s+/g," ")),b}function $(N,b){return W(N),N.trackPosition&&(b+=`
75
+ Line: `+N.line+`
76
+ Column: `+N.column+`
77
+ Char: `+N.c),b=new Error(b),N.error=b,j(N,"onerror",b),N}function Y(N){return N.sawRoot&&!N.closedRoot&&H(N,"Unclosed root tag"),N.state!==y.BEGIN&&N.state!==y.BEGIN_WHITESPACE&&N.state!==y.TEXT&&$(N,"Unexpected end"),W(N),N.c="",N.closed=!0,j(N,"onend"),n.call(N,N.strict,N.opt),N}function H(N,b){if(typeof N!="object"||!(N instanceof n))throw new Error("bad call to strictFail");N.strict&&$(N,b)}function Ue(N){N.strict||(N.tagName=N.tagName[N.looseCase]());var b=N.tags[N.tags.length-1]||N,R=N.tag={name:N.tagName,attributes:{}};N.opt.xmlns&&(R.ns=b.ns),N.attribList.length=0,U(N,"onopentagstart",R)}function Ae(N,b){var R=N.indexOf(":"),D=R<0?["",N]:N.split(":"),J=D[0],K=D[1];return b&&N==="xmlns"&&(J="xmlns",K=""),{prefix:J,local:K}}function xe(N){if(N.strict||(N.attribName=N.attribName[N.looseCase]()),N.attribList.indexOf(N.attribName)!==-1||N.tag.attributes.hasOwnProperty(N.attribName)){N.attribName=N.attribValue="";return}if(N.opt.xmlns){var b=Ae(N.attribName,!0),R=b.prefix,D=b.local;if(R==="xmlns")if(D==="xml"&&N.attribValue!==E)H(N,"xml: prefix must be bound to "+E+`
78
+ Actual: `+N.attribValue);else if(D==="xmlns"&&N.attribValue!==I)H(N,"xmlns: prefix must be bound to "+I+`
79
+ Actual: `+N.attribValue);else{var J=N.tag,K=N.tags[N.tags.length-1]||N;J.ns===K.ns&&(J.ns=Object.create(K.ns)),J.ns[D]=N.attribValue}N.attribList.push([N.attribName,N.attribValue])}else N.tag.attributes[N.attribName]=N.attribValue,U(N,"onattribute",{name:N.attribName,value:N.attribValue});N.attribName=N.attribValue=""}function Z(N,b){if(N.opt.xmlns){var R=N.tag,D=Ae(N.tagName);R.prefix=D.prefix,R.local=D.local,R.uri=R.ns[D.prefix]||"",R.prefix&&!R.uri&&(H(N,"Unbound namespace prefix: "+JSON.stringify(N.tagName)),R.uri=D.prefix);var J=N.tags[N.tags.length-1]||N;R.ns&&J.ns!==R.ns&&Object.keys(R.ns).forEach(function(C){U(N,"onopennamespace",{prefix:C,uri:R.ns[C]})});for(var K=0,z=N.attribList.length;K<z;K++){var oe=N.attribList[K],P=oe[0],f=oe[1],u=Ae(P,!0),c=u.prefix,p=u.local,L=c===""?"":R.ns[c]||"",S={name:P,value:f,prefix:c,local:p,uri:L};c&&c!=="xmlns"&&!L&&(H(N,"Unbound namespace prefix: "+JSON.stringify(c)),S.uri=c),N.tag.attributes[P]=S,U(N,"onattribute",S)}N.attribList.length=0}N.tag.isSelfClosing=!!b,N.sawRoot=!0,N.tags.push(N.tag),U(N,"onopentag",N.tag),b||(!N.noscript&&N.tagName.toLowerCase()==="script"?N.state=y.SCRIPT:N.state=y.TEXT,N.tag=null,N.tagName=""),N.attribName=N.attribValue="",N.attribList.length=0}function te(N){if(!N.tagName){H(N,"Weird empty close tag."),N.textNode+="</>",N.state=y.TEXT;return}if(N.script){if(N.tagName!=="script"){N.script+="</"+N.tagName+">",N.tagName="",N.state=y.SCRIPT;return}U(N,"onscript",N.script),N.script=""}var b=N.tags.length,R=N.tagName;N.strict||(R=R[N.looseCase]());for(var D=R;b--;){var J=N.tags[b];if(J.name!==D)H(N,"Unexpected close tag");else break}if(b<0){H(N,"Unmatched closing tag: "+N.tagName),N.textNode+="</"+N.tagName+">",N.state=y.TEXT;return}N.tagName=R;for(var K=N.tags.length;K-- >b;){var z=N.tag=N.tags.pop();N.tagName=N.tag.name,U(N,"onclosetag",N.tagName);var oe={};for(var P in z.ns)oe[P]=z.ns[P];var f=N.tags[N.tags.length-1]||N;N.opt.xmlns&&z.ns!==f.ns&&Object.keys(z.ns).forEach(function(u){var c=z.ns[u];U(N,"onclosenamespace",{prefix:u,uri:c})})}b===0&&(N.closedRoot=!0),N.tagName=N.attribValue=N.attribName="",N.attribList.length=0,N.state=y.TEXT}function Me(N){var b=N.entity,R=b.toLowerCase(),D,J="";return N.ENTITIES[b]?N.ENTITIES[b]:N.ENTITIES[R]?N.ENTITIES[R]:(b=R,b.charAt(0)==="#"&&(b.charAt(1)==="x"?(b=b.slice(2),D=parseInt(b,16),J=D.toString(16)):(b=b.slice(1),D=parseInt(b,10),J=D.toString(10))),b=b.replace(/^0+/,""),isNaN(D)||J.toLowerCase()!==b||D<0||D>1114111?(H(N,"Invalid character entity"),"&"+N.entity+";"):String.fromCodePoint(D))}function q(N,b){b==="<"?(N.state=y.OPEN_WAKA,N.startTagPosition=N.position):O(b)||(H(N,"Non-whitespace before first tag."),N.textNode=b,N.state=y.TEXT)}function be(N,b){var R="";return b<N.length&&(R=N.charAt(b)),R}function Xe(N){var b=this;if(this.error)throw this.error;if(b.closed)return $(b,"Cannot write after close. Assign an onready handler.");if(N===null)return Y(b);typeof N=="object"&&(N=N.toString());for(var R=0,D="";D=be(N,R++),b.c=D,!!D;)switch(b.trackPosition&&(b.position++,D===`
80
+ `?(b.line++,b.column=0):b.column++),b.state){case y.BEGIN:if(b.state=y.BEGIN_WHITESPACE,D==="\uFEFF")continue;q(b,D);continue;case y.BEGIN_WHITESPACE:q(b,D);continue;case y.TEXT:if(b.sawRoot&&!b.closedRoot){for(var K=R-1;D&&D!=="<"&&D!=="&";)D=be(N,R++),D&&b.trackPosition&&(b.position++,D===`
81
+ `?(b.line++,b.column=0):b.column++);b.textNode+=N.substring(K,R-1)}D==="<"&&!(b.sawRoot&&b.closedRoot&&!b.strict)?(b.state=y.OPEN_WAKA,b.startTagPosition=b.position):(!O(D)&&(!b.sawRoot||b.closedRoot)&&H(b,"Text data outside of root node."),D==="&"?b.state=y.TEXT_ENTITY:b.textNode+=D);continue;case y.SCRIPT:D==="<"?b.state=y.SCRIPT_ENDING:b.script+=D;continue;case y.SCRIPT_ENDING:D==="/"?b.state=y.CLOSE_TAG:(b.script+="<"+D,b.state=y.SCRIPT);continue;case y.OPEN_WAKA:if(D==="!")b.state=y.SGML_DECL,b.sgmlDecl="";else if(!O(D))if(M(T,D))b.state=y.OPEN_TAG,b.tagName=D;else if(D==="/")b.state=y.CLOSE_TAG,b.tagName="";else if(D==="?")b.state=y.PROC_INST,b.procInstName=b.procInstBody="";else{if(H(b,"Unencoded <"),b.startTagPosition+1<b.position){var J=b.position-b.startTagPosition;D=new Array(J).join(" ")+D}b.textNode+="<"+D,b.state=y.TEXT}continue;case y.SGML_DECL:if(b.sgmlDecl+D==="--"){b.state=y.COMMENT,b.comment="",b.sgmlDecl="";continue}b.doctype&&b.doctype!==!0&&b.sgmlDecl?(b.state=y.DOCTYPE_DTD,b.doctype+="<!"+b.sgmlDecl+D,b.sgmlDecl=""):(b.sgmlDecl+D).toUpperCase()===m?(U(b,"onopencdata"),b.state=y.CDATA,b.sgmlDecl="",b.cdata=""):(b.sgmlDecl+D).toUpperCase()===w?(b.state=y.DOCTYPE,(b.doctype||b.sawRoot)&&H(b,"Inappropriately located doctype declaration"),b.doctype="",b.sgmlDecl=""):D===">"?(U(b,"onsgmldeclaration",b.sgmlDecl),b.sgmlDecl="",b.state=y.TEXT):(A(D)&&(b.state=y.SGML_DECL_QUOTED),b.sgmlDecl+=D);continue;case y.SGML_DECL_QUOTED:D===b.q&&(b.state=y.SGML_DECL,b.q=""),b.sgmlDecl+=D;continue;case y.DOCTYPE:D===">"?(b.state=y.TEXT,U(b,"ondoctype",b.doctype),b.doctype=!0):(b.doctype+=D,D==="["?b.state=y.DOCTYPE_DTD:A(D)&&(b.state=y.DOCTYPE_QUOTED,b.q=D));continue;case y.DOCTYPE_QUOTED:b.doctype+=D,D===b.q&&(b.q="",b.state=y.DOCTYPE);continue;case y.DOCTYPE_DTD:D==="]"?(b.doctype+=D,b.state=y.DOCTYPE):D==="<"?(b.state=y.OPEN_WAKA,b.startTagPosition=b.position):A(D)?(b.doctype+=D,b.state=y.DOCTYPE_DTD_QUOTED,b.q=D):b.doctype+=D;continue;case y.DOCTYPE_DTD_QUOTED:b.doctype+=D,D===b.q&&(b.state=y.DOCTYPE_DTD,b.q="");continue;case y.COMMENT:D==="-"?b.state=y.COMMENT_ENDING:b.comment+=D;continue;case y.COMMENT_ENDING:D==="-"?(b.state=y.COMMENT_ENDED,b.comment=X(b.opt,b.comment),b.comment&&U(b,"oncomment",b.comment),b.comment=""):(b.comment+="-"+D,b.state=y.COMMENT);continue;case y.COMMENT_ENDED:D!==">"?(H(b,"Malformed comment"),b.comment+="--"+D,b.state=y.COMMENT):b.doctype&&b.doctype!==!0?b.state=y.DOCTYPE_DTD:b.state=y.TEXT;continue;case y.CDATA:for(var K=R-1;D&&D!=="]";)D=be(N,R++),D&&b.trackPosition&&(b.position++,D===`
82
+ `?(b.line++,b.column=0):b.column++);b.cdata+=N.substring(K,R-1),D==="]"&&(b.state=y.CDATA_ENDING);continue;case y.CDATA_ENDING:D==="]"?b.state=y.CDATA_ENDING_2:(b.cdata+="]"+D,b.state=y.CDATA);continue;case y.CDATA_ENDING_2:D===">"?(b.cdata&&U(b,"oncdata",b.cdata),U(b,"onclosecdata"),b.cdata="",b.state=y.TEXT):D==="]"?b.cdata+="]":(b.cdata+="]]"+D,b.state=y.CDATA);continue;case y.PROC_INST:D==="?"?b.state=y.PROC_INST_ENDING:O(D)?b.state=y.PROC_INST_BODY:b.procInstName+=D;continue;case y.PROC_INST_BODY:if(!b.procInstBody&&O(D))continue;D==="?"?b.state=y.PROC_INST_ENDING:b.procInstBody+=D;continue;case y.PROC_INST_ENDING:D===">"?(U(b,"onprocessinginstruction",{name:b.procInstName,body:b.procInstBody}),b.procInstName=b.procInstBody="",b.state=y.TEXT):(b.procInstBody+="?"+D,b.state=y.PROC_INST_BODY);continue;case y.OPEN_TAG:M(x,D)?b.tagName+=D:(Ue(b),D===">"?Z(b):D==="/"?b.state=y.OPEN_TAG_SLASH:(O(D)||H(b,"Invalid character in tag name"),b.state=y.ATTRIB));continue;case y.OPEN_TAG_SLASH:D===">"?(Z(b,!0),te(b)):(H(b,"Forward-slash in opening tag not followed by >"),b.state=y.ATTRIB);continue;case y.ATTRIB:if(O(D))continue;D===">"?Z(b):D==="/"?b.state=y.OPEN_TAG_SLASH:M(T,D)?(b.attribName=D,b.attribValue="",b.state=y.ATTRIB_NAME):H(b,"Invalid attribute name");continue;case y.ATTRIB_NAME:D==="="?b.state=y.ATTRIB_VALUE:D===">"?(H(b,"Attribute without value"),b.attribValue=b.attribName,xe(b),Z(b)):O(D)?b.state=y.ATTRIB_NAME_SAW_WHITE:M(x,D)?b.attribName+=D:H(b,"Invalid attribute name");continue;case y.ATTRIB_NAME_SAW_WHITE:if(D==="=")b.state=y.ATTRIB_VALUE;else{if(O(D))continue;H(b,"Attribute without value"),b.tag.attributes[b.attribName]="",b.attribValue="",U(b,"onattribute",{name:b.attribName,value:""}),b.attribName="",D===">"?Z(b):M(T,D)?(b.attribName=D,b.state=y.ATTRIB_NAME):(H(b,"Invalid attribute name"),b.state=y.ATTRIB)}continue;case y.ATTRIB_VALUE:if(O(D))continue;A(D)?(b.q=D,b.state=y.ATTRIB_VALUE_QUOTED):(b.opt.unquotedAttributeValues||$(b,"Unquoted attribute value"),b.state=y.ATTRIB_VALUE_UNQUOTED,b.attribValue=D);continue;case y.ATTRIB_VALUE_QUOTED:if(D!==b.q){D==="&"?b.state=y.ATTRIB_VALUE_ENTITY_Q:b.attribValue+=D;continue}xe(b),b.q="",b.state=y.ATTRIB_VALUE_CLOSED;continue;case y.ATTRIB_VALUE_CLOSED:O(D)?b.state=y.ATTRIB:D===">"?Z(b):D==="/"?b.state=y.OPEN_TAG_SLASH:M(T,D)?(H(b,"No whitespace between attributes"),b.attribName=D,b.attribValue="",b.state=y.ATTRIB_NAME):H(b,"Invalid attribute name");continue;case y.ATTRIB_VALUE_UNQUOTED:if(!F(D)){D==="&"?b.state=y.ATTRIB_VALUE_ENTITY_U:b.attribValue+=D;continue}xe(b),D===">"?Z(b):b.state=y.ATTRIB;continue;case y.CLOSE_TAG:if(b.tagName)D===">"?te(b):M(x,D)?b.tagName+=D:b.script?(b.script+="</"+b.tagName,b.tagName="",b.state=y.SCRIPT):(O(D)||H(b,"Invalid tagname in closing tag"),b.state=y.CLOSE_TAG_SAW_WHITE);else{if(O(D))continue;k(T,D)?b.script?(b.script+="</"+D,b.state=y.SCRIPT):H(b,"Invalid tagname in closing tag."):b.tagName=D}continue;case y.CLOSE_TAG_SAW_WHITE:if(O(D))continue;D===">"?te(b):H(b,"Invalid characters in closing tag");continue;case y.TEXT_ENTITY:case y.ATTRIB_VALUE_ENTITY_Q:case y.ATTRIB_VALUE_ENTITY_U:var z,oe;switch(b.state){case y.TEXT_ENTITY:z=y.TEXT,oe="textNode";break;case y.ATTRIB_VALUE_ENTITY_Q:z=y.ATTRIB_VALUE_QUOTED,oe="attribValue";break;case y.ATTRIB_VALUE_ENTITY_U:z=y.ATTRIB_VALUE_UNQUOTED,oe="attribValue";break}if(D===";"){var P=Me(b);b.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(P)?(b.entity="",b.state=z,b.write(P)):(b[oe]+=P,b.entity="",b.state=z)}else M(b.entity.length?h:v,D)?b.entity+=D:(H(b,"Invalid character in entity name"),b[oe]+="&"+b.entity+D,b.entity="",b.state=z);continue;default:throw new Error(b,"Unknown state: "+b.state)}return b.position>=b.bufferCheckPosition&&a(b),b}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var N=String.fromCharCode,b=Math.floor,R=function(){var D=16384,J=[],K,z,oe=-1,P=arguments.length;if(!P)return"";for(var f="";++oe<P;){var u=Number(arguments[oe]);if(!isFinite(u)||u<0||u>1114111||b(u)!==u)throw RangeError("Invalid code point: "+u);u<=65535?J.push(u):(u-=65536,K=(u>>10)+55296,z=u%1024+56320,J.push(K,z)),(oe+1===P||J.length>D)&&(f+=N.apply(null,J),J.length=0)}return f};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R}()})(e)}(Yt)),Yt}var Jt={},Sn;function Cs(){return Sn||(Sn=1,function(){Jt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(Q)),Jt}var _e={},Mn;function di(){return Mn||(Mn=1,function(){var e;e=new RegExp(/(?!xmlns)^.*:/),_e.normalize=function(t){return t.toLowerCase()},_e.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},_e.stripPrefix=function(t){return t.replace(e,"")},_e.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},_e.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(Q)),_e}var Fn;function Bs(){return Fn||(Fn=1,function(e){(function(){var t,r,n,a,o,i,s,l,d,g=function(E,I){return function(){return E.apply(I,arguments)}},m=function(E,I){for(var _ in I)w.call(I,_)&&(E[_]=I[_]);function T(){this.constructor=E}return T.prototype=I.prototype,E.prototype=new T,E.__super__=I.prototype,E},w={}.hasOwnProperty;l=Fs(),a=ur,t=Cs(),s=di(),d=Bi.setImmediate,r=cr().defaults,o=function(E){return typeof E=="object"&&E!=null&&Object.keys(E).length===0},i=function(E,I,_){var T,x,v;for(T=0,x=E.length;T<x;T++)v=E[T],I=v(I,_);return I},n=function(E,I,_){var T;return T=Object.create(null),T.value=_,T.writable=!0,T.enumerable=!0,T.configurable=!0,Object.defineProperty(E,I,T)},e.Parser=function(E){m(I,E);function I(_){this.parseStringPromise=g(this.parseStringPromise,this),this.parseString=g(this.parseString,this),this.reset=g(this.reset,this),this.assignOrPush=g(this.assignOrPush,this),this.processAsync=g(this.processAsync,this);var T,x,v;if(!(this instanceof e.Parser))return new e.Parser(_);this.options={},x=r["0.2"];for(T in x)w.call(x,T)&&(v=x[T],this.options[T]=v);for(T in _)w.call(_,T)&&(v=_[T],this.options[T]=v);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 I.prototype.processAsync=function(){var _,T;try{return this.remaining.length<=this.options.chunkSize?(_=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(_),this.saxParser.close()):(_=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(_),d(this.processAsync))}catch(x){if(T=x,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(T)}},I.prototype.assignOrPush=function(_,T,x){return T in _?(_[T]instanceof Array||n(_,T,[_[T]]),_[T].push(x)):this.options.explicitArray?n(_,T,[x]):n(_,T,x)},I.prototype.reset=function(){var _,T,x,v;return this.removeAllListeners(),this.saxParser=l.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(h){return function(O){if(h.saxParser.resume(),!h.saxParser.errThrown)return h.saxParser.errThrown=!0,h.emit("error",O)}}(this),this.saxParser.onend=function(h){return function(){if(!h.saxParser.ended)return h.saxParser.ended=!0,h.emit("end",h.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,v=[],_=this.options.attrkey,T=this.options.charkey,this.saxParser.onopentag=function(h){return function(O){var A,F,M,k,y;if(M={},M[T]="",!h.options.ignoreAttrs){y=O.attributes;for(A in y)w.call(y,A)&&(!(_ in M)&&!h.options.mergeAttrs&&(M[_]={}),F=h.options.attrValueProcessors?i(h.options.attrValueProcessors,O.attributes[A],A):O.attributes[A],k=h.options.attrNameProcessors?i(h.options.attrNameProcessors,A):A,h.options.mergeAttrs?h.assignOrPush(M,k,F):n(M[_],k,F))}return M["#name"]=h.options.tagNameProcessors?i(h.options.tagNameProcessors,O.name):O.name,h.options.xmlns&&(M[h.options.xmlnskey]={uri:O.uri,local:O.local}),v.push(M)}}(this),this.saxParser.onclosetag=function(h){return function(){var O,A,F,M,k,y,B,j,U,W;if(y=v.pop(),k=y["#name"],(!h.options.explicitChildren||!h.options.preserveChildrenOrder)&&delete y["#name"],y.cdata===!0&&(O=y.cdata,delete y.cdata),U=v[v.length-1],y[T].match(/^\s*$/)&&!O?(A=y[T],delete y[T]):(h.options.trim&&(y[T]=y[T].trim()),h.options.normalize&&(y[T]=y[T].replace(/\s{2,}/g," ").trim()),y[T]=h.options.valueProcessors?i(h.options.valueProcessors,y[T],k):y[T],Object.keys(y).length===1&&T in y&&!h.EXPLICIT_CHARKEY&&(y=y[T])),o(y)&&(typeof h.options.emptyTag=="function"?y=h.options.emptyTag():y=h.options.emptyTag!==""?h.options.emptyTag:A),h.options.validator!=null&&(W="/"+function(){var X,$,Y;for(Y=[],X=0,$=v.length;X<$;X++)M=v[X],Y.push(M["#name"]);return Y}().concat(k).join("/"),function(){var X;try{return y=h.options.validator(W,U&&U[k],y)}catch($){return X=$,h.emit("error",X)}}()),h.options.explicitChildren&&!h.options.mergeAttrs&&typeof y=="object"){if(!h.options.preserveChildrenOrder)M={},h.options.attrkey in y&&(M[h.options.attrkey]=y[h.options.attrkey],delete y[h.options.attrkey]),!h.options.charsAsChildren&&h.options.charkey in y&&(M[h.options.charkey]=y[h.options.charkey],delete y[h.options.charkey]),Object.getOwnPropertyNames(y).length>0&&(M[h.options.childkey]=y),y=M;else if(U){U[h.options.childkey]=U[h.options.childkey]||[],B={};for(F in y)w.call(y,F)&&n(B,F,y[F]);U[h.options.childkey].push(B),delete y["#name"],Object.keys(y).length===1&&T in y&&!h.EXPLICIT_CHARKEY&&(y=y[T])}}return v.length>0?h.assignOrPush(U,k,y):(h.options.explicitRoot&&(j=y,y={},n(y,k,j)),h.resultObject=y,h.saxParser.ended=!0,h.emit("end",h.resultObject))}}(this),x=function(h){return function(O){var A,F;if(F=v[v.length-1],F)return F[T]+=O,h.options.explicitChildren&&h.options.preserveChildrenOrder&&h.options.charsAsChildren&&(h.options.includeWhiteChars||O.replace(/\\n/g,"").trim()!=="")&&(F[h.options.childkey]=F[h.options.childkey]||[],A={"#name":"__text__"},A[T]=O,h.options.normalize&&(A[T]=A[T].replace(/\s{2,}/g," ").trim()),F[h.options.childkey].push(A)),F}}(this),this.saxParser.ontext=x,this.saxParser.oncdata=function(h){return function(O){var A;if(A=x(O),A)return A.cdata=!0}}()},I.prototype.parseString=function(_,T){var x;T!=null&&typeof T=="function"&&(this.on("end",function(v){return this.reset(),T(null,v)}),this.on("error",function(v){return this.reset(),T(v)}));try{return _=_.toString(),_.trim()===""?(this.emit("end",null),!0):(_=t.stripBOM(_),this.options.async?(this.remaining=_,d(this.processAsync),this.saxParser):this.saxParser.write(_).close())}catch(v){if(x=v,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw x}else return this.emit("error",x),this.saxParser.errThrown=!0}},I.prototype.parseStringPromise=function(_){return new Promise(function(T){return function(x,v){return T.parseString(_,function(h,O){return h?v(h):x(O)})}}(this))},I}(a),e.parseString=function(E,I,_){var T,x,v;return _!=null?(typeof _=="function"&&(T=_),typeof I=="object"&&(x=I)):(typeof I=="function"&&(T=I),x={}),v=new e.Parser(x),v.parseString(E,T)},e.parseStringPromise=function(E,I){var _,T;return typeof I=="object"&&(_=I),T=new e.Parser(_),T.parseStringPromise(E)}}).call(Q)}(Gt)),Gt}var gi;(function(){var e,t,r,n=function(o,i){for(var s in i)a.call(i,s)&&(o[s]=i[s]);function l(){this.constructor=o}return l.prototype=i.prototype,o.prototype=new l,o.__super__=i.prototype,o},a={}.hasOwnProperty;t=cr(),e=Ls(),r=Bs(),di(),t.defaults,function(o){n(i,o);function i(s){this.message=s}return i}(Error),e.Builder,r.Parser,r.parseString,gi=r.parseStringPromise}).call(Q);class ks{constructor(t,r,n){this.nextTxnId=1,this.pendingCommands=new Map,this.breakpoints=new Map,this.scriptIdByUrl=new Map,this.nextScriptId=1,this.objectHandles=new Map,this.nextObjectId=1,this.callFramesMap=new Map,this.xdebugConnected=!1,this.dbgp=t,this.cdp=r,this.readPHPFile=n.getPHPFile,this.phpRoot=n.phpRoot||"";for(const a of n.knownScriptUrls)this.scriptIdByUrl.set(a,this.getOrCreateScriptId(a));this.breakOnFirstLine=n.breakOnFirstLine||!1}start(){this.dbgp.on("connected",()=>{this.xdebugConnected=!0,this.sendDbgpCommand("stdout","-c 1"),this.sendDbgpCommand("stderr","-c 1")}),this.dbgp.on("message",async t=>{try{const r=await gi(t,{explicitArray:!1});await this.handleDbgpMessage(r)}catch{}}),this.dbgp.on("disconnected",()=>{this.xdebugConnected=!1,this.cdp.sendMessage({method:"Debugger.paused",params:{reason:"terminated",callFrames:[]}})}),this.cdp.on("message",t=>{this.handleCdpMessage(t)}),this.cdp.on("clientDisconnected",()=>{this.xdebugConnected&&this.sendDbgpCommand("detach")}),this.sendInitialScripts().then(()=>{if(!this.breakOnFirstLine){const t=this.scriptIdByUrl.entries().next().value;t&&(this.cdp.sendMessage({method:"Debugger.paused",params:{callFrames:[{location:{scriptId:t[1],lineNumber:0},scopeChain:[],this:{type:"undefined"}}],reason:"other"}}),setTimeout(()=>{this.cdp.sendMessage({method:"Debugger.resumed"})},50))}this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:`🎉 Welcome to WordPress Playground DevTools! 🎉
43
83
  ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
44
84
 
45
85
  1. Add breakpoints in your files to start step debugging.
46
86
 
47
87
  2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
48
88
 
49
- 3. Witness the magic break.`,timestamp:Date.now()}}}),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:" ",timestamp:Date.now()}}})})}stop(){this.dbgp.close(),this.cdp.close()}async sendInitialScripts(){for(const[n,c]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(n,c)}async sendScriptToCDP(n,c){const a=this.uriFromBridgeToCDPSyntaxHighlight(n),f=this.uriFromBridgeToCDP(n);try{const o=await this.readPHPFile(n),t=o.split(`
50
- `),i=t.map((y,b)=>b===0?"AAAA":"AACA").join(";"),m={version:3,file:f,sources:[a],sourcesContent:[o],mappings:i},w=`data:application/json;base64,${Buffer.from(JSON.stringify(m),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:c,url:f,startLine:0,startColumn:0,endLine:t.length,endColumn:0,executionContextId:1,sourceMapURL:w}})}catch(o){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:o.message,timestamp:Date.now()}}})}}getOrCreateScriptId(n){let c=this.scriptIdByUrl.get(n);return c||(c=Mn("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(n,c)),c}formatPropertyFullName(n){let c=!1,a="";for(const f of n)f==='"'||f==="\\"||f==="\0"?(a+="\\"+f,c=!0):f===" "?(a+=f,c=!0):a+=f;return(c||n.includes("'"))&&(a=`"${a}"`),a}sendDbgpCommand(n,c){const f=(this.nextTxnId++).toString();let o=`${n} -i ${f}`;return c!==void 0&&(o+=` ${c}`),this.dbgp.sendCommand(o),f}async handleCdpMessage(n){const{id:c,method:a,params:f}=n;let o={},t=!0;switch(a){case"Debugger.enable":case"Runtime.enable":o={};break;case"Debugger.setBreakpointByUrl":{const{url:i,lineNumber:m}=f;if(!i){t=!1;break}const N=this.uriFromCDPToBridge(i),w=this.uriFromBridgeToDBGP(N),y=(typeof m=="number"?m:0)+1,b=String(this.breakpoints.size+1);if(this.xdebugConnected){const x=`breakpoint_set -t line -f ${this.formatPropertyFullName(w)} -n ${y}`,O=this.sendDbgpCommand(x);this.pendingCommands.set(O,{cdpId:c,cdpMethod:a,params:{breakpointId:b,fileUri:N,lineNumber:y}}),t=!1}else this.breakpoints.set(b,{cdpId:b,xdebugId:null,fileUri:N,lineNumber:y}),o={breakpointId:b,locations:[{scriptId:this.getOrCreateScriptId(N),lineNumber:y-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:i}=f,m=String(i),N=this.breakpoints.get(m);if(N){if(N.xdebugId&&this.xdebugConnected){const w=`breakpoint_remove -d ${N.xdebugId}`,y=this.sendDbgpCommand(w);this.pendingCommands.set(y,{cdpId:c,cdpMethod:a}),t=!1}this.breakpoints.delete(m)}o={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),o={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),o={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),o={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),o={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),o={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const i=f.expression||"",m=f.callFrameId;if(a==="Debugger.evaluateOnCallFrame"){if(m===void 0||!this.callFramesMap.has(m)){this.cdp.sendMessage({id:c,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(m)!==0){this.cdp.sendMessage({id:c,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const N=Buffer.from(i).toString("base64"),w=this.sendDbgpCommand("eval",`-- ${N}`);this.pendingCommands.set(w,{cdpId:c,cdpMethod:a}),t=!1}else o={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:i}=f,m=this.objectHandles.get(i);if(m&&this.xdebugConnected)if(m.type==="context"){const N=m.contextId??0,y=`context_get -d ${m.depth} -c ${N} -p 0 -m 32`,b=this.sendDbgpCommand(y),x={...m,currentPage:0,aggregatedProps:[]};this.objectHandles.set(i,x),this.pendingCommands.set(b,{cdpId:c,cdpMethod:a,params:{objectId:i}}),t=!1}else if(m.type==="property"){const N=m.depth,w=m.fullname,y=this.formatPropertyFullName(w),b=`property_get -d ${N} -n ${y} -p 0 -m 32`,x=this.sendDbgpCommand(b),O={...m,currentPage:0,aggregatedProps:[]};this.objectHandles.set(i,O),this.pendingCommands.set(x,{cdpId:c,cdpMethod:a,params:{parentObjectId:i}}),t=!1}else o={result:[]};else o={result:[]};break}case"Debugger.getScriptSource":{const i=f.scriptId,m=[...this.scriptIdByUrl.entries()].find(([,w])=>w===i)?.[0],N=[];m&&N.push(`Here's the full path for your convenience:
51
- `,`${this.uriFromBridgeToCDPSyntaxHighlight(m).replace("file://","")}
52
- `),o={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...N,"What is this file, then? It's a placeholder required due to the dev tools limitations.","The XDebug <-> Devtools bridge implement PHP syntax highlighting using source maps,",'and the unfortunate side effect is having a "source" file and a "target" file.',`This is the "source". If you're interested in even more details, see the discussion at:
89
+ 3. Witness the magic break.`,timestamp:Date.now()}}}),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"info",text:" ",timestamp:Date.now()}}})})}stop(){this.dbgp.close(),this.cdp.close()}async sendInitialScripts(){for(const[t,r]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(t,r)}async sendScriptToCDP(t,r){const n=this.uriFromBridgeToCDPSyntaxHighlight(t),a=this.uriFromBridgeToCDP(t);try{const o=await this.readPHPFile(t),i=o.split(`
90
+ `),s=i.map((m,w)=>w===0?"AAAA":"AACA").join(";"),l={version:3,file:a,sources:[n],sourcesContent:[o],mappings:s},g=`data:application/json;base64,${Buffer.from(JSON.stringify(l),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:r,url:a,startLine:0,startColumn:0,endLine:i.length,endColumn:0,executionContextId:1,sourceMapURL:g}})}catch(o){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:o.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let r=this.scriptIdByUrl.get(t);return r||(r=Ci("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,r)),r}formatPropertyFullName(t){let r=!1,n="";for(const a of t)a==='"'||a==="\\"||a==="\0"?(n+="\\"+a,r=!0):a===" "?(n+=a,r=!0):n+=a;return(r||t.includes("'"))&&(n=`"${n}"`),n}sendDbgpCommand(t,r){const a=(this.nextTxnId++).toString();let o=`${t} -i ${a}`;return r!==void 0&&(o+=` ${r}`),this.dbgp.sendCommand(o),a}async handleCdpMessage(t){const{id:r,method:n,params:a}=t;let o={},i=!0;switch(n){case"Debugger.enable":case"Runtime.enable":o={};break;case"Debugger.setBreakpointByUrl":{const{url:s,lineNumber:l}=a;if(!s){i=!1;break}const d=this.uriFromCDPToBridge(s),g=this.uriFromBridgeToDBGP(d),m=(typeof l=="number"?l:0)+1,w=String(this.breakpoints.size+1);if(this.xdebugConnected){const E=`breakpoint_set -t line -f ${this.formatPropertyFullName(g)} -n ${m}`,I=this.sendDbgpCommand(E);this.pendingCommands.set(I,{cdpId:r,cdpMethod:n,params:{breakpointId:w,fileUri:d,lineNumber:m}}),i=!1}else this.breakpoints.set(w,{cdpId:w,xdebugId:null,fileUri:d,lineNumber:m}),o={breakpointId:w,locations:[{scriptId:this.getOrCreateScriptId(d),lineNumber:m-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:s}=a,l=String(s),d=this.breakpoints.get(l);if(d){if(d.xdebugId&&this.xdebugConnected){const g=`breakpoint_remove -d ${d.xdebugId}`,m=this.sendDbgpCommand(g);this.pendingCommands.set(m,{cdpId:r,cdpMethod:n}),i=!1}this.breakpoints.delete(l)}o={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),o={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),o={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),o={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),o={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),o={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const s=a.expression||"",l=a.callFrameId;if(n==="Debugger.evaluateOnCallFrame"){if(l===void 0||!this.callFramesMap.has(l)){this.cdp.sendMessage({id:r,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(l)!==0){this.cdp.sendMessage({id:r,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const d=Buffer.from(s).toString("base64"),g=this.sendDbgpCommand("eval",`-- ${d}`);this.pendingCommands.set(g,{cdpId:r,cdpMethod:n}),i=!1}else o={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:s}=a,l=this.objectHandles.get(s);if(l&&this.xdebugConnected)if(l.type==="context"){const d=l.contextId??0,m=`context_get -d ${l.depth} -c ${d} -p 0 -m 32`,w=this.sendDbgpCommand(m),E={...l,currentPage:0,aggregatedProps:[]};this.objectHandles.set(s,E),this.pendingCommands.set(w,{cdpId:r,cdpMethod:n,params:{objectId:s}}),i=!1}else if(l.type==="property"){const d=l.depth,g=l.fullname,m=this.formatPropertyFullName(g),w=`property_get -d ${d} -n ${m} -p 0 -m 32`,E=this.sendDbgpCommand(w),I={...l,currentPage:0,aggregatedProps:[]};this.objectHandles.set(s,I),this.pendingCommands.set(E,{cdpId:r,cdpMethod:n,params:{parentObjectId:s}}),i=!1}else o={result:[]};else o={result:[]};break}case"Debugger.getScriptSource":{const s=a.scriptId,l=[...this.scriptIdByUrl.entries()].find(([,g])=>g===s)?.[0],d=[];l&&d.push(`Here's the full path for your convenience:
91
+ `,`${this.uriFromBridgeToCDPSyntaxHighlight(l).replace("file://","")}
92
+ `),o={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...d,"What is this file, then? It's a placeholder required due to the dev tools limitations.","The XDebug <-> Devtools bridge implement PHP syntax highlighting using source maps,",'and the unfortunate side effect is having a "source" file and a "target" file.',`This is the "source". If you're interested in even more details, see the discussion at:
53
93
  `,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
54
- `)};break}default:o={};break}t&&this.cdp.sendMessage({id:c,result:o})}uriFromBridgeToCDPSyntaxHighlight(n){return`file://PHP.wasm/${n}`}uriFromBridgeToCDP(n){return n=this.scriptIdByUrl.get(n)??"",`file://placeholders/${n}`}uriFromCDPToBridge(n){const c="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,a])=>a===n.slice(c.length))?.[0]??""}uriFromBridgeToDBGP(n){return Pt.resolve(process.cwd(),n)}uriFromDBGPToBridge(n){n=n.startsWith("file://")?n.slice(7):n;const c=n.indexOf(this.phpRoot);return c!==-1?n.slice(c):n}async handleDbgpMessage(n){if(n.init){this.breakpoints.forEach(a=>{this.handleCdpMessage({id:a.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(a.fileUri),lineNumber:a.lineNumber-1}})});const c=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(c,{});return}if(n.response){const c=n.response,a=c.$,f=a.command,o=a.transaction_id,t=this.pendingCommands.get(o);switch(f){case"breakpoint_set":{if(t&&t.cdpId!==void 0&&t.cdpMethod==="Debugger.setBreakpointByUrl"){const i=a.id,m=t.params;if(m){const{breakpointId:N,fileUri:w,lineNumber:y}=m;this.breakpoints.set(N,{cdpId:N,xdebugId:i,fileUri:w,lineNumber:y});const b=this.getOrCreateScriptId(w),x={breakpointId:N,locations:[{scriptId:b,lineNumber:y-1,columnNumber:0}]};this.cdp.sendMessage({id:t.cdpId,result:x})}this.pendingCommands.delete(o)}break}case"breakpoint_remove":{t&&t.cdpId!==void 0&&(this.cdp.sendMessage({id:t.cdpId,result:{}}),this.pendingCommands.delete(o));break}case"run":case"step_into":case"step_over":case"step_out":{const i=a.status;if(c["xdebug:message"]){const m=this.uriFromDBGPToBridge(c["xdebug:message"].$.filename);m&&!this.scriptIdByUrl.has(m)&&await this.sendScriptToCDP(m,this.getOrCreateScriptId(m))}if(i==="break"){const m=this.sendDbgpCommand("stack_get");this.pendingCommands.set(m,{}),this.pendingCommands.delete(o)}else(i==="stopping"||i==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(t&&t.cdpId!==void 0){let i;if(c.property){const N=c.property,w=N.$.type,y=N.$.encoding;let b=null;if(Object.prototype.hasOwnProperty.call(N,"_")?b=N._:typeof N.$value<"u"&&(b=N.$value),y==="base64"&&b!==null)try{b=Buffer.from(b,"base64").toString()}catch{}if(w==="string")i={type:"string",value:b??""};else if(w==="int"||w==="float"||w==="bool"||w==="boolen"||w==="integer"||w==="double"){let x=b;w.startsWith("int")||w==="integer"?x=parseInt(b||"0",10):w==="float"||w==="double"?x=parseFloat(b||"0"):w.startsWith("bool")&&(x=b==="1"||b==="true"),i={type:"number",value:x}}else if(w==="array"||w==="object"){const x=N.$.classname||(w==="array"?"Array":"Object"),O=String(this.nextObjectId++),_=N.$.fullname||"";this.objectHandles.set(O,{type:"property",depth:0,contextId:0,fullname:_}),i={type:"object",objectId:O,className:x,description:x}}else w==="null"?i={type:"object",subtype:"null",value:null}:i={type:"undefined",value:void 0}}else i={type:"undefined",value:void 0};const m={result:i};this.cdp.sendMessage({id:t.cdpId,result:m}),this.pendingCommands.delete(o)}break}case"context_get":case"property_get":{if(t&&t.cdpId!==void 0){const i=t.params?.objectId||t.params?.parentObjectId,m=i?this.objectHandles.get(i):null,N=c.property?.property??c.property,w=[];if(N){const y=Array.isArray(N)?N:[N];for(const b of y){const x=b.$.name||b.$.fullname||"";let O=b.$.type||"undefined";const _=b.$.children==="1",E=b.$.encoding;let D=null;if(typeof b._<"u"&&(D=b._),E==="base64"&&D!==null)try{D=Buffer.from(D,"base64").toString()}catch{}if(_){const T=b.$.classname||(O==="array"?"Array":"Object"),p=String(this.nextObjectId++),I=t.cdpMethod==="Runtime.getProperties"&&t.params?.parentObjectId&&this.objectHandles.get(t.params.parentObjectId)?.contextId||0,A=t.cdpMethod==="Runtime.getProperties"&&t.params?.parentObjectId&&this.objectHandles.get(t.params.parentObjectId)?.depth||0;this.objectHandles.set(p,{type:"property",depth:A,contextId:I,fullname:b.$.fullname||x}),w.push({name:b.$.key||x,value:{type:"object",className:T,description:T,objectId:p},writable:!1,configurable:!1,enumerable:!0})}else{let T,p;O==="string"?T=D??"":O==="int"||O==="integer"?T=parseInt(D||"0",10):O==="float"||O==="double"?T=parseFloat(D||"0"):O==="bool"||O==="boolean"?(T=D==="1"||D==="true",O="boolean"):O==="null"?(T=null,p="null"):T=D;const I={type:O==="integer"?"number":O};p&&(I.subtype=p),I.value=T,w.push({name:b.$.key||x,value:I,writable:!1,configurable:!1,enumerable:!0})}}}if(m){const y=(m.aggregatedProps||[]).concat(w),b=32;if(w.length===b){const O=(m.currentPage||0)+1,_={...m,currentPage:O,aggregatedProps:y};this.objectHandles.set(i,_);let E;if(f==="context_get"){const T=m.contextId??0;E=`context_get -d ${m.depth} -c ${T} -p ${O} -m ${b}`}else{const T=m.depth,p=m.fullname,I=this.formatPropertyFullName(p);E=`property_get -d ${T} -n ${I} -p ${O} -m ${b}`}const D=this.sendDbgpCommand(E);this.pendingCommands.set(D,{cdpId:t.cdpId,cdpMethod:t.cdpMethod,params:t.params}),this.pendingCommands.delete(o);return}else{const O={result:y};this.cdp.sendMessage({id:t.cdpId,result:O}),this.pendingCommands.delete(o)}}else{const y={result:w};this.cdp.sendMessage({id:t.cdpId,result:y}),this.pendingCommands.delete(o)}}break}case"stack_get":{if(c.stack){const i=Array.isArray(c.stack)?c.stack:[c.stack],m=[];this.callFramesMap.clear();for(const w of i){const y=this.uriFromDBGPToBridge(w.$.filename),b=this.getOrCreateScriptId(y);this.scriptIdByUrl.has(y)||(this.scriptIdByUrl.set(y,b),await this.sendScriptToCDP(y,b))}for(const w of i){const y=parseInt(w.$.level,10),b=this.uriFromDBGPToBridge(w.$.filename),x=parseInt(w.$.lineno,10),O=w.$.where&&w.$.where!=="{main}"?w.$.where:"(anonymous)",_=`frame:${y}`;this.callFramesMap.set(_,y);const E=[],D=String(this.nextObjectId++);this.objectHandles.set(D,{type:"context",contextId:0,depth:y}),E.push({type:"local",object:{objectId:D,className:"Object",description:"Local"}});const T=String(this.nextObjectId++);this.objectHandles.set(T,{type:"context",contextId:1,depth:y}),E.push({type:"global",object:{objectId:T,className:"Object",description:"Global"}}),m.push({callFrameId:_,functionName:O,location:{scriptId:this.getOrCreateScriptId(b),lineNumber:x-1,columnNumber:0},scopeChain:E,this:{type:"object",className:"Object",description:"Object",objectId:T}})}let N="pause";if(i.length>0){const w=i[0];if(w.$.filename&&w.$.lineno){const y=this.uriFromDBGPToBridge(w.$.filename),b=parseInt(w.$.lineno,10);for(const x of this.breakpoints.values())if(x.fileUri===y&&x.lineNumber===b){N="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:N,callFrames:m,hitBreakpoints:N==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(o);break}default:{t&&t.cdpId!==void 0&&(this.cdp.sendMessage({id:t.cdpId,result:{}}),this.pendingCommands.delete(o));break}}}else if(n.stream){const c=n.stream,a=c.$.type,f=c.$.encoding||"none";let o=typeof c._=="string"?c._:"";f==="base64"&&(o=Buffer.from(o,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:a==="stderr"?"error":"info",text:o,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else n.notify}}async function Ii(u){const n=u.cdpPort??9229,c=u.dbgpPort??9003,a=u.cdpHost??"localhost",f=u.phpRoot??process.cwd(),o=u.breakOnFirstLine??!1;ht.log("Starting XDebug Bridge...");const t=new Gn(n);ht.log("Connect Chrome DevTools to CDP at:"),ht.log(`devtools://devtools/bundled/inspector.html?ws=${a}:${n}
55
- `),await new Promise(y=>t.on("clientConnected",y)),await new Promise(y=>setTimeout(y,2e3)),ht.log("Chrome connected! Initializing Xdebug receiver...");const i=new Yn(c);ht.log(`XDebug receiver running on port ${c}`),ht.log("Running a PHP script with Xdebug enabled...");async function m(y){const b=[],x=u.phpInstance?await u.phpInstance.listFiles(y):gn(y);for(const O of x){const _=Pt.join(y,O);try{(u.phpInstance?await u.phpInstance.isDir(_):wn(_).isDirectory())?b.push(...await m(_)):O.endsWith(".php")&&b.push(_)}catch{}}return b}const N=u.phpInstance?y=>u.phpInstance.readFileAsText(y):u.getPHPFile?u.getPHPFile:y=>Oe(y,"utf-8"),w=await m(f);return new vi(i,t,{knownScriptUrls:w,phpRoot:f,getPHPFile:N,breakOnFirstLine:o})}let at=process.argv.slice(2);at.length||(at=["--help"]);const dn=(import.meta||{}).url,Ne=new URL("ca-bundle.crt",dn).pathname;bn(Ne)||Hr(Ne,Tn.join(`
56
- `));at.unshift("-d",`openssl.cafile=${Ne}`);async function Ni(){const u=new URL("php.ini",dn).pathname,n=process.env.PHP||xn;if(!Dn.includes(n))throw new Error(`Unsupported PHP version ${n}`);const c=at.some(y=>y.startsWith("--xdebug"));c&&(at=at.filter(y=>y!=="--xdebug"));const a=at.some(y=>y.startsWith("--experimental-devtools"));a&&(at=at.filter(y=>y!=="--experimental-devtools"));const{TMPDIR:f,...o}=process.env,t=ze(Pt.join(Ye.tmpdir(),"php-wasm-bin"));Hr(`${t}/php`,`#!/bin/sh
94
+ `)};break}default:o={};break}i&&this.cdp.sendMessage({id:r,result:o})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const r="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,n])=>n===t.slice(r.length))?.[0]??""}uriFromBridgeToDBGP(t){return ue.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const r=t.indexOf(this.phpRoot);return r!==-1?t.slice(r):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(n=>{this.handleCdpMessage({id:n.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(n.fileUri),lineNumber:n.lineNumber-1}})});const r=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(r,{});return}if(t.response){const r=t.response,n=r.$,a=n.command,o=n.transaction_id,i=this.pendingCommands.get(o);switch(a){case"breakpoint_set":{if(i&&i.cdpId!==void 0&&i.cdpMethod==="Debugger.setBreakpointByUrl"){const s=n.id,l=i.params;if(l){const{breakpointId:d,fileUri:g,lineNumber:m}=l;this.breakpoints.set(d,{cdpId:d,xdebugId:s,fileUri:g,lineNumber:m});const w=this.getOrCreateScriptId(g),E={breakpointId:d,locations:[{scriptId:w,lineNumber:m-1,columnNumber:0}]};this.cdp.sendMessage({id:i.cdpId,result:E})}this.pendingCommands.delete(o)}break}case"breakpoint_remove":{i&&i.cdpId!==void 0&&(this.cdp.sendMessage({id:i.cdpId,result:{}}),this.pendingCommands.delete(o));break}case"run":case"step_into":case"step_over":case"step_out":{const s=n.status;if(r["xdebug:message"]){const l=this.uriFromDBGPToBridge(r["xdebug:message"].$.filename);l&&!this.scriptIdByUrl.has(l)&&await this.sendScriptToCDP(l,this.getOrCreateScriptId(l))}if(s==="break"){const l=this.sendDbgpCommand("stack_get");this.pendingCommands.set(l,{}),this.pendingCommands.delete(o)}else(s==="stopping"||s==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(i&&i.cdpId!==void 0){let s;if(r.property){const d=r.property,g=d.$.type,m=d.$.encoding;let w=null;if(Object.prototype.hasOwnProperty.call(d,"_")?w=d._:typeof d.$value<"u"&&(w=d.$value),m==="base64"&&w!==null)try{w=Buffer.from(w,"base64").toString()}catch{}if(g==="string")s={type:"string",value:w??""};else if(g==="int"||g==="float"||g==="bool"||g==="boolen"||g==="integer"||g==="double"){let E=w;g.startsWith("int")||g==="integer"?E=parseInt(w||"0",10):g==="float"||g==="double"?E=parseFloat(w||"0"):g.startsWith("bool")&&(E=w==="1"||w==="true"),s={type:"number",value:E}}else if(g==="array"||g==="object"){const E=d.$.classname||(g==="array"?"Array":"Object"),I=String(this.nextObjectId++),_=d.$.fullname||"";this.objectHandles.set(I,{type:"property",depth:0,contextId:0,fullname:_}),s={type:"object",objectId:I,className:E,description:E}}else g==="null"?s={type:"object",subtype:"null",value:null}:s={type:"undefined",value:void 0}}else s={type:"undefined",value:void 0};const l={result:s};this.cdp.sendMessage({id:i.cdpId,result:l}),this.pendingCommands.delete(o)}break}case"context_get":case"property_get":{if(i&&i.cdpId!==void 0){const s=i.params?.objectId||i.params?.parentObjectId,l=s?this.objectHandles.get(s):null,d=r.property?.property??r.property,g=[];if(d){const m=Array.isArray(d)?d:[d];for(const w of m){const E=w.$.name||w.$.fullname||"";let I=w.$.type||"undefined";const _=w.$.children==="1",T=w.$.encoding;let x=null;if(typeof w._<"u"&&(x=w._),T==="base64"&&x!==null)try{x=Buffer.from(x,"base64").toString()}catch{}if(_){const v=w.$.classname||(I==="array"?"Array":"Object"),h=String(this.nextObjectId++),O=i.cdpMethod==="Runtime.getProperties"&&i.params?.parentObjectId&&this.objectHandles.get(i.params.parentObjectId)?.contextId||0,A=i.cdpMethod==="Runtime.getProperties"&&i.params?.parentObjectId&&this.objectHandles.get(i.params.parentObjectId)?.depth||0;this.objectHandles.set(h,{type:"property",depth:A,contextId:O,fullname:w.$.fullname||E}),g.push({name:w.$.key||E,value:{type:"object",className:v,description:v,objectId:h},writable:!1,configurable:!1,enumerable:!0})}else{let v,h;I==="string"?v=x??"":I==="int"||I==="integer"?v=parseInt(x||"0",10):I==="float"||I==="double"?v=parseFloat(x||"0"):I==="bool"||I==="boolean"?(v=x==="1"||x==="true",I="boolean"):I==="null"?(v=null,h="null"):v=x;const O={type:I==="integer"?"number":I};h&&(O.subtype=h),O.value=v,g.push({name:w.$.key||E,value:O,writable:!1,configurable:!1,enumerable:!0})}}}if(l){const m=(l.aggregatedProps||[]).concat(g),w=32;if(g.length===w){const I=(l.currentPage||0)+1,_={...l,currentPage:I,aggregatedProps:m};this.objectHandles.set(s,_);let T;if(a==="context_get"){const v=l.contextId??0;T=`context_get -d ${l.depth} -c ${v} -p ${I} -m ${w}`}else{const v=l.depth,h=l.fullname,O=this.formatPropertyFullName(h);T=`property_get -d ${v} -n ${O} -p ${I} -m ${w}`}const x=this.sendDbgpCommand(T);this.pendingCommands.set(x,{cdpId:i.cdpId,cdpMethod:i.cdpMethod,params:i.params}),this.pendingCommands.delete(o);return}else{const I={result:m};this.cdp.sendMessage({id:i.cdpId,result:I}),this.pendingCommands.delete(o)}}else{const m={result:g};this.cdp.sendMessage({id:i.cdpId,result:m}),this.pendingCommands.delete(o)}}break}case"stack_get":{if(r.stack){const s=Array.isArray(r.stack)?r.stack:[r.stack],l=[];this.callFramesMap.clear();for(const g of s){const m=this.uriFromDBGPToBridge(g.$.filename),w=this.getOrCreateScriptId(m);this.scriptIdByUrl.has(m)||(this.scriptIdByUrl.set(m,w),await this.sendScriptToCDP(m,w))}for(const g of s){const m=parseInt(g.$.level,10),w=this.uriFromDBGPToBridge(g.$.filename),E=parseInt(g.$.lineno,10),I=g.$.where&&g.$.where!=="{main}"?g.$.where:"(anonymous)",_=`frame:${m}`;this.callFramesMap.set(_,m);const T=[],x=String(this.nextObjectId++);this.objectHandles.set(x,{type:"context",contextId:0,depth:m}),T.push({type:"local",object:{objectId:x,className:"Object",description:"Local"}});const v=String(this.nextObjectId++);this.objectHandles.set(v,{type:"context",contextId:1,depth:m}),T.push({type:"global",object:{objectId:v,className:"Object",description:"Global"}}),l.push({callFrameId:_,functionName:I,location:{scriptId:this.getOrCreateScriptId(w),lineNumber:E-1,columnNumber:0},scopeChain:T,this:{type:"object",className:"Object",description:"Object",objectId:v}})}let d="pause";if(s.length>0){const g=s[0];if(g.$.filename&&g.$.lineno){const m=this.uriFromDBGPToBridge(g.$.filename),w=parseInt(g.$.lineno,10);for(const E of this.breakpoints.values())if(E.fileUri===m&&E.lineNumber===w){d="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:d,callFrames:l,hitBreakpoints:d==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(o);break}default:{i&&i.cdpId!==void 0&&(this.cdp.sendMessage({id:i.cdpId,result:{}}),this.pendingCommands.delete(o));break}}}else if(t.stream){const r=t.stream,n=r.$.type,a=r.$.encoding||"none";let o=typeof r._=="string"?r._:"";a==="base64"&&(o=Buffer.from(o,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:n==="stderr"?"error":"info",text:o,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function Rs(e){const t=e.cdpPort??9229,r=e.dbgpPort??9003,n=e.cdpHost??"localhost",a=e.phpRoot??process.cwd(),o=e.breakOnFirstLine??!1;we.log("Starting XDebug Bridge...");const i=new ss(t);we.log("Connect Chrome DevTools to CDP at:"),we.log(`devtools://devtools/bundled/inspector.html?ws=${n}:${t}
95
+ `),await new Promise(m=>i.on("clientConnected",m)),await new Promise(m=>setTimeout(m,2e3)),we.log("Chrome connected! Initializing Xdebug receiver...");const s=new as(r);we.log(`XDebug receiver running on port ${r}`),we.log("Running a PHP script with Xdebug enabled...");async function l(m){const w=[],E=e.phpInstance?await e.phpInstance.listFiles(m):vi(m);for(const I of E){const _=ue.join(m,I);try{(e.phpInstance?await e.phpInstance.isDir(_):Ii(_).isDirectory())?w.push(...await l(_)):I.endsWith(".php")&&w.push(_)}catch{}}return w}const d=e.phpInstance?m=>e.phpInstance.readFileAsText(m):e.getPHPFile?e.getPHPFile:m=>or(m,"utf-8"),g=await l(a);return new ks(s,i,{knownScriptUrls:g,phpRoot:a,getPHPFile:d,breakOnFirstLine:o})}let fe=process.argv.slice(2);fe.length||(fe=["--help"]);const ke=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,Cn=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,js=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,mi=(import.meta||{}).url,ir=new URL("ca-bundle.crt",mi).pathname;xi(ir)||Bn(ir,Ai.join(`
96
+ `));fe.unshift("-d",`openssl.cafile=${ir}`);async function Us(){const e=new URL("php.ini",mi).pathname,t=process.env.PHP||yi;if(!wi.includes(t))throw new Error(`Unsupported PHP version ${t}`);const r=fe.some(w=>w.startsWith("--xdebug"));r&&(fe=fe.filter(w=>w!=="--xdebug"));const n=fe.some(w=>w.startsWith("--experimental-devtools"));n&&(fe=fe.filter(w=>w!=="--experimental-devtools"));const a=fe.filter(w=>w.startsWith("--experimental-unsafe-ide-integration")).map(w=>{const E=w.split("=")[1];return E===void 0?["vscode","phpstorm"]:E.includes(",")?E.split(","):[E]})[0]??!1;a&&(fe=fe.filter(w=>!w.startsWith("--experimental-unsafe-ide-integration")));const{TMPDIR:o,...i}=process.env,s=Or(ue.join(Ar.tmpdir(),"php-wasm-bin"));Bn(`${s}/php`,`#!/bin/sh
57
97
  ${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}
58
- `),En(`${t}/php`,493);const i=ze(Pt.join(Ye.tmpdir(),"php-wasm-sys-tmp")),m=new vn(await In(n,{emscriptenOptions:{fileLockManager:new Nn,processId:1,ENV:{...o,TMPDIR:i,TERM:"xterm",PATH:`${t}:${o.PATH}`}},withXdebug:c}));On(m),a&&c&&(await Ii({breakOnFirstLine:!0})).start(),at.some(y=>y.startsWith("-c"))||at.unshift("-c",u);const w=await m.cli(["php",...at]);w.stderr.pipeTo(new WritableStream({write(y){process.stderr.write(y)}})),w.stdout.pipeTo(new WritableStream({write(y){process.stdout.write(y)}})),await w.exitCode.catch(y=>{throw y.name==="ExitStatus"&&process.exit(y.status===void 0?1:y.status),y}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}Ni();
98
+ `),Oi(`${s}/php`,493);const l=Or(ue.join(Ar.tmpdir(),"php-wasm-sys-tmp")),d=new bi(await Pi(t,{emscriptenOptions:{fileLockManager:new _i,processId:1,ENV:{...i,TMPDIR:l,TERM:"xterm",PATH:`${s}:${i.PATH}`}},withXdebug:r}));if(d.setSpawnHandler((w,E)=>Ei(w,E,{shell:!0,stdio:["pipe","pipe","pipe"]})),Di(d),r&&a)try{const w="PHP.wasm CLI - Listen for Xdebug",E=a;await Ho(w,process.cwd());const I=await Wo({name:w,host:"example.com",port:443,ides:E,cwd:process.cwd()}),_=E.includes("vscode"),T=E.includes("phpstorm"),x=Object.values(I);console.log(""),x.length>0?(console.log(ke("Xdebug configured successfully")),console.log(js("Updated IDE config: ")+x.join(" "))):(console.log(ke("Xdebug configuration failed.")),console.log("No IDE-specific project settings directory was found in the current working directory.")),console.log(""),_&&I.vscode&&(console.log(ke("VS Code / Cursor instructions:")),console.log(" 1. Ensure you have installed an IDE extension for PHP Debugging"),console.log(` (The ${ke("PHP Debug")} extension by ${ke("Xdebug")} has been a solid option)`),console.log(" 2. Open the Run and Debug panel on the left sidebar"),console.log(` 3. Select "${Cn(w)}" from the dropdown`),console.log(' 3. Click "start debugging"'),console.log(" 5. Set a breakpoint."),console.log(" 6. Run your command with PHP.wasm CLI."),T&&console.log("")),T&&I.phpstorm&&(console.log(ke("PhpStorm instructions:")),console.log(` 1. Choose "${Cn(w)}" debug configuration in the toolbar`),console.log(" 2. Click the debug button (bug icon)`"),console.log(" 3. Set a breakpoint."),console.log(" 4. Run your command with PHP.wasm CLI.")),console.log("")}catch(w){throw new Error("Could not configure Xdebug",{cause:w})}r&&n&&(await Rs({breakOnFirstLine:!0})).start(),fe.some(w=>w.startsWith("-c"))||fe.unshift("-c",e);const m=await d.cli(["php",...fe]);m.stderr.pipeTo(new WritableStream({write(w){process.stderr.write(w)}})),m.stdout.pipeTo(new WritableStream({write(w){process.stdout.write(w)}})),await m.exitCode.catch(w=>{throw w.name==="ExitStatus"&&process.exit(w.status===void 0?1:w.status),w}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}Us();
59
99
  //# sourceMappingURL=main.js.map