From 3a1374a98a3349e740256c2881e289e4fc27b0c8 Mon Sep 17 00:00:00 2001 From: kzrnm Date: Thu, 2 Jan 2025 11:31:01 +0900 Subject: [PATCH] Use no `Condition` tag --- .../version_prefix_suffix_condition.xml | 9 +++++++ dist/index.js | 2 +- dist/index.js.map | 2 +- package.json | 4 +-- src/main.ts | 27 ++++++++++++------- 5 files changed, 30 insertions(+), 14 deletions(-) create mode 100644 __tests__/testdata/version_prefix_suffix_condition.xml diff --git a/__tests__/testdata/version_prefix_suffix_condition.xml b/__tests__/testdata/version_prefix_suffix_condition.xml new file mode 100644 index 0000000..1f3b46d --- /dev/null +++ b/__tests__/testdata/version_prefix_suffix_condition.xml @@ -0,0 +1,9 @@ + + + + 2.0.0 + + beta.1 + + + diff --git a/dist/index.js b/dist/index.js index 6922ef3..25a89cd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,2 +1,2 @@ -require('./sourcemap-register.js');(()=>{var e={109:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var o=Object.getOwnPropertyDescriptor(r,n);if(!o||("get"in o?!r.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,o)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.prototype.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};var s=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});const u=a(n(186));const l=n(147);const c=n(213);function put(e,r){u.info(`${e}: ${r}`);u.setOutput(e,r)}class DocumentWrapper{constructor(e){this.docElement=e}getLastText(e){const r=this.docElement.getElementsByTagName(e);return r.length>0?r[r.length-1].textContent:null}static createAsync(e){return s(this,void 0,void 0,(function*(){let r;try{r=yield l.promises.readFile(e,"utf-8")}catch(r){throw new Error(`no such file: '${e}'`)}const n=(new c.DOMParser).parseFromString(r,"text/xml");if(!(n===null||n===void 0?void 0:n.documentElement)){throw new Error(`failed to parse xml file: '${e}'`)}return new DocumentWrapper(n.documentElement)}))}}function run(){return s(this,void 0,void 0,(function*(){try{const e=u.getInput("proj-path");u.debug(`proj-path=${e}`);let r=false;const n=yield DocumentWrapper.createAsync(e);let i=n.getLastText("VersionPrefix");let o=n.getLastText("VersionSuffix");let a=n.getLastText("Version");if(a){r=true;const e=a.indexOf("-");if(e>=0){i=a.substr(0,e);o=a.substr(e+1)}else{i=a;o=""}}else{if(i){r=true}else{i="1.0.0"}if(o){r=true;a=`${i}-${o}`}else{a=i;o=""}}let s=n.getLastText("PackageVersion");if(s){r=true}else{s=a}let l=n.getLastText("AssemblyVersion");if(l){r=true}else{l=i}let c=n.getLastText("FileVersion");if(c){r=true}else{c=l}let d=n.getLastText("InformationalVersion");if(d){r=true}else{d=a}if(!r){throw new Error("Not found version tag")}put("version",a);put("version-prefix",i);put("version-suffix",o);put("package-version",s);put("assembly-version",l);put("file-version",c);put("informational-version",d)}catch(e){if(e instanceof Error){u.setFailed(e.message)}}}))}run()},351:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.issue=r.issueCommand=void 0;const s=a(n(37));const u=n(278);function issueCommand(e,r,n){const i=new Command(e,r,n);process.stdout.write(i.toString()+s.EOL)}r.issueCommand=issueCommand;function issue(e,r=""){issueCommand(e,{},r)}r.issue=issue;const l="::";class Command{constructor(e,r,n){if(!e){e="missing.command"}this.command=e;this.properties=r;this.message=n}toString(){let e=l+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let r=true;for(const n in this.properties){if(this.properties.hasOwnProperty(n)){const i=this.properties[n];if(i){if(r){r=false}else{e+=","}e+=`${n}=${escapeProperty(i)}`}}}}e+=`${l}${escapeData(this.message)}`;return e}}function escapeData(e){return u.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return u.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},186:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};var s=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.getIDToken=r.getState=r.saveState=r.group=r.endGroup=r.startGroup=r.info=r.notice=r.warning=r.error=r.debug=r.isDebug=r.setFailed=r.setCommandEcho=r.setOutput=r.getBooleanInput=r.getMultilineInput=r.getInput=r.addPath=r.setSecret=r.exportVariable=r.ExitCode=void 0;const u=n(351);const l=n(717);const c=n(278);const d=a(n(37));const f=a(n(17));const p=n(41);var h;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(h=r.ExitCode||(r.ExitCode={}));function exportVariable(e,r){const n=c.toCommandValue(r);process.env[e]=n;const i=process.env["GITHUB_ENV"]||"";if(i){return l.issueFileCommand("ENV",l.prepareKeyValueMessage(e,r))}u.issueCommand("set-env",{name:e},n)}r.exportVariable=exportVariable;function setSecret(e){u.issueCommand("add-mask",{},e)}r.setSecret=setSecret;function addPath(e){const r=process.env["GITHUB_PATH"]||"";if(r){l.issueFileCommand("PATH",e)}else{u.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${f.delimiter}${process.env["PATH"]}`}r.addPath=addPath;function getInput(e,r){const n=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(r&&r.required&&!n){throw new Error(`Input required and not supplied: ${e}`)}if(r&&r.trimWhitespace===false){return n}return n.trim()}r.getInput=getInput;function getMultilineInput(e,r){const n=getInput(e,r).split("\n").filter((e=>e!==""));if(r&&r.trimWhitespace===false){return n}return n.map((e=>e.trim()))}r.getMultilineInput=getMultilineInput;function getBooleanInput(e,r){const n=["true","True","TRUE"];const i=["false","False","FALSE"];const o=getInput(e,r);if(n.includes(o))return true;if(i.includes(o))return false;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e}\n`+`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}r.getBooleanInput=getBooleanInput;function setOutput(e,r){const n=process.env["GITHUB_OUTPUT"]||"";if(n){return l.issueFileCommand("OUTPUT",l.prepareKeyValueMessage(e,r))}process.stdout.write(d.EOL);u.issueCommand("set-output",{name:e},c.toCommandValue(r))}r.setOutput=setOutput;function setCommandEcho(e){u.issue("echo",e?"on":"off")}r.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=h.Failure;error(e)}r.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}r.isDebug=isDebug;function debug(e){u.issueCommand("debug",{},e)}r.debug=debug;function error(e,r={}){u.issueCommand("error",c.toCommandProperties(r),e instanceof Error?e.toString():e)}r.error=error;function warning(e,r={}){u.issueCommand("warning",c.toCommandProperties(r),e instanceof Error?e.toString():e)}r.warning=warning;function notice(e,r={}){u.issueCommand("notice",c.toCommandProperties(r),e instanceof Error?e.toString():e)}r.notice=notice;function info(e){process.stdout.write(e+d.EOL)}r.info=info;function startGroup(e){u.issue("group",e)}r.startGroup=startGroup;function endGroup(){u.issue("endgroup")}r.endGroup=endGroup;function group(e,r){return s(this,void 0,void 0,(function*(){startGroup(e);let n;try{n=yield r()}finally{endGroup()}return n}))}r.group=group;function saveState(e,r){const n=process.env["GITHUB_STATE"]||"";if(n){return l.issueFileCommand("STATE",l.prepareKeyValueMessage(e,r))}u.issueCommand("save-state",{name:e},c.toCommandValue(r))}r.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}r.getState=getState;function getIDToken(e){return s(this,void 0,void 0,(function*(){return yield p.OidcClient.getIDToken(e)}))}r.getIDToken=getIDToken;var m=n(327);Object.defineProperty(r,"summary",{enumerable:true,get:function(){return m.summary}});var v=n(327);Object.defineProperty(r,"markdownSummary",{enumerable:true,get:function(){return v.markdownSummary}});var g=n(981);Object.defineProperty(r,"toPosixPath",{enumerable:true,get:function(){return g.toPosixPath}});Object.defineProperty(r,"toWin32Path",{enumerable:true,get:function(){return g.toWin32Path}});Object.defineProperty(r,"toPlatformPath",{enumerable:true,get:function(){return g.toPlatformPath}})},717:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.prepareKeyValueMessage=r.issueFileCommand=void 0;const s=a(n(147));const u=a(n(37));const l=n(840);const c=n(278);function issueFileCommand(e,r){const n=process.env[`GITHUB_${e}`];if(!n){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!s.existsSync(n)){throw new Error(`Missing file at path: ${n}`)}s.appendFileSync(n,`${c.toCommandValue(r)}${u.EOL}`,{encoding:"utf8"})}r.issueFileCommand=issueFileCommand;function prepareKeyValueMessage(e,r){const n=`ghadelimiter_${l.v4()}`;const i=c.toCommandValue(r);if(e.includes(n)){throw new Error(`Unexpected input: name should not contain the delimiter "${n}"`)}if(i.includes(n)){throw new Error(`Unexpected input: value should not contain the delimiter "${n}"`)}return`${e}<<${n}${u.EOL}${i}${u.EOL}${n}`}r.prepareKeyValueMessage=prepareKeyValueMessage},41:function(e,r,n){"use strict";var i=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.OidcClient=void 0;const o=n(255);const a=n(526);const s=n(186);class OidcClient{static createHttpClient(e=true,r=10){const n={allowRetries:e,maxRetries:r};return new o.HttpClient("actions/oidc-client",[new a.BearerCredentialHandler(OidcClient.getRequestToken())],n)}static getRequestToken(){const e=process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];if(!e){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable")}return e}static getIDTokenUrl(){const e=process.env["ACTIONS_ID_TOKEN_REQUEST_URL"];if(!e){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable")}return e}static getCall(e){var r;return i(this,void 0,void 0,(function*(){const n=OidcClient.createHttpClient();const i=yield n.getJson(e).catch((e=>{throw new Error(`Failed to get ID Token. \n \n Error Code : ${e.statusCode}\n \n Error Message: ${e.message}`)}));const o=(r=i.result)===null||r===void 0?void 0:r.value;if(!o){throw new Error("Response json body do not have ID Token field")}return o}))}static getIDToken(e){return i(this,void 0,void 0,(function*(){try{let r=OidcClient.getIDTokenUrl();if(e){const n=encodeURIComponent(e);r=`${r}&audience=${n}`}s.debug(`ID token url is ${r}`);const n=yield OidcClient.getCall(r);s.setSecret(n);return n}catch(e){throw new Error(`Error message: ${e.message}`)}}))}}r.OidcClient=OidcClient},981:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.toPlatformPath=r.toWin32Path=r.toPosixPath=void 0;const s=a(n(17));function toPosixPath(e){return e.replace(/[\\]/g,"/")}r.toPosixPath=toPosixPath;function toWin32Path(e){return e.replace(/[/]/g,"\\")}r.toWin32Path=toWin32Path;function toPlatformPath(e){return e.replace(/[/\\]/g,s.sep)}r.toPlatformPath=toPlatformPath},327:function(e,r,n){"use strict";var i=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.summary=r.markdownSummary=r.SUMMARY_DOCS_URL=r.SUMMARY_ENV_VAR=void 0;const o=n(37);const a=n(147);const{access:s,appendFile:u,writeFile:l}=a.promises;r.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";r.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class Summary{constructor(){this._buffer=""}filePath(){return i(this,void 0,void 0,(function*(){if(this._filePath){return this._filePath}const e=process.env[r.SUMMARY_ENV_VAR];if(!e){throw new Error(`Unable to find environment variable for $${r.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`)}try{yield s(e,a.constants.R_OK|a.constants.W_OK)}catch(r){throw new Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}this._filePath=e;return this._filePath}))}wrap(e,r,n={}){const i=Object.entries(n).map((([e,r])=>` ${e}="${r}"`)).join("");if(!r){return`<${e}${i}>`}return`<${e}${i}>${r}`}write(e){return i(this,void 0,void 0,(function*(){const r=!!(e===null||e===void 0?void 0:e.overwrite);const n=yield this.filePath();const i=r?l:u;yield i(n,this._buffer,{encoding:"utf8"});return this.emptyBuffer()}))}clear(){return i(this,void 0,void 0,(function*(){return this.emptyBuffer().write({overwrite:true})}))}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){this._buffer="";return this}addRaw(e,r=false){this._buffer+=e;return r?this.addEOL():this}addEOL(){return this.addRaw(o.EOL)}addCodeBlock(e,r){const n=Object.assign({},r&&{lang:r});const i=this.wrap("pre",this.wrap("code",e),n);return this.addRaw(i).addEOL()}addList(e,r=false){const n=r?"ol":"ul";const i=e.map((e=>this.wrap("li",e))).join("");const o=this.wrap(n,i);return this.addRaw(o).addEOL()}addTable(e){const r=e.map((e=>{const r=e.map((e=>{if(typeof e==="string"){return this.wrap("td",e)}const{header:r,data:n,colspan:i,rowspan:o}=e;const a=r?"th":"td";const s=Object.assign(Object.assign({},i&&{colspan:i}),o&&{rowspan:o});return this.wrap(a,n,s)})).join("");return this.wrap("tr",r)})).join("");const n=this.wrap("table",r);return this.addRaw(n).addEOL()}addDetails(e,r){const n=this.wrap("details",this.wrap("summary",e)+r);return this.addRaw(n).addEOL()}addImage(e,r,n){const{width:i,height:o}=n||{};const a=Object.assign(Object.assign({},i&&{width:i}),o&&{height:o});const s=this.wrap("img",null,Object.assign({src:e,alt:r},a));return this.addRaw(s).addEOL()}addHeading(e,r){const n=`h${r}`;const i=["h1","h2","h3","h4","h5","h6"].includes(n)?n:"h1";const o=this.wrap(i,e);return this.addRaw(o).addEOL()}addSeparator(){const e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){const e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,r){const n=Object.assign({},r&&{cite:r});const i=this.wrap("blockquote",e,n);return this.addRaw(i).addEOL()}addLink(e,r){const n=this.wrap("a",e,{href:r});return this.addRaw(n).addEOL()}}const c=new Summary;r.markdownSummary=c;r.summary=c},278:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.toCommandProperties=r.toCommandValue=void 0;function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}r.toCommandValue=toCommandValue;function toCommandProperties(e){if(!Object.keys(e).length){return{}}return{title:e.title,file:e.file,line:e.startLine,endLine:e.endLine,col:e.startColumn,endColumn:e.endColumn}}r.toCommandProperties=toCommandProperties},526:function(e,r){"use strict";var n=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.PersonalAccessTokenCredentialHandler=r.BearerCredentialHandler=r.BasicCredentialHandler=void 0;class BasicCredentialHandler{constructor(e,r){this.username=e;this.password=r}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.BasicCredentialHandler=BasicCredentialHandler;class BearerCredentialHandler{constructor(e){this.token=e}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Bearer ${this.token}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.BearerCredentialHandler=BearerCredentialHandler;class PersonalAccessTokenCredentialHandler{constructor(e){this.token=e}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.PersonalAccessTokenCredentialHandler=PersonalAccessTokenCredentialHandler},255:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};var s=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.HttpClient=r.isHttps=r.HttpClientResponse=r.HttpClientError=r.getProxyUrl=r.MediaTypes=r.Headers=r.HttpCodes=void 0;const u=a(n(685));const l=a(n(687));const c=a(n(835));const d=a(n(294));var f;(function(e){e[e["OK"]=200]="OK";e[e["MultipleChoices"]=300]="MultipleChoices";e[e["MovedPermanently"]=301]="MovedPermanently";e[e["ResourceMoved"]=302]="ResourceMoved";e[e["SeeOther"]=303]="SeeOther";e[e["NotModified"]=304]="NotModified";e[e["UseProxy"]=305]="UseProxy";e[e["SwitchProxy"]=306]="SwitchProxy";e[e["TemporaryRedirect"]=307]="TemporaryRedirect";e[e["PermanentRedirect"]=308]="PermanentRedirect";e[e["BadRequest"]=400]="BadRequest";e[e["Unauthorized"]=401]="Unauthorized";e[e["PaymentRequired"]=402]="PaymentRequired";e[e["Forbidden"]=403]="Forbidden";e[e["NotFound"]=404]="NotFound";e[e["MethodNotAllowed"]=405]="MethodNotAllowed";e[e["NotAcceptable"]=406]="NotAcceptable";e[e["ProxyAuthenticationRequired"]=407]="ProxyAuthenticationRequired";e[e["RequestTimeout"]=408]="RequestTimeout";e[e["Conflict"]=409]="Conflict";e[e["Gone"]=410]="Gone";e[e["TooManyRequests"]=429]="TooManyRequests";e[e["InternalServerError"]=500]="InternalServerError";e[e["NotImplemented"]=501]="NotImplemented";e[e["BadGateway"]=502]="BadGateway";e[e["ServiceUnavailable"]=503]="ServiceUnavailable";e[e["GatewayTimeout"]=504]="GatewayTimeout"})(f=r.HttpCodes||(r.HttpCodes={}));var p;(function(e){e["Accept"]="accept";e["ContentType"]="content-type"})(p=r.Headers||(r.Headers={}));var h;(function(e){e["ApplicationJson"]="application/json"})(h=r.MediaTypes||(r.MediaTypes={}));function getProxyUrl(e){const r=c.getProxyUrl(new URL(e));return r?r.href:""}r.getProxyUrl=getProxyUrl;const m=[f.MovedPermanently,f.ResourceMoved,f.SeeOther,f.TemporaryRedirect,f.PermanentRedirect];const v=[f.BadGateway,f.ServiceUnavailable,f.GatewayTimeout];const g=["OPTIONS","GET","DELETE","HEAD"];const y=10;const _=5;class HttpClientError extends Error{constructor(e,r){super(e);this.name="HttpClientError";this.statusCode=r;Object.setPrototypeOf(this,HttpClientError.prototype)}}r.HttpClientError=HttpClientError;class HttpClientResponse{constructor(e){this.message=e}readBody(){return s(this,void 0,void 0,(function*(){return new Promise((e=>s(this,void 0,void 0,(function*(){let r=Buffer.alloc(0);this.message.on("data",(e=>{r=Buffer.concat([r,e])}));this.message.on("end",(()=>{e(r.toString())}))}))))}))}}r.HttpClientResponse=HttpClientResponse;function isHttps(e){const r=new URL(e);return r.protocol==="https:"}r.isHttps=isHttps;class HttpClient{constructor(e,r,n){this._ignoreSslError=false;this._allowRedirects=true;this._allowRedirectDowngrade=false;this._maxRedirects=50;this._allowRetries=false;this._maxRetries=1;this._keepAlive=false;this._disposed=false;this.userAgent=e;this.handlers=r||[];this.requestOptions=n;if(n){if(n.ignoreSslError!=null){this._ignoreSslError=n.ignoreSslError}this._socketTimeout=n.socketTimeout;if(n.allowRedirects!=null){this._allowRedirects=n.allowRedirects}if(n.allowRedirectDowngrade!=null){this._allowRedirectDowngrade=n.allowRedirectDowngrade}if(n.maxRedirects!=null){this._maxRedirects=Math.max(n.maxRedirects,0)}if(n.keepAlive!=null){this._keepAlive=n.keepAlive}if(n.allowRetries!=null){this._allowRetries=n.allowRetries}if(n.maxRetries!=null){this._maxRetries=n.maxRetries}}}options(e,r){return s(this,void 0,void 0,(function*(){return this.request("OPTIONS",e,null,r||{})}))}get(e,r){return s(this,void 0,void 0,(function*(){return this.request("GET",e,null,r||{})}))}del(e,r){return s(this,void 0,void 0,(function*(){return this.request("DELETE",e,null,r||{})}))}post(e,r,n){return s(this,void 0,void 0,(function*(){return this.request("POST",e,r,n||{})}))}patch(e,r,n){return s(this,void 0,void 0,(function*(){return this.request("PATCH",e,r,n||{})}))}put(e,r,n){return s(this,void 0,void 0,(function*(){return this.request("PUT",e,r,n||{})}))}head(e,r){return s(this,void 0,void 0,(function*(){return this.request("HEAD",e,null,r||{})}))}sendStream(e,r,n,i){return s(this,void 0,void 0,(function*(){return this.request(e,r,n,i)}))}getJson(e,r={}){return s(this,void 0,void 0,(function*(){r[p.Accept]=this._getExistingOrDefaultHeader(r,p.Accept,h.ApplicationJson);const n=yield this.get(e,r);return this._processResponse(n,this.requestOptions)}))}postJson(e,r,n={}){return s(this,void 0,void 0,(function*(){const i=JSON.stringify(r,null,2);n[p.Accept]=this._getExistingOrDefaultHeader(n,p.Accept,h.ApplicationJson);n[p.ContentType]=this._getExistingOrDefaultHeader(n,p.ContentType,h.ApplicationJson);const o=yield this.post(e,i,n);return this._processResponse(o,this.requestOptions)}))}putJson(e,r,n={}){return s(this,void 0,void 0,(function*(){const i=JSON.stringify(r,null,2);n[p.Accept]=this._getExistingOrDefaultHeader(n,p.Accept,h.ApplicationJson);n[p.ContentType]=this._getExistingOrDefaultHeader(n,p.ContentType,h.ApplicationJson);const o=yield this.put(e,i,n);return this._processResponse(o,this.requestOptions)}))}patchJson(e,r,n={}){return s(this,void 0,void 0,(function*(){const i=JSON.stringify(r,null,2);n[p.Accept]=this._getExistingOrDefaultHeader(n,p.Accept,h.ApplicationJson);n[p.ContentType]=this._getExistingOrDefaultHeader(n,p.ContentType,h.ApplicationJson);const o=yield this.patch(e,i,n);return this._processResponse(o,this.requestOptions)}))}request(e,r,n,i){return s(this,void 0,void 0,(function*(){if(this._disposed){throw new Error("Client has already been disposed.")}const o=new URL(r);let a=this._prepareRequest(e,o,i);const s=this._allowRetries&&g.includes(e)?this._maxRetries+1:1;let u=0;let l;do{l=yield this.requestRaw(a,n);if(l&&l.message&&l.message.statusCode===f.Unauthorized){let e;for(const r of this.handlers){if(r.canHandleAuthentication(l)){e=r;break}}if(e){return e.handleAuthentication(this,a,n)}else{return l}}let r=this._maxRedirects;while(l.message.statusCode&&m.includes(l.message.statusCode)&&this._allowRedirects&&r>0){const s=l.message.headers["location"];if(!s){break}const u=new URL(s);if(o.protocol==="https:"&&o.protocol!==u.protocol&&!this._allowRedirectDowngrade){throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.")}yield l.readBody();if(u.hostname!==o.hostname){for(const e in i){if(e.toLowerCase()==="authorization"){delete i[e]}}}a=this._prepareRequest(e,u,i);l=yield this.requestRaw(a,n);r--}if(!l.message.statusCode||!v.includes(l.message.statusCode)){return l}u+=1;if(u{function callbackForResult(e,r){if(e){i(e)}else if(!r){i(new Error("Unknown error"))}else{n(r)}}this.requestRawWithCallback(e,r,callbackForResult)}))}))}requestRawWithCallback(e,r,n){if(typeof r==="string"){if(!e.options.headers){e.options.headers={}}e.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8")}let i=false;function handleResult(e,r){if(!i){i=true;n(e,r)}}const o=e.httpModule.request(e.options,(e=>{const r=new HttpClientResponse(e);handleResult(undefined,r)}));let a;o.on("socket",(e=>{a=e}));o.setTimeout(this._socketTimeout||3*6e4,(()=>{if(a){a.end()}handleResult(new Error(`Request timeout: ${e.options.path}`))}));o.on("error",(function(e){handleResult(e)}));if(r&&typeof r==="string"){o.write(r,"utf8")}if(r&&typeof r!=="string"){r.on("close",(function(){o.end()}));r.pipe(o)}else{o.end()}}getAgent(e){const r=new URL(e);return this._getAgent(r)}_prepareRequest(e,r,n){const i={};i.parsedUrl=r;const o=i.parsedUrl.protocol==="https:";i.httpModule=o?l:u;const a=o?443:80;i.options={};i.options.host=i.parsedUrl.hostname;i.options.port=i.parsedUrl.port?parseInt(i.parsedUrl.port):a;i.options.path=(i.parsedUrl.pathname||"")+(i.parsedUrl.search||"");i.options.method=e;i.options.headers=this._mergeHeaders(n);if(this.userAgent!=null){i.options.headers["user-agent"]=this.userAgent}i.options.agent=this._getAgent(i.parsedUrl);if(this.handlers){for(const e of this.handlers){e.prepareRequest(i.options)}}return i}_mergeHeaders(e){if(this.requestOptions&&this.requestOptions.headers){return Object.assign({},lowercaseKeys(this.requestOptions.headers),lowercaseKeys(e||{}))}return lowercaseKeys(e||{})}_getExistingOrDefaultHeader(e,r,n){let i;if(this.requestOptions&&this.requestOptions.headers){i=lowercaseKeys(this.requestOptions.headers)[r]}return e[r]||i||n}_getAgent(e){let r;const n=c.getProxyUrl(e);const i=n&&n.hostname;if(this._keepAlive&&i){r=this._proxyAgent}if(this._keepAlive&&!i){r=this._agent}if(r){return r}const o=e.protocol==="https:";let a=100;if(this.requestOptions){a=this.requestOptions.maxSockets||u.globalAgent.maxSockets}if(n&&n.hostname){const e={maxSockets:a,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})};let i;const s=n.protocol==="https:";if(o){i=s?d.httpsOverHttps:d.httpsOverHttp}else{i=s?d.httpOverHttps:d.httpOverHttp}r=i(e);this._proxyAgent=r}if(this._keepAlive&&!r){const e={keepAlive:this._keepAlive,maxSockets:a};r=o?new l.Agent(e):new u.Agent(e);this._agent=r}if(!r){r=o?l.globalAgent:u.globalAgent}if(o&&this._ignoreSslError){r.options=Object.assign(r.options||{},{rejectUnauthorized:false})}return r}_performExponentialBackoff(e){return s(this,void 0,void 0,(function*(){e=Math.min(y,e);const r=_*Math.pow(2,e);return new Promise((e=>setTimeout((()=>e()),r)))}))}_processResponse(e,r){return s(this,void 0,void 0,(function*(){return new Promise(((n,i)=>s(this,void 0,void 0,(function*(){const o=e.message.statusCode||0;const a={statusCode:o,result:null,headers:{}};if(o===f.NotFound){n(a)}function dateTimeDeserializer(e,r){if(typeof r==="string"){const e=new Date(r);if(!isNaN(e.valueOf())){return e}}return r}let s;let u;try{u=yield e.readBody();if(u&&u.length>0){if(r&&r.deserializeDates){s=JSON.parse(u,dateTimeDeserializer)}else{s=JSON.parse(u)}a.result=s}a.headers=e.message.headers}catch(e){}if(o>299){let e;if(s&&s.message){e=s.message}else if(u&&u.length>0){e=u}else{e=`Failed request: (${o})`}const r=new HttpClientError(e,o);r.result=a.result;i(r)}else{n(a)}}))))}))}}r.HttpClient=HttpClient;const lowercaseKeys=e=>Object.keys(e).reduce(((r,n)=>(r[n.toLowerCase()]=e[n],r)),{})},835:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.checkBypass=r.getProxyUrl=void 0;function getProxyUrl(e){const r=e.protocol==="https:";if(checkBypass(e)){return undefined}const n=(()=>{if(r){return process.env["https_proxy"]||process.env["HTTPS_PROXY"]}else{return process.env["http_proxy"]||process.env["HTTP_PROXY"]}})();if(n){return new URL(n)}else{return undefined}}r.getProxyUrl=getProxyUrl;function checkBypass(e){if(!e.hostname){return false}const r=process.env["no_proxy"]||process.env["NO_PROXY"]||"";if(!r){return false}let n;if(e.port){n=Number(e.port)}else if(e.protocol==="http:"){n=80}else if(e.protocol==="https:"){n=443}const i=[e.hostname.toUpperCase()];if(typeof n==="number"){i.push(`${i[0]}:${n}`)}for(const e of r.split(",").map((e=>e.trim().toUpperCase())).filter((e=>e))){if(i.some((r=>r===e))){return true}}return false}r.checkBypass=checkBypass},756:(e,r)=>{"use strict";function find(e,r,n){if(n===undefined){n=Array.prototype}if(e&&typeof n.find==="function"){return n.find.call(e,r)}for(var i=0;i{var i;var o=n(756);var a=n(389);var s=n(508);var u=n(58);var l=a.DOMImplementation;var c=o.NAMESPACE;var d=u.ParseError;var f=u.XMLReader;function normalizeLineEndings(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function DOMParser(e){this.options=e||{locator:{}}}DOMParser.prototype.parseFromString=function(e,r){var n=this.options;var i=new f;var o=n.domBuilder||new DOMHandler;var a=n.errorHandler;var u=n.locator;var l=n.xmlns||{};var d=/\/x?html?$/.test(r);var p=d?s.HTML_ENTITIES:s.XML_ENTITIES;if(u){o.setDocumentLocator(u)}i.errorHandler=buildErrorHandler(a,o,u);i.domBuilder=n.domBuilder||o;if(d){l[""]=c.HTML}l.xml=l.xml||c.XML;var h=n.normalizeLineEndings||normalizeLineEndings;if(e&&typeof e==="string"){i.parse(h(e),l,p)}else{i.errorHandler.error("invalid doc source")}return o.doc};function buildErrorHandler(e,r,n){if(!e){if(r instanceof DOMHandler){return r}e=r}var i={};var o=e instanceof Function;n=n||{};function build(r){var a=e[r];if(!a&&o){a=e.length==2?function(n){e(r,n)}:e}i[r]=a&&function(e){a("[xmldom "+r+"]\t"+e+_locator(n))}||function(){}}build("warning");build("error");build("fatalError");return i}function DOMHandler(){this.cdata=false}function position(e,r){r.lineNumber=e.lineNumber;r.columnNumber=e.columnNumber}DOMHandler.prototype={startDocument:function(){this.doc=(new l).createDocument(null,null,null);if(this.locator){this.doc.documentURI=this.locator.systemId}},startElement:function(e,r,n,i){var o=this.doc;var a=o.createElementNS(e,n||r);var s=i.length;appendElement(this,a);this.currentElement=a;this.locator&&position(this.locator,a);for(var u=0;u=r+n||r){return new java.lang.String(e,r,n)+""}return e}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){DOMHandler.prototype[e]=function(){return null}}));function appendElement(e,r){if(!e.currentElement){e.doc.appendChild(r)}else{e.currentElement.appendChild(r)}}i=DOMHandler;i=normalizeLineEndings;r.DOMParser=DOMParser},389:(e,r,n)=>{var i=n(756);var o=i.find;var a=i.NAMESPACE;function notEmptyString(e){return e!==""}function splitOnASCIIWhitespace(e){return e?e.split(/[\t\n\f\r ]+/).filter(notEmptyString):[]}function orderedSetReducer(e,r){if(!e.hasOwnProperty(r)){e[r]=true}return e}function toOrderedSet(e){if(!e)return[];var r=splitOnASCIIWhitespace(e);return Object.keys(r.reduce(orderedSetReducer,{}))}function arrayIncludes(e){return function(r){return e&&e.indexOf(r)!==-1}}function copy(e,r){for(var n in e){if(Object.prototype.hasOwnProperty.call(e,n)){r[n]=e[n]}}}function _extends(e,r){var n=e.prototype;if(!(n instanceof r)){function t(){}t.prototype=r.prototype;t=new t;copy(n,t);e.prototype=n=t}if(n.constructor!=e){if(typeof e!="function"){console.error("unknown Class:"+e)}n.constructor=e}}var s={};var u=s.ELEMENT_NODE=1;var l=s.ATTRIBUTE_NODE=2;var c=s.TEXT_NODE=3;var d=s.CDATA_SECTION_NODE=4;var f=s.ENTITY_REFERENCE_NODE=5;var p=s.ENTITY_NODE=6;var h=s.PROCESSING_INSTRUCTION_NODE=7;var m=s.COMMENT_NODE=8;var v=s.DOCUMENT_NODE=9;var g=s.DOCUMENT_TYPE_NODE=10;var y=s.DOCUMENT_FRAGMENT_NODE=11;var _=s.NOTATION_NODE=12;var N={};var E={};var w=N.INDEX_SIZE_ERR=(E[1]="Index size error",1);var b=N.DOMSTRING_SIZE_ERR=(E[2]="DOMString size error",2);var O=N.HIERARCHY_REQUEST_ERR=(E[3]="Hierarchy request error",3);var T=N.WRONG_DOCUMENT_ERR=(E[4]="Wrong document",4);var D=N.INVALID_CHARACTER_ERR=(E[5]="Invalid character",5);var x=N.NO_DATA_ALLOWED_ERR=(E[6]="No data allowed",6);var C=N.NO_MODIFICATION_ALLOWED_ERR=(E[7]="No modification allowed",7);var S=N.NOT_FOUND_ERR=(E[8]="Not found",8);var R=N.NOT_SUPPORTED_ERR=(E[9]="Not supported",9);var A=N.INUSE_ATTRIBUTE_ERR=(E[10]="Attribute in use",10);var P=N.INVALID_STATE_ERR=(E[11]="Invalid state",11);var M=N.SYNTAX_ERR=(E[12]="Syntax error",12);var I=N.INVALID_MODIFICATION_ERR=(E[13]="Invalid modification",13);var L=N.NAMESPACE_ERR=(E[14]="Invalid namespace",14);var q=N.INVALID_ACCESS_ERR=(E[15]="Invalid access",15);function DOMException(e,r){if(r instanceof Error){var n=r}else{n=this;Error.call(this,E[e]);this.message=E[e];if(Error.captureStackTrace)Error.captureStackTrace(this,DOMException)}n.code=e;if(r)this.message=this.message+": "+r;return n}DOMException.prototype=Error.prototype;copy(N,DOMException);function NodeList(){}NodeList.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,r){for(var n=[],i=0;i=0){var o=r.length-1;while(i0},lookupPrefix:function(e){var r=this;while(r){var n=r._nsMap;if(n){for(var i in n){if(Object.prototype.hasOwnProperty.call(n,i)&&n[i]===e){return i}}}r=r.nodeType==l?r.ownerDocument:r.parentNode}return null},lookupNamespaceURI:function(e){var r=this;while(r){var n=r._nsMap;if(n){if(Object.prototype.hasOwnProperty.call(n,e)){return n[e]}}r=r.nodeType==l?r.ownerDocument:r.parentNode}return null},isDefaultNamespace:function(e){var r=this.lookupPrefix(e);return r==null}};function _xmlEncoder(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}copy(s,Node);copy(s,Node.prototype);function _visitNode(e,r){if(r(e)){return true}if(e=e.firstChild){do{if(_visitNode(e,r)){return true}}while(e=e.nextSibling)}}function Document(){this.ownerDocument=this}function _onAddAttribute(e,r,n){e&&e._inc++;var i=n.namespaceURI;if(i===a.XMLNS){r._nsMap[n.prefix?n.localName:""]=n.value}}function _onRemoveAttribute(e,r,n,i){e&&e._inc++;var o=n.namespaceURI;if(o===a.XMLNS){delete r._nsMap[n.prefix?n.localName:""]}}function _onUpdateChild(e,r,n){if(e&&e._inc){e._inc++;var i=r.childNodes;if(n){i[i.length++]=n}else{var o=r.firstChild;var a=0;while(o){i[a++]=o;o=o.nextSibling}i.length=a;delete i[i.length]}}}function _removeChild(e,r){var n=r.previousSibling;var i=r.nextSibling;if(n){n.nextSibling=i}else{e.firstChild=i}if(i){i.previousSibling=n}else{e.lastChild=n}r.parentNode=null;r.previousSibling=null;r.nextSibling=null;_onUpdateChild(e.ownerDocument,e);return r}function hasValidParentNodeType(e){return e&&(e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE||e.nodeType===Node.ELEMENT_NODE)}function hasInsertableNodeType(e){return e&&(isElementNode(e)||isTextNode(e)||isDocTypeNode(e)||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE||e.nodeType===Node.COMMENT_NODE||e.nodeType===Node.PROCESSING_INSTRUCTION_NODE)}function isDocTypeNode(e){return e&&e.nodeType===Node.DOCUMENT_TYPE_NODE}function isElementNode(e){return e&&e.nodeType===Node.ELEMENT_NODE}function isTextNode(e){return e&&e.nodeType===Node.TEXT_NODE}function isElementInsertionPossible(e,r){var n=e.childNodes||[];if(o(n,isElementNode)||isDocTypeNode(r)){return false}var i=o(n,isDocTypeNode);return!(r&&i&&n.indexOf(i)>n.indexOf(r))}function isElementReplacementPossible(e,r){var n=e.childNodes||[];function hasElementChildThatIsNotChild(e){return isElementNode(e)&&e!==r}if(o(n,hasElementChildThatIsNotChild)){return false}var i=o(n,isDocTypeNode);return!(r&&i&&n.indexOf(i)>n.indexOf(r))}function assertPreInsertionValidity1to5(e,r,n){if(!hasValidParentNodeType(e)){throw new DOMException(O,"Unexpected parent node type "+e.nodeType)}if(n&&n.parentNode!==e){throw new DOMException(S,"child not in parent")}if(!hasInsertableNodeType(r)||isDocTypeNode(r)&&e.nodeType!==Node.DOCUMENT_NODE){throw new DOMException(O,"Unexpected node type "+r.nodeType+" for parent node type "+e.nodeType)}}function assertPreInsertionValidityInDocument(e,r,n){var i=e.childNodes||[];var a=r.childNodes||[];if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var s=a.filter(isElementNode);if(s.length>1||o(a,isTextNode)){throw new DOMException(O,"More than one element or text in fragment")}if(s.length===1&&!isElementInsertionPossible(e,n)){throw new DOMException(O,"Element in fragment can not be inserted before doctype")}}if(isElementNode(r)){if(!isElementInsertionPossible(e,n)){throw new DOMException(O,"Only one element can be added and only after doctype")}}if(isDocTypeNode(r)){if(o(i,isDocTypeNode)){throw new DOMException(O,"Only one doctype is allowed")}var u=o(i,isElementNode);if(n&&i.indexOf(u)1||o(a,isTextNode)){throw new DOMException(O,"More than one element or text in fragment")}if(s.length===1&&!isElementReplacementPossible(e,n)){throw new DOMException(O,"Element in fragment can not be inserted before doctype")}}if(isElementNode(r)){if(!isElementReplacementPossible(e,n)){throw new DOMException(O,"Only one element can be added and only after doctype")}}if(isDocTypeNode(r)){function hasDoctypeChildThatIsNotChild(e){return isDocTypeNode(e)&&e!==n}if(o(i,hasDoctypeChildThatIsNotChild)){throw new DOMException(O,"Only one doctype is allowed")}var u=o(i,isElementNode);if(n&&i.indexOf(u)0){_visitNode(n.documentElement,(function(o){if(o!==n&&o.nodeType===u){var a=o.getAttribute("class");if(a){var s=e===a;if(!s){var l=toOrderedSet(a);s=r.every(arrayIncludes(l))}if(s){i.push(o)}}}}))}return i}))},createElement:function(e){var r=new Element;r.ownerDocument=this;r.nodeName=e;r.tagName=e;r.localName=e;r.childNodes=new NodeList;var n=r.attributes=new NamedNodeMap;n._ownerElement=r;return r},createDocumentFragment:function(){var e=new DocumentFragment;e.ownerDocument=this;e.childNodes=new NodeList;return e},createTextNode:function(e){var r=new Text;r.ownerDocument=this;r.appendData(e);return r},createComment:function(e){var r=new Comment;r.ownerDocument=this;r.appendData(e);return r},createCDATASection:function(e){var r=new CDATASection;r.ownerDocument=this;r.appendData(e);return r},createProcessingInstruction:function(e,r){var n=new ProcessingInstruction;n.ownerDocument=this;n.tagName=n.target=e;n.nodeValue=n.data=r;return n},createAttribute:function(e){var r=new Attr;r.ownerDocument=this;r.name=e;r.nodeName=e;r.localName=e;r.specified=true;return r},createEntityReference:function(e){var r=new EntityReference;r.ownerDocument=this;r.nodeName=e;return r},createElementNS:function(e,r){var n=new Element;var i=r.split(":");var o=n.attributes=new NamedNodeMap;n.childNodes=new NodeList;n.ownerDocument=this;n.nodeName=r;n.tagName=r;n.namespaceURI=e;if(i.length==2){n.prefix=i[0];n.localName=i[1]}else{n.localName=r}o._ownerElement=n;return n},createAttributeNS:function(e,r){var n=new Attr;var i=r.split(":");n.ownerDocument=this;n.nodeName=r;n.name=r;n.namespaceURI=e;n.specified=true;if(i.length==2){n.prefix=i[0];n.localName=i[1]}else{n.localName=r}return n}};_extends(Document,Node);function Element(){this._nsMap={}}Element.prototype={nodeType:u,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var r=this.getAttributeNode(e);return r&&r.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,r){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+r;this.setAttributeNode(n)},removeAttribute:function(e){var r=this.getAttributeNode(e);r&&this.removeAttributeNode(r)},appendChild:function(e){if(e.nodeType===y){return this.insertBefore(e,null)}else{return _appendSingleChild(this,e)}},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,r){var n=this.getAttributeNodeNS(e,r);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,r){return this.getAttributeNodeNS(e,r)!=null},getAttributeNS:function(e,r){var n=this.getAttributeNodeNS(e,r);return n&&n.value||""},setAttributeNS:function(e,r,n){var i=this.ownerDocument.createAttributeNS(e,r);i.value=i.nodeValue=""+n;this.setAttributeNode(i)},getAttributeNodeNS:function(e,r){return this.attributes.getNamedItemNS(e,r)},getElementsByTagName:function(e){return new LiveNodeList(this,(function(r){var n=[];_visitNode(r,(function(i){if(i!==r&&i.nodeType==u&&(e==="*"||i.tagName==e)){n.push(i)}}));return n}))},getElementsByTagNameNS:function(e,r){return new LiveNodeList(this,(function(n){var i=[];_visitNode(n,(function(o){if(o!==n&&o.nodeType===u&&(e==="*"||o.namespaceURI===e)&&(r==="*"||o.localName==r)){i.push(o)}}));return i}))}};Document.prototype.getElementsByTagName=Element.prototype.getElementsByTagName;Document.prototype.getElementsByTagNameNS=Element.prototype.getElementsByTagNameNS;_extends(Element,Node);function Attr(){}Attr.prototype.nodeType=l;_extends(Attr,Node);function CharacterData(){}CharacterData.prototype={data:"",substringData:function(e,r){return this.data.substring(e,e+r)},appendData:function(e){e=this.data+e;this.nodeValue=this.data=e;this.length=e.length},insertData:function(e,r){this.replaceData(e,0,r)},appendChild:function(e){throw new Error(E[O])},deleteData:function(e,r){this.replaceData(e,r,"")},replaceData:function(e,r,n){var i=this.data.substring(0,e);var o=this.data.substring(e+r);n=i+n+o;this.nodeValue=this.data=n;this.length=n.length}};_extends(CharacterData,Node);function Text(){}Text.prototype={nodeName:"#text",nodeType:c,splitText:function(e){var r=this.data;var n=r.substring(e);r=r.substring(0,e);this.data=this.nodeValue=r;this.length=r.length;var i=this.ownerDocument.createTextNode(n);if(this.parentNode){this.parentNode.insertBefore(i,this.nextSibling)}return i}};_extends(Text,CharacterData);function Comment(){}Comment.prototype={nodeName:"#comment",nodeType:m};_extends(Comment,CharacterData);function CDATASection(){}CDATASection.prototype={nodeName:"#cdata-section",nodeType:d};_extends(CDATASection,CharacterData);function DocumentType(){}DocumentType.prototype.nodeType=g;_extends(DocumentType,Node);function Notation(){}Notation.prototype.nodeType=_;_extends(Notation,Node);function Entity(){}Entity.prototype.nodeType=p;_extends(Entity,Node);function EntityReference(){}EntityReference.prototype.nodeType=f;_extends(EntityReference,Node);function DocumentFragment(){}DocumentFragment.prototype.nodeName="#document-fragment";DocumentFragment.prototype.nodeType=y;_extends(DocumentFragment,Node);function ProcessingInstruction(){}ProcessingInstruction.prototype.nodeType=h;_extends(ProcessingInstruction,Node);function XMLSerializer(){}XMLSerializer.prototype.serializeToString=function(e,r,n){return nodeSerializeToString.call(e,r,n)};Node.prototype.toString=nodeSerializeToString;function nodeSerializeToString(e,r){var n=[];var i=this.nodeType==9&&this.documentElement||this;var o=i.prefix;var a=i.namespaceURI;if(a&&o==null){var o=i.lookupPrefix(a);if(o==null){var s=[{namespace:a,prefix:null}]}}serializeToString(this,n,e,r,s);return n.join("")}function needNamespaceDefine(e,r,n){var i=e.prefix||"";var o=e.namespaceURI;if(!o){return false}if(i==="xml"&&o===a.XML||o===a.XMLNS){return false}var s=n.length;while(s--){var u=n[s];if(u.prefix===i){return u.namespace!==o}}return true}function addSerializedAttribute(e,r,n){e.push(" ",r,'="',n.replace(/[<>&"\t\n\r]/g,_xmlEncoder),'"')}function serializeToString(e,r,n,i,o){if(!o){o=[]}if(i){e=i(e);if(e){if(typeof e=="string"){r.push(e);return}}else{return}}switch(e.nodeType){case u:var s=e.attributes;var p=s.length;var _=e.firstChild;var N=e.tagName;n=a.isHTML(e.namespaceURI)||n;var E=N;if(!n&&!e.prefix&&e.namespaceURI){var w;for(var b=0;b=0;O--){var T=o[O];if(T.prefix===""&&T.namespace===e.namespaceURI){w=T.namespace;break}}}if(w!==e.namespaceURI){for(var O=o.length-1;O>=0;O--){var T=o[O];if(T.namespace===e.namespaceURI){if(T.prefix){E=T.prefix+":"+N}break}}}}r.push("<",E);for(var D=0;D");if(n&&/^script$/i.test(N)){while(_){if(_.data){r.push(_.data)}else{serializeToString(_,r,n,i,o.slice())}_=_.nextSibling}}else{while(_){serializeToString(_,r,n,i,o.slice());_=_.nextSibling}}r.push("")}else{r.push("/>")}return;case v:case y:var _=e.firstChild;while(_){serializeToString(_,r,n,i,o.slice());_=_.nextSibling}return;case l:return addSerializedAttribute(r,e.name,e.value);case c:return r.push(e.data.replace(/[<&>]/g,_xmlEncoder));case d:return r.push("");case m:return r.push("\x3c!--",e.data,"--\x3e");case g:var R=e.publicId;var A=e.systemId;r.push("")}else if(A&&A!="."){r.push(" SYSTEM ",A,">")}else{var P=e.internalSubset;if(P){r.push(" [",P,"]")}r.push(">")}return;case h:return r.push("");case f:return r.push("&",e.nodeName,";");default:r.push("??",e.nodeName)}}function importNode(e,r,n){var i;switch(r.nodeType){case u:i=r.cloneNode(false);i.ownerDocument=e;case y:break;case l:n=true;break}if(!i){i=r.cloneNode(false)}i.ownerDocument=e;i.parentNode=null;if(n){var o=r.firstChild;while(o){i.appendChild(importNode(e,o,n));o=o.nextSibling}}return i}function cloneNode(e,r,n){var i=new r.constructor;for(var o in r){if(Object.prototype.hasOwnProperty.call(r,o)){var a=r[o];if(typeof a!="object"){if(a!=i[o]){i[o]=a}}}}if(r.childNodes){i.childNodes=new NodeList}i.ownerDocument=e;switch(i.nodeType){case u:var s=r.attributes;var c=i.attributes=new NamedNodeMap;var d=s.length;c._ownerElement=i;for(var f=0;f{var i=n(756).freeze;r.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});r.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"});r.entityMap=r.HTML_ENTITIES},213:(e,r,n)=>{var i=n(389);r.DOMImplementation=i.DOMImplementation;r.XMLSerializer=i.XMLSerializer;r.DOMParser=n(72).DOMParser},58:(e,r,n)=>{var i=n(756).NAMESPACE;var o=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var a=new RegExp("[\\-\\.0-9"+o.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");var s=new RegExp("^"+o.source+a.source+"*(?::"+o.source+a.source+"*)?$");var u=0;var l=1;var c=2;var d=3;var f=4;var p=5;var h=6;var m=7;function ParseError(e,r){this.message=e;this.locator=r;if(Error.captureStackTrace)Error.captureStackTrace(this,ParseError)}ParseError.prototype=new Error;ParseError.prototype.name=ParseError.name;function XMLReader(){}XMLReader.prototype={parse:function(e,r,n){var i=this.domBuilder;i.startDocument();_copy(r,r={});parse(e,r,n,i,this.errorHandler);i.endDocument()}};function parse(e,r,n,o,a){function fixedFromCharCode(e){if(e>65535){e-=65536;var r=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(r,n)}else{return String.fromCharCode(e)}}function entityReplacer(e){var r=e.slice(1,-1);if(Object.hasOwnProperty.call(n,r)){return n[r]}else if(r.charAt(0)==="#"){return fixedFromCharCode(parseInt(r.substr(1).replace("x","0x")))}else{a.error("entity not found:"+e);return e}}function appendText(r){if(r>p){var n=e.substring(p,r).replace(/&#?\w+;/g,entityReplacer);c&&position(p);o.characters(n,0,r-p);p=r}}function position(r,n){while(r>=u&&(n=l.exec(e))){s=n.index;u=s+n[0].length;c.lineNumber++}c.columnNumber=r-s+1}var s=0;var u=0;var l=/.*(?:\r\n?|\n)|.*$/g;var c=o.locator;var d=[{currentNSMap:r}];var f={};var p=0;while(true){try{var h=e.indexOf("<",p);if(h<0){if(!e.substr(p).match(/^\s*$/)){var m=o.doc;var v=m.createTextNode(e.substr(p));m.appendChild(v);o.currentElement=v}return}if(h>p){appendText(h)}switch(e.charAt(h+1)){case"/":var g=e.indexOf(">",h+3);var y=e.substring(h+2,g).replace(/[ \t\n\r]+$/g,"");var _=d.pop();if(g<0){y=e.substring(h+2).replace(/[\s<].*/,"");a.error("end tag name: "+y+" is not complete:"+_.tagName);g=h+1+y.length}else if(y.match(/\sp){p=g}else{appendText(Math.max(h,p)+1)}}}function copyLocator(e,r){r.lineNumber=e.lineNumber;r.columnNumber=e.columnNumber;return r}function parseElementStartPart(e,r,n,o,a,s){function addAttribute(e,r,i){if(n.attributeNames.hasOwnProperty(e)){s.fatalError("Attribute "+e+" redefined")}n.addValue(e,r.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),i)}var v;var g;var y=++r;var _=u;while(true){var N=e.charAt(y);switch(N){case"=":if(_===l){v=e.slice(r,y);_=d}else if(_===c){_=d}else{throw new Error("attribute equal must after attrName")}break;case"'":case'"':if(_===d||_===l){if(_===l){s.warning('attribute value must after "="');v=e.slice(r,y)}r=y+1;y=e.indexOf(N,r);if(y>0){g=e.slice(r,y);addAttribute(v,g,r-1);_=p}else{throw new Error("attribute value no end '"+N+"' match")}}else if(_==f){g=e.slice(r,y);addAttribute(v,g,r);s.warning('attribute "'+v+'" missed start quot('+N+")!!");r=y+1;_=p}else{throw new Error('attribute value must after "="')}break;case"/":switch(_){case u:n.setTagName(e.slice(r,y));case p:case h:case m:_=m;n.closed=true;case f:case l:case c:break;default:throw new Error("attribute invalid close char('/')")}break;case"":s.error("unexpected end of input");if(_==u){n.setTagName(e.slice(r,y))}return y;case">":switch(_){case u:n.setTagName(e.slice(r,y));case p:case h:case m:break;case f:case l:g=e.slice(r,y);if(g.slice(-1)==="/"){n.closed=true;g=g.slice(0,-1)}case c:if(_===c){g=v}if(_==f){s.warning('attribute "'+g+'" missed quot(")!');addAttribute(v,g,r)}else{if(!i.isHTML(o[""])||!g.match(/^(?:disabled|checked|selected)$/i)){s.warning('attribute "'+g+'" missed value!! "'+g+'" instead!!')}addAttribute(g,g,r)}break;case d:throw new Error("attribute value missed!!")}return y;case"€":N=" ";default:if(N<=" "){switch(_){case u:n.setTagName(e.slice(r,y));_=h;break;case l:v=e.slice(r,y);_=c;break;case f:var g=e.slice(r,y);s.warning('attribute "'+g+'" missed quot(")!!');addAttribute(v,g,r);case p:_=h;break}}else{switch(_){case c:var E=n.tagName;if(!i.isHTML(o[""])||!v.match(/^(?:disabled|checked|selected)$/i)){s.warning('attribute "'+v+'" missed value!! "'+v+'" instead2!!')}addAttribute(v,v,r);r=y;_=l;break;case p:s.warning('attribute space is required"'+v+'"!!');case h:_=l;r=y;break;case d:_=f;r=y;break;case m:throw new Error("elements closed character '/' and '>' must be connected to")}}}y++}}function appendElement(e,r,n){var o=e.tagName;var a=null;var s=e.length;while(s--){var u=e[s];var l=u.qName;var c=u.value;var d=l.indexOf(":");if(d>0){var f=u.prefix=l.slice(0,d);var p=l.slice(d+1);var h=f==="xmlns"&&p}else{p=l;f=null;h=l==="xmlns"&&""}u.localName=p;if(h!==false){if(a==null){a={};_copy(n,n={})}n[h]=a[h]=c;u.uri=i.XMLNS;r.startPrefixMapping(h,c)}}var s=e.length;while(s--){u=e[s];var f=u.prefix;if(f){if(f==="xml"){u.uri=i.XML}if(f!=="xmlns"){u.uri=n[f||""]}}}var d=o.indexOf(":");if(d>0){f=e.prefix=o.slice(0,d);p=e.localName=o.slice(d+1)}else{f=null;p=e.localName=o}var m=e.uri=n[f||""];r.startElement(m,p,o,e);if(e.closed){r.endElement(m,p,o);if(a){for(f in a){if(Object.prototype.hasOwnProperty.call(a,f)){r.endPrefixMapping(f)}}}}else{e.currentNSMap=n;e.localNSMap=a;return true}}function parseHtmlSpecialContent(e,r,n,i,o){if(/^(?:script|textarea)$/i.test(n)){var a=e.indexOf("",r);var s=e.substring(r+1,a);if(/[&<]/.test(s)){if(/^script$/i.test(n)){o.characters(s,0,s.length);return a}s=s.replace(/&#?\w+;/g,i);o.characters(s,0,s.length);return a}}return r+1}function fixSelfClosed(e,r,n,i){var o=i[n];if(o==null){o=e.lastIndexOf("");if(or){n.comment(e,r+4,a-r-4);return a+3}else{i.error("Unclosed comment");return-1}}else{return-1}default:if(e.substr(r+3,6)=="CDATA["){var a=e.indexOf("]]>",r+9);n.startCDATA();n.characters(e,r+9,a-r-9);n.endCDATA();return a+3}var s=split(e,r);var u=s.length;if(u>1&&/!doctype/i.test(s[0][0])){var l=s[1][0];var c=false;var d=false;if(u>3){if(/^public$/i.test(s[2][0])){c=s[3][0];d=u>4&&s[4][0]}else if(/^system$/i.test(s[2][0])){d=s[3][0]}}var f=s[u-1];n.startDTD(l,c,d);n.endDTD();return f.index+f[0].length}}return-1}function parseInstruction(e,r,n){var i=e.indexOf("?>",r);if(i){var o=e.substring(r,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){var a=o[0].length;n.processingInstruction(o[1],o[2]);return i+2}else{return-1}}return-1}function ElementAttributes(){this.attributeNames={}}ElementAttributes.prototype={setTagName:function(e){if(!s.test(e)){throw new Error("invalid tagName:"+e)}this.tagName=e},addValue:function(e,r,n){if(!s.test(e)){throw new Error("invalid attribute:"+e)}this.attributeNames[e]=this.length;this[this.length++]={qName:e,value:r,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function split(e,r){var n;var i=[];var o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;o.lastIndex=r;o.exec(e);while(n=o.exec(e)){i.push(n);if(n[1])return i}}r.XMLReader=XMLReader;r.ParseError=ParseError},294:(e,r,n)=>{e.exports=n(219)},219:(e,r,n)=>{"use strict";var i=n(808);var o=n(404);var a=n(685);var s=n(687);var u=n(361);var l=n(491);var c=n(837);r.httpOverHttp=httpOverHttp;r.httpsOverHttp=httpsOverHttp;r.httpOverHttps=httpOverHttps;r.httpsOverHttps=httpsOverHttps;function httpOverHttp(e){var r=new TunnelingAgent(e);r.request=a.request;return r}function httpsOverHttp(e){var r=new TunnelingAgent(e);r.request=a.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function httpOverHttps(e){var r=new TunnelingAgent(e);r.request=s.request;return r}function httpsOverHttps(e){var r=new TunnelingAgent(e);r.request=s.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function TunnelingAgent(e){var r=this;r.options=e||{};r.proxyOptions=r.options.proxy||{};r.maxSockets=r.options.maxSockets||a.Agent.defaultMaxSockets;r.requests=[];r.sockets=[];r.on("free",(function onFree(e,n,i,o){var a=toOptions(n,i,o);for(var s=0,u=r.requests.length;s=this.maxSockets){o.requests.push(a);return}o.createSocket(a,(function(r){r.on("free",onFree);r.on("close",onCloseOrRemove);r.on("agentRemove",onCloseOrRemove);e.onSocket(r);function onFree(){o.emit("free",r,a)}function onCloseOrRemove(e){o.removeSocket(r);r.removeListener("free",onFree);r.removeListener("close",onCloseOrRemove);r.removeListener("agentRemove",onCloseOrRemove)}}))};TunnelingAgent.prototype.createSocket=function createSocket(e,r){var n=this;var i={};n.sockets.push(i);var o=mergeOptions({},n.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:false,headers:{host:e.host+":"+e.port}});if(e.localAddress){o.localAddress=e.localAddress}if(o.proxyAuth){o.headers=o.headers||{};o.headers["Proxy-Authorization"]="Basic "+new Buffer(o.proxyAuth).toString("base64")}d("making CONNECT request");var a=n.request(o);a.useChunkedEncodingByDefault=false;a.once("response",onResponse);a.once("upgrade",onUpgrade);a.once("connect",onConnect);a.once("error",onError);a.end();function onResponse(e){e.upgrade=true}function onUpgrade(e,r,n){process.nextTick((function(){onConnect(e,r,n)}))}function onConnect(o,s,u){a.removeAllListeners();s.removeAllListeners();if(o.statusCode!==200){d("tunneling socket could not be established, statusCode=%d",o.statusCode);s.destroy();var l=new Error("tunneling socket could not be established, "+"statusCode="+o.statusCode);l.code="ECONNRESET";e.request.emit("error",l);n.removeSocket(i);return}if(u.length>0){d("got illegal response body from proxy");s.destroy();var l=new Error("got illegal response body from proxy");l.code="ECONNRESET";e.request.emit("error",l);n.removeSocket(i);return}d("tunneling connection has established");n.sockets[n.sockets.indexOf(i)]=s;return r(s)}function onError(r){a.removeAllListeners();d("tunneling socket could not be established, cause=%s\n",r.message,r.stack);var o=new Error("tunneling socket could not be established, "+"cause="+r.message);o.code="ECONNRESET";e.request.emit("error",o);n.removeSocket(i)}};TunnelingAgent.prototype.removeSocket=function removeSocket(e){var r=this.sockets.indexOf(e);if(r===-1){return}this.sockets.splice(r,1);var n=this.requests.shift();if(n){this.createSocket(n,(function(e){n.request.onSocket(e)}))}};function createSecureSocket(e,r){var n=this;TunnelingAgent.prototype.createSocket.call(n,e,(function(i){var a=e.request.getHeader("host");var s=mergeOptions({},n.options,{socket:i,servername:a?a.replace(/:.*$/,""):e.host});var u=o.connect(0,s);n.sockets[n.sockets.indexOf(i)]=u;r(u)}))}function toOptions(e,r,n){if(typeof e==="string"){return{host:e,port:r,localAddress:n}}return e}function mergeOptions(e){for(var r=1,n=arguments.length;r{"use strict";Object.defineProperty(r,"__esModule",{value:true});Object.defineProperty(r,"v1",{enumerable:true,get:function(){return i.default}});Object.defineProperty(r,"v3",{enumerable:true,get:function(){return o.default}});Object.defineProperty(r,"v4",{enumerable:true,get:function(){return a.default}});Object.defineProperty(r,"v5",{enumerable:true,get:function(){return s.default}});Object.defineProperty(r,"NIL",{enumerable:true,get:function(){return u.default}});Object.defineProperty(r,"version",{enumerable:true,get:function(){return l.default}});Object.defineProperty(r,"validate",{enumerable:true,get:function(){return c.default}});Object.defineProperty(r,"stringify",{enumerable:true,get:function(){return d.default}});Object.defineProperty(r,"parse",{enumerable:true,get:function(){return f.default}});var i=_interopRequireDefault(n(628));var o=_interopRequireDefault(n(409));var a=_interopRequireDefault(n(122));var s=_interopRequireDefault(n(120));var u=_interopRequireDefault(n(332));var l=_interopRequireDefault(n(595));var c=_interopRequireDefault(n(900));var d=_interopRequireDefault(n(950));var f=_interopRequireDefault(n(746));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},569:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(113));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function md5(e){if(Array.isArray(e)){e=Buffer.from(e)}else if(typeof e==="string"){e=Buffer.from(e,"utf8")}return i.default.createHash("md5").update(e).digest()}var o=md5;r["default"]=o},332:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n="00000000-0000-0000-0000-000000000000";r["default"]=n},746:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function parse(e){if(!(0,i.default)(e)){throw TypeError("Invalid UUID")}let r;const n=new Uint8Array(16);n[0]=(r=parseInt(e.slice(0,8),16))>>>24;n[1]=r>>>16&255;n[2]=r>>>8&255;n[3]=r&255;n[4]=(r=parseInt(e.slice(9,13),16))>>>8;n[5]=r&255;n[6]=(r=parseInt(e.slice(14,18),16))>>>8;n[7]=r&255;n[8]=(r=parseInt(e.slice(19,23),16))>>>8;n[9]=r&255;n[10]=(r=parseInt(e.slice(24,36),16))/1099511627776&255;n[11]=r/4294967296&255;n[12]=r>>>24&255;n[13]=r>>>16&255;n[14]=r>>>8&255;n[15]=r&255;return n}var o=parse;r["default"]=o},814:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;r["default"]=n},807:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=rng;var i=_interopRequireDefault(n(113));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=new Uint8Array(256);let a=o.length;function rng(){if(a>o.length-16){i.default.randomFillSync(o);a=0}return o.slice(a,a+=16)}},274:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(113));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function sha1(e){if(Array.isArray(e)){e=Buffer.from(e)}else if(typeof e==="string"){e=Buffer.from(e,"utf8")}return i.default.createHash("sha1").update(e).digest()}var o=sha1;r["default"]=o},950:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=[];for(let e=0;e<256;++e){o.push((e+256).toString(16).substr(1))}function stringify(e,r=0){const n=(o[e[r+0]]+o[e[r+1]]+o[e[r+2]]+o[e[r+3]]+"-"+o[e[r+4]]+o[e[r+5]]+"-"+o[e[r+6]]+o[e[r+7]]+"-"+o[e[r+8]]+o[e[r+9]]+"-"+o[e[r+10]]+o[e[r+11]]+o[e[r+12]]+o[e[r+13]]+o[e[r+14]]+o[e[r+15]]).toLowerCase();if(!(0,i.default)(n)){throw TypeError("Stringified UUID is invalid")}return n}var a=stringify;r["default"]=a},628:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(807));var o=_interopRequireDefault(n(950));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let a;let s;let u=0;let l=0;function v1(e,r,n){let c=r&&n||0;const d=r||new Array(16);e=e||{};let f=e.node||a;let p=e.clockseq!==undefined?e.clockseq:s;if(f==null||p==null){const r=e.random||(e.rng||i.default)();if(f==null){f=a=[r[0]|1,r[1],r[2],r[3],r[4],r[5]]}if(p==null){p=s=(r[6]<<8|r[7])&16383}}let h=e.msecs!==undefined?e.msecs:Date.now();let m=e.nsecs!==undefined?e.nsecs:l+1;const v=h-u+(m-l)/1e4;if(v<0&&e.clockseq===undefined){p=p+1&16383}if((v<0||h>u)&&e.nsecs===undefined){m=0}if(m>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}u=h;l=m;s=p;h+=122192928e5;const g=((h&268435455)*1e4+m)%4294967296;d[c++]=g>>>24&255;d[c++]=g>>>16&255;d[c++]=g>>>8&255;d[c++]=g&255;const y=h/4294967296*1e4&268435455;d[c++]=y>>>8&255;d[c++]=y&255;d[c++]=y>>>24&15|16;d[c++]=y>>>16&255;d[c++]=p>>>8|128;d[c++]=p&255;for(let e=0;e<6;++e){d[c+e]=f[e]}return r||(0,o.default)(d)}var c=v1;r["default"]=c},409:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(998));var o=_interopRequireDefault(n(569));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a=(0,i.default)("v3",48,o.default);var s=a;r["default"]=s},998:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=_default;r.URL=r.DNS=void 0;var i=_interopRequireDefault(n(950));var o=_interopRequireDefault(n(746));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function stringToBytes(e){e=unescape(encodeURIComponent(e));const r=[];for(let n=0;n{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(807));var o=_interopRequireDefault(n(950));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function v4(e,r,n){e=e||{};const a=e.random||(e.rng||i.default)();a[6]=a[6]&15|64;a[8]=a[8]&63|128;if(r){n=n||0;for(let e=0;e<16;++e){r[n+e]=a[e]}return r}return(0,o.default)(a)}var a=v4;r["default"]=a},120:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(998));var o=_interopRequireDefault(n(274));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a=(0,i.default)("v5",80,o.default);var s=a;r["default"]=s},900:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(814));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function validate(e){return typeof e==="string"&&i.default.test(e)}var o=validate;r["default"]=o},595:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function version(e){if(!(0,i.default)(e)){throw TypeError("Invalid UUID")}return parseInt(e.substr(14,1),16)}var o=version;r["default"]=o},491:e=>{"use strict";e.exports=require("assert")},113:e=>{"use strict";e.exports=require("crypto")},361:e=>{"use strict";e.exports=require("events")},147:e=>{"use strict";e.exports=require("fs")},685:e=>{"use strict";e.exports=require("http")},687:e=>{"use strict";e.exports=require("https")},808:e=>{"use strict";e.exports=require("net")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")},404:e=>{"use strict";e.exports=require("tls")},837:e=>{"use strict";e.exports=require("util")}};var r={};function __nccwpck_require__(n){var i=r[n];if(i!==undefined){return i.exports}var o=r[n]={exports:{}};var a=true;try{e[n].call(o.exports,o,o.exports,__nccwpck_require__);a=false}finally{if(a)delete r[n]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(109);module.exports=n})(); +require('./sourcemap-register.js');(()=>{var e={109:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;var o=Object.getOwnPropertyDescriptor(r,n);if(!o||("get"in o?!r.__esModule:o.writable||o.configurable)){o={enumerable:true,get:function(){return r[n]}}}Object.defineProperty(e,i,o)}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.prototype.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};var s=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});const u=a(n(186));const l=n(147);const c=n(213);function put(e,r){u.info(`${e}: ${r}`);u.setOutput(e,r)}class DocumentWrapper{constructor(e){this.docElement=e}getAnyText(e){const r=this.docElement.getElementsByTagName(e);for(let e=0;e0?r[r.length-1].textContent:null}static createAsync(e){return s(this,void 0,void 0,(function*(){let r;try{r=yield l.promises.readFile(e,"utf-8")}catch(r){throw new Error(`no such file: '${e}'`)}const n=(new c.DOMParser).parseFromString(r,"text/xml");if(!(n===null||n===void 0?void 0:n.documentElement)){throw new Error(`failed to parse xml file: '${e}'`)}return new DocumentWrapper(n.documentElement)}))}}function run(){return s(this,void 0,void 0,(function*(){try{const e=u.getInput("proj-path");u.debug(`proj-path=${e}`);let r=false;const n=yield DocumentWrapper.createAsync(e);let i=n.getAnyText("VersionPrefix");let o=n.getAnyText("VersionSuffix");let a=n.getAnyText("Version");if(a){r=true;const e=a.indexOf("-");if(e>=0){i=a.substring(0,e);o=a.substring(e+1)}else{i=a;o=""}}else{if(i){r=true}else{i="1.0.0"}if(o){r=true;a=`${i}-${o}`}else{a=i;o=""}}let s=n.getAnyText("PackageVersion");if(s){r=true}else{s=a}let l=n.getAnyText("AssemblyVersion");if(l){r=true}else{l=i}let c=n.getAnyText("FileVersion");if(c){r=true}else{c=l}let d=n.getAnyText("InformationalVersion");if(d){r=true}else{d=a}if(!r){throw new Error("Not found version tag")}put("version",a);put("version-prefix",i);put("version-suffix",o);put("package-version",s);put("assembly-version",l);put("file-version",c);put("informational-version",d)}catch(e){if(e instanceof Error){u.setFailed(e.message)}}}))}run()},351:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.issue=r.issueCommand=void 0;const s=a(n(37));const u=n(278);function issueCommand(e,r,n){const i=new Command(e,r,n);process.stdout.write(i.toString()+s.EOL)}r.issueCommand=issueCommand;function issue(e,r=""){issueCommand(e,{},r)}r.issue=issue;const l="::";class Command{constructor(e,r,n){if(!e){e="missing.command"}this.command=e;this.properties=r;this.message=n}toString(){let e=l+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let r=true;for(const n in this.properties){if(this.properties.hasOwnProperty(n)){const i=this.properties[n];if(i){if(r){r=false}else{e+=","}e+=`${n}=${escapeProperty(i)}`}}}}e+=`${l}${escapeData(this.message)}`;return e}}function escapeData(e){return u.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return u.toCommandValue(e).replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},186:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};var s=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.getIDToken=r.getState=r.saveState=r.group=r.endGroup=r.startGroup=r.info=r.notice=r.warning=r.error=r.debug=r.isDebug=r.setFailed=r.setCommandEcho=r.setOutput=r.getBooleanInput=r.getMultilineInput=r.getInput=r.addPath=r.setSecret=r.exportVariable=r.ExitCode=void 0;const u=n(351);const l=n(717);const c=n(278);const d=a(n(37));const f=a(n(17));const p=n(41);var h;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(h=r.ExitCode||(r.ExitCode={}));function exportVariable(e,r){const n=c.toCommandValue(r);process.env[e]=n;const i=process.env["GITHUB_ENV"]||"";if(i){return l.issueFileCommand("ENV",l.prepareKeyValueMessage(e,r))}u.issueCommand("set-env",{name:e},n)}r.exportVariable=exportVariable;function setSecret(e){u.issueCommand("add-mask",{},e)}r.setSecret=setSecret;function addPath(e){const r=process.env["GITHUB_PATH"]||"";if(r){l.issueFileCommand("PATH",e)}else{u.issueCommand("add-path",{},e)}process.env["PATH"]=`${e}${f.delimiter}${process.env["PATH"]}`}r.addPath=addPath;function getInput(e,r){const n=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(r&&r.required&&!n){throw new Error(`Input required and not supplied: ${e}`)}if(r&&r.trimWhitespace===false){return n}return n.trim()}r.getInput=getInput;function getMultilineInput(e,r){const n=getInput(e,r).split("\n").filter((e=>e!==""));if(r&&r.trimWhitespace===false){return n}return n.map((e=>e.trim()))}r.getMultilineInput=getMultilineInput;function getBooleanInput(e,r){const n=["true","True","TRUE"];const i=["false","False","FALSE"];const o=getInput(e,r);if(n.includes(o))return true;if(i.includes(o))return false;throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${e}\n`+`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``)}r.getBooleanInput=getBooleanInput;function setOutput(e,r){const n=process.env["GITHUB_OUTPUT"]||"";if(n){return l.issueFileCommand("OUTPUT",l.prepareKeyValueMessage(e,r))}process.stdout.write(d.EOL);u.issueCommand("set-output",{name:e},c.toCommandValue(r))}r.setOutput=setOutput;function setCommandEcho(e){u.issue("echo",e?"on":"off")}r.setCommandEcho=setCommandEcho;function setFailed(e){process.exitCode=h.Failure;error(e)}r.setFailed=setFailed;function isDebug(){return process.env["RUNNER_DEBUG"]==="1"}r.isDebug=isDebug;function debug(e){u.issueCommand("debug",{},e)}r.debug=debug;function error(e,r={}){u.issueCommand("error",c.toCommandProperties(r),e instanceof Error?e.toString():e)}r.error=error;function warning(e,r={}){u.issueCommand("warning",c.toCommandProperties(r),e instanceof Error?e.toString():e)}r.warning=warning;function notice(e,r={}){u.issueCommand("notice",c.toCommandProperties(r),e instanceof Error?e.toString():e)}r.notice=notice;function info(e){process.stdout.write(e+d.EOL)}r.info=info;function startGroup(e){u.issue("group",e)}r.startGroup=startGroup;function endGroup(){u.issue("endgroup")}r.endGroup=endGroup;function group(e,r){return s(this,void 0,void 0,(function*(){startGroup(e);let n;try{n=yield r()}finally{endGroup()}return n}))}r.group=group;function saveState(e,r){const n=process.env["GITHUB_STATE"]||"";if(n){return l.issueFileCommand("STATE",l.prepareKeyValueMessage(e,r))}u.issueCommand("save-state",{name:e},c.toCommandValue(r))}r.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}r.getState=getState;function getIDToken(e){return s(this,void 0,void 0,(function*(){return yield p.OidcClient.getIDToken(e)}))}r.getIDToken=getIDToken;var m=n(327);Object.defineProperty(r,"summary",{enumerable:true,get:function(){return m.summary}});var v=n(327);Object.defineProperty(r,"markdownSummary",{enumerable:true,get:function(){return v.markdownSummary}});var g=n(981);Object.defineProperty(r,"toPosixPath",{enumerable:true,get:function(){return g.toPosixPath}});Object.defineProperty(r,"toWin32Path",{enumerable:true,get:function(){return g.toWin32Path}});Object.defineProperty(r,"toPlatformPath",{enumerable:true,get:function(){return g.toPlatformPath}})},717:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.prepareKeyValueMessage=r.issueFileCommand=void 0;const s=a(n(147));const u=a(n(37));const l=n(840);const c=n(278);function issueFileCommand(e,r){const n=process.env[`GITHUB_${e}`];if(!n){throw new Error(`Unable to find environment variable for file command ${e}`)}if(!s.existsSync(n)){throw new Error(`Missing file at path: ${n}`)}s.appendFileSync(n,`${c.toCommandValue(r)}${u.EOL}`,{encoding:"utf8"})}r.issueFileCommand=issueFileCommand;function prepareKeyValueMessage(e,r){const n=`ghadelimiter_${l.v4()}`;const i=c.toCommandValue(r);if(e.includes(n)){throw new Error(`Unexpected input: name should not contain the delimiter "${n}"`)}if(i.includes(n)){throw new Error(`Unexpected input: value should not contain the delimiter "${n}"`)}return`${e}<<${n}${u.EOL}${i}${u.EOL}${n}`}r.prepareKeyValueMessage=prepareKeyValueMessage},41:function(e,r,n){"use strict";var i=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.OidcClient=void 0;const o=n(255);const a=n(526);const s=n(186);class OidcClient{static createHttpClient(e=true,r=10){const n={allowRetries:e,maxRetries:r};return new o.HttpClient("actions/oidc-client",[new a.BearerCredentialHandler(OidcClient.getRequestToken())],n)}static getRequestToken(){const e=process.env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];if(!e){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable")}return e}static getIDTokenUrl(){const e=process.env["ACTIONS_ID_TOKEN_REQUEST_URL"];if(!e){throw new Error("Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable")}return e}static getCall(e){var r;return i(this,void 0,void 0,(function*(){const n=OidcClient.createHttpClient();const i=yield n.getJson(e).catch((e=>{throw new Error(`Failed to get ID Token. \n \n Error Code : ${e.statusCode}\n \n Error Message: ${e.message}`)}));const o=(r=i.result)===null||r===void 0?void 0:r.value;if(!o){throw new Error("Response json body do not have ID Token field")}return o}))}static getIDToken(e){return i(this,void 0,void 0,(function*(){try{let r=OidcClient.getIDTokenUrl();if(e){const n=encodeURIComponent(e);r=`${r}&audience=${n}`}s.debug(`ID token url is ${r}`);const n=yield OidcClient.getCall(r);s.setSecret(n);return n}catch(e){throw new Error(`Error message: ${e.message}`)}}))}}r.OidcClient=OidcClient},981:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};Object.defineProperty(r,"__esModule",{value:true});r.toPlatformPath=r.toWin32Path=r.toPosixPath=void 0;const s=a(n(17));function toPosixPath(e){return e.replace(/[\\]/g,"/")}r.toPosixPath=toPosixPath;function toWin32Path(e){return e.replace(/[/]/g,"\\")}r.toWin32Path=toWin32Path;function toPlatformPath(e){return e.replace(/[/\\]/g,s.sep)}r.toPlatformPath=toPlatformPath},327:function(e,r,n){"use strict";var i=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.summary=r.markdownSummary=r.SUMMARY_DOCS_URL=r.SUMMARY_ENV_VAR=void 0;const o=n(37);const a=n(147);const{access:s,appendFile:u,writeFile:l}=a.promises;r.SUMMARY_ENV_VAR="GITHUB_STEP_SUMMARY";r.SUMMARY_DOCS_URL="https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary";class Summary{constructor(){this._buffer=""}filePath(){return i(this,void 0,void 0,(function*(){if(this._filePath){return this._filePath}const e=process.env[r.SUMMARY_ENV_VAR];if(!e){throw new Error(`Unable to find environment variable for $${r.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`)}try{yield s(e,a.constants.R_OK|a.constants.W_OK)}catch(r){throw new Error(`Unable to access summary file: '${e}'. Check if the file has correct read/write permissions.`)}this._filePath=e;return this._filePath}))}wrap(e,r,n={}){const i=Object.entries(n).map((([e,r])=>` ${e}="${r}"`)).join("");if(!r){return`<${e}${i}>`}return`<${e}${i}>${r}`}write(e){return i(this,void 0,void 0,(function*(){const r=!!(e===null||e===void 0?void 0:e.overwrite);const n=yield this.filePath();const i=r?l:u;yield i(n,this._buffer,{encoding:"utf8"});return this.emptyBuffer()}))}clear(){return i(this,void 0,void 0,(function*(){return this.emptyBuffer().write({overwrite:true})}))}stringify(){return this._buffer}isEmptyBuffer(){return this._buffer.length===0}emptyBuffer(){this._buffer="";return this}addRaw(e,r=false){this._buffer+=e;return r?this.addEOL():this}addEOL(){return this.addRaw(o.EOL)}addCodeBlock(e,r){const n=Object.assign({},r&&{lang:r});const i=this.wrap("pre",this.wrap("code",e),n);return this.addRaw(i).addEOL()}addList(e,r=false){const n=r?"ol":"ul";const i=e.map((e=>this.wrap("li",e))).join("");const o=this.wrap(n,i);return this.addRaw(o).addEOL()}addTable(e){const r=e.map((e=>{const r=e.map((e=>{if(typeof e==="string"){return this.wrap("td",e)}const{header:r,data:n,colspan:i,rowspan:o}=e;const a=r?"th":"td";const s=Object.assign(Object.assign({},i&&{colspan:i}),o&&{rowspan:o});return this.wrap(a,n,s)})).join("");return this.wrap("tr",r)})).join("");const n=this.wrap("table",r);return this.addRaw(n).addEOL()}addDetails(e,r){const n=this.wrap("details",this.wrap("summary",e)+r);return this.addRaw(n).addEOL()}addImage(e,r,n){const{width:i,height:o}=n||{};const a=Object.assign(Object.assign({},i&&{width:i}),o&&{height:o});const s=this.wrap("img",null,Object.assign({src:e,alt:r},a));return this.addRaw(s).addEOL()}addHeading(e,r){const n=`h${r}`;const i=["h1","h2","h3","h4","h5","h6"].includes(n)?n:"h1";const o=this.wrap(i,e);return this.addRaw(o).addEOL()}addSeparator(){const e=this.wrap("hr",null);return this.addRaw(e).addEOL()}addBreak(){const e=this.wrap("br",null);return this.addRaw(e).addEOL()}addQuote(e,r){const n=Object.assign({},r&&{cite:r});const i=this.wrap("blockquote",e,n);return this.addRaw(i).addEOL()}addLink(e,r){const n=this.wrap("a",e,{href:r});return this.addRaw(n).addEOL()}}const c=new Summary;r.markdownSummary=c;r.summary=c},278:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.toCommandProperties=r.toCommandValue=void 0;function toCommandValue(e){if(e===null||e===undefined){return""}else if(typeof e==="string"||e instanceof String){return e}return JSON.stringify(e)}r.toCommandValue=toCommandValue;function toCommandProperties(e){if(!Object.keys(e).length){return{}}return{title:e.title,file:e.file,line:e.startLine,endLine:e.endLine,col:e.startColumn,endColumn:e.endColumn}}r.toCommandProperties=toCommandProperties},526:function(e,r){"use strict";var n=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.PersonalAccessTokenCredentialHandler=r.BearerCredentialHandler=r.BasicCredentialHandler=void 0;class BasicCredentialHandler{constructor(e,r){this.username=e;this.password=r}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.BasicCredentialHandler=BasicCredentialHandler;class BearerCredentialHandler{constructor(e){this.token=e}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Bearer ${this.token}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.BearerCredentialHandler=BearerCredentialHandler;class PersonalAccessTokenCredentialHandler{constructor(e){this.token=e}prepareRequest(e){if(!e.headers){throw Error("The request has no headers")}e.headers["Authorization"]=`Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`}canHandleAuthentication(){return false}handleAuthentication(){return n(this,void 0,void 0,(function*(){throw new Error("not implemented")}))}}r.PersonalAccessTokenCredentialHandler=PersonalAccessTokenCredentialHandler},255:function(e,r,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,r,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return r[n]}})}:function(e,r,n,i){if(i===undefined)i=n;e[i]=r[n]});var o=this&&this.__setModuleDefault||(Object.create?function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}:function(e,r){e["default"]=r});var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))i(r,e,n);o(r,e);return r};var s=this&&this.__awaiter||function(e,r,n,i){function adopt(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,o){function fulfilled(e){try{step(i.next(e))}catch(e){o(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){o(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,r||[])).next())}))};Object.defineProperty(r,"__esModule",{value:true});r.HttpClient=r.isHttps=r.HttpClientResponse=r.HttpClientError=r.getProxyUrl=r.MediaTypes=r.Headers=r.HttpCodes=void 0;const u=a(n(685));const l=a(n(687));const c=a(n(835));const d=a(n(294));var f;(function(e){e[e["OK"]=200]="OK";e[e["MultipleChoices"]=300]="MultipleChoices";e[e["MovedPermanently"]=301]="MovedPermanently";e[e["ResourceMoved"]=302]="ResourceMoved";e[e["SeeOther"]=303]="SeeOther";e[e["NotModified"]=304]="NotModified";e[e["UseProxy"]=305]="UseProxy";e[e["SwitchProxy"]=306]="SwitchProxy";e[e["TemporaryRedirect"]=307]="TemporaryRedirect";e[e["PermanentRedirect"]=308]="PermanentRedirect";e[e["BadRequest"]=400]="BadRequest";e[e["Unauthorized"]=401]="Unauthorized";e[e["PaymentRequired"]=402]="PaymentRequired";e[e["Forbidden"]=403]="Forbidden";e[e["NotFound"]=404]="NotFound";e[e["MethodNotAllowed"]=405]="MethodNotAllowed";e[e["NotAcceptable"]=406]="NotAcceptable";e[e["ProxyAuthenticationRequired"]=407]="ProxyAuthenticationRequired";e[e["RequestTimeout"]=408]="RequestTimeout";e[e["Conflict"]=409]="Conflict";e[e["Gone"]=410]="Gone";e[e["TooManyRequests"]=429]="TooManyRequests";e[e["InternalServerError"]=500]="InternalServerError";e[e["NotImplemented"]=501]="NotImplemented";e[e["BadGateway"]=502]="BadGateway";e[e["ServiceUnavailable"]=503]="ServiceUnavailable";e[e["GatewayTimeout"]=504]="GatewayTimeout"})(f=r.HttpCodes||(r.HttpCodes={}));var p;(function(e){e["Accept"]="accept";e["ContentType"]="content-type"})(p=r.Headers||(r.Headers={}));var h;(function(e){e["ApplicationJson"]="application/json"})(h=r.MediaTypes||(r.MediaTypes={}));function getProxyUrl(e){const r=c.getProxyUrl(new URL(e));return r?r.href:""}r.getProxyUrl=getProxyUrl;const m=[f.MovedPermanently,f.ResourceMoved,f.SeeOther,f.TemporaryRedirect,f.PermanentRedirect];const v=[f.BadGateway,f.ServiceUnavailable,f.GatewayTimeout];const g=["OPTIONS","GET","DELETE","HEAD"];const y=10;const _=5;class HttpClientError extends Error{constructor(e,r){super(e);this.name="HttpClientError";this.statusCode=r;Object.setPrototypeOf(this,HttpClientError.prototype)}}r.HttpClientError=HttpClientError;class HttpClientResponse{constructor(e){this.message=e}readBody(){return s(this,void 0,void 0,(function*(){return new Promise((e=>s(this,void 0,void 0,(function*(){let r=Buffer.alloc(0);this.message.on("data",(e=>{r=Buffer.concat([r,e])}));this.message.on("end",(()=>{e(r.toString())}))}))))}))}}r.HttpClientResponse=HttpClientResponse;function isHttps(e){const r=new URL(e);return r.protocol==="https:"}r.isHttps=isHttps;class HttpClient{constructor(e,r,n){this._ignoreSslError=false;this._allowRedirects=true;this._allowRedirectDowngrade=false;this._maxRedirects=50;this._allowRetries=false;this._maxRetries=1;this._keepAlive=false;this._disposed=false;this.userAgent=e;this.handlers=r||[];this.requestOptions=n;if(n){if(n.ignoreSslError!=null){this._ignoreSslError=n.ignoreSslError}this._socketTimeout=n.socketTimeout;if(n.allowRedirects!=null){this._allowRedirects=n.allowRedirects}if(n.allowRedirectDowngrade!=null){this._allowRedirectDowngrade=n.allowRedirectDowngrade}if(n.maxRedirects!=null){this._maxRedirects=Math.max(n.maxRedirects,0)}if(n.keepAlive!=null){this._keepAlive=n.keepAlive}if(n.allowRetries!=null){this._allowRetries=n.allowRetries}if(n.maxRetries!=null){this._maxRetries=n.maxRetries}}}options(e,r){return s(this,void 0,void 0,(function*(){return this.request("OPTIONS",e,null,r||{})}))}get(e,r){return s(this,void 0,void 0,(function*(){return this.request("GET",e,null,r||{})}))}del(e,r){return s(this,void 0,void 0,(function*(){return this.request("DELETE",e,null,r||{})}))}post(e,r,n){return s(this,void 0,void 0,(function*(){return this.request("POST",e,r,n||{})}))}patch(e,r,n){return s(this,void 0,void 0,(function*(){return this.request("PATCH",e,r,n||{})}))}put(e,r,n){return s(this,void 0,void 0,(function*(){return this.request("PUT",e,r,n||{})}))}head(e,r){return s(this,void 0,void 0,(function*(){return this.request("HEAD",e,null,r||{})}))}sendStream(e,r,n,i){return s(this,void 0,void 0,(function*(){return this.request(e,r,n,i)}))}getJson(e,r={}){return s(this,void 0,void 0,(function*(){r[p.Accept]=this._getExistingOrDefaultHeader(r,p.Accept,h.ApplicationJson);const n=yield this.get(e,r);return this._processResponse(n,this.requestOptions)}))}postJson(e,r,n={}){return s(this,void 0,void 0,(function*(){const i=JSON.stringify(r,null,2);n[p.Accept]=this._getExistingOrDefaultHeader(n,p.Accept,h.ApplicationJson);n[p.ContentType]=this._getExistingOrDefaultHeader(n,p.ContentType,h.ApplicationJson);const o=yield this.post(e,i,n);return this._processResponse(o,this.requestOptions)}))}putJson(e,r,n={}){return s(this,void 0,void 0,(function*(){const i=JSON.stringify(r,null,2);n[p.Accept]=this._getExistingOrDefaultHeader(n,p.Accept,h.ApplicationJson);n[p.ContentType]=this._getExistingOrDefaultHeader(n,p.ContentType,h.ApplicationJson);const o=yield this.put(e,i,n);return this._processResponse(o,this.requestOptions)}))}patchJson(e,r,n={}){return s(this,void 0,void 0,(function*(){const i=JSON.stringify(r,null,2);n[p.Accept]=this._getExistingOrDefaultHeader(n,p.Accept,h.ApplicationJson);n[p.ContentType]=this._getExistingOrDefaultHeader(n,p.ContentType,h.ApplicationJson);const o=yield this.patch(e,i,n);return this._processResponse(o,this.requestOptions)}))}request(e,r,n,i){return s(this,void 0,void 0,(function*(){if(this._disposed){throw new Error("Client has already been disposed.")}const o=new URL(r);let a=this._prepareRequest(e,o,i);const s=this._allowRetries&&g.includes(e)?this._maxRetries+1:1;let u=0;let l;do{l=yield this.requestRaw(a,n);if(l&&l.message&&l.message.statusCode===f.Unauthorized){let e;for(const r of this.handlers){if(r.canHandleAuthentication(l)){e=r;break}}if(e){return e.handleAuthentication(this,a,n)}else{return l}}let r=this._maxRedirects;while(l.message.statusCode&&m.includes(l.message.statusCode)&&this._allowRedirects&&r>0){const s=l.message.headers["location"];if(!s){break}const u=new URL(s);if(o.protocol==="https:"&&o.protocol!==u.protocol&&!this._allowRedirectDowngrade){throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.")}yield l.readBody();if(u.hostname!==o.hostname){for(const e in i){if(e.toLowerCase()==="authorization"){delete i[e]}}}a=this._prepareRequest(e,u,i);l=yield this.requestRaw(a,n);r--}if(!l.message.statusCode||!v.includes(l.message.statusCode)){return l}u+=1;if(u{function callbackForResult(e,r){if(e){i(e)}else if(!r){i(new Error("Unknown error"))}else{n(r)}}this.requestRawWithCallback(e,r,callbackForResult)}))}))}requestRawWithCallback(e,r,n){if(typeof r==="string"){if(!e.options.headers){e.options.headers={}}e.options.headers["Content-Length"]=Buffer.byteLength(r,"utf8")}let i=false;function handleResult(e,r){if(!i){i=true;n(e,r)}}const o=e.httpModule.request(e.options,(e=>{const r=new HttpClientResponse(e);handleResult(undefined,r)}));let a;o.on("socket",(e=>{a=e}));o.setTimeout(this._socketTimeout||3*6e4,(()=>{if(a){a.end()}handleResult(new Error(`Request timeout: ${e.options.path}`))}));o.on("error",(function(e){handleResult(e)}));if(r&&typeof r==="string"){o.write(r,"utf8")}if(r&&typeof r!=="string"){r.on("close",(function(){o.end()}));r.pipe(o)}else{o.end()}}getAgent(e){const r=new URL(e);return this._getAgent(r)}_prepareRequest(e,r,n){const i={};i.parsedUrl=r;const o=i.parsedUrl.protocol==="https:";i.httpModule=o?l:u;const a=o?443:80;i.options={};i.options.host=i.parsedUrl.hostname;i.options.port=i.parsedUrl.port?parseInt(i.parsedUrl.port):a;i.options.path=(i.parsedUrl.pathname||"")+(i.parsedUrl.search||"");i.options.method=e;i.options.headers=this._mergeHeaders(n);if(this.userAgent!=null){i.options.headers["user-agent"]=this.userAgent}i.options.agent=this._getAgent(i.parsedUrl);if(this.handlers){for(const e of this.handlers){e.prepareRequest(i.options)}}return i}_mergeHeaders(e){if(this.requestOptions&&this.requestOptions.headers){return Object.assign({},lowercaseKeys(this.requestOptions.headers),lowercaseKeys(e||{}))}return lowercaseKeys(e||{})}_getExistingOrDefaultHeader(e,r,n){let i;if(this.requestOptions&&this.requestOptions.headers){i=lowercaseKeys(this.requestOptions.headers)[r]}return e[r]||i||n}_getAgent(e){let r;const n=c.getProxyUrl(e);const i=n&&n.hostname;if(this._keepAlive&&i){r=this._proxyAgent}if(this._keepAlive&&!i){r=this._agent}if(r){return r}const o=e.protocol==="https:";let a=100;if(this.requestOptions){a=this.requestOptions.maxSockets||u.globalAgent.maxSockets}if(n&&n.hostname){const e={maxSockets:a,keepAlive:this._keepAlive,proxy:Object.assign(Object.assign({},(n.username||n.password)&&{proxyAuth:`${n.username}:${n.password}`}),{host:n.hostname,port:n.port})};let i;const s=n.protocol==="https:";if(o){i=s?d.httpsOverHttps:d.httpsOverHttp}else{i=s?d.httpOverHttps:d.httpOverHttp}r=i(e);this._proxyAgent=r}if(this._keepAlive&&!r){const e={keepAlive:this._keepAlive,maxSockets:a};r=o?new l.Agent(e):new u.Agent(e);this._agent=r}if(!r){r=o?l.globalAgent:u.globalAgent}if(o&&this._ignoreSslError){r.options=Object.assign(r.options||{},{rejectUnauthorized:false})}return r}_performExponentialBackoff(e){return s(this,void 0,void 0,(function*(){e=Math.min(y,e);const r=_*Math.pow(2,e);return new Promise((e=>setTimeout((()=>e()),r)))}))}_processResponse(e,r){return s(this,void 0,void 0,(function*(){return new Promise(((n,i)=>s(this,void 0,void 0,(function*(){const o=e.message.statusCode||0;const a={statusCode:o,result:null,headers:{}};if(o===f.NotFound){n(a)}function dateTimeDeserializer(e,r){if(typeof r==="string"){const e=new Date(r);if(!isNaN(e.valueOf())){return e}}return r}let s;let u;try{u=yield e.readBody();if(u&&u.length>0){if(r&&r.deserializeDates){s=JSON.parse(u,dateTimeDeserializer)}else{s=JSON.parse(u)}a.result=s}a.headers=e.message.headers}catch(e){}if(o>299){let e;if(s&&s.message){e=s.message}else if(u&&u.length>0){e=u}else{e=`Failed request: (${o})`}const r=new HttpClientError(e,o);r.result=a.result;i(r)}else{n(a)}}))))}))}}r.HttpClient=HttpClient;const lowercaseKeys=e=>Object.keys(e).reduce(((r,n)=>(r[n.toLowerCase()]=e[n],r)),{})},835:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.checkBypass=r.getProxyUrl=void 0;function getProxyUrl(e){const r=e.protocol==="https:";if(checkBypass(e)){return undefined}const n=(()=>{if(r){return process.env["https_proxy"]||process.env["HTTPS_PROXY"]}else{return process.env["http_proxy"]||process.env["HTTP_PROXY"]}})();if(n){return new URL(n)}else{return undefined}}r.getProxyUrl=getProxyUrl;function checkBypass(e){if(!e.hostname){return false}const r=process.env["no_proxy"]||process.env["NO_PROXY"]||"";if(!r){return false}let n;if(e.port){n=Number(e.port)}else if(e.protocol==="http:"){n=80}else if(e.protocol==="https:"){n=443}const i=[e.hostname.toUpperCase()];if(typeof n==="number"){i.push(`${i[0]}:${n}`)}for(const e of r.split(",").map((e=>e.trim().toUpperCase())).filter((e=>e))){if(i.some((r=>r===e))){return true}}return false}r.checkBypass=checkBypass},756:(e,r)=>{"use strict";function find(e,r,n){if(n===undefined){n=Array.prototype}if(e&&typeof n.find==="function"){return n.find.call(e,r)}for(var i=0;i{var i;var o=n(756);var a=n(389);var s=n(508);var u=n(58);var l=a.DOMImplementation;var c=o.NAMESPACE;var d=u.ParseError;var f=u.XMLReader;function normalizeLineEndings(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function DOMParser(e){this.options=e||{locator:{}}}DOMParser.prototype.parseFromString=function(e,r){var n=this.options;var i=new f;var o=n.domBuilder||new DOMHandler;var a=n.errorHandler;var u=n.locator;var l=n.xmlns||{};var d=/\/x?html?$/.test(r);var p=d?s.HTML_ENTITIES:s.XML_ENTITIES;if(u){o.setDocumentLocator(u)}i.errorHandler=buildErrorHandler(a,o,u);i.domBuilder=n.domBuilder||o;if(d){l[""]=c.HTML}l.xml=l.xml||c.XML;var h=n.normalizeLineEndings||normalizeLineEndings;if(e&&typeof e==="string"){i.parse(h(e),l,p)}else{i.errorHandler.error("invalid doc source")}return o.doc};function buildErrorHandler(e,r,n){if(!e){if(r instanceof DOMHandler){return r}e=r}var i={};var o=e instanceof Function;n=n||{};function build(r){var a=e[r];if(!a&&o){a=e.length==2?function(n){e(r,n)}:e}i[r]=a&&function(e){a("[xmldom "+r+"]\t"+e+_locator(n))}||function(){}}build("warning");build("error");build("fatalError");return i}function DOMHandler(){this.cdata=false}function position(e,r){r.lineNumber=e.lineNumber;r.columnNumber=e.columnNumber}DOMHandler.prototype={startDocument:function(){this.doc=(new l).createDocument(null,null,null);if(this.locator){this.doc.documentURI=this.locator.systemId}},startElement:function(e,r,n,i){var o=this.doc;var a=o.createElementNS(e,n||r);var s=i.length;appendElement(this,a);this.currentElement=a;this.locator&&position(this.locator,a);for(var u=0;u=r+n||r){return new java.lang.String(e,r,n)+""}return e}}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,(function(e){DOMHandler.prototype[e]=function(){return null}}));function appendElement(e,r){if(!e.currentElement){e.doc.appendChild(r)}else{e.currentElement.appendChild(r)}}i=DOMHandler;i=normalizeLineEndings;r.DOMParser=DOMParser},389:(e,r,n)=>{var i=n(756);var o=i.find;var a=i.NAMESPACE;function notEmptyString(e){return e!==""}function splitOnASCIIWhitespace(e){return e?e.split(/[\t\n\f\r ]+/).filter(notEmptyString):[]}function orderedSetReducer(e,r){if(!e.hasOwnProperty(r)){e[r]=true}return e}function toOrderedSet(e){if(!e)return[];var r=splitOnASCIIWhitespace(e);return Object.keys(r.reduce(orderedSetReducer,{}))}function arrayIncludes(e){return function(r){return e&&e.indexOf(r)!==-1}}function copy(e,r){for(var n in e){if(Object.prototype.hasOwnProperty.call(e,n)){r[n]=e[n]}}}function _extends(e,r){var n=e.prototype;if(!(n instanceof r)){function t(){}t.prototype=r.prototype;t=new t;copy(n,t);e.prototype=n=t}if(n.constructor!=e){if(typeof e!="function"){console.error("unknown Class:"+e)}n.constructor=e}}var s={};var u=s.ELEMENT_NODE=1;var l=s.ATTRIBUTE_NODE=2;var c=s.TEXT_NODE=3;var d=s.CDATA_SECTION_NODE=4;var f=s.ENTITY_REFERENCE_NODE=5;var p=s.ENTITY_NODE=6;var h=s.PROCESSING_INSTRUCTION_NODE=7;var m=s.COMMENT_NODE=8;var v=s.DOCUMENT_NODE=9;var g=s.DOCUMENT_TYPE_NODE=10;var y=s.DOCUMENT_FRAGMENT_NODE=11;var _=s.NOTATION_NODE=12;var N={};var E={};var w=N.INDEX_SIZE_ERR=(E[1]="Index size error",1);var b=N.DOMSTRING_SIZE_ERR=(E[2]="DOMString size error",2);var O=N.HIERARCHY_REQUEST_ERR=(E[3]="Hierarchy request error",3);var T=N.WRONG_DOCUMENT_ERR=(E[4]="Wrong document",4);var D=N.INVALID_CHARACTER_ERR=(E[5]="Invalid character",5);var x=N.NO_DATA_ALLOWED_ERR=(E[6]="No data allowed",6);var C=N.NO_MODIFICATION_ALLOWED_ERR=(E[7]="No modification allowed",7);var S=N.NOT_FOUND_ERR=(E[8]="Not found",8);var A=N.NOT_SUPPORTED_ERR=(E[9]="Not supported",9);var R=N.INUSE_ATTRIBUTE_ERR=(E[10]="Attribute in use",10);var P=N.INVALID_STATE_ERR=(E[11]="Invalid state",11);var M=N.SYNTAX_ERR=(E[12]="Syntax error",12);var I=N.INVALID_MODIFICATION_ERR=(E[13]="Invalid modification",13);var q=N.NAMESPACE_ERR=(E[14]="Invalid namespace",14);var k=N.INVALID_ACCESS_ERR=(E[15]="Invalid access",15);function DOMException(e,r){if(r instanceof Error){var n=r}else{n=this;Error.call(this,E[e]);this.message=E[e];if(Error.captureStackTrace)Error.captureStackTrace(this,DOMException)}n.code=e;if(r)this.message=this.message+": "+r;return n}DOMException.prototype=Error.prototype;copy(N,DOMException);function NodeList(){}NodeList.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,r){for(var n=[],i=0;i=0){var o=r.length-1;while(i0},lookupPrefix:function(e){var r=this;while(r){var n=r._nsMap;if(n){for(var i in n){if(Object.prototype.hasOwnProperty.call(n,i)&&n[i]===e){return i}}}r=r.nodeType==l?r.ownerDocument:r.parentNode}return null},lookupNamespaceURI:function(e){var r=this;while(r){var n=r._nsMap;if(n){if(Object.prototype.hasOwnProperty.call(n,e)){return n[e]}}r=r.nodeType==l?r.ownerDocument:r.parentNode}return null},isDefaultNamespace:function(e){var r=this.lookupPrefix(e);return r==null}};function _xmlEncoder(e){return e=="<"&&"<"||e==">"&&">"||e=="&"&&"&"||e=='"'&&"""||"&#"+e.charCodeAt()+";"}copy(s,Node);copy(s,Node.prototype);function _visitNode(e,r){if(r(e)){return true}if(e=e.firstChild){do{if(_visitNode(e,r)){return true}}while(e=e.nextSibling)}}function Document(){this.ownerDocument=this}function _onAddAttribute(e,r,n){e&&e._inc++;var i=n.namespaceURI;if(i===a.XMLNS){r._nsMap[n.prefix?n.localName:""]=n.value}}function _onRemoveAttribute(e,r,n,i){e&&e._inc++;var o=n.namespaceURI;if(o===a.XMLNS){delete r._nsMap[n.prefix?n.localName:""]}}function _onUpdateChild(e,r,n){if(e&&e._inc){e._inc++;var i=r.childNodes;if(n){i[i.length++]=n}else{var o=r.firstChild;var a=0;while(o){i[a++]=o;o=o.nextSibling}i.length=a;delete i[i.length]}}}function _removeChild(e,r){var n=r.previousSibling;var i=r.nextSibling;if(n){n.nextSibling=i}else{e.firstChild=i}if(i){i.previousSibling=n}else{e.lastChild=n}r.parentNode=null;r.previousSibling=null;r.nextSibling=null;_onUpdateChild(e.ownerDocument,e);return r}function hasValidParentNodeType(e){return e&&(e.nodeType===Node.DOCUMENT_NODE||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE||e.nodeType===Node.ELEMENT_NODE)}function hasInsertableNodeType(e){return e&&(isElementNode(e)||isTextNode(e)||isDocTypeNode(e)||e.nodeType===Node.DOCUMENT_FRAGMENT_NODE||e.nodeType===Node.COMMENT_NODE||e.nodeType===Node.PROCESSING_INSTRUCTION_NODE)}function isDocTypeNode(e){return e&&e.nodeType===Node.DOCUMENT_TYPE_NODE}function isElementNode(e){return e&&e.nodeType===Node.ELEMENT_NODE}function isTextNode(e){return e&&e.nodeType===Node.TEXT_NODE}function isElementInsertionPossible(e,r){var n=e.childNodes||[];if(o(n,isElementNode)||isDocTypeNode(r)){return false}var i=o(n,isDocTypeNode);return!(r&&i&&n.indexOf(i)>n.indexOf(r))}function isElementReplacementPossible(e,r){var n=e.childNodes||[];function hasElementChildThatIsNotChild(e){return isElementNode(e)&&e!==r}if(o(n,hasElementChildThatIsNotChild)){return false}var i=o(n,isDocTypeNode);return!(r&&i&&n.indexOf(i)>n.indexOf(r))}function assertPreInsertionValidity1to5(e,r,n){if(!hasValidParentNodeType(e)){throw new DOMException(O,"Unexpected parent node type "+e.nodeType)}if(n&&n.parentNode!==e){throw new DOMException(S,"child not in parent")}if(!hasInsertableNodeType(r)||isDocTypeNode(r)&&e.nodeType!==Node.DOCUMENT_NODE){throw new DOMException(O,"Unexpected node type "+r.nodeType+" for parent node type "+e.nodeType)}}function assertPreInsertionValidityInDocument(e,r,n){var i=e.childNodes||[];var a=r.childNodes||[];if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var s=a.filter(isElementNode);if(s.length>1||o(a,isTextNode)){throw new DOMException(O,"More than one element or text in fragment")}if(s.length===1&&!isElementInsertionPossible(e,n)){throw new DOMException(O,"Element in fragment can not be inserted before doctype")}}if(isElementNode(r)){if(!isElementInsertionPossible(e,n)){throw new DOMException(O,"Only one element can be added and only after doctype")}}if(isDocTypeNode(r)){if(o(i,isDocTypeNode)){throw new DOMException(O,"Only one doctype is allowed")}var u=o(i,isElementNode);if(n&&i.indexOf(u)1||o(a,isTextNode)){throw new DOMException(O,"More than one element or text in fragment")}if(s.length===1&&!isElementReplacementPossible(e,n)){throw new DOMException(O,"Element in fragment can not be inserted before doctype")}}if(isElementNode(r)){if(!isElementReplacementPossible(e,n)){throw new DOMException(O,"Only one element can be added and only after doctype")}}if(isDocTypeNode(r)){function hasDoctypeChildThatIsNotChild(e){return isDocTypeNode(e)&&e!==n}if(o(i,hasDoctypeChildThatIsNotChild)){throw new DOMException(O,"Only one doctype is allowed")}var u=o(i,isElementNode);if(n&&i.indexOf(u)0){_visitNode(n.documentElement,(function(o){if(o!==n&&o.nodeType===u){var a=o.getAttribute("class");if(a){var s=e===a;if(!s){var l=toOrderedSet(a);s=r.every(arrayIncludes(l))}if(s){i.push(o)}}}}))}return i}))},createElement:function(e){var r=new Element;r.ownerDocument=this;r.nodeName=e;r.tagName=e;r.localName=e;r.childNodes=new NodeList;var n=r.attributes=new NamedNodeMap;n._ownerElement=r;return r},createDocumentFragment:function(){var e=new DocumentFragment;e.ownerDocument=this;e.childNodes=new NodeList;return e},createTextNode:function(e){var r=new Text;r.ownerDocument=this;r.appendData(e);return r},createComment:function(e){var r=new Comment;r.ownerDocument=this;r.appendData(e);return r},createCDATASection:function(e){var r=new CDATASection;r.ownerDocument=this;r.appendData(e);return r},createProcessingInstruction:function(e,r){var n=new ProcessingInstruction;n.ownerDocument=this;n.tagName=n.target=e;n.nodeValue=n.data=r;return n},createAttribute:function(e){var r=new Attr;r.ownerDocument=this;r.name=e;r.nodeName=e;r.localName=e;r.specified=true;return r},createEntityReference:function(e){var r=new EntityReference;r.ownerDocument=this;r.nodeName=e;return r},createElementNS:function(e,r){var n=new Element;var i=r.split(":");var o=n.attributes=new NamedNodeMap;n.childNodes=new NodeList;n.ownerDocument=this;n.nodeName=r;n.tagName=r;n.namespaceURI=e;if(i.length==2){n.prefix=i[0];n.localName=i[1]}else{n.localName=r}o._ownerElement=n;return n},createAttributeNS:function(e,r){var n=new Attr;var i=r.split(":");n.ownerDocument=this;n.nodeName=r;n.name=r;n.namespaceURI=e;n.specified=true;if(i.length==2){n.prefix=i[0];n.localName=i[1]}else{n.localName=r}return n}};_extends(Document,Node);function Element(){this._nsMap={}}Element.prototype={nodeType:u,hasAttribute:function(e){return this.getAttributeNode(e)!=null},getAttribute:function(e){var r=this.getAttributeNode(e);return r&&r.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,r){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+r;this.setAttributeNode(n)},removeAttribute:function(e){var r=this.getAttributeNode(e);r&&this.removeAttributeNode(r)},appendChild:function(e){if(e.nodeType===y){return this.insertBefore(e,null)}else{return _appendSingleChild(this,e)}},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,r){var n=this.getAttributeNodeNS(e,r);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,r){return this.getAttributeNodeNS(e,r)!=null},getAttributeNS:function(e,r){var n=this.getAttributeNodeNS(e,r);return n&&n.value||""},setAttributeNS:function(e,r,n){var i=this.ownerDocument.createAttributeNS(e,r);i.value=i.nodeValue=""+n;this.setAttributeNode(i)},getAttributeNodeNS:function(e,r){return this.attributes.getNamedItemNS(e,r)},getElementsByTagName:function(e){return new LiveNodeList(this,(function(r){var n=[];_visitNode(r,(function(i){if(i!==r&&i.nodeType==u&&(e==="*"||i.tagName==e)){n.push(i)}}));return n}))},getElementsByTagNameNS:function(e,r){return new LiveNodeList(this,(function(n){var i=[];_visitNode(n,(function(o){if(o!==n&&o.nodeType===u&&(e==="*"||o.namespaceURI===e)&&(r==="*"||o.localName==r)){i.push(o)}}));return i}))}};Document.prototype.getElementsByTagName=Element.prototype.getElementsByTagName;Document.prototype.getElementsByTagNameNS=Element.prototype.getElementsByTagNameNS;_extends(Element,Node);function Attr(){}Attr.prototype.nodeType=l;_extends(Attr,Node);function CharacterData(){}CharacterData.prototype={data:"",substringData:function(e,r){return this.data.substring(e,e+r)},appendData:function(e){e=this.data+e;this.nodeValue=this.data=e;this.length=e.length},insertData:function(e,r){this.replaceData(e,0,r)},appendChild:function(e){throw new Error(E[O])},deleteData:function(e,r){this.replaceData(e,r,"")},replaceData:function(e,r,n){var i=this.data.substring(0,e);var o=this.data.substring(e+r);n=i+n+o;this.nodeValue=this.data=n;this.length=n.length}};_extends(CharacterData,Node);function Text(){}Text.prototype={nodeName:"#text",nodeType:c,splitText:function(e){var r=this.data;var n=r.substring(e);r=r.substring(0,e);this.data=this.nodeValue=r;this.length=r.length;var i=this.ownerDocument.createTextNode(n);if(this.parentNode){this.parentNode.insertBefore(i,this.nextSibling)}return i}};_extends(Text,CharacterData);function Comment(){}Comment.prototype={nodeName:"#comment",nodeType:m};_extends(Comment,CharacterData);function CDATASection(){}CDATASection.prototype={nodeName:"#cdata-section",nodeType:d};_extends(CDATASection,CharacterData);function DocumentType(){}DocumentType.prototype.nodeType=g;_extends(DocumentType,Node);function Notation(){}Notation.prototype.nodeType=_;_extends(Notation,Node);function Entity(){}Entity.prototype.nodeType=p;_extends(Entity,Node);function EntityReference(){}EntityReference.prototype.nodeType=f;_extends(EntityReference,Node);function DocumentFragment(){}DocumentFragment.prototype.nodeName="#document-fragment";DocumentFragment.prototype.nodeType=y;_extends(DocumentFragment,Node);function ProcessingInstruction(){}ProcessingInstruction.prototype.nodeType=h;_extends(ProcessingInstruction,Node);function XMLSerializer(){}XMLSerializer.prototype.serializeToString=function(e,r,n){return nodeSerializeToString.call(e,r,n)};Node.prototype.toString=nodeSerializeToString;function nodeSerializeToString(e,r){var n=[];var i=this.nodeType==9&&this.documentElement||this;var o=i.prefix;var a=i.namespaceURI;if(a&&o==null){var o=i.lookupPrefix(a);if(o==null){var s=[{namespace:a,prefix:null}]}}serializeToString(this,n,e,r,s);return n.join("")}function needNamespaceDefine(e,r,n){var i=e.prefix||"";var o=e.namespaceURI;if(!o){return false}if(i==="xml"&&o===a.XML||o===a.XMLNS){return false}var s=n.length;while(s--){var u=n[s];if(u.prefix===i){return u.namespace!==o}}return true}function addSerializedAttribute(e,r,n){e.push(" ",r,'="',n.replace(/[<>&"\t\n\r]/g,_xmlEncoder),'"')}function serializeToString(e,r,n,i,o){if(!o){o=[]}if(i){e=i(e);if(e){if(typeof e=="string"){r.push(e);return}}else{return}}switch(e.nodeType){case u:var s=e.attributes;var p=s.length;var _=e.firstChild;var N=e.tagName;n=a.isHTML(e.namespaceURI)||n;var E=N;if(!n&&!e.prefix&&e.namespaceURI){var w;for(var b=0;b=0;O--){var T=o[O];if(T.prefix===""&&T.namespace===e.namespaceURI){w=T.namespace;break}}}if(w!==e.namespaceURI){for(var O=o.length-1;O>=0;O--){var T=o[O];if(T.namespace===e.namespaceURI){if(T.prefix){E=T.prefix+":"+N}break}}}}r.push("<",E);for(var D=0;D");if(n&&/^script$/i.test(N)){while(_){if(_.data){r.push(_.data)}else{serializeToString(_,r,n,i,o.slice())}_=_.nextSibling}}else{while(_){serializeToString(_,r,n,i,o.slice());_=_.nextSibling}}r.push("")}else{r.push("/>")}return;case v:case y:var _=e.firstChild;while(_){serializeToString(_,r,n,i,o.slice());_=_.nextSibling}return;case l:return addSerializedAttribute(r,e.name,e.value);case c:return r.push(e.data.replace(/[<&>]/g,_xmlEncoder));case d:return r.push("");case m:return r.push("\x3c!--",e.data,"--\x3e");case g:var A=e.publicId;var R=e.systemId;r.push("")}else if(R&&R!="."){r.push(" SYSTEM ",R,">")}else{var P=e.internalSubset;if(P){r.push(" [",P,"]")}r.push(">")}return;case h:return r.push("");case f:return r.push("&",e.nodeName,";");default:r.push("??",e.nodeName)}}function importNode(e,r,n){var i;switch(r.nodeType){case u:i=r.cloneNode(false);i.ownerDocument=e;case y:break;case l:n=true;break}if(!i){i=r.cloneNode(false)}i.ownerDocument=e;i.parentNode=null;if(n){var o=r.firstChild;while(o){i.appendChild(importNode(e,o,n));o=o.nextSibling}}return i}function cloneNode(e,r,n){var i=new r.constructor;for(var o in r){if(Object.prototype.hasOwnProperty.call(r,o)){var a=r[o];if(typeof a!="object"){if(a!=i[o]){i[o]=a}}}}if(r.childNodes){i.childNodes=new NodeList}i.ownerDocument=e;switch(i.nodeType){case u:var s=r.attributes;var c=i.attributes=new NamedNodeMap;var d=s.length;c._ownerElement=i;for(var f=0;f{var i=n(756).freeze;r.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});r.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"});r.entityMap=r.HTML_ENTITIES},213:(e,r,n)=>{var i=n(389);r.DOMImplementation=i.DOMImplementation;r.XMLSerializer=i.XMLSerializer;r.DOMParser=n(72).DOMParser},58:(e,r,n)=>{var i=n(756).NAMESPACE;var o=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;var a=new RegExp("[\\-\\.0-9"+o.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");var s=new RegExp("^"+o.source+a.source+"*(?::"+o.source+a.source+"*)?$");var u=0;var l=1;var c=2;var d=3;var f=4;var p=5;var h=6;var m=7;function ParseError(e,r){this.message=e;this.locator=r;if(Error.captureStackTrace)Error.captureStackTrace(this,ParseError)}ParseError.prototype=new Error;ParseError.prototype.name=ParseError.name;function XMLReader(){}XMLReader.prototype={parse:function(e,r,n){var i=this.domBuilder;i.startDocument();_copy(r,r={});parse(e,r,n,i,this.errorHandler);i.endDocument()}};function parse(e,r,n,o,a){function fixedFromCharCode(e){if(e>65535){e-=65536;var r=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(r,n)}else{return String.fromCharCode(e)}}function entityReplacer(e){var r=e.slice(1,-1);if(Object.hasOwnProperty.call(n,r)){return n[r]}else if(r.charAt(0)==="#"){return fixedFromCharCode(parseInt(r.substr(1).replace("x","0x")))}else{a.error("entity not found:"+e);return e}}function appendText(r){if(r>p){var n=e.substring(p,r).replace(/&#?\w+;/g,entityReplacer);c&&position(p);o.characters(n,0,r-p);p=r}}function position(r,n){while(r>=u&&(n=l.exec(e))){s=n.index;u=s+n[0].length;c.lineNumber++}c.columnNumber=r-s+1}var s=0;var u=0;var l=/.*(?:\r\n?|\n)|.*$/g;var c=o.locator;var d=[{currentNSMap:r}];var f={};var p=0;while(true){try{var h=e.indexOf("<",p);if(h<0){if(!e.substr(p).match(/^\s*$/)){var m=o.doc;var v=m.createTextNode(e.substr(p));m.appendChild(v);o.currentElement=v}return}if(h>p){appendText(h)}switch(e.charAt(h+1)){case"/":var g=e.indexOf(">",h+3);var y=e.substring(h+2,g).replace(/[ \t\n\r]+$/g,"");var _=d.pop();if(g<0){y=e.substring(h+2).replace(/[\s<].*/,"");a.error("end tag name: "+y+" is not complete:"+_.tagName);g=h+1+y.length}else if(y.match(/\sp){p=g}else{appendText(Math.max(h,p)+1)}}}function copyLocator(e,r){r.lineNumber=e.lineNumber;r.columnNumber=e.columnNumber;return r}function parseElementStartPart(e,r,n,o,a,s){function addAttribute(e,r,i){if(n.attributeNames.hasOwnProperty(e)){s.fatalError("Attribute "+e+" redefined")}n.addValue(e,r.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,a),i)}var v;var g;var y=++r;var _=u;while(true){var N=e.charAt(y);switch(N){case"=":if(_===l){v=e.slice(r,y);_=d}else if(_===c){_=d}else{throw new Error("attribute equal must after attrName")}break;case"'":case'"':if(_===d||_===l){if(_===l){s.warning('attribute value must after "="');v=e.slice(r,y)}r=y+1;y=e.indexOf(N,r);if(y>0){g=e.slice(r,y);addAttribute(v,g,r-1);_=p}else{throw new Error("attribute value no end '"+N+"' match")}}else if(_==f){g=e.slice(r,y);addAttribute(v,g,r);s.warning('attribute "'+v+'" missed start quot('+N+")!!");r=y+1;_=p}else{throw new Error('attribute value must after "="')}break;case"/":switch(_){case u:n.setTagName(e.slice(r,y));case p:case h:case m:_=m;n.closed=true;case f:case l:case c:break;default:throw new Error("attribute invalid close char('/')")}break;case"":s.error("unexpected end of input");if(_==u){n.setTagName(e.slice(r,y))}return y;case">":switch(_){case u:n.setTagName(e.slice(r,y));case p:case h:case m:break;case f:case l:g=e.slice(r,y);if(g.slice(-1)==="/"){n.closed=true;g=g.slice(0,-1)}case c:if(_===c){g=v}if(_==f){s.warning('attribute "'+g+'" missed quot(")!');addAttribute(v,g,r)}else{if(!i.isHTML(o[""])||!g.match(/^(?:disabled|checked|selected)$/i)){s.warning('attribute "'+g+'" missed value!! "'+g+'" instead!!')}addAttribute(g,g,r)}break;case d:throw new Error("attribute value missed!!")}return y;case"€":N=" ";default:if(N<=" "){switch(_){case u:n.setTagName(e.slice(r,y));_=h;break;case l:v=e.slice(r,y);_=c;break;case f:var g=e.slice(r,y);s.warning('attribute "'+g+'" missed quot(")!!');addAttribute(v,g,r);case p:_=h;break}}else{switch(_){case c:var E=n.tagName;if(!i.isHTML(o[""])||!v.match(/^(?:disabled|checked|selected)$/i)){s.warning('attribute "'+v+'" missed value!! "'+v+'" instead2!!')}addAttribute(v,v,r);r=y;_=l;break;case p:s.warning('attribute space is required"'+v+'"!!');case h:_=l;r=y;break;case d:_=f;r=y;break;case m:throw new Error("elements closed character '/' and '>' must be connected to")}}}y++}}function appendElement(e,r,n){var o=e.tagName;var a=null;var s=e.length;while(s--){var u=e[s];var l=u.qName;var c=u.value;var d=l.indexOf(":");if(d>0){var f=u.prefix=l.slice(0,d);var p=l.slice(d+1);var h=f==="xmlns"&&p}else{p=l;f=null;h=l==="xmlns"&&""}u.localName=p;if(h!==false){if(a==null){a={};_copy(n,n={})}n[h]=a[h]=c;u.uri=i.XMLNS;r.startPrefixMapping(h,c)}}var s=e.length;while(s--){u=e[s];var f=u.prefix;if(f){if(f==="xml"){u.uri=i.XML}if(f!=="xmlns"){u.uri=n[f||""]}}}var d=o.indexOf(":");if(d>0){f=e.prefix=o.slice(0,d);p=e.localName=o.slice(d+1)}else{f=null;p=e.localName=o}var m=e.uri=n[f||""];r.startElement(m,p,o,e);if(e.closed){r.endElement(m,p,o);if(a){for(f in a){if(Object.prototype.hasOwnProperty.call(a,f)){r.endPrefixMapping(f)}}}}else{e.currentNSMap=n;e.localNSMap=a;return true}}function parseHtmlSpecialContent(e,r,n,i,o){if(/^(?:script|textarea)$/i.test(n)){var a=e.indexOf("",r);var s=e.substring(r+1,a);if(/[&<]/.test(s)){if(/^script$/i.test(n)){o.characters(s,0,s.length);return a}s=s.replace(/&#?\w+;/g,i);o.characters(s,0,s.length);return a}}return r+1}function fixSelfClosed(e,r,n,i){var o=i[n];if(o==null){o=e.lastIndexOf("");if(or){n.comment(e,r+4,a-r-4);return a+3}else{i.error("Unclosed comment");return-1}}else{return-1}default:if(e.substr(r+3,6)=="CDATA["){var a=e.indexOf("]]>",r+9);n.startCDATA();n.characters(e,r+9,a-r-9);n.endCDATA();return a+3}var s=split(e,r);var u=s.length;if(u>1&&/!doctype/i.test(s[0][0])){var l=s[1][0];var c=false;var d=false;if(u>3){if(/^public$/i.test(s[2][0])){c=s[3][0];d=u>4&&s[4][0]}else if(/^system$/i.test(s[2][0])){d=s[3][0]}}var f=s[u-1];n.startDTD(l,c,d);n.endDTD();return f.index+f[0].length}}return-1}function parseInstruction(e,r,n){var i=e.indexOf("?>",r);if(i){var o=e.substring(r,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){var a=o[0].length;n.processingInstruction(o[1],o[2]);return i+2}else{return-1}}return-1}function ElementAttributes(){this.attributeNames={}}ElementAttributes.prototype={setTagName:function(e){if(!s.test(e)){throw new Error("invalid tagName:"+e)}this.tagName=e},addValue:function(e,r,n){if(!s.test(e)){throw new Error("invalid attribute:"+e)}this.attributeNames[e]=this.length;this[this.length++]={qName:e,value:r,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};function split(e,r){var n;var i=[];var o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;o.lastIndex=r;o.exec(e);while(n=o.exec(e)){i.push(n);if(n[1])return i}}r.XMLReader=XMLReader;r.ParseError=ParseError},294:(e,r,n)=>{e.exports=n(219)},219:(e,r,n)=>{"use strict";var i=n(808);var o=n(404);var a=n(685);var s=n(687);var u=n(361);var l=n(491);var c=n(837);r.httpOverHttp=httpOverHttp;r.httpsOverHttp=httpsOverHttp;r.httpOverHttps=httpOverHttps;r.httpsOverHttps=httpsOverHttps;function httpOverHttp(e){var r=new TunnelingAgent(e);r.request=a.request;return r}function httpsOverHttp(e){var r=new TunnelingAgent(e);r.request=a.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function httpOverHttps(e){var r=new TunnelingAgent(e);r.request=s.request;return r}function httpsOverHttps(e){var r=new TunnelingAgent(e);r.request=s.request;r.createSocket=createSecureSocket;r.defaultPort=443;return r}function TunnelingAgent(e){var r=this;r.options=e||{};r.proxyOptions=r.options.proxy||{};r.maxSockets=r.options.maxSockets||a.Agent.defaultMaxSockets;r.requests=[];r.sockets=[];r.on("free",(function onFree(e,n,i,o){var a=toOptions(n,i,o);for(var s=0,u=r.requests.length;s=this.maxSockets){o.requests.push(a);return}o.createSocket(a,(function(r){r.on("free",onFree);r.on("close",onCloseOrRemove);r.on("agentRemove",onCloseOrRemove);e.onSocket(r);function onFree(){o.emit("free",r,a)}function onCloseOrRemove(e){o.removeSocket(r);r.removeListener("free",onFree);r.removeListener("close",onCloseOrRemove);r.removeListener("agentRemove",onCloseOrRemove)}}))};TunnelingAgent.prototype.createSocket=function createSocket(e,r){var n=this;var i={};n.sockets.push(i);var o=mergeOptions({},n.proxyOptions,{method:"CONNECT",path:e.host+":"+e.port,agent:false,headers:{host:e.host+":"+e.port}});if(e.localAddress){o.localAddress=e.localAddress}if(o.proxyAuth){o.headers=o.headers||{};o.headers["Proxy-Authorization"]="Basic "+new Buffer(o.proxyAuth).toString("base64")}d("making CONNECT request");var a=n.request(o);a.useChunkedEncodingByDefault=false;a.once("response",onResponse);a.once("upgrade",onUpgrade);a.once("connect",onConnect);a.once("error",onError);a.end();function onResponse(e){e.upgrade=true}function onUpgrade(e,r,n){process.nextTick((function(){onConnect(e,r,n)}))}function onConnect(o,s,u){a.removeAllListeners();s.removeAllListeners();if(o.statusCode!==200){d("tunneling socket could not be established, statusCode=%d",o.statusCode);s.destroy();var l=new Error("tunneling socket could not be established, "+"statusCode="+o.statusCode);l.code="ECONNRESET";e.request.emit("error",l);n.removeSocket(i);return}if(u.length>0){d("got illegal response body from proxy");s.destroy();var l=new Error("got illegal response body from proxy");l.code="ECONNRESET";e.request.emit("error",l);n.removeSocket(i);return}d("tunneling connection has established");n.sockets[n.sockets.indexOf(i)]=s;return r(s)}function onError(r){a.removeAllListeners();d("tunneling socket could not be established, cause=%s\n",r.message,r.stack);var o=new Error("tunneling socket could not be established, "+"cause="+r.message);o.code="ECONNRESET";e.request.emit("error",o);n.removeSocket(i)}};TunnelingAgent.prototype.removeSocket=function removeSocket(e){var r=this.sockets.indexOf(e);if(r===-1){return}this.sockets.splice(r,1);var n=this.requests.shift();if(n){this.createSocket(n,(function(e){n.request.onSocket(e)}))}};function createSecureSocket(e,r){var n=this;TunnelingAgent.prototype.createSocket.call(n,e,(function(i){var a=e.request.getHeader("host");var s=mergeOptions({},n.options,{socket:i,servername:a?a.replace(/:.*$/,""):e.host});var u=o.connect(0,s);n.sockets[n.sockets.indexOf(i)]=u;r(u)}))}function toOptions(e,r,n){if(typeof e==="string"){return{host:e,port:r,localAddress:n}}return e}function mergeOptions(e){for(var r=1,n=arguments.length;r{"use strict";Object.defineProperty(r,"__esModule",{value:true});Object.defineProperty(r,"v1",{enumerable:true,get:function(){return i.default}});Object.defineProperty(r,"v3",{enumerable:true,get:function(){return o.default}});Object.defineProperty(r,"v4",{enumerable:true,get:function(){return a.default}});Object.defineProperty(r,"v5",{enumerable:true,get:function(){return s.default}});Object.defineProperty(r,"NIL",{enumerable:true,get:function(){return u.default}});Object.defineProperty(r,"version",{enumerable:true,get:function(){return l.default}});Object.defineProperty(r,"validate",{enumerable:true,get:function(){return c.default}});Object.defineProperty(r,"stringify",{enumerable:true,get:function(){return d.default}});Object.defineProperty(r,"parse",{enumerable:true,get:function(){return f.default}});var i=_interopRequireDefault(n(628));var o=_interopRequireDefault(n(409));var a=_interopRequireDefault(n(122));var s=_interopRequireDefault(n(120));var u=_interopRequireDefault(n(332));var l=_interopRequireDefault(n(595));var c=_interopRequireDefault(n(900));var d=_interopRequireDefault(n(950));var f=_interopRequireDefault(n(746));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}},569:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(113));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function md5(e){if(Array.isArray(e)){e=Buffer.from(e)}else if(typeof e==="string"){e=Buffer.from(e,"utf8")}return i.default.createHash("md5").update(e).digest()}var o=md5;r["default"]=o},332:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n="00000000-0000-0000-0000-000000000000";r["default"]=n},746:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function parse(e){if(!(0,i.default)(e)){throw TypeError("Invalid UUID")}let r;const n=new Uint8Array(16);n[0]=(r=parseInt(e.slice(0,8),16))>>>24;n[1]=r>>>16&255;n[2]=r>>>8&255;n[3]=r&255;n[4]=(r=parseInt(e.slice(9,13),16))>>>8;n[5]=r&255;n[6]=(r=parseInt(e.slice(14,18),16))>>>8;n[7]=r&255;n[8]=(r=parseInt(e.slice(19,23),16))>>>8;n[9]=r&255;n[10]=(r=parseInt(e.slice(24,36),16))/1099511627776&255;n[11]=r/4294967296&255;n[12]=r>>>24&255;n[13]=r>>>16&255;n[14]=r>>>8&255;n[15]=r&255;return n}var o=parse;r["default"]=o},814:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var n=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;r["default"]=n},807:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=rng;var i=_interopRequireDefault(n(113));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=new Uint8Array(256);let a=o.length;function rng(){if(a>o.length-16){i.default.randomFillSync(o);a=0}return o.slice(a,a+=16)}},274:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(113));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function sha1(e){if(Array.isArray(e)){e=Buffer.from(e)}else if(typeof e==="string"){e=Buffer.from(e,"utf8")}return i.default.createHash("sha1").update(e).digest()}var o=sha1;r["default"]=o},950:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const o=[];for(let e=0;e<256;++e){o.push((e+256).toString(16).substr(1))}function stringify(e,r=0){const n=(o[e[r+0]]+o[e[r+1]]+o[e[r+2]]+o[e[r+3]]+"-"+o[e[r+4]]+o[e[r+5]]+"-"+o[e[r+6]]+o[e[r+7]]+"-"+o[e[r+8]]+o[e[r+9]]+"-"+o[e[r+10]]+o[e[r+11]]+o[e[r+12]]+o[e[r+13]]+o[e[r+14]]+o[e[r+15]]).toLowerCase();if(!(0,i.default)(n)){throw TypeError("Stringified UUID is invalid")}return n}var a=stringify;r["default"]=a},628:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(807));var o=_interopRequireDefault(n(950));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let a;let s;let u=0;let l=0;function v1(e,r,n){let c=r&&n||0;const d=r||new Array(16);e=e||{};let f=e.node||a;let p=e.clockseq!==undefined?e.clockseq:s;if(f==null||p==null){const r=e.random||(e.rng||i.default)();if(f==null){f=a=[r[0]|1,r[1],r[2],r[3],r[4],r[5]]}if(p==null){p=s=(r[6]<<8|r[7])&16383}}let h=e.msecs!==undefined?e.msecs:Date.now();let m=e.nsecs!==undefined?e.nsecs:l+1;const v=h-u+(m-l)/1e4;if(v<0&&e.clockseq===undefined){p=p+1&16383}if((v<0||h>u)&&e.nsecs===undefined){m=0}if(m>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}u=h;l=m;s=p;h+=122192928e5;const g=((h&268435455)*1e4+m)%4294967296;d[c++]=g>>>24&255;d[c++]=g>>>16&255;d[c++]=g>>>8&255;d[c++]=g&255;const y=h/4294967296*1e4&268435455;d[c++]=y>>>8&255;d[c++]=y&255;d[c++]=y>>>24&15|16;d[c++]=y>>>16&255;d[c++]=p>>>8|128;d[c++]=p&255;for(let e=0;e<6;++e){d[c+e]=f[e]}return r||(0,o.default)(d)}var c=v1;r["default"]=c},409:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(998));var o=_interopRequireDefault(n(569));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a=(0,i.default)("v3",48,o.default);var s=a;r["default"]=s},998:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=_default;r.URL=r.DNS=void 0;var i=_interopRequireDefault(n(950));var o=_interopRequireDefault(n(746));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function stringToBytes(e){e=unescape(encodeURIComponent(e));const r=[];for(let n=0;n{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(807));var o=_interopRequireDefault(n(950));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function v4(e,r,n){e=e||{};const a=e.random||(e.rng||i.default)();a[6]=a[6]&15|64;a[8]=a[8]&63|128;if(r){n=n||0;for(let e=0;e<16;++e){r[n+e]=a[e]}return r}return(0,o.default)(a)}var a=v4;r["default"]=a},120:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(998));var o=_interopRequireDefault(n(274));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const a=(0,i.default)("v5",80,o.default);var s=a;r["default"]=s},900:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(814));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function validate(e){return typeof e==="string"&&i.default.test(e)}var o=validate;r["default"]=o},595:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r["default"]=void 0;var i=_interopRequireDefault(n(900));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function version(e){if(!(0,i.default)(e)){throw TypeError("Invalid UUID")}return parseInt(e.substr(14,1),16)}var o=version;r["default"]=o},491:e=>{"use strict";e.exports=require("assert")},113:e=>{"use strict";e.exports=require("crypto")},361:e=>{"use strict";e.exports=require("events")},147:e=>{"use strict";e.exports=require("fs")},685:e=>{"use strict";e.exports=require("http")},687:e=>{"use strict";e.exports=require("https")},808:e=>{"use strict";e.exports=require("net")},37:e=>{"use strict";e.exports=require("os")},17:e=>{"use strict";e.exports=require("path")},404:e=>{"use strict";e.exports=require("tls")},837:e=>{"use strict";e.exports=require("util")}};var r={};function __nccwpck_require__(n){var i=r[n];if(i!==undefined){return i.exports}var o=r[n]={exports:{}};var a=true;try{e[n].call(o.exports,o,o.exports,__nccwpck_require__);a=false}finally{if(a)delete r[n]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(109);module.exports=n})(); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map index 6197026..521269b 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","names":["__createBinding","this","Object","create","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__setModuleDefault","v","value","__importStar","mod","result","prototype","hasOwnProperty","call","__awaiter","thisArg","_arguments","P","generator","adopt","resolve","Promise","reject","fulfilled","step","next","e","rejected","done","then","apply","exports","core","__webpack_require__","fs_1","xmldom_1","put","name","info","setOutput","DocumentWrapper","constructor","docElement","getLastText","tagName","nodes","getElementsByTagName","length","textContent","createAsync","projPath","xmlText","promises","readFile","_a","Error","domDoc","DOMParser","parseFromString","documentElement","run","getInput","debug","found","doc","versionPrefix","versionSuffix","version","hyphenPos","indexOf","substr","packageVersion","assemblyVersion","fileVersion","informationalVersion","error","setFailed","message","issue","issueCommand","os","utils_1","command","properties","cmd","Command","process","stdout","write","toString","EOL","CMD_STRING","cmdStr","keys","first","key","val","escapeProperty","escapeData","s","toCommandValue","replace","getIDToken","getState","saveState","group","endGroup","startGroup","notice","warning","isDebug","setCommandEcho","getBooleanInput","getMultilineInput","addPath","setSecret","exportVariable","ExitCode","command_1","file_command_1","path","oidc_utils_1","convertedVal","env","filePath","issueFileCommand","prepareKeyValueMessage","secret","inputPath","delimiter","options","toUpperCase","required","trimWhitespace","trim","inputs","split","filter","x","map","input","trueValue","falseValue","includes","TypeError","enabled","exitCode","Failure","toCommandProperties","fn","aud","OidcClient","summary_1","summary","summary_2","markdownSummary","path_utils_1","toPosixPath","toWin32Path","toPlatformPath","fs","uuid_1","existsSync","appendFileSync","encoding","v4","convertedValue","http_client_1","auth_1","core_1","createHttpClient","allowRetry","maxRetry","requestOptions","allowRetries","maxRetries","HttpClient","BearerCredentialHandler","getRequestToken","token","getIDTokenUrl","runtimeUrl","getCall","id_token_url","httpclient","res","getJson","catch","statusCode","id_token","audience","encodedAudience","encodeURIComponent","pth","sep","SUMMARY_DOCS_URL","SUMMARY_ENV_VAR","os_1","access","appendFile","writeFile","Summary","_buffer","_filePath","pathFromEnv","constants","R_OK","W_OK","wrap","tag","content","attrs","htmlAttrs","entries","join","overwrite","writeFunc","emptyBuffer","clear","stringify","isEmptyBuffer","addRaw","text","addEOL","addCodeBlock","code","lang","assign","element","addList","items","ordered","listItems","item","addTable","rows","tableBody","row","cells","cell","header","data","colspan","rowspan","addDetails","label","addImage","src","alt","width","height","addHeading","level","allowedTag","addSeparator","addBreak","addQuote","cite","addLink","href","_summary","String","JSON","annotationProperties","title","file","line","startLine","endLine","col","startColumn","endColumn","PersonalAccessTokenCredentialHandler","BasicCredentialHandler","username","password","prepareRequest","headers","Buffer","from","canHandleAuthentication","handleAuthentication","isHttps","HttpClientResponse","HttpClientError","getProxyUrl","MediaTypes","Headers","HttpCodes","http","https","pm","tunnel","serverUrl","proxyUrl","URL","HttpRedirectCodes","MovedPermanently","ResourceMoved","SeeOther","TemporaryRedirect","PermanentRedirect","HttpResponseRetryCodes","BadGateway","ServiceUnavailable","GatewayTimeout","RetryableHttpVerbs","ExponentialBackoffCeiling","ExponentialBackoffTimeSlice","super","setPrototypeOf","readBody","output","alloc","on","chunk","concat","requestUrl","parsedUrl","protocol","userAgent","handlers","_ignoreSslError","_allowRedirects","_allowRedirectDowngrade","_maxRedirects","_allowRetries","_maxRetries","_keepAlive","_disposed","ignoreSslError","_socketTimeout","socketTimeout","allowRedirects","allowRedirectDowngrade","maxRedirects","Math","max","keepAlive","additionalHeaders","request","del","post","patch","head","sendStream","verb","stream","Accept","_getExistingOrDefaultHeader","ApplicationJson","_processResponse","postJson","obj","ContentType","putJson","patchJson","_prepareRequest","maxTries","numTries","response","requestRaw","Unauthorized","authenticationHandler","handler","redirectsRemaining","redirectUrl","parsedRedirectUrl","hostname","toLowerCase","_performExponentialBackoff","dispose","_agent","destroy","callbackForResult","err","requestRawWithCallback","onResult","byteLength","callbackCalled","handleResult","req","httpModule","msg","socket","sock","setTimeout","end","pipe","getAgent","_getAgent","method","usingSsl","defaultPort","host","port","parseInt","pathname","search","_mergeHeaders","agent","lowercaseKeys","_default","clientHeader","useProxy","_proxyAgent","maxSockets","globalAgent","agentOptions","proxy","proxyAuth","tunnelAgent","overHttps","httpsOverHttps","httpsOverHttp","httpOverHttps","httpOverHttp","Agent","rejectUnauthorized","retryNumber","min","ms","pow","NotFound","dateTimeDeserializer","a","Date","isNaN","valueOf","contents","deserializeDates","parse","reduce","c","checkBypass","reqUrl","proxyVar","noProxy","reqPort","Number","upperReqHosts","push","upperNoProxyItem","some","find","list","predicate","ac","Array","i","freeze","object","oc","target","source","MIME_TYPE","HTML","isHTML","XML_APPLICATION","XML_TEXT","XML_XHTML_APPLICATION","XML_SVG_IMAGE","NAMESPACE","uri","SVG","XML","XMLNS","conventions","dom","entities","sax","DOMImplementation","ParseError","XMLReader","normalizeLineEndings","locator","mimeType","domBuilder","DOMHandler","errorHandler","defaultNSMap","xmlns","test","entityMap","HTML_ENTITIES","XML_ENTITIES","setDocumentLocator","buildErrorHandler","xml","normalize","errorImpl","isCallback","Function","build","_locator","cdata","position","node","lineNumber","columnNumber","startDocument","createDocument","documentURI","systemId","startElement","namespaceURI","localName","qName","el","createElementNS","len","appendElement","currentElement","getURI","getValue","getQName","attr","createAttributeNS","getLocator","nodeValue","setAttributeNode","endElement","current","parentNode","startPrefixMapping","prefix","endPrefixMapping","processingInstruction","ins","createProcessingInstruction","ignorableWhitespace","ch","start","characters","chars","_toString","arguments","charNode","createCDATASection","createTextNode","appendChild","skippedEntity","endDocument","comment","comm","createComment","startCDATA","endCDATA","startDTD","publicId","impl","implementation","createDocumentType","dt","doctype","console","warn","fatalError","l","java","hander","__webpack_unused_export__","notEmptyString","splitOnASCIIWhitespace","orderedSetReducer","toOrderedSet","arrayIncludes","copy","dest","p","_extends","Class","Super","pt","t","NodeType","ELEMENT_NODE","ATTRIBUTE_NODE","TEXT_NODE","CDATA_SECTION_NODE","ENTITY_REFERENCE_NODE","ENTITY_NODE","PROCESSING_INSTRUCTION_NODE","COMMENT_NODE","DOCUMENT_NODE","DOCUMENT_TYPE_NODE","DOCUMENT_FRAGMENT_NODE","NOTATION_NODE","ExceptionCode","ExceptionMessage","INDEX_SIZE_ERR","DOMSTRING_SIZE_ERR","HIERARCHY_REQUEST_ERR","WRONG_DOCUMENT_ERR","INVALID_CHARACTER_ERR","NO_DATA_ALLOWED_ERR","NO_MODIFICATION_ALLOWED_ERR","NOT_FOUND_ERR","NOT_SUPPORTED_ERR","INUSE_ATTRIBUTE_ERR","INVALID_STATE_ERR","SYNTAX_ERR","INVALID_MODIFICATION_ERR","NAMESPACE_ERR","INVALID_ACCESS_ERR","DOMException","captureStackTrace","NodeList","index","nodeFilter","buf","serializeToString","LiveNodeList","refresh","_node","_refresh","_updateLiveList","inc","_inc","ownerDocument","ls","__set__","NamedNodeMap","_findNodeIndex","_addNamedNode","newAttr","oldAttr","ownerElement","_onRemoveAttribute","_onAddAttribute","_removeNamedNode","lastIndex","getNamedItem","nodeName","setNamedItem","_ownerElement","setNamedItemNS","getNamedItemNS","removeNamedItem","removeNamedItemNS","hasFeature","feature","qualifiedName","Document","childNodes","root","DocumentType","Node","firstChild","lastChild","previousSibling","nextSibling","attributes","insertBefore","newChild","refChild","_insertBefore","replaceChild","oldChild","assertPreReplacementValidityInDocument","removeChild","_removeChild","hasChildNodes","cloneNode","deep","child","nodeType","appendData","isSupported","hasAttributes","lookupPrefix","_nsMap","n","lookupNamespaceURI","isDefaultNamespace","_xmlEncoder","charCodeAt","_visitNode","callback","ns","remove","_onUpdateChild","cs","previous","hasValidParentNodeType","hasInsertableNodeType","isElementNode","isTextNode","isDocTypeNode","isElementInsertionPossible","parentChildNodes","docTypeNode","isElementReplacementPossible","hasElementChildThatIsNotChild","assertPreInsertionValidity1to5","parent","assertPreInsertionValidityInDocument","nodeChildNodes","nodeChildElements","parentElementChild","hasDoctypeChildThatIsNotChild","_inDocumentAssertion","cp","newFirst","newLast","pre","_appendSingleChild","importNode","importedNode","getElementById","id","rtv","getAttribute","getElementsByClassName","classNames","classNamesSet","base","nodeClassNames","matches","nodeClassNamesSet","every","createElement","Element","createDocumentFragment","DocumentFragment","Text","Comment","CDATASection","ProcessingInstruction","createAttribute","Attr","specified","createEntityReference","EntityReference","pl","hasAttribute","getAttributeNode","setAttribute","removeAttribute","removeAttributeNode","setAttributeNodeNS","removeAttributeNS","old","getAttributeNodeNS","hasAttributeNS","getAttributeNS","setAttributeNS","getElementsByTagNameNS","CharacterData","substringData","offset","count","substring","insertData","replaceData","deleteData","splitText","newText","newNode","Notation","Entity","XMLSerializer","isHtml","nodeSerializeToString","refNode","visibleNamespaces","namespace","needNamespaceDefine","addSerializedAttribute","prefixedNodeName","defaultNS","ai","nsi","slice","pubid","sysid","sub","internalSubset","node2","attrs2","$$length","getTextContent","set","amp","apos","gt","lt","quot","Agrave","Aacute","Acirc","Atilde","Auml","Aring","AElig","Ccedil","Egrave","Eacute","Ecirc","Euml","Igrave","Iacute","Icirc","Iuml","ETH","Ntilde","Ograve","Oacute","Ocirc","Otilde","Ouml","Oslash","Ugrave","Uacute","Ucirc","Uuml","Yacute","THORN","szlig","agrave","aacute","acirc","atilde","auml","aring","aelig","ccedil","egrave","eacute","ecirc","euml","igrave","iacute","icirc","iuml","eth","ntilde","ograve","oacute","ocirc","otilde","ouml","oslash","ugrave","uacute","ucirc","uuml","yacute","thorn","yuml","nbsp","iexcl","cent","pound","curren","yen","brvbar","sect","uml","ordf","laquo","not","shy","reg","macr","deg","plusmn","sup2","sup3","acute","micro","para","middot","cedil","sup1","ordm","raquo","frac14","frac12","frac34","iquest","times","divide","forall","part","exist","empty","nabla","isin","notin","ni","prod","sum","minus","lowast","radic","prop","infin","ang","and","or","cap","cup","int","there4","sim","cong","asymp","ne","equiv","le","ge","sup","nsub","sube","supe","oplus","otimes","perp","sdot","Alpha","Beta","Gamma","Delta","Epsilon","Zeta","Eta","Theta","Iota","Kappa","Lambda","Mu","Nu","Xi","Omicron","Pi","Rho","Sigma","Tau","Upsilon","Phi","Chi","Psi","Omega","alpha","beta","gamma","delta","epsilon","zeta","eta","theta","iota","kappa","lambda","mu","nu","xi","omicron","pi","rho","sigmaf","sigma","tau","upsilon","phi","chi","psi","omega","thetasym","upsih","piv","OElig","oelig","Scaron","scaron","Yuml","fnof","circ","tilde","ensp","emsp","thinsp","zwnj","zwj","lrm","rlm","ndash","mdash","lsquo","rsquo","sbquo","ldquo","rdquo","bdquo","dagger","Dagger","bull","hellip","permil","prime","Prime","lsaquo","rsaquo","oline","euro","trade","larr","uarr","rarr","darr","harr","crarr","lceil","rceil","lfloor","rfloor","loz","spades","clubs","hearts","diams","nameStartChar","nameChar","RegExp","tagNamePattern","S_TAG","S_ATTR","S_ATTR_SPACE","S_EQ","S_ATTR_NOQUOT_VALUE","S_ATTR_END","S_TAG_SPACE","S_TAG_CLOSE","_copy","defaultNSMapCopy","fixedFromCharCode","surrogate1","surrogate2","fromCharCode","entityReplacer","charAt","appendText","xt","lineEnd","linePattern","exec","lineStart","parseStack","currentNSMap","closeMap","tagStart","match","config","pop","localNSMap","endMatch","endIgnoreCaseMach","parseInstruction","parseDCC","ElementAttributes","parseElementStartPart","closed","fixSelfClosed","locator2","copyLocator","parseHtmlSpecialContent","f","addAttribute","qname","startIndex","attributeNames","addValue","attrName","setTagName","nsp","nsPrefix","elStartEnd","elEndStart","pos","lastIndexOf","matchs","lastMatch","endDTD","getLocalName","module","net","tls","events","assert","util","TunnelingAgent","createSocket","createSecureSocket","self","proxyOptions","defaultMaxSockets","requests","sockets","onFree","localAddress","toOptions","pending","splice","onSocket","removeSocket","inherits","EventEmitter","addRequest","mergeOptions","onCloseOrRemove","emit","removeListener","cb","placeholder","connectOptions","connectReq","useChunkedEncodingByDefault","once","onResponse","onUpgrade","onConnect","onError","upgrade","nextTick","removeAllListeners","cause","stack","shift","hostHeader","getHeader","tlsOptions","servername","secureSocket","connect","overrides","j","keyLen","NODE_DEBUG","args","unshift","_v","default","_v2","_v3","_v4","_nil","_version","_validate","_stringify","_parse","_interopRequireDefault","_crypto","md5","bytes","isArray","createHash","update","digest","uuid","arr","Uint8Array","rng","rnds8Pool","poolPtr","randomFillSync","sha1","byteToHex","_rng","_nodeId","_clockseq","_lastMSecs","_lastNSecs","v1","b","clockseq","seedBytes","random","msecs","now","nsecs","tl","tmh","_md","v3","DNS","stringToBytes","str","unescape","hashfunc","generateUUID","rnds","_sha","v5","_regex","validate","require","__webpack_module_cache__","moduleId","cachedModule","threw","__webpack_modules__","ab","__dirname","__webpack_exports__"],"sources":[".././lib/main.js",".././node_modules/@actions/core/lib/command.js",".././node_modules/@actions/core/lib/core.js",".././node_modules/@actions/core/lib/file-command.js",".././node_modules/@actions/core/lib/oidc-utils.js",".././node_modules/@actions/core/lib/path-utils.js",".././node_modules/@actions/core/lib/summary.js",".././node_modules/@actions/core/lib/utils.js",".././node_modules/@actions/http-client/lib/auth.js",".././node_modules/@actions/http-client/lib/index.js",".././node_modules/@actions/http-client/lib/proxy.js",".././node_modules/@xmldom/xmldom/lib/conventions.js",".././node_modules/@xmldom/xmldom/lib/dom-parser.js",".././node_modules/@xmldom/xmldom/lib/dom.js",".././node_modules/@xmldom/xmldom/lib/entities.js",".././node_modules/@xmldom/xmldom/lib/index.js",".././node_modules/@xmldom/xmldom/lib/sax.js",".././node_modules/tunnel/index.js",".././node_modules/tunnel/lib/tunnel.js",".././node_modules/uuid/dist/index.js",".././node_modules/uuid/dist/md5.js",".././node_modules/uuid/dist/nil.js",".././node_modules/uuid/dist/parse.js",".././node_modules/uuid/dist/regex.js",".././node_modules/uuid/dist/rng.js",".././node_modules/uuid/dist/sha1.js",".././node_modules/uuid/dist/stringify.js",".././node_modules/uuid/dist/v1.js",".././node_modules/uuid/dist/v3.js",".././node_modules/uuid/dist/v35.js",".././node_modules/uuid/dist/v4.js",".././node_modules/uuid/dist/v5.js",".././node_modules/uuid/dist/validate.js",".././node_modules/uuid/dist/version.js","../external node-commonjs \"assert\"","../external node-commonjs \"crypto\"","../external node-commonjs \"events\"","../external node-commonjs \"fs\"","../external node-commonjs \"http\"","../external node-commonjs \"https\"","../external node-commonjs \"net\"","../external node-commonjs \"os\"","../external node-commonjs \"path\"","../external node-commonjs \"tls\"","../external node-commonjs \"util\"","../webpack/bootstrap","../webpack/runtime/compat","../webpack/startup"],"sourcesContent":["\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst core = __importStar(require(\"@actions/core\"));\nconst fs_1 = require(\"fs\");\nconst xmldom_1 = require(\"@xmldom/xmldom\");\nfunction put(name, value) {\n core.info(`${name}: ${value}`);\n core.setOutput(name, value);\n}\nclass DocumentWrapper {\n constructor(docElement) {\n this.docElement = docElement;\n }\n getLastText(tagName) {\n const nodes = this.docElement.getElementsByTagName(tagName);\n return nodes.length > 0 ? nodes[nodes.length - 1].textContent : null;\n }\n static createAsync(projPath) {\n return __awaiter(this, void 0, void 0, function* () {\n let xmlText;\n try {\n xmlText = yield fs_1.promises.readFile(projPath, 'utf-8');\n }\n catch (_a) {\n throw new Error(`no such file: '${projPath}'`);\n }\n const domDoc = new xmldom_1.DOMParser().parseFromString(xmlText, 'text/xml');\n if (!(domDoc === null || domDoc === void 0 ? void 0 : domDoc.documentElement)) {\n throw new Error(`failed to parse xml file: '${projPath}'`);\n }\n return new DocumentWrapper(domDoc.documentElement);\n });\n }\n}\nfunction run() {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n const projPath = core.getInput('proj-path');\n core.debug(`proj-path=${projPath}`);\n let found = false;\n const doc = yield DocumentWrapper.createAsync(projPath);\n let versionPrefix = doc.getLastText('VersionPrefix');\n let versionSuffix = doc.getLastText('VersionSuffix');\n let version = doc.getLastText('Version');\n if (version) {\n found = true;\n const hyphenPos = version.indexOf('-');\n if (hyphenPos >= 0) {\n versionPrefix = version.substr(0, hyphenPos);\n versionSuffix = version.substr(hyphenPos + 1);\n }\n else {\n versionPrefix = version;\n versionSuffix = '';\n }\n }\n else {\n if (versionPrefix) {\n found = true;\n }\n else {\n versionPrefix = '1.0.0';\n }\n if (versionSuffix) {\n found = true;\n version = `${versionPrefix}-${versionSuffix}`;\n }\n else {\n version = versionPrefix;\n versionSuffix = '';\n }\n }\n let packageVersion = doc.getLastText('PackageVersion');\n if (packageVersion) {\n found = true;\n }\n else {\n packageVersion = version;\n }\n let assemblyVersion = doc.getLastText('AssemblyVersion');\n if (assemblyVersion) {\n found = true;\n }\n else {\n assemblyVersion = versionPrefix;\n }\n let fileVersion = doc.getLastText('FileVersion');\n if (fileVersion) {\n found = true;\n }\n else {\n fileVersion = assemblyVersion;\n }\n let informationalVersion = doc.getLastText('InformationalVersion');\n if (informationalVersion) {\n found = true;\n }\n else {\n informationalVersion = version;\n }\n if (!found) {\n throw new Error('Not found version tag');\n }\n put('version', version);\n put('version-prefix', versionPrefix);\n put('version-suffix', versionSuffix);\n put('package-version', packageVersion);\n put('assembly-version', assemblyVersion);\n put('file-version', fileVersion);\n put('informational-version', informationalVersion);\n }\n catch (error) {\n if (error instanceof Error) {\n core.setFailed(error.message);\n }\n }\n });\n}\nrun();\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.issue = exports.issueCommand = void 0;\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nfunction issueCommand(command, properties, message) {\n const cmd = new Command(command, properties, message);\n process.stdout.write(cmd.toString() + os.EOL);\n}\nexports.issueCommand = issueCommand;\nfunction issue(name, message = '') {\n issueCommand(name, {}, message);\n}\nexports.issue = issue;\nconst CMD_STRING = '::';\nclass Command {\n constructor(command, properties, message) {\n if (!command) {\n command = 'missing.command';\n }\n this.command = command;\n this.properties = properties;\n this.message = message;\n }\n toString() {\n let cmdStr = CMD_STRING + this.command;\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' ';\n let first = true;\n for (const key in this.properties) {\n if (this.properties.hasOwnProperty(key)) {\n const val = this.properties[key];\n if (val) {\n if (first) {\n first = false;\n }\n else {\n cmdStr += ',';\n }\n cmdStr += `${key}=${escapeProperty(val)}`;\n }\n }\n }\n }\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`;\n return cmdStr;\n }\n}\nfunction escapeData(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A');\n}\nfunction escapeProperty(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A')\n .replace(/:/g, '%3A')\n .replace(/,/g, '%2C');\n}\n//# sourceMappingURL=command.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getIDToken = exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;\nconst command_1 = require(\"./command\");\nconst file_command_1 = require(\"./file-command\");\nconst utils_1 = require(\"./utils\");\nconst os = __importStar(require(\"os\"));\nconst path = __importStar(require(\"path\"));\nconst oidc_utils_1 = require(\"./oidc-utils\");\n/**\n * The code to exit an action\n */\nvar ExitCode;\n(function (ExitCode) {\n /**\n * A code indicating that the action was successful\n */\n ExitCode[ExitCode[\"Success\"] = 0] = \"Success\";\n /**\n * A code indicating that the action was a failure\n */\n ExitCode[ExitCode[\"Failure\"] = 1] = \"Failure\";\n})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));\n//-----------------------------------------------------------------------\n// Variables\n//-----------------------------------------------------------------------\n/**\n * Sets env variable for this action and future actions in the job\n * @param name the name of the variable to set\n * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction exportVariable(name, val) {\n const convertedVal = utils_1.toCommandValue(val);\n process.env[name] = convertedVal;\n const filePath = process.env['GITHUB_ENV'] || '';\n if (filePath) {\n return file_command_1.issueFileCommand('ENV', file_command_1.prepareKeyValueMessage(name, val));\n }\n command_1.issueCommand('set-env', { name }, convertedVal);\n}\nexports.exportVariable = exportVariable;\n/**\n * Registers a secret which will get masked from logs\n * @param secret value of the secret\n */\nfunction setSecret(secret) {\n command_1.issueCommand('add-mask', {}, secret);\n}\nexports.setSecret = setSecret;\n/**\n * Prepends inputPath to the PATH (for this action and future actions)\n * @param inputPath\n */\nfunction addPath(inputPath) {\n const filePath = process.env['GITHUB_PATH'] || '';\n if (filePath) {\n file_command_1.issueFileCommand('PATH', inputPath);\n }\n else {\n command_1.issueCommand('add-path', {}, inputPath);\n }\n process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;\n}\nexports.addPath = addPath;\n/**\n * Gets the value of an input.\n * Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.\n * Returns an empty string if the value is not defined.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string\n */\nfunction getInput(name, options) {\n const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';\n if (options && options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n if (options && options.trimWhitespace === false) {\n return val;\n }\n return val.trim();\n}\nexports.getInput = getInput;\n/**\n * Gets the values of an multiline input. Each value is also trimmed.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string[]\n *\n */\nfunction getMultilineInput(name, options) {\n const inputs = getInput(name, options)\n .split('\\n')\n .filter(x => x !== '');\n if (options && options.trimWhitespace === false) {\n return inputs;\n }\n return inputs.map(input => input.trim());\n}\nexports.getMultilineInput = getMultilineInput;\n/**\n * Gets the input value of the boolean type in the YAML 1.2 \"core schema\" specification.\n * Support boolean input list: `true | True | TRUE | false | False | FALSE` .\n * The return value is also in boolean type.\n * ref: https://yaml.org/spec/1.2/spec.html#id2804923\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns boolean\n */\nfunction getBooleanInput(name, options) {\n const trueValue = ['true', 'True', 'TRUE'];\n const falseValue = ['false', 'False', 'FALSE'];\n const val = getInput(name, options);\n if (trueValue.includes(val))\n return true;\n if (falseValue.includes(val))\n return false;\n throw new TypeError(`Input does not meet YAML 1.2 \"Core Schema\" specification: ${name}\\n` +\n `Support boolean input list: \\`true | True | TRUE | false | False | FALSE\\``);\n}\nexports.getBooleanInput = getBooleanInput;\n/**\n * Sets the value of an output.\n *\n * @param name name of the output to set\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setOutput(name, value) {\n const filePath = process.env['GITHUB_OUTPUT'] || '';\n if (filePath) {\n return file_command_1.issueFileCommand('OUTPUT', file_command_1.prepareKeyValueMessage(name, value));\n }\n process.stdout.write(os.EOL);\n command_1.issueCommand('set-output', { name }, utils_1.toCommandValue(value));\n}\nexports.setOutput = setOutput;\n/**\n * Enables or disables the echoing of commands into stdout for the rest of the step.\n * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.\n *\n */\nfunction setCommandEcho(enabled) {\n command_1.issue('echo', enabled ? 'on' : 'off');\n}\nexports.setCommandEcho = setCommandEcho;\n//-----------------------------------------------------------------------\n// Results\n//-----------------------------------------------------------------------\n/**\n * Sets the action status to failed.\n * When the action exits it will be with an exit code of 1\n * @param message add error issue message\n */\nfunction setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}\nexports.setFailed = setFailed;\n//-----------------------------------------------------------------------\n// Logging Commands\n//-----------------------------------------------------------------------\n/**\n * Gets whether Actions Step Debug is on or not\n */\nfunction isDebug() {\n return process.env['RUNNER_DEBUG'] === '1';\n}\nexports.isDebug = isDebug;\n/**\n * Writes debug message to user log\n * @param message debug message\n */\nfunction debug(message) {\n command_1.issueCommand('debug', {}, message);\n}\nexports.debug = debug;\n/**\n * Adds an error issue\n * @param message error issue message. Errors will be converted to string via toString()\n * @param properties optional properties to add to the annotation.\n */\nfunction error(message, properties = {}) {\n command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);\n}\nexports.error = error;\n/**\n * Adds a warning issue\n * @param message warning issue message. Errors will be converted to string via toString()\n * @param properties optional properties to add to the annotation.\n */\nfunction warning(message, properties = {}) {\n command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);\n}\nexports.warning = warning;\n/**\n * Adds a notice issue\n * @param message notice issue message. Errors will be converted to string via toString()\n * @param properties optional properties to add to the annotation.\n */\nfunction notice(message, properties = {}) {\n command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);\n}\nexports.notice = notice;\n/**\n * Writes info to log with console.log.\n * @param message info message\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n *\n * Output until the next `groupEnd` will be foldable in this group\n *\n * @param name The name of the output group\n */\nfunction startGroup(name) {\n command_1.issue('group', name);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n command_1.issue('endgroup');\n}\nexports.endGroup = endGroup;\n/**\n * Wrap an asynchronous function call in a group.\n *\n * Returns the same type as the function itself.\n *\n * @param name The name of the group\n * @param fn The function to wrap in the group\n */\nfunction group(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n startGroup(name);\n let result;\n try {\n result = yield fn();\n }\n finally {\n endGroup();\n }\n return result;\n });\n}\nexports.group = group;\n//-----------------------------------------------------------------------\n// Wrapper action state\n//-----------------------------------------------------------------------\n/**\n * Saves state for current action, the state can only be retrieved by this action's post job execution.\n *\n * @param name name of the state to store\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction saveState(name, value) {\n const filePath = process.env['GITHUB_STATE'] || '';\n if (filePath) {\n return file_command_1.issueFileCommand('STATE', file_command_1.prepareKeyValueMessage(name, value));\n }\n command_1.issueCommand('save-state', { name }, utils_1.toCommandValue(value));\n}\nexports.saveState = saveState;\n/**\n * Gets the value of an state set by this action's main execution.\n *\n * @param name name of the state to get\n * @returns string\n */\nfunction getState(name) {\n return process.env[`STATE_${name}`] || '';\n}\nexports.getState = getState;\nfunction getIDToken(aud) {\n return __awaiter(this, void 0, void 0, function* () {\n return yield oidc_utils_1.OidcClient.getIDToken(aud);\n });\n}\nexports.getIDToken = getIDToken;\n/**\n * Summary exports\n */\nvar summary_1 = require(\"./summary\");\nObject.defineProperty(exports, \"summary\", { enumerable: true, get: function () { return summary_1.summary; } });\n/**\n * @deprecated use core.summary\n */\nvar summary_2 = require(\"./summary\");\nObject.defineProperty(exports, \"markdownSummary\", { enumerable: true, get: function () { return summary_2.markdownSummary; } });\n/**\n * Path exports\n */\nvar path_utils_1 = require(\"./path-utils\");\nObject.defineProperty(exports, \"toPosixPath\", { enumerable: true, get: function () { return path_utils_1.toPosixPath; } });\nObject.defineProperty(exports, \"toWin32Path\", { enumerable: true, get: function () { return path_utils_1.toWin32Path; } });\nObject.defineProperty(exports, \"toPlatformPath\", { enumerable: true, get: function () { return path_utils_1.toPlatformPath; } });\n//# sourceMappingURL=core.js.map","\"use strict\";\n// For internal use, subject to change.\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.prepareKeyValueMessage = exports.issueFileCommand = void 0;\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst fs = __importStar(require(\"fs\"));\nconst os = __importStar(require(\"os\"));\nconst uuid_1 = require(\"uuid\");\nconst utils_1 = require(\"./utils\");\nfunction issueFileCommand(command, message) {\n const filePath = process.env[`GITHUB_${command}`];\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`);\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`);\n }\n fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n });\n}\nexports.issueFileCommand = issueFileCommand;\nfunction prepareKeyValueMessage(key, value) {\n const delimiter = `ghadelimiter_${uuid_1.v4()}`;\n const convertedValue = utils_1.toCommandValue(value);\n // These should realistically never happen, but just in case someone finds a\n // way to exploit uuid generation let's not allow keys or values that contain\n // the delimiter.\n if (key.includes(delimiter)) {\n throw new Error(`Unexpected input: name should not contain the delimiter \"${delimiter}\"`);\n }\n if (convertedValue.includes(delimiter)) {\n throw new Error(`Unexpected input: value should not contain the delimiter \"${delimiter}\"`);\n }\n return `${key}<<${delimiter}${os.EOL}${convertedValue}${os.EOL}${delimiter}`;\n}\nexports.prepareKeyValueMessage = prepareKeyValueMessage;\n//# sourceMappingURL=file-command.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.OidcClient = void 0;\nconst http_client_1 = require(\"@actions/http-client\");\nconst auth_1 = require(\"@actions/http-client/lib/auth\");\nconst core_1 = require(\"./core\");\nclass OidcClient {\n static createHttpClient(allowRetry = true, maxRetry = 10) {\n const requestOptions = {\n allowRetries: allowRetry,\n maxRetries: maxRetry\n };\n return new http_client_1.HttpClient('actions/oidc-client', [new auth_1.BearerCredentialHandler(OidcClient.getRequestToken())], requestOptions);\n }\n static getRequestToken() {\n const token = process.env['ACTIONS_ID_TOKEN_REQUEST_TOKEN'];\n if (!token) {\n throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_TOKEN env variable');\n }\n return token;\n }\n static getIDTokenUrl() {\n const runtimeUrl = process.env['ACTIONS_ID_TOKEN_REQUEST_URL'];\n if (!runtimeUrl) {\n throw new Error('Unable to get ACTIONS_ID_TOKEN_REQUEST_URL env variable');\n }\n return runtimeUrl;\n }\n static getCall(id_token_url) {\n var _a;\n return __awaiter(this, void 0, void 0, function* () {\n const httpclient = OidcClient.createHttpClient();\n const res = yield httpclient\n .getJson(id_token_url)\n .catch(error => {\n throw new Error(`Failed to get ID Token. \\n \n Error Code : ${error.statusCode}\\n \n Error Message: ${error.message}`);\n });\n const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;\n if (!id_token) {\n throw new Error('Response json body do not have ID Token field');\n }\n return id_token;\n });\n }\n static getIDToken(audience) {\n return __awaiter(this, void 0, void 0, function* () {\n try {\n // New ID Token is requested from action service\n let id_token_url = OidcClient.getIDTokenUrl();\n if (audience) {\n const encodedAudience = encodeURIComponent(audience);\n id_token_url = `${id_token_url}&audience=${encodedAudience}`;\n }\n core_1.debug(`ID token url is ${id_token_url}`);\n const id_token = yield OidcClient.getCall(id_token_url);\n core_1.setSecret(id_token);\n return id_token;\n }\n catch (error) {\n throw new Error(`Error message: ${error.message}`);\n }\n });\n }\n}\nexports.OidcClient = OidcClient;\n//# sourceMappingURL=oidc-utils.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;\nconst path = __importStar(require(\"path\"));\n/**\n * toPosixPath converts the given path to the posix form. On Windows, \\\\ will be\n * replaced with /.\n *\n * @param pth. Path to transform.\n * @return string Posix path.\n */\nfunction toPosixPath(pth) {\n return pth.replace(/[\\\\]/g, '/');\n}\nexports.toPosixPath = toPosixPath;\n/**\n * toWin32Path converts the given path to the win32 form. On Linux, / will be\n * replaced with \\\\.\n *\n * @param pth. Path to transform.\n * @return string Win32 path.\n */\nfunction toWin32Path(pth) {\n return pth.replace(/[/]/g, '\\\\');\n}\nexports.toWin32Path = toWin32Path;\n/**\n * toPlatformPath converts the given path to a platform-specific path. It does\n * this by replacing instances of / and \\ with the platform-specific path\n * separator.\n *\n * @param pth The path to platformize.\n * @return string The platform-specific path.\n */\nfunction toPlatformPath(pth) {\n return pth.replace(/[/\\\\]/g, path.sep);\n}\nexports.toPlatformPath = toPlatformPath;\n//# sourceMappingURL=path-utils.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.summary = exports.markdownSummary = exports.SUMMARY_DOCS_URL = exports.SUMMARY_ENV_VAR = void 0;\nconst os_1 = require(\"os\");\nconst fs_1 = require(\"fs\");\nconst { access, appendFile, writeFile } = fs_1.promises;\nexports.SUMMARY_ENV_VAR = 'GITHUB_STEP_SUMMARY';\nexports.SUMMARY_DOCS_URL = 'https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary';\nclass Summary {\n constructor() {\n this._buffer = '';\n }\n /**\n * Finds the summary file path from the environment, rejects if env var is not found or file does not exist\n * Also checks r/w permissions.\n *\n * @returns step summary file path\n */\n filePath() {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._filePath) {\n return this._filePath;\n }\n const pathFromEnv = process.env[exports.SUMMARY_ENV_VAR];\n if (!pathFromEnv) {\n throw new Error(`Unable to find environment variable for $${exports.SUMMARY_ENV_VAR}. Check if your runtime environment supports job summaries.`);\n }\n try {\n yield access(pathFromEnv, fs_1.constants.R_OK | fs_1.constants.W_OK);\n }\n catch (_a) {\n throw new Error(`Unable to access summary file: '${pathFromEnv}'. Check if the file has correct read/write permissions.`);\n }\n this._filePath = pathFromEnv;\n return this._filePath;\n });\n }\n /**\n * Wraps content in an HTML tag, adding any HTML attributes\n *\n * @param {string} tag HTML tag to wrap\n * @param {string | null} content content within the tag\n * @param {[attribute: string]: string} attrs key-value list of HTML attributes to add\n *\n * @returns {string} content wrapped in HTML element\n */\n wrap(tag, content, attrs = {}) {\n const htmlAttrs = Object.entries(attrs)\n .map(([key, value]) => ` ${key}=\"${value}\"`)\n .join('');\n if (!content) {\n return `<${tag}${htmlAttrs}>`;\n }\n return `<${tag}${htmlAttrs}>${content}`;\n }\n /**\n * Writes text in the buffer to the summary buffer file and empties buffer. Will append by default.\n *\n * @param {SummaryWriteOptions} [options] (optional) options for write operation\n *\n * @returns {Promise} summary instance\n */\n write(options) {\n return __awaiter(this, void 0, void 0, function* () {\n const overwrite = !!(options === null || options === void 0 ? void 0 : options.overwrite);\n const filePath = yield this.filePath();\n const writeFunc = overwrite ? writeFile : appendFile;\n yield writeFunc(filePath, this._buffer, { encoding: 'utf8' });\n return this.emptyBuffer();\n });\n }\n /**\n * Clears the summary buffer and wipes the summary file\n *\n * @returns {Summary} summary instance\n */\n clear() {\n return __awaiter(this, void 0, void 0, function* () {\n return this.emptyBuffer().write({ overwrite: true });\n });\n }\n /**\n * Returns the current summary buffer as a string\n *\n * @returns {string} string of summary buffer\n */\n stringify() {\n return this._buffer;\n }\n /**\n * If the summary buffer is empty\n *\n * @returns {boolen} true if the buffer is empty\n */\n isEmptyBuffer() {\n return this._buffer.length === 0;\n }\n /**\n * Resets the summary buffer without writing to summary file\n *\n * @returns {Summary} summary instance\n */\n emptyBuffer() {\n this._buffer = '';\n return this;\n }\n /**\n * Adds raw text to the summary buffer\n *\n * @param {string} text content to add\n * @param {boolean} [addEOL=false] (optional) append an EOL to the raw text (default: false)\n *\n * @returns {Summary} summary instance\n */\n addRaw(text, addEOL = false) {\n this._buffer += text;\n return addEOL ? this.addEOL() : this;\n }\n /**\n * Adds the operating system-specific end-of-line marker to the buffer\n *\n * @returns {Summary} summary instance\n */\n addEOL() {\n return this.addRaw(os_1.EOL);\n }\n /**\n * Adds an HTML codeblock to the summary buffer\n *\n * @param {string} code content to render within fenced code block\n * @param {string} lang (optional) language to syntax highlight code\n *\n * @returns {Summary} summary instance\n */\n addCodeBlock(code, lang) {\n const attrs = Object.assign({}, (lang && { lang }));\n const element = this.wrap('pre', this.wrap('code', code), attrs);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML list to the summary buffer\n *\n * @param {string[]} items list of items to render\n * @param {boolean} [ordered=false] (optional) if the rendered list should be ordered or not (default: false)\n *\n * @returns {Summary} summary instance\n */\n addList(items, ordered = false) {\n const tag = ordered ? 'ol' : 'ul';\n const listItems = items.map(item => this.wrap('li', item)).join('');\n const element = this.wrap(tag, listItems);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML table to the summary buffer\n *\n * @param {SummaryTableCell[]} rows table rows\n *\n * @returns {Summary} summary instance\n */\n addTable(rows) {\n const tableBody = rows\n .map(row => {\n const cells = row\n .map(cell => {\n if (typeof cell === 'string') {\n return this.wrap('td', cell);\n }\n const { header, data, colspan, rowspan } = cell;\n const tag = header ? 'th' : 'td';\n const attrs = Object.assign(Object.assign({}, (colspan && { colspan })), (rowspan && { rowspan }));\n return this.wrap(tag, data, attrs);\n })\n .join('');\n return this.wrap('tr', cells);\n })\n .join('');\n const element = this.wrap('table', tableBody);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds a collapsable HTML details element to the summary buffer\n *\n * @param {string} label text for the closed state\n * @param {string} content collapsable content\n *\n * @returns {Summary} summary instance\n */\n addDetails(label, content) {\n const element = this.wrap('details', this.wrap('summary', label) + content);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML image tag to the summary buffer\n *\n * @param {string} src path to the image you to embed\n * @param {string} alt text description of the image\n * @param {SummaryImageOptions} options (optional) addition image attributes\n *\n * @returns {Summary} summary instance\n */\n addImage(src, alt, options) {\n const { width, height } = options || {};\n const attrs = Object.assign(Object.assign({}, (width && { width })), (height && { height }));\n const element = this.wrap('img', null, Object.assign({ src, alt }, attrs));\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML section heading element\n *\n * @param {string} text heading text\n * @param {number | string} [level=1] (optional) the heading level, default: 1\n *\n * @returns {Summary} summary instance\n */\n addHeading(text, level) {\n const tag = `h${level}`;\n const allowedTag = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(tag)\n ? tag\n : 'h1';\n const element = this.wrap(allowedTag, text);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML thematic break (
) to the summary buffer\n *\n * @returns {Summary} summary instance\n */\n addSeparator() {\n const element = this.wrap('hr', null);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML line break (
) to the summary buffer\n *\n * @returns {Summary} summary instance\n */\n addBreak() {\n const element = this.wrap('br', null);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML blockquote to the summary buffer\n *\n * @param {string} text quote text\n * @param {string} cite (optional) citation url\n *\n * @returns {Summary} summary instance\n */\n addQuote(text, cite) {\n const attrs = Object.assign({}, (cite && { cite }));\n const element = this.wrap('blockquote', text, attrs);\n return this.addRaw(element).addEOL();\n }\n /**\n * Adds an HTML anchor tag to the summary buffer\n *\n * @param {string} text link text/content\n * @param {string} href hyperlink\n *\n * @returns {Summary} summary instance\n */\n addLink(text, href) {\n const element = this.wrap('a', text, { href });\n return this.addRaw(element).addEOL();\n }\n}\nconst _summary = new Summary();\n/**\n * @deprecated use `core.summary`\n */\nexports.markdownSummary = _summary;\nexports.summary = _summary;\n//# sourceMappingURL=summary.js.map","\"use strict\";\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toCommandProperties = exports.toCommandValue = void 0;\n/**\n * Sanitizes an input into a string so it can be passed into issueCommand safely\n * @param input input to sanitize into a string\n */\nfunction toCommandValue(input) {\n if (input === null || input === undefined) {\n return '';\n }\n else if (typeof input === 'string' || input instanceof String) {\n return input;\n }\n return JSON.stringify(input);\n}\nexports.toCommandValue = toCommandValue;\n/**\n *\n * @param annotationProperties\n * @returns The command properties to send with the actual annotation command\n * See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646\n */\nfunction toCommandProperties(annotationProperties) {\n if (!Object.keys(annotationProperties).length) {\n return {};\n }\n return {\n title: annotationProperties.title,\n file: annotationProperties.file,\n line: annotationProperties.startLine,\n endLine: annotationProperties.endLine,\n col: annotationProperties.startColumn,\n endColumn: annotationProperties.endColumn\n };\n}\nexports.toCommandProperties = toCommandProperties;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PersonalAccessTokenCredentialHandler = exports.BearerCredentialHandler = exports.BasicCredentialHandler = void 0;\nclass BasicCredentialHandler {\n constructor(username, password) {\n this.username = username;\n this.password = password;\n }\n prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString('base64')}`;\n }\n // This handler cannot handle 401\n canHandleAuthentication() {\n return false;\n }\n handleAuthentication() {\n return __awaiter(this, void 0, void 0, function* () {\n throw new Error('not implemented');\n });\n }\n}\nexports.BasicCredentialHandler = BasicCredentialHandler;\nclass BearerCredentialHandler {\n constructor(token) {\n this.token = token;\n }\n // currently implements pre-authorization\n // TODO: support preAuth = false where it hooks on 401\n prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Bearer ${this.token}`;\n }\n // This handler cannot handle 401\n canHandleAuthentication() {\n return false;\n }\n handleAuthentication() {\n return __awaiter(this, void 0, void 0, function* () {\n throw new Error('not implemented');\n });\n }\n}\nexports.BearerCredentialHandler = BearerCredentialHandler;\nclass PersonalAccessTokenCredentialHandler {\n constructor(token) {\n this.token = token;\n }\n // currently implements pre-authorization\n // TODO: support preAuth = false where it hooks on 401\n prepareRequest(options) {\n if (!options.headers) {\n throw Error('The request has no headers');\n }\n options.headers['Authorization'] = `Basic ${Buffer.from(`PAT:${this.token}`).toString('base64')}`;\n }\n // This handler cannot handle 401\n canHandleAuthentication() {\n return false;\n }\n handleAuthentication() {\n return __awaiter(this, void 0, void 0, function* () {\n throw new Error('not implemented');\n });\n }\n}\nexports.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler;\n//# sourceMappingURL=auth.js.map","\"use strict\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HttpClient = exports.isHttps = exports.HttpClientResponse = exports.HttpClientError = exports.getProxyUrl = exports.MediaTypes = exports.Headers = exports.HttpCodes = void 0;\nconst http = __importStar(require(\"http\"));\nconst https = __importStar(require(\"https\"));\nconst pm = __importStar(require(\"./proxy\"));\nconst tunnel = __importStar(require(\"tunnel\"));\nvar HttpCodes;\n(function (HttpCodes) {\n HttpCodes[HttpCodes[\"OK\"] = 200] = \"OK\";\n HttpCodes[HttpCodes[\"MultipleChoices\"] = 300] = \"MultipleChoices\";\n HttpCodes[HttpCodes[\"MovedPermanently\"] = 301] = \"MovedPermanently\";\n HttpCodes[HttpCodes[\"ResourceMoved\"] = 302] = \"ResourceMoved\";\n HttpCodes[HttpCodes[\"SeeOther\"] = 303] = \"SeeOther\";\n HttpCodes[HttpCodes[\"NotModified\"] = 304] = \"NotModified\";\n HttpCodes[HttpCodes[\"UseProxy\"] = 305] = \"UseProxy\";\n HttpCodes[HttpCodes[\"SwitchProxy\"] = 306] = \"SwitchProxy\";\n HttpCodes[HttpCodes[\"TemporaryRedirect\"] = 307] = \"TemporaryRedirect\";\n HttpCodes[HttpCodes[\"PermanentRedirect\"] = 308] = \"PermanentRedirect\";\n HttpCodes[HttpCodes[\"BadRequest\"] = 400] = \"BadRequest\";\n HttpCodes[HttpCodes[\"Unauthorized\"] = 401] = \"Unauthorized\";\n HttpCodes[HttpCodes[\"PaymentRequired\"] = 402] = \"PaymentRequired\";\n HttpCodes[HttpCodes[\"Forbidden\"] = 403] = \"Forbidden\";\n HttpCodes[HttpCodes[\"NotFound\"] = 404] = \"NotFound\";\n HttpCodes[HttpCodes[\"MethodNotAllowed\"] = 405] = \"MethodNotAllowed\";\n HttpCodes[HttpCodes[\"NotAcceptable\"] = 406] = \"NotAcceptable\";\n HttpCodes[HttpCodes[\"ProxyAuthenticationRequired\"] = 407] = \"ProxyAuthenticationRequired\";\n HttpCodes[HttpCodes[\"RequestTimeout\"] = 408] = \"RequestTimeout\";\n HttpCodes[HttpCodes[\"Conflict\"] = 409] = \"Conflict\";\n HttpCodes[HttpCodes[\"Gone\"] = 410] = \"Gone\";\n HttpCodes[HttpCodes[\"TooManyRequests\"] = 429] = \"TooManyRequests\";\n HttpCodes[HttpCodes[\"InternalServerError\"] = 500] = \"InternalServerError\";\n HttpCodes[HttpCodes[\"NotImplemented\"] = 501] = \"NotImplemented\";\n HttpCodes[HttpCodes[\"BadGateway\"] = 502] = \"BadGateway\";\n HttpCodes[HttpCodes[\"ServiceUnavailable\"] = 503] = \"ServiceUnavailable\";\n HttpCodes[HttpCodes[\"GatewayTimeout\"] = 504] = \"GatewayTimeout\";\n})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));\nvar Headers;\n(function (Headers) {\n Headers[\"Accept\"] = \"accept\";\n Headers[\"ContentType\"] = \"content-type\";\n})(Headers = exports.Headers || (exports.Headers = {}));\nvar MediaTypes;\n(function (MediaTypes) {\n MediaTypes[\"ApplicationJson\"] = \"application/json\";\n})(MediaTypes = exports.MediaTypes || (exports.MediaTypes = {}));\n/**\n * Returns the proxy URL, depending upon the supplied url and proxy environment variables.\n * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com\n */\nfunction getProxyUrl(serverUrl) {\n const proxyUrl = pm.getProxyUrl(new URL(serverUrl));\n return proxyUrl ? proxyUrl.href : '';\n}\nexports.getProxyUrl = getProxyUrl;\nconst HttpRedirectCodes = [\n HttpCodes.MovedPermanently,\n HttpCodes.ResourceMoved,\n HttpCodes.SeeOther,\n HttpCodes.TemporaryRedirect,\n HttpCodes.PermanentRedirect\n];\nconst HttpResponseRetryCodes = [\n HttpCodes.BadGateway,\n HttpCodes.ServiceUnavailable,\n HttpCodes.GatewayTimeout\n];\nconst RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];\nconst ExponentialBackoffCeiling = 10;\nconst ExponentialBackoffTimeSlice = 5;\nclass HttpClientError extends Error {\n constructor(message, statusCode) {\n super(message);\n this.name = 'HttpClientError';\n this.statusCode = statusCode;\n Object.setPrototypeOf(this, HttpClientError.prototype);\n }\n}\nexports.HttpClientError = HttpClientError;\nclass HttpClientResponse {\n constructor(message) {\n this.message = message;\n }\n readBody() {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {\n let output = Buffer.alloc(0);\n this.message.on('data', (chunk) => {\n output = Buffer.concat([output, chunk]);\n });\n this.message.on('end', () => {\n resolve(output.toString());\n });\n }));\n });\n }\n}\nexports.HttpClientResponse = HttpClientResponse;\nfunction isHttps(requestUrl) {\n const parsedUrl = new URL(requestUrl);\n return parsedUrl.protocol === 'https:';\n}\nexports.isHttps = isHttps;\nclass HttpClient {\n constructor(userAgent, handlers, requestOptions) {\n this._ignoreSslError = false;\n this._allowRedirects = true;\n this._allowRedirectDowngrade = false;\n this._maxRedirects = 50;\n this._allowRetries = false;\n this._maxRetries = 1;\n this._keepAlive = false;\n this._disposed = false;\n this.userAgent = userAgent;\n this.handlers = handlers || [];\n this.requestOptions = requestOptions;\n if (requestOptions) {\n if (requestOptions.ignoreSslError != null) {\n this._ignoreSslError = requestOptions.ignoreSslError;\n }\n this._socketTimeout = requestOptions.socketTimeout;\n if (requestOptions.allowRedirects != null) {\n this._allowRedirects = requestOptions.allowRedirects;\n }\n if (requestOptions.allowRedirectDowngrade != null) {\n this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade;\n }\n if (requestOptions.maxRedirects != null) {\n this._maxRedirects = Math.max(requestOptions.maxRedirects, 0);\n }\n if (requestOptions.keepAlive != null) {\n this._keepAlive = requestOptions.keepAlive;\n }\n if (requestOptions.allowRetries != null) {\n this._allowRetries = requestOptions.allowRetries;\n }\n if (requestOptions.maxRetries != null) {\n this._maxRetries = requestOptions.maxRetries;\n }\n }\n }\n options(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('OPTIONS', requestUrl, null, additionalHeaders || {});\n });\n }\n get(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('GET', requestUrl, null, additionalHeaders || {});\n });\n }\n del(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('DELETE', requestUrl, null, additionalHeaders || {});\n });\n }\n post(requestUrl, data, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('POST', requestUrl, data, additionalHeaders || {});\n });\n }\n patch(requestUrl, data, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('PATCH', requestUrl, data, additionalHeaders || {});\n });\n }\n put(requestUrl, data, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('PUT', requestUrl, data, additionalHeaders || {});\n });\n }\n head(requestUrl, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request('HEAD', requestUrl, null, additionalHeaders || {});\n });\n }\n sendStream(verb, requestUrl, stream, additionalHeaders) {\n return __awaiter(this, void 0, void 0, function* () {\n return this.request(verb, requestUrl, stream, additionalHeaders);\n });\n }\n /**\n * Gets a typed object from an endpoint\n * Be aware that not found returns a null. Other errors (4xx, 5xx) reject the promise\n */\n getJson(requestUrl, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n const res = yield this.get(requestUrl, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n postJson(requestUrl, obj, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n const res = yield this.post(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n putJson(requestUrl, obj, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n const res = yield this.put(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n patchJson(requestUrl, obj, additionalHeaders = {}) {\n return __awaiter(this, void 0, void 0, function* () {\n const data = JSON.stringify(obj, null, 2);\n additionalHeaders[Headers.Accept] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.Accept, MediaTypes.ApplicationJson);\n additionalHeaders[Headers.ContentType] = this._getExistingOrDefaultHeader(additionalHeaders, Headers.ContentType, MediaTypes.ApplicationJson);\n const res = yield this.patch(requestUrl, data, additionalHeaders);\n return this._processResponse(res, this.requestOptions);\n });\n }\n /**\n * Makes a raw http request.\n * All other methods such as get, post, patch, and request ultimately call this.\n * Prefer get, del, post and patch\n */\n request(verb, requestUrl, data, headers) {\n return __awaiter(this, void 0, void 0, function* () {\n if (this._disposed) {\n throw new Error('Client has already been disposed.');\n }\n const parsedUrl = new URL(requestUrl);\n let info = this._prepareRequest(verb, parsedUrl, headers);\n // Only perform retries on reads since writes may not be idempotent.\n const maxTries = this._allowRetries && RetryableHttpVerbs.includes(verb)\n ? this._maxRetries + 1\n : 1;\n let numTries = 0;\n let response;\n do {\n response = yield this.requestRaw(info, data);\n // Check if it's an authentication challenge\n if (response &&\n response.message &&\n response.message.statusCode === HttpCodes.Unauthorized) {\n let authenticationHandler;\n for (const handler of this.handlers) {\n if (handler.canHandleAuthentication(response)) {\n authenticationHandler = handler;\n break;\n }\n }\n if (authenticationHandler) {\n return authenticationHandler.handleAuthentication(this, info, data);\n }\n else {\n // We have received an unauthorized response but have no handlers to handle it.\n // Let the response return to the caller.\n return response;\n }\n }\n let redirectsRemaining = this._maxRedirects;\n while (response.message.statusCode &&\n HttpRedirectCodes.includes(response.message.statusCode) &&\n this._allowRedirects &&\n redirectsRemaining > 0) {\n const redirectUrl = response.message.headers['location'];\n if (!redirectUrl) {\n // if there's no location to redirect to, we won't\n break;\n }\n const parsedRedirectUrl = new URL(redirectUrl);\n if (parsedUrl.protocol === 'https:' &&\n parsedUrl.protocol !== parsedRedirectUrl.protocol &&\n !this._allowRedirectDowngrade) {\n throw new Error('Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true.');\n }\n // we need to finish reading the response before reassigning response\n // which will leak the open socket.\n yield response.readBody();\n // strip authorization header if redirected to a different hostname\n if (parsedRedirectUrl.hostname !== parsedUrl.hostname) {\n for (const header in headers) {\n // header names are case insensitive\n if (header.toLowerCase() === 'authorization') {\n delete headers[header];\n }\n }\n }\n // let's make the request with the new redirectUrl\n info = this._prepareRequest(verb, parsedRedirectUrl, headers);\n response = yield this.requestRaw(info, data);\n redirectsRemaining--;\n }\n if (!response.message.statusCode ||\n !HttpResponseRetryCodes.includes(response.message.statusCode)) {\n // If not a retry code, return immediately instead of retrying\n return response;\n }\n numTries += 1;\n if (numTries < maxTries) {\n yield response.readBody();\n yield this._performExponentialBackoff(numTries);\n }\n } while (numTries < maxTries);\n return response;\n });\n }\n /**\n * Needs to be called if keepAlive is set to true in request options.\n */\n dispose() {\n if (this._agent) {\n this._agent.destroy();\n }\n this._disposed = true;\n }\n /**\n * Raw request.\n * @param info\n * @param data\n */\n requestRaw(info, data) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve, reject) => {\n function callbackForResult(err, res) {\n if (err) {\n reject(err);\n }\n else if (!res) {\n // If `err` is not passed, then `res` must be passed.\n reject(new Error('Unknown error'));\n }\n else {\n resolve(res);\n }\n }\n this.requestRawWithCallback(info, data, callbackForResult);\n });\n });\n }\n /**\n * Raw request with callback.\n * @param info\n * @param data\n * @param onResult\n */\n requestRawWithCallback(info, data, onResult) {\n if (typeof data === 'string') {\n if (!info.options.headers) {\n info.options.headers = {};\n }\n info.options.headers['Content-Length'] = Buffer.byteLength(data, 'utf8');\n }\n let callbackCalled = false;\n function handleResult(err, res) {\n if (!callbackCalled) {\n callbackCalled = true;\n onResult(err, res);\n }\n }\n const req = info.httpModule.request(info.options, (msg) => {\n const res = new HttpClientResponse(msg);\n handleResult(undefined, res);\n });\n let socket;\n req.on('socket', sock => {\n socket = sock;\n });\n // If we ever get disconnected, we want the socket to timeout eventually\n req.setTimeout(this._socketTimeout || 3 * 60000, () => {\n if (socket) {\n socket.end();\n }\n handleResult(new Error(`Request timeout: ${info.options.path}`));\n });\n req.on('error', function (err) {\n // err has statusCode property\n // res should have headers\n handleResult(err);\n });\n if (data && typeof data === 'string') {\n req.write(data, 'utf8');\n }\n if (data && typeof data !== 'string') {\n data.on('close', function () {\n req.end();\n });\n data.pipe(req);\n }\n else {\n req.end();\n }\n }\n /**\n * Gets an http agent. This function is useful when you need an http agent that handles\n * routing through a proxy server - depending upon the url and proxy environment variables.\n * @param serverUrl The server URL where the request will be sent. For example, https://api.github.com\n */\n getAgent(serverUrl) {\n const parsedUrl = new URL(serverUrl);\n return this._getAgent(parsedUrl);\n }\n _prepareRequest(method, requestUrl, headers) {\n const info = {};\n info.parsedUrl = requestUrl;\n const usingSsl = info.parsedUrl.protocol === 'https:';\n info.httpModule = usingSsl ? https : http;\n const defaultPort = usingSsl ? 443 : 80;\n info.options = {};\n info.options.host = info.parsedUrl.hostname;\n info.options.port = info.parsedUrl.port\n ? parseInt(info.parsedUrl.port)\n : defaultPort;\n info.options.path =\n (info.parsedUrl.pathname || '') + (info.parsedUrl.search || '');\n info.options.method = method;\n info.options.headers = this._mergeHeaders(headers);\n if (this.userAgent != null) {\n info.options.headers['user-agent'] = this.userAgent;\n }\n info.options.agent = this._getAgent(info.parsedUrl);\n // gives handlers an opportunity to participate\n if (this.handlers) {\n for (const handler of this.handlers) {\n handler.prepareRequest(info.options);\n }\n }\n return info;\n }\n _mergeHeaders(headers) {\n if (this.requestOptions && this.requestOptions.headers) {\n return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers || {}));\n }\n return lowercaseKeys(headers || {});\n }\n _getExistingOrDefaultHeader(additionalHeaders, header, _default) {\n let clientHeader;\n if (this.requestOptions && this.requestOptions.headers) {\n clientHeader = lowercaseKeys(this.requestOptions.headers)[header];\n }\n return additionalHeaders[header] || clientHeader || _default;\n }\n _getAgent(parsedUrl) {\n let agent;\n const proxyUrl = pm.getProxyUrl(parsedUrl);\n const useProxy = proxyUrl && proxyUrl.hostname;\n if (this._keepAlive && useProxy) {\n agent = this._proxyAgent;\n }\n if (this._keepAlive && !useProxy) {\n agent = this._agent;\n }\n // if agent is already assigned use that agent.\n if (agent) {\n return agent;\n }\n const usingSsl = parsedUrl.protocol === 'https:';\n let maxSockets = 100;\n if (this.requestOptions) {\n maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets;\n }\n // This is `useProxy` again, but we need to check `proxyURl` directly for TypeScripts's flow analysis.\n if (proxyUrl && proxyUrl.hostname) {\n const agentOptions = {\n maxSockets,\n keepAlive: this._keepAlive,\n proxy: Object.assign(Object.assign({}, ((proxyUrl.username || proxyUrl.password) && {\n proxyAuth: `${proxyUrl.username}:${proxyUrl.password}`\n })), { host: proxyUrl.hostname, port: proxyUrl.port })\n };\n let tunnelAgent;\n const overHttps = proxyUrl.protocol === 'https:';\n if (usingSsl) {\n tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp;\n }\n else {\n tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp;\n }\n agent = tunnelAgent(agentOptions);\n this._proxyAgent = agent;\n }\n // if reusing agent across request and tunneling agent isn't assigned create a new agent\n if (this._keepAlive && !agent) {\n const options = { keepAlive: this._keepAlive, maxSockets };\n agent = usingSsl ? new https.Agent(options) : new http.Agent(options);\n this._agent = agent;\n }\n // if not using private agent and tunnel agent isn't setup then use global agent\n if (!agent) {\n agent = usingSsl ? https.globalAgent : http.globalAgent;\n }\n if (usingSsl && this._ignoreSslError) {\n // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process\n // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options\n // we have to cast it to any and change it directly\n agent.options = Object.assign(agent.options || {}, {\n rejectUnauthorized: false\n });\n }\n return agent;\n }\n _performExponentialBackoff(retryNumber) {\n return __awaiter(this, void 0, void 0, function* () {\n retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber);\n const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber);\n return new Promise(resolve => setTimeout(() => resolve(), ms));\n });\n }\n _processResponse(res, options) {\n return __awaiter(this, void 0, void 0, function* () {\n return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {\n const statusCode = res.message.statusCode || 0;\n const response = {\n statusCode,\n result: null,\n headers: {}\n };\n // not found leads to null obj returned\n if (statusCode === HttpCodes.NotFound) {\n resolve(response);\n }\n // get the result from the body\n function dateTimeDeserializer(key, value) {\n if (typeof value === 'string') {\n const a = new Date(value);\n if (!isNaN(a.valueOf())) {\n return a;\n }\n }\n return value;\n }\n let obj;\n let contents;\n try {\n contents = yield res.readBody();\n if (contents && contents.length > 0) {\n if (options && options.deserializeDates) {\n obj = JSON.parse(contents, dateTimeDeserializer);\n }\n else {\n obj = JSON.parse(contents);\n }\n response.result = obj;\n }\n response.headers = res.message.headers;\n }\n catch (err) {\n // Invalid resource (contents not json); leaving result obj null\n }\n // note that 3xx redirects are handled by the http layer.\n if (statusCode > 299) {\n let msg;\n // if exception/error in body, attempt to get better error\n if (obj && obj.message) {\n msg = obj.message;\n }\n else if (contents && contents.length > 0) {\n // it may be the case that the exception is in the body message as string\n msg = contents;\n }\n else {\n msg = `Failed request: (${statusCode})`;\n }\n const err = new HttpClientError(msg, statusCode);\n err.result = response.result;\n reject(err);\n }\n else {\n resolve(response);\n }\n }));\n });\n }\n}\nexports.HttpClient = HttpClient;\nconst lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => ((c[k.toLowerCase()] = obj[k]), c), {});\n//# sourceMappingURL=index.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkBypass = exports.getProxyUrl = void 0;\nfunction getProxyUrl(reqUrl) {\n const usingSsl = reqUrl.protocol === 'https:';\n if (checkBypass(reqUrl)) {\n return undefined;\n }\n const proxyVar = (() => {\n if (usingSsl) {\n return process.env['https_proxy'] || process.env['HTTPS_PROXY'];\n }\n else {\n return process.env['http_proxy'] || process.env['HTTP_PROXY'];\n }\n })();\n if (proxyVar) {\n return new URL(proxyVar);\n }\n else {\n return undefined;\n }\n}\nexports.getProxyUrl = getProxyUrl;\nfunction checkBypass(reqUrl) {\n if (!reqUrl.hostname) {\n return false;\n }\n const noProxy = process.env['no_proxy'] || process.env['NO_PROXY'] || '';\n if (!noProxy) {\n return false;\n }\n // Determine the request port\n let reqPort;\n if (reqUrl.port) {\n reqPort = Number(reqUrl.port);\n }\n else if (reqUrl.protocol === 'http:') {\n reqPort = 80;\n }\n else if (reqUrl.protocol === 'https:') {\n reqPort = 443;\n }\n // Format the request hostname and hostname with port\n const upperReqHosts = [reqUrl.hostname.toUpperCase()];\n if (typeof reqPort === 'number') {\n upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);\n }\n // Compare request host against noproxy\n for (const upperNoProxyItem of noProxy\n .split(',')\n .map(x => x.trim().toUpperCase())\n .filter(x => x)) {\n if (upperReqHosts.some(x => x === upperNoProxyItem)) {\n return true;\n }\n }\n return false;\n}\nexports.checkBypass = checkBypass;\n//# sourceMappingURL=proxy.js.map","'use strict'\n\n/**\n * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.\n *\n * Works with anything that has a `length` property and index access properties, including NodeList.\n *\n * @template {unknown} T\n * @param {Array | ({length:number, [number]: T})} list\n * @param {function (item: T, index: number, list:Array | ({length:number, [number]: T})):boolean} predicate\n * @param {Partial>?} ac `Array.prototype` by default,\n * \t\t\t\tallows injecting a custom implementation in tests\n * @returns {T | undefined}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find\n */\nfunction find(list, predicate, ac) {\n\tif (ac === undefined) {\n\t\tac = Array.prototype;\n\t}\n\tif (list && typeof ac.find === 'function') {\n\t\treturn ac.find.call(list, predicate);\n\t}\n\tfor (var i = 0; i < list.length; i++) {\n\t\tif (Object.prototype.hasOwnProperty.call(list, i)) {\n\t\t\tvar item = list[i];\n\t\t\tif (predicate.call(undefined, item, i, list)) {\n\t\t\t\treturn item;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * \"Shallow freezes\" an object to render it immutable.\n * Uses `Object.freeze` if available,\n * otherwise the immutability is only in the type.\n *\n * Is used to create \"enum like\" objects.\n *\n * @template T\n * @param {T} object the object to freeze\n * @param {Pick = Object} oc `Object` by default,\n * \t\t\t\tallows to inject custom object constructor for tests\n * @returns {Readonly}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze\n */\nfunction freeze(object, oc) {\n\tif (oc === undefined) {\n\t\toc = Object\n\t}\n\treturn oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object\n}\n\n/**\n * Since we can not rely on `Object.assign` we provide a simplified version\n * that is sufficient for our needs.\n *\n * @param {Object} target\n * @param {Object | null | undefined} source\n *\n * @returns {Object} target\n * @throws TypeError if target is not an object\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign\n */\nfunction assign(target, source) {\n\tif (target === null || typeof target !== 'object') {\n\t\tthrow new TypeError('target is not an object')\n\t}\n\tfor (var key in source) {\n\t\tif (Object.prototype.hasOwnProperty.call(source, key)) {\n\t\t\ttarget[key] = source[key]\n\t\t}\n\t}\n\treturn target\n}\n\n/**\n * All mime types that are allowed as input to `DOMParser.parseFromString`\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec\n * @see DOMParser.prototype.parseFromString\n */\nvar MIME_TYPE = freeze({\n\t/**\n\t * `text/html`, the only mime type that triggers treating an XML document as HTML.\n\t *\n\t * @see DOMParser.SupportedType.isHTML\n\t * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n\t * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec\n\t */\n\tHTML: 'text/html',\n\n\t/**\n\t * Helper method to check a mime type if it indicates an HTML document\n\t *\n\t * @param {string} [value]\n\t * @returns {boolean}\n\t *\n\t * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n\t * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring \t */\n\tisHTML: function (value) {\n\t\treturn value === MIME_TYPE.HTML\n\t},\n\n\t/**\n\t * `application/xml`, the standard mime type for XML documents.\n\t *\n\t * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration\n\t * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303\n\t * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n\t */\n\tXML_APPLICATION: 'application/xml',\n\n\t/**\n\t * `text/html`, an alias for `application/xml`.\n\t *\n\t * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303\n\t * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n\t */\n\tXML_TEXT: 'text/xml',\n\n\t/**\n\t * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,\n\t * but is parsed as an XML document.\n\t *\n\t * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec\n\t * @see https://en.wikipedia.org/wiki/XHTML Wikipedia\n\t */\n\tXML_XHTML_APPLICATION: 'application/xhtml+xml',\n\n\t/**\n\t * `image/svg+xml`,\n\t *\n\t * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration\n\t * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1\n\t * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia\n\t */\n\tXML_SVG_IMAGE: 'image/svg+xml',\n})\n\n/**\n * Namespaces that are used in this code base.\n *\n * @see http://www.w3.org/TR/REC-xml-names\n */\nvar NAMESPACE = freeze({\n\t/**\n\t * The XHTML namespace.\n\t *\n\t * @see http://www.w3.org/1999/xhtml\n\t */\n\tHTML: 'http://www.w3.org/1999/xhtml',\n\n\t/**\n\t * Checks if `uri` equals `NAMESPACE.HTML`.\n\t *\n\t * @param {string} [uri]\n\t *\n\t * @see NAMESPACE.HTML\n\t */\n\tisHTML: function (uri) {\n\t\treturn uri === NAMESPACE.HTML\n\t},\n\n\t/**\n\t * The SVG namespace.\n\t *\n\t * @see http://www.w3.org/2000/svg\n\t */\n\tSVG: 'http://www.w3.org/2000/svg',\n\n\t/**\n\t * The `xml:` namespace.\n\t *\n\t * @see http://www.w3.org/XML/1998/namespace\n\t */\n\tXML: 'http://www.w3.org/XML/1998/namespace',\n\n\t/**\n\t * The `xmlns:` namespace\n\t *\n\t * @see https://www.w3.org/2000/xmlns/\n\t */\n\tXMLNS: 'http://www.w3.org/2000/xmlns/',\n})\n\nexports.assign = assign;\nexports.find = find;\nexports.freeze = freeze;\nexports.MIME_TYPE = MIME_TYPE;\nexports.NAMESPACE = NAMESPACE;\n","var conventions = require(\"./conventions\");\nvar dom = require('./dom')\nvar entities = require('./entities');\nvar sax = require('./sax');\n\nvar DOMImplementation = dom.DOMImplementation;\n\nvar NAMESPACE = conventions.NAMESPACE;\n\nvar ParseError = sax.ParseError;\nvar XMLReader = sax.XMLReader;\n\n/**\n * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends:\n *\n * > XML parsed entities are often stored in computer files which,\n * > for editing convenience, are organized into lines.\n * > These lines are typically separated by some combination\n * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).\n * >\n * > To simplify the tasks of applications, the XML processor must behave\n * > as if it normalized all line breaks in external parsed entities (including the document entity)\n * > on input, before parsing, by translating all of the following to a single #xA character:\n * >\n * > 1. the two-character sequence #xD #xA\n * > 2. the two-character sequence #xD #x85\n * > 3. the single character #x85\n * > 4. the single character #x2028\n * > 5. any #xD character that is not immediately followed by #xA or #x85.\n *\n * @param {string} input\n * @returns {string}\n */\nfunction normalizeLineEndings(input) {\n\treturn input\n\t\t.replace(/\\r[\\n\\u0085]/g, '\\n')\n\t\t.replace(/[\\r\\u0085\\u2028]/g, '\\n')\n}\n\n/**\n * @typedef Locator\n * @property {number} [columnNumber]\n * @property {number} [lineNumber]\n */\n\n/**\n * @typedef DOMParserOptions\n * @property {DOMHandler} [domBuilder]\n * @property {Function} [errorHandler]\n * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing\n * \t\t\t\t\t\tdefaults to `normalizeLineEndings`\n * @property {Locator} [locator]\n * @property {Record} [xmlns]\n *\n * @see normalizeLineEndings\n */\n\n/**\n * The DOMParser interface provides the ability to parse XML or HTML source code\n * from a string into a DOM `Document`.\n *\n * _xmldom is different from the spec in that it allows an `options` parameter,\n * to override the default behavior._\n *\n * @param {DOMParserOptions} [options]\n * @constructor\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization\n */\nfunction DOMParser(options){\n\tthis.options = options ||{locator:{}};\n}\n\nDOMParser.prototype.parseFromString = function(source,mimeType){\n\tvar options = this.options;\n\tvar sax = new XMLReader();\n\tvar domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler\n\tvar errorHandler = options.errorHandler;\n\tvar locator = options.locator;\n\tvar defaultNSMap = options.xmlns||{};\n\tvar isHTML = /\\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;\n \tvar entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;\n\tif(locator){\n\t\tdomBuilder.setDocumentLocator(locator)\n\t}\n\n\tsax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);\n\tsax.domBuilder = options.domBuilder || domBuilder;\n\tif(isHTML){\n\t\tdefaultNSMap[''] = NAMESPACE.HTML;\n\t}\n\tdefaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;\n\tvar normalize = options.normalizeLineEndings || normalizeLineEndings;\n\tif (source && typeof source === 'string') {\n\t\tsax.parse(\n\t\t\tnormalize(source),\n\t\t\tdefaultNSMap,\n\t\t\tentityMap\n\t\t)\n\t} else {\n\t\tsax.errorHandler.error('invalid doc source')\n\t}\n\treturn domBuilder.doc;\n}\nfunction buildErrorHandler(errorImpl,domBuilder,locator){\n\tif(!errorImpl){\n\t\tif(domBuilder instanceof DOMHandler){\n\t\t\treturn domBuilder;\n\t\t}\n\t\terrorImpl = domBuilder ;\n\t}\n\tvar errorHandler = {}\n\tvar isCallback = errorImpl instanceof Function;\n\tlocator = locator||{}\n\tfunction build(key){\n\t\tvar fn = errorImpl[key];\n\t\tif(!fn && isCallback){\n\t\t\tfn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;\n\t\t}\n\t\terrorHandler[key] = fn && function(msg){\n\t\t\tfn('[xmldom '+key+']\\t'+msg+_locator(locator));\n\t\t}||function(){};\n\t}\n\tbuild('warning');\n\tbuild('error');\n\tbuild('fatalError');\n\treturn errorHandler;\n}\n\n//console.log('#\\n\\n\\n\\n\\n\\n\\n####')\n/**\n * +ContentHandler+ErrorHandler\n * +LexicalHandler+EntityResolver2\n * -DeclHandler-DTDHandler\n *\n * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler\n * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2\n * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html\n */\nfunction DOMHandler() {\n this.cdata = false;\n}\nfunction position(locator,node){\n\tnode.lineNumber = locator.lineNumber;\n\tnode.columnNumber = locator.columnNumber;\n}\n/**\n * @see org.xml.sax.ContentHandler#startDocument\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html\n */\nDOMHandler.prototype = {\n\tstartDocument : function() {\n \tthis.doc = new DOMImplementation().createDocument(null, null, null);\n \tif (this.locator) {\n \tthis.doc.documentURI = this.locator.systemId;\n \t}\n\t},\n\tstartElement:function(namespaceURI, localName, qName, attrs) {\n\t\tvar doc = this.doc;\n\t var el = doc.createElementNS(namespaceURI, qName||localName);\n\t var len = attrs.length;\n\t appendElement(this, el);\n\t this.currentElement = el;\n\n\t\tthis.locator && position(this.locator,el)\n\t for (var i = 0 ; i < len; i++) {\n\t var namespaceURI = attrs.getURI(i);\n\t var value = attrs.getValue(i);\n\t var qName = attrs.getQName(i);\n\t\t\tvar attr = doc.createAttributeNS(namespaceURI, qName);\n\t\t\tthis.locator &&position(attrs.getLocator(i),attr);\n\t\t\tattr.value = attr.nodeValue = value;\n\t\t\tel.setAttributeNode(attr)\n\t }\n\t},\n\tendElement:function(namespaceURI, localName, qName) {\n\t\tvar current = this.currentElement\n\t\tvar tagName = current.tagName;\n\t\tthis.currentElement = current.parentNode;\n\t},\n\tstartPrefixMapping:function(prefix, uri) {\n\t},\n\tendPrefixMapping:function(prefix) {\n\t},\n\tprocessingInstruction:function(target, data) {\n\t var ins = this.doc.createProcessingInstruction(target, data);\n\t this.locator && position(this.locator,ins)\n\t appendElement(this, ins);\n\t},\n\tignorableWhitespace:function(ch, start, length) {\n\t},\n\tcharacters:function(chars, start, length) {\n\t\tchars = _toString.apply(this,arguments)\n\t\t//console.log(chars)\n\t\tif(chars){\n\t\t\tif (this.cdata) {\n\t\t\t\tvar charNode = this.doc.createCDATASection(chars);\n\t\t\t} else {\n\t\t\t\tvar charNode = this.doc.createTextNode(chars);\n\t\t\t}\n\t\t\tif(this.currentElement){\n\t\t\t\tthis.currentElement.appendChild(charNode);\n\t\t\t}else if(/^\\s*$/.test(chars)){\n\t\t\t\tthis.doc.appendChild(charNode);\n\t\t\t\t//process xml\n\t\t\t}\n\t\t\tthis.locator && position(this.locator,charNode)\n\t\t}\n\t},\n\tskippedEntity:function(name) {\n\t},\n\tendDocument:function() {\n\t\tthis.doc.normalize();\n\t},\n\tsetDocumentLocator:function (locator) {\n\t if(this.locator = locator){// && !('lineNumber' in locator)){\n\t \tlocator.lineNumber = 0;\n\t }\n\t},\n\t//LexicalHandler\n\tcomment:function(chars, start, length) {\n\t\tchars = _toString.apply(this,arguments)\n\t var comm = this.doc.createComment(chars);\n\t this.locator && position(this.locator,comm)\n\t appendElement(this, comm);\n\t},\n\n\tstartCDATA:function() {\n\t //used in characters() methods\n\t this.cdata = true;\n\t},\n\tendCDATA:function() {\n\t this.cdata = false;\n\t},\n\n\tstartDTD:function(name, publicId, systemId) {\n\t\tvar impl = this.doc.implementation;\n\t if (impl && impl.createDocumentType) {\n\t var dt = impl.createDocumentType(name, publicId, systemId);\n\t this.locator && position(this.locator,dt)\n\t appendElement(this, dt);\n\t\t\t\t\tthis.doc.doctype = dt;\n\t }\n\t},\n\t/**\n\t * @see org.xml.sax.ErrorHandler\n\t * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html\n\t */\n\twarning:function(error) {\n\t\tconsole.warn('[xmldom warning]\\t'+error,_locator(this.locator));\n\t},\n\terror:function(error) {\n\t\tconsole.error('[xmldom error]\\t'+error,_locator(this.locator));\n\t},\n\tfatalError:function(error) {\n\t\tthrow new ParseError(error, this.locator);\n\t}\n}\nfunction _locator(l){\n\tif(l){\n\t\treturn '\\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'\n\t}\n}\nfunction _toString(chars,start,length){\n\tif(typeof chars == 'string'){\n\t\treturn chars.substr(start,length)\n\t}else{//java sax connect width xmldom on rhino(what about: \"? && !(chars instanceof String)\")\n\t\tif(chars.length >= start+length || start){\n\t\t\treturn new java.lang.String(chars,start,length)+'';\n\t\t}\n\t\treturn chars;\n\t}\n}\n\n/*\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html\n * used method of org.xml.sax.ext.LexicalHandler:\n * #comment(chars, start, length)\n * #startCDATA()\n * #endCDATA()\n * #startDTD(name, publicId, systemId)\n *\n *\n * IGNORED method of org.xml.sax.ext.LexicalHandler:\n * #endDTD()\n * #startEntity(name)\n * #endEntity(name)\n *\n *\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html\n * IGNORED method of org.xml.sax.ext.DeclHandler\n * \t#attributeDecl(eName, aName, type, mode, value)\n * #elementDecl(name, model)\n * #externalEntityDecl(name, publicId, systemId)\n * #internalEntityDecl(name, value)\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html\n * IGNORED method of org.xml.sax.EntityResolver2\n * #resolveEntity(String name,String publicId,String baseURI,String systemId)\n * #resolveEntity(publicId, systemId)\n * #getExternalSubset(name, baseURI)\n * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html\n * IGNORED method of org.xml.sax.DTDHandler\n * #notationDecl(name, publicId, systemId) {};\n * #unparsedEntityDecl(name, publicId, systemId, notationName) {};\n */\n\"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl\".replace(/\\w+/g,function(key){\n\tDOMHandler.prototype[key] = function(){return null}\n})\n\n/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */\nfunction appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key\n\nexports.__DOMHandler = DOMHandler;\nexports.normalizeLineEndings = normalizeLineEndings;\nexports.DOMParser = DOMParser;\n","var conventions = require(\"./conventions\");\n\nvar find = conventions.find;\nvar NAMESPACE = conventions.NAMESPACE;\n\n/**\n * A prerequisite for `[].filter`, to drop elements that are empty\n * @param {string} input\n * @returns {boolean}\n */\nfunction notEmptyString (input) {\n\treturn input !== ''\n}\n/**\n * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace\n * @see https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * @param {string} input\n * @returns {string[]} (can be empty)\n */\nfunction splitOnASCIIWhitespace(input) {\n\t// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE\n\treturn input ? input.split(/[\\t\\n\\f\\r ]+/).filter(notEmptyString) : []\n}\n\n/**\n * Adds element as a key to current if it is not already present.\n *\n * @param {Record} current\n * @param {string} element\n * @returns {Record}\n */\nfunction orderedSetReducer (current, element) {\n\tif (!current.hasOwnProperty(element)) {\n\t\tcurrent[element] = true;\n\t}\n\treturn current;\n}\n\n/**\n * @see https://infra.spec.whatwg.org/#ordered-set\n * @param {string} input\n * @returns {string[]}\n */\nfunction toOrderedSet(input) {\n\tif (!input) return [];\n\tvar list = splitOnASCIIWhitespace(input);\n\treturn Object.keys(list.reduce(orderedSetReducer, {}))\n}\n\n/**\n * Uses `list.indexOf` to implement something like `Array.prototype.includes`,\n * which we can not rely on being available.\n *\n * @param {any[]} list\n * @returns {function(any): boolean}\n */\nfunction arrayIncludes (list) {\n\treturn function(element) {\n\t\treturn list && list.indexOf(element) !== -1;\n\t}\n}\n\nfunction copy(src,dest){\n\tfor(var p in src){\n\t\tif (Object.prototype.hasOwnProperty.call(src, p)) {\n\t\t\tdest[p] = src[p];\n\t\t}\n\t}\n}\n\n/**\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*((?:.*\\{\\s*?[\\r\\n][\\s\\S]*?^})|\\S.*?(?=[;\\r\\n]));?\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*(\\S.*?(?=[;\\r\\n]));?\n */\nfunction _extends(Class,Super){\n\tvar pt = Class.prototype;\n\tif(!(pt instanceof Super)){\n\t\tfunction t(){};\n\t\tt.prototype = Super.prototype;\n\t\tt = new t();\n\t\tcopy(pt,t);\n\t\tClass.prototype = pt = t;\n\t}\n\tif(pt.constructor != Class){\n\t\tif(typeof Class != 'function'){\n\t\t\tconsole.error(\"unknown Class:\"+Class)\n\t\t}\n\t\tpt.constructor = Class\n\t}\n}\n\n// Node Types\nvar NodeType = {}\nvar ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;\nvar ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;\nvar TEXT_NODE = NodeType.TEXT_NODE = 3;\nvar CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;\nvar ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;\nvar ENTITY_NODE = NodeType.ENTITY_NODE = 6;\nvar PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;\nvar COMMENT_NODE = NodeType.COMMENT_NODE = 8;\nvar DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;\nvar DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;\nvar DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;\nvar NOTATION_NODE = NodeType.NOTATION_NODE = 12;\n\n// ExceptionCode\nvar ExceptionCode = {}\nvar ExceptionMessage = {};\nvar INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]=\"Index size error\"),1);\nvar DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]=\"DOMString size error\"),2);\nvar HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]=\"Hierarchy request error\"),3);\nvar WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]=\"Wrong document\"),4);\nvar INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]=\"Invalid character\"),5);\nvar NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]=\"No data allowed\"),6);\nvar NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]=\"No modification allowed\"),7);\nvar NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]=\"Not found\"),8);\nvar NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]=\"Not supported\"),9);\nvar INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]=\"Attribute in use\"),10);\n//level2\nvar INVALID_STATE_ERR \t= ExceptionCode.INVALID_STATE_ERR \t= ((ExceptionMessage[11]=\"Invalid state\"),11);\nvar SYNTAX_ERR \t= ExceptionCode.SYNTAX_ERR \t= ((ExceptionMessage[12]=\"Syntax error\"),12);\nvar INVALID_MODIFICATION_ERR \t= ExceptionCode.INVALID_MODIFICATION_ERR \t= ((ExceptionMessage[13]=\"Invalid modification\"),13);\nvar NAMESPACE_ERR \t= ExceptionCode.NAMESPACE_ERR \t= ((ExceptionMessage[14]=\"Invalid namespace\"),14);\nvar INVALID_ACCESS_ERR \t= ExceptionCode.INVALID_ACCESS_ERR \t= ((ExceptionMessage[15]=\"Invalid access\"),15);\n\n/**\n * DOM Level 2\n * Object DOMException\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html\n */\nfunction DOMException(code, message) {\n\tif(message instanceof Error){\n\t\tvar error = message;\n\t}else{\n\t\terror = this;\n\t\tError.call(this, ExceptionMessage[code]);\n\t\tthis.message = ExceptionMessage[code];\n\t\tif(Error.captureStackTrace) Error.captureStackTrace(this, DOMException);\n\t}\n\terror.code = code;\n\tif(message) this.message = this.message + \": \" + message;\n\treturn error;\n};\nDOMException.prototype = Error.prototype;\ncopy(ExceptionCode,DOMException)\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177\n * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.\n * The items in the NodeList are accessible via an integral index, starting from 0.\n */\nfunction NodeList() {\n};\nNodeList.prototype = {\n\t/**\n\t * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.\n\t * @standard level1\n\t */\n\tlength:0,\n\t/**\n\t * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.\n\t * @standard level1\n\t * @param index unsigned long\n\t * Index into the collection.\n\t * @return Node\n\t * \tThe node at the indexth position in the NodeList, or null if that is not a valid index.\n\t */\n\titem: function(index) {\n\t\treturn this[index] || null;\n\t},\n\ttoString:function(isHTML,nodeFilter){\n\t\tfor(var buf = [], i = 0;i=0){\n\t\tvar lastIndex = list.length-1\n\t\twhile(i0 || key == 'xmlns'){\n//\t\t\treturn null;\n//\t\t}\n\t\t//console.log()\n\t\tvar i = this.length;\n\t\twhile(i--){\n\t\t\tvar attr = this[i];\n\t\t\t//console.log(attr.nodeName,key)\n\t\t\tif(attr.nodeName == key){\n\t\t\t\treturn attr;\n\t\t\t}\n\t\t}\n\t},\n\tsetNamedItem: function(attr) {\n\t\tvar el = attr.ownerElement;\n\t\tif(el && el!=this._ownerElement){\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\tvar oldAttr = this.getNamedItem(attr.nodeName);\n\t\t_addNamedNode(this._ownerElement,this,attr,oldAttr);\n\t\treturn oldAttr;\n\t},\n\t/* returns Node */\n\tsetNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR\n\t\tvar el = attr.ownerElement, oldAttr;\n\t\tif(el && el!=this._ownerElement){\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\toldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName);\n\t\t_addNamedNode(this._ownerElement,this,attr,oldAttr);\n\t\treturn oldAttr;\n\t},\n\n\t/* returns Node */\n\tremoveNamedItem: function(key) {\n\t\tvar attr = this.getNamedItem(key);\n\t\t_removeNamedNode(this._ownerElement,this,attr);\n\t\treturn attr;\n\n\n\t},// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR\n\n\t//for level2\n\tremoveNamedItemNS:function(namespaceURI,localName){\n\t\tvar attr = this.getNamedItemNS(namespaceURI,localName);\n\t\t_removeNamedNode(this._ownerElement,this,attr);\n\t\treturn attr;\n\t},\n\tgetNamedItemNS: function(namespaceURI, localName) {\n\t\tvar i = this.length;\n\t\twhile(i--){\n\t\t\tvar node = this[i];\n\t\t\tif(node.localName == localName && node.namespaceURI == namespaceURI){\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n};\n\n/**\n * The DOMImplementation interface represents an object providing methods\n * which are not dependent on any particular document.\n * Such an object is returned by the `Document.implementation` property.\n *\n * __The individual methods describe the differences compared to the specs.__\n *\n * @constructor\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN\n * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)\n * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core\n * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core\n * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard\n */\nfunction DOMImplementation() {\n}\n\nDOMImplementation.prototype = {\n\t/**\n\t * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.\n\t * The different implementations fairly diverged in what kind of features were reported.\n\t * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.\n\t *\n\t * @deprecated It is deprecated and modern browsers return true in all cases.\n\t *\n\t * @param {string} feature\n\t * @param {string} [version]\n\t * @returns {boolean} always true\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN\n\t * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard\n\t */\n\thasFeature: function(feature, version) {\n\t\t\treturn true;\n\t},\n\t/**\n\t * Creates an XML Document object of the specified type with its document element.\n\t *\n\t * __It behaves slightly different from the description in the living standard__:\n\t * - There is no interface/class `XMLDocument`, it returns a `Document` instance.\n\t * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t * - this implementation is not validating names or qualified names\n\t * (when parsing XML strings, the SAX parser takes care of that)\n\t *\n\t * @param {string|null} namespaceURI\n\t * @param {string} qualifiedName\n\t * @param {DocumentType=null} doctype\n\t * @returns {Document}\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core\n\t *\n\t * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n\t * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n\t * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n\t */\n\tcreateDocument: function(namespaceURI, qualifiedName, doctype){\n\t\tvar doc = new Document();\n\t\tdoc.implementation = this;\n\t\tdoc.childNodes = new NodeList();\n\t\tdoc.doctype = doctype || null;\n\t\tif (doctype){\n\t\t\tdoc.appendChild(doctype);\n\t\t}\n\t\tif (qualifiedName){\n\t\t\tvar root = doc.createElementNS(namespaceURI, qualifiedName);\n\t\t\tdoc.appendChild(root);\n\t\t}\n\t\treturn doc;\n\t},\n\t/**\n\t * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.\n\t *\n\t * __This behavior is slightly different from the in the specs__:\n\t * - this implementation is not validating names or qualified names\n\t * (when parsing XML strings, the SAX parser takes care of that)\n\t *\n\t * @param {string} qualifiedName\n\t * @param {string} [publicId]\n\t * @param {string} [systemId]\n\t * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation\n\t * \t\t\t\t or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard\n\t *\n\t * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n\t * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n\t * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n\t */\n\tcreateDocumentType: function(qualifiedName, publicId, systemId){\n\t\tvar node = new DocumentType();\n\t\tnode.name = qualifiedName;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.publicId = publicId || '';\n\t\tnode.systemId = systemId || '';\n\n\t\treturn node;\n\t}\n};\n\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247\n */\n\nfunction Node() {\n};\n\nNode.prototype = {\n\tfirstChild : null,\n\tlastChild : null,\n\tpreviousSibling : null,\n\tnextSibling : null,\n\tattributes : null,\n\tparentNode : null,\n\tchildNodes : null,\n\townerDocument : null,\n\tnodeValue : null,\n\tnamespaceURI : null,\n\tprefix : null,\n\tlocalName : null,\n\t// Modified in DOM Level 2:\n\tinsertBefore:function(newChild, refChild){//raises\n\t\treturn _insertBefore(this,newChild,refChild);\n\t},\n\treplaceChild:function(newChild, oldChild){//raises\n\t\t_insertBefore(this, newChild,oldChild, assertPreReplacementValidityInDocument);\n\t\tif(oldChild){\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t},\n\tremoveChild:function(oldChild){\n\t\treturn _removeChild(this,oldChild);\n\t},\n\tappendChild:function(newChild){\n\t\treturn this.insertBefore(newChild,null);\n\t},\n\thasChildNodes:function(){\n\t\treturn this.firstChild != null;\n\t},\n\tcloneNode:function(deep){\n\t\treturn cloneNode(this.ownerDocument||this,this,deep);\n\t},\n\t// Modified in DOM Level 2:\n\tnormalize:function(){\n\t\tvar child = this.firstChild;\n\t\twhile(child){\n\t\t\tvar next = child.nextSibling;\n\t\t\tif(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){\n\t\t\t\tthis.removeChild(next);\n\t\t\t\tchild.appendData(next.data);\n\t\t\t}else{\n\t\t\t\tchild.normalize();\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t}\n\t},\n \t// Introduced in DOM Level 2:\n\tisSupported:function(feature, version){\n\t\treturn this.ownerDocument.implementation.hasFeature(feature,version);\n\t},\n // Introduced in DOM Level 2:\n hasAttributes:function(){\n \treturn this.attributes.length>0;\n },\n\t/**\n\t * Look up the prefix associated to the given namespace URI, starting from this node.\n\t * **The default namespace declarations are ignored by this method.**\n\t * See Namespace Prefix Lookup for details on the algorithm used by this method.\n\t *\n\t * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._\n\t *\n\t * @param {string | null} namespaceURI\n\t * @returns {string | null}\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo\n\t * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix\n\t * @see https://github.com/xmldom/xmldom/issues/322\n\t */\n lookupPrefix:function(namespaceURI){\n \tvar el = this;\n \twhile(el){\n \t\tvar map = el._nsMap;\n \t\t//console.dir(map)\n \t\tif(map){\n \t\t\tfor(var n in map){\n\t\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {\n\t\t\t\t\t\t\treturn n;\n\t\t\t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tel = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;\n \t}\n \treturn null;\n },\n // Introduced in DOM Level 3:\n lookupNamespaceURI:function(prefix){\n \tvar el = this;\n \twhile(el){\n \t\tvar map = el._nsMap;\n \t\t//console.dir(map)\n \t\tif(map){\n \t\t\tif(Object.prototype.hasOwnProperty.call(map, prefix)){\n \t\t\t\treturn map[prefix] ;\n \t\t\t}\n \t\t}\n \t\tel = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;\n \t}\n \treturn null;\n },\n // Introduced in DOM Level 3:\n isDefaultNamespace:function(namespaceURI){\n \tvar prefix = this.lookupPrefix(namespaceURI);\n \treturn prefix == null;\n }\n};\n\n\nfunction _xmlEncoder(c){\n\treturn c == '<' && '<' ||\n c == '>' && '>' ||\n c == '&' && '&' ||\n c == '\"' && '"' ||\n '&#'+c.charCodeAt()+';'\n}\n\n\ncopy(NodeType,Node);\ncopy(NodeType,Node.prototype);\n\n/**\n * @param callback return true for continue,false for break\n * @return boolean true: break visit;\n */\nfunction _visitNode(node,callback){\n\tif(callback(node)){\n\t\treturn true;\n\t}\n\tif(node = node.firstChild){\n\t\tdo{\n\t\t\tif(_visitNode(node,callback)){return true}\n }while(node=node.nextSibling)\n }\n}\n\n\n\nfunction Document(){\n\tthis.ownerDocument = this;\n}\n\nfunction _onAddAttribute(doc,el,newAttr){\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI ;\n\tif(ns === NAMESPACE.XMLNS){\n\t\t//update namespace\n\t\tel._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value\n\t}\n}\n\nfunction _onRemoveAttribute(doc,el,newAttr,remove){\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI ;\n\tif(ns === NAMESPACE.XMLNS){\n\t\t//update namespace\n\t\tdelete el._nsMap[newAttr.prefix?newAttr.localName:'']\n\t}\n}\n\n/**\n * Updates `el.childNodes`, updating the indexed items and it's `length`.\n * Passing `newChild` means it will be appended.\n * Otherwise it's assumed that an item has been removed,\n * and `el.firstNode` and it's `.nextSibling` are used\n * to walk the current list of child nodes.\n *\n * @param {Document} doc\n * @param {Node} el\n * @param {Node} [newChild]\n * @private\n */\nfunction _onUpdateChild (doc, el, newChild) {\n\tif(doc && doc._inc){\n\t\tdoc._inc++;\n\t\t//update childNodes\n\t\tvar cs = el.childNodes;\n\t\tif (newChild) {\n\t\t\tcs[cs.length++] = newChild;\n\t\t} else {\n\t\t\tvar child = el.firstChild;\n\t\t\tvar i = 0;\n\t\t\twhile (child) {\n\t\t\t\tcs[i++] = child;\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\tcs.length = i;\n\t\t\tdelete cs[cs.length];\n\t\t}\n\t}\n}\n\n/**\n * Removes the connections between `parentNode` and `child`\n * and any existing `child.previousSibling` or `child.nextSibling`.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n *\n * @param {Node} parentNode\n * @param {Node} child\n * @returns {Node} the child that was removed.\n * @private\n */\nfunction _removeChild (parentNode, child) {\n\tvar previous = child.previousSibling;\n\tvar next = child.nextSibling;\n\tif (previous) {\n\t\tprevious.nextSibling = next;\n\t} else {\n\t\tparentNode.firstChild = next;\n\t}\n\tif (next) {\n\t\tnext.previousSibling = previous;\n\t} else {\n\t\tparentNode.lastChild = previous;\n\t}\n\tchild.parentNode = null;\n\tchild.previousSibling = null;\n\tchild.nextSibling = null;\n\t_onUpdateChild(parentNode.ownerDocument, parentNode);\n\treturn child;\n}\n\n/**\n * Returns `true` if `node` can be a parent for insertion.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasValidParentNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE)\n\t);\n}\n\n/**\n * Returns `true` if `node` can be inserted according to it's `nodeType`.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasInsertableNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(isElementNode(node) ||\n\t\t\tisTextNode(node) ||\n\t\t\tisDocTypeNode(node) ||\n\t\t\tnode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||\n\t\t\tnode.nodeType === Node.COMMENT_NODE ||\n\t\t\tnode.nodeType === Node.PROCESSING_INSTRUCTION_NODE)\n\t);\n}\n\n/**\n * Returns true if `node` is a DOCTYPE node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isDocTypeNode(node) {\n\treturn node && node.nodeType === Node.DOCUMENT_TYPE_NODE;\n}\n\n/**\n * Returns true if the node is an element\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isElementNode(node) {\n\treturn node && node.nodeType === Node.ELEMENT_NODE;\n}\n/**\n * Returns true if `node` is a text node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isTextNode(node) {\n\treturn node && node.nodeType === Node.TEXT_NODE;\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Document} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementInsertionPossible(doc, child) {\n\tvar parentChildNodes = doc.childNodes || [];\n\tif (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {\n\t\treturn false;\n\t}\n\tvar docTypeNode = find(parentChildNodes, isDocTypeNode);\n\treturn !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Node} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementReplacementPossible(doc, child) {\n\tvar parentChildNodes = doc.childNodes || [];\n\n\tfunction hasElementChildThatIsNotChild(node) {\n\t\treturn isElementNode(node) && node !== child;\n\t}\n\n\tif (find(parentChildNodes, hasElementChildThatIsNotChild)) {\n\t\treturn false;\n\t}\n\tvar docTypeNode = find(parentChildNodes, isDocTypeNode);\n\treturn !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * @private\n * Steps 1-5 of the checks before inserting and before replacing a child are the same.\n *\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidity1to5(parent, node, child) {\n\t// 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a \"HierarchyRequestError\" DOMException.\n\tif (!hasValidParentNodeType(parent)) {\n\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected parent node type ' + parent.nodeType);\n\t}\n\t// 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a \"HierarchyRequestError\" DOMException.\n\t// not implemented!\n\t// 3. If `child` is non-null and its parent is not `parent`, then throw a \"NotFoundError\" DOMException.\n\tif (child && child.parentNode !== parent) {\n\t\tthrow new DOMException(NOT_FOUND_ERR, 'child not in parent');\n\t}\n\tif (\n\t\t// 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a \"HierarchyRequestError\" DOMException.\n\t\t!hasInsertableNodeType(node) ||\n\t\t// 5. If either `node` is a Text node and `parent` is a document,\n\t\t// the sax parser currently adds top level text nodes, this will be fixed in 0.9.0\n\t\t// || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)\n\t\t// or `node` is a doctype and `parent` is not a document, then throw a \"HierarchyRequestError\" DOMException.\n\t\t(isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE)\n\t) {\n\t\tthrow new DOMException(\n\t\t\tHIERARCHY_REQUEST_ERR,\n\t\t\t'Unexpected node type ' + node.nodeType + ' for parent node type ' + parent.nodeType\n\t\t);\n\t}\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidityInDocument(parent, node, child) {\n\tvar parentChildNodes = parent.childNodes || [];\n\tvar nodeChildNodes = node.childNodes || [];\n\n\t// DocumentFragment\n\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\tvar nodeChildElements = nodeChildNodes.filter(isElementNode);\n\t\t// If node has more than one element child or has a Text node child.\n\t\tif (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n\t\t}\n\t\t// Otherwise, if `node` has one element child and either `parent` has an element child,\n\t\t// `child` is a doctype, or `child` is non-null and a doctype is following `child`.\n\t\tif (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n\t\t}\n\t}\n\t// Element\n\tif (isElementNode(node)) {\n\t\t// `parent` has an element child, `child` is a doctype,\n\t\t// or `child` is non-null and a doctype is following `child`.\n\t\tif (!isElementInsertionPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n\t\t}\n\t}\n\t// DocumentType\n\tif (isDocTypeNode(node)) {\n\t\t// `parent` has a doctype child,\n\t\tif (find(parentChildNodes, isDocTypeNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n\t\t}\n\t\tvar parentElementChild = find(parentChildNodes, isElementNode);\n\t\t// `child` is non-null and an element is preceding `child`,\n\t\tif (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t\t// or `child` is null and `parent` has an element child.\n\t\tif (!child && parentElementChild) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');\n\t\t}\n\t}\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreReplacementValidityInDocument(parent, node, child) {\n\tvar parentChildNodes = parent.childNodes || [];\n\tvar nodeChildNodes = node.childNodes || [];\n\n\t// DocumentFragment\n\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\tvar nodeChildElements = nodeChildNodes.filter(isElementNode);\n\t\t// If `node` has more than one element child or has a Text node child.\n\t\tif (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n\t\t}\n\t\t// Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`.\n\t\tif (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n\t\t}\n\t}\n\t// Element\n\tif (isElementNode(node)) {\n\t\t// `parent` has an element child that is not `child` or a doctype is following `child`.\n\t\tif (!isElementReplacementPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n\t\t}\n\t}\n\t// DocumentType\n\tif (isDocTypeNode(node)) {\n\t\tfunction hasDoctypeChildThatIsNotChild(node) {\n\t\t\treturn isDocTypeNode(node) && node !== child;\n\t\t}\n\n\t\t// `parent` has a doctype child that is not `child`,\n\t\tif (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n\t\t}\n\t\tvar parentElementChild = find(parentChildNodes, isElementNode);\n\t\t// or an element is preceding `child`.\n\t\tif (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t}\n}\n\n/**\n * @private\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction _insertBefore(parent, node, child, _inDocumentAssertion) {\n\t// To ensure pre-insertion validity of a node into a parent before a child, run these steps:\n\tassertPreInsertionValidity1to5(parent, node, child);\n\n\t// If parent is a document, and any of the statements below, switched on the interface node implements,\n\t// are true, then throw a \"HierarchyRequestError\" DOMException.\n\tif (parent.nodeType === Node.DOCUMENT_NODE) {\n\t\t(_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);\n\t}\n\n\tvar cp = node.parentNode;\n\tif(cp){\n\t\tcp.removeChild(node);//remove and update\n\t}\n\tif(node.nodeType === DOCUMENT_FRAGMENT_NODE){\n\t\tvar newFirst = node.firstChild;\n\t\tif (newFirst == null) {\n\t\t\treturn node;\n\t\t}\n\t\tvar newLast = node.lastChild;\n\t}else{\n\t\tnewFirst = newLast = node;\n\t}\n\tvar pre = child ? child.previousSibling : parent.lastChild;\n\n\tnewFirst.previousSibling = pre;\n\tnewLast.nextSibling = child;\n\n\n\tif(pre){\n\t\tpre.nextSibling = newFirst;\n\t}else{\n\t\tparent.firstChild = newFirst;\n\t}\n\tif(child == null){\n\t\tparent.lastChild = newLast;\n\t}else{\n\t\tchild.previousSibling = newLast;\n\t}\n\tdo{\n\t\tnewFirst.parentNode = parent;\n\t}while(newFirst !== newLast && (newFirst= newFirst.nextSibling))\n\t_onUpdateChild(parent.ownerDocument||parent, parent);\n\t//console.log(parent.lastChild.nextSibling == null)\n\tif (node.nodeType == DOCUMENT_FRAGMENT_NODE) {\n\t\tnode.firstChild = node.lastChild = null;\n\t}\n\treturn node;\n}\n\n/**\n * Appends `newChild` to `parentNode`.\n * If `newChild` is already connected to a `parentNode` it is first removed from it.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n * @param {Node} parentNode\n * @param {Node} newChild\n * @returns {Node}\n * @private\n */\nfunction _appendSingleChild (parentNode, newChild) {\n\tif (newChild.parentNode) {\n\t\tnewChild.parentNode.removeChild(newChild);\n\t}\n\tnewChild.parentNode = parentNode;\n\tnewChild.previousSibling = parentNode.lastChild;\n\tnewChild.nextSibling = null;\n\tif (newChild.previousSibling) {\n\t\tnewChild.previousSibling.nextSibling = newChild;\n\t} else {\n\t\tparentNode.firstChild = newChild;\n\t}\n\tparentNode.lastChild = newChild;\n\t_onUpdateChild(parentNode.ownerDocument, parentNode, newChild);\n\treturn newChild;\n}\n\nDocument.prototype = {\n\t//implementation : null,\n\tnodeName : '#document',\n\tnodeType : DOCUMENT_NODE,\n\t/**\n\t * The DocumentType node of the document.\n\t *\n\t * @readonly\n\t * @type DocumentType\n\t */\n\tdoctype : null,\n\tdocumentElement : null,\n\t_inc : 1,\n\n\tinsertBefore : function(newChild, refChild){//raises\n\t\tif(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){\n\t\t\tvar child = newChild.firstChild;\n\t\t\twhile(child){\n\t\t\t\tvar next = child.nextSibling;\n\t\t\t\tthis.insertBefore(child,refChild);\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t\treturn newChild;\n\t\t}\n\t\t_insertBefore(this, newChild, refChild);\n\t\tnewChild.ownerDocument = this;\n\t\tif (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {\n\t\t\tthis.documentElement = newChild;\n\t\t}\n\n\t\treturn newChild;\n\t},\n\tremoveChild : function(oldChild){\n\t\tif(this.documentElement == oldChild){\n\t\t\tthis.documentElement = null;\n\t\t}\n\t\treturn _removeChild(this,oldChild);\n\t},\n\treplaceChild: function (newChild, oldChild) {\n\t\t//raises\n\t\t_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);\n\t\tnewChild.ownerDocument = this;\n\t\tif (oldChild) {\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t\tif (isElementNode(newChild)) {\n\t\t\tthis.documentElement = newChild;\n\t\t}\n\t},\n\t// Introduced in DOM Level 2:\n\timportNode : function(importedNode,deep){\n\t\treturn importNode(this,importedNode,deep);\n\t},\n\t// Introduced in DOM Level 2:\n\tgetElementById :\tfunction(id){\n\t\tvar rtv = null;\n\t\t_visitNode(this.documentElement,function(node){\n\t\t\tif(node.nodeType == ELEMENT_NODE){\n\t\t\t\tif(node.getAttribute('id') == id){\n\t\t\t\t\trtv = node;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\treturn rtv;\n\t},\n\n\t/**\n\t * The `getElementsByClassName` method of `Document` interface returns an array-like object\n\t * of all child elements which have **all** of the given class name(s).\n\t *\n\t * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.\n\t *\n\t *\n\t * Warning: This is a live LiveNodeList.\n\t * Changes in the DOM will reflect in the array as the changes occur.\n\t * If an element selected by this array no longer qualifies for the selector,\n\t * it will automatically be removed. Be aware of this for iteration purposes.\n\t *\n\t * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName\n\t * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname\n\t */\n\tgetElementsByClassName: function(classNames) {\n\t\tvar classNamesSet = toOrderedSet(classNames)\n\t\treturn new LiveNodeList(this, function(base) {\n\t\t\tvar ls = [];\n\t\t\tif (classNamesSet.length > 0) {\n\t\t\t\t_visitNode(base.documentElement, function(node) {\n\t\t\t\t\tif(node !== base && node.nodeType === ELEMENT_NODE) {\n\t\t\t\t\t\tvar nodeClassNames = node.getAttribute('class')\n\t\t\t\t\t\t// can be null if the attribute does not exist\n\t\t\t\t\t\tif (nodeClassNames) {\n\t\t\t\t\t\t\t// before splitting and iterating just compare them for the most common case\n\t\t\t\t\t\t\tvar matches = classNames === nodeClassNames;\n\t\t\t\t\t\t\tif (!matches) {\n\t\t\t\t\t\t\t\tvar nodeClassNamesSet = toOrderedSet(nodeClassNames)\n\t\t\t\t\t\t\t\tmatches = classNamesSet.every(arrayIncludes(nodeClassNamesSet))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(matches) {\n\t\t\t\t\t\t\t\tls.push(node);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn ls;\n\t\t});\n\t},\n\n\t//document factory method:\n\tcreateElement :\tfunction(tagName){\n\t\tvar node = new Element();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = tagName;\n\t\tnode.tagName = tagName;\n\t\tnode.localName = tagName;\n\t\tnode.childNodes = new NodeList();\n\t\tvar attrs\t= node.attributes = new NamedNodeMap();\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\tcreateDocumentFragment :\tfunction(){\n\t\tvar node = new DocumentFragment();\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\treturn node;\n\t},\n\tcreateTextNode :\tfunction(data){\n\t\tvar node = new Text();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateComment :\tfunction(data){\n\t\tvar node = new Comment();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateCDATASection :\tfunction(data){\n\t\tvar node = new CDATASection();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateProcessingInstruction :\tfunction(target,data){\n\t\tvar node = new ProcessingInstruction();\n\t\tnode.ownerDocument = this;\n\t\tnode.tagName = node.target = target;\n\t\tnode.nodeValue= node.data = data;\n\t\treturn node;\n\t},\n\tcreateAttribute :\tfunction(name){\n\t\tvar node = new Attr();\n\t\tnode.ownerDocument\t= this;\n\t\tnode.name = name;\n\t\tnode.nodeName\t= name;\n\t\tnode.localName = name;\n\t\tnode.specified = true;\n\t\treturn node;\n\t},\n\tcreateEntityReference :\tfunction(name){\n\t\tvar node = new EntityReference();\n\t\tnode.ownerDocument\t= this;\n\t\tnode.nodeName\t= name;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateElementNS :\tfunction(namespaceURI,qualifiedName){\n\t\tvar node = new Element();\n\t\tvar pl = qualifiedName.split(':');\n\t\tvar attrs\t= node.attributes = new NamedNodeMap();\n\t\tnode.childNodes = new NodeList();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.tagName = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tif(pl.length == 2){\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t}else{\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateAttributeNS :\tfunction(namespaceURI,qualifiedName){\n\t\tvar node = new Attr();\n\t\tvar pl = qualifiedName.split(':');\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.name = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tnode.specified = true;\n\t\tif(pl.length == 2){\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t}else{\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\treturn node;\n\t}\n};\n_extends(Document,Node);\n\n\nfunction Element() {\n\tthis._nsMap = {};\n};\nElement.prototype = {\n\tnodeType : ELEMENT_NODE,\n\thasAttribute : function(name){\n\t\treturn this.getAttributeNode(name)!=null;\n\t},\n\tgetAttribute : function(name){\n\t\tvar attr = this.getAttributeNode(name);\n\t\treturn attr && attr.value || '';\n\t},\n\tgetAttributeNode : function(name){\n\t\treturn this.attributes.getNamedItem(name);\n\t},\n\tsetAttribute : function(name, value){\n\t\tvar attr = this.ownerDocument.createAttribute(name);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr)\n\t},\n\tremoveAttribute : function(name){\n\t\tvar attr = this.getAttributeNode(name)\n\t\tattr && this.removeAttributeNode(attr);\n\t},\n\n\t//four real opeartion method\n\tappendChild:function(newChild){\n\t\tif(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){\n\t\t\treturn this.insertBefore(newChild,null);\n\t\t}else{\n\t\t\treturn _appendSingleChild(this,newChild);\n\t\t}\n\t},\n\tsetAttributeNode : function(newAttr){\n\t\treturn this.attributes.setNamedItem(newAttr);\n\t},\n\tsetAttributeNodeNS : function(newAttr){\n\t\treturn this.attributes.setNamedItemNS(newAttr);\n\t},\n\tremoveAttributeNode : function(oldAttr){\n\t\t//console.log(this == oldAttr.ownerElement)\n\t\treturn this.attributes.removeNamedItem(oldAttr.nodeName);\n\t},\n\t//get real attribute name,and remove it by removeAttributeNode\n\tremoveAttributeNS : function(namespaceURI, localName){\n\t\tvar old = this.getAttributeNodeNS(namespaceURI, localName);\n\t\told && this.removeAttributeNode(old);\n\t},\n\n\thasAttributeNS : function(namespaceURI, localName){\n\t\treturn this.getAttributeNodeNS(namespaceURI, localName)!=null;\n\t},\n\tgetAttributeNS : function(namespaceURI, localName){\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\treturn attr && attr.value || '';\n\t},\n\tsetAttributeNS : function(namespaceURI, qualifiedName, value){\n\t\tvar attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr)\n\t},\n\tgetAttributeNodeNS : function(namespaceURI, localName){\n\t\treturn this.attributes.getNamedItemNS(namespaceURI, localName);\n\t},\n\n\tgetElementsByTagName : function(tagName){\n\t\treturn new LiveNodeList(this,function(base){\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base,function(node){\n\t\t\t\tif(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\t\t});\n\t},\n\tgetElementsByTagNameNS : function(namespaceURI, localName){\n\t\treturn new LiveNodeList(this,function(base){\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base,function(node){\n\t\t\t\tif(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\n\t\t});\n\t}\n};\nDocument.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;\nDocument.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;\n\n\n_extends(Element,Node);\nfunction Attr() {\n};\nAttr.prototype.nodeType = ATTRIBUTE_NODE;\n_extends(Attr,Node);\n\n\nfunction CharacterData() {\n};\nCharacterData.prototype = {\n\tdata : '',\n\tsubstringData : function(offset, count) {\n\t\treturn this.data.substring(offset, offset+count);\n\t},\n\tappendData: function(text) {\n\t\ttext = this.data+text;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t},\n\tinsertData: function(offset,text) {\n\t\tthis.replaceData(offset,0,text);\n\n\t},\n\tappendChild:function(newChild){\n\t\tthrow new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])\n\t},\n\tdeleteData: function(offset, count) {\n\t\tthis.replaceData(offset,count,\"\");\n\t},\n\treplaceData: function(offset, count, text) {\n\t\tvar start = this.data.substring(0,offset);\n\t\tvar end = this.data.substring(offset+count);\n\t\ttext = start + text + end;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t}\n}\n_extends(CharacterData,Node);\nfunction Text() {\n};\nText.prototype = {\n\tnodeName : \"#text\",\n\tnodeType : TEXT_NODE,\n\tsplitText : function(offset) {\n\t\tvar text = this.data;\n\t\tvar newText = text.substring(offset);\n\t\ttext = text.substring(0, offset);\n\t\tthis.data = this.nodeValue = text;\n\t\tthis.length = text.length;\n\t\tvar newNode = this.ownerDocument.createTextNode(newText);\n\t\tif(this.parentNode){\n\t\t\tthis.parentNode.insertBefore(newNode, this.nextSibling);\n\t\t}\n\t\treturn newNode;\n\t}\n}\n_extends(Text,CharacterData);\nfunction Comment() {\n};\nComment.prototype = {\n\tnodeName : \"#comment\",\n\tnodeType : COMMENT_NODE\n}\n_extends(Comment,CharacterData);\n\nfunction CDATASection() {\n};\nCDATASection.prototype = {\n\tnodeName : \"#cdata-section\",\n\tnodeType : CDATA_SECTION_NODE\n}\n_extends(CDATASection,CharacterData);\n\n\nfunction DocumentType() {\n};\nDocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;\n_extends(DocumentType,Node);\n\nfunction Notation() {\n};\nNotation.prototype.nodeType = NOTATION_NODE;\n_extends(Notation,Node);\n\nfunction Entity() {\n};\nEntity.prototype.nodeType = ENTITY_NODE;\n_extends(Entity,Node);\n\nfunction EntityReference() {\n};\nEntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;\n_extends(EntityReference,Node);\n\nfunction DocumentFragment() {\n};\nDocumentFragment.prototype.nodeName =\t\"#document-fragment\";\nDocumentFragment.prototype.nodeType =\tDOCUMENT_FRAGMENT_NODE;\n_extends(DocumentFragment,Node);\n\n\nfunction ProcessingInstruction() {\n}\nProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;\n_extends(ProcessingInstruction,Node);\nfunction XMLSerializer(){}\nXMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){\n\treturn nodeSerializeToString.call(node,isHtml,nodeFilter);\n}\nNode.prototype.toString = nodeSerializeToString;\nfunction nodeSerializeToString(isHtml,nodeFilter){\n\tvar buf = [];\n\tvar refNode = this.nodeType == 9 && this.documentElement || this;\n\tvar prefix = refNode.prefix;\n\tvar uri = refNode.namespaceURI;\n\n\tif(uri && prefix == null){\n\t\t//console.log(prefix)\n\t\tvar prefix = refNode.lookupPrefix(uri);\n\t\tif(prefix == null){\n\t\t\t//isHTML = true;\n\t\t\tvar visibleNamespaces=[\n\t\t\t{namespace:uri,prefix:null}\n\t\t\t//{namespace:uri,prefix:''}\n\t\t\t]\n\t\t}\n\t}\n\tserializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);\n\t//console.log('###',this.nodeType,uri,prefix,buf.join(''))\n\treturn buf.join('');\n}\n\nfunction needNamespaceDefine(node, isHTML, visibleNamespaces) {\n\tvar prefix = node.prefix || '';\n\tvar uri = node.namespaceURI;\n\t// According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,\n\t// and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :\n\t// > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.\n\t// in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)\n\t// and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :\n\t// > [...] Furthermore, the attribute value [...] must not be an empty string.\n\t// so serializing empty namespace value like xmlns:ds=\"\" would produce an invalid XML document.\n\tif (!uri) {\n\t\treturn false;\n\t}\n\tif (prefix === \"xml\" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {\n\t\treturn false;\n\t}\n\n\tvar i = visibleNamespaces.length\n\twhile (i--) {\n\t\tvar ns = visibleNamespaces[i];\n\t\t// get namespace prefix\n\t\tif (ns.prefix === prefix) {\n\t\t\treturn ns.namespace !== uri;\n\t\t}\n\t}\n\treturn true;\n}\n/**\n * Well-formed constraint: No < in Attribute Values\n * > The replacement text of any entity referred to directly or indirectly\n * > in an attribute value must not contain a <.\n * @see https://www.w3.org/TR/xml11/#CleanAttrVals\n * @see https://www.w3.org/TR/xml11/#NT-AttValue\n *\n * Literal whitespace other than space that appear in attribute values\n * are serialized as their entity references, so they will be preserved.\n * (In contrast to whitespace literals in the input which are normalized to spaces)\n * @see https://www.w3.org/TR/xml11/#AVNormalize\n * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes\n */\nfunction addSerializedAttribute(buf, qualifiedName, value) {\n\tbuf.push(' ', qualifiedName, '=\"', value.replace(/[<>&\"\\t\\n\\r]/g, _xmlEncoder), '\"')\n}\n\nfunction serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){\n\tif (!visibleNamespaces) {\n\t\tvisibleNamespaces = [];\n\t}\n\n\tif(nodeFilter){\n\t\tnode = nodeFilter(node);\n\t\tif(node){\n\t\t\tif(typeof node == 'string'){\n\t\t\t\tbuf.push(node);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}else{\n\t\t\treturn;\n\t\t}\n\t\t//buf.sort.apply(attrs, attributeSorter);\n\t}\n\n\tswitch(node.nodeType){\n\tcase ELEMENT_NODE:\n\t\tvar attrs = node.attributes;\n\t\tvar len = attrs.length;\n\t\tvar child = node.firstChild;\n\t\tvar nodeName = node.tagName;\n\n\t\tisHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML\n\n\t\tvar prefixedNodeName = nodeName\n\t\tif (!isHTML && !node.prefix && node.namespaceURI) {\n\t\t\tvar defaultNS\n\t\t\t// lookup current default ns from `xmlns` attribute\n\t\t\tfor (var ai = 0; ai < attrs.length; ai++) {\n\t\t\t\tif (attrs.item(ai).name === 'xmlns') {\n\t\t\t\t\tdefaultNS = attrs.item(ai).value\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!defaultNS) {\n\t\t\t\t// lookup current default ns in visibleNamespaces\n\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\tvar namespace = visibleNamespaces[nsi]\n\t\t\t\t\tif (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\tdefaultNS = namespace.namespace\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (defaultNS !== node.namespaceURI) {\n\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\tvar namespace = visibleNamespaces[nsi]\n\t\t\t\t\tif (namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\tif (namespace.prefix) {\n\t\t\t\t\t\t\tprefixedNodeName = namespace.prefix + ':' + nodeName\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbuf.push('<', prefixedNodeName);\n\n\t\tfor(var i=0;i');\n\t\t\t//if is cdata child node\n\t\t\tif(isHTML && /^script$/i.test(nodeName)){\n\t\t\t\twhile(child){\n\t\t\t\t\tif(child.data){\n\t\t\t\t\t\tbuf.push(child.data);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\t}\n\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t}\n\t\t\t}else\n\t\t\t{\n\t\t\t\twhile(child){\n\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.push('');\n\t\t}else{\n\t\t\tbuf.push('/>');\n\t\t}\n\t\t// remove added visible namespaces\n\t\t//visibleNamespaces.length = startVisibleNamespaces;\n\t\treturn;\n\tcase DOCUMENT_NODE:\n\tcase DOCUMENT_FRAGMENT_NODE:\n\t\tvar child = node.firstChild;\n\t\twhile(child){\n\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\tchild = child.nextSibling;\n\t\t}\n\t\treturn;\n\tcase ATTRIBUTE_NODE:\n\t\treturn addSerializedAttribute(buf, node.name, node.value);\n\tcase TEXT_NODE:\n\t\t/**\n\t\t * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,\n\t\t * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.\n\t\t * If they are needed elsewhere, they must be escaped using either numeric character references or the strings\n\t\t * `&` and `<` respectively.\n\t\t * The right angle bracket (>) may be represented using the string \" > \", and must, for compatibility,\n\t\t * be escaped using either `>` or a character reference when it appears in the string `]]>` in content,\n\t\t * when that string is not marking the end of a CDATA section.\n\t\t *\n\t\t * In the content of elements, character data is any string of characters\n\t\t * which does not contain the start-delimiter of any markup\n\t\t * and does not include the CDATA-section-close delimiter, `]]>`.\n\t\t *\n\t\t * @see https://www.w3.org/TR/xml/#NT-CharData\n\t\t * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node\n\t\t */\n\t\treturn buf.push(node.data\n\t\t\t.replace(/[<&>]/g,_xmlEncoder)\n\t\t);\n\tcase CDATA_SECTION_NODE:\n\t\treturn buf.push( '');\n\tcase COMMENT_NODE:\n\t\treturn buf.push( \"\");\n\tcase DOCUMENT_TYPE_NODE:\n\t\tvar pubid = node.publicId;\n\t\tvar sysid = node.systemId;\n\t\tbuf.push('');\n\t\t}else if(sysid && sysid!='.'){\n\t\t\tbuf.push(' SYSTEM ', sysid, '>');\n\t\t}else{\n\t\t\tvar sub = node.internalSubset;\n\t\t\tif(sub){\n\t\t\t\tbuf.push(\" [\",sub,\"]\");\n\t\t\t}\n\t\t\tbuf.push(\">\");\n\t\t}\n\t\treturn;\n\tcase PROCESSING_INSTRUCTION_NODE:\n\t\treturn buf.push( \"\");\n\tcase ENTITY_REFERENCE_NODE:\n\t\treturn buf.push( '&',node.nodeName,';');\n\t//case ENTITY_NODE:\n\t//case NOTATION_NODE:\n\tdefault:\n\t\tbuf.push('??',node.nodeName);\n\t}\n}\nfunction importNode(doc,node,deep){\n\tvar node2;\n\tswitch (node.nodeType) {\n\tcase ELEMENT_NODE:\n\t\tnode2 = node.cloneNode(false);\n\t\tnode2.ownerDocument = doc;\n\t\t//var attrs = node2.attributes;\n\t\t//var len = attrs.length;\n\t\t//for(var i=0;i', lt:'<', quot:'\"'})\n\n/**\n * A map of currently 241 entities that are detected in an HTML document.\n * They contain all entries from `XML_ENTITIES`.\n *\n * @see XML_ENTITIES\n * @see DOMParser.parseFromString\n * @see DOMImplementation.prototype.createHTMLDocument\n * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec\n * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names\n * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)\n */\nexports.HTML_ENTITIES = freeze({\n lt: '<',\n gt: '>',\n amp: '&',\n quot: '\"',\n apos: \"'\",\n Agrave: \"À\",\n Aacute: \"Á\",\n Acirc: \"Â\",\n Atilde: \"Ã\",\n Auml: \"Ä\",\n Aring: \"Å\",\n AElig: \"Æ\",\n Ccedil: \"Ç\",\n Egrave: \"È\",\n Eacute: \"É\",\n Ecirc: \"Ê\",\n Euml: \"Ë\",\n Igrave: \"Ì\",\n Iacute: \"Í\",\n Icirc: \"Î\",\n Iuml: \"Ï\",\n ETH: \"Ð\",\n Ntilde: \"Ñ\",\n Ograve: \"Ò\",\n Oacute: \"Ó\",\n Ocirc: \"Ô\",\n Otilde: \"Õ\",\n Ouml: \"Ö\",\n Oslash: \"Ø\",\n Ugrave: \"Ù\",\n Uacute: \"Ú\",\n Ucirc: \"Û\",\n Uuml: \"Ü\",\n Yacute: \"Ý\",\n THORN: \"Þ\",\n szlig: \"ß\",\n agrave: \"à\",\n aacute: \"á\",\n acirc: \"â\",\n atilde: \"ã\",\n auml: \"ä\",\n aring: \"å\",\n aelig: \"æ\",\n ccedil: \"ç\",\n egrave: \"è\",\n eacute: \"é\",\n ecirc: \"ê\",\n euml: \"ë\",\n igrave: \"ì\",\n iacute: \"í\",\n icirc: \"î\",\n iuml: \"ï\",\n eth: \"ð\",\n ntilde: \"ñ\",\n ograve: \"ò\",\n oacute: \"ó\",\n ocirc: \"ô\",\n otilde: \"õ\",\n ouml: \"ö\",\n oslash: \"ø\",\n ugrave: \"ù\",\n uacute: \"ú\",\n ucirc: \"û\",\n uuml: \"ü\",\n yacute: \"ý\",\n thorn: \"þ\",\n yuml: \"ÿ\",\n nbsp: \"\\u00a0\",\n iexcl: \"¡\",\n cent: \"¢\",\n pound: \"£\",\n curren: \"¤\",\n yen: \"¥\",\n brvbar: \"¦\",\n sect: \"§\",\n uml: \"¨\",\n copy: \"©\",\n ordf: \"ª\",\n laquo: \"«\",\n not: \"¬\",\n shy: \"­­\",\n reg: \"®\",\n macr: \"¯\",\n deg: \"°\",\n plusmn: \"±\",\n sup2: \"²\",\n sup3: \"³\",\n acute: \"´\",\n micro: \"µ\",\n para: \"¶\",\n middot: \"·\",\n cedil: \"¸\",\n sup1: \"¹\",\n ordm: \"º\",\n raquo: \"»\",\n frac14: \"¼\",\n frac12: \"½\",\n frac34: \"¾\",\n iquest: \"¿\",\n times: \"×\",\n divide: \"÷\",\n forall: \"∀\",\n part: \"∂\",\n exist: \"∃\",\n empty: \"∅\",\n nabla: \"∇\",\n isin: \"∈\",\n notin: \"∉\",\n ni: \"∋\",\n prod: \"∏\",\n sum: \"∑\",\n minus: \"−\",\n lowast: \"∗\",\n radic: \"√\",\n prop: \"∝\",\n infin: \"∞\",\n ang: \"∠\",\n and: \"∧\",\n or: \"∨\",\n cap: \"∩\",\n cup: \"∪\",\n 'int': \"∫\",\n there4: \"∴\",\n sim: \"∼\",\n cong: \"≅\",\n asymp: \"≈\",\n ne: \"≠\",\n equiv: \"≡\",\n le: \"≤\",\n ge: \"≥\",\n sub: \"⊂\",\n sup: \"⊃\",\n nsub: \"⊄\",\n sube: \"⊆\",\n supe: \"⊇\",\n oplus: \"⊕\",\n otimes: \"⊗\",\n perp: \"⊥\",\n sdot: \"⋅\",\n Alpha: \"Α\",\n Beta: \"Β\",\n Gamma: \"Γ\",\n Delta: \"Δ\",\n Epsilon: \"Ε\",\n Zeta: \"Ζ\",\n Eta: \"Η\",\n Theta: \"Θ\",\n Iota: \"Ι\",\n Kappa: \"Κ\",\n Lambda: \"Λ\",\n Mu: \"Μ\",\n Nu: \"Ν\",\n Xi: \"Ξ\",\n Omicron: \"Ο\",\n Pi: \"Π\",\n Rho: \"Ρ\",\n Sigma: \"Σ\",\n Tau: \"Τ\",\n Upsilon: \"Υ\",\n Phi: \"Φ\",\n Chi: \"Χ\",\n Psi: \"Ψ\",\n Omega: \"Ω\",\n alpha: \"α\",\n beta: \"β\",\n gamma: \"γ\",\n delta: \"δ\",\n epsilon: \"ε\",\n zeta: \"ζ\",\n eta: \"η\",\n theta: \"θ\",\n iota: \"ι\",\n kappa: \"κ\",\n lambda: \"λ\",\n mu: \"μ\",\n nu: \"ν\",\n xi: \"ξ\",\n omicron: \"ο\",\n pi: \"π\",\n rho: \"ρ\",\n sigmaf: \"ς\",\n sigma: \"σ\",\n tau: \"τ\",\n upsilon: \"υ\",\n phi: \"φ\",\n chi: \"χ\",\n psi: \"ψ\",\n omega: \"ω\",\n thetasym: \"ϑ\",\n upsih: \"ϒ\",\n piv: \"ϖ\",\n OElig: \"Œ\",\n oelig: \"œ\",\n Scaron: \"Š\",\n scaron: \"š\",\n Yuml: \"Ÿ\",\n fnof: \"ƒ\",\n circ: \"ˆ\",\n tilde: \"˜\",\n ensp: \" \",\n emsp: \" \",\n thinsp: \" \",\n zwnj: \"‌\",\n zwj: \"‍\",\n lrm: \"‎\",\n rlm: \"‏\",\n ndash: \"–\",\n mdash: \"—\",\n lsquo: \"‘\",\n rsquo: \"’\",\n sbquo: \"‚\",\n ldquo: \"“\",\n rdquo: \"”\",\n bdquo: \"„\",\n dagger: \"†\",\n Dagger: \"‡\",\n bull: \"•\",\n hellip: \"…\",\n permil: \"‰\",\n prime: \"′\",\n Prime: \"″\",\n lsaquo: \"‹\",\n rsaquo: \"›\",\n oline: \"‾\",\n euro: \"€\",\n trade: \"™\",\n larr: \"←\",\n uarr: \"↑\",\n rarr: \"→\",\n darr: \"↓\",\n harr: \"↔\",\n crarr: \"↵\",\n lceil: \"⌈\",\n rceil: \"⌉\",\n lfloor: \"⌊\",\n rfloor: \"⌋\",\n loz: \"◊\",\n spades: \"♠\",\n clubs: \"♣\",\n hearts: \"♥\",\n diams: \"♦\"\n});\n\n/**\n * @deprecated use `HTML_ENTITIES` instead\n * @see HTML_ENTITIES\n */\nexports.entityMap = exports.HTML_ENTITIES\n","var dom = require('./dom')\nexports.DOMImplementation = dom.DOMImplementation\nexports.XMLSerializer = dom.XMLSerializer\nexports.DOMParser = require('./dom-parser').DOMParser\n","var NAMESPACE = require(\"./conventions\").NAMESPACE;\n\n//[4] \tNameStartChar\t ::= \t\":\" | [A-Z] | \"_\" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n//[4a] \tNameChar\t ::= \tNameStartChar | \"-\" | \".\" | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]\n//[5] \tName\t ::= \tNameStartChar (NameChar)*\nvar nameStartChar = /[A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]///\\u10000-\\uEFFFF\nvar nameChar = new RegExp(\"[\\\\-\\\\.0-9\"+nameStartChar.source.slice(1,-1)+\"\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]\");\nvar tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\\:'+nameStartChar.source+nameChar.source+'*)?$');\n//var tagNamePattern = /^[a-zA-Z_][\\w\\-\\.]*(?:\\:[a-zA-Z_][\\w\\-\\.]*)?$/\n//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')\n\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\nvar S_TAG = 0;//tag name offerring\nvar S_ATTR = 1;//attr name offerring\nvar S_ATTR_SPACE=2;//attr name end and space offer\nvar S_EQ = 3;//=space?\nvar S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)\nvar S_ATTR_END = 5;//attr value end and no space(quot end)\nvar S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)\nvar S_TAG_CLOSE = 7;//closed el\n\n/**\n * Creates an error that will not be caught by XMLReader aka the SAX parser.\n *\n * @param {string} message\n * @param {any?} locator Optional, can provide details about the location in the source\n * @constructor\n */\nfunction ParseError(message, locator) {\n\tthis.message = message\n\tthis.locator = locator\n\tif(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);\n}\nParseError.prototype = new Error();\nParseError.prototype.name = ParseError.name\n\nfunction XMLReader(){\n\n}\n\nXMLReader.prototype = {\n\tparse:function(source,defaultNSMap,entityMap){\n\t\tvar domBuilder = this.domBuilder;\n\t\tdomBuilder.startDocument();\n\t\t_copy(defaultNSMap ,defaultNSMap = {})\n\t\tparse(source,defaultNSMap,entityMap,\n\t\t\t\tdomBuilder,this.errorHandler);\n\t\tdomBuilder.endDocument();\n\t}\n}\nfunction parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){\n\tfunction fixedFromCharCode(code) {\n\t\t// String.prototype.fromCharCode does not supports\n\t\t// > 2 bytes unicode chars directly\n\t\tif (code > 0xffff) {\n\t\t\tcode -= 0x10000;\n\t\t\tvar surrogate1 = 0xd800 + (code >> 10)\n\t\t\t\t, surrogate2 = 0xdc00 + (code & 0x3ff);\n\n\t\t\treturn String.fromCharCode(surrogate1, surrogate2);\n\t\t} else {\n\t\t\treturn String.fromCharCode(code);\n\t\t}\n\t}\n\tfunction entityReplacer(a){\n\t\tvar k = a.slice(1,-1);\n\t\tif (Object.hasOwnProperty.call(entityMap, k)) {\n\t\t\treturn entityMap[k];\n\t\t}else if(k.charAt(0) === '#'){\n\t\t\treturn fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))\n\t\t}else{\n\t\t\terrorHandler.error('entity not found:'+a);\n\t\t\treturn a;\n\t\t}\n\t}\n\tfunction appendText(end){//has some bugs\n\t\tif(end>start){\n\t\t\tvar xt = source.substring(start,end).replace(/&#?\\w+;/g,entityReplacer);\n\t\t\tlocator&&position(start);\n\t\t\tdomBuilder.characters(xt,0,end-start);\n\t\t\tstart = end\n\t\t}\n\t}\n\tfunction position(p,m){\n\t\twhile(p>=lineEnd && (m = linePattern.exec(source))){\n\t\t\tlineStart = m.index;\n\t\t\tlineEnd = lineStart + m[0].length;\n\t\t\tlocator.lineNumber++;\n\t\t\t//console.log('line++:',locator,startPos,endPos)\n\t\t}\n\t\tlocator.columnNumber = p-lineStart+1;\n\t}\n\tvar lineStart = 0;\n\tvar lineEnd = 0;\n\tvar linePattern = /.*(?:\\r\\n?|\\n)|.*$/g\n\tvar locator = domBuilder.locator;\n\n\tvar parseStack = [{currentNSMap:defaultNSMapCopy}]\n\tvar closeMap = {};\n\tvar start = 0;\n\twhile(true){\n\t\ttry{\n\t\t\tvar tagStart = source.indexOf('<',start);\n\t\t\tif(tagStart<0){\n\t\t\t\tif(!source.substr(start).match(/^\\s*$/)){\n\t\t\t\t\tvar doc = domBuilder.doc;\n\t \t\t\tvar text = doc.createTextNode(source.substr(start));\n\t \t\t\tdoc.appendChild(text);\n\t \t\t\tdomBuilder.currentElement = text;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(tagStart>start){\n\t\t\t\tappendText(tagStart);\n\t\t\t}\n\t\t\tswitch(source.charAt(tagStart+1)){\n\t\t\tcase '/':\n\t\t\t\tvar end = source.indexOf('>',tagStart+3);\n\t\t\t\tvar tagName = source.substring(tagStart + 2, end).replace(/[ \\t\\n\\r]+$/g, '');\n\t\t\t\tvar config = parseStack.pop();\n\t\t\t\tif(end<0){\n\n\t \t\ttagName = source.substring(tagStart+2).replace(/[\\s<].*/,'');\n\t \t\terrorHandler.error(\"end tag name: \"+tagName+' is not complete:'+config.tagName);\n\t \t\tend = tagStart+1+tagName.length;\n\t \t}else if(tagName.match(/\\s\n\t\t\t\tlocator&&position(tagStart);\n\t\t\t\tend = parseInstruction(source,tagStart,domBuilder);\n\t\t\t\tbreak;\n\t\t\tcase '!':// start){\n\t\t\tstart = end;\n\t\t}else{\n\t\t\t//TODO: 这里有可能sax回退,有位置错误风险\n\t\t\tappendText(Math.max(tagStart,start)+1);\n\t\t}\n\t}\n}\nfunction copyLocator(f,t){\n\tt.lineNumber = f.lineNumber;\n\tt.columnNumber = f.columnNumber;\n\treturn t;\n}\n\n/**\n * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);\n * @return end of the elementStartPart(end of elementEndPart for selfClosed el)\n */\nfunction parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){\n\n\t/**\n\t * @param {string} qname\n\t * @param {string} value\n\t * @param {number} startIndex\n\t */\n\tfunction addAttribute(qname, value, startIndex) {\n\t\tif (el.attributeNames.hasOwnProperty(qname)) {\n\t\t\terrorHandler.fatalError('Attribute ' + qname + ' redefined')\n\t\t}\n\t\tel.addValue(\n\t\t\tqname,\n\t\t\t// @see https://www.w3.org/TR/xml/#AVNormalize\n\t\t\t// since the xmldom sax parser does not \"interpret\" DTD the following is not implemented:\n\t\t\t// - recursive replacement of (DTD) entity references\n\t\t\t// - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA\n\t\t\tvalue.replace(/[\\t\\n\\r]/g, ' ').replace(/&#?\\w+;/g, entityReplacer),\n\t\t\tstartIndex\n\t\t)\n\t}\n\tvar attrName;\n\tvar value;\n\tvar p = ++start;\n\tvar s = S_TAG;//status\n\twhile(true){\n\t\tvar c = source.charAt(p);\n\t\tswitch(c){\n\t\tcase '=':\n\t\t\tif(s === S_ATTR){//attrName\n\t\t\t\tattrName = source.slice(start,p);\n\t\t\t\ts = S_EQ;\n\t\t\t}else if(s === S_ATTR_SPACE){\n\t\t\t\ts = S_EQ;\n\t\t\t}else{\n\t\t\t\t//fatalError: equal must after attrName or space after attrName\n\t\t\t\tthrow new Error('attribute equal must after attrName'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '\\'':\n\t\tcase '\"':\n\t\t\tif(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE\n\t\t\t\t){//equal\n\t\t\t\tif(s === S_ATTR){\n\t\t\t\t\terrorHandler.warning('attribute value must after \"=\"')\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t}\n\t\t\t\tstart = p+1;\n\t\t\t\tp = source.indexOf(c,start)\n\t\t\t\tif(p>0){\n\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\taddAttribute(attrName, value, start-1);\n\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t}else{\n\t\t\t\t\t//fatalError: no end quot match\n\t\t\t\t\tthrow new Error('attribute value no end \\''+c+'\\' match');\n\t\t\t\t}\n\t\t\t}else if(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed start quot('+c+')!!');\n\t\t\t\tstart = p+1;\n\t\t\t\ts = S_ATTR_END\n\t\t\t}else{\n\t\t\t\t//fatalError: no equal before\n\t\t\t\tthrow new Error('attribute value must after \"=\"'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '/':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\ts =S_TAG_CLOSE;\n\t\t\t\tel.closed = true;\n\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\tcase S_ATTR:\n\t\t\tcase S_ATTR_SPACE:\n\t\t\t\tbreak;\n\t\t\t//case S_EQ:\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"attribute invalid close char('/')\") // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase ''://end document\n\t\t\terrorHandler.error('unexpected end of input');\n\t\t\tif(s == S_TAG){\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\t}\n\t\t\treturn p;\n\t\tcase '>':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\tbreak;//normal\n\t\t\tcase S_ATTR_NOQUOT_VALUE://Compatible state\n\t\t\tcase S_ATTR:\n\t\t\t\tvalue = source.slice(start,p);\n\t\t\t\tif(value.slice(-1) === '/'){\n\t\t\t\t\tel.closed = true;\n\t\t\t\t\tvalue = value.slice(0,-1)\n\t\t\t\t}\n\t\t\tcase S_ATTR_SPACE:\n\t\t\t\tif(s === S_ATTR_SPACE){\n\t\t\t\t\tvalue = attrName;\n\t\t\t\t}\n\t\t\t\tif(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\t}else{\n\t\t\t\t\tif(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed value!! \"'+value+'\" instead!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(value, value, start)\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase S_EQ:\n\t\t\t\tthrow new Error('attribute value missed!!');\n\t\t\t}\n//\t\t\tconsole.log(tagName,tagNamePattern,tagNamePattern.test(tagName))\n\t\t\treturn p;\n\t\t/*xml space '\\x20' | #x9 | #xD | #xA; */\n\t\tcase '\\u0080':\n\t\t\tc = ' ';\n\t\tdefault:\n\t\t\tif(c<= ' '){//space\n\t\t\t\tswitch(s){\n\t\t\t\tcase S_TAG:\n\t\t\t\t\tel.setTagName(source.slice(start,p));//tagName\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR:\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t\ts = S_ATTR_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\tvar value = source.slice(start, p);\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\t//case S_TAG_SPACE:\n\t\t\t\t//case S_EQ:\n\t\t\t\t//case S_ATTR_SPACE:\n\t\t\t\t//\tvoid();break;\n\t\t\t\t//case S_TAG_CLOSE:\n\t\t\t\t\t//ignore warning\n\t\t\t\t}\n\t\t\t}else{//not space\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\n\t\t\t\tswitch(s){\n\t\t\t\t//case S_TAG:void();break;\n\t\t\t\t//case S_ATTR:void();break;\n\t\t\t\t//case S_ATTR_NOQUOT_VALUE:void();break;\n\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\tvar tagName = el.tagName;\n\t\t\t\t\tif (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed value!! \"'+attrName+'\" instead2!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(attrName, attrName, start);\n\t\t\t\t\tstart = p;\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\terrorHandler.warning('attribute space is required\"'+attrName+'\"!!')\n\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_EQ:\n\t\t\t\t\ts = S_ATTR_NOQUOT_VALUE;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\tthrow new Error(\"elements closed character '/' and '>' must be connected to\");\n\t\t\t\t}\n\t\t\t}\n\t\t}//end outer switch\n\t\t//console.log('p++',p)\n\t\tp++;\n\t}\n}\n/**\n * @return true if has new namespace define\n */\nfunction appendElement(el,domBuilder,currentNSMap){\n\tvar tagName = el.tagName;\n\tvar localNSMap = null;\n\t//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;\n\tvar i = el.length;\n\twhile(i--){\n\t\tvar a = el[i];\n\t\tvar qName = a.qName;\n\t\tvar value = a.value;\n\t\tvar nsp = qName.indexOf(':');\n\t\tif(nsp>0){\n\t\t\tvar prefix = a.prefix = qName.slice(0,nsp);\n\t\t\tvar localName = qName.slice(nsp+1);\n\t\t\tvar nsPrefix = prefix === 'xmlns' && localName\n\t\t}else{\n\t\t\tlocalName = qName;\n\t\t\tprefix = null\n\t\t\tnsPrefix = qName === 'xmlns' && ''\n\t\t}\n\t\t//can not set prefix,because prefix !== ''\n\t\ta.localName = localName ;\n\t\t//prefix == null for no ns prefix attribute\n\t\tif(nsPrefix !== false){//hack!!\n\t\t\tif(localNSMap == null){\n\t\t\t\tlocalNSMap = {}\n\t\t\t\t//console.log(currentNSMap,0)\n\t\t\t\t_copy(currentNSMap,currentNSMap={})\n\t\t\t\t//console.log(currentNSMap,1)\n\t\t\t}\n\t\t\tcurrentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;\n\t\t\ta.uri = NAMESPACE.XMLNS\n\t\t\tdomBuilder.startPrefixMapping(nsPrefix, value)\n\t\t}\n\t}\n\tvar i = el.length;\n\twhile(i--){\n\t\ta = el[i];\n\t\tvar prefix = a.prefix;\n\t\tif(prefix){//no prefix attribute has no namespace\n\t\t\tif(prefix === 'xml'){\n\t\t\t\ta.uri = NAMESPACE.XML;\n\t\t\t}if(prefix !== 'xmlns'){\n\t\t\t\ta.uri = currentNSMap[prefix || '']\n\n\t\t\t\t//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}\n\t\t\t}\n\t\t}\n\t}\n\tvar nsp = tagName.indexOf(':');\n\tif(nsp>0){\n\t\tprefix = el.prefix = tagName.slice(0,nsp);\n\t\tlocalName = el.localName = tagName.slice(nsp+1);\n\t}else{\n\t\tprefix = null;//important!!\n\t\tlocalName = el.localName = tagName;\n\t}\n\t//no prefix element has default namespace\n\tvar ns = el.uri = currentNSMap[prefix || ''];\n\tdomBuilder.startElement(ns,localName,tagName,el);\n\t//endPrefixMapping and startPrefixMapping have not any help for dom builder\n\t//localNSMap = null\n\tif(el.closed){\n\t\tdomBuilder.endElement(ns,localName,tagName);\n\t\tif(localNSMap){\n\t\t\tfor (prefix in localNSMap) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {\n\t\t\t\t\tdomBuilder.endPrefixMapping(prefix);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}else{\n\t\tel.currentNSMap = currentNSMap;\n\t\tel.localNSMap = localNSMap;\n\t\t//parseStack.push(el);\n\t\treturn true;\n\t}\n}\nfunction parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){\n\tif(/^(?:script|textarea)$/i.test(tagName)){\n\t\tvar elEndStart = source.indexOf('',elStartEnd);\n\t\tvar text = source.substring(elStartEnd+1,elEndStart);\n\t\tif(/[&<]/.test(text)){\n\t\t\tif(/^script$/i.test(tagName)){\n\t\t\t\t//if(!/\\]\\]>/.test(text)){\n\t\t\t\t\t//lexHandler.startCDATA();\n\t\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\t\t//lexHandler.endCDATA();\n\t\t\t\t\treturn elEndStart;\n\t\t\t\t//}\n\t\t\t}//}else{//text area\n\t\t\t\ttext = text.replace(/&#?\\w+;/g,entityReplacer);\n\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\treturn elEndStart;\n\t\t\t//}\n\n\t\t}\n\t}\n\treturn elStartEnd+1;\n}\nfunction fixSelfClosed(source,elStartEnd,tagName,closeMap){\n\t//if(tagName in closeMap){\n\tvar pos = closeMap[tagName];\n\tif(pos == null){\n\t\t//console.log(tagName)\n\t\tpos = source.lastIndexOf('')\n\t\tif(pos',start+4);\n\t\t\t//append comment source.substring(4,end)//\");\n\tcase DOCUMENT_TYPE_NODE:\n\t\tvar pubid = node.publicId;\n\t\tvar sysid = node.systemId;\n\t\tbuf.push('');\n\t\t}else if(sysid && sysid!='.'){\n\t\t\tbuf.push(' SYSTEM ', sysid, '>');\n\t\t}else{\n\t\t\tvar sub = node.internalSubset;\n\t\t\tif(sub){\n\t\t\t\tbuf.push(\" [\",sub,\"]\");\n\t\t\t}\n\t\t\tbuf.push(\">\");\n\t\t}\n\t\treturn;\n\tcase PROCESSING_INSTRUCTION_NODE:\n\t\treturn buf.push( \"\");\n\tcase ENTITY_REFERENCE_NODE:\n\t\treturn buf.push( '&',node.nodeName,';');\n\t//case ENTITY_NODE:\n\t//case NOTATION_NODE:\n\tdefault:\n\t\tbuf.push('??',node.nodeName);\n\t}\n}\nfunction importNode(doc,node,deep){\n\tvar node2;\n\tswitch (node.nodeType) {\n\tcase ELEMENT_NODE:\n\t\tnode2 = node.cloneNode(false);\n\t\tnode2.ownerDocument = doc;\n\t\t//var attrs = node2.attributes;\n\t\t//var len = attrs.length;\n\t\t//for(var i=0;i', lt:'<', quot:'\"'})\n\n/**\n * A map of currently 241 entities that are detected in an HTML document.\n * They contain all entries from `XML_ENTITIES`.\n *\n * @see XML_ENTITIES\n * @see DOMParser.parseFromString\n * @see DOMImplementation.prototype.createHTMLDocument\n * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec\n * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names\n * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)\n */\nexports.HTML_ENTITIES = freeze({\n lt: '<',\n gt: '>',\n amp: '&',\n quot: '\"',\n apos: \"'\",\n Agrave: \"À\",\n Aacute: \"Á\",\n Acirc: \"Â\",\n Atilde: \"Ã\",\n Auml: \"Ä\",\n Aring: \"Å\",\n AElig: \"Æ\",\n Ccedil: \"Ç\",\n Egrave: \"È\",\n Eacute: \"É\",\n Ecirc: \"Ê\",\n Euml: \"Ë\",\n Igrave: \"Ì\",\n Iacute: \"Í\",\n Icirc: \"Î\",\n Iuml: \"Ï\",\n ETH: \"Ð\",\n Ntilde: \"Ñ\",\n Ograve: \"Ò\",\n Oacute: \"Ó\",\n Ocirc: \"Ô\",\n Otilde: \"Õ\",\n Ouml: \"Ö\",\n Oslash: \"Ø\",\n Ugrave: \"Ù\",\n Uacute: \"Ú\",\n Ucirc: \"Û\",\n Uuml: \"Ü\",\n Yacute: \"Ý\",\n THORN: \"Þ\",\n szlig: \"ß\",\n agrave: \"à\",\n aacute: \"á\",\n acirc: \"â\",\n atilde: \"ã\",\n auml: \"ä\",\n aring: \"å\",\n aelig: \"æ\",\n ccedil: \"ç\",\n egrave: \"è\",\n eacute: \"é\",\n ecirc: \"ê\",\n euml: \"ë\",\n igrave: \"ì\",\n iacute: \"í\",\n icirc: \"î\",\n iuml: \"ï\",\n eth: \"ð\",\n ntilde: \"ñ\",\n ograve: \"ò\",\n oacute: \"ó\",\n ocirc: \"ô\",\n otilde: \"õ\",\n ouml: \"ö\",\n oslash: \"ø\",\n ugrave: \"ù\",\n uacute: \"ú\",\n ucirc: \"û\",\n uuml: \"ü\",\n yacute: \"ý\",\n thorn: \"þ\",\n yuml: \"ÿ\",\n nbsp: \"\\u00a0\",\n iexcl: \"¡\",\n cent: \"¢\",\n pound: \"£\",\n curren: \"¤\",\n yen: \"¥\",\n brvbar: \"¦\",\n sect: \"§\",\n uml: \"¨\",\n copy: \"©\",\n ordf: \"ª\",\n laquo: \"«\",\n not: \"¬\",\n shy: \"­­\",\n reg: \"®\",\n macr: \"¯\",\n deg: \"°\",\n plusmn: \"±\",\n sup2: \"²\",\n sup3: \"³\",\n acute: \"´\",\n micro: \"µ\",\n para: \"¶\",\n middot: \"·\",\n cedil: \"¸\",\n sup1: \"¹\",\n ordm: \"º\",\n raquo: \"»\",\n frac14: \"¼\",\n frac12: \"½\",\n frac34: \"¾\",\n iquest: \"¿\",\n times: \"×\",\n divide: \"÷\",\n forall: \"∀\",\n part: \"∂\",\n exist: \"∃\",\n empty: \"∅\",\n nabla: \"∇\",\n isin: \"∈\",\n notin: \"∉\",\n ni: \"∋\",\n prod: \"∏\",\n sum: \"∑\",\n minus: \"−\",\n lowast: \"∗\",\n radic: \"√\",\n prop: \"∝\",\n infin: \"∞\",\n ang: \"∠\",\n and: \"∧\",\n or: \"∨\",\n cap: \"∩\",\n cup: \"∪\",\n 'int': \"∫\",\n there4: \"∴\",\n sim: \"∼\",\n cong: \"≅\",\n asymp: \"≈\",\n ne: \"≠\",\n equiv: \"≡\",\n le: \"≤\",\n ge: \"≥\",\n sub: \"⊂\",\n sup: \"⊃\",\n nsub: \"⊄\",\n sube: \"⊆\",\n supe: \"⊇\",\n oplus: \"⊕\",\n otimes: \"⊗\",\n perp: \"⊥\",\n sdot: \"⋅\",\n Alpha: \"Α\",\n Beta: \"Β\",\n Gamma: \"Γ\",\n Delta: \"Δ\",\n Epsilon: \"Ε\",\n Zeta: \"Ζ\",\n Eta: \"Η\",\n Theta: \"Θ\",\n Iota: \"Ι\",\n Kappa: \"Κ\",\n Lambda: \"Λ\",\n Mu: \"Μ\",\n Nu: \"Ν\",\n Xi: \"Ξ\",\n Omicron: \"Ο\",\n Pi: \"Π\",\n Rho: \"Ρ\",\n Sigma: \"Σ\",\n Tau: \"Τ\",\n Upsilon: \"Υ\",\n Phi: \"Φ\",\n Chi: \"Χ\",\n Psi: \"Ψ\",\n Omega: \"Ω\",\n alpha: \"α\",\n beta: \"β\",\n gamma: \"γ\",\n delta: \"δ\",\n epsilon: \"ε\",\n zeta: \"ζ\",\n eta: \"η\",\n theta: \"θ\",\n iota: \"ι\",\n kappa: \"κ\",\n lambda: \"λ\",\n mu: \"μ\",\n nu: \"ν\",\n xi: \"ξ\",\n omicron: \"ο\",\n pi: \"π\",\n rho: \"ρ\",\n sigmaf: \"ς\",\n sigma: \"σ\",\n tau: \"τ\",\n upsilon: \"υ\",\n phi: \"φ\",\n chi: \"χ\",\n psi: \"ψ\",\n omega: \"ω\",\n thetasym: \"ϑ\",\n upsih: \"ϒ\",\n piv: \"ϖ\",\n OElig: \"Œ\",\n oelig: \"œ\",\n Scaron: \"Š\",\n scaron: \"š\",\n Yuml: \"Ÿ\",\n fnof: \"ƒ\",\n circ: \"ˆ\",\n tilde: \"˜\",\n ensp: \" \",\n emsp: \" \",\n thinsp: \" \",\n zwnj: \"‌\",\n zwj: \"‍\",\n lrm: \"‎\",\n rlm: \"‏\",\n ndash: \"–\",\n mdash: \"—\",\n lsquo: \"‘\",\n rsquo: \"’\",\n sbquo: \"‚\",\n ldquo: \"“\",\n rdquo: \"”\",\n bdquo: \"„\",\n dagger: \"†\",\n Dagger: \"‡\",\n bull: \"•\",\n hellip: \"…\",\n permil: \"‰\",\n prime: \"′\",\n Prime: \"″\",\n lsaquo: \"‹\",\n rsaquo: \"›\",\n oline: \"‾\",\n euro: \"€\",\n trade: \"™\",\n larr: \"←\",\n uarr: \"↑\",\n rarr: \"→\",\n darr: \"↓\",\n harr: \"↔\",\n crarr: \"↵\",\n lceil: \"⌈\",\n rceil: \"⌉\",\n lfloor: \"⌊\",\n rfloor: \"⌋\",\n loz: \"◊\",\n spades: \"♠\",\n clubs: \"♣\",\n hearts: \"♥\",\n diams: \"♦\"\n});\n\n/**\n * @deprecated use `HTML_ENTITIES` instead\n * @see HTML_ENTITIES\n */\nexports.entityMap = exports.HTML_ENTITIES\n","var dom = require('./dom')\nexports.DOMImplementation = dom.DOMImplementation\nexports.XMLSerializer = dom.XMLSerializer\nexports.DOMParser = require('./dom-parser').DOMParser\n","var NAMESPACE = require(\"./conventions\").NAMESPACE;\n\n//[4] \tNameStartChar\t ::= \t\":\" | [A-Z] | \"_\" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n//[4a] \tNameChar\t ::= \tNameStartChar | \"-\" | \".\" | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]\n//[5] \tName\t ::= \tNameStartChar (NameChar)*\nvar nameStartChar = /[A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]///\\u10000-\\uEFFFF\nvar nameChar = new RegExp(\"[\\\\-\\\\.0-9\"+nameStartChar.source.slice(1,-1)+\"\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]\");\nvar tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\\:'+nameStartChar.source+nameChar.source+'*)?$');\n//var tagNamePattern = /^[a-zA-Z_][\\w\\-\\.]*(?:\\:[a-zA-Z_][\\w\\-\\.]*)?$/\n//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')\n\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\nvar S_TAG = 0;//tag name offerring\nvar S_ATTR = 1;//attr name offerring\nvar S_ATTR_SPACE=2;//attr name end and space offer\nvar S_EQ = 3;//=space?\nvar S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)\nvar S_ATTR_END = 5;//attr value end and no space(quot end)\nvar S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)\nvar S_TAG_CLOSE = 7;//closed el\n\n/**\n * Creates an error that will not be caught by XMLReader aka the SAX parser.\n *\n * @param {string} message\n * @param {any?} locator Optional, can provide details about the location in the source\n * @constructor\n */\nfunction ParseError(message, locator) {\n\tthis.message = message\n\tthis.locator = locator\n\tif(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);\n}\nParseError.prototype = new Error();\nParseError.prototype.name = ParseError.name\n\nfunction XMLReader(){\n\n}\n\nXMLReader.prototype = {\n\tparse:function(source,defaultNSMap,entityMap){\n\t\tvar domBuilder = this.domBuilder;\n\t\tdomBuilder.startDocument();\n\t\t_copy(defaultNSMap ,defaultNSMap = {})\n\t\tparse(source,defaultNSMap,entityMap,\n\t\t\t\tdomBuilder,this.errorHandler);\n\t\tdomBuilder.endDocument();\n\t}\n}\nfunction parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){\n\tfunction fixedFromCharCode(code) {\n\t\t// String.prototype.fromCharCode does not supports\n\t\t// > 2 bytes unicode chars directly\n\t\tif (code > 0xffff) {\n\t\t\tcode -= 0x10000;\n\t\t\tvar surrogate1 = 0xd800 + (code >> 10)\n\t\t\t\t, surrogate2 = 0xdc00 + (code & 0x3ff);\n\n\t\t\treturn String.fromCharCode(surrogate1, surrogate2);\n\t\t} else {\n\t\t\treturn String.fromCharCode(code);\n\t\t}\n\t}\n\tfunction entityReplacer(a){\n\t\tvar k = a.slice(1,-1);\n\t\tif (Object.hasOwnProperty.call(entityMap, k)) {\n\t\t\treturn entityMap[k];\n\t\t}else if(k.charAt(0) === '#'){\n\t\t\treturn fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))\n\t\t}else{\n\t\t\terrorHandler.error('entity not found:'+a);\n\t\t\treturn a;\n\t\t}\n\t}\n\tfunction appendText(end){//has some bugs\n\t\tif(end>start){\n\t\t\tvar xt = source.substring(start,end).replace(/&#?\\w+;/g,entityReplacer);\n\t\t\tlocator&&position(start);\n\t\t\tdomBuilder.characters(xt,0,end-start);\n\t\t\tstart = end\n\t\t}\n\t}\n\tfunction position(p,m){\n\t\twhile(p>=lineEnd && (m = linePattern.exec(source))){\n\t\t\tlineStart = m.index;\n\t\t\tlineEnd = lineStart + m[0].length;\n\t\t\tlocator.lineNumber++;\n\t\t\t//console.log('line++:',locator,startPos,endPos)\n\t\t}\n\t\tlocator.columnNumber = p-lineStart+1;\n\t}\n\tvar lineStart = 0;\n\tvar lineEnd = 0;\n\tvar linePattern = /.*(?:\\r\\n?|\\n)|.*$/g\n\tvar locator = domBuilder.locator;\n\n\tvar parseStack = [{currentNSMap:defaultNSMapCopy}]\n\tvar closeMap = {};\n\tvar start = 0;\n\twhile(true){\n\t\ttry{\n\t\t\tvar tagStart = source.indexOf('<',start);\n\t\t\tif(tagStart<0){\n\t\t\t\tif(!source.substr(start).match(/^\\s*$/)){\n\t\t\t\t\tvar doc = domBuilder.doc;\n\t \t\t\tvar text = doc.createTextNode(source.substr(start));\n\t \t\t\tdoc.appendChild(text);\n\t \t\t\tdomBuilder.currentElement = text;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(tagStart>start){\n\t\t\t\tappendText(tagStart);\n\t\t\t}\n\t\t\tswitch(source.charAt(tagStart+1)){\n\t\t\tcase '/':\n\t\t\t\tvar end = source.indexOf('>',tagStart+3);\n\t\t\t\tvar tagName = source.substring(tagStart + 2, end).replace(/[ \\t\\n\\r]+$/g, '');\n\t\t\t\tvar config = parseStack.pop();\n\t\t\t\tif(end<0){\n\n\t \t\ttagName = source.substring(tagStart+2).replace(/[\\s<].*/,'');\n\t \t\terrorHandler.error(\"end tag name: \"+tagName+' is not complete:'+config.tagName);\n\t \t\tend = tagStart+1+tagName.length;\n\t \t}else if(tagName.match(/\\s\n\t\t\t\tlocator&&position(tagStart);\n\t\t\t\tend = parseInstruction(source,tagStart,domBuilder);\n\t\t\t\tbreak;\n\t\t\tcase '!':// start){\n\t\t\tstart = end;\n\t\t}else{\n\t\t\t//TODO: 这里有可能sax回退,有位置错误风险\n\t\t\tappendText(Math.max(tagStart,start)+1);\n\t\t}\n\t}\n}\nfunction copyLocator(f,t){\n\tt.lineNumber = f.lineNumber;\n\tt.columnNumber = f.columnNumber;\n\treturn t;\n}\n\n/**\n * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);\n * @return end of the elementStartPart(end of elementEndPart for selfClosed el)\n */\nfunction parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){\n\n\t/**\n\t * @param {string} qname\n\t * @param {string} value\n\t * @param {number} startIndex\n\t */\n\tfunction addAttribute(qname, value, startIndex) {\n\t\tif (el.attributeNames.hasOwnProperty(qname)) {\n\t\t\terrorHandler.fatalError('Attribute ' + qname + ' redefined')\n\t\t}\n\t\tel.addValue(\n\t\t\tqname,\n\t\t\t// @see https://www.w3.org/TR/xml/#AVNormalize\n\t\t\t// since the xmldom sax parser does not \"interpret\" DTD the following is not implemented:\n\t\t\t// - recursive replacement of (DTD) entity references\n\t\t\t// - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA\n\t\t\tvalue.replace(/[\\t\\n\\r]/g, ' ').replace(/&#?\\w+;/g, entityReplacer),\n\t\t\tstartIndex\n\t\t)\n\t}\n\tvar attrName;\n\tvar value;\n\tvar p = ++start;\n\tvar s = S_TAG;//status\n\twhile(true){\n\t\tvar c = source.charAt(p);\n\t\tswitch(c){\n\t\tcase '=':\n\t\t\tif(s === S_ATTR){//attrName\n\t\t\t\tattrName = source.slice(start,p);\n\t\t\t\ts = S_EQ;\n\t\t\t}else if(s === S_ATTR_SPACE){\n\t\t\t\ts = S_EQ;\n\t\t\t}else{\n\t\t\t\t//fatalError: equal must after attrName or space after attrName\n\t\t\t\tthrow new Error('attribute equal must after attrName'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '\\'':\n\t\tcase '\"':\n\t\t\tif(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE\n\t\t\t\t){//equal\n\t\t\t\tif(s === S_ATTR){\n\t\t\t\t\terrorHandler.warning('attribute value must after \"=\"')\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t}\n\t\t\t\tstart = p+1;\n\t\t\t\tp = source.indexOf(c,start)\n\t\t\t\tif(p>0){\n\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\taddAttribute(attrName, value, start-1);\n\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t}else{\n\t\t\t\t\t//fatalError: no end quot match\n\t\t\t\t\tthrow new Error('attribute value no end \\''+c+'\\' match');\n\t\t\t\t}\n\t\t\t}else if(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed start quot('+c+')!!');\n\t\t\t\tstart = p+1;\n\t\t\t\ts = S_ATTR_END\n\t\t\t}else{\n\t\t\t\t//fatalError: no equal before\n\t\t\t\tthrow new Error('attribute value must after \"=\"'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '/':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\ts =S_TAG_CLOSE;\n\t\t\t\tel.closed = true;\n\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\tcase S_ATTR:\n\t\t\tcase S_ATTR_SPACE:\n\t\t\t\tbreak;\n\t\t\t//case S_EQ:\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"attribute invalid close char('/')\") // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase ''://end document\n\t\t\terrorHandler.error('unexpected end of input');\n\t\t\tif(s == S_TAG){\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\t}\n\t\t\treturn p;\n\t\tcase '>':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\tbreak;//normal\n\t\t\tcase S_ATTR_NOQUOT_VALUE://Compatible state\n\t\t\tcase S_ATTR:\n\t\t\t\tvalue = source.slice(start,p);\n\t\t\t\tif(value.slice(-1) === '/'){\n\t\t\t\t\tel.closed = true;\n\t\t\t\t\tvalue = value.slice(0,-1)\n\t\t\t\t}\n\t\t\tcase S_ATTR_SPACE:\n\t\t\t\tif(s === S_ATTR_SPACE){\n\t\t\t\t\tvalue = attrName;\n\t\t\t\t}\n\t\t\t\tif(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\t}else{\n\t\t\t\t\tif(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed value!! \"'+value+'\" instead!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(value, value, start)\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase S_EQ:\n\t\t\t\tthrow new Error('attribute value missed!!');\n\t\t\t}\n//\t\t\tconsole.log(tagName,tagNamePattern,tagNamePattern.test(tagName))\n\t\t\treturn p;\n\t\t/*xml space '\\x20' | #x9 | #xD | #xA; */\n\t\tcase '\\u0080':\n\t\t\tc = ' ';\n\t\tdefault:\n\t\t\tif(c<= ' '){//space\n\t\t\t\tswitch(s){\n\t\t\t\tcase S_TAG:\n\t\t\t\t\tel.setTagName(source.slice(start,p));//tagName\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR:\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t\ts = S_ATTR_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\tvar value = source.slice(start, p);\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\t//case S_TAG_SPACE:\n\t\t\t\t//case S_EQ:\n\t\t\t\t//case S_ATTR_SPACE:\n\t\t\t\t//\tvoid();break;\n\t\t\t\t//case S_TAG_CLOSE:\n\t\t\t\t\t//ignore warning\n\t\t\t\t}\n\t\t\t}else{//not space\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\n\t\t\t\tswitch(s){\n\t\t\t\t//case S_TAG:void();break;\n\t\t\t\t//case S_ATTR:void();break;\n\t\t\t\t//case S_ATTR_NOQUOT_VALUE:void();break;\n\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\tvar tagName = el.tagName;\n\t\t\t\t\tif (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed value!! \"'+attrName+'\" instead2!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(attrName, attrName, start);\n\t\t\t\t\tstart = p;\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\terrorHandler.warning('attribute space is required\"'+attrName+'\"!!')\n\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_EQ:\n\t\t\t\t\ts = S_ATTR_NOQUOT_VALUE;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\tthrow new Error(\"elements closed character '/' and '>' must be connected to\");\n\t\t\t\t}\n\t\t\t}\n\t\t}//end outer switch\n\t\t//console.log('p++',p)\n\t\tp++;\n\t}\n}\n/**\n * @return true if has new namespace define\n */\nfunction appendElement(el,domBuilder,currentNSMap){\n\tvar tagName = el.tagName;\n\tvar localNSMap = null;\n\t//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;\n\tvar i = el.length;\n\twhile(i--){\n\t\tvar a = el[i];\n\t\tvar qName = a.qName;\n\t\tvar value = a.value;\n\t\tvar nsp = qName.indexOf(':');\n\t\tif(nsp>0){\n\t\t\tvar prefix = a.prefix = qName.slice(0,nsp);\n\t\t\tvar localName = qName.slice(nsp+1);\n\t\t\tvar nsPrefix = prefix === 'xmlns' && localName\n\t\t}else{\n\t\t\tlocalName = qName;\n\t\t\tprefix = null\n\t\t\tnsPrefix = qName === 'xmlns' && ''\n\t\t}\n\t\t//can not set prefix,because prefix !== ''\n\t\ta.localName = localName ;\n\t\t//prefix == null for no ns prefix attribute\n\t\tif(nsPrefix !== false){//hack!!\n\t\t\tif(localNSMap == null){\n\t\t\t\tlocalNSMap = {}\n\t\t\t\t//console.log(currentNSMap,0)\n\t\t\t\t_copy(currentNSMap,currentNSMap={})\n\t\t\t\t//console.log(currentNSMap,1)\n\t\t\t}\n\t\t\tcurrentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;\n\t\t\ta.uri = NAMESPACE.XMLNS\n\t\t\tdomBuilder.startPrefixMapping(nsPrefix, value)\n\t\t}\n\t}\n\tvar i = el.length;\n\twhile(i--){\n\t\ta = el[i];\n\t\tvar prefix = a.prefix;\n\t\tif(prefix){//no prefix attribute has no namespace\n\t\t\tif(prefix === 'xml'){\n\t\t\t\ta.uri = NAMESPACE.XML;\n\t\t\t}if(prefix !== 'xmlns'){\n\t\t\t\ta.uri = currentNSMap[prefix || '']\n\n\t\t\t\t//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}\n\t\t\t}\n\t\t}\n\t}\n\tvar nsp = tagName.indexOf(':');\n\tif(nsp>0){\n\t\tprefix = el.prefix = tagName.slice(0,nsp);\n\t\tlocalName = el.localName = tagName.slice(nsp+1);\n\t}else{\n\t\tprefix = null;//important!!\n\t\tlocalName = el.localName = tagName;\n\t}\n\t//no prefix element has default namespace\n\tvar ns = el.uri = currentNSMap[prefix || ''];\n\tdomBuilder.startElement(ns,localName,tagName,el);\n\t//endPrefixMapping and startPrefixMapping have not any help for dom builder\n\t//localNSMap = null\n\tif(el.closed){\n\t\tdomBuilder.endElement(ns,localName,tagName);\n\t\tif(localNSMap){\n\t\t\tfor (prefix in localNSMap) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {\n\t\t\t\t\tdomBuilder.endPrefixMapping(prefix);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}else{\n\t\tel.currentNSMap = currentNSMap;\n\t\tel.localNSMap = localNSMap;\n\t\t//parseStack.push(el);\n\t\treturn true;\n\t}\n}\nfunction parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){\n\tif(/^(?:script|textarea)$/i.test(tagName)){\n\t\tvar elEndStart = source.indexOf('',elStartEnd);\n\t\tvar text = source.substring(elStartEnd+1,elEndStart);\n\t\tif(/[&<]/.test(text)){\n\t\t\tif(/^script$/i.test(tagName)){\n\t\t\t\t//if(!/\\]\\]>/.test(text)){\n\t\t\t\t\t//lexHandler.startCDATA();\n\t\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\t\t//lexHandler.endCDATA();\n\t\t\t\t\treturn elEndStart;\n\t\t\t\t//}\n\t\t\t}//}else{//text area\n\t\t\t\ttext = text.replace(/&#?\\w+;/g,entityReplacer);\n\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\treturn elEndStart;\n\t\t\t//}\n\n\t\t}\n\t}\n\treturn elStartEnd+1;\n}\nfunction fixSelfClosed(source,elStartEnd,tagName,closeMap){\n\t//if(tagName in closeMap){\n\tvar pos = closeMap[tagName];\n\tif(pos == null){\n\t\t//console.log(tagName)\n\t\tpos = source.lastIndexOf('')\n\t\tif(pos',start+4);\n\t\t\t//append comment source.substring(4,end)//