@php-wasm/cli 3.0.54 → 3.1.0

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 +39 -39
  2. package/main.js.map +1 -1
  3. package/package.json +7 -9
package/main.js CHANGED
@@ -1,54 +1,54 @@
1
- import{LatestSupportedPHPVersion as ni,SupportedPHPVersionsList as ri,PHP as ii}from"@php-wasm/universal";import{spawn as si}from"child_process";import K,{readFileSync as Qt,writeFile as oi,statSync as ai,readdirSync as ui,lstatSync as ci,existsSync as li,writeFileSync as Er,mkdtempSync as mn,chmodSync as fi}from"fs";import yn from"os";import{rootCertificates as pi}from"tls";import oe,{resolve as Jt,normalize as hi}from"path";import{loadNodeRuntime as di,FileLockManagerForNode as gi,useHostFilesystem as mi}from"@php-wasm/node";import{WebSocketServer as yi}from"ws";import bi from"net";import"assert";import{format as Nr}from"util";import{fileURLToPath as wi}from"url";import{createHash as Ti}from"crypto";import Ei from"timers";function Ir(e){let t=e.replaceAll("\\","/");const n=t.match(/^([A-Za-z]):\//);return n&&(t="/"+n[1]+t.slice(2)),t}const vr=":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",Ni=vr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Ii="["+vr+"]["+Ni+"]*",vi=new RegExp("^"+Ii+"$");function Or(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const i=r.length;for(let s=0;s<i;s++)o.push(r[s]);n.push(o),r=t.exec(e)}return n}const Ye=function(e){const t=vi.exec(e);return!(t===null||typeof t>"u")};function Oi(e){return typeof e<"u"}const Ai={allowBooleanAttributes:!1,unpairedTags:[]};function Li(e,t){t=Object.assign({},Ai,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=wn(e,i),i.err)return i}else if(e[i]==="<"){let s=i;if(i++,e[i]==="!"){i=Tn(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let u="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
2
- `&&e[i]!=="\r";i++)u+=e[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!Ci(u)){let l;return u.trim().length===0?l="Invalid space after '<'.":l="Tag '"+u+"' is an invalid name.",Z("InvalidTag",l,ie(e,i))}const p=_i(e,i);if(p===!1)return Z("InvalidAttr","Attributes for '"+u+"' have open quote.",ie(e,i));let d=p.value;if(i=p.index,d[d.length-1]==="/"){const l=i-d.length;d=d.substring(0,d.length-1);const h=En(d,t);if(h===!0)r=!0;else return Z(h.err.code,h.err.msg,ie(e,l+h.err.line))}else if(a)if(p.tagClosed){if(d.trim().length>0)return Z("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",ie(e,s));if(n.length===0)return Z("InvalidTag","Closing tag '"+u+"' has not been opened.",ie(e,s));{const l=n.pop();if(u!==l.tagName){let h=ie(e,l.tagStartPos);return Z("InvalidTag","Expected closing tag '"+l.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+u+"'.",ie(e,s))}n.length==0&&(o=!0)}}else return Z("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",ie(e,i));else{const l=En(d,t);if(l!==!0)return Z(l.err.code,l.err.msg,ie(e,i-d.length+l.err.line));if(o===!0)return Z("InvalidXml","Multiple possible root nodes found.",ie(e,i));t.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:s}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=Tn(e,i);continue}else if(e[i+1]==="?"){if(i=wn(e,++i),i.err)return i}else break;else if(e[i]==="&"){const l=Si(e,i);if(l==-1)return Z("InvalidChar","char '&' is not expected.",ie(e,i));i=l}else if(o===!0&&!bn(e[i]))return Z("InvalidXml","Extra text at the end",ie(e,i));e[i]==="<"&&i--}}else{if(bn(e[i]))continue;return Z("InvalidChar","char '"+e[i]+"' is not expected.",ie(e,i))}if(r){if(n.length==1)return Z("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ie(e,n[0].tagStartPos));if(n.length>0)return Z("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Z("InvalidXml","Start tag expected.",1);return!0}function bn(e){return e===" "||e===" "||e===`
3
- `||e==="\r"}function wn(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return Z("InvalidXml","XML declaration allowed only at the start of the document.",ie(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Tn(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 n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===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 Pi='"',xi="'";function _i(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===Pi||e[t]===xi)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const Di=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function En(e,t){const n=Or(e,Di),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",je(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",je(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Z("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",je(n[o]));const i=n[o][2];if(!Fi(i))return Z("InvalidAttr","Attribute '"+i+"' is an invalid name.",je(n[o]));if(!r.hasOwnProperty(i))r[i]=1;else return Z("InvalidAttr","Attribute '"+i+"' is repeated.",je(n[o]))}return!0}function Mi(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function Si(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Mi(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function Z(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Fi(e){return Ye(e)}function Ci(e){return Ye(e)}function ie(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function je(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,n){return e},captureMetaData:!1},ki=function(e){return Object.assign({},ji,e)};let $e;typeof Symbol!="function"?$e="@@xmlMetadata":$e=Symbol("XML Node Metadata");class Oe{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){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}),n!==void 0&&(this.child[this.child.length-1][$e]={startIndex:n})}static getMetaDataSymbol(){return $e}}class Bi{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const r={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let o=1,i=!1,s=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!s){if(i&&Ne(t,"!ENTITY",n)){n+=7;let u,p;[u,p,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),p.indexOf("&")===-1&&(r[u]={regx:RegExp(`&${u};`,"g"),val:p})}else if(i&&Ne(t,"!ELEMENT",n)){n+=8;const{index:u}=this.readElementExp(t,n+1);n=u}else if(i&&Ne(t,"!ATTLIST",n))n+=8;else if(i&&Ne(t,"!NOTATION",n)){n+=9;const{index:u}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=u}else if(Ne(t,"!--",n))s=!0;else throw new Error("Invalid DOCTYPE");o++,a=""}else if(t[n]===">"){if(s?t[n-1]==="-"&&t[n-2]==="-"&&(s=!1,o--):o--,o===0)break}else t[n]==="["?i=!0:a+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(ke(r),n=ae(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let o="";return[n,o]=this.readIdentifierVal(t,n,"entity"),n--,[r,o,n]}readNotationExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&ke(r),n=ae(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=ae(t,n);let i=null,s=null;if(o==="PUBLIC")[n,i]=this.readIdentifierVal(t,n,"publicIdentifier"),n=ae(t,n),(t[n]==='"'||t[n]==="'")&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:i,systemIdentifier:s,index:--n}}readIdentifierVal(t,n,r){let o="";const i=t[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);for(n++;n<t.length&&t[n]!==i;)o+=t[n],n++;if(t[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Ye(r))throw new Error(`Invalid element name: "${r}"`);n=ae(t,n);let o="";if(t[n]==="E"&&Ne(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Ne(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;ke(r),n=ae(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!ke(o))throw new Error(`Invalid attribute name: "${o}"`);n=ae(t,n);let i="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(i="NOTATION",n+=8,n=ae(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let a=[];for(;n<t.length&&t[n]!==")";){let u="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)u+=t[n],n++;if(u=u.trim(),!ke(u))throw new Error(`Invalid notation name: "${u}"`);a.push(u),t[n]==="|"&&(n++,n=ae(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,i+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)i+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}n=ae(t,n);let s="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(s="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(s="#IMPLIED",n+=7):[n,s]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:i,defaultValue:s,index:n}}}const ae=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Ne(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function ke(e){if(Ye(e))return e;throw new Error(`Invalid entity name ${e}`)}const Ri=/^[-+]?0x[a-fA-F0-9]+$/,Xi=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Ui={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function Vi(e,t={}){if(t=Object.assign({},Ui,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&Ri.test(n))return Hi(n,16);if(n.includes("e")||n.includes("E"))return qi(e,n,t);{const r=Xi.exec(n);if(r){const o=r[1]||"",i=r[2];let s=Wi(r[3]);const a=o?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a))return e;{const u=Number(n),p=String(u);if(u===0)return u;if(p.search(/[eE]/)!==-1)return t.eNotation?u:e;if(n.indexOf(".")!==-1)return p==="0"||p===s||p===`${o}${s}`?u:e;let d=i?s:n;return i?d===p||o+d===p?u:e:d===p||d===o+p?u:e}}else return e}}const $i=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function qi(e,t,n){if(!n.eNotation)return e;const r=t.match($i);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?e[s.length+1]===i:e[s.length]===i;return s.length>1&&a?e:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(t):n.leadingZeros&&!a?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function Wi(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 Hi(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 Ar(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Gi{constructor(t){if(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:(n,r)=>Nn(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>Nn(r,16,"&#x")}},this.addExternalEntities=Yi,this.parseXml=Ki,this.parseTextData=zi,this.resolveNameSpace=Qi,this.buildAttributesMap=Zi,this.isItStopNode=rs,this.replaceEntitiesValue=ts,this.readStopNodeData=ss,this.saveTextToParentTag=ns,this.addChild=es,this.ignoreAttributesFn=Ar(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function Yi(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function zi(e,t,n,r,o,i,s){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,o,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?qt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?qt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Qi(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const Ji=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Zi(e,t){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const n=Or(e,Ji),r=n.length,o={};for(let i=0;i<r;i++){const s=this.resolveNameSpace(n[i][1]);if(this.ignoreAttributesFn(s,t))continue;let a=n[i][4],u=this.options.attributeNamePrefix+s;if(s.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),a!==void 0){this.options.trimValues&&(a=a.trim()),a=this.replaceEntitiesValue(a);const p=this.options.attributeValueProcessor(s,a,t);p==null?o[u]=a:typeof p!=typeof a||p!==a?o[u]=p:o[u]=qt(a,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const Ki=function(e){e=e.replace(/\r\n?/g,`
4
- `);const t=new Oe("!xml");let n=t,r="",o="";const i=new Bi(this.options.processEntities);for(let s=0;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="/"){const u=Ae(e,">",s,"Closing Tag is not closed.");let p=e.substring(s+2,u).trim();if(this.options.removeNSPrefix){const h=p.indexOf(":");h!==-1&&(p=p.substr(h+1))}this.options.transformTagName&&(p=this.options.transformTagName(p)),n&&(r=this.saveTextToParentTag(r,n,o));const d=o.substring(o.lastIndexOf(".")+1);if(p&&this.options.unpairedTags.indexOf(p)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${p}>`);let l=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(l=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=o.lastIndexOf("."),o=o.substring(0,l),n=this.tagsNodeStack.pop(),r="",s=u}else if(e[s+1]==="?"){let u=$t(e,s,!1,"?>");if(!u)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&u.tagName==="?xml"||this.options.ignorePiTags)){const p=new Oe(u.tagName);p.add(this.options.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&(p[":@"]=this.buildAttributesMap(u.tagExp,o)),this.addChild(n,p,o,s)}s=u.closeIndex+1}else if(e.substr(s+1,3)==="!--"){const u=Ae(e,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const p=e.substring(s+4,u-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:p}])}s=u}else if(e.substr(s+1,2)==="!D"){const u=i.readDocType(e,s);this.docTypeEntities=u.entities,s=u.i}else if(e.substr(s+1,2)==="!["){const u=Ae(e,"]]>",s,"CDATA is not closed.")-2,p=e.substring(s+9,u);r=this.saveTextToParentTag(r,n,o);let d=this.parseTextData(p,n.tagname,o,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:p}]):n.add(this.options.textNodeName,d),s=u+2}else{let u=$t(e,s,this.options.removeNSPrefix),p=u.tagName;const d=u.rawTagName;let l=u.tagExp,h=u.attrExpPresent,b=u.closeIndex;if(this.options.transformTagName){const y=this.options.transformTagName(p);l===p&&(l=y),p=y}n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const T=n;T&&this.options.unpairedTags.indexOf(T.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),p!==t.tagname&&(o+=o?"."+p:p);const O=s;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,p)){let y="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)p[p.length-1]==="/"?(p=p.substr(0,p.length-1),o=o.substr(0,o.length-1),l=p):l=l.substr(0,l.length-1),s=u.closeIndex;else if(this.options.unpairedTags.indexOf(p)!==-1)s=u.closeIndex;else{const E=this.readStopNodeData(e,d,b+1);if(!E)throw new Error(`Unexpected end of ${d}`);s=E.i,y=E.tagContent}const D=new Oe(p);p!==l&&h&&(D[":@"]=this.buildAttributesMap(l,o)),y&&(y=this.parseTextData(y,p,o,!0,h,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),D.add(this.options.textNodeName,y),this.addChild(n,D,o,O)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){if(p[p.length-1]==="/"?(p=p.substr(0,p.length-1),o=o.substr(0,o.length-1),l=p):l=l.substr(0,l.length-1),this.options.transformTagName){const D=this.options.transformTagName(p);l===p&&(l=D),p=D}const y=new Oe(p);p!==l&&h&&(y[":@"]=this.buildAttributesMap(l,o)),this.addChild(n,y,o,O),o=o.substr(0,o.lastIndexOf("."))}else{const y=new Oe(p);this.tagsNodeStack.push(n),p!==l&&h&&(y[":@"]=this.buildAttributesMap(l,o)),this.addChild(n,y,o,O),n=y}r="",s=b}}else r+=e[s];return t.child};function es(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const ts=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function ns(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function rs(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function is(e,t,n=">"){let r,o="";for(let i=t;i<e.length;i++){let s=e[i];if(r)s===r&&(r="");else if(s==='"'||s==="'")r=s;else if(s===n[0])if(n[1]){if(e[i+1]===n[1])return{data:o,index:i}}else return{data:o,index:i};else s===" "&&(s=" ");o+=s}}function Ae(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function $t(e,t,n,r=">"){const o=is(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,p=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const d=u;if(n){const l=u.indexOf(":");l!==-1&&(u=u.substr(l+1),p=u!==o.data.substr(l+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:p,rawTagName:d}}function ss(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=Ae(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=Ae(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Ae(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Ae(e,"]]>",n,"StopNode is not closed.")-2;else{const i=$t(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,n=i.closeIndex)}}function qt(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:Vi(e,n)}else return Oi(e)?e:""}function Nn(e,t,n){const r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+";"}const tt=Oe.getMetaDataSymbol();function os(e,t){return Lr(e,t)}function Lr(e,t,n){let r;const o={};for(let i=0;i<e.length;i++){const s=e[i],a=as(s);let u="";if(n===void 0?u=a:u=n+"."+a,a===t.textNodeName)r===void 0?r=s[a]:r+=""+s[a];else{if(a===void 0)continue;if(s[a]){let p=Lr(s[a],t,u);const d=cs(p,t);s[tt]!==void 0&&(p[tt]=s[tt]),s[":@"]?us(p,s[":@"],u,t):Object.keys(p).length===1&&p[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?p=p[t.textNodeName]:Object.keys(p).length===0&&(t.alwaysCreateTextNode?p[t.textNodeName]="":p=""),o[a]!==void 0&&o.hasOwnProperty(a)?(Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(p)):t.isArray(a,u,d)?o[a]=[p]:o[a]=p}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function as(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function us(e,t,n,r){if(t){const o=Object.keys(t),i=o.length;for(let s=0;s<i;s++){const a=o[s];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function cs(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class Pr{constructor(t){this.externalEntities={},this.options=ki(t)}parse(t,n){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(n){n===!0&&(n={});const i=Li(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new Gi(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:os(o,this.options)}addEntity(t,n){if(n.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(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return Oe.getMetaDataSymbol()}}const ls=`
5
- `;function fs(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=ls),xr(e,t,"",n)}function xr(e,t,n,r){let o="",i=!1;for(let s=0;s<e.length;s++){const a=e[s],u=ps(a);if(u===void 0)continue;let p="";if(n.length===0?p=u:p=`${n}.${u}`,u===t.textNodeName){let T=a[u];hs(p,t)||(T=t.tagValueProcessor(u,T),T=_r(T,t)),i&&(o+=r),o+=T,i=!1;continue}else if(u===t.cdataPropName){i&&(o+=r),o+=`<![CDATA[${a[u][0][t.textNodeName]}]]>`,i=!1;continue}else if(u===t.commentPropName){o+=r+`<!--${a[u][0][t.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){const T=In(a[":@"],t),O=u==="?xml"?"":r;let y=a[u][0][t.textNodeName];y=y.length!==0?" "+y:"",o+=O+`<${u}${y}${T}?>`,i=!0;continue}let d=r;d!==""&&(d+=t.indentBy);const l=In(a[":@"],t),h=r+`<${u}${l}`,b=xr(a[u],t,p,d);t.unpairedTags.indexOf(u)!==-1?t.suppressUnpairedNode?o+=h+">":o+=h+"/>":(!b||b.length===0)&&t.suppressEmptyNode?o+=h+"/>":b&&b.endsWith(">")?o+=h+`>${b}${r}</${u}>`:(o+=h+">",b&&r!==""&&(b.includes("/>")||b.includes("</"))?o+=r+t.indentBy+b+r:o+=b,o+=`</${u}>`),i=!0}return o}function ps(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function In(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=_r(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function hs(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function _r(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const ds={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 we(e){this.options=Object.assign({},ds,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ar(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ys),this.processTextOrObjNode=gs,this.options.format?(this.indentate=ms,this.tagEndChar=`>
1
+ import{LatestSupportedPHPVersion as ri,SupportedPHPVersionsList as ii,PHP as si,FileLockManagerInMemory as oi}from"@php-wasm/universal";import{spawn as ai}from"child_process";import K,{readFileSync as Qt,writeFile as ui,statSync as ci,readdirSync as li,lstatSync as fi,existsSync as pi,writeFileSync as Tr,mkdtempSync as mn,chmodSync as hi}from"fs";import yn from"os";import{rootCertificates as di}from"tls";import oe,{resolve as Jt,normalize as gi}from"path";import{loadNodeRuntime as mi,useHostFilesystem as yi}from"@php-wasm/node";import{WebSocketServer as bi}from"ws";import wi from"net";import"assert";import{format as Nr}from"util";import{fileURLToPath as Ei}from"url";import{createHash as Ti}from"crypto";import Ni from"timers";function Ir(e){let t=e.replaceAll("\\","/");const n=t.match(/^([A-Za-z]):\//);return n&&(t="/"+n[1]+t.slice(2)),t}const Or=":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",Ii=Or+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Oi="["+Or+"]["+Ii+"]*",vi=new RegExp("^"+Oi+"$");function vr(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const i=r.length;for(let s=0;s<i;s++)o.push(r[s]);n.push(o),r=t.exec(e)}return n}const Ye=function(e){const t=vi.exec(e);return!(t===null||typeof t>"u")};function xi(e){return typeof e<"u"}const Ai={allowBooleanAttributes:!1,unpairedTags:[]};function Li(e,t){t=Object.assign({},Ai,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let i=0;i<e.length;i++)if(e[i]==="<"&&e[i+1]==="?"){if(i+=2,i=wn(e,i),i.err)return i}else if(e[i]==="<"){let s=i;if(i++,e[i]==="!"){i=En(e,i);continue}else{let a=!1;e[i]==="/"&&(a=!0,i++);let u="";for(;i<e.length&&e[i]!==">"&&e[i]!==" "&&e[i]!==" "&&e[i]!==`
2
+ `&&e[i]!=="\r";i++)u+=e[i];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),i--),!ji(u)){let p;return u.trim().length===0?p="Invalid space after '<'.":p="Tag '"+u+"' is an invalid name.",Z("InvalidTag",p,ie(e,i))}const l=Di(e,i);if(l===!1)return Z("InvalidAttr","Attributes for '"+u+"' have open quote.",ie(e,i));let f=l.value;if(i=l.index,f[f.length-1]==="/"){const p=i-f.length;f=f.substring(0,f.length-1);const d=Tn(f,t);if(d===!0)r=!0;else return Z(d.err.code,d.err.msg,ie(e,p+d.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return Z("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",ie(e,s));if(n.length===0)return Z("InvalidTag","Closing tag '"+u+"' has not been opened.",ie(e,s));{const p=n.pop();if(u!==p.tagName){let d=ie(e,p.tagStartPos);return Z("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+d.line+", col "+d.col+") instead of closing tag '"+u+"'.",ie(e,s))}n.length==0&&(o=!0)}}else return Z("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",ie(e,i));else{const p=Tn(f,t);if(p!==!0)return Z(p.err.code,p.err.msg,ie(e,i-f.length+p.err.line));if(o===!0)return Z("InvalidXml","Multiple possible root nodes found.",ie(e,i));t.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:s}),r=!0}for(i++;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="!"){i++,i=En(e,i);continue}else if(e[i+1]==="?"){if(i=wn(e,++i),i.err)return i}else break;else if(e[i]==="&"){const p=Ci(e,i);if(p==-1)return Z("InvalidChar","char '&' is not expected.",ie(e,i));i=p}else if(o===!0&&!bn(e[i]))return Z("InvalidXml","Extra text at the end",ie(e,i));e[i]==="<"&&i--}}else{if(bn(e[i]))continue;return Z("InvalidChar","char '"+e[i]+"' is not expected.",ie(e,i))}if(r){if(n.length==1)return Z("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ie(e,n[0].tagStartPos));if(n.length>0)return Z("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Z("InvalidXml","Start tag expected.",1);return!0}function bn(e){return e===" "||e===" "||e===`
3
+ `||e==="\r"}function wn(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return Z("InvalidXml","XML declaration allowed only at the start of the document.",ie(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function En(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 n=1;for(t+=8;t<e.length;t++)if(e[t]==="<")n++;else if(e[t]===">"&&(n--,n===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 Pi='"',_i="'";function Di(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===Pi||e[t]===_i)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const Mi=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Tn(e,t){const n=vr(e,Mi),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",je(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Z("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",je(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Z("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",je(n[o]));const i=n[o][2];if(!Fi(i))return Z("InvalidAttr","Attribute '"+i+"' is an invalid name.",je(n[o]));if(!r.hasOwnProperty(i))r[i]=1;else return Z("InvalidAttr","Attribute '"+i+"' is repeated.",je(n[o]))}return!0}function Si(e,t){let n=/\d/;for(e[t]==="x"&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===";")return t;if(!e[t].match(n))break}return-1}function Ci(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,Si(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===";")break;return-1}return t}function Z(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Fi(e){return Ye(e)}function ji(e){return Ye(e)}function ie(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function je(e){return e.startIndex+e[1].length}const ki={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,n){return e},captureMetaData:!1};function xr(e){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,allowedTags:null,tagFilter:null}:typeof e=="object"&&e!==null?{enabled:e.enabled!==!1,maxEntitySize:e.maxEntitySize??1e4,maxExpansionDepth:e.maxExpansionDepth??10,maxTotalExpansions:e.maxTotalExpansions??1e3,maxExpandedLength:e.maxExpandedLength??1e5,allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null}:xr(!0)}const Bi=function(e){const t=Object.assign({},ki,e);return t.processEntities=xr(t.processEntities),t};let $e;typeof Symbol!="function"?$e="@@xmlMetadata":$e=Symbol("XML Node Metadata");class ve{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t,n){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}),n!==void 0&&(this.child[this.child.length-1][$e]={startIndex:n})}static getMetaDataSymbol(){return $e}}class Ri{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,n){const r={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let o=1,i=!1,s=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!s){if(i&&Ne(t,"!ENTITY",n)){n+=7;let u,l;if([u,l,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),l.indexOf("&")===-1){const f=u.replace(/[.\-+*:]/g,"\\.");r[u]={regx:RegExp(`&${f};`,"g"),val:l}}}else if(i&&Ne(t,"!ELEMENT",n)){n+=8;const{index:u}=this.readElementExp(t,n+1);n=u}else if(i&&Ne(t,"!ATTLIST",n))n+=8;else if(i&&Ne(t,"!NOTATION",n)){n+=9;const{index:u}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=u}else if(Ne(t,"!--",n))s=!0;else throw new Error("Invalid DOCTYPE");o++,a=""}else if(t[n]===">"){if(s?t[n-1]==="-"&&t[n-2]==="-"&&(s=!1,o--):o--,o===0)break}else t[n]==="["?i=!0:a+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(ke(r),n=ae(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let o="";if([n,o]=this.readIdentifierVal(t,n,"entity"),this.options.enabled!==!1&&this.options.maxEntitySize&&o.length>this.options.maxEntitySize)throw new Error(`Entity "${r}" size (${o.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return n--,[r,o,n]}readNotationExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&ke(r),n=ae(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=ae(t,n);let i=null,s=null;if(o==="PUBLIC")[n,i]=this.readIdentifierVal(t,n,"publicIdentifier"),n=ae(t,n),(t[n]==='"'||t[n]==="'")&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,s]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!s))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:i,systemIdentifier:s,index:--n}}readIdentifierVal(t,n,r){let o="";const i=t[n];if(i!=='"'&&i!=="'")throw new Error(`Expected quoted string, found "${i}"`);for(n++;n<t.length&&t[n]!==i;)o+=t[n],n++;if(t[n]!==i)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Ye(r))throw new Error(`Invalid element name: "${r}"`);n=ae(t,n);let o="";if(t[n]==="E"&&Ne(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Ne(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=ae(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;ke(r),n=ae(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!ke(o))throw new Error(`Invalid attribute name: "${o}"`);n=ae(t,n);let i="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(i="NOTATION",n+=8,n=ae(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let a=[];for(;n<t.length&&t[n]!==")";){let u="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)u+=t[n],n++;if(u=u.trim(),!ke(u))throw new Error(`Invalid notation name: "${u}"`);a.push(u),t[n]==="|"&&(n++,n=ae(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,i+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)i+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(i.toUpperCase()))throw new Error(`Invalid attribute type: "${i}"`)}n=ae(t,n);let s="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(s="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(s="#IMPLIED",n+=7):[n,s]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:i,defaultValue:s,index:n}}}const ae=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Ne(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function ke(e){if(Ye(e))return e;throw new Error(`Invalid entity name ${e}`)}const Xi=/^[-+]?0x[a-fA-F0-9]+$/,Ui=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Vi={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function $i(e,t={}){if(t=Object.assign({},Vi,t),!e||typeof e!="string")return e;let n=e.trim();if(t.skipLike!==void 0&&t.skipLike.test(n))return e;if(e==="0")return 0;if(t.hex&&Xi.test(n))return Gi(n,16);if(n.includes("e")||n.includes("E"))return Wi(e,n,t);{const r=Ui.exec(n);if(r){const o=r[1]||"",i=r[2];let s=Hi(r[3]);const a=o?e[i.length+1]===".":e[i.length]===".";if(!t.leadingZeros&&(i.length>1||i.length===1&&!a))return e;{const u=Number(n),l=String(u);if(u===0)return u;if(l.search(/[eE]/)!==-1)return t.eNotation?u:e;if(n.indexOf(".")!==-1)return l==="0"||l===s||l===`${o}${s}`?u:e;let f=i?s:n;return i?f===l||o+f===l?u:e:f===l||f===o+l?u:e}}else return e}}const qi=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Wi(e,t,n){if(!n.eNotation)return e;const r=t.match(qi);if(r){let o=r[1]||"";const i=r[3].indexOf("e")===-1?"E":"e",s=r[2],a=o?e[s.length+1]===i:e[s.length]===i;return s.length>1&&a?e:s.length===1&&(r[3].startsWith(`.${i}`)||r[3][0]===i)?Number(t):n.leadingZeros&&!a?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function Hi(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 Gi(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 Ar(e){return typeof e=="function"?e:Array.isArray(e)?t=>{for(const n of e)if(typeof n=="string"&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}class Yi{constructor(t){if(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:(n,r)=>Nn(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>Nn(r,16,"&#x")}},this.addExternalEntities=zi,this.parseXml=es,this.parseTextData=Qi,this.resolveNameSpace=Ji,this.buildAttributesMap=Ki,this.isItStopNode=is,this.replaceEntitiesValue=ns,this.readStopNodeData=os,this.saveTextToParentTag=rs,this.addChild=ts,this.ignoreAttributesFn=Ar(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function zi(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n],o=r.replace(/[.\-+*:]/g,"\\.");this.lastEntities[r]={regex:new RegExp("&"+o+";","g"),val:e[r]}}}function Qi(e,t,n,r,o,i,s){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e,t,n));const a=this.options.tagValueProcessor(t,e,n,o,i);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?qt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?qt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Ji(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const Zi=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Ki(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=vr(e,Zi),o=r.length,i={};for(let s=0;s<o;s++){const a=this.resolveNameSpace(r[s][1]);if(this.ignoreAttributesFn(a,t))continue;let u=r[s][4],l=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(l=this.options.transformAttributeName(l)),l==="__proto__"&&(l="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u,n,t);const f=this.options.attributeValueProcessor(a,u,t);f==null?i[l]=u:typeof f!=typeof u||f!==u?i[l]=f:i[l]=qt(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[l]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const s={};return s[this.options.attributesGroupName]=i,s}return i}}const es=function(e){e=e.replace(/\r\n?/g,`
4
+ `);const t=new ve("!xml");let n=t,r="",o="";this.entityExpansionCount=0,this.currentExpandedLength=0;const i=new Ri(this.options.processEntities);for(let s=0;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="/"){const u=xe(e,">",s,"Closing Tag is not closed.");let l=e.substring(s+2,u).trim();if(this.options.removeNSPrefix){const d=l.indexOf(":");d!==-1&&(l=l.substr(d+1))}this.options.transformTagName&&(l=this.options.transformTagName(l)),n&&(r=this.saveTextToParentTag(r,n,o));const f=o.substring(o.lastIndexOf(".")+1);if(l&&this.options.unpairedTags.indexOf(l)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);let p=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(p=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=o.lastIndexOf("."),o=o.substring(0,p),n=this.tagsNodeStack.pop(),r="",s=u}else if(e[s+1]==="?"){let u=$t(e,s,!1,"?>");if(!u)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&u.tagName==="?xml"||this.options.ignorePiTags)){const l=new ve(u.tagName);l.add(this.options.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&(l[":@"]=this.buildAttributesMap(u.tagExp,o,u.tagName)),this.addChild(n,l,o,s)}s=u.closeIndex+1}else if(e.substr(s+1,3)==="!--"){const u=xe(e,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){const l=e.substring(s+4,u-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:l}])}s=u}else if(e.substr(s+1,2)==="!D"){const u=i.readDocType(e,s);this.docTypeEntities=u.entities,s=u.i}else if(e.substr(s+1,2)==="!["){const u=xe(e,"]]>",s,"CDATA is not closed.")-2,l=e.substring(s+9,u);r=this.saveTextToParentTag(r,n,o);let f=this.parseTextData(l,n.tagname,o,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:l}]):n.add(this.options.textNodeName,f),s=u+2}else{let u=$t(e,s,this.options.removeNSPrefix),l=u.tagName;const f=u.rawTagName;let p=u.tagExp,d=u.attrExpPresent,b=u.closeIndex;if(this.options.transformTagName){const y=this.options.transformTagName(l);p===l&&(p=y),l=y}n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const E=n;E&&this.options.unpairedTags.indexOf(E.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),l!==t.tagname&&(o+=o?"."+l:l);const v=s;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,l)){let y="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)l[l.length-1]==="/"?(l=l.substr(0,l.length-1),o=o.substr(0,o.length-1),p=l):p=p.substr(0,p.length-1),s=u.closeIndex;else if(this.options.unpairedTags.indexOf(l)!==-1)s=u.closeIndex;else{const T=this.readStopNodeData(e,f,b+1);if(!T)throw new Error(`Unexpected end of ${f}`);s=T.i,y=T.tagContent}const D=new ve(l);l!==p&&d&&(D[":@"]=this.buildAttributesMap(p,o,l)),y&&(y=this.parseTextData(y,l,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),D.add(this.options.textNodeName,y),this.addChild(n,D,o,v)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){if(l[l.length-1]==="/"?(l=l.substr(0,l.length-1),o=o.substr(0,o.length-1),p=l):p=p.substr(0,p.length-1),this.options.transformTagName){const D=this.options.transformTagName(l);p===l&&(p=D),l=D}const y=new ve(l);l!==p&&d&&(y[":@"]=this.buildAttributesMap(p,o,l)),this.addChild(n,y,o,v),o=o.substr(0,o.lastIndexOf("."))}else{const y=new ve(l);this.tagsNodeStack.push(n),l!==p&&d&&(y[":@"]=this.buildAttributesMap(p,o,l)),this.addChild(n,y,o,v),n=y}r="",s=b}}else r+=e[s];return t.child};function ts(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const ns=function(e,t,n){if(e.indexOf("&")===-1)return e;const r=this.options.processEntities;if(!r.enabled||r.allowedTags&&!r.allowedTags.includes(t)||r.tagFilter&&!r.tagFilter(t,n))return e;for(let o in this.docTypeEntities){const i=this.docTypeEntities[o],s=e.match(i.regx);if(s){if(this.entityExpansionCount+=s.length,r.maxTotalExpansions&&this.entityExpansionCount>r.maxTotalExpansions)throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${r.maxTotalExpansions}`);const a=e.length;if(e=e.replace(i.regx,i.val),r.maxExpandedLength&&(this.currentExpandedLength+=e.length-a,this.currentExpandedLength>r.maxExpandedLength))throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${r.maxExpandedLength}`)}}if(e.indexOf("&")===-1)return e;for(let o in this.lastEntities){const i=this.lastEntities[o];e=e.replace(i.regex,i.val)}if(e.indexOf("&")===-1)return e;if(this.options.htmlEntities)for(let o in this.htmlEntities){const i=this.htmlEntities[o];e=e.replace(i.regex,i.val)}return e=e.replace(this.ampEntity.regex,this.ampEntity.val),e};function rs(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function is(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function ss(e,t,n=">"){let r,o="";for(let i=t;i<e.length;i++){let s=e[i];if(r)s===r&&(r="");else if(s==='"'||s==="'")r=s;else if(s===n[0])if(n[1]){if(e[i+1]===n[1])return{data:o,index:i}}else return{data:o,index:i};else s===" "&&(s=" ");o+=s}}function xe(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function $t(e,t,n,r=">"){const o=ss(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,l=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const f=u;if(n){const p=u.indexOf(":");p!==-1&&(u=u.substr(p+1),l=u!==o.data.substr(p+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:l,rawTagName:f}}function os(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const i=xe(e,">",n,`${t} is not closed`);if(e.substring(n+2,i).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i};n=i}else if(e[n+1]==="?")n=xe(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=xe(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=xe(e,"]]>",n,"StopNode is not closed.")-2;else{const i=$t(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,n=i.closeIndex)}}function qt(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:$i(e,n)}else return xi(e)?e:""}function Nn(e,t,n){const r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+";"}const tt=ve.getMetaDataSymbol();function as(e,t){return Lr(e,t)}function Lr(e,t,n){let r;const o={};for(let i=0;i<e.length;i++){const s=e[i],a=us(s);let u="";if(n===void 0?u=a:u=n+"."+a,a===t.textNodeName)r===void 0?r=s[a]:r+=""+s[a];else{if(a===void 0)continue;if(s[a]){let l=Lr(s[a],t,u);const f=ls(l,t);s[tt]!==void 0&&(l[tt]=s[tt]),s[":@"]?cs(l,s[":@"],u,t):Object.keys(l).length===1&&l[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?l=l[t.textNodeName]:Object.keys(l).length===0&&(t.alwaysCreateTextNode?l[t.textNodeName]="":l=""),o[a]!==void 0&&o.hasOwnProperty(a)?(Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(l)):t.isArray(a,u,f)?o[a]=[l]:o[a]=l}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function us(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function cs(e,t,n,r){if(t){const o=Object.keys(t),i=o.length;for(let s=0;s<i;s++){const a=o[s];r.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function ls(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class Pr{constructor(t){this.externalEntities={},this.options=Bi(t)}parse(t,n){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(n){n===!0&&(n={});const i=Li(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new Yi(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:as(o,this.options)}addEntity(t,n){if(n.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(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return ve.getMetaDataSymbol()}}const fs=`
5
+ `;function ps(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=fs),_r(e,t,"",n)}function _r(e,t,n,r){let o="",i=!1;for(let s=0;s<e.length;s++){const a=e[s],u=hs(a);if(u===void 0)continue;let l="";if(n.length===0?l=u:l=`${n}.${u}`,u===t.textNodeName){let E=a[u];ds(l,t)||(E=t.tagValueProcessor(u,E),E=Dr(E,t)),i&&(o+=r),o+=E,i=!1;continue}else if(u===t.cdataPropName){i&&(o+=r),o+=`<![CDATA[${a[u][0][t.textNodeName]}]]>`,i=!1;continue}else if(u===t.commentPropName){o+=r+`<!--${a[u][0][t.textNodeName]}-->`,i=!0;continue}else if(u[0]==="?"){const E=In(a[":@"],t),v=u==="?xml"?"":r;let y=a[u][0][t.textNodeName];y=y.length!==0?" "+y:"",o+=v+`<${u}${y}${E}?>`,i=!0;continue}let f=r;f!==""&&(f+=t.indentBy);const p=In(a[":@"],t),d=r+`<${u}${p}`,b=_r(a[u],t,l,f);t.unpairedTags.indexOf(u)!==-1?t.suppressUnpairedNode?o+=d+">":o+=d+"/>":(!b||b.length===0)&&t.suppressEmptyNode?o+=d+"/>":b&&b.endsWith(">")?o+=d+`>${b}${r}</${u}>`:(o+=d+">",b&&r!==""&&(b.includes("/>")||b.includes("</"))?o+=r+t.indentBy+b+r:o+=b,o+=`</${u}>`),i=!0}return o}function hs(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function In(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=Dr(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function ds(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Dr(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const gs={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 we(e){this.options=Object.assign({},gs,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Ar(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=bs),this.processTextOrObjNode=ms,this.options.format?(this.indentate=ys,this.tagEndChar=`>
6
6
  `,this.newLine=`
7
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}we.prototype.build=function(e){return this.options.preserveOrder?fs(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};we.prototype.j2x=function(e,t,n){let r="",o="";const i=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(o+="");else if(e[s]===null)this.isAttribute(s)||s===this.options.cdataPropName?o+="":s[0]==="?"?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)o+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){const a=this.isAttribute(s);if(a&&!this.ignoreAttributesFn(a,i))r+=this.buildAttrPairStr(a,""+e[s]);else if(!a)if(s===this.options.textNodeName){let u=this.options.tagValueProcessor(s,""+e[s]);o+=this.replaceEntitiesValue(u)}else o+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const a=e[s].length;let u="",p="";for(let d=0;d<a;d++){const l=e[s][d];if(!(typeof l>"u"))if(l===null)s[0]==="?"?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof l=="object")if(this.options.oneListGroup){const h=this.j2x(l,t+1,n.concat(s));u+=h.val,this.options.attributesGroupName&&l.hasOwnProperty(this.options.attributesGroupName)&&(p+=h.attrStr)}else u+=this.processTextOrObjNode(l,s,t,n);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(s,l);h=this.replaceEntitiesValue(h),u+=h}else u+=this.buildTextValNode(l,s,"",t)}this.options.oneListGroup&&(u=this.buildObjectNode(u,s,p,t)),o+=u}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const a=Object.keys(e[s]),u=a.length;for(let p=0;p<u;p++)r+=this.buildAttrPairStr(a[p],""+e[s][a[p]])}else o+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:r,val:o}};we.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 gs(e,t,n,r){const o=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}we.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+o}};we.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};we.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}};we.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function ms(e){return this.options.indentBy.repeat(e)}function ys(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}function Dr(e,t=!1){const n=e.length;let r=0,o="",i=0,s=16,a=0,u=0,p=0,d=0,l=0;function h(f,w){let I=0,x=0;for(;I<f;){let P=e.charCodeAt(r);if(P>=48&&P<=57)x=x*16+P-48;else if(P>=65&&P<=70)x=x*16+P-65+10;else if(P>=97&&P<=102)x=x*16+P-97+10;else break;r++,I++}return I<f&&(x=-1),x}function b(f){r=f,o="",i=0,s=16,l=0}function T(){let f=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&xe(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&xe(e.charCodeAt(r)))for(r++;r<e.length&&xe(e.charCodeAt(r));)r++;else return l=3,e.substring(f,r);let w=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&xe(e.charCodeAt(r))){for(r++;r<e.length&&xe(e.charCodeAt(r));)r++;w=r}else l=3;return e.substring(f,w)}function O(){let f="",w=r;for(;;){if(r>=n){f+=e.substring(w,r),l=2;break}const I=e.charCodeAt(r);if(I===34){f+=e.substring(w,r),r++;break}if(I===92){if(f+=e.substring(w,r),r++,r>=n){l=2;break}switch(e.charCodeAt(r++)){case 34:f+='"';break;case 92:f+="\\";break;case 47:f+="/";break;case 98:f+="\b";break;case 102:f+="\f";break;case 110:f+=`
8
- `;break;case 114:f+="\r";break;case 116:f+=" ";break;case 117:const P=h(4);P>=0?f+=String.fromCharCode(P):l=4;break;default:l=5}w=r;continue}if(I>=0&&I<=31)if(Be(I)){f+=e.substring(w,r),l=2;break}else l=6;r++}return f}function y(){if(o="",l=0,i=r,u=a,d=p,r>=n)return i=n,s=17;let f=e.charCodeAt(r);if(nt(f)){do r++,o+=String.fromCharCode(f),f=e.charCodeAt(r);while(nt(f));return s=15}if(Be(f))return r++,o+=String.fromCharCode(f),f===13&&e.charCodeAt(r)===10&&(r++,o+=`
9
- `),a++,p=r,s=14;switch(f){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,o=O(),s=10;case 47:const w=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Be(e.charCodeAt(r));)r++;return o=e.substring(w,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;const I=n-1;let x=!1;for(;r<I;){const P=e.charCodeAt(r);if(P===42&&e.charCodeAt(r+1)===47){r+=2,x=!0;break}r++,Be(P)&&(P===13&&e.charCodeAt(r)===10&&r++,a++,p=r)}return x||(r++,l=1),o=e.substring(w,r),s=13}return o+=String.fromCharCode(f),r++,s=16;case 45:if(o+=String.fromCharCode(f),r++,r===n||!xe(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=T(),s=11;default:for(;r<n&&D(f);)r++,f=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(f),r++,s=16}}function D(f){if(nt(f)||Be(f))return!1;switch(f){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function E(){let f;do f=y();while(f>=12&&f<=15);return f}return{setPosition:b,getPosition:()=>r,scan:t?E:y,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-d,getTokenError:()=>l}}function nt(e){return e===32||e===9}function Be(e){return e===10||e===13}function xe(e){return e>=48&&e<=57}var vn;(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"})(vn||(vn={}));const ce=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),_e=200,On={" ":{"\n":new Array(_e).fill(0).map((e,t)=>`
7
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}we.prototype.build=function(e){return this.options.preserveOrder?ps(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};we.prototype.j2x=function(e,t,n){let r="",o="";const i=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(typeof e[s]>"u")this.isAttribute(s)&&(o+="");else if(e[s]===null)this.isAttribute(s)||s===this.options.cdataPropName?o+="":s[0]==="?"?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)o+=this.buildTextValNode(e[s],s,"",t);else if(typeof e[s]!="object"){const a=this.isAttribute(s);if(a&&!this.ignoreAttributesFn(a,i))r+=this.buildAttrPairStr(a,""+e[s]);else if(!a)if(s===this.options.textNodeName){let u=this.options.tagValueProcessor(s,""+e[s]);o+=this.replaceEntitiesValue(u)}else o+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const a=e[s].length;let u="",l="";for(let f=0;f<a;f++){const p=e[s][f];if(!(typeof p>"u"))if(p===null)s[0]==="?"?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const d=this.j2x(p,t+1,n.concat(s));u+=d.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(l+=d.attrStr)}else u+=this.processTextOrObjNode(p,s,t,n);else if(this.options.oneListGroup){let d=this.options.tagValueProcessor(s,p);d=this.replaceEntitiesValue(d),u+=d}else u+=this.buildTextValNode(p,s,"",t)}this.options.oneListGroup&&(u=this.buildObjectNode(u,s,l,t)),o+=u}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const a=Object.keys(e[s]),u=a.length;for(let l=0;l<u;l++)r+=this.buildAttrPairStr(a[l],""+e[s][a[l]])}else o+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:r,val:o}};we.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 ms(e,t,n,r){const o=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}we.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,i="";return t[0]==="?"&&(i="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+i+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&i.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+i+this.tagEndChar+e+this.indentate(r)+o}};we.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};we.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}};we.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function ys(e){return this.options.indentBy.repeat(e)}function bs(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}function Mr(e,t=!1){const n=e.length;let r=0,o="",i=0,s=16,a=0,u=0,l=0,f=0,p=0;function d(h,w){let I=0,P=0;for(;I<h;){let L=e.charCodeAt(r);if(L>=48&&L<=57)P=P*16+L-48;else if(L>=65&&L<=70)P=P*16+L-65+10;else if(L>=97&&L<=102)P=P*16+L-97+10;else break;r++,I++}return I<h&&(P=-1),P}function b(h){r=h,o="",i=0,s=16,p=0}function E(){let h=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Pe(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Pe(e.charCodeAt(r)))for(r++;r<e.length&&Pe(e.charCodeAt(r));)r++;else return p=3,e.substring(h,r);let w=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&Pe(e.charCodeAt(r))){for(r++;r<e.length&&Pe(e.charCodeAt(r));)r++;w=r}else p=3;return e.substring(h,w)}function v(){let h="",w=r;for(;;){if(r>=n){h+=e.substring(w,r),p=2;break}const I=e.charCodeAt(r);if(I===34){h+=e.substring(w,r),r++;break}if(I===92){if(h+=e.substring(w,r),r++,r>=n){p=2;break}switch(e.charCodeAt(r++)){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 L=d(4);L>=0?h+=String.fromCharCode(L):p=4;break;default:p=5}w=r;continue}if(I>=0&&I<=31)if(Be(I)){h+=e.substring(w,r),p=2;break}else p=6;r++}return h}function y(){if(o="",p=0,i=r,u=a,f=l,r>=n)return i=n,s=17;let h=e.charCodeAt(r);if(nt(h)){do r++,o+=String.fromCharCode(h),h=e.charCodeAt(r);while(nt(h));return s=15}if(Be(h))return r++,o+=String.fromCharCode(h),h===13&&e.charCodeAt(r)===10&&(r++,o+=`
9
+ `),a++,l=r,s=14;switch(h){case 123:return r++,s=1;case 125:return r++,s=2;case 91:return r++,s=3;case 93:return r++,s=4;case 58:return r++,s=6;case 44:return r++,s=5;case 34:return r++,o=v(),s=10;case 47:const w=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Be(e.charCodeAt(r));)r++;return o=e.substring(w,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;const I=n-1;let P=!1;for(;r<I;){const L=e.charCodeAt(r);if(L===42&&e.charCodeAt(r+1)===47){r+=2,P=!0;break}r++,Be(L)&&(L===13&&e.charCodeAt(r)===10&&r++,a++,l=r)}return P||(r++,p=1),o=e.substring(w,r),s=13}return o+=String.fromCharCode(h),r++,s=16;case 45:if(o+=String.fromCharCode(h),r++,r===n||!Pe(e.charCodeAt(r)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=E(),s=11;default:for(;r<n&&D(h);)r++,h=e.charCodeAt(r);if(i!==r){switch(o=e.substring(i,r),o){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return o+=String.fromCharCode(h),r++,s=16}}function D(h){if(nt(h)||Be(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 T(){let h;do h=y();while(h>=12&&h<=15);return h}return{setPosition:b,getPosition:()=>r,scan:t?T:y,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-f,getTokenError:()=>p}}function nt(e){return e===32||e===9}function Be(e){return e===10||e===13}function Pe(e){return e>=48&&e<=57}var On;(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"})(On||(On={}));const ce=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),_e=200,vn={" ":{"\n":new Array(_e).fill(0).map((e,t)=>`
10
10
  `+" ".repeat(t)),"\r":new Array(_e).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(_e).fill(0).map((e,t)=>`\r
11
11
  `+" ".repeat(t))}," ":{"\n":new Array(_e).fill(0).map((e,t)=>`
12
12
  `+" ".repeat(t)),"\r":new Array(_e).fill(0).map((e,t)=>"\r"+" ".repeat(t)),"\r\n":new Array(_e).fill(0).map((e,t)=>`\r
13
- `+" ".repeat(t))}},bs=[`
13
+ `+" ".repeat(t))}},ws=[`
14
14
  `,"\r",`\r
15
- `];function ws(e,t,n){let r,o,i,s,a;if(t){for(s=t.offset,a=s+t.length,i=s;i>0&&!qe(e,i-1);)i--;let I=a;for(;I<e.length&&!qe(e,I);)I++;o=e.substring(i,I),r=Ts(o,n)}else o=e,r=0,i=0,s=0,a=e.length;const u=Es(n,e),p=bs.includes(u);let d=0,l=0,h;n.insertSpaces?h=ce[n.tabSize||4]??De(ce[1],n.tabSize||4):h=" ";const b=h===" "?" ":" ";let T=Dr(o,!1),O=!1;function y(){if(d>1)return De(u,d)+De(h,r+l);const I=h.length*(r+l);return!p||I>On[b][u].length?u+De(h,r+l):I<=0?u:On[b][u][I]}function D(){let I=T.scan();for(d=0;I===15||I===14;)I===14&&n.keepLines?d+=1:I===14&&(d=1),I=T.scan();return O=I===16||T.getTokenError()!==0,I}const E=[];function f(I,x,P){!O&&(!t||x<a&&P>s)&&e.substring(x,P)!==I&&E.push({offset:x,length:P-x,content:I})}let w=D();if(n.keepLines&&d>0&&f(De(u,d),0,0),w!==17){let I=T.getTokenOffset()+i,x=h.length*r<20&&n.insertSpaces?ce[h.length*r]:De(h,r);f(x,i,I)}for(;w!==17;){let I=T.getTokenOffset()+T.getTokenLength()+i,x=D(),P="",S=!1;for(;d===0&&(x===12||x===13);){let _=T.getTokenOffset()+i;f(ce[1],I,_),I=T.getTokenOffset()+T.getTokenLength()+i,S=x===12,P=S?y():"",x=D()}if(x===2)w!==1&&l--,n.keepLines&&d>0||!n.keepLines&&w!==1?P=y():n.keepLines&&(P=ce[1]);else if(x===4)w!==3&&l--,n.keepLines&&d>0||!n.keepLines&&w!==3?P=y():n.keepLines&&(P=ce[1]);else{switch(w){case 3:case 1:l++,n.keepLines&&d>0||!n.keepLines?P=y():P=ce[1];break;case 5:n.keepLines&&d>0||!n.keepLines?P=y():P=ce[1];break;case 12:P=y();break;case 13:d>0?P=y():S||(P=ce[1]);break;case 6:n.keepLines&&d>0?P=y():S||(P=ce[1]);break;case 10:n.keepLines&&d>0?P=y():x===6&&!S&&(P="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&d>0?P=y():(x===12||x===13)&&!S?P=ce[1]:x!==5&&x!==17&&(O=!0);break;case 16:O=!0;break}d>0&&(x===12||x===13)&&(P=y())}x===17&&(n.keepLines&&d>0?P=y():P=n.insertFinalNewline?u:"");const c=T.getTokenOffset()+i;f(P,I,c),w=x}return E}function De(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Ts(e,t){let n=0,r=0;const o=t.tabSize||4;for(;n<e.length;){let i=e.charAt(n);if(i===ce[1])r++;else if(i===" ")r+=o;else break;n++}return Math.floor(r/o)}function Es(e,t){for(let n=0;n<t.length;n++){const r=t.charAt(n);if(r==="\r")return n+1<t.length&&t.charAt(n+1)===`
15
+ `];function Es(e,t,n){let r,o,i,s,a;if(t){for(s=t.offset,a=s+t.length,i=s;i>0&&!qe(e,i-1);)i--;let I=a;for(;I<e.length&&!qe(e,I);)I++;o=e.substring(i,I),r=Ts(o,n)}else o=e,r=0,i=0,s=0,a=e.length;const u=Ns(n,e),l=ws.includes(u);let f=0,p=0,d;n.insertSpaces?d=ce[n.tabSize||4]??De(ce[1],n.tabSize||4):d=" ";const b=d===" "?" ":" ";let E=Mr(o,!1),v=!1;function y(){if(f>1)return De(u,f)+De(d,r+p);const I=d.length*(r+p);return!l||I>vn[b][u].length?u+De(d,r+p):I<=0?u:vn[b][u][I]}function D(){let I=E.scan();for(f=0;I===15||I===14;)I===14&&n.keepLines?f+=1:I===14&&(f=1),I=E.scan();return v=I===16||E.getTokenError()!==0,I}const T=[];function h(I,P,L){!v&&(!t||P<a&&L>s)&&e.substring(P,L)!==I&&T.push({offset:P,length:L-P,content:I})}let w=D();if(n.keepLines&&f>0&&h(De(u,f),0,0),w!==17){let I=E.getTokenOffset()+i,P=d.length*r<20&&n.insertSpaces?ce[d.length*r]:De(d,r);h(P,i,I)}for(;w!==17;){let I=E.getTokenOffset()+E.getTokenLength()+i,P=D(),L="",S=!1;for(;f===0&&(P===12||P===13);){let _=E.getTokenOffset()+i;h(ce[1],I,_),I=E.getTokenOffset()+E.getTokenLength()+i,S=P===12,L=S?y():"",P=D()}if(P===2)w!==1&&p--,n.keepLines&&f>0||!n.keepLines&&w!==1?L=y():n.keepLines&&(L=ce[1]);else if(P===4)w!==3&&p--,n.keepLines&&f>0||!n.keepLines&&w!==3?L=y():n.keepLines&&(L=ce[1]);else{switch(w){case 3:case 1:p++,n.keepLines&&f>0||!n.keepLines?L=y():L=ce[1];break;case 5:n.keepLines&&f>0||!n.keepLines?L=y():L=ce[1];break;case 12:L=y();break;case 13:f>0?L=y():S||(L=ce[1]);break;case 6:n.keepLines&&f>0?L=y():S||(L=ce[1]);break;case 10:n.keepLines&&f>0?L=y():P===6&&!S&&(L="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&f>0?L=y():(P===12||P===13)&&!S?L=ce[1]:P!==5&&P!==17&&(v=!0);break;case 16:v=!0;break}f>0&&(P===12||P===13)&&(L=y())}P===17&&(n.keepLines&&f>0?L=y():L=n.insertFinalNewline?u:"");const c=E.getTokenOffset()+i;h(L,I,c),w=P}return T}function De(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Ts(e,t){let n=0,r=0;const o=t.tabSize||4;for(;n<e.length;){let i=e.charAt(n);if(i===ce[1])r++;else if(i===" ")r+=o;else break;n++}return Math.floor(r/o)}function Ns(e,t){for(let n=0;n<t.length;n++){const r=t.charAt(n);if(r==="\r")return n+1<t.length&&t.charAt(n+1)===`
16
16
  `?`\r
17
17
  `:"\r";if(r===`
18
18
  `)return`
19
19
  `}return e&&e.eol||`
20
20
  `}function qe(e,t){return`\r
21
- `.indexOf(e.charAt(t))!==-1}var We;(function(e){e.DEFAULT={allowTrailingComma:!1}})(We||(We={}));function Mr(e,t=[],n=We.DEFAULT){let r={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(u){r.type==="property"&&(r.length=u-r.offset,r=r.parent)}function i(u){return r.children.push(u),u}Ns(e,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,p,d)=>{r=i({type:"property",offset:p,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:p,length:d,parent:r})},onObjectEnd:(u,p)=>{o(u+p),r.length=u+p-r.offset,r=r.parent,o(u+p)},onArrayBegin:(u,p)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,p)=>{r.length=u+p-r.offset,r=r.parent,o(u+p)},onLiteralValue:(u,p,d)=>{i({type:Is(u),offset:p,length:d,parent:r,value:u}),o(p+d)},onSeparator:(u,p,d)=>{r.type==="property"&&(u===":"?r.colonOffset=p:u===","&&o(p))},onError:(u,p,d)=>{t.push({error:u,offset:p,length:d})}},n);const a=r.children[0];return a&&delete a.parent,a}function Wt(e,t){if(!e)return;let n=e;for(let r of t)if(typeof r=="string"){if(n.type!=="object"||!Array.isArray(n.children))return;let o=!1;for(const i of n.children)if(Array.isArray(i.children)&&i.children[0].value===r&&i.children.length===2){n=i.children[1],o=!0;break}if(!o)return}else{const o=r;if(n.type!=="array"||o<0||!Array.isArray(n.children)||o>=n.children.length)return;n=n.children[o]}return n}function Ns(e,t,n=We.DEFAULT){const r=Dr(e,!1),o=[];let i=0;function s(R){return R?()=>i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(R){return R?V=>i===0&&R(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(R){return R?V=>i===0&&R(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function p(R){return R?()=>{i>0?i++:R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function d(R){return R?()=>{i>0&&i--,i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const l=p(t.onObjectBegin),h=u(t.onObjectProperty),b=d(t.onObjectEnd),T=p(t.onArrayBegin),O=d(t.onArrayEnd),y=u(t.onLiteralValue),D=a(t.onSeparator),E=s(t.onComment),f=a(t.onError),w=n&&n.disallowComments,I=n&&n.allowTrailingComma;function x(){for(;;){const R=r.scan();switch(r.getTokenError()){case 4:P(14);break;case 5:P(15);break;case 3:P(13);break;case 1:w||P(11);break;case 2:P(12);break;case 6:P(16);break}switch(R){case 12:case 13:w?P(10):E();break;case 16:P(1);break;case 15:case 14:break;default:return R}}}function P(R,V=[],G=[]){if(f(R),V.length+G.length>0){let W=r.getToken();for(;W!==17;){if(V.indexOf(W)!==-1){x();break}else if(G.indexOf(W)!==-1)break;W=x()}}}function S(R){const V=r.getTokenValue();return R?y(V):(h(V),o.push(V)),x(),!0}function c(){switch(r.getToken()){case 11:const R=r.getTokenValue();let V=Number(R);isNaN(V)&&(P(2),V=0),y(V);break;case 7:y(null);break;case 8:y(!0);break;case 9:y(!1);break;default:return!1}return x(),!0}function _(){return r.getToken()!==10?(P(3,[],[2,5]),!1):(S(!1),r.getToken()===6?(D(":"),x(),q()||P(4,[],[2,5])):P(5,[],[2,5]),o.pop(),!0)}function C(){l(),x();let R=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(R||P(4,[],[]),D(","),x(),r.getToken()===2&&I)break}else R&&P(6,[],[]);_()||P(4,[],[2,5]),R=!0}return b(),r.getToken()!==2?P(7,[2],[]):x(),!0}function k(){T(),x();let R=!0,V=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(V||P(4,[],[]),D(","),x(),r.getToken()===4&&I)break}else V&&P(6,[],[]);R?(o.push(0),R=!1):o[o.length-1]++,q()||P(4,[],[4,5]),V=!0}return O(),R||o.pop(),r.getToken()!==4?P(8,[4],[]):x(),!0}function q(){switch(r.getToken()){case 3:return k();case 1:return C();case 10:return S(!0);default:return c()}}return x(),r.getToken()===17?n.allowEmptyContent?!0:(P(4,[],[]),!1):q()?(r.getToken()!==17&&P(9,[],[]),!0):(P(4,[],[]),!1)}function Is(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 vs(e,t,n,r){const o=t.slice(),s=Mr(e,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Wt(s,o),a===void 0&&n!==void 0);)typeof u=="string"?n={[u]:n}:n=[n];if(a)if(a.type==="object"&&typeof u=="string"&&Array.isArray(a.children)){const p=Wt(a,[u]);if(p!==void 0)if(n===void 0){if(!p.parent)throw new Error("Malformed AST");const d=a.children.indexOf(p.parent);let l,h=p.parent.offset+p.parent.length;if(d>0){let b=a.children[d-1];l=b.offset+b.length}else l=a.offset+1,a.children.length>1&&(h=a.children[1].offset);return Ie(e,{offset:l,length:h-l,content:""},r)}else return Ie(e,{offset:p.offset,length:p.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const d=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,l=r.getInsertionIndex?r.getInsertionIndex(a.children.map(b=>b.children[0].value)):a.children.length;let h;if(l>0){let b=a.children[l-1];h={offset:b.offset+b.length,length:0,content:","+d}}else a.children.length===0?h={offset:a.offset+1,length:0,content:d}:h={offset:a.offset+1,length:0,content:d+","};return Ie(e,h,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const p=u;if(p===-1){const d=`${JSON.stringify(n)}`;let l;if(a.children.length===0)l={offset:a.offset+1,length:0,content:d};else{const h=a.children[a.children.length-1];l={offset:h.offset+h.length,length:0,content:","+d}}return Ie(e,l,r)}else if(n===void 0&&a.children.length>=0){const d=u,l=a.children[d];let h;if(a.children.length===1)h={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===d){let b=a.children[d-1],T=b.offset+b.length,O=a.offset+a.length;h={offset:T,length:O-2-T,content:""}}else h={offset:l.offset,length:a.children[d+1].offset-l.offset,content:""};return Ie(e,h,r)}else if(n!==void 0){let d;const l=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const h=a.children[u];d={offset:h.offset,length:h.length,content:l}}else if(a.children.length===0||u===0)d={offset:a.offset+1,length:0,content:a.children.length===0?l:l+","};else{const h=u>a.children.length?a.children.length:u,b=a.children[h-1];d={offset:b.offset+b.length,length:0,content:","+l}}return Ie(e,d,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${p} as length is not sufficient`)}else throw new Error(`Can not add ${typeof u!="number"?"index":"property"} to parent of type ${a.type}`);else{if(n===void 0)throw new Error("Can not delete in empty document");return Ie(e,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function Ie(e,t,n){if(!n.formattingOptions)return[t];let r=Ht(e,t),o=t.offset,i=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;o>0&&!qe(r,o-1);)o--;for(;i<r.length&&!qe(r,i);)i++}const s=ws(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const p=s[u];r=Ht(r,p),o=Math.min(o,p.offset),i=Math.max(i,p.offset+p.length),i+=p.content.length-p.length}const a=e.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function Ht(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var An;(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"})(An||(An={}));var Ln;(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"})(Ln||(Ln={}));const He=Mr,Re=Wt;var Pn;(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"})(Pn||(Pn={}));function Os(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 Gt(e,t,n,r){return vs(e,t,n,r)}function Sr(e,t){let n=t.slice(0).sort((o,i)=>{const s=o.offset-i.offset;return s===0?o.length-i.length:s}),r=e.length;for(let o=n.length-1;o>=0;o--){let i=n[o];if(i.offset+i.length<=r)e=Ht(e,i);else throw new Error("Overlapping edit");r=i.offset}return e}function As(e,t){return t.filter(n=>{const r=oe.resolve(n.hostPath),o=oe.join(e,oe.sep);return r===e||r.startsWith(o)})}const Ee={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},Fr={ignoreAttributes:Ee.ignoreAttributes,attributeNamePrefix:Ee.attributeNamePrefix,preserveOrder:Ee.preserveOrder,cdataPropName:Ee.cdataPropName,commentPropName:Ee.commentPropName,suppressBooleanAttributes:!Ee.allowBooleanAttributes,format:!0,indentBy:" "},Ge={allowEmptyContent:!0,allowTrailingComma:!0};function Ls(e,t){const{name:n,host:r,port:o,mappings:i,ideKey:s}=t,a=new Pr(Ee),u=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),p={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(p.server[0].path_mappings=i.map(E=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Ir(oe.relative(t.projectDir,E.hostPath))}`,"remote-root":E.vfsPath}})));let d=u?.find(E=>!!E?.project);if(d){const E=d[":@"]?.version;if(E===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(E!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${E}".`)}d===void 0&&(d={project:[],":@":{version:"4"}},u.push(d));let l=d.project?.find(E=>!!E?.component&&E?.[":@"]?.name==="PhpServers");l===void 0&&(l={component:[],":@":{name:"PhpServers"}},d.project===void 0&&(d.project=[]),d.project.push(l));let h=l.component?.find(E=>!!E?.servers);h===void 0&&(h={servers:[]},l.component===void 0&&(l.component=[]),l.component.push(h));const b=h.servers?.findIndex(E=>!!E?.server&&E?.[":@"]?.name===n);(b===void 0||b<0)&&(h.servers===void 0&&(h.servers=[]),h.servers.push(p));let T=d.project?.find(E=>!!E?.component&&E?.[":@"]?.name==="RunManager");if(T===void 0&&(T={component:[],":@":{name:"RunManager"}},d.project===void 0&&(d.project=[]),d.project.push(T)),(T.component?.findIndex(E=>!!E?.configuration&&E?.[":@"]?.name===n)??-1)<0){const E={configuration:[{method:[],":@":{v:"2"}}],":@":{name:n,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:n,session_id:s}};T.component===void 0&&(T.component=[]),T.component.push(E)}const D=new we(Fr).build(u);try{a.parse(D,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return D}function Ps(e,t){const{name:n,mappings:r}=t,o=[];let i=e,s=He(i,o,Ge);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");let a=Re(s,["configurations"]);if(a===void 0||a.children===void 0){const p=Gt(i,["configurations"],[],{});i=Sr(i,p),s=He(i,[],Ge),a=Re(s,["configurations"])}const u=a?.children?.findIndex(p=>Re(p,["name"])?.value===n);if(u===void 0||u<0){const p={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(p.pathMappings=r.reduce((h,b)=>(h[b.vfsPath]=`\${workspaceFolder}/${Ir(oe.relative(t.workspaceDir,b.hostPath))}`,h),{}));const d=a?.children?.length||0,l=Gt(i,["configurations",d],p,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
22
- `}});i=Cr(i,l)}return i}async function xs({name:e,ides:t,host:n,port:r,cwd:o,mounts:i,ideKey:s="PHPWASMCLI"}){const a=i?As(o,i):[],u={};if(t.includes("phpstorm")){const p=".idea/workspace.xml",d=oe.join(o,p);if(!K.existsSync(d)){if(K.existsSync(oe.dirname(d)))K.writeFileSync(d,`<?xml version="1.0" encoding="UTF-8"?>
21
+ `.indexOf(e.charAt(t))!==-1}var We;(function(e){e.DEFAULT={allowTrailingComma:!1}})(We||(We={}));function Sr(e,t=[],n=We.DEFAULT){let r={type:"array",offset:-1,length:-1,children:[],parent:void 0};function o(u){r.type==="property"&&(r.length=u-r.offset,r=r.parent)}function i(u){return r.children.push(u),u}Is(e,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,l,f)=>{r=i({type:"property",offset:l,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:l,length:f,parent:r})},onObjectEnd:(u,l)=>{o(u+l),r.length=u+l-r.offset,r=r.parent,o(u+l)},onArrayBegin:(u,l)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,l)=>{r.length=u+l-r.offset,r=r.parent,o(u+l)},onLiteralValue:(u,l,f)=>{i({type:Os(u),offset:l,length:f,parent:r,value:u}),o(l+f)},onSeparator:(u,l,f)=>{r.type==="property"&&(u===":"?r.colonOffset=l:u===","&&o(l))},onError:(u,l,f)=>{t.push({error:u,offset:l,length:f})}},n);const a=r.children[0];return a&&delete a.parent,a}function Wt(e,t){if(!e)return;let n=e;for(let r of t)if(typeof r=="string"){if(n.type!=="object"||!Array.isArray(n.children))return;let o=!1;for(const i of n.children)if(Array.isArray(i.children)&&i.children[0].value===r&&i.children.length===2){n=i.children[1],o=!0;break}if(!o)return}else{const o=r;if(n.type!=="array"||o<0||!Array.isArray(n.children)||o>=n.children.length)return;n=n.children[o]}return n}function Is(e,t,n=We.DEFAULT){const r=Mr(e,!1),o=[];let i=0;function s(R){return R?()=>i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function a(R){return R?V=>i===0&&R(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(R){return R?V=>i===0&&R(V,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function l(R){return R?()=>{i>0?i++:R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function f(R){return R?()=>{i>0&&i--,i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const p=l(t.onObjectBegin),d=u(t.onObjectProperty),b=f(t.onObjectEnd),E=l(t.onArrayBegin),v=f(t.onArrayEnd),y=u(t.onLiteralValue),D=a(t.onSeparator),T=s(t.onComment),h=a(t.onError),w=n&&n.disallowComments,I=n&&n.allowTrailingComma;function P(){for(;;){const R=r.scan();switch(r.getTokenError()){case 4:L(14);break;case 5:L(15);break;case 3:L(13);break;case 1:w||L(11);break;case 2:L(12);break;case 6:L(16);break}switch(R){case 12:case 13:w?L(10):T();break;case 16:L(1);break;case 15:case 14:break;default:return R}}}function L(R,V=[],G=[]){if(h(R),V.length+G.length>0){let W=r.getToken();for(;W!==17;){if(V.indexOf(W)!==-1){P();break}else if(G.indexOf(W)!==-1)break;W=P()}}}function S(R){const V=r.getTokenValue();return R?y(V):(d(V),o.push(V)),P(),!0}function c(){switch(r.getToken()){case 11:const R=r.getTokenValue();let V=Number(R);isNaN(V)&&(L(2),V=0),y(V);break;case 7:y(null);break;case 8:y(!0);break;case 9:y(!1);break;default:return!1}return P(),!0}function _(){return r.getToken()!==10?(L(3,[],[2,5]),!1):(S(!1),r.getToken()===6?(D(":"),P(),q()||L(4,[],[2,5])):L(5,[],[2,5]),o.pop(),!0)}function F(){p(),P();let R=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(R||L(4,[],[]),D(","),P(),r.getToken()===2&&I)break}else R&&L(6,[],[]);_()||L(4,[],[2,5]),R=!0}return b(),r.getToken()!==2?L(7,[2],[]):P(),!0}function k(){E(),P();let R=!0,V=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(V||L(4,[],[]),D(","),P(),r.getToken()===4&&I)break}else V&&L(6,[],[]);R?(o.push(0),R=!1):o[o.length-1]++,q()||L(4,[],[4,5]),V=!0}return v(),R||o.pop(),r.getToken()!==4?L(8,[4],[]):P(),!0}function q(){switch(r.getToken()){case 3:return k();case 1:return F();case 10:return S(!0);default:return c()}}return P(),r.getToken()===17?n.allowEmptyContent?!0:(L(4,[],[]),!1):q()?(r.getToken()!==17&&L(9,[],[]),!0):(L(4,[],[]),!1)}function Os(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 vs(e,t,n,r){const o=t.slice(),s=Sr(e,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Wt(s,o),a===void 0&&n!==void 0);)typeof u=="string"?n={[u]:n}:n=[n];if(a)if(a.type==="object"&&typeof u=="string"&&Array.isArray(a.children)){const l=Wt(a,[u]);if(l!==void 0)if(n===void 0){if(!l.parent)throw new Error("Malformed AST");const f=a.children.indexOf(l.parent);let p,d=l.parent.offset+l.parent.length;if(f>0){let b=a.children[f-1];p=b.offset+b.length}else p=a.offset+1,a.children.length>1&&(d=a.children[1].offset);return Ie(e,{offset:p,length:d-p,content:""},r)}else return Ie(e,{offset:l.offset,length:l.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const f=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,p=r.getInsertionIndex?r.getInsertionIndex(a.children.map(b=>b.children[0].value)):a.children.length;let d;if(p>0){let b=a.children[p-1];d={offset:b.offset+b.length,length:0,content:","+f}}else a.children.length===0?d={offset:a.offset+1,length:0,content:f}:d={offset:a.offset+1,length:0,content:f+","};return Ie(e,d,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const l=u;if(l===-1){const f=`${JSON.stringify(n)}`;let p;if(a.children.length===0)p={offset:a.offset+1,length:0,content:f};else{const d=a.children[a.children.length-1];p={offset:d.offset+d.length,length:0,content:","+f}}return Ie(e,p,r)}else if(n===void 0&&a.children.length>=0){const f=u,p=a.children[f];let d;if(a.children.length===1)d={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===f){let b=a.children[f-1],E=b.offset+b.length,v=a.offset+a.length;d={offset:E,length:v-2-E,content:""}}else d={offset:p.offset,length:a.children[f+1].offset-p.offset,content:""};return Ie(e,d,r)}else if(n!==void 0){let f;const p=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const d=a.children[u];f={offset:d.offset,length:d.length,content:p}}else if(a.children.length===0||u===0)f={offset:a.offset+1,length:0,content:a.children.length===0?p:p+","};else{const d=u>a.children.length?a.children.length:u,b=a.children[d-1];f={offset:b.offset+b.length,length:0,content:","+p}}return Ie(e,f,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${l} as length is not sufficient`)}else throw new Error(`Can not add ${typeof u!="number"?"index":"property"} to parent of type ${a.type}`);else{if(n===void 0)throw new Error("Can not delete in empty document");return Ie(e,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function Ie(e,t,n){if(!n.formattingOptions)return[t];let r=Ht(e,t),o=t.offset,i=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;o>0&&!qe(r,o-1);)o--;for(;i<r.length&&!qe(r,i);)i++}const s=Es(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const l=s[u];r=Ht(r,l),o=Math.min(o,l.offset),i=Math.max(i,l.offset+l.length),i+=l.content.length-l.length}const a=e.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function Ht(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var xn;(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"})(xn||(xn={}));var An;(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"})(An||(An={}));const He=Sr,Re=Wt;var Ln;(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"})(Ln||(Ln={}));function xs(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 Gt(e,t,n,r){return vs(e,t,n,r)}function Cr(e,t){let n=t.slice(0).sort((o,i)=>{const s=o.offset-i.offset;return s===0?o.length-i.length:s}),r=e.length;for(let o=n.length-1;o>=0;o--){let i=n[o];if(i.offset+i.length<=r)e=Ht(e,i);else throw new Error("Overlapping edit");r=i.offset}return e}function As(e,t){return t.filter(n=>{const r=oe.resolve(n.hostPath),o=oe.join(e,oe.sep);return r===e||r.startsWith(o)})}const Te={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},Fr={ignoreAttributes:Te.ignoreAttributes,attributeNamePrefix:Te.attributeNamePrefix,preserveOrder:Te.preserveOrder,cdataPropName:Te.cdataPropName,commentPropName:Te.commentPropName,suppressBooleanAttributes:!Te.allowBooleanAttributes,format:!0,indentBy:" "},Ge={allowEmptyContent:!0,allowTrailingComma:!0};function Ls(e,t){const{name:n,host:r,port:o,mappings:i,ideKey:s}=t,a=new Pr(Te),u=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),l={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(l.server[0].path_mappings=i.map(T=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Ir(oe.relative(t.projectDir,T.hostPath))}`,"remote-root":T.vfsPath}})));let f=u?.find(T=>!!T?.project);if(f){const T=f[":@"]?.version;if(T===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(T!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${T}".`)}f===void 0&&(f={project:[],":@":{version:"4"}},u.push(f));let p=f.project?.find(T=>!!T?.component&&T?.[":@"]?.name==="PhpServers");p===void 0&&(p={component:[],":@":{name:"PhpServers"}},f.project===void 0&&(f.project=[]),f.project.push(p));let d=p.component?.find(T=>!!T?.servers);d===void 0&&(d={servers:[]},p.component===void 0&&(p.component=[]),p.component.push(d));const b=d.servers?.findIndex(T=>!!T?.server&&T?.[":@"]?.name===n);(b===void 0||b<0)&&(d.servers===void 0&&(d.servers=[]),d.servers.push(l));let E=f.project?.find(T=>!!T?.component&&T?.[":@"]?.name==="RunManager");if(E===void 0&&(E={component:[],":@":{name:"RunManager"}},f.project===void 0&&(f.project=[]),f.project.push(E)),(E.component?.findIndex(T=>!!T?.configuration&&T?.[":@"]?.name===n)??-1)<0){const T={configuration:[{method:[],":@":{v:"2"}}],":@":{name:n,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:n,session_id:s}};E.component===void 0&&(E.component=[]),E.component.push(T)}const D=new we(Fr).build(u);try{a.parse(D,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return D}function Ps(e,t){const{name:n,mappings:r}=t,o=[];let i=e,s=He(i,o,Ge);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");let a=Re(s,["configurations"]);if(a===void 0||a.children===void 0){const l=Gt(i,["configurations"],[],{});i=Cr(i,l),s=He(i,[],Ge),a=Re(s,["configurations"])}const u=a?.children?.findIndex(l=>Re(l,["name"])?.value===n);if(u===void 0||u<0){const l={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(l.pathMappings=r.reduce((d,b)=>(d[b.vfsPath]=`\${workspaceFolder}/${Ir(oe.relative(t.workspaceDir,b.hostPath))}`,d),{}));const f=a?.children?.length||0,p=Gt(i,["configurations",f],l,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
22
+ `}});i=jr(i,p)}return i}async function _s({name:e,ides:t,host:n,port:r,cwd:o,mounts:i,ideKey:s="PHPWASMCLI"}){const a=i?As(o,i):[],u={};if(t.includes("phpstorm")){const l=".idea/workspace.xml",f=oe.join(o,l);if(!K.existsSync(f)){if(K.existsSync(oe.dirname(f)))K.writeFileSync(f,`<?xml version="1.0" encoding="UTF-8"?>
23
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(K.existsSync(d)){const l=K.readFileSync(d,"utf8"),h=Ls(l,{name:e,host:n,port:r,projectDir:o,mappings:a,ideKey:s});K.writeFileSync(d,h),u.phpstorm=p}}if(t.includes("vscode")){const p=".vscode/launch.json",d=oe.join(o,p);if(!K.existsSync(d)){if(K.existsSync(oe.dirname(d)))K.writeFileSync(d,`{
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(K.existsSync(f)){const p=K.readFileSync(f,"utf8"),d=Ls(p,{name:e,host:n,port:r,projectDir:o,mappings:a,ideKey:s});K.writeFileSync(f,d),u.phpstorm=l}}if(t.includes("vscode")){const l=".vscode/launch.json",f=oe.join(o,l);if(!K.existsSync(f)){if(K.existsSync(oe.dirname(f)))K.writeFileSync(f,`{
25
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(K.existsSync(d)){const l=K.readFileSync(d,"utf-8"),h=Ps(l,{name:e,workspaceDir:o,mappings:a});h!==l&&(K.writeFileSync(d,h),u.vscode=p)}}return u}async function _s(e,t){const n=oe.join(t,".idea/workspace.xml");if(K.existsSync(n)){const o=K.readFileSync(n,"utf8"),i=new Pr(Ee),s=(()=>{try{return i.parse(o,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),p=s.find(l=>!!l?.project)?.project?.find(l=>!!l?.component&&l?.[":@"]?.name==="PhpServers")?.component?.find(l=>!!l?.servers),d=p?.servers?.findIndex(l=>!!l?.server&&l?.[":@"]?.name===e);if(d!==void 0&&d>=0){p.servers.splice(d,1);const h=new we(Fr).build(s);try{i.parse(h,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}h===`<?xml version="1.0" encoding="UTF-8"?>
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(K.existsSync(f)){const p=K.readFileSync(f,"utf-8"),d=Ps(p,{name:e,workspaceDir:o,mappings:a});d!==p&&(K.writeFileSync(f,d),u.vscode=l)}}return u}async function Ds(e,t){const n=oe.join(t,".idea/workspace.xml");if(K.existsSync(n)){const o=K.readFileSync(n,"utf8"),i=new Pr(Te),s=(()=>{try{return i.parse(o,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),l=s.find(p=>!!p?.project)?.project?.find(p=>!!p?.component&&p?.[":@"]?.name==="PhpServers")?.component?.find(p=>!!p?.servers),f=l?.servers?.findIndex(p=>!!p?.server&&p?.[":@"]?.name===e);if(f!==void 0&&f>=0){l.servers.splice(f,1);const d=new we(Fr).build(s);try{i.parse(d,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}d===`<?xml version="1.0" encoding="UTF-8"?>
27
27
  <project version="4">
28
28
  <component name="PhpServers">
29
29
  <servers></servers>
30
30
  </component>
31
- </project>`?K.unlinkSync(n):K.writeFileSync(n,h)}}const r=oe.join(t,".vscode/launch.json");if(K.existsSync(r)){const o=[],i=K.readFileSync(r,"utf-8"),s=He(i,o,Ge);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");const u=Re(s,["configurations"])?.children?.findIndex(p=>Re(p,["name"])?.value===e);if(u!==void 0&&u>=0){const p=Gt(i,["configurations",u],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
32
- `}}),d=Cr(i,p);d===`{
31
+ </project>`?K.unlinkSync(n):K.writeFileSync(n,d)}}const r=oe.join(t,".vscode/launch.json");if(K.existsSync(r)){const o=[],i=K.readFileSync(r,"utf-8"),s=He(i,o,Ge);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");const u=Re(s,["configurations"])?.children?.findIndex(l=>Re(l,["name"])?.value===e);if(u!==void 0&&u>=0){const l=Gt(i,["configurations",u],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
32
+ `}}),f=jr(i,l);f===`{
33
33
  "configurations": []
34
- }`?K.unlinkSync(r):K.writeFileSync(r,d)}}}function Cr(e,t){const n=[],r=Sr(e,t);if(n.length=0,He(r,n,Ge),n.length){const o=n.map(s=>({message:Os(s.error),offset:s.offset,length:s.length,fragment:r.slice(Math.max(0,s.offset-20),Math.min(r.length,s.offset+s.length+10))})).map(s=>`${s.message} at ${s.offset}:${s.length} (${s.fragment})`),i=t.map(s=>`At ${s.offset}:${s.length} - (${s.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.
34
+ }`?K.unlinkSync(r):K.writeFileSync(r,f)}}}function jr(e,t){const n=[],r=Cr(e,t);if(n.length=0,He(r,n,Ge),n.length){const o=n.map(s=>({message:xs(s.error),offset:s.offset,length:s.length,fragment:r.slice(Math.max(0,s.offset-20),Math.min(r.length,s.offset+s.length+10))})).map(s=>`${s.message} at ${s.offset}:${s.length} (${s.fragment})`),i=t.map(s=>`At ${s.offset}:${s.length} - (${s.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
35
 
36
36
  Applied edits: ${i.join(`
37
37
  `)}
38
38
 
39
39
  The errors are: ${o.join(`
40
- `)}`)}return r}const jr=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(jr==="NODE"){let e=function(n){return new Promise(function(r,o){n.onload=n.onerror=function(i){n.onload=n.onerror=null,i.type==="load"?r(n.result):o(new Error("Failed to read the blob/file"))}})},t=function(){const n=new Uint8Array([1,2,3,4]),o=new File([n],"test").stream();try{return o.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class n extends Blob{constructor(o,i,s){super(o);let a;s?.lastModified&&(a=new Date),(!a||isNaN(a.getFullYear()))&&(a=new Date),this.lastModifiedDate=a,this.lastModified=a.getMilliseconds(),this.name=i||""}}global.File=n}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const r=new FileReader;return r.readAsArrayBuffer(this),e(r)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const r=new FileReader;return r.readAsText(this),e(r)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let n=0;const r=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(o){const i=o.byobRequest.view,a=await r.slice(n,n+i.byteLength).arrayBuffer(),u=new Uint8Array(a);new Uint8Array(i.buffer).set(u);const p=u.byteLength;o.byobRequest.respond(p),n+=p,n>=r.size&&o.close()}})})}if(jr==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(n,r={}){super(n,r),this.detail=r.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Ds="playground-log",Ms=(e,...t)=>{de.dispatchEvent(new CustomEvent(Ds,{detail:{log:e,args:t}}))},Ss=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",Yt(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",Yt(e.message.message)),e.severity){case le.Debug:console.debug(e.message,...t);break;case le.Info:console.info(e.message,...t);break;case le.Warn:console.warn(e.message,...t);break;case le.Error:console.error(e.message,...t);break;case le.Fatal:console.error(e.message,...t);break;default:console.log(e.message,...t)}},Fs=e=>e instanceof Error?[e.message,e.stack].join(`
41
- `):JSON.stringify(e,null,2),kr=[],xn=e=>{kr.push(e)},Br=e=>{if(e.raw===!0)xn(e.message);else{const t=ks(typeof e.message=="object"?Fs(e.message):e.message,e.severity,e.prefix??Se.JS);xn(t)}},le={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}},Se={JS:"JavaScript"};class Cs extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=le.Info,this.handlers=t}getLogs(){return this.handlers.includes(Br)?[...kr]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
40
+ `)}`)}return r}const kr=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(kr==="NODE"){let e=function(n){return new Promise(function(r,o){n.onload=n.onerror=function(i){n.onload=n.onerror=null,i.type==="load"?r(n.result):o(new Error("Failed to read the blob/file"))}})},t=function(){const n=new Uint8Array([1,2,3,4]),o=new File([n],"test").stream();try{return o.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class n extends Blob{constructor(o,i,s){super(o);let a;s?.lastModified&&(a=new Date),(!a||isNaN(a.getFullYear()))&&(a=new Date),this.lastModifiedDate=a,this.lastModified=a.getMilliseconds(),this.name=i||""}}global.File=n}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const r=new FileReader;return r.readAsArrayBuffer(this),e(r)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const r=new FileReader;return r.readAsText(this),e(r)}),(typeof Blob.prototype.stream>"u"||!t())&&(Blob.prototype.stream=function(){let n=0;const r=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(o){const i=o.byobRequest.view,a=await r.slice(n,n+i.byteLength).arrayBuffer(),u=new Uint8Array(a);new Uint8Array(i.buffer).set(u);const l=u.byteLength;o.byobRequest.respond(l),n+=l,n>=r.size&&o.close()}})})}if(kr==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(n,r={}){super(n,r),this.detail=r.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const Ms="playground-log",Ss=(e,...t)=>{de.dispatchEvent(new CustomEvent(Ms,{detail:{log:e,args:t}}))},Cs=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",Yt(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",Yt(e.message.message)),e.severity){case le.Debug:console.debug(e.message,...t);break;case le.Info:console.info(e.message,...t);break;case le.Warn:console.warn(e.message,...t);break;case le.Error:console.error(e.message,...t);break;case le.Fatal:console.error(e.message,...t);break;default:console.log(e.message,...t)}},Fs=e=>e instanceof Error?[e.message,e.stack].join(`
41
+ `):JSON.stringify(e,null,2),Br=[],Pn=e=>{Br.push(e)},Rr=e=>{if(e.raw===!0)Pn(e.message);else{const t=Bs(typeof e.message=="object"?Fs(e.message):e.message,e.severity,e.prefix??Se.JS);Pn(t)}},le={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}},Se={JS:"JavaScript"};class js extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=le.Info,this.handlers=t}getLogs(){return this.handlers.includes(Rr)?[...Br]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
42
42
  If you're using a custom logger instance, make sure to register logToMemory handler.
43
- `),[])}logMessage(t,...n){const r={...t,severity:t.severity??le.Log};for(const o of this.handlers)r.severity.level<=this.severity.level&&o(r,...n)}setSeverityFilterLevel(t){this.severity=t}log(t,...n){this.logMessage({message:t,severity:le.Log,prefix:Se.JS,raw:!1},...n)}debug(t,...n){this.logMessage({message:t,severity:le.Debug,prefix:Se.JS,raw:!1},...n)}info(t,...n){this.logMessage({message:t,severity:le.Info,prefix:Se.JS,raw:!1},...n)}warn(t,...n){this.logMessage({message:t,severity:le.Warn,prefix:Se.JS,raw:!1},...n)}error(t,...n){this.logMessage({message:t,severity:le.Error,prefix:Se.JS,raw:!1},...n)}}const js=()=>{try{}catch{}return[Br,Ss,Ms]},de=new Cs(js()),Yt=e=>e.replace(/\t/g,""),ks=(e,t,n)=>{const r=new Date,o=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(r).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(r),s=o+" "+i;return e=Yt(e),`[${s}] ${n} ${t.name}: ${e}`};var H=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Zt={exports:{}},Fe=typeof Reflect=="object"?Reflect:null,_n=Fe&&typeof Fe.apply=="function"?Fe.apply:function(t,n,r){return Function.prototype.apply.call(t,n,r)},Ve;Fe&&typeof Fe.ownKeys=="function"?Ve=Fe.ownKeys:Object.getOwnPropertySymbols?Ve=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ve=function(t){return Object.getOwnPropertyNames(t)};function Bs(e){console&&console.warn&&console.warn(e)}var Rr=Number.isNaN||function(t){return t!==t};function Q(){Q.init.call(this)}Zt.exports=Q;Zt.exports.once=Vs;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount=0;Q.prototype._maxListeners=void 0;var Dn=10;function ze(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Q,"defaultMaxListeners",{enumerable:!0,get:function(){return Dn},set:function(e){if(typeof e!="number"||e<0||Rr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Dn=e}});Q.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};Q.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Rr(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 Xr(e){return e._maxListeners===void 0?Q.defaultMaxListeners:e._maxListeners}Q.prototype.getMaxListeners=function(){return Xr(this)};Q.prototype.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var o=t==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(u===void 0)return!1;if(typeof u=="function")_n(u,this,n);else for(var p=u.length,d=Wr(u,p),r=0;r<p;++r)_n(d[r],this,n);return!0};function Ur(e,t,n,r){var o,i,s;if(ze(n),i=e._events,i===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),s===void 0)s=i[t]=n,++e._eventsCount;else if(typeof s=="function"?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),o=Xr(e),o>0&&s.length>o&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,Bs(a)}return e}Q.prototype.addListener=function(t,n){return Ur(this,t,n,!1)};Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=function(t,n){return Ur(this,t,n,!0)};function Rs(){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 Vr(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=Rs.bind(r);return o.listener=n,r.wrapFn=o,o}Q.prototype.once=function(t,n){return ze(n),this.on(t,Vr(this,t,n)),this};Q.prototype.prependOnceListener=function(t,n){return ze(n),this.prependListener(t,Vr(this,t,n)),this};Q.prototype.removeListener=function(t,n){var r,o,i,s,a;if(ze(n),o=this._events,o===void 0)return this;if(r=o[t],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,i=s;break}if(i<0)return this;i===0?r.shift():Xs(r,i),r.length===1&&(o[t]=r[0]),o.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this};Q.prototype.off=Q.prototype.removeListener;Q.prototype.removeAllListeners=function(t){var n,r,o;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var i=Object.keys(r),s;for(o=0;o<i.length;++o)s=i[o],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(o=n.length-1;o>=0;o--)this.removeListener(t,n[o]);return this};function $r(e,t,n){var r=e._events;if(r===void 0)return[];var o=r[t];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?Us(o):Wr(o,o.length)}Q.prototype.listeners=function(t){return $r(this,t,!0)};Q.prototype.rawListeners=function(t){return $r(this,t,!1)};Q.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):qr.call(e,t)};Q.prototype.listenerCount=qr;function qr(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}Q.prototype.eventNames=function(){return this._eventsCount>0?Ve(this._events):[]};function Wr(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function Xs(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function Us(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function Vs(e,t){return new Promise(function(n,r){function o(s){e.removeListener(t,i),r(s)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",o),n([].slice.call(arguments))}Hr(e,t,i,{once:!0}),t!=="error"&&$s(e,o,{once:!0})})}function $s(e,t,n){typeof e.on=="function"&&Hr(e,"error",t,n)}function Hr(e,t,n,r){if(typeof e.on=="function")r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function o(i){r.once&&e.removeEventListener(t,o),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Kt=Zt.exports;class qs extends Kt.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new yi({port:t}),this.wss.on("connection",n=>{if(this.ws){n.close();return}this.ws=n,this.emit("clientConnected"),n.on("message",r=>{de.debug("\x1B[1;32m[CDP][received]\x1B[0m",r.toString());let o;try{o=JSON.parse(r.toString())}catch{return}this.connected?this.emit("message",o):this.buffer.push(o)}),n.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.on("newListener",n=>{n==="message"&&process.nextTick(()=>{for(const r of this.buffer)this.emit("message",r);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const n=JSON.stringify(t);de.debug("\x1B[1;32m[CDP][send]\x1B[0m",n),this.ws.send(n)}close(){this.wss.close()}}class Ws extends Kt.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=bi.createServer(),this.server.on("connection",n=>{if(this.socket){n.destroy();return}this.socket=n,n.setEncoding("utf8"),this.emit("connected"),n.on("data",r=>this.onData(r.toString())),n.on("close",()=>{this.socket=null,this.emit("disconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.server.listen(t)}onData(t){for(de.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const n=this.buffer.indexOf("\0");if(n===-1)break;const r=this.buffer.substring(0,n),o=parseInt(r,10);if(isNaN(o)){this.buffer="";break}this.expectedLength=o,this.buffer=this.buffer.slice(n+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const n=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const r=n.trim();this.expectedLength=null,this.emit("message",r);continue}break}}sendCommand(t){this.socket&&(de.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}/**
43
+ `),[])}logMessage(t,...n){const r={...t,severity:t.severity??le.Log};for(const o of this.handlers)r.severity.level<=this.severity.level&&o(r,...n)}setSeverityFilterLevel(t){this.severity=t}log(t,...n){this.logMessage({message:t,severity:le.Log,prefix:Se.JS,raw:!1},...n)}debug(t,...n){this.logMessage({message:t,severity:le.Debug,prefix:Se.JS,raw:!1},...n)}info(t,...n){this.logMessage({message:t,severity:le.Info,prefix:Se.JS,raw:!1},...n)}warn(t,...n){this.logMessage({message:t,severity:le.Warn,prefix:Se.JS,raw:!1},...n)}error(t,...n){this.logMessage({message:t,severity:le.Error,prefix:Se.JS,raw:!1},...n)}}const ks=()=>{try{}catch{}return[Rr,Cs,Ss]},de=new js(ks()),Yt=e=>e.replace(/\t/g,""),Bs=(e,t,n)=>{const r=new Date,o=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(r).replace(/ /g,"-"),i=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(r),s=o+" "+i;return e=Yt(e),`[${s}] ${n} ${t.name}: ${e}`};var H=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Zt={exports:{}},Ce=typeof Reflect=="object"?Reflect:null,_n=Ce&&typeof Ce.apply=="function"?Ce.apply:function(t,n,r){return Function.prototype.apply.call(t,n,r)},Ve;Ce&&typeof Ce.ownKeys=="function"?Ve=Ce.ownKeys:Object.getOwnPropertySymbols?Ve=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Ve=function(t){return Object.getOwnPropertyNames(t)};function Rs(e){console&&console.warn&&console.warn(e)}var Xr=Number.isNaN||function(t){return t!==t};function Q(){Q.init.call(this)}Zt.exports=Q;Zt.exports.once=$s;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount=0;Q.prototype._maxListeners=void 0;var Dn=10;function ze(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Q,"defaultMaxListeners",{enumerable:!0,get:function(){return Dn},set:function(e){if(typeof e!="number"||e<0||Xr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Dn=e}});Q.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};Q.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Xr(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 Ur(e){return e._maxListeners===void 0?Q.defaultMaxListeners:e._maxListeners}Q.prototype.getMaxListeners=function(){return Ur(this)};Q.prototype.emit=function(t){for(var n=[],r=1;r<arguments.length;r++)n.push(arguments[r]);var o=t==="error",i=this._events;if(i!==void 0)o=o&&i.error===void 0;else if(!o)return!1;if(o){var s;if(n.length>0&&(s=n[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=i[t];if(u===void 0)return!1;if(typeof u=="function")_n(u,this,n);else for(var l=u.length,f=Hr(u,l),r=0;r<l;++r)_n(f[r],this,n);return!0};function Vr(e,t,n,r){var o,i,s;if(ze(n),i=e._events,i===void 0?(i=e._events=Object.create(null),e._eventsCount=0):(i.newListener!==void 0&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),s===void 0)s=i[t]=n,++e._eventsCount;else if(typeof s=="function"?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),o=Ur(e),o>0&&s.length>o&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,Rs(a)}return e}Q.prototype.addListener=function(t,n){return Vr(this,t,n,!1)};Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=function(t,n){return Vr(this,t,n,!0)};function Xs(){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 $r(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=Xs.bind(r);return o.listener=n,r.wrapFn=o,o}Q.prototype.once=function(t,n){return ze(n),this.on(t,$r(this,t,n)),this};Q.prototype.prependOnceListener=function(t,n){return ze(n),this.prependListener(t,$r(this,t,n)),this};Q.prototype.removeListener=function(t,n){var r,o,i,s,a;if(ze(n),o=this._events,o===void 0)return this;if(r=o[t],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,r.listener||n));else if(typeof r!="function"){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){a=r[s].listener,i=s;break}if(i<0)return this;i===0?r.shift():Us(r,i),r.length===1&&(o[t]=r[0]),o.removeListener!==void 0&&this.emit("removeListener",t,a||n)}return this};Q.prototype.off=Q.prototype.removeListener;Q.prototype.removeAllListeners=function(t){var n,r,o;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[t]),this;if(arguments.length===0){var i=Object.keys(r),s;for(o=0;o<i.length;++o)s=i[o],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=r[t],typeof n=="function")this.removeListener(t,n);else if(n!==void 0)for(o=n.length-1;o>=0;o--)this.removeListener(t,n[o]);return this};function qr(e,t,n){var r=e._events;if(r===void 0)return[];var o=r[t];return o===void 0?[]:typeof o=="function"?n?[o.listener||o]:[o]:n?Vs(o):Hr(o,o.length)}Q.prototype.listeners=function(t){return qr(this,t,!0)};Q.prototype.rawListeners=function(t){return qr(this,t,!1)};Q.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Wr.call(e,t)};Q.prototype.listenerCount=Wr;function Wr(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}Q.prototype.eventNames=function(){return this._eventsCount>0?Ve(this._events):[]};function Hr(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function Us(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function Vs(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function $s(e,t){return new Promise(function(n,r){function o(s){e.removeListener(t,i),r(s)}function i(){typeof e.removeListener=="function"&&e.removeListener("error",o),n([].slice.call(arguments))}Gr(e,t,i,{once:!0}),t!=="error"&&qs(e,o,{once:!0})})}function qs(e,t,n){typeof e.on=="function"&&Gr(e,"error",t,n)}function Gr(e,t,n,r){if(typeof e.on=="function")r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener=="function")e.addEventListener(t,function o(i){r.once&&e.removeEventListener(t,o),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}var Kt=Zt.exports;class Ws extends Kt.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new bi({port:t}),this.wss.on("connection",n=>{if(this.ws){n.close();return}this.ws=n,this.emit("clientConnected"),n.on("message",r=>{de.debug("\x1B[1;32m[CDP][received]\x1B[0m",r.toString());let o;try{o=JSON.parse(r.toString())}catch{return}this.connected?this.emit("message",o):this.buffer.push(o)}),n.on("close",()=>{this.ws=null,this.emit("clientDisconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.on("newListener",n=>{n==="message"&&process.nextTick(()=>{for(const r of this.buffer)this.emit("message",r);this.buffer=[],this.connected=!0})})}sendMessage(t){if(!this.ws||this.ws.readyState!==this.ws.OPEN)return;const n=JSON.stringify(t);de.debug("\x1B[1;32m[CDP][send]\x1B[0m",n),this.ws.send(n)}close(){this.wss.close()}}class Hs extends Kt.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=wi.createServer(),this.server.on("connection",n=>{if(this.socket){n.destroy();return}this.socket=n,n.setEncoding("utf8"),this.emit("connected"),n.on("data",r=>this.onData(r.toString())),n.on("close",()=>{this.socket=null,this.emit("disconnected")}),n.on("error",r=>{this.emit("error",r)})}),this.server.listen(t)}onData(t){for(de.debug("\x1B[1;32m[XDebug][received]]\x1B[0m",t),this.buffer+=t;;){if(this.expectedLength===null){const n=this.buffer.indexOf("\0");if(n===-1)break;const r=this.buffer.substring(0,n),o=parseInt(r,10);if(isNaN(o)){this.buffer="";break}this.expectedLength=o,this.buffer=this.buffer.slice(n+1)}if(this.expectedLength!==null&&this.buffer.length>=this.expectedLength){const n=this.buffer.substring(0,this.expectedLength);this.buffer=this.buffer.slice(this.expectedLength),this.buffer.startsWith("\0")&&(this.buffer=this.buffer.slice(1));const r=n.trim();this.expectedLength=null,this.emit("message",r);continue}break}}sendCommand(t){this.socket&&(de.debug("\x1B[1;32m[XDebug][send]\x1B[0m",t),this.socket.write(t+"\0"))}close(){this.server.close()}}/**
44
44
  * @license
45
45
  * Copyright (c) 2016, Contributors
46
46
  * SPDX-License-Identifier: ISC
47
- */function Ue(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let n="",r=!1;const o=e.match(/^-+/);for(let i=o?o[0].length:0;i<e.length;i++){let s=e.charAt(i);r&&(r=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?r=!0:s!=="-"&&s!=="_"&&(n+=s)}return n}}function Hs(e,t){const n=e.toLowerCase();t=t||"-";let r="";for(let o=0;o<e.length;o++){const i=n.charAt(o),s=e.charAt(o);i!==s&&o>0?r+=`${t}${n.charAt(o)}`:r+=s}return r}function Gs(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)}/**
47
+ */function Ue(e){if(e!==e.toLowerCase()&&e!==e.toUpperCase()||(e=e.toLowerCase()),e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;{let n="",r=!1;const o=e.match(/^-+/);for(let i=o?o[0].length:0;i<e.length;i++){let s=e.charAt(i);r&&(r=!1,s=s.toUpperCase()),i!==0&&(s==="-"||s==="_")?r=!0:s!=="-"&&s!=="_"&&(n+=s)}return n}}function Gs(e,t){const n=e.toLowerCase();t=t||"-";let r="";for(let o=0;o<e.length;o++){const i=n.charAt(o),s=e.charAt(o);i!==s&&o>0?r+=`${t}${n.charAt(o)}`:r+=s}return r}function Ys(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)}/**
48
48
  * @license
49
49
  * Copyright (c) 2016, Contributors
50
50
  * SPDX-License-Identifier: ISC
51
- */function Ys(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let t=0,n=null,r=null,o=null;const i=[];for(let s=0;s<e.length;s++){if(n=r,r=e.charAt(s),r===" "&&!o){n!==" "&&t++;continue}r===o?o=null:(r==="'"||r==='"')&&!o&&(o=r),i[t]||(i[t]=""),i[t]+=r}return i}/**
51
+ */function zs(e){if(Array.isArray(e))return e.map(s=>typeof s!="string"?s+"":s);e=e.trim();let t=0,n=null,r=null,o=null;const i=[];for(let s=0;s<e.length;s++){if(n=r,r=e.charAt(s),r===" "&&!o){n!==" "&&t++;continue}r===o?o=null:(r==="'"||r==='"')&&!o&&(o=r),i[t]||(i[t]=""),i[t]+=r}return i}/**
52
52
  * @license
53
53
  * Copyright (c) 2016, Contributors
54
54
  * SPDX-License-Identifier: ISC
@@ -56,25 +56,25 @@ import{LatestSupportedPHPVersion as ni,SupportedPHPVersionsList as ri,PHP as ii}
56
56
  * @license
57
57
  * Copyright (c) 2016, Contributors
58
58
  * SPDX-License-Identifier: ISC
59
- */let me;class zs{constructor(t){me=t}parse(t,n){const r=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},n),o=Ys(t),i=typeof t=="string",s=Qs(Object.assign(Object.create(null),r.alias)),a=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},r.configuration),u=Object.assign(Object.create(null),r.default),p=r.configObjects||[],d=r.envPrefix,l=a["populate--"],h=l?"--":"_",b=Object.create(null),T=Object.create(null),O=r.__||me.format,y={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]+)$/,E=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(N){const L=typeof N=="object"?N.key:N,j=Object.keys(N).map(function(M){return{boolean:"bools",string:"strings",number:"numbers"}[M]}).filter(Boolean).pop();j&&(y[j][L]=!0),y.arrays[L]=!0,y.keys.push(L)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(N){y.bools[N]=!0,y.keys.push(N)}),[].concat(r.string||[]).filter(Boolean).forEach(function(N){y.strings[N]=!0,y.keys.push(N)}),[].concat(r.number||[]).filter(Boolean).forEach(function(N){y.numbers[N]=!0,y.keys.push(N)}),[].concat(r.count||[]).filter(Boolean).forEach(function(N){y.counts[N]=!0,y.keys.push(N)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(N){y.normalize[N]=!0,y.keys.push(N)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([N,L])=>{typeof L=="number"&&(y.nargs[N]=L,y.keys.push(N))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([N,L])=>{typeof L=="function"&&(y.coercions[N]=L,y.keys.push(N))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(N){y.configs[N]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([N,L])=>{(typeof L=="boolean"||typeof L=="function")&&(y.configs[N]=L)})),Ke(r.key,s,r.default,y.arrays),Object.keys(u).forEach(function(N){(y.aliases[N]||[]).forEach(function(L){u[L]=u[N]})});let f=null;ne();let w=[];const I=Object.assign(Object.create(null),{_:[]}),x={};for(let N=0;N<o.length;N++){const L=o[N],j=L.replace(/^-{3,}/,"---");let M,A,X,B,U,te;if(L!=="--"&&/^-/.test(L)&&g(L))P(L);else if(j.match(/^---+(=|$)/)){P(L);continue}else if(L.match(/^--.+=/)||!a["short-option-groups"]&&L.match(/^-.+=/))B=L.match(/^--?([^=]+)=([\s\S]*)$/),B!==null&&Array.isArray(B)&&B.length>=3&&($(B[1],y.arrays)?N=c(N,B[1],o,B[2]):$(B[1],y.nargs)!==!1?N=S(N,B[1],o,B[2]):_(B[1],B[2],!0));else if(L.match(E)&&a["boolean-negation"])B=L.match(E),B!==null&&Array.isArray(B)&&B.length>=2&&(A=B[1],_(A,$(A,y.arrays)?[!1]:!1));else if(L.match(/^--.+/)||!a["short-option-groups"]&&L.match(/^-[^-]+/))B=L.match(/^--?(.+)/),B!==null&&Array.isArray(B)&&B.length>=2&&(A=B[1],$(A,y.arrays)?N=c(N,A,o):$(A,y.nargs)!==!1?N=S(N,A,o):(U=o[N+1],U!==void 0&&(!U.match(/^-/)||U.match(D))&&!$(A,y.bools)&&!$(A,y.counts)||/^(true|false)$/.test(U)?(_(A,U),N++):_(A,v(A))));else if(L.match(/^-.\..+=/))B=L.match(/^-([^=]+)=([\s\S]*)$/),B!==null&&Array.isArray(B)&&B.length>=3&&_(B[1],B[2]);else if(L.match(/^-.\..+/)&&!L.match(D))U=o[N+1],B=L.match(/^-(.\..+)/),B!==null&&Array.isArray(B)&&B.length>=2&&(A=B[1],U!==void 0&&!U.match(/^-/)&&!$(A,y.bools)&&!$(A,y.counts)?(_(A,U),N++):_(A,v(A)));else if(L.match(/^-[^-]+/)&&!L.match(D)){X=L.slice(1,-1).split(""),M=!1;for(let re=0;re<X.length;re++){if(U=L.slice(re+2),X[re+1]&&X[re+1]==="="){te=L.slice(re+3),A=X[re],$(A,y.arrays)?N=c(N,A,o,te):$(A,y.nargs)!==!1?N=S(N,A,o,te):_(A,te),M=!0;break}if(U==="-"){_(X[re],U);continue}if(/[A-Za-z]/.test(X[re])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(U)&&$(U,y.bools)===!1){_(X[re],U),M=!0;break}if(X[re+1]&&X[re+1].match(/\W/)){_(X[re],U),M=!0;break}else _(X[re],v(X[re]))}A=L.slice(-1)[0],!M&&A!=="-"&&($(A,y.arrays)?N=c(N,A,o):$(A,y.nargs)!==!1?N=S(N,A,o):(U=o[N+1],U!==void 0&&(!/^(-|--)[^-]/.test(U)||U.match(D))&&!$(A,y.bools)&&!$(A,y.counts)||/^(true|false)$/.test(U)?(_(A,U),N++):_(A,v(A))))}else if(L.match(/^-[0-9]$/)&&L.match(D)&&$(L.slice(1),y.bools))A=L.slice(1),_(A,v(A));else if(L==="--"){w=o.slice(N+1);break}else if(a["halt-at-non-option"]){w=o.slice(N);break}else P(L)}W(I,!0),W(I,!1),R(I),G(),Le(I,y.aliases,u,!0),Ze(I),a["set-placeholder-key"]&&Ce(I),Object.keys(y.counts).forEach(function(N){ue(I,N.split("."))||_(N,0)}),l&&w.length&&(I[h]=[]),w.forEach(function(N){I[h].push(N)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(I).filter(N=>N!=="--"&&N.includes("-")).forEach(N=>{delete I[N]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(N=>s[N])).forEach(N=>{a["camel-case-expansion"]&&N.includes("-")&&delete I[N.split(".").map(L=>Ue(L)).join(".")],delete I[N]});function P(N){const L=q("_",N);(typeof L=="string"||typeof L=="number")&&I._.push(L)}function S(N,L,j,M){let A,X=$(L,y.nargs);if(X=typeof X!="number"||isNaN(X)?1:X,X===0)return z(M)||(f=Error(O("Argument unexpected for: %s",L))),_(L,v(L)),N;let B=z(M)?0:1;if(a["nargs-eats-options"])j.length-(N+1)+B<X&&(f=Error(O("Not enough arguments following: %s",L))),B=X;else{for(A=N+1;A<j.length&&(!j[A].match(/^-[^0-9]/)||j[A].match(D)||g(j[A]));A++)B++;B<X&&(f=Error(O("Not enough arguments following: %s",L)))}let U=Math.min(B,X);for(!z(M)&&U>0&&(_(L,M),U--),A=N+1;A<U+N+1;A++)_(L,j[A]);return N+U}function c(N,L,j,M){let A=[],X=M||j[N+1];const B=$(L,y.nargs);if($(L,y.bools)&&!/^(true|false)$/.test(X))A.push(!0);else if(z(X)||z(M)&&/^-/.test(X)&&!D.test(X)&&!g(X)){if(u[L]!==void 0){const U=u[L];A=Array.isArray(U)?U:[U]}}else{z(M)||A.push(k(L,M,!0));for(let U=N+1;U<j.length&&!(!a["greedy-arrays"]&&A.length>0||B&&typeof B=="number"&&A.length>=B||(X=j[U],/^-/.test(X)&&!D.test(X)&&!g(X)));U++)N=U,A.push(k(L,X,i))}return typeof B=="number"&&(B&&A.length<B||isNaN(B)&&A.length===0)&&(f=Error(O("Not enough arguments following: %s",L))),_(L,A),N}function _(N,L,j=i){if(/-/.test(N)&&a["camel-case-expansion"]){const X=N.split(".").map(function(B){return Ue(B)}).join(".");C(N,X)}const M=k(N,L,j),A=N.split(".");ge(I,A,M),y.aliases[N]&&y.aliases[N].forEach(function(X){const B=X.split(".");ge(I,B,M)}),A.length>1&&a["dot-notation"]&&(y.aliases[A[0]]||[]).forEach(function(X){let B=X.split(".");const U=[].concat(A);U.shift(),B=B.concat(U),(y.aliases[N]||[]).includes(B.join("."))||ge(I,B,M)}),$(N,y.normalize)&&!$(N,y.arrays)&&[N].concat(y.aliases[N]||[]).forEach(function(B){Object.defineProperty(x,B,{enumerable:!0,get(){return L},set(U){L=typeof U=="string"?me.normalize(U):U}})})}function C(N,L){y.aliases[N]&&y.aliases[N].length||(y.aliases[N]=[L],b[L]=!0),y.aliases[L]&&y.aliases[L].length||C(L,N)}function k(N,L,j){j&&(L=Js(L)),($(N,y.bools)||$(N,y.counts))&&typeof L=="string"&&(L=L==="true");let M=Array.isArray(L)?L.map(function(A){return q(N,A)}):q(N,L);return $(N,y.counts)&&(z(M)||typeof M=="boolean")&&(M=rt()),$(N,y.normalize)&&$(N,y.arrays)&&(Array.isArray(L)?M=L.map(A=>me.normalize(A)):M=me.normalize(L)),M}function q(N,L){return!a["parse-positional-numbers"]&&N==="_"||!$(N,y.strings)&&!$(N,y.bools)&&!Array.isArray(L)&&(Gs(L)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${L}`)))||!z(L)&&$(N,y.numbers))&&(L=Number(L)),L}function R(N){const L=Object.create(null);Le(L,y.aliases,u),Object.keys(y.configs).forEach(function(j){const M=N[j]||L[j];if(M)try{let A=null;const X=me.resolve(me.cwd(),M),B=y.configs[j];if(typeof B=="function"){try{A=B(X)}catch(U){A=U}if(A instanceof Error){f=A;return}}else A=me.require(X);V(A)}catch(A){A.name==="PermissionDenied"?f=A:N[j]&&(f=Error(O("Invalid JSON config file: %s",M)))}})}function V(N,L){Object.keys(N).forEach(function(j){const M=N[j],A=L?L+"."+j:j;typeof M=="object"&&M!==null&&!Array.isArray(M)&&a["dot-notation"]?V(M,A):(!ue(I,A.split("."))||$(A,y.arrays)&&a["combine-arrays"])&&_(A,M)})}function G(){typeof p<"u"&&p.forEach(function(N){V(N)})}function W(N,L){if(typeof d>"u")return;const j=typeof d=="string"?d:"",M=me.env();Object.keys(M).forEach(function(A){if(j===""||A.lastIndexOf(j,0)===0){const X=A.split("__").map(function(B,U){return U===0&&(B=B.substring(j.length)),Ue(B)});(L&&y.configs[X.join(".")]||!L)&&!ue(N,X)&&_(X.join("."),M[A])}})}function Ze(N){let L;const j=new Set;Object.keys(N).forEach(function(M){if(!j.has(M)&&(L=$(M,y.coercions),typeof L=="function"))try{const A=q(M,L(N[M]));[].concat(y.aliases[M]||[],M).forEach(X=>{j.add(X),N[X]=A})}catch(A){f=A}})}function Ce(N){return y.keys.forEach(L=>{~L.indexOf(".")||typeof N[L]>"u"&&(N[L]=void 0)}),N}function Le(N,L,j,M=!1){Object.keys(j).forEach(function(A){ue(N,A.split("."))||(ge(N,A.split("."),j[A]),M&&(T[A]=!0),(L[A]||[]).forEach(function(X){ue(N,X.split("."))||ge(N,X.split("."),j[A])}))})}function ue(N,L){let j=N;a["dot-notation"]||(L=[L.join(".")]),L.slice(0,-1).forEach(function(A){j=j[A]||{}});const M=L[L.length-1];return typeof j!="object"?!1:M in j}function ge(N,L,j){let M=N;a["dot-notation"]||(L=[L.join(".")]),L.slice(0,-1).forEach(function(te){te=Mn(te),typeof M=="object"&&M[te]===void 0&&(M[te]={}),typeof M[te]!="object"||Array.isArray(M[te])?(Array.isArray(M[te])?M[te].push({}):M[te]=[M[te],{}],M=M[te][M[te].length-1]):M=M[te]});const A=Mn(L[L.length-1]),X=$(L.join("."),y.arrays),B=Array.isArray(j);let U=a["duplicate-arguments-array"];!U&&$(A,y.nargs)&&(U=!0,(!z(M[A])&&y.nargs[A]===1||Array.isArray(M[A])&&M[A].length===y.nargs[A])&&(M[A]=void 0)),j===rt()?M[A]=rt(M[A]):Array.isArray(M[A])?U&&X&&B?M[A]=a["flatten-duplicate-arrays"]?M[A].concat(j):(Array.isArray(M[A][0])?M[A]:[M[A]]).concat([j]):!U&&!!X==!!B?M[A]=j:M[A]=M[A].concat([j]):M[A]===void 0&&X?M[A]=B?j:[j]:U&&!(M[A]===void 0||$(A,y.counts)||$(A,y.bools))?M[A]=[M[A],j]:M[A]=j}function Ke(...N){N.forEach(function(L){Object.keys(L||{}).forEach(function(j){y.aliases[j]||(y.aliases[j]=[].concat(s[j]||[]),y.aliases[j].concat(j).forEach(function(M){if(/-/.test(M)&&a["camel-case-expansion"]){const A=Ue(M);A!==j&&y.aliases[j].indexOf(A)===-1&&(y.aliases[j].push(A),b[A]=!0)}}),y.aliases[j].concat(j).forEach(function(M){if(M.length>1&&/[A-Z]/.test(M)&&a["camel-case-expansion"]){const A=Hs(M,"-");A!==j&&y.aliases[j].indexOf(A)===-1&&(y.aliases[j].push(A),b[A]=!0)}}),y.aliases[j].forEach(function(M){y.aliases[M]=[j].concat(y.aliases[j].filter(function(A){return M!==A}))}))})})}function $(N,L){const j=[].concat(y.aliases[N]||[],N),M=Object.keys(L),A=j.find(X=>M.includes(X));return A?L[A]:!1}function Pe(N){const L=Object.keys(y);return[].concat(L.map(M=>y[M])).some(function(M){return Array.isArray(M)?M.includes(N):M[N]})}function et(N,...L){return[].concat(...L).some(function(M){const A=N.match(M);return A&&Pe(A[1])})}function m(N){if(N.match(D)||!N.match(/^-[^-]+/))return!1;let L=!0,j;const M=N.slice(1).split("");for(let A=0;A<M.length;A++){if(j=N.slice(A+2),!Pe(M[A])){L=!1;break}if(M[A+1]&&M[A+1]==="="||j==="-"||/[A-Za-z]/.test(M[A])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)||M[A+1]&&M[A+1].match(/\W/))break}return L}function g(N){return a["unknown-options-as-args"]&&F(N)}function F(N){return N=N.replace(/^-{3,}/,"--"),N.match(D)||m(N)?!1:!et(N,/^-+([^=]+?)=[\s\S]*$/,E,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function v(N){return!$(N,y.bools)&&!$(N,y.counts)&&`${N}`in u?u[N]:Y(J(N))}function Y(N){return{[he.BOOLEAN]:!0,[he.STRING]:"",[he.NUMBER]:void 0,[he.ARRAY]:[]}[N]}function J(N){let L=he.BOOLEAN;return $(N,y.strings)?L=he.STRING:$(N,y.numbers)?L=he.NUMBER:$(N,y.bools)?L=he.BOOLEAN:$(N,y.arrays)&&(L=he.ARRAY),L}function z(N){return N===void 0}function ne(){Object.keys(y.counts).find(N=>$(N,y.arrays)?(f=Error(O("Invalid configuration: %s, opts.count excludes opts.array.",N)),!0):$(N,y.nargs)?(f=Error(O("Invalid configuration: %s, opts.count excludes opts.narg.",N)),!0):!1)}return{aliases:Object.assign({},y.aliases),argv:Object.assign(x,I),configuration:a,defaulted:Object.assign({},T),error:f,newAliases:Object.assign({},b)}}}function Qs(e){const t=[],n=Object.create(null);let r=!0;for(Object.keys(e).forEach(function(o){t.push([].concat(e[o],o))});r;){r=!1;for(let o=0;o<t.length;o++)for(let i=o+1;i<t.length;i++)if(t[o].filter(function(a){return t[i].indexOf(a)!==-1}).length){t[o]=t[o].concat(t[i]),t.splice(i,1),r=!0;break}}return t.forEach(function(o){o=o.filter(function(s,a,u){return u.indexOf(s)===a});const i=o.pop();i!==void 0&&typeof i=="string"&&(n[i]=o)}),n}function rt(e){return e!==void 0?e+1:1}function Mn(e){return e==="__proto__"?"___proto___":e}function Js(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
59
+ */let me;class Qs{constructor(t){me=t}parse(t,n){const r=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},n),o=zs(t),i=typeof t=="string",s=Js(Object.assign(Object.create(null),r.alias)),a=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},r.configuration),u=Object.assign(Object.create(null),r.default),l=r.configObjects||[],f=r.envPrefix,p=a["populate--"],d=p?"--":"_",b=Object.create(null),E=Object.create(null),v=r.__||me.format,y={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("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(N){const A=typeof N=="object"?N.key:N,j=Object.keys(N).map(function(M){return{boolean:"bools",string:"strings",number:"numbers"}[M]}).filter(Boolean).pop();j&&(y[j][A]=!0),y.arrays[A]=!0,y.keys.push(A)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(N){y.bools[N]=!0,y.keys.push(N)}),[].concat(r.string||[]).filter(Boolean).forEach(function(N){y.strings[N]=!0,y.keys.push(N)}),[].concat(r.number||[]).filter(Boolean).forEach(function(N){y.numbers[N]=!0,y.keys.push(N)}),[].concat(r.count||[]).filter(Boolean).forEach(function(N){y.counts[N]=!0,y.keys.push(N)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(N){y.normalize[N]=!0,y.keys.push(N)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([N,A])=>{typeof A=="number"&&(y.nargs[N]=A,y.keys.push(N))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([N,A])=>{typeof A=="function"&&(y.coercions[N]=A,y.keys.push(N))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(N){y.configs[N]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([N,A])=>{(typeof A=="boolean"||typeof A=="function")&&(y.configs[N]=A)})),Ke(r.key,s,r.default,y.arrays),Object.keys(u).forEach(function(N){(y.aliases[N]||[]).forEach(function(A){u[A]=u[N]})});let h=null;ne();let w=[];const I=Object.assign(Object.create(null),{_:[]}),P={};for(let N=0;N<o.length;N++){const A=o[N],j=A.replace(/^-{3,}/,"---");let M,x,X,B,U,te;if(A!=="--"&&/^-/.test(A)&&g(A))L(A);else if(j.match(/^---+(=|$)/)){L(A);continue}else if(A.match(/^--.+=/)||!a["short-option-groups"]&&A.match(/^-.+=/))B=A.match(/^--?([^=]+)=([\s\S]*)$/),B!==null&&Array.isArray(B)&&B.length>=3&&($(B[1],y.arrays)?N=c(N,B[1],o,B[2]):$(B[1],y.nargs)!==!1?N=S(N,B[1],o,B[2]):_(B[1],B[2],!0));else if(A.match(T)&&a["boolean-negation"])B=A.match(T),B!==null&&Array.isArray(B)&&B.length>=2&&(x=B[1],_(x,$(x,y.arrays)?[!1]:!1));else if(A.match(/^--.+/)||!a["short-option-groups"]&&A.match(/^-[^-]+/))B=A.match(/^--?(.+)/),B!==null&&Array.isArray(B)&&B.length>=2&&(x=B[1],$(x,y.arrays)?N=c(N,x,o):$(x,y.nargs)!==!1?N=S(N,x,o):(U=o[N+1],U!==void 0&&(!U.match(/^-/)||U.match(D))&&!$(x,y.bools)&&!$(x,y.counts)||/^(true|false)$/.test(U)?(_(x,U),N++):_(x,O(x))));else if(A.match(/^-.\..+=/))B=A.match(/^-([^=]+)=([\s\S]*)$/),B!==null&&Array.isArray(B)&&B.length>=3&&_(B[1],B[2]);else if(A.match(/^-.\..+/)&&!A.match(D))U=o[N+1],B=A.match(/^-(.\..+)/),B!==null&&Array.isArray(B)&&B.length>=2&&(x=B[1],U!==void 0&&!U.match(/^-/)&&!$(x,y.bools)&&!$(x,y.counts)?(_(x,U),N++):_(x,O(x)));else if(A.match(/^-[^-]+/)&&!A.match(D)){X=A.slice(1,-1).split(""),M=!1;for(let re=0;re<X.length;re++){if(U=A.slice(re+2),X[re+1]&&X[re+1]==="="){te=A.slice(re+3),x=X[re],$(x,y.arrays)?N=c(N,x,o,te):$(x,y.nargs)!==!1?N=S(N,x,o,te):_(x,te),M=!0;break}if(U==="-"){_(X[re],U);continue}if(/[A-Za-z]/.test(X[re])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(U)&&$(U,y.bools)===!1){_(X[re],U),M=!0;break}if(X[re+1]&&X[re+1].match(/\W/)){_(X[re],U),M=!0;break}else _(X[re],O(X[re]))}x=A.slice(-1)[0],!M&&x!=="-"&&($(x,y.arrays)?N=c(N,x,o):$(x,y.nargs)!==!1?N=S(N,x,o):(U=o[N+1],U!==void 0&&(!/^(-|--)[^-]/.test(U)||U.match(D))&&!$(x,y.bools)&&!$(x,y.counts)||/^(true|false)$/.test(U)?(_(x,U),N++):_(x,O(x))))}else if(A.match(/^-[0-9]$/)&&A.match(D)&&$(A.slice(1),y.bools))x=A.slice(1),_(x,O(x));else if(A==="--"){w=o.slice(N+1);break}else if(a["halt-at-non-option"]){w=o.slice(N);break}else L(A)}W(I,!0),W(I,!1),R(I),G(),Ae(I,y.aliases,u,!0),Ze(I),a["set-placeholder-key"]&&Fe(I),Object.keys(y.counts).forEach(function(N){ue(I,N.split("."))||_(N,0)}),p&&w.length&&(I[d]=[]),w.forEach(function(N){I[d].push(N)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(I).filter(N=>N!=="--"&&N.includes("-")).forEach(N=>{delete I[N]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(N=>s[N])).forEach(N=>{a["camel-case-expansion"]&&N.includes("-")&&delete I[N.split(".").map(A=>Ue(A)).join(".")],delete I[N]});function L(N){const A=q("_",N);(typeof A=="string"||typeof A=="number")&&I._.push(A)}function S(N,A,j,M){let x,X=$(A,y.nargs);if(X=typeof X!="number"||isNaN(X)?1:X,X===0)return z(M)||(h=Error(v("Argument unexpected for: %s",A))),_(A,O(A)),N;let B=z(M)?0:1;if(a["nargs-eats-options"])j.length-(N+1)+B<X&&(h=Error(v("Not enough arguments following: %s",A))),B=X;else{for(x=N+1;x<j.length&&(!j[x].match(/^-[^0-9]/)||j[x].match(D)||g(j[x]));x++)B++;B<X&&(h=Error(v("Not enough arguments following: %s",A)))}let U=Math.min(B,X);for(!z(M)&&U>0&&(_(A,M),U--),x=N+1;x<U+N+1;x++)_(A,j[x]);return N+U}function c(N,A,j,M){let x=[],X=M||j[N+1];const B=$(A,y.nargs);if($(A,y.bools)&&!/^(true|false)$/.test(X))x.push(!0);else if(z(X)||z(M)&&/^-/.test(X)&&!D.test(X)&&!g(X)){if(u[A]!==void 0){const U=u[A];x=Array.isArray(U)?U:[U]}}else{z(M)||x.push(k(A,M,!0));for(let U=N+1;U<j.length&&!(!a["greedy-arrays"]&&x.length>0||B&&typeof B=="number"&&x.length>=B||(X=j[U],/^-/.test(X)&&!D.test(X)&&!g(X)));U++)N=U,x.push(k(A,X,i))}return typeof B=="number"&&(B&&x.length<B||isNaN(B)&&x.length===0)&&(h=Error(v("Not enough arguments following: %s",A))),_(A,x),N}function _(N,A,j=i){if(/-/.test(N)&&a["camel-case-expansion"]){const X=N.split(".").map(function(B){return Ue(B)}).join(".");F(N,X)}const M=k(N,A,j),x=N.split(".");ge(I,x,M),y.aliases[N]&&y.aliases[N].forEach(function(X){const B=X.split(".");ge(I,B,M)}),x.length>1&&a["dot-notation"]&&(y.aliases[x[0]]||[]).forEach(function(X){let B=X.split(".");const U=[].concat(x);U.shift(),B=B.concat(U),(y.aliases[N]||[]).includes(B.join("."))||ge(I,B,M)}),$(N,y.normalize)&&!$(N,y.arrays)&&[N].concat(y.aliases[N]||[]).forEach(function(B){Object.defineProperty(P,B,{enumerable:!0,get(){return A},set(U){A=typeof U=="string"?me.normalize(U):U}})})}function F(N,A){y.aliases[N]&&y.aliases[N].length||(y.aliases[N]=[A],b[A]=!0),y.aliases[A]&&y.aliases[A].length||F(A,N)}function k(N,A,j){j&&(A=Zs(A)),($(N,y.bools)||$(N,y.counts))&&typeof A=="string"&&(A=A==="true");let M=Array.isArray(A)?A.map(function(x){return q(N,x)}):q(N,A);return $(N,y.counts)&&(z(M)||typeof M=="boolean")&&(M=rt()),$(N,y.normalize)&&$(N,y.arrays)&&(Array.isArray(A)?M=A.map(x=>me.normalize(x)):M=me.normalize(A)),M}function q(N,A){return!a["parse-positional-numbers"]&&N==="_"||!$(N,y.strings)&&!$(N,y.bools)&&!Array.isArray(A)&&(Ys(A)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${A}`)))||!z(A)&&$(N,y.numbers))&&(A=Number(A)),A}function R(N){const A=Object.create(null);Ae(A,y.aliases,u),Object.keys(y.configs).forEach(function(j){const M=N[j]||A[j];if(M)try{let x=null;const X=me.resolve(me.cwd(),M),B=y.configs[j];if(typeof B=="function"){try{x=B(X)}catch(U){x=U}if(x instanceof Error){h=x;return}}else x=me.require(X);V(x)}catch(x){x.name==="PermissionDenied"?h=x:N[j]&&(h=Error(v("Invalid JSON config file: %s",M)))}})}function V(N,A){Object.keys(N).forEach(function(j){const M=N[j],x=A?A+"."+j:j;typeof M=="object"&&M!==null&&!Array.isArray(M)&&a["dot-notation"]?V(M,x):(!ue(I,x.split("."))||$(x,y.arrays)&&a["combine-arrays"])&&_(x,M)})}function G(){typeof l<"u"&&l.forEach(function(N){V(N)})}function W(N,A){if(typeof f>"u")return;const j=typeof f=="string"?f:"",M=me.env();Object.keys(M).forEach(function(x){if(j===""||x.lastIndexOf(j,0)===0){const X=x.split("__").map(function(B,U){return U===0&&(B=B.substring(j.length)),Ue(B)});(A&&y.configs[X.join(".")]||!A)&&!ue(N,X)&&_(X.join("."),M[x])}})}function Ze(N){let A;const j=new Set;Object.keys(N).forEach(function(M){if(!j.has(M)&&(A=$(M,y.coercions),typeof A=="function"))try{const x=q(M,A(N[M]));[].concat(y.aliases[M]||[],M).forEach(X=>{j.add(X),N[X]=x})}catch(x){h=x}})}function Fe(N){return y.keys.forEach(A=>{~A.indexOf(".")||typeof N[A]>"u"&&(N[A]=void 0)}),N}function Ae(N,A,j,M=!1){Object.keys(j).forEach(function(x){ue(N,x.split("."))||(ge(N,x.split("."),j[x]),M&&(E[x]=!0),(A[x]||[]).forEach(function(X){ue(N,X.split("."))||ge(N,X.split("."),j[x])}))})}function ue(N,A){let j=N;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(x){j=j[x]||{}});const M=A[A.length-1];return typeof j!="object"?!1:M in j}function ge(N,A,j){let M=N;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(te){te=Mn(te),typeof M=="object"&&M[te]===void 0&&(M[te]={}),typeof M[te]!="object"||Array.isArray(M[te])?(Array.isArray(M[te])?M[te].push({}):M[te]=[M[te],{}],M=M[te][M[te].length-1]):M=M[te]});const x=Mn(A[A.length-1]),X=$(A.join("."),y.arrays),B=Array.isArray(j);let U=a["duplicate-arguments-array"];!U&&$(x,y.nargs)&&(U=!0,(!z(M[x])&&y.nargs[x]===1||Array.isArray(M[x])&&M[x].length===y.nargs[x])&&(M[x]=void 0)),j===rt()?M[x]=rt(M[x]):Array.isArray(M[x])?U&&X&&B?M[x]=a["flatten-duplicate-arrays"]?M[x].concat(j):(Array.isArray(M[x][0])?M[x]:[M[x]]).concat([j]):!U&&!!X==!!B?M[x]=j:M[x]=M[x].concat([j]):M[x]===void 0&&X?M[x]=B?j:[j]:U&&!(M[x]===void 0||$(x,y.counts)||$(x,y.bools))?M[x]=[M[x],j]:M[x]=j}function Ke(...N){N.forEach(function(A){Object.keys(A||{}).forEach(function(j){y.aliases[j]||(y.aliases[j]=[].concat(s[j]||[]),y.aliases[j].concat(j).forEach(function(M){if(/-/.test(M)&&a["camel-case-expansion"]){const x=Ue(M);x!==j&&y.aliases[j].indexOf(x)===-1&&(y.aliases[j].push(x),b[x]=!0)}}),y.aliases[j].concat(j).forEach(function(M){if(M.length>1&&/[A-Z]/.test(M)&&a["camel-case-expansion"]){const x=Gs(M,"-");x!==j&&y.aliases[j].indexOf(x)===-1&&(y.aliases[j].push(x),b[x]=!0)}}),y.aliases[j].forEach(function(M){y.aliases[M]=[j].concat(y.aliases[j].filter(function(x){return M!==x}))}))})})}function $(N,A){const j=[].concat(y.aliases[N]||[],N),M=Object.keys(A),x=j.find(X=>M.includes(X));return x?A[x]:!1}function Le(N){const A=Object.keys(y);return[].concat(A.map(M=>y[M])).some(function(M){return Array.isArray(M)?M.includes(N):M[N]})}function et(N,...A){return[].concat(...A).some(function(M){const x=N.match(M);return x&&Le(x[1])})}function m(N){if(N.match(D)||!N.match(/^-[^-]+/))return!1;let A=!0,j;const M=N.slice(1).split("");for(let x=0;x<M.length;x++){if(j=N.slice(x+2),!Le(M[x])){A=!1;break}if(M[x+1]&&M[x+1]==="="||j==="-"||/[A-Za-z]/.test(M[x])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)||M[x+1]&&M[x+1].match(/\W/))break}return A}function g(N){return a["unknown-options-as-args"]&&C(N)}function C(N){return N=N.replace(/^-{3,}/,"--"),N.match(D)||m(N)?!1:!et(N,/^-+([^=]+?)=[\s\S]*$/,T,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function O(N){return!$(N,y.bools)&&!$(N,y.counts)&&`${N}`in u?u[N]:Y(J(N))}function Y(N){return{[he.BOOLEAN]:!0,[he.STRING]:"",[he.NUMBER]:void 0,[he.ARRAY]:[]}[N]}function J(N){let A=he.BOOLEAN;return $(N,y.strings)?A=he.STRING:$(N,y.numbers)?A=he.NUMBER:$(N,y.bools)?A=he.BOOLEAN:$(N,y.arrays)&&(A=he.ARRAY),A}function z(N){return N===void 0}function ne(){Object.keys(y.counts).find(N=>$(N,y.arrays)?(h=Error(v("Invalid configuration: %s, opts.count excludes opts.array.",N)),!0):$(N,y.nargs)?(h=Error(v("Invalid configuration: %s, opts.count excludes opts.narg.",N)),!0):!1)}return{aliases:Object.assign({},y.aliases),argv:Object.assign(P,I),configuration:a,defaulted:Object.assign({},E),error:h,newAliases:Object.assign({},b)}}}function Js(e){const t=[],n=Object.create(null);let r=!0;for(Object.keys(e).forEach(function(o){t.push([].concat(e[o],o))});r;){r=!1;for(let o=0;o<t.length;o++)for(let i=o+1;i<t.length;i++)if(t[o].filter(function(a){return t[i].indexOf(a)!==-1}).length){t[o]=t[o].concat(t[i]),t.splice(i,1),r=!0;break}}return t.forEach(function(o){o=o.filter(function(s,a,u){return u.indexOf(s)===a});const i=o.pop();i!==void 0&&typeof i=="string"&&(n[i]=o)}),n}function rt(e){return e!==void 0?e+1:1}function Mn(e){return e==="__proto__"?"___proto___":e}function Zs(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
60
60
  * @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
61
61
  * CJS and ESM environments.
62
62
  *
63
63
  * @license
64
64
  * Copyright (c) 2016, Contributors
65
65
  * SPDX-License-Identifier: ISC
66
- */var it,st,ot;const Sn=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Fn=(st=(it=process==null?void 0:process.versions)===null||it===void 0?void 0:it.node)!==null&&st!==void 0?st:(ot=process==null?void 0:process.version)===null||ot===void 0?void 0:ot.slice(1);if(Fn&&Number(Fn.match(/^([^.]+)/)[1])<Sn)throw Error(`yargs parser supports a minimum Node.js version of ${Sn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Zs=process?process.env:{};new zs({cwd:process.cwd,env:()=>Zs,format:Nr,normalize:hi,resolve:Jt,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Qt(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const Ks={fs:{readFileSync:Qt,writeFile:oi},format:Nr,resolve:Jt,exists:e=>{try{return ai(e).isFile()}catch{return!1}}};let pe;class eo{constructor(t){t=t||{},this.directory=t.directory||"./locales",this.updateFiles=typeof t.updateFiles=="boolean"?t.updateFiles:!0,this.locale=t.locale||"en",this.fallbackToLanguage=typeof t.fallbackToLanguage=="boolean"?t.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...t){if(typeof arguments[0]!="string")return this._taggedLiteral(arguments[0],...arguments);const n=t.shift();let r=function(){};return typeof t[t.length-1]=="function"&&(r=t.pop()),r=r||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r(),pe.format.apply(pe.format,[this.cache[this.locale][n]||n].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),n=t.shift(),r=t.shift(),o=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let s=o===1?n:r;this.cache[this.locale][n]&&(s=this.cache[this.locale][n][o===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:r},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const a=[s];return~s.indexOf("%d")&&a.push(o),pe.format.apply(pe.format,a.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this.cache[this.locale][n]=t[n])}_taggedLiteral(t,...n){let r="";return t.forEach(function(o,i){const s=n[i+1];r+=o,typeof s<"u"&&(r+="%s")}),this.__.apply(this,[r].concat([].slice.call(n,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,n=this.writeQueue[0],r=n.directory,o=n.locale,i=n.cb,s=this._resolveLocaleFile(r,o),a=JSON.stringify(this.cache[o],null,2);pe.fs.writeFile(s,a,"utf-8",function(u){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(u)})}_readLocaleFile(){let t={};const n=this._resolveLocaleFile(this.directory,this.locale);try{pe.fs.readFileSync&&(t=JSON.parse(pe.fs.readFileSync(n,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+n),r.code==="ENOENT")t={};else throw r}this.cache[this.locale]=t}_resolveLocaleFile(t,n){let r=pe.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~n.lastIndexOf("_")){const o=pe.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(o)&&(r=o)}return r}_fileExistsSync(t){return pe.exists(t)}}function to(e,t){pe=t;const n=new eo(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}const no=e=>to(e,Ks);let Xe;try{Xe=wi(import.meta.url)}catch{Xe=process.cwd()}const ro=Xe.substring(0,Xe.lastIndexOf("node_modules"));ro||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,no({directory:Jt(Xe,"../../../locales"),updateFiles:!1});var at={},Cn;function en(){return Cn||(Cn=1,function(){at.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(H)),at}var ut={},ye={},be={},jn;function Te(){return jn||(jn=1,function(){var e,t,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;e=function(){var p,d,l,h,b,T;if(T=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(p=0,l=b.length;p<l;p++)if(h=b[p],h!=null)for(d in h)u.call(h,d)&&(T[d]=h[d]);return T},o=function(p){return!!p&&Object.prototype.toString.call(p)==="[object Function]"},i=function(p){var d;return!!p&&((d=typeof p)=="function"||d==="object")},n=function(p){return o(Array.isArray)?Array.isArray(p):Object.prototype.toString.call(p)==="[object Array]"},r=function(p){var d;if(n(p))return!p.length;for(d in p)if(u.call(p,d))return!1;return!0},s=function(p){var d,l;return i(p)&&(l=Object.getPrototypeOf(p))&&(d=l.constructor)&&typeof d=="function"&&d instanceof d&&Function.prototype.toString.call(d)===Function.prototype.toString.call(Object)},t=function(p){return o(p.valueOf)?p.valueOf():p},be.assign=e,be.isFunction=o,be.isObject=i,be.isArray=n,be.isEmpty=r,be.isPlainObject=s,be.getValue=t}.call(H)),be}var ct={exports:{}},kn;function Gr(){return kn||(kn=1,function(){ct.exports=function(){function e(){}return e.prototype.hasFeature=function(t,n){return!0},e.prototype.createDocumentType=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,n,r){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,n){throw new Error("This DOM method is not implemented.")},e}()}.call(H)),ct.exports}var lt={exports:{}},ft={exports:{}},pt={exports:{}},Bn;function io(){return Bn||(Bn=1,function(){pt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(H)),pt.exports}var ht={exports:{}},Rn;function so(){return Rn||(Rn=1,function(){ht.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(H)),ht.exports}var Xn;function oo(){return Xn||(Xn=1,function(){var e,t;e=io(),t=so(),ft.exports=function(){function n(){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(n.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(r){return this.params.hasOwnProperty(r)?this.params[r]:null},n.prototype.canSetParameter=function(r,o){return!0},n.prototype.setParameter=function(r,o){return o!=null?this.params[r]=o:delete this.params[r]},n}()}.call(H)),ft.exports}var dt={exports:{}},gt={exports:{}},mt={exports:{}},Un;function ee(){return Un||(Un=1,function(){mt.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(H)),mt.exports}var yt={exports:{}},Vn;function Yr(){return Vn||(Vn=1,function(){var e;e=ee(),fe(),yt.exports=function(){function t(n,r,o){if(this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),r==null)throw new Error("Missing attribute name. "+this.debugInfo(r));this.name=this.stringify.name(r),this.value=this.stringify.attValue(o),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(n){return this.value=n||""}}),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(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},t.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},t}()}.call(H)),yt.exports}var bt={exports:{}},$n;function tn(){return $n||($n=1,function(){bt.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 n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},e.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,n){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,n){throw new Error("This DOM method is not implemented.")},e}()}.call(H)),bt.exports}var qn;function nn(){return qn||(qn=1,function(){var e,t,n,r,o,i,s,a,u=function(d,l){for(var h in l)p.call(l,h)&&(d[h]=l[h]);function b(){this.constructor=d}return b.prototype=l.prototype,d.prototype=new b,d.__super__=l.prototype,d},p={}.hasOwnProperty;a=Te(),s=a.isObject,i=a.isFunction,o=a.getValue,r=fe(),e=ee(),t=Yr(),n=tn(),gt.exports=function(d){u(l,d);function l(h,b,T){var O,y,D,E;if(l.__super__.constructor.call(this,h),b==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(b),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,T!=null&&this.attribute(T),h.type===e.Document&&(this.isRoot=!0,this.documentObject=h,h.rootObject=this,h.children)){for(E=h.children,y=0,D=E.length;y<D;y++)if(O=E[y],O.type===e.DocType){O.name=this.name;break}}}return Object.defineProperty(l.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(l.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(l.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(l.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(l.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(l.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),l.prototype.clone=function(){var h,b,T,O;T=Object.create(this),T.isRoot&&(T.documentObject=null),T.attribs={},O=this.attribs;for(b in O)p.call(O,b)&&(h=O[b],T.attribs[b]=h.clone());return T.children=[],this.children.forEach(function(y){var D;return D=y.clone(),D.parent=T,T.children.push(D)}),T},l.prototype.attribute=function(h,b){var T,O;if(h!=null&&(h=o(h)),s(h))for(T in h)p.call(h,T)&&(O=h[T],this.attribute(T,O));else i(b)&&(b=b.apply()),this.options.keepNullAttributes&&b==null?this.attribs[h]=new t(this,h,""):b!=null&&(this.attribs[h]=new t(this,h,b));return this},l.prototype.removeAttribute=function(h){var b,T,O;if(h==null)throw new Error("Missing attribute name. "+this.debugInfo());if(h=o(h),Array.isArray(h))for(T=0,O=h.length;T<O;T++)b=h[T],delete this.attribs[b];else delete this.attribs[h];return this},l.prototype.toString=function(h){return this.options.writer.element(this,this.options.writer.filterOptions(h))},l.prototype.att=function(h,b){return this.attribute(h,b)},l.prototype.a=function(h,b){return this.attribute(h,b)},l.prototype.getAttribute=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h].value:null},l.prototype.setAttribute=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNode=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h]:null},l.prototype.setAttributeNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.removeAttributeNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setAttributeNS=function(h,b,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.removeAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getAttributeNodeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setAttributeNodeNS=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagNameNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.hasAttribute=function(h){return this.attribs.hasOwnProperty(h)},l.prototype.hasAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setIdAttribute=function(h,b){return this.attribs.hasOwnProperty(h)?this.attribs[h].isId:b},l.prototype.setIdAttributeNS=function(h,b,T){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.setIdAttributeNode=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByTagNameNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.getElementsByClassName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},l.prototype.isEqualNode=function(h){var b,T,O;if(!l.__super__.isEqualNode.apply(this,arguments).isEqualNode(h)||h.namespaceURI!==this.namespaceURI||h.prefix!==this.prefix||h.localName!==this.localName||h.attribs.length!==this.attribs.length)return!1;for(b=T=0,O=this.attribs.length-1;0<=O?T<=O:T>=O;b=0<=O?++T:--T)if(!this.attribs[b].isEqualNode(h.attribs[b]))return!1;return!0},l}(r)}.call(H)),gt.exports}var wt={exports:{}},Tt={exports:{}},Wn;function Qe(){return Wn||(Wn=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=fe(),Tt.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(o.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(o.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(o.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.substringData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.insertData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.deleteData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceData=function(i,s,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},o}(e)}.call(H)),Tt.exports}var Hn;function rn(){return Hn||(Hn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),wt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.cdata(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),wt.exports}var Et={exports:{}},Gn;function sn(){return Gn||(Gn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),Et.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.comment(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Et.exports}var Nt={exports:{}},Yn;function on(){return Yn||(Yn=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Te().isObject,t=fe(),e=ee(),Nt.exports=function(i){r(s,i);function s(a,u,p,d){var l;s.__super__.constructor.call(this,a),n(u)&&(l=u,u=l.version,p=l.encoding,d=l.standalone),u||(u="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(u),p!=null&&(this.encoding=this.stringify.xmlEncoding(p)),d!=null&&(this.standalone=this.stringify.xmlStandalone(d))}return s.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},s}(t)}.call(H)),Nt.exports}var It={exports:{}},vt={exports:{}},zn;function an(){return zn||(zn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),vt.exports=function(o){n(i,o);function i(s,a,u,p,d,l){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(u==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(a));if(!p)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!d)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(d.indexOf("#")!==0&&(d="#"+d),!d.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(l&&!d.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.name(a),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(p),l&&(this.defaultValue=this.stringify.dtdAttDefault(l)),this.defaultValueType=d}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),vt.exports}var Ot={exports:{}},Qn;function un(){return Qn||(Qn=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Te().isObject,t=fe(),e=ee(),Ot.exports=function(i){r(s,i);function s(a,u,p,d){if(s.__super__.constructor.call(this,a),p==null)throw new Error("Missing DTD entity name. "+this.debugInfo(p));if(d==null)throw new Error("Missing DTD entity value. "+this.debugInfo(p));if(this.pe=!!u,this.name=this.stringify.name(p),this.type=e.EntityDeclaration,!n(d))this.value=this.stringify.dtdEntityValue(d),this.internal=!0;else{if(!d.pubID&&!d.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(p));if(d.pubID&&!d.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(p));if(this.internal=!1,d.pubID!=null&&(this.pubID=this.stringify.dtdPubID(d.pubID)),d.sysID!=null&&(this.sysID=this.stringify.dtdSysID(d.sysID)),d.nData!=null&&(this.nData=this.stringify.dtdNData(d.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(p))}}return Object.defineProperty(s.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(s.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(s.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(s.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlVersion",{get:function(){return null}}),s.prototype.toString=function(a){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(a))},s}(t)}.call(H)),Ot.exports}var At={exports:{}},Jn;function cn(){return Jn||(Jn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),At.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.name(a),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(u)}return i.prototype.toString=function(s){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),At.exports}var Lt={exports:{}},Zn;function ln(){return Zn||(Zn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),Lt.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(a));this.name=this.stringify.name(a),this.type=e.NotationDeclaration,u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),i.prototype.toString=function(s){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Lt.exports}var Kn;function fn(){return Kn||(Kn=1,function(){var e,t,n,r,o,i,s,a,u=function(d,l){for(var h in l)p.call(l,h)&&(d[h]=l[h]);function b(){this.constructor=d}return b.prototype=l.prototype,d.prototype=new b,d.__super__=l.prototype,d},p={}.hasOwnProperty;a=Te().isObject,s=fe(),e=ee(),t=an(),r=un(),n=cn(),o=ln(),i=tn(),It.exports=function(d){u(l,d);function l(h,b,T){var O,y,D,E,f,w;if(l.__super__.constructor.call(this,h),this.type=e.DocType,h.children){for(E=h.children,y=0,D=E.length;y<D;y++)if(O=E[y],O.type===e.Element){this.name=O.name;break}}this.documentObject=h,a(b)&&(f=b,b=f.pubID,T=f.sysID),T==null&&(w=[b,T],T=w[0],b=w[1]),b!=null&&(this.pubID=this.stringify.dtdPubID(b)),T!=null&&(this.sysID=this.stringify.dtdSysID(T))}return Object.defineProperty(l.prototype,"entities",{get:function(){var h,b,T,O,y;for(O={},y=this.children,b=0,T=y.length;b<T;b++)h=y[b],h.type===e.EntityDeclaration&&!h.pe&&(O[h.name]=h);return new i(O)}}),Object.defineProperty(l.prototype,"notations",{get:function(){var h,b,T,O,y;for(O={},y=this.children,b=0,T=y.length;b<T;b++)h=y[b],h.type===e.NotationDeclaration&&(O[h.name]=h);return new i(O)}}),Object.defineProperty(l.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(l.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(l.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),l.prototype.element=function(h,b){var T;return T=new n(this,h,b),this.children.push(T),this},l.prototype.attList=function(h,b,T,O,y){var D;return D=new t(this,h,b,T,O,y),this.children.push(D),this},l.prototype.entity=function(h,b){var T;return T=new r(this,!1,h,b),this.children.push(T),this},l.prototype.pEntity=function(h,b){var T;return T=new r(this,!0,h,b),this.children.push(T),this},l.prototype.notation=function(h,b){var T;return T=new o(this,h,b),this.children.push(T),this},l.prototype.toString=function(h){return this.options.writer.docType(this,this.options.writer.filterOptions(h))},l.prototype.ele=function(h,b){return this.element(h,b)},l.prototype.att=function(h,b,T,O,y){return this.attList(h,b,T,O,y)},l.prototype.ent=function(h,b){return this.entity(h,b)},l.prototype.pent=function(h,b){return this.pEntity(h,b)},l.prototype.not=function(h,b){return this.notation(h,b)},l.prototype.up=function(){return this.root()||this.documentObject},l.prototype.isEqualNode=function(h){return!(!l.__super__.isEqualNode.apply(this,arguments).isEqualNode(h)||h.name!==this.name||h.publicId!==this.publicId||h.systemId!==this.systemId)},l}(s)}.call(H)),It.exports}var Pt={exports:{}},er;function pn(){return er||(er=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=fe(),Pt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=e.Raw,this.value=this.stringify.raw(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.raw(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Pt.exports}var xt={exports:{}},tr;function hn(){return tr||(tr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),xt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=e.Text,this.value=this.stringify.text(a)}return Object.defineProperty(i.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(i.prototype,"wholeText",{get:function(){var s,a,u;for(u="",a=this.previousSibling;a;)u=a.data+u,a=a.previousSibling;for(u+=this.data,s=this.nextSibling;s;)u=u+s.data,s=s.nextSibling;return u}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.text(this,this.options.writer.filterOptions(s))},i.prototype.splitText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(H)),xt.exports}var _t={exports:{}},nr;function dn(){return nr||(nr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),_t.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=e.ProcessingInstruction,this.target=this.stringify.insTarget(a),this.name=this.target,u&&(this.value=this.stringify.insValue(u))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(s))},i.prototype.isEqualNode=function(s){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(s)||s.target!==this.target)},i}(t)}.call(H)),_t.exports}var Dt={exports:{}},rr;function zr(){return rr||(rr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),Dt.exports=function(o){n(i,o);function i(s){i.__super__.constructor.call(this,s),this.type=e.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return""},i}(t)}.call(H)),Dt.exports}var Mt={exports:{}},ir;function ao(){return ir||(ir=1,function(){Mt.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(H)),Mt.exports}var St={exports:{}},sr;function uo(){return sr||(sr=1,function(){St.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(H)),St.exports}var or;function fe(){return or||(or=1,function(){var e,t,n,r,o,i,s,a,u,p,d,l,h,b,T,O,y,D={}.hasOwnProperty;y=Te(),O=y.isObject,T=y.isFunction,b=y.isEmpty,h=y.getValue,a=null,n=null,r=null,o=null,i=null,d=null,l=null,p=null,s=null,t=null,u=null,e=null,dt.exports=function(){function E(f){this.parent=f,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=nn(),n=rn(),r=sn(),o=on(),i=fn(),d=pn(),l=hn(),p=dn(),s=zr(),t=ee(),u=ao(),tn(),e=uo())}return Object.defineProperty(E.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(E.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(E.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(E.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(E.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new u(this.children)),this.childNodeList}}),Object.defineProperty(E.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(E.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(E.prototype,"previousSibling",{get:function(){var f;return f=this.parent.children.indexOf(this),this.parent.children[f-1]||null}}),Object.defineProperty(E.prototype,"nextSibling",{get:function(){var f;return f=this.parent.children.indexOf(this),this.parent.children[f+1]||null}}),Object.defineProperty(E.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(E.prototype,"textContent",{get:function(){var f,w,I,x,P;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(P="",x=this.children,w=0,I=x.length;w<I;w++)f=x[w],f.textContent&&(P+=f.textContent);return P}else return null},set:function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),E.prototype.setParent=function(f){var w,I,x,P,S;for(this.parent=f,f&&(this.options=f.options,this.stringify=f.stringify),P=this.children,S=[],I=0,x=P.length;I<x;I++)w=P[I],S.push(w.setParent(this));return S},E.prototype.element=function(f,w,I){var x,P,S,c,_,C,k,q,R,V,G;if(C=null,w===null&&I==null&&(R=[{},null],w=R[0],I=R[1]),w==null&&(w={}),w=h(w),O(w)||(V=[w,I],I=V[0],w=V[1]),f!=null&&(f=h(f)),Array.isArray(f))for(S=0,k=f.length;S<k;S++)P=f[S],C=this.element(P);else if(T(f))C=this.element(f.apply());else if(O(f)){for(_ in f)if(D.call(f,_))if(G=f[_],T(G)&&(G=G.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&_.indexOf(this.stringify.convertAttKey)===0)C=this.attribute(_.substr(this.stringify.convertAttKey.length),G);else if(!this.options.separateArrayItems&&Array.isArray(G)&&b(G))C=this.dummy();else if(O(G)&&b(G))C=this.element(_);else if(!this.options.keepNullNodes&&G==null)C=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(G))for(c=0,q=G.length;c<q;c++)P=G[c],x={},x[_]=P,C=this.element(x);else O(G)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&_.indexOf(this.stringify.convertTextKey)===0?C=this.element(G):(C=this.element(_),C.element(G)):C=this.element(_,G)}else!this.options.keepNullNodes&&I===null?C=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&f.indexOf(this.stringify.convertTextKey)===0?C=this.text(I):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&f.indexOf(this.stringify.convertCDataKey)===0?C=this.cdata(I):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&f.indexOf(this.stringify.convertCommentKey)===0?C=this.comment(I):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&f.indexOf(this.stringify.convertRawKey)===0?C=this.raw(I):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&f.indexOf(this.stringify.convertPIKey)===0?C=this.instruction(f.substr(this.stringify.convertPIKey.length),I):C=this.node(f,w,I);if(C==null)throw new Error("Could not create any elements with: "+f+". "+this.debugInfo());return C},E.prototype.insertBefore=function(f,w,I){var x,P,S,c,_;if(f?.type)return S=f,c=w,S.setParent(this),c?(P=children.indexOf(c),_=children.splice(P),children.push(S),Array.prototype.push.apply(children,_)):children.push(S),S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(f));return P=this.parent.children.indexOf(this),_=this.parent.children.splice(P),x=this.parent.element(f,w,I),Array.prototype.push.apply(this.parent.children,_),x},E.prototype.insertAfter=function(f,w,I){var x,P,S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(f));return P=this.parent.children.indexOf(this),S=this.parent.children.splice(P+1),x=this.parent.element(f,w,I),Array.prototype.push.apply(this.parent.children,S),x},E.prototype.remove=function(){var f;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return f=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[f,f-f+1].concat([])),this.parent},E.prototype.node=function(f,w,I){var x,P;return f!=null&&(f=h(f)),w||(w={}),w=h(w),O(w)||(P=[w,I],I=P[0],w=P[1]),x=new a(this,f,w),I!=null&&x.text(I),this.children.push(x),x},E.prototype.text=function(f){var w;return O(f)&&this.element(f),w=new l(this,f),this.children.push(w),this},E.prototype.cdata=function(f){var w;return w=new n(this,f),this.children.push(w),this},E.prototype.comment=function(f){var w;return w=new r(this,f),this.children.push(w),this},E.prototype.commentBefore=function(f){var w,I;return w=this.parent.children.indexOf(this),I=this.parent.children.splice(w),this.parent.comment(f),Array.prototype.push.apply(this.parent.children,I),this},E.prototype.commentAfter=function(f){var w,I;return w=this.parent.children.indexOf(this),I=this.parent.children.splice(w+1),this.parent.comment(f),Array.prototype.push.apply(this.parent.children,I),this},E.prototype.raw=function(f){var w;return w=new d(this,f),this.children.push(w),this},E.prototype.dummy=function(){var f;return f=new s(this),f},E.prototype.instruction=function(f,w){var I,x,P,S,c;if(f!=null&&(f=h(f)),w!=null&&(w=h(w)),Array.isArray(f))for(S=0,c=f.length;S<c;S++)I=f[S],this.instruction(I);else if(O(f))for(I in f)D.call(f,I)&&(x=f[I],this.instruction(I,x));else T(w)&&(w=w.apply()),P=new p(this,f,w),this.children.push(P);return this},E.prototype.instructionBefore=function(f,w){var I,x;return I=this.parent.children.indexOf(this),x=this.parent.children.splice(I),this.parent.instruction(f,w),Array.prototype.push.apply(this.parent.children,x),this},E.prototype.instructionAfter=function(f,w){var I,x;return I=this.parent.children.indexOf(this),x=this.parent.children.splice(I+1),this.parent.instruction(f,w),Array.prototype.push.apply(this.parent.children,x),this},E.prototype.declaration=function(f,w,I){var x,P;return x=this.document(),P=new o(x,f,w,I),x.children.length===0?x.children.unshift(P):x.children[0].type===t.Declaration?x.children[0]=P:x.children.unshift(P),x.root()||x},E.prototype.dtd=function(f,w){var I,x,P,S,c,_,C,k,q,R;for(x=this.document(),P=new i(x,f,w),q=x.children,S=c=0,C=q.length;c<C;S=++c)if(I=q[S],I.type===t.DocType)return x.children[S]=P,P;for(R=x.children,S=_=0,k=R.length;_<k;S=++_)if(I=R[S],I.isRoot)return x.children.splice(S,0,P),P;return x.children.push(P),P},E.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},E.prototype.root=function(){var f;for(f=this;f;){if(f.type===t.Document)return f.rootObject;if(f.isRoot)return f;f=f.parent}},E.prototype.document=function(){var f;for(f=this;f;){if(f.type===t.Document)return f;f=f.parent}},E.prototype.end=function(f){return this.document().end(f)},E.prototype.prev=function(){var f;if(f=this.parent.children.indexOf(this),f<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[f-1]},E.prototype.next=function(){var f;if(f=this.parent.children.indexOf(this),f===-1||f===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[f+1]},E.prototype.importDocument=function(f){var w;return w=f.root().clone(),w.parent=this,w.isRoot=!1,this.children.push(w),this},E.prototype.debugInfo=function(f){var w,I;return f=f||this.name,f==null&&!((w=this.parent)!=null&&w.name)?"":f==null?"parent: <"+this.parent.name+">":(I=this.parent)!=null&&I.name?"node: <"+f+">, parent: <"+this.parent.name+">":"node: <"+f+">"},E.prototype.ele=function(f,w,I){return this.element(f,w,I)},E.prototype.nod=function(f,w,I){return this.node(f,w,I)},E.prototype.txt=function(f){return this.text(f)},E.prototype.dat=function(f){return this.cdata(f)},E.prototype.com=function(f){return this.comment(f)},E.prototype.ins=function(f,w){return this.instruction(f,w)},E.prototype.doc=function(){return this.document()},E.prototype.dec=function(f,w,I){return this.declaration(f,w,I)},E.prototype.e=function(f,w,I){return this.element(f,w,I)},E.prototype.n=function(f,w,I){return this.node(f,w,I)},E.prototype.t=function(f){return this.text(f)},E.prototype.d=function(f){return this.cdata(f)},E.prototype.c=function(f){return this.comment(f)},E.prototype.r=function(f){return this.raw(f)},E.prototype.i=function(f,w){return this.instruction(f,w)},E.prototype.u=function(){return this.up()},E.prototype.importXMLBuilder=function(f){return this.importDocument(f)},E.prototype.replaceChild=function(f,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.removeChild=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.appendChild=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.hasChildNodes=function(){return this.children.length!==0},E.prototype.cloneNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isSupported=function(f,w){return!0},E.prototype.hasAttributes=function(){return this.attribs.length!==0},E.prototype.compareDocumentPosition=function(f){var w,I;return w=this,w===f?0:this.document()!==f.document()?(I=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?I|=e.Preceding:I|=e.Following,I):w.isAncestor(f)?e.Contains|e.Preceding:w.isDescendant(f)?e.Contains|e.Following:w.isPreceding(f)?e.Preceding:e.Following},E.prototype.isSameNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupPrefix=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isDefaultNamespace=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.lookupNamespaceURI=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.isEqualNode=function(f){var w,I,x;if(f.nodeType!==this.nodeType||f.children.length!==this.children.length)return!1;for(w=I=0,x=this.children.length-1;0<=x?I<=x:I>=x;w=0<=x?++I:--I)if(!this.children[w].isEqualNode(f.children[w]))return!1;return!0},E.prototype.getFeature=function(f,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.setUserData=function(f,w,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.getUserData=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},E.prototype.contains=function(f){return f?f===this||this.isDescendant(f):!1},E.prototype.isDescendant=function(f){var w,I,x,P,S;for(S=this.children,x=0,P=S.length;x<P;x++)if(w=S[x],f===w||(I=w.isDescendant(f),I))return!0;return!1},E.prototype.isAncestor=function(f){return f.isDescendant(this)},E.prototype.isPreceding=function(f){var w,I;return w=this.treePosition(f),I=this.treePosition(this),w===-1||I===-1?!1:w<I},E.prototype.isFollowing=function(f){var w,I;return w=this.treePosition(f),I=this.treePosition(this),w===-1||I===-1?!1:w>I},E.prototype.treePosition=function(f){var w,I;return I=0,w=!1,this.foreachTreeNode(this.document(),function(x){if(I++,!w&&x===f)return w=!0}),w?I:-1},E.prototype.foreachTreeNode=function(f,w){var I,x,P,S,c;for(f||(f=this.document()),S=f.children,x=0,P=S.length;x<P;x++){if(I=S[x],c=w(I))return c;if(c=this.foreachTreeNode(I,w),c)return c}},E}()}.call(H)),dt.exports}var Ft={exports:{}},ar;function Qr(){return ar||(ar=1,function(){var e=function(n,r){return function(){return n.apply(r,arguments)}},t={}.hasOwnProperty;Ft.exports=function(){function n(r){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var o,i,s;r||(r={}),this.options=r,this.options.version||(this.options.version="1.0"),i=r.stringify||{};for(o in i)t.call(i,o)&&(s=i[o],this[o]=s)}return n.prototype.name=function(r){return this.options.noValidation?r:this.assertLegalName(""+r||"")},n.prototype.text=function(r){return this.options.noValidation?r:this.assertLegalChar(this.textEscape(""+r||""))},n.prototype.cdata=function(r){return this.options.noValidation?r:(r=""+r||"",r=r.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(r))},n.prototype.comment=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+r);return this.assertLegalChar(r)},n.prototype.raw=function(r){return this.options.noValidation?r:""+r||""},n.prototype.attValue=function(r){return this.options.noValidation?r:this.assertLegalChar(this.attEscape(r=""+r||""))},n.prototype.insTarget=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.insValue=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/\?>/))throw new Error("Invalid processing instruction value: "+r);return this.assertLegalChar(r)},n.prototype.xmlVersion=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+r);return r},n.prototype.xmlEncoding=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+r);return this.assertLegalChar(r)},n.prototype.xmlStandalone=function(r){return this.options.noValidation?r:r?"yes":"no"},n.prototype.dtdPubID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdSysID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdElementValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttType=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttDefault=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdEntityValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdNData=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(r){var o,i;if(this.options.noValidation)return r;if(o="",this.options.version==="1.0"){if(o=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o))throw new Error("Invalid character in string: "+r+" at index "+i.index)}else if(this.options.version==="1.1"&&(o=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o)))throw new Error("Invalid character in string: "+r+" at index "+i.index);return r},n.prototype.assertLegalName=function(r){var o;if(this.options.noValidation)return r;if(this.assertLegalChar(r),o=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!r.match(o))throw new Error("Invalid character in name");return r},n.prototype.textEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n}()}.call(H)),Ft.exports}var Ct={exports:{}},jt={exports:{}},kt={exports:{}},ur;function Je(){return ur||(ur=1,function(){kt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(H)),kt.exports}var cr;function Jr(){return cr||(cr=1,function(){var e,t,n,r={}.hasOwnProperty;n=Te().assign,e=ee(),on(),fn(),rn(),sn(),nn(),pn(),hn(),dn(),zr(),an(),cn(),un(),ln(),t=Je(),jt.exports=function(){function o(i){var s,a,u;i||(i={}),this.options=i,a=i.writer||{};for(s in a)r.call(a,s)&&(u=a[s],this["_"+s]=this[s],this[s]=u)}return o.prototype.filterOptions=function(i){var s,a,u,p,d,l,h,b;return i||(i={}),i=n({},this.options,i),s={writer:this},s.pretty=i.pretty||!1,s.allowEmpty=i.allowEmpty||!1,s.indent=(a=i.indent)!=null?a:" ",s.newline=(u=i.newline)!=null?u:`
68
- `,s.offset=(p=i.offset)!=null?p:0,s.dontPrettyTextNodes=(d=(l=i.dontPrettyTextNodes)!=null?l:i.dontprettytextnodes)!=null?d:0,s.spaceBeforeSlash=(h=(b=i.spaceBeforeSlash)!=null?b:i.spacebeforeslash)!=null?h:"",s.spaceBeforeSlash===!0&&(s.spaceBeforeSlash=" "),s.suppressPrettyCount=0,s.user={},s.state=t.None,s},o.prototype.indent=function(i,s,a){var u;return!s.pretty||s.suppressPrettyCount?"":s.pretty&&(u=(a||0)+s.offset+1,u>0)?new Array(u).join(s.indent):""},o.prototype.endline=function(i,s,a){return!s.pretty||s.suppressPrettyCount?"":s.newline},o.prototype.attribute=function(i,s,a){var u;return this.openAttribute(i,s,a),u=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,s,a),u},o.prototype.cdata=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<![CDATA[",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+="]]>"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.comment=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!-- ",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=" -->"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.declaration=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?xml",s.state=t.InsideTag,u+=' version="'+i.version+'"',i.encoding!=null&&(u+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(u+=' standalone="'+i.standalone+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.docType=function(i,s,a){var u,p,d,l,h;if(a||(a=0),this.openNode(i,s,a),s.state=t.OpenTag,l=this.indent(i,s,a),l+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?l+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(l+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(l+=" [",l+=this.endline(i,s,a),s.state=t.InsideTag,h=i.children,p=0,d=h.length;p<d;p++)u=h[p],l+=this.writeChildNode(u,s,a+1);s.state=t.CloseTag,l+="]"}return s.state=t.CloseTag,l+=s.spaceBeforeSlash+">",l+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),l},o.prototype.element=function(i,s,a){var u,p,d,l,h,b,T,O,y,D,E,f,w,I;a||(a=0),D=!1,E="",this.openNode(i,s,a),s.state=t.OpenTag,E+=this.indent(i,s,a)+"<"+i.name,f=i.attribs;for(y in f)r.call(f,y)&&(u=f[y],E+=this.attribute(u,s,a));if(d=i.children.length,l=d===0?null:i.children[0],d===0||i.children.every(function(x){return(x.type===e.Text||x.type===e.Raw)&&x.value===""}))s.allowEmpty?(E+=">",s.state=t.CloseTag,E+="</"+i.name+">"+this.endline(i,s,a)):(s.state=t.CloseTag,E+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&d===1&&(l.type===e.Text||l.type===e.Raw)&&l.value!=null)E+=">",s.state=t.InsideTag,s.suppressPrettyCount++,D=!0,E+=this.writeChildNode(l,s,a+1),s.suppressPrettyCount--,D=!1,s.state=t.CloseTag,E+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(w=i.children,h=0,T=w.length;h<T;h++)if(p=w[h],(p.type===e.Text||p.type===e.Raw)&&p.value!=null){s.suppressPrettyCount++,D=!0;break}}for(E+=">"+this.endline(i,s,a),s.state=t.InsideTag,I=i.children,b=0,O=I.length;b<O;b++)p=I[b],E+=this.writeChildNode(p,s,a+1);s.state=t.CloseTag,E+=this.indent(i,s,a)+"</"+i.name+">",D&&s.suppressPrettyCount--,E+=this.endline(i,s,a),s.state=t.None}return this.closeNode(i,s,a),E},o.prototype.writeChildNode=function(i,s,a){switch(i.type){case e.CData:return this.cdata(i,s,a);case e.Comment:return this.comment(i,s,a);case e.Element:return this.element(i,s,a);case e.Raw:return this.raw(i,s,a);case e.Text:return this.text(i,s,a);case e.ProcessingInstruction:return this.processingInstruction(i,s,a);case e.Dummy:return"";case e.Declaration:return this.declaration(i,s,a);case e.DocType:return this.docType(i,s,a);case e.AttributeDeclaration:return this.dtdAttList(i,s,a);case e.ElementDeclaration:return this.dtdElement(i,s,a);case e.EntityDeclaration:return this.dtdEntity(i,s,a);case e.NotationDeclaration:return this.dtdNotation(i,s,a);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},o.prototype.processingInstruction=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?",s.state=t.InsideTag,u+=i.target,i.value&&(u+=" "+i.value),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.raw=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.text=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdAttList=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ATTLIST",s.state=t.InsideTag,u+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(u+=" "+i.defaultValueType),i.defaultValue&&(u+=' "'+i.defaultValue+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdElement=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ELEMENT",s.state=t.InsideTag,u+=" "+i.name+" "+i.value,s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdEntity=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ENTITY",s.state=t.InsideTag,i.pe&&(u+=" %"),u+=" "+i.name,i.value?u+=' "'+i.value+'"':(i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),i.nData&&(u+=" NDATA "+i.nData)),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdNotation=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!NOTATION",s.state=t.InsideTag,u+=" "+i.name,i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?u+=' PUBLIC "'+i.pubID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.openNode=function(i,s,a){},o.prototype.closeNode=function(i,s,a){},o.prototype.openAttribute=function(i,s,a){},o.prototype.closeAttribute=function(i,s,a){},o}()}.call(H)),jt.exports}var lr;function gn(){return lr||(lr=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=Jr(),Ct.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,s){var a,u,p,d,l;for(s=this.filterOptions(s),d="",l=i.children,u=0,p=l.length;u<p;u++)a=l[u],d+=this.writeChildNode(a,s,0);return s.pretty&&d.slice(-s.newline.length)===s.newline&&(d=d.slice(0,-s.newline.length)),d},o}(e)}.call(H)),Ct.exports}var fr;function Zr(){return fr||(fr=1,function(){var e,t,n,r,o,i,s,a=function(p,d){for(var l in d)u.call(d,l)&&(p[l]=d[l]);function h(){this.constructor=p}return h.prototype=d.prototype,p.prototype=new h,p.__super__=d.prototype,p},u={}.hasOwnProperty;s=Te().isPlainObject,n=Gr(),t=oo(),r=fe(),e=ee(),i=Qr(),o=gn(),lt.exports=function(p){a(d,p);function d(l){d.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,l||(l={}),l.writer||(l.writer=new o),this.options=l,this.stringify=new i(l)}return Object.defineProperty(d.prototype,"implementation",{value:new n}),Object.defineProperty(d.prototype,"doctype",{get:function(){var l,h,b,T;for(T=this.children,h=0,b=T.length;h<b;h++)if(l=T[h],l.type===e.DocType)return l;return null}}),Object.defineProperty(d.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(d.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(d.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(d.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(d.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(d.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(d.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(d.prototype,"origin",{get:function(){return null}}),Object.defineProperty(d.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(d.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(d.prototype,"contentType",{get:function(){return null}}),d.prototype.end=function(l){var h;return h={},l?s(l)&&(h=l,l=this.options.writer):l=this.options.writer,l.document(this,l.filterOptions(h))},d.prototype.toString=function(l){return this.options.writer.document(this,this.options.writer.filterOptions(l))},d.prototype.createElement=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createTextNode=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createComment=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createCDATASection=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createProcessingInstruction=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createAttribute=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createEntityReference=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.importNode=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createElementNS=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createAttributeNS=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByTagNameNS=function(l,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementById=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.adoptNode=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.renameNode=function(l,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.getElementsByClassName=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createEvent=function(l){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createNodeIterator=function(l,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d.prototype.createTreeWalker=function(l,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},d}(r)}.call(H)),lt.exports}var Bt={exports:{}},pr;function co(){return pr||(pr=1,function(){var e,t,n,r,o,i,s,a,u,p,d,l,h,b,T,O,y,D,E,f,w,I,x,P={}.hasOwnProperty;x=Te(),w=x.isObject,f=x.isFunction,I=x.isPlainObject,E=x.getValue,e=ee(),l=Zr(),h=nn(),r=rn(),o=sn(),T=pn(),D=hn(),b=dn(),p=on(),d=fn(),i=an(),a=un(),s=cn(),u=ln(),n=Yr(),y=Qr(),O=gn(),t=Je(),Bt.exports=function(){function S(c,_,C){var k;this.name="?xml",this.type=e.Document,c||(c={}),k={},c.writer?I(c.writer)&&(k=c.writer,c.writer=new O):c.writer=new O,this.options=c,this.writer=c.writer,this.writerOptions=this.writer.filterOptions(k),this.stringify=new y(c),this.onDataCallback=_||function(){},this.onEndCallback=C||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return S.prototype.createChildNode=function(c){var _,C,k,q,R,V,G,W;switch(c.type){case e.CData:this.cdata(c.value);break;case e.Comment:this.comment(c.value);break;case e.Element:k={},G=c.attribs;for(C in G)P.call(G,C)&&(_=G[C],k[C]=_.value);this.node(c.name,k);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(c.value);break;case e.Text:this.text(c.value);break;case e.ProcessingInstruction:this.instruction(c.target,c.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+c.constructor.name)}for(W=c.children,R=0,V=W.length;R<V;R++)q=W[R],this.createChildNode(q),q.type===e.Element&&this.up();return this},S.prototype.dummy=function(){return this},S.prototype.node=function(c,_,C){var k;if(c==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(c));return this.openCurrent(),c=E(c),_==null&&(_={}),_=E(_),w(_)||(k=[_,C],C=k[0],_=k[1]),this.currentNode=new h(this,c,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,C!=null&&this.text(C),this},S.prototype.element=function(c,_,C){var k,q,R,V,G,W;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(c)||w(c)||f(c))for(V=this.options.noValidation,this.options.noValidation=!0,W=new l(this.options).element("TEMP_ROOT"),W.element(c),this.options.noValidation=V,G=W.children,q=0,R=G.length;q<R;q++)k=G[q],this.createChildNode(k),k.type===e.Element&&this.up();else this.node(c,_,C);return this},S.prototype.attribute=function(c,_){var C,k;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(c));if(c!=null&&(c=E(c)),w(c))for(C in c)P.call(c,C)&&(k=c[C],this.attribute(C,k));else f(_)&&(_=_.apply()),this.options.keepNullAttributes&&_==null?this.currentNode.attribs[c]=new n(this,c,""):_!=null&&(this.currentNode.attribs[c]=new n(this,c,_));return this},S.prototype.text=function(c){var _;return this.openCurrent(),_=new D(this,c),this.onData(this.writer.text(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.cdata=function(c){var _;return this.openCurrent(),_=new r(this,c),this.onData(this.writer.cdata(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.comment=function(c){var _;return this.openCurrent(),_=new o(this,c),this.onData(this.writer.comment(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.raw=function(c){var _;return this.openCurrent(),_=new T(this,c),this.onData(this.writer.raw(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.instruction=function(c,_){var C,k,q,R,V;if(this.openCurrent(),c!=null&&(c=E(c)),_!=null&&(_=E(_)),Array.isArray(c))for(C=0,R=c.length;C<R;C++)k=c[C],this.instruction(k);else if(w(c))for(k in c)P.call(c,k)&&(q=c[k],this.instruction(k,q));else f(_)&&(_=_.apply()),V=new b(this,c,_),this.onData(this.writer.processingInstruction(V,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},S.prototype.declaration=function(c,_,C){var k;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return k=new p(this,c,_,C),this.onData(this.writer.declaration(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.doctype=function(c,_,C){if(this.openCurrent(),c==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new d(this,_,C),this.currentNode.rootNodeName=c,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},S.prototype.dtdElement=function(c,_){var C;return this.openCurrent(),C=new s(this,c,_),this.onData(this.writer.dtdElement(C,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.attList=function(c,_,C,k,q){var R;return this.openCurrent(),R=new i(this,c,_,C,k,q),this.onData(this.writer.dtdAttList(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.entity=function(c,_){var C;return this.openCurrent(),C=new a(this,!1,c,_),this.onData(this.writer.dtdEntity(C,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.pEntity=function(c,_){var C;return this.openCurrent(),C=new a(this,!0,c,_),this.onData(this.writer.dtdEntity(C,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.notation=function(c,_){var C;return this.openCurrent(),C=new u(this,c,_),this.onData(this.writer.dtdNotation(C,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},S.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},S.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},S.prototype.openNode=function(c){var _,C,k,q;if(!c.isOpen){if(!this.root&&this.currentLevel===0&&c.type===e.Element&&(this.root=c),C="",c.type===e.Element){this.writerOptions.state=t.OpenTag,C=this.writer.indent(c,this.writerOptions,this.currentLevel)+"<"+c.name,q=c.attribs;for(k in q)P.call(q,k)&&(_=q[k],C+=this.writer.attribute(_,this.writerOptions,this.currentLevel));C+=(c.children?">":"/>")+this.writer.endline(c,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,C=this.writer.indent(c,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+c.rootNodeName,c.pubID&&c.sysID?C+=' PUBLIC "'+c.pubID+'" "'+c.sysID+'"':c.sysID&&(C+=' SYSTEM "'+c.sysID+'"'),c.children?(C+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,C+=">"),C+=this.writer.endline(c,this.writerOptions,this.currentLevel);return this.onData(C,this.currentLevel),c.isOpen=!0}},S.prototype.closeNode=function(c){var _;if(!c.isClosed)return _="",this.writerOptions.state=t.CloseTag,c.type===e.Element?_=this.writer.indent(c,this.writerOptions,this.currentLevel)+"</"+c.name+">"+this.writer.endline(c,this.writerOptions,this.currentLevel):_=this.writer.indent(c,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(c,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(_,this.currentLevel),c.isClosed=!0},S.prototype.onData=function(c,_){return this.documentStarted=!0,this.onDataCallback(c,_+1)},S.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},S.prototype.debugInfo=function(c){return c==null?"":"node: <"+c+">"},S.prototype.ele=function(){return this.element.apply(this,arguments)},S.prototype.nod=function(c,_,C){return this.node(c,_,C)},S.prototype.txt=function(c){return this.text(c)},S.prototype.dat=function(c){return this.cdata(c)},S.prototype.com=function(c){return this.comment(c)},S.prototype.ins=function(c,_){return this.instruction(c,_)},S.prototype.dec=function(c,_,C){return this.declaration(c,_,C)},S.prototype.dtd=function(c,_,C){return this.doctype(c,_,C)},S.prototype.e=function(c,_,C){return this.element(c,_,C)},S.prototype.n=function(c,_,C){return this.node(c,_,C)},S.prototype.t=function(c){return this.text(c)},S.prototype.d=function(c){return this.cdata(c)},S.prototype.c=function(c){return this.comment(c)},S.prototype.r=function(c){return this.raw(c)},S.prototype.i=function(c,_){return this.instruction(c,_)},S.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.ent=function(c,_){return this.entity(c,_)},S.prototype.pent=function(c,_){return this.pEntity(c,_)},S.prototype.not=function(c,_){return this.notation(c,_)},S}()}.call(H)),Bt.exports}var Rt={exports:{}},hr;function lo(){return hr||(hr=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;e=ee(),n=Jr(),t=Je(),Rt.exports=function(i){r(s,i);function s(a,u){this.stream=a,s.__super__.constructor.call(this,u)}return s.prototype.endline=function(a,u,p){return a.isLastRootNode&&u.state===t.CloseTag?"":s.__super__.endline.call(this,a,u,p)},s.prototype.document=function(a,u){var p,d,l,h,b,T,O,y,D;for(O=a.children,d=l=0,b=O.length;l<b;d=++l)p=O[d],p.isLastRootNode=d===a.children.length-1;for(u=this.filterOptions(u),y=a.children,D=[],h=0,T=y.length;h<T;h++)p=y[h],D.push(this.writeChildNode(p,u,0));return D},s.prototype.attribute=function(a,u,p){return this.stream.write(s.__super__.attribute.call(this,a,u,p))},s.prototype.cdata=function(a,u,p){return this.stream.write(s.__super__.cdata.call(this,a,u,p))},s.prototype.comment=function(a,u,p){return this.stream.write(s.__super__.comment.call(this,a,u,p))},s.prototype.declaration=function(a,u,p){return this.stream.write(s.__super__.declaration.call(this,a,u,p))},s.prototype.docType=function(a,u,p){var d,l,h,b;if(p||(p=0),this.openNode(a,u,p),u.state=t.OpenTag,this.stream.write(this.indent(a,u,p)),this.stream.write("<!DOCTYPE "+a.root().name),a.pubID&&a.sysID?this.stream.write(' PUBLIC "'+a.pubID+'" "'+a.sysID+'"'):a.sysID&&this.stream.write(' SYSTEM "'+a.sysID+'"'),a.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(a,u,p)),u.state=t.InsideTag,b=a.children,l=0,h=b.length;l<h;l++)d=b[l],this.writeChildNode(d,u,p+1);u.state=t.CloseTag,this.stream.write("]")}return u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+">"),this.stream.write(this.endline(a,u,p)),u.state=t.None,this.closeNode(a,u,p)},s.prototype.element=function(a,u,p){var d,l,h,b,T,O,y,D,E;p||(p=0),this.openNode(a,u,p),u.state=t.OpenTag,this.stream.write(this.indent(a,u,p)+"<"+a.name),D=a.attribs;for(y in D)o.call(D,y)&&(d=D[y],this.attribute(d,u,p));if(h=a.children.length,b=h===0?null:a.children[0],h===0||a.children.every(function(f){return(f.type===e.Text||f.type===e.Raw)&&f.value===""}))u.allowEmpty?(this.stream.write(">"),u.state=t.CloseTag,this.stream.write("</"+a.name+">")):(u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+"/>"));else if(u.pretty&&h===1&&(b.type===e.Text||b.type===e.Raw)&&b.value!=null)this.stream.write(">"),u.state=t.InsideTag,u.suppressPrettyCount++,this.writeChildNode(b,u,p+1),u.suppressPrettyCount--,u.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,p)),u.state=t.InsideTag,E=a.children,T=0,O=E.length;T<O;T++)l=E[T],this.writeChildNode(l,u,p+1);u.state=t.CloseTag,this.stream.write(this.indent(a,u,p)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,p)),u.state=t.None,this.closeNode(a,u,p)},s.prototype.processingInstruction=function(a,u,p){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,p))},s.prototype.raw=function(a,u,p){return this.stream.write(s.__super__.raw.call(this,a,u,p))},s.prototype.text=function(a,u,p){return this.stream.write(s.__super__.text.call(this,a,u,p))},s.prototype.dtdAttList=function(a,u,p){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,p))},s.prototype.dtdElement=function(a,u,p){return this.stream.write(s.__super__.dtdElement.call(this,a,u,p))},s.prototype.dtdEntity=function(a,u,p){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,p))},s.prototype.dtdNotation=function(a,u,p){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,p))},s}(n)}.call(H)),Rt.exports}var dr;function fo(){return dr||(dr=1,function(){var e,t,n,r,o,i,s,a,u,p;p=Te(),a=p.assign,u=p.isFunction,n=Gr(),r=Zr(),o=co(),s=gn(),i=lo(),e=ee(),t=Je(),ye.create=function(d,l,h,b){var T,O;if(d==null)throw new Error("Root element needs a name.");return b=a({},l,h,b),T=new r(b),O=T.element(d),b.headless||(T.declaration(b),(b.pubID!=null||b.sysID!=null)&&T.dtd(b)),O},ye.begin=function(d,l,h){var b;return u(d)&&(b=[d,l],l=b[0],h=b[1],d={}),l?new o(d,l,h):new r(d)},ye.stringWriter=function(d){return new s(d)},ye.streamWriter=function(d,l){return new i(d,l)},ye.implementation=new n,ye.nodeType=e,ye.writerState=t}.call(H)),ye}var gr;function po(){return gr||(gr=1,function(){var e,t,n,r,o,i={}.hasOwnProperty;e=fo(),t=en().defaults,r=function(s){return typeof s=="string"&&(s.indexOf("&")>=0||s.indexOf(">")>=0||s.indexOf("<")>=0)},o=function(s){return"<![CDATA["+n(s)+"]]>"},n=function(s){return s.replace("]]>","]]]]><![CDATA[>")},ut.Builder=function(){function s(a){var u,p,d;this.options={},p=t["0.2"];for(u in p)i.call(p,u)&&(d=p[u],this.options[u]=d);for(u in a)i.call(a,u)&&(d=a[u],this.options[u]=d)}return s.prototype.buildObject=function(a){var u,p,d,l,h;return u=this.options.attrkey,p=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===t["0.2"].rootName?(h=Object.keys(a)[0],a=a[h]):h=this.options.rootName,d=function(b){return function(T,O){var y,D,E,f,w,I;if(typeof O!="object")b.options.cdata&&r(O)?T.raw(o(O)):T.txt(O);else if(Array.isArray(O)){for(f in O)if(i.call(O,f)){D=O[f];for(w in D)E=D[w],T=d(T.ele(w),E).up()}}else for(w in O)if(i.call(O,w))if(D=O[w],w===u){if(typeof D=="object")for(y in D)I=D[y],T=T.att(y,I)}else if(w===p)b.options.cdata&&r(D)?T=T.raw(o(D)):T=T.txt(D);else if(Array.isArray(D))for(f in D)i.call(D,f)&&(E=D[f],typeof E=="string"?b.options.cdata&&r(E)?T=T.ele(w).raw(o(E)).up():T=T.ele(w,E).up():T=d(T.ele(w),E).up());else typeof D=="object"?T=d(T.ele(w),D).up():typeof D=="string"&&b.options.cdata&&r(D)?T=T.ele(w).raw(o(D)).up():(D==null&&(D=""),T=T.ele(w,D.toString()).up());return T}}(this),l=e.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),d(l,a).end(this.options.renderOpts)},s}()}.call(H)),ut}var Xt={},Ut={},mr;function ho(){return mr||(mr=1,function(e){(function(t){t.parser=function(m,g){return new r(m,g)},t.SAXParser=r,t.SAXStream=d,t.createStream=p,t.MAX_BUFFER_LENGTH=64*1024;var n=["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 r(m,g){if(!(this instanceof r))return new r(m,g);var F=this;i(F),F.q=F.c="",F.bufferCheckPosition=t.MAX_BUFFER_LENGTH,F.opt=g||{},F.opt.lowercase=F.opt.lowercase||F.opt.lowercasetags,F.looseCase=F.opt.lowercase?"toLowerCase":"toUpperCase",F.tags=[],F.closed=F.closedRoot=F.sawRoot=!1,F.tag=F.error=null,F.strict=!!m,F.noscript=!!(m||F.opt.noscript),F.state=c.BEGIN,F.strictEntities=F.opt.strictEntities,F.ENTITIES=F.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),F.attribList=[],F.opt.xmlns&&(F.ns=Object.create(O)),F.opt.unquotedAttributeValues===void 0&&(F.opt.unquotedAttributeValues=!m),F.trackPosition=F.opt.position!==!1,F.trackPosition&&(F.position=F.line=F.column=0),C(F,"onready")}Object.create||(Object.create=function(m){function g(){}g.prototype=m;var F=new g;return F}),Object.keys||(Object.keys=function(m){var g=[];for(var F in m)m.hasOwnProperty(F)&&g.push(F);return g});function o(m){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),F=0,v=0,Y=n.length;v<Y;v++){var J=m[n[v]].length;if(J>g)switch(n[v]){case"textNode":q(m);break;case"cdata":k(m,"oncdata",m.cdata),m.cdata="";break;case"script":k(m,"onscript",m.script),m.script="";break;default:V(m,"Max buffer length exceeded: "+n[v])}F=Math.max(F,J)}var z=t.MAX_BUFFER_LENGTH-F;m.bufferCheckPosition=z+m.position}function i(m){for(var g=0,F=n.length;g<F;g++)m[n[g]]=""}function s(m){q(m),m.cdata!==""&&(k(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(k(m,"onscript",m.script),m.script="")}r.prototype={end:function(){G(this)},write:et,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var u=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function p(m,g){return new d(m,g)}function d(m,g){if(!(this instanceof d))return new d(m,g);a.apply(this),this._parser=new r(m,g),this.writable=!0,this.readable=!0;var F=this;this._parser.onend=function(){F.emit("end")},this._parser.onerror=function(v){F.emit("error",v),F._parser.error=null},this._decoder=null,u.forEach(function(v){Object.defineProperty(F,"on"+v,{get:function(){return F._parser["on"+v]},set:function(Y){if(!Y)return F.removeAllListeners(v),F._parser["on"+v]=Y,Y;F.on(v,Y)},enumerable:!0,configurable:!1})})}d.prototype=Object.create(a.prototype,{constructor:{value:d}}),d.prototype.write=function(m){return typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m)&&(this._decoder||(this._decoder=new TextDecoder("utf8")),m=this._decoder.decode(m,{stream:!0})),this._parser.write(m.toString()),this.emit("data",m),!0},d.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var g=this._decoder.decode();g&&(this._parser.write(g),this.emit("data",g))}return this._parser.end(),!0},d.prototype.on=function(m,g){var F=this;return!F._parser["on"+m]&&u.indexOf(m)!==-1&&(F._parser["on"+m]=function(){var v=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);v.splice(0,0,m),F.emit.apply(F,v)}),a.prototype.on.call(F,m,g)};var l="[CDATA[",h="DOCTYPE",b="http://www.w3.org/XML/1998/namespace",T="http://www.w3.org/2000/xmlns/",O={xml:b,xmlns:T},y=/[:_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-]/,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]/,f=/[#:_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 w(m){return m===" "||m===`
69
- `||m==="\r"||m===" "}function I(m){return m==='"'||m==="'"}function x(m){return m===">"||w(m)}function P(m,g){return m.test(g)}function S(m,g){return!P(m,g)}var c=0;t.STATE={BEGIN:c++,BEGIN_WHITESPACE:c++,TEXT:c++,TEXT_ENTITY:c++,OPEN_WAKA:c++,SGML_DECL:c++,SGML_DECL_QUOTED:c++,DOCTYPE:c++,DOCTYPE_QUOTED:c++,DOCTYPE_DTD:c++,DOCTYPE_DTD_QUOTED:c++,COMMENT_STARTING:c++,COMMENT:c++,COMMENT_ENDING:c++,COMMENT_ENDED:c++,CDATA:c++,CDATA_ENDING:c++,CDATA_ENDING_2:c++,PROC_INST:c++,PROC_INST_BODY:c++,PROC_INST_ENDING:c++,OPEN_TAG:c++,OPEN_TAG_SLASH:c++,ATTRIB:c++,ATTRIB_NAME:c++,ATTRIB_NAME_SAW_WHITE:c++,ATTRIB_VALUE:c++,ATTRIB_VALUE_QUOTED:c++,ATTRIB_VALUE_CLOSED:c++,ATTRIB_VALUE_UNQUOTED:c++,ATTRIB_VALUE_ENTITY_Q:c++,ATTRIB_VALUE_ENTITY_U:c++,CLOSE_TAG:c++,CLOSE_TAG_SAW_WHITE:c++,SCRIPT:c++,SCRIPT_ENDING:c++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var g=t.ENTITIES[m],F=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[m]=F});for(var _ in t.STATE)t.STATE[t.STATE[_]]=_;c=t.STATE;function C(m,g,F){m[g]&&m[g](F)}function k(m,g,F){m.textNode&&q(m),C(m,g,F)}function q(m){m.textNode=R(m.opt,m.textNode),m.textNode&&C(m,"ontext",m.textNode),m.textNode=""}function R(m,g){return m.trim&&(g=g.trim()),m.normalize&&(g=g.replace(/\s+/g," ")),g}function V(m,g){return q(m),m.trackPosition&&(g+=`
66
+ */var it,st,ot;const Sn=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,Cn=(st=(it=process==null?void 0:process.versions)===null||it===void 0?void 0:it.node)!==null&&st!==void 0?st:(ot=process==null?void 0:process.version)===null||ot===void 0?void 0:ot.slice(1);if(Cn&&Number(Cn.match(/^([^.]+)/)[1])<Sn)throw Error(`yargs parser supports a minimum Node.js version of ${Sn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const Ks=process?process.env:{};new Qs({cwd:process.cwd,env:()=>Ks,format:Nr,normalize:gi,resolve:Jt,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Qt(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const eo={fs:{readFileSync:Qt,writeFile:ui},format:Nr,resolve:Jt,exists:e=>{try{return ci(e).isFile()}catch{return!1}}};let pe;class to{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 n=t.shift();let r=function(){};return typeof t[t.length-1]=="function"&&(r=t.pop()),r=r||function(){},this.cache[this.locale]||this._readLocaleFile(),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]=n,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r})):r(),pe.format.apply(pe.format,[this.cache[this.locale][n]||n].concat(t))}__n(){const t=Array.prototype.slice.call(arguments),n=t.shift(),r=t.shift(),o=t.shift();let i=function(){};typeof t[t.length-1]=="function"&&(i=t.pop()),this.cache[this.locale]||this._readLocaleFile();let s=o===1?n:r;this.cache[this.locale][n]&&(s=this.cache[this.locale][n][o===1?"one":"other"]),!this.cache[this.locale][n]&&this.updateFiles?(this.cache[this.locale][n]={one:n,other:r},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:i})):i();const a=[s];return~s.indexOf("%d")&&a.push(o),pe.format.apply(pe.format,a.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){this.cache[this.locale]||this._readLocaleFile();for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(this.cache[this.locale][n]=t[n])}_taggedLiteral(t,...n){let r="";return t.forEach(function(o,i){const s=n[i+1];r+=o,typeof s<"u"&&(r+="%s")}),this.__.apply(this,[r].concat([].slice.call(n,1)))}_enqueueWrite(t){this.writeQueue.push(t),this.writeQueue.length===1&&this._processWriteQueue()}_processWriteQueue(){const t=this,n=this.writeQueue[0],r=n.directory,o=n.locale,i=n.cb,s=this._resolveLocaleFile(r,o),a=JSON.stringify(this.cache[o],null,2);pe.fs.writeFile(s,a,"utf-8",function(u){t.writeQueue.shift(),t.writeQueue.length>0&&t._processWriteQueue(),i(u)})}_readLocaleFile(){let t={};const n=this._resolveLocaleFile(this.directory,this.locale);try{pe.fs.readFileSync&&(t=JSON.parse(pe.fs.readFileSync(n,"utf-8")))}catch(r){if(r instanceof SyntaxError&&(r.message="syntax error in "+n),r.code==="ENOENT")t={};else throw r}this.cache[this.locale]=t}_resolveLocaleFile(t,n){let r=pe.resolve(t,"./",n+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(r)&&~n.lastIndexOf("_")){const o=pe.resolve(t,"./",n.split("_")[0]+".json");this._fileExistsSync(o)&&(r=o)}return r}_fileExistsSync(t){return pe.exists(t)}}function no(e,t){pe=t;const n=new to(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}const ro=e=>no(e,eo);let Xe;try{Xe=Ei(import.meta.url)}catch{Xe=process.cwd()}const io=Xe.substring(0,Xe.lastIndexOf("node_modules"));io||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,ro({directory:Jt(Xe,"../../../locales"),updateFiles:!1});var at={},Fn;function en(){return Fn||(Fn=1,function(){at.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(H)),at}var ut={},ye={},be={},jn;function Ee(){return jn||(jn=1,function(){var e,t,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;e=function(){var l,f,p,d,b,E;if(E=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(l=0,p=b.length;l<p;l++)if(d=b[l],d!=null)for(f in d)u.call(d,f)&&(E[f]=d[f]);return E},o=function(l){return!!l&&Object.prototype.toString.call(l)==="[object Function]"},i=function(l){var f;return!!l&&((f=typeof l)=="function"||f==="object")},n=function(l){return o(Array.isArray)?Array.isArray(l):Object.prototype.toString.call(l)==="[object Array]"},r=function(l){var f;if(n(l))return!l.length;for(f in l)if(u.call(l,f))return!1;return!0},s=function(l){var f,p;return i(l)&&(p=Object.getPrototypeOf(l))&&(f=p.constructor)&&typeof f=="function"&&f instanceof f&&Function.prototype.toString.call(f)===Function.prototype.toString.call(Object)},t=function(l){return o(l.valueOf)?l.valueOf():l},be.assign=e,be.isFunction=o,be.isObject=i,be.isArray=n,be.isEmpty=r,be.isPlainObject=s,be.getValue=t}.call(H)),be}var ct={exports:{}},kn;function Yr(){return kn||(kn=1,function(){ct.exports=function(){function e(){}return e.prototype.hasFeature=function(t,n){return!0},e.prototype.createDocumentType=function(t,n,r){throw new Error("This DOM method is not implemented.")},e.prototype.createDocument=function(t,n,r){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,n){throw new Error("This DOM method is not implemented.")},e}()}.call(H)),ct.exports}var lt={exports:{}},ft={exports:{}},pt={exports:{}},Bn;function so(){return Bn||(Bn=1,function(){pt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(H)),pt.exports}var ht={exports:{}},Rn;function oo(){return Rn||(Rn=1,function(){ht.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(H)),ht.exports}var Xn;function ao(){return Xn||(Xn=1,function(){var e,t;e=so(),t=oo(),ft.exports=function(){function n(){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(n.prototype,"parameterNames",{get:function(){return new t(Object.keys(this.defaultParams))}}),n.prototype.getParameter=function(r){return this.params.hasOwnProperty(r)?this.params[r]:null},n.prototype.canSetParameter=function(r,o){return!0},n.prototype.setParameter=function(r,o){return o!=null?this.params[r]=o:delete this.params[r]},n}()}.call(H)),ft.exports}var dt={exports:{}},gt={exports:{}},mt={exports:{}},Un;function ee(){return Un||(Un=1,function(){mt.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(H)),mt.exports}var yt={exports:{}},Vn;function zr(){return Vn||(Vn=1,function(){var e;e=ee(),fe(),yt.exports=function(){function t(n,r,o){if(this.parent=n,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),r==null)throw new Error("Missing attribute name. "+this.debugInfo(r));this.name=this.stringify.name(r),this.value=this.stringify.attValue(o),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(n){return this.value=n||""}}),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(n){return this.options.writer.attribute(this,this.options.writer.filterOptions(n))},t.prototype.debugInfo=function(n){return n=n||this.name,n==null?"parent: <"+this.parent.name+">":"attribute: {"+n+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(n){return!(n.namespaceURI!==this.namespaceURI||n.prefix!==this.prefix||n.localName!==this.localName||n.value!==this.value)},t}()}.call(H)),yt.exports}var bt={exports:{}},$n;function tn(){return $n||($n=1,function(){bt.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 n;return n=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,n||null},e.prototype.removeNamedItem=function(t){var n;return n=this.nodes[t],delete this.nodes[t],n||null},e.prototype.item=function(t){return this.nodes[Object.keys(this.nodes)[t]]||null},e.prototype.getNamedItemNS=function(t,n){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,n){throw new Error("This DOM method is not implemented.")},e}()}.call(H)),bt.exports}var qn;function nn(){return qn||(qn=1,function(){var e,t,n,r,o,i,s,a,u=function(f,p){for(var d in p)l.call(p,d)&&(f[d]=p[d]);function b(){this.constructor=f}return b.prototype=p.prototype,f.prototype=new b,f.__super__=p.prototype,f},l={}.hasOwnProperty;a=Ee(),s=a.isObject,i=a.isFunction,o=a.getValue,r=fe(),e=ee(),t=zr(),n=tn(),gt.exports=function(f){u(p,f);function p(d,b,E){var v,y,D,T;if(p.__super__.constructor.call(this,d),b==null)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(b),this.type=e.Element,this.attribs={},this.schemaTypeInfo=null,E!=null&&this.attribute(E),d.type===e.Document&&(this.isRoot=!0,this.documentObject=d,d.rootObject=this,d.children)){for(T=d.children,y=0,D=T.length;y<D;y++)if(v=T[y],v.type===e.DocType){v.name=this.name;break}}}return Object.defineProperty(p.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(p.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(p.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(p.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(p.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(p.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),p.prototype.clone=function(){var d,b,E,v;E=Object.create(this),E.isRoot&&(E.documentObject=null),E.attribs={},v=this.attribs;for(b in v)l.call(v,b)&&(d=v[b],E.attribs[b]=d.clone());return E.children=[],this.children.forEach(function(y){var D;return D=y.clone(),D.parent=E,E.children.push(D)}),E},p.prototype.attribute=function(d,b){var E,v;if(d!=null&&(d=o(d)),s(d))for(E in d)l.call(d,E)&&(v=d[E],this.attribute(E,v));else i(b)&&(b=b.apply()),this.options.keepNullAttributes&&b==null?this.attribs[d]=new t(this,d,""):b!=null&&(this.attribs[d]=new t(this,d,b));return this},p.prototype.removeAttribute=function(d){var b,E,v;if(d==null)throw new Error("Missing attribute name. "+this.debugInfo());if(d=o(d),Array.isArray(d))for(E=0,v=d.length;E<v;E++)b=d[E],delete this.attribs[b];else delete this.attribs[d];return this},p.prototype.toString=function(d){return this.options.writer.element(this,this.options.writer.filterOptions(d))},p.prototype.att=function(d,b){return this.attribute(d,b)},p.prototype.a=function(d,b){return this.attribute(d,b)},p.prototype.getAttribute=function(d){return this.attribs.hasOwnProperty(d)?this.attribs[d].value:null},p.prototype.setAttribute=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNode=function(d){return this.attribs.hasOwnProperty(d)?this.attribs[d]:null},p.prototype.setAttributeNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.removeAttributeNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setAttributeNS=function(d,b,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.removeAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getAttributeNodeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setAttributeNodeNS=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.hasAttribute=function(d){return this.attribs.hasOwnProperty(d)},p.prototype.hasAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setIdAttribute=function(d,b){return this.attribs.hasOwnProperty(d)?this.attribs[d].isId:b},p.prototype.setIdAttributeNS=function(d,b,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.setIdAttributeNode=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.isEqualNode=function(d){var b,E,v;if(!p.__super__.isEqualNode.apply(this,arguments).isEqualNode(d)||d.namespaceURI!==this.namespaceURI||d.prefix!==this.prefix||d.localName!==this.localName||d.attribs.length!==this.attribs.length)return!1;for(b=E=0,v=this.attribs.length-1;0<=v?E<=v:E>=v;b=0<=v?++E:--E)if(!this.attribs[b].isEqualNode(d.attribs[b]))return!1;return!0},p}(r)}.call(H)),gt.exports}var wt={exports:{}},Et={exports:{}},Wn;function Qe(){return Wn||(Wn=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=fe(),Et.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i),this.value=""}return Object.defineProperty(o.prototype,"data",{get:function(){return this.value},set:function(i){return this.value=i||""}}),Object.defineProperty(o.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(o.prototype,"textContent",{get:function(){return this.value},set:function(i){return this.value=i||""}}),o.prototype.clone=function(){return Object.create(this)},o.prototype.substringData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.appendData=function(i){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.insertData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.deleteData=function(i,s){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.replaceData=function(i,s,a){throw new Error("This DOM method is not implemented."+this.debugInfo())},o.prototype.isEqualNode=function(i){return!(!o.__super__.isEqualNode.apply(this,arguments).isEqualNode(i)||i.data!==this.data)},o}(e)}.call(H)),Et.exports}var Hn;function rn(){return Hn||(Hn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),wt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=e.CData,this.value=this.stringify.cdata(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.cdata(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),wt.exports}var Tt={exports:{}},Gn;function sn(){return Gn||(Gn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),Tt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=e.Comment,this.value=this.stringify.comment(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.comment(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Tt.exports}var Nt={exports:{}},Yn;function on(){return Yn||(Yn=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Ee().isObject,t=fe(),e=ee(),Nt.exports=function(i){r(s,i);function s(a,u,l,f){var p;s.__super__.constructor.call(this,a),n(u)&&(p=u,u=p.version,l=p.encoding,f=p.standalone),u||(u="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(u),l!=null&&(this.encoding=this.stringify.xmlEncoding(l)),f!=null&&(this.standalone=this.stringify.xmlStandalone(f))}return s.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},s}(t)}.call(H)),Nt.exports}var It={exports:{}},Ot={exports:{}},zn;function an(){return zn||(zn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),Ot.exports=function(o){n(i,o);function i(s,a,u,l,f,p){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());if(u==null)throw new Error("Missing DTD attribute name. "+this.debugInfo(a));if(!l)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!f)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(f.indexOf("#")!==0&&(f="#"+f),!f.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(p&&!f.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.name(a),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(l),p&&(this.defaultValue=this.stringify.dtdAttDefault(p)),this.defaultValueType=f}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Ot.exports}var vt={exports:{}},Qn;function un(){return Qn||(Qn=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;n=Ee().isObject,t=fe(),e=ee(),vt.exports=function(i){r(s,i);function s(a,u,l,f){if(s.__super__.constructor.call(this,a),l==null)throw new Error("Missing DTD entity name. "+this.debugInfo(l));if(f==null)throw new Error("Missing DTD entity value. "+this.debugInfo(l));if(this.pe=!!u,this.name=this.stringify.name(l),this.type=e.EntityDeclaration,!n(f))this.value=this.stringify.dtdEntityValue(f),this.internal=!0;else{if(!f.pubID&&!f.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(l));if(f.pubID&&!f.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(l));if(this.internal=!1,f.pubID!=null&&(this.pubID=this.stringify.dtdPubID(f.pubID)),f.sysID!=null&&(this.sysID=this.stringify.dtdSysID(f.sysID)),f.nData!=null&&(this.nData=this.stringify.dtdNData(f.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(l))}}return Object.defineProperty(s.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(s.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(s.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(s.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(s.prototype,"xmlVersion",{get:function(){return null}}),s.prototype.toString=function(a){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(a))},s}(t)}.call(H)),vt.exports}var xt={exports:{}},Jn;function cn(){return Jn||(Jn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),xt.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD element name. "+this.debugInfo());u||(u="(#PCDATA)"),Array.isArray(u)&&(u="("+u.join(",")+")"),this.name=this.stringify.name(a),this.type=e.ElementDeclaration,this.value=this.stringify.dtdElementValue(u)}return i.prototype.toString=function(s){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),xt.exports}var At={exports:{}},Zn;function ln(){return Zn||(Zn=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),At.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing DTD notation name. "+this.debugInfo(a));if(!u.pubID&&!u.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(a));this.name=this.stringify.name(a),this.type=e.NotationDeclaration,u.pubID!=null&&(this.pubID=this.stringify.dtdPubID(u.pubID)),u.sysID!=null&&(this.sysID=this.stringify.dtdSysID(u.sysID))}return Object.defineProperty(i.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(i.prototype,"systemId",{get:function(){return this.sysID}}),i.prototype.toString=function(s){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),At.exports}var Kn;function fn(){return Kn||(Kn=1,function(){var e,t,n,r,o,i,s,a,u=function(f,p){for(var d in p)l.call(p,d)&&(f[d]=p[d]);function b(){this.constructor=f}return b.prototype=p.prototype,f.prototype=new b,f.__super__=p.prototype,f},l={}.hasOwnProperty;a=Ee().isObject,s=fe(),e=ee(),t=an(),r=un(),n=cn(),o=ln(),i=tn(),It.exports=function(f){u(p,f);function p(d,b,E){var v,y,D,T,h,w;if(p.__super__.constructor.call(this,d),this.type=e.DocType,d.children){for(T=d.children,y=0,D=T.length;y<D;y++)if(v=T[y],v.type===e.Element){this.name=v.name;break}}this.documentObject=d,a(b)&&(h=b,b=h.pubID,E=h.sysID),E==null&&(w=[b,E],E=w[0],b=w[1]),b!=null&&(this.pubID=this.stringify.dtdPubID(b)),E!=null&&(this.sysID=this.stringify.dtdSysID(E))}return Object.defineProperty(p.prototype,"entities",{get:function(){var d,b,E,v,y;for(v={},y=this.children,b=0,E=y.length;b<E;b++)d=y[b],d.type===e.EntityDeclaration&&!d.pe&&(v[d.name]=d);return new i(v)}}),Object.defineProperty(p.prototype,"notations",{get:function(){var d,b,E,v,y;for(v={},y=this.children,b=0,E=y.length;b<E;b++)d=y[b],d.type===e.NotationDeclaration&&(v[d.name]=d);return new i(v)}}),Object.defineProperty(p.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(p.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(p.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),p.prototype.element=function(d,b){var E;return E=new n(this,d,b),this.children.push(E),this},p.prototype.attList=function(d,b,E,v,y){var D;return D=new t(this,d,b,E,v,y),this.children.push(D),this},p.prototype.entity=function(d,b){var E;return E=new r(this,!1,d,b),this.children.push(E),this},p.prototype.pEntity=function(d,b){var E;return E=new r(this,!0,d,b),this.children.push(E),this},p.prototype.notation=function(d,b){var E;return E=new o(this,d,b),this.children.push(E),this},p.prototype.toString=function(d){return this.options.writer.docType(this,this.options.writer.filterOptions(d))},p.prototype.ele=function(d,b){return this.element(d,b)},p.prototype.att=function(d,b,E,v,y){return this.attList(d,b,E,v,y)},p.prototype.ent=function(d,b){return this.entity(d,b)},p.prototype.pent=function(d,b){return this.pEntity(d,b)},p.prototype.not=function(d,b){return this.notation(d,b)},p.prototype.up=function(){return this.root()||this.documentObject},p.prototype.isEqualNode=function(d){return!(!p.__super__.isEqualNode.apply(this,arguments).isEqualNode(d)||d.name!==this.name||d.publicId!==this.publicId||d.systemId!==this.systemId)},p}(s)}.call(H)),It.exports}var Lt={exports:{}},er;function pn(){return er||(er=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=fe(),Lt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing raw text. "+this.debugInfo());this.type=e.Raw,this.value=this.stringify.raw(a)}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.raw(this,this.options.writer.filterOptions(s))},i}(t)}.call(H)),Lt.exports}var Pt={exports:{}},tr;function hn(){return tr||(tr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),Pt.exports=function(o){n(i,o);function i(s,a){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=e.Text,this.value=this.stringify.text(a)}return Object.defineProperty(i.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(i.prototype,"wholeText",{get:function(){var s,a,u;for(u="",a=this.previousSibling;a;)u=a.data+u,a=a.previousSibling;for(u+=this.data,s=this.nextSibling;s;)u=u+s.data,s=s.nextSibling;return u}}),i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.text(this,this.options.writer.filterOptions(s))},i.prototype.splitText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i.prototype.replaceWholeText=function(s){throw new Error("This DOM method is not implemented."+this.debugInfo())},i}(t)}.call(H)),Pt.exports}var _t={exports:{}},nr;function dn(){return nr||(nr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;e=ee(),t=Qe(),_t.exports=function(o){n(i,o);function i(s,a,u){if(i.__super__.constructor.call(this,s),a==null)throw new Error("Missing instruction target. "+this.debugInfo());this.type=e.ProcessingInstruction,this.target=this.stringify.insTarget(a),this.name=this.target,u&&(this.value=this.stringify.insValue(u))}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(s))},i.prototype.isEqualNode=function(s){return!(!i.__super__.isEqualNode.apply(this,arguments).isEqualNode(s)||s.target!==this.target)},i}(t)}.call(H)),_t.exports}var Dt={exports:{}},rr;function Qr(){return rr||(rr=1,function(){var e,t,n=function(o,i){for(var s in i)r.call(i,s)&&(o[s]=i[s]);function a(){this.constructor=o}return a.prototype=i.prototype,o.prototype=new a,o.__super__=i.prototype,o},r={}.hasOwnProperty;t=fe(),e=ee(),Dt.exports=function(o){n(i,o);function i(s){i.__super__.constructor.call(this,s),this.type=e.Dummy}return i.prototype.clone=function(){return Object.create(this)},i.prototype.toString=function(s){return""},i}(t)}.call(H)),Dt.exports}var Mt={exports:{}},ir;function uo(){return ir||(ir=1,function(){Mt.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(H)),Mt.exports}var St={exports:{}},sr;function co(){return sr||(sr=1,function(){St.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(H)),St.exports}var or;function fe(){return or||(or=1,function(){var e,t,n,r,o,i,s,a,u,l,f,p,d,b,E,v,y,D={}.hasOwnProperty;y=Ee(),v=y.isObject,E=y.isFunction,b=y.isEmpty,d=y.getValue,a=null,n=null,r=null,o=null,i=null,f=null,p=null,l=null,s=null,t=null,u=null,e=null,dt.exports=function(){function T(h){this.parent=h,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,a||(a=nn(),n=rn(),r=sn(),o=on(),i=fn(),f=pn(),p=hn(),l=dn(),s=Qr(),t=ee(),u=uo(),tn(),e=co())}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 u(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 h;return h=this.parent.children.indexOf(this),this.parent.children[h-1]||null}}),Object.defineProperty(T.prototype,"nextSibling",{get:function(){var h;return h=this.parent.children.indexOf(this),this.parent.children[h+1]||null}}),Object.defineProperty(T.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(T.prototype,"textContent",{get:function(){var h,w,I,P,L;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(L="",P=this.children,w=0,I=P.length;w<I;w++)h=P[w],h.textContent&&(L+=h.textContent);return L}else return null},set:function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),T.prototype.setParent=function(h){var w,I,P,L,S;for(this.parent=h,h&&(this.options=h.options,this.stringify=h.stringify),L=this.children,S=[],I=0,P=L.length;I<P;I++)w=L[I],S.push(w.setParent(this));return S},T.prototype.element=function(h,w,I){var P,L,S,c,_,F,k,q,R,V,G;if(F=null,w===null&&I==null&&(R=[{},null],w=R[0],I=R[1]),w==null&&(w={}),w=d(w),v(w)||(V=[w,I],I=V[0],w=V[1]),h!=null&&(h=d(h)),Array.isArray(h))for(S=0,k=h.length;S<k;S++)L=h[S],F=this.element(L);else if(E(h))F=this.element(h.apply());else if(v(h)){for(_ in h)if(D.call(h,_))if(G=h[_],E(G)&&(G=G.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&_.indexOf(this.stringify.convertAttKey)===0)F=this.attribute(_.substr(this.stringify.convertAttKey.length),G);else if(!this.options.separateArrayItems&&Array.isArray(G)&&b(G))F=this.dummy();else if(v(G)&&b(G))F=this.element(_);else if(!this.options.keepNullNodes&&G==null)F=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(G))for(c=0,q=G.length;c<q;c++)L=G[c],P={},P[_]=L,F=this.element(P);else v(G)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&_.indexOf(this.stringify.convertTextKey)===0?F=this.element(G):(F=this.element(_),F.element(G)):F=this.element(_,G)}else!this.options.keepNullNodes&&I===null?F=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&h.indexOf(this.stringify.convertTextKey)===0?F=this.text(I):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&h.indexOf(this.stringify.convertCDataKey)===0?F=this.cdata(I):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&h.indexOf(this.stringify.convertCommentKey)===0?F=this.comment(I):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&h.indexOf(this.stringify.convertRawKey)===0?F=this.raw(I):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&h.indexOf(this.stringify.convertPIKey)===0?F=this.instruction(h.substr(this.stringify.convertPIKey.length),I):F=this.node(h,w,I);if(F==null)throw new Error("Could not create any elements with: "+h+". "+this.debugInfo());return F},T.prototype.insertBefore=function(h,w,I){var P,L,S,c,_;if(h?.type)return S=h,c=w,S.setParent(this),c?(L=children.indexOf(c),_=children.splice(L),children.push(S),Array.prototype.push.apply(children,_)):children.push(S),S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return L=this.parent.children.indexOf(this),_=this.parent.children.splice(L),P=this.parent.element(h,w,I),Array.prototype.push.apply(this.parent.children,_),P},T.prototype.insertAfter=function(h,w,I){var P,L,S;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(h));return L=this.parent.children.indexOf(this),S=this.parent.children.splice(L+1),P=this.parent.element(h,w,I),Array.prototype.push.apply(this.parent.children,S),P},T.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},T.prototype.node=function(h,w,I){var P,L;return h!=null&&(h=d(h)),w||(w={}),w=d(w),v(w)||(L=[w,I],I=L[0],w=L[1]),P=new a(this,h,w),I!=null&&P.text(I),this.children.push(P),P},T.prototype.text=function(h){var w;return v(h)&&this.element(h),w=new p(this,h),this.children.push(w),this},T.prototype.cdata=function(h){var w;return w=new n(this,h),this.children.push(w),this},T.prototype.comment=function(h){var w;return w=new r(this,h),this.children.push(w),this},T.prototype.commentBefore=function(h){var w,I;return w=this.parent.children.indexOf(this),I=this.parent.children.splice(w),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,I),this},T.prototype.commentAfter=function(h){var w,I;return w=this.parent.children.indexOf(this),I=this.parent.children.splice(w+1),this.parent.comment(h),Array.prototype.push.apply(this.parent.children,I),this},T.prototype.raw=function(h){var w;return w=new f(this,h),this.children.push(w),this},T.prototype.dummy=function(){var h;return h=new s(this),h},T.prototype.instruction=function(h,w){var I,P,L,S,c;if(h!=null&&(h=d(h)),w!=null&&(w=d(w)),Array.isArray(h))for(S=0,c=h.length;S<c;S++)I=h[S],this.instruction(I);else if(v(h))for(I in h)D.call(h,I)&&(P=h[I],this.instruction(I,P));else E(w)&&(w=w.apply()),L=new l(this,h,w),this.children.push(L);return this},T.prototype.instructionBefore=function(h,w){var I,P;return I=this.parent.children.indexOf(this),P=this.parent.children.splice(I),this.parent.instruction(h,w),Array.prototype.push.apply(this.parent.children,P),this},T.prototype.instructionAfter=function(h,w){var I,P;return I=this.parent.children.indexOf(this),P=this.parent.children.splice(I+1),this.parent.instruction(h,w),Array.prototype.push.apply(this.parent.children,P),this},T.prototype.declaration=function(h,w,I){var P,L;return P=this.document(),L=new o(P,h,w,I),P.children.length===0?P.children.unshift(L):P.children[0].type===t.Declaration?P.children[0]=L:P.children.unshift(L),P.root()||P},T.prototype.dtd=function(h,w){var I,P,L,S,c,_,F,k,q,R;for(P=this.document(),L=new i(P,h,w),q=P.children,S=c=0,F=q.length;c<F;S=++c)if(I=q[S],I.type===t.DocType)return P.children[S]=L,L;for(R=P.children,S=_=0,k=R.length;_<k;S=++_)if(I=R[S],I.isRoot)return P.children.splice(S,0,L),L;return P.children.push(L),L},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 h;for(h=this;h;){if(h.type===t.Document)return h.rootObject;if(h.isRoot)return h;h=h.parent}},T.prototype.document=function(){var h;for(h=this;h;){if(h.type===t.Document)return h;h=h.parent}},T.prototype.end=function(h){return this.document().end(h)},T.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]},T.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]},T.prototype.importDocument=function(h){var w;return w=h.root().clone(),w.parent=this,w.isRoot=!1,this.children.push(w),this},T.prototype.debugInfo=function(h){var w,I;return h=h||this.name,h==null&&!((w=this.parent)!=null&&w.name)?"":h==null?"parent: <"+this.parent.name+">":(I=this.parent)!=null&&I.name?"node: <"+h+">, parent: <"+this.parent.name+">":"node: <"+h+">"},T.prototype.ele=function(h,w,I){return this.element(h,w,I)},T.prototype.nod=function(h,w,I){return this.node(h,w,I)},T.prototype.txt=function(h){return this.text(h)},T.prototype.dat=function(h){return this.cdata(h)},T.prototype.com=function(h){return this.comment(h)},T.prototype.ins=function(h,w){return this.instruction(h,w)},T.prototype.doc=function(){return this.document()},T.prototype.dec=function(h,w,I){return this.declaration(h,w,I)},T.prototype.e=function(h,w,I){return this.element(h,w,I)},T.prototype.n=function(h,w,I){return this.node(h,w,I)},T.prototype.t=function(h){return this.text(h)},T.prototype.d=function(h){return this.cdata(h)},T.prototype.c=function(h){return this.comment(h)},T.prototype.r=function(h){return this.raw(h)},T.prototype.i=function(h,w){return this.instruction(h,w)},T.prototype.u=function(){return this.up()},T.prototype.importXMLBuilder=function(h){return this.importDocument(h)},T.prototype.replaceChild=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.removeChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.appendChild=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.hasChildNodes=function(){return this.children.length!==0},T.prototype.cloneNode=function(h){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(h,w){return!0},T.prototype.hasAttributes=function(){return this.attribs.length!==0},T.prototype.compareDocumentPosition=function(h){var w,I;return w=this,w===h?0:this.document()!==h.document()?(I=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?I|=e.Preceding:I|=e.Following,I):w.isAncestor(h)?e.Contains|e.Preceding:w.isDescendant(h)?e.Contains|e.Following:w.isPreceding(h)?e.Preceding:e.Following},T.prototype.isSameNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.lookupPrefix=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.isDefaultNamespace=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.lookupNamespaceURI=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.isEqualNode=function(h){var w,I,P;if(h.nodeType!==this.nodeType||h.children.length!==this.children.length)return!1;for(w=I=0,P=this.children.length-1;0<=P?I<=P:I>=P;w=0<=P?++I:--I)if(!this.children[w].isEqualNode(h.children[w]))return!1;return!0},T.prototype.getFeature=function(h,w){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.setUserData=function(h,w,I){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.getUserData=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},T.prototype.contains=function(h){return h?h===this||this.isDescendant(h):!1},T.prototype.isDescendant=function(h){var w,I,P,L,S;for(S=this.children,P=0,L=S.length;P<L;P++)if(w=S[P],h===w||(I=w.isDescendant(h),I))return!0;return!1},T.prototype.isAncestor=function(h){return h.isDescendant(this)},T.prototype.isPreceding=function(h){var w,I;return w=this.treePosition(h),I=this.treePosition(this),w===-1||I===-1?!1:w<I},T.prototype.isFollowing=function(h){var w,I;return w=this.treePosition(h),I=this.treePosition(this),w===-1||I===-1?!1:w>I},T.prototype.treePosition=function(h){var w,I;return I=0,w=!1,this.foreachTreeNode(this.document(),function(P){if(I++,!w&&P===h)return w=!0}),w?I:-1},T.prototype.foreachTreeNode=function(h,w){var I,P,L,S,c;for(h||(h=this.document()),S=h.children,P=0,L=S.length;P<L;P++){if(I=S[P],c=w(I))return c;if(c=this.foreachTreeNode(I,w),c)return c}},T}()}.call(H)),dt.exports}var Ct={exports:{}},ar;function Jr(){return ar||(ar=1,function(){var e=function(n,r){return function(){return n.apply(r,arguments)}},t={}.hasOwnProperty;Ct.exports=function(){function n(r){this.assertLegalName=e(this.assertLegalName,this),this.assertLegalChar=e(this.assertLegalChar,this);var o,i,s;r||(r={}),this.options=r,this.options.version||(this.options.version="1.0"),i=r.stringify||{};for(o in i)t.call(i,o)&&(s=i[o],this[o]=s)}return n.prototype.name=function(r){return this.options.noValidation?r:this.assertLegalName(""+r||"")},n.prototype.text=function(r){return this.options.noValidation?r:this.assertLegalChar(this.textEscape(""+r||""))},n.prototype.cdata=function(r){return this.options.noValidation?r:(r=""+r||"",r=r.replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(r))},n.prototype.comment=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/--/))throw new Error("Comment text cannot contain double-hypen: "+r);return this.assertLegalChar(r)},n.prototype.raw=function(r){return this.options.noValidation?r:""+r||""},n.prototype.attValue=function(r){return this.options.noValidation?r:this.assertLegalChar(this.attEscape(r=""+r||""))},n.prototype.insTarget=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.insValue=function(r){if(this.options.noValidation)return r;if(r=""+r||"",r.match(/\?>/))throw new Error("Invalid processing instruction value: "+r);return this.assertLegalChar(r)},n.prototype.xmlVersion=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/1\.[0-9]+/))throw new Error("Invalid version number: "+r);return r},n.prototype.xmlEncoding=function(r){if(this.options.noValidation)return r;if(r=""+r||"",!r.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+r);return this.assertLegalChar(r)},n.prototype.xmlStandalone=function(r){return this.options.noValidation?r:r?"yes":"no"},n.prototype.dtdPubID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdSysID=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdElementValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttType=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdAttDefault=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdEntityValue=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.dtdNData=function(r){return this.options.noValidation?r:this.assertLegalChar(""+r||"")},n.prototype.convertAttKey="@",n.prototype.convertPIKey="?",n.prototype.convertTextKey="#text",n.prototype.convertCDataKey="#cdata",n.prototype.convertCommentKey="#comment",n.prototype.convertRawKey="#raw",n.prototype.assertLegalChar=function(r){var o,i;if(this.options.noValidation)return r;if(o="",this.options.version==="1.0"){if(o=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o))throw new Error("Invalid character in string: "+r+" at index "+i.index)}else if(this.options.version==="1.1"&&(o=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,i=r.match(o)))throw new Error("Invalid character in string: "+r+" at index "+i.index);return r},n.prototype.assertLegalName=function(r){var o;if(this.options.noValidation)return r;if(this.assertLegalChar(r),o=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!r.match(o))throw new Error("Invalid character in name");return r},n.prototype.textEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},n.prototype.attEscape=function(r){var o;return this.options.noValidation?r:(o=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,r.replace(o,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},n}()}.call(H)),Ct.exports}var Ft={exports:{}},jt={exports:{}},kt={exports:{}},ur;function Je(){return ur||(ur=1,function(){kt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(H)),kt.exports}var cr;function Zr(){return cr||(cr=1,function(){var e,t,n,r={}.hasOwnProperty;n=Ee().assign,e=ee(),on(),fn(),rn(),sn(),nn(),pn(),hn(),dn(),Qr(),an(),cn(),un(),ln(),t=Je(),jt.exports=function(){function o(i){var s,a,u;i||(i={}),this.options=i,a=i.writer||{};for(s in a)r.call(a,s)&&(u=a[s],this["_"+s]=this[s],this[s]=u)}return o.prototype.filterOptions=function(i){var s,a,u,l,f,p,d,b;return i||(i={}),i=n({},this.options,i),s={writer:this},s.pretty=i.pretty||!1,s.allowEmpty=i.allowEmpty||!1,s.indent=(a=i.indent)!=null?a:" ",s.newline=(u=i.newline)!=null?u:`
68
+ `,s.offset=(l=i.offset)!=null?l:0,s.dontPrettyTextNodes=(f=(p=i.dontPrettyTextNodes)!=null?p:i.dontprettytextnodes)!=null?f:0,s.spaceBeforeSlash=(d=(b=i.spaceBeforeSlash)!=null?b:i.spacebeforeslash)!=null?d:"",s.spaceBeforeSlash===!0&&(s.spaceBeforeSlash=" "),s.suppressPrettyCount=0,s.user={},s.state=t.None,s},o.prototype.indent=function(i,s,a){var u;return!s.pretty||s.suppressPrettyCount?"":s.pretty&&(u=(a||0)+s.offset+1,u>0)?new Array(u).join(s.indent):""},o.prototype.endline=function(i,s,a){return!s.pretty||s.suppressPrettyCount?"":s.newline},o.prototype.attribute=function(i,s,a){var u;return this.openAttribute(i,s,a),u=" "+i.name+'="'+i.value+'"',this.closeAttribute(i,s,a),u},o.prototype.cdata=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<![CDATA[",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+="]]>"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.comment=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!-- ",s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=" -->"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.declaration=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?xml",s.state=t.InsideTag,u+=' version="'+i.version+'"',i.encoding!=null&&(u+=' encoding="'+i.encoding+'"'),i.standalone!=null&&(u+=' standalone="'+i.standalone+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.docType=function(i,s,a){var u,l,f,p,d;if(a||(a=0),this.openNode(i,s,a),s.state=t.OpenTag,p=this.indent(i,s,a),p+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?p+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(p+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(p+=" [",p+=this.endline(i,s,a),s.state=t.InsideTag,d=i.children,l=0,f=d.length;l<f;l++)u=d[l],p+=this.writeChildNode(u,s,a+1);s.state=t.CloseTag,p+="]"}return s.state=t.CloseTag,p+=s.spaceBeforeSlash+">",p+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),p},o.prototype.element=function(i,s,a){var u,l,f,p,d,b,E,v,y,D,T,h,w,I;a||(a=0),D=!1,T="",this.openNode(i,s,a),s.state=t.OpenTag,T+=this.indent(i,s,a)+"<"+i.name,h=i.attribs;for(y in h)r.call(h,y)&&(u=h[y],T+=this.attribute(u,s,a));if(f=i.children.length,p=f===0?null:i.children[0],f===0||i.children.every(function(P){return(P.type===e.Text||P.type===e.Raw)&&P.value===""}))s.allowEmpty?(T+=">",s.state=t.CloseTag,T+="</"+i.name+">"+this.endline(i,s,a)):(s.state=t.CloseTag,T+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&f===1&&(p.type===e.Text||p.type===e.Raw)&&p.value!=null)T+=">",s.state=t.InsideTag,s.suppressPrettyCount++,D=!0,T+=this.writeChildNode(p,s,a+1),s.suppressPrettyCount--,D=!1,s.state=t.CloseTag,T+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(w=i.children,d=0,E=w.length;d<E;d++)if(l=w[d],(l.type===e.Text||l.type===e.Raw)&&l.value!=null){s.suppressPrettyCount++,D=!0;break}}for(T+=">"+this.endline(i,s,a),s.state=t.InsideTag,I=i.children,b=0,v=I.length;b<v;b++)l=I[b],T+=this.writeChildNode(l,s,a+1);s.state=t.CloseTag,T+=this.indent(i,s,a)+"</"+i.name+">",D&&s.suppressPrettyCount--,T+=this.endline(i,s,a),s.state=t.None}return this.closeNode(i,s,a),T},o.prototype.writeChildNode=function(i,s,a){switch(i.type){case e.CData:return this.cdata(i,s,a);case e.Comment:return this.comment(i,s,a);case e.Element:return this.element(i,s,a);case e.Raw:return this.raw(i,s,a);case e.Text:return this.text(i,s,a);case e.ProcessingInstruction:return this.processingInstruction(i,s,a);case e.Dummy:return"";case e.Declaration:return this.declaration(i,s,a);case e.DocType:return this.docType(i,s,a);case e.AttributeDeclaration:return this.dtdAttList(i,s,a);case e.ElementDeclaration:return this.dtdElement(i,s,a);case e.EntityDeclaration:return this.dtdEntity(i,s,a);case e.NotationDeclaration:return this.dtdNotation(i,s,a);default:throw new Error("Unknown XML node type: "+i.constructor.name)}},o.prototype.processingInstruction=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<?",s.state=t.InsideTag,u+=i.target,i.value&&(u+=" "+i.value),s.state=t.CloseTag,u+=s.spaceBeforeSlash+"?>",u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.raw=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.text=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a),s.state=t.InsideTag,u+=i.value,s.state=t.CloseTag,u+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdAttList=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ATTLIST",s.state=t.InsideTag,u+=" "+i.elementName+" "+i.attributeName+" "+i.attributeType,i.defaultValueType!=="#DEFAULT"&&(u+=" "+i.defaultValueType),i.defaultValue&&(u+=' "'+i.defaultValue+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdElement=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ELEMENT",s.state=t.InsideTag,u+=" "+i.name+" "+i.value,s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdEntity=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!ENTITY",s.state=t.InsideTag,i.pe&&(u+=" %"),u+=" "+i.name,i.value?u+=' "'+i.value+'"':(i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),i.nData&&(u+=" NDATA "+i.nData)),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.dtdNotation=function(i,s,a){var u;return this.openNode(i,s,a),s.state=t.OpenTag,u=this.indent(i,s,a)+"<!NOTATION",s.state=t.InsideTag,u+=" "+i.name,i.pubID&&i.sysID?u+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.pubID?u+=' PUBLIC "'+i.pubID+'"':i.sysID&&(u+=' SYSTEM "'+i.sysID+'"'),s.state=t.CloseTag,u+=s.spaceBeforeSlash+">"+this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),u},o.prototype.openNode=function(i,s,a){},o.prototype.closeNode=function(i,s,a){},o.prototype.openAttribute=function(i,s,a){},o.prototype.closeAttribute=function(i,s,a){},o}()}.call(H)),jt.exports}var lr;function gn(){return lr||(lr=1,function(){var e,t=function(r,o){for(var i in o)n.call(o,i)&&(r[i]=o[i]);function s(){this.constructor=r}return s.prototype=o.prototype,r.prototype=new s,r.__super__=o.prototype,r},n={}.hasOwnProperty;e=Zr(),Ft.exports=function(r){t(o,r);function o(i){o.__super__.constructor.call(this,i)}return o.prototype.document=function(i,s){var a,u,l,f,p;for(s=this.filterOptions(s),f="",p=i.children,u=0,l=p.length;u<l;u++)a=p[u],f+=this.writeChildNode(a,s,0);return s.pretty&&f.slice(-s.newline.length)===s.newline&&(f=f.slice(0,-s.newline.length)),f},o}(e)}.call(H)),Ft.exports}var fr;function Kr(){return fr||(fr=1,function(){var e,t,n,r,o,i,s,a=function(l,f){for(var p in f)u.call(f,p)&&(l[p]=f[p]);function d(){this.constructor=l}return d.prototype=f.prototype,l.prototype=new d,l.__super__=f.prototype,l},u={}.hasOwnProperty;s=Ee().isPlainObject,n=Yr(),t=ao(),r=fe(),e=ee(),i=Jr(),o=gn(),lt.exports=function(l){a(f,l);function f(p){f.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,p||(p={}),p.writer||(p.writer=new o),this.options=p,this.stringify=new i(p)}return Object.defineProperty(f.prototype,"implementation",{value:new n}),Object.defineProperty(f.prototype,"doctype",{get:function(){var p,d,b,E;for(E=this.children,d=0,b=E.length;d<b;d++)if(p=E[d],p.type===e.DocType)return p;return null}}),Object.defineProperty(f.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(f.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(f.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(f.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(f.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(f.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(f.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(f.prototype,"origin",{get:function(){return null}}),Object.defineProperty(f.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(f.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(f.prototype,"contentType",{get:function(){return null}}),f.prototype.end=function(p){var d;return d={},p?s(p)&&(d=p,p=this.options.writer):p=this.options.writer,p.document(this,p.filterOptions(d))},f.prototype.toString=function(p){return this.options.writer.document(this,this.options.writer.filterOptions(p))},f.prototype.createElement=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createTextNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createComment=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createCDATASection=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createProcessingInstruction=function(p,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createAttribute=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createEntityReference=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.importNode=function(p,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createElementNS=function(p,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createAttributeNS=function(p,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagNameNS=function(p,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementById=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.adoptNode=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.renameNode=function(p,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByClassName=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createEvent=function(p){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createNodeIterator=function(p,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.createTreeWalker=function(p,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f}(r)}.call(H)),lt.exports}var Bt={exports:{}},pr;function lo(){return pr||(pr=1,function(){var e,t,n,r,o,i,s,a,u,l,f,p,d,b,E,v,y,D,T,h,w,I,P,L={}.hasOwnProperty;P=Ee(),w=P.isObject,h=P.isFunction,I=P.isPlainObject,T=P.getValue,e=ee(),p=Kr(),d=nn(),r=rn(),o=sn(),E=pn(),D=hn(),b=dn(),l=on(),f=fn(),i=an(),a=un(),s=cn(),u=ln(),n=zr(),y=Jr(),v=gn(),t=Je(),Bt.exports=function(){function S(c,_,F){var k;this.name="?xml",this.type=e.Document,c||(c={}),k={},c.writer?I(c.writer)&&(k=c.writer,c.writer=new v):c.writer=new v,this.options=c,this.writer=c.writer,this.writerOptions=this.writer.filterOptions(k),this.stringify=new y(c),this.onDataCallback=_||function(){},this.onEndCallback=F||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return S.prototype.createChildNode=function(c){var _,F,k,q,R,V,G,W;switch(c.type){case e.CData:this.cdata(c.value);break;case e.Comment:this.comment(c.value);break;case e.Element:k={},G=c.attribs;for(F in G)L.call(G,F)&&(_=G[F],k[F]=_.value);this.node(c.name,k);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(c.value);break;case e.Text:this.text(c.value);break;case e.ProcessingInstruction:this.instruction(c.target,c.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+c.constructor.name)}for(W=c.children,R=0,V=W.length;R<V;R++)q=W[R],this.createChildNode(q),q.type===e.Element&&this.up();return this},S.prototype.dummy=function(){return this},S.prototype.node=function(c,_,F){var k;if(c==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(c));return this.openCurrent(),c=T(c),_==null&&(_={}),_=T(_),w(_)||(k=[_,F],F=k[0],_=k[1]),this.currentNode=new d(this,c,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},S.prototype.element=function(c,_,F){var k,q,R,V,G,W;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(c)||w(c)||h(c))for(V=this.options.noValidation,this.options.noValidation=!0,W=new p(this.options).element("TEMP_ROOT"),W.element(c),this.options.noValidation=V,G=W.children,q=0,R=G.length;q<R;q++)k=G[q],this.createChildNode(k),k.type===e.Element&&this.up();else this.node(c,_,F);return this},S.prototype.attribute=function(c,_){var F,k;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(c));if(c!=null&&(c=T(c)),w(c))for(F in c)L.call(c,F)&&(k=c[F],this.attribute(F,k));else h(_)&&(_=_.apply()),this.options.keepNullAttributes&&_==null?this.currentNode.attribs[c]=new n(this,c,""):_!=null&&(this.currentNode.attribs[c]=new n(this,c,_));return this},S.prototype.text=function(c){var _;return this.openCurrent(),_=new D(this,c),this.onData(this.writer.text(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.cdata=function(c){var _;return this.openCurrent(),_=new r(this,c),this.onData(this.writer.cdata(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.comment=function(c){var _;return this.openCurrent(),_=new o(this,c),this.onData(this.writer.comment(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.raw=function(c){var _;return this.openCurrent(),_=new E(this,c),this.onData(this.writer.raw(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.instruction=function(c,_){var F,k,q,R,V;if(this.openCurrent(),c!=null&&(c=T(c)),_!=null&&(_=T(_)),Array.isArray(c))for(F=0,R=c.length;F<R;F++)k=c[F],this.instruction(k);else if(w(c))for(k in c)L.call(c,k)&&(q=c[k],this.instruction(k,q));else h(_)&&(_=_.apply()),V=new b(this,c,_),this.onData(this.writer.processingInstruction(V,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},S.prototype.declaration=function(c,_,F){var k;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return k=new l(this,c,_,F),this.onData(this.writer.declaration(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.doctype=function(c,_,F){if(this.openCurrent(),c==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 f(this,_,F),this.currentNode.rootNodeName=c,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},S.prototype.dtdElement=function(c,_){var F;return this.openCurrent(),F=new s(this,c,_),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.attList=function(c,_,F,k,q){var R;return this.openCurrent(),R=new i(this,c,_,F,k,q),this.onData(this.writer.dtdAttList(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.entity=function(c,_){var F;return this.openCurrent(),F=new a(this,!1,c,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.pEntity=function(c,_){var F;return this.openCurrent(),F=new a(this,!0,c,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.notation=function(c,_){var F;return this.openCurrent(),F=new u(this,c,_),this.onData(this.writer.dtdNotation(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},S.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},S.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},S.prototype.openNode=function(c){var _,F,k,q;if(!c.isOpen){if(!this.root&&this.currentLevel===0&&c.type===e.Element&&(this.root=c),F="",c.type===e.Element){this.writerOptions.state=t.OpenTag,F=this.writer.indent(c,this.writerOptions,this.currentLevel)+"<"+c.name,q=c.attribs;for(k in q)L.call(q,k)&&(_=q[k],F+=this.writer.attribute(_,this.writerOptions,this.currentLevel));F+=(c.children?">":"/>")+this.writer.endline(c,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,F=this.writer.indent(c,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+c.rootNodeName,c.pubID&&c.sysID?F+=' PUBLIC "'+c.pubID+'" "'+c.sysID+'"':c.sysID&&(F+=' SYSTEM "'+c.sysID+'"'),c.children?(F+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,F+=">"),F+=this.writer.endline(c,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),c.isOpen=!0}},S.prototype.closeNode=function(c){var _;if(!c.isClosed)return _="",this.writerOptions.state=t.CloseTag,c.type===e.Element?_=this.writer.indent(c,this.writerOptions,this.currentLevel)+"</"+c.name+">"+this.writer.endline(c,this.writerOptions,this.currentLevel):_=this.writer.indent(c,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(c,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(_,this.currentLevel),c.isClosed=!0},S.prototype.onData=function(c,_){return this.documentStarted=!0,this.onDataCallback(c,_+1)},S.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},S.prototype.debugInfo=function(c){return c==null?"":"node: <"+c+">"},S.prototype.ele=function(){return this.element.apply(this,arguments)},S.prototype.nod=function(c,_,F){return this.node(c,_,F)},S.prototype.txt=function(c){return this.text(c)},S.prototype.dat=function(c){return this.cdata(c)},S.prototype.com=function(c){return this.comment(c)},S.prototype.ins=function(c,_){return this.instruction(c,_)},S.prototype.dec=function(c,_,F){return this.declaration(c,_,F)},S.prototype.dtd=function(c,_,F){return this.doctype(c,_,F)},S.prototype.e=function(c,_,F){return this.element(c,_,F)},S.prototype.n=function(c,_,F){return this.node(c,_,F)},S.prototype.t=function(c){return this.text(c)},S.prototype.d=function(c){return this.cdata(c)},S.prototype.c=function(c){return this.comment(c)},S.prototype.r=function(c){return this.raw(c)},S.prototype.i=function(c,_){return this.instruction(c,_)},S.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},S.prototype.ent=function(c,_){return this.entity(c,_)},S.prototype.pent=function(c,_){return this.pEntity(c,_)},S.prototype.not=function(c,_){return this.notation(c,_)},S}()}.call(H)),Bt.exports}var Rt={exports:{}},hr;function fo(){return hr||(hr=1,function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;e=ee(),n=Zr(),t=Je(),Rt.exports=function(i){r(s,i);function s(a,u){this.stream=a,s.__super__.constructor.call(this,u)}return s.prototype.endline=function(a,u,l){return a.isLastRootNode&&u.state===t.CloseTag?"":s.__super__.endline.call(this,a,u,l)},s.prototype.document=function(a,u){var l,f,p,d,b,E,v,y,D;for(v=a.children,f=p=0,b=v.length;p<b;f=++p)l=v[f],l.isLastRootNode=f===a.children.length-1;for(u=this.filterOptions(u),y=a.children,D=[],d=0,E=y.length;d<E;d++)l=y[d],D.push(this.writeChildNode(l,u,0));return D},s.prototype.attribute=function(a,u,l){return this.stream.write(s.__super__.attribute.call(this,a,u,l))},s.prototype.cdata=function(a,u,l){return this.stream.write(s.__super__.cdata.call(this,a,u,l))},s.prototype.comment=function(a,u,l){return this.stream.write(s.__super__.comment.call(this,a,u,l))},s.prototype.declaration=function(a,u,l){return this.stream.write(s.__super__.declaration.call(this,a,u,l))},s.prototype.docType=function(a,u,l){var f,p,d,b;if(l||(l=0),this.openNode(a,u,l),u.state=t.OpenTag,this.stream.write(this.indent(a,u,l)),this.stream.write("<!DOCTYPE "+a.root().name),a.pubID&&a.sysID?this.stream.write(' PUBLIC "'+a.pubID+'" "'+a.sysID+'"'):a.sysID&&this.stream.write(' SYSTEM "'+a.sysID+'"'),a.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(a,u,l)),u.state=t.InsideTag,b=a.children,p=0,d=b.length;p<d;p++)f=b[p],this.writeChildNode(f,u,l+1);u.state=t.CloseTag,this.stream.write("]")}return u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+">"),this.stream.write(this.endline(a,u,l)),u.state=t.None,this.closeNode(a,u,l)},s.prototype.element=function(a,u,l){var f,p,d,b,E,v,y,D,T;l||(l=0),this.openNode(a,u,l),u.state=t.OpenTag,this.stream.write(this.indent(a,u,l)+"<"+a.name),D=a.attribs;for(y in D)o.call(D,y)&&(f=D[y],this.attribute(f,u,l));if(d=a.children.length,b=d===0?null:a.children[0],d===0||a.children.every(function(h){return(h.type===e.Text||h.type===e.Raw)&&h.value===""}))u.allowEmpty?(this.stream.write(">"),u.state=t.CloseTag,this.stream.write("</"+a.name+">")):(u.state=t.CloseTag,this.stream.write(u.spaceBeforeSlash+"/>"));else if(u.pretty&&d===1&&(b.type===e.Text||b.type===e.Raw)&&b.value!=null)this.stream.write(">"),u.state=t.InsideTag,u.suppressPrettyCount++,this.writeChildNode(b,u,l+1),u.suppressPrettyCount--,u.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,l)),u.state=t.InsideTag,T=a.children,E=0,v=T.length;E<v;E++)p=T[E],this.writeChildNode(p,u,l+1);u.state=t.CloseTag,this.stream.write(this.indent(a,u,l)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,l)),u.state=t.None,this.closeNode(a,u,l)},s.prototype.processingInstruction=function(a,u,l){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,l))},s.prototype.raw=function(a,u,l){return this.stream.write(s.__super__.raw.call(this,a,u,l))},s.prototype.text=function(a,u,l){return this.stream.write(s.__super__.text.call(this,a,u,l))},s.prototype.dtdAttList=function(a,u,l){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,l))},s.prototype.dtdElement=function(a,u,l){return this.stream.write(s.__super__.dtdElement.call(this,a,u,l))},s.prototype.dtdEntity=function(a,u,l){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,l))},s.prototype.dtdNotation=function(a,u,l){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,l))},s}(n)}.call(H)),Rt.exports}var dr;function po(){return dr||(dr=1,function(){var e,t,n,r,o,i,s,a,u,l;l=Ee(),a=l.assign,u=l.isFunction,n=Yr(),r=Kr(),o=lo(),s=gn(),i=fo(),e=ee(),t=Je(),ye.create=function(f,p,d,b){var E,v;if(f==null)throw new Error("Root element needs a name.");return b=a({},p,d,b),E=new r(b),v=E.element(f),b.headless||(E.declaration(b),(b.pubID!=null||b.sysID!=null)&&E.dtd(b)),v},ye.begin=function(f,p,d){var b;return u(f)&&(b=[f,p],p=b[0],d=b[1],f={}),p?new o(f,p,d):new r(f)},ye.stringWriter=function(f){return new s(f)},ye.streamWriter=function(f,p){return new i(f,p)},ye.implementation=new n,ye.nodeType=e,ye.writerState=t}.call(H)),ye}var gr;function ho(){return gr||(gr=1,function(){var e,t,n,r,o,i={}.hasOwnProperty;e=po(),t=en().defaults,r=function(s){return typeof s=="string"&&(s.indexOf("&")>=0||s.indexOf(">")>=0||s.indexOf("<")>=0)},o=function(s){return"<![CDATA["+n(s)+"]]>"},n=function(s){return s.replace("]]>","]]]]><![CDATA[>")},ut.Builder=function(){function s(a){var u,l,f;this.options={},l=t["0.2"];for(u in l)i.call(l,u)&&(f=l[u],this.options[u]=f);for(u in a)i.call(a,u)&&(f=a[u],this.options[u]=f)}return s.prototype.buildObject=function(a){var u,l,f,p,d;return u=this.options.attrkey,l=this.options.charkey,Object.keys(a).length===1&&this.options.rootName===t["0.2"].rootName?(d=Object.keys(a)[0],a=a[d]):d=this.options.rootName,f=function(b){return function(E,v){var y,D,T,h,w,I;if(typeof v!="object")b.options.cdata&&r(v)?E.raw(o(v)):E.txt(v);else if(Array.isArray(v)){for(h in v)if(i.call(v,h)){D=v[h];for(w in D)T=D[w],E=f(E.ele(w),T).up()}}else for(w in v)if(i.call(v,w))if(D=v[w],w===u){if(typeof D=="object")for(y in D)I=D[y],E=E.att(y,I)}else if(w===l)b.options.cdata&&r(D)?E=E.raw(o(D)):E=E.txt(D);else if(Array.isArray(D))for(h in D)i.call(D,h)&&(T=D[h],typeof T=="string"?b.options.cdata&&r(T)?E=E.ele(w).raw(o(T)).up():E=E.ele(w,T).up():E=f(E.ele(w),T).up());else typeof D=="object"?E=f(E.ele(w),D).up():typeof D=="string"&&b.options.cdata&&r(D)?E=E.ele(w).raw(o(D)).up():(D==null&&(D=""),E=E.ele(w,D.toString()).up());return E}}(this),p=e.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),f(p,a).end(this.options.renderOpts)},s}()}.call(H)),ut}var Xt={},Ut={},mr;function go(){return mr||(mr=1,function(e){(function(t){t.parser=function(m,g){return new r(m,g)},t.SAXParser=r,t.SAXStream=f,t.createStream=l,t.MAX_BUFFER_LENGTH=64*1024;var n=["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 r(m,g){if(!(this instanceof r))return new r(m,g);var C=this;i(C),C.q=C.c="",C.bufferCheckPosition=t.MAX_BUFFER_LENGTH,C.opt=g||{},C.opt.lowercase=C.opt.lowercase||C.opt.lowercasetags,C.looseCase=C.opt.lowercase?"toLowerCase":"toUpperCase",C.tags=[],C.closed=C.closedRoot=C.sawRoot=!1,C.tag=C.error=null,C.strict=!!m,C.noscript=!!(m||C.opt.noscript),C.state=c.BEGIN,C.strictEntities=C.opt.strictEntities,C.ENTITIES=C.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),C.attribList=[],C.opt.xmlns&&(C.ns=Object.create(v)),C.opt.unquotedAttributeValues===void 0&&(C.opt.unquotedAttributeValues=!m),C.trackPosition=C.opt.position!==!1,C.trackPosition&&(C.position=C.line=C.column=0),F(C,"onready")}Object.create||(Object.create=function(m){function g(){}g.prototype=m;var C=new g;return C}),Object.keys||(Object.keys=function(m){var g=[];for(var C in m)m.hasOwnProperty(C)&&g.push(C);return g});function o(m){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),C=0,O=0,Y=n.length;O<Y;O++){var J=m[n[O]].length;if(J>g)switch(n[O]){case"textNode":q(m);break;case"cdata":k(m,"oncdata",m.cdata),m.cdata="";break;case"script":k(m,"onscript",m.script),m.script="";break;default:V(m,"Max buffer length exceeded: "+n[O])}C=Math.max(C,J)}var z=t.MAX_BUFFER_LENGTH-C;m.bufferCheckPosition=z+m.position}function i(m){for(var g=0,C=n.length;g<C;g++)m[n[g]]=""}function s(m){q(m),m.cdata!==""&&(k(m,"oncdata",m.cdata),m.cdata=""),m.script!==""&&(k(m,"onscript",m.script),m.script="")}r.prototype={end:function(){G(this)},write:et,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){s(this)}};var a;try{a=require("stream").Stream}catch{a=function(){}}a||(a=function(){});var u=t.EVENTS.filter(function(m){return m!=="error"&&m!=="end"});function l(m,g){return new f(m,g)}function f(m,g){if(!(this instanceof f))return new f(m,g);a.apply(this),this._parser=new r(m,g),this.writable=!0,this.readable=!0;var C=this;this._parser.onend=function(){C.emit("end")},this._parser.onerror=function(O){C.emit("error",O),C._parser.error=null},this._decoder=null,u.forEach(function(O){Object.defineProperty(C,"on"+O,{get:function(){return C._parser["on"+O]},set:function(Y){if(!Y)return C.removeAllListeners(O),C._parser["on"+O]=Y,Y;C.on(O,Y)},enumerable:!0,configurable:!1})})}f.prototype=Object.create(a.prototype,{constructor:{value:f}}),f.prototype.write=function(m){return typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(m)&&(this._decoder||(this._decoder=new TextDecoder("utf8")),m=this._decoder.decode(m,{stream:!0})),this._parser.write(m.toString()),this.emit("data",m),!0},f.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var g=this._decoder.decode();g&&(this._parser.write(g),this.emit("data",g))}return this._parser.end(),!0},f.prototype.on=function(m,g){var C=this;return!C._parser["on"+m]&&u.indexOf(m)!==-1&&(C._parser["on"+m]=function(){var O=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);O.splice(0,0,m),C.emit.apply(C,O)}),a.prototype.on.call(C,m,g)};var p="[CDATA[",d="DOCTYPE",b="http://www.w3.org/XML/1998/namespace",E="http://www.w3.org/2000/xmlns/",v={xml:b,xmlns:E},y=/[:_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]/,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 w(m){return m===" "||m===`
69
+ `||m==="\r"||m===" "}function I(m){return m==='"'||m==="'"}function P(m){return m===">"||w(m)}function L(m,g){return m.test(g)}function S(m,g){return!L(m,g)}var c=0;t.STATE={BEGIN:c++,BEGIN_WHITESPACE:c++,TEXT:c++,TEXT_ENTITY:c++,OPEN_WAKA:c++,SGML_DECL:c++,SGML_DECL_QUOTED:c++,DOCTYPE:c++,DOCTYPE_QUOTED:c++,DOCTYPE_DTD:c++,DOCTYPE_DTD_QUOTED:c++,COMMENT_STARTING:c++,COMMENT:c++,COMMENT_ENDING:c++,COMMENT_ENDED:c++,CDATA:c++,CDATA_ENDING:c++,CDATA_ENDING_2:c++,PROC_INST:c++,PROC_INST_BODY:c++,PROC_INST_ENDING:c++,OPEN_TAG:c++,OPEN_TAG_SLASH:c++,ATTRIB:c++,ATTRIB_NAME:c++,ATTRIB_NAME_SAW_WHITE:c++,ATTRIB_VALUE:c++,ATTRIB_VALUE_QUOTED:c++,ATTRIB_VALUE_CLOSED:c++,ATTRIB_VALUE_UNQUOTED:c++,ATTRIB_VALUE_ENTITY_Q:c++,ATTRIB_VALUE_ENTITY_U:c++,CLOSE_TAG:c++,CLOSE_TAG_SAW_WHITE:c++,SCRIPT:c++,SCRIPT_ENDING:c++},t.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},t.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(t.ENTITIES).forEach(function(m){var g=t.ENTITIES[m],C=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[m]=C});for(var _ in t.STATE)t.STATE[t.STATE[_]]=_;c=t.STATE;function F(m,g,C){m[g]&&m[g](C)}function k(m,g,C){m.textNode&&q(m),F(m,g,C)}function q(m){m.textNode=R(m.opt,m.textNode),m.textNode&&F(m,"ontext",m.textNode),m.textNode=""}function R(m,g){return m.trim&&(g=g.trim()),m.normalize&&(g=g.replace(/\s+/g," ")),g}function V(m,g){return q(m),m.trackPosition&&(g+=`
70
70
  Line: `+m.line+`
71
71
  Column: `+m.column+`
72
- Char: `+m.c),g=new Error(g),m.error=g,C(m,"onerror",g),m}function G(m){return m.sawRoot&&!m.closedRoot&&W(m,"Unclosed root tag"),m.state!==c.BEGIN&&m.state!==c.BEGIN_WHITESPACE&&m.state!==c.TEXT&&V(m,"Unexpected end"),q(m),m.c="",m.closed=!0,C(m,"onend"),r.call(m,m.strict,m.opt),m}function W(m,g){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&V(m,g)}function Ze(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var g=m.tags[m.tags.length-1]||m,F=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(F.ns=g.ns),m.attribList.length=0,k(m,"onopentagstart",F)}function Ce(m,g){var F=m.indexOf(":"),v=F<0?["",m]:m.split(":"),Y=v[0],J=v[1];return g&&m==="xmlns"&&(Y="xmlns",J=""),{prefix:Y,local:J}}function Le(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var g=Ce(m.attribName,!0),F=g.prefix,v=g.local;if(F==="xmlns")if(v==="xml"&&m.attribValue!==b)W(m,"xml: prefix must be bound to "+b+`
73
- Actual: `+m.attribValue);else if(v==="xmlns"&&m.attribValue!==T)W(m,"xmlns: prefix must be bound to "+T+`
74
- Actual: `+m.attribValue);else{var Y=m.tag,J=m.tags[m.tags.length-1]||m;Y.ns===J.ns&&(Y.ns=Object.create(J.ns)),Y.ns[v]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,k(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function ue(m,g){if(m.opt.xmlns){var F=m.tag,v=Ce(m.tagName);F.prefix=v.prefix,F.local=v.local,F.uri=F.ns[v.prefix]||"",F.prefix&&!F.uri&&(W(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),F.uri=v.prefix);var Y=m.tags[m.tags.length-1]||m;F.ns&&Y.ns!==F.ns&&Object.keys(F.ns).forEach(function(U){k(m,"onopennamespace",{prefix:U,uri:F.ns[U]})});for(var J=0,z=m.attribList.length;J<z;J++){var ne=m.attribList[J],N=ne[0],L=ne[1],j=Ce(N,!0),M=j.prefix,A=j.local,X=M===""?"":F.ns[M]||"",B={name:N,value:L,prefix:M,local:A,uri:X};M&&M!=="xmlns"&&!X&&(W(m,"Unbound namespace prefix: "+JSON.stringify(M)),B.uri=M),m.tag.attributes[N]=B,k(m,"onattribute",B)}m.attribList.length=0}m.tag.isSelfClosing=!!g,m.sawRoot=!0,m.tags.push(m.tag),k(m,"onopentag",m.tag),g||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=c.SCRIPT:m.state=c.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function ge(m){if(!m.tagName){W(m,"Weird empty close tag."),m.textNode+="</>",m.state=c.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=c.SCRIPT;return}k(m,"onscript",m.script),m.script=""}var g=m.tags.length,F=m.tagName;m.strict||(F=F[m.looseCase]());for(var v=F;g--;){var Y=m.tags[g];if(Y.name!==v)W(m,"Unexpected close tag");else break}if(g<0){W(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=c.TEXT;return}m.tagName=F;for(var J=m.tags.length;J-- >g;){var z=m.tag=m.tags.pop();m.tagName=m.tag.name,k(m,"onclosetag",m.tagName);var ne={};for(var N in z.ns)ne[N]=z.ns[N];var L=m.tags[m.tags.length-1]||m;m.opt.xmlns&&z.ns!==L.ns&&Object.keys(z.ns).forEach(function(j){var M=z.ns[j];k(m,"onclosenamespace",{prefix:j,uri:M})})}g===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=c.TEXT}function Ke(m){var g=m.entity,F=g.toLowerCase(),v,Y="";return m.ENTITIES[g]?m.ENTITIES[g]:m.ENTITIES[F]?m.ENTITIES[F]:(g=F,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),v=parseInt(g,16),Y=v.toString(16)):(g=g.slice(1),v=parseInt(g,10),Y=v.toString(10))),g=g.replace(/^0+/,""),isNaN(v)||Y.toLowerCase()!==g||v<0||v>1114111?(W(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(v))}function $(m,g){g==="<"?(m.state=c.OPEN_WAKA,m.startTagPosition=m.position):w(g)||(W(m,"Non-whitespace before first tag."),m.textNode=g,m.state=c.TEXT)}function Pe(m,g){var F="";return g<m.length&&(F=m.charAt(g)),F}function et(m){var g=this;if(this.error)throw this.error;if(g.closed)return V(g,"Cannot write after close. Assign an onready handler.");if(m===null)return G(g);typeof m=="object"&&(m=m.toString());for(var F=0,v="";v=Pe(m,F++),g.c=v,!!v;)switch(g.trackPosition&&(g.position++,v===`
75
- `?(g.line++,g.column=0):g.column++),g.state){case c.BEGIN:if(g.state=c.BEGIN_WHITESPACE,v==="\uFEFF")continue;$(g,v);continue;case c.BEGIN_WHITESPACE:$(g,v);continue;case c.TEXT:if(g.sawRoot&&!g.closedRoot){for(var J=F-1;v&&v!=="<"&&v!=="&";)v=Pe(m,F++),v&&g.trackPosition&&(g.position++,v===`
76
- `?(g.line++,g.column=0):g.column++);g.textNode+=m.substring(J,F-1)}v==="<"&&!(g.sawRoot&&g.closedRoot&&!g.strict)?(g.state=c.OPEN_WAKA,g.startTagPosition=g.position):(!w(v)&&(!g.sawRoot||g.closedRoot)&&W(g,"Text data outside of root node."),v==="&"?g.state=c.TEXT_ENTITY:g.textNode+=v);continue;case c.SCRIPT:v==="<"?g.state=c.SCRIPT_ENDING:g.script+=v;continue;case c.SCRIPT_ENDING:v==="/"?g.state=c.CLOSE_TAG:(g.script+="<"+v,g.state=c.SCRIPT);continue;case c.OPEN_WAKA:if(v==="!")g.state=c.SGML_DECL,g.sgmlDecl="";else if(!w(v))if(P(y,v))g.state=c.OPEN_TAG,g.tagName=v;else if(v==="/")g.state=c.CLOSE_TAG,g.tagName="";else if(v==="?")g.state=c.PROC_INST,g.procInstName=g.procInstBody="";else{if(W(g,"Unencoded <"),g.startTagPosition+1<g.position){var Y=g.position-g.startTagPosition;v=new Array(Y).join(" ")+v}g.textNode+="<"+v,g.state=c.TEXT}continue;case c.SGML_DECL:if(g.sgmlDecl+v==="--"){g.state=c.COMMENT,g.comment="",g.sgmlDecl="";continue}g.doctype&&g.doctype!==!0&&g.sgmlDecl?(g.state=c.DOCTYPE_DTD,g.doctype+="<!"+g.sgmlDecl+v,g.sgmlDecl=""):(g.sgmlDecl+v).toUpperCase()===l?(k(g,"onopencdata"),g.state=c.CDATA,g.sgmlDecl="",g.cdata=""):(g.sgmlDecl+v).toUpperCase()===h?(g.state=c.DOCTYPE,(g.doctype||g.sawRoot)&&W(g,"Inappropriately located doctype declaration"),g.doctype="",g.sgmlDecl=""):v===">"?(k(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=c.TEXT):(I(v)&&(g.state=c.SGML_DECL_QUOTED),g.sgmlDecl+=v);continue;case c.SGML_DECL_QUOTED:v===g.q&&(g.state=c.SGML_DECL,g.q=""),g.sgmlDecl+=v;continue;case c.DOCTYPE:v===">"?(g.state=c.TEXT,k(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=v,v==="["?g.state=c.DOCTYPE_DTD:I(v)&&(g.state=c.DOCTYPE_QUOTED,g.q=v));continue;case c.DOCTYPE_QUOTED:g.doctype+=v,v===g.q&&(g.q="",g.state=c.DOCTYPE);continue;case c.DOCTYPE_DTD:v==="]"?(g.doctype+=v,g.state=c.DOCTYPE):v==="<"?(g.state=c.OPEN_WAKA,g.startTagPosition=g.position):I(v)?(g.doctype+=v,g.state=c.DOCTYPE_DTD_QUOTED,g.q=v):g.doctype+=v;continue;case c.DOCTYPE_DTD_QUOTED:g.doctype+=v,v===g.q&&(g.state=c.DOCTYPE_DTD,g.q="");continue;case c.COMMENT:v==="-"?g.state=c.COMMENT_ENDING:g.comment+=v;continue;case c.COMMENT_ENDING:v==="-"?(g.state=c.COMMENT_ENDED,g.comment=R(g.opt,g.comment),g.comment&&k(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+v,g.state=c.COMMENT);continue;case c.COMMENT_ENDED:v!==">"?(W(g,"Malformed comment"),g.comment+="--"+v,g.state=c.COMMENT):g.doctype&&g.doctype!==!0?g.state=c.DOCTYPE_DTD:g.state=c.TEXT;continue;case c.CDATA:for(var J=F-1;v&&v!=="]";)v=Pe(m,F++),v&&g.trackPosition&&(g.position++,v===`
77
- `?(g.line++,g.column=0):g.column++);g.cdata+=m.substring(J,F-1),v==="]"&&(g.state=c.CDATA_ENDING);continue;case c.CDATA_ENDING:v==="]"?g.state=c.CDATA_ENDING_2:(g.cdata+="]"+v,g.state=c.CDATA);continue;case c.CDATA_ENDING_2:v===">"?(g.cdata&&k(g,"oncdata",g.cdata),k(g,"onclosecdata"),g.cdata="",g.state=c.TEXT):v==="]"?g.cdata+="]":(g.cdata+="]]"+v,g.state=c.CDATA);continue;case c.PROC_INST:v==="?"?g.state=c.PROC_INST_ENDING:w(v)?g.state=c.PROC_INST_BODY:g.procInstName+=v;continue;case c.PROC_INST_BODY:if(!g.procInstBody&&w(v))continue;v==="?"?g.state=c.PROC_INST_ENDING:g.procInstBody+=v;continue;case c.PROC_INST_ENDING:v===">"?(k(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=c.TEXT):(g.procInstBody+="?"+v,g.state=c.PROC_INST_BODY);continue;case c.OPEN_TAG:P(D,v)?g.tagName+=v:(Ze(g),v===">"?ue(g):v==="/"?g.state=c.OPEN_TAG_SLASH:(w(v)||W(g,"Invalid character in tag name"),g.state=c.ATTRIB));continue;case c.OPEN_TAG_SLASH:v===">"?(ue(g,!0),ge(g)):(W(g,"Forward-slash in opening tag not followed by >"),g.state=c.ATTRIB);continue;case c.ATTRIB:if(w(v))continue;v===">"?ue(g):v==="/"?g.state=c.OPEN_TAG_SLASH:P(y,v)?(g.attribName=v,g.attribValue="",g.state=c.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case c.ATTRIB_NAME:v==="="?g.state=c.ATTRIB_VALUE:v===">"?(W(g,"Attribute without value"),g.attribValue=g.attribName,Le(g),ue(g)):w(v)?g.state=c.ATTRIB_NAME_SAW_WHITE:P(D,v)?g.attribName+=v:W(g,"Invalid attribute name");continue;case c.ATTRIB_NAME_SAW_WHITE:if(v==="=")g.state=c.ATTRIB_VALUE;else{if(w(v))continue;W(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",k(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",v===">"?ue(g):P(y,v)?(g.attribName=v,g.state=c.ATTRIB_NAME):(W(g,"Invalid attribute name"),g.state=c.ATTRIB)}continue;case c.ATTRIB_VALUE:if(w(v))continue;I(v)?(g.q=v,g.state=c.ATTRIB_VALUE_QUOTED):(g.opt.unquotedAttributeValues||V(g,"Unquoted attribute value"),g.state=c.ATTRIB_VALUE_UNQUOTED,g.attribValue=v);continue;case c.ATTRIB_VALUE_QUOTED:if(v!==g.q){v==="&"?g.state=c.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=v;continue}Le(g),g.q="",g.state=c.ATTRIB_VALUE_CLOSED;continue;case c.ATTRIB_VALUE_CLOSED:w(v)?g.state=c.ATTRIB:v===">"?ue(g):v==="/"?g.state=c.OPEN_TAG_SLASH:P(y,v)?(W(g,"No whitespace between attributes"),g.attribName=v,g.attribValue="",g.state=c.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case c.ATTRIB_VALUE_UNQUOTED:if(!x(v)){v==="&"?g.state=c.ATTRIB_VALUE_ENTITY_U:g.attribValue+=v;continue}Le(g),v===">"?ue(g):g.state=c.ATTRIB;continue;case c.CLOSE_TAG:if(g.tagName)v===">"?ge(g):P(D,v)?g.tagName+=v:g.script?(g.script+="</"+g.tagName+v,g.tagName="",g.state=c.SCRIPT):(w(v)||W(g,"Invalid tagname in closing tag"),g.state=c.CLOSE_TAG_SAW_WHITE);else{if(w(v))continue;S(y,v)?g.script?(g.script+="</"+v,g.state=c.SCRIPT):W(g,"Invalid tagname in closing tag."):g.tagName=v}continue;case c.CLOSE_TAG_SAW_WHITE:if(w(v))continue;v===">"?ge(g):W(g,"Invalid characters in closing tag");continue;case c.TEXT_ENTITY:case c.ATTRIB_VALUE_ENTITY_Q:case c.ATTRIB_VALUE_ENTITY_U:var z,ne;switch(g.state){case c.TEXT_ENTITY:z=c.TEXT,ne="textNode";break;case c.ATTRIB_VALUE_ENTITY_Q:z=c.ATTRIB_VALUE_QUOTED,ne="attribValue";break;case c.ATTRIB_VALUE_ENTITY_U:z=c.ATTRIB_VALUE_UNQUOTED,ne="attribValue";break}if(v===";"){var N=Ke(g);g.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(N)?(g.entity="",g.state=z,g.write(N)):(g[ne]+=N,g.entity="",g.state=z)}else P(g.entity.length?f:E,v)?g.entity+=v:(W(g,"Invalid character in entity name"),g[ne]+="&"+g.entity+v,g.entity="",g.state=z);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&o(g),g}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,g=Math.floor,F=function(){var v=16384,Y=[],J,z,ne=-1,N=arguments.length;if(!N)return"";for(var L="";++ne<N;){var j=Number(arguments[ne]);if(!isFinite(j)||j<0||j>1114111||g(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?Y.push(j):(j-=65536,J=(j>>10)+55296,z=j%1024+56320,Y.push(J,z)),(ne+1===N||Y.length>v)&&(L+=m.apply(null,Y),Y.length=0)}return L};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:F,configurable:!0,writable:!0}):String.fromCodePoint=F}()})(e)}(Ut)),Ut}var Vt={},yr;function go(){return yr||(yr=1,function(){Vt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(H)),Vt}var ve={},br;function Kr(){return br||(br=1,function(){var e;e=new RegExp(/(?!xmlns)^.*:/),ve.normalize=function(t){return t.toLowerCase()},ve.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},ve.stripPrefix=function(t){return t.replace(e,"")},ve.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},ve.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(H)),ve}var wr;function mo(){return wr||(wr=1,function(e){(function(){var t,n,r,o,i,s,a,u,p,d=function(b,T){return function(){return b.apply(T,arguments)}},l=function(b,T){for(var O in T)h.call(T,O)&&(b[O]=T[O]);function y(){this.constructor=b}return y.prototype=T.prototype,b.prototype=new y,b.__super__=T.prototype,b},h={}.hasOwnProperty;u=ho(),o=Kt,t=go(),a=Kr(),p=Ei.setImmediate,n=en().defaults,i=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},s=function(b,T,O){var y,D,E;for(y=0,D=b.length;y<D;y++)E=b[y],T=E(T,O);return T},r=function(b,T,O){var y;return y=Object.create(null),y.value=O,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(b,T,y)},e.Parser=function(b){l(T,b);function T(O){this.parseStringPromise=d(this.parseStringPromise,this),this.parseString=d(this.parseString,this),this.reset=d(this.reset,this),this.assignOrPush=d(this.assignOrPush,this),this.processAsync=d(this.processAsync,this);var y,D,E;if(!(this instanceof e.Parser))return new e.Parser(O);this.options={},D=n["0.2"];for(y in D)h.call(D,y)&&(E=D[y],this.options[y]=E);for(y in O)h.call(O,y)&&(E=O[y],this.options[y]=E);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return T.prototype.processAsync=function(){var O,y;try{return this.remaining.length<=this.options.chunkSize?(O=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(O),this.saxParser.close()):(O=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(O),p(this.processAsync))}catch(D){if(y=D,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},T.prototype.assignOrPush=function(O,y,D){return y in O?(O[y]instanceof Array||r(O,y,[O[y]]),O[y].push(D)):this.options.explicitArray?r(O,y,[D]):r(O,y,D)},T.prototype.reset=function(){var O,y,D,E;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(f){return function(w){if(f.saxParser.resume(),!f.saxParser.errThrown)return f.saxParser.errThrown=!0,f.emit("error",w)}}(this),this.saxParser.onend=function(f){return function(){if(!f.saxParser.ended)return f.saxParser.ended=!0,f.emit("end",f.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,E=[],O=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=function(f){return function(w){var I,x,P,S,c;if(P={},P[y]="",!f.options.ignoreAttrs){c=w.attributes;for(I in c)h.call(c,I)&&(!(O in P)&&!f.options.mergeAttrs&&(P[O]={}),x=f.options.attrValueProcessors?s(f.options.attrValueProcessors,w.attributes[I],I):w.attributes[I],S=f.options.attrNameProcessors?s(f.options.attrNameProcessors,I):I,f.options.mergeAttrs?f.assignOrPush(P,S,x):r(P[O],S,x))}return P["#name"]=f.options.tagNameProcessors?s(f.options.tagNameProcessors,w.name):w.name,f.options.xmlns&&(P[f.options.xmlnskey]={uri:w.uri,local:w.local}),E.push(P)}}(this),this.saxParser.onclosetag=function(f){return function(){var w,I,x,P,S,c,_,C,k,q;if(c=E.pop(),S=c["#name"],(!f.options.explicitChildren||!f.options.preserveChildrenOrder)&&delete c["#name"],c.cdata===!0&&(w=c.cdata,delete c.cdata),k=E[E.length-1],c[y].match(/^\s*$/)&&!w?(I=c[y],delete c[y]):(f.options.trim&&(c[y]=c[y].trim()),f.options.normalize&&(c[y]=c[y].replace(/\s{2,}/g," ").trim()),c[y]=f.options.valueProcessors?s(f.options.valueProcessors,c[y],S):c[y],Object.keys(c).length===1&&y in c&&!f.EXPLICIT_CHARKEY&&(c=c[y])),i(c)&&(typeof f.options.emptyTag=="function"?c=f.options.emptyTag():c=f.options.emptyTag!==""?f.options.emptyTag:I),f.options.validator!=null&&(q="/"+function(){var R,V,G;for(G=[],R=0,V=E.length;R<V;R++)P=E[R],G.push(P["#name"]);return G}().concat(S).join("/"),function(){var R;try{return c=f.options.validator(q,k&&k[S],c)}catch(V){return R=V,f.emit("error",R)}}()),f.options.explicitChildren&&!f.options.mergeAttrs&&typeof c=="object"){if(!f.options.preserveChildrenOrder)P={},f.options.attrkey in c&&(P[f.options.attrkey]=c[f.options.attrkey],delete c[f.options.attrkey]),!f.options.charsAsChildren&&f.options.charkey in c&&(P[f.options.charkey]=c[f.options.charkey],delete c[f.options.charkey]),Object.getOwnPropertyNames(c).length>0&&(P[f.options.childkey]=c),c=P;else if(k){k[f.options.childkey]=k[f.options.childkey]||[],_={};for(x in c)h.call(c,x)&&r(_,x,c[x]);k[f.options.childkey].push(_),delete c["#name"],Object.keys(c).length===1&&y in c&&!f.EXPLICIT_CHARKEY&&(c=c[y])}}return E.length>0?f.assignOrPush(k,S,c):(f.options.explicitRoot&&(C=c,c={},r(c,S,C)),f.resultObject=c,f.saxParser.ended=!0,f.emit("end",f.resultObject))}}(this),D=function(f){return function(w){var I,x;if(x=E[E.length-1],x)return x[y]+=w,f.options.explicitChildren&&f.options.preserveChildrenOrder&&f.options.charsAsChildren&&(f.options.includeWhiteChars||w.replace(/\\n/g,"").trim()!=="")&&(x[f.options.childkey]=x[f.options.childkey]||[],I={"#name":"__text__"},I[y]=w,f.options.normalize&&(I[y]=I[y].replace(/\s{2,}/g," ").trim()),x[f.options.childkey].push(I)),x}}(this),this.saxParser.ontext=D,this.saxParser.oncdata=function(f){return function(w){var I;if(I=D(w),I)return I.cdata=!0}}()},T.prototype.parseString=function(O,y){var D;y!=null&&typeof y=="function"&&(this.on("end",function(E){return this.reset(),y(null,E)}),this.on("error",function(E){return this.reset(),y(E)}));try{return O=O.toString(),O.trim()===""?(this.emit("end",null),!0):(O=t.stripBOM(O),this.options.async?(this.remaining=O,p(this.processAsync),this.saxParser):this.saxParser.write(O).close())}catch(E){if(D=E,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw D}else return this.emit("error",D),this.saxParser.errThrown=!0}},T.prototype.parseStringPromise=function(O){return new Promise(function(y){return function(D,E){return y.parseString(O,function(f,w){return f?E(f):D(w)})}}(this))},T}(o),e.parseString=function(b,T,O){var y,D,E;return O!=null?(typeof O=="function"&&(y=O),typeof T=="object"&&(D=T)):(typeof T=="function"&&(y=T),D={}),E=new e.Parser(D),E.parseString(b,y)},e.parseStringPromise=function(b,T){var O,y;return typeof T=="object"&&(O=T),y=new e.Parser(O),y.parseStringPromise(b)}}).call(H)}(Xt)),Xt}var ei;(function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;t=en(),e=po(),n=mo(),Kr(),t.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),e.Builder,n.Parser,n.parseString,ei=n.parseStringPromise}).call(H);class yo{constructor(t,n,r){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=n,this.readPHPFile=r.getPHPFile,this.phpRoot=r.phpRoot||"";for(const o of r.knownScriptUrls)this.scriptIdByUrl.set(o,this.getOrCreateScriptId(o));this.breakOnFirstLine=r.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 n=await ei(t,{explicitArray:!1});await this.handleDbgpMessage(n)}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! 🎉
72
+ Char: `+m.c),g=new Error(g),m.error=g,F(m,"onerror",g),m}function G(m){return m.sawRoot&&!m.closedRoot&&W(m,"Unclosed root tag"),m.state!==c.BEGIN&&m.state!==c.BEGIN_WHITESPACE&&m.state!==c.TEXT&&V(m,"Unexpected end"),q(m),m.c="",m.closed=!0,F(m,"onend"),r.call(m,m.strict,m.opt),m}function W(m,g){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&V(m,g)}function Ze(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var g=m.tags[m.tags.length-1]||m,C=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(C.ns=g.ns),m.attribList.length=0,k(m,"onopentagstart",C)}function Fe(m,g){var C=m.indexOf(":"),O=C<0?["",m]:m.split(":"),Y=O[0],J=O[1];return g&&m==="xmlns"&&(Y="xmlns",J=""),{prefix:Y,local:J}}function Ae(m){if(m.strict||(m.attribName=m.attribName[m.looseCase]()),m.attribList.indexOf(m.attribName)!==-1||m.tag.attributes.hasOwnProperty(m.attribName)){m.attribName=m.attribValue="";return}if(m.opt.xmlns){var g=Fe(m.attribName,!0),C=g.prefix,O=g.local;if(C==="xmlns")if(O==="xml"&&m.attribValue!==b)W(m,"xml: prefix must be bound to "+b+`
73
+ Actual: `+m.attribValue);else if(O==="xmlns"&&m.attribValue!==E)W(m,"xmlns: prefix must be bound to "+E+`
74
+ Actual: `+m.attribValue);else{var Y=m.tag,J=m.tags[m.tags.length-1]||m;Y.ns===J.ns&&(Y.ns=Object.create(J.ns)),Y.ns[O]=m.attribValue}m.attribList.push([m.attribName,m.attribValue])}else m.tag.attributes[m.attribName]=m.attribValue,k(m,"onattribute",{name:m.attribName,value:m.attribValue});m.attribName=m.attribValue=""}function ue(m,g){if(m.opt.xmlns){var C=m.tag,O=Fe(m.tagName);C.prefix=O.prefix,C.local=O.local,C.uri=C.ns[O.prefix]||"",C.prefix&&!C.uri&&(W(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),C.uri=O.prefix);var Y=m.tags[m.tags.length-1]||m;C.ns&&Y.ns!==C.ns&&Object.keys(C.ns).forEach(function(U){k(m,"onopennamespace",{prefix:U,uri:C.ns[U]})});for(var J=0,z=m.attribList.length;J<z;J++){var ne=m.attribList[J],N=ne[0],A=ne[1],j=Fe(N,!0),M=j.prefix,x=j.local,X=M===""?"":C.ns[M]||"",B={name:N,value:A,prefix:M,local:x,uri:X};M&&M!=="xmlns"&&!X&&(W(m,"Unbound namespace prefix: "+JSON.stringify(M)),B.uri=M),m.tag.attributes[N]=B,k(m,"onattribute",B)}m.attribList.length=0}m.tag.isSelfClosing=!!g,m.sawRoot=!0,m.tags.push(m.tag),k(m,"onopentag",m.tag),g||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=c.SCRIPT:m.state=c.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function ge(m){if(!m.tagName){W(m,"Weird empty close tag."),m.textNode+="</>",m.state=c.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=c.SCRIPT;return}k(m,"onscript",m.script),m.script=""}var g=m.tags.length,C=m.tagName;m.strict||(C=C[m.looseCase]());for(var O=C;g--;){var Y=m.tags[g];if(Y.name!==O)W(m,"Unexpected close tag");else break}if(g<0){W(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=c.TEXT;return}m.tagName=C;for(var J=m.tags.length;J-- >g;){var z=m.tag=m.tags.pop();m.tagName=m.tag.name,k(m,"onclosetag",m.tagName);var ne={};for(var N in z.ns)ne[N]=z.ns[N];var A=m.tags[m.tags.length-1]||m;m.opt.xmlns&&z.ns!==A.ns&&Object.keys(z.ns).forEach(function(j){var M=z.ns[j];k(m,"onclosenamespace",{prefix:j,uri:M})})}g===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=c.TEXT}function Ke(m){var g=m.entity,C=g.toLowerCase(),O,Y="";return m.ENTITIES[g]?m.ENTITIES[g]:m.ENTITIES[C]?m.ENTITIES[C]:(g=C,g.charAt(0)==="#"&&(g.charAt(1)==="x"?(g=g.slice(2),O=parseInt(g,16),Y=O.toString(16)):(g=g.slice(1),O=parseInt(g,10),Y=O.toString(10))),g=g.replace(/^0+/,""),isNaN(O)||Y.toLowerCase()!==g||O<0||O>1114111?(W(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(O))}function $(m,g){g==="<"?(m.state=c.OPEN_WAKA,m.startTagPosition=m.position):w(g)||(W(m,"Non-whitespace before first tag."),m.textNode=g,m.state=c.TEXT)}function Le(m,g){var C="";return g<m.length&&(C=m.charAt(g)),C}function et(m){var g=this;if(this.error)throw this.error;if(g.closed)return V(g,"Cannot write after close. Assign an onready handler.");if(m===null)return G(g);typeof m=="object"&&(m=m.toString());for(var C=0,O="";O=Le(m,C++),g.c=O,!!O;)switch(g.trackPosition&&(g.position++,O===`
75
+ `?(g.line++,g.column=0):g.column++),g.state){case c.BEGIN:if(g.state=c.BEGIN_WHITESPACE,O==="\uFEFF")continue;$(g,O);continue;case c.BEGIN_WHITESPACE:$(g,O);continue;case c.TEXT:if(g.sawRoot&&!g.closedRoot){for(var J=C-1;O&&O!=="<"&&O!=="&";)O=Le(m,C++),O&&g.trackPosition&&(g.position++,O===`
76
+ `?(g.line++,g.column=0):g.column++);g.textNode+=m.substring(J,C-1)}O==="<"&&!(g.sawRoot&&g.closedRoot&&!g.strict)?(g.state=c.OPEN_WAKA,g.startTagPosition=g.position):(!w(O)&&(!g.sawRoot||g.closedRoot)&&W(g,"Text data outside of root node."),O==="&"?g.state=c.TEXT_ENTITY:g.textNode+=O);continue;case c.SCRIPT:O==="<"?g.state=c.SCRIPT_ENDING:g.script+=O;continue;case c.SCRIPT_ENDING:O==="/"?g.state=c.CLOSE_TAG:(g.script+="<"+O,g.state=c.SCRIPT);continue;case c.OPEN_WAKA:if(O==="!")g.state=c.SGML_DECL,g.sgmlDecl="";else if(!w(O))if(L(y,O))g.state=c.OPEN_TAG,g.tagName=O;else if(O==="/")g.state=c.CLOSE_TAG,g.tagName="";else if(O==="?")g.state=c.PROC_INST,g.procInstName=g.procInstBody="";else{if(W(g,"Unencoded <"),g.startTagPosition+1<g.position){var Y=g.position-g.startTagPosition;O=new Array(Y).join(" ")+O}g.textNode+="<"+O,g.state=c.TEXT}continue;case c.SGML_DECL:if(g.sgmlDecl+O==="--"){g.state=c.COMMENT,g.comment="",g.sgmlDecl="";continue}g.doctype&&g.doctype!==!0&&g.sgmlDecl?(g.state=c.DOCTYPE_DTD,g.doctype+="<!"+g.sgmlDecl+O,g.sgmlDecl=""):(g.sgmlDecl+O).toUpperCase()===p?(k(g,"onopencdata"),g.state=c.CDATA,g.sgmlDecl="",g.cdata=""):(g.sgmlDecl+O).toUpperCase()===d?(g.state=c.DOCTYPE,(g.doctype||g.sawRoot)&&W(g,"Inappropriately located doctype declaration"),g.doctype="",g.sgmlDecl=""):O===">"?(k(g,"onsgmldeclaration",g.sgmlDecl),g.sgmlDecl="",g.state=c.TEXT):(I(O)&&(g.state=c.SGML_DECL_QUOTED),g.sgmlDecl+=O);continue;case c.SGML_DECL_QUOTED:O===g.q&&(g.state=c.SGML_DECL,g.q=""),g.sgmlDecl+=O;continue;case c.DOCTYPE:O===">"?(g.state=c.TEXT,k(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=O,O==="["?g.state=c.DOCTYPE_DTD:I(O)&&(g.state=c.DOCTYPE_QUOTED,g.q=O));continue;case c.DOCTYPE_QUOTED:g.doctype+=O,O===g.q&&(g.q="",g.state=c.DOCTYPE);continue;case c.DOCTYPE_DTD:O==="]"?(g.doctype+=O,g.state=c.DOCTYPE):O==="<"?(g.state=c.OPEN_WAKA,g.startTagPosition=g.position):I(O)?(g.doctype+=O,g.state=c.DOCTYPE_DTD_QUOTED,g.q=O):g.doctype+=O;continue;case c.DOCTYPE_DTD_QUOTED:g.doctype+=O,O===g.q&&(g.state=c.DOCTYPE_DTD,g.q="");continue;case c.COMMENT:O==="-"?g.state=c.COMMENT_ENDING:g.comment+=O;continue;case c.COMMENT_ENDING:O==="-"?(g.state=c.COMMENT_ENDED,g.comment=R(g.opt,g.comment),g.comment&&k(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+O,g.state=c.COMMENT);continue;case c.COMMENT_ENDED:O!==">"?(W(g,"Malformed comment"),g.comment+="--"+O,g.state=c.COMMENT):g.doctype&&g.doctype!==!0?g.state=c.DOCTYPE_DTD:g.state=c.TEXT;continue;case c.CDATA:for(var J=C-1;O&&O!=="]";)O=Le(m,C++),O&&g.trackPosition&&(g.position++,O===`
77
+ `?(g.line++,g.column=0):g.column++);g.cdata+=m.substring(J,C-1),O==="]"&&(g.state=c.CDATA_ENDING);continue;case c.CDATA_ENDING:O==="]"?g.state=c.CDATA_ENDING_2:(g.cdata+="]"+O,g.state=c.CDATA);continue;case c.CDATA_ENDING_2:O===">"?(g.cdata&&k(g,"oncdata",g.cdata),k(g,"onclosecdata"),g.cdata="",g.state=c.TEXT):O==="]"?g.cdata+="]":(g.cdata+="]]"+O,g.state=c.CDATA);continue;case c.PROC_INST:O==="?"?g.state=c.PROC_INST_ENDING:w(O)?g.state=c.PROC_INST_BODY:g.procInstName+=O;continue;case c.PROC_INST_BODY:if(!g.procInstBody&&w(O))continue;O==="?"?g.state=c.PROC_INST_ENDING:g.procInstBody+=O;continue;case c.PROC_INST_ENDING:O===">"?(k(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=c.TEXT):(g.procInstBody+="?"+O,g.state=c.PROC_INST_BODY);continue;case c.OPEN_TAG:L(D,O)?g.tagName+=O:(Ze(g),O===">"?ue(g):O==="/"?g.state=c.OPEN_TAG_SLASH:(w(O)||W(g,"Invalid character in tag name"),g.state=c.ATTRIB));continue;case c.OPEN_TAG_SLASH:O===">"?(ue(g,!0),ge(g)):(W(g,"Forward-slash in opening tag not followed by >"),g.state=c.ATTRIB);continue;case c.ATTRIB:if(w(O))continue;O===">"?ue(g):O==="/"?g.state=c.OPEN_TAG_SLASH:L(y,O)?(g.attribName=O,g.attribValue="",g.state=c.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case c.ATTRIB_NAME:O==="="?g.state=c.ATTRIB_VALUE:O===">"?(W(g,"Attribute without value"),g.attribValue=g.attribName,Ae(g),ue(g)):w(O)?g.state=c.ATTRIB_NAME_SAW_WHITE:L(D,O)?g.attribName+=O:W(g,"Invalid attribute name");continue;case c.ATTRIB_NAME_SAW_WHITE:if(O==="=")g.state=c.ATTRIB_VALUE;else{if(w(O))continue;W(g,"Attribute without value"),g.tag.attributes[g.attribName]="",g.attribValue="",k(g,"onattribute",{name:g.attribName,value:""}),g.attribName="",O===">"?ue(g):L(y,O)?(g.attribName=O,g.state=c.ATTRIB_NAME):(W(g,"Invalid attribute name"),g.state=c.ATTRIB)}continue;case c.ATTRIB_VALUE:if(w(O))continue;I(O)?(g.q=O,g.state=c.ATTRIB_VALUE_QUOTED):(g.opt.unquotedAttributeValues||V(g,"Unquoted attribute value"),g.state=c.ATTRIB_VALUE_UNQUOTED,g.attribValue=O);continue;case c.ATTRIB_VALUE_QUOTED:if(O!==g.q){O==="&"?g.state=c.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=O;continue}Ae(g),g.q="",g.state=c.ATTRIB_VALUE_CLOSED;continue;case c.ATTRIB_VALUE_CLOSED:w(O)?g.state=c.ATTRIB:O===">"?ue(g):O==="/"?g.state=c.OPEN_TAG_SLASH:L(y,O)?(W(g,"No whitespace between attributes"),g.attribName=O,g.attribValue="",g.state=c.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case c.ATTRIB_VALUE_UNQUOTED:if(!P(O)){O==="&"?g.state=c.ATTRIB_VALUE_ENTITY_U:g.attribValue+=O;continue}Ae(g),O===">"?ue(g):g.state=c.ATTRIB;continue;case c.CLOSE_TAG:if(g.tagName)O===">"?ge(g):L(D,O)?g.tagName+=O:g.script?(g.script+="</"+g.tagName+O,g.tagName="",g.state=c.SCRIPT):(w(O)||W(g,"Invalid tagname in closing tag"),g.state=c.CLOSE_TAG_SAW_WHITE);else{if(w(O))continue;S(y,O)?g.script?(g.script+="</"+O,g.state=c.SCRIPT):W(g,"Invalid tagname in closing tag."):g.tagName=O}continue;case c.CLOSE_TAG_SAW_WHITE:if(w(O))continue;O===">"?ge(g):W(g,"Invalid characters in closing tag");continue;case c.TEXT_ENTITY:case c.ATTRIB_VALUE_ENTITY_Q:case c.ATTRIB_VALUE_ENTITY_U:var z,ne;switch(g.state){case c.TEXT_ENTITY:z=c.TEXT,ne="textNode";break;case c.ATTRIB_VALUE_ENTITY_Q:z=c.ATTRIB_VALUE_QUOTED,ne="attribValue";break;case c.ATTRIB_VALUE_ENTITY_U:z=c.ATTRIB_VALUE_UNQUOTED,ne="attribValue";break}if(O===";"){var N=Ke(g);g.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(N)?(g.entity="",g.state=z,g.write(N)):(g[ne]+=N,g.entity="",g.state=z)}else L(g.entity.length?h:T,O)?g.entity+=O:(W(g,"Invalid character in entity name"),g[ne]+="&"+g.entity+O,g.entity="",g.state=z);continue;default:throw new Error(g,"Unknown state: "+g.state)}return g.position>=g.bufferCheckPosition&&o(g),g}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,g=Math.floor,C=function(){var O=16384,Y=[],J,z,ne=-1,N=arguments.length;if(!N)return"";for(var A="";++ne<N;){var j=Number(arguments[ne]);if(!isFinite(j)||j<0||j>1114111||g(j)!==j)throw RangeError("Invalid code point: "+j);j<=65535?Y.push(j):(j-=65536,J=(j>>10)+55296,z=j%1024+56320,Y.push(J,z)),(ne+1===N||Y.length>O)&&(A+=m.apply(null,Y),Y.length=0)}return A};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:C,configurable:!0,writable:!0}):String.fromCodePoint=C}()})(e)}(Ut)),Ut}var Vt={},yr;function mo(){return yr||(yr=1,function(){Vt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(H)),Vt}var Oe={},br;function ei(){return br||(br=1,function(){var e;e=new RegExp(/(?!xmlns)^.*:/),Oe.normalize=function(t){return t.toLowerCase()},Oe.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},Oe.stripPrefix=function(t){return t.replace(e,"")},Oe.parseNumbers=function(t){return isNaN(t)||(t=t%1===0?parseInt(t,10):parseFloat(t)),t},Oe.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t=t.toLowerCase()==="true"),t}}.call(H)),Oe}var wr;function yo(){return wr||(wr=1,function(e){(function(){var t,n,r,o,i,s,a,u,l,f=function(b,E){return function(){return b.apply(E,arguments)}},p=function(b,E){for(var v in E)d.call(E,v)&&(b[v]=E[v]);function y(){this.constructor=b}return y.prototype=E.prototype,b.prototype=new y,b.__super__=E.prototype,b},d={}.hasOwnProperty;u=go(),o=Kt,t=mo(),a=ei(),l=Ni.setImmediate,n=en().defaults,i=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},s=function(b,E,v){var y,D,T;for(y=0,D=b.length;y<D;y++)T=b[y],E=T(E,v);return E},r=function(b,E,v){var y;return y=Object.create(null),y.value=v,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(b,E,y)},e.Parser=function(b){p(E,b);function E(v){this.parseStringPromise=f(this.parseStringPromise,this),this.parseString=f(this.parseString,this),this.reset=f(this.reset,this),this.assignOrPush=f(this.assignOrPush,this),this.processAsync=f(this.processAsync,this);var y,D,T;if(!(this instanceof e.Parser))return new e.Parser(v);this.options={},D=n["0.2"];for(y in D)d.call(D,y)&&(T=D[y],this.options[y]=T);for(y in v)d.call(v,y)&&(T=v[y],this.options[y]=T);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(a.normalize)),this.reset()}return E.prototype.processAsync=function(){var v,y;try{return this.remaining.length<=this.options.chunkSize?(v=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(v),this.saxParser.close()):(v=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(v),l(this.processAsync))}catch(D){if(y=D,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},E.prototype.assignOrPush=function(v,y,D){return y in v?(v[y]instanceof Array||r(v,y,[v[y]]),v[y].push(D)):this.options.explicitArray?r(v,y,[D]):r(v,y,D)},E.prototype.reset=function(){var v,y,D,T;return this.removeAllListeners(),this.saxParser=u.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=function(h){return function(w){if(h.saxParser.resume(),!h.saxParser.errThrown)return h.saxParser.errThrown=!0,h.emit("error",w)}}(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,T=[],v=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=function(h){return function(w){var I,P,L,S,c;if(L={},L[y]="",!h.options.ignoreAttrs){c=w.attributes;for(I in c)d.call(c,I)&&(!(v in L)&&!h.options.mergeAttrs&&(L[v]={}),P=h.options.attrValueProcessors?s(h.options.attrValueProcessors,w.attributes[I],I):w.attributes[I],S=h.options.attrNameProcessors?s(h.options.attrNameProcessors,I):I,h.options.mergeAttrs?h.assignOrPush(L,S,P):r(L[v],S,P))}return L["#name"]=h.options.tagNameProcessors?s(h.options.tagNameProcessors,w.name):w.name,h.options.xmlns&&(L[h.options.xmlnskey]={uri:w.uri,local:w.local}),T.push(L)}}(this),this.saxParser.onclosetag=function(h){return function(){var w,I,P,L,S,c,_,F,k,q;if(c=T.pop(),S=c["#name"],(!h.options.explicitChildren||!h.options.preserveChildrenOrder)&&delete c["#name"],c.cdata===!0&&(w=c.cdata,delete c.cdata),k=T[T.length-1],c[y].match(/^\s*$/)&&!w?(I=c[y],delete c[y]):(h.options.trim&&(c[y]=c[y].trim()),h.options.normalize&&(c[y]=c[y].replace(/\s{2,}/g," ").trim()),c[y]=h.options.valueProcessors?s(h.options.valueProcessors,c[y],S):c[y],Object.keys(c).length===1&&y in c&&!h.EXPLICIT_CHARKEY&&(c=c[y])),i(c)&&(typeof h.options.emptyTag=="function"?c=h.options.emptyTag():c=h.options.emptyTag!==""?h.options.emptyTag:I),h.options.validator!=null&&(q="/"+function(){var R,V,G;for(G=[],R=0,V=T.length;R<V;R++)L=T[R],G.push(L["#name"]);return G}().concat(S).join("/"),function(){var R;try{return c=h.options.validator(q,k&&k[S],c)}catch(V){return R=V,h.emit("error",R)}}()),h.options.explicitChildren&&!h.options.mergeAttrs&&typeof c=="object"){if(!h.options.preserveChildrenOrder)L={},h.options.attrkey in c&&(L[h.options.attrkey]=c[h.options.attrkey],delete c[h.options.attrkey]),!h.options.charsAsChildren&&h.options.charkey in c&&(L[h.options.charkey]=c[h.options.charkey],delete c[h.options.charkey]),Object.getOwnPropertyNames(c).length>0&&(L[h.options.childkey]=c),c=L;else if(k){k[h.options.childkey]=k[h.options.childkey]||[],_={};for(P in c)d.call(c,P)&&r(_,P,c[P]);k[h.options.childkey].push(_),delete c["#name"],Object.keys(c).length===1&&y in c&&!h.EXPLICIT_CHARKEY&&(c=c[y])}}return T.length>0?h.assignOrPush(k,S,c):(h.options.explicitRoot&&(F=c,c={},r(c,S,F)),h.resultObject=c,h.saxParser.ended=!0,h.emit("end",h.resultObject))}}(this),D=function(h){return function(w){var I,P;if(P=T[T.length-1],P)return P[y]+=w,h.options.explicitChildren&&h.options.preserveChildrenOrder&&h.options.charsAsChildren&&(h.options.includeWhiteChars||w.replace(/\\n/g,"").trim()!=="")&&(P[h.options.childkey]=P[h.options.childkey]||[],I={"#name":"__text__"},I[y]=w,h.options.normalize&&(I[y]=I[y].replace(/\s{2,}/g," ").trim()),P[h.options.childkey].push(I)),P}}(this),this.saxParser.ontext=D,this.saxParser.oncdata=function(h){return function(w){var I;if(I=D(w),I)return I.cdata=!0}}()},E.prototype.parseString=function(v,y){var D;y!=null&&typeof y=="function"&&(this.on("end",function(T){return this.reset(),y(null,T)}),this.on("error",function(T){return this.reset(),y(T)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=t.stripBOM(v),this.options.async?(this.remaining=v,l(this.processAsync),this.saxParser):this.saxParser.write(v).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}},E.prototype.parseStringPromise=function(v){return new Promise(function(y){return function(D,T){return y.parseString(v,function(h,w){return h?T(h):D(w)})}}(this))},E}(o),e.parseString=function(b,E,v){var y,D,T;return v!=null?(typeof v=="function"&&(y=v),typeof E=="object"&&(D=E)):(typeof E=="function"&&(y=E),D={}),T=new e.Parser(D),T.parseString(b,y)},e.parseStringPromise=function(b,E){var v,y;return typeof E=="object"&&(v=E),y=new e.Parser(v),y.parseStringPromise(b)}}).call(H)}(Xt)),Xt}var ti;(function(){var e,t,n,r=function(i,s){for(var a in s)o.call(s,a)&&(i[a]=s[a]);function u(){this.constructor=i}return u.prototype=s.prototype,i.prototype=new u,i.__super__=s.prototype,i},o={}.hasOwnProperty;t=en(),e=ho(),n=yo(),ei(),t.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),e.Builder,n.Parser,n.parseString,ti=n.parseStringPromise}).call(H);class bo{constructor(t,n,r){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=n,this.readPHPFile=r.getPHPFile,this.phpRoot=r.phpRoot||"";for(const o of r.knownScriptUrls)this.scriptIdByUrl.set(o,this.getOrCreateScriptId(o));this.breakOnFirstLine=r.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 n=await ti(t,{explicitArray:!1});await this.handleDbgpMessage(n)}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! 🎉
78
78
  ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
79
79
 
80
80
  1. Add breakpoints in your files to start step debugging.
@@ -82,13 +82,13 @@ Actual: `+m.attribValue);else{var Y=m.tag,J=m.tags[m.tags.length-1]||m;Y.ns===J.
82
82
  2. Run your php file, project, plugin or theme using PHP.wasm or Playground CLI.
83
83
 
84
84
  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,n]of this.scriptIdByUrl.entries())await this.sendScriptToCDP(t,n)}async sendScriptToCDP(t,n){const r=this.uriFromBridgeToCDPSyntaxHighlight(t),o=this.uriFromBridgeToCDP(t);try{const i=await this.readPHPFile(t),s=i.split(`
85
- `),a=s.map((l,h)=>h===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a},d=`data:application/json;base64,${Buffer.from(JSON.stringify(u),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:n,url:o,startLine:0,startColumn:0,endLine:s.length,endColumn:0,executionContextId:1,sourceMapURL:d}})}catch(i){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:i.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let n=this.scriptIdByUrl.get(t);return n||(n=Ti("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,n)),n}formatPropertyFullName(t){let n=!1,r="";for(const o of t)o==='"'||o==="\\"||o==="\0"?(r+="\\"+o,n=!0):o===" "?(r+=o,n=!0):r+=o;return(n||t.includes("'"))&&(r=`"${r}"`),r}sendDbgpCommand(t,n){const o=(this.nextTxnId++).toString();let i=`${t} -i ${o}`;return n!==void 0&&(i+=` ${n}`),this.dbgp.sendCommand(i),o}async handleCdpMessage(t){const{id:n,method:r,params:o}=t;let i={},s=!0;switch(r){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:a,lineNumber:u}=o;if(!a){s=!1;break}const p=this.uriFromCDPToBridge(a),d=this.uriFromBridgeToDBGP(p),l=(typeof u=="number"?u:0)+1,h=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(d)} -n ${l}`,T=this.sendDbgpCommand(b);this.pendingCommands.set(T,{cdpId:n,cdpMethod:r,params:{breakpointId:h,fileUri:p,lineNumber:l}}),s=!1}else this.breakpoints.set(h,{cdpId:h,xdebugId:null,fileUri:p,lineNumber:l}),i={breakpointId:h,locations:[{scriptId:this.getOrCreateScriptId(p),lineNumber:l-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),p=this.breakpoints.get(u);if(p){if(p.xdebugId&&this.xdebugConnected){const d=`breakpoint_remove -d ${p.xdebugId}`,l=this.sendDbgpCommand(d);this.pendingCommands.set(l,{cdpId:n,cdpMethod:r}),s=!1}this.breakpoints.delete(u)}i={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),i={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),i={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),i={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),i={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),i={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const a=o.expression||"",u=o.callFrameId;if(r==="Debugger.evaluateOnCallFrame"){if(u===void 0||!this.callFramesMap.has(u)){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(u)!==0){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const p=Buffer.from(a).toString("base64"),d=this.sendDbgpCommand("eval",`-- ${p}`);this.pendingCommands.set(d,{cdpId:n,cdpMethod:r}),s=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:a}=o,u=this.objectHandles.get(a);if(u&&this.xdebugConnected)if(u.type==="context"){const p=u.contextId??0,l=`context_get -d ${u.depth} -c ${p} -p 0 -m 32`,h=this.sendDbgpCommand(l),b={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,b),this.pendingCommands.set(h,{cdpId:n,cdpMethod:r,params:{objectId:a}}),s=!1}else if(u.type==="property"){const p=u.depth,d=u.fullname,l=this.formatPropertyFullName(d),h=`property_get -d ${p} -n ${l} -p 0 -m 32`,b=this.sendDbgpCommand(h),T={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,T),this.pendingCommands.set(b,{cdpId:n,cdpMethod:r,params:{parentObjectId:a}}),s=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const a=o.scriptId,u=[...this.scriptIdByUrl.entries()].find(([,d])=>d===a)?.[0],p=[];u&&p.push(`Here's the full path for your convenience:
85
+ `),a=s.map((p,d)=>d===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a},f=`data:application/json;base64,${Buffer.from(JSON.stringify(u),"utf-8").toString("base64")}`;this.cdp.sendMessage({method:"Debugger.scriptParsed",params:{scriptId:n,url:o,startLine:0,startColumn:0,endLine:s.length,endColumn:0,executionContextId:1,sourceMapURL:f}})}catch(i){this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:"warning",text:i.message,timestamp:Date.now()}}})}}getOrCreateScriptId(t){let n=this.scriptIdByUrl.get(t);return n||(n=Ti("sha256").update(String(this.nextScriptId++)).digest("hex").slice(0,16),this.scriptIdByUrl.set(t,n)),n}formatPropertyFullName(t){let n=!1,r="";for(const o of t)o==='"'||o==="\\"||o==="\0"?(r+="\\"+o,n=!0):o===" "?(r+=o,n=!0):r+=o;return(n||t.includes("'"))&&(r=`"${r}"`),r}sendDbgpCommand(t,n){const o=(this.nextTxnId++).toString();let i=`${t} -i ${o}`;return n!==void 0&&(i+=` ${n}`),this.dbgp.sendCommand(i),o}async handleCdpMessage(t){const{id:n,method:r,params:o}=t;let i={},s=!0;switch(r){case"Debugger.enable":case"Runtime.enable":i={};break;case"Debugger.setBreakpointByUrl":{const{url:a,lineNumber:u}=o;if(!a){s=!1;break}const l=this.uriFromCDPToBridge(a),f=this.uriFromBridgeToDBGP(l),p=(typeof u=="number"?u:0)+1,d=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(f)} -n ${p}`,E=this.sendDbgpCommand(b);this.pendingCommands.set(E,{cdpId:n,cdpMethod:r,params:{breakpointId:d,fileUri:l,lineNumber:p}}),s=!1}else this.breakpoints.set(d,{cdpId:d,xdebugId:null,fileUri:l,lineNumber:p}),i={breakpointId:d,locations:[{scriptId:this.getOrCreateScriptId(l),lineNumber:p-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),l=this.breakpoints.get(u);if(l){if(l.xdebugId&&this.xdebugConnected){const f=`breakpoint_remove -d ${l.xdebugId}`,p=this.sendDbgpCommand(f);this.pendingCommands.set(p,{cdpId:n,cdpMethod:r}),s=!1}this.breakpoints.delete(u)}i={};break}case"Debugger.resume":{this.xdebugConnected&&this.sendDbgpCommand("run"),i={};break}case"Debugger.stepOver":{this.xdebugConnected&&this.sendDbgpCommand("step_over"),i={};break}case"Debugger.stepInto":{this.xdebugConnected&&this.sendDbgpCommand("step_into"),i={};break}case"Debugger.stepOut":{this.xdebugConnected&&this.sendDbgpCommand("step_out"),i={};break}case"Debugger.pause":{this.xdebugConnected&&this.sendDbgpCommand("break"),i={};break}case"Runtime.evaluate":case"Debugger.evaluateOnCallFrame":{const a=o.expression||"",u=o.callFrameId;if(r==="Debugger.evaluateOnCallFrame"){if(u===void 0||!this.callFramesMap.has(u)){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"No such call frame"}});return}if(this.callFramesMap.get(u)!==0){this.cdp.sendMessage({id:n,error:{code:-32e3,message:"Evaluation in this frame not supported"}});return}}if(this.xdebugConnected){const l=Buffer.from(a).toString("base64"),f=this.sendDbgpCommand("eval",`-- ${l}`);this.pendingCommands.set(f,{cdpId:n,cdpMethod:r}),s=!1}else i={result:{type:"undefined",value:void 0}};break}case"Runtime.getProperties":{const{objectId:a}=o,u=this.objectHandles.get(a);if(u&&this.xdebugConnected)if(u.type==="context"){const l=u.contextId??0,p=`context_get -d ${u.depth} -c ${l} -p 0 -m 32`,d=this.sendDbgpCommand(p),b={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,b),this.pendingCommands.set(d,{cdpId:n,cdpMethod:r,params:{objectId:a}}),s=!1}else if(u.type==="property"){const l=u.depth,f=u.fullname,p=this.formatPropertyFullName(f),d=`property_get -d ${l} -n ${p} -p 0 -m 32`,b=this.sendDbgpCommand(d),E={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,E),this.pendingCommands.set(b,{cdpId:n,cdpMethod:r,params:{parentObjectId:a}}),s=!1}else i={result:[]};else i={result:[]};break}case"Debugger.getScriptSource":{const a=o.scriptId,u=[...this.scriptIdByUrl.entries()].find(([,f])=>f===a)?.[0],l=[];u&&l.push(`Here's the full path for your convenience:
86
86
  `,`${this.uriFromBridgeToCDPSyntaxHighlight(u).replace("file://","")}
87
- `),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...p,"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:
87
+ `),i={scriptSource:["`Are you looking for your source code?","Go to PHP.wasm group in the navigator and find it there.",...l,"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:
88
88
  `,"https://github.com/WordPress/wordpress-playground/pull/2566`"].join(`
89
- `)};break}default:i={};break}s&&this.cdp.sendMessage({id:n,result:i})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const n="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,r])=>r===t.slice(n.length))?.[0]??""}uriFromBridgeToDBGP(t){return oe.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const n=t.indexOf(this.phpRoot);return n!==-1?t.slice(n):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(r=>{this.handleCdpMessage({id:r.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(r.fileUri),lineNumber:r.lineNumber-1}})});const n=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(n,{});return}if(t.response){const n=t.response,r=n.$,o=r.command,i=r.transaction_id,s=this.pendingCommands.get(i);switch(o){case"breakpoint_set":{if(s&&s.cdpId!==void 0&&s.cdpMethod==="Debugger.setBreakpointByUrl"){const a=r.id,u=s.params;if(u){const{breakpointId:p,fileUri:d,lineNumber:l}=u;this.breakpoints.set(p,{cdpId:p,xdebugId:a,fileUri:d,lineNumber:l});const h=this.getOrCreateScriptId(d),b={breakpointId:p,locations:[{scriptId:h,lineNumber:l-1,columnNumber:0}]};this.cdp.sendMessage({id:s.cdpId,result:b})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const a=r.status;if(n["xdebug:message"]){const u=this.uriFromDBGPToBridge(n["xdebug:message"].$.filename);u&&!this.scriptIdByUrl.has(u)&&await this.sendScriptToCDP(u,this.getOrCreateScriptId(u))}if(a==="break"){const u=this.sendDbgpCommand("stack_get");this.pendingCommands.set(u,{}),this.pendingCommands.delete(i)}else(a==="stopping"||a==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(s&&s.cdpId!==void 0){let a;if(n.property){const p=n.property,d=p.$.type,l=p.$.encoding;let h=null;if(Object.prototype.hasOwnProperty.call(p,"_")?h=p._:typeof p.$value<"u"&&(h=p.$value),l==="base64"&&h!==null)try{h=Buffer.from(h,"base64").toString()}catch{}if(d==="string")a={type:"string",value:h??""};else if(d==="int"||d==="float"||d==="bool"||d==="boolen"||d==="integer"||d==="double"){let b=h;d.startsWith("int")||d==="integer"?b=parseInt(h||"0",10):d==="float"||d==="double"?b=parseFloat(h||"0"):d.startsWith("bool")&&(b=h==="1"||h==="true"),a={type:"number",value:b}}else if(d==="array"||d==="object"){const b=p.$.classname||(d==="array"?"Array":"Object"),T=String(this.nextObjectId++),O=p.$.fullname||"";this.objectHandles.set(T,{type:"property",depth:0,contextId:0,fullname:O}),a={type:"object",objectId:T,className:b,description:b}}else d==="null"?a={type:"object",subtype:"null",value:null}:a={type:"undefined",value:void 0}}else a={type:"undefined",value:void 0};const u={result:a};this.cdp.sendMessage({id:s.cdpId,result:u}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(s&&s.cdpId!==void 0){const a=s.params?.objectId||s.params?.parentObjectId,u=a?this.objectHandles.get(a):null,p=n.property?.property??n.property,d=[];if(p){const l=Array.isArray(p)?p:[p];for(const h of l){const b=h.$.name||h.$.fullname||"";let T=h.$.type||"undefined";const O=h.$.children==="1",y=h.$.encoding;let D=null;if(typeof h._<"u"&&(D=h._),y==="base64"&&D!==null)try{D=Buffer.from(D,"base64").toString()}catch{}if(O){const E=h.$.classname||(T==="array"?"Array":"Object"),f=String(this.nextObjectId++),w=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.contextId||0,I=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.depth||0;this.objectHandles.set(f,{type:"property",depth:I,contextId:w,fullname:h.$.fullname||b}),d.push({name:h.$.key||b,value:{type:"object",className:E,description:E,objectId:f},writable:!1,configurable:!1,enumerable:!0})}else{let E,f;T==="string"?E=D??"":T==="int"||T==="integer"?E=parseInt(D||"0",10):T==="float"||T==="double"?E=parseFloat(D||"0"):T==="bool"||T==="boolean"?(E=D==="1"||D==="true",T="boolean"):T==="null"?(E=null,f="null"):E=D;const w={type:T==="integer"?"number":T};f&&(w.subtype=f),w.value=E,d.push({name:h.$.key||b,value:w,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const l=(u.aggregatedProps||[]).concat(d),h=32;if(d.length===h){const T=(u.currentPage||0)+1,O={...u,currentPage:T,aggregatedProps:l};this.objectHandles.set(a,O);let y;if(o==="context_get"){const E=u.contextId??0;y=`context_get -d ${u.depth} -c ${E} -p ${T} -m ${h}`}else{const E=u.depth,f=u.fullname,w=this.formatPropertyFullName(f);y=`property_get -d ${E} -n ${w} -p ${T} -m ${h}`}const D=this.sendDbgpCommand(y);this.pendingCommands.set(D,{cdpId:s.cdpId,cdpMethod:s.cdpMethod,params:s.params}),this.pendingCommands.delete(i);return}else{const T={result:l};this.cdp.sendMessage({id:s.cdpId,result:T}),this.pendingCommands.delete(i)}}else{const l={result:d};this.cdp.sendMessage({id:s.cdpId,result:l}),this.pendingCommands.delete(i)}}break}case"stack_get":{if(n.stack){const a=Array.isArray(n.stack)?n.stack:[n.stack],u=[];this.callFramesMap.clear();for(const d of a){const l=this.uriFromDBGPToBridge(d.$.filename),h=this.getOrCreateScriptId(l);this.scriptIdByUrl.has(l)||(this.scriptIdByUrl.set(l,h),await this.sendScriptToCDP(l,h))}for(const d of a){const l=parseInt(d.$.level,10),h=this.uriFromDBGPToBridge(d.$.filename),b=parseInt(d.$.lineno,10),T=d.$.where&&d.$.where!=="{main}"?d.$.where:"(anonymous)",O=`frame:${l}`;this.callFramesMap.set(O,l);const y=[],D=String(this.nextObjectId++);this.objectHandles.set(D,{type:"context",contextId:0,depth:l}),y.push({type:"local",object:{objectId:D,className:"Object",description:"Local"}});const E=String(this.nextObjectId++);this.objectHandles.set(E,{type:"context",contextId:1,depth:l}),y.push({type:"global",object:{objectId:E,className:"Object",description:"Global"}}),u.push({callFrameId:O,functionName:T,location:{scriptId:this.getOrCreateScriptId(h),lineNumber:b-1,columnNumber:0},scopeChain:y,this:{type:"object",className:"Object",description:"Object",objectId:E}})}let p="pause";if(a.length>0){const d=a[0];if(d.$.filename&&d.$.lineno){const l=this.uriFromDBGPToBridge(d.$.filename),h=parseInt(d.$.lineno,10);for(const b of this.breakpoints.values())if(b.fileUri===l&&b.lineNumber===h){p="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:p,callFrames:u,hitBreakpoints:p==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const n=t.stream,r=n.$.type,o=n.$.encoding||"none";let i=typeof n._=="string"?n._:"";o==="base64"&&(i=Buffer.from(i,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:r==="stderr"?"error":"info",text:i,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function bo(e){const t=e.cdpPort??9229,n=e.dbgpPort??9003,r=e.cdpHost??"localhost",o=e.phpRoot??process.cwd(),i=e.breakOnFirstLine??!1;de.log("Starting XDebug Bridge...");const s=new qs(t);de.log("Connect Chrome DevTools to CDP at:"),de.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${t}
90
- `),await new Promise(l=>s.on("clientConnected",l)),await new Promise(l=>setTimeout(l,2e3)),de.log("Chrome connected! Initializing Xdebug receiver...");const a=new Ws(n);de.log(`XDebug receiver running on port ${n}`),de.log("Running a PHP script with Xdebug enabled...");async function u(l){const h=[],b=e.phpInstance?await e.phpInstance.listFiles(l):ui(l);for(const T of b){const O=oe.join(l,T);try{(e.phpInstance?await e.phpInstance.isDir(O):ci(O).isDirectory())?h.push(...await u(O)):T.endsWith(".php")&&h.push(O)}catch{}}return h}const p=e.phpInstance?l=>e.phpInstance.readFileAsText(l):e.getPHPFile?e.getPHPFile:l=>Qt(l,"utf-8"),d=await u(o);return new yo(a,s,{knownScriptUrls:d,phpRoot:o,getPHPFile:p,breakOnFirstLine:i})}let se=process.argv.slice(2);se.length||(se=["--help"]);const Me=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,Tr=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,wo=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,ti=(import.meta||{}).url,zt=new URL("ca-bundle.crt",ti).pathname;li(zt)||Er(zt,pi.join(`
91
- `));se.unshift("-d",`openssl.cafile=${zt}`);async function To(){const e=new URL("php.ini",ti).pathname,t=process.env.PHP||ni;if(!ri.includes(t))throw new Error(`Unsupported PHP version ${t}`);const n=se.some(h=>h.startsWith("--xdebug"));n&&(se=se.filter(h=>h!=="--xdebug"));const r=se.some(h=>h.startsWith("--experimental-devtools"));r&&(se=se.filter(h=>h!=="--experimental-devtools"));const o=se.filter(h=>h.startsWith("--experimental-unsafe-ide-integration")).map(h=>{const b=h.split("=")[1];return b===void 0?["vscode","phpstorm"]:b.includes(",")?b.split(","):[b]})[0]??!1;o&&(se=se.filter(h=>!h.startsWith("--experimental-unsafe-ide-integration")));const{TMPDIR:i,...s}=process.env,a=mn(oe.join(yn.tmpdir(),"php-wasm-bin"));Er(`${a}/php`,`#!/bin/sh
89
+ `)};break}default:i={};break}s&&this.cdp.sendMessage({id:n,result:i})}uriFromBridgeToCDPSyntaxHighlight(t){return`file://PHP.wasm/${t}`}uriFromBridgeToCDP(t){return t=this.scriptIdByUrl.get(t)??"",`file://placeholders/${t}`}uriFromCDPToBridge(t){const n="file://placeholders/";return[...this.scriptIdByUrl.entries()].find(([,r])=>r===t.slice(n.length))?.[0]??""}uriFromBridgeToDBGP(t){return oe.resolve(process.cwd(),t)}uriFromDBGPToBridge(t){t=t.startsWith("file://")?t.slice(7):t;const n=t.indexOf(this.phpRoot);return n!==-1?t.slice(n):t}async handleDbgpMessage(t){if(t.init){this.breakpoints.forEach(r=>{this.handleCdpMessage({id:r.cdpId,method:"Debugger.setBreakpointByUrl",params:{url:this.uriFromBridgeToCDP(r.fileUri),lineNumber:r.lineNumber-1}})});const n=this.breakOnFirstLine?this.sendDbgpCommand("step_into"):this.sendDbgpCommand("run");this.pendingCommands.set(n,{});return}if(t.response){const n=t.response,r=n.$,o=r.command,i=r.transaction_id,s=this.pendingCommands.get(i);switch(o){case"breakpoint_set":{if(s&&s.cdpId!==void 0&&s.cdpMethod==="Debugger.setBreakpointByUrl"){const a=r.id,u=s.params;if(u){const{breakpointId:l,fileUri:f,lineNumber:p}=u;this.breakpoints.set(l,{cdpId:l,xdebugId:a,fileUri:f,lineNumber:p});const d=this.getOrCreateScriptId(f),b={breakpointId:l,locations:[{scriptId:d,lineNumber:p-1,columnNumber:0}]};this.cdp.sendMessage({id:s.cdpId,result:b})}this.pendingCommands.delete(i)}break}case"breakpoint_remove":{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}case"run":case"step_into":case"step_over":case"step_out":{const a=r.status;if(n["xdebug:message"]){const u=this.uriFromDBGPToBridge(n["xdebug:message"].$.filename);u&&!this.scriptIdByUrl.has(u)&&await this.sendScriptToCDP(u,this.getOrCreateScriptId(u))}if(a==="break"){const u=this.sendDbgpCommand("stack_get");this.pendingCommands.set(u,{}),this.pendingCommands.delete(i)}else(a==="stopping"||a==="stopped")&&this.cdp.sendMessage({method:"Debugger.resumed",params:{}});break}case"eval":{if(s&&s.cdpId!==void 0){let a;if(n.property){const l=n.property,f=l.$.type,p=l.$.encoding;let d=null;if(Object.prototype.hasOwnProperty.call(l,"_")?d=l._:typeof l.$value<"u"&&(d=l.$value),p==="base64"&&d!==null)try{d=Buffer.from(d,"base64").toString()}catch{}if(f==="string")a={type:"string",value:d??""};else if(f==="int"||f==="float"||f==="bool"||f==="boolen"||f==="integer"||f==="double"){let b=d;f.startsWith("int")||f==="integer"?b=parseInt(d||"0",10):f==="float"||f==="double"?b=parseFloat(d||"0"):f.startsWith("bool")&&(b=d==="1"||d==="true"),a={type:"number",value:b}}else if(f==="array"||f==="object"){const b=l.$.classname||(f==="array"?"Array":"Object"),E=String(this.nextObjectId++),v=l.$.fullname||"";this.objectHandles.set(E,{type:"property",depth:0,contextId:0,fullname:v}),a={type:"object",objectId:E,className:b,description:b}}else f==="null"?a={type:"object",subtype:"null",value:null}:a={type:"undefined",value:void 0}}else a={type:"undefined",value:void 0};const u={result:a};this.cdp.sendMessage({id:s.cdpId,result:u}),this.pendingCommands.delete(i)}break}case"context_get":case"property_get":{if(s&&s.cdpId!==void 0){const a=s.params?.objectId||s.params?.parentObjectId,u=a?this.objectHandles.get(a):null,l=n.property?.property??n.property,f=[];if(l){const p=Array.isArray(l)?l:[l];for(const d of p){const b=d.$.name||d.$.fullname||"";let E=d.$.type||"undefined";const v=d.$.children==="1",y=d.$.encoding;let D=null;if(typeof d._<"u"&&(D=d._),y==="base64"&&D!==null)try{D=Buffer.from(D,"base64").toString()}catch{}if(v){const T=d.$.classname||(E==="array"?"Array":"Object"),h=String(this.nextObjectId++),w=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.contextId||0,I=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.depth||0;this.objectHandles.set(h,{type:"property",depth:I,contextId:w,fullname:d.$.fullname||b}),f.push({name:d.$.key||b,value:{type:"object",className:T,description:T,objectId:h},writable:!1,configurable:!1,enumerable:!0})}else{let T,h;E==="string"?T=D??"":E==="int"||E==="integer"?T=parseInt(D||"0",10):E==="float"||E==="double"?T=parseFloat(D||"0"):E==="bool"||E==="boolean"?(T=D==="1"||D==="true",E="boolean"):E==="null"?(T=null,h="null"):T=D;const w={type:E==="integer"?"number":E};h&&(w.subtype=h),w.value=T,f.push({name:d.$.key||b,value:w,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const p=(u.aggregatedProps||[]).concat(f),d=32;if(f.length===d){const E=(u.currentPage||0)+1,v={...u,currentPage:E,aggregatedProps:p};this.objectHandles.set(a,v);let y;if(o==="context_get"){const T=u.contextId??0;y=`context_get -d ${u.depth} -c ${T} -p ${E} -m ${d}`}else{const T=u.depth,h=u.fullname,w=this.formatPropertyFullName(h);y=`property_get -d ${T} -n ${w} -p ${E} -m ${d}`}const D=this.sendDbgpCommand(y);this.pendingCommands.set(D,{cdpId:s.cdpId,cdpMethod:s.cdpMethod,params:s.params}),this.pendingCommands.delete(i);return}else{const E={result:p};this.cdp.sendMessage({id:s.cdpId,result:E}),this.pendingCommands.delete(i)}}else{const p={result:f};this.cdp.sendMessage({id:s.cdpId,result:p}),this.pendingCommands.delete(i)}}break}case"stack_get":{if(n.stack){const a=Array.isArray(n.stack)?n.stack:[n.stack],u=[];this.callFramesMap.clear();for(const f of a){const p=this.uriFromDBGPToBridge(f.$.filename),d=this.getOrCreateScriptId(p);this.scriptIdByUrl.has(p)||(this.scriptIdByUrl.set(p,d),await this.sendScriptToCDP(p,d))}for(const f of a){const p=parseInt(f.$.level,10),d=this.uriFromDBGPToBridge(f.$.filename),b=parseInt(f.$.lineno,10),E=f.$.where&&f.$.where!=="{main}"?f.$.where:"(anonymous)",v=`frame:${p}`;this.callFramesMap.set(v,p);const y=[],D=String(this.nextObjectId++);this.objectHandles.set(D,{type:"context",contextId:0,depth:p}),y.push({type:"local",object:{objectId:D,className:"Object",description:"Local"}});const T=String(this.nextObjectId++);this.objectHandles.set(T,{type:"context",contextId:1,depth:p}),y.push({type:"global",object:{objectId:T,className:"Object",description:"Global"}}),u.push({callFrameId:v,functionName:E,location:{scriptId:this.getOrCreateScriptId(d),lineNumber:b-1,columnNumber:0},scopeChain:y,this:{type:"object",className:"Object",description:"Object",objectId:T}})}let l="pause";if(a.length>0){const f=a[0];if(f.$.filename&&f.$.lineno){const p=this.uriFromDBGPToBridge(f.$.filename),d=parseInt(f.$.lineno,10);for(const b of this.breakpoints.values())if(b.fileUri===p&&b.lineNumber===d){l="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:l,callFrames:u,hitBreakpoints:l==="breakpoint"?[""]:[]}})}this.pendingCommands.delete(i);break}default:{s&&s.cdpId!==void 0&&(this.cdp.sendMessage({id:s.cdpId,result:{}}),this.pendingCommands.delete(i));break}}}else if(t.stream){const n=t.stream,r=n.$.type,o=n.$.encoding||"none";let i=typeof n._=="string"?n._:"";o==="base64"&&(i=Buffer.from(i,"base64").toString()),this.cdp.sendMessage({method:"Log.entryAdded",params:{entry:{source:"other",level:r==="stderr"?"error":"info",text:i,timestamp:Date.now(),stackTrace:{callFrames:[]}}}})}else t.notify}}async function wo(e){const t=e.cdpPort??9229,n=e.dbgpPort??9003,r=e.cdpHost??"localhost",o=e.phpRoot??process.cwd(),i=e.breakOnFirstLine??!1;de.log("Starting XDebug Bridge...");const s=new Ws(t);de.log("Connect Chrome DevTools to CDP at:"),de.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${t}
90
+ `),await new Promise(p=>s.on("clientConnected",p)),await new Promise(p=>setTimeout(p,2e3)),de.log("Chrome connected! Initializing Xdebug receiver...");const a=new Hs(n);de.log(`XDebug receiver running on port ${n}`),de.log("Running a PHP script with Xdebug enabled...");async function u(p){const d=[],b=e.phpInstance?await e.phpInstance.listFiles(p):li(p);for(const E of b){const v=oe.join(p,E);try{(e.phpInstance?await e.phpInstance.isDir(v):fi(v).isDirectory())?d.push(...await u(v)):E.endsWith(".php")&&d.push(v)}catch{}}return d}const l=e.phpInstance?p=>e.phpInstance.readFileAsText(p):e.getPHPFile?e.getPHPFile:p=>Qt(p,"utf-8"),f=await u(o);return new bo(a,s,{knownScriptUrls:f,phpRoot:o,getPHPFile:l,breakOnFirstLine:i})}let se=process.argv.slice(2);se.length||(se=["--help"]);const Me=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,Er=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,Eo=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,ni=(import.meta||{}).url,zt=new URL("ca-bundle.crt",ni).pathname;pi(zt)||Tr(zt,di.join(`
91
+ `));se.unshift("-d",`openssl.cafile=${zt}`);async function To(){const e=new URL("php.ini",ni).pathname,t=process.env.PHP||ri;if(!ii.includes(t))throw new Error(`Unsupported PHP version ${t}`);const n=se.some(d=>d.startsWith("--xdebug"));n&&(se=se.filter(d=>d!=="--xdebug"));const r=se.some(d=>d.startsWith("--experimental-devtools"));r&&(se=se.filter(d=>d!=="--experimental-devtools"));const o=se.filter(d=>d.startsWith("--experimental-unsafe-ide-integration")).map(d=>{const b=d.split("=")[1];return b===void 0?["vscode","phpstorm"]:b.includes(",")?b.split(","):[b]})[0]??!1;o&&(se=se.filter(d=>!d.startsWith("--experimental-unsafe-ide-integration")));const{TMPDIR:i,...s}=process.env,a=mn(oe.join(yn.tmpdir(),"php-wasm-bin"));Tr(`${a}/php`,`#!/bin/sh
92
92
  ${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}
93
- `),fi(`${a}/php`,493);const u=mn(oe.join(yn.tmpdir(),"php-wasm-sys-tmp")),p=new ii(await di(t,{emscriptenOptions:{fileLockManager:new gi,processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},withXdebug:n}));if(p.setSpawnHandler((h,b)=>si(h,b,{shell:!0,stdio:["pipe","pipe","pipe"]})),mi(p),n&&o)try{const h="PHP.wasm CLI - Listen for Xdebug",b=o;await _s(h,process.cwd());const T=await xs({name:h,host:"example.com",port:443,ides:b,cwd:process.cwd()}),O=b.includes("vscode"),y=b.includes("phpstorm"),D=Object.values(T);console.log(""),D.length>0?(console.log(Me("Xdebug configured successfully")),console.log(wo("Updated IDE config: ")+D.join(" "))):(console.log(Me("Xdebug configuration failed.")),console.log("No IDE-specific project settings directory was found in the current working directory.")),console.log(""),O&&T.vscode&&(console.log(Me("VS Code / Cursor instructions:")),console.log(" 1. Ensure you have installed an IDE extension for PHP Debugging"),console.log(` (The ${Me("PHP Debug")} extension by ${Me("Xdebug")} has been a solid option)`),console.log(" 2. Open the Run and Debug panel on the left sidebar"),console.log(` 3. Select "${Tr(h)}" 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."),y&&console.log("")),y&&T.phpstorm&&(console.log(Me("PhpStorm instructions:")),console.log(` 1. Choose "${Tr(h)}" 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(h){throw new Error("Could not configure Xdebug",{cause:h})}n&&r&&(await bo({breakOnFirstLine:!0})).start(),se.some(h=>h.startsWith("-c"))||se.unshift("-c",e);const l=await p.cli(["php",...se]);l.stderr.pipeTo(new WritableStream({write(h){process.stderr.write(h)}})),l.stdout.pipeTo(new WritableStream({write(h){process.stdout.write(h)}})),await l.exitCode.catch(h=>{throw h.name==="ExitStatus"&&process.exit(h.status===void 0?1:h.status),h}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}To();
93
+ `),hi(`${a}/php`,493);const u=mn(oe.join(yn.tmpdir(),"php-wasm-sys-tmp")),l=new si(await mi(t,{fileLockManager:new oi,emscriptenOptions:{processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},withXdebug:n}));if(l.setSpawnHandler((d,b)=>ai(d,b,{shell:!0,stdio:["pipe","pipe","pipe"]})),yi(l),n&&o)try{const d="PHP.wasm CLI - Listen for Xdebug",b=o;await Ds(d,process.cwd());const E=await _s({name:d,host:"example.com",port:443,ides:b,cwd:process.cwd()}),v=b.includes("vscode"),y=b.includes("phpstorm"),D=Object.values(E);console.log(""),D.length>0?(console.log(Me("Xdebug configured successfully")),console.log(Eo("Updated IDE config: ")+D.join(" "))):(console.log(Me("Xdebug configuration failed.")),console.log("No IDE-specific project settings directory was found in the current working directory.")),console.log(""),v&&E.vscode&&(console.log(Me("VS Code / Cursor instructions:")),console.log(" 1. Ensure you have installed an IDE extension for PHP Debugging"),console.log(` (The ${Me("PHP Debug")} extension by ${Me("Xdebug")} has been a solid option)`),console.log(" 2. Open the Run and Debug panel on the left sidebar"),console.log(` 3. Select "${Er(d)}" 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."),y&&console.log("")),y&&E.phpstorm&&(console.log(Me("PhpStorm instructions:")),console.log(` 1. Choose "${Er(d)}" 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(d){throw new Error("Could not configure Xdebug",{cause:d})}n&&r&&(await wo({breakOnFirstLine:!0})).start(),se.some(d=>d.startsWith("-c"))||se.unshift("-c",e);const p=await l.cli(["php",...se]);p.stderr.pipeTo(new WritableStream({write(d){process.stderr.write(d)}})),p.stdout.pipeTo(new WritableStream({write(d){process.stdout.write(d)}})),await p.exitCode.catch(d=>{throw d.name==="ExitStatus"&&process.exit(d.status===void 0?1:d.status),d}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}To();
94
94
  //# sourceMappingURL=main.js.map