@php-wasm/cli 3.1.5 → 3.1.8

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 +43 -43
  2. package/main.js.map +1 -1
  3. package/package.json +7 -8
package/main.js CHANGED
@@ -1,80 +1,80 @@
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 Jt,writeFile as ui,statSync as ci,readdirSync as li,lstatSync as fi,existsSync as pi,writeFileSync as Nr,mkdtempSync as yn,chmodSync as hi}from"fs";import bn from"os";import{rootCertificates as di}from"tls";import oe,{resolve as Zt,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 Ir}from"util";import{fileURLToPath as Ei}from"url";import{createHash as Ti}from"crypto";import Ni from"timers";function Or(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",Ii=vr+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Oi="["+vr+"]["+Ii+"]*",vi=new RegExp("^"+Oi+"$");function xr(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=En(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--),!ji(u)){let f;return u.trim().length===0?f="Invalid space after '<'.":f="Tag '"+u+"' is an invalid name.",Z("InvalidTag",f,ie(e,i))}const c=Di(e,i);if(c===!1)return Z("InvalidAttr","Attributes for '"+u+"' have open quote.",ie(e,i));let p=c.value;if(i=c.index,p[p.length-1]==="/"){const f=i-p.length;p=p.substring(0,p.length-1);const d=Nn(p,t);if(d===!0)r=!0;else return Z(d.err.code,d.err.msg,ie(e,f+d.err.line))}else if(a)if(c.tagClosed){if(p.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 f=n.pop();if(u!==f.tagName){let d=ie(e,f.tagStartPos);return Z("InvalidTag","Expected closing tag '"+f.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 f=Nn(p,t);if(f!==!0)return Z(f.err.code,f.err.msg,ie(e,i-p.length+f.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=En(e,++i),i.err)return i}else break;else if(e[i]==="&"){const f=Ci(e,i);if(f==-1)return Z("InvalidChar","char '&' is not expected.",ie(e,i));i=f}else if(o===!0&&!wn(e[i]))return Z("InvalidXml","Extra text at the end",ie(e,i));e[i]==="<"&&i--}}else{if(wn(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 wn(e){return e===" "||e===" "||e===`
3
- `||e==="\r"}function En(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='"',_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 Nn(e,t){const n=xr(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(!Object.prototype.hasOwnProperty.call(r,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,maxNestedTags:100,strictReservedNames:!0};function Ar(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}:Ar(!0)}const Bi=function(e){const t=Object.assign({},ki,e);return t.processEntities=Ar(t.processEntities),t};let $e;typeof Symbol!="function"?$e="@@xmlMetadata":$e=Symbol("XML Node Metadata");class Te{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}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=Object.create(null);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&&Ie(t,"!ENTITY",n)){n+=7;let u,c;if([u,c,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),c.indexOf("&")===-1){const p=u.replace(/[.\-+*:]/g,"\\.");r[u]={regx:RegExp(`&${p};`,"g"),val:c}}}else if(i&&Ie(t,"!ELEMENT",n)){n+=8;const{index:u}=this.readElementExp(t,n+1);n=u}else if(i&&Ie(t,"!ATTLIST",n))n+=8;else if(i&&Ie(t,"!NOTATION",n)){n+=9;const{index:u}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=u}else if(Ie(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"&&Ie(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Ie(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 Ie(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),c=String(u);if(u===0)return u;if(c.search(/[eE]/)!==-1)return t.eNotation?u:e;if(n.indexOf(".")!==-1)return c==="0"||c===s||c===`${o}${s}`?u:e;let p=i?s:n;return i?p===c||o+p===c?u:e:p===c||p===o+c?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 Yi(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 zi{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)=>In(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>In(r,16,"&#x")}},this.addExternalEntities=Qi,this.parseXml=ts,this.parseTextData=Ji,this.resolveNameSpace=Zi,this.buildAttributesMap=es,this.isItStopNode=ss,this.replaceEntitiesValue=rs,this.readStopNodeData=as,this.saveTextToParentTag=is,this.addChild=ns,this.ignoreAttributesFn=Yi(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 Qi(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 Ji(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 Zi(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 Ki=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function es(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=xr(e,Ki),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],c=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(c=this.options.transformAttributeName(c)),c==="__proto__"&&(c="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u,n,t);const p=this.options.attributeValueProcessor(a,u,t);p==null?i[c]=u:typeof p!=typeof u||p!==u?i[c]=p:i[c]=qt(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[c]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const s={};return s[this.options.attributesGroupName]=i,s}return i}}const ts=function(e){e=e.replace(/\r\n?/g,`
4
- `);const t=new Te("!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 c=e.substring(s+2,u).trim();if(this.options.removeNSPrefix){const d=c.indexOf(":");d!==-1&&(c=c.substr(d+1))}this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&(r=this.saveTextToParentTag(r,n,o));const p=o.substring(o.lastIndexOf(".")+1);if(c&&this.options.unpairedTags.indexOf(c)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);let f=0;p&&this.options.unpairedTags.indexOf(p)!==-1?(f=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=o.lastIndexOf("."),o=o.substring(0,f),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 c=new Te(u.tagName);c.add(this.options.textNodeName,""),u.tagName!==u.tagExp&&u.attrExpPresent&&(c[":@"]=this.buildAttributesMap(u.tagExp,o,u.tagName)),this.addChild(n,c,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 c=e.substring(s+4,u-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:c}])}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,c=e.substring(s+9,u);r=this.saveTextToParentTag(r,n,o);let p=this.parseTextData(c,n.tagname,o,!0,!1,!0,!0);p==null&&(p=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:c}]):n.add(this.options.textNodeName,p),s=u+2}else{let u=$t(e,s,this.options.removeNSPrefix),c=u.tagName;const p=u.rawTagName;let f=u.tagExp,d=u.attrExpPresent,b=u.closeIndex;if(this.options.transformTagName){const m=this.options.transformTagName(c);f===c&&(f=m),c=m}if(this.options.strictReservedNames&&(c===this.options.commentPropName||c===this.options.cdataPropName))throw new Error(`Invalid tag name: ${c}`);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("."))),c!==t.tagname&&(o+=o?"."+c:c);const v=s;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,c)){let m="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)c[c.length-1]==="/"?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),f=c):f=f.substr(0,f.length-1),s=u.closeIndex;else if(this.options.unpairedTags.indexOf(c)!==-1)s=u.closeIndex;else{const T=this.readStopNodeData(e,p,b+1);if(!T)throw new Error(`Unexpected end of ${p}`);s=T.i,m=T.tagContent}const D=new Te(c);c!==f&&d&&(D[":@"]=this.buildAttributesMap(f,o,c)),m&&(m=this.parseTextData(m,c,o,!0,d,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),D.add(this.options.textNodeName,m),this.addChild(n,D,o,v)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){if(c[c.length-1]==="/"?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),f=c):f=f.substr(0,f.length-1),this.options.transformTagName){const D=this.options.transformTagName(c);f===c&&(f=D),c=D}const m=new Te(c);c!==f&&d&&(m[":@"]=this.buildAttributesMap(f,o,c)),this.addChild(n,m,o,v),o=o.substr(0,o.lastIndexOf("."))}else if(this.options.unpairedTags.indexOf(c)!==-1){const m=new Te(c);c!==f&&d&&(m[":@"]=this.buildAttributesMap(f,o)),this.addChild(n,m,o,v),o=o.substr(0,o.lastIndexOf(".")),s=u.closeIndex;continue}else{const m=new Te(c);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),c!==f&&d&&(m[":@"]=this.buildAttributesMap(f,o,c)),this.addChild(n,m,o,v),n=m}r="",s=b}}else r+=e[s];return t.child};function ns(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 rs=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 is(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 ss(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function os(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=os(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,c=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const p=u;if(n){const f=u.indexOf(":");f!==-1&&(u=u.substr(f+1),c=u!==o.data.substr(f+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:c,rawTagName:p}}function as(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 In(e,t,n){const r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+";"}const tt=Te.getMetaDataSymbol();function us(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=cs(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 c=Lr(s[a],t,u);const p=fs(c,t);s[":@"]?ls(c,s[":@"],u,t):Object.keys(c).length===1&&c[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?c=c[t.textNodeName]:Object.keys(c).length===0&&(t.alwaysCreateTextNode?c[t.textNodeName]="":c=""),s[tt]!==void 0&&typeof c=="object"&&c!==null&&(c[tt]=s[tt]),o[a]!==void 0&&Object.prototype.hasOwnProperty.call(o,a)?(Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(c)):t.isArray(a,u,p)?o[a]=[c]:o[a]=c}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function cs(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function ls(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 fs(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 zi(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:us(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 Te.getMetaDataSymbol()}}const ps=`
5
- `;function hs(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=ps),_r(e,t,"",n)}function _r(e,t,n,r){let o="",i=!1;if(!Array.isArray(e)){if(e!=null){let s=e.toString();return s=Wt(s,t),s}return""}for(let s=0;s<e.length;s++){const a=e[s],u=ds(a);if(u===void 0)continue;let c="";if(n.length===0?c=u:c=`${n}.${u}`,u===t.textNodeName){let E=a[u];gs(c,t)||(E=t.tagValueProcessor(u,E),E=Wt(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=On(a[":@"],t),v=u==="?xml"?"":r;let m=a[u][0][t.textNodeName];m=m.length!==0?" "+m:"",o+=v+`<${u}${m}${E}?>`,i=!0;continue}let p=r;p!==""&&(p+=t.indentBy);const f=On(a[":@"],t),d=r+`<${u}${f}`,b=_r(a[u],t,c,p);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 ds(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==":@")return r}}function On(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let o=t.attributeValueProcessor(r,e[r]);o=Wt(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function gs(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 Wt(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}function ms(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}const ys={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({},ys,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=ms(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Es),this.processTextOrObjNode=bs,this.options.format?(this.indentate=ws,this.tagEndChar=`>
1
+ import{LatestSupportedPHPVersion as ai,SupportedPHPVersionsList as ui,PHP as ci,FileLockManagerInMemory as li}from"@php-wasm/universal";import{spawn as fi}from"child_process";import Z,{readFileSync as Kt,writeFile as hi,statSync as pi,readdirSync as di,lstatSync as gi,existsSync as mi,writeFileSync as Ir,mkdtempSync as wn,chmodSync as yi}from"fs";import En from"os";import{rootCertificates as bi}from"tls";import oe,{resolve as Zt,normalize as wi}from"path";import{loadNodeRuntime as Ei,useHostFilesystem as Ni}from"@php-wasm/node";import{WebSocketServer as Ti}from"ws";import Oi from"net";import"assert";import{format as vr}from"util";import{fileURLToPath as Ii}from"url";import{createHash as vi}from"crypto";import xi from"timers";function xr(e){let t=e.replaceAll("\\","/");const n=t.match(/^([A-Za-z]):\//);return n&&(t="/"+n[1]+t.slice(2)),t}const Ar=":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",Ai=Ar+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",Pi="["+Ar+"]["+Ai+"]*",Li=new RegExp("^"+Pi+"$");function Pr(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 ze=function(e){const t=Li.exec(e);return!(t===null||typeof t>"u")};function _i(e){return typeof e<"u"}const Di={allowBooleanAttributes:!1,unpairedTags:[]};function Si(e,t){t=Object.assign({},Di,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=Tn(e,i),i.err)return i}else if(e[i]==="<"){let s=i;if(i++,e[i]==="!"){i=On(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--),!Xi(u)){let g;return u.trim().length===0?g="Invalid space after '<'.":g="Tag '"+u+"' is an invalid name.",K("InvalidTag",g,ie(e,i))}const d=Fi(e,i);if(d===!1)return K("InvalidAttr","Attributes for '"+u+"' have open quote.",ie(e,i));let c=d.value;if(i=d.index,c[c.length-1]==="/"){const g=i-c.length;c=c.substring(0,c.length-1);const h=In(c,t);if(h===!0)r=!0;else return K(h.err.code,h.err.msg,ie(e,g+h.err.line))}else if(a)if(d.tagClosed){if(c.trim().length>0)return K("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",ie(e,s));if(n.length===0)return K("InvalidTag","Closing tag '"+u+"' has not been opened.",ie(e,s));{const g=n.pop();if(u!==g.tagName){let h=ie(e,g.tagStartPos);return K("InvalidTag","Expected closing tag '"+g.tagName+"' (opened in line "+h.line+", col "+h.col+") instead of closing tag '"+u+"'.",ie(e,s))}n.length==0&&(o=!0)}}else return K("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",ie(e,i));else{const g=In(c,t);if(g!==!0)return K(g.err.code,g.err.msg,ie(e,i-c.length+g.err.line));if(o===!0)return K("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=On(e,i);continue}else if(e[i+1]==="?"){if(i=Tn(e,++i),i.err)return i}else break;else if(e[i]==="&"){const g=Bi(e,i);if(g==-1)return K("InvalidChar","char '&' is not expected.",ie(e,i));i=g}else if(o===!0&&!Nn(e[i]))return K("InvalidXml","Extra text at the end",ie(e,i));e[i]==="<"&&i--}}else{if(Nn(e[i]))continue;return K("InvalidChar","char '"+e[i]+"' is not expected.",ie(e,i))}if(r){if(n.length==1)return K("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",ie(e,n[0].tagStartPos));if(n.length>0)return K("InvalidXml","Invalid '"+JSON.stringify(n.map(i=>i.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return K("InvalidXml","Start tag expected.",1);return!0}function Nn(e){return e===" "||e===" "||e===`
3
+ `||e==="\r"}function Tn(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 K("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 On(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 Mi='"',Ci="'";function Fi(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===Mi||e[t]===Ci)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 ji=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function In(e,t){const n=Pr(e,ji),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return K("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",ke(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return K("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",ke(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return K("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",ke(n[o]));const i=n[o][2];if(!Ri(i))return K("InvalidAttr","Attribute '"+i+"' is an invalid name.",ke(n[o]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return K("InvalidAttr","Attribute '"+i+"' is repeated.",ke(n[o]))}return!0}function ki(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 Bi(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,ki(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 K(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Ri(e){return ze(e)}function Xi(e){return ze(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 ke(e){return e.startIndex+e[1].length}const $i={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,maxNestedTags:100,strictReservedNames:!0,jPath:!0};function Lr(e){return typeof e=="boolean"?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:10,maxTotalExpansions:1e3,maxExpandedLength:1e5,maxEntityCount:100,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,maxEntityCount:e.maxEntityCount??100,allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null}:Lr(!0)}const Ui=function(e){const t=Object.assign({},$i,e);return t.processEntities=Lr(t.processEntities),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(n=>typeof n=="string"&&n.startsWith("*.")?".."+n.substring(2):n)),t};let qe;typeof Symbol!="function"?qe="@@xmlMetadata":qe=Symbol("XML Node Metadata");class Ne{constructor(t){this.tagname=t,this.child=[],this[":@"]=Object.create(null)}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][qe]={startIndex:n})}static getMetaDataSymbol(){return qe}}class Vi{constructor(t){this.suppressValidationErr=!t,this.options=t}readDocType(t,n){const r=Object.create(null);let o=0;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 i=1,s=!1,a=!1,u="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(s&&Oe(t,"!ENTITY",n)){n+=7;let d,c;if([d,c,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),c.indexOf("&")===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount&&o>=this.options.maxEntityCount)throw new Error(`Entity count (${o+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);const g=d.replace(/[.\-+*:]/g,"\\.");r[d]={regx:RegExp(`&${g};`,"g"),val:c},o++}}else if(s&&Oe(t,"!ELEMENT",n)){n+=8;const{index:d}=this.readElementExp(t,n+1);n=d}else if(s&&Oe(t,"!ATTLIST",n))n+=8;else if(s&&Oe(t,"!NOTATION",n)){n+=9;const{index:d}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=d}else if(Oe(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");i++,u=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,i--):i--,i===0)break}else t[n]==="["?s=!0:u+=t[n];if(i!==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(Be(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&&Be(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&&!ze(r))throw new Error(`Invalid element name: "${r}"`);n=ae(t,n);let o="";if(t[n]==="E"&&Oe(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Oe(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++;Be(r),n=ae(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!Be(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(),!Be(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 Oe(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Be(e){if(ze(e))return e;throw new Error(`Invalid entity name ${e}`)}const qi=/^[-+]?0x[a-fA-F0-9]+$/,Wi=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,Gi={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0,infinity:"original"};function Hi(e,t={}){if(t=Object.assign({},Gi,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&&qi.test(n))return Ji(n,16);if(isFinite(n)){if(n.includes("e")||n.includes("E"))return zi(e,n,t);{const r=Wi.exec(n);if(r){const o=r[1]||"",i=r[2];let s=Qi(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),d=String(u);if(u===0)return u;if(d.search(/[eE]/)!==-1)return t.eNotation?u:e;if(n.indexOf(".")!==-1)return d==="0"||d===s||d===`${o}${s}`?u:e;let c=i?s:n;return i?c===d||o+c===d?u:e:c===d||c===o+d?u:e}}else return e}}else return Ki(e,Number(n),t)}const Yi=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function zi(e,t,n){if(!n.eNotation)return e;const r=t.match(Yi);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 Qi(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 Ji(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 Ki(e,t,n){const r=t===1/0;switch(n.infinity.toLowerCase()){case"null":return null;case"infinity":return t;case"string":return r?"Infinity":"-Infinity";case"original":default:return e}}function Zi(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 Fe{constructor(t,n={}){this.pattern=t,this.separator=n.separator||".",this.segments=this._parse(t),this._hasDeepWildcard=this.segments.some(r=>r.type==="deep-wildcard"),this._hasAttributeCondition=this.segments.some(r=>r.attrName!==void 0),this._hasPositionSelector=this.segments.some(r=>r.position!==void 0)}_parse(t){const n=[];let r=0,o="";for(;r<t.length;)t[r]===this.separator?r+1<t.length&&t[r+1]===this.separator?(o.trim()&&(n.push(this._parseSegment(o.trim())),o=""),n.push({type:"deep-wildcard"}),r+=2):(o.trim()&&n.push(this._parseSegment(o.trim())),o="",r++):(o+=t[r],r++);return o.trim()&&n.push(this._parseSegment(o.trim())),n}_parseSegment(t){const n={type:"tag"};let r=null,o=t;const i=t.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(o=i[1]+i[3],i[2])){const c=i[2].slice(1,-1);c&&(r=c)}let s,a=o;if(o.includes("::")){const c=o.indexOf("::");if(s=o.substring(0,c).trim(),a=o.substring(c+2).trim(),!s)throw new Error(`Invalid namespace in pattern: ${t}`)}let u,d=null;if(a.includes(":")){const c=a.lastIndexOf(":"),g=a.substring(0,c).trim(),h=a.substring(c+1).trim();["first","last","odd","even"].includes(h)||/^nth\(\d+\)$/.test(h)?(u=g,d=h):u=a}else u=a;if(!u)throw new Error(`Invalid segment pattern: ${t}`);if(n.tag=u,s&&(n.namespace=s),r)if(r.includes("=")){const c=r.indexOf("=");n.attrName=r.substring(0,c).trim(),n.attrValue=r.substring(c+1).trim()}else n.attrName=r.trim();if(d){const c=d.match(/^nth\((\d+)\)$/);c?(n.position="nth",n.positionValue=parseInt(c[1],10)):n.position=d}return n}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}}class en{constructor(t={}){this.separator=t.separator||".",this.path=[],this.siblingStacks=[]}push(t,n=null,r=null){if(this.path.length>0){const c=this.path[this.path.length-1];c.values=void 0}const o=this.path.length;this.siblingStacks[o]||(this.siblingStacks[o]=new Map);const i=this.siblingStacks[o],s=r?`${r}:${t}`:t,a=i.get(s)||0;let u=0;for(const c of i.values())u+=c;i.set(s,a+1);const d={tag:t,position:u,counter:a};r!=null&&(d.namespace=r),n!=null&&(d.values=n),this.path.push(d)}pop(){if(this.path.length===0)return;const t=this.path.pop();return this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1),t}updateCurrent(t){if(this.path.length>0){const n=this.path[this.path.length-1];t!=null&&(n.values=t)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(t){return this.path.length===0?void 0:this.path[this.path.length-1].values?.[t]}hasAttr(t){if(this.path.length===0)return!1;const n=this.path[this.path.length-1];return n.values!==void 0&&t in n.values}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(t,n=!0){const r=t||this.separator;return this.path.map(o=>n&&o.namespace?`${o.namespace}:${o.tag}`:o.tag).join(r)}toArray(){return this.path.map(t=>t.tag)}reset(){this.path=[],this.siblingStacks=[]}matches(t){const n=t.segments;return n.length===0?!1:t.hasDeepWildcard()?this._matchWithDeepWildcard(n):this._matchSimple(n)}_matchSimple(t){if(this.path.length!==t.length)return!1;for(let n=0;n<t.length;n++){const r=t[n],o=this.path[n],i=n===this.path.length-1;if(!this._matchSegment(r,o,i))return!1}return!0}_matchWithDeepWildcard(t){let n=this.path.length-1,r=t.length-1;for(;r>=0&&n>=0;){const o=t[r];if(o.type==="deep-wildcard"){if(r--,r<0)return!0;const i=t[r];let s=!1;for(let a=n;a>=0;a--){const u=a===this.path.length-1;if(this._matchSegment(i,this.path[a],u)){n=a-1,r--,s=!0;break}}if(!s)return!1}else{const i=n===this.path.length-1;if(!this._matchSegment(o,this.path[n],i))return!1;n--,r--}}return r<0}_matchSegment(t,n,r){if(t.tag!=="*"&&t.tag!==n.tag||t.namespace!==void 0&&t.namespace!=="*"&&t.namespace!==n.namespace)return!1;if(t.attrName!==void 0){if(!r||!n.values||!(t.attrName in n.values))return!1;if(t.attrValue!==void 0){const o=n.values[t.attrName];if(String(o)!==String(t.attrValue))return!1}}if(t.position!==void 0){if(!r)return!1;const o=n.counter??0;if(t.position==="first"&&o!==0)return!1;if(t.position==="odd"&&o%2!==1)return!1;if(t.position==="even"&&o%2!==0)return!1;if(t.position==="nth"&&o!==t.positionValue)return!1}return!0}snapshot(){return{path:this.path.map(t=>({...t})),siblingStacks:this.siblingStacks.map(t=>new Map(t))}}restore(t){this.path=t.path.map(n=>({...n})),this.siblingStacks=t.siblingStacks.map(n=>new Map(n))}}function es(e,t){if(!e)return{};const n=t.attributesGroupName?e[t.attributesGroupName]:e;if(!n)return{};const r={};for(const o in n)if(o.startsWith(t.attributeNamePrefix)){const i=o.substring(t.attributeNamePrefix.length);r[i]=n[o]}else r[o]=n[o];return r}function ts(e){if(!e||typeof e!="string")return;const t=e.indexOf(":");if(t!==-1&&t>0){const n=e.substring(0,t);if(n!=="xmlns")return n}}class ns{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)=>vn(r,10,"&#")},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>vn(r,16,"&#x")}},this.addExternalEntities=rs,this.parseXml=us,this.parseTextData=is,this.resolveNameSpace=ss,this.buildAttributesMap=as,this.isItStopNode=hs,this.replaceEntitiesValue=ls,this.readStopNodeData=ds,this.saveTextToParentTag=fs,this.addChild=cs,this.ignoreAttributesFn=Zi(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0,this.matcher=new en,this.isCurrentNodeStopNode=!1,this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodeExpressions=[];for(let n=0;n<this.options.stopNodes.length;n++){const r=this.options.stopNodes[n];typeof r=="string"?this.stopNodeExpressions.push(new Fe(r)):r instanceof Fe&&this.stopNodeExpressions.push(r)}}}}function rs(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 is(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.jPath?n.toString():n,u=this.options.tagValueProcessor(t,e,a,o,i);return u==null?e:typeof u!=typeof e||u!==e?u:this.options.trimValues?Wt(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?Wt(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function ss(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 os=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function as(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Pr(e,os),o=r.length,i={},s={};for(let a=0;a<o;a++){const u=this.resolveNameSpace(r[a][1]),d=r[a][4];if(u.length&&d!==void 0){let c=d;this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,n,t),s[u]=c}}Object.keys(s).length>0&&typeof t=="object"&&t.updateCurrent&&t.updateCurrent(s);for(let a=0;a<o;a++){const u=this.resolveNameSpace(r[a][1]),d=this.options.jPath?t.toString():t;if(this.ignoreAttributesFn(u,d))continue;let c=r[a][4],g=this.options.attributeNamePrefix+u;if(u.length)if(this.options.transformAttributeName&&(g=this.options.transformAttributeName(g)),g==="__proto__"&&(g="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c,n,t);const h=this.options.jPath?t.toString():t,b=this.options.attributeValueProcessor(u,c,h);b==null?i[g]=c:typeof b!=typeof c||b!==c?i[g]=b:i[g]=Wt(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[g]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=i,a}return i}}const us=function(e){e=e.replace(/\r\n?/g,`
4
+ `);const t=new Ne("!xml");let n=t,r="";this.matcher.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;const o=new Vi(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const a=xe(e,">",i,"Closing Tag is not closed.");let u=e.substring(i+2,a).trim();if(this.options.removeNSPrefix){const c=u.indexOf(":");c!==-1&&(u=u.substr(c+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(r=this.saveTextToParentTag(r,n,this.matcher));const d=this.matcher.getCurrentTag();if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);d&&this.options.unpairedTags.indexOf(d)!==-1&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),r="",i=a}else if(e[i+1]==="?"){let a=qt(e,i,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,this.matcher),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const u=new Ne(a.tagName);u.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(u[":@"]=this.buildAttributesMap(a.tagExp,this.matcher,a.tagName)),this.addChild(n,u,this.matcher,i)}i=a.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const a=xe(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(i+4,a-2);r=this.saveTextToParentTag(r,n,this.matcher),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=a}else if(e.substr(i+1,2)==="!D"){const a=o.readDocType(e,i);this.docTypeEntities=a.entities,i=a.i}else if(e.substr(i+1,2)==="!["){const a=xe(e,"]]>",i,"CDATA is not closed.")-2,u=e.substring(i+9,a);r=this.saveTextToParentTag(r,n,this.matcher);let d=this.parseTextData(u,n.tagname,this.matcher,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),i=a+2}else{let a=qt(e,i,this.options.removeNSPrefix);if(!a){const w=e.substring(Math.max(0,i-50),Math.min(e.length,i+50));throw new Error(`readTagExp returned undefined at position ${i}. Context: "${w}"`)}let u=a.tagName;const d=a.rawTagName;let c=a.tagExp,g=a.attrExpPresent,h=a.closeIndex;if(this.options.transformTagName){const w=this.options.transformTagName(u);c===u&&(c=w),u=w}if(this.options.strictReservedNames&&(u===this.options.commentPropName||u===this.options.cdataPropName))throw new Error(`Invalid tag name: ${u}`);n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,this.matcher,!1));const b=n;b&&this.options.unpairedTags.indexOf(b.tagname)!==-1&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let N=!1;c.length>0&&c.lastIndexOf("/")===c.length-1&&(N=!0,u[u.length-1]==="/"?(u=u.substr(0,u.length-1),c=u):c=c.substr(0,c.length-1),g=u!==c);let I=null,y;y=ts(d),u!==t.tagname&&this.matcher.push(u,{},y),u!==c&&g&&(I=this.buildAttributesMap(c,this.matcher,u),I&&es(I,this.options)),u!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode(this.stopNodeExpressions,this.matcher));const D=i;if(this.isCurrentNodeStopNode){let w="";if(N)i=a.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=a.closeIndex;else{const E=this.readStopNodeData(e,d,h+1);if(!E)throw new Error(`Unexpected end of ${d}`);i=E.i,w=E.tagContent}const f=new Ne(u);I&&(f[":@"]=I),f.add(this.options.textNodeName,w),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,f,this.matcher,D)}else{if(N){if(this.options.transformTagName){const f=this.options.transformTagName(u);c===u&&(c=f),u=f}const w=new Ne(u);I&&(w[":@"]=I),this.addChild(n,w,this.matcher,D),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(this.options.unpairedTags.indexOf(u)!==-1){const w=new Ne(u);I&&(w[":@"]=I),this.addChild(n,w,this.matcher,D),this.matcher.pop(),this.isCurrentNodeStopNode=!1,i=a.closeIndex;continue}else{const w=new Ne(u);if(this.tagsNodeStack.length>this.options.maxNestedTags)throw new Error("Maximum nested tags exceeded");this.tagsNodeStack.push(n),I&&(w[":@"]=I),this.addChild(n,w,this.matcher,D),n=w}r="",i=h}}else r+=e[i];return t.child};function cs(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.jPath?n.toString():n,i=this.options.updateTag(t.tagname,o,t[":@"]);i===!1||(typeof i=="string"&&(t.tagname=i),e.addChild(t,r))}function ls(e,t,n){const r=this.options.processEntities;if(!r||!r.enabled)return e;if(r.allowedTags){const o=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(t):r.allowedTags(t,o)))return e}if(r.tagFilter){const o=this.options.jPath?n.toString():n;if(!r.tagFilter(t,o))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 fs(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 hs(e,t){if(!e||e.length===0)return!1;for(let n=0;n<e.length;n++)if(t.matches(e[n]))return!0;return!1}function ps(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 qt(e,t,n,r=">"){const o=ps(e,t+1,r);if(!o)return;let i=o.data;const s=o.index,a=i.search(/\s/);let u=i,d=!0;a!==-1&&(u=i.substring(0,a),i=i.substring(a+1).trimStart());const c=u;if(n){const g=u.indexOf(":");g!==-1&&(u=u.substr(g+1),d=u!==o.data.substr(g+1))}return{tagName:u,tagExp:i,closeIndex:s,attrExpPresent:d,rawTagName:c}}function ds(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=qt(e,n,">");i&&((i&&i.tagName)===t&&i.tagExp[i.tagExp.length-1]!=="/"&&o++,n=i.closeIndex)}}function Wt(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:Hi(e,n)}else return _i(e)?e:""}function vn(e,t,n){const r=Number.parseInt(e,t);return r>=0&&r<=1114111?String.fromCodePoint(r):n+e+";"}const nt=Ne.getMetaDataSymbol();function gs(e,t){if(!e||typeof e!="object")return{};if(!t)return e;const n={};for(const r in e)if(r.startsWith(t)){const o=r.substring(t.length);n[o]=e[r]}else n[r]=e[r];return n}function ms(e,t,n){return _r(e,t,n)}function _r(e,t,n){let r;const o={};for(let i=0;i<e.length;i++){const s=e[i],a=ys(s);if(a!==void 0&&a!==t.textNodeName){const u=gs(s[":@"]||{},t.attributeNamePrefix);n.push(a,u)}if(a===t.textNodeName)r===void 0?r=s[a]:r+=""+s[a];else{if(a===void 0)continue;if(s[a]){let u=_r(s[a],t,n);const d=ws(u,t);if(s[":@"]?bs(u,s[":@"],n,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),s[nt]!==void 0&&typeof u=="object"&&u!==null&&(u[nt]=s[nt]),o[a]!==void 0&&Object.prototype.hasOwnProperty.call(o,a))Array.isArray(o[a])||(o[a]=[o[a]]),o[a].push(u);else{const c=t.jPath?n.toString():n;t.isArray(a,c,d)?o[a]=[u]:o[a]=u}a!==void 0&&a!==t.textNodeName&&n.pop()}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function ys(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function bs(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],u=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,d=r.jPath?n.toString()+"."+u:n;r.isArray(a,d,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function ws(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 Dr{constructor(t){this.externalEntities={},this.options=Ui(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=Si(t,n);if(i!==!0)throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`)}const r=new ns(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:ms(o,this.options,r.matcher)}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 Ne.getMetaDataSymbol()}}const Es=`
5
+ `;function Ns(e,t){let n="";t.format&&t.indentBy.length>0&&(n=Es);const r=[];if(t.stopNodes&&Array.isArray(t.stopNodes))for(let i=0;i<t.stopNodes.length;i++){const s=t.stopNodes[i];typeof s=="string"?r.push(new Fe(s)):s instanceof Fe&&r.push(s)}const o=new en;return Sr(e,t,n,o,r)}function Sr(e,t,n,r,o){let i="",s=!1;if(!Array.isArray(e)){if(e!=null){let a=e.toString();return a=Gt(a,t),a}return""}for(let a=0;a<e.length;a++){const u=e[a],d=Cr(u);if(d===void 0)continue;const c=Ts(u[":@"],t);r.push(d,c);const g=Is(r,o);if(d===t.textNodeName){let y=u[d];g||(y=t.tagValueProcessor(d,y),y=Gt(y,t)),s&&(i+=n),i+=y,s=!1,r.pop();continue}else if(d===t.cdataPropName){s&&(i+=n),i+=`<![CDATA[${u[d][0][t.textNodeName]}]]>`,s=!1,r.pop();continue}else if(d===t.commentPropName){i+=n+`<!--${u[d][0][t.textNodeName]}-->`,s=!0,r.pop();continue}else if(d[0]==="?"){const y=xn(u[":@"],t,g),D=d==="?xml"?"":n;let w=u[d][0][t.textNodeName];w=w.length!==0?" "+w:"",i+=D+`<${d}${w}${y}?>`,s=!0,r.pop();continue}let h=n;h!==""&&(h+=t.indentBy);const b=xn(u[":@"],t,g),N=n+`<${d}${b}`;let I;g?I=Mr(u[d],t):I=Sr(u[d],t,h,r,o),t.unpairedTags.indexOf(d)!==-1?t.suppressUnpairedNode?i+=N+">":i+=N+"/>":(!I||I.length===0)&&t.suppressEmptyNode?i+=N+"/>":I&&I.endsWith(">")?i+=N+`>${I}${n}</${d}>`:(i+=N+">",I&&n!==""&&(I.includes("/>")||I.includes("</"))?i+=n+t.indentBy+I+n:i+=I,i+=`</${d}>`),s=!0,r.pop()}return i}function Ts(e,t){if(!e||t.ignoreAttributes)return null;const n={};let r=!1;for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;const i=o.startsWith(t.attributeNamePrefix)?o.substr(t.attributeNamePrefix.length):o;n[i]=e[o],r=!0}return r?n:null}function Mr(e,t){if(!Array.isArray(e))return e!=null?e.toString():"";let n="";for(let r=0;r<e.length;r++){const o=e[r],i=Cr(o);if(i===t.textNodeName)n+=o[i];else if(i===t.cdataPropName)n+=o[i][0][t.textNodeName];else if(i===t.commentPropName)n+=o[i][0][t.textNodeName];else{if(i&&i[0]==="?")continue;if(i){const s=Os(o[":@"],t),a=Mr(o[i],t);!a||a.length===0?n+=`<${i}${s}/>`:n+=`<${i}${s}>${a}</${i}>`}}}return n}function Os(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let o=e[r];o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function Cr(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==":@")return r}}function xn(e,t,n){let r="";if(e&&!t.ignoreAttributes)for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let i;n?i=e[o]:(i=t.attributeValueProcessor(o,e[o]),i=Gt(i,t)),i===!0&&t.suppressBooleanAttributes?r+=` ${o.substr(t.attributeNamePrefix.length)}`:r+=` ${o.substr(t.attributeNamePrefix.length)}="${i}"`}return r}function Is(e,t){if(!t||t.length===0)return!1;for(let n=0;n<t.length;n++)if(e.matches(t[n]))return!0;return!1}function Gt(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}function vs(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}const xs={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,jPath:!0};function ce(e){if(this.options=Object.assign({},xs,e),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(t=>typeof t=="string"&&t.startsWith("*.")?".."+t.substring(2):t)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let t=0;t<this.options.stopNodes.length;t++){const n=this.options.stopNodes[t];typeof n=="string"?this.stopNodeExpressions.push(new Fe(n)):n instanceof Fe&&this.stopNodeExpressions.push(n)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=vs(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Ls),this.processTextOrObjNode=As,this.options.format?(this.indentate=Ps,this.tagEndChar=`>
6
6
  `,this.newLine=`
7
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}we.prototype.build=function(e){return this.options.preserveOrder?hs(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="",c="";for(let p=0;p<a;p++){const f=e[s][p];if(!(typeof f>"u"))if(f===null)s[0]==="?"?o+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const d=this.j2x(f,t+1,n.concat(s));u+=d.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(c+=d.attrStr)}else u+=this.processTextOrObjNode(f,s,t,n);else if(this.options.oneListGroup){let d=this.options.tagValueProcessor(s,f);d=this.replaceEntitiesValue(d),u+=d}else u+=this.buildTextValNode(f,s,"",t)}this.options.oneListGroup&&(u=this.buildObjectNode(u,s,c,t)),o+=u}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const a=Object.keys(e[s]),u=a.length;for(let c=0;c<u;c++)r+=this.buildAttrPairStr(a[c],""+e[s][a[c]])}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 bs(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 ws(e){return this.options.indentBy.repeat(e)}function Es(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,c=0,p=0,f=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,f=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 f=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 f=3;return e.substring(h,w)}function v(){let h="",w=r;for(;;){if(r>=n){h+=e.substring(w,r),f=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){f=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):f=4;break;default:f=5}w=r;continue}if(I>=0&&I<=31)if(Be(I)){h+=e.substring(w,r),f=2;break}else f=6;r++}return h}function m(){if(o="",f=0,i=r,u=a,p=c,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++,c=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++,c=r)}return P||(r++,f=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=m();while(h>=12&&h<=15);return h}return{setPosition:b,getPosition:()=>r,scan:t?T:m,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-p,getTokenError:()=>f}}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 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,xn={" ":{"\n":new Array(_e).fill(0).map((e,t)=>`
7
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}ce.prototype.build=function(e){if(this.options.preserveOrder)return Ns(e,this.options);{Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e});const t=new en;return this.j2x(e,0,t).val}};ce.prototype.j2x=function(e,t,n){let r="",o="";const i=this.options.jPath?n.toString():n,s=this.checkStopNode(n);for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(o+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t,n);else if(typeof e[a]!="object"){const u=this.isAttribute(a);if(u&&!this.ignoreAttributesFn(u,i))r+=this.buildAttrPairStr(u,""+e[a],s);else if(!u)if(a===this.options.textNodeName){let d=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(d)}else{n.push(a);const d=this.checkStopNode(n);if(n.pop(),d){const c=""+e[a];c===""?o+=this.indentate(t)+"<"+a+this.closeTag(a)+this.tagEndChar:o+=this.indentate(t)+"<"+a+">"+c+"</"+a+this.tagEndChar}else o+=this.buildTextValNode(e[a],a,"",t,n)}}else if(Array.isArray(e[a])){const u=e[a].length;let d="",c="";for(let g=0;g<u;g++){const h=e[a][g];if(!(typeof h>"u"))if(h===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof h=="object")if(this.options.oneListGroup){n.push(a);const b=this.j2x(h,t+1,n);n.pop(),d+=b.val,this.options.attributesGroupName&&h.hasOwnProperty(this.options.attributesGroupName)&&(c+=b.attrStr)}else d+=this.processTextOrObjNode(h,a,t,n);else if(this.options.oneListGroup){let b=this.options.tagValueProcessor(a,h);b=this.replaceEntitiesValue(b),d+=b}else{n.push(a);const b=this.checkStopNode(n);if(n.pop(),b){const N=""+h;N===""?d+=this.indentate(t)+"<"+a+this.closeTag(a)+this.tagEndChar:d+=this.indentate(t)+"<"+a+">"+N+"</"+a+this.tagEndChar}else d+=this.buildTextValNode(h,a,"",t,n)}}this.options.oneListGroup&&(d=this.buildObjectNode(d,a,c,t)),o+=d}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const u=Object.keys(e[a]),d=u.length;for(let c=0;c<d;c++)r+=this.buildAttrPairStr(u[c],""+e[a][u[c]],s)}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:o}};ce.prototype.buildAttrPairStr=function(e,t,n){return n||(t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t)),this.options.suppressBooleanAttributes&&t==="true"?" "+e:" "+e+'="'+t+'"'};function As(e,t,n,r){const o=this.extractAttributes(e);if(r.push(t,o),this.checkStopNode(r)){const a=this.buildRawContent(e),u=this.buildAttributesForStopNode(e);return r.pop(),this.buildObjectNode(a,t,u,n)}const s=this.j2x(e,n+1,r);return r.pop(),e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,s.attrStr,n,r):this.buildObjectNode(s.val,t,s.attrStr,n)}ce.prototype.extractAttributes=function(e){if(!e||typeof e!="object")return null;const t={};let n=!1;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){const r=e[this.options.attributesGroupName];for(let o in r){if(!Object.prototype.hasOwnProperty.call(r,o))continue;const i=o.startsWith(this.options.attributeNamePrefix)?o.substring(this.options.attributeNamePrefix.length):o;t[i]=r[o],n=!0}}else for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;const o=this.isAttribute(r);o&&(t[o]=e[r],n=!0)}return n?t:null};ce.prototype.buildRawContent=function(e){if(typeof e=="string")return e;if(typeof e!="object"||e===null)return String(e);if(e[this.options.textNodeName]!==void 0)return e[this.options.textNodeName];let t="";for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;const r=e[n];if(n===this.options.textNodeName)t+=r;else if(Array.isArray(r)){for(let o of r)if(typeof o=="string"||typeof o=="number")t+=`<${n}>${o}</${n}>`;else if(typeof o=="object"&&o!==null){const i=this.buildRawContent(o),s=this.buildAttributesForStopNode(o);i===""?t+=`<${n}${s}/>`:t+=`<${n}${s}>${i}</${n}>`}}else if(typeof r=="object"&&r!==null){const o=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);o===""?t+=`<${n}${i}/>`:t+=`<${n}${i}>${o}</${n}>`}else t+=`<${n}>${r}</${n}>`}return t};ce.prototype.buildAttributesForStopNode=function(e){if(!e||typeof e!="object")return"";let t="";if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){const n=e[this.options.attributesGroupName];for(let r in n){if(!Object.prototype.hasOwnProperty.call(n,r))continue;const o=r.startsWith(this.options.attributeNamePrefix)?r.substring(this.options.attributeNamePrefix.length):r,i=n[r];i===!0&&this.options.suppressBooleanAttributes?t+=" "+o:t+=" "+o+'="'+i+'"'}}else for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=this.isAttribute(n);if(r){const o=e[n];o===!0&&this.options.suppressBooleanAttributes?t+=" "+r:t+=" "+r+'="'+o+'"'}}return t};ce.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}};ce.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};ce.prototype.checkStopNode=function(e){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let t=0;t<this.stopNodeExpressions.length;t++)if(e.matches(this.stopNodeExpressions[t]))return!0;return!1};ce.prototype.buildTextValNode=function(e,t,n,r,o){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 i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}};ce.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 Ps(e){return this.options.indentBy.repeat(e)}function Ls(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}function Fr(e,t=!1){const n=e.length;let r=0,o="",i=0,s=16,a=0,u=0,d=0,c=0,g=0;function h(f,E){let O=0,L=0;for(;O<f;){let P=e.charCodeAt(r);if(P>=48&&P<=57)L=L*16+P-48;else if(P>=65&&P<=70)L=L*16+P-65+10;else if(P>=97&&P<=102)L=L*16+P-97+10;else break;r++,O++}return O<f&&(L=-1),L}function b(f){r=f,o="",i=0,s=16,g=0}function N(){let f=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&Le(e.charCodeAt(r)))for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;else return g=3,e.substring(f,r);let E=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&&Le(e.charCodeAt(r))){for(r++;r<e.length&&Le(e.charCodeAt(r));)r++;E=r}else g=3;return e.substring(f,E)}function I(){let f="",E=r;for(;;){if(r>=n){f+=e.substring(E,r),g=2;break}const O=e.charCodeAt(r);if(O===34){f+=e.substring(E,r),r++;break}if(O===92){if(f+=e.substring(E,r),r++,r>=n){g=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):g=4;break;default:g=5}E=r;continue}if(O>=0&&O<=31)if(Re(O)){f+=e.substring(E,r),g=2;break}else g=6;r++}return f}function y(){if(o="",g=0,i=r,u=a,c=d,r>=n)return i=n,s=17;let f=e.charCodeAt(r);if(rt(f)){do r++,o+=String.fromCharCode(f),f=e.charCodeAt(r);while(rt(f));return s=15}if(Re(f))return r++,o+=String.fromCharCode(f),f===13&&e.charCodeAt(r)===10&&(r++,o+=`
9
+ `),a++,d=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=I(),s=10;case 47:const E=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!Re(e.charCodeAt(r));)r++;return o=e.substring(E,r),s=12}if(e.charCodeAt(r+1)===42){r+=2;const O=n-1;let L=!1;for(;r<O;){const P=e.charCodeAt(r);if(P===42&&e.charCodeAt(r+1)===47){r+=2,L=!0;break}r++,Re(P)&&(P===13&&e.charCodeAt(r)===10&&r++,a++,d=r)}return L||(r++,g=1),o=e.substring(E,r),s=13}return o+=String.fromCharCode(f),r++,s=16;case 45:if(o+=String.fromCharCode(f),r++,r===n||!Le(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+=N(),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(rt(f)||Re(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 w(){let f;do f=y();while(f>=12&&f<=15);return f}return{setPosition:b,getPosition:()=>r,scan:t?w:y,getToken:()=>s,getTokenValue:()=>o,getTokenOffset:()=>i,getTokenLength:()=>r-i,getTokenStartLine:()=>u,getTokenStartCharacter:()=>i-c,getTokenError:()=>g}}function rt(e){return e===32||e===9}function Re(e){return e===10||e===13}function Le(e){return e>=48&&e<=57}var An;(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"})(An||(An={}));const le=new Array(20).fill(0).map((e,t)=>" ".repeat(t)),_e=200,Pn={" ":{"\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))}},Ts=[`
13
+ `+" ".repeat(t))}},_s=[`
14
14
  `,"\r",`\r
15
- `];function Ns(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=Is(o,n)}else o=e,r=0,i=0,s=0,a=e.length;const u=Os(n,e),c=Ts.includes(u);let p=0,f=0,d;n.insertSpaces?d=ce[n.tabSize||4]??De(ce[1],n.tabSize||4):d=" ";const b=d===" "?" ":" ";let E=Dr(o,!1),v=!1;function m(){if(p>1)return De(u,p)+De(d,r+f);const I=d.length*(r+f);return!c||I>xn[b][u].length?u+De(d,r+f):I<=0?u:xn[b][u][I]}function D(){let I=E.scan();for(p=0;I===15||I===14;)I===14&&n.keepLines?p+=1:I===14&&(p=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&&p>0&&h(De(u,p),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(;p===0&&(P===12||P===13);){let _=E.getTokenOffset()+i;h(ce[1],I,_),I=E.getTokenOffset()+E.getTokenLength()+i,S=P===12,L=S?m():"",P=D()}if(P===2)w!==1&&f--,n.keepLines&&p>0||!n.keepLines&&w!==1?L=m():n.keepLines&&(L=ce[1]);else if(P===4)w!==3&&f--,n.keepLines&&p>0||!n.keepLines&&w!==3?L=m():n.keepLines&&(L=ce[1]);else{switch(w){case 3:case 1:f++,n.keepLines&&p>0||!n.keepLines?L=m():L=ce[1];break;case 5:n.keepLines&&p>0||!n.keepLines?L=m():L=ce[1];break;case 12:L=m();break;case 13:p>0?L=m():S||(L=ce[1]);break;case 6:n.keepLines&&p>0?L=m():S||(L=ce[1]);break;case 10:n.keepLines&&p>0?L=m():P===6&&!S&&(L="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&p>0?L=m():(P===12||P===13)&&!S?L=ce[1]:P!==5&&P!==17&&(v=!0);break;case 16:v=!0;break}p>0&&(P===12||P===13)&&(L=m())}P===17&&(n.keepLines&&p>0?L=m():L=n.insertFinalNewline?u:"");const l=E.getTokenOffset()+i;h(L,I,l),w=P}return T}function De(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Is(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 Os(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 Ds(e,t,n){let r,o,i,s,a;if(t){for(s=t.offset,a=s+t.length,i=s;i>0&&!We(e,i-1);)i--;let O=a;for(;O<e.length&&!We(e,O);)O++;o=e.substring(i,O),r=Ss(o,n)}else o=e,r=0,i=0,s=0,a=e.length;const u=Ms(n,e),d=_s.includes(u);let c=0,g=0,h;n.insertSpaces?h=le[n.tabSize||4]??De(le[1],n.tabSize||4):h=" ";const b=h===" "?" ":" ";let N=Fr(o,!1),I=!1;function y(){if(c>1)return De(u,c)+De(h,r+g);const O=h.length*(r+g);return!d||O>Pn[b][u].length?u+De(h,r+g):O<=0?u:Pn[b][u][O]}function D(){let O=N.scan();for(c=0;O===15||O===14;)O===14&&n.keepLines?c+=1:O===14&&(c=1),O=N.scan();return I=O===16||N.getTokenError()!==0,O}const w=[];function f(O,L,P){!I&&(!t||L<a&&P>s)&&e.substring(L,P)!==O&&w.push({offset:L,length:P-L,content:O})}let E=D();if(n.keepLines&&c>0&&f(De(u,c),0,0),E!==17){let O=N.getTokenOffset()+i,L=h.length*r<20&&n.insertSpaces?le[h.length*r]:De(h,r);f(L,i,O)}for(;E!==17;){let O=N.getTokenOffset()+N.getTokenLength()+i,L=D(),P="",C=!1;for(;c===0&&(L===12||L===13);){let _=N.getTokenOffset()+i;f(le[1],O,_),O=N.getTokenOffset()+N.getTokenLength()+i,C=L===12,P=C?y():"",L=D()}if(L===2)E!==1&&g--,n.keepLines&&c>0||!n.keepLines&&E!==1?P=y():n.keepLines&&(P=le[1]);else if(L===4)E!==3&&g--,n.keepLines&&c>0||!n.keepLines&&E!==3?P=y():n.keepLines&&(P=le[1]);else{switch(E){case 3:case 1:g++,n.keepLines&&c>0||!n.keepLines?P=y():P=le[1];break;case 5:n.keepLines&&c>0||!n.keepLines?P=y():P=le[1];break;case 12:P=y();break;case 13:c>0?P=y():C||(P=le[1]);break;case 6:n.keepLines&&c>0?P=y():C||(P=le[1]);break;case 10:n.keepLines&&c>0?P=y():L===6&&!C&&(P="");break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&c>0?P=y():(L===12||L===13)&&!C?P=le[1]:L!==5&&L!==17&&(I=!0);break;case 16:I=!0;break}c>0&&(L===12||L===13)&&(P=y())}L===17&&(n.keepLines&&c>0?P=y():P=n.insertFinalNewline?u:"");const l=N.getTokenOffset()+i;f(P,O,l),E=L}return w}function De(e,t){let n="";for(let r=0;r<t;r++)n+=e;return n}function Ss(e,t){let n=0,r=0;const o=t.tabSize||4;for(;n<e.length;){let i=e.charAt(n);if(i===le[1])r++;else if(i===" ")r+=o;else break;n++}return Math.floor(r/o)}function Ms(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
- `}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}vs(e,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,c,p)=>{r=i({type:"property",offset:c,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:c,length:p,parent:r})},onObjectEnd:(u,c)=>{o(u+c),r.length=u+c-r.offset,r=r.parent,o(u+c)},onArrayBegin:(u,c)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,c)=>{r.length=u+c-r.offset,r=r.parent,o(u+c)},onLiteralValue:(u,c,p)=>{i({type:xs(u),offset:c,length:p,parent:r,value:u}),o(c+p)},onSeparator:(u,c,p)=>{r.type==="property"&&(u===":"?r.colonOffset=c:u===","&&o(c))},onError:(u,c,p)=>{t.push({error:u,offset:c,length:p})}},n);const a=r.children[0];return a&&delete a.parent,a}function Ht(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 vs(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 c(R){return R?()=>{i>0?i++:R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function p(R){return R?()=>{i>0&&i--,i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const f=c(t.onObjectBegin),d=u(t.onObjectProperty),b=p(t.onObjectEnd),E=c(t.onArrayBegin),v=p(t.onArrayEnd),m=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?m(V):(d(V),o.push(V)),P(),!0}function l(){switch(r.getToken()){case 11:const R=r.getTokenValue();let V=Number(R);isNaN(V)&&(L(2),V=0),m(V);break;case 7:m(null);break;case 8:m(!0);break;case 9:m(!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(){f(),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 l()}}return P(),r.getToken()===17?n.allowEmptyContent?!0:(L(4,[],[]),!1):q()?(r.getToken()!==17&&L(9,[],[]),!0):(L(4,[],[]),!1)}function xs(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 As(e,t,n,r){const o=t.slice(),s=Mr(e,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Ht(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 c=Ht(a,[u]);if(c!==void 0)if(n===void 0){if(!c.parent)throw new Error("Malformed AST");const p=a.children.indexOf(c.parent);let f,d=c.parent.offset+c.parent.length;if(p>0){let b=a.children[p-1];f=b.offset+b.length}else f=a.offset+1,a.children.length>1&&(d=a.children[1].offset);return Oe(e,{offset:f,length:d-f,content:""},r)}else return Oe(e,{offset:c.offset,length:c.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const p=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,f=r.getInsertionIndex?r.getInsertionIndex(a.children.map(b=>b.children[0].value)):a.children.length;let d;if(f>0){let b=a.children[f-1];d={offset:b.offset+b.length,length:0,content:","+p}}else a.children.length===0?d={offset:a.offset+1,length:0,content:p}:d={offset:a.offset+1,length:0,content:p+","};return Oe(e,d,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const c=u;if(c===-1){const p=`${JSON.stringify(n)}`;let f;if(a.children.length===0)f={offset:a.offset+1,length:0,content:p};else{const d=a.children[a.children.length-1];f={offset:d.offset+d.length,length:0,content:","+p}}return Oe(e,f,r)}else if(n===void 0&&a.children.length>=0){const p=u,f=a.children[p];let d;if(a.children.length===1)d={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===p){let b=a.children[p-1],E=b.offset+b.length,v=a.offset+a.length;d={offset:E,length:v-2-E,content:""}}else d={offset:f.offset,length:a.children[p+1].offset-f.offset,content:""};return Oe(e,d,r)}else if(n!==void 0){let p;const f=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const d=a.children[u];p={offset:d.offset,length:d.length,content:f}}else if(a.children.length===0||u===0)p={offset:a.offset+1,length:0,content:a.children.length===0?f:f+","};else{const d=u>a.children.length?a.children.length:u,b=a.children[d-1];p={offset:b.offset+b.length,length:0,content:","+f}}return Oe(e,p,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${c} 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 Oe(e,{offset:s?s.offset:0,length:s?s.length:0,content:JSON.stringify(n)},r)}}function Oe(e,t,n){if(!n.formattingOptions)return[t];let r=Gt(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=Ns(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const c=s[u];r=Gt(r,c),o=Math.min(o,c.offset),i=Math.max(i,c.offset+c.length),i+=c.content.length-c.length}const a=e.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function Gt(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=Ht;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 Ls(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 Yt(e,t,n,r){return As(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=Gt(e,i);else throw new Error("Overlapping edit");r=i.offset}return e}const Ps="PHPWASMCLI";function Cr(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 Ne={ignoreAttributes:!1,attributeNamePrefix:"",preserveOrder:!0,cdataPropName:"__cdata",commentPropName:"__xmlComment",allowBooleanAttributes:!0,trimValues:!0},Fr={ignoreAttributes:Ne.ignoreAttributes,attributeNamePrefix:Ne.attributeNamePrefix,preserveOrder:Ne.preserveOrder,cdataPropName:Ne.cdataPropName,commentPropName:Ne.commentPropName,suppressBooleanAttributes:!Ne.allowBooleanAttributes,format:!0,indentBy:" "},Ge={allowEmptyContent:!0,allowTrailingComma:!0};function _s(e,t){const{name:n,host:r,port:o,mappings:i,ideKey:s}=t,a=new Pr(Ne),u=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),c={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(c.server[0].path_mappings=i.map(T=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${Or(oe.relative(t.projectDir,T.hostPath))}`,"remote-root":T.vfsPath}})));let p=u?.find(T=>!!T?.project);if(p){const T=p[":@"]?.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}".`)}p===void 0&&(p={project:[],":@":{version:"4"}},u.push(p));let f=p.project?.find(T=>!!T?.component&&T?.[":@"]?.name==="PhpServers");f===void 0&&(f={component:[],":@":{name:"PhpServers"}},p.project===void 0&&(p.project=[]),p.project.push(f));let d=f.component?.find(T=>!!T?.servers);d===void 0&&(d={servers:[]},f.component===void 0&&(f.component=[]),f.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(c));let E=p.project?.find(T=>!!T?.component&&T?.[":@"]?.name==="RunManager");if(E===void 0&&(E={component:[],":@":{name:"RunManager"}},p.project===void 0&&(p.project=[]),p.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 Ds(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 c=Yt(i,["configurations"],[],{});i=Sr(i,c),s=He(i,[],Ge),a=Re(s,["configurations"])}const u=a?.children?.findIndex(c=>Re(c,["name"])?.value===n);if(u===void 0||u<0){const c={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(c.pathMappings=r.reduce((d,b)=>(d[b.vfsPath]=`\${workspaceFolder}/${Or(oe.relative(t.workspaceDir,b.hostPath))}`,d),{}));const p=a?.children?.length||0,f=Yt(i,["configurations",p],c,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
22
- `}});i=jr(i,f)}return i}async function Ms({name:e,ides:t,host:n,port:r,cwd:o,mounts:i,ideKey:s=Ps}){const a=i?Cr(o,i):[],u={};if(t.includes("phpstorm")){const c=".idea/workspace.xml",p=oe.join(o,c);if(!K.existsSync(p)){if(K.existsSync(oe.dirname(p)))K.writeFileSync(p,`<?xml version="1.0" encoding="UTF-8"?>
20
+ `}function We(e,t){return`\r
21
+ `.indexOf(e.charAt(t))!==-1}var Ge;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Ge||(Ge={}));function jr(e,t=[],n=Ge.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}Cs(e,{onObjectBegin:u=>{r=i({type:"object",offset:u,length:-1,parent:r,children:[]})},onObjectProperty:(u,d,c)=>{r=i({type:"property",offset:d,length:-1,parent:r,children:[]}),r.children.push({type:"string",value:u,offset:d,length:c,parent:r})},onObjectEnd:(u,d)=>{o(u+d),r.length=u+d-r.offset,r=r.parent,o(u+d)},onArrayBegin:(u,d)=>{r=i({type:"array",offset:u,length:-1,parent:r,children:[]})},onArrayEnd:(u,d)=>{r.length=u+d-r.offset,r=r.parent,o(u+d)},onLiteralValue:(u,d,c)=>{i({type:Fs(u),offset:d,length:c,parent:r,value:u}),o(d+c)},onSeparator:(u,d,c)=>{r.type==="property"&&(u===":"?r.colonOffset=d:u===","&&o(d))},onError:(u,d,c)=>{t.push({error:u,offset:d,length:c})}},n);const a=r.children[0];return a&&delete a.parent,a}function Ht(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 Cs(e,t,n=Ge.DEFAULT){const r=Fr(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?U=>i===0&&R(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function u(R){return R?U=>i===0&&R(U,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice()):()=>!0}function d(R){return R?()=>{i>0?i++:R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>o.slice())===!1&&(i=1)}:()=>!0}function c(R){return R?()=>{i>0&&i--,i===0&&R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}const g=d(t.onObjectBegin),h=u(t.onObjectProperty),b=c(t.onObjectEnd),N=d(t.onArrayBegin),I=c(t.onArrayEnd),y=u(t.onLiteralValue),D=a(t.onSeparator),w=s(t.onComment),f=a(t.onError),E=n&&n.disallowComments,O=n&&n.allowTrailingComma;function L(){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:E||P(11);break;case 2:P(12);break;case 6:P(16);break}switch(R){case 12:case 13:E?P(10):w();break;case 16:P(1);break;case 15:case 14:break;default:return R}}}function P(R,U=[],H=[]){if(f(R),U.length+H.length>0){let W=r.getToken();for(;W!==17;){if(U.indexOf(W)!==-1){L();break}else if(H.indexOf(W)!==-1)break;W=L()}}}function C(R){const U=r.getTokenValue();return R?y(U):(h(U),o.push(U)),L(),!0}function l(){switch(r.getToken()){case 11:const R=r.getTokenValue();let U=Number(R);isNaN(U)&&(P(2),U=0),y(U);break;case 7:y(null);break;case 8:y(!0);break;case 9:y(!1);break;default:return!1}return L(),!0}function _(){return r.getToken()!==10?(P(3,[],[2,5]),!1):(C(!1),r.getToken()===6?(D(":"),L(),q()||P(4,[],[2,5])):P(5,[],[2,5]),o.pop(),!0)}function F(){g(),L();let R=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(R||P(4,[],[]),D(","),L(),r.getToken()===2&&O)break}else R&&P(6,[],[]);_()||P(4,[],[2,5]),R=!0}return b(),r.getToken()!==2?P(7,[2],[]):L(),!0}function k(){N(),L();let R=!0,U=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(U||P(4,[],[]),D(","),L(),r.getToken()===4&&O)break}else U&&P(6,[],[]);R?(o.push(0),R=!1):o[o.length-1]++,q()||P(4,[],[4,5]),U=!0}return I(),R||o.pop(),r.getToken()!==4?P(8,[4],[]):L(),!0}function q(){switch(r.getToken()){case 3:return k();case 1:return F();case 10:return C(!0);default:return l()}}return L(),r.getToken()===17?n.allowEmptyContent?!0:(P(4,[],[]),!1):q()?(r.getToken()!==17&&P(9,[],[]),!0):(P(4,[],[]),!1)}function Fs(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 js(e,t,n,r){const o=t.slice(),s=jr(e,[]);let a,u;for(;o.length>0&&(u=o.pop(),a=Ht(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 d=Ht(a,[u]);if(d!==void 0)if(n===void 0){if(!d.parent)throw new Error("Malformed AST");const c=a.children.indexOf(d.parent);let g,h=d.parent.offset+d.parent.length;if(c>0){let b=a.children[c-1];g=b.offset+b.length}else g=a.offset+1,a.children.length>1&&(h=a.children[1].offset);return Ie(e,{offset:g,length:h-g,content:""},r)}else return Ie(e,{offset:d.offset,length:d.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];const c=`${JSON.stringify(u)}: ${JSON.stringify(n)}`,g=r.getInsertionIndex?r.getInsertionIndex(a.children.map(b=>b.children[0].value)):a.children.length;let h;if(g>0){let b=a.children[g-1];h={offset:b.offset+b.length,length:0,content:","+c}}else a.children.length===0?h={offset:a.offset+1,length:0,content:c}:h={offset:a.offset+1,length:0,content:c+","};return Ie(e,h,r)}}else if(a.type==="array"&&typeof u=="number"&&Array.isArray(a.children)){const d=u;if(d===-1){const c=`${JSON.stringify(n)}`;let g;if(a.children.length===0)g={offset:a.offset+1,length:0,content:c};else{const h=a.children[a.children.length-1];g={offset:h.offset+h.length,length:0,content:","+c}}return Ie(e,g,r)}else if(n===void 0&&a.children.length>=0){const c=u,g=a.children[c];let h;if(a.children.length===1)h={offset:a.offset+1,length:a.length-2,content:""};else if(a.children.length-1===c){let b=a.children[c-1],N=b.offset+b.length,I=a.offset+a.length;h={offset:N,length:I-2-N,content:""}}else h={offset:g.offset,length:a.children[c+1].offset-g.offset,content:""};return Ie(e,h,r)}else if(n!==void 0){let c;const g=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&a.children.length>u){const h=a.children[u];c={offset:h.offset,length:h.length,content:g}}else if(a.children.length===0||u===0)c={offset:a.offset+1,length:0,content:a.children.length===0?g:g+","};else{const h=u>a.children.length?a.children.length:u,b=a.children[h-1];c={offset:b.offset+b.length,length:0,content:","+g}}return Ie(e,c,r)}else throw new Error(`Can not ${n===void 0?"remove":r.isArrayInsertion?"insert":"modify"} Array index ${d} 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=Yt(e,t),o=t.offset,i=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;o>0&&!We(r,o-1);)o--;for(;i<r.length&&!We(r,i);)i++}const s=Ds(r,{offset:o,length:i-o},{...n.formattingOptions,keepLines:!1});for(let u=s.length-1;u>=0;u--){const d=s[u];r=Yt(r,d),o=Math.min(o,d.offset),i=Math.max(i,d.offset+d.length),i+=d.content.length-d.length}const a=e.length-(r.length-i)-o;return[{offset:o,length:a,content:r.substring(o,i)}]}function Yt(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var Ln;(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"})(Ln||(Ln={}));var _n;(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"})(_n||(_n={}));const He=jr,Xe=Ht;var Dn;(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"})(Dn||(Dn={}));function ks(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 zt(e,t,n,r){return js(e,t,n,r)}function kr(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=Yt(e,i);else throw new Error("Overlapping edit");r=i.offset}return e}const Bs="PHPWASMCLI";function Br(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},Rr={ignoreAttributes:Te.ignoreAttributes,attributeNamePrefix:Te.attributeNamePrefix,preserveOrder:Te.preserveOrder,cdataPropName:Te.cdataPropName,commentPropName:Te.commentPropName,suppressBooleanAttributes:!Te.allowBooleanAttributes,format:!0,indentBy:" "},Ye={allowEmptyContent:!0,allowTrailingComma:!0};function Rs(e,t){const{name:n,host:r,port:o,mappings:i,ideKey:s}=t,a=new Dr(Te),u=(()=>{try{return a.parse(e,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),d={server:[{}],":@":{name:n,host:`${r}:${o}`,use_path_mappings:"true"}};i&&i.length&&(d.server[0].path_mappings=i.map(w=>({mapping:[],":@":{"local-root":`$PROJECT_DIR$/${xr(oe.relative(t.projectDir,w.hostPath))}`,"remote-root":w.vfsPath}})));let c=u?.find(w=>!!w?.project);if(c){const w=c[":@"]?.version;if(w===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(w!=="4")throw new Error(`PhpStorm IDE integration only supports <project version="4"> in workspace.xml, but we found a <project> configuration with version "${w}".`)}c===void 0&&(c={project:[],":@":{version:"4"}},u.push(c));let g=c.project?.find(w=>!!w?.component&&w?.[":@"]?.name==="PhpServers");g===void 0&&(g={component:[],":@":{name:"PhpServers"}},c.project===void 0&&(c.project=[]),c.project.push(g));let h=g.component?.find(w=>!!w?.servers);h===void 0&&(h={servers:[]},g.component===void 0&&(g.component=[]),g.component.push(h));const b=h.servers?.findIndex(w=>!!w?.server&&w?.[":@"]?.name===n);(b===void 0||b<0)&&(h.servers===void 0&&(h.servers=[]),h.servers.push(d));let N=c.project?.find(w=>!!w?.component&&w?.[":@"]?.name==="RunManager");if(N===void 0&&(N={component:[],":@":{name:"RunManager"}},c.project===void 0&&(c.project=[]),c.project.push(N)),(N.component?.findIndex(w=>!!w?.configuration&&w?.[":@"]?.name===n)??-1)<0){const w={configuration:[{method:[],":@":{v:"2"}}],":@":{name:n,type:"PhpRemoteDebugRunConfigurationType",factoryName:"PHP Remote Debug",filter_connections:"FILTER",server_name:n,session_id:s}};N.component===void 0&&(N.component=[]),N.component.push(w)}const D=new ce(Rr).build(u);try{a.parse(D,!0)}catch{throw new Error("The resulting PhpStorm configuration file is not valid XML.")}return D}function Xs(e,t){const{name:n,mappings:r}=t,o=[];let i=e,s=He(i,o,Ye);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");let a=Xe(s,["configurations"]);if(a===void 0||a.children===void 0){const d=zt(i,["configurations"],[],{});i=kr(i,d),s=He(i,[],Ye),a=Xe(s,["configurations"])}const u=a?.children?.findIndex(d=>Xe(d,["name"])?.value===n);if(u===void 0||u<0){const d={name:n,type:"php",request:"launch",port:9003};r&&r.length&&(d.pathMappings=r.reduce((h,b)=>(h[b.vfsPath]=`\${workspaceFolder}/${xr(oe.relative(t.workspaceDir,b.hostPath))}`,h),{}));const c=a?.children?.length||0,g=zt(i,["configurations",c],d,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
22
+ `}});i=Xr(i,g)}return i}async function $s({name:e,ides:t,host:n,port:r,cwd:o,mounts:i,ideKey:s=Bs}){const a=i?Br(o,i):[],u={};if(t.includes("phpstorm")){const d=".idea/workspace.xml",c=oe.join(o,d);if(!Z.existsSync(c)){if(Z.existsSync(oe.dirname(c)))Z.writeFileSync(c,`<?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(p)){const f=K.readFileSync(p,"utf8"),d=_s(f,{name:e,host:n,port:r,projectDir:o,mappings:a,ideKey:s});K.writeFileSync(p,d),u.phpstorm=c}}if(t.includes("vscode")){const c=".vscode/launch.json",p=oe.join(o,c);if(!K.existsSync(p)){if(K.existsSync(oe.dirname(p)))K.writeFileSync(p,`{
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(Z.existsSync(c)){const g=Z.readFileSync(c,"utf8"),h=Rs(g,{name:e,host:n,port:r,projectDir:o,mappings:a,ideKey:s});Z.writeFileSync(c,h),u.phpstorm=d}}if(t.includes("vscode")){const d=".vscode/launch.json",c=oe.join(o,d);if(!Z.existsSync(c)){if(Z.existsSync(oe.dirname(c)))Z.writeFileSync(c,`{
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(p)){const f=K.readFileSync(p,"utf-8"),d=Ds(f,{name:e,workspaceDir:o,mappings:a});d!==f&&(K.writeFileSync(p,d),u.vscode=c)}}return u}async function Ss(e,t){const n=oe.join(t,".idea/workspace.xml");if(K.existsSync(n)){const o=K.readFileSync(n,"utf8"),i=new Pr(Ne),s=(()=>{try{return i.parse(o,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),c=s.find(f=>!!f?.project)?.project?.find(f=>!!f?.component&&f?.[":@"]?.name==="PhpServers")?.component?.find(f=>!!f?.servers),p=c?.servers?.findIndex(f=>!!f?.server&&f?.[":@"]?.name===e);if(p!==void 0&&p>=0){c.servers.splice(p,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"?>
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(Z.existsSync(c)){const g=Z.readFileSync(c,"utf-8"),h=Xs(g,{name:e,workspaceDir:o,mappings:a});h!==g&&(Z.writeFileSync(c,h),u.vscode=d)}}return u}async function Us(e,t){const n=oe.join(t,".idea/workspace.xml");if(Z.existsSync(n)){const o=Z.readFileSync(n,"utf8"),i=new Dr(Te),s=(()=>{try{return i.parse(o,!0)}catch{throw new Error("PhpStorm configuration file is not valid XML.")}})(),d=s.find(g=>!!g?.project)?.project?.find(g=>!!g?.component&&g?.[":@"]?.name==="PhpServers")?.component?.find(g=>!!g?.servers),c=d?.servers?.findIndex(g=>!!g?.server&&g?.[":@"]?.name===e);if(c!==void 0&&c>=0){d.servers.splice(c,1);const h=new ce(Rr).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"?>
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,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(c=>Re(c,["name"])?.value===e);if(u!==void 0&&u>=0){const c=Yt(i,["configurations",u],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
32
- `}}),p=jr(i,c);p===`{
31
+ </project>`?Z.unlinkSync(n):Z.writeFileSync(n,h)}}const r=oe.join(t,".vscode/launch.json");if(Z.existsSync(r)){const o=[],i=Z.readFileSync(r,"utf-8"),s=He(i,o,Ye);if(s===void 0||o.length)throw new Error("VS Code configuration file is not valid JSON.");const u=Xe(s,["configurations"])?.children?.findIndex(d=>Xe(d,["name"])?.value===e);if(u!==void 0&&u>=0){const d=zt(i,["configurations",u],void 0,{formattingOptions:{insertSpaces:!0,tabSize:4,eol:`
32
+ `}}),c=Xr(i,d);c===`{
33
33
  "configurations": []
34
- }`?K.unlinkSync(r):K.writeFileSync(r,p)}}}function Cs({cwd:e,mounts:t,pathSkippings:n}){return{pathMappings:e&&t?Cr(e,t):void 0,pathSkippings:n}}function jr(e,t){const n=[],r=Sr(e,t);if(n.length=0,He(r,n,Ge),n.length){const o=n.map(s=>({message:Ls(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
+ }`?Z.unlinkSync(r):Z.writeFileSync(r,c)}}}function Vs({cwd:e,mounts:t,pathSkippings:n}){return{pathMappings:e&&t?Br(e,t):void 0,pathSkippings:n}}function Xr(e,t){const n=[],r=kr(e,t);if(n.length=0,He(r,n,Ye),n.length){const o=n.map(s=>({message:ks(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 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 c=u.byteLength;o.byobRequest.respond(c),n+=c,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 Fs="playground-log",js=(e,...t)=>{de.dispatchEvent(new CustomEvent(Fs,{detail:{log:e,args:t}}))},ks=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",zt(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",zt(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)}},Bs=e=>e instanceof Error?[e.message,e.stack].join(`
41
- `):JSON.stringify(e,null,2),Br=[],_n=e=>{Br.push(e)},Rr=e=>{if(e.raw===!0)_n(e.message);else{const t=Us(typeof e.message=="object"?Bs(e.message):e.message,e.severity,e.prefix??Se.JS);_n(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 Rs 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.
40
+ `)}`)}return r}const $r=function(){return typeof process<"u"&&process.release?.name==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if($r==="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 d=u.byteLength;o.byobRequest.respond(d),n+=d,n>=r.size&&o.close()}})})}if($r==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(n,r={}){super(n,r),this.detail=r.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const qs="playground-log",Ws=(e,...t)=>{ge.dispatchEvent(new CustomEvent(qs,{detail:{log:e,args:t}}))},Gs=(e,...t)=>{switch(typeof e.message=="string"?Reflect.set(e,"message",Qt(e.message)):e.message.message&&typeof e.message.message=="string"&&Reflect.set(e.message,"message",Qt(e.message.message)),e.severity){case fe.Debug:console.debug(e.message,...t);break;case fe.Info:console.info(e.message,...t);break;case fe.Warn:console.warn(e.message,...t);break;case fe.Error:console.error(e.message,...t);break;case fe.Fatal:console.error(e.message,...t);break;default:console.log(e.message,...t)}},Hs=e=>e instanceof Error?[e.message,e.stack].join(`
41
+ `):JSON.stringify(e,null,2),Ur=[],Sn=e=>{Ur.push(e)},Vr=e=>{if(e.raw===!0)Sn(e.message);else{const t=Qs(typeof e.message=="object"?Hs(e.message):e.message,e.severity,e.prefix??Me.JS);Sn(t)}},fe={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}},Me={JS:"JavaScript"};class Ys extends EventTarget{constructor(t=[]){super(),this.fatalErrorEvent="playground-fatal-error",this.severity=fe.Info,this.handlers=t}getLogs(){return this.handlers.includes(Vr)?[...Ur]:(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 Xs=()=>{try{}catch{}return[Rr,ks,js]},de=new Rs(Xs()),zt=e=>e.replace(/\t/g,""),Us=(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=zt(e),`[${s}] ${n} ${t.name}: ${e}`};var H=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Kt={exports:{}},Ce=typeof Reflect=="object"?Reflect:null,Dn=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 Vs(e){console&&console.warn&&console.warn(e)}var Xr=Number.isNaN||function(t){return t!==t};function Q(){Q.init.call(this)}Kt.exports=Q;Kt.exports.once=Hs;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount=0;Q.prototype._maxListeners=void 0;var Mn=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 Mn},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+".");Mn=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")Dn(u,this,n);else for(var c=u.length,p=Hr(u,c),r=0;r<c;++r)Dn(p[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,Vs(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 $s(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function $r(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=$s.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():qs(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?Ws(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 qs(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function Ws(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function Hs(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"&&Gs(e,o,{once:!0})})}function Gs(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 en=Kt.exports;class Ys extends en.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 zs extends en.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()}}/**
43
+ `),[])}logMessage(t,...n){const r={...t,severity:t.severity??fe.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:fe.Log,prefix:Me.JS,raw:!1},...n)}debug(t,...n){this.logMessage({message:t,severity:fe.Debug,prefix:Me.JS,raw:!1},...n)}info(t,...n){this.logMessage({message:t,severity:fe.Info,prefix:Me.JS,raw:!1},...n)}warn(t,...n){this.logMessage({message:t,severity:fe.Warn,prefix:Me.JS,raw:!1},...n)}error(t,...n){this.logMessage({message:t,severity:fe.Error,prefix:Me.JS,raw:!1},...n)}}const zs=()=>{try{}catch{}return[Vr,Gs,Ws]},ge=new Ys(zs()),Qt=e=>e.replace(/\t/g,""),Qs=(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=Qt(e),`[${s}] ${n} ${t.name}: ${e}`};var G=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},tn={exports:{}},Ce=typeof Reflect=="object"?Reflect:null,Mn=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 Js(e){console&&console.warn&&console.warn(e)}var qr=Number.isNaN||function(t){return t!==t};function Q(){Q.init.call(this)}tn.exports=Q;tn.exports.once=to;Q.EventEmitter=Q;Q.prototype._events=void 0;Q.prototype._eventsCount=0;Q.prototype._maxListeners=void 0;var Cn=10;function Qe(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 Cn},set:function(e){if(typeof e!="number"||e<0||qr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Cn=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||qr(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 Wr(e){return e._maxListeners===void 0?Q.defaultMaxListeners:e._maxListeners}Q.prototype.getMaxListeners=function(){return Wr(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")Mn(u,this,n);else for(var d=u.length,c=Qr(u,d),r=0;r<d;++r)Mn(c[r],this,n);return!0};function Gr(e,t,n,r){var o,i,s;if(Qe(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=Wr(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,Js(a)}return e}Q.prototype.addListener=function(t,n){return Gr(this,t,n,!1)};Q.prototype.on=Q.prototype.addListener;Q.prototype.prependListener=function(t,n){return Gr(this,t,n,!0)};function Ks(){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 Hr(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=Ks.bind(r);return o.listener=n,r.wrapFn=o,o}Q.prototype.once=function(t,n){return Qe(n),this.on(t,Hr(this,t,n)),this};Q.prototype.prependOnceListener=function(t,n){return Qe(n),this.prependListener(t,Hr(this,t,n)),this};Q.prototype.removeListener=function(t,n){var r,o,i,s,a;if(Qe(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():Zs(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 Yr(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?eo(o):Qr(o,o.length)}Q.prototype.listeners=function(t){return Yr(this,t,!0)};Q.prototype.rawListeners=function(t){return Yr(this,t,!1)};Q.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):zr.call(e,t)};Q.prototype.listenerCount=zr;function zr(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 Qr(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function Zs(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function eo(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function to(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))}Jr(e,t,i,{once:!0}),t!=="error"&&no(e,o,{once:!0})})}function no(e,t,n){typeof e.on=="function"&&Jr(e,"error",t,n)}function Jr(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 nn=tn.exports;class ro extends nn.EventEmitter{constructor(t=9229){super(),this.ws=null,this.connected=!1,this.buffer=[],this.wss=new Ti({port:t}),this.wss.on("connection",n=>{if(this.ws){n.close();return}this.ws=n,this.emit("clientConnected"),n.on("message",r=>{ge.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);ge.debug("\x1B[1;32m[CDP][send]\x1B[0m",n),this.ws.send(n)}close(){this.wss.close()}}class io extends nn.EventEmitter{constructor(t=9003){super(),this.socket=null,this.buffer="",this.expectedLength=null,this.server=Oi.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(ge.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&&(ge.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 Qs(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 Js(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 so(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 oo(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 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}/**
51
+ */function ao(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
55
- */var he;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(he||(he={}));/**
55
+ */var de;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(de||(de={}));/**
56
56
  * @license
57
57
  * Copyright (c) 2016, Contributors
58
58
  * SPDX-License-Identifier: ISC
59
- */let me;class Ks{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=eo(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),c=r.configObjects||[],p=r.envPrefix,f=a["populate--"],d=f?"--":"_",b=Object.create(null),E=Object.create(null),v=r.__||me.format,m={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&&(m[j][A]=!0),m.arrays[A]=!0,m.keys.push(A)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(N){m.bools[N]=!0,m.keys.push(N)}),[].concat(r.string||[]).filter(Boolean).forEach(function(N){m.strings[N]=!0,m.keys.push(N)}),[].concat(r.number||[]).filter(Boolean).forEach(function(N){m.numbers[N]=!0,m.keys.push(N)}),[].concat(r.count||[]).filter(Boolean).forEach(function(N){m.counts[N]=!0,m.keys.push(N)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(N){m.normalize[N]=!0,m.keys.push(N)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([N,A])=>{typeof A=="number"&&(m.nargs[N]=A,m.keys.push(N))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([N,A])=>{typeof A=="function"&&(m.coercions[N]=A,m.keys.push(N))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(N){m.configs[N]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([N,A])=>{(typeof A=="boolean"||typeof A=="function")&&(m.configs[N]=A)})),Ke(r.key,s,r.default,m.arrays),Object.keys(u).forEach(function(N){(m.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],m.arrays)?N=l(N,B[1],o,B[2]):$(B[1],m.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,m.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,m.arrays)?N=l(N,x,o):$(x,m.nargs)!==!1?N=S(N,x,o):(U=o[N+1],U!==void 0&&(!U.match(/^-/)||U.match(D))&&!$(x,m.bools)&&!$(x,m.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,m.bools)&&!$(x,m.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,m.arrays)?N=l(N,x,o,te):$(x,m.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,m.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,m.arrays)?N=l(N,x,o):$(x,m.nargs)!==!1?N=S(N,x,o):(U=o[N+1],U!==void 0&&(!/^(-|--)[^-]/.test(U)||U.match(D))&&!$(x,m.bools)&&!$(x,m.counts)||/^(true|false)$/.test(U)?(_(x,U),N++):_(x,O(x))))}else if(A.match(/^-[0-9]$/)&&A.match(D)&&$(A.slice(1),m.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,m.aliases,u,!0),Ze(I),a["set-placeholder-key"]&&Fe(I),Object.keys(m.counts).forEach(function(N){ue(I,N.split("."))||_(N,0)}),f&&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,m.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 l(N,A,j,M){let x=[],X=M||j[N+1];const B=$(A,m.nargs);if($(A,m.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),m.aliases[N]&&m.aliases[N].forEach(function(X){const B=X.split(".");ge(I,B,M)}),x.length>1&&a["dot-notation"]&&(m.aliases[x[0]]||[]).forEach(function(X){let B=X.split(".");const U=[].concat(x);U.shift(),B=B.concat(U),(m.aliases[N]||[]).includes(B.join("."))||ge(I,B,M)}),$(N,m.normalize)&&!$(N,m.arrays)&&[N].concat(m.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){m.aliases[N]&&m.aliases[N].length||(m.aliases[N]=[A],b[A]=!0),m.aliases[A]&&m.aliases[A].length||F(A,N)}function k(N,A,j){j&&(A=to(A)),($(N,m.bools)||$(N,m.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,m.counts)&&(z(M)||typeof M=="boolean")&&(M=rt()),$(N,m.normalize)&&$(N,m.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,m.strings)&&!$(N,m.bools)&&!Array.isArray(A)&&(Js(A)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${A}`)))||!z(A)&&$(N,m.numbers))&&(A=Number(A)),A}function R(N){const A=Object.create(null);Ae(A,m.aliases,u),Object.keys(m.configs).forEach(function(j){const M=N[j]||A[j];if(M)try{let x=null;const X=me.resolve(me.cwd(),M),B=m.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,m.arrays)&&a["combine-arrays"])&&_(x,M)})}function G(){typeof c<"u"&&c.forEach(function(N){V(N)})}function W(N,A){if(typeof p>"u")return;const j=typeof p=="string"?p:"",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&&m.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,m.coercions),typeof A=="function"))try{const x=q(M,A(N[M]));[].concat(m.aliases[M]||[],M).forEach(X=>{j.add(X),N[X]=x})}catch(x){h=x}})}function Fe(N){return m.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=Sn(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=Sn(A[A.length-1]),X=$(A.join("."),m.arrays),B=Array.isArray(j);let U=a["duplicate-arguments-array"];!U&&$(x,m.nargs)&&(U=!0,(!z(M[x])&&m.nargs[x]===1||Array.isArray(M[x])&&M[x].length===m.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,m.counts)||$(x,m.bools))?M[x]=[M[x],j]:M[x]=j}function Ke(...N){N.forEach(function(A){Object.keys(A||{}).forEach(function(j){m.aliases[j]||(m.aliases[j]=[].concat(s[j]||[]),m.aliases[j].concat(j).forEach(function(M){if(/-/.test(M)&&a["camel-case-expansion"]){const x=Ue(M);x!==j&&m.aliases[j].indexOf(x)===-1&&(m.aliases[j].push(x),b[x]=!0)}}),m.aliases[j].concat(j).forEach(function(M){if(M.length>1&&/[A-Z]/.test(M)&&a["camel-case-expansion"]){const x=Qs(M,"-");x!==j&&m.aliases[j].indexOf(x)===-1&&(m.aliases[j].push(x),b[x]=!0)}}),m.aliases[j].forEach(function(M){m.aliases[M]=[j].concat(m.aliases[j].filter(function(x){return M!==x}))}))})})}function $(N,A){const j=[].concat(m.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(m);return[].concat(A.map(M=>m[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 y(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)||y(N)?!1:!et(N,/^-+([^=]+?)=[\s\S]*$/,T,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function O(N){return!$(N,m.bools)&&!$(N,m.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,m.strings)?A=he.STRING:$(N,m.numbers)?A=he.NUMBER:$(N,m.bools)?A=he.BOOLEAN:$(N,m.arrays)&&(A=he.ARRAY),A}function z(N){return N===void 0}function ne(){Object.keys(m.counts).find(N=>$(N,m.arrays)?(h=Error(v("Invalid configuration: %s, opts.count excludes opts.array.",N)),!0):$(N,m.nargs)?(h=Error(v("Invalid configuration: %s, opts.count excludes opts.narg.",N)),!0):!1)}return{aliases:Object.assign({},m.aliases),argv:Object.assign(P,I),configuration:a,defaulted:Object.assign({},E),error:h,newAliases:Object.assign({},b)}}}function eo(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 Sn(e){return e==="__proto__"?"___proto___":e}function to(e){return typeof e=="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}/**
59
+ */let ye;class uo{constructor(t){ye=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=ao(t),i=typeof t=="string",s=co(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),d=r.configObjects||[],c=r.envPrefix,g=a["populate--"],h=g?"--":"_",b=Object.create(null),N=Object.create(null),I=r.__||ye.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]+)$/,w=new RegExp("^--"+a["negation-prefix"]+"(.+)");[].concat(r.array||[]).filter(Boolean).forEach(function(T){const A=typeof T=="object"?T.key:T,j=Object.keys(T).map(function(S){return{boolean:"bools",string:"strings",number:"numbers"}[S]}).filter(Boolean).pop();j&&(y[j][A]=!0),y.arrays[A]=!0,y.keys.push(A)}),[].concat(r.boolean||[]).filter(Boolean).forEach(function(T){y.bools[T]=!0,y.keys.push(T)}),[].concat(r.string||[]).filter(Boolean).forEach(function(T){y.strings[T]=!0,y.keys.push(T)}),[].concat(r.number||[]).filter(Boolean).forEach(function(T){y.numbers[T]=!0,y.keys.push(T)}),[].concat(r.count||[]).filter(Boolean).forEach(function(T){y.counts[T]=!0,y.keys.push(T)}),[].concat(r.normalize||[]).filter(Boolean).forEach(function(T){y.normalize[T]=!0,y.keys.push(T)}),typeof r.narg=="object"&&Object.entries(r.narg).forEach(([T,A])=>{typeof A=="number"&&(y.nargs[T]=A,y.keys.push(T))}),typeof r.coerce=="object"&&Object.entries(r.coerce).forEach(([T,A])=>{typeof A=="function"&&(y.coercions[T]=A,y.keys.push(T))}),typeof r.config<"u"&&(Array.isArray(r.config)||typeof r.config=="string"?[].concat(r.config).filter(Boolean).forEach(function(T){y.configs[T]=!0}):typeof r.config=="object"&&Object.entries(r.config).forEach(([T,A])=>{(typeof A=="boolean"||typeof A=="function")&&(y.configs[T]=A)})),et(r.key,s,r.default,y.arrays),Object.keys(u).forEach(function(T){(y.aliases[T]||[]).forEach(function(A){u[A]=u[T]})});let f=null;ne();let E=[];const O=Object.assign(Object.create(null),{_:[]}),L={};for(let T=0;T<o.length;T++){const A=o[T],j=A.replace(/^-{3,}/,"---");let S,x,X,B,$,te;if(A!=="--"&&/^-/.test(A)&&p(A))P(A);else if(j.match(/^---+(=|$)/)){P(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&&(V(B[1],y.arrays)?T=l(T,B[1],o,B[2]):V(B[1],y.nargs)!==!1?T=C(T,B[1],o,B[2]):_(B[1],B[2],!0));else if(A.match(w)&&a["boolean-negation"])B=A.match(w),B!==null&&Array.isArray(B)&&B.length>=2&&(x=B[1],_(x,V(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],V(x,y.arrays)?T=l(T,x,o):V(x,y.nargs)!==!1?T=C(T,x,o):($=o[T+1],$!==void 0&&(!$.match(/^-/)||$.match(D))&&!V(x,y.bools)&&!V(x,y.counts)||/^(true|false)$/.test($)?(_(x,$),T++):_(x,v(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))$=o[T+1],B=A.match(/^-(.\..+)/),B!==null&&Array.isArray(B)&&B.length>=2&&(x=B[1],$!==void 0&&!$.match(/^-/)&&!V(x,y.bools)&&!V(x,y.counts)?(_(x,$),T++):_(x,v(x)));else if(A.match(/^-[^-]+/)&&!A.match(D)){X=A.slice(1,-1).split(""),S=!1;for(let re=0;re<X.length;re++){if($=A.slice(re+2),X[re+1]&&X[re+1]==="="){te=A.slice(re+3),x=X[re],V(x,y.arrays)?T=l(T,x,o,te):V(x,y.nargs)!==!1?T=C(T,x,o,te):_(x,te),S=!0;break}if($==="-"){_(X[re],$);continue}if(/[A-Za-z]/.test(X[re])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test($)&&V($,y.bools)===!1){_(X[re],$),S=!0;break}if(X[re+1]&&X[re+1].match(/\W/)){_(X[re],$),S=!0;break}else _(X[re],v(X[re]))}x=A.slice(-1)[0],!S&&x!=="-"&&(V(x,y.arrays)?T=l(T,x,o):V(x,y.nargs)!==!1?T=C(T,x,o):($=o[T+1],$!==void 0&&(!/^(-|--)[^-]/.test($)||$.match(D))&&!V(x,y.bools)&&!V(x,y.counts)||/^(true|false)$/.test($)?(_(x,$),T++):_(x,v(x))))}else if(A.match(/^-[0-9]$/)&&A.match(D)&&V(A.slice(1),y.bools))x=A.slice(1),_(x,v(x));else if(A==="--"){E=o.slice(T+1);break}else if(a["halt-at-non-option"]){E=o.slice(T);break}else P(A)}W(O,!0),W(O,!1),R(O),H(),Ae(O,y.aliases,u,!0),Ze(O),a["set-placeholder-key"]&&je(O),Object.keys(y.counts).forEach(function(T){ue(O,T.split("."))||_(T,0)}),g&&E.length&&(O[h]=[]),E.forEach(function(T){O[h].push(T)}),a["camel-case-expansion"]&&a["strip-dashed"]&&Object.keys(O).filter(T=>T!=="--"&&T.includes("-")).forEach(T=>{delete O[T]}),a["strip-aliased"]&&[].concat(...Object.keys(s).map(T=>s[T])).forEach(T=>{a["camel-case-expansion"]&&T.includes("-")&&delete O[T.split(".").map(A=>Ue(A)).join(".")],delete O[T]});function P(T){const A=q("_",T);(typeof A=="string"||typeof A=="number")&&O._.push(A)}function C(T,A,j,S){let x,X=V(A,y.nargs);if(X=typeof X!="number"||isNaN(X)?1:X,X===0)return z(S)||(f=Error(I("Argument unexpected for: %s",A))),_(A,v(A)),T;let B=z(S)?0:1;if(a["nargs-eats-options"])j.length-(T+1)+B<X&&(f=Error(I("Not enough arguments following: %s",A))),B=X;else{for(x=T+1;x<j.length&&(!j[x].match(/^-[^0-9]/)||j[x].match(D)||p(j[x]));x++)B++;B<X&&(f=Error(I("Not enough arguments following: %s",A)))}let $=Math.min(B,X);for(!z(S)&&$>0&&(_(A,S),$--),x=T+1;x<$+T+1;x++)_(A,j[x]);return T+$}function l(T,A,j,S){let x=[],X=S||j[T+1];const B=V(A,y.nargs);if(V(A,y.bools)&&!/^(true|false)$/.test(X))x.push(!0);else if(z(X)||z(S)&&/^-/.test(X)&&!D.test(X)&&!p(X)){if(u[A]!==void 0){const $=u[A];x=Array.isArray($)?$:[$]}}else{z(S)||x.push(k(A,S,!0));for(let $=T+1;$<j.length&&!(!a["greedy-arrays"]&&x.length>0||B&&typeof B=="number"&&x.length>=B||(X=j[$],/^-/.test(X)&&!D.test(X)&&!p(X)));$++)T=$,x.push(k(A,X,i))}return typeof B=="number"&&(B&&x.length<B||isNaN(B)&&x.length===0)&&(f=Error(I("Not enough arguments following: %s",A))),_(A,x),T}function _(T,A,j=i){if(/-/.test(T)&&a["camel-case-expansion"]){const X=T.split(".").map(function(B){return Ue(B)}).join(".");F(T,X)}const S=k(T,A,j),x=T.split(".");me(O,x,S),y.aliases[T]&&y.aliases[T].forEach(function(X){const B=X.split(".");me(O,B,S)}),x.length>1&&a["dot-notation"]&&(y.aliases[x[0]]||[]).forEach(function(X){let B=X.split(".");const $=[].concat(x);$.shift(),B=B.concat($),(y.aliases[T]||[]).includes(B.join("."))||me(O,B,S)}),V(T,y.normalize)&&!V(T,y.arrays)&&[T].concat(y.aliases[T]||[]).forEach(function(B){Object.defineProperty(L,B,{enumerable:!0,get(){return A},set($){A=typeof $=="string"?ye.normalize($):$}})})}function F(T,A){y.aliases[T]&&y.aliases[T].length||(y.aliases[T]=[A],b[A]=!0),y.aliases[A]&&y.aliases[A].length||F(A,T)}function k(T,A,j){j&&(A=lo(A)),(V(T,y.bools)||V(T,y.counts))&&typeof A=="string"&&(A=A==="true");let S=Array.isArray(A)?A.map(function(x){return q(T,x)}):q(T,A);return V(T,y.counts)&&(z(S)||typeof S=="boolean")&&(S=it()),V(T,y.normalize)&&V(T,y.arrays)&&(Array.isArray(A)?S=A.map(x=>ye.normalize(x)):S=ye.normalize(A)),S}function q(T,A){return!a["parse-positional-numbers"]&&T==="_"||!V(T,y.strings)&&!V(T,y.bools)&&!Array.isArray(A)&&(oo(A)&&a["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${A}`)))||!z(A)&&V(T,y.numbers))&&(A=Number(A)),A}function R(T){const A=Object.create(null);Ae(A,y.aliases,u),Object.keys(y.configs).forEach(function(j){const S=T[j]||A[j];if(S)try{let x=null;const X=ye.resolve(ye.cwd(),S),B=y.configs[j];if(typeof B=="function"){try{x=B(X)}catch($){x=$}if(x instanceof Error){f=x;return}}else x=ye.require(X);U(x)}catch(x){x.name==="PermissionDenied"?f=x:T[j]&&(f=Error(I("Invalid JSON config file: %s",S)))}})}function U(T,A){Object.keys(T).forEach(function(j){const S=T[j],x=A?A+"."+j:j;typeof S=="object"&&S!==null&&!Array.isArray(S)&&a["dot-notation"]?U(S,x):(!ue(O,x.split("."))||V(x,y.arrays)&&a["combine-arrays"])&&_(x,S)})}function H(){typeof d<"u"&&d.forEach(function(T){U(T)})}function W(T,A){if(typeof c>"u")return;const j=typeof c=="string"?c:"",S=ye.env();Object.keys(S).forEach(function(x){if(j===""||x.lastIndexOf(j,0)===0){const X=x.split("__").map(function(B,$){return $===0&&(B=B.substring(j.length)),Ue(B)});(A&&y.configs[X.join(".")]||!A)&&!ue(T,X)&&_(X.join("."),S[x])}})}function Ze(T){let A;const j=new Set;Object.keys(T).forEach(function(S){if(!j.has(S)&&(A=V(S,y.coercions),typeof A=="function"))try{const x=q(S,A(T[S]));[].concat(y.aliases[S]||[],S).forEach(X=>{j.add(X),T[X]=x})}catch(x){f=x}})}function je(T){return y.keys.forEach(A=>{~A.indexOf(".")||typeof T[A]>"u"&&(T[A]=void 0)}),T}function Ae(T,A,j,S=!1){Object.keys(j).forEach(function(x){ue(T,x.split("."))||(me(T,x.split("."),j[x]),S&&(N[x]=!0),(A[x]||[]).forEach(function(X){ue(T,X.split("."))||me(T,X.split("."),j[x])}))})}function ue(T,A){let j=T;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(x){j=j[x]||{}});const S=A[A.length-1];return typeof j!="object"?!1:S in j}function me(T,A,j){let S=T;a["dot-notation"]||(A=[A.join(".")]),A.slice(0,-1).forEach(function(te){te=Fn(te),typeof S=="object"&&S[te]===void 0&&(S[te]={}),typeof S[te]!="object"||Array.isArray(S[te])?(Array.isArray(S[te])?S[te].push({}):S[te]=[S[te],{}],S=S[te][S[te].length-1]):S=S[te]});const x=Fn(A[A.length-1]),X=V(A.join("."),y.arrays),B=Array.isArray(j);let $=a["duplicate-arguments-array"];!$&&V(x,y.nargs)&&($=!0,(!z(S[x])&&y.nargs[x]===1||Array.isArray(S[x])&&S[x].length===y.nargs[x])&&(S[x]=void 0)),j===it()?S[x]=it(S[x]):Array.isArray(S[x])?$&&X&&B?S[x]=a["flatten-duplicate-arrays"]?S[x].concat(j):(Array.isArray(S[x][0])?S[x]:[S[x]]).concat([j]):!$&&!!X==!!B?S[x]=j:S[x]=S[x].concat([j]):S[x]===void 0&&X?S[x]=B?j:[j]:$&&!(S[x]===void 0||V(x,y.counts)||V(x,y.bools))?S[x]=[S[x],j]:S[x]=j}function et(...T){T.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(S){if(/-/.test(S)&&a["camel-case-expansion"]){const x=Ue(S);x!==j&&y.aliases[j].indexOf(x)===-1&&(y.aliases[j].push(x),b[x]=!0)}}),y.aliases[j].concat(j).forEach(function(S){if(S.length>1&&/[A-Z]/.test(S)&&a["camel-case-expansion"]){const x=so(S,"-");x!==j&&y.aliases[j].indexOf(x)===-1&&(y.aliases[j].push(x),b[x]=!0)}}),y.aliases[j].forEach(function(S){y.aliases[S]=[j].concat(y.aliases[j].filter(function(x){return S!==x}))}))})})}function V(T,A){const j=[].concat(y.aliases[T]||[],T),S=Object.keys(A),x=j.find(X=>S.includes(X));return x?A[x]:!1}function Pe(T){const A=Object.keys(y);return[].concat(A.map(S=>y[S])).some(function(S){return Array.isArray(S)?S.includes(T):S[T]})}function tt(T,...A){return[].concat(...A).some(function(S){const x=T.match(S);return x&&Pe(x[1])})}function m(T){if(T.match(D)||!T.match(/^-[^-]+/))return!1;let A=!0,j;const S=T.slice(1).split("");for(let x=0;x<S.length;x++){if(j=T.slice(x+2),!Pe(S[x])){A=!1;break}if(S[x+1]&&S[x+1]==="="||j==="-"||/[A-Za-z]/.test(S[x])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(j)||S[x+1]&&S[x+1].match(/\W/))break}return A}function p(T){return a["unknown-options-as-args"]&&M(T)}function M(T){return T=T.replace(/^-{3,}/,"--"),T.match(D)||m(T)?!1:!tt(T,/^-+([^=]+?)=[\s\S]*$/,w,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function v(T){return!V(T,y.bools)&&!V(T,y.counts)&&`${T}`in u?u[T]:Y(J(T))}function Y(T){return{[de.BOOLEAN]:!0,[de.STRING]:"",[de.NUMBER]:void 0,[de.ARRAY]:[]}[T]}function J(T){let A=de.BOOLEAN;return V(T,y.strings)?A=de.STRING:V(T,y.numbers)?A=de.NUMBER:V(T,y.bools)?A=de.BOOLEAN:V(T,y.arrays)&&(A=de.ARRAY),A}function z(T){return T===void 0}function ne(){Object.keys(y.counts).find(T=>V(T,y.arrays)?(f=Error(I("Invalid configuration: %s, opts.count excludes opts.array.",T)),!0):V(T,y.nargs)?(f=Error(I("Invalid configuration: %s, opts.count excludes opts.narg.",T)),!0):!1)}return{aliases:Object.assign({},y.aliases),argv:Object.assign(L,O),configuration:a,defaulted:Object.assign({},N),error:f,newAliases:Object.assign({},b)}}}function co(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 it(e){return e!==void 0?e+1:1}function Fn(e){return e==="__proto__"?"___proto___":e}function lo(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 Cn=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])<Cn)throw Error(`yargs parser supports a minimum Node.js version of ${Cn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const no=process?process.env:{};new Ks({cwd:process.cwd,env:()=>no,format:Ir,normalize:gi,resolve:Zt,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Jt(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const ro={fs:{readFileSync:Jt,writeFile:ui},format:Ir,resolve:Zt,exists:e=>{try{return ci(e).isFile()}catch{return!1}}};let pe;class io{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 so(e,t){pe=t;const n=new io(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 oo=e=>so(e,ro);let Xe;try{Xe=Ei(import.meta.url)}catch{Xe=process.cwd()}const ao=Xe.substring(0,Xe.lastIndexOf("node_modules"));ao||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,oo({directory:Zt(Xe,"../../../locales"),updateFiles:!1});var at={},jn;function tn(){return jn||(jn=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={},kn;function Ee(){return kn||(kn=1,function(){var e,t,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;e=function(){var c,p,f,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(c=0,f=b.length;c<f;c++)if(d=b[c],d!=null)for(p in d)u.call(d,p)&&(E[p]=d[p]);return E},o=function(c){return!!c&&Object.prototype.toString.call(c)==="[object Function]"},i=function(c){var p;return!!c&&((p=typeof c)=="function"||p==="object")},n=function(c){return o(Array.isArray)?Array.isArray(c):Object.prototype.toString.call(c)==="[object Array]"},r=function(c){var p;if(n(c))return!c.length;for(p in c)if(u.call(c,p))return!1;return!0},s=function(c){var p,f;return i(c)&&(f=Object.getPrototypeOf(c))&&(p=f.constructor)&&typeof p=="function"&&p instanceof p&&Function.prototype.toString.call(p)===Function.prototype.toString.call(Object)},t=function(c){return o(c.valueOf)?c.valueOf():c},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:{}},Bn;function Yr(){return Bn||(Bn=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:{}},Rn;function uo(){return Rn||(Rn=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:{}},Xn;function co(){return Xn||(Xn=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 Un;function lo(){return Un||(Un=1,function(){var e,t;e=uo(),t=co(),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:{}},Vn;function ee(){return Vn||(Vn=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:{}},$n;function zr(){return $n||($n=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:{}},qn;function nn(){return qn||(qn=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 Wn;function rn(){return Wn||(Wn=1,function(){var e,t,n,r,o,i,s,a,u=function(p,f){for(var d in f)c.call(f,d)&&(p[d]=f[d]);function b(){this.constructor=p}return b.prototype=f.prototype,p.prototype=new b,p.__super__=f.prototype,p},c={}.hasOwnProperty;a=Ee(),s=a.isObject,i=a.isFunction,o=a.getValue,r=fe(),e=ee(),t=zr(),n=nn(),gt.exports=function(p){u(f,p);function f(d,b,E){var v,m,D,T;if(f.__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,m=0,D=T.length;m<D;m++)if(v=T[m],v.type===e.DocType){v.name=this.name;break}}}return Object.defineProperty(f.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(f.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(f.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(f.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(f.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(f.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),f.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)c.call(v,b)&&(d=v[b],E.attribs[b]=d.clone());return E.children=[],this.children.forEach(function(m){var D;return D=m.clone(),D.parent=E,E.children.push(D)}),E},f.prototype.attribute=function(d,b){var E,v;if(d!=null&&(d=o(d)),s(d))for(E in d)c.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},f.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},f.prototype.toString=function(d){return this.options.writer.element(this,this.options.writer.filterOptions(d))},f.prototype.att=function(d,b){return this.attribute(d,b)},f.prototype.a=function(d,b){return this.attribute(d,b)},f.prototype.getAttribute=function(d){return this.attribs.hasOwnProperty(d)?this.attribs[d].value:null},f.prototype.setAttribute=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNode=function(d){return this.attribs.hasOwnProperty(d)?this.attribs[d]:null},f.prototype.setAttributeNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.removeAttributeNode=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setAttributeNS=function(d,b,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.removeAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getAttributeNodeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setAttributeNodeNS=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagNameNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.hasAttribute=function(d){return this.attribs.hasOwnProperty(d)},f.prototype.hasAttributeNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setIdAttribute=function(d,b){return this.attribs.hasOwnProperty(d)?this.attribs[d].isId:b},f.prototype.setIdAttributeNS=function(d,b,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.setIdAttributeNode=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByTagNameNS=function(d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.getElementsByClassName=function(d){throw new Error("This DOM method is not implemented."+this.debugInfo())},f.prototype.isEqualNode=function(d){var b,E,v;if(!f.__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},f}(r)}.call(H)),gt.exports}var wt={exports:{}},Et={exports:{}},Hn;function Qe(){return Hn||(Hn=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 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(),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:{}},Yn;function on(){return Yn||(Yn=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:{}},zn;function an(){return zn||(zn=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,c,p){var f;s.__super__.constructor.call(this,a),n(u)&&(f=u,u=f.version,c=f.encoding,p=f.standalone),u||(u="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(u),c!=null&&(this.encoding=this.stringify.xmlEncoding(c)),p!=null&&(this.standalone=this.stringify.xmlStandalone(p))}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:{}},Qn;function un(){return Qn||(Qn=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,c,p,f){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(!c)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!p)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(p.indexOf("#")!==0&&(p="#"+p),!p.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(f&&!p.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(a));this.elementName=this.stringify.name(a),this.type=e.AttributeDeclaration,this.attributeName=this.stringify.name(u),this.attributeType=this.stringify.dtdAttType(c),f&&(this.defaultValue=this.stringify.dtdAttDefault(f)),this.defaultValueType=p}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:{}},Jn;function cn(){return Jn||(Jn=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,c,p){if(s.__super__.constructor.call(this,a),c==null)throw new Error("Missing DTD entity name. "+this.debugInfo(c));if(p==null)throw new Error("Missing DTD entity value. "+this.debugInfo(c));if(this.pe=!!u,this.name=this.stringify.name(c),this.type=e.EntityDeclaration,!n(p))this.value=this.stringify.dtdEntityValue(p),this.internal=!0;else{if(!p.pubID&&!p.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(c));if(p.pubID&&!p.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(c));if(this.internal=!1,p.pubID!=null&&(this.pubID=this.stringify.dtdPubID(p.pubID)),p.sysID!=null&&(this.sysID=this.stringify.dtdSysID(p.sysID)),p.nData!=null&&(this.nData=this.stringify.dtdNData(p.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(c))}}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:{}},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(),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:{}},Kn;function fn(){return Kn||(Kn=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 er;function pn(){return er||(er=1,function(){var e,t,n,r,o,i,s,a,u=function(p,f){for(var d in f)c.call(f,d)&&(p[d]=f[d]);function b(){this.constructor=p}return b.prototype=f.prototype,p.prototype=new b,p.__super__=f.prototype,p},c={}.hasOwnProperty;a=Ee().isObject,s=fe(),e=ee(),t=un(),r=cn(),n=ln(),o=fn(),i=nn(),It.exports=function(p){u(f,p);function f(d,b,E){var v,m,D,T,h,w;if(f.__super__.constructor.call(this,d),this.type=e.DocType,d.children){for(T=d.children,m=0,D=T.length;m<D;m++)if(v=T[m],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(f.prototype,"entities",{get:function(){var d,b,E,v,m;for(v={},m=this.children,b=0,E=m.length;b<E;b++)d=m[b],d.type===e.EntityDeclaration&&!d.pe&&(v[d.name]=d);return new i(v)}}),Object.defineProperty(f.prototype,"notations",{get:function(){var d,b,E,v,m;for(v={},m=this.children,b=0,E=m.length;b<E;b++)d=m[b],d.type===e.NotationDeclaration&&(v[d.name]=d);return new i(v)}}),Object.defineProperty(f.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(f.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(f.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),f.prototype.element=function(d,b){var E;return E=new n(this,d,b),this.children.push(E),this},f.prototype.attList=function(d,b,E,v,m){var D;return D=new t(this,d,b,E,v,m),this.children.push(D),this},f.prototype.entity=function(d,b){var E;return E=new r(this,!1,d,b),this.children.push(E),this},f.prototype.pEntity=function(d,b){var E;return E=new r(this,!0,d,b),this.children.push(E),this},f.prototype.notation=function(d,b){var E;return E=new o(this,d,b),this.children.push(E),this},f.prototype.toString=function(d){return this.options.writer.docType(this,this.options.writer.filterOptions(d))},f.prototype.ele=function(d,b){return this.element(d,b)},f.prototype.att=function(d,b,E,v,m){return this.attList(d,b,E,v,m)},f.prototype.ent=function(d,b){return this.entity(d,b)},f.prototype.pent=function(d,b){return this.pEntity(d,b)},f.prototype.not=function(d,b){return this.notation(d,b)},f.prototype.up=function(){return this.root()||this.documentObject},f.prototype.isEqualNode=function(d){return!(!f.__super__.isEqualNode.apply(this,arguments).isEqualNode(d)||d.name!==this.name||d.publicId!==this.publicId||d.systemId!==this.systemId)},f}(s)}.call(H)),It.exports}var Lt={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=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:{}},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(),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:{}},rr;function gn(){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;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:{}},ir;function Qr(){return ir||(ir=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:{}},sr;function fo(){return sr||(sr=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:{}},or;function po(){return or||(or=1,function(){St.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(H)),St.exports}var ar;function fe(){return ar||(ar=1,function(){var e,t,n,r,o,i,s,a,u,c,p,f,d,b,E,v,m,D={}.hasOwnProperty;m=Ee(),v=m.isObject,E=m.isFunction,b=m.isEmpty,d=m.getValue,a=null,n=null,r=null,o=null,i=null,p=null,f=null,c=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=rn(),n=sn(),r=on(),o=an(),i=pn(),p=hn(),f=dn(),c=gn(),s=Qr(),t=ee(),u=fo(),nn(),e=po())}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,l,_,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(l=0,q=G.length;l<q;l++)L=G[l],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,l,_;if(h?.type)return S=h,l=w,S.setParent(this),l?(L=children.indexOf(l),_=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 f(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 p(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,l;if(h!=null&&(h=d(h)),w!=null&&(w=d(w)),Array.isArray(h))for(S=0,l=h.length;S<l;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 c(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,l,_,F,k,q,R;for(P=this.document(),L=new i(P,h,w),q=P.children,S=l=0,F=q.length;l<F;S=++l)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,l;for(h||(h=this.document()),S=h.children,P=0,L=S.length;P<L;P++){if(I=S[P],l=w(I))return l;if(l=this.foreachTreeNode(I,w),l)return l}},T}()}.call(H)),dt.exports}var Ct={exports:{}},ur;function Jr(){return ur||(ur=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:{}},cr;function Je(){return cr||(cr=1,function(){kt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(H)),kt.exports}var lr;function Zr(){return lr||(lr=1,function(){var e,t,n,r={}.hasOwnProperty;n=Ee().assign,e=ee(),an(),pn(),sn(),on(),rn(),hn(),dn(),gn(),Qr(),un(),ln(),cn(),fn(),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,c,p,f,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=(c=i.offset)!=null?c:0,s.dontPrettyTextNodes=(p=(f=i.dontPrettyTextNodes)!=null?f:i.dontprettytextnodes)!=null?p: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,c,p,f,d;if(a||(a=0),this.openNode(i,s,a),s.state=t.OpenTag,f=this.indent(i,s,a),f+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?f+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(f+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(f+=" [",f+=this.endline(i,s,a),s.state=t.InsideTag,d=i.children,c=0,p=d.length;c<p;c++)u=d[c],f+=this.writeChildNode(u,s,a+1);s.state=t.CloseTag,f+="]"}return s.state=t.CloseTag,f+=s.spaceBeforeSlash+">",f+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),f},o.prototype.element=function(i,s,a){var u,c,p,f,d,b,E,v,m,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(m in h)r.call(h,m)&&(u=h[m],T+=this.attribute(u,s,a));if(p=i.children.length,f=p===0?null:i.children[0],p===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&&p===1&&(f.type===e.Text||f.type===e.Raw)&&f.value!=null)T+=">",s.state=t.InsideTag,s.suppressPrettyCount++,D=!0,T+=this.writeChildNode(f,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(c=w[d],(c.type===e.Text||c.type===e.Raw)&&c.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++)c=I[b],T+=this.writeChildNode(c,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 fr;function mn(){return fr||(fr=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,c,p,f;for(s=this.filterOptions(s),p="",f=i.children,u=0,c=f.length;u<c;u++)a=f[u],p+=this.writeChildNode(a,s,0);return s.pretty&&p.slice(-s.newline.length)===s.newline&&(p=p.slice(0,-s.newline.length)),p},o}(e)}.call(H)),Ft.exports}var pr;function Kr(){return pr||(pr=1,function(){var e,t,n,r,o,i,s,a=function(c,p){for(var f in p)u.call(p,f)&&(c[f]=p[f]);function d(){this.constructor=c}return d.prototype=p.prototype,c.prototype=new d,c.__super__=p.prototype,c},u={}.hasOwnProperty;s=Ee().isPlainObject,n=Yr(),t=lo(),r=fe(),e=ee(),i=Jr(),o=mn(),lt.exports=function(c){a(p,c);function p(f){p.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,f||(f={}),f.writer||(f.writer=new o),this.options=f,this.stringify=new i(f)}return Object.defineProperty(p.prototype,"implementation",{value:new n}),Object.defineProperty(p.prototype,"doctype",{get:function(){var f,d,b,E;for(E=this.children,d=0,b=E.length;d<b;d++)if(f=E[d],f.type===e.DocType)return f;return null}}),Object.defineProperty(p.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(p.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(p.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(p.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(p.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(p.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(p.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(p.prototype,"origin",{get:function(){return null}}),Object.defineProperty(p.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(p.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(p.prototype,"contentType",{get:function(){return null}}),p.prototype.end=function(f){var d;return d={},f?s(f)&&(d=f,f=this.options.writer):f=this.options.writer,f.document(this,f.filterOptions(d))},p.prototype.toString=function(f){return this.options.writer.document(this,this.options.writer.filterOptions(f))},p.prototype.createElement=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createTextNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createComment=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createCDATASection=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createProcessingInstruction=function(f,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createAttribute=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createEntityReference=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.importNode=function(f,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createElementNS=function(f,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createAttributeNS=function(f,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByTagNameNS=function(f,d){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementById=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.adoptNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.renameNode=function(f,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.getElementsByClassName=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createEvent=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createNodeIterator=function(f,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p.prototype.createTreeWalker=function(f,d,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},p}(r)}.call(H)),lt.exports}var Bt={exports:{}},hr;function ho(){return hr||(hr=1,function(){var e,t,n,r,o,i,s,a,u,c,p,f,d,b,E,v,m,D,T,h,w,I,P,L={}.hasOwnProperty;P=Ee(),w=P.isObject,h=P.isFunction,I=P.isPlainObject,T=P.getValue,e=ee(),f=Kr(),d=rn(),r=sn(),o=on(),E=hn(),D=dn(),b=gn(),c=an(),p=pn(),i=un(),a=cn(),s=ln(),u=fn(),n=zr(),m=Jr(),v=mn(),t=Je(),Bt.exports=function(){function S(l,_,F){var k;this.name="?xml",this.type=e.Document,l||(l={}),k={},l.writer?I(l.writer)&&(k=l.writer,l.writer=new v):l.writer=new v,this.options=l,this.writer=l.writer,this.writerOptions=this.writer.filterOptions(k),this.stringify=new m(l),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(l){var _,F,k,q,R,V,G,W;switch(l.type){case e.CData:this.cdata(l.value);break;case e.Comment:this.comment(l.value);break;case e.Element:k={},G=l.attribs;for(F in G)L.call(G,F)&&(_=G[F],k[F]=_.value);this.node(l.name,k);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(l.value);break;case e.Text:this.text(l.value);break;case e.ProcessingInstruction:this.instruction(l.target,l.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+l.constructor.name)}for(W=l.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(l,_,F){var k;if(l==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(l));return this.openCurrent(),l=T(l),_==null&&(_={}),_=T(_),w(_)||(k=[_,F],F=k[0],_=k[1]),this.currentNode=new d(this,l,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},S.prototype.element=function(l,_,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(l)||w(l)||h(l))for(V=this.options.noValidation,this.options.noValidation=!0,W=new f(this.options).element("TEMP_ROOT"),W.element(l),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(l,_,F);return this},S.prototype.attribute=function(l,_){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(l));if(l!=null&&(l=T(l)),w(l))for(F in l)L.call(l,F)&&(k=l[F],this.attribute(F,k));else h(_)&&(_=_.apply()),this.options.keepNullAttributes&&_==null?this.currentNode.attribs[l]=new n(this,l,""):_!=null&&(this.currentNode.attribs[l]=new n(this,l,_));return this},S.prototype.text=function(l){var _;return this.openCurrent(),_=new D(this,l),this.onData(this.writer.text(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.cdata=function(l){var _;return this.openCurrent(),_=new r(this,l),this.onData(this.writer.cdata(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.comment=function(l){var _;return this.openCurrent(),_=new o(this,l),this.onData(this.writer.comment(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.raw=function(l){var _;return this.openCurrent(),_=new E(this,l),this.onData(this.writer.raw(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.instruction=function(l,_){var F,k,q,R,V;if(this.openCurrent(),l!=null&&(l=T(l)),_!=null&&(_=T(_)),Array.isArray(l))for(F=0,R=l.length;F<R;F++)k=l[F],this.instruction(k);else if(w(l))for(k in l)L.call(l,k)&&(q=l[k],this.instruction(k,q));else h(_)&&(_=_.apply()),V=new b(this,l,_),this.onData(this.writer.processingInstruction(V,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},S.prototype.declaration=function(l,_,F){var k;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return k=new c(this,l,_,F),this.onData(this.writer.declaration(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.doctype=function(l,_,F){if(this.openCurrent(),l==null)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new p(this,_,F),this.currentNode.rootNodeName=l,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},S.prototype.dtdElement=function(l,_){var F;return this.openCurrent(),F=new s(this,l,_),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.attList=function(l,_,F,k,q){var R;return this.openCurrent(),R=new i(this,l,_,F,k,q),this.onData(this.writer.dtdAttList(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.entity=function(l,_){var F;return this.openCurrent(),F=new a(this,!1,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.pEntity=function(l,_){var F;return this.openCurrent(),F=new a(this,!0,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},S.prototype.notation=function(l,_){var F;return this.openCurrent(),F=new u(this,l,_),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(l){var _,F,k,q;if(!l.isOpen){if(!this.root&&this.currentLevel===0&&l.type===e.Element&&(this.root=l),F="",l.type===e.Element){this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<"+l.name,q=l.attribs;for(k in q)L.call(q,k)&&(_=q[k],F+=this.writer.attribute(_,this.writerOptions,this.currentLevel));F+=(l.children?">":"/>")+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+l.rootNodeName,l.pubID&&l.sysID?F+=' PUBLIC "'+l.pubID+'" "'+l.sysID+'"':l.sysID&&(F+=' SYSTEM "'+l.sysID+'"'),l.children?(F+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,F+=">"),F+=this.writer.endline(l,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),l.isOpen=!0}},S.prototype.closeNode=function(l){var _;if(!l.isClosed)return _="",this.writerOptions.state=t.CloseTag,l.type===e.Element?_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"</"+l.name+">"+this.writer.endline(l,this.writerOptions,this.currentLevel):_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(_,this.currentLevel),l.isClosed=!0},S.prototype.onData=function(l,_){return this.documentStarted=!0,this.onDataCallback(l,_+1)},S.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},S.prototype.debugInfo=function(l){return l==null?"":"node: <"+l+">"},S.prototype.ele=function(){return this.element.apply(this,arguments)},S.prototype.nod=function(l,_,F){return this.node(l,_,F)},S.prototype.txt=function(l){return this.text(l)},S.prototype.dat=function(l){return this.cdata(l)},S.prototype.com=function(l){return this.comment(l)},S.prototype.ins=function(l,_){return this.instruction(l,_)},S.prototype.dec=function(l,_,F){return this.declaration(l,_,F)},S.prototype.dtd=function(l,_,F){return this.doctype(l,_,F)},S.prototype.e=function(l,_,F){return this.element(l,_,F)},S.prototype.n=function(l,_,F){return this.node(l,_,F)},S.prototype.t=function(l){return this.text(l)},S.prototype.d=function(l){return this.cdata(l)},S.prototype.c=function(l){return this.comment(l)},S.prototype.r=function(l){return this.raw(l)},S.prototype.i=function(l,_){return this.instruction(l,_)},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(l,_){return this.entity(l,_)},S.prototype.pent=function(l,_){return this.pEntity(l,_)},S.prototype.not=function(l,_){return this.notation(l,_)},S}()}.call(H)),Bt.exports}var Rt={exports:{}},dr;function go(){return dr||(dr=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,c){return a.isLastRootNode&&u.state===t.CloseTag?"":s.__super__.endline.call(this,a,u,c)},s.prototype.document=function(a,u){var c,p,f,d,b,E,v,m,D;for(v=a.children,p=f=0,b=v.length;f<b;p=++f)c=v[p],c.isLastRootNode=p===a.children.length-1;for(u=this.filterOptions(u),m=a.children,D=[],d=0,E=m.length;d<E;d++)c=m[d],D.push(this.writeChildNode(c,u,0));return D},s.prototype.attribute=function(a,u,c){return this.stream.write(s.__super__.attribute.call(this,a,u,c))},s.prototype.cdata=function(a,u,c){return this.stream.write(s.__super__.cdata.call(this,a,u,c))},s.prototype.comment=function(a,u,c){return this.stream.write(s.__super__.comment.call(this,a,u,c))},s.prototype.declaration=function(a,u,c){return this.stream.write(s.__super__.declaration.call(this,a,u,c))},s.prototype.docType=function(a,u,c){var p,f,d,b;if(c||(c=0),this.openNode(a,u,c),u.state=t.OpenTag,this.stream.write(this.indent(a,u,c)),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,c)),u.state=t.InsideTag,b=a.children,f=0,d=b.length;f<d;f++)p=b[f],this.writeChildNode(p,u,c+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,c)),u.state=t.None,this.closeNode(a,u,c)},s.prototype.element=function(a,u,c){var p,f,d,b,E,v,m,D,T;c||(c=0),this.openNode(a,u,c),u.state=t.OpenTag,this.stream.write(this.indent(a,u,c)+"<"+a.name),D=a.attribs;for(m in D)o.call(D,m)&&(p=D[m],this.attribute(p,u,c));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,c+1),u.suppressPrettyCount--,u.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,c)),u.state=t.InsideTag,T=a.children,E=0,v=T.length;E<v;E++)f=T[E],this.writeChildNode(f,u,c+1);u.state=t.CloseTag,this.stream.write(this.indent(a,u,c)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,c)),u.state=t.None,this.closeNode(a,u,c)},s.prototype.processingInstruction=function(a,u,c){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,c))},s.prototype.raw=function(a,u,c){return this.stream.write(s.__super__.raw.call(this,a,u,c))},s.prototype.text=function(a,u,c){return this.stream.write(s.__super__.text.call(this,a,u,c))},s.prototype.dtdAttList=function(a,u,c){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,c))},s.prototype.dtdElement=function(a,u,c){return this.stream.write(s.__super__.dtdElement.call(this,a,u,c))},s.prototype.dtdEntity=function(a,u,c){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,c))},s.prototype.dtdNotation=function(a,u,c){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,c))},s}(n)}.call(H)),Rt.exports}var gr;function mo(){return gr||(gr=1,function(){var e,t,n,r,o,i,s,a,u,c;c=Ee(),a=c.assign,u=c.isFunction,n=Yr(),r=Kr(),o=ho(),s=mn(),i=go(),e=ee(),t=Je(),ye.create=function(p,f,d,b){var E,v;if(p==null)throw new Error("Root element needs a name.");return b=a({},f,d,b),E=new r(b),v=E.element(p),b.headless||(E.declaration(b),(b.pubID!=null||b.sysID!=null)&&E.dtd(b)),v},ye.begin=function(p,f,d){var b;return u(p)&&(b=[p,f],f=b[0],d=b[1],p={}),f?new o(p,f,d):new r(p)},ye.stringWriter=function(p){return new s(p)},ye.streamWriter=function(p,f){return new i(p,f)},ye.implementation=new n,ye.nodeType=e,ye.writerState=t}.call(H)),ye}var mr;function yo(){return mr||(mr=1,function(){var e,t,n,r,o,i={}.hasOwnProperty;e=mo(),t=tn().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,c,p;this.options={},c=t["0.2"];for(u in c)i.call(c,u)&&(p=c[u],this.options[u]=p);for(u in a)i.call(a,u)&&(p=a[u],this.options[u]=p)}return s.prototype.buildObject=function(a){var u,c,p,f,d;return u=this.options.attrkey,c=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,p=function(b){return function(E,v){var m,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=p(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(m in D)I=D[m],E=E.att(m,I)}else if(w===c)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=p(E.ele(w),T).up());else typeof D=="object"?E=p(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),f=e.create(d,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),p(f,a).end(this.options.renderOpts)},s}()}.call(H)),ut}var Xt={},Ut={},yr;function bo(){return yr||(yr=1,function(e){(function(t){t.parser=function(y,g){return new r(y,g)},t.SAXParser=r,t.SAXStream=p,t.createStream=c,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(y,g){if(!(this instanceof r))return new r(y,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=!!y,C.noscript=!!(y||C.opt.noscript),C.state=l.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=!y),C.trackPosition=C.opt.position!==!1,C.trackPosition&&(C.position=C.line=C.column=0),F(C,"onready")}Object.create||(Object.create=function(y){function g(){}g.prototype=y;var C=new g;return C}),Object.keys||(Object.keys=function(y){var g=[];for(var C in y)y.hasOwnProperty(C)&&g.push(C);return g});function o(y){for(var g=Math.max(t.MAX_BUFFER_LENGTH,10),C=0,O=0,Y=n.length;O<Y;O++){var J=y[n[O]].length;if(J>g)switch(n[O]){case"textNode":q(y);break;case"cdata":k(y,"oncdata",y.cdata),y.cdata="";break;case"script":k(y,"onscript",y.script),y.script="";break;default:V(y,"Max buffer length exceeded: "+n[O])}C=Math.max(C,J)}var z=t.MAX_BUFFER_LENGTH-C;y.bufferCheckPosition=z+y.position}function i(y){for(var g=0,C=n.length;g<C;g++)y[n[g]]=""}function s(y){q(y),y.cdata!==""&&(k(y,"oncdata",y.cdata),y.cdata=""),y.script!==""&&(k(y,"onscript",y.script),y.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(y){return y!=="error"&&y!=="end"});function c(y,g){return new p(y,g)}function p(y,g){if(!(this instanceof p))return new p(y,g);a.apply(this),this._parser=new r(y,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})})}p.prototype=Object.create(a.prototype,{constructor:{value:p}}),p.prototype.write=function(y){return typeof Buffer=="function"&&typeof Buffer.isBuffer=="function"&&Buffer.isBuffer(y)&&(this._decoder||(this._decoder=new TextDecoder("utf8")),y=this._decoder.decode(y,{stream:!0})),this._parser.write(y.toString()),this.emit("data",y),!0},p.prototype.end=function(y){if(y&&y.length&&this.write(y),this._decoder){var g=this._decoder.decode();g&&(this._parser.write(g),this.emit("data",g))}return this._parser.end(),!0},p.prototype.on=function(y,g){var C=this;return!C._parser["on"+y]&&u.indexOf(y)!==-1&&(C._parser["on"+y]=function(){var O=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);O.splice(0,0,y),C.emit.apply(C,O)}),a.prototype.on.call(C,y,g)};var f="[CDATA[",d="DOCTYPE",b="http://www.w3.org/XML/1998/namespace",E="http://www.w3.org/2000/xmlns/",v={xml:b,xmlns:E},m=/[:_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(y){return y===" "||y===`
69
- `||y==="\r"||y===" "}function I(y){return y==='"'||y==="'"}function P(y){return y===">"||w(y)}function L(y,g){return y.test(g)}function S(y,g){return!L(y,g)}var l=0;t.STATE={BEGIN:l++,BEGIN_WHITESPACE:l++,TEXT:l++,TEXT_ENTITY:l++,OPEN_WAKA:l++,SGML_DECL:l++,SGML_DECL_QUOTED:l++,DOCTYPE:l++,DOCTYPE_QUOTED:l++,DOCTYPE_DTD:l++,DOCTYPE_DTD_QUOTED:l++,COMMENT_STARTING:l++,COMMENT:l++,COMMENT_ENDING:l++,COMMENT_ENDED:l++,CDATA:l++,CDATA_ENDING:l++,CDATA_ENDING_2:l++,PROC_INST:l++,PROC_INST_BODY:l++,PROC_INST_ENDING:l++,OPEN_TAG:l++,OPEN_TAG_SLASH:l++,ATTRIB:l++,ATTRIB_NAME:l++,ATTRIB_NAME_SAW_WHITE:l++,ATTRIB_VALUE:l++,ATTRIB_VALUE_QUOTED:l++,ATTRIB_VALUE_CLOSED:l++,ATTRIB_VALUE_UNQUOTED:l++,ATTRIB_VALUE_ENTITY_Q:l++,ATTRIB_VALUE_ENTITY_U:l++,CLOSE_TAG:l++,CLOSE_TAG_SAW_WHITE:l++,SCRIPT:l++,SCRIPT_ENDING:l++},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(y){var g=t.ENTITIES[y],C=typeof g=="number"?String.fromCharCode(g):g;t.ENTITIES[y]=C});for(var _ in t.STATE)t.STATE[t.STATE[_]]=_;l=t.STATE;function F(y,g,C){y[g]&&y[g](C)}function k(y,g,C){y.textNode&&q(y),F(y,g,C)}function q(y){y.textNode=R(y.opt,y.textNode),y.textNode&&F(y,"ontext",y.textNode),y.textNode=""}function R(y,g){return y.trim&&(g=g.trim()),y.normalize&&(g=g.replace(/\s+/g," ")),g}function V(y,g){return q(y),y.trackPosition&&(g+=`
70
- Line: `+y.line+`
71
- Column: `+y.column+`
72
- Char: `+y.c),g=new Error(g),y.error=g,F(y,"onerror",g),y}function G(y){return y.sawRoot&&!y.closedRoot&&W(y,"Unclosed root tag"),y.state!==l.BEGIN&&y.state!==l.BEGIN_WHITESPACE&&y.state!==l.TEXT&&V(y,"Unexpected end"),q(y),y.c="",y.closed=!0,F(y,"onend"),r.call(y,y.strict,y.opt),y}function W(y,g){if(typeof y!="object"||!(y instanceof r))throw new Error("bad call to strictFail");y.strict&&V(y,g)}function Ze(y){y.strict||(y.tagName=y.tagName[y.looseCase]());var g=y.tags[y.tags.length-1]||y,C=y.tag={name:y.tagName,attributes:{}};y.opt.xmlns&&(C.ns=g.ns),y.attribList.length=0,k(y,"onopentagstart",C)}function Fe(y,g){var C=y.indexOf(":"),O=C<0?["",y]:y.split(":"),Y=O[0],J=O[1];return g&&y==="xmlns"&&(Y="xmlns",J=""),{prefix:Y,local:J}}function Ae(y){if(y.strict||(y.attribName=y.attribName[y.looseCase]()),y.attribList.indexOf(y.attribName)!==-1||y.tag.attributes.hasOwnProperty(y.attribName)){y.attribName=y.attribValue="";return}if(y.opt.xmlns){var g=Fe(y.attribName,!0),C=g.prefix,O=g.local;if(C==="xmlns")if(O==="xml"&&y.attribValue!==b)W(y,"xml: prefix must be bound to "+b+`
73
- Actual: `+y.attribValue);else if(O==="xmlns"&&y.attribValue!==E)W(y,"xmlns: prefix must be bound to "+E+`
74
- Actual: `+y.attribValue);else{var Y=y.tag,J=y.tags[y.tags.length-1]||y;Y.ns===J.ns&&(Y.ns=Object.create(J.ns)),Y.ns[O]=y.attribValue}y.attribList.push([y.attribName,y.attribValue])}else y.tag.attributes[y.attribName]=y.attribValue,k(y,"onattribute",{name:y.attribName,value:y.attribValue});y.attribName=y.attribValue=""}function ue(y,g){if(y.opt.xmlns){var C=y.tag,O=Fe(y.tagName);C.prefix=O.prefix,C.local=O.local,C.uri=C.ns[O.prefix]||"",C.prefix&&!C.uri&&(W(y,"Unbound namespace prefix: "+JSON.stringify(y.tagName)),C.uri=O.prefix);var Y=y.tags[y.tags.length-1]||y;C.ns&&Y.ns!==C.ns&&Object.keys(C.ns).forEach(function(U){k(y,"onopennamespace",{prefix:U,uri:C.ns[U]})});for(var J=0,z=y.attribList.length;J<z;J++){var ne=y.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(y,"Unbound namespace prefix: "+JSON.stringify(M)),B.uri=M),y.tag.attributes[N]=B,k(y,"onattribute",B)}y.attribList.length=0}y.tag.isSelfClosing=!!g,y.sawRoot=!0,y.tags.push(y.tag),k(y,"onopentag",y.tag),g||(!y.noscript&&y.tagName.toLowerCase()==="script"?y.state=l.SCRIPT:y.state=l.TEXT,y.tag=null,y.tagName=""),y.attribName=y.attribValue="",y.attribList.length=0}function ge(y){if(!y.tagName){W(y,"Weird empty close tag."),y.textNode+="</>",y.state=l.TEXT;return}if(y.script){if(y.tagName!=="script"){y.script+="</"+y.tagName+">",y.tagName="",y.state=l.SCRIPT;return}k(y,"onscript",y.script),y.script=""}var g=y.tags.length,C=y.tagName;y.strict||(C=C[y.looseCase]());for(var O=C;g--;){var Y=y.tags[g];if(Y.name!==O)W(y,"Unexpected close tag");else break}if(g<0){W(y,"Unmatched closing tag: "+y.tagName),y.textNode+="</"+y.tagName+">",y.state=l.TEXT;return}y.tagName=C;for(var J=y.tags.length;J-- >g;){var z=y.tag=y.tags.pop();y.tagName=y.tag.name,k(y,"onclosetag",y.tagName);var ne={};for(var N in z.ns)ne[N]=z.ns[N];var A=y.tags[y.tags.length-1]||y;y.opt.xmlns&&z.ns!==A.ns&&Object.keys(z.ns).forEach(function(j){var M=z.ns[j];k(y,"onclosenamespace",{prefix:j,uri:M})})}g===0&&(y.closedRoot=!0),y.tagName=y.attribValue=y.attribName="",y.attribList.length=0,y.state=l.TEXT}function Ke(y){var g=y.entity,C=g.toLowerCase(),O,Y="";return y.ENTITIES[g]?y.ENTITIES[g]:y.ENTITIES[C]?y.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(y,"Invalid character entity"),"&"+y.entity+";"):String.fromCodePoint(O))}function $(y,g){g==="<"?(y.state=l.OPEN_WAKA,y.startTagPosition=y.position):w(g)||(W(y,"Non-whitespace before first tag."),y.textNode=g,y.state=l.TEXT)}function Le(y,g){var C="";return g<y.length&&(C=y.charAt(g)),C}function et(y){var g=this;if(this.error)throw this.error;if(g.closed)return V(g,"Cannot write after close. Assign an onready handler.");if(y===null)return G(g);typeof y=="object"&&(y=y.toString());for(var C=0,O="";O=Le(y,C++),g.c=O,!!O;)switch(g.trackPosition&&(g.position++,O===`
75
- `?(g.line++,g.column=0):g.column++),g.state){case l.BEGIN:if(g.state=l.BEGIN_WHITESPACE,O==="\uFEFF")continue;$(g,O);continue;case l.BEGIN_WHITESPACE:$(g,O);continue;case l.TEXT:if(g.sawRoot&&!g.closedRoot){for(var J=C-1;O&&O!=="<"&&O!=="&";)O=Le(y,C++),O&&g.trackPosition&&(g.position++,O===`
76
- `?(g.line++,g.column=0):g.column++);g.textNode+=y.substring(J,C-1)}O==="<"&&!(g.sawRoot&&g.closedRoot&&!g.strict)?(g.state=l.OPEN_WAKA,g.startTagPosition=g.position):(!w(O)&&(!g.sawRoot||g.closedRoot)&&W(g,"Text data outside of root node."),O==="&"?g.state=l.TEXT_ENTITY:g.textNode+=O);continue;case l.SCRIPT:O==="<"?g.state=l.SCRIPT_ENDING:g.script+=O;continue;case l.SCRIPT_ENDING:O==="/"?g.state=l.CLOSE_TAG:(g.script+="<"+O,g.state=l.SCRIPT);continue;case l.OPEN_WAKA:if(O==="!")g.state=l.SGML_DECL,g.sgmlDecl="";else if(!w(O))if(L(m,O))g.state=l.OPEN_TAG,g.tagName=O;else if(O==="/")g.state=l.CLOSE_TAG,g.tagName="";else if(O==="?")g.state=l.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=l.TEXT}continue;case l.SGML_DECL:if(g.sgmlDecl+O==="--"){g.state=l.COMMENT,g.comment="",g.sgmlDecl="";continue}g.doctype&&g.doctype!==!0&&g.sgmlDecl?(g.state=l.DOCTYPE_DTD,g.doctype+="<!"+g.sgmlDecl+O,g.sgmlDecl=""):(g.sgmlDecl+O).toUpperCase()===f?(k(g,"onopencdata"),g.state=l.CDATA,g.sgmlDecl="",g.cdata=""):(g.sgmlDecl+O).toUpperCase()===d?(g.state=l.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=l.TEXT):(I(O)&&(g.state=l.SGML_DECL_QUOTED),g.sgmlDecl+=O);continue;case l.SGML_DECL_QUOTED:O===g.q&&(g.state=l.SGML_DECL,g.q=""),g.sgmlDecl+=O;continue;case l.DOCTYPE:O===">"?(g.state=l.TEXT,k(g,"ondoctype",g.doctype),g.doctype=!0):(g.doctype+=O,O==="["?g.state=l.DOCTYPE_DTD:I(O)&&(g.state=l.DOCTYPE_QUOTED,g.q=O));continue;case l.DOCTYPE_QUOTED:g.doctype+=O,O===g.q&&(g.q="",g.state=l.DOCTYPE);continue;case l.DOCTYPE_DTD:O==="]"?(g.doctype+=O,g.state=l.DOCTYPE):O==="<"?(g.state=l.OPEN_WAKA,g.startTagPosition=g.position):I(O)?(g.doctype+=O,g.state=l.DOCTYPE_DTD_QUOTED,g.q=O):g.doctype+=O;continue;case l.DOCTYPE_DTD_QUOTED:g.doctype+=O,O===g.q&&(g.state=l.DOCTYPE_DTD,g.q="");continue;case l.COMMENT:O==="-"?g.state=l.COMMENT_ENDING:g.comment+=O;continue;case l.COMMENT_ENDING:O==="-"?(g.state=l.COMMENT_ENDED,g.comment=R(g.opt,g.comment),g.comment&&k(g,"oncomment",g.comment),g.comment=""):(g.comment+="-"+O,g.state=l.COMMENT);continue;case l.COMMENT_ENDED:O!==">"?(W(g,"Malformed comment"),g.comment+="--"+O,g.state=l.COMMENT):g.doctype&&g.doctype!==!0?g.state=l.DOCTYPE_DTD:g.state=l.TEXT;continue;case l.CDATA:for(var J=C-1;O&&O!=="]";)O=Le(y,C++),O&&g.trackPosition&&(g.position++,O===`
77
- `?(g.line++,g.column=0):g.column++);g.cdata+=y.substring(J,C-1),O==="]"&&(g.state=l.CDATA_ENDING);continue;case l.CDATA_ENDING:O==="]"?g.state=l.CDATA_ENDING_2:(g.cdata+="]"+O,g.state=l.CDATA);continue;case l.CDATA_ENDING_2:O===">"?(g.cdata&&k(g,"oncdata",g.cdata),k(g,"onclosecdata"),g.cdata="",g.state=l.TEXT):O==="]"?g.cdata+="]":(g.cdata+="]]"+O,g.state=l.CDATA);continue;case l.PROC_INST:O==="?"?g.state=l.PROC_INST_ENDING:w(O)?g.state=l.PROC_INST_BODY:g.procInstName+=O;continue;case l.PROC_INST_BODY:if(!g.procInstBody&&w(O))continue;O==="?"?g.state=l.PROC_INST_ENDING:g.procInstBody+=O;continue;case l.PROC_INST_ENDING:O===">"?(k(g,"onprocessinginstruction",{name:g.procInstName,body:g.procInstBody}),g.procInstName=g.procInstBody="",g.state=l.TEXT):(g.procInstBody+="?"+O,g.state=l.PROC_INST_BODY);continue;case l.OPEN_TAG:L(D,O)?g.tagName+=O:(Ze(g),O===">"?ue(g):O==="/"?g.state=l.OPEN_TAG_SLASH:(w(O)||W(g,"Invalid character in tag name"),g.state=l.ATTRIB));continue;case l.OPEN_TAG_SLASH:O===">"?(ue(g,!0),ge(g)):(W(g,"Forward-slash in opening tag not followed by >"),g.state=l.ATTRIB);continue;case l.ATTRIB:if(w(O))continue;O===">"?ue(g):O==="/"?g.state=l.OPEN_TAG_SLASH:L(m,O)?(g.attribName=O,g.attribValue="",g.state=l.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case l.ATTRIB_NAME:O==="="?g.state=l.ATTRIB_VALUE:O===">"?(W(g,"Attribute without value"),g.attribValue=g.attribName,Ae(g),ue(g)):w(O)?g.state=l.ATTRIB_NAME_SAW_WHITE:L(D,O)?g.attribName+=O:W(g,"Invalid attribute name");continue;case l.ATTRIB_NAME_SAW_WHITE:if(O==="=")g.state=l.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(m,O)?(g.attribName=O,g.state=l.ATTRIB_NAME):(W(g,"Invalid attribute name"),g.state=l.ATTRIB)}continue;case l.ATTRIB_VALUE:if(w(O))continue;I(O)?(g.q=O,g.state=l.ATTRIB_VALUE_QUOTED):(g.opt.unquotedAttributeValues||V(g,"Unquoted attribute value"),g.state=l.ATTRIB_VALUE_UNQUOTED,g.attribValue=O);continue;case l.ATTRIB_VALUE_QUOTED:if(O!==g.q){O==="&"?g.state=l.ATTRIB_VALUE_ENTITY_Q:g.attribValue+=O;continue}Ae(g),g.q="",g.state=l.ATTRIB_VALUE_CLOSED;continue;case l.ATTRIB_VALUE_CLOSED:w(O)?g.state=l.ATTRIB:O===">"?ue(g):O==="/"?g.state=l.OPEN_TAG_SLASH:L(m,O)?(W(g,"No whitespace between attributes"),g.attribName=O,g.attribValue="",g.state=l.ATTRIB_NAME):W(g,"Invalid attribute name");continue;case l.ATTRIB_VALUE_UNQUOTED:if(!P(O)){O==="&"?g.state=l.ATTRIB_VALUE_ENTITY_U:g.attribValue+=O;continue}Ae(g),O===">"?ue(g):g.state=l.ATTRIB;continue;case l.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=l.SCRIPT):(w(O)||W(g,"Invalid tagname in closing tag"),g.state=l.CLOSE_TAG_SAW_WHITE);else{if(w(O))continue;S(m,O)?g.script?(g.script+="</"+O,g.state=l.SCRIPT):W(g,"Invalid tagname in closing tag."):g.tagName=O}continue;case l.CLOSE_TAG_SAW_WHITE:if(w(O))continue;O===">"?ge(g):W(g,"Invalid characters in closing tag");continue;case l.TEXT_ENTITY:case l.ATTRIB_VALUE_ENTITY_Q:case l.ATTRIB_VALUE_ENTITY_U:var z,ne;switch(g.state){case l.TEXT_ENTITY:z=l.TEXT,ne="textNode";break;case l.ATTRIB_VALUE_ENTITY_Q:z=l.ATTRIB_VALUE_QUOTED,ne="attribValue";break;case l.ATTRIB_VALUE_ENTITY_U:z=l.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 y=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+=y.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={},br;function wo(){return br||(br=1,function(){Vt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(H)),Vt}var ve={},wr;function ei(){return wr||(wr=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 Er;function Eo(){return Er||(Er=1,function(e){(function(){var t,n,r,o,i,s,a,u,c,p=function(b,E){return function(){return b.apply(E,arguments)}},f=function(b,E){for(var v in E)d.call(E,v)&&(b[v]=E[v]);function m(){this.constructor=b}return m.prototype=E.prototype,b.prototype=new m,b.__super__=E.prototype,b},d={}.hasOwnProperty;u=bo(),o=en,t=wo(),a=ei(),c=Ni.setImmediate,n=tn().defaults,i=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},s=function(b,E,v){var m,D,T;for(m=0,D=b.length;m<D;m++)T=b[m],E=T(E,v);return E},r=function(b,E,v){var m;return m=Object.create(null),m.value=v,m.writable=!0,m.enumerable=!0,m.configurable=!0,Object.defineProperty(b,E,m)},e.Parser=function(b){f(E,b);function E(v){this.parseStringPromise=p(this.parseStringPromise,this),this.parseString=p(this.parseString,this),this.reset=p(this.reset,this),this.assignOrPush=p(this.assignOrPush,this),this.processAsync=p(this.processAsync,this);var m,D,T;if(!(this instanceof e.Parser))return new e.Parser(v);this.options={},D=n["0.2"];for(m in D)d.call(D,m)&&(T=D[m],this.options[m]=T);for(m in v)d.call(v,m)&&(T=v[m],this.options[m]=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,m;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),c(this.processAsync))}catch(D){if(m=D,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(m)}},E.prototype.assignOrPush=function(v,m,D){return m in v?(v[m]instanceof Array||r(v,m,[v[m]]),v[m].push(D)):this.options.explicitArray?r(v,m,[D]):r(v,m,D)},E.prototype.reset=function(){var v,m,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,m=this.options.charkey,this.saxParser.onopentag=function(h){return function(w){var I,P,L,S,l;if(L={},L[m]="",!h.options.ignoreAttrs){l=w.attributes;for(I in l)d.call(l,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,l,_,F,k,q;if(l=T.pop(),S=l["#name"],(!h.options.explicitChildren||!h.options.preserveChildrenOrder)&&delete l["#name"],l.cdata===!0&&(w=l.cdata,delete l.cdata),k=T[T.length-1],l[m].match(/^\s*$/)&&!w?(I=l[m],delete l[m]):(h.options.trim&&(l[m]=l[m].trim()),h.options.normalize&&(l[m]=l[m].replace(/\s{2,}/g," ").trim()),l[m]=h.options.valueProcessors?s(h.options.valueProcessors,l[m],S):l[m],Object.keys(l).length===1&&m in l&&!h.EXPLICIT_CHARKEY&&(l=l[m])),i(l)&&(typeof h.options.emptyTag=="function"?l=h.options.emptyTag():l=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 l=h.options.validator(q,k&&k[S],l)}catch(V){return R=V,h.emit("error",R)}}()),h.options.explicitChildren&&!h.options.mergeAttrs&&typeof l=="object"){if(!h.options.preserveChildrenOrder)L={},h.options.attrkey in l&&(L[h.options.attrkey]=l[h.options.attrkey],delete l[h.options.attrkey]),!h.options.charsAsChildren&&h.options.charkey in l&&(L[h.options.charkey]=l[h.options.charkey],delete l[h.options.charkey]),Object.getOwnPropertyNames(l).length>0&&(L[h.options.childkey]=l),l=L;else if(k){k[h.options.childkey]=k[h.options.childkey]||[],_={};for(P in l)d.call(l,P)&&r(_,P,l[P]);k[h.options.childkey].push(_),delete l["#name"],Object.keys(l).length===1&&m in l&&!h.EXPLICIT_CHARKEY&&(l=l[m])}}return T.length>0?h.assignOrPush(k,S,l):(h.options.explicitRoot&&(F=l,l={},r(l,S,F)),h.resultObject=l,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[m]+=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[m]=w,h.options.normalize&&(I[m]=I[m].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,m){var D;m!=null&&typeof m=="function"&&(this.on("end",function(T){return this.reset(),m(null,T)}),this.on("error",function(T){return this.reset(),m(T)}));try{return v=v.toString(),v.trim()===""?(this.emit("end",null),!0):(v=t.stripBOM(v),this.options.async?(this.remaining=v,c(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(m){return function(D,T){return m.parseString(v,function(h,w){return h?T(h):D(w)})}}(this))},E}(o),e.parseString=function(b,E,v){var m,D,T;return v!=null?(typeof v=="function"&&(m=v),typeof E=="object"&&(D=E)):(typeof E=="function"&&(m=E),D={}),T=new e.Parser(D),T.parseString(b,m)},e.parseStringPromise=function(b,E){var v,m;return typeof E=="object"&&(v=E),m=new e.Parser(v),m.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=tn(),e=yo(),n=Eo(),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 To{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! 🎉
66
+ */var st,ot,at;const jn=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12,kn=(ot=(st=process==null?void 0:process.versions)===null||st===void 0?void 0:st.node)!==null&&ot!==void 0?ot:(at=process==null?void 0:process.version)===null||at===void 0?void 0:at.slice(1);if(kn&&Number(kn.match(/^([^.]+)/)[1])<jn)throw Error(`yargs parser supports a minimum Node.js version of ${jn}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);const fo=process?process.env:{};new uo({cwd:process.cwd,env:()=>fo,format:vr,normalize:wi,resolve:Zt,require:e=>{if(typeof require<"u")return require(e);if(e.match(/\.json$/))return JSON.parse(Kt(e,"utf8"));throw Error("only .json config files are supported in ESM")}});const ho={fs:{readFileSync:Kt,writeFile:hi},format:vr,resolve:Zt,exists:e=>{try{return pi(e).isFile()}catch{return!1}}};let pe;class po{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 go(e,t){pe=t;const n=new po(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 mo=e=>go(e,ho);let $e;try{$e=Ii(import.meta.url)}catch{$e=process.cwd()}const yo=$e.substring(0,$e.lastIndexOf("node_modules"));yo||process.cwd(),process.cwd,process.exit,process.nextTick,typeof process.stdout.columns<"u"&&process.stdout.columns,mo({directory:Zt($e,"../../../locales"),updateFiles:!1});var ut={},Bn;function rn(){return Bn||(Bn=1,function(){ut.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(G)),ut}var ct={},be={},we={},Rn;function Ee(){return Rn||(Rn=1,function(){var e,t,n,r,o,i,s,a=[].slice,u={}.hasOwnProperty;e=function(){var d,c,g,h,b,N;if(N=arguments[0],b=2<=arguments.length?a.call(arguments,1):[],o(Object.assign))Object.assign.apply(null,arguments);else for(d=0,g=b.length;d<g;d++)if(h=b[d],h!=null)for(c in h)u.call(h,c)&&(N[c]=h[c]);return N},o=function(d){return!!d&&Object.prototype.toString.call(d)==="[object Function]"},i=function(d){var c;return!!d&&((c=typeof d)=="function"||c==="object")},n=function(d){return o(Array.isArray)?Array.isArray(d):Object.prototype.toString.call(d)==="[object Array]"},r=function(d){var c;if(n(d))return!d.length;for(c in d)if(u.call(d,c))return!1;return!0},s=function(d){var c,g;return i(d)&&(g=Object.getPrototypeOf(d))&&(c=g.constructor)&&typeof c=="function"&&c instanceof c&&Function.prototype.toString.call(c)===Function.prototype.toString.call(Object)},t=function(d){return o(d.valueOf)?d.valueOf():d},we.assign=e,we.isFunction=o,we.isObject=i,we.isArray=n,we.isEmpty=r,we.isPlainObject=s,we.getValue=t}.call(G)),we}var lt={exports:{}},Xn;function Kr(){return Xn||(Xn=1,function(){lt.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(G)),lt.exports}var ft={exports:{}},ht={exports:{}},pt={exports:{}},$n;function bo(){return $n||($n=1,function(){pt.exports=function(){function e(){}return e.prototype.handleError=function(t){throw new Error(t)},e}()}.call(G)),pt.exports}var dt={exports:{}},Un;function wo(){return Un||(Un=1,function(){dt.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(G)),dt.exports}var Vn;function Eo(){return Vn||(Vn=1,function(){var e,t;e=bo(),t=wo(),ht.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(G)),ht.exports}var gt={exports:{}},mt={exports:{}},yt={exports:{}},qn;function ee(){return qn||(qn=1,function(){yt.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}.call(G)),yt.exports}var bt={exports:{}},Wn;function Zr(){return Wn||(Wn=1,function(){var e;e=ee(),he(),bt.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(G)),bt.exports}var wt={exports:{}},Gn;function sn(){return Gn||(Gn=1,function(){wt.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(G)),wt.exports}var Hn;function on(){return Hn||(Hn=1,function(){var e,t,n,r,o,i,s,a,u=function(c,g){for(var h in g)d.call(g,h)&&(c[h]=g[h]);function b(){this.constructor=c}return b.prototype=g.prototype,c.prototype=new b,c.__super__=g.prototype,c},d={}.hasOwnProperty;a=Ee(),s=a.isObject,i=a.isFunction,o=a.getValue,r=he(),e=ee(),t=Zr(),n=sn(),mt.exports=function(c){u(g,c);function g(h,b,N){var I,y,D,w;if(g.__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,N!=null&&this.attribute(N),h.type===e.Document&&(this.isRoot=!0,this.documentObject=h,h.rootObject=this,h.children)){for(w=h.children,y=0,D=w.length;y<D;y++)if(I=w[y],I.type===e.DocType){I.name=this.name;break}}}return Object.defineProperty(g.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(g.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(g.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(g.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(g.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(g.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(g.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(g.prototype,"attributes",{get:function(){return(!this.attributeMap||!this.attributeMap.nodes)&&(this.attributeMap=new n(this.attribs)),this.attributeMap}}),g.prototype.clone=function(){var h,b,N,I;N=Object.create(this),N.isRoot&&(N.documentObject=null),N.attribs={},I=this.attribs;for(b in I)d.call(I,b)&&(h=I[b],N.attribs[b]=h.clone());return N.children=[],this.children.forEach(function(y){var D;return D=y.clone(),D.parent=N,N.children.push(D)}),N},g.prototype.attribute=function(h,b){var N,I;if(h!=null&&(h=o(h)),s(h))for(N in h)d.call(h,N)&&(I=h[N],this.attribute(N,I));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},g.prototype.removeAttribute=function(h){var b,N,I;if(h==null)throw new Error("Missing attribute name. "+this.debugInfo());if(h=o(h),Array.isArray(h))for(N=0,I=h.length;N<I;N++)b=h[N],delete this.attribs[b];else delete this.attribs[h];return this},g.prototype.toString=function(h){return this.options.writer.element(this,this.options.writer.filterOptions(h))},g.prototype.att=function(h,b){return this.attribute(h,b)},g.prototype.a=function(h,b){return this.attribute(h,b)},g.prototype.getAttribute=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h].value:null},g.prototype.setAttribute=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNode=function(h){return this.attribs.hasOwnProperty(h)?this.attribs[h]:null},g.prototype.setAttributeNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNode=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNS=function(h,b,N){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.removeAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getAttributeNodeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setAttributeNodeNS=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.hasAttribute=function(h){return this.attribs.hasOwnProperty(h)},g.prototype.hasAttributeNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttribute=function(h,b){return this.attribs.hasOwnProperty(h)?this.attribs[h].isId:b},g.prototype.setIdAttributeNS=function(h,b,N){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.setIdAttributeNode=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByTagNameNS=function(h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.getElementsByClassName=function(h){throw new Error("This DOM method is not implemented."+this.debugInfo())},g.prototype.isEqualNode=function(h){var b,N,I;if(!g.__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=N=0,I=this.attribs.length-1;0<=I?N<=I:N>=I;b=0<=I?++N:--N)if(!this.attribs[b].isEqualNode(h.attribs[b]))return!1;return!0},g}(r)}.call(G)),mt.exports}var Et={exports:{}},Nt={exports:{}},Yn;function Je(){return Yn||(Yn=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=he(),Nt.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(G)),Nt.exports}var 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;e=ee(),t=Je(),Et.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(G)),Et.exports}var Tt={exports:{}},Qn;function un(){return Qn||(Qn=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=Je(),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(G)),Tt.exports}var Ot={exports:{}},Jn;function cn(){return Jn||(Jn=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=he(),e=ee(),Ot.exports=function(i){r(s,i);function s(a,u,d,c){var g;s.__super__.constructor.call(this,a),n(u)&&(g=u,u=g.version,d=g.encoding,c=g.standalone),u||(u="1.0"),this.type=e.Declaration,this.version=this.stringify.xmlVersion(u),d!=null&&(this.encoding=this.stringify.xmlEncoding(d)),c!=null&&(this.standalone=this.stringify.xmlStandalone(c))}return s.prototype.toString=function(a){return this.options.writer.declaration(this,this.options.writer.filterOptions(a))},s}(t)}.call(G)),Ot.exports}var It={exports:{}},vt={exports:{}},Kn;function ln(){return Kn||(Kn=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=he(),e=ee(),vt.exports=function(o){n(i,o);function i(s,a,u,d,c,g){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(!d)throw new Error("Missing DTD attribute type. "+this.debugInfo(a));if(!c)throw new Error("Missing DTD attribute default. "+this.debugInfo(a));if(c.indexOf("#")!==0&&(c="#"+c),!c.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(a));if(g&&!c.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(d),g&&(this.defaultValue=this.stringify.dtdAttDefault(g)),this.defaultValueType=c}return i.prototype.toString=function(s){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(s))},i}(t)}.call(G)),vt.exports}var xt={exports:{}},Zn;function fn(){return Zn||(Zn=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=he(),e=ee(),xt.exports=function(i){r(s,i);function s(a,u,d,c){if(s.__super__.constructor.call(this,a),d==null)throw new Error("Missing DTD entity name. "+this.debugInfo(d));if(c==null)throw new Error("Missing DTD entity value. "+this.debugInfo(d));if(this.pe=!!u,this.name=this.stringify.name(d),this.type=e.EntityDeclaration,!n(c))this.value=this.stringify.dtdEntityValue(c),this.internal=!0;else{if(!c.pubID&&!c.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(d));if(c.pubID&&!c.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(d));if(this.internal=!1,c.pubID!=null&&(this.pubID=this.stringify.dtdPubID(c.pubID)),c.sysID!=null&&(this.sysID=this.stringify.dtdSysID(c.sysID)),c.nData!=null&&(this.nData=this.stringify.dtdNData(c.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(d))}}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(G)),xt.exports}var At={exports:{}},er;function hn(){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;t=he(),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(G)),At.exports}var Pt={exports:{}},tr;function pn(){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;t=he(),e=ee(),Pt.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(G)),Pt.exports}var nr;function dn(){return nr||(nr=1,function(){var e,t,n,r,o,i,s,a,u=function(c,g){for(var h in g)d.call(g,h)&&(c[h]=g[h]);function b(){this.constructor=c}return b.prototype=g.prototype,c.prototype=new b,c.__super__=g.prototype,c},d={}.hasOwnProperty;a=Ee().isObject,s=he(),e=ee(),t=ln(),r=fn(),n=hn(),o=pn(),i=sn(),It.exports=function(c){u(g,c);function g(h,b,N){var I,y,D,w,f,E;if(g.__super__.constructor.call(this,h),this.type=e.DocType,h.children){for(w=h.children,y=0,D=w.length;y<D;y++)if(I=w[y],I.type===e.Element){this.name=I.name;break}}this.documentObject=h,a(b)&&(f=b,b=f.pubID,N=f.sysID),N==null&&(E=[b,N],N=E[0],b=E[1]),b!=null&&(this.pubID=this.stringify.dtdPubID(b)),N!=null&&(this.sysID=this.stringify.dtdSysID(N))}return Object.defineProperty(g.prototype,"entities",{get:function(){var h,b,N,I,y;for(I={},y=this.children,b=0,N=y.length;b<N;b++)h=y[b],h.type===e.EntityDeclaration&&!h.pe&&(I[h.name]=h);return new i(I)}}),Object.defineProperty(g.prototype,"notations",{get:function(){var h,b,N,I,y;for(I={},y=this.children,b=0,N=y.length;b<N;b++)h=y[b],h.type===e.NotationDeclaration&&(I[h.name]=h);return new i(I)}}),Object.defineProperty(g.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(g.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(g.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),g.prototype.element=function(h,b){var N;return N=new n(this,h,b),this.children.push(N),this},g.prototype.attList=function(h,b,N,I,y){var D;return D=new t(this,h,b,N,I,y),this.children.push(D),this},g.prototype.entity=function(h,b){var N;return N=new r(this,!1,h,b),this.children.push(N),this},g.prototype.pEntity=function(h,b){var N;return N=new r(this,!0,h,b),this.children.push(N),this},g.prototype.notation=function(h,b){var N;return N=new o(this,h,b),this.children.push(N),this},g.prototype.toString=function(h){return this.options.writer.docType(this,this.options.writer.filterOptions(h))},g.prototype.ele=function(h,b){return this.element(h,b)},g.prototype.att=function(h,b,N,I,y){return this.attList(h,b,N,I,y)},g.prototype.ent=function(h,b){return this.entity(h,b)},g.prototype.pent=function(h,b){return this.pEntity(h,b)},g.prototype.not=function(h,b){return this.notation(h,b)},g.prototype.up=function(){return this.root()||this.documentObject},g.prototype.isEqualNode=function(h){return!(!g.__super__.isEqualNode.apply(this,arguments).isEqualNode(h)||h.name!==this.name||h.publicId!==this.publicId||h.systemId!==this.systemId)},g}(s)}.call(G)),It.exports}var Lt={exports:{}},rr;function gn(){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;e=ee(),t=he(),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(G)),Lt.exports}var _t={exports:{}},ir;function mn(){return ir||(ir=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=Je(),_t.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(G)),_t.exports}var Dt={exports:{}},sr;function yn(){return sr||(sr=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=Je(),Dt.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(G)),Dt.exports}var St={exports:{}},or;function ei(){return or||(or=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=he(),e=ee(),St.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(G)),St.exports}var Mt={exports:{}},ar;function No(){return ar||(ar=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(G)),Mt.exports}var Ct={exports:{}},ur;function To(){return ur||(ur=1,function(){Ct.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}.call(G)),Ct.exports}var cr;function he(){return cr||(cr=1,function(){var e,t,n,r,o,i,s,a,u,d,c,g,h,b,N,I,y,D={}.hasOwnProperty;y=Ee(),I=y.isObject,N=y.isFunction,b=y.isEmpty,h=y.getValue,a=null,n=null,r=null,o=null,i=null,c=null,g=null,d=null,s=null,t=null,u=null,e=null,gt.exports=function(){function w(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=on(),n=an(),r=un(),o=cn(),i=dn(),c=gn(),g=mn(),d=yn(),s=ei(),t=ee(),u=No(),sn(),e=To())}return Object.defineProperty(w.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(w.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(w.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(w.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(w.prototype,"childNodes",{get:function(){return(!this.childNodeList||!this.childNodeList.nodes)&&(this.childNodeList=new u(this.children)),this.childNodeList}}),Object.defineProperty(w.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(w.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(w.prototype,"previousSibling",{get:function(){var f;return f=this.parent.children.indexOf(this),this.parent.children[f-1]||null}}),Object.defineProperty(w.prototype,"nextSibling",{get:function(){var f;return f=this.parent.children.indexOf(this),this.parent.children[f+1]||null}}),Object.defineProperty(w.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(w.prototype,"textContent",{get:function(){var f,E,O,L,P;if(this.nodeType===t.Element||this.nodeType===t.DocumentFragment){for(P="",L=this.children,E=0,O=L.length;E<O;E++)f=L[E],f.textContent&&(P+=f.textContent);return P}else return null},set:function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),w.prototype.setParent=function(f){var E,O,L,P,C;for(this.parent=f,f&&(this.options=f.options,this.stringify=f.stringify),P=this.children,C=[],O=0,L=P.length;O<L;O++)E=P[O],C.push(E.setParent(this));return C},w.prototype.element=function(f,E,O){var L,P,C,l,_,F,k,q,R,U,H;if(F=null,E===null&&O==null&&(R=[{},null],E=R[0],O=R[1]),E==null&&(E={}),E=h(E),I(E)||(U=[E,O],O=U[0],E=U[1]),f!=null&&(f=h(f)),Array.isArray(f))for(C=0,k=f.length;C<k;C++)P=f[C],F=this.element(P);else if(N(f))F=this.element(f.apply());else if(I(f)){for(_ in f)if(D.call(f,_))if(H=f[_],N(H)&&(H=H.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&_.indexOf(this.stringify.convertAttKey)===0)F=this.attribute(_.substr(this.stringify.convertAttKey.length),H);else if(!this.options.separateArrayItems&&Array.isArray(H)&&b(H))F=this.dummy();else if(I(H)&&b(H))F=this.element(_);else if(!this.options.keepNullNodes&&H==null)F=this.dummy();else if(!this.options.separateArrayItems&&Array.isArray(H))for(l=0,q=H.length;l<q;l++)P=H[l],L={},L[_]=P,F=this.element(L);else I(H)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&_.indexOf(this.stringify.convertTextKey)===0?F=this.element(H):(F=this.element(_),F.element(H)):F=this.element(_,H)}else!this.options.keepNullNodes&&O===null?F=this.dummy():!this.options.ignoreDecorators&&this.stringify.convertTextKey&&f.indexOf(this.stringify.convertTextKey)===0?F=this.text(O):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&f.indexOf(this.stringify.convertCDataKey)===0?F=this.cdata(O):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&f.indexOf(this.stringify.convertCommentKey)===0?F=this.comment(O):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&f.indexOf(this.stringify.convertRawKey)===0?F=this.raw(O):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&f.indexOf(this.stringify.convertPIKey)===0?F=this.instruction(f.substr(this.stringify.convertPIKey.length),O):F=this.node(f,E,O);if(F==null)throw new Error("Could not create any elements with: "+f+". "+this.debugInfo());return F},w.prototype.insertBefore=function(f,E,O){var L,P,C,l,_;if(f?.type)return C=f,l=E,C.setParent(this),l?(P=children.indexOf(l),_=children.splice(P),children.push(C),Array.prototype.push.apply(children,_)):children.push(C),C;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),L=this.parent.element(f,E,O),Array.prototype.push.apply(this.parent.children,_),L},w.prototype.insertAfter=function(f,E,O){var L,P,C;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(f));return P=this.parent.children.indexOf(this),C=this.parent.children.splice(P+1),L=this.parent.element(f,E,O),Array.prototype.push.apply(this.parent.children,C),L},w.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},w.prototype.node=function(f,E,O){var L,P;return f!=null&&(f=h(f)),E||(E={}),E=h(E),I(E)||(P=[E,O],O=P[0],E=P[1]),L=new a(this,f,E),O!=null&&L.text(O),this.children.push(L),L},w.prototype.text=function(f){var E;return I(f)&&this.element(f),E=new g(this,f),this.children.push(E),this},w.prototype.cdata=function(f){var E;return E=new n(this,f),this.children.push(E),this},w.prototype.comment=function(f){var E;return E=new r(this,f),this.children.push(E),this},w.prototype.commentBefore=function(f){var E,O;return E=this.parent.children.indexOf(this),O=this.parent.children.splice(E),this.parent.comment(f),Array.prototype.push.apply(this.parent.children,O),this},w.prototype.commentAfter=function(f){var E,O;return E=this.parent.children.indexOf(this),O=this.parent.children.splice(E+1),this.parent.comment(f),Array.prototype.push.apply(this.parent.children,O),this},w.prototype.raw=function(f){var E;return E=new c(this,f),this.children.push(E),this},w.prototype.dummy=function(){var f;return f=new s(this),f},w.prototype.instruction=function(f,E){var O,L,P,C,l;if(f!=null&&(f=h(f)),E!=null&&(E=h(E)),Array.isArray(f))for(C=0,l=f.length;C<l;C++)O=f[C],this.instruction(O);else if(I(f))for(O in f)D.call(f,O)&&(L=f[O],this.instruction(O,L));else N(E)&&(E=E.apply()),P=new d(this,f,E),this.children.push(P);return this},w.prototype.instructionBefore=function(f,E){var O,L;return O=this.parent.children.indexOf(this),L=this.parent.children.splice(O),this.parent.instruction(f,E),Array.prototype.push.apply(this.parent.children,L),this},w.prototype.instructionAfter=function(f,E){var O,L;return O=this.parent.children.indexOf(this),L=this.parent.children.splice(O+1),this.parent.instruction(f,E),Array.prototype.push.apply(this.parent.children,L),this},w.prototype.declaration=function(f,E,O){var L,P;return L=this.document(),P=new o(L,f,E,O),L.children.length===0?L.children.unshift(P):L.children[0].type===t.Declaration?L.children[0]=P:L.children.unshift(P),L.root()||L},w.prototype.dtd=function(f,E){var O,L,P,C,l,_,F,k,q,R;for(L=this.document(),P=new i(L,f,E),q=L.children,C=l=0,F=q.length;l<F;C=++l)if(O=q[C],O.type===t.DocType)return L.children[C]=P,P;for(R=L.children,C=_=0,k=R.length;_<k;C=++_)if(O=R[C],O.isRoot)return L.children.splice(C,0,P),P;return L.children.push(P),P},w.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},w.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}},w.prototype.document=function(){var f;for(f=this;f;){if(f.type===t.Document)return f;f=f.parent}},w.prototype.end=function(f){return this.document().end(f)},w.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]},w.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]},w.prototype.importDocument=function(f){var E;return E=f.root().clone(),E.parent=this,E.isRoot=!1,this.children.push(E),this},w.prototype.debugInfo=function(f){var E,O;return f=f||this.name,f==null&&!((E=this.parent)!=null&&E.name)?"":f==null?"parent: <"+this.parent.name+">":(O=this.parent)!=null&&O.name?"node: <"+f+">, parent: <"+this.parent.name+">":"node: <"+f+">"},w.prototype.ele=function(f,E,O){return this.element(f,E,O)},w.prototype.nod=function(f,E,O){return this.node(f,E,O)},w.prototype.txt=function(f){return this.text(f)},w.prototype.dat=function(f){return this.cdata(f)},w.prototype.com=function(f){return this.comment(f)},w.prototype.ins=function(f,E){return this.instruction(f,E)},w.prototype.doc=function(){return this.document()},w.prototype.dec=function(f,E,O){return this.declaration(f,E,O)},w.prototype.e=function(f,E,O){return this.element(f,E,O)},w.prototype.n=function(f,E,O){return this.node(f,E,O)},w.prototype.t=function(f){return this.text(f)},w.prototype.d=function(f){return this.cdata(f)},w.prototype.c=function(f){return this.comment(f)},w.prototype.r=function(f){return this.raw(f)},w.prototype.i=function(f,E){return this.instruction(f,E)},w.prototype.u=function(){return this.up()},w.prototype.importXMLBuilder=function(f){return this.importDocument(f)},w.prototype.replaceChild=function(f,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.removeChild=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.appendChild=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.hasChildNodes=function(){return this.children.length!==0},w.prototype.cloneNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.isSupported=function(f,E){return!0},w.prototype.hasAttributes=function(){return this.attribs.length!==0},w.prototype.compareDocumentPosition=function(f){var E,O;return E=this,E===f?0:this.document()!==f.document()?(O=e.Disconnected|e.ImplementationSpecific,Math.random()<.5?O|=e.Preceding:O|=e.Following,O):E.isAncestor(f)?e.Contains|e.Preceding:E.isDescendant(f)?e.Contains|e.Following:E.isPreceding(f)?e.Preceding:e.Following},w.prototype.isSameNode=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.lookupPrefix=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.isDefaultNamespace=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.lookupNamespaceURI=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.isEqualNode=function(f){var E,O,L;if(f.nodeType!==this.nodeType||f.children.length!==this.children.length)return!1;for(E=O=0,L=this.children.length-1;0<=L?O<=L:O>=L;E=0<=L?++O:--O)if(!this.children[E].isEqualNode(f.children[E]))return!1;return!0},w.prototype.getFeature=function(f,E){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.setUserData=function(f,E,O){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.getUserData=function(f){throw new Error("This DOM method is not implemented."+this.debugInfo())},w.prototype.contains=function(f){return f?f===this||this.isDescendant(f):!1},w.prototype.isDescendant=function(f){var E,O,L,P,C;for(C=this.children,L=0,P=C.length;L<P;L++)if(E=C[L],f===E||(O=E.isDescendant(f),O))return!0;return!1},w.prototype.isAncestor=function(f){return f.isDescendant(this)},w.prototype.isPreceding=function(f){var E,O;return E=this.treePosition(f),O=this.treePosition(this),E===-1||O===-1?!1:E<O},w.prototype.isFollowing=function(f){var E,O;return E=this.treePosition(f),O=this.treePosition(this),E===-1||O===-1?!1:E>O},w.prototype.treePosition=function(f){var E,O;return O=0,E=!1,this.foreachTreeNode(this.document(),function(L){if(O++,!E&&L===f)return E=!0}),E?O:-1},w.prototype.foreachTreeNode=function(f,E){var O,L,P,C,l;for(f||(f=this.document()),C=f.children,L=0,P=C.length;L<P;L++){if(O=C[L],l=E(O))return l;if(l=this.foreachTreeNode(O,E),l)return l}},w}()}.call(G)),gt.exports}var Ft={exports:{}},lr;function ti(){return lr||(lr=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(G)),Ft.exports}var jt={exports:{}},kt={exports:{}},Bt={exports:{}},fr;function Ke(){return fr||(fr=1,function(){Bt.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}.call(G)),Bt.exports}var hr;function ni(){return hr||(hr=1,function(){var e,t,n,r={}.hasOwnProperty;n=Ee().assign,e=ee(),cn(),dn(),an(),un(),on(),gn(),mn(),yn(),ei(),ln(),hn(),fn(),pn(),t=Ke(),kt.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,d,c,g,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=(d=i.offset)!=null?d:0,s.dontPrettyTextNodes=(c=(g=i.dontPrettyTextNodes)!=null?g:i.dontprettytextnodes)!=null?c: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,d,c,g,h;if(a||(a=0),this.openNode(i,s,a),s.state=t.OpenTag,g=this.indent(i,s,a),g+="<!DOCTYPE "+i.root().name,i.pubID&&i.sysID?g+=' PUBLIC "'+i.pubID+'" "'+i.sysID+'"':i.sysID&&(g+=' SYSTEM "'+i.sysID+'"'),i.children.length>0){for(g+=" [",g+=this.endline(i,s,a),s.state=t.InsideTag,h=i.children,d=0,c=h.length;d<c;d++)u=h[d],g+=this.writeChildNode(u,s,a+1);s.state=t.CloseTag,g+="]"}return s.state=t.CloseTag,g+=s.spaceBeforeSlash+">",g+=this.endline(i,s,a),s.state=t.None,this.closeNode(i,s,a),g},o.prototype.element=function(i,s,a){var u,d,c,g,h,b,N,I,y,D,w,f,E,O;a||(a=0),D=!1,w="",this.openNode(i,s,a),s.state=t.OpenTag,w+=this.indent(i,s,a)+"<"+i.name,f=i.attribs;for(y in f)r.call(f,y)&&(u=f[y],w+=this.attribute(u,s,a));if(c=i.children.length,g=c===0?null:i.children[0],c===0||i.children.every(function(L){return(L.type===e.Text||L.type===e.Raw)&&L.value===""}))s.allowEmpty?(w+=">",s.state=t.CloseTag,w+="</"+i.name+">"+this.endline(i,s,a)):(s.state=t.CloseTag,w+=s.spaceBeforeSlash+"/>"+this.endline(i,s,a));else if(s.pretty&&c===1&&(g.type===e.Text||g.type===e.Raw)&&g.value!=null)w+=">",s.state=t.InsideTag,s.suppressPrettyCount++,D=!0,w+=this.writeChildNode(g,s,a+1),s.suppressPrettyCount--,D=!1,s.state=t.CloseTag,w+="</"+i.name+">"+this.endline(i,s,a);else{if(s.dontPrettyTextNodes){for(E=i.children,h=0,N=E.length;h<N;h++)if(d=E[h],(d.type===e.Text||d.type===e.Raw)&&d.value!=null){s.suppressPrettyCount++,D=!0;break}}for(w+=">"+this.endline(i,s,a),s.state=t.InsideTag,O=i.children,b=0,I=O.length;b<I;b++)d=O[b],w+=this.writeChildNode(d,s,a+1);s.state=t.CloseTag,w+=this.indent(i,s,a)+"</"+i.name+">",D&&s.suppressPrettyCount--,w+=this.endline(i,s,a),s.state=t.None}return this.closeNode(i,s,a),w},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(G)),kt.exports}var pr;function bn(){return pr||(pr=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=ni(),jt.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,d,c,g;for(s=this.filterOptions(s),c="",g=i.children,u=0,d=g.length;u<d;u++)a=g[u],c+=this.writeChildNode(a,s,0);return s.pretty&&c.slice(-s.newline.length)===s.newline&&(c=c.slice(0,-s.newline.length)),c},o}(e)}.call(G)),jt.exports}var dr;function ri(){return dr||(dr=1,function(){var e,t,n,r,o,i,s,a=function(d,c){for(var g in c)u.call(c,g)&&(d[g]=c[g]);function h(){this.constructor=d}return h.prototype=c.prototype,d.prototype=new h,d.__super__=c.prototype,d},u={}.hasOwnProperty;s=Ee().isPlainObject,n=Kr(),t=Eo(),r=he(),e=ee(),i=ti(),o=bn(),ft.exports=function(d){a(c,d);function c(g){c.__super__.constructor.call(this,null),this.name="#document",this.type=e.Document,this.documentURI=null,this.domConfig=new t,g||(g={}),g.writer||(g.writer=new o),this.options=g,this.stringify=new i(g)}return Object.defineProperty(c.prototype,"implementation",{value:new n}),Object.defineProperty(c.prototype,"doctype",{get:function(){var g,h,b,N;for(N=this.children,h=0,b=N.length;h<b;h++)if(g=N[h],g.type===e.DocType)return g;return null}}),Object.defineProperty(c.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(c.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(c.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(c.prototype,"xmlEncoding",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].encoding:null}}),Object.defineProperty(c.prototype,"xmlStandalone",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].standalone==="yes":!1}}),Object.defineProperty(c.prototype,"xmlVersion",{get:function(){return this.children.length!==0&&this.children[0].type===e.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(c.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(c.prototype,"origin",{get:function(){return null}}),Object.defineProperty(c.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(c.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(c.prototype,"contentType",{get:function(){return null}}),c.prototype.end=function(g){var h;return h={},g?s(g)&&(h=g,g=this.options.writer):g=this.options.writer,g.document(this,g.filterOptions(h))},c.prototype.toString=function(g){return this.options.writer.document(this,this.options.writer.filterOptions(g))},c.prototype.createElement=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTextNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createComment=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createCDATASection=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createProcessingInstruction=function(g,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttribute=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEntityReference=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.importNode=function(g,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createElementNS=function(g,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createAttributeNS=function(g,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByTagNameNS=function(g,h){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementById=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.adoptNode=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.renameNode=function(g,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.getElementsByClassName=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createEvent=function(g){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createNodeIterator=function(g,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},c.prototype.createTreeWalker=function(g,h,b){throw new Error("This DOM method is not implemented."+this.debugInfo())},c}(r)}.call(G)),ft.exports}var Rt={exports:{}},gr;function Oo(){return gr||(gr=1,function(){var e,t,n,r,o,i,s,a,u,d,c,g,h,b,N,I,y,D,w,f,E,O,L,P={}.hasOwnProperty;L=Ee(),E=L.isObject,f=L.isFunction,O=L.isPlainObject,w=L.getValue,e=ee(),g=ri(),h=on(),r=an(),o=un(),N=gn(),D=mn(),b=yn(),d=cn(),c=dn(),i=ln(),a=fn(),s=hn(),u=pn(),n=Zr(),y=ti(),I=bn(),t=Ke(),Rt.exports=function(){function C(l,_,F){var k;this.name="?xml",this.type=e.Document,l||(l={}),k={},l.writer?O(l.writer)&&(k=l.writer,l.writer=new I):l.writer=new I,this.options=l,this.writer=l.writer,this.writerOptions=this.writer.filterOptions(k),this.stringify=new y(l),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 C.prototype.createChildNode=function(l){var _,F,k,q,R,U,H,W;switch(l.type){case e.CData:this.cdata(l.value);break;case e.Comment:this.comment(l.value);break;case e.Element:k={},H=l.attribs;for(F in H)P.call(H,F)&&(_=H[F],k[F]=_.value);this.node(l.name,k);break;case e.Dummy:this.dummy();break;case e.Raw:this.raw(l.value);break;case e.Text:this.text(l.value);break;case e.ProcessingInstruction:this.instruction(l.target,l.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+l.constructor.name)}for(W=l.children,R=0,U=W.length;R<U;R++)q=W[R],this.createChildNode(q),q.type===e.Element&&this.up();return this},C.prototype.dummy=function(){return this},C.prototype.node=function(l,_,F){var k;if(l==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(l));return this.openCurrent(),l=w(l),_==null&&(_={}),_=w(_),E(_)||(k=[_,F],F=k[0],_=k[1]),this.currentNode=new h(this,l,_),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,F!=null&&this.text(F),this},C.prototype.element=function(l,_,F){var k,q,R,U,H,W;if(this.currentNode&&this.currentNode.type===e.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(l)||E(l)||f(l))for(U=this.options.noValidation,this.options.noValidation=!0,W=new g(this.options).element("TEMP_ROOT"),W.element(l),this.options.noValidation=U,H=W.children,q=0,R=H.length;q<R;q++)k=H[q],this.createChildNode(k),k.type===e.Element&&this.up();else this.node(l,_,F);return this},C.prototype.attribute=function(l,_){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(l));if(l!=null&&(l=w(l)),E(l))for(F in l)P.call(l,F)&&(k=l[F],this.attribute(F,k));else f(_)&&(_=_.apply()),this.options.keepNullAttributes&&_==null?this.currentNode.attribs[l]=new n(this,l,""):_!=null&&(this.currentNode.attribs[l]=new n(this,l,_));return this},C.prototype.text=function(l){var _;return this.openCurrent(),_=new D(this,l),this.onData(this.writer.text(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.cdata=function(l){var _;return this.openCurrent(),_=new r(this,l),this.onData(this.writer.cdata(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.comment=function(l){var _;return this.openCurrent(),_=new o(this,l),this.onData(this.writer.comment(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.raw=function(l){var _;return this.openCurrent(),_=new N(this,l),this.onData(this.writer.raw(_,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.instruction=function(l,_){var F,k,q,R,U;if(this.openCurrent(),l!=null&&(l=w(l)),_!=null&&(_=w(_)),Array.isArray(l))for(F=0,R=l.length;F<R;F++)k=l[F],this.instruction(k);else if(E(l))for(k in l)P.call(l,k)&&(q=l[k],this.instruction(k,q));else f(_)&&(_=_.apply()),U=new b(this,l,_),this.onData(this.writer.processingInstruction(U,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},C.prototype.declaration=function(l,_,F){var k;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return k=new d(this,l,_,F),this.onData(this.writer.declaration(k,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.doctype=function(l,_,F){if(this.openCurrent(),l==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 c(this,_,F),this.currentNode.rootNodeName=l,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},C.prototype.dtdElement=function(l,_){var F;return this.openCurrent(),F=new s(this,l,_),this.onData(this.writer.dtdElement(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.attList=function(l,_,F,k,q){var R;return this.openCurrent(),R=new i(this,l,_,F,k,q),this.onData(this.writer.dtdAttList(R,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.entity=function(l,_){var F;return this.openCurrent(),F=new a(this,!1,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.pEntity=function(l,_){var F;return this.openCurrent(),F=new a(this,!0,l,_),this.onData(this.writer.dtdEntity(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.prototype.notation=function(l,_){var F;return this.openCurrent(),F=new u(this,l,_),this.onData(this.writer.dtdNotation(F,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},C.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},C.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},C.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},C.prototype.openNode=function(l){var _,F,k,q;if(!l.isOpen){if(!this.root&&this.currentLevel===0&&l.type===e.Element&&(this.root=l),F="",l.type===e.Element){this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<"+l.name,q=l.attribs;for(k in q)P.call(q,k)&&(_=q[k],F+=this.writer.attribute(_,this.writerOptions,this.currentLevel));F+=(l.children?">":"/>")+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.InsideTag}else this.writerOptions.state=t.OpenTag,F=this.writer.indent(l,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+l.rootNodeName,l.pubID&&l.sysID?F+=' PUBLIC "'+l.pubID+'" "'+l.sysID+'"':l.sysID&&(F+=' SYSTEM "'+l.sysID+'"'),l.children?(F+=" [",this.writerOptions.state=t.InsideTag):(this.writerOptions.state=t.CloseTag,F+=">"),F+=this.writer.endline(l,this.writerOptions,this.currentLevel);return this.onData(F,this.currentLevel),l.isOpen=!0}},C.prototype.closeNode=function(l){var _;if(!l.isClosed)return _="",this.writerOptions.state=t.CloseTag,l.type===e.Element?_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"</"+l.name+">"+this.writer.endline(l,this.writerOptions,this.currentLevel):_=this.writer.indent(l,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(l,this.writerOptions,this.currentLevel),this.writerOptions.state=t.None,this.onData(_,this.currentLevel),l.isClosed=!0},C.prototype.onData=function(l,_){return this.documentStarted=!0,this.onDataCallback(l,_+1)},C.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},C.prototype.debugInfo=function(l){return l==null?"":"node: <"+l+">"},C.prototype.ele=function(){return this.element.apply(this,arguments)},C.prototype.nod=function(l,_,F){return this.node(l,_,F)},C.prototype.txt=function(l){return this.text(l)},C.prototype.dat=function(l){return this.cdata(l)},C.prototype.com=function(l){return this.comment(l)},C.prototype.ins=function(l,_){return this.instruction(l,_)},C.prototype.dec=function(l,_,F){return this.declaration(l,_,F)},C.prototype.dtd=function(l,_,F){return this.doctype(l,_,F)},C.prototype.e=function(l,_,F){return this.element(l,_,F)},C.prototype.n=function(l,_,F){return this.node(l,_,F)},C.prototype.t=function(l){return this.text(l)},C.prototype.d=function(l){return this.cdata(l)},C.prototype.c=function(l){return this.comment(l)},C.prototype.r=function(l){return this.raw(l)},C.prototype.i=function(l,_){return this.instruction(l,_)},C.prototype.att=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},C.prototype.a=function(){return this.currentNode&&this.currentNode.type===e.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},C.prototype.ent=function(l,_){return this.entity(l,_)},C.prototype.pent=function(l,_){return this.pEntity(l,_)},C.prototype.not=function(l,_){return this.notation(l,_)},C}()}.call(G)),Rt.exports}var Xt={exports:{}},mr;function Io(){return mr||(mr=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=ni(),t=Ke(),Xt.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,d){return a.isLastRootNode&&u.state===t.CloseTag?"":s.__super__.endline.call(this,a,u,d)},s.prototype.document=function(a,u){var d,c,g,h,b,N,I,y,D;for(I=a.children,c=g=0,b=I.length;g<b;c=++g)d=I[c],d.isLastRootNode=c===a.children.length-1;for(u=this.filterOptions(u),y=a.children,D=[],h=0,N=y.length;h<N;h++)d=y[h],D.push(this.writeChildNode(d,u,0));return D},s.prototype.attribute=function(a,u,d){return this.stream.write(s.__super__.attribute.call(this,a,u,d))},s.prototype.cdata=function(a,u,d){return this.stream.write(s.__super__.cdata.call(this,a,u,d))},s.prototype.comment=function(a,u,d){return this.stream.write(s.__super__.comment.call(this,a,u,d))},s.prototype.declaration=function(a,u,d){return this.stream.write(s.__super__.declaration.call(this,a,u,d))},s.prototype.docType=function(a,u,d){var c,g,h,b;if(d||(d=0),this.openNode(a,u,d),u.state=t.OpenTag,this.stream.write(this.indent(a,u,d)),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,d)),u.state=t.InsideTag,b=a.children,g=0,h=b.length;g<h;g++)c=b[g],this.writeChildNode(c,u,d+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,d)),u.state=t.None,this.closeNode(a,u,d)},s.prototype.element=function(a,u,d){var c,g,h,b,N,I,y,D,w;d||(d=0),this.openNode(a,u,d),u.state=t.OpenTag,this.stream.write(this.indent(a,u,d)+"<"+a.name),D=a.attribs;for(y in D)o.call(D,y)&&(c=D[y],this.attribute(c,u,d));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,d+1),u.suppressPrettyCount--,u.state=t.CloseTag,this.stream.write("</"+a.name+">");else{for(this.stream.write(">"+this.endline(a,u,d)),u.state=t.InsideTag,w=a.children,N=0,I=w.length;N<I;N++)g=w[N],this.writeChildNode(g,u,d+1);u.state=t.CloseTag,this.stream.write(this.indent(a,u,d)+"</"+a.name+">")}return this.stream.write(this.endline(a,u,d)),u.state=t.None,this.closeNode(a,u,d)},s.prototype.processingInstruction=function(a,u,d){return this.stream.write(s.__super__.processingInstruction.call(this,a,u,d))},s.prototype.raw=function(a,u,d){return this.stream.write(s.__super__.raw.call(this,a,u,d))},s.prototype.text=function(a,u,d){return this.stream.write(s.__super__.text.call(this,a,u,d))},s.prototype.dtdAttList=function(a,u,d){return this.stream.write(s.__super__.dtdAttList.call(this,a,u,d))},s.prototype.dtdElement=function(a,u,d){return this.stream.write(s.__super__.dtdElement.call(this,a,u,d))},s.prototype.dtdEntity=function(a,u,d){return this.stream.write(s.__super__.dtdEntity.call(this,a,u,d))},s.prototype.dtdNotation=function(a,u,d){return this.stream.write(s.__super__.dtdNotation.call(this,a,u,d))},s}(n)}.call(G)),Xt.exports}var yr;function vo(){return yr||(yr=1,function(){var e,t,n,r,o,i,s,a,u,d;d=Ee(),a=d.assign,u=d.isFunction,n=Kr(),r=ri(),o=Oo(),s=bn(),i=Io(),e=ee(),t=Ke(),be.create=function(c,g,h,b){var N,I;if(c==null)throw new Error("Root element needs a name.");return b=a({},g,h,b),N=new r(b),I=N.element(c),b.headless||(N.declaration(b),(b.pubID!=null||b.sysID!=null)&&N.dtd(b)),I},be.begin=function(c,g,h){var b;return u(c)&&(b=[c,g],g=b[0],h=b[1],c={}),g?new o(c,g,h):new r(c)},be.stringWriter=function(c){return new s(c)},be.streamWriter=function(c,g){return new i(c,g)},be.implementation=new n,be.nodeType=e,be.writerState=t}.call(G)),be}var br;function xo(){return br||(br=1,function(){var e,t,n,r,o,i={}.hasOwnProperty;e=vo(),t=rn().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[>")},ct.Builder=function(){function s(a){var u,d,c;this.options={},d=t["0.2"];for(u in d)i.call(d,u)&&(c=d[u],this.options[u]=c);for(u in a)i.call(a,u)&&(c=a[u],this.options[u]=c)}return s.prototype.buildObject=function(a){var u,d,c,g,h;return u=this.options.attrkey,d=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,c=function(b){return function(N,I){var y,D,w,f,E,O;if(typeof I!="object")b.options.cdata&&r(I)?N.raw(o(I)):N.txt(I);else if(Array.isArray(I)){for(f in I)if(i.call(I,f)){D=I[f];for(E in D)w=D[E],N=c(N.ele(E),w).up()}}else for(E in I)if(i.call(I,E))if(D=I[E],E===u){if(typeof D=="object")for(y in D)O=D[y],N=N.att(y,O)}else if(E===d)b.options.cdata&&r(D)?N=N.raw(o(D)):N=N.txt(D);else if(Array.isArray(D))for(f in D)i.call(D,f)&&(w=D[f],typeof w=="string"?b.options.cdata&&r(w)?N=N.ele(E).raw(o(w)).up():N=N.ele(E,w).up():N=c(N.ele(E),w).up());else typeof D=="object"?N=c(N.ele(E),D).up():typeof D=="string"&&b.options.cdata&&r(D)?N=N.ele(E).raw(o(D)).up():(D==null&&(D=""),N=N.ele(E,D.toString()).up());return N}}(this),g=e.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),c(g,a).end(this.options.renderOpts)},s}()}.call(G)),ct}var $t={},Ut={},wr;function Ao(){return wr||(wr=1,function(e){(function(t){t.parser=function(m,p){return new r(m,p)},t.SAXParser=r,t.SAXStream=c,t.createStream=d,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,p){if(!(this instanceof r))return new r(m,p);var M=this;i(M),M.q=M.c="",M.bufferCheckPosition=t.MAX_BUFFER_LENGTH,M.opt=p||{},M.opt.lowercase=M.opt.lowercase||M.opt.lowercasetags,M.looseCase=M.opt.lowercase?"toLowerCase":"toUpperCase",M.opt.maxEntityCount=M.opt.maxEntityCount||512,M.opt.maxEntityDepth=M.opt.maxEntityDepth||4,M.entityCount=M.entityDepth=0,M.tags=[],M.closed=M.closedRoot=M.sawRoot=!1,M.tag=M.error=null,M.strict=!!m,M.noscript=!!(m||M.opt.noscript),M.state=l.BEGIN,M.strictEntities=M.opt.strictEntities,M.ENTITIES=M.strictEntities?Object.create(t.XML_ENTITIES):Object.create(t.ENTITIES),M.attribList=[],M.opt.xmlns&&(M.ns=Object.create(I)),M.opt.unquotedAttributeValues===void 0&&(M.opt.unquotedAttributeValues=!m),M.trackPosition=M.opt.position!==!1,M.trackPosition&&(M.position=M.line=M.column=0),F(M,"onready")}Object.create||(Object.create=function(m){function p(){}p.prototype=m;var M=new p;return M}),Object.keys||(Object.keys=function(m){var p=[];for(var M in m)m.hasOwnProperty(M)&&p.push(M);return p});function o(m){for(var p=Math.max(t.MAX_BUFFER_LENGTH,10),M=0,v=0,Y=n.length;v<Y;v++){var J=m[n[v]].length;if(J>p)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:U(m,"Max buffer length exceeded: "+n[v])}M=Math.max(M,J)}var z=t.MAX_BUFFER_LENGTH-M;m.bufferCheckPosition=z+m.position}function i(m){for(var p=0,M=n.length;p<M;p++)m[n[p]]=""}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(){H(this)},write:tt,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 d(m,p){return new c(m,p)}function c(m,p){if(!(this instanceof c))return new c(m,p);a.apply(this),this._parser=new r(m,p),this.writable=!0,this.readable=!0;var M=this;this._parser.onend=function(){M.emit("end")},this._parser.onerror=function(v){M.emit("error",v),M._parser.error=null},this._decoder=null,u.forEach(function(v){Object.defineProperty(M,"on"+v,{get:function(){return M._parser["on"+v]},set:function(Y){if(!Y)return M.removeAllListeners(v),M._parser["on"+v]=Y,Y;M.on(v,Y)},enumerable:!0,configurable:!1})})}c.prototype=Object.create(a.prototype,{constructor:{value:c}}),c.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},c.prototype.end=function(m){if(m&&m.length&&this.write(m),this._decoder){var p=this._decoder.decode();p&&(this._parser.write(p),this.emit("data",p))}return this._parser.end(),!0},c.prototype.on=function(m,p){var M=this;return!M._parser["on"+m]&&u.indexOf(m)!==-1&&(M._parser["on"+m]=function(){var v=arguments.length===1?[arguments[0]]:Array.apply(null,arguments);v.splice(0,0,m),M.emit.apply(M,v)}),a.prototype.on.call(M,m,p)};var g="[CDATA[",h="DOCTYPE",b="http://www.w3.org/XML/1998/namespace",N="http://www.w3.org/2000/xmlns/",I={xml:b,xmlns:N},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-]/,w=/[#:_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 E(m){return m===" "||m===`
69
+ `||m==="\r"||m===" "}function O(m){return m==='"'||m==="'"}function L(m){return m===">"||E(m)}function P(m,p){return m.test(p)}function C(m,p){return!P(m,p)}var l=0;t.STATE={BEGIN:l++,BEGIN_WHITESPACE:l++,TEXT:l++,TEXT_ENTITY:l++,OPEN_WAKA:l++,SGML_DECL:l++,SGML_DECL_QUOTED:l++,DOCTYPE:l++,DOCTYPE_QUOTED:l++,DOCTYPE_DTD:l++,DOCTYPE_DTD_QUOTED:l++,COMMENT_STARTING:l++,COMMENT:l++,COMMENT_ENDING:l++,COMMENT_ENDED:l++,CDATA:l++,CDATA_ENDING:l++,CDATA_ENDING_2:l++,PROC_INST:l++,PROC_INST_BODY:l++,PROC_INST_ENDING:l++,OPEN_TAG:l++,OPEN_TAG_SLASH:l++,ATTRIB:l++,ATTRIB_NAME:l++,ATTRIB_NAME_SAW_WHITE:l++,ATTRIB_VALUE:l++,ATTRIB_VALUE_QUOTED:l++,ATTRIB_VALUE_CLOSED:l++,ATTRIB_VALUE_UNQUOTED:l++,ATTRIB_VALUE_ENTITY_Q:l++,ATTRIB_VALUE_ENTITY_U:l++,CLOSE_TAG:l++,CLOSE_TAG_SAW_WHITE:l++,SCRIPT:l++,SCRIPT_ENDING:l++},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 p=t.ENTITIES[m],M=typeof p=="number"?String.fromCharCode(p):p;t.ENTITIES[m]=M});for(var _ in t.STATE)t.STATE[t.STATE[_]]=_;l=t.STATE;function F(m,p,M){m[p]&&m[p](M)}function k(m,p,M){m.textNode&&q(m),F(m,p,M)}function q(m){m.textNode=R(m.opt,m.textNode),m.textNode&&F(m,"ontext",m.textNode),m.textNode=""}function R(m,p){return m.trim&&(p=p.trim()),m.normalize&&(p=p.replace(/\s+/g," ")),p}function U(m,p){return q(m),m.trackPosition&&(p+=`
70
+ Line: `+m.line+`
71
+ Column: `+m.column+`
72
+ Char: `+m.c),p=new Error(p),m.error=p,F(m,"onerror",p),m}function H(m){return m.sawRoot&&!m.closedRoot&&W(m,"Unclosed root tag"),m.state!==l.BEGIN&&m.state!==l.BEGIN_WHITESPACE&&m.state!==l.TEXT&&U(m,"Unexpected end"),q(m),m.c="",m.closed=!0,F(m,"onend"),r.call(m,m.strict,m.opt),m}function W(m,p){if(typeof m!="object"||!(m instanceof r))throw new Error("bad call to strictFail");m.strict&&U(m,p)}function Ze(m){m.strict||(m.tagName=m.tagName[m.looseCase]());var p=m.tags[m.tags.length-1]||m,M=m.tag={name:m.tagName,attributes:{}};m.opt.xmlns&&(M.ns=p.ns),m.attribList.length=0,k(m,"onopentagstart",M)}function je(m,p){var M=m.indexOf(":"),v=M<0?["",m]:m.split(":"),Y=v[0],J=v[1];return p&&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 p=je(m.attribName,!0),M=p.prefix,v=p.local;if(M==="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!==N)W(m,"xmlns: prefix must be bound to "+N+`
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,p){if(m.opt.xmlns){var M=m.tag,v=je(m.tagName);M.prefix=v.prefix,M.local=v.local,M.uri=M.ns[v.prefix]||"",M.prefix&&!M.uri&&(W(m,"Unbound namespace prefix: "+JSON.stringify(m.tagName)),M.uri=v.prefix);var Y=m.tags[m.tags.length-1]||m;M.ns&&Y.ns!==M.ns&&Object.keys(M.ns).forEach(function($){k(m,"onopennamespace",{prefix:$,uri:M.ns[$]})});for(var J=0,z=m.attribList.length;J<z;J++){var ne=m.attribList[J],T=ne[0],A=ne[1],j=je(T,!0),S=j.prefix,x=j.local,X=S===""?"":M.ns[S]||"",B={name:T,value:A,prefix:S,local:x,uri:X};S&&S!=="xmlns"&&!X&&(W(m,"Unbound namespace prefix: "+JSON.stringify(S)),B.uri=S),m.tag.attributes[T]=B,k(m,"onattribute",B)}m.attribList.length=0}m.tag.isSelfClosing=!!p,m.sawRoot=!0,m.tags.push(m.tag),k(m,"onopentag",m.tag),p||(!m.noscript&&m.tagName.toLowerCase()==="script"?m.state=l.SCRIPT:m.state=l.TEXT,m.tag=null,m.tagName=""),m.attribName=m.attribValue="",m.attribList.length=0}function me(m){if(!m.tagName){W(m,"Weird empty close tag."),m.textNode+="</>",m.state=l.TEXT;return}if(m.script){if(m.tagName!=="script"){m.script+="</"+m.tagName+">",m.tagName="",m.state=l.SCRIPT;return}k(m,"onscript",m.script),m.script=""}var p=m.tags.length,M=m.tagName;m.strict||(M=M[m.looseCase]());for(var v=M;p--;){var Y=m.tags[p];if(Y.name!==v)W(m,"Unexpected close tag");else break}if(p<0){W(m,"Unmatched closing tag: "+m.tagName),m.textNode+="</"+m.tagName+">",m.state=l.TEXT;return}m.tagName=M;for(var J=m.tags.length;J-- >p;){var z=m.tag=m.tags.pop();m.tagName=m.tag.name,k(m,"onclosetag",m.tagName);var ne={};for(var T in z.ns)ne[T]=z.ns[T];var A=m.tags[m.tags.length-1]||m;m.opt.xmlns&&z.ns!==A.ns&&Object.keys(z.ns).forEach(function(j){var S=z.ns[j];k(m,"onclosenamespace",{prefix:j,uri:S})})}p===0&&(m.closedRoot=!0),m.tagName=m.attribValue=m.attribName="",m.attribList.length=0,m.state=l.TEXT}function et(m){var p=m.entity,M=p.toLowerCase(),v,Y="";return m.ENTITIES[p]?m.ENTITIES[p]:m.ENTITIES[M]?m.ENTITIES[M]:(p=M,p.charAt(0)==="#"&&(p.charAt(1)==="x"?(p=p.slice(2),v=parseInt(p,16),Y=v.toString(16)):(p=p.slice(1),v=parseInt(p,10),Y=v.toString(10))),p=p.replace(/^0+/,""),isNaN(v)||Y.toLowerCase()!==p||v<0||v>1114111?(W(m,"Invalid character entity"),"&"+m.entity+";"):String.fromCodePoint(v))}function V(m,p){p==="<"?(m.state=l.OPEN_WAKA,m.startTagPosition=m.position):E(p)||(W(m,"Non-whitespace before first tag."),m.textNode=p,m.state=l.TEXT)}function Pe(m,p){var M="";return p<m.length&&(M=m.charAt(p)),M}function tt(m){var p=this;if(this.error)throw this.error;if(p.closed)return U(p,"Cannot write after close. Assign an onready handler.");if(m===null)return H(p);typeof m=="object"&&(m=m.toString());for(var M=0,v="";v=Pe(m,M++),p.c=v,!!v;)switch(p.trackPosition&&(p.position++,v===`
75
+ `?(p.line++,p.column=0):p.column++),p.state){case l.BEGIN:if(p.state=l.BEGIN_WHITESPACE,v==="\uFEFF")continue;V(p,v);continue;case l.BEGIN_WHITESPACE:V(p,v);continue;case l.TEXT:if(p.sawRoot&&!p.closedRoot){for(var J=M-1;v&&v!=="<"&&v!=="&";)v=Pe(m,M++),v&&p.trackPosition&&(p.position++,v===`
76
+ `?(p.line++,p.column=0):p.column++);p.textNode+=m.substring(J,M-1)}v==="<"&&!(p.sawRoot&&p.closedRoot&&!p.strict)?(p.state=l.OPEN_WAKA,p.startTagPosition=p.position):(!E(v)&&(!p.sawRoot||p.closedRoot)&&W(p,"Text data outside of root node."),v==="&"?p.state=l.TEXT_ENTITY:p.textNode+=v);continue;case l.SCRIPT:v==="<"?p.state=l.SCRIPT_ENDING:p.script+=v;continue;case l.SCRIPT_ENDING:v==="/"?p.state=l.CLOSE_TAG:(p.script+="<"+v,p.state=l.SCRIPT);continue;case l.OPEN_WAKA:if(v==="!")p.state=l.SGML_DECL,p.sgmlDecl="";else if(!E(v))if(P(y,v))p.state=l.OPEN_TAG,p.tagName=v;else if(v==="/")p.state=l.CLOSE_TAG,p.tagName="";else if(v==="?")p.state=l.PROC_INST,p.procInstName=p.procInstBody="";else{if(W(p,"Unencoded <"),p.startTagPosition+1<p.position){var Y=p.position-p.startTagPosition;v=new Array(Y).join(" ")+v}p.textNode+="<"+v,p.state=l.TEXT}continue;case l.SGML_DECL:if(p.sgmlDecl+v==="--"){p.state=l.COMMENT,p.comment="",p.sgmlDecl="";continue}p.doctype&&p.doctype!==!0&&p.sgmlDecl?(p.state=l.DOCTYPE_DTD,p.doctype+="<!"+p.sgmlDecl+v,p.sgmlDecl=""):(p.sgmlDecl+v).toUpperCase()===g?(k(p,"onopencdata"),p.state=l.CDATA,p.sgmlDecl="",p.cdata=""):(p.sgmlDecl+v).toUpperCase()===h?(p.state=l.DOCTYPE,(p.doctype||p.sawRoot)&&W(p,"Inappropriately located doctype declaration"),p.doctype="",p.sgmlDecl=""):v===">"?(k(p,"onsgmldeclaration",p.sgmlDecl),p.sgmlDecl="",p.state=l.TEXT):(O(v)&&(p.state=l.SGML_DECL_QUOTED),p.sgmlDecl+=v);continue;case l.SGML_DECL_QUOTED:v===p.q&&(p.state=l.SGML_DECL,p.q=""),p.sgmlDecl+=v;continue;case l.DOCTYPE:v===">"?(p.state=l.TEXT,k(p,"ondoctype",p.doctype),p.doctype=!0):(p.doctype+=v,v==="["?p.state=l.DOCTYPE_DTD:O(v)&&(p.state=l.DOCTYPE_QUOTED,p.q=v));continue;case l.DOCTYPE_QUOTED:p.doctype+=v,v===p.q&&(p.q="",p.state=l.DOCTYPE);continue;case l.DOCTYPE_DTD:v==="]"?(p.doctype+=v,p.state=l.DOCTYPE):v==="<"?(p.state=l.OPEN_WAKA,p.startTagPosition=p.position):O(v)?(p.doctype+=v,p.state=l.DOCTYPE_DTD_QUOTED,p.q=v):p.doctype+=v;continue;case l.DOCTYPE_DTD_QUOTED:p.doctype+=v,v===p.q&&(p.state=l.DOCTYPE_DTD,p.q="");continue;case l.COMMENT:v==="-"?p.state=l.COMMENT_ENDING:p.comment+=v;continue;case l.COMMENT_ENDING:v==="-"?(p.state=l.COMMENT_ENDED,p.comment=R(p.opt,p.comment),p.comment&&k(p,"oncomment",p.comment),p.comment=""):(p.comment+="-"+v,p.state=l.COMMENT);continue;case l.COMMENT_ENDED:v!==">"?(W(p,"Malformed comment"),p.comment+="--"+v,p.state=l.COMMENT):p.doctype&&p.doctype!==!0?p.state=l.DOCTYPE_DTD:p.state=l.TEXT;continue;case l.CDATA:for(var J=M-1;v&&v!=="]";)v=Pe(m,M++),v&&p.trackPosition&&(p.position++,v===`
77
+ `?(p.line++,p.column=0):p.column++);p.cdata+=m.substring(J,M-1),v==="]"&&(p.state=l.CDATA_ENDING);continue;case l.CDATA_ENDING:v==="]"?p.state=l.CDATA_ENDING_2:(p.cdata+="]"+v,p.state=l.CDATA);continue;case l.CDATA_ENDING_2:v===">"?(p.cdata&&k(p,"oncdata",p.cdata),k(p,"onclosecdata"),p.cdata="",p.state=l.TEXT):v==="]"?p.cdata+="]":(p.cdata+="]]"+v,p.state=l.CDATA);continue;case l.PROC_INST:v==="?"?p.state=l.PROC_INST_ENDING:E(v)?p.state=l.PROC_INST_BODY:p.procInstName+=v;continue;case l.PROC_INST_BODY:if(!p.procInstBody&&E(v))continue;v==="?"?p.state=l.PROC_INST_ENDING:p.procInstBody+=v;continue;case l.PROC_INST_ENDING:v===">"?(k(p,"onprocessinginstruction",{name:p.procInstName,body:p.procInstBody}),p.procInstName=p.procInstBody="",p.state=l.TEXT):(p.procInstBody+="?"+v,p.state=l.PROC_INST_BODY);continue;case l.OPEN_TAG:P(D,v)?p.tagName+=v:(Ze(p),v===">"?ue(p):v==="/"?p.state=l.OPEN_TAG_SLASH:(E(v)||W(p,"Invalid character in tag name"),p.state=l.ATTRIB));continue;case l.OPEN_TAG_SLASH:v===">"?(ue(p,!0),me(p)):(W(p,"Forward-slash in opening tag not followed by >"),p.state=l.ATTRIB);continue;case l.ATTRIB:if(E(v))continue;v===">"?ue(p):v==="/"?p.state=l.OPEN_TAG_SLASH:P(y,v)?(p.attribName=v,p.attribValue="",p.state=l.ATTRIB_NAME):W(p,"Invalid attribute name");continue;case l.ATTRIB_NAME:v==="="?p.state=l.ATTRIB_VALUE:v===">"?(W(p,"Attribute without value"),p.attribValue=p.attribName,Ae(p),ue(p)):E(v)?p.state=l.ATTRIB_NAME_SAW_WHITE:P(D,v)?p.attribName+=v:W(p,"Invalid attribute name");continue;case l.ATTRIB_NAME_SAW_WHITE:if(v==="=")p.state=l.ATTRIB_VALUE;else{if(E(v))continue;W(p,"Attribute without value"),p.tag.attributes[p.attribName]="",p.attribValue="",k(p,"onattribute",{name:p.attribName,value:""}),p.attribName="",v===">"?ue(p):P(y,v)?(p.attribName=v,p.state=l.ATTRIB_NAME):(W(p,"Invalid attribute name"),p.state=l.ATTRIB)}continue;case l.ATTRIB_VALUE:if(E(v))continue;O(v)?(p.q=v,p.state=l.ATTRIB_VALUE_QUOTED):(p.opt.unquotedAttributeValues||U(p,"Unquoted attribute value"),p.state=l.ATTRIB_VALUE_UNQUOTED,p.attribValue=v);continue;case l.ATTRIB_VALUE_QUOTED:if(v!==p.q){v==="&"?p.state=l.ATTRIB_VALUE_ENTITY_Q:p.attribValue+=v;continue}Ae(p),p.q="",p.state=l.ATTRIB_VALUE_CLOSED;continue;case l.ATTRIB_VALUE_CLOSED:E(v)?p.state=l.ATTRIB:v===">"?ue(p):v==="/"?p.state=l.OPEN_TAG_SLASH:P(y,v)?(W(p,"No whitespace between attributes"),p.attribName=v,p.attribValue="",p.state=l.ATTRIB_NAME):W(p,"Invalid attribute name");continue;case l.ATTRIB_VALUE_UNQUOTED:if(!L(v)){v==="&"?p.state=l.ATTRIB_VALUE_ENTITY_U:p.attribValue+=v;continue}Ae(p),v===">"?ue(p):p.state=l.ATTRIB;continue;case l.CLOSE_TAG:if(p.tagName)v===">"?me(p):P(D,v)?p.tagName+=v:p.script?(p.script+="</"+p.tagName+v,p.tagName="",p.state=l.SCRIPT):(E(v)||W(p,"Invalid tagname in closing tag"),p.state=l.CLOSE_TAG_SAW_WHITE);else{if(E(v))continue;C(y,v)?p.script?(p.script+="</"+v,p.state=l.SCRIPT):W(p,"Invalid tagname in closing tag."):p.tagName=v}continue;case l.CLOSE_TAG_SAW_WHITE:if(E(v))continue;v===">"?me(p):W(p,"Invalid characters in closing tag");continue;case l.TEXT_ENTITY:case l.ATTRIB_VALUE_ENTITY_Q:case l.ATTRIB_VALUE_ENTITY_U:var z,ne;switch(p.state){case l.TEXT_ENTITY:z=l.TEXT,ne="textNode";break;case l.ATTRIB_VALUE_ENTITY_Q:z=l.ATTRIB_VALUE_QUOTED,ne="attribValue";break;case l.ATTRIB_VALUE_ENTITY_U:z=l.ATTRIB_VALUE_UNQUOTED,ne="attribValue";break}if(v===";"){var T=et(p);p.opt.unparsedEntities&&!Object.values(t.XML_ENTITIES).includes(T)?((p.entityCount+=1)>p.opt.maxEntityCount&&U(p,"Parsed entity count exceeds max entity count"),(p.entityDepth+=1)>p.opt.maxEntityDepth&&U(p,"Parsed entity depth exceeds max entity depth"),p.entity="",p.state=z,p.write(T),p.entityDepth-=1):(p[ne]+=T,p.entity="",p.state=z)}else P(p.entity.length?f:w,v)?p.entity+=v:(W(p,"Invalid character in entity name"),p[ne]+="&"+p.entity+v,p.entity="",p.state=z);continue;default:throw new Error(p,"Unknown state: "+p.state)}return p.position>=p.bufferCheckPosition&&o(p),p}/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */String.fromCodePoint||function(){var m=String.fromCharCode,p=Math.floor,M=function(){var v=16384,Y=[],J,z,ne=-1,T=arguments.length;if(!T)return"";for(var A="";++ne<T;){var j=Number(arguments[ne]);if(!isFinite(j)||j<0||j>1114111||p(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===T||Y.length>v)&&(A+=m.apply(null,Y),Y.length=0)}return A};Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:M,configurable:!0,writable:!0}):String.fromCodePoint=M}()})(e)}(Ut)),Ut}var Vt={},Er;function Po(){return Er||(Er=1,function(){Vt.stripBOM=function(e){return e[0]==="\uFEFF"?e.substring(1):e}}.call(G)),Vt}var ve={},Nr;function ii(){return Nr||(Nr=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(G)),ve}var Tr;function Lo(){return Tr||(Tr=1,function(e){(function(){var t,n,r,o,i,s,a,u,d,c=function(b,N){return function(){return b.apply(N,arguments)}},g=function(b,N){for(var I in N)h.call(N,I)&&(b[I]=N[I]);function y(){this.constructor=b}return y.prototype=N.prototype,b.prototype=new y,b.__super__=N.prototype,b},h={}.hasOwnProperty;u=Ao(),o=nn,t=Po(),a=ii(),d=xi.setImmediate,n=rn().defaults,i=function(b){return typeof b=="object"&&b!=null&&Object.keys(b).length===0},s=function(b,N,I){var y,D,w;for(y=0,D=b.length;y<D;y++)w=b[y],N=w(N,I);return N},r=function(b,N,I){var y;return y=Object.create(null),y.value=I,y.writable=!0,y.enumerable=!0,y.configurable=!0,Object.defineProperty(b,N,y)},e.Parser=function(b){g(N,b);function N(I){this.parseStringPromise=c(this.parseStringPromise,this),this.parseString=c(this.parseString,this),this.reset=c(this.reset,this),this.assignOrPush=c(this.assignOrPush,this),this.processAsync=c(this.processAsync,this);var y,D,w;if(!(this instanceof e.Parser))return new e.Parser(I);this.options={},D=n["0.2"];for(y in D)h.call(D,y)&&(w=D[y],this.options[y]=w);for(y in I)h.call(I,y)&&(w=I[y],this.options[y]=w);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 N.prototype.processAsync=function(){var I,y;try{return this.remaining.length<=this.options.chunkSize?(I=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(I),this.saxParser.close()):(I=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(I),d(this.processAsync))}catch(D){if(y=D,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(y)}},N.prototype.assignOrPush=function(I,y,D){return y in I?(I[y]instanceof Array||r(I,y,[I[y]]),I[y].push(D)):this.options.explicitArray?r(I,y,[D]):r(I,y,D)},N.prototype.reset=function(){var I,y,D,w;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(E){if(f.saxParser.resume(),!f.saxParser.errThrown)return f.saxParser.errThrown=!0,f.emit("error",E)}}(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,w=[],I=this.options.attrkey,y=this.options.charkey,this.saxParser.onopentag=function(f){return function(E){var O,L,P,C,l;if(P={},P[y]="",!f.options.ignoreAttrs){l=E.attributes;for(O in l)h.call(l,O)&&(!(I in P)&&!f.options.mergeAttrs&&(P[I]={}),L=f.options.attrValueProcessors?s(f.options.attrValueProcessors,E.attributes[O],O):E.attributes[O],C=f.options.attrNameProcessors?s(f.options.attrNameProcessors,O):O,f.options.mergeAttrs?f.assignOrPush(P,C,L):r(P[I],C,L))}return P["#name"]=f.options.tagNameProcessors?s(f.options.tagNameProcessors,E.name):E.name,f.options.xmlns&&(P[f.options.xmlnskey]={uri:E.uri,local:E.local}),w.push(P)}}(this),this.saxParser.onclosetag=function(f){return function(){var E,O,L,P,C,l,_,F,k,q;if(l=w.pop(),C=l["#name"],(!f.options.explicitChildren||!f.options.preserveChildrenOrder)&&delete l["#name"],l.cdata===!0&&(E=l.cdata,delete l.cdata),k=w[w.length-1],l[y].match(/^\s*$/)&&!E?(O=l[y],delete l[y]):(f.options.trim&&(l[y]=l[y].trim()),f.options.normalize&&(l[y]=l[y].replace(/\s{2,}/g," ").trim()),l[y]=f.options.valueProcessors?s(f.options.valueProcessors,l[y],C):l[y],Object.keys(l).length===1&&y in l&&!f.EXPLICIT_CHARKEY&&(l=l[y])),i(l)&&(typeof f.options.emptyTag=="function"?l=f.options.emptyTag():l=f.options.emptyTag!==""?f.options.emptyTag:O),f.options.validator!=null&&(q="/"+function(){var R,U,H;for(H=[],R=0,U=w.length;R<U;R++)P=w[R],H.push(P["#name"]);return H}().concat(C).join("/"),function(){var R;try{return l=f.options.validator(q,k&&k[C],l)}catch(U){return R=U,f.emit("error",R)}}()),f.options.explicitChildren&&!f.options.mergeAttrs&&typeof l=="object"){if(!f.options.preserveChildrenOrder)P={},f.options.attrkey in l&&(P[f.options.attrkey]=l[f.options.attrkey],delete l[f.options.attrkey]),!f.options.charsAsChildren&&f.options.charkey in l&&(P[f.options.charkey]=l[f.options.charkey],delete l[f.options.charkey]),Object.getOwnPropertyNames(l).length>0&&(P[f.options.childkey]=l),l=P;else if(k){k[f.options.childkey]=k[f.options.childkey]||[],_={};for(L in l)h.call(l,L)&&r(_,L,l[L]);k[f.options.childkey].push(_),delete l["#name"],Object.keys(l).length===1&&y in l&&!f.EXPLICIT_CHARKEY&&(l=l[y])}}return w.length>0?f.assignOrPush(k,C,l):(f.options.explicitRoot&&(F=l,l={},r(l,C,F)),f.resultObject=l,f.saxParser.ended=!0,f.emit("end",f.resultObject))}}(this),D=function(f){return function(E){var O,L;if(L=w[w.length-1],L)return L[y]+=E,f.options.explicitChildren&&f.options.preserveChildrenOrder&&f.options.charsAsChildren&&(f.options.includeWhiteChars||E.replace(/\\n/g,"").trim()!=="")&&(L[f.options.childkey]=L[f.options.childkey]||[],O={"#name":"__text__"},O[y]=E,f.options.normalize&&(O[y]=O[y].replace(/\s{2,}/g," ").trim()),L[f.options.childkey].push(O)),L}}(this),this.saxParser.ontext=D,this.saxParser.oncdata=function(f){return function(E){var O;if(O=D(E),O)return O.cdata=!0}}()},N.prototype.parseString=function(I,y){var D;y!=null&&typeof y=="function"&&(this.on("end",function(w){return this.reset(),y(null,w)}),this.on("error",function(w){return this.reset(),y(w)}));try{return I=I.toString(),I.trim()===""?(this.emit("end",null),!0):(I=t.stripBOM(I),this.options.async?(this.remaining=I,d(this.processAsync),this.saxParser):this.saxParser.write(I).close())}catch(w){if(D=w,this.saxParser.errThrown||this.saxParser.ended){if(this.saxParser.ended)throw D}else return this.emit("error",D),this.saxParser.errThrown=!0}},N.prototype.parseStringPromise=function(I){return new Promise(function(y){return function(D,w){return y.parseString(I,function(f,E){return f?w(f):D(E)})}}(this))},N}(o),e.parseString=function(b,N,I){var y,D,w;return I!=null?(typeof I=="function"&&(y=I),typeof N=="object"&&(D=N)):(typeof N=="function"&&(y=N),D={}),w=new e.Parser(D),w.parseString(b,y)},e.parseStringPromise=function(b,N){var I,y;return typeof N=="object"&&(I=N),y=new e.Parser(I),y.parseStringPromise(b)}}).call(G)}($t)),$t}var si;(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=rn(),e=xo(),n=Lo(),ii(),t.defaults,function(i){r(s,i);function s(a){this.message=a}return s}(Error),e.Builder,n.Parser,n.parseString,si=n.parseStringPromise}).call(G);class _o{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 si(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: `+y.attribValue);else{var Y=y.tag,J=y.tags[y.tags.length-1]||y;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((f,d)=>d===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a},p=`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:p}})}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 c=this.uriFromCDPToBridge(a),p=this.uriFromBridgeToDBGP(c),f=(typeof u=="number"?u:0)+1,d=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(p)} -n ${f}`,E=this.sendDbgpCommand(b);this.pendingCommands.set(E,{cdpId:n,cdpMethod:r,params:{breakpointId:d,fileUri:c,lineNumber:f}}),s=!1}else this.breakpoints.set(d,{cdpId:d,xdebugId:null,fileUri:c,lineNumber:f}),i={breakpointId:d,locations:[{scriptId:this.getOrCreateScriptId(c),lineNumber:f-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),c=this.breakpoints.get(u);if(c){if(c.xdebugId&&this.xdebugConnected){const p=`breakpoint_remove -d ${c.xdebugId}`,f=this.sendDbgpCommand(p);this.pendingCommands.set(f,{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 c=Buffer.from(a).toString("base64"),p=this.sendDbgpCommand("eval",`-- ${c}`);this.pendingCommands.set(p,{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 c=u.contextId??0,f=`context_get -d ${u.depth} -c ${c} -p 0 -m 32`,d=this.sendDbgpCommand(f),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 c=u.depth,p=u.fullname,f=this.formatPropertyFullName(p),d=`property_get -d ${c} -n ${f} -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(([,p])=>p===a)?.[0],c=[];u&&c.push(`Here's the full path for your convenience:
85
+ `),a=s.map((g,h)=>h===0?"AAAA":"AACA").join(";"),u={version:3,file:o,sources:[r],sourcesContent:[i],mappings:a},c=`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:c}})}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=vi("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 d=this.uriFromCDPToBridge(a),c=this.uriFromBridgeToDBGP(d),g=(typeof u=="number"?u:0)+1,h=String(this.breakpoints.size+1);if(this.xdebugConnected){const b=`breakpoint_set -t line -f ${this.formatPropertyFullName(c)} -n ${g}`,N=this.sendDbgpCommand(b);this.pendingCommands.set(N,{cdpId:n,cdpMethod:r,params:{breakpointId:h,fileUri:d,lineNumber:g}}),s=!1}else this.breakpoints.set(h,{cdpId:h,xdebugId:null,fileUri:d,lineNumber:g}),i={breakpointId:h,locations:[{scriptId:this.getOrCreateScriptId(d),lineNumber:g-1,columnNumber:0}]};break}case"Debugger.removeBreakpoint":{const{breakpointId:a}=o,u=String(a),d=this.breakpoints.get(u);if(d){if(d.xdebugId&&this.xdebugConnected){const c=`breakpoint_remove -d ${d.xdebugId}`,g=this.sendDbgpCommand(c);this.pendingCommands.set(g,{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 d=Buffer.from(a).toString("base64"),c=this.sendDbgpCommand("eval",`-- ${d}`);this.pendingCommands.set(c,{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 d=u.contextId??0,g=`context_get -d ${u.depth} -c ${d} -p 0 -m 32`,h=this.sendDbgpCommand(g),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 d=u.depth,c=u.fullname,g=this.formatPropertyFullName(c),h=`property_get -d ${d} -n ${g} -p 0 -m 32`,b=this.sendDbgpCommand(h),N={...u,currentPage:0,aggregatedProps:[]};this.objectHandles.set(a,N),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(([,c])=>c===a)?.[0],d=[];u&&d.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.",...c,"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.",...d,"What is this file, then? It's a placeholder required due to the dev tools limitations.","The XDebug <-> Devtools bridge implement PHP syntax highlighting using source maps,",'and the unfortunate side effect is having a "source" file and a "target" file.',`This is the "source". If you're interested in even more details, see the discussion at:
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:c,fileUri:p,lineNumber:f}=u;this.breakpoints.set(c,{cdpId:c,xdebugId:a,fileUri:p,lineNumber:f});const d=this.getOrCreateScriptId(p),b={breakpointId:c,locations:[{scriptId:d,lineNumber:f-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 c=n.property,p=c.$.type,f=c.$.encoding;let d=null;if(Object.prototype.hasOwnProperty.call(c,"_")?d=c._:typeof c.$value<"u"&&(d=c.$value),f==="base64"&&d!==null)try{d=Buffer.from(d,"base64").toString()}catch{}if(p==="string")a={type:"string",value:d??""};else if(p==="int"||p==="float"||p==="bool"||p==="boolen"||p==="integer"||p==="double"){let b=d;p.startsWith("int")||p==="integer"?b=parseInt(d||"0",10):p==="float"||p==="double"?b=parseFloat(d||"0"):p.startsWith("bool")&&(b=d==="1"||d==="true"),a={type:"number",value:b}}else if(p==="array"||p==="object"){const b=c.$.classname||(p==="array"?"Array":"Object"),E=String(this.nextObjectId++),v=c.$.fullname||"";this.objectHandles.set(E,{type:"property",depth:0,contextId:0,fullname:v}),a={type:"object",objectId:E,className:b,description:b}}else p==="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,c=n.property?.property??n.property,p=[];if(c){const f=Array.isArray(c)?c:[c];for(const d of f){const b=d.$.name||d.$.fullname||"";let E=d.$.type||"undefined";const v=d.$.children==="1",m=d.$.encoding;let D=null;if(typeof d._<"u"&&(D=d._),m==="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}),p.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,p.push({name:d.$.key||b,value:w,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const f=(u.aggregatedProps||[]).concat(p),d=32;if(p.length===d){const E=(u.currentPage||0)+1,v={...u,currentPage:E,aggregatedProps:f};this.objectHandles.set(a,v);let m;if(o==="context_get"){const T=u.contextId??0;m=`context_get -d ${u.depth} -c ${T} -p ${E} -m ${d}`}else{const T=u.depth,h=u.fullname,w=this.formatPropertyFullName(h);m=`property_get -d ${T} -n ${w} -p ${E} -m ${d}`}const D=this.sendDbgpCommand(m);this.pendingCommands.set(D,{cdpId:s.cdpId,cdpMethod:s.cdpMethod,params:s.params}),this.pendingCommands.delete(i);return}else{const E={result:f};this.cdp.sendMessage({id:s.cdpId,result:E}),this.pendingCommands.delete(i)}}else{const f={result:p};this.cdp.sendMessage({id:s.cdpId,result:f}),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 p of a){const f=this.uriFromDBGPToBridge(p.$.filename),d=this.getOrCreateScriptId(f);this.scriptIdByUrl.has(f)||(this.scriptIdByUrl.set(f,d),await this.sendScriptToCDP(f,d))}for(const p of a){const f=parseInt(p.$.level,10),d=this.uriFromDBGPToBridge(p.$.filename),b=parseInt(p.$.lineno,10),E=p.$.where&&p.$.where!=="{main}"?p.$.where:"(anonymous)",v=`frame:${f}`;this.callFramesMap.set(v,f);const m=[],D=String(this.nextObjectId++);this.objectHandles.set(D,{type:"context",contextId:0,depth:f}),m.push({type:"local",object:{objectId:D,className:"Object",description:"Local"}});const T=String(this.nextObjectId++);this.objectHandles.set(T,{type:"context",contextId:1,depth:f}),m.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:m,this:{type:"object",className:"Object",description:"Object",objectId:T}})}let c="pause";if(a.length>0){const p=a[0];if(p.$.filename&&p.$.lineno){const f=this.uriFromDBGPToBridge(p.$.filename),d=parseInt(p.$.lineno,10);for(const b of this.breakpoints.values())if(b.fileUri===f&&b.lineNumber===d){c="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:c,callFrames:u,hitBreakpoints:c==="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 No(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 Ys(t);de.log("Connect Chrome DevTools to CDP at:"),de.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${t}
90
- `),await new Promise(f=>s.on("clientConnected",f)),await new Promise(f=>setTimeout(f,2e3)),de.log("Chrome connected! Initializing Xdebug receiver...");const a=new zs(n);de.log(`XDebug receiver running on port ${n}`),de.log("Running a PHP script with Xdebug enabled...");async function u(f){const d=[],b=e.phpInstance?await e.phpInstance.listFiles(f):li(f);for(const E of b){const v=oe.join(f,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 c=e.phpInstance?f=>e.phpInstance.readFileAsText(f):e.getPHPFile?e.getPHPFile:f=>Jt(f,"utf-8"),p=await u(o);return new To(a,s,{knownScriptUrls:p,phpRoot:o,getPHPFile:c,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,Io=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,ni=(import.meta||{}).url,Qt=new URL("ca-bundle.crt",ni).pathname;pi(Qt)||Nr(Qt,di.join(`
91
- `));se.unshift("-d",`openssl.cafile=${Qt}`);async function Oo(){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=yn(oe.join(bn.tmpdir(),"php-wasm-bin"));Nr(`${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:d,fileUri:c,lineNumber:g}=u;this.breakpoints.set(d,{cdpId:d,xdebugId:a,fileUri:c,lineNumber:g});const h=this.getOrCreateScriptId(c),b={breakpointId:d,locations:[{scriptId:h,lineNumber:g-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 d=n.property,c=d.$.type,g=d.$.encoding;let h=null;if(Object.prototype.hasOwnProperty.call(d,"_")?h=d._:typeof d.$value<"u"&&(h=d.$value),g==="base64"&&h!==null)try{h=Buffer.from(h,"base64").toString()}catch{}if(c==="string")a={type:"string",value:h??""};else if(c==="int"||c==="float"||c==="bool"||c==="boolen"||c==="integer"||c==="double"){let b=h;c.startsWith("int")||c==="integer"?b=parseInt(h||"0",10):c==="float"||c==="double"?b=parseFloat(h||"0"):c.startsWith("bool")&&(b=h==="1"||h==="true"),a={type:"number",value:b}}else if(c==="array"||c==="object"){const b=d.$.classname||(c==="array"?"Array":"Object"),N=String(this.nextObjectId++),I=d.$.fullname||"";this.objectHandles.set(N,{type:"property",depth:0,contextId:0,fullname:I}),a={type:"object",objectId:N,className:b,description:b}}else c==="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,d=n.property?.property??n.property,c=[];if(d){const g=Array.isArray(d)?d:[d];for(const h of g){const b=h.$.name||h.$.fullname||"";let N=h.$.type||"undefined";const I=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(I){const w=h.$.classname||(N==="array"?"Array":"Object"),f=String(this.nextObjectId++),E=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.contextId||0,O=s.cdpMethod==="Runtime.getProperties"&&s.params?.parentObjectId&&this.objectHandles.get(s.params.parentObjectId)?.depth||0;this.objectHandles.set(f,{type:"property",depth:O,contextId:E,fullname:h.$.fullname||b}),c.push({name:h.$.key||b,value:{type:"object",className:w,description:w,objectId:f},writable:!1,configurable:!1,enumerable:!0})}else{let w,f;N==="string"?w=D??"":N==="int"||N==="integer"?w=parseInt(D||"0",10):N==="float"||N==="double"?w=parseFloat(D||"0"):N==="bool"||N==="boolean"?(w=D==="1"||D==="true",N="boolean"):N==="null"?(w=null,f="null"):w=D;const E={type:N==="integer"?"number":N};f&&(E.subtype=f),E.value=w,c.push({name:h.$.key||b,value:E,writable:!1,configurable:!1,enumerable:!0})}}}if(u){const g=(u.aggregatedProps||[]).concat(c),h=32;if(c.length===h){const N=(u.currentPage||0)+1,I={...u,currentPage:N,aggregatedProps:g};this.objectHandles.set(a,I);let y;if(o==="context_get"){const w=u.contextId??0;y=`context_get -d ${u.depth} -c ${w} -p ${N} -m ${h}`}else{const w=u.depth,f=u.fullname,E=this.formatPropertyFullName(f);y=`property_get -d ${w} -n ${E} -p ${N} -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 N={result:g};this.cdp.sendMessage({id:s.cdpId,result:N}),this.pendingCommands.delete(i)}}else{const g={result:c};this.cdp.sendMessage({id:s.cdpId,result:g}),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 c of a){const g=this.uriFromDBGPToBridge(c.$.filename),h=this.getOrCreateScriptId(g);this.scriptIdByUrl.has(g)||(this.scriptIdByUrl.set(g,h),await this.sendScriptToCDP(g,h))}for(const c of a){const g=parseInt(c.$.level,10),h=this.uriFromDBGPToBridge(c.$.filename),b=parseInt(c.$.lineno,10),N=c.$.where&&c.$.where!=="{main}"?c.$.where:"(anonymous)",I=`frame:${g}`;this.callFramesMap.set(I,g);const y=[],D=String(this.nextObjectId++);this.objectHandles.set(D,{type:"context",contextId:0,depth:g}),y.push({type:"local",object:{objectId:D,className:"Object",description:"Local"}});const w=String(this.nextObjectId++);this.objectHandles.set(w,{type:"context",contextId:1,depth:g}),y.push({type:"global",object:{objectId:w,className:"Object",description:"Global"}}),u.push({callFrameId:I,functionName:N,location:{scriptId:this.getOrCreateScriptId(h),lineNumber:b-1,columnNumber:0},scopeChain:y,this:{type:"object",className:"Object",description:"Object",objectId:w}})}let d="pause";if(a.length>0){const c=a[0];if(c.$.filename&&c.$.lineno){const g=this.uriFromDBGPToBridge(c.$.filename),h=parseInt(c.$.lineno,10);for(const b of this.breakpoints.values())if(b.fileUri===g&&b.lineNumber===h){d="breakpoint";break}}}this.cdp.sendMessage({method:"Debugger.paused",params:{reason:d,callFrames:u,hitBreakpoints:d==="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 Do(e){const t=e.cdpPort??9229,n=e.dbgpPort??9003,r=e.cdpHost??"localhost",o=e.phpRoot??process.cwd(),i=e.breakOnFirstLine??!1;ge.log("Starting XDebug Bridge...");const s=new ro(t);ge.log("Connect Chrome DevTools to CDP at:"),ge.log(`devtools://devtools/bundled/inspector.html?ws=${r}:${t}
90
+ `),await new Promise(g=>s.on("clientConnected",g)),await new Promise(g=>setTimeout(g,2e3)),ge.log("Chrome connected! Initializing Xdebug receiver...");const a=new io(n);ge.log(`XDebug receiver running on port ${n}`),ge.log("Running a PHP script with Xdebug enabled...");async function u(g){const h=[],b=e.phpInstance?await e.phpInstance.listFiles(g):di(g);for(const N of b){const I=oe.join(g,N);try{(e.phpInstance?await e.phpInstance.isDir(I):gi(I).isDirectory())?h.push(...await u(I)):N.endsWith(".php")&&h.push(I)}catch{}}return h}const d=e.phpInstance?g=>e.phpInstance.readFileAsText(g):e.getPHPFile?e.getPHPFile:g=>Kt(g,"utf-8"),c=await u(o);return new _o(a,s,{knownScriptUrls:c,phpRoot:o,getPHPFile:d,breakOnFirstLine:i})}let se=process.argv.slice(2);se.length||(se=["--help"]);const Se=e=>process.stdout.isTTY?"\x1B[1m"+e+"\x1B[0m":e,Or=e=>process.stdout.isTTY?`\x1B[3m${e}\x1B[0m`:e,So=e=>process.stdout.isTTY?`\x1B[33m${e}\x1B[0m`:e,oi=(import.meta||{}).url,Jt=new URL("ca-bundle.crt",oi).pathname;mi(Jt)||Ir(Jt,bi.join(`
91
+ `));se.unshift("-d",`openssl.cafile=${Jt}`);async function Mo(){const e=new URL("php.ini",oi).pathname,t=process.env.PHP||ai;if(!ui.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=wn(oe.join(En.tmpdir(),"php-wasm-bin"));Ir(`${a}/php`,`#!/bin/sh
92
92
  ${process.argv[0]} ${process.execArgv.join(" ")} ${process.argv[1]}
93
- `),hi(`${a}/php`,493);const u=yn(oe.join(bn.tmpdir(),"php-wasm-sys-tmp")),c=new si(await mi(t,{fileLockManager:new oi,emscriptenOptions:{processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},withXdebug:n??Cs({pathSkippings:["/dev/","/home/","/internal/","/request/","/proc/"]})}));if(c.setSpawnHandler((d,b)=>ai(d,b,{shell:!0,stdio:["pipe","pipe","pipe"]})),yi(c),n&&o)try{const d="PHP.wasm CLI - Listen for Xdebug",b=o;await Ss(d,process.cwd());const E=await Ms({name:d,host:"example.com",port:443,ides:b,cwd:process.cwd()}),v=b.includes("vscode"),m=b.includes("phpstorm"),D=Object.values(E);console.log(""),D.length>0?(console.log(Me("Xdebug configured successfully")),console.log(Io("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 "${Tr(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."),m&&console.log("")),m&&E.phpstorm&&(console.log(Me("PhpStorm instructions:")),console.log(` 1. Choose "${Tr(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 No({breakOnFirstLine:!0})).start(),se.some(d=>d.startsWith("-c"))||se.unshift("-c",e);const f=await c.cli(["php",...se]);f.stderr.pipeTo(new WritableStream({write(d){process.stderr.write(d)}})),f.stdout.pipeTo(new WritableStream({write(d){process.stdout.write(d)}})),await f.exitCode.catch(d=>{throw d.name==="ExitStatus"&&process.exit(d.status===void 0?1:d.status),d}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}Oo();
93
+ `),yi(`${a}/php`,493);const u=wn(oe.join(En.tmpdir(),"php-wasm-sys-tmp")),d=new ci(await Ei(t,{fileLockManager:new li,emscriptenOptions:{processId:1,ENV:{...s,TMPDIR:u,TERM:"xterm",PATH:`${a}:${s.PATH}`}},withXdebug:n??Vs({pathSkippings:["/dev/","/home/","/internal/","/request/","/proc/"]})}));if(d.setSpawnHandler((h,b)=>fi(h,b,{shell:!0,stdio:["pipe","pipe","pipe"]})),Ni(d),n&&o)try{const h="PHP.wasm CLI - Listen for Xdebug",b=o;await Us(h,process.cwd());const N=await $s({name:h,host:"example.com",port:443,ides:b,cwd:process.cwd()}),I=b.includes("vscode"),y=b.includes("phpstorm"),D=Object.values(N);console.log(""),D.length>0?(console.log(Se("Xdebug configured successfully")),console.log(So("Updated IDE config: ")+D.join(" "))):(console.log(Se("Xdebug configuration failed.")),console.log("No IDE-specific project settings directory was found in the current working directory.")),console.log(""),I&&N.vscode&&(console.log(Se("VS Code / Cursor instructions:")),console.log(" 1. Ensure you have installed an IDE extension for PHP Debugging"),console.log(` (The ${Se("PHP Debug")} extension by ${Se("Xdebug")} has been a solid option)`),console.log(" 2. Open the Run and Debug panel on the left sidebar"),console.log(` 3. Select "${Or(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&&N.phpstorm&&(console.log(Se("PhpStorm instructions:")),console.log(` 1. Choose "${Or(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 Do({breakOnFirstLine:!0})).start(),se.some(h=>h.startsWith("-c"))||se.unshift("-c",e);const g=await d.cli(["php",...se]);g.stderr.pipeTo(new WritableStream({write(h){process.stderr.write(h)}})),g.stdout.pipeTo(new WritableStream({write(h){process.stdout.write(h)}})),await g.exitCode.catch(h=>{throw h.name==="ExitStatus"&&process.exit(h.status===void 0?1:h.status),h}).finally(()=>{setTimeout(()=>{process.exit(0)},100)})}Mo();
94
94
  //# sourceMappingURL=main.js.map